PageSourceSearch

https://igghera-outfitanyone.hf.space/assets/index-8b3d331e.js

js igghera-outfitanyone.hf.space collected 2026-10-04 10:21:07 UTC 111,285 bytes, 4,241 lines download raw bytes

1import { U as Upload } from './Upload-5eb3d513.js';
2import { M as ModifyUpload } from './ModifyUpload-2d323204.js';
3import { B as Block } from './Button-4603580c.js';
4import { B as BlockLabel } from './BlockLabel-29e86818.js';
5import { S as Static } from './Index-1fd72dbe.js';
6import { T as Trim, P as Pause, a as Play, V as Video$2, S as SelectSource } from './SelectSource-04a84021.js';
7import { W as Webcam } from './ImageUploader-2eb1c2b7.js';
8import { p as prepare_files, u as upload, n as normalise_file } from './index-a4a7fd54.js';
9import './Example.svelte_svelte_type_style_lang-67e00421.js';
10import { l as loadFfmpeg, t as trimVideo, V as Video$1, p as prettyBytes, a as playable } from './Example-59268a5b.js';
11export { E as BaseExample, b as loaded } from './Example-59268a5b.js';
12import { U as Undo } from './Undo-6c110254.js';
13import { I as IconButton } from './IconButton-a83f4ef3.js';
14import { E as Empty } from './Empty-e2e0272e.js';
15import { S as ShareButton } from './ShareButton-0349c9cf.js';
16import { D as Download } from './Download-ea83bae3.js';
17import { u as uploadToHuggingFace } from './utils-8f25e669.js';
18import { U as UploadText } from './UploadText-c5b17877.js';
19/* empty css                                                     */import './Clear-9760deed.js';
20import './Upload-8f4bfd80.js';
21import './Image-6cbf81d1.js';
22import './DropdownArrow-835e9379.js';
23import './svelte/svelte.js';
24import './file-url-7e88bc31.js';
25
26/* home/runner/work/gradio/gradio/js/icons/src/Maximise.svelte generated by Svelte v4.2.2 */
27const {
28	SvelteComponent: SvelteComponent$6,
29	append: append$5,
30	attr: attr$5,
31	detach: detach$6,
32	init: init$6,
33	insert: insert$6,
34	noop: noop$4,
35	safe_not_equal: safe_not_equal$6,
36	svg_element
37} = window.__gradio__svelte__internal;
38function create_fragment$6(ctx) {
39	let svg;
40	let path;
41
42	return {
43		c() {
44			svg = svg_element("svg");
45			path = svg_element("path");
46			attr$5(path, "d", "M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3");
47			attr$5(svg, "xmlns", "http://www.w3.org/2000/svg");
48			attr$5(svg, "width", "100%");
49			attr$5(svg, "height", "100%");
50			attr$5(svg, "viewBox", "0 0 24 24");
51			attr$5(svg, "fill", "none");
52			attr$5(svg, "stroke", "currentColor");
53			attr$5(svg, "stroke-width", "1.5");
54			attr$5(svg, "stroke-linecap", "round");
55			attr$5(svg, "stroke-linejoin", "round");
56		},
57		m(target, anchor) {
58			insert$6(target, svg, anchor);
59			append$5(svg, path);
60		},
61		p: noop$4,
62		i: noop$4,
63		o: noop$4,
64		d(detaching) {
65			if (detaching) {
66				detach$6(svg);
67			}
68		}
69	};
70}
71
72class Maximise extends SvelteComponent$6 {
73	constructor(options) {
74		super();
75		init$6(this, options, null, create_fragment$6, safe_not_equal$6, {});
76	}
77}
78
79const VideoTimeline_svelte_svelte_type_style_lang = '';
80
81/* home/runner/work/gradio/gradio/js/video/shared/VideoTimeline.svelte generated by Svelte v4.2.2 */
82const {
83	SvelteComponent: SvelteComponent$5,
84	append: append$4,
85	attr: attr$4,
86	destroy_block,
87	detach: detach$5,
88	element: element$4,
89	ensure_array_like,
90	init: init$5,
91	insert: insert$5,
92	listen: listen$2,
93	noop: noop$3,
94	run_all: run_all$2,
95	safe_not_equal: safe_not_equal$5,
96	set_style,
97	space: space$5,
98	src_url_equal: src_url_equal$1,
99	update_keyed_each
100} = window.__gradio__svelte__internal;
101const { onMount: onMount$1, onDestroy } = window.__gradio__svelte__internal;
102function get_each_context(ctx, list, i) {
103	const child_ctx = ctx.slice();
104	child_ctx[20] = list[i];
105	child_ctx[22] = i;
106	return child_ctx;
107}
108
109// (128:1) {:else}
110function create_else_block$5(ctx) {
111	let div1;
112	let button0;
113	let t0;
114	let div0;
115	let t1;
116	let each_blocks = [];
117	let each_1_lookup = new Map();
118	let t2;
119	let button1;
120	let mounted;
121	let dispose;
122	let each_value = ensure_array_like(/*thumbnails*/ ctx[1]);
123	const get_key = ctx => /*i*/ ctx[22];
124
125	for (let i = 0; i < each_value.length; i += 1) {
126		let child_ctx = get_each_context(ctx, each_value, i);
127		let key = get_key(child_ctx);
128		each_1_lookup.set(key, each_blocks[i] = create_each_block(key, child_ctx));
129	}
130
131	return {
132		c() {
133			div1 = element$4("div");
134			button0 = element$4("button");
135			t0 = space$5();
136			div0 = element$4("div");
137			t1 = space$5();
138
139			for (let i = 0; i < each_blocks.length; i += 1) {
140				each_blocks[i].c();
141			}
142
143			t2 = space$5();
144			button1 = element$4("button");
145			attr$4(button0, "aria-label", "start drag handle for trimming video");
146			attr$4(button0, "class", "handle left svelte-10c4beq");
147			set_style(button0, "left", /*leftHandlePosition*/ ctx[2] + "%");
148			attr$4(div0, "class", "opaque-layer svelte-10c4beq");
149			set_style(div0, "left", /*leftHandlePosition*/ ctx[2] + "%");
150			set_style(div0, "right", 100 - /*rightHandlePosition*/ ctx[3] + "%");
151			attr$4(button1, "aria-label", "end drag handle for trimming video");
152			attr$4(button1, "class", "handle right svelte-10c4beq");
153			set_style(button1, "left", /*rightHandlePosition*/ ctx[3] + "%");
154			attr$4(div1, "id", "timeline");
155			attr$4(div1, "class", "thumbnail-wrapper svelte-10c4beq");
156		},
157		m(target, anchor) {
158			insert$5(target, div1, anchor);
159			append$4(div1, button0);
160			append$4(div1, t0);
161			append$4(div1, div0);
162			append$4(div1, t1);
163
164			for (let i = 0; i < each_blocks.length; i += 1) {
165				if (each_blocks[i]) {
166					each_blocks[i].m(div1, null);
167				}
168			}
169
170			append$4(div1, t2);
171			append$4(div1, button1);
172
173			if (!mounted) {
174				dispose = [
175					listen$2(button0, "mousedown", /*mousedown_handler*/ ctx[10]),
176					listen$2(button0, "blur", /*stopDragging*/ ctx[5]),
177					listen$2(button0, "keydown", /*keydown_handler*/ ctx[11]),
178					listen$2(button1, "mousedown", /*mousedown_handler_1*/ ctx[12]),
179					listen$2(button1, "blur", /*stopDragging*/ ctx[5]),
180					listen$2(button1, "keydown", /*keydown_handler_1*/ ctx[13])
181				];
182
183				mounted = true;
184			}
185		},
186		p(ctx, dirty) {
187			if (dirty & /*leftHandlePosition*/ 4) {
188				set_style(button0, "left", /*leftHandlePosition*/ ctx[2] + "%");
189			}
190
191			if (dirty & /*leftHandlePosition*/ 4) {
192				set_style(div0, "left", /*leftHandlePosition*/ ctx[2] + "%");
193			}
194
195			if (dirty & /*rightHandlePosition*/ 8) {
196				set_style(div0, "right", 100 - /*rightHandlePosition*/ ctx[3] + "%");
197			}
198
199			if (dirty & /*thumbnails*/ 2) {
200				each_value = ensure_array_like(/*thumbnails*/ ctx[1]);
201				each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, div1, destroy_block, create_each_block, t2, get_each_context);
202			}
203
204			if (dirty & /*rightHandlePosition*/ 8) {
205				set_style(button1, "left", /*rightHandlePosition*/ ctx[3] + "%");
206			}
207		},
208		d(detaching) {
209			if (detaching) {
210				detach$5(div1);
211			}
212
213			for (let i = 0; i < each_blocks.length; i += 1) {
214				each_blocks[i].d();
215			}
216
217			mounted = false;
218			run_all$2(dispose);
219		}
220	};
221}
222
223// (124:1) {#if loadingTimeline}
224function create_if_block$5(ctx) {
225	let div;
226
227	return {
228		c() {
229			div = element$4("div");
230			div.innerHTML = `<span aria-label="loading timeline" class="loader svelte-10c4beq"></span>`;
231			attr$4(div, "class", "load-wrap svelte-10c4beq");
232		},
233		m(target, anchor) {
234			insert$5(target, div, anchor);
235		},
236		p: noop$3,
237		d(detaching) {
238			if (detaching) {
239				detach$5(div);
240			}
241		}
242	};
243}
244
245// (148:3) {#each thumbnails as thumbnail, i (i)}
246function create_each_block(key_1, ctx) {
247	let img;
248	let img_src_value;
249	let img_alt_value;
250
251	return {
252		key: key_1,
253		first: null,
254		c() {
255			img = element$4("img");
256			if (!src_url_equal$1(img.src, img_src_value = /*thumbnail*/ ctx[20])) attr$4(img, "src", img_src_value);
257			attr$4(img, "alt", img_alt_value = `frame-${/*i*/ ctx[22]}`);
258			attr$4(img, "draggable", "false");
259			attr$4(img, "class", "svelte-10c4beq");
260			this.first = img;
261		},
262		m(target, anchor) {
263			insert$5(target, img, anchor);
264		},
265		p(new_ctx, dirty) {
266			ctx = new_ctx;
267
268			if (dirty & /*thumbnails*/ 2 && !src_url_equal$1(img.src, img_src_value = /*thumbnail*/ ctx[20])) {
269				attr$4(img, "src", img_src_value);
270			}
271
272			if (dirty & /*thumbnails*/ 2 && img_alt_value !== (img_alt_value = `frame-${/*i*/ ctx[22]}`)) {
273				attr$4(img, "alt", img_alt_value);
274			}
275		},
276		d(detaching) {
277			if (detaching) {
278				detach$5(img);
279			}
280		}
281	};
282}
283
284function create_fragment$5(ctx) {
285	let div;
286
287	function select_block_type(ctx, dirty) {
288		if (/*loadingTimeline*/ ctx[0]) return create_if_block$5;
289		return create_else_block$5;
290	}
291
292	let current_block_type = select_block_type(ctx);
293	let if_block = current_block_type(ctx);
294
295	return {
296		c() {
297			div = element$4("div");
298			if_block.c();
299			attr$4(div, "class", "container svelte-10c4beq");
300		},
301		m(target, anchor) {
302			insert$5(target, div, anchor);
303			if_block.m(div, null);
304		},
305		p(ctx, [dirty]) {
306			if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block) {
307				if_block.p(ctx, dirty);
308			} else {
309				if_block.d(1);
310				if_block = current_block_type(ctx);
311
312				if (if_block) {
313					if_block.c();
314					if_block.m(div, null);
315				}
316			}
317		},
318		i: noop$3,
319		o: noop$3,
320		d(detaching) {
321			if (detaching) {
322				detach$5(div);
323			}
324
325			if_block.d();
326		}
327	};
328}
329
330let numberOfThumbnails = 10;
331
332function instance$5($$self, $$props, $$invalidate) {
333	let { videoElement } = $$props;
334	let { trimmedDuration } = $$props;
335	let { dragStart } = $$props;
336	let { dragEnd } = $$props;
337	let { loadingTimeline } = $$props;
338	let thumbnails = [];
339	let videoDuration;
340	let leftHandlePosition = 0;
341	let rightHandlePosition = 100;
342	let dragging = null;
343
344	const startDragging = side => {
345		dragging = side;
346	};
347
348	const stopDragging = () => {
349		dragging = null;
350	};
351
352	const drag = (event, distance) => {
353		if (dragging) {
354			const timeline = document.getElementById("timeline");
355			if (!timeline) return;
356			const rect = timeline.getBoundingClientRect();
357			let newPercentage = (event.clientX - rect.left) / rect.width * 100;
358
359			if (distance) {
360				// Move handle based on arrow key press
361				newPercentage = dragging === "left"
362				? leftHandlePosition + distance
363				: rightHandlePosition + distance;
364			} else {
365				// Move handle based on mouse drag
366				newPercentage = (event.clientX - rect.left) / rect.width * 100;
367			}
368
369			newPercentage = Math.max(0, Math.min(newPercentage, 100)); // Keep within 0 and 100
370
371			if (dragging === "left") {
372				$$invalidate(2, leftHandlePosition = Math.min(newPercentage, rightHandlePosition));
373
374				// Calculate the new time and set it for the videoElement
375				const newTimeLeft = leftHandlePosition / 100 * videoDuration;
376
377				$$invalidate(6, videoElement.currentTime = newTimeLeft, videoElement);
378				$$invalidate(8, dragStart = newTimeLeft);
379			} else if (dragging === "right") {
380				$$invalidate(3, rightHandlePosition = Math.max(newPercentage, leftHandlePosition));
381				const newTimeRight = rightHandlePosition / 100 * videoDuration;
382				$$invalidate(6, videoElement.currentTime = newTimeRight, videoElement);
383				$$invalidate(9, dragEnd = newTimeRight);
384			}
385
386			const startTime = leftHandlePosition / 100 * videoDuration;
387			const endTime = rightHandlePosition / 100 * videoDuration;
388			$$invalidate(7, trimmedDuration = endTime - startTime);
389			$$invalidate(2, leftHandlePosition);
390			$$invalidate(3, rightHandlePosition);
391		}
392	};
393
394	const moveHandle = e => {
395		if (dragging) {
396			// Calculate the movement distance as a percentage of the video duration
397			const distance = 1 / videoDuration * 100;
398
399			if (e.key === "ArrowLeft") {
400				drag({ clientX: 0 }, -distance);
401			} else if (e.key === "ArrowRight") {
402				drag({ clientX: 0 }, distance);
403			}
404		}
405	};
406
407	const generateThumbnail = () => {
408		const canvas = document.createElement("canvas");
409		const ctx = canvas.getContext("2d");
410		if (!ctx) return;
411		canvas.width = videoElement.videoWidth;
412		canvas.height = videoElement.videoHeight;
413		ctx.drawImage(videoElement, 0, 0, canvas.width, canvas.height);
414		const thumbnail = canvas.toDataURL("image/jpeg", 0.7);
415		$$invalidate(1, thumbnails = [...thumbnails, thumbnail]);
416	};
417
418	onMount$1(() => {
419		const loadMetadata = () => {
420			videoDuration = videoElement.duration;
421			const interval = videoDuration / numberOfThumbnails;
422			let captures = 0;
423
424			const onSeeked = () => {
425				generateThumbnail();
426				captures++;
427
428				if (captures < numberOfThumbnails) {
429					$$invalidate(6, videoElement.currentTime += interval, videoElement);
430				} else {
431					videoElement.removeEventListener("seeked", onSeeked);
432				}
433			};
434
435			videoElement.addEventListener("seeked", onSeeked);
436			$$invalidate(6, videoElement.currentTime = 0, videoElement);
437		};
438
439		if (videoElement.readyState >= 1) {
440			loadMetadata();
441		} else {
442			videoElement.addEventListener("loadedmetadata", loadMetadata);
443		}
444	});
445
446	onDestroy(() => {
447		window.removeEventListener("mousemove", drag);
448		window.removeEventListener("mouseup", stopDragging);
449		window.removeEventListener("keydown", moveHandle);
450	});
451
452	onMount$1(() => {
453		window.addEventListener("mousemove", drag);
454		window.addEventListener("mouseup", stopDragging);
455		window.addEventListener("keydown", moveHandle);
456	});
457
458	const mousedown_handler = () => startDragging("left");
459
460	const keydown_handler = e => {
461		if (e.key === "ArrowLeft" || e.key == "ArrowRight") {
462			startDragging("left");
463		}
464	};
465
466	const mousedown_handler_1 = () => startDragging("right");
467
468	const keydown_handler_1 = e => {
469		if (e.key === "ArrowLeft" || e.key == "ArrowRight") {
470			startDragging("right");
471		}
472	};
473
474	$$self.$$set = $$props => {
475		if ('videoElement' in $$props) $$invalidate(6, videoElement = $$props.videoElement);
476		if ('trimmedDuration' in $$props) $$invalidate(7, trimmedDuration = $$props.trimmedDuration);
477		if ('dragStart' in $$props) $$invalidate(8, dragStart = $$props.dragStart);
478		if ('dragEnd' in $$props) $$invalidate(9, dragEnd = $$props.dragEnd);
479		if ('loadingTimeline' in $$props) $$invalidate(0, loadingTimeline = $$props.loadingTimeline);
480	};
481
482	$$self.$$.update = () => {
483		if ($$self.$$.dirty & /*thumbnails*/ 2) {
484			$$invalidate(0, loadingTimeline = thumbnails.length !== numberOfThumbnails);
485		}
486	};
487
488	return [
489		loadingTimeline,
490		thumbnails,
491		leftHandlePosition,
492		rightHandlePosition,
493		startDragging,
494		stopDragging,
495		videoElement,
496		trimmedDuration,
497		dragStart,
498		dragEnd,
499		mousedown_handler,
500		keydown_handler,
501		mousedown_handler_1,
502		keydown_handler_1
503	];
504}
505
506class VideoTimeline extends SvelteComponent$5 {
507	constructor(options) {
508		super();
509
510		init$5(this, options, instance$5, create_fragment$5, safe_not_equal$5, {
511			videoElement: 6,
512			trimmedDuration: 7,
513			dragStart: 8,
514			dragEnd: 9,
515			loadingTimeline: 0
516		});
517	}
518}
519
520const VideoControls_svelte_svelte_type_style_lang = '';
521
522/* home/runner/work/gradio/gradio/js/video/shared/VideoControls.svelte generated by Svelte v4.2.2 */
523const {
524	SvelteComponent: SvelteComponent$4,
525	add_flush_callback: add_flush_callback$2,
526	append: append$3,
527	attr: attr$3,
528	bind: bind$2,
529	binding_callbacks: binding_callbacks$2,
530	check_outros: check_outros$4,
531	create_component: create_component$4,
532	destroy_component: destroy_component$4,
533	detach: detach$4,
534	element: element$3,
535	empty: empty$4,
536	group_outros: group_outros$4,
537	init: init$4,
538	insert: insert$4,
539	listen: listen$1,
540	mount_component: mount_component$4,
541	noop: noop$2,
542	run_all: run_all$1,
543	safe_not_equal: safe_not_equal$4,
544	set_data: set_data$2,
545	space: space$4,
546	text: text$2,
547	toggle_class: toggle_class$1,
548	transition_in: transition_in$4,
549	transition_out: transition_out$4
550} = window.__gradio__svelte__internal;const { onMount } = window.__gradio__svelte__internal;
551function create_if_block_4$1(ctx) {
552	let div;
553	let videotimeline;
554	let updating_dragStart;
555	let updating_dragEnd;
556	let updating_trimmedDuration;
557	let updating_loadingTimeline;
558	let current;
559
560	function videotimeline_dragStart_binding(value) {
561		/*videotimeline_dragStart_binding*/ ctx[14](value);
562	}
563
564	function videotimeline_dragEnd_binding(value) {
565		/*videotimeline_dragEnd_binding*/ ctx[15](value);
566	}
567
568	function videotimeline_trimmedDuration_binding(value) {
569		/*videotimeline_trimmedDuration_binding*/ ctx[16](value);
570	}
571
572	function videotimeline_loadingTimeline_binding(value) {
573		/*videotimeline_loadingTimeline_binding*/ ctx[17](value);
574	}
575
576	let videotimeline_props = { videoElement: /*videoElement*/ ctx[2] };
577
578	if (/*dragStart*/ ctx[9] !== void 0) {
579		videotimeline_props.dragStart = /*dragStart*/ ctx[9];
580	}
581
582	if (/*dragEnd*/ ctx[10] !== void 0) {
583		videotimeline_props.dragEnd = /*dragEnd*/ ctx[10];
584	}
585
586	if (/*trimmedDuration*/ ctx[7] !== void 0) {
587		videotimeline_props.trimmedDuration = /*trimmedDuration*/ ctx[7];
588	}
589
590	if (/*loadingTimeline*/ ctx[11] !== void 0) {
591		videotimeline_props.loadingTimeline = /*loadingTimeline*/ ctx[11];
592	}
593
594	videotimeline = new VideoTimeline({ props: videotimeline_props });
595	binding_callbacks$2.push(() => bind$2(videotimeline, 'dragStart', videotimeline_dragStart_binding));
596	binding_callbacks$2.push(() => bind$2(videotimeline, 'dragEnd', videotimeline_dragEnd_binding));
597	binding_callbacks$2.push(() => bind$2(videotimeline, 'trimmedDuration', videotimeline_trimmedDuration_binding));
598	binding_callbacks$2.push(() => bind$2(videotimeline, 'loadingTimeline', videotimeline_loadingTimeline_binding));
599
600	return {
601		c() {
602			div = element$3("div");
603			create_component$4(videotimeline.$$.fragment);
604			attr$3(div, "class", "timeline-wrapper svelte-sxyn79");
605		},
606		m(target, anchor) {
607			insert$4(target, div, anchor);
608			mount_component$4(videotimeline, div, null);
609			current = true;
610		},
611		p(ctx, dirty) {
612			const videotimeline_changes = {};
613			if (dirty & /*videoElement*/ 4) videotimeline_changes.videoElement = /*videoElement*/ ctx[2];
614
615			if (!updating_dragStart && dirty & /*dragStart*/ 512) {
616				updating_dragStart = true;
617				videotimeline_changes.dragStart = /*dragStart*/ ctx[9];
618				add_flush_callback$2(() => updating_dragStart = false);
619			}
620
621			if (!updating_dragEnd && dirty & /*dragEnd*/ 1024) {
622				updating_dragEnd = true;
623				videotimeline_changes.dragEnd = /*dragEnd*/ ctx[10];
624				add_flush_callback$2(() => updating_dragEnd = false);
625			}
626
627			if (!updating_trimmedDuration && dirty & /*trimmedDuration*/ 128) {
628				updating_trimmedDuration = true;
629				videotimeline_changes.trimmedDuration = /*trimmedDuration*/ ctx[7];
630				add_flush_callback$2(() => updating_trimmedDuration = false);
631			}
632
633			if (!updating_loadingTimeline && dirty & /*loadingTimeline*/ 2048) {
634				updating_loadingTimeline = true;
635				videotimeline_changes.loadingTimeline = /*loadingTimeline*/ ctx[11];
636				add_flush_callback$2(() => updating_loadingTimeline = false);
637			}
638
639			videotimeline.$set(videotimeline_changes);
640		},
641		i(local) {
642			if (current) return;
643			transition_in$4(videotimeline.$$.fragment, local);
644			current = true;
645		},
646		o(local) {
647			transition_out$4(videotimeline.$$.fragment, local);
648			current = false;
649		},
650		d(detaching) {
651			if (detaching) {
652				detach$4(div);
653			}
654
655			destroy_component$4(videotimeline);
656		}
657	};
658}
659
660// (63:2) {:else}
661function create_else_block_1(ctx) {
662	let div;
663
664	return {
665		c() {
666			div = element$3("div");
667			attr$3(div, "class", "svelte-sxyn79");
668		},
669		m(target, anchor) {
670			insert$4(target, div, anchor);
671		},
672		p: noop$2,
673		d(detaching) {
674			if (detaching) {
675				detach$4(div);
676			}
677		}
678	};
679}
680
681// (58:2) {#if mode === "edit" && trimmedDuration !== null}
682function create_if_block_3$1(ctx) {
683	let time;
684	let t_value = /*formatTime*/ ctx[12](/*trimmedDuration*/ ctx[7]) + "";
685	let t;
686
687	return {
688		c() {
689			time = element$3("time");
690			t = text$2(t_value);
691			attr$3(time, "aria-label", "duration of selected region in seconds");
692			attr$3(time, "class", "svelte-sxyn79");
693			toggle_class$1(time, "hidden", /*loadingTimeline*/ ctx[11]);
694		},
695		m(target, anchor) {
696			insert$4(target, time, anchor);
697			append$3(time, t);
698		},
699		p(ctx, dirty) {
700			if (dirty & /*trimmedDuration*/ 128 && t_value !== (t_value = /*formatTime*/ ctx[12](/*trimmedDuration*/ ctx[7]) + "")) set_data$2(t, t_value);
701
702			if (dirty & /*loadingTimeline*/ 2048) {
703				toggle_class$1(time, "hidden", /*loadingTimeline*/ ctx[11]);
704			}
705		},
706		d(detaching) {
707			if (detaching) {
708				detach$4(time);
709			}
710		}
711	};
712}
713
714// (68:3) {#if showRedo && mode === ""}
715function create_if_block_2$3(ctx) {
716	let button;
717	let undo;
718	let current;
719	let mounted;
720	let dispose;
721	undo = new Undo({});
722
723	return {
724		c() {
725			button = element$3("button");
726			create_component$4(undo.$$.fragment);
727			attr$3(button, "class", "action icon svelte-sxyn79");
728			button.disabled = /*processingVideo*/ ctx[1];
729			attr$3(button, "aria-label", "Reset video to initial value");
730		},
731		m(target, anchor) {
732			insert$4(target, button, anchor);
733			mount_component$4(undo, button, null);
734			current = true;
735
736			if (!mounted) {
737				dispose = listen$1(button, "click", /*click_handler*/ ctx[18]);
738				mounted = true;
739			}
740		},
741		p(ctx, dirty) {
742			if (!current || dirty & /*processingVideo*/ 2) {
743				button.disabled = /*processingVideo*/ ctx[1];
744			}
745		},
746		i(local) {
747			if (current) return;
748			transition_in$4(undo.$$.fragment, local);
749			current = true;
750		},
751		o(local) {
752			transition_out$4(undo.$$.fragment, local);
753			current = false;
754		},
755		d(detaching) {
756			if (detaching) {
757				detach$4(button);
758			}
759
760			destroy_component$4(undo);
761			mounted = false;
762			dispose();
763		}
764	};
765}
766
767// (82:3) {#if interactive}
768function create_if_block$4(ctx) {
769	let current_block_type_index;
770	let if_block;
771	let if_block_anchor;
772	let current;
773	const if_block_creators = [create_if_block_1$3, create_else_block$4];
774	const if_blocks = [];
775
776	function select_block_type_1(ctx, dirty) {
777		if (/*mode*/ ctx[0] === "") return 0;
778		return 1;
779	}
780
781	current_block_type_index = select_block_type_1(ctx);
782	if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
783
784	return {
785		c() {
786			if_block.c();
787			if_block_anchor = empty$4();
788		},
789		m(target, anchor) {
790			if_blocks[current_block_type_index].m(target, anchor);
791			insert$4(target, if_block_anchor, anchor);
792			current = true;
793		},
794		p(ctx, dirty) {
795			let previous_block_index = current_block_type_index;
796			current_block_type_index = select_block_type_1(ctx);
797
798			if (current_block_type_index === previous_block_index) {
799				if_blocks[current_block_type_index].p(ctx, dirty);
800			} else {
801				group_outros$4();
802
803				transition_out$4(if_blocks[previous_block_index], 1, 1, () => {
804					if_blocks[previous_block_index] = null;
805				});
806
807				check_outros$4();
808				if_block = if_blocks[current_block_type_index];
809
810				if (!if_block) {
811					if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
812					if_block.c();
813				} else {
814					if_block.p(ctx, dirty);
815				}
816
817				transition_in$4(if_block, 1);
818				if_block.m(if_block_anchor.parentNode, if_block_anchor);
819			}
820		},
821		i(local) {
822			if (current) return;
823			transition_in$4(if_block);
824			current = true;
825		},
826		o(local) {
827			transition_out$4(if_block);
828			current = false;
829		},
830		d(detaching) {
831			if (detaching) {
832				detach$4(if_block_anchor);
833			}
834
835			if_blocks[current_block_type_index].d(detaching);
836		}
837	};
838}
839
840// (92:4) {:else}
841function create_else_block$4(ctx) {
842	let button0;
843	let t1;
844	let button1;
845	let mounted;
846	let dispose;
847
848	return {
849		c() {
850			button0 = element$3("button");
851			button0.textContent = "Trim";
852			t1 = space$4();
853			button1 = element$3("button");
854			button1.textContent = "Cancel";
855			attr$3(button0, "class", "text-button svelte-sxyn79");
856			toggle_class$1(button0, "hidden", /*loadingTimeline*/ ctx[11]);
857			attr$3(button1, "class", "text-button svelte-sxyn79");
858			toggle_class$1(button1, "hidden", /*loadingTimeline*/ ctx[11]);
859		},
860		m(target, anchor) {
861			insert$4(target, button0, anchor);
862			insert$4(target, t1, anchor);
863			insert$4(target, button1, anchor);
864
865			if (!mounted) {
866				dispose = [
867					listen$1(button0, "click", /*click_handler_1*/ ctx[19]),
868					listen$1(button1, "click", /*toggleTrimmingMode*/ ctx[13])
869				];
870
871				mounted = true;
872			}
873		},
874		p(ctx, dirty) {
875			if (dirty & /*loadingTimeline*/ 2048) {
876				toggle_class$1(button0, "hidden", /*loadingTimeline*/ ctx[11]);
877			}
878
879			if (dirty & /*loadingTimeline*/ 2048) {
880				toggle_class$1(button1, "hidden", /*loadingTimeline*/ ctx[11]);
881			}
882		},
883		i: noop$2,
884		o: noop$2,
885		d(detaching) {
886			if (detaching) {
887				detach$4(button0);
888				detach$4(t1);
889				detach$4(button1);
890			}
891
892			mounted = false;
893			run_all$1(dispose);
894		}
895	};
896}
897
898// (83:4) {#if mode === ""}
899function create_if_block_1$3(ctx) {
900	let button;
901	let trim;
902	let current;
903	let mounted;
904	let dispose;
905	trim = new Trim({});
906
907	return {
908		c() {
909			button = element$3("button");
910			create_component$4(trim.$$.fragment);
911			button.disabled = /*processingVideo*/ ctx[1];
912			attr$3(button, "class", "action icon svelte-sxyn79");
913			attr$3(button, "aria-label", "Trim video to selection");
914		},
915		m(target, anchor) {
916			insert$4(target, button, anchor);
917			mount_component$4(trim, button, null);
918			current = true;
919
920			if (!mounted) {
921				dispose = listen$1(button, "click", /*toggleTrimmingMode*/ ctx[13]);
922				mounted = true;
923			}
924		},
925		p(ctx, dirty) {
926			if (!current || dirty & /*processingVideo*/ 2) {
927				button.disabled = /*processingVideo*/ ctx[1];
928			}
929		},
930		i(local) {
931			if (current) return;
932			transition_in$4(trim.$$.fragment, local);
933			current = true;
934		},
935		o(local) {
936			transition_out$4(trim.$$.fragment, local);
937			current = false;
938		},
939		d(detaching) {
940			if (detaching) {
941				detach$4(button);
942			}
943
944			destroy_component$4(trim);
945			mounted = false;
946			dispose();
947		}
948	};
949}
950
951function create_fragment$4(ctx) {
952	let div2;
953	let t0;
954	let div1;
955	let t1;
956	let div0;
957	let t2;
958	let current;
959	let if_block0 = /*mode*/ ctx[0] === "edit" && create_if_block_4$1(ctx);
960
961	function select_block_type(ctx, dirty) {
962		if (/*mode*/ ctx[0] === "edit" && /*trimmedDuration*/ ctx[7] !== null) return create_if_block_3$1;
963		return create_else_block_1;
964	}
965
966	let current_block_type = select_block_type(ctx);
967	let if_block1 = current_block_type(ctx);
968	let if_block2 = /*showRedo*/ ctx[3] && /*mode*/ ctx[0] === "" && create_if_block_2$3(ctx);
969	let if_block3 = /*interactive*/ ctx[4] && create_if_block$4(ctx);
970
971	return {
972		c() {
973			div2 = element$3("div");
974			if (if_block0) if_block0.c();
975			t0 = space$4();
976			div1 = element$3("div");
977			if_block1.c();
978			t1 = space$4();
979			div0 = element$3("div");
980			if (if_block2) if_block2.c();
981			t2 = space$4();
982			if (if_block3) if_block3.c();
983			attr$3(div0, "class", "settings-wrapper svelte-sxyn79");
984			attr$3(div1, "class", "controls svelte-sxyn79");
985			attr$3(div1, "data-testid", "waveform-controls");
986			attr$3(div2, "class", "container svelte-sxyn79");
987		},
988		m(target, anchor) {
989			insert$4(target, div2, anchor);
990			if (if_block0) if_block0.m(div2, null);
991			append$3(div2, t0);
992			append$3(div2, div1);
993			if_block1.m(div1, null);
994			append$3(div1, t1);
995			append$3(div1, div0);
996			if (if_block2) if_block2.m(div0, null);
997			append$3(div0, t2);
998			if (if_block3) if_block3.m(div0, null);
999			current = true;
1000		},
1001		p(ctx, [dirty]) {
1002			if (/*mode*/ ctx[0] === "edit") {
1003				if (if_block0) {
1004					if_block0.p(ctx, dirty);
1005
1006					if (dirty & /*mode*/ 1) {
1007						transition_in$4(if_block0, 1);
1008					}
1009				} else {
1010					if_block0 = create_if_block_4$1(ctx);
1011					if_block0.c();
1012					transition_in$4(if_block0, 1);
1013					if_block0.m(div2, t0);
1014				}
1015			} else if (if_block0) {
1016				group_outros$4();
1017
1018				transition_out$4(if_block0, 1, 1, () => {
1019					if_block0 = null;
1020				});
1021
1022				check_outros$4();
1023			}
1024
1025			if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block1) {
1026				if_block1.p(ctx, dirty);
1027			} else {
1028				if_block1.d(1);
1029				if_block1 = current_block_type(ctx);
1030
1031				if (if_block1) {
1032					if_block1.c();
1033					if_block1.m(div1, t1);
1034				}
1035			}
1036
1037			if (/*showRedo*/ ctx[3] && /*mode*/ ctx[0] === "") {
1038				if (if_block2) {
1039					if_block2.p(ctx, dirty);
1040
1041					if (dirty & /*showRedo, mode*/ 9) {
1042						transition_in$4(if_block2, 1);
1043					}
1044				} else {
1045					if_block2 = create_if_block_2$3(ctx);
1046					if_block2.c();
1047					transition_in$4(if_block2, 1);
1048					if_block2.m(div0, t2);
1049				}
1050			} else if (if_block2) {
1051				group_outros$4();
1052
1053				transition_out$4(if_block2, 1, 1, () => {
1054					if_block2 = null;
1055				});
1056
1057				check_outros$4();
1058			}
1059
1060			if (/*interactive*/ ctx[4]) {
1061				if (if_block3) {
1062					if_block3.p(ctx, dirty);
1063
1064					if (dirty & /*interactive*/ 16) {
1065						transition_in$4(if_block3, 1);
1066					}
1067				} else {
1068					if_block3 = create_if_block$4(ctx);
1069					if_block3.c();
1070					transition_in$4(if_block3, 1);
1071					if_block3.m(div0, null);
1072				}
1073			} else if (if_block3) {
1074				group_outros$4();
1075
1076				transition_out$4(if_block3, 1, 1, () => {
1077					if_block3 = null;
1078				});
1079
1080				check_outros$4();
1081			}
1082		},
1083		i(local) {
1084			if (current) return;
1085			transition_in$4(if_block0);
1086			transition_in$4(if_block2);
1087			transition_in$4(if_block3);
1088			current = true;
1089		},
1090		o(local) {
1091			transition_out$4(if_block0);
1092			transition_out$4(if_block2);
1093			transition_out$4(if_block3);
1094			current = false;
1095		},
1096		d(detaching) {
1097			if (detaching) {
1098				detach$4(div2);
1099			}
1100
1101			if (if_block0) if_block0.d();
1102			if_block1.d();
1103			if (if_block2) if_block2.d();
1104			if (if_block3) if_block3.d();
1105		}
1106	};
1107}
1108
1109function instance$4($$self, $$props, $$invalidate) {
1110	let { videoElement } = $$props;
1111	let { showRedo = false } = $$props;
1112	let { interactive = true } = $$props;
1113	let { mode = "" } = $$props;
1114	let { handle_reset_value } = $$props;
1115	let { handle_trim_video } = $$props;
1116	let { processingVideo = false } = $$props;
1117	let ffmpeg;
1118
1119	onMount(async () => {
1120		$$invalidate(8, ffmpeg = await loadFfmpeg());
1121	});
1122
1123	const formatTime = seconds => {
1124		const minutes = Math.floor(seconds / 60);
1125		const secondsRemainder = Math.round(seconds) % 60;
1126		const paddedSeconds = `0${secondsRemainder}`.slice(-2);
1127
1128		if (Number.isNaN(minutes) || Number.isNaN(secondsRemainder)) {
1129			return "00:00";
1130		}
1131
1132		return `${minutes}:${paddedSeconds}`;
1133	};
1134
1135	let trimmedDuration = null;
1136	let dragStart = 0;
1137	let dragEnd = 0;
1138	let loadingTimeline = false;
1139
1140	const toggleTrimmingMode = () => {
1141		if (mode === "edit") {
1142			$$invalidate(0, mode = "");
1143			$$invalidate(7, trimmedDuration = videoElement.duration);
1144		} else {
1145			$$invalidate(0, mode = "edit");
1146		}
1147	};
1148
1149	function videotimeline_dragStart_binding(value) {
1150		dragStart = value;
1151		$$invalidate(9, dragStart);
1152	}
1153
1154	function videotimeline_dragEnd_binding(value) {
1155		dragEnd = value;
1156		$$invalidate(10, dragEnd);
1157	}
1158
1159	function videotimeline_trimmedDuration_binding(value) {
1160		trimmedDuration = value;
1161		(($$invalidate(7, trimmedDuration), $$invalidate(0, mode)), $$invalidate(2, videoElement));
1162	}
1163
1164	function videotimeline_loadingTimeline_binding(value) {
1165		loadingTimeline = value;
1166		$$invalidate(11, loadingTimeline);
1167	}
1168
1169	const click_handler = () => {
1170		handle_reset_value();
1171		$$invalidate(0, mode = "");
1172	};
1173
1174	const click_handler_1 = () => {
1175		$$invalidate(0, mode = "");
1176		$$invalidate(1, processingVideo = true);
1177
1178		trimVideo(ffmpeg, dragStart, dragEnd, videoElement).then(videoBlob => {
1179			handle_trim_video(videoBlob);
1180		}).then(() => {
1181			$$invalidate(1, processingVideo = false);
1182		});
1183	};
1184
1185	$$self.$$set = $$props => {
1186		if ('videoElement' in $$props) $$invalidate(2, videoElement = $$props.videoElement);
1187		if ('showRedo' in $$props) $$invalidate(3, showRedo = $$props.showRedo);
1188		if ('interactive' in $$props) $$invalidate(4, interactive = $$props.interactive);
1189		if ('mode' in $$props) $$invalidate(0, mode = $$props.mode);
1190		if ('handle_reset_value' in $$props) $$invalidate(5, handle_reset_value = $$props.handle_reset_value);
1191		if ('handle_trim_video' in $$props) $$invalidate(6, handle_trim_video = $$props.handle_trim_video);
1192		if ('processingVideo' in $$props) $$invalidate(1, processingVideo = $$props.processingVideo);
1193	};
1194
1195	$$self.$$.update = () => {
1196		if ($$self.$$.dirty & /*mode, trimmedDuration, videoElement*/ 133) {
1197			if (mode === "edit" && trimmedDuration === null && videoElement) $$invalidate(7, trimmedDuration = videoElement.duration);
1198		}
1199	};
1200
1201	return [
1202		mode,
1203		processingVideo,
1204		videoElement,
1205		showRedo,
1206		interactive,
1207		handle_reset_value,
1208		handle_trim_video,
1209		trimmedDuration,
1210		ffmpeg,
1211		dragStart,
1212		dragEnd,
1213		loadingTimeline,
1214		formatTime,
1215		toggleTrimmingMode,
1216		videotimeline_dragStart_binding,
1217		videotimeline_dragEnd_binding,
1218		videotimeline_trimmedDuration_binding,
1219		videotimeline_loadingTimeline_binding,
1220		click_handler,
1221		click_handler_1
1222	];
1223}
1224
1225class VideoControls extends SvelteComponent$4 {
1226	constructor(options) {
1227		super();
1228
1229		init$4(this, options, instance$4, create_fragment$4, safe_not_equal$4, {
1230			videoElement: 2,
1231			showRedo: 3,
1232			interactive: 4,
1233			mode: 0,
1234			handle_reset_value: 5,
1235			handle_trim_video: 6,
1236			processingVideo: 1
1237		});
1238	}
1239}
1240
1241const Player_svelte_svelte_type_style_lang = '';
1242
1243/* home/runner/work/gradio/gradio/js/video/shared/Player.svelte generated by Svelte v4.2.2 */
1244const {
1245	SvelteComponent: SvelteComponent$3,
1246	add_flush_callback: add_flush_callback$1,
1247	append: append$2,
1248	attr: attr$2,
1249	bind: bind$1,
1250	binding_callbacks: binding_callbacks$1,
1251	bubble: bubble$2,
1252	check_outros: check_outros$3,
1253	create_component: create_component$3,
1254	destroy_component: destroy_component$3,
1255	detach: detach$3,
1256	element: element$2,
1257	empty: empty$3,
1258	group_outros: group_outros$3,
1259	init: init$3,
1260	insert: insert$3,
1261	listen,
1262	mount_component: mount_component$3,
1263	prevent_default,
1264	run_all,
1265	safe_not_equal: safe_not_equal$3,
1266	set_data: set_data$1,
1267	space: space$3,
1268	src_url_equal,
1269	stop_propagation,
1270	text: text$1,
1271	toggle_class,
1272	transition_in: transition_in$3,
1273	transition_out: transition_out$3
1274} = window.__gradio__svelte__internal;
1275const { createEventDispatcher: createEventDispatcher$2 } = window.__gradio__svelte__internal;
1276function create_default_slot$3(ctx) {
1277	let track;
1278	let track_src_value;
1279
1280	return {
1281		c() {
1282			track = element$2("track");
1283			attr$2(track, "kind", "captions");
1284			if (!src_url_equal(track.src, track_src_value = /*subtitle*/ ctx[1])) attr$2(track, "src", track_src_value);
1285			track.default = true;
1286		},
1287		m(target, anchor) {
1288			insert$3(target, track, anchor);
1289		},
1290		p(ctx, dirty) {
1291			if (dirty & /*subtitle*/ 2 && !src_url_equal(track.src, track_src_value = /*subtitle*/ ctx[1])) {
1292				attr$2(track, "src", track_src_value);
1293			}
1294		},
1295		d(detaching) {
1296			if (detaching) {
1297				detach$3(track);
1298			}
1299		}
1300	};
1301}
1302
1303// (112:4) {:else}
1304function create_else_block$3(ctx) {
1305	let pause;
1306	let current;
1307	pause = new Pause({});
1308
1309	return {
1310		c() {
1311			create_component$3(pause.$$.fragment);
1312		},
1313		m(target, anchor) {
1314			mount_component$3(pause, target, anchor);
1315			current = true;
1316		},
1317		i(local) {
1318			if (current) return;
1319			transition_in$3(pause.$$.fragment, local);
1320			current = true;
1321		},
1322		o(local) {
1323			transition_out$3(pause.$$.fragment, local);
1324			current = false;
1325		},
1326		d(detaching) {
1327			destroy_component$3(pause, detaching);
1328		}
1329	};
1330}
1331
1332// (110:21) 
1333function create_if_block_2$2(ctx) {
1334	let play;
1335	let current;
1336	play = new Play({});
1337
1338	return {
1339		c() {
1340			create_component$3(play.$$.fragment);
1341		},
1342		m(target, anchor) {
1343			mount_component$3(play, target, anchor);
1344			current = true;
1345		},
1346		i(local) {
1347			if (current) return;
1348			transition_in$3(play.$$.fragment, local);
1349			current = true;
1350		},
1351		o(local) {
1352			transition_out$3(play.$$.fragment, local);
1353			current = false;
1354		},
1355		d(detaching) {
1356			destroy_component$3(play, detaching);
1357		}
1358	};
1359}
1360
1361// (108:4) {#if time === duration}
1362function create_if_block_1$2(ctx) {
1363	let undo;
1364	let current;
1365	undo = new Undo({});
1366
1367	return {
1368		c() {
1369			create_component$3(undo.$$.fragment);
1370		},
1371		m(target, anchor) {
1372			mount_component$3(undo, target, anchor);
1373			current = true;
1374		},
1375		i(local) {
1376			if (current) return;
1377			transition_in$3(undo.$$.fragment, local);
1378			current = true;
1379		},
1380		o(local) {
1381			transition_out$3(undo.$$.fragment, local);
1382			current = false;
1383		},
1384		d(detaching) {
1385			destroy_component$3(undo, detaching);
1386		}
1387	};
1388}
1389
1390// (142:0) {#if interactive}
1391function create_if_block$3(ctx) {
1392	let videocontrols;
1393	let updating_processingVideo;
1394	let current;
1395
1396	function videocontrols_processingVideo_binding(value) {
1397		/*videocontrols_processingVideo_binding*/ ctx[26](value);
1398	}
1399
1400	let videocontrols_props = {
1401		videoElement: /*video*/ ctx[10],
1402		showRedo: true,
1403		handle_trim_video: /*handle_trim_video*/ ctx[16],
1404		handle_reset_value: /*handle_reset_value*/ ctx[6]
1405	};
1406
1407	if (/*processingVideo*/ ctx[11] !== void 0) {
1408		videocontrols_props.processingVideo = /*processingVideo*/ ctx[11];
1409	}
1410
1411	videocontrols = new VideoControls({ props: videocontrols_props });
1412	binding_callbacks$1.push(() => bind$1(videocontrols, 'processingVideo', videocontrols_processingVideo_binding));
1413
1414	return {
1415		c() {
1416			create_component$3(videocontrols.$$.fragment);
1417		},
1418		m(target, anchor) {
1419			mount_component$3(videocontrols, target, anchor);
1420			current = true;
1421		},
1422		p(ctx, dirty) {
1423			const videocontrols_changes = {};
1424			if (dirty & /*video*/ 1024) videocontrols_changes.videoElement = /*video*/ ctx[10];
1425			if (dirty & /*handle_reset_value*/ 64) videocontrols_changes.handle_reset_value = /*handle_reset_value*/ ctx[6];
1426
1427			if (!updating_processingVideo && dirty & /*processingVideo*/ 2048) {
1428				updating_processingVideo = true;
1429				videocontrols_changes.processingVideo = /*processingVideo*/ ctx[11];
1430				add_flush_callback$1(() => updating_processingVideo = false);
1431			}
1432
1433			videocontrols.$set(videocontrols_changes);
1434		},
1435		i(local) {
1436			if (current) return;
1437			transition_in$3(videocontrols.$$.fragment, local);
1438			current = true;
1439		},
1440		o(local) {
1441			transition_out$3(videocontrols.$$.fragment, local);
1442			current = false;
1443		},
1444		d(detaching) {
1445			destroy_component$3(videocontrols, detaching);
1446		}
1447	};
1448}
1449
1450function create_fragment$3(ctx) {
1451	let div4;
1452	let div0;
1453	let video_1;
1454	let updating_currentTime;
1455	let updating_duration;
1456	let updating_paused;
1457	let updating_node;
1458	let t0;
1459	let div3;
1460	let div2;
1461	let span0;
1462	let current_block_type_index;
1463	let if_block0;
1464	let t1;
1465	let span1;
1466	let t2_value = format(/*time*/ ctx[7]) + "";
1467	let t2;
1468	let t3;
1469	let t4_value = format(/*duration*/ ctx[8]) + "";
1470	let t4;
1471	let t5;
1472	let progress;
1473	let progress_value_value;
1474	let t6;
1475	let div1;
1476	let maximise;
1477	let t7;
1478	let if_block1_anchor;
1479	let current;
1480	let mounted;
1481	let dispose;
1482
1483	function video_1_currentTime_binding(value) {
1484		/*video_1_currentTime_binding*/ ctx[20](value);
1485	}
1486
1487	function video_1_duration_binding(value) {
1488		/*video_1_duration_binding*/ ctx[21](value);
1489	}
1490
1491	function video_1_paused_binding(value) {
1492		/*video_1_paused_binding*/ ctx[22](value);
1493	}
1494
1495	function video_1_node_binding(value) {
1496		/*video_1_node_binding*/ ctx[23](value);
1497	}
1498
1499	let video_1_props = {
1500		src: /*src*/ ctx[0],
1501		preload: "auto",
1502		autoplay: /*autoplay*/ ctx[3],
1503		"data-testid": `${/*label*/ ctx[4]}-player`,
1504		processingVideo: /*processingVideo*/ ctx[11],
1505		$$slots: { default: [create_default_slot$3] },
1506		$$scope: { ctx }
1507	};
1508
1509	if (/*time*/ ctx[7] !== void 0) {
1510		video_1_props.currentTime = /*time*/ ctx[7];
1511	}
1512
1513	if (/*duration*/ ctx[8] !== void 0) {
1514		video_1_props.duration = /*duration*/ ctx[8];
1515	}
1516
1517	if (/*paused*/ ctx[9] !== void 0) {
1518		video_1_props.paused = /*paused*/ ctx[9];
1519	}
1520
1521	if (/*video*/ ctx[10] !== void 0) {
1522		video_1_props.node = /*video*/ ctx[10];
1523	}
1524
1525	video_1 = new Video$1({ props: video_1_props });
1526	binding_callbacks$1.push(() => bind$1(video_1, 'currentTime', video_1_currentTime_binding));
1527	binding_callbacks$1.push(() => bind$1(video_1, 'duration', video_1_duration_binding));
1528	binding_callbacks$1.push(() => bind$1(video_1, 'paused', video_1_paused_binding));
1529	binding_callbacks$1.push(() => bind$1(video_1, 'node', video_1_node_binding));
1530	video_1.$on("click", /*play_pause*/ ctx[13]);
1531	video_1.$on("play", /*play_handler*/ ctx[24]);
1532	video_1.$on("pause", /*pause_handler*/ ctx[25]);
1533	video_1.$on("ended", /*handle_end*/ ctx[15]);
1534	const if_block_creators = [create_if_block_1$2, create_if_block_2$2, create_else_block$3];
1535	const if_blocks = [];
1536
1537	function select_block_type(ctx, dirty) {
1538		if (/*time*/ ctx[7] === /*duration*/ ctx[8]) return 0;
1539		if (/*paused*/ ctx[9]) return 1;
1540		return 2;
1541	}
1542
1543	current_block_type_index = select_block_type(ctx);
1544	if_block0 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
1545	maximise = new Maximise({});
1546	let if_block1 = /*interactive*/ ctx[5] && create_if_block$3(ctx);
1547
1548	return {
1549		c() {
1550			div4 = element$2("div");
1551			div0 = element$2("div");
1552			create_component$3(video_1.$$.fragment);
1553			t0 = space$3();
1554			div3 = element$2("div");
1555			div2 = element$2("div");
1556			span0 = element$2("span");
1557			if_block0.c();
1558			t1 = space$3();
1559			span1 = element$2("span");
1560			t2 = text$1(t2_value);
1561			t3 = text$1(" / ");
1562			t4 = text$1(t4_value);
1563			t5 = space$3();
1564			progress = element$2("progress");
1565			t6 = space$3();
1566			div1 = element$2("div");
1567			create_component$3(maximise.$$.fragment);
1568			t7 = space$3();
1569			if (if_block1) if_block1.c();
1570			if_block1_anchor = empty$3();
1571			attr$2(div0, "class", "svelte-1i3qraf");
1572			toggle_class(div0, "mirror", /*mirror*/ ctx[2]);
1573			attr$2(span0, "role", "button");
1574			attr$2(span0, "tabindex", "0");
1575			attr$2(span0, "class", "icon svelte-1i3qraf");
1576			attr$2(span0, "aria-label", "play-pause-replay-button");
1577			attr$2(span1, "class", "time svelte-1i3qraf");
1578			progress.value = progress_value_value = /*time*/ ctx[7] / /*duration*/ ctx[8] || 0;
1579			attr$2(progress, "class", "svelte-1i3qraf");
1580			attr$2(div1, "role", "button");
1581			attr$2(div1, "tabindex", "0");
1582			attr$2(div1, "class", "icon svelte-1i3qraf");
1583			attr$2(div1, "aria-label", "full-screen");
1584			attr$2(div2, "class", "inner svelte-1i3qraf");
1585			attr$2(div3, "class", "controls svelte-1i3qraf");
1586			attr$2(div4, "class", "wrap svelte-1i3qraf");
1587		},
1588		m(target, anchor) {
1589			insert$3(target, div4, anchor);
1590			append$2(div4, div0);
1591			mount_component$3(video_1, div0, null);
1592			append$2(div4, t0);
1593			append$2(div4, div3);
1594			append$2(div3, div2);
1595			append$2(div2, span0);
1596			if_blocks[current_block_type_index].m(span0, null);
1597			append$2(div2, t1);
1598			append$2(div2, span1);
1599			append$2(span1, t2);
1600			append$2(span1, t3);
1601			append$2(span1, t4);
1602			append$2(div2, t5);
1603			append$2(div2, progress);
1604			append$2(div2, t6);
1605			append$2(div2, div1);
1606			mount_component$3(maximise, div1, null);
1607			insert$3(target, t7, anchor);
1608			if (if_block1) if_block1.m(target, anchor);
1609			insert$3(target, if_block1_anchor, anchor);
1610			current = true;
1611
1612			if (!mounted) {
1613				dispose = [
1614					listen(span0, "click", /*play_pause*/ ctx[13]),
1615					listen(span0, "keydown", /*play_pause*/ ctx[13]),
1616					listen(progress, "mousemove", /*handleMove*/ ctx[12]),
1617					listen(progress, "touchmove", prevent_default(/*handleMove*/ ctx[12])),
1618					listen(progress, "click", stop_propagation(prevent_default(/*handle_click*/ ctx[14]))),
1619					listen(div1, "click", /*open_full_screen*/ ctx[17]),
1620					listen(div1, "keypress", /*open_full_screen*/ ctx[17])
1621				];
1622
1623				mounted = true;
1624			}
1625		},
1626		p(ctx, [dirty]) {
1627			const video_1_changes = {};
1628			if (dirty & /*src*/ 1) video_1_changes.src = /*src*/ ctx[0];
1629			if (dirty & /*autoplay*/ 8) video_1_changes.autoplay = /*autoplay*/ ctx[3];
1630			if (dirty & /*label*/ 16) video_1_changes["data-testid"] = `${/*label*/ ctx[4]}-player`;
1631			if (dirty & /*processingVideo*/ 2048) video_1_changes.processingVideo = /*processingVideo*/ ctx[11];
1632
1633			if (dirty & /*$$scope, subtitle*/ 268435458) {
1634				video_1_changes.$$scope = { dirty, ctx };
1635			}
1636
1637			if (!updating_currentTime && dirty & /*time*/ 128) {
1638				updating_currentTime = true;
1639				video_1_changes.currentTime = /*time*/ ctx[7];
1640				add_flush_callback$1(() => updating_currentTime = false);
1641			}
1642
1643			if (!updating_duration && dirty & /*duration*/ 256) {
1644				updating_duration = true;
1645				video_1_changes.duration = /*duration*/ ctx[8];
1646				add_flush_callback$1(() => updating_duration = false);
1647			}
1648
1649			if (!updating_paused && dirty & /*paused*/ 512) {
1650				updating_paused = true;
1651				video_1_changes.paused = /*paused*/ ctx[9];
1652				add_flush_callback$1(() => updating_paused = false);
1653			}
1654
1655			if (!updating_node && dirty & /*video*/ 1024) {
1656				updating_node = true;
1657				video_1_changes.node = /*video*/ ctx[10];
1658				add_flush_callback$1(() => updating_node = false);
1659			}
1660
1661			video_1.$set(video_1_changes);
1662
1663			if (!current || dirty & /*mirror*/ 4) {
1664				toggle_class(div0, "mirror", /*mirror*/ ctx[2]);
1665			}
1666
1667			let previous_block_index = current_block_type_index;
1668			current_block_type_index = select_block_type(ctx);
1669
1670			if (current_block_type_index !== previous_block_index) {
1671				group_outros$3();
1672
1673				transition_out$3(if_blocks[previous_block_index], 1, 1, () => {
1674					if_blocks[previous_block_index] = null;
1675				});
1676
1677				check_outros$3();
1678				if_block0 = if_blocks[current_block_type_index];
1679
1680				if (!if_block0) {
1681					if_block0 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
1682					if_block0.c();
1683				}
1684
1685				transition_in$3(if_block0, 1);
1686				if_block0.m(span0, null);
1687			}
1688
1689			if ((!current || dirty & /*time*/ 128) && t2_value !== (t2_value = format(/*time*/ ctx[7]) + "")) set_data$1(t2, t2_value);
1690			if ((!current || dirty & /*duration*/ 256) && t4_value !== (t4_value = format(/*duration*/ ctx[8]) + "")) set_data$1(t4, t4_value);
1691
1692			if (!current || dirty & /*time, duration*/ 384 && progress_value_value !== (progress_value_value = /*time*/ ctx[7] / /*duration*/ ctx[8] || 0)) {
1693				progress.value = progress_value_value;
1694			}
1695
1696			if (/*interactive*/ ctx[5]) {
1697				if (if_block1) {
1698					if_block1.p(ctx, dirty);
1699
1700					if (dirty & /*interactive*/ 32) {
1701						transition_in$3(if_block1, 1);
1702					}
1703				} else {
1704					if_block1 = create_if_block$3(ctx);
1705					if_block1.c();
1706					transition_in$3(if_block1, 1);
1707					if_block1.m(if_block1_anchor.parentNode, if_block1_anchor);
1708				}
1709			} else if (if_block1) {
1710				group_outros$3();
1711
1712				transition_out$3(if_block1, 1, 1, () => {
1713					if_block1 = null;
1714				});
1715
1716				check_outros$3();
1717			}
1718		},
1719		i(local) {
1720			if (current) return;
1721			transition_in$3(video_1.$$.fragment, local);
1722			transition_in$3(if_block0);
1723			transition_in$3(maximise.$$.fragment, local);
1724			transition_in$3(if_block1);
1725			current = true;
1726		},
1727		o(local) {
1728			transition_out$3(video_1.$$.fragment, local);
1729			transition_out$3(if_block0);
1730			transition_out$3(maximise.$$.fragment, local);
1731			transition_out$3(if_block1);
1732			current = false;
1733		},
1734		d(detaching) {
1735			if (detaching) {
1736				detach$3(div4);
1737				detach$3(t7);
1738				detach$3(if_block1_anchor);
1739			}
1740
1741			destroy_component$3(video_1);
1742			if_blocks[current_block_type_index].d();
1743			destroy_component$3(maximise);
1744			if (if_block1) if_block1.d(detaching);
1745			mounted = false;
1746			run_all(dispose);
1747		}
1748	};
1749}
1750
1751function format(seconds) {
1752	if (isNaN(seconds) || !isFinite(seconds)) return "...";
1753	const minutes = Math.floor(seconds / 60);
1754	let _seconds = Math.floor(seconds % 60);
1755	if (_seconds < 10) _seconds = `0${_seconds}`;
1756	return `${minutes}:${_seconds}`;
1757}
1758
1759function instance$3($$self, $$props, $$invalidate) {
1760	let { root = "" } = $$props;
1761	let { src } = $$props;
1762	let { subtitle = null } = $$props;
1763	let { mirror } = $$props;
1764	let { autoplay } = $$props;
1765	let { label = "test" } = $$props;
1766	let { interactive = false } = $$props;
1767
1768	let { handle_change = () => {
1769		
1770	} } = $$props;
1771
1772	let { handle_reset_value = () => {
1773		
1774	} } = $$props;
1775
1776	const dispatch = createEventDispatcher$2();
1777	let time = 0;
1778	let duration;
1779	let paused = true;
1780	let video;
1781	let processingVideo = false;
1782
1783	function handleMove(e) {
1784		if (!duration) return;
1785
1786		if (e.type === "click") {
1787			handle_click(e);
1788			return;
1789		}
1790
1791		if (e.type !== "touchmove" && !(e.buttons & 1)) return;
1792
1793		const clientX = e.type === "touchmove"
1794		? e.touches[0].clientX
1795		: e.clientX;
1796
1797		const { left, right } = e.currentTarget.getBoundingClientRect();
1798		$$invalidate(7, time = duration * (clientX - left) / (right - left));
1799	}
1800
1801	async function play_pause() {
1802		if (document.fullscreenElement != video) {
1803			const isPlaying = video.currentTime > 0 && !video.paused && !video.ended && video.readyState > video.HAVE_CURRENT_DATA;
1804
1805			if (!isPlaying) {
1806				await video.play();
1807			} else video.pause();
1808		}
1809	}
1810
1811	function handle_click(e) {
1812		const { left, right } = e.currentTarget.getBoundingClientRect();
1813		$$invalidate(7, time = duration * (e.clientX - left) / (right - left));
1814	}
1815
1816	function handle_end() {
1817		dispatch("stop");
1818		dispatch("end");
1819	}
1820
1821	const handle_trim_video = async videoBlob => {
1822		let _video_blob = new File([videoBlob], "video.mp4");
1823		const val = await prepare_files([_video_blob]);
1824		let value = (await upload(val, root))?.filter(Boolean)[0];
1825		handle_change(value);
1826	};
1827
1828	function open_full_screen() {
1829		video.requestFullscreen();
1830	}
1831
1832	function video_1_currentTime_binding(value) {
1833		time = value;
1834		$$invalidate(7, time);
1835	}
1836
1837	function video_1_duration_binding(value) {
1838		duration = value;
1839		$$invalidate(8, duration);
1840	}
1841
1842	function video_1_paused_binding(value) {
1843		paused = value;
1844		$$invalidate(9, paused);
1845	}
1846
1847	function video_1_node_binding(value) {
1848		video = value;
1849		$$invalidate(10, video);
1850	}
1851
1852	function play_handler(event) {
1853		bubble$2.call(this, $$self, event);
1854	}
1855
1856	function pause_handler(event) {
1857		bubble$2.call(this, $$self, event);
1858	}
1859
1860	function videocontrols_processingVideo_binding(value) {
1861		processingVideo = value;
1862		$$invalidate(11, processingVideo);
1863	}
1864
1865	$$self.$$set = $$props => {
1866		if ('root' in $$props) $$invalidate(18, root = $$props.root);
1867		if ('src' in $$props) $$invalidate(0, src = $$props.src);
1868		if ('subtitle' in $$props) $$invalidate(1, subtitle = $$props.subtitle);
1869		if ('mirror' in $$props) $$invalidate(2, mirror = $$props.mirror);
1870		if ('autoplay' in $$props) $$invalidate(3, autoplay = $$props.autoplay);
1871		if ('label' in $$props) $$invalidate(4, label = $$props.label);
1872		if ('interactive' in $$props) $$invalidate(5, interactive = $$props.interactive);
1873		if ('handle_change' in $$props) $$invalidate(19, handle_change = $$props.handle_change);
1874		if ('handle_reset_value' in $$props) $$invalidate(6, handle_reset_value = $$props.handle_reset_value);
1875	};
1876
1877	return [
1878		src,
1879		subtitle,
1880		mirror,
1881		autoplay,
1882		label,
1883		interactive,
1884		handle_reset_value,
1885		time,
1886		duration,
1887		paused,
1888		video,
1889		processingVideo,
1890		handleMove,
1891		play_pause,
1892		handle_click,
1893		handle_end,
1894		handle_trim_video,
1895		open_full_screen,
1896		root,
1897		handle_change,
1898		video_1_currentTime_binding,
1899		video_1_duration_binding,
1900		video_1_paused_binding,
1901		video_1_node_binding,
1902		play_handler,
1903		pause_handler,
1904		videocontrols_processingVideo_binding
1905	];
1906}
1907
1908class Player extends SvelteComponent$3 {
1909	constructor(options) {
1910		super();
1911
1912		init$3(this, options, instance$3, create_fragment$3, safe_not_equal$3, {
1913			root: 18,
1914			src: 0,
1915			subtitle: 1,
1916			mirror: 2,
1917			autoplay: 3,
1918			label: 4,
1919			interactive: 5,
1920			handle_change: 19,
1921			handle_reset_value: 6
1922		});
1923	}
1924}
1925
1926const Player$1 = Player;
1927
1928const InteractiveVideo_svelte_svelte_type_style_lang = '';
1929
1930/* home/runner/work/gradio/gradio/js/video/shared/InteractiveVideo.svelte generated by Svelte v4.2.2 */
1931const {
1932	SvelteComponent: SvelteComponent$2,
1933	add_flush_callback,
1934	append: append$1,
1935	attr: attr$1,
1936	bind,
1937	binding_callbacks,
1938	bubble: bubble$1,
1939	check_outros: check_outros$2,
1940	create_component: create_component$2,
1941	create_slot,
1942	destroy_component: destroy_component$2,
1943	detach: detach$2,
1944	element: element$1,
1945	empty: empty$2,
1946	get_all_dirty_from_scope,
1947	get_slot_changes,
1948	group_outros: group_outros$2,
1949	init: init$2,
1950	insert: insert$2,
1951	mount_component: mount_component$2,
1952	noop: noop$1,
1953	safe_not_equal: safe_not_equal$2,
1954	set_data,
1955	space: space$2,
1956	text,
1957	transition_in: transition_in$2,
1958	transition_out: transition_out$2,
1959	update_slot_base
1960} = window.__gradio__svelte__internal;
1961const { createEventDispatcher: createEventDispatcher$1 } = window.__gradio__svelte__internal;
1962function create_else_block$2(ctx) {
1963	let modifyupload;
1964	let t;
1965	let show_if;
1966	let current_block_type_index;
1967	let if_block;
1968	let if_block_anchor;
1969	let current;
1970	modifyupload = new ModifyUpload({ props: { i18n: /*i18n*/ ctx[10] } });
1971	modifyupload.$on("clear", /*handle_clear*/ ctx[15]);
1972	const if_block_creators = [create_if_block_3, create_if_block_4];
1973	const if_blocks = [];
1974
1975	function select_block_type_2(ctx, dirty) {
1976		if (show_if == null) show_if = !!playable();
1977		if (show_if) return 0;
1978		if (/*value*/ ctx[0].size) return 1;
1979		return -1;
1980	}
1981
1982	if (~(current_block_type_index = select_block_type_2(ctx))) {
1983		if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
1984	}
1985
1986	return {
1987		c() {
1988			create_component$2(modifyupload.$$.fragment);
1989			t = space$2();
1990			if (if_block) if_block.c();
1991			if_block_anchor = empty$2();
1992		},
1993		m(target, anchor) {
1994			mount_component$2(modifyupload, target, anchor);
1995			insert$2(target, t, anchor);
1996
1997			if (~current_block_type_index) {
1998				if_blocks[current_block_type_index].m(target, anchor);
1999			}
2000
2001			insert$2(target, if_block_anchor, anchor);
2002			current = true;
2003		},
2004		p(ctx, dirty) {
2005			const modifyupload_changes = {};
2006			if (dirty & /*i18n*/ 1024) modifyupload_changes.i18n = /*i18n*/ ctx[10];
2007			modifyupload.$set(modifyupload_changes);
2008			let previous_block_index = current_block_type_index;
2009			current_block_type_index = select_block_type_2(ctx);
2010
2011			if (current_block_type_index === previous_block_index) {
2012				if (~current_block_type_index) {
2013					if_blocks[current_block_type_index].p(ctx, dirty);
2014				}
2015			} else {
2016				if (if_block) {
2017					group_outros$2();
2018
2019					transition_out$2(if_blocks[previous_block_index], 1, 1, () => {
2020						if_blocks[previous_block_index] = null;
2021					});
2022
2023					check_outros$2();
2024				}
2025
2026				if (~current_block_type_index) {
2027					if_block = if_blocks[current_block_type_index];
2028
2029					if (!if_block) {
2030						if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
2031						if_block.c();
2032					} else {
2033						if_block.p(ctx, dirty);
2034					}
2035
2036					transition_in$2(if_block, 1);
2037					if_block.m(if_block_anchor.parentNode, if_block_anchor);
2038				} else {
2039					if_block = null;
2040				}
2041			}
2042		},
2043		i(local) {
2044			if (current) return;
2045			transition_in$2(modifyupload.$$.fragment, local);
2046			transition_in$2(if_block);
2047			current = true;
2048		},
2049		o(local) {
2050			transition_out$2(modifyupload.$$.fragment, local);
2051			transition_out$2(if_block);
2052			current = false;
2053		},
2054		d(detaching) {
2055			if (detaching) {
2056				detach$2(t);
2057				detach$2(if_block_anchor);
2058			}
2059
2060			destroy_component$2(modifyupload, detaching);
2061
2062			if (~current_block_type_index) {
2063				if_blocks[current_block_type_index].d(detaching);
2064			}
2065		}
2066	};
2067}
2068
2069// (40:0) {#if value === null || value.url === undefined}
2070function create_if_block$2(ctx) {
2071	let current_block_type_index;
2072	let if_block;
2073	let if_block_anchor;
2074	let current;
2075	const if_block_creators = [create_if_block_1$1, create_if_block_2$1];
2076	const if_blocks = [];
2077
2078	function select_block_type_1(ctx, dirty) {
2079		if (/*active_source*/ ctx[1] === "upload") return 0;
2080		if (/*active_source*/ ctx[1] === "webcam") return 1;
2081		return -1;
2082	}
2083
2084	if (~(current_block_type_index = select_block_type_1(ctx))) {
2085		if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
2086	}
2087
2088	return {
2089		c() {
2090			if (if_block) if_block.c();
2091			if_block_anchor = empty$2();
2092		},
2093		m(target, anchor) {
2094			if (~current_block_type_index) {
2095				if_blocks[current_block_type_index].m(target, anchor);
2096			}
2097
2098			insert$2(target, if_block_anchor, anchor);
2099			current = true;
2100		},
2101		p(ctx, dirty) {
2102			let previous_block_index = current_block_type_index;
2103			current_block_type_index = select_block_type_1(ctx);
2104
2105			if (current_block_type_index === previous_block_index) {
2106				if (~current_block_type_index) {
2107					if_blocks[current_block_type_index].p(ctx, dirty);
2108				}
2109			} else {
2110				if (if_block) {
2111					group_outros$2();
2112
2113					transition_out$2(if_blocks[previous_block_index], 1, 1, () => {
2114						if_blocks[previous_block_index] = null;
2115					});
2116
2117					check_outros$2();
2118				}
2119
2120				if (~current_block_type_index) {
2121					if_block = if_blocks[current_block_type_index];
2122
2123					if (!if_block) {
2124						if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
2125						if_block.c();
2126					} else {
2127						if_block.p(ctx, dirty);
2128					}
2129
2130					transition_in$2(if_block, 1);
2131					if_block.m(if_block_anchor.parentNode, if_block_anchor);
2132				} else {
2133					if_block = null;
2134				}
2135			}
2136		},
2137		i(local) {
2138			if (current) return;
2139			transition_in$2(if_block);
2140			current = true;
2141		},
2142		o(local) {
2143			transition_out$2(if_block);
2144			current = false;
2145		},
2146		d(detaching) {
2147			if (detaching) {
2148				detach$2(if_block_anchor);
2149			}
2150
2151			if (~current_block_type_index) {
2152				if_blocks[current_block_type_index].d(detaching);
2153			}
2154		}
2155	};
2156}
2157
2158// (84:22) 
2159function create_if_block_4(ctx) {
2160	let div0;
2161	let t0_value = (/*value*/ ctx[0].orig_name || /*value*/ ctx[0].url) + "";
2162	let t0;
2163	let t1;
2164	let div1;
2165	let t2_value = prettyBytes(/*value*/ ctx[0].size) + "";
2166	let t2;
2167
2168	return {
2169		c() {
2170			div0 = element$1("div");
2171			t0 = text(t0_value);
2172			t1 = space$2();
2173			div1 = element$1("div");
2174			t2 = text(t2_value);
2175			attr$1(div0, "class", "file-name svelte-a6ruol");
2176			attr$1(div1, "class", "file-size svelte-a6ruol");
2177		},
2178		m(target, anchor) {
2179			insert$2(target, div0, anchor);
2180			append$1(div0, t0);
2181			insert$2(target, t1, anchor);
2182			insert$2(target, div1, anchor);
2183			append$1(div1, t2);
2184		},
2185		p(ctx, dirty) {
2186			if (dirty & /*value*/ 1 && t0_value !== (t0_value = (/*value*/ ctx[0].orig_name || /*value*/ ctx[0].url) + "")) set_data(t0, t0_value);
2187			if (dirty & /*value*/ 1 && t2_value !== (t2_value = prettyBytes(/*value*/ ctx[0].size) + "")) set_data(t2, t2_value);
2188		},
2189		i: noop$1,
2190		o: noop$1,
2191		d(detaching) {
2192			if (detaching) {
2193				detach$2(div0);
2194				detach$2(t1);
2195				detach$2(div1);
2196			}
2197		}
2198	};
2199}
2200
2201// (66:1) {#if playable()}
2202function create_if_block_3(ctx) {
2203	let previous_key = /*value*/ ctx[0]?.url;
2204	let key_block_anchor;
2205	let current;
2206	let key_block = create_key_block$1(ctx);
2207
2208	return {
2209		c() {
2210			key_block.c();
2211			key_block_anchor = empty$2();
2212		},
2213		m(target, anchor) {
2214			key_block.m(target, anchor);
2215			insert$2(target, key_block_anchor, anchor);
2216			current = true;
2217		},
2218		p(ctx, dirty) {
2219			if (dirty & /*value*/ 1 && safe_not_equal$2(previous_key, previous_key = /*value*/ ctx[0]?.url)) {
2220				group_outros$2();
2221				transition_out$2(key_block, 1, 1, noop$1);
2222				check_outros$2();
2223				key_block = create_key_block$1(ctx);
2224				key_block.c();
2225				transition_in$2(key_block, 1);
2226				key_block.m(key_block_anchor.parentNode, key_block_anchor);
2227			} else {
2228				key_block.p(ctx, dirty);
2229			}
2230		},
2231		i(local) {
2232			if (current) return;
2233			transition_in$2(key_block);
2234			current = true;
2235		},
2236		o(local) {
2237			transition_out$2(key_block);
2238			current = false;
2239		},
2240		d(detaching) {
2241			if (detaching) {
2242				detach$2(key_block_anchor);
2243			}
2244
2245			key_block.d(detaching);
2246		}
2247	};
2248}
2249
2250// (67:2) {#key value?.url}
2251function create_key_block$1(ctx) {
2252	let player;
2253	let current;
2254
2255	player = new Player$1({
2256			props: {
2257				root: /*root*/ ctx[9],
2258				interactive: true,
2259				autoplay: /*autoplay*/ ctx[8],
2260				src: /*value*/ ctx[0].url,
2261				subtitle: /*subtitle*/ ctx[2]?.url,
2262				mirror: /*mirror_webcam*/ ctx[6] && /*active_source*/ ctx[1] === "webcam",
2263				label: /*label*/ ctx[4],
2264				handle_change: /*handle_change*/ ctx[16],
2265				handle_reset_value: /*handle_reset_value*/ ctx[11]
2266			}
2267		});
2268
2269	player.$on("play", /*play_handler*/ ctx[24]);
2270	player.$on("pause", /*pause_handler*/ ctx[25]);
2271	player.$on("stop", /*stop_handler*/ ctx[26]);
2272	player.$on("end", /*end_handler*/ ctx[27]);
2273
2274	return {
2275		c() {
2276			create_component$2(player.$$.fragment);
2277		},
2278		m(target, anchor) {
2279			mount_component$2(player, target, anchor);
2280			current = true;
2281		},
2282		p(ctx, dirty) {
2283			const player_changes = {};
2284			if (dirty & /*root*/ 512) player_changes.root = /*root*/ ctx[9];
2285			if (dirty & /*autoplay*/ 256) player_changes.autoplay = /*autoplay*/ ctx[8];
2286			if (dirty & /*value*/ 1) player_changes.src = /*value*/ ctx[0].url;
2287			if (dirty & /*subtitle*/ 4) player_changes.subtitle = /*subtitle*/ ctx[2]?.url;
2288			if (dirty & /*mirror_webcam, active_source*/ 66) player_changes.mirror = /*mirror_webcam*/ ctx[6] && /*active_source*/ ctx[1] === "webcam";
2289			if (dirty & /*label*/ 16) player_changes.label = /*label*/ ctx[4];
2290			if (dirty & /*handle_reset_value*/ 2048) player_changes.handle_reset_value = /*handle_reset_value*/ ctx[11];
2291			player.$set(player_changes);
2292		},
2293		i(local) {
2294			if (current) return;
2295			transition_in$2(player.$$.fragment, local);
2296			current = true;
2297		},
2298		o(local) {
2299			transition_out$2(player.$$.fragment, local);
2300			current = false;
2301		},
2302		d(detaching) {
2303			destroy_component$2(player, detaching);
2304		}
2305	};
2306}
2307
2308// (52:38) 
2309function create_if_block_2$1(ctx) {
2310	let webcam;
2311	let current;
2312
2313	webcam = new Webcam({
2314			props: {
2315				mirror_webcam: /*mirror_webcam*/ ctx[6],
2316				include_audio: /*include_audio*/ ctx[7],
2317				mode: "video",
2318				i18n: /*i18n*/ ctx[10]
2319			}
2320		});
2321
2322	webcam.$on("error", /*error_handler*/ ctx[20]);
2323	webcam.$on("capture", /*capture_handler*/ ctx[21]);
2324	webcam.$on("start_recording", /*start_recording_handler*/ ctx[22]);
2325	webcam.$on("stop_recording", /*stop_recording_handler*/ ctx[23]);
2326
2327	return {
2328		c() {
2329			create_component$2(webcam.$$.fragment);
2330		},
2331		m(target, anchor) {
2332			mount_component$2(webcam, target, anchor);
2333			current = true;
2334		},
2335		p(ctx, dirty) {
2336			const webcam_changes = {};
2337			if (dirty & /*mirror_webcam*/ 64) webcam_changes.mirror_webcam = /*mirror_webcam*/ ctx[6];
2338			if (dirty & /*include_audio*/ 128) webcam_changes.include_audio = /*include_audio*/ ctx[7];
2339			if (dirty & /*i18n*/ 1024) webcam_changes.i18n = /*i18n*/ ctx[10];
2340			webcam.$set(webcam_changes);
2341		},
2342		i(local) {
2343			if (current) return;
2344			transition_in$2(webcam.$$.fragment, local);
2345			current = true;
2346		},
2347		o(local) {
2348			transition_out$2(webcam.$$.fragment, local);
2349			current = false;
2350		},
2351		d(detaching) {
2352			destroy_component$2(webcam, detaching);
2353		}
2354	};
2355}
2356
2357// (41:1) {#if active_source === "upload"}
2358function create_if_block_1$1(ctx) {
2359	let upload;
2360	let updating_dragging;
2361	let current;
2362
2363	function upload_dragging_binding(value) {
2364		/*upload_dragging_binding*/ ctx[18](value);
2365	}
2366
2367	let upload_props = {
2368		filetype: "video/x-m4v,video/*",
2369		root: /*root*/ ctx[9],
2370		include_sources: /*sources*/ ctx[3].length > 1,
2371		$$slots: { default: [create_default_slot$2] },
2372		$$scope: { ctx }
2373	};
2374
2375	if (/*dragging*/ ctx[12] !== void 0) {
2376		upload_props.dragging = /*dragging*/ ctx[12];
2377	}
2378
2379	upload = new Upload({ props: upload_props });
2380	binding_callbacks.push(() => bind(upload, 'dragging', upload_dragging_binding));
2381	upload.$on("load", /*handle_load*/ ctx[14]);
2382	upload.$on("error", /*error_handler_1*/ ctx[19]);
2383
2384	return {
2385		c() {
2386			create_component$2(upload.$$.fragment);
2387		},
2388		m(target, anchor) {
2389			mount_component$2(upload, target, anchor);
2390			current = true;
2391		},
2392		p(ctx, dirty) {
2393			const upload_changes = {};
2394			if (dirty & /*root*/ 512) upload_changes.root = /*root*/ ctx[9];
2395			if (dirty & /*sources*/ 8) upload_changes.include_sources = /*sources*/ ctx[3].length > 1;
2396
2397			if (dirty & /*$$scope*/ 536870912) {
2398				upload_changes.$$scope = { dirty, ctx };
2399			}
2400
2401			if (!updating_dragging && dirty & /*dragging*/ 4096) {
2402				updating_dragging = true;
2403				upload_changes.dragging = /*dragging*/ ctx[12];
2404				add_flush_callback(() => updating_dragging = false);
2405			}
2406
2407			upload.$set(upload_changes);
2408		},
2409		i(local) {
2410			if (current) return;
2411			transition_in$2(upload.$$.fragment, local);
2412			current = true;
2413		},
2414		o(local) {
2415			transition_out$2(upload.$$.fragment, local);
2416			current = false;
2417		},
2418		d(detaching) {
2419			destroy_component$2(upload, detaching);
2420		}
2421	};
2422}
2423
2424// (42:2) <Upload    bind:dragging    filetype="video/x-m4v,video/*"    on:load={handle_load}    on:error={({ detail }) => dispatch("error", detail)}    {root}    include_sources={sources.length > 1}   >
2425function create_default_slot$2(ctx) {
2426	let current;
2427	const default_slot_template = /*#slots*/ ctx[17].default;
2428	const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[29], null);
2429
2430	return {
2431		c() {
2432			if (default_slot) default_slot.c();
2433		},
2434		m(target, anchor) {
2435			if (default_slot) {
2436				default_slot.m(target, anchor);
2437			}
2438
2439			current = true;
2440		},
2441		p(ctx, dirty) {
2442			if (default_slot) {
2443				if (default_slot.p && (!current || dirty & /*$$scope*/ 536870912)) {
2444					update_slot_base(
2445						default_slot,
2446						default_slot_template,
2447						ctx,
2448						/*$$scope*/ ctx[29],
2449						!current
2450						? get_all_dirty_from_scope(/*$$scope*/ ctx[29])
2451						: get_slot_changes(default_slot_template, /*$$scope*/ ctx[29], dirty, null),
2452						null
2453					);
2454				}
2455			}
2456		},
2457		i(local) {
2458			if (current) return;
2459			transition_in$2(default_slot, local);
2460			current = true;
2461		},
2462		o(local) {
2463			transition_out$2(default_slot, local);
2464			current = false;
2465		},
2466		d(detaching) {
2467			if (default_slot) default_slot.d(detaching);
2468		}
2469	};
2470}
2471
2472function create_fragment$2(ctx) {
2473	let blocklabel;
2474	let t0;
2475	let current_block_type_index;
2476	let if_block;
2477	let t1;
2478	let selectsource;
2479	let updating_active_source;
2480	let current;
2481
2482	blocklabel = new BlockLabel({
2483			props: {
2484				show_label: /*show_label*/ ctx[5],
2485				Icon: Video$2,
2486				label: /*label*/ ctx[4] || "Video"
2487			}
2488		});
2489
2490	const if_block_creators = [create_if_block$2, create_else_block$2];
2491	const if_blocks = [];
2492
2493	function select_block_type(ctx, dirty) {
2494		if (/*value*/ ctx[0] === null || /*value*/ ctx[0].url === undefined) return 0;
2495		return 1;
2496	}
2497
2498	current_block_type_index = select_block_type(ctx);
2499	if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
2500
2501	function selectsource_active_source_binding(value) {
2502		/*selectsource_active_source_binding*/ ctx[28](value);
2503	}
2504
2505	let selectsource_props = {
2506		sources: /*sources*/ ctx[3],
2507		handle_clear: /*handle_clear*/ ctx[15]
2508	};
2509
2510	if (/*active_source*/ ctx[1] !== void 0) {
2511		selectsource_props.active_source = /*active_source*/ ctx[1];
2512	}
2513
2514	selectsource = new SelectSource({ props: selectsource_props });
2515	binding_callbacks.push(() => bind(selectsource, 'active_source', selectsource_active_source_binding));
2516
2517	return {
2518		c() {
2519			create_component$2(blocklabel.$$.fragment);
2520			t0 = space$2();
2521			if_block.c();
2522			t1 = space$2();
2523			create_component$2(selectsource.$$.fragment);
2524		},
2525		m(target, anchor) {
2526			mount_component$2(blocklabel, target, anchor);
2527			insert$2(target, t0, anchor);
2528			if_blocks[current_block_type_index].m(target, anchor);
2529			insert$2(target, t1, anchor);
2530			mount_component$2(selectsource, target, anchor);
2531			current = true;
2532		},
2533		p(ctx, [dirty]) {
2534			const blocklabel_changes = {};
2535			if (dirty & /*show_label*/ 32) blocklabel_changes.show_label = /*show_label*/ ctx[5];
2536			if (dirty & /*label*/ 16) blocklabel_changes.label = /*label*/ ctx[4] || "Video";
2537			blocklabel.$set(blocklabel_changes);
2538			let previous_block_index = current_block_type_index;
2539			current_block_type_index = select_block_type(ctx);
2540
2541			if (current_block_type_index === previous_block_index) {
2542				if_blocks[current_block_type_index].p(ctx, dirty);
2543			} else {
2544				group_outros$2();
2545
2546				transition_out$2(if_blocks[previous_block_index], 1, 1, () => {
2547					if_blocks[previous_block_index] = null;
2548				});
2549
2550				check_outros$2();
2551				if_block = if_blocks[current_block_type_index];
2552
2553				if (!if_block) {
2554					if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
2555					if_block.c();
2556				} else {
2557					if_block.p(ctx, dirty);
2558				}
2559
2560				transition_in$2(if_block, 1);
2561				if_block.m(t1.parentNode, t1);
2562			}
2563
2564			const selectsource_changes = {};
2565			if (dirty & /*sources*/ 8) selectsource_changes.sources = /*sources*/ ctx[3];
2566
2567			if (!updating_active_source && dirty & /*active_source*/ 2) {
2568				updating_active_source = true;
2569				selectsource_changes.active_source = /*active_source*/ ctx[1];
2570				add_flush_callback(() => updating_active_source = false);
2571			}
2572
2573			selectsource.$set(selectsource_changes);
2574		},
2575		i(local) {
2576			if (current) return;
2577			transition_in$2(blocklabel.$$.fragment, local);
2578			transition_in$2(if_block);
2579			transition_in$2(selectsource.$$.fragment, local);
2580			current = true;
2581		},
2582		o(local) {
2583			transition_out$2(blocklabel.$$.fragment, local);
2584			transition_out$2(if_block);
2585			transition_out$2(selectsource.$$.fragment, local);
2586			current = false;
2587		},
2588		d(detaching) {
2589			if (detaching) {
2590				detach$2(t0);
2591				detach$2(t1);
2592			}
2593
2594			destroy_component$2(blocklabel, detaching);
2595			if_blocks[current_block_type_index].d(detaching);
2596			destroy_component$2(selectsource, detaching);
2597		}
2598	};
2599}
2600
2601function instance$2($$self, $$props, $$invalidate) {
2602	let { $$slots: slots = {}, $$scope } = $$props;
2603	let { value = null } = $$props;
2604	let { subtitle = null } = $$props;
2605	let { sources = ["webcam", "upload"] } = $$props;
2606	let { label = undefined } = $$props;
2607	let { show_label = true } = $$props;
2608	let { mirror_webcam = false } = $$props;
2609	let { include_audio } = $$props;
2610	let { autoplay } = $$props;
2611	let { root } = $$props;
2612	let { i18n } = $$props;
2613	let { active_source = "webcam" } = $$props;
2614
2615	let { handle_reset_value = () => {
2616		
2617	} } = $$props;
2618
2619	const dispatch = createEventDispatcher$1();
2620
2621	function handle_load({ detail }) {
2622		$$invalidate(0, value = detail);
2623		dispatch("change", detail);
2624		dispatch("upload", detail);
2625	}
2626
2627	function handle_clear() {
2628		$$invalidate(0, value = null);
2629		dispatch("change", null);
2630		dispatch("clear");
2631	}
2632
2633	function handle_change(video) {
2634		dispatch("change", video);
2635	}
2636
2637	let dragging = false;
2638
2639	function upload_dragging_binding(value) {
2640		dragging = value;
2641		$$invalidate(12, dragging);
2642	}
2643
2644	const error_handler_1 = ({ detail }) => dispatch("error", detail);
2645
2646	function error_handler(event) {
2647		bubble$1.call(this, $$self, event);
2648	}
2649
2650	const capture_handler = () => dispatch("change");
2651
2652	function start_recording_handler(event) {
2653		bubble$1.call(this, $$self, event);
2654	}
2655
2656	function stop_recording_handler(event) {
2657		bubble$1.call(this, $$self, event);
2658	}
2659
2660	function play_handler(event) {
2661		bubble$1.call(this, $$self, event);
2662	}
2663
2664	function pause_handler(event) {
2665		bubble$1.call(this, $$self, event);
2666	}
2667
2668	function stop_handler(event) {
2669		bubble$1.call(this, $$self, event);
2670	}
2671
2672	function end_handler(event) {
2673		bubble$1.call(this, $$self, event);
2674	}
2675
2676	function selectsource_active_source_binding(value) {
2677		active_source = value;
2678		$$invalidate(1, active_source);
2679	}
2680
2681	$$self.$$set = $$props => {
2682		if ('value' in $$props) $$invalidate(0, value = $$props.value);
2683		if ('subtitle' in $$props) $$invalidate(2, subtitle = $$props.subtitle);
2684		if ('sources' in $$props) $$invalidate(3, sources = $$props.sources);
2685		if ('label' in $$props) $$invalidate(4, label = $$props.label);
2686		if ('show_label' in $$props) $$invalidate(5, show_label = $$props.show_label);
2687		if ('mirror_webcam' in $$props) $$invalidate(6, mirror_webcam = $$props.mirror_webcam);
2688		if ('include_audio' in $$props) $$invalidate(7, include_audio = $$props.include_audio);
2689		if ('autoplay' in $$props) $$invalidate(8, autoplay = $$props.autoplay);
2690		if ('root' in $$props) $$invalidate(9, root = $$props.root);
2691		if ('i18n' in $$props) $$invalidate(10, i18n = $$props.i18n);
2692		if ('active_source' in $$props) $$invalidate(1, active_source = $$props.active_source);
2693		if ('handle_reset_value' in $$props) $$invalidate(11, handle_reset_value = $$props.handle_reset_value);
2694		if ('$$scope' in $$props) $$invalidate(29, $$scope = $$props.$$scope);
2695	};
2696
2697	$$self.$$.update = () => {
2698		if ($$self.$$.dirty & /*dragging*/ 4096) {
2699			dispatch("drag", dragging);
2700		}
2701	};
2702
2703	return [
2704		value,
2705		active_source,
2706		subtitle,
2707		sources,
2708		label,
2709		show_label,
2710		mirror_webcam,
2711		include_audio,
2712		autoplay,
2713		root,
2714		i18n,
2715		handle_reset_value,
2716		dragging,
2717		dispatch,
2718		handle_load,
2719		handle_clear,
2720		handle_change,
2721		slots,
2722		upload_dragging_binding,
2723		error_handler_1,
2724		error_handler,
2725		capture_handler,
2726		start_recording_handler,
2727		stop_recording_handler,
2728		play_handler,
2729		pause_handler,
2730		stop_handler,
2731		end_handler,
2732		selectsource_active_source_binding,
2733		$$scope
2734	];
2735}
2736
2737class InteractiveVideo extends SvelteComponent$2 {
2738	constructor(options) {
2739		super();
2740
2741		init$2(this, options, instance$2, create_fragment$2, safe_not_equal$2, {
2742			value: 0,
2743			subtitle: 2,
2744			sources: 3,
2745			label: 4,
2746			show_label: 5,
2747			mirror_webcam: 6,
2748			include_audio: 7,
2749			autoplay: 8,
2750			root: 9,
2751			i18n: 10,
2752			active_source: 1,
2753			handle_reset_value: 11
2754		});
2755	}
2756}
2757
2758const Video = InteractiveVideo;
2759
2760const VideoPreview_svelte_svelte_type_style_lang = '';
2761
2762/* home/runner/work/gradio/gradio/js/video/shared/VideoPreview.svelte generated by Svelte v4.2.2 */
2763const {
2764	SvelteComponent: SvelteComponent$1,
2765	append,
2766	attr,
2767	bubble,
2768	check_outros: check_outros$1,
2769	create_component: create_component$1,
2770	destroy_component: destroy_component$1,
2771	detach: detach$1,
2772	element,
2773	empty: empty$1,
2774	group_outros: group_outros$1,
2775	init: init$1,
2776	insert: insert$1,
2777	mount_component: mount_component$1,
2778	noop,
2779	safe_not_equal: safe_not_equal$1,
2780	space: space$1,
2781	transition_in: transition_in$1,
2782	transition_out: transition_out$1
2783} = window.__gradio__svelte__internal;
2784const { createEventDispatcher, afterUpdate, tick } = window.__gradio__svelte__internal;
2785function create_else_block$1(ctx) {
2786	let previous_key = /*value*/ ctx[0].url;
2787	let t0;
2788	let div;
2789	let t1;
2790	let current;
2791	let key_block = create_key_block(ctx);
2792	let if_block0 = /*show_download_button*/ ctx[6] && create_if_block_2(ctx);
2793	let if_block1 = /*show_share_button*/ ctx[5] && create_if_block_1(ctx);
2794
2795	return {
2796		c() {
2797			key_block.c();
2798			t0 = space$1();
2799			div = element("div");
2800			if (if_block0) if_block0.c();
2801			t1 = space$1();
2802			if (if_block1) if_block1.c();
2803			attr(div, "class", "icon-buttons svelte-rvdo70");
2804			attr(div, "data-testid", "download-div");
2805		},
2806		m(target, anchor) {
2807			key_block.m(target, anchor);
2808			insert$1(target, t0, anchor);
2809			insert$1(target, div, anchor);
2810			if (if_block0) if_block0.m(div, null);
2811			append(div, t1);
2812			if (if_block1) if_block1.m(div, null);
2813			current = true;
2814		},
2815		p(ctx, dirty) {
2816			if (dirty & /*value*/ 1 && safe_not_equal$1(previous_key, previous_key = /*value*/ ctx[0].url)) {
2817				group_outros$1();
2818				transition_out$1(key_block, 1, 1, noop);
2819				check_outros$1();
2820				key_block = create_key_block(ctx);
2821				key_block.c();
2822				transition_in$1(key_block, 1);
2823				key_block.m(t0.parentNode, t0);
2824			} else {
2825				key_block.p(ctx, dirty);
2826			}
2827
2828			if (/*show_download_button*/ ctx[6]) {
2829				if (if_block0) {
2830					if_block0.p(ctx, dirty);
2831
2832					if (dirty & /*show_download_button*/ 64) {
2833						transition_in$1(if_block0, 1);
2834					}
2835				} else {
2836					if_block0 = create_if_block_2(ctx);
2837					if_block0.c();
2838					transition_in$1(if_block0, 1);
2839					if_block0.m(div, t1);
2840				}
2841			} else if (if_block0) {
2842				group_outros$1();
2843
2844				transition_out$1(if_block0, 1, 1, () => {
2845					if_block0 = null;
2846				});
2847
2848				check_outros$1();
2849			}
2850
2851			if (/*show_share_button*/ ctx[5]) {
2852				if (if_block1) {
2853					if_block1.p(ctx, dirty);
2854
2855					if (dirty & /*show_share_button*/ 32) {
2856						transition_in$1(if_block1, 1);
2857					}
2858				} else {
2859					if_block1 = create_if_block_1(ctx);
2860					if_block1.c();
2861					transition_in$1(if_block1, 1);
2862					if_block1.m(div, null);
2863				}
2864			} else if (if_block1) {
2865				group_outros$1();
2866
2867				transition_out$1(if_block1, 1, 1, () => {
2868					if_block1 = null;
2869				});
2870
2871				check_outros$1();
2872			}
2873		},
2874		i(local) {
2875			if (current) return;
2876			transition_in$1(key_block);
2877			transition_in$1(if_block0);
2878			transition_in$1(if_block1);
2879			current = true;
2880		},
2881		o(local) {
2882			transition_out$1(key_block);
2883			transition_out$1(if_block0);
2884			transition_out$1(if_block1);
2885			current = false;
2886		},
2887		d(detaching) {
2888			if (detaching) {
2889				detach$1(t0);
2890				detach$1(div);
2891			}
2892
2893			key_block.d(detaching);
2894			if (if_block0) if_block0.d();
2895			if (if_block1) if_block1.d();
2896		}
2897	};
2898}
2899
2900// (34:0) {#if value === null || value.url === undefined}
2901function create_if_block$1(ctx) {
2902	let empty_1;
2903	let current;
2904
2905	empty_1 = new Empty({
2906			props: {
2907				unpadded_box: true,
2908				size: "large",
2909				$$slots: { default: [create_default_slot$1] },
2910				$$scope: { ctx }
2911			}
2912		});
2913
2914	return {
2915		c() {
2916			create_component$1(empty_1.$$.fragment);
2917		},
2918		m(target, anchor) {
2919			mount_component$1(empty_1, target, anchor);
2920			current = true;
2921		},
2922		p(ctx, dirty) {
2923			const empty_1_changes = {};
2924
2925			if (dirty & /*$$scope*/ 262144) {
2926				empty_1_changes.$$scope = { dirty, ctx };
2927			}
2928
2929			empty_1.$set(empty_1_changes);
2930		},
2931		i(local) {
2932			if (current) return;
2933			transition_in$1(empty_1.$$.fragment, local);
2934			current = true;
2935		},
2936		o(local) {
2937			transition_out$1(empty_1.$$.fragment, local);
2938			current = false;
2939		},
2940		d(detaching) {
2941			destroy_component$1(empty_1, detaching);
2942		}
2943	};
2944}
2945
2946// (37:1) {#key value.url}
2947function create_key_block(ctx) {
2948	let player;
2949	let current;
2950
2951	player = new Player$1({
2952			props: {
2953				src: /*value*/ ctx[0].url,
2954				subtitle: /*subtitle*/ ctx[1]?.url,
2955				autoplay: /*autoplay*/ ctx[4],
2956				mirror: false,
2957				label: /*label*/ ctx[2],
2958				interactive: false
2959			}
2960		});
2961
2962	player.$on("play", /*play_handler*/ ctx[8]);
2963	player.$on("pause", /*pause_handler*/ ctx[9]);
2964	player.$on("stop", /*stop_handler*/ ctx[10]);
2965	player.$on("end", /*end_handler*/ ctx[11]);
2966
2967	return {
2968		c() {
2969			create_component$1(player.$$.fragment);
2970		},
2971		m(target, anchor) {
2972			mount_component$1(player, target, anchor);
2973			current = true;
2974		},
2975		p(ctx, dirty) {
2976			const player_changes = {};
2977			if (dirty & /*value*/ 1) player_changes.src = /*value*/ ctx[0].url;
2978			if (dirty & /*subtitle*/ 2) player_changes.subtitle = /*subtitle*/ ctx[1]?.url;
2979			if (dirty & /*autoplay*/ 16) player_changes.autoplay = /*autoplay*/ ctx[4];
2980			if (dirty & /*label*/ 4) player_changes.label = /*label*/ ctx[2];
2981			player.$set(player_changes);
2982		},
2983		i(local) {
2984			if (current) return;
2985			transition_in$1(player.$$.fragment, local);
2986			current = true;
2987		},
2988		o(local) {
2989			transition_out$1(player.$$.fragment, local);
2990			current = false;
2991		},
2992		d(detaching) {
2993			destroy_component$1(player, detaching);
2994		}
2995	};
2996}
2997
2998// (52:2) {#if show_download_button}
2999function create_if_block_2(ctx) {
3000	let a;
3001	let iconbutton;
3002	let a_href_value;
3003	let a_download_value;
3004	let current;
3005
3006	iconbutton = new IconButton({
3007			props: { Icon: Download, label: "Download" }
3008		});
3009
3010	return {
3011		c() {
3012			a = element("a");
3013			create_component$1(iconbutton.$$.fragment);
3014			attr(a, "href", a_href_value = /*value*/ ctx[0].url);
3015			attr(a, "target", window.__is_colab__ ? "_blank" : null);
3016			attr(a, "download", a_download_value = /*value*/ ctx[0].orig_name || /*value*/ ctx[0].path);
3017		},
3018		m(target, anchor) {
3019			insert$1(target, a, anchor);
3020			mount_component$1(iconbutton, a, null);
3021			current = true;
3022		},
3023		p(ctx, dirty) {
3024			if (!current || dirty & /*value*/ 1 && a_href_value !== (a_href_value = /*value*/ ctx[0].url)) {
3025				attr(a, "href", a_href_value);
3026			}
3027
3028			if (!current || dirty & /*value*/ 1 && a_download_value !== (a_download_value = /*value*/ ctx[0].orig_name || /*value*/ ctx[0].path)) {
3029				attr(a, "download", a_download_value);
3030			}
3031		},
3032		i(local) {
3033			if (current) return;
3034			transition_in$1(iconbutton.$$.fragment, local);
3035			current = true;
3036		},
3037		o(local) {
3038			transition_out$1(iconbutton.$$.fragment, local);
3039			current = false;
3040		},
3041		d(detaching) {
3042			if (detaching) {
3043				detach$1(a);
3044			}
3045
3046			destroy_component$1(iconbutton);
3047		}
3048	};
3049}
3050
3051// (61:2) {#if show_share_button}
3052function create_if_block_1(ctx) {
3053	let sharebutton;
3054	let current;
3055
3056	sharebutton = new ShareButton({
3057			props: {
3058				i18n: /*i18n*/ ctx[7],
3059				value: /*value*/ ctx[0],
3060				formatter: /*func*/ ctx[12]
3061			}
3062		});
3063
3064	sharebutton.$on("error", /*error_handler*/ ctx[13]);
3065	sharebutton.$on("share", /*share_handler*/ ctx[14]);
3066
3067	return {
3068		c() {
3069			create_component$1(sharebutton.$$.fragment);
3070		},
3071		m(target, anchor) {
3072			mount_component$1(sharebutton, target, anchor);
3073			current = true;
3074		},
3075		p(ctx, dirty) {
3076			const sharebutton_changes = {};
3077			if (dirty & /*i18n*/ 128) sharebutton_changes.i18n = /*i18n*/ ctx[7];
3078			if (dirty & /*value*/ 1) sharebutton_changes.value = /*value*/ ctx[0];
3079			sharebutton.$set(sharebutton_changes);
3080		},
3081		i(local) {
3082			if (current) return;
3083			transition_in$1(sharebutton.$$.fragment, local);
3084			current = true;
3085		},
3086		o(local) {
3087			transition_out$1(sharebutton.$$.fragment, local);
3088			current = false;
3089		},
3090		d(detaching) {
3091			destroy_component$1(sharebutton, detaching);
3092		}
3093	};
3094}
3095
3096// (35:1) <Empty unpadded_box={true} size="large">
3097function create_default_slot$1(ctx) {
3098	let video;
3099	let current;
3100	video = new Video$2({});
3101
3102	return {
3103		c() {
3104			create_component$1(video.$$.fragment);
3105		},
3106		m(target, anchor) {
3107			mount_component$1(video, target, anchor);
3108			current = true;
3109		},
3110		i(local) {
3111			if (current) return;
3112			transition_in$1(video.$$.fragment, local);
3113			current = true;
3114		},
3115		o(local) {
3116			transition_out$1(video.$$.fragment, local);
3117			current = false;
3118		},
3119		d(detaching) {
3120			destroy_component$1(video, detaching);
3121		}
3122	};
3123}
3124
3125function create_fragment$1(ctx) {
3126	let blocklabel;
3127	let t;
3128	let current_block_type_index;
3129	let if_block;
3130	let if_block_anchor;
3131	let current;
3132
3133	blocklabel = new BlockLabel({
3134			props: {
3135				show_label: /*show_label*/ ctx[3],
3136				Icon: Video$2,
3137				label: /*label*/ ctx[2] || "Video"
3138			}
3139		});
3140
3141	const if_block_creators = [create_if_block$1, create_else_block$1];
3142	const if_blocks = [];
3143
3144	function select_block_type(ctx, dirty) {
3145		if (/*value*/ ctx[0] === null || /*value*/ ctx[0].url === undefined) return 0;
3146		return 1;
3147	}
3148
3149	current_block_type_index = select_block_type(ctx);
3150	if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
3151
3152	return {
3153		c() {
3154			create_component$1(blocklabel.$$.fragment);
3155			t = space$1();
3156			if_block.c();
3157			if_block_anchor = empty$1();
3158		},
3159		m(target, anchor) {
3160			mount_component$1(blocklabel, target, anchor);
3161			insert$1(target, t, anchor);
3162			if_blocks[current_block_type_index].m(target, anchor);
3163			insert$1(target, if_block_anchor, anchor);
3164			current = true;
3165		},
3166		p(ctx, [dirty]) {
3167			const blocklabel_changes = {};
3168			if (dirty & /*show_label*/ 8) blocklabel_changes.show_label = /*show_label*/ ctx[3];
3169			if (dirty & /*label*/ 4) blocklabel_changes.label = /*label*/ ctx[2] || "Video";
3170			blocklabel.$set(blocklabel_changes);
3171			let previous_block_index = current_block_type_index;
3172			current_block_type_index = select_block_type(ctx);
3173
3174			if (current_block_type_index === previous_block_index) {
3175				if_blocks[current_block_type_index].p(ctx, dirty);
3176			} else {
3177				group_outros$1();
3178
3179				transition_out$1(if_blocks[previous_block_index], 1, 1, () => {
3180					if_blocks[previous_block_index] = null;
3181				});
3182
3183				check_outros$1();
3184				if_block = if_blocks[current_block_type_index];
3185
3186				if (!if_block) {
3187					if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
3188					if_block.c();
3189				} else {
3190					if_block.p(ctx, dirty);
3191				}
3192
3193				transition_in$1(if_block, 1);
3194				if_block.m(if_block_anchor.parentNode, if_block_anchor);
3195			}
3196		},
3197		i(local) {
3198			if (current) return;
3199			transition_in$1(blocklabel.$$.fragment, local);
3200			transition_in$1(if_block);
3201			current = true;
3202		},
3203		o(local) {
3204			transition_out$1(blocklabel.$$.fragment, local);
3205			transition_out$1(if_block);
3206			current = false;
3207		},
3208		d(detaching) {
3209			if (detaching) {
3210				detach$1(t);
3211				detach$1(if_block_anchor);
3212			}
3213
3214			destroy_component$1(blocklabel, detaching);
3215			if_blocks[current_block_type_index].d(detaching);
3216		}
3217	};
3218}
3219
3220function instance$1($$self, $$props, $$invalidate) {
3221	let { value = null } = $$props;
3222	let { subtitle = null } = $$props;
3223	let { label = undefined } = $$props;
3224	let { show_label = true } = $$props;
3225	let { autoplay } = $$props;
3226	let { show_share_button = true } = $$props;
3227	let { show_download_button = true } = $$props;
3228	let { i18n } = $$props;
3229	let old_value = null;
3230	let old_subtitle = null;
3231	const dispatch = createEventDispatcher();
3232
3233	afterUpdate(async () => {
3234		// needed to bust subtitle caching issues on Chrome
3235		if (value !== old_value && subtitle !== old_subtitle && old_subtitle !== null) {
3236			old_value = value;
3237			$$invalidate(0, value = null);
3238			await tick();
3239			$$invalidate(0, value = old_value);
3240		}
3241
3242		old_value = value;
3243		old_subtitle = subtitle;
3244	});
3245
3246	function play_handler(event) {
3247		bubble.call(this, $$self, event);
3248	}
3249
3250	function pause_handler(event) {
3251		bubble.call(this, $$self, event);
3252	}
3253
3254	function stop_handler(event) {
3255		bubble.call(this, $$self, event);
3256	}
3257
3258	function end_handler(event) {
3259		bubble.call(this, $$self, event);
3260	}
3261
3262	const func = async value => {
3263		if (!value) return "";
3264		let url = await uploadToHuggingFace(value.data, "url");
3265		return url;
3266	};
3267
3268	function error_handler(event) {
3269		bubble.call(this, $$self, event);
3270	}
3271
3272	function share_handler(event) {
3273		bubble.call(this, $$self, event);
3274	}
3275
3276	$$self.$$set = $$props => {
3277		if ('value' in $$props) $$invalidate(0, value = $$props.value);
3278		if ('subtitle' in $$props) $$invalidate(1, subtitle = $$props.subtitle);
3279		if ('label' in $$props) $$invalidate(2, label = $$props.label);
3280		if ('show_label' in $$props) $$invalidate(3, show_label = $$props.show_label);
3281		if ('autoplay' in $$props) $$invalidate(4, autoplay = $$props.autoplay);
3282		if ('show_share_button' in $$props) $$invalidate(5, show_share_button = $$props.show_share_button);
3283		if ('show_download_button' in $$props) $$invalidate(6, show_download_button = $$props.show_download_button);
3284		if ('i18n' in $$props) $$invalidate(7, i18n = $$props.i18n);
3285	};
3286
3287	$$self.$$.update = () => {
3288		if ($$self.$$.dirty & /*value*/ 1) {
3289			value && dispatch("change", value);
3290		}
3291	};
3292
3293	return [
3294		value,
3295		subtitle,
3296		label,
3297		show_label,
3298		autoplay,
3299		show_share_button,
3300		show_download_button,
3301		i18n,
3302		play_handler,
3303		pause_handler,
3304		stop_handler,
3305		end_handler,
3306		func,
3307		error_handler,
3308		share_handler
3309	];
3310}
3311
3312class VideoPreview extends SvelteComponent$1 {
3313	constructor(options) {
3314		super();
3315
3316		init$1(this, options, instance$1, create_fragment$1, safe_not_equal$1, {
3317			value: 0,
3318			subtitle: 1,
3319			label: 2,
3320			show_label: 3,
3321			autoplay: 4,
3322			show_share_button: 5,
3323			show_download_button: 6,
3324			i18n: 7
3325		});
3326	}
3327}
3328
3329const StaticVideo = VideoPreview;
3330
3331/* home/runner/work/gradio/gradio/js/video/Index.svelte generated by Svelte v4.2.2 */
3332const {
3333	SvelteComponent,
3334	assign,
3335	check_outros,
3336	create_component,
3337	destroy_component,
3338	detach,
3339	empty,
3340	flush,
3341	get_spread_object,
3342	get_spread_update,
3343	group_outros,
3344	init,
3345	insert,
3346	mount_component,
3347	safe_not_equal,
3348	space,
3349	transition_in,
3350	transition_out
3351} = window.__gradio__svelte__internal;
3352function create_else_block(ctx) {
3353	let block;
3354	let current;
3355
3356	block = new Block({
3357			props: {
3358				visible: /*visible*/ ctx[4],
3359				variant: /*value*/ ctx[0] === null && /*active_source*/ ctx[22] === "upload"
3360				? "dashed"
3361				: "solid",
3362				border_mode: /*dragging*/ ctx[23] ? "focus" : "base",
3363				padding: false,
3364				elem_id: /*elem_id*/ ctx[2],
3365				elem_classes: /*elem_classes*/ ctx[3],
3366				height: /*height*/ ctx[9],
3367				width: /*width*/ ctx[10],
3368				container: /*container*/ ctx[11],
3369				scale: /*scale*/ ctx[12],
3370				min_width: /*min_width*/ ctx[13],
3371				allow_overflow: false,
3372				$$slots: { default: [create_default_slot_1] },
3373				$$scope: { ctx }
3374			}
3375		});
3376
3377	return {
3378		c() {
3379			create_component(block.$$.fragment);
3380		},
3381		m(target, anchor) {
3382			mount_component(block, target, anchor);
3383			current = true;
3384		},
3385		p(ctx, dirty) {
3386			const block_changes = {};
3387			if (dirty[0] & /*visible*/ 16) block_changes.visible = /*visible*/ ctx[4];
3388
3389			if (dirty[0] & /*value, active_source*/ 4194305) block_changes.variant = /*value*/ ctx[0] === null && /*active_source*/ ctx[22] === "upload"
3390			? "dashed"
3391			: "solid";
3392
3393			if (dirty[0] & /*dragging*/ 8388608) block_changes.border_mode = /*dragging*/ ctx[23] ? "focus" : "base";
3394			if (dirty[0] & /*elem_id*/ 4) block_changes.elem_id = /*elem_id*/ ctx[2];
3395			if (dirty[0] & /*elem_classes*/ 8) block_changes.elem_classes = /*elem_classes*/ ctx[3];
3396			if (dirty[0] & /*height*/ 512) block_changes.height = /*height*/ ctx[9];
3397			if (dirty[0] & /*width*/ 1024) block_changes.width = /*width*/ ctx[10];
3398			if (dirty[0] & /*container*/ 2048) block_changes.container = /*container*/ ctx[11];
3399			if (dirty[0] & /*scale*/ 4096) block_changes.scale = /*scale*/ ctx[12];
3400			if (dirty[0] & /*min_width*/ 8192) block_changes.min_width = /*min_width*/ ctx[13];
3401
3402			if (dirty[0] & /*_video, _subtitle, label, show_label, sources, active_source, mirror_webcam, include_audio, autoplay, root, gradio, dragging, loading_status*/ 16597474 | dirty[1] & /*$$scope*/ 16384) {
3403				block_changes.$$scope = { dirty, ctx };
3404			}
3405
3406			block.$set(block_changes);
3407		},
3408		i(local) {
3409			if (current) return;
3410			transition_in(block.$$.fragment, local);
3411			current = true;
3412		},
3413		o(local) {
3414			transition_out(block.$$.fragment, local);
3415			current = false;
3416		},
3417		d(detaching) {
3418			destroy_component(block, detaching);
3419		}
3420	};
3421}
3422
3423// (87:0) {#if !interactive}
3424function create_if_block(ctx) {
3425	let block;
3426	let current;
3427
3428	block = new Block({
3429			props: {
3430				visible: /*visible*/ ctx[4],
3431				variant: /*value*/ ctx[0] === null && /*active_source*/ ctx[22] === "upload"
3432				? "dashed"
3433				: "solid",
3434				border_mode: /*dragging*/ ctx[23] ? "focus" : "base",
3435				padding: false,
3436				elem_id: /*elem_id*/ ctx[2],
3437				elem_classes: /*elem_classes*/ ctx[3],
3438				height: /*height*/ ctx[9],
3439				width: /*width*/ ctx[10],
3440				container: /*container*/ ctx[11],
3441				scale: /*scale*/ ctx[12],
3442				min_width: /*min_width*/ ctx[13],
3443				allow_overflow: false,
3444				$$slots: { default: [create_default_slot] },
3445				$$scope: { ctx }
3446			}
3447		});
3448
3449	return {
3450		c() {
3451			create_component(block.$$.fragment);
3452		},
3453		m(target, anchor) {
3454			mount_component(block, target, anchor);
3455			current = true;
3456		},
3457		p(ctx, dirty) {
3458			const block_changes = {};
3459			if (dirty[0] & /*visible*/ 16) block_changes.visible = /*visible*/ ctx[4];
3460
3461			if (dirty[0] & /*value, active_source*/ 4194305) block_changes.variant = /*value*/ ctx[0] === null && /*active_source*/ ctx[22] === "upload"
3462			? "dashed"
3463			: "solid";
3464
3465			if (dirty[0] & /*dragging*/ 8388608) block_changes.border_mode = /*dragging*/ ctx[23] ? "focus" : "base";
3466			if (dirty[0] & /*elem_id*/ 4) block_changes.elem_id = /*elem_id*/ ctx[2];
3467			if (dirty[0] & /*elem_classes*/ 8) block_changes.elem_classes = /*elem_classes*/ ctx[3];
3468			if (dirty[0] & /*height*/ 512) block_changes.height = /*height*/ ctx[9];
3469			if (dirty[0] & /*width*/ 1024) block_changes.width = /*width*/ ctx[10];
3470			if (dirty[0] & /*container*/ 2048) block_changes.container = /*container*/ ctx[11];
3471			if (dirty[0] & /*scale*/ 4096) block_changes.scale = /*scale*/ ctx[12];
3472			if (dirty[0] & /*min_width*/ 8192) block_changes.min_width = /*min_width*/ ctx[13];
3473
3474			if (dirty[0] & /*_video, _subtitle, label, show_label, autoplay, show_share_button, gradio, loading_status*/ 3260706 | dirty[1] & /*$$scope*/ 16384) {
3475				block_changes.$$scope = { dirty, ctx };
3476			}
3477
3478			block.$set(block_changes);
3479		},
3480		i(local) {
3481			if (current) return;
3482			transition_in(block.$$.fragment, local);
3483			current = true;
3484		},
3485		o(local) {
3486			transition_out(block.$$.fragment, local);
3487			current = false;
3488		},
3489		d(detaching) {
3490			destroy_component(block, detaching);
3491		}
3492	};
3493}
3494
3495// (146:2) <Video    value={_video}    subtitle={_subtitle}    on:change={handle_change}    on:drag={({ detail }) => (dragging = detail)}    on:error={handle_error}    {label}    {show_label}    {sources}    {active_source}    {mirror_webcam}    {include_audio}    {autoplay}    {root}    {handle_reset_value}    on:clear={() => gradio.dispatch("clear")}    on:play={() => gradio.dispatch("play")}    on:pause={() => gradio.dispatch("pause")}    on:upload={() => gradio.dispatch("upload")}    on:stop={() => gradio.dispatch("stop")}    on:end={() => gradio.dispatch("end")}    on:start_recording={() => gradio.dispatch("start_recording")}    on:stop_recording={() => gradio.dispatch("stop_recording")}    i18n={gradio.i18n}   >
3496function create_default_slot_2(ctx) {
3497	let uploadtext;
3498	let current;
3499
3500	uploadtext = new UploadText({
3501			props: {
3502				i18n: /*gradio*/ ctx[16].i18n,
3503				type: "video"
3504			}
3505		});
3506
3507	return {
3508		c() {
3509			create_component(uploadtext.$$.fragment);
3510		},
3511		m(target, anchor) {
3512			mount_component(uploadtext, target, anchor);
3513			current = true;
3514		},
3515		p(ctx, dirty) {
3516			const uploadtext_changes = {};
3517			if (dirty[0] & /*gradio*/ 65536) uploadtext_changes.i18n = /*gradio*/ ctx[16].i18n;
3518			uploadtext.$set(uploadtext_changes);
3519		},
3520		i(local) {
3521			if (current) return;
3522			transition_in(uploadtext.$$.fragment, local);
3523			current = true;
3524		},
3525		o(local) {
3526			transition_out(uploadtext.$$.fragment, local);
3527			current = false;
3528		},
3529		d(detaching) {
3530			destroy_component(uploadtext, detaching);
3531		}
3532	};
3533}
3534
3535// (126:1) <Block   {visible}   variant={value === null && active_source === "upload" ? "dashed" : "solid"}   border_mode={dragging ? "focus" : "base"}   padding={false}   {elem_id}   {elem_classes}   {height}   {width}   {container}   {scale}   {min_width}   allow_overflow={false}  >
3536function create_default_slot_1(ctx) {
3537	let statustracker;
3538	let t;
3539	let video;
3540	let current;
3541
3542	const statustracker_spread_levels = [
3543		{
3544			autoscroll: /*gradio*/ ctx[16].autoscroll
3545		},
3546		{ i18n: /*gradio*/ ctx[16].i18n },
3547		/*loading_status*/ ctx[1]
3548	];
3549
3550	let statustracker_props = {};
3551
3552	for (let i = 0; i < statustracker_spread_levels.length; i += 1) {
3553		statustracker_props = assign(statustracker_props, statustracker_spread_levels[i]);
3554	}
3555
3556	statustracker = new Static({ props: statustracker_props });
3557
3558	video = new Video({
3559			props: {
3560				value: /*_video*/ ctx[20],
3561				subtitle: /*_subtitle*/ ctx[21],
3562				label: /*label*/ ctx[5],
3563				show_label: /*show_label*/ ctx[8],
3564				sources: /*sources*/ ctx[6],
3565				active_source: /*active_source*/ ctx[22],
3566				mirror_webcam: /*mirror_webcam*/ ctx[18],
3567				include_audio: /*include_audio*/ ctx[19],
3568				autoplay: /*autoplay*/ ctx[14],
3569				root: /*root*/ ctx[7],
3570				handle_reset_value: /*handle_reset_value*/ ctx[24],
3571				i18n: /*gradio*/ ctx[16].i18n,
3572				$$slots: { default: [create_default_slot_2] },
3573				$$scope: { ctx }
3574			}
3575		});
3576
3577	video.$on("change", /*handle_change*/ ctx[25]);
3578	video.$on("drag", /*drag_handler*/ ctx[36]);
3579	video.$on("error", /*handle_error*/ ctx[26]);
3580	video.$on("clear", /*clear_handler*/ ctx[37]);
3581	video.$on("play", /*play_handler_1*/ ctx[38]);
3582	video.$on("pause", /*pause_handler_1*/ ctx[39]);
3583	video.$on("upload", /*upload_handler*/ ctx[40]);
3584	video.$on("stop", /*stop_handler_1*/ ctx[41]);
3585	video.$on("end", /*end_handler_1*/ ctx[42]);
3586	video.$on("start_recording", /*start_recording_handler*/ ctx[43]);
3587	video.$on("stop_recording", /*stop_recording_handler*/ ctx[44]);
3588
3589	return {
3590		c() {
3591			create_component(statustracker.$$.fragment);
3592			t = space();
3593			create_component(video.$$.fragment);
3594		},
3595		m(target, anchor) {
3596			mount_component(statustracker, target, anchor);
3597			insert(target, t, anchor);
3598			mount_component(video, target, anchor);
3599			current = true;
3600		},
3601		p(ctx, dirty) {
3602			const statustracker_changes = (dirty[0] & /*gradio, loading_status*/ 65538)
3603			? get_spread_update(statustracker_spread_levels, [
3604					dirty[0] & /*gradio*/ 65536 && {
3605						autoscroll: /*gradio*/ ctx[16].autoscroll
3606					},
3607					dirty[0] & /*gradio*/ 65536 && { i18n: /*gradio*/ ctx[16].i18n },
3608					dirty[0] & /*loading_status*/ 2 && get_spread_object(/*loading_status*/ ctx[1])
3609				])
3610			: {};
3611
3612			statustracker.$set(statustracker_changes);
3613			const video_changes = {};
3614			if (dirty[0] & /*_video*/ 1048576) video_changes.value = /*_video*/ ctx[20];
3615			if (dirty[0] & /*_subtitle*/ 2097152) video_changes.subtitle = /*_subtitle*/ ctx[21];
3616			if (dirty[0] & /*label*/ 32) video_changes.label = /*label*/ ctx[5];
3617			if (dirty[0] & /*show_label*/ 256) video_changes.show_label = /*show_label*/ ctx[8];
3618			if (dirty[0] & /*sources*/ 64) video_changes.sources = /*sources*/ ctx[6];
3619			if (dirty[0] & /*active_source*/ 4194304) video_changes.active_source = /*active_source*/ ctx[22];
3620			if (dirty[0] & /*mirror_webcam*/ 262144) video_changes.mirror_webcam = /*mirror_webcam*/ ctx[18];
3621			if (dirty[0] & /*include_audio*/ 524288) video_changes.include_audio = /*include_audio*/ ctx[19];
3622			if (dirty[0] & /*autoplay*/ 16384) video_changes.autoplay = /*autoplay*/ ctx[14];
3623			if (dirty[0] & /*root*/ 128) video_changes.root = /*root*/ ctx[7];
3624			if (dirty[0] & /*gradio*/ 65536) video_changes.i18n = /*gradio*/ ctx[16].i18n;
3625
3626			if (dirty[0] & /*gradio*/ 65536 | dirty[1] & /*$$scope*/ 16384) {
3627				video_changes.$$scope = { dirty, ctx };
3628			}
3629
3630			video.$set(video_changes);
3631		},
3632		i(local) {
3633			if (current) return;
3634			transition_in(statustracker.$$.fragment, local);
3635			transition_in(video.$$.fragment, local);
3636			current = true;
3637		},
3638		o(local) {
3639			transition_out(statustracker.$$.fragment, local);
3640			transition_out(video.$$.fragment, local);
3641			current = false;
3642		},
3643		d(detaching) {
3644			if (detaching) {
3645				detach(t);
3646			}
3647
3648			destroy_component(statustracker, detaching);
3649			destroy_component(video, detaching);
3650		}
3651	};
3652}
3653
3654// (88:1) <Block   {visible}   variant={value === null && active_source === "upload" ? "dashed" : "solid"}   border_mode={dragging ? "focus" : "base"}   padding={false}   {elem_id}   {elem_classes}   {height}   {width}   {container}   {scale}   {min_width}   allow_overflow={false}  >
3655function create_default_slot(ctx) {
3656	let statustracker;
3657	let t;
3658	let staticvideo;
3659	let current;
3660
3661	const statustracker_spread_levels = [
3662		{
3663			autoscroll: /*gradio*/ ctx[16].autoscroll
3664		},
3665		{ i18n: /*gradio*/ ctx[16].i18n },
3666		/*loading_status*/ ctx[1]
3667	];
3668
3669	let statustracker_props = {};
3670
3671	for (let i = 0; i < statustracker_spread_levels.length; i += 1) {
3672		statustracker_props = assign(statustracker_props, statustracker_spread_levels[i]);
3673	}
3674
3675	statustracker = new Static({ props: statustracker_props });
3676
3677	staticvideo = new StaticVideo({
3678			props: {
3679				value: /*_video*/ ctx[20],
3680				subtitle: /*_subtitle*/ ctx[21],
3681				label: /*label*/ ctx[5],
3682				show_label: /*show_label*/ ctx[8],
3683				autoplay: /*autoplay*/ ctx[14],
3684				show_share_button: /*show_share_button*/ ctx[15],
3685				show_download_button: true,
3686				i18n: /*gradio*/ ctx[16].i18n
3687			}
3688		});
3689
3690	staticvideo.$on("play", /*play_handler*/ ctx[30]);
3691	staticvideo.$on("pause", /*pause_handler*/ ctx[31]);
3692	staticvideo.$on("stop", /*stop_handler*/ ctx[32]);
3693	staticvideo.$on("end", /*end_handler*/ ctx[33]);
3694	staticvideo.$on("share", /*share_handler*/ ctx[34]);
3695	staticvideo.$on("error", /*error_handler*/ ctx[35]);
3696
3697	return {
3698		c() {
3699			create_component(statustracker.$$.fragment);
3700			t = space();
3701			create_component(staticvideo.$$.fragment);
3702		},
3703		m(target, anchor) {
3704			mount_component(statustracker, target, anchor);
3705			insert(target, t, anchor);
3706			mount_component(staticvideo, target, anchor);
3707			current = true;
3708		},
3709		p(ctx, dirty) {
3710			const statustracker_changes = (dirty[0] & /*gradio, loading_status*/ 65538)
3711			? get_spread_update(statustracker_spread_levels, [
3712					dirty[0] & /*gradio*/ 65536 && {
3713						autoscroll: /*gradio*/ ctx[16].autoscroll
3714					},
3715					dirty[0] & /*gradio*/ 65536 && { i18n: /*gradio*/ ctx[16].i18n },
3716					dirty[0] & /*loading_status*/ 2 && get_spread_object(/*loading_status*/ ctx[1])
3717				])
3718			: {};
3719
3720			statustracker.$set(statustracker_changes);
3721			const staticvideo_changes = {};
3722			if (dirty[0] & /*_video*/ 1048576) staticvideo_changes.value = /*_video*/ ctx[20];
3723			if (dirty[0] & /*_subtitle*/ 2097152) staticvideo_changes.subtitle = /*_subtitle*/ ctx[21];
3724			if (dirty[0] & /*label*/ 32) staticvideo_changes.label = /*label*/ ctx[5];
3725			if (dirty[0] & /*show_label*/ 256) staticvideo_changes.show_label = /*show_label*/ ctx[8];
3726			if (dirty[0] & /*autoplay*/ 16384) staticvideo_changes.autoplay = /*autoplay*/ ctx[14];
3727			if (dirty[0] & /*show_share_button*/ 32768) staticvideo_changes.show_share_button = /*show_share_button*/ ctx[15];
3728			if (dirty[0] & /*gradio*/ 65536) staticvideo_changes.i18n = /*gradio*/ ctx[16].i18n;
3729			staticvideo.$set(staticvideo_changes);
3730		},
3731		i(local) {
3732			if (current) return;
3733			transition_in(statustracker.$$.fragment, local);
3734			transition_in(staticvideo.$$.fragment, local);
3735			current = true;
3736		},
3737		o(local) {
3738			transition_out(statustracker.$$.fragment, local);
3739			transition_out(staticvideo.$$.fragment, local);
3740			current = false;
3741		},
3742		d(detaching) {
3743			if (detaching) {
3744				detach(t);
3745			}
3746
3747			destroy_component(statustracker, detaching);
3748			destroy_component(staticvideo, detaching);
3749		}
3750	};
3751}
3752
3753function create_fragment(ctx) {
3754	let current_block_type_index;
3755	let if_block;
3756	let if_block_anchor;
3757	let current;
3758	const if_block_creators = [create_if_block, create_else_block];
3759	const if_blocks = [];
3760
3761	function select_block_type(ctx, dirty) {
3762		if (!/*interactive*/ ctx[17]) return 0;
3763		return 1;
3764	}
3765
3766	current_block_type_index = select_block_type(ctx);
3767	if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
3768
3769	return {
3770		c() {
3771			if_block.c();
3772			if_block_anchor = empty();
3773		},
3774		m(target, anchor) {
3775			if_blocks[current_block_type_index].m(target, anchor);
3776			insert(target, if_block_anchor, anchor);
3777			current = true;
3778		},
3779		p(ctx, dirty) {
3780			let previous_block_index = current_block_type_index;
3781			current_block_type_index = select_block_type(ctx);
3782
3783			if (current_block_type_index === previous_block_index) {
3784				if_blocks[current_block_type_index].p(ctx, dirty);
3785			} else {
3786				group_outros();
3787
3788				transition_out(if_blocks[previous_block_index], 1, 1, () => {
3789					if_blocks[previous_block_index] = null;
3790				});
3791
3792				check_outros();
3793				if_block = if_blocks[current_block_type_index];
3794
3795				if (!if_block) {
3796					if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
3797					if_block.c();
3798				} else {
3799					if_block.p(ctx, dirty);
3800				}
3801
3802				transition_in(if_block, 1);
3803				if_block.m(if_block_anchor.parentNode, if_block_anchor);
3804			}
3805		},
3806		i(local) {
3807			if (current) return;
3808			transition_in(if_block);
3809			current = true;
3810		},
3811		o(local) {
3812			transition_out(if_block);
3813			current = false;
3814		},
3815		d(detaching) {
3816			if (detaching) {
3817				detach(if_block_anchor);
3818			}
3819
3820			if_blocks[current_block_type_index].d(detaching);
3821		}
3822	};
3823}
3824
3825function instance($$self, $$props, $$invalidate) {
3826	let { elem_id = "" } = $$props;
3827	let { elem_classes = [] } = $$props;
3828	let { visible = true } = $$props;
3829	let { value = null } = $$props;
3830	let old_value = null;
3831	let { label } = $$props;
3832	let { sources } = $$props;
3833	let { root } = $$props;
3834	let { proxy_url } = $$props;
3835	let { show_label } = $$props;
3836	let { loading_status } = $$props;
3837	let { height } = $$props;
3838	let { width } = $$props;
3839	let { container = false } = $$props;
3840	let { scale = null } = $$props;
3841	let { min_width = undefined } = $$props;
3842	let { autoplay = false } = $$props;
3843	let { show_share_button = true } = $$props;
3844	let { gradio } = $$props;
3845	let { interactive } = $$props;
3846	let { mirror_webcam } = $$props;
3847	let { include_audio } = $$props;
3848	let _video = null;
3849	let _subtitle = null;
3850	let active_source;
3851	let initial_value = value;
3852
3853	const handle_reset_value = () => {
3854		if (initial_value === null || value === initial_value) {
3855			return;
3856		}
3857
3858		$$invalidate(0, value = initial_value);
3859	};
3860
3861	let dragging = false;
3862
3863	function handle_change({ detail }) {
3864		if (detail != null) {
3865			$$invalidate(0, value = { video: detail, subtitles: null });
3866		} else {
3867			$$invalidate(0, value = null);
3868		}
3869	}
3870
3871	function handle_error({ detail }) {
3872		const [level, status] = detail.includes("Invalid file type")
3873		? ["warning", "complete"]
3874		: ["error", "error"];
3875
3876		$$invalidate(1, loading_status = loading_status || {});
3877		$$invalidate(1, loading_status.status = status, loading_status);
3878		$$invalidate(1, loading_status.message = detail, loading_status);
3879		gradio.dispatch(level, detail);
3880	}
3881
3882	const play_handler = () => gradio.dispatch("play");
3883	const pause_handler = () => gradio.dispatch("pause");
3884	const stop_handler = () => gradio.dispatch("stop");
3885	const end_handler = () => gradio.dispatch("end");
3886	const share_handler = ({ detail }) => gradio.dispatch("share", detail);
3887	const error_handler = ({ detail }) => gradio.dispatch("error", detail);
3888	const drag_handler = ({ detail }) => $$invalidate(23, dragging = detail);
3889	const clear_handler = () => gradio.dispatch("clear");
3890	const play_handler_1 = () => gradio.dispatch("play");
3891	const pause_handler_1 = () => gradio.dispatch("pause");
3892	const upload_handler = () => gradio.dispatch("upload");
3893	const stop_handler_1 = () => gradio.dispatch("stop");
3894	const end_handler_1 = () => gradio.dispatch("end");
3895	const start_recording_handler = () => gradio.dispatch("start_recording");
3896	const stop_recording_handler = () => gradio.dispatch("stop_recording");
3897
3898	$$self.$$set = $$props => {
3899		if ('elem_id' in $$props) $$invalidate(2, elem_id = $$props.elem_id);
3900		if ('elem_classes' in $$props) $$invalidate(3, elem_classes = $$props.elem_classes);
3901		if ('visible' in $$props) $$invalidate(4, visible = $$props.visible);
3902		if ('value' in $$props) $$invalidate(0, value = $$props.value);
3903		if ('label' in $$props) $$invalidate(5, label = $$props.label);
3904		if ('sources' in $$props) $$invalidate(6, sources = $$props.sources);
3905		if ('root' in $$props) $$invalidate(7, root = $$props.root);
3906		if ('proxy_url' in $$props) $$invalidate(27, proxy_url = $$props.proxy_url);
3907		if ('show_label' in $$props) $$invalidate(8, show_label = $$props.show_label);
3908		if ('loading_status' in $$props) $$invalidate(1, loading_status = $$props.loading_status);
3909		if ('height' in $$props) $$invalidate(9, height = $$props.height);
3910		if ('width' in $$props) $$invalidate(10, width = $$props.width);
3911		if ('container' in $$props) $$invalidate(11, container = $$props.container);
3912		if ('scale' in $$props) $$invalidate(12, scale = $$props.scale);
3913		if ('min_width' in $$props) $$invalidate(13, min_width = $$props.min_width);
3914		if ('autoplay' in $$props) $$invalidate(14, autoplay = $$props.autoplay);
3915		if ('show_share_button' in $$props) $$invalidate(15, show_share_button = $$props.show_share_button);
3916		if ('gradio' in $$props) $$invalidate(16, gradio = $$props.gradio);
3917		if ('interactive' in $$props) $$invalidate(17, interactive = $$props.interactive);
3918		if ('mirror_webcam' in $$props) $$invalidate(18, mirror_webcam = $$props.mirror_webcam);
3919		if ('include_audio' in $$props) $$invalidate(19, include_audio = $$props.include_audio);
3920	};
3921
3922	$$self.$$.update = () => {
3923		if ($$self.$$.dirty[0] & /*value, initial_value*/ 536870913) {
3924			if (value && initial_value === null) {
3925				$$invalidate(29, initial_value = value);
3926			}
3927		}
3928
3929		if ($$self.$$.dirty[0] & /*sources*/ 64) {
3930			if (sources) {
3931				if (sources.length > 1) {
3932					$$invalidate(22, active_source = "upload");
3933				} else {
3934					$$invalidate(22, active_source = sources[0]);
3935				}
3936			}
3937		}
3938
3939		if ($$self.$$.dirty[0] & /*value, root, proxy_url*/ 134217857) {
3940			{
3941				if (value != null) {
3942					$$invalidate(20, _video = normalise_file(value.video, root, proxy_url));
3943					$$invalidate(21, _subtitle = normalise_file(value.subtitles, root, proxy_url));
3944				} else {
3945					$$invalidate(20, _video = null);
3946					$$invalidate(21, _subtitle = null);
3947				}
3948			}
3949		}
3950
3951		if ($$self.$$.dirty[0] & /*value, old_value, gradio*/ 268500993) {
3952			{
3953				if (JSON.stringify(value) !== JSON.stringify(old_value)) {
3954					$$invalidate(28, old_value = value);
3955					gradio.dispatch("change");
3956				}
3957			}
3958		}
3959	};
3960
3961	return [
3962		value,
3963		loading_status,
3964		elem_id,
3965		elem_classes,
3966		visible,
3967		label,
3968		sources,
3969		root,
3970		show_label,
3971		height,
3972		width,
3973		container,
3974		scale,
3975		min_width,
3976		autoplay,
3977		show_share_button,
3978		gradio,
3979		interactive,
3980		mirror_webcam,
3981		include_audio,
3982		_video,
3983		_subtitle,
3984		active_source,
3985		dragging,
3986		handle_reset_value,
3987		handle_change,
3988		handle_error,
3989		proxy_url,
3990		old_value,
3991		initial_value,
3992		play_handler,
3993		pause_handler,
3994		stop_handler,
3995		end_handler,
3996		share_handler,
3997		error_handler,
3998		drag_handler,
3999		clear_handler,
4000		play_handler_1,
4001		pause_handler_1,
4002		upload_handler,
4003		stop_handler_1,
4004		end_handler_1,
4005		start_recording_handler,
4006		stop_recording_handler
4007	];
4008}
4009
4010class Index extends SvelteComponent {
4011	constructor(options) {
4012		super();
4013
4014		init(
4015			this,
4016			options,
4017			instance,
4018			create_fragment,
4019			safe_not_equal,
4020			{
4021				elem_id: 2,
4022				elem_classes: 3,
4023				visible: 4,
4024				value: 0,
4025				label: 5,
4026				sources: 6,
4027				root: 7,
4028				proxy_url: 27,
4029				show_label: 8,
4030				loading_status: 1,
4031				height: 9,
4032				width: 10,
4033				container: 11,
4034				scale: 12,
4035				min_width: 13,
4036				autoplay: 14,
4037				show_share_button: 15,
4038				gradio: 16,
4039				interactive: 17,
4040				mirror_webcam: 18,
4041				include_audio: 19
4042			},
4043			null,
4044			[-1, -1]
4045		);
4046	}
4047
4048	get elem_id() {
4049		return this.$$.ctx[2];
4050	}
4051
4052	set elem_id(elem_id) {
4053		this.$$set({ elem_id });
4054		flush();
4055	}
4056
4057	get elem_classes() {
4058		return this.$$.ctx[3];
4059	}
4060
4061	set elem_classes(elem_classes) {
4062		this.$$set({ elem_classes });
4063		flush();
4064	}
4065
4066	get visible() {
4067		return this.$$.ctx[4];
4068	}
4069
4070	set visible(visible) {
4071		this.$$set({ visible });
4072		flush();
4073	}
4074
4075	get value() {
4076		return this.$$.ctx[0];
4077	}
4078
4079	set value(value) {
4080		this.$$set({ value });
4081		flush();
4082	}
4083
4084	get label() {
4085		return this.$$.ctx[5];
4086	}
4087
4088	set label(label) {
4089		this.$$set({ label });
4090		flush();
4091	}
4092
4093	get sources() {
4094		return this.$$.ctx[6];
4095	}
4096
4097	set sources(sources) {
4098		this.$$set({ sources });
4099		flush();
4100	}
4101
4102	get root() {
4103		return this.$$.ctx[7];
4104	}
4105
4106	set root(root) {
4107		this.$$set({ root });
4108		flush();
4109	}
4110
4111	get proxy_url() {
4112		return this.$$.ctx[27];
4113	}
4114
4115	set proxy_url(proxy_url) {
4116		this.$$set({ proxy_url });
4117		flush();
4118	}
4119
4120	get show_label() {
4121		return this.$$.ctx[8];
4122	}
4123
4124	set show_label(show_label) {
4125		this.$$set({ show_label });
4126		flush();
4127	}
4128
4129	get loading_status() {
4130		return this.$$.ctx[1];
4131	}
4132
4133	set loading_status(loading_status) {
4134		this.$$set({ loading_status });
4135		flush();
4136	}
4137
4138	get height() {
4139		return this.$$.ctx[9];
4140	}
4141
4142	set height(height) {
4143		this.$$set({ height });
4144		flush();
4145	}
4146
4147	get width() {
4148		return this.$$.ctx[10];
4149	}
4150
4151	set width(width) {
4152		this.$$set({ width });
4153		flush();
4154	}
4155
4156	get container() {
4157		return this.$$.ctx[11];
4158	}
4159
4160	set container(container) {
4161		this.$$set({ container });
4162		flush();
4163	}
4164
4165	get scale() {
4166		return this.$$.ctx[12];
4167	}
4168
4169	set scale(scale) {
4170		this.$$set({ scale });
4171		flush();
4172	}
4173
4174	get min_width() {
4175		return this.$$.ctx[13];
4176	}
4177
4178	set min_width(min_width) {
4179		this.$$set({ min_width });
4180		flush();
4181	}
4182
4183	get autoplay() {
4184		return this.$$.ctx[14];
4185	}
4186
4187	set autoplay(autoplay) {
4188		this.$$set({ autoplay });
4189		flush();
4190	}
4191
4192	get show_share_button() {
4193		return this.$$.ctx[15];
4194	}
4195
4196	set show_share_button(show_share_button) {
4197		this.$$set({ show_share_button });
4198		flush();
4199	}
4200
4201	get gradio() {
4202		return this.$$.ctx[16];
4203	}
4204
4205	set gradio(gradio) {
4206		this.$$set({ gradio });
4207		flush();
4208	}
4209
4210	get interactive() {
4211		return this.$$.ctx[17];
4212	}
4213
4214	set interactive(interactive) {
4215		this.$$set({ interactive });
4216		flush();
4217	}
4218
4219	get mirror_webcam() {
4220		return this.$$.ctx[18];
4221	}
4222
4223	set mirror_webcam(mirror_webcam) {
4224		this.$$set({ mirror_webcam });
4225		flush();
4226	}
4227
4228	get include_audio() {
4229		return this.$$.ctx[19];
4230	}
4231
4232	set include_audio(include_audio) {
4233		this.$$set({ include_audio });
4234		flush();
4235	}
4236}
4237
4238const Index$1 = Index;
4239
4240export { Video as BaseInteractiveVideo, Player$1 as BasePlayer, StaticVideo as BaseStaticVideo, Index$1 as default, playable, prettyBytes };
4241//# sourceMappingURL=index-8b3d331e.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.