1import { U as Upload } from './ModifyUpload.svelte_svelte_type_style_lang-6f675b46.js'; 2import { M as ModifyUpload } from './ModifyUpload-75b22e38.js'; 3import { B as Block } from './Button-f2ef1e3f.js'; 4import { B as BlockLabel } from './BlockLabel-b0ab52e0.js'; 5import { S as Static } from './Index-f4e7a341.js'; 6import { S as SelectSource } from './SelectSource-85b10638.js'; 7import { W as Webcam } from './ImageUploader-1337d0c5.js'; 8import { p as prepare_files, u as upload, n as normalise_file } from './index-546f83db.js'; 9import './Image-5414ffe6.js'; 10/* empty css */import { l as loadFfmpeg, t as trimVideo, V as Video$2, p as prettyBytes, a as playable } from './Video-67b30a0c.js'; 11export { b as loaded } from './Video-67b30a0c.js'; 12import { T as Trim, P as Pause, a as Play } from './Trim-7bd312df.js'; 13import { U as Undo } from './Undo-6c110254.js'; 14import { I as IconButton } from './IconButton-b1f250d1.js'; 15import { E as Empty } from './Empty-27f3e442.js'; 16import { S as ShareButton } from './ShareButton-c254ab08.js'; 17import { D as DownloadLink, a as Download } from './DownloadLink-3c2b99a1.js'; 18import { u as uploadToHuggingFace } from './utils-8f25e669.js'; 19export { default as BaseExample } from './Example-a8164feb.js'; 20import { U as UploadText } from './UploadText-78b5a93a.js'; 21import './Upload-96564545.js'; 22import './Image-6cbf81d1.js'; 23import './DropdownArrow-04b836e1.js'; 24import './svelte/svelte.js'; 25import './file-url-c18a1f7c.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[14](value); 626 } 627 628 function videotimeline_dragEnd_binding(value) { 629 /*videotimeline_dragEnd_binding*/ ctx[15](value); 630 } 631 632 function videotimeline_trimmedDuration_binding(value) { 633 /*videotimeline_trimmedDuration_binding*/ ctx[16](value); 634 } 635 636 function videotimeline_loadingTimeline_binding(value) { 637 /*videotimeline_loadingTimeline_binding*/ ctx[17](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// (63: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// (58:2) {#if mode === "edit" && trimmedDuration !== null} 746function create_if_block_3$1(ctx) { 747 let time; 748 let t_value = /*formatTime*/ ctx[12](/*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 = /*formatTime*/ ctx[12](/*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// (68: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[18]); 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// (82: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// (92: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[19]), 932 listen$1(button1, "click", /*toggleTrimmingMode*/ ctx[13]) 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// (83: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[13]); 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 const formatTime = seconds => { 1188 const minutes = Math.floor(seconds / 60); 1189 const secondsRemainder = Math.round(seconds) % 60; 1190 const paddedSeconds = `0${secondsRemainder}`.slice(-2); 1191 1192 if (Number.isNaN(minutes) || Number.isNaN(secondsRemainder)) { 1193 return "00:00"; 1194 } 1195 1196 return `${minutes}:${paddedSeconds}`; 1197 }; 1198 1199 let trimmedDuration = null; 1200 let dragStart = 0; 1201 let dragEnd = 0; 1202 let loadingTimeline = false; 1203 1204 const toggleTrimmingMode = () => { 1205 if (mode === "edit") { 1206 $$invalidate(0, mode = ""); 1207 $$invalidate(7, trimmedDuration = videoElement.duration); 1208 } else { 1209 $$invalidate(0, mode = "edit"); 1210 } 1211 }; 1212 1213 function videotimeline_dragStart_binding(value) { 1214 dragStart = value; 1215 $$invalidate(9, dragStart); 1216 } 1217 1218 function videotimeline_dragEnd_binding(value) { 1219 dragEnd = value; 1220 $$invalidate(10, dragEnd); 1221 } 1222 1223 function videotimeline_trimmedDuration_binding(value) { 1224 trimmedDuration = value; 1225 (($$invalidate(7, trimmedDuration), $$invalidate(0, mode)), $$invalidate(2, videoElement)); 1226 } 1227 1228 function videotimeline_loadingTimeline_binding(value) { 1229 loadingTimeline = value; 1230 $$invalidate(11, loadingTimeline); 1231 } 1232 1233 const click_handler = () => { 1234 handle_reset_value(); 1235 $$invalidate(0, mode = ""); 1236 }; 1237 1238 const click_handler_1 = () => { 1239 $$invalidate(0, mode = ""); 1240 $$invalidate(1, processingVideo = true); 1241 1242 trimVideo(ffmpeg, dragStart, dragEnd, videoElement).then(videoBlob => { 1243 handle_trim_video(videoBlob); 1244 }).then(() => { 1245 $$invalidate(1, processingVideo = false); 1246 }); 1247 }; 1248 1249 $$self.$$set = $$props => {
1250 if ('videoElement' in $$props) $$invalidate(2, videoElement = $$props.videoElement); 1251 if ('showRedo' in $$props) $$invalidate(3, showRedo = $$props.showRedo); 1252 if ('interactive' in $$props) $$invalidate(4, interactive = $$props.interactive); 1253 if ('mode' in $$props) $$invalidate(0, mode = $$props.mode); 1254 if ('handle_reset_value' in $$props) $$invalidate(5, handle_reset_value = $$props.handle_reset_value); 1255 if ('handle_trim_video' in $$props) $$invalidate(6, handle_trim_video = $$props.handle_trim_video); 1256 if ('processingVideo' in $$props) $$invalidate(1, processingVideo = $$props.processingVideo); 1257 }; 1258 1259 $$self.$$.update = () => { 1260 if ($$self.$$.dirty & /*mode, trimmedDuration, videoElement*/ 133) { 1261 if (mode === "edit" && trimmedDuration === null && videoElement) $$invalidate(7, trimmedDuration = videoElement.duration); 1262 } 1263 }; 1264 1265 return [ 1266 mode, 1267 processingVideo, 1268 videoElement, 1269 showRedo, 1270 interactive, 1271 handle_reset_value, 1272 handle_trim_video, 1273 trimmedDuration, 1274 ffmpeg, 1275 dragStart, 1276 dragEnd, 1277 loadingTimeline, 1278 formatTime, 1279 toggleTrimmingMode, 1280 videotimeline_dragStart_binding, 1281 videotimeline_dragEnd_binding, 1282 videotimeline_trimmedDuration_binding, 1283 videotimeline_loadingTimeline_binding, 1284 click_handler, 1285 click_handler_1 1286 ]; 1287} 1288 1289class VideoControls extends SvelteComponent$4 { 1290 constructor(options) { 1291 super(); 1292 1293 init$4(this, options, instance$4, create_fragment$4, safe_not_equal$4, { 1294 videoElement: 2, 1295 showRedo: 3, 1296 interactive: 4, 1297 mode: 0, 1298 handle_reset_value: 5, 1299 handle_trim_video: 6, 1300 processingVideo: 1 1301 }); 1302 } 1303} 1304 1305const Player_svelte_svelte_type_style_lang = ''; 1306 1307/* home/runner/work/gradio/gradio/js/video/shared/Player.svelte generated by Svelte v4.2.2 */ 1308const { 1309 SvelteComponent: SvelteComponent$3, 1310 add_flush_callback: add_flush_callback$1, 1311 append: append$2, 1312 attr: attr$2, 1313 bind: bind$1, 1314 binding_callbacks: binding_callbacks$1, 1315 bubble: bubble$2, 1316 check_outros: check_outros$3, 1317 create_component: create_component$3, 1318 destroy_component: destroy_component$3, 1319 detach: detach$3, 1320 element: element$2, 1321 empty: empty$3, 1322 group_outros: group_outros$3, 1323 init: init$3, 1324 insert: insert$3, 1325 listen, 1326 mount_component: mount_component$3, 1327 prevent_default, 1328 run_all, 1329 safe_not_equal: safe_not_equal$3, 1330 set_data: set_data$1, 1331 space: space$3, 1332 src_url_equal, 1333 stop_propagation, 1334 text: text$1, 1335 toggle_class, 1336 transition_in: transition_in$3, 1337 transition_out: transition_out$3 1338} = window.__gradio__svelte__internal; 1339const { createEventDispatcher: createEventDispatcher$2 } = window.__gradio__svelte__internal; 1340function create_default_slot$3(ctx) { 1341 let track; 1342 let track_src_value; 1343 1344 return { 1345 c() { 1346 track = element$2("track"); 1347 attr$2(track, "kind", "captions"); 1348 if (!src_url_equal(track.src, track_src_value = /*subtitle*/ ctx[1])) attr$2(track, "src", track_src_value); 1349 track.default = true; 1350 }, 1351 m(target, anchor) { 1352 insert$3(target, track, anchor); 1353 }, 1354 p(ctx, dirty) { 1355 if (dirty & /*subtitle*/ 2 && !src_url_equal(track.src, track_src_value = /*subtitle*/ ctx[1])) { 1356 attr$2(track, "src", track_src_value); 1357 } 1358 }, 1359 d(detaching) { 1360 if (detaching) { 1361 detach$3(track); 1362 } 1363 } 1364 }; 1365} 1366 1367// (112:4) {:else} 1368function create_else_block$3(ctx) { 1369 let pause; 1370 let current; 1371 pause = new Pause({}); 1372 1373 return { 1374 c() { 1375 create_component$3(pause.$$.fragment); 1376 }, 1377 m(target, anchor) { 1378 mount_component$3(pause, target, anchor); 1379 current = true; 1380 }, 1381 i(local) { 1382 if (current) return; 1383 transition_in$3(pause.$$.fragment, local); 1384 current = true; 1385 }, 1386 o(local) { 1387 transition_out$3(pause.$$.fragment, local); 1388 current = false; 1389 }, 1390 d(detaching) { 1391 destroy_component$3(pause, detaching); 1392 } 1393 }; 1394} 1395 1396// (110:21) 1397function create_if_block_2$2(ctx) { 1398 let play; 1399 let current; 1400 play = new Play({}); 1401 1402 return { 1403 c() { 1404 create_component$3(play.$$.fragment); 1405 }, 1406 m(target, anchor) { 1407 mount_component$3(play, target, anchor); 1408 current = true; 1409 }, 1410 i(local) { 1411 if (current) return; 1412 transition_in$3(play.$$.fragment, local); 1413 current = true; 1414 }, 1415 o(local) { 1416 transition_out$3(play.$$.fragment, local); 1417 current = false;
1418 }, 1419 d(detaching) { 1420 destroy_component$3(play, detaching); 1421 } 1422 }; 1423} 1424 1425// (108:4) {#if time === duration} 1426function create_if_block_1$2(ctx) { 1427 let undo; 1428 let current; 1429 undo = new Undo({}); 1430 1431 return { 1432 c() { 1433 create_component$3(undo.$$.fragment); 1434 }, 1435 m(target, anchor) { 1436 mount_component$3(undo, target, anchor); 1437 current = true; 1438 }, 1439 i(local) { 1440 if (current) return; 1441 transition_in$3(undo.$$.fragment, local); 1442 current = true; 1443 }, 1444 o(local) { 1445 transition_out$3(undo.$$.fragment, local); 1446 current = false; 1447 }, 1448 d(detaching) { 1449 destroy_component$3(undo, detaching); 1450 } 1451 }; 1452} 1453 1454// (142:0) {#if interactive} 1455function create_if_block$3(ctx) { 1456 let videocontrols; 1457 let updating_processingVideo; 1458 let current; 1459 1460 function videocontrols_processingVideo_binding(value) { 1461 /*videocontrols_processingVideo_binding*/ ctx[26](value); 1462 } 1463 1464 let videocontrols_props = { 1465 videoElement: /*video*/ ctx[10], 1466 showRedo: true, 1467 handle_trim_video: /*handle_trim_video*/ ctx[16], 1468 handle_reset_value: /*handle_reset_value*/ ctx[6] 1469 }; 1470 1471 if (/*processingVideo*/ ctx[11] !== void 0) { 1472 videocontrols_props.processingVideo = /*processingVideo*/ ctx[11]; 1473 } 1474 1475 videocontrols = new VideoControls({ props: videocontrols_props }); 1476 binding_callbacks$1.push(() => bind$1(videocontrols, 'processingVideo', videocontrols_processingVideo_binding)); 1477 1478 return { 1479 c() { 1480 create_component$3(videocontrols.$$.fragment); 1481 }, 1482 m(target, anchor) { 1483 mount_component$3(videocontrols, target, anchor); 1484 current = true; 1485 }, 1486 p(ctx, dirty) { 1487 const videocontrols_changes = {}; 1488 if (dirty & /*video*/ 1024) videocontrols_changes.videoElement = /*video*/ ctx[10]; 1489 if (dirty & /*handle_reset_value*/ 64) videocontrols_changes.handle_reset_value = /*handle_reset_value*/ ctx[6]; 1490 1491 if (!updating_processingVideo && dirty & /*processingVideo*/ 2048) { 1492 updating_processingVideo = true; 1493 videocontrols_changes.processingVideo = /*processingVideo*/ ctx[11]; 1494 add_flush_callback$1(() => updating_processingVideo = false); 1495 } 1496 1497 videocontrols.$set(videocontrols_changes); 1498 }, 1499 i(local) { 1500 if (current) return; 1501 transition_in$3(videocontrols.$$.fragment, local); 1502 current = true; 1503 }, 1504 o(local) { 1505 transition_out$3(videocontrols.$$.fragment, local); 1506 current = false; 1507 }, 1508 d(detaching) { 1509 destroy_component$3(videocontrols, detaching); 1510 } 1511 }; 1512} 1513 1514function create_fragment$3(ctx) { 1515 let div4; 1516 let div0; 1517 let video_1; 1518 let updating_currentTime; 1519 let updating_duration; 1520 let updating_paused; 1521 let updating_node; 1522 let t0; 1523 let div3; 1524 let div2; 1525 let span0; 1526 let current_block_type_index; 1527 let if_block0; 1528 let t1; 1529 let span1; 1530 let t2_value = format(/*time*/ ctx[7]) + ""; 1531 let t2; 1532 let t3; 1533 let t4_value = format(/*duration*/ ctx[8]) + ""; 1534 let t4; 1535 let t5; 1536 let progress; 1537 let progress_value_value; 1538 let t6; 1539 let div1; 1540 let maximise; 1541 let t7; 1542 let if_block1_anchor; 1543 let current; 1544 let mounted; 1545 let dispose; 1546 1547 function video_1_currentTime_binding(value) { 1548 /*video_1_currentTime_binding*/ ctx[20](value); 1549 } 1550 1551 function video_1_duration_binding(value) { 1552 /*video_1_duration_binding*/ ctx[21](value); 1553 } 1554 1555 function video_1_paused_binding(value) { 1556 /*video_1_paused_binding*/ ctx[22](value); 1557 } 1558 1559 function video_1_node_binding(value) { 1560 /*video_1_node_binding*/ ctx[23](value); 1561 } 1562 1563 let video_1_props = { 1564 src: /*src*/ ctx[0], 1565 preload: "auto", 1566 autoplay: /*autoplay*/ ctx[3], 1567 "data-testid": `${/*label*/ ctx[4]}-player`, 1568 processingVideo: /*processingVideo*/ ctx[11], 1569 $$slots: { default: [create_default_slot$3] }, 1570 $$scope: { ctx } 1571 }; 1572 1573 if (/*time*/ ctx[7] !== void 0) { 1574 video_1_props.currentTime = /*time*/ ctx[7]; 1575 } 1576 1577 if (/*duration*/ ctx[8] !== void 0) { 1578 video_1_props.duration = /*duration*/ ctx[8]; 1579 } 1580 1581 if (/*paused*/ ctx[9] !== void 0) { 1582 video_1_props.paused = /*paused*/ ctx[9]; 1583 } 1584 1585 if (/*video*/ ctx[10] !== void 0) { 1586 video_1_props.node = /*video*/ ctx[10]; 1587 } 1588 1589 video_1 = new Video$2({ props: video_1_props }); 1590 binding_callbacks$1.push(() => bind$1(video_1, 'currentTime', video_1_currentTime_binding)); 1591 binding_callbacks$1.push(() => bind$1(video_1, 'duration', video_1_duration_binding)); 1592 binding_callbacks$1.push(() => bind$1(video_1, 'paused', video_1_paused_binding)); 1593 binding_callbacks$1.push(() => bind$1(video_1, 'node', video_1_node_binding)); 1594 video_1.$on("click", /*play_pause*/ ctx[13]); 1595 video_1.$on("play", /*play_handler*/ ctx[24]); 1596 video_1.$on("pause", /*pause_handler*/ ctx[25]); 1597 video_1.$on("ended", /*handle_end*/ ctx[15]); 1598 const if_block_creators = [create_if_block_1$2, create_if_block_2$2, create_else_block$3]; 1599 const if_blocks = []; 1600 1601 function select_block_type(ctx, dirty) { 1602 if (/*time*/ ctx[7] === /*duration*/ ctx[8]) return 0; 1603 if (/*paused*/ ctx[9]) return 1; 1604 return 2; 1605 } 1606 1607 current_block_type_index = select_block_type(ctx); 1608 if_block0 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 1609 maximise = new Maximise({}); 1610 let if_block1 = /*interactive*/ ctx[5] && create_if_block$3(ctx); 1611 1612 return { 1613 c() { 1614 div4 = element$2("div"); 1615 div0 = element$2("div"); 1616 create_component$3(video_1.$$.fragment); 1617 t0 = space$3(); 1618 div3 = element$2("div"); 1619 div2 = element$2("div"); 1620 span0 = element$2("span"); 1621 if_block0.c(); 1622 t1 = space$3(); 1623 span1 = element$2("span"); 1624 t2 = text$1(t2_value); 1625 t3 = text$1(" / "); 1626 t4 = text$1(t4_value); 1627 t5 = space$3(); 1628 progress = element$2("progress"); 1629 t6 = space$3(); 1630 div1 = element$2("div"); 1631 create_component$3(maximise.$$.fragment); 1632 t7 = space$3(); 1633 if (if_block1) if_block1.c(); 1634 if_block1_anchor = empty$3(); 1635 attr$2(div0, "class", "mirror-wrap svelte-euo1cw"); 1636 toggle_class(div0, "mirror", /*mirror*/ ctx[2]); 1637 attr$2(span0, "role", "button"); 1638 attr$2(span0, "tabindex", "0"); 1639 attr$2(span0, "class", "icon svelte-euo1cw"); 1640 attr$2(span0, "aria-label", "play-pause-replay-button"); 1641 attr$2(span1, "class", "time svelte-euo1cw"); 1642 progress.value = progress_value_value = /*time*/ ctx[7] / /*duration*/ ctx[8] || 0; 1643 attr$2(progress, "class", "svelte-euo1cw"); 1644 attr$2(div1, "role", "button"); 1645 attr$2(div1, "tabindex", "0"); 1646 attr$2(div1, "class", "icon svelte-euo1cw"); 1647 attr$2(div1, "aria-label", "full-screen"); 1648 attr$2(div2, "class", "inner svelte-euo1cw"); 1649 attr$2(div3, "class", "controls svelte-euo1cw"); 1650 attr$2(div4, "class", "wrap svelte-euo1cw"); 1651 }, 1652 m(target, anchor) { 1653 insert$3(target, div4, anchor); 1654 append$2(div4, div0);
1655 mount_component$3(video_1, div0, null); 1656 append$2(div4, t0); 1657 append$2(div4, div3); 1658 append$2(div3, div2); 1659 append$2(div2, span0); 1660 if_blocks[current_block_type_index].m(span0, null); 1661 append$2(div2, t1); 1662 append$2(div2, span1); 1663 append$2(span1, t2); 1664 append$2(span1, t3); 1665 append$2(span1, t4); 1666 append$2(div2, t5); 1667 append$2(div2, progress); 1668 append$2(div2, t6); 1669 append$2(div2, div1); 1670 mount_component$3(maximise, div1, null); 1671 insert$3(target, t7, anchor); 1672 if (if_block1) if_block1.m(target, anchor); 1673 insert$3(target, if_block1_anchor, anchor); 1674 current = true; 1675 1676 if (!mounted) { 1677 dispose = [ 1678 listen(span0, "click", /*play_pause*/ ctx[13]), 1679 listen(span0, "keydown", /*play_pause*/ ctx[13]), 1680 listen(progress, "mousemove", /*handleMove*/ ctx[12]), 1681 listen(progress, "touchmove", prevent_default(/*handleMove*/ ctx[12])), 1682 listen(progress, "click", stop_propagation(prevent_default(/*handle_click*/ ctx[14]))), 1683 listen(div1, "click", /*open_full_screen*/ ctx[17]), 1684 listen(div1, "keypress", /*open_full_screen*/ ctx[17]) 1685 ]; 1686 1687 mounted = true; 1688 } 1689 }, 1690 p(ctx, [dirty]) { 1691 const video_1_changes = {}; 1692 if (dirty & /*src*/ 1) video_1_changes.src = /*src*/ ctx[0]; 1693 if (dirty & /*autoplay*/ 8) video_1_changes.autoplay = /*autoplay*/ ctx[3]; 1694 if (dirty & /*label*/ 16) video_1_changes["data-testid"] = `${/*label*/ ctx[4]}-player`; 1695 if (dirty & /*processingVideo*/ 2048) video_1_changes.processingVideo = /*processingVideo*/ ctx[11]; 1696 1697 if (dirty & /*$$scope, subtitle*/ 268435458) { 1698 video_1_changes.$$scope = { dirty, ctx }; 1699 } 1700 1701 if (!updating_currentTime && dirty & /*time*/ 128) { 1702 updating_currentTime = true; 1703 video_1_changes.currentTime = /*time*/ ctx[7]; 1704 add_flush_callback$1(() => updating_currentTime = false); 1705 } 1706 1707 if (!updating_duration && dirty & /*duration*/ 256) { 1708 updating_duration = true; 1709 video_1_changes.duration = /*duration*/ ctx[8]; 1710 add_flush_callback$1(() => updating_duration = false); 1711 } 1712 1713 if (!updating_paused && dirty & /*paused*/ 512) { 1714 updating_paused = true; 1715 video_1_changes.paused = /*paused*/ ctx[9]; 1716 add_flush_callback$1(() => updating_paused = false); 1717 } 1718 1719 if (!updating_node && dirty & /*video*/ 1024) { 1720 updating_node = true; 1721 video_1_changes.node = /*video*/ ctx[10]; 1722 add_flush_callback$1(() => updating_node = false); 1723 } 1724 1725 video_1.$set(video_1_changes); 1726 1727 if (!current || dirty & /*mirror*/ 4) { 1728 toggle_class(div0, "mirror", /*mirror*/ ctx[2]); 1729 } 1730 1731 let previous_block_index = current_block_type_index; 1732 current_block_type_index = select_block_type(ctx); 1733 1734 if (current_block_type_index !== previous_block_index) { 1735 group_outros$3(); 1736 1737 transition_out$3(if_blocks[previous_block_index], 1, 1, () => { 1738 if_blocks[previous_block_index] = null; 1739 }); 1740 1741 check_outros$3(); 1742 if_block0 = if_blocks[current_block_type_index]; 1743 1744 if (!if_block0) { 1745 if_block0 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 1746 if_block0.c(); 1747 } 1748 1749 transition_in$3(if_block0, 1); 1750 if_block0.m(span0, null); 1751 } 1752 1753 if ((!current || dirty & /*time*/ 128) && t2_value !== (t2_value = format(/*time*/ ctx[7]) + "")) set_data$1(t2, t2_value); 1754 if ((!current || dirty & /*duration*/ 256) && t4_value !== (t4_value = format(/*duration*/ ctx[8]) + "")) set_data$1(t4, t4_value); 1755 1756 if (!current || dirty & /*time, duration*/ 384 && progress_value_value !== (progress_value_value = /*time*/ ctx[7] / /*duration*/ ctx[8] || 0)) { 1757 progress.value = progress_value_value; 1758 } 1759 1760 if (/*interactive*/ ctx[5]) { 1761 if (if_block1) { 1762 if_block1.p(ctx, dirty); 1763 1764 if (dirty & /*interactive*/ 32) { 1765 transition_in$3(if_block1, 1); 1766 } 1767 } else { 1768 if_block1 = create_if_block$3(ctx); 1769 if_block1.c(); 1770 transition_in$3(if_block1, 1); 1771 if_block1.m(if_block1_anchor.parentNode, if_block1_anchor); 1772 } 1773 } else if (if_block1) { 1774 group_outros$3(); 1775 1776 transition_out$3(if_block1, 1, 1, () => { 1777 if_block1 = null; 1778 }); 1779 1780 check_outros$3(); 1781 } 1782 }, 1783 i(local) { 1784 if (current) return; 1785 transition_in$3(video_1.$$.fragment, local); 1786 transition_in$3(if_block0); 1787 transition_in$3(maximise.$$.fragment, local); 1788 transition_in$3(if_block1); 1789 current = true; 1790 }, 1791 o(local) { 1792 transition_out$3(video_1.$$.fragment, local); 1793 transition_out$3(if_block0); 1794 transition_out$3(maximise.$$.fragment, local); 1795 transition_out$3(if_block1); 1796 current = false;
1797 }, 1798 d(detaching) { 1799 if (detaching) { 1800 detach$3(div4); 1801 detach$3(t7); 1802 detach$3(if_block1_anchor); 1803 } 1804 1805 destroy_component$3(video_1); 1806 if_blocks[current_block_type_index].d(); 1807 destroy_component$3(maximise); 1808 if (if_block1) if_block1.d(detaching); 1809 mounted = false; 1810 run_all(dispose); 1811 } 1812 }; 1813} 1814 1815function format(seconds) { 1816 if (isNaN(seconds) || !isFinite(seconds)) return "..."; 1817 const minutes = Math.floor(seconds / 60); 1818 let _seconds = Math.floor(seconds % 60); 1819 if (_seconds < 10) _seconds = `0${_seconds}`; 1820 return `${minutes}:${_seconds}`; 1821} 1822 1823function instance$3($$self, $$props, $$invalidate) { 1824 let { root = "" } = $$props; 1825 let { src } = $$props; 1826 let { subtitle = null } = $$props; 1827 let { mirror } = $$props; 1828 let { autoplay } = $$props; 1829 let { label = "test" } = $$props; 1830 let { interactive = false } = $$props; 1831 1832 let { handle_change = () => { 1833 1834 } } = $$props; 1835 1836 let { handle_reset_value = () => { 1837 1838 } } = $$props; 1839 1840 const dispatch = createEventDispatcher$2(); 1841 let time = 0; 1842 let duration; 1843 let paused = true; 1844 let video; 1845 let processingVideo = false; 1846 1847 function handleMove(e) { 1848 if (!duration) return; 1849 1850 if (e.type === "click") { 1851 handle_click(e); 1852 return; 1853 } 1854 1855 if (e.type !== "touchmove" && !(e.buttons & 1)) return; 1856 1857 const clientX = e.type === "touchmove" 1858 ? e.touches[0].clientX 1859 : e.clientX; 1860 1861 const { left, right } = e.currentTarget.getBoundingClientRect(); 1862 $$invalidate(7, time = duration * (clientX - left) / (right - left)); 1863 } 1864 1865 async function play_pause() { 1866 if (document.fullscreenElement != video) { 1867 const isPlaying = video.currentTime > 0 && !video.paused && !video.ended && video.readyState > video.HAVE_CURRENT_DATA; 1868 1869 if (!isPlaying) { 1870 await video.play(); 1871 } else video.pause(); 1872 } 1873 } 1874 1875 function handle_click(e) { 1876 const { left, right } = e.currentTarget.getBoundingClientRect(); 1877 $$invalidate(7, time = duration * (e.clientX - left) / (right - left)); 1878 } 1879 1880 function handle_end() { 1881 dispatch("stop"); 1882 dispatch("end"); 1883 } 1884 1885 const handle_trim_video = async videoBlob => { 1886 let _video_blob = new File([videoBlob], "video.mp4"); 1887 const val = await prepare_files([_video_blob]); 1888 let value = (await upload(val, root))?.filter(Boolean)[0]; 1889 handle_change(value); 1890 }; 1891 1892 function open_full_screen() { 1893 video.requestFullscreen(); 1894 } 1895 1896 function video_1_currentTime_binding(value) { 1897 time = value; 1898 $$invalidate(7, time); 1899 } 1900 1901 function video_1_duration_binding(value) { 1902 duration = value; 1903 $$invalidate(8, duration); 1904 } 1905 1906 function video_1_paused_binding(value) { 1907 paused = value; 1908 $$invalidate(9, paused); 1909 } 1910 1911 function video_1_node_binding(value) { 1912 video = value; 1913 $$invalidate(10, video); 1914 } 1915 1916 function play_handler(event) { 1917 bubble$2.call(this, $$self, event); 1918 } 1919 1920 function pause_handler(event) { 1921 bubble$2.call(this, $$self, event); 1922 } 1923 1924 function videocontrols_processingVideo_binding(value) { 1925 processingVideo = value; 1926 $$invalidate(11, processingVideo); 1927 } 1928 1929 $$self.$$set = $$props => {
1930 if ('root' in $$props) $$invalidate(18, root = $$props.root); 1931 if ('src' in $$props) $$invalidate(0, src = $$props.src); 1932 if ('subtitle' in $$props) $$invalidate(1, subtitle = $$props.subtitle); 1933 if ('mirror' in $$props) $$invalidate(2, mirror = $$props.mirror); 1934 if ('autoplay' in $$props) $$invalidate(3, autoplay = $$props.autoplay); 1935 if ('label' in $$props) $$invalidate(4, label = $$props.label); 1936 if ('interactive' in $$props) $$invalidate(5, interactive = $$props.interactive); 1937 if ('handle_change' in $$props) $$invalidate(19, handle_change = $$props.handle_change); 1938 if ('handle_reset_value' in $$props) $$invalidate(6, handle_reset_value = $$props.handle_reset_value); 1939 }; 1940 1941 return [ 1942 src, 1943 subtitle, 1944 mirror, 1945 autoplay, 1946 label, 1947 interactive, 1948 handle_reset_value, 1949 time, 1950 duration, 1951 paused, 1952 video, 1953 processingVideo, 1954 handleMove, 1955 play_pause, 1956 handle_click, 1957 handle_end, 1958 handle_trim_video, 1959 open_full_screen, 1960 root, 1961 handle_change, 1962 video_1_currentTime_binding, 1963 video_1_duration_binding, 1964 video_1_paused_binding, 1965 video_1_node_binding, 1966 play_handler, 1967 pause_handler, 1968 videocontrols_processingVideo_binding 1969 ]; 1970} 1971 1972class Player extends SvelteComponent$3 { 1973 constructor(options) { 1974 super(); 1975 1976 init$3(this, options, instance$3, create_fragment$3, safe_not_equal$3, { 1977 root: 18, 1978 src: 0, 1979 subtitle: 1, 1980 mirror: 2, 1981 autoplay: 3, 1982 label: 4, 1983 interactive: 5, 1984 handle_change: 19, 1985 handle_reset_value: 6 1986 }); 1987 } 1988} 1989 1990const Player$1 = Player; 1991 1992const InteractiveVideo_svelte_svelte_type_style_lang = ''; 1993 1994/* home/runner/work/gradio/gradio/js/video/shared/InteractiveVideo.svelte generated by Svelte v4.2.2 */ 1995const { 1996 SvelteComponent: SvelteComponent$2, 1997 add_flush_callback, 1998 append: append$1, 1999 attr: attr$1, 2000 bind, 2001 binding_callbacks, 2002 bubble: bubble$1, 2003 check_outros: check_outros$2, 2004 create_component: create_component$2, 2005 create_slot, 2006 destroy_component: destroy_component$2, 2007 detach: detach$2, 2008 element: element$1, 2009 empty: empty$2, 2010 get_all_dirty_from_scope, 2011 get_slot_changes, 2012 group_outros: group_outros$2, 2013 init: init$2, 2014 insert: insert$2, 2015 mount_component: mount_component$2, 2016 noop: noop$1, 2017 safe_not_equal: safe_not_equal$2, 2018 set_data, 2019 space: space$2, 2020 text, 2021 transition_in: transition_in$2, 2022 transition_out: transition_out$2, 2023 update_slot_base 2024} = window.__gradio__svelte__internal; 2025const { createEventDispatcher: createEventDispatcher$1 } = window.__gradio__svelte__internal; 2026function create_else_block$2(ctx) { 2027 let modifyupload; 2028 let t; 2029 let show_if; 2030 let current_block_type_index; 2031 let if_block; 2032 let if_block_anchor; 2033 let current; 2034 2035 modifyupload = new ModifyUpload({ 2036 props: { 2037 i18n: /*i18n*/ ctx[11], 2038 download: /*show_download_button*/ ctx[5] 2039 ? /*value*/ ctx[0].url 2040 : null 2041 } 2042 }); 2043 2044 modifyupload.$on("clear", /*handle_clear*/ ctx[16]); 2045 const if_block_creators = [create_if_block_3, create_if_block_4]; 2046 const if_blocks = []; 2047 2048 function select_block_type_2(ctx, dirty) { 2049 if (show_if == null) show_if = !!playable(); 2050 if (show_if) return 0; 2051 if (/*value*/ ctx[0].size) return 1; 2052 return -1; 2053 } 2054 2055 if (~(current_block_type_index = select_block_type_2(ctx))) { 2056 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 2057 } 2058 2059 return { 2060 c() { 2061 create_component$2(modifyupload.$$.fragment); 2062 t = space$2(); 2063 if (if_block) if_block.c(); 2064 if_block_anchor = empty$2(); 2065 }, 2066 m(target, anchor) { 2067 mount_component$2(modifyupload, target, anchor); 2068 insert$2(target, t, anchor); 2069 2070 if (~current_block_type_index) { 2071 if_blocks[current_block_type_index].m(target, anchor); 2072 } 2073 2074 insert$2(target, if_block_anchor, anchor); 2075 current = true; 2076 }, 2077 p(ctx, dirty) { 2078 const modifyupload_changes = {}; 2079 if (dirty & /*i18n*/ 2048) modifyupload_changes.i18n = /*i18n*/ ctx[11]; 2080 2081 if (dirty & /*show_download_button, value*/ 33) modifyupload_changes.download = /*show_download_button*/ ctx[5] 2082 ? /*value*/ ctx[0].url 2083 : null; 2084 2085 modifyupload.$set(modifyupload_changes); 2086 let previous_block_index = current_block_type_index; 2087 current_block_type_index = select_block_type_2(ctx); 2088 2089 if (current_block_type_index === previous_block_index) { 2090 if (~current_block_type_index) { 2091 if_blocks[current_block_type_index].p(ctx, dirty); 2092 } 2093 } else { 2094 if (if_block) { 2095 group_outros$2(); 2096 2097 transition_out$2(if_blocks[previous_block_index], 1, 1, () => { 2098 if_blocks[previous_block_index] = null; 2099 }); 2100 2101 check_outros$2(); 2102 } 2103 2104 if (~current_block_type_index) { 2105 if_block = if_blocks[current_block_type_index]; 2106 2107 if (!if_block) { 2108 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 2109 if_block.c(); 2110 } else { 2111 if_block.p(ctx, dirty); 2112 } 2113 2114 transition_in$2(if_block, 1); 2115 if_block.m(if_block_anchor.parentNode, if_block_anchor); 2116 } else { 2117 if_block = null; 2118 } 2119 } 2120 }, 2121 i(local) { 2122 if (current) return; 2123 transition_in$2(modifyupload.$$.fragment, local); 2124 transition_in$2(if_block); 2125 current = true; 2126 }, 2127 o(local) { 2128 transition_out$2(modifyupload.$$.fragment, local); 2129 transition_out$2(if_block); 2130 current = false;
2131 }, 2132 d(detaching) { 2133 if (detaching) { 2134 detach$2(t); 2135 detach$2(if_block_anchor); 2136 } 2137 2138 destroy_component$2(modifyupload, detaching); 2139 2140 if (~current_block_type_index) { 2141 if_blocks[current_block_type_index].d(detaching); 2142 } 2143 } 2144 }; 2145} 2146 2147// (45:1) {#if value === null || value.url === undefined} 2148function create_if_block$2(ctx) { 2149 let div; 2150 let current_block_type_index; 2151 let if_block; 2152 let current; 2153 const if_block_creators = [create_if_block_1$1, create_if_block_2$1]; 2154 const if_blocks = []; 2155 2156 function select_block_type_1(ctx, dirty) { 2157 if (/*active_source*/ ctx[1] === "upload") return 0; 2158 if (/*active_source*/ ctx[1] === "webcam") return 1; 2159 return -1; 2160 } 2161 2162 if (~(current_block_type_index = select_block_type_1(ctx))) { 2163 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 2164 } 2165 2166 return { 2167 c() { 2168 div = element$1("div"); 2169 if (if_block) if_block.c(); 2170 attr$1(div, "class", "upload-container svelte-1cs6pot"); 2171 }, 2172 m(target, anchor) { 2173 insert$2(target, div, anchor); 2174 2175 if (~current_block_type_index) { 2176 if_blocks[current_block_type_index].m(div, null); 2177 } 2178 2179 current = true; 2180 }, 2181 p(ctx, dirty) { 2182 let previous_block_index = current_block_type_index; 2183 current_block_type_index = select_block_type_1(ctx); 2184 2185 if (current_block_type_index === previous_block_index) { 2186 if (~current_block_type_index) { 2187 if_blocks[current_block_type_index].p(ctx, dirty); 2188 } 2189 } else { 2190 if (if_block) { 2191 group_outros$2(); 2192 2193 transition_out$2(if_blocks[previous_block_index], 1, 1, () => { 2194 if_blocks[previous_block_index] = null; 2195 }); 2196 2197 check_outros$2(); 2198 } 2199 2200 if (~current_block_type_index) { 2201 if_block = if_blocks[current_block_type_index]; 2202 2203 if (!if_block) { 2204 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 2205 if_block.c(); 2206 } else { 2207 if_block.p(ctx, dirty); 2208 } 2209 2210 transition_in$2(if_block, 1); 2211 if_block.m(div, null); 2212 } else { 2213 if_block = null; 2214 } 2215 } 2216 }, 2217 i(local) { 2218 if (current) return; 2219 transition_in$2(if_block); 2220 current = true; 2221 }, 2222 o(local) { 2223 transition_out$2(if_block); 2224 current = false; 2225 }, 2226 d(detaching) { 2227 if (detaching) { 2228 detach$2(div); 2229 } 2230 2231 if (~current_block_type_index) { 2232 if_blocks[current_block_type_index].d(); 2233 } 2234 } 2235 }; 2236} 2237 2238// (95:23) 2239function create_if_block_4(ctx) { 2240 let div0; 2241 let t0_value = (/*value*/ ctx[0].orig_name || /*value*/ ctx[0].url) + ""; 2242 let t0; 2243 let t1; 2244 let div1; 2245 let t2_value = prettyBytes(/*value*/ ctx[0].size) + ""; 2246 let t2; 2247 2248 return { 2249 c() { 2250 div0 = element$1("div"); 2251 t0 = text(t0_value); 2252 t1 = space$2(); 2253 div1 = element$1("div"); 2254 t2 = text(t2_value); 2255 attr$1(div0, "class", "file-name svelte-1cs6pot"); 2256 attr$1(div1, "class", "file-size svelte-1cs6pot"); 2257 }, 2258 m(target, anchor) { 2259 insert$2(target, div0, anchor); 2260 append$1(div0, t0); 2261 insert$2(target, t1, anchor); 2262 insert$2(target, div1, anchor); 2263 append$1(div1, t2); 2264 }, 2265 p(ctx, dirty) { 2266 if (dirty & /*value*/ 1 && t0_value !== (t0_value = (/*value*/ ctx[0].orig_name || /*value*/ ctx[0].url) + "")) set_data(t0, t0_value); 2267 if (dirty & /*value*/ 1 && t2_value !== (t2_value = prettyBytes(/*value*/ ctx[0].size) + "")) set_data(t2, t2_value); 2268 }, 2269 i: noop$1, 2270 o: noop$1, 2271 d(detaching) { 2272 if (detaching) { 2273 detach$2(div0); 2274 detach$2(t1); 2275 detach$2(div1); 2276 } 2277 } 2278 }; 2279} 2280 2281// (77:2) {#if playable()} 2282function create_if_block_3(ctx) { 2283 let previous_key = /*value*/ ctx[0]?.url; 2284 let key_block_anchor; 2285 let current; 2286 let key_block = create_key_block$1(ctx); 2287 2288 return { 2289 c() { 2290 key_block.c(); 2291 key_block_anchor = empty$2(); 2292 }, 2293 m(target, anchor) { 2294 key_block.m(target, anchor); 2295 insert$2(target, key_block_anchor, anchor); 2296 current = true; 2297 }, 2298 p(ctx, dirty) { 2299 if (dirty & /*value*/ 1 && safe_not_equal$2(previous_key, previous_key = /*value*/ ctx[0]?.url)) { 2300 group_outros$2(); 2301 transition_out$2(key_block, 1, 1, noop$1); 2302 check_outros$2(); 2303 key_block = create_key_block$1(ctx); 2304 key_block.c(); 2305 transition_in$2(key_block, 1); 2306 key_block.m(key_block_anchor.parentNode, key_block_anchor); 2307 } else { 2308 key_block.p(ctx, dirty); 2309 } 2310 }, 2311 i(local) { 2312 if (current) return; 2313 transition_in$2(key_block); 2314 current = true; 2315 }, 2316 o(local) { 2317 transition_out$2(key_block); 2318 current = false;
2319 }, 2320 d(detaching) { 2321 if (detaching) { 2322 detach$2(key_block_anchor); 2323 } 2324 2325 key_block.d(detaching); 2326 } 2327 }; 2328} 2329 2330// (78:3) {#key value?.url} 2331function create_key_block$1(ctx) { 2332 let player; 2333 let current; 2334 2335 player = new Player$1({ 2336 props: { 2337 root: /*root*/ ctx[10], 2338 interactive: true, 2339 autoplay: /*autoplay*/ ctx[9], 2340 src: /*value*/ ctx[0].url, 2341 subtitle: /*subtitle*/ ctx[2]?.url, 2342 mirror: /*mirror_webcam*/ ctx[7] && /*active_source*/ ctx[1] === "webcam", 2343 label: /*label*/ ctx[4], 2344 handle_change: /*handle_change*/ ctx[17], 2345 handle_reset_value: /*handle_reset_value*/ ctx[12] 2346 } 2347 }); 2348 2349 player.$on("play", /*play_handler*/ ctx[25]); 2350 player.$on("pause", /*pause_handler*/ ctx[26]); 2351 player.$on("stop", /*stop_handler*/ ctx[27]); 2352 player.$on("end", /*end_handler*/ ctx[28]); 2353 2354 return { 2355 c() { 2356 create_component$2(player.$$.fragment); 2357 }, 2358 m(target, anchor) { 2359 mount_component$2(player, target, anchor); 2360 current = true; 2361 }, 2362 p(ctx, dirty) { 2363 const player_changes = {}; 2364 if (dirty & /*root*/ 1024) player_changes.root = /*root*/ ctx[10]; 2365 if (dirty & /*autoplay*/ 512) player_changes.autoplay = /*autoplay*/ ctx[9]; 2366 if (dirty & /*value*/ 1) player_changes.src = /*value*/ ctx[0].url; 2367 if (dirty & /*subtitle*/ 4) player_changes.subtitle = /*subtitle*/ ctx[2]?.url; 2368 if (dirty & /*mirror_webcam, active_source*/ 130) player_changes.mirror = /*mirror_webcam*/ ctx[7] && /*active_source*/ ctx[1] === "webcam"; 2369 if (dirty & /*label*/ 16) player_changes.label = /*label*/ ctx[4]; 2370 if (dirty & /*handle_reset_value*/ 4096) player_changes.handle_reset_value = /*handle_reset_value*/ ctx[12]; 2371 player.$set(player_changes); 2372 }, 2373 i(local) { 2374 if (current) return; 2375 transition_in$2(player.$$.fragment, local); 2376 current = true; 2377 }, 2378 o(local) { 2379 transition_out$2(player.$$.fragment, local); 2380 current = false; 2381 }, 2382 d(detaching) { 2383 destroy_component$2(player, detaching); 2384 } 2385 }; 2386} 2387 2388// (57:40) 2389function create_if_block_2$1(ctx) { 2390 let webcam; 2391 let current; 2392 2393 webcam = new Webcam({ 2394 props: { 2395 root: /*root*/ ctx[10], 2396 mirror_webcam: /*mirror_webcam*/ ctx[7], 2397 include_audio: /*include_audio*/ ctx[8], 2398 mode: "video", 2399 i18n: /*i18n*/ ctx[11] 2400 } 2401 }); 2402 2403 webcam.$on("error", /*error_handler*/ ctx[22]); 2404 webcam.$on("capture", /*handle_capture*/ ctx[18]); 2405 webcam.$on("start_recording", /*start_recording_handler*/ ctx[23]); 2406 webcam.$on("stop_recording", /*stop_recording_handler*/ ctx[24]); 2407 2408 return { 2409 c() { 2410 create_component$2(webcam.$$.fragment); 2411 }, 2412 m(target, anchor) { 2413 mount_component$2(webcam, target, anchor); 2414 current = true; 2415 }, 2416 p(ctx, dirty) { 2417 const webcam_changes = {}; 2418 if (dirty & /*root*/ 1024) webcam_changes.root = /*root*/ ctx[10]; 2419 if (dirty & /*mirror_webcam*/ 128) webcam_changes.mirror_webcam = /*mirror_webcam*/ ctx[7]; 2420 if (dirty & /*include_audio*/ 256) webcam_changes.include_audio = /*include_audio*/ ctx[8]; 2421 if (dirty & /*i18n*/ 2048) webcam_changes.i18n = /*i18n*/ ctx[11]; 2422 webcam.$set(webcam_changes); 2423 }, 2424 i(local) { 2425 if (current) return; 2426 transition_in$2(webcam.$$.fragment, local); 2427 current = true; 2428 }, 2429 o(local) { 2430 transition_out$2(webcam.$$.fragment, local); 2431 current = false; 2432 }, 2433 d(detaching) { 2434 destroy_component$2(webcam, detaching); 2435 } 2436 }; 2437} 2438 2439// (47:3) {#if active_source === "upload"} 2440function create_if_block_1$1(ctx) { 2441 let upload; 2442 let updating_dragging; 2443 let current; 2444 2445 function upload_dragging_binding(value) { 2446 /*upload_dragging_binding*/ ctx[20](value); 2447 } 2448 2449 let upload_props = { 2450 filetype: "video/x-m4v,video/*", 2451 root: /*root*/ ctx[10], 2452 $$slots: { default: [create_default_slot$2] }, 2453 $$scope: { ctx } 2454 }; 2455 2456 if (/*dragging*/ ctx[13] !== void 0) { 2457 upload_props.dragging = /*dragging*/ ctx[13]; 2458 } 2459 2460 upload = new Upload({ props: upload_props }); 2461 binding_callbacks.push(() => bind(upload, 'dragging', upload_dragging_binding)); 2462 upload.$on("load", /*handle_load*/ ctx[15]); 2463 upload.$on("error", /*error_handler_1*/ ctx[21]); 2464 2465 return { 2466 c() { 2467 create_component$2(upload.$$.fragment); 2468 }, 2469 m(target, anchor) { 2470 mount_component$2(upload, target, anchor); 2471 current = true; 2472 }, 2473 p(ctx, dirty) { 2474 const upload_changes = {};
2475 if (dirty & /*root*/ 1024) upload_changes.root = /*root*/ ctx[10]; 2476 2477 if (dirty & /*$$scope*/ 1073741824) { 2478 upload_changes.$$scope = { dirty, ctx }; 2479 } 2480 2481 if (!updating_dragging && dirty & /*dragging*/ 8192) { 2482 updating_dragging = true; 2483 upload_changes.dragging = /*dragging*/ ctx[13]; 2484 add_flush_callback(() => updating_dragging = false); 2485 } 2486 2487 upload.$set(upload_changes); 2488 }, 2489 i(local) { 2490 if (current) return; 2491 transition_in$2(upload.$$.fragment, local); 2492 current = true; 2493 }, 2494 o(local) { 2495 transition_out$2(upload.$$.fragment, local); 2496 current = false; 2497 }, 2498 d(detaching) { 2499 destroy_component$2(upload, detaching); 2500 } 2501 }; 2502} 2503 2504// (48:4) <Upload bind:dragging filetype="video/x-m4v,video/*" on:load={handle_load} on:error={({ detail }) => dispatch("error", detail)} {root} > 2505function create_default_slot$2(ctx) { 2506 let current; 2507 const default_slot_template = /*#slots*/ ctx[19].default; 2508 const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[30], null); 2509 2510 return { 2511 c() { 2512 if (default_slot) default_slot.c(); 2513 }, 2514 m(target, anchor) { 2515 if (default_slot) { 2516 default_slot.m(target, anchor); 2517 } 2518 2519 current = true; 2520 }, 2521 p(ctx, dirty) { 2522 if (default_slot) { 2523 if (default_slot.p && (!current || dirty & /*$$scope*/ 1073741824)) { 2524 update_slot_base( 2525 default_slot, 2526 default_slot_template, 2527 ctx, 2528 /*$$scope*/ ctx[30], 2529 !current 2530 ? get_all_dirty_from_scope(/*$$scope*/ ctx[30]) 2531 : get_slot_changes(default_slot_template, /*$$scope*/ ctx[30], dirty, null), 2532 null 2533 ); 2534 } 2535 } 2536 }, 2537 i(local) { 2538 if (current) return; 2539 transition_in$2(default_slot, local); 2540 current = true; 2541 }, 2542 o(local) { 2543 transition_out$2(default_slot, local); 2544 current = false; 2545 }, 2546 d(detaching) { 2547 if (default_slot) default_slot.d(detaching); 2548 } 2549 }; 2550} 2551 2552function create_fragment$2(ctx) { 2553 let blocklabel; 2554 let t0; 2555 let div; 2556 let current_block_type_index; 2557 let if_block; 2558 let t1; 2559 let selectsource; 2560 let updating_active_source; 2561 let current; 2562 2563 blocklabel = new BlockLabel({ 2564 props: { 2565 show_label: /*show_label*/ ctx[6], 2566 Icon: Video$1, 2567 label: /*label*/ ctx[4] || "Video" 2568 } 2569 }); 2570 2571 const if_block_creators = [create_if_block$2, create_else_block$2]; 2572 const if_blocks = []; 2573 2574 function select_block_type(ctx, dirty) { 2575 if (/*value*/ ctx[0] === null || /*value*/ ctx[0].url === undefined) return 0; 2576 return 1; 2577 } 2578 2579 current_block_type_index = select_block_type(ctx); 2580 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 2581 2582 function selectsource_active_source_binding(value) { 2583 /*selectsource_active_source_binding*/ ctx[29](value); 2584 } 2585 2586 let selectsource_props = { 2587 sources: /*sources*/ ctx[3], 2588 handle_clear: /*handle_clear*/ ctx[16] 2589 }; 2590 2591 if (/*active_source*/ ctx[1] !== void 0) { 2592 selectsource_props.active_source = /*active_source*/ ctx[1]; 2593 } 2594 2595 selectsource = new SelectSource({ props: selectsource_props }); 2596 binding_callbacks.push(() => bind(selectsource, 'active_source', selectsource_active_source_binding)); 2597 2598 return { 2599 c() { 2600 create_component$2(blocklabel.$$.fragment); 2601 t0 = space$2(); 2602 div = element$1("div"); 2603 if_block.c(); 2604 t1 = space$2(); 2605 create_component$2(selectsource.$$.fragment); 2606 attr$1(div, "data-testid", "video"); 2607 attr$1(div, "class", "video-container svelte-1cs6pot"); 2608 }, 2609 m(target, anchor) { 2610 mount_component$2(blocklabel, target, anchor); 2611 insert$2(target, t0, anchor); 2612 insert$2(target, div, anchor); 2613 if_blocks[current_block_type_index].m(div, null); 2614 append$1(div, t1);
2615 mount_component$2(selectsource, div, null); 2616 current = true; 2617 }, 2618 p(ctx, [dirty]) { 2619 const blocklabel_changes = {}; 2620 if (dirty & /*show_label*/ 64) blocklabel_changes.show_label = /*show_label*/ ctx[6]; 2621 if (dirty & /*label*/ 16) blocklabel_changes.label = /*label*/ ctx[4] || "Video"; 2622 blocklabel.$set(blocklabel_changes); 2623 let previous_block_index = current_block_type_index; 2624 current_block_type_index = select_block_type(ctx); 2625 2626 if (current_block_type_index === previous_block_index) { 2627 if_blocks[current_block_type_index].p(ctx, dirty); 2628 } else { 2629 group_outros$2(); 2630 2631 transition_out$2(if_blocks[previous_block_index], 1, 1, () => { 2632 if_blocks[previous_block_index] = null; 2633 }); 2634 2635 check_outros$2(); 2636 if_block = if_blocks[current_block_type_index]; 2637 2638 if (!if_block) { 2639 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 2640 if_block.c(); 2641 } else { 2642 if_block.p(ctx, dirty); 2643 } 2644 2645 transition_in$2(if_block, 1); 2646 if_block.m(div, t1); 2647 } 2648 2649 const selectsource_changes = {}; 2650 if (dirty & /*sources*/ 8) selectsource_changes.sources = /*sources*/ ctx[3]; 2651 2652 if (!updating_active_source && dirty & /*active_source*/ 2) { 2653 updating_active_source = true; 2654 selectsource_changes.active_source = /*active_source*/ ctx[1]; 2655 add_flush_callback(() => updating_active_source = false); 2656 } 2657 2658 selectsource.$set(selectsource_changes); 2659 }, 2660 i(local) { 2661 if (current) return; 2662 transition_in$2(blocklabel.$$.fragment, local); 2663 transition_in$2(if_block); 2664 transition_in$2(selectsource.$$.fragment, local); 2665 current = true; 2666 }, 2667 o(local) { 2668 transition_out$2(blocklabel.$$.fragment, local); 2669 transition_out$2(if_block); 2670 transition_out$2(selectsource.$$.fragment, local); 2671 current = false; 2672 }, 2673 d(detaching) { 2674 if (detaching) { 2675 detach$2(t0); 2676 detach$2(div); 2677 } 2678 2679 destroy_component$2(blocklabel, detaching); 2680 if_blocks[current_block_type_index].d(); 2681 destroy_component$2(selectsource); 2682 } 2683 }; 2684} 2685 2686function instance$2($$self, $$props, $$invalidate) { 2687 let { $$slots: slots = {}, $$scope } = $$props; 2688 let { value = null } = $$props; 2689 let { subtitle = null } = $$props; 2690 let { sources = ["webcam", "upload"] } = $$props; 2691 let { label = undefined } = $$props; 2692 let { show_download_button = false } = $$props; 2693 let { show_label = true } = $$props; 2694 let { mirror_webcam = false } = $$props; 2695 let { include_audio } = $$props; 2696 let { autoplay } = $$props; 2697 let { root } = $$props; 2698 let { i18n } = $$props; 2699 let { active_source = "webcam" } = $$props; 2700 2701 let { handle_reset_value = () => { 2702 2703 } } = $$props; 2704 2705 const dispatch = createEventDispatcher$1(); 2706 2707 function handle_load({ detail }) { 2708 $$invalidate(0, value = detail); 2709 dispatch("change", detail); 2710 dispatch("upload", detail); 2711 } 2712 2713 function handle_clear() { 2714 $$invalidate(0, value = null); 2715 dispatch("change", null); 2716 dispatch("clear"); 2717 } 2718 2719 function handle_change(video) { 2720 dispatch("change", video); 2721 } 2722 2723 function handle_capture({ detail }) { 2724 dispatch("change", detail); 2725 } 2726 2727 let dragging = false; 2728 2729 function upload_dragging_binding(value) { 2730 dragging = value; 2731 $$invalidate(13, dragging); 2732 } 2733 2734 const error_handler_1 = ({ detail }) => dispatch("error", detail); 2735 2736 function error_handler(event) { 2737 bubble$1.call(this, $$self, event); 2738 } 2739 2740 function start_recording_handler(event) { 2741 bubble$1.call(this, $$self, event); 2742 } 2743 2744 function stop_recording_handler(event) { 2745 bubble$1.call(this, $$self, event); 2746 } 2747 2748 function play_handler(event) { 2749 bubble$1.call(this, $$self, event); 2750 } 2751 2752 function pause_handler(event) { 2753 bubble$1.call(this, $$self, event); 2754 } 2755 2756 function stop_handler(event) { 2757 bubble$1.call(this, $$self, event); 2758 } 2759 2760 function end_handler(event) { 2761 bubble$1.call(this, $$self, event); 2762 } 2763 2764 function selectsource_active_source_binding(value) { 2765 active_source = value; 2766 $$invalidate(1, active_source); 2767 } 2768 2769 $$self.$$set = $$props => {
2770 if ('value' in $$props) $$invalidate(0, value = $$props.value); 2771 if ('subtitle' in $$props) $$invalidate(2, subtitle = $$props.subtitle); 2772 if ('sources' in $$props) $$invalidate(3, sources = $$props.sources); 2773 if ('label' in $$props) $$invalidate(4, label = $$props.label); 2774 if ('show_download_button' in $$props) $$invalidate(5, show_download_button = $$props.show_download_button); 2775 if ('show_label' in $$props) $$invalidate(6, show_label = $$props.show_label); 2776 if ('mirror_webcam' in $$props) $$invalidate(7, mirror_webcam = $$props.mirror_webcam); 2777 if ('include_audio' in $$props) $$invalidate(8, include_audio = $$props.include_audio); 2778 if ('autoplay' in $$props) $$invalidate(9, autoplay = $$props.autoplay); 2779 if ('root' in $$props) $$invalidate(10, root = $$props.root); 2780 if ('i18n' in $$props) $$invalidate(11, i18n = $$props.i18n); 2781 if ('active_source' in $$props) $$invalidate(1, active_source = $$props.active_source); 2782 if ('handle_reset_value' in $$props) $$invalidate(12, handle_reset_value = $$props.handle_reset_value);
2783 if ('$$scope' in $$props) $$invalidate(30, $$scope = $$props.$$scope); 2784 }; 2785 2786 $$self.$$.update = () => { 2787 if ($$self.$$.dirty & /*dragging*/ 8192) { 2788 dispatch("drag", dragging); 2789 } 2790 }; 2791 2792 return [ 2793 value, 2794 active_source, 2795 subtitle, 2796 sources, 2797 label, 2798 show_download_button, 2799 show_label, 2800 mirror_webcam, 2801 include_audio, 2802 autoplay, 2803 root, 2804 i18n, 2805 handle_reset_value, 2806 dragging, 2807 dispatch, 2808 handle_load, 2809 handle_clear, 2810 handle_change, 2811 handle_capture, 2812 slots, 2813 upload_dragging_binding, 2814 error_handler_1, 2815 error_handler, 2816 start_recording_handler, 2817 stop_recording_handler, 2818 play_handler, 2819 pause_handler, 2820 stop_handler, 2821 end_handler, 2822 selectsource_active_source_binding, 2823 $$scope 2824 ]; 2825} 2826 2827class InteractiveVideo extends SvelteComponent$2 { 2828 constructor(options) { 2829 super(); 2830 2831 init$2(this, options, instance$2, create_fragment$2, safe_not_equal$2, { 2832 value: 0, 2833 subtitle: 2, 2834 sources: 3, 2835 label: 4, 2836 show_download_button: 5, 2837 show_label: 6, 2838 mirror_webcam: 7, 2839 include_audio: 8, 2840 autoplay: 9, 2841 root: 10, 2842 i18n: 11, 2843 active_source: 1, 2844 handle_reset_value: 12 2845 }); 2846 } 2847} 2848 2849const Video = InteractiveVideo; 2850 2851const VideoPreview_svelte_svelte_type_style_lang = ''; 2852 2853/* home/runner/work/gradio/gradio/js/video/shared/VideoPreview.svelte generated by Svelte v4.2.2 */ 2854const { 2855 SvelteComponent: SvelteComponent$1, 2856 append, 2857 attr, 2858 bubble, 2859 check_outros: check_outros$1, 2860 create_component: create_component$1, 2861 destroy_component: destroy_component$1, 2862 detach: detach$1, 2863 element, 2864 empty: empty$1, 2865 group_outros: group_outros$1, 2866 init: init$1, 2867 insert: insert$1, 2868 mount_component: mount_component$1, 2869 noop, 2870 safe_not_equal: safe_not_equal$1, 2871 space: space$1, 2872 transition_in: transition_in$1, 2873 transition_out: transition_out$1 2874} = window.__gradio__svelte__internal; 2875const { createEventDispatcher, afterUpdate, tick } = window.__gradio__svelte__internal; 2876function create_else_block$1(ctx) { 2877 let previous_key = /*value*/ ctx[0].url; 2878 let t0; 2879 let div; 2880 let t1; 2881 let current; 2882 let key_block = create_key_block(ctx); 2883 let if_block0 = /*show_download_button*/ ctx[6] && create_if_block_2(ctx); 2884 let if_block1 = /*show_share_button*/ ctx[5] && create_if_block_1(ctx); 2885 2886 return { 2887 c() { 2888 key_block.c(); 2889 t0 = space$1(); 2890 div = element("div"); 2891 if (if_block0) if_block0.c(); 2892 t1 = space$1(); 2893 if (if_block1) if_block1.c(); 2894 attr(div, "class", "icon-buttons svelte-rvdo70"); 2895 attr(div, "data-testid", "download-div"); 2896 }, 2897 m(target, anchor) { 2898 key_block.m(target, anchor); 2899 insert$1(target, t0, anchor); 2900 insert$1(target, div, anchor); 2901 if (if_block0) if_block0.m(div, null); 2902 append(div, t1); 2903 if (if_block1) if_block1.m(div, null); 2904 current = true; 2905 }, 2906 p(ctx, dirty) { 2907 if (dirty & /*value*/ 1 && safe_not_equal$1(previous_key, previous_key = /*value*/ ctx[0].url)) { 2908 group_outros$1(); 2909 transition_out$1(key_block, 1, 1, noop); 2910 check_outros$1(); 2911 key_block = create_key_block(ctx); 2912 key_block.c(); 2913 transition_in$1(key_block, 1); 2914 key_block.m(t0.parentNode, t0); 2915 } else { 2916 key_block.p(ctx, dirty); 2917 } 2918 2919 if (/*show_download_button*/ ctx[6]) { 2920 if (if_block0) { 2921 if_block0.p(ctx, dirty); 2922 2923 if (dirty & /*show_download_button*/ 64) { 2924 transition_in$1(if_block0, 1); 2925 } 2926 } else { 2927 if_block0 = create_if_block_2(ctx); 2928 if_block0.c(); 2929 transition_in$1(if_block0, 1); 2930 if_block0.m(div, t1); 2931 } 2932 } else if (if_block0) { 2933 group_outros$1(); 2934 2935 transition_out$1(if_block0, 1, 1, () => { 2936 if_block0 = null; 2937 }); 2938 2939 check_outros$1(); 2940 } 2941 2942 if (/*show_share_button*/ ctx[5]) { 2943 if (if_block1) { 2944 if_block1.p(ctx, dirty); 2945 2946 if (dirty & /*show_share_button*/ 32) { 2947 transition_in$1(if_block1, 1); 2948 } 2949 } else { 2950 if_block1 = create_if_block_1(ctx); 2951 if_block1.c(); 2952 transition_in$1(if_block1, 1); 2953 if_block1.m(div, null); 2954 } 2955 } else if (if_block1) { 2956 group_outros$1(); 2957 2958 transition_out$1(if_block1, 1, 1, () => { 2959 if_block1 = null; 2960 }); 2961 2962 check_outros$1(); 2963 } 2964 }, 2965 i(local) { 2966 if (current) return; 2967 transition_in$1(key_block); 2968 transition_in$1(if_block0); 2969 transition_in$1(if_block1); 2970 current = true; 2971 }, 2972 o(local) { 2973 transition_out$1(key_block); 2974 transition_out$1(if_block0); 2975 transition_out$1(if_block1); 2976 current = false;
2977 }, 2978 d(detaching) { 2979 if (detaching) { 2980 detach$1(t0); 2981 detach$1(div); 2982 } 2983 2984 key_block.d(detaching); 2985 if (if_block0) if_block0.d(); 2986 if (if_block1) if_block1.d(); 2987 } 2988 }; 2989} 2990 2991// (35:0) {#if value === null || value.url === undefined} 2992function create_if_block$1(ctx) { 2993 let empty_1; 2994 let current; 2995 2996 empty_1 = new Empty({ 2997 props: { 2998 unpadded_box: true, 2999 size: "large", 3000 $$slots: { default: [create_default_slot$1] }, 3001 $$scope: { ctx } 3002 } 3003 }); 3004 3005 return { 3006 c() { 3007 create_component$1(empty_1.$$.fragment); 3008 }, 3009 m(target, anchor) { 3010 mount_component$1(empty_1, target, anchor); 3011 current = true; 3012 }, 3013 p(ctx, dirty) { 3014 const empty_1_changes = {}; 3015 3016 if (dirty & /*$$scope*/ 262144) { 3017 empty_1_changes.$$scope = { dirty, ctx }; 3018 } 3019 3020 empty_1.$set(empty_1_changes); 3021 }, 3022 i(local) { 3023 if (current) return; 3024 transition_in$1(empty_1.$$.fragment, local); 3025 current = true; 3026 }, 3027 o(local) { 3028 transition_out$1(empty_1.$$.fragment, local); 3029 current = false; 3030 }, 3031 d(detaching) { 3032 destroy_component$1(empty_1, detaching); 3033 } 3034 }; 3035} 3036 3037// (38:1) {#key value.url} 3038function create_key_block(ctx) { 3039 let player; 3040 let current; 3041 3042 player = new Player$1({ 3043 props: { 3044 src: /*value*/ ctx[0].url, 3045 subtitle: /*subtitle*/ ctx[1]?.url, 3046 autoplay: /*autoplay*/ ctx[4], 3047 mirror: false, 3048 label: /*label*/ ctx[2], 3049 interactive: false 3050 } 3051 }); 3052 3053 player.$on("play", /*play_handler*/ ctx[8]); 3054 player.$on("pause", /*pause_handler*/ ctx[9]); 3055 player.$on("stop", /*stop_handler*/ ctx[10]); 3056 player.$on("end", /*end_handler*/ ctx[11]); 3057 3058 return { 3059 c() { 3060 create_component$1(player.$$.fragment); 3061 }, 3062 m(target, anchor) { 3063 mount_component$1(player, target, anchor); 3064 current = true; 3065 }, 3066 p(ctx, dirty) { 3067 const player_changes = {}; 3068 if (dirty & /*value*/ 1) player_changes.src = /*value*/ ctx[0].url; 3069 if (dirty & /*subtitle*/ 2) player_changes.subtitle = /*subtitle*/ ctx[1]?.url; 3070 if (dirty & /*autoplay*/ 16) player_changes.autoplay = /*autoplay*/ ctx[4]; 3071 if (dirty & /*label*/ 4) player_changes.label = /*label*/ ctx[2]; 3072 player.$set(player_changes); 3073 }, 3074 i(local) { 3075 if (current) return; 3076 transition_in$1(player.$$.fragment, local); 3077 current = true; 3078 }, 3079 o(local) { 3080 transition_out$1(player.$$.fragment, local); 3081 current = false; 3082 }, 3083 d(detaching) { 3084 destroy_component$1(player, detaching); 3085 } 3086 }; 3087} 3088 3089// (53:2) {#if show_download_button} 3090function create_if_block_2(ctx) { 3091 let downloadlink; 3092 let current; 3093 3094 downloadlink = new DownloadLink({ 3095 props: { 3096 href: /*value*/ ctx[0].url, 3097 download: /*value*/ ctx[0].orig_name || /*value*/ ctx[0].path, 3098 $$slots: { default: [create_default_slot_1$1] }, 3099 $$scope: { ctx } 3100 } 3101 }); 3102 3103 return { 3104 c() { 3105 create_component$1(downloadlink.$$.fragment); 3106 }, 3107 m(target, anchor) { 3108 mount_component$1(downloadlink, target, anchor); 3109 current = true; 3110 }, 3111 p(ctx, dirty) { 3112 const downloadlink_changes = {}; 3113 if (dirty & /*value*/ 1) downloadlink_changes.href = /*value*/ ctx[0].url; 3114 if (dirty & /*value*/ 1) downloadlink_changes.download = /*value*/ ctx[0].orig_name || /*value*/ ctx[0].path; 3115 3116 if (dirty & /*$$scope*/ 262144) { 3117 downloadlink_changes.$$scope = { dirty, ctx }; 3118 } 3119 3120 downloadlink.$set(downloadlink_changes); 3121 }, 3122 i(local) { 3123 if (current) return; 3124 transition_in$1(downloadlink.$$.fragment, local); 3125 current = true; 3126 }, 3127 o(local) { 3128 transition_out$1(downloadlink.$$.fragment, local); 3129 current = false; 3130 }, 3131 d(detaching) { 3132 destroy_component$1(downloadlink, detaching); 3133 } 3134 }; 3135} 3136 3137// (54:3) <DownloadLink href={value.url} download={value.orig_name || value.path}> 3138function create_default_slot_1$1(ctx) { 3139 let iconbutton; 3140 let current; 3141 3142 iconbutton = new IconButton({ 3143 props: { Icon: Download, label: "Download" } 3144 }); 3145 3146 return { 3147 c() { 3148 create_component$1(iconbutton.$$.fragment); 3149 }, 3150 m(target, anchor) { 3151 mount_component$1(iconbutton, target, anchor); 3152 current = true; 3153 }, 3154 p: noop, 3155 i(local) { 3156 if (current) return; 3157 transition_in$1(iconbutton.$$.fragment, local); 3158 current = true; 3159 }, 3160 o(local) { 3161 transition_out$1(iconbutton.$$.fragment, local); 3162 current = false;
3163 }, 3164 d(detaching) { 3165 destroy_component$1(iconbutton, detaching); 3166 } 3167 }; 3168} 3169 3170// (58:2) {#if show_share_button} 3171function create_if_block_1(ctx) { 3172 let sharebutton; 3173 let current; 3174 3175 sharebutton = new ShareButton({ 3176 props: { 3177 i18n: /*i18n*/ ctx[7], 3178 value: /*value*/ ctx[0], 3179 formatter: /*func*/ ctx[12] 3180 } 3181 }); 3182 3183 sharebutton.$on("error", /*error_handler*/ ctx[13]); 3184 sharebutton.$on("share", /*share_handler*/ ctx[14]); 3185 3186 return { 3187 c() { 3188 create_component$1(sharebutton.$$.fragment); 3189 }, 3190 m(target, anchor) { 3191 mount_component$1(sharebutton, target, anchor); 3192 current = true; 3193 }, 3194 p(ctx, dirty) { 3195 const sharebutton_changes = {}; 3196 if (dirty & /*i18n*/ 128) sharebutton_changes.i18n = /*i18n*/ ctx[7]; 3197 if (dirty & /*value*/ 1) sharebutton_changes.value = /*value*/ ctx[0]; 3198 sharebutton.$set(sharebutton_changes); 3199 }, 3200 i(local) { 3201 if (current) return; 3202 transition_in$1(sharebutton.$$.fragment, local); 3203 current = true; 3204 }, 3205 o(local) { 3206 transition_out$1(sharebutton.$$.fragment, local); 3207 current = false; 3208 }, 3209 d(detaching) { 3210 destroy_component$1(sharebutton, detaching); 3211 } 3212 }; 3213} 3214 3215// (36:1) <Empty unpadded_box={true} size="large"> 3216function create_default_slot$1(ctx) { 3217 let video; 3218 let current; 3219 video = new Video$1({}); 3220 3221 return { 3222 c() { 3223 create_component$1(video.$$.fragment); 3224 }, 3225 m(target, anchor) { 3226 mount_component$1(video, target, anchor); 3227 current = true; 3228 }, 3229 i(local) { 3230 if (current) return; 3231 transition_in$1(video.$$.fragment, local); 3232 current = true; 3233 }, 3234 o(local) { 3235 transition_out$1(video.$$.fragment, local); 3236 current = false; 3237 }, 3238 d(detaching) { 3239 destroy_component$1(video, detaching); 3240 } 3241 }; 3242} 3243 3244function create_fragment$1(ctx) { 3245 let blocklabel; 3246 let t; 3247 let current_block_type_index; 3248 let if_block; 3249 let if_block_anchor; 3250 let current; 3251 3252 blocklabel = new BlockLabel({ 3253 props: { 3254 show_label: /*show_label*/ ctx[3], 3255 Icon: Video$1, 3256 label: /*label*/ ctx[2] || "Video" 3257 } 3258 }); 3259 3260 const if_block_creators = [create_if_block$1, create_else_block$1]; 3261 const if_blocks = []; 3262 3263 function select_block_type(ctx, dirty) { 3264 if (/*value*/ ctx[0] === null || /*value*/ ctx[0].url === undefined) return 0; 3265 return 1; 3266 } 3267 3268 current_block_type_index = select_block_type(ctx); 3269 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 3270 3271 return { 3272 c() { 3273 create_component$1(blocklabel.$$.fragment); 3274 t = space$1(); 3275 if_block.c(); 3276 if_block_anchor = empty$1(); 3277 }, 3278 m(target, anchor) { 3279 mount_component$1(blocklabel, target, anchor); 3280 insert$1(target, t, anchor); 3281 if_blocks[current_block_type_index].m(target, anchor); 3282 insert$1(target, if_block_anchor, anchor); 3283 current = true; 3284 }, 3285 p(ctx, [dirty]) { 3286 const blocklabel_changes = {}; 3287 if (dirty & /*show_label*/ 8) blocklabel_changes.show_label = /*show_label*/ ctx[3]; 3288 if (dirty & /*label*/ 4) blocklabel_changes.label = /*label*/ ctx[2] || "Video"; 3289 blocklabel.$set(blocklabel_changes); 3290 let previous_block_index = current_block_type_index; 3291 current_block_type_index = select_block_type(ctx); 3292 3293 if (current_block_type_index === previous_block_index) { 3294 if_blocks[current_block_type_index].p(ctx, dirty); 3295 } else { 3296 group_outros$1(); 3297 3298 transition_out$1(if_blocks[previous_block_index], 1, 1, () => { 3299 if_blocks[previous_block_index] = null; 3300 }); 3301 3302 check_outros$1(); 3303 if_block = if_blocks[current_block_type_index]; 3304 3305 if (!if_block) { 3306 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 3307 if_block.c(); 3308 } else { 3309 if_block.p(ctx, dirty); 3310 } 3311 3312 transition_in$1(if_block, 1); 3313 if_block.m(if_block_anchor.parentNode, if_block_anchor); 3314 } 3315 }, 3316 i(local) { 3317 if (current) return; 3318 transition_in$1(blocklabel.$$.fragment, local); 3319 transition_in$1(if_block); 3320 current = true; 3321 }, 3322 o(local) { 3323 transition_out$1(blocklabel.$$.fragment, local); 3324 transition_out$1(if_block); 3325 current = false; 3326 }, 3327 d(detaching) { 3328 if (detaching) { 3329 detach$1(t); 3330 detach$1(if_block_anchor); 3331 } 3332 3333 destroy_component$1(blocklabel, detaching); 3334 if_blocks[current_block_type_index].d(detaching); 3335 } 3336 }; 3337} 3338
3339function instance$1($$self, $$props, $$invalidate) { 3340 let { value = null } = $$props; 3341 let { subtitle = null } = $$props; 3342 let { label = undefined } = $$props; 3343 let { show_label = true } = $$props; 3344 let { autoplay } = $$props; 3345 let { show_share_button = true } = $$props; 3346 let { show_download_button = true } = $$props; 3347 let { i18n } = $$props; 3348 let old_value = null; 3349 let old_subtitle = null; 3350 const dispatch = createEventDispatcher(); 3351 3352 afterUpdate(async () => { 3353 // needed to bust subtitle caching issues on Chrome 3354 if (value !== old_value && subtitle !== old_subtitle && old_subtitle !== null) { 3355 old_value = value; 3356 $$invalidate(0, value = null); 3357 await tick(); 3358 $$invalidate(0, value = old_value); 3359 } 3360 3361 old_value = value; 3362 old_subtitle = subtitle; 3363 }); 3364 3365 function play_handler(event) { 3366 bubble.call(this, $$self, event); 3367 } 3368 3369 function pause_handler(event) { 3370 bubble.call(this, $$self, event); 3371 } 3372 3373 function stop_handler(event) { 3374 bubble.call(this, $$self, event); 3375 } 3376 3377 function end_handler(event) { 3378 bubble.call(this, $$self, event); 3379 } 3380 3381 const func = async value => { 3382 if (!value) return ""; 3383 let url = await uploadToHuggingFace(value.data, "url"); 3384 return url; 3385 }; 3386 3387 function error_handler(event) { 3388 bubble.call(this, $$self, event); 3389 } 3390 3391 function share_handler(event) { 3392 bubble.call(this, $$self, event); 3393 } 3394 3395 $$self.$$set = $$props => {
3396 if ('value' in $$props) $$invalidate(0, value = $$props.value); 3397 if ('subtitle' in $$props) $$invalidate(1, subtitle = $$props.subtitle); 3398 if ('label' in $$props) $$invalidate(2, label = $$props.label); 3399 if ('show_label' in $$props) $$invalidate(3, show_label = $$props.show_label); 3400 if ('autoplay' in $$props) $$invalidate(4, autoplay = $$props.autoplay); 3401 if ('show_share_button' in $$props) $$invalidate(5, show_share_button = $$props.show_share_button); 3402 if ('show_download_button' in $$props) $$invalidate(6, show_download_button = $$props.show_download_button); 3403 if ('i18n' in $$props) $$invalidate(7, i18n = $$props.i18n); 3404 }; 3405 3406 $$self.$$.update = () => { 3407 if ($$self.$$.dirty & /*value*/ 1) { 3408 value && dispatch("change", value); 3409 } 3410 }; 3411 3412 return [ 3413 value, 3414 subtitle, 3415 label, 3416 show_label, 3417 autoplay, 3418 show_share_button, 3419 show_download_button, 3420 i18n, 3421 play_handler, 3422 pause_handler, 3423 stop_handler, 3424 end_handler, 3425 func, 3426 error_handler, 3427 share_handler 3428 ]; 3429} 3430 3431class VideoPreview extends SvelteComponent$1 { 3432 constructor(options) { 3433 super(); 3434 3435 init$1(this, options, instance$1, create_fragment$1, safe_not_equal$1, { 3436 value: 0, 3437 subtitle: 1, 3438 label: 2, 3439 show_label: 3, 3440 autoplay: 4, 3441 show_share_button: 5, 3442 show_download_button: 6, 3443 i18n: 7 3444 }); 3445 } 3446} 3447 3448const StaticVideo = VideoPreview; 3449 3450/* home/runner/work/gradio/gradio/js/video/Index.svelte generated by Svelte v4.2.2 */ 3451const { 3452 SvelteComponent, 3453 assign, 3454 check_outros, 3455 create_component, 3456 destroy_component, 3457 detach, 3458 empty, 3459 flush, 3460 get_spread_object, 3461 get_spread_update, 3462 group_outros, 3463 init, 3464 insert, 3465 mount_component, 3466 safe_not_equal, 3467 space, 3468 transition_in, 3469 transition_out 3470} = window.__gradio__svelte__internal; 3471function create_else_block(ctx) { 3472 let block; 3473 let current; 3474 3475 block = new Block({ 3476 props: { 3477 visible: /*visible*/ ctx[4], 3478 variant: /*value*/ ctx[0] === null && /*active_source*/ ctx[21] === "upload" 3479 ? "dashed" 3480 : "solid", 3481 border_mode: /*dragging*/ ctx[24] ? "focus" : "base", 3482 padding: false, 3483 elem_id: /*elem_id*/ ctx[2], 3484 elem_classes: /*elem_classes*/ ctx[3], 3485 height: /*height*/ ctx[9], 3486 width: /*width*/ ctx[10], 3487 container: /*container*/ ctx[11], 3488 scale: /*scale*/ ctx[12], 3489 min_width: /*min_width*/ ctx[13], 3490 allow_overflow: false, 3491 $$slots: { default: [create_default_slot_1] }, 3492 $$scope: { ctx } 3493 } 3494 }); 3495 3496 return { 3497 c() { 3498 create_component(block.$$.fragment); 3499 }, 3500 m(target, anchor) { 3501 mount_component(block, target, anchor); 3502 current = true; 3503 }, 3504 p(ctx, dirty) { 3505 const block_changes = {}; 3506 if (dirty[0] & /*visible*/ 16) block_changes.visible = /*visible*/ ctx[4]; 3507 3508 if (dirty[0] & /*value, active_source*/ 2097153) block_changes.variant = /*value*/ ctx[0] === null && /*active_source*/ ctx[21] === "upload" 3509 ? "dashed" 3510 : "solid"; 3511 3512 if (dirty[0] & /*dragging*/ 16777216) block_changes.border_mode = /*dragging*/ ctx[24] ? "focus" : "base"; 3513 if (dirty[0] & /*elem_id*/ 4) block_changes.elem_id = /*elem_id*/ ctx[2]; 3514 if (dirty[0] & /*elem_classes*/ 8) block_changes.elem_classes = /*elem_classes*/ ctx[3]; 3515 if (dirty[0] & /*height*/ 512) block_changes.height = /*height*/ ctx[9]; 3516 if (dirty[0] & /*width*/ 1024) block_changes.width = /*width*/ ctx[10]; 3517 if (dirty[0] & /*container*/ 2048) block_changes.container = /*container*/ ctx[11]; 3518 if (dirty[0] & /*scale*/ 4096) block_changes.scale = /*scale*/ ctx[12]; 3519 if (dirty[0] & /*min_width*/ 8192) block_changes.min_width = /*min_width*/ ctx[13]; 3520 3521 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*/ 32768) { 3522 block_changes.$$scope = { dirty, ctx }; 3523 } 3524 3525 block.$set(block_changes); 3526 }, 3527 i(local) { 3528 if (current) return; 3529 transition_in(block.$$.fragment, local); 3530 current = true; 3531 }, 3532 o(local) { 3533 transition_out(block.$$.fragment, local); 3534 current = false; 3535 }, 3536 d(detaching) { 3537 destroy_component(block, detaching); 3538 } 3539 }; 3540} 3541 3542// (83:0) {#if !interactive} 3543function create_if_block(ctx) { 3544 let block; 3545 let current; 3546 3547 block = new Block({ 3548 props: { 3549 visible: /*visible*/ ctx[4], 3550 variant: /*value*/ ctx[0] === null && /*active_source*/ ctx[21] === "upload" 3551 ? "dashed" 3552 : "solid", 3553 border_mode: /*dragging*/ ctx[24] ? "focus" : "base", 3554 padding: false, 3555 elem_id: /*elem_id*/ ctx[2], 3556 elem_classes: /*elem_classes*/ ctx[3], 3557 height: /*height*/ ctx[9], 3558 width: /*width*/ ctx[10], 3559 container: /*container*/ ctx[11], 3560 scale: /*scale*/ ctx[12], 3561 min_width: /*min_width*/ ctx[13], 3562 allow_overflow: false, 3563 $$slots: { default: [create_default_slot] }, 3564 $$scope: { ctx } 3565 } 3566 }); 3567 3568 return { 3569 c() { 3570 create_component(block.$$.fragment); 3571 }, 3572 m(target, anchor) { 3573 mount_component(block, target, anchor); 3574 current = true; 3575 }, 3576 p(ctx, dirty) { 3577 const block_changes = {};
3578 if (dirty[0] & /*visible*/ 16) block_changes.visible = /*visible*/ ctx[4]; 3579 3580 if (dirty[0] & /*value, active_source*/ 2097153) block_changes.variant = /*value*/ ctx[0] === null && /*active_source*/ ctx[21] === "upload" 3581 ? "dashed" 3582 : "solid"; 3583 3584 if (dirty[0] & /*dragging*/ 16777216) block_changes.border_mode = /*dragging*/ ctx[24] ? "focus" : "base"; 3585 if (dirty[0] & /*elem_id*/ 4) block_changes.elem_id = /*elem_id*/ ctx[2]; 3586 if (dirty[0] & /*elem_classes*/ 8) block_changes.elem_classes = /*elem_classes*/ ctx[3]; 3587 if (dirty[0] & /*height*/ 512) block_changes.height = /*height*/ ctx[9]; 3588 if (dirty[0] & /*width*/ 1024) block_changes.width = /*width*/ ctx[10]; 3589 if (dirty[0] & /*container*/ 2048) block_changes.container = /*container*/ ctx[11]; 3590 if (dirty[0] & /*scale*/ 4096) block_changes.scale = /*scale*/ ctx[12]; 3591 if (dirty[0] & /*min_width*/ 8192) block_changes.min_width = /*min_width*/ ctx[13]; 3592 3593 if (dirty[0] & /*_video, _subtitle, label, show_label, autoplay, show_share_button, show_download_button, gradio, loading_status*/ 12828962 | dirty[1] & /*$$scope*/ 32768) { 3594 block_changes.$$scope = { dirty, ctx }; 3595 } 3596 3597 block.$set(block_changes); 3598 }, 3599 i(local) { 3600 if (current) return; 3601 transition_in(block.$$.fragment, local); 3602 current = true; 3603 }, 3604 o(local) { 3605 transition_out(block.$$.fragment, local); 3606 current = false; 3607 }, 3608 d(detaching) { 3609 destroy_component(block, detaching); 3610 } 3611 }; 3612} 3613 3614// (142: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} > 3615function create_default_slot_2(ctx) { 3616 let uploadtext; 3617 let current; 3618 3619 uploadtext = new UploadText({ 3620 props: { 3621 i18n: /*gradio*/ ctx[17].i18n, 3622 type: "video" 3623 } 3624 }); 3625 3626 return { 3627 c() { 3628 create_component(uploadtext.$$.fragment); 3629 }, 3630 m(target, anchor) { 3631 mount_component(uploadtext, target, anchor); 3632 current = true; 3633 }, 3634 p(ctx, dirty) { 3635 const uploadtext_changes = {}; 3636 if (dirty[0] & /*gradio*/ 131072) uploadtext_changes.i18n = /*gradio*/ ctx[17].i18n; 3637 uploadtext.$set(uploadtext_changes); 3638 }, 3639 i(local) { 3640 if (current) return; 3641 transition_in(uploadtext.$$.fragment, local); 3642 current = true; 3643 }, 3644 o(local) { 3645 transition_out(uploadtext.$$.fragment, local); 3646 current = false; 3647 }, 3648 d(detaching) { 3649 destroy_component(uploadtext, detaching); 3650 } 3651 }; 3652} 3653 3654// (122:1) <Block {visible} variant={value === null && active_source === "upload" ? "dashed" : "solid"} border_mode={dragging ? "focus" : "base"} padding={false} {elem_id} {elem_classes} {height} {width} {container} {scale} {min_width} allow_overflow={false} > 3655function create_default_slot_1(ctx) { 3656 let statustracker; 3657 let t; 3658 let video; 3659 let current; 3660 3661 const statustracker_spread_levels = [ 3662 { 3663 autoscroll: /*gradio*/ ctx[17].autoscroll 3664 }, 3665 { i18n: /*gradio*/ ctx[17].i18n }, 3666 /*loading_status*/ ctx[1] 3667 ]; 3668 3669 let statustracker_props = {}; 3670 3671 for (let i = 0; i < statustracker_spread_levels.length; i += 1) { 3672 statustracker_props = assign(statustracker_props, statustracker_spread_levels[i]); 3673 } 3674 3675 statustracker = new Static({ props: statustracker_props }); 3676 3677 video = new Video({ 3678 props: { 3679 value: /*_video*/ ctx[22], 3680 subtitle: /*_subtitle*/ ctx[23], 3681 label: /*label*/ ctx[5], 3682 show_label: /*show_label*/ ctx[8], 3683 show_download_button: /*show_download_button*/ ctx[16], 3684 sources: /*sources*/ ctx[6], 3685 active_source: /*active_source*/ ctx[21], 3686 mirror_webcam: /*mirror_webcam*/ ctx[19], 3687 include_audio: /*include_audio*/ ctx[20], 3688 autoplay: /*autoplay*/ ctx[14], 3689 root: /*root*/ ctx[7], 3690 handle_reset_value: /*handle_reset_value*/ ctx[25], 3691 i18n: /*gradio*/ ctx[17].i18n, 3692 $$slots: { default: [create_default_slot_2] }, 3693 $$scope: { ctx } 3694 } 3695 }); 3696 3697 video.$on("change", /*handle_change*/ ctx[26]); 3698 video.$on("drag", /*drag_handler*/ ctx[37]); 3699 video.$on("error", /*handle_error*/ ctx[27]); 3700 video.$on("clear", /*clear_handler*/ ctx[38]); 3701 video.$on("play", /*play_handler_1*/ ctx[39]); 3702 video.$on("pause", /*pause_handler_1*/ ctx[40]); 3703 video.$on("upload", /*upload_handler*/ ctx[41]); 3704 video.$on("stop", /*stop_handler_1*/ ctx[42]); 3705 video.$on("end", /*end_handler_1*/ ctx[43]); 3706 video.$on("start_recording", /*start_recording_handler*/ ctx[44]); 3707 video.$on("stop_recording", /*stop_recording_handler*/ ctx[45]); 3708 3709 return { 3710 c() { 3711 create_component(statustracker.$$.fragment); 3712 t = space(); 3713 create_component(video.$$.fragment); 3714 }, 3715 m(target, anchor) { 3716 mount_component(statustracker, target, anchor); 3717 insert(target, t, anchor);
3718 mount_component(video, target, anchor); 3719 current = true; 3720 }, 3721 p(ctx, dirty) { 3722 const statustracker_changes = (dirty[0] & /*gradio, loading_status*/ 131074) 3723 ? get_spread_update(statustracker_spread_levels, [ 3724 dirty[0] & /*gradio*/ 131072 && { 3725 autoscroll: /*gradio*/ ctx[17].autoscroll 3726 }, 3727 dirty[0] & /*gradio*/ 131072 && { i18n: /*gradio*/ ctx[17].i18n }, 3728 dirty[0] & /*loading_status*/ 2 && get_spread_object(/*loading_status*/ ctx[1]) 3729 ]) 3730 : {}; 3731 3732 statustracker.$set(statustracker_changes); 3733 const video_changes = {}; 3734 if (dirty[0] & /*_video*/ 4194304) video_changes.value = /*_video*/ ctx[22]; 3735 if (dirty[0] & /*_subtitle*/ 8388608) video_changes.subtitle = /*_subtitle*/ ctx[23]; 3736 if (dirty[0] & /*label*/ 32) video_changes.label = /*label*/ ctx[5]; 3737 if (dirty[0] & /*show_label*/ 256) video_changes.show_label = /*show_label*/ ctx[8]; 3738 if (dirty[0] & /*show_download_button*/ 65536) video_changes.show_download_button = /*show_download_button*/ ctx[16]; 3739 if (dirty[0] & /*sources*/ 64) video_changes.sources = /*sources*/ ctx[6]; 3740 if (dirty[0] & /*active_source*/ 2097152) video_changes.active_source = /*active_source*/ ctx[21]; 3741 if (dirty[0] & /*mirror_webcam*/ 524288) video_changes.mirror_webcam = /*mirror_webcam*/ ctx[19]; 3742 if (dirty[0] & /*include_audio*/ 1048576) video_changes.include_audio = /*include_audio*/ ctx[20]; 3743 if (dirty[0] & /*autoplay*/ 16384) video_changes.autoplay = /*autoplay*/ ctx[14]; 3744 if (dirty[0] & /*root*/ 128) video_changes.root = /*root*/ ctx[7]; 3745 if (dirty[0] & /*gradio*/ 131072) video_changes.i18n = /*gradio*/ ctx[17].i18n; 3746 3747 if (dirty[0] & /*gradio*/ 131072 | dirty[1] & /*$$scope*/ 32768) { 3748 video_changes.$$scope = { dirty, ctx }; 3749 } 3750 3751 video.$set(video_changes); 3752 }, 3753 i(local) { 3754 if (current) return; 3755 transition_in(statustracker.$$.fragment, local); 3756 transition_in(video.$$.fragment, local); 3757 current = true; 3758 }, 3759 o(local) { 3760 transition_out(statustracker.$$.fragment, local); 3761 transition_out(video.$$.fragment, local); 3762 current = false; 3763 }, 3764 d(detaching) { 3765 if (detaching) { 3766 detach(t); 3767 } 3768 3769 destroy_component(statustracker, detaching); 3770 destroy_component(video, detaching); 3771 } 3772 }; 3773} 3774 3775// (84: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} > 3776function create_default_slot(ctx) { 3777 let statustracker; 3778 let t; 3779 let staticvideo; 3780 let current; 3781 3782 const statustracker_spread_levels = [ 3783 { 3784 autoscroll: /*gradio*/ ctx[17].autoscroll 3785 }, 3786 { i18n: /*gradio*/ ctx[17].i18n }, 3787 /*loading_status*/ ctx[1] 3788 ]; 3789 3790 let statustracker_props = {}; 3791 3792 for (let i = 0; i < statustracker_spread_levels.length; i += 1) { 3793 statustracker_props = assign(statustracker_props, statustracker_spread_levels[i]); 3794 } 3795 3796 statustracker = new Static({ props: statustracker_props }); 3797 3798 staticvideo = new StaticVideo({ 3799 props: { 3800 value: /*_video*/ ctx[22], 3801 subtitle: /*_subtitle*/ ctx[23], 3802 label: /*label*/ ctx[5], 3803 show_label: /*show_label*/ ctx[8], 3804 autoplay: /*autoplay*/ ctx[14], 3805 show_share_button: /*show_share_button*/ ctx[15], 3806 show_download_button: /*show_download_button*/ ctx[16], 3807 i18n: /*gradio*/ ctx[17].i18n 3808 } 3809 }); 3810 3811 staticvideo.$on("play", /*play_handler*/ ctx[31]); 3812 staticvideo.$on("pause", /*pause_handler*/ ctx[32]); 3813 staticvideo.$on("stop", /*stop_handler*/ ctx[33]); 3814 staticvideo.$on("end", /*end_handler*/ ctx[34]); 3815 staticvideo.$on("share", /*share_handler*/ ctx[35]); 3816 staticvideo.$on("error", /*error_handler*/ ctx[36]); 3817 3818 return { 3819 c() { 3820 create_component(statustracker.$$.fragment); 3821 t = space(); 3822 create_component(staticvideo.$$.fragment); 3823 }, 3824 m(target, anchor) { 3825 mount_component(statustracker, target, anchor); 3826 insert(target, t, anchor); 3827 mount_component(staticvideo, target, anchor); 3828 current = true; 3829 }, 3830 p(ctx, dirty) { 3831 const statustracker_changes = (dirty[0] & /*gradio, loading_status*/ 131074) 3832 ? get_spread_update(statustracker_spread_levels, [ 3833 dirty[0] & /*gradio*/ 131072 && { 3834 autoscroll: /*gradio*/ ctx[17].autoscroll 3835 }, 3836 dirty[0] & /*gradio*/ 131072 && { i18n: /*gradio*/ ctx[17].i18n }, 3837 dirty[0] & /*loading_status*/ 2 && get_spread_object(/*loading_status*/ ctx[1]) 3838 ]) 3839 : {}; 3840 3841 statustracker.$set(statustracker_changes); 3842 const staticvideo_changes = {};
3843 if (dirty[0] & /*_video*/ 4194304) staticvideo_changes.value = /*_video*/ ctx[22]; 3844 if (dirty[0] & /*_subtitle*/ 8388608) staticvideo_changes.subtitle = /*_subtitle*/ ctx[23]; 3845 if (dirty[0] & /*label*/ 32) staticvideo_changes.label = /*label*/ ctx[5]; 3846 if (dirty[0] & /*show_label*/ 256) staticvideo_changes.show_label = /*show_label*/ ctx[8]; 3847 if (dirty[0] & /*autoplay*/ 16384) staticvideo_changes.autoplay = /*autoplay*/ ctx[14]; 3848 if (dirty[0] & /*show_share_button*/ 32768) staticvideo_changes.show_share_button = /*show_share_button*/ ctx[15]; 3849 if (dirty[0] & /*show_download_button*/ 65536) staticvideo_changes.show_download_button = /*show_download_button*/ ctx[16]; 3850 if (dirty[0] & /*gradio*/ 131072) staticvideo_changes.i18n = /*gradio*/ ctx[17].i18n; 3851 staticvideo.$set(staticvideo_changes); 3852 }, 3853 i(local) { 3854 if (current) return; 3855 transition_in(statustracker.$$.fragment, local); 3856 transition_in(staticvideo.$$.fragment, local); 3857 current = true; 3858 }, 3859 o(local) { 3860 transition_out(statustracker.$$.fragment, local); 3861 transition_out(staticvideo.$$.fragment, local); 3862 current = false; 3863 }, 3864 d(detaching) { 3865 if (detaching) { 3866 detach(t); 3867 } 3868 3869 destroy_component(statustracker, detaching); 3870 destroy_component(staticvideo, detaching); 3871 } 3872 }; 3873} 3874 3875function create_fragment(ctx) { 3876 let current_block_type_index; 3877 let if_block; 3878 let if_block_anchor; 3879 let current; 3880 const if_block_creators = [create_if_block, create_else_block]; 3881 const if_blocks = []; 3882 3883 function select_block_type(ctx, dirty) { 3884 if (!/*interactive*/ ctx[18]) return 0; 3885 return 1; 3886 } 3887 3888 current_block_type_index = select_block_type(ctx); 3889 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 3890 3891 return { 3892 c() { 3893 if_block.c(); 3894 if_block_anchor = empty(); 3895 }, 3896 m(target, anchor) { 3897 if_blocks[current_block_type_index].m(target, anchor); 3898 insert(target, if_block_anchor, anchor); 3899 current = true; 3900 }, 3901 p(ctx, dirty) { 3902 let previous_block_index = current_block_type_index; 3903 current_block_type_index = select_block_type(ctx); 3904 3905 if (current_block_type_index === previous_block_index) { 3906 if_blocks[current_block_type_index].p(ctx, dirty); 3907 } else { 3908 group_outros(); 3909 3910 transition_out(if_blocks[previous_block_index], 1, 1, () => { 3911 if_blocks[previous_block_index] = null; 3912 }); 3913 3914 check_outros(); 3915 if_block = if_blocks[current_block_type_index]; 3916 3917 if (!if_block) { 3918 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 3919 if_block.c(); 3920 } else { 3921 if_block.p(ctx, dirty); 3922 } 3923 3924 transition_in(if_block, 1); 3925 if_block.m(if_block_anchor.parentNode, if_block_anchor); 3926 } 3927 }, 3928 i(local) { 3929 if (current) return; 3930 transition_in(if_block); 3931 current = true; 3932 }, 3933 o(local) { 3934 transition_out(if_block); 3935 current = false; 3936 }, 3937 d(detaching) { 3938 if (detaching) { 3939 detach(if_block_anchor); 3940 } 3941 3942 if_blocks[current_block_type_index].d(detaching); 3943 } 3944 }; 3945} 3946 3947function instance($$self, $$props, $$invalidate) { 3948 let { elem_id = "" } = $$props; 3949 let { elem_classes = [] } = $$props; 3950 let { visible = true } = $$props; 3951 let { value = null } = $$props; 3952 let old_value = null; 3953 let { label } = $$props; 3954 let { sources } = $$props; 3955 let { root } = $$props; 3956 let { proxy_url } = $$props; 3957 let { show_label } = $$props; 3958 let { loading_status } = $$props; 3959 let { height } = $$props; 3960 let { width } = $$props; 3961 let { container = false } = $$props; 3962 let { scale = null } = $$props; 3963 let { min_width = undefined } = $$props; 3964 let { autoplay = false } = $$props; 3965 let { show_share_button = true } = $$props; 3966 let { show_download_button } = $$props; 3967 let { gradio } = $$props; 3968 let { interactive } = $$props; 3969 let { mirror_webcam } = $$props; 3970 let { include_audio } = $$props; 3971 let _video = null; 3972 let _subtitle = null; 3973 let active_source; 3974 let initial_value = value; 3975 3976 const handle_reset_value = () => { 3977 if (initial_value === null || value === initial_value) { 3978 return; 3979 } 3980 3981 $$invalidate(0, value = initial_value); 3982 }; 3983 3984 let dragging = false;
3985 3986 function handle_change({ detail }) { 3987 if (detail != null) { 3988 $$invalidate(0, value = { video: detail, subtitles: null }); 3989 } else { 3990 $$invalidate(0, value = null); 3991 } 3992 } 3993 3994 function handle_error({ detail }) { 3995 const [level, status] = detail.includes("Invalid file type") 3996 ? ["warning", "complete"] 3997 : ["error", "error"]; 3998 3999 $$invalidate(1, loading_status = loading_status || {}); 4000 $$invalidate(1, loading_status.status = status, loading_status); 4001 $$invalidate(1, loading_status.message = detail, loading_status); 4002 gradio.dispatch(level, detail); 4003 } 4004 4005 const play_handler = () => gradio.dispatch("play"); 4006 const pause_handler = () => gradio.dispatch("pause"); 4007 const stop_handler = () => gradio.dispatch("stop"); 4008 const end_handler = () => gradio.dispatch("end"); 4009 const share_handler = ({ detail }) => gradio.dispatch("share", detail); 4010 const error_handler = ({ detail }) => gradio.dispatch("error", detail); 4011 const drag_handler = ({ detail }) => $$invalidate(24, dragging = detail); 4012 const clear_handler = () => gradio.dispatch("clear"); 4013 const play_handler_1 = () => gradio.dispatch("play"); 4014 const pause_handler_1 = () => gradio.dispatch("pause"); 4015 const upload_handler = () => gradio.dispatch("upload"); 4016 const stop_handler_1 = () => gradio.dispatch("stop"); 4017 const end_handler_1 = () => gradio.dispatch("end"); 4018 const start_recording_handler = () => gradio.dispatch("start_recording"); 4019 const stop_recording_handler = () => gradio.dispatch("stop_recording"); 4020 4021 $$self.$$set = $$props => {
4022 if ('elem_id' in $$props) $$invalidate(2, elem_id = $$props.elem_id); 4023 if ('elem_classes' in $$props) $$invalidate(3, elem_classes = $$props.elem_classes); 4024 if ('visible' in $$props) $$invalidate(4, visible = $$props.visible); 4025 if ('value' in $$props) $$invalidate(0, value = $$props.value); 4026 if ('label' in $$props) $$invalidate(5, label = $$props.label); 4027 if ('sources' in $$props) $$invalidate(6, sources = $$props.sources); 4028 if ('root' in $$props) $$invalidate(7, root = $$props.root); 4029 if ('proxy_url' in $$props) $$invalidate(28, proxy_url = $$props.proxy_url); 4030 if ('show_label' in $$props) $$invalidate(8, show_label = $$props.show_label); 4031 if ('loading_status' in $$props) $$invalidate(1, loading_status = $$props.loading_status); 4032 if ('height' in $$props) $$invalidate(9, height = $$props.height); 4033 if ('width' in $$props) $$invalidate(10, width = $$props.width); 4034 if ('container' in $$props) $$invalidate(11, container = $$props.container); 4035 if ('scale' in $$props) $$invalidate(12, scale = $$props.scale);
4036 if ('min_width' in $$props) $$invalidate(13, min_width = $$props.min_width); 4037 if ('autoplay' in $$props) $$invalidate(14, autoplay = $$props.autoplay); 4038 if ('show_share_button' in $$props) $$invalidate(15, show_share_button = $$props.show_share_button); 4039 if ('show_download_button' in $$props) $$invalidate(16, show_download_button = $$props.show_download_button); 4040 if ('gradio' in $$props) $$invalidate(17, gradio = $$props.gradio); 4041 if ('interactive' in $$props) $$invalidate(18, interactive = $$props.interactive); 4042 if ('mirror_webcam' in $$props) $$invalidate(19, mirror_webcam = $$props.mirror_webcam); 4043 if ('include_audio' in $$props) $$invalidate(20, include_audio = $$props.include_audio); 4044 }; 4045 4046 $$self.$$.update = () => { 4047 if ($$self.$$.dirty[0] & /*value, initial_value*/ 1073741825) { 4048 if (value && initial_value === null) { 4049 $$invalidate(30, initial_value = value); 4050 } 4051 } 4052 4053 if ($$self.$$.dirty[0] & /*sources, active_source*/ 2097216) { 4054 if (sources && !active_source) { 4055 $$invalidate(21, active_source = sources[0]); 4056 } 4057 } 4058 4059 if ($$self.$$.dirty[0] & /*value, root, proxy_url*/ 268435585) { 4060 { 4061 if (value != null) { 4062 $$invalidate(22, _video = normalise_file(value.video, root, proxy_url)); 4063 $$invalidate(23, _subtitle = normalise_file(value.subtitles, root, proxy_url)); 4064 } else { 4065 $$invalidate(22, _video = null); 4066 $$invalidate(23, _subtitle = null); 4067 } 4068 } 4069 } 4070 4071 if ($$self.$$.dirty[0] & /*value, old_value, gradio*/ 537001985) { 4072 { 4073 if (JSON.stringify(value) !== JSON.stringify(old_value)) { 4074 $$invalidate(29, old_value = value); 4075 gradio.dispatch("change"); 4076 } 4077 } 4078 } 4079 }; 4080 4081 return [ 4082 value, 4083 loading_status, 4084 elem_id, 4085 elem_classes, 4086 visible, 4087 label, 4088 sources, 4089 root, 4090 show_label, 4091 height, 4092 width, 4093 container, 4094 scale, 4095 min_width, 4096 autoplay, 4097 show_share_button, 4098 show_download_button, 4099 gradio, 4100 interactive, 4101 mirror_webcam, 4102 include_audio, 4103 active_source, 4104 _video, 4105 _subtitle, 4106 dragging, 4107 handle_reset_value, 4108 handle_change, 4109 handle_error, 4110 proxy_url, 4111 old_value, 4112 initial_value, 4113 play_handler, 4114 pause_handler, 4115 stop_handler, 4116 end_handler, 4117 share_handler, 4118 error_handler, 4119 drag_handler, 4120 clear_handler, 4121 play_handler_1, 4122 pause_handler_1, 4123 upload_handler, 4124 stop_handler_1, 4125 end_handler_1, 4126 start_recording_handler, 4127 stop_recording_handler 4128 ]; 4129} 4130 4131class Index extends SvelteComponent { 4132 constructor(options) { 4133 super(); 4134 4135 init( 4136 this, 4137 options, 4138 instance, 4139 create_fragment, 4140 safe_not_equal, 4141 { 4142 elem_id: 2, 4143 elem_classes: 3, 4144 visible: 4, 4145 value: 0, 4146 label: 5, 4147 sources: 6, 4148 root: 7, 4149 proxy_url: 28, 4150 show_label: 8, 4151 loading_status: 1, 4152 height: 9, 4153 width: 10, 4154 container: 11, 4155 scale: 12, 4156 min_width: 13, 4157 autoplay: 14, 4158 show_share_button: 15, 4159 show_download_button: 16, 4160 gradio: 17, 4161 interactive: 18, 4162 mirror_webcam: 19, 4163 include_audio: 20 4164 }, 4165 null, 4166 [-1, -1] 4167 ); 4168 } 4169 4170 get elem_id() { 4171 return this.$$.ctx[2]; 4172 } 4173 4174 set elem_id(elem_id) { 4175 this.$$set({ elem_id }); 4176 flush(); 4177 } 4178 4179 get elem_classes() { 4180 return this.$$.ctx[3]; 4181 } 4182 4183 set elem_classes(elem_classes) { 4184 this.$$set({ elem_classes }); 4185 flush(); 4186 } 4187 4188 get visible() { 4189 return this.$$.ctx[4]; 4190 } 4191 4192 set visible(visible) { 4193 this.$$set({ visible }); 4194 flush(); 4195 } 4196 4197 get value() { 4198 return this.$$.ctx[0]; 4199 } 4200 4201 set value(value) { 4202 this.$$set({ value }); 4203 flush(); 4204 } 4205 4206 get label() { 4207 return this.$$.ctx[5]; 4208 } 4209 4210 set label(label) { 4211 this.$$set({ label }); 4212 flush(); 4213 } 4214 4215 get sources() { 4216 return this.$$.ctx[6]; 4217 } 4218 4219 set sources(sources) { 4220 this.$$set({ sources }); 4221 flush(); 4222 } 4223 4224 get root() { 4225 return this.$$.ctx[7]; 4226 } 4227 4228 set root(root) { 4229 this.$$set({ root }); 4230 flush(); 4231 } 4232 4233 get proxy_url() { 4234 return this.$$.ctx[28]; 4235 } 4236 4237 set proxy_url(proxy_url) { 4238 this.$$set({ proxy_url }); 4239 flush(); 4240 } 4241 4242 get show_label() { 4243 return this.$$.ctx[8]; 4244 } 4245 4246 set show_label(show_label) { 4247 this.$$set({ show_label }); 4248 flush(); 4249 } 4250 4251 get loading_status() { 4252 return this.$$.ctx[1]; 4253 } 4254 4255 set loading_status(loading_status) { 4256 this.$$set({ loading_status }); 4257 flush(); 4258 } 4259 4260 get height() { 4261 return this.$$.ctx[9]; 4262 } 4263 4264 set height(height) { 4265 this.$$set({ height }); 4266 flush(); 4267 } 4268 4269 get width() { 4270 return this.$$.ctx[10]; 4271 } 4272 4273 set width(width) { 4274 this.$$set({ width }); 4275 flush(); 4276 } 4277 4278 get container() { 4279 return this.$$.ctx[11]; 4280 } 4281 4282 set container(container) { 4283 this.$$set({ container }); 4284 flush(); 4285 } 4286 4287 get scale() { 4288 return this.$$.ctx[12]; 4289 } 4290 4291 set scale(scale) { 4292 this.$$set({ scale }); 4293 flush(); 4294 } 4295 4296 get min_width() { 4297 return this.$$.ctx[13]; 4298 } 4299 4300 set min_width(min_width) { 4301 this.$$set({ min_width }); 4302 flush(); 4303 } 4304 4305 get autoplay() { 4306 return this.$$.ctx[14]; 4307 } 4308 4309 set autoplay(autoplay) { 4310 this.$$set({ autoplay }); 4311 flush(); 4312 } 4313 4314 get show_share_button() { 4315 return this.$$.ctx[15]; 4316 } 4317 4318 set show_share_button(show_share_button) { 4319 this.$$set({ show_share_button }); 4320 flush(); 4321 } 4322 4323 get show_download_button() { 4324 return this.$$.ctx[16]; 4325 } 4326 4327 set show_download_button(show_download_button) { 4328 this.$$set({ show_download_button }); 4329 flush(); 4330 } 4331 4332 get gradio() { 4333 return this.$$.ctx[17]; 4334 } 4335 4336 set gradio(gradio) { 4337 this.$$set({ gradio }); 4338 flush(); 4339 } 4340 4341 get interactive() { 4342 return this.$$.ctx[18]; 4343 } 4344 4345 set interactive(interactive) { 4346 this.$$set({ interactive }); 4347 flush(); 4348 } 4349 4350 get mirror_webcam() { 4351 return this.$$.ctx[19]; 4352 } 4353 4354 set mirror_webcam(mirror_webcam) { 4355 this.$$set({ mirror_webcam }); 4356 flush(); 4357 } 4358 4359 get include_audio() { 4360 return this.$$.ctx[20]; 4361 } 4362 4363 set include_audio(include_audio) { 4364 this.$$set({ include_audio }); 4365 flush(); 4366 } 4367} 4368 4369const Index$1 = Index; 4370 4371export { Video as BaseInteractiveVideo, Player$1 as BasePlayer, StaticVideo as BaseStaticVideo, Index$1 as default, playable, prettyBytes }; 4372//# sourceMappingURL=index-ad3ff87c.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.