diff --git "a/src/backend/gradio_carousel/templates/component/index.js" "b/src/backend/gradio_carousel/templates/component/index.js" new file mode 100644--- /dev/null +++ "b/src/backend/gradio_carousel/templates/component/index.js" @@ -0,0 +1,12099 @@ +const { + SvelteComponent: ra, + assign: ia, + create_slot: oa, + detach: la, + element: sa, + get_all_dirty_from_scope: aa, + get_slot_changes: ua, + get_spread_update: fa, + init: ca, + insert: da, + safe_not_equal: _a, + set_dynamic_element_data: Mi, + set_style: Pe, + toggle_class: ot, + transition_in: Il, + transition_out: Ll, + update_slot_base: ha +} = window.__gradio__svelte__internal; +function ma(e) { + let t, n, r; + const i = ( + /*#slots*/ + e[18].default + ), o = oa( + i, + e, + /*$$scope*/ + e[17], + null + ); + let l = [ + { "data-testid": ( + /*test_id*/ + e[7] + ) }, + { id: ( + /*elem_id*/ + e[2] + ) }, + { + class: n = "block " + /*elem_classes*/ + e[3].join(" ") + " svelte-1t38q2d" + } + ], u = {}; + for (let s = 0; s < l.length; s += 1) + u = ia(u, l[s]); + return { + c() { + t = sa( + /*tag*/ + e[14] + ), o && o.c(), Mi( + /*tag*/ + e[14] + )(t, u), ot( + t, + "hidden", + /*visible*/ + e[10] === !1 + ), ot( + t, + "padded", + /*padding*/ + e[6] + ), ot( + t, + "border_focus", + /*border_mode*/ + e[5] === "focus" + ), ot(t, "hide-container", !/*explicit_call*/ + e[8] && !/*container*/ + e[9]), Pe( + t, + "height", + /*get_dimension*/ + e[15]( + /*height*/ + e[0] + ) + ), Pe(t, "width", typeof /*width*/ + e[1] == "number" ? `calc(min(${/*width*/ + e[1]}px, 100%))` : ( + /*get_dimension*/ + e[15]( + /*width*/ + e[1] + ) + )), Pe( + t, + "border-style", + /*variant*/ + e[4] + ), Pe( + t, + "overflow", + /*allow_overflow*/ + e[11] ? "visible" : "hidden" + ), Pe( + t, + "flex-grow", + /*scale*/ + e[12] + ), Pe(t, "min-width", `calc(min(${/*min_width*/ + e[13]}px, 100%))`), Pe(t, "border-width", "var(--block-border-width)"); + }, + m(s, a) { + da(s, t, a), o && o.m(t, null), r = !0; + }, + p(s, a) { + o && o.p && (!r || a & /*$$scope*/ + 131072) && ha( + o, + i, + s, + /*$$scope*/ + s[17], + r ? ua( + i, + /*$$scope*/ + s[17], + a, + null + ) : aa( + /*$$scope*/ + s[17] + ), + null + ), Mi( + /*tag*/ + s[14] + )(t, u = fa(l, [ + (!r || a & /*test_id*/ + 128) && { "data-testid": ( + /*test_id*/ + s[7] + ) }, + (!r || a & /*elem_id*/ + 4) && { id: ( + /*elem_id*/ + s[2] + ) }, + (!r || a & /*elem_classes*/ + 8 && n !== (n = "block " + /*elem_classes*/ + s[3].join(" ") + " svelte-1t38q2d")) && { class: n } + ])), ot( + t, + "hidden", + /*visible*/ + s[10] === !1 + ), ot( + t, + "padded", + /*padding*/ + s[6] + ), ot( + t, + "border_focus", + /*border_mode*/ + s[5] === "focus" + ), ot(t, "hide-container", !/*explicit_call*/ + s[8] && !/*container*/ + s[9]), a & /*height*/ + 1 && Pe( + t, + "height", + /*get_dimension*/ + s[15]( + /*height*/ + s[0] + ) + ), a & /*width*/ + 2 && Pe(t, "width", typeof /*width*/ + s[1] == "number" ? `calc(min(${/*width*/ + s[1]}px, 100%))` : ( + /*get_dimension*/ + s[15]( + /*width*/ + s[1] + ) + )), a & /*variant*/ + 16 && Pe( + t, + "border-style", + /*variant*/ + s[4] + ), a & /*allow_overflow*/ + 2048 && Pe( + t, + "overflow", + /*allow_overflow*/ + s[11] ? "visible" : "hidden" + ), a & /*scale*/ + 4096 && Pe( + t, + "flex-grow", + /*scale*/ + s[12] + ), a & /*min_width*/ + 8192 && Pe(t, "min-width", `calc(min(${/*min_width*/ + s[13]}px, 100%))`); + }, + i(s) { + r || (Il(o, s), r = !0); + }, + o(s) { + Ll(o, s), r = !1; + }, + d(s) { + s && la(t), o && o.d(s); + } + }; +} +function pa(e) { + let t, n = ( + /*tag*/ + e[14] && ma(e) + ); + return { + c() { + n && n.c(); + }, + m(r, i) { + n && n.m(r, i), t = !0; + }, + p(r, [i]) { + /*tag*/ + r[14] && n.p(r, i); + }, + i(r) { + t || (Il(n, r), t = !0); + }, + o(r) { + Ll(n, r), t = !1; + }, + d(r) { + n && n.d(r); + } + }; +} +function ga(e, t, n) { + let { $$slots: r = {}, $$scope: i } = t, { height: o = void 0 } = t, { width: l = void 0 } = t, { elem_id: u = "" } = t, { elem_classes: s = [] } = t, { variant: a = "solid" } = t, { border_mode: f = "base" } = t, { padding: d = !0 } = t, { type: c = "normal" } = t, { test_id: h = void 0 } = t, { explicit_call: _ = !1 } = t, { container: m = !0 } = t, { visible: g = !0 } = t, { allow_overflow: p = !0 } = t, { scale: v = null } = t, { min_width: b = 0 } = t, w = c === "fieldset" ? "fieldset" : "div"; + const y = (S) => { + if (S !== void 0) { + if (typeof S == "number") + return S + "px"; + if (typeof S == "string") + return S; + } + }; + return e.$$set = (S) => { + "height" in S && n(0, o = S.height), "width" in S && n(1, l = S.width), "elem_id" in S && n(2, u = S.elem_id), "elem_classes" in S && n(3, s = S.elem_classes), "variant" in S && n(4, a = S.variant), "border_mode" in S && n(5, f = S.border_mode), "padding" in S && n(6, d = S.padding), "type" in S && n(16, c = S.type), "test_id" in S && n(7, h = S.test_id), "explicit_call" in S && n(8, _ = S.explicit_call), "container" in S && n(9, m = S.container), "visible" in S && n(10, g = S.visible), "allow_overflow" in S && n(11, p = S.allow_overflow), "scale" in S && n(12, v = S.scale), "min_width" in S && n(13, b = S.min_width), "$$scope" in S && n(17, i = S.$$scope); + }, [ + o, + l, + u, + s, + a, + f, + d, + h, + _, + m, + g, + p, + v, + b, + w, + y, + c, + i, + r + ]; +} +class ba extends ra { + constructor(t) { + super(), ca(this, t, ga, pa, _a, { + height: 0, + width: 1, + elem_id: 2, + elem_classes: 3, + variant: 4, + border_mode: 5, + padding: 6, + type: 16, + test_id: 7, + explicit_call: 8, + container: 9, + visible: 10, + allow_overflow: 11, + scale: 12, + min_width: 13 + }); + } +} +const { + SvelteComponent: wa, + append: dr, + attr: Tn, + create_component: va, + destroy_component: ya, + detach: Ea, + element: Di, + init: Sa, + insert: ka, + mount_component: Ta, + safe_not_equal: Aa, + set_data: Ba, + space: Ca, + text: Ia, + toggle_class: lt, + transition_in: La, + transition_out: Pa +} = window.__gradio__svelte__internal; +function Oa(e) { + let t, n, r, i, o, l; + return r = new /*Icon*/ + e[1]({}), { + c() { + t = Di("label"), n = Di("span"), va(r.$$.fragment), i = Ca(), o = Ia( + /*label*/ + e[0] + ), Tn(n, "class", "svelte-9gxdi0"), Tn(t, "for", ""), Tn(t, "data-testid", "block-label"), Tn(t, "class", "svelte-9gxdi0"), lt(t, "hide", !/*show_label*/ + e[2]), lt(t, "sr-only", !/*show_label*/ + e[2]), lt( + t, + "float", + /*float*/ + e[4] + ), lt( + t, + "hide-label", + /*disable*/ + e[3] + ); + }, + m(u, s) { + ka(u, t, s), dr(t, n), Ta(r, n, null), dr(t, i), dr(t, o), l = !0; + }, + p(u, [s]) { + (!l || s & /*label*/ + 1) && Ba( + o, + /*label*/ + u[0] + ), (!l || s & /*show_label*/ + 4) && lt(t, "hide", !/*show_label*/ + u[2]), (!l || s & /*show_label*/ + 4) && lt(t, "sr-only", !/*show_label*/ + u[2]), (!l || s & /*float*/ + 16) && lt( + t, + "float", + /*float*/ + u[4] + ), (!l || s & /*disable*/ + 8) && lt( + t, + "hide-label", + /*disable*/ + u[3] + ); + }, + i(u) { + l || (La(r.$$.fragment, u), l = !0); + }, + o(u) { + Pa(r.$$.fragment, u), l = !1; + }, + d(u) { + u && Ea(t), ya(r); + } + }; +} +function Ha(e, t, n) { + let { label: r = null } = t, { Icon: i } = t, { show_label: o = !0 } = t, { disable: l = !1 } = t, { float: u = !0 } = t; + return e.$$set = (s) => { + "label" in s && n(0, r = s.label), "Icon" in s && n(1, i = s.Icon), "show_label" in s && n(2, o = s.show_label), "disable" in s && n(3, l = s.disable), "float" in s && n(4, u = s.float); + }, [r, i, o, l, u]; +} +class Pl extends wa { + constructor(t) { + super(), Sa(this, t, Ha, Oa, Aa, { + label: 0, + Icon: 1, + show_label: 2, + disable: 3, + float: 4 + }); + } +} +const { + SvelteComponent: Na, + append: zr, + attr: et, + bubble: Ma, + create_component: Da, + destroy_component: Ra, + detach: Ol, + element: Vr, + init: Ua, + insert: Hl, + listen: Fa, + mount_component: Ga, + safe_not_equal: qa, + set_data: ja, + set_style: An, + space: xa, + text: za, + toggle_class: Ne, + transition_in: Va, + transition_out: Xa +} = window.__gradio__svelte__internal; +function Ri(e) { + let t, n; + return { + c() { + t = Vr("span"), n = za( + /*label*/ + e[1] + ), et(t, "class", "svelte-lpi64a"); + }, + m(r, i) { + Hl(r, t, i), zr(t, n); + }, + p(r, i) { + i & /*label*/ + 2 && ja( + n, + /*label*/ + r[1] + ); + }, + d(r) { + r && Ol(t); + } + }; +} +function Wa(e) { + let t, n, r, i, o, l, u, s = ( + /*show_label*/ + e[2] && Ri(e) + ); + return i = new /*Icon*/ + e[0]({}), { + c() { + t = Vr("button"), s && s.c(), n = xa(), r = Vr("div"), Da(i.$$.fragment), et(r, "class", "svelte-lpi64a"), Ne( + r, + "small", + /*size*/ + e[4] === "small" + ), Ne( + r, + "large", + /*size*/ + e[4] === "large" + ), t.disabled = /*disabled*/ + e[7], et( + t, + "aria-label", + /*label*/ + e[1] + ), et( + t, + "aria-haspopup", + /*hasPopup*/ + e[8] + ), et( + t, + "title", + /*label*/ + e[1] + ), et(t, "class", "svelte-lpi64a"), Ne( + t, + "pending", + /*pending*/ + e[3] + ), Ne( + t, + "padded", + /*padded*/ + e[5] + ), Ne( + t, + "highlight", + /*highlight*/ + e[6] + ), Ne( + t, + "transparent", + /*transparent*/ + e[9] + ), An(t, "color", !/*disabled*/ + e[7] && /*_color*/ + e[11] ? ( + /*_color*/ + e[11] + ) : "var(--block-label-text-color)"), An(t, "--bg-color", /*disabled*/ + e[7] ? "auto" : ( + /*background*/ + e[10] + )); + }, + m(a, f) { + Hl(a, t, f), s && s.m(t, null), zr(t, n), zr(t, r), Ga(i, r, null), o = !0, l || (u = Fa( + t, + "click", + /*click_handler*/ + e[13] + ), l = !0); + }, + p(a, [f]) { + /*show_label*/ + a[2] ? s ? s.p(a, f) : (s = Ri(a), s.c(), s.m(t, n)) : s && (s.d(1), s = null), (!o || f & /*size*/ + 16) && Ne( + r, + "small", + /*size*/ + a[4] === "small" + ), (!o || f & /*size*/ + 16) && Ne( + r, + "large", + /*size*/ + a[4] === "large" + ), (!o || f & /*disabled*/ + 128) && (t.disabled = /*disabled*/ + a[7]), (!o || f & /*label*/ + 2) && et( + t, + "aria-label", + /*label*/ + a[1] + ), (!o || f & /*hasPopup*/ + 256) && et( + t, + "aria-haspopup", + /*hasPopup*/ + a[8] + ), (!o || f & /*label*/ + 2) && et( + t, + "title", + /*label*/ + a[1] + ), (!o || f & /*pending*/ + 8) && Ne( + t, + "pending", + /*pending*/ + a[3] + ), (!o || f & /*padded*/ + 32) && Ne( + t, + "padded", + /*padded*/ + a[5] + ), (!o || f & /*highlight*/ + 64) && Ne( + t, + "highlight", + /*highlight*/ + a[6] + ), (!o || f & /*transparent*/ + 512) && Ne( + t, + "transparent", + /*transparent*/ + a[9] + ), f & /*disabled, _color*/ + 2176 && An(t, "color", !/*disabled*/ + a[7] && /*_color*/ + a[11] ? ( + /*_color*/ + a[11] + ) : "var(--block-label-text-color)"), f & /*disabled, background*/ + 1152 && An(t, "--bg-color", /*disabled*/ + a[7] ? "auto" : ( + /*background*/ + a[10] + )); + }, + i(a) { + o || (Va(i.$$.fragment, a), o = !0); + }, + o(a) { + Xa(i.$$.fragment, a), o = !1; + }, + d(a) { + a && Ol(t), s && s.d(), Ra(i), l = !1, u(); + } + }; +} +function Za(e, t, n) { + let r, { Icon: i } = t, { label: o = "" } = t, { show_label: l = !1 } = t, { pending: u = !1 } = t, { size: s = "small" } = t, { padded: a = !0 } = t, { highlight: f = !1 } = t, { disabled: d = !1 } = t, { hasPopup: c = !1 } = t, { color: h = "var(--block-label-text-color)" } = t, { transparent: _ = !1 } = t, { background: m = "var(--background-fill-primary)" } = t; + function g(p) { + Ma.call(this, e, p); + } + return e.$$set = (p) => { + "Icon" in p && n(0, i = p.Icon), "label" in p && n(1, o = p.label), "show_label" in p && n(2, l = p.show_label), "pending" in p && n(3, u = p.pending), "size" in p && n(4, s = p.size), "padded" in p && n(5, a = p.padded), "highlight" in p && n(6, f = p.highlight), "disabled" in p && n(7, d = p.disabled), "hasPopup" in p && n(8, c = p.hasPopup), "color" in p && n(12, h = p.color), "transparent" in p && n(9, _ = p.transparent), "background" in p && n(10, m = p.background); + }, e.$$.update = () => { + e.$$.dirty & /*highlight, color*/ + 4160 && n(11, r = f ? "var(--color-accent)" : h); + }, [ + i, + o, + l, + u, + s, + a, + f, + d, + c, + _, + m, + r, + h, + g + ]; +} +class Jt extends Na { + constructor(t) { + super(), Ua(this, t, Za, Wa, qa, { + Icon: 0, + label: 1, + show_label: 2, + pending: 3, + size: 4, + padded: 5, + highlight: 6, + disabled: 7, + hasPopup: 8, + color: 12, + transparent: 9, + background: 10 + }); + } +} +const { + SvelteComponent: Ja, + append: Qa, + attr: _r, + binding_callbacks: Ya, + create_slot: Ka, + detach: $a, + element: Ui, + get_all_dirty_from_scope: eu, + get_slot_changes: tu, + init: nu, + insert: ru, + safe_not_equal: iu, + toggle_class: st, + transition_in: ou, + transition_out: lu, + update_slot_base: su +} = window.__gradio__svelte__internal; +function au(e) { + let t, n, r; + const i = ( + /*#slots*/ + e[5].default + ), o = Ka( + i, + e, + /*$$scope*/ + e[4], + null + ); + return { + c() { + t = Ui("div"), n = Ui("div"), o && o.c(), _r(n, "class", "icon svelte-3w3rth"), _r(t, "class", "empty svelte-3w3rth"), _r(t, "aria-label", "Empty value"), st( + t, + "small", + /*size*/ + e[0] === "small" + ), st( + t, + "large", + /*size*/ + e[0] === "large" + ), st( + t, + "unpadded_box", + /*unpadded_box*/ + e[1] + ), st( + t, + "small_parent", + /*parent_height*/ + e[3] + ); + }, + m(l, u) { + ru(l, t, u), Qa(t, n), o && o.m(n, null), e[6](t), r = !0; + }, + p(l, [u]) { + o && o.p && (!r || u & /*$$scope*/ + 16) && su( + o, + i, + l, + /*$$scope*/ + l[4], + r ? tu( + i, + /*$$scope*/ + l[4], + u, + null + ) : eu( + /*$$scope*/ + l[4] + ), + null + ), (!r || u & /*size*/ + 1) && st( + t, + "small", + /*size*/ + l[0] === "small" + ), (!r || u & /*size*/ + 1) && st( + t, + "large", + /*size*/ + l[0] === "large" + ), (!r || u & /*unpadded_box*/ + 2) && st( + t, + "unpadded_box", + /*unpadded_box*/ + l[1] + ), (!r || u & /*parent_height*/ + 8) && st( + t, + "small_parent", + /*parent_height*/ + l[3] + ); + }, + i(l) { + r || (ou(o, l), r = !0); + }, + o(l) { + lu(o, l), r = !1; + }, + d(l) { + l && $a(t), o && o.d(l), e[6](null); + } + }; +} +function uu(e) { + let t, n = e[0], r = 1; + for (; r < e.length; ) { + const i = e[r], o = e[r + 1]; + if (r += 2, (i === "optionalAccess" || i === "optionalCall") && n == null) + return; + i === "access" || i === "optionalAccess" ? (t = n, n = o(n)) : (i === "call" || i === "optionalCall") && (n = o((...l) => n.call(t, ...l)), t = void 0); + } + return n; +} +function fu(e, t, n) { + let r, { $$slots: i = {}, $$scope: o } = t, { size: l = "small" } = t, { unpadded_box: u = !1 } = t, s; + function a(d) { + if (!d) + return !1; + const { height: c } = d.getBoundingClientRect(), { height: h } = uu([ + d, + "access", + (_) => _.parentElement, + "optionalAccess", + (_) => _.getBoundingClientRect, + "call", + (_) => _() + ]) || { height: c }; + return c > h + 2; + } + function f(d) { + Ya[d ? "unshift" : "push"](() => { + s = d, n(2, s); + }); + } + return e.$$set = (d) => { + "size" in d && n(0, l = d.size), "unpadded_box" in d && n(1, u = d.unpadded_box), "$$scope" in d && n(4, o = d.$$scope); + }, e.$$.update = () => { + e.$$.dirty & /*el*/ + 4 && n(3, r = a(s)); + }, [l, u, s, r, o, i, f]; +} +class cu extends Ja { + constructor(t) { + super(), nu(this, t, fu, au, iu, { size: 0, unpadded_box: 1 }); + } +} +const { + SvelteComponent: du, + append: hr, + attr: qe, + detach: _u, + init: hu, + insert: mu, + noop: mr, + safe_not_equal: pu, + set_style: Je, + svg_element: Bn +} = window.__gradio__svelte__internal; +function gu(e) { + let t, n, r, i; + return { + c() { + t = Bn("svg"), n = Bn("g"), r = Bn("path"), i = Bn("path"), qe(r, "d", "M18,6L6.087,17.913"), Je(r, "fill", "none"), Je(r, "fill-rule", "nonzero"), Je(r, "stroke-width", "2px"), qe(n, "transform", "matrix(1.14096,-0.140958,-0.140958,1.14096,-0.0559523,0.0559523)"), qe(i, "d", "M4.364,4.364L19.636,19.636"), Je(i, "fill", "none"), Je(i, "fill-rule", "nonzero"), Je(i, "stroke-width", "2px"), qe(t, "width", "100%"), qe(t, "height", "100%"), qe(t, "viewBox", "0 0 24 24"), qe(t, "version", "1.1"), qe(t, "xmlns", "http://www.w3.org/2000/svg"), qe(t, "xmlns:xlink", "http://www.w3.org/1999/xlink"), qe(t, "xml:space", "preserve"), qe(t, "stroke", "currentColor"), Je(t, "fill-rule", "evenodd"), Je(t, "clip-rule", "evenodd"), Je(t, "stroke-linecap", "round"), Je(t, "stroke-linejoin", "round"); + }, + m(o, l) { + mu(o, t, l), hr(t, n), hr(n, r), hr(t, i); + }, + p: mr, + i: mr, + o: mr, + d(o) { + o && _u(t); + } + }; +} +class bu extends du { + constructor(t) { + super(), hu(this, t, null, gu, pu, {}); + } +} +const { + SvelteComponent: wu, + append: vu, + attr: en, + detach: yu, + init: Eu, + insert: Su, + noop: pr, + safe_not_equal: ku, + svg_element: Fi +} = window.__gradio__svelte__internal; +function Tu(e) { + let t, n; + return { + c() { + t = Fi("svg"), n = Fi("path"), en(n, "d", "M23,20a5,5,0,0,0-3.89,1.89L11.8,17.32a4.46,4.46,0,0,0,0-2.64l7.31-4.57A5,5,0,1,0,18,7a4.79,4.79,0,0,0,.2,1.32l-7.31,4.57a5,5,0,1,0,0,6.22l7.31,4.57A4.79,4.79,0,0,0,18,25a5,5,0,1,0,5-5ZM23,4a3,3,0,1,1-3,3A3,3,0,0,1,23,4ZM7,19a3,3,0,1,1,3-3A3,3,0,0,1,7,19Zm16,9a3,3,0,1,1,3-3A3,3,0,0,1,23,28Z"), en(n, "fill", "currentColor"), en(t, "id", "icon"), en(t, "xmlns", "http://www.w3.org/2000/svg"), en(t, "viewBox", "0 0 32 32"); + }, + m(r, i) { + Su(r, t, i), vu(t, n); + }, + p: pr, + i: pr, + o: pr, + d(r) { + r && yu(t); + } + }; +} +class Au extends wu { + constructor(t) { + super(), Eu(this, t, null, Tu, ku, {}); + } +} +const { + SvelteComponent: Bu, + append: Cu, + attr: Nt, + detach: Iu, + init: Lu, + insert: Pu, + noop: gr, + safe_not_equal: Ou, + svg_element: Gi +} = window.__gradio__svelte__internal; +function Hu(e) { + let t, n; + return { + c() { + t = Gi("svg"), n = Gi("path"), Nt(n, "fill", "currentColor"), Nt(n, "d", "M26 24v4H6v-4H4v4a2 2 0 0 0 2 2h20a2 2 0 0 0 2-2v-4zm0-10l-1.41-1.41L17 20.17V2h-2v18.17l-7.59-7.58L6 14l10 10l10-10z"), Nt(t, "xmlns", "http://www.w3.org/2000/svg"), Nt(t, "width", "100%"), Nt(t, "height", "100%"), Nt(t, "viewBox", "0 0 32 32"); + }, + m(r, i) { + Pu(r, t, i), Cu(t, n); + }, + p: gr, + i: gr, + o: gr, + d(r) { + r && Iu(t); + } + }; +} +class Nl extends Bu { + constructor(t) { + super(), Lu(this, t, null, Hu, Ou, {}); + } +} +const { + SvelteComponent: Nu, + append: Mu, + attr: je, + detach: Du, + init: Ru, + insert: Uu, + noop: br, + safe_not_equal: Fu, + svg_element: qi +} = window.__gradio__svelte__internal; +function Gu(e) { + let t, n; + return { + c() { + t = qi("svg"), n = qi("path"), je(n, "d", "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"), je(t, "xmlns", "http://www.w3.org/2000/svg"), je(t, "width", "100%"), je(t, "height", "100%"), je(t, "viewBox", "0 0 24 24"), je(t, "fill", "none"), je(t, "stroke", "currentColor"), je(t, "stroke-width", "1.5"), je(t, "stroke-linecap", "round"), je(t, "stroke-linejoin", "round"), je(t, "class", "feather feather-edit-2"); + }, + m(r, i) { + Uu(r, t, i), Mu(t, n); + }, + p: br, + i: br, + o: br, + d(r) { + r && Du(t); + } + }; +} +class qu extends Nu { + constructor(t) { + super(), Ru(this, t, null, Gu, Fu, {}); + } +} +const { + SvelteComponent: ju, + append: ji, + attr: Me, + detach: xu, + init: zu, + insert: Vu, + noop: wr, + safe_not_equal: Xu, + svg_element: vr +} = window.__gradio__svelte__internal; +function Wu(e) { + let t, n, r; + return { + c() { + t = vr("svg"), n = vr("path"), r = vr("polyline"), Me(n, "d", "M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"), Me(r, "points", "13 2 13 9 20 9"), Me(t, "xmlns", "http://www.w3.org/2000/svg"), Me(t, "width", "100%"), Me(t, "height", "100%"), Me(t, "viewBox", "0 0 24 24"), Me(t, "fill", "none"), Me(t, "stroke", "currentColor"), Me(t, "stroke-width", "1.5"), Me(t, "stroke-linecap", "round"), Me(t, "stroke-linejoin", "round"), Me(t, "class", "feather feather-file"); + }, + m(i, o) { + Vu(i, t, o), ji(t, n), ji(t, r); + }, + p: wr, + i: wr, + o: wr, + d(i) { + i && xu(t); + } + }; +} +let Zu = class extends ju { + constructor(t) { + super(), zu(this, t, null, Wu, Xu, {}); + } +}; +const { + SvelteComponent: Ju, + append: yr, + attr: he, + detach: Qu, + init: Yu, + insert: Ku, + noop: Er, + safe_not_equal: $u, + svg_element: Cn +} = window.__gradio__svelte__internal; +function ef(e) { + let t, n, r, i; + return { + c() { + t = Cn("svg"), n = Cn("rect"), r = Cn("circle"), i = Cn("polyline"), he(n, "x", "3"), he(n, "y", "3"), he(n, "width", "18"), he(n, "height", "18"), he(n, "rx", "2"), he(n, "ry", "2"), he(r, "cx", "8.5"), he(r, "cy", "8.5"), he(r, "r", "1.5"), he(i, "points", "21 15 16 10 5 21"), he(t, "xmlns", "http://www.w3.org/2000/svg"), he(t, "width", "100%"), he(t, "height", "100%"), he(t, "viewBox", "0 0 24 24"), he(t, "fill", "none"), he(t, "stroke", "currentColor"), he(t, "stroke-width", "1.5"), he(t, "stroke-linecap", "round"), he(t, "stroke-linejoin", "round"), he(t, "class", "feather feather-image"); + }, + m(o, l) { + Ku(o, t, l), yr(t, n), yr(t, r), yr(t, i); + }, + p: Er, + i: Er, + o: Er, + d(o) { + o && Qu(t); + } + }; +} +let Ml = class extends Ju { + constructor(t) { + super(), Yu(this, t, null, ef, $u, {}); + } +}; +const { + SvelteComponent: tf, + append: nf, + attr: Mt, + detach: rf, + init: of, + insert: lf, + noop: Sr, + safe_not_equal: sf, + svg_element: xi +} = window.__gradio__svelte__internal; +function af(e) { + let t, n; + return { + c() { + t = xi("svg"), n = xi("path"), Mt(n, "fill", "currentColor"), Mt(n, "d", "M13.75 2a2.25 2.25 0 0 1 2.236 2.002V4h1.764A2.25 2.25 0 0 1 20 6.25V11h-1.5V6.25a.75.75 0 0 0-.75-.75h-2.129c-.404.603-1.091 1-1.871 1h-3.5c-.78 0-1.467-.397-1.871-1H6.25a.75.75 0 0 0-.75.75v13.5c0 .414.336.75.75.75h4.78a3.99 3.99 0 0 0 .505 1.5H6.25A2.25 2.25 0 0 1 4 19.75V6.25A2.25 2.25 0 0 1 6.25 4h1.764a2.25 2.25 0 0 1 2.236-2h3.5Zm2.245 2.096L16 4.25c0-.052-.002-.103-.005-.154ZM13.75 3.5h-3.5a.75.75 0 0 0 0 1.5h3.5a.75.75 0 0 0 0-1.5ZM15 12a3 3 0 0 0-3 3v5c0 .556.151 1.077.415 1.524l3.494-3.494a2.25 2.25 0 0 1 3.182 0l3.494 3.494c.264-.447.415-.968.415-1.524v-5a3 3 0 0 0-3-3h-5Zm0 11a2.985 2.985 0 0 1-1.524-.415l3.494-3.494a.75.75 0 0 1 1.06 0l3.494 3.494A2.985 2.985 0 0 1 20 23h-5Zm5-7a1 1 0 1 1 0-2a1 1 0 0 1 0 2Z"), Mt(t, "xmlns", "http://www.w3.org/2000/svg"), Mt(t, "width", "100%"), Mt(t, "height", "100%"), Mt(t, "viewBox", "0 0 24 24"); + }, + m(r, i) { + lf(r, t, i), nf(t, n); + }, + p: Sr, + i: Sr, + o: Sr, + d(r) { + r && rf(t); + } + }; +} +class uf extends tf { + constructor(t) { + super(), of(this, t, null, af, sf, {}); + } +} +const { + SvelteComponent: ff, + append: zi, + attr: De, + detach: cf, + init: df, + insert: _f, + noop: kr, + safe_not_equal: hf, + svg_element: Tr +} = window.__gradio__svelte__internal; +function mf(e) { + let t, n, r; + return { + c() { + t = Tr("svg"), n = Tr("polyline"), r = Tr("path"), De(n, "points", "1 4 1 10 7 10"), De(r, "d", "M3.51 15a9 9 0 1 0 2.13-9.36L1 10"), De(t, "xmlns", "http://www.w3.org/2000/svg"), De(t, "width", "100%"), De(t, "height", "100%"), De(t, "viewBox", "0 0 24 24"), De(t, "fill", "none"), De(t, "stroke", "currentColor"), De(t, "stroke-width", "2"), De(t, "stroke-linecap", "round"), De(t, "stroke-linejoin", "round"), De(t, "class", "feather feather-rotate-ccw"); + }, + m(i, o) { + _f(i, t, o), zi(t, n), zi(t, r); + }, + p: kr, + i: kr, + o: kr, + d(i) { + i && cf(t); + } + }; +} +class pf extends ff { + constructor(t) { + super(), df(this, t, null, mf, hf, {}); + } +} +const { + SvelteComponent: gf, + append: Ar, + attr: ve, + detach: bf, + init: wf, + insert: vf, + noop: Br, + safe_not_equal: yf, + svg_element: In +} = window.__gradio__svelte__internal; +function Ef(e) { + let t, n, r, i; + return { + c() { + t = In("svg"), n = In("path"), r = In("polyline"), i = In("line"), ve(n, "d", "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"), ve(r, "points", "17 8 12 3 7 8"), ve(i, "x1", "12"), ve(i, "y1", "3"), ve(i, "x2", "12"), ve(i, "y2", "15"), ve(t, "xmlns", "http://www.w3.org/2000/svg"), ve(t, "width", "90%"), ve(t, "height", "90%"), ve(t, "viewBox", "0 0 24 24"), ve(t, "fill", "none"), ve(t, "stroke", "currentColor"), ve(t, "stroke-width", "2"), ve(t, "stroke-linecap", "round"), ve(t, "stroke-linejoin", "round"), ve(t, "class", "feather feather-upload"); + }, + m(o, l) { + vf(o, t, l), Ar(t, n), Ar(t, r), Ar(t, i); + }, + p: Br, + i: Br, + o: Br, + d(o) { + o && bf(t); + } + }; +} +let Sf = class extends gf { + constructor(t) { + super(), wf(this, t, null, Ef, yf, {}); + } +}; +const kf = [ + { color: "red", primary: 600, secondary: 100 }, + { color: "green", primary: 600, secondary: 100 }, + { color: "blue", primary: 600, secondary: 100 }, + { color: "yellow", primary: 500, secondary: 100 }, + { color: "purple", primary: 600, secondary: 100 }, + { color: "teal", primary: 600, secondary: 100 }, + { color: "orange", primary: 600, secondary: 100 }, + { color: "cyan", primary: 600, secondary: 100 }, + { color: "lime", primary: 500, secondary: 100 }, + { color: "pink", primary: 600, secondary: 100 } +], Vi = { + inherit: "inherit", + current: "currentColor", + transparent: "transparent", + black: "#000", + white: "#fff", + slate: { + 50: "#f8fafc", + 100: "#f1f5f9", + 200: "#e2e8f0", + 300: "#cbd5e1", + 400: "#94a3b8", + 500: "#64748b", + 600: "#475569", + 700: "#334155", + 800: "#1e293b", + 900: "#0f172a", + 950: "#020617" + }, + gray: { + 50: "#f9fafb", + 100: "#f3f4f6", + 200: "#e5e7eb", + 300: "#d1d5db", + 400: "#9ca3af", + 500: "#6b7280", + 600: "#4b5563", + 700: "#374151", + 800: "#1f2937", + 900: "#111827", + 950: "#030712" + }, + zinc: { + 50: "#fafafa", + 100: "#f4f4f5", + 200: "#e4e4e7", + 300: "#d4d4d8", + 400: "#a1a1aa", + 500: "#71717a", + 600: "#52525b", + 700: "#3f3f46", + 800: "#27272a", + 900: "#18181b", + 950: "#09090b" + }, + neutral: { + 50: "#fafafa", + 100: "#f5f5f5", + 200: "#e5e5e5", + 300: "#d4d4d4", + 400: "#a3a3a3", + 500: "#737373", + 600: "#525252", + 700: "#404040", + 800: "#262626", + 900: "#171717", + 950: "#0a0a0a" + }, + stone: { + 50: "#fafaf9", + 100: "#f5f5f4", + 200: "#e7e5e4", + 300: "#d6d3d1", + 400: "#a8a29e", + 500: "#78716c", + 600: "#57534e", + 700: "#44403c", + 800: "#292524", + 900: "#1c1917", + 950: "#0c0a09" + }, + red: { + 50: "#fef2f2", + 100: "#fee2e2", + 200: "#fecaca", + 300: "#fca5a5", + 400: "#f87171", + 500: "#ef4444", + 600: "#dc2626", + 700: "#b91c1c", + 800: "#991b1b", + 900: "#7f1d1d", + 950: "#450a0a" + }, + orange: { + 50: "#fff7ed", + 100: "#ffedd5", + 200: "#fed7aa", + 300: "#fdba74", + 400: "#fb923c", + 500: "#f97316", + 600: "#ea580c", + 700: "#c2410c", + 800: "#9a3412", + 900: "#7c2d12", + 950: "#431407" + }, + amber: { + 50: "#fffbeb", + 100: "#fef3c7", + 200: "#fde68a", + 300: "#fcd34d", + 400: "#fbbf24", + 500: "#f59e0b", + 600: "#d97706", + 700: "#b45309", + 800: "#92400e", + 900: "#78350f", + 950: "#451a03" + }, + yellow: { + 50: "#fefce8", + 100: "#fef9c3", + 200: "#fef08a", + 300: "#fde047", + 400: "#facc15", + 500: "#eab308", + 600: "#ca8a04", + 700: "#a16207", + 800: "#854d0e", + 900: "#713f12", + 950: "#422006" + }, + lime: { + 50: "#f7fee7", + 100: "#ecfccb", + 200: "#d9f99d", + 300: "#bef264", + 400: "#a3e635", + 500: "#84cc16", + 600: "#65a30d", + 700: "#4d7c0f", + 800: "#3f6212", + 900: "#365314", + 950: "#1a2e05" + }, + green: { + 50: "#f0fdf4", + 100: "#dcfce7", + 200: "#bbf7d0", + 300: "#86efac", + 400: "#4ade80", + 500: "#22c55e", + 600: "#16a34a", + 700: "#15803d", + 800: "#166534", + 900: "#14532d", + 950: "#052e16" + }, + emerald: { + 50: "#ecfdf5", + 100: "#d1fae5", + 200: "#a7f3d0", + 300: "#6ee7b7", + 400: "#34d399", + 500: "#10b981", + 600: "#059669", + 700: "#047857", + 800: "#065f46", + 900: "#064e3b", + 950: "#022c22" + }, + teal: { + 50: "#f0fdfa", + 100: "#ccfbf1", + 200: "#99f6e4", + 300: "#5eead4", + 400: "#2dd4bf", + 500: "#14b8a6", + 600: "#0d9488", + 700: "#0f766e", + 800: "#115e59", + 900: "#134e4a", + 950: "#042f2e" + }, + cyan: { + 50: "#ecfeff", + 100: "#cffafe", + 200: "#a5f3fc", + 300: "#67e8f9", + 400: "#22d3ee", + 500: "#06b6d4", + 600: "#0891b2", + 700: "#0e7490", + 800: "#155e75", + 900: "#164e63", + 950: "#083344" + }, + sky: { + 50: "#f0f9ff", + 100: "#e0f2fe", + 200: "#bae6fd", + 300: "#7dd3fc", + 400: "#38bdf8", + 500: "#0ea5e9", + 600: "#0284c7", + 700: "#0369a1", + 800: "#075985", + 900: "#0c4a6e", + 950: "#082f49" + }, + blue: { + 50: "#eff6ff", + 100: "#dbeafe", + 200: "#bfdbfe", + 300: "#93c5fd", + 400: "#60a5fa", + 500: "#3b82f6", + 600: "#2563eb", + 700: "#1d4ed8", + 800: "#1e40af", + 900: "#1e3a8a", + 950: "#172554" + }, + indigo: { + 50: "#eef2ff", + 100: "#e0e7ff", + 200: "#c7d2fe", + 300: "#a5b4fc", + 400: "#818cf8", + 500: "#6366f1", + 600: "#4f46e5", + 700: "#4338ca", + 800: "#3730a3", + 900: "#312e81", + 950: "#1e1b4b" + }, + violet: { + 50: "#f5f3ff", + 100: "#ede9fe", + 200: "#ddd6fe", + 300: "#c4b5fd", + 400: "#a78bfa", + 500: "#8b5cf6", + 600: "#7c3aed", + 700: "#6d28d9", + 800: "#5b21b6", + 900: "#4c1d95", + 950: "#2e1065" + }, + purple: { + 50: "#faf5ff", + 100: "#f3e8ff", + 200: "#e9d5ff", + 300: "#d8b4fe", + 400: "#c084fc", + 500: "#a855f7", + 600: "#9333ea", + 700: "#7e22ce", + 800: "#6b21a8", + 900: "#581c87", + 950: "#3b0764" + }, + fuchsia: { + 50: "#fdf4ff", + 100: "#fae8ff", + 200: "#f5d0fe", + 300: "#f0abfc", + 400: "#e879f9", + 500: "#d946ef", + 600: "#c026d3", + 700: "#a21caf", + 800: "#86198f", + 900: "#701a75", + 950: "#4a044e" + }, + pink: { + 50: "#fdf2f8", + 100: "#fce7f3", + 200: "#fbcfe8", + 300: "#f9a8d4", + 400: "#f472b6", + 500: "#ec4899", + 600: "#db2777", + 700: "#be185d", + 800: "#9d174d", + 900: "#831843", + 950: "#500724" + }, + rose: { + 50: "#fff1f2", + 100: "#ffe4e6", + 200: "#fecdd3", + 300: "#fda4af", + 400: "#fb7185", + 500: "#f43f5e", + 600: "#e11d48", + 700: "#be123c", + 800: "#9f1239", + 900: "#881337", + 950: "#4c0519" + } +}; +kf.reduce( + (e, { color: t, primary: n, secondary: r }) => ({ + ...e, + [t]: { + primary: Vi[t][n], + secondary: Vi[t][r] + } + }), + {} +); +function Tf(e) { + let t, n = e[0], r = 1; + for (; r < e.length; ) { + const i = e[r], o = e[r + 1]; + if (r += 2, (i === "optionalAccess" || i === "optionalCall") && n == null) + return; + i === "access" || i === "optionalAccess" ? (t = n, n = o(n)) : (i === "call" || i === "optionalCall") && (n = o((...l) => n.call(t, ...l)), t = void 0); + } + return n; +} +class Nn extends Error { + constructor(t) { + super(t), this.name = "ShareError"; + } +} +async function Af(e, t) { + if (window.__gradio_space__ == null) + throw new Nn("Must be on Spaces to share."); + let n, r, i; + if (t === "url") { + const s = await fetch(e); + n = await s.blob(), r = s.headers.get("content-type") || "", i = s.headers.get("content-disposition") || ""; + } else + n = Bf(e), r = e.split(";")[0].split(":")[1], i = "file" + r.split("/")[1]; + const o = new File([n], i, { type: r }), l = await fetch("https://huggingface.co/uploads", { + method: "POST", + body: o, + headers: { + "Content-Type": o.type, + "X-Requested-With": "XMLHttpRequest" + } + }); + if (!l.ok) { + if (Tf([l, "access", (s) => s.headers, "access", (s) => s.get, "call", (s) => s("content-type"), "optionalAccess", (s) => s.includes, "call", (s) => s("application/json")])) { + const s = await l.json(); + throw new Nn(`Upload failed: ${s.error}`); + } + throw new Nn("Upload failed."); + } + return await l.text(); +} +function Bf(e) { + for (var t = e.split(","), n = t[0].match(/:(.*?);/)[1], r = atob(t[1]), i = r.length, o = new Uint8Array(i); i--; ) + o[i] = r.charCodeAt(i); + return new Blob([o], { type: n }); +} +const { + SvelteComponent: Cf, + create_component: If, + destroy_component: Lf, + init: Pf, + mount_component: Of, + safe_not_equal: Hf, + transition_in: Nf, + transition_out: Mf +} = window.__gradio__svelte__internal, { createEventDispatcher: Df } = window.__gradio__svelte__internal; +function Rf(e) { + let t, n; + return t = new Jt({ + props: { + Icon: Au, + label: ( + /*i18n*/ + e[2]("common.share") + ), + pending: ( + /*pending*/ + e[3] + ) + } + }), t.$on( + "click", + /*click_handler*/ + e[5] + ), { + c() { + If(t.$$.fragment); + }, + m(r, i) { + Of(t, r, i), n = !0; + }, + p(r, [i]) { + const o = {}; + i & /*i18n*/ + 4 && (o.label = /*i18n*/ + r[2]("common.share")), i & /*pending*/ + 8 && (o.pending = /*pending*/ + r[3]), t.$set(o); + }, + i(r) { + n || (Nf(t.$$.fragment, r), n = !0); + }, + o(r) { + Mf(t.$$.fragment, r), n = !1; + }, + d(r) { + Lf(t, r); + } + }; +} +function Uf(e, t, n) { + const r = Df(); + let { formatter: i } = t, { value: o } = t, { i18n: l } = t, u = !1; + const s = async () => { + try { + n(3, u = !0); + const a = await i(o); + r("share", { description: a }); + } catch (a) { + console.error(a); + let f = a instanceof Nn ? a.message : "Share failed."; + r("error", f); + } finally { + n(3, u = !1); + } + }; + return e.$$set = (a) => { + "formatter" in a && n(0, i = a.formatter), "value" in a && n(1, o = a.value), "i18n" in a && n(2, l = a.i18n); + }, [i, o, l, u, r, s]; +} +class Ff extends Cf { + constructor(t) { + super(), Pf(this, t, Uf, Rf, Hf, { formatter: 0, value: 1, i18n: 2 }); + } +} +const { + SvelteComponent: Gf, + append: yt, + attr: Xr, + check_outros: qf, + create_component: Dl, + destroy_component: Rl, + detach: Mn, + element: Wr, + group_outros: jf, + init: xf, + insert: Dn, + mount_component: Ul, + safe_not_equal: zf, + set_data: Zr, + space: Jr, + text: rn, + toggle_class: Xi, + transition_in: Gn, + transition_out: qn +} = window.__gradio__svelte__internal; +function Vf(e) { + let t, n; + return t = new Sf({}), { + c() { + Dl(t.$$.fragment); + }, + m(r, i) { + Ul(t, r, i), n = !0; + }, + i(r) { + n || (Gn(t.$$.fragment, r), n = !0); + }, + o(r) { + qn(t.$$.fragment, r), n = !1; + }, + d(r) { + Rl(t, r); + } + }; +} +function Xf(e) { + let t, n; + return t = new uf({}), { + c() { + Dl(t.$$.fragment); + }, + m(r, i) { + Ul(t, r, i), n = !0; + }, + i(r) { + n || (Gn(t.$$.fragment, r), n = !0); + }, + o(r) { + qn(t.$$.fragment, r), n = !1; + }, + d(r) { + Rl(t, r); + } + }; +} +function Wi(e) { + let t, n, r = ( + /*i18n*/ + e[1]("common.or") + "" + ), i, o, l, u = ( + /*message*/ + (e[2] || /*i18n*/ + e[1]("upload_text.click_to_upload")) + "" + ), s; + return { + c() { + t = Wr("span"), n = rn("- "), i = rn(r), o = rn(" -"), l = Jr(), s = rn(u), Xr(t, "class", "or svelte-kzcjhc"); + }, + m(a, f) { + Dn(a, t, f), yt(t, n), yt(t, i), yt(t, o), Dn(a, l, f), Dn(a, s, f); + }, + p(a, f) { + f & /*i18n*/ + 2 && r !== (r = /*i18n*/ + a[1]("common.or") + "") && Zr(i, r), f & /*message, i18n*/ + 6 && u !== (u = /*message*/ + (a[2] || /*i18n*/ + a[1]("upload_text.click_to_upload")) + "") && Zr(s, u); + }, + d(a) { + a && (Mn(t), Mn(l), Mn(s)); + } + }; +} +function Wf(e) { + let t, n, r, i, o, l = ( + /*i18n*/ + e[1]( + /*defs*/ + e[5][ + /*type*/ + e[0] + ] || /*defs*/ + e[5].file + ) + "" + ), u, s, a; + const f = [Xf, Vf], d = []; + function c(_, m) { + return ( + /*type*/ + _[0] === "clipboard" ? 0 : 1 + ); + } + r = c(e), i = d[r] = f[r](e); + let h = ( + /*mode*/ + e[3] !== "short" && Wi(e) + ); + return { + c() { + t = Wr("div"), n = Wr("span"), i.c(), o = Jr(), u = rn(l), s = Jr(), h && h.c(), Xr(n, "class", "icon-wrap svelte-kzcjhc"), Xi( + n, + "hovered", + /*hovered*/ + e[4] + ), Xr(t, "class", "wrap svelte-kzcjhc"); + }, + m(_, m) { + Dn(_, t, m), yt(t, n), d[r].m(n, null), yt(t, o), yt(t, u), yt(t, s), h && h.m(t, null), a = !0; + }, + p(_, [m]) { + let g = r; + r = c(_), r !== g && (jf(), qn(d[g], 1, 1, () => { + d[g] = null; + }), qf(), i = d[r], i || (i = d[r] = f[r](_), i.c()), Gn(i, 1), i.m(n, null)), (!a || m & /*hovered*/ + 16) && Xi( + n, + "hovered", + /*hovered*/ + _[4] + ), (!a || m & /*i18n, type*/ + 3) && l !== (l = /*i18n*/ + _[1]( + /*defs*/ + _[5][ + /*type*/ + _[0] + ] || /*defs*/ + _[5].file + ) + "") && Zr(u, l), /*mode*/ + _[3] !== "short" ? h ? h.p(_, m) : (h = Wi(_), h.c(), h.m(t, null)) : h && (h.d(1), h = null); + }, + i(_) { + a || (Gn(i), a = !0); + }, + o(_) { + qn(i), a = !1; + }, + d(_) { + _ && Mn(t), d[r].d(), h && h.d(); + } + }; +} +function Zf(e, t, n) { + let { type: r = "file" } = t, { i18n: i } = t, { message: o = void 0 } = t, { mode: l = "full" } = t, { hovered: u = !1 } = t; + const s = { + image: "upload_text.drop_image", + video: "upload_text.drop_video", + audio: "upload_text.drop_audio", + file: "upload_text.drop_file", + csv: "upload_text.drop_csv", + gallery: "upload_text.drop_gallery", + clipboard: "upload_text.paste_clipboard" + }; + return e.$$set = (a) => { + "type" in a && n(0, r = a.type), "i18n" in a && n(1, i = a.i18n), "message" in a && n(2, o = a.message), "mode" in a && n(3, l = a.mode), "hovered" in a && n(4, u = a.hovered); + }, [r, i, o, l, u, s]; +} +class Jf extends Gf { + constructor(t) { + super(), xf(this, t, Zf, Wf, zf, { + type: 0, + i18n: 1, + message: 2, + mode: 3, + hovered: 4 + }); + } +} +var Cr = new Intl.Collator(0, { numeric: 1 }).compare; +function Zi(e, t, n) { + return e = e.split("."), t = t.split("."), Cr(e[0], t[0]) || Cr(e[1], t[1]) || (t[2] = t.slice(2).join("."), n = /[.-]/.test(e[2] = e.slice(2).join(".")), n == /[.-]/.test(t[2]) ? Cr(e[2], t[2]) : n ? -1 : 1); +} +function Fl(e, t, n) { + return t.startsWith("http://") || t.startsWith("https://") ? n ? e : t : e + t; +} +function Ir(e) { + if (e.startsWith("http")) { + const { protocol: t, host: n } = new URL(e); + return n.endsWith("hf.space") ? { + ws_protocol: "wss", + host: n, + http_protocol: t + } : { + ws_protocol: t === "https:" ? "wss" : "ws", + http_protocol: t, + host: n + }; + } else if (e.startsWith("file:")) + return { + ws_protocol: "ws", + http_protocol: "http:", + host: "lite.local" + // Special fake hostname only used for this case. This matches the hostname allowed in `is_self_host()` in `js/wasm/network/host.ts`. + }; + return { + ws_protocol: "wss", + http_protocol: "https:", + host: e + }; +} +const Gl = /^[^\/]*\/[^\/]*$/, Qf = /.*hf\.space\/{0,1}$/; +async function Yf(e, t) { + const n = {}; + t && (n.Authorization = `Bearer ${t}`); + const r = e.trim(); + if (Gl.test(r)) + try { + const i = await fetch( + `https://huggingface.co/api/spaces/${r}/host`, + { headers: n } + ); + if (i.status !== 200) + throw new Error("Space metadata could not be loaded."); + const o = (await i.json()).host; + return { + space_id: e, + ...Ir(o) + }; + } catch (i) { + throw new Error("Space metadata could not be loaded." + i.message); + } + if (Qf.test(r)) { + const { ws_protocol: i, http_protocol: o, host: l } = Ir(r); + return { + space_id: l.replace(".hf.space", ""), + ws_protocol: i, + http_protocol: o, + host: l + }; + } + return { + space_id: !1, + ...Ir(r) + }; +} +function Kf(e) { + let t = {}; + return e.forEach(({ api_name: n }, r) => { + n && (t[n] = r); + }), t; +} +const $f = /^(?=[^]*\b[dD]iscussions{0,1}\b)(?=[^]*\b[dD]isabled\b)[^]*$/; +async function Ji(e) { + try { + const n = (await fetch( + `https://huggingface.co/api/spaces/${e}/discussions`, + { + method: "HEAD" + } + )).headers.get("x-error-message"); + return !(n && $f.test(n)); + } catch { + return !1; + } +} +function Et(e, t, n) { + if (e == null) + return null; + if (Array.isArray(e)) { + const r = []; + for (const i of e) + i == null ? r.push(null) : r.push(Et(i, t, n)); + return r; + } + return e.is_stream ? n == null ? new Ft({ + ...e, + url: t + "/stream/" + e.path + }) : new Ft({ + ...e, + url: "/proxy=" + n + "stream/" + e.path + }) : new Ft({ + ...e, + url: tc(e.path, t, n) + }); +} +function ec(e) { + try { + const t = new URL(e); + return t.protocol === "http:" || t.protocol === "https:"; + } catch { + return !1; + } +} +function tc(e, t, n) { + return e == null ? n ? `/proxy=${n}file=` : `${t}/file=` : ec(e) ? e : n ? `/proxy=${n}file=${e}` : `${t}/file=${e}`; +} +async function nc(e, t, n, r = oc) { + let i = (Array.isArray(e) ? e : [e]).map( + (o) => o.blob + ); + return await Promise.all( + await r(t, i, void 0, n).then( + async (o) => { + if (o.error) + throw new Error(o.error); + return o.files ? o.files.map((l, u) => { + const s = new Ft({ ...e[u], path: l }); + return Et(s, t, null); + }) : []; + } + ) + ); +} +async function rc(e, t) { + return e.map( + (n, r) => new Ft({ + path: n.name, + orig_name: n.name, + blob: n, + size: n.size, + mime_type: n.type, + is_stream: t + }) + ); +} +class Ft { + constructor({ + path: t, + url: n, + orig_name: r, + size: i, + blob: o, + is_stream: l, + mime_type: u, + alt_text: s + }) { + this.path = t, this.url = n, this.orig_name = r, this.size = i, this.blob = n ? void 0 : o, this.is_stream = l, this.mime_type = u, this.alt_text = s; + } +} +const ql = "This application is too busy. Keep trying!", ht = "Connection errored out."; +let jl; +function ic(e, t) { + return { post_data: n, upload_files: r, client: i, handle_blob: o }; + async function n(l, u, s) { + const a = { "Content-Type": "application/json" }; + s && (a.Authorization = `Bearer ${s}`); + try { + var f = await e(l, { + method: "POST", + body: JSON.stringify(u), + headers: a + }); + } catch { + return [{ error: ht }, 500]; + } + let d, c; + try { + d = await f.json(), c = f.status; + } catch (h) { + d = { error: `Could not parse server response: ${h}` }, c = 500; + } + return [d, c]; + } + async function r(l, u, s, a) { + const f = {}; + s && (f.Authorization = `Bearer ${s}`); + const d = 1e3, c = []; + for (let _ = 0; _ < u.length; _ += d) { + const m = u.slice(_, _ + d), g = new FormData(); + m.forEach((v) => { + g.append("files", v); + }); + try { + const v = a ? `${l}/upload?upload_id=${a}` : `${l}/upload`; + var h = await e(v, { + method: "POST", + body: g, + headers: f + }); + } catch { + return { error: ht }; + } + const p = await h.json(); + c.push(...p); + } + return { files: c }; + } + async function i(l, u = { normalise_files: !0 }) { + return new Promise(async (s) => { + const { status_callback: a, hf_token: f, normalise_files: d } = u, c = { + predict: ne, + submit: ce, + view_api: pe, + component_server: B + }, h = d ?? !0; + if ((typeof window > "u" || !("WebSocket" in window)) && !global.Websocket) { + const E = await import("./wrapper-6f348d45-f837cf34.js"); + jl = (await import("./__vite-browser-external-2447137e.js")).Blob, global.WebSocket = E.WebSocket; + } + const { ws_protocol: _, http_protocol: m, host: g, space_id: p } = await Yf(l, f), v = Math.random().toString(36).substring(2), b = {}; + let w = !1, y = {}, S = null; + const C = {}, P = /* @__PURE__ */ new Set(); + let k, O = {}, U = !1; + f && p && (U = await sc(p, f)); + async function x(E) { + if (k = E, O = Kf((E == null ? void 0 : E.dependencies) || []), k.auth_required) + return { + config: k, + ...c + }; + try { + j = await pe(k); + } catch (M) { + console.error(`Could not get api details: ${M.message}`); + } + return { + config: k, + ...c + }; + } + let j; + async function te(E) { + if (a && a(E), E.status === "running") + try { + k = await $i( + e, + `${m}//${g}`, + f + ); + const M = await x(k); + s(M); + } catch (M) { + console.error(M), a && a({ + status: "error", + message: "Could not load this space.", + load_status: "error", + detail: "NOT_FOUND" + }); + } + } + try { + k = await $i( + e, + `${m}//${g}`, + f + ); + const E = await x(k); + s(E); + } catch (E) { + console.error(E), p ? Yr( + p, + Gl.test(p) ? "space_name" : "subdomain", + te + ) : a && a({ + status: "error", + message: "Could not load this space.", + load_status: "error", + detail: "NOT_FOUND" + }); + } + function ne(E, M, A) { + let F = !1, L = !1, re; + if (typeof E == "number") + re = k.dependencies[E]; + else { + const z = E.replace(/^\//, ""); + re = k.dependencies[O[z]]; + } + if (re.types.continuous) + throw new Error( + "Cannot call predict on this function as it may run forever. Use submit instead" + ); + return new Promise((z, ee) => { + const T = ce(E, M, A); + let H; + T.on("data", (D) => { + L && (T.destroy(), z(D)), F = !0, H = D; + }).on("status", (D) => { + D.stage === "error" && ee(D), D.stage === "complete" && (L = !0, F && (T.destroy(), z(H))); + }); + }); + } + function ce(E, M, A, F = null) { + let L, re; + if (typeof E == "number") + L = E, re = j.unnamed_endpoints[L]; + else { + const de = E.replace(/^\//, ""); + L = O[de], re = j.named_endpoints[E.trim()]; + } + if (typeof L != "number") + throw new Error( + "There is no endpoint matching that name of fn_index matching that number." + ); + let z, ee, T = k.protocol ?? "ws"; + const H = typeof E == "number" ? "/predict" : E; + let D, I = null, N = !1; + const Q = {}; + let Y = ""; + typeof window < "u" && (Y = new URLSearchParams(window.location.search).toString()), o(`${k.root}`, M, re, f).then( + (de) => { + if (D = { + data: de || [], + event_data: A, + fn_index: L, + trigger_id: F + }, ac(L, k)) + R({ + type: "status", + endpoint: H, + stage: "pending", + queue: !1, + fn_index: L, + time: /* @__PURE__ */ new Date() + }), n( + `${k.root}/run${H.startsWith("/") ? H : `/${H}`}${Y ? "?" + Y : ""}`, + { + ...D, + session_hash: v + }, + f + ).then(([oe, se]) => { + const Le = h ? Ln( + oe.data, + re, + k.root, + k.root_url + ) : oe.data; + se == 200 ? (R({ + type: "data", + endpoint: H, + fn_index: L, + data: Le, + time: /* @__PURE__ */ new Date() + }), R({ + type: "status", + endpoint: H, + fn_index: L, + stage: "complete", + eta: oe.average_duration, + queue: !1, + time: /* @__PURE__ */ new Date() + })) : R({ + type: "status", + stage: "error", + endpoint: H, + fn_index: L, + message: oe.error, + queue: !1, + time: /* @__PURE__ */ new Date() + }); + }).catch((oe) => { + R({ + type: "status", + stage: "error", + message: oe.message, + endpoint: H, + fn_index: L, + queue: !1, + time: /* @__PURE__ */ new Date() + }); + }); + else if (T == "ws") { + R({ + type: "status", + stage: "pending", + queue: !0, + endpoint: H, + fn_index: L, + time: /* @__PURE__ */ new Date() + }); + let oe = new URL(`${_}://${Fl( + g, + k.path, + !0 + )} + /queue/join${Y ? "?" + Y : ""}`); + U && oe.searchParams.set("__sign", U), z = new WebSocket(oe), z.onclose = (se) => { + se.wasClean || R({ + type: "status", + stage: "error", + broken: !0, + message: ht, + queue: !0, + endpoint: H, + fn_index: L, + time: /* @__PURE__ */ new Date() + }); + }, z.onmessage = function(se) { + const Le = JSON.parse(se.data), { type: ge, status: K, data: Z } = Lr( + Le, + b[L] + ); + if (ge === "update" && K && !N) + R({ + type: "status", + endpoint: H, + fn_index: L, + time: /* @__PURE__ */ new Date(), + ...K + }), K.stage === "error" && z.close(); + else if (ge === "hash") { + z.send(JSON.stringify({ fn_index: L, session_hash: v })); + return; + } else + ge === "data" ? z.send(JSON.stringify({ ...D, session_hash: v })) : ge === "complete" ? N = K : ge === "log" ? R({ + type: "log", + log: Z.log, + level: Z.level, + endpoint: H, + fn_index: L + }) : ge === "generating" && R({ + type: "status", + time: /* @__PURE__ */ new Date(), + ...K, + stage: K == null ? void 0 : K.stage, + queue: !0, + endpoint: H, + fn_index: L + }); + Z && (R({ + type: "data", + time: /* @__PURE__ */ new Date(), + data: h ? Ln( + Z.data, + re, + k.root, + k.root_url + ) : Z.data, + endpoint: H, + fn_index: L + }), N && (R({ + type: "status", + time: /* @__PURE__ */ new Date(), + ...N, + stage: K == null ? void 0 : K.stage, + queue: !0, + endpoint: H, + fn_index: L + }), z.close())); + }, Zi(k.version || "2.0.0", "3.6") < 0 && addEventListener( + "open", + () => z.send(JSON.stringify({ hash: v })) + ); + } else if (T == "sse") { + R({ + type: "status", + stage: "pending", + queue: !0, + endpoint: H, + fn_index: L, + time: /* @__PURE__ */ new Date() + }); + var we = new URLSearchParams({ + fn_index: L.toString(), + session_hash: v + }).toString(); + let oe = new URL( + `${k.root}/queue/join?${Y ? Y + "&" : ""}${we}` + ); + ee = t(oe), ee.onmessage = async function(se) { + const Le = JSON.parse(se.data), { type: ge, status: K, data: Z } = Lr( + Le, + b[L] + ); + if (ge === "update" && K && !N) + R({ + type: "status", + endpoint: H, + fn_index: L, + time: /* @__PURE__ */ new Date(), + ...K + }), K.stage === "error" && ee.close(); + else if (ge === "data") { + I = Le.event_id; + let [Ae, $t] = await n( + `${k.root}/queue/data`, + { + ...D, + session_hash: v, + event_id: I + }, + f + ); + $t !== 200 && (R({ + type: "status", + stage: "error", + message: ht, + queue: !0, + endpoint: H, + fn_index: L, + time: /* @__PURE__ */ new Date() + }), ee.close()); + } else + ge === "complete" ? N = K : ge === "log" ? R({ + type: "log", + log: Z.log, + level: Z.level, + endpoint: H, + fn_index: L + }) : ge === "generating" && R({ + type: "status", + time: /* @__PURE__ */ new Date(), + ...K, + stage: K == null ? void 0 : K.stage, + queue: !0, + endpoint: H, + fn_index: L + }); + Z && (R({ + type: "data", + time: /* @__PURE__ */ new Date(), + data: h ? Ln( + Z.data, + re, + k.root, + k.root_url + ) : Z.data, + endpoint: H, + fn_index: L + }), N && (R({ + type: "status", + time: /* @__PURE__ */ new Date(), + ...N, + stage: K == null ? void 0 : K.stage, + queue: !0, + endpoint: H, + fn_index: L + }), ee.close())); + }; + } else + T == "sse_v1" && (R({ + type: "status", + stage: "pending", + queue: !0, + endpoint: H, + fn_index: L, + time: /* @__PURE__ */ new Date() + }), n( + `${k.root}/queue/join?${Y}`, + { + ...D, + session_hash: v + }, + f + ).then(([oe, se]) => { + if (se === 503) + R({ + type: "status", + stage: "error", + message: ql, + queue: !0, + endpoint: H, + fn_index: L, + time: /* @__PURE__ */ new Date() + }); + else if (se !== 200) + R({ + type: "status", + stage: "error", + message: ht, + queue: !0, + endpoint: H, + fn_index: L, + time: /* @__PURE__ */ new Date() + }); + else { + I = oe.event_id; + let Le = async function(ge) { + try { + const { type: K, status: Z, data: Ae } = Lr( + ge, + b[L] + ); + if (K == "heartbeat") + return; + if (K === "update" && Z && !N) + R({ + type: "status", + endpoint: H, + fn_index: L, + time: /* @__PURE__ */ new Date(), + ...Z + }); + else if (K === "complete") + N = Z; + else if (K == "unexpected_error") + console.error("Unexpected error", Z == null ? void 0 : Z.message), R({ + type: "status", + stage: "error", + message: (Z == null ? void 0 : Z.message) || "An Unexpected Error Occurred!", + queue: !0, + endpoint: H, + fn_index: L, + time: /* @__PURE__ */ new Date() + }); + else if (K === "log") { + R({ + type: "log", + log: Ae.log, + level: Ae.level, + endpoint: H, + fn_index: L + }); + return; + } else + K === "generating" && R({ + type: "status", + time: /* @__PURE__ */ new Date(), + ...Z, + stage: Z == null ? void 0 : Z.stage, + queue: !0, + endpoint: H, + fn_index: L + }); + Ae && (R({ + type: "data", + time: /* @__PURE__ */ new Date(), + data: h ? Ln( + Ae.data, + re, + k.root, + k.root_url + ) : Ae.data, + endpoint: H, + fn_index: L + }), N && R({ + type: "status", + time: /* @__PURE__ */ new Date(), + ...N, + stage: Z == null ? void 0 : Z.stage, + queue: !0, + endpoint: H, + fn_index: L + })), ((Z == null ? void 0 : Z.stage) === "complete" || (Z == null ? void 0 : Z.stage) === "error") && C[I] && delete C[I]; + } catch (K) { + console.error("Unexpected client exception", K), R({ + type: "status", + stage: "error", + message: "An Unexpected Error Occurred!", + queue: !0, + endpoint: H, + fn_index: L, + time: /* @__PURE__ */ new Date() + }), _e(); + } + }; + I in y && (y[I].forEach( + (ge) => Le(ge) + ), delete y[I]), C[I] = Le, P.add(I), w || me(); + } + })); + } + ); + function R(de) { + const oe = Q[de.type] || []; + oe == null || oe.forEach((se) => se(de)); + } + function Te(de, we) { + const oe = Q, se = oe[de] || []; + return oe[de] = se, se == null || se.push(we), { on: Te, off: He, cancel: Ie, destroy: $e }; + } + function He(de, we) { + const oe = Q; + let se = oe[de] || []; + return se = se == null ? void 0 : se.filter((Le) => Le !== we), oe[de] = se, { on: Te, off: He, cancel: Ie, destroy: $e }; + } + async function Ie() { + const de = { + stage: "complete", + queue: !1, + time: /* @__PURE__ */ new Date() + }; + N = de, R({ + ...de, + type: "status", + endpoint: H, + fn_index: L + }); + let we = {}; + T === "ws" ? (z && z.readyState === 0 ? z.addEventListener("open", () => { + z.close(); + }) : z.close(), we = { fn_index: L, session_hash: v }) : (ee.close(), we = { event_id: I }); + try { + await e(`${k.root}/reset`, { + headers: { "Content-Type": "application/json" }, + method: "POST", + body: JSON.stringify(we) + }); + } catch { + console.warn( + "The `/reset` endpoint could not be called. Subsequent endpoint results may be unreliable." + ); + } + } + function $e() { + for (const de in Q) + Q[de].forEach((we) => { + He(de, we); + }); + } + return { + on: Te, + off: He, + cancel: Ie, + destroy: $e + }; + } + function me() { + w = !0; + let E = new URLSearchParams({ + session_hash: v + }).toString(), M = new URL(`${k.root}/queue/data?${E}`); + S = t(M), S.onmessage = async function(A) { + let F = JSON.parse(A.data); + const L = F.event_id; + if (!L) + await Promise.all( + Object.keys(C).map( + (re) => C[re](F) + ) + ); + else if (C[L]) { + F.msg === "process_completed" && (P.delete(L), P.size === 0 && _e()); + let re = C[L]; + window.setTimeout(re, 0, F); + } else + y[L] || (y[L] = []), y[L].push(F); + }, S.onerror = async function(A) { + await Promise.all( + Object.keys(C).map( + (F) => C[F]({ + msg: "unexpected_error", + message: ht + }) + ) + ), _e(); + }; + } + function _e() { + w = !1, S == null || S.close(); + } + async function B(E, M, A) { + var F; + const L = { "Content-Type": "application/json" }; + f && (L.Authorization = `Bearer ${f}`); + let re, z = k.components.find( + (H) => H.id === E + ); + (F = z == null ? void 0 : z.props) != null && F.root_url ? re = z.props.root_url : re = k.root; + const ee = await e( + `${re}/component_server/`, + { + method: "POST", + body: JSON.stringify({ + data: A, + component_id: E, + fn_name: M, + session_hash: v + }), + headers: L + } + ); + if (!ee.ok) + throw new Error( + "Could not connect to component server: " + ee.statusText + ); + return await ee.json(); + } + async function pe(E) { + if (j) + return j; + const M = { "Content-Type": "application/json" }; + f && (M.Authorization = `Bearer ${f}`); + let A; + if (Zi(E.version || "2.0.0", "3.30") < 0 ? A = await e( + "https://gradio-space-api-fetcher-v2.hf.space/api", + { + method: "POST", + body: JSON.stringify({ + serialize: !1, + config: JSON.stringify(E) + }), + headers: M + } + ) : A = await e(`${E.root}/info`, { + headers: M + }), !A.ok) + throw new Error(ht); + let F = await A.json(); + return "api" in F && (F = F.api), F.named_endpoints["/predict"] && !F.unnamed_endpoints[0] && (F.unnamed_endpoints[0] = F.named_endpoints["/predict"]), lc(F, E, O); + } + }); + } + async function o(l, u, s, a) { + const f = await Qr( + u, + void 0, + [], + !0, + s + ); + return Promise.all( + f.map(async ({ path: d, blob: c, type: h }) => { + if (c) { + const _ = (await r(l, [c], a)).files[0]; + return { path: d, file_url: _, type: h, name: c == null ? void 0 : c.name }; + } + return { path: d, type: h }; + }) + ).then((d) => (d.forEach(({ path: c, file_url: h, type: _, name: m }) => { + if (_ === "Gallery") + Ki(u, h, c); + else if (h) { + const g = new Ft({ path: h, orig_name: m }); + Ki(u, g, c); + } + }), u)); + } +} +const { post_data: op, upload_files: oc, client: lp, handle_blob: sp } = ic( + fetch, + (...e) => new EventSource(...e) +); +function Ln(e, t, n, r) { + return e.map((i, o) => { + var l, u, s, a; + return ((u = (l = t == null ? void 0 : t.returns) == null ? void 0 : l[o]) == null ? void 0 : u.component) === "File" ? Et(i, n, r) : ((a = (s = t == null ? void 0 : t.returns) == null ? void 0 : s[o]) == null ? void 0 : a.component) === "Gallery" ? i.map((f) => Array.isArray(f) ? [Et(f[0], n, r), f[1]] : [Et(f, n, r), null]) : typeof i == "object" && i.path ? Et(i, n, r) : i; + }); +} +function Qi(e, t, n, r) { + switch (e.type) { + case "string": + return "string"; + case "boolean": + return "boolean"; + case "number": + return "number"; + } + if (n === "JSONSerializable" || n === "StringSerializable") + return "any"; + if (n === "ListStringSerializable") + return "string[]"; + if (t === "Image") + return r === "parameter" ? "Blob | File | Buffer" : "string"; + if (n === "FileSerializable") + return (e == null ? void 0 : e.type) === "array" ? r === "parameter" ? "(Blob | File | Buffer)[]" : "{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}[]" : r === "parameter" ? "Blob | File | Buffer" : "{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}"; + if (n === "GallerySerializable") + return r === "parameter" ? "[(Blob | File | Buffer), (string | null)][]" : "[{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}, (string | null))][]"; +} +function Yi(e, t) { + return t === "GallerySerializable" ? "array of [file, label] tuples" : t === "ListStringSerializable" ? "array of strings" : t === "FileSerializable" ? "array of files or single file" : e.description; +} +function lc(e, t, n) { + const r = { + named_endpoints: {}, + unnamed_endpoints: {} + }; + for (const i in e) { + const o = e[i]; + for (const l in o) { + const u = t.dependencies[l] ? l : n[l.replace("/", "")], s = o[l]; + r[i][l] = {}, r[i][l].parameters = {}, r[i][l].returns = {}, r[i][l].type = t.dependencies[u].types, r[i][l].parameters = s.parameters.map( + ({ label: a, component: f, type: d, serializer: c }) => ({ + label: a, + component: f, + type: Qi(d, f, c, "parameter"), + description: Yi(d, c) + }) + ), r[i][l].returns = s.returns.map( + ({ label: a, component: f, type: d, serializer: c }) => ({ + label: a, + component: f, + type: Qi(d, f, c, "return"), + description: Yi(d, c) + }) + ); + } + } + return r; +} +async function sc(e, t) { + try { + return (await (await fetch(`https://huggingface.co/api/spaces/${e}/jwt`, { + headers: { + Authorization: `Bearer ${t}` + } + })).json()).token || !1; + } catch (n) { + return console.error(n), !1; + } +} +function Ki(e, t, n) { + for (; n.length > 1; ) + e = e[n.shift()]; + e[n.shift()] = t; +} +async function Qr(e, t = void 0, n = [], r = !1, i = void 0) { + if (Array.isArray(e)) { + let o = []; + return await Promise.all( + e.map(async (l, u) => { + var s; + let a = n.slice(); + a.push(u); + const f = await Qr( + e[u], + r ? ((s = i == null ? void 0 : i.parameters[u]) == null ? void 0 : s.component) || void 0 : t, + a, + !1, + i + ); + o = o.concat(f); + }) + ), o; + } else { + if (globalThis.Buffer && e instanceof globalThis.Buffer) + return [ + { + path: n, + blob: t === "Image" ? !1 : new jl([e]), + type: t + } + ]; + if (typeof e == "object") { + let o = []; + for (let l in e) + if (e.hasOwnProperty(l)) { + let u = n.slice(); + u.push(l), o = o.concat( + await Qr( + e[l], + void 0, + u, + !1, + i + ) + ); + } + return o; + } + } + return []; +} +function ac(e, t) { + var n, r, i, o; + return !(((r = (n = t == null ? void 0 : t.dependencies) == null ? void 0 : n[e]) == null ? void 0 : r.queue) === null ? t.enable_queue : (o = (i = t == null ? void 0 : t.dependencies) == null ? void 0 : i[e]) != null && o.queue) || !1; +} +async function $i(e, t, n) { + const r = {}; + if (n && (r.Authorization = `Bearer ${n}`), typeof window < "u" && window.gradio_config && location.origin !== "http://localhost:9876" && !window.gradio_config.dev_mode) { + const i = window.gradio_config.root, o = window.gradio_config; + return o.root = Fl(t, o.root, !1), { ...o, path: i }; + } else if (t) { + let i = await e(`${t}/config`, { + headers: r + }); + if (i.status === 200) { + const o = await i.json(); + return o.path = o.path ?? "", o.root = t, o; + } + throw new Error("Could not get config."); + } + throw new Error("No config or app endpoint found"); +} +async function Yr(e, t, n) { + let r = t === "subdomain" ? `https://huggingface.co/api/spaces/by-subdomain/${e}` : `https://huggingface.co/api/spaces/${e}`, i, o; + try { + if (i = await fetch(r), o = i.status, o !== 200) + throw new Error(); + i = await i.json(); + } catch { + n({ + status: "error", + load_status: "error", + message: "Could not get space status", + detail: "NOT_FOUND" + }); + return; + } + if (!i || o !== 200) + return; + const { + runtime: { stage: l }, + id: u + } = i; + switch (l) { + case "STOPPED": + case "SLEEPING": + n({ + status: "sleeping", + load_status: "pending", + message: "Space is asleep. Waking it up...", + detail: l + }), setTimeout(() => { + Yr(e, t, n); + }, 1e3); + break; + case "PAUSED": + n({ + status: "paused", + load_status: "error", + message: "This space has been paused by the author. If you would like to try this demo, consider duplicating the space.", + detail: l, + discussions_enabled: await Ji(u) + }); + break; + case "RUNNING": + case "RUNNING_BUILDING": + n({ + status: "running", + load_status: "complete", + message: "", + detail: l + }); + break; + case "BUILDING": + n({ + status: "building", + load_status: "pending", + message: "Space is building...", + detail: l + }), setTimeout(() => { + Yr(e, t, n); + }, 1e3); + break; + default: + n({ + status: "space_error", + load_status: "error", + message: "This space is experiencing an issue.", + detail: l, + discussions_enabled: await Ji(u) + }); + break; + } +} +function Lr(e, t) { + switch (e.msg) { + case "send_data": + return { type: "data" }; + case "send_hash": + return { type: "hash" }; + case "queue_full": + return { + type: "update", + status: { + queue: !0, + message: ql, + stage: "error", + code: e.code, + success: e.success + } + }; + case "heartbeat": + return { + type: "heartbeat" + }; + case "unexpected_error": + return { + type: "unexpected_error", + status: { + queue: !0, + message: e.message, + stage: "error", + success: !1 + } + }; + case "estimation": + return { + type: "update", + status: { + queue: !0, + stage: t || "pending", + code: e.code, + size: e.queue_size, + position: e.rank, + eta: e.rank_eta, + success: e.success + } + }; + case "progress": + return { + type: "update", + status: { + queue: !0, + stage: "pending", + code: e.code, + progress_data: e.progress_data, + success: e.success + } + }; + case "log": + return { type: "log", data: e }; + case "process_generating": + return { + type: "generating", + status: { + queue: !0, + message: e.success ? null : e.output.error, + stage: e.success ? "generating" : "error", + code: e.code, + progress_data: e.progress_data, + eta: e.average_duration + }, + data: e.success ? e.output : null + }; + case "process_completed": + return "error" in e.output ? { + type: "update", + status: { + queue: !0, + message: e.output.error, + stage: "error", + code: e.code, + success: e.success + } + } : { + type: "complete", + status: { + queue: !0, + message: e.success ? void 0 : e.output.error, + stage: e.success ? "complete" : "error", + code: e.code, + progress_data: e.progress_data + }, + data: e.success ? e.output : null + }; + case "process_starts": + return { + type: "update", + status: { + queue: !0, + stage: "pending", + code: e.code, + size: e.rank, + position: 0, + success: e.success, + eta: e.eta + } + }; + } + return { type: "none", status: { stage: "error", queue: !0 } }; +} +function kt() { +} +function uc(e) { + return e(); +} +function fc(e) { + e.forEach(uc); +} +function cc(e) { + return typeof e == "function"; +} +function dc(e, t) { + return e != e ? t == t : e !== t || e && typeof e == "object" || typeof e == "function"; +} +function _c(e, ...t) { + if (e == null) { + for (const r of t) + r(void 0); + return kt; + } + const n = e.subscribe(...t); + return n.unsubscribe ? () => n.unsubscribe() : n; +} +const xl = typeof window < "u"; +let eo = xl ? () => window.performance.now() : () => Date.now(), zl = xl ? (e) => requestAnimationFrame(e) : kt; +const Gt = /* @__PURE__ */ new Set(); +function Vl(e) { + Gt.forEach((t) => { + t.c(e) || (Gt.delete(t), t.f()); + }), Gt.size !== 0 && zl(Vl); +} +function hc(e) { + let t; + return Gt.size === 0 && zl(Vl), { + promise: new Promise((n) => { + Gt.add(t = { c: e, f: n }); + }), + abort() { + Gt.delete(t); + } + }; +} +const Dt = []; +function mc(e, t) { + return { + subscribe: hn(e, t).subscribe + }; +} +function hn(e, t = kt) { + let n; + const r = /* @__PURE__ */ new Set(); + function i(u) { + if (dc(e, u) && (e = u, n)) { + const s = !Dt.length; + for (const a of r) + a[1](), Dt.push(a, e); + if (s) { + for (let a = 0; a < Dt.length; a += 2) + Dt[a][0](Dt[a + 1]); + Dt.length = 0; + } + } + } + function o(u) { + i(u(e)); + } + function l(u, s = kt) { + const a = [u, s]; + return r.add(a), r.size === 1 && (n = t(i, o) || kt), u(e), () => { + r.delete(a), r.size === 0 && n && (n(), n = null); + }; + } + return { set: i, update: o, subscribe: l }; +} +function Qt(e, t, n) { + const r = !Array.isArray(e), i = r ? [e] : e; + if (!i.every(Boolean)) + throw new Error("derived() expects stores as input, got a falsy value"); + const o = t.length < 2; + return mc(n, (l, u) => { + let s = !1; + const a = []; + let f = 0, d = kt; + const c = () => { + if (f) + return; + d(); + const _ = t(r ? a[0] : a, l, u); + o ? l(_) : d = cc(_) ? _ : kt; + }, h = i.map( + (_, m) => _c( + _, + (g) => { + a[m] = g, f &= ~(1 << m), s && c(); + }, + () => { + f |= 1 << m; + } + ) + ); + return s = !0, c(), function() { + fc(h), d(), s = !1; + }; + }); +} +function to(e) { + return Object.prototype.toString.call(e) === "[object Date]"; +} +function Kr(e, t, n, r) { + if (typeof n == "number" || to(n)) { + const i = r - n, o = (n - t) / (e.dt || 1 / 60), l = e.opts.stiffness * i, u = e.opts.damping * o, s = (l - u) * e.inv_mass, a = (o + s) * e.dt; + return Math.abs(a) < e.opts.precision && Math.abs(i) < e.opts.precision ? r : (e.settled = !1, to(n) ? new Date(n.getTime() + a) : n + a); + } else { + if (Array.isArray(n)) + return n.map( + (i, o) => Kr(e, t[o], n[o], r[o]) + ); + if (typeof n == "object") { + const i = {}; + for (const o in n) + i[o] = Kr(e, t[o], n[o], r[o]); + return i; + } else + throw new Error(`Cannot spring ${typeof n} values`); + } +} +function no(e, t = {}) { + const n = hn(e), { stiffness: r = 0.15, damping: i = 0.8, precision: o = 0.01 } = t; + let l, u, s, a = e, f = e, d = 1, c = 0, h = !1; + function _(g, p = {}) { + f = g; + const v = s = {}; + return e == null || p.hard || m.stiffness >= 1 && m.damping >= 1 ? (h = !0, l = eo(), a = g, n.set(e = f), Promise.resolve()) : (p.soft && (c = 1 / ((p.soft === !0 ? 0.5 : +p.soft) * 60), d = 0), u || (l = eo(), h = !1, u = hc((b) => { + if (h) + return h = !1, u = null, !1; + d = Math.min(d + c, 1); + const w = { + inv_mass: d, + opts: m, + settled: !0, + dt: (b - l) * 60 / 1e3 + }, y = Kr(w, a, e, f); + return l = b, a = e, n.set(e = y), w.settled && (u = null), !w.settled; + })), new Promise((b) => { + u.promise.then(() => { + v === s && b(); + }); + })); + } + const m = { + set: _, + update: (g, p) => _(g(f, e), p), + subscribe: n.subscribe, + stiffness: r, + damping: i, + precision: o + }; + return m; +} +function pc(e) { + return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; +} +var gc = function(t) { + return bc(t) && !wc(t); +}; +function bc(e) { + return !!e && typeof e == "object"; +} +function wc(e) { + var t = Object.prototype.toString.call(e); + return t === "[object RegExp]" || t === "[object Date]" || Ec(e); +} +var vc = typeof Symbol == "function" && Symbol.for, yc = vc ? Symbol.for("react.element") : 60103; +function Ec(e) { + return e.$$typeof === yc; +} +function Sc(e) { + return Array.isArray(e) ? [] : {}; +} +function an(e, t) { + return t.clone !== !1 && t.isMergeableObject(e) ? jt(Sc(e), e, t) : e; +} +function kc(e, t, n) { + return e.concat(t).map(function(r) { + return an(r, n); + }); +} +function Tc(e, t) { + if (!t.customMerge) + return jt; + var n = t.customMerge(e); + return typeof n == "function" ? n : jt; +} +function Ac(e) { + return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(e).filter(function(t) { + return Object.propertyIsEnumerable.call(e, t); + }) : []; +} +function ro(e) { + return Object.keys(e).concat(Ac(e)); +} +function Xl(e, t) { + try { + return t in e; + } catch { + return !1; + } +} +function Bc(e, t) { + return Xl(e, t) && !(Object.hasOwnProperty.call(e, t) && Object.propertyIsEnumerable.call(e, t)); +} +function Cc(e, t, n) { + var r = {}; + return n.isMergeableObject(e) && ro(e).forEach(function(i) { + r[i] = an(e[i], n); + }), ro(t).forEach(function(i) { + Bc(e, i) || (Xl(e, i) && n.isMergeableObject(t[i]) ? r[i] = Tc(i, n)(e[i], t[i], n) : r[i] = an(t[i], n)); + }), r; +} +function jt(e, t, n) { + n = n || {}, n.arrayMerge = n.arrayMerge || kc, n.isMergeableObject = n.isMergeableObject || gc, n.cloneUnlessOtherwiseSpecified = an; + var r = Array.isArray(t), i = Array.isArray(e), o = r === i; + return o ? r ? n.arrayMerge(e, t, n) : Cc(e, t, n) : an(t, n); +} +jt.all = function(t, n) { + if (!Array.isArray(t)) + throw new Error("first argument should be an array"); + return t.reduce(function(r, i) { + return jt(r, i, n); + }, {}); +}; +var Ic = jt, Lc = Ic; +const Pc = /* @__PURE__ */ pc(Lc); +var $r = function(e, t) { + return $r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) { + n.__proto__ = r; + } || function(n, r) { + for (var i in r) + Object.prototype.hasOwnProperty.call(r, i) && (n[i] = r[i]); + }, $r(e, t); +}; +function tr(e, t) { + if (typeof t != "function" && t !== null) + throw new TypeError("Class extends value " + String(t) + " is not a constructor or null"); + $r(e, t); + function n() { + this.constructor = e; + } + e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n()); +} +var $ = function() { + return $ = Object.assign || function(t) { + for (var n, r = 1, i = arguments.length; r < i; r++) { + n = arguments[r]; + for (var o in n) + Object.prototype.hasOwnProperty.call(n, o) && (t[o] = n[o]); + } + return t; + }, $.apply(this, arguments); +}; +function Pr(e, t, n) { + if (n || arguments.length === 2) + for (var r = 0, i = t.length, o; r < i; r++) + (o || !(r in t)) && (o || (o = Array.prototype.slice.call(t, 0, r)), o[r] = t[r]); + return e.concat(o || Array.prototype.slice.call(t)); +} +var V; +(function(e) { + e[e.EXPECT_ARGUMENT_CLOSING_BRACE = 1] = "EXPECT_ARGUMENT_CLOSING_BRACE", e[e.EMPTY_ARGUMENT = 2] = "EMPTY_ARGUMENT", e[e.MALFORMED_ARGUMENT = 3] = "MALFORMED_ARGUMENT", e[e.EXPECT_ARGUMENT_TYPE = 4] = "EXPECT_ARGUMENT_TYPE", e[e.INVALID_ARGUMENT_TYPE = 5] = "INVALID_ARGUMENT_TYPE", e[e.EXPECT_ARGUMENT_STYLE = 6] = "EXPECT_ARGUMENT_STYLE", e[e.INVALID_NUMBER_SKELETON = 7] = "INVALID_NUMBER_SKELETON", e[e.INVALID_DATE_TIME_SKELETON = 8] = "INVALID_DATE_TIME_SKELETON", e[e.EXPECT_NUMBER_SKELETON = 9] = "EXPECT_NUMBER_SKELETON", e[e.EXPECT_DATE_TIME_SKELETON = 10] = "EXPECT_DATE_TIME_SKELETON", e[e.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE = 11] = "UNCLOSED_QUOTE_IN_ARGUMENT_STYLE", e[e.EXPECT_SELECT_ARGUMENT_OPTIONS = 12] = "EXPECT_SELECT_ARGUMENT_OPTIONS", e[e.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE = 13] = "EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE", e[e.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE = 14] = "INVALID_PLURAL_ARGUMENT_OFFSET_VALUE", e[e.EXPECT_SELECT_ARGUMENT_SELECTOR = 15] = "EXPECT_SELECT_ARGUMENT_SELECTOR", e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR = 16] = "EXPECT_PLURAL_ARGUMENT_SELECTOR", e[e.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT = 17] = "EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT", e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT = 18] = "EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT", e[e.INVALID_PLURAL_ARGUMENT_SELECTOR = 19] = "INVALID_PLURAL_ARGUMENT_SELECTOR", e[e.DUPLICATE_PLURAL_ARGUMENT_SELECTOR = 20] = "DUPLICATE_PLURAL_ARGUMENT_SELECTOR", e[e.DUPLICATE_SELECT_ARGUMENT_SELECTOR = 21] = "DUPLICATE_SELECT_ARGUMENT_SELECTOR", e[e.MISSING_OTHER_CLAUSE = 22] = "MISSING_OTHER_CLAUSE", e[e.INVALID_TAG = 23] = "INVALID_TAG", e[e.INVALID_TAG_NAME = 25] = "INVALID_TAG_NAME", e[e.UNMATCHED_CLOSING_TAG = 26] = "UNMATCHED_CLOSING_TAG", e[e.UNCLOSED_TAG = 27] = "UNCLOSED_TAG"; +})(V || (V = {})); +var ae; +(function(e) { + e[e.literal = 0] = "literal", e[e.argument = 1] = "argument", e[e.number = 2] = "number", e[e.date = 3] = "date", e[e.time = 4] = "time", e[e.select = 5] = "select", e[e.plural = 6] = "plural", e[e.pound = 7] = "pound", e[e.tag = 8] = "tag"; +})(ae || (ae = {})); +var xt; +(function(e) { + e[e.number = 0] = "number", e[e.dateTime = 1] = "dateTime"; +})(xt || (xt = {})); +function io(e) { + return e.type === ae.literal; +} +function Oc(e) { + return e.type === ae.argument; +} +function Wl(e) { + return e.type === ae.number; +} +function Zl(e) { + return e.type === ae.date; +} +function Jl(e) { + return e.type === ae.time; +} +function Ql(e) { + return e.type === ae.select; +} +function Yl(e) { + return e.type === ae.plural; +} +function Hc(e) { + return e.type === ae.pound; +} +function Kl(e) { + return e.type === ae.tag; +} +function $l(e) { + return !!(e && typeof e == "object" && e.type === xt.number); +} +function ei(e) { + return !!(e && typeof e == "object" && e.type === xt.dateTime); +} +var es = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/, Nc = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g; +function Mc(e) { + var t = {}; + return e.replace(Nc, function(n) { + var r = n.length; + switch (n[0]) { + case "G": + t.era = r === 4 ? "long" : r === 5 ? "narrow" : "short"; + break; + case "y": + t.year = r === 2 ? "2-digit" : "numeric"; + break; + case "Y": + case "u": + case "U": + case "r": + throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead"); + case "q": + case "Q": + throw new RangeError("`q/Q` (quarter) patterns are not supported"); + case "M": + case "L": + t.month = ["numeric", "2-digit", "short", "long", "narrow"][r - 1]; + break; + case "w": + case "W": + throw new RangeError("`w/W` (week) patterns are not supported"); + case "d": + t.day = ["numeric", "2-digit"][r - 1]; + break; + case "D": + case "F": + case "g": + throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead"); + case "E": + t.weekday = r === 4 ? "short" : r === 5 ? "narrow" : "short"; + break; + case "e": + if (r < 4) + throw new RangeError("`e..eee` (weekday) patterns are not supported"); + t.weekday = ["short", "long", "narrow", "short"][r - 4]; + break; + case "c": + if (r < 4) + throw new RangeError("`c..ccc` (weekday) patterns are not supported"); + t.weekday = ["short", "long", "narrow", "short"][r - 4]; + break; + case "a": + t.hour12 = !0; + break; + case "b": + case "B": + throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead"); + case "h": + t.hourCycle = "h12", t.hour = ["numeric", "2-digit"][r - 1]; + break; + case "H": + t.hourCycle = "h23", t.hour = ["numeric", "2-digit"][r - 1]; + break; + case "K": + t.hourCycle = "h11", t.hour = ["numeric", "2-digit"][r - 1]; + break; + case "k": + t.hourCycle = "h24", t.hour = ["numeric", "2-digit"][r - 1]; + break; + case "j": + case "J": + case "C": + throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead"); + case "m": + t.minute = ["numeric", "2-digit"][r - 1]; + break; + case "s": + t.second = ["numeric", "2-digit"][r - 1]; + break; + case "S": + case "A": + throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead"); + case "z": + t.timeZoneName = r < 4 ? "short" : "long"; + break; + case "Z": + case "O": + case "v": + case "V": + case "X": + case "x": + throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead"); + } + return ""; + }), t; +} +var Dc = /[\t-\r \x85\u200E\u200F\u2028\u2029]/i; +function Rc(e) { + if (e.length === 0) + throw new Error("Number skeleton cannot be empty"); + for (var t = e.split(Dc).filter(function(c) { + return c.length > 0; + }), n = [], r = 0, i = t; r < i.length; r++) { + var o = i[r], l = o.split("/"); + if (l.length === 0) + throw new Error("Invalid number skeleton"); + for (var u = l[0], s = l.slice(1), a = 0, f = s; a < f.length; a++) { + var d = f[a]; + if (d.length === 0) + throw new Error("Invalid number skeleton"); + } + n.push({ stem: u, options: s }); + } + return n; +} +function Uc(e) { + return e.replace(/^(.*?)-/, ""); +} +var oo = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g, ts = /^(@+)?(\+|#+)?[rs]?$/g, Fc = /(\*)(0+)|(#+)(0+)|(0+)/g, ns = /^(0+)$/; +function lo(e) { + var t = {}; + return e[e.length - 1] === "r" ? t.roundingPriority = "morePrecision" : e[e.length - 1] === "s" && (t.roundingPriority = "lessPrecision"), e.replace(ts, function(n, r, i) { + return typeof i != "string" ? (t.minimumSignificantDigits = r.length, t.maximumSignificantDigits = r.length) : i === "+" ? t.minimumSignificantDigits = r.length : r[0] === "#" ? t.maximumSignificantDigits = r.length : (t.minimumSignificantDigits = r.length, t.maximumSignificantDigits = r.length + (typeof i == "string" ? i.length : 0)), ""; + }), t; +} +function rs(e) { + switch (e) { + case "sign-auto": + return { + signDisplay: "auto" + }; + case "sign-accounting": + case "()": + return { + currencySign: "accounting" + }; + case "sign-always": + case "+!": + return { + signDisplay: "always" + }; + case "sign-accounting-always": + case "()!": + return { + signDisplay: "always", + currencySign: "accounting" + }; + case "sign-except-zero": + case "+?": + return { + signDisplay: "exceptZero" + }; + case "sign-accounting-except-zero": + case "()?": + return { + signDisplay: "exceptZero", + currencySign: "accounting" + }; + case "sign-never": + case "+_": + return { + signDisplay: "never" + }; + } +} +function Gc(e) { + var t; + if (e[0] === "E" && e[1] === "E" ? (t = { + notation: "engineering" + }, e = e.slice(2)) : e[0] === "E" && (t = { + notation: "scientific" + }, e = e.slice(1)), t) { + var n = e.slice(0, 2); + if (n === "+!" ? (t.signDisplay = "always", e = e.slice(2)) : n === "+?" && (t.signDisplay = "exceptZero", e = e.slice(2)), !ns.test(e)) + throw new Error("Malformed concise eng/scientific notation"); + t.minimumIntegerDigits = e.length; + } + return t; +} +function so(e) { + var t = {}, n = rs(e); + return n || t; +} +function qc(e) { + for (var t = {}, n = 0, r = e; n < r.length; n++) { + var i = r[n]; + switch (i.stem) { + case "percent": + case "%": + t.style = "percent"; + continue; + case "%x100": + t.style = "percent", t.scale = 100; + continue; + case "currency": + t.style = "currency", t.currency = i.options[0]; + continue; + case "group-off": + case ",_": + t.useGrouping = !1; + continue; + case "precision-integer": + case ".": + t.maximumFractionDigits = 0; + continue; + case "measure-unit": + case "unit": + t.style = "unit", t.unit = Uc(i.options[0]); + continue; + case "compact-short": + case "K": + t.notation = "compact", t.compactDisplay = "short"; + continue; + case "compact-long": + case "KK": + t.notation = "compact", t.compactDisplay = "long"; + continue; + case "scientific": + t = $($($({}, t), { notation: "scientific" }), i.options.reduce(function(s, a) { + return $($({}, s), so(a)); + }, {})); + continue; + case "engineering": + t = $($($({}, t), { notation: "engineering" }), i.options.reduce(function(s, a) { + return $($({}, s), so(a)); + }, {})); + continue; + case "notation-simple": + t.notation = "standard"; + continue; + case "unit-width-narrow": + t.currencyDisplay = "narrowSymbol", t.unitDisplay = "narrow"; + continue; + case "unit-width-short": + t.currencyDisplay = "code", t.unitDisplay = "short"; + continue; + case "unit-width-full-name": + t.currencyDisplay = "name", t.unitDisplay = "long"; + continue; + case "unit-width-iso-code": + t.currencyDisplay = "symbol"; + continue; + case "scale": + t.scale = parseFloat(i.options[0]); + continue; + case "integer-width": + if (i.options.length > 1) + throw new RangeError("integer-width stems only accept a single optional option"); + i.options[0].replace(Fc, function(s, a, f, d, c, h) { + if (a) + t.minimumIntegerDigits = f.length; + else { + if (d && c) + throw new Error("We currently do not support maximum integer digits"); + if (h) + throw new Error("We currently do not support exact integer digits"); + } + return ""; + }); + continue; + } + if (ns.test(i.stem)) { + t.minimumIntegerDigits = i.stem.length; + continue; + } + if (oo.test(i.stem)) { + if (i.options.length > 1) + throw new RangeError("Fraction-precision stems only accept a single optional option"); + i.stem.replace(oo, function(s, a, f, d, c, h) { + return f === "*" ? t.minimumFractionDigits = a.length : d && d[0] === "#" ? t.maximumFractionDigits = d.length : c && h ? (t.minimumFractionDigits = c.length, t.maximumFractionDigits = c.length + h.length) : (t.minimumFractionDigits = a.length, t.maximumFractionDigits = a.length), ""; + }); + var o = i.options[0]; + o === "w" ? t = $($({}, t), { trailingZeroDisplay: "stripIfInteger" }) : o && (t = $($({}, t), lo(o))); + continue; + } + if (ts.test(i.stem)) { + t = $($({}, t), lo(i.stem)); + continue; + } + var l = rs(i.stem); + l && (t = $($({}, t), l)); + var u = Gc(i.stem); + u && (t = $($({}, t), u)); + } + return t; +} +var Pn = { + AX: [ + "H" + ], + BQ: [ + "H" + ], + CP: [ + "H" + ], + CZ: [ + "H" + ], + DK: [ + "H" + ], + FI: [ + "H" + ], + ID: [ + "H" + ], + IS: [ + "H" + ], + ML: [ + "H" + ], + NE: [ + "H" + ], + RU: [ + "H" + ], + SE: [ + "H" + ], + SJ: [ + "H" + ], + SK: [ + "H" + ], + AS: [ + "h", + "H" + ], + BT: [ + "h", + "H" + ], + DJ: [ + "h", + "H" + ], + ER: [ + "h", + "H" + ], + GH: [ + "h", + "H" + ], + IN: [ + "h", + "H" + ], + LS: [ + "h", + "H" + ], + PG: [ + "h", + "H" + ], + PW: [ + "h", + "H" + ], + SO: [ + "h", + "H" + ], + TO: [ + "h", + "H" + ], + VU: [ + "h", + "H" + ], + WS: [ + "h", + "H" + ], + "001": [ + "H", + "h" + ], + AL: [ + "h", + "H", + "hB" + ], + TD: [ + "h", + "H", + "hB" + ], + "ca-ES": [ + "H", + "h", + "hB" + ], + CF: [ + "H", + "h", + "hB" + ], + CM: [ + "H", + "h", + "hB" + ], + "fr-CA": [ + "H", + "h", + "hB" + ], + "gl-ES": [ + "H", + "h", + "hB" + ], + "it-CH": [ + "H", + "h", + "hB" + ], + "it-IT": [ + "H", + "h", + "hB" + ], + LU: [ + "H", + "h", + "hB" + ], + NP: [ + "H", + "h", + "hB" + ], + PF: [ + "H", + "h", + "hB" + ], + SC: [ + "H", + "h", + "hB" + ], + SM: [ + "H", + "h", + "hB" + ], + SN: [ + "H", + "h", + "hB" + ], + TF: [ + "H", + "h", + "hB" + ], + VA: [ + "H", + "h", + "hB" + ], + CY: [ + "h", + "H", + "hb", + "hB" + ], + GR: [ + "h", + "H", + "hb", + "hB" + ], + CO: [ + "h", + "H", + "hB", + "hb" + ], + DO: [ + "h", + "H", + "hB", + "hb" + ], + KP: [ + "h", + "H", + "hB", + "hb" + ], + KR: [ + "h", + "H", + "hB", + "hb" + ], + NA: [ + "h", + "H", + "hB", + "hb" + ], + PA: [ + "h", + "H", + "hB", + "hb" + ], + PR: [ + "h", + "H", + "hB", + "hb" + ], + VE: [ + "h", + "H", + "hB", + "hb" + ], + AC: [ + "H", + "h", + "hb", + "hB" + ], + AI: [ + "H", + "h", + "hb", + "hB" + ], + BW: [ + "H", + "h", + "hb", + "hB" + ], + BZ: [ + "H", + "h", + "hb", + "hB" + ], + CC: [ + "H", + "h", + "hb", + "hB" + ], + CK: [ + "H", + "h", + "hb", + "hB" + ], + CX: [ + "H", + "h", + "hb", + "hB" + ], + DG: [ + "H", + "h", + "hb", + "hB" + ], + FK: [ + "H", + "h", + "hb", + "hB" + ], + GB: [ + "H", + "h", + "hb", + "hB" + ], + GG: [ + "H", + "h", + "hb", + "hB" + ], + GI: [ + "H", + "h", + "hb", + "hB" + ], + IE: [ + "H", + "h", + "hb", + "hB" + ], + IM: [ + "H", + "h", + "hb", + "hB" + ], + IO: [ + "H", + "h", + "hb", + "hB" + ], + JE: [ + "H", + "h", + "hb", + "hB" + ], + LT: [ + "H", + "h", + "hb", + "hB" + ], + MK: [ + "H", + "h", + "hb", + "hB" + ], + MN: [ + "H", + "h", + "hb", + "hB" + ], + MS: [ + "H", + "h", + "hb", + "hB" + ], + NF: [ + "H", + "h", + "hb", + "hB" + ], + NG: [ + "H", + "h", + "hb", + "hB" + ], + NR: [ + "H", + "h", + "hb", + "hB" + ], + NU: [ + "H", + "h", + "hb", + "hB" + ], + PN: [ + "H", + "h", + "hb", + "hB" + ], + SH: [ + "H", + "h", + "hb", + "hB" + ], + SX: [ + "H", + "h", + "hb", + "hB" + ], + TA: [ + "H", + "h", + "hb", + "hB" + ], + ZA: [ + "H", + "h", + "hb", + "hB" + ], + "af-ZA": [ + "H", + "h", + "hB", + "hb" + ], + AR: [ + "H", + "h", + "hB", + "hb" + ], + CL: [ + "H", + "h", + "hB", + "hb" + ], + CR: [ + "H", + "h", + "hB", + "hb" + ], + CU: [ + "H", + "h", + "hB", + "hb" + ], + EA: [ + "H", + "h", + "hB", + "hb" + ], + "es-BO": [ + "H", + "h", + "hB", + "hb" + ], + "es-BR": [ + "H", + "h", + "hB", + "hb" + ], + "es-EC": [ + "H", + "h", + "hB", + "hb" + ], + "es-ES": [ + "H", + "h", + "hB", + "hb" + ], + "es-GQ": [ + "H", + "h", + "hB", + "hb" + ], + "es-PE": [ + "H", + "h", + "hB", + "hb" + ], + GT: [ + "H", + "h", + "hB", + "hb" + ], + HN: [ + "H", + "h", + "hB", + "hb" + ], + IC: [ + "H", + "h", + "hB", + "hb" + ], + KG: [ + "H", + "h", + "hB", + "hb" + ], + KM: [ + "H", + "h", + "hB", + "hb" + ], + LK: [ + "H", + "h", + "hB", + "hb" + ], + MA: [ + "H", + "h", + "hB", + "hb" + ], + MX: [ + "H", + "h", + "hB", + "hb" + ], + NI: [ + "H", + "h", + "hB", + "hb" + ], + PY: [ + "H", + "h", + "hB", + "hb" + ], + SV: [ + "H", + "h", + "hB", + "hb" + ], + UY: [ + "H", + "h", + "hB", + "hb" + ], + JP: [ + "H", + "h", + "K" + ], + AD: [ + "H", + "hB" + ], + AM: [ + "H", + "hB" + ], + AO: [ + "H", + "hB" + ], + AT: [ + "H", + "hB" + ], + AW: [ + "H", + "hB" + ], + BE: [ + "H", + "hB" + ], + BF: [ + "H", + "hB" + ], + BJ: [ + "H", + "hB" + ], + BL: [ + "H", + "hB" + ], + BR: [ + "H", + "hB" + ], + CG: [ + "H", + "hB" + ], + CI: [ + "H", + "hB" + ], + CV: [ + "H", + "hB" + ], + DE: [ + "H", + "hB" + ], + EE: [ + "H", + "hB" + ], + FR: [ + "H", + "hB" + ], + GA: [ + "H", + "hB" + ], + GF: [ + "H", + "hB" + ], + GN: [ + "H", + "hB" + ], + GP: [ + "H", + "hB" + ], + GW: [ + "H", + "hB" + ], + HR: [ + "H", + "hB" + ], + IL: [ + "H", + "hB" + ], + IT: [ + "H", + "hB" + ], + KZ: [ + "H", + "hB" + ], + MC: [ + "H", + "hB" + ], + MD: [ + "H", + "hB" + ], + MF: [ + "H", + "hB" + ], + MQ: [ + "H", + "hB" + ], + MZ: [ + "H", + "hB" + ], + NC: [ + "H", + "hB" + ], + NL: [ + "H", + "hB" + ], + PM: [ + "H", + "hB" + ], + PT: [ + "H", + "hB" + ], + RE: [ + "H", + "hB" + ], + RO: [ + "H", + "hB" + ], + SI: [ + "H", + "hB" + ], + SR: [ + "H", + "hB" + ], + ST: [ + "H", + "hB" + ], + TG: [ + "H", + "hB" + ], + TR: [ + "H", + "hB" + ], + WF: [ + "H", + "hB" + ], + YT: [ + "H", + "hB" + ], + BD: [ + "h", + "hB", + "H" + ], + PK: [ + "h", + "hB", + "H" + ], + AZ: [ + "H", + "hB", + "h" + ], + BA: [ + "H", + "hB", + "h" + ], + BG: [ + "H", + "hB", + "h" + ], + CH: [ + "H", + "hB", + "h" + ], + GE: [ + "H", + "hB", + "h" + ], + LI: [ + "H", + "hB", + "h" + ], + ME: [ + "H", + "hB", + "h" + ], + RS: [ + "H", + "hB", + "h" + ], + UA: [ + "H", + "hB", + "h" + ], + UZ: [ + "H", + "hB", + "h" + ], + XK: [ + "H", + "hB", + "h" + ], + AG: [ + "h", + "hb", + "H", + "hB" + ], + AU: [ + "h", + "hb", + "H", + "hB" + ], + BB: [ + "h", + "hb", + "H", + "hB" + ], + BM: [ + "h", + "hb", + "H", + "hB" + ], + BS: [ + "h", + "hb", + "H", + "hB" + ], + CA: [ + "h", + "hb", + "H", + "hB" + ], + DM: [ + "h", + "hb", + "H", + "hB" + ], + "en-001": [ + "h", + "hb", + "H", + "hB" + ], + FJ: [ + "h", + "hb", + "H", + "hB" + ], + FM: [ + "h", + "hb", + "H", + "hB" + ], + GD: [ + "h", + "hb", + "H", + "hB" + ], + GM: [ + "h", + "hb", + "H", + "hB" + ], + GU: [ + "h", + "hb", + "H", + "hB" + ], + GY: [ + "h", + "hb", + "H", + "hB" + ], + JM: [ + "h", + "hb", + "H", + "hB" + ], + KI: [ + "h", + "hb", + "H", + "hB" + ], + KN: [ + "h", + "hb", + "H", + "hB" + ], + KY: [ + "h", + "hb", + "H", + "hB" + ], + LC: [ + "h", + "hb", + "H", + "hB" + ], + LR: [ + "h", + "hb", + "H", + "hB" + ], + MH: [ + "h", + "hb", + "H", + "hB" + ], + MP: [ + "h", + "hb", + "H", + "hB" + ], + MW: [ + "h", + "hb", + "H", + "hB" + ], + NZ: [ + "h", + "hb", + "H", + "hB" + ], + SB: [ + "h", + "hb", + "H", + "hB" + ], + SG: [ + "h", + "hb", + "H", + "hB" + ], + SL: [ + "h", + "hb", + "H", + "hB" + ], + SS: [ + "h", + "hb", + "H", + "hB" + ], + SZ: [ + "h", + "hb", + "H", + "hB" + ], + TC: [ + "h", + "hb", + "H", + "hB" + ], + TT: [ + "h", + "hb", + "H", + "hB" + ], + UM: [ + "h", + "hb", + "H", + "hB" + ], + US: [ + "h", + "hb", + "H", + "hB" + ], + VC: [ + "h", + "hb", + "H", + "hB" + ], + VG: [ + "h", + "hb", + "H", + "hB" + ], + VI: [ + "h", + "hb", + "H", + "hB" + ], + ZM: [ + "h", + "hb", + "H", + "hB" + ], + BO: [ + "H", + "hB", + "h", + "hb" + ], + EC: [ + "H", + "hB", + "h", + "hb" + ], + ES: [ + "H", + "hB", + "h", + "hb" + ], + GQ: [ + "H", + "hB", + "h", + "hb" + ], + PE: [ + "H", + "hB", + "h", + "hb" + ], + AE: [ + "h", + "hB", + "hb", + "H" + ], + "ar-001": [ + "h", + "hB", + "hb", + "H" + ], + BH: [ + "h", + "hB", + "hb", + "H" + ], + DZ: [ + "h", + "hB", + "hb", + "H" + ], + EG: [ + "h", + "hB", + "hb", + "H" + ], + EH: [ + "h", + "hB", + "hb", + "H" + ], + HK: [ + "h", + "hB", + "hb", + "H" + ], + IQ: [ + "h", + "hB", + "hb", + "H" + ], + JO: [ + "h", + "hB", + "hb", + "H" + ], + KW: [ + "h", + "hB", + "hb", + "H" + ], + LB: [ + "h", + "hB", + "hb", + "H" + ], + LY: [ + "h", + "hB", + "hb", + "H" + ], + MO: [ + "h", + "hB", + "hb", + "H" + ], + MR: [ + "h", + "hB", + "hb", + "H" + ], + OM: [ + "h", + "hB", + "hb", + "H" + ], + PH: [ + "h", + "hB", + "hb", + "H" + ], + PS: [ + "h", + "hB", + "hb", + "H" + ], + QA: [ + "h", + "hB", + "hb", + "H" + ], + SA: [ + "h", + "hB", + "hb", + "H" + ], + SD: [ + "h", + "hB", + "hb", + "H" + ], + SY: [ + "h", + "hB", + "hb", + "H" + ], + TN: [ + "h", + "hB", + "hb", + "H" + ], + YE: [ + "h", + "hB", + "hb", + "H" + ], + AF: [ + "H", + "hb", + "hB", + "h" + ], + LA: [ + "H", + "hb", + "hB", + "h" + ], + CN: [ + "H", + "hB", + "hb", + "h" + ], + LV: [ + "H", + "hB", + "hb", + "h" + ], + TL: [ + "H", + "hB", + "hb", + "h" + ], + "zu-ZA": [ + "H", + "hB", + "hb", + "h" + ], + CD: [ + "hB", + "H" + ], + IR: [ + "hB", + "H" + ], + "hi-IN": [ + "hB", + "h", + "H" + ], + "kn-IN": [ + "hB", + "h", + "H" + ], + "ml-IN": [ + "hB", + "h", + "H" + ], + "te-IN": [ + "hB", + "h", + "H" + ], + KH: [ + "hB", + "h", + "H", + "hb" + ], + "ta-IN": [ + "hB", + "h", + "hb", + "H" + ], + BN: [ + "hb", + "hB", + "h", + "H" + ], + MY: [ + "hb", + "hB", + "h", + "H" + ], + ET: [ + "hB", + "hb", + "h", + "H" + ], + "gu-IN": [ + "hB", + "hb", + "h", + "H" + ], + "mr-IN": [ + "hB", + "hb", + "h", + "H" + ], + "pa-IN": [ + "hB", + "hb", + "h", + "H" + ], + TW: [ + "hB", + "hb", + "h", + "H" + ], + KE: [ + "hB", + "hb", + "H", + "h" + ], + MM: [ + "hB", + "hb", + "H", + "h" + ], + TZ: [ + "hB", + "hb", + "H", + "h" + ], + UG: [ + "hB", + "hb", + "H", + "h" + ] +}; +function jc(e, t) { + for (var n = "", r = 0; r < e.length; r++) { + var i = e.charAt(r); + if (i === "j") { + for (var o = 0; r + 1 < e.length && e.charAt(r + 1) === i; ) + o++, r++; + var l = 1 + (o & 1), u = o < 2 ? 1 : 3 + (o >> 1), s = "a", a = xc(t); + for ((a == "H" || a == "k") && (u = 0); u-- > 0; ) + n += s; + for (; l-- > 0; ) + n = a + n; + } else + i === "J" ? n += "H" : n += i; + } + return n; +} +function xc(e) { + var t = e.hourCycle; + if (t === void 0 && // @ts-ignore hourCycle(s) is not identified yet + e.hourCycles && // @ts-ignore + e.hourCycles.length && (t = e.hourCycles[0]), t) + switch (t) { + case "h24": + return "k"; + case "h23": + return "H"; + case "h12": + return "h"; + case "h11": + return "K"; + default: + throw new Error("Invalid hourCycle"); + } + var n = e.language, r; + n !== "root" && (r = e.maximize().region); + var i = Pn[r || ""] || Pn[n || ""] || Pn["".concat(n, "-001")] || Pn["001"]; + return i[0]; +} +var Or, zc = new RegExp("^".concat(es.source, "*")), Vc = new RegExp("".concat(es.source, "*$")); +function X(e, t) { + return { start: e, end: t }; +} +var Xc = !!String.prototype.startsWith, Wc = !!String.fromCodePoint, Zc = !!Object.fromEntries, Jc = !!String.prototype.codePointAt, Qc = !!String.prototype.trimStart, Yc = !!String.prototype.trimEnd, Kc = !!Number.isSafeInteger, $c = Kc ? Number.isSafeInteger : function(e) { + return typeof e == "number" && isFinite(e) && Math.floor(e) === e && Math.abs(e) <= 9007199254740991; +}, ti = !0; +try { + var e0 = os("([^\\p{White_Space}\\p{Pattern_Syntax}]*)", "yu"); + ti = ((Or = e0.exec("a")) === null || Or === void 0 ? void 0 : Or[0]) === "a"; +} catch { + ti = !1; +} +var ao = Xc ? ( + // Native + function(t, n, r) { + return t.startsWith(n, r); + } +) : ( + // For IE11 + function(t, n, r) { + return t.slice(r, r + n.length) === n; + } +), ni = Wc ? String.fromCodePoint : ( + // IE11 + function() { + for (var t = [], n = 0; n < arguments.length; n++) + t[n] = arguments[n]; + for (var r = "", i = t.length, o = 0, l; i > o; ) { + if (l = t[o++], l > 1114111) + throw RangeError(l + " is not a valid code point"); + r += l < 65536 ? String.fromCharCode(l) : String.fromCharCode(((l -= 65536) >> 10) + 55296, l % 1024 + 56320); + } + return r; + } +), uo = ( + // native + Zc ? Object.fromEntries : ( + // Ponyfill + function(t) { + for (var n = {}, r = 0, i = t; r < i.length; r++) { + var o = i[r], l = o[0], u = o[1]; + n[l] = u; + } + return n; + } + ) +), is = Jc ? ( + // Native + function(t, n) { + return t.codePointAt(n); + } +) : ( + // IE 11 + function(t, n) { + var r = t.length; + if (!(n < 0 || n >= r)) { + var i = t.charCodeAt(n), o; + return i < 55296 || i > 56319 || n + 1 === r || (o = t.charCodeAt(n + 1)) < 56320 || o > 57343 ? i : (i - 55296 << 10) + (o - 56320) + 65536; + } + } +), t0 = Qc ? ( + // Native + function(t) { + return t.trimStart(); + } +) : ( + // Ponyfill + function(t) { + return t.replace(zc, ""); + } +), n0 = Yc ? ( + // Native + function(t) { + return t.trimEnd(); + } +) : ( + // Ponyfill + function(t) { + return t.replace(Vc, ""); + } +); +function os(e, t) { + return new RegExp(e, t); +} +var ri; +if (ti) { + var fo = os("([^\\p{White_Space}\\p{Pattern_Syntax}]*)", "yu"); + ri = function(t, n) { + var r; + fo.lastIndex = n; + var i = fo.exec(t); + return (r = i[1]) !== null && r !== void 0 ? r : ""; + }; +} else + ri = function(t, n) { + for (var r = []; ; ) { + var i = is(t, n); + if (i === void 0 || ls(i) || l0(i)) + break; + r.push(i), n += i >= 65536 ? 2 : 1; + } + return ni.apply(void 0, r); + }; +var r0 = ( + /** @class */ + function() { + function e(t, n) { + n === void 0 && (n = {}), this.message = t, this.position = { offset: 0, line: 1, column: 1 }, this.ignoreTag = !!n.ignoreTag, this.locale = n.locale, this.requiresOtherClause = !!n.requiresOtherClause, this.shouldParseSkeletons = !!n.shouldParseSkeletons; + } + return e.prototype.parse = function() { + if (this.offset() !== 0) + throw Error("parser can only be used once"); + return this.parseMessage(0, "", !1); + }, e.prototype.parseMessage = function(t, n, r) { + for (var i = []; !this.isEOF(); ) { + var o = this.char(); + if (o === 123) { + var l = this.parseArgument(t, r); + if (l.err) + return l; + i.push(l.val); + } else { + if (o === 125 && t > 0) + break; + if (o === 35 && (n === "plural" || n === "selectordinal")) { + var u = this.clonePosition(); + this.bump(), i.push({ + type: ae.pound, + location: X(u, this.clonePosition()) + }); + } else if (o === 60 && !this.ignoreTag && this.peek() === 47) { + if (r) + break; + return this.error(V.UNMATCHED_CLOSING_TAG, X(this.clonePosition(), this.clonePosition())); + } else if (o === 60 && !this.ignoreTag && ii(this.peek() || 0)) { + var l = this.parseTag(t, n); + if (l.err) + return l; + i.push(l.val); + } else { + var l = this.parseLiteral(t, n); + if (l.err) + return l; + i.push(l.val); + } + } + } + return { val: i, err: null }; + }, e.prototype.parseTag = function(t, n) { + var r = this.clonePosition(); + this.bump(); + var i = this.parseTagName(); + if (this.bumpSpace(), this.bumpIf("/>")) + return { + val: { + type: ae.literal, + value: "<".concat(i, "/>"), + location: X(r, this.clonePosition()) + }, + err: null + }; + if (this.bumpIf(">")) { + var o = this.parseMessage(t + 1, n, !0); + if (o.err) + return o; + var l = o.val, u = this.clonePosition(); + if (this.bumpIf("") ? { + val: { + type: ae.tag, + value: i, + children: l, + location: X(r, this.clonePosition()) + }, + err: null + } : this.error(V.INVALID_TAG, X(u, this.clonePosition()))); + } else + return this.error(V.UNCLOSED_TAG, X(r, this.clonePosition())); + } else + return this.error(V.INVALID_TAG, X(r, this.clonePosition())); + }, e.prototype.parseTagName = function() { + var t = this.offset(); + for (this.bump(); !this.isEOF() && o0(this.char()); ) + this.bump(); + return this.message.slice(t, this.offset()); + }, e.prototype.parseLiteral = function(t, n) { + for (var r = this.clonePosition(), i = ""; ; ) { + var o = this.tryParseQuote(n); + if (o) { + i += o; + continue; + } + var l = this.tryParseUnquoted(t, n); + if (l) { + i += l; + continue; + } + var u = this.tryParseLeftAngleBracket(); + if (u) { + i += u; + continue; + } + break; + } + var s = X(r, this.clonePosition()); + return { + val: { type: ae.literal, value: i, location: s }, + err: null + }; + }, e.prototype.tryParseLeftAngleBracket = function() { + return !this.isEOF() && this.char() === 60 && (this.ignoreTag || // If at the opening tag or closing tag position, bail. + !i0(this.peek() || 0)) ? (this.bump(), "<") : null; + }, e.prototype.tryParseQuote = function(t) { + if (this.isEOF() || this.char() !== 39) + return null; + switch (this.peek()) { + case 39: + return this.bump(), this.bump(), "'"; + case 123: + case 60: + case 62: + case 125: + break; + case 35: + if (t === "plural" || t === "selectordinal") + break; + return null; + default: + return null; + } + this.bump(); + var n = [this.char()]; + for (this.bump(); !this.isEOF(); ) { + var r = this.char(); + if (r === 39) + if (this.peek() === 39) + n.push(39), this.bump(); + else { + this.bump(); + break; + } + else + n.push(r); + this.bump(); + } + return ni.apply(void 0, n); + }, e.prototype.tryParseUnquoted = function(t, n) { + if (this.isEOF()) + return null; + var r = this.char(); + return r === 60 || r === 123 || r === 35 && (n === "plural" || n === "selectordinal") || r === 125 && t > 0 ? null : (this.bump(), ni(r)); + }, e.prototype.parseArgument = function(t, n) { + var r = this.clonePosition(); + if (this.bump(), this.bumpSpace(), this.isEOF()) + return this.error(V.EXPECT_ARGUMENT_CLOSING_BRACE, X(r, this.clonePosition())); + if (this.char() === 125) + return this.bump(), this.error(V.EMPTY_ARGUMENT, X(r, this.clonePosition())); + var i = this.parseIdentifierIfPossible().value; + if (!i) + return this.error(V.MALFORMED_ARGUMENT, X(r, this.clonePosition())); + if (this.bumpSpace(), this.isEOF()) + return this.error(V.EXPECT_ARGUMENT_CLOSING_BRACE, X(r, this.clonePosition())); + switch (this.char()) { + case 125: + return this.bump(), { + val: { + type: ae.argument, + // value does not include the opening and closing braces. + value: i, + location: X(r, this.clonePosition()) + }, + err: null + }; + case 44: + return this.bump(), this.bumpSpace(), this.isEOF() ? this.error(V.EXPECT_ARGUMENT_CLOSING_BRACE, X(r, this.clonePosition())) : this.parseArgumentOptions(t, n, i, r); + default: + return this.error(V.MALFORMED_ARGUMENT, X(r, this.clonePosition())); + } + }, e.prototype.parseIdentifierIfPossible = function() { + var t = this.clonePosition(), n = this.offset(), r = ri(this.message, n), i = n + r.length; + this.bumpTo(i); + var o = this.clonePosition(), l = X(t, o); + return { value: r, location: l }; + }, e.prototype.parseArgumentOptions = function(t, n, r, i) { + var o, l = this.clonePosition(), u = this.parseIdentifierIfPossible().value, s = this.clonePosition(); + switch (u) { + case "": + return this.error(V.EXPECT_ARGUMENT_TYPE, X(l, s)); + case "number": + case "date": + case "time": { + this.bumpSpace(); + var a = null; + if (this.bumpIf(",")) { + this.bumpSpace(); + var f = this.clonePosition(), d = this.parseSimpleArgStyleIfPossible(); + if (d.err) + return d; + var c = n0(d.val); + if (c.length === 0) + return this.error(V.EXPECT_ARGUMENT_STYLE, X(this.clonePosition(), this.clonePosition())); + var h = X(f, this.clonePosition()); + a = { style: c, styleLocation: h }; + } + var _ = this.tryParseArgumentClose(i); + if (_.err) + return _; + var m = X(i, this.clonePosition()); + if (a && ao(a == null ? void 0 : a.style, "::", 0)) { + var g = t0(a.style.slice(2)); + if (u === "number") { + var d = this.parseNumberSkeletonFromString(g, a.styleLocation); + return d.err ? d : { + val: { type: ae.number, value: r, location: m, style: d.val }, + err: null + }; + } else { + if (g.length === 0) + return this.error(V.EXPECT_DATE_TIME_SKELETON, m); + var p = g; + this.locale && (p = jc(g, this.locale)); + var c = { + type: xt.dateTime, + pattern: p, + location: a.styleLocation, + parsedOptions: this.shouldParseSkeletons ? Mc(p) : {} + }, v = u === "date" ? ae.date : ae.time; + return { + val: { type: v, value: r, location: m, style: c }, + err: null + }; + } + } + return { + val: { + type: u === "number" ? ae.number : u === "date" ? ae.date : ae.time, + value: r, + location: m, + style: (o = a == null ? void 0 : a.style) !== null && o !== void 0 ? o : null + }, + err: null + }; + } + case "plural": + case "selectordinal": + case "select": { + var b = this.clonePosition(); + if (this.bumpSpace(), !this.bumpIf(",")) + return this.error(V.EXPECT_SELECT_ARGUMENT_OPTIONS, X(b, $({}, b))); + this.bumpSpace(); + var w = this.parseIdentifierIfPossible(), y = 0; + if (u !== "select" && w.value === "offset") { + if (!this.bumpIf(":")) + return this.error(V.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, X(this.clonePosition(), this.clonePosition())); + this.bumpSpace(); + var d = this.tryParseDecimalInteger(V.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, V.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE); + if (d.err) + return d; + this.bumpSpace(), w = this.parseIdentifierIfPossible(), y = d.val; + } + var S = this.tryParsePluralOrSelectOptions(t, u, n, w); + if (S.err) + return S; + var _ = this.tryParseArgumentClose(i); + if (_.err) + return _; + var C = X(i, this.clonePosition()); + return u === "select" ? { + val: { + type: ae.select, + value: r, + options: uo(S.val), + location: C + }, + err: null + } : { + val: { + type: ae.plural, + value: r, + options: uo(S.val), + offset: y, + pluralType: u === "plural" ? "cardinal" : "ordinal", + location: C + }, + err: null + }; + } + default: + return this.error(V.INVALID_ARGUMENT_TYPE, X(l, s)); + } + }, e.prototype.tryParseArgumentClose = function(t) { + return this.isEOF() || this.char() !== 125 ? this.error(V.EXPECT_ARGUMENT_CLOSING_BRACE, X(t, this.clonePosition())) : (this.bump(), { val: !0, err: null }); + }, e.prototype.parseSimpleArgStyleIfPossible = function() { + for (var t = 0, n = this.clonePosition(); !this.isEOF(); ) { + var r = this.char(); + switch (r) { + case 39: { + this.bump(); + var i = this.clonePosition(); + if (!this.bumpUntil("'")) + return this.error(V.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE, X(i, this.clonePosition())); + this.bump(); + break; + } + case 123: { + t += 1, this.bump(); + break; + } + case 125: { + if (t > 0) + t -= 1; + else + return { + val: this.message.slice(n.offset, this.offset()), + err: null + }; + break; + } + default: + this.bump(); + break; + } + } + return { + val: this.message.slice(n.offset, this.offset()), + err: null + }; + }, e.prototype.parseNumberSkeletonFromString = function(t, n) { + var r = []; + try { + r = Rc(t); + } catch { + return this.error(V.INVALID_NUMBER_SKELETON, n); + } + return { + val: { + type: xt.number, + tokens: r, + location: n, + parsedOptions: this.shouldParseSkeletons ? qc(r) : {} + }, + err: null + }; + }, e.prototype.tryParsePluralOrSelectOptions = function(t, n, r, i) { + for (var o, l = !1, u = [], s = /* @__PURE__ */ new Set(), a = i.value, f = i.location; ; ) { + if (a.length === 0) { + var d = this.clonePosition(); + if (n !== "select" && this.bumpIf("=")) { + var c = this.tryParseDecimalInteger(V.EXPECT_PLURAL_ARGUMENT_SELECTOR, V.INVALID_PLURAL_ARGUMENT_SELECTOR); + if (c.err) + return c; + f = X(d, this.clonePosition()), a = this.message.slice(d.offset, this.offset()); + } else + break; + } + if (s.has(a)) + return this.error(n === "select" ? V.DUPLICATE_SELECT_ARGUMENT_SELECTOR : V.DUPLICATE_PLURAL_ARGUMENT_SELECTOR, f); + a === "other" && (l = !0), this.bumpSpace(); + var h = this.clonePosition(); + if (!this.bumpIf("{")) + return this.error(n === "select" ? V.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT : V.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT, X(this.clonePosition(), this.clonePosition())); + var _ = this.parseMessage(t + 1, n, r); + if (_.err) + return _; + var m = this.tryParseArgumentClose(h); + if (m.err) + return m; + u.push([ + a, + { + value: _.val, + location: X(h, this.clonePosition()) + } + ]), s.add(a), this.bumpSpace(), o = this.parseIdentifierIfPossible(), a = o.value, f = o.location; + } + return u.length === 0 ? this.error(n === "select" ? V.EXPECT_SELECT_ARGUMENT_SELECTOR : V.EXPECT_PLURAL_ARGUMENT_SELECTOR, X(this.clonePosition(), this.clonePosition())) : this.requiresOtherClause && !l ? this.error(V.MISSING_OTHER_CLAUSE, X(this.clonePosition(), this.clonePosition())) : { val: u, err: null }; + }, e.prototype.tryParseDecimalInteger = function(t, n) { + var r = 1, i = this.clonePosition(); + this.bumpIf("+") || this.bumpIf("-") && (r = -1); + for (var o = !1, l = 0; !this.isEOF(); ) { + var u = this.char(); + if (u >= 48 && u <= 57) + o = !0, l = l * 10 + (u - 48), this.bump(); + else + break; + } + var s = X(i, this.clonePosition()); + return o ? (l *= r, $c(l) ? { val: l, err: null } : this.error(n, s)) : this.error(t, s); + }, e.prototype.offset = function() { + return this.position.offset; + }, e.prototype.isEOF = function() { + return this.offset() === this.message.length; + }, e.prototype.clonePosition = function() { + return { + offset: this.position.offset, + line: this.position.line, + column: this.position.column + }; + }, e.prototype.char = function() { + var t = this.position.offset; + if (t >= this.message.length) + throw Error("out of bound"); + var n = is(this.message, t); + if (n === void 0) + throw Error("Offset ".concat(t, " is at invalid UTF-16 code unit boundary")); + return n; + }, e.prototype.error = function(t, n) { + return { + val: null, + err: { + kind: t, + message: this.message, + location: n + } + }; + }, e.prototype.bump = function() { + if (!this.isEOF()) { + var t = this.char(); + t === 10 ? (this.position.line += 1, this.position.column = 1, this.position.offset += 1) : (this.position.column += 1, this.position.offset += t < 65536 ? 1 : 2); + } + }, e.prototype.bumpIf = function(t) { + if (ao(this.message, t, this.offset())) { + for (var n = 0; n < t.length; n++) + this.bump(); + return !0; + } + return !1; + }, e.prototype.bumpUntil = function(t) { + var n = this.offset(), r = this.message.indexOf(t, n); + return r >= 0 ? (this.bumpTo(r), !0) : (this.bumpTo(this.message.length), !1); + }, e.prototype.bumpTo = function(t) { + if (this.offset() > t) + throw Error("targetOffset ".concat(t, " must be greater than or equal to the current offset ").concat(this.offset())); + for (t = Math.min(t, this.message.length); ; ) { + var n = this.offset(); + if (n === t) + break; + if (n > t) + throw Error("targetOffset ".concat(t, " is at invalid UTF-16 code unit boundary")); + if (this.bump(), this.isEOF()) + break; + } + }, e.prototype.bumpSpace = function() { + for (; !this.isEOF() && ls(this.char()); ) + this.bump(); + }, e.prototype.peek = function() { + if (this.isEOF()) + return null; + var t = this.char(), n = this.offset(), r = this.message.charCodeAt(n + (t >= 65536 ? 2 : 1)); + return r ?? null; + }, e; + }() +); +function ii(e) { + return e >= 97 && e <= 122 || e >= 65 && e <= 90; +} +function i0(e) { + return ii(e) || e === 47; +} +function o0(e) { + return e === 45 || e === 46 || e >= 48 && e <= 57 || e === 95 || e >= 97 && e <= 122 || e >= 65 && e <= 90 || e == 183 || e >= 192 && e <= 214 || e >= 216 && e <= 246 || e >= 248 && e <= 893 || e >= 895 && e <= 8191 || e >= 8204 && e <= 8205 || e >= 8255 && e <= 8256 || e >= 8304 && e <= 8591 || e >= 11264 && e <= 12271 || e >= 12289 && e <= 55295 || e >= 63744 && e <= 64975 || e >= 65008 && e <= 65533 || e >= 65536 && e <= 983039; +} +function ls(e) { + return e >= 9 && e <= 13 || e === 32 || e === 133 || e >= 8206 && e <= 8207 || e === 8232 || e === 8233; +} +function l0(e) { + return e >= 33 && e <= 35 || e === 36 || e >= 37 && e <= 39 || e === 40 || e === 41 || e === 42 || e === 43 || e === 44 || e === 45 || e >= 46 && e <= 47 || e >= 58 && e <= 59 || e >= 60 && e <= 62 || e >= 63 && e <= 64 || e === 91 || e === 92 || e === 93 || e === 94 || e === 96 || e === 123 || e === 124 || e === 125 || e === 126 || e === 161 || e >= 162 && e <= 165 || e === 166 || e === 167 || e === 169 || e === 171 || e === 172 || e === 174 || e === 176 || e === 177 || e === 182 || e === 187 || e === 191 || e === 215 || e === 247 || e >= 8208 && e <= 8213 || e >= 8214 && e <= 8215 || e === 8216 || e === 8217 || e === 8218 || e >= 8219 && e <= 8220 || e === 8221 || e === 8222 || e === 8223 || e >= 8224 && e <= 8231 || e >= 8240 && e <= 8248 || e === 8249 || e === 8250 || e >= 8251 && e <= 8254 || e >= 8257 && e <= 8259 || e === 8260 || e === 8261 || e === 8262 || e >= 8263 && e <= 8273 || e === 8274 || e === 8275 || e >= 8277 && e <= 8286 || e >= 8592 && e <= 8596 || e >= 8597 && e <= 8601 || e >= 8602 && e <= 8603 || e >= 8604 && e <= 8607 || e === 8608 || e >= 8609 && e <= 8610 || e === 8611 || e >= 8612 && e <= 8613 || e === 8614 || e >= 8615 && e <= 8621 || e === 8622 || e >= 8623 && e <= 8653 || e >= 8654 && e <= 8655 || e >= 8656 && e <= 8657 || e === 8658 || e === 8659 || e === 8660 || e >= 8661 && e <= 8691 || e >= 8692 && e <= 8959 || e >= 8960 && e <= 8967 || e === 8968 || e === 8969 || e === 8970 || e === 8971 || e >= 8972 && e <= 8991 || e >= 8992 && e <= 8993 || e >= 8994 && e <= 9e3 || e === 9001 || e === 9002 || e >= 9003 && e <= 9083 || e === 9084 || e >= 9085 && e <= 9114 || e >= 9115 && e <= 9139 || e >= 9140 && e <= 9179 || e >= 9180 && e <= 9185 || e >= 9186 && e <= 9254 || e >= 9255 && e <= 9279 || e >= 9280 && e <= 9290 || e >= 9291 && e <= 9311 || e >= 9472 && e <= 9654 || e === 9655 || e >= 9656 && e <= 9664 || e === 9665 || e >= 9666 && e <= 9719 || e >= 9720 && e <= 9727 || e >= 9728 && e <= 9838 || e === 9839 || e >= 9840 && e <= 10087 || e === 10088 || e === 10089 || e === 10090 || e === 10091 || e === 10092 || e === 10093 || e === 10094 || e === 10095 || e === 10096 || e === 10097 || e === 10098 || e === 10099 || e === 10100 || e === 10101 || e >= 10132 && e <= 10175 || e >= 10176 && e <= 10180 || e === 10181 || e === 10182 || e >= 10183 && e <= 10213 || e === 10214 || e === 10215 || e === 10216 || e === 10217 || e === 10218 || e === 10219 || e === 10220 || e === 10221 || e === 10222 || e === 10223 || e >= 10224 && e <= 10239 || e >= 10240 && e <= 10495 || e >= 10496 && e <= 10626 || e === 10627 || e === 10628 || e === 10629 || e === 10630 || e === 10631 || e === 10632 || e === 10633 || e === 10634 || e === 10635 || e === 10636 || e === 10637 || e === 10638 || e === 10639 || e === 10640 || e === 10641 || e === 10642 || e === 10643 || e === 10644 || e === 10645 || e === 10646 || e === 10647 || e === 10648 || e >= 10649 && e <= 10711 || e === 10712 || e === 10713 || e === 10714 || e === 10715 || e >= 10716 && e <= 10747 || e === 10748 || e === 10749 || e >= 10750 && e <= 11007 || e >= 11008 && e <= 11055 || e >= 11056 && e <= 11076 || e >= 11077 && e <= 11078 || e >= 11079 && e <= 11084 || e >= 11085 && e <= 11123 || e >= 11124 && e <= 11125 || e >= 11126 && e <= 11157 || e === 11158 || e >= 11159 && e <= 11263 || e >= 11776 && e <= 11777 || e === 11778 || e === 11779 || e === 11780 || e === 11781 || e >= 11782 && e <= 11784 || e === 11785 || e === 11786 || e === 11787 || e === 11788 || e === 11789 || e >= 11790 && e <= 11798 || e === 11799 || e >= 11800 && e <= 11801 || e === 11802 || e === 11803 || e === 11804 || e === 11805 || e >= 11806 && e <= 11807 || e === 11808 || e === 11809 || e === 11810 || e === 11811 || e === 11812 || e === 11813 || e === 11814 || e === 11815 || e === 11816 || e === 11817 || e >= 11818 && e <= 11822 || e === 11823 || e >= 11824 && e <= 11833 || e >= 11834 && e <= 11835 || e >= 11836 && e <= 11839 || e === 11840 || e === 11841 || e === 11842 || e >= 11843 && e <= 11855 || e >= 11856 && e <= 11857 || e === 11858 || e >= 11859 && e <= 11903 || e >= 12289 && e <= 12291 || e === 12296 || e === 12297 || e === 12298 || e === 12299 || e === 12300 || e === 12301 || e === 12302 || e === 12303 || e === 12304 || e === 12305 || e >= 12306 && e <= 12307 || e === 12308 || e === 12309 || e === 12310 || e === 12311 || e === 12312 || e === 12313 || e === 12314 || e === 12315 || e === 12316 || e === 12317 || e >= 12318 && e <= 12319 || e === 12320 || e === 12336 || e === 64830 || e === 64831 || e >= 65093 && e <= 65094; +} +function oi(e) { + e.forEach(function(t) { + if (delete t.location, Ql(t) || Yl(t)) + for (var n in t.options) + delete t.options[n].location, oi(t.options[n].value); + else + Wl(t) && $l(t.style) || (Zl(t) || Jl(t)) && ei(t.style) ? delete t.style.location : Kl(t) && oi(t.children); + }); +} +function s0(e, t) { + t === void 0 && (t = {}), t = $({ shouldParseSkeletons: !0, requiresOtherClause: !0 }, t); + var n = new r0(e, t).parse(); + if (n.err) { + var r = SyntaxError(V[n.err.kind]); + throw r.location = n.err.location, r.originalMessage = n.err.message, r; + } + return t != null && t.captureLocation || oi(n.val), n.val; +} +function Hr(e, t) { + var n = t && t.cache ? t.cache : _0, r = t && t.serializer ? t.serializer : d0, i = t && t.strategy ? t.strategy : u0; + return i(e, { + cache: n, + serializer: r + }); +} +function a0(e) { + return e == null || typeof e == "number" || typeof e == "boolean"; +} +function ss(e, t, n, r) { + var i = a0(r) ? r : n(r), o = t.get(i); + return typeof o > "u" && (o = e.call(this, r), t.set(i, o)), o; +} +function as(e, t, n) { + var r = Array.prototype.slice.call(arguments, 3), i = n(r), o = t.get(i); + return typeof o > "u" && (o = e.apply(this, r), t.set(i, o)), o; +} +function pi(e, t, n, r, i) { + return n.bind(t, e, r, i); +} +function u0(e, t) { + var n = e.length === 1 ? ss : as; + return pi(e, this, n, t.cache.create(), t.serializer); +} +function f0(e, t) { + return pi(e, this, as, t.cache.create(), t.serializer); +} +function c0(e, t) { + return pi(e, this, ss, t.cache.create(), t.serializer); +} +var d0 = function() { + return JSON.stringify(arguments); +}; +function gi() { + this.cache = /* @__PURE__ */ Object.create(null); +} +gi.prototype.get = function(e) { + return this.cache[e]; +}; +gi.prototype.set = function(e, t) { + this.cache[e] = t; +}; +var _0 = { + create: function() { + return new gi(); + } +}, Nr = { + variadic: f0, + monadic: c0 +}, zt; +(function(e) { + e.MISSING_VALUE = "MISSING_VALUE", e.INVALID_VALUE = "INVALID_VALUE", e.MISSING_INTL_API = "MISSING_INTL_API"; +})(zt || (zt = {})); +var nr = ( + /** @class */ + function(e) { + tr(t, e); + function t(n, r, i) { + var o = e.call(this, n) || this; + return o.code = r, o.originalMessage = i, o; + } + return t.prototype.toString = function() { + return "[formatjs Error: ".concat(this.code, "] ").concat(this.message); + }, t; + }(Error) +), co = ( + /** @class */ + function(e) { + tr(t, e); + function t(n, r, i, o) { + return e.call(this, 'Invalid values for "'.concat(n, '": "').concat(r, '". Options are "').concat(Object.keys(i).join('", "'), '"'), zt.INVALID_VALUE, o) || this; + } + return t; + }(nr) +), h0 = ( + /** @class */ + function(e) { + tr(t, e); + function t(n, r, i) { + return e.call(this, 'Value for "'.concat(n, '" must be of type ').concat(r), zt.INVALID_VALUE, i) || this; + } + return t; + }(nr) +), m0 = ( + /** @class */ + function(e) { + tr(t, e); + function t(n, r) { + return e.call(this, 'The intl string context variable "'.concat(n, '" was not provided to the string "').concat(r, '"'), zt.MISSING_VALUE, r) || this; + } + return t; + }(nr) +), ke; +(function(e) { + e[e.literal = 0] = "literal", e[e.object = 1] = "object"; +})(ke || (ke = {})); +function p0(e) { + return e.length < 2 ? e : e.reduce(function(t, n) { + var r = t[t.length - 1]; + return !r || r.type !== ke.literal || n.type !== ke.literal ? t.push(n) : r.value += n.value, t; + }, []); +} +function g0(e) { + return typeof e == "function"; +} +function Rn(e, t, n, r, i, o, l) { + if (e.length === 1 && io(e[0])) + return [ + { + type: ke.literal, + value: e[0].value + } + ]; + for (var u = [], s = 0, a = e; s < a.length; s++) { + var f = a[s]; + if (io(f)) { + u.push({ + type: ke.literal, + value: f.value + }); + continue; + } + if (Hc(f)) { + typeof o == "number" && u.push({ + type: ke.literal, + value: n.getNumberFormat(t).format(o) + }); + continue; + } + var d = f.value; + if (!(i && d in i)) + throw new m0(d, l); + var c = i[d]; + if (Oc(f)) { + (!c || typeof c == "string" || typeof c == "number") && (c = typeof c == "string" || typeof c == "number" ? String(c) : ""), u.push({ + type: typeof c == "string" ? ke.literal : ke.object, + value: c + }); + continue; + } + if (Zl(f)) { + var h = typeof f.style == "string" ? r.date[f.style] : ei(f.style) ? f.style.parsedOptions : void 0; + u.push({ + type: ke.literal, + value: n.getDateTimeFormat(t, h).format(c) + }); + continue; + } + if (Jl(f)) { + var h = typeof f.style == "string" ? r.time[f.style] : ei(f.style) ? f.style.parsedOptions : r.time.medium; + u.push({ + type: ke.literal, + value: n.getDateTimeFormat(t, h).format(c) + }); + continue; + } + if (Wl(f)) { + var h = typeof f.style == "string" ? r.number[f.style] : $l(f.style) ? f.style.parsedOptions : void 0; + h && h.scale && (c = c * (h.scale || 1)), u.push({ + type: ke.literal, + value: n.getNumberFormat(t, h).format(c) + }); + continue; + } + if (Kl(f)) { + var _ = f.children, m = f.value, g = i[m]; + if (!g0(g)) + throw new h0(m, "function", l); + var p = Rn(_, t, n, r, i, o), v = g(p.map(function(y) { + return y.value; + })); + Array.isArray(v) || (v = [v]), u.push.apply(u, v.map(function(y) { + return { + type: typeof y == "string" ? ke.literal : ke.object, + value: y + }; + })); + } + if (Ql(f)) { + var b = f.options[c] || f.options.other; + if (!b) + throw new co(f.value, c, Object.keys(f.options), l); + u.push.apply(u, Rn(b.value, t, n, r, i)); + continue; + } + if (Yl(f)) { + var b = f.options["=".concat(c)]; + if (!b) { + if (!Intl.PluralRules) + throw new nr(`Intl.PluralRules is not available in this environment. +Try polyfilling it using "@formatjs/intl-pluralrules" +`, zt.MISSING_INTL_API, l); + var w = n.getPluralRules(t, { type: f.pluralType }).select(c - (f.offset || 0)); + b = f.options[w] || f.options.other; + } + if (!b) + throw new co(f.value, c, Object.keys(f.options), l); + u.push.apply(u, Rn(b.value, t, n, r, i, c - (f.offset || 0))); + continue; + } + } + return p0(u); +} +function b0(e, t) { + return t ? $($($({}, e || {}), t || {}), Object.keys(e).reduce(function(n, r) { + return n[r] = $($({}, e[r]), t[r] || {}), n; + }, {})) : e; +} +function w0(e, t) { + return t ? Object.keys(e).reduce(function(n, r) { + return n[r] = b0(e[r], t[r]), n; + }, $({}, e)) : e; +} +function Mr(e) { + return { + create: function() { + return { + get: function(t) { + return e[t]; + }, + set: function(t, n) { + e[t] = n; + } + }; + } + }; +} +function v0(e) { + return e === void 0 && (e = { + number: {}, + dateTime: {}, + pluralRules: {} + }), { + getNumberFormat: Hr(function() { + for (var t, n = [], r = 0; r < arguments.length; r++) + n[r] = arguments[r]; + return new ((t = Intl.NumberFormat).bind.apply(t, Pr([void 0], n, !1)))(); + }, { + cache: Mr(e.number), + strategy: Nr.variadic + }), + getDateTimeFormat: Hr(function() { + for (var t, n = [], r = 0; r < arguments.length; r++) + n[r] = arguments[r]; + return new ((t = Intl.DateTimeFormat).bind.apply(t, Pr([void 0], n, !1)))(); + }, { + cache: Mr(e.dateTime), + strategy: Nr.variadic + }), + getPluralRules: Hr(function() { + for (var t, n = [], r = 0; r < arguments.length; r++) + n[r] = arguments[r]; + return new ((t = Intl.PluralRules).bind.apply(t, Pr([void 0], n, !1)))(); + }, { + cache: Mr(e.pluralRules), + strategy: Nr.variadic + }) + }; +} +var y0 = ( + /** @class */ + function() { + function e(t, n, r, i) { + var o = this; + if (n === void 0 && (n = e.defaultLocale), this.formatterCache = { + number: {}, + dateTime: {}, + pluralRules: {} + }, this.format = function(l) { + var u = o.formatToParts(l); + if (u.length === 1) + return u[0].value; + var s = u.reduce(function(a, f) { + return !a.length || f.type !== ke.literal || typeof a[a.length - 1] != "string" ? a.push(f.value) : a[a.length - 1] += f.value, a; + }, []); + return s.length <= 1 ? s[0] || "" : s; + }, this.formatToParts = function(l) { + return Rn(o.ast, o.locales, o.formatters, o.formats, l, void 0, o.message); + }, this.resolvedOptions = function() { + return { + locale: o.resolvedLocale.toString() + }; + }, this.getAst = function() { + return o.ast; + }, this.locales = n, this.resolvedLocale = e.resolveLocale(n), typeof t == "string") { + if (this.message = t, !e.__parse) + throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`"); + this.ast = e.__parse(t, { + ignoreTag: i == null ? void 0 : i.ignoreTag, + locale: this.resolvedLocale + }); + } else + this.ast = t; + if (!Array.isArray(this.ast)) + throw new TypeError("A message must be provided as a String or AST."); + this.formats = w0(e.formats, r), this.formatters = i && i.formatters || v0(this.formatterCache); + } + return Object.defineProperty(e, "defaultLocale", { + get: function() { + return e.memoizedDefaultLocale || (e.memoizedDefaultLocale = new Intl.NumberFormat().resolvedOptions().locale), e.memoizedDefaultLocale; + }, + enumerable: !1, + configurable: !0 + }), e.memoizedDefaultLocale = null, e.resolveLocale = function(t) { + var n = Intl.NumberFormat.supportedLocalesOf(t); + return n.length > 0 ? new Intl.Locale(n[0]) : new Intl.Locale(typeof t == "string" ? t : t[0]); + }, e.__parse = s0, e.formats = { + number: { + integer: { + maximumFractionDigits: 0 + }, + currency: { + style: "currency" + }, + percent: { + style: "percent" + } + }, + date: { + short: { + month: "numeric", + day: "numeric", + year: "2-digit" + }, + medium: { + month: "short", + day: "numeric", + year: "numeric" + }, + long: { + month: "long", + day: "numeric", + year: "numeric" + }, + full: { + weekday: "long", + month: "long", + day: "numeric", + year: "numeric" + } + }, + time: { + short: { + hour: "numeric", + minute: "numeric" + }, + medium: { + hour: "numeric", + minute: "numeric", + second: "numeric" + }, + long: { + hour: "numeric", + minute: "numeric", + second: "numeric", + timeZoneName: "short" + }, + full: { + hour: "numeric", + minute: "numeric", + second: "numeric", + timeZoneName: "short" + } + } + }, e; + }() +); +function E0(e, t) { + if (t == null) + return; + if (t in e) + return e[t]; + const n = t.split("."); + let r = e; + for (let i = 0; i < n.length; i++) + if (typeof r == "object") { + if (i > 0) { + const o = n.slice(i, n.length).join("."); + if (o in r) { + r = r[o]; + break; + } + } + r = r[n[i]]; + } else + r = void 0; + return r; +} +const ut = {}, S0 = (e, t, n) => n && (t in ut || (ut[t] = {}), e in ut[t] || (ut[t][e] = n), n), us = (e, t) => { + if (t == null) + return; + if (t in ut && e in ut[t]) + return ut[t][e]; + const n = rr(t); + for (let r = 0; r < n.length; r++) { + const i = n[r], o = T0(i, e); + if (o) + return S0(e, t, o); + } +}; +let bi; +const mn = hn({}); +function k0(e) { + return bi[e] || null; +} +function fs(e) { + return e in bi; +} +function T0(e, t) { + if (!fs(e)) + return null; + const n = k0(e); + return E0(n, t); +} +function A0(e) { + if (e == null) + return; + const t = rr(e); + for (let n = 0; n < t.length; n++) { + const r = t[n]; + if (fs(r)) + return r; + } +} +function B0(e, ...t) { + delete ut[e], mn.update((n) => (n[e] = Pc.all([n[e] || {}, ...t]), n)); +} +Qt( + [mn], + ([e]) => Object.keys(e) +); +mn.subscribe((e) => bi = e); +const Un = {}; +function C0(e, t) { + Un[e].delete(t), Un[e].size === 0 && delete Un[e]; +} +function cs(e) { + return Un[e]; +} +function I0(e) { + return rr(e).map((t) => { + const n = cs(t); + return [t, n ? [...n] : []]; + }).filter(([, t]) => t.length > 0); +} +function li(e) { + return e == null ? !1 : rr(e).some( + (t) => { + var n; + return (n = cs(t)) == null ? void 0 : n.size; + } + ); +} +function L0(e, t) { + return Promise.all( + t.map((r) => (C0(e, r), r().then((i) => i.default || i))) + ).then((r) => B0(e, ...r)); +} +const tn = {}; +function ds(e) { + if (!li(e)) + return e in tn ? tn[e] : Promise.resolve(); + const t = I0(e); + return tn[e] = Promise.all( + t.map( + ([n, r]) => L0(n, r) + ) + ).then(() => { + if (li(e)) + return ds(e); + delete tn[e]; + }), tn[e]; +} +const P0 = { + number: { + scientific: { notation: "scientific" }, + engineering: { notation: "engineering" }, + compactLong: { notation: "compact", compactDisplay: "long" }, + compactShort: { notation: "compact", compactDisplay: "short" } + }, + date: { + short: { month: "numeric", day: "numeric", year: "2-digit" }, + medium: { month: "short", day: "numeric", year: "numeric" }, + long: { month: "long", day: "numeric", year: "numeric" }, + full: { weekday: "long", month: "long", day: "numeric", year: "numeric" } + }, + time: { + short: { hour: "numeric", minute: "numeric" }, + medium: { hour: "numeric", minute: "numeric", second: "numeric" }, + long: { + hour: "numeric", + minute: "numeric", + second: "numeric", + timeZoneName: "short" + }, + full: { + hour: "numeric", + minute: "numeric", + second: "numeric", + timeZoneName: "short" + } + } +}, O0 = { + fallbackLocale: null, + loadingDelay: 200, + formats: P0, + warnOnMissingMessages: !0, + handleMissingMessage: void 0, + ignoreTag: !0 +}, H0 = O0; +function Vt() { + return H0; +} +const Dr = hn(!1); +var N0 = Object.defineProperty, M0 = Object.defineProperties, D0 = Object.getOwnPropertyDescriptors, _o = Object.getOwnPropertySymbols, R0 = Object.prototype.hasOwnProperty, U0 = Object.prototype.propertyIsEnumerable, ho = (e, t, n) => t in e ? N0(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, F0 = (e, t) => { + for (var n in t || (t = {})) + R0.call(t, n) && ho(e, n, t[n]); + if (_o) + for (var n of _o(t)) + U0.call(t, n) && ho(e, n, t[n]); + return e; +}, G0 = (e, t) => M0(e, D0(t)); +let si; +const jn = hn(null); +function mo(e) { + return e.split("-").map((t, n, r) => r.slice(0, n + 1).join("-")).reverse(); +} +function rr(e, t = Vt().fallbackLocale) { + const n = mo(e); + return t ? [.../* @__PURE__ */ new Set([...n, ...mo(t)])] : n; +} +function Ht() { + return si ?? void 0; +} +jn.subscribe((e) => { + si = e ?? void 0, typeof window < "u" && e != null && document.documentElement.setAttribute("lang", e); +}); +const q0 = (e) => { + if (e && A0(e) && li(e)) { + const { loadingDelay: t } = Vt(); + let n; + return typeof window < "u" && Ht() != null && t ? n = window.setTimeout( + () => Dr.set(!0), + t + ) : Dr.set(!0), ds(e).then(() => { + jn.set(e); + }).finally(() => { + clearTimeout(n), Dr.set(!1); + }); + } + return jn.set(e); +}, pn = G0(F0({}, jn), { + set: q0 +}), ir = (e) => { + const t = /* @__PURE__ */ Object.create(null); + return (r) => { + const i = JSON.stringify(r); + return i in t ? t[i] : t[i] = e(r); + }; +}; +var j0 = Object.defineProperty, xn = Object.getOwnPropertySymbols, _s = Object.prototype.hasOwnProperty, hs = Object.prototype.propertyIsEnumerable, po = (e, t, n) => t in e ? j0(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, wi = (e, t) => { + for (var n in t || (t = {})) + _s.call(t, n) && po(e, n, t[n]); + if (xn) + for (var n of xn(t)) + hs.call(t, n) && po(e, n, t[n]); + return e; +}, Yt = (e, t) => { + var n = {}; + for (var r in e) + _s.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]); + if (e != null && xn) + for (var r of xn(e)) + t.indexOf(r) < 0 && hs.call(e, r) && (n[r] = e[r]); + return n; +}; +const un = (e, t) => { + const { formats: n } = Vt(); + if (e in n && t in n[e]) + return n[e][t]; + throw new Error(`[svelte-i18n] Unknown "${t}" ${e} format.`); +}, x0 = ir( + (e) => { + var t = e, { locale: n, format: r } = t, i = Yt(t, ["locale", "format"]); + if (n == null) + throw new Error('[svelte-i18n] A "locale" must be set to format numbers'); + return r && (i = un("number", r)), new Intl.NumberFormat(n, i); + } +), z0 = ir( + (e) => { + var t = e, { locale: n, format: r } = t, i = Yt(t, ["locale", "format"]); + if (n == null) + throw new Error('[svelte-i18n] A "locale" must be set to format dates'); + return r ? i = un("date", r) : Object.keys(i).length === 0 && (i = un("date", "short")), new Intl.DateTimeFormat(n, i); + } +), V0 = ir( + (e) => { + var t = e, { locale: n, format: r } = t, i = Yt(t, ["locale", "format"]); + if (n == null) + throw new Error( + '[svelte-i18n] A "locale" must be set to format time values' + ); + return r ? i = un("time", r) : Object.keys(i).length === 0 && (i = un("time", "short")), new Intl.DateTimeFormat(n, i); + } +), X0 = (e = {}) => { + var t = e, { + locale: n = Ht() + } = t, r = Yt(t, [ + "locale" + ]); + return x0(wi({ locale: n }, r)); +}, W0 = (e = {}) => { + var t = e, { + locale: n = Ht() + } = t, r = Yt(t, [ + "locale" + ]); + return z0(wi({ locale: n }, r)); +}, Z0 = (e = {}) => { + var t = e, { + locale: n = Ht() + } = t, r = Yt(t, [ + "locale" + ]); + return V0(wi({ locale: n }, r)); +}, J0 = ir( + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + (e, t = Ht()) => new y0(e, t, Vt().formats, { + ignoreTag: Vt().ignoreTag + }) +), Q0 = (e, t = {}) => { + var n, r, i, o; + let l = t; + typeof e == "object" && (l = e, e = l.id); + const { + values: u, + locale: s = Ht(), + default: a + } = l; + if (s == null) + throw new Error( + "[svelte-i18n] Cannot format a message without first setting the initial locale." + ); + let f = us(e, s); + if (!f) + f = (o = (i = (r = (n = Vt()).handleMissingMessage) == null ? void 0 : r.call(n, { locale: s, id: e, defaultValue: a })) != null ? i : a) != null ? o : e; + else if (typeof f != "string") + return console.warn( + `[svelte-i18n] Message with id "${e}" must be of type "string", found: "${typeof f}". Gettin its value through the "$format" method is deprecated; use the "json" method instead.` + ), f; + if (!u) + return f; + let d = f; + try { + d = J0(f, s).format(u); + } catch (c) { + c instanceof Error && console.warn( + `[svelte-i18n] Message "${e}" has syntax error:`, + c.message + ); + } + return d; +}, Y0 = (e, t) => Z0(t).format(e), K0 = (e, t) => W0(t).format(e), $0 = (e, t) => X0(t).format(e), ed = (e, t = Ht()) => us(e, t); +Qt([pn, mn], () => Q0); +Qt([pn], () => Y0); +Qt([pn], () => K0); +Qt([pn], () => $0); +Qt([pn, mn], () => ed); +const { + SvelteComponent: td, + append: Ce, + attr: wt, + detach: ms, + element: vt, + init: nd, + insert: ps, + noop: go, + safe_not_equal: rd, + set_data: zn, + set_style: Rr, + space: ai, + text: Rt, + toggle_class: bo +} = window.__gradio__svelte__internal, { onMount: id, createEventDispatcher: od, getContext: ld } = window.__gradio__svelte__internal; +function wo(e) { + let t, n, r, i, o = on( + /*file_to_display*/ + e[2] + ) + "", l, u, s, a, f = ( + /*file_to_display*/ + e[2].orig_name + "" + ), d; + return { + c() { + t = vt("div"), n = vt("span"), r = vt("div"), i = vt("progress"), l = Rt(o), s = ai(), a = vt("span"), d = Rt(f), Rr(i, "visibility", "hidden"), Rr(i, "height", "0"), Rr(i, "width", "0"), i.value = u = on( + /*file_to_display*/ + e[2] + ), wt(i, "max", "100"), wt(i, "class", "svelte-12ckl9l"), wt(r, "class", "progress-bar svelte-12ckl9l"), wt(a, "class", "file-name svelte-12ckl9l"), wt(t, "class", "file svelte-12ckl9l"); + }, + m(c, h) { + ps(c, t, h), Ce(t, n), Ce(n, r), Ce(r, i), Ce(i, l), Ce(t, s), Ce(t, a), Ce(a, d); + }, + p(c, h) { + h & /*file_to_display*/ + 4 && o !== (o = on( + /*file_to_display*/ + c[2] + ) + "") && zn(l, o), h & /*file_to_display*/ + 4 && u !== (u = on( + /*file_to_display*/ + c[2] + )) && (i.value = u), h & /*file_to_display*/ + 4 && f !== (f = /*file_to_display*/ + c[2].orig_name + "") && zn(d, f); + }, + d(c) { + c && ms(t); + } + }; +} +function sd(e) { + let t, n, r, i = ( + /*files_with_progress*/ + e[0].length + "" + ), o, l, u = ( + /*files_with_progress*/ + e[0].length > 1 ? "files" : "file" + ), s, a, f, d = ( + /*file_to_display*/ + e[2] && wo(e) + ); + return { + c() { + t = vt("div"), n = vt("span"), r = Rt("Uploading "), o = Rt(i), l = ai(), s = Rt(u), a = Rt("..."), f = ai(), d && d.c(), wt(n, "class", "uploading svelte-12ckl9l"), wt(t, "class", "wrap svelte-12ckl9l"), bo( + t, + "progress", + /*progress*/ + e[1] + ); + }, + m(c, h) { + ps(c, t, h), Ce(t, n), Ce(n, r), Ce(n, o), Ce(n, l), Ce(n, s), Ce(n, a), Ce(t, f), d && d.m(t, null); + }, + p(c, [h]) { + h & /*files_with_progress*/ + 1 && i !== (i = /*files_with_progress*/ + c[0].length + "") && zn(o, i), h & /*files_with_progress*/ + 1 && u !== (u = /*files_with_progress*/ + c[0].length > 1 ? "files" : "file") && zn(s, u), /*file_to_display*/ + c[2] ? d ? d.p(c, h) : (d = wo(c), d.c(), d.m(t, null)) : d && (d.d(1), d = null), h & /*progress*/ + 2 && bo( + t, + "progress", + /*progress*/ + c[1] + ); + }, + i: go, + o: go, + d(c) { + c && ms(t), d && d.d(); + } + }; +} +function on(e) { + return e.progress * 100 / (e.size || 0) || 0; +} +function ad(e) { + let t = 0; + return e.forEach((n) => { + t += on(n); + }), document.documentElement.style.setProperty("--upload-progress-width", (t / e.length).toFixed(2) + "%"), t / e.length; +} +function ud(e, t, n) { + let { upload_id: r } = t, { root: i } = t, { files: o } = t, l, u = !1, s, a, f = o.map((_) => ({ ..._, progress: 0 })); + const d = od(); + function c(_, m) { + n(0, f = f.map((g) => (g.orig_name === _ && (g.progress += m), g))); + } + const h = ld("EventSource_factory"); + return id(() => { + l = h(new URL(`${i}/upload_progress?upload_id=${r}`)), l.onmessage = async function(_) { + const m = JSON.parse(_.data); + u || n(1, u = !0), m.msg === "done" ? (l.close(), d("done")) : (n(6, s = m), c(m.orig_name, m.chunk_size)); + }; + }), e.$$set = (_) => { + "upload_id" in _ && n(3, r = _.upload_id), "root" in _ && n(4, i = _.root), "files" in _ && n(5, o = _.files); + }, e.$$.update = () => { + e.$$.dirty & /*files_with_progress*/ + 1 && ad(f), e.$$.dirty & /*current_file_upload, files_with_progress*/ + 65 && n(2, a = s || f[0]); + }, [ + f, + u, + a, + r, + i, + o, + s + ]; +} +class fd extends td { + constructor(t) { + super(), nd(this, t, ud, sd, rd, { upload_id: 3, root: 4, files: 5 }); + } +} +const { + SvelteComponent: cd, + append: vo, + attr: ye, + binding_callbacks: dd, + bubble: mt, + check_outros: gs, + create_component: _d, + create_slot: bs, + destroy_component: hd, + detach: or, + element: ui, + empty: ws, + get_all_dirty_from_scope: vs, + get_slot_changes: ys, + group_outros: Es, + init: md, + insert: lr, + listen: Oe, + mount_component: pd, + prevent_default: pt, + run_all: gd, + safe_not_equal: bd, + set_style: Ss, + space: wd, + stop_propagation: gt, + toggle_class: Ee, + transition_in: ct, + transition_out: It, + update_slot_base: ks +} = window.__gradio__svelte__internal, { createEventDispatcher: vd, tick: yd, getContext: Ed } = window.__gradio__svelte__internal; +function Sd(e) { + let t, n, r, i, o, l, u, s, a, f; + const d = ( + /*#slots*/ + e[22].default + ), c = bs( + d, + e, + /*$$scope*/ + e[21], + null + ); + return { + c() { + t = ui("button"), c && c.c(), n = wd(), r = ui("input"), ye(r, "aria-label", "file upload"), ye(r, "data-testid", "file-upload"), ye(r, "type", "file"), ye( + r, + "accept", + /*accept_file_types*/ + e[12] + ), r.multiple = i = /*file_count*/ + e[5] === "multiple" || void 0, ye(r, "webkitdirectory", o = /*file_count*/ + e[5] === "directory" || void 0), ye(r, "mozdirectory", l = /*file_count*/ + e[5] === "directory" || void 0), ye(r, "class", "svelte-1aq8tno"), ye(t, "tabindex", u = /*hidden*/ + e[7] ? -1 : 0), ye(t, "class", "svelte-1aq8tno"), Ee( + t, + "hidden", + /*hidden*/ + e[7] + ), Ee( + t, + "center", + /*center*/ + e[3] + ), Ee( + t, + "boundedheight", + /*boundedheight*/ + e[2] + ), Ee( + t, + "flex", + /*flex*/ + e[4] + ), Ss(t, "height", "100%"); + }, + m(h, _) { + lr(h, t, _), c && c.m(t, null), vo(t, n), vo(t, r), e[30](r), s = !0, a || (f = [ + Oe( + r, + "change", + /*load_files_from_upload*/ + e[15] + ), + Oe(t, "drag", gt(pt( + /*drag_handler*/ + e[23] + ))), + Oe(t, "dragstart", gt(pt( + /*dragstart_handler*/ + e[24] + ))), + Oe(t, "dragend", gt(pt( + /*dragend_handler*/ + e[25] + ))), + Oe(t, "dragover", gt(pt( + /*dragover_handler*/ + e[26] + ))), + Oe(t, "dragenter", gt(pt( + /*dragenter_handler*/ + e[27] + ))), + Oe(t, "dragleave", gt(pt( + /*dragleave_handler*/ + e[28] + ))), + Oe(t, "drop", gt(pt( + /*drop_handler*/ + e[29] + ))), + Oe( + t, + "click", + /*open_file_upload*/ + e[9] + ), + Oe( + t, + "drop", + /*loadFilesFromDrop*/ + e[16] + ), + Oe( + t, + "dragenter", + /*updateDragging*/ + e[14] + ), + Oe( + t, + "dragleave", + /*updateDragging*/ + e[14] + ) + ], a = !0); + }, + p(h, _) { + c && c.p && (!s || _[0] & /*$$scope*/ + 2097152) && ks( + c, + d, + h, + /*$$scope*/ + h[21], + s ? ys( + d, + /*$$scope*/ + h[21], + _, + null + ) : vs( + /*$$scope*/ + h[21] + ), + null + ), (!s || _[0] & /*accept_file_types*/ + 4096) && ye( + r, + "accept", + /*accept_file_types*/ + h[12] + ), (!s || _[0] & /*file_count*/ + 32 && i !== (i = /*file_count*/ + h[5] === "multiple" || void 0)) && (r.multiple = i), (!s || _[0] & /*file_count*/ + 32 && o !== (o = /*file_count*/ + h[5] === "directory" || void 0)) && ye(r, "webkitdirectory", o), (!s || _[0] & /*file_count*/ + 32 && l !== (l = /*file_count*/ + h[5] === "directory" || void 0)) && ye(r, "mozdirectory", l), (!s || _[0] & /*hidden*/ + 128 && u !== (u = /*hidden*/ + h[7] ? -1 : 0)) && ye(t, "tabindex", u), (!s || _[0] & /*hidden*/ + 128) && Ee( + t, + "hidden", + /*hidden*/ + h[7] + ), (!s || _[0] & /*center*/ + 8) && Ee( + t, + "center", + /*center*/ + h[3] + ), (!s || _[0] & /*boundedheight*/ + 4) && Ee( + t, + "boundedheight", + /*boundedheight*/ + h[2] + ), (!s || _[0] & /*flex*/ + 16) && Ee( + t, + "flex", + /*flex*/ + h[4] + ); + }, + i(h) { + s || (ct(c, h), s = !0); + }, + o(h) { + It(c, h), s = !1; + }, + d(h) { + h && or(t), c && c.d(h), e[30](null), a = !1, gd(f); + } + }; +} +function kd(e) { + let t, n, r = !/*hidden*/ + e[7] && yo(e); + return { + c() { + r && r.c(), t = ws(); + }, + m(i, o) { + r && r.m(i, o), lr(i, t, o), n = !0; + }, + p(i, o) { + /*hidden*/ + i[7] ? r && (Es(), It(r, 1, 1, () => { + r = null; + }), gs()) : r ? (r.p(i, o), o[0] & /*hidden*/ + 128 && ct(r, 1)) : (r = yo(i), r.c(), ct(r, 1), r.m(t.parentNode, t)); + }, + i(i) { + n || (ct(r), n = !0); + }, + o(i) { + It(r), n = !1; + }, + d(i) { + i && or(t), r && r.d(i); + } + }; +} +function Td(e) { + let t, n, r, i, o; + const l = ( + /*#slots*/ + e[22].default + ), u = bs( + l, + e, + /*$$scope*/ + e[21], + null + ); + return { + c() { + t = ui("button"), u && u.c(), ye(t, "tabindex", n = /*hidden*/ + e[7] ? -1 : 0), ye(t, "class", "svelte-1aq8tno"), Ee( + t, + "hidden", + /*hidden*/ + e[7] + ), Ee( + t, + "center", + /*center*/ + e[3] + ), Ee( + t, + "boundedheight", + /*boundedheight*/ + e[2] + ), Ee( + t, + "flex", + /*flex*/ + e[4] + ), Ss(t, "height", "100%"); + }, + m(s, a) { + lr(s, t, a), u && u.m(t, null), r = !0, i || (o = Oe( + t, + "click", + /*paste_clipboard*/ + e[8] + ), i = !0); + }, + p(s, a) { + u && u.p && (!r || a[0] & /*$$scope*/ + 2097152) && ks( + u, + l, + s, + /*$$scope*/ + s[21], + r ? ys( + l, + /*$$scope*/ + s[21], + a, + null + ) : vs( + /*$$scope*/ + s[21] + ), + null + ), (!r || a[0] & /*hidden*/ + 128 && n !== (n = /*hidden*/ + s[7] ? -1 : 0)) && ye(t, "tabindex", n), (!r || a[0] & /*hidden*/ + 128) && Ee( + t, + "hidden", + /*hidden*/ + s[7] + ), (!r || a[0] & /*center*/ + 8) && Ee( + t, + "center", + /*center*/ + s[3] + ), (!r || a[0] & /*boundedheight*/ + 4) && Ee( + t, + "boundedheight", + /*boundedheight*/ + s[2] + ), (!r || a[0] & /*flex*/ + 16) && Ee( + t, + "flex", + /*flex*/ + s[4] + ); + }, + i(s) { + r || (ct(u, s), r = !0); + }, + o(s) { + It(u, s), r = !1; + }, + d(s) { + s && or(t), u && u.d(s), i = !1, o(); + } + }; +} +function yo(e) { + let t, n; + return t = new fd({ + props: { + root: ( + /*root*/ + e[6] + ), + upload_id: ( + /*upload_id*/ + e[10] + ), + files: ( + /*file_data*/ + e[11] + ) + } + }), { + c() { + _d(t.$$.fragment); + }, + m(r, i) { + pd(t, r, i), n = !0; + }, + p(r, i) { + const o = {}; + i[0] & /*root*/ + 64 && (o.root = /*root*/ + r[6]), i[0] & /*upload_id*/ + 1024 && (o.upload_id = /*upload_id*/ + r[10]), i[0] & /*file_data*/ + 2048 && (o.files = /*file_data*/ + r[11]), t.$set(o); + }, + i(r) { + n || (ct(t.$$.fragment, r), n = !0); + }, + o(r) { + It(t.$$.fragment, r), n = !1; + }, + d(r) { + hd(t, r); + } + }; +} +function Ad(e) { + let t, n, r, i; + const o = [Td, kd, Sd], l = []; + function u(s, a) { + return ( + /*filetype*/ + s[0] === "clipboard" ? 0 : ( + /*uploading*/ + s[1] ? 1 : 2 + ) + ); + } + return t = u(e), n = l[t] = o[t](e), { + c() { + n.c(), r = ws(); + }, + m(s, a) { + l[t].m(s, a), lr(s, r, a), i = !0; + }, + p(s, a) { + let f = t; + t = u(s), t === f ? l[t].p(s, a) : (Es(), It(l[f], 1, 1, () => { + l[f] = null; + }), gs(), n = l[t], n ? n.p(s, a) : (n = l[t] = o[t](s), n.c()), ct(n, 1), n.m(r.parentNode, r)); + }, + i(s) { + i || (ct(n), i = !0); + }, + o(s) { + It(n), i = !1; + }, + d(s) { + s && or(r), l[t].d(s); + } + }; +} +function Eo(e) { + let t, n = e[0], r = 1; + for (; r < e.length; ) { + const i = e[r], o = e[r + 1]; + if (r += 2, (i === "optionalAccess" || i === "optionalCall") && n == null) + return; + i === "access" || i === "optionalAccess" ? (t = n, n = o(n)) : (i === "call" || i === "optionalCall") && (n = o((...l) => n.call(t, ...l)), t = void 0); + } + return n; +} +function Bd(e, t) { + return !e || e === "*" || e === "file/*" ? !0 : (typeof e == "string" && e.endsWith("/*") && (e = e.split(",")), Array.isArray(e) ? e.includes(t) || e.some((n) => { + const [r] = n.split("/"); + return n.endsWith("/*") && t.startsWith(r + "/"); + }) : e === t); +} +function Cd(e, t, n) { + let { $$slots: r = {}, $$scope: i } = t, { filetype: o = null } = t, { dragging: l = !1 } = t, { boundedheight: u = !0 } = t, { center: s = !0 } = t, { flex: a = !0 } = t, { file_count: f = "single" } = t, { disable_click: d = !1 } = t, { root: c } = t, { hidden: h = !1 } = t, { format: _ = "file" } = t, { uploading: m = !1 } = t, g, p, v; + const b = Ed("upload_files"); + let w; + const y = vd(); + function S() { + n(17, l = !l); + } + function C() { + navigator.clipboard.read().then(async (E) => { + for (let M = 0; M < E.length; M++) { + const A = E[M].types.find((F) => F.startsWith("image/")); + if (A) { + E[M].getType(A).then(async (F) => { + const L = new File([F], `clipboard.${A.replace("image/", "")}`); + await O([L]); + }); + break; + } + } + }); + } + function P() { + d || (n(13, w.value = "", w), w.click()); + } + async function k(E) { + await yd(), n(10, g = Math.random().toString(36).substring(2, 15)), n(1, m = !0); + const M = await nc(E, c, g, b); + return y("load", f === "single" ? Eo([M, "optionalAccess", (A) => A[0]]) : M), n(1, m = !1), M || []; + } + async function O(E) { + if (!E.length) + return; + let M = E.map((A) => new File([A], A.name)); + return n(11, p = await rc(M)), await k(p); + } + async function U(E) { + const M = E.target; + if (M.files) + if (_ != "blob") + await O(Array.from(M.files)); + else { + if (f === "single") { + y("load", M.files[0]); + return; + } + y("load", M.files); + } + } + async function x(E) { + if (n(17, l = !1), !Eo([E, "access", (A) => A.dataTransfer, "optionalAccess", (A) => A.files])) + return; + const M = Array.from(E.dataTransfer.files).filter((A) => { + const F = "." + A.name.split(".").pop(); + return A.type && Bd(o, A.type) || (F && Array.isArray(o) ? o.includes(F) : F === o) ? !0 : (y("error", `Invalid file type only ${o} allowed.`), !1); + }); + await O(M); + } + function j(E) { + mt.call(this, e, E); + } + function te(E) { + mt.call(this, e, E); + } + function ne(E) { + mt.call(this, e, E); + } + function ce(E) { + mt.call(this, e, E); + } + function me(E) { + mt.call(this, e, E); + } + function _e(E) { + mt.call(this, e, E); + } + function B(E) { + mt.call(this, e, E); + } + function pe(E) { + dd[E ? "unshift" : "push"](() => { + w = E, n(13, w); + }); + } + return e.$$set = (E) => { + "filetype" in E && n(0, o = E.filetype), "dragging" in E && n(17, l = E.dragging), "boundedheight" in E && n(2, u = E.boundedheight), "center" in E && n(3, s = E.center), "flex" in E && n(4, a = E.flex), "file_count" in E && n(5, f = E.file_count), "disable_click" in E && n(18, d = E.disable_click), "root" in E && n(6, c = E.root), "hidden" in E && n(7, h = E.hidden), "format" in E && n(19, _ = E.format), "uploading" in E && n(1, m = E.uploading), "$$scope" in E && n(21, i = E.$$scope); + }, e.$$.update = () => { + e.$$.dirty[0] & /*filetype*/ + 1 && (o == null || typeof o == "string" ? n(12, v = o) : (n(0, o = o.map((E) => E.startsWith(".") ? E : E + "/*")), n(12, v = o.join(", ")))); + }, [ + o, + m, + u, + s, + a, + f, + c, + h, + C, + P, + g, + p, + v, + w, + S, + U, + x, + l, + d, + _, + O, + i, + r, + j, + te, + ne, + ce, + me, + _e, + B, + pe + ]; +} +class Id extends cd { + constructor(t) { + super(), md( + this, + t, + Cd, + Ad, + bd, + { + filetype: 0, + dragging: 17, + boundedheight: 2, + center: 3, + flex: 4, + file_count: 5, + disable_click: 18, + root: 6, + hidden: 7, + format: 19, + uploading: 1, + paste_clipboard: 8, + open_file_upload: 9, + load_files: 20 + }, + null, + [-1, -1] + ); + } + get paste_clipboard() { + return this.$$.ctx[8]; + } + get open_file_upload() { + return this.$$.ctx[9]; + } + get load_files() { + return this.$$.ctx[20]; + } +} +const { setContext: ap, getContext: Ld } = window.__gradio__svelte__internal, Pd = "WORKER_PROXY_CONTEXT_KEY"; +function Ts() { + return Ld(Pd); +} +function Od(e) { + return e.host === window.location.host || e.host === "localhost:7860" || e.host === "127.0.0.1:7860" || // Ref: https://github.com/gradio-app/gradio/blob/v3.32.0/js/app/src/Index.svelte#L194 + e.host === "lite.local"; +} +function As(e, t) { + const n = t.toLowerCase(); + for (const [r, i] of Object.entries(e)) + if (r.toLowerCase() === n) + return i; +} +function Bs(e) { + if (e == null) + return !1; + const t = new URL(e); + return !(!Od(t) || t.protocol !== "http:" && t.protocol !== "https:"); +} +async function Hd(e) { + if (e == null || !Bs(e)) + return e; + const t = Ts(); + if (t == null) + return e; + const r = new URL(e).pathname; + return t.httpRequest({ + method: "GET", + path: r, + headers: {}, + query_string: "" + }).then((i) => { + if (i.status !== 200) + throw new Error(`Failed to get file ${r} from the Wasm worker.`); + const o = new Blob([i.body], { + type: As(i.headers, "content-type") + }); + return URL.createObjectURL(o); + }); +} +const { + SvelteComponent: Nd, + assign: Vn, + check_outros: Cs, + compute_rest_props: So, + create_slot: vi, + detach: sr, + element: Is, + empty: Ls, + exclude_internal_props: Md, + get_all_dirty_from_scope: yi, + get_slot_changes: Ei, + get_spread_update: Ps, + group_outros: Os, + init: Dd, + insert: ar, + listen: Hs, + prevent_default: Rd, + safe_not_equal: Ud, + set_attributes: Xn, + transition_in: Lt, + transition_out: Pt, + update_slot_base: Si +} = window.__gradio__svelte__internal, { createEventDispatcher: Fd } = window.__gradio__svelte__internal; +function Gd(e) { + let t, n, r, i, o; + const l = ( + /*#slots*/ + e[8].default + ), u = vi( + l, + e, + /*$$scope*/ + e[7], + null + ); + let s = [ + { href: ( + /*href*/ + e[0] + ) }, + { + target: n = typeof window < "u" && window.__is_colab__ ? "_blank" : null + }, + { rel: "noopener noreferrer" }, + { download: ( + /*download*/ + e[1] + ) }, + /*$$restProps*/ + e[6] + ], a = {}; + for (let f = 0; f < s.length; f += 1) + a = Vn(a, s[f]); + return { + c() { + t = Is("a"), u && u.c(), Xn(t, a); + }, + m(f, d) { + ar(f, t, d), u && u.m(t, null), r = !0, i || (o = Hs( + t, + "click", + /*dispatch*/ + e[3].bind(null, "click") + ), i = !0); + }, + p(f, d) { + u && u.p && (!r || d & /*$$scope*/ + 128) && Si( + u, + l, + f, + /*$$scope*/ + f[7], + r ? Ei( + l, + /*$$scope*/ + f[7], + d, + null + ) : yi( + /*$$scope*/ + f[7] + ), + null + ), Xn(t, a = Ps(s, [ + (!r || d & /*href*/ + 1) && { href: ( + /*href*/ + f[0] + ) }, + { target: n }, + { rel: "noopener noreferrer" }, + (!r || d & /*download*/ + 2) && { download: ( + /*download*/ + f[1] + ) }, + d & /*$$restProps*/ + 64 && /*$$restProps*/ + f[6] + ])); + }, + i(f) { + r || (Lt(u, f), r = !0); + }, + o(f) { + Pt(u, f), r = !1; + }, + d(f) { + f && sr(t), u && u.d(f), i = !1, o(); + } + }; +} +function qd(e) { + let t, n, r, i; + const o = [xd, jd], l = []; + function u(s, a) { + return ( + /*is_downloading*/ + s[2] ? 0 : 1 + ); + } + return t = u(e), n = l[t] = o[t](e), { + c() { + n.c(), r = Ls(); + }, + m(s, a) { + l[t].m(s, a), ar(s, r, a), i = !0; + }, + p(s, a) { + let f = t; + t = u(s), t === f ? l[t].p(s, a) : (Os(), Pt(l[f], 1, 1, () => { + l[f] = null; + }), Cs(), n = l[t], n ? n.p(s, a) : (n = l[t] = o[t](s), n.c()), Lt(n, 1), n.m(r.parentNode, r)); + }, + i(s) { + i || (Lt(n), i = !0); + }, + o(s) { + Pt(n), i = !1; + }, + d(s) { + s && sr(r), l[t].d(s); + } + }; +} +function jd(e) { + let t, n, r, i; + const o = ( + /*#slots*/ + e[8].default + ), l = vi( + o, + e, + /*$$scope*/ + e[7], + null + ); + let u = [ + /*$$restProps*/ + e[6], + { href: ( + /*href*/ + e[0] + ) } + ], s = {}; + for (let a = 0; a < u.length; a += 1) + s = Vn(s, u[a]); + return { + c() { + t = Is("a"), l && l.c(), Xn(t, s); + }, + m(a, f) { + ar(a, t, f), l && l.m(t, null), n = !0, r || (i = Hs(t, "click", Rd( + /*wasm_click_handler*/ + e[5] + )), r = !0); + }, + p(a, f) { + l && l.p && (!n || f & /*$$scope*/ + 128) && Si( + l, + o, + a, + /*$$scope*/ + a[7], + n ? Ei( + o, + /*$$scope*/ + a[7], + f, + null + ) : yi( + /*$$scope*/ + a[7] + ), + null + ), Xn(t, s = Ps(u, [ + f & /*$$restProps*/ + 64 && /*$$restProps*/ + a[6], + (!n || f & /*href*/ + 1) && { href: ( + /*href*/ + a[0] + ) } + ])); + }, + i(a) { + n || (Lt(l, a), n = !0); + }, + o(a) { + Pt(l, a), n = !1; + }, + d(a) { + a && sr(t), l && l.d(a), r = !1, i(); + } + }; +} +function xd(e) { + let t; + const n = ( + /*#slots*/ + e[8].default + ), r = vi( + n, + e, + /*$$scope*/ + e[7], + null + ); + return { + c() { + r && r.c(); + }, + m(i, o) { + r && r.m(i, o), t = !0; + }, + p(i, o) { + r && r.p && (!t || o & /*$$scope*/ + 128) && Si( + r, + n, + i, + /*$$scope*/ + i[7], + t ? Ei( + n, + /*$$scope*/ + i[7], + o, + null + ) : yi( + /*$$scope*/ + i[7] + ), + null + ); + }, + i(i) { + t || (Lt(r, i), t = !0); + }, + o(i) { + Pt(r, i), t = !1; + }, + d(i) { + r && r.d(i); + } + }; +} +function zd(e) { + let t, n, r, i, o; + const l = [qd, Gd], u = []; + function s(a, f) { + return f & /*href*/ + 1 && (t = null), t == null && (t = !!/*worker_proxy*/ + (a[4] && Bs( + /*href*/ + a[0] + ))), t ? 0 : 1; + } + return n = s(e, -1), r = u[n] = l[n](e), { + c() { + r.c(), i = Ls(); + }, + m(a, f) { + u[n].m(a, f), ar(a, i, f), o = !0; + }, + p(a, [f]) { + let d = n; + n = s(a, f), n === d ? u[n].p(a, f) : (Os(), Pt(u[d], 1, 1, () => { + u[d] = null; + }), Cs(), r = u[n], r ? r.p(a, f) : (r = u[n] = l[n](a), r.c()), Lt(r, 1), r.m(i.parentNode, i)); + }, + i(a) { + o || (Lt(r), o = !0); + }, + o(a) { + Pt(r), o = !1; + }, + d(a) { + a && sr(i), u[n].d(a); + } + }; +} +function Vd(e, t, n) { + const r = ["href", "download"]; + let i = So(t, r), { $$slots: o = {}, $$scope: l } = t, { href: u = void 0 } = t, { download: s } = t; + const a = Fd(); + let f = !1; + const d = Ts(); + async function c() { + if (f) + return; + if (a("click"), u == null) + throw new Error("href is not defined."); + if (d == null) + throw new Error("Wasm worker proxy is not available."); + const _ = new URL(u).pathname; + n(2, f = !0), d.httpRequest({ + method: "GET", + path: _, + headers: {}, + query_string: "" + }).then((m) => { + if (m.status !== 200) + throw new Error(`Failed to get file ${_} from the Wasm worker.`); + const g = new Blob( + [m.body], + { + type: As(m.headers, "content-type") + } + ), p = URL.createObjectURL(g), v = document.createElement("a"); + v.href = p, v.download = s, v.click(), URL.revokeObjectURL(p); + }).finally(() => { + n(2, f = !1); + }); + } + return e.$$set = (h) => { + t = Vn(Vn({}, t), Md(h)), n(6, i = So(t, r)), "href" in h && n(0, u = h.href), "download" in h && n(1, s = h.download), "$$scope" in h && n(7, l = h.$$scope); + }, [ + u, + s, + f, + a, + d, + c, + i, + l, + o + ]; +} +class Ns extends Nd { + constructor(t) { + super(), Dd(this, t, Vd, zd, Ud, { href: 0, download: 1 }); + } +} +const { + SvelteComponent: Xd, + append: Ur, + attr: Wd, + check_outros: Fr, + create_component: gn, + destroy_component: bn, + detach: Zd, + element: Jd, + group_outros: Gr, + init: Qd, + insert: Yd, + mount_component: wn, + safe_not_equal: Kd, + set_style: ko, + space: qr, + toggle_class: To, + transition_in: Be, + transition_out: Xe +} = window.__gradio__svelte__internal, { createEventDispatcher: $d } = window.__gradio__svelte__internal; +function Ao(e) { + let t, n; + return t = new Jt({ + props: { + Icon: qu, + label: ( + /*i18n*/ + e[4]("common.edit") + ) + } + }), t.$on( + "click", + /*click_handler*/ + e[6] + ), { + c() { + gn(t.$$.fragment); + }, + m(r, i) { + wn(t, r, i), n = !0; + }, + p(r, i) { + const o = {}; + i & /*i18n*/ + 16 && (o.label = /*i18n*/ + r[4]("common.edit")), t.$set(o); + }, + i(r) { + n || (Be(t.$$.fragment, r), n = !0); + }, + o(r) { + Xe(t.$$.fragment, r), n = !1; + }, + d(r) { + bn(t, r); + } + }; +} +function Bo(e) { + let t, n; + return t = new Jt({ + props: { + Icon: pf, + label: ( + /*i18n*/ + e[4]("common.undo") + ) + } + }), t.$on( + "click", + /*click_handler_1*/ + e[7] + ), { + c() { + gn(t.$$.fragment); + }, + m(r, i) { + wn(t, r, i), n = !0; + }, + p(r, i) { + const o = {}; + i & /*i18n*/ + 16 && (o.label = /*i18n*/ + r[4]("common.undo")), t.$set(o); + }, + i(r) { + n || (Be(t.$$.fragment, r), n = !0); + }, + o(r) { + Xe(t.$$.fragment, r), n = !1; + }, + d(r) { + bn(t, r); + } + }; +} +function Co(e) { + let t, n; + return t = new Ns({ + props: { + href: ( + /*download*/ + e[2] + ), + download: !0, + $$slots: { default: [e_] }, + $$scope: { ctx: e } + } + }), { + c() { + gn(t.$$.fragment); + }, + m(r, i) { + wn(t, r, i), n = !0; + }, + p(r, i) { + const o = {}; + i & /*download*/ + 4 && (o.href = /*download*/ + r[2]), i & /*$$scope, i18n*/ + 528 && (o.$$scope = { dirty: i, ctx: r }), t.$set(o); + }, + i(r) { + n || (Be(t.$$.fragment, r), n = !0); + }, + o(r) { + Xe(t.$$.fragment, r), n = !1; + }, + d(r) { + bn(t, r); + } + }; +} +function e_(e) { + let t, n; + return t = new Jt({ + props: { + Icon: Nl, + label: ( + /*i18n*/ + e[4]("common.download") + ) + } + }), { + c() { + gn(t.$$.fragment); + }, + m(r, i) { + wn(t, r, i), n = !0; + }, + p(r, i) { + const o = {}; + i & /*i18n*/ + 16 && (o.label = /*i18n*/ + r[4]("common.download")), t.$set(o); + }, + i(r) { + n || (Be(t.$$.fragment, r), n = !0); + }, + o(r) { + Xe(t.$$.fragment, r), n = !1; + }, + d(r) { + bn(t, r); + } + }; +} +function t_(e) { + let t, n, r, i, o, l, u = ( + /*editable*/ + e[0] && Ao(e) + ), s = ( + /*undoable*/ + e[1] && Bo(e) + ), a = ( + /*download*/ + e[2] && Co(e) + ); + return o = new Jt({ + props: { + Icon: bu, + label: ( + /*i18n*/ + e[4]("common.clear") + ) + } + }), o.$on( + "click", + /*click_handler_2*/ + e[8] + ), { + c() { + t = Jd("div"), u && u.c(), n = qr(), s && s.c(), r = qr(), a && a.c(), i = qr(), gn(o.$$.fragment), Wd(t, "class", "svelte-1wj0ocy"), To(t, "not-absolute", !/*absolute*/ + e[3]), ko( + t, + "position", + /*absolute*/ + e[3] ? "absolute" : "static" + ); + }, + m(f, d) { + Yd(f, t, d), u && u.m(t, null), Ur(t, n), s && s.m(t, null), Ur(t, r), a && a.m(t, null), Ur(t, i), wn(o, t, null), l = !0; + }, + p(f, [d]) { + /*editable*/ + f[0] ? u ? (u.p(f, d), d & /*editable*/ + 1 && Be(u, 1)) : (u = Ao(f), u.c(), Be(u, 1), u.m(t, n)) : u && (Gr(), Xe(u, 1, 1, () => { + u = null; + }), Fr()), /*undoable*/ + f[1] ? s ? (s.p(f, d), d & /*undoable*/ + 2 && Be(s, 1)) : (s = Bo(f), s.c(), Be(s, 1), s.m(t, r)) : s && (Gr(), Xe(s, 1, 1, () => { + s = null; + }), Fr()), /*download*/ + f[2] ? a ? (a.p(f, d), d & /*download*/ + 4 && Be(a, 1)) : (a = Co(f), a.c(), Be(a, 1), a.m(t, i)) : a && (Gr(), Xe(a, 1, 1, () => { + a = null; + }), Fr()); + const c = {}; + d & /*i18n*/ + 16 && (c.label = /*i18n*/ + f[4]("common.clear")), o.$set(c), (!l || d & /*absolute*/ + 8) && To(t, "not-absolute", !/*absolute*/ + f[3]), d & /*absolute*/ + 8 && ko( + t, + "position", + /*absolute*/ + f[3] ? "absolute" : "static" + ); + }, + i(f) { + l || (Be(u), Be(s), Be(a), Be(o.$$.fragment, f), l = !0); + }, + o(f) { + Xe(u), Xe(s), Xe(a), Xe(o.$$.fragment, f), l = !1; + }, + d(f) { + f && Zd(t), u && u.d(), s && s.d(), a && a.d(), bn(o); + } + }; +} +function n_(e, t, n) { + let { editable: r = !1 } = t, { undoable: i = !1 } = t, { download: o = null } = t, { absolute: l = !0 } = t, { i18n: u } = t; + const s = $d(), a = () => s("edit"), f = () => s("undo"), d = (c) => { + s("clear"), c.stopPropagation(); + }; + return e.$$set = (c) => { + "editable" in c && n(0, r = c.editable), "undoable" in c && n(1, i = c.undoable), "download" in c && n(2, o = c.download), "absolute" in c && n(3, l = c.absolute), "i18n" in c && n(4, u = c.i18n); + }, [ + r, + i, + o, + l, + u, + s, + a, + f, + d + ]; +} +class ki extends Xd { + constructor(t) { + super(), Qd(this, t, n_, t_, Kd, { + editable: 0, + undoable: 1, + download: 2, + absolute: 3, + i18n: 4 + }); + } +} +const { + SvelteComponent: r_, + assign: fi, + compute_rest_props: Io, + detach: i_, + element: o_, + exclude_internal_props: l_, + get_spread_update: s_, + init: a_, + insert: u_, + noop: Lo, + safe_not_equal: f_, + set_attributes: Po, + src_url_equal: c_ +} = window.__gradio__svelte__internal; +function d_(e) { + let t, n, r = [ + { + src: n = /*resolved_src*/ + e[0] + }, + /*$$restProps*/ + e[1] + ], i = {}; + for (let o = 0; o < r.length; o += 1) + i = fi(i, r[o]); + return { + c() { + t = o_("img"), Po(t, i); + }, + m(o, l) { + u_(o, t, l); + }, + p(o, [l]) { + Po(t, i = s_(r, [ + l & /*resolved_src*/ + 1 && !c_(t.src, n = /*resolved_src*/ + o[0]) && { src: n }, + l & /*$$restProps*/ + 2 && /*$$restProps*/ + o[1] + ])); + }, + i: Lo, + o: Lo, + d(o) { + o && i_(t); + } + }; +} +function __(e, t, n) { + const r = ["src"]; + let i = Io(t, r), { src: o = void 0 } = t, l, u; + return e.$$set = (s) => { + t = fi(fi({}, t), l_(s)), n(1, i = Io(t, r)), "src" in s && n(2, o = s.src); + }, e.$$.update = () => { + if (e.$$.dirty & /*src, latest_src*/ + 12) { + n(0, l = o), n(3, u = o); + const s = o; + Hd(s).then((a) => { + u === s && n(0, l = a); + }); + } + }, [l, i, o, u]; +} +class Ms extends r_ { + constructor(t) { + super(), a_(this, t, __, d_, f_, { src: 2 }); + } +} +var Oo = Object.prototype.hasOwnProperty; +function Ho(e, t, n) { + for (n of e.keys()) + if (ln(n, t)) + return n; +} +function ln(e, t) { + var n, r, i; + if (e === t) + return !0; + if (e && t && (n = e.constructor) === t.constructor) { + if (n === Date) + return e.getTime() === t.getTime(); + if (n === RegExp) + return e.toString() === t.toString(); + if (n === Array) { + if ((r = e.length) === t.length) + for (; r-- && ln(e[r], t[r]); ) + ; + return r === -1; + } + if (n === Set) { + if (e.size !== t.size) + return !1; + for (r of e) + if (i = r, i && typeof i == "object" && (i = Ho(t, i), !i) || !t.has(i)) + return !1; + return !0; + } + if (n === Map) { + if (e.size !== t.size) + return !1; + for (r of e) + if (i = r[0], i && typeof i == "object" && (i = Ho(t, i), !i) || !ln(r[1], t.get(i))) + return !1; + return !0; + } + if (n === ArrayBuffer) + e = new Uint8Array(e), t = new Uint8Array(t); + else if (n === DataView) { + if ((r = e.byteLength) === t.byteLength) + for (; r-- && e.getInt8(r) === t.getInt8(r); ) + ; + return r === -1; + } + if (ArrayBuffer.isView(e)) { + if ((r = e.byteLength) === t.byteLength) + for (; r-- && e[r] === t[r]; ) + ; + return r === -1; + } + if (!n || typeof e == "object") { + r = 0; + for (n in e) + if (Oo.call(e, n) && ++r && !Oo.call(t, n) || !(n in t) || !ln(e[n], t[n])) + return !1; + return Object.keys(t).length === r; + } + } + return e !== e && t !== t; +} +function h_(e) { + return Object.prototype.toString.call(e) === "[object Object]"; +} +function No(e) { + return h_(e) || Array.isArray(e); +} +function m_() { + return !!(typeof window < "u" && window.document && window.document.createElement); +} +function Ti(e, t) { + const n = Object.keys(e), r = Object.keys(t); + if (n.length !== r.length) + return !1; + const i = JSON.stringify(Object.keys(e.breakpoints || {})), o = JSON.stringify(Object.keys(t.breakpoints || {})); + return i !== o ? !1 : n.every((l) => { + const u = e[l], s = t[l]; + return typeof u == "function" ? `${u}` == `${s}` : !No(u) || !No(s) ? u === s : Ti(u, s); + }); +} +function Mo(e) { + return e.concat().sort((t, n) => t.name > n.name ? 1 : -1).map((t) => t.options); +} +function p_(e, t) { + if (e.length !== t.length) + return !1; + const n = Mo(e), r = Mo(t); + return n.every((i, o) => { + const l = r[o]; + return Ti(i, l); + }); +} +function Ai(e) { + return typeof e == "number"; +} +function ci(e) { + return typeof e == "string"; +} +function Bi(e) { + return typeof e == "boolean"; +} +function Do(e) { + return Object.prototype.toString.call(e) === "[object Object]"; +} +function ue(e) { + return Math.abs(e); +} +function Ci(e) { + return Math.sign(e); +} +function sn(e, t) { + return ue(e - t); +} +function g_(e, t) { + if (e === 0 || t === 0 || ue(e) <= ue(t)) + return 0; + const n = sn(ue(e), ue(t)); + return ue(n / e); +} +function fn(e) { + return cn(e).map(Number); +} +function Ze(e) { + return e[vn(e)]; +} +function vn(e) { + return Math.max(0, e.length - 1); +} +function Ii(e, t) { + return t === vn(e); +} +function Ro(e, t = 0) { + return Array.from(Array(e), (n, r) => t + r); +} +function cn(e) { + return Object.keys(e); +} +function Ds(e, t) { + return [e, t].reduce((n, r) => (cn(r).forEach((i) => { + const o = n[i], l = r[i], u = Do(o) && Do(l); + n[i] = u ? Ds(o, l) : l; + }), n), {}); +} +function Rs(e, t) { + return typeof t.MouseEvent < "u" && e instanceof t.MouseEvent; +} +function b_(e, t) { + const n = { + start: r, + center: i, + end: o + }; + function r() { + return 0; + } + function i(s) { + return o(s) / 2; + } + function o(s) { + return t - s; + } + function l(s, a) { + return ci(e) ? n[e](s) : e(t, s, a); + } + return { + measure: l + }; +} +function dn() { + let e = []; + function t(i, o, l, u = { + passive: !0 + }) { + let s; + if ("addEventListener" in i) + i.addEventListener(o, l, u), s = () => i.removeEventListener(o, l, u); + else { + const a = i; + a.addListener(l), s = () => a.removeListener(l); + } + return e.push(s), r; + } + function n() { + e = e.filter((i) => i()); + } + const r = { + add: t, + clear: n + }; + return r; +} +function w_(e, t, n, r) { + const i = dn(), o = 1e3 / 60; + let l = null, u = 0, s = 0; + function a() { + i.add(e, "visibilitychange", () => { + e.hidden && _(); + }); + } + function f() { + h(), i.clear(); + } + function d(g) { + l || (l = g); + const p = g - l; + for (l = g, u += p; u >= o; ) + n(), u -= o; + const v = ue(u / o); + r(v), s && t.requestAnimationFrame(d); + } + function c() { + s || (s = t.requestAnimationFrame(d)); + } + function h() { + t.cancelAnimationFrame(s), l = null, u = 0, s = 0; + } + function _() { + l = null, u = 0; + } + return { + init: a, + destroy: f, + start: c, + stop: h, + update: n, + render: r + }; +} +function v_(e, t) { + const n = e === "y" ? "y" : "x", r = e === "y" ? "x" : "y", i = u(), o = s(); + function l(f) { + const { + width: d, + height: c + } = f; + return n === "x" ? d : c; + } + function u() { + return n === "y" ? "top" : t === "rtl" ? "right" : "left"; + } + function s() { + return n === "y" ? "bottom" : t === "rtl" ? "left" : "right"; + } + return { + scroll: n, + cross: r, + startEdge: i, + endEdge: o, + measureSize: l + }; +} +function Ot(e = 0, t = 0) { + const n = ue(e - t); + function r(a) { + return a < e; + } + function i(a) { + return a > t; + } + function o(a) { + return r(a) || i(a); + } + function l(a) { + return o(a) ? r(a) ? e : t : a; + } + function u(a) { + return n ? a - n * Math.ceil((a - t) / n) : a; + } + return { + length: n, + max: t, + min: e, + constrain: l, + reachedAny: o, + reachedMax: i, + reachedMin: r, + removeOffset: u + }; +} +function Us(e, t, n) { + const { + constrain: r + } = Ot(0, e), i = e + 1; + let o = l(t); + function l(c) { + return n ? ue((i + c) % i) : r(c); + } + function u() { + return o; + } + function s(c) { + return o = l(c), d; + } + function a(c) { + return f().set(u() + c); + } + function f() { + return Us(e, u(), n); + } + const d = { + get: u, + set: s, + add: a, + clone: f + }; + return d; +} +function y_(e) { + const t = e === "rtl" ? -1 : 1; + function n(i) { + return i * t; + } + return { + apply: n + }; +} +function E_(e, t, n, r, i, o, l, u, s, a, f, d, c, h, _, m, g, p, v, b) { + const { + cross: w + } = e, y = ["INPUT", "SELECT", "TEXTAREA"], S = { + passive: !1 + }, C = dn(), P = dn(), k = Ot(50, 225).constrain(_.measure(20)), O = { + mouse: 300, + touch: 400 + }, U = { + mouse: 500, + touch: 600 + }, x = m ? 43 : 25; + let j = !1, te = 0, ne = 0, ce = !1, me = !1, _e = !1, B = !1; + function pe(I) { + if (!b) + return; + function N(Y) { + (Bi(b) || b(I, Y)) && re(Y); + } + const Q = n; + C.add(Q, "dragstart", (Y) => Y.preventDefault(), S).add(Q, "touchmove", () => { + }, S).add(Q, "touchend", () => { + }).add(Q, "touchstart", N).add(Q, "mousedown", N).add(Q, "touchcancel", ee).add(Q, "contextmenu", ee).add(Q, "click", T, !0); + } + function E() { + C.clear(), P.clear(); + } + function M() { + const I = B ? r : n; + P.add(I, "touchmove", z, S).add(I, "touchend", ee).add(I, "mousemove", z, S).add(I, "mouseup", ee); + } + function A(I) { + const N = I.nodeName || ""; + return y.includes(N); + } + function F() { + return (m ? U : O)[B ? "mouse" : "touch"]; + } + function L(I, N) { + const Q = c.add(Ci(I) * -1), Y = d.byDistance(I, !m).distance; + return m || ue(I) < k ? Y : p && N ? Y * 0.5 : d.byIndex(Q.get(), 0).distance; + } + function re(I) { + const N = Rs(I, i); + B = N, !(N && I.button !== 0) && (A(I.target) || (_e = m && N && !I.buttons && j, j = sn(o.get(), u.get()) >= 2, ce = !0, l.pointerDown(I), f.useFriction(0).useDuration(0), o.set(u), M(), te = l.readPoint(I), ne = l.readPoint(I, w), h.emit("pointerDown"))); + } + function z(I) { + const N = l.readPoint(I), Q = l.readPoint(I, w), Y = sn(N, te), R = sn(Q, ne); + if (!me && !B && (!I.cancelable || (me = Y > R, !me))) + return ee(I); + const Te = l.pointerMove(I); + Y > g && (_e = !0), f.useFriction(0.3).useDuration(1), s.start(), o.add(t.apply(Te)), I.preventDefault(); + } + function ee(I) { + const Q = d.byDistance(0, !1).index !== c.get(), Y = l.pointerUp(I) * F(), R = L(t.apply(Y), Q), Te = g_(Y, R), He = x - 10 * Te, Ie = v + Te / 50; + me = !1, ce = !1, P.clear(), f.useDuration(He).useFriction(Ie), a.distance(R, !m), B = !1, h.emit("pointerUp"); + } + function T(I) { + _e && (I.stopPropagation(), I.preventDefault()); + } + function H() { + return ce; + } + return { + init: pe, + pointerDown: H, + destroy: E + }; +} +function S_(e, t) { + let r, i; + function o(d) { + return d.timeStamp; + } + function l(d, c) { + const _ = `client${(c || e.scroll) === "x" ? "X" : "Y"}`; + return (Rs(d, t) ? d : d.touches[0])[_]; + } + function u(d) { + return r = d, i = d, l(d); + } + function s(d) { + const c = l(d) - l(i), h = o(d) - o(r) > 170; + return i = d, h && (r = d), c; + } + function a(d) { + if (!r || !i) + return 0; + const c = l(i) - l(r), h = o(d) - o(r), _ = o(d) - o(i) > 170, m = c / h; + return h && !_ && ue(m) > 0.1 ? m : 0; + } + return { + pointerDown: u, + pointerMove: s, + pointerUp: a, + readPoint: l + }; +} +function k_() { + function e(n) { + const { + offsetTop: r, + offsetLeft: i, + offsetWidth: o, + offsetHeight: l + } = n; + return { + top: r, + right: i + o, + bottom: r + l, + left: i, + width: o, + height: l + }; + } + return { + measure: e + }; +} +function T_(e) { + function t(r) { + return e * (r / 100); + } + return { + measure: t + }; +} +function A_(e, t, n, r, i, o, l) { + let u, s, a = [], f = !1; + function d(m) { + return i.measureSize(l.measure(m)); + } + function c(m) { + if (!o) + return; + s = d(e), a = r.map(d); + function g(v) { + for (const b of v) { + const w = b.target === e, y = r.indexOf(b.target), S = w ? s : a[y], C = d(w ? e : r[y]); + if (ue(C - S) >= 0.5) { + n.requestAnimationFrame(() => { + m.reInit(), t.emit("resize"); + }); + break; + } + } + } + u = new ResizeObserver((v) => { + f || (Bi(o) || o(m, v)) && g(v); + }), [e].concat(r).forEach((v) => u.observe(v)); + } + function h() { + u && u.disconnect(), f = !0; + } + return { + init: c, + destroy: h + }; +} +function B_(e, t, n, r, i) { + let o = 0, l = 0, u = r, s = i, a = e.get(), f = 0; + function d() { + const y = n.get() - e.get(), S = !u; + let C = 0; + return S ? (o = 0, e.set(n), C = y) : (o += y / u, o *= s, a += o, e.add(o), C = a - f), l = Ci(C), f = a, w; + } + function c() { + const y = n.get() - t.get(); + return ue(y) < 1e-3; + } + function h() { + return u; + } + function _() { + return l; + } + function m() { + return o; + } + function g() { + return v(r); + } + function p() { + return b(i); + } + function v(y) { + return u = y, w; + } + function b(y) { + return s = y, w; + } + const w = { + direction: _, + duration: h, + velocity: m, + seek: d, + settled: c, + useBaseFriction: p, + useBaseDuration: g, + useFriction: b, + useDuration: v + }; + return w; +} +function C_(e, t, n, r, i) { + const o = i.measure(10), l = i.measure(50), u = Ot(0.1, 0.99); + let s = !1; + function a() { + return !(s || !e.reachedAny(n.get()) || !e.reachedAny(t.get())); + } + function f(h) { + if (!a()) + return; + const _ = e.reachedMin(t.get()) ? "min" : "max", m = ue(e[_] - t.get()), g = n.get() - t.get(), p = u.constrain(m / l); + n.subtract(g * p), !h && ue(g) < o && (n.set(e.constrain(n.get())), r.useDuration(25).useBaseFriction()); + } + function d(h) { + s = !h; + } + return { + constrain: f, + toggleActive: d + }; +} +function I_(e, t, n, r, i) { + const o = Ot(-t + e, 0), l = d(), u = f(), s = c(); + function a(_, m) { + return sn(_, m) < 1; + } + function f() { + const _ = l[0], m = Ze(l), g = l.lastIndexOf(_), p = l.indexOf(m) + 1; + return Ot(g, p); + } + function d() { + return n.map((_, m) => { + const { + min: g, + max: p + } = o, v = o.constrain(_), b = !m, w = Ii(n, m); + return b ? p : w || a(g, v) ? g : a(p, v) ? p : v; + }).map((_) => parseFloat(_.toFixed(3))); + } + function c() { + if (t <= e + i) + return [o.max]; + if (r === "keepSnaps") + return l; + const { + min: _, + max: m + } = u; + return l.slice(_, m); + } + return { + snapsContained: s, + scrollContainLimit: u + }; +} +function L_(e, t, n) { + const r = t[0], i = n ? r - e : Ze(t); + return { + limit: Ot(i, r) + }; +} +function P_(e, t, n, r) { + const o = t.min + 0.1, l = t.max + 0.1, { + reachedMin: u, + reachedMax: s + } = Ot(o, l); + function a(c) { + return c === 1 ? s(n.get()) : c === -1 ? u(n.get()) : !1; + } + function f(c) { + if (!a(c)) + return; + const h = e * (c * -1); + r.forEach((_) => _.add(h)); + } + return { + loop: f + }; +} +function O_(e) { + const { + max: t, + length: n + } = e; + function r(o) { + const l = o - t; + return n ? l / -n : 0; + } + return { + get: r + }; +} +function H_(e, t, n, r, i) { + const { + startEdge: o, + endEdge: l + } = e, { + groupSlides: u + } = i, s = d().map(t.measure), a = c(), f = h(); + function d() { + return u(r).map((m) => Ze(m)[l] - m[0][o]).map(ue); + } + function c() { + return r.map((m) => n[o] - m[o]).map((m) => -ue(m)); + } + function h() { + return u(a).map((m) => m[0]).map((m, g) => m + s[g]); + } + return { + snaps: a, + snapsAligned: f + }; +} +function N_(e, t, n, r, i, o) { + const { + groupSlides: l + } = i, { + min: u, + max: s + } = r, a = f(); + function f() { + const c = l(o), h = !e || t === "keepSnaps"; + return n.length === 1 ? [o] : h ? c : c.slice(u, s).map((_, m, g) => { + const p = !m, v = Ii(g, m); + if (p) { + const b = Ze(g[0]) + 1; + return Ro(b); + } + if (v) { + const b = vn(o) - Ze(g)[0] + 1; + return Ro(b, Ze(g)[0]); + } + return _; + }); + } + return { + slideRegistry: a + }; +} +function M_(e, t, n, r, i) { + const { + reachedAny: o, + removeOffset: l, + constrain: u + } = r; + function s(_) { + return _.concat().sort((m, g) => ue(m) - ue(g))[0]; + } + function a(_) { + const m = e ? l(_) : u(_), g = t.map((v) => v - m).map((v) => f(v, 0)).map((v, b) => ({ + diff: v, + index: b + })).sort((v, b) => ue(v.diff) - ue(b.diff)), { + index: p + } = g[0]; + return { + index: p, + distance: m + }; + } + function f(_, m) { + const g = [_, _ + n, _ - n]; + if (!e) + return g[0]; + if (!m) + return s(g); + const p = g.filter((v) => Ci(v) === m); + return p.length ? s(p) : Ze(g) - n; + } + function d(_, m) { + const g = t[_] - i.get(), p = f(g, m); + return { + index: _, + distance: p + }; + } + function c(_, m) { + const g = i.get() + _, { + index: p, + distance: v + } = a(g), b = !e && o(g); + if (!m || b) + return { + index: p, + distance: _ + }; + const w = t[p] - v, y = _ + f(w, 0); + return { + index: p, + distance: y + }; + } + return { + byDistance: c, + byIndex: d, + shortcut: f + }; +} +function D_(e, t, n, r, i, o, l) { + function u(d) { + const c = d.distance, h = d.index !== t.get(); + o.add(c), c && (r.duration() ? e.start() : (e.update(), e.render(1), e.update())), h && (n.set(t.get()), t.set(d.index), l.emit("select")); + } + function s(d, c) { + const h = i.byDistance(d, c); + u(h); + } + function a(d, c) { + const h = t.clone().set(d), _ = i.byIndex(h.get(), c); + u(_); + } + return { + distance: s, + index: a + }; +} +function R_(e, t, n, r, i, o) { + let l = 0; + function u() { + o.add(document, "keydown", s, !1), t.forEach(a); + } + function s(d) { + d.code === "Tab" && (l = (/* @__PURE__ */ new Date()).getTime()); + } + function a(d) { + const c = () => { + if ((/* @__PURE__ */ new Date()).getTime() - l > 10) + return; + e.scrollLeft = 0; + const m = t.indexOf(d), g = n.findIndex((p) => p.includes(m)); + Ai(g) && (i.useDuration(0), r.index(g, 0)); + }; + o.add(d, "focus", c, { + passive: !0, + capture: !0 + }); + } + return { + init: u + }; +} +function Fn(e) { + let t = e; + function n() { + return t; + } + function r(s) { + t = l(s); + } + function i(s) { + t += l(s); + } + function o(s) { + t -= l(s); + } + function l(s) { + return Ai(s) ? s : s.get(); + } + return { + get: n, + set: r, + add: i, + subtract: o + }; +} +function Fs(e, t, n) { + const r = e.scroll === "x" ? l : u, i = n.style; + let o = !1; + function l(c) { + return `translate3d(${c}px,0px,0px)`; + } + function u(c) { + return `translate3d(0px,${c}px,0px)`; + } + function s(c) { + o || (i.transform = r(t.apply(c))); + } + function a(c) { + o = !c; + } + function f() { + o || (i.transform = "", n.getAttribute("style") || n.removeAttribute("style")); + } + return { + clear: f, + to: s, + toggleActive: a + }; +} +function U_(e, t, n, r, i, o, l, u, s, a) { + const d = fn(o), c = fn(o).reverse(), h = v().concat(b()); + function _(P, k) { + return P.reduce((O, U) => O - o[U], k); + } + function m(P, k) { + return P.reduce((O, U) => _(O, k) > 0 ? O.concat([U]) : O, []); + } + function g(P) { + return l.map((k, O) => ({ + start: k - i[O] + 0.5 + P, + end: k + n - 0.5 + P + })); + } + function p(P, k, O) { + const U = g(k); + return P.map((x) => { + const j = O ? 0 : -r, te = O ? r : 0, ne = O ? "end" : "start", ce = U[x][ne]; + return { + index: x, + loopPoint: ce, + slideLocation: Fn(-1), + translate: Fs(e, t, a[x]), + target: () => s.get() > ce ? j : te + }; + }); + } + function v() { + const P = u[0], k = m(c, P); + return p(k, r, !1); + } + function b() { + const P = n - u[0] - 1, k = m(d, P); + return p(k, -r, !0); + } + function w() { + return h.every(({ + index: P + }) => { + const k = d.filter((O) => O !== P); + return _(k, n) <= 0.1; + }); + } + function y() { + h.forEach((P) => { + const { + target: k, + translate: O, + slideLocation: U + } = P, x = k(); + x !== U.get() && (O.to(x), U.set(x)); + }); + } + function S() { + h.forEach((P) => P.translate.clear()); + } + return { + canLoop: w, + clear: S, + loop: y, + loopPoints: h + }; +} +function F_(e, t, n) { + let r, i = !1; + function o(s) { + if (!n) + return; + function a(f) { + for (const d of f) + if (d.type === "childList") { + s.reInit(), t.emit("slidesChanged"); + break; + } + } + r = new MutationObserver((f) => { + i || (Bi(n) || n(s, f)) && a(f); + }), r.observe(e, { + childList: !0 + }); + } + function l() { + r && r.disconnect(), i = !0; + } + return { + init: o, + destroy: l + }; +} +function G_(e, t, n, r) { + const i = {}; + let o = null, l = null, u, s = !1; + function a() { + u = new IntersectionObserver((_) => { + s || (_.forEach((m) => { + const g = t.indexOf(m.target); + i[g] = m; + }), o = null, l = null, n.emit("slidesInView")); + }, { + root: e.parentElement, + threshold: r + }), t.forEach((_) => u.observe(_)); + } + function f() { + u && u.disconnect(), s = !0; + } + function d(_) { + return cn(i).reduce((m, g) => { + const p = parseInt(g), { + isIntersecting: v + } = i[p]; + return (_ && v || !_ && !v) && m.push(p), m; + }, []); + } + function c(_ = !0) { + if (_ && o) + return o; + if (!_ && l) + return l; + const m = d(_); + return _ && (o = m), _ || (l = m), m; + } + return { + init: a, + destroy: f, + get: c + }; +} +function q_(e, t, n, r, i, o) { + const { + measureSize: l, + startEdge: u, + endEdge: s + } = e, a = n[0] && i, f = _(), d = m(), c = n.map(l), h = g(); + function _() { + if (!a) + return 0; + const v = n[0]; + return ue(t[u] - v[u]); + } + function m() { + if (!a) + return 0; + const v = o.getComputedStyle(Ze(r)); + return parseFloat(v.getPropertyValue(`margin-${s}`)); + } + function g() { + return n.map((v, b, w) => { + const y = !b, S = Ii(w, b); + return y ? c[b] + f : S ? c[b] + d : w[b + 1][u] - v[u]; + }).map(ue); + } + return { + slideSizes: c, + slideSizesWithGaps: h, + startGap: f, + endGap: d + }; +} +function j_(e, t, n, r, i, o, l, u, s, a) { + const { + startEdge: f, + endEdge: d + } = e, c = Ai(r); + function h(p, v) { + return fn(p).filter((b) => b % v === 0).map((b) => p.slice(b, b + v)); + } + function _(p) { + return p.length ? fn(p).reduce((v, b) => { + const w = Ze(v) || 0, y = w === 0, S = b === vn(p), C = o[f] - l[w][f], P = o[f] - l[b][d], k = !i && y ? t.apply(u) : 0, O = !i && S ? t.apply(s) : 0; + return ue(P - O - (C + k)) > n + a && v.push(b), S && v.push(p.length), v; + }, []).map((v, b, w) => { + const y = Math.max(w[b - 1] || 0); + return p.slice(y, v); + }) : []; + } + function m(p) { + return c ? h(p, r) : _(p); + } + return { + groupSlides: m + }; +} +function x_(e, t, n, r, i, o, l) { + const { + align: u, + axis: s, + direction: a, + startIndex: f, + loop: d, + duration: c, + dragFree: h, + dragThreshold: _, + inViewThreshold: m, + slidesToScroll: g, + skipSnaps: p, + containScroll: v, + watchResize: b, + watchSlides: w, + watchDrag: y + } = o, S = 2, C = k_(), P = C.measure(t), k = n.map(C.measure), O = y_(a), U = v_(s, a), x = U.measureSize(P), j = T_(x), te = b_(u, x), ne = !d && !!v, ce = d || !!v, { + slideSizes: me, + slideSizesWithGaps: _e, + startGap: B, + endGap: pe + } = q_(U, P, k, n, ce, i), E = j_(U, O, x, g, d, P, k, B, pe, S), { + snaps: M, + snapsAligned: A + } = H_(U, te, P, k, E), F = -Ze(M) + Ze(_e), { + snapsContained: L, + scrollContainLimit: re + } = I_(x, F, A, v, S), z = ne ? L : A, { + limit: ee + } = L_(F, z, d), T = Us(vn(z), f, d), H = T.clone(), D = fn(n), I = ({ + dragHandler: Ae, + scrollBody: $t, + scrollBounds: cr, + options: { + loop: kn + } + }) => { + kn || cr.constrain(Ae.pointerDown()), $t.seek(); + }, N = ({ + scrollBody: Ae, + translate: $t, + location: cr, + offsetLocation: kn, + scrollLooper: Ys, + slideLooper: Ks, + dragHandler: $s, + animation: ea, + eventHandler: Oi, + options: { + loop: ta + } + }, na) => { + const Hi = Ae.velocity(), Ni = Ae.settled(); + Ni && !$s.pointerDown() && (ea.stop(), Oi.emit("settle")), Ni || Oi.emit("scroll"), kn.set(cr.get() - Hi + Hi * na), ta && (Ys.loop(Ae.direction()), Ks.loop()), $t.to(kn.get()); + }, Q = w_(r, i, () => I(Z), (Ae) => N(Z, Ae)), Y = 0.68, R = z[T.get()], Te = Fn(R), He = Fn(R), Ie = Fn(R), $e = B_(Te, He, Ie, c, Y), de = M_(d, z, F, ee, Ie), we = D_(Q, T, H, $e, de, Ie, l), oe = O_(ee), se = dn(), Le = G_(t, n, l, m), { + slideRegistry: ge + } = N_(ne, v, z, re, E, D), K = R_(e, n, ge, we, $e, se), Z = { + ownerDocument: r, + ownerWindow: i, + eventHandler: l, + containerRect: P, + slideRects: k, + animation: Q, + axis: U, + direction: O, + dragHandler: E_(U, O, e, r, i, Ie, S_(U, i), Te, Q, we, $e, de, T, l, j, h, _, p, Y, y), + eventStore: se, + percentOfView: j, + index: T, + indexPrevious: H, + limit: ee, + location: Te, + offsetLocation: He, + options: o, + resizeHandler: A_(t, l, i, n, U, b, C), + scrollBody: $e, + scrollBounds: C_(ee, Te, Ie, $e, j), + scrollLooper: P_(F, ee, He, [Te, He, Ie]), + scrollProgress: oe, + scrollSnapList: z.map(oe.get), + scrollSnaps: z, + scrollTarget: de, + scrollTo: we, + slideLooper: U_(U, O, x, F, me, _e, M, z, He, n), + slideFocus: K, + slidesHandler: F_(t, l, w), + slidesInView: Le, + slideIndexes: D, + slideRegistry: ge, + slidesToScroll: E, + target: Ie, + translate: Fs(U, O, t) + }; + return Z; +} +function z_() { + const e = {}; + let t; + function n(s) { + t = s; + } + function r(s) { + return e[s] || []; + } + function i(s) { + return r(s).forEach((a) => a(t, s)), u; + } + function o(s, a) { + return e[s] = r(s).concat([a]), u; + } + function l(s, a) { + return e[s] = r(s).filter((f) => f !== a), u; + } + const u = { + init: n, + emit: i, + off: l, + on: o + }; + return u; +} +const V_ = { + align: "center", + axis: "x", + container: null, + slides: null, + containScroll: "trimSnaps", + direction: "ltr", + slidesToScroll: 1, + inViewThreshold: 0, + breakpoints: {}, + dragFree: !1, + dragThreshold: 10, + loop: !1, + skipSnaps: !1, + duration: 25, + startIndex: 0, + active: !0, + watchDrag: !0, + watchResize: !0, + watchSlides: !0 +}; +function X_(e) { + function t(o, l) { + return Ds(o, l || {}); + } + function n(o) { + const l = o.breakpoints || {}, u = cn(l).filter((s) => e.matchMedia(s).matches).map((s) => l[s]).reduce((s, a) => t(s, a), {}); + return t(o, u); + } + function r(o) { + return o.map((l) => cn(l.breakpoints || {})).reduce((l, u) => l.concat(u), []).map(e.matchMedia); + } + return { + mergeOptions: t, + optionsAtMedia: n, + optionsMediaQueries: r + }; +} +function W_(e) { + let t = []; + function n(o, l) { + return t = l.filter(({ + options: u + }) => e.optionsAtMedia(u).active !== !1), t.forEach((u) => u.init(o, e)), l.reduce((u, s) => Object.assign(u, { + [s.name]: s + }), {}); + } + function r() { + t = t.filter((o) => o.destroy()); + } + return { + init: n, + destroy: r + }; +} +function Wn(e, t, n) { + const r = e.ownerDocument, i = r.defaultView, o = X_(i), l = W_(o), u = dn(), s = z_(), { + mergeOptions: a, + optionsAtMedia: f, + optionsMediaQueries: d + } = o, { + on: c, + off: h, + emit: _ + } = s, m = U; + let g = !1, p, v = a(V_, Wn.globalOptions), b = a(v), w = [], y, S, C; + function P() { + const { + container: D, + slides: I + } = b; + S = (ci(D) ? e.querySelector(D) : D) || e.children[0]; + const Q = ci(I) ? S.querySelectorAll(I) : I; + C = [].slice.call(Q || S.children); + } + function k(D) { + const I = x_(e, S, C, r, i, D, s); + if (D.loop && !I.slideLooper.canLoop()) { + const N = Object.assign({}, D, { + loop: !1 + }); + return k(N); + } + return I; + } + function O(D, I) { + g || (v = a(v, D), b = f(v), w = I || w, P(), p = k(b), d([v, ...w.map(({ + options: N + }) => N)]).forEach((N) => u.add(N, "change", U)), b.active && (p.translate.to(p.location.get()), p.animation.init(), p.slidesInView.init(), p.slideFocus.init(), p.eventHandler.init(H), p.resizeHandler.init(H), p.slidesHandler.init(H), p.options.loop && p.slideLooper.loop(), S.offsetParent && C.length && p.dragHandler.init(H), y = l.init(H, w))); + } + function U(D, I) { + const N = E(); + x(), O(a({ + startIndex: N + }, D), I), s.emit("reInit"); + } + function x() { + p.dragHandler.destroy(), p.eventStore.clear(), p.translate.clear(), p.slideLooper.clear(), p.resizeHandler.destroy(), p.slidesHandler.destroy(), p.slidesInView.destroy(), p.animation.destroy(), l.destroy(), u.clear(); + } + function j() { + g || (g = !0, u.clear(), x(), s.emit("destroy")); + } + function te(D, I, N) { + !b.active || g || (p.scrollBody.useBaseFriction().useDuration(I === !0 ? 0 : b.duration), p.scrollTo.index(D, N || 0)); + } + function ne(D) { + const I = p.index.add(1).get(); + te(I, D, -1); + } + function ce(D) { + const I = p.index.add(-1).get(); + te(I, D, 1); + } + function me() { + return p.index.add(1).get() !== E(); + } + function _e() { + return p.index.add(-1).get() !== E(); + } + function B() { + return p.scrollSnapList; + } + function pe() { + return p.scrollProgress.get(p.location.get()); + } + function E() { + return p.index.get(); + } + function M() { + return p.indexPrevious.get(); + } + function A() { + return p.slidesInView.get(); + } + function F() { + return p.slidesInView.get(!1); + } + function L() { + return y; + } + function re() { + return p; + } + function z() { + return e; + } + function ee() { + return S; + } + function T() { + return C; + } + const H = { + canScrollNext: me, + canScrollPrev: _e, + containerNode: ee, + internalEngine: re, + destroy: j, + off: h, + on: c, + emit: _, + plugins: L, + previousScrollSnap: M, + reInit: m, + rootNode: z, + scrollNext: ne, + scrollPrev: ce, + scrollProgress: pe, + scrollSnapList: B, + scrollTo: te, + selectedScrollSnap: E, + slideNodes: T, + slidesInView: A, + slidesNotInView: F + }; + return O(t, n), setTimeout(() => s.emit("init"), 0), H; +} +Wn.globalOptions = void 0; +function Li(e, t = { + options: {}, + plugins: [] +}) { + let n = t, r; + return m_() && (Wn.globalOptions = Li.globalOptions, r = Wn(e, n.options, n.plugins), r.on("init", () => e.dispatchEvent(new CustomEvent("emblaInit", { + detail: r + })))), { + destroy: () => { + r && r.destroy(); + }, + update: (i) => { + const o = !Ti(n.options, i.options), l = !p_(n.plugins, i.plugins); + !o && !l || (n = i, r && r.reInit(n.options, n.plugins)); + } + }; +} +Li.globalOptions = void 0; +const Z_ = 4.2, J_ = (e, t, n) => Math.min(Math.max(e, t), n), Q_ = (e) => { + const t = e.internalEngine(), n = e.scrollProgress(); + return e.scrollSnapList().map((r, i) => { + if (!e.slidesInView().includes(i)) + return 0; + let o = r - n; + t.options.loop && t.slideLooper.loopPoints.forEach((u) => { + const s = u.target(); + if (i === u.index && s !== 0) { + const a = Math.sign(s); + a === -1 && (o = r - (1 + n)), a === 1 && (o = r + (1 - n)); + } + }); + const l = 1 - Math.abs(o * Z_); + return J_(l, 0, 1); + }); +}, Y_ = (e) => { + const t = e.slideNodes(); + return { + applyTweenOpacity: () => { + Q_(e).forEach((o, l) => { + t[l].style.opacity = o.toString(); + }); + }, + removeTweenOpacity: () => { + t.forEach((i) => i.removeAttribute("style")); + } + }; +}, K_ = { + active: !0, + breakpoints: {}, + delay: 4e3, + jump: !1, + playOnInit: !0, + stopOnFocusIn: !0, + stopOnInteraction: !0, + stopOnMouseEnter: !1, + stopOnLastSnap: !1, + rootNode: null +}; +function Pi(e = {}) { + let t, n, r, i = !1, o = !0, l = !1, u = 0, s = 0; + function a(w, y) { + n = w; + const { + mergeOptions: S, + optionsAtMedia: C + } = y, P = S(K_, Pi.globalOptions), k = S(P, e); + if (t = C(k), n.scrollSnapList().length <= 1) + return; + l = t.jump, r = !1; + const { + eventStore: O, + ownerDocument: U + } = n.internalEngine(), x = n.rootNode(), j = t.rootNode && t.rootNode(x) || x, te = n.containerNode(); + n.on("pointerDown", c), t.stopOnInteraction || n.on("pointerUp", d), t.stopOnMouseEnter && (O.add(j, "mouseenter", () => { + o = !1, c(); + }), t.stopOnInteraction || O.add(j, "mouseleave", () => { + o = !0, d(); + })), t.stopOnFocusIn && (O.add(te, "focusin", c), t.stopOnInteraction || O.add(te, "focusout", d)), O.add(U, "visibilitychange", h), t.playOnInit && n.on("init", d).on("reInit", d); + } + function f() { + r = !0, i = !1, n.off("init", d).off("reInit", d).off("pointerDown", c).off("pointerUp", d), c(), cancelAnimationFrame(u), u = 0; + } + function d() { + if (r || !o) + return; + i || n.emit("autoplay:play"); + const { + ownerWindow: w + } = n.internalEngine(); + w.clearInterval(s), s = w.setInterval(v, t.delay), i = !0; + } + function c() { + if (r) + return; + i && n.emit("autoplay:stop"); + const { + ownerWindow: w + } = n.internalEngine(); + w.clearInterval(s), s = 0, i = !1; + } + function h() { + const { + ownerDocument: w + } = n.internalEngine(); + if (w.visibilityState === "hidden") + return o = i, c(); + o && d(); + } + function _(w) { + typeof w < "u" && (l = w), o = !0, d(); + } + function m() { + i && c(); + } + function g() { + i && _(); + } + function p() { + return i; + } + function v() { + u = requestAnimationFrame(() => { + const { + index: w + } = n.internalEngine(), y = w.clone().add(1).get(), S = n.scrollSnapList().length - 1; + t.stopOnLastSnap && y === S && c(), n.canScrollNext() ? n.scrollNext(l) : n.scrollTo(0, l); + }); + } + return { + name: "autoplay", + options: e, + init: a, + destroy: f, + play: _, + stop: m, + reset: g, + isPlaying: p + }; +} +Pi.globalOptions = void 0; +async function $_(e) { + return e ? `
${(await Promise.all( + e.map(async ([n, r]) => n === null || !n.url ? "" : await Af(n.url, "url")) + )).map((n) => ``).join("")}
` : ""; +} +const { + SvelteComponent: eh, + action_destroyer: th, + add_render_callback: nh, + append: be, + attr: ie, + binding_callbacks: Uo, + bubble: Fo, + check_outros: dt, + create_component: nt, + destroy_component: rt, + destroy_each: Gs, + detach: Ue, + element: Se, + empty: rh, + ensure_array_like: Zn, + globals: ih, + group_outros: _t, + init: oh, + insert: Fe, + listen: Xt, + mount_component: it, + run_all: qs, + safe_not_equal: lh, + set_data: js, + set_style: Go, + space: We, + src_url_equal: qo, + text: xs, + toggle_class: Jn, + transition_in: J, + transition_out: le +} = window.__gradio__svelte__internal, { window: zs } = ih, { createEventDispatcher: sh, getContext: ah } = window.__gradio__svelte__internal, { tick: uh } = window.__gradio__svelte__internal; +function jo(e, t, n) { + const r = e.slice(); + return r[42] = t[n], r[44] = n, r; +} +function xo(e, t, n) { + const r = e.slice(); + return r[45] = t[n], r[46] = t, r[44] = n, r; +} +function zo(e) { + let t, n; + return t = new Pl({ + props: { + show_label: ( + /*show_label*/ + e[2] + ), + Icon: Ml, + label: ( + /*label*/ + e[3] || "Gallery" + ) + } + }), { + c() { + nt(t.$$.fragment); + }, + m(r, i) { + it(t, r, i), n = !0; + }, + p(r, i) { + const o = {}; + i[0] & /*show_label*/ + 4 && (o.show_label = /*show_label*/ + r[2]), i[0] & /*label*/ + 8 && (o.label = /*label*/ + r[3] || "Gallery"), t.$set(o); + }, + i(r) { + n || (J(t.$$.fragment, r), n = !0); + }, + o(r) { + le(t.$$.fragment, r), n = !1; + }, + d(r) { + rt(t, r); + } + }; +} +function fh(e) { + let t, n, r, i, o, l, u, s = ( + /*selected_image*/ + e[13] && /*allow_preview*/ + e[4] && Vo(e) + ), a = Zn( + /*resolved_value*/ + e[9] + ), f = []; + for (let c = 0; c < a.length; c += 1) + f[c] = Ko(jo(e, a, c)); + const d = (c) => le(f[c], 1, 1, () => { + f[c] = null; + }); + return { + c() { + s && s.c(), t = We(), n = Se("div"), r = Se("div"), i = Se("div"); + for (let c = 0; c < f.length; c += 1) + f[c].c(); + ie(i, "class", "embla__container svelte-a675k2"), ie(r, "class", "embla__viewport svelte-a675k2"), ie(n, "class", "embla svelte-a675k2"); + }, + m(c, h) { + s && s.m(c, h), Fe(c, t, h), Fe(c, n, h), be(n, r), be(r, i); + for (let _ = 0; _ < f.length; _ += 1) + f[_] && f[_].m(i, null); + o = !0, l || (u = [ + th(Li.call(null, r, { + options: ( + /*options*/ + e[14] + ), + plugins: [Pi({ delay: 2e3 })] + })), + Xt( + r, + "emblaInit", + /*onInit*/ + e[15] + ) + ], l = !0); + }, + p(c, h) { + if (/*selected_image*/ + c[13] && /*allow_preview*/ + c[4] ? s ? (s.p(c, h), h[0] & /*selected_image, allow_preview*/ + 8208 && J(s, 1)) : (s = Vo(c), s.c(), J(s, 1), s.m(t.parentNode, t)) : s && (_t(), le(s, 1, 1, () => { + s = null; + }), dt()), h[0] & /*resolved_value, selected_index, i18n, show_share_button, value, interactive*/ + 931) { + a = Zn( + /*resolved_value*/ + c[9] + ); + let _; + for (_ = 0; _ < a.length; _ += 1) { + const m = jo(c, a, _); + f[_] ? (f[_].p(m, h), J(f[_], 1)) : (f[_] = Ko(m), f[_].c(), J(f[_], 1), f[_].m(i, null)); + } + for (_t(), _ = a.length; _ < f.length; _ += 1) + d(_); + dt(); + } + }, + i(c) { + if (!o) { + J(s); + for (let h = 0; h < a.length; h += 1) + J(f[h]); + o = !0; + } + }, + o(c) { + le(s), f = f.filter(Boolean); + for (let h = 0; h < f.length; h += 1) + le(f[h]); + o = !1; + }, + d(c) { + c && (Ue(t), Ue(n)), s && s.d(c), Gs(f, c), l = !1, qs(u); + } + }; +} +function ch(e) { + let t, n; + return t = new cu({ + props: { + unpadded_box: !0, + size: "large", + $$slots: { default: [dh] }, + $$scope: { ctx: e } + } + }), { + c() { + nt(t.$$.fragment); + }, + m(r, i) { + it(t, r, i), n = !0; + }, + p(r, i) { + const o = {}; + i[1] & /*$$scope*/ + 65536 && (o.$$scope = { dirty: i, ctx: r }), t.$set(o); + }, + i(r) { + n || (J(t.$$.fragment, r), n = !0); + }, + o(r) { + le(t.$$.fragment, r), n = !1; + }, + d(r) { + rt(t, r); + } + }; +} +function Vo(e) { + var b; + let t, n, r, i, o, l, u, s, a, f, d, c, h, _ = ( + /*show_download_button*/ + e[6] && Xo(e) + ); + i = new ki({ + props: { i18n: ( + /*i18n*/ + e[7] + ), absolute: !1 } + }), i.$on( + "clear", + /*clear_handler*/ + e[28] + ), u = new Ms({ + props: { + "data-testid": "detailed-image", + src: ( + /*selected_image*/ + e[13].image.url + ), + alt: ( + /*selected_image*/ + e[13].caption || "" + ), + title: ( + /*selected_image*/ + e[13].caption || null + ), + class: ( + /*selected_image*/ + e[13].caption && "with-caption" + ), + loading: "lazy" + } + }); + let m = ( + /*selected_image*/ + ((b = e[13]) == null ? void 0 : b.caption) && Wo(e) + ), g = Zn( + /*resolved_value*/ + e[9] + ), p = []; + for (let w = 0; w < g.length; w += 1) + p[w] = Zo(xo(e, g, w)); + const v = (w) => le(p[w], 1, 1, () => { + p[w] = null; + }); + return { + c() { + t = Se("button"), n = Se("div"), _ && _.c(), r = We(), nt(i.$$.fragment), o = We(), l = Se("button"), nt(u.$$.fragment), s = We(), m && m.c(), a = We(), f = Se("div"); + for (let w = 0; w < p.length; w += 1) + p[w].c(); + ie(n, "class", "icon-buttons svelte-a675k2"), ie(l, "class", "image-button svelte-a675k2"), Go(l, "height", "calc(100% - " + /*selected_image*/ + (e[13].caption ? "80px" : "60px") + ")"), ie(l, "aria-label", "detailed view of selected image"), ie(f, "class", "thumbnails scroll-hide svelte-a675k2"), ie(f, "data-testid", "container_el"), ie(t, "class", "preview svelte-a675k2"); + }, + m(w, y) { + Fe(w, t, y), be(t, n), _ && _.m(n, null), be(n, r), it(i, n, null), be(t, o), be(t, l), it(u, l, null), be(t, s), m && m.m(t, null), be(t, a), be(t, f); + for (let S = 0; S < p.length; S += 1) + p[S] && p[S].m(f, null); + e[32](f), d = !0, c || (h = [ + Xt( + l, + "click", + /*click_handler_1*/ + e[29] + ), + Xt( + t, + "keydown", + /*on_keydown*/ + e[17] + ) + ], c = !0); + }, + p(w, y) { + var P; + /*show_download_button*/ + w[6] ? _ ? (_.p(w, y), y[0] & /*show_download_button*/ + 64 && J(_, 1)) : (_ = Xo(w), _.c(), J(_, 1), _.m(n, r)) : _ && (_t(), le(_, 1, 1, () => { + _ = null; + }), dt()); + const S = {}; + y[0] & /*i18n*/ + 128 && (S.i18n = /*i18n*/ + w[7]), i.$set(S); + const C = {}; + if (y[0] & /*selected_image*/ + 8192 && (C.src = /*selected_image*/ + w[13].image.url), y[0] & /*selected_image*/ + 8192 && (C.alt = /*selected_image*/ + w[13].caption || ""), y[0] & /*selected_image*/ + 8192 && (C.title = /*selected_image*/ + w[13].caption || null), y[0] & /*selected_image*/ + 8192 && (C.class = /*selected_image*/ + w[13].caption && "with-caption"), u.$set(C), (!d || y[0] & /*selected_image*/ + 8192) && Go(l, "height", "calc(100% - " + /*selected_image*/ + (w[13].caption ? "80px" : "60px") + ")"), /*selected_image*/ + (P = w[13]) != null && P.caption ? m ? m.p(w, y) : (m = Wo(w), m.c(), m.m(t, a)) : m && (m.d(1), m = null), y[0] & /*resolved_value, el, selected_index*/ + 1538) { + g = Zn( + /*resolved_value*/ + w[9] + ); + let k; + for (k = 0; k < g.length; k += 1) { + const O = xo(w, g, k); + p[k] ? (p[k].p(O, y), J(p[k], 1)) : (p[k] = Zo(O), p[k].c(), J(p[k], 1), p[k].m(f, null)); + } + for (_t(), k = g.length; k < p.length; k += 1) + v(k); + dt(); + } + }, + i(w) { + if (!d) { + J(_), J(i.$$.fragment, w), J(u.$$.fragment, w); + for (let y = 0; y < g.length; y += 1) + J(p[y]); + d = !0; + } + }, + o(w) { + le(_), le(i.$$.fragment, w), le(u.$$.fragment, w), p = p.filter(Boolean); + for (let y = 0; y < p.length; y += 1) + le(p[y]); + d = !1; + }, + d(w) { + w && Ue(t), _ && _.d(), rt(i), rt(u), m && m.d(), Gs(p, w), e[32](null), c = !1, qs(h); + } + }; +} +function Xo(e) { + let t, n, r; + return n = new Jt({ + props: { + Icon: Nl, + label: ( + /*i18n*/ + e[7]("common.download") + ) + } + }), n.$on( + "click", + /*click_handler*/ + e[27] + ), { + c() { + t = Se("div"), nt(n.$$.fragment), ie(t, "class", "download-button-container svelte-a675k2"); + }, + m(i, o) { + Fe(i, t, o), it(n, t, null), r = !0; + }, + p(i, o) { + const l = {}; + o[0] & /*i18n*/ + 128 && (l.label = /*i18n*/ + i[7]("common.download")), n.$set(l); + }, + i(i) { + r || (J(n.$$.fragment, i), r = !0); + }, + o(i) { + le(n.$$.fragment, i), r = !1; + }, + d(i) { + i && Ue(t), rt(n); + } + }; +} +function Wo(e) { + let t, n = ( + /*selected_image*/ + e[13].caption + "" + ), r; + return { + c() { + t = Se("caption"), r = xs(n), ie(t, "class", "caption svelte-a675k2"); + }, + m(i, o) { + Fe(i, t, o), be(t, r); + }, + p(i, o) { + o[0] & /*selected_image*/ + 8192 && n !== (n = /*selected_image*/ + i[13].caption + "") && js(r, n); + }, + d(i) { + i && Ue(t); + } + }; +} +function Zo(e) { + let t, n, r, i, o = ( + /*i*/ + e[44] + ), l, u, s; + n = new Ms({ + props: { + src: ( + /*image*/ + e[45].image.url + ), + title: ( + /*image*/ + e[45].caption || null + ), + "data-testid": "thumbnail " + /*i*/ + (e[44] + 1), + alt: "", + loading: "lazy" + } + }); + const a = () => ( + /*button_binding*/ + e[30](t, o) + ), f = () => ( + /*button_binding*/ + e[30](null, o) + ); + function d() { + return ( + /*click_handler_2*/ + e[31]( + /*i*/ + e[44] + ) + ); + } + return { + c() { + t = Se("button"), nt(n.$$.fragment), r = We(), ie(t, "class", "thumbnail-item thumbnail-small svelte-a675k2"), ie(t, "aria-label", i = "Thumbnail " + /*i*/ + (e[44] + 1) + " of " + /*resolved_value*/ + e[9].length), Jn( + t, + "selected", + /*selected_index*/ + e[1] === /*i*/ + e[44] + ); + }, + m(c, h) { + Fe(c, t, h), it(n, t, null), be(t, r), a(), l = !0, u || (s = Xt(t, "click", d), u = !0); + }, + p(c, h) { + e = c; + const _ = {}; + h[0] & /*resolved_value*/ + 512 && (_.src = /*image*/ + e[45].image.url), h[0] & /*resolved_value*/ + 512 && (_.title = /*image*/ + e[45].caption || null), n.$set(_), (!l || h[0] & /*resolved_value*/ + 512 && i !== (i = "Thumbnail " + /*i*/ + (e[44] + 1) + " of " + /*resolved_value*/ + e[9].length)) && ie(t, "aria-label", i), o !== /*i*/ + e[44] && (f(), o = /*i*/ + e[44], a()), (!l || h[0] & /*selected_index*/ + 2) && Jn( + t, + "selected", + /*selected_index*/ + e[1] === /*i*/ + e[44] + ); + }, + i(c) { + l || (J(n.$$.fragment, c), l = !0); + }, + o(c) { + le(n.$$.fragment, c), l = !1; + }, + d(c) { + c && Ue(t), rt(n), f(), u = !1, s(); + } + }; +} +function Jo(e) { + let t, n, r; + return n = new ki({ + props: { i18n: ( + /*i18n*/ + e[7] + ), absolute: !1 } + }), n.$on( + "clear", + /*clear_handler_1*/ + e[33] + ), { + c() { + t = Se("div"), nt(n.$$.fragment), ie(t, "class", "icon-button svelte-a675k2"); + }, + m(i, o) { + Fe(i, t, o), it(n, t, null), r = !0; + }, + p(i, o) { + const l = {}; + o[0] & /*i18n*/ + 128 && (l.i18n = /*i18n*/ + i[7]), n.$set(l); + }, + i(i) { + r || (J(n.$$.fragment, i), r = !0); + }, + o(i) { + le(n.$$.fragment, i), r = !1; + }, + d(i) { + i && Ue(t), rt(n); + } + }; +} +function Qo(e) { + let t, n, r; + return n = new Ff({ + props: { + i18n: ( + /*i18n*/ + e[7] + ), + value: ( + /*resolved_value*/ + e[9] + ), + formatter: $_ + } + }), n.$on( + "share", + /*share_handler*/ + e[34] + ), n.$on( + "error", + /*error_handler*/ + e[35] + ), { + c() { + t = Se("div"), nt(n.$$.fragment), ie(t, "class", "icon-button svelte-a675k2"); + }, + m(i, o) { + Fe(i, t, o), it(n, t, null), r = !0; + }, + p(i, o) { + const l = {}; + o[0] & /*i18n*/ + 128 && (l.i18n = /*i18n*/ + i[7]), o[0] & /*resolved_value*/ + 512 && (l.value = /*resolved_value*/ + i[9]), n.$set(l); + }, + i(i) { + r || (J(n.$$.fragment, i), r = !0); + }, + o(i) { + le(n.$$.fragment, i), r = !1; + }, + d(i) { + i && Ue(t), rt(n); + } + }; +} +function Yo(e) { + let t, n = ( + /*entry*/ + e[42].caption + "" + ), r; + return { + c() { + t = Se("div"), r = xs(n), ie(t, "class", "caption-label svelte-a675k2"); + }, + m(i, o) { + Fe(i, t, o), be(t, r); + }, + p(i, o) { + o[0] & /*resolved_value*/ + 512 && n !== (n = /*entry*/ + i[42].caption + "") && js(r, n); + }, + d(i) { + i && Ue(t); + } + }; +} +function Ko(e) { + let t, n, r, i, o, l, u, s, a, f, d, c, h, _ = ( + /*interactive*/ + e[8] && Jo(e) + ), m = ( + /*show_share_button*/ + e[5] && Qo(e) + ), g = ( + /*entry*/ + e[42].caption && Yo(e) + ); + function p() { + return ( + /*click_handler_3*/ + e[36]( + /*i*/ + e[44] + ) + ); + } + return { + c() { + t = Se("div"), _ && _.c(), n = We(), m && m.c(), r = We(), i = Se("button"), o = Se("img"), s = We(), g && g.c(), f = We(), ie(o, "class", "embla__slide__img svelte-a675k2"), qo(o.src, l = /*entry*/ + e[42].image.url) || ie(o, "src", l), ie(o, "alt", u = /*entry*/ + e[42].caption || null), ie(o, "loading", "lazy"), ie(i, "class", "embla__slide__img svelte-a675k2"), ie(i, "aria-label", a = "Thumbnail " + /*i*/ + (e[44] + 1) + " of " + /*resolved_value*/ + e[9].length), Jn( + i, + "selected", + /*selected_index*/ + e[1] === /*i*/ + e[44] + ), ie(t, "class", "embla__slide svelte-a675k2"); + }, + m(v, b) { + Fe(v, t, b), _ && _.m(t, null), be(t, n), m && m.m(t, null), be(t, r), be(t, i), be(i, o), be(i, s), g && g.m(i, null), be(t, f), d = !0, c || (h = Xt(i, "click", p), c = !0); + }, + p(v, b) { + e = v, /*interactive*/ + e[8] ? _ ? (_.p(e, b), b[0] & /*interactive*/ + 256 && J(_, 1)) : (_ = Jo(e), _.c(), J(_, 1), _.m(t, n)) : _ && (_t(), le(_, 1, 1, () => { + _ = null; + }), dt()), /*show_share_button*/ + e[5] ? m ? (m.p(e, b), b[0] & /*show_share_button*/ + 32 && J(m, 1)) : (m = Qo(e), m.c(), J(m, 1), m.m(t, r)) : m && (_t(), le(m, 1, 1, () => { + m = null; + }), dt()), (!d || b[0] & /*resolved_value*/ + 512 && !qo(o.src, l = /*entry*/ + e[42].image.url)) && ie(o, "src", l), (!d || b[0] & /*resolved_value*/ + 512 && u !== (u = /*entry*/ + e[42].caption || null)) && ie(o, "alt", u), /*entry*/ + e[42].caption ? g ? g.p(e, b) : (g = Yo(e), g.c(), g.m(i, null)) : g && (g.d(1), g = null), (!d || b[0] & /*resolved_value*/ + 512 && a !== (a = "Thumbnail " + /*i*/ + (e[44] + 1) + " of " + /*resolved_value*/ + e[9].length)) && ie(i, "aria-label", a), (!d || b[0] & /*selected_index*/ + 2) && Jn( + i, + "selected", + /*selected_index*/ + e[1] === /*i*/ + e[44] + ); + }, + i(v) { + d || (J(_), J(m), d = !0); + }, + o(v) { + le(_), le(m), d = !1; + }, + d(v) { + v && Ue(t), _ && _.d(), m && m.d(), g && g.d(), c = !1, h(); + } + }; +} +function dh(e) { + let t, n; + return t = new Ml({}), { + c() { + nt(t.$$.fragment); + }, + m(r, i) { + it(t, r, i), n = !0; + }, + i(r) { + n || (J(t.$$.fragment, r), n = !0); + }, + o(r) { + le(t.$$.fragment, r), n = !1; + }, + d(r) { + rt(t, r); + } + }; +} +function _h(e) { + let t, n, r, i, o, l, u; + nh( + /*onwindowresize*/ + e[26] + ); + let s = ( + /*show_label*/ + e[2] && zo(e) + ); + const a = [ch, fh], f = []; + function d(c, h) { + return ( + /*value*/ + c[0] == null || /*resolved_value*/ + c[9] == null || /*resolved_value*/ + c[9].length === 0 ? 0 : 1 + ); + } + return n = d(e), r = f[n] = a[n](e), { + c() { + s && s.c(), t = We(), r.c(), i = rh(); + }, + m(c, h) { + s && s.m(c, h), Fe(c, t, h), f[n].m(c, h), Fe(c, i, h), o = !0, l || (u = Xt( + zs, + "resize", + /*onwindowresize*/ + e[26] + ), l = !0); + }, + p(c, h) { + /*show_label*/ + c[2] ? s ? (s.p(c, h), h[0] & /*show_label*/ + 4 && J(s, 1)) : (s = zo(c), s.c(), J(s, 1), s.m(t.parentNode, t)) : s && (_t(), le(s, 1, 1, () => { + s = null; + }), dt()); + let _ = n; + n = d(c), n === _ ? f[n].p(c, h) : (_t(), le(f[_], 1, 1, () => { + f[_] = null; + }), dt(), r = f[n], r ? r.p(c, h) : (r = f[n] = a[n](c), r.c()), J(r, 1), r.m(i.parentNode, i)); + }, + i(c) { + o || (J(s), J(r), o = !0); + }, + o(c) { + le(s), le(r), o = !1; + }, + d(c) { + c && (Ue(t), Ue(i)), s && s.d(c), f[n].d(c), l = !1, u(); + } + }; +} +function nn(e, t) { + return e ?? t(); +} +function bt(e) { + let t, n = e[0], r = 1; + for (; r < e.length; ) { + const i = e[r], o = e[r + 1]; + if (r += 2, (i === "optionalAccess" || i === "optionalCall") && n == null) + return; + i === "access" || i === "optionalAccess" ? (t = n, n = o(n)) : (i === "call" || i === "optionalCall") && (n = o((...l) => n.call(t, ...l)), t = void 0); + } + return n; +} +function hh(e, t, n) { + let r, i, o, { show_label: l = !0 } = t, { label: u } = t, { root: s = "" } = t, { proxy_url: a = null } = t, { value: f = null } = t, { preview: d } = t, { allow_preview: c = !0 } = t, { show_share_button: h = !1 } = t, { show_download_button: _ = !1 } = t, { i18n: m } = t, { selected_index: g = null } = t, { interactive: p } = t; + const v = sh(); + let b, w = { loop: !0 }; + const y = (T) => { + n(22, b = T.detail), console.log(b.slideNodes()); + }; + let S = !0, C = null, P = f; + g == null && d && bt([f, "optionalAccess", (T) => T.length]) && (g = 0); + let k = g; + function O(T) { + const H = T.target, D = T.clientX, N = H.offsetWidth / 2; + D < N ? n(1, g = r) : n(1, g = i); + } + function U(T) { + switch (T.code) { + case "Escape": + T.preventDefault(), n(1, g = null); + break; + case "ArrowLeft": + T.preventDefault(), n(1, g = r); + break; + case "ArrowRight": + T.preventDefault(), n(1, g = i); + break; + } + } + let x = [], j; + async function te(T) { + if (typeof T != "number" || (await uh(), x[T] === void 0)) + return; + bt([ + x, + "access", + (R) => R[T], + "optionalAccess", + (R) => R.focus, + "call", + (R) => R() + ]); + const { left: H, width: D } = j.getBoundingClientRect(), { left: I, width: N } = x[T].getBoundingClientRect(), Y = I - H + N / 2 - D / 2 + j.scrollLeft; + j && typeof j.scrollTo == "function" && j.scrollTo({ + left: Y < 0 ? 0 : Y, + behavior: "smooth" + }); + } + let ne = 0; + const ce = ah("fetch_implementation"); + async function me(T, H) { + let D; + try { + D = await ce(T); + } catch (Y) { + if (Y instanceof TypeError) { + window.open(T, "_blank", "noreferrer"); + return; + } + throw Y; + } + const I = await D.blob(), N = URL.createObjectURL(I), Q = document.createElement("a"); + Q.href = N, Q.download = H, Q.click(), URL.revokeObjectURL(N); + } + function _e() { + n(12, ne = zs.innerHeight); + } + const B = () => { + const T = o == null ? void 0 : o.image; + if (T == null) + return; + const { url: H, orig_name: D } = T; + H && me(H, D ?? "image"); + }, pe = () => n(1, g = null), E = (T) => O(T); + function M(T, H) { + Uo[T ? "unshift" : "push"](() => { + x[H] = T, n(10, x); + }); + } + const A = (T) => n(1, g = T); + function F(T) { + Uo[T ? "unshift" : "push"](() => { + j = T, n(11, j); + }); + } + const L = () => n(0, f = null); + function re(T) { + Fo.call(this, e, T); + } + function z(T) { + Fo.call(this, e, T); + } + const ee = (T) => n(1, g = T); + return e.$$set = (T) => { + "show_label" in T && n(2, l = T.show_label), "label" in T && n(3, u = T.label), "root" in T && n(19, s = T.root), "proxy_url" in T && n(20, a = T.proxy_url), "value" in T && n(0, f = T.value), "preview" in T && n(21, d = T.preview), "allow_preview" in T && n(4, c = T.allow_preview), "show_share_button" in T && n(5, h = T.show_share_button), "show_download_button" in T && n(6, _ = T.show_download_button), "i18n" in T && n(7, m = T.i18n), "selected_index" in T && n(1, g = T.selected_index), "interactive" in T && n(8, p = T.interactive); + }, e.$$.update = () => { + if (e.$$.dirty[0] & /*emblaApi*/ + 4194304 && b != null) { + const { applyTweenOpacity: T } = Y_(b); + b.on("init", T).on("scroll", T).on("reInit", T); + } + e.$$.dirty[0] & /*value, was_reset*/ + 8388609 && n(23, S = f == null || f.length === 0 ? !0 : S), e.$$.dirty[0] & /*value, root, proxy_url*/ + 1572865 && n(9, C = f == null ? null : f.map((T) => ({ + image: Et(T.image, s, a), + caption: T.caption + }))), e.$$.dirty[0] & /*prev_value, value, was_reset, preview, selected_index*/ + 27262979 && (ln(P, f) || (S ? (n(1, g = d && bt([f, "optionalAccess", (T) => T.length]) ? 0 : null), n(23, S = !1)) : n( + 1, + g = g != null && f != null && g < f.length ? g : null + ), v("change"), n(24, P = f))), e.$$.dirty[0] & /*selected_index, resolved_value*/ + 514 && (r = (nn(g, () => 0) + nn(bt([C, "optionalAccess", (T) => T.length]), () => 0) - 1) % nn(bt([C, "optionalAccess", (T) => T.length]), () => 0)), e.$$.dirty[0] & /*selected_index, resolved_value*/ + 514 && (i = (nn(g, () => 0) + 1) % nn(bt([C, "optionalAccess", (T) => T.length]), () => 0)), e.$$.dirty[0] & /*selected_index, old_selected_index, resolved_value*/ + 33554946 && g !== k && (n(25, k = g), g !== null && v("select", { + index: g, + value: bt([C, "optionalAccess", (T) => T[g]]) + })), e.$$.dirty[0] & /*allow_preview, selected_index*/ + 18 && c && te(g), e.$$.dirty[0] & /*selected_index, resolved_value*/ + 514 && n(13, o = g != null && C != null ? C[g] : null); + }, [ + f, + g, + l, + u, + c, + h, + _, + m, + p, + C, + x, + j, + ne, + o, + w, + y, + O, + U, + me, + s, + a, + d, + b, + S, + P, + k, + _e, + B, + pe, + E, + M, + A, + F, + L, + re, + z, + ee + ]; +} +class mh extends eh { + constructor(t) { + super(), oh( + this, + t, + hh, + _h, + lh, + { + show_label: 2, + label: 3, + root: 19, + proxy_url: 20, + value: 0, + preview: 21, + allow_preview: 4, + show_share_button: 5, + show_download_button: 6, + i18n: 7, + selected_index: 1, + interactive: 8 + }, + null, + [-1, -1] + ); + } +} +function Ut(e) { + let t = ["", "k", "M", "G", "T", "P", "E", "Z"], n = 0; + for (; e > 1e3 && n < t.length - 1; ) + e /= 1e3, n++; + let r = t[n]; + return (Number.isInteger(e) ? e : e.toFixed(1)) + r; +} +const { + SvelteComponent: ph, + append: xe, + attr: W, + component_subscribe: $o, + detach: gh, + element: bh, + init: wh, + insert: vh, + noop: el, + safe_not_equal: yh, + set_style: On, + svg_element: ze, + toggle_class: tl +} = window.__gradio__svelte__internal, { onMount: Eh } = window.__gradio__svelte__internal; +function Sh(e) { + let t, n, r, i, o, l, u, s, a, f, d, c; + return { + c() { + t = bh("div"), n = ze("svg"), r = ze("g"), i = ze("path"), o = ze("path"), l = ze("path"), u = ze("path"), s = ze("g"), a = ze("path"), f = ze("path"), d = ze("path"), c = ze("path"), W(i, "d", "M255.926 0.754768L509.702 139.936V221.027L255.926 81.8465V0.754768Z"), W(i, "fill", "#FF7C00"), W(i, "fill-opacity", "0.4"), W(i, "class", "svelte-43sxxs"), W(o, "d", "M509.69 139.936L254.981 279.641V361.255L509.69 221.55V139.936Z"), W(o, "fill", "#FF7C00"), W(o, "class", "svelte-43sxxs"), W(l, "d", "M0.250138 139.937L254.981 279.641V361.255L0.250138 221.55V139.937Z"), W(l, "fill", "#FF7C00"), W(l, "fill-opacity", "0.4"), W(l, "class", "svelte-43sxxs"), W(u, "d", "M255.923 0.232622L0.236328 139.936V221.55L255.923 81.8469V0.232622Z"), W(u, "fill", "#FF7C00"), W(u, "class", "svelte-43sxxs"), On(r, "transform", "translate(" + /*$top*/ + e[1][0] + "px, " + /*$top*/ + e[1][1] + "px)"), W(a, "d", "M255.926 141.5L509.702 280.681V361.773L255.926 222.592V141.5Z"), W(a, "fill", "#FF7C00"), W(a, "fill-opacity", "0.4"), W(a, "class", "svelte-43sxxs"), W(f, "d", "M509.69 280.679L254.981 420.384V501.998L509.69 362.293V280.679Z"), W(f, "fill", "#FF7C00"), W(f, "class", "svelte-43sxxs"), W(d, "d", "M0.250138 280.681L254.981 420.386V502L0.250138 362.295V280.681Z"), W(d, "fill", "#FF7C00"), W(d, "fill-opacity", "0.4"), W(d, "class", "svelte-43sxxs"), W(c, "d", "M255.923 140.977L0.236328 280.68V362.294L255.923 222.591V140.977Z"), W(c, "fill", "#FF7C00"), W(c, "class", "svelte-43sxxs"), On(s, "transform", "translate(" + /*$bottom*/ + e[2][0] + "px, " + /*$bottom*/ + e[2][1] + "px)"), W(n, "viewBox", "-1200 -1200 3000 3000"), W(n, "fill", "none"), W(n, "xmlns", "http://www.w3.org/2000/svg"), W(n, "class", "svelte-43sxxs"), W(t, "class", "svelte-43sxxs"), tl( + t, + "margin", + /*margin*/ + e[0] + ); + }, + m(h, _) { + vh(h, t, _), xe(t, n), xe(n, r), xe(r, i), xe(r, o), xe(r, l), xe(r, u), xe(n, s), xe(s, a), xe(s, f), xe(s, d), xe(s, c); + }, + p(h, [_]) { + _ & /*$top*/ + 2 && On(r, "transform", "translate(" + /*$top*/ + h[1][0] + "px, " + /*$top*/ + h[1][1] + "px)"), _ & /*$bottom*/ + 4 && On(s, "transform", "translate(" + /*$bottom*/ + h[2][0] + "px, " + /*$bottom*/ + h[2][1] + "px)"), _ & /*margin*/ + 1 && tl( + t, + "margin", + /*margin*/ + h[0] + ); + }, + i: el, + o: el, + d(h) { + h && gh(t); + } + }; +} +function kh(e, t, n) { + let r, i, { margin: o = !0 } = t; + const l = no([0, 0]); + $o(e, l, (c) => n(1, r = c)); + const u = no([0, 0]); + $o(e, u, (c) => n(2, i = c)); + let s; + async function a() { + await Promise.all([l.set([125, 140]), u.set([-125, -140])]), await Promise.all([l.set([-125, 140]), u.set([125, -140])]), await Promise.all([l.set([-125, 0]), u.set([125, -0])]), await Promise.all([l.set([125, 0]), u.set([-125, 0])]); + } + async function f() { + await a(), s || f(); + } + async function d() { + await Promise.all([l.set([125, 0]), u.set([-125, 0])]), f(); + } + return Eh(() => (d(), () => s = !0)), e.$$set = (c) => { + "margin" in c && n(0, o = c.margin); + }, [o, r, i, l, u]; +} +class Th extends ph { + constructor(t) { + super(), wh(this, t, kh, Sh, yh, { margin: 0 }); + } +} +const { + SvelteComponent: Ah, + append: St, + attr: Ye, + binding_callbacks: nl, + check_outros: Vs, + create_component: Bh, + create_slot: Ch, + destroy_component: Ih, + destroy_each: Xs, + detach: G, + element: tt, + empty: Kt, + ensure_array_like: Qn, + get_all_dirty_from_scope: Lh, + get_slot_changes: Ph, + group_outros: Ws, + init: Oh, + insert: q, + mount_component: Hh, + noop: di, + safe_not_equal: Nh, + set_data: Ge, + set_style: ft, + space: Ke, + text: fe, + toggle_class: Re, + transition_in: Wt, + transition_out: Zt, + update_slot_base: Mh +} = window.__gradio__svelte__internal, { tick: Dh } = window.__gradio__svelte__internal, { onDestroy: Rh } = window.__gradio__svelte__internal, Uh = (e) => ({}), rl = (e) => ({}); +function il(e, t, n) { + const r = e.slice(); + return r[38] = t[n], r[40] = n, r; +} +function ol(e, t, n) { + const r = e.slice(); + return r[38] = t[n], r; +} +function Fh(e) { + let t, n = ( + /*i18n*/ + e[1]("common.error") + "" + ), r, i, o; + const l = ( + /*#slots*/ + e[29].error + ), u = Ch( + l, + e, + /*$$scope*/ + e[28], + rl + ); + return { + c() { + t = tt("span"), r = fe(n), i = Ke(), u && u.c(), Ye(t, "class", "error svelte-1txqlrd"); + }, + m(s, a) { + q(s, t, a), St(t, r), q(s, i, a), u && u.m(s, a), o = !0; + }, + p(s, a) { + (!o || a[0] & /*i18n*/ + 2) && n !== (n = /*i18n*/ + s[1]("common.error") + "") && Ge(r, n), u && u.p && (!o || a[0] & /*$$scope*/ + 268435456) && Mh( + u, + l, + s, + /*$$scope*/ + s[28], + o ? Ph( + l, + /*$$scope*/ + s[28], + a, + Uh + ) : Lh( + /*$$scope*/ + s[28] + ), + rl + ); + }, + i(s) { + o || (Wt(u, s), o = !0); + }, + o(s) { + Zt(u, s), o = !1; + }, + d(s) { + s && (G(t), G(i)), u && u.d(s); + } + }; +} +function Gh(e) { + let t, n, r, i, o, l, u, s, a, f = ( + /*variant*/ + e[8] === "default" && /*show_eta_bar*/ + e[18] && /*show_progress*/ + e[6] === "full" && ll(e) + ); + function d(b, w) { + if ( + /*progress*/ + b[7] + ) + return xh; + if ( + /*queue_position*/ + b[2] !== null && /*queue_size*/ + b[3] !== void 0 && /*queue_position*/ + b[2] >= 0 + ) + return jh; + if ( + /*queue_position*/ + b[2] === 0 + ) + return qh; + } + let c = d(e), h = c && c(e), _ = ( + /*timer*/ + e[5] && ul(e) + ); + const m = [Wh, Xh], g = []; + function p(b, w) { + return ( + /*last_progress_level*/ + b[15] != null ? 0 : ( + /*show_progress*/ + b[6] === "full" ? 1 : -1 + ) + ); + } + ~(o = p(e)) && (l = g[o] = m[o](e)); + let v = !/*timer*/ + e[5] && pl(e); + return { + c() { + f && f.c(), t = Ke(), n = tt("div"), h && h.c(), r = Ke(), _ && _.c(), i = Ke(), l && l.c(), u = Ke(), v && v.c(), s = Kt(), Ye(n, "class", "progress-text svelte-1txqlrd"), Re( + n, + "meta-text-center", + /*variant*/ + e[8] === "center" + ), Re( + n, + "meta-text", + /*variant*/ + e[8] === "default" + ); + }, + m(b, w) { + f && f.m(b, w), q(b, t, w), q(b, n, w), h && h.m(n, null), St(n, r), _ && _.m(n, null), q(b, i, w), ~o && g[o].m(b, w), q(b, u, w), v && v.m(b, w), q(b, s, w), a = !0; + }, + p(b, w) { + /*variant*/ + b[8] === "default" && /*show_eta_bar*/ + b[18] && /*show_progress*/ + b[6] === "full" ? f ? f.p(b, w) : (f = ll(b), f.c(), f.m(t.parentNode, t)) : f && (f.d(1), f = null), c === (c = d(b)) && h ? h.p(b, w) : (h && h.d(1), h = c && c(b), h && (h.c(), h.m(n, r))), /*timer*/ + b[5] ? _ ? _.p(b, w) : (_ = ul(b), _.c(), _.m(n, null)) : _ && (_.d(1), _ = null), (!a || w[0] & /*variant*/ + 256) && Re( + n, + "meta-text-center", + /*variant*/ + b[8] === "center" + ), (!a || w[0] & /*variant*/ + 256) && Re( + n, + "meta-text", + /*variant*/ + b[8] === "default" + ); + let y = o; + o = p(b), o === y ? ~o && g[o].p(b, w) : (l && (Ws(), Zt(g[y], 1, 1, () => { + g[y] = null; + }), Vs()), ~o ? (l = g[o], l ? l.p(b, w) : (l = g[o] = m[o](b), l.c()), Wt(l, 1), l.m(u.parentNode, u)) : l = null), /*timer*/ + b[5] ? v && (v.d(1), v = null) : v ? v.p(b, w) : (v = pl(b), v.c(), v.m(s.parentNode, s)); + }, + i(b) { + a || (Wt(l), a = !0); + }, + o(b) { + Zt(l), a = !1; + }, + d(b) { + b && (G(t), G(n), G(i), G(u), G(s)), f && f.d(b), h && h.d(), _ && _.d(), ~o && g[o].d(b), v && v.d(b); + } + }; +} +function ll(e) { + let t, n = `translateX(${/*eta_level*/ + (e[17] || 0) * 100 - 100}%)`; + return { + c() { + t = tt("div"), Ye(t, "class", "eta-bar svelte-1txqlrd"), ft(t, "transform", n); + }, + m(r, i) { + q(r, t, i); + }, + p(r, i) { + i[0] & /*eta_level*/ + 131072 && n !== (n = `translateX(${/*eta_level*/ + (r[17] || 0) * 100 - 100}%)`) && ft(t, "transform", n); + }, + d(r) { + r && G(t); + } + }; +} +function qh(e) { + let t; + return { + c() { + t = fe("processing |"); + }, + m(n, r) { + q(n, t, r); + }, + p: di, + d(n) { + n && G(t); + } + }; +} +function jh(e) { + let t, n = ( + /*queue_position*/ + e[2] + 1 + "" + ), r, i, o, l; + return { + c() { + t = fe("queue: "), r = fe(n), i = fe("/"), o = fe( + /*queue_size*/ + e[3] + ), l = fe(" |"); + }, + m(u, s) { + q(u, t, s), q(u, r, s), q(u, i, s), q(u, o, s), q(u, l, s); + }, + p(u, s) { + s[0] & /*queue_position*/ + 4 && n !== (n = /*queue_position*/ + u[2] + 1 + "") && Ge(r, n), s[0] & /*queue_size*/ + 8 && Ge( + o, + /*queue_size*/ + u[3] + ); + }, + d(u) { + u && (G(t), G(r), G(i), G(o), G(l)); + } + }; +} +function xh(e) { + let t, n = Qn( + /*progress*/ + e[7] + ), r = []; + for (let i = 0; i < n.length; i += 1) + r[i] = al(ol(e, n, i)); + return { + c() { + for (let i = 0; i < r.length; i += 1) + r[i].c(); + t = Kt(); + }, + m(i, o) { + for (let l = 0; l < r.length; l += 1) + r[l] && r[l].m(i, o); + q(i, t, o); + }, + p(i, o) { + if (o[0] & /*progress*/ + 128) { + n = Qn( + /*progress*/ + i[7] + ); + let l; + for (l = 0; l < n.length; l += 1) { + const u = ol(i, n, l); + r[l] ? r[l].p(u, o) : (r[l] = al(u), r[l].c(), r[l].m(t.parentNode, t)); + } + for (; l < r.length; l += 1) + r[l].d(1); + r.length = n.length; + } + }, + d(i) { + i && G(t), Xs(r, i); + } + }; +} +function sl(e) { + let t, n = ( + /*p*/ + e[38].unit + "" + ), r, i, o = " ", l; + function u(f, d) { + return ( + /*p*/ + f[38].length != null ? Vh : zh + ); + } + let s = u(e), a = s(e); + return { + c() { + a.c(), t = Ke(), r = fe(n), i = fe(" | "), l = fe(o); + }, + m(f, d) { + a.m(f, d), q(f, t, d), q(f, r, d), q(f, i, d), q(f, l, d); + }, + p(f, d) { + s === (s = u(f)) && a ? a.p(f, d) : (a.d(1), a = s(f), a && (a.c(), a.m(t.parentNode, t))), d[0] & /*progress*/ + 128 && n !== (n = /*p*/ + f[38].unit + "") && Ge(r, n); + }, + d(f) { + f && (G(t), G(r), G(i), G(l)), a.d(f); + } + }; +} +function zh(e) { + let t = Ut( + /*p*/ + e[38].index || 0 + ) + "", n; + return { + c() { + n = fe(t); + }, + m(r, i) { + q(r, n, i); + }, + p(r, i) { + i[0] & /*progress*/ + 128 && t !== (t = Ut( + /*p*/ + r[38].index || 0 + ) + "") && Ge(n, t); + }, + d(r) { + r && G(n); + } + }; +} +function Vh(e) { + let t = Ut( + /*p*/ + e[38].index || 0 + ) + "", n, r, i = Ut( + /*p*/ + e[38].length + ) + "", o; + return { + c() { + n = fe(t), r = fe("/"), o = fe(i); + }, + m(l, u) { + q(l, n, u), q(l, r, u), q(l, o, u); + }, + p(l, u) { + u[0] & /*progress*/ + 128 && t !== (t = Ut( + /*p*/ + l[38].index || 0 + ) + "") && Ge(n, t), u[0] & /*progress*/ + 128 && i !== (i = Ut( + /*p*/ + l[38].length + ) + "") && Ge(o, i); + }, + d(l) { + l && (G(n), G(r), G(o)); + } + }; +} +function al(e) { + let t, n = ( + /*p*/ + e[38].index != null && sl(e) + ); + return { + c() { + n && n.c(), t = Kt(); + }, + m(r, i) { + n && n.m(r, i), q(r, t, i); + }, + p(r, i) { + /*p*/ + r[38].index != null ? n ? n.p(r, i) : (n = sl(r), n.c(), n.m(t.parentNode, t)) : n && (n.d(1), n = null); + }, + d(r) { + r && G(t), n && n.d(r); + } + }; +} +function ul(e) { + let t, n = ( + /*eta*/ + e[0] ? `/${/*formatted_eta*/ + e[19]}` : "" + ), r, i; + return { + c() { + t = fe( + /*formatted_timer*/ + e[20] + ), r = fe(n), i = fe("s"); + }, + m(o, l) { + q(o, t, l), q(o, r, l), q(o, i, l); + }, + p(o, l) { + l[0] & /*formatted_timer*/ + 1048576 && Ge( + t, + /*formatted_timer*/ + o[20] + ), l[0] & /*eta, formatted_eta*/ + 524289 && n !== (n = /*eta*/ + o[0] ? `/${/*formatted_eta*/ + o[19]}` : "") && Ge(r, n); + }, + d(o) { + o && (G(t), G(r), G(i)); + } + }; +} +function Xh(e) { + let t, n; + return t = new Th({ + props: { margin: ( + /*variant*/ + e[8] === "default" + ) } + }), { + c() { + Bh(t.$$.fragment); + }, + m(r, i) { + Hh(t, r, i), n = !0; + }, + p(r, i) { + const o = {}; + i[0] & /*variant*/ + 256 && (o.margin = /*variant*/ + r[8] === "default"), t.$set(o); + }, + i(r) { + n || (Wt(t.$$.fragment, r), n = !0); + }, + o(r) { + Zt(t.$$.fragment, r), n = !1; + }, + d(r) { + Ih(t, r); + } + }; +} +function Wh(e) { + let t, n, r, i, o, l = `${/*last_progress_level*/ + e[15] * 100}%`, u = ( + /*progress*/ + e[7] != null && fl(e) + ); + return { + c() { + t = tt("div"), n = tt("div"), u && u.c(), r = Ke(), i = tt("div"), o = tt("div"), Ye(n, "class", "progress-level-inner svelte-1txqlrd"), Ye(o, "class", "progress-bar svelte-1txqlrd"), ft(o, "width", l), Ye(i, "class", "progress-bar-wrap svelte-1txqlrd"), Ye(t, "class", "progress-level svelte-1txqlrd"); + }, + m(s, a) { + q(s, t, a), St(t, n), u && u.m(n, null), St(t, r), St(t, i), St(i, o), e[30](o); + }, + p(s, a) { + /*progress*/ + s[7] != null ? u ? u.p(s, a) : (u = fl(s), u.c(), u.m(n, null)) : u && (u.d(1), u = null), a[0] & /*last_progress_level*/ + 32768 && l !== (l = `${/*last_progress_level*/ + s[15] * 100}%`) && ft(o, "width", l); + }, + i: di, + o: di, + d(s) { + s && G(t), u && u.d(), e[30](null); + } + }; +} +function fl(e) { + let t, n = Qn( + /*progress*/ + e[7] + ), r = []; + for (let i = 0; i < n.length; i += 1) + r[i] = ml(il(e, n, i)); + return { + c() { + for (let i = 0; i < r.length; i += 1) + r[i].c(); + t = Kt(); + }, + m(i, o) { + for (let l = 0; l < r.length; l += 1) + r[l] && r[l].m(i, o); + q(i, t, o); + }, + p(i, o) { + if (o[0] & /*progress_level, progress*/ + 16512) { + n = Qn( + /*progress*/ + i[7] + ); + let l; + for (l = 0; l < n.length; l += 1) { + const u = il(i, n, l); + r[l] ? r[l].p(u, o) : (r[l] = ml(u), r[l].c(), r[l].m(t.parentNode, t)); + } + for (; l < r.length; l += 1) + r[l].d(1); + r.length = n.length; + } + }, + d(i) { + i && G(t), Xs(r, i); + } + }; +} +function cl(e) { + let t, n, r, i, o = ( + /*i*/ + e[40] !== 0 && Zh() + ), l = ( + /*p*/ + e[38].desc != null && dl(e) + ), u = ( + /*p*/ + e[38].desc != null && /*progress_level*/ + e[14] && /*progress_level*/ + e[14][ + /*i*/ + e[40] + ] != null && _l() + ), s = ( + /*progress_level*/ + e[14] != null && hl(e) + ); + return { + c() { + o && o.c(), t = Ke(), l && l.c(), n = Ke(), u && u.c(), r = Ke(), s && s.c(), i = Kt(); + }, + m(a, f) { + o && o.m(a, f), q(a, t, f), l && l.m(a, f), q(a, n, f), u && u.m(a, f), q(a, r, f), s && s.m(a, f), q(a, i, f); + }, + p(a, f) { + /*p*/ + a[38].desc != null ? l ? l.p(a, f) : (l = dl(a), l.c(), l.m(n.parentNode, n)) : l && (l.d(1), l = null), /*p*/ + a[38].desc != null && /*progress_level*/ + a[14] && /*progress_level*/ + a[14][ + /*i*/ + a[40] + ] != null ? u || (u = _l(), u.c(), u.m(r.parentNode, r)) : u && (u.d(1), u = null), /*progress_level*/ + a[14] != null ? s ? s.p(a, f) : (s = hl(a), s.c(), s.m(i.parentNode, i)) : s && (s.d(1), s = null); + }, + d(a) { + a && (G(t), G(n), G(r), G(i)), o && o.d(a), l && l.d(a), u && u.d(a), s && s.d(a); + } + }; +} +function Zh(e) { + let t; + return { + c() { + t = fe(" /"); + }, + m(n, r) { + q(n, t, r); + }, + d(n) { + n && G(t); + } + }; +} +function dl(e) { + let t = ( + /*p*/ + e[38].desc + "" + ), n; + return { + c() { + n = fe(t); + }, + m(r, i) { + q(r, n, i); + }, + p(r, i) { + i[0] & /*progress*/ + 128 && t !== (t = /*p*/ + r[38].desc + "") && Ge(n, t); + }, + d(r) { + r && G(n); + } + }; +} +function _l(e) { + let t; + return { + c() { + t = fe("-"); + }, + m(n, r) { + q(n, t, r); + }, + d(n) { + n && G(t); + } + }; +} +function hl(e) { + let t = (100 * /*progress_level*/ + (e[14][ + /*i*/ + e[40] + ] || 0)).toFixed(1) + "", n, r; + return { + c() { + n = fe(t), r = fe("%"); + }, + m(i, o) { + q(i, n, o), q(i, r, o); + }, + p(i, o) { + o[0] & /*progress_level*/ + 16384 && t !== (t = (100 * /*progress_level*/ + (i[14][ + /*i*/ + i[40] + ] || 0)).toFixed(1) + "") && Ge(n, t); + }, + d(i) { + i && (G(n), G(r)); + } + }; +} +function ml(e) { + let t, n = ( + /*p*/ + (e[38].desc != null || /*progress_level*/ + e[14] && /*progress_level*/ + e[14][ + /*i*/ + e[40] + ] != null) && cl(e) + ); + return { + c() { + n && n.c(), t = Kt(); + }, + m(r, i) { + n && n.m(r, i), q(r, t, i); + }, + p(r, i) { + /*p*/ + r[38].desc != null || /*progress_level*/ + r[14] && /*progress_level*/ + r[14][ + /*i*/ + r[40] + ] != null ? n ? n.p(r, i) : (n = cl(r), n.c(), n.m(t.parentNode, t)) : n && (n.d(1), n = null); + }, + d(r) { + r && G(t), n && n.d(r); + } + }; +} +function pl(e) { + let t, n; + return { + c() { + t = tt("p"), n = fe( + /*loading_text*/ + e[9] + ), Ye(t, "class", "loading svelte-1txqlrd"); + }, + m(r, i) { + q(r, t, i), St(t, n); + }, + p(r, i) { + i[0] & /*loading_text*/ + 512 && Ge( + n, + /*loading_text*/ + r[9] + ); + }, + d(r) { + r && G(t); + } + }; +} +function Jh(e) { + let t, n, r, i, o; + const l = [Gh, Fh], u = []; + function s(a, f) { + return ( + /*status*/ + a[4] === "pending" ? 0 : ( + /*status*/ + a[4] === "error" ? 1 : -1 + ) + ); + } + return ~(n = s(e)) && (r = u[n] = l[n](e)), { + c() { + t = tt("div"), r && r.c(), Ye(t, "class", i = "wrap " + /*variant*/ + e[8] + " " + /*show_progress*/ + e[6] + " svelte-1txqlrd"), Re(t, "hide", !/*status*/ + e[4] || /*status*/ + e[4] === "complete" || /*show_progress*/ + e[6] === "hidden"), Re( + t, + "translucent", + /*variant*/ + e[8] === "center" && /*status*/ + (e[4] === "pending" || /*status*/ + e[4] === "error") || /*translucent*/ + e[11] || /*show_progress*/ + e[6] === "minimal" + ), Re( + t, + "generating", + /*status*/ + e[4] === "generating" + ), Re( + t, + "border", + /*border*/ + e[12] + ), ft( + t, + "position", + /*absolute*/ + e[10] ? "absolute" : "static" + ), ft( + t, + "padding", + /*absolute*/ + e[10] ? "0" : "var(--size-8) 0" + ); + }, + m(a, f) { + q(a, t, f), ~n && u[n].m(t, null), e[31](t), o = !0; + }, + p(a, f) { + let d = n; + n = s(a), n === d ? ~n && u[n].p(a, f) : (r && (Ws(), Zt(u[d], 1, 1, () => { + u[d] = null; + }), Vs()), ~n ? (r = u[n], r ? r.p(a, f) : (r = u[n] = l[n](a), r.c()), Wt(r, 1), r.m(t, null)) : r = null), (!o || f[0] & /*variant, show_progress*/ + 320 && i !== (i = "wrap " + /*variant*/ + a[8] + " " + /*show_progress*/ + a[6] + " svelte-1txqlrd")) && Ye(t, "class", i), (!o || f[0] & /*variant, show_progress, status, show_progress*/ + 336) && Re(t, "hide", !/*status*/ + a[4] || /*status*/ + a[4] === "complete" || /*show_progress*/ + a[6] === "hidden"), (!o || f[0] & /*variant, show_progress, variant, status, translucent, show_progress*/ + 2384) && Re( + t, + "translucent", + /*variant*/ + a[8] === "center" && /*status*/ + (a[4] === "pending" || /*status*/ + a[4] === "error") || /*translucent*/ + a[11] || /*show_progress*/ + a[6] === "minimal" + ), (!o || f[0] & /*variant, show_progress, status*/ + 336) && Re( + t, + "generating", + /*status*/ + a[4] === "generating" + ), (!o || f[0] & /*variant, show_progress, border*/ + 4416) && Re( + t, + "border", + /*border*/ + a[12] + ), f[0] & /*absolute*/ + 1024 && ft( + t, + "position", + /*absolute*/ + a[10] ? "absolute" : "static" + ), f[0] & /*absolute*/ + 1024 && ft( + t, + "padding", + /*absolute*/ + a[10] ? "0" : "var(--size-8) 0" + ); + }, + i(a) { + o || (Wt(r), o = !0); + }, + o(a) { + Zt(r), o = !1; + }, + d(a) { + a && G(t), ~n && u[n].d(), e[31](null); + } + }; +} +let Hn = [], jr = !1; +async function Qh(e, t = !0) { + if (!(window.__gradio_mode__ === "website" || window.__gradio_mode__ !== "app" && t !== !0)) { + if (Hn.push(e), !jr) + jr = !0; + else + return; + await Dh(), requestAnimationFrame(() => { + let n = [0, 0]; + for (let r = 0; r < Hn.length; r++) { + const o = Hn[r].getBoundingClientRect(); + (r === 0 || o.top + window.scrollY <= n[0]) && (n[0] = o.top + window.scrollY, n[1] = r); + } + window.scrollTo({ top: n[0] - 20, behavior: "smooth" }), jr = !1, Hn = []; + }); + } +} +function Yh(e, t, n) { + let r, { $$slots: i = {}, $$scope: o } = t, { i18n: l } = t, { eta: u = null } = t, { queue_position: s } = t, { queue_size: a } = t, { status: f } = t, { scroll_to_output: d = !1 } = t, { timer: c = !0 } = t, { show_progress: h = "full" } = t, { message: _ = null } = t, { progress: m = null } = t, { variant: g = "default" } = t, { loading_text: p = "Loading..." } = t, { absolute: v = !0 } = t, { translucent: b = !1 } = t, { border: w = !1 } = t, { autoscroll: y } = t, S, C = !1, P = 0, k = 0, O = null, U = null, x = 0, j = null, te, ne = null, ce = !0; + const me = () => { + n(0, u = n(26, O = n(19, pe = null))), n(24, P = performance.now()), n(25, k = 0), C = !0, _e(); + }; + function _e() { + requestAnimationFrame(() => { + n(25, k = (performance.now() - P) / 1e3), C && _e(); + }); + } + function B() { + n(25, k = 0), n(0, u = n(26, O = n(19, pe = null))), C && (C = !1); + } + Rh(() => { + C && B(); + }); + let pe = null; + function E(A) { + nl[A ? "unshift" : "push"](() => { + ne = A, n(16, ne), n(7, m), n(14, j), n(15, te); + }); + } + function M(A) { + nl[A ? "unshift" : "push"](() => { + S = A, n(13, S); + }); + } + return e.$$set = (A) => { + "i18n" in A && n(1, l = A.i18n), "eta" in A && n(0, u = A.eta), "queue_position" in A && n(2, s = A.queue_position), "queue_size" in A && n(3, a = A.queue_size), "status" in A && n(4, f = A.status), "scroll_to_output" in A && n(21, d = A.scroll_to_output), "timer" in A && n(5, c = A.timer), "show_progress" in A && n(6, h = A.show_progress), "message" in A && n(22, _ = A.message), "progress" in A && n(7, m = A.progress), "variant" in A && n(8, g = A.variant), "loading_text" in A && n(9, p = A.loading_text), "absolute" in A && n(10, v = A.absolute), "translucent" in A && n(11, b = A.translucent), "border" in A && n(12, w = A.border), "autoscroll" in A && n(23, y = A.autoscroll), "$$scope" in A && n(28, o = A.$$scope); + }, e.$$.update = () => { + e.$$.dirty[0] & /*eta, old_eta, timer_start, eta_from_start*/ + 218103809 && (u === null && n(0, u = O), u != null && O !== u && (n(27, U = (performance.now() - P) / 1e3 + u), n(19, pe = U.toFixed(1)), n(26, O = u))), e.$$.dirty[0] & /*eta_from_start, timer_diff*/ + 167772160 && n(17, x = U === null || U <= 0 || !k ? null : Math.min(k / U, 1)), e.$$.dirty[0] & /*progress*/ + 128 && m != null && n(18, ce = !1), e.$$.dirty[0] & /*progress, progress_level, progress_bar, last_progress_level*/ + 114816 && (m != null ? n(14, j = m.map((A) => { + if (A.index != null && A.length != null) + return A.index / A.length; + if (A.progress != null) + return A.progress; + })) : n(14, j = null), j ? (n(15, te = j[j.length - 1]), ne && (te === 0 ? n(16, ne.style.transition = "0", ne) : n(16, ne.style.transition = "150ms", ne))) : n(15, te = void 0)), e.$$.dirty[0] & /*status*/ + 16 && (f === "pending" ? me() : B()), e.$$.dirty[0] & /*el, scroll_to_output, status, autoscroll*/ + 10493968 && S && d && (f === "pending" || f === "complete") && Qh(S, y), e.$$.dirty[0] & /*status, message*/ + 4194320, e.$$.dirty[0] & /*timer_diff*/ + 33554432 && n(20, r = k.toFixed(1)); + }, [ + u, + l, + s, + a, + f, + c, + h, + m, + g, + p, + v, + b, + w, + S, + j, + te, + ne, + x, + ce, + pe, + r, + d, + _, + y, + P, + k, + O, + U, + o, + i, + E, + M + ]; +} +class Kh extends Ah { + constructor(t) { + super(), Oh( + this, + t, + Yh, + Jh, + Nh, + { + i18n: 1, + eta: 0, + queue_position: 2, + queue_size: 3, + status: 4, + scroll_to_output: 21, + timer: 5, + show_progress: 6, + message: 22, + progress: 7, + variant: 8, + loading_text: 9, + absolute: 10, + translucent: 11, + border: 12, + autoscroll: 23 + }, + null, + [-1, -1] + ); + } +} +const gl = (e) => { + let t = ["B", "KB", "MB", "GB", "PB"], n = 0; + for (; e > 1024; ) + e /= 1024, n++; + let r = t[n]; + return e.toFixed(1) + " " + r; +}; +const { + HtmlTag: $h, + SvelteComponent: em, + append: Ve, + attr: Qe, + check_outros: Zs, + create_component: tm, + destroy_component: nm, + destroy_each: rm, + detach: ur, + element: at, + ensure_array_like: bl, + group_outros: Js, + init: im, + insert: fr, + listen: om, + mount_component: lm, + noop: wl, + safe_not_equal: sm, + set_data: _i, + set_style: vl, + space: xr, + text: Yn, + toggle_class: yl, + transition_in: qt, + transition_out: _n +} = window.__gradio__svelte__internal, { createEventDispatcher: am } = window.__gradio__svelte__internal; +function El(e, t, n) { + const r = e.slice(); + return r[7] = t[n], r[9] = n, r; +} +function um(e) { + let t = ( + /*i18n*/ + e[2]("file.uploading") + "" + ), n; + return { + c() { + n = Yn(t); + }, + m(r, i) { + fr(r, n, i); + }, + p(r, i) { + i & /*i18n*/ + 4 && t !== (t = /*i18n*/ + r[2]("file.uploading") + "") && _i(n, t); + }, + i: wl, + o: wl, + d(r) { + r && ur(n); + } + }; +} +function fm(e) { + let t, n; + return t = new Ns({ + props: { + href: ( + /*file*/ + e[7].url + ), + download: window.__is_colab__ ? null : ( + /*file*/ + e[7].orig_name + ), + $$slots: { default: [cm] }, + $$scope: { ctx: e } + } + }), { + c() { + tm(t.$$.fragment); + }, + m(r, i) { + lm(t, r, i), n = !0; + }, + p(r, i) { + const o = {}; + i & /*normalized_files*/ + 8 && (o.href = /*file*/ + r[7].url), i & /*normalized_files*/ + 8 && (o.download = window.__is_colab__ ? null : ( + /*file*/ + r[7].orig_name + )), i & /*$$scope, normalized_files*/ + 1032 && (o.$$scope = { dirty: i, ctx: r }), t.$set(o); + }, + i(r) { + n || (qt(t.$$.fragment, r), n = !0); + }, + o(r) { + _n(t.$$.fragment, r), n = !1; + }, + d(r) { + nm(t, r); + } + }; +} +function cm(e) { + let t, n = ( + /*file*/ + (e[7].size != null ? gl( + /*file*/ + e[7].size + ) : "(size unknown)") + "" + ), r; + return { + c() { + t = new $h(!1), r = Yn(" ⇣"), t.a = r; + }, + m(i, o) { + t.m(n, i, o), fr(i, r, o); + }, + p(i, o) { + o & /*normalized_files*/ + 8 && n !== (n = /*file*/ + (i[7].size != null ? gl( + /*file*/ + i[7].size + ) : "(size unknown)") + "") && t.p(n); + }, + d(i) { + i && (t.d(), ur(r)); + } + }; +} +function Sl(e) { + let t, n, r, i = ( + /*file*/ + e[7].filename_stem + "" + ), o, l, u, s = ( + /*file*/ + e[7].filename_ext + "" + ), a, f, d, c, h, _, m, g, p, v; + const b = [fm, um], w = []; + function y(C, P) { + return ( + /*file*/ + C[7].url ? 0 : 1 + ); + } + h = y(e), _ = w[h] = b[h](e); + function S() { + return ( + /*click_handler*/ + e[6]( + /*file*/ + e[7], + /*i*/ + e[9] + ) + ); + } + return { + c() { + t = at("tr"), n = at("td"), r = at("span"), o = Yn(i), l = xr(), u = at("span"), a = Yn(s), d = xr(), c = at("td"), _.c(), m = xr(), Qe(r, "class", "stem svelte-144xq2d"), Qe(u, "class", "ext svelte-144xq2d"), Qe(n, "class", "filename svelte-144xq2d"), Qe(n, "aria-label", f = /*file*/ + e[7].orig_name), Qe(c, "class", "download svelte-144xq2d"), Qe(t, "class", "file svelte-144xq2d"), yl( + t, + "selectable", + /*selectable*/ + e[0] + ); + }, + m(C, P) { + fr(C, t, P), Ve(t, n), Ve(n, r), Ve(r, o), Ve(n, l), Ve(n, u), Ve(u, a), Ve(t, d), Ve(t, c), w[h].m(c, null), Ve(t, m), g = !0, p || (v = om(t, "click", S), p = !0); + }, + p(C, P) { + e = C, (!g || P & /*normalized_files*/ + 8) && i !== (i = /*file*/ + e[7].filename_stem + "") && _i(o, i), (!g || P & /*normalized_files*/ + 8) && s !== (s = /*file*/ + e[7].filename_ext + "") && _i(a, s), (!g || P & /*normalized_files*/ + 8 && f !== (f = /*file*/ + e[7].orig_name)) && Qe(n, "aria-label", f); + let k = h; + h = y(e), h === k ? w[h].p(e, P) : (Js(), _n(w[k], 1, 1, () => { + w[k] = null; + }), Zs(), _ = w[h], _ ? _.p(e, P) : (_ = w[h] = b[h](e), _.c()), qt(_, 1), _.m(c, null)), (!g || P & /*selectable*/ + 1) && yl( + t, + "selectable", + /*selectable*/ + e[0] + ); + }, + i(C) { + g || (qt(_), g = !0); + }, + o(C) { + _n(_), g = !1; + }, + d(C) { + C && ur(t), w[h].d(), p = !1, v(); + } + }; +} +function dm(e) { + let t, n, r, i, o = bl( + /*normalized_files*/ + e[3] + ), l = []; + for (let s = 0; s < o.length; s += 1) + l[s] = Sl(El(e, o, s)); + const u = (s) => _n(l[s], 1, 1, () => { + l[s] = null; + }); + return { + c() { + t = at("div"), n = at("table"), r = at("tbody"); + for (let s = 0; s < l.length; s += 1) + l[s].c(); + Qe(r, "class", "svelte-144xq2d"), Qe(n, "class", "file-preview svelte-144xq2d"), Qe(t, "class", "file-preview-holder"), vl(t, "max-height", typeof /*height*/ + e[1] === void 0 ? "auto" : ( + /*height*/ + e[1] + "px" + )); + }, + m(s, a) { + fr(s, t, a), Ve(t, n), Ve(n, r); + for (let f = 0; f < l.length; f += 1) + l[f] && l[f].m(r, null); + i = !0; + }, + p(s, [a]) { + if (a & /*selectable, dispatch, normalized_files, window, i18n*/ + 29) { + o = bl( + /*normalized_files*/ + s[3] + ); + let f; + for (f = 0; f < o.length; f += 1) { + const d = El(s, o, f); + l[f] ? (l[f].p(d, a), qt(l[f], 1)) : (l[f] = Sl(d), l[f].c(), qt(l[f], 1), l[f].m(r, null)); + } + for (Js(), f = o.length; f < l.length; f += 1) + u(f); + Zs(); + } + (!i || a & /*height*/ + 2) && vl(t, "max-height", typeof /*height*/ + s[1] === void 0 ? "auto" : ( + /*height*/ + s[1] + "px" + )); + }, + i(s) { + if (!i) { + for (let a = 0; a < o.length; a += 1) + qt(l[a]); + i = !0; + } + }, + o(s) { + l = l.filter(Boolean); + for (let a = 0; a < l.length; a += 1) + _n(l[a]); + i = !1; + }, + d(s) { + s && ur(t), rm(l, s); + } + }; +} +function _m(e, t) { + return e ?? t(); +} +function hm(e) { + const t = e.lastIndexOf("."); + return t === -1 ? [e, ""] : [e.slice(0, t), e.slice(t)]; +} +function mm(e, t, n) { + let r; + const i = am(); + let { value: o } = t, { selectable: l = !1 } = t, { height: u = void 0 } = t, { i18n: s } = t; + const a = (f, d) => i("select", { value: f.orig_name, index: d }); + return e.$$set = (f) => { + "value" in f && n(5, o = f.value), "selectable" in f && n(0, l = f.selectable), "height" in f && n(1, u = f.height), "i18n" in f && n(2, s = f.i18n); + }, e.$$.update = () => { + e.$$.dirty & /*value*/ + 32 && n(3, r = (Array.isArray(o) ? o : [o]).map((f) => { + const [d, c] = hm(_m(f.orig_name, () => "")); + return { ...f, filename_stem: d, filename_ext: c }; + })); + }, [l, u, s, r, i, o, a]; +} +class pm extends em { + constructor(t) { + super(), im(this, t, mm, dm, sm, { + value: 5, + selectable: 0, + height: 1, + i18n: 2 + }); + } +} +const { + SvelteComponent: gm, + add_flush_callback: bm, + bind: wm, + binding_callbacks: vm, + bubble: ym, + check_outros: Em, + create_component: Kn, + create_slot: Sm, + destroy_component: $n, + detach: hi, + empty: km, + get_all_dirty_from_scope: Tm, + get_slot_changes: Am, + group_outros: Bm, + init: Cm, + insert: mi, + mount_component: er, + safe_not_equal: Im, + space: Qs, + transition_in: Tt, + transition_out: At, + update_slot_base: Lm +} = window.__gradio__svelte__internal, { createEventDispatcher: Pm, tick: Om } = window.__gradio__svelte__internal; +function Hm(e) { + let t, n, r; + function i(l) { + e[15](l); + } + let o = { + filetype: ( + /*accept_file_types*/ + e[9] + ), + file_count: ( + /*file_count*/ + e[3] + ), + root: ( + /*root*/ + e[5] + ), + $$slots: { default: [Mm] }, + $$scope: { ctx: e } + }; + return ( + /*dragging*/ + e[8] !== void 0 && (o.dragging = /*dragging*/ + e[8]), t = new Id({ props: o }), vm.push(() => wm(t, "dragging", i)), t.$on( + "load", + /*handle_upload*/ + e[10] + ), { + c() { + Kn(t.$$.fragment); + }, + m(l, u) { + er(t, l, u), r = !0; + }, + p(l, u) { + const s = {}; + u & /*accept_file_types*/ + 512 && (s.filetype = /*accept_file_types*/ + l[9]), u & /*file_count*/ + 8 && (s.file_count = /*file_count*/ + l[3]), u & /*root*/ + 32 && (s.root = /*root*/ + l[5]), u & /*$$scope*/ + 65536 && (s.$$scope = { dirty: u, ctx: l }), !n && u & /*dragging*/ + 256 && (n = !0, s.dragging = /*dragging*/ + l[8], bm(() => n = !1)), t.$set(s); + }, + i(l) { + r || (Tt(t.$$.fragment, l), r = !0); + }, + o(l) { + At(t.$$.fragment, l), r = !1; + }, + d(l) { + $n(t, l); + } + } + ); +} +function Nm(e) { + let t, n, r, i; + return t = new ki({ + props: { i18n: ( + /*i18n*/ + e[7] + ), absolute: !0 } + }), t.$on( + "clear", + /*handle_clear*/ + e[11] + ), r = new pm({ + props: { + i18n: ( + /*i18n*/ + e[7] + ), + selectable: ( + /*selectable*/ + e[4] + ), + value: ( + /*value*/ + e[0] + ), + height: ( + /*height*/ + e[6] + ) + } + }), r.$on( + "select", + /*select_handler*/ + e[14] + ), { + c() { + Kn(t.$$.fragment), n = Qs(), Kn(r.$$.fragment); + }, + m(o, l) { + er(t, o, l), mi(o, n, l), er(r, o, l), i = !0; + }, + p(o, l) { + const u = {}; + l & /*i18n*/ + 128 && (u.i18n = /*i18n*/ + o[7]), t.$set(u); + const s = {}; + l & /*i18n*/ + 128 && (s.i18n = /*i18n*/ + o[7]), l & /*selectable*/ + 16 && (s.selectable = /*selectable*/ + o[4]), l & /*value*/ + 1 && (s.value = /*value*/ + o[0]), l & /*height*/ + 64 && (s.height = /*height*/ + o[6]), r.$set(s); + }, + i(o) { + i || (Tt(t.$$.fragment, o), Tt(r.$$.fragment, o), i = !0); + }, + o(o) { + At(t.$$.fragment, o), At(r.$$.fragment, o), i = !1; + }, + d(o) { + o && hi(n), $n(t, o), $n(r, o); + } + }; +} +function Mm(e) { + let t; + const n = ( + /*#slots*/ + e[13].default + ), r = Sm( + n, + e, + /*$$scope*/ + e[16], + null + ); + return { + c() { + r && r.c(); + }, + m(i, o) { + r && r.m(i, o), t = !0; + }, + p(i, o) { + r && r.p && (!t || o & /*$$scope*/ + 65536) && Lm( + r, + n, + i, + /*$$scope*/ + i[16], + t ? Am( + n, + /*$$scope*/ + i[16], + o, + null + ) : Tm( + /*$$scope*/ + i[16] + ), + null + ); + }, + i(i) { + t || (Tt(r, i), t = !0); + }, + o(i) { + At(r, i), t = !1; + }, + d(i) { + r && r.d(i); + } + }; +} +function Dm(e) { + let t, n, r, i, o, l, u; + t = new Pl({ + props: { + show_label: ( + /*show_label*/ + e[2] + ), + Icon: Zu, + float: ( + /*value*/ + e[0] === null + ), + label: ( + /*label*/ + e[1] || "File" + ) + } + }); + const s = [Nm, Hm], a = []; + function f(d, c) { + return c & /*value*/ + 1 && (r = null), r == null && (r = !!/*value*/ + (d[0] && (Array.isArray( + /*value*/ + d[0] + ) && /*value*/ + d[0].length > 0))), r ? 0 : 1; + } + return i = f(e, -1), o = a[i] = s[i](e), { + c() { + Kn(t.$$.fragment), n = Qs(), o.c(), l = km(); + }, + m(d, c) { + er(t, d, c), mi(d, n, c), a[i].m(d, c), mi(d, l, c), u = !0; + }, + p(d, [c]) { + const h = {}; + c & /*show_label*/ + 4 && (h.show_label = /*show_label*/ + d[2]), c & /*value*/ + 1 && (h.float = /*value*/ + d[0] === null), c & /*label*/ + 2 && (h.label = /*label*/ + d[1] || "File"), t.$set(h); + let _ = i; + i = f(d, c), i === _ ? a[i].p(d, c) : (Bm(), At(a[_], 1, 1, () => { + a[_] = null; + }), Em(), o = a[i], o ? o.p(d, c) : (o = a[i] = s[i](d), o.c()), Tt(o, 1), o.m(l.parentNode, l)); + }, + i(d) { + u || (Tt(t.$$.fragment, d), Tt(o), u = !0); + }, + o(d) { + At(t.$$.fragment, d), At(o), u = !1; + }, + d(d) { + d && (hi(n), hi(l)), $n(t, d), a[i].d(d); + } + }; +} +function Rm(e, t, n) { + let { $$slots: r = {}, $$scope: i } = t, { value: o } = t, { label: l } = t, { show_label: u = !0 } = t, { file_count: s = "single" } = t, { file_types: a = null } = t, { selectable: f = !1 } = t, { root: d } = t, { height: c = void 0 } = t, { i18n: h } = t; + async function _({ detail: y }) { + n(0, o = y), await Om(), g("change", o), g("upload", y); + } + function m() { + n(0, o = null), g("change", null), g("clear"); + } + const g = Pm(); + let p; + a == null ? p = null : (a = a.map((y) => y.startsWith(".") ? y : y + "/*"), p = a.join(", ")); + let v = !1; + function b(y) { + ym.call(this, e, y); + } + function w(y) { + v = y, n(8, v); + } + return e.$$set = (y) => { + "value" in y && n(0, o = y.value), "label" in y && n(1, l = y.label), "show_label" in y && n(2, u = y.show_label), "file_count" in y && n(3, s = y.file_count), "file_types" in y && n(12, a = y.file_types), "selectable" in y && n(4, f = y.selectable), "root" in y && n(5, d = y.root), "height" in y && n(6, c = y.height), "i18n" in y && n(7, h = y.i18n), "$$scope" in y && n(16, i = y.$$scope); + }, e.$$.update = () => { + e.$$.dirty & /*dragging*/ + 256 && g("drag", v); + }, [ + o, + l, + u, + s, + f, + d, + c, + h, + v, + p, + _, + m, + a, + r, + b, + w, + i + ]; +} +class Um extends gm { + constructor(t) { + super(), Cm(this, t, Rm, Dm, Im, { + value: 0, + label: 1, + show_label: 2, + file_count: 3, + file_types: 12, + selectable: 4, + root: 5, + height: 6, + i18n: 7 + }); + } +} +const { + SvelteComponent: Fm, + add_flush_callback: kl, + assign: Gm, + bind: Tl, + binding_callbacks: Al, + check_outros: qm, + create_component: yn, + destroy_component: En, + detach: Bl, + empty: jm, + get_spread_object: xm, + get_spread_update: zm, + group_outros: Vm, + init: Xm, + insert: Cl, + mount_component: Sn, + safe_not_equal: Wm, + space: Zm, + transition_in: Bt, + transition_out: Ct +} = window.__gradio__svelte__internal, { createEventDispatcher: Jm } = window.__gradio__svelte__internal; +function Qm(e) { + let t, n, r, i; + function o(s) { + e[25](s); + } + function l(s) { + e[26](s); + } + let u = { + label: ( + /*label*/ + e[4] + ), + show_label: ( + /*show_label*/ + e[3] + ), + root: ( + /*root*/ + e[5] + ), + proxy_url: ( + /*proxy_url*/ + e[6] + ), + columns: ( + /*columns*/ + e[13] + ), + rows: ( + /*rows*/ + e[14] + ), + height: ( + /*height*/ + e[15] + ), + preview: ( + /*preview*/ + e[16] + ), + object_fit: ( + /*object_fit*/ + e[18] + ), + interactive: ( + /*interactive*/ + e[20] + ), + allow_preview: ( + /*allow_preview*/ + e[17] + ), + show_share_button: ( + /*show_share_button*/ + e[19] + ), + show_download_button: ( + /*show_download_button*/ + e[21] + ), + i18n: ( + /*gradio*/ + e[22].i18n + ) + }; + return ( + /*selected_index*/ + e[1] !== void 0 && (u.selected_index = /*selected_index*/ + e[1]), /*value*/ + e[0] !== void 0 && (u.value = /*value*/ + e[0]), t = new mh({ props: u }), Al.push(() => Tl(t, "selected_index", o)), Al.push(() => Tl(t, "value", l)), t.$on( + "change", + /*change_handler*/ + e[27] + ), t.$on( + "select", + /*select_handler*/ + e[28] + ), t.$on( + "share", + /*share_handler*/ + e[29] + ), t.$on( + "error", + /*error_handler*/ + e[30] + ), { + c() { + yn(t.$$.fragment); + }, + m(s, a) { + Sn(t, s, a), i = !0; + }, + p(s, a) { + const f = {}; + a[0] & /*label*/ + 16 && (f.label = /*label*/ + s[4]), a[0] & /*show_label*/ + 8 && (f.show_label = /*show_label*/ + s[3]), a[0] & /*root*/ + 32 && (f.root = /*root*/ + s[5]), a[0] & /*proxy_url*/ + 64 && (f.proxy_url = /*proxy_url*/ + s[6]), a[0] & /*columns*/ + 8192 && (f.columns = /*columns*/ + s[13]), a[0] & /*rows*/ + 16384 && (f.rows = /*rows*/ + s[14]), a[0] & /*height*/ + 32768 && (f.height = /*height*/ + s[15]), a[0] & /*preview*/ + 65536 && (f.preview = /*preview*/ + s[16]), a[0] & /*object_fit*/ + 262144 && (f.object_fit = /*object_fit*/ + s[18]), a[0] & /*interactive*/ + 1048576 && (f.interactive = /*interactive*/ + s[20]), a[0] & /*allow_preview*/ + 131072 && (f.allow_preview = /*allow_preview*/ + s[17]), a[0] & /*show_share_button*/ + 524288 && (f.show_share_button = /*show_share_button*/ + s[19]), a[0] & /*show_download_button*/ + 2097152 && (f.show_download_button = /*show_download_button*/ + s[21]), a[0] & /*gradio*/ + 4194304 && (f.i18n = /*gradio*/ + s[22].i18n), !n && a[0] & /*selected_index*/ + 2 && (n = !0, f.selected_index = /*selected_index*/ + s[1], kl(() => n = !1)), !r && a[0] & /*value*/ + 1 && (r = !0, f.value = /*value*/ + s[0], kl(() => r = !1)), t.$set(f); + }, + i(s) { + i || (Bt(t.$$.fragment, s), i = !0); + }, + o(s) { + Ct(t.$$.fragment, s), i = !1; + }, + d(s) { + En(t, s); + } + } + ); +} +function Ym(e) { + let t, n; + return t = new Um({ + props: { + value: null, + root: ( + /*root*/ + e[5] + ), + label: ( + /*label*/ + e[4] + ), + file_count: "multiple", + file_types: ["image"], + i18n: ( + /*gradio*/ + e[22].i18n + ), + $$slots: { default: [Km] }, + $$scope: { ctx: e } + } + }), t.$on( + "upload", + /*upload_handler*/ + e[24] + ), { + c() { + yn(t.$$.fragment); + }, + m(r, i) { + Sn(t, r, i), n = !0; + }, + p(r, i) { + const o = {}; + i[0] & /*root*/ + 32 && (o.root = /*root*/ + r[5]), i[0] & /*label*/ + 16 && (o.label = /*label*/ + r[4]), i[0] & /*gradio*/ + 4194304 && (o.i18n = /*gradio*/ + r[22].i18n), i[0] & /*gradio*/ + 4194304 | i[1] & /*$$scope*/ + 2 && (o.$$scope = { dirty: i, ctx: r }), t.$set(o); + }, + i(r) { + n || (Bt(t.$$.fragment, r), n = !0); + }, + o(r) { + Ct(t.$$.fragment, r), n = !1; + }, + d(r) { + En(t, r); + } + }; +} +function Km(e) { + let t, n; + return t = new Jf({ + props: { + i18n: ( + /*gradio*/ + e[22].i18n + ), + type: "gallery" + } + }), { + c() { + yn(t.$$.fragment); + }, + m(r, i) { + Sn(t, r, i), n = !0; + }, + p(r, i) { + const o = {}; + i[0] & /*gradio*/ + 4194304 && (o.i18n = /*gradio*/ + r[22].i18n), t.$set(o); + }, + i(r) { + n || (Bt(t.$$.fragment, r), n = !0); + }, + o(r) { + Ct(t.$$.fragment, r), n = !1; + }, + d(r) { + En(t, r); + } + }; +} +function $m(e) { + let t, n, r, i, o, l; + const u = [ + { + autoscroll: ( + /*gradio*/ + e[22].autoscroll + ) + }, + { i18n: ( + /*gradio*/ + e[22].i18n + ) }, + /*loading_status*/ + e[2] + ]; + let s = {}; + for (let c = 0; c < u.length; c += 1) + s = Gm(s, u[c]); + t = new Kh({ props: s }); + const a = [Ym, Qm], f = []; + function d(c, h) { + return ( + /*interactive*/ + c[20] && /*no_value*/ + c[23] ? 0 : 1 + ); + } + return r = d(e), i = f[r] = a[r](e), { + c() { + yn(t.$$.fragment), n = Zm(), i.c(), o = jm(); + }, + m(c, h) { + Sn(t, c, h), Cl(c, n, h), f[r].m(c, h), Cl(c, o, h), l = !0; + }, + p(c, h) { + const _ = h[0] & /*gradio, loading_status*/ + 4194308 ? zm(u, [ + h[0] & /*gradio*/ + 4194304 && { + autoscroll: ( + /*gradio*/ + c[22].autoscroll + ) + }, + h[0] & /*gradio*/ + 4194304 && { i18n: ( + /*gradio*/ + c[22].i18n + ) }, + h[0] & /*loading_status*/ + 4 && xm( + /*loading_status*/ + c[2] + ) + ]) : {}; + t.$set(_); + let m = r; + r = d(c), r === m ? f[r].p(c, h) : (Vm(), Ct(f[m], 1, 1, () => { + f[m] = null; + }), qm(), i = f[r], i ? i.p(c, h) : (i = f[r] = a[r](c), i.c()), Bt(i, 1), i.m(o.parentNode, o)); + }, + i(c) { + l || (Bt(t.$$.fragment, c), Bt(i), l = !0); + }, + o(c) { + Ct(t.$$.fragment, c), Ct(i), l = !1; + }, + d(c) { + c && (Bl(n), Bl(o)), En(t, c), f[r].d(c); + } + }; +} +function ep(e) { + let t, n; + return t = new ba({ + props: { + visible: ( + /*visible*/ + e[9] + ), + variant: "solid", + padding: !1, + elem_id: ( + /*elem_id*/ + e[7] + ), + elem_classes: ( + /*elem_classes*/ + e[8] + ), + container: ( + /*container*/ + e[10] + ), + scale: ( + /*scale*/ + e[11] + ), + min_width: ( + /*min_width*/ + e[12] + ), + allow_overflow: !1, + height: typeof /*height*/ + e[15] == "number" ? ( + /*height*/ + e[15] + ) : void 0, + $$slots: { default: [$m] }, + $$scope: { ctx: e } + } + }), { + c() { + yn(t.$$.fragment); + }, + m(r, i) { + Sn(t, r, i), n = !0; + }, + p(r, i) { + const o = {}; + i[0] & /*visible*/ + 512 && (o.visible = /*visible*/ + r[9]), i[0] & /*elem_id*/ + 128 && (o.elem_id = /*elem_id*/ + r[7]), i[0] & /*elem_classes*/ + 256 && (o.elem_classes = /*elem_classes*/ + r[8]), i[0] & /*container*/ + 1024 && (o.container = /*container*/ + r[10]), i[0] & /*scale*/ + 2048 && (o.scale = /*scale*/ + r[11]), i[0] & /*min_width*/ + 4096 && (o.min_width = /*min_width*/ + r[12]), i[0] & /*height*/ + 32768 && (o.height = typeof /*height*/ + r[15] == "number" ? ( + /*height*/ + r[15] + ) : void 0), i[0] & /*root, label, gradio, value, interactive, no_value, show_label, proxy_url, columns, rows, height, preview, object_fit, allow_preview, show_share_button, show_download_button, selected_index, loading_status*/ + 16769151 | i[1] & /*$$scope*/ + 2 && (o.$$scope = { dirty: i, ctx: r }), t.$set(o); + }, + i(r) { + n || (Bt(t.$$.fragment, r), n = !0); + }, + o(r) { + Ct(t.$$.fragment, r), n = !1; + }, + d(r) { + En(t, r); + } + }; +} +function tp(e, t, n) { + let r, { loading_status: i } = t, { show_label: o } = t, { label: l } = t, { root: u } = t, { proxy_url: s } = t, { elem_id: a = "" } = t, { elem_classes: f = [] } = t, { visible: d = !0 } = t, { value: c = null } = t, { container: h = !0 } = t, { scale: _ = null } = t, { min_width: m = void 0 } = t, { columns: g = [2] } = t, { rows: p = void 0 } = t, { height: v = "auto" } = t, { preview: b } = t, { allow_preview: w = !0 } = t, { selected_index: y = null } = t, { object_fit: S = "cover" } = t, { show_share_button: C = !1 } = t, { interactive: P } = t, { show_download_button: k = !1 } = t, { gradio: O } = t; + const U = Jm(), x = (B) => { + const pe = Array.isArray(B.detail) ? B.detail : [B.detail]; + n(0, c = pe.map((E) => ({ image: E, caption: null }))), O.dispatch("upload", c); + }; + function j(B) { + y = B, n(1, y); + } + function te(B) { + c = B, n(0, c); + } + const ne = () => O.dispatch("change", c), ce = (B) => O.dispatch("select", B.detail), me = (B) => O.dispatch("share", B.detail), _e = (B) => O.dispatch("error", B.detail); + return e.$$set = (B) => { + "loading_status" in B && n(2, i = B.loading_status), "show_label" in B && n(3, o = B.show_label), "label" in B && n(4, l = B.label), "root" in B && n(5, u = B.root), "proxy_url" in B && n(6, s = B.proxy_url), "elem_id" in B && n(7, a = B.elem_id), "elem_classes" in B && n(8, f = B.elem_classes), "visible" in B && n(9, d = B.visible), "value" in B && n(0, c = B.value), "container" in B && n(10, h = B.container), "scale" in B && n(11, _ = B.scale), "min_width" in B && n(12, m = B.min_width), "columns" in B && n(13, g = B.columns), "rows" in B && n(14, p = B.rows), "height" in B && n(15, v = B.height), "preview" in B && n(16, b = B.preview), "allow_preview" in B && n(17, w = B.allow_preview), "selected_index" in B && n(1, y = B.selected_index), "object_fit" in B && n(18, S = B.object_fit), "show_share_button" in B && n(19, C = B.show_share_button), "interactive" in B && n(20, P = B.interactive), "show_download_button" in B && n(21, k = B.show_download_button), "gradio" in B && n(22, O = B.gradio); + }, e.$$.update = () => { + e.$$.dirty[0] & /*value*/ + 1 && n(23, r = Array.isArray(c) ? c.length === 0 : !c), e.$$.dirty[0] & /*selected_index*/ + 2 && U("prop_change", { selected_index: y }); + }, [ + c, + y, + i, + o, + l, + u, + s, + a, + f, + d, + h, + _, + m, + g, + p, + v, + b, + w, + S, + C, + P, + k, + O, + r, + x, + j, + te, + ne, + ce, + me, + _e + ]; +} +class up extends Fm { + constructor(t) { + super(), Xm( + this, + t, + tp, + ep, + Wm, + { + loading_status: 2, + show_label: 3, + label: 4, + root: 5, + proxy_url: 6, + elem_id: 7, + elem_classes: 8, + visible: 9, + value: 0, + container: 10, + scale: 11, + min_width: 12, + columns: 13, + rows: 14, + height: 15, + preview: 16, + allow_preview: 17, + selected_index: 1, + object_fit: 18, + show_share_button: 19, + interactive: 20, + show_download_button: 21, + gradio: 22 + }, + null, + [-1, -1] + ); + } +} +export { + mh as BaseGallery, + up as default +};