1import { B as Block } from './Button-4603580c.js'; 2import { B as BlockLabel } from './BlockLabel-29e86818.js'; 3import { E as Empty } from './Empty-e2e0272e.js'; 4import { S as Static } from './Index-1fd72dbe.js'; 5import { F as File$1 } from './File-e96cd7d6.js'; 6import { U as Upload } from './Upload-5eb3d513.js'; 7import { M as ModifyUpload } from './ModifyUpload-2d323204.js'; 8import { n as normalise_file } from './index-a4a7fd54.js'; 9import { U as UploadText } from './UploadText-c5b17877.js'; 10export { default as BaseExample } from './Example-d9b38e6f.js'; 11/* empty css */import './IconButton-a83f4ef3.js'; 12import './Clear-9760deed.js'; 13import './Undo-6c110254.js'; 14import './svelte/svelte.js'; 15import './Upload-8f4bfd80.js'; 16 17const prettyBytes = (bytes) => { 18 let units = ["B", "KB", "MB", "GB", "PB"]; 19 let i = 0; 20 while (bytes > 1024) { 21 bytes /= 1024; 22 i++; 23 } 24 let unit = units[i]; 25 return bytes.toFixed(1) + " " + unit; 26}; 27 28const FilePreview_svelte_svelte_type_style_lang = ''; 29 30/* home/runner/work/gradio/gradio/js/file/shared/FilePreview.svelte generated by Svelte v4.2.2 */ 31const { 32 HtmlTag, 33 SvelteComponent: SvelteComponent$3, 34 append, 35 attr, 36 destroy_each, 37 detach: detach$3, 38 element, 39 ensure_array_like, 40 init: init$3, 41 insert: insert$3, 42 listen, 43 noop, 44 safe_not_equal: safe_not_equal$3, 45 set_data, 46 set_style, 47 space: space$3, 48 text, 49 toggle_class 50} = window.__gradio__svelte__internal;const { createEventDispatcher: createEventDispatcher$1 } = window.__gradio__svelte__internal; 51function get_each_context(ctx, list, i) { 52 const child_ctx = ctx.slice(); 53 child_ctx[7] = list[i]; 54 child_ctx[9] = i; 55 return child_ctx; 56} 57 58// (57:6) {:else} 59function create_else_block$3(ctx) { 60 let t_value = /*i18n*/ ctx[2]("file.uploading") + ""; 61 let t; 62 63 return { 64 c() { 65 t = text(t_value); 66 }, 67 m(target, anchor) { 68 insert$3(target, t, anchor); 69 }, 70 p(ctx, dirty) { 71 if (dirty & /*i18n*/ 4 && t_value !== (t_value = /*i18n*/ ctx[2]("file.uploading") + "")) set_data(t, t_value); 72 }, 73 d(detaching) { 74 if (detaching) { 75 detach$3(t); 76 } 77 } 78 }; 79} 80 81// (47:6) {#if file.url} 82function create_if_block$3(ctx) { 83 let a; 84 let html_tag; 85 86 let raw_value = (/*file*/ ctx[7].size != null 87 ? prettyBytes(/*file*/ ctx[7].size) 88 : "(size unknown)") + ""; 89 90 let t; 91 let a_href_value; 92 let a_download_value; 93 94 return { 95 c() { 96 a = element("a"); 97 html_tag = new HtmlTag(false); 98 t = text(" â£"); 99 html_tag.a = t; 100 attr(a, "href", a_href_value = /*file*/ ctx[7].url); 101 attr(a, "target", "_blank"); 102 attr(a, "download", a_download_value = window.__is_colab__ ? null : /*file*/ ctx[7].orig_name); 103 attr(a, "class", "svelte-ba3tf5"); 104 }, 105 m(target, anchor) { 106 insert$3(target, a, anchor); 107 html_tag.m(raw_value, a); 108 append(a, t); 109 }, 110 p(ctx, dirty) { 111 if (dirty & /*normalized_files*/ 8 && raw_value !== (raw_value = (/*file*/ ctx[7].size != null 112 ? prettyBytes(/*file*/ ctx[7].size) 113 : "(size unknown)") + "")) html_tag.p(raw_value); 114 115 if (dirty & /*normalized_files*/ 8 && a_href_value !== (a_href_value = /*file*/ ctx[7].url)) { 116 attr(a, "href", a_href_value); 117 } 118 119 if (dirty & /*normalized_files*/ 8 && a_download_value !== (a_download_value = window.__is_colab__ ? null : /*file*/ ctx[7].orig_name)) { 120 attr(a, "download", a_download_value); 121 } 122 }, 123 d(detaching) { 124 if (detaching) { 125 detach$3(a); 126 } 127 } 128 }; 129} 130 131// (31:3) {#each normalized_files as file, i} 132function create_each_block(ctx) { 133 let tr; 134 let td0; 135 let span0; 136 let t0_value = /*file*/ ctx[7].filename_stem + ""; 137 let t0; 138 let t1; 139 let span1; 140 let t2_value = /*file*/ ctx[7].filename_ext + ""; 141 let t2; 142 let td0_aria_label_value; 143 let t3; 144 let td1; 145 let t4; 146 let mounted; 147 let dispose; 148 149 function select_block_type(ctx, dirty) { 150 if (/*file*/ ctx[7].url) return create_if_block$3; 151 return create_else_block$3; 152 } 153 154 let current_block_type = select_block_type(ctx); 155 let if_block = current_block_type(ctx); 156 157 function click_handler() { 158 return /*click_handler*/ ctx[6](/*file*/ ctx[7], /*i*/ ctx[9]); 159 } 160 161 return { 162 c() { 163 tr = element("tr"); 164 td0 = element("td"); 165 span0 = element("span"); 166 t0 = text(t0_value); 167 t1 = space$3(); 168 span1 = element("span"); 169 t2 = text(t2_value); 170 t3 = space$3(); 171 td1 = element("td"); 172 if_block.c(); 173 t4 = space$3(); 174 attr(span0, "class", "stem svelte-ba3tf5"); 175 attr(span1, "class", "ext svelte-ba3tf5"); 176 attr(td0, "class", "filename svelte-ba3tf5"); 177 attr(td0, "aria-label", td0_aria_label_value = /*file*/ ctx[7].orig_name); 178 attr(td1, "class", "download svelte-ba3tf5"); 179 attr(tr, "class", "file svelte-ba3tf5"); 180 toggle_class(tr, "selectable", /*selectable*/ ctx[0]); 181 }, 182 m(target, anchor) { 183 insert$3(target, tr, anchor); 184 append(tr, td0); 185 append(td0, span0); 186 append(span0, t0); 187 append(td0, t1); 188 append(td0, span1); 189 append(span1, t2); 190 append(tr, t3); 191 append(tr, td1); 192 if_block.m(td1, null); 193 append(tr, t4); 194 195 if (!mounted) { 196 dispose = listen(tr, "click", click_handler); 197 mounted = true; 198 } 199 }, 200 p(new_ctx, dirty) { 201 ctx = new_ctx;
202 if (dirty & /*normalized_files*/ 8 && t0_value !== (t0_value = /*file*/ ctx[7].filename_stem + "")) set_data(t0, t0_value); 203 if (dirty & /*normalized_files*/ 8 && t2_value !== (t2_value = /*file*/ ctx[7].filename_ext + "")) set_data(t2, t2_value); 204 205 if (dirty & /*normalized_files*/ 8 && td0_aria_label_value !== (td0_aria_label_value = /*file*/ ctx[7].orig_name)) { 206 attr(td0, "aria-label", td0_aria_label_value); 207 } 208 209 if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block) { 210 if_block.p(ctx, dirty); 211 } else { 212 if_block.d(1); 213 if_block = current_block_type(ctx); 214 215 if (if_block) { 216 if_block.c(); 217 if_block.m(td1, null); 218 } 219 } 220 221 if (dirty & /*selectable*/ 1) { 222 toggle_class(tr, "selectable", /*selectable*/ ctx[0]); 223 } 224 }, 225 d(detaching) { 226 if (detaching) { 227 detach$3(tr); 228 } 229 230 if_block.d(); 231 mounted = false; 232 dispose(); 233 } 234 }; 235} 236 237function create_fragment$3(ctx) { 238 let div; 239 let table; 240 let tbody; 241 let each_value = ensure_array_like(/*normalized_files*/ ctx[3]); 242 let each_blocks = []; 243 244 for (let i = 0; i < each_value.length; i += 1) { 245 each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); 246 } 247 248 return { 249 c() { 250 div = element("div"); 251 table = element("table"); 252 tbody = element("tbody"); 253 254 for (let i = 0; i < each_blocks.length; i += 1) { 255 each_blocks[i].c(); 256 } 257 258 attr(tbody, "class", "svelte-ba3tf5"); 259 attr(table, "class", "file-preview svelte-ba3tf5"); 260 attr(div, "class", "file-preview-holder"); 261 262 set_style(div, "max-height", typeof /*height*/ ctx[1] === undefined 263 ? 'auto' 264 : /*height*/ ctx[1] + 'px'); 265 }, 266 m(target, anchor) { 267 insert$3(target, div, anchor); 268 append(div, table); 269 append(table, tbody); 270 271 for (let i = 0; i < each_blocks.length; i += 1) { 272 if (each_blocks[i]) { 273 each_blocks[i].m(tbody, null); 274 } 275 } 276 }, 277 p(ctx, [dirty]) { 278 if (dirty & /*selectable, dispatch, normalized_files, window, i18n*/ 29) { 279 each_value = ensure_array_like(/*normalized_files*/ ctx[3]); 280 let i; 281 282 for (i = 0; i < each_value.length; i += 1) { 283 const child_ctx = get_each_context(ctx, each_value, i); 284 285 if (each_blocks[i]) { 286 each_blocks[i].p(child_ctx, dirty); 287 } else { 288 each_blocks[i] = create_each_block(child_ctx); 289 each_blocks[i].c(); 290 each_blocks[i].m(tbody, null); 291 } 292 } 293 294 for (; i < each_blocks.length; i += 1) { 295 each_blocks[i].d(1); 296 } 297 298 each_blocks.length = each_value.length; 299 } 300 301 if (dirty & /*height*/ 2) { 302 set_style(div, "max-height", typeof /*height*/ ctx[1] === undefined 303 ? 'auto' 304 : /*height*/ ctx[1] + 'px'); 305 } 306 }, 307 i: noop, 308 o: noop, 309 d(detaching) { 310 if (detaching) { 311 detach$3(div); 312 } 313 314 destroy_each(each_blocks, detaching); 315 } 316 }; 317} 318 319function split_filename(filename) { 320 const last_dot = filename.lastIndexOf("."); 321 322 if (last_dot === -1) { 323 return [filename, ""]; 324 } 325 326 return [filename.slice(0, last_dot), filename.slice(last_dot)]; 327} 328 329function instance$3($$self, $$props, $$invalidate) { 330 let normalized_files; 331 const dispatch = createEventDispatcher$1(); 332 let { value } = $$props; 333 let { selectable = false } = $$props; 334 let { height = undefined } = $$props; 335 let { i18n } = $$props; 336 const click_handler = (file, i) => dispatch("select", { value: file.orig_name, index: i }); 337 338 $$self.$$set = $$props => {
339 if ('value' in $$props) $$invalidate(5, value = $$props.value); 340 if ('selectable' in $$props) $$invalidate(0, selectable = $$props.selectable); 341 if ('height' in $$props) $$invalidate(1, height = $$props.height); 342 if ('i18n' in $$props) $$invalidate(2, i18n = $$props.i18n); 343 }; 344 345 $$self.$$.update = () => { 346 if ($$self.$$.dirty & /*value*/ 32) { 347 $$invalidate(3, normalized_files = (Array.isArray(value) ? value : [value]).map(file => { 348 const [filename_stem, filename_ext] = split_filename(file.orig_name ?? ""); 349 return { ...file, filename_stem, filename_ext }; 350 })); 351 } 352 }; 353 354 return [selectable, height, i18n, normalized_files, dispatch, value, click_handler]; 355} 356 357class FilePreview extends SvelteComponent$3 { 358 constructor(options) { 359 super(); 360 361 init$3(this, options, instance$3, create_fragment$3, safe_not_equal$3, { 362 value: 5, 363 selectable: 0, 364 height: 1, 365 i18n: 2 366 }); 367 } 368} 369 370const FilePreview$1 = FilePreview; 371 372/* home/runner/work/gradio/gradio/js/file/shared/File.svelte generated by Svelte v4.2.2 */ 373const { 374 SvelteComponent: SvelteComponent$2, 375 bubble: bubble$1, 376 check_outros: check_outros$2, 377 create_component: create_component$2, 378 destroy_component: destroy_component$2, 379 detach: detach$2, 380 empty: empty$2, 381 group_outros: group_outros$2, 382 init: init$2, 383 insert: insert$2, 384 mount_component: mount_component$2, 385 safe_not_equal: safe_not_equal$2, 386 space: space$2, 387 transition_in: transition_in$2, 388 transition_out: transition_out$2 389} = window.__gradio__svelte__internal; 390function create_else_block$2(ctx) { 391 let empty_1; 392 let current; 393 394 empty_1 = new Empty({ 395 props: { 396 unpadded_box: true, 397 size: "large", 398 $$slots: { default: [create_default_slot$2] }, 399 $$scope: { ctx } 400 } 401 }); 402 403 return { 404 c() { 405 create_component$2(empty_1.$$.fragment); 406 }, 407 m(target, anchor) { 408 mount_component$2(empty_1, target, anchor); 409 current = true; 410 }, 411 p(ctx, dirty) { 412 const empty_1_changes = {}; 413 414 if (dirty & /*$$scope*/ 128) { 415 empty_1_changes.$$scope = { dirty, ctx }; 416 } 417 418 empty_1.$set(empty_1_changes); 419 }, 420 i(local) { 421 if (current) return; 422 transition_in$2(empty_1.$$.fragment, local); 423 current = true; 424 }, 425 o(local) { 426 transition_out$2(empty_1.$$.fragment, local); 427 current = false; 428 }, 429 d(detaching) { 430 destroy_component$2(empty_1, detaching); 431 } 432 }; 433} 434 435// (19:0) {#if value} 436function create_if_block$2(ctx) { 437 let filepreview; 438 let current; 439 440 filepreview = new FilePreview$1({ 441 props: { 442 i18n: /*i18n*/ ctx[5], 443 selectable: /*selectable*/ ctx[3], 444 value: /*value*/ ctx[0], 445 height: /*height*/ ctx[4] 446 } 447 }); 448 449 filepreview.$on("select", /*select_handler*/ ctx[6]); 450 451 return { 452 c() { 453 create_component$2(filepreview.$$.fragment); 454 }, 455 m(target, anchor) { 456 mount_component$2(filepreview, target, anchor); 457 current = true; 458 }, 459 p(ctx, dirty) { 460 const filepreview_changes = {}; 461 if (dirty & /*i18n*/ 32) filepreview_changes.i18n = /*i18n*/ ctx[5]; 462 if (dirty & /*selectable*/ 8) filepreview_changes.selectable = /*selectable*/ ctx[3]; 463 if (dirty & /*value*/ 1) filepreview_changes.value = /*value*/ ctx[0]; 464 if (dirty & /*height*/ 16) filepreview_changes.height = /*height*/ ctx[4]; 465 filepreview.$set(filepreview_changes); 466 }, 467 i(local) { 468 if (current) return; 469 transition_in$2(filepreview.$$.fragment, local); 470 current = true; 471 }, 472 o(local) { 473 transition_out$2(filepreview.$$.fragment, local); 474 current = false; 475 }, 476 d(detaching) { 477 destroy_component$2(filepreview, detaching); 478 } 479 }; 480} 481 482// (22:1) <Empty unpadded_box={true} size="large"> 483function create_default_slot$2(ctx) { 484 let file; 485 let current; 486 file = new File$1({}); 487 488 return { 489 c() { 490 create_component$2(file.$$.fragment); 491 }, 492 m(target, anchor) { 493 mount_component$2(file, target, anchor); 494 current = true; 495 }, 496 i(local) { 497 if (current) return; 498 transition_in$2(file.$$.fragment, local); 499 current = true; 500 }, 501 o(local) { 502 transition_out$2(file.$$.fragment, local); 503 current = false; 504 }, 505 d(detaching) { 506 destroy_component$2(file, detaching); 507 } 508 }; 509} 510 511function create_fragment$2(ctx) { 512 let blocklabel; 513 let t; 514 let current_block_type_index; 515 let if_block; 516 let if_block_anchor; 517 let current; 518 519 blocklabel = new BlockLabel({ 520 props: { 521 show_label: /*show_label*/ ctx[2], 522 float: /*value*/ ctx[0] === null, 523 Icon: File$1, 524 label: /*label*/ ctx[1] || "File" 525 } 526 }); 527 528 const if_block_creators = [create_if_block$2, create_else_block$2]; 529 const if_blocks = []; 530 531 function select_block_type(ctx, dirty) { 532 if (/*value*/ ctx[0]) return 0; 533 return 1; 534 } 535 536 current_block_type_index = select_block_type(ctx); 537 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 538 539 return { 540 c() { 541 create_component$2(blocklabel.$$.fragment); 542 t = space$2(); 543 if_block.c(); 544 if_block_anchor = empty$2(); 545 }, 546 m(target, anchor) { 547 mount_component$2(blocklabel, target, anchor); 548 insert$2(target, t, anchor); 549 if_blocks[current_block_type_index].m(target, anchor); 550 insert$2(target, if_block_anchor, anchor); 551 current = true; 552 }, 553 p(ctx, [dirty]) { 554 const blocklabel_changes = {};
555 if (dirty & /*show_label*/ 4) blocklabel_changes.show_label = /*show_label*/ ctx[2]; 556 if (dirty & /*value*/ 1) blocklabel_changes.float = /*value*/ ctx[0] === null; 557 if (dirty & /*label*/ 2) blocklabel_changes.label = /*label*/ ctx[1] || "File"; 558 blocklabel.$set(blocklabel_changes); 559 let previous_block_index = current_block_type_index; 560 current_block_type_index = select_block_type(ctx); 561 562 if (current_block_type_index === previous_block_index) { 563 if_blocks[current_block_type_index].p(ctx, dirty); 564 } else { 565 group_outros$2(); 566 567 transition_out$2(if_blocks[previous_block_index], 1, 1, () => { 568 if_blocks[previous_block_index] = null; 569 }); 570 571 check_outros$2(); 572 if_block = if_blocks[current_block_type_index]; 573 574 if (!if_block) { 575 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 576 if_block.c(); 577 } else { 578 if_block.p(ctx, dirty); 579 } 580 581 transition_in$2(if_block, 1); 582 if_block.m(if_block_anchor.parentNode, if_block_anchor); 583 } 584 }, 585 i(local) { 586 if (current) return; 587 transition_in$2(blocklabel.$$.fragment, local); 588 transition_in$2(if_block); 589 current = true; 590 }, 591 o(local) { 592 transition_out$2(blocklabel.$$.fragment, local); 593 transition_out$2(if_block); 594 current = false; 595 }, 596 d(detaching) { 597 if (detaching) { 598 detach$2(t); 599 detach$2(if_block_anchor); 600 } 601 602 destroy_component$2(blocklabel, detaching); 603 if_blocks[current_block_type_index].d(detaching); 604 } 605 }; 606} 607 608function instance$2($$self, $$props, $$invalidate) { 609 let { value = null } = $$props; 610 let { label } = $$props; 611 let { show_label = true } = $$props; 612 let { selectable = false } = $$props; 613 let { height = undefined } = $$props; 614 let { i18n } = $$props; 615 616 function select_handler(event) { 617 bubble$1.call(this, $$self, event); 618 } 619 620 $$self.$$set = $$props => {
621 if ('value' in $$props) $$invalidate(0, value = $$props.value); 622 if ('label' in $$props) $$invalidate(1, label = $$props.label); 623 if ('show_label' in $$props) $$invalidate(2, show_label = $$props.show_label); 624 if ('selectable' in $$props) $$invalidate(3, selectable = $$props.selectable); 625 if ('height' in $$props) $$invalidate(4, height = $$props.height); 626 if ('i18n' in $$props) $$invalidate(5, i18n = $$props.i18n); 627 }; 628 629 return [value, label, show_label, selectable, height, i18n, select_handler]; 630} 631 632class File_1 extends SvelteComponent$2 { 633 constructor(options) { 634 super(); 635 636 init$2(this, options, instance$2, create_fragment$2, safe_not_equal$2, { 637 value: 0, 638 label: 1, 639 show_label: 2, 640 selectable: 3, 641 height: 4, 642 i18n: 5 643 }); 644 } 645} 646 647const File = File_1; 648 649/* home/runner/work/gradio/gradio/js/file/shared/FileUpload.svelte generated by Svelte v4.2.2 */ 650const { 651 SvelteComponent: SvelteComponent$1, 652 add_flush_callback, 653 bind, 654 binding_callbacks, 655 bubble, 656 check_outros: check_outros$1, 657 create_component: create_component$1, 658 create_slot, 659 destroy_component: destroy_component$1, 660 detach: detach$1, 661 empty: empty$1, 662 get_all_dirty_from_scope, 663 get_slot_changes, 664 group_outros: group_outros$1, 665 init: init$1, 666 insert: insert$1, 667 mount_component: mount_component$1, 668 safe_not_equal: safe_not_equal$1, 669 space: space$1, 670 transition_in: transition_in$1, 671 transition_out: transition_out$1, 672 update_slot_base 673} = window.__gradio__svelte__internal; 674const { createEventDispatcher, tick } = window.__gradio__svelte__internal; 675function create_else_block$1(ctx) { 676 let upload; 677 let updating_dragging; 678 let current; 679 680 function upload_dragging_binding(value) { 681 /*upload_dragging_binding*/ ctx[15](value); 682 } 683 684 let upload_props = { 685 filetype: /*accept_file_types*/ ctx[9], 686 file_count: /*file_count*/ ctx[3], 687 root: /*root*/ ctx[5], 688 $$slots: { default: [create_default_slot$1] }, 689 $$scope: { ctx } 690 }; 691 692 if (/*dragging*/ ctx[8] !== void 0) { 693 upload_props.dragging = /*dragging*/ ctx[8]; 694 } 695 696 upload = new Upload({ props: upload_props }); 697 binding_callbacks.push(() => bind(upload, 'dragging', upload_dragging_binding)); 698 upload.$on("load", /*handle_upload*/ ctx[10]); 699 700 return { 701 c() { 702 create_component$1(upload.$$.fragment); 703 }, 704 m(target, anchor) { 705 mount_component$1(upload, target, anchor); 706 current = true; 707 }, 708 p(ctx, dirty) { 709 const upload_changes = {}; 710 if (dirty & /*accept_file_types*/ 512) upload_changes.filetype = /*accept_file_types*/ ctx[9]; 711 if (dirty & /*file_count*/ 8) upload_changes.file_count = /*file_count*/ ctx[3]; 712 if (dirty & /*root*/ 32) upload_changes.root = /*root*/ ctx[5]; 713 714 if (dirty & /*$$scope*/ 65536) { 715 upload_changes.$$scope = { dirty, ctx }; 716 } 717 718 if (!updating_dragging && dirty & /*dragging*/ 256) { 719 updating_dragging = true; 720 upload_changes.dragging = /*dragging*/ ctx[8]; 721 add_flush_callback(() => updating_dragging = false); 722 } 723 724 upload.$set(upload_changes); 725 }, 726 i(local) { 727 if (current) return; 728 transition_in$1(upload.$$.fragment, local); 729 current = true; 730 }, 731 o(local) { 732 transition_out$1(upload.$$.fragment, local); 733 current = false; 734 }, 735 d(detaching) { 736 destroy_component$1(upload, detaching); 737 } 738 }; 739} 740 741// (51:0) {#if value} 742function create_if_block$1(ctx) { 743 let modifyupload; 744 let t; 745 let filepreview; 746 let current; 747 748 modifyupload = new ModifyUpload({ 749 props: { i18n: /*i18n*/ ctx[7], absolute: true } 750 }); 751 752 modifyupload.$on("clear", /*handle_clear*/ ctx[11]); 753 754 filepreview = new FilePreview$1({ 755 props: { 756 i18n: /*i18n*/ ctx[7], 757 selectable: /*selectable*/ ctx[4], 758 value: /*value*/ ctx[0], 759 height: /*height*/ ctx[6] 760 } 761 }); 762 763 filepreview.$on("select", /*select_handler*/ ctx[14]); 764 765 return { 766 c() { 767 create_component$1(modifyupload.$$.fragment); 768 t = space$1(); 769 create_component$1(filepreview.$$.fragment); 770 }, 771 m(target, anchor) { 772 mount_component$1(modifyupload, target, anchor); 773 insert$1(target, t, anchor); 774 mount_component$1(filepreview, target, anchor); 775 current = true; 776 }, 777 p(ctx, dirty) { 778 const modifyupload_changes = {};
779 if (dirty & /*i18n*/ 128) modifyupload_changes.i18n = /*i18n*/ ctx[7]; 780 modifyupload.$set(modifyupload_changes); 781 const filepreview_changes = {}; 782 if (dirty & /*i18n*/ 128) filepreview_changes.i18n = /*i18n*/ ctx[7]; 783 if (dirty & /*selectable*/ 16) filepreview_changes.selectable = /*selectable*/ ctx[4]; 784 if (dirty & /*value*/ 1) filepreview_changes.value = /*value*/ ctx[0]; 785 if (dirty & /*height*/ 64) filepreview_changes.height = /*height*/ ctx[6]; 786 filepreview.$set(filepreview_changes); 787 }, 788 i(local) { 789 if (current) return; 790 transition_in$1(modifyupload.$$.fragment, local); 791 transition_in$1(filepreview.$$.fragment, local); 792 current = true; 793 }, 794 o(local) { 795 transition_out$1(modifyupload.$$.fragment, local); 796 transition_out$1(filepreview.$$.fragment, local); 797 current = false; 798 }, 799 d(detaching) { 800 if (detaching) { 801 detach$1(t); 802 } 803 804 destroy_component$1(modifyupload, detaching); 805 destroy_component$1(filepreview, detaching); 806 } 807 }; 808} 809 810// (55:1) <Upload on:load={handle_upload} filetype={accept_file_types} {file_count} {root} bind:dragging > 811function create_default_slot$1(ctx) { 812 let current; 813 const default_slot_template = /*#slots*/ ctx[13].default; 814 const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[16], null); 815 816 return { 817 c() { 818 if (default_slot) default_slot.c(); 819 }, 820 m(target, anchor) { 821 if (default_slot) { 822 default_slot.m(target, anchor); 823 } 824 825 current = true; 826 }, 827 p(ctx, dirty) { 828 if (default_slot) { 829 if (default_slot.p && (!current || dirty & /*$$scope*/ 65536)) { 830 update_slot_base( 831 default_slot, 832 default_slot_template, 833 ctx, 834 /*$$scope*/ ctx[16], 835 !current 836 ? get_all_dirty_from_scope(/*$$scope*/ ctx[16]) 837 : get_slot_changes(default_slot_template, /*$$scope*/ ctx[16], dirty, null), 838 null 839 ); 840 } 841 } 842 }, 843 i(local) { 844 if (current) return; 845 transition_in$1(default_slot, local); 846 current = true; 847 }, 848 o(local) { 849 transition_out$1(default_slot, local); 850 current = false; 851 }, 852 d(detaching) { 853 if (default_slot) default_slot.d(detaching); 854 } 855 }; 856} 857 858function create_fragment$1(ctx) { 859 let blocklabel; 860 let t; 861 let current_block_type_index; 862 let if_block; 863 let if_block_anchor; 864 let current; 865 866 blocklabel = new BlockLabel({ 867 props: { 868 show_label: /*show_label*/ ctx[2], 869 Icon: File$1, 870 float: /*value*/ ctx[0] === null, 871 label: /*label*/ ctx[1] || "File" 872 } 873 }); 874 875 const if_block_creators = [create_if_block$1, create_else_block$1]; 876 const if_blocks = []; 877 878 function select_block_type(ctx, dirty) { 879 if (/*value*/ ctx[0]) return 0; 880 return 1; 881 } 882 883 current_block_type_index = select_block_type(ctx); 884 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 885 886 return { 887 c() { 888 create_component$1(blocklabel.$$.fragment); 889 t = space$1(); 890 if_block.c(); 891 if_block_anchor = empty$1(); 892 }, 893 m(target, anchor) { 894 mount_component$1(blocklabel, target, anchor); 895 insert$1(target, t, anchor); 896 if_blocks[current_block_type_index].m(target, anchor); 897 insert$1(target, if_block_anchor, anchor); 898 current = true; 899 }, 900 p(ctx, [dirty]) { 901 const blocklabel_changes = {}; 902 if (dirty & /*show_label*/ 4) blocklabel_changes.show_label = /*show_label*/ ctx[2]; 903 if (dirty & /*value*/ 1) blocklabel_changes.float = /*value*/ ctx[0] === null; 904 if (dirty & /*label*/ 2) blocklabel_changes.label = /*label*/ ctx[1] || "File"; 905 blocklabel.$set(blocklabel_changes); 906 let previous_block_index = current_block_type_index; 907 current_block_type_index = select_block_type(ctx); 908 909 if (current_block_type_index === previous_block_index) { 910 if_blocks[current_block_type_index].p(ctx, dirty); 911 } else { 912 group_outros$1(); 913 914 transition_out$1(if_blocks[previous_block_index], 1, 1, () => { 915 if_blocks[previous_block_index] = null; 916 }); 917 918 check_outros$1(); 919 if_block = if_blocks[current_block_type_index]; 920 921 if (!if_block) { 922 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 923 if_block.c(); 924 } else { 925 if_block.p(ctx, dirty); 926 } 927 928 transition_in$1(if_block, 1); 929 if_block.m(if_block_anchor.parentNode, if_block_anchor); 930 } 931 }, 932 i(local) { 933 if (current) return; 934 transition_in$1(blocklabel.$$.fragment, local); 935 transition_in$1(if_block); 936 current = true; 937 }, 938 o(local) { 939 transition_out$1(blocklabel.$$.fragment, local); 940 transition_out$1(if_block); 941 current = false;
942 }, 943 d(detaching) { 944 if (detaching) { 945 detach$1(t); 946 detach$1(if_block_anchor); 947 } 948 949 destroy_component$1(blocklabel, detaching); 950 if_blocks[current_block_type_index].d(detaching); 951 } 952 }; 953} 954 955function instance$1($$self, $$props, $$invalidate) { 956 let { $$slots: slots = {}, $$scope } = $$props; 957 let { value } = $$props; 958 let { label } = $$props; 959 let { show_label = true } = $$props; 960 let { file_count = "single" } = $$props; 961 let { file_types = null } = $$props; 962 let { selectable = false } = $$props; 963 let { root } = $$props; 964 let { height = undefined } = $$props; 965 let { i18n } = $$props; 966 967 async function handle_upload({ detail }) { 968 $$invalidate(0, value = detail); 969 await tick(); 970 dispatch("change", value); 971 dispatch("upload", detail); 972 } 973 974 function handle_clear() { 975 $$invalidate(0, value = null); 976 dispatch("change", null); 977 dispatch("clear"); 978 } 979 980 const dispatch = createEventDispatcher(); 981 let accept_file_types; 982 983 if (file_types == null) { 984 accept_file_types = null; 985 } else { 986 file_types = file_types.map(x => { 987 if (x.startsWith(".")) { 988 return x; 989 } 990 991 return x + "/*"; 992 }); 993 994 accept_file_types = file_types.join(", "); 995 } 996 997 let dragging = false; 998 999 function select_handler(event) { 1000 bubble.call(this, $$self, event); 1001 } 1002 1003 function upload_dragging_binding(value) { 1004 dragging = value; 1005 $$invalidate(8, dragging); 1006 } 1007 1008 $$self.$$set = $$props => {
1009 if ('value' in $$props) $$invalidate(0, value = $$props.value); 1010 if ('label' in $$props) $$invalidate(1, label = $$props.label); 1011 if ('show_label' in $$props) $$invalidate(2, show_label = $$props.show_label); 1012 if ('file_count' in $$props) $$invalidate(3, file_count = $$props.file_count); 1013 if ('file_types' in $$props) $$invalidate(12, file_types = $$props.file_types); 1014 if ('selectable' in $$props) $$invalidate(4, selectable = $$props.selectable); 1015 if ('root' in $$props) $$invalidate(5, root = $$props.root); 1016 if ('height' in $$props) $$invalidate(6, height = $$props.height); 1017 if ('i18n' in $$props) $$invalidate(7, i18n = $$props.i18n); 1018 if ('$$scope' in $$props) $$invalidate(16, $$scope = $$props.$$scope); 1019 }; 1020 1021 $$self.$$.update = () => { 1022 if ($$self.$$.dirty & /*dragging*/ 256) { 1023 dispatch("drag", dragging); 1024 } 1025 }; 1026 1027 return [ 1028 value, 1029 label, 1030 show_label, 1031 file_count, 1032 selectable, 1033 root, 1034 height, 1035 i18n, 1036 dragging, 1037 accept_file_types, 1038 handle_upload, 1039 handle_clear, 1040 file_types, 1041 slots, 1042 select_handler, 1043 upload_dragging_binding, 1044 $$scope 1045 ]; 1046} 1047 1048class FileUpload extends SvelteComponent$1 { 1049 constructor(options) { 1050 super(); 1051 1052 init$1(this, options, instance$1, create_fragment$1, safe_not_equal$1, { 1053 value: 0, 1054 label: 1, 1055 show_label: 2, 1056 file_count: 3, 1057 file_types: 12, 1058 selectable: 4, 1059 root: 5, 1060 height: 6, 1061 i18n: 7 1062 }); 1063 } 1064} 1065 1066const FileUpload$1 = FileUpload; 1067 1068/* home/runner/work/gradio/gradio/js/file/Index.svelte generated by Svelte v4.2.2 */ 1069const { 1070 SvelteComponent, 1071 assign, 1072 check_outros, 1073 create_component, 1074 destroy_component, 1075 detach, 1076 empty, 1077 flush, 1078 get_spread_object, 1079 get_spread_update, 1080 group_outros, 1081 init, 1082 insert, 1083 mount_component, 1084 safe_not_equal, 1085 space, 1086 transition_in, 1087 transition_out 1088} = window.__gradio__svelte__internal; 1089function create_else_block(ctx) { 1090 let fileupload; 1091 let current; 1092 1093 fileupload = new FileUpload$1({ 1094 props: { 1095 label: /*label*/ ctx[6], 1096 show_label: /*show_label*/ ctx[7], 1097 value: /*_value*/ ctx[17], 1098 file_count: /*file_count*/ ctx[15], 1099 file_types: /*file_types*/ ctx[16], 1100 selectable: /*_selectable*/ ctx[9], 1101 root: /*root*/ ctx[5], 1102 height: /*height*/ ctx[8], 1103 i18n: /*gradio*/ ctx[14].i18n, 1104 $$slots: { default: [create_default_slot_1] }, 1105 $$scope: { ctx } 1106 } 1107 }); 1108 1109 fileupload.$on("change", /*change_handler*/ ctx[22]); 1110 fileupload.$on("drag", /*drag_handler*/ ctx[23]); 1111 fileupload.$on("clear", /*clear_handler*/ ctx[24]); 1112 fileupload.$on("select", /*select_handler_1*/ ctx[25]); 1113 fileupload.$on("upload", /*upload_handler*/ ctx[26]); 1114 1115 return { 1116 c() { 1117 create_component(fileupload.$$.fragment); 1118 }, 1119 m(target, anchor) { 1120 mount_component(fileupload, target, anchor); 1121 current = true; 1122 }, 1123 p(ctx, dirty) { 1124 const fileupload_changes = {}; 1125 if (dirty & /*label*/ 64) fileupload_changes.label = /*label*/ ctx[6]; 1126 if (dirty & /*show_label*/ 128) fileupload_changes.show_label = /*show_label*/ ctx[7]; 1127 if (dirty & /*_value*/ 131072) fileupload_changes.value = /*_value*/ ctx[17]; 1128 if (dirty & /*file_count*/ 32768) fileupload_changes.file_count = /*file_count*/ ctx[15]; 1129 if (dirty & /*file_types*/ 65536) fileupload_changes.file_types = /*file_types*/ ctx[16]; 1130 if (dirty & /*_selectable*/ 512) fileupload_changes.selectable = /*_selectable*/ ctx[9]; 1131 if (dirty & /*root*/ 32) fileupload_changes.root = /*root*/ ctx[5]; 1132 if (dirty & /*height*/ 256) fileupload_changes.height = /*height*/ ctx[8]; 1133 if (dirty & /*gradio*/ 16384) fileupload_changes.i18n = /*gradio*/ ctx[14].i18n; 1134 1135 if (dirty & /*$$scope, gradio*/ 134234112) { 1136 fileupload_changes.$$scope = { dirty, ctx }; 1137 } 1138 1139 fileupload.$set(fileupload_changes); 1140 }, 1141 i(local) { 1142 if (current) return; 1143 transition_in(fileupload.$$.fragment, local); 1144 current = true; 1145 }, 1146 o(local) { 1147 transition_out(fileupload.$$.fragment, local); 1148 current = false; 1149 }, 1150 d(detaching) { 1151 destroy_component(fileupload, detaching); 1152 } 1153 }; 1154} 1155 1156// (62:1) {#if !interactive} 1157function create_if_block(ctx) { 1158 let file; 1159 let current; 1160 1161 file = new File({ 1162 props: { 1163 selectable: /*_selectable*/ ctx[9], 1164 value: /*_value*/ ctx[17], 1165 label: /*label*/ ctx[6], 1166 show_label: /*show_label*/ ctx[7], 1167 height: /*height*/ ctx[8], 1168 i18n: /*gradio*/ ctx[14].i18n 1169 } 1170 }); 1171 1172 file.$on("select", /*select_handler*/ ctx[21]); 1173 1174 return { 1175 c() { 1176 create_component(file.$$.fragment); 1177 }, 1178 m(target, anchor) { 1179 mount_component(file, target, anchor); 1180 current = true; 1181 }, 1182 p(ctx, dirty) { 1183 const file_changes = {};
1184 if (dirty & /*_selectable*/ 512) file_changes.selectable = /*_selectable*/ ctx[9]; 1185 if (dirty & /*_value*/ 131072) file_changes.value = /*_value*/ ctx[17]; 1186 if (dirty & /*label*/ 64) file_changes.label = /*label*/ ctx[6]; 1187 if (dirty & /*show_label*/ 128) file_changes.show_label = /*show_label*/ ctx[7]; 1188 if (dirty & /*height*/ 256) file_changes.height = /*height*/ ctx[8]; 1189 if (dirty & /*gradio*/ 16384) file_changes.i18n = /*gradio*/ ctx[14].i18n; 1190 file.$set(file_changes); 1191 }, 1192 i(local) { 1193 if (current) return; 1194 transition_in(file.$$.fragment, local); 1195 current = true; 1196 }, 1197 o(local) { 1198 transition_out(file.$$.fragment, local); 1199 current = false; 1200 }, 1201 d(detaching) { 1202 destroy_component(file, detaching); 1203 } 1204 }; 1205} 1206 1207// (73:2) <FileUpload {label} {show_label} value={_value} {file_count} {file_types} selectable={_selectable} {root} {height} on:change={({ detail }) => { value = detail; }} on:drag={({ detail }) => (dragging = detail)} on:clear={() => gradio.dispatch("clear")} on:select={({ detail }) => gradio.dispatch("select", detail)} on:upload={() => gradio.dispatch("upload")} i18n={gradio.i18n} > 1208function create_default_slot_1(ctx) { 1209 let uploadtext; 1210 let current; 1211 1212 uploadtext = new UploadText({ 1213 props: { 1214 i18n: /*gradio*/ ctx[14].i18n, 1215 type: "file" 1216 } 1217 }); 1218 1219 return { 1220 c() { 1221 create_component(uploadtext.$$.fragment); 1222 }, 1223 m(target, anchor) { 1224 mount_component(uploadtext, target, anchor); 1225 current = true; 1226 }, 1227 p(ctx, dirty) { 1228 const uploadtext_changes = {}; 1229 if (dirty & /*gradio*/ 16384) uploadtext_changes.i18n = /*gradio*/ ctx[14].i18n; 1230 uploadtext.$set(uploadtext_changes); 1231 }, 1232 i(local) { 1233 if (current) return; 1234 transition_in(uploadtext.$$.fragment, local); 1235 current = true; 1236 }, 1237 o(local) { 1238 transition_out(uploadtext.$$.fragment, local); 1239 current = false; 1240 }, 1241 d(detaching) { 1242 destroy_component(uploadtext, detaching); 1243 } 1244 }; 1245} 1246 1247// (42:0) <Block {visible} variant={value === null ? "dashed" : "solid"} border_mode={dragging ? "focus" : "base"} padding={false} {elem_id} {elem_classes} {container} {scale} {min_width} allow_overflow={false} > 1248function create_default_slot(ctx) { 1249 let statustracker; 1250 let t; 1251 let current_block_type_index; 1252 let if_block; 1253 let if_block_anchor; 1254 let current; 1255 1256 const statustracker_spread_levels = [ 1257 { 1258 autoscroll: /*gradio*/ ctx[14].autoscroll 1259 }, 1260 { i18n: /*gradio*/ ctx[14].i18n }, 1261 /*loading_status*/ ctx[10], 1262 { 1263 status: /*loading_status*/ ctx[10]?.status || "complete" 1264 } 1265 ]; 1266 1267 let statustracker_props = {}; 1268 1269 for (let i = 0; i < statustracker_spread_levels.length; i += 1) { 1270 statustracker_props = assign(statustracker_props, statustracker_spread_levels[i]); 1271 } 1272 1273 statustracker = new Static({ props: statustracker_props }); 1274 const if_block_creators = [create_if_block, create_else_block]; 1275 const if_blocks = []; 1276 1277 function select_block_type(ctx, dirty) { 1278 if (!/*interactive*/ ctx[4]) return 0; 1279 return 1; 1280 } 1281 1282 current_block_type_index = select_block_type(ctx); 1283 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 1284 1285 return { 1286 c() { 1287 create_component(statustracker.$$.fragment); 1288 t = space(); 1289 if_block.c(); 1290 if_block_anchor = empty(); 1291 }, 1292 m(target, anchor) { 1293 mount_component(statustracker, target, anchor); 1294 insert(target, t, anchor); 1295 if_blocks[current_block_type_index].m(target, anchor); 1296 insert(target, if_block_anchor, anchor); 1297 current = true; 1298 }, 1299 p(ctx, dirty) { 1300 const statustracker_changes = (dirty & /*gradio, loading_status, pending_upload*/ 17408) 1301 ? get_spread_update(statustracker_spread_levels, [ 1302 dirty & /*gradio*/ 16384 && { 1303 autoscroll: /*gradio*/ ctx[14].autoscroll 1304 }, 1305 dirty & /*gradio*/ 16384 && { i18n: /*gradio*/ ctx[14].i18n }, 1306 dirty & /*loading_status*/ 1024 && get_spread_object(/*loading_status*/ ctx[10]), 1307 dirty & /*pending_upload, loading_status*/ 1024 && { 1308 status: /*loading_status*/ ctx[10]?.status || "complete" 1309 } 1310 ]) 1311 : {}; 1312 1313 statustracker.$set(statustracker_changes); 1314 let previous_block_index = current_block_type_index; 1315 current_block_type_index = select_block_type(ctx); 1316 1317 if (current_block_type_index === previous_block_index) { 1318 if_blocks[current_block_type_index].p(ctx, dirty); 1319 } else { 1320 group_outros(); 1321 1322 transition_out(if_blocks[previous_block_index], 1, 1, () => { 1323 if_blocks[previous_block_index] = null; 1324 }); 1325 1326 check_outros(); 1327 if_block = if_blocks[current_block_type_index]; 1328 1329 if (!if_block) { 1330 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 1331 if_block.c(); 1332 } else { 1333 if_block.p(ctx, dirty); 1334 } 1335 1336 transition_in(if_block, 1); 1337 if_block.m(if_block_anchor.parentNode, if_block_anchor); 1338 } 1339 }, 1340 i(local) { 1341 if (current) return; 1342 transition_in(statustracker.$$.fragment, local); 1343 transition_in(if_block); 1344 current = true; 1345 }, 1346 o(local) { 1347 transition_out(statustracker.$$.fragment, local); 1348 transition_out(if_block); 1349 current = false;
1350 }, 1351 d(detaching) { 1352 if (detaching) { 1353 detach(t); 1354 detach(if_block_anchor); 1355 } 1356 1357 destroy_component(statustracker, detaching); 1358 if_blocks[current_block_type_index].d(detaching); 1359 } 1360 }; 1361} 1362 1363function create_fragment(ctx) { 1364 let block; 1365 let current; 1366 1367 block = new Block({ 1368 props: { 1369 visible: /*visible*/ ctx[3], 1370 variant: /*value*/ ctx[0] === null ? "dashed" : "solid", 1371 border_mode: /*dragging*/ ctx[18] ? "focus" : "base", 1372 padding: false, 1373 elem_id: /*elem_id*/ ctx[1], 1374 elem_classes: /*elem_classes*/ ctx[2], 1375 container: /*container*/ ctx[11], 1376 scale: /*scale*/ ctx[12], 1377 min_width: /*min_width*/ ctx[13], 1378 allow_overflow: false, 1379 $$slots: { default: [create_default_slot] }, 1380 $$scope: { ctx } 1381 } 1382 }); 1383 1384 return { 1385 c() { 1386 create_component(block.$$.fragment); 1387 }, 1388 m(target, anchor) { 1389 mount_component(block, target, anchor); 1390 current = true; 1391 }, 1392 p(ctx, [dirty]) { 1393 const block_changes = {}; 1394 if (dirty & /*visible*/ 8) block_changes.visible = /*visible*/ ctx[3]; 1395 if (dirty & /*value*/ 1) block_changes.variant = /*value*/ ctx[0] === null ? "dashed" : "solid"; 1396 if (dirty & /*dragging*/ 262144) block_changes.border_mode = /*dragging*/ ctx[18] ? "focus" : "base"; 1397 if (dirty & /*elem_id*/ 2) block_changes.elem_id = /*elem_id*/ ctx[1]; 1398 if (dirty & /*elem_classes*/ 4) block_changes.elem_classes = /*elem_classes*/ ctx[2]; 1399 if (dirty & /*container*/ 2048) block_changes.container = /*container*/ ctx[11]; 1400 if (dirty & /*scale*/ 4096) block_changes.scale = /*scale*/ ctx[12]; 1401 if (dirty & /*min_width*/ 8192) block_changes.min_width = /*min_width*/ ctx[13]; 1402 1403 if (dirty & /*$$scope, _selectable, _value, label, show_label, height, gradio, interactive, file_count, file_types, root, value, dragging, loading_status*/ 134727665) { 1404 block_changes.$$scope = { dirty, ctx }; 1405 } 1406 1407 block.$set(block_changes); 1408 }, 1409 i(local) { 1410 if (current) return; 1411 transition_in(block.$$.fragment, local); 1412 current = true; 1413 }, 1414 o(local) { 1415 transition_out(block.$$.fragment, local); 1416 current = false; 1417 }, 1418 d(detaching) { 1419 destroy_component(block, detaching); 1420 } 1421 }; 1422} 1423 1424function instance($$self, $$props, $$invalidate) { 1425 let _value; 1426 let { elem_id = "" } = $$props; 1427 let { elem_classes = [] } = $$props; 1428 let { visible = true } = $$props; 1429 let { value } = $$props; 1430 let { interactive } = $$props; 1431 let { root } = $$props; 1432 let { label } = $$props; 1433 let { show_label } = $$props; 1434 let { height = undefined } = $$props; 1435 let { proxy_url } = $$props; 1436 let { _selectable = false } = $$props; 1437 let { loading_status } = $$props; 1438 let { container = true } = $$props; 1439 let { scale = null } = $$props; 1440 let { min_width = undefined } = $$props; 1441 let { gradio } = $$props; 1442 let { file_count } = $$props; 1443 let { file_types = ["file"] } = $$props; 1444 let old_value = _value; 1445 let dragging = false; 1446 const select_handler = ({ detail }) => gradio.dispatch("select", detail); 1447 1448 const change_handler = ({ detail }) => { 1449 $$invalidate(0, value = detail); 1450 }; 1451 1452 const drag_handler = ({ detail }) =>
1452 $$invalidate(18, dragging = detail); 1453 const clear_handler = () => gradio.dispatch("clear"); 1454 const select_handler_1 = ({ detail }) => gradio.dispatch("select", detail); 1455 const upload_handler = () => gradio.dispatch("upload"); 1456 1457 $$self.$$set = $$props => { 1458 if ('elem_id' in $$props) $$invalidate(1, elem_id = $$props.elem_id); 1459 if ('elem_classes' in $$props) $$invalidate(2, elem_classes = $$props.elem_classes); 1460 if ('visible' in $$props) $$invalidate(3, visible = $$props.visible); 1461 if ('value' in $$props) $$invalidate(0, value = $$props.value); 1462 if ('interactive' in $$props) $$invalidate(4, interactive = $$props.interactive); 1463 if ('root' in $$props) $$invalidate(5, root = $$props.root); 1464 if ('label' in $$props) $$invalidate(6, label = $$props.label); 1465 if ('show_label' in $$props) $$invalidate(7, show_label = $$props.show_label); 1466 if ('height' in $$props) $$invalidate(8, height = $$props.height); 1467 if ('proxy_url' in $$props) $$invalidate(19, proxy_url = $$props.proxy_url); 1468 if ('_selectable' in $$props) $$invali
1468date(9, _selectable = $$props._selectable); 1469 if ('loading_status' in $$props) $$invalidate(10, loading_status = $$props.loading_status); 1470 if ('container' in $$props) $$invalidate(11, container = $$props.container); 1471 if ('scale' in $$props) $$invalidate(12, scale = $$props.scale); 1472 if ('min_width' in $$props) $$invalidate(13, min_width = $$props.min_width); 1473 if ('gradio' in $$props) $$invalidate(14, gradio = $$props.gradio); 1474 if ('file_count' in $$props) $$invalidate(15, file_count = $$props.file_count); 1475 if ('file_types' in $$props) $$invalidate(16, file_types = $$props.file_types); 1476 }; 1477 1478 $$self.$$.update = () => { 1479 if ($$self.$$.dirty & /*value, root, proxy_url*/ 524321) { 1480 $$invalidate(17, _value = normalise_file(value, root, proxy_url)); 1481 } 1482 1483 if ($$self.$$.dirty & /*old_value, _value, gradio*/ 1196032) { 1484 if (JSON.stringify(old_value) !== JSON.stringify(_value)) { 1485 gradio.dispatch("change"); 1486 $$invalidate(20, old_value = _value); 1487 } 1488 } 1489 }; 1490 1491 return [ 1492 value, 1493 elem_id, 1494 elem_classes, 1495 visible, 1496 interactive, 1497 root, 1498 label, 1499 show_label, 1500 height, 1501 _selectable, 1502 loading_status, 1503 container, 1504 scale, 1505 min_width, 1506 gradio, 1507 file_count, 1508 file_types, 1509 _value, 1510 dragging, 1511 proxy_url, 1512 old_value, 1513 select_handler, 1514 change_handler, 1515 drag_handler, 1516 clear_handler, 1517 select_handler_1, 1518 upload_handler 1519 ]; 1520} 1521 1522class Index extends SvelteComponent { 1523 constructor(options) { 1524 super(); 1525 1526 init(this, options, instance, create_fragment, safe_not_equal, { 1527 elem_id: 1, 1528 elem_classes: 2, 1529 visible: 3, 1530 value: 0, 1531 interactive: 4, 1532 root: 5, 1533 label: 6, 1534 show_label: 7, 1535 height: 8, 1536 proxy_url: 19, 1537 _selectable: 9, 1538 loading_status: 10, 1539 container: 11, 1540 scale: 12, 1541 min_width: 13, 1542 gradio: 14, 1543 file_count: 15, 1544 file_types: 16 1545 }); 1546 } 1547 1548 get elem_id() { 1549 return this.$$.ctx[1]; 1550 } 1551 1552 set elem_id(elem_id) { 1553 this.$$set({ elem_id }); 1554 flush(); 1555 } 1556 1557 get elem_classes() { 1558 return this.$$.ctx[2]; 1559 } 1560 1561 set elem_classes(elem_classes) { 1562 this.$$set({ elem_classes }); 1563 flush(); 1564 } 1565 1566 get visible() { 1567 return this.$$.ctx[3]; 1568 } 1569 1570 set visible(visible) { 1571 this.$$set({ visible }); 1572 flush(); 1573 } 1574 1575 get value() { 1576 return this.$$.ctx[0]; 1577 } 1578 1579 set value(value) { 1580 this.$$set({ value }); 1581 flush(); 1582 } 1583 1584 get interactive() { 1585 return this.$$.ctx[4]; 1586 } 1587 1588 set interactive(interactive) { 1589 this.$$set({ interactive }); 1590 flush(); 1591 } 1592 1593 get root() { 1594 return this.$$.ctx[5]; 1595 } 1596 1597 set root(root) { 1598 this.$$set({ root }); 1599 flush(); 1600 } 1601 1602 get label() { 1603 return this.$$.ctx[6]; 1604 } 1605 1606 set label(label) { 1607 this.$$set({ label }); 1608 flush(); 1609 } 1610 1611 get show_label() { 1612 return this.$$.ctx[7]; 1613 } 1614 1615 set show_label(show_label) { 1616 this.$$set({ show_label }); 1617 flush(); 1618 } 1619 1620 get height() { 1621 return this.$$.ctx[8]; 1622 } 1623 1624 set height(height) { 1625 this.$$set({ height }); 1626 flush(); 1627 } 1628 1629 get proxy_url() { 1630 return this.$$.ctx[19]; 1631 } 1632 1633 set proxy_url(proxy_url) { 1634 this.$$set({ proxy_url }); 1635 flush(); 1636 } 1637 1638 get _selectable() { 1639 return this.$$.ctx[9]; 1640 } 1641 1642 set _selectable(_selectable) { 1643 this.$$set({ _selectable }); 1644 flush(); 1645 } 1646 1647 get loading_status() { 1648 return this.$$.ctx[10]; 1649 } 1650 1651 set loading_status(loading_status) { 1652 this.$$set({ loading_status }); 1653 flush(); 1654 } 1655 1656 get container() { 1657 return this.$$.ctx[11]; 1658 } 1659 1660 set container(container) { 1661 this.$$set({ container }); 1662 flush(); 1663 } 1664 1665 get scale() { 1666 return this.$$.ctx[12]; 1667 } 1668 1669 set scale(scale) { 1670 this.$$set({ scale }); 1671 flush(); 1672 } 1673 1674 get min_width() { 1675 return this.$$.ctx[13]; 1676 } 1677 1678 set min_width(min_width) { 1679 this.$$set({ min_width }); 1680 flush(); 1681 } 1682 1683 get gradio() { 1684 return this.$$.ctx[14]; 1685 } 1686 1687 set gradio(gradio) { 1688 this.$$set({ gradio }); 1689 flush(); 1690 } 1691 1692 get file_count() { 1693 return this.$$.ctx[15]; 1694 } 1695 1696 set file_count(file_count) { 1697 this.$$set({ file_count }); 1698 flush(); 1699 } 1700 1701 get file_types() { 1702 return this.$$.ctx[16]; 1703 } 1704 1705 set file_types(file_types) { 1706 this.$$set({ file_types }); 1707 flush(); 1708 } 1709} 1710 1711export { File as BaseFile, FileUpload$1 as BaseFileUpload, FilePreview$1 as FilePreview, Index as default }; 1712//# sourceMappingURL=Index-9098679f.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.