PageSourceSearch

https://weyaxi-merge-lora.hf.space/assets/Index-42ed4a43.js

js weyaxi-merge-lora.hf.space collected 2026-10-03 10:23:53 UTC 105,946 bytes, 3,906 lines download raw bytes

1import { a as Button, B as Block } from './Button-05bf7cea.js';
2import { S as Static } from './Index-2cec2c56.js';
3import { d as dequal } from './index-21d69e4c.js';
4import { c as copy } from './utils-8f25e669.js';
5import { U as Upload } from './Upload-02e4db12.js';
6/* empty css                                                     */import './Index.svelte_svelte_type_style_lang-09b631ef.js';
7import { M as MarkdownCode } from './Example.svelte_svelte_type_style_lang-b83dcc5a.js';
8import { d as dsvFormat } from './dsv-a37bb3db.js';
9export { default as BaseExample } from './Example-7d6bb9b6.js';
10import './index-5550136d.js';
11import './svelte/svelte.js';
12
13const EditableCell_svelte_svelte_type_style_lang = '';
14
15/* home/runner/work/gradio/gradio/js/dataframe/shared/EditableCell.svelte generated by Svelte v4.2.2 */
16const {
17	HtmlTag,
18	SvelteComponent: SvelteComponent$3,
19	action_destroyer: action_destroyer$1,
20	attr: attr$2,
21	binding_callbacks: binding_callbacks$2,
22	bubble,
23	check_outros: check_outros$2,
24	create_component: create_component$2,
25	destroy_component: destroy_component$2,
26	detach: detach$3,
27	element: element$2,
28	empty: empty$2,
29	group_outros: group_outros$2,
30	init: init$3,
31	insert: insert$3,
32	listen: listen$2,
33	mount_component: mount_component$2,
34	noop,
35	prevent_default,
36	run_all: run_all$1,
37	safe_not_equal: safe_not_equal$3,
38	set_data: set_data$1,
39	set_input_value,
40	space: space$3,
41	text: text$2,
42	toggle_class: toggle_class$1,
43	transition_in: transition_in$3,
44	transition_out: transition_out$3
45} = window.__gradio__svelte__internal;
46const { createEventDispatcher: createEventDispatcher$1 } = window.__gradio__svelte__internal;
47function create_if_block_2$1(ctx) {
48	let input;
49	let mounted;
50	let dispose;
51
52	return {
53		c() {
54			input = element$2("input");
55			attr$2(input, "tabindex", "-1");
56			attr$2(input, "class", "svelte-q8uklq");
57			toggle_class$1(input, "header", /*header*/ ctx[5]);
58		},
59		m(target, anchor) {
60			insert$3(target, input, anchor);
61			/*input_binding*/ ctx[18](input);
62			set_input_value(input, /*_value*/ ctx[10]);
63
64			if (!mounted) {
65				dispose = [
66					listen$2(input, "input", /*input_input_handler*/ ctx[19]),
67					listen$2(input, "blur", /*handle_blur*/ ctx[12]),
68					action_destroyer$1(/*use_focus*/ ctx[11].call(null, input)),
69					listen$2(input, "keydown", /*keydown_handler*/ ctx[17])
70				];
71
72				mounted = true;
73			}
74		},
75		p(ctx, dirty) {
76			if (dirty & /*_value*/ 1024 && input.value !== /*_value*/ ctx[10]) {
77				set_input_value(input, /*_value*/ ctx[10]);
78			}
79
80			if (dirty & /*header*/ 32) {
81				toggle_class$1(input, "header", /*header*/ ctx[5]);
82			}
83		},
84		d(detaching) {
85			if (detaching) {
86				detach$3(input);
87			}
88
89			/*input_binding*/ ctx[18](null);
90			mounted = false;
91			run_all$1(dispose);
92		}
93	};
94}
95
96// (62:1) {:else}
97function create_else_block(ctx) {
98	let t_value = (/*editable*/ ctx[9]
99	? /*value*/ ctx[0]
100	: /*display_value*/ ctx[3] || /*value*/ ctx[0]) + "";
101
102	let t;
103
104	return {
105		c() {
106			t = text$2(t_value);
107		},
108		m(target, anchor) {
109			insert$3(target, t, anchor);
110		},
111		p(ctx, dirty) {
112			if (dirty & /*editable, value, display_value*/ 521 && t_value !== (t_value = (/*editable*/ ctx[9]
113			? /*value*/ ctx[0]
114			: /*display_value*/ ctx[3] || /*value*/ ctx[0]) + "")) set_data$1(t, t_value);
115		},
116		i: noop,
117		o: noop,
118		d(detaching) {
119			if (detaching) {
120				detach$3(t);
121			}
122		}
123	};
124}
125
126// (55:35) 
127function create_if_block_1$1(ctx) {
128	let markdowncode;
129	let current;
130
131	markdowncode = new MarkdownCode({
132			props: {
133				message: /*value*/ ctx[0].toLocaleString(),
134				latex_delimiters: /*latex_delimiters*/ ctx[7],
135				line_breaks: /*line_breaks*/ ctx[8],
136				chatbot: false
137			}
138		});
139
140	return {
141		c() {
142			create_component$2(markdowncode.$$.fragment);
143		},
144		m(target, anchor) {
145			mount_component$2(markdowncode, target, anchor);
146			current = true;
147		},
148		p(ctx, dirty) {
149			const markdowncode_changes = {};
150			if (dirty & /*value*/ 1) markdowncode_changes.message = /*value*/ ctx[0].toLocaleString();
151			if (dirty & /*latex_delimiters*/ 128) markdowncode_changes.latex_delimiters = /*latex_delimiters*/ ctx[7];
152			if (dirty & /*line_breaks*/ 256) markdowncode_changes.line_breaks = /*line_breaks*/ ctx[8];
153			markdowncode.$set(markdowncode_changes);
154		},
155		i(local) {
156			if (current) return;
157			transition_in$3(markdowncode.$$.fragment, local);
158			current = true;
159		},
160		o(local) {
161			transition_out$3(markdowncode.$$.fragment, local);
162			current = false;
163		},
164		d(detaching) {
165			destroy_component$2(markdowncode, detaching);
166		}
167	};
168}
169
170// (53:1) {#if datatype === "html"}
171function create_if_block$2(ctx) {
172	let html_tag;
173	let html_anchor;
174
175	return {
176		c() {
177			html_tag = new HtmlTag(false);
178			html_anchor = empty$2();
179			html_tag.a = html_anchor;
180		},
181		m(target, anchor) {
182			html_tag.m(/*value*/ ctx[0], target, anchor);
183			insert$3(target, html_anchor, anchor);
184		},
185		p(ctx, dirty) {
186			if (dirty & /*value*/ 1) html_tag.p(/*value*/ ctx[0]);
187		},
188		i: noop,
189		o: noop,
190		d(detaching) {
191			if (detaching) {
192				detach$3(html_anchor);
193				html_tag.d();
194			}
195		}
196	};
197}
198
199function create_fragment$3(ctx) {
200	let t;
201	let span;
202	let current_block_type_index;
203	let if_block1;
204	let current;
205	let mounted;
206	let dispose;
207	let if_block0 = /*edit*/ ctx[2] && create_if_block_2$1(ctx);
208	const if_block_creators = [create_if_block$2, create_if_block_1$1, create_else_block];
209	const if_blocks = [];
210
211	function select_block_type(ctx, dirty) {
212		if (/*datatype*/ ctx[6] === "html") return 0;
213		if (/*datatype*/ ctx[6] === "markdown") return 1;
214		return 2;
215	}
216
217	current_block_type_index = select_block_type(ctx);
218	if_block1 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
219
220	return {
221		c() {
222			if (if_block0) if_block0.c();
223			t = space$3();
224			span = element$2("span");
225			if_block1.c();
226			attr$2(span, "tabindex", "-1");
227			attr$2(span, "role", "button");
228			attr$2(span, "style", /*styling*/ ctx[4]);
229			attr$2(span, "class", "svelte-q8uklq");
230			toggle_class$1(span, "edit", /*edit*/ ctx[2]);
231		},
232		m(target, anchor) {
233			if (if_block0) if_block0.m(target, anchor);
234			insert$3(target, t, anchor);
235			insert$3(target, span, anchor);
236			if_blocks[current_block_type_index].m(span, null);
237			current = true;
238
239			if (!mounted) {
240				dispose = [
241					listen$2(span, "dblclick", /*dblclick_handler*/ ctx[15]),
242					listen$2(span, "focus", prevent_default(/*focus_handler*/ ctx[16]))
243				];
244
245				mounted = true;
246			}
247		},
248		p(ctx, [dirty]) {
249			if (/*edit*/ ctx[2]) {
250				if (if_block0) {
251					if_block0.p(ctx, dirty);
252				} else {
253					if_block0 = create_if_block_2$1(ctx);
254					if_block0.c();
255					if_block0.m(t.parentNode, t);
256				}
257			} else if (if_block0) {
258				if_block0.d(1);
259				if_block0 = null;
260			}
261
262			let previous_block_index = current_block_type_index;
263			current_block_type_index = select_block_type(ctx);
264
265			if (current_block_type_index === previous_block_index) {
266				if_blocks[current_block_type_index].p(ctx, dirty);
267			} else {
268				group_outros$2();
269
270				transition_out$3(if_blocks[previous_block_index], 1, 1, () => {
271					if_blocks[previous_block_index] = null;
272				});
273
274				check_outros$2();
275				if_block1 = if_blocks[current_block_type_index];
276
277				if (!if_block1) {
278					if_block1 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
279					if_block1.c();
280				} else {
281					if_block1.p(ctx, dirty);
282				}
283
284				transition_in$3(if_block1, 1);
285				if_block1.m(span, null);
286			}
287
288			if (!current || dirty & /*styling*/ 16) {
289				attr$2(span, "style", /*styling*/ ctx[4]);
290			}
291
292			if (!current || dirty & /*edit*/ 4) {
293				toggle_class$1(span, "edit", /*edit*/ ctx[2]);
294			}
295		},
296		i(local) {
297			if (current) return;
298			transition_in$3(if_block1);
299			current = true;
300		},
301		o(local) {
302			transition_out$3(if_block1);
303			current = false;
304		},
305		d(detaching) {
306			if (detaching) {
307				detach$3(t);
308				detach$3(span);
309			}
310
311			if (if_block0) if_block0.d(detaching);
312			if_blocks[current_block_type_index].d();
313			mounted = false;
314			run_all$1(dispose);
315		}
316	};
317}
318
319function instance$3($$self, $$props, $$invalidate) {
320	let _value;
321	let { edit } = $$props;
322	let { value = "" } = $$props;
323	let { display_value = null } = $$props;
324	let { styling = "" } = $$props;
325	let { header = false } = $$props;
326	let { datatype = "str" } = $$props;
327	let { latex_delimiters } = $$props;
328	let { clear_on_focus = false } = $$props;
329	let { select_on_focus = false } = $$props;
330	let { line_breaks = true } = $$props;
331	let { editable = true } = $$props;
332	const dispatch = createEventDispatcher$1();
333	let { el } = $$props;
334
335	function use_focus(node) {
336		if (clear_on_focus) {
337			$$invalidate(10, _value = "");
338		}
339
340		if (select_on_focus) {
341			node.select();
342		}
343
344		node.focus();
345		return {};
346	}
347
348	function handle_blur({ currentTarget }) {
349		$$invalidate(0, value = currentTarget.value);
350		dispatch("blur");
351	}
352
353	function dblclick_handler(event) {
354		bubble.call(this, $$self, event);
355	}
356
357	function focus_handler(event) {
358		bubble.call(this, $$self, event);
359	}
360
361	function keydown_handler(event) {
362		bubble.call(this, $$self, event);
363	}
364
365	function input_binding($$value) {
366		binding_callbacks$2[$$value ? 'unshift' : 'push'](() => {
367			el = $$value;
368			$$invalidate(1, el);
369		});
370	}
371
372	function input_input_handler() {
373		_value = this.value;
374		($$invalidate(10, _value), $$invalidate(0, value));
375	}
376
377	$$self.$$set = $$props => {
378		if ('edit' in $$props) $$invalidate(2, edit = $$props.edit);
379		if ('value' in $$props) $$invalidate(0, value = $$props.value);
380		if ('display_value' in $$props) $$invalidate(3, display_value = $$props.display_value);
381		if ('styling' in $$props) $$invalidate(4, styling = $$props.styling);
382		if ('header' in $$props) $$invalidate(5, header = $$props.header);
383		if ('datatype' in $$props) $$invalidate(6, datatype = $$props.datatype);
384		if ('latex_delimiters' in $$props) $$invalidate(7, latex_delimiters = $$props.latex_delimiters);
385		if ('clear_on_focus' in $$props) $$invalidate(13, clear_on_focus = $$props.clear_on_focus);
386		if ('select_on_focus' in $$props) $$invalidate(14, select_on_focus = $$props.select_on_focus);
387		if ('line_breaks' in $$props) $$invalidate(8, line_breaks = $$props.line_breaks);
388		if ('editable' in $$props) $$invalidate(9, editable = $$props.editable);
389		if ('el' in $$props) $$invalidate(1, el = $$props.el);
390	};
391
392	$$self.$$.update = () => {
393		if ($$self.$$.dirty & /*value*/ 1) {
394			$$invalidate(10, _value = value);
395		}
396	};
397
398	return [
399		value,
400		el,
401		edit,
402		display_value,
403		styling,
404		header,
405		datatype,
406		latex_delimiters,
407		line_breaks,
408		editable,
409		_value,
410		use_focus,
411		handle_blur,
412		clear_on_focus,
413		select_on_focus,
414		dblclick_handler,
415		focus_handler,
416		keydown_handler,
417		input_binding,
418		input_input_handler
419	];
420}
421
422class EditableCell extends SvelteComponent$3 {
423	constructor(options) {
424		super();
425
426		init$3(this, options, instance$3, create_fragment$3, safe_not_equal$3, {
427			edit: 2,
428			value: 0,
429			display_value: 3,
430			styling: 4,
431			header: 5,
432			datatype: 6,
433			latex_delimiters: 7,
434			clear_on_focus: 13,
435			select_on_focus: 14,
436			line_breaks: 8,
437			editable: 9,
438			el: 1
439		});
440	}
441}
442
443const VirtualTable_svelte_svelte_type_style_lang = '';
444
445/* home/runner/work/gradio/gradio/js/dataframe/shared/VirtualTable.svelte generated by Svelte v4.2.2 */
446const {
447	SvelteComponent: SvelteComponent$2,
448	add_iframe_resize_listener: add_iframe_resize_listener$1,
449	add_render_callback: add_render_callback$1,
450	append: append$1,
451	attr: attr$1,
452	binding_callbacks: binding_callbacks$1,
453	check_outros: check_outros$1,
454	create_slot,
455	detach: detach$2,
456	element: element$1,
457	empty: empty$1,
458	ensure_array_like: ensure_array_like$1,
459	get_all_dirty_from_scope,
460	get_slot_changes,
461	group_outros: group_outros$1,
462	init: init$2,
463	insert: insert$2,
464	listen: listen$1,
465	outro_and_destroy_block: outro_and_destroy_block$1,
466	safe_not_equal: safe_not_equal$2,
467	set_style: set_style$1,
468	space: space$2,
469	text: text$1,
470	transition_in: transition_in$2,
471	transition_out: transition_out$2,
472	update_keyed_each: update_keyed_each$1,
473	update_slot_base
474} = window.__gradio__svelte__internal;
475const { onMount: onMount$1, tick: tick$1 } = window.__gradio__svelte__internal;const get_tfoot_slot_changes = dirty => ({});
476const get_tfoot_slot_context = ctx => ({});
477
478function get_each_context$1(ctx, list, i) {
479	const child_ctx = ctx.slice();
480	child_ctx[34] = list[i];
481	return child_ctx;
482}
483
484const get_tbody_slot_changes = dirty => ({
485	item: dirty[0] & /*visible*/ 256,
486	index: dirty[0] & /*visible*/ 256
487});
488
489const get_tbody_slot_context = ctx => ({
490	item: /*item*/ ctx[34].data,
491	index: /*item*/ ctx[34].index
492});
493
494const get_thead_slot_changes = dirty => ({});
495const get_thead_slot_context = ctx => ({});
496
497// (217:3) {#if visible.length && visible[0].data.length}
498function create_if_block$1(ctx) {
499	let each_blocks = [];
500	let each_1_lookup = new Map();
501	let each_1_anchor;
502	let current;
503	let each_value = ensure_array_like$1(/*visible*/ ctx[8]);
504	const get_key = ctx => /*item*/ ctx[34].data[0].id;
505
506	for (let i = 0; i < each_value.length; i += 1) {
507		let child_ctx = get_each_context$1(ctx, each_value, i);
508		let key = get_key(child_ctx);
509		each_1_lookup.set(key, each_blocks[i] = create_each_block$1(key, child_ctx));
510	}
511
512	return {
513		c() {
514			for (let i = 0; i < each_blocks.length; i += 1) {
515				each_blocks[i].c();
516			}
517
518			each_1_anchor = empty$1();
519		},
520		m(target, anchor) {
521			for (let i = 0; i < each_blocks.length; i += 1) {
522				if (each_blocks[i]) {
523					each_blocks[i].m(target, anchor);
524				}
525			}
526
527			insert$2(target, each_1_anchor, anchor);
528			current = true;
529		},
530		p(ctx, dirty) {
531			if (dirty[0] & /*$$scope, visible*/ 2097408) {
532				each_value = ensure_array_like$1(/*visible*/ ctx[8]);
533				group_outros$1();
534				each_blocks = update_keyed_each$1(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, each_1_anchor.parentNode, outro_and_destroy_block$1, create_each_block$1, each_1_anchor, get_each_context$1);
535				check_outros$1();
536			}
537		},
538		i(local) {
539			if (current) return;
540
541			for (let i = 0; i < each_value.length; i += 1) {
542				transition_in$2(each_blocks[i]);
543			}
544
545			current = true;
546		},
547		o(local) {
548			for (let i = 0; i < each_blocks.length; i += 1) {
549				transition_out$2(each_blocks[i]);
550			}
551
552			current = false;
553		},
554		d(detaching) {
555			if (detaching) {
556				detach$2(each_1_anchor);
557			}
558
559			for (let i = 0; i < each_blocks.length; i += 1) {
560				each_blocks[i].d(detaching);
561			}
562		}
563	};
564}
565
566// (219:60)        Missing Table Row      
567function fallback_block(ctx) {
568	let t;
569
570	return {
571		c() {
572			t = text$1("Missing Table Row\n\t\t\t\t\t");
573		},
574		m(target, anchor) {
575			insert$2(target, t, anchor);
576		},
577		d(detaching) {
578			if (detaching) {
579				detach$2(t);
580			}
581		}
582	};
583}
584
585// (218:4) {#each visible as item (item.data[0].id)}
586function create_each_block$1(key_1, ctx) {
587	let first;
588	let current;
589	const tbody_slot_template = /*#slots*/ ctx[22].tbody;
590	const tbody_slot = create_slot(tbody_slot_template, ctx, /*$$scope*/ ctx[21], get_tbody_slot_context);
591	const tbody_slot_or_fallback = tbody_slot || fallback_block();
592
593	return {
594		key: key_1,
595		first: null,
596		c() {
597			first = empty$1();
598			if (tbody_slot_or_fallback) tbody_slot_or_fallback.c();
599			this.first = first;
600		},
601		m(target, anchor) {
602			insert$2(target, first, anchor);
603
604			if (tbody_slot_or_fallback) {
605				tbody_slot_or_fallback.m(target, anchor);
606			}
607
608			current = true;
609		},
610		p(new_ctx, dirty) {
611			ctx = new_ctx;
612
613			if (tbody_slot) {
614				if (tbody_slot.p && (!current || dirty[0] & /*$$scope, visible*/ 2097408)) {
615					update_slot_base(
616						tbody_slot,
617						tbody_slot_template,
618						ctx,
619						/*$$scope*/ ctx[21],
620						!current
621						? get_all_dirty_from_scope(/*$$scope*/ ctx[21])
622						: get_slot_changes(tbody_slot_template, /*$$scope*/ ctx[21], dirty, get_tbody_slot_changes),
623						get_tbody_slot_context
624					);
625				}
626			}
627		},
628		i(local) {
629			if (current) return;
630			transition_in$2(tbody_slot_or_fallback, local);
631			current = true;
632		},
633		o(local) {
634			transition_out$2(tbody_slot_or_fallback, local);
635			current = false;
636		},
637		d(detaching) {
638			if (detaching) {
639				detach$2(first);
640			}
641
642			if (tbody_slot_or_fallback) tbody_slot_or_fallback.d(detaching);
643		}
644	};
645}
646
647function create_fragment$2(ctx) {
648	let svelte_virtual_table_viewport;
649	let table;
650	let thead;
651	let thead_resize_listener;
652	let t0;
653	let tbody;
654	let t1;
655	let tfoot;
656	let tfoot_resize_listener;
657	let table_resize_listener;
658	let current;
659	let mounted;
660	let dispose;
661	const thead_slot_template = /*#slots*/ ctx[22].thead;
662	const thead_slot = create_slot(thead_slot_template, ctx, /*$$scope*/ ctx[21], get_thead_slot_context);
663	let if_block = /*visible*/ ctx[8].length && /*visible*/ ctx[8][0].data.length && create_if_block$1(ctx);
664	const tfoot_slot_template = /*#slots*/ ctx[22].tfoot;
665	const tfoot_slot = create_slot(tfoot_slot_template, ctx, /*$$scope*/ ctx[21], get_tfoot_slot_context);
666
667	return {
668		c() {
669			svelte_virtual_table_viewport = element$1("svelte-virtual-table-viewport");
670			table = element$1("table");
671			thead = element$1("thead");
672			if (thead_slot) thead_slot.c();
673			t0 = space$2();
674			tbody = element$1("tbody");
675			if (if_block) if_block.c();
676			t1 = space$2();
677			tfoot = element$1("tfoot");
678			if (tfoot_slot) tfoot_slot.c();
679			attr$1(thead, "class", "thead svelte-1jok1de");
680			add_render_callback$1(() => /*thead_elementresize_handler*/ ctx[23].call(thead));
681			attr$1(tbody, "class", "tbody svelte-1jok1de");
682			attr$1(tfoot, "class", "tfoot svelte-1jok1de");
683			add_render_callback$1(() => /*tfoot_elementresize_handler*/ ctx[25].call(tfoot));
684			attr$1(table, "class", "table svelte-1jok1de");
685			set_style$1(table, "height", height);
686			set_style$1(table, "--bw-svt-p-top", /*top*/ ctx[5] + "px");
687			set_style$1(table, "--bw-svt-p-bottom", /*bottom*/ ctx[1] + "px");
688			set_style$1(table, "--bw-svt-head-height", /*head_height*/ ctx[3] + "px");
689			set_style$1(table, "--bw-svt-foot-height", /*foot_height*/ ctx[4] + "px");
690			set_style$1(table, "--bw-svt-avg-row-height", /*average_height*/ ctx[0] + "px");
691			add_render_callback$1(() => /*table_elementresize_handler*/ ctx[27].call(table));
692		},
693		m(target, anchor) {
694			insert$2(target, svelte_virtual_table_viewport, anchor);
695			append$1(svelte_virtual_table_viewport, table);
696			append$1(table, thead);
697
698			if (thead_slot) {
699				thead_slot.m(thead, null);
700			}
701
702			thead_resize_listener = add_iframe_resize_listener$1(thead, /*thead_elementresize_handler*/ ctx[23].bind(thead));
703			append$1(table, t0);
704			append$1(table, tbody);
705			if (if_block) if_block.m(tbody, null);
706			/*tbody_binding*/ ctx[24](tbody);
707			append$1(table, t1);
708			append$1(table, tfoot);
709
710			if (tfoot_slot) {
711				tfoot_slot.m(tfoot, null);
712			}
713
714			tfoot_resize_listener = add_iframe_resize_listener$1(tfoot, /*tfoot_elementresize_handler*/ ctx[25].bind(tfoot));
715			/*table_binding*/ ctx[26](table);
716			table_resize_listener = add_iframe_resize_listener$1(table, /*table_elementresize_handler*/ ctx[27].bind(table));
717			current = true;
718
719			if (!mounted) {
720				dispose = listen$1(table, "scroll", /*handle_scroll*/ ctx[9]);
721				mounted = true;
722			}
723		},
724		p(ctx, dirty) {
725			if (thead_slot) {
726				if (thead_slot.p && (!current || dirty[0] & /*$$scope*/ 2097152)) {
727					update_slot_base(
728						thead_slot,
729						thead_slot_template,
730						ctx,
731						/*$$scope*/ ctx[21],
732						!current
733						? get_all_dirty_from_scope(/*$$scope*/ ctx[21])
734						: get_slot_changes(thead_slot_template, /*$$scope*/ ctx[21], dirty, get_thead_slot_changes),
735						get_thead_slot_context
736					);
737				}
738			}
739
740			if (/*visible*/ ctx[8].length && /*visible*/ ctx[8][0].data.length) {
741				if (if_block) {
742					if_block.p(ctx, dirty);
743
744					if (dirty[0] & /*visible*/ 256) {
745						transition_in$2(if_block, 1);
746					}
747				} else {
748					if_block = create_if_block$1(ctx);
749					if_block.c();
750					transition_in$2(if_block, 1);
751					if_block.m(tbody, null);
752				}
753			} else if (if_block) {
754				group_outros$1();
755
756				transition_out$2(if_block, 1, 1, () => {
757					if_block = null;
758				});
759
760				check_outros$1();
761			}
762
763			if (tfoot_slot) {
764				if (tfoot_slot.p && (!current || dirty[0] & /*$$scope*/ 2097152)) {
765					update_slot_base(
766						tfoot_slot,
767						tfoot_slot_template,
768						ctx,
769						/*$$scope*/ ctx[21],
770						!current
771						? get_all_dirty_from_scope(/*$$scope*/ ctx[21])
772						: get_slot_changes(tfoot_slot_template, /*$$scope*/ ctx[21], dirty, get_tfoot_slot_changes),
773						get_tfoot_slot_context
774					);
775				}
776			}
777
778			if (!current || dirty[0] & /*top*/ 32) {
779				set_style$1(table, "--bw-svt-p-top", /*top*/ ctx[5] + "px");
780			}
781
782			if (!current || dirty[0] & /*bottom*/ 2) {
783				set_style$1(table, "--bw-svt-p-bottom", /*bottom*/ ctx[1] + "px");
784			}
785
786			if (!current || dirty[0] & /*head_height*/ 8) {
787				set_style$1(table, "--bw-svt-head-height", /*head_height*/ ctx[3] + "px");
788			}
789
790			if (!current || dirty[0] & /*foot_height*/ 16) {
791				set_style$1(table, "--bw-svt-foot-height", /*foot_height*/ ctx[4] + "px");
792			}
793
794			if (!current || dirty[0] & /*average_height*/ 1) {
795				set_style$1(table, "--bw-svt-avg-row-height", /*average_height*/ ctx[0] + "px");
796			}
797		},
798		i(local) {
799			if (current) return;
800			transition_in$2(thead_slot, local);
801			transition_in$2(if_block);
802			transition_in$2(tfoot_slot, local);
803			current = true;
804		},
805		o(local) {
806			transition_out$2(thead_slot, local);
807			transition_out$2(if_block);
808			transition_out$2(tfoot_slot, local);
809			current = false;
810		},
811		d(detaching) {
812			if (detaching) {
813				detach$2(svelte_virtual_table_viewport);
814			}
815
816			if (thead_slot) thead_slot.d(detaching);
817			thead_resize_listener();
818			if (if_block) if_block.d();
819			/*tbody_binding*/ ctx[24](null);
820			if (tfoot_slot) tfoot_slot.d(detaching);
821			tfoot_resize_listener();
822			/*table_binding*/ ctx[26](null);
823			table_resize_listener();
824			mounted = false;
825			dispose();
826		}
827	};
828}
829
830let height = "100%";
831
832function get_computed_px_amount(elem, property) {
833	if (!elem) {
834		return 0;
835	}
836
837	const compStyle = getComputedStyle(elem);
838	let x = parseInt(compStyle.getPropertyValue(property));
839	return x;
840}
841
842function instance$2($$self, $$props, $$invalidate) {
843	let sortedItems;
844	let { $$slots: slots = {}, $$scope } = $$props;
845	let { items = [] } = $$props;
846	let { table_width } = $$props;
847	let { max_height } = $$props;
848	let { actual_height } = $$props;
849	let { table_scrollbar_width } = $$props;
850	let { start = 0 } = $$props;
851	let { end = 0 } = $$props;
852	let { selected } = $$props;
853	let average_height;
854	let bottom = 0;
855	let contents;
856	let head_height = 0;
857	let foot_height = 0;
858	let height_map = [];
859	let mounted;
860	let rows;
861	let top = 0;
862	let viewport;
863	let viewport_height = 0;
864	let visible = [];
865	let content_height = 0;
866
867	async function refresh_height_map(_items) {
868		if (viewport_height === 0 || table_width === 0) {
869			return;
870		}
871
872		const { scrollTop } = viewport;
873		$$invalidate(13, table_scrollbar_width = viewport.offsetWidth - viewport.clientWidth);
874		content_height = top - (scrollTop - head_height);
875		let i = start;
876
877		while (content_height < max_height && i < _items.length) {
878			let row = rows[i - start];
879
880			if (!row) {
881				$$invalidate(11, end = i + 1);
882				await tick$1(); // render the newly visible row
883				row = rows[i - start];
884			}
885
886			let _h = row?.getBoundingClientRect().height;
887
888			if (!_h) {
889				_h = average_height;
890			}
891
892			const row_height = height_map[i] = _h;
893			content_height += row_height;
894			i += 1;
895		}
896
897		$$invalidate(11, end = i);
898		const remaining = _items.length - end;
899		const scrollbar_height = viewport.offsetHeight - viewport.clientHeight;
900
901		if (scrollbar_height > 0) {
902			content_height += scrollbar_height;
903		}
904
905		let filtered_height_map = height_map.filter(v => typeof v === "number");
906		$$invalidate(0, average_height = filtered_height_map.reduce((a, b) => a + b, 0) / filtered_height_map.length);
907		$$invalidate(1, bottom = remaining * average_height);
908		height_map.length = _items.length;
909		await tick$1();
910
911		if (!max_height) {
912			$$invalidate(12, actual_height = content_height + 1);
913		} else if (content_height < max_height) {
914			$$invalidate(12, actual_height = content_height + 2);
915		} else {
916			$$invalidate(12, actual_height = max_height);
917		}
918
919		await tick$1();
920	}
921
922	async function scroll_and_render(n) {
923		requestAnimationFrame(async () => {
924			if (typeof n !== "number") return;
925			const direction = typeof n !== "number" ? false : is_in_view(n);
926
927			if (direction === true) {
928				return;
929			}
930
931			if (direction === "back") {
932				await scroll_to_index(n, { behavior: "instant" });
933			}
934
935			if (direction === "forwards") {
936				await scroll_to_index(n, { behavior: "instant" }, true);
937			}
938		});
939	}
940
941	function is_in_view(n) {
942		const current = rows && rows[n - start];
943
944		if (!current && n < start) {
945			return "back";
946		}
947
948		if (!current && n >= end - 1) {
949			return "forwards";
950		}
951
952		const { top: viewport_top } = viewport.getBoundingClientRect();
953		const { top, bottom } = current.getBoundingClientRect();
954
955		if (top - viewport_top < 37) {
956			return "back";
957		}
958
959		if (bottom - viewport_top > viewport_height) {
960			return "forwards";
961		}
962
963		return true;
964	}
965
966	async function handle_scroll(e) {
967		const scroll_top = viewport.scrollTop;
968		rows = contents.children;
969		const is_start_overflow = sortedItems.length < start;
970		const row_top_border = get_computed_px_amount(rows[1], "border-top-width");
971		const actual_border_collapsed_width = 0;
972
973		if (is_start_overflow) {
974			await scroll_to_index(sortedItems.length - 1, { behavior: "auto" });
975		}
976
977		let new_start = 0;
978
979		// acquire height map for currently visible rows
980		for (let v = 0; v < rows.length; v += 1) {
981			height_map[start + v] = rows[v].getBoundingClientRect().height;
982		}
983
984		let i = 0;
985
986		// start from top: thead, with its borders, plus the first border to afterwards neglect
987		let y = head_height + row_top_border / 2;
988
989		let row_heights = [];
990
991		// loop items to find new start
992		while (i < sortedItems.length) {
993			const row_height = height_map[i] || average_height;
994			row_heights[i] = row_height;
995
996			// we only want to jump if the full (incl. border) row is away
997			if (y + row_height + actual_border_collapsed_width > scroll_top) {
998				// this is the last index still inside the viewport
999				new_start = i;
1000
1001				$$invalidate(5, top = y - (head_height + row_top_border / 2));
1002				break;
1003			}
1004
1005			y += row_height;
1006			i += 1;
1007		}
1008
1009		new_start = Math.max(0, new_start);
1010
1011		while (i < sortedItems.length) {
1012			const row_height = height_map[i] || average_height;
1013			y += row_height;
1014			i += 1;
1015
1016			if (y > scroll_top + viewport_height) {
1017				break;
1018			}
1019		}
1020
1021		$$invalidate(10, start = new_start);
1022		$$invalidate(11, end = i);
1023		const remaining = sortedItems.length - end;
1024
1025		if (end === 0) {
1026			$$invalidate(11, end = 10);
1027		}
1028
1029		$$invalidate(0, average_height = (y - head_height) / end);
1030		let remaining_height = remaining * average_height; // 0
1031
1032		// compute height map for remaining items
1033		while (i < sortedItems.length) {
1034			i += 1;
1035			height_map[i] = average_height;
1036		}
1037
1038		$$invalidate(1, bottom = remaining_height);
1039
1040		if (!isFinite(bottom)) {
1041			$$invalidate(1, bottom = 200000);
1042		}
1043	}
1044
1045	async function scroll_to_index(index, opts, align_end = false) {
1046		await tick$1();
1047		const _itemHeight = average_height;
1048		let distance = index * _itemHeight;
1049
1050		if (align_end) {
1051			distance = distance - viewport_height + _itemHeight + head_height;
1052		}
1053
1054		const scrollbar_height = viewport.offsetHeight - viewport.clientHeight;
1055
1056		if (scrollbar_height > 0) {
1057			distance += scrollbar_height;
1058		}
1059
1060		const _opts = {
1061			top: distance,
1062			behavior: "smooth",
1063			...opts
1064		};
1065
1066		viewport.scrollTo(_opts);
1067	}
1068
1069	onMount$1(() => {
1070		rows = contents.children;
1071		$$invalidate(19, mounted = true);
1072		refresh_height_map(items);
1073	});
1074
1075	function thead_elementresize_handler() {
1076		head_height = this.offsetHeight;
1077		$$invalidate(3, head_height);
1078	}
1079
1080	function tbody_binding($$value) {
1081		binding_callbacks$1[$$value ? 'unshift' : 'push'](() => {
1082			contents = $$value;
1083			$$invalidate(2, contents);
1084		});
1085	}
1086
1087	function tfoot_elementresize_handler() {
1088		foot_height = this.offsetHeight;
1089		$$invalidate(4, foot_height);
1090	}
1091
1092	function table_binding($$value) {
1093		binding_callbacks$1[$$value ? 'unshift' : 'push'](() => {
1094			viewport = $$value;
1095			$$invalidate(6, viewport);
1096		});
1097	}
1098
1099	function table_elementresize_handler() {
1100		viewport_height = this.offsetHeight;
1101		$$invalidate(7, viewport_height);
1102	}
1103
1104	$$self.$$set = $$props => {
1105		if ('items' in $$props) $$invalidate(14, items = $$props.items);
1106		if ('table_width' in $$props) $$invalidate(15, table_width = $$props.table_width);
1107		if ('max_height' in $$props) $$invalidate(16, max_height = $$props.max_height);
1108		if ('actual_height' in $$props) $$invalidate(12, actual_height = $$props.actual_height);
1109		if ('table_scrollbar_width' in $$props) $$invalidate(13, table_scrollbar_width = $$props.table_scrollbar_width);
1110		if ('start' in $$props) $$invalidate(10, start = $$props.start);
1111		if ('end' in $$props) $$invalidate(11, end = $$props.end);
1112		if ('selected' in $$props) $$invalidate(17, selected = $$props.selected);
1113		if ('$$scope' in $$props) $$invalidate(21, $$scope = $$props.$$scope);
1114	};
1115
1116	$$self.$$.update = () => {
1117		if ($$self.$$.dirty[0] & /*items*/ 16384) {
1118			$$invalidate(20, sortedItems = items);
1119		}
1120
1121		if ($$self.$$.dirty[0] & /*mounted, sortedItems*/ 1572864) {
1122			if (mounted) requestAnimationFrame(() => refresh_height_map(sortedItems));
1123		}
1124
1125		if ($$self.$$.dirty[0] & /*selected*/ 131072) {
1126			scroll_and_render(selected);
1127		}
1128
1129		if ($$self.$$.dirty[0] & /*sortedItems, start, end*/ 1051648) {
1130			$$invalidate(8, visible = sortedItems.slice(start, end).map((data, i) => {
1131				return { index: i + start, data };
1132			}));
1133		}
1134	};
1135
1136	return [
1137		average_height,
1138		bottom,
1139		contents,
1140		head_height,
1141		foot_height,
1142		top,
1143		viewport,
1144		viewport_height,
1145		visible,
1146		handle_scroll,
1147		start,
1148		end,
1149		actual_height,
1150		table_scrollbar_width,
1151		items,
1152		table_width,
1153		max_height,
1154		selected,
1155		scroll_to_index,
1156		mounted,
1157		sortedItems,
1158		$$scope,
1159		slots,
1160		thead_elementresize_handler,
1161		tbody_binding,
1162		tfoot_elementresize_handler,
1163		table_binding,
1164		table_elementresize_handler
1165	];
1166}
1167
1168class VirtualTable extends SvelteComponent$2 {
1169	constructor(options) {
1170		super();
1171
1172		init$2(
1173			this,
1174			options,
1175			instance$2,
1176			create_fragment$2,
1177			safe_not_equal$2,
1178			{
1179				items: 14,
1180				table_width: 15,
1181				max_height: 16,
1182				actual_height: 12,
1183				table_scrollbar_width: 13,
1184				start: 10,
1185				end: 11,
1186				selected: 17,
1187				scroll_to_index: 18
1188			},
1189			null,
1190			[-1, -1]
1191		);
1192	}
1193
1194	get scroll_to_index() {
1195		return this.$$.ctx[18];
1196	}
1197}
1198
1199const Table_svelte_svelte_type_style_lang = '';
1200
1201/* home/runner/work/gradio/gradio/js/dataframe/shared/Table.svelte generated by Svelte v4.2.2 */
1202const {
1203	SvelteComponent: SvelteComponent$1,
1204	action_destroyer,
1205	add_flush_callback,
1206	add_iframe_resize_listener,
1207	add_render_callback,
1208	append,
1209	attr,
1210	bind,
1211	binding_callbacks,
1212	check_outros,
1213	create_component: create_component$1,
1214	destroy_component: destroy_component$1,
1215	detach: detach$1,
1216	element,
1217	empty,
1218	ensure_array_like,
1219	group_outros,
1220	init: init$1,
1221	insert: insert$1,
1222	listen,
1223	mount_component: mount_component$1,
1224	outro_and_destroy_block,
1225	run_all,
1226	safe_not_equal: safe_not_equal$1,
1227	set_data,
1228	set_style,
1229	space: space$1,
1230	svg_element,
1231	text,
1232	toggle_class,
1233	transition_in: transition_in$1,
1234	transition_out: transition_out$1,
1235	update_keyed_each
1236} = window.__gradio__svelte__internal;
1237const { createEventDispatcher, tick, onMount } = window.__gradio__svelte__internal;
1238function get_each_context_1(ctx, list, i) {
1239	const child_ctx = ctx.slice();
1240	child_ctx[12] = list[i].value;
1241	child_ctx[87] = list[i].id;
1242	child_ctx[90] = list;
1243	child_ctx[91] = i;
1244	return child_ctx;
1245}
1246
1247function get_each_context(ctx, list, i) {
1248	const child_ctx = ctx.slice();
1249	child_ctx[12] = list[i].value;
1250	child_ctx[87] = list[i].id;
1251	child_ctx[88] = list;
1252	child_ctx[89] = i;
1253	return child_ctx;
1254}
1255
1256function get_each_context_2(ctx, list, i) {
1257	const child_ctx = ctx.slice();
1258	child_ctx[12] = list[i].value;
1259	child_ctx[87] = list[i].id;
1260	child_ctx[92] = list;
1261	child_ctx[89] = i;
1262	return child_ctx;
1263}
1264
1265function get_each_context_3(ctx, list, i) {
1266	const child_ctx = ctx.slice();
1267	child_ctx[12] = list[i].value;
1268	child_ctx[87] = list[i].id;
1269	child_ctx[91] = i;
1270	return child_ctx;
1271}
1272
1273// (504:1) {#if label && label.length !== 0}
1274function create_if_block_5(ctx) {
1275	let p;
1276	let t;
1277
1278	return {
1279		c() {
1280			p = element("p");
1281			t = text(/*label*/ ctx[1]);
1282			attr(p, "class", "svelte-1bvc1p0");
1283		},
1284		m(target, anchor) {
1285			insert$1(target, p, anchor);
1286			append(p, t);
1287		},
1288		p(ctx, dirty) {
1289			if (dirty[0] & /*label*/ 2) set_data(t, /*label*/ ctx[1]);
1290		},
1291		d(detaching) {
1292			if (detaching) {
1293				detach$1(p);
1294			}
1295		}
1296	};
1297}
1298
1299// (524:3) {#if label && label.length !== 0}
1300function create_if_block_4(ctx) {
1301	let caption;
1302	let t;
1303
1304	return {
1305		c() {
1306			caption = element("caption");
1307			t = text(/*label*/ ctx[1]);
1308			attr(caption, "class", "sr-only");
1309		},
1310		m(target, anchor) {
1311			insert$1(target, caption, anchor);
1312			append(caption, t);
1313		},
1314		p(ctx, dirty) {
1315			if (dirty[0] & /*label*/ 2) set_data(t, /*label*/ ctx[1]);
1316		},
1317		d(detaching) {
1318			if (detaching) {
1319				detach$1(caption);
1320			}
1321		}
1322	};
1323}
1324
1325// (529:5) {#each _headers as { value, id }
1326function create_each_block_3(key_1, ctx) {
1327	let th;
1328	let div1;
1329	let editablecell;
1330	let t0;
1331	let div0;
1332	let svg;
1333	let path;
1334	let div0_class_value;
1335	let t1;
1336	let th_aria_sort_value;
1337	let current;
1338
1339	editablecell = new EditableCell({
1340			props: {
1341				value: /*value*/ ctx[12],
1342				latex_delimiters: /*latex_delimiters*/ ctx[4],
1343				line_breaks: /*line_breaks*/ ctx[10],
1344				header: true,
1345				edit: false,
1346				el: null
1347			}
1348		});
1349
1350	return {
1351		key: key_1,
1352		first: null,
1353		c() {
1354			th = element("th");
1355			div1 = element("div");
1356			create_component$1(editablecell.$$.fragment);
1357			t0 = space$1();
1358			div0 = element("div");
1359			svg = svg_element("svg");
1360			path = svg_element("path");
1361			t1 = space$1();
1362			attr(path, "d", "M4.49999 0L8.3971 6.75H0.602875L4.49999 0Z");
1363			attr(svg, "width", "1em");
1364			attr(svg, "height", "1em");
1365			attr(svg, "viewBox", "0 0 9 7");
1366			attr(svg, "fill", "none");
1367			attr(svg, "xmlns", "http://www.w3.org/2000/svg");
1368			attr(svg, "class", "svelte-1bvc1p0");
1369			attr(div0, "class", div0_class_value = "sort-button " + /*sort_direction*/ ctx[18] + "" + " svelte-1bvc1p0");
1370			toggle_class(div0, "sorted", /*sort_by*/ ctx[19] === /*i*/ ctx[91]);
1371			toggle_class(div0, "des", /*sort_by*/ ctx[19] === /*i*/ ctx[91] && /*sort_direction*/ ctx[18] === "des");
1372			attr(div1, "class", "cell-wrap svelte-1bvc1p0");
1373			attr(th, "aria-sort", th_aria_sort_value = /*get_sort_status*/ ctx[35](/*value*/ ctx[12], /*sort_by*/ ctx[19], /*sort_direction*/ ctx[18]));
1374			attr(th, "class", "svelte-1bvc1p0");
1375			toggle_class(th, "editing", /*header_edit*/ ctx[24] === /*i*/ ctx[91]);
1376
1377			set_style(th, "width", /*column_widths*/ ctx[11].length
1378			? /*column_widths*/ ctx[11][/*i*/ ctx[91]]
1379			: undefined);
1380
1381			this.first = th;
1382		},
1383		m(target, anchor) {
1384			insert$1(target, th, anchor);
1385			append(th, div1);
1386			mount_component$1(editablecell, div1, null);
1387			append(div1, t0);
1388			append(div1, div0);
1389			append(div0, svg);
1390			append(svg, path);
1391			append(th, t1);
1392			current = true;
1393		},
1394		p(new_ctx, dirty) {
1395			ctx = new_ctx;
1396			const editablecell_changes = {};
1397			if (dirty[0] & /*_headers*/ 65536) editablecell_changes.value = /*value*/ ctx[12];
1398			if (dirty[0] & /*latex_delimiters*/ 16) editablecell_changes.latex_delimiters = /*latex_delimiters*/ ctx[4];
1399			if (dirty[0] & /*line_breaks*/ 1024) editablecell_changes.line_breaks = /*line_breaks*/ ctx[10];
1400			editablecell.$set(editablecell_changes);
1401
1402			if (!current || dirty[0] & /*sort_direction*/ 262144 && div0_class_value !== (div0_class_value = "sort-button " + /*sort_direction*/ ctx[18] + "" + " svelte-1bvc1p0")) {
1403				attr(div0, "class", div0_class_value);
1404			}
1405
1406			if (!current || dirty[0] & /*sort_direction, sort_by, _headers*/ 851968) {
1407				toggle_class(div0, "sorted", /*sort_by*/ ctx[19] === /*i*/ ctx[91]);
1408			}
1409
1410			if (!current || dirty[0] & /*sort_direction, sort_by, _headers, sort_direction*/ 851968) {
1411				toggle_class(div0, "des", /*sort_by*/ ctx[19] === /*i*/ ctx[91] && /*sort_direction*/ ctx[18] === "des");
1412			}
1413
1414			if (!current || dirty[0] & /*_headers, sort_by, sort_direction*/ 851968 && th_aria_sort_value !== (th_aria_sort_value = /*get_sort_status*/ ctx[35](/*value*/ ctx[12], /*sort_by*/ ctx[19], /*sort_direction*/ ctx[18]))) {
1415				attr(th, "aria-sort", th_aria_sort_value);
1416			}
1417
1418			if (!current || dirty[0] & /*header_edit, _headers*/ 16842752) {
1419				toggle_class(th, "editing", /*header_edit*/ ctx[24] === /*i*/ ctx[91]);
1420			}
1421
1422			if (dirty[0] & /*column_widths, _headers*/ 67584) {
1423				set_style(th, "width", /*column_widths*/ ctx[11].length
1424				? /*column_widths*/ ctx[11][/*i*/ ctx[91]]
1425				: undefined);
1426			}
1427		},
1428		i(local) {
1429			if (current) return;
1430			transition_in$1(editablecell.$$.fragment, local);
1431			current = true;
1432		},
1433		o(local) {
1434			transition_out$1(editablecell.$$.fragment, local);
1435			current = false;
1436		},
1437		d(detaching) {
1438			if (detaching) {
1439				detach$1(th);
1440			}
1441
1442			destroy_component$1(editablecell);
1443		}
1444	};
1445}
1446
1447// (567:5) {#each max as { value, id }
1448function create_each_block_2(key_1, ctx) {
1449	let td;
1450	let div;
1451	let editablecell;
1452	let t;
1453	let j = /*j*/ ctx[89];
1454	let current;
1455
1456	editablecell = new EditableCell({
1457			props: {
1458				value: /*value*/ ctx[12],
1459				latex_delimiters: /*latex_delimiters*/ ctx[4],
1460				line_breaks: /*line_breaks*/ ctx[10],
1461				datatype: Array.isArray(/*datatype*/ ctx[0])
1462				? /*datatype*/ ctx[0][/*j*/ ctx[89]]
1463				: /*datatype*/ ctx[0],
1464				edit: false,
1465				el: null
1466			}
1467		});
1468
1469	const assign_td = () => /*td_binding*/ ctx[52](td, j);
1470	const unassign_td = () => /*td_binding*/ ctx[52](null, j);
1471
1472	return {
1473		key: key_1,
1474		first: null,
1475		c() {
1476			td = element("td");
1477			div = element("div");
1478			create_component$1(editablecell.$$.fragment);
1479			t = space$1();
1480			attr(div, "class", "cell-wrap svelte-1bvc1p0");
1481			attr(td, "tabindex", "-1");
1482			attr(td, "class", "svelte-1bvc1p0");
1483			this.first = td;
1484		},
1485		m(target, anchor) {
1486			insert$1(target, td, anchor);
1487			append(td, div);
1488			mount_component$1(editablecell, div, null);
1489			append(td, t);
1490			assign_td();
1491			current = true;
1492		},
1493		p(new_ctx, dirty) {
1494			ctx = new_ctx;
1495			const editablecell_changes = {};
1496			if (dirty[1] & /*max*/ 8) editablecell_changes.value = /*value*/ ctx[12];
1497			if (dirty[0] & /*latex_delimiters*/ 16) editablecell_changes.latex_delimiters = /*latex_delimiters*/ ctx[4];
1498			if (dirty[0] & /*line_breaks*/ 1024) editablecell_changes.line_breaks = /*line_breaks*/ ctx[10];
1499
1500			if (dirty[0] & /*datatype*/ 1 | dirty[1] & /*max*/ 8) editablecell_changes.datatype = Array.isArray(/*datatype*/ ctx[0])
1501			? /*datatype*/ ctx[0][/*j*/ ctx[89]]
1502			: /*datatype*/ ctx[0];
1503
1504			editablecell.$set(editablecell_changes);
1505
1506			if (j !== /*j*/ ctx[89]) {
1507				unassign_td();
1508				j = /*j*/ ctx[89];
1509				assign_td();
1510			}
1511		},
1512		i(local) {
1513			if (current) return;
1514			transition_in$1(editablecell.$$.fragment, local);
1515			current = true;
1516		},
1517		o(local) {
1518			transition_out$1(editablecell.$$.fragment, local);
1519			current = false;
1520		},
1521		d(detaching) {
1522			if (detaching) {
1523				detach$1(td);
1524			}
1525
1526			destroy_component$1(editablecell);
1527			unassign_td();
1528		}
1529	};
1530}
1531
1532// (601:4) {#if label && label.length !== 0}
1533function create_if_block_3(ctx) {
1534	let caption;
1535	let t;
1536
1537	return {
1538		c() {
1539			caption = element("caption");
1540			t = text(/*label*/ ctx[1]);
1541			attr(caption, "class", "sr-only");
1542		},
1543		m(target, anchor) {
1544			insert$1(target, caption, anchor);
1545			append(caption, t);
1546		},
1547		p(ctx, dirty) {
1548			if (dirty[0] & /*label*/ 2) set_data(t, /*label*/ ctx[1]);
1549		},
1550		d(detaching) {
1551			if (detaching) {
1552				detach$1(caption);
1553			}
1554		}
1555	};
1556}
1557
1558// (593:3) <VirtualTable     bind:items={data}     table_width={t_width}     max_height={height}     bind:actual_height={table_height}     bind:table_scrollbar_width={scrollbar_width}     selected={selected_index}    >
1559function create_default_slot_3(ctx) {
1560	let if_block_anchor;
1561	let if_block = /*label*/ ctx[1] && /*label*/ ctx[1].length !== 0 && create_if_block_3(ctx);
1562
1563	return {
1564		c() {
1565			if (if_block) if_block.c();
1566			if_block_anchor = empty();
1567		},
1568		m(target, anchor) {
1569			if (if_block) if_block.m(target, anchor);
1570			insert$1(target, if_block_anchor, anchor);
1571		},
1572		p(ctx, dirty) {
1573			if (/*label*/ ctx[1] && /*label*/ ctx[1].length !== 0) {
1574				if (if_block) {
1575					if_block.p(ctx, dirty);
1576				} else {
1577					if_block = create_if_block_3(ctx);
1578					if_block.c();
1579					if_block.m(if_block_anchor.parentNode, if_block_anchor);
1580				}
1581			} else if (if_block) {
1582				if_block.d(1);
1583				if_block = null;
1584			}
1585		},
1586		d(detaching) {
1587			if (detaching) {
1588				detach$1(if_block_anchor);
1589			}
1590
1591			if (if_block) if_block.d(detaching);
1592		}
1593	};
1594}
1595
1596// (605:5) {#each _headers as { value, id }
1597function create_each_block_1(key_1, ctx) {
1598	let th;
1599	let div1;
1600	let editablecell;
1601	let updating_value;
1602	let updating_el;
1603	let t0;
1604	let div0;
1605	let svg;
1606	let path;
1607	let div0_class_value;
1608	let t1;
1609	let th_aria_sort_value;
1610	let current;
1611	let mounted;
1612	let dispose;
1613
1614	function editablecell_value_binding_1(value) {
1615		/*editablecell_value_binding_1*/ ctx[61](value, /*i*/ ctx[91]);
1616	}
1617
1618	function editablecell_el_binding_1(value) {
1619		/*editablecell_el_binding_1*/ ctx[62](value, /*id*/ ctx[87]);
1620	}
1621
1622	function dblclick_handler_1() {
1623		return /*dblclick_handler_1*/ ctx[63](/*i*/ ctx[91]);
1624	}
1625
1626	let editablecell_props = {
1627		latex_delimiters: /*latex_delimiters*/ ctx[4],
1628		line_breaks: /*line_breaks*/ ctx[10],
1629		edit: /*header_edit*/ ctx[24] === /*i*/ ctx[91],
1630		select_on_focus: /*select_on_focus*/ ctx[25],
1631		header: true
1632	};
1633
1634	if (/*_headers*/ ctx[16][/*i*/ ctx[91]].value !== void 0) {
1635		editablecell_props.value = /*_headers*/ ctx[16][/*i*/ ctx[91]].value;
1636	}
1637
1638	if (/*els*/ ctx[22][/*id*/ ctx[87]].input !== void 0) {
1639		editablecell_props.el = /*els*/ ctx[22][/*id*/ ctx[87]].input;
1640	}
1641
1642	editablecell = new EditableCell({ props: editablecell_props });
1643	binding_callbacks.push(() => bind(editablecell, 'value', editablecell_value_binding_1));
1644	binding_callbacks.push(() => bind(editablecell, 'el', editablecell_el_binding_1));
1645	editablecell.$on("keydown", /*end_header_edit*/ ctx[41]);
1646	editablecell.$on("dblclick", dblclick_handler_1);
1647
1648	function click_handler_1() {
1649		return /*click_handler_1*/ ctx[64](/*i*/ ctx[91]);
1650	}
1651
1652	return {
1653		key: key_1,
1654		first: null,
1655		c() {
1656			th = element("th");
1657			div1 = element("div");
1658			create_component$1(editablecell.$$.fragment);
1659			t0 = space$1();
1660			div0 = element("div");
1661			svg = svg_element("svg");
1662			path = svg_element("path");
1663			t1 = space$1();
1664			attr(path, "d", "M4.49999 0L8.3971 6.75H0.602875L4.49999 0Z");
1665			attr(svg, "width", "1em");
1666			attr(svg, "height", "1em");
1667			attr(svg, "viewBox", "0 0 9 7");
1668			attr(svg, "fill", "none");
1669			attr(svg, "xmlns", "http://www.w3.org/2000/svg");
1670			attr(svg, "class", "svelte-1bvc1p0");
1671			attr(div0, "class", div0_class_value = "sort-button " + /*sort_direction*/ ctx[18] + "" + " svelte-1bvc1p0");
1672			toggle_class(div0, "sorted", /*sort_by*/ ctx[19] === /*i*/ ctx[91]);
1673			toggle_class(div0, "des", /*sort_by*/ ctx[19] === /*i*/ ctx[91] && /*sort_direction*/ ctx[18] === "des");
1674			attr(div1, "class", "cell-wrap svelte-1bvc1p0");
1675			attr(th, "aria-sort", th_aria_sort_value = /*get_sort_status*/ ctx[35](/*value*/ ctx[12], /*sort_by*/ ctx[19], /*sort_direction*/ ctx[18]));
1676			set_style(th, "width", "var(--cell-width-" + /*i*/ ctx[91] + ")");
1677			attr(th, "class", "svelte-1bvc1p0");
1678			toggle_class(th, "focus", /*header_edit*/ ctx[24] === /*i*/ ctx[91] || /*selected_header*/ ctx[26] === /*i*/ ctx[91]);
1679			this.first = th;
1680		},
1681		m(target, anchor) {
1682			insert$1(target, th, anchor);
1683			append(th, div1);
1684			mount_component$1(editablecell, div1, null);
1685			append(div1, t0);
1686			append(div1, div0);
1687			append(div0, svg);
1688			append(svg, path);
1689			append(th, t1);
1690			current = true;
1691
1692			if (!mounted) {
1693				dispose = listen(div0, "click", click_handler_1);
1694				mounted = true;
1695			}
1696		},
1697		p(new_ctx, dirty) {
1698			ctx = new_ctx;
1699			const editablecell_changes = {};
1700			if (dirty[0] & /*latex_delimiters*/ 16) editablecell_changes.latex_delimiters = /*latex_delimiters*/ ctx[4];
1701			if (dirty[0] & /*line_breaks*/ 1024) editablecell_changes.line_breaks = /*line_breaks*/ ctx[10];
1702			if (dirty[0] & /*header_edit, _headers*/ 16842752) editablecell_changes.edit = /*header_edit*/ ctx[24] === /*i*/ ctx[91];
1703			if (dirty[0] & /*select_on_focus*/ 33554432) editablecell_changes.select_on_focus = /*select_on_focus*/ ctx[25];
1704
1705			if (!updating_value && dirty[0] & /*_headers*/ 65536) {
1706				updating_value = true;
1707				editablecell_changes.value = /*_headers*/ ctx[16][/*i*/ ctx[91]].value;
1708				add_flush_callback(() => updating_value = false);
1709			}
1710
1711			if (!updating_el && dirty[0] & /*els, _headers*/ 4259840) {
1712				updating_el = true;
1713				editablecell_changes.el = /*els*/ ctx[22][/*id*/ ctx[87]].input;
1714				add_flush_callback(() => updating_el = false);
1715			}
1716
1717			editablecell.$set(editablecell_changes);
1718
1719			if (!current || dirty[0] & /*sort_direction*/ 262144 && div0_class_value !== (div0_class_value = "sort-button " + /*sort_direction*/ ctx[18] + "" + " svelte-1bvc1p0")) {
1720				attr(div0, "class", div0_class_value);
1721			}
1722
1723			if (!current || dirty[0] & /*sort_direction, sort_by, _headers*/ 851968) {
1724				toggle_class(div0, "sorted", /*sort_by*/ ctx[19] === /*i*/ ctx[91]);
1725			}
1726
1727			if (!current || dirty[0] & /*sort_direction, sort_by, _headers, sort_direction*/ 851968) {
1728				toggle_class(div0, "des", /*sort_by*/ ctx[19] === /*i*/ ctx[91] && /*sort_direction*/ ctx[18] === "des");
1729			}
1730
1731			if (!current || dirty[0] & /*_headers, sort_by, sort_direction*/ 851968 && th_aria_sort_value !== (th_aria_sort_value = /*get_sort_status*/ ctx[35](/*value*/ ctx[12], /*sort_by*/ ctx[19], /*sort_direction*/ ctx[18]))) {
1732				attr(th, "aria-sort", th_aria_sort_value);
1733			}
1734
1735			if (!current || dirty[0] & /*_headers*/ 65536) {
1736				set_style(th, "width", "var(--cell-width-" + /*i*/ ctx[91] + ")");
1737			}
1738
1739			if (!current || dirty[0] & /*header_edit, _headers, selected_header*/ 83951616) {
1740				toggle_class(th, "focus", /*header_edit*/ ctx[24] === /*i*/ ctx[91] || /*selected_header*/ ctx[26] === /*i*/ ctx[91]);
1741			}
1742		},
1743		i(local) {
1744			if (current) return;
1745			transition_in$1(editablecell.$$.fragment, local);
1746			current = true;
1747		},
1748		o(local) {
1749			transition_out$1(editablecell.$$.fragment, local);
1750			current = false;
1751		},
1752		d(detaching) {
1753			if (detaching) {
1754				detach$1(th);
1755			}
1756
1757			destroy_component$1(editablecell);
1758			mounted = false;
1759			dispose();
1760		}
1761	};
1762}
1763
1764// (604:4) 
1765function create_thead_slot(ctx) {
1766	let tr;
1767	let each_blocks = [];
1768	let each_1_lookup = new Map();
1769	let current;
1770	let each_value_1 = ensure_array_like(/*_headers*/ ctx[16]);
1771	const get_key = ctx => /*id*/ ctx[87];
1772
1773	for (let i = 0; i < each_value_1.length; i += 1) {
1774		let child_ctx = get_each_context_1(ctx, each_value_1, i);
1775		let key = get_key(child_ctx);
1776		each_1_lookup.set(key, each_blocks[i] = create_each_block_1(key, child_ctx));
1777	}
1778
1779	return {
1780		c() {
1781			tr = element("tr");
1782
1783			for (let i = 0; i < each_blocks.length; i += 1) {
1784				each_blocks[i].c();
1785			}
1786
1787			attr(tr, "slot", "thead");
1788			attr(tr, "class", "svelte-1bvc1p0");
1789		},
1790		m(target, anchor) {
1791			insert$1(target, tr, anchor);
1792
1793			for (let i = 0; i < each_blocks.length; i += 1) {
1794				if (each_blocks[i]) {
1795					each_blocks[i].m(tr, null);
1796				}
1797			}
1798
1799			current = true;
1800		},
1801		p(ctx, dirty) {
1802			if (dirty[0] & /*_headers, sort_by, sort_direction, header_edit, selected_header, latex_delimiters, line_breaks, select_on_focus, els*/ 122487824 | dirty[1] & /*get_sort_status, handle_sort, end_header_edit, edit_header*/ 1808) {
1803				each_value_1 = ensure_array_like(/*_headers*/ ctx[16]);
1804				group_outros();
1805				each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value_1, each_1_lookup, tr, outro_and_destroy_block, create_each_block_1, null, get_each_context_1);
1806				check_outros();
1807			}
1808		},
1809		i(local) {
1810			if (current) return;
1811
1812			for (let i = 0; i < each_value_1.length; i += 1) {
1813				transition_in$1(each_blocks[i]);
1814			}
1815
1816			current = true;
1817		},
1818		o(local) {
1819			for (let i = 0; i < each_blocks.length; i += 1) {
1820				transition_out$1(each_blocks[i]);
1821			}
1822
1823			current = false;
1824		},
1825		d(detaching) {
1826			if (detaching) {
1827				detach$1(tr);
1828			}
1829
1830			for (let i = 0; i < each_blocks.length; i += 1) {
1831				each_blocks[i].d();
1832			}
1833		}
1834	};
1835}
1836
1837// (649:5) {#each item as { value, id }
1838function create_each_block(key_1, ctx) {
1839	let td;
1840	let div;
1841	let editablecell;
1842	let updating_value;
1843	let updating_el;
1844	let t;
1845	let td_style_value;
1846	let style_width = `var(--cell-width-${/*j*/ ctx[89]})`;
1847	let current;
1848	let mounted;
1849	let dispose;
1850
1851	function editablecell_value_binding(value) {
1852		/*editablecell_value_binding*/ ctx[55](value, /*index*/ ctx[85], /*j*/ ctx[89]);
1853	}
1854
1855	function editablecell_el_binding(value) {
1856		/*editablecell_el_binding*/ ctx[56](value, /*id*/ ctx[87]);
1857	}
1858
1859	let editablecell_props = {
1860		display_value: /*display_value*/ ctx[14]?.[/*index*/ ctx[85]]?.[/*j*/ ctx[89]],
1861		latex_delimiters: /*latex_delimiters*/ ctx[4],
1862		line_breaks: /*line_breaks*/ ctx[10],
1863		editable: /*editable*/ ctx[5],
1864		edit: dequal(/*editing*/ ctx[21], [/*index*/ ctx[85], /*j*/ ctx[89]]),
1865		datatype: Array.isArray(/*datatype*/ ctx[0])
1866		? /*datatype*/ ctx[0][/*j*/ ctx[89]]
1867		: /*datatype*/ ctx[0],
1868		clear_on_focus: /*clear_on_focus*/ ctx[23]
1869	};
1870
1871	if (/*data*/ ctx[17][/*index*/ ctx[85]][/*j*/ ctx[89]].value !== void 0) {
1872		editablecell_props.value = /*data*/ ctx[17][/*index*/ ctx[85]][/*j*/ ctx[89]].value;
1873	}
1874
1875	if (/*els*/ ctx[22][/*id*/ ctx[87]].input !== void 0) {
1876		editablecell_props.el = /*els*/ ctx[22][/*id*/ ctx[87]].input;
1877	}
1878
1879	editablecell = new EditableCell({ props: editablecell_props });
1880	binding_callbacks.push(() => bind(editablecell, 'value', editablecell_value_binding));
1881	binding_callbacks.push(() => bind(editablecell, 'el', editablecell_el_binding));
1882	editablecell.$on("blur", /*blur_handler*/ ctx[57]);
1883
1884	function touchstart_handler() {
1885		return /*touchstart_handler*/ ctx[58](/*index*/ ctx[85], /*j*/ ctx[89]);
1886	}
1887
1888	function click_handler() {
1889		return /*click_handler*/ ctx[59](/*index*/ ctx[85], /*j*/ ctx[89]);
1890	}
1891
1892	function dblclick_handler() {
1893		return /*dblclick_handler*/ ctx[60](/*index*/ ctx[85], /*j*/ ctx[89]);
1894	}
1895
1896	return {
1897		key: key_1,
1898		first: null,
1899		c() {
1900			td = element("td");
1901			div = element("div");
1902			create_component$1(editablecell.$$.fragment);
1903			t = space$1();
1904			attr(div, "class", "cell-wrap svelte-1bvc1p0");
1905			attr(td, "tabindex", "0");
1906			attr(td, "style", td_style_value = /*styling*/ ctx[15]?.[/*index*/ ctx[85]]?.[/*j*/ ctx[89]] || "");
1907			attr(td, "class", "svelte-1bvc1p0");
1908			toggle_class(td, "focus", dequal(/*selected*/ ctx[13], [/*index*/ ctx[85], /*j*/ ctx[89]]));
1909			set_style(td, "width", style_width);
1910			this.first = td;
1911		},
1912		m(target, anchor) {
1913			insert$1(target, td, anchor);
1914			append(td, div);
1915			mount_component$1(editablecell, div, null);
1916			append(td, t);
1917			current = true;
1918
1919			if (!mounted) {
1920				dispose = [
1921					listen(td, "touchstart", touchstart_handler, { passive: true }),
1922					listen(td, "click", click_handler),
1923					listen(td, "dblclick", dblclick_handler)
1924				];
1925
1926				mounted = true;
1927			}
1928		},
1929		p(new_ctx, dirty) {
1930			ctx = new_ctx;
1931			const editablecell_changes = {};
1932			if (dirty[0] & /*display_value*/ 16384 | dirty[2] & /*index, item*/ 25165824) editablecell_changes.display_value = /*display_value*/ ctx[14]?.[/*index*/ ctx[85]]?.[/*j*/ ctx[89]];
1933			if (dirty[0] & /*latex_delimiters*/ 16) editablecell_changes.latex_delimiters = /*latex_delimiters*/ ctx[4];
1934			if (dirty[0] & /*line_breaks*/ 1024) editablecell_changes.line_breaks = /*line_breaks*/ ctx[10];
1935			if (dirty[0] & /*editable*/ 32) editablecell_changes.editable = /*editable*/ ctx[5];
1936			if (dirty[0] & /*editing*/ 2097152 | dirty[2] & /*index, item*/ 25165824) editablecell_changes.edit = dequal(/*editing*/ ctx[21], [/*index*/ ctx[85], /*j*/ ctx[89]]);
1937
1938			if (dirty[0] & /*datatype*/ 1 | dirty[2] & /*item*/ 16777216) editablecell_changes.datatype = Array.isArray(/*datatype*/ ctx[0])
1939			? /*datatype*/ ctx[0][/*j*/ ctx[89]]
1940			: /*datatype*/ ctx[0];
1941
1942			if (dirty[0] & /*clear_on_focus*/ 8388608) editablecell_changes.clear_on_focus = /*clear_on_focus*/ ctx[23];
1943
1944			if (!updating_value && dirty[0] & /*data*/ 131072 | dirty[2] & /*index, item*/ 25165824) {
1945				updating_value = true;
1946				editablecell_changes.value = /*data*/ ctx[17][/*index*/ ctx[85]][/*j*/ ctx[89]].value;
1947				add_flush_callback(() => updating_value = false);
1948			}
1949
1950			if (!updating_el && dirty[0] & /*els*/ 4194304 | dirty[2] & /*item*/ 16777216) {
1951				updating_el = true;
1952				editablecell_changes.el = /*els*/ ctx[22][/*id*/ ctx[87]].input;
1953				add_flush_callback(() => updating_el = false);
1954			}
1955
1956			editablecell.$set(editablecell_changes);
1957
1958			if (!current || dirty[0] & /*styling*/ 32768 | dirty[2] & /*index, item*/ 25165824 && td_style_value !== (td_style_value = /*styling*/ ctx[15]?.[/*index*/ ctx[85]]?.[/*j*/ ctx[89]] || "")) {
1959				attr(td, "style", td_style_value);
1960			}
1961
1962			if (!current || dirty[0] & /*selected*/ 8192 | dirty[2] & /*index, item*/ 25165824) {
1963				toggle_class(td, "focus", dequal(/*selected*/ ctx[13], [/*index*/ ctx[85], /*j*/ ctx[89]]));
1964			}
1965
1966			const style_changed = dirty[0] & /*styling*/ 32768 | dirty[2] & /*index, item*/ 25165824;
1967
1968			if (dirty[0] & /*styling*/ 32768 | dirty[2] & /*item, index*/ 25165824 && style_width !== (style_width = `var(--cell-width-${/*j*/ ctx[89]})`) || style_changed) {
1969				set_style(td, "width", style_width);
1970			}
1971		},
1972		i(local) {
1973			if (current) return;
1974			transition_in$1(editablecell.$$.fragment, local);
1975			current = true;
1976		},
1977		o(local) {
1978			transition_out$1(editablecell.$$.fragment, local);
1979			current = false;
1980		},
1981		d(detaching) {
1982			if (detaching) {
1983				detach$1(td);
1984			}
1985
1986			destroy_component$1(editablecell);
1987			mounted = false;
1988			run_all(dispose);
1989		}
1990	};
1991}
1992
1993// (648:4) 
1994function create_tbody_slot(ctx) {
1995	let tr;
1996	let each_blocks = [];
1997	let each_1_lookup = new Map();
1998	let current;
1999	let each_value = ensure_array_like(/*item*/ ctx[86]);
2000	const get_key = ctx => /*id*/ ctx[87];
2001
2002	for (let i = 0; i < each_value.length; i += 1) {
2003		let child_ctx = get_each_context(ctx, each_value, i);
2004		let key = get_key(child_ctx);
2005		each_1_lookup.set(key, each_blocks[i] = create_each_block(key, child_ctx));
2006	}
2007
2008	return {
2009		c() {
2010			tr = element("tr");
2011
2012			for (let i = 0; i < each_blocks.length; i += 1) {
2013				each_blocks[i].c();
2014			}
2015
2016			attr(tr, "slot", "tbody");
2017			attr(tr, "class", "svelte-1bvc1p0");
2018			toggle_class(tr, "row_odd", /*index*/ ctx[85] % 2 === 0);
2019		},
2020		m(target, anchor) {
2021			insert$1(target, tr, anchor);
2022
2023			for (let i = 0; i < each_blocks.length; i += 1) {
2024				if (each_blocks[i]) {
2025					each_blocks[i].m(tr, null);
2026				}
2027			}
2028
2029			current = true;
2030		},
2031		p(ctx, dirty) {
2032			if (dirty[0] & /*styling, selected, display_value, latex_delimiters, line_breaks, editable, editing, datatype, clear_on_focus, data, els, parent*/ 551740465 | dirty[1] & /*start_edit, handle_cell_click*/ 160 | dirty[2] & /*index, item*/ 25165824) {
2033				each_value = ensure_array_like(/*item*/ ctx[86]);
2034				group_outros();
2035				each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, tr, outro_and_destroy_block, create_each_block, null, get_each_context);
2036				check_outros();
2037			}
2038
2039			if (!current || dirty[2] & /*index*/ 8388608) {
2040				toggle_class(tr, "row_odd", /*index*/ ctx[85] % 2 === 0);
2041			}
2042		},
2043		i(local) {
2044			if (current) return;
2045
2046			for (let i = 0; i < each_value.length; i += 1) {
2047				transition_in$1(each_blocks[i]);
2048			}
2049
2050			current = true;
2051		},
2052		o(local) {
2053			for (let i = 0; i < each_blocks.length; i += 1) {
2054				transition_out$1(each_blocks[i]);
2055			}
2056
2057			current = false;
2058		},
2059		d(detaching) {
2060			if (detaching) {
2061				detach$1(tr);
2062			}
2063
2064			for (let i = 0; i < each_blocks.length; i += 1) {
2065				each_blocks[i].d();
2066			}
2067		}
2068	};
2069}
2070
2071// (584:2) <Upload    flex={false}    center={false}    boundedheight={false}    disable_click={true}    {root}    on:load={(e) => blob_to_string(data_uri_to_blob(e.detail.data))}    bind:dragging   >
2072function create_default_slot_2(ctx) {
2073	let virtualtable;
2074	let updating_items;
2075	let updating_actual_height;
2076	let updating_table_scrollbar_width;
2077	let current;
2078
2079	function virtualtable_items_binding(value) {
2080		/*virtualtable_items_binding*/ ctx[65](value);
2081	}
2082
2083	function virtualtable_actual_height_binding(value) {
2084		/*virtualtable_actual_height_binding*/ ctx[66](value);
2085	}
2086
2087	function virtualtable_table_scrollbar_width_binding(value) {
2088		/*virtualtable_table_scrollbar_width_binding*/ ctx[67](value);
2089	}
2090
2091	let virtualtable_props = {
2092		table_width: /*t_width*/ ctx[28],
2093		max_height: /*height*/ ctx[9],
2094		selected: /*selected_index*/ ctx[33],
2095		$$slots: {
2096			tbody: [
2097				create_tbody_slot,
2098				({ index, item }) => ({ 85: index, 86: item }),
2099				({ index, item }) => [0, 0, (index ? 8388608 : 0) | (item ? 16777216 : 0)]
2100			],
2101			thead: [create_thead_slot],
2102			default: [create_default_slot_3]
2103		},
2104		$$scope: { ctx }
2105	};
2106
2107	if (/*data*/ ctx[17] !== void 0) {
2108		virtualtable_props.items = /*data*/ ctx[17];
2109	}
2110
2111	if (/*table_height*/ ctx[31] !== void 0) {
2112		virtualtable_props.actual_height = /*table_height*/ ctx[31];
2113	}
2114
2115	if (/*scrollbar_width*/ ctx[32] !== void 0) {
2116		virtualtable_props.table_scrollbar_width = /*scrollbar_width*/ ctx[32];
2117	}
2118
2119	virtualtable = new VirtualTable({ props: virtualtable_props });
2120	binding_callbacks.push(() => bind(virtualtable, 'items', virtualtable_items_binding));
2121	binding_callbacks.push(() => bind(virtualtable, 'actual_height', virtualtable_actual_height_binding));
2122	binding_callbacks.push(() => bind(virtualtable, 'table_scrollbar_width', virtualtable_table_scrollbar_width_binding));
2123
2124	return {
2125		c() {
2126			create_component$1(virtualtable.$$.fragment);
2127		},
2128		m(target, anchor) {
2129			mount_component$1(virtualtable, target, anchor);
2130			current = true;
2131		},
2132		p(ctx, dirty) {
2133			const virtualtable_changes = {};
2134			if (dirty[0] & /*t_width*/ 268435456) virtualtable_changes.table_width = /*t_width*/ ctx[28];
2135			if (dirty[0] & /*height*/ 512) virtualtable_changes.max_height = /*height*/ ctx[9];
2136			if (dirty[1] & /*selected_index*/ 4) virtualtable_changes.selected = /*selected_index*/ ctx[33];
2137
2138			if (dirty[0] & /*styling, selected, display_value, latex_delimiters, line_breaks, editable, editing, datatype, clear_on_focus, data, els, parent, _headers, sort_by, sort_direction, header_edit, selected_header, select_on_focus, label*/ 670032947 | dirty[2] & /*index, item*/ 25165824 | dirty[3] & /*$$scope*/ 2) {
2139				virtualtable_changes.$$scope = { dirty, ctx };
2140			}
2141
2142			if (!updating_items && dirty[0] & /*data*/ 131072) {
2143				updating_items = true;
2144				virtualtable_changes.items = /*data*/ ctx[17];
2145				add_flush_callback(() => updating_items = false);
2146			}
2147
2148			if (!updating_actual_height && dirty[1] & /*table_height*/ 1) {
2149				updating_actual_height = true;
2150				virtualtable_changes.actual_height = /*table_height*/ ctx[31];
2151				add_flush_callback(() => updating_actual_height = false);
2152			}
2153
2154			if (!updating_table_scrollbar_width && dirty[1] & /*scrollbar_width*/ 2) {
2155				updating_table_scrollbar_width = true;
2156				virtualtable_changes.table_scrollbar_width = /*scrollbar_width*/ ctx[32];
2157				add_flush_callback(() => updating_table_scrollbar_width = false);
2158			}
2159
2160			virtualtable.$set(virtualtable_changes);
2161		},
2162		i(local) {
2163			if (current) return;
2164			transition_in$1(virtualtable.$$.fragment, local);
2165			current = true;
2166		},
2167		o(local) {
2168			transition_out$1(virtualtable.$$.fragment, local);
2169			current = false;
2170		},
2171		d(detaching) {
2172			destroy_component$1(virtualtable, detaching);
2173		}
2174	};
2175}
2176
2177// (679:1) {#if editable}
2178function create_if_block(ctx) {
2179	let div;
2180	let t;
2181	let current;
2182	let if_block0 = /*row_count*/ ctx[3][1] === "dynamic" && create_if_block_2(ctx);
2183	let if_block1 = /*col_count*/ ctx[2][1] === "dynamic" && create_if_block_1(ctx);
2184
2185	return {
2186		c() {
2187			div = element("div");
2188			if (if_block0) if_block0.c();
2189			t = space$1();
2190			if (if_block1) if_block1.c();
2191			attr(div, "class", "controls-wrap svelte-1bvc1p0");
2192		},
2193		m(target, anchor) {
2194			insert$1(target, div, anchor);
2195			if (if_block0) if_block0.m(div, null);
2196			append(div, t);
2197			if (if_block1) if_block1.m(div, null);
2198			current = true;
2199		},
2200		p(ctx, dirty) {
2201			if (/*row_count*/ ctx[3][1] === "dynamic") {
2202				if (if_block0) {
2203					if_block0.p(ctx, dirty);
2204
2205					if (dirty[0] & /*row_count*/ 8) {
2206						transition_in$1(if_block0, 1);
2207					}
2208				} else {
2209					if_block0 = create_if_block_2(ctx);
2210					if_block0.c();
2211					transition_in$1(if_block0, 1);
2212					if_block0.m(div, t);
2213				}
2214			} else if (if_block0) {
2215				group_outros();
2216
2217				transition_out$1(if_block0, 1, 1, () => {
2218					if_block0 = null;
2219				});
2220
2221				check_outros();
2222			}
2223
2224			if (/*col_count*/ ctx[2][1] === "dynamic") {
2225				if (if_block1) {
2226					if_block1.p(ctx, dirty);
2227
2228					if (dirty[0] & /*col_count*/ 4) {
2229						transition_in$1(if_block1, 1);
2230					}
2231				} else {
2232					if_block1 = create_if_block_1(ctx);
2233					if_block1.c();
2234					transition_in$1(if_block1, 1);
2235					if_block1.m(div, null);
2236				}
2237			} else if (if_block1) {
2238				group_outros();
2239
2240				transition_out$1(if_block1, 1, 1, () => {
2241					if_block1 = null;
2242				});
2243
2244				check_outros();
2245			}
2246		},
2247		i(local) {
2248			if (current) return;
2249			transition_in$1(if_block0);
2250			transition_in$1(if_block1);
2251			current = true;
2252		},
2253		o(local) {
2254			transition_out$1(if_block0);
2255			transition_out$1(if_block1);
2256			current = false;
2257		},
2258		d(detaching) {
2259			if (detaching) {
2260				detach$1(div);
2261			}
2262
2263			if (if_block0) if_block0.d();
2264			if (if_block1) if_block1.d();
2265		}
2266	};
2267}
2268
2269// (681:3) {#if row_count[1] === "dynamic"}
2270function create_if_block_2(ctx) {
2271	let span;
2272	let basebutton;
2273	let current;
2274
2275	basebutton = new Button({
2276			props: {
2277				variant: "secondary",
2278				size: "sm",
2279				$$slots: { default: [create_default_slot_1] },
2280				$$scope: { ctx }
2281			}
2282		});
2283
2284	basebutton.$on("click", /*click_handler_2*/ ctx[72]);
2285
2286	return {
2287		c() {
2288			span = element("span");
2289			create_component$1(basebutton.$$.fragment);
2290			attr(span, "class", "button-wrap svelte-1bvc1p0");
2291		},
2292		m(target, anchor) {
2293			insert$1(target, span, anchor);
2294			mount_component$1(basebutton, span, null);
2295			current = true;
2296		},
2297		p(ctx, dirty) {
2298			const basebutton_changes = {};
2299
2300			if (dirty[0] & /*i18n*/ 256 | dirty[3] & /*$$scope*/ 2) {
2301				basebutton_changes.$$scope = { dirty, ctx };
2302			}
2303
2304			basebutton.$set(basebutton_changes);
2305		},
2306		i(local) {
2307			if (current) return;
2308			transition_in$1(basebutton.$$.fragment, local);
2309			current = true;
2310		},
2311		o(local) {
2312			transition_out$1(basebutton.$$.fragment, local);
2313			current = false;
2314		},
2315		d(detaching) {
2316			if (detaching) {
2317				detach$1(span);
2318			}
2319
2320			destroy_component$1(basebutton);
2321		}
2322	};
2323}
2324
2325// (683:5) <BaseButton       variant="secondary"       size="sm"       on:click={(e) => (e.stopPropagation(), add_row())}      >
2326function create_default_slot_1(ctx) {
2327	let svg;
2328	let path;
2329	let t0;
2330	let t1_value = /*i18n*/ ctx[8]("dataframe.new_row") + "";
2331	let t1;
2332
2333	return {
2334		c() {
2335			svg = svg_element("svg");
2336			path = svg_element("path");
2337			t0 = space$1();
2338			t1 = text(t1_value);
2339			attr(path, "fill", "currentColor");
2340			attr(path, "d", "M24.59 16.59L17 24.17V4h-2v20.17l-7.59-7.58L6 18l10 10l10-10l-1.41-1.41z");
2341			attr(svg, "xmlns", "http://www.w3.org/2000/svg");
2342			attr(svg, "xmlns:xlink", "http://www.w3.org/1999/xlink");
2343			attr(svg, "aria-hidden", "true");
2344			attr(svg, "role", "img");
2345			attr(svg, "width", "1em");
2346			attr(svg, "height", "1em");
2347			attr(svg, "preserveAspectRatio", "xMidYMid meet");
2348			attr(svg, "viewBox", "0 0 32 32");
2349			attr(svg, "class", "svelte-1bvc1p0");
2350		},
2351		m(target, anchor) {
2352			insert$1(target, svg, anchor);
2353			append(svg, path);
2354			insert$1(target, t0, anchor);
2355			insert$1(target, t1, anchor);
2356		},
2357		p(ctx, dirty) {
2358			if (dirty[0] & /*i18n*/ 256 && t1_value !== (t1_value = /*i18n*/ ctx[8]("dataframe.new_row") + "")) set_data(t1, t1_value);
2359		},
2360		d(detaching) {
2361			if (detaching) {
2362				detach$1(svg);
2363				detach$1(t0);
2364				detach$1(t1);
2365			}
2366		}
2367	};
2368}
2369
2370// (707:3) {#if col_count[1] === "dynamic"}
2371function create_if_block_1(ctx) {
2372	let span;
2373	let basebutton;
2374	let current;
2375
2376	basebutton = new Button({
2377			props: {
2378				variant: "secondary",
2379				size: "sm",
2380				$$slots: { default: [create_default_slot$1] },
2381				$$scope: { ctx }
2382			}
2383		});
2384
2385	basebutton.$on("click", /*click_handler_3*/ ctx[73]);
2386
2387	return {
2388		c() {
2389			span = element("span");
2390			create_component$1(basebutton.$$.fragment);
2391			attr(span, "class", "button-wrap svelte-1bvc1p0");
2392		},
2393		m(target, anchor) {
2394			insert$1(target, span, anchor);
2395			mount_component$1(basebutton, span, null);
2396			current = true;
2397		},
2398		p(ctx, dirty) {
2399			const basebutton_changes = {};
2400
2401			if (dirty[0] & /*i18n*/ 256 | dirty[3] & /*$$scope*/ 2) {
2402				basebutton_changes.$$scope = { dirty, ctx };
2403			}
2404
2405			basebutton.$set(basebutton_changes);
2406		},
2407		i(local) {
2408			if (current) return;
2409			transition_in$1(basebutton.$$.fragment, local);
2410			current = true;
2411		},
2412		o(local) {
2413			transition_out$1(basebutton.$$.fragment, local);
2414			current = false;
2415		},
2416		d(detaching) {
2417			if (detaching) {
2418				detach$1(span);
2419			}
2420
2421			destroy_component$1(basebutton);
2422		}
2423	};
2424}
2425
2426// (709:5) <BaseButton       variant="secondary"       size="sm"       on:click={(e) => (e.stopPropagation(), add_col())}      >
2427function create_default_slot$1(ctx) {
2428	let svg;
2429	let path;
2430	let t0;
2431	let t1_value = /*i18n*/ ctx[8]("dataframe.new_column") + "";
2432	let t1;
2433
2434	return {
2435		c() {
2436			svg = svg_element("svg");
2437			path = svg_element("path");
2438			t0 = space$1();
2439			t1 = text(t1_value);
2440			attr(path, "fill", "currentColor");
2441			attr(path, "d", "m18 6l-1.43 1.393L24.15 15H4v2h20.15l-7.58 7.573L18 26l10-10L18 6z");
2442			attr(svg, "xmlns", "http://www.w3.org/2000/svg");
2443			attr(svg, "xmlns:xlink", "http://www.w3.org/1999/xlink");
2444			attr(svg, "aria-hidden", "true");
2445			attr(svg, "role", "img");
2446			attr(svg, "width", "1em");
2447			attr(svg, "height", "1em");
2448			attr(svg, "preserveAspectRatio", "xMidYMid meet");
2449			attr(svg, "viewBox", "0 0 32 32");
2450			attr(svg, "class", "svelte-1bvc1p0");
2451		},
2452		m(target, anchor) {
2453			insert$1(target, svg, anchor);
2454			append(svg, path);
2455			insert$1(target, t0, anchor);
2456			insert$1(target, t1, anchor);
2457		},
2458		p(ctx, dirty) {
2459			if (dirty[0] & /*i18n*/ 256 && t1_value !== (t1_value = /*i18n*/ ctx[8]("dataframe.new_column") + "")) set_data(t1, t1_value);
2460		},
2461		d(detaching) {
2462			if (detaching) {
2463				detach$1(svg);
2464				detach$1(t0);
2465				detach$1(t1);
2466			}
2467		}
2468	};
2469}
2470
2471function create_fragment$1(ctx) {
2472	let div1;
2473	let t0;
2474	let div0;
2475	let table_1;
2476	let t1;
2477	let thead;
2478	let tr0;
2479	let each_blocks_1 = [];
2480	let each0_lookup = new Map();
2481	let t2;
2482	let tbody;
2483	let tr1;
2484	let each_blocks = [];
2485	let each1_lookup = new Map();
2486	let table_1_resize_listener;
2487	let t3;
2488	let upload;
2489	let updating_dragging;
2490	let t4;
2491	let current;
2492	let mounted;
2493	let dispose;
2494	let if_block0 = /*label*/ ctx[1] && /*label*/ ctx[1].length !== 0 && create_if_block_5(ctx);
2495	let if_block1 = /*label*/ ctx[1] && /*label*/ ctx[1].length !== 0 && create_if_block_4(ctx);
2496	let each_value_3 = ensure_array_like(/*_headers*/ ctx[16]);
2497	const get_key = ctx => /*id*/ ctx[87];
2498
2499	for (let i = 0; i < each_value_3.length; i += 1) {
2500		let child_ctx = get_each_context_3(ctx, each_value_3, i);
2501		let key = get_key(child_ctx);
2502		each0_lookup.set(key, each_blocks_1[i] = create_each_block_3(key, child_ctx));
2503	}
2504
2505	let each_value_2 = ensure_array_like(/*max*/ ctx[34]);
2506	const get_key_1 = ctx => /*id*/ ctx[87];
2507
2508	for (let i = 0; i < each_value_2.length; i += 1) {
2509		let child_ctx = get_each_context_2(ctx, each_value_2, i);
2510		let key = get_key_1(child_ctx);
2511		each1_lookup.set(key, each_blocks[i] = create_each_block_2(key, child_ctx));
2512	}
2513
2514	function upload_dragging_binding(value) {
2515		/*upload_dragging_binding*/ ctx[68](value);
2516	}
2517
2518	let upload_props = {
2519		flex: false,
2520		center: false,
2521		boundedheight: false,
2522		disable_click: true,
2523		root: /*root*/ ctx[7],
2524		$$slots: { default: [create_default_slot_2] },
2525		$$scope: { ctx }
2526	};
2527
2528	if (/*dragging*/ ctx[27] !== void 0) {
2529		upload_props.dragging = /*dragging*/ ctx[27];
2530	}
2531
2532	upload = new Upload({ props: upload_props });
2533	binding_callbacks.push(() => bind(upload, 'dragging', upload_dragging_binding));
2534	upload.$on("load", /*load_handler*/ ctx[69]);
2535	let if_block2 = /*editable*/ ctx[5] && create_if_block(ctx);
2536
2537	return {
2538		c() {
2539			div1 = element("div");
2540			if (if_block0) if_block0.c();
2541			t0 = space$1();
2542			div0 = element("div");
2543			table_1 = element("table");
2544			if (if_block1) if_block1.c();
2545			t1 = space$1();
2546			thead = element("thead");
2547			tr0 = element("tr");
2548
2549			for (let i = 0; i < each_blocks_1.length; i += 1) {
2550				each_blocks_1[i].c();
2551			}
2552
2553			t2 = space$1();
2554			tbody = element("tbody");
2555			tr1 = element("tr");
2556
2557			for (let i = 0; i < each_blocks.length; i += 1) {
2558				each_blocks[i].c();
2559			}
2560
2561			t3 = space$1();
2562			create_component$1(upload.$$.fragment);
2563			t4 = space$1();
2564			if (if_block2) if_block2.c();
2565			attr(tr0, "class", "svelte-1bvc1p0");
2566			attr(thead, "class", "svelte-1bvc1p0");
2567			attr(tr1, "class", "svelte-1bvc1p0");
2568			attr(table_1, "class", "svelte-1bvc1p0");
2569			add_render_callback(() =>
2569 /*table_1_elementresize_handler*/ ctx[53].call(table_1));
2570			toggle_class(table_1, "fixed-layout", /*column_widths*/ ctx[11].length != 0);
2571			attr(div0, "class", "table-wrap svelte-1bvc1p0");
2572			set_style(div0, "height", /*table_height*/ ctx[31] + "px");
2573			attr(div0, "role", "grid");
2574			attr(div0, "tabindex", "0");
2575			toggle_class(div0, "dragging", /*dragging*/ ctx[27]);
2576			toggle_class(div0, "no-wrap", !/*wrap*/ ctx[6]);
2577			attr(div1, "class", "svelte-1bvc1p0");
2578			toggle_class(div1, "label", /*label*/ ctx[1] && /*label*/ ctx[1].length !== 0);
2579		},
2580		m(target, anchor) {
2581			insert$1(target, div1, anchor);
2582			if (if_block0) if_block0.m(div1, null);
2583			append(div1, t0);
2584			append(div1, div0);
2585			append(div0, table_1);
2586			if (if_block1) if_block1.m(table_1, null);
2587			append(table_1, t1);
2588			append(table_1, thead);
2589			append(thead, tr0);
2590
2591			for (let i = 0; i < each_blocks_1.length; i += 1) {
2592				if (each_blocks_1[i]) {
2593					each_blocks_1[i].m(tr0, null);
2594				}
2595			}
2596
2597			append(table_1, t2);
2598			append(table_1, tbody);
2599			append(tbody, tr1);
2600
2601			for (let i = 0; i < each_blocks.length; i += 1) {
2602				if (each_blocks[i]) {
2603					each_blocks[i].m(tr1, null);
2604				}
2605			}
2606
2607			table_1_resize_listener = add_iframe_resize_listener(table_1, /*table_1_elementresize_handler*/ ctx[53].bind(table_1));
2608			/*table_1_binding*/ ctx[54](table_1);
2609			append(div0, t3);
2610			mount_component$1(upload, div0, null);
2611			/*div0_binding*/ ctx[70](div0);
2612			append(div1, t4);
2613			if (if_block2) if_block2.m(div1, null);
2614			current = true;
2615
2616			if (!mounted) {
2617				dispose = [
2618					listen(window, "click", /*handle_click_outside*/ ctx[44]),
2619					listen(window, "touchstart", /*handle_click_outside*/ ctx[44]),
2620					listen(window, "resize", /*resize_handler*/ ctx[51]),
2621					listen(div0, "keydown", /*keydown_handler*/ ctx[71]),
2622					action_destroyer(copy.call(null, div1))
2623				];
2624
2625				mounted = true;
2626			}
2627		},
2628		p(ctx, dirty) {
2629			if (/*label*/ ctx[1] && /*label*/ ctx[1].length !== 0) {
2630				if (if_block0) {
2631					if_block0.p(ctx, dirty);
2632				} else {
2633					if_block0 = create_if_block_5(ctx);
2634					if_block0.c();
2635					if_block0.m(div1, t0);
2636				}
2637			} else if (if_block0) {
2638				if_block0.d(1);
2639				if_block0 = null;
2640			}
2641
2642			if (/*label*/ ctx[1] && /*label*/ ctx[1].length !== 0) {
2643				if (if_block1) {
2644					if_block1.p(ctx, dirty);
2645				} else {
2646					if_block1 = create_if_block_4(ctx);
2647					if_block1.c();
2648					if_block1.m(table_1, t1);
2649				}
2650			} else if (if_block1) {
2651				if_block1.d(1);
2652				if_block1 = null;
2653			}
2654
2655			if (dirty[0] & /*_headers, sort_by, sort_direction, header_edit, column_widths, latex_delimiters, line_breaks*/ 17632272 | dirty[1] & /*get_sort_status*/ 16) {
2656				each_value_3 = ensure_array_like(/*_headers*/ ctx[16]);
2657				group_outros();
2658				each_blocks_1 = update_keyed_each(each_blocks_1, dirty, get_key, 1, ctx, each_value_3, each0_lookup, tr0, outro_and_destroy_block, create_each_block_3, null, get_each_context_3);
2659				check_outros();
2660			}
2661
2662			if (dirty[0] & /*cells, latex_delimiters, line_breaks, datatype*/ 1049617 | dirty[1] & /*max*/ 8) {
2663				each_value_2 = ensure_array_like(/*max*/ ctx[34]);
2664				group_outros();
2665				each_blocks = update_keyed_each(each_blocks, dirty, get_key_1, 1, ctx, each_value_2, each1_lookup, tr1, outro_and_destroy_block, create_each_block_2, null, get_each_context_2);
2666				check_outros();
2667			}
2668
2669			if (!current || dirty[0] & /*column_widths*/ 2048) {
2670				toggle_class(table_1, "fixed-layout", /*column_widths*/ ctx[11].length != 0);
2671			}
2672
2673			const upload_changes = {};
2674			if (dirty[0] & /*root*/ 128) upload_changes.root = /*root*/ ctx[7];
2675
2676			if (dirty[0] & /*t_width, height, data, styling, selected, display_value, latex_delimiters, line_breaks, editable, editing, datatype, clear_on_focus, els, parent, _headers, sort_by, sort_direction, header_edit, selected_header, select_on_focus, label*/ 938468915 | dirty[1] & /*selected_index, table_height, scrollbar_width*/ 7 | dirty[3] & /*$$scope*/ 2) {
2677				upload_changes.$$scope = { dirty, ctx };
2678			}
2679
2680			if (!updating_dragging && dirty[0] & /*dragging*/ 134217728) {
2681				updating_dragging = true;
2682				upload_changes.dragging = /*dragging*/ ctx[27];
2683				add_flush_callback(() => updating_dragging = false);
2684			}
2685
2686			upload.$set(upload_changes);
2687
2688			if (!current || dirty[1] & /*table_height*/ 1) {
2689				set_style(div0, "height", /*table_height*/ ctx[31] + "px");
2690			}
2691
2692			if (!current || dirty[0] & /*dragging*/ 134217728) {
2693				toggle_class(div0, "dragging", /*dragging*/ ctx[27]);
2694			}
2695
2696			if (!current || dirty[0] & /*wrap*/ 64) {
2697				toggle_class(div0, "no-wrap", !/*wrap*/ ctx[6]);
2698			}
2699
2700			if (/*editable*/ ctx[5]) {
2701				if (if_block2) {
2702					if_block2.p(ctx, dirty);
2703
2704					if (dirty[0] & /*editable*/ 32) {
2705						transition_in$1(if_block2, 1);
2706					}
2707				} else {
2708					if_block2 = create_if_block(ctx);
2709					if_block2.c();
2710					transition_in$1(if_block2, 1);
2711					if_block2.m(div1, null);
2712				}
2713			} else if (if_block2) {
2714				group_outros();
2715
2716				transition_out$1(if_block2, 1, 1, () => {
2717					if_block2 = null;
2718				});
2719
2720				check_outros();
2721			}
2722
2723			if (!current || dirty[0] & /*label*/ 2) {
2724				toggle_class(div1, "label", /*label*/ ctx[1] && /*label*/ ctx[1].length !== 0);
2725			}
2726		},
2727		i(local) {
2728			if (current) return;
2729
2730			for (let i = 0; i < each_value_3.length; i += 1) {
2731				transition_in$1(each_blocks_1[i]);
2732			}
2733
2734			for (let i = 0; i < each_value_2.length; i += 1) {
2735				transition_in$1(each_blocks[i]);
2736			}
2737
2738			transition_in$1(upload.$$.fragment, local);
2739			transition_in$1(if_block2);
2740			current = true;
2741		},
2742		o(local) {
2743			for (let i = 0; i < each_blocks_1.length; i += 1) {
2744				transition_out$1(each_blocks_1[i]);
2745			}
2746
2747			for (let i = 0; i < each_blocks.length; i += 1) {
2748				transition_out$1(each_blocks[i]);
2749			}
2750
2751			transition_out$1(upload.$$.fragment, local);
2752			transition_out$1(if_block2);
2753			current = false;
2754		},
2755		d(detaching) {
2756			if (detaching) {
2757				detach$1(div1);
2758			}
2759
2760			if (if_block0) if_block0.d();
2761			if (if_block1) if_block1.d();
2762
2763			for (let i = 0; i < each_blocks_1.length; i += 1) {
2764				each_blocks_1[i].d();
2765			}
2766
2767			for (let i = 0; i < each_blocks.length; i += 1) {
2768				each_blocks[i].d();
2769			}
2770
2771			table_1_resize_listener();
2772			/*table_1_binding*/ ctx[54](null);
2773			destroy_component$1(upload);
2774			/*div0_binding*/ ctx[70](null);
2775			if (if_block2) if_block2.d();
2776			mounted = false;
2777			run_all(dispose);
2778		}
2779	};
2780}
2781
2782function make_id() {
2783	return Math.random().toString(36).substring(2, 15);
2784}
2785
2786function guess_delimitaor(text, possibleDelimiters) {
2787	return possibleDelimiters.filter(weedOut);
2788
2789	function weedOut(delimiter) {
2790		var cache = -1;
2791		return text.split("\n").every(checkLength);
2792
2793		function checkLength(line) {
2794			if (!line) {
2795				return true;
2796			}
2797
2798			var length = line.split(delimiter).length;
2799
2800			if (cache < 0) {
2801				cache = length;
2802			}
2803
2804			return cache === length && length > 1;
2805		}
2806	}
2807}
2808
2809function data_uri_to_blob(data_uri) {
2810	const byte_str = atob(data_uri.split(",")[1]);
2811	const mime_str = data_uri.split(",")[0].split(":")[1].split(";")[0];
2812	const ab = new ArrayBuffer(byte_str.length);
2813	const ia = new Uint8Array(ab);
2814
2815	for (let i = 0; i < byte_str.length; i++) {
2816		ia[i] = byte_str.charCodeAt(i);
2817	}
2818
2819	return new Blob([ab], { type: mime_str });
2820}
2821
2822function instance$1($$self, $$props, $$invalidate) {
2823	let max;
2824	let selected_index;
2825	let { datatype } = $$props;
2826	let { label = null } = $$props;
2827	let { headers = [] } = $$props;
2828	let values;
2829	let { value } = $$props;
2830	let { col_count } = $$props;
2831	let { row_count } = $$props;
2832	let { latex_delimiters } = $$props;
2833	let { editable = true } = $$props;
2834	let { wrap = false } = $$props;
2835	let { root } = $$props;
2836	let { i18n } = $$props;
2837	let { height = 500 } = $$props;
2838	let { line_breaks = true } = $$props;
2839	let { column_widths = [] } = $$props;
2840	let selected = false;
2841	let display_value = value?.metadata?.display_value ?? null;
2842	let styling = value?.metadata?.styling ?? null;
2843	const dispatch = createEventDispatcher();
2844	let editing = false;
2845	const get_data_at = (row, col) => data?.[row]?.[col]?.value;
2846	let els = {};
2847
2848	function make_headers(_head) {
2849		let _h = _head || [];
2850
2851		if (col_count[1] === "fixed" && _h.length < col_count[0]) {
2852			const fill = Array(col_count[0] - _h.length).fill("").map((_, i) => `${i + _h.length}`);
2853			_h = _h.concat(fill);
2854		}
2855
2856		if (!_h || _h.length === 0) {
2857			return Array(col_count[0]).fill(0).map((_, i) => {
2858				const _id = make_id();
2859				$$invalidate(22, els[_id] = { cell: null, input: null }, els);
2860				return { id: _id, value: JSON.stringify(i + 1) };
2861			});
2862		}
2863
2864		return _h.map((h, i) => {
2865			const _id = make_id();
2866			$$invalidate(22, els[_id] = { cell: null, input: null }, els);
2867			return { id: _id, value: h ?? "" };
2868		});
2869	}
2870
2871	function process_data(_values) {
2872		const data_row_length = _values.length;
2873
2874		return Array(row_count[1] === "fixed"
2875		? row_count[0]
2876		: data_row_length < row_count[0]
2877			? row_count[0]
2878			: data_row_length).fill(0).map((_, i) => Array(col_count[1] === "fixed"
2879		? col_count[0]
2880		: data_row_length > 0 ? _values[0].length : headers.length).fill(0).map((_, j) => {
2881			const id = make_id();
2882			$$invalidate(22, els[id] = els[id] || { input: null, cell: null }, els);
2883			const obj = { value: _values?.[i]?.[j] ?? "", id };
2884			return obj;
2885		}));
2886	}
2887
2888	let _headers = make_headers(headers);
2889	let old_headers;
2890
2891	function trigger_headers() {
2892		$$invalidate(16, _headers = make_headers(headers));
2893		$$invalidate(49, old_headers = headers.slice());
2894	}
2895
2896	let data = [[]];
2897	let old_val = undefined;
2898
2899	function get_sort_status(name, _sort, direction) {
2900		if (!_sort) return "none";
2901
2902		if (headers[_sort] === name) {
2903			if (direction === "asc") return "ascending";
2904			if (direction === "des") return "descending";
2905		}
2906
2907		return "none";
2908	}
2909
2910	function get_current_indices(id) {
2911		return data.reduce(
2912			(acc, arr, i) => {
2913				const j = arr.reduce((_acc, _data, k) => id === _data.id ? k : _acc, -1);
2914				return j === -1 ? acc : [i, j];
2915			},
2916			[-1, -1]
2917		);
2918	}
2919
2920	async function start_edit(i, j) {
2921		if (!editable || dequal(editing, [i, j])) return;
2922		$$invalidate(21, editing = [i, j]);
2923	}
2924
2925	function move_cursor(key, current_coords) {
2926		const dir = ({
2927			ArrowRight: [0, 1],
2928			ArrowLeft: [0, -1],
2929			ArrowDown: [1, 0],
2930			ArrowUp: [-1, 0]
2931		})[key];
2932
2933		const i = current_coords[0] + dir[0];
2934		const j = current_coords[1] + dir[1];
2935
2936		if (i < 0 && j <= 0) {
2937			$$invalidate(26, selected_header = j);
2938			$$invalidate(13, selected = false);
2939		} else {
2940			const is_data = data[i]?.[j];
2941			$$invalidate(13, selected = is_data ? [i, j] : selected);
2942		}
2943	}
2944
2945	let clear_on_focus = false;
2946
2947	// eslint-disable-next-line complexity
2948	async function handle_keydown(event) {
2949		if (selected_header !== false && header_edit === false) {
2950			switch (event.key) {
2951				case "ArrowDown":
2952					$$invalidate(13, selected = [0, selected_header]);
2953					$$invalidate(26, selected_header = false);
2954					return;
2955				case "ArrowLeft":
2956					$$invalidate(26, selected_header = selected_header > 0
2957					? selected_header - 1
2958					: selected_header);
2959					return;
2960				case "ArrowRight":
2961					$$invalidate(26, selected_header = selected_header < _headers.length - 1
2962					? selected_header + 1
2963					: selected_header);
2964					return;
2965				case "Escape":
2966					event.preventDefault();
2967					$$invalidate(26, selected_header = false);
2968					break;
2969				case "Enter":
2970					event.preventDefault();
2971					break;
2972			}
2973		}
2974
2975		if (!selected) {
2976			return;
2977		}
2978
2979		const [i, j] = selected;
2980
2981		switch (event.key) {
2982			case "ArrowRight":
2983			case "ArrowLeft":
2984			case "ArrowDown":
2985			case "ArrowUp":
2986				if (editing) break;
2987				event.preventDefault();
2988				move_cursor(event.key, [i, j]);
2989				break;
2990			case "Escape":
2991				if (!editable) break;
2992				event.preventDefault();
2993				$$invalidate(21, editing = false);
2994				break;
2995			case "Enter":
2996				if (!editable) break;
2997				event.preventDefault();
2998				if (event.shiftKey) {
2999					add_row(i);
3000					await tick();
3001					$$invalidate(13, selected = [i + 1, j]);
3002				} else {
3003					if (dequal(editing, [i, j])) {
3004						$$invalidate(21, editing = false);
3005						await tick();
3006						$$invalidate(13, selected = [i, j]);
3007					} else {
3008						$$invalidate(21, editing = [i, j]);
3009					}
3010				}
3011				break;
3012			case "Backspace":
3013				if (!editable) break;
3014				if (!editing) {
3015					event.preventDefault();
3016					$$invalidate(17, data[i][j].value = "", data);
3017				}
3018				break;
3019			case "Delete":
3020				if (!editable) break;
3021				if (!editing) {
3022					event.preventDefault();
3023					$$invalidate(17, data[i][j].value = "", data);
3024				}
3025				break;
3026			case "Tab":
3027				let direction = event.shiftKey ? -1 : 1;
3028				let is_data_x = data[i][j + direction];
3029				let is_data_y = data?.[i + direction]?.[direction > 0 ? 0 : _headers.length - 1];
3030				if (is_data_x || is_data_y) {
3031					event.preventDefault();
3032
3033					$$invalidate(13, selected = is_data_x
3034					? [i, j + direction]
3035					: [i + direction, direction > 0 ? 0 : _headers.length - 1]);
3036				}
3037				$$invalidate(21, editing = false);
3038				break;
3039			default:
3040				if (!editable) break;
3041				if ((!editing || editing && dequal(editing, [i, j])) && event.key.length === 1) {
3042					$$invalidate(23, clear_on_focus = true);
3043					$$invalidate(21, editing = [i, j]);
3044				}
3045		}
3046	}
3047
3048	async function handle_cell_click(i, j) {
3049		if (dequal(editing, [i, j])) return;
3050		$$invalidate(24, header_edit = false);
3051		$$invalidate(26, selected_header = false);
3052		$$invalidate(21, editing = false);
3053		$$invalidate(13, selected = [i, j]);
3054		await tick();
3055		parent.focus();
3056	}
3057
3058	let sort_direction;
3059	let sort_by;
3060
3061	function handle_sort(col) {
3062		if (typeof sort_by !== "number" || sort_by !== col) {
3063			$$invalidate(18, sort_direction = "asc");
3064			$$invalidate(19, sort_by = col);
3065		} else {
3066			if (sort_direction === "asc") {
3067				$$invalidate(18, sort_direction = "des");
3068			} else if (sort_direction === "des") {
3069				$$invalidate(18, sort_direction = "asc");
3070			}
3071		}
3072	}
3073
3074	let header_edit;
3075	let select_on_focus = false;
3076	let selected_header = false;
3077
3078	async function edit_header(i, _select = false) {
3079		if (!editable || col_count[1] !== "dynamic" || header_edit === i) return;
3080		$$invalidate(13, selected = false);
3081		$$invalidate(26, selected_header = i);
3082		$$invalidate(24, header_edit = i);
3083		$$invalidate(25, select_on_focus = _select);
3084	}
3085
3086	function end_header_edit(event) {
3087		if (!editable) return;
3088
3089		switch (event.key) {
3090			case "Escape":
3091			case "Enter":
3092			case "Tab":
3093				event.preventDefault();
3094				$$invalidate(13, selected = false);
3095				$$invalidate(26, selected_header = header_edit);
3096				$$invalidate(24, header_edit = false);
3097				parent.focus();
3098				break;
3099		}
3100	}
3101
3102	async function add_row(index) {
3103		parent.focus();
3104		if (row_count[1] !== "dynamic") return;
3105
3106		if (data.length === 0) {
3107			$$invalidate(48, values = [Array(headers.length).fill("")]);
3108			return;
3109		}
3110
3111		data.splice(index ? index + 1 : data.length, 0, Array(data[0].length).fill(0).map((_, i) => {
3112			const _id = make_id();
3113			$$invalidate(22, els[_id] = { cell: null, input: null }, els);
3114			return { id: _id, value: "" };
3115		}));
3116
3117		((($$invalidate(17, data), $$invalidate(48, values)), $$invalidate(50, old_val)), $$invalidate(12, value));
3118		$$invalidate(13, selected = [index ? index + 1 : data.length - 1, 0]);
3119	}
3120
3121	async function add_col() {
3122		parent.focus();
3123		if (col_count[1] !== "dynamic") return;
3124
3125		for (let i = 0; i < data.length; i++) {
3126			const _id = make_id();
3127			$$invalidate(22, els[_id] = { cell: null, input: null }, els);
3128			data[i].push({ id: _id, value: "" });
3129		}
3130
3131		headers.push(`Header ${headers.length + 1}`);
3132		((($$invalidate(17, data), $$invalidate(48, values)), $$invalidate(50, old_val)), $$invalidate(12, value));
3133		(($$invalidate(47, headers), $$invalidate(12, value)), $$invalidate(48, values));
3134		await tick();
3135
3136		requestAnimationFrame(() => {
3137			edit_header(headers.length - 1, true);
3138			const new_w = parent.querySelectorAll("tbody")[1].offsetWidth;
3139			parent.querySelectorAll("table")[1].scrollTo({ left: new_w });
3140		});
3141	}
3142
3143	function handle_click_outside(event) {
3144		event.stopImmediatePropagation();
3145		const [trigger] = event.composedPath();
3146
3147		if (parent.contains(trigger)) {
3148			return;
3149		}
3150
3151		$$invalidate(21, editing = false);
3152		$$invalidate(24, header_edit = false);
3153		$$invalidate(26, selected_header = false);
3154		$$invalidate(13, selected = false);
3155	}
3156
3157	function blob_to_string(blob) {
3158		const reader = new FileReader();
3159
3160		function handle_read(e) {
3161			if (!e?.target?.result || typeof e.target.result !== "string") return;
3162			const [delimiter] = guess_delimitaor(e.target.result, [",", "\t"]);
3163			const [head, ...rest] = dsvFormat(delimiter).parseRows(e.target.result);
3164
3165			$$invalidate(16, _headers = make_headers(col_count[1] === "fixed"
3166			? head.slice(0, col_count[0])
3167			: head));
3168
3169			$$invalidate(48, values = rest);
3170			reader.removeEventListener("loadend", handle_read);
3171		}
3172
3173		reader.addEventListener("loadend", handle_read);
3174		reader.readAsText(blob);
3175	}
3176
3177	let dragging = false;
3178	let t_width = 0;
3179
3180	function get_max(_d) {
3181		let max = _d[0].slice();
3182
3183		for (let i = 0; i < _d.length; i++) {
3184			for (let j = 0; j < _d[i].length; j++) {
3185				if (`${max[j].value}`.length < `${_d[i][j].value}`.length) {
3186					max[j] = _d[i][j];
3187				}
3188			}
3189		}
3190
3191		return max;
3192	}
3193
3194	let cells = [];
3195	let parent;
3196	let table;
3197
3198	function set_cell_widths() {
3199		const widths = cells.map((el, i) => {
3200			return el?.clientWidth || 0;
3201		});
3202
3203		if (widths.length === 0) return;
3204
3205		for (let i = 0; i < widths.length; i++) {
3206			parent.style.setProperty(`--cell-width-${i}`, `${widths[i] - scrollbar_width / widths.length}px`);
3207		}
3208	}
3209
3210	let table_height = height;
3211	let scrollbar_width = 0;
3212
3213	function sort_data(_data, _display_value, _styling, col, dir) {
3214		let id = null;
3215
3216		//Checks if the selected cell is still in the data
3217		if (selected && selected[0] in data && selected[1] in data[selected[0]]) {
3218			id = data[selected[0]][selected[1]].id;
3219		}
3220
3221		if (typeof col !== "number" || !dir) {
3222			return;
3223		}
3224
3225		const indices = [...Array(_data.length).keys()];
3226
3227		if (dir === "asc") {
3228			indices.sort((i, j) => _data[i][col].value < _data[j][col].value ? -1 : 1);
3229		} else if (dir === "des") {
3230			indices.sort((i, j) => _data[i][col].value > _data[j][col].value ? -1 : 1);
3231		} else {
3232			return;
3233		}
3234
3235		// sort all the data and metadata based on the values in the data
3236		const temp_data = [..._data];
3237
3238		const temp_display_value = _display_value ? [..._display_value] : null;
3239		const temp_styling = _styling ? [..._styling] : null;
3240
3241		indices.forEach((originalIndex, sortedIndex) => {
3242			_data[sortedIndex] = temp_data[originalIndex];
3243			if (_display_value && temp_display_value) _display_value[sortedIndex] = temp_display_value[originalIndex];
3244			if (_styling && temp_styling) _styling[sortedIndex] = temp_styling[originalIndex];
3245		});
3246
3247		((($$invalidate(17, data), $$invalidate(48, values)), $$invalidate(50, old_val)), $$invalidate(12, value));
3248
3249		if (id) {
3250			const [i, j] = get_current_indices(id);
3251			$$invalidate(13, selected = [i, j]);
3252		}
3253	}
3254
3255	let is_visible = false;
3256
3257	onMount(() => {
3258		const observer = new IntersectionObserver((entries, observer) => {
3259				entries.forEach(entry => {
3260					if (entry.isIntersecting && !is_visible) {
3261						set_cell_widths();
3262						((($$invalidate(17, data), $$invalidate(48, values)), $$invalidate(50, old_val)), $$invalidate(12, value));
3263					}
3264
3265					is_visible = entry.isIntersecting;
3266				});
3267			});
3268
3269		observer.observe(parent);
3270
3271		return () => {
3272			observer.disconnect();
3273		};
3274	});
3275
3276	const resize_handler = () => set_cell_widths();
3277
3278	function td_binding($$value, j) {
3279		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
3280			cells[j] = $$value;
3281			$$invalidate(20, cells);
3282		});
3283	}
3284
3285	function table_1_elementresize_handler() {
3286		t_width = this.clientWidth;
3287		$$invalidate(28, t_width);
3288	}
3289
3290	function table_1_binding($$value) {
3291		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
3292			table = $$value;
3293			$$invalidate(30, table);
3294		});
3295	}
3296
3297	function editablecell_value_binding(value$1, index, j) {
3298		if ($$self.$$.not_equal(data[index][j].value, value$1)) {
3299			data[index][j].value = value$1;
3300			((($$invalidate(17, data), $$invalidate(48, values)), $$invalidate(50, old_val)), $$invalidate(12, value));
3301		}
3302	}
3303
3304	function editablecell_el_binding(value, id) {
3305		if ($$self.$$.not_equal(els[id].input, value)) {
3306			els[id].input = value;
3307			$$invalidate(22, els);
3308		}
3309	}
3310
3311	const blur_handler = () => ($$invalidate(23, clear_on_focus = false), parent.focus());
3312	const touchstart_handler = (index, j) => start_edit(index, j);
3313	const click_handler = (index, j) => handle_cell_click(index, j);
3314	const dblclick_handler = (index, j) => start_edit(index, j);
3315
3316	function editablecell_value_binding_1(value, i) {
3317		if ($$self.$$.not_equal(_headers[i].value, value)) {
3318			_headers[i].value = value;
3319			$$invalidate(16, _headers);
3320		}
3321	}
3322
3323	function editablecell_el_binding_1(value, id) {
3324		if ($$self.$$.not_equal(els[id].input, value)) {
3325			els[id].input = value;
3326			$$invalidate(22, els);
3327		}
3328	}
3329
3330	const dblclick_handler_1 = i => edit_header(i);
3331	const click_handler_1 = i => handle_sort(i);
3332
3333	function virtualtable_items_binding(value$1) {
3334		data = value$1;
3335		((($$invalidate(17, data), $$invalidate(48, values)), $$invalidate(50, old_val)), $$invalidate(12, value));
3336	}
3337
3338	function virtualtable_actual_height_binding(value) {
3339		table_height = value;
3340		$$invalidate(31, table_height);
3341	}
3342
3343	function virtualtable_table_scrollbar_width_binding(value) {
3344		scrollbar_width = value;
3345		$$invalidate(32, scrollbar_width);
3346	}
3347
3348	function upload_dragging_binding(value) {
3349		dragging = value;
3350		$$invalidate(27, dragging);
3351	}
3352
3353	const load_handler = e => blob_to_string(data_uri_to_blob(e.detail.data));
3354
3355	function div0_binding($$value) {
3356		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
3357			parent = $$value;
3358			$$invalidate(29, parent);
3359		});
3360	}
3361
3362	const keydown_handler = e => handle_keydown(e);
3363	const click_handler_2 = e => (e.stopPropagation(), add_row());
3364	const click_handler_3 = e => (e.stopPropagation(), add_col());
3365
3366	$$self.$$set = $$props => {
3367		if ('datatype' in $$props) $$invalidate(0, datatype = $$props.datatype);
3368		if ('label' in $$props) $$invalidate(1, label = $$props.label);
3369		if ('headers' in $$props) $$invalidate(47, headers = $$props.headers);
3370		if ('value' in $$props) $$invalidate(12, value = $$props.value);
3371		if ('col_count' in $$props) $$invalidate(2, col_count = $$props.col_count);
3372		if ('row_count' in $$props) $$invalidate(3, row_count = $$props.row_count);
3373		if ('latex_delimiters' in $$props) $$invalidate(4, latex_delimiters = $$props.latex_delimiters);
3374		if ('editable' in $$props) $$invalidate(5, editable = $$props.editable);
3375		if ('wrap' in $$props) $$invalidate(6, wrap = $$props.wrap);
3376		if ('root' in $$props) $$invalidate(7, root = $$props.root);
3377		if ('i18n' in $$props) $$invalidate(8, i18n = $$props.i18n);
3378		if ('height' in $$props) $$invalidate(9, height = $$props.height);
3379		if ('line_breaks' in $$props) $$invalidate(10, line_breaks = $$props.line_breaks);
3380		if ('column_widths' in $$props) $$invalidate(11, column_widths = $$props.column_widths);
3381	};
3382
3383	$$self.$$.update = () => {
3384		if ($$self.$$.dirty[0] & /*value*/ 4096 | $$self.$$.dirty[1] & /*values*/ 131072) {
3385			{
3386				if (value) {
3387					$$invalidate(47, headers = value.headers);
3388					$$invalidate(48, values = value.data);
3389					$$invalidate(14, display_value = value?.metadata?.display_value ?? null);
3390					$$invalidate(15, styling = value?.metadata?.styling ?? null);
3391				} else if (values === null) {
3392					$$invalidate(48, values = []);
3393				}
3394			}
3395		}
3396
3397		if ($$self.$$.dirty[0] & /*selected*/ 8192) {
3398			{
3399				if (selected !== false) {
3400					const [row, col] = selected;
3401
3402					if (!isNaN(row) && !isNaN(col)) {
3403						dispatch("select", {
3404							index: [row, col],
3405							value: get_data_at(row, col)
3406						});
3407					}
3408				}
3409			}
3410		}
3411
3412		if ($$self.$$.dirty[1] & /*headers, old_headers*/ 327680) {
3413			{
3414				if (!dequal(headers, old_headers)) {
3415					trigger_headers();
3416				}
3417			}
3418		}
3419
3420		if ($$self.$$.dirty[1] & /*values, old_val*/ 655360) {
3421			if (!dequal(values, old_val)) {
3422				$$invalidate(17, data = process_data(values));
3423				$$invalidate(50, old_val = values);
3424			}
3425		}
3426
3427		if ($$self.$$.dirty[0] & /*_headers, data, editable, display_value, styling*/ 245792) {
3428			_headers && dispatch("change", {
3429				data: data.map(r => r.map(({ value }) => value)),
3430				headers: _headers.map(h => h.value),
3431				metadata: editable ? null : { display_value, styling }
3432			});
3433		}
3434
3435		if ($$self.$$.dirty[0] & /*data*/ 131072) {
3436			$$invalidate(34, max = get_max(data));
3437		}
3438
3439		if ($$self.$$.dirty[0] & /*cells*/ 1048576) {
3440			cells[0] && set_cell_widths();
3441		}
3442
3443		if ($$self.$$.dirty[0] & /*data, display_value, styling, sort_by, sort_direction*/ 966656) {
3444			sort_data(data, display_value, styling, sort_by, sort_direction);
3445		}
3446
3447		if ($$self.$$.dirty[0] & /*selected*/ 8192) {
3448			$$invalidate(33, selected_index = !!selected && selected[0]);
3449		}
3450	};
3451
3452	return [
3453		datatype,
3454		label,
3455		col_count,
3456		row_count,
3457		latex_delimiters,
3458		editable,
3459		wrap,
3460		root,
3461		i18n,
3462		height,
3463		line_breaks,
3464		column_widths,
3465		value,
3466		selected,
3467		display_value,
3468		styling,
3469		_headers,
3470		data,
3471		sort_direction,
3472		sort_by,
3473		cells,
3474		editing,
3475		els,
3476		clear_on_focus,
3477		header_edit,
3478		select_on_focus,
3479		selected_header,
3480		dragging,
3481		t_width,
3482		parent,
3483		table,
3484		table_height,
3485		scrollbar_width,
3486		selected_index,
3487		max,
3488		get_sort_status,
3489		start_edit,
3490		handle_keydown,
3491		handle_cell_click,
3492		handle_sort,
3493		edit_header,
3494		end_header_edit,
3495		add_row,
3496		add_col,
3497		handle_click_outside,
3498		blob_to_string,
3499		set_cell_widths,
3500		headers,
3501		values,
3502		old_headers,
3503		old_val,
3504		resize_handler,
3505		td_binding,
3506		table_1_elementresize_handler,
3507		table_1_binding,
3508		editablecell_value_binding,
3509		editablecell_el_binding,
3510		blur_handler,
3511		touchstart_handler,
3512		click_handler,
3513		dblclick_handler,
3514		editablecell_value_binding_1,
3515		editablecell_el_binding_1,
3516		dblclick_handler_1,
3517		click_handler_1,
3518		virtualtable_items_binding,
3519		virtualtable_actual_height_binding,
3520		virtualtable_table_scrollbar_width_binding,
3521		upload_dragging_binding,
3522		load_handler,
3523		div0_binding,
3524		keydown_handler,
3525		click_handler_2,
3526		click_handler_3
3527	];
3528}
3529
3530class Table extends SvelteComponent$1 {
3531	constructor(options) {
3532		super();
3533
3534		init$1(
3535			this,
3536			options,
3537			instance$1,
3538			create_fragment$1,
3539			safe_not_equal$1,
3540			{
3541				datatype: 0,
3542				label: 1,
3543				headers: 47,
3544				value: 12,
3545				col_count: 2,
3546				row_count: 3,
3547				latex_delimiters: 4,
3548				editable: 5,
3549				wrap: 6,
3550				root: 7,
3551				i18n: 8,
3552				height: 9,
3553				line_breaks: 10,
3554				column_widths: 11
3555			},
3556			null,
3557			[-1, -1, -1, -1]
3558		);
3559	}
3560}
3561
3562const Table$1 = Table;
3563
3564/* home/runner/work/gradio/gradio/js/dataframe/Index.svelte generated by Svelte v4.2.2 */
3565const {
3566	SvelteComponent,
3567	assign,
3568	create_component,
3569	destroy_component,
3570	detach,
3571	get_spread_object,
3572	get_spread_update,
3573	init,
3574	insert,
3575	is_function,
3576	mount_component,
3577	safe_not_equal,
3578	space,
3579	transition_in,
3580	transition_out
3581} = window.__gradio__svelte__internal;
3582const { afterUpdate } = window.__gradio__svelte__internal;
3583function create_default_slot(ctx) {
3584	let statustracker;
3585	let t;
3586	let table;
3587	let current;
3588
3589	const statustracker_spread_levels = [
3590		{
3591			autoscroll: /*gradio*/ ctx[15].autoscroll
3592		},
3593		{ i18n: /*gradio*/ ctx[15].i18n },
3594		/*loading_status*/ ctx[18]
3595	];
3596
3597	let statustracker_props = {};
3598
3599	for (let i = 0; i < statustracker_spread_levels.length; i += 1) {
3600		statustracker_props = assign(statustracker_props, statustracker_spread_levels[i]);
3601	}
3602
3603	statustracker = new Static({ props: statustracker_props });
3604
3605	table = new Table$1({
3606			props: {
3607				root: /*root*/ ctx[12],
3608				label: /*label*/ ctx[7],
3609				row_count: /*row_count*/ ctx[6],
3610				col_count: /*col_count*/ ctx[5],
3611				value: /*value*/ ctx[0],
3612				headers: /*headers*/ ctx[1],
3613				wrap: /*wrap*/ ctx[8],
3614				datatype: /*datatype*/ ctx[9],
3615				latex_delimiters: /*latex_delimiters*/ ctx[16],
3616				editable: /*interactive*/ ctx[19],
3617				height: /*height*/ ctx[17],
3618				i18n: /*gradio*/ ctx[15].i18n,
3619				line_breaks: /*line_breaks*/ ctx[13],
3620				column_widths: /*column_widths*/ ctx[14]
3621			}
3622		});
3623
3624	table.$on("change", function () {
3625		if (is_function(/*interactive*/ ctx[19]
3626		? /*change_handler*/ ctx[22]
3627		: change_handler_1)) (/*interactive*/ ctx[19]
3628		? /*change_handler*/ ctx[22]
3629		: change_handler_1).apply(this, arguments);
3630	});
3631
3632	table.$on("select", /*select_handler*/ ctx[23]);
3633
3634	return {
3635		c() {
3636			create_component(statustracker.$$.fragment);
3637			t = space();
3638			create_component(table.$$.fragment);
3639		},
3640		m(target, anchor) {
3641			mount_component(statustracker, target, anchor);
3642			insert(target, t, anchor);
3643			mount_component(table, target, anchor);
3644			current = true;
3645		},
3646		p(new_ctx, dirty) {
3647			ctx = new_ctx;
3648
3649			const statustracker_changes = (dirty & /*gradio, loading_status*/ 294912)
3650			? get_spread_update(statustracker_spread_levels, [
3651					dirty & /*gradio*/ 32768 && {
3652						autoscroll: /*gradio*/ ctx[15].autoscroll
3653					},
3654					dirty & /*gradio*/ 32768 && { i18n: /*gradio*/ ctx[15].i18n },
3655					dirty & /*loading_status*/ 262144 && get_spread_object(/*loading_status*/ ctx[18])
3656				])
3657			: {};
3658
3659			statustracker.$set(statustracker_changes);
3660			const table_changes = {};
3661			if (dirty & /*root*/ 4096) table_changes.root = /*root*/ ctx[12];
3662			if (dirty & /*label*/ 128) table_changes.label = /*label*/ ctx[7];
3663			if (dirty & /*row_count*/ 64) table_changes.row_count = /*row_count*/ ctx[6];
3664			if (dirty & /*col_count*/ 32) table_changes.col_count = /*col_count*/ ctx[5];
3665			if (dirty & /*value*/ 1) table_changes.value = /*value*/ ctx[0];
3666			if (dirty & /*headers*/ 2) table_changes.headers = /*headers*/ ctx[1];
3667			if (dirty & /*wrap*/ 256) table_changes.wrap = /*wrap*/ ctx[8];
3668			if (dirty & /*datatype*/ 512) table_changes.datatype = /*datatype*/ ctx[9];
3669			if (dirty & /*latex_delimiters*/ 65536) table_changes.latex_delimiters = /*latex_delimiters*/ ctx[16];
3670			if (dirty & /*interactive*/ 524288) table_changes.editable = /*interactive*/ ctx[19];
3671			if (dirty & /*height*/ 131072) table_changes.height = /*height*/ ctx[17];
3672			if (dirty & /*gradio*/ 32768) table_changes.i18n = /*gradio*/ ctx[15].i18n;
3673			if (dirty & /*line_breaks*/ 8192) table_changes.line_breaks = /*line_breaks*/ ctx[13];
3674			if (dirty & /*column_widths*/ 16384) table_changes.column_widths = /*column_widths*/ ctx[14];
3675			table.$set(table_changes);
3676		},
3677		i(local) {
3678			if (current) return;
3679			transition_in(statustracker.$$.fragment, local);
3680			transition_in(table.$$.fragment, local);
3681			current = true;
3682		},
3683		o(local) {
3684			transition_out(statustracker.$$.fragment, local);
3685			transition_out(table.$$.fragment, local);
3686			current = false;
3687		},
3688		d(detaching) {
3689			if (detaching) {
3690				detach(t);
3691			}
3692
3693			destroy_component(statustracker, detaching);
3694			destroy_component(table, detaching);
3695		}
3696	};
3697}
3698
3699function create_fragment(ctx) {
3700	let block;
3701	let current;
3702
3703	block = new Block({
3704			props: {
3705				visible: /*visible*/ ctx[4],
3706				padding: false,
3707				elem_id: /*elem_id*/ ctx[2],
3708				elem_classes: /*elem_classes*/ ctx[3],
3709				container: false,
3710				scale: /*scale*/ ctx[10],
3711				min_width: /*min_width*/ ctx[11],
3712				allow_overflow: false,
3713				$$slots: { default: [create_default_slot] },
3714				$$scope: { ctx }
3715			}
3716		});
3717
3718	return {
3719		c() {
3720			create_component(block.$$.fragment);
3721		},
3722		m(target, anchor) {
3723			mount_component(block, target, anchor);
3724			current = true;
3725		},
3726		p(ctx, [dirty]) {
3727			const block_changes = {};
3728			if (dirty & /*visible*/ 16) block_changes.visible = /*visible*/ ctx[4];
3729			if (dirty & /*elem_id*/ 4) block_changes.elem_id = /*elem_id*/ ctx[2];
3730			if (dirty & /*elem_classes*/ 8) block_changes.elem_classes = /*elem_classes*/ ctx[3];
3731			if (dirty & /*scale*/ 1024) block_changes.scale = /*scale*/ ctx[10];
3732			if (dirty & /*min_width*/ 2048) block_changes.min_width = /*min_width*/ ctx[11];
3733
3734			if (dirty & /*$$scope, root, label, row_count, col_count, value, headers, wrap, datatype, latex_delimiters, interactive, height, gradio, line_breaks, column_widths, loading_status*/ 34599907) {
3735				block_changes.$$scope = { dirty, ctx };
3736			}
3737
3738			block.$set(block_changes);
3739		},
3740		i(local) {
3741			if (current) return;
3742			transition_in(block.$$.fragment, local);
3743			current = true;
3744		},
3745		o(local) {
3746			transition_out(block.$$.fragment, local);
3747			current = false;
3748		},
3749		d(detaching) {
3750			destroy_component(block, detaching);
3751		}
3752	};
3753}
3754
3755const change_handler_1 = () => {
3756	
3757};
3758
3759function instance($$self, $$props, $$invalidate) {
3760	let { headers = [] } = $$props;
3761	let { elem_id = "" } = $$props;
3762	let { elem_classes = [] } = $$props;
3763	let { visible = true } = $$props;
3764
3765	let { value = {
3766		data: [["", "", ""]],
3767		headers: ["1", "2", "3"],
3768		metadata: null
3769	} } = $$props;
3770
3771	let old_value = JSON.stringify(value);
3772	let { value_is_output = false } = $$props;
3773	let { col_count } = $$props;
3774	let { row_count } = $$props;
3775	let { label = null } = $$props;
3776	let { wrap } = $$props;
3777	let { datatype } = $$props;
3778	let { scale = null } = $$props;
3779	let { min_width = undefined } = $$props;
3780	let { root } = $$props;
3781	let { line_breaks = true } = $$props;
3782	let { column_widths = [] } = $$props;
3783	let { gradio } = $$props;
3784	let { latex_delimiters } = $$props;
3785	let { height = undefined } = $$props;
3786	let { loading_status } = $$props;
3787	let { interactive } = $$props;
3788
3789	function handle_change() {
3790		gradio.dispatch("change");
3791
3792		if (!value_is_output) {
3793			gradio.dispatch("input");
3794		}
3795	}
3796
3797	afterUpdate(() => {
3798		$$invalidate(20, value_is_output = false);
3799	});
3800
3801	if (Array.isArray(value) && value?.[0]?.length === 0 || value.data?.[0]?.length === 0) {
3802		value = {
3803			data: [Array(col_count?.[0] || 3).fill("")],
3804			headers: Array(col_count?.[0] || 3).fill("").map((_, i) => `${i + 1}`),
3805			metadata: null
3806		};
3807	}
3808
3809	const change_handler = e => $$invalidate(0, value = e.detail);
3810	const select_handler = e => gradio.dispatch("select", e.detail);
3811
3812	$$self.$$set = $$props => {
3813		if ('headers' in $$props) $$invalidate(1, headers = $$props.headers);
3814		if ('elem_id' in $$props) $$invalidate(2, elem_id = $$props.elem_id);
3815		if ('elem_classes' in $$props) $$invalidate(3, elem_classes = $$props.elem_classes);
3816		if ('visible' in $$props) $$invalidate(4, visible = $$props.visible);
3817		if ('value' in $$props) $$invalidate(0, value = $$props.value);
3818		if ('value_is_output' in $$props) $$invalidate(20, value_is_output = $$props.value_is_output);
3819		if ('col_count' in $$props) $$invalidate(5, col_count = $$props.col_count);
3820		if ('row_count' in $$props) $$invalidate(6, row_count = $$props.row_count);
3821		if ('label' in $$props) $$invalidate(7, label = $$props.label);
3822		if ('wrap' in $$props) $$invalidate(8, wrap = $$props.wrap);
3823		if ('datatype' in $$props) $$invalidate(9, datatype = $$props.datatype);
3824		if ('scale' in $$props) $$invalidate(10, scale = $$props.scale);
3825		if ('min_width' in $$props) $$invalidate(11, min_width = $$props.min_width);
3826		if ('root' in $$props) $$invalidate(12, root = $$props.root);
3827		if ('line_breaks' in $$props) $$invalidate(13, line_breaks = $$props.line_breaks);
3828		if ('column_widths' in $$props) $$invalidate(14, column_widths = $$props.column_widths);
3829		if ('gradio' in $$props) $$invalidate(15, gradio = $$props.gradio);
3830		if ('latex_delimiters' in $$props) $$invalidate(16, latex_delimiters = $$props.latex_delimiters);
3831		if ('height' in $$props) $$invalidate(17, height = $$props.height);
3832		if ('loading_status' in $$props) $$invalidate(18, loading_status = $$props.loading_status);
3833		if ('interactive' in $$props) $$invalidate(19, interactive = $$props.interactive);
3834	};
3835
3836	$$self.$$.update = () => {
3837		if ($$self.$$.dirty & /*value, old_value*/ 2097153) {
3838			{
3839				if (JSON.stringify(value) !== old_value) {
3840					$$invalidate(21, old_value = JSON.stringify(value));
3841					handle_change();
3842				}
3843			}
3844		}
3845	};
3846
3847	return [
3848		value,
3849		headers,
3850		elem_id,
3851		elem_classes,
3852		visible,
3853		col_count,
3854		row_count,
3855		label,
3856		wrap,
3857		datatype,
3858		scale,
3859		min_width,
3860		root,
3861		line_breaks,
3862		column_widths,
3863		gradio,
3864		latex_delimiters,
3865		height,
3866		loading_status,
3867		interactive,
3868		value_is_output,
3869		old_value,
3870		change_handler,
3871		select_handler
3872	];
3873}
3874
3875class Index extends SvelteComponent {
3876	constructor(options) {
3877		super();
3878
3879		init(this, options, instance, create_fragment, safe_not_equal, {
3880			headers: 1,
3881			elem_id: 2,
3882			elem_classes: 3,
3883			visible: 4,
3884			value: 0,
3885			value_is_output: 20,
3886			col_count: 5,
3887			row_count: 6,
3888			label: 7,
3889			wrap: 8,
3890			datatype: 9,
3891			scale: 10,
3892			min_width: 11,
3893			root: 12,
3894			line_breaks: 13,
3895			column_widths: 14,
3896			gradio: 15,
3897			latex_delimiters: 16,
3898			height: 17,
3899			loading_status: 18,
3900			interactive: 19
3901		});
3902	}
3903}
3904
3905export { Table$1 as BaseDataFrame, Index as default };
3906//# sourceMappingURL=Index-42ed4a43.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.