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