PageSourceSearch

https://paulbucurestiberceni-remove-video-background.hf.space/assets/Textbox-4503493e.js

js paulbucurestiberceni-remove-video-background.hf.space collected 2026-10-03 10:24:41 UTC 25,755 bytes, 1,068 lines download raw bytes

1import { f as fade } from './Button-0502e555.js';
2import { B as BlockTitle } from './BlockTitle-a8a324e7.js';
3import { C as Check } from './Check-f7edb5d9.js';
4import { C as Copy } from './Copy-a69620a8.js';
5import './Index-4c82ea7b.js';
6
7const Textbox_svelte_svelte_type_style_lang = '';
8
9/* home/runner/work/gradio/gradio/js/textbox/shared/Textbox.svelte generated by Svelte v4.2.2 */
10const {
11	SvelteComponent,
12	action_destroyer,
13	add_render_callback,
14	append,
15	attr,
16	binding_callbacks,
17	bubble,
18	check_outros,
19	create_component,
20	create_in_transition,
21	destroy_component,
22	detach,
23	element,
24	empty,
25	group_outros,
26	init,
27	insert,
28	is_function,
29	listen,
30	mount_component,
31	noop,
32	run_all,
33	safe_not_equal,
34	set_data,
35	set_input_value,
36	space,
37	text,
38	toggle_class,
39	transition_in,
40	transition_out
41} = window.__gradio__svelte__internal;
42const { beforeUpdate, afterUpdate, createEventDispatcher, tick } = window.__gradio__svelte__internal;
43function create_default_slot(ctx) {
44	let t;
45
46	return {
47		c() {
48			t = text(/*label*/ ctx[3]);
49		},
50		m(target, anchor) {
51			insert(target, t, anchor);
52		},
53		p(ctx, dirty) {
54			if (dirty[0] & /*label*/ 8) set_data(t, /*label*/ ctx[3]);
55		},
56		d(detaching) {
57			if (detaching) {
58				detach(t);
59			}
60		}
61	};
62}
63
64// (198:1) {:else}
65function create_else_block(ctx) {
66	let t;
67	let textarea;
68	let textarea_dir_value;
69	let textarea_style_value;
70	let text_area_resize_action;
71	let current;
72	let mounted;
73	let dispose;
74	let if_block = /*show_label*/ ctx[6] && /*show_copy_button*/ ctx[10] && create_if_block_4(ctx);
75
76	return {
77		c() {
78			if (if_block) if_block.c();
79			t = space();
80			textarea = element("textarea");
81			attr(textarea, "data-testid", "textbox");
82			attr(textarea, "class", "scroll-hide svelte-1f354aw");
83			attr(textarea, "dir", textarea_dir_value = /*rtl*/ ctx[11] ? "rtl" : "ltr");
84			attr(textarea, "placeholder", /*placeholder*/ ctx[2]);
85			attr(textarea, "rows", /*lines*/ ctx[1]);
86			textarea.disabled = /*disabled*/ ctx[5];
87			textarea.autofocus = /*autofocus*/ ctx[12];
88
89			attr(textarea, "style", textarea_style_value = /*text_align*/ ctx[13]
90			? "text-align: " + /*text_align*/ ctx[13]
91			: "");
92		},
93		m(target, anchor) {
94			if (if_block) if_block.m(target, anchor);
95			insert(target, t, anchor);
96			insert(target, textarea, anchor);
97			set_input_value(textarea, /*value*/ ctx[0]);
98			/*textarea_binding*/ ctx[38](textarea);
99			current = true;
100			if (/*autofocus*/ ctx[12]) textarea.focus();
101
102			if (!mounted) {
103				dispose = [
104					action_destroyer(text_area_resize_action = /*text_area_resize*/ ctx[20].call(null, textarea, /*value*/ ctx[0])),
105					listen(textarea, "input", /*textarea_input_handler*/ ctx[37]),
106					listen(textarea, "keypress", /*handle_keypress*/ ctx[18]),
107					listen(textarea, "blur", /*blur_handler_3*/ ctx[29]),
108					listen(textarea, "select", /*handle_select*/ ctx[17]),
109					listen(textarea, "focus", /*focus_handler_3*/ ctx[30]),
110					listen(textarea, "scroll", /*handle_scroll*/ ctx[19])
111				];
112
113				mounted = true;
114			}
115		},
116		p(ctx, dirty) {
117			if (/*show_label*/ ctx[6] && /*show_copy_button*/ ctx[10]) {
118				if (if_block) {
119					if_block.p(ctx, dirty);
120
121					if (dirty[0] & /*show_label, show_copy_button*/ 1088) {
122						transition_in(if_block, 1);
123					}
124				} else {
125					if_block = create_if_block_4(ctx);
126					if_block.c();
127					transition_in(if_block, 1);
128					if_block.m(t.parentNode, t);
129				}
130			} else if (if_block) {
131				group_outros();
132
133				transition_out(if_block, 1, 1, () => {
134					if_block = null;
135				});
136
137				check_outros();
138			}
139
140			if (!current || dirty[0] & /*rtl*/ 2048 && textarea_dir_value !== (textarea_dir_value = /*rtl*/ ctx[11] ? "rtl" : "ltr")) {
141				attr(textarea, "dir", textarea_dir_value);
142			}
143
144			if (!current || dirty[0] & /*placeholder*/ 4) {
145				attr(textarea, "placeholder", /*placeholder*/ ctx[2]);
146			}
147
148			if (!current || dirty[0] & /*lines*/ 2) {
149				attr(textarea, "rows", /*lines*/ ctx[1]);
150			}
151
152			if (!current || dirty[0] & /*disabled*/ 32) {
153				textarea.disabled = /*disabled*/ ctx[5];
154			}
155
156			if (!current || dirty[0] & /*autofocus*/ 4096) {
157				textarea.autofocus = /*autofocus*/ ctx[12];
158			}
159
160			if (!current || dirty[0] & /*text_align*/ 8192 && textarea_style_value !== (textarea_style_value = /*text_align*/ ctx[13]
161			? "text-align: " + /*text_align*/ ctx[13]
162			: "")) {
163				attr(textarea, "style", textarea_style_value);
164			}
165
166			if (text_area_resize_action && is_function(text_area_resize_action.update) && dirty[0] & /*value*/ 1) text_area_resize_action.update.call(null, /*value*/ ctx[0]);
167
168			if (dirty[0] & /*value*/ 1) {
169				set_input_value(textarea, /*value*/ ctx[0]);
170			}
171		},
172		i(local) {
173			if (current) return;
174			transition_in(if_block);
175			current = true;
176		},
177		o(local) {
178			transition_out(if_block);
179			current = false;
180		},
181		d(detaching) {
182			if (detaching) {
183				detach(t);
184				detach(textarea);
185			}
186
187			if (if_block) if_block.d(detaching);
188			/*textarea_binding*/ ctx[38](null);
189			mounted = false;
190			run_all(dispose);
191		}
192	};
193}
194
195// (147:1) {#if lines === 1 && max_lines === 1}
196function create_if_block(ctx) {
197	let if_block_anchor;
198
199	function select_block_type_1(ctx, dirty) {
200		if (/*type*/ ctx[9] === "text") return create_if_block_1;
201		if (/*type*/ ctx[9] === "password") return create_if_block_2;
202		if (/*type*/ ctx[9] === "email") return create_if_block_3;
203	}
204
205	let current_block_type = select_block_type_1(ctx);
206	let if_block = current_block_type && current_block_type(ctx);
207
208	return {
209		c() {
210			if (if_block) if_block.c();
211			if_block_anchor = empty();
212		},
213		m(target, anchor) {
214			if (if_block) if_block.m(target, anchor);
215			insert(target, if_block_anchor, anchor);
216		},
217		p(ctx, dirty) {
218			if (current_block_type === (current_block_type = select_block_type_1(ctx)) && if_block) {
219				if_block.p(ctx, dirty);
220			} else {
221				if (if_block) if_block.d(1);
222				if_block = current_block_type && current_block_type(ctx);
223
224				if (if_block) {
225					if_block.c();
226					if_block.m(if_block_anchor.parentNode, if_block_anchor);
227				}
228			}
229		},
230		i: noop,
231		o: noop,
232		d(detaching) {
233			if (detaching) {
234				detach(if_block_anchor);
235			}
236
237			if (if_block) {
238				if_block.d(detaching);
239			}
240		}
241	};
242}
243
244// (199:2) {#if show_label && show_copy_button}
245function create_if_block_4(ctx) {
246	let current_block_type_index;
247	let if_block;
248	let if_block_anchor;
249	let current;
250	const if_block_creators = [create_if_block_5, create_else_block_1];
251	const if_blocks = [];
252
253	function select_block_type_2(ctx, dirty) {
254		if (/*copied*/ ctx[15]) return 0;
255		return 1;
256	}
257
258	current_block_type_index = select_block_type_2(ctx);
259	if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
260
261	return {
262		c() {
263			if_block.c();
264			if_block_anchor = empty();
265		},
266		m(target, anchor) {
267			if_blocks[current_block_type_index].m(target, anchor);
268			insert(target, if_block_anchor, anchor);
269			current = true;
270		},
271		p(ctx, dirty) {
272			let previous_block_index = current_block_type_index;
273			current_block_type_index = select_block_type_2(ctx);
274
275			if (current_block_type_index === previous_block_index) {
276				if_blocks[current_block_type_index].p(ctx, dirty);
277			} else {
278				group_outros();
279
280				transition_out(if_blocks[previous_block_index], 1, 1, () => {
281					if_blocks[previous_block_index] = null;
282				});
283
284				check_outros();
285				if_block = if_blocks[current_block_type_index];
286
287				if (!if_block) {
288					if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
289					if_block.c();
290				} else {
291					if_block.p(ctx, dirty);
292				}
293
294				transition_in(if_block, 1);
295				if_block.m(if_block_anchor.parentNode, if_block_anchor);
296			}
297		},
298		i(local) {
299			if (current) return;
300			transition_in(if_block);
301			current = true;
302		},
303		o(local) {
304			transition_out(if_block);
305			current = false;
306		},
307		d(detaching) {
308			if (detaching) {
309				detach(if_block_anchor);
310			}
311
312			if_blocks[current_block_type_index].d(detaching);
313		}
314	};
315}
316
317// (206:3) {:else}
318function create_else_block_1(ctx) {
319	let button;
320	let copy;
321	let current;
322	let mounted;
323	let dispose;
324	copy = new Copy({});
325
326	return {
327		c() {
328			button = element("button");
329			create_component(copy.$$.fragment);
330			attr(button, "aria-label", "Copy");
331			attr(button, "aria-roledescription", "Copy text");
332			attr(button, "class", "svelte-1f354aw");
333		},
334		m(target, anchor) {
335			insert(target, button, anchor);
336			mount_component(copy, button, null);
337			current = true;
338
339			if (!mounted) {
340				dispose = listen(button, "click", /*handle_copy*/ ctx[16]);
341				mounted = true;
342			}
343		},
344		p: noop,
345		i(local) {
346			if (current) return;
347			transition_in(copy.$$.fragment, local);
348			current = true;
349		},
350		o(local) {
351			transition_out(copy.$$.fragment, local);
352			current = false;
353		},
354		d(detaching) {
355			if (detaching) {
356				detach(button);
357			}
358
359			destroy_component(copy);
360			mounted = false;
361			dispose();
362		}
363	};
364}
365
366// (200:3) {#if copied}
367function create_if_block_5(ctx) {
368	let button;
369	let check;
370	let button_intro;
371	let current;
372	check = new Check({});
373
374	return {
375		c() {
376			button = element("button");
377			create_component(check.$$.fragment);
378			attr(button, "aria-label", "Copied");
379			attr(button, "aria-roledescription", "Text copied");
380			attr(button, "class", "svelte-1f354aw");
381		},
382		m(target, anchor) {
383			insert(target, button, anchor);
384			mount_component(check, button, null);
385			current = true;
386		},
387		p: noop,
388		i(local) {
389			if (current) return;
390			transition_in(check.$$.fragment, local);
391
392			if (local) {
393				if (!button_intro) {
394					add_render_callback(() => {
395						button_intro = create_in_transition(button, fade, { duration: 300 });
396						button_intro.start();
397					});
398				}
399			}
400
401			current = true;
402		},
403		o(local) {
404			transition_out(check.$$.fragment, local);
405			current = false;
406		},
407		d(detaching) {
408			if (detaching) {
409				detach(button);
410			}
411
412			destroy_component(check);
413		}
414	};
415}
416
417// (181:29) 
418function create_if_block_3(ctx) {
419	let input;
420	let mounted;
421	let dispose;
422
423	return {
424		c() {
425			input = element("input");
426			attr(input, "data-testid", "textbox");
427			attr(input, "type", "email");
428			attr(input, "class", "scroll-hide svelte-1f354aw");
429			attr(input, "placeholder", /*placeholder*/ ctx[2]);
430			input.disabled = /*disabled*/ ctx[5];
431			input.autofocus = /*autofocus*/ ctx[12];
432			attr(input, "autocomplete", "email");
433		},
434		m(target, anchor) {
435			insert(target, input, anchor);
436			set_input_value(input, /*value*/ ctx[0]);
437			/*input_binding_2*/ ctx[36](input);
438			if (/*autofocus*/ ctx[12]) input.focus();
439
440			if (!mounted) {
441				dispose = [
442					listen(input, "input", /*input_input_handler_2*/ ctx[35]),
443					listen(input, "keypress", /*handle_keypress*/ ctx[18]),
444					listen(input, "blur", /*blur_handler_2*/ ctx[27]),
445					listen(input, "select", /*handle_select*/ ctx[17]),
446					listen(input, "focus", /*focus_handler_2*/ ctx[28])
447				];
448
449				mounted = true;
450			}
451		},
452		p(ctx, dirty) {
453			if (dirty[0] & /*placeholder*/ 4) {
454				attr(input, "placeholder", /*placeholder*/ ctx[2]);
455			}
456
457			if (dirty[0] & /*disabled*/ 32) {
458				input.disabled = /*disabled*/ ctx[5];
459			}
460
461			if (dirty[0] & /*autofocus*/ 4096) {
462				input.autofocus = /*autofocus*/ ctx[12];
463			}
464
465			if (dirty[0] & /*value*/ 1 && input.value !== /*value*/ ctx[0]) {
466				set_input_value(input, /*value*/ ctx[0]);
467			}
468		},
469		d(detaching) {
470			if (detaching) {
471				detach(input);
472			}
473
474			/*input_binding_2*/ ctx[36](null);
475			mounted = false;
476			run_all(dispose);
477		}
478	};
479}
480
481// (165:32) 
482function create_if_block_2(ctx) {
483	let input;
484	let mounted;
485	let dispose;
486
487	return {
488		c() {
489			input = element("input");
490			attr(input, "data-testid", "password");
491			attr(input, "type", "password");
492			attr(input, "class", "scroll-hide svelte-1f354aw");
493			attr(input, "placeholder", /*placeholder*/ ctx[2]);
494			input.disabled = /*disabled*/ ctx[5];
495			input.autofocus = /*autofocus*/ ctx[12];
496			attr(input, "autocomplete", "");
497		},
498		m(target, anchor) {
499			insert(target, input, anchor);
500			set_input_value(input, /*value*/ ctx[0]);
501			/*input_binding_1*/ ctx[34](input);
502			if (/*autofocus*/ ctx[12]) input.focus();
503
504			if (!mounted) {
505				dispose = [
506					listen(input, "input", /*input_input_handler_1*/ ctx[33]),
507					listen(input, "keypress", /*handle_keypress*/ ctx[18]),
508					listen(input, "blur", /*blur_handler_1*/ ctx[25]),
509					listen(input, "select", /*handle_select*/ ctx[17]),
510					listen(input, "focus", /*focus_handler_1*/ ctx[26])
511				];
512
513				mounted = true;
514			}
515		},
516		p(ctx, dirty) {
517			if (dirty[0] & /*placeholder*/ 4) {
518				attr(input, "placeholder", /*placeholder*/ ctx[2]);
519			}
520
521			if (dirty[0] & /*disabled*/ 32) {
522				input.disabled = /*disabled*/ ctx[5];
523			}
524
525			if (dirty[0] & /*autofocus*/ 4096) {
526				input.autofocus = /*autofocus*/ ctx[12];
527			}
528
529			if (dirty[0] & /*value*/ 1 && input.value !== /*value*/ ctx[0]) {
530				set_input_value(input, /*value*/ ctx[0]);
531			}
532		},
533		d(detaching) {
534			if (detaching) {
535				detach(input);
536			}
537
538			/*input_binding_1*/ ctx[34](null);
539			mounted = false;
540			run_all(dispose);
541		}
542	};
543}
544
545// (148:2) {#if type === "text"}
546function create_if_block_1(ctx) {
547	let input;
548	let input_dir_value;
549	let input_style_value;
550	let mounted;
551	let dispose;
552
553	return {
554		c() {
555			input = element("input");
556			attr(input, "data-testid", "textbox");
557			attr(input, "type", "text");
558			attr(input, "class", "scroll-hide svelte-1f354aw");
559			attr(input, "dir", input_dir_value = /*rtl*/ ctx[11] ? "rtl" : "ltr");
560			attr(input, "placeholder", /*placeholder*/ ctx[2]);
561			input.disabled = /*disabled*/ ctx[5];
562			input.autofocus = /*autofocus*/ ctx[12];
563
564			attr(input, "style", input_style_value = /*text_align*/ ctx[13]
565			? "text-align: " + /*text_align*/ ctx[13]
566			: "");
567		},
568		m(target, anchor) {
569			insert(target, input, anchor);
570			set_input_value(input, /*value*/ ctx[0]);
571			/*input_binding*/ ctx[32](input);
572			if (/*autofocus*/ ctx[12]) input.focus();
573
574			if (!mounted) {
575				dispose = [
576					listen(input, "input", /*input_input_handler*/ ctx[31]),
577					listen(input, "keypress", /*handle_keypress*/ ctx[18]),
578					listen(input, "blur", /*blur_handler*/ ctx[23]),
579					listen(input, "select", /*handle_select*/ ctx[17]),
580					listen(input, "focus", /*focus_handler*/ ctx[24])
581				];
582
583				mounted = true;
584			}
585		},
586		p(ctx, dirty) {
587			if (dirty[0] & /*rtl*/ 2048 && input_dir_value !== (input_dir_value = /*rtl*/ ctx[11] ? "rtl" : "ltr")) {
588				attr(input, "dir", input_dir_value);
589			}
590
591			if (dirty[0] & /*placeholder*/ 4) {
592				attr(input, "placeholder", /*placeholder*/ ctx[2]);
593			}
594
595			if (dirty[0] & /*disabled*/ 32) {
596				input.disabled = /*disabled*/ ctx[5];
597			}
598
599			if (dirty[0] & /*autofocus*/ 4096) {
600				input.autofocus = /*autofocus*/ ctx[12];
601			}
602
603			if (dirty[0] & /*text_align*/ 8192 && input_style_value !== (input_style_value = /*text_align*/ ctx[13]
604			? "text-align: " + /*text_align*/ ctx[13]
605			: "")) {
606				attr(input, "style", input_style_value);
607			}
608
609			if (dirty[0] & /*value*/ 1 && input.value !== /*value*/ ctx[0]) {
610				set_input_value(input, /*value*/ ctx[0]);
611			}
612		},
613		d(detaching) {
614			if (detaching) {
615				detach(input);
616			}
617
618			/*input_binding*/ ctx[32](null);
619			mounted = false;
620			run_all(dispose);
621		}
622	};
623}
624
625function create_fragment(ctx) {
626	let label_1;
627	let blocktitle;
628	let t;
629	let current_block_type_index;
630	let if_block;
631	let current;
632
633	blocktitle = new BlockTitle({
634			props: {
635				show_label: /*show_label*/ ctx[6],
636				info: /*info*/ ctx[4],
637				$$slots: { default: [create_default_slot] },
638				$$scope: { ctx }
639			}
640		});
641
642	const if_block_creators = [create_if_block, create_else_block];
643	const if_blocks = [];
644
645	function select_block_type(ctx, dirty) {
646		if (/*lines*/ ctx[1] === 1 && /*max_lines*/ ctx[8] === 1) return 0;
647		return 1;
648	}
649
650	current_block_type_index = select_block_type(ctx);
651	if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
652
653	return {
654		c() {
655			label_1 = element("label");
656			create_component(blocktitle.$$.fragment);
657			t = space();
658			if_block.c();
659			attr(label_1, "class", "svelte-1f354aw");
660			toggle_class(label_1, "container", /*container*/ ctx[7]);
661		},
662		m(target, anchor) {
663			insert(target, label_1, anchor);
664			mount_component(blocktitle, label_1, null);
665			append(label_1, t);
666			if_blocks[current_block_type_index].m(label_1, null);
667			current = true;
668		},
669		p(ctx, dirty) {
670			const blocktitle_changes = {};
671			if (dirty[0] & /*show_label*/ 64) blocktitle_changes.show_label = /*show_label*/ ctx[6];
672			if (dirty[0] & /*info*/ 16) blocktitle_changes.info = /*info*/ ctx[4];
673
674			if (dirty[0] & /*label*/ 8 | dirty[1] & /*$$scope*/ 131072) {
675				blocktitle_changes.$$scope = { dirty, ctx };
676			}
677
678			blocktitle.$set(blocktitle_changes);
679			let previous_block_index = current_block_type_index;
680			current_block_type_index = select_block_type(ctx);
681
682			if (current_block_type_index === previous_block_index) {
683				if_blocks[current_block_type_index].p(ctx, dirty);
684			} else {
685				group_outros();
686
687				transition_out(if_blocks[previous_block_index], 1, 1, () => {
688					if_blocks[previous_block_index] = null;
689				});
690
691				check_outros();
692				if_block = if_blocks[current_block_type_index];
693
694				if (!if_block) {
695					if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
696					if_block.c();
697				} else {
698					if_block.p(ctx, dirty);
699				}
700
701				transition_in(if_block, 1);
702				if_block.m(label_1, null);
703			}
704
705			if (!current || dirty[0] & /*container*/ 128) {
706				toggle_class(label_1, "container", /*container*/ ctx[7]);
707			}
708		},
709		i(local) {
710			if (current) return;
711			transition_in(blocktitle.$$.fragment, local);
712			transition_in(if_block);
713			current = true;
714		},
715		o(local) {
716			transition_out(blocktitle.$$.fragment, local);
717			transition_out(if_block);
718			current = false;
719		},
720		d(detaching) {
721			if (detaching) {
722				detach(label_1);
723			}
724
725			destroy_component(blocktitle);
726			if_blocks[current_block_type_index].d();
727		}
728	};
729}
730
731function instance($$self, $$props, $$invalidate) {
732	let { value = "" } = $$props;
733	let { value_is_output = false } = $$props;
734	let { lines = 1 } = $$props;
735	let { placeholder = "Type here..." } = $$props;
736	let { label } = $$props;
737	let { info = undefined } = $$props;
738	let { disabled = false } = $$props;
739	let { show_label = true } = $$props;
740	let { container = true } = $$props;
741	let { max_lines } = $$props;
742	let { type = "text" } = $$props;
743	let { show_copy_button = false } = $$props;
744	let { rtl = false } = $$props;
745	let { autofocus = false } = $$props;
746	let { text_align = undefined } = $$props;
747	let { autoscroll = true } = $$props;
748	let el;
749	let copied = false;
750	let timer;
751	let can_scroll;
752	let previous_scroll_top = 0;
753	let user_has_scrolled_up = false;
754	const dispatch = createEventDispatcher();
755
756	beforeUpdate(() => {
757		can_scroll = el && el.offsetHeight + el.scrollTop > el.scrollHeight - 100;
758	});
759
760	const scroll = () => {
761		if (can_scroll && autoscroll && !user_has_scrolled_up) {
762			el.scrollTo(0, el.scrollHeight);
763		}
764	};
765
766	function handle_change() {
767		dispatch("change", value);
768
769		if (!value_is_output) {
770			dispatch("input");
771		}
772	}
773
774	afterUpdate(() => {
775		if (autofocus) {
776			el.focus();
777		}
778
779		if (can_scroll && autoscroll) {
780			scroll();
781		}
782
783		$$invalidate(21, value_is_output = false);
784	});
785
786	async function handle_copy() {
787		if ("clipboard" in navigator) {
788			await navigator.clipboard.writeText(value);
789			copy_feedback();
790		}
791	}
792
793	function copy_feedback() {
794		$$invalidate(15, copied = true);
795		if (timer) clearTimeout(timer);
796
797		timer = setTimeout(
798			() => {
799				$$invalidate(15, copied = false);
800			},
801			1000
802		);
803	}
804
805	function handle_select(event) {
806		const target = event.target;
807		const text = target.value;
808		const index = [target.selectionStart, target.selectionEnd];
809		dispatch("select", { value: text.substring(...index), index });
810	}
811
812	async function handle_keypress(e) {
813		await tick();
814
815		if (e.key === "Enter" && e.shiftKey && lines > 1) {
816			e.preventDefault();
817			dispatch("submit");
818		} else if (e.key === "Enter" && !e.shiftKey && lines === 1 && max_lines >= 1) {
819			e.preventDefault();
820			dispatch("submit");
821		}
822	}
823
824	function handle_scroll(event) {
825		const target = event.target;
826		const current_scroll_top = target.scrollTop;
827
828		if (current_scroll_top < previous_scroll_top) {
829			user_has_scrolled_up = true;
830		}
831
832		previous_scroll_top = current_scroll_top;
833		const max_scroll_top = target.scrollHeight - target.clientHeight;
834		const user_has_scrolled_to_bottom = current_scroll_top >= max_scroll_top;
835
836		if (user_has_scrolled_to_bottom) {
837			user_has_scrolled_up = false;
838		}
839	}
840
841	async function resize(event) {
842		await tick();
843		if (lines === max_lines) return;
844
845		let max = max_lines === undefined
846		? false
847		: max_lines === undefined ? 21 * 11 : 21 * (max_lines + 1); // default
848
849		let min = 21 * (lines + 1);
850		const target = event.target;
851		target.style.height = "1px";
852		let scroll_height;
853
854		if (max && target.scrollHeight > max) {
855			scroll_height = max;
856		} else if (target.scrollHeight < min) {
857			scroll_height = min;
858		} else {
859			scroll_height = target.scrollHeight;
860		}
861
862		target.style.height = `${scroll_height}px`;
863	}
864
865	function text_area_resize(_el, _value) {
866		if (lines === max_lines) return;
867		_el.style.overflowY = "scroll";
868		_el.addEventListener("input", resize);
869		if (!_value.trim()) return;
870		resize({ target: _el });
871
872		return {
873			destroy: () => _el.removeEventListener("input", resize)
874		};
875	}
876
877	function blur_handler(event) {
878		bubble.call(this, $$self, event);
879	}
880
881	function focus_handler(event) {
882		bubble.call(this, $$self, event);
883	}
884
885	function blur_handler_1(event) {
886		bubble.call(this, $$self, event);
887	}
888
889	function focus_handler_1(event) {
890		bubble.call(this, $$self, event);
891	}
892
893	function blur_handler_2(event) {
894		bubble.call(this, $$self, event);
895	}
896
897	function focus_handler_2(event) {
898		bubble.call(this, $$self, event);
899	}
900
901	function blur_handler_3(event) {
902		bubble.call(this, $$self, event);
903	}
904
905	function focus_handler_3(event) {
906		bubble.call(this, $$self, event);
907	}
908
909	function input_input_handler() {
910		value = this.value;
911		$$invalidate(0, value);
912	}
913
914	function input_binding($$value) {
915		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
916			el = $$value;
917			$$invalidate(14, el);
918		});
919	}
920
921	function input_input_handler_1() {
922		value = this.value;
923		$$invalidate(0, value);
924	}
925
926	function input_binding_1($$value) {
927		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
928			el = $$value;
929			$$invalidate(14, el);
930		});
931	}
932
933	function input_input_handler_2() {
934		value = this.value;
935		$$invalidate(0, value);
936	}
937
938	function input_binding_2($$value) {
939		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
940			el = $$value;
941			$$invalidate(14, el);
942		});
943	}
944
945	function textarea_input_handler() {
946		value = this.value;
947		$$invalidate(0, value);
948	}
949
950	function textarea_binding($$value) {
951		binding_callbacks[$$value ? 'unshift' : 'push'](() => {
952			el = $$value;
953			$$invalidate(14, el);
954		});
955	}
956
957	$$self.$$set = $$props => {
958		if ('value' in $$props) $$invalidate(0, value = $$props.value);
959		if ('value_is_output' in $$props) $$invalidate(21, value_is_output = $$props.value_is_output);
960		if ('lines' in $$props) $$invalidate(1, lines = $$props.lines);
961		if ('placeholder' in $$props) $$invalidate(2, placeholder = $$props.placeholder);
962		if ('label' in $$props) $$invalidate(3, label = $$props.label);
963		if ('info' in $$props) $$invalidate(4, info = $$props.info);
964		if ('disabled' in $$props) $$invalidate(5, disabled = $$props.disabled);
965		if ('show_label' in $$props) $$invalidate(6, show_label = $$props.show_label);
966		if ('container' in $$props) $$invalidate(7, container = $$props.container);
967		if ('max_lines' in $$props) $$invalidate(8, max_lines = $$props.max_lines);
968		if ('type' in $$props) $$invalidate(9, type = $$props.type);
969		if ('show_copy_button' in $$props) $$invalidate(10, show_copy_button = $$props.show_copy_button);
970		if ('rtl' in $$props) $$invalidate(11, rtl = $$props.rtl);
971		if ('autofocus' in $$props) $$invalidate(12, autofocus = $$props.autofocus);
972		if ('text_align' in $$props) $$invalidate(13, text_align = $$props.text_align);
973		if ('autoscroll' in $$props) $$invalidate(22, autoscroll = $$props.autoscroll);
974	};
975
976	$$self.$$.update = () => {
977		if ($$self.$$.dirty[0] & /*value*/ 1) {
978			if (value === null) $$invalidate(0, value = "");
979		}
980
981		if ($$self.$$.dirty[0] & /*value, el, lines, max_lines*/ 16643) {
982			(el && lines !== max_lines && resize({ target: el }));
983		}
984
985		if ($$self.$$.dirty[0] & /*value*/ 1) {
986			(handle_change());
987		}
988	};
989
990	return [
991		value,
992		lines,
993		placeholder,
994		label,
995		info,
996		disabled,
997		show_label,
998		container,
999		max_lines,
1000		type,
1001		show_copy_button,
1002		rtl,
1003		autofocus,
1004		text_align,
1005		el,
1006		copied,
1007		handle_copy,
1008		handle_select,
1009		handle_keypress,
1010		handle_scroll,
1011		text_area_resize,
1012		value_is_output,
1013		autoscroll,
1014		blur_handler,
1015		focus_handler,
1016		blur_handler_1,
1017		focus_handler_1,
1018		blur_handler_2,
1019		focus_handler_2,
1020		blur_handler_3,
1021		focus_handler_3,
1022		input_input_handler,
1023		input_binding,
1024		input_input_handler_1,
1025		input_binding_1,
1026		input_input_handler_2,
1027		input_binding_2,
1028		textarea_input_handler,
1029		textarea_binding
1030	];
1031}
1032
1033class Textbox extends SvelteComponent {
1034	constructor(options) {
1035		super();
1036
1037		init(
1038			this,
1039			options,
1040			instance,
1041			create_fragment,
1042			safe_not_equal,
1043			{
1044				value: 0,
1045				value_is_output: 21,
1046				lines: 1,
1047				placeholder: 2,
1048				label: 3,
1049				info: 4,
1050				disabled: 5,
1051				show_label: 6,
1052				container: 7,
1053				max_lines: 8,
1054				type: 9,
1055				show_copy_button: 10,
1056				rtl: 11,
1057				autofocus: 12,
1058				text_align: 13,
1059				autoscroll: 22
1060			},
1061			null,
1062			[-1, -1]
1063		);
1064	}
1065}
1066
1067export { Textbox as T };
1068//# sourceMappingURL=Textbox-4503493e.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.