1import { I as ImageUploader, S as StaticImage } from './ImageUploader-c0805dd2.js'; 2export { W as Webcam } from './ImageUploader-c0805dd2.js'; 3import { B as Block } from './Button-20c14f3f.js'; 4import { E as Empty } from './Empty-513247fb.js'; 5import { S as Static } from './Index-34f70ab5.js'; 6import { I as Image } from './Image-6cbf81d1.js'; 7import { U as UploadText } from './UploadText-1c7f46b2.js'; 8import { n as normalise_file } from './index-6d9f7a14.js'; 9export { I as BaseImage } from './Image-81c44f01.js'; 10export { default as BaseExample } from './Example-9525fda4.js'; 11import './utils-8f25e669.js'; 12import './BlockLabel-01d2e4bc.js'; 13import './IconButton-7a2ae610.js'; 14import './ShareButton-4c59f811.js'; 15import './Download-ea83bae3.js'; 16import './DownloadLink-9c980133.js'; 17import './file-url-9a71ec36.js'; 18import './SelectSource-dae165df.js'; 19import './Upload-c5c1b405.js'; 20import './DropdownArrow-1cc8aef9.js'; 21import './Upload-dd644e1d.js'; 22/* empty css */import './Clear-9760deed.js'; 23import './svelte/svelte.js'; 24/* empty css */ 25/* home/runner/work/gradio/gradio/js/image/Index.svelte generated by Svelte v4.2.2 */ 26const { 27 SvelteComponent, 28 add_flush_callback, 29 assign, 30 bind, 31 binding_callbacks, 32 check_outros, 33 create_component, 34 destroy_component, 35 detach, 36 empty, 37 flush, 38 get_spread_object, 39 get_spread_update, 40 group_outros, 41 init, 42 insert, 43 mount_component, 44 safe_not_equal, 45 space, 46 transition_in, 47 transition_out 48} = window.__gradio__svelte__internal; 49function create_else_block(ctx) { 50 let block; 51 let current; 52 53 block = new Block({ 54 props: { 55 visible: /*visible*/ ctx[4], 56 variant: /*_value*/ ctx[22] === null ? "dashed" : "solid", 57 border_mode: /*dragging*/ ctx[23] ? "focus" : "base", 58 padding: false, 59 elem_id: /*elem_id*/ ctx[2], 60 elem_classes: /*elem_classes*/ ctx[3], 61 height: /*height*/ ctx[9] || undefined, 62 width: /*width*/ ctx[10], 63 allow_overflow: false, 64 container: /*container*/ ctx[12], 65 scale: /*scale*/ ctx[13], 66 min_width: /*min_width*/ ctx[14], 67 $$slots: { default: [create_default_slot_1] }, 68 $$scope: { ctx } 69 } 70 }); 71 72 return { 73 c() { 74 create_component(block.$$.fragment); 75 }, 76 m(target, anchor) { 77 mount_component(block, target, anchor); 78 current = true; 79 }, 80 p(ctx, dirty) { 81 const block_changes = {}; 82 if (dirty[0] & /*visible*/ 16) block_changes.visible = /*visible*/ ctx[4]; 83 if (dirty[0] & /*_value*/ 4194304) block_changes.variant = /*_value*/ ctx[22] === null ? "dashed" : "solid"; 84 if (dirty[0] & /*dragging*/ 8388608) block_changes.border_mode = /*dragging*/ ctx[23] ? "focus" : "base"; 85 if (dirty[0] & /*elem_id*/ 4) block_changes.elem_id = /*elem_id*/ ctx[2]; 86 if (dirty[0] & /*elem_classes*/ 8) block_changes.elem_classes = /*elem_classes*/ ctx[3]; 87 if (dirty[0] & /*height*/ 512) block_changes.height = /*height*/ ctx[9] || undefined; 88 if (dirty[0] & /*width*/ 1024) block_changes.width = /*width*/ ctx[10]; 89 if (dirty[0] & /*container*/ 4096) block_changes.container = /*container*/ ctx[12]; 90 if (dirty[0] & /*scale*/ 8192) block_changes.scale = /*scale*/ ctx[13]; 91 if (dirty[0] & /*min_width*/ 16384) block_changes.min_width = /*min_width*/ ctx[14]; 92 93 if (dirty[0] & /*_selectable, root, sources, label, show_label, pending, streaming, mirror_webcam, gradio, active_source, value, dragging, loading_status*/ 29165923 | dirty[1] & /*$$scope*/ 512) { 94 block_changes.$$scope = { dirty, ctx }; 95 } 96 97 block.$set(block_changes); 98 }, 99 i(local) { 100 if (current) return; 101 transition_in(block.$$.fragment, local); 102 current = true; 103 }, 104 o(local) { 105 transition_out(block.$$.fragment, local); 106 current = false; 107 }, 108 d(detaching) { 109 destroy_component(block, detaching); 110 } 111 }; 112} 113 114// (50:0) {#if !interactive} 115function create_if_block(ctx) { 116 let block; 117 let current; 118 119 block = new Block({ 120 props: { 121 visible: /*visible*/ ctx[4], 122 variant: "solid", 123 border_mode: /*dragging*/ ctx[23] ? "focus" : "base", 124 padding: false, 125 elem_id: /*elem_id*/ ctx[2], 126 elem_classes: /*elem_classes*/ ctx[3], 127 height: /*height*/ ctx[9] || undefined, 128 width: /*width*/ ctx[10], 129 allow_overflow: false, 130 container: /*container*/ ctx[12], 131 scale: /*scale*/ ctx[13], 132 min_width: /*min_width*/ ctx[14], 133 $$slots: { default: [create_default_slot] }, 134 $$scope: { ctx } 135 } 136 }); 137 138 return { 139 c() { 140 create_component(block.$$.fragment); 141 }, 142 m(target, anchor) { 143 mount_component(block, target, anchor); 144 current = true; 145 }, 146 p(ctx, dirty) { 147 const block_changes = {};
148 if (dirty[0] & /*visible*/ 16) block_changes.visible = /*visible*/ ctx[4]; 149 if (dirty[0] & /*dragging*/ 8388608) block_changes.border_mode = /*dragging*/ ctx[23] ? "focus" : "base"; 150 if (dirty[0] & /*elem_id*/ 4) block_changes.elem_id = /*elem_id*/ ctx[2]; 151 if (dirty[0] & /*elem_classes*/ 8) block_changes.elem_classes = /*elem_classes*/ ctx[3]; 152 if (dirty[0] & /*height*/ 512) block_changes.height = /*height*/ ctx[9] || undefined; 153 if (dirty[0] & /*width*/ 1024) block_changes.width = /*width*/ ctx[10]; 154 if (dirty[0] & /*container*/ 4096) block_changes.container = /*container*/ ctx[12]; 155 if (dirty[0] & /*scale*/ 8192) block_changes.scale = /*scale*/ ctx[13]; 156 if (dirty[0] & /*min_width*/ 16384) block_changes.min_width = /*min_width*/ ctx[14]; 157 158 if (dirty[0] & /*_value, label, show_label, show_download_button, _selectable, show_share_button, gradio, loading_status*/ 6326498 | dirty[1] & /*$$scope*/ 512) { 159 block_changes.$$scope = { dirty, ctx }; 160 } 161 162 block.$set(block_changes); 163 }, 164 i(local) { 165 if (current) return; 166 transition_in(block.$$.fragment, local); 167 current = true; 168 }, 169 o(local) { 170 transition_out(block.$$.fragment, local); 171 current = false; 172 }, 173 d(detaching) { 174 destroy_component(block, detaching); 175 } 176 }; 177} 178 179// (135:3) {:else} 180function create_else_block_1(ctx) { 181 let empty_1; 182 let current; 183 184 empty_1 = new Empty({ 185 props: { 186 unpadded_box: true, 187 size: "large", 188 $$slots: { default: [create_default_slot_3] }, 189 $$scope: { ctx } 190 } 191 }); 192 193 return { 194 c() { 195 create_component(empty_1.$$.fragment); 196 }, 197 m(target, anchor) { 198 mount_component(empty_1, target, anchor); 199 current = true; 200 }, 201 p(ctx, dirty) { 202 const empty_1_changes = {}; 203 204 if (dirty[1] & /*$$scope*/ 512) { 205 empty_1_changes.$$scope = { dirty, ctx }; 206 } 207 208 empty_1.$set(empty_1_changes); 209 }, 210 i(local) { 211 if (current) return; 212 transition_in(empty_1.$$.fragment, local); 213 current = true; 214 }, 215 o(local) { 216 transition_out(empty_1.$$.fragment, local); 217 current = false; 218 }, 219 d(detaching) { 220 destroy_component(empty_1, detaching); 221 } 222 }; 223} 224 225// (133:43) 226function create_if_block_2(ctx) { 227 let uploadtext; 228 let current; 229 230 uploadtext = new UploadText({ 231 props: { 232 i18n: /*gradio*/ ctx[21].i18n, 233 type: "clipboard", 234 mode: "short" 235 } 236 }); 237 238 return { 239 c() { 240 create_component(uploadtext.$$.fragment); 241 }, 242 m(target, anchor) { 243 mount_component(uploadtext, target, anchor); 244 current = true; 245 }, 246 p(ctx, dirty) { 247 const uploadtext_changes = {}; 248 if (dirty[0] & /*gradio*/ 2097152) uploadtext_changes.i18n = /*gradio*/ ctx[21].i18n; 249 uploadtext.$set(uploadtext_changes); 250 }, 251 i(local) { 252 if (current) return; 253 transition_in(uploadtext.$$.fragment, local); 254 current = true; 255 }, 256 o(local) { 257 transition_out(uploadtext.$$.fragment, local); 258 current = false; 259 }, 260 d(detaching) { 261 destroy_component(uploadtext, detaching); 262 } 263 }; 264} 265 266// (131:3) {#if active_source === "upload" || !active_source} 267function create_if_block_1(ctx) { 268 let uploadtext; 269 let current; 270 271 uploadtext = new UploadText({ 272 props: { 273 i18n: /*gradio*/ ctx[21].i18n, 274 type: "image" 275 } 276 }); 277 278 return { 279 c() { 280 create_component(uploadtext.$$.fragment); 281 }, 282 m(target, anchor) { 283 mount_component(uploadtext, target, anchor); 284 current = true; 285 }, 286 p(ctx, dirty) { 287 const uploadtext_changes = {}; 288 if (dirty[0] & /*gradio*/ 2097152) uploadtext_changes.i18n = /*gradio*/ ctx[21].i18n; 289 uploadtext.$set(uploadtext_changes); 290 }, 291 i(local) { 292 if (current) return; 293 transition_in(uploadtext.$$.fragment, local); 294 current = true; 295 }, 296 o(local) { 297 transition_out(uploadtext.$$.fragment, local); 298 current = false; 299 }, 300 d(detaching) { 301 destroy_component(uploadtext, detaching); 302 } 303 }; 304} 305 306// (136:4) <Empty unpadded_box={true} size="large"> 307function create_default_slot_3(ctx) { 308 let image; 309 let current; 310 image = new Image({}); 311 312 return { 313 c() { 314 create_component(image.$$.fragment); 315 }, 316 m(target, anchor) { 317 mount_component(image, target, anchor); 318 current = true; 319 }, 320 i(local) { 321 if (current) return; 322 transition_in(image.$$.fragment, local); 323 current = true; 324 }, 325 o(local) { 326 transition_out(image.$$.fragment, local); 327 current = false;
328 }, 329 d(detaching) { 330 destroy_component(image, detaching); 331 } 332 }; 333} 334 335// (104:2) <ImageUploader bind:active_source bind:value selectable={_selectable} {root} {sources} on:edit={() => gradio.dispatch("edit")} on:clear={() => { gradio.dispatch("clear"); }} on:stream={() => gradio.dispatch("stream")} on:drag={({ detail }) => (dragging = detail)} on:upload={() => gradio.dispatch("upload")} on:select={({ detail }) => gradio.dispatch("select", detail)} on:share={({ detail }) => gradio.dispatch("share", detail)} on:error={({ detail }) => { loading_status = loading_status || {}; loading_status.status = "error"; gradio.dispatch("error", detail); }} {label} {show_label} {pending} {streaming} {mirror_webcam} i18n={gradio.i18n} > 336function create_default_slot_2(ctx) { 337 let current_block_type_index; 338 let if_block; 339 let if_block_anchor; 340 let current; 341 const if_block_creators = [create_if_block_1, create_if_block_2, create_else_block_1]; 342 const if_blocks = []; 343 344 function select_block_type_1(ctx, dirty) { 345 if (/*active_source*/ ctx[24] === "upload" || !/*active_source*/ ctx[24]) return 0; 346 if (/*active_source*/ ctx[24] === "clipboard") return 1; 347 return 2; 348 } 349 350 current_block_type_index = select_block_type_1(ctx); 351 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 352 353 return { 354 c() { 355 if_block.c(); 356 if_block_anchor = empty(); 357 }, 358 m(target, anchor) { 359 if_blocks[current_block_type_index].m(target, anchor); 360 insert(target, if_block_anchor, anchor); 361 current = true; 362 }, 363 p(ctx, dirty) { 364 let previous_block_index = current_block_type_index; 365 current_block_type_index = select_block_type_1(ctx); 366 367 if (current_block_type_index === previous_block_index) { 368 if_blocks[current_block_type_index].p(ctx, dirty); 369 } else { 370 group_outros(); 371 372 transition_out(if_blocks[previous_block_index], 1, 1, () => { 373 if_blocks[previous_block_index] = null; 374 }); 375 376 check_outros(); 377 if_block = if_blocks[current_block_type_index]; 378 379 if (!if_block) { 380 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 381 if_block.c(); 382 } else { 383 if_block.p(ctx, dirty); 384 } 385 386 transition_in(if_block, 1); 387 if_block.m(if_block_anchor.parentNode, if_block_anchor); 388 } 389 }, 390 i(local) { 391 if (current) return; 392 transition_in(if_block); 393 current = true; 394 }, 395 o(local) { 396 transition_out(if_block); 397 current = false; 398 }, 399 d(detaching) { 400 if (detaching) { 401 detach(if_block_anchor); 402 } 403 404 if_blocks[current_block_type_index].d(detaching); 405 } 406 }; 407} 408 409// (84:1) <Block {visible} variant={_value === null ? "dashed" : "solid"} border_mode={dragging ? "focus" : "base"} padding={false} {elem_id} {elem_classes} height={height || undefined} {width} allow_overflow={false} {container} {scale} {min_width} > 410function create_default_slot_1(ctx) { 411 let statustracker; 412 let t; 413 let imageuploader; 414 let updating_active_source; 415 let updating_value; 416 let current; 417 418 const statustracker_spread_levels = [ 419 { 420 autoscroll: /*gradio*/ ctx[21].autoscroll 421 }, 422 { i18n: /*gradio*/ ctx[21].i18n }, 423 /*loading_status*/ ctx[1] 424 ]; 425 426 let statustracker_props = {}; 427 428 for (let i = 0; i < statustracker_spread_levels.length; i += 1) { 429 statustracker_props = assign(statustracker_props, statustracker_spread_levels[i]); 430 } 431 432 statustracker = new Static({ props: statustracker_props }); 433 434 function imageuploader_active_source_binding(value) { 435 /*imageuploader_active_source_binding*/ ctx[30](value); 436 } 437 438 function imageuploader_value_binding(value) { 439 /*imageuploader_value_binding*/ ctx[31](value); 440 } 441 442 let imageuploader_props = { 443 selectable: /*_selectable*/ ctx[11], 444 root: /*root*/ ctx[8], 445 sources: /*sources*/ ctx[16], 446 label: /*label*/ ctx[5], 447 show_label: /*show_label*/ ctx[6], 448 pending: /*pending*/ ctx[19], 449 streaming: /*streaming*/ ctx[18], 450 mirror_webcam: /*mirror_webcam*/ ctx[20], 451 i18n: /*gradio*/ ctx[21].i18n, 452 $$slots: { default: [create_default_slot_2] }, 453 $$scope: { ctx } 454 }; 455 456 if (/*active_source*/ ctx[24] !== void 0) { 457 imageuploader_props.active_source = /*active_source*/ ctx[24]; 458 } 459 460 if (/*value*/ ctx[0] !== void 0) { 461 imageuploader_props.value = /*value*/ ctx[0]; 462 } 463 464 imageuploader = new ImageUploader({ props: imageuploader_props }); 465 binding_callbacks.push(() => bind(imageuploader, 'active_source', imageuploader_active_source_binding)); 466 binding_callbacks.push(() => bind(imageuploader, 'value', imageuploader_value_binding)); 467 imageuploader.$on("edit", /*edit_handler*/ ctx[32]); 468 imageuploader.$on("clear", /*clear_handler*/ ctx[33]); 469 imageuploader.$on("stream", /*stream_handler*/ ctx[34]); 470 imageuploader.$on("drag", /*drag_handler*/ ctx[35]); 471 imageuploader.$on("upload", /*upload_handler*/ ctx[36]); 472 imageuploader.$on("select", /*select_handler_1*/ ctx[37]); 473 imageuploader.$on("share", /*share_handler_1*/ ctx[38]); 474 imageuploader.$on("error", /*error_handler_1*/ ctx[39]); 475 476 return { 477 c() { 478 create_component(statustracker.$$.fragment); 479 t = space(); 480 create_component(imageuploader.$$.fragment); 481 }, 482 m(target, anchor) { 483 mount_component(statustracker, target, anchor); 484 insert(target, t, anchor);
485 mount_component(imageuploader, target, anchor); 486 current = true; 487 }, 488 p(ctx, dirty) { 489 const statustracker_changes = (dirty[0] & /*gradio, loading_status*/ 2097154) 490 ? get_spread_update(statustracker_spread_levels, [ 491 dirty[0] & /*gradio*/ 2097152 && { 492 autoscroll: /*gradio*/ ctx[21].autoscroll 493 }, 494 dirty[0] & /*gradio*/ 2097152 && { i18n: /*gradio*/ ctx[21].i18n }, 495 dirty[0] & /*loading_status*/ 2 && get_spread_object(/*loading_status*/ ctx[1]) 496 ]) 497 : {}; 498 499 statustracker.$set(statustracker_changes); 500 const imageuploader_changes = {}; 501 if (dirty[0] & /*_selectable*/ 2048) imageuploader_changes.selectable = /*_selectable*/ ctx[11]; 502 if (dirty[0] & /*root*/ 256) imageuploader_changes.root = /*root*/ ctx[8]; 503 if (dirty[0] & /*sources*/ 65536) imageuploader_changes.sources = /*sources*/ ctx[16]; 504 if (dirty[0] & /*label*/ 32) imageuploader_changes.label = /*label*/ ctx[5]; 505 if (dirty[0] & /*show_label*/ 64) imageuploader_changes.show_label = /*show_label*/ ctx[6]; 506 if (dirty[0] & /*pending*/ 524288) imageuploader_changes.pending = /*pending*/ ctx[19]; 507 if (dirty[0] & /*streaming*/ 262144) imageuploader_changes.streaming = /*streaming*/ ctx[18]; 508 if (dirty[0] & /*mirror_webcam*/ 1048576) imageuploader_changes.mirror_webcam = /*mirror_webcam*/ ctx[20]; 509 if (dirty[0] & /*gradio*/ 2097152) imageuploader_changes.i18n = /*gradio*/ ctx[21].i18n; 510 511 if (dirty[0] & /*gradio, active_source*/ 18874368 | dirty[1] & /*$$scope*/ 512) { 512 imageuploader_changes.$$scope = { dirty, ctx }; 513 } 514 515 if (!updating_active_source && dirty[0] & /*active_source*/ 16777216) { 516 updating_active_source = true; 517 imageuploader_changes.active_source = /*active_source*/ ctx[24]; 518 add_flush_callback(() => updating_active_source = false); 519 } 520 521 if (!updating_value && dirty[0] & /*value*/ 1) { 522 updating_value = true; 523 imageuploader_changes.value = /*value*/ ctx[0]; 524 add_flush_callback(() => updating_value = false); 525 } 526 527 imageuploader.$set(imageuploader_changes); 528 }, 529 i(local) { 530 if (current) return; 531 transition_in(statustracker.$$.fragment, local); 532 transition_in(imageuploader.$$.fragment, local); 533 current = true; 534 }, 535 o(local) { 536 transition_out(statustracker.$$.fragment, local); 537 transition_out(imageuploader.$$.fragment, local); 538 current = false; 539 }, 540 d(detaching) { 541 if (detaching) { 542 detach(t); 543 } 544 545 destroy_component(statustracker, detaching); 546 destroy_component(imageuploader, detaching); 547 } 548 }; 549} 550 551// (51:1) <Block {visible} variant={"solid"} border_mode={dragging ? "focus" : "base"} padding={false} {elem_id} {elem_classes} height={height || undefined} {width} allow_overflow={false} {container} {scale} {min_width} > 552function create_default_slot(ctx) { 553 let statustracker; 554 let t; 555 let staticimage; 556 let current; 557 558 const statustracker_spread_levels = [ 559 { 560 autoscroll: /*gradio*/ ctx[21].autoscroll 561 }, 562 { i18n: /*gradio*/ ctx[21].i18n }, 563 /*loading_status*/ ctx[1] 564 ]; 565 566 let statustracker_props = {}; 567 568 for (let i = 0; i < statustracker_spread_levels.length; i += 1) { 569 statustracker_props = assign(statustracker_props, statustracker_spread_levels[i]); 570 } 571 572 statustracker = new Static({ props: statustracker_props }); 573 574 staticimage = new StaticImage({ 575 props: { 576 value: /*_value*/ ctx[22], 577 label: /*label*/ ctx[5], 578 show_label: /*show_label*/ ctx[6], 579 show_download_button: /*show_download_button*/ ctx[7], 580 selectable: /*_selectable*/ ctx[11], 581 show_share_button: /*show_share_button*/ ctx[15], 582 i18n: /*gradio*/ ctx[21].i18n 583 } 584 }); 585 586 staticimage.$on("select", /*select_handler*/ ctx[27]); 587 staticimage.$on("share", /*share_handler*/ ctx[28]); 588 staticimage.$on("error", /*error_handler*/ ctx[29]); 589 590 return { 591 c() { 592 create_component(statustracker.$$.fragment); 593 t = space(); 594 create_component(staticimage.$$.fragment); 595 }, 596 m(target, anchor) { 597 mount_component(statustracker, target, anchor); 598 insert(target, t, anchor); 599 mount_component(staticimage, target, anchor); 600 current = true; 601 }, 602 p(ctx, dirty) { 603 const statustracker_changes = (dirty[0] & /*gradio, loading_status*/ 2097154) 604 ? get_spread_update(statustracker_spread_levels, [ 605 dirty[0] & /*gradio*/ 2097152 && { 606 autoscroll: /*gradio*/ ctx[21].autoscroll 607 }, 608 dirty[0] & /*gradio*/ 2097152 && { i18n: /*gradio*/ ctx[21].i18n }, 609 dirty[0] & /*loading_status*/ 2 && get_spread_object(/*loading_status*/ ctx[1]) 610 ]) 611 : {}; 612 613 statustracker.$set(statustracker_changes); 614 const staticimage_changes = {};
615 if (dirty[0] & /*_value*/ 4194304) staticimage_changes.value = /*_value*/ ctx[22]; 616 if (dirty[0] & /*label*/ 32) staticimage_changes.label = /*label*/ ctx[5]; 617 if (dirty[0] & /*show_label*/ 64) staticimage_changes.show_label = /*show_label*/ ctx[6]; 618 if (dirty[0] & /*show_download_button*/ 128) staticimage_changes.show_download_button = /*show_download_button*/ ctx[7]; 619 if (dirty[0] & /*_selectable*/ 2048) staticimage_changes.selectable = /*_selectable*/ ctx[11]; 620 if (dirty[0] & /*show_share_button*/ 32768) staticimage_changes.show_share_button = /*show_share_button*/ ctx[15]; 621 if (dirty[0] & /*gradio*/ 2097152) staticimage_changes.i18n = /*gradio*/ ctx[21].i18n; 622 staticimage.$set(staticimage_changes); 623 }, 624 i(local) { 625 if (current) return; 626 transition_in(statustracker.$$.fragment, local); 627 transition_in(staticimage.$$.fragment, local); 628 current = true; 629 }, 630 o(local) { 631 transition_out(statustracker.$$.fragment, local); 632 transition_out(staticimage.$$.fragment, local); 633 current = false; 634 }, 635 d(detaching) { 636 if (detaching) { 637 detach(t); 638 } 639 640 destroy_component(statustracker, detaching); 641 destroy_component(staticimage, detaching); 642 } 643 }; 644} 645 646function create_fragment(ctx) { 647 let current_block_type_index; 648 let if_block; 649 let if_block_anchor; 650 let current; 651 const if_block_creators = [create_if_block, create_else_block]; 652 const if_blocks = []; 653 654 function select_block_type(ctx, dirty) { 655 if (!/*interactive*/ ctx[17]) return 0; 656 return 1; 657 } 658 659 current_block_type_index = select_block_type(ctx); 660 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 661 662 return { 663 c() { 664 if_block.c(); 665 if_block_anchor = empty(); 666 }, 667 m(target, anchor) { 668 if_blocks[current_block_type_index].m(target, anchor); 669 insert(target, if_block_anchor, anchor); 670 current = true; 671 }, 672 p(ctx, dirty) { 673 let previous_block_index = current_block_type_index; 674 current_block_type_index = select_block_type(ctx); 675 676 if (current_block_type_index === previous_block_index) { 677 if_blocks[current_block_type_index].p(ctx, dirty); 678 } else { 679 group_outros(); 680 681 transition_out(if_blocks[previous_block_index], 1, 1, () => { 682 if_blocks[previous_block_index] = null; 683 }); 684 685 check_outros(); 686 if_block = if_blocks[current_block_type_index]; 687 688 if (!if_block) { 689 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 690 if_block.c(); 691 } else { 692 if_block.p(ctx, dirty); 693 } 694 695 transition_in(if_block, 1); 696 if_block.m(if_block_anchor.parentNode, if_block_anchor); 697 } 698 }, 699 i(local) { 700 if (current) return; 701 transition_in(if_block); 702 current = true; 703 }, 704 o(local) { 705 transition_out(if_block); 706 current = false; 707 }, 708 d(detaching) { 709 if (detaching) { 710 detach(if_block_anchor); 711 } 712 713 if_blocks[current_block_type_index].d(detaching); 714 } 715 }; 716} 717 718function instance($$self, $$props, $$invalidate) { 719 let _value; 720 let url; 721 let { elem_id = "" } = $$props; 722 let { elem_classes = [] } = $$props; 723 let { visible = true } = $$props; 724 let { value = null } = $$props; 725 let { label } = $$props; 726 let { show_label } = $$props; 727 let { show_download_button } = $$props; 728 let { root } = $$props; 729 let { proxy_url } = $$props; 730 let { height } = $$props; 731 let { width } = $$props; 732 let { _selectable = false } = $$props; 733 let { container = true } = $$props; 734 let { scale = null } = $$props; 735 let { min_width = undefined } = $$props; 736 let { loading_status } = $$props; 737 let { show_share_button = false } = $$props; 738 let { sources = ["upload", "clipboard", "webcam"] } = $$props; 739 let { interactive } = $$props; 740 let { streaming } = $$props; 741 let { pending } = $$props; 742 let { mirror_webcam } = $$props; 743 let { gradio } = $$props; 744 let dragging; 745 let active_source = null; 746 const select_handler = ({ detail }) => gradio.dispatch("select", detail); 747 const share_handler = ({ detail }) => gradio.dispatch("share", detail); 748 const error_handler = ({ detail }) => gradio.dispatch("error", detail); 749 750 function imageuploader_active_source_binding(value) { 751 active_source = value;
752 $$invalidate(24, active_source); 753 } 754 755 function imageuploader_value_binding(value$1) { 756 value = value$1; 757 $$invalidate(0, value); 758 } 759 760 const edit_handler = () => gradio.dispatch("edit"); 761 762 const clear_handler = () => { 763 gradio.dispatch("clear"); 764 }; 765 766 const stream_handler = () => gradio.dispatch("stream"); 767 const drag_handler = ({ detail }) => $$invalidate(23, dragging = detail); 768 const upload_handler = () => gradio.dispatch("upload"); 769 const select_handler_1 = ({ detail }) => gradio.dispatch("select", detail); 770 const share_handler_1 = ({ detail }) => gradio.dispatch("share", detail); 771 772 const error_handler_1 = ({ detail }) => { 773 $$invalidate(1, loading_status = loading_status || {}); 774 $$invalidate(1, loading_status.status = "error", loading_status); 775 gradio.dispatch("error", detail); 776 }; 777 778 $$self.$$set = $$props => { 779 if ('elem_id' in $$props) $$invalidate(2, elem_id = $$props.elem_id); 780 if ('elem_classes' in $$props) $$invalidate(3, elem_classes = $$props.elem_classes); 781 if ('visible' in $$props) $$invalidate(4, visible = $$props.visible);
782 if ('value' in $$props) $$invalidate(0, value = $$props.value); 783 if ('label' in $$props) $$invalidate(5, label = $$props.label); 784 if ('show_label' in $$props) $$invalidate(6, show_label = $$props.show_label); 785 if ('show_download_button' in $$props) $$invalidate(7, show_download_button = $$props.show_download_button); 786 if ('root' in $$props) $$invalidate(8, root = $$props.root); 787 if ('proxy_url' in $$props) $$invalidate(25, proxy_url = $$props.proxy_url); 788 if ('height' in $$props) $$invalidate(9, height = $$props.height); 789 if ('width' in $$props) $$invalidate(10, width = $$props.width); 790 if ('_selectable' in $$props) $$invalidate(11, _selectable = $$props._selectable); 791 if ('container' in $$props) $$invalidate(12, container = $$props.container); 792 if ('scale' in $$props) $$invalidate(13, scale = $$props.scale); 793 if ('min_width' in $$props) $$invalidate(14, min_width = $$props.min_width); 794 if ('loading_status' in $$props) $$invalidate(1, loading_status = $$props.loading_status); 795 if ('show_share_button' in $$props) $$invali
795date(15, show_share_button = $$props.show_share_button); 796 if ('sources' in $$props) $$invalidate(16, sources = $$props.sources); 797 if ('interactive' in $$props) $$invalidate(17, interactive = $$props.interactive); 798 if ('streaming' in $$props) $$invalidate(18, streaming = $$props.streaming); 799 if ('pending' in $$props) $$invalidate(19, pending = $$props.pending); 800 if ('mirror_webcam' in $$props) $$invalidate(20, mirror_webcam = $$props.mirror_webcam); 801 if ('gradio' in $$props) $$invalidate(21, gradio = $$props.gradio); 802 }; 803 804 $$self.$$.update = () => { 805 if ($$self.$$.dirty[0] & /*value, root, proxy_url*/ 33554689) { 806 $$invalidate(22, _value = normalise_file(value, root, proxy_url)); 807 } 808 809 if ($$self.$$.dirty[0] & /*_value*/ 4194304) { 810 $$invalidate(26, url = _value?.url); 811 } 812 813 if ($$self.$$.dirty[0] & /*url, gradio*/ 69206016) { 814 (gradio.dispatch("change")); 815 } 816 }; 817 818 return [ 819 value, 820 loading_status, 821 elem_id, 822 elem_classes, 823 visible, 824 label, 825 show_label, 826 show_download_button, 827 root, 828 height, 829 width, 830 _selectable, 831 container, 832 scale, 833 min_width, 834 show_share_button, 835 sources, 836 interactive, 837 streaming, 838 pending, 839 mirror_webcam, 840 gradio, 841 _value, 842 dragging, 843 active_source, 844 proxy_url, 845 url, 846 select_handler, 847 share_handler, 848 error_handler, 849 imageuploader_active_source_binding, 850 imageuploader_value_binding, 851 edit_handler, 852 clear_handler, 853 stream_handler, 854 drag_handler, 855 upload_handler, 856 select_handler_1, 857 share_handler_1, 858 error_handler_1 859 ]; 860} 861 862class Index extends SvelteComponent { 863 constructor(options) { 864 super(); 865 866 init( 867 this, 868 options, 869 instance, 870 create_fragment, 871 safe_not_equal, 872 { 873 elem_id: 2, 874 elem_classes: 3, 875 visible: 4, 876 value: 0, 877 label: 5, 878 show_label: 6, 879 show_download_button: 7, 880 root: 8, 881 proxy_url: 25, 882 height: 9, 883 width: 10, 884 _selectable: 11, 885 container: 12, 886 scale: 13, 887 min_width: 14, 888 loading_status: 1, 889 show_share_button: 15, 890 sources: 16, 891 interactive: 17, 892 streaming: 18, 893 pending: 19, 894 mirror_webcam: 20, 895 gradio: 21 896 }, 897 null, 898 [-1, -1] 899 ); 900 } 901 902 get elem_id() { 903 return this.$$.ctx[2]; 904 } 905 906 set elem_id(elem_id) { 907 this.$$set({ elem_id }); 908 flush(); 909 } 910 911 get elem_classes() { 912 return this.$$.ctx[3]; 913 } 914 915 set elem_classes(elem_classes) { 916 this.$$set({ elem_classes }); 917 flush(); 918 } 919 920 get visible() { 921 return this.$$.ctx[4]; 922 } 923 924 set visible(visible) { 925 this.$$set({ visible }); 926 flush(); 927 } 928 929 get value() { 930 return this.$$.ctx[0]; 931 } 932 933 set value(value) { 934 this.$$set({ value }); 935 flush(); 936 } 937 938 get label() { 939 return this.$$.ctx[5]; 940 } 941 942 set label(label) { 943 this.$$set({ label }); 944 flush(); 945 } 946 947 get show_label() { 948 return this.$$.ctx[6]; 949 } 950 951 set show_label(show_label) { 952 this.$$set({ show_label }); 953 flush(); 954 } 955 956 get show_download_button() { 957 return this.$$.ctx[7]; 958 } 959 960 set show_download_button(show_download_button) { 961 this.$$set({ show_download_button }); 962 flush(); 963 } 964 965 get root() { 966 return this.$$.ctx[8]; 967 } 968 969 set root(root) { 970 this.$$set({ root }); 971 flush(); 972 } 973 974 get proxy_url() { 975 return this.$$.ctx[25]; 976 } 977 978 set proxy_url(proxy_url) { 979 this.$$set({ proxy_url }); 980 flush(); 981 } 982 983 get height() { 984 return this.$$.ctx[9]; 985 } 986 987 set height(height) { 988 this.$$set({ height }); 989 flush(); 990 } 991 992 get width() { 993 return this.$$.ctx[10]; 994 } 995 996 set width(width) { 997 this.$$set({ width }); 998 flush(); 999 } 1000 1001 get _selectable() { 1002 return this.$$.ctx[11]; 1003 } 1004 1005 set _selectable(_selectable) { 1006 this.$$set({ _selectable }); 1007 flush(); 1008 } 1009 1010 get container() { 1011 return this.$$.ctx[12]; 1012 } 1013 1014 set container(container) { 1015 this.$$set({ container }); 1016 flush(); 1017 } 1018 1019 get scale() { 1020 return this.$$.ctx[13]; 1021 } 1022 1023 set scale(scale) { 1024 this.$$set({ scale }); 1025 flush(); 1026 } 1027 1028 get min_width() { 1029 return this.$$.ctx[14]; 1030 } 1031 1032 set min_width(min_width) { 1033 this.$$set({ min_width }); 1034 flush(); 1035 } 1036 1037 get loading_status() { 1038 return this.$$.ctx[1]; 1039 } 1040 1041 set loading_status(loading_status) { 1042 this.$$set({ loading_status }); 1043 flush(); 1044 } 1045 1046 get show_share_button() { 1047 return this.$$.ctx[15]; 1048 } 1049 1050 set show_share_button(show_share_button) { 1051 this.$$set({ show_share_button }); 1052 flush(); 1053 } 1054 1055 get sources() { 1056 return this.$$.ctx[16]; 1057 } 1058 1059 set sources(sources) { 1060 this.$$set({ sources }); 1061 flush(); 1062 } 1063 1064 get interactive() { 1065 return this.$$.ctx[17]; 1066 } 1067 1068 set interactive(interactive) { 1069 this.$$set({ interactive }); 1070 flush(); 1071 } 1072 1073 get streaming() { 1074 return this.$$.ctx[18]; 1075 } 1076 1077 set streaming(streaming) { 1078 this.$$set({ streaming }); 1079 flush(); 1080 } 1081 1082 get pending() { 1083 return this.$$.ctx[19]; 1084 } 1085 1086 set pending(pending) { 1087 this.$$set({ pending }); 1088 flush(); 1089 } 1090 1091 get mirror_webcam() { 1092 return this.$$.ctx[20]; 1093 } 1094 1095 set mirror_webcam(mirror_webcam) { 1096 this.$$set({ mirror_webcam }); 1097 flush(); 1098 } 1099 1100 get gradio() { 1101 return this.$$.ctx[21]; 1102 } 1103 1104 set gradio(gradio) { 1105 this.$$set({ gradio }); 1106 flush(); 1107 } 1108} 1109 1110export { ImageUploader as BaseImageUploader, StaticImage as BaseStaticImage, Index as default }; 1111//# sourceMappingURL=Index-d234233b.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.