1import { _ as __vitePreload } from './index-7905665e.js'; 2import { b as is_function, w as writable, L as Loader, d as get_store_value, $ as $format, e as setupi18n } from './Index-a19f568c.js'; 3import { d as cubicOut, f as fade, B as Block, a as Button } from './Button-515ad287.js'; 4 5/** 6 * The flip function calculates the start and end position of an element and animates between them, translating the x and y values. 7 * `flip` stands for [First, Last, Invert, Play](https://aerotwist.com/blog/flip-your-animations/). 8 * 9 * https://svelte.dev/docs/svelte-animate#flip 10 * @param {Element} node 11 * @param {{ from: DOMRect; to: DOMRect }} fromTo 12 * @param {import('./public.js').FlipParams} params 13 * @returns {import('./public.js').AnimationConfig} 14 */ 15function flip(node, { from, to }, params = {}) { 16 const style = getComputedStyle(node); 17 const transform = style.transform === 'none' ? '' : style.transform; 18 const [ox, oy] = style.transformOrigin.split(' ').map(parseFloat); 19 const dx = from.left + (from.width * ox) / to.width - (to.left + ox); 20 const dy = from.top + (from.height * oy) / to.height - (to.top + oy); 21 const { delay = 0, duration = (d) => Math.sqrt(d) * 120, easing = cubicOut } = params; 22 return { 23 delay, 24 duration: is_function(duration) ? duration(Math.sqrt(dx * dx + dy * dy)) : duration, 25 easing, 26 css: (t, u) => { 27 const x = u * dx; 28 const y = u * dy; 29 const sx = t + (u * from.width) / to.width; 30 const sy = t + (u * from.height) / to.height; 31 return `transform: ${transform} translate(${x}px, ${y}px) scale(${sx}, ${sy});`; 32 } 33 }; 34} 35 36/* home/runner/work/gradio/gradio/js/icons/src/Error.svelte generated by Svelte v4.2.2 */ 37const { 38 SvelteComponent: SvelteComponent$g, 39 append: append$d, 40 attr: attr$d, 41 detach: detach$f, 42 init: init$g, 43 insert: insert$f, 44 noop: noop$8, 45 safe_not_equal: safe_not_equal$g, 46 svg_element: svg_element$3 47} = window.__gradio__svelte__internal; 48function create_fragment$g(ctx) { 49 let svg; 50 let path; 51 52 return { 53 c() { 54 svg = svg_element$3("svg"); 55 path = svg_element$3("path"); 56 attr$d(path, "stroke-linecap", "round"); 57 attr$d(path, "stroke-linejoin", "round"); 58 attr$d(path, "d", "M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"); 59 attr$d(svg, "fill", "none"); 60 attr$d(svg, "stroke", "currentColor"); 61 attr$d(svg, "viewBox", "0 0 24 24"); 62 attr$d(svg, "width", "100%"); 63 attr$d(svg, "height", "100%"); 64 attr$d(svg, "xmlns", "http://www.w3.org/2000/svg"); 65 attr$d(svg, "aria-hidden", "true"); 66 attr$d(svg, "stroke-width", "2"); 67 attr$d(svg, "stroke-linecap", "round"); 68 attr$d(svg, "stroke-linejoin", "round"); 69 }, 70 m(target, anchor) { 71 insert$f(target, svg, anchor); 72 append$d(svg, path); 73 }, 74 p: noop$8, 75 i: noop$8, 76 o: noop$8, 77 d(detaching) { 78 if (detaching) { 79 detach$f(svg); 80 } 81 } 82 }; 83} 84 85let Error$1 = class Error extends SvelteComponent$g { 86 constructor(options) { 87 super(); 88 init$g(this, options, null, create_fragment$g, safe_not_equal$g, {}); 89 } 90}; 91 92/* home/runner/work/gradio/gradio/js/icons/src/Info.svelte generated by Svelte v4.2.2 */ 93const { 94 SvelteComponent: SvelteComponent$f,
95 append: append$c, 96 attr: attr$c, 97 detach: detach$e, 98 init: init$f, 99 insert: insert$e, 100 noop: noop$7, 101 safe_not_equal: safe_not_equal$f, 102 svg_element: svg_element$2 103} = window.__gradio__svelte__internal; 104function create_fragment$f(ctx) { 105 let svg; 106 let path; 107 108 return { 109 c() { 110 svg = svg_element$2("svg"); 111 path = svg_element$2("path"); 112 attr$c(path, "stroke-linecap", "round"); 113 attr$c(path, "stroke-linejoin", "round"); 114 attr$c(path, "d", "M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"); 115 attr$c(svg, "fill", "none"); 116 attr$c(svg, "stroke", "currentColor"); 117 attr$c(svg, "viewBox", "0 0 24 24"); 118 attr$c(svg, "width", "100%"); 119 attr$c(svg, "height", "100%"); 120 attr$c(svg, "xmlns", "http://www.w3.org/2000/svg"); 121 attr$c(svg, "aria-hidden", "true"); 122 attr$c(svg, "stroke-width", "2"); 123 attr$c(svg, "stroke-linecap", "round"); 124 attr$c(svg, "stroke-linejoin", "round"); 125 }, 126 m(target, anchor) { 127 insert$e(target, svg, anchor); 128 append$c(svg, path); 129 }, 130 p: noop$7, 131 i: noop$7, 132 o: noop$7, 133 d(detaching) { 134 if (detaching) { 135 detach$e(svg); 136 } 137 } 138 }; 139} 140 141class Info extends SvelteComponent$f { 142 constructor(options) { 143 super(); 144 init$f(this, options, null, create_fragment$f, safe_not_equal$f, {}); 145 } 146} 147 148/* home/runner/work/gradio/gradio/js/icons/src/Warning.svelte generated by Svelte v4.2.2 */ 149const { 150 SvelteComponent: SvelteComponent$e, 151 append: append$b, 152 attr: attr$b, 153 detach: detach$d, 154 init: init$e, 155 insert: insert$d, 156 noop: noop$6, 157 safe_not_equal: safe_not_equal$e, 158 svg_element: svg_element$1 159} = window.__gradio__svelte__internal; 160function create_fragment$e(ctx) { 161 let svg; 162 let path; 163 164 return { 165 c() { 166 svg = svg_element$1("svg"); 167 path = svg_element$1("path"); 168 attr$b(path, "stroke-linecap", "round"); 169 attr$b(path, "stroke-linejoin", "round"); 170 attr$b(path, "d", "M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"); 171 attr$b(svg, "fill", "none"); 172 attr$b(svg, "stroke", "currentColor"); 173 attr$b(svg, "stroke-width", "2"); 174 attr$b(svg, "viewBox", "0 0 24 24"); 175 attr$b(svg, "width", "100%"); 176 attr$b(svg, "height", "100%"); 177 attr$b(svg, "xmlns", "http://www.w3.org/2000/svg"); 178 attr$b(svg, "aria-hidden", "true"); 179 attr$b(svg, "stroke-linecap", "round"); 180 attr$b(svg, "stroke-linejoin", "round"); 181 }, 182 m(target, anchor) { 183 insert$d(target, svg, anchor); 184 append$b(svg, path); 185 }, 186 p: noop$6, 187 i: noop$6, 188 o: noop$6, 189 d(detaching) { 190 if (detaching) { 191 detach$d(svg); 192 } 193 } 194 }; 195} 196 197class Warning extends SvelteComponent$e { 198 constructor(options) { 199 super(); 200 init$e(this, options, null, create_fragment$e, safe_not_equal$e, {}); 201 } 202} 203 204/* home/runner/work/gradio/gradio/js/statustracker/static/ToastContent.svelte generated by Svelte v4.2.2 */ 205const { 206 SvelteComponent: SvelteComponent$d, 207 add_render_callback, 208 append: append$a, 209 attr: attr$a, 210 bubble: bubble$3, 211 check_outros: check_outros$7, 212 create_component: create_component$b, 213 create_in_transition, 214 create_out_transition, 215 destroy_component: destroy_component$b, 216 detach: detach$c, 217 element: element$9, 218 group_outros: group_outros$7, 219 init: init$d, 220 insert: insert$c, 221 listen: listen$4, 222 mount_component: mount_component$b, 223 run_all, 224 safe_not_equal: safe_not_equal$d, 225 set_data: set_data$7, 226 space: space$8, 227 stop_propagation, 228 text: text$8, 229 transition_in: transition_in$b, 230 transition_out: transition_out$b 231} = window.__gradio__svelte__internal;const { createEventDispatcher: createEventDispatcher$5, onMount: onMount$3 } = window.__gradio__svelte__internal; 232function create_if_block_2$4(ctx) { 233 let error; 234 let current; 235 error = new Error$1({}); 236 237 return { 238 c() { 239 create_component$b(error.$$.fragment); 240 }, 241 m(target, anchor) { 242 mount_component$b(error, target, anchor); 243 current = true; 244 }, 245 i(local) { 246 if (current) return; 247 transition_in$b(error.$$.fragment, local); 248 current = true; 249 }, 250 o(local) { 251 transition_out$b(error.$$.fragment, local); 252 current = false;
253 }, 254 d(detaching) { 255 destroy_component$b(error, detaching); 256 } 257 }; 258} 259 260// (32:28) 261function create_if_block_1$5(ctx) { 262 let info; 263 let current; 264 info = new Info({}); 265 266 return { 267 c() { 268 create_component$b(info.$$.fragment); 269 }, 270 m(target, anchor) { 271 mount_component$b(info, target, anchor); 272 current = true; 273 }, 274 i(local) { 275 if (current) return; 276 transition_in$b(info.$$.fragment, local); 277 current = true; 278 }, 279 o(local) { 280 transition_out$b(info.$$.fragment, local); 281 current = false; 282 }, 283 d(detaching) { 284 destroy_component$b(info, detaching); 285 } 286 }; 287} 288 289// (30:2) {#if type === "warning"} 290function create_if_block$8(ctx) { 291 let warning; 292 let current; 293 warning = new Warning({}); 294 295 return { 296 c() { 297 create_component$b(warning.$$.fragment); 298 }, 299 m(target, anchor) { 300 mount_component$b(warning, target, anchor); 301 current = true; 302 }, 303 i(local) { 304 if (current) return; 305 transition_in$b(warning.$$.fragment, local); 306 current = true; 307 }, 308 o(local) { 309 transition_out$b(warning.$$.fragment, local); 310 current = false; 311 }, 312 d(detaching) { 313 destroy_component$b(warning, detaching); 314 } 315 }; 316} 317 318function create_fragment$d(ctx) { 319 let div5; 320 let div0; 321 let current_block_type_index; 322 let if_block; 323 let div0_class_value; 324 let t0; 325 let div3; 326 let div1; 327 let t1; 328 let div1_class_value; 329 let t2; 330 let div2; 331 let t3; 332 let div2_class_value; 333 let div3_class_value; 334 let t4; 335 let button; 336 let span; 337 let button_class_value; 338 let t6; 339 let div4; 340 let div4_class_value; 341 let div5_class_value; 342 let div5_intro; 343 let div5_outro; 344 let current; 345 let mounted; 346 let dispose; 347 const if_block_creators = [create_if_block$8, create_if_block_1$5, create_if_block_2$4]; 348 const if_blocks = []; 349 350 function select_block_type(ctx, dirty) { 351 if (/*type*/ ctx[1] === "warning") return 0; 352 if (/*type*/ ctx[1] === "info") return 1; 353 if (/*type*/ ctx[1] === "error") return 2; 354 return -1; 355 } 356 357 if (~(current_block_type_index = select_block_type(ctx))) { 358 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 359 } 360 361 return { 362 c() { 363 div5 = element$9("div"); 364 div0 = element$9("div"); 365 if (if_block) if_block.c(); 366 t0 = space$8(); 367 div3 = element$9("div"); 368 div1 = element$9("div"); 369 t1 = text$8(/*type*/ ctx[1]); 370 t2 = space$8(); 371 div2 = element$9("div"); 372 t3 = text$8(/*message*/ ctx[0]); 373 t4 = space$8(); 374 button = element$9("button"); 375 span = element$9("span"); 376 span.textContent = "Ã"; 377 t6 = space$8(); 378 div4 = element$9("div"); 379 attr$a(div0, "class", div0_class_value = "toast-icon " + /*type*/ ctx[1] + " svelte-z3l7qj"); 380 attr$a(div1, "class", div1_class_value = "toast-title " + /*type*/ ctx[1] + " svelte-z3l7qj"); 381 attr$a(div2, "class", div2_class_value = "toast-text " + /*type*/ ctx[1] + " svelte-z3l7qj"); 382 attr$a(div3, "class", div3_class_value = "toast-details " + /*type*/ ctx[1] + " svelte-z3l7qj"); 383 attr$a(span, "aria-hidden", "true"); 384 attr$a(button, "class", button_class_value = "toast-close " + /*type*/ ctx[1] + " svelte-z3l7qj"); 385 attr$a(button, "type", "button"); 386 attr$a(button, "aria-label", "Close"); 387 attr$a(button, "data-testid", "toast-close"); 388 attr$a(div4, "class", div4_class_value = "timer " + /*type*/ ctx[1] + " svelte-z3l7qj"); 389 attr$a(div5, "class", div5_class_value = "toast-body " + /*type*/ ctx[1] + " svelte-z3l7qj"); 390 attr$a(div5, "role", "alert"); 391 attr$a(div5, "data-testid", "toast-body"); 392 }, 393 m(target, anchor) { 394 insert$c(target, div5, anchor); 395 append$a(div5, div0); 396 397 if (~current_block_type_index) { 398 if_blocks[current_block_type_index].m(div0, null); 399 } 400 401 append$a(div5, t0); 402 append$a(div5, div3); 403 append$a(div3, div1); 404 append$a(div1, t1); 405 append$a(div3, t2); 406 append$a(div3, div2); 407 append$a(div2, t3); 408 append$a(div5, t4); 409 append$a(div5, button); 410 append$a(button, span); 411 append$a(div5, t6); 412 append$a(div5, div4); 413 current = true; 414 415 if (!mounted) { 416 dispose = [ 417 listen$4(button, "click", /*close_message*/ ctx[2]), 418 listen$4(div5, "click", stop_propagation(/*click_handler*/ ctx[4])), 419 listen$4(div5, "keydown", stop_propagation(/*keydown_handler*/ ctx[5])) 420 ]; 421 422 mounted = true; 423 } 424 }, 425 p(ctx, [dirty]) { 426 let previous_block_index = current_block_type_index; 427 current_block_type_index = select_block_type(ctx); 428 429 if (current_block_type_index !== previous_block_index) { 430 if (if_block) { 431 group_outros$7(); 432 433 transition_out$b(if_blocks[previous_block_index], 1, 1, () => { 434 if_blocks[previous_block_index] = null; 435 }); 436 437 check_outros$7(); 438 } 439 440 if (~current_block_type_index) { 441 if_block = if_blocks[current_block_type_index]; 442 443 if (!if_block) { 444 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 445 if_block.c(); 446 } 447 448 transition_in$b(if_block, 1); 449 if_block.m(div0, null); 450 } else { 451 if_block = null; 452 } 453 } 454 455 if (!current || dirty & /*type*/ 2 && div0_class_value !== (div0_class_value = "toast-icon " + /*type*/ ctx[1] + " svelte-z3l7qj")) { 456 attr$a(div0, "class", div0_class_value); 457 } 458 459 if (!current || dirty & /*type*/ 2) set_data$7(t1, /*type*/ ctx[1]); 460 461 if (!current || dirty & /*type*/ 2 && div1_class_value !== (div1_class_value = "toast-title " + /*type*/ ctx[1] + " svelte-z3l7qj")) { 462 attr$a(div1, "class", div1_class_value); 463 } 464 465 if (!current || dirty & /*message*/ 1) set_data$7(t3, /*message*/ ctx[0]); 466 467 if (!current || dirty & /*type*/ 2 && div2_class_value !== (div2_class_value = "toast-text " + /*type*/ ctx[1] + " svelte-z3l7qj")) { 468 attr$a(div2, "class", div2_class_value); 469 } 470 471 if (!current || dirty & /*type*/ 2 && div3_class_value !== (div3_class_value = "toast-details " + /*type*/ ctx[1] + " svelte-z3l7qj")) { 472 attr$a(div3, "class", div3_class_value); 473 } 474 475 if (!current || dirty & /*type*/ 2 && button_class_value !== (button_class_value = "toast-close " + /*type*/ ctx[1] + " svelte-z3l7qj")) { 476 attr$a(button, "class", button_class_value); 477 } 478 479 if (!current || dirty & /*type*/ 2 && div4_class_value !== (div4_class_value = "timer " + /*type*/ ctx[1] + " svelte-z3l7qj")) { 480 attr$a(div4, "class", div4_class_value); 481 } 482 483 if (!current || dirty & /*type*/ 2 && div5_class_value !== (div5_class_value = "toast-body " + /*type*/ ctx[1] + " svelte-z3l7qj")) { 484 attr$a(div5, "class", div5_class_value); 485 } 486 }, 487 i(local) { 488 if (current) return; 489 transition_in$b(if_block); 490 491 if (local) { 492 add_render_callback(() => { 493 if (!current) return; 494 if (div5_outro) div5_outro.end(1);
495 div5_intro = create_in_transition(div5, fade, { duration: 200, delay: 100 }); 496 div5_intro.start(); 497 }); 498 } 499 500 current = true; 501 }, 502 o(local) { 503 transition_out$b(if_block); 504 if (div5_intro) div5_intro.invalidate(); 505 506 if (local) { 507 div5_outro = create_out_transition(div5, fade, { duration: 200 }); 508 } 509 510 current = false; 511 }, 512 d(detaching) { 513 if (detaching) { 514 detach$c(div5); 515 } 516 517 if (~current_block_type_index) { 518 if_blocks[current_block_type_index].d(); 519 } 520 521 if (detaching && div5_outro) div5_outro.end(); 522 mounted = false; 523 run_all(dispose); 524 } 525 }; 526} 527 528function instance$c($$self, $$props, $$invalidate) { 529 let { message = "" } = $$props; 530 let { type } = $$props; 531 let { id } = $$props; 532 const dispatch = createEventDispatcher$5(); 533 534 function close_message() { 535 dispatch("close", id); 536 } 537 538 onMount$3(() => { 539 setTimeout( 540 () => { 541 close_message(); 542 }, 543 10000 544 ); 545 }); 546 547 function click_handler(event) { 548 bubble$3.call(this, $$self, event); 549 } 550 551 function keydown_handler(event) { 552 bubble$3.call(this, $$self, event); 553 } 554 555 $$self.$$set = $$props => {
556 if ('message' in $$props) $$invalidate(0, message = $$props.message); 557 if ('type' in $$props) $$invalidate(1, type = $$props.type); 558 if ('id' in $$props) $$invalidate(3, id = $$props.id); 559 }; 560 561 return [message, type, close_message, id, click_handler, keydown_handler]; 562} 563 564class ToastContent extends SvelteComponent$d { 565 constructor(options) { 566 super(); 567 init$d(this, options, instance$c, create_fragment$d, safe_not_equal$d, { message: 0, type: 1, id: 3 }); 568 } 569} 570 571/* home/runner/work/gradio/gradio/js/statustracker/static/Toast.svelte generated by Svelte v4.2.2 */ 572const { 573 SvelteComponent: SvelteComponent$c, 574 append: append$9, 575 attr: attr$9, 576 bubble: bubble$2, 577 check_outros: check_outros$6, 578 create_animation, 579 create_component: create_component$a, 580 destroy_component: destroy_component$a, 581 detach: detach$b, 582 element: element$8, 583 ensure_array_like: ensure_array_like$4, 584 fix_and_outro_and_destroy_block, 585 fix_position, 586 group_outros: group_outros$6, 587 init: init$c, 588 insert: insert$b, 589 mount_component: mount_component$a, 590 noop: noop$5, 591 safe_not_equal: safe_not_equal$c, 592 set_style: set_style$2, 593 space: space$7, 594 transition_in: transition_in$a, 595 transition_out: transition_out$a, 596 update_keyed_each: update_keyed_each$1 597} = window.__gradio__svelte__internal; 598function get_each_context$4(ctx, list, i) { 599 const child_ctx = ctx.slice(); 600 child_ctx[2] = list[i].type; 601 child_ctx[3] = list[i].message; 602 child_ctx[4] = list[i].id; 603 return child_ctx; 604} 605 606// (15:1) {#each messages as { type, message, id } 607function create_each_block$4(key_1, ctx) { 608 let div; 609 let toastcontent; 610 let t; 611 let rect; 612 let stop_animation = noop$5; 613 let current; 614 615 toastcontent = new ToastContent({ 616 props: { 617 type: /*type*/ ctx[2], 618 message: /*message*/ ctx[3], 619 id: /*id*/ ctx[4] 620 } 621 }); 622 623 toastcontent.$on("close", /*close_handler*/ ctx[1]); 624 625 return { 626 key: key_1, 627 first: null, 628 c() { 629 div = element$8("div"); 630 create_component$a(toastcontent.$$.fragment); 631 t = space$7(); 632 set_style$2(div, "width", `100%`); 633 this.first = div; 634 }, 635 m(target, anchor) { 636 insert$b(target, div, anchor); 637 mount_component$a(toastcontent, div, null); 638 append$9(div, t); 639 current = true; 640 }, 641 p(new_ctx, dirty) { 642 ctx = new_ctx; 643 const toastcontent_changes = {}; 644 if (dirty & /*messages*/ 1) toastcontent_changes.type = /*type*/ ctx[2]; 645 if (dirty & /*messages*/ 1) toastcontent_changes.message = /*message*/ ctx[3]; 646 if (dirty & /*messages*/ 1) toastcontent_changes.id = /*id*/ ctx[4]; 647 toastcontent.$set(toastcontent_changes); 648 }, 649 r() { 650 rect = div.getBoundingClientRect(); 651 }, 652 f() { 653 fix_position(div); 654 stop_animation(); 655 }, 656 a() { 657 stop_animation(); 658 stop_animation = create_animation(div, rect, flip, { duration: 300 }); 659 }, 660 i(local) { 661 if (current) return; 662 transition_in$a(toastcontent.$$.fragment, local); 663 current = true; 664 }, 665 o(local) { 666 transition_out$a(toastcontent.$$.fragment, local); 667 current = false; 668 }, 669 d(detaching) { 670 if (detaching) { 671 detach$b(div); 672 } 673 674 destroy_component$a(toastcontent); 675 } 676 }; 677} 678 679function create_fragment$c(ctx) { 680 let div; 681 let each_blocks = []; 682 let each_1_lookup = new Map(); 683 let current; 684 let each_value = ensure_array_like$4(/*messages*/ ctx[0]); 685 const get_key = ctx => /*id*/ ctx[4]; 686 687 for (let i = 0; i < each_value.length; i += 1) { 688 let child_ctx = get_each_context$4(ctx, each_value, i); 689 let key = get_key(child_ctx); 690 each_1_lookup.set(key, each_blocks[i] = create_each_block$4(key, child_ctx)); 691 } 692 693 return { 694 c() { 695 div = element$8("div"); 696 697 for (let i = 0; i < each_blocks.length; i += 1) { 698 each_blocks[i].c(); 699 } 700 701 attr$9(div, "class", "toast-wrap svelte-pu0yf1"); 702 }, 703 m(target, anchor) { 704 insert$b(target, div, anchor); 705 706 for (let i = 0; i < each_blocks.length; i += 1) { 707 if (each_blocks[i]) { 708 each_blocks[i].m(div, null); 709 } 710 } 711 712 current = true; 713 }, 714 p(ctx, [dirty]) { 715 if (dirty & /*messages*/ 1) { 716 each_value = ensure_array_like$4(/*messages*/ ctx[0]); 717 group_outros$6(); 718 for (let i = 0; i < each_blocks.length; i += 1) each_blocks[i].r(); 719 each_blocks = update_keyed_each$1(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, div, fix_and_outro_and_destroy_block, create_each_block$4, null, get_each_context$4); 720 for (let i = 0; i < each_blocks.length; i += 1) each_blocks[i].a(); 721 check_outros$6(); 722 } 723 }, 724 i(local) { 725 if (current) return; 726 727 for (let i = 0; i < each_value.length; i += 1) { 728 transition_in$a(each_blocks[i]); 729 } 730 731 current = true; 732 }, 733 o(local) { 734 for (let i = 0; i < each_blocks.length; i += 1) { 735 transition_out$a(each_blocks[i]); 736 } 737 738 current = false;
739 }, 740 d(detaching) { 741 if (detaching) { 742 detach$b(div); 743 } 744 745 for (let i = 0; i < each_blocks.length; i += 1) { 746 each_blocks[i].d(); 747 } 748 } 749 }; 750} 751 752function scroll_to_top(_messages) { 753 if (_messages.length > 0) { 754 if ("parentIFrame" in window) { 755 window.parentIFrame?.scrollTo(0, 0); 756 } 757 } 758} 759 760function instance$b($$self, $$props, $$invalidate) { 761 let { messages = [] } = $$props; 762 763 function close_handler(event) { 764 bubble$2.call(this, $$self, event); 765 } 766 767 $$self.$$set = $$props => { 768 if ('messages' in $$props) $$invalidate(0, messages = $$props.messages); 769 }; 770 771 $$self.$$.update = () => { 772 if ($$self.$$.dirty & /*messages*/ 1) { 773 scroll_to_top(messages); 774 } 775 }; 776 777 return [messages, close_handler]; 778} 779 780class Toast extends SvelteComponent$c { 781 constructor(options) { 782 super(); 783 init$c(this, options, instance$b, create_fragment$c, safe_not_equal$c, { messages: 0 }); 784 } 785} 786 787const component_map = { 788 "accordion": { 789 790 component: () => __vitePreload(() => import('./Index-64f7cc27.js'),true?["./Index-64f7cc27.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-515ad287.js","./Button-2a9911a9.css","./Index-24a33ce1.js","./Index-2abed479.css","./Index-a90cda25.css"]:void 0,import.meta.url) 791 }, 792"annotatedimage": { 793 794 component: () => __vitePreload(() => import('./Index-0ac687e5.js'),true?["./Index-0ac687e5.js","./Button-515ad287.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-2a9911a9.css","./BlockLabel-59adcbbb.js","./Empty-b82e3792.js","./Image-6cbf81d1.js","./file-url-8dc1c09f.js","./Index-1454732f.css"]:void 0,import.meta.url) 795 }, 796"audio": { 797 example: () => __vitePreload(() => import('./Example-63607f02.js'),true?["./Example-63607f02.js","./Example-55d94c71.css"]:void 0,import.meta.url), 798 799 component: () => __vitePreload(() => import('./index-9db0ba23.js'),true?["./index-9db0ba23.js","./Button-515ad287.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-2a9911a9.css","./utils-013c0d40.js","./BlockLabel-59adcbbb.js","./IconButton-8c191862.js","./Empty-b82e3792.js","./ShareButton-4a821dc3.js","./DownloadLink-f05b00bb.js","./file-url-8dc1c09f.js","./Trim-0317ad89.js","./Undo-6c110254.js","./ModifyUpload.svelte_svelte_type_style_lang-9c565bcf.js","./ModifyUpload-7d41bdb3.css","./ModifyUpload-9839c63f.js","./Upload-96564545.js","./SelectSource-7173a592.js","./UploadText-5118a6cd.js","./Example-63607f02.js","./Example-55d94c71.css","./index-3723b105.css"]:void 0,import.meta.url) 800 }, 801"box": { 802 803 component: () => __vitePreload(() => import('./Index-ad7959a8.js'),true?["./Index-ad7959a8.js","./Button-515ad287.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-2a9911a9.css"]:void 0,import.meta.url) 804 }, 805"button": { 806 807 component: () => __vitePreload(() => import('./Index-6875f198.js'),true?["./Index-6875f198.js","./Button-515ad287.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-2a9911a9.css"]:void 0,import.meta.url) 808 }, 809"chatbot": { 810 811 component: () => __vitePreload(() => import('./Index-bf5ae563.js'),true?["./Index-bf5ae563.js","./Button-515ad287.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-2a9911a9.css","./utils-013c0d40.js","./index-21d69e4c.js","./ShareButton-4a821dc3.js","./IconButton-8c191862.js","./file-url-8dc1c09f.js","./Image-f2cd351b.js","./Image-7b829b60.css","./Video-fd9c9c36.js","./Video-540eb7aa.css","./Index.svelte_svelte_type_style_lang-6093f3be.js","./Example.
811svelte_svelte_type_style_lang-3c6b3e79.js","./prism-python-4704117c.js","./Example-5fbca523.css","./Index-11e1685d.css","./Check-f7edb5d9.js","./Copy-a69620a8.js","./BlockLabel-59adcbbb.js","./Index-7ea7c4ca.css"]:void 0,import.meta.url) 812 }, 813"checkbox": { 814 example: () => __vitePreload(() => import('./Example-ce3e8356.js'),true?["./Example-ce3e8356.js","./Example-55d94c71.css"]:void 0,import.meta.url), 815 816 component: () => __vitePreload(() => import('./Index-17ed5bc8.js'),true?["./Index-17ed5bc8.js","./Button-515ad287.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-2a9911a9.css","./Info-4519ff72.js","./Index-6224b77c.css"]:void 0,import.meta.url) 817 }, 818"checkboxgroup": { 819 example: () => __vitePreload(() => import('./Example-a2cac5a5.js'),true?["./Example-a2cac5a5.js","./Example-55d94c71.css"]:void 0,import.meta.url), 820 821 component: () => __vitePreload(() => import('./Index-75346e66.js'),true?["./Index-75346e66.js","./Button-515ad287.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-2a9911a9.css","./BlockTitle-26127777.js","./Info-4519ff72.js","./Index-5676d3d3.css"]:void 0,import.meta.url) 822 }, 823"code": { 824 example: () => __vitePreload(() => import('./Example-26f7bda8.js'),true?["./Example-26f7bda8.js","./Example-c56e7331.css"]:void 0,import.meta.url), 825 826 component: () => __vitePreload(() => import('./Index-b36a50da.js').then(n => n.F),true?["./Index-b36a50da.js","./index-7905665e.js","./index-e657421a.css","./Button-515ad287.js","./Index-a19f568c.js","./Index-52a9d5ff.css","./Button-2a9911a9.css","./Check-f7edb5d9.js","./Copy-a69620a8.js","./DownloadLink-f05b00bb.js","./file-url-8dc1c09f.js","./BlockLabel-59adcbbb.js","./Empty-b82e3792.js","./Example-26f7bda8.js","./Example-c56e7331.css","./Index-9369397e.css"]:void 0,import.meta.url) 827 }, 828"colorpicker": { 829 example: () => __vitePreload(() => import('./Example-85be0e05.js'),true?["./Example-85be0e05.js","./Example-5be72496.css"]:void 0,import.meta.url), 830 831 component: () => __vitePreload(() => import('./Index-6a2c8aa5.js'),true?["./Index-6a2c8aa5.js","./Button-515ad287.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-2a9911a9.css","./BlockTitle-26127777.js","./Info-4519ff72.js","./Example-85be0e05.js","./Example-5be72496.css","./Index-497c6364.css"]:void 0,import.meta.url) 832 }, 833"column": { 834 835 component: () => __vitePreload(() => import('./Index-24a33ce1.js'),true?["./Index-24a33ce1.js","./Index-2abed479.css"]:void 0,import.meta.url) 836 }, 837"dataframe": { 838 example: () => __vitePreload(() => import('./Example-7d6bb9b6.js'),true?["./Example-7d6bb9b6.js","./dsv-a37bb3db.js","./Example-aca1592e.css"]:void 0,import.meta.url), 839 840 component: () => __vitePreload(() => import('./Index-66b7e0ee.js'),true?["./Index-66b7e0ee.js","./Button-515ad287.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-2a9911a9.css","./index-21d69e4c.js","./utils-013c0d40.js","./ModifyUpload.svelte_svelte_type_style_lang-9c565bcf.js","./ModifyUpload-7d41bdb3.css","./Index.svelte_svelte_type_style_lang-6093f3be.js","./Example.
840svelte_svelte_type_style_lang-3c6b3e79.js","./prism-python-4704117c.js","./Example-5fbca523.css","./Index-11e1685d.css","./dsv-a37bb3db.js","./Example-7d6bb9b6.js","./Example-aca1592e.css","./Index-960777cd.css"]:void 0,import.meta.url) 841 }, 842"dataset": { 843 844 component: () => __vitePreload(() => import('./Index-3db412fe.js'),true?["./Index-3db412fe.js","./Button-515ad287.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-2a9911a9.css","./Index-52db28fc.css"]:void 0,import.meta.url) 845 }, 846"dropdown": { 847 example: () => __vitePreload(() => import('./Example-84a3b179.js'),true?["./Example-84a3b179.js","./Example-55d94c71.css"]:void 0,import.meta.url), 848 849 component: () => __vitePreload(() => import('./Index-c0981c0c.js'),true?["./Index-c0981c0c.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-515ad287.js","./Button-2a9911a9.css","./BlockTitle-26127777.js","./Info-4519ff72.js","./DropdownArrow-79cdb392.js","./Example-84a3b179.js","./Example-55d94c71.css","./Index-99d07eaa.css"]:void 0,import.meta.url) 850 }, 851"file": { 852 example: () => __vitePreload(() => import('./Example-04e4c2ae.js'),true?["./Example-04e4c2ae.js","./Example-4f56d95a.css"]:void 0,import.meta.url), 853 854 component: () => __vitePreload(() => import('./Index-7e29e33e.js'),true?["./Index-7e29e33e.js","./FileUpload-c8dcb844.js","./Button-515ad287.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-2a9911a9.css","./BlockLabel-59adcbbb.js","./Empty-b82e3792.js","./File-e96cd7d6.js","./ModifyUpload.svelte_svelte_type_style_lang-9c565bcf.js","./ModifyUpload-7d41bdb3.css","./ModifyUpload-9839c63f.js","./IconButton-8c191862.js","./Upload-96564545.js","./DownloadLink-f05b00bb.js","./file-url-8dc1c09f.js","./Undo-6c110254.js","./FileUpload-284cdfec.css","./UploadText-5118a6cd.js","./Example-04e4c2ae.js","./Example-4f56d95a.css"]:void 0,import.meta.url) 855 }, 856"fileexplorer": { 857 example: () => __vitePreload(() => import('./Example-e80d1b80.js'),true?["./Example-e80d1b80.js","./Example-7cc47009.css"]:void 0,import.meta.url), 858 859 component: () => __vitePreload(() => import('./Index-01818d03.js'),true?["./Index-01818d03.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./File-e96cd7d6.js","./Button-515ad287.js","./Button-2a9911a9.css","./BlockLabel-59adcbbb.js","./Index-211277ac.css"]:void 0,import.meta.url) 860 }, 861"form": { 862 863 component: () => __vitePreload(() => import('./Index-0d7ad3de.js'),true?["./Index-0d7ad3de.js","./Index-7ab72019.css"]:void 0,import.meta.url) 864 }, 865"gallery": { 866 867 component: () => __vitePreload(() => import('./Index-03d9f7ea.js'),true?["./Index-03d9f7ea.js","./Button-515ad287.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-2a9911a9.css","./UploadText-5118a6cd.js","./Upload-96564545.js","./BlockLabel-59adcbbb.js","./IconButton-8c191862.js","./Empty-b82e3792.js","./ShareButton-4a821dc3.js","./utils-013c0d40.js","./DownloadLink-f05b00bb.js","./file-url-8dc1c09f.js","./Image-6cbf81d1.js","./ModifyUpload.svelte_svelte_type_style_lang-9c565bcf.js","./ModifyUpload-7d41bdb3.css","./ModifyUpload-9839c63f.js","./Undo-6c110254.js","./Image-f2cd351b.js","./Image-7b829b60.css","./FileUpload-c8dcb844.js","./File-e96cd7d6.js","./FileUpload-284cdfec.css","./Index-316eaab2.css","./Example-4f56d95a.css"]:void 0,import.meta.url) 868 }, 869"group": { 870 871 component: () => __vitePreload(() => import('./Index-a3ffbeb0.js'),true?["./Index-a3ffbeb0.js","./Index-e45a2b11.css"]:void 0,import.meta.url) 872 }, 873"highlightedtext": { 874 875 component: () => __vitePreload(() => import('./Index-e9d65697.js'),true?["./Index-e9d65697.js","./color-efc51a40.js","./Button-515ad287.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-2a9911a9.css","./BlockLabel-59adcbbb.js","./Empty-b82e3792.js","./Index-a4c50cbd.css"]:void 0,import.meta.url) 876 }, 877"html": { 878 example: () => __vitePreload(() => import('./Example-39f519bd.js'),true?["./Example-39f519bd.js","./Example-eac655f5.css"]:void 0,import.meta.url), 879 880 component: () => __vitePreload(() => import('./Index-a6b22f5a.js'),true?["./Index-a6b22f5a.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-515ad287.js","./Button-2a9911a9.css","./Index-5538a1d8.css"]:void 0,import.meta.url) 881 }, 882"image": { 883 example: () => __vitePreload(() => import('./Example-6974dad0.js'),true?["./Example-6974dad0.js","./Image-f2cd351b.js","./file-url-8dc1c09f.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Image-7b829b60.css","./Example-e441efe6.css"]:void 0,import.meta.url), 884 885 component: () => __vitePreload(() => import('./Index-51b49198.js'),true?["./Index-51b49198.js","./ImageUploader-794965b4.js","./Button-515ad287.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-2a9911a9.css","./utils-013c0d40.js","./BlockLabel-59adcbbb.js","./IconButton-8c191862.
885js","./Empty-b82e3792.js","./ShareButton-4a821dc3.js","./DownloadLink-f05b00bb.js","./file-url-8dc1c09f.js","./Image-6cbf81d1.js","./Image-f2cd351b.js","./Image-7b829b60.css","./SelectSource-7173a592.js","./Upload-96564545.js","./DropdownArrow-79cdb392.js","./ModifyUpload.svelte_svelte_type_style_lang-9c565bcf.js","./ModifyUpload-7d41bdb3.css","./ImageUploader-57e340a3.css","./UploadText-5118a6cd.js","./Example-6974dad0.js","./Example-e441efe6.css"]:void 0,import.meta.url) 886 }, 887"imageeditor": { 888 example: () => __vitePreload(() => import('./Example-70bbc66b.js'),true?["./Example-70bbc66b.js","./ImageUploader-794965b4.js","./Button-515ad287.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-2a9911a9.css","./utils-013c0d40.js","./BlockLabel-59adcbbb.js","./IconButton-8c191862.js","./Empty-b82e3792.js","./ShareButton-4a821dc3.js","./DownloadLink-f05b00bb.js","./file-url-8dc1c09f.js","./Image-6cbf81d1.js","./Image-f2cd351b.js","./Image-7b829b60.css","./SelectSource-7173a592.js","./Upload-96564545.js","./DropdownArrow-79cdb392.js","./ModifyUpload.svelte_svelte_type_style_lang-9c565bcf.js","./ModifyUpload-7d41bdb3.css","./ImageUploader-57e340a3.css","./Example-2b10ae8c.css","./Example-e441efe6.css"]:void 0,import.meta.url), 889 890 component: () => __vitePreload(() => import('./Index-862e63aa.js'),true?["./Index-862e63aa.js","./ImageUploader-794965b4.js","./Button-515ad287.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-2a9911a9.css","./utils-013c0d40.js","./BlockLabel-59adcbbb.js","./IconButton-8c191862.js","./Empty-b82e3792.js","./ShareButton-4a821dc3.js","./DownloadLink-f05b00bb.js","./file-url-8dc1c09f.js","./Image-6cbf81d1.js","./Image-f2cd351b.js","./Image-7b829b60.css","./SelectSource-7173a592.js","./Upload-96564545.js","./DropdownArrow-79cdb392.js","./ModifyUpload.svelte_svelte_type_style_lang-9c565bcf.js","./ModifyUpload-7d41bdb3.css","./ImageUploader-57e340a3.css","./__vite-browser-external-cb19bde2.js","./Check-f7edb5d9.js","./Undo-6c110254.js","./Index-20f25ba4.css","./Example-e441efe6.css"]:void 0,import.meta.url) 891 }, 892"json": { 893 894 component: () => __vitePreload(() => import('./Index-b3babf86.js'),true?["./Index-b3babf86.js","./Button-515ad287.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-2a9911a9.css","./Check-f7edb5d9.js","./Copy-a69620a8.js","./Empty-b82e3792.js","./BlockLabel-59adcbbb.js","./Index-8659c753.css"]:void 0,import.meta.url) 895 }, 896"label": { 897 898 component: () => __vitePreload(() => import('./Index-7314fd47.js'),true?["./Index-7314fd47.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-515ad287.js","./Button-2a9911a9.css","./BlockLabel-59adcbbb.js","./Empty-b82e3792.js","./Index-d2e7a806.css"]:void 0,import.meta.url) 899 }, 900"markdown": { 901 example: () => __vitePreload(() => import('./Example-e54a3c35.js'),true?["./Example-e54a3c35.js","./Example.
901svelte_svelte_type_style_lang-3c6b3e79.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./prism-python-4704117c.js","./Example-5fbca523.css"]:void 0,import.meta.url), 902 903 component: () => __vitePreload(() => import('./Index-e68ce6da.js'),true?["./Index-e68ce6da.js","./Index.svelte_svelte_type_style_lang-6093f3be.js","./Button-515ad287.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-2a9911a9.css","./utils-013c0d40.js","./Example.svelte_svelte_type_style_lang-3c6b3e79.js","./prism-python-4704117c.js","./Example-5fbca523.css","./Index-11e1685d.css","./Example-e54a3c35.js"]:void 0,import.meta.url) 904 }, 905"model3d": { 906 example: () => __vitePreload(() => import('./Example-a0d6492c.js'),true?["./Example-a0d6492c.js","./Example-55d94c71.css"]:void 0,import.meta.url), 907 908 component: () => __vitePreload(() => import('./Index-a18fefa7.js'),true?["./Index-a18fefa7.js","./index-7905665e.js","./index-e657421a.css","./Button-515ad287.js","./Index-a19f568c.js","./Index-52a9d5ff.css","./Button-2a9911a9.css","./BlockLabel-59adcbbb.js","./IconButton-8c191862.js","./DownloadLink-f05b00bb.js","./file-url-8dc1c09f.js","./File-e96cd7d6.js","./Undo-6c110254.js","./ModifyUpload.svelte_svelte_type_style_lang-9c565bcf.js","./ModifyUpload-7d41bdb3.css","./ModifyUpload-9839c63f.js","./Upload-96564545.js","./Empty-b82e3792.js","./UploadText-5118a6cd.js","./Example-a0d6492c.js","./Example-55d94c71.css","./Index-c5d3e223.css"]:void 0,import.meta.url) 909 }, 910"number": { 911 example: () => __vitePreload(() => import('./Example-6dde398e.js'),true?["./Example-6dde398e.js","./Example-55d94c71.css"]:void 0,import.meta.url), 912 913 component: () => __vitePreload(() => import('./Index-7b5d9685.js'),true?["./Index-7b5d9685.js","./Button-515ad287.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-2a9911a9.css","./BlockTitle-26127777.js","./Info-4519ff72.js","./Index-8bd4bdf3.css"]:void 0,import.meta.url) 914 }, 915"paramviewer": { 916 example: () => __vitePreload(() => import('./Example-2fbf541e.js'),true?["./Example-2fbf541e.js","./Example-55d94c71.css"]:void 0,import.meta.url), 917 918 component: () => __vitePreload(() => import('./Index-edf41ba1.js'),true?["./Index-edf41ba1.js","./prism-python-4704117c.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Index-0c1d17c9.css"]:void 0,import.meta.url) 919 }, 920"plot": { 921 922 component: () => __vitePreload(() => import('./Index-ed21142b.js'),true?["./Index-ed21142b.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-515ad287.js","./Button-2a9911a9.css","./color-efc51a40.js","./dsv-a37bb3db.js","./Empty-b82e3792.js","./BlockLabel-59adcbbb.js","./Index-31740b2a.css"]:void 0,import.meta.url) 923 }, 924"radio": { 925 example: () => __vitePreload(() => import('./Example-b79eee1b.js'),true?["./Example-b79eee1b.js","./Example-55d94c71.css"]:void 0,import.meta.url), 926 927 component: () => __vitePreload(() => import('./Index-59aab71a.js'),true?["./Index-59aab71a.js","./Button-515ad287.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-2a9911a9.css","./BlockTitle-26127777.js","./Info-4519ff72.js","./Example-b79eee1b.js","./Example-55d94c71.css","./Index-f43ff834.css"]:void 0,import.meta.url) 928 }, 929"row": { 930 931 component: () => __vitePreload(() => import('./Index-7cbc3ec9.js'),true?["./Index-7cbc3ec9.js","./Index-815f98ca.css"]:void 0,import.meta.url) 932 }, 933"slider": { 934 example: () => __vitePreload(() => import('./Example-94402048.js'),true?["./Example-94402048.js","./Example-55d94c71.css"]:void 0,import.meta.url), 935 936 component: () => __vitePreload(() => import('./Index-118aaac5.js'),true?["./Index-118aaac5.js","./Button-515ad287.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-2a9911a9.css","./BlockTitle-26127777.js","./Info-4519ff72.js","./Index-61d7d897.css"]:void 0,import.meta.url) 937 }, 938"state": { 939 940 component: () => __vitePreload(() => import('./Index-b2efa79d.js'),true?[]:void 0,import.meta.url) 941 }, 942"statustracker": { 943 944 component: () => __vitePreload(() => import('./index-586861c2.js'),true?["./index-586861c2.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-515ad287.js","./Button-2a9911a9.css"]:void 0,import.meta.url) 945 }, 946"tabitem": { 947 948 component: () => __vitePreload(() => import('./Index-be6211c1.js'),true?["./Index-be6211c1.js","./Tabs-6758c5cf.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Tabs-e53cc473.css","./Index-24a33ce1.js","./Index-2abed479.css","./Index-f5395e19.css"]:void 0,import.meta.url) 949 }, 950"tabs": { 951 952 component: () => __vitePreload(() => import('./Index-081c2c53.js'),true?["./Index-081c2c53.js","./Tabs-6758c5cf.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Tabs-e53cc473.css"]:void 0,import.meta.url) 953 }, 954"textbox": { 955 example: () => __vitePreload(() => import('./Example-e0df15d4.js'),true?["./Example-e0df15d4.js","./Example-e8628e88.css"]:void 0,import.meta.url), 956 957 component: () => __vitePreload(() => import('./Index-833d4772.js'),true?["./Index-833d4772.js","./Textbox-40ef2b25.js","./Button-515ad287.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-2a9911a9.css","./BlockTitle-26127777.js","./Info-4519ff72.js","./Check-f7edb5d9.js","./Copy-a69620a8.js","./Textbox-4c6022f4.css","./Example-e0df15d4.js","./Example-e8628e88.css"]:void 0,import.meta.url) 958 }, 959"uploadbutton": { 960 961 component: () => __vitePreload(() => import('./Index-6f3d0edc.js'),true?["./Index-6f3d0edc.js","./Button-515ad287.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Button-2a9911a9.css","./Index-dc08ef34.css"]:void 0,import.meta.url) 962 }, 963"video": { 964 example: () => __vitePreload(() => import('./Example-6e65d912.js'),true?["./Example-6e65d912.js","./Video-fd9c9c36.js","./file-url-8dc1c09f.js","./Index-a19f568c.js","./index-7905665e.js","./index-e657421a.css","./Index-52a9d5ff.css","./Video-540eb7aa.css","./Example-3390cfd5.css"]:void 0,import.meta.url), 965 966 component: () => __vitePreload(() => import('./index-4c4edf56.js'),true?["./index-4c4edf56.js","./ModifyUpload.svelte_svelte_type_style_lang-9c565bcf.js","./index-7905665e.js","./index-e657421a.css","./Index-a19f568c.js","./Index-52a9d5ff.css","./ModifyUpload-7d41bdb3.css","./ModifyUpload-9839c63f.js","./Button-515ad287.js","./Button-2a9911a9.css","./IconButton-8c191862.
966js","./Upload-96564545.js","./DownloadLink-f05b00bb.js","./file-url-8dc1c09f.js","./Undo-6c110254.js","./BlockLabel-59adcbbb.js","./SelectSource-7173a592.js","./ImageUploader-794965b4.js","./utils-013c0d40.js","./Empty-b82e3792.js","./ShareButton-4a821dc3.js","./Image-6cbf81d1.js","./Image-f2cd351b.js","./Image-7b829b60.css","./DropdownArrow-79cdb392.js","./ImageUploader-57e340a3.css","./Video-fd9c9c36.js","./Video-540eb7aa.css","./Trim-0317ad89.js","./Example-6e65d912.js","./Example-3390cfd5.css","./UploadText-5118a6cd.js","./index-bea7352a.css","./Example-e441efe6.css"]:void 0,import.meta.url) 967 }, 968 969}; 970 971 972// @ts-nocheck 973 974async function load_component({ api_url, name, id, variant }) { 975 const comps = window.__GRADIO__CC__; 976 977 const _component_map = { 978 // eslint-disable-next-line no-undef 979 ...component_map, 980 ...(!comps ? {} : comps) 981 }; 982 983 try { 984 const c = await ( 985 _component_map?.[id]?.[variant] || // for dev mode custom components 986 _component_map?.[name]?.[variant] 987 )(); 988 return { 989 name, 990 component: c 991 }; 992 } catch (e) { 993 console.error(e); 994 try { 995 await load_css(`${api_url}/custom_component/${id}/${variant}/style.css`); 996 const c = await __vitePreload(() => import( 997 /* @vite-ignore */ `${api_url}/custom_component/${id}/${variant}/index.js` 998 ),true?[]:void 0,import.meta.url); 999 return { 1000 name, 1001 component: c 1002 }; 1003 } catch (e) { 1004 if (variant === "example") { 1005 return { 1006 name, 1007 component: await __vitePreload(() => import('./Example-b742dabd.js'),true?["./Example-b742dabd.js","./Example-55d94c71.css"]:void 0,import.meta.url) 1008 }; 1009 } 1010 console.error(`failed to load: ${name}`); 1011 console.error(e); 1012 throw e; 1013 } 1014 } 1015} 1016 1017function load_css(url) { 1018 return new Promise((resolve, reject) => { 1019 const link = document.createElement("link"); 1020 link.rel = "stylesheet"; 1021 link.href = url; 1022 document.head.appendChild(link); 1023 link.onload = () => resolve(); 1024 link.onerror = () => reject(); 1025 }); 1026} 1027 1028function create_loading_status_store() { 1029 const store = writable({}); 1030 const fn_inputs = []; 1031 const fn_outputs = []; 1032 const pending_outputs = /* @__PURE__ */ new Map(); 1033 const pending_inputs = /* @__PURE__ */ new Map(); 1034 const inputs_to_update = /* @__PURE__ */ new Map(); 1035 const fn_status = []; 1036 function update({ 1037 fn_index, 1038 status, 1039 queue = true, 1040 size, 1041 position = null, 1042 eta = null, 1043 message = null, 1044 progress 1045 }) { 1046 const outputs = fn_outputs[fn_index]; 1047 const inputs = fn_inputs[fn_index]; 1048 const last_status = fn_status[fn_index]; 1049 const outputs_to_update = outputs.map((id) => { 1050 let new_status; 1051 const pending_count = pending_outputs.get(id) || 0; 1052 if (last_status === "pending" && status !== "pending") { 1053 let new_count = pending_count - 1; 1054 pending_outputs.set(id, new_count < 0 ? 0 : new_count); 1055 new_status = new_count > 0 ? "pending" : status; 1056 } else if (last_status === "pending" && status === "pending") { 1057 new_status = "pending"; 1058 } else if (last_status !== "pending" && status === "pending") { 1059 new_status = "pending"; 1060 pending_outputs.set(id, pending_count + 1); 1061 } else { 1062 new_status = status; 1063 } 1064 return { 1065 id, 1066 queue_position: position, 1067 queue_size: size, 1068 eta, 1069 status: new_status, 1070 message, 1071 progress 1072 }; 1073 }); 1074 inputs.forEach((id) => { 1075 const pending_count = pending_inputs.get(id) || 0; 1076 if (last_status === "pending" && status !== "pending") { 1077 let new_count = pending_count - 1; 1078 pending_inputs.set(id, new_count < 0 ? 0 : new_count); 1079 inputs_to_update.set(id, status); 1080 } else if (last_status !== "pending" && status === "pending") { 1081 pending_inputs.set(id, pending_count + 1); 1082 inputs_to_update.set(id, status); 1083 } else { 1084 inputs_to_update.delete(id); 1085 } 1086 }); 1087 store.update((outputs2) => { 1088 outputs_to_update.forEach( 1089 ({ 1090 id, 1091 queue_position, 1092 queue_size, 1093 eta: eta2, 1094 status: status2, 1095 message: message2, 1096 progress: progress2 1097 }) => { 1098 outputs2[id] = { 1099 queue, 1100 queue_size, 1101 queue_position, 1102 eta: eta2, 1103 message: message2, 1104 progress: progress2, 1105 status: status2, 1106 fn_index 1107 }; 1108 } 1109 ); 1110 return outputs2; 1111 }); 1112 fn_status[fn_index] = status; 1113 } 1114 function register(index, inputs, outputs) {
1115 fn_inputs[index] = inputs; 1116 fn_outputs[index] = outputs; 1117 } 1118 return { 1119 update, 1120 register, 1121 subscribe: store.subscribe, 1122 get_status_for_fn(i) { 1123 return fn_status[i]; 1124 }, 1125 get_inputs_to_update() { 1126 return inputs_to_update; 1127 } 1128 }; 1129} 1130 1131/* src/api_docs/img/clear.svelte generated by Svelte v4.2.2 */ 1132const { 1133 SvelteComponent: SvelteComponent$b, 1134 append: append$8, 1135 attr: attr$8, 1136 detach: detach$a, 1137 init: init$b, 1138 insert: insert$a, 1139 noop: noop$4, 1140 safe_not_equal: safe_not_equal$b, 1141 set_style: set_style$1, 1142 svg_element 1143} = window.__gradio__svelte__internal; 1144function create_fragment$b(ctx) { 1145 let svg; 1146 let g; 1147 let path0; 1148 let path1; 1149 1150 return { 1151 c() { 1152 svg = svg_element("svg"); 1153 g = svg_element("g"); 1154 path0 = svg_element("path"); 1155 path1 = svg_element("path"); 1156 attr$8(path0, "d", "M3.789,0.09C3.903,-0.024 4.088,-0.024 4.202,0.09L4.817,0.705C4.931,0.819 4.931,1.004 4.817,1.118L1.118,4.817C1.004,4.931 0.819,4.931 0.705,4.817L0.09,4.202C-0.024,4.088 -0.024,3.903 0.09,3.789L3.789,0.09Z"); 1157 attr$8(path1, "d", "M4.825,3.797C4.934,3.907 4.934,4.084 4.825,4.193L4.193,4.825C4.084,4.934 3.907,4.934 3.797,4.825L0.082,1.11C-0.027,1.001 -0.027,0.823 0.082,0.714L0.714,0.082C0.823,-0.027 1.001,-0.027 1.11,0.082L4.825,3.797Z"); 1158 attr$8(svg, "width", "100%"); 1159 attr$8(svg, "height", "100%"); 1160 attr$8(svg, "viewBox", "0 0 5 5"); 1161 attr$8(svg, "version", "1.1"); 1162 attr$8(svg, "xmlns", "http://www.w3.org/2000/svg"); 1163 attr$8(svg, "xmlns:xlink", "http://www.w3.org/1999/xlink"); 1164 attr$8(svg, "xml:space", "preserve"); 1165 set_style$1(svg, "fill", "currentColor"); 1166 set_style$1(svg, "fill-rule", "evenodd"); 1167 set_style$1(svg, "clip-rule", "evenodd"); 1168 set_style$1(svg, "stroke-linejoin", "round"); 1169 set_style$1(svg, "stroke-miterlimit", "2"); 1170 }, 1171 m(target, anchor) { 1172 insert$a(target, svg, anchor); 1173 append$8(svg, g); 1174 append$8(g, path0); 1175 append$8(g, path1); 1176 }, 1177 p: noop$4, 1178 i: noop$4, 1179 o: noop$4, 1180 d(detaching) { 1181 if (detaching) { 1182 detach$a(svg); 1183 } 1184 } 1185 }; 1186} 1187 1188class Clear extends SvelteComponent$b { 1189 constructor(options) { 1190 super(); 1191 init$b(this, options, null, create_fragment$b, safe_not_equal$b, {}); 1192 } 1193} 1194 1195const NoApi_svelte_svelte_type_style_lang = ''; 1196 1197/* src/api_docs/NoApi.svelte generated by Svelte v4.2.2 */ 1198const { 1199 SvelteComponent: SvelteComponent$a, 1200 append: append$7, 1201 attr: attr$7, 1202 create_component: create_component$9, 1203 destroy_component: destroy_component$9, 1204 detach: detach$9, 1205 element: element$7, 1206 init: init$a, 1207 insert: insert$9, 1208 listen: listen$3, 1209 mount_component: mount_component$9, 1210 safe_not_equal: safe_not_equal$a, 1211 set_data: set_data$6, 1212 space: space$6, 1213 text: text$7, 1214 transition_in: transition_in$9, 1215 transition_out: transition_out$9 1216} = window.__gradio__svelte__internal; 1217const { createEventDispatcher: createEventDispatcher$4 } = window.__gradio__svelte__internal; 1218function create_fragment$a(ctx) { 1219 let div; 1220 let h1; 1221 let t1; 1222 let p0; 1223 let t2; 1224 let code0; 1225 let t3; 1226 let t4; 1227 let p1; 1228 let t15; 1229 let button; 1230 let clear; 1231 let current; 1232 let mounted; 1233 let dispose; 1234 clear = new Clear({}); 1235 1236 return { 1237 c() { 1238 div = element$7("div"); 1239 h1 = element$7("h1"); 1240 h1.textContent = "API Docs"; 1241 t1 = space$6(); 1242 p0 = element$7("p"); 1243 t2 = text$7("No API Routes found for\n\t\t"); 1244 code0 = element$7("code"); 1245 t3 = text$7(/*root*/ ctx[0]); 1246 t4 = space$6(); 1247 p1 = element$7("p"); 1248 1249 p1.innerHTML = `To expose an API endpoint of your app in this page, set the <code>api_name</code> 1250 parameter of the event listener. 1251 <br/> 1252 For more information, visit the 1253 <a href="https://gradio.app/sharing_your_app/#api-page" target="_blank">API Page guide</a> 1254 . To hide the API documentation button and this page, set 1255 <code>show_api=False</code> 1256 in the 1257 <code>Blocks.launch()</code> 1258 method.`; 1259 1260 t15 = space$6(); 1261 button = element$7("button"); 1262 create_component$9(clear.$$.fragment); 1263 attr$7(code0, "class", "svelte-e1ha0f"); 1264 attr$7(p0, "class", "attention svelte-e1ha0f"); 1265 attr$7(div, "class", "wrap prose svelte-e1ha0f"); 1266 attr$7(button, "class", "svelte-e1ha0f"); 1267 }, 1268 m(target, anchor) { 1269 insert$9(target, div, anchor); 1270 append$7(div, h1); 1271 append$7(div, t1); 1272 append$7(div, p0); 1273 append$7(p0, t2); 1274 append$7(p0, code0); 1275 append$7(code0, t3); 1276 append$7(div, t4); 1277 append$7(div, p1); 1278 insert$9(target, t15, anchor); 1279 insert$9(target, button, anchor);
1280 mount_component$9(clear, button, null); 1281 current = true; 1282 1283 if (!mounted) { 1284 dispose = listen$3(button, "click", /*click_handler*/ ctx[2]); 1285 mounted = true; 1286 } 1287 }, 1288 p(ctx, [dirty]) { 1289 if (!current || dirty & /*root*/ 1) set_data$6(t3, /*root*/ ctx[0]); 1290 }, 1291 i(local) { 1292 if (current) return; 1293 transition_in$9(clear.$$.fragment, local); 1294 current = true; 1295 }, 1296 o(local) { 1297 transition_out$9(clear.$$.fragment, local); 1298 current = false; 1299 }, 1300 d(detaching) { 1301 if (detaching) { 1302 detach$9(div); 1303 detach$9(t15); 1304 detach$9(button); 1305 } 1306 1307 destroy_component$9(clear); 1308 mounted = false; 1309 dispose(); 1310 } 1311 }; 1312} 1313 1314function instance$a($$self, $$props, $$invalidate) { 1315 const dispatch = createEventDispatcher$4(); 1316 let { root } = $$props; 1317 const click_handler = () => dispatch("close"); 1318 1319 $$self.$$set = $$props => { 1320 if ('root' in $$props) $$invalidate(0, root = $$props.root); 1321 }; 1322 1323 return [root, dispatch, click_handler]; 1324} 1325 1326class NoApi extends SvelteComponent$a { 1327 constructor(options) { 1328 super(); 1329 init$a(this, options, instance$a, create_fragment$a, safe_not_equal$a, { root: 0 }); 1330 } 1331} 1332 1333function represent_value(value, type, lang = null) { 1334 if (type === void 0) { 1335 return lang === "py" ? "None" : null; 1336 } 1337 if (type === "string" || type === "str" || type == "filepath") { 1338 return lang === null ? value : '"' + value + '"'; 1339 } else if (type === "number") { 1340 return lang === null ? parseFloat(value) : value; 1341 } else if (type === "boolean" || type == "bool") { 1342 if (lang === "py") { 1343 value = String(value); 1344 return value === "true" ? "True" : "False"; 1345 } else if (lang === "js") { 1346 return value; 1347 } 1348 return value === "true"; 1349 } else if (type === "List[str]") { 1350 value = JSON.stringify(value); 1351 return value; 1352 } else if (type.startsWith("Literal['")) { 1353 return '"' + value + '"'; 1354 } 1355 if (lang === null) { 1356 return value === "" ? null : JSON.parse(value); 1357 } else if (typeof value === "string") { 1358 if (value === "") { 1359 return lang === "py" ? "None" : "null"; 1360 } 1361 return value; 1362 } 1363 return JSON.stringify(value); 1364} 1365 1366const api_logo = ""+new URL('api-logo-5346f193.svg', import.meta.url).href+""; 1367 1368const ApiBanner_svelte_svelte_type_style_lang = ''; 1369 1370/* src/api_docs/ApiBanner.svelte generated by Svelte v4.2.2 */ 1371const { 1372 SvelteComponent: SvelteComponent$9, 1373 append: append$6, 1374 attr: attr$6, 1375 create_component: create_component$8, 1376 destroy_component: destroy_component$8, 1377 detach: detach$8, 1378 element: element$6, 1379 init: init$9, 1380 insert: insert$8, 1381 listen: listen$2, 1382 mount_component: mount_component$8, 1383 safe_not_equal: safe_not_equal$9, 1384 set_data: set_data$5, 1385 space: space$5, 1386 src_url_equal: src_url_equal$2, 1387 text: text$6, 1388 transition_in: transition_in$8, 1389 transition_out: transition_out$8 1390} = window.__gradio__svelte__internal; 1391const { createEventDispatcher: createEventDispatcher$3 } = window.__gradio__svelte__internal; 1392function create_if_block$7(ctx) { 1393 let t; 1394 1395 return { 1396 c() { 1397 t = text$6("s"); 1398 }, 1399 m(target, anchor) { 1400 insert$8(target, t, anchor); 1401 }, 1402 d(detaching) { 1403 if (detaching) { 1404 detach$8(t); 1405 } 1406 } 1407 }; 1408} 1409 1410function create_fragment$9(ctx) { 1411 let h2; 1412 let img; 1413 let img_src_value; 1414 let t0; 1415 let div1; 1416 let t1; 1417 let div0; 1418 let t2; 1419 let t3; 1420 let span1; 1421 let span0; 1422 let t4; 1423 let t5; 1424 let t6; 1425 let button; 1426 let clear; 1427 let current; 1428 let mounted; 1429 let dispose; 1430 let if_block = /*api_count*/ ctx[1] > 1 && create_if_block$7(); 1431 clear = new Clear({}); 1432 1433 return { 1434 c() { 1435 h2 = element$6("h2"); 1436 img = element$6("img"); 1437 t0 = space$5(); 1438 div1 = element$6("div"); 1439 t1 = text$6("API documentation\n\t\t"); 1440 div0 = element$6("div"); 1441 t2 = text$6(/*root*/ ctx[0]); 1442 t3 = space$5(); 1443 span1 = element$6("span"); 1444 span0 = element$6("span"); 1445 t4 = text$6(/*api_count*/ ctx[1]); 1446 t5 = text$6(" API endpoint"); 1447 if (if_block) if_block.c(); 1448 t6 = space$5(); 1449 button = element$6("button"); 1450 create_component$8(clear.$$.fragment); 1451 if (!src_url_equal$2(img.src, img_src_value = api_logo)) attr$6(img, "src", img_src_value); 1452 attr$6(img, "alt", ""); 1453 attr$6(img, "class", "svelte-3n2nxs"); 1454 attr$6(div0, "class", "url svelte-3n2nxs"); 1455 attr$6(span0, "class", "url svelte-3n2nxs"); 1456 attr$6(span1, "class", "counts svelte-3n2nxs"); 1457 attr$6(h2, "class", "svelte-3n2nxs"); 1458 attr$6(button, "class", "svelte-3n2nxs"); 1459 }, 1460 m(target, anchor) { 1461 insert$8(target, h2, anchor); 1462 append$6(h2, img); 1463 append$6(h2, t0); 1464 append$6(h2, div1); 1465 append$6(div1, t1); 1466 append$6(div1, div0); 1467 append$6(div0, t2); 1468 append$6(h2, t3); 1469 append$6(h2, span1); 1470 append$6(span1, span0); 1471 append$6(span0, t4); 1472 append$6(span1, t5); 1473 if (if_block) if_block.m(span1, null); 1474 insert$8(target, t6, anchor); 1475 insert$8(target, button, anchor);
1476 mount_component$8(clear, button, null); 1477 current = true; 1478 1479 if (!mounted) { 1480 dispose = listen$2(button, "click", /*click_handler*/ ctx[3]); 1481 mounted = true; 1482 } 1483 }, 1484 p(ctx, [dirty]) { 1485 if (!current || dirty & /*root*/ 1) set_data$5(t2, /*root*/ ctx[0]); 1486 if (!current || dirty & /*api_count*/ 2) set_data$5(t4, /*api_count*/ ctx[1]); 1487 1488 if (/*api_count*/ ctx[1] > 1) { 1489 if (if_block) ; else { 1490 if_block = create_if_block$7(); 1491 if_block.c(); 1492 if_block.m(span1, null); 1493 } 1494 } else if (if_block) { 1495 if_block.d(1); 1496 if_block = null; 1497 } 1498 }, 1499 i(local) { 1500 if (current) return; 1501 transition_in$8(clear.$$.fragment, local); 1502 current = true; 1503 }, 1504 o(local) { 1505 transition_out$8(clear.$$.fragment, local); 1506 current = false; 1507 }, 1508 d(detaching) { 1509 if (detaching) { 1510 detach$8(h2); 1511 detach$8(t6); 1512 detach$8(button); 1513 } 1514 1515 if (if_block) if_block.d(); 1516 destroy_component$8(clear); 1517 mounted = false; 1518 dispose(); 1519 } 1520 }; 1521} 1522 1523function instance$9($$self, $$props, $$invalidate) { 1524 let { root } = $$props; 1525 let { api_count } = $$props; 1526 const dispatch = createEventDispatcher$3(); 1527 const click_handler = () => dispatch("close"); 1528 1529 $$self.$$set = $$props => {
1530 if ('root' in $$props) $$invalidate(0, root = $$props.root); 1531 if ('api_count' in $$props) $$invalidate(1, api_count = $$props.api_count); 1532 }; 1533 1534 return [root, api_count, dispatch, click_handler]; 1535} 1536 1537class ApiBanner extends SvelteComponent$9 { 1538 constructor(options) { 1539 super(); 1540 init$9(this, options, instance$9, create_fragment$9, safe_not_equal$9, { root: 0, api_count: 1 }); 1541 } 1542} 1543 1544const ResponseObject_svelte_svelte_type_style_lang = ''; 1545 1546/* src/api_docs/ResponseObject.svelte generated by Svelte v4.2.2 */ 1547const { 1548 SvelteComponent: SvelteComponent$8, 1549 append: append$5, 1550 attr: attr$5, 1551 check_outros: check_outros$5, 1552 create_component: create_component$7, 1553 destroy_component: destroy_component$7, 1554 destroy_each: destroy_each$2, 1555 detach: detach$7, 1556 element: element$5, 1557 empty: empty$5, 1558 ensure_array_like: ensure_array_like$3, 1559 group_outros: group_outros$5, 1560 init: init$8, 1561 insert: insert$7, 1562 mount_component: mount_component$7, 1563 safe_not_equal: safe_not_equal$8, 1564 set_data: set_data$4, 1565 space: space$4, 1566 text: text$5, 1567 toggle_class, 1568 transition_in: transition_in$7, 1569 transition_out: transition_out$7 1570} = window.__gradio__svelte__internal; 1571function get_each_context$3(ctx, list, i) { 1572 const child_ctx = ctx.slice(); 1573 child_ctx[4] = list[i].label; 1574 child_ctx[5] = list[i].type; 1575 child_ctx[6] = list[i].python_type; 1576 child_ctx[7] = list[i].component; 1577 child_ctx[8] = list[i].serializer; 1578 child_ctx[10] = i; 1579 return child_ctx; 1580} 1581 1582// (18:3) {#if endpoint_returns.length > 1} 1583function create_if_block_6$2(ctx) { 1584 let t; 1585 1586 return { 1587 c() { 1588 t = text$5("("); 1589 }, 1590 m(target, anchor) { 1591 insert$7(target, t, anchor); 1592 }, 1593 d(detaching) { 1594 if (detaching) { 1595 detach$7(t); 1596 } 1597 } 1598 }; 1599} 1600 1601// (23:132) {:else} 1602function create_else_block$3(ctx) { 1603 let t_value = /*js_returns*/ ctx[2][/*i*/ ctx[10]].type + ""; 1604 let t; 1605 let if_block_anchor; 1606 let if_block = /*js_returns*/ ctx[2][/*i*/ ctx[10]].description && create_if_block_5$2(ctx); 1607 1608 return { 1609 c() { 1610 t = text$5(t_value); 1611 if (if_block) if_block.c(); 1612 if_block_anchor = empty$5(); 1613 }, 1614 m(target, anchor) { 1615 insert$7(target, t, anchor); 1616 if (if_block) if_block.m(target, anchor); 1617 insert$7(target, if_block_anchor, anchor); 1618 }, 1619 p(ctx, dirty) { 1620 if (dirty & /*js_returns*/ 4 && t_value !== (t_value = /*js_returns*/ ctx[2][/*i*/ ctx[10]].type + "")) set_data$4(t, t_value); 1621 1622 if (/*js_returns*/ ctx[2][/*i*/ ctx[10]].description) { 1623 if (if_block) { 1624 if_block.p(ctx, dirty); 1625 } else { 1626 if_block = create_if_block_5$2(ctx); 1627 if_block.c(); 1628 if_block.m(if_block_anchor.parentNode, if_block_anchor); 1629 } 1630 } else if (if_block) { 1631 if_block.d(1); 1632 if_block = null; 1633 } 1634 }, 1635 d(detaching) { 1636 if (detaching) { 1637 detach$7(t); 1638 detach$7(if_block_anchor); 1639 } 1640 1641 if (if_block) if_block.d(detaching); 1642 } 1643 }; 1644} 1645 1646// (23:11) {#if current_language === "python"} 1647function create_if_block_3$3(ctx) { 1648 let t_value = /*python_type*/ ctx[6].type + ""; 1649 let t; 1650 let if_block_anchor; 1651 let if_block = /*python_type*/ ctx[6]?.description && create_if_block_4$2(ctx); 1652 1653 return { 1654 c() { 1655 t = text$5(t_value); 1656 if (if_block) if_block.c(); 1657 if_block_anchor = empty$5(); 1658 }, 1659 m(target, anchor) { 1660 insert$7(target, t, anchor); 1661 if (if_block) if_block.m(target, anchor); 1662 insert$7(target, if_block_anchor, anchor); 1663 }, 1664 p(ctx, dirty) { 1665 if (dirty & /*endpoint_returns*/ 2 && t_value !== (t_value = /*python_type*/ ctx[6].type + "")) set_data$4(t, t_value); 1666 1667 if (/*python_type*/ ctx[6]?.description) { 1668 if (if_block) { 1669 if_block.p(ctx, dirty); 1670 } else { 1671 if_block = create_if_block_4$2(ctx); 1672 if_block.c(); 1673 if_block.m(if_block_anchor.parentNode, if_block_anchor); 1674 } 1675 } else if (if_block) { 1676 if_block.d(1); 1677 if_block = null; 1678 } 1679 }, 1680 d(detaching) { 1681 if (detaching) { 1682 detach$7(t); 1683 detach$7(if_block_anchor); 1684 } 1685 1686 if (if_block) if_block.d(detaching); 1687 } 1688 }; 1689} 1690 1691// (25:14) {#if js_returns[i].description} 1692function create_if_block_5$2(ctx) { 1693 let t0; 1694 let t1_value = /*js_returns*/ ctx[2][/*i*/ ctx[10]].description + ""; 1695 let t1; 1696 let t2; 1697 1698 return { 1699 c() { 1700 t0 = text$5("Â ("); 1701 t1 = text$5(t1_value); 1702 t2 = text$5(")"); 1703 }, 1704 m(target, anchor) { 1705 insert$7(target, t0, anchor); 1706 insert$7(target, t1, anchor); 1707 insert$7(target, t2, anchor); 1708 }, 1709 p(ctx, dirty) {
1710 if (dirty & /*js_returns*/ 4 && t1_value !== (t1_value = /*js_returns*/ ctx[2][/*i*/ ctx[10]].description + "")) set_data$4(t1, t1_value); 1711 }, 1712 d(detaching) { 1713 if (detaching) { 1714 detach$7(t0); 1715 detach$7(t1); 1716 detach$7(t2); 1717 } 1718 } 1719 }; 1720} 1721 1722// (23:64) {#if python_type?.description} 1723function create_if_block_4$2(ctx) { 1724 let t0; 1725 let t1_value = /*python_type*/ ctx[6].description + ""; 1726 let t1; 1727 let t2; 1728 1729 return { 1730 c() { 1731 t0 = text$5("Â ("); 1732 t1 = text$5(t1_value); 1733 t2 = text$5(")"); 1734 }, 1735 m(target, anchor) { 1736 insert$7(target, t0, anchor); 1737 insert$7(target, t1, anchor); 1738 insert$7(target, t2, anchor); 1739 }, 1740 p(ctx, dirty) { 1741 if (dirty & /*endpoint_returns*/ 2 && t1_value !== (t1_value = /*python_type*/ ctx[6].description + "")) set_data$4(t1, t1_value); 1742 }, 1743 d(detaching) { 1744 if (detaching) { 1745 detach$7(t0); 1746 detach$7(t1); 1747 detach$7(t2); 1748 } 1749 } 1750 }; 1751} 1752 1753// (32:6) {#if endpoint_returns.length > 1} 1754function create_if_block_2$3(ctx) { 1755 let t; 1756 1757 return { 1758 c() { 1759 t = text$5(","); 1760 }, 1761 m(target, anchor) { 1762 insert$7(target, t, anchor); 1763 }, 1764 d(detaching) { 1765 if (detaching) { 1766 detach$7(t); 1767 } 1768 } 1769 }; 1770} 1771 1772// (19:3) {#each endpoint_returns as { label, type, python_type, component, serializer } 1773function create_each_block$3(ctx) { 1774 let div; 1775 let span; 1776 let t0; 1777 let t1; 1778 let t2_value = /*label*/ ctx[4] + ""; 1779 let t2; 1780 let t3; 1781 let t4_value = /*component*/ ctx[7] + ""; 1782 let t4; 1783 let t5; 1784 1785 function select_block_type(ctx, dirty) { 1786 if (/*current_language*/ ctx[3] === "python") return create_if_block_3$3; 1787 return create_else_block$3; 1788 } 1789 1790 let current_block_type = select_block_type(ctx); 1791 let if_block0 = current_block_type(ctx); 1792 let if_block1 = /*endpoint_returns*/ ctx[1].length > 1 && create_if_block_2$3(); 1793 1794 return { 1795 c() { 1796 div = element$5("div"); 1797 span = element$5("span"); 1798 t0 = text$5("# "); 1799 if_block0.c(); 1800 t1 = text$5("\n\t\t\t\t\t\trepresenting output in '"); 1801 t2 = text$5(t2_value); 1802 t3 = text$5("' "); 1803 t4 = text$5(t4_value); 1804 t5 = text$5("\n\t\t\t\t\t\tcomponent"); 1805 if (if_block1) if_block1.c(); 1806 attr$5(span, "class", "desc svelte-1c7hj3i"); 1807 attr$5(div, "class", "svelte-1c7hj3i"); 1808 toggle_class(div, "second-level", /*endpoint_returns*/ ctx[1].length > 1); 1809 }, 1810 m(target, anchor) { 1811 insert$7(target, div, anchor); 1812 append$5(div, span); 1813 append$5(span, t0); 1814 if_block0.m(span, null); 1815 append$5(span, t1); 1816 append$5(span, t2); 1817 append$5(span, t3); 1818 append$5(span, t4); 1819 append$5(span, t5); 1820 if (if_block1) if_block1.m(div, null); 1821 }, 1822 p(ctx, dirty) { 1823 if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block0) { 1824 if_block0.p(ctx, dirty); 1825 } else { 1826 if_block0.d(1); 1827 if_block0 = current_block_type(ctx); 1828 1829 if (if_block0) { 1830 if_block0.c(); 1831 if_block0.m(span, t1); 1832 } 1833 } 1834 1835 if (dirty & /*endpoint_returns*/ 2 && t2_value !== (t2_value = /*label*/ ctx[4] + "")) set_data$4(t2, t2_value); 1836 if (dirty & /*endpoint_returns*/ 2 && t4_value !== (t4_value = /*component*/ ctx[7] + "")) set_data$4(t4, t4_value); 1837 1838 if (/*endpoint_returns*/ ctx[1].length > 1) { 1839 if (if_block1) ; else { 1840 if_block1 = create_if_block_2$3(); 1841 if_block1.c(); 1842 if_block1.m(div, null); 1843 } 1844 } else if (if_block1) { 1845 if_block1.d(1); 1846 if_block1 = null; 1847 } 1848 1849 if (dirty & /*endpoint_returns*/ 2) { 1850 toggle_class(div, "second-level", /*endpoint_returns*/ ctx[1].length > 1); 1851 } 1852 }, 1853 d(detaching) { 1854 if (detaching) { 1855 detach$7(div); 1856 } 1857 1858 if_block0.d(); 1859 if (if_block1) if_block1.d(); 1860 } 1861 }; 1862} 1863 1864// (35:3) {#if endpoint_returns.length > 1} 1865function create_if_block_1$4(ctx) { 1866 let t; 1867 1868 return { 1869 c() { 1870 t = text$5(")"); 1871 }, 1872 m(target, anchor) { 1873 insert$7(target, t, anchor); 1874 }, 1875 d(detaching) { 1876 if (detaching) { 1877 detach$7(t); 1878 } 1879 } 1880 }; 1881} 1882 1883// (37:2) {#if is_running} 1884function create_if_block$6(ctx) { 1885 let div; 1886 let loader; 1887 let current; 1888 loader = new Loader({ props: { margin: false } }); 1889 1890 return { 1891 c() { 1892 div = element$5("div"); 1893 create_component$7(loader.$$.fragment); 1894 attr$5(div, "class", "load-wrap svelte-1c7hj3i"); 1895 }, 1896 m(target, anchor) { 1897 insert$7(target, div, anchor);
1898 mount_component$7(loader, div, null); 1899 current = true; 1900 }, 1901 i(local) { 1902 if (current) return; 1903 transition_in$7(loader.$$.fragment, local); 1904 current = true; 1905 }, 1906 o(local) { 1907 transition_out$7(loader.$$.fragment, local); 1908 current = false; 1909 }, 1910 d(detaching) { 1911 if (detaching) { 1912 detach$7(div); 1913 } 1914 1915 destroy_component$7(loader); 1916 } 1917 }; 1918} 1919 1920// (15:0) <Block> 1921function create_default_slot$4(ctx) { 1922 let div1; 1923 let div0; 1924 let t0; 1925 let t1; 1926 let t2; 1927 let current; 1928 let if_block0 = /*endpoint_returns*/ ctx[1].length > 1 && create_if_block_6$2(); 1929 let each_value = ensure_array_like$3(/*endpoint_returns*/ ctx[1]); 1930 let each_blocks = []; 1931 1932 for (let i = 0; i < each_value.length; i += 1) { 1933 each_blocks[i] = create_each_block$3(get_each_context$3(ctx, each_value, i)); 1934 } 1935 1936 let if_block1 = /*endpoint_returns*/ ctx[1].length > 1 && create_if_block_1$4(); 1937 let if_block2 = /*is_running*/ ctx[0] && create_if_block$6(); 1938 1939 return { 1940 c() { 1941 div1 = element$5("div"); 1942 div0 = element$5("div"); 1943 if (if_block0) if_block0.c(); 1944 t0 = space$4(); 1945 1946 for (let i = 0; i < each_blocks.length; i += 1) { 1947 each_blocks[i].c(); 1948 } 1949 1950 t1 = space$4(); 1951 if (if_block1) if_block1.c(); 1952 t2 = space$4(); 1953 if (if_block2) if_block2.c(); 1954 attr$5(div0, "class", "svelte-1c7hj3i"); 1955 toggle_class(div0, "hide", /*is_running*/ ctx[0]); 1956 attr$5(div1, "class", "response-wrap svelte-1c7hj3i"); 1957 }, 1958 m(target, anchor) { 1959 insert$7(target, div1, anchor); 1960 append$5(div1, div0); 1961 if (if_block0) if_block0.m(div0, null); 1962 append$5(div0, t0); 1963 1964 for (let i = 0; i < each_blocks.length; i += 1) { 1965 if (each_blocks[i]) { 1966 each_blocks[i].m(div0, null); 1967 } 1968 } 1969 1970 append$5(div0, t1); 1971 if (if_block1) if_block1.m(div0, null); 1972 append$5(div1, t2); 1973 if (if_block2) if_block2.m(div1, null); 1974 current = true; 1975 }, 1976 p(ctx, dirty) { 1977 if (/*endpoint_returns*/ ctx[1].length > 1) { 1978 if (if_block0) ; else { 1979 if_block0 = create_if_block_6$2(); 1980 if_block0.c(); 1981 if_block0.m(div0, t0); 1982 } 1983 } else if (if_block0) { 1984 if_block0.d(1); 1985 if_block0 = null; 1986 } 1987 1988 if (dirty & /*endpoint_returns, current_language, js_returns*/ 14) { 1989 each_value = ensure_array_like$3(/*endpoint_returns*/ ctx[1]); 1990 let i; 1991 1992 for (i = 0; i < each_value.length; i += 1) { 1993 const child_ctx = get_each_context$3(ctx, each_value, i); 1994 1995 if (each_blocks[i]) { 1996 each_blocks[i].p(child_ctx, dirty); 1997 } else { 1998 each_blocks[i] = create_each_block$3(child_ctx); 1999 each_blocks[i].c(); 2000 each_blocks[i].m(div0, t1); 2001 } 2002 } 2003 2004 for (; i < each_blocks.length; i += 1) { 2005 each_blocks[i].d(1); 2006 } 2007 2008 each_blocks.length = each_value.length; 2009 } 2010 2011 if (/*endpoint_returns*/ ctx[1].length > 1) { 2012 if (if_block1) ; else { 2013 if_block1 = create_if_block_1$4(); 2014 if_block1.c(); 2015 if_block1.m(div0, null); 2016 } 2017 } else if (if_block1) { 2018 if_block1.d(1); 2019 if_block1 = null; 2020 } 2021 2022 if (!current || dirty & /*is_running*/ 1) { 2023 toggle_class(div0, "hide", /*is_running*/ ctx[0]); 2024 } 2025 2026 if (/*is_running*/ ctx[0]) { 2027 if (if_block2) { 2028 if (dirty & /*is_running*/ 1) { 2029 transition_in$7(if_block2, 1); 2030 } 2031 } else { 2032 if_block2 = create_if_block$6(); 2033 if_block2.c(); 2034 transition_in$7(if_block2, 1); 2035 if_block2.m(div1, null); 2036 } 2037 } else if (if_block2) { 2038 group_outros$5(); 2039 2040 transition_out$7(if_block2, 1, 1, () => { 2041 if_block2 = null; 2042 }); 2043 2044 check_outros$5(); 2045 } 2046 }, 2047 i(local) { 2048 if (current) return; 2049 transition_in$7(if_block2); 2050 current = true; 2051 }, 2052 o(local) { 2053 transition_out$7(if_block2); 2054 current = false; 2055 }, 2056 d(detaching) { 2057 if (detaching) { 2058 detach$7(div1); 2059 } 2060 2061 if (if_block0) if_block0.d(); 2062 destroy_each$2(each_blocks, detaching); 2063 if (if_block1) if_block1.d(); 2064 if (if_block2) if_block2.d(); 2065 } 2066 }; 2067} 2068 2069function create_fragment$8(ctx) { 2070 let h4; 2071 let t1; 2072 let block; 2073 let current; 2074 2075 block = new Block({ 2076 props: { 2077 $$slots: { default: [create_default_slot$4] }, 2078 $$scope: { ctx } 2079 } 2080 }); 2081 2082 return { 2083 c() { 2084 h4 = element$5("h4"); 2085 2086 h4.innerHTML = `<div class="toggle-icon svelte-1c7hj3i"><div class="toggle-dot svelte-1c7hj3i"></div></div> 2087 Return Type(s)`; 2088 2089 t1 = space$4(); 2090 create_component$7(block.$$.fragment); 2091 attr$5(h4, "class", "svelte-1c7hj3i"); 2092 }, 2093 m(target, anchor) {
2094 insert$7(target, h4, anchor); 2095 insert$7(target, t1, anchor); 2096 mount_component$7(block, target, anchor); 2097 current = true; 2098 }, 2099 p(ctx, [dirty]) { 2100 const block_changes = {}; 2101 2102 if (dirty & /*$$scope, is_running, endpoint_returns, current_language, js_returns*/ 2063) { 2103 block_changes.$$scope = { dirty, ctx }; 2104 } 2105 2106 block.$set(block_changes); 2107 }, 2108 i(local) { 2109 if (current) return; 2110 transition_in$7(block.$$.fragment, local); 2111 current = true; 2112 }, 2113 o(local) { 2114 transition_out$7(block.$$.fragment, local); 2115 current = false; 2116 }, 2117 d(detaching) { 2118 if (detaching) { 2119 detach$7(h4); 2120 detach$7(t1); 2121 } 2122 2123 destroy_component$7(block, detaching); 2124 } 2125 }; 2126} 2127 2128function instance$8($$self, $$props, $$invalidate) { 2129 let { is_running } = $$props; 2130 let { endpoint_returns } = $$props; 2131 let { js_returns } = $$props; 2132 let { current_language } = $$props; 2133 2134 $$self.$$set = $$props => { 2135 if ('is_running' in $$props) $$invalidate(0, is_running = $$props.is_running); 2136 if ('endpoint_returns' in $$props) $$invalidate(1, endpoint_returns = $$props.endpoint_returns);
2137 if ('js_returns' in $$props) $$invalidate(2, js_returns = $$props.js_returns); 2138 if ('current_language' in $$props) $$invalidate(3, current_language = $$props.current_language); 2139 }; 2140 2141 return [is_running, endpoint_returns, js_returns, current_language]; 2142} 2143 2144class ResponseObject extends SvelteComponent$8 { 2145 constructor(options) { 2146 super(); 2147 2148 init$8(this, options, instance$8, create_fragment$8, safe_not_equal$8, { 2149 is_running: 0, 2150 endpoint_returns: 1, 2151 js_returns: 2, 2152 current_language: 3 2153 }); 2154 } 2155} 2156 2157/* src/api_docs/CopyButton.svelte generated by Svelte v4.2.2 */ 2158const { 2159 SvelteComponent: SvelteComponent$7, 2160 create_component: create_component$6, 2161 destroy_component: destroy_component$6, 2162 detach: detach$6, 2163 init: init$7, 2164 insert: insert$6, 2165 mount_component: mount_component$6, 2166 safe_not_equal: safe_not_equal$7, 2167 set_data: set_data$3, 2168 text: text$4, 2169 transition_in: transition_in$6, 2170 transition_out: transition_out$6 2171} = window.__gradio__svelte__internal; 2172function create_default_slot$3(ctx) { 2173 let t; 2174 2175 return { 2176 c() { 2177 t = text$4(/*copy_text*/ ctx[0]); 2178 }, 2179 m(target, anchor) { 2180 insert$6(target, t, anchor); 2181 }, 2182 p(ctx, dirty) { 2183 if (dirty & /*copy_text*/ 1) set_data$3(t, /*copy_text*/ ctx[0]); 2184 }, 2185 d(detaching) { 2186 if (detaching) { 2187 detach$6(t); 2188 } 2189 } 2190 }; 2191} 2192 2193function create_fragment$7(ctx) { 2194 let basebutton; 2195 let current; 2196 2197 basebutton = new Button({ 2198 props: { 2199 size: "sm", 2200 $$slots: { default: [create_default_slot$3] }, 2201 $$scope: { ctx } 2202 } 2203 }); 2204 2205 basebutton.$on("click", /*copy*/ ctx[1]); 2206 2207 return { 2208 c() { 2209 create_component$6(basebutton.$$.fragment); 2210 }, 2211 m(target, anchor) { 2212 mount_component$6(basebutton, target, anchor); 2213 current = true; 2214 }, 2215 p(ctx, [dirty]) { 2216 const basebutton_changes = {}; 2217 2218 if (dirty & /*$$scope, copy_text*/ 9) { 2219 basebutton_changes.$$scope = { dirty, ctx }; 2220 } 2221 2222 basebutton.$set(basebutton_changes); 2223 }, 2224 i(local) { 2225 if (current) return; 2226 transition_in$6(basebutton.$$.fragment, local); 2227 current = true; 2228 }, 2229 o(local) { 2230 transition_out$6(basebutton.$$.fragment, local); 2231 current = false; 2232 }, 2233 d(detaching) { 2234 destroy_component$6(basebutton, detaching); 2235 } 2236 }; 2237} 2238 2239function instance$7($$self, $$props, $$invalidate) { 2240 let { code } = $$props; 2241 let copy_text = "copy"; 2242 2243 function copy() { 2244 navigator.clipboard.writeText(code); 2245 $$invalidate(0, copy_text = "copied!"); 2246 2247 setTimeout( 2248 () => { 2249 $$invalidate(0, copy_text = "copy"); 2250 }, 2251 1500 2252 ); 2253 } 2254 2255 $$self.$$set = $$props => {
2256 if ('code' in $$props) $$invalidate(2, code = $$props.code); 2257 }; 2258 2259 return [copy_text, copy, code]; 2260} 2261 2262class CopyButton extends SvelteComponent$7 { 2263 constructor(options) { 2264 super(); 2265 init$7(this, options, instance$7, create_fragment$7, safe_not_equal$7, { code: 2 }); 2266 } 2267} 2268 2269const InstallSnippet_svelte_svelte_type_style_lang = ''; 2270 2271/* src/api_docs/InstallSnippet.svelte generated by Svelte v4.2.2 */ 2272const { 2273 SvelteComponent: SvelteComponent$6, 2274 append: append$4, 2275 attr: attr$4, 2276 check_outros: check_outros$4, 2277 create_component: create_component$5, 2278 destroy_component: destroy_component$5, 2279 detach: detach$5, 2280 element: element$4, 2281 group_outros: group_outros$4, 2282 init: init$6, 2283 insert: insert$5, 2284 mount_component: mount_component$5, 2285 noop: noop$3, 2286 safe_not_equal: safe_not_equal$6, 2287 space: space$3, 2288 transition_in: transition_in$5, 2289 transition_out: transition_out$5 2290} = window.__gradio__svelte__internal; 2291function create_if_block_1$3(ctx) { 2292 let div0; 2293 let copybutton; 2294 let t0; 2295 let div1; 2296 let pre; 2297 let current; 2298 copybutton = new CopyButton({ props: { code: js_install } }); 2299 2300 return { 2301 c() { 2302 div0 = element$4("div"); 2303 create_component$5(copybutton.$$.fragment); 2304 t0 = space$3(); 2305 div1 = element$4("div"); 2306 pre = element$4("pre"); 2307 pre.textContent = `\$ ${js_install}`; 2308 attr$4(div0, "class", "copy svelte-hq8ezf"); 2309 attr$4(pre, "class", "svelte-hq8ezf"); 2310 }, 2311 m(target, anchor) { 2312 insert$5(target, div0, anchor); 2313 mount_component$5(copybutton, div0, null); 2314 insert$5(target, t0, anchor); 2315 insert$5(target, div1, anchor); 2316 append$4(div1, pre); 2317 current = true; 2318 }, 2319 p: noop$3, 2320 i(local) { 2321 if (current) return; 2322 transition_in$5(copybutton.$$.fragment, local); 2323 current = true; 2324 }, 2325 o(local) { 2326 transition_out$5(copybutton.$$.fragment, local); 2327 current = false; 2328 }, 2329 d(detaching) { 2330 if (detaching) { 2331 detach$5(div0); 2332 detach$5(t0); 2333 detach$5(div1); 2334 } 2335 2336 destroy_component$5(copybutton); 2337 } 2338 }; 2339} 2340 2341// (10:2) {#if current_language === "python"} 2342function create_if_block$5(ctx) { 2343 let div0; 2344 let copybutton; 2345 let t0; 2346 let div1; 2347 let pre; 2348 let current; 2349 copybutton = new CopyButton({ props: { code: py_install } }); 2350 2351 return { 2352 c() { 2353 div0 = element$4("div"); 2354 create_component$5(copybutton.$$.fragment); 2355 t0 = space$3(); 2356 div1 = element$4("div"); 2357 pre = element$4("pre"); 2358 pre.textContent = `\$ ${py_install}`; 2359 attr$4(div0, "class", "copy svelte-hq8ezf"); 2360 attr$4(pre, "class", "svelte-hq8ezf"); 2361 }, 2362 m(target, anchor) { 2363 insert$5(target, div0, anchor); 2364 mount_component$5(copybutton, div0, null); 2365 insert$5(target, t0, anchor); 2366 insert$5(target, div1, anchor); 2367 append$4(div1, pre); 2368 current = true; 2369 }, 2370 p: noop$3, 2371 i(local) { 2372 if (current) return; 2373 transition_in$5(copybutton.$$.fragment, local); 2374 current = true; 2375 }, 2376 o(local) { 2377 transition_out$5(copybutton.$$.fragment, local); 2378 current = false; 2379 }, 2380 d(detaching) { 2381 if (detaching) { 2382 detach$5(div0); 2383 detach$5(t0); 2384 detach$5(div1); 2385 } 2386 2387 destroy_component$5(copybutton); 2388 } 2389 }; 2390} 2391 2392// (8:0) <Block> 2393function create_default_slot$2(ctx) { 2394 let code; 2395 let current_block_type_index; 2396 let if_block; 2397 let current; 2398 const if_block_creators = [create_if_block$5, create_if_block_1$3]; 2399 const if_blocks = []; 2400 2401 function select_block_type(ctx, dirty) { 2402 if (/*current_language*/ ctx[0] === "python") return 0; 2403 if (/*current_language*/ ctx[0] === "javascript") return 1; 2404 return -1; 2405 } 2406 2407 if (~(current_block_type_index = select_block_type(ctx))) { 2408 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 2409 } 2410 2411 return { 2412 c() { 2413 code = element$4("code"); 2414 if (if_block) if_block.c(); 2415 attr$4(code, "class", "svelte-hq8ezf"); 2416 }, 2417 m(target, anchor) { 2418 insert$5(target, code, anchor); 2419 2420 if (~current_block_type_index) { 2421 if_blocks[current_block_type_index].m(code, null); 2422 } 2423 2424 current = true; 2425 }, 2426 p(ctx, dirty) { 2427 let previous_block_index = current_block_type_index; 2428 current_block_type_index = select_block_type(ctx); 2429 2430 if (current_block_type_index === previous_block_index) { 2431 if (~current_block_type_index) { 2432 if_blocks[current_block_type_index].p(ctx, dirty); 2433 } 2434 } else { 2435 if (if_block) { 2436 group_outros$4(); 2437 2438 transition_out$5(if_blocks[previous_block_index], 1, 1, () => { 2439 if_blocks[previous_block_index] = null; 2440 }); 2441 2442 check_outros$4(); 2443 } 2444 2445 if (~current_block_type_index) { 2446 if_block = if_blocks[current_block_type_index]; 2447 2448 if (!if_block) { 2449 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 2450 if_block.c(); 2451 } else { 2452 if_block.p(ctx, dirty); 2453 } 2454 2455 transition_in$5(if_block, 1); 2456 if_block.m(code, null); 2457 } else { 2458 if_block = null; 2459 } 2460 } 2461 }, 2462 i(local) { 2463 if (current) return; 2464 transition_in$5(if_block); 2465 current = true; 2466 }, 2467 o(local) { 2468 transition_out$5(if_block); 2469 current = false;
2470 }, 2471 d(detaching) { 2472 if (detaching) { 2473 detach$5(code); 2474 } 2475 2476 if (~current_block_type_index) { 2477 if_blocks[current_block_type_index].d(); 2478 } 2479 } 2480 }; 2481} 2482 2483function create_fragment$6(ctx) { 2484 let block; 2485 let current; 2486 2487 block = new Block({ 2488 props: { 2489 $$slots: { default: [create_default_slot$2] }, 2490 $$scope: { ctx } 2491 } 2492 }); 2493 2494 return { 2495 c() { 2496 create_component$5(block.$$.fragment); 2497 }, 2498 m(target, anchor) { 2499 mount_component$5(block, target, anchor); 2500 current = true; 2501 }, 2502 p(ctx, [dirty]) { 2503 const block_changes = {}; 2504 2505 if (dirty & /*$$scope, current_language*/ 3) { 2506 block_changes.$$scope = { dirty, ctx }; 2507 } 2508 2509 block.$set(block_changes); 2510 }, 2511 i(local) { 2512 if (current) return; 2513 transition_in$5(block.$$.fragment, local); 2514 current = true; 2515 }, 2516 o(local) { 2517 transition_out$5(block.$$.fragment, local); 2518 current = false; 2519 }, 2520 d(detaching) { 2521 destroy_component$5(block, detaching); 2522 } 2523 }; 2524} 2525 2526let py_install = "pip install gradio_client"; 2527let js_install = "npm i -D @gradio/client"; 2528 2529function instance$6($$self, $$props, $$invalidate) { 2530 let { current_language } = $$props; 2531 2532 $$self.$$set = $$props => {
2533 if ('current_language' in $$props) $$invalidate(0, current_language = $$props.current_language); 2534 }; 2535 2536 return [current_language]; 2537} 2538 2539class InstallSnippet extends SvelteComponent$6 { 2540 constructor(options) { 2541 super(); 2542 init$6(this, options, instance$6, create_fragment$6, safe_not_equal$6, { current_language: 0 }); 2543 } 2544} 2545 2546const EndpointDetail_svelte_svelte_type_style_lang = ''; 2547 2548/* src/api_docs/EndpointDetail.svelte generated by Svelte v4.2.2 */ 2549const { 2550 SvelteComponent: SvelteComponent$5, 2551 append: append$3, 2552 attr: attr$3, 2553 detach: detach$4, 2554 element: element$3, 2555 empty: empty$4, 2556 init: init$5, 2557 insert: insert$4, 2558 noop: noop$2, 2559 safe_not_equal: safe_not_equal$5, 2560 set_data: set_data$2, 2561 text: text$3 2562} = window.__gradio__svelte__internal; 2563function create_else_block$2(ctx) { 2564 let h3; 2565 let t0; 2566 let span; 2567 let t1; 2568 2569 return { 2570 c() { 2571 h3 = element$3("h3"); 2572 t0 = text$3("fn_index:\n\t\t"); 2573 span = element$3("span"); 2574 t1 = text$3(/*fn_index*/ ctx[1]); 2575 attr$3(span, "class", "post svelte-41kcm6"); 2576 attr$3(h3, "class", "svelte-41kcm6"); 2577 }, 2578 m(target, anchor) { 2579 insert$4(target, h3, anchor); 2580 append$3(h3, t0); 2581 append$3(h3, span); 2582 append$3(span, t1); 2583 }, 2584 p(ctx, dirty) { 2585 if (dirty & /*fn_index*/ 2) set_data$2(t1, /*fn_index*/ ctx[1]); 2586 }, 2587 d(detaching) { 2588 if (detaching) { 2589 detach$4(h3); 2590 } 2591 } 2592 }; 2593} 2594 2595// (6:0) {#if named} 2596function create_if_block$4(ctx) { 2597 let h3; 2598 let t0; 2599 let span; 2600 let t1_value = "/" + /*api_name*/ ctx[0] + ""; 2601 let t1; 2602 2603 return { 2604 c() { 2605 h3 = element$3("h3"); 2606 t0 = text$3("api_name:\n\t\t"); 2607 span = element$3("span"); 2608 t1 = text$3(t1_value); 2609 attr$3(span, "class", "post svelte-41kcm6"); 2610 attr$3(h3, "class", "svelte-41kcm6"); 2611 }, 2612 m(target, anchor) { 2613 insert$4(target, h3, anchor); 2614 append$3(h3, t0); 2615 append$3(h3, span); 2616 append$3(span, t1); 2617 }, 2618 p(ctx, dirty) { 2619 if (dirty & /*api_name*/ 1 && t1_value !== (t1_value = "/" + /*api_name*/ ctx[0] + "")) set_data$2(t1, t1_value); 2620 }, 2621 d(detaching) { 2622 if (detaching) { 2623 detach$4(h3); 2624 } 2625 } 2626 }; 2627} 2628 2629function create_fragment$5(ctx) { 2630 let if_block_anchor; 2631 2632 function select_block_type(ctx, dirty) { 2633 if (/*named*/ ctx[2]) return create_if_block$4; 2634 return create_else_block$2; 2635 } 2636 2637 let current_block_type = select_block_type(ctx); 2638 let if_block = current_block_type(ctx); 2639 2640 return { 2641 c() { 2642 if_block.c(); 2643 if_block_anchor = empty$4(); 2644 }, 2645 m(target, anchor) { 2646 if_block.m(target, anchor); 2647 insert$4(target, if_block_anchor, anchor); 2648 }, 2649 p(ctx, [dirty]) { 2650 if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block) { 2651 if_block.p(ctx, dirty); 2652 } else { 2653 if_block.d(1); 2654 if_block = current_block_type(ctx); 2655 2656 if (if_block) { 2657 if_block.c(); 2658 if_block.m(if_block_anchor.parentNode, if_block_anchor); 2659 } 2660 } 2661 }, 2662 i: noop$2, 2663 o: noop$2, 2664 d(detaching) { 2665 if (detaching) { 2666 detach$4(if_block_anchor); 2667 } 2668 2669 if_block.d(detaching); 2670 } 2671 }; 2672} 2673 2674function instance$5($$self, $$props, $$invalidate) { 2675 let { api_name = null } = $$props; 2676 let { fn_index = null } = $$props; 2677 let { named } = $$props; 2678 2679 $$self.$$set = $$props => {
2680 if ('api_name' in $$props) $$invalidate(0, api_name = $$props.api_name); 2681 if ('fn_index' in $$props) $$invalidate(1, fn_index = $$props.fn_index); 2682 if ('named' in $$props) $$invalidate(2, named = $$props.named); 2683 }; 2684 2685 return [api_name, fn_index, named]; 2686} 2687 2688class EndpointDetail extends SvelteComponent$5 { 2689 constructor(options) { 2690 super(); 2691 init$5(this, options, instance$5, create_fragment$5, safe_not_equal$5, { api_name: 0, fn_index: 1, named: 2 }); 2692 } 2693} 2694 2695const CodeSnippets_svelte_svelte_type_style_lang = ''; 2696 2697/* src/api_docs/CodeSnippets.svelte generated by Svelte v4.2.2 */ 2698const { 2699 SvelteComponent: SvelteComponent$4, 2700 append: append$2, 2701 attr: attr$2, 2702 binding_callbacks: binding_callbacks$1, 2703 check_outros: check_outros$3, 2704 create_component: create_component$4, 2705 destroy_component: destroy_component$4, 2706 destroy_each: destroy_each$1, 2707 detach: detach$3, 2708 element: element$2, 2709 empty: empty$3, 2710 ensure_array_like: ensure_array_like$2, 2711 group_outros: group_outros$3, 2712 init: init$4, 2713 insert: insert$3, 2714 mount_component: mount_component$4, 2715 noop: noop$1, 2716 safe_not_equal: safe_not_equal$4, 2717 set_data: set_data$1, 2718 space: space$2, 2719 text: text$2, 2720 transition_in: transition_in$4, 2721 transition_out: transition_out$4 2722} = window.__gradio__svelte__internal; 2723function get_each_context_1$1(ctx, list, i) { 2724 const child_ctx = ctx.slice(); 2725 child_ctx[14] = list[i].label; 2726 child_ctx[15] = list[i].type; 2727 child_ctx[16] = list[i].python_type; 2728 child_ctx[17] = list[i].component; 2729 child_ctx[18] = list[i].example_input; 2730 child_ctx[19] = list[i].serializer; 2731 child_ctx[21] = i; 2732 return child_ctx; 2733} 2734 2735function get_each_context_2(ctx, list, i) { 2736 const child_ctx = ctx.slice(); 2737 child_ctx[14] = list[i].label; 2738 child_ctx[15] = list[i].type; 2739 child_ctx[16] = list[i].python_type; 2740 child_ctx[17] = list[i].component; 2741 child_ctx[18] = list[i].example_input; 2742 child_ctx[19] = list[i].serializer; 2743 child_ctx[21] = i; 2744 return child_ctx; 2745} 2746 2747function get_each_context$2(ctx, list, i) { 2748 const child_ctx = ctx.slice(); 2749 child_ctx[14] = list[i].label; 2750 child_ctx[15] = list[i].type; 2751 child_ctx[16] = list[i].python_type; 2752 child_ctx[17] = list[i].component; 2753 child_ctx[18] = list[i].example_input; 2754 child_ctx[19] = list[i].serializer; 2755 child_ctx[21] = i; 2756 return child_ctx; 2757} 2758 2759// (22:1) {:else} 2760function create_else_block_2(ctx) { 2761 let endpointdetail; 2762 let current; 2763 2764 endpointdetail = new EndpointDetail({ 2765 props: { 2766 named: /*named*/ ctx[6], 2767 fn_index: /*dependency_index*/ ctx[1] 2768 } 2769 }); 2770 2771 return { 2772 c() { 2773 create_component$4(endpointdetail.$$.fragment); 2774 }, 2775 m(target, anchor) { 2776 mount_component$4(endpointdetail, target, anchor); 2777 current = true; 2778 }, 2779 p(ctx, dirty) { 2780 const endpointdetail_changes = {}; 2781 if (dirty & /*named*/ 64) endpointdetail_changes.named = /*named*/ ctx[6]; 2782 if (dirty & /*dependency_index*/ 2) endpointdetail_changes.fn_index = /*dependency_index*/ ctx[1]; 2783 endpointdetail.$set(endpointdetail_changes); 2784 }, 2785 i(local) { 2786 if (current) return; 2787 transition_in$4(endpointdetail.$$.fragment, local); 2788 current = true; 2789 }, 2790 o(local) { 2791 transition_out$4(endpointdetail.$$.fragment, local); 2792 current = false; 2793 }, 2794 d(detaching) { 2795 destroy_component$4(endpointdetail, detaching); 2796 } 2797 }; 2798} 2799 2800// (20:1) {#if named} 2801function create_if_block_7(ctx) { 2802 let endpointdetail; 2803 let current; 2804 2805 endpointdetail = new EndpointDetail({ 2806 props: { 2807 named: /*named*/ ctx[6], 2808 api_name: /*dependency*/ ctx[0].api_name 2809 } 2810 }); 2811 2812 return { 2813 c() { 2814 create_component$4(endpointdetail.$$.fragment); 2815 }, 2816 m(target, anchor) { 2817 mount_component$4(endpointdetail, target, anchor); 2818 current = true; 2819 }, 2820 p(ctx, dirty) { 2821 const endpointdetail_changes = {}; 2822 if (dirty & /*named*/ 64) endpointdetail_changes.named = /*named*/ ctx[6]; 2823 if (dirty & /*dependency*/ 1) endpointdetail_changes.api_name = /*dependency*/ ctx[0].api_name; 2824 endpointdetail.$set(endpointdetail_changes); 2825 }, 2826 i(local) { 2827 if (current) return; 2828 transition_in$4(endpointdetail.$$.fragment, local); 2829 current = true; 2830 }, 2831 o(local) { 2832 transition_out$4(endpointdetail.$$.fragment, local); 2833 current = false;
2834 }, 2835 d(detaching) { 2836 destroy_component$4(endpointdetail, detaching); 2837 } 2838 }; 2839} 2840 2841// (61:47) 2842function create_if_block_3$2(ctx) { 2843 let div0; 2844 let copybutton; 2845 let t0; 2846 let div1; 2847 let pre; 2848 let t1; 2849 let t2; 2850 let span; 2851 let t3; 2852 let t4; 2853 let t5; 2854 let t6; 2855 let t7; 2856 let t8; 2857 let current; 2858 2859 copybutton = new CopyButton({ 2860 props: { code: /*js_code*/ ctx[9]?.innerText } 2861 }); 2862 2863 let each_value_2 = ensure_array_like$2(/*blob_examples*/ ctx[11]); 2864 let each_blocks_1 = []; 2865 2866 for (let i = 0; i < each_value_2.length; i += 1) { 2867 each_blocks_1[i] = create_each_block_2(get_each_context_2(ctx, each_value_2, i)); 2868 } 2869 2870 function select_block_type_2(ctx, dirty) { 2871 if (/*named*/ ctx[6]) return create_if_block_6$1; 2872 return create_else_block_1; 2873 } 2874 2875 let current_block_type = select_block_type_2(ctx); 2876 let if_block = current_block_type(ctx); 2877 let each_value_1 = ensure_array_like$2(/*endpoint_parameters*/ ctx[4]); 2878 let each_blocks = []; 2879 2880 for (let i = 0; i < each_value_1.length; i += 1) { 2881 each_blocks[i] = create_each_block_1$1(get_each_context_1$1(ctx, each_value_1, i)); 2882 } 2883 2884 return { 2885 c() { 2886 div0 = element$2("div"); 2887 create_component$4(copybutton.$$.fragment); 2888 t0 = space$2(); 2889 div1 = element$2("div"); 2890 pre = element$2("pre"); 2891 t1 = text$2("import { client } from \"@gradio/client\";\n"); 2892 2893 for (let i = 0; i < each_blocks_1.length; i += 1) { 2894 each_blocks_1[i].c(); 2895 } 2896 2897 t2 = text$2("\nconst app = await client("); 2898 span = element$2("span"); 2899 t3 = text$2("\""); 2900 t4 = text$2(/*root*/ ctx[2]); 2901 t5 = text$2("\""); 2902 t6 = text$2(");\nconst result = await app.predict("); 2903 if_block.c(); 2904 t7 = text$2(", ["); 2905 2906 for (let i = 0; i < each_blocks.length; i += 1) { 2907 each_blocks[i].c(); 2908 } 2909 2910 t8 = text$2("\n\t]);\n\nconsole.log(result.data);\n"); 2911 attr$2(div0, "class", "copy svelte-1d98qmk"); 2912 attr$2(span, "class", "token string svelte-1d98qmk"); 2913 attr$2(pre, "class", "svelte-1d98qmk"); 2914 }, 2915 m(target, anchor) { 2916 insert$3(target, div0, anchor); 2917 mount_component$4(copybutton, div0, null); 2918 insert$3(target, t0, anchor); 2919 insert$3(target, div1, anchor); 2920 append$2(div1, pre); 2921 append$2(pre, t1); 2922 2923 for (let i = 0; i < each_blocks_1.length; i += 1) { 2924 if (each_blocks_1[i]) { 2925 each_blocks_1[i].m(pre, null); 2926 } 2927 } 2928 2929 append$2(pre, t2); 2930 append$2(pre, span); 2931 append$2(span, t3); 2932 append$2(span, t4); 2933 append$2(span, t5); 2934 append$2(pre, t6); 2935 if_block.m(pre, null); 2936 append$2(pre, t7); 2937 2938 for (let i = 0; i < each_blocks.length; i += 1) { 2939 if (each_blocks[i]) { 2940 each_blocks[i].m(pre, null); 2941 } 2942 } 2943 2944 append$2(pre, t8); 2945 /*div1_binding_1*/ ctx[13](div1); 2946 current = true; 2947 }, 2948 p(ctx, dirty) { 2949 const copybutton_changes = {}; 2950 if (dirty & /*js_code*/ 512) copybutton_changes.code = /*js_code*/ ctx[9]?.innerText; 2951 copybutton.$set(copybutton_changes); 2952 2953 if (dirty & /*blob_examples*/ 2048) { 2954 each_value_2 = ensure_array_like$2(/*blob_examples*/ ctx[11]); 2955 let i; 2956 2957 for (i = 0; i < each_value_2.length; i += 1) { 2958 const child_ctx = get_each_context_2(ctx, each_value_2, i); 2959 2960 if (each_blocks_1[i]) { 2961 each_blocks_1[i].p(child_ctx, dirty); 2962 } else { 2963 each_blocks_1[i] = create_each_block_2(child_ctx); 2964 each_blocks_1[i].c(); 2965 each_blocks_1[i].m(pre, t2); 2966 } 2967 } 2968 2969 for (; i < each_blocks_1.length; i += 1) { 2970 each_blocks_1[i].d(1); 2971 } 2972 2973 each_blocks_1.length = each_value_2.length; 2974 } 2975 2976 if (!current || dirty & /*root*/ 4) set_data$1(t4, /*root*/ ctx[2]); 2977 2978 if (current_block_type === (current_block_type = select_block_type_2(ctx)) && if_block) { 2979 if_block.p(ctx, dirty); 2980 } else { 2981 if_block.d(1); 2982 if_block = current_block_type(ctx); 2983 2984 if (if_block) { 2985 if_block.c(); 2986 if_block.m(pre, t7); 2987 } 2988 } 2989 2990 if (dirty & /*endpoint_parameters, blob_components, js_parameters*/ 1072) { 2991 each_value_1 = ensure_array_like$2(/*endpoint_parameters*/ ctx[4]); 2992 let i; 2993 2994 for (i = 0; i < each_value_1.length; i += 1) { 2995 const child_ctx = get_each_context_1$1(ctx, each_value_1, i); 2996 2997 if (each_blocks[i]) { 2998 each_blocks[i].p(child_ctx, dirty); 2999 } else { 3000 each_blocks[i] = create_each_block_1$1(child_ctx); 3001 each_blocks[i].c(); 3002 each_blocks[i].m(pre, t8); 3003 } 3004 } 3005 3006 for (; i < each_blocks.length; i += 1) { 3007 each_blocks[i].d(1); 3008 } 3009 3010 each_blocks.length = each_value_1.length; 3011 } 3012 }, 3013 i(local) { 3014 if (current) return; 3015 transition_in$4(copybutton.$$.fragment, local); 3016 current = true; 3017 }, 3018 o(local) { 3019 transition_out$4(copybutton.$$.fragment, local); 3020 current = false;
3021 }, 3022 d(detaching) { 3023 if (detaching) { 3024 detach$3(div0); 3025 detach$3(t0); 3026 detach$3(div1); 3027 } 3028 3029 destroy_component$4(copybutton); 3030 destroy_each$1(each_blocks_1, detaching); 3031 if_block.d(); 3032 destroy_each$1(each_blocks, detaching); 3033 /*div1_binding_1*/ ctx[13](null); 3034 } 3035 }; 3036} 3037 3038// (27:3) {#if current_language === "python"} 3039function create_if_block$3(ctx) { 3040 let div0; 3041 let copybutton; 3042 let t0; 3043 let div1; 3044 let pre; 3045 let t1; 3046 let span; 3047 let t2; 3048 let t3; 3049 let t4; 3050 let t5; 3051 let t6; 3052 let t7_value = /*dependency*/ ctx[0].api_name + ""; 3053 let t7; 3054 let t8; 3055 let current; 3056 3057 copybutton = new CopyButton({ 3058 props: { code: /*python_code*/ ctx[8]?.innerText } 3059 }); 3060 3061 let each_value = ensure_array_like$2(/*endpoint_parameters*/ ctx[4]); 3062 let each_blocks = []; 3063 3064 for (let i = 0; i < each_value.length; i += 1) { 3065 each_blocks[i] = create_each_block$2(get_each_context$2(ctx, each_value, i)); 3066 } 3067 3068 return { 3069 c() { 3070 div0 = element$2("div"); 3071 create_component$4(copybutton.$$.fragment); 3072 t0 = space$2(); 3073 div1 = element$2("div"); 3074 pre = element$2("pre"); 3075 t1 = text$2("from gradio_client import Client\n\nclient = Client("); 3076 span = element$2("span"); 3077 t2 = text$2("\""); 3078 t3 = text$2(/*root*/ ctx[2]); 3079 t4 = text$2("\""); 3080 t5 = text$2(")\nresult = client.predict("); 3081 3082 for (let i = 0; i < each_blocks.length; i += 1) { 3083 each_blocks[i].c(); 3084 } 3085 3086 t6 = text$2("\n\t\tapi_name=\"/"); 3087 t7 = text$2(t7_value); 3088 t8 = text$2("\"\n)\nprint(result)"); 3089 attr$2(div0, "class", "copy svelte-1d98qmk"); 3090 attr$2(span, "class", "token string svelte-1d98qmk"); 3091 attr$2(pre, "class", "svelte-1d98qmk"); 3092 }, 3093 m(target, anchor) { 3094 insert$3(target, div0, anchor); 3095 mount_component$4(copybutton, div0, null); 3096 insert$3(target, t0, anchor); 3097 insert$3(target, div1, anchor); 3098 append$2(div1, pre); 3099 append$2(pre, t1); 3100 append$2(pre, span); 3101 append$2(span, t2); 3102 append$2(span, t3); 3103 append$2(span, t4); 3104 append$2(pre, t5); 3105 3106 for (let i = 0; i < each_blocks.length; i += 1) { 3107 if (each_blocks[i]) { 3108 each_blocks[i].m(pre, null); 3109 } 3110 } 3111 3112 append$2(pre, t6); 3113 append$2(pre, t7); 3114 append$2(pre, t8); 3115 /*div1_binding*/ ctx[12](div1); 3116 current = true; 3117 }, 3118 p(ctx, dirty) { 3119 const copybutton_changes = {}; 3120 if (dirty & /*python_code*/ 256) copybutton_changes.code = /*python_code*/ ctx[8]?.innerText; 3121 copybutton.$set(copybutton_changes); 3122 if (!current || dirty & /*root*/ 4) set_data$1(t3, /*root*/ ctx[2]); 3123 3124 if (dirty & /*endpoint_parameters, dependency_failures, dependency_index*/ 26) { 3125 each_value = ensure_array_like$2(/*endpoint_parameters*/ ctx[4]); 3126 let i; 3127 3128 for (i = 0; i < each_value.length; i += 1) { 3129 const child_ctx = get_each_context$2(ctx, each_value, i); 3130 3131 if (each_blocks[i]) { 3132 each_blocks[i].p(child_ctx, dirty); 3133 } else { 3134 each_blocks[i] = create_each_block$2(child_ctx); 3135 each_blocks[i].c(); 3136 each_blocks[i].m(pre, t6); 3137 } 3138 } 3139 3140 for (; i < each_blocks.length; i += 1) { 3141 each_blocks[i].d(1); 3142 } 3143 3144 each_blocks.length = each_value.length; 3145 } 3146 3147 if ((!current || dirty & /*dependency*/ 1) && t7_value !== (t7_value = /*dependency*/ ctx[0].api_name + "")) set_data$1(t7, t7_value); 3148 }, 3149 i(local) { 3150 if (current) return; 3151 transition_in$4(copybutton.$$.fragment, local); 3152 current = true; 3153 }, 3154 o(local) { 3155 transition_out$4(copybutton.$$.fragment, local); 3156 current = false; 3157 }, 3158 d(detaching) { 3159 if (detaching) { 3160 detach$3(div0);
3161 detach$3(t0); 3162 detach$3(div1); 3163 } 3164 3165 destroy_component$4(copybutton); 3166 destroy_each$1(each_blocks, detaching); 3167 /*div1_binding*/ ctx[12](null); 3168 } 3169 }; 3170} 3171 3172// (67:0) {#each blob_examples as { label, type, python_type, component, example_input, serializer } 3173function create_each_block_2(ctx) { 3174 let t0; 3175 let t1; 3176 let t2; 3177 let t3_value = /*example_input*/ ctx[18] + ""; 3178 let t3; 3179 let t4; 3180 let t5_value = /*component*/ ctx[17] + ""; 3181 let t5; 3182 let t6; 3183 let t7; 3184 let t8; 3185 3186 return { 3187 c() { 3188 t0 = text$2("\nconst response_"); 3189 t1 = text$2(/*i*/ ctx[21]); 3190 t2 = text$2(" = await fetch(\""); 3191 t3 = text$2(t3_value); 3192 t4 = text$2("\");\nconst example"); 3193 t5 = text$2(t5_value); 3194 t6 = text$2(" = await response_"); 3195 t7 = text$2(/*i*/ ctx[21]); 3196 t8 = text$2(".blob();\n\t\t\t\t\t\t"); 3197 }, 3198 m(target, anchor) { 3199 insert$3(target, t0, anchor); 3200 insert$3(target, t1, anchor); 3201 insert$3(target, t2, anchor); 3202 insert$3(target, t3, anchor); 3203 insert$3(target, t4, anchor); 3204 insert$3(target, t5, anchor); 3205 insert$3(target, t6, anchor); 3206 insert$3(target, t7, anchor); 3207 insert$3(target, t8, anchor); 3208 }, 3209 p: noop$1, 3210 d(detaching) { 3211 if (detaching) {
3212 detach$3(t0); 3213 detach$3(t1); 3214 detach$3(t2); 3215 detach$3(t3); 3216 detach$3(t4); 3217 detach$3(t5); 3218 detach$3(t6); 3219 detach$3(t7); 3220 detach$3(t8); 3221 } 3222 } 3223 }; 3224} 3225 3226// (74:68) {:else} 3227function create_else_block_1(ctx) { 3228 let t; 3229 3230 return { 3231 c() { 3232 t = text$2(/*dependency_index*/ ctx[1]); 3233 }, 3234 m(target, anchor) { 3235 insert$3(target, t, anchor); 3236 }, 3237 p(ctx, dirty) { 3238 if (dirty & /*dependency_index*/ 2) set_data$1(t, /*dependency_index*/ ctx[1]); 3239 }, 3240 d(detaching) { 3241 if (detaching) { 3242 detach$3(t); 3243 } 3244 } 3245 }; 3246} 3247 3248// (74:33) {#if named} 3249function create_if_block_6$1(ctx) { 3250 let t0; 3251 let t1_value = /*dependency*/ ctx[0].api_name + ""; 3252 let t1; 3253 let t2; 3254 3255 return { 3256 c() { 3257 t0 = text$2("\"/"); 3258 t1 = text$2(t1_value); 3259 t2 = text$2("\""); 3260 }, 3261 m(target, anchor) { 3262 insert$3(target, t0, anchor); 3263 insert$3(target, t1, anchor); 3264 insert$3(target, t2, anchor); 3265 }, 3266 p(ctx, dirty) { 3267 if (dirty & /*dependency*/ 1 && t1_value !== (t1_value = /*dependency*/ ctx[0].api_name + "")) set_data$1(t1, t1_value); 3268 }, 3269 d(detaching) { 3270 if (detaching) {
3271 detach$3(t0); 3272 detach$3(t1); 3273 detach$3(t2); 3274 } 3275 } 3276 }; 3277} 3278 3279// (88:5) {:else} 3280function create_else_block$1(ctx) { 3281 let t0; 3282 let span0; 3283 let t1_value = represent_value(/*example_input*/ ctx[18], /*python_type*/ ctx[16].type, "js") + ""; 3284 let t1; 3285 let t2; 3286 let span1; 3287 let t3; 3288 let t4_value = /*js_parameters*/ ctx[5][/*i*/ ctx[21]].type + ""; 3289 let t4; 3290 let t5; 3291 let t6; 3292 let t7_value = /*label*/ ctx[14] + ""; 3293 let t7; 3294 let t8; 3295 let t9_value = /*component*/ ctx[17] + ""; 3296 let t9; 3297 let t10; 3298 let if_block = /*js_parameters*/ ctx[5][/*i*/ ctx[21]].description && create_if_block_5$1(ctx); 3299 3300 return { 3301 c() { 3302 t0 = text$2("\t\t\n\t\t\t\t"); 3303 span0 = element$2("span"); 3304 t1 = text$2(t1_value); 3305 t2 = text$2(", "); 3306 span1 = element$2("span"); 3307 t3 = text$2("// "); 3308 t4 = text$2(t4_value); 3309 t5 = text$2(" "); 3310 if (if_block) if_block.c(); 3311 t6 = text$2(" in '"); 3312 t7 = text$2(t7_value); 3313 t8 = text$2("' "); 3314 t9 = text$2(t9_value); 3315 t10 = text$2(" component"); 3316 attr$2(span0, "class", "example-inputs svelte-1d98qmk"); 3317 attr$2(span1, "class", "desc svelte-1d98qmk"); 3318 }, 3319 m(target, anchor) { 3320 insert$3(target, t0, anchor); 3321 insert$3(target, span0, anchor); 3322 append$2(span0, t1); 3323 insert$3(target, t2, anchor); 3324 insert$3(target, span1, anchor); 3325 append$2(span1, t3); 3326 append$2(span1, t4); 3327 append$2(span1, t5); 3328 if (if_block) if_block.m(span1, null); 3329 append$2(span1, t6); 3330 append$2(span1, t7); 3331 append$2(span1, t8); 3332 append$2(span1, t9); 3333 append$2(span1, t10); 3334 }, 3335 p(ctx, dirty) { 3336 if (dirty & /*endpoint_parameters*/ 16 && t1_value !== (t1_value = represent_value(/*example_input*/ ctx[18], /*python_type*/ ctx[16].type, "js") + "")) set_data$1(t1, t1_value); 3337 if (dirty & /*js_parameters*/ 32 && t4_value !== (t4_value = /*js_parameters*/ ctx[5][/*i*/ ctx[21]].type + "")) set_data$1(t4, t4_value); 3338 3339 if (/*js_parameters*/ ctx[5][/*i*/ ctx[21]].description) { 3340 if (if_block) { 3341 if_block.p(ctx, dirty); 3342 } else { 3343 if_block = create_if_block_5$1(ctx); 3344 if_block.c(); 3345 if_block.m(span1, t6); 3346 } 3347 } else if (if_block) { 3348 if_block.d(1); 3349 if_block = null; 3350 } 3351 3352 if (dirty & /*endpoint_parameters*/ 16 && t7_value !== (t7_value = /*label*/ ctx[14] + "")) set_data$1(t7, t7_value); 3353 if (dirty & /*endpoint_parameters*/ 16 && t9_value !== (t9_value = /*component*/ ctx[17] + "")) set_data$1(t9, t9_value); 3354 }, 3355 d(detaching) { 3356 if (detaching) {
3357 detach$3(t0); 3358 detach$3(span0); 3359 detach$3(t2); 3360 detach$3(span1); 3361 } 3362 3363 if (if_block) if_block.d(); 3364 } 3365 }; 3366} 3367 3368// (76:5) {#if blob_components.includes(component)} 3369function create_if_block_4$1(ctx) { 3370 let t0; 3371 let span0; 3372 let t1; 3373 let t2_value = /*component*/ ctx[17] + ""; 3374 let t2; 3375 let t3; 3376 let span1; 3377 let t4; 3378 let t5_value = /*label*/ ctx[14] + ""; 3379 let t5; 3380 let t6; 3381 let t7_value = /*component*/ ctx[17] + ""; 3382 let t7; 3383 let t8; 3384 3385 return { 3386 c() { 3387 t0 = text$2("\n\t\t\t\t"); 3388 span0 = element$2("span"); 3389 t1 = text$2("example"); 3390 t2 = text$2(t2_value); 3391 t3 = text$2(", "); 3392 span1 = element$2("span"); 3393 t4 = text$2("\t// blob in '"); 3394 t5 = text$2(t5_value); 3395 t6 = text$2("' "); 3396 t7 = text$2(t7_value); 3397 t8 = text$2(" component"); 3398 attr$2(span0, "class", "example-inputs svelte-1d98qmk"); 3399 attr$2(span1, "class", "desc svelte-1d98qmk"); 3400 }, 3401 m(target, anchor) { 3402 insert$3(target, t0, anchor); 3403 insert$3(target, span0, anchor); 3404 append$2(span0, t1); 3405 append$2(span0, t2); 3406 insert$3(target, t3, anchor); 3407 insert$3(target, span1, anchor); 3408 append$2(span1, t4); 3409 append$2(span1, t5); 3410 append$2(span1, t6); 3411 append$2(span1, t7); 3412 append$2(span1, t8); 3413 }, 3414 p(ctx, dirty) { 3415 if (dirty & /*endpoint_parameters*/ 16 && t2_value !== (t2_value = /*component*/ ctx[17] + "")) set_data$1(t2, t2_value); 3416 if (dirty & /*endpoint_parameters*/ 16 && t5_value !== (t5_value = /*label*/ ctx[14] + "")) set_data$1(t5, t5_value); 3417 if (dirty & /*endpoint_parameters*/ 16 && t7_value !== (t7_value = /*component*/ ctx[17] + "")) set_data$1(t7, t7_value); 3418 }, 3419 d(detaching) { 3420 if (detaching) {
3421 detach$3(t0); 3422 detach$3(span0); 3423 detach$3(t3); 3424 detach$3(span1); 3425 } 3426 } 3427 }; 3428} 3429 3430// (100:17) {#if js_parameters[i].description} 3431function create_if_block_5$1(ctx) { 3432 let t0; 3433 let t1_value = /*js_parameters*/ ctx[5][/*i*/ ctx[21]].description + ""; 3434 let t1; 3435 let t2; 3436 3437 return { 3438 c() { 3439 t0 = text$2("("); 3440 t1 = text$2(t1_value); 3441 t2 = text$2(")"); 3442 }, 3443 m(target, anchor) { 3444 insert$3(target, t0, anchor); 3445 insert$3(target, t1, anchor); 3446 insert$3(target, t2, anchor); 3447 }, 3448 p(ctx, dirty) { 3449 if (dirty & /*js_parameters*/ 32 && t1_value !== (t1_value = /*js_parameters*/ ctx[5][/*i*/ ctx[21]].description + "")) set_data$1(t1, t1_value); 3450 }, 3451 d(detaching) { 3452 if (detaching) { 3453 detach$3(t0); 3454 detach$3(t1); 3455 detach$3(t2); 3456 } 3457 } 3458 }; 3459} 3460 3461// (75:3) {#each endpoint_parameters as { label, type, python_type, component, example_input, serializer } 3462function create_each_block_1$1(ctx) { 3463 let show_if; 3464 let if_block_anchor; 3465 3466 function select_block_type_3(ctx, dirty) { 3467 if (dirty & /*endpoint_parameters*/ 16) show_if = null; 3468 if (show_if == null) show_if = !!/*blob_components*/ ctx[10].includes(/*component*/ ctx[17]); 3469 if (show_if) return create_if_block_4$1; 3470 return create_else_block$1; 3471 } 3472 3473 let current_block_type = select_block_type_3(ctx, -1); 3474 let if_block = current_block_type(ctx); 3475 3476 return { 3477 c() { 3478 if_block.c(); 3479 if_block_anchor = empty$3(); 3480 }, 3481 m(target, anchor) { 3482 if_block.m(target, anchor); 3483 insert$3(target, if_block_anchor, anchor); 3484 }, 3485 p(ctx, dirty) { 3486 if (current_block_type === (current_block_type = select_block_type_3(ctx, dirty)) && if_block) { 3487 if_block.p(ctx, dirty); 3488 } else { 3489 if_block.d(1); 3490 if_block = current_block_type(ctx); 3491 3492 if (if_block) { 3493 if_block.c(); 3494 if_block.m(if_block_anchor.parentNode, if_block_anchor); 3495 } 3496 } 3497 }, 3498 d(detaching) { 3499 if (detaching) { 3500 detach$3(if_block_anchor); 3501 } 3502 3503 if_block.d(detaching); 3504 } 3505 }; 3506} 3507 3508// (42:6) {#if dependency_failures[dependency_index][i]} 3509function create_if_block_2$2(ctx) { 3510 let span; 3511 3512 return { 3513 c() { 3514 span = element$2("span"); 3515 span.textContent = "ERROR"; 3516 attr$2(span, "class", "error svelte-1d98qmk"); 3517 }, 3518 m(target, anchor) { 3519 insert$3(target, span, anchor); 3520 }, 3521 d(detaching) { 3522 if (detaching) { 3523 detach$3(span); 3524 } 3525 } 3526 }; 3527} 3528 3529// (49:28) {#if python_type.description} 3530function create_if_block_1$2(ctx) { 3531 let t0; 3532 let t1_value = /*python_type*/ ctx[16].description + ""; 3533 let t1; 3534 let t2; 3535 3536 return { 3537 c() { 3538 t0 = text$2("("); 3539 t1 = text$2(t1_value); 3540 t2 = text$2(")"); 3541 }, 3542 m(target, anchor) { 3543 insert$3(target, t0, anchor); 3544 insert$3(target, t1, anchor); 3545 insert$3(target, t2, anchor); 3546 }, 3547 p(ctx, dirty) { 3548 if (dirty & /*endpoint_parameters*/ 16 && t1_value !== (t1_value = /*python_type*/ ctx[16].description + "")) set_data$1(t1, t1_value); 3549 }, 3550 d(detaching) { 3551 if (detaching) {
3552 detach$3(t0); 3553 detach$3(t1); 3554 detach$3(t2); 3555 } 3556 } 3557 }; 3558} 3559 3560// (36:3) {#each endpoint_parameters as { label, type, python_type, component, example_input, serializer } 3561function create_each_block$2(ctx) { 3562 let t0; 3563 let span0; 3564 let t1_value = represent_value(/*example_input*/ ctx[18], /*python_type*/ ctx[16].type, "py") + ""; 3565 let t1; 3566 let t2; 3567 let span1; 3568 let t3; 3569 let t4_value = /*python_type*/ ctx[16].type + ""; 3570 let t4; 3571 let t5; 3572 let t6; 3573 let t7_value = /*label*/ ctx[14] + ""; 3574 let t7; 3575 let t8; 3576 let t9_value = /*component*/ ctx[17] + ""; 3577 let t9; 3578 let t10; 3579 let if_block0 = /*dependency_failures*/ ctx[3][/*dependency_index*/ ctx[1]][/*i*/ ctx[21]] && create_if_block_2$2(); 3580 let if_block1 = /*python_type*/ ctx[16].description && create_if_block_1$2(ctx); 3581 3582 return { 3583 c() { 3584 t0 = text$2("\n\t\t"); 3585 span0 = element$2("span"); 3586 t1 = text$2(t1_value); 3587 t2 = text$2(","); 3588 if (if_block0) if_block0.c(); 3589 span1 = element$2("span"); 3590 t3 = text$2("\t# "); 3591 t4 = text$2(t4_value); 3592 t5 = text$2(" "); 3593 if (if_block1) if_block1.c(); 3594 t6 = text$2(" in '"); 3595 t7 = text$2(t7_value); 3596 t8 = text$2("' "); 3597 t9 = text$2(t9_value); 3598 t10 = text$2(" component"); 3599 attr$2(span0, "class", "example-inputs svelte-1d98qmk"); 3600 attr$2(span1, "class", "desc svelte-1d98qmk"); 3601 }, 3602 m(target, anchor) { 3603 insert$3(target, t0, anchor); 3604 insert$3(target, span0, anchor); 3605 append$2(span0, t1); 3606 insert$3(target, t2, anchor); 3607 if (if_block0) if_block0.m(target, anchor); 3608 insert$3(target, span1, anchor); 3609 append$2(span1, t3); 3610 append$2(span1, t4); 3611 append$2(span1, t5); 3612 if (if_block1) if_block1.m(span1, null); 3613 append$2(span1, t6); 3614 append$2(span1, t7); 3615 append$2(span1, t8); 3616 append$2(span1, t9); 3617 append$2(span1, t10); 3618 }, 3619 p(ctx, dirty) { 3620 if (dirty & /*endpoint_parameters*/ 16 && t1_value !== (t1_value = represent_value(/*example_input*/ ctx[18], /*python_type*/ ctx[16].type, "py") + "")) set_data$1(t1, t1_value); 3621 3622 if (/*dependency_failures*/ ctx[3][/*dependency_index*/ ctx[1]][/*i*/ ctx[21]]) { 3623 if (if_block0) ; else { 3624 if_block0 = create_if_block_2$2(); 3625 if_block0.c(); 3626 if_block0.m(span1.parentNode, span1); 3627 } 3628 } else if (if_block0) { 3629 if_block0.d(1); 3630 if_block0 = null; 3631 } 3632 3633 if (dirty & /*endpoint_parameters*/ 16 && t4_value !== (t4_value = /*python_type*/ ctx[16].type + "")) set_data$1(t4, t4_value); 3634 3635 if (/*python_type*/ ctx[16].description) { 3636 if (if_block1) { 3637 if_block1.p(ctx, dirty); 3638 } else { 3639 if_block1 = create_if_block_1$2(ctx); 3640 if_block1.c(); 3641 if_block1.m(span1, t6); 3642 } 3643 } else if (if_block1) { 3644 if_block1.d(1); 3645 if_block1 = null; 3646 } 3647 3648 if (dirty & /*endpoint_parameters*/ 16 && t7_value !== (t7_value = /*label*/ ctx[14] + "")) set_data$1(t7, t7_value); 3649 if (dirty & /*endpoint_parameters*/ 16 && t9_value !== (t9_value = /*component*/ ctx[17] + "")) set_data$1(t9, t9_value); 3650 }, 3651 d(detaching) { 3652 if (detaching) {
3653 detach$3(t0); 3654 detach$3(span0); 3655 detach$3(t2); 3656 detach$3(span1); 3657 } 3658 3659 if (if_block0) if_block0.d(detaching); 3660 if (if_block1) if_block1.d(); 3661 } 3662 }; 3663} 3664 3665// (25:1) <Block> 3666function create_default_slot$1(ctx) { 3667 let code; 3668 let current_block_type_index; 3669 let if_block; 3670 let current; 3671 const if_block_creators = [create_if_block$3, create_if_block_3$2]; 3672 const if_blocks = []; 3673 3674 function select_block_type_1(ctx, dirty) { 3675 if (/*current_language*/ ctx[7] === "python") return 0; 3676 if (/*current_language*/ ctx[7] === "javascript") return 1; 3677 return -1; 3678 } 3679 3680 if (~(current_block_type_index = select_block_type_1(ctx))) { 3681 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 3682 } 3683 3684 return { 3685 c() { 3686 code = element$2("code"); 3687 if (if_block) if_block.c(); 3688 attr$2(code, "class", "svelte-1d98qmk"); 3689 }, 3690 m(target, anchor) { 3691 insert$3(target, code, anchor); 3692 3693 if (~current_block_type_index) { 3694 if_blocks[current_block_type_index].m(code, null); 3695 } 3696 3697 current = true; 3698 }, 3699 p(ctx, dirty) { 3700 let previous_block_index = current_block_type_index; 3701 current_block_type_index = select_block_type_1(ctx); 3702 3703 if (current_block_type_index === previous_block_index) { 3704 if (~current_block_type_index) { 3705 if_blocks[current_block_type_index].p(ctx, dirty); 3706 } 3707 } else { 3708 if (if_block) { 3709 group_outros$3(); 3710 3711 transition_out$4(if_blocks[previous_block_index], 1, 1, () => { 3712 if_blocks[previous_block_index] = null; 3713 }); 3714 3715 check_outros$3(); 3716 } 3717 3718 if (~current_block_type_index) { 3719 if_block = if_blocks[current_block_type_index]; 3720 3721 if (!if_block) { 3722 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 3723 if_block.c(); 3724 } else { 3725 if_block.p(ctx, dirty); 3726 } 3727 3728 transition_in$4(if_block, 1); 3729 if_block.m(code, null); 3730 } else { 3731 if_block = null; 3732 } 3733 } 3734 }, 3735 i(local) { 3736 if (current) return; 3737 transition_in$4(if_block); 3738 current = true; 3739 }, 3740 o(local) { 3741 transition_out$4(if_block); 3742 current = false; 3743 }, 3744 d(detaching) { 3745 if (detaching) { 3746 detach$3(code); 3747 } 3748 3749 if (~current_block_type_index) { 3750 if_blocks[current_block_type_index].d(); 3751 } 3752 } 3753 }; 3754} 3755 3756function create_fragment$4(ctx) { 3757 let div; 3758 let current_block_type_index; 3759 let if_block; 3760 let t; 3761 let block; 3762 let current; 3763 const if_block_creators = [create_if_block_7, create_else_block_2]; 3764 const if_blocks = []; 3765 3766 function select_block_type(ctx, dirty) { 3767 if (/*named*/ ctx[6]) return 0; 3768 return 1; 3769 } 3770 3771 current_block_type_index = select_block_type(ctx); 3772 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 3773 3774 block = new Block({ 3775 props: { 3776 $$slots: { default: [create_default_slot$1] }, 3777 $$scope: { ctx } 3778 } 3779 }); 3780 3781 return { 3782 c() { 3783 div = element$2("div"); 3784 if_block.c(); 3785 t = space$2(); 3786 create_component$4(block.$$.fragment); 3787 attr$2(div, "class", "container svelte-1d98qmk"); 3788 }, 3789 m(target, anchor) { 3790 insert$3(target, div, anchor); 3791 if_blocks[current_block_type_index].m(div, null); 3792 append$2(div, t); 3793 mount_component$4(block, div, null); 3794 current = true; 3795 }, 3796 p(ctx, [dirty]) { 3797 let previous_block_index = current_block_type_index; 3798 current_block_type_index = select_block_type(ctx); 3799 3800 if (current_block_type_index === previous_block_index) { 3801 if_blocks[current_block_type_index].p(ctx, dirty); 3802 } else { 3803 group_outros$3(); 3804 3805 transition_out$4(if_blocks[previous_block_index], 1, 1, () => { 3806 if_blocks[previous_block_index] = null; 3807 }); 3808 3809 check_outros$3(); 3810 if_block = if_blocks[current_block_type_index]; 3811 3812 if (!if_block) { 3813 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 3814 if_block.c(); 3815 } else { 3816 if_block.p(ctx, dirty); 3817 } 3818 3819 transition_in$4(if_block, 1); 3820 if_block.m(div, t); 3821 } 3822 3823 const block_changes = {}; 3824 3825 if (dirty & /*$$scope, python_code, dependency, endpoint_parameters, dependency_failures, dependency_index, root, current_language, js_code, js_parameters, named*/ 16778239) { 3826 block_changes.$$scope = { dirty, ctx }; 3827 } 3828 3829 block.$set(block_changes); 3830 }, 3831 i(local) { 3832 if (current) return; 3833 transition_in$4(if_block); 3834 transition_in$4(block.$$.fragment, local); 3835 current = true; 3836 }, 3837 o(local) { 3838 transition_out$4(if_block); 3839 transition_out$4(block.$$.fragment, local); 3840 current = false;
3841 }, 3842 d(detaching) { 3843 if (detaching) { 3844 detach$3(div); 3845 } 3846 3847 if_blocks[current_block_type_index].d(); 3848 destroy_component$4(block); 3849 } 3850 }; 3851} 3852 3853function instance$4($$self, $$props, $$invalidate) { 3854 let { dependency } = $$props; 3855 let { dependency_index } = $$props; 3856 let { root } = $$props; 3857 let { dependency_failures } = $$props; 3858 let { endpoint_parameters } = $$props; 3859 let { js_parameters } = $$props; 3860 let { named } = $$props; 3861 let { current_language } = $$props; 3862 let python_code; 3863 let js_code; 3864 let blob_components = ["Audio", "File", "Image", "Video"]; 3865 let blob_examples = endpoint_parameters.filter(param => blob_components.includes(param.component)); 3866 3867 function div1_binding($$value) { 3868 binding_callbacks$1[$$value ? 'unshift' : 'push'](() => { 3869 python_code = $$value; 3870 $$invalidate(8, python_code); 3871 }); 3872 } 3873 3874 function div1_binding_1($$value) { 3875 binding_callbacks$1[$$value ? 'unshift' : 'push'](() => { 3876 js_code = $$value; 3877 $$invalidate(9, js_code); 3878 }); 3879 } 3880 3881 $$self.$$set = $$props => { 3882 if ('dependency' in $$props) $$invali
3882date(0, dependency = $$props.dependency); 3883 if ('dependency_index' in $$props) $$invalidate(1, dependency_index = $$props.dependency_index); 3884 if ('root' in $$props) $$invalidate(2, root = $$props.root); 3885 if ('dependency_failures' in $$props) $$invalidate(3, dependency_failures = $$props.dependency_failures); 3886 if ('endpoint_parameters' in $$props) $$invalidate(4, endpoint_parameters = $$props.endpoint_parameters); 3887 if ('js_parameters' in $$props) $$invalidate(5, js_parameters = $$props.js_parameters); 3888 if ('named' in $$props) $$invalidate(6, named = $$props.named); 3889 if ('current_language' in $$props) $$invalidate(7, current_language = $$props.current_language); 3890 }; 3891 3892 return [ 3893 dependency, 3894 dependency_index, 3895 root, 3896 dependency_failures, 3897 endpoint_parameters, 3898 js_parameters, 3899 named, 3900 current_language, 3901 python_code, 3902 js_code, 3903 blob_components, 3904 blob_examples, 3905 div1_binding, 3906 div1_binding_1 3907 ]; 3908} 3909 3910class CodeSnippets extends SvelteComponent$4 { 3911 constructor(options) { 3912 super(); 3913 3914 init$4(this, options, instance$4, create_fragment$4, safe_not_equal$4, { 3915 dependency: 0, 3916 dependency_index: 1, 3917 root: 2, 3918 dependency_failures: 3, 3919 endpoint_parameters: 4, 3920 js_parameters: 5, 3921 named: 6, 3922 current_language: 7 3923 }); 3924 } 3925} 3926 3927const python = ""+new URL('python-20e39c92.svg', import.meta.url).href+""; 3928 3929const javascript = ""+new URL('javascript-850cf94b.svg', import.meta.url).href+""; 3930 3931const ApiDocs_svelte_svelte_type_style_lang = ''; 3932 3933/* src/api_docs/ApiDocs.svelte generated by Svelte v4.2.2 */ 3934const { 3935 SvelteComponent: SvelteComponent$3, 3936 append: append$1, 3937 attr: attr$1, 3938 bubble: bubble$1, 3939 check_outros: check_outros$2, 3940 create_component: create_component$3, 3941 destroy_component: destroy_component$3, 3942 destroy_each, 3943 detach: detach$2, 3944 element: element$1, 3945 empty: empty$2, 3946 ensure_array_like: ensure_array_like$1, 3947 group_outros: group_outros$2, 3948 init: init$3, 3949 insert: insert$2, 3950 listen: listen$1, 3951 mount_component: mount_component$3, 3952 safe_not_equal: safe_not_equal$3, 3953 space: space$1, 3954 src_url_equal: src_url_equal$1, 3955 text: text$1, 3956 transition_in: transition_in$3, 3957 transition_out: transition_out$3 3958} = window.__gradio__svelte__internal; 3959const { onMount: onMount$2, createEventDispatcher: createEventDispatcher$2 } = window.__gradio__svelte__internal; 3960function get_each_context$1(ctx, list, i) { 3961 const child_ctx = ctx.slice(); 3962 child_ctx[20] = list[i]; 3963 child_ctx[22] = i; 3964 return child_ctx; 3965} 3966 3967function get_each_context_1(ctx, list, i) { 3968 const child_ctx = ctx.slice(); 3969 child_ctx[23] = list[i][0]; 3970 child_ctx[24] = list[i][1]; 3971 return child_ctx; 3972} 3973 3974// (108:0) {#if info} 3975function create_if_block$2(ctx) { 3976 let current_block_type_index; 3977 let if_block; 3978 let if_block_anchor; 3979 let current; 3980 const if_block_creators = [create_if_block_1$1, create_else_block]; 3981 const if_blocks = []; 3982 3983 function select_block_type(ctx, dirty) { 3984 if (/*api_count*/ ctx[8]) return 0; 3985 return 1; 3986 } 3987 3988 current_block_type_index = select_block_type(ctx); 3989 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 3990 3991 return { 3992 c() { 3993 if_block.c(); 3994 if_block_anchor = empty$2(); 3995 }, 3996 m(target, anchor) { 3997 if_blocks[current_block_type_index].m(target, anchor); 3998 insert$2(target, if_block_anchor, anchor); 3999 current = true; 4000 }, 4001 p(ctx, dirty) { 4002 if_block.p(ctx, dirty); 4003 }, 4004 i(local) { 4005 if (current) return; 4006 transition_in$3(if_block); 4007 current = true; 4008 }, 4009 o(local) { 4010 transition_out$3(if_block); 4011 current = false; 4012 }, 4013 d(detaching) { 4014 if (detaching) { 4015 detach$2(if_block_anchor); 4016 } 4017 4018 if_blocks[current_block_type_index].d(detaching); 4019 } 4020 }; 4021} 4022 4023// (194:1) {:else} 4024function create_else_block(ctx) { 4025 let noapi; 4026 let current; 4027 noapi = new NoApi({ props: { root: /*root*/ ctx[0] } }); 4028 noapi.$on("close", /*close_handler_1*/ ctx[14]); 4029 4030 return { 4031 c() { 4032 create_component$3(noapi.$$.fragment); 4033 }, 4034 m(target, anchor) { 4035 mount_component$3(noapi, target, anchor); 4036 current = true; 4037 }, 4038 p(ctx, dirty) { 4039 const noapi_changes = {}; 4040 if (dirty & /*root*/ 1) noapi_changes.root = /*root*/ ctx[0]; 4041 noapi.$set(noapi_changes); 4042 }, 4043 i(local) { 4044 if (current) return; 4045 transition_in$3(noapi.$$.fragment, local); 4046 current = true; 4047 }, 4048 o(local) { 4049 transition_out$3(noapi.$$.fragment, local); 4050 current = false;
4051 }, 4052 d(detaching) { 4053 destroy_component$3(noapi, detaching); 4054 } 4055 }; 4056} 4057 4058// (109:1) {#if api_count} 4059function create_if_block_1$1(ctx) { 4060 let div0; 4061 let apibanner; 4062 let t0; 4063 let div4; 4064 let div1; 4065 let p0; 4066 let t1; 4067 let code0; 4068 let t3; 4069 let a0; 4070 let t4; 4071 let t5; 4072 let code1; 4073 let t7; 4074 let a1; 4075 let t8; 4076 let t9; 4077 let t10; 4078 let div3; 4079 let div2; 4080 let t11; 4081 let p1; 4082 let t13; 4083 let installsnippet; 4084 let t14; 4085 let p2; 4086 let t15; 4087 let t16; 4088 let t17; 4089 let current; 4090 4091 apibanner = new ApiBanner({ 4092 props: { 4093 root: /*space_id*/ ctx[2] || /*root*/ ctx[0], 4094 api_count: /*api_count*/ ctx[8] 4095 } 4096 }); 4097 4098 apibanner.$on("close", /*close_handler*/ ctx[12]); 4099 let each_value_1 = ensure_array_like$1(/*langs*/ ctx[9]); 4100 let each_blocks_1 = []; 4101 4102 for (let i = 0; i < each_value_1.length; i += 1) { 4103 each_blocks_1[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i)); 4104 } 4105 4106 installsnippet = new InstallSnippet({ 4107 props: { 4108 current_language: /*current_language*/ ctx[3] 4109 } 4110 }); 4111 4112 let if_block = /*space_id*/ ctx[2] && create_if_block_3$1(ctx); 4113 let each_value = ensure_array_like$1(/*dependencies*/ ctx[1]); 4114 let each_blocks = []; 4115 4116 for (let i = 0; i < each_value.length; i += 1) { 4117 each_blocks[i] = create_each_block$1(get_each_context$1(ctx, each_value, i)); 4118 } 4119 4120 const out = i => transition_out$3(each_blocks[i], 1, 1, () => { 4121 each_blocks[i] = null; 4122 }); 4123 4124 return { 4125 c() { 4126 div0 = element$1("div"); 4127 create_component$3(apibanner.$$.fragment); 4128 t0 = space$1(); 4129 div4 = element$1("div"); 4130 div1 = element$1("div"); 4131 p0 = element$1("p"); 4132 t1 = text$1("Use the "); 4133 code0 = element$1("code"); 4134 code0.textContent = "gradio_client"; 4135 t3 = text$1("\n\t\t\t\t\tPython library ("); 4136 a0 = element$1("a"); 4137 t4 = text$1("docs"); 4138 t5 = text$1(") or the\n\t\t\t\t\t"); 4139 code1 = element$1("code"); 4140 code1.textContent = "@gradio/client"; 4141 t7 = text$1("\n\t\t\t\t\tJavascript package ("); 4142 a1 = element$1("a"); 4143 t8 = text$1("docs"); 4144 t9 = text$1(") to\n\t\t\t\t\tquery the app via API."); 4145 t10 = space$1(); 4146 div3 = element$1("div"); 4147 div2 = element$1("div"); 4148 4149 for (let i = 0; i < each_blocks_1.length; i += 1) { 4150 each_blocks_1[i].c(); 4151 } 4152 4153 t11 = space$1(); 4154 p1 = element$1("p"); 4155 p1.textContent = "1. Install the client if you don't already have it installed."; 4156 t13 = space$1(); 4157 create_component$3(installsnippet.$$.fragment); 4158 t14 = space$1(); 4159 p2 = element$1("p"); 4160 t15 = text$1("2. Find the API endpoint below corresponding to your desired function\n\t\t\t\t\tin the app. Copy the code snippet, replacing the placeholder values\n\t\t\t\t\twith your own input data.\n\t\t\t\t\t"); 4161 if (if_block) if_block.c(); 4162 t16 = text$1(" Run the code, that's it!"); 4163 t17 = space$1(); 4164 4165 for (let i = 0; i < each_blocks.length; i += 1) { 4166 each_blocks[i].c(); 4167 } 4168 4169 attr$1(div0, "class", "banner-wrap svelte-19gb6z1"); 4170 attr$1(code0, "class", "library svelte-19gb6z1"); 4171 attr$1(a0, "href", py_docs); 4172 attr$1(a0, "target", "_blank"); 4173 attr$1(a0, "class", "svelte-19gb6z1"); 4174 attr$1(code1, "class", "library svelte-19gb6z1"); 4175 attr$1(a1, "href", js_docs); 4176 attr$1(a1, "target", "_blank"); 4177 attr$1(a1, "class", "svelte-19gb6z1"); 4178 attr$1(div1, "class", "client-doc svelte-19gb6z1"); 4179 attr$1(div2, "class", "snippets svelte-19gb6z1"); 4180 attr$1(p1, "class", "padded svelte-19gb6z1"); 4181 attr$1(p2, "class", "padded svelte-19gb6z1"); 4182 attr$1(div3, "class", "endpoint svelte-19gb6z1"); 4183 attr$1(div4, "class", "docs-wrap svelte-19gb6z1"); 4184 }, 4185 m(target, anchor) { 4186 insert$2(target, div0, anchor); 4187 mount_component$3(apibanner, div0, null); 4188 insert$2(target, t0, anchor); 4189 insert$2(target, div4, anchor); 4190 append$1(div4, div1); 4191 append$1(div1, p0); 4192 append$1(p0, t1); 4193 append$1(p0, code0); 4194 append$1(p0, t3); 4195 append$1(p0, a0); 4196 append$1(a0, t4); 4197 append$1(p0, t5); 4198 append$1(p0, code1); 4199 append$1(p0, t7); 4200 append$1(p0, a1); 4201 append$1(a1, t8); 4202 append$1(p0, t9); 4203 append$1(div4, t10); 4204 append$1(div4, div3); 4205 append$1(div3, div2); 4206 4207 for (let i = 0; i < each_blocks_1.length; i += 1) { 4208 if (each_blocks_1[i]) { 4209 each_blocks_1[i].m(div2, null); 4210 } 4211 } 4212 4213 append$1(div3, t11); 4214 append$1(div3, p1); 4215 append$1(div3, t13);
4216 mount_component$3(installsnippet, div3, null); 4217 append$1(div3, t14); 4218 append$1(div3, p2); 4219 append$1(p2, t15); 4220 if (if_block) if_block.m(p2, null); 4221 append$1(p2, t16); 4222 append$1(div3, t17); 4223 4224 for (let i = 0; i < each_blocks.length; i += 1) { 4225 if (each_blocks[i]) { 4226 each_blocks[i].m(div3, null); 4227 } 4228 } 4229 4230 current = true; 4231 }, 4232 p(ctx, dirty) { 4233 const apibanner_changes = {}; 4234 if (dirty & /*space_id, root*/ 5) apibanner_changes.root = /*space_id*/ ctx[2] || /*root*/ ctx[0]; 4235 apibanner.$set(apibanner_changes); 4236 4237 if (dirty & /*current_language, langs*/ 520) { 4238 each_value_1 = ensure_array_like$1(/*langs*/ ctx[9]); 4239 let i; 4240 4241 for (i = 0; i < each_value_1.length; i += 1) { 4242 const child_ctx = get_each_context_1(ctx, each_value_1, i); 4243 4244 if (each_blocks_1[i]) { 4245 each_blocks_1[i].p(child_ctx, dirty); 4246 } else { 4247 each_blocks_1[i] = create_each_block_1(child_ctx); 4248 each_blocks_1[i].c(); 4249 each_blocks_1[i].m(div2, null); 4250 } 4251 } 4252 4253 for (; i < each_blocks_1.length; i += 1) { 4254 each_blocks_1[i].d(1); 4255 } 4256 4257 each_blocks_1.length = each_value_1.length; 4258 } 4259 4260 const installsnippet_changes = {}; 4261 if (dirty & /*current_language*/ 8) installsnippet_changes.current_language = /*current_language*/ ctx[3]; 4262 installsnippet.$set(installsnippet_changes); 4263 4264 if (/*space_id*/ ctx[2]) { 4265 if (if_block) { 4266 if_block.p(ctx, dirty); 4267 } else { 4268 if_block = create_if_block_3$1(ctx); 4269 if_block.c(); 4270 if_block.m(p2, t16); 4271 } 4272 } else if (if_block) { 4273 if_block.d(1); 4274 if_block = null; 4275 } 4276 4277 if (dirty & /*info, dependencies, js_info, is_running, current_language, space_id, root, dependency_failures*/ 255) { 4278 each_value = ensure_array_like$1(/*dependencies*/ ctx[1]); 4279 let i; 4280 4281 for (i = 0; i < each_value.length; i += 1) { 4282 const child_ctx = get_each_context$1(ctx, each_value, i); 4283 4284 if (each_blocks[i]) { 4285 each_blocks[i].p(child_ctx, dirty); 4286 transition_in$3(each_blocks[i], 1); 4287 } else { 4288 each_blocks[i] = create_each_block$1(child_ctx); 4289 each_blocks[i].c(); 4290 transition_in$3(each_blocks[i], 1); 4291 each_blocks[i].m(div3, null); 4292 } 4293 } 4294 4295 group_outros$2(); 4296 4297 for (i = each_value.length; i < each_blocks.length; i += 1) { 4298 out(i); 4299 } 4300 4301 check_outros$2(); 4302 } 4303 }, 4304 i(local) { 4305 if (current) return; 4306 transition_in$3(apibanner.$$.fragment, local); 4307 transition_in$3(installsnippet.$$.fragment, local); 4308 4309 for (let i = 0; i < each_value.length; i += 1) { 4310 transition_in$3(each_blocks[i]); 4311 } 4312 4313 current = true; 4314 }, 4315 o(local) { 4316 transition_out$3(apibanner.$$.fragment, local); 4317 transition_out$3(installsnippet.$$.fragment, local);
4318 each_blocks = each_blocks.filter(Boolean); 4319 4320 for (let i = 0; i < each_blocks.length; i += 1) { 4321 transition_out$3(each_blocks[i]); 4322 } 4323 4324 current = false; 4325 }, 4326 d(detaching) { 4327 if (detaching) { 4328 detach$2(div0); 4329 detach$2(t0); 4330 detach$2(div4); 4331 } 4332 4333 destroy_component$3(apibanner); 4334 destroy_each(each_blocks_1, detaching); 4335 destroy_component$3(installsnippet); 4336 if (if_block) if_block.d(); 4337 destroy_each(each_blocks, detaching); 4338 } 4339 }; 4340} 4341 4342// (125:5) {#each langs as [language, img]} 4343function create_each_block_1(ctx) { 4344 let li; 4345 let img_1; 4346 let img_1_src_value; 4347 let t0; 4348 let t1_value = /*language*/ ctx[23] + ""; 4349 let t1; 4350 let t2; 4351 let li_class_value; 4352 let mounted; 4353 let dispose; 4354 4355 function click_handler() { 4356 return /*click_handler*/ ctx[13](/*language*/ ctx[23]); 4357 } 4358 4359 return { 4360 c() { 4361 li = element$1("li"); 4362 img_1 = element$1("img"); 4363 t0 = space$1(); 4364 t1 = text$1(t1_value); 4365 t2 = space$1(); 4366 if (!src_url_equal$1(img_1.src, img_1_src_value = /*img*/ ctx[24])) attr$1(img_1, "src", img_1_src_value); 4367 attr$1(img_1, "alt", ""); 4368 attr$1(img_1, "class", "svelte-19gb6z1"); 4369 4370 attr$1(li, "class", li_class_value = "snippet " + (/*current_language*/ ctx[3] === /*language*/ ctx[23] 4371 ? 'current-lang' 4372 : 'inactive-lang') + " svelte-19gb6z1"); 4373 }, 4374 m(target, anchor) { 4375 insert$2(target, li, anchor); 4376 append$1(li, img_1); 4377 append$1(li, t0); 4378 append$1(li, t1); 4379 append$1(li, t2); 4380 4381 if (!mounted) { 4382 dispose = listen$1(li, "click", click_handler); 4383 mounted = true; 4384 } 4385 }, 4386 p(new_ctx, dirty) { 4387 ctx = new_ctx; 4388 4389 if (dirty & /*current_language*/ 8 && li_class_value !== (li_class_value = "snippet " + (/*current_language*/ ctx[3] === /*language*/ ctx[23] 4390 ? 'current-lang' 4391 : 'inactive-lang') + " svelte-19gb6z1")) { 4392 attr$1(li, "class", li_class_value); 4393 } 4394 }, 4395 d(detaching) { 4396 if (detaching) { 4397 detach$2(li); 4398 } 4399 4400 mounted = false; 4401 dispose(); 4402 } 4403 }; 4404} 4405 4406// (147:5) {#if space_id} 4407function create_if_block_3$1(ctx) { 4408 let t0; 4409 let a; 4410 let t1; 4411 let a_href_value; 4412 let t2; 4413 4414 return { 4415 c() { 4416 t0 = text$1("If this is a private Space, you may need to pass your\n\t\t\t\t\t\tHugging Face token as well ("); 4417 a = element$1("a"); 4418 t1 = text$1("read more"); 4419 t2 = text$1(")."); 4420 4421 attr$1(a, "href", a_href_value = (/*current_language*/ ctx[3] == "python" 4422 ? py_docs 4423 : js_docs) + spaces_docs_suffix); 4424 4425 attr$1(a, "class", "underline svelte-19gb6z1"); 4426 attr$1(a, "target", "_blank"); 4427 }, 4428 m(target, anchor) { 4429 insert$2(target, t0, anchor); 4430 insert$2(target, a, anchor); 4431 append$1(a, t1); 4432 insert$2(target, t2, anchor); 4433 }, 4434 p(ctx, dirty) { 4435 if (dirty & /*current_language*/ 8 && a_href_value !== (a_href_value = (/*current_language*/ ctx[3] == "python" 4436 ? py_docs 4437 : js_docs) + spaces_docs_suffix)) { 4438 attr$1(a, "href", a_href_value); 4439 } 4440 }, 4441 d(detaching) { 4442 if (detaching) { 4443 detach$2(t0); 4444 detach$2(a); 4445 detach$2(t2); 4446 } 4447 } 4448 }; 4449} 4450 4451// (157:5) {#if dependency.show_api} 4452function create_if_block_2$1(ctx) { 4453 let div; 4454 let codesnippets; 4455 let t0; 4456 let responseobject; 4457 let t1; 4458 let current; 4459 4460 codesnippets = new CodeSnippets({ 4461 props: { 4462 named: true, 4463 endpoint_parameters: /*info*/ ctx[6].named_endpoints["/" + /*dependency*/ ctx[20].api_name].parameters, 4464 js_parameters: /*js_info*/ ctx[7].named_endpoints["/" + /*dependency*/ ctx[20].api_name].parameters, 4465 dependency: /*dependency*/ ctx[20], 4466 dependency_index: /*dependency_index*/ ctx[22], 4467 current_language: /*current_language*/ ctx[3], 4468 root: /*space_id*/ ctx[2] || /*root*/ ctx[0], 4469 dependency_failures: /*dependency_failures*/ ctx[5] 4470 } 4471 }); 4472 4473 responseobject = new ResponseObject({ 4474 props: { 4475 endpoint_returns: /*info*/ ctx[6].named_endpoints["/" + /*dependency*/ ctx[20].api_name].returns, 4476 js_returns: /*js_info*/ ctx[7].named_endpoints["/" + /*dependency*/ ctx[20].api_name].returns, 4477 is_running: /*is_running*/ ctx[4], 4478 current_language: /*current_language*/ ctx[3] 4479 } 4480 }); 4481 4482 return { 4483 c() { 4484 div = element$1("div"); 4485 create_component$3(codesnippets.$$.fragment); 4486 t0 = space$1(); 4487 create_component$3(responseobject.$$.fragment); 4488 t1 = space$1(); 4489 attr$1(div, "class", "endpoint-container svelte-19gb6z1"); 4490 }, 4491 m(target, anchor) { 4492 insert$2(target, div, anchor);
4493 mount_component$3(codesnippets, div, null); 4494 append$1(div, t0); 4495 mount_component$3(responseobject, div, null); 4496 append$1(div, t1); 4497 current = true; 4498 }, 4499 p(ctx, dirty) { 4500 const codesnippets_changes = {}; 4501 if (dirty & /*info, dependencies*/ 66) codesnippets_changes.endpoint_parameters = /*info*/ ctx[6].named_endpoints["/" + /*dependency*/ ctx[20].api_name].parameters; 4502 if (dirty & /*js_info, dependencies*/ 130) codesnippets_changes.js_parameters = /*js_info*/ ctx[7].named_endpoints["/" + /*dependency*/ ctx[20].api_name].parameters; 4503 if (dirty & /*dependencies*/ 2) codesnippets_changes.dependency = /*dependency*/ ctx[20]; 4504 if (dirty & /*current_language*/ 8) codesnippets_changes.current_language = /*current_language*/ ctx[3]; 4505 if (dirty & /*space_id, root*/ 5) codesnippets_changes.root = /*space_id*/ ctx[2] || /*root*/ ctx[0]; 4506 if (dirty & /*dependency_failures*/ 32) codesnippets_changes.dependency_failures = /*dependency_failures*/ ctx[5]; 4507 codesnippets.$set(codesnippets_changes); 4508 const responseobject_changes = {}; 4509 if (dirty & /*info, dependencies*/ 66) responseobject_changes.endpoint_returns = /*info*/ ctx[6].named_endpoints["/" + /*dependency*/ ctx[20].api_name].returns; 4510 if (dirty & /*js_info, dependencies*/ 130) responseobject_changes.js_returns = /*js_info*/ ctx[7].named_endpoints["/" + /*dependency*/ ctx[20].api_name].returns; 4511 if (dirty & /*is_running*/ 16) responseobject_changes.is_running = /*is_running*/ ctx[4]; 4512 if (dirty & /*current_language*/ 8) responseobject_changes.current_language = /*current_language*/ ctx[3]; 4513 responseobject.$set(responseobject_changes); 4514 }, 4515 i(local) { 4516 if (current) return; 4517 transition_in$3(codesnippets.$$.fragment, local); 4518 transition_in$3(responseobject.$$.fragment, local); 4519 current = true; 4520 }, 4521 o(local) { 4522 transition_out$3(codesnippets.$$.fragment, local); 4523 transition_out$3(responseobject.$$.fragment, local); 4524 current = false; 4525 }, 4526 d(detaching) { 4527 if (detaching) { 4528 detach$2(div); 4529 } 4530 4531 destroy_component$3(codesnippets); 4532 destroy_component$3(responseobject); 4533 } 4534 }; 4535} 4536 4537// (156:4) {#each dependencies as dependency, dependency_index} 4538function create_each_block$1(ctx) { 4539 let if_block_anchor; 4540 let current;
4541 let if_block = /*dependency*/ ctx[20].show_api && create_if_block_2$1(ctx); 4542 4543 return { 4544 c() { 4545 if (if_block) if_block.c(); 4546 if_block_anchor = empty$2(); 4547 }, 4548 m(target, anchor) { 4549 if (if_block) if_block.m(target, anchor); 4550 insert$2(target, if_block_anchor, anchor); 4551 current = true; 4552 }, 4553 p(ctx, dirty) { 4554 if (/*dependency*/ ctx[20].show_api) { 4555 if (if_block) { 4556 if_block.p(ctx, dirty); 4557 4558 if (dirty & /*dependencies*/ 2) { 4559 transition_in$3(if_block, 1); 4560 } 4561 } else { 4562 if_block = create_if_block_2$1(ctx); 4563 if_block.c(); 4564 transition_in$3(if_block, 1); 4565 if_block.m(if_block_anchor.parentNode, if_block_anchor); 4566 } 4567 } else if (if_block) { 4568 group_outros$2(); 4569 4570 transition_out$3(if_block, 1, 1, () => { 4571 if_block = null; 4572 }); 4573 4574 check_outros$2(); 4575 } 4576 }, 4577 i(local) { 4578 if (current) return; 4579 transition_in$3(if_block); 4580 current = true; 4581 }, 4582 o(local) { 4583 transition_out$3(if_block); 4584 current = false; 4585 }, 4586 d(detaching) { 4587 if (detaching) { 4588 detach$2(if_block_anchor); 4589 } 4590 4591 if (if_block) if_block.d(detaching); 4592 } 4593 }; 4594} 4595 4596function create_fragment$3(ctx) { 4597 let if_block_anchor; 4598 let current; 4599 let if_block = /*info*/ ctx[6] && create_if_block$2(ctx); 4600 4601 return { 4602 c() { 4603 if (if_block) if_block.c(); 4604 if_block_anchor = empty$2(); 4605 }, 4606 m(target, anchor) { 4607 if (if_block) if_block.m(target, anchor); 4608 insert$2(target, if_block_anchor, anchor); 4609 current = true; 4610 }, 4611 p(ctx, [dirty]) { 4612 if (/*info*/ ctx[6]) { 4613 if (if_block) { 4614 if_block.p(ctx, dirty); 4615 4616 if (dirty & /*info*/ 64) { 4617 transition_in$3(if_block, 1); 4618 } 4619 } else { 4620 if_block = create_if_block$2(ctx); 4621 if_block.c(); 4622 transition_in$3(if_block, 1); 4623 if_block.m(if_block_anchor.parentNode, if_block_anchor); 4624 } 4625 } else if (if_block) { 4626 group_outros$2(); 4627 4628 transition_out$3(if_block, 1, 1, () => { 4629 if_block = null; 4630 }); 4631 4632 check_outros$2(); 4633 } 4634 }, 4635 i(local) { 4636 if (current) return; 4637 transition_in$3(if_block); 4638 current = true; 4639 }, 4640 o(local) { 4641 transition_out$3(if_block); 4642 current = false; 4643 }, 4644 d(detaching) { 4645 if (detaching) { 4646 detach$2(if_block_anchor); 4647 } 4648 4649 if (if_block) if_block.d(detaching); 4650 } 4651 }; 4652} 4653 4654const js_docs = "https://www.gradio.app/guides/getting-started-with-the-js-client"; 4655const py_docs = "https://www.gradio.app/guides/getting-started-with-the-python-client"; 4656const spaces_docs_suffix = "#connecting-to-a-hugging-face-space"; 4657 4658function instance$3($$self, $$props, $$invalidate) { 4659 let { instance_map } = $$props; 4660 let { dependencies } = $$props; 4661 let { root } = $$props; 4662 let { app } = $$props; 4663 let { space_id } = $$props; 4664 let api_count = dependencies.filter(dependency => dependency.show_api).length; 4665 4666 if (root === "") { 4667 root = location.protocol + "//" + location.host + location.pathname; 4668 } 4669 4670 if (!root.endsWith("/")) { 4671 root += "/"; 4672 } 4673 4674 let current_language = "python"; 4675 const langs = [["python", python], ["javascript", javascript]]; 4676 let is_running = false; 4677 4678 dependencies.map(dependency => dependency.inputs.map(_id => { 4679 let default_data = instance_map[_id].documentation?.example_data; 4680 4681 if (default_data === undefined) { 4682 default_data = ""; 4683 } else if (typeof default_data === "object") { 4684 default_data = JSON.stringify(default_data); 4685 } 4686 4687 return default_data; 4688 })); 4689 4690 dependencies.map(dependency => new Array(dependency.outputs.length)); 4691 let dependency_failures = dependencies.map(dependency => new Array(dependency.inputs.length).fill(false)); 4692 4693 async function get_info() { 4694 let response = await fetch(root + "info"); 4695 let data = await response.json(); 4696 return data; 4697 } 4698 4699 async function get_js_info() { 4700 let js_api_info = await app.view_api(); 4701 return js_api_info; 4702 } 4703 4704 let info; 4705 let js_info; 4706 4707 get_info().then(data => { 4708 $$invalidate(6, info = data); 4709 }); 4710 4711 get_js_info().then(js_api_info => { 4712 $$invalidate(7, js_info = js_api_info); 4713 }); 4714 4715 onMount$2(() => { 4716 document.body.style.overflow = "hidden"; 4717 4718 if ("parentIFrame" in window) { 4719 window.parentIFrame?.scrollTo(0, 0); 4720 } 4721 4722 return () => { 4723 document.body.style.overflow = "auto"; 4724 }; 4725 }); 4726 4727 function close_handler(event) { 4728 bubble$1.call(this, $$self, event); 4729 } 4730 4731 const click_handler = language =>
4731 $$invalidate(3, current_language = language); 4732 4733 function close_handler_1(event) { 4734 bubble$1.call(this, $$self, event); 4735 } 4736 4737 $$self.$$set = $$props => { 4738 if ('instance_map' in $$props) $$invalidate(10, instance_map = $$props.instance_map); 4739 if ('dependencies' in $$props) $$invalidate(1, dependencies = $$props.dependencies); 4740 if ('root' in $$props) $$invalidate(0, root = $$props.root); 4741 if ('app' in $$props) $$invalidate(11, app = $$props.app); 4742 if ('space_id' in $$props) $$invalidate(2, space_id = $$props.space_id); 4743 }; 4744 4745 return [ 4746 root, 4747 dependencies, 4748 space_id, 4749 current_language, 4750 is_running, 4751 dependency_failures, 4752 info, 4753 js_info, 4754 api_count, 4755 langs, 4756 instance_map, 4757 app, 4758 close_handler, 4759 click_handler, 4760 close_handler_1 4761 ]; 4762} 4763 4764class ApiDocs extends SvelteComponent$3 { 4765 constructor(options) { 4766 super(); 4767 4768 init$3(this, options, instance$3, create_fragment$3, safe_not_equal$3, { 4769 instance_map: 10, 4770 dependencies: 1, 4771 root: 0, 4772 app: 11, 4773 space_id: 2 4774 }); 4775 } 4776} 4777 4778get_store_value($format); 4779class Gradio { 4780 #id; 4781 #el; 4782 constructor(id, el, theme, version, root, autoscroll) { 4783 this.#id = id; 4784 this.theme = theme; 4785 this.version = version; 4786 this.#el = el; 4787 this.i18n = get_store_value($format); 4788 this.root = root; 4789 this.autoscroll = autoscroll; 4790 } 4791 dispatch(event_name, data) { 4792 const e = new CustomEvent("gradio", { 4793 bubbles: true, 4794 detail: { data, id: this.#id, event: event_name } 4795 }); 4796 this.#el.dispatchEvent(e); 4797 } 4798} 4799 4800/* src/Render.svelte generated by Svelte v4.2.2 */ 4801const { 4802 SvelteComponent: SvelteComponent$2, 4803 add_flush_callback, 4804 assign, 4805 bind, 4806 binding_callbacks, 4807 bubble, 4808 check_outros: check_outros$1, 4809 construct_svelte_component, 4810 create_component: create_component$2, 4811 destroy_component: destroy_component$2, 4812 detach: detach$1, 4813 empty: empty$1, 4814 ensure_array_like, 4815 get_spread_object, 4816 get_spread_update, 4817 group_outros: group_outros$1, 4818 init: init$2, 4819 insert: insert$1, 4820 mount_component: mount_component$2, 4821 outro_and_destroy_block, 4822 safe_not_equal: safe_not_equal$2, 4823 transition_in: transition_in$2, 4824 transition_out: transition_out$2, 4825 update_keyed_each 4826} = window.__gradio__svelte__internal;const { onMount: onMount$1, createEventDispatcher: createEventDispatcher$1, setContext } = window.__gradio__svelte__internal; 4827function get_each_context(ctx, list, i) { 4828 const child_ctx = ctx.slice(); 4829 child_ctx[10] = list[i].component; 4830 child_ctx[19] = list[i].id; 4831 child_ctx[2] = list[i].props; 4832 child_ctx[20] = list[i].children; 4833 child_ctx[21] = list[i].has_modes; 4834 return child_ctx; 4835} 4836 4837// (69:1) {#if children && children.length} 4838function create_if_block$1(ctx) { 4839 let each_blocks = []; 4840 let each_1_lookup = new Map(); 4841 let each_1_anchor; 4842 let current; 4843 let each_value = ensure_array_like(/*children*/ ctx[1]); 4844 const get_key = ctx => /*each_id*/ ctx[19]; 4845 4846 for (let i = 0; i < each_value.length; i += 1) { 4847 let child_ctx = get_each_context(ctx, each_value, i); 4848 let key = get_key(child_ctx); 4849 each_1_lookup.set(key, each_blocks[i] = create_each_block(key, child_ctx)); 4850 } 4851 4852 return { 4853 c() { 4854 for (let i = 0; i < each_blocks.length; i += 1) { 4855 each_blocks[i].c(); 4856 } 4857 4858 each_1_anchor = empty$1(); 4859 }, 4860 m(target, anchor) { 4861 for (let i = 0; i < each_blocks.length; i += 1) { 4862 if (each_blocks[i]) { 4863 each_blocks[i].m(target, anchor); 4864 } 4865 } 4866 4867 insert$1(target, each_1_anchor, anchor); 4868 current = true; 4869 }, 4870 p(ctx, dirty) { 4871 if (dirty & /*children, target, root, instance_map, dynamic_ids, theme_mode*/ 235) { 4872 each_value = ensure_array_like(/*children*/ ctx[1]); 4873 group_outros$1(); 4874 each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, each_1_anchor.parentNode, outro_and_destroy_block, create_each_block, each_1_anchor, get_each_context); 4875 check_outros$1(); 4876 } 4877 }, 4878 i(local) { 4879 if (current) return; 4880 4881 for (let i = 0; i < each_value.length; i += 1) { 4882 transition_in$2(each_blocks[i]); 4883 } 4884 4885 current = true; 4886 }, 4887 o(local) { 4888 for (let i = 0; i < each_blocks.length; i += 1) { 4889 transition_out$2(each_blocks[i]); 4890 } 4891 4892 current = false;
4893 }, 4894 d(detaching) { 4895 if (detaching) { 4896 detach$1(each_1_anchor); 4897 } 4898 4899 for (let i = 0; i < each_blocks.length; i += 1) { 4900 each_blocks[i].d(detaching); 4901 } 4902 } 4903 }; 4904} 4905 4906// (70:2) {#each children as { component, id: each_id, props, children: _children, has_modes } 4907function create_each_block(key_1, ctx) { 4908 let first; 4909 let render; 4910 let current; 4911 4912 render = new Render({ 4913 props: { 4914 component: /*component*/ ctx[10], 4915 target: /*target*/ ctx[6], 4916 id: /*each_id*/ ctx[19], 4917 props: /*props*/ ctx[2], 4918 root: /*root*/ ctx[3], 4919 instance_map: /*instance_map*/ ctx[0], 4920 children: /*_children*/ ctx[20], 4921 dynamic_ids: /*dynamic_ids*/ ctx[5], 4922 has_modes: /*has_modes*/ ctx[21], 4923 theme_mode: /*theme_mode*/ ctx[7] 4924 } 4925 }); 4926 4927 render.$on("destroy", /*destroy_handler*/ ctx[13]); 4928 render.$on("mount", /*mount_handler*/ ctx[14]); 4929 4930 return { 4931 key: key_1, 4932 first: null, 4933 c() { 4934 first = empty$1(); 4935 create_component$2(render.$$.fragment); 4936 this.first = first; 4937 }, 4938 m(target, anchor) { 4939 insert$1(target, first, anchor); 4940 mount_component$2(render, target, anchor); 4941 current = true; 4942 }, 4943 p(new_ctx, dirty) { 4944 ctx = new_ctx; 4945 const render_changes = {}; 4946 if (dirty & /*children*/ 2) render_changes.component = /*component*/ ctx[10]; 4947 if (dirty & /*target*/ 64) render_changes.target = /*target*/ ctx[6]; 4948 if (dirty & /*children*/ 2) render_changes.id = /*each_id*/ ctx[19]; 4949 if (dirty & /*children*/ 2) render_changes.props = /*props*/ ctx[2]; 4950 if (dirty & /*root*/ 8) render_changes.root = /*root*/ ctx[3]; 4951 if (dirty & /*instance_map*/ 1) render_changes.instance_map = /*instance_map*/ ctx[0]; 4952 if (dirty & /*children*/ 2) render_changes.children = /*_children*/ ctx[20]; 4953 if (dirty & /*dynamic_ids*/ 32) render_changes.dynamic_ids = /*dynamic_ids*/ ctx[5]; 4954 if (dirty & /*children*/ 2) render_changes.has_modes = /*has_modes*/ ctx[21]; 4955 if (dirty & /*theme_mode*/ 128) render_changes.theme_mode = /*theme_mode*/ ctx[7]; 4956 render.$set(render_changes); 4957 }, 4958 i(local) { 4959 if (current) return; 4960 transition_in$2(render.$$.fragment, local); 4961 current = true; 4962 }, 4963 o(local) { 4964 transition_out$2(render.$$.fragment, local); 4965 current = false; 4966 }, 4967 d(detaching) { 4968 if (detaching) { 4969 detach$1(first); 4970 } 4971 4972 destroy_component$2(render, detaching); 4973 } 4974 }; 4975} 4976 4977// (56:0) <svelte:component this={component} bind:this={instance_map[id].instance} bind:value={instance_map[id].props.value} elem_id={("elem_id" in props && props.elem_id) || `component-${id}`} elem_classes={("elem_classes" in props && props.elem_classes) || []} on:prop_change={handle_prop_change} {target} {...props} {theme_mode} {root} gradio={new Gradio(id, target, theme_mode, version, root, autoscroll)} > 4978function create_default_slot(ctx) { 4979 let if_block_anchor; 4980 let current; 4981 let if_block = /*children*/ ctx[1] && /*children*/ ctx[1].length && create_if_block$1(ctx); 4982 4983 return { 4984 c() { 4985 if (if_block) if_block.c(); 4986 if_block_anchor = empty$1(); 4987 }, 4988 m(target, anchor) { 4989 if (if_block) if_block.m(target, anchor); 4990 insert$1(target, if_block_anchor, anchor); 4991 current = true; 4992 }, 4993 p(ctx, dirty) { 4994 if (/*children*/ ctx[1] && /*children*/ ctx[1].length) { 4995 if (if_block) { 4996 if_block.p(ctx, dirty); 4997 4998 if (dirty & /*children*/ 2) { 4999 transition_in$2(if_block, 1); 5000 } 5001 } else { 5002 if_block = create_if_block$1(ctx); 5003 if_block.c(); 5004 transition_in$2(if_block, 1); 5005 if_block.m(if_block_anchor.parentNode, if_block_anchor); 5006 } 5007 } else if (if_block) { 5008 group_outros$1(); 5009 5010 transition_out$2(if_block, 1, 1, () => { 5011 if_block = null; 5012 }); 5013 5014 check_outros$1(); 5015 } 5016 }, 5017 i(local) { 5018 if (current) return; 5019 transition_in$2(if_block); 5020 current = true; 5021 }, 5022 o(local) { 5023 transition_out$2(if_block); 5024 current = false; 5025 }, 5026 d(detaching) { 5027 if (detaching) { 5028 detach$1(if_block_anchor); 5029 } 5030 5031 if (if_block) if_block.d(detaching); 5032 } 5033 }; 5034} 5035 5036function create_fragment$2(ctx) { 5037 let switch_instance; 5038 let updating_value; 5039 let switch_instance_anchor; 5040 let current; 5041 5042 const switch_instance_spread_levels = [ 5043 { 5044 elem_id: "elem_id" in /*props*/ ctx[2] && /*props*/ ctx[2].elem_id || `component-${/*id
5044*/ ctx[4]}` 5045 }, 5046 { 5047 elem_classes: "elem_classes" in /*props*/ ctx[2] && /*props*/ ctx[2].elem_classes || [] 5048 }, 5049 { target: /*target*/ ctx[6] }, 5050 /*props*/ ctx[2], 5051 { theme_mode: /*theme_mode*/ ctx[7] }, 5052 { root: /*root*/ ctx[3] }, 5053 { 5054 gradio: new Gradio(/*id*/ ctx[4], /*target*/ ctx[6], /*theme_mode*/ ctx[7], /*version*/ ctx[8], /*root*/ ctx[3], /*autoscroll*/ ctx[9]) 5055 } 5056 ]; 5057 5058 function switch_instance_value_binding(value) { 5059 /*switch_instance_value_binding*/ ctx[16](value); 5060 } 5061 5062 var switch_value = /*component*/ ctx[10]; 5063 5064 function switch_props(ctx, dirty) { 5065 let switch_instance_props = { 5066 $$slots: { default: [create_default_slot] }, 5067 $$scope: { ctx } 5068 }; 5069 5070 if (dirty !== undefined && dirty & /*props, id, target, theme_mode, root, version, autoscroll*/ 988) { 5071 switch_instance_props = get_spread_update(switch_instance_spread_levels, [ 5072 dirty & /*props, id*/ 20 && { 5073 elem_id: "elem_id" in /*props*/ ctx[2] && /*props*/ ctx[2].elem_id || `component-${/*id*/ ctx[4]}` 5074 }, 5075 dirty & /*props*/ 4 && { 5076 elem_classes: "elem_classes" in /*props*/ ctx[2] && /*props*/ ctx[2].elem_classes || [] 5077 }, 5078 dirty & /*target*/ 64 && { target: /*target*/ ctx[6] }, 5079 dirty & /*props*/ 4 && get_spread_object(/*props*/ ctx[2]), 5080 dirty & /*theme_mode*/ 128 && { theme_mode: /*theme_mode*/ ctx[7] }, 5081 dirty & /*root*/ 8 && { root: /*root*/ ctx[3] }, 5082 dirty & /*id, target, theme_mode, version, root, autoscroll*/ 984 && { 5083 gradio: new Gradio(/*id*/ ctx[4], /*target*/ ctx[6], /*theme_mode*/ ctx[7], /*version*/ ctx[8], /*root*/ ctx[3], /*autoscroll*/ ctx[9]) 5084 } 5085 ]); 5086 } else { 5087 for (let i = 0; i < switch_instance_spread_levels.length; i += 1) { 5088 switch_instance_props = assign(switch_instance_props, switch_instance_spread_levels[i]); 5089 } 5090 } 5091 5092 if (/*instance_map*/ ctx[0][/*id*/ ctx[4]].props.value !== void 0) { 5093 switch_instance_props.value = /*instance_map*/ ctx[0][/*id*/ ctx[4]].props.value; 5094 } 5095 5096 return { props: switch_instance_props }; 5097 } 5098 5099 if (switch_value) { 5100 switch_instance = construct_svelte_component(switch_value, switch_props(ctx)); 5101 /*switch_instance_binding*/ ctx[15](switch_instance); 5102 binding_callbacks.push(() => bind(switch_instance, 'value', switch_instance_value_binding)); 5103 switch_instance.$on("prop_change", /*handle_prop_change*/ ctx[11]); 5104 } 5105 5106 return { 5107 c() { 5108 if (switch_instance) create_component$2(switch_instance.$$.fragment); 5109 switch_instance_anchor = empty$1(); 5110 }, 5111 m(target, anchor) { 5112 if (switch_instance) mount_component$2(switch_instance, target, anchor); 5113 insert$1(target, switch_instance_anchor, anchor); 5114 current = true; 5115 }, 5116 p(ctx, [dirty]) { 5117 if (dirty & /*component*/ 1024 && switch_value !== (switch_value = /*component*/ ctx[10])) { 5118 if (switch_instance) { 5119 group_outros$1(); 5120 const old_component = switch_instance; 5121 5122 transition_out$2(old_component.$$.fragment, 1, 0, () => { 5123 destroy_component$2(old_component, 1); 5124 }); 5125 5126 check_outros$1(); 5127 } 5128 5129 if (switch_value) { 5130 switch_instance = construct_svelte_component(switch_value, switch_props(ctx, dirty)); 5131 /*switch_instance_binding*/ ctx[15](switch_instance); 5132 binding_callbacks.push(() => bind(switch_instance, 'value', switch_instance_value_binding)); 5133 switch_instance.$on("prop_change", /*handle_prop_change*/ ctx[11]); 5134 create_component$2(switch_instance.$$.fragment); 5135 transition_in$2(switch_instance.$$.fragment, 1); 5136 mount_component$2(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor); 5137 } else { 5138 switch_instance = null; 5139 } 5140 } else if (switch_value) { 5141 const switch_instance_changes = (dirty & /*props, id, target, theme_mode, root, version, autoscroll*/ 988) 5142 ? get_spread_update(switch_instance_spread_levels, [ 5143 dirty & /*props, id*/ 20 && { 5144 elem_id: "elem_id" in /*props*/ ctx[2] && /*props*/ ctx[2].elem_id || `component-${/*id*/ ctx[4]}` 5145 }, 5146 dirty & /*props*/ 4 && { 5147 elem_classes: "elem_classes" in /*props*/ ctx[2] && /*props*/ ctx[2].elem_classes || [] 5148 }, 5149 dirty & /*target*/ 64 && { target: /*target*/ ctx[6] }, 5150 dirty & /*props*/ 4 && get_spread_object(/*props*/ ctx[2]), 5151 dirty & /*theme_mode*/ 128 && { theme_mode: /*theme_mode*/ ctx[7] }, 5152 dirty & /*root*/ 8 && { root: /*root*/ ctx[3] }, 5153 dirty & /*id, target, theme_mode, version, root, autoscroll*/ 984 && { 5154 gradio: new Gradio(/*id*/ ctx[4], /*target*/ ctx[6], /*theme_mode*/ ctx[7], /*version*/ ctx[8], /*root*/ ctx[3], /*autoscroll*/ ctx[9]) 5155 } 5156 ]) 5157 : {}; 5158
5159 if (dirty & /*$$scope, children, target, root, instance_map, dynamic_ids, theme_mode*/ 16777451) { 5160 switch_instance_changes.$$scope = { dirty, ctx }; 5161 } 5162 5163 if (!updating_value && dirty & /*instance_map, id*/ 17) { 5164 updating_value = true; 5165 switch_instance_changes.value = /*instance_map*/ ctx[0][/*id*/ ctx[4]].props.value; 5166 add_flush_callback(() => updating_value = false); 5167 } 5168 5169 switch_instance.$set(switch_instance_changes); 5170 } 5171 }, 5172 i(local) { 5173 if (current) return; 5174 if (switch_instance) transition_in$2(switch_instance.$$.fragment, local); 5175 current = true; 5176 }, 5177 o(local) { 5178 if (switch_instance) transition_out$2(switch_instance.$$.fragment, local); 5179 current = false; 5180 }, 5181 d(detaching) { 5182 if (detaching) { 5183 detach$1(switch_instance_anchor); 5184 } 5185 5186 /*switch_instance_binding*/ ctx[15](null); 5187 if (switch_instance) destroy_component$2(switch_instance, detaching); 5188 } 5189 }; 5190} 5191 5192function instance$2($$self, $$props, $$invalidate) { 5193 let { root } = $$props; 5194 let { component } = $$props; 5195 let { instance_map } = $$props; 5196 let { id } = $$props; 5197 let { props } = $$props; 5198 let { children } = $$props; 5199 let { dynamic_ids } = $$props; 5200 let { parent = null } = $$props; 5201 let { target } = $$props; 5202 let { theme_mode } = $$props; 5203 let { version } = $$props; 5204 let { autoscroll } = $$props; 5205 const dispatch = createEventDispatcher$1(); 5206 let filtered_children = []; 5207 5208 onMount$1(() => { 5209 dispatch("mount", id); 5210 5211 for (const child of filtered_children) { 5212 dispatch("mount", child.id); 5213 } 5214 5215 return () => { 5216 dispatch("destroy", id); 5217 5218 for (const child of filtered_children) { 5219 dispatch("mount", child.id); 5220 } 5221 }; 5222 }); 5223 5224 setContext("BLOCK_KEY", parent); 5225 5226 function handle_prop_change(e) { 5227 for (const k in e.detail) { 5228 $$invalidate(0, instance_map[id].props[k] = e.detail[k], instance_map); 5229 } 5230 } 5231 5232 function destroy_handler(event) { 5233 bubble.call(this, $$self, event); 5234 } 5235 5236 function mount_handler(event) { 5237 bubble.call(this, $$self, event); 5238 } 5239 5240 function switch_instance_binding($$value) { 5241 binding_callbacks[$$value ? 'unshift' : 'push'](() => { 5242 instance_map[id].instance = $$value; 5243 $$invalidate(0, instance_map); 5244 }); 5245 } 5246 5247 function switch_instance_value_binding(value) { 5248 if ($$self.$$.not_equal(instance_map[id].props.value, value)) { 5249 instance_map[id].props.value = value; 5250 $$invalidate(0, instance_map); 5251 } 5252 } 5253 5254 $$self.$$set = $$props => {
5255 if ('root' in $$props) $$invalidate(3, root = $$props.root); 5256 if ('component' in $$props) $$invalidate(10, component = $$props.component); 5257 if ('instance_map' in $$props) $$invalidate(0, instance_map = $$props.instance_map); 5258 if ('id' in $$props) $$invalidate(4, id = $$props.id); 5259 if ('props' in $$props) $$invalidate(2, props = $$props.props); 5260 if ('children' in $$props) $$invalidate(1, children = $$props.children); 5261 if ('dynamic_ids' in $$props) $$invalidate(5, dynamic_ids = $$props.dynamic_ids); 5262 if ('parent' in $$props) $$invalidate(12, parent = $$props.parent); 5263 if ('target' in $$props) $$invalidate(6, target = $$props.target); 5264 if ('theme_mode' in $$props) $$invalidate(7, theme_mode = $$props.theme_mode); 5265 if ('version' in $$props) $$invalidate(8, version = $$props.version); 5266 if ('autoscroll' in $$props) $$invalidate(9, autoscroll = $$props.autoscroll); 5267 }; 5268 5269 $$self.$$.update = () => { 5270 if ($$self.$$.dirty & /*children, instance_map*/ 3) { 5271 $$invalidate(1, children = children && children.filter(v => { 5272 const valid_node = instance_map[v.id].type !== "statustracker"; 5273 5274 if (!valid_node) { 5275 filtered_children.push(v); 5276 } 5277 5278 return valid_node; 5279 })); 5280 } 5281 5282 if ($$self.$$.dirty & /*instance_map, id, children*/ 19) { 5283 { 5284 if (instance_map[id].type === "form") { 5285 if (children?.every(c => !c.props.visible)) { 5286 $$invalidate(2, props.visible = false, props); 5287 } else { 5288 $$invalidate(2, props.visible = true, props); 5289 } 5290 } 5291 } 5292 } 5293 }; 5294 5295 return [ 5296 instance_map, 5297 children, 5298 props, 5299 root, 5300 id, 5301 dynamic_ids, 5302 target, 5303 theme_mode, 5304 version, 5305 autoscroll, 5306 component, 5307 handle_prop_change, 5308 parent, 5309 destroy_handler, 5310 mount_handler, 5311 switch_instance_binding, 5312 switch_instance_value_binding 5313 ]; 5314} 5315 5316class Render extends SvelteComponent$2 { 5317 constructor(options) { 5318 super(); 5319 5320 init$2(this, options, instance$2, create_fragment$2, safe_not_equal$2, { 5321 root: 3, 5322 component: 10, 5323 instance_map: 0, 5324 id: 4, 5325 props: 2, 5326 children: 1, 5327 dynamic_ids: 5, 5328 parent: 12, 5329 target: 6, 5330 theme_mode: 7, 5331 version: 8, 5332 autoscroll: 9 5333 }); 5334 } 5335} 5336 5337/* src/MountComponents.svelte generated by Svelte v4.2.2 */ 5338const { 5339 SvelteComponent: SvelteComponent$1, 5340 create_component: create_component$1, 5341 destroy_component: destroy_component$1, 5342 init: init$1, 5343 mount_component: mount_component$1, 5344 safe_not_equal: safe_not_equal$1, 5345 transition_in: transition_in$1, 5346 transition_out: transition_out$1 5347} = window.__gradio__svelte__internal; 5348const { onMount, createEventDispatcher } = window.__gradio__svelte__internal; 5349function create_fragment$1(ctx) { 5350 let render; 5351 let current; 5352 5353 render = new Render({ 5354 props: { 5355 component: /*rootNode*/ ctx[0].component, 5356 id: /*rootNode*/ ctx[0].id, 5357 props: /*rootNode*/ ctx[0].props, 5358 children: /*rootNode*/ ctx[0].children, 5359 dynamic_ids: /*dynamic_ids*/ ctx[1], 5360 instance_map: /*instance_map*/ ctx[2], 5361 root: /*root*/ ctx[3], 5362 target: /*target*/ ctx[4], 5363 theme_mode: /*theme_mode*/ ctx[5], 5364 version: /*version*/ ctx[6], 5365 autoscroll: /*autoscroll*/ ctx[7] 5366 } 5367 }); 5368 5369 return { 5370 c() { 5371 create_component$1(render.$$.fragment); 5372 }, 5373 m(target, anchor) { 5374 mount_component$1(render, target, anchor); 5375 current = true; 5376 }, 5377 p(ctx, [dirty]) { 5378 const render_changes = {}; 5379 if (dirty & /*rootNode*/ 1) render_changes.component = /*rootNode*/ ctx[0].component; 5380 if (dirty & /*rootNode*/ 1) render_changes.id = /*rootNode*/ ctx[0].id; 5381 if (dirty & /*rootNode*/ 1) render_changes.props = /*rootNode*/ ctx[0].props; 5382 if (dirty & /*rootNode*/ 1) render_changes.children = /*rootNode*/ ctx[0].children; 5383 if (dirty & /*dynamic_ids*/ 2) render_changes.dynamic_ids = /*dynamic_ids*/ ctx[1]; 5384 if (dirty & /*instance_map*/ 4) render_changes.instance_map = /*instance_map*/ ctx[2]; 5385 if (dirty & /*root*/ 8) render_changes.root = /*root*/ ctx[3]; 5386 if (dirty & /*target*/ 16) render_changes.target = /*target*/ ctx[4]; 5387 if (dirty & /*theme_mode*/ 32) render_changes.theme_mode = /*theme_mode*/ ctx[5]; 5388 if (dirty & /*version*/ 64) render_changes.version = /*version*/ ctx[6];
5389 if (dirty & /*autoscroll*/ 128) render_changes.autoscroll = /*autoscroll*/ ctx[7]; 5390 render.$set(render_changes); 5391 }, 5392 i(local) { 5393 if (current) return; 5394 transition_in$1(render.$$.fragment, local); 5395 current = true; 5396 }, 5397 o(local) { 5398 transition_out$1(render.$$.fragment, local); 5399 current = false; 5400 }, 5401 d(detaching) { 5402 destroy_component$1(render, detaching); 5403 } 5404 }; 5405} 5406 5407function instance$1($$self, $$props, $$invalidate) { 5408 let { rootNode } = $$props; 5409 let { dynamic_ids } = $$props; 5410 let { instance_map } = $$props; 5411 let { root } = $$props; 5412 let { target } = $$props; 5413 let { theme_mode } = $$props; 5414 let { version } = $$props; 5415 let { autoscroll } = $$props; 5416 const dispatch = createEventDispatcher(); 5417 5418 onMount(() => { 5419 dispatch("mount"); 5420 }); 5421 5422 $$self.$$set = $$props => { 5423 if ('rootNode' in $$props) $$invalidate(0, rootNode = $$props.rootNode); 5424 if ('dynamic_ids' in $$props) $$invalidate(1, dynamic_ids = $$props.dynamic_ids); 5425 if ('instance_map' in $$props) $$invalidate(2, instance_map = $$props.instance_map);
5426 if ('root' in $$props) $$invalidate(3, root = $$props.root); 5427 if ('target' in $$props) $$invalidate(4, target = $$props.target); 5428 if ('theme_mode' in $$props) $$invalidate(5, theme_mode = $$props.theme_mode); 5429 if ('version' in $$props) $$invalidate(6, version = $$props.version); 5430 if ('autoscroll' in $$props) $$invalidate(7, autoscroll = $$props.autoscroll); 5431 }; 5432 5433 return [ 5434 rootNode, 5435 dynamic_ids, 5436 instance_map, 5437 root, 5438 target, 5439 theme_mode, 5440 version, 5441 autoscroll 5442 ]; 5443} 5444 5445class MountComponents extends SvelteComponent$1 { 5446 constructor(options) { 5447 super(); 5448 5449 init$1(this, options, instance$1, create_fragment$1, safe_not_equal$1, { 5450 rootNode: 0, 5451 dynamic_ids: 1, 5452 instance_map: 2, 5453 root: 3, 5454 target: 4, 5455 theme_mode: 5, 5456 version: 6, 5457 autoscroll: 7 5458 }); 5459 } 5460} 5461 5462const logo = ""+new URL('logo-3707f936.svg', import.meta.url).href+""; 5463 5464const Blocks_svelte_svelte_type_style_lang = ''; 5465 5466/* src/Blocks.svelte generated by Svelte v4.2.2 */ 5467const { 5468 SvelteComponent, 5469 append, 5470 attr, 5471 check_outros, 5472 component_subscribe, 5473 create_component, 5474 destroy_component, 5475 detach, 5476 element, 5477 empty, 5478 globals, 5479 group_outros, 5480 init, 5481 insert, 5482 listen, 5483 mount_component, 5484 noop, 5485 safe_not_equal, 5486 set_data, 5487 set_style, 5488 space, 5489 src_url_equal, 5490 subscribe, 5491 text, 5492 transition_in, 5493 transition_out 5494} = window.__gradio__svelte__internal; 5495const { document: document_1 } = globals; 5496const { tick } = window.__gradio__svelte__internal; 5497function create_if_block_6(ctx) { 5498 document_1.title = /*title*/ ctx[3]; 5499 return { c: noop, m: noop, d: noop }; 5500} 5501 5502// (543:1) {#if analytics_enabled} 5503function create_if_block_5(ctx) { 5504 let script0; 5505 let script0_src_value; 5506 let t0; 5507 let script1; 5508 5509 return { 5510 c() { 5511 script0 = element("script"); 5512 script0.innerHTML = ``; 5513 t0 = space(); 5514 script1 = element("script"); 5515 script1.textContent = "window.dataLayer = window.dataLayer || [];\n\t\t\tfunction gtag() {\n\t\t\t\tdataLayer.push(arguments);\n\t\t\t}\n\t\t\tgtag(\"js\", new Date());\n\t\t\tgtag(\"config\", \"UA-156449732-1\", {\n\t\t\t\tcookie_flags: \"samesite=none;secure\"\n\t\t\t});"; 5516 script0.async = true; 5517 script0.defer = true; 5518 if (!src_url_equal(script0.src, script0_src_value = "https://www.googletagmanager.com/gtag/js?id=UA-156449732-1")) attr(script0, "src", script0_src_value); 5519 }, 5520 m(target, anchor) { 5521 insert(target, script0, anchor); 5522 insert(target, t0, anchor); 5523 insert(target, script1, anchor); 5524 }, 5525 d(detaching) { 5526 if (detaching) { 5527 detach(script0); 5528 detach(t0); 5529 detach(script1); 5530 } 5531 } 5532 }; 5533} 5534 5535// (564:2) {#if ready} 5536function create_if_block_4(ctx) { 5537 let mountcomponents; 5538 let current; 5539 5540 mountcomponents = new MountComponents({ 5541 props: { 5542 rootNode: /*rootNode*/ ctx[16], 5543 dynamic_ids: /*dynamic_ids*/ ctx[18], 5544 instance_map: /*instance_map*/ ctx[19], 5545 root: /*root*/ ctx[1], 5546 target: /*target*/ ctx[5], 5547 theme_mode: /*theme_mode*/ ctx[11], 5548 version: /*version*/ ctx[14], 5549 autoscroll: /*autoscroll*/ ctx[6] 5550 } 5551 }); 5552 5553 mountcomponents.$on("mount", /*handle_mount*/ ctx[24]); 5554 mountcomponents.$on("destroy", /*destroy_handler*/ ctx[32]); 5555 5556 return { 5557 c() { 5558 create_component(mountcomponents.$$.fragment); 5559 }, 5560 m(target, anchor) { 5561 mount_component(mountcomponents, target, anchor); 5562 current = true; 5563 }, 5564 p(ctx, dirty) { 5565 const mountcomponents_changes = {}; 5566 if (dirty[0] & /*rootNode*/ 65536) mountcomponents_changes.rootNode = /*rootNode*/ ctx[16]; 5567 if (dirty[0] & /*dynamic_ids*/ 262144) mountcomponents_changes.dynamic_ids = /*dynamic_ids*/ ctx[18]; 5568 if (dirty[0] & /*instance_map*/ 524288) mountcomponents_changes.instance_map = /*instance_map*/ ctx[19]; 5569 if (dirty[0] & /*root*/ 2) mountcomponents_changes.root = /*root*/ ctx[1]; 5570 if (dirty[0] & /*target*/ 32) mountcomponents_changes.target = /*target*/ ctx[5]; 5571 if (dirty[0] & /*theme_mode*/ 2048) mountcomponents_changes.theme_mode = /*theme_mode*/ ctx[11]; 5572 if (dirty[0] & /*version*/ 16384) mountcomponents_changes.version = /*version*/ ctx[14]; 5573 if (dirty[0] & /*autoscroll*/ 64) mountcomponents_changes.autoscroll = /*autoscroll*/ ctx[6];
5574 mountcomponents.$set(mountcomponents_changes); 5575 }, 5576 i(local) { 5577 if (current) return; 5578 transition_in(mountcomponents.$$.fragment, local); 5579 current = true; 5580 }, 5581 o(local) { 5582 transition_out(mountcomponents.$$.fragment, local); 5583 current = false; 5584 }, 5585 d(detaching) { 5586 destroy_component(mountcomponents, detaching); 5587 } 5588 }; 5589} 5590 5591// (580:1) {#if show_footer} 5592function create_if_block_2(ctx) { 5593 let footer; 5594 let t0; 5595 let a; 5596 let t1_value = /*$_*/ ctx[21]("common.built_with_gradio") + ""; 5597 let t1; 5598 let t2; 5599 let img; 5600 let img_src_value; 5601 let img_alt_value; 5602 let if_block = /*show_api*/ ctx[7] && create_if_block_3(ctx); 5603 5604 return { 5605 c() { 5606 footer = element("footer"); 5607 if (if_block) if_block.c(); 5608 t0 = space(); 5609 a = element("a"); 5610 t1 = text(t1_value); 5611 t2 = space(); 5612 img = element("img"); 5613 if (!src_url_equal(img.src, img_src_value = logo)) attr(img, "src", img_src_value); 5614 attr(img, "alt", img_alt_value = /*$_*/ ctx[21]("common.logo")); 5615 attr(img, "class", "svelte-16bt5n8"); 5616 attr(a, "href", "https://gradio.app");
5617 attr(a, "class", "built-with svelte-16bt5n8"); 5618 attr(a, "target", "_blank"); 5619 attr(a, "rel", "noreferrer"); 5620 attr(footer, "class", "svelte-16bt5n8"); 5621 }, 5622 m(target, anchor) { 5623 insert(target, footer, anchor); 5624 if (if_block) if_block.m(footer, null); 5625 append(footer, t0); 5626 append(footer, a); 5627 append(a, t1); 5628 append(a, t2); 5629 append(a, img); 5630 }, 5631 p(ctx, dirty) { 5632 if (/*show_api*/ ctx[7]) { 5633 if (if_block) { 5634 if_block.p(ctx, dirty); 5635 } else { 5636 if_block = create_if_block_3(ctx); 5637 if_block.c(); 5638 if_block.m(footer, t0); 5639 } 5640 } else if (if_block) { 5641 if_block.d(1); 5642 if_block = null; 5643 } 5644 5645 if (dirty[0] & /*$_*/ 2097152 && t1_value !== (t1_value = /*$_*/ ctx[21]("common.built_with_gradio") + "")) set_data(t1, t1_value); 5646 5647 if (dirty[0] & /*$_*/ 2097152 && img_alt_value !== (img_alt_value = /*$_*/ ctx[21]("common.logo"))) { 5648 attr(img, "alt", img_alt_value); 5649 } 5650 }, 5651 d(detaching) { 5652 if (detaching) { 5653 detach(footer); 5654 } 5655 5656 if (if_block) if_block.d(); 5657 } 5658 }; 5659} 5660 5661// (582:3) {#if show_api} 5662function create_if_block_3(ctx) { 5663 let button; 5664 let t0_value = /*$_*/ ctx[21]("errors.use_via_api") + ""; 5665 let t0; 5666 let t1; 5667 let img; 5668 let img_src_value; 5669 let img_alt_value; 5670 let t2; 5671 let div; 5672 let mounted; 5673 let dispose; 5674 5675 return { 5676 c() { 5677 button = element("button"); 5678 t0 = text(t0_value); 5679 t1 = space(); 5680 img = element("img"); 5681 t2 = space(); 5682 div = element("div"); 5683 div.textContent = "·"; 5684 if (!src_url_equal(img.src, img_src_value = api_logo)) attr(img, "src", img_src_value); 5685 attr(img, "alt", img_alt_value = /*$_*/ ctx[21]("common.logo")); 5686 attr(img, "class", "svelte-16bt5n8"); 5687 attr(button, "class", "show-api svelte-16bt5n8"); 5688 attr(div, "class", "svelte-16bt5n8"); 5689 }, 5690 m(target, anchor) { 5691 insert(target, button, anchor); 5692 append(button, t0); 5693 append(button, t1); 5694 append(button, img); 5695 insert(target, t2, anchor); 5696 insert(target, div, anchor); 5697 5698 if (!mounted) { 5699 dispose = listen(button, "click", /*click_handler*/ ctx[33]); 5700 mounted = true; 5701 } 5702 }, 5703 p(ctx, dirty) { 5704 if (dirty[0] & /*$_*/ 2097152 && t0_value !== (t0_value = /*$_*/ ctx[21]("errors.use_via_api") + "")) set_data(t0, t0_value); 5705 5706 if (dirty[0] & /*$_*/ 2097152 && img_alt_value !== (img_alt_value = /*$_*/ ctx[21]("common.logo"))) { 5707 attr(img, "alt", img_alt_value); 5708 } 5709 }, 5710 d(detaching) { 5711 if (detaching) { 5712 detach(button); 5713 detach(t2); 5714 detach(div); 5715 } 5716 5717 mounted = false; 5718 dispose(); 5719 } 5720 }; 5721} 5722 5723// (607:0) {#if api_docs_visible && ready} 5724function create_if_block_1(ctx) { 5725 let div2; 5726 let div0; 5727 let t; 5728 let div1; 5729 let apidocs; 5730 let current; 5731 let mounted; 5732 let dispose; 5733 5734 apidocs = new ApiDocs({ 5735 props: { 5736 instance_map: /*instance_map*/ ctx[19], 5737 dependencies: /*dependencies*/ ctx[2], 5738 root: /*root*/ ctx[1], 5739 app: /*app*/ ctx[12], 5740 space_id: /*space_id*/ ctx[13] 5741 } 5742 }); 5743 5744 apidocs.$on("close", /*close_handler*/ ctx[35]); 5745 5746 return { 5747 c() { 5748 div2 = element("div"); 5749 div0 = element("div"); 5750 t = space(); 5751 div1 = element("div"); 5752 create_component(apidocs.$$.fragment); 5753 attr(div0, "class", "backdrop svelte-16bt5n8"); 5754 attr(div1, "class", "api-docs-wrap svelte-16bt5n8"); 5755 attr(div2, "class", "api-docs svelte-16bt5n8"); 5756 }, 5757 m(target, anchor) { 5758 insert(target, div2, anchor); 5759 append(div2, div0); 5760 append(div2, t); 5761 append(div2, div1); 5762 mount_component(apidocs, div1, null); 5763 current = true; 5764 5765 if (!mounted) { 5766 dispose = listen(div0, "click", /*click_handler_1*/ ctx[34]); 5767 mounted = true; 5768 } 5769 }, 5770 p(ctx, dirty) { 5771 const apidocs_changes = {}; 5772 if (dirty[0] & /*instance_map*/ 524288) apidocs_changes.instance_map = /*instance_map*/ ctx[19]; 5773 if (dirty[0] & /*dependencies*/ 4) apidocs_changes.dependencies = /*dependencies*/ ctx[2]; 5774 if (dirty[0] & /*root*/ 2) apidocs_changes.root = /*root*/ ctx[1]; 5775 if (dirty[0] & /*app*/ 4096) apidocs_changes.app = /*app*/ ctx[12]; 5776 if (dirty[0] & /*space_id*/ 8192) apidocs_changes.space_id = /*space_id*/ ctx[13]; 5777 apidocs.$set(apidocs_changes); 5778 }, 5779 i(local) { 5780 if (current) return; 5781 transition_in(apidocs.$$.fragment, local); 5782 current = true; 5783 }, 5784 o(local) { 5785 transition_out(apidocs.$$.fragment, local); 5786 current = false;
5787 }, 5788 d(detaching) { 5789 if (detaching) { 5790 detach(div2); 5791 } 5792 5793 destroy_component(apidocs); 5794 mounted = false; 5795 dispose(); 5796 } 5797 }; 5798} 5799 5800// (633:0) {#if messages} 5801function create_if_block(ctx) { 5802 let toast; 5803 let current; 5804 5805 toast = new Toast({ 5806 props: { messages: /*messages*/ ctx[20] } 5807 }); 5808 5809 toast.$on("close", /*handle_error_close*/ ctx[23]); 5810 5811 return { 5812 c() { 5813 create_component(toast.$$.fragment); 5814 }, 5815 m(target, anchor) { 5816 mount_component(toast, target, anchor); 5817 current = true; 5818 }, 5819 p(ctx, dirty) { 5820 const toast_changes = {}; 5821 if (dirty[0] & /*messages*/ 1048576) toast_changes.messages = /*messages*/ ctx[20]; 5822 toast.$set(toast_changes); 5823 }, 5824 i(local) { 5825 if (current) return; 5826 transition_in(toast.$$.fragment, local); 5827 current = true; 5828 }, 5829 o(local) { 5830 transition_out(toast.$$.fragment, local); 5831 current = false; 5832 }, 5833 d(detaching) { 5834 destroy_component(toast, detaching); 5835 } 5836 }; 5837} 5838 5839function create_fragment(ctx) { 5840 let if_block0_anchor; 5841 let if_block1_anchor; 5842 let t0; 5843 let div1; 5844 let div0; 5845 let t1; 5846 let t2; 5847 let t3; 5848 let if_block5_anchor; 5849 let current; 5850 let if_block0 = /*control_page_title*/ ctx[9] && create_if_block_6(ctx); 5851 let if_block1 = /*analytics_enabled*/ ctx[4] && create_if_block_5(); 5852 let if_block2 = /*ready*/ ctx[0] && create_if_block_4(ctx); 5853 let if_block3 = /*show_footer*/ ctx[8] && create_if_block_2(ctx); 5854 let if_block4 = /*api_docs_visible*/ ctx[17] && /*ready*/ ctx[0] && create_if_block_1(ctx); 5855 let if_block5 = /*messages*/ ctx[20] && create_if_block(ctx); 5856 5857 return { 5858 c() { 5859 if (if_block0) if_block0.c(); 5860 if_block0_anchor = empty(); 5861 if (if_block1) if_block1.c(); 5862 if_block1_anchor = empty(); 5863 t0 = space(); 5864 div1 = element("div"); 5865 div0 = element("div"); 5866 if (if_block2) if_block2.c(); 5867 t1 = space(); 5868 if (if_block3) if_block3.c(); 5869 t2 = space(); 5870 if (if_block4) if_block4.c(); 5871 t3 = space(); 5872 if (if_block5) if_block5.c(); 5873 if_block5_anchor = empty(); 5874 attr(div0, "class", "contain svelte-16bt5n8"); 5875 set_style(div0, "flex-grow", /*app_mode*/ ctx[10] ? "1" : "auto"); 5876 attr(div1, "class", "wrap svelte-16bt5n8"); 5877 set_style(div1, "min-height", /*app_mode*/ ctx[10] ? "100%" : "auto"); 5878 }, 5879 m(target, anchor) { 5880 if (if_block0) if_block0.m(document_1.head, null); 5881 append(document_1.head, if_block0_anchor); 5882 if (if_block1) if_block1.m(document_1.head, null); 5883 append(document_1.head, if_block1_anchor); 5884 insert(target, t0, anchor); 5885 insert(target, div1, anchor); 5886 append(div1, div0); 5887 if (if_block2) if_block2.m(div0, null); 5888 append(div1, t1); 5889 if (if_block3) if_block3.m(div1, null); 5890 insert(target, t2, anchor); 5891 if (if_block4) if_block4.m(target, anchor); 5892 insert(target, t3, anchor); 5893 if (if_block5) if_block5.m(target, anchor); 5894 insert(target, if_block5_anchor, anchor); 5895 current = true; 5896 }, 5897 p(ctx, dirty) { 5898 if (/*control_page_title*/ ctx[9]) { 5899 if (if_block0) ; else { 5900 if_block0 = create_if_block_6(ctx); 5901 if_block0.c(); 5902 if_block0.m(if_block0_anchor.parentNode, if_block0_anchor); 5903 } 5904 } else if (if_block0) { 5905 if_block0.d(1); 5906 if_block0 = null; 5907 } 5908 5909 if (/*analytics_enabled*/ ctx[4]) { 5910 if (if_block1) ; else { 5911 if_block1 = create_if_block_5(); 5912 if_block1.c(); 5913 if_block1.m(if_block1_anchor.parentNode, if_block1_anchor); 5914 } 5915 } else if (if_block1) { 5916 if_block1.d(1); 5917 if_block1 = null; 5918 } 5919 5920 if (/*ready*/ ctx[0]) { 5921 if (if_block2) { 5922 if_block2.p(ctx, dirty); 5923 5924 if (dirty[0] & /*ready*/ 1) { 5925 transition_in(if_block2, 1); 5926 } 5927 } else { 5928 if_block2 = create_if_block_4(ctx); 5929 if_block2.c(); 5930 transition_in(if_block2, 1); 5931 if_block2.m(div0, null); 5932 } 5933 } else if (if_block2) { 5934 group_outros(); 5935 5936 transition_out(if_block2, 1, 1, () => { 5937 if_block2 = null; 5938 }); 5939 5940 check_outros(); 5941 } 5942 5943 if (dirty[0] & /*app_mode*/ 1024) { 5944 set_style(div0, "flex-grow", /*app_mode*/ ctx[10] ? "1" : "auto"); 5945 } 5946 5947 if (/*show_footer*/ ctx[8]) { 5948 if (if_block3) { 5949 if_block3.p(ctx, dirty); 5950 } else { 5951 if_block3 = create_if_block_2(ctx); 5952 if_block3.c(); 5953 if_block3.m(div1, null); 5954 } 5955 } else if (if_block3) { 5956 if_block3.d(1); 5957 if_block3 = null; 5958 } 5959
5960 if (dirty[0] & /*app_mode*/ 1024) { 5961 set_style(div1, "min-height", /*app_mode*/ ctx[10] ? "100%" : "auto"); 5962 } 5963 5964 if (/*api_docs_visible*/ ctx[17] && /*ready*/ ctx[0]) { 5965 if (if_block4) { 5966 if_block4.p(ctx, dirty); 5967 5968 if (dirty[0] & /*api_docs_visible, ready*/ 131073) { 5969 transition_in(if_block4, 1); 5970 } 5971 } else { 5972 if_block4 = create_if_block_1(ctx); 5973 if_block4.c(); 5974 transition_in(if_block4, 1); 5975 if_block4.m(t3.parentNode, t3); 5976 } 5977 } else if (if_block4) { 5978 group_outros(); 5979 5980 transition_out(if_block4, 1, 1, () => { 5981 if_block4 = null; 5982 }); 5983 5984 check_outros(); 5985 } 5986 5987 if (/*messages*/ ctx[20]) { 5988 if (if_block5) { 5989 if_block5.p(ctx, dirty); 5990 5991 if (dirty[0] & /*messages*/ 1048576) { 5992 transition_in(if_block5, 1); 5993 } 5994 } else { 5995 if_block5 = create_if_block(ctx); 5996 if_block5.c(); 5997 transition_in(if_block5, 1); 5998 if_block5.m(if_block5_anchor.parentNode, if_block5_anchor); 5999 } 6000 } else if (if_block5) { 6001 group_outros(); 6002 6003 transition_out(if_block5, 1, 1, () => { 6004 if_block5 = null; 6005 }); 6006 6007 check_outros(); 6008 } 6009 }, 6010 i(local) { 6011 if (current) return; 6012 transition_in(if_block2); 6013 transition_in(if_block4); 6014 transition_in(if_block5); 6015 current = true; 6016 }, 6017 o(local) { 6018 transition_out(if_block2); 6019 transition_out(if_block4); 6020 transition_out(if_block5); 6021 current = false; 6022 }, 6023 d(detaching) { 6024 if (detaching) { 6025 detach(t0); 6026 detach(div1); 6027 detach(t2); 6028 detach(t3); 6029 detach(if_block5_anchor); 6030 } 6031 6032 if (if_block0) if_block0.d(detaching); 6033 detach(if_block0_anchor); 6034 if (if_block1) if_block1.d(detaching); 6035 detach(if_block1_anchor); 6036 if (if_block2) if_block2.d(); 6037 if (if_block3) if_block3.d(); 6038 if (if_block4) if_block4.d(detaching); 6039 if (if_block5) if_block5.d(detaching); 6040 } 6041 }; 6042} 6043 6044const MESSAGE_QUOTE_RE = /^'([^]+)'$/; 6045const SHOW_DUPLICATE_MESSAGE_ON_ETA = 15; 6046const SHOW_MOBILE_QUEUE_WARNING_ON_ETA = 10; 6047 6048function is_dep(id, type, deps) { 6049 for (const dep of deps) { 6050 for (const dep_item of dep[type]) { 6051 if (dep_item === id) return true; 6052 } 6053 } 6054 6055 return false; 6056} 6057 6058function has_no_default_value(value) { 6059 return Array.isArray(value) && value.length === 0 || value === "" || value === 0 || !value; 6060} 6061 6062function throttle(func, limit) { 6063 let lastFunc; 6064 let lastRan; 6065 let lastThis; 6066 let lastArgs; 6067 6068 return function (...args) { 6069 if (!lastRan) { 6070 func.apply(this, args); 6071 lastRan = Date.now(); 6072 } else { 6073 clearTimeout(lastFunc); 6074 lastThis = this; 6075 lastArgs = arguments; 6076 6077 lastFunc = setTimeout( 6078 () => { 6079 if (Date.now() - lastRan >= limit) { 6080 if (lastArgs) { 6081 func.apply(lastThis, Array.prototype.slice.call(lastArgs)); 6082 } 6083 6084 lastRan = Date.now(); 6085 } 6086 }, 6087 Math.max(limit - (Date.now() - lastRan), 0) 6088 ); 6089 } 6090 }; 6091} 6092 6093function get_data(comp) { 6094 if (comp.instance.get_value) { 6095 return comp.instance.get_value(); 6096 } 6097 6098 return comp.props.value; 6099} 6100 6101function isCustomEvent(event) { 6102 return "detail" in event; 6103} 6104 6105function instance($$self, $$props, $$invalidate) { 6106 let $loading_status, 6107 $$unsubscribe_loading_status = noop,
6108 $$subscribe_loading_status = () => ($$unsubscribe_loading_status(), $$unsubscribe_loading_status = subscribe(loading_status, $$value => $$invalidate(31, $loading_status = $$value)), loading_status); 6109 6110 let $_; 6111 component_subscribe($$self, $format, $$value => $$invalidate(21, $_ = $$value)); 6112 $$self.$$.on_destroy.push(() => $$unsubscribe_loading_status()); 6113 setupi18n(); 6114 let { root } = $$props; 6115 let { components } = $$props; 6116 let { layout } = $$props; 6117 let { dependencies } = $$props; 6118 let { title = "Gradio" } = $$props; 6119 let { analytics_enabled = false } = $$props; 6120 let { target } = $$props; 6121 let { autoscroll } = $$props; 6122 let { show_api = true } = $$props; 6123 let { show_footer = true } = $$props; 6124 let { control_page_title = false } = $$props; 6125 let { app_mode } = $$props; 6126 let { theme_mode } = $$props; 6127 let { app } = $$props; 6128 let { space_id } = $$props; 6129 let { version } = $$props; 6130 let { js } = $$props; 6131 let { fill_height = false } = $$props; 6132 let loading_status = create_loading_status_store(); 6133 $$subscribe_loading_status(); 6134 6135 let rootNode = { 6136 id: layout.id, 6137 type: "column", 6138 props: { 6139 interactive: false, 6140 scale: fill_height ? 1 : null 6141 }, 6142 has_modes: false, 6143 instance: null, 6144 component: null, 6145 component_class_id: "" 6146 }; 6147 6148 const AsyncFunction = Object.getPrototypeOf(async function () { 6149 6150 }).constructor; 6151 6152 dependencies.forEach(d => { 6153 if (d.js) { 6154 const wrap = d.backend_fn 6155 ? d.inputs.length === 1 6156 : d.outputs.length === 1; 6157 6158 try { 6159 d.frontend_fn = new AsyncFunction("__fn_args", 6160 `let result = await (${d.js})(...__fn_args); 6161 return (${wrap} && !Array.isArray(result)) ? [result] : result;`); 6162 } catch(e) { 6163 console.error("Could not parse custom js method."); 6164 console.error(e); 6165 } 6166 } 6167 }); 6168 6169 let params = new URLSearchParams(window.location.search); 6170 let api_docs_visible = params.get("view") === "api" && show_api; 6171 6172 function set_api_docs_visible(visible) { 6173 $$invalidate(17, api_docs_visible = visible); 6174 let params = new URLSearchParams(window.location.search); 6175 6176 if (visible) { 6177 params.set("view", "api"); 6178 } else { 6179 params.delete("view"); 6180 } 6181 6182 history.replaceState(null, "", "?" + params.toString()); 6183 } 6184 6185 let dynamic_ids = new Set(); 6186 let instance_map; 6187 6188 async function walk_layout(node, type_map, instance_map, component_map) { 6189 $$invalidate(0, ready = false); 6190 let instance = instance_map[node.id]; 6191 const _component = (await component_map.get(`${instance.type}_${type_map.get(node.id) || "false"}`)).component; 6192 instance.component = _component.default; 6193 6194 if (node.children) { 6195 instance.children = node.children.map(v => instance_map[v.id]); 6196 await Promise.all(node.children.map(v => walk_layout(v, type_map, instance_map, component_map))); 6197 } 6198 } 6199 6200 let { ready = false } = $$props; 6201 let { render_complete = false } = $$props; 6202 let target_map = {}; 6203 6204 function prepare_components() { 6205 target_map = dependencies.reduce( 6206 (acc, dep, i) => { 6207 dep.targets.forEach(([id, trigger]) => { 6208 if (!acc[id]) { 6209 acc[id] = {}; 6210 } 6211 6212 if (acc[id]?.[trigger]) { 6213 acc[id][trigger].push(i); 6214 } else { 6215 acc[id][trigger] = [i]; 6216 } 6217 }); 6218 6219 return acc; 6220 }, 6221 {} 6222 ); 6223 6224 $$subscribe_loading_status($$invalidate(15, loading_status = create_loading_status_store())); 6225 6226 dependencies.forEach((v, i) => { 6227 loading_status.register(i, v.inputs, v.outputs); 6228 }); 6229 6230 const _dynamic_ids = new Set(); 6231 6232 for (const comp of components) { 6233 const { id, props } = comp; 6234 const is_input = is_dep(id, "inputs", dependencies); 6235 6236 if (is_input || !is_dep(id, "outputs", dependencies) && has_no_default_value(props?.value)) { 6237 _dynamic_ids.add(id); 6238 } 6239 } 6240 6241 $$invalidate(18, dynamic_ids = _dynamic_ids); 6242 6243 const _rootNode = { 6244 id: layout.id, 6245 type: "column", 6246 props: { 6247 interactive: false, 6248 scale: fill_height ? 1 : null 6249 }, 6250 has_modes: false, 6251 instance: null, 6252 component: null, 6253 component_class_id: "" 6254 }; 6255 6256 components.push(_rootNode); 6257 const _component_set = new Set(); 6258 const __component_map = new Map(); 6259 const __type_for_id = new Map(); 6260 6261 const _instance_map = components.reduce( 6262 (acc, next) => { 6263 acc[next.id] = next; 6264 return acc; 6265 }, 6266 {} 6267 ); 6268
6269 components.forEach(c => { 6270 if (c.props.interactive === false) { 6271 c.props.interactive = false; 6272 } else if (c.props.interactive === true) { 6273 c.props.interactive = true; 6274 } else if (dynamic_ids.has(c.id)) { 6275 c.props.interactive = true; 6276 } else { 6277 c.props.interactive = false; 6278 } 6279 6280 if (c.props.server_fns) { 6281 let server = {}; 6282 6283 c.props.server_fns.forEach(fn => { 6284 server[fn] = async (...args) => { 6285 if (args.length === 1) { 6286 args = args[0]; 6287 } 6288 6289 const result = await app.component_server(c.id, fn, args); 6290 return result; 6291 }; 6292 }); 6293 6294 c.props.server = server; 6295 } 6296 6297 if (target_map[c.id]) { 6298 c.props.attached_events = Object.keys(target_map[c.id]); 6299 } 6300 6301 __type_for_id.set(c.id, c.props.interactive); 6302 6303 if (c.type === "dataset") { 6304 const example_component_map = new Map(); 6305 6306 c.props.components.forEach(name => { 6307 if (example_component_map.has(name)) { 6308 return; 6309 } 6310 6311 let _c; 6312 const matching_component = components.find(c => c.type === name); 6313 6314 if (matching_component) { 6315 _c = load_component({ 6316 api_url: root, 6317 name, 6318 id: matching_component.component_class_id, 6319 variant: "example" 6320 }); 6321 6322 example_component_map.set(name, _c); 6323 } 6324 }); 6325 6326 c.props.component_map = example_component_map; 6327 } 6328 6329 // maybe load custom 6330 const _c = load_component({ 6331 api_url: root, 6332 name: c.type, 6333 id: c.component_class_id, 6334 variant: "component" 6335 }); 6336 6337 _component_set.add(_c); 6338 __component_map.set(`${c.type}_${c.props.interactive}`, _c); 6339 }); 6340 6341 Promise.all(Array.from(_component_set)).then(() => { 6342 walk_layout(layout, __type_for_id, _instance_map, __component_map).then(async () => { 6343 $$invalidate(0, ready = true); 6344 $$invalidate(19, instance_map = _instance_map); 6345 $$invalidate(16, rootNode = _rootNode); 6346 }).catch(e => { 6347 console.error(e); 6348 }); 6349 }); 6350 } 6351 6352 const refresh = throttle( 6353 () => { 6354 $$invalidate(16, rootNode); 6355 }, 6356 50 6357 ); 6358 6359 async function handle_update(data, fn_index) { 6360 const outputs = dependencies[fn_index].outputs; 6361 6362 data?.forEach((value, i) => { 6363 const output = instance_map[outputs[i]]; 6364 output.props.value_is_output = true; 6365 }); 6366 6367 refresh(); 6368 await tick(); 6369 6370 data?.forEach((value, i) => { 6371 const output = instance_map[outputs[i]]; 6372 6373 if (typeof value === "object" && value !== null && value.__type__ === "update") { 6374 for (const [update_key, update_value] of Object.entries(value)) { 6375 if (update_key === "__type__") { 6376 continue; 6377 } else { 6378 output.props[update_key] = update_value; 6379 } 6380 } 6381 } else { 6382 output.props.value = value; 6383 } 6384 }); 6385 6386 refresh(); 6387 } 6388 6389 let submit_map = new Map(); 6390 6391 function set_prop(obj, prop, val) { 6392 if (!obj?.props) { 6393 // @ts-ignore 6394 obj.props = {}; 6395 } 6396 6397 obj.props[prop] = val; 6398 refresh(); 6399 } 6400 6401 let handled_dependencies = []; 6402 let messages = []; 6403 6404 function new_message(message, fn_index, type) { 6405 return { message, fn_index, type, id: ++_error_id }; 6406 } 6407 6408 let _error_id = -1; 6409 let user_left_page = false; 6410 6411 document.addEventListener("visibilitychange", function () { 6412 if (document.visibilityState === "hidden") { 6413 user_left_page = true; 6414 } 6415 }); 6416 6417 const DUPLICATE_MESSAGE = $_("blocks.long_requests_queue"); 6418 const MOBILE_QUEUE_WARNING = $_("blocks.connection_can_break"); 6419 const MOBILE_RECONNECT_MESSAGE = $_("blocks.lost_connection"); 6420 const is_mobile_device = (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i).test(navigator.userAgent); 6421 let showed_duplicate_message = false; 6422 let showed_mobile_warning = false; 6423 6424 async function trigger_api_call(dep_index, trigger_id = null, event_data = null) { 6425 let dep = dependencies[dep_index]; 6426 const current_status = loading_status.get_status_for_fn(dep_index); 6427 $$invalidate(20, messages = messages.filter(({ fn_index }) => fn_index !== dep_index)); 6428 6429 if (dep.cancels) { 6430 await Promise.all(dep.cancels.map(async fn_index => { 6431 const submission = submit_map.get(fn_index); 6432 submission?.cancel(); 6433 return submission; 6434 })); 6435 } 6436 6437 if (current_status === "pending" || current_status === "generating") { 6438 dep.pending_request = true; 6439 } 6440 6441 let payload = { 6442 fn_index: dep_index, 6443 data: await Promise.all(dep.inputs.map(id => get_data(instance_map[id]))), 6444 event_data: dep.collects_event_data ? event_data : null, 6445 trigger_id 6446 }; 6447 6448 if (dep.frontend_fn) { 6449 dep.frontend_fn(payload.data.concat(await Promise.all(dep.inputs.map(id => get_data(instance_map[id]))))).then(v => { 6450 if (dep.backend_fn) { 6451 payload.data = v; 6452 make_prediction(payload); 6453 } else { 6454 handle_update(v, dep_index); 6455 } 6456 }); 6457 } else { 6458 if (dep.backend_fn) { 6459 if (dep.trigger_mode === "once") { 6460 if (!dep.pending_request) make_prediction(payload); 6461 } else if (dep.trigger_mode === "multiple") { 6462 make_prediction(payload); 6463 } else if (dep.trigger_mode === "always_last") { 6464 if (!dep.pending_request) { 6465 make_prediction(payload); 6466 } else { 6467 dep.final_event = payload; 6468 } 6469 } 6470 } 6471 } 6472 6473 function make_prediction(payload) { 6474 const submission = app.submit(payload.fn_index, payload.data, payload.event_data, payload.trigger_id).on("data", ({ data, fn_index }) => { 6475 if (dep.pending_request && dep.final_event) { 6476 dep.pending_request = false;
6477 make_prediction(dep.final_event); 6478 } 6479 6480 dep.pending_request = false; 6481 handle_update(data, fn_index); 6482 }).on("status", ({ fn_index, ...status }) => { 6483 tick().then(() => { 6484 //@ts-ignore 6485 loading_status.update({ 6486 ...status, 6487 status: status.stage, 6488 progress: status.progress_data, 6489 fn_index 6490 }); 6491 6492 if (!showed_duplicate_message && space_id !== null && status.position !== undefined && status.position >= 2 && status.eta !== undefined && status.eta > SHOW_DUPLICATE_MESSAGE_ON_ETA) { 6493 showed_duplicate_message = true; 6494 $$invalidate(20, messages = [new_message(DUPLICATE_MESSAGE, fn_index, "warning"), ...messages]); 6495 } 6496 6497 if (!showed_mobile_warning && is_mobile_device && status.eta !== undefined && status.eta > SHOW_MOBILE_QUEUE_WARNING_ON_ETA) { 6498 showed_mobile_warning = true; 6499 $$invalidate(20, messages = [new_message(MOBILE_QUEUE_WARNING, fn_index, "warning"), ...messages]); 6500 } 6501 6502 if (status.stage === "complete") { 6503 dependencies.map(async (dep, i) => { 6504 if (dep.trigger_after === fn_index) { 6505 trigger_api_call(i, payload.trigger_id); 6506 } 6507 }); 6508 6509 submission.destroy(); 6510 } 6511 6512 if (status.broken && is_mobile_device && user_left_page) { 6513 window.setTimeout( 6514 () => { 6515 $$invalidate(20, messages = [ 6516 new_message(MOBILE_RECONNECT_MESSAGE, fn_index, "error"), 6517 ...messages 6518 ]); 6519 }, 6520 0 6521 ); 6522 6523 trigger_api_call(dep_index, payload.trigger_id, event_data); 6524 user_left_page = false; 6525 } else if (status.stage === "error") { 6526 if (status.message) { 6527 const _message = status.message.replace(MESSAGE_QUOTE_RE, (_, b) => b); 6528 $$invalidate(20, messages = [new_message(_message, fn_index, "error"), ...messages]); 6529 } 6530 6531 dependencies.map(async (dep, i) => { 6532 if (dep.trigger_after === fn_index && !dep.trigger_only_on_success) { 6533 trigger_api_call(i, payload.trigger_id); 6534 } 6535 }); 6536 6537 submission.destroy(); 6538 } 6539 }); 6540 }).on("log", ({ log, fn_index, level }) => { 6541 $$invalidate(20, messages = [new_message(log, fn_index, level), ...messages]); 6542 }); 6543 6544 submit_map.set(dep_index, submission); 6545 } 6546 } 6547 6548 function trigger_share(title, description) { 6549 if (space_id === null) { 6550 return; 6551 } 6552 6553 const discussion_url = new URL(`https://huggingface.co/spaces/${space_id}/discussions/new`); 6554 6555 if (title !== undefined && title.length > 0) { 6556 discussion_url.searchParams.set("title", title); 6557 } 6558 6559 discussion_url.searchParams.set("description", description); 6560 window.open(discussion_url.toString(), "_blank"); 6561 } 6562 6563 function handle_error_close(e) { 6564 const _id = e.detail; 6565 $$invalidate(20, messages = messages.filter(m => m.id !== _id)); 6566 } 6567 6568 const is_external_url = link => !!(link && new URL(link, location.href).origin !== location.origin); 6569 6570 async function handle_mount() { 6571 if (js) { 6572 let blocks_frontend_fn = new AsyncFunction(`let result = await (${js})(); 6573 return (!Array.isArray(result)) ? [result] : result;`); 6574 6575 blocks_frontend_fn(); 6576 } 6577 6578 await tick(); 6579 var a = target.getElementsByTagName("a"); 6580 6581 for (var i = 0; i < a.length; i++) { 6582 const _target = a[i].getAttribute("target"); 6583 const _link = a[i].getAttribute("href"); 6584 6585 // only target anchor tags with external links 6586 if (is_external_url(_link) && _target !== "_blank") a[i].setAttribute("target", "_blank"); 6587 } 6588 6589 // handle load triggers 6590 dependencies.forEach((dep, i) => { 6591 if (dep.targets[0][1] === "load") { 6592 trigger_api_call(i); 6593 } 6594 }); 6595 6596 if (render_complete) return; 6597 6598 target.addEventListener("gradio", e => { 6599 if (!isCustomEvent(e)) throw new Error("not a custom event"); 6600 const { id, event, data } = e.detail; 6601 6602 if (event === "share") { 6603 const { title, description } = data; 6604 trigger_share(title, description); 6605 } else if (event === "error" || event === "warning") { 6606 $$invalidate(20, messages = [new_message(data, -1, event), ...messages]); 6607 } else { 6608 const deps = target_map[id]?.[event]; 6609 6610 deps?.forEach(dep_id => { 6611 trigger_api_call(dep_id, id, data); 6612 }); 6613 } 6614 }); 6615
6616 $$invalidate(26, render_complete = true); 6617 } 6618 6619 function handle_destroy(id) { 6620 handled_dependencies = handled_dependencies.map(dep => { 6621 return dep.filter(_id => _id !== id); 6622 }); 6623 } 6624 6625 function set_status(statuses) { 6626 for (const id in statuses) { 6627 let loading_status = statuses[id]; 6628 let dependency = dependencies[loading_status.fn_index]; 6629 loading_status.scroll_to_output = dependency.scroll_to_output; 6630 loading_status.show_progress = dependency.show_progress; 6631 set_prop(instance_map[id], "loading_status", loading_status); 6632 } 6633 6634 const inputs_to_update = loading_status.get_inputs_to_update(); 6635 6636 for (const [id, pending_status] of inputs_to_update) { 6637 set_prop(instance_map[id], "pending", pending_status === "pending"); 6638 } 6639 } 6640 6641 const destroy_handler = ({ detail }) => handle_destroy(detail); 6642 6643 const click_handler = () => { 6644 set_api_docs_visible(!api_docs_visible); 6645 }; 6646 6647 const click_handler_1 = () => { 6648 set_api_docs_visible(false); 6649 }; 6650 6651 const close_handler = () => { 6652 set_api_docs_visible(false); 6653 }; 6654 6655 $$self.$$set = $$props => {
6656 if ('root' in $$props) $$invalidate(1, root = $$props.root); 6657 if ('components' in $$props) $$invalidate(27, components = $$props.components); 6658 if ('layout' in $$props) $$invalidate(28, layout = $$props.layout); 6659 if ('dependencies' in $$props) $$invalidate(2, dependencies = $$props.dependencies); 6660 if ('title' in $$props) $$invalidate(3, title = $$props.title); 6661 if ('analytics_enabled' in $$props) $$invalidate(4, analytics_enabled = $$props.analytics_enabled); 6662 if ('target' in $$props) $$invalidate(5, target = $$props.target); 6663 if ('autoscroll' in $$props) $$invalidate(6, autoscroll = $$props.autoscroll); 6664 if ('show_api' in $$props) $$invalidate(7, show_api = $$props.show_api); 6665 if ('show_footer' in $$props) $$invalidate(8, show_footer = $$props.show_footer); 6666 if ('control_page_title' in $$props) $$invalidate(9, control_page_title = $$props.control_page_title); 6667 if ('app_mode' in $$props) $$invalidate(10, app_mode = $$props.app_mode); 6668 if ('theme_mode' in $$props) $$invalidate(11, theme_mode = $$props.theme_mode);
6669 if ('app' in $$props) $$invalidate(12, app = $$props.app); 6670 if ('space_id' in $$props) $$invalidate(13, space_id = $$props.space_id); 6671 if ('version' in $$props) $$invalidate(14, version = $$props.version); 6672 if ('js' in $$props) $$invalidate(29, js = $$props.js); 6673 if ('fill_height' in $$props) $$invalidate(30, fill_height = $$props.fill_height); 6674 if ('ready' in $$props) $$invalidate(0, ready = $$props.ready); 6675 if ('render_complete' in $$props) $$invalidate(26, render_complete = $$props.render_complete); 6676 }; 6677 6678 $$self.$$.update = () => { 6679 if ($$self.$$.dirty[0] & /*components, layout*/ 402653184) { 6680 (prepare_components()); 6681 } 6682 6683 if ($$self.$$.dirty[1] & /*$loading_status*/ 1) { 6684 set_status($loading_status); 6685 } 6686 }; 6687 6688 return [ 6689 ready, 6690 root, 6691 dependencies, 6692 title, 6693 analytics_enabled, 6694 target, 6695 autoscroll, 6696 show_api, 6697 show_footer, 6698 control_page_title, 6699 app_mode, 6700 theme_mode, 6701 app, 6702 space_id, 6703 version, 6704 loading_status, 6705 rootNode, 6706 api_docs_visible, 6707 dynamic_ids, 6708 instance_map, 6709 messages, 6710 $_, 6711 set_api_docs_visible, 6712 handle_error_close, 6713 handle_mount, 6714 handle_destroy, 6715 render_complete, 6716 components, 6717 layout, 6718 js, 6719 fill_height, 6720 $loading_status, 6721 destroy_handler, 6722 click_handler, 6723 click_handler_1, 6724 close_handler 6725 ]; 6726} 6727 6728class Blocks extends SvelteComponent { 6729 constructor(options) { 6730 super(); 6731 6732 init( 6733 this, 6734 options, 6735 instance, 6736 create_fragment, 6737 safe_not_equal, 6738 { 6739 root: 1, 6740 components: 27, 6741 layout: 28, 6742 dependencies: 2, 6743 title: 3, 6744 analytics_enabled: 4, 6745 target: 5, 6746 autoscroll: 6, 6747 show_api: 7, 6748 show_footer: 8, 6749 control_page_title: 9, 6750 app_mode: 10, 6751 theme_mode: 11, 6752 app: 12, 6753 space_id: 13, 6754 version: 14, 6755 js: 29, 6756 fill_height: 30, 6757 ready: 0, 6758 render_complete: 26 6759 }, 6760 null, 6761 [-1, -1] 6762 ); 6763 } 6764} 6765 6766const Blocks$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 6767 __proto__: null, 6768 default: Blocks 6769}, Symbol.toStringTag, { value: 'Module' })); 6770 6771export { Blocks$1 as B, Toast as T }; 6772//# sourceMappingURL=Blocks-38260f5a.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.