diff --git a/README.md b/README.md index 29cd489..15989b0 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,30 @@ pip install gradio_image_annotation import gradio as gr from gradio_image_annotation import image_annotator -example = { + +example_annotation = { + "image": "https://gradio-builds.s3.amazonaws.com/demo-files/base.png", + "boxes": [ + { + "xmin": 636, + "ymin": 575, + "xmax": 801, + "ymax": 697, + "label": "Vehicle", + "color": (255, 0, 0) + }, + { + "xmin": 360, + "ymin": 615, + "xmax": 386, + "ymax": 702, + "label": "Person", + "color": (0, 255, 0) + } + ] +} + +example_crop = { "image": "https://raw.githubusercontent.com/gradio-app/gradio/main/guides/assets/logo.png", "boxes": [ { @@ -24,8 +47,7 @@ example = { "ymin": 70, "xmax": 530, "ymax": 500, - "label": "Gradio", - "color": (250, 185, 0), + "color": (100, 200, 255) } ] } @@ -44,19 +66,25 @@ def crop(annotations): def get_boxes_json(annotations): return annotations["boxes"] + with gr.Blocks() as demo: with gr.Tab("Object annotation"): annotator = image_annotator( - {"image": "https://gradio-builds.s3.amazonaws.com/demo-files/base.png"}, + example_annotation, label_list=["Person", "Vehicle"], label_colors=[(0, 255, 0), (255, 0, 0)], ) button_get = gr.Button("Get bounding boxes") json_boxes = gr.JSON() button_get.click(get_boxes_json, annotator, json_boxes) + with gr.Tab("Crop"): with gr.Row(): - annotator_crop = image_annotator(example, image_type="numpy") + annotator_crop = image_annotator( + example_crop, + image_type="numpy", + disable_edit_boxes=True + ) image_crop = gr.Image() button_crop = gr.Button("Crop") button_crop.click(crop, annotator_crop, image_crop) @@ -185,6 +213,19 @@ int | None Thickness of the bounding box outline when it is selected. + +disable_edit_boxes + + +```python +bool | None +``` + + +None +Disables the ability to set and edit the label and color of the boxes. + + height diff --git a/backend/gradio_image_annotation/templates/component/index.js b/backend/gradio_image_annotation/templates/component/index.js index 049d834..0757c2b 100644 --- a/backend/gradio_image_annotation/templates/component/index.js +++ b/backend/gradio_image_annotation/templates/component/index.js @@ -10,11 +10,11 @@ const { init: ua, insert: ca, safe_not_equal: _a, - set_dynamic_element_data: pi, - set_style: ke, - toggle_class: Re, - transition_in: Jo, - transition_out: Qo, + set_dynamic_element_data: ki, + set_style: ge, + toggle_class: He, + transition_in: xo, + transition_out: $o, update_slot_base: da } = window.__gradio__svelte__internal; function ha(l) { @@ -50,32 +50,32 @@ function ha(l) { e = sa( /*tag*/ l[14] - ), o && o.c(), pi( + ), o && o.c(), ki( /*tag*/ l[14] - )(e, r), Re( + )(e, r), He( e, "hidden", /*visible*/ l[10] === !1 - ), Re( + ), He( e, "padded", /*padding*/ l[6] - ), Re( + ), He( e, "border_focus", /*border_mode*/ l[5] === "focus" - ), Re( + ), He( e, "border_contrast", /*border_mode*/ l[5] === "contrast" - ), Re(e, "hide-container", !/*explicit_call*/ + ), He(e, "hide-container", !/*explicit_call*/ l[8] && !/*container*/ - l[9]), ke( + l[9]), ge( e, "height", /*get_dimension*/ @@ -83,7 +83,7 @@ function ha(l) { /*height*/ l[0] ) - ), ke(e, "width", typeof /*width*/ + ), ge(e, "width", typeof /*width*/ l[1] == "number" ? `calc(min(${/*width*/ l[1]}px, 100%))` : ( /*get_dimension*/ @@ -91,23 +91,23 @@ function ha(l) { /*width*/ l[1] ) - )), ke( + )), ge( e, "border-style", /*variant*/ l[4] - ), ke( + ), ge( e, "overflow", /*allow_overflow*/ l[11] ? "visible" : "hidden" - ), ke( + ), ge( e, "flex-grow", /*scale*/ l[12] - ), ke(e, "min-width", `calc(min(${/*min_width*/ - l[13]}px, 100%))`), ke(e, "border-width", "var(--block-border-width)"); + ), ge(e, "min-width", `calc(min(${/*min_width*/ + l[13]}px, 100%))`), ge(e, "border-width", "var(--block-border-width)"); }, m(s, f) { ca(s, e, f), o && o.m(e, null), n = !0; @@ -131,7 +131,7 @@ function ha(l) { s[17] ), null - ), pi( + ), ki( /*tag*/ s[14] )(e, r = fa(a, [ @@ -148,30 +148,30 @@ function ha(l) { (!n || f & /*elem_classes*/ 8 && t !== (t = "block " + /*elem_classes*/ s[3].join(" ") + " svelte-nl1om8")) && { class: t } - ])), Re( + ])), He( e, "hidden", /*visible*/ s[10] === !1 - ), Re( + ), He( e, "padded", /*padding*/ s[6] - ), Re( + ), He( e, "border_focus", /*border_mode*/ s[5] === "focus" - ), Re( + ), He( e, "border_contrast", /*border_mode*/ s[5] === "contrast" - ), Re(e, "hide-container", !/*explicit_call*/ + ), He(e, "hide-container", !/*explicit_call*/ s[8] && !/*container*/ s[9]), f & /*height*/ - 1 && ke( + 1 && ge( e, "height", /*get_dimension*/ @@ -180,7 +180,7 @@ function ha(l) { s[0] ) ), f & /*width*/ - 2 && ke(e, "width", typeof /*width*/ + 2 && ge(e, "width", typeof /*width*/ s[1] == "number" ? `calc(min(${/*width*/ s[1]}px, 100%))` : ( /*get_dimension*/ @@ -189,32 +189,32 @@ function ha(l) { s[1] ) )), f & /*variant*/ - 16 && ke( + 16 && ge( e, "border-style", /*variant*/ s[4] ), f & /*allow_overflow*/ - 2048 && ke( + 2048 && ge( e, "overflow", /*allow_overflow*/ s[11] ? "visible" : "hidden" ), f & /*scale*/ - 4096 && ke( + 4096 && ge( e, "flex-grow", /*scale*/ s[12] ), f & /*min_width*/ - 8192 && ke(e, "min-width", `calc(min(${/*min_width*/ + 8192 && ge(e, "min-width", `calc(min(${/*min_width*/ s[13]}px, 100%))`); }, i(s) { - n || (Jo(o, s), n = !0); + n || (xo(o, s), n = !0); }, o(s) { - Qo(o, s), n = !1; + $o(o, s), n = !1; }, d(s) { s && oa(e), o && o.d(s); @@ -238,10 +238,10 @@ function ma(l) { n[14] && t.p(n, i); }, i(n) { - e || (Jo(t, n), e = !0); + e || (xo(t, n), e = !0); }, o(n) { - Qo(t, n), e = !1; + $o(t, n), e = !1; }, d(n) { t && t.d(n); @@ -249,17 +249,17 @@ function ma(l) { }; } function ba(l, e, t) { - let { $$slots: n = {}, $$scope: i } = e, { height: o = void 0 } = e, { width: a = void 0 } = e, { elem_id: r = "" } = e, { elem_classes: s = [] } = e, { variant: f = "solid" } = e, { border_mode: u = "base" } = e, { padding: c = !0 } = e, { type: d = "normal" } = e, { test_id: _ = void 0 } = e, { explicit_call: h = !1 } = e, { container: m = !0 } = e, { visible: b = !0 } = e, { allow_overflow: g = !0 } = e, { scale: w = null } = e, { min_width: p = 0 } = e, C = d === "fieldset" ? "fieldset" : "div"; - const E = (v) => { - if (v !== void 0) { - if (typeof v == "number") - return v + "px"; - if (typeof v == "string") - return v; + let { $$slots: n = {}, $$scope: i } = e, { height: o = void 0 } = e, { width: a = void 0 } = e, { elem_id: r = "" } = e, { elem_classes: s = [] } = e, { variant: f = "solid" } = e, { border_mode: u = "base" } = e, { padding: c = !0 } = e, { type: _ = "normal" } = e, { test_id: d = void 0 } = e, { explicit_call: h = !1 } = e, { container: b = !0 } = e, { visible: m = !0 } = e, { allow_overflow: w = !0 } = e, { scale: k = null } = e, { min_width: g = 0 } = e, S = _ === "fieldset" ? "fieldset" : "div"; + const M = (y) => { + if (y !== void 0) { + if (typeof y == "number") + return y + "px"; + if (typeof y == "string") + return y; } }; - return l.$$set = (v) => { - "height" in v && t(0, o = v.height), "width" in v && t(1, a = v.width), "elem_id" in v && t(2, r = v.elem_id), "elem_classes" in v && t(3, s = v.elem_classes), "variant" in v && t(4, f = v.variant), "border_mode" in v && t(5, u = v.border_mode), "padding" in v && t(6, c = v.padding), "type" in v && t(16, d = v.type), "test_id" in v && t(7, _ = v.test_id), "explicit_call" in v && t(8, h = v.explicit_call), "container" in v && t(9, m = v.container), "visible" in v && t(10, b = v.visible), "allow_overflow" in v && t(11, g = v.allow_overflow), "scale" in v && t(12, w = v.scale), "min_width" in v && t(13, p = v.min_width), "$$scope" in v && t(17, i = v.$$scope); + return l.$$set = (y) => { + "height" in y && t(0, o = y.height), "width" in y && t(1, a = y.width), "elem_id" in y && t(2, r = y.elem_id), "elem_classes" in y && t(3, s = y.elem_classes), "variant" in y && t(4, f = y.variant), "border_mode" in y && t(5, u = y.border_mode), "padding" in y && t(6, c = y.padding), "type" in y && t(16, _ = y.type), "test_id" in y && t(7, d = y.test_id), "explicit_call" in y && t(8, h = y.explicit_call), "container" in y && t(9, b = y.container), "visible" in y && t(10, m = y.visible), "allow_overflow" in y && t(11, w = y.allow_overflow), "scale" in y && t(12, k = y.scale), "min_width" in y && t(13, g = y.min_width), "$$scope" in y && t(17, i = y.$$scope); }, [ o, a, @@ -268,16 +268,16 @@ function ba(l, e, t) { f, u, c, - _, + d, h, - m, b, - g, + m, w, - p, - C, - E, - d, + k, + g, + S, + M, + _, i, n ]; @@ -313,12 +313,12 @@ const { get_slot_changes: Sa, init: za, insert: qa, - safe_not_equal: Ma, - transition_in: Ea, - transition_out: Aa, - update_slot_base: La + safe_not_equal: Ea, + transition_in: Ma, + transition_out: Ba, + update_slot_base: Aa } = window.__gradio__svelte__internal; -function Da(l) { +function La(l) { let e, t; const n = ( /*#slots*/ @@ -339,7 +339,7 @@ function Da(l) { }, p(o, [a]) { i && i.p && (!t || a & /*$$scope*/ - 1) && La( + 1) && Aa( i, n, o, @@ -359,55 +359,55 @@ function Da(l) { ); }, i(o) { - t || (Ea(i, o), t = !0); + t || (Ma(i, o), t = !0); }, o(o) { - Aa(i, o), t = !1; + Ba(i, o), t = !1; }, d(o) { o && va(e), i && i.d(o); } }; } -function Ta(l, e, t) { +function Da(l, e, t) { let { $$slots: n = {}, $$scope: i } = e; return l.$$set = (o) => { "$$scope" in o && t(0, i = o.$$scope); }, [i, n]; } -class Ba extends wa { +class Ta extends wa { constructor(e) { - super(), za(this, e, Ta, Da, Ma, {}); + super(), za(this, e, Da, La, Ea, {}); } } const { SvelteComponent: ja, - attr: ki, + attr: vi, check_outros: Ia, create_component: Ra, create_slot: Fa, destroy_component: Ha, - detach: Hn, + detach: Un, element: Ua, empty: Na, get_all_dirty_from_scope: Oa, get_slot_changes: Xa, group_outros: Ya, init: Wa, - insert: Un, + insert: Nn, mount_component: Va, safe_not_equal: Pa, set_data: Za, space: Ka, text: Ga, - toggle_class: Mt, + toggle_class: Lt, transition_in: nn, - transition_out: Nn, + transition_out: On, update_slot_base: Ja } = window.__gradio__svelte__internal; -function vi(l) { +function yi(l) { let e, t; - return e = new Ba({ + return e = new Ta({ props: { $$slots: { default: [Qa] }, $$scope: { ctx: l } @@ -428,7 +428,7 @@ function vi(l) { t || (nn(e.$$.fragment, n), t = !0); }, o(n) { - Nn(e.$$.fragment, n), t = !1; + On(e.$$.fragment, n), t = !1; }, d(n) { Ha(e, n); @@ -445,7 +445,7 @@ function Qa(l) { ); }, m(t, n) { - Un(t, e, n); + Nn(t, e, n); }, p(t, n) { n & /*info*/ @@ -456,7 +456,7 @@ function Qa(l) { ); }, d(t) { - t && Hn(e); + t && Un(e); } }; } @@ -474,13 +474,13 @@ function xa(l) { ); let r = ( /*info*/ - l[1] && vi(l) + l[1] && yi(l) ); return { c() { - e = Ua("span"), a && a.c(), t = Ka(), r && r.c(), n = Na(), ki(e, "data-testid", "block-info"), ki(e, "class", "svelte-22c38v"), Mt(e, "sr-only", !/*show_label*/ - l[0]), Mt(e, "hide", !/*show_label*/ - l[0]), Mt( + e = Ua("span"), a && a.c(), t = Ka(), r && r.c(), n = Na(), vi(e, "data-testid", "block-info"), vi(e, "class", "svelte-22c38v"), Lt(e, "sr-only", !/*show_label*/ + l[0]), Lt(e, "hide", !/*show_label*/ + l[0]), Lt( e, "has-info", /*info*/ @@ -488,7 +488,7 @@ function xa(l) { ); }, m(s, f) { - Un(s, e, f), a && a.m(e, null), Un(s, t, f), r && r.m(s, f), Un(s, n, f), i = !0; + Nn(s, e, f), a && a.m(e, null), Nn(s, t, f), r && r.m(s, f), Nn(s, n, f), i = !0; }, p(s, [f]) { a && a.p && (!i || f & /*$$scope*/ @@ -510,18 +510,18 @@ function xa(l) { ), null ), (!i || f & /*show_label*/ - 1) && Mt(e, "sr-only", !/*show_label*/ + 1) && Lt(e, "sr-only", !/*show_label*/ s[0]), (!i || f & /*show_label*/ - 1) && Mt(e, "hide", !/*show_label*/ + 1) && Lt(e, "hide", !/*show_label*/ s[0]), (!i || f & /*info*/ - 2) && Mt( + 2) && Lt( e, "has-info", /*info*/ s[1] != null ), /*info*/ s[1] ? r ? (r.p(s, f), f & /*info*/ - 2 && nn(r, 1)) : (r = vi(s), r.c(), nn(r, 1), r.m(n.parentNode, n)) : r && (Ya(), Nn(r, 1, 1, () => { + 2 && nn(r, 1)) : (r = yi(s), r.c(), nn(r, 1), r.m(n.parentNode, n)) : r && (Ya(), On(r, 1, 1, () => { r = null; }), Ia()); }, @@ -529,10 +529,10 @@ function xa(l) { i || (nn(a, s), nn(r), i = !0); }, o(s) { - Nn(a, s), Nn(r), i = !1; + On(a, s), On(r), i = !1; }, d(s) { - s && (Hn(e), Hn(t), Hn(n)), a && a.d(s), r && r.d(s); + s && (Un(e), Un(t), Un(n)), a && a.d(s), r && r.d(s); } }; } @@ -542,19 +542,19 @@ function $a(l, e, t) { "show_label" in r && t(0, o = r.show_label), "info" in r && t(1, a = r.info), "$$scope" in r && t(3, i = r.$$scope); }, [o, a, n, i]; } -class xo extends ja { +class es extends ja { constructor(e) { super(), Wa(this, e, $a, xa, Pa, { show_label: 0, info: 1 }); } } const { SvelteComponent: er, - append: hl, - attr: yn, + append: gl, + attr: Cn, create_component: tr, destroy_component: nr, detach: lr, - element: yi, + element: Ci, init: ir, insert: or, mount_component: sr, @@ -562,7 +562,7 @@ const { set_data: rr, space: fr, text: ur, - toggle_class: Je, + toggle_class: xe, transition_in: cr, transition_out: _r } = window.__gradio__svelte__internal; @@ -571,17 +571,17 @@ function dr(l) { return n = new /*Icon*/ l[1]({}), { c() { - e = yi("label"), t = yi("span"), tr(n.$$.fragment), i = fr(), o = ur( + e = Ci("label"), t = Ci("span"), tr(n.$$.fragment), i = fr(), o = ur( /*label*/ l[0] - ), yn(t, "class", "svelte-9gxdi0"), yn(e, "for", ""), yn(e, "data-testid", "block-label"), yn(e, "class", "svelte-9gxdi0"), Je(e, "hide", !/*show_label*/ - l[2]), Je(e, "sr-only", !/*show_label*/ - l[2]), Je( + ), Cn(t, "class", "svelte-9gxdi0"), Cn(e, "for", ""), Cn(e, "data-testid", "block-label"), Cn(e, "class", "svelte-9gxdi0"), xe(e, "hide", !/*show_label*/ + l[2]), xe(e, "sr-only", !/*show_label*/ + l[2]), xe( e, "float", /*float*/ l[4] - ), Je( + ), xe( e, "hide-label", /*disable*/ @@ -589,7 +589,7 @@ function dr(l) { ); }, m(r, s) { - or(r, e, s), hl(e, t), sr(n, t, null), hl(e, i), hl(e, o), a = !0; + or(r, e, s), gl(e, t), sr(n, t, null), gl(e, i), gl(e, o), a = !0; }, p(r, [s]) { (!a || s & /*label*/ @@ -598,17 +598,17 @@ function dr(l) { /*label*/ r[0] ), (!a || s & /*show_label*/ - 4) && Je(e, "hide", !/*show_label*/ + 4) && xe(e, "hide", !/*show_label*/ r[2]), (!a || s & /*show_label*/ - 4) && Je(e, "sr-only", !/*show_label*/ + 4) && xe(e, "sr-only", !/*show_label*/ r[2]), (!a || s & /*float*/ - 16) && Je( + 16) && xe( e, "float", /*float*/ r[4] ), (!a || s & /*disable*/ - 8) && Je( + 8) && xe( e, "hide-label", /*disable*/ @@ -645,37 +645,37 @@ class mr extends er { } const { SvelteComponent: br, - append: Pl, - attr: Ze, + append: Zl, + attr: Ke, bubble: gr, create_component: wr, destroy_component: pr, - detach: $o, - element: Zl, + detach: ts, + element: Kl, init: kr, - insert: es, + insert: ns, listen: vr, mount_component: yr, safe_not_equal: Cr, set_data: Sr, - set_style: Et, + set_style: Dt, space: zr, text: qr, - toggle_class: _e, - transition_in: Mr, - transition_out: Er + toggle_class: re, + transition_in: Er, + transition_out: Mr } = window.__gradio__svelte__internal; -function Ci(l) { +function Si(l) { let e, t; return { c() { - e = Zl("span"), t = qr( + e = Kl("span"), t = qr( /*label*/ l[1] - ), Ze(e, "class", "svelte-1lrphxw"); + ), Ke(e, "class", "svelte-1lrphxw"); }, m(n, i) { - es(n, e, i), Pl(e, t); + ns(n, e, i), Zl(e, t); }, p(n, i) { i & /*label*/ @@ -686,79 +686,79 @@ function Ci(l) { ); }, d(n) { - n && $o(e); + n && ts(e); } }; } -function Ar(l) { +function Br(l) { let e, t, n, i, o, a, r, s = ( /*show_label*/ - l[2] && Ci(l) + l[2] && Si(l) ); return i = new /*Icon*/ l[0]({}), { c() { - e = Zl("button"), s && s.c(), t = zr(), n = Zl("div"), wr(i.$$.fragment), Ze(n, "class", "svelte-1lrphxw"), _e( + e = Kl("button"), s && s.c(), t = zr(), n = Kl("div"), wr(i.$$.fragment), Ke(n, "class", "svelte-1lrphxw"), re( n, "small", /*size*/ l[4] === "small" - ), _e( + ), re( n, "large", /*size*/ l[4] === "large" - ), _e( + ), re( n, "medium", /*size*/ l[4] === "medium" ), e.disabled = /*disabled*/ - l[7], Ze( + l[7], Ke( e, "aria-label", /*label*/ l[1] - ), Ze( + ), Ke( e, "aria-haspopup", /*hasPopup*/ l[8] - ), Ze( + ), Ke( e, "title", /*label*/ l[1] - ), Ze(e, "class", "svelte-1lrphxw"), _e( + ), Ke(e, "class", "svelte-1lrphxw"), re( e, "pending", /*pending*/ l[3] - ), _e( + ), re( e, "padded", /*padded*/ l[5] - ), _e( + ), re( e, "highlight", /*highlight*/ l[6] - ), _e( + ), re( e, "transparent", /*transparent*/ l[9] - ), Et(e, "color", !/*disabled*/ + ), Dt(e, "color", !/*disabled*/ l[7] && /*_color*/ l[12] ? ( /*_color*/ l[12] - ) : "var(--block-label-text-color)"), Et(e, "--bg-color", /*disabled*/ + ) : "var(--block-label-text-color)"), Dt(e, "--bg-color", /*disabled*/ l[7] ? "auto" : ( /*background*/ l[10] - )), Et( + )), Dt( e, "margin-left", /*offset*/ @@ -766,7 +766,7 @@ function Ar(l) { ); }, m(f, u) { - es(f, e, u), s && s.m(e, null), Pl(e, t), Pl(e, n), yr(i, n, null), o = !0, a || (r = vr( + ns(f, e, u), s && s.m(e, null), Zl(e, t), Zl(e, n), yr(i, n, null), o = !0, a || (r = vr( e, "click", /*click_handler*/ @@ -775,20 +775,20 @@ function Ar(l) { }, p(f, [u]) { /*show_label*/ - f[2] ? s ? s.p(f, u) : (s = Ci(f), s.c(), s.m(e, t)) : s && (s.d(1), s = null), (!o || u & /*size*/ - 16) && _e( + f[2] ? s ? s.p(f, u) : (s = Si(f), s.c(), s.m(e, t)) : s && (s.d(1), s = null), (!o || u & /*size*/ + 16) && re( n, "small", /*size*/ f[4] === "small" ), (!o || u & /*size*/ - 16) && _e( + 16) && re( n, "large", /*size*/ f[4] === "large" ), (!o || u & /*size*/ - 16) && _e( + 16) && re( n, "medium", /*size*/ @@ -796,60 +796,60 @@ function Ar(l) { ), (!o || u & /*disabled*/ 128) && (e.disabled = /*disabled*/ f[7]), (!o || u & /*label*/ - 2) && Ze( + 2) && Ke( e, "aria-label", /*label*/ f[1] ), (!o || u & /*hasPopup*/ - 256) && Ze( + 256) && Ke( e, "aria-haspopup", /*hasPopup*/ f[8] ), (!o || u & /*label*/ - 2) && Ze( + 2) && Ke( e, "title", /*label*/ f[1] ), (!o || u & /*pending*/ - 8) && _e( + 8) && re( e, "pending", /*pending*/ f[3] ), (!o || u & /*padded*/ - 32) && _e( + 32) && re( e, "padded", /*padded*/ f[5] ), (!o || u & /*highlight*/ - 64) && _e( + 64) && re( e, "highlight", /*highlight*/ f[6] ), (!o || u & /*transparent*/ - 512) && _e( + 512) && re( e, "transparent", /*transparent*/ f[9] ), u & /*disabled, _color*/ - 4224 && Et(e, "color", !/*disabled*/ + 4224 && Dt(e, "color", !/*disabled*/ f[7] && /*_color*/ f[12] ? ( /*_color*/ f[12] ) : "var(--block-label-text-color)"), u & /*disabled, background*/ - 1152 && Et(e, "--bg-color", /*disabled*/ + 1152 && Dt(e, "--bg-color", /*disabled*/ f[7] ? "auto" : ( /*background*/ f[10] )), u & /*offset*/ - 2048 && Et( + 2048 && Dt( e, "margin-left", /*offset*/ @@ -857,26 +857,26 @@ function Ar(l) { ); }, i(f) { - o || (Mr(i.$$.fragment, f), o = !0); + o || (Er(i.$$.fragment, f), o = !0); }, o(f) { - Er(i.$$.fragment, f), o = !1; + Mr(i.$$.fragment, f), o = !1; }, d(f) { - f && $o(e), s && s.d(), pr(i), a = !1, r(); + f && ts(e), s && s.d(), pr(i), a = !1, r(); } }; } -function Lr(l, e, t) { - let n, { Icon: i } = e, { label: o = "" } = e, { show_label: a = !1 } = e, { pending: r = !1 } = e, { size: s = "small" } = e, { padded: f = !0 } = e, { highlight: u = !1 } = e, { disabled: c = !1 } = e, { hasPopup: d = !1 } = e, { color: _ = "var(--block-label-text-color)" } = e, { transparent: h = !1 } = e, { background: m = "var(--background-fill-primary)" } = e, { offset: b = 0 } = e; - function g(w) { - gr.call(this, l, w); +function Ar(l, e, t) { + let n, { Icon: i } = e, { label: o = "" } = e, { show_label: a = !1 } = e, { pending: r = !1 } = e, { size: s = "small" } = e, { padded: f = !0 } = e, { highlight: u = !1 } = e, { disabled: c = !1 } = e, { hasPopup: _ = !1 } = e, { color: d = "var(--block-label-text-color)" } = e, { transparent: h = !1 } = e, { background: b = "var(--background-fill-primary)" } = e, { offset: m = 0 } = e; + function w(k) { + gr.call(this, l, k); } - return l.$$set = (w) => { - "Icon" in w && t(0, i = w.Icon), "label" in w && t(1, o = w.label), "show_label" in w && t(2, a = w.show_label), "pending" in w && t(3, r = w.pending), "size" in w && t(4, s = w.size), "padded" in w && t(5, f = w.padded), "highlight" in w && t(6, u = w.highlight), "disabled" in w && t(7, c = w.disabled), "hasPopup" in w && t(8, d = w.hasPopup), "color" in w && t(13, _ = w.color), "transparent" in w && t(9, h = w.transparent), "background" in w && t(10, m = w.background), "offset" in w && t(11, b = w.offset); + return l.$$set = (k) => { + "Icon" in k && t(0, i = k.Icon), "label" in k && t(1, o = k.label), "show_label" in k && t(2, a = k.show_label), "pending" in k && t(3, r = k.pending), "size" in k && t(4, s = k.size), "padded" in k && t(5, f = k.padded), "highlight" in k && t(6, u = k.highlight), "disabled" in k && t(7, c = k.disabled), "hasPopup" in k && t(8, _ = k.hasPopup), "color" in k && t(13, d = k.color), "transparent" in k && t(9, h = k.transparent), "background" in k && t(10, b = k.background), "offset" in k && t(11, m = k.offset); }, l.$$.update = () => { l.$$.dirty & /*highlight, color*/ - 8256 && t(12, n = u ? "var(--color-accent)" : _); + 8256 && t(12, n = u ? "var(--color-accent)" : d); }, [ i, o, @@ -886,18 +886,18 @@ function Lr(l, e, t) { f, u, c, - d, + _, h, - m, b, + m, n, - _, - g + d, + w ]; } -class il extends br { +class al extends br { constructor(e) { - super(), kr(this, e, Lr, Ar, Cr, { + super(), kr(this, e, Ar, Br, Cr, { Icon: 0, label: 1, show_label: 2, @@ -915,19 +915,19 @@ class il extends br { } } const { - SvelteComponent: Dr, - append: Tr, - attr: ml, - binding_callbacks: Br, + SvelteComponent: Lr, + append: Dr, + attr: wl, + binding_callbacks: Tr, create_slot: jr, detach: Ir, - element: Si, + element: zi, get_all_dirty_from_scope: Rr, get_slot_changes: Fr, init: Hr, insert: Ur, safe_not_equal: Nr, - toggle_class: Qe, + toggle_class: $e, transition_in: Or, transition_out: Xr, update_slot_base: Yr @@ -946,22 +946,22 @@ function Wr(l) { ); return { c() { - e = Si("div"), t = Si("div"), o && o.c(), ml(t, "class", "icon svelte-3w3rth"), ml(e, "class", "empty svelte-3w3rth"), ml(e, "aria-label", "Empty value"), Qe( + e = zi("div"), t = zi("div"), o && o.c(), wl(t, "class", "icon svelte-3w3rth"), wl(e, "class", "empty svelte-3w3rth"), wl(e, "aria-label", "Empty value"), $e( e, "small", /*size*/ l[0] === "small" - ), Qe( + ), $e( e, "large", /*size*/ l[0] === "large" - ), Qe( + ), $e( e, "unpadded_box", /*unpadded_box*/ l[1] - ), Qe( + ), $e( e, "small_parent", /*parent_height*/ @@ -969,7 +969,7 @@ function Wr(l) { ); }, m(a, r) { - Ur(a, e, r), Tr(e, t), o && o.m(t, null), l[6](e), n = !0; + Ur(a, e, r), Dr(e, t), o && o.m(t, null), l[6](e), n = !0; }, p(a, [r]) { o && o.p && (!n || r & /*$$scope*/ @@ -991,25 +991,25 @@ function Wr(l) { ), null ), (!n || r & /*size*/ - 1) && Qe( + 1) && $e( e, "small", /*size*/ a[0] === "small" ), (!n || r & /*size*/ - 1) && Qe( + 1) && $e( e, "large", /*size*/ a[0] === "large" ), (!n || r & /*unpadded_box*/ - 2) && Qe( + 2) && $e( e, "unpadded_box", /*unpadded_box*/ a[1] ), (!n || r & /*parent_height*/ - 8) && Qe( + 8) && $e( e, "small_parent", /*parent_height*/ @@ -1030,13 +1030,13 @@ function Wr(l) { function Vr(l, e, t) { let n, { $$slots: i = {}, $$scope: o } = e, { size: a = "small" } = e, { unpadded_box: r = !1 } = e, s; function f(c) { - var d; + var _; if (!c) return !1; - const { height: _ } = c.getBoundingClientRect(), { height: h } = ((d = c.parentElement) === null || d === void 0 ? void 0 : d.getBoundingClientRect()) || { height: _ }; - return _ > h + 2; + const { height: d } = c.getBoundingClientRect(), { height: h } = ((_ = c.parentElement) === null || _ === void 0 ? void 0 : _.getBoundingClientRect()) || { height: d }; + return d > h + 2; } function u(c) { - Br[c ? "unshift" : "push"](() => { + Tr[c ? "unshift" : "push"](() => { s = c, t(2, s); }); } @@ -1047,41 +1047,41 @@ function Vr(l, e, t) { 4 && t(3, n = f(s)); }, [a, r, s, n, o, i, u]; } -class Pr extends Dr { +class Pr extends Lr { constructor(e) { super(), Hr(this, e, Vr, Wr, Nr, { size: 0, unpadded_box: 1 }); } } const { SvelteComponent: Zr, - append: bl, - attr: Ae, + append: pl, + attr: De, detach: Kr, init: Gr, insert: Jr, - noop: gl, + noop: kl, safe_not_equal: Qr, - set_style: Fe, - svg_element: Cn + set_style: Ue, + svg_element: Sn } = window.__gradio__svelte__internal; function xr(l) { let e, t, n, i; return { c() { - e = Cn("svg"), t = Cn("g"), n = Cn("path"), i = Cn("path"), Ae(n, "d", "M18,6L6.087,17.913"), Fe(n, "fill", "none"), Fe(n, "fill-rule", "nonzero"), Fe(n, "stroke-width", "2px"), Ae(t, "transform", "matrix(1.14096,-0.140958,-0.140958,1.14096,-0.0559523,0.0559523)"), Ae(i, "d", "M4.364,4.364L19.636,19.636"), Fe(i, "fill", "none"), Fe(i, "fill-rule", "nonzero"), Fe(i, "stroke-width", "2px"), Ae(e, "width", "100%"), Ae(e, "height", "100%"), Ae(e, "viewBox", "0 0 24 24"), Ae(e, "version", "1.1"), Ae(e, "xmlns", "http://www.w3.org/2000/svg"), Ae(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), Ae(e, "xml:space", "preserve"), Ae(e, "stroke", "currentColor"), Fe(e, "fill-rule", "evenodd"), Fe(e, "clip-rule", "evenodd"), Fe(e, "stroke-linecap", "round"), Fe(e, "stroke-linejoin", "round"); + e = Sn("svg"), t = Sn("g"), n = Sn("path"), i = Sn("path"), De(n, "d", "M18,6L6.087,17.913"), Ue(n, "fill", "none"), Ue(n, "fill-rule", "nonzero"), Ue(n, "stroke-width", "2px"), De(t, "transform", "matrix(1.14096,-0.140958,-0.140958,1.14096,-0.0559523,0.0559523)"), De(i, "d", "M4.364,4.364L19.636,19.636"), Ue(i, "fill", "none"), Ue(i, "fill-rule", "nonzero"), Ue(i, "stroke-width", "2px"), De(e, "width", "100%"), De(e, "height", "100%"), De(e, "viewBox", "0 0 24 24"), De(e, "version", "1.1"), De(e, "xmlns", "http://www.w3.org/2000/svg"), De(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), De(e, "xml:space", "preserve"), De(e, "stroke", "currentColor"), Ue(e, "fill-rule", "evenodd"), Ue(e, "clip-rule", "evenodd"), Ue(e, "stroke-linecap", "round"), Ue(e, "stroke-linejoin", "round"); }, m(o, a) { - Jr(o, e, a), bl(e, t), bl(t, n), bl(e, i); + Jr(o, e, a), pl(e, t), pl(t, n), pl(e, i); }, - p: gl, - i: gl, - o: gl, + p: kl, + i: kl, + o: kl, d(o) { o && Kr(e); } }; } -class ui extends Zr { +class ci extends Zr { constructor(e) { super(), Gr(this, e, null, xr, Qr, {}); } @@ -1093,22 +1093,22 @@ const { detach: tf, init: nf, insert: lf, - noop: wl, + noop: vl, safe_not_equal: of, - svg_element: zi + svg_element: qi } = window.__gradio__svelte__internal; function sf(l) { let e, t; return { c() { - e = zi("svg"), t = zi("path"), Qt(t, "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"), Qt(t, "fill", "currentColor"), Qt(e, "id", "icon"), Qt(e, "xmlns", "http://www.w3.org/2000/svg"), Qt(e, "viewBox", "0 0 32 32"); + e = qi("svg"), t = qi("path"), Qt(t, "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"), Qt(t, "fill", "currentColor"), Qt(e, "id", "icon"), Qt(e, "xmlns", "http://www.w3.org/2000/svg"), Qt(e, "viewBox", "0 0 32 32"); }, m(n, i) { lf(n, e, i), ef(e, t); }, - p: wl, - i: wl, - o: wl, + p: vl, + i: vl, + o: vl, d(n) { n && tf(e); } @@ -1122,26 +1122,26 @@ class af extends $r { const { SvelteComponent: rf, append: ff, - attr: At, + attr: Tt, detach: uf, init: cf, insert: _f, - noop: pl, + noop: yl, safe_not_equal: df, - svg_element: qi + svg_element: Ei } = window.__gradio__svelte__internal; function hf(l) { let e, t; return { c() { - e = qi("svg"), t = qi("path"), At(t, "fill", "currentColor"), At(t, "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"), At(e, "xmlns", "http://www.w3.org/2000/svg"), At(e, "width", "100%"), At(e, "height", "100%"), At(e, "viewBox", "0 0 32 32"); + e = Ei("svg"), t = Ei("path"), Tt(t, "fill", "currentColor"), Tt(t, "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"), Tt(e, "xmlns", "http://www.w3.org/2000/svg"), Tt(e, "width", "100%"), Tt(e, "height", "100%"), Tt(e, "viewBox", "0 0 32 32"); }, m(n, i) { _f(n, e, i), ff(e, t); }, - p: pl, - i: pl, - o: pl, + p: yl, + i: yl, + o: yl, d(n) { n && uf(e); } @@ -1155,11 +1155,11 @@ class mf extends rf { const { SvelteComponent: bf, append: gf, - attr: Lt, + attr: jt, detach: wf, init: pf, insert: kf, - noop: kl, + noop: Cl, safe_not_equal: vf, svg_element: Mi } = window.__gradio__svelte__internal; @@ -1167,14 +1167,14 @@ function yf(l) { let e, t; return { c() { - e = Mi("svg"), t = Mi("path"), Lt(t, "d", "M5 8l4 4 4-4z"), Lt(e, "class", "dropdown-arrow svelte-145leq6"), Lt(e, "xmlns", "http://www.w3.org/2000/svg"), Lt(e, "width", "100%"), Lt(e, "height", "100%"), Lt(e, "viewBox", "0 0 18 18"); + e = Mi("svg"), t = Mi("path"), jt(t, "d", "M5 8l4 4 4-4z"), jt(e, "class", "dropdown-arrow svelte-145leq6"), jt(e, "xmlns", "http://www.w3.org/2000/svg"), jt(e, "width", "100%"), jt(e, "height", "100%"), jt(e, "viewBox", "0 0 18 18"); }, m(n, i) { kf(n, e, i), gf(e, t); }, - p: kl, - i: kl, - o: kl, + p: Cl, + i: Cl, + o: Cl, d(n) { n && wf(e); } @@ -1188,65 +1188,65 @@ class Cf extends bf { const { SvelteComponent: Sf, append: zf, - attr: Le, + attr: Te, detach: qf, - init: Mf, - insert: Ef, - noop: vl, - safe_not_equal: Af, - svg_element: Ei + init: Ef, + insert: Mf, + noop: Sl, + safe_not_equal: Bf, + svg_element: Bi } = window.__gradio__svelte__internal; -function Lf(l) { +function Af(l) { let e, t; return { c() { - e = Ei("svg"), t = Ei("path"), Le(t, "d", "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"), Le(e, "xmlns", "http://www.w3.org/2000/svg"), Le(e, "width", "100%"), Le(e, "height", "100%"), Le(e, "viewBox", "0 0 24 24"), Le(e, "fill", "none"), Le(e, "stroke", "currentColor"), Le(e, "stroke-width", "1.5"), Le(e, "stroke-linecap", "round"), Le(e, "stroke-linejoin", "round"), Le(e, "class", "feather feather-edit-2"); + e = Bi("svg"), t = Bi("path"), Te(t, "d", "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"), Te(e, "xmlns", "http://www.w3.org/2000/svg"), Te(e, "width", "100%"), Te(e, "height", "100%"), Te(e, "viewBox", "0 0 24 24"), Te(e, "fill", "none"), Te(e, "stroke", "currentColor"), Te(e, "stroke-width", "1.5"), Te(e, "stroke-linecap", "round"), Te(e, "stroke-linejoin", "round"), Te(e, "class", "feather feather-edit-2"); }, m(n, i) { - Ef(n, e, i), zf(e, t); + Mf(n, e, i), zf(e, t); }, - p: vl, - i: vl, - o: vl, + p: Sl, + i: Sl, + o: Sl, d(n) { n && qf(e); } }; } -class Df extends Sf { +class Lf extends Sf { constructor(e) { - super(), Mf(this, e, null, Lf, Af, {}); + super(), Ef(this, e, null, Af, Bf, {}); } } const { - SvelteComponent: Tf, - append: yl, + SvelteComponent: Df, + append: zl, attr: Q, - detach: Bf, + detach: Tf, init: jf, insert: If, - noop: Cl, + noop: ql, safe_not_equal: Rf, - svg_element: Sn + svg_element: zn } = window.__gradio__svelte__internal; function Ff(l) { let e, t, n, i; return { c() { - e = Sn("svg"), t = Sn("rect"), n = Sn("circle"), i = Sn("polyline"), Q(t, "x", "3"), Q(t, "y", "3"), Q(t, "width", "18"), Q(t, "height", "18"), Q(t, "rx", "2"), Q(t, "ry", "2"), Q(n, "cx", "8.5"), Q(n, "cy", "8.5"), Q(n, "r", "1.5"), Q(i, "points", "21 15 16 10 5 21"), Q(e, "xmlns", "http://www.w3.org/2000/svg"), Q(e, "width", "100%"), Q(e, "height", "100%"), Q(e, "viewBox", "0 0 24 24"), Q(e, "fill", "none"), Q(e, "stroke", "currentColor"), Q(e, "stroke-width", "1.5"), Q(e, "stroke-linecap", "round"), Q(e, "stroke-linejoin", "round"), Q(e, "class", "feather feather-image"); + e = zn("svg"), t = zn("rect"), n = zn("circle"), i = zn("polyline"), Q(t, "x", "3"), Q(t, "y", "3"), Q(t, "width", "18"), Q(t, "height", "18"), Q(t, "rx", "2"), Q(t, "ry", "2"), Q(n, "cx", "8.5"), Q(n, "cy", "8.5"), Q(n, "r", "1.5"), Q(i, "points", "21 15 16 10 5 21"), Q(e, "xmlns", "http://www.w3.org/2000/svg"), Q(e, "width", "100%"), Q(e, "height", "100%"), Q(e, "viewBox", "0 0 24 24"), Q(e, "fill", "none"), Q(e, "stroke", "currentColor"), Q(e, "stroke-width", "1.5"), Q(e, "stroke-linecap", "round"), Q(e, "stroke-linejoin", "round"), Q(e, "class", "feather feather-image"); }, m(o, a) { - If(o, e, a), yl(e, t), yl(e, n), yl(e, i); + If(o, e, a), zl(e, t), zl(e, n), zl(e, i); }, - p: Cl, - i: Cl, - o: Cl, + p: ql, + i: ql, + o: ql, d(o) { - o && Bf(e); + o && Tf(e); } }; } -let ts = class extends Tf { +let ls = class extends Df { constructor(e) { super(), jf(this, e, null, Ff, Rf, {}); } @@ -1254,11 +1254,11 @@ let ts = class extends Tf { const { SvelteComponent: Hf, append: Uf, - attr: zn, + attr: qn, detach: Nf, init: Of, insert: Xf, - noop: Sl, + noop: El, safe_not_equal: Yf, svg_element: Ai } = window.__gradio__svelte__internal; @@ -1266,32 +1266,32 @@ function Wf(l) { let e, t; return { c() { - e = Ai("svg"), t = Ai("path"), zn(t, "fill", "currentColor"), zn(t, "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.78a4 4 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-2zm2.245 2.096L16 4.25q0-.078-.005-.154M13.75 3.5h-3.5a.75.75 0 0 0 0 1.5h3.5a.75.75 0 0 0 0-1.5M15 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-3zm0 11a3 3 0 0 1-1.524-.415l3.494-3.494a.75.75 0 0 1 1.06 0l3.494 3.494A3 3 0 0 1 20 23zm5-7a1 1 0 1 1 0-2 1 1 0 0 1 0 2"), zn(e, "xmlns", "http://www.w3.org/2000/svg"), zn(e, "viewBox", "0 0 24 24"); + e = Ai("svg"), t = Ai("path"), qn(t, "fill", "currentColor"), qn(t, "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.78a4 4 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-2zm2.245 2.096L16 4.25q0-.078-.005-.154M13.75 3.5h-3.5a.75.75 0 0 0 0 1.5h3.5a.75.75 0 0 0 0-1.5M15 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-3zm0 11a3 3 0 0 1-1.524-.415l3.494-3.494a.75.75 0 0 1 1.06 0l3.494 3.494A3 3 0 0 1 20 23zm5-7a1 1 0 1 1 0-2 1 1 0 0 1 0 2"), qn(e, "xmlns", "http://www.w3.org/2000/svg"), qn(e, "viewBox", "0 0 24 24"); }, m(n, i) { Xf(n, e, i), Uf(e, t); }, - p: Sl, - i: Sl, - o: Sl, + p: El, + i: El, + o: El, d(n) { n && Nf(e); } }; } -class ns extends Hf { +class is extends Hf { constructor(e) { super(), Of(this, e, null, Wf, Yf, {}); } } const { SvelteComponent: Vf, - append: qn, + append: En, attr: x, detach: Pf, init: Zf, insert: Kf, - noop: zl, + noop: Ml, safe_not_equal: Gf, svg_element: xt } = window.__gradio__svelte__internal; @@ -1302,11 +1302,11 @@ function Jf(l) { e = xt("svg"), t = xt("path"), n = xt("path"), i = xt("line"), o = xt("line"), x(t, "d", "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"), x(n, "d", "M19 10v2a7 7 0 0 1-14 0v-2"), x(i, "x1", "12"), x(i, "y1", "19"), x(i, "x2", "12"), x(i, "y2", "23"), x(o, "x1", "8"), x(o, "y1", "23"), x(o, "x2", "16"), x(o, "y2", "23"), x(e, "xmlns", "http://www.w3.org/2000/svg"), x(e, "width", "100%"), x(e, "height", "100%"), x(e, "viewBox", "0 0 24 24"), x(e, "fill", "none"), x(e, "stroke", "currentColor"), x(e, "stroke-width", "2"), x(e, "stroke-linecap", "round"), x(e, "stroke-linejoin", "round"), x(e, "class", "feather feather-mic"); }, m(a, r) { - Kf(a, e, r), qn(e, t), qn(e, n), qn(e, i), qn(e, o); + Kf(a, e, r), En(e, t), En(e, n), En(e, i), En(e, o); }, - p: zl, - i: zl, - o: zl, + p: Ml, + i: Ml, + o: Ml, d(a) { a && Pf(e); } @@ -1319,12 +1319,12 @@ class Qf extends Vf { } const { SvelteComponent: xf, - append: ql, - attr: le, + append: Bl, + attr: ie, detach: $f, init: eu, insert: tu, - noop: Ml, + noop: Al, safe_not_equal: nu, svg_element: Mn } = window.__gradio__svelte__internal; @@ -1332,20 +1332,20 @@ function lu(l) { let e, t, n, i; return { c() { - e = Mn("svg"), t = Mn("path"), n = Mn("polyline"), i = Mn("line"), le(t, "d", "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"), le(n, "points", "17 8 12 3 7 8"), le(i, "x1", "12"), le(i, "y1", "3"), le(i, "x2", "12"), le(i, "y2", "15"), le(e, "xmlns", "http://www.w3.org/2000/svg"), le(e, "width", "90%"), le(e, "height", "90%"), le(e, "viewBox", "0 0 24 24"), le(e, "fill", "none"), le(e, "stroke", "currentColor"), le(e, "stroke-width", "2"), le(e, "stroke-linecap", "round"), le(e, "stroke-linejoin", "round"), le(e, "class", "feather feather-upload"); + e = Mn("svg"), t = Mn("path"), n = Mn("polyline"), i = Mn("line"), ie(t, "d", "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"), ie(n, "points", "17 8 12 3 7 8"), ie(i, "x1", "12"), ie(i, "y1", "3"), ie(i, "x2", "12"), ie(i, "y2", "15"), ie(e, "xmlns", "http://www.w3.org/2000/svg"), ie(e, "width", "90%"), ie(e, "height", "90%"), ie(e, "viewBox", "0 0 24 24"), ie(e, "fill", "none"), ie(e, "stroke", "currentColor"), ie(e, "stroke-width", "2"), ie(e, "stroke-linecap", "round"), ie(e, "stroke-linejoin", "round"), ie(e, "class", "feather feather-upload"); }, m(o, a) { - tu(o, e, a), ql(e, t), ql(e, n), ql(e, i); + tu(o, e, a), Bl(e, t), Bl(e, n), Bl(e, i); }, - p: Ml, - i: Ml, - o: Ml, + p: Al, + i: Al, + o: Al, d(o) { o && $f(e); } }; } -let ls = class extends xf { +let os = class extends xf { constructor(e) { super(), eu(this, e, null, lu, nu, {}); } @@ -1353,26 +1353,26 @@ let ls = class extends xf { const { SvelteComponent: iu, append: Li, - attr: xe, + attr: et, detach: ou, init: su, insert: au, - noop: El, + noop: Ll, safe_not_equal: ru, - svg_element: Al + svg_element: Dl } = window.__gradio__svelte__internal; function fu(l) { let e, t, n; return { c() { - e = Al("svg"), t = Al("path"), n = Al("path"), xe(t, "fill", "currentColor"), xe(t, "d", "M12 2c-4.963 0-9 4.038-9 9c0 3.328 1.82 6.232 4.513 7.79l-2.067 1.378A1 1 0 0 0 6 22h12a1 1 0 0 0 .555-1.832l-2.067-1.378C19.18 17.232 21 14.328 21 11c0-4.962-4.037-9-9-9zm0 16c-3.859 0-7-3.141-7-7c0-3.86 3.141-7 7-7s7 3.14 7 7c0 3.859-3.141 7-7 7z"), xe(n, "fill", "currentColor"), xe(n, "d", "M12 6c-2.757 0-5 2.243-5 5s2.243 5 5 5s5-2.243 5-5s-2.243-5-5-5zm0 8c-1.654 0-3-1.346-3-3s1.346-3 3-3s3 1.346 3 3s-1.346 3-3 3z"), xe(e, "xmlns", "http://www.w3.org/2000/svg"), xe(e, "width", "100%"), xe(e, "height", "100%"), xe(e, "viewBox", "0 0 24 24"); + e = Dl("svg"), t = Dl("path"), n = Dl("path"), et(t, "fill", "currentColor"), et(t, "d", "M12 2c-4.963 0-9 4.038-9 9c0 3.328 1.82 6.232 4.513 7.79l-2.067 1.378A1 1 0 0 0 6 22h12a1 1 0 0 0 .555-1.832l-2.067-1.378C19.18 17.232 21 14.328 21 11c0-4.962-4.037-9-9-9zm0 16c-3.859 0-7-3.141-7-7c0-3.86 3.141-7 7-7s7 3.14 7 7c0 3.859-3.141 7-7 7z"), et(n, "fill", "currentColor"), et(n, "d", "M12 6c-2.757 0-5 2.243-5 5s2.243 5 5 5s5-2.243 5-5s-2.243-5-5-5zm0 8c-1.654 0-3-1.346-3-3s1.346-3 3-3s3 1.346 3 3s-1.346 3-3 3z"), et(e, "xmlns", "http://www.w3.org/2000/svg"), et(e, "width", "100%"), et(e, "height", "100%"), et(e, "viewBox", "0 0 24 24"); }, m(i, o) { au(i, e, o), Li(e, t), Li(e, n); }, - p: El, - i: El, - o: El, + p: Ll, + i: Ll, + o: Ll, d(i) { i && ou(e); } @@ -1697,7 +1697,7 @@ cu.reduce( }), {} ); -class On extends Error { +class Xn extends Error { constructor(e) { super(e), this.name = "ShareError"; } @@ -1705,7 +1705,7 @@ class On extends Error { async function _u(l, e) { var s; if (window.__gradio_space__ == null) - throw new On("Must be on Spaces to share."); + throw new Xn("Must be on Spaces to share."); let t, n, i; t = du(l), n = l.split(";")[0].split(":")[1], i = "file" + n.split("/")[1]; const o = new File([t], i, { type: n }), a = await fetch("https://huggingface.co/uploads", { @@ -1719,9 +1719,9 @@ async function _u(l, e) { if (!a.ok) { if ((s = a.headers.get("content-type")) != null && s.includes("application/json")) { const f = await a.json(); - throw new On(`Upload failed: ${f.error}`); + throw new Xn(`Upload failed: ${f.error}`); } - throw new On("Upload failed."); + throw new Xn("Upload failed."); } return await a.text(); } @@ -1742,7 +1742,7 @@ const { } = window.__gradio__svelte__internal, { createEventDispatcher: yu } = window.__gradio__svelte__internal; function Cu(l) { let e, t; - return e = new il({ + return e = new al({ props: { Icon: af, label: ( @@ -1794,7 +1794,7 @@ function Su(l, e, t) { n("share", { description: f }); } catch (f) { console.error(f); - let u = f instanceof On ? f.message : "Share failed."; + let u = f instanceof Xn ? f.message : "Share failed."; n("error", u); } finally { t(3, r = !1); @@ -1811,66 +1811,66 @@ class zu extends hu { } const { SvelteComponent: qu, - append: bt, - attr: Kl, - check_outros: Mu, - create_component: is, - destroy_component: os, - detach: Xn, - element: Gl, - group_outros: Eu, - init: Au, - insert: Yn, - mount_component: ss, - safe_not_equal: Lu, - set_data: Jl, - space: Ql, + append: kt, + attr: Gl, + check_outros: Eu, + create_component: ss, + destroy_component: as, + detach: Yn, + element: Jl, + group_outros: Mu, + init: Bu, + insert: Wn, + mount_component: rs, + safe_not_equal: Au, + set_data: Ql, + space: xl, text: ln, toggle_class: Ti, - transition_in: Pn, - transition_out: Zn + transition_in: Gn, + transition_out: Jn } = window.__gradio__svelte__internal; -function Du(l) { +function Lu(l) { let e, t; - return e = new ls({}), { + return e = new os({}), { c() { - is(e.$$.fragment); + ss(e.$$.fragment); }, m(n, i) { - ss(e, n, i), t = !0; + rs(e, n, i), t = !0; }, i(n) { - t || (Pn(e.$$.fragment, n), t = !0); + t || (Gn(e.$$.fragment, n), t = !0); }, o(n) { - Zn(e.$$.fragment, n), t = !1; + Jn(e.$$.fragment, n), t = !1; }, d(n) { - os(e, n); + as(e, n); } }; } -function Tu(l) { +function Du(l) { let e, t; - return e = new ns({}), { + return e = new is({}), { c() { - is(e.$$.fragment); + ss(e.$$.fragment); }, m(n, i) { - ss(e, n, i), t = !0; + rs(e, n, i), t = !0; }, i(n) { - t || (Pn(e.$$.fragment, n), t = !0); + t || (Gn(e.$$.fragment, n), t = !0); }, o(n) { - Zn(e.$$.fragment, n), t = !1; + Jn(e.$$.fragment, n), t = !1; }, d(n) { - os(e, n); + as(e, n); } }; } -function Bi(l) { +function ji(l) { let e, t, n = ( /*i18n*/ l[1]("common.or") + "" @@ -1881,25 +1881,25 @@ function Bi(l) { ), s; return { c() { - e = Gl("span"), t = ln("- "), i = ln(n), o = ln(" -"), a = Ql(), s = ln(r), Kl(e, "class", "or svelte-kzcjhc"); + e = Jl("span"), t = ln("- "), i = ln(n), o = ln(" -"), a = xl(), s = ln(r), Gl(e, "class", "or svelte-kzcjhc"); }, m(f, u) { - Yn(f, e, u), bt(e, t), bt(e, i), bt(e, o), Yn(f, a, u), Yn(f, s, u); + Wn(f, e, u), kt(e, t), kt(e, i), kt(e, o), Wn(f, a, u), Wn(f, s, u); }, p(f, u) { u & /*i18n*/ 2 && n !== (n = /*i18n*/ - f[1]("common.or") + "") && Jl(i, n), u & /*message, i18n*/ + f[1]("common.or") + "") && Ql(i, n), u & /*message, i18n*/ 6 && r !== (r = /*message*/ (f[2] || /*i18n*/ - f[1]("upload_text.click_to_upload")) + "") && Jl(s, r); + f[1]("upload_text.click_to_upload")) + "") && Ql(s, r); }, d(f) { - f && (Xn(e), Xn(a), Xn(s)); + f && (Yn(e), Yn(a), Yn(s)); } }; } -function Bu(l) { +function Tu(l) { let e, t, n, i, o, a = ( /*i18n*/ l[1]( @@ -1911,41 +1911,41 @@ function Bu(l) { l[5].file ) + "" ), r, s, f; - const u = [Tu, Du], c = []; - function d(h, m) { + const u = [Du, Lu], c = []; + function _(h, b) { return ( /*type*/ h[0] === "clipboard" ? 0 : 1 ); } - n = d(l), i = c[n] = u[n](l); - let _ = ( + n = _(l), i = c[n] = u[n](l); + let d = ( /*mode*/ - l[3] !== "short" && Bi(l) + l[3] !== "short" && ji(l) ); return { c() { - e = Gl("div"), t = Gl("span"), i.c(), o = Ql(), r = ln(a), s = Ql(), _ && _.c(), Kl(t, "class", "icon-wrap svelte-kzcjhc"), Ti( + e = Jl("div"), t = Jl("span"), i.c(), o = xl(), r = ln(a), s = xl(), d && d.c(), Gl(t, "class", "icon-wrap svelte-kzcjhc"), Ti( t, "hovered", /*hovered*/ l[4] - ), Kl(e, "class", "wrap svelte-kzcjhc"); + ), Gl(e, "class", "wrap svelte-kzcjhc"); }, - m(h, m) { - Yn(h, e, m), bt(e, t), c[n].m(t, null), bt(e, o), bt(e, r), bt(e, s), _ && _.m(e, null), f = !0; + m(h, b) { + Wn(h, e, b), kt(e, t), c[n].m(t, null), kt(e, o), kt(e, r), kt(e, s), d && d.m(e, null), f = !0; }, - p(h, [m]) { - let b = n; - n = d(h), n !== b && (Eu(), Zn(c[b], 1, 1, () => { - c[b] = null; - }), Mu(), i = c[n], i || (i = c[n] = u[n](h), i.c()), Pn(i, 1), i.m(t, null)), (!f || m & /*hovered*/ + p(h, [b]) { + let m = n; + n = _(h), n !== m && (Mu(), Jn(c[m], 1, 1, () => { + c[m] = null; + }), Eu(), i = c[n], i || (i = c[n] = u[n](h), i.c()), Gn(i, 1), i.m(t, null)), (!f || b & /*hovered*/ 16) && Ti( t, "hovered", /*hovered*/ h[4] - ), (!f || m & /*i18n, type*/ + ), (!f || b & /*i18n, type*/ 3) && a !== (a = /*i18n*/ h[1]( /*defs*/ @@ -1954,17 +1954,17 @@ function Bu(l) { h[0] ] || /*defs*/ h[5].file - ) + "") && Jl(r, a), /*mode*/ - h[3] !== "short" ? _ ? _.p(h, m) : (_ = Bi(h), _.c(), _.m(e, null)) : _ && (_.d(1), _ = null); + ) + "") && Ql(r, a), /*mode*/ + h[3] !== "short" ? d ? d.p(h, b) : (d = ji(h), d.c(), d.m(e, null)) : d && (d.d(1), d = null); }, i(h) { - f || (Pn(i), f = !0); + f || (Gn(i), f = !0); }, o(h) { - Zn(i), f = !1; + Jn(i), f = !1; }, d(h) { - h && Xn(e), c[n].d(), _ && _.d(); + h && Yn(e), c[n].d(), d && d.d(); } }; } @@ -1983,9 +1983,9 @@ function ju(l, e, t) { "type" in f && t(0, n = f.type), "i18n" in f && t(1, i = f.i18n), "message" in f && t(2, o = f.message), "mode" in f && t(3, a = f.mode), "hovered" in f && t(4, r = f.hovered); }, [n, i, o, a, r, s]; } -class as extends qu { +class fs extends qu { constructor(e) { - super(), Au(this, e, ju, Bu, Lu, { + super(), Bu(this, e, ju, Tu, Au, { type: 0, i18n: 1, message: 2, @@ -1996,26 +1996,26 @@ class as extends qu { } const { SvelteComponent: Iu, - append: Ll, - attr: Xe, + append: Tl, + attr: We, check_outros: on, - create_component: ol, - destroy_component: sl, - detach: Zt, - element: pn, + create_component: rl, + destroy_component: fl, + detach: Kt, + element: kn, empty: Ru, group_outros: sn, init: Fu, - insert: Kt, - listen: al, - mount_component: rl, + insert: Gt, + listen: ul, + mount_component: cl, safe_not_equal: Hu, - space: Dl, - toggle_class: ot, - transition_in: te, - transition_out: me + space: jl, + toggle_class: at, + transition_in: $, + transition_out: ue } = window.__gradio__svelte__internal; -function ji(l) { +function Ii(l) { let e, t = ( /*sources*/ l[1].includes("upload") @@ -2028,53 +2028,53 @@ function ji(l) { ), r, s = ( /*sources*/ l[1].includes("clipboard") - ), f, u = t && Ii(l), c = i && Ri(l), d = a && Fi(l), _ = s && Hi(l); + ), f, u = t && Ri(l), c = i && Fi(l), _ = a && Hi(l), d = s && Ui(l); return { c() { - e = pn("span"), u && u.c(), n = Dl(), c && c.c(), o = Dl(), d && d.c(), r = Dl(), _ && _.c(), Xe(e, "class", "source-selection svelte-1jp3vgd"), Xe(e, "data-testid", "source-select"); + e = kn("span"), u && u.c(), n = jl(), c && c.c(), o = jl(), _ && _.c(), r = jl(), d && d.c(), We(e, "class", "source-selection svelte-1jp3vgd"), We(e, "data-testid", "source-select"); }, - m(h, m) { - Kt(h, e, m), u && u.m(e, null), Ll(e, n), c && c.m(e, null), Ll(e, o), d && d.m(e, null), Ll(e, r), _ && _.m(e, null), f = !0; + m(h, b) { + Gt(h, e, b), u && u.m(e, null), Tl(e, n), c && c.m(e, null), Tl(e, o), _ && _.m(e, null), Tl(e, r), d && d.m(e, null), f = !0; }, - p(h, m) { - m & /*sources*/ + p(h, b) { + b & /*sources*/ 2 && (t = /*sources*/ - h[1].includes("upload")), t ? u ? (u.p(h, m), m & /*sources*/ - 2 && te(u, 1)) : (u = Ii(h), u.c(), te(u, 1), u.m(e, n)) : u && (sn(), me(u, 1, 1, () => { + h[1].includes("upload")), t ? u ? (u.p(h, b), b & /*sources*/ + 2 && $(u, 1)) : (u = Ri(h), u.c(), $(u, 1), u.m(e, n)) : u && (sn(), ue(u, 1, 1, () => { u = null; - }), on()), m & /*sources*/ + }), on()), b & /*sources*/ 2 && (i = /*sources*/ - h[1].includes("microphone")), i ? c ? (c.p(h, m), m & /*sources*/ - 2 && te(c, 1)) : (c = Ri(h), c.c(), te(c, 1), c.m(e, o)) : c && (sn(), me(c, 1, 1, () => { + h[1].includes("microphone")), i ? c ? (c.p(h, b), b & /*sources*/ + 2 && $(c, 1)) : (c = Fi(h), c.c(), $(c, 1), c.m(e, o)) : c && (sn(), ue(c, 1, 1, () => { c = null; - }), on()), m & /*sources*/ + }), on()), b & /*sources*/ 2 && (a = /*sources*/ - h[1].includes("webcam")), a ? d ? (d.p(h, m), m & /*sources*/ - 2 && te(d, 1)) : (d = Fi(h), d.c(), te(d, 1), d.m(e, r)) : d && (sn(), me(d, 1, 1, () => { - d = null; - }), on()), m & /*sources*/ - 2 && (s = /*sources*/ - h[1].includes("clipboard")), s ? _ ? (_.p(h, m), m & /*sources*/ - 2 && te(_, 1)) : (_ = Hi(h), _.c(), te(_, 1), _.m(e, null)) : _ && (sn(), me(_, 1, 1, () => { + h[1].includes("webcam")), a ? _ ? (_.p(h, b), b & /*sources*/ + 2 && $(_, 1)) : (_ = Hi(h), _.c(), $(_, 1), _.m(e, r)) : _ && (sn(), ue(_, 1, 1, () => { _ = null; + }), on()), b & /*sources*/ + 2 && (s = /*sources*/ + h[1].includes("clipboard")), s ? d ? (d.p(h, b), b & /*sources*/ + 2 && $(d, 1)) : (d = Ui(h), d.c(), $(d, 1), d.m(e, null)) : d && (sn(), ue(d, 1, 1, () => { + d = null; }), on()); }, i(h) { - f || (te(u), te(c), te(d), te(_), f = !0); + f || ($(u), $(c), $(_), $(d), f = !0); }, o(h) { - me(u), me(c), me(d), me(_), f = !1; + ue(u), ue(c), ue(_), ue(d), f = !1; }, d(h) { - h && Zt(e), u && u.d(), c && c.d(), d && d.d(), _ && _.d(); + h && Kt(e), u && u.d(), c && c.d(), _ && _.d(), d && d.d(); } }; } -function Ii(l) { +function Ri(l) { let e, t, n, i, o; - return t = new ls({}), { + return t = new os({}), { c() { - e = pn("button"), ol(t.$$.fragment), Xe(e, "class", "icon svelte-1jp3vgd"), Xe(e, "aria-label", "Upload file"), ot( + e = kn("button"), rl(t.$$.fragment), We(e, "class", "icon svelte-1jp3vgd"), We(e, "aria-label", "Upload file"), at( e, "selected", /*active_source*/ @@ -2083,7 +2083,7 @@ function Ii(l) { ); }, m(a, r) { - Kt(a, e, r), rl(t, e, null), n = !0, i || (o = al( + Gt(a, e, r), cl(t, e, null), n = !0, i || (o = ul( e, "click", /*click_handler*/ @@ -2092,7 +2092,7 @@ function Ii(l) { }, p(a, r) { (!n || r & /*active_source*/ - 1) && ot( + 1) && at( e, "selected", /*active_source*/ @@ -2101,21 +2101,21 @@ function Ii(l) { ); }, i(a) { - n || (te(t.$$.fragment, a), n = !0); + n || ($(t.$$.fragment, a), n = !0); }, o(a) { - me(t.$$.fragment, a), n = !1; + ue(t.$$.fragment, a), n = !1; }, d(a) { - a && Zt(e), sl(t), i = !1, o(); + a && Kt(e), fl(t), i = !1, o(); } }; } -function Ri(l) { +function Fi(l) { let e, t, n, i, o; return t = new Qf({}), { c() { - e = pn("button"), ol(t.$$.fragment), Xe(e, "class", "icon svelte-1jp3vgd"), Xe(e, "aria-label", "Record audio"), ot( + e = kn("button"), rl(t.$$.fragment), We(e, "class", "icon svelte-1jp3vgd"), We(e, "aria-label", "Record audio"), at( e, "selected", /*active_source*/ @@ -2123,7 +2123,7 @@ function Ri(l) { ); }, m(a, r) { - Kt(a, e, r), rl(t, e, null), n = !0, i || (o = al( + Gt(a, e, r), cl(t, e, null), n = !0, i || (o = ul( e, "click", /*click_handler_1*/ @@ -2132,7 +2132,7 @@ function Ri(l) { }, p(a, r) { (!n || r & /*active_source*/ - 1) && ot( + 1) && at( e, "selected", /*active_source*/ @@ -2140,21 +2140,21 @@ function Ri(l) { ); }, i(a) { - n || (te(t.$$.fragment, a), n = !0); + n || ($(t.$$.fragment, a), n = !0); }, o(a) { - me(t.$$.fragment, a), n = !1; + ue(t.$$.fragment, a), n = !1; }, d(a) { - a && Zt(e), sl(t), i = !1, o(); + a && Kt(e), fl(t), i = !1, o(); } }; } -function Fi(l) { +function Hi(l) { let e, t, n, i, o; return t = new uu({}), { c() { - e = pn("button"), ol(t.$$.fragment), Xe(e, "class", "icon svelte-1jp3vgd"), Xe(e, "aria-label", "Capture from camera"), ot( + e = kn("button"), rl(t.$$.fragment), We(e, "class", "icon svelte-1jp3vgd"), We(e, "aria-label", "Capture from camera"), at( e, "selected", /*active_source*/ @@ -2162,7 +2162,7 @@ function Fi(l) { ); }, m(a, r) { - Kt(a, e, r), rl(t, e, null), n = !0, i || (o = al( + Gt(a, e, r), cl(t, e, null), n = !0, i || (o = ul( e, "click", /*click_handler_2*/ @@ -2171,7 +2171,7 @@ function Fi(l) { }, p(a, r) { (!n || r & /*active_source*/ - 1) && ot( + 1) && at( e, "selected", /*active_source*/ @@ -2179,21 +2179,21 @@ function Fi(l) { ); }, i(a) { - n || (te(t.$$.fragment, a), n = !0); + n || ($(t.$$.fragment, a), n = !0); }, o(a) { - me(t.$$.fragment, a), n = !1; + ue(t.$$.fragment, a), n = !1; }, d(a) { - a && Zt(e), sl(t), i = !1, o(); + a && Kt(e), fl(t), i = !1, o(); } }; } -function Hi(l) { +function Ui(l) { let e, t, n, i, o; - return t = new ns({}), { + return t = new is({}), { c() { - e = pn("button"), ol(t.$$.fragment), Xe(e, "class", "icon svelte-1jp3vgd"), Xe(e, "aria-label", "Paste from clipboard"), ot( + e = kn("button"), rl(t.$$.fragment), We(e, "class", "icon svelte-1jp3vgd"), We(e, "aria-label", "Paste from clipboard"), at( e, "selected", /*active_source*/ @@ -2201,7 +2201,7 @@ function Hi(l) { ); }, m(a, r) { - Kt(a, e, r), rl(t, e, null), n = !0, i || (o = al( + Gt(a, e, r), cl(t, e, null), n = !0, i || (o = ul( e, "click", /*click_handler_3*/ @@ -2210,7 +2210,7 @@ function Hi(l) { }, p(a, r) { (!n || r & /*active_source*/ - 1) && ot( + 1) && at( e, "selected", /*active_source*/ @@ -2218,73 +2218,73 @@ function Hi(l) { ); }, i(a) { - n || (te(t.$$.fragment, a), n = !0); + n || ($(t.$$.fragment, a), n = !0); }, o(a) { - me(t.$$.fragment, a), n = !1; + ue(t.$$.fragment, a), n = !1; }, d(a) { - a && Zt(e), sl(t), i = !1, o(); + a && Kt(e), fl(t), i = !1, o(); } }; } function Uu(l) { let e, t, n = ( /*unique_sources*/ - l[2].length > 1 && ji(l) + l[2].length > 1 && Ii(l) ); return { c() { n && n.c(), e = Ru(); }, m(i, o) { - n && n.m(i, o), Kt(i, e, o), t = !0; + n && n.m(i, o), Gt(i, e, o), t = !0; }, p(i, [o]) { /*unique_sources*/ i[2].length > 1 ? n ? (n.p(i, o), o & /*unique_sources*/ - 4 && te(n, 1)) : (n = ji(i), n.c(), te(n, 1), n.m(e.parentNode, e)) : n && (sn(), me(n, 1, 1, () => { + 4 && $(n, 1)) : (n = Ii(i), n.c(), $(n, 1), n.m(e.parentNode, e)) : n && (sn(), ue(n, 1, 1, () => { n = null; }), on()); }, i(i) { - t || (te(n), t = !0); + t || ($(n), t = !0); }, o(i) { - me(n), t = !1; + ue(n), t = !1; }, d(i) { - i && Zt(e), n && n.d(i); + i && Kt(e), n && n.d(i); } }; } function Nu(l, e, t) { let n; - var i = this && this.__awaiter || function(h, m, b, g) { - function w(p) { - return p instanceof b ? p : new b(function(C) { - C(p); + var i = this && this.__awaiter || function(h, b, m, w) { + function k(g) { + return g instanceof m ? g : new m(function(S) { + S(g); }); } - return new (b || (b = Promise))(function(p, C) { - function E(k) { + return new (m || (m = Promise))(function(g, S) { + function M(v) { try { - z(g.next(k)); + z(w.next(v)); } catch (q) { - C(q); + S(q); } } - function v(k) { + function y(v) { try { - z(g.throw(k)); + z(w.throw(v)); } catch (q) { - C(q); + S(q); } } - function z(k) { - k.done ? p(k.value) : w(k.value).then(E, v); + function z(v) { + v.done ? g(v.value) : k(v.value).then(M, y); } - z((g = g.apply(h, m || [])).next()); + z((w = w.apply(h, b || [])).next()); }); }; let { sources: o } = e, { active_source: a } = e, { handle_clear: r = () => { @@ -2295,7 +2295,7 @@ function Nu(l, e, t) { r(), t(0, a = h), s(h); }); } - const u = () => f("upload"), c = () => f("microphone"), d = () => f("webcam"), _ = () => f("clipboard"); + const u = () => f("upload"), c = () => f("microphone"), _ = () => f("webcam"), d = () => f("clipboard"); return l.$$set = (h) => { "sources" in h && t(1, o = h.sources), "active_source" in h && t(0, a = h.active_source), "handle_clear" in h && t(4, r = h.handle_clear), "handle_select" in h && t(5, s = h.handle_select); }, l.$$.update = () => { @@ -2310,8 +2310,8 @@ function Nu(l, e, t) { s, u, c, - d, - _ + _, + d ]; } class Ou extends Iu { @@ -2324,19 +2324,19 @@ class Ou extends Iu { }); } } -function Xt(l) { +function Yt(l) { let e = ["", "k", "M", "G", "T", "P", "E", "Z"], t = 0; for (; l > 1e3 && t < e.length - 1; ) l /= 1e3, t++; let n = e[t]; return (Number.isInteger(l) ? l : l.toFixed(1)) + n; } -function Wn() { +function Vn() { } function Xu(l, e) { return l != l ? e == e : l !== e || l && typeof l == "object" || typeof l == "function"; } -function Ui(l) { +function Ni(l) { const e = typeof l == "string" && l.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/); return e ? [parseFloat(e[1]), e[2] || "px"] : [ /** @type {number} */ @@ -2344,17 +2344,17 @@ function Ui(l) { "px" ]; } -const rs = typeof window < "u"; -let Ni = rs ? () => window.performance.now() : () => Date.now(), fs = rs ? (l) => requestAnimationFrame(l) : Wn; +const us = typeof window < "u"; +let Oi = us ? () => window.performance.now() : () => Date.now(), cs = us ? (l) => requestAnimationFrame(l) : Vn; const Pt = /* @__PURE__ */ new Set(); -function us(l) { +function _s(l) { Pt.forEach((e) => { e.c(l) || (Pt.delete(e), e.f()); - }), Pt.size !== 0 && fs(us); + }), Pt.size !== 0 && cs(_s); } function Yu(l) { let e; - return Pt.size === 0 && fs(us), { + return Pt.size === 0 && cs(_s), { promise: new Promise((t) => { Pt.add(e = { c: l, f: t }); }), @@ -2367,187 +2367,187 @@ function Wu(l) { const e = l - 1; return e * e * e + 1; } -function Oi(l, { delay: e = 0, duration: t = 400, easing: n = Wu, x: i = 0, y: o = 0, opacity: a = 0 } = {}) { - const r = getComputedStyle(l), s = +r.opacity, f = r.transform === "none" ? "" : r.transform, u = s * (1 - a), [c, d] = Ui(i), [_, h] = Ui(o); +function Xi(l, { delay: e = 0, duration: t = 400, easing: n = Wu, x: i = 0, y: o = 0, opacity: a = 0 } = {}) { + const r = getComputedStyle(l), s = +r.opacity, f = r.transform === "none" ? "" : r.transform, u = s * (1 - a), [c, _] = Ni(i), [d, h] = Ni(o); return { delay: e, duration: t, easing: n, - css: (m, b) => ` - transform: ${f} translate(${(1 - m) * c}${d}, ${(1 - m) * _}${h}); - opacity: ${s - u * b}` + css: (b, m) => ` + transform: ${f} translate(${(1 - b) * c}${_}, ${(1 - b) * d}${h}); + opacity: ${s - u * m}` }; } -const Dt = []; -function Vu(l, e = Wn) { +const It = []; +function Vu(l, e = Vn) { let t; const n = /* @__PURE__ */ new Set(); function i(r) { if (Xu(l, r) && (l = r, t)) { - const s = !Dt.length; + const s = !It.length; for (const f of n) - f[1](), Dt.push(f, l); + f[1](), It.push(f, l); if (s) { - for (let f = 0; f < Dt.length; f += 2) - Dt[f][0](Dt[f + 1]); - Dt.length = 0; + for (let f = 0; f < It.length; f += 2) + It[f][0](It[f + 1]); + It.length = 0; } } } function o(r) { i(r(l)); } - function a(r, s = Wn) { + function a(r, s = Vn) { const f = [r, s]; - return n.add(f), n.size === 1 && (t = e(i, o) || Wn), r(l), () => { + return n.add(f), n.size === 1 && (t = e(i, o) || Vn), r(l), () => { n.delete(f), n.size === 0 && t && (t(), t = null); }; } return { set: i, update: o, subscribe: a }; } -function Xi(l) { +function Yi(l) { return Object.prototype.toString.call(l) === "[object Date]"; } -function xl(l, e, t, n) { - if (typeof t == "number" || Xi(t)) { +function $l(l, e, t, n) { + if (typeof t == "number" || Yi(t)) { const i = n - t, o = (t - e) / (l.dt || 1 / 60), a = l.opts.stiffness * i, r = l.opts.damping * o, s = (a - r) * l.inv_mass, f = (o + s) * l.dt; - return Math.abs(f) < l.opts.precision && Math.abs(i) < l.opts.precision ? n : (l.settled = !1, Xi(t) ? new Date(t.getTime() + f) : t + f); + return Math.abs(f) < l.opts.precision && Math.abs(i) < l.opts.precision ? n : (l.settled = !1, Yi(t) ? new Date(t.getTime() + f) : t + f); } else { if (Array.isArray(t)) return t.map( - (i, o) => xl(l, e[o], t[o], n[o]) + (i, o) => $l(l, e[o], t[o], n[o]) ); if (typeof t == "object") { const i = {}; for (const o in t) - i[o] = xl(l, e[o], t[o], n[o]); + i[o] = $l(l, e[o], t[o], n[o]); return i; } else throw new Error(`Cannot spring ${typeof t} values`); } } -function Yi(l, e = {}) { +function Wi(l, e = {}) { const t = Vu(l), { stiffness: n = 0.15, damping: i = 0.8, precision: o = 0.01 } = e; - let a, r, s, f = l, u = l, c = 1, d = 0, _ = !1; - function h(b, g = {}) { - u = b; - const w = s = {}; - return l == null || g.hard || m.stiffness >= 1 && m.damping >= 1 ? (_ = !0, a = Ni(), f = b, t.set(l = u), Promise.resolve()) : (g.soft && (d = 1 / ((g.soft === !0 ? 0.5 : +g.soft) * 60), c = 0), r || (a = Ni(), _ = !1, r = Yu((p) => { - if (_) - return _ = !1, r = null, !1; - c = Math.min(c + d, 1); - const C = { + let a, r, s, f = l, u = l, c = 1, _ = 0, d = !1; + function h(m, w = {}) { + u = m; + const k = s = {}; + return l == null || w.hard || b.stiffness >= 1 && b.damping >= 1 ? (d = !0, a = Oi(), f = m, t.set(l = u), Promise.resolve()) : (w.soft && (_ = 1 / ((w.soft === !0 ? 0.5 : +w.soft) * 60), c = 0), r || (a = Oi(), d = !1, r = Yu((g) => { + if (d) + return d = !1, r = null, !1; + c = Math.min(c + _, 1); + const S = { inv_mass: c, - opts: m, + opts: b, settled: !0, - dt: (p - a) * 60 / 1e3 - }, E = xl(C, f, l, u); - return a = p, f = l, t.set(l = E), C.settled && (r = null), !C.settled; - })), new Promise((p) => { + dt: (g - a) * 60 / 1e3 + }, M = $l(S, f, l, u); + return a = g, f = l, t.set(l = M), S.settled && (r = null), !S.settled; + })), new Promise((g) => { r.promise.then(() => { - w === s && p(); + k === s && g(); }); })); } - const m = { + const b = { set: h, - update: (b, g) => h(b(u, l), g), + update: (m, w) => h(m(u, l), w), subscribe: t.subscribe, stiffness: n, damping: i, precision: o }; - return m; + return b; } const { SvelteComponent: Pu, - append: De, + append: je, attr: U, - component_subscribe: Wi, + component_subscribe: Vi, detach: Zu, element: Ku, init: Gu, insert: Ju, - noop: Vi, + noop: Pi, safe_not_equal: Qu, - set_style: En, - svg_element: Te, - toggle_class: Pi + set_style: Bn, + svg_element: Ie, + toggle_class: Zi } = window.__gradio__svelte__internal, { onMount: xu } = window.__gradio__svelte__internal; function $u(l) { - let e, t, n, i, o, a, r, s, f, u, c, d; + let e, t, n, i, o, a, r, s, f, u, c, _; return { c() { - e = Ku("div"), t = Te("svg"), n = Te("g"), i = Te("path"), o = Te("path"), a = Te("path"), r = Te("path"), s = Te("g"), f = Te("path"), u = Te("path"), c = Te("path"), d = Te("path"), U(i, "d", "M255.926 0.754768L509.702 139.936V221.027L255.926 81.8465V0.754768Z"), U(i, "fill", "#FF7C00"), U(i, "fill-opacity", "0.4"), U(i, "class", "svelte-43sxxs"), U(o, "d", "M509.69 139.936L254.981 279.641V361.255L509.69 221.55V139.936Z"), U(o, "fill", "#FF7C00"), U(o, "class", "svelte-43sxxs"), U(a, "d", "M0.250138 139.937L254.981 279.641V361.255L0.250138 221.55V139.937Z"), U(a, "fill", "#FF7C00"), U(a, "fill-opacity", "0.4"), U(a, "class", "svelte-43sxxs"), U(r, "d", "M255.923 0.232622L0.236328 139.936V221.55L255.923 81.8469V0.232622Z"), U(r, "fill", "#FF7C00"), U(r, "class", "svelte-43sxxs"), En(n, "transform", "translate(" + /*$top*/ + e = Ku("div"), t = Ie("svg"), n = Ie("g"), i = Ie("path"), o = Ie("path"), a = Ie("path"), r = Ie("path"), s = Ie("g"), f = Ie("path"), u = Ie("path"), c = Ie("path"), _ = Ie("path"), U(i, "d", "M255.926 0.754768L509.702 139.936V221.027L255.926 81.8465V0.754768Z"), U(i, "fill", "#FF7C00"), U(i, "fill-opacity", "0.4"), U(i, "class", "svelte-43sxxs"), U(o, "d", "M509.69 139.936L254.981 279.641V361.255L509.69 221.55V139.936Z"), U(o, "fill", "#FF7C00"), U(o, "class", "svelte-43sxxs"), U(a, "d", "M0.250138 139.937L254.981 279.641V361.255L0.250138 221.55V139.937Z"), U(a, "fill", "#FF7C00"), U(a, "fill-opacity", "0.4"), U(a, "class", "svelte-43sxxs"), U(r, "d", "M255.923 0.232622L0.236328 139.936V221.55L255.923 81.8469V0.232622Z"), U(r, "fill", "#FF7C00"), U(r, "class", "svelte-43sxxs"), Bn(n, "transform", "translate(" + /*$top*/ l[1][0] + "px, " + /*$top*/ - l[1][1] + "px)"), U(f, "d", "M255.926 141.5L509.702 280.681V361.773L255.926 222.592V141.5Z"), U(f, "fill", "#FF7C00"), U(f, "fill-opacity", "0.4"), U(f, "class", "svelte-43sxxs"), U(u, "d", "M509.69 280.679L254.981 420.384V501.998L509.69 362.293V280.679Z"), U(u, "fill", "#FF7C00"), U(u, "class", "svelte-43sxxs"), U(c, "d", "M0.250138 280.681L254.981 420.386V502L0.250138 362.295V280.681Z"), U(c, "fill", "#FF7C00"), U(c, "fill-opacity", "0.4"), U(c, "class", "svelte-43sxxs"), U(d, "d", "M255.923 140.977L0.236328 280.68V362.294L255.923 222.591V140.977Z"), U(d, "fill", "#FF7C00"), U(d, "class", "svelte-43sxxs"), En(s, "transform", "translate(" + /*$bottom*/ + l[1][1] + "px)"), U(f, "d", "M255.926 141.5L509.702 280.681V361.773L255.926 222.592V141.5Z"), U(f, "fill", "#FF7C00"), U(f, "fill-opacity", "0.4"), U(f, "class", "svelte-43sxxs"), U(u, "d", "M509.69 280.679L254.981 420.384V501.998L509.69 362.293V280.679Z"), U(u, "fill", "#FF7C00"), U(u, "class", "svelte-43sxxs"), U(c, "d", "M0.250138 280.681L254.981 420.386V502L0.250138 362.295V280.681Z"), U(c, "fill", "#FF7C00"), U(c, "fill-opacity", "0.4"), U(c, "class", "svelte-43sxxs"), U(_, "d", "M255.923 140.977L0.236328 280.68V362.294L255.923 222.591V140.977Z"), U(_, "fill", "#FF7C00"), U(_, "class", "svelte-43sxxs"), Bn(s, "transform", "translate(" + /*$bottom*/ l[2][0] + "px, " + /*$bottom*/ - l[2][1] + "px)"), U(t, "viewBox", "-1200 -1200 3000 3000"), U(t, "fill", "none"), U(t, "xmlns", "http://www.w3.org/2000/svg"), U(t, "class", "svelte-43sxxs"), U(e, "class", "svelte-43sxxs"), Pi( + l[2][1] + "px)"), U(t, "viewBox", "-1200 -1200 3000 3000"), U(t, "fill", "none"), U(t, "xmlns", "http://www.w3.org/2000/svg"), U(t, "class", "svelte-43sxxs"), U(e, "class", "svelte-43sxxs"), Zi( e, "margin", /*margin*/ l[0] ); }, - m(_, h) { - Ju(_, e, h), De(e, t), De(t, n), De(n, i), De(n, o), De(n, a), De(n, r), De(t, s), De(s, f), De(s, u), De(s, c), De(s, d); + m(d, h) { + Ju(d, e, h), je(e, t), je(t, n), je(n, i), je(n, o), je(n, a), je(n, r), je(t, s), je(s, f), je(s, u), je(s, c), je(s, _); }, - p(_, [h]) { + p(d, [h]) { h & /*$top*/ - 2 && En(n, "transform", "translate(" + /*$top*/ - _[1][0] + "px, " + /*$top*/ - _[1][1] + "px)"), h & /*$bottom*/ - 4 && En(s, "transform", "translate(" + /*$bottom*/ - _[2][0] + "px, " + /*$bottom*/ - _[2][1] + "px)"), h & /*margin*/ - 1 && Pi( + 2 && Bn(n, "transform", "translate(" + /*$top*/ + d[1][0] + "px, " + /*$top*/ + d[1][1] + "px)"), h & /*$bottom*/ + 4 && Bn(s, "transform", "translate(" + /*$bottom*/ + d[2][0] + "px, " + /*$bottom*/ + d[2][1] + "px)"), h & /*margin*/ + 1 && Zi( e, "margin", /*margin*/ - _[0] + d[0] ); }, - i: Vi, - o: Vi, - d(_) { - _ && Zu(e); + i: Pi, + o: Pi, + d(d) { + d && Zu(e); } }; } function ec(l, e, t) { let n, i; - var o = this && this.__awaiter || function(_, h, m, b) { - function g(w) { - return w instanceof m ? w : new m(function(p) { - p(w); + var o = this && this.__awaiter || function(d, h, b, m) { + function w(k) { + return k instanceof b ? k : new b(function(g) { + g(k); }); } - return new (m || (m = Promise))(function(w, p) { - function C(z) { + return new (b || (b = Promise))(function(k, g) { + function S(z) { try { - v(b.next(z)); - } catch (k) { - p(k); + y(m.next(z)); + } catch (v) { + g(v); } } - function E(z) { + function M(z) { try { - v(b.throw(z)); - } catch (k) { - p(k); + y(m.throw(z)); + } catch (v) { + g(v); } } - function v(z) { - z.done ? w(z.value) : g(z.value).then(C, E); + function y(z) { + z.done ? k(z.value) : w(z.value).then(S, M); } - v((b = b.apply(_, h || [])).next()); + y((m = m.apply(d, h || [])).next()); }); }; let { margin: a = !0 } = e; - const r = Yi([0, 0]); - Wi(l, r, (_) => t(1, n = _)); - const s = Yi([0, 0]); - Wi(l, s, (_) => t(2, i = _)); + const r = Wi([0, 0]); + Vi(l, r, (d) => t(1, n = d)); + const s = Wi([0, 0]); + Vi(l, s, (d) => t(2, i = d)); let f; function u() { return o(this, void 0, void 0, function* () { @@ -2559,13 +2559,13 @@ function ec(l, e, t) { yield u(), f || c(); }); } - function d() { + function _() { return o(this, void 0, void 0, function* () { yield Promise.all([r.set([125, 0]), s.set([-125, 0])]), c(); }); } - return xu(() => (d(), () => f = !0)), l.$$set = (_) => { - "margin" in _ && t(0, a = _.margin); + return xu(() => (_(), () => f = !0)), l.$$set = (d) => { + "margin" in d && t(0, a = d.margin); }, [a, n, i, r, s]; } class tc extends Pu { @@ -2575,40 +2575,40 @@ class tc extends Pu { } const { SvelteComponent: nc, - append: gt, - attr: Ie, - binding_callbacks: Zi, - check_outros: $l, - create_component: cs, - create_slot: _s, - destroy_component: ds, - destroy_each: hs, - detach: I, - element: Ne, - empty: Gt, - ensure_array_like: Kn, - get_all_dirty_from_scope: ms, - get_slot_changes: bs, - group_outros: ei, + append: vt, + attr: Fe, + binding_callbacks: Ki, + check_outros: ei, + create_component: ds, + create_slot: hs, + destroy_component: ms, + destroy_each: bs, + detach: T, + element: Xe, + empty: Jt, + ensure_array_like: Qn, + get_all_dirty_from_scope: gs, + get_slot_changes: ws, + group_outros: ti, init: lc, - insert: R, - mount_component: gs, - noop: ti, + insert: j, + mount_component: ps, + noop: ni, safe_not_equal: ic, - set_data: Me, - set_style: lt, - space: qe, - text: Z, - toggle_class: ze, - transition_in: je, - transition_out: Oe, - update_slot_base: ws -} = window.__gradio__svelte__internal, { tick: oc } = window.__gradio__svelte__internal, { onDestroy: sc } = window.__gradio__svelte__internal, { createEventDispatcher: ac } = window.__gradio__svelte__internal, rc = (l) => ({}), Ki = (l) => ({}), fc = (l) => ({}), Gi = (l) => ({}); -function Ji(l, e, t) { + set_data: Be, + set_style: ot, + space: Me, + text: P, + toggle_class: Ee, + transition_in: Re, + transition_out: Ye, + update_slot_base: ks +} = window.__gradio__svelte__internal, { tick: oc } = window.__gradio__svelte__internal, { onDestroy: sc } = window.__gradio__svelte__internal, { createEventDispatcher: ac } = window.__gradio__svelte__internal, rc = (l) => ({}), Gi = (l) => ({}), fc = (l) => ({}), Ji = (l) => ({}); +function Qi(l, e, t) { const n = l.slice(); return n[41] = e[t], n[43] = t, n; } -function Qi(l, e, t) { +function xi(l, e, t) { const n = l.slice(); return n[41] = e[t], n; } @@ -2617,9 +2617,9 @@ function uc(l) { /*i18n*/ l[1]("common.error") + "" ), a, r, s; - t = new il({ + t = new al({ props: { - Icon: ui, + Icon: ci, label: ( /*i18n*/ l[1]("common.clear") @@ -2634,54 +2634,54 @@ function uc(l) { const f = ( /*#slots*/ l[30].error - ), u = _s( + ), u = hs( f, l, /*$$scope*/ l[29], - Ki + Gi ); return { c() { - e = Ne("div"), cs(t.$$.fragment), n = qe(), i = Ne("span"), a = Z(o), r = qe(), u && u.c(), Ie(e, "class", "clear-status svelte-16nch4a"), Ie(i, "class", "error svelte-16nch4a"); + e = Xe("div"), ds(t.$$.fragment), n = Me(), i = Xe("span"), a = P(o), r = Me(), u && u.c(), Fe(e, "class", "clear-status svelte-16nch4a"), Fe(i, "class", "error svelte-16nch4a"); }, - m(c, d) { - R(c, e, d), gs(t, e, null), R(c, n, d), R(c, i, d), gt(i, a), R(c, r, d), u && u.m(c, d), s = !0; + m(c, _) { + j(c, e, _), ps(t, e, null), j(c, n, _), j(c, i, _), vt(i, a), j(c, r, _), u && u.m(c, _), s = !0; }, - p(c, d) { - const _ = {}; - d[0] & /*i18n*/ - 2 && (_.label = /*i18n*/ - c[1]("common.clear")), t.$set(_), (!s || d[0] & /*i18n*/ + p(c, _) { + const d = {}; + _[0] & /*i18n*/ + 2 && (d.label = /*i18n*/ + c[1]("common.clear")), t.$set(d), (!s || _[0] & /*i18n*/ 2) && o !== (o = /*i18n*/ - c[1]("common.error") + "") && Me(a, o), u && u.p && (!s || d[0] & /*$$scope*/ - 536870912) && ws( + c[1]("common.error") + "") && Be(a, o), u && u.p && (!s || _[0] & /*$$scope*/ + 536870912) && ks( u, f, c, /*$$scope*/ c[29], - s ? bs( + s ? ws( f, /*$$scope*/ c[29], - d, + _, rc - ) : ms( + ) : gs( /*$$scope*/ c[29] ), - Ki + Gi ); }, i(c) { - s || (je(t.$$.fragment, c), je(u, c), s = !0); + s || (Re(t.$$.fragment, c), Re(u, c), s = !0); }, o(c) { - Oe(t.$$.fragment, c), Oe(u, c), s = !1; + Ye(t.$$.fragment, c), Ye(u, c), s = !1; }, d(c) { - c && (I(e), I(n), I(i), I(r)), ds(t), u && u.d(c); + c && (T(e), T(n), T(i), T(r)), ms(t), u && u.d(c); } }; } @@ -2690,113 +2690,113 @@ function cc(l) { /*variant*/ l[8] === "default" && /*show_eta_bar*/ l[18] && /*show_progress*/ - l[6] === "full" && xi(l) + l[6] === "full" && $i(l) ); - function c(p, C) { + function c(g, S) { if ( /*progress*/ - p[7] + g[7] ) return hc; if ( /*queue_position*/ - p[2] !== null && /*queue_size*/ - p[3] !== void 0 && /*queue_position*/ - p[2] >= 0 + g[2] !== null && /*queue_size*/ + g[3] !== void 0 && /*queue_position*/ + g[2] >= 0 ) return dc; if ( /*queue_position*/ - p[2] === 0 + g[2] === 0 ) return _c; } - let d = c(l), _ = d && d(l), h = ( + let _ = c(l), d = _ && _(l), h = ( /*timer*/ - l[5] && to(l) + l[5] && no(l) ); - const m = [wc, gc], b = []; - function g(p, C) { + const b = [wc, gc], m = []; + function w(g, S) { return ( /*last_progress_level*/ - p[15] != null ? 0 : ( + g[15] != null ? 0 : ( /*show_progress*/ - p[6] === "full" ? 1 : -1 + g[6] === "full" ? 1 : -1 ) ); } - ~(o = g(l)) && (a = b[o] = m[o](l)); - let w = !/*timer*/ - l[5] && ro(l); + ~(o = w(l)) && (a = m[o] = b[o](l)); + let k = !/*timer*/ + l[5] && fo(l); return { c() { - u && u.c(), e = qe(), t = Ne("div"), _ && _.c(), n = qe(), h && h.c(), i = qe(), a && a.c(), r = qe(), w && w.c(), s = Gt(), Ie(t, "class", "progress-text svelte-16nch4a"), ze( + u && u.c(), e = Me(), t = Xe("div"), d && d.c(), n = Me(), h && h.c(), i = Me(), a && a.c(), r = Me(), k && k.c(), s = Jt(), Fe(t, "class", "progress-text svelte-16nch4a"), Ee( t, "meta-text-center", /*variant*/ l[8] === "center" - ), ze( + ), Ee( t, "meta-text", /*variant*/ l[8] === "default" ); }, - m(p, C) { - u && u.m(p, C), R(p, e, C), R(p, t, C), _ && _.m(t, null), gt(t, n), h && h.m(t, null), R(p, i, C), ~o && b[o].m(p, C), R(p, r, C), w && w.m(p, C), R(p, s, C), f = !0; + m(g, S) { + u && u.m(g, S), j(g, e, S), j(g, t, S), d && d.m(t, null), vt(t, n), h && h.m(t, null), j(g, i, S), ~o && m[o].m(g, S), j(g, r, S), k && k.m(g, S), j(g, s, S), f = !0; }, - p(p, C) { + p(g, S) { /*variant*/ - p[8] === "default" && /*show_eta_bar*/ - p[18] && /*show_progress*/ - p[6] === "full" ? u ? u.p(p, C) : (u = xi(p), u.c(), u.m(e.parentNode, e)) : u && (u.d(1), u = null), d === (d = c(p)) && _ ? _.p(p, C) : (_ && _.d(1), _ = d && d(p), _ && (_.c(), _.m(t, n))), /*timer*/ - p[5] ? h ? h.p(p, C) : (h = to(p), h.c(), h.m(t, null)) : h && (h.d(1), h = null), (!f || C[0] & /*variant*/ - 256) && ze( + g[8] === "default" && /*show_eta_bar*/ + g[18] && /*show_progress*/ + g[6] === "full" ? u ? u.p(g, S) : (u = $i(g), u.c(), u.m(e.parentNode, e)) : u && (u.d(1), u = null), _ === (_ = c(g)) && d ? d.p(g, S) : (d && d.d(1), d = _ && _(g), d && (d.c(), d.m(t, n))), /*timer*/ + g[5] ? h ? h.p(g, S) : (h = no(g), h.c(), h.m(t, null)) : h && (h.d(1), h = null), (!f || S[0] & /*variant*/ + 256) && Ee( t, "meta-text-center", /*variant*/ - p[8] === "center" - ), (!f || C[0] & /*variant*/ - 256) && ze( + g[8] === "center" + ), (!f || S[0] & /*variant*/ + 256) && Ee( t, "meta-text", /*variant*/ - p[8] === "default" + g[8] === "default" ); - let E = o; - o = g(p), o === E ? ~o && b[o].p(p, C) : (a && (ei(), Oe(b[E], 1, 1, () => { - b[E] = null; - }), $l()), ~o ? (a = b[o], a ? a.p(p, C) : (a = b[o] = m[o](p), a.c()), je(a, 1), a.m(r.parentNode, r)) : a = null), /*timer*/ - p[5] ? w && (ei(), Oe(w, 1, 1, () => { - w = null; - }), $l()) : w ? (w.p(p, C), C[0] & /*timer*/ - 32 && je(w, 1)) : (w = ro(p), w.c(), je(w, 1), w.m(s.parentNode, s)); + let M = o; + o = w(g), o === M ? ~o && m[o].p(g, S) : (a && (ti(), Ye(m[M], 1, 1, () => { + m[M] = null; + }), ei()), ~o ? (a = m[o], a ? a.p(g, S) : (a = m[o] = b[o](g), a.c()), Re(a, 1), a.m(r.parentNode, r)) : a = null), /*timer*/ + g[5] ? k && (ti(), Ye(k, 1, 1, () => { + k = null; + }), ei()) : k ? (k.p(g, S), S[0] & /*timer*/ + 32 && Re(k, 1)) : (k = fo(g), k.c(), Re(k, 1), k.m(s.parentNode, s)); }, - i(p) { - f || (je(a), je(w), f = !0); + i(g) { + f || (Re(a), Re(k), f = !0); }, - o(p) { - Oe(a), Oe(w), f = !1; + o(g) { + Ye(a), Ye(k), f = !1; }, - d(p) { - p && (I(e), I(t), I(i), I(r), I(s)), u && u.d(p), _ && _.d(), h && h.d(), ~o && b[o].d(p), w && w.d(p); + d(g) { + g && (T(e), T(t), T(i), T(r), T(s)), u && u.d(g), d && d.d(), h && h.d(), ~o && m[o].d(g), k && k.d(g); } }; } -function xi(l) { +function $i(l) { let e, t = `translateX(${/*eta_level*/ (l[17] || 0) * 100 - 100}%)`; return { c() { - e = Ne("div"), Ie(e, "class", "eta-bar svelte-16nch4a"), lt(e, "transform", t); + e = Xe("div"), Fe(e, "class", "eta-bar svelte-16nch4a"), ot(e, "transform", t); }, m(n, i) { - R(n, e, i); + j(n, e, i); }, p(n, i) { i[0] & /*eta_level*/ 131072 && t !== (t = `translateX(${/*eta_level*/ - (n[17] || 0) * 100 - 100}%)`) && lt(e, "transform", t); + (n[17] || 0) * 100 - 100}%)`) && ot(e, "transform", t); }, d(n) { - n && I(e); + n && T(e); } }; } @@ -2804,14 +2804,14 @@ function _c(l) { let e; return { c() { - e = Z("processing |"); + e = P("processing |"); }, m(t, n) { - R(t, e, n); + j(t, e, n); }, - p: ti, + p: ni, d(t) { - t && I(e); + t && T(e); } }; } @@ -2822,58 +2822,58 @@ function dc(l) { ), n, i, o, a; return { c() { - e = Z("queue: "), n = Z(t), i = Z("/"), o = Z( + e = P("queue: "), n = P(t), i = P("/"), o = P( /*queue_size*/ l[3] - ), a = Z(" |"); + ), a = P(" |"); }, m(r, s) { - R(r, e, s), R(r, n, s), R(r, i, s), R(r, o, s), R(r, a, s); + j(r, e, s), j(r, n, s), j(r, i, s), j(r, o, s), j(r, a, s); }, p(r, s) { s[0] & /*queue_position*/ 4 && t !== (t = /*queue_position*/ - r[2] + 1 + "") && Me(n, t), s[0] & /*queue_size*/ - 8 && Me( + r[2] + 1 + "") && Be(n, t), s[0] & /*queue_size*/ + 8 && Be( o, /*queue_size*/ r[3] ); }, d(r) { - r && (I(e), I(n), I(i), I(o), I(a)); + r && (T(e), T(n), T(i), T(o), T(a)); } }; } function hc(l) { - let e, t = Kn( + let e, t = Qn( /*progress*/ l[7] ), n = []; for (let i = 0; i < t.length; i += 1) - n[i] = eo(Qi(l, t, i)); + n[i] = to(xi(l, t, i)); return { c() { for (let i = 0; i < n.length; i += 1) n[i].c(); - e = Gt(); + e = Jt(); }, m(i, o) { for (let a = 0; a < n.length; a += 1) n[a] && n[a].m(i, o); - R(i, e, o); + j(i, e, o); }, p(i, o) { if (o[0] & /*progress*/ 128) { - t = Kn( + t = Qn( /*progress*/ i[7] ); let a; for (a = 0; a < t.length; a += 1) { - const r = Qi(i, t, a); - n[a] ? n[a].p(r, o) : (n[a] = eo(r), n[a].c(), n[a].m(e.parentNode, e)); + const r = xi(i, t, a); + n[a] ? n[a].p(r, o) : (n[a] = to(r), n[a].c(), n[a].m(e.parentNode, e)); } for (; a < n.length; a += 1) n[a].d(1); @@ -2881,11 +2881,11 @@ function hc(l) { } }, d(i) { - i && I(e), hs(n, i); + i && T(e), bs(n, i); } }; } -function $i(l) { +function eo(l) { let e, t = ( /*p*/ l[41].unit + "" @@ -2899,98 +2899,98 @@ function $i(l) { let s = r(l), f = s(l); return { c() { - f.c(), e = qe(), n = Z(t), i = Z(" | "), a = Z(o); + f.c(), e = Me(), n = P(t), i = P(" | "), a = P(o); }, m(u, c) { - f.m(u, c), R(u, e, c), R(u, n, c), R(u, i, c), R(u, a, c); + f.m(u, c), j(u, e, c), j(u, n, c), j(u, i, c), j(u, a, c); }, p(u, c) { s === (s = r(u)) && f ? f.p(u, c) : (f.d(1), f = s(u), f && (f.c(), f.m(e.parentNode, e))), c[0] & /*progress*/ 128 && t !== (t = /*p*/ - u[41].unit + "") && Me(n, t); + u[41].unit + "") && Be(n, t); }, d(u) { - u && (I(e), I(n), I(i), I(a)), f.d(u); + u && (T(e), T(n), T(i), T(a)), f.d(u); } }; } function mc(l) { - let e = Xt( + let e = Yt( /*p*/ l[41].index || 0 ) + "", t; return { c() { - t = Z(e); + t = P(e); }, m(n, i) { - R(n, t, i); + j(n, t, i); }, p(n, i) { i[0] & /*progress*/ - 128 && e !== (e = Xt( + 128 && e !== (e = Yt( /*p*/ n[41].index || 0 - ) + "") && Me(t, e); + ) + "") && Be(t, e); }, d(n) { - n && I(t); + n && T(t); } }; } function bc(l) { - let e = Xt( + let e = Yt( /*p*/ l[41].index || 0 - ) + "", t, n, i = Xt( + ) + "", t, n, i = Yt( /*p*/ l[41].length ) + "", o; return { c() { - t = Z(e), n = Z("/"), o = Z(i); + t = P(e), n = P("/"), o = P(i); }, m(a, r) { - R(a, t, r), R(a, n, r), R(a, o, r); + j(a, t, r), j(a, n, r), j(a, o, r); }, p(a, r) { r[0] & /*progress*/ - 128 && e !== (e = Xt( + 128 && e !== (e = Yt( /*p*/ a[41].index || 0 - ) + "") && Me(t, e), r[0] & /*progress*/ - 128 && i !== (i = Xt( + ) + "") && Be(t, e), r[0] & /*progress*/ + 128 && i !== (i = Yt( /*p*/ a[41].length - ) + "") && Me(o, i); + ) + "") && Be(o, i); }, d(a) { - a && (I(t), I(n), I(o)); + a && (T(t), T(n), T(o)); } }; } -function eo(l) { +function to(l) { let e, t = ( /*p*/ - l[41].index != null && $i(l) + l[41].index != null && eo(l) ); return { c() { - t && t.c(), e = Gt(); + t && t.c(), e = Jt(); }, m(n, i) { - t && t.m(n, i), R(n, e, i); + t && t.m(n, i), j(n, e, i); }, p(n, i) { /*p*/ - n[41].index != null ? t ? t.p(n, i) : (t = $i(n), t.c(), t.m(e.parentNode, e)) : t && (t.d(1), t = null); + n[41].index != null ? t ? t.p(n, i) : (t = eo(n), t.c(), t.m(e.parentNode, e)) : t && (t.d(1), t = null); }, d(n) { - n && I(e), t && t.d(n); + n && T(e), t && t.d(n); } }; } -function to(l) { +function no(l) { let e, t = ( /*eta*/ l[0] ? `/${/*formatted_eta*/ @@ -2998,27 +2998,27 @@ function to(l) { ), n, i; return { c() { - e = Z( + e = P( /*formatted_timer*/ l[20] - ), n = Z(t), i = Z("s"); + ), n = P(t), i = P("s"); }, m(o, a) { - R(o, e, a), R(o, n, a), R(o, i, a); + j(o, e, a), j(o, n, a), j(o, i, a); }, p(o, a) { a[0] & /*formatted_timer*/ - 1048576 && Me( + 1048576 && Be( e, /*formatted_timer*/ o[20] ), a[0] & /*eta, formatted_eta*/ 524289 && t !== (t = /*eta*/ o[0] ? `/${/*formatted_eta*/ - o[19]}` : "") && Me(n, t); + o[19]}` : "") && Be(n, t); }, d(o) { - o && (I(e), I(n), I(i)); + o && (T(e), T(n), T(i)); } }; } @@ -3031,10 +3031,10 @@ function gc(l) { ) } }), { c() { - cs(e.$$.fragment); + ds(e.$$.fragment); }, m(n, i) { - gs(e, n, i), t = !0; + ps(e, n, i), t = !0; }, p(n, i) { const o = {}; @@ -3043,13 +3043,13 @@ function gc(l) { n[8] === "default"), e.$set(o); }, i(n) { - t || (je(e.$$.fragment, n), t = !0); + t || (Re(e.$$.fragment, n), t = !0); }, o(n) { - Oe(e.$$.fragment, n), t = !1; + Ye(e.$$.fragment, n), t = !1; }, d(n) { - ds(e, n); + ms(e, n); } }; } @@ -3057,57 +3057,57 @@ function wc(l) { let e, t, n, i, o, a = `${/*last_progress_level*/ l[15] * 100}%`, r = ( /*progress*/ - l[7] != null && no(l) + l[7] != null && lo(l) ); return { c() { - e = Ne("div"), t = Ne("div"), r && r.c(), n = qe(), i = Ne("div"), o = Ne("div"), Ie(t, "class", "progress-level-inner svelte-16nch4a"), Ie(o, "class", "progress-bar svelte-16nch4a"), lt(o, "width", a), Ie(i, "class", "progress-bar-wrap svelte-16nch4a"), Ie(e, "class", "progress-level svelte-16nch4a"); + e = Xe("div"), t = Xe("div"), r && r.c(), n = Me(), i = Xe("div"), o = Xe("div"), Fe(t, "class", "progress-level-inner svelte-16nch4a"), Fe(o, "class", "progress-bar svelte-16nch4a"), ot(o, "width", a), Fe(i, "class", "progress-bar-wrap svelte-16nch4a"), Fe(e, "class", "progress-level svelte-16nch4a"); }, m(s, f) { - R(s, e, f), gt(e, t), r && r.m(t, null), gt(e, n), gt(e, i), gt(i, o), l[31](o); + j(s, e, f), vt(e, t), r && r.m(t, null), vt(e, n), vt(e, i), vt(i, o), l[31](o); }, p(s, f) { /*progress*/ - s[7] != null ? r ? r.p(s, f) : (r = no(s), r.c(), r.m(t, null)) : r && (r.d(1), r = null), f[0] & /*last_progress_level*/ + s[7] != null ? r ? r.p(s, f) : (r = lo(s), r.c(), r.m(t, null)) : r && (r.d(1), r = null), f[0] & /*last_progress_level*/ 32768 && a !== (a = `${/*last_progress_level*/ - s[15] * 100}%`) && lt(o, "width", a); + s[15] * 100}%`) && ot(o, "width", a); }, - i: ti, - o: ti, + i: ni, + o: ni, d(s) { - s && I(e), r && r.d(), l[31](null); + s && T(e), r && r.d(), l[31](null); } }; } -function no(l) { - let e, t = Kn( +function lo(l) { + let e, t = Qn( /*progress*/ l[7] ), n = []; for (let i = 0; i < t.length; i += 1) - n[i] = ao(Ji(l, t, i)); + n[i] = ro(Qi(l, t, i)); return { c() { for (let i = 0; i < n.length; i += 1) n[i].c(); - e = Gt(); + e = Jt(); }, m(i, o) { for (let a = 0; a < n.length; a += 1) n[a] && n[a].m(i, o); - R(i, e, o); + j(i, e, o); }, p(i, o) { if (o[0] & /*progress_level, progress*/ 16512) { - t = Kn( + t = Qn( /*progress*/ i[7] ); let a; for (a = 0; a < t.length; a += 1) { - const r = Ji(i, t, a); - n[a] ? n[a].p(r, o) : (n[a] = ao(r), n[a].c(), n[a].m(e.parentNode, e)); + const r = Qi(i, t, a); + n[a] ? n[a].p(r, o) : (n[a] = ro(r), n[a].c(), n[a].m(e.parentNode, e)); } for (; a < n.length; a += 1) n[a].d(1); @@ -3115,17 +3115,17 @@ function no(l) { } }, d(i) { - i && I(e), hs(n, i); + i && T(e), bs(n, i); } }; } -function lo(l) { +function io(l) { let e, t, n, i, o = ( /*i*/ l[43] !== 0 && pc() ), a = ( /*p*/ - l[41].desc != null && io(l) + l[41].desc != null && oo(l) ), r = ( /*p*/ l[41].desc != null && /*progress_level*/ @@ -3133,31 +3133,31 @@ function lo(l) { l[14][ /*i*/ l[43] - ] != null && oo() + ] != null && so() ), s = ( /*progress_level*/ - l[14] != null && so(l) + l[14] != null && ao(l) ); return { c() { - o && o.c(), e = qe(), a && a.c(), t = qe(), r && r.c(), n = qe(), s && s.c(), i = Gt(); + o && o.c(), e = Me(), a && a.c(), t = Me(), r && r.c(), n = Me(), s && s.c(), i = Jt(); }, m(f, u) { - o && o.m(f, u), R(f, e, u), a && a.m(f, u), R(f, t, u), r && r.m(f, u), R(f, n, u), s && s.m(f, u), R(f, i, u); + o && o.m(f, u), j(f, e, u), a && a.m(f, u), j(f, t, u), r && r.m(f, u), j(f, n, u), s && s.m(f, u), j(f, i, u); }, p(f, u) { /*p*/ - f[41].desc != null ? a ? a.p(f, u) : (a = io(f), a.c(), a.m(t.parentNode, t)) : a && (a.d(1), a = null), /*p*/ + f[41].desc != null ? a ? a.p(f, u) : (a = oo(f), a.c(), a.m(t.parentNode, t)) : a && (a.d(1), a = null), /*p*/ f[41].desc != null && /*progress_level*/ f[14] && /*progress_level*/ f[14][ /*i*/ f[43] - ] != null ? r || (r = oo(), r.c(), r.m(n.parentNode, n)) : r && (r.d(1), r = null), /*progress_level*/ - f[14] != null ? s ? s.p(f, u) : (s = so(f), s.c(), s.m(i.parentNode, i)) : s && (s.d(1), s = null); + ] != null ? r || (r = so(), r.c(), r.m(n.parentNode, n)) : r && (r.d(1), r = null), /*progress_level*/ + f[14] != null ? s ? s.p(f, u) : (s = ao(f), s.c(), s.m(i.parentNode, i)) : s && (s.d(1), s = null); }, d(f) { - f && (I(e), I(t), I(n), I(i)), o && o.d(f), a && a.d(f), r && r.d(f), s && s.d(f); + f && (T(e), T(t), T(n), T(i)), o && o.d(f), a && a.d(f), r && r.d(f), s && s.d(f); } }; } @@ -3165,53 +3165,53 @@ function pc(l) { let e; return { c() { - e = Z(" /"); + e = P(" /"); }, m(t, n) { - R(t, e, n); + j(t, e, n); }, d(t) { - t && I(e); + t && T(e); } }; } -function io(l) { +function oo(l) { let e = ( /*p*/ l[41].desc + "" ), t; return { c() { - t = Z(e); + t = P(e); }, m(n, i) { - R(n, t, i); + j(n, t, i); }, p(n, i) { i[0] & /*progress*/ 128 && e !== (e = /*p*/ - n[41].desc + "") && Me(t, e); + n[41].desc + "") && Be(t, e); }, d(n) { - n && I(t); + n && T(t); } }; } -function oo(l) { +function so(l) { let e; return { c() { - e = Z("-"); + e = P("-"); }, m(t, n) { - R(t, e, n); + j(t, e, n); }, d(t) { - t && I(e); + t && T(e); } }; } -function so(l) { +function ao(l) { let e = (100 * /*progress_level*/ (l[14][ /*i*/ @@ -3219,10 +3219,10 @@ function so(l) { ] || 0)).toFixed(1) + "", t, n; return { c() { - t = Z(e), n = Z("%"); + t = P(e), n = P("%"); }, m(i, o) { - R(i, t, o), R(i, n, o); + j(i, t, o), j(i, n, o); }, p(i, o) { o[0] & /*progress_level*/ @@ -3230,14 +3230,14 @@ function so(l) { (i[14][ /*i*/ i[43] - ] || 0)).toFixed(1) + "") && Me(t, e); + ] || 0)).toFixed(1) + "") && Be(t, e); }, d(i) { - i && (I(t), I(n)); + i && (T(t), T(n)); } }; } -function ao(l) { +function ro(l) { let e, t = ( /*p*/ (l[41].desc != null || /*progress_level*/ @@ -3245,14 +3245,14 @@ function ao(l) { l[14][ /*i*/ l[43] - ] != null) && lo(l) + ] != null) && io(l) ); return { c() { - t && t.c(), e = Gt(); + t && t.c(), e = Jt(); }, m(n, i) { - t && t.m(n, i), R(n, e, i); + t && t.m(n, i), j(n, e, i); }, p(n, i) { /*p*/ @@ -3261,69 +3261,69 @@ function ao(l) { n[14][ /*i*/ n[43] - ] != null ? t ? t.p(n, i) : (t = lo(n), t.c(), t.m(e.parentNode, e)) : t && (t.d(1), t = null); + ] != null ? t ? t.p(n, i) : (t = io(n), t.c(), t.m(e.parentNode, e)) : t && (t.d(1), t = null); }, d(n) { - n && I(e), t && t.d(n); + n && T(e), t && t.d(n); } }; } -function ro(l) { +function fo(l) { let e, t, n, i; const o = ( /*#slots*/ l[30]["additional-loading-text"] - ), a = _s( + ), a = hs( o, l, /*$$scope*/ l[29], - Gi + Ji ); return { c() { - e = Ne("p"), t = Z( + e = Xe("p"), t = P( /*loading_text*/ l[9] - ), n = qe(), a && a.c(), Ie(e, "class", "loading svelte-16nch4a"); + ), n = Me(), a && a.c(), Fe(e, "class", "loading svelte-16nch4a"); }, m(r, s) { - R(r, e, s), gt(e, t), R(r, n, s), a && a.m(r, s), i = !0; + j(r, e, s), vt(e, t), j(r, n, s), a && a.m(r, s), i = !0; }, p(r, s) { (!i || s[0] & /*loading_text*/ - 512) && Me( + 512) && Be( t, /*loading_text*/ r[9] ), a && a.p && (!i || s[0] & /*$$scope*/ - 536870912) && ws( + 536870912) && ks( a, o, r, /*$$scope*/ r[29], - i ? bs( + i ? ws( o, /*$$scope*/ r[29], s, fc - ) : ms( + ) : gs( /*$$scope*/ r[29] ), - Gi + Ji ); }, i(r) { - i || (je(a, r), i = !0); + i || (Re(a, r), i = !0); }, o(r) { - Oe(a, r), i = !1; + Ye(a, r), i = !1; }, d(r) { - r && (I(e), I(n)), a && a.d(r); + r && (T(e), T(n)), a && a.d(r); } }; } @@ -3341,12 +3341,12 @@ function kc(l) { } return ~(t = s(l)) && (n = r[t] = a[t](l)), { c() { - e = Ne("div"), n && n.c(), Ie(e, "class", i = "wrap " + /*variant*/ + e = Xe("div"), n && n.c(), Fe(e, "class", i = "wrap " + /*variant*/ l[8] + " " + /*show_progress*/ - l[6] + " svelte-16nch4a"), ze(e, "hide", !/*status*/ + l[6] + " svelte-16nch4a"), Ee(e, "hide", !/*status*/ l[4] || /*status*/ l[4] === "complete" || /*show_progress*/ - l[6] === "hidden"), ze( + l[6] === "hidden"), Ee( e, "translucent", /*variant*/ @@ -3355,22 +3355,22 @@ function kc(l) { l[4] === "error") || /*translucent*/ l[11] || /*show_progress*/ l[6] === "minimal" - ), ze( + ), Ee( e, "generating", /*status*/ l[4] === "generating" - ), ze( + ), Ee( e, "border", /*border*/ l[12] - ), lt( + ), ot( e, "position", /*absolute*/ l[10] ? "absolute" : "static" - ), lt( + ), ot( e, "padding", /*absolute*/ @@ -3378,21 +3378,21 @@ function kc(l) { ); }, m(f, u) { - R(f, e, u), ~t && r[t].m(e, null), l[33](e), o = !0; + j(f, e, u), ~t && r[t].m(e, null), l[33](e), o = !0; }, p(f, u) { let c = t; - t = s(f), t === c ? ~t && r[t].p(f, u) : (n && (ei(), Oe(r[c], 1, 1, () => { + t = s(f), t === c ? ~t && r[t].p(f, u) : (n && (ti(), Ye(r[c], 1, 1, () => { r[c] = null; - }), $l()), ~t ? (n = r[t], n ? n.p(f, u) : (n = r[t] = a[t](f), n.c()), je(n, 1), n.m(e, null)) : n = null), (!o || u[0] & /*variant, show_progress*/ + }), ei()), ~t ? (n = r[t], n ? n.p(f, u) : (n = r[t] = a[t](f), n.c()), Re(n, 1), n.m(e, null)) : n = null), (!o || u[0] & /*variant, show_progress*/ 320 && i !== (i = "wrap " + /*variant*/ f[8] + " " + /*show_progress*/ - f[6] + " svelte-16nch4a")) && Ie(e, "class", i), (!o || u[0] & /*variant, show_progress, status, show_progress*/ - 336) && ze(e, "hide", !/*status*/ + f[6] + " svelte-16nch4a")) && Fe(e, "class", i), (!o || u[0] & /*variant, show_progress, status, show_progress*/ + 336) && Ee(e, "hide", !/*status*/ f[4] || /*status*/ f[4] === "complete" || /*show_progress*/ f[6] === "hidden"), (!o || u[0] & /*variant, show_progress, variant, status, translucent, show_progress*/ - 2384) && ze( + 2384) && Ee( e, "translucent", /*variant*/ @@ -3402,25 +3402,25 @@ function kc(l) { f[11] || /*show_progress*/ f[6] === "minimal" ), (!o || u[0] & /*variant, show_progress, status*/ - 336) && ze( + 336) && Ee( e, "generating", /*status*/ f[4] === "generating" ), (!o || u[0] & /*variant, show_progress, border*/ - 4416) && ze( + 4416) && Ee( e, "border", /*border*/ f[12] ), u[0] & /*absolute*/ - 1024 && lt( + 1024 && ot( e, "position", /*absolute*/ f[10] ? "absolute" : "static" ), u[0] & /*absolute*/ - 1024 && lt( + 1024 && ot( e, "padding", /*absolute*/ @@ -3428,13 +3428,13 @@ function kc(l) { ); }, i(f) { - o || (je(n), o = !0); + o || (Re(n), o = !0); }, o(f) { - Oe(n), o = !1; + Ye(n), o = !1; }, d(f) { - f && I(e), ~t && r[t].d(), l[33](null); + f && T(e), ~t && r[t].d(), l[33](null); } }; } @@ -3465,11 +3465,11 @@ var vc = function(l, e, t, n) { f((n = n.apply(l, e || [])).next()); }); }; -let An = [], Tl = !1; +let An = [], Il = !1; function yc(l) { return vc(this, arguments, void 0, function* (e, t = !0) { if (!(window.__gradio_mode__ === "website" || window.__gradio_mode__ !== "app" && t !== !0)) { - if (An.push(e), !Tl) Tl = !0; + if (An.push(e), !Il) Il = !0; else return; yield oc(), requestAnimationFrame(() => { let n = [0, 0]; @@ -3477,7 +3477,7 @@ function yc(l) { const a = An[i].getBoundingClientRect(); (i === 0 || a.top + window.scrollY <= n[0]) && (n[0] = a.top + window.scrollY, n[1] = i); } - window.scrollTo({ top: n[0] - 20, behavior: "smooth" }), Tl = !1, An = []; + window.scrollTo({ top: n[0] - 20, behavior: "smooth" }), Il = !1, An = []; }); } }); @@ -3486,87 +3486,87 @@ function Cc(l, e, t) { let n, { $$slots: i = {}, $$scope: o } = e; this && this.__awaiter; const a = ac(); - let { i18n: r } = e, { eta: s = null } = e, { queue_position: f } = e, { queue_size: u } = e, { status: c } = e, { scroll_to_output: d = !1 } = e, { timer: _ = !0 } = e, { show_progress: h = "full" } = e, { message: m = null } = e, { progress: b = null } = e, { variant: g = "default" } = e, { loading_text: w = "Loading..." } = e, { absolute: p = !0 } = e, { translucent: C = !1 } = e, { border: E = !1 } = e, { autoscroll: v } = e, z, k = !1, q = 0, F = 0, j = null, D = null, N = 0, K = null, $, X = null, se = !0; - const we = () => { - t(0, s = t(27, j = t(19, ae = null))), t(25, q = performance.now()), t(26, F = 0), k = !0, re(); + let { i18n: r } = e, { eta: s = null } = e, { queue_position: f } = e, { queue_size: u } = e, { status: c } = e, { scroll_to_output: _ = !1 } = e, { timer: d = !0 } = e, { show_progress: h = "full" } = e, { message: b = null } = e, { progress: m = null } = e, { variant: w = "default" } = e, { loading_text: k = "Loading..." } = e, { absolute: g = !0 } = e, { translucent: S = !1 } = e, { border: M = !1 } = e, { autoscroll: y } = e, z, v = !1, q = 0, R = 0, I = null, B = null, W = 0, H = null, le, X = null, ee = !0; + const ae = () => { + t(0, s = t(27, I = t(19, de = null))), t(25, q = performance.now()), t(26, R = 0), v = !0, ye(); }; - function re() { + function ye() { requestAnimationFrame(() => { - t(26, F = (performance.now() - q) / 1e3), k && re(); + t(26, R = (performance.now() - q) / 1e3), v && ye(); }); } - function T() { - t(26, F = 0), t(0, s = t(27, j = t(19, ae = null))), k && (k = !1); + function L() { + t(26, R = 0), t(0, s = t(27, I = t(19, de = null))), v && (v = !1); } sc(() => { - k && T(); + v && L(); }); - let ae = null; - function fe(L) { - Zi[L ? "unshift" : "push"](() => { - X = L, t(16, X), t(7, b), t(14, K), t(15, $); + let de = null; + function Ae(A) { + Ki[A ? "unshift" : "push"](() => { + X = A, t(16, X), t(7, m), t(14, H), t(15, le); }); } - const Ye = () => { + const Le = () => { a("clear_status"); }; - function We(L) { - Zi[L ? "unshift" : "push"](() => { - z = L, t(13, z); + function Ce(A) { + Ki[A ? "unshift" : "push"](() => { + z = A, t(13, z); }); } - return l.$$set = (L) => { - "i18n" in L && t(1, r = L.i18n), "eta" in L && t(0, s = L.eta), "queue_position" in L && t(2, f = L.queue_position), "queue_size" in L && t(3, u = L.queue_size), "status" in L && t(4, c = L.status), "scroll_to_output" in L && t(22, d = L.scroll_to_output), "timer" in L && t(5, _ = L.timer), "show_progress" in L && t(6, h = L.show_progress), "message" in L && t(23, m = L.message), "progress" in L && t(7, b = L.progress), "variant" in L && t(8, g = L.variant), "loading_text" in L && t(9, w = L.loading_text), "absolute" in L && t(10, p = L.absolute), "translucent" in L && t(11, C = L.translucent), "border" in L && t(12, E = L.border), "autoscroll" in L && t(24, v = L.autoscroll), "$$scope" in L && t(29, o = L.$$scope); + return l.$$set = (A) => { + "i18n" in A && t(1, r = A.i18n), "eta" in A && t(0, s = A.eta), "queue_position" in A && t(2, f = A.queue_position), "queue_size" in A && t(3, u = A.queue_size), "status" in A && t(4, c = A.status), "scroll_to_output" in A && t(22, _ = A.scroll_to_output), "timer" in A && t(5, d = A.timer), "show_progress" in A && t(6, h = A.show_progress), "message" in A && t(23, b = A.message), "progress" in A && t(7, m = A.progress), "variant" in A && t(8, w = A.variant), "loading_text" in A && t(9, k = A.loading_text), "absolute" in A && t(10, g = A.absolute), "translucent" in A && t(11, S = A.translucent), "border" in A && t(12, M = A.border), "autoscroll" in A && t(24, y = A.autoscroll), "$$scope" in A && t(29, o = A.$$scope); }, l.$$.update = () => { l.$$.dirty[0] & /*eta, old_eta, timer_start, eta_from_start*/ - 436207617 && (s === null && t(0, s = j), s != null && j !== s && (t(28, D = (performance.now() - q) / 1e3 + s), t(19, ae = D.toFixed(1)), t(27, j = s))), l.$$.dirty[0] & /*eta_from_start, timer_diff*/ - 335544320 && t(17, N = D === null || D <= 0 || !F ? null : Math.min(F / D, 1)), l.$$.dirty[0] & /*progress*/ - 128 && b != null && t(18, se = !1), l.$$.dirty[0] & /*progress, progress_level, progress_bar, last_progress_level*/ - 114816 && (b != null ? t(14, K = b.map((L) => { - if (L.index != null && L.length != null) - return L.index / L.length; - if (L.progress != null) - return L.progress; - })) : t(14, K = null), K ? (t(15, $ = K[K.length - 1]), X && ($ === 0 ? t(16, X.style.transition = "0", X) : t(16, X.style.transition = "150ms", X))) : t(15, $ = void 0)), l.$$.dirty[0] & /*status*/ - 16 && (c === "pending" ? we() : T()), l.$$.dirty[0] & /*el, scroll_to_output, status, autoscroll*/ - 20979728 && z && d && (c === "pending" || c === "complete") && yc(z, v), l.$$.dirty[0] & /*status, message*/ + 436207617 && (s === null && t(0, s = I), s != null && I !== s && (t(28, B = (performance.now() - q) / 1e3 + s), t(19, de = B.toFixed(1)), t(27, I = s))), l.$$.dirty[0] & /*eta_from_start, timer_diff*/ + 335544320 && t(17, W = B === null || B <= 0 || !R ? null : Math.min(R / B, 1)), l.$$.dirty[0] & /*progress*/ + 128 && m != null && t(18, ee = !1), l.$$.dirty[0] & /*progress, progress_level, progress_bar, last_progress_level*/ + 114816 && (m != null ? t(14, H = m.map((A) => { + if (A.index != null && A.length != null) + return A.index / A.length; + if (A.progress != null) + return A.progress; + })) : t(14, H = null), H ? (t(15, le = H[H.length - 1]), X && (le === 0 ? t(16, X.style.transition = "0", X) : t(16, X.style.transition = "150ms", X))) : t(15, le = void 0)), l.$$.dirty[0] & /*status*/ + 16 && (c === "pending" ? ae() : L()), l.$$.dirty[0] & /*el, scroll_to_output, status, autoscroll*/ + 20979728 && z && _ && (c === "pending" || c === "complete") && yc(z, y), l.$$.dirty[0] & /*status, message*/ 8388624, l.$$.dirty[0] & /*timer_diff*/ - 67108864 && t(20, n = F.toFixed(1)); + 67108864 && t(20, n = R.toFixed(1)); }, [ s, r, f, u, c, - _, + d, h, - b, - g, + m, w, - p, - C, - E, + k, + g, + S, + M, z, - K, - $, + H, + le, X, - N, - se, - ae, + W, + ee, + de, n, a, - d, - m, - v, + _, + b, + y, q, - F, - j, - D, + R, + I, + B, o, i, - fe, - Ye, - We + Ae, + Le, + Ce ]; } class Sc extends nc { @@ -3601,29 +3601,29 @@ class Sc extends nc { } } const { setContext: g1, getContext: zc } = window.__gradio__svelte__internal, qc = "WORKER_PROXY_CONTEXT_KEY"; -function ps() { +function vs() { return zc(qc); } -function Mc(l) { +function Ec(l) { return l.host === window.location.host || l.host === "localhost:7860" || l.host === "127.0.0.1:7860" || // Ref: https://github.com/gradio-app/gradio/blob/v3.32.0/js/app/src/Index.svelte#L194 l.host === "lite.local"; } -function ks(l, e) { +function ys(l, e) { const t = e.toLowerCase(); for (const [n, i] of Object.entries(l)) if (n.toLowerCase() === t) return i; } -function vs(l) { +function Cs(l) { if (l == null) return !1; const e = new URL(l, window.location.href); - return !(!Mc(e) || e.protocol !== "http:" && e.protocol !== "https:"); + return !(!Ec(e) || e.protocol !== "http:" && e.protocol !== "https:"); } -async function Ec(l) { - if (l == null || !vs(l)) +async function Mc(l) { + if (l == null || !Cs(l)) return l; - const e = ps(); + const e = vs(); if (e == null) return l; const n = new URL(l, window.location.href).pathname; @@ -3636,41 +3636,41 @@ async function Ec(l) { if (i.status !== 200) throw new Error(`Failed to get file ${n} from the Wasm worker.`); const o = new Blob([i.body], { - type: ks(i.headers, "content-type") + type: ys(i.headers, "content-type") }); return URL.createObjectURL(o); }); } const { - SvelteComponent: Ac, - assign: Gn, - check_outros: ys, - compute_rest_props: fo, - create_slot: ci, - detach: fl, - element: Cs, - empty: Ss, - exclude_internal_props: Lc, - get_all_dirty_from_scope: _i, - get_slot_changes: di, - get_spread_update: zs, - group_outros: qs, - init: Dc, - insert: ul, - listen: Ms, - prevent_default: Tc, - safe_not_equal: Bc, - set_attributes: Jn, - transition_in: vt, - transition_out: yt, - update_slot_base: hi + SvelteComponent: Bc, + assign: xn, + check_outros: Ss, + compute_rest_props: uo, + create_slot: _i, + detach: _l, + element: zs, + empty: qs, + exclude_internal_props: Ac, + get_all_dirty_from_scope: di, + get_slot_changes: hi, + get_spread_update: Es, + group_outros: Ms, + init: Lc, + insert: dl, + listen: Bs, + prevent_default: Dc, + safe_not_equal: Tc, + set_attributes: $n, + transition_in: zt, + transition_out: qt, + update_slot_base: mi } = window.__gradio__svelte__internal, { createEventDispatcher: jc } = window.__gradio__svelte__internal; function Ic(l) { let e, t, n, i, o; const a = ( /*#slots*/ l[8].default - ), r = ci( + ), r = _i( a, l, /*$$scope*/ @@ -3694,13 +3694,13 @@ function Ic(l) { l[6] ], f = {}; for (let u = 0; u < s.length; u += 1) - f = Gn(f, s[u]); + f = xn(f, s[u]); return { c() { - e = Cs("a"), r && r.c(), Jn(e, f); + e = zs("a"), r && r.c(), $n(e, f); }, m(u, c) { - ul(u, e, c), r && r.m(e, null), n = !0, i || (o = Ms( + dl(u, e, c), r && r.m(e, null), n = !0, i || (o = Bs( e, "click", /*dispatch*/ @@ -3709,24 +3709,24 @@ function Ic(l) { }, p(u, c) { r && r.p && (!n || c & /*$$scope*/ - 128) && hi( + 128) && mi( r, a, u, /*$$scope*/ u[7], - n ? di( + n ? hi( a, /*$$scope*/ u[7], c, null - ) : _i( + ) : di( /*$$scope*/ u[7] ), null - ), Jn(e, f = zs(s, [ + ), $n(e, f = Es(s, [ (!n || c & /*href*/ 1) && { href: ( /*href*/ @@ -3745,13 +3745,13 @@ function Ic(l) { ])); }, i(u) { - n || (vt(r, u), n = !0); + n || (zt(r, u), n = !0); }, o(u) { - yt(r, u), n = !1; + qt(r, u), n = !1; }, d(u) { - u && fl(e), r && r.d(u), i = !1, o(); + u && _l(e), r && r.d(u), i = !1, o(); } }; } @@ -3766,25 +3766,25 @@ function Rc(l) { } return e = r(l), t = a[e] = o[e](l), { c() { - t.c(), n = Ss(); + t.c(), n = qs(); }, m(s, f) { - a[e].m(s, f), ul(s, n, f), i = !0; + a[e].m(s, f), dl(s, n, f), i = !0; }, p(s, f) { let u = e; - e = r(s), e === u ? a[e].p(s, f) : (qs(), yt(a[u], 1, 1, () => { + e = r(s), e === u ? a[e].p(s, f) : (Ms(), qt(a[u], 1, 1, () => { a[u] = null; - }), ys(), t = a[e], t ? t.p(s, f) : (t = a[e] = o[e](s), t.c()), vt(t, 1), t.m(n.parentNode, n)); + }), Ss(), t = a[e], t ? t.p(s, f) : (t = a[e] = o[e](s), t.c()), zt(t, 1), t.m(n.parentNode, n)); }, i(s) { - i || (vt(t), i = !0); + i || (zt(t), i = !0); }, o(s) { - yt(t), i = !1; + qt(t), i = !1; }, d(s) { - s && fl(n), a[e].d(s); + s && _l(n), a[e].d(s); } }; } @@ -3793,7 +3793,7 @@ function Fc(l) { const o = ( /*#slots*/ l[8].default - ), a = ci( + ), a = _i( o, l, /*$$scope*/ @@ -3809,37 +3809,37 @@ function Fc(l) { ) } ], s = {}; for (let f = 0; f < r.length; f += 1) - s = Gn(s, r[f]); + s = xn(s, r[f]); return { c() { - e = Cs("a"), a && a.c(), Jn(e, s); + e = zs("a"), a && a.c(), $n(e, s); }, m(f, u) { - ul(f, e, u), a && a.m(e, null), t = !0, n || (i = Ms(e, "click", Tc( + dl(f, e, u), a && a.m(e, null), t = !0, n || (i = Bs(e, "click", Dc( /*wasm_click_handler*/ l[5] )), n = !0); }, p(f, u) { a && a.p && (!t || u & /*$$scope*/ - 128) && hi( + 128) && mi( a, o, f, /*$$scope*/ f[7], - t ? di( + t ? hi( o, /*$$scope*/ f[7], u, null - ) : _i( + ) : di( /*$$scope*/ f[7] ), null - ), Jn(e, s = zs(r, [ + ), $n(e, s = Es(r, [ u & /*$$restProps*/ 64 && /*$$restProps*/ f[6], @@ -3851,13 +3851,13 @@ function Fc(l) { ])); }, i(f) { - t || (vt(a, f), t = !0); + t || (zt(a, f), t = !0); }, o(f) { - yt(a, f), t = !1; + qt(a, f), t = !1; }, d(f) { - f && fl(e), a && a.d(f), n = !1, i(); + f && _l(e), a && a.d(f), n = !1, i(); } }; } @@ -3866,7 +3866,7 @@ function Hc(l) { const t = ( /*#slots*/ l[8].default - ), n = ci( + ), n = _i( t, l, /*$$scope*/ @@ -3882,19 +3882,19 @@ function Hc(l) { }, p(i, o) { n && n.p && (!e || o & /*$$scope*/ - 128) && hi( + 128) && mi( n, t, i, /*$$scope*/ i[7], - e ? di( + e ? hi( t, /*$$scope*/ i[7], o, null - ) : _i( + ) : di( /*$$scope*/ i[7] ), @@ -3902,10 +3902,10 @@ function Hc(l) { ); }, i(i) { - e || (vt(n, i), e = !0); + e || (zt(n, i), e = !0); }, o(i) { - yt(n, i), e = !1; + qt(n, i), e = !1; }, d(i) { n && n.d(i); @@ -3918,125 +3918,125 @@ function Uc(l) { function s(f, u) { return u & /*href*/ 1 && (e = null), e == null && (e = !!/*worker_proxy*/ - (f[4] && vs( + (f[4] && Cs( /*href*/ f[0] ))), e ? 0 : 1; } return t = s(l, -1), n = r[t] = a[t](l), { c() { - n.c(), i = Ss(); + n.c(), i = qs(); }, m(f, u) { - r[t].m(f, u), ul(f, i, u), o = !0; + r[t].m(f, u), dl(f, i, u), o = !0; }, p(f, [u]) { let c = t; - t = s(f, u), t === c ? r[t].p(f, u) : (qs(), yt(r[c], 1, 1, () => { + t = s(f, u), t === c ? r[t].p(f, u) : (Ms(), qt(r[c], 1, 1, () => { r[c] = null; - }), ys(), n = r[t], n ? n.p(f, u) : (n = r[t] = a[t](f), n.c()), vt(n, 1), n.m(i.parentNode, i)); + }), Ss(), n = r[t], n ? n.p(f, u) : (n = r[t] = a[t](f), n.c()), zt(n, 1), n.m(i.parentNode, i)); }, i(f) { - o || (vt(n), o = !0); + o || (zt(n), o = !0); }, o(f) { - yt(n), o = !1; + qt(n), o = !1; }, d(f) { - f && fl(i), r[t].d(f); + f && _l(i), r[t].d(f); } }; } function Nc(l, e, t) { const n = ["href", "download"]; - let i = fo(e, n), { $$slots: o = {}, $$scope: a } = e; - var r = this && this.__awaiter || function(h, m, b, g) { - function w(p) { - return p instanceof b ? p : new b(function(C) { - C(p); + let i = uo(e, n), { $$slots: o = {}, $$scope: a } = e; + var r = this && this.__awaiter || function(h, b, m, w) { + function k(g) { + return g instanceof m ? g : new m(function(S) { + S(g); }); } - return new (b || (b = Promise))(function(p, C) { - function E(k) { + return new (m || (m = Promise))(function(g, S) { + function M(v) { try { - z(g.next(k)); + z(w.next(v)); } catch (q) { - C(q); + S(q); } } - function v(k) { + function y(v) { try { - z(g.throw(k)); + z(w.throw(v)); } catch (q) { - C(q); + S(q); } } - function z(k) { - k.done ? p(k.value) : w(k.value).then(E, v); + function z(v) { + v.done ? g(v.value) : k(v.value).then(M, y); } - z((g = g.apply(h, m || [])).next()); + z((w = w.apply(h, b || [])).next()); }); }; let { href: s = void 0 } = e, { download: f } = e; const u = jc(); let c = !1; - const d = ps(); - function _() { + const _ = vs(); + function d() { return r(this, void 0, void 0, function* () { if (c) return; if (u("click"), s == null) throw new Error("href is not defined."); - if (d == null) + if (_ == null) throw new Error("Wasm worker proxy is not available."); - const m = new URL(s, window.location.href).pathname; - t(2, c = !0), d.httpRequest({ + const b = new URL(s, window.location.href).pathname; + t(2, c = !0), _.httpRequest({ method: "GET", - path: m, + path: b, headers: {}, query_string: "" - }).then((b) => { - if (b.status !== 200) - throw new Error(`Failed to get file ${m} from the Wasm worker.`); - const g = new Blob( - [b.body], + }).then((m) => { + if (m.status !== 200) + throw new Error(`Failed to get file ${b} from the Wasm worker.`); + const w = new Blob( + [m.body], { - type: ks(b.headers, "content-type") + type: ys(m.headers, "content-type") } - ), w = URL.createObjectURL(g), p = document.createElement("a"); - p.href = w, p.download = f, p.click(), URL.revokeObjectURL(w); + ), k = URL.createObjectURL(w), g = document.createElement("a"); + g.href = k, g.download = f, g.click(), URL.revokeObjectURL(k); }).finally(() => { t(2, c = !1); }); }); } return l.$$set = (h) => { - e = Gn(Gn({}, e), Lc(h)), t(6, i = fo(e, n)), "href" in h && t(0, s = h.href), "download" in h && t(1, f = h.download), "$$scope" in h && t(7, a = h.$$scope); + e = xn(xn({}, e), Ac(h)), t(6, i = uo(e, n)), "href" in h && t(0, s = h.href), "download" in h && t(1, f = h.download), "$$scope" in h && t(7, a = h.$$scope); }, [ s, f, c, u, - d, _, + d, i, a, o ]; } -class Oc extends Ac { +class Oc extends Bc { constructor(e) { - super(), Dc(this, e, Nc, Uc, Bc, { href: 0, download: 1 }); + super(), Lc(this, e, Nc, Uc, Tc, { href: 0, download: 1 }); } } -var Xc = Object.defineProperty, Yc = (l, e, t) => e in l ? Xc(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t, Ve = (l, e, t) => (Yc(l, typeof e != "symbol" ? e + "" : e, t), t), Es = (l, e, t) => { +var Xc = Object.defineProperty, Yc = (l, e, t) => e in l ? Xc(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t, Pe = (l, e, t) => (Yc(l, typeof e != "symbol" ? e + "" : e, t), t), As = (l, e, t) => { if (!e.has(l)) throw TypeError("Cannot " + t); -}, $t = (l, e, t) => (Es(l, e, "read from private field"), t ? t.call(l) : e.get(l)), Wc = (l, e, t) => { +}, $t = (l, e, t) => (As(l, e, "read from private field"), t ? t.call(l) : e.get(l)), Wc = (l, e, t) => { if (e.has(l)) throw TypeError("Cannot add the same private member more than once"); e instanceof WeakSet ? e.add(l) : e.set(l, t); -}, Vc = (l, e, t, n) => (Es(l, e, "write to private field"), e.set(l, t), t), tt; +}, Vc = (l, e, t, n) => (As(l, e, "write to private field"), e.set(l, t), t), lt; new Intl.Collator(0, { numeric: 1 }).compare; async function Pc(l, e) { return l.map( @@ -4061,7 +4061,7 @@ class Zc { mime_type: r, alt_text: s }) { - Ve(this, "path"), Ve(this, "url"), Ve(this, "orig_name"), Ve(this, "size"), Ve(this, "blob"), Ve(this, "is_stream"), Ve(this, "mime_type"), Ve(this, "alt_text"), Ve(this, "meta", { _type: "gradio.FileData" }), this.path = e, this.url = t, this.orig_name = n, this.size = i, this.blob = t ? void 0 : o, this.is_stream = a, this.mime_type = r, this.alt_text = s; + Pe(this, "path"), Pe(this, "url"), Pe(this, "orig_name"), Pe(this, "size"), Pe(this, "blob"), Pe(this, "is_stream"), Pe(this, "mime_type"), Pe(this, "alt_text"), Pe(this, "meta", { _type: "gradio.FileData" }), this.path = e, this.url = t, this.orig_name = n, this.size = i, this.blob = t ? void 0 : o, this.is_stream = a, this.mime_type = r, this.alt_text = s; } } typeof process < "u" && process.versions && process.versions.node; @@ -4070,7 +4070,7 @@ class w1 extends TransformStream { constructor(e = { allowCR: !1 }) { super({ transform: (t, n) => { - for (t = $t(this, tt) + t; ; ) { + for (t = $t(this, lt) + t; ; ) { const i = t.indexOf(` `), o = e.allowCR ? t.indexOf("\r") : -1; if (o !== -1 && o !== t.length - 1 && (i === -1 || i - 1 > o)) { @@ -4082,35 +4082,35 @@ class w1 extends TransformStream { const a = t[i - 1] === "\r" ? i - 1 : i; n.enqueue(t.slice(0, a)), t = t.slice(i + 1); } - Vc(this, tt, t); + Vc(this, lt, t); }, flush: (t) => { - if ($t(this, tt) === "") + if ($t(this, lt) === "") return; - const n = e.allowCR && $t(this, tt).endsWith("\r") ? $t(this, tt).slice(0, -1) : $t(this, tt); + const n = e.allowCR && $t(this, lt).endsWith("\r") ? $t(this, lt).slice(0, -1) : $t(this, lt); t.enqueue(n); } - }), Wc(this, tt, ""); + }), Wc(this, lt, ""); } } -tt = /* @__PURE__ */ new WeakMap(); +lt = /* @__PURE__ */ new WeakMap(); const { SvelteComponent: Kc, - append: ge, - attr: ht, - detach: As, - element: mt, + append: _e, + attr: bt, + detach: Ls, + element: gt, init: Gc, - insert: Ls, - noop: uo, + insert: Ds, + noop: co, safe_not_equal: Jc, - set_data: Qn, - set_style: Bl, - space: ni, - text: Yt, - toggle_class: co + set_data: el, + set_style: Rl, + space: li, + text: Wt, + toggle_class: _o } = window.__gradio__svelte__internal, { onMount: Qc, createEventDispatcher: xc, onDestroy: $c } = window.__gradio__svelte__internal; -function _o(l) { +function ho(l) { let e, t, n, i, o = an( /*file_to_display*/ l[2] @@ -4120,29 +4120,29 @@ function _o(l) { ), c; return { c() { - e = mt("div"), t = mt("span"), n = mt("div"), i = mt("progress"), a = Yt(o), s = ni(), f = mt("span"), c = Yt(u), Bl(i, "visibility", "hidden"), Bl(i, "height", "0"), Bl(i, "width", "0"), i.value = r = an( + e = gt("div"), t = gt("span"), n = gt("div"), i = gt("progress"), a = Wt(o), s = li(), f = gt("span"), c = Wt(u), Rl(i, "visibility", "hidden"), Rl(i, "height", "0"), Rl(i, "width", "0"), i.value = r = an( /*file_to_display*/ l[2] - ), ht(i, "max", "100"), ht(i, "class", "svelte-cr2edf"), ht(n, "class", "progress-bar svelte-cr2edf"), ht(f, "class", "file-name svelte-cr2edf"), ht(e, "class", "file svelte-cr2edf"); + ), bt(i, "max", "100"), bt(i, "class", "svelte-cr2edf"), bt(n, "class", "progress-bar svelte-cr2edf"), bt(f, "class", "file-name svelte-cr2edf"), bt(e, "class", "file svelte-cr2edf"); }, - m(d, _) { - Ls(d, e, _), ge(e, t), ge(t, n), ge(n, i), ge(i, a), ge(e, s), ge(e, f), ge(f, c); + m(_, d) { + Ds(_, e, d), _e(e, t), _e(t, n), _e(n, i), _e(i, a), _e(e, s), _e(e, f), _e(f, c); }, - p(d, _) { - _ & /*file_to_display*/ + p(_, d) { + d & /*file_to_display*/ 4 && o !== (o = an( /*file_to_display*/ - d[2] - ) + "") && Qn(a, o), _ & /*file_to_display*/ + _[2] + ) + "") && el(a, o), d & /*file_to_display*/ 4 && r !== (r = an( /*file_to_display*/ - d[2] - )) && (i.value = r), _ & /*file_to_display*/ + _[2] + )) && (i.value = r), d & /*file_to_display*/ 4 && u !== (u = /*file_to_display*/ - d[2].orig_name + "") && Qn(c, u); + _[2].orig_name + "") && el(c, u); }, - d(d) { - d && As(e); + d(_) { + _ && Ls(e); } }; } @@ -4155,38 +4155,38 @@ function e_(l) { l[0].length > 1 ? "files" : "file" ), s, f, u, c = ( /*file_to_display*/ - l[2] && _o(l) + l[2] && ho(l) ); return { c() { - e = mt("div"), t = mt("span"), n = Yt("Uploading "), o = Yt(i), a = ni(), s = Yt(r), f = Yt("..."), u = ni(), c && c.c(), ht(t, "class", "uploading svelte-cr2edf"), ht(e, "class", "wrap svelte-cr2edf"), co( + e = gt("div"), t = gt("span"), n = Wt("Uploading "), o = Wt(i), a = li(), s = Wt(r), f = Wt("..."), u = li(), c && c.c(), bt(t, "class", "uploading svelte-cr2edf"), bt(e, "class", "wrap svelte-cr2edf"), _o( e, "progress", /*progress*/ l[1] ); }, - m(d, _) { - Ls(d, e, _), ge(e, t), ge(t, n), ge(t, o), ge(t, a), ge(t, s), ge(t, f), ge(e, u), c && c.m(e, null); + m(_, d) { + Ds(_, e, d), _e(e, t), _e(t, n), _e(t, o), _e(t, a), _e(t, s), _e(t, f), _e(e, u), c && c.m(e, null); }, - p(d, [_]) { - _ & /*files_with_progress*/ + p(_, [d]) { + d & /*files_with_progress*/ 1 && i !== (i = /*files_with_progress*/ - d[0].length + "") && Qn(o, i), _ & /*files_with_progress*/ + _[0].length + "") && el(o, i), d & /*files_with_progress*/ 1 && r !== (r = /*files_with_progress*/ - d[0].length > 1 ? "files" : "file") && Qn(s, r), /*file_to_display*/ - d[2] ? c ? c.p(d, _) : (c = _o(d), c.c(), c.m(e, null)) : c && (c.d(1), c = null), _ & /*progress*/ - 2 && co( + _[0].length > 1 ? "files" : "file") && el(s, r), /*file_to_display*/ + _[2] ? c ? c.p(_, d) : (c = ho(_), c.c(), c.m(e, null)) : c && (c.d(1), c = null), d & /*progress*/ + 2 && _o( e, "progress", /*progress*/ - d[1] + _[1] ); }, - i: uo, - o: uo, - d(d) { - d && As(e), c && c.d(); + i: co, + o: co, + d(_) { + _ && Ls(e), c && c.d(); } }; } @@ -4200,57 +4200,57 @@ function t_(l) { }), document.documentElement.style.setProperty("--upload-progress-width", (e / l.length).toFixed(2) + "%"), e / l.length; } function n_(l, e, t) { - var n = this && this.__awaiter || function(m, b, g, w) { - function p(C) { - return C instanceof g ? C : new g(function(E) { - E(C); + var n = this && this.__awaiter || function(b, m, w, k) { + function g(S) { + return S instanceof w ? S : new w(function(M) { + M(S); }); } - return new (g || (g = Promise))(function(C, E) { - function v(q) { + return new (w || (w = Promise))(function(S, M) { + function y(q) { try { - k(w.next(q)); - } catch (F) { - E(F); + v(k.next(q)); + } catch (R) { + M(R); } } function z(q) { try { - k(w.throw(q)); - } catch (F) { - E(F); + v(k.throw(q)); + } catch (R) { + M(R); } } - function k(q) { - q.done ? C(q.value) : p(q.value).then(v, z); + function v(q) { + q.done ? S(q.value) : g(q.value).then(y, z); } - k((w = w.apply(m, b || [])).next()); + v((k = k.apply(b, m || [])).next()); }); }; - let { upload_id: i } = e, { root: o } = e, { files: a } = e, { stream_handler: r } = e, s, f = !1, u, c, d = a.map((m) => Object.assign(Object.assign({}, m), { progress: 0 })); - const _ = xc(); - function h(m, b) { - t(0, d = d.map((g) => (g.orig_name === m && (g.progress += b), g))); + let { upload_id: i } = e, { root: o } = e, { files: a } = e, { stream_handler: r } = e, s, f = !1, u, c, _ = a.map((b) => Object.assign(Object.assign({}, b), { progress: 0 })); + const d = xc(); + function h(b, m) { + t(0, _ = _.map((w) => (w.orig_name === b && (w.progress += m), w))); } return Qc(() => n(void 0, void 0, void 0, function* () { if (s = yield r(new URL(`${o}/upload_progress?upload_id=${i}`)), s == null) throw new Error("Event source is not defined"); - s.onmessage = function(m) { + s.onmessage = function(b) { return n(this, void 0, void 0, function* () { - const b = JSON.parse(m.data); - f || t(1, f = !0), b.msg === "done" ? (s == null || s.close(), _("done")) : (t(7, u = b), h(b.orig_name, b.chunk_size)); + const m = JSON.parse(b.data); + f || t(1, f = !0), m.msg === "done" ? (s == null || s.close(), d("done")) : (t(7, u = m), h(m.orig_name, m.chunk_size)); }); }; })), $c(() => { (s != null || s != null) && s.close(); - }), l.$$set = (m) => { - "upload_id" in m && t(3, i = m.upload_id), "root" in m && t(4, o = m.root), "files" in m && t(5, a = m.files), "stream_handler" in m && t(6, r = m.stream_handler); + }), l.$$set = (b) => { + "upload_id" in b && t(3, i = b.upload_id), "root" in b && t(4, o = b.root), "files" in b && t(5, a = b.files), "stream_handler" in b && t(6, r = b.stream_handler); }, l.$$.update = () => { l.$$.dirty & /*files_with_progress*/ - 1 && t_(d), l.$$.dirty & /*current_file_upload, files_with_progress*/ - 129 && t(2, c = u || d[0]); + 1 && t_(_), l.$$.dirty & /*current_file_upload, files_with_progress*/ + 129 && t(2, c = u || _[0]); }, [ - d, + _, f, c, i, @@ -4272,42 +4272,42 @@ class l_ extends Kc { } const { SvelteComponent: i_, - append: ho, - attr: oe, + append: mo, + attr: se, binding_callbacks: o_, - bubble: ft, - check_outros: Ds, + bubble: ct, + check_outros: Ts, create_component: s_, - create_slot: Ts, + create_slot: js, destroy_component: a_, - detach: cl, - element: li, - empty: Bs, - get_all_dirty_from_scope: js, - get_slot_changes: Is, - group_outros: Rs, + detach: hl, + element: ii, + empty: Is, + get_all_dirty_from_scope: Rs, + get_slot_changes: Fs, + group_outros: Hs, init: r_, - insert: _l, - listen: ve, + insert: ml, + listen: we, mount_component: f_, - prevent_default: ut, + prevent_default: _t, run_all: u_, safe_not_equal: c_, - set_style: Fs, + set_style: Us, space: __, - stop_propagation: ct, - toggle_class: ne, - transition_in: it, - transition_out: Ct, - update_slot_base: Hs + stop_propagation: dt, + toggle_class: te, + transition_in: st, + transition_out: Et, + update_slot_base: Ns } = window.__gradio__svelte__internal, { createEventDispatcher: d_, tick: h_ } = window.__gradio__svelte__internal; function m_(l) { let e, t, n, i, o, a, r, s, f, u, c; - const d = ( + const _ = ( /*#slots*/ l[26].default - ), _ = Ts( - d, + ), d = js( + _, l, /*$$scope*/ l[25], @@ -4315,93 +4315,93 @@ function m_(l) { ); return { c() { - e = li("button"), _ && _.c(), t = __(), n = li("input"), oe(n, "aria-label", "file upload"), oe(n, "data-testid", "file-upload"), oe(n, "type", "file"), oe(n, "accept", i = /*accept_file_types*/ + e = ii("button"), d && d.c(), t = __(), n = ii("input"), se(n, "aria-label", "file upload"), se(n, "data-testid", "file-upload"), se(n, "type", "file"), se(n, "accept", i = /*accept_file_types*/ l[16] || void 0), n.multiple = o = /*file_count*/ - l[6] === "multiple" || void 0, oe(n, "webkitdirectory", a = /*file_count*/ - l[6] === "directory" || void 0), oe(n, "mozdirectory", r = /*file_count*/ - l[6] === "directory" || void 0), oe(n, "class", "svelte-1s26xmt"), oe(e, "tabindex", s = /*hidden*/ - l[9] ? -1 : 0), oe(e, "class", "svelte-1s26xmt"), ne( + l[6] === "multiple" || void 0, se(n, "webkitdirectory", a = /*file_count*/ + l[6] === "directory" || void 0), se(n, "mozdirectory", r = /*file_count*/ + l[6] === "directory" || void 0), se(n, "class", "svelte-1s26xmt"), se(e, "tabindex", s = /*hidden*/ + l[9] ? -1 : 0), se(e, "class", "svelte-1s26xmt"), te( e, "hidden", /*hidden*/ l[9] - ), ne( + ), te( e, "center", /*center*/ l[4] - ), ne( + ), te( e, "boundedheight", /*boundedheight*/ l[3] - ), ne( + ), te( e, "flex", /*flex*/ l[5] - ), ne( + ), te( e, "disable_click", /*disable_click*/ l[7] - ), Fs(e, "height", "100%"); + ), Us(e, "height", "100%"); }, - m(h, m) { - _l(h, e, m), _ && _.m(e, null), ho(e, t), ho(e, n), l[34](n), f = !0, u || (c = [ - ve( + m(h, b) { + ml(h, e, b), d && d.m(e, null), mo(e, t), mo(e, n), l[34](n), f = !0, u || (c = [ + we( n, "change", /*load_files_from_upload*/ l[18] ), - ve(e, "drag", ct(ut( + we(e, "drag", dt(_t( /*drag_handler*/ l[27] ))), - ve(e, "dragstart", ct(ut( + we(e, "dragstart", dt(_t( /*dragstart_handler*/ l[28] ))), - ve(e, "dragend", ct(ut( + we(e, "dragend", dt(_t( /*dragend_handler*/ l[29] ))), - ve(e, "dragover", ct(ut( + we(e, "dragover", dt(_t( /*dragover_handler*/ l[30] ))), - ve(e, "dragenter", ct(ut( + we(e, "dragenter", dt(_t( /*dragenter_handler*/ l[31] ))), - ve(e, "dragleave", ct(ut( + we(e, "dragleave", dt(_t( /*dragleave_handler*/ l[32] ))), - ve(e, "drop", ct(ut( + we(e, "drop", dt(_t( /*drop_handler*/ l[33] ))), - ve( + we( e, "click", /*open_file_upload*/ l[13] ), - ve( + we( e, "drop", /*loadFilesFromDrop*/ l[19] ), - ve( + we( e, "dragenter", /*updateDragging*/ l[17] ), - ve( + we( e, "dragleave", /*updateDragging*/ @@ -4409,61 +4409,61 @@ function m_(l) { ) ], u = !0); }, - p(h, m) { - _ && _.p && (!f || m[0] & /*$$scope*/ - 33554432) && Hs( - _, + p(h, b) { + d && d.p && (!f || b[0] & /*$$scope*/ + 33554432) && Ns( d, + _, h, /*$$scope*/ h[25], - f ? Is( - d, + f ? Fs( + _, /*$$scope*/ h[25], - m, + b, null - ) : js( + ) : Rs( /*$$scope*/ h[25] ), null - ), (!f || m[0] & /*accept_file_types*/ + ), (!f || b[0] & /*accept_file_types*/ 65536 && i !== (i = /*accept_file_types*/ - h[16] || void 0)) && oe(n, "accept", i), (!f || m[0] & /*file_count*/ + h[16] || void 0)) && se(n, "accept", i), (!f || b[0] & /*file_count*/ 64 && o !== (o = /*file_count*/ - h[6] === "multiple" || void 0)) && (n.multiple = o), (!f || m[0] & /*file_count*/ + h[6] === "multiple" || void 0)) && (n.multiple = o), (!f || b[0] & /*file_count*/ 64 && a !== (a = /*file_count*/ - h[6] === "directory" || void 0)) && oe(n, "webkitdirectory", a), (!f || m[0] & /*file_count*/ + h[6] === "directory" || void 0)) && se(n, "webkitdirectory", a), (!f || b[0] & /*file_count*/ 64 && r !== (r = /*file_count*/ - h[6] === "directory" || void 0)) && oe(n, "mozdirectory", r), (!f || m[0] & /*hidden*/ + h[6] === "directory" || void 0)) && se(n, "mozdirectory", r), (!f || b[0] & /*hidden*/ 512 && s !== (s = /*hidden*/ - h[9] ? -1 : 0)) && oe(e, "tabindex", s), (!f || m[0] & /*hidden*/ - 512) && ne( + h[9] ? -1 : 0)) && se(e, "tabindex", s), (!f || b[0] & /*hidden*/ + 512) && te( e, "hidden", /*hidden*/ h[9] - ), (!f || m[0] & /*center*/ - 16) && ne( + ), (!f || b[0] & /*center*/ + 16) && te( e, "center", /*center*/ h[4] - ), (!f || m[0] & /*boundedheight*/ - 8) && ne( + ), (!f || b[0] & /*boundedheight*/ + 8) && te( e, "boundedheight", /*boundedheight*/ h[3] - ), (!f || m[0] & /*flex*/ - 32) && ne( + ), (!f || b[0] & /*flex*/ + 32) && te( e, "flex", /*flex*/ h[5] - ), (!f || m[0] & /*disable_click*/ - 128) && ne( + ), (!f || b[0] & /*disable_click*/ + 128) && te( e, "disable_click", /*disable_click*/ @@ -4471,41 +4471,41 @@ function m_(l) { ); }, i(h) { - f || (it(_, h), f = !0); + f || (st(d, h), f = !0); }, o(h) { - Ct(_, h), f = !1; + Et(d, h), f = !1; }, d(h) { - h && cl(e), _ && _.d(h), l[34](null), u = !1, u_(c); + h && hl(e), d && d.d(h), l[34](null), u = !1, u_(c); } }; } function b_(l) { let e, t, n = !/*hidden*/ - l[9] && mo(l); + l[9] && bo(l); return { c() { - n && n.c(), e = Bs(); + n && n.c(), e = Is(); }, m(i, o) { - n && n.m(i, o), _l(i, e, o), t = !0; + n && n.m(i, o), ml(i, e, o), t = !0; }, p(i, o) { /*hidden*/ - i[9] ? n && (Rs(), Ct(n, 1, 1, () => { + i[9] ? n && (Hs(), Et(n, 1, 1, () => { n = null; - }), Ds()) : n ? (n.p(i, o), o[0] & /*hidden*/ - 512 && it(n, 1)) : (n = mo(i), n.c(), it(n, 1), n.m(e.parentNode, e)); + }), Ts()) : n ? (n.p(i, o), o[0] & /*hidden*/ + 512 && st(n, 1)) : (n = bo(i), n.c(), st(n, 1), n.m(e.parentNode, e)); }, i(i) { - t || (it(n), t = !0); + t || (st(n), t = !0); }, o(i) { - Ct(n), t = !1; + Et(n), t = !1; }, d(i) { - i && cl(e), n && n.d(i); + i && hl(e), n && n.d(i); } }; } @@ -4514,7 +4514,7 @@ function g_(l) { const a = ( /*#slots*/ l[26].default - ), r = Ts( + ), r = js( a, l, /*$$scope*/ @@ -4523,31 +4523,31 @@ function g_(l) { ); return { c() { - e = li("button"), r && r.c(), oe(e, "tabindex", t = /*hidden*/ - l[9] ? -1 : 0), oe(e, "class", "svelte-1s26xmt"), ne( + e = ii("button"), r && r.c(), se(e, "tabindex", t = /*hidden*/ + l[9] ? -1 : 0), se(e, "class", "svelte-1s26xmt"), te( e, "hidden", /*hidden*/ l[9] - ), ne( + ), te( e, "center", /*center*/ l[4] - ), ne( + ), te( e, "boundedheight", /*boundedheight*/ l[3] - ), ne( + ), te( e, "flex", /*flex*/ l[5] - ), Fs(e, "height", "100%"); + ), Us(e, "height", "100%"); }, m(s, f) { - _l(s, e, f), r && r.m(e, null), n = !0, i || (o = ve( + ml(s, e, f), r && r.m(e, null), n = !0, i || (o = we( e, "click", /*paste_clipboard*/ @@ -4556,45 +4556,45 @@ function g_(l) { }, p(s, f) { r && r.p && (!n || f[0] & /*$$scope*/ - 33554432) && Hs( + 33554432) && Ns( r, a, s, /*$$scope*/ s[25], - n ? Is( + n ? Fs( a, /*$$scope*/ s[25], f, null - ) : js( + ) : Rs( /*$$scope*/ s[25] ), null ), (!n || f[0] & /*hidden*/ 512 && t !== (t = /*hidden*/ - s[9] ? -1 : 0)) && oe(e, "tabindex", t), (!n || f[0] & /*hidden*/ - 512) && ne( + s[9] ? -1 : 0)) && se(e, "tabindex", t), (!n || f[0] & /*hidden*/ + 512) && te( e, "hidden", /*hidden*/ s[9] ), (!n || f[0] & /*center*/ - 16) && ne( + 16) && te( e, "center", /*center*/ s[4] ), (!n || f[0] & /*boundedheight*/ - 8) && ne( + 8) && te( e, "boundedheight", /*boundedheight*/ s[3] ), (!n || f[0] & /*flex*/ - 32) && ne( + 32) && te( e, "flex", /*flex*/ @@ -4602,17 +4602,17 @@ function g_(l) { ); }, i(s) { - n || (it(r, s), n = !0); + n || (st(r, s), n = !0); }, o(s) { - Ct(r, s), n = !1; + Et(r, s), n = !1; }, d(s) { - s && cl(e), r && r.d(s), i = !1, o(); + s && hl(e), r && r.d(s), i = !1, o(); } }; } -function mo(l) { +function bo(l) { let e, t; return e = new l_({ props: { @@ -4653,10 +4653,10 @@ function mo(l) { n[11]), e.$set(o); }, i(n) { - t || (it(e.$$.fragment, n), t = !0); + t || (st(e.$$.fragment, n), t = !0); }, o(n) { - Ct(e.$$.fragment, n), t = !1; + Et(e.$$.fragment, n), t = !1; }, d(n) { a_(e, n); @@ -4678,25 +4678,25 @@ function w_(l) { } return e = r(l), t = a[e] = o[e](l), { c() { - t.c(), n = Bs(); + t.c(), n = Is(); }, m(s, f) { - a[e].m(s, f), _l(s, n, f), i = !0; + a[e].m(s, f), ml(s, n, f), i = !0; }, p(s, f) { let u = e; - e = r(s), e === u ? a[e].p(s, f) : (Rs(), Ct(a[u], 1, 1, () => { + e = r(s), e === u ? a[e].p(s, f) : (Hs(), Et(a[u], 1, 1, () => { a[u] = null; - }), Ds(), t = a[e], t ? t.p(s, f) : (t = a[e] = o[e](s), t.c()), it(t, 1), t.m(n.parentNode, n)); + }), Ts(), t = a[e], t ? t.p(s, f) : (t = a[e] = o[e](s), t.c()), st(t, 1), t.m(n.parentNode, n)); }, i(s) { - i || (it(t), i = !0); + i || (st(t), i = !0); }, o(s) { - Ct(t), i = !1; + Et(t), i = !1; }, d(s) { - s && cl(n), a[e].d(s); + s && hl(n), a[e].d(s); } }; } @@ -4717,167 +4717,167 @@ function p_(l, e, t) { } function k_(l, e, t) { let { $$slots: n = {}, $$scope: i } = e; - var o = this && this.__awaiter || function(S, H, G, y) { - function ee(ue) { - return ue instanceof G ? ue : new G(function(pe) { - pe(ue); + var o = this && this.__awaiter || function(p, F, Z, K) { + function C(Se) { + return Se instanceof Z ? Se : new Z(function(he) { + he(Se); }); } - return new (G || (G = Promise))(function(ue, pe) { - function A(V) { + return new (Z || (Z = Promise))(function(Se, he) { + function ze(D) { try { - O(y.next(V)); - } catch (Ee) { - pe(Ee); + E(K.next(D)); + } catch (Y) { + he(Y); } } - function B(V) { + function me(D) { try { - O(y.throw(V)); - } catch (Ee) { - pe(Ee); + E(K.throw(D)); + } catch (Y) { + he(Y); } } - function O(V) { - V.done ? ue(V.value) : ee(V.value).then(A, B); + function E(D) { + D.done ? Se(D.value) : C(D.value).then(ze, me); } - O((y = y.apply(S, H || [])).next()); + E((K = K.apply(p, F || [])).next()); }); }; - let { filetype: a = null } = e, { dragging: r = !1 } = e, { boundedheight: s = !0 } = e, { center: f = !0 } = e, { flex: u = !0 } = e, { file_count: c = "single" } = e, { disable_click: d = !1 } = e, { root: _ } = e, { hidden: h = !1 } = e, { format: m = "file" } = e, { uploading: b = !1 } = e, { hidden_upload: g = null } = e, { show_progress: w = !0 } = e, { max_file_size: p = null } = e, { upload: C } = e, { stream_handler: E } = e, v, z, k; - const q = d_(), F = ["image", "video", "audio", "text", "file"], j = (S) => S.startsWith(".") || S.endsWith("/*") ? S : F.includes(S) ? S + "/*" : "." + S; - function D() { + let { filetype: a = null } = e, { dragging: r = !1 } = e, { boundedheight: s = !0 } = e, { center: f = !0 } = e, { flex: u = !0 } = e, { file_count: c = "single" } = e, { disable_click: _ = !1 } = e, { root: d } = e, { hidden: h = !1 } = e, { format: b = "file" } = e, { uploading: m = !1 } = e, { hidden_upload: w = null } = e, { show_progress: k = !0 } = e, { max_file_size: g = null } = e, { upload: S } = e, { stream_handler: M } = e, y, z, v; + const q = d_(), R = ["image", "video", "audio", "text", "file"], I = (p) => p.startsWith(".") || p.endsWith("/*") ? p : R.includes(p) ? p + "/*" : "." + p; + function B() { t(20, r = !r); } - function N() { - navigator.clipboard.read().then((S) => o(this, void 0, void 0, function* () { - for (let H = 0; H < S.length; H++) { - const G = S[H].types.find((y) => y.startsWith("image/")); - if (G) { - S[H].getType(G).then((y) => o(this, void 0, void 0, function* () { - const ee = new File([y], `clipboard.${G.replace("image/", "")}`); - yield X([ee]); + function W() { + navigator.clipboard.read().then((p) => o(this, void 0, void 0, function* () { + for (let F = 0; F < p.length; F++) { + const Z = p[F].types.find((K) => K.startsWith("image/")); + if (Z) { + p[F].getType(Z).then((K) => o(this, void 0, void 0, function* () { + const C = new File([K], `clipboard.${Z.replace("image/", "")}`); + yield X([C]); })); break; } } })); } - function K() { - d || g && (t(2, g.value = "", g), g.click()); + function H() { + _ || w && (t(2, w.value = "", w), w.click()); } - function $(S) { + function le(p) { return o(this, void 0, void 0, function* () { - yield h_(), t(14, v = Math.random().toString(36).substring(2, 15)), t(1, b = !0); + yield h_(), t(14, y = Math.random().toString(36).substring(2, 15)), t(1, m = !0); try { - const H = yield C(S, _, v, p ?? 1 / 0); - return q("load", c === "single" ? H == null ? void 0 : H[0] : H), t(1, b = !1), H || []; - } catch (H) { - return q("error", H.message), t(1, b = !1), []; + const F = yield S(p, d, y, g ?? 1 / 0); + return q("load", c === "single" ? F == null ? void 0 : F[0] : F), t(1, m = !1), F || []; + } catch (F) { + return q("error", F.message), t(1, m = !1), []; } }); } - function X(S) { + function X(p) { return o(this, void 0, void 0, function* () { - if (!S.length) + if (!p.length) return; - let H = S.map((G) => new File([G], G instanceof File ? G.name : "file", { type: G.type })); - return t(15, z = yield Pc(H)), yield $(z); + let F = p.map((Z) => new File([Z], Z instanceof File ? Z.name : "file", { type: Z.type })); + return t(15, z = yield Pc(F)), yield le(z); }); } - function se(S) { + function ee(p) { return o(this, void 0, void 0, function* () { - const H = S.target; - if (H.files) - if (m != "blob") - yield X(Array.from(H.files)); + const F = p.target; + if (F.files) + if (b != "blob") + yield X(Array.from(F.files)); else { if (c === "single") { - q("load", H.files[0]); + q("load", F.files[0]); return; } - q("load", H.files); + q("load", F.files); } }); } - function we(S) { + function ae(p) { return o(this, void 0, void 0, function* () { - var H; - if (t(20, r = !1), !(!((H = S.dataTransfer) === null || H === void 0) && H.files)) return; - const G = Array.from(S.dataTransfer.files).filter((y) => { - const ee = "." + y.name.split(".").pop(); - return ee && p_(k, ee, y.type) || (ee && Array.isArray(a) ? a.includes(ee) : ee === a) ? !0 : (q("error", `Invalid file type only ${a} allowed.`), !1); + var F; + if (t(20, r = !1), !(!((F = p.dataTransfer) === null || F === void 0) && F.files)) return; + const Z = Array.from(p.dataTransfer.files).filter((K) => { + const C = "." + K.name.split(".").pop(); + return C && p_(v, C, K.type) || (C && Array.isArray(a) ? a.includes(C) : C === a) ? !0 : (q("error", `Invalid file type only ${a} allowed.`), !1); }); - yield X(G); + yield X(Z); }); } - function re(S) { - ft.call(this, l, S); + function ye(p) { + ct.call(this, l, p); } - function T(S) { - ft.call(this, l, S); + function L(p) { + ct.call(this, l, p); } - function ae(S) { - ft.call(this, l, S); + function de(p) { + ct.call(this, l, p); } - function fe(S) { - ft.call(this, l, S); + function Ae(p) { + ct.call(this, l, p); } - function Ye(S) { - ft.call(this, l, S); + function Le(p) { + ct.call(this, l, p); } - function We(S) { - ft.call(this, l, S); + function Ce(p) { + ct.call(this, l, p); } - function L(S) { - ft.call(this, l, S); + function A(p) { + ct.call(this, l, p); } - function M(S) { - o_[S ? "unshift" : "push"](() => { - g = S, t(2, g); + function Ve(p) { + o_[p ? "unshift" : "push"](() => { + w = p, t(2, w); }); } - return l.$$set = (S) => { - "filetype" in S && t(0, a = S.filetype), "dragging" in S && t(20, r = S.dragging), "boundedheight" in S && t(3, s = S.boundedheight), "center" in S && t(4, f = S.center), "flex" in S && t(5, u = S.flex), "file_count" in S && t(6, c = S.file_count), "disable_click" in S && t(7, d = S.disable_click), "root" in S && t(8, _ = S.root), "hidden" in S && t(9, h = S.hidden), "format" in S && t(21, m = S.format), "uploading" in S && t(1, b = S.uploading), "hidden_upload" in S && t(2, g = S.hidden_upload), "show_progress" in S && t(10, w = S.show_progress), "max_file_size" in S && t(22, p = S.max_file_size), "upload" in S && t(23, C = S.upload), "stream_handler" in S && t(11, E = S.stream_handler), "$$scope" in S && t(25, i = S.$$scope); + return l.$$set = (p) => { + "filetype" in p && t(0, a = p.filetype), "dragging" in p && t(20, r = p.dragging), "boundedheight" in p && t(3, s = p.boundedheight), "center" in p && t(4, f = p.center), "flex" in p && t(5, u = p.flex), "file_count" in p && t(6, c = p.file_count), "disable_click" in p && t(7, _ = p.disable_click), "root" in p && t(8, d = p.root), "hidden" in p && t(9, h = p.hidden), "format" in p && t(21, b = p.format), "uploading" in p && t(1, m = p.uploading), "hidden_upload" in p && t(2, w = p.hidden_upload), "show_progress" in p && t(10, k = p.show_progress), "max_file_size" in p && t(22, g = p.max_file_size), "upload" in p && t(23, S = p.upload), "stream_handler" in p && t(11, M = p.stream_handler), "$$scope" in p && t(25, i = p.$$scope); }, l.$$.update = () => { l.$$.dirty[0] & /*filetype*/ - 1 && (a == null ? t(16, k = null) : typeof a == "string" ? t(16, k = j(a)) : (t(0, a = a.map(j)), t(16, k = a.join(", ")))); + 1 && (a == null ? t(16, v = null) : typeof a == "string" ? t(16, v = I(a)) : (t(0, a = a.map(I)), t(16, v = a.join(", ")))); }, [ a, - b, - g, + m, + w, s, f, u, c, - d, _, + d, h, - w, - E, - N, - K, - v, - z, k, - D, - se, - we, + M, + W, + H, + y, + z, + v, + B, + ee, + ae, r, - m, - p, - C, + b, + g, + S, X, i, n, - re, - T, - ae, - fe, - Ye, - We, + ye, L, - M + de, + Ae, + Le, + Ce, + A, + Ve ]; } class v_ extends i_ { @@ -4925,55 +4925,55 @@ class v_ extends i_ { } const { SvelteComponent: y_, - append: bo, - attr: ie, + append: go, + attr: oe, detach: C_, init: S_, insert: z_, - noop: jl, + noop: Fl, safe_not_equal: q_, - set_style: $e, - svg_element: Il + set_style: tt, + svg_element: Hl } = window.__gradio__svelte__internal; -function M_(l) { +function E_(l) { let e, t, n; return { c() { - e = Il("svg"), t = Il("line"), n = Il("line"), ie(t, "x1", "4"), ie(t, "y1", "12"), ie(t, "x2", "20"), ie(t, "y2", "12"), $e(t, "fill", "none"), $e(t, "stroke-width", "2px"), ie(n, "x1", "12"), ie(n, "y1", "4"), ie(n, "x2", "12"), ie(n, "y2", "20"), $e(n, "fill", "none"), $e(n, "stroke-width", "2px"), ie(e, "width", "100%"), ie(e, "height", "100%"), ie(e, "viewBox", "0 0 24 24"), ie(e, "version", "1.1"), ie(e, "xmlns", "http://www.w3.org/2000/svg"), ie(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), ie(e, "xml:space", "preserve"), ie(e, "stroke", "currentColor"), $e(e, "fill-rule", "evenodd"), $e(e, "clip-rule", "evenodd"), $e(e, "stroke-linecap", "round"), $e(e, "stroke-linejoin", "round"); + e = Hl("svg"), t = Hl("line"), n = Hl("line"), oe(t, "x1", "4"), oe(t, "y1", "12"), oe(t, "x2", "20"), oe(t, "y2", "12"), tt(t, "fill", "none"), tt(t, "stroke-width", "2px"), oe(n, "x1", "12"), oe(n, "y1", "4"), oe(n, "x2", "12"), oe(n, "y2", "20"), tt(n, "fill", "none"), tt(n, "stroke-width", "2px"), oe(e, "width", "100%"), oe(e, "height", "100%"), oe(e, "viewBox", "0 0 24 24"), oe(e, "version", "1.1"), oe(e, "xmlns", "http://www.w3.org/2000/svg"), oe(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), oe(e, "xml:space", "preserve"), oe(e, "stroke", "currentColor"), tt(e, "fill-rule", "evenodd"), tt(e, "clip-rule", "evenodd"), tt(e, "stroke-linecap", "round"), tt(e, "stroke-linejoin", "round"); }, m(i, o) { - z_(i, e, o), bo(e, t), bo(e, n); + z_(i, e, o), go(e, t), go(e, n); }, - p: jl, - i: jl, - o: jl, + p: Fl, + i: Fl, + o: Fl, d(i) { i && C_(e); } }; } -class E_ extends y_ { +class M_ extends y_ { constructor(e) { - super(), S_(this, e, null, M_, q_, {}); + super(), S_(this, e, null, E_, q_, {}); } } const { - SvelteComponent: A_, - append: go, - attr: Rl, - bubble: wo, - create_component: L_, - destroy_component: D_, - detach: Us, - element: po, - init: T_, - insert: Ns, - listen: Fl, - mount_component: B_, + SvelteComponent: B_, + append: wo, + attr: Ul, + bubble: po, + create_component: A_, + destroy_component: L_, + detach: Os, + element: ko, + init: D_, + insert: Xs, + listen: Nl, + mount_component: T_, run_all: j_, safe_not_equal: I_, set_data: R_, - set_input_value: ko, + set_input_value: vo, space: F_, text: H_, transition_in: U_, @@ -4989,7 +4989,7 @@ function Y_(l) { ); }, m(t, n) { - Ns(t, e, n); + Xs(t, e, n); }, p(t, n) { n & /*label*/ @@ -5000,13 +5000,13 @@ function Y_(l) { ); }, d(t) { - t && Us(e); + t && Os(e); } }; } function W_(l) { let e, t, n, i, o, a, r; - return t = new xo({ + return t = new es({ props: { show_label: ( /*show_label*/ @@ -5021,28 +5021,28 @@ function W_(l) { } }), { c() { - e = po("label"), L_(t.$$.fragment), n = F_(), i = po("input"), Rl(i, "type", "color"), i.disabled = /*disabled*/ - l[3], Rl(i, "class", "svelte-16l8u73"), Rl(e, "class", "block"); + e = ko("label"), A_(t.$$.fragment), n = F_(), i = ko("input"), Ul(i, "type", "color"), i.disabled = /*disabled*/ + l[3], Ul(i, "class", "svelte-16l8u73"), Ul(e, "class", "block"); }, m(s, f) { - Ns(s, e, f), B_(t, e, null), go(e, n), go(e, i), ko( + Xs(s, e, f), T_(t, e, null), wo(e, n), wo(e, i), vo( i, /*value*/ l[0] ), o = !0, a || (r = [ - Fl( + Nl( i, "input", /*input_input_handler*/ l[8] ), - Fl( + Nl( i, "focus", /*focus_handler*/ l[6] ), - Fl( + Nl( i, "blur", /*blur_handler*/ @@ -5060,7 +5060,7 @@ function W_(l) { 2050 && (u.$$scope = { dirty: f, ctx: s }), t.$set(u), (!o || f & /*disabled*/ 8) && (i.disabled = /*disabled*/ s[3]), f & /*value*/ - 1 && ko( + 1 && vo( i, /*value*/ s[0] @@ -5073,7 +5073,7 @@ function W_(l) { N_(t.$$.fragment, s), o = !1; }, d(s) { - s && Us(e), D_(t), a = !1, j_(r); + s && Os(e), L_(t), a = !1, j_(r); } }; } @@ -5087,12 +5087,12 @@ function V_(l, e, t) { t(5, i = !1); }); function c(h) { - wo.call(this, l, h); + po.call(this, l, h); } - function d(h) { - wo.call(this, l, h); + function _(h) { + po.call(this, l, h); } - function _() { + function d() { n = this.value, t(0, n); } return l.$$set = (h) => { @@ -5108,13 +5108,13 @@ function V_(l, e, t) { s, i, c, - d, - _ + _, + d ]; } -class P_ extends A_ { +class P_ extends B_ { constructor(e) { - super(), T_(this, e, V_, W_, I_, { + super(), D_(this, e, V_, W_, I_, { value: 0, value_is_output: 5, label: 1, @@ -5126,38 +5126,38 @@ class P_ extends A_ { } const { SvelteComponent: Z_, - append: Os, - attr: P, + append: Ys, + attr: V, bubble: K_, check_outros: G_, - create_slot: Xs, - detach: kn, - element: dl, + create_slot: Ws, + detach: vn, + element: bl, empty: J_, - get_all_dirty_from_scope: Ys, - get_slot_changes: Ws, + get_all_dirty_from_scope: Vs, + get_slot_changes: Ps, group_outros: Q_, init: x_, - insert: vn, + insert: yn, listen: $_, safe_not_equal: ed, - set_style: be, - space: Vs, - src_url_equal: xn, - toggle_class: Wt, - transition_in: $n, - transition_out: el, - update_slot_base: Ps + set_style: ce, + space: Zs, + src_url_equal: tl, + toggle_class: Vt, + transition_in: nl, + transition_out: ll, + update_slot_base: Ks } = window.__gradio__svelte__internal; function td(l) { let e, t, n, i, o, a, r = ( /*icon*/ - l[7] && vo(l) + l[7] && yo(l) ); const s = ( /*#slots*/ l[12].default - ), f = Xs( + ), f = Ws( s, l, /*$$scope*/ @@ -5166,32 +5166,32 @@ function td(l) { ); return { c() { - e = dl("button"), r && r.c(), t = Vs(), f && f.c(), P(e, "class", n = /*size*/ + e = bl("button"), r && r.c(), t = Zs(), f && f.c(), V(e, "class", n = /*size*/ l[4] + " " + /*variant*/ l[3] + " " + /*elem_classes*/ - l[1].join(" ") + " svelte-8huxfn"), P( + l[1].join(" ") + " svelte-8huxfn"), V( e, "id", /*elem_id*/ l[0] ), e.disabled = /*disabled*/ - l[8], Wt(e, "hidden", !/*visible*/ - l[2]), be( + l[8], Vt(e, "hidden", !/*visible*/ + l[2]), ce( e, "flex-grow", /*scale*/ l[9] - ), be( + ), ce( e, "width", /*scale*/ l[9] === 0 ? "fit-content" : null - ), be(e, "min-width", typeof /*min_width*/ + ), ce(e, "min-width", typeof /*min_width*/ l[10] == "number" ? `calc(min(${/*min_width*/ l[10]}px, 100%))` : null); }, m(u, c) { - vn(u, e, c), r && r.m(e, null), Os(e, t), f && f.m(e, null), i = !0, o || (a = $_( + yn(u, e, c), r && r.m(e, null), Ys(e, t), f && f.m(e, null), i = !0, o || (a = $_( e, "click", /*click_handler*/ @@ -5200,20 +5200,20 @@ function td(l) { }, p(u, c) { /*icon*/ - u[7] ? r ? r.p(u, c) : (r = vo(u), r.c(), r.m(e, t)) : r && (r.d(1), r = null), f && f.p && (!i || c & /*$$scope*/ - 2048) && Ps( + u[7] ? r ? r.p(u, c) : (r = yo(u), r.c(), r.m(e, t)) : r && (r.d(1), r = null), f && f.p && (!i || c & /*$$scope*/ + 2048) && Ks( f, s, u, /*$$scope*/ u[11], - i ? Ws( + i ? Ps( s, /*$$scope*/ u[11], c, null - ) : Ys( + ) : Vs( /*$$scope*/ u[11] ), @@ -5222,8 +5222,8 @@ function td(l) { 26 && n !== (n = /*size*/ u[4] + " " + /*variant*/ u[3] + " " + /*elem_classes*/ - u[1].join(" ") + " svelte-8huxfn")) && P(e, "class", n), (!i || c & /*elem_id*/ - 1) && P( + u[1].join(" ") + " svelte-8huxfn")) && V(e, "class", n), (!i || c & /*elem_id*/ + 1) && V( e, "id", /*elem_id*/ @@ -5231,44 +5231,44 @@ function td(l) { ), (!i || c & /*disabled*/ 256) && (e.disabled = /*disabled*/ u[8]), (!i || c & /*size, variant, elem_classes, visible*/ - 30) && Wt(e, "hidden", !/*visible*/ + 30) && Vt(e, "hidden", !/*visible*/ u[2]), c & /*scale*/ - 512 && be( + 512 && ce( e, "flex-grow", /*scale*/ u[9] ), c & /*scale*/ - 512 && be( + 512 && ce( e, "width", /*scale*/ u[9] === 0 ? "fit-content" : null ), c & /*min_width*/ - 1024 && be(e, "min-width", typeof /*min_width*/ + 1024 && ce(e, "min-width", typeof /*min_width*/ u[10] == "number" ? `calc(min(${/*min_width*/ u[10]}px, 100%))` : null); }, i(u) { - i || ($n(f, u), i = !0); + i || (nl(f, u), i = !0); }, o(u) { - el(f, u), i = !1; + ll(f, u), i = !1; }, d(u) { - u && kn(e), r && r.d(), f && f.d(u), o = !1, a(); + u && vn(e), r && r.d(), f && f.d(u), o = !1, a(); } }; } function nd(l) { let e, t, n, i, o = ( /*icon*/ - l[7] && yo(l) + l[7] && Co(l) ); const a = ( /*#slots*/ l[12].default - ), r = Xs( + ), r = Ws( a, l, /*$$scope*/ @@ -5277,80 +5277,80 @@ function nd(l) { ); return { c() { - e = dl("a"), o && o.c(), t = Vs(), r && r.c(), P( + e = bl("a"), o && o.c(), t = Zs(), r && r.c(), V( e, "href", /*link*/ l[6] - ), P(e, "rel", "noopener noreferrer"), P( + ), V(e, "rel", "noopener noreferrer"), V( e, "aria-disabled", /*disabled*/ l[8] - ), P(e, "class", n = /*size*/ + ), V(e, "class", n = /*size*/ l[4] + " " + /*variant*/ l[3] + " " + /*elem_classes*/ - l[1].join(" ") + " svelte-8huxfn"), P( + l[1].join(" ") + " svelte-8huxfn"), V( e, "id", /*elem_id*/ l[0] - ), Wt(e, "hidden", !/*visible*/ - l[2]), Wt( + ), Vt(e, "hidden", !/*visible*/ + l[2]), Vt( e, "disabled", /*disabled*/ l[8] - ), be( + ), ce( e, "flex-grow", /*scale*/ l[9] - ), be( + ), ce( e, "pointer-events", /*disabled*/ l[8] ? "none" : null - ), be( + ), ce( e, "width", /*scale*/ l[9] === 0 ? "fit-content" : null - ), be(e, "min-width", typeof /*min_width*/ + ), ce(e, "min-width", typeof /*min_width*/ l[10] == "number" ? `calc(min(${/*min_width*/ l[10]}px, 100%))` : null); }, m(s, f) { - vn(s, e, f), o && o.m(e, null), Os(e, t), r && r.m(e, null), i = !0; + yn(s, e, f), o && o.m(e, null), Ys(e, t), r && r.m(e, null), i = !0; }, p(s, f) { /*icon*/ - s[7] ? o ? o.p(s, f) : (o = yo(s), o.c(), o.m(e, t)) : o && (o.d(1), o = null), r && r.p && (!i || f & /*$$scope*/ - 2048) && Ps( + s[7] ? o ? o.p(s, f) : (o = Co(s), o.c(), o.m(e, t)) : o && (o.d(1), o = null), r && r.p && (!i || f & /*$$scope*/ + 2048) && Ks( r, a, s, /*$$scope*/ s[11], - i ? Ws( + i ? Ps( a, /*$$scope*/ s[11], f, null - ) : Ys( + ) : Vs( /*$$scope*/ s[11] ), null ), (!i || f & /*link*/ - 64) && P( + 64) && V( e, "href", /*link*/ s[6] ), (!i || f & /*disabled*/ - 256) && P( + 256) && V( e, "aria-disabled", /*disabled*/ @@ -5359,97 +5359,97 @@ function nd(l) { 26 && n !== (n = /*size*/ s[4] + " " + /*variant*/ s[3] + " " + /*elem_classes*/ - s[1].join(" ") + " svelte-8huxfn")) && P(e, "class", n), (!i || f & /*elem_id*/ - 1) && P( + s[1].join(" ") + " svelte-8huxfn")) && V(e, "class", n), (!i || f & /*elem_id*/ + 1) && V( e, "id", /*elem_id*/ s[0] ), (!i || f & /*size, variant, elem_classes, visible*/ - 30) && Wt(e, "hidden", !/*visible*/ + 30) && Vt(e, "hidden", !/*visible*/ s[2]), (!i || f & /*size, variant, elem_classes, disabled*/ - 282) && Wt( + 282) && Vt( e, "disabled", /*disabled*/ s[8] ), f & /*scale*/ - 512 && be( + 512 && ce( e, "flex-grow", /*scale*/ s[9] ), f & /*disabled*/ - 256 && be( + 256 && ce( e, "pointer-events", /*disabled*/ s[8] ? "none" : null ), f & /*scale*/ - 512 && be( + 512 && ce( e, "width", /*scale*/ s[9] === 0 ? "fit-content" : null ), f & /*min_width*/ - 1024 && be(e, "min-width", typeof /*min_width*/ + 1024 && ce(e, "min-width", typeof /*min_width*/ s[10] == "number" ? `calc(min(${/*min_width*/ s[10]}px, 100%))` : null); }, i(s) { - i || ($n(r, s), i = !0); + i || (nl(r, s), i = !0); }, o(s) { - el(r, s), i = !1; + ll(r, s), i = !1; }, d(s) { - s && kn(e), o && o.d(), r && r.d(s); + s && vn(e), o && o.d(), r && r.d(s); } }; } -function vo(l) { +function yo(l) { let e, t, n; return { c() { - e = dl("img"), P(e, "class", "button-icon svelte-8huxfn"), xn(e.src, t = /*icon*/ - l[7].url) || P(e, "src", t), P(e, "alt", n = `${/*value*/ + e = bl("img"), V(e, "class", "button-icon svelte-8huxfn"), tl(e.src, t = /*icon*/ + l[7].url) || V(e, "src", t), V(e, "alt", n = `${/*value*/ l[5]} icon`); }, m(i, o) { - vn(i, e, o); + yn(i, e, o); }, p(i, o) { o & /*icon*/ - 128 && !xn(e.src, t = /*icon*/ - i[7].url) && P(e, "src", t), o & /*value*/ + 128 && !tl(e.src, t = /*icon*/ + i[7].url) && V(e, "src", t), o & /*value*/ 32 && n !== (n = `${/*value*/ - i[5]} icon`) && P(e, "alt", n); + i[5]} icon`) && V(e, "alt", n); }, d(i) { - i && kn(e); + i && vn(e); } }; } -function yo(l) { +function Co(l) { let e, t, n; return { c() { - e = dl("img"), P(e, "class", "button-icon svelte-8huxfn"), xn(e.src, t = /*icon*/ - l[7].url) || P(e, "src", t), P(e, "alt", n = `${/*value*/ + e = bl("img"), V(e, "class", "button-icon svelte-8huxfn"), tl(e.src, t = /*icon*/ + l[7].url) || V(e, "src", t), V(e, "alt", n = `${/*value*/ l[5]} icon`); }, m(i, o) { - vn(i, e, o); + yn(i, e, o); }, p(i, o) { o & /*icon*/ - 128 && !xn(e.src, t = /*icon*/ - i[7].url) && P(e, "src", t), o & /*value*/ + 128 && !tl(e.src, t = /*icon*/ + i[7].url) && V(e, "src", t), o & /*value*/ 32 && n !== (n = `${/*value*/ - i[5]} icon`) && P(e, "alt", n); + i[5]} icon`) && V(e, "alt", n); }, d(i) { - i && kn(e); + i && vn(e); } }; } @@ -5468,32 +5468,32 @@ function ld(l) { t.c(), n = J_(); }, m(s, f) { - a[e].m(s, f), vn(s, n, f), i = !0; + a[e].m(s, f), yn(s, n, f), i = !0; }, p(s, [f]) { let u = e; - e = r(s), e === u ? a[e].p(s, f) : (Q_(), el(a[u], 1, 1, () => { + e = r(s), e === u ? a[e].p(s, f) : (Q_(), ll(a[u], 1, 1, () => { a[u] = null; - }), G_(), t = a[e], t ? t.p(s, f) : (t = a[e] = o[e](s), t.c()), $n(t, 1), t.m(n.parentNode, n)); + }), G_(), t = a[e], t ? t.p(s, f) : (t = a[e] = o[e](s), t.c()), nl(t, 1), t.m(n.parentNode, n)); }, i(s) { - i || ($n(t), i = !0); + i || (nl(t), i = !0); }, o(s) { - el(t), i = !1; + ll(t), i = !1; }, d(s) { - s && kn(n), a[e].d(s); + s && vn(n), a[e].d(s); } }; } function id(l, e, t) { - let { $$slots: n = {}, $$scope: i } = e, { elem_id: o = "" } = e, { elem_classes: a = [] } = e, { visible: r = !0 } = e, { variant: s = "secondary" } = e, { size: f = "lg" } = e, { value: u = null } = e, { link: c = null } = e, { icon: d = null } = e, { disabled: _ = !1 } = e, { scale: h = null } = e, { min_width: m = void 0 } = e; - function b(g) { - K_.call(this, l, g); + let { $$slots: n = {}, $$scope: i } = e, { elem_id: o = "" } = e, { elem_classes: a = [] } = e, { visible: r = !0 } = e, { variant: s = "secondary" } = e, { size: f = "lg" } = e, { value: u = null } = e, { link: c = null } = e, { icon: _ = null } = e, { disabled: d = !1 } = e, { scale: h = null } = e, { min_width: b = void 0 } = e; + function m(w) { + K_.call(this, l, w); } - return l.$$set = (g) => { - "elem_id" in g && t(0, o = g.elem_id), "elem_classes" in g && t(1, a = g.elem_classes), "visible" in g && t(2, r = g.visible), "variant" in g && t(3, s = g.variant), "size" in g && t(4, f = g.size), "value" in g && t(5, u = g.value), "link" in g && t(6, c = g.link), "icon" in g && t(7, d = g.icon), "disabled" in g && t(8, _ = g.disabled), "scale" in g && t(9, h = g.scale), "min_width" in g && t(10, m = g.min_width), "$$scope" in g && t(11, i = g.$$scope); + return l.$$set = (w) => { + "elem_id" in w && t(0, o = w.elem_id), "elem_classes" in w && t(1, a = w.elem_classes), "visible" in w && t(2, r = w.visible), "variant" in w && t(3, s = w.variant), "size" in w && t(4, f = w.size), "value" in w && t(5, u = w.value), "link" in w && t(6, c = w.link), "icon" in w && t(7, _ = w.icon), "disabled" in w && t(8, d = w.disabled), "scale" in w && t(9, h = w.scale), "min_width" in w && t(10, b = w.min_width), "$$scope" in w && t(11, i = w.$$scope); }, [ o, a, @@ -5502,16 +5502,16 @@ function id(l, e, t) { f, u, c, - d, _, + d, h, - m, + b, i, n, - b + m ]; } -class Co extends Z_ { +class So extends Z_ { constructor(e) { super(), x_(this, e, id, ld, ed, { elem_id: 0, @@ -5530,55 +5530,55 @@ class Co extends Z_ { } const { SvelteComponent: od, - add_render_callback: Zs, + add_render_callback: Gs, append: Ln, - attr: Ce, - binding_callbacks: So, + attr: ke, + binding_callbacks: zo, check_outros: sd, - create_bidirectional_transition: zo, + create_bidirectional_transition: qo, destroy_each: ad, - detach: un, - element: tl, + detach: cn, + element: il, empty: rd, - ensure_array_like: qo, + ensure_array_like: Eo, group_outros: fd, init: ud, - insert: cn, - listen: ii, + insert: _n, + listen: oi, prevent_default: cd, run_all: _d, safe_not_equal: dd, set_data: hd, - set_style: Tt, - space: oi, + set_style: Rt, + space: si, text: md, - toggle_class: He, - transition_in: Hl, + toggle_class: Ne, + transition_in: Ol, transition_out: Mo } = window.__gradio__svelte__internal, { createEventDispatcher: bd } = window.__gradio__svelte__internal; -function Eo(l, e, t) { +function Bo(l, e, t) { const n = l.slice(); return n[26] = e[t], n; } function Ao(l) { - let e, t, n, i, o, a = qo( + let e, t, n, i, o, a = Eo( /*filtered_indices*/ l[1] ), r = []; for (let s = 0; s < a.length; s += 1) - r[s] = Lo(Eo(l, a, s)); + r[s] = Lo(Bo(l, a, s)); return { c() { - e = tl("ul"); + e = il("ul"); for (let s = 0; s < r.length; s += 1) r[s].c(); - Ce(e, "class", "options svelte-yuohum"), Ce(e, "role", "listbox"), Tt( + ke(e, "class", "options svelte-yuohum"), ke(e, "role", "listbox"), Rt( e, "bottom", /*bottom*/ l[9] - ), Tt(e, "max-height", `calc(${/*max_height*/ - l[10]}px - var(--window-padding))`), Tt( + ), Rt(e, "max-height", `calc(${/*max_height*/ + l[10]}px - var(--window-padding))`), Rt( e, "width", /*input_width*/ @@ -5586,10 +5586,10 @@ function Ao(l) { ); }, m(s, f) { - cn(s, e, f); + _n(s, e, f); for (let u = 0; u < r.length; u += 1) r[u] && r[u].m(e, null); - l[22](e), n = !0, i || (o = ii(e, "mousedown", cd( + l[22](e), n = !0, i || (o = oi(e, "mousedown", cd( /*mousedown_handler*/ l[21] )), i = !0); @@ -5597,13 +5597,13 @@ function Ao(l) { p(s, f) { if (f & /*filtered_indices, choices, selected_indices, active_index*/ 51) { - a = qo( + a = Eo( /*filtered_indices*/ s[1] ); let u; for (u = 0; u < a.length; u += 1) { - const c = Eo(s, a, u); + const c = Bo(s, a, u); r[u] ? r[u].p(c, f) : (r[u] = Lo(c), r[u].c(), r[u].m(e, null)); } for (; u < r.length; u += 1) @@ -5611,15 +5611,15 @@ function Ao(l) { r.length = a.length; } f & /*bottom*/ - 512 && Tt( + 512 && Rt( e, "bottom", /*bottom*/ s[9] ), f & /*max_height*/ - 1024 && Tt(e, "max-height", `calc(${/*max_height*/ + 1024 && Rt(e, "max-height", `calc(${/*max_height*/ s[10]}px - var(--window-padding))`), f & /*input_width*/ - 256 && Tt( + 256 && Rt( e, "width", /*input_width*/ @@ -5627,15 +5627,15 @@ function Ao(l) { ); }, i(s) { - n || (s && Zs(() => { - n && (t || (t = zo(e, Oi, { duration: 200, y: 5 }, !0)), t.run(1)); + n || (s && Gs(() => { + n && (t || (t = qo(e, Xi, { duration: 200, y: 5 }, !0)), t.run(1)); }), n = !0); }, o(s) { - s && (t || (t = zo(e, Oi, { duration: 200, y: 5 }, !1)), t.run(0)), n = !1; + s && (t || (t = qo(e, Xi, { duration: 200, y: 5 }, !1)), t.run(0)), n = !1; }, d(s) { - s && un(e), ad(r, s), l[22](null), s && t && t.end(), i = !1, o(); + s && cn(e), ad(r, s), l[22](null), s && t && t.end(), i = !1, o(); } }; } @@ -5649,20 +5649,20 @@ function Lo(l) { ), o, a, r, s, f; return { c() { - e = tl("li"), t = tl("span"), t.textContent = "✓", n = oi(), o = md(i), a = oi(), Ce(t, "class", "inner-item svelte-yuohum"), He(t, "hide", !/*selected_indices*/ + e = il("li"), t = il("span"), t.textContent = "✓", n = si(), o = md(i), a = si(), ke(t, "class", "inner-item svelte-yuohum"), Ne(t, "hide", !/*selected_indices*/ l[4].includes( /*index*/ l[26] - )), Ce(e, "class", "item svelte-yuohum"), Ce(e, "data-index", r = /*index*/ - l[26]), Ce(e, "aria-label", s = /*choices*/ + )), ke(e, "class", "item svelte-yuohum"), ke(e, "data-index", r = /*index*/ + l[26]), ke(e, "aria-label", s = /*choices*/ l[0][ /*index*/ l[26] - ][0]), Ce(e, "data-testid", "dropdown-option"), Ce(e, "role", "option"), Ce(e, "aria-selected", f = /*selected_indices*/ + ][0]), ke(e, "data-testid", "dropdown-option"), ke(e, "role", "option"), ke(e, "aria-selected", f = /*selected_indices*/ l[4].includes( /*index*/ l[26] - )), He( + )), Ne( e, "selected", /*selected_indices*/ @@ -5670,19 +5670,19 @@ function Lo(l) { /*index*/ l[26] ) - ), He( + ), Ne( e, "active", /*index*/ l[26] === /*active_index*/ l[5] - ), He( + ), Ne( e, "bg-gray-100", /*index*/ l[26] === /*active_index*/ l[5] - ), He( + ), Ne( e, "dark:bg-gray-600", /*index*/ @@ -5691,11 +5691,11 @@ function Lo(l) { ); }, m(u, c) { - cn(u, e, c), Ln(e, t), Ln(e, n), Ln(e, o), Ln(e, a); + _n(u, e, c), Ln(e, t), Ln(e, n), Ln(e, o), Ln(e, a); }, p(u, c) { c & /*selected_indices, filtered_indices*/ - 18 && He(t, "hide", !/*selected_indices*/ + 18 && Ne(t, "hide", !/*selected_indices*/ u[4].includes( /*index*/ u[26] @@ -5706,18 +5706,18 @@ function Lo(l) { u[26] ][0] + "") && hd(o, i), c & /*filtered_indices*/ 2 && r !== (r = /*index*/ - u[26]) && Ce(e, "data-index", r), c & /*choices, filtered_indices*/ + u[26]) && ke(e, "data-index", r), c & /*choices, filtered_indices*/ 3 && s !== (s = /*choices*/ u[0][ /*index*/ u[26] - ][0]) && Ce(e, "aria-label", s), c & /*selected_indices, filtered_indices*/ + ][0]) && ke(e, "aria-label", s), c & /*selected_indices, filtered_indices*/ 18 && f !== (f = /*selected_indices*/ u[4].includes( /*index*/ u[26] - )) && Ce(e, "aria-selected", f), c & /*selected_indices, filtered_indices*/ - 18 && He( + )) && ke(e, "aria-selected", f), c & /*selected_indices, filtered_indices*/ + 18 && Ne( e, "selected", /*selected_indices*/ @@ -5726,21 +5726,21 @@ function Lo(l) { u[26] ) ), c & /*filtered_indices, active_index*/ - 34 && He( + 34 && Ne( e, "active", /*index*/ u[26] === /*active_index*/ u[5] ), c & /*filtered_indices, active_index*/ - 34 && He( + 34 && Ne( e, "bg-gray-100", /*index*/ u[26] === /*active_index*/ u[5] ), c & /*filtered_indices, active_index*/ - 34 && He( + 34 && Ne( e, "dark:bg-gray-600", /*index*/ @@ -5749,13 +5749,13 @@ function Lo(l) { ); }, d(u) { - u && un(e); + u && cn(e); } }; } function gd(l) { let e, t, n, i, o; - Zs( + Gs( /*onwindowresize*/ l[19] ); @@ -5766,17 +5766,17 @@ function gd(l) { ); return { c() { - e = tl("div"), t = oi(), a && a.c(), n = rd(), Ce(e, "class", "reference"); + e = il("div"), t = si(), a && a.c(), n = rd(), ke(e, "class", "reference"); }, m(r, s) { - cn(r, e, s), l[20](e), cn(r, t, s), a && a.m(r, s), cn(r, n, s), i || (o = [ - ii( + _n(r, e, s), l[20](e), _n(r, t, s), a && a.m(r, s), _n(r, n, s), i || (o = [ + oi( window, "scroll", /*scroll_listener*/ l[12] ), - ii( + oi( window, "resize", /*onwindowresize*/ @@ -5788,71 +5788,71 @@ function gd(l) { /*show_options*/ r[2] && !/*disabled*/ r[3] ? a ? (a.p(r, s), s & /*show_options, disabled*/ - 12 && Hl(a, 1)) : (a = Ao(r), a.c(), Hl(a, 1), a.m(n.parentNode, n)) : a && (fd(), Mo(a, 1, 1, () => { + 12 && Ol(a, 1)) : (a = Ao(r), a.c(), Ol(a, 1), a.m(n.parentNode, n)) : a && (fd(), Mo(a, 1, 1, () => { a = null; }), sd()); }, i(r) { - Hl(a); + Ol(a); }, o(r) { Mo(a); }, d(r) { - r && (un(e), un(t), un(n)), l[20](null), a && a.d(r), i = !1, _d(o); + r && (cn(e), cn(t), cn(n)), l[20](null), a && a.d(r), i = !1, _d(o); } }; } function wd(l, e, t) { var n, i; - let { choices: o } = e, { filtered_indices: a } = e, { show_options: r = !1 } = e, { disabled: s = !1 } = e, { selected_indices: f = [] } = e, { active_index: u = null } = e, c, d, _, h, m, b, g, w, p; - function C() { - const { top: D, bottom: N } = m.getBoundingClientRect(); - t(16, c = D), t(17, d = p - N); + let { choices: o } = e, { filtered_indices: a } = e, { show_options: r = !1 } = e, { disabled: s = !1 } = e, { selected_indices: f = [] } = e, { active_index: u = null } = e, c, _, d, h, b, m, w, k, g; + function S() { + const { top: B, bottom: W } = b.getBoundingClientRect(); + t(16, c = B), t(17, _ = g - W); } - let E = null; - function v() { - r && (E !== null && clearTimeout(E), E = setTimeout( + let M = null; + function y() { + r && (M !== null && clearTimeout(M), M = setTimeout( () => { - C(), E = null; + S(), M = null; }, 10 )); } const z = bd(); - function k() { - t(11, p = window.innerHeight); + function v() { + t(11, g = window.innerHeight); } - function q(D) { - So[D ? "unshift" : "push"](() => { - m = D, t(6, m); + function q(B) { + zo[B ? "unshift" : "push"](() => { + b = B, t(6, b); }); } - const F = (D) => z("change", D); - function j(D) { - So[D ? "unshift" : "push"](() => { - b = D, t(7, b); + const R = (B) => z("change", B); + function I(B) { + zo[B ? "unshift" : "push"](() => { + m = B, t(7, m); }); } - return l.$$set = (D) => { - "choices" in D && t(0, o = D.choices), "filtered_indices" in D && t(1, a = D.filtered_indices), "show_options" in D && t(2, r = D.show_options), "disabled" in D && t(3, s = D.disabled), "selected_indices" in D && t(4, f = D.selected_indices), "active_index" in D && t(5, u = D.active_index); + return l.$$set = (B) => { + "choices" in B && t(0, o = B.choices), "filtered_indices" in B && t(1, a = B.filtered_indices), "show_options" in B && t(2, r = B.show_options), "disabled" in B && t(3, s = B.disabled), "selected_indices" in B && t(4, f = B.selected_indices), "active_index" in B && t(5, u = B.active_index); }, l.$$.update = () => { if (l.$$.dirty & /*show_options, refElement, listElement, selected_indices, _a, _b, distance_from_bottom, distance_from_top, input_height*/ 508116) { - if (r && m) { - if (b && f.length > 0) { - let N = b.querySelectorAll("li"); - for (const K of Array.from(N)) - if (K.getAttribute("data-index") === f[0].toString()) { - t(14, n = b == null ? void 0 : b.scrollTo) === null || n === void 0 || n.call(b, 0, K.offsetTop); + if (r && b) { + if (m && f.length > 0) { + let W = m.querySelectorAll("li"); + for (const H of Array.from(W)) + if (H.getAttribute("data-index") === f[0].toString()) { + t(14, n = m == null ? void 0 : m.scrollTo) === null || n === void 0 || n.call(m, 0, H.offsetTop); break; } } - C(); - const D = t(15, i = m.parentElement) === null || i === void 0 ? void 0 : i.getBoundingClientRect(); - t(18, _ = (D == null ? void 0 : D.height) || 0), t(8, h = (D == null ? void 0 : D.width) || 0); + S(); + const B = t(15, i = b.parentElement) === null || i === void 0 ? void 0 : i.getBoundingClientRect(); + t(18, d = (B == null ? void 0 : B.height) || 0), t(8, h = (B == null ? void 0 : B.width) || 0); } - d > c ? (t(10, w = d), t(9, g = null)) : (t(9, g = `${d + _}px`), t(10, w = c - _)); + _ > c ? (t(10, k = _), t(9, w = null)) : (t(9, w = `${_ + d}px`), t(10, k = c - d)); } }, [ o, @@ -5861,23 +5861,23 @@ function wd(l, e, t) { s, f, u, - m, b, + m, h, - g, w, - p, - v, + k, + g, + y, z, n, i, c, - d, _, - k, + d, + v, q, - F, - j + R, + I ]; } class pd extends od { @@ -5915,77 +5915,77 @@ function yd(l, e, t) { } const { SvelteComponent: Cd, - append: _t, - attr: ye, + append: ht, + attr: pe, binding_callbacks: Sd, check_outros: zd, - create_component: si, - destroy_component: ai, - detach: mi, - element: It, + create_component: ai, + destroy_component: ri, + detach: bi, + element: Ut, group_outros: qd, - init: Md, - insert: bi, + init: Ed, + insert: gi, listen: en, - mount_component: ri, - run_all: Ed, - safe_not_equal: Ad, - set_data: Ld, + mount_component: fi, + run_all: Md, + safe_not_equal: Bd, + set_data: Ad, set_input_value: To, - space: Ul, - text: Dd, - toggle_class: Bt, - transition_in: Rt, + space: Xl, + text: Ld, + toggle_class: Ft, + transition_in: Nt, transition_out: rn -} = window.__gradio__svelte__internal, { onMount: Td } = window.__gradio__svelte__internal, { createEventDispatcher: Bd, afterUpdate: jd } = window.__gradio__svelte__internal; +} = window.__gradio__svelte__internal, { onMount: Dd } = window.__gradio__svelte__internal, { createEventDispatcher: Td, afterUpdate: jd } = window.__gradio__svelte__internal; function Id(l) { let e; return { c() { - e = Dd( + e = Ld( /*label*/ l[0] ); }, m(t, n) { - bi(t, e, n); + gi(t, e, n); }, p(t, n) { n[0] & /*label*/ - 1 && Ld( + 1 && Ad( e, /*label*/ t[0] ); }, d(t) { - t && mi(e); + t && bi(e); } }; } -function Bo(l) { +function jo(l) { let e, t, n; return t = new Cf({}), { c() { - e = It("div"), si(t.$$.fragment), ye(e, "class", "icon-wrap svelte-1m1zvyj"); + e = Ut("div"), ai(t.$$.fragment), pe(e, "class", "icon-wrap svelte-1m1zvyj"); }, m(i, o) { - bi(i, e, o), ri(t, e, null), n = !0; + gi(i, e, o), fi(t, e, null), n = !0; }, i(i) { - n || (Rt(t.$$.fragment, i), n = !0); + n || (Nt(t.$$.fragment, i), n = !0); }, o(i) { rn(t.$$.fragment, i), n = !1; }, d(i) { - i && mi(e), ai(t); + i && bi(e), ri(t); } }; } function Rd(l) { - let e, t, n, i, o, a, r, s, f, u, c, d, _, h; - t = new xo({ + let e, t, n, i, o, a, r, s, f, u, c, _, d, h; + t = new es({ props: { show_label: ( /*show_label*/ @@ -5999,8 +5999,8 @@ function Rd(l) { $$scope: { ctx: l } } }); - let m = !/*disabled*/ - l[3] && Bo(); + let b = !/*disabled*/ + l[3] && jo(); return c = new pd({ props: { show_options: ( @@ -6037,41 +6037,41 @@ function Rd(l) { l[16] ), { c() { - e = It("div"), si(t.$$.fragment), n = Ul(), i = It("div"), o = It("div"), a = It("div"), r = It("input"), f = Ul(), m && m.c(), u = Ul(), si(c.$$.fragment), ye(r, "role", "listbox"), ye(r, "aria-controls", "dropdown-options"), ye( + e = Ut("div"), ai(t.$$.fragment), n = Xl(), i = Ut("div"), o = Ut("div"), a = Ut("div"), r = Ut("input"), f = Xl(), b && b.c(), u = Xl(), ai(c.$$.fragment), pe(r, "role", "listbox"), pe(r, "aria-controls", "dropdown-options"), pe( r, "aria-expanded", /*show_options*/ l[12] - ), ye( + ), pe( r, "aria-label", /*label*/ l[0] - ), ye(r, "class", "border-none svelte-1m1zvyj"), r.disabled = /*disabled*/ - l[3], ye(r, "autocomplete", "off"), r.readOnly = s = !/*filterable*/ - l[7], Bt(r, "subdued", !/*choices_names*/ + ), pe(r, "class", "border-none svelte-1m1zvyj"), r.disabled = /*disabled*/ + l[3], pe(r, "autocomplete", "off"), r.readOnly = s = !/*filterable*/ + l[7], Ft(r, "subdued", !/*choices_names*/ l[13].includes( /*input_text*/ l[9] ) && !/*allow_custom_value*/ - l[6]), ye(a, "class", "secondary-wrap svelte-1m1zvyj"), ye(o, "class", "wrap-inner svelte-1m1zvyj"), Bt( + l[6]), pe(a, "class", "secondary-wrap svelte-1m1zvyj"), pe(o, "class", "wrap-inner svelte-1m1zvyj"), Ft( o, "show_options", /*show_options*/ l[12] - ), ye(i, "class", "wrap svelte-1m1zvyj"), ye(e, "class", "svelte-1m1zvyj"), Bt( + ), pe(i, "class", "wrap svelte-1m1zvyj"), pe(e, "class", "svelte-1m1zvyj"), Ft( e, "container", /*container*/ l[5] ); }, - m(b, g) { - bi(b, e, g), ri(t, e, null), _t(e, n), _t(e, i), _t(i, o), _t(o, a), _t(a, r), To( + m(m, w) { + gi(m, e, w), fi(t, e, null), ht(e, n), ht(e, i), ht(i, o), ht(o, a), ht(a, r), To( r, /*input_text*/ l[9] - ), l[29](r), _t(a, f), m && m.m(a, null), _t(i, u), ri(c, i, null), d = !0, _ || (h = [ + ), l[29](r), ht(a, f), b && b.m(a, null), ht(i, u), fi(c, i, null), _ = !0, d || (h = [ en( r, "input", @@ -6102,185 +6102,185 @@ function Rd(l) { /*handle_focus*/ l[17] ) - ], _ = !0); - }, - p(b, g) { - const w = {}; - g[0] & /*show_label*/ - 16 && (w.show_label = /*show_label*/ - b[4]), g[0] & /*info*/ - 2 && (w.info = /*info*/ - b[1]), g[0] & /*label*/ - 1 | g[1] & /*$$scope*/ - 4 && (w.$$scope = { dirty: g, ctx: b }), t.$set(w), (!d || g[0] & /*show_options*/ - 4096) && ye( + ], d = !0); + }, + p(m, w) { + const k = {}; + w[0] & /*show_label*/ + 16 && (k.show_label = /*show_label*/ + m[4]), w[0] & /*info*/ + 2 && (k.info = /*info*/ + m[1]), w[0] & /*label*/ + 1 | w[1] & /*$$scope*/ + 4 && (k.$$scope = { dirty: w, ctx: m }), t.$set(k), (!_ || w[0] & /*show_options*/ + 4096) && pe( r, "aria-expanded", /*show_options*/ - b[12] - ), (!d || g[0] & /*label*/ - 1) && ye( + m[12] + ), (!_ || w[0] & /*label*/ + 1) && pe( r, "aria-label", /*label*/ - b[0] - ), (!d || g[0] & /*disabled*/ + m[0] + ), (!_ || w[0] & /*disabled*/ 8) && (r.disabled = /*disabled*/ - b[3]), (!d || g[0] & /*filterable*/ + m[3]), (!_ || w[0] & /*filterable*/ 128 && s !== (s = !/*filterable*/ - b[7])) && (r.readOnly = s), g[0] & /*input_text*/ + m[7])) && (r.readOnly = s), w[0] & /*input_text*/ 512 && r.value !== /*input_text*/ - b[9] && To( + m[9] && To( r, /*input_text*/ - b[9] - ), (!d || g[0] & /*choices_names, input_text, allow_custom_value*/ - 8768) && Bt(r, "subdued", !/*choices_names*/ - b[13].includes( + m[9] + ), (!_ || w[0] & /*choices_names, input_text, allow_custom_value*/ + 8768) && Ft(r, "subdued", !/*choices_names*/ + m[13].includes( /*input_text*/ - b[9] + m[9] ) && !/*allow_custom_value*/ - b[6]), /*disabled*/ - b[3] ? m && (qd(), rn(m, 1, 1, () => { - m = null; - }), zd()) : m ? g[0] & /*disabled*/ - 8 && Rt(m, 1) : (m = Bo(), m.c(), Rt(m, 1), m.m(a, null)), (!d || g[0] & /*show_options*/ - 4096) && Bt( + m[6]), /*disabled*/ + m[3] ? b && (qd(), rn(b, 1, 1, () => { + b = null; + }), zd()) : b ? w[0] & /*disabled*/ + 8 && Nt(b, 1) : (b = jo(), b.c(), Nt(b, 1), b.m(a, null)), (!_ || w[0] & /*show_options*/ + 4096) && Ft( o, "show_options", /*show_options*/ - b[12] + m[12] ); - const p = {}; - g[0] & /*show_options*/ - 4096 && (p.show_options = /*show_options*/ - b[12]), g[0] & /*choices*/ - 4 && (p.choices = /*choices*/ - b[2]), g[0] & /*filtered_indices*/ - 1024 && (p.filtered_indices = /*filtered_indices*/ - b[10]), g[0] & /*disabled*/ - 8 && (p.disabled = /*disabled*/ - b[3]), g[0] & /*selected_index*/ - 2048 && (p.selected_indices = /*selected_index*/ - b[11] === null ? [] : [ + const g = {}; + w[0] & /*show_options*/ + 4096 && (g.show_options = /*show_options*/ + m[12]), w[0] & /*choices*/ + 4 && (g.choices = /*choices*/ + m[2]), w[0] & /*filtered_indices*/ + 1024 && (g.filtered_indices = /*filtered_indices*/ + m[10]), w[0] & /*disabled*/ + 8 && (g.disabled = /*disabled*/ + m[3]), w[0] & /*selected_index*/ + 2048 && (g.selected_indices = /*selected_index*/ + m[11] === null ? [] : [ /*selected_index*/ - b[11] - ]), g[0] & /*active_index*/ - 16384 && (p.active_index = /*active_index*/ - b[14]), c.$set(p), (!d || g[0] & /*container*/ - 32) && Bt( + m[11] + ]), w[0] & /*active_index*/ + 16384 && (g.active_index = /*active_index*/ + m[14]), c.$set(g), (!_ || w[0] & /*container*/ + 32) && Ft( e, "container", /*container*/ - b[5] + m[5] ); }, - i(b) { - d || (Rt(t.$$.fragment, b), Rt(m), Rt(c.$$.fragment, b), d = !0); + i(m) { + _ || (Nt(t.$$.fragment, m), Nt(b), Nt(c.$$.fragment, m), _ = !0); }, - o(b) { - rn(t.$$.fragment, b), rn(m), rn(c.$$.fragment, b), d = !1; + o(m) { + rn(t.$$.fragment, m), rn(b), rn(c.$$.fragment, m), _ = !1; }, - d(b) { - b && mi(e), ai(t), l[29](null), m && m.d(), ai(c), _ = !1, Ed(h); + d(m) { + m && bi(e), ri(t), l[29](null), b && b.d(), ri(c), d = !1, Md(h); } }; } function Fd(l, e, t) { - let { label: n } = e, { info: i = void 0 } = e, { value: o = [] } = e, a = [], { value_is_output: r = !1 } = e, { choices: s } = e, f, { disabled: u = !1 } = e, { show_label: c } = e, { container: d = !0 } = e, { allow_custom_value: _ = !1 } = e, { filterable: h = !0 } = e, m, b = !1, g, w, p = "", C = "", E = !1, v = [], z = null, k = null, q; - const F = Bd(); - o ? (q = s.map((T) => T[1]).indexOf(o), k = q, k === -1 ? (a = o, k = null) : ([p, a] = s[k], C = p), D()) : s.length > 0 && (q = 0, k = 0, [p, o] = s[k], a = o, C = p); - function j() { - t(13, g = s.map((T) => T[0])), t(24, w = s.map((T) => T[1])); - } - function D() { - j(), o === void 0 || Array.isArray(o) && o.length === 0 ? (t(9, p = ""), t(11, k = null)) : w.includes(o) ? (t(9, p = g[w.indexOf(o)]), t(11, k = w.indexOf(o))) : _ ? (t(9, p = o), t(11, k = null)) : (t(9, p = ""), t(11, k = null)), t(27, q = k); - } - function N(T) { - if (t(11, k = parseInt(T.detail.target.dataset.index)), isNaN(k)) { - t(11, k = null); + let { label: n } = e, { info: i = void 0 } = e, { value: o = [] } = e, a = [], { value_is_output: r = !1 } = e, { choices: s } = e, f, { disabled: u = !1 } = e, { show_label: c } = e, { container: _ = !0 } = e, { allow_custom_value: d = !1 } = e, { filterable: h = !0 } = e, b, m = !1, w, k, g = "", S = "", M = !1, y = [], z = null, v = null, q; + const R = Td(); + o ? (q = s.map((L) => L[1]).indexOf(o), v = q, v === -1 ? (a = o, v = null) : ([g, a] = s[v], S = g), B()) : s.length > 0 && (q = 0, v = 0, [g, o] = s[v], a = o, S = g); + function I() { + t(13, w = s.map((L) => L[0])), t(24, k = s.map((L) => L[1])); + } + function B() { + I(), o === void 0 || Array.isArray(o) && o.length === 0 ? (t(9, g = ""), t(11, v = null)) : k.includes(o) ? (t(9, g = w[k.indexOf(o)]), t(11, v = k.indexOf(o))) : d ? (t(9, g = o), t(11, v = null)) : (t(9, g = ""), t(11, v = null)), t(27, q = v); + } + function W(L) { + if (t(11, v = parseInt(L.detail.target.dataset.index)), isNaN(v)) { + t(11, v = null); return; } - t(12, b = !1), t(14, z = null), m.blur(); + t(12, m = !1), t(14, z = null), b.blur(); } - function K(T) { - t(10, v = s.map((ae, fe) => fe)), t(12, b = !0), F("focus"); + function H(L) { + t(10, y = s.map((de, Ae) => Ae)), t(12, m = !0), R("focus"); } - function $() { - _ ? t(20, o = p) : t(9, p = g[w.indexOf(o)]), t(12, b = !1), t(14, z = null), F("blur"); + function le() { + d ? t(20, o = g) : t(9, g = w[k.indexOf(o)]), t(12, m = !1), t(14, z = null), R("blur"); } - function X(T) { - t(12, [b, z] = yd(T, z, v), b, (t(14, z), t(2, s), t(23, f), t(6, _), t(9, p), t(10, v), t(8, m), t(25, C), t(11, k), t(27, q), t(26, E), t(24, w))), T.key === "Enter" && (z !== null ? (t(11, k = z), t(12, b = !1), m.blur(), t(14, z = null)) : g.includes(p) ? (t(11, k = g.indexOf(p)), t(12, b = !1), t(14, z = null), m.blur()) : _ && (t(20, o = p), t(11, k = null), t(12, b = !1), t(14, z = null), m.blur()), F("enter", o)); + function X(L) { + t(12, [m, z] = yd(L, z, y), m, (t(14, z), t(2, s), t(23, f), t(6, d), t(9, g), t(10, y), t(8, b), t(25, S), t(11, v), t(27, q), t(26, M), t(24, k))), L.key === "Enter" && (z !== null ? (t(11, v = z), t(12, m = !1), b.blur(), t(14, z = null)) : w.includes(g) ? (t(11, v = w.indexOf(g)), t(12, m = !1), t(14, z = null), b.blur()) : d && (t(20, o = g), t(11, v = null), t(12, m = !1), t(14, z = null), b.blur()), R("enter", o)); } jd(() => { - t(21, r = !1), t(26, E = !0); - }), Td(() => { - m.focus(); + t(21, r = !1), t(26, M = !0); + }), Dd(() => { + b.focus(); }); - function se() { - p = this.value, t(9, p), t(11, k), t(27, q), t(26, E), t(2, s), t(24, w); + function ee() { + g = this.value, t(9, g), t(11, v), t(27, q), t(26, M), t(2, s), t(24, k); } - function we(T) { - Sd[T ? "unshift" : "push"](() => { - m = T, t(8, m); + function ae(L) { + Sd[L ? "unshift" : "push"](() => { + b = L, t(8, b); }); } - const re = (T) => F("key_up", { key: T.key, input_value: p }); - return l.$$set = (T) => { - "label" in T && t(0, n = T.label), "info" in T && t(1, i = T.info), "value" in T && t(20, o = T.value), "value_is_output" in T && t(21, r = T.value_is_output), "choices" in T && t(2, s = T.choices), "disabled" in T && t(3, u = T.disabled), "show_label" in T && t(4, c = T.show_label), "container" in T && t(5, d = T.container), "allow_custom_value" in T && t(6, _ = T.allow_custom_value), "filterable" in T && t(7, h = T.filterable); + const ye = (L) => R("key_up", { key: L.key, input_value: g }); + return l.$$set = (L) => { + "label" in L && t(0, n = L.label), "info" in L && t(1, i = L.info), "value" in L && t(20, o = L.value), "value_is_output" in L && t(21, r = L.value_is_output), "choices" in L && t(2, s = L.choices), "disabled" in L && t(3, u = L.disabled), "show_label" in L && t(4, c = L.show_label), "container" in L && t(5, _ = L.container), "allow_custom_value" in L && t(6, d = L.allow_custom_value), "filterable" in L && t(7, h = L.filterable); }, l.$$.update = () => { l.$$.dirty[0] & /*selected_index, old_selected_index, initialized, choices, choices_values*/ - 218105860 && k !== q && k !== null && E && (t(9, [p, o] = s[k], p, (t(20, o), t(11, k), t(27, q), t(26, E), t(2, s), t(24, w))), t(27, q = k), F("select", { - index: k, - value: w[k], + 218105860 && v !== q && v !== null && M && (t(9, [g, o] = s[v], g, (t(20, o), t(11, v), t(27, q), t(26, M), t(2, s), t(24, k))), t(27, q = v), R("select", { + index: v, + value: k[v], selected: !0 })), l.$$.dirty[0] & /*value, old_value, value_is_output*/ - 7340032 && o != a && (D(), vd(F, o, r), t(22, a = o)), l.$$.dirty[0] & /*choices*/ - 4 && j(), l.$$.dirty[0] & /*choices, old_choices, allow_custom_value, input_text, filtered_indices, filter_input*/ - 8390468 && s !== f && (_ || D(), t(23, f = s), t(10, v = Do(s, p)), !_ && v.length > 0 && t(14, z = v[0]), m == document.activeElement && t(12, b = !0)), l.$$.dirty[0] & /*input_text, old_input_text, choices, allow_custom_value, filtered_indices*/ - 33556036 && p !== C && (t(10, v = Do(s, p)), t(25, C = p), !_ && v.length > 0 && t(14, z = v[0])); + 7340032 && o != a && (B(), vd(R, o, r), t(22, a = o)), l.$$.dirty[0] & /*choices*/ + 4 && I(), l.$$.dirty[0] & /*choices, old_choices, allow_custom_value, input_text, filtered_indices, filter_input*/ + 8390468 && s !== f && (d || B(), t(23, f = s), t(10, y = Do(s, g)), !d && y.length > 0 && t(14, z = y[0]), b == document.activeElement && t(12, m = !0)), l.$$.dirty[0] & /*input_text, old_input_text, choices, allow_custom_value, filtered_indices*/ + 33556036 && g !== S && (t(10, y = Do(s, g)), t(25, S = g), !d && y.length > 0 && t(14, z = y[0])); }, [ n, i, s, u, c, - d, _, + d, h, - m, - p, - v, - k, b, g, + y, + v, + m, + w, z, - F, - N, - K, - $, + R, + W, + H, + le, X, o, r, a, f, - w, - C, - E, + k, + S, + M, q, - se, - we, - re + ee, + ae, + ye ]; } class Hd extends Cd { constructor(e) { - super(), Md( + super(), Ed( this, e, Fd, Rd, - Ad, + Bd, { label: 0, info: 1, @@ -6300,33 +6300,33 @@ class Hd extends Cd { } const { SvelteComponent: Ud, - append: Pe, + append: Ze, attr: Dn, create_component: Tn, - destroy_component: Bn, - detach: gi, - element: dt, + destroy_component: jn, + detach: wi, + element: mt, init: Nd, - insert: wi, - mount_component: jn, + insert: pi, + mount_component: In, safe_not_equal: Od, - set_style: In, - space: Nl, - text: Ks, - transition_in: Rn, - transition_out: Fn + set_style: Rn, + space: Yl, + text: Js, + transition_in: Fn, + transition_out: Hn } = window.__gradio__svelte__internal, { createEventDispatcher: Xd } = window.__gradio__svelte__internal, { onMount: Yd, onDestroy: Wd } = window.__gradio__svelte__internal; function Vd(l) { let e; return { c() { - e = Ks("Cancel"); + e = Js("Cancel"); }, m(t, n) { - wi(t, e, n); + pi(t, e, n); }, d(t) { - t && gi(e); + t && wi(e); } }; } @@ -6334,18 +6334,18 @@ function Pd(l) { let e; return { c() { - e = Ks("OK"); + e = Js("OK"); }, m(t, n) { - wi(t, e, n); + pi(t, e, n); }, d(t) { - t && gi(e); + t && wi(e); } }; } function Zd(l) { - let e, t, n, i, o, a, r, s, f, u, c, d, _, h, m; + let e, t, n, i, o, a, r, s, f, u, c, _, d, h, b; return o = new Hd({ props: { value: ( @@ -6381,7 +6381,7 @@ function Zd(l) { "change", /*onColorChange*/ l[5] - ), c = new Co({ + ), c = new So({ props: { $$slots: { default: [Vd] }, $$scope: { ctx: l } @@ -6390,7 +6390,7 @@ function Zd(l) { "click", /*click_handler*/ l[10] - ), h = new Co({ + ), h = new So({ props: { variant: "primary", $$slots: { default: [Pd] }, @@ -6402,64 +6402,64 @@ function Zd(l) { l[11] ), { c() { - e = dt("div"), t = dt("div"), n = dt("span"), i = dt("div"), Tn(o.$$.fragment), a = Nl(), r = dt("div"), Tn(s.$$.fragment), f = Nl(), u = dt("div"), Tn(c.$$.fragment), d = Nl(), _ = dt("div"), Tn(h.$$.fragment), In(i, "margin-right", "10px"), In(r, "margin-right", "40px"), In(r, "margin-bottom", "8px"), In(u, "margin-right", "8px"), Dn(n, "class", "model-content svelte-hkn2q1"), Dn(t, "class", "modal-container svelte-hkn2q1"), Dn(e, "class", "modal svelte-hkn2q1"), Dn(e, "id", "model-box-edit"); - }, - m(b, g) { - wi(b, e, g), Pe(e, t), Pe(t, n), Pe(n, i), jn(o, i, null), Pe(n, a), Pe(n, r), jn(s, r, null), Pe(n, f), Pe(n, u), jn(c, u, null), Pe(n, d), Pe(n, _), jn(h, _, null), m = !0; - }, - p(b, [g]) { - const w = {}; - g & /*currentLabel*/ - 1 && (w.value = /*currentLabel*/ - b[0]), g & /*choices*/ - 4 && (w.choices = /*choices*/ - b[2]), o.$set(w); - const p = {}; - g & /*currentColor*/ - 2 && (p.value = /*currentColor*/ - b[1]), s.$set(p); - const C = {}; - g & /*$$scope*/ - 16384 && (C.$$scope = { dirty: g, ctx: b }), c.$set(C); - const E = {}; - g & /*$$scope*/ - 16384 && (E.$$scope = { dirty: g, ctx: b }), h.$set(E); - }, - i(b) { - m || (Rn(o.$$.fragment, b), Rn(s.$$.fragment, b), Rn(c.$$.fragment, b), Rn(h.$$.fragment, b), m = !0); - }, - o(b) { - Fn(o.$$.fragment, b), Fn(s.$$.fragment, b), Fn(c.$$.fragment, b), Fn(h.$$.fragment, b), m = !1; - }, - d(b) { - b && gi(e), Bn(o), Bn(s), Bn(c), Bn(h); + e = mt("div"), t = mt("div"), n = mt("span"), i = mt("div"), Tn(o.$$.fragment), a = Yl(), r = mt("div"), Tn(s.$$.fragment), f = Yl(), u = mt("div"), Tn(c.$$.fragment), _ = Yl(), d = mt("div"), Tn(h.$$.fragment), Rn(i, "margin-right", "10px"), Rn(r, "margin-right", "40px"), Rn(r, "margin-bottom", "8px"), Rn(u, "margin-right", "8px"), Dn(n, "class", "model-content svelte-hkn2q1"), Dn(t, "class", "modal-container svelte-hkn2q1"), Dn(e, "class", "modal svelte-hkn2q1"), Dn(e, "id", "model-box-edit"); + }, + m(m, w) { + pi(m, e, w), Ze(e, t), Ze(t, n), Ze(n, i), In(o, i, null), Ze(n, a), Ze(n, r), In(s, r, null), Ze(n, f), Ze(n, u), In(c, u, null), Ze(n, _), Ze(n, d), In(h, d, null), b = !0; + }, + p(m, [w]) { + const k = {}; + w & /*currentLabel*/ + 1 && (k.value = /*currentLabel*/ + m[0]), w & /*choices*/ + 4 && (k.choices = /*choices*/ + m[2]), o.$set(k); + const g = {}; + w & /*currentColor*/ + 2 && (g.value = /*currentColor*/ + m[1]), s.$set(g); + const S = {}; + w & /*$$scope*/ + 16384 && (S.$$scope = { dirty: w, ctx: m }), c.$set(S); + const M = {}; + w & /*$$scope*/ + 16384 && (M.$$scope = { dirty: w, ctx: m }), h.$set(M); + }, + i(m) { + b || (Fn(o.$$.fragment, m), Fn(s.$$.fragment, m), Fn(c.$$.fragment, m), Fn(h.$$.fragment, m), b = !0); + }, + o(m) { + Hn(o.$$.fragment, m), Hn(s.$$.fragment, m), Hn(c.$$.fragment, m), Hn(h.$$.fragment, m), b = !1; + }, + d(m) { + m && wi(e), jn(o), jn(s), jn(c), jn(h); } }; } function Kd(l, e, t) { let { label: n = "" } = e, { currentLabel: i = "" } = e, { choices: o = [] } = e, { choicesColors: a = [] } = e, { color: r = "" } = e, { currentColor: s = "" } = e; const f = Xd(); - function u(g) { + function u(w) { f("change", { label: i, color: s, - ok: g + ok: w }); } - function c(g) { - const { detail: w } = g; - let p = w; - Number.isInteger(p) ? (Array.isArray(a) && p < a.length && t(1, s = a[p]), Array.isArray(o) && p < o.length && t(0, i = o[p][0])) : t(0, i = p); + function c(w) { + const { detail: k } = w; + let g = k; + Number.isInteger(g) ? (Array.isArray(a) && g < a.length && t(1, s = a[g]), Array.isArray(o) && g < o.length && t(0, i = o[g][0])) : t(0, i = g); } - function d(g) { - const { detail: w } = g; - t(1, s = w); + function _(w) { + const { detail: k } = w; + t(1, s = k); } - function _(g) { - c(g), u(!0); + function d(w) { + c(w), u(!0); } - function h(g) { - switch (g.key) { + function h(w) { + switch (w.key) { case "Enter": u(!0); break; @@ -6470,25 +6470,25 @@ function Kd(l, e, t) { }), Wd(() => { document.removeEventListener("keydown", h); }); - const m = () => u(!1), b = () => u(!0); - return l.$$set = (g) => { - "label" in g && t(7, n = g.label), "currentLabel" in g && t(0, i = g.currentLabel), "choices" in g && t(2, o = g.choices), "choicesColors" in g && t(8, a = g.choicesColors), "color" in g && t(9, r = g.color), "currentColor" in g && t(1, s = g.currentColor); + const b = () => u(!1), m = () => u(!0); + return l.$$set = (w) => { + "label" in w && t(7, n = w.label), "currentLabel" in w && t(0, i = w.currentLabel), "choices" in w && t(2, o = w.choices), "choicesColors" in w && t(8, a = w.choicesColors), "color" in w && t(9, r = w.color), "currentColor" in w && t(1, s = w.currentColor); }, [ i, s, o, u, c, - d, _, + d, n, a, r, - m, - b + b, + m ]; } -class Gs extends Ud { +class Qs extends Ud { constructor(e) { super(), Nd(this, e, Kd, Zd, Od, { label: 7, @@ -6500,8 +6500,8 @@ class Gs extends Ud { }); } } -const de = (l, e, t) => Math.min(Math.max(l, e), t); -function Ol(l, e) { +const fe = (l, e, t) => Math.min(Math.max(l, e), t); +function Wl(l, e) { if (l.startsWith("rgba")) return l.replace(/[\d.]+$/, e.toString()); const t = l.match(/\d+/g); @@ -6510,50 +6510,50 @@ function Ol(l, e) { const [n, i, o] = t; return `rgba(${n}, ${i}, ${o}, ${e})`; } -class Xl { - constructor(e, t, n, i, o, a, r, s, f, u, c = "rgb(255, 255, 255)", d = 0.5, _ = 25, h = 8, m = 2, b = 4, g = 1) { +class Vl { + constructor(e, t, n, i, o, a, r, s, f, u, c = "rgb(255, 255, 255)", _ = 0.5, d = 25, h = 8, b = 2, m = 4, w = 1) { this.stopDrag = () => { this.isDragging = !1, document.removeEventListener("mousemove", this.handleDrag), document.removeEventListener("mouseup", this.stopDrag); - }, this.handleDrag = (w) => { + }, this.handleDrag = (k) => { if (this.isDragging) { - let p = w.clientX - this.offsetMouseX - this.xmin, C = w.clientY - this.offsetMouseY - this.ymin; - const E = this.canvasXmax - this.canvasXmin, v = this.canvasYmax - this.canvasYmin; - p = de(p, -this.xmin, E - this.xmax), C = de(C, -this.ymin, v - this.ymax), this.xmin += p, this.ymin += C, this.xmax += p, this.ymax += C, this.updateHandles(), this.renderCallBack(); + let g = k.clientX - this.offsetMouseX - this.xmin, S = k.clientY - this.offsetMouseY - this.ymin; + const M = this.canvasXmax - this.canvasXmin, y = this.canvasYmax - this.canvasYmin; + g = fe(g, -this.xmin, M - this.xmax), S = fe(S, -this.ymin, y - this.ymax), this.xmin += g, this.ymin += S, this.xmax += g, this.ymax += S, this.updateHandles(), this.renderCallBack(); } - }, this.handleResize = (w) => { + }, this.handleResize = (k) => { if (this.isResizing) { - const p = w.clientX, C = w.clientY, E = p - this.resizeHandles[this.resizingHandleIndex].xmin - this.offsetMouseX, v = C - this.resizeHandles[this.resizingHandleIndex].ymin - this.offsetMouseY, z = this.canvasXmax - this.canvasXmin, k = this.canvasYmax - this.canvasYmin; + const g = k.clientX, S = k.clientY, M = g - this.resizeHandles[this.resizingHandleIndex].xmin - this.offsetMouseX, y = S - this.resizeHandles[this.resizingHandleIndex].ymin - this.offsetMouseY, z = this.canvasXmax - this.canvasXmin, v = this.canvasYmax - this.canvasYmin; switch (this.resizingHandleIndex) { case 0: - this.xmin += E, this.ymin += v, this.xmin = de(this.xmin, 0, this.xmax - this.minSize), this.ymin = de(this.ymin, 0, this.ymax - this.minSize); + this.xmin += M, this.ymin += y, this.xmin = fe(this.xmin, 0, this.xmax - this.minSize), this.ymin = fe(this.ymin, 0, this.ymax - this.minSize); break; case 1: - this.xmax += E, this.ymin += v, this.xmax = de(this.xmax, this.xmin + this.minSize, z), this.ymin = de(this.ymin, 0, this.ymax - this.minSize); + this.xmax += M, this.ymin += y, this.xmax = fe(this.xmax, this.xmin + this.minSize, z), this.ymin = fe(this.ymin, 0, this.ymax - this.minSize); break; case 2: - this.xmax += E, this.ymax += v, this.xmax = de(this.xmax, this.xmin + this.minSize, z), this.ymax = de(this.ymax, this.ymin + this.minSize, k); + this.xmax += M, this.ymax += y, this.xmax = fe(this.xmax, this.xmin + this.minSize, z), this.ymax = fe(this.ymax, this.ymin + this.minSize, v); break; case 3: - this.xmin += E, this.ymax += v, this.xmin = de(this.xmin, 0, this.xmax - this.minSize), this.ymax = de(this.ymax, this.ymin + this.minSize, k); + this.xmin += M, this.ymax += y, this.xmin = fe(this.xmin, 0, this.xmax - this.minSize), this.ymax = fe(this.ymax, this.ymin + this.minSize, v); break; case 4: - this.ymin += v, this.ymin = de(this.ymin, 0, this.ymax - this.minSize); + this.ymin += y, this.ymin = fe(this.ymin, 0, this.ymax - this.minSize); break; case 5: - this.xmax += E, this.xmax = de(this.xmax, this.xmin + this.minSize, z); + this.xmax += M, this.xmax = fe(this.xmax, this.xmin + this.minSize, z); break; case 6: - this.ymax += v, this.ymax = de(this.ymax, this.ymin + this.minSize, k); + this.ymax += y, this.ymax = fe(this.ymax, this.ymin + this.minSize, v); break; case 7: - this.xmin += E, this.xmin = de(this.xmin, 0, this.xmax - this.minSize); + this.xmin += M, this.xmin = fe(this.xmin, 0, this.xmax - this.minSize); break; } this.updateHandles(), this.renderCallBack(); } }, this.stopResize = () => { this.isResizing = !1, document.removeEventListener("mousemove", this.handleResize), document.removeEventListener("mouseup", this.stopResize); - }, this.renderCallBack = e, this.canvasXmin = t, this.canvasYmin = n, this.canvasXmax = i, this.canvasYmax = o, this.scaleFactor = g, this.label = a, this.isDragging = !1, this.xmin = r, this.ymin = s, this.xmax = f, this.ymax = u, this.isResizing = !1, this.isSelected = !1, this.offsetMouseX = 0, this.offsetMouseY = 0, this.resizeHandleSize = h, this.thickness = m, this.selectedThickness = b, this.updateHandles(), this.resizingHandleIndex = -1, this.minSize = _, this.color = c, this.alpha = d; + }, this.renderCallBack = e, this.canvasXmin = t, this.canvasYmin = n, this.canvasXmax = i, this.canvasYmax = o, this.scaleFactor = w, this.label = a, this.isDragging = !1, this.xmin = r, this.ymin = s, this.xmax = f, this.ymax = u, this.isResizing = !1, this.isSelected = !1, this.offsetMouseX = 0, this.offsetMouseY = 0, this.resizeHandleSize = h, this.thickness = b, this.selectedThickness = m, this.updateHandles(), this.resizingHandleIndex = -1, this.minSize = d, this.color = c, this.alpha = _; } toJSON() { return { @@ -6648,13 +6648,13 @@ class Xl { } render(e) { let t, n; - if (e.beginPath(), [t, n] = this.toCanvasCoordinates(this.xmin, this.ymin), e.rect(t, n, this.getWidth(), this.getHeight()), e.fillStyle = Ol(this.color, this.alpha), e.fill(), this.isSelected ? e.lineWidth = this.selectedThickness : e.lineWidth = this.thickness, e.strokeStyle = Ol(this.color, 1), e.stroke(), e.closePath(), this.label !== null && this.label.trim() !== "") { + if (e.beginPath(), [t, n] = this.toCanvasCoordinates(this.xmin, this.ymin), e.rect(t, n, this.getWidth(), this.getHeight()), e.fillStyle = Wl(this.color, this.alpha), e.fill(), this.isSelected ? e.lineWidth = this.selectedThickness : e.lineWidth = this.thickness, e.strokeStyle = Wl(this.color, 1), e.stroke(), e.closePath(), this.label !== null && this.label.trim() !== "") { this.isSelected ? e.font = "bold 14px Arial" : e.font = "12px Arial"; const i = e.measureText(this.label).width + 10, o = 20; let a = this.xmin, r = this.ymin - o; e.fillStyle = "white", [a, r] = this.toCanvasCoordinates(a, r), e.fillRect(a, r, i, o), e.lineWidth = 1, e.strokeStyle = "black", e.strokeRect(a, r, i, o), e.fillStyle = "black", e.fillText(this.label, a + 5, r + 15); } - e.fillStyle = Ol(this.color, 1); + e.fillStyle = Wl(this.color, 1); for (const i of this.resizeHandles) [t, n] = this.toCanvasCoordinates(i.xmin, i.ymin), e.fillRect( t, @@ -6682,7 +6682,7 @@ class Xl { this.resizingHandleIndex = e, this.isResizing = !0, this.offsetMouseX = t.clientX - this.resizeHandles[e].xmin, this.offsetMouseY = t.clientY - this.resizeHandles[e].ymin, document.addEventListener("mousemove", this.handleResize), document.addEventListener("mouseup", this.stopResize); } } -const Ue = [ +const Oe = [ "rgb(255, 168, 77)", "rgb(92, 172, 238)", "rgb(255, 99, 71)", @@ -6698,71 +6698,100 @@ const Ue = [ "rgb(255, 250, 138)" ], { SvelteComponent: Gd, - append: Ft, - attr: wt, + append: fn, + attr: St, binding_callbacks: Jd, - bubble: jo, - check_outros: Yl, - create_component: _n, - destroy_component: dn, - detach: Ht, - element: Vt, + bubble: Io, + check_outros: Pn, + create_component: mn, + destroy_component: bn, + detach: wt, + element: Zt, empty: Qd, - group_outros: Wl, + group_outros: Zn, init: xd, - insert: Ut, - listen: nt, - mount_component: hn, + insert: pt, + listen: it, + mount_component: gn, noop: $d, - run_all: Js, + run_all: xs, safe_not_equal: e0, - space: mn, - transition_in: he, - transition_out: Be + space: dn, + transition_in: ne, + transition_out: ve } = window.__gradio__svelte__internal, { onMount: t0, onDestroy: n0, createEventDispatcher: l0 } = window.__gradio__svelte__internal; -function Io(l) { - let e, t, n, i, o, a, r, s, f, u, c, d; - return n = new E_({}), a = new Df({}), f = new ui({}), { +function Ro(l) { + let e, t, n, i, o, a, r, s, f, u; + n = new M_({}); + let c = !/*disableEditBoxes*/ + l[4] && Fo(l); + return r = new ci({}), { c() { - e = Vt("span"), t = Vt("button"), _n(n.$$.fragment), i = mn(), o = Vt("button"), _n(a.$$.fragment), r = mn(), s = Vt("button"), _n(f.$$.fragment), wt(t, "class", "icon svelte-182gnnj"), wt(o, "class", "icon svelte-182gnnj"), wt(s, "class", "icon svelte-182gnnj"), wt(e, "class", "canvas-control svelte-182gnnj"); + e = Zt("span"), t = Zt("button"), mn(n.$$.fragment), i = dn(), c && c.c(), o = dn(), a = Zt("button"), mn(r.$$.fragment), St(t, "class", "icon svelte-182gnnj"), St(a, "class", "icon svelte-182gnnj"), St(e, "class", "canvas-control svelte-182gnnj"); }, - m(_, h) { - Ut(_, e, h), Ft(e, t), hn(n, t, null), Ft(e, i), Ft(e, o), hn(a, o, null), Ft(e, r), Ft(e, s), hn(f, s, null), u = !0, c || (d = [ - nt( + m(_, d) { + pt(_, e, d), fn(e, t), gn(n, t, null), fn(e, i), c && c.m(e, null), fn(e, o), fn(e, a), gn(r, a, null), s = !0, f || (u = [ + it( t, "click", /*click_handler*/ - l[25] - ), - nt( - o, - "click", - /*click_handler_1*/ l[26] ), - nt( - s, + it( + a, "click", /*click_handler_2*/ - l[27] + l[28] ) - ], c = !0); + ], f = !0); + }, + p(_, d) { + /*disableEditBoxes*/ + _[4] ? c && (Zn(), ve(c, 1, 1, () => { + c = null; + }), Pn()) : c ? (c.p(_, d), d[0] & /*disableEditBoxes*/ + 16 && ne(c, 1)) : (c = Fo(_), c.c(), ne(c, 1), c.m(e, o)); }, - p: $d, i(_) { - u || (he(n.$$.fragment, _), he(a.$$.fragment, _), he(f.$$.fragment, _), u = !0); + s || (ne(n.$$.fragment, _), ne(c), ne(r.$$.fragment, _), s = !0); }, o(_) { - Be(n.$$.fragment, _), Be(a.$$.fragment, _), Be(f.$$.fragment, _), u = !1; + ve(n.$$.fragment, _), ve(c), ve(r.$$.fragment, _), s = !1; }, d(_) { - _ && Ht(e), dn(n), dn(a), dn(f), c = !1, Js(d); + _ && wt(e), bn(n), c && c.d(), bn(r), f = !1, xs(u); } }; } -function Ro(l) { +function Fo(l) { + let e, t, n, i, o; + return t = new Lf({}), { + c() { + e = Zt("button"), mn(t.$$.fragment), St(e, "class", "icon svelte-182gnnj"); + }, + m(a, r) { + pt(a, e, r), gn(t, e, null), n = !0, i || (o = it( + e, + "click", + /*click_handler_1*/ + l[27] + ), i = !0); + }, + p: $d, + i(a) { + n || (ne(t.$$.fragment, a), n = !0); + }, + o(a) { + ve(t.$$.fragment, a), n = !1; + }, + d(a) { + a && wt(e), bn(t), i = !1, o(); + } + }; +} +function Ho(l) { let e, t; - return e = new Gs({ + return e = new Qs({ props: { choices: ( /*choices*/ @@ -6774,25 +6803,25 @@ function Ro(l) { ), label: ( /*selectedBox*/ - l[5] >= 0 && /*selectedBox*/ - l[5] < /*value*/ + l[6] >= 0 && /*selectedBox*/ + l[6] < /*value*/ l[0].boxes.length ? ( /*value*/ l[0].boxes[ /*selectedBox*/ - l[5] + l[6] ].label ) : "" ), color: ( /*selectedBox*/ - l[5] >= 0 && /*selectedBox*/ - l[5] < /*value*/ - l[0].boxes.length ? gn( + l[6] >= 0 && /*selectedBox*/ + l[6] < /*value*/ + l[0].boxes.length ? wn( /*value*/ l[0].boxes[ /*selectedBox*/ - l[5] + l[6] ].color ) : "" ) @@ -6800,17 +6829,17 @@ function Ro(l) { }), e.$on( "change", /*onModalEditChange*/ - l[14] + l[15] ), e.$on( "enter{onModalEditChange}", /*enter_onModalEditChange_handler*/ - l[28] + l[29] ), { c() { - _n(e.$$.fragment); + mn(e.$$.fragment); }, m(n, i) { - hn(e, n, i), t = !0; + gn(e, n, i), t = !0; }, p(n, i) { const o = {}; @@ -6819,41 +6848,41 @@ function Ro(l) { n[2]), i[0] & /*choicesColors*/ 8 && (o.choicesColors = /*choicesColors*/ n[3]), i[0] & /*selectedBox, value*/ - 33 && (o.label = /*selectedBox*/ - n[5] >= 0 && /*selectedBox*/ - n[5] < /*value*/ + 65 && (o.label = /*selectedBox*/ + n[6] >= 0 && /*selectedBox*/ + n[6] < /*value*/ n[0].boxes.length ? ( /*value*/ n[0].boxes[ /*selectedBox*/ - n[5] + n[6] ].label ) : ""), i[0] & /*selectedBox, value*/ - 33 && (o.color = /*selectedBox*/ - n[5] >= 0 && /*selectedBox*/ - n[5] < /*value*/ - n[0].boxes.length ? gn( + 65 && (o.color = /*selectedBox*/ + n[6] >= 0 && /*selectedBox*/ + n[6] < /*value*/ + n[0].boxes.length ? wn( /*value*/ n[0].boxes[ /*selectedBox*/ - n[5] + n[6] ].color ) : ""), e.$set(o); }, i(n) { - t || (he(e.$$.fragment, n), t = !0); + t || (ne(e.$$.fragment, n), t = !0); }, o(n) { - Be(e.$$.fragment, n), t = !1; + ve(e.$$.fragment, n), t = !1; }, d(n) { - dn(e, n); + bn(e, n); } }; } -function Fo(l) { +function Uo(l) { let e, t; - return e = new Gs({ + return e = new Qs({ props: { choices: ( /*choices*/ @@ -6870,25 +6899,25 @@ function Fo(l) { l[3].length > 0 ? ( /*choicesColors*/ l[3][0] - ) : gn(Ue[ + ) : wn(Oe[ /*value*/ - l[0].boxes.length % Ue.length + l[0].boxes.length % Oe.length ]) } }), e.$on( "change", /*onModalNewChange*/ - l[11] + l[12] ), e.$on( "enter{onModalNewChange}", /*enter_onModalNewChange_handler*/ - l[29] + l[30] ), { c() { - _n(e.$$.fragment); + mn(e.$$.fragment); }, m(n, i) { - hn(e, n, i), t = !0; + gn(e, n, i), t = !0; }, p(n, i) { const o = {}; @@ -6904,278 +6933,279 @@ function Fo(l) { n[3].length > 0 ? ( /*choicesColors*/ n[3][0] - ) : gn(Ue[ + ) : wn(Oe[ /*value*/ - n[0].boxes.length % Ue.length + n[0].boxes.length % Oe.length ])), e.$set(o); }, i(n) { - t || (he(e.$$.fragment, n), t = !0); + t || (ne(e.$$.fragment, n), t = !0); }, o(n) { - Be(e.$$.fragment, n), t = !1; + ve(e.$$.fragment, n), t = !1; }, d(n) { - dn(e, n); + bn(e, n); } }; } function i0(l) { let e, t, n, i, o, a, r, s, f, u = ( /*interactive*/ - l[1] && Io(l) + l[1] && Ro(l) ), c = ( /*editModalVisible*/ - l[6] && Ro(l) - ), d = ( + l[7] && Ho(l) + ), _ = ( /*newModalVisible*/ - l[7] && Fo(l) + l[8] && Uo(l) ); return { c() { - e = Vt("div"), t = Vt("canvas"), n = mn(), u && u.c(), i = mn(), c && c.c(), o = mn(), d && d.c(), a = Qd(), wt(t, "class", "canvas-annotator svelte-182gnnj"), wt(e, "class", "canvas-container svelte-182gnnj"), wt(e, "tabindex", "-1"); + e = Zt("div"), t = Zt("canvas"), n = dn(), u && u.c(), i = dn(), c && c.c(), o = dn(), _ && _.c(), a = Qd(), St(t, "class", "canvas-annotator svelte-182gnnj"), St(e, "class", "canvas-container svelte-182gnnj"), St(e, "tabindex", "-1"); }, - m(_, h) { - Ut(_, e, h), Ft(e, t), l[24](t), Ut(_, n, h), u && u.m(_, h), Ut(_, i, h), c && c.m(_, h), Ut(_, o, h), d && d.m(_, h), Ut(_, a, h), r = !0, s || (f = [ - nt( + m(d, h) { + pt(d, e, h), fn(e, t), l[25](t), pt(d, n, h), u && u.m(d, h), pt(d, i, h), c && c.m(d, h), pt(d, o, h), _ && _.m(d, h), pt(d, a, h), r = !0, s || (f = [ + it( t, "mousedown", /*handleMouseDown*/ - l[8] + l[9] ), - nt( + it( t, "mouseup", /*handleMouseUp*/ - l[9] + l[10] ), - nt( + it( t, "dblclick", /*handleDoubleClick*/ - l[13] + l[14] ), - nt( + it( e, "focusin", /*handleCanvasFocus*/ - l[16] + l[17] ), - nt( + it( e, "focusout", /*handleCanvasBlur*/ - l[17] + l[18] ) ], s = !0); }, - p(_, h) { + p(d, h) { /*interactive*/ - _[1] ? u ? (u.p(_, h), h[0] & /*interactive*/ - 2 && he(u, 1)) : (u = Io(_), u.c(), he(u, 1), u.m(i.parentNode, i)) : u && (Wl(), Be(u, 1, 1, () => { + d[1] ? u ? (u.p(d, h), h[0] & /*interactive*/ + 2 && ne(u, 1)) : (u = Ro(d), u.c(), ne(u, 1), u.m(i.parentNode, i)) : u && (Zn(), ve(u, 1, 1, () => { u = null; - }), Yl()), /*editModalVisible*/ - _[6] ? c ? (c.p(_, h), h[0] & /*editModalVisible*/ - 64 && he(c, 1)) : (c = Ro(_), c.c(), he(c, 1), c.m(o.parentNode, o)) : c && (Wl(), Be(c, 1, 1, () => { + }), Pn()), /*editModalVisible*/ + d[7] ? c ? (c.p(d, h), h[0] & /*editModalVisible*/ + 128 && ne(c, 1)) : (c = Ho(d), c.c(), ne(c, 1), c.m(o.parentNode, o)) : c && (Zn(), ve(c, 1, 1, () => { c = null; - }), Yl()), /*newModalVisible*/ - _[7] ? d ? (d.p(_, h), h[0] & /*newModalVisible*/ - 128 && he(d, 1)) : (d = Fo(_), d.c(), he(d, 1), d.m(a.parentNode, a)) : d && (Wl(), Be(d, 1, 1, () => { - d = null; - }), Yl()); + }), Pn()), /*newModalVisible*/ + d[8] ? _ ? (_.p(d, h), h[0] & /*newModalVisible*/ + 256 && ne(_, 1)) : (_ = Uo(d), _.c(), ne(_, 1), _.m(a.parentNode, a)) : _ && (Zn(), ve(_, 1, 1, () => { + _ = null; + }), Pn()); }, - i(_) { - r || (he(u), he(c), he(d), r = !0); + i(d) { + r || (ne(u), ne(c), ne(_), r = !0); }, - o(_) { - Be(u), Be(c), Be(d), r = !1; + o(d) { + ve(u), ve(c), ve(_), r = !1; }, - d(_) { - _ && (Ht(e), Ht(n), Ht(i), Ht(o), Ht(a)), l[24](null), u && u.d(_), c && c.d(_), d && d.d(_), s = !1, Js(f); + d(d) { + d && (wt(e), wt(n), wt(i), wt(o), wt(a)), l[25](null), u && u.d(d), c && c.d(d), _ && _.d(d), s = !1, xs(f); } }; } -function Ho(l) { +function No(l) { var e = parseInt(l.slice(1, 3), 16), t = parseInt(l.slice(3, 5), 16), n = parseInt(l.slice(5, 7), 16); return "rgb(" + e + ", " + t + ", " + n + ")"; } -function gn(l) { +function wn(l) { const e = l.match(/(\d+(\.\d+)?)/g), t = parseInt(e[0]), n = parseInt(e[1]), i = parseInt(e[2]); return "#" + (1 << 24 | t << 16 | n << 8 | i).toString(16).slice(1); } function o0(l, e, t) { - let { imageUrl: n = null } = e, { interactive: i } = e, { boxAlpha: o = 0.5 } = e, { boxMinSize: a = 25 } = e, { handleSize: r } = e, { boxThickness: s } = e, { boxSelectedThickness: f } = e, { value: u } = e, { choices: c = [] } = e, { choicesColors: d = [] } = e, _, h, m = null, b = -1, g = 0, w = 0, p = 0, C = 0, E = 1, v = 0, z = 0, k = !1, q = !1; - const F = l0(); - function j() { - if (h) { - h.clearRect(0, 0, _.width, _.height), m !== null && h.drawImage(m, g, w, v, z); - for (const A of u.boxes.slice().reverse()) - A.render(h); + let { imageUrl: n = null } = e, { interactive: i } = e, { boxAlpha: o = 0.5 } = e, { boxMinSize: a = 25 } = e, { handleSize: r } = e, { boxThickness: s } = e, { boxSelectedThickness: f } = e, { value: u } = e, { choices: c = [] } = e, { choicesColors: _ = [] } = e, { disableEditBoxes: d = !1 } = e, h, b, m = null, w = -1, k = 0, g = 0, S = 0, M = 0, y = 1, z = 0, v = 0, q = !1, R = !1; + const I = l0(); + function B() { + if (b) { + b.clearRect(0, 0, h.width, h.height), m !== null && b.drawImage(m, k, g, z, v); + for (const E of u.boxes.slice().reverse()) + E.render(b); } } - function D(A) { - t(5, b = A), u.boxes.forEach((B) => { - B.setSelected(!1); - }), A >= 0 && A < u.boxes.length && u.boxes[A].setSelected(!0), j(); + function W(E) { + t(6, w = E), u.boxes.forEach((D) => { + D.setSelected(!1); + }), E >= 0 && E < u.boxes.length && u.boxes[E].setSelected(!0), B(); } - function N(A) { + function H(E) { if (!i) return; - const B = _.getBoundingClientRect(), O = A.clientX - B.left, V = A.clientY - B.top; - for (const [Ee, ce] of u.boxes.entries()) { - const Se = ce.indexOfPointInsideHandle(O, V); - if (Se >= 0) { - D(Ee), ce.startResize(Se, A); + const D = h.getBoundingClientRect(), Y = E.clientX - D.left, be = E.clientY - D.top; + for (const [qe, J] of u.boxes.entries()) { + const Qe = J.indexOfPointInsideHandle(Y, be); + if (Qe >= 0) { + W(qe), J.startResize(Qe, E); return; } } - for (const [Ee, ce] of u.boxes.entries()) - if (ce.isPointInsideBox(O, V)) { - D(Ee), ce.startDrag(A); + for (const [qe, J] of u.boxes.entries()) + if (J.isPointInsideBox(Y, be)) { + W(qe), J.startDrag(E); return; } - D(-1); + W(-1); } - function K(A) { - F("change"); + function le(E) { + I("change"); } - function $(A) { + function X(E) { if (i) - switch (A.key) { + switch (E.key) { case "Delete": - ae(); + Le(); break; } } - function X() { - t(7, q = !0); + function ee() { + d ? ae() : t(8, R = !0); } - function se(A) { - t(7, q = !1); - const { detail: B } = A; - let O = B.label, V = B.color; - if (B.ok) { - V === null || V === "" ? V = Ue[u.boxes.length % Ue.length] : V = Ho(V); - let ce = v / 3 / E, Se = v / 3 * 2 / E, Jt = z / 3 / E, ea = z / 3 * 2 / E, ta = new Xl(j, g, w, p, C, O, Math.round(ce), Math.round(Jt), Math.round(Se), Math.round(ea), V, o, a, r, s, f); - t(0, u.boxes = [ta, ...u.boxes], u), j(), F("change"); - } + function ae(E = null, D = null, Y = null, be = null, qe = null, J = null) { + D === null || D === "" ? D = Oe[u.boxes.length % Oe.length] : D = No(D), E === null && (E = ""), Y === null && (Y = z / 3 / y), qe === null && (qe = z / 3 * 2 / y), be === null && (be = v / 3 / y), J === null && (J = v / 3 * 2 / y); + let Qe = new Vl(B, k, g, S, M, E, Math.round(Y), Math.round(be), Math.round(qe), Math.round(J), D, o, a, r, s, f); + t(0, u.boxes = [Qe, ...u.boxes], u), B(), I("change"); + } + function ye(E) { + t(8, R = !1); + const { detail: D } = E; + D.ok && ae(D.label, D.color); } - function we() { - b >= 0 && b < u.boxes.length && t(6, k = !0); + function L() { + w >= 0 && w < u.boxes.length && !d && t(7, q = !0); } - function re(A) { - i && we(); + function de(E) { + i && L(); } - function T(A) { - t(6, k = !1); - const { detail: B } = A; - let O = B.label, V = B.color; - if (B.ok && b >= 0 && b < u.boxes.length) { - let ce = u.boxes[b]; - ce.label = O, ce.color = Ho(V), j(), F("change"); + function Ae(E) { + t(7, q = !1); + const { detail: D } = E; + let Y = D.label, be = D.color; + if (D.ok && w >= 0 && w < u.boxes.length) { + let J = u.boxes[w]; + J.label = Y, J.color = No(be), B(), I("change"); } } - function ae() { - b >= 0 && b < u.boxes.length && (u.boxes.splice(b, 1), D(-1), F("change")); + function Le() { + w >= 0 && w < u.boxes.length && (u.boxes.splice(w, 1), W(-1), I("change")); } - function fe() { - if (_) { - if (E = 1, t(4, _.width = _.clientWidth, _), m !== null) - if (m.width > _.width) - E = _.width / m.width, v = m.width * E, z = m.height * E, g = 0, w = 0, p = v, C = z, t(4, _.height = z, _); + function Ce() { + if (h) { + if (y = 1, t(5, h.width = h.clientWidth, h), m !== null) + if (m.width > h.width) + y = h.width / m.width, z = m.width * y, v = m.height * y, k = 0, g = 0, S = z, M = v, t(5, h.height = v, h); else { - v = m.width, z = m.height; - var A = (_.width - v) / 2; - g = A, w = 0, p = A + v, C = m.height, t(4, _.height = z, _); + z = m.width, v = m.height; + var E = (h.width - z) / 2; + k = E, g = 0, S = E + z, M = m.height, t(5, h.height = v, h); } else - g = 0, w = 0, p = _.width, C = _.height, t(4, _.height = _.clientHeight, _); - if (p > 0 && C > 0) - for (const B of u.boxes) - B.canvasXmin = g, B.canvasYmin = w, B.canvasXmax = p, B.canvasYmax = C, B.setScaleFactor(E); - j(), F("change"); - } - } - const Ye = new ResizeObserver(fe); - function We() { - for (let A = 0; A < u.boxes.length; A++) { - let B = u.boxes[A]; - if (!(B instanceof Xl)) { - let O = "", V = ""; - B.hasOwnProperty("color") ? (O = B.color, Array.isArray(O) && O.length === 3 && (O = `rgb(${O[0]}, ${O[1]}, ${O[2]})`)) : O = Ue[A % Ue.length], B.hasOwnProperty("label") && (V = B.label), B = new Xl(j, g, w, p, C, V, B.xmin, B.ymin, B.xmax, B.ymax, O, o, a, r, s, f), t(0, u.boxes[A] = B, u); + k = 0, g = 0, S = h.width, M = h.height, t(5, h.height = h.clientHeight, h); + if (S > 0 && M > 0) + for (const D of u.boxes) + D.canvasXmin = k, D.canvasYmin = g, D.canvasXmax = S, D.canvasYmax = M, D.setScaleFactor(y); + B(), I("change"); + } + } + const A = new ResizeObserver(Ce); + function Ve() { + for (let E = 0; E < u.boxes.length; E++) { + let D = u.boxes[E]; + if (!(D instanceof Vl)) { + let Y = "", be = ""; + D.hasOwnProperty("color") ? (Y = D.color, Array.isArray(Y) && Y.length === 3 && (Y = `rgb(${Y[0]}, ${Y[1]}, ${Y[2]})`)) : Y = Oe[E % Oe.length], D.hasOwnProperty("label") && (be = D.label), D = new Vl(B, k, g, S, M, be, D.xmin, D.ymin, D.xmax, D.ymax, Y, o, a, r, s, f), t(0, u.boxes[E] = D, u); } } } - function L() { + function p() { n !== null && (m === null || m.src != n) && (m = new Image(), m.src = n, m.onload = function() { - fe(), j(); + Ce(), B(); }); } t0(() => { - if (Array.isArray(c) && c.length > 0 && (!Array.isArray(d) || d.length == 0)) - for (let A = 0; A < c.length; A++) { - let B = Ue[A % Ue.length]; - d.push(gn(B)); + if (Array.isArray(c) && c.length > 0 && (!Array.isArray(_) || _.length == 0)) + for (let E = 0; E < c.length; E++) { + let D = Oe[E % Oe.length]; + _.push(wn(D)); } - h = _.getContext("2d"), Ye.observe(_), L(), fe(), j(); + b = h.getContext("2d"), A.observe(h), p(), Ce(), B(); }); - function M() { - document.addEventListener("keydown", $); + function F() { + document.addEventListener("keydown", X); } - function S() { - document.removeEventListener("keydown", $); + function Z() { + document.removeEventListener("keydown", X); } n0(() => { - document.removeEventListener("keydown", $); + document.removeEventListener("keydown", X); }); - function H(A) { - Jd[A ? "unshift" : "push"](() => { - _ = A, t(4, _); + function K(E) { + Jd[E ? "unshift" : "push"](() => { + h = E, t(5, h); }); } - const G = () => X(), y = () => we(), ee = () => ae(); - function ue(A) { - jo.call(this, l, A); + const C = () => ee(), Se = () => L(), he = () => Le(); + function ze(E) { + Io.call(this, l, E); } - function pe(A) { - jo.call(this, l, A); + function me(E) { + Io.call(this, l, E); } - return l.$$set = (A) => { - "imageUrl" in A && t(18, n = A.imageUrl), "interactive" in A && t(1, i = A.interactive), "boxAlpha" in A && t(19, o = A.boxAlpha), "boxMinSize" in A && t(20, a = A.boxMinSize), "handleSize" in A && t(21, r = A.handleSize), "boxThickness" in A && t(22, s = A.boxThickness), "boxSelectedThickness" in A && t(23, f = A.boxSelectedThickness), "value" in A && t(0, u = A.value), "choices" in A && t(2, c = A.choices), "choicesColors" in A && t(3, d = A.choicesColors); + return l.$$set = (E) => { + "imageUrl" in E && t(19, n = E.imageUrl), "interactive" in E && t(1, i = E.interactive), "boxAlpha" in E && t(20, o = E.boxAlpha), "boxMinSize" in E && t(21, a = E.boxMinSize), "handleSize" in E && t(22, r = E.handleSize), "boxThickness" in E && t(23, s = E.boxThickness), "boxSelectedThickness" in E && t(24, f = E.boxSelectedThickness), "value" in E && t(0, u = E.value), "choices" in E && t(2, c = E.choices), "choicesColors" in E && t(3, _ = E.choicesColors), "disableEditBoxes" in E && t(4, d = E.disableEditBoxes); }, l.$$.update = () => { l.$$.dirty[0] & /*value*/ - 1 && (L(), We(), fe(), j()); + 1 && (p(), Ve(), Ce(), B()); }, [ u, i, c, - d, _, - b, - k, + d, + h, + w, q, - N, - K, - X, - se, - we, - re, - T, - ae, - M, - S, + R, + H, + le, + ee, + ye, + L, + de, + Ae, + Le, + F, + Z, n, o, a, r, s, f, - H, - G, - y, - ee, - ue, - pe + K, + C, + Se, + he, + ze, + me ]; } class s0 extends Gd { @@ -7187,16 +7217,17 @@ class s0 extends Gd { i0, e0, { - imageUrl: 18, + imageUrl: 19, interactive: 1, - boxAlpha: 19, - boxMinSize: 20, - handleSize: 21, - boxThickness: 22, - boxSelectedThickness: 23, + boxAlpha: 20, + boxMinSize: 21, + handleSize: 22, + boxThickness: 23, + boxSelectedThickness: 24, value: 0, choices: 2, - choicesColors: 3 + choicesColors: 3, + disableEditBoxes: 4 }, null, [-1, -1] @@ -7219,7 +7250,7 @@ const { function p0(l) { let e, t, n; function i(a) { - l[13](a); + l[14](a); } let o = { interactive: ( @@ -7254,9 +7285,13 @@ function p0(l) { /*boxSelectedThickness*/ l[8] ), + disableEditBoxes: ( + /*disableEditBoxes*/ + l[9] + ), imageUrl: ( /*resolved_src*/ - l[9] + l[10] ) }; return ( @@ -7265,7 +7300,7 @@ function p0(l) { l[0]), e = new s0({ props: o }), u0.push(() => f0(e, "value", i)), e.$on( "change", /*change_handler*/ - l[14] + l[15] ), { c() { c0(e.$$.fragment); @@ -7291,9 +7326,11 @@ function p0(l) { 128 && (s.boxThickness = /*boxThickness*/ a[7]), r & /*boxSelectedThickness*/ 256 && (s.boxSelectedThickness = /*boxSelectedThickness*/ - a[8]), r & /*resolved_src*/ - 512 && (s.imageUrl = /*resolved_src*/ - a[9]), !t && r & /*value*/ + a[8]), r & /*disableEditBoxes*/ + 512 && (s.disableEditBoxes = /*disableEditBoxes*/ + a[9]), r & /*resolved_src*/ + 1024 && (s.imageUrl = /*resolved_src*/ + a[10]), !t && r & /*value*/ 1 && (t = !0, s.value = /*value*/ a[0], r0(() => t = !1)), e.$set(s); }, @@ -7310,25 +7347,25 @@ function p0(l) { ); } function k0(l, e, t) { - let { src: n = void 0 } = e, { interactive: i } = e, { boxesAlpha: o } = e, { labelList: a } = e, { labelColors: r } = e, { boxMinSize: s } = e, { handleSize: f } = e, { boxThickness: u } = e, { boxSelectedThickness: c } = e, { value: d } = e, _, h; + let { src: n = void 0 } = e, { interactive: i } = e, { boxesAlpha: o } = e, { labelList: a } = e, { labelColors: r } = e, { boxMinSize: s } = e, { handleSize: f } = e, { boxThickness: u } = e, { boxSelectedThickness: c } = e, { value: _ } = e, { disableEditBoxes: d } = e, h, b; const m = w0(); - function b(w) { - d = w, t(0, d); + function w(g) { + _ = g, t(0, _); } - const g = () => m("change"); - return l.$$set = (w) => { - "src" in w && t(11, n = w.src), "interactive" in w && t(1, i = w.interactive), "boxesAlpha" in w && t(2, o = w.boxesAlpha), "labelList" in w && t(3, a = w.labelList), "labelColors" in w && t(4, r = w.labelColors), "boxMinSize" in w && t(5, s = w.boxMinSize), "handleSize" in w && t(6, f = w.handleSize), "boxThickness" in w && t(7, u = w.boxThickness), "boxSelectedThickness" in w && t(8, c = w.boxSelectedThickness), "value" in w && t(0, d = w.value); + const k = () => m("change"); + return l.$$set = (g) => { + "src" in g && t(12, n = g.src), "interactive" in g && t(1, i = g.interactive), "boxesAlpha" in g && t(2, o = g.boxesAlpha), "labelList" in g && t(3, a = g.labelList), "labelColors" in g && t(4, r = g.labelColors), "boxMinSize" in g && t(5, s = g.boxMinSize), "handleSize" in g && t(6, f = g.handleSize), "boxThickness" in g && t(7, u = g.boxThickness), "boxSelectedThickness" in g && t(8, c = g.boxSelectedThickness), "value" in g && t(0, _ = g.value), "disableEditBoxes" in g && t(9, d = g.disableEditBoxes); }, l.$$.update = () => { if (l.$$.dirty & /*src, latest_src*/ - 6144) { - t(9, _ = n), t(12, h = n); - const w = n; - Ec(w).then((p) => { - h === w && t(9, _ = p); + 12288) { + t(10, h = n), t(13, b = n); + const g = n; + Mc(g).then((S) => { + b === g && t(10, h = S); }); } }, [ - d, + _, i, o, a, @@ -7337,18 +7374,19 @@ function k0(l, e, t) { f, u, c, - _, + d, + h, m, n, - h, b, - g + w, + k ]; } -class Qs extends a0 { +class $s extends a0 { constructor(e) { super(), d0(this, e, k0, p0, m0, { - src: 11, + src: 12, interactive: 1, boxesAlpha: 2, labelList: 3, @@ -7357,7 +7395,8 @@ class Qs extends a0 { handleSize: 6, boxThickness: 7, boxSelectedThickness: 8, - value: 0 + value: 0, + disableEditBoxes: 9 }); } } @@ -7368,34 +7407,34 @@ class v0 { } const { SvelteComponent: y0, - add_flush_callback: nl, + add_flush_callback: ol, append: tn, - attr: fn, - bind: ll, - binding_callbacks: wn, - bubble: Vl, - check_outros: Nt, - create_component: st, + attr: un, + bind: sl, + binding_callbacks: pn, + bubble: Pl, + check_outros: Ot, + create_component: rt, create_slot: C0, - destroy_component: at, - detach: pt, - element: bn, + destroy_component: ft, + detach: yt, + element: hn, empty: S0, get_all_dirty_from_scope: z0, get_slot_changes: q0, - group_outros: Ot, - init: M0, - insert: kt, - mount_component: rt, - noop: E0, - safe_not_equal: A0, - space: jt, - toggle_class: Uo, - transition_in: W, - transition_out: J, - update_slot_base: L0 -} = window.__gradio__svelte__internal, { createEventDispatcher: D0 } = window.__gradio__svelte__internal; -function No(l) { + group_outros: Xt, + init: E0, + insert: Ct, + mount_component: ut, + noop: M0, + safe_not_equal: B0, + space: Ht, + toggle_class: Oo, + transition_in: O, + transition_out: G, + update_slot_base: A0 +} = window.__gradio__svelte__internal, { createEventDispatcher: L0 } = window.__gradio__svelte__internal; +function Xo(l) { let e, t; return e = new Oc({ props: { @@ -7407,15 +7446,15 @@ function No(l) { /*value*/ l[1].image.orig_name || "image" ), - $$slots: { default: [T0] }, + $$slots: { default: [D0] }, $$scope: { ctx: l } } }), { c() { - st(e.$$.fragment); + rt(e.$$.fragment); }, m(n, i) { - rt(e, n, i), t = !0; + ut(e, n, i), t = !0; }, p(n, i) { const o = {}; @@ -7425,22 +7464,22 @@ function No(l) { 2 && (o.download = /*value*/ n[1].image.orig_name || "image"), i[0] & /*i18n*/ 256 | i[1] & /*$$scope*/ - 1024 && (o.$$scope = { dirty: i, ctx: n }), e.$set(o); + 2048 && (o.$$scope = { dirty: i, ctx: n }), e.$set(o); }, i(n) { - t || (W(e.$$.fragment, n), t = !0); + t || (O(e.$$.fragment, n), t = !0); }, o(n) { - J(e.$$.fragment, n), t = !1; + G(e.$$.fragment, n), t = !1; }, d(n) { - at(e, n); + ft(e, n); } }; } -function T0(l) { +function D0(l) { let e, t; - return e = new il({ + return e = new al({ props: { Icon: mf, label: ( @@ -7450,10 +7489,10 @@ function T0(l) { } }), { c() { - st(e.$$.fragment); + rt(e.$$.fragment); }, m(n, i) { - rt(e, n, i), t = !0; + ut(e, n, i), t = !0; }, p(n, i) { const o = {}; @@ -7462,17 +7501,17 @@ function T0(l) { n[8]("common.download")), e.$set(o); }, i(n) { - t || (W(e.$$.fragment, n), t = !0); + t || (O(e.$$.fragment, n), t = !0); }, o(n) { - J(e.$$.fragment, n), t = !1; + G(e.$$.fragment, n), t = !1; }, d(n) { - at(e, n); + ft(e, n); } }; } -function Oo(l) { +function Yo(l) { let e, t; return e = new zu({ props: { @@ -7482,7 +7521,7 @@ function Oo(l) { ), formatter: ( /*func*/ - l[31] + l[32] ), value: ( /*value*/ @@ -7492,17 +7531,17 @@ function Oo(l) { }), e.$on( "share", /*share_handler*/ - l[32] + l[33] ), e.$on( "error", /*error_handler*/ - l[33] + l[34] ), { c() { - st(e.$$.fragment); + rt(e.$$.fragment); }, m(n, i) { - rt(e, n, i), t = !0; + ut(e, n, i), t = !0; }, p(n, i) { const o = {}; @@ -7513,53 +7552,53 @@ function Oo(l) { n[1]), e.$set(o); }, i(n) { - t || (W(e.$$.fragment, n), t = !0); + t || (O(e.$$.fragment, n), t = !0); }, o(n) { - J(e.$$.fragment, n), t = !1; + G(e.$$.fragment, n), t = !1; }, d(n) { - at(e, n); + ft(e, n); } }; } -function Xo(l) { +function Wo(l) { let e, t, n; - return t = new il({ - props: { Icon: ui, label: "Remove Image" } + return t = new al({ + props: { Icon: ci, label: "Remove Image" } }), t.$on( "click", /*clear*/ - l[29] + l[30] ), { c() { - e = bn("div"), st(t.$$.fragment); + e = hn("div"), rt(t.$$.fragment); }, m(i, o) { - kt(i, e, o), rt(t, e, null), n = !0; + Ct(i, e, o), ut(t, e, null), n = !0; }, - p: E0, + p: M0, i(i) { - n || (W(t.$$.fragment, i), n = !0); + n || (O(t.$$.fragment, i), n = !0); }, o(i) { - J(t.$$.fragment, i), n = !1; + G(t.$$.fragment, i), n = !1; }, d(i) { - i && pt(e), at(t); + i && yt(e), ft(t); } }; } -function Yo(l) { +function Vo(l) { let e; const t = ( /*#slots*/ - l[30].default + l[31].default ), n = C0( t, l, /*$$scope*/ - l[41], + l[42], null ); return { @@ -7571,70 +7610,70 @@ function Yo(l) { }, p(i, o) { n && n.p && (!e || o[1] & /*$$scope*/ - 1024) && L0( + 2048) && A0( n, t, i, /*$$scope*/ - i[41], + i[42], e ? q0( t, /*$$scope*/ - i[41], + i[42], o, null ) : z0( /*$$scope*/ - i[41] + i[42] ), null ); }, i(i) { - e || (W(n, i), e = !0); + e || (O(n, i), e = !0); }, o(i) { - J(n, i), e = !1; + G(n, i), e = !1; }, d(i) { n && n.d(i); } }; } -function B0(l) { +function T0(l) { let e, t, n = ( /*value*/ - l[1] === null && Yo(l) + l[1] === null && Vo(l) ); return { c() { n && n.c(), e = S0(); }, m(i, o) { - n && n.m(i, o), kt(i, e, o), t = !0; + n && n.m(i, o), Ct(i, e, o), t = !0; }, p(i, o) { /*value*/ i[1] === null ? n ? (n.p(i, o), o[0] & /*value*/ - 2 && W(n, 1)) : (n = Yo(i), n.c(), W(n, 1), n.m(e.parentNode, e)) : n && (Ot(), J(n, 1, 1, () => { + 2 && O(n, 1)) : (n = Vo(i), n.c(), O(n, 1), n.m(e.parentNode, e)) : n && (Xt(), G(n, 1, 1, () => { n = null; - }), Nt()); + }), Ot()); }, i(i) { - t || (W(n), t = !0); + t || (O(n), t = !0); }, o(i) { - J(n), t = !1; + G(n), t = !1; }, d(i) { - i && pt(e), n && n.d(i); + i && yt(e), n && n.d(i); } }; } -function Wo(l) { +function Po(l) { let e, t, n, i; function o(r) { - l[38](r); + l[39](r); } let a = { boxesAlpha: ( @@ -7665,9 +7704,13 @@ function Wo(l) { /*boxThickness*/ l[17] ), + disableEditBoxes: ( + /*disableEditBoxes*/ + l[18] + ), boxSelectedThickness: ( /*boxSelectedThickness*/ - l[18] + l[19] ), src: ( /*value*/ @@ -7677,13 +7720,13 @@ function Wo(l) { return ( /*value*/ l[1] !== void 0 && (a.value = /*value*/ - l[1]), t = new Qs({ props: a }), wn.push(() => ll(t, "value", o)), t.$on( + l[1]), t = new $s({ props: a }), pn.push(() => sl(t, "value", o)), t.$on( "change", /*change_handler*/ - l[39] + l[40] ), { c() { - e = bn("div"), st(t.$$.fragment), fn(e, "class", "image-frame svelte-1gjdske"), Uo( + e = hn("div"), rt(t.$$.fragment), un(e, "class", "image-frame svelte-1gjdske"), Oo( e, "selectable", /*selectable*/ @@ -7691,7 +7734,7 @@ function Wo(l) { ); }, m(r, s) { - kt(r, e, s), rt(t, e, null), i = !0; + Ct(r, e, s), ut(t, e, null), i = !0; }, p(r, s) { const f = {}; @@ -7709,14 +7752,16 @@ function Wo(l) { 65536 && (f.handleSize = /*handleSize*/ r[16]), s[0] & /*boxThickness*/ 131072 && (f.boxThickness = /*boxThickness*/ - r[17]), s[0] & /*boxSelectedThickness*/ - 262144 && (f.boxSelectedThickness = /*boxSelectedThickness*/ - r[18]), s[0] & /*value*/ + r[17]), s[0] & /*disableEditBoxes*/ + 262144 && (f.disableEditBoxes = /*disableEditBoxes*/ + r[18]), s[0] & /*boxSelectedThickness*/ + 524288 && (f.boxSelectedThickness = /*boxSelectedThickness*/ + r[19]), s[0] & /*value*/ 2 && (f.src = /*value*/ r[1].image.url), !n && s[0] & /*value*/ 2 && (n = !0, f.value = /*value*/ - r[1], nl(() => n = !1)), t.$set(f), (!i || s[0] & /*selectable*/ - 32) && Uo( + r[1], ol(() => n = !1)), t.$set(f), (!i || s[0] & /*selectable*/ + 32) && Oo( e, "selectable", /*selectable*/ @@ -7724,21 +7769,21 @@ function Wo(l) { ); }, i(r) { - i || (W(t.$$.fragment, r), i = !0); + i || (O(t.$$.fragment, r), i = !0); }, o(r) { - J(t.$$.fragment, r), i = !1; + G(t.$$.fragment, r), i = !1; }, d(r) { - r && pt(e), at(t); + r && yt(e), ft(t); } } ); } -function Vo(l) { +function Zo(l) { let e, t, n; function i(a) { - l[40](a); + l[41](a); } let o = { sources: ( @@ -7747,22 +7792,22 @@ function Vo(l) { ), handle_clear: ( /*handle_clear*/ - l[26] + l[27] ), handle_select: ( /*handle_select_source*/ - l[28] + l[29] ) }; return ( /*active_source*/ l[0] !== void 0 && (o.active_source = /*active_source*/ - l[0]), e = new Ou({ props: o }), wn.push(() => ll(e, "active_source", i)), { + l[0]), e = new Ou({ props: o }), pn.push(() => sl(e, "active_source", i)), { c() { - st(e.$$.fragment); + rt(e.$$.fragment); }, m(a, r) { - rt(e, a, r), n = !0; + ut(e, a, r), n = !0; }, p(a, r) { const s = {}; @@ -7770,62 +7815,62 @@ function Vo(l) { 16 && (s.sources = /*sources*/ a[4]), !t && r[0] & /*active_source*/ 1 && (t = !0, s.active_source = /*active_source*/ - a[0], nl(() => t = !1)), e.$set(s); + a[0], ol(() => t = !1)), e.$set(s); }, i(a) { - n || (W(e.$$.fragment, a), n = !0); + n || (O(e.$$.fragment, a), n = !0); }, o(a) { - J(e.$$.fragment, a), n = !1; + G(e.$$.fragment, a), n = !1; }, d(a) { - at(e, a); + ft(e, a); } } ); } function j0(l) { - let e, t, n, i, o, a, r, s, f, u, c, d, _, h = ( + let e, t, n, i, o, a, r, s, f, u, c, _, d, h = ( /*sources*/ (l[4].length > 1 || /*sources*/ l[4].includes("clipboard")) && /*value*/ l[1] === null && /*interactive*/ l[7] - ), m; + ), b; e = new mr({ props: { show_label: ( /*show_label*/ l[3] ), - Icon: ts, + Icon: ls, label: ( /*label*/ l[2] || "Image Annotator" ) } }); - let b = ( + let m = ( /*showDownloadButton*/ l[10] && /*value*/ - l[1] !== null && No(l) - ), g = ( + l[1] !== null && Xo(l) + ), w = ( /*showShareButton*/ l[9] && /*value*/ - l[1] !== null && Oo(l) - ), w = ( + l[1] !== null && Yo(l) + ), k = ( /*showClearButton*/ l[11] && /*value*/ l[1] !== null && /*interactive*/ - l[7] && Xo(l) + l[7] && Wo(l) ); - function p(k) { - l[35](k); + function g(v) { + l[36](v); } - function C(k) { - l[36](k); + function S(v) { + l[37](v); } - let E = { + let M = { hidden: ( /*value*/ l[1] !== null @@ -7840,252 +7885,253 @@ function j0(l) { ), max_file_size: ( /*max_file_size*/ - l[19] + l[20] ), disable_click: !/*sources*/ l[4].includes("upload"), upload: ( /*cli_upload*/ - l[20] + l[21] ), stream_handler: ( /*stream_handler*/ - l[21] + l[22] ), - $$slots: { default: [B0] }, + $$slots: { default: [T0] }, $$scope: { ctx: l } }; /*uploading*/ - l[22] !== void 0 && (E.uploading = /*uploading*/ - l[22]), /*dragging*/ - l[23] !== void 0 && (E.dragging = /*dragging*/ - l[23]), f = new v_({ props: E }), l[34](f), wn.push(() => ll(f, "uploading", p)), wn.push(() => ll(f, "dragging", C)), f.$on( + l[23] !== void 0 && (M.uploading = /*uploading*/ + l[23]), /*dragging*/ + l[24] !== void 0 && (M.dragging = /*dragging*/ + l[24]), f = new v_({ props: M }), l[35](f), pn.push(() => sl(f, "uploading", g)), pn.push(() => sl(f, "dragging", S)), f.$on( "load", /*handle_upload*/ - l[25] + l[26] ), f.$on( "error", /*error_handler_1*/ - l[37] + l[38] ); - let v = ( + let y = ( /*value*/ - l[1] !== null && Wo(l) - ), z = h && Vo(l); + l[1] !== null && Po(l) + ), z = h && Zo(l); return { c() { - st(e.$$.fragment), t = jt(), n = bn("div"), b && b.c(), i = jt(), g && g.c(), o = jt(), w && w.c(), a = jt(), r = bn("div"), s = bn("div"), st(f.$$.fragment), d = jt(), v && v.c(), _ = jt(), z && z.c(), fn(n, "class", "icon-buttons svelte-1gjdske"), fn(s, "class", "upload-container svelte-1gjdske"), fn(r, "data-testid", "image"), fn(r, "class", "image-container svelte-1gjdske"); + rt(e.$$.fragment), t = Ht(), n = hn("div"), m && m.c(), i = Ht(), w && w.c(), o = Ht(), k && k.c(), a = Ht(), r = hn("div"), s = hn("div"), rt(f.$$.fragment), _ = Ht(), y && y.c(), d = Ht(), z && z.c(), un(n, "class", "icon-buttons svelte-1gjdske"), un(s, "class", "upload-container svelte-1gjdske"), un(r, "data-testid", "image"), un(r, "class", "image-container svelte-1gjdske"); }, - m(k, q) { - rt(e, k, q), kt(k, t, q), kt(k, n, q), b && b.m(n, null), tn(n, i), g && g.m(n, null), tn(n, o), w && w.m(n, null), kt(k, a, q), kt(k, r, q), tn(r, s), rt(f, s, null), tn(s, d), v && v.m(s, null), tn(r, _), z && z.m(r, null), m = !0; + m(v, q) { + ut(e, v, q), Ct(v, t, q), Ct(v, n, q), m && m.m(n, null), tn(n, i), w && w.m(n, null), tn(n, o), k && k.m(n, null), Ct(v, a, q), Ct(v, r, q), tn(r, s), ut(f, s, null), tn(s, _), y && y.m(s, null), tn(r, d), z && z.m(r, null), b = !0; }, - p(k, q) { - const F = {}; + p(v, q) { + const R = {}; q[0] & /*show_label*/ - 8 && (F.show_label = /*show_label*/ - k[3]), q[0] & /*label*/ - 4 && (F.label = /*label*/ - k[2] || "Image Annotator"), e.$set(F), /*showDownloadButton*/ - k[10] && /*value*/ - k[1] !== null ? b ? (b.p(k, q), q[0] & /*showDownloadButton, value*/ - 1026 && W(b, 1)) : (b = No(k), b.c(), W(b, 1), b.m(n, i)) : b && (Ot(), J(b, 1, 1, () => { - b = null; - }), Nt()), /*showShareButton*/ - k[9] && /*value*/ - k[1] !== null ? g ? (g.p(k, q), q[0] & /*showShareButton, value*/ - 514 && W(g, 1)) : (g = Oo(k), g.c(), W(g, 1), g.m(n, o)) : g && (Ot(), J(g, 1, 1, () => { - g = null; - }), Nt()), /*showClearButton*/ - k[11] && /*value*/ - k[1] !== null && /*interactive*/ - k[7] ? w ? (w.p(k, q), q[0] & /*showClearButton, value, interactive*/ - 2178 && W(w, 1)) : (w = Xo(k), w.c(), W(w, 1), w.m(n, null)) : w && (Ot(), J(w, 1, 1, () => { + 8 && (R.show_label = /*show_label*/ + v[3]), q[0] & /*label*/ + 4 && (R.label = /*label*/ + v[2] || "Image Annotator"), e.$set(R), /*showDownloadButton*/ + v[10] && /*value*/ + v[1] !== null ? m ? (m.p(v, q), q[0] & /*showDownloadButton, value*/ + 1026 && O(m, 1)) : (m = Xo(v), m.c(), O(m, 1), m.m(n, i)) : m && (Xt(), G(m, 1, 1, () => { + m = null; + }), Ot()), /*showShareButton*/ + v[9] && /*value*/ + v[1] !== null ? w ? (w.p(v, q), q[0] & /*showShareButton, value*/ + 514 && O(w, 1)) : (w = Yo(v), w.c(), O(w, 1), w.m(n, o)) : w && (Xt(), G(w, 1, 1, () => { w = null; - }), Nt()); - const j = {}; + }), Ot()), /*showClearButton*/ + v[11] && /*value*/ + v[1] !== null && /*interactive*/ + v[7] ? k ? (k.p(v, q), q[0] & /*showClearButton, value, interactive*/ + 2178 && O(k, 1)) : (k = Wo(v), k.c(), O(k, 1), k.m(n, null)) : k && (Xt(), G(k, 1, 1, () => { + k = null; + }), Ot()); + const I = {}; q[0] & /*value*/ - 2 && (j.hidden = /*value*/ - k[1] !== null), q[0] & /*active_source*/ - 1 && (j.filetype = /*active_source*/ - k[0] === "clipboard" ? "clipboard" : "image/*"), q[0] & /*root*/ - 64 && (j.root = /*root*/ - k[6]), q[0] & /*max_file_size*/ - 524288 && (j.max_file_size = /*max_file_size*/ - k[19]), q[0] & /*sources*/ - 16 && (j.disable_click = !/*sources*/ - k[4].includes("upload")), q[0] & /*cli_upload*/ - 1048576 && (j.upload = /*cli_upload*/ - k[20]), q[0] & /*stream_handler*/ - 2097152 && (j.stream_handler = /*stream_handler*/ - k[21]), q[0] & /*value*/ + 2 && (I.hidden = /*value*/ + v[1] !== null), q[0] & /*active_source*/ + 1 && (I.filetype = /*active_source*/ + v[0] === "clipboard" ? "clipboard" : "image/*"), q[0] & /*root*/ + 64 && (I.root = /*root*/ + v[6]), q[0] & /*max_file_size*/ + 1048576 && (I.max_file_size = /*max_file_size*/ + v[20]), q[0] & /*sources*/ + 16 && (I.disable_click = !/*sources*/ + v[4].includes("upload")), q[0] & /*cli_upload*/ + 2097152 && (I.upload = /*cli_upload*/ + v[21]), q[0] & /*stream_handler*/ + 4194304 && (I.stream_handler = /*stream_handler*/ + v[22]), q[0] & /*value*/ 2 | q[1] & /*$$scope*/ - 1024 && (j.$$scope = { dirty: q, ctx: k }), !u && q[0] & /*uploading*/ - 4194304 && (u = !0, j.uploading = /*uploading*/ - k[22], nl(() => u = !1)), !c && q[0] & /*dragging*/ - 8388608 && (c = !0, j.dragging = /*dragging*/ - k[23], nl(() => c = !1)), f.$set(j), /*value*/ - k[1] !== null ? v ? (v.p(k, q), q[0] & /*value*/ - 2 && W(v, 1)) : (v = Wo(k), v.c(), W(v, 1), v.m(s, null)) : v && (Ot(), J(v, 1, 1, () => { - v = null; - }), Nt()), q[0] & /*sources, value, interactive*/ + 2048 && (I.$$scope = { dirty: q, ctx: v }), !u && q[0] & /*uploading*/ + 8388608 && (u = !0, I.uploading = /*uploading*/ + v[23], ol(() => u = !1)), !c && q[0] & /*dragging*/ + 16777216 && (c = !0, I.dragging = /*dragging*/ + v[24], ol(() => c = !1)), f.$set(I), /*value*/ + v[1] !== null ? y ? (y.p(v, q), q[0] & /*value*/ + 2 && O(y, 1)) : (y = Po(v), y.c(), O(y, 1), y.m(s, null)) : y && (Xt(), G(y, 1, 1, () => { + y = null; + }), Ot()), q[0] & /*sources, value, interactive*/ 146 && (h = /*sources*/ - (k[4].length > 1 || /*sources*/ - k[4].includes("clipboard")) && /*value*/ - k[1] === null && /*interactive*/ - k[7]), h ? z ? (z.p(k, q), q[0] & /*sources, value, interactive*/ - 146 && W(z, 1)) : (z = Vo(k), z.c(), W(z, 1), z.m(r, null)) : z && (Ot(), J(z, 1, 1, () => { + (v[4].length > 1 || /*sources*/ + v[4].includes("clipboard")) && /*value*/ + v[1] === null && /*interactive*/ + v[7]), h ? z ? (z.p(v, q), q[0] & /*sources, value, interactive*/ + 146 && O(z, 1)) : (z = Zo(v), z.c(), O(z, 1), z.m(r, null)) : z && (Xt(), G(z, 1, 1, () => { z = null; - }), Nt()); + }), Ot()); }, - i(k) { - m || (W(e.$$.fragment, k), W(b), W(g), W(w), W(f.$$.fragment, k), W(v), W(z), m = !0); + i(v) { + b || (O(e.$$.fragment, v), O(m), O(w), O(k), O(f.$$.fragment, v), O(y), O(z), b = !0); }, - o(k) { - J(e.$$.fragment, k), J(b), J(g), J(w), J(f.$$.fragment, k), J(v), J(z), m = !1; + o(v) { + G(e.$$.fragment, v), G(m), G(w), G(k), G(f.$$.fragment, v), G(y), G(z), b = !1; }, - d(k) { - k && (pt(t), pt(n), pt(a), pt(r)), at(e, k), b && b.d(), g && g.d(), w && w.d(), l[34](null), at(f), v && v.d(), z && z.d(); + d(v) { + v && (yt(t), yt(n), yt(a), yt(r)), ft(e, v), m && m.d(), w && w.d(), k && k.d(), l[35](null), ft(f), y && y.d(), z && z.d(); } }; } function I0(l, e, t) { let { $$slots: n = {}, $$scope: i } = e; - var o = this && this.__awaiter || function(y, ee, ue, pe) { - function A(B) { - return B instanceof ue ? B : new ue(function(O) { - O(B); + var o = this && this.__awaiter || function(C, Se, he, ze) { + function me(E) { + return E instanceof he ? E : new he(function(D) { + D(E); }); } - return new (ue || (ue = Promise))(function(B, O) { - function V(Se) { + return new (he || (he = Promise))(function(E, D) { + function Y(J) { try { - ce(pe.next(Se)); - } catch (Jt) { - O(Jt); + qe(ze.next(J)); + } catch (Qe) { + D(Qe); } } - function Ee(Se) { + function be(J) { try { - ce(pe.throw(Se)); - } catch (Jt) { - O(Jt); + qe(ze.throw(J)); + } catch (Qe) { + D(Qe); } } - function ce(Se) { - Se.done ? B(Se.value) : A(Se.value).then(V, Ee); + function qe(J) { + J.done ? E(J.value) : me(J.value).then(Y, be); } - ce((pe = pe.apply(y, ee || [])).next()); + qe((ze = ze.apply(C, Se || [])).next()); }); }; - let { value: a } = e, { label: r = void 0 } = e, { show_label: s } = e, { sources: f = ["upload", "clipboard"] } = e, { selectable: u = !1 } = e, { root: c } = e, { interactive: d } = e, { i18n: _ } = e, { showShareButton: h } = e, { showDownloadButton: m } = e, { showClearButton: b } = e, { boxesAlpha: g } = e, { labelList: w } = e, { labelColors: p } = e, { boxMinSize: C } = e, { handleSize: E } = e, { boxThickness: v } = e, { boxSelectedThickness: z } = e, { max_file_size: k = null } = e, { cli_upload: q } = e, { stream_handler: F } = e, j, D = !1, { active_source: N = null } = e; - function K({ detail: y }) { - t(1, a = new v0()), t(1, a.image = y, a), X("upload"); + let { value: a } = e, { label: r = void 0 } = e, { show_label: s } = e, { sources: f = ["upload", "clipboard"] } = e, { selectable: u = !1 } = e, { root: c } = e, { interactive: _ } = e, { i18n: d } = e, { showShareButton: h } = e, { showDownloadButton: b } = e, { showClearButton: m } = e, { boxesAlpha: w } = e, { labelList: k } = e, { labelColors: g } = e, { boxMinSize: S } = e, { handleSize: M } = e, { boxThickness: y } = e, { disableEditBoxes: z } = e, { boxSelectedThickness: v } = e, { max_file_size: q = null } = e, { cli_upload: R } = e, { stream_handler: I } = e, B, W = !1, { active_source: H = null } = e; + function le({ detail: C }) { + t(1, a = new v0()), t(1, a.image = C, a), ee("upload"); } - function $() { - re(), X("clear"), X("change"); + function X() { + L(), ee("clear"), ee("change"); } - const X = D0(); - let se = !1; - function we(y) { + const ee = L0(); + let ae = !1; + function ye(C) { return o(this, void 0, void 0, function* () { - switch (y) { + switch (C) { case "clipboard": - j.paste_clipboard(); + B.paste_clipboard(); break; } }); } - function re() { + function L() { t(1, a = null); } - const T = async (y) => y === null ? "" : ``; - function ae(y) { - Vl.call(this, l, y); + const de = async (C) => C === null ? "" : ``; + function Ae(C) { + Pl.call(this, l, C); } - function fe(y) { - Vl.call(this, l, y); + function Le(C) { + Pl.call(this, l, C); } - function Ye(y) { - wn[y ? "unshift" : "push"](() => { - j = y, t(24, j); + function Ce(C) { + pn[C ? "unshift" : "push"](() => { + B = C, t(25, B); }); } - function We(y) { - D = y, t(22, D); + function A(C) { + W = C, t(23, W); } - function L(y) { - se = y, t(23, se); + function Ve(C) { + ae = C, t(24, ae); } - function M(y) { - Vl.call(this, l, y); + function p(C) { + Pl.call(this, l, C); } - function S(y) { - a = y, t(1, a); + function F(C) { + a = C, t(1, a); } - const H = () => X("change"); - function G(y) { - N = y, t(0, N), t(4, f); + const Z = () => ee("change"); + function K(C) { + H = C, t(0, H), t(4, f); } - return l.$$set = (y) => { - "value" in y && t(1, a = y.value), "label" in y && t(2, r = y.label), "show_label" in y && t(3, s = y.show_label), "sources" in y && t(4, f = y.sources), "selectable" in y && t(5, u = y.selectable), "root" in y && t(6, c = y.root), "interactive" in y && t(7, d = y.interactive), "i18n" in y && t(8, _ = y.i18n), "showShareButton" in y && t(9, h = y.showShareButton), "showDownloadButton" in y && t(10, m = y.showDownloadButton), "showClearButton" in y && t(11, b = y.showClearButton), "boxesAlpha" in y && t(12, g = y.boxesAlpha), "labelList" in y && t(13, w = y.labelList), "labelColors" in y && t(14, p = y.labelColors), "boxMinSize" in y && t(15, C = y.boxMinSize), "handleSize" in y && t(16, E = y.handleSize), "boxThickness" in y && t(17, v = y.boxThickness), "boxSelectedThickness" in y && t(18, z = y.boxSelectedThickness), "max_file_size" in y && t(19, k = y.max_file_size), "cli_upload" in y && t(20, q = y.cli_upload), "stream_handler" in y && t(21, F = y.stream_handler), "active_source" in y && t(0, N = y.active_source), "$$scope" in y && t(41, i = y.$$scope); + return l.$$set = (C) => { + "value" in C && t(1, a = C.value), "label" in C && t(2, r = C.label), "show_label" in C && t(3, s = C.show_label), "sources" in C && t(4, f = C.sources), "selectable" in C && t(5, u = C.selectable), "root" in C && t(6, c = C.root), "interactive" in C && t(7, _ = C.interactive), "i18n" in C && t(8, d = C.i18n), "showShareButton" in C && t(9, h = C.showShareButton), "showDownloadButton" in C && t(10, b = C.showDownloadButton), "showClearButton" in C && t(11, m = C.showClearButton), "boxesAlpha" in C && t(12, w = C.boxesAlpha), "labelList" in C && t(13, k = C.labelList), "labelColors" in C && t(14, g = C.labelColors), "boxMinSize" in C && t(15, S = C.boxMinSize), "handleSize" in C && t(16, M = C.handleSize), "boxThickness" in C && t(17, y = C.boxThickness), "disableEditBoxes" in C && t(18, z = C.disableEditBoxes), "boxSelectedThickness" in C && t(19, v = C.boxSelectedThickness), "max_file_size" in C && t(20, q = C.max_file_size), "cli_upload" in C && t(21, R = C.cli_upload), "stream_handler" in C && t(22, I = C.stream_handler), "active_source" in C && t(0, H = C.active_source), "$$scope" in C && t(42, i = C.$$scope); }, l.$$.update = () => { l.$$.dirty[0] & /*uploading*/ - 4194304 && D && re(), l.$$.dirty[0] & /*dragging*/ - 8388608 && X("drag", se), l.$$.dirty[0] & /*active_source, sources*/ - 17 && !N && f && t(0, N = f[0]); + 8388608 && W && L(), l.$$.dirty[0] & /*dragging*/ + 16777216 && ee("drag", ae), l.$$.dirty[0] & /*active_source, sources*/ + 17 && !H && f && t(0, H = f[0]); }, [ - N, + H, a, r, s, f, u, c, - d, _, + d, h, - m, b, - g, + m, w, - p, - C, - E, - v, - z, k, + g, + S, + M, + y, + z, + v, q, - F, - D, - se, - j, - K, - $, - X, - we, - re, - n, - T, + R, + I, + W, ae, - fe, - Ye, - We, + B, + le, + X, + ee, + ye, L, - M, - S, - H, - G, + n, + de, + Ae, + Le, + Ce, + A, + Ve, + p, + F, + Z, + K, i ]; } class R0 extends y0 { constructor(e) { - super(), M0( + super(), E0( this, e, I0, j0, - A0, + B0, { value: 1, label: 2, @@ -8104,10 +8150,11 @@ class R0 extends y0 { boxMinSize: 15, handleSize: 16, boxThickness: 17, - boxSelectedThickness: 18, - max_file_size: 19, - cli_upload: 20, - stream_handler: 21, + disableEditBoxes: 18, + boxSelectedThickness: 19, + max_file_size: 20, + cli_upload: 21, + stream_handler: 22, active_source: 0 }, null, @@ -8128,13 +8175,13 @@ const { insert: P0, mount_component: Z0, safe_not_equal: K0, - toggle_class: et, - transition_in: Vn, - transition_out: fi + toggle_class: nt, + transition_in: Kn, + transition_out: ui } = window.__gradio__svelte__internal; -function Po(l) { +function Ko(l) { let e, t; - return e = new Qs({ + return e = new $s({ props: { src: ( /*samples_dir*/ @@ -8158,10 +8205,10 @@ function Po(l) { n[0].path), e.$set(o); }, i(n) { - t || (Vn(e.$$.fragment, n), t = !0); + t || (Kn(e.$$.fragment, n), t = !0); }, o(n) { - fi(e.$$.fragment, n), t = !1; + ui(e.$$.fragment, n), t = !1; }, d(n) { O0(e, n); @@ -8171,26 +8218,26 @@ function Po(l) { function G0(l) { let e, t, n = ( /*value*/ - l[0] && Po(l) + l[0] && Ko(l) ); return { c() { - e = Y0("div"), n && n.c(), H0(e, "class", "container svelte-1sgcyba"), et( + e = Y0("div"), n && n.c(), H0(e, "class", "container svelte-1sgcyba"), nt( e, "table", /*type*/ l[2] === "table" - ), et( + ), nt( e, "gallery", /*type*/ l[2] === "gallery" - ), et( + ), nt( e, "selected", /*selected*/ l[3] - ), et( + ), nt( e, "border", /*value*/ @@ -8203,28 +8250,28 @@ function G0(l) { p(i, [o]) { /*value*/ i[0] ? n ? (n.p(i, o), o & /*value*/ - 1 && Vn(n, 1)) : (n = Po(i), n.c(), Vn(n, 1), n.m(e, null)) : n && (W0(), fi(n, 1, 1, () => { + 1 && Kn(n, 1)) : (n = Ko(i), n.c(), Kn(n, 1), n.m(e, null)) : n && (W0(), ui(n, 1, 1, () => { n = null; }), U0()), (!t || o & /*type*/ - 4) && et( + 4) && nt( e, "table", /*type*/ i[2] === "table" ), (!t || o & /*type*/ - 4) && et( + 4) && nt( e, "gallery", /*type*/ i[2] === "gallery" ), (!t || o & /*selected*/ - 8) && et( + 8) && nt( e, "selected", /*selected*/ i[3] ), (!t || o & /*value*/ - 1) && et( + 1) && nt( e, "border", /*value*/ @@ -8232,10 +8279,10 @@ function G0(l) { ); }, i(i) { - t || (Vn(n), t = !0); + t || (Kn(n), t = !0); }, o(i) { - fi(n), t = !1; + ui(n), t = !1; }, d(i) { i && X0(e), n && n.d(); @@ -8260,26 +8307,26 @@ class p1 extends F0 { } const { SvelteComponent: Q0, - add_flush_callback: Zo, + add_flush_callback: Go, assign: x0, - bind: Ko, - binding_callbacks: Go, + bind: Jo, + binding_callbacks: Qo, check_outros: $0, - create_component: St, - destroy_component: zt, - detach: xs, + create_component: Mt, + destroy_component: Bt, + detach: ea, empty: e1, - flush: Y, + flush: N, get_spread_object: t1, get_spread_update: n1, group_outros: l1, init: i1, - insert: $s, - mount_component: qt, + insert: ta, + mount_component: At, safe_not_equal: o1, space: s1, - transition_in: Ke, - transition_out: Ge + transition_in: Ge, + transition_out: Je } = window.__gradio__svelte__internal; function a1(l) { let e, t; @@ -8292,113 +8339,113 @@ function a1(l) { } }), { c() { - St(e.$$.fragment); + Mt(e.$$.fragment); }, m(n, i) { - qt(e, n, i), t = !0; + At(e, n, i), t = !0; }, p(n, i) { const o = {}; i[1] & /*$$scope*/ - 256 && (o.$$scope = { dirty: i, ctx: n }), e.$set(o); + 512 && (o.$$scope = { dirty: i, ctx: n }), e.$set(o); }, i(n) { - t || (Ke(e.$$.fragment, n), t = !0); + t || (Ge(e.$$.fragment, n), t = !0); }, o(n) { - Ge(e.$$.fragment, n), t = !1; + Je(e.$$.fragment, n), t = !1; }, d(n) { - zt(e, n); + Bt(e, n); } }; } function r1(l) { let e, t; - return e = new as({ + return e = new fs({ props: { i18n: ( /*gradio*/ - l[26].i18n + l[27].i18n ), type: "clipboard", mode: "short" } }), { c() { - St(e.$$.fragment); + Mt(e.$$.fragment); }, m(n, i) { - qt(e, n, i), t = !0; + At(e, n, i), t = !0; }, p(n, i) { const o = {}; i[0] & /*gradio*/ - 67108864 && (o.i18n = /*gradio*/ - n[26].i18n), e.$set(o); + 134217728 && (o.i18n = /*gradio*/ + n[27].i18n), e.$set(o); }, i(n) { - t || (Ke(e.$$.fragment, n), t = !0); + t || (Ge(e.$$.fragment, n), t = !0); }, o(n) { - Ge(e.$$.fragment, n), t = !1; + Je(e.$$.fragment, n), t = !1; }, d(n) { - zt(e, n); + Bt(e, n); } }; } function f1(l) { let e, t; - return e = new as({ + return e = new fs({ props: { i18n: ( /*gradio*/ - l[26].i18n + l[27].i18n ), type: "image" } }), { c() { - St(e.$$.fragment); + Mt(e.$$.fragment); }, m(n, i) { - qt(e, n, i), t = !0; + At(e, n, i), t = !0; }, p(n, i) { const o = {}; i[0] & /*gradio*/ - 67108864 && (o.i18n = /*gradio*/ - n[26].i18n), e.$set(o); + 134217728 && (o.i18n = /*gradio*/ + n[27].i18n), e.$set(o); }, i(n) { - t || (Ke(e.$$.fragment, n), t = !0); + t || (Ge(e.$$.fragment, n), t = !0); }, o(n) { - Ge(e.$$.fragment, n), t = !1; + Je(e.$$.fragment, n), t = !1; }, d(n) { - zt(e, n); + Bt(e, n); } }; } function u1(l) { let e, t; - return e = new ts({}), { + return e = new ls({}), { c() { - St(e.$$.fragment); + Mt(e.$$.fragment); }, m(n, i) { - qt(e, n, i), t = !0; + At(e, n, i), t = !0; }, i(n) { - t || (Ke(e.$$.fragment, n), t = !0); + t || (Ge(e.$$.fragment, n), t = !0); }, o(n) { - Ge(e.$$.fragment, n), t = !1; + Je(e.$$.fragment, n), t = !1; }, d(n) { - zt(e, n); + Bt(e, n); } }; } @@ -8408,9 +8455,9 @@ function c1(l) { function r(s, f) { return ( /*active_source*/ - s[28] === "upload" ? 0 : ( + s[29] === "upload" ? 0 : ( /*active_source*/ - s[28] === "clipboard" ? 1 : 2 + s[29] === "clipboard" ? 1 : 2 ) ); } @@ -8419,22 +8466,22 @@ function c1(l) { t.c(), n = e1(); }, m(s, f) { - a[e].m(s, f), $s(s, n, f), i = !0; + a[e].m(s, f), ta(s, n, f), i = !0; }, p(s, f) { let u = e; - e = r(s), e === u ? a[e].p(s, f) : (l1(), Ge(a[u], 1, 1, () => { + e = r(s), e === u ? a[e].p(s, f) : (l1(), Je(a[u], 1, 1, () => { a[u] = null; - }), $0(), t = a[e], t ? t.p(s, f) : (t = a[e] = o[e](s), t.c()), Ke(t, 1), t.m(n.parentNode, n)); + }), $0(), t = a[e], t ? t.p(s, f) : (t = a[e] = o[e](s), t.c()), Ge(t, 1), t.m(n.parentNode, n)); }, i(s) { - i || (Ke(t), i = !0); + i || (Ge(t), i = !0); }, o(s) { - Ge(t), i = !1; + Je(t), i = !1; }, d(s) { - s && xs(n), a[e].d(s); + s && ea(n), a[e].d(s); } }; } @@ -8444,25 +8491,25 @@ function _1(l) { { autoscroll: ( /*gradio*/ - l[26].autoscroll + l[27].autoscroll ) }, { i18n: ( /*gradio*/ - l[26].i18n + l[27].i18n ) }, /*loading_status*/ l[1] ]; let s = {}; - for (let d = 0; d < r.length; d += 1) - s = x0(s, r[d]); + for (let _ = 0; _ < r.length; _ += 1) + s = x0(s, r[_]); e = new Sc({ props: s }); - function f(d) { - l[29](d); + function f(_) { + l[30](_); } - function u(d) { - l[30](d); + function u(_) { + l[31](_); } let c = { selectable: ( @@ -8495,7 +8542,7 @@ function _1(l) { ), i18n: ( /*gradio*/ - l[26].i18n + l[27].i18n ), boxesAlpha: ( /*boxes_alpha*/ @@ -8523,15 +8570,15 @@ function _1(l) { ), max_file_size: ( /*gradio*/ - l[26].max_file_size + l[27].max_file_size ), cli_upload: ( /*gradio*/ - l[26].client.upload + l[27].client.upload ), stream_handler: ( /*gradio*/ - l[26].client.stream + l[27].client.stream ), handleSize: ( /*handle_size*/ @@ -8545,132 +8592,138 @@ function _1(l) { /*box_selected_thickness*/ l[25] ), + disableEditBoxes: ( + /*disable_edit_boxes*/ + l[26] + ), $$slots: { default: [c1] }, $$scope: { ctx: l } }; return ( /*active_source*/ - l[28] !== void 0 && (c.active_source = /*active_source*/ - l[28]), /*value*/ + l[29] !== void 0 && (c.active_source = /*active_source*/ + l[29]), /*value*/ l[0] !== void 0 && (c.value = /*value*/ - l[0]), n = new R0({ props: c }), Go.push(() => Ko(n, "active_source", f)), Go.push(() => Ko(n, "value", u)), n.$on( + l[0]), n = new R0({ props: c }), Qo.push(() => Jo(n, "active_source", f)), Qo.push(() => Jo(n, "value", u)), n.$on( "change", /*change_handler*/ - l[31] + l[32] ), n.$on( "edit", /*edit_handler*/ - l[32] + l[33] ), n.$on( "clear", /*clear_handler*/ - l[33] + l[34] ), n.$on( "drag", /*drag_handler*/ - l[34] + l[35] ), n.$on( "upload", /*upload_handler*/ - l[35] + l[36] ), n.$on( "select", /*select_handler*/ - l[36] + l[37] ), n.$on( "share", /*share_handler*/ - l[37] + l[38] ), n.$on( "error", /*error_handler*/ - l[38] + l[39] ), { c() { - St(e.$$.fragment), t = s1(), St(n.$$.fragment); + Mt(e.$$.fragment), t = s1(), Mt(n.$$.fragment); }, - m(d, _) { - qt(e, d, _), $s(d, t, _), qt(n, d, _), a = !0; + m(_, d) { + At(e, _, d), ta(_, t, d), At(n, _, d), a = !0; }, - p(d, _) { - const h = _[0] & /*gradio, loading_status*/ - 67108866 ? n1(r, [ - _[0] & /*gradio*/ - 67108864 && { + p(_, d) { + const h = d[0] & /*gradio, loading_status*/ + 134217730 ? n1(r, [ + d[0] & /*gradio*/ + 134217728 && { autoscroll: ( /*gradio*/ - d[26].autoscroll + _[27].autoscroll ) }, - _[0] & /*gradio*/ - 67108864 && { i18n: ( + d[0] & /*gradio*/ + 134217728 && { i18n: ( /*gradio*/ - d[26].i18n + _[27].i18n ) }, - _[0] & /*loading_status*/ + d[0] & /*loading_status*/ 2 && t1( /*loading_status*/ - d[1] + _[1] ) ]) : {}; e.$set(h); - const m = {}; - _[0] & /*_selectable*/ - 1024 && (m.selectable = /*_selectable*/ - d[10]), _[0] & /*root*/ - 128 && (m.root = /*root*/ - d[7]), _[0] & /*sources*/ - 16384 && (m.sources = /*sources*/ - d[14]), _[0] & /*interactive*/ - 262144 && (m.interactive = /*interactive*/ - d[18]), _[0] & /*show_download_button*/ - 32768 && (m.showDownloadButton = /*show_download_button*/ - d[15]), _[0] & /*show_share_button*/ - 65536 && (m.showShareButton = /*show_share_button*/ - d[16]), _[0] & /*show_clear_button*/ - 131072 && (m.showClearButton = /*show_clear_button*/ - d[17]), _[0] & /*gradio*/ - 67108864 && (m.i18n = /*gradio*/ - d[26].i18n), _[0] & /*boxes_alpha*/ - 524288 && (m.boxesAlpha = /*boxes_alpha*/ - d[19]), _[0] & /*label_list*/ - 1048576 && (m.labelList = /*label_list*/ - d[20]), _[0] & /*label_colors*/ - 2097152 && (m.labelColors = /*label_colors*/ - d[21]), _[0] & /*box_min_size*/ - 4194304 && (m.boxMinSize = /*box_min_size*/ - d[22]), _[0] & /*label*/ - 32 && (m.label = /*label*/ - d[5]), _[0] & /*show_label*/ - 64 && (m.show_label = /*show_label*/ - d[6]), _[0] & /*gradio*/ - 67108864 && (m.max_file_size = /*gradio*/ - d[26].max_file_size), _[0] & /*gradio*/ - 67108864 && (m.cli_upload = /*gradio*/ - d[26].client.upload), _[0] & /*gradio*/ - 67108864 && (m.stream_handler = /*gradio*/ - d[26].client.stream), _[0] & /*handle_size*/ - 8388608 && (m.handleSize = /*handle_size*/ - d[23]), _[0] & /*box_thickness*/ - 16777216 && (m.boxThickness = /*box_thickness*/ - d[24]), _[0] & /*box_selected_thickness*/ - 33554432 && (m.boxSelectedThickness = /*box_selected_thickness*/ - d[25]), _[0] & /*gradio, active_source*/ - 335544320 | _[1] & /*$$scope*/ - 256 && (m.$$scope = { dirty: _, ctx: d }), !i && _[0] & /*active_source*/ - 268435456 && (i = !0, m.active_source = /*active_source*/ - d[28], Zo(() => i = !1)), !o && _[0] & /*value*/ - 1 && (o = !0, m.value = /*value*/ - d[0], Zo(() => o = !1)), n.$set(m); + const b = {}; + d[0] & /*_selectable*/ + 1024 && (b.selectable = /*_selectable*/ + _[10]), d[0] & /*root*/ + 128 && (b.root = /*root*/ + _[7]), d[0] & /*sources*/ + 16384 && (b.sources = /*sources*/ + _[14]), d[0] & /*interactive*/ + 262144 && (b.interactive = /*interactive*/ + _[18]), d[0] & /*show_download_button*/ + 32768 && (b.showDownloadButton = /*show_download_button*/ + _[15]), d[0] & /*show_share_button*/ + 65536 && (b.showShareButton = /*show_share_button*/ + _[16]), d[0] & /*show_clear_button*/ + 131072 && (b.showClearButton = /*show_clear_button*/ + _[17]), d[0] & /*gradio*/ + 134217728 && (b.i18n = /*gradio*/ + _[27].i18n), d[0] & /*boxes_alpha*/ + 524288 && (b.boxesAlpha = /*boxes_alpha*/ + _[19]), d[0] & /*label_list*/ + 1048576 && (b.labelList = /*label_list*/ + _[20]), d[0] & /*label_colors*/ + 2097152 && (b.labelColors = /*label_colors*/ + _[21]), d[0] & /*box_min_size*/ + 4194304 && (b.boxMinSize = /*box_min_size*/ + _[22]), d[0] & /*label*/ + 32 && (b.label = /*label*/ + _[5]), d[0] & /*show_label*/ + 64 && (b.show_label = /*show_label*/ + _[6]), d[0] & /*gradio*/ + 134217728 && (b.max_file_size = /*gradio*/ + _[27].max_file_size), d[0] & /*gradio*/ + 134217728 && (b.cli_upload = /*gradio*/ + _[27].client.upload), d[0] & /*gradio*/ + 134217728 && (b.stream_handler = /*gradio*/ + _[27].client.stream), d[0] & /*handle_size*/ + 8388608 && (b.handleSize = /*handle_size*/ + _[23]), d[0] & /*box_thickness*/ + 16777216 && (b.boxThickness = /*box_thickness*/ + _[24]), d[0] & /*box_selected_thickness*/ + 33554432 && (b.boxSelectedThickness = /*box_selected_thickness*/ + _[25]), d[0] & /*disable_edit_boxes*/ + 67108864 && (b.disableEditBoxes = /*disable_edit_boxes*/ + _[26]), d[0] & /*gradio, active_source*/ + 671088640 | d[1] & /*$$scope*/ + 512 && (b.$$scope = { dirty: d, ctx: _ }), !i && d[0] & /*active_source*/ + 536870912 && (i = !0, b.active_source = /*active_source*/ + _[29], Go(() => i = !1)), !o && d[0] & /*value*/ + 1 && (o = !0, b.value = /*value*/ + _[0], Go(() => o = !1)), n.$set(b); }, - i(d) { - a || (Ke(e.$$.fragment, d), Ke(n.$$.fragment, d), a = !0); + i(_) { + a || (Ge(e.$$.fragment, _), Ge(n.$$.fragment, _), a = !0); }, - o(d) { - Ge(e.$$.fragment, d), Ge(n.$$.fragment, d), a = !1; + o(_) { + Je(e.$$.fragment, _), Je(n.$$.fragment, _), a = !1; }, - d(d) { - d && xs(t), zt(e, d), zt(n, d); + d(_) { + _ && ea(t), Bt(e, _), Bt(n, _); } } ); @@ -8686,7 +8739,7 @@ function d1(l) { variant: "solid", border_mode: ( /*dragging*/ - l[27] ? "focus" : "base" + l[28] ? "focus" : "base" ), padding: !1, elem_id: ( @@ -8723,18 +8776,18 @@ function d1(l) { } }), { c() { - St(e.$$.fragment); + Mt(e.$$.fragment); }, m(n, i) { - qt(e, n, i), t = !0; + At(e, n, i), t = !0; }, p(n, i) { const o = {}; i[0] & /*visible*/ 16 && (o.visible = /*visible*/ n[4]), i[0] & /*dragging*/ - 134217728 && (o.border_mode = /*dragging*/ - n[27] ? "focus" : "base"), i[0] & /*elem_id*/ + 268435456 && (o.border_mode = /*dragging*/ + n[28] ? "focus" : "base"), i[0] & /*elem_id*/ 4 && (o.elem_id = /*elem_id*/ n[2]), i[0] & /*elem_classes*/ 8 && (o.elem_classes = /*elem_classes*/ @@ -8748,39 +8801,39 @@ function d1(l) { 4096 && (o.scale = /*scale*/ n[12]), i[0] & /*min_width*/ 8192 && (o.min_width = /*min_width*/ - n[13]), i[0] & /*_selectable, root, sources, interactive, show_download_button, show_share_button, show_clear_button, gradio, boxes_alpha, label_list, label_colors, box_min_size, label, show_label, handle_size, box_thickness, box_selected_thickness, active_source, value, dragging, loading_status*/ - 536855779 | i[1] & /*$$scope*/ - 256 && (o.$$scope = { dirty: i, ctx: n }), e.$set(o); + n[13]), i[0] & /*_selectable, root, sources, interactive, show_download_button, show_share_button, show_clear_button, gradio, boxes_alpha, label_list, label_colors, box_min_size, label, show_label, handle_size, box_thickness, box_selected_thickness, disable_edit_boxes, active_source, value, dragging, loading_status*/ + 1073726691 | i[1] & /*$$scope*/ + 512 && (o.$$scope = { dirty: i, ctx: n }), e.$set(o); }, i(n) { - t || (Ke(e.$$.fragment, n), t = !0); + t || (Ge(e.$$.fragment, n), t = !0); }, o(n) { - Ge(e.$$.fragment, n), t = !1; + Je(e.$$.fragment, n), t = !1; }, d(n) { - zt(e, n); + Bt(e, n); } }; } function h1(l, e, t) { - let { elem_id: n = "" } = e, { elem_classes: i = [] } = e, { visible: o = !0 } = e, { value: a = null } = e, { label: r } = e, { show_label: s } = e, { root: f } = e, { height: u } = e, { width: c } = e, { _selectable: d = !1 } = e, { container: _ = !0 } = e, { scale: h = null } = e, { min_width: m = void 0 } = e, { loading_status: b } = e, { sources: g = ["upload", "clipboard"] } = e, { show_download_button: w } = e, { show_share_button: p } = e, { show_clear_button: C } = e, { interactive: E } = e, { boxes_alpha: v } = e, { label_list: z } = e, { label_colors: k } = e, { box_min_size: q } = e, { handle_size: F } = e, { box_thickness: j } = e, { box_selected_thickness: D } = e, { gradio: N } = e, K, $ = null; - function X(M) { - $ = M, t(28, $); + let { elem_id: n = "" } = e, { elem_classes: i = [] } = e, { visible: o = !0 } = e, { value: a = null } = e, { label: r } = e, { show_label: s } = e, { root: f } = e, { height: u } = e, { width: c } = e, { _selectable: _ = !1 } = e, { container: d = !0 } = e, { scale: h = null } = e, { min_width: b = void 0 } = e, { loading_status: m } = e, { sources: w = ["upload", "clipboard"] } = e, { show_download_button: k } = e, { show_share_button: g } = e, { show_clear_button: S } = e, { interactive: M } = e, { boxes_alpha: y } = e, { label_list: z } = e, { label_colors: v } = e, { box_min_size: q } = e, { handle_size: R } = e, { box_thickness: I } = e, { box_selected_thickness: B } = e, { disable_edit_boxes: W } = e, { gradio: H } = e, le, X = null; + function ee(p) { + X = p, t(29, X); } - function se(M) { - a = M, t(0, a); + function ae(p) { + a = p, t(0, a); } - const we = () => N.dispatch("change"), re = () => N.dispatch("edit"), T = () => { - N.dispatch("clear"); - }, ae = ({ detail: M }) => t(27, K = M), fe = () => N.dispatch("upload"), Ye = ({ detail: M }) => N.dispatch("select", M), We = ({ detail: M }) => N.dispatch("share", M), L = ({ detail: M }) => { - t(1, b = b || {}), t(1, b.status = "error", b), N.dispatch("error", M); + const ye = () => H.dispatch("change"), L = () => H.dispatch("edit"), de = () => { + H.dispatch("clear"); + }, Ae = ({ detail: p }) => t(28, le = p), Le = () => H.dispatch("upload"), Ce = ({ detail: p }) => H.dispatch("select", p), A = ({ detail: p }) => H.dispatch("share", p), Ve = ({ detail: p }) => { + t(1, m = m || {}), t(1, m.status = "error", m), H.dispatch("error", p); }; - return l.$$set = (M) => { - "elem_id" in M && t(2, n = M.elem_id), "elem_classes" in M && t(3, i = M.elem_classes), "visible" in M && t(4, o = M.visible), "value" in M && t(0, a = M.value), "label" in M && t(5, r = M.label), "show_label" in M && t(6, s = M.show_label), "root" in M && t(7, f = M.root), "height" in M && t(8, u = M.height), "width" in M && t(9, c = M.width), "_selectable" in M && t(10, d = M._selectable), "container" in M && t(11, _ = M.container), "scale" in M && t(12, h = M.scale), "min_width" in M && t(13, m = M.min_width), "loading_status" in M && t(1, b = M.loading_status), "sources" in M && t(14, g = M.sources), "show_download_button" in M && t(15, w = M.show_download_button), "show_share_button" in M && t(16, p = M.show_share_button), "show_clear_button" in M && t(17, C = M.show_clear_button), "interactive" in M && t(18, E = M.interactive), "boxes_alpha" in M && t(19, v = M.boxes_alpha), "label_list" in M && t(20, z = M.label_list), "label_colors" in M && t(21, k = M.label_colors), "box_min_size" in M && t(22, q = M.box_min_size), "handle_size" in M && t(23, F = M.handle_size), "box_thickness" in M && t(24, j = M.box_thickness), "box_selected_thickness" in M && t(25, D = M.box_selected_thickness), "gradio" in M && t(26, N = M.gradio); + return l.$$set = (p) => { + "elem_id" in p && t(2, n = p.elem_id), "elem_classes" in p && t(3, i = p.elem_classes), "visible" in p && t(4, o = p.visible), "value" in p && t(0, a = p.value), "label" in p && t(5, r = p.label), "show_label" in p && t(6, s = p.show_label), "root" in p && t(7, f = p.root), "height" in p && t(8, u = p.height), "width" in p && t(9, c = p.width), "_selectable" in p && t(10, _ = p._selectable), "container" in p && t(11, d = p.container), "scale" in p && t(12, h = p.scale), "min_width" in p && t(13, b = p.min_width), "loading_status" in p && t(1, m = p.loading_status), "sources" in p && t(14, w = p.sources), "show_download_button" in p && t(15, k = p.show_download_button), "show_share_button" in p && t(16, g = p.show_share_button), "show_clear_button" in p && t(17, S = p.show_clear_button), "interactive" in p && t(18, M = p.interactive), "boxes_alpha" in p && t(19, y = p.boxes_alpha), "label_list" in p && t(20, z = p.label_list), "label_colors" in p && t(21, v = p.label_colors), "box_min_size" in p && t(22, q = p.box_min_size), "handle_size" in p && t(23, R = p.handle_size), "box_thickness" in p && t(24, I = p.box_thickness), "box_selected_thickness" in p && t(25, B = p.box_selected_thickness), "disable_edit_boxes" in p && t(26, W = p.disable_edit_boxes), "gradio" in p && t(27, H = p.gradio); }, [ a, - b, + m, n, i, o, @@ -8789,35 +8842,36 @@ function h1(l, e, t) { f, u, c, - d, _, + d, h, - m, - g, + b, w, - p, - C, - E, - v, - z, k, + g, + S, + M, + y, + z, + v, q, - F, - j, - D, - N, - K, - $, + R, + I, + B, + W, + H, + le, X, - se, - we, - re, - T, + ee, ae, - fe, - Ye, - We, - L + ye, + L, + de, + Ae, + Le, + Ce, + A, + Ve ]; } class k1 extends Q0 { @@ -8855,7 +8909,8 @@ class k1 extends Q0 { handle_size: 23, box_thickness: 24, box_selected_thickness: 25, - gradio: 26 + disable_edit_boxes: 26, + gradio: 27 }, null, [-1, -1] @@ -8865,163 +8920,169 @@ class k1 extends Q0 { return this.$$.ctx[2]; } set elem_id(e) { - this.$$set({ elem_id: e }), Y(); + this.$$set({ elem_id: e }), N(); } get elem_classes() { return this.$$.ctx[3]; } set elem_classes(e) { - this.$$set({ elem_classes: e }), Y(); + this.$$set({ elem_classes: e }), N(); } get visible() { return this.$$.ctx[4]; } set visible(e) { - this.$$set({ visible: e }), Y(); + this.$$set({ visible: e }), N(); } get value() { return this.$$.ctx[0]; } set value(e) { - this.$$set({ value: e }), Y(); + this.$$set({ value: e }), N(); } get label() { return this.$$.ctx[5]; } set label(e) { - this.$$set({ label: e }), Y(); + this.$$set({ label: e }), N(); } get show_label() { return this.$$.ctx[6]; } set show_label(e) { - this.$$set({ show_label: e }), Y(); + this.$$set({ show_label: e }), N(); } get root() { return this.$$.ctx[7]; } set root(e) { - this.$$set({ root: e }), Y(); + this.$$set({ root: e }), N(); } get height() { return this.$$.ctx[8]; } set height(e) { - this.$$set({ height: e }), Y(); + this.$$set({ height: e }), N(); } get width() { return this.$$.ctx[9]; } set width(e) { - this.$$set({ width: e }), Y(); + this.$$set({ width: e }), N(); } get _selectable() { return this.$$.ctx[10]; } set _selectable(e) { - this.$$set({ _selectable: e }), Y(); + this.$$set({ _selectable: e }), N(); } get container() { return this.$$.ctx[11]; } set container(e) { - this.$$set({ container: e }), Y(); + this.$$set({ container: e }), N(); } get scale() { return this.$$.ctx[12]; } set scale(e) { - this.$$set({ scale: e }), Y(); + this.$$set({ scale: e }), N(); } get min_width() { return this.$$.ctx[13]; } set min_width(e) { - this.$$set({ min_width: e }), Y(); + this.$$set({ min_width: e }), N(); } get loading_status() { return this.$$.ctx[1]; } set loading_status(e) { - this.$$set({ loading_status: e }), Y(); + this.$$set({ loading_status: e }), N(); } get sources() { return this.$$.ctx[14]; } set sources(e) { - this.$$set({ sources: e }), Y(); + this.$$set({ sources: e }), N(); } get show_download_button() { return this.$$.ctx[15]; } set show_download_button(e) { - this.$$set({ show_download_button: e }), Y(); + this.$$set({ show_download_button: e }), N(); } get show_share_button() { return this.$$.ctx[16]; } set show_share_button(e) { - this.$$set({ show_share_button: e }), Y(); + this.$$set({ show_share_button: e }), N(); } get show_clear_button() { return this.$$.ctx[17]; } set show_clear_button(e) { - this.$$set({ show_clear_button: e }), Y(); + this.$$set({ show_clear_button: e }), N(); } get interactive() { return this.$$.ctx[18]; } set interactive(e) { - this.$$set({ interactive: e }), Y(); + this.$$set({ interactive: e }), N(); } get boxes_alpha() { return this.$$.ctx[19]; } set boxes_alpha(e) { - this.$$set({ boxes_alpha: e }), Y(); + this.$$set({ boxes_alpha: e }), N(); } get label_list() { return this.$$.ctx[20]; } set label_list(e) { - this.$$set({ label_list: e }), Y(); + this.$$set({ label_list: e }), N(); } get label_colors() { return this.$$.ctx[21]; } set label_colors(e) { - this.$$set({ label_colors: e }), Y(); + this.$$set({ label_colors: e }), N(); } get box_min_size() { return this.$$.ctx[22]; } set box_min_size(e) { - this.$$set({ box_min_size: e }), Y(); + this.$$set({ box_min_size: e }), N(); } get handle_size() { return this.$$.ctx[23]; } set handle_size(e) { - this.$$set({ handle_size: e }), Y(); + this.$$set({ handle_size: e }), N(); } get box_thickness() { return this.$$.ctx[24]; } set box_thickness(e) { - this.$$set({ box_thickness: e }), Y(); + this.$$set({ box_thickness: e }), N(); } get box_selected_thickness() { return this.$$.ctx[25]; } set box_selected_thickness(e) { - this.$$set({ box_selected_thickness: e }), Y(); + this.$$set({ box_selected_thickness: e }), N(); } - get gradio() { + get disable_edit_boxes() { return this.$$.ctx[26]; } + set disable_edit_boxes(e) { + this.$$set({ disable_edit_boxes: e }), N(); + } + get gradio() { + return this.$$.ctx[27]; + } set gradio(e) { - this.$$set({ gradio: e }), Y(); + this.$$set({ gradio: e }), N(); } } export { diff --git a/backend/gradio_image_annotation/templates/example/index.js b/backend/gradio_image_annotation/templates/example/index.js index 9ef7dfc..f114e6e 100644 --- a/backend/gradio_image_annotation/templates/example/index.js +++ b/backend/gradio_image_annotation/templates/example/index.js @@ -1,27 +1,27 @@ -const { setContext: io, getContext: At } = window.__gradio__svelte__internal, Dt = "WORKER_PROXY_CONTEXT_KEY"; -function Ht() { - return At(Dt); +const { setContext: io, getContext: At } = window.__gradio__svelte__internal, Bt = "WORKER_PROXY_CONTEXT_KEY"; +function Dt() { + return At(Bt); } -function Tt(t) { +function Ht(t) { return t.host === window.location.host || t.host === "localhost:7860" || t.host === "127.0.0.1:7860" || // Ref: https://github.com/gradio-app/gradio/blob/v3.32.0/js/app/src/Index.svelte#L194 t.host === "lite.local"; } -function qt(t, e) { +function Tt(t, e) { const n = e.toLowerCase(); for (const [i, l] of Object.entries(t)) if (i.toLowerCase() === n) return l; } -function Lt(t) { +function qt(t) { if (t == null) return !1; const e = new URL(t, window.location.href); - return !(!Tt(e) || e.protocol !== "http:" && e.protocol !== "https:"); + return !(!Ht(e) || e.protocol !== "http:" && e.protocol !== "https:"); } -async function Rt(t) { - if (t == null || !Lt(t)) +async function Lt(t) { + if (t == null || !qt(t)) return t; - const e = Ht(); + const e = Dt(); if (e == null) return t; const i = new URL(t, window.location.href).pathname; @@ -33,69 +33,69 @@ async function Rt(t) { }).then((l) => { if (l.status !== 200) throw new Error(`Failed to get file ${i} from the Wasm worker.`); - const o = new Blob([l.body], { - type: qt(l.headers, "content-type") + const a = new Blob([l.body], { + type: Tt(l.headers, "content-type") }); - return URL.createObjectURL(o); + return URL.createObjectURL(a); }); } const { - SvelteComponent: Xt, - append: $e, - attr: j, - detach: Yt, - init: Bt, + SvelteComponent: Rt, + append: tn, + attr: U, + detach: Xt, + init: Yt, insert: Ot, - noop: en, + noop: ln, safe_not_equal: It, - set_style: F, - svg_element: qe + set_style: P, + svg_element: He } = window.__gradio__svelte__internal; function jt(t) { let e, n, i, l; return { c() { - e = qe("svg"), n = qe("g"), i = qe("path"), l = qe("path"), j(i, "d", "M18,6L6.087,17.913"), F(i, "fill", "none"), F(i, "fill-rule", "nonzero"), F(i, "stroke-width", "2px"), j(n, "transform", "matrix(1.14096,-0.140958,-0.140958,1.14096,-0.0559523,0.0559523)"), j(l, "d", "M4.364,4.364L19.636,19.636"), F(l, "fill", "none"), F(l, "fill-rule", "nonzero"), F(l, "stroke-width", "2px"), j(e, "width", "100%"), j(e, "height", "100%"), j(e, "viewBox", "0 0 24 24"), j(e, "version", "1.1"), j(e, "xmlns", "http://www.w3.org/2000/svg"), j(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), j(e, "xml:space", "preserve"), j(e, "stroke", "currentColor"), F(e, "fill-rule", "evenodd"), F(e, "clip-rule", "evenodd"), F(e, "stroke-linecap", "round"), F(e, "stroke-linejoin", "round"); + e = He("svg"), n = He("g"), i = He("path"), l = He("path"), U(i, "d", "M18,6L6.087,17.913"), P(i, "fill", "none"), P(i, "fill-rule", "nonzero"), P(i, "stroke-width", "2px"), U(n, "transform", "matrix(1.14096,-0.140958,-0.140958,1.14096,-0.0559523,0.0559523)"), U(l, "d", "M4.364,4.364L19.636,19.636"), P(l, "fill", "none"), P(l, "fill-rule", "nonzero"), P(l, "stroke-width", "2px"), U(e, "width", "100%"), U(e, "height", "100%"), U(e, "viewBox", "0 0 24 24"), U(e, "version", "1.1"), U(e, "xmlns", "http://www.w3.org/2000/svg"), U(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), U(e, "xml:space", "preserve"), U(e, "stroke", "currentColor"), P(e, "fill-rule", "evenodd"), P(e, "clip-rule", "evenodd"), P(e, "stroke-linecap", "round"), P(e, "stroke-linejoin", "round"); }, - m(o, r) { - Ot(o, e, r), $e(e, n), $e(n, i), $e(e, l); + m(a, r) { + Ot(a, e, r), tn(e, n), tn(n, i), tn(e, l); }, - p: en, - i: en, - o: en, - d(o) { - o && Yt(e); + p: ln, + i: ln, + o: ln, + d(a) { + a && Xt(e); } }; } -class Ut extends Xt { +class Ut extends Rt { constructor(e) { - super(), Bt(this, e, null, jt, It, {}); + super(), Yt(this, e, null, jt, It, {}); } } const { SvelteComponent: Wt, append: Nt, - attr: le, + attr: oe, detach: Ft, init: Pt, insert: Kt, - noop: nn, + noop: sn, safe_not_equal: Vt, - svg_element: xn + svg_element: Mn } = window.__gradio__svelte__internal; function Gt(t) { let e, n; return { c() { - e = xn("svg"), n = xn("path"), le(n, "d", "M5 8l4 4 4-4z"), le(e, "class", "dropdown-arrow svelte-145leq6"), le(e, "xmlns", "http://www.w3.org/2000/svg"), le(e, "width", "100%"), le(e, "height", "100%"), le(e, "viewBox", "0 0 18 18"); + e = Mn("svg"), n = Mn("path"), oe(n, "d", "M5 8l4 4 4-4z"), oe(e, "class", "dropdown-arrow svelte-145leq6"), oe(e, "xmlns", "http://www.w3.org/2000/svg"), oe(e, "width", "100%"), oe(e, "height", "100%"), oe(e, "viewBox", "0 0 18 18"); }, m(i, l) { Kt(i, e, l), Nt(e, n); }, - p: nn, - i: nn, - o: nn, + p: sn, + i: sn, + o: sn, d(i) { i && Ft(e); } @@ -109,26 +109,26 @@ class Jt extends Wt { const { SvelteComponent: Qt, append: Zt, - attr: U, + attr: W, detach: $t, init: ei, insert: ni, - noop: tn, + noop: on, safe_not_equal: ti, - svg_element: Mn + svg_element: An } = window.__gradio__svelte__internal; function ii(t) { let e, n; return { c() { - e = Mn("svg"), n = Mn("path"), U(n, "d", "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"), U(e, "xmlns", "http://www.w3.org/2000/svg"), U(e, "width", "100%"), U(e, "height", "100%"), U(e, "viewBox", "0 0 24 24"), U(e, "fill", "none"), U(e, "stroke", "currentColor"), U(e, "stroke-width", "1.5"), U(e, "stroke-linecap", "round"), U(e, "stroke-linejoin", "round"), U(e, "class", "feather feather-edit-2"); + e = An("svg"), n = An("path"), W(n, "d", "M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"), W(e, "xmlns", "http://www.w3.org/2000/svg"), W(e, "width", "100%"), W(e, "height", "100%"), W(e, "viewBox", "0 0 24 24"), W(e, "fill", "none"), W(e, "stroke", "currentColor"), W(e, "stroke-width", "1.5"), W(e, "stroke-linecap", "round"), W(e, "stroke-linejoin", "round"), W(e, "class", "feather feather-edit-2"); }, m(i, l) { ni(i, e, l), Zt(e, n); }, - p: tn, - i: tn, - o: tn, + p: on, + i: on, + o: on, d(i) { i && $t(e); } @@ -141,28 +141,28 @@ class li extends Qt { } const { SvelteComponent: si, - append: En, + append: Bn, attr: T, detach: oi, init: ai, insert: ri, - noop: ln, + noop: an, safe_not_equal: fi, - set_style: G, - svg_element: sn + set_style: Q, + svg_element: rn } = window.__gradio__svelte__internal; function ci(t) { let e, n, i; return { c() { - e = sn("svg"), n = sn("line"), i = sn("line"), T(n, "x1", "4"), T(n, "y1", "12"), T(n, "x2", "20"), T(n, "y2", "12"), G(n, "fill", "none"), G(n, "stroke-width", "2px"), T(i, "x1", "12"), T(i, "y1", "4"), T(i, "x2", "12"), T(i, "y2", "20"), G(i, "fill", "none"), G(i, "stroke-width", "2px"), T(e, "width", "100%"), T(e, "height", "100%"), T(e, "viewBox", "0 0 24 24"), T(e, "version", "1.1"), T(e, "xmlns", "http://www.w3.org/2000/svg"), T(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), T(e, "xml:space", "preserve"), T(e, "stroke", "currentColor"), G(e, "fill-rule", "evenodd"), G(e, "clip-rule", "evenodd"), G(e, "stroke-linecap", "round"), G(e, "stroke-linejoin", "round"); + e = rn("svg"), n = rn("line"), i = rn("line"), T(n, "x1", "4"), T(n, "y1", "12"), T(n, "x2", "20"), T(n, "y2", "12"), Q(n, "fill", "none"), Q(n, "stroke-width", "2px"), T(i, "x1", "12"), T(i, "y1", "4"), T(i, "x2", "12"), T(i, "y2", "20"), Q(i, "fill", "none"), Q(i, "stroke-width", "2px"), T(e, "width", "100%"), T(e, "height", "100%"), T(e, "viewBox", "0 0 24 24"), T(e, "version", "1.1"), T(e, "xmlns", "http://www.w3.org/2000/svg"), T(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), T(e, "xml:space", "preserve"), T(e, "stroke", "currentColor"), Q(e, "fill-rule", "evenodd"), Q(e, "clip-rule", "evenodd"), Q(e, "stroke-linecap", "round"), Q(e, "stroke-linejoin", "round"); }, - m(l, o) { - ri(l, e, o), En(e, n), En(e, i); + m(l, a) { + ri(l, e, a), Bn(e, n), Bn(e, i); }, - p: ln, - i: ln, - o: ln, + p: an, + i: an, + o: an, d(l) { l && oi(e); } @@ -181,8 +181,8 @@ const { element: bi, get_all_dirty_from_scope: gi, get_slot_changes: wi, - init: pi, - insert: ki, + init: ki, + insert: pi, safe_not_equal: vi, transition_in: yi, transition_out: Ci, @@ -204,104 +204,104 @@ function zi(t) { c() { e = bi("div"), l && l.c(), _i(e, "class", "svelte-1hnfib2"); }, - m(o, r) { - ki(o, e, r), l && l.m(e, null), n = !0; + m(a, r) { + pi(a, e, r), l && l.m(e, null), n = !0; }, - p(o, [r]) { + p(a, [r]) { l && l.p && (!n || r & /*$$scope*/ 1) && Si( l, i, - o, + a, /*$$scope*/ - o[0], + a[0], n ? wi( i, /*$$scope*/ - o[0], + a[0], r, null ) : gi( /*$$scope*/ - o[0] + a[0] ), null ); }, - i(o) { - n || (yi(l, o), n = !0); + i(a) { + n || (yi(l, a), n = !0); }, - o(o) { - Ci(l, o), n = !1; + o(a) { + Ci(l, a), n = !1; }, - d(o) { - o && mi(e), l && l.d(o); + d(a) { + a && mi(e), l && l.d(a); } }; } function xi(t, e, n) { let { $$slots: i = {}, $$scope: l } = e; - return t.$$set = (o) => { - "$$scope" in o && n(0, l = o.$$scope); + return t.$$set = (a) => { + "$$scope" in a && n(0, l = a.$$scope); }, [l, i]; } -class Mi extends hi { +class Ei extends hi { constructor(e) { - super(), pi(this, e, xi, zi, vi, {}); + super(), ki(this, e, xi, zi, vi, {}); } } const { - SvelteComponent: Ei, - attr: An, + SvelteComponent: Mi, + attr: Dn, check_outros: Ai, - create_component: Di, - create_slot: Hi, - destroy_component: Ti, - detach: Ue, - element: qi, - empty: Li, - get_all_dirty_from_scope: Ri, - get_slot_changes: Xi, - group_outros: Yi, - init: Bi, - insert: We, + create_component: Bi, + create_slot: Di, + destroy_component: Hi, + detach: je, + element: Ti, + empty: qi, + get_all_dirty_from_scope: Li, + get_slot_changes: Ri, + group_outros: Xi, + init: Yi, + insert: Ue, mount_component: Oi, safe_not_equal: Ii, set_data: ji, space: Ui, text: Wi, - toggle_class: se, - transition_in: pe, - transition_out: Ne, + toggle_class: ae, + transition_in: be, + transition_out: We, update_slot_base: Ni } = window.__gradio__svelte__internal; -function Dn(t) { +function Hn(t) { let e, n; - return e = new Mi({ + return e = new Ei({ props: { $$slots: { default: [Fi] }, $$scope: { ctx: t } } }), { c() { - Di(e.$$.fragment); + Bi(e.$$.fragment); }, m(i, l) { Oi(e, i, l), n = !0; }, p(i, l) { - const o = {}; + const a = {}; l & /*$$scope, info*/ - 10 && (o.$$scope = { dirty: l, ctx: i }), e.$set(o); + 10 && (a.$$scope = { dirty: l, ctx: i }), e.$set(a); }, i(i) { - n || (pe(e.$$.fragment, i), n = !0); + n || (be(e.$$.fragment, i), n = !0); }, o(i) { - Ne(e.$$.fragment, i), n = !1; + We(e.$$.fragment, i), n = !1; }, d(i) { - Ti(e, i); + Hi(e, i); } }; } @@ -315,7 +315,7 @@ function Fi(t) { ); }, m(n, i) { - We(n, e, i); + Ue(n, e, i); }, p(n, i) { i & /*info*/ @@ -326,31 +326,31 @@ function Fi(t) { ); }, d(n) { - n && Ue(e); + n && je(e); } }; } function Pi(t) { let e, n, i, l; - const o = ( + const a = ( /*#slots*/ t[2].default - ), r = Hi( - o, + ), r = Di( + a, t, /*$$scope*/ t[3], null ); - let a = ( + let o = ( /*info*/ - t[1] && Dn(t) + t[1] && Hn(t) ); return { c() { - e = qi("span"), r && r.c(), n = Ui(), a && a.c(), i = Li(), An(e, "data-testid", "block-info"), An(e, "class", "svelte-22c38v"), se(e, "sr-only", !/*show_label*/ - t[0]), se(e, "hide", !/*show_label*/ - t[0]), se( + e = Ti("span"), r && r.c(), n = Ui(), o && o.c(), i = qi(), Dn(e, "data-testid", "block-info"), Dn(e, "class", "svelte-22c38v"), ae(e, "sr-only", !/*show_label*/ + t[0]), ae(e, "hide", !/*show_label*/ + t[0]), ae( e, "has-info", /*info*/ @@ -358,63 +358,63 @@ function Pi(t) { ); }, m(s, c) { - We(s, e, c), r && r.m(e, null), We(s, n, c), a && a.m(s, c), We(s, i, c), l = !0; + Ue(s, e, c), r && r.m(e, null), Ue(s, n, c), o && o.m(s, c), Ue(s, i, c), l = !0; }, p(s, [c]) { r && r.p && (!l || c & /*$$scope*/ 8) && Ni( r, - o, + a, s, /*$$scope*/ s[3], - l ? Xi( - o, + l ? Ri( + a, /*$$scope*/ s[3], c, null - ) : Ri( + ) : Li( /*$$scope*/ s[3] ), null ), (!l || c & /*show_label*/ - 1) && se(e, "sr-only", !/*show_label*/ + 1) && ae(e, "sr-only", !/*show_label*/ s[0]), (!l || c & /*show_label*/ - 1) && se(e, "hide", !/*show_label*/ + 1) && ae(e, "hide", !/*show_label*/ s[0]), (!l || c & /*info*/ - 2) && se( + 2) && ae( e, "has-info", /*info*/ s[1] != null ), /*info*/ - s[1] ? a ? (a.p(s, c), c & /*info*/ - 2 && pe(a, 1)) : (a = Dn(s), a.c(), pe(a, 1), a.m(i.parentNode, i)) : a && (Yi(), Ne(a, 1, 1, () => { - a = null; + s[1] ? o ? (o.p(s, c), c & /*info*/ + 2 && be(o, 1)) : (o = Hn(s), o.c(), be(o, 1), o.m(i.parentNode, i)) : o && (Xi(), We(o, 1, 1, () => { + o = null; }), Ai()); }, i(s) { - l || (pe(r, s), pe(a), l = !0); + l || (be(r, s), be(o), l = !0); }, o(s) { - Ne(r, s), Ne(a), l = !1; + We(r, s), We(o), l = !1; }, d(s) { - s && (Ue(e), Ue(n), Ue(i)), r && r.d(s), a && a.d(s); + s && (je(e), je(n), je(i)), r && r.d(s), o && o.d(s); } }; } function Ki(t, e, n) { - let { $$slots: i = {}, $$scope: l } = e, { show_label: o = !0 } = e, { info: r = void 0 } = e; - return t.$$set = (a) => { - "show_label" in a && n(0, o = a.show_label), "info" in a && n(1, r = a.info), "$$scope" in a && n(3, l = a.$$scope); - }, [o, r, i, l]; + let { $$slots: i = {}, $$scope: l } = e, { show_label: a = !0 } = e, { info: r = void 0 } = e; + return t.$$set = (o) => { + "show_label" in o && n(0, a = o.show_label), "info" in o && n(1, r = o.info), "$$scope" in o && n(3, l = o.$$scope); + }, [a, r, i, l]; } -class it extends Ei { +class ot extends Mi { constructor(e) { - super(), Bi(this, e, Ki, Pi, Ii, { show_label: 0, info: 1 }); + super(), Yi(this, e, Ki, Pi, Ii, { show_label: 0, info: 1 }); } } const Vi = [ @@ -428,7 +428,7 @@ const Vi = [ { color: "cyan", primary: 600, secondary: 100 }, { color: "lime", primary: 500, secondary: 100 }, { color: "pink", primary: 600, secondary: 100 } -], Hn = { +], Tn = { inherit: "inherit", current: "currentColor", transparent: "transparent", @@ -725,29 +725,29 @@ Vi.reduce( (t, { color: e, primary: n, secondary: i }) => ({ ...t, [e]: { - primary: Hn[e][n], - secondary: Hn[e][i] + primary: Tn[e][n], + secondary: Tn[e][i] } }), {} ); const { SvelteComponent: Gi, - append: Tn, - attr: on, - bubble: qn, + append: qn, + attr: fn, + bubble: Ln, create_component: Ji, destroy_component: Qi, - detach: lt, - element: Ln, + detach: at, + element: Rn, init: Zi, - insert: st, - listen: an, + insert: rt, + listen: cn, mount_component: $i, run_all: el, safe_not_equal: nl, set_data: tl, - set_input_value: Rn, + set_input_value: Xn, space: il, text: ll, transition_in: sl, @@ -763,7 +763,7 @@ function fl(t) { ); }, m(n, i) { - st(n, e, i); + rt(n, e, i); }, p(n, i) { i & /*label*/ @@ -774,13 +774,13 @@ function fl(t) { ); }, d(n) { - n && lt(e); + n && at(e); } }; } function cl(t) { - let e, n, i, l, o, r, a; - return n = new it({ + let e, n, i, l, a, r, o; + return n = new ot({ props: { show_label: ( /*show_label*/ @@ -795,28 +795,28 @@ function cl(t) { } }), { c() { - e = Ln("label"), Ji(n.$$.fragment), i = il(), l = Ln("input"), on(l, "type", "color"), l.disabled = /*disabled*/ - t[3], on(l, "class", "svelte-16l8u73"), on(e, "class", "block"); + e = Rn("label"), Ji(n.$$.fragment), i = il(), l = Rn("input"), fn(l, "type", "color"), l.disabled = /*disabled*/ + t[3], fn(l, "class", "svelte-16l8u73"), fn(e, "class", "block"); }, m(s, c) { - st(s, e, c), $i(n, e, null), Tn(e, i), Tn(e, l), Rn( + rt(s, e, c), $i(n, e, null), qn(e, i), qn(e, l), Xn( l, /*value*/ t[0] - ), o = !0, r || (a = [ - an( + ), a = !0, r || (o = [ + cn( l, "input", /*input_input_handler*/ t[8] ), - an( + cn( l, "focus", /*focus_handler*/ t[6] ), - an( + cn( l, "blur", /*blur_handler*/ @@ -831,28 +831,28 @@ function cl(t) { s[4]), c & /*info*/ 4 && (f.info = /*info*/ s[2]), c & /*$$scope, label*/ - 2050 && (f.$$scope = { dirty: c, ctx: s }), n.$set(f), (!o || c & /*disabled*/ + 2050 && (f.$$scope = { dirty: c, ctx: s }), n.$set(f), (!a || c & /*disabled*/ 8) && (l.disabled = /*disabled*/ s[3]), c & /*value*/ - 1 && Rn( + 1 && Xn( l, /*value*/ s[0] ); }, i(s) { - o || (sl(n.$$.fragment, s), o = !0); + a || (sl(n.$$.fragment, s), a = !0); }, o(s) { - ol(n.$$.fragment, s), o = !1; + ol(n.$$.fragment, s), a = !1; }, d(s) { - s && lt(e), Qi(n), r = !1, el(a); + s && at(e), Qi(n), r = !1, el(o); } }; } function ul(t, e, n) { - let { value: i = "#000000" } = e, { value_is_output: l = !1 } = e, { label: o } = e, { info: r = void 0 } = e, { disabled: a = !1 } = e, { show_label: s = !0 } = e; + let { value: i = "#000000" } = e, { value_is_output: l = !1 } = e, { label: a } = e, { info: r = void 0 } = e, { disabled: o = !1 } = e, { show_label: s = !0 } = e; const c = al(); function f() { c("change", i), l || c("input"); @@ -860,30 +860,30 @@ function ul(t, e, n) { rl(() => { n(5, l = !1); }); - function _(m) { - qn.call(this, t, m); + function u(d) { + Ln.call(this, t, d); } - function g(m) { - qn.call(this, t, m); + function b(d) { + Ln.call(this, t, d); } - function h() { + function g() { i = this.value, n(0, i); } - return t.$$set = (m) => { - "value" in m && n(0, i = m.value), "value_is_output" in m && n(5, l = m.value_is_output), "label" in m && n(1, o = m.label), "info" in m && n(2, r = m.info), "disabled" in m && n(3, a = m.disabled), "show_label" in m && n(4, s = m.show_label); + return t.$$set = (d) => { + "value" in d && n(0, i = d.value), "value_is_output" in d && n(5, l = d.value_is_output), "label" in d && n(1, a = d.label), "info" in d && n(2, r = d.info), "disabled" in d && n(3, o = d.disabled), "show_label" in d && n(4, s = d.show_label); }, t.$$.update = () => { t.$$.dirty & /*value*/ 1 && f(); }, [ i, - o, - r, a, + r, + o, s, l, - _, - g, - h + u, + b, + g ]; } class hl extends Gi { @@ -898,7 +898,7 @@ class hl extends Gi { }); } } -function Xn(t) { +function Yn(t) { const e = typeof t == "string" && t.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/); return e ? [parseFloat(e[1]), e[2] || "px"] : [ /** @type {number} */ @@ -910,51 +910,51 @@ function _l(t) { const e = t - 1; return e * e * e + 1; } -function Yn(t, { delay: e = 0, duration: n = 400, easing: i = _l, x: l = 0, y: o = 0, opacity: r = 0 } = {}) { - const a = getComputedStyle(t), s = +a.opacity, c = a.transform === "none" ? "" : a.transform, f = s * (1 - r), [_, g] = Xn(l), [h, m] = Xn(o); +function On(t, { delay: e = 0, duration: n = 400, easing: i = _l, x: l = 0, y: a = 0, opacity: r = 0 } = {}) { + const o = getComputedStyle(t), s = +o.opacity, c = o.transform === "none" ? "" : o.transform, f = s * (1 - r), [u, b] = Yn(l), [g, d] = Yn(a); return { delay: e, duration: n, easing: i, - css: (b, d) => ` - transform: ${c} translate(${(1 - b) * _}${g}, ${(1 - b) * h}${m}); - opacity: ${s - f * d}` + css: (k, _) => ` + transform: ${c} translate(${(1 - k) * u}${b}, ${(1 - k) * g}${d}); + opacity: ${s - f * _}` }; } const { SvelteComponent: dl, - append: ot, + append: ft, attr: A, bubble: ml, check_outros: bl, - create_slot: at, - detach: Ee, - element: Je, + create_slot: ct, + detach: xe, + element: Qe, empty: gl, - get_all_dirty_from_scope: rt, - get_slot_changes: ft, + get_all_dirty_from_scope: ut, + get_slot_changes: ht, group_outros: wl, - init: pl, - insert: Ae, - listen: kl, + init: kl, + insert: Ee, + listen: pl, safe_not_equal: vl, - set_style: B, - space: ct, - src_url_equal: Pe, - toggle_class: _e, - transition_in: Ke, - transition_out: Ve, - update_slot_base: ut + set_style: L, + space: _t, + src_url_equal: Ke, + toggle_class: he, + transition_in: Ve, + transition_out: Ge, + update_slot_base: dt } = window.__gradio__svelte__internal; function yl(t) { - let e, n, i, l, o, r, a = ( + let e, n, i, l, a, r, o = ( /*icon*/ - t[7] && Bn(t) + t[7] && In(t) ); const s = ( /*#slots*/ t[12].default - ), c = at( + ), c = ct( s, t, /*$$scope*/ @@ -963,7 +963,7 @@ function yl(t) { ); return { c() { - e = Je("button"), a && a.c(), n = ct(), c && c.c(), A(e, "class", i = /*size*/ + e = Qe("button"), o && o.c(), n = _t(), c && c.c(), A(e, "class", i = /*size*/ t[4] + " " + /*variant*/ t[3] + " " + /*elem_classes*/ t[1].join(" ") + " svelte-8huxfn"), A( @@ -972,100 +972,100 @@ function yl(t) { /*elem_id*/ t[0] ), e.disabled = /*disabled*/ - t[8], _e(e, "hidden", !/*visible*/ - t[2]), B( + t[8], he(e, "hidden", !/*visible*/ + t[2]), L( e, "flex-grow", /*scale*/ t[9] - ), B( + ), L( e, "width", /*scale*/ t[9] === 0 ? "fit-content" : null - ), B(e, "min-width", typeof /*min_width*/ + ), L(e, "min-width", typeof /*min_width*/ t[10] == "number" ? `calc(min(${/*min_width*/ t[10]}px, 100%))` : null); }, - m(f, _) { - Ae(f, e, _), a && a.m(e, null), ot(e, n), c && c.m(e, null), l = !0, o || (r = kl( + m(f, u) { + Ee(f, e, u), o && o.m(e, null), ft(e, n), c && c.m(e, null), l = !0, a || (r = pl( e, "click", /*click_handler*/ t[13] - ), o = !0); + ), a = !0); }, - p(f, _) { + p(f, u) { /*icon*/ - f[7] ? a ? a.p(f, _) : (a = Bn(f), a.c(), a.m(e, n)) : a && (a.d(1), a = null), c && c.p && (!l || _ & /*$$scope*/ - 2048) && ut( + f[7] ? o ? o.p(f, u) : (o = In(f), o.c(), o.m(e, n)) : o && (o.d(1), o = null), c && c.p && (!l || u & /*$$scope*/ + 2048) && dt( c, s, f, /*$$scope*/ f[11], - l ? ft( + l ? ht( s, /*$$scope*/ f[11], - _, + u, null - ) : rt( + ) : ut( /*$$scope*/ f[11] ), null - ), (!l || _ & /*size, variant, elem_classes*/ + ), (!l || u & /*size, variant, elem_classes*/ 26 && i !== (i = /*size*/ f[4] + " " + /*variant*/ f[3] + " " + /*elem_classes*/ - f[1].join(" ") + " svelte-8huxfn")) && A(e, "class", i), (!l || _ & /*elem_id*/ + f[1].join(" ") + " svelte-8huxfn")) && A(e, "class", i), (!l || u & /*elem_id*/ 1) && A( e, "id", /*elem_id*/ f[0] - ), (!l || _ & /*disabled*/ + ), (!l || u & /*disabled*/ 256) && (e.disabled = /*disabled*/ - f[8]), (!l || _ & /*size, variant, elem_classes, visible*/ - 30) && _e(e, "hidden", !/*visible*/ - f[2]), _ & /*scale*/ - 512 && B( + f[8]), (!l || u & /*size, variant, elem_classes, visible*/ + 30) && he(e, "hidden", !/*visible*/ + f[2]), u & /*scale*/ + 512 && L( e, "flex-grow", /*scale*/ f[9] - ), _ & /*scale*/ - 512 && B( + ), u & /*scale*/ + 512 && L( e, "width", /*scale*/ f[9] === 0 ? "fit-content" : null - ), _ & /*min_width*/ - 1024 && B(e, "min-width", typeof /*min_width*/ + ), u & /*min_width*/ + 1024 && L(e, "min-width", typeof /*min_width*/ f[10] == "number" ? `calc(min(${/*min_width*/ f[10]}px, 100%))` : null); }, i(f) { - l || (Ke(c, f), l = !0); + l || (Ve(c, f), l = !0); }, o(f) { - Ve(c, f), l = !1; + Ge(c, f), l = !1; }, d(f) { - f && Ee(e), a && a.d(), c && c.d(f), o = !1, r(); + f && xe(e), o && o.d(), c && c.d(f), a = !1, r(); } }; } function Cl(t) { - let e, n, i, l, o = ( + let e, n, i, l, a = ( /*icon*/ - t[7] && On(t) + t[7] && jn(t) ); const r = ( /*#slots*/ t[12].default - ), a = at( + ), o = ct( r, t, /*$$scope*/ @@ -1074,7 +1074,7 @@ function Cl(t) { ); return { c() { - e = Je("a"), o && o.c(), n = ct(), a && a.c(), A( + e = Qe("a"), a && a.c(), n = _t(), o && o.c(), A( e, "href", /*link*/ @@ -1092,50 +1092,50 @@ function Cl(t) { "id", /*elem_id*/ t[0] - ), _e(e, "hidden", !/*visible*/ - t[2]), _e( + ), he(e, "hidden", !/*visible*/ + t[2]), he( e, "disabled", /*disabled*/ t[8] - ), B( + ), L( e, "flex-grow", /*scale*/ t[9] - ), B( + ), L( e, "pointer-events", /*disabled*/ t[8] ? "none" : null - ), B( + ), L( e, "width", /*scale*/ t[9] === 0 ? "fit-content" : null - ), B(e, "min-width", typeof /*min_width*/ + ), L(e, "min-width", typeof /*min_width*/ t[10] == "number" ? `calc(min(${/*min_width*/ t[10]}px, 100%))` : null); }, m(s, c) { - Ae(s, e, c), o && o.m(e, null), ot(e, n), a && a.m(e, null), l = !0; + Ee(s, e, c), a && a.m(e, null), ft(e, n), o && o.m(e, null), l = !0; }, p(s, c) { /*icon*/ - s[7] ? o ? o.p(s, c) : (o = On(s), o.c(), o.m(e, n)) : o && (o.d(1), o = null), a && a.p && (!l || c & /*$$scope*/ - 2048) && ut( - a, + s[7] ? a ? a.p(s, c) : (a = jn(s), a.c(), a.m(e, n)) : a && (a.d(1), a = null), o && o.p && (!l || c & /*$$scope*/ + 2048) && dt( + o, r, s, /*$$scope*/ s[11], - l ? ft( + l ? ht( r, /*$$scope*/ s[11], c, null - ) : rt( + ) : ut( /*$$scope*/ s[11] ), @@ -1163,154 +1163,154 @@ function Cl(t) { /*elem_id*/ s[0] ), (!l || c & /*size, variant, elem_classes, visible*/ - 30) && _e(e, "hidden", !/*visible*/ + 30) && he(e, "hidden", !/*visible*/ s[2]), (!l || c & /*size, variant, elem_classes, disabled*/ - 282) && _e( + 282) && he( e, "disabled", /*disabled*/ s[8] ), c & /*scale*/ - 512 && B( + 512 && L( e, "flex-grow", /*scale*/ s[9] ), c & /*disabled*/ - 256 && B( + 256 && L( e, "pointer-events", /*disabled*/ s[8] ? "none" : null ), c & /*scale*/ - 512 && B( + 512 && L( e, "width", /*scale*/ s[9] === 0 ? "fit-content" : null ), c & /*min_width*/ - 1024 && B(e, "min-width", typeof /*min_width*/ + 1024 && L(e, "min-width", typeof /*min_width*/ s[10] == "number" ? `calc(min(${/*min_width*/ s[10]}px, 100%))` : null); }, i(s) { - l || (Ke(a, s), l = !0); + l || (Ve(o, s), l = !0); }, o(s) { - Ve(a, s), l = !1; + Ge(o, s), l = !1; }, d(s) { - s && Ee(e), o && o.d(), a && a.d(s); + s && xe(e), a && a.d(), o && o.d(s); } }; } -function Bn(t) { +function In(t) { let e, n, i; return { c() { - e = Je("img"), A(e, "class", "button-icon svelte-8huxfn"), Pe(e.src, n = /*icon*/ + e = Qe("img"), A(e, "class", "button-icon svelte-8huxfn"), Ke(e.src, n = /*icon*/ t[7].url) || A(e, "src", n), A(e, "alt", i = `${/*value*/ t[5]} icon`); }, - m(l, o) { - Ae(l, e, o); + m(l, a) { + Ee(l, e, a); }, - p(l, o) { - o & /*icon*/ - 128 && !Pe(e.src, n = /*icon*/ - l[7].url) && A(e, "src", n), o & /*value*/ + p(l, a) { + a & /*icon*/ + 128 && !Ke(e.src, n = /*icon*/ + l[7].url) && A(e, "src", n), a & /*value*/ 32 && i !== (i = `${/*value*/ l[5]} icon`) && A(e, "alt", i); }, d(l) { - l && Ee(e); + l && xe(e); } }; } -function On(t) { +function jn(t) { let e, n, i; return { c() { - e = Je("img"), A(e, "class", "button-icon svelte-8huxfn"), Pe(e.src, n = /*icon*/ + e = Qe("img"), A(e, "class", "button-icon svelte-8huxfn"), Ke(e.src, n = /*icon*/ t[7].url) || A(e, "src", n), A(e, "alt", i = `${/*value*/ t[5]} icon`); }, - m(l, o) { - Ae(l, e, o); + m(l, a) { + Ee(l, e, a); }, - p(l, o) { - o & /*icon*/ - 128 && !Pe(e.src, n = /*icon*/ - l[7].url) && A(e, "src", n), o & /*value*/ + p(l, a) { + a & /*icon*/ + 128 && !Ke(e.src, n = /*icon*/ + l[7].url) && A(e, "src", n), a & /*value*/ 32 && i !== (i = `${/*value*/ l[5]} icon`) && A(e, "alt", i); }, d(l) { - l && Ee(e); + l && xe(e); } }; } function Sl(t) { let e, n, i, l; - const o = [Cl, yl], r = []; - function a(s, c) { + const a = [Cl, yl], r = []; + function o(s, c) { return ( /*link*/ s[6] && /*link*/ s[6].length > 0 ? 0 : 1 ); } - return e = a(t), n = r[e] = o[e](t), { + return e = o(t), n = r[e] = a[e](t), { c() { n.c(), i = gl(); }, m(s, c) { - r[e].m(s, c), Ae(s, i, c), l = !0; + r[e].m(s, c), Ee(s, i, c), l = !0; }, p(s, [c]) { let f = e; - e = a(s), e === f ? r[e].p(s, c) : (wl(), Ve(r[f], 1, 1, () => { + e = o(s), e === f ? r[e].p(s, c) : (wl(), Ge(r[f], 1, 1, () => { r[f] = null; - }), bl(), n = r[e], n ? n.p(s, c) : (n = r[e] = o[e](s), n.c()), Ke(n, 1), n.m(i.parentNode, i)); + }), bl(), n = r[e], n ? n.p(s, c) : (n = r[e] = a[e](s), n.c()), Ve(n, 1), n.m(i.parentNode, i)); }, i(s) { - l || (Ke(n), l = !0); + l || (Ve(n), l = !0); }, o(s) { - Ve(n), l = !1; + Ge(n), l = !1; }, d(s) { - s && Ee(i), r[e].d(s); + s && xe(i), r[e].d(s); } }; } function zl(t, e, n) { - let { $$slots: i = {}, $$scope: l } = e, { elem_id: o = "" } = e, { elem_classes: r = [] } = e, { visible: a = !0 } = e, { variant: s = "secondary" } = e, { size: c = "lg" } = e, { value: f = null } = e, { link: _ = null } = e, { icon: g = null } = e, { disabled: h = !1 } = e, { scale: m = null } = e, { min_width: b = void 0 } = e; - function d(u) { - ml.call(this, t, u); + let { $$slots: i = {}, $$scope: l } = e, { elem_id: a = "" } = e, { elem_classes: r = [] } = e, { visible: o = !0 } = e, { variant: s = "secondary" } = e, { size: c = "lg" } = e, { value: f = null } = e, { link: u = null } = e, { icon: b = null } = e, { disabled: g = !1 } = e, { scale: d = null } = e, { min_width: k = void 0 } = e; + function _(h) { + ml.call(this, t, h); } - return t.$$set = (u) => { - "elem_id" in u && n(0, o = u.elem_id), "elem_classes" in u && n(1, r = u.elem_classes), "visible" in u && n(2, a = u.visible), "variant" in u && n(3, s = u.variant), "size" in u && n(4, c = u.size), "value" in u && n(5, f = u.value), "link" in u && n(6, _ = u.link), "icon" in u && n(7, g = u.icon), "disabled" in u && n(8, h = u.disabled), "scale" in u && n(9, m = u.scale), "min_width" in u && n(10, b = u.min_width), "$$scope" in u && n(11, l = u.$$scope); + return t.$$set = (h) => { + "elem_id" in h && n(0, a = h.elem_id), "elem_classes" in h && n(1, r = h.elem_classes), "visible" in h && n(2, o = h.visible), "variant" in h && n(3, s = h.variant), "size" in h && n(4, c = h.size), "value" in h && n(5, f = h.value), "link" in h && n(6, u = h.link), "icon" in h && n(7, b = h.icon), "disabled" in h && n(8, g = h.disabled), "scale" in h && n(9, d = h.scale), "min_width" in h && n(10, k = h.min_width), "$$scope" in h && n(11, l = h.$$scope); }, [ - o, - r, a, + r, + o, s, c, f, - _, - g, - h, - m, + u, b, + g, + d, + k, l, i, - d + _ ]; } -class In extends dl { +class Un extends dl { constructor(e) { - super(), pl(this, e, zl, Sl, vl, { + super(), kl(this, e, zl, Sl, vl, { elem_id: 0, elem_classes: 1, visible: 2, @@ -1327,55 +1327,55 @@ class In extends dl { } const { SvelteComponent: xl, - add_render_callback: ht, - append: Le, - attr: I, - binding_callbacks: jn, - check_outros: Ml, - create_bidirectional_transition: Un, - destroy_each: El, - detach: ve, - element: Ge, + add_render_callback: mt, + append: Te, + attr: Y, + binding_callbacks: Wn, + check_outros: El, + create_bidirectional_transition: Nn, + destroy_each: Ml, + detach: ke, + element: Je, empty: Al, - ensure_array_like: Wn, - group_outros: Dl, - init: Hl, - insert: ye, - listen: mn, - prevent_default: Tl, - run_all: ql, - safe_not_equal: Ll, - set_data: Rl, - set_style: oe, - space: bn, - text: Xl, - toggle_class: P, - transition_in: rn, - transition_out: Nn -} = window.__gradio__svelte__internal, { createEventDispatcher: Yl } = window.__gradio__svelte__internal; -function Fn(t, e, n) { + ensure_array_like: Fn, + group_outros: Bl, + init: Dl, + insert: pe, + listen: bn, + prevent_default: Hl, + run_all: Tl, + safe_not_equal: ql, + set_data: Ll, + set_style: re, + space: gn, + text: Rl, + toggle_class: K, + transition_in: un, + transition_out: Pn +} = window.__gradio__svelte__internal, { createEventDispatcher: Xl } = window.__gradio__svelte__internal; +function Kn(t, e, n) { const i = t.slice(); return i[26] = e[n], i; } -function Pn(t) { - let e, n, i, l, o, r = Wn( +function Vn(t) { + let e, n, i, l, a, r = Fn( /*filtered_indices*/ t[1] - ), a = []; + ), o = []; for (let s = 0; s < r.length; s += 1) - a[s] = Kn(Fn(t, r, s)); + o[s] = Gn(Kn(t, r, s)); return { c() { - e = Ge("ul"); - for (let s = 0; s < a.length; s += 1) - a[s].c(); - I(e, "class", "options svelte-yuohum"), I(e, "role", "listbox"), oe( + e = Je("ul"); + for (let s = 0; s < o.length; s += 1) + o[s].c(); + Y(e, "class", "options svelte-yuohum"), Y(e, "role", "listbox"), re( e, "bottom", /*bottom*/ t[9] - ), oe(e, "max-height", `calc(${/*max_height*/ - t[10]}px - var(--window-padding))`), oe( + ), re(e, "max-height", `calc(${/*max_height*/ + t[10]}px - var(--window-padding))`), re( e, "width", /*input_width*/ @@ -1383,10 +1383,10 @@ function Pn(t) { ); }, m(s, c) { - ye(s, e, c); - for (let f = 0; f < a.length; f += 1) - a[f] && a[f].m(e, null); - t[22](e), i = !0, l || (o = mn(e, "mousedown", Tl( + pe(s, e, c); + for (let f = 0; f < o.length; f += 1) + o[f] && o[f].m(e, null); + t[22](e), i = !0, l || (a = bn(e, "mousedown", Hl( /*mousedown_handler*/ t[21] )), l = !0); @@ -1394,29 +1394,29 @@ function Pn(t) { p(s, c) { if (c & /*filtered_indices, choices, selected_indices, active_index*/ 51) { - r = Wn( + r = Fn( /*filtered_indices*/ s[1] ); let f; for (f = 0; f < r.length; f += 1) { - const _ = Fn(s, r, f); - a[f] ? a[f].p(_, c) : (a[f] = Kn(_), a[f].c(), a[f].m(e, null)); + const u = Kn(s, r, f); + o[f] ? o[f].p(u, c) : (o[f] = Gn(u), o[f].c(), o[f].m(e, null)); } - for (; f < a.length; f += 1) - a[f].d(1); - a.length = r.length; + for (; f < o.length; f += 1) + o[f].d(1); + o.length = r.length; } c & /*bottom*/ - 512 && oe( + 512 && re( e, "bottom", /*bottom*/ s[9] ), c & /*max_height*/ - 1024 && oe(e, "max-height", `calc(${/*max_height*/ + 1024 && re(e, "max-height", `calc(${/*max_height*/ s[10]}px - var(--window-padding))`), c & /*input_width*/ - 256 && oe( + 256 && re( e, "width", /*input_width*/ @@ -1424,42 +1424,42 @@ function Pn(t) { ); }, i(s) { - i || (s && ht(() => { - i && (n || (n = Un(e, Yn, { duration: 200, y: 5 }, !0)), n.run(1)); + i || (s && mt(() => { + i && (n || (n = Nn(e, On, { duration: 200, y: 5 }, !0)), n.run(1)); }), i = !0); }, o(s) { - s && (n || (n = Un(e, Yn, { duration: 200, y: 5 }, !1)), n.run(0)), i = !1; + s && (n || (n = Nn(e, On, { duration: 200, y: 5 }, !1)), n.run(0)), i = !1; }, d(s) { - s && ve(e), El(a, s), t[22](null), s && n && n.end(), l = !1, o(); + s && ke(e), Ml(o, s), t[22](null), s && n && n.end(), l = !1, a(); } }; } -function Kn(t) { +function Gn(t) { let e, n, i, l = ( /*choices*/ t[0][ /*index*/ t[26] ][0] + "" - ), o, r, a, s, c; + ), a, r, o, s, c; return { c() { - e = Ge("li"), n = Ge("span"), n.textContent = "✓", i = bn(), o = Xl(l), r = bn(), I(n, "class", "inner-item svelte-yuohum"), P(n, "hide", !/*selected_indices*/ + e = Je("li"), n = Je("span"), n.textContent = "✓", i = gn(), a = Rl(l), r = gn(), Y(n, "class", "inner-item svelte-yuohum"), K(n, "hide", !/*selected_indices*/ t[4].includes( /*index*/ t[26] - )), I(e, "class", "item svelte-yuohum"), I(e, "data-index", a = /*index*/ - t[26]), I(e, "aria-label", s = /*choices*/ + )), Y(e, "class", "item svelte-yuohum"), Y(e, "data-index", o = /*index*/ + t[26]), Y(e, "aria-label", s = /*choices*/ t[0][ /*index*/ t[26] - ][0]), I(e, "data-testid", "dropdown-option"), I(e, "role", "option"), I(e, "aria-selected", c = /*selected_indices*/ + ][0]), Y(e, "data-testid", "dropdown-option"), Y(e, "role", "option"), Y(e, "aria-selected", c = /*selected_indices*/ t[4].includes( /*index*/ t[26] - )), P( + )), K( e, "selected", /*selected_indices*/ @@ -1467,19 +1467,19 @@ function Kn(t) { /*index*/ t[26] ) - ), P( + ), K( e, "active", /*index*/ t[26] === /*active_index*/ t[5] - ), P( + ), K( e, "bg-gray-100", /*index*/ t[26] === /*active_index*/ t[5] - ), P( + ), K( e, "dark:bg-gray-600", /*index*/ @@ -1487,34 +1487,34 @@ function Kn(t) { t[5] ); }, - m(f, _) { - ye(f, e, _), Le(e, n), Le(e, i), Le(e, o), Le(e, r); + m(f, u) { + pe(f, e, u), Te(e, n), Te(e, i), Te(e, a), Te(e, r); }, - p(f, _) { - _ & /*selected_indices, filtered_indices*/ - 18 && P(n, "hide", !/*selected_indices*/ + p(f, u) { + u & /*selected_indices, filtered_indices*/ + 18 && K(n, "hide", !/*selected_indices*/ f[4].includes( /*index*/ f[26] - )), _ & /*choices, filtered_indices*/ + )), u & /*choices, filtered_indices*/ 3 && l !== (l = /*choices*/ f[0][ /*index*/ f[26] - ][0] + "") && Rl(o, l), _ & /*filtered_indices*/ - 2 && a !== (a = /*index*/ - f[26]) && I(e, "data-index", a), _ & /*choices, filtered_indices*/ + ][0] + "") && Ll(a, l), u & /*filtered_indices*/ + 2 && o !== (o = /*index*/ + f[26]) && Y(e, "data-index", o), u & /*choices, filtered_indices*/ 3 && s !== (s = /*choices*/ f[0][ /*index*/ f[26] - ][0]) && I(e, "aria-label", s), _ & /*selected_indices, filtered_indices*/ + ][0]) && Y(e, "aria-label", s), u & /*selected_indices, filtered_indices*/ 18 && c !== (c = /*selected_indices*/ f[4].includes( /*index*/ f[26] - )) && I(e, "aria-selected", c), _ & /*selected_indices, filtered_indices*/ - 18 && P( + )) && Y(e, "aria-selected", c), u & /*selected_indices, filtered_indices*/ + 18 && K( e, "selected", /*selected_indices*/ @@ -1522,22 +1522,22 @@ function Kn(t) { /*index*/ f[26] ) - ), _ & /*filtered_indices, active_index*/ - 34 && P( + ), u & /*filtered_indices, active_index*/ + 34 && K( e, "active", /*index*/ f[26] === /*active_index*/ f[5] - ), _ & /*filtered_indices, active_index*/ - 34 && P( + ), u & /*filtered_indices, active_index*/ + 34 && K( e, "bg-gray-100", /*index*/ f[26] === /*active_index*/ f[5] - ), _ & /*filtered_indices, active_index*/ - 34 && P( + ), u & /*filtered_indices, active_index*/ + 34 && K( e, "dark:bg-gray-600", /*index*/ @@ -1546,34 +1546,34 @@ function Kn(t) { ); }, d(f) { - f && ve(e); + f && ke(e); } }; } -function Bl(t) { - let e, n, i, l, o; - ht( +function Yl(t) { + let e, n, i, l, a; + mt( /*onwindowresize*/ t[19] ); let r = ( /*show_options*/ t[2] && !/*disabled*/ - t[3] && Pn(t) + t[3] && Vn(t) ); return { c() { - e = Ge("div"), n = bn(), r && r.c(), i = Al(), I(e, "class", "reference"); + e = Je("div"), n = gn(), r && r.c(), i = Al(), Y(e, "class", "reference"); }, - m(a, s) { - ye(a, e, s), t[20](e), ye(a, n, s), r && r.m(a, s), ye(a, i, s), l || (o = [ - mn( + m(o, s) { + pe(o, e, s), t[20](e), pe(o, n, s), r && r.m(o, s), pe(o, i, s), l || (a = [ + bn( window, "scroll", /*scroll_listener*/ t[12] ), - mn( + bn( window, "resize", /*onwindowresize*/ @@ -1581,105 +1581,105 @@ function Bl(t) { ) ], l = !0); }, - p(a, [s]) { + p(o, [s]) { /*show_options*/ - a[2] && !/*disabled*/ - a[3] ? r ? (r.p(a, s), s & /*show_options, disabled*/ - 12 && rn(r, 1)) : (r = Pn(a), r.c(), rn(r, 1), r.m(i.parentNode, i)) : r && (Dl(), Nn(r, 1, 1, () => { + o[2] && !/*disabled*/ + o[3] ? r ? (r.p(o, s), s & /*show_options, disabled*/ + 12 && un(r, 1)) : (r = Vn(o), r.c(), un(r, 1), r.m(i.parentNode, i)) : r && (Bl(), Pn(r, 1, 1, () => { r = null; - }), Ml()); + }), El()); }, - i(a) { - rn(r); + i(o) { + un(r); }, - o(a) { - Nn(r); + o(o) { + Pn(r); }, - d(a) { - a && (ve(e), ve(n), ve(i)), t[20](null), r && r.d(a), l = !1, ql(o); + d(o) { + o && (ke(e), ke(n), ke(i)), t[20](null), r && r.d(o), l = !1, Tl(a); } }; } function Ol(t, e, n) { var i, l; - let { choices: o } = e, { filtered_indices: r } = e, { show_options: a = !1 } = e, { disabled: s = !1 } = e, { selected_indices: c = [] } = e, { active_index: f = null } = e, _, g, h, m, b, d, u, w, p; + let { choices: a } = e, { filtered_indices: r } = e, { show_options: o = !1 } = e, { disabled: s = !1 } = e, { selected_indices: c = [] } = e, { active_index: f = null } = e, u, b, g, d, k, _, h, p, m; function E() { - const { top: y, bottom: Z } = b.getBoundingClientRect(); - n(16, _ = y), n(17, g = p - Z); + const { top: v, bottom: F } = k.getBoundingClientRect(); + n(16, u = v), n(17, b = m - F); } - let S = null; + let z = null; function x() { - a && (S !== null && clearTimeout(S), S = setTimeout( + o && (z !== null && clearTimeout(z), z = setTimeout( () => { - E(), S = null; + E(), z = null; }, 10 )); } - const M = Yl(); - function C() { - n(11, p = window.innerHeight); + const M = Xl(); + function y() { + n(11, m = window.innerHeight); } - function D(y) { - jn[y ? "unshift" : "push"](() => { - b = y, n(6, b); + function H(v) { + Wn[v ? "unshift" : "push"](() => { + k = v, n(6, k); }); } - const q = (y) => M("change", y); - function L(y) { - jn[y ? "unshift" : "push"](() => { - d = y, n(7, d); + const R = (v) => M("change", v); + function N(v) { + Wn[v ? "unshift" : "push"](() => { + _ = v, n(7, _); }); } - return t.$$set = (y) => { - "choices" in y && n(0, o = y.choices), "filtered_indices" in y && n(1, r = y.filtered_indices), "show_options" in y && n(2, a = y.show_options), "disabled" in y && n(3, s = y.disabled), "selected_indices" in y && n(4, c = y.selected_indices), "active_index" in y && n(5, f = y.active_index); + return t.$$set = (v) => { + "choices" in v && n(0, a = v.choices), "filtered_indices" in v && n(1, r = v.filtered_indices), "show_options" in v && n(2, o = v.show_options), "disabled" in v && n(3, s = v.disabled), "selected_indices" in v && n(4, c = v.selected_indices), "active_index" in v && n(5, f = v.active_index); }, t.$$.update = () => { if (t.$$.dirty & /*show_options, refElement, listElement, selected_indices, _a, _b, distance_from_bottom, distance_from_top, input_height*/ 508116) { - if (a && b) { - if (d && c.length > 0) { - let Z = d.querySelectorAll("li"); - for (const te of Array.from(Z)) - if (te.getAttribute("data-index") === c[0].toString()) { - n(14, i = d == null ? void 0 : d.scrollTo) === null || i === void 0 || i.call(d, 0, te.offsetTop); + if (o && k) { + if (_ && c.length > 0) { + let F = _.querySelectorAll("li"); + for (const se of Array.from(F)) + if (se.getAttribute("data-index") === c[0].toString()) { + n(14, i = _ == null ? void 0 : _.scrollTo) === null || i === void 0 || i.call(_, 0, se.offsetTop); break; } } E(); - const y = n(15, l = b.parentElement) === null || l === void 0 ? void 0 : l.getBoundingClientRect(); - n(18, h = (y == null ? void 0 : y.height) || 0), n(8, m = (y == null ? void 0 : y.width) || 0); + const v = n(15, l = k.parentElement) === null || l === void 0 ? void 0 : l.getBoundingClientRect(); + n(18, g = (v == null ? void 0 : v.height) || 0), n(8, d = (v == null ? void 0 : v.width) || 0); } - g > _ ? (n(10, w = g), n(9, u = null)) : (n(9, u = `${g + h}px`), n(10, w = _ - h)); + b > u ? (n(10, p = b), n(9, h = null)) : (n(9, h = `${b + g}px`), n(10, p = u - g)); } }, [ - o, - r, a, + r, + o, s, c, f, - b, + k, + _, d, - m, - u, - w, + h, p, + m, x, M, i, l, - _, + u, + b, g, - h, - C, - D, - q, - L + y, + H, + R, + N ]; } class Il extends xl { constructor(e) { - super(), Hl(this, e, Ol, Bl, Ll, { + super(), Dl(this, e, Ol, Yl, ql, { choices: 0, filtered_indices: 1, show_options: 2, @@ -1692,7 +1692,7 @@ class Il extends xl { function jl(t, e) { return (t % e + e) % e; } -function Vn(t, e) { +function Jn(t, e) { return t.reduce((n, i, l) => ((!e || i[0].toLowerCase().includes(e.toLowerCase())) && n.push(l), n), []); } function Ul(t, e, n) { @@ -1712,28 +1712,28 @@ function Wl(t, e, n) { } const { SvelteComponent: Nl, - append: $, - attr: O, + append: ee, + attr: X, binding_callbacks: Fl, check_outros: Pl, - create_component: gn, - destroy_component: wn, - detach: vn, - element: re, + create_component: wn, + destroy_component: kn, + detach: yn, + element: ce, group_outros: Kl, init: Vl, - insert: yn, - listen: we, + insert: Cn, + listen: me, mount_component: pn, run_all: Gl, safe_not_equal: Jl, set_data: Ql, - set_input_value: Gn, - space: fn, + set_input_value: Qn, + space: hn, text: Zl, - toggle_class: ae, - transition_in: fe, - transition_out: ke + toggle_class: fe, + transition_in: ue, + transition_out: ge } = window.__gradio__svelte__internal, { onMount: $l } = window.__gradio__svelte__internal, { createEventDispatcher: es, afterUpdate: ns } = window.__gradio__svelte__internal; function ts(t) { let e; @@ -1745,7 +1745,7 @@ function ts(t) { ); }, m(n, i) { - yn(n, e, i); + Cn(n, e, i); }, p(n, i) { i[0] & /*label*/ @@ -1756,33 +1756,33 @@ function ts(t) { ); }, d(n) { - n && vn(e); + n && yn(e); } }; } -function Jn(t) { +function Zn(t) { let e, n, i; return n = new Jt({}), { c() { - e = re("div"), gn(n.$$.fragment), O(e, "class", "icon-wrap svelte-1m1zvyj"); + e = ce("div"), wn(n.$$.fragment), X(e, "class", "icon-wrap svelte-1m1zvyj"); }, - m(l, o) { - yn(l, e, o), pn(n, e, null), i = !0; + m(l, a) { + Cn(l, e, a), pn(n, e, null), i = !0; }, i(l) { - i || (fe(n.$$.fragment, l), i = !0); + i || (ue(n.$$.fragment, l), i = !0); }, o(l) { - ke(n.$$.fragment, l), i = !1; + ge(n.$$.fragment, l), i = !1; }, d(l) { - l && vn(e), wn(n); + l && yn(e), kn(n); } }; } function is(t) { - let e, n, i, l, o, r, a, s, c, f, _, g, h, m; - n = new it({ + let e, n, i, l, a, r, o, s, c, f, u, b, g, d; + n = new ot({ props: { show_label: ( /*show_label*/ @@ -1796,9 +1796,9 @@ function is(t) { $$scope: { ctx: t } } }); - let b = !/*disabled*/ - t[3] && Jn(); - return _ = new Il({ + let k = !/*disabled*/ + t[3] && Zn(); + return u = new Il({ props: { show_options: ( /*show_options*/ @@ -1828,246 +1828,246 @@ function is(t) { t[14] ) } - }), _.$on( + }), u.$on( "change", /*handle_option_selected*/ t[16] ), { c() { - e = re("div"), gn(n.$$.fragment), i = fn(), l = re("div"), o = re("div"), r = re("div"), a = re("input"), c = fn(), b && b.c(), f = fn(), gn(_.$$.fragment), O(a, "role", "listbox"), O(a, "aria-controls", "dropdown-options"), O( - a, + e = ce("div"), wn(n.$$.fragment), i = hn(), l = ce("div"), a = ce("div"), r = ce("div"), o = ce("input"), c = hn(), k && k.c(), f = hn(), wn(u.$$.fragment), X(o, "role", "listbox"), X(o, "aria-controls", "dropdown-options"), X( + o, "aria-expanded", /*show_options*/ t[12] - ), O( - a, + ), X( + o, "aria-label", /*label*/ t[0] - ), O(a, "class", "border-none svelte-1m1zvyj"), a.disabled = /*disabled*/ - t[3], O(a, "autocomplete", "off"), a.readOnly = s = !/*filterable*/ - t[7], ae(a, "subdued", !/*choices_names*/ + ), X(o, "class", "border-none svelte-1m1zvyj"), o.disabled = /*disabled*/ + t[3], X(o, "autocomplete", "off"), o.readOnly = s = !/*filterable*/ + t[7], fe(o, "subdued", !/*choices_names*/ t[13].includes( /*input_text*/ t[9] ) && !/*allow_custom_value*/ - t[6]), O(r, "class", "secondary-wrap svelte-1m1zvyj"), O(o, "class", "wrap-inner svelte-1m1zvyj"), ae( - o, + t[6]), X(r, "class", "secondary-wrap svelte-1m1zvyj"), X(a, "class", "wrap-inner svelte-1m1zvyj"), fe( + a, "show_options", /*show_options*/ t[12] - ), O(l, "class", "wrap svelte-1m1zvyj"), O(e, "class", "svelte-1m1zvyj"), ae( + ), X(l, "class", "wrap svelte-1m1zvyj"), X(e, "class", "svelte-1m1zvyj"), fe( e, "container", /*container*/ t[5] ); }, - m(d, u) { - yn(d, e, u), pn(n, e, null), $(e, i), $(e, l), $(l, o), $(o, r), $(r, a), Gn( - a, + m(_, h) { + Cn(_, e, h), pn(n, e, null), ee(e, i), ee(e, l), ee(l, a), ee(a, r), ee(r, o), Qn( + o, /*input_text*/ t[9] - ), t[29](a), $(r, c), b && b.m(r, null), $(l, f), pn(_, l, null), g = !0, h || (m = [ - we( - a, + ), t[29](o), ee(r, c), k && k.m(r, null), ee(l, f), pn(u, l, null), b = !0, g || (d = [ + me( + o, "input", /*input_input_handler*/ t[28] ), - we( - a, + me( + o, "keydown", /*handle_key_down*/ t[19] ), - we( - a, + me( + o, "keyup", /*keyup_handler*/ t[30] ), - we( - a, + me( + o, "blur", /*handle_blur*/ t[18] ), - we( - a, + me( + o, "focus", /*handle_focus*/ t[17] ) - ], h = !0); - }, - p(d, u) { - const w = {}; - u[0] & /*show_label*/ - 16 && (w.show_label = /*show_label*/ - d[4]), u[0] & /*info*/ - 2 && (w.info = /*info*/ - d[1]), u[0] & /*label*/ - 1 | u[1] & /*$$scope*/ - 4 && (w.$$scope = { dirty: u, ctx: d }), n.$set(w), (!g || u[0] & /*show_options*/ - 4096) && O( - a, + ], g = !0); + }, + p(_, h) { + const p = {}; + h[0] & /*show_label*/ + 16 && (p.show_label = /*show_label*/ + _[4]), h[0] & /*info*/ + 2 && (p.info = /*info*/ + _[1]), h[0] & /*label*/ + 1 | h[1] & /*$$scope*/ + 4 && (p.$$scope = { dirty: h, ctx: _ }), n.$set(p), (!b || h[0] & /*show_options*/ + 4096) && X( + o, "aria-expanded", /*show_options*/ - d[12] - ), (!g || u[0] & /*label*/ - 1) && O( - a, + _[12] + ), (!b || h[0] & /*label*/ + 1) && X( + o, "aria-label", /*label*/ - d[0] - ), (!g || u[0] & /*disabled*/ - 8) && (a.disabled = /*disabled*/ - d[3]), (!g || u[0] & /*filterable*/ + _[0] + ), (!b || h[0] & /*disabled*/ + 8) && (o.disabled = /*disabled*/ + _[3]), (!b || h[0] & /*filterable*/ 128 && s !== (s = !/*filterable*/ - d[7])) && (a.readOnly = s), u[0] & /*input_text*/ - 512 && a.value !== /*input_text*/ - d[9] && Gn( - a, + _[7])) && (o.readOnly = s), h[0] & /*input_text*/ + 512 && o.value !== /*input_text*/ + _[9] && Qn( + o, /*input_text*/ - d[9] - ), (!g || u[0] & /*choices_names, input_text, allow_custom_value*/ - 8768) && ae(a, "subdued", !/*choices_names*/ - d[13].includes( + _[9] + ), (!b || h[0] & /*choices_names, input_text, allow_custom_value*/ + 8768) && fe(o, "subdued", !/*choices_names*/ + _[13].includes( /*input_text*/ - d[9] + _[9] ) && !/*allow_custom_value*/ - d[6]), /*disabled*/ - d[3] ? b && (Kl(), ke(b, 1, 1, () => { - b = null; - }), Pl()) : b ? u[0] & /*disabled*/ - 8 && fe(b, 1) : (b = Jn(), b.c(), fe(b, 1), b.m(r, null)), (!g || u[0] & /*show_options*/ - 4096) && ae( - o, + _[6]), /*disabled*/ + _[3] ? k && (Kl(), ge(k, 1, 1, () => { + k = null; + }), Pl()) : k ? h[0] & /*disabled*/ + 8 && ue(k, 1) : (k = Zn(), k.c(), ue(k, 1), k.m(r, null)), (!b || h[0] & /*show_options*/ + 4096) && fe( + a, "show_options", /*show_options*/ - d[12] + _[12] ); - const p = {}; - u[0] & /*show_options*/ - 4096 && (p.show_options = /*show_options*/ - d[12]), u[0] & /*choices*/ - 4 && (p.choices = /*choices*/ - d[2]), u[0] & /*filtered_indices*/ - 1024 && (p.filtered_indices = /*filtered_indices*/ - d[10]), u[0] & /*disabled*/ - 8 && (p.disabled = /*disabled*/ - d[3]), u[0] & /*selected_index*/ - 2048 && (p.selected_indices = /*selected_index*/ - d[11] === null ? [] : [ + const m = {}; + h[0] & /*show_options*/ + 4096 && (m.show_options = /*show_options*/ + _[12]), h[0] & /*choices*/ + 4 && (m.choices = /*choices*/ + _[2]), h[0] & /*filtered_indices*/ + 1024 && (m.filtered_indices = /*filtered_indices*/ + _[10]), h[0] & /*disabled*/ + 8 && (m.disabled = /*disabled*/ + _[3]), h[0] & /*selected_index*/ + 2048 && (m.selected_indices = /*selected_index*/ + _[11] === null ? [] : [ /*selected_index*/ - d[11] - ]), u[0] & /*active_index*/ - 16384 && (p.active_index = /*active_index*/ - d[14]), _.$set(p), (!g || u[0] & /*container*/ - 32) && ae( + _[11] + ]), h[0] & /*active_index*/ + 16384 && (m.active_index = /*active_index*/ + _[14]), u.$set(m), (!b || h[0] & /*container*/ + 32) && fe( e, "container", /*container*/ - d[5] + _[5] ); }, - i(d) { - g || (fe(n.$$.fragment, d), fe(b), fe(_.$$.fragment, d), g = !0); + i(_) { + b || (ue(n.$$.fragment, _), ue(k), ue(u.$$.fragment, _), b = !0); }, - o(d) { - ke(n.$$.fragment, d), ke(b), ke(_.$$.fragment, d), g = !1; + o(_) { + ge(n.$$.fragment, _), ge(k), ge(u.$$.fragment, _), b = !1; }, - d(d) { - d && vn(e), wn(n), t[29](null), b && b.d(), wn(_), h = !1, Gl(m); + d(_) { + _ && yn(e), kn(n), t[29](null), k && k.d(), kn(u), g = !1, Gl(d); } }; } function ls(t, e, n) { - let { label: i } = e, { info: l = void 0 } = e, { value: o = [] } = e, r = [], { value_is_output: a = !1 } = e, { choices: s } = e, c, { disabled: f = !1 } = e, { show_label: _ } = e, { container: g = !0 } = e, { allow_custom_value: h = !1 } = e, { filterable: m = !0 } = e, b, d = !1, u, w, p = "", E = "", S = !1, x = [], M = null, C = null, D; - const q = es(); - o ? (D = s.map((v) => v[1]).indexOf(o), C = D, C === -1 ? (r = o, C = null) : ([p, r] = s[C], E = p), y()) : s.length > 0 && (D = 0, C = 0, [p, o] = s[C], r = o, E = p); - function L() { - n(13, u = s.map((v) => v[0])), n(24, w = s.map((v) => v[1])); - } - function y() { - L(), o === void 0 || Array.isArray(o) && o.length === 0 ? (n(9, p = ""), n(11, C = null)) : w.includes(o) ? (n(9, p = u[w.indexOf(o)]), n(11, C = w.indexOf(o))) : h ? (n(9, p = o), n(11, C = null)) : (n(9, p = ""), n(11, C = null)), n(27, D = C); - } - function Z(v) { - if (n(11, C = parseInt(v.detail.target.dataset.index)), isNaN(C)) { - n(11, C = null); + let { label: i } = e, { info: l = void 0 } = e, { value: a = [] } = e, r = [], { value_is_output: o = !1 } = e, { choices: s } = e, c, { disabled: f = !1 } = e, { show_label: u } = e, { container: b = !0 } = e, { allow_custom_value: g = !1 } = e, { filterable: d = !0 } = e, k, _ = !1, h, p, m = "", E = "", z = !1, x = [], M = null, y = null, H; + const R = es(); + a ? (H = s.map((C) => C[1]).indexOf(a), y = H, y === -1 ? (r = a, y = null) : ([m, r] = s[y], E = m), v()) : s.length > 0 && (H = 0, y = 0, [m, a] = s[y], r = a, E = m); + function N() { + n(13, h = s.map((C) => C[0])), n(24, p = s.map((C) => C[1])); + } + function v() { + N(), a === void 0 || Array.isArray(a) && a.length === 0 ? (n(9, m = ""), n(11, y = null)) : p.includes(a) ? (n(9, m = h[p.indexOf(a)]), n(11, y = p.indexOf(a))) : g ? (n(9, m = a), n(11, y = null)) : (n(9, m = ""), n(11, y = null)), n(27, H = y); + } + function F(C) { + if (n(11, y = parseInt(C.detail.target.dataset.index)), isNaN(y)) { + n(11, y = null); return; } - n(12, d = !1), n(14, M = null), b.blur(); + n(12, _ = !1), n(14, M = null), k.blur(); } - function te(v) { - n(10, x = s.map((He, ie) => ie)), n(12, d = !0), q("focus"); + function se(C) { + n(10, x = s.map((xn, en) => en)), n(12, _ = !0), R("focus"); } - function me() { - h ? n(20, o = p) : n(9, p = u[w.indexOf(o)]), n(12, d = !1), n(14, M = null), q("blur"); + function Ze() { + g ? n(20, a = m) : n(9, m = h[p.indexOf(a)]), n(12, _ = !1), n(14, M = null), R("blur"); } - function De(v) { - n(12, [d, M] = Wl(v, M, x), d, (n(14, M), n(2, s), n(23, c), n(6, h), n(9, p), n(10, x), n(8, b), n(25, E), n(11, C), n(27, D), n(26, S), n(24, w))), v.key === "Enter" && (M !== null ? (n(11, C = M), n(12, d = !1), b.blur(), n(14, M = null)) : u.includes(p) ? (n(11, C = u.indexOf(p)), n(12, d = !1), n(14, M = null), b.blur()) : h && (n(20, o = p), n(11, C = null), n(12, d = !1), n(14, M = null), b.blur()), q("enter", o)); + function de(C) { + n(12, [_, M] = Wl(C, M, x), _, (n(14, M), n(2, s), n(23, c), n(6, g), n(9, m), n(10, x), n(8, k), n(25, E), n(11, y), n(27, H), n(26, z), n(24, p))), C.key === "Enter" && (M !== null ? (n(11, y = M), n(12, _ = !1), k.blur(), n(14, M = null)) : h.includes(m) ? (n(11, y = h.indexOf(m)), n(12, _ = !1), n(14, M = null), k.blur()) : g && (n(20, a = m), n(11, y = null), n(12, _ = !1), n(14, M = null), k.blur()), R("enter", a)); } ns(() => { - n(21, a = !1), n(26, S = !0); + n(21, o = !1), n(26, z = !0); }), $l(() => { - b.focus(); + k.focus(); }); - function Qe() { - p = this.value, n(9, p), n(11, C), n(27, D), n(26, S), n(2, s), n(24, w); + function Me() { + m = this.value, n(9, m), n(11, y), n(27, H), n(26, z), n(2, s), n(24, p); } - function be(v) { - Fl[v ? "unshift" : "push"](() => { - b = v, n(8, b); + function Ae(C) { + Fl[C ? "unshift" : "push"](() => { + k = C, n(8, k); }); } - const Ze = (v) => q("key_up", { key: v.key, input_value: p }); - return t.$$set = (v) => { - "label" in v && n(0, i = v.label), "info" in v && n(1, l = v.info), "value" in v && n(20, o = v.value), "value_is_output" in v && n(21, a = v.value_is_output), "choices" in v && n(2, s = v.choices), "disabled" in v && n(3, f = v.disabled), "show_label" in v && n(4, _ = v.show_label), "container" in v && n(5, g = v.container), "allow_custom_value" in v && n(6, h = v.allow_custom_value), "filterable" in v && n(7, m = v.filterable); + const $e = (C) => R("key_up", { key: C.key, input_value: m }); + return t.$$set = (C) => { + "label" in C && n(0, i = C.label), "info" in C && n(1, l = C.info), "value" in C && n(20, a = C.value), "value_is_output" in C && n(21, o = C.value_is_output), "choices" in C && n(2, s = C.choices), "disabled" in C && n(3, f = C.disabled), "show_label" in C && n(4, u = C.show_label), "container" in C && n(5, b = C.container), "allow_custom_value" in C && n(6, g = C.allow_custom_value), "filterable" in C && n(7, d = C.filterable); }, t.$$.update = () => { t.$$.dirty[0] & /*selected_index, old_selected_index, initialized, choices, choices_values*/ - 218105860 && C !== D && C !== null && S && (n(9, [p, o] = s[C], p, (n(20, o), n(11, C), n(27, D), n(26, S), n(2, s), n(24, w))), n(27, D = C), q("select", { - index: C, - value: w[C], + 218105860 && y !== H && y !== null && z && (n(9, [m, a] = s[y], m, (n(20, a), n(11, y), n(27, H), n(26, z), n(2, s), n(24, p))), n(27, H = y), R("select", { + index: y, + value: p[y], selected: !0 })), t.$$.dirty[0] & /*value, old_value, value_is_output*/ - 7340032 && o != r && (y(), Ul(q, o, a), n(22, r = o)), t.$$.dirty[0] & /*choices*/ - 4 && L(), t.$$.dirty[0] & /*choices, old_choices, allow_custom_value, input_text, filtered_indices, filter_input*/ - 8390468 && s !== c && (h || y(), n(23, c = s), n(10, x = Vn(s, p)), !h && x.length > 0 && n(14, M = x[0]), b == document.activeElement && n(12, d = !0)), t.$$.dirty[0] & /*input_text, old_input_text, choices, allow_custom_value, filtered_indices*/ - 33556036 && p !== E && (n(10, x = Vn(s, p)), n(25, E = p), !h && x.length > 0 && n(14, M = x[0])); + 7340032 && a != r && (v(), Ul(R, a, o), n(22, r = a)), t.$$.dirty[0] & /*choices*/ + 4 && N(), t.$$.dirty[0] & /*choices, old_choices, allow_custom_value, input_text, filtered_indices, filter_input*/ + 8390468 && s !== c && (g || v(), n(23, c = s), n(10, x = Jn(s, m)), !g && x.length > 0 && n(14, M = x[0]), k == document.activeElement && n(12, _ = !0)), t.$$.dirty[0] & /*input_text, old_input_text, choices, allow_custom_value, filtered_indices*/ + 33556036 && m !== E && (n(10, x = Jn(s, m)), n(25, E = m), !g && x.length > 0 && n(14, M = x[0])); }, [ i, l, s, f, - _, + u, + b, g, - h, + d, + k, m, - b, - p, x, - C, - d, - u, + y, + _, + h, M, - q, - Z, - te, - me, - De, - o, + R, + F, + se, + Ze, + de, a, + o, r, c, - w, + p, E, - S, - D, - Qe, - be, - Ze + z, + H, + Me, + Ae, + $e ]; } class ss extends Nl { @@ -2097,33 +2097,33 @@ class ss extends Nl { } const { SvelteComponent: os, - append: V, - attr: Re, - create_component: Xe, - destroy_component: Ye, - detach: Cn, - element: ee, + append: G, + attr: qe, + create_component: Le, + destroy_component: Re, + detach: Sn, + element: ne, init: as, - insert: Sn, - mount_component: Be, + insert: zn, + mount_component: Xe, safe_not_equal: rs, - set_style: Oe, - space: cn, - text: _t, - transition_in: Ie, - transition_out: je + set_style: Ye, + space: _n, + text: bt, + transition_in: Oe, + transition_out: Ie } = window.__gradio__svelte__internal, { createEventDispatcher: fs } = window.__gradio__svelte__internal, { onMount: cs, onDestroy: us } = window.__gradio__svelte__internal; function hs(t) { let e; return { c() { - e = _t("Cancel"); + e = bt("Cancel"); }, m(n, i) { - Sn(n, e, i); + zn(n, e, i); }, d(n) { - n && Cn(e); + n && Sn(e); } }; } @@ -2131,19 +2131,19 @@ function _s(t) { let e; return { c() { - e = _t("OK"); + e = bt("OK"); }, m(n, i) { - Sn(n, e, i); + zn(n, e, i); }, d(n) { - n && Cn(e); + n && Sn(e); } }; } function ds(t) { - let e, n, i, l, o, r, a, s, c, f, _, g, h, m, b; - return o = new ss({ + let e, n, i, l, a, r, o, s, c, f, u, b, g, d, k; + return a = new ss({ props: { value: ( /*currentLabel*/ @@ -2157,11 +2157,11 @@ function ds(t) { show_label: !1, allow_custom_value: !0 } - }), o.$on( + }), a.$on( "change", /*onDropDownChange*/ t[4] - ), o.$on( + ), a.$on( "enter", /*onDropDownEnter*/ t[6] @@ -2178,114 +2178,114 @@ function ds(t) { "change", /*onColorChange*/ t[5] - ), _ = new In({ + ), u = new Un({ props: { $$slots: { default: [hs] }, $$scope: { ctx: t } } - }), _.$on( + }), u.$on( "click", /*click_handler*/ t[10] - ), m = new In({ + ), d = new Un({ props: { variant: "primary", $$slots: { default: [_s] }, $$scope: { ctx: t } } - }), m.$on( + }), d.$on( "click", /*click_handler_1*/ t[11] ), { c() { - e = ee("div"), n = ee("div"), i = ee("span"), l = ee("div"), Xe(o.$$.fragment), r = cn(), a = ee("div"), Xe(s.$$.fragment), c = cn(), f = ee("div"), Xe(_.$$.fragment), g = cn(), h = ee("div"), Xe(m.$$.fragment), Oe(l, "margin-right", "10px"), Oe(a, "margin-right", "40px"), Oe(a, "margin-bottom", "8px"), Oe(f, "margin-right", "8px"), Re(i, "class", "model-content svelte-hkn2q1"), Re(n, "class", "modal-container svelte-hkn2q1"), Re(e, "class", "modal svelte-hkn2q1"), Re(e, "id", "model-box-edit"); - }, - m(d, u) { - Sn(d, e, u), V(e, n), V(n, i), V(i, l), Be(o, l, null), V(i, r), V(i, a), Be(s, a, null), V(i, c), V(i, f), Be(_, f, null), V(i, g), V(i, h), Be(m, h, null), b = !0; - }, - p(d, [u]) { - const w = {}; - u & /*currentLabel*/ - 1 && (w.value = /*currentLabel*/ - d[0]), u & /*choices*/ - 4 && (w.choices = /*choices*/ - d[2]), o.$set(w); + e = ne("div"), n = ne("div"), i = ne("span"), l = ne("div"), Le(a.$$.fragment), r = _n(), o = ne("div"), Le(s.$$.fragment), c = _n(), f = ne("div"), Le(u.$$.fragment), b = _n(), g = ne("div"), Le(d.$$.fragment), Ye(l, "margin-right", "10px"), Ye(o, "margin-right", "40px"), Ye(o, "margin-bottom", "8px"), Ye(f, "margin-right", "8px"), qe(i, "class", "model-content svelte-hkn2q1"), qe(n, "class", "modal-container svelte-hkn2q1"), qe(e, "class", "modal svelte-hkn2q1"), qe(e, "id", "model-box-edit"); + }, + m(_, h) { + zn(_, e, h), G(e, n), G(n, i), G(i, l), Xe(a, l, null), G(i, r), G(i, o), Xe(s, o, null), G(i, c), G(i, f), Xe(u, f, null), G(i, b), G(i, g), Xe(d, g, null), k = !0; + }, + p(_, [h]) { const p = {}; - u & /*currentColor*/ - 2 && (p.value = /*currentColor*/ - d[1]), s.$set(p); + h & /*currentLabel*/ + 1 && (p.value = /*currentLabel*/ + _[0]), h & /*choices*/ + 4 && (p.choices = /*choices*/ + _[2]), a.$set(p); + const m = {}; + h & /*currentColor*/ + 2 && (m.value = /*currentColor*/ + _[1]), s.$set(m); const E = {}; - u & /*$$scope*/ - 16384 && (E.$$scope = { dirty: u, ctx: d }), _.$set(E); - const S = {}; - u & /*$$scope*/ - 16384 && (S.$$scope = { dirty: u, ctx: d }), m.$set(S); + h & /*$$scope*/ + 16384 && (E.$$scope = { dirty: h, ctx: _ }), u.$set(E); + const z = {}; + h & /*$$scope*/ + 16384 && (z.$$scope = { dirty: h, ctx: _ }), d.$set(z); }, - i(d) { - b || (Ie(o.$$.fragment, d), Ie(s.$$.fragment, d), Ie(_.$$.fragment, d), Ie(m.$$.fragment, d), b = !0); + i(_) { + k || (Oe(a.$$.fragment, _), Oe(s.$$.fragment, _), Oe(u.$$.fragment, _), Oe(d.$$.fragment, _), k = !0); }, - o(d) { - je(o.$$.fragment, d), je(s.$$.fragment, d), je(_.$$.fragment, d), je(m.$$.fragment, d), b = !1; + o(_) { + Ie(a.$$.fragment, _), Ie(s.$$.fragment, _), Ie(u.$$.fragment, _), Ie(d.$$.fragment, _), k = !1; }, - d(d) { - d && Cn(e), Ye(o), Ye(s), Ye(_), Ye(m); + d(_) { + _ && Sn(e), Re(a), Re(s), Re(u), Re(d); } }; } function ms(t, e, n) { - let { label: i = "" } = e, { currentLabel: l = "" } = e, { choices: o = [] } = e, { choicesColors: r = [] } = e, { color: a = "" } = e, { currentColor: s = "" } = e; + let { label: i = "" } = e, { currentLabel: l = "" } = e, { choices: a = [] } = e, { choicesColors: r = [] } = e, { color: o = "" } = e, { currentColor: s = "" } = e; const c = fs(); - function f(u) { + function f(h) { c("change", { label: l, color: s, - ok: u + ok: h }); } - function _(u) { - const { detail: w } = u; - let p = w; - Number.isInteger(p) ? (Array.isArray(r) && p < r.length && n(1, s = r[p]), Array.isArray(o) && p < o.length && n(0, l = o[p][0])) : n(0, l = p); + function u(h) { + const { detail: p } = h; + let m = p; + Number.isInteger(m) ? (Array.isArray(r) && m < r.length && n(1, s = r[m]), Array.isArray(a) && m < a.length && n(0, l = a[m][0])) : n(0, l = m); } - function g(u) { - const { detail: w } = u; - n(1, s = w); + function b(h) { + const { detail: p } = h; + n(1, s = p); } - function h(u) { - _(u), f(!0); + function g(h) { + u(h), f(!0); } - function m(u) { - switch (u.key) { + function d(h) { + switch (h.key) { case "Enter": f(!0); break; } } cs(() => { - document.addEventListener("keydown", m), n(0, l = i), n(1, s = a); + document.addEventListener("keydown", d), n(0, l = i), n(1, s = o); }), us(() => { - document.removeEventListener("keydown", m); + document.removeEventListener("keydown", d); }); - const b = () => f(!1), d = () => f(!0); - return t.$$set = (u) => { - "label" in u && n(7, i = u.label), "currentLabel" in u && n(0, l = u.currentLabel), "choices" in u && n(2, o = u.choices), "choicesColors" in u && n(8, r = u.choicesColors), "color" in u && n(9, a = u.color), "currentColor" in u && n(1, s = u.currentColor); + const k = () => f(!1), _ = () => f(!0); + return t.$$set = (h) => { + "label" in h && n(7, i = h.label), "currentLabel" in h && n(0, l = h.currentLabel), "choices" in h && n(2, a = h.choices), "choicesColors" in h && n(8, r = h.choicesColors), "color" in h && n(9, o = h.color), "currentColor" in h && n(1, s = h.currentColor); }, [ l, s, - o, + a, f, - _, + u, + b, g, - h, i, r, - a, - b, - d + o, + k, + _ ]; } -class dt extends os { +class gt extends os { constructor(e) { super(), as(this, e, ms, ds, rs, { label: 7, @@ -2297,60 +2297,60 @@ class dt extends os { }); } } -const X = (t, e, n) => Math.min(Math.max(t, e), n); -function un(t, e) { +const q = (t, e, n) => Math.min(Math.max(t, e), n); +function dn(t, e) { if (t.startsWith("rgba")) return t.replace(/[\d.]+$/, e.toString()); const n = t.match(/\d+/g); if (!n || n.length !== 3) return `rgba(50, 50, 50, ${e})`; - const [i, l, o] = n; - return `rgba(${i}, ${l}, ${o}, ${e})`; + const [i, l, a] = n; + return `rgba(${i}, ${l}, ${a}, ${e})`; } -class hn { - constructor(e, n, i, l, o, r, a, s, c, f, _ = "rgb(255, 255, 255)", g = 0.5, h = 25, m = 8, b = 2, d = 4, u = 1) { +class mn { + constructor(e, n, i, l, a, r, o, s, c, f, u = "rgb(255, 255, 255)", b = 0.5, g = 25, d = 8, k = 2, _ = 4, h = 1) { this.stopDrag = () => { this.isDragging = !1, document.removeEventListener("mousemove", this.handleDrag), document.removeEventListener("mouseup", this.stopDrag); - }, this.handleDrag = (w) => { + }, this.handleDrag = (p) => { if (this.isDragging) { - let p = w.clientX - this.offsetMouseX - this.xmin, E = w.clientY - this.offsetMouseY - this.ymin; - const S = this.canvasXmax - this.canvasXmin, x = this.canvasYmax - this.canvasYmin; - p = X(p, -this.xmin, S - this.xmax), E = X(E, -this.ymin, x - this.ymax), this.xmin += p, this.ymin += E, this.xmax += p, this.ymax += E, this.updateHandles(), this.renderCallBack(); + let m = p.clientX - this.offsetMouseX - this.xmin, E = p.clientY - this.offsetMouseY - this.ymin; + const z = this.canvasXmax - this.canvasXmin, x = this.canvasYmax - this.canvasYmin; + m = q(m, -this.xmin, z - this.xmax), E = q(E, -this.ymin, x - this.ymax), this.xmin += m, this.ymin += E, this.xmax += m, this.ymax += E, this.updateHandles(), this.renderCallBack(); } - }, this.handleResize = (w) => { + }, this.handleResize = (p) => { if (this.isResizing) { - const p = w.clientX, E = w.clientY, S = p - this.resizeHandles[this.resizingHandleIndex].xmin - this.offsetMouseX, x = E - this.resizeHandles[this.resizingHandleIndex].ymin - this.offsetMouseY, M = this.canvasXmax - this.canvasXmin, C = this.canvasYmax - this.canvasYmin; + const m = p.clientX, E = p.clientY, z = m - this.resizeHandles[this.resizingHandleIndex].xmin - this.offsetMouseX, x = E - this.resizeHandles[this.resizingHandleIndex].ymin - this.offsetMouseY, M = this.canvasXmax - this.canvasXmin, y = this.canvasYmax - this.canvasYmin; switch (this.resizingHandleIndex) { case 0: - this.xmin += S, this.ymin += x, this.xmin = X(this.xmin, 0, this.xmax - this.minSize), this.ymin = X(this.ymin, 0, this.ymax - this.minSize); + this.xmin += z, this.ymin += x, this.xmin = q(this.xmin, 0, this.xmax - this.minSize), this.ymin = q(this.ymin, 0, this.ymax - this.minSize); break; case 1: - this.xmax += S, this.ymin += x, this.xmax = X(this.xmax, this.xmin + this.minSize, M), this.ymin = X(this.ymin, 0, this.ymax - this.minSize); + this.xmax += z, this.ymin += x, this.xmax = q(this.xmax, this.xmin + this.minSize, M), this.ymin = q(this.ymin, 0, this.ymax - this.minSize); break; case 2: - this.xmax += S, this.ymax += x, this.xmax = X(this.xmax, this.xmin + this.minSize, M), this.ymax = X(this.ymax, this.ymin + this.minSize, C); + this.xmax += z, this.ymax += x, this.xmax = q(this.xmax, this.xmin + this.minSize, M), this.ymax = q(this.ymax, this.ymin + this.minSize, y); break; case 3: - this.xmin += S, this.ymax += x, this.xmin = X(this.xmin, 0, this.xmax - this.minSize), this.ymax = X(this.ymax, this.ymin + this.minSize, C); + this.xmin += z, this.ymax += x, this.xmin = q(this.xmin, 0, this.xmax - this.minSize), this.ymax = q(this.ymax, this.ymin + this.minSize, y); break; case 4: - this.ymin += x, this.ymin = X(this.ymin, 0, this.ymax - this.minSize); + this.ymin += x, this.ymin = q(this.ymin, 0, this.ymax - this.minSize); break; case 5: - this.xmax += S, this.xmax = X(this.xmax, this.xmin + this.minSize, M); + this.xmax += z, this.xmax = q(this.xmax, this.xmin + this.minSize, M); break; case 6: - this.ymax += x, this.ymax = X(this.ymax, this.ymin + this.minSize, C); + this.ymax += x, this.ymax = q(this.ymax, this.ymin + this.minSize, y); break; case 7: - this.xmin += S, this.xmin = X(this.xmin, 0, this.xmax - this.minSize); + this.xmin += z, this.xmin = q(this.xmin, 0, this.xmax - this.minSize); break; } this.updateHandles(), this.renderCallBack(); } }, this.stopResize = () => { this.isResizing = !1, document.removeEventListener("mousemove", this.handleResize), document.removeEventListener("mouseup", this.stopResize); - }, this.renderCallBack = e, this.canvasXmin = n, this.canvasYmin = i, this.canvasXmax = l, this.canvasYmax = o, this.scaleFactor = u, this.label = r, this.isDragging = !1, this.xmin = a, this.ymin = s, this.xmax = c, this.ymax = f, this.isResizing = !1, this.isSelected = !1, this.offsetMouseX = 0, this.offsetMouseY = 0, this.resizeHandleSize = m, this.thickness = b, this.selectedThickness = d, this.updateHandles(), this.resizingHandleIndex = -1, this.minSize = h, this.color = _, this.alpha = g; + }, this.renderCallBack = e, this.canvasXmin = n, this.canvasYmin = i, this.canvasXmax = l, this.canvasYmax = a, this.scaleFactor = h, this.label = r, this.isDragging = !1, this.xmin = o, this.ymin = s, this.xmax = c, this.ymax = f, this.isResizing = !1, this.isSelected = !1, this.offsetMouseX = 0, this.offsetMouseY = 0, this.resizeHandleSize = d, this.thickness = k, this.selectedThickness = _, this.updateHandles(), this.resizingHandleIndex = -1, this.minSize = g, this.color = u, this.alpha = b; } toJSON() { return { @@ -2445,13 +2445,13 @@ class hn { } render(e) { let n, i; - if (e.beginPath(), [n, i] = this.toCanvasCoordinates(this.xmin, this.ymin), e.rect(n, i, this.getWidth(), this.getHeight()), e.fillStyle = un(this.color, this.alpha), e.fill(), this.isSelected ? e.lineWidth = this.selectedThickness : e.lineWidth = this.thickness, e.strokeStyle = un(this.color, 1), e.stroke(), e.closePath(), this.label !== null && this.label.trim() !== "") { + if (e.beginPath(), [n, i] = this.toCanvasCoordinates(this.xmin, this.ymin), e.rect(n, i, this.getWidth(), this.getHeight()), e.fillStyle = dn(this.color, this.alpha), e.fill(), this.isSelected ? e.lineWidth = this.selectedThickness : e.lineWidth = this.thickness, e.strokeStyle = dn(this.color, 1), e.stroke(), e.closePath(), this.label !== null && this.label.trim() !== "") { this.isSelected ? e.font = "bold 14px Arial" : e.font = "12px Arial"; - const l = e.measureText(this.label).width + 10, o = 20; - let r = this.xmin, a = this.ymin - o; - e.fillStyle = "white", [r, a] = this.toCanvasCoordinates(r, a), e.fillRect(r, a, l, o), e.lineWidth = 1, e.strokeStyle = "black", e.strokeRect(r, a, l, o), e.fillStyle = "black", e.fillText(this.label, r + 5, a + 15); + const l = e.measureText(this.label).width + 10, a = 20; + let r = this.xmin, o = this.ymin - a; + e.fillStyle = "white", [r, o] = this.toCanvasCoordinates(r, o), e.fillRect(r, o, l, a), e.lineWidth = 1, e.strokeStyle = "black", e.strokeRect(r, o, l, a), e.fillStyle = "black", e.fillText(this.label, r + 5, o + 15); } - e.fillStyle = un(this.color, 1); + e.fillStyle = dn(this.color, 1); for (const l of this.resizeHandles) [n, i] = this.toCanvasCoordinates(l.xmin, l.ymin), e.fillRect( n, @@ -2479,7 +2479,7 @@ class hn { this.resizingHandleIndex = e, this.isResizing = !0, this.offsetMouseX = n.clientX - this.resizeHandles[e].xmin, this.offsetMouseY = n.clientY - this.resizeHandles[e].ymin, document.addEventListener("mousemove", this.handleResize), document.addEventListener("mouseup", this.stopResize); } } -const K = [ +const V = [ "rgb(255, 168, 77)", "rgb(92, 172, 238)", "rgb(255, 99, 71)", @@ -2495,71 +2495,100 @@ const K = [ "rgb(255, 250, 138)" ], { SvelteComponent: bs, - append: ce, - attr: ne, + append: we, + attr: le, binding_callbacks: gs, - bubble: Qn, - check_outros: _n, - create_component: Ce, - destroy_component: Se, - detach: ue, - element: de, + bubble: $n, + check_outros: Ne, + create_component: ye, + destroy_component: Ce, + detach: te, + element: _e, empty: ws, - group_outros: dn, - init: ps, - insert: he, - listen: Q, - mount_component: ze, - noop: ks, - run_all: mt, + group_outros: Fe, + init: ks, + insert: ie, + listen: $, + mount_component: Se, + noop: ps, + run_all: wt, safe_not_equal: vs, - space: xe, - transition_in: Y, - transition_out: W + space: ve, + transition_in: D, + transition_out: O } = window.__gradio__svelte__internal, { onMount: ys, onDestroy: Cs, createEventDispatcher: Ss } = window.__gradio__svelte__internal; -function Zn(t) { - let e, n, i, l, o, r, a, s, c, f, _, g; - return i = new ui({}), r = new li({}), c = new Ut({}), { +function et(t) { + let e, n, i, l, a, r, o, s, c, f; + i = new ui({}); + let u = !/*disableEditBoxes*/ + t[4] && nt(t); + return o = new Ut({}), { c() { - e = de("span"), n = de("button"), Ce(i.$$.fragment), l = xe(), o = de("button"), Ce(r.$$.fragment), a = xe(), s = de("button"), Ce(c.$$.fragment), ne(n, "class", "icon svelte-182gnnj"), ne(o, "class", "icon svelte-182gnnj"), ne(s, "class", "icon svelte-182gnnj"), ne(e, "class", "canvas-control svelte-182gnnj"); + e = _e("span"), n = _e("button"), ye(i.$$.fragment), l = ve(), u && u.c(), a = ve(), r = _e("button"), ye(o.$$.fragment), le(n, "class", "icon svelte-182gnnj"), le(r, "class", "icon svelte-182gnnj"), le(e, "class", "canvas-control svelte-182gnnj"); }, - m(h, m) { - he(h, e, m), ce(e, n), ze(i, n, null), ce(e, l), ce(e, o), ze(r, o, null), ce(e, a), ce(e, s), ze(c, s, null), f = !0, _ || (g = [ - Q( + m(b, g) { + ie(b, e, g), we(e, n), Se(i, n, null), we(e, l), u && u.m(e, null), we(e, a), we(e, r), Se(o, r, null), s = !0, c || (f = [ + $( n, "click", /*click_handler*/ - t[25] - ), - Q( - o, - "click", - /*click_handler_1*/ t[26] ), - Q( - s, + $( + r, "click", /*click_handler_2*/ - t[27] + t[28] ) - ], _ = !0); + ], c = !0); + }, + p(b, g) { + /*disableEditBoxes*/ + b[4] ? u && (Fe(), O(u, 1, 1, () => { + u = null; + }), Ne()) : u ? (u.p(b, g), g[0] & /*disableEditBoxes*/ + 16 && D(u, 1)) : (u = nt(b), u.c(), D(u, 1), u.m(e, a)); }, - p: ks, - i(h) { - f || (Y(i.$$.fragment, h), Y(r.$$.fragment, h), Y(c.$$.fragment, h), f = !0); + i(b) { + s || (D(i.$$.fragment, b), D(u), D(o.$$.fragment, b), s = !0); }, - o(h) { - W(i.$$.fragment, h), W(r.$$.fragment, h), W(c.$$.fragment, h), f = !1; + o(b) { + O(i.$$.fragment, b), O(u), O(o.$$.fragment, b), s = !1; }, - d(h) { - h && ue(e), Se(i), Se(r), Se(c), _ = !1, mt(g); + d(b) { + b && te(e), Ce(i), u && u.d(), Ce(o), c = !1, wt(f); } }; } -function $n(t) { +function nt(t) { + let e, n, i, l, a; + return n = new li({}), { + c() { + e = _e("button"), ye(n.$$.fragment), le(e, "class", "icon svelte-182gnnj"); + }, + m(r, o) { + ie(r, e, o), Se(n, e, null), i = !0, l || (a = $( + e, + "click", + /*click_handler_1*/ + t[27] + ), l = !0); + }, + p: ps, + i(r) { + i || (D(n.$$.fragment, r), i = !0); + }, + o(r) { + O(n.$$.fragment, r), i = !1; + }, + d(r) { + r && te(e), Ce(n), l = !1, a(); + } + }; +} +function tt(t) { let e, n; - return e = new dt({ + return e = new gt({ props: { choices: ( /*choices*/ @@ -2571,25 +2600,25 @@ function $n(t) { ), label: ( /*selectedBox*/ - t[5] >= 0 && /*selectedBox*/ - t[5] < /*value*/ + t[6] >= 0 && /*selectedBox*/ + t[6] < /*value*/ t[0].boxes.length ? ( /*value*/ t[0].boxes[ /*selectedBox*/ - t[5] + t[6] ].label ) : "" ), color: ( /*selectedBox*/ - t[5] >= 0 && /*selectedBox*/ - t[5] < /*value*/ - t[0].boxes.length ? Me( + t[6] >= 0 && /*selectedBox*/ + t[6] < /*value*/ + t[0].boxes.length ? ze( /*value*/ t[0].boxes[ /*selectedBox*/ - t[5] + t[6] ].color ) : "" ) @@ -2597,60 +2626,60 @@ function $n(t) { }), e.$on( "change", /*onModalEditChange*/ - t[14] + t[15] ), e.$on( "enter{onModalEditChange}", /*enter_onModalEditChange_handler*/ - t[28] + t[29] ), { c() { - Ce(e.$$.fragment); + ye(e.$$.fragment); }, m(i, l) { - ze(e, i, l), n = !0; + Se(e, i, l), n = !0; }, p(i, l) { - const o = {}; + const a = {}; l[0] & /*choices*/ - 4 && (o.choices = /*choices*/ + 4 && (a.choices = /*choices*/ i[2]), l[0] & /*choicesColors*/ - 8 && (o.choicesColors = /*choicesColors*/ + 8 && (a.choicesColors = /*choicesColors*/ i[3]), l[0] & /*selectedBox, value*/ - 33 && (o.label = /*selectedBox*/ - i[5] >= 0 && /*selectedBox*/ - i[5] < /*value*/ + 65 && (a.label = /*selectedBox*/ + i[6] >= 0 && /*selectedBox*/ + i[6] < /*value*/ i[0].boxes.length ? ( /*value*/ i[0].boxes[ /*selectedBox*/ - i[5] + i[6] ].label ) : ""), l[0] & /*selectedBox, value*/ - 33 && (o.color = /*selectedBox*/ - i[5] >= 0 && /*selectedBox*/ - i[5] < /*value*/ - i[0].boxes.length ? Me( + 65 && (a.color = /*selectedBox*/ + i[6] >= 0 && /*selectedBox*/ + i[6] < /*value*/ + i[0].boxes.length ? ze( /*value*/ i[0].boxes[ /*selectedBox*/ - i[5] + i[6] ].color - ) : ""), e.$set(o); + ) : ""), e.$set(a); }, i(i) { - n || (Y(e.$$.fragment, i), n = !0); + n || (D(e.$$.fragment, i), n = !0); }, o(i) { - W(e.$$.fragment, i), n = !1; + O(e.$$.fragment, i), n = !1; }, d(i) { - Se(e, i); + Ce(e, i); } }; } -function et(t) { +function it(t) { let e, n; - return e = new dt({ + return e = new gt({ props: { choices: ( /*choices*/ @@ -2667,333 +2696,335 @@ function et(t) { t[3].length > 0 ? ( /*choicesColors*/ t[3][0] - ) : Me(K[ + ) : ze(V[ /*value*/ - t[0].boxes.length % K.length + t[0].boxes.length % V.length ]) } }), e.$on( "change", /*onModalNewChange*/ - t[11] + t[12] ), e.$on( "enter{onModalNewChange}", /*enter_onModalNewChange_handler*/ - t[29] + t[30] ), { c() { - Ce(e.$$.fragment); + ye(e.$$.fragment); }, m(i, l) { - ze(e, i, l), n = !0; + Se(e, i, l), n = !0; }, p(i, l) { - const o = {}; + const a = {}; l[0] & /*choices*/ - 4 && (o.choices = /*choices*/ + 4 && (a.choices = /*choices*/ i[2]), l[0] & /*choicesColors*/ - 8 && (o.choicesColors = /*choicesColors*/ + 8 && (a.choicesColors = /*choicesColors*/ i[3]), l[0] & /*choicesColors, value*/ - 9 && (o.color = Array.isArray( + 9 && (a.color = Array.isArray( /*choicesColors*/ i[3] ) && /*choicesColors*/ i[3].length > 0 ? ( /*choicesColors*/ i[3][0] - ) : Me(K[ + ) : ze(V[ /*value*/ - i[0].boxes.length % K.length - ])), e.$set(o); + i[0].boxes.length % V.length + ])), e.$set(a); }, i(i) { - n || (Y(e.$$.fragment, i), n = !0); + n || (D(e.$$.fragment, i), n = !0); }, o(i) { - W(e.$$.fragment, i), n = !1; + O(e.$$.fragment, i), n = !1; }, d(i) { - Se(e, i); + Ce(e, i); } }; } function zs(t) { - let e, n, i, l, o, r, a, s, c, f = ( + let e, n, i, l, a, r, o, s, c, f = ( /*interactive*/ - t[1] && Zn(t) - ), _ = ( + t[1] && et(t) + ), u = ( /*editModalVisible*/ - t[6] && $n(t) - ), g = ( + t[7] && tt(t) + ), b = ( /*newModalVisible*/ - t[7] && et(t) + t[8] && it(t) ); return { c() { - e = de("div"), n = de("canvas"), i = xe(), f && f.c(), l = xe(), _ && _.c(), o = xe(), g && g.c(), r = ws(), ne(n, "class", "canvas-annotator svelte-182gnnj"), ne(e, "class", "canvas-container svelte-182gnnj"), ne(e, "tabindex", "-1"); + e = _e("div"), n = _e("canvas"), i = ve(), f && f.c(), l = ve(), u && u.c(), a = ve(), b && b.c(), r = ws(), le(n, "class", "canvas-annotator svelte-182gnnj"), le(e, "class", "canvas-container svelte-182gnnj"), le(e, "tabindex", "-1"); }, - m(h, m) { - he(h, e, m), ce(e, n), t[24](n), he(h, i, m), f && f.m(h, m), he(h, l, m), _ && _.m(h, m), he(h, o, m), g && g.m(h, m), he(h, r, m), a = !0, s || (c = [ - Q( + m(g, d) { + ie(g, e, d), we(e, n), t[25](n), ie(g, i, d), f && f.m(g, d), ie(g, l, d), u && u.m(g, d), ie(g, a, d), b && b.m(g, d), ie(g, r, d), o = !0, s || (c = [ + $( n, "mousedown", /*handleMouseDown*/ - t[8] + t[9] ), - Q( + $( n, "mouseup", /*handleMouseUp*/ - t[9] + t[10] ), - Q( + $( n, "dblclick", /*handleDoubleClick*/ - t[13] + t[14] ), - Q( + $( e, "focusin", /*handleCanvasFocus*/ - t[16] + t[17] ), - Q( + $( e, "focusout", /*handleCanvasBlur*/ - t[17] + t[18] ) ], s = !0); }, - p(h, m) { + p(g, d) { /*interactive*/ - h[1] ? f ? (f.p(h, m), m[0] & /*interactive*/ - 2 && Y(f, 1)) : (f = Zn(h), f.c(), Y(f, 1), f.m(l.parentNode, l)) : f && (dn(), W(f, 1, 1, () => { + g[1] ? f ? (f.p(g, d), d[0] & /*interactive*/ + 2 && D(f, 1)) : (f = et(g), f.c(), D(f, 1), f.m(l.parentNode, l)) : f && (Fe(), O(f, 1, 1, () => { f = null; - }), _n()), /*editModalVisible*/ - h[6] ? _ ? (_.p(h, m), m[0] & /*editModalVisible*/ - 64 && Y(_, 1)) : (_ = $n(h), _.c(), Y(_, 1), _.m(o.parentNode, o)) : _ && (dn(), W(_, 1, 1, () => { - _ = null; - }), _n()), /*newModalVisible*/ - h[7] ? g ? (g.p(h, m), m[0] & /*newModalVisible*/ - 128 && Y(g, 1)) : (g = et(h), g.c(), Y(g, 1), g.m(r.parentNode, r)) : g && (dn(), W(g, 1, 1, () => { - g = null; - }), _n()); - }, - i(h) { - a || (Y(f), Y(_), Y(g), a = !0); - }, - o(h) { - W(f), W(_), W(g), a = !1; - }, - d(h) { - h && (ue(e), ue(i), ue(l), ue(o), ue(r)), t[24](null), f && f.d(h), _ && _.d(h), g && g.d(h), s = !1, mt(c); + }), Ne()), /*editModalVisible*/ + g[7] ? u ? (u.p(g, d), d[0] & /*editModalVisible*/ + 128 && D(u, 1)) : (u = tt(g), u.c(), D(u, 1), u.m(a.parentNode, a)) : u && (Fe(), O(u, 1, 1, () => { + u = null; + }), Ne()), /*newModalVisible*/ + g[8] ? b ? (b.p(g, d), d[0] & /*newModalVisible*/ + 256 && D(b, 1)) : (b = it(g), b.c(), D(b, 1), b.m(r.parentNode, r)) : b && (Fe(), O(b, 1, 1, () => { + b = null; + }), Ne()); + }, + i(g) { + o || (D(f), D(u), D(b), o = !0); + }, + o(g) { + O(f), O(u), O(b), o = !1; + }, + d(g) { + g && (te(e), te(i), te(l), te(a), te(r)), t[25](null), f && f.d(g), u && u.d(g), b && b.d(g), s = !1, wt(c); } }; } -function nt(t) { +function lt(t) { var e = parseInt(t.slice(1, 3), 16), n = parseInt(t.slice(3, 5), 16), i = parseInt(t.slice(5, 7), 16); return "rgb(" + e + ", " + n + ", " + i + ")"; } -function Me(t) { +function ze(t) { const e = t.match(/(\d+(\.\d+)?)/g), n = parseInt(e[0]), i = parseInt(e[1]), l = parseInt(e[2]); return "#" + (1 << 24 | n << 16 | i << 8 | l).toString(16).slice(1); } function xs(t, e, n) { - let { imageUrl: i = null } = e, { interactive: l } = e, { boxAlpha: o = 0.5 } = e, { boxMinSize: r = 25 } = e, { handleSize: a } = e, { boxThickness: s } = e, { boxSelectedThickness: c } = e, { value: f } = e, { choices: _ = [] } = e, { choicesColors: g = [] } = e, h, m, b = null, d = -1, u = 0, w = 0, p = 0, E = 0, S = 1, x = 0, M = 0, C = !1, D = !1; - const q = Ss(); - function L() { - if (m) { - m.clearRect(0, 0, h.width, h.height), b !== null && m.drawImage(b, u, w, x, M); - for (const k of f.boxes.slice().reverse()) - k.render(m); + let { imageUrl: i = null } = e, { interactive: l } = e, { boxAlpha: a = 0.5 } = e, { boxMinSize: r = 25 } = e, { handleSize: o } = e, { boxThickness: s } = e, { boxSelectedThickness: c } = e, { value: f } = e, { choices: u = [] } = e, { choicesColors: b = [] } = e, { disableEditBoxes: g = !1 } = e, d, k, _ = null, h = -1, p = 0, m = 0, E = 0, z = 0, x = 1, M = 0, y = 0, H = !1, R = !1; + const N = Ss(); + function v() { + if (k) { + k.clearRect(0, 0, d.width, d.height), _ !== null && k.drawImage(_, p, m, M, y); + for (const w of f.boxes.slice().reverse()) + w.render(k); } } - function y(k) { - n(5, d = k), f.boxes.forEach((z) => { - z.setSelected(!1); - }), k >= 0 && k < f.boxes.length && f.boxes[k].setSelected(!0), L(); + function F(w) { + n(6, h = w), f.boxes.forEach((S) => { + S.setSelected(!1); + }), w >= 0 && w < f.boxes.length && f.boxes[w].setSelected(!0), v(); } - function Z(k) { + function se(w) { if (!l) return; - const z = h.getBoundingClientRect(), H = k.clientX - z.left, R = k.clientY - z.top; - for (const [ge, N] of f.boxes.entries()) { - const Te = N.indexOfPointInsideHandle(H, R); - if (Te >= 0) { - y(ge), N.startResize(Te, k); + const S = d.getBoundingClientRect(), B = w.clientX - S.left, j = w.clientY - S.top; + for (const [J, I] of f.boxes.entries()) { + const De = I.indexOfPointInsideHandle(B, j); + if (De >= 0) { + F(J), I.startResize(De, w); return; } } - for (const [ge, N] of f.boxes.entries()) - if (N.isPointInsideBox(H, R)) { - y(ge), N.startDrag(k); + for (const [J, I] of f.boxes.entries()) + if (I.isPointInsideBox(B, j)) { + F(J), I.startDrag(w); return; } - y(-1); + F(-1); } - function te(k) { - q("change"); + function Ze(w) { + N("change"); } - function me(k) { + function de(w) { if (l) - switch (k.key) { + switch (w.key) { case "Delete": - He(); + nn(); break; } } - function De() { - n(7, D = !0); - } - function Qe(k) { - n(7, D = !1); - const { detail: z } = k; - let H = z.label, R = z.color; - if (z.ok) { - R === null || R === "" ? R = K[f.boxes.length % K.length] : R = nt(R); - let N = x / 3 / S, Te = x / 3 * 2 / S, xt = M / 3 / S, Mt = M / 3 * 2 / S, Et = new hn(L, u, w, p, E, H, Math.round(N), Math.round(xt), Math.round(Te), Math.round(Mt), R, o, r, a, s, c); - n(0, f.boxes = [Et, ...f.boxes], f), L(), q("change"); - } + function Me() { + g ? Ae() : n(8, R = !0); } - function be() { - d >= 0 && d < f.boxes.length && n(6, C = !0); + function Ae(w = null, S = null, B = null, j = null, J = null, I = null) { + S === null || S === "" ? S = V[f.boxes.length % V.length] : S = lt(S), w === null && (w = ""), B === null && (B = M / 3 / x), J === null && (J = M / 3 * 2 / x), j === null && (j = y / 3 / x), I === null && (I = y / 3 * 2 / x); + let De = new mn(v, p, m, E, z, w, Math.round(B), Math.round(j), Math.round(J), Math.round(I), S, a, r, o, s, c); + n(0, f.boxes = [De, ...f.boxes], f), v(), N("change"); } - function Ze(k) { - l && be(); + function $e(w) { + n(8, R = !1); + const { detail: S } = w; + S.ok && Ae(S.label, S.color); } - function v(k) { - n(6, C = !1); - const { detail: z } = k; - let H = z.label, R = z.color; - if (z.ok && d >= 0 && d < f.boxes.length) { - let N = f.boxes[d]; - N.label = H, N.color = nt(R), L(), q("change"); + function C() { + h >= 0 && h < f.boxes.length && !g && n(7, H = !0); + } + function xn(w) { + l && C(); + } + function en(w) { + n(7, H = !1); + const { detail: S } = w; + let B = S.label, j = S.color; + if (S.ok && h >= 0 && h < f.boxes.length) { + let I = f.boxes[h]; + I.label = B, I.color = lt(j), v(), N("change"); } } - function He() { - d >= 0 && d < f.boxes.length && (f.boxes.splice(d, 1), y(-1), q("change")); + function nn() { + h >= 0 && h < f.boxes.length && (f.boxes.splice(h, 1), F(-1), N("change")); } - function ie() { - if (h) { - if (S = 1, n(4, h.width = h.clientWidth, h), b !== null) - if (b.width > h.width) - S = h.width / b.width, x = b.width * S, M = b.height * S, u = 0, w = 0, p = x, E = M, n(4, h.height = M, h); + function Be() { + if (d) { + if (x = 1, n(5, d.width = d.clientWidth, d), _ !== null) + if (_.width > d.width) + x = d.width / _.width, M = _.width * x, y = _.height * x, p = 0, m = 0, E = M, z = y, n(5, d.height = y, d); else { - x = b.width, M = b.height; - var k = (h.width - x) / 2; - u = k, w = 0, p = k + x, E = b.height, n(4, h.height = M, h); + M = _.width, y = _.height; + var w = (d.width - M) / 2; + p = w, m = 0, E = w + M, z = _.height, n(5, d.height = y, d); } else - u = 0, w = 0, p = h.width, E = h.height, n(4, h.height = h.clientHeight, h); - if (p > 0 && E > 0) - for (const z of f.boxes) - z.canvasXmin = u, z.canvasYmin = w, z.canvasXmax = p, z.canvasYmax = E, z.setScaleFactor(S); - L(), q("change"); + p = 0, m = 0, E = d.width, z = d.height, n(5, d.height = d.clientHeight, d); + if (E > 0 && z > 0) + for (const S of f.boxes) + S.canvasXmin = p, S.canvasYmin = m, S.canvasXmax = E, S.canvasYmax = z, S.setScaleFactor(x); + v(), N("change"); } } - const bt = new ResizeObserver(ie); - function gt() { - for (let k = 0; k < f.boxes.length; k++) { - let z = f.boxes[k]; - if (!(z instanceof hn)) { - let H = "", R = ""; - z.hasOwnProperty("color") ? (H = z.color, Array.isArray(H) && H.length === 3 && (H = `rgb(${H[0]}, ${H[1]}, ${H[2]})`)) : H = K[k % K.length], z.hasOwnProperty("label") && (R = z.label), z = new hn(L, u, w, p, E, R, z.xmin, z.ymin, z.xmax, z.ymax, H, o, r, a, s, c), n(0, f.boxes[k] = z, f); + const kt = new ResizeObserver(Be); + function pt() { + for (let w = 0; w < f.boxes.length; w++) { + let S = f.boxes[w]; + if (!(S instanceof mn)) { + let B = "", j = ""; + S.hasOwnProperty("color") ? (B = S.color, Array.isArray(B) && B.length === 3 && (B = `rgb(${B[0]}, ${B[1]}, ${B[2]})`)) : B = V[w % V.length], S.hasOwnProperty("label") && (j = S.label), S = new mn(v, p, m, E, z, j, S.xmin, S.ymin, S.xmax, S.ymax, B, a, r, o, s, c), n(0, f.boxes[w] = S, f); } } } - function zn() { - i !== null && (b === null || b.src != i) && (b = new Image(), b.src = i, b.onload = function() { - ie(), L(); + function En() { + i !== null && (_ === null || _.src != i) && (_ = new Image(), _.src = i, _.onload = function() { + Be(), v(); }); } ys(() => { - if (Array.isArray(_) && _.length > 0 && (!Array.isArray(g) || g.length == 0)) - for (let k = 0; k < _.length; k++) { - let z = K[k % K.length]; - g.push(Me(z)); + if (Array.isArray(u) && u.length > 0 && (!Array.isArray(b) || b.length == 0)) + for (let w = 0; w < u.length; w++) { + let S = V[w % V.length]; + b.push(ze(S)); } - m = h.getContext("2d"), bt.observe(h), zn(), ie(), L(); + k = d.getContext("2d"), kt.observe(d), En(), Be(), v(); }); - function wt() { - document.addEventListener("keydown", me); + function vt() { + document.addEventListener("keydown", de); } - function pt() { - document.removeEventListener("keydown", me); + function yt() { + document.removeEventListener("keydown", de); } Cs(() => { - document.removeEventListener("keydown", me); + document.removeEventListener("keydown", de); }); - function kt(k) { - gs[k ? "unshift" : "push"](() => { - h = k, n(4, h); + function Ct(w) { + gs[w ? "unshift" : "push"](() => { + d = w, n(5, d); }); } - const vt = () => De(), yt = () => be(), Ct = () => He(); - function St(k) { - Qn.call(this, t, k); + const St = () => Me(), zt = () => C(), xt = () => nn(); + function Et(w) { + $n.call(this, t, w); } - function zt(k) { - Qn.call(this, t, k); + function Mt(w) { + $n.call(this, t, w); } - return t.$$set = (k) => { - "imageUrl" in k && n(18, i = k.imageUrl), "interactive" in k && n(1, l = k.interactive), "boxAlpha" in k && n(19, o = k.boxAlpha), "boxMinSize" in k && n(20, r = k.boxMinSize), "handleSize" in k && n(21, a = k.handleSize), "boxThickness" in k && n(22, s = k.boxThickness), "boxSelectedThickness" in k && n(23, c = k.boxSelectedThickness), "value" in k && n(0, f = k.value), "choices" in k && n(2, _ = k.choices), "choicesColors" in k && n(3, g = k.choicesColors); + return t.$$set = (w) => { + "imageUrl" in w && n(19, i = w.imageUrl), "interactive" in w && n(1, l = w.interactive), "boxAlpha" in w && n(20, a = w.boxAlpha), "boxMinSize" in w && n(21, r = w.boxMinSize), "handleSize" in w && n(22, o = w.handleSize), "boxThickness" in w && n(23, s = w.boxThickness), "boxSelectedThickness" in w && n(24, c = w.boxSelectedThickness), "value" in w && n(0, f = w.value), "choices" in w && n(2, u = w.choices), "choicesColors" in w && n(3, b = w.choicesColors), "disableEditBoxes" in w && n(4, g = w.disableEditBoxes); }, t.$$.update = () => { t.$$.dirty[0] & /*value*/ - 1 && (zn(), gt(), ie(), L()); + 1 && (En(), pt(), Be(), v()); }, [ f, l, - _, + u, + b, g, - h, d, - C, - D, - Z, - te, - De, - Qe, - be, + h, + H, + R, + se, Ze, - v, - He, - wt, - pt, + Me, + $e, + C, + xn, + en, + nn, + vt, + yt, i, - o, - r, a, + r, + o, s, c, - kt, - vt, - yt, Ct, St, - zt + zt, + xt, + Et, + Mt ]; } -class Ms extends bs { +class Es extends bs { constructor(e) { - super(), ps( + super(), ks( this, e, xs, zs, vs, { - imageUrl: 18, + imageUrl: 19, interactive: 1, - boxAlpha: 19, - boxMinSize: 20, - handleSize: 21, - boxThickness: 22, - boxSelectedThickness: 23, + boxAlpha: 20, + boxMinSize: 21, + handleSize: 22, + boxThickness: 23, + boxSelectedThickness: 24, value: 0, choices: 2, - choicesColors: 3 + choicesColors: 3, + disableEditBoxes: 4 }, null, [-1, -1] @@ -3001,24 +3032,24 @@ class Ms extends bs { } } const { - SvelteComponent: Es, + SvelteComponent: Ms, add_flush_callback: As, - bind: Ds, - binding_callbacks: Hs, - create_component: Ts, - destroy_component: qs, - init: Ls, - mount_component: Rs, - safe_not_equal: Xs, - transition_in: Ys, - transition_out: Bs + bind: Bs, + binding_callbacks: Ds, + create_component: Hs, + destroy_component: Ts, + init: qs, + mount_component: Ls, + safe_not_equal: Rs, + transition_in: Xs, + transition_out: Ys } = window.__gradio__svelte__internal, { createEventDispatcher: Os } = window.__gradio__svelte__internal; function Is(t) { let e, n, i; function l(r) { - t[13](r); + t[14](r); } - let o = { + let a = { interactive: ( /*interactive*/ t[1] @@ -3051,101 +3082,108 @@ function Is(t) { /*boxSelectedThickness*/ t[8] ), + disableEditBoxes: ( + /*disableEditBoxes*/ + t[9] + ), imageUrl: ( /*resolved_src*/ - t[9] + t[10] ) }; return ( /*value*/ - t[0] !== void 0 && (o.value = /*value*/ - t[0]), e = new Ms({ props: o }), Hs.push(() => Ds(e, "value", l)), e.$on( + t[0] !== void 0 && (a.value = /*value*/ + t[0]), e = new Es({ props: a }), Ds.push(() => Bs(e, "value", l)), e.$on( "change", /*change_handler*/ - t[14] + t[15] ), { c() { - Ts(e.$$.fragment); + Hs(e.$$.fragment); }, - m(r, a) { - Rs(e, r, a), i = !0; + m(r, o) { + Ls(e, r, o), i = !0; }, - p(r, [a]) { + p(r, [o]) { const s = {}; - a & /*interactive*/ + o & /*interactive*/ 2 && (s.interactive = /*interactive*/ - r[1]), a & /*boxesAlpha*/ + r[1]), o & /*boxesAlpha*/ 4 && (s.boxAlpha = /*boxesAlpha*/ - r[2]), a & /*labelList*/ + r[2]), o & /*labelList*/ 8 && (s.choices = /*labelList*/ - r[3]), a & /*labelColors*/ + r[3]), o & /*labelColors*/ 16 && (s.choicesColors = /*labelColors*/ - r[4]), a & /*boxMinSize*/ + r[4]), o & /*boxMinSize*/ 32 && (s.boxMinSize = /*boxMinSize*/ - r[5]), a & /*handleSize*/ + r[5]), o & /*handleSize*/ 64 && (s.handleSize = /*handleSize*/ - r[6]), a & /*boxThickness*/ + r[6]), o & /*boxThickness*/ 128 && (s.boxThickness = /*boxThickness*/ - r[7]), a & /*boxSelectedThickness*/ + r[7]), o & /*boxSelectedThickness*/ 256 && (s.boxSelectedThickness = /*boxSelectedThickness*/ - r[8]), a & /*resolved_src*/ - 512 && (s.imageUrl = /*resolved_src*/ - r[9]), !n && a & /*value*/ + r[8]), o & /*disableEditBoxes*/ + 512 && (s.disableEditBoxes = /*disableEditBoxes*/ + r[9]), o & /*resolved_src*/ + 1024 && (s.imageUrl = /*resolved_src*/ + r[10]), !n && o & /*value*/ 1 && (n = !0, s.value = /*value*/ r[0], As(() => n = !1)), e.$set(s); }, i(r) { - i || (Ys(e.$$.fragment, r), i = !0); + i || (Xs(e.$$.fragment, r), i = !0); }, o(r) { - Bs(e.$$.fragment, r), i = !1; + Ys(e.$$.fragment, r), i = !1; }, d(r) { - qs(e, r); + Ts(e, r); } } ); } function js(t, e, n) { - let { src: i = void 0 } = e, { interactive: l } = e, { boxesAlpha: o } = e, { labelList: r } = e, { labelColors: a } = e, { boxMinSize: s } = e, { handleSize: c } = e, { boxThickness: f } = e, { boxSelectedThickness: _ } = e, { value: g } = e, h, m; - const b = Os(); - function d(w) { - g = w, n(0, g); + let { src: i = void 0 } = e, { interactive: l } = e, { boxesAlpha: a } = e, { labelList: r } = e, { labelColors: o } = e, { boxMinSize: s } = e, { handleSize: c } = e, { boxThickness: f } = e, { boxSelectedThickness: u } = e, { value: b } = e, { disableEditBoxes: g } = e, d, k; + const _ = Os(); + function h(m) { + b = m, n(0, b); } - const u = () => b("change"); - return t.$$set = (w) => { - "src" in w && n(11, i = w.src), "interactive" in w && n(1, l = w.interactive), "boxesAlpha" in w && n(2, o = w.boxesAlpha), "labelList" in w && n(3, r = w.labelList), "labelColors" in w && n(4, a = w.labelColors), "boxMinSize" in w && n(5, s = w.boxMinSize), "handleSize" in w && n(6, c = w.handleSize), "boxThickness" in w && n(7, f = w.boxThickness), "boxSelectedThickness" in w && n(8, _ = w.boxSelectedThickness), "value" in w && n(0, g = w.value); + const p = () => _("change"); + return t.$$set = (m) => { + "src" in m && n(12, i = m.src), "interactive" in m && n(1, l = m.interactive), "boxesAlpha" in m && n(2, a = m.boxesAlpha), "labelList" in m && n(3, r = m.labelList), "labelColors" in m && n(4, o = m.labelColors), "boxMinSize" in m && n(5, s = m.boxMinSize), "handleSize" in m && n(6, c = m.handleSize), "boxThickness" in m && n(7, f = m.boxThickness), "boxSelectedThickness" in m && n(8, u = m.boxSelectedThickness), "value" in m && n(0, b = m.value), "disableEditBoxes" in m && n(9, g = m.disableEditBoxes); }, t.$$.update = () => { if (t.$$.dirty & /*src, latest_src*/ - 6144) { - n(9, h = i), n(12, m = i); - const w = i; - Rt(w).then((p) => { - m === w && n(9, h = p); + 12288) { + n(10, d = i), n(13, k = i); + const m = i; + Lt(m).then((E) => { + k === m && n(10, d = E); }); } }, [ - g, + b, l, - o, - r, a, + r, + o, s, c, f, + u, + g, + d, _, - h, - b, i, - m, - d, - u + k, + h, + p ]; } -class Us extends Es { +class Us extends Ms { constructor(e) { - super(), Ls(this, e, js, Is, Xs, { - src: 11, + super(), qs(this, e, js, Is, Rs, { + src: 12, interactive: 1, boxesAlpha: 2, labelList: 3, @@ -3154,7 +3192,8 @@ class Us extends Es { handleSize: 6, boxThickness: 7, boxSelectedThickness: 8, - value: 0 + value: 0, + disableEditBoxes: 9 }); } } @@ -3171,11 +3210,11 @@ const { insert: Zs, mount_component: $s, safe_not_equal: eo, - toggle_class: J, - transition_in: Fe, - transition_out: kn + toggle_class: Z, + transition_in: Pe, + transition_out: vn } = window.__gradio__svelte__internal; -function tt(t) { +function st(t) { let e, n; return e = new Us({ props: { @@ -3194,17 +3233,17 @@ function tt(t) { $s(e, i, l), n = !0; }, p(i, l) { - const o = {}; + const a = {}; l & /*samples_dir, value*/ - 3 && (o.src = /*samples_dir*/ + 3 && (a.src = /*samples_dir*/ i[1] + /*value*/ - i[0].path), e.$set(o); + i[0].path), e.$set(a); }, i(i) { - n || (Fe(e.$$.fragment, i), n = !0); + n || (Pe(e.$$.fragment, i), n = !0); }, o(i) { - kn(e.$$.fragment, i), n = !1; + vn(e.$$.fragment, i), n = !1; }, d(i) { Ks(e, i); @@ -3214,60 +3253,60 @@ function tt(t) { function no(t) { let e, n, i = ( /*value*/ - t[0] && tt(t) + t[0] && st(t) ); return { c() { - e = Gs("div"), i && i.c(), Ns(e, "class", "container svelte-1sgcyba"), J( + e = Gs("div"), i && i.c(), Ns(e, "class", "container svelte-1sgcyba"), Z( e, "table", /*type*/ t[2] === "table" - ), J( + ), Z( e, "gallery", /*type*/ t[2] === "gallery" - ), J( + ), Z( e, "selected", /*selected*/ t[3] - ), J( + ), Z( e, "border", /*value*/ t[0] ); }, - m(l, o) { - Zs(l, e, o), i && i.m(e, null), n = !0; + m(l, a) { + Zs(l, e, a), i && i.m(e, null), n = !0; }, - p(l, [o]) { + p(l, [a]) { /*value*/ - l[0] ? i ? (i.p(l, o), o & /*value*/ - 1 && Fe(i, 1)) : (i = tt(l), i.c(), Fe(i, 1), i.m(e, null)) : i && (Js(), kn(i, 1, 1, () => { + l[0] ? i ? (i.p(l, a), a & /*value*/ + 1 && Pe(i, 1)) : (i = st(l), i.c(), Pe(i, 1), i.m(e, null)) : i && (Js(), vn(i, 1, 1, () => { i = null; - }), Fs()), (!n || o & /*type*/ - 4) && J( + }), Fs()), (!n || a & /*type*/ + 4) && Z( e, "table", /*type*/ l[2] === "table" - ), (!n || o & /*type*/ - 4) && J( + ), (!n || a & /*type*/ + 4) && Z( e, "gallery", /*type*/ l[2] === "gallery" - ), (!n || o & /*selected*/ - 8) && J( + ), (!n || a & /*selected*/ + 8) && Z( e, "selected", /*selected*/ l[3] - ), (!n || o & /*value*/ - 1) && J( + ), (!n || a & /*value*/ + 1) && Z( e, "border", /*value*/ @@ -3275,10 +3314,10 @@ function no(t) { ); }, i(l) { - n || (Fe(i), n = !0); + n || (Pe(i), n = !0); }, o(l) { - kn(i), n = !1; + vn(i), n = !1; }, d(l) { l && Vs(e), i && i.d(); @@ -3286,10 +3325,10 @@ function no(t) { }; } function to(t, e, n) { - let { value: i } = e, { samples_dir: l } = e, { type: o } = e, { selected: r = !1 } = e; - return t.$$set = (a) => { - "value" in a && n(0, i = a.value), "samples_dir" in a && n(1, l = a.samples_dir), "type" in a && n(2, o = a.type), "selected" in a && n(3, r = a.selected); - }, [i, l, o, r]; + let { value: i } = e, { samples_dir: l } = e, { type: a } = e, { selected: r = !1 } = e; + return t.$$set = (o) => { + "value" in o && n(0, i = o.value), "samples_dir" in o && n(1, l = o.samples_dir), "type" in o && n(2, a = o.type), "selected" in o && n(3, r = o.selected); + }, [i, l, a, r]; } class lo extends Ws { constructor(e) { diff --git a/demo/space.py b/demo/space.py index b35fbb7..2e89203 100644 --- a/demo/space.py +++ b/demo/space.py @@ -3,7 +3,7 @@ from app import demo as app import os -_docs = {'image_annotator': {'description': 'Creates a component to annotate images with bounding boxes. The bounding boxes can be created and edited by the user or be passed by code.\nIt is also possible to predefine a set of valid classes and colors.', 'members': {'__init__': {'value': {'type': 'dict | None', 'default': 'None', 'description': "A dict or None. The dictionary must contain a key 'image' with either an URL to an image, a numpy image or a PIL image. Optionally it may contain a key 'boxes' with a list of boxes. Each box must be a dict wit the keys: 'xmin', 'ymin', 'xmax' and 'ymax' with the absolute image coordinates of the box. Optionally can also include the keys 'label' and 'color' describing the label and color of the box. Color must be a tuple of RGB values (e.g. `(255,255,255)`)."}, 'boxes_alpha': {'type': 'float | None', 'default': 'None', 'description': 'Opacity of the bounding boxes 0 and 1.'}, 'label_list': {'type': 'list[str] | None', 'default': 'None', 'description': 'List of valid labels.'}, 'label_colors': {'type': 'list[str] | None', 'default': 'None', 'description': 'Optional list of colors for each label when `label_list` is used. Colors must be a tuple of RGB values (e.g. `(255,255,255)`).'}, 'box_min_size': {'type': 'int | None', 'default': 'None', 'description': 'Minimum valid bounding box size.'}, 'handle_size': {'type': 'int | None', 'default': 'None', 'description': 'Size of the bounding box resize handles.'}, 'box_thickness': {'type': 'int | None', 'default': 'None', 'description': 'Thickness of the bounding box outline.'}, 'box_selected_thickness': {'type': 'int | None', 'default': 'None', 'description': 'Thickness of the bounding box outline when it is selected.'}, 'height': {'type': 'int | str | None', 'default': 'None', 'description': 'The height of the displayed image, specified in pixels if a number is passed, or in CSS units if a string is passed.'}, 'width': {'type': 'int | str | None', 'default': 'None', 'description': 'The width of the displayed image, specified in pixels if a number is passed, or in CSS units if a string is passed.'}, 'image_mode': {'type': '"1"\n | "L"\n | "P"\n | "RGB"\n | "RGBA"\n | "CMYK"\n | "YCbCr"\n | "LAB"\n | "HSV"\n | "I"\n | "F"', 'default': '"RGB"', 'description': '"RGB" if color, or "L" if black and white. See https://pillow.readthedocs.io/en/stable/handbook/concepts.html for other supported image modes and their meaning.'}, 'sources': {'type': 'list["upload" | "clipboard"] | None', 'default': '["upload", "clipboard"]', 'description': 'List of sources for the image. "upload" creates a box where user can drop an image file, "clipboard" allows users to paste an image from the clipboard. If None, defaults to ["upload", "clipboard"].'}, 'image_type': {'type': '"numpy" | "pil" | "filepath"', 'default': '"numpy"', 'description': 'The format the image is converted before being passed into the prediction function. "numpy" converts the image to a numpy array with shape (height, width, 3) and values from 0 to 255, "pil" converts the image to a PIL image object, "filepath" passes a str path to a temporary file containing the image. If the image is SVG, the `type` is ignored and the filepath of the SVG is returned.'}, 'label': {'type': 'str | None', 'default': 'None', 'description': 'The label for this component. Appears above the component and is also used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to.'}, 'container': {'type': 'bool', 'default': 'True', 'description': 'If True, will place the component in a container - providing some extra padding around the border.'}, 'scale': {'type': 'int | None', 'default': 'None', 'description': 'relative size compared to adjacent Components. For example if Components A and B are in a Row, and A has scale=2, and B has scale=1, A will be twice as wide as B. Should be an integer. scale applies in Rows, and to top-level Components in Blocks where fill_height=True.'}, 'min_width': {'type': 'int', 'default': '160', 'description': 'minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.'}, 'interactive': {'type': 'bool | None', 'default': 'True', 'description': 'if True, will allow users to upload and annotate an image; if False, can only be used to display annotated images.'}, 'visible': {'type': 'bool', 'default': 'True', 'description': 'If False, component will be hidden.'}, 'elem_id': {'type': 'str | None', 'default': 'None', 'description': 'An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.'}, 'elem_classes': {'type': 'list[str] | str | None', 'default': 'None', 'description': 'An optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.'}, 'render': {'type': 'bool', 'default': 'True', 'description': 'If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.'}, 'show_label': {'type': 'bool | None', 'default': 'None', 'description': 'if True, will display label.'}, 'show_download_button': {'type': 'bool', 'default': 'True', 'description': 'If True, will show a button to download the image.'}, 'show_share_button': {'type': 'bool | None', 'default': 'None', 'description': 'If True, will show a share icon in the corner of the component that allows user to share outputs to Hugging Face Spaces Discussions. If False, icon does not appear. If set to None (default behavior), then the icon appears if this Gradio app is launched on Spaces, but not otherwise.'}, 'show_clear_button': {'type': 'bool | None', 'default': 'True', 'description': 'If True, will show a clear button.'}}, 'postprocess': {'value': {'type': 'dict | None', 'description': 'A dict with an image and an optional list of boxes or None.'}}, 'preprocess': {'return': {'type': 'dict | None', 'description': 'A dict with the image and boxes or None.'}, 'value': None}}, 'events': {'clear': {'type': None, 'default': None, 'description': 'This listener is triggered when the user clears the image_annotator using the X button for the component.'}, 'change': {'type': None, 'default': None, 'description': 'Triggered when the value of the image_annotator changes either because of user input (e.g. a user types in a textbox) OR because of a function update (e.g. an image receives a value from the output of an event trigger). See `.input()` for a listener that is only triggered by user input.'}, 'upload': {'type': None, 'default': None, 'description': 'This listener is triggered when the user uploads a file into the image_annotator.'}}}, '__meta__': {'additional_interfaces': {}, 'user_fn_refs': {'image_annotator': []}}} +_docs = {'image_annotator': {'description': 'Creates a component to annotate images with bounding boxes. The bounding boxes can be created and edited by the user or be passed by code.\nIt is also possible to predefine a set of valid classes and colors.', 'members': {'__init__': {'value': {'type': 'dict | None', 'default': 'None', 'description': "A dict or None. The dictionary must contain a key 'image' with either an URL to an image, a numpy image or a PIL image. Optionally it may contain a key 'boxes' with a list of boxes. Each box must be a dict wit the keys: 'xmin', 'ymin', 'xmax' and 'ymax' with the absolute image coordinates of the box. Optionally can also include the keys 'label' and 'color' describing the label and color of the box. Color must be a tuple of RGB values (e.g. `(255,255,255)`)."}, 'boxes_alpha': {'type': 'float | None', 'default': 'None', 'description': 'Opacity of the bounding boxes 0 and 1.'}, 'label_list': {'type': 'list[str] | None', 'default': 'None', 'description': 'List of valid labels.'}, 'label_colors': {'type': 'list[str] | None', 'default': 'None', 'description': 'Optional list of colors for each label when `label_list` is used. Colors must be a tuple of RGB values (e.g. `(255,255,255)`).'}, 'box_min_size': {'type': 'int | None', 'default': 'None', 'description': 'Minimum valid bounding box size.'}, 'handle_size': {'type': 'int | None', 'default': 'None', 'description': 'Size of the bounding box resize handles.'}, 'box_thickness': {'type': 'int | None', 'default': 'None', 'description': 'Thickness of the bounding box outline.'}, 'box_selected_thickness': {'type': 'int | None', 'default': 'None', 'description': 'Thickness of the bounding box outline when it is selected.'}, 'disable_edit_boxes': {'type': 'bool | None', 'default': 'None', 'description': 'Disables the ability to set and edit the label and color of the boxes.'}, 'height': {'type': 'int | str | None', 'default': 'None', 'description': 'The height of the displayed image, specified in pixels if a number is passed, or in CSS units if a string is passed.'}, 'width': {'type': 'int | str | None', 'default': 'None', 'description': 'The width of the displayed image, specified in pixels if a number is passed, or in CSS units if a string is passed.'}, 'image_mode': {'type': '"1"\n | "L"\n | "P"\n | "RGB"\n | "RGBA"\n | "CMYK"\n | "YCbCr"\n | "LAB"\n | "HSV"\n | "I"\n | "F"', 'default': '"RGB"', 'description': '"RGB" if color, or "L" if black and white. See https://pillow.readthedocs.io/en/stable/handbook/concepts.html for other supported image modes and their meaning.'}, 'sources': {'type': 'list["upload" | "clipboard"] | None', 'default': '["upload", "clipboard"]', 'description': 'List of sources for the image. "upload" creates a box where user can drop an image file, "clipboard" allows users to paste an image from the clipboard. If None, defaults to ["upload", "clipboard"].'}, 'image_type': {'type': '"numpy" | "pil" | "filepath"', 'default': '"numpy"', 'description': 'The format the image is converted before being passed into the prediction function. "numpy" converts the image to a numpy array with shape (height, width, 3) and values from 0 to 255, "pil" converts the image to a PIL image object, "filepath" passes a str path to a temporary file containing the image. If the image is SVG, the `type` is ignored and the filepath of the SVG is returned.'}, 'label': {'type': 'str | None', 'default': 'None', 'description': 'The label for this component. Appears above the component and is also used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to.'}, 'container': {'type': 'bool', 'default': 'True', 'description': 'If True, will place the component in a container - providing some extra padding around the border.'}, 'scale': {'type': 'int | None', 'default': 'None', 'description': 'relative size compared to adjacent Components. For example if Components A and B are in a Row, and A has scale=2, and B has scale=1, A will be twice as wide as B. Should be an integer. scale applies in Rows, and to top-level Components in Blocks where fill_height=True.'}, 'min_width': {'type': 'int', 'default': '160', 'description': 'minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.'}, 'interactive': {'type': 'bool | None', 'default': 'True', 'description': 'if True, will allow users to upload and annotate an image; if False, can only be used to display annotated images.'}, 'visible': {'type': 'bool', 'default': 'True', 'description': 'If False, component will be hidden.'}, 'elem_id': {'type': 'str | None', 'default': 'None', 'description': 'An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.'}, 'elem_classes': {'type': 'list[str] | str | None', 'default': 'None', 'description': 'An optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.'}, 'render': {'type': 'bool', 'default': 'True', 'description': 'If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.'}, 'show_label': {'type': 'bool | None', 'default': 'None', 'description': 'if True, will display label.'}, 'show_download_button': {'type': 'bool', 'default': 'True', 'description': 'If True, will show a button to download the image.'}, 'show_share_button': {'type': 'bool | None', 'default': 'None', 'description': 'If True, will show a share icon in the corner of the component that allows user to share outputs to Hugging Face Spaces Discussions. If False, icon does not appear. If set to None (default behavior), then the icon appears if this Gradio app is launched on Spaces, but not otherwise.'}, 'show_clear_button': {'type': 'bool | None', 'default': 'True', 'description': 'If True, will show a clear button.'}}, 'postprocess': {'value': {'type': 'dict | None', 'description': 'A dict with an image and an optional list of boxes or None.'}}, 'preprocess': {'return': {'type': 'dict | None', 'description': 'A dict with the image and boxes or None.'}, 'value': None}}, 'events': {'clear': {'type': None, 'default': None, 'description': 'This listener is triggered when the user clears the image_annotator using the X button for the component.'}, 'change': {'type': None, 'default': None, 'description': 'Triggered when the value of the image_annotator changes either because of user input (e.g. a user types in a textbox) OR because of a function update (e.g. an image receives a value from the output of an event trigger). See `.input()` for a listener that is only triggered by user input.'}, 'upload': {'type': None, 'default': None, 'description': 'This listener is triggered when the user uploads a file into the image_annotator.'}}}, '__meta__': {'additional_interfaces': {}, 'user_fn_refs': {'image_annotator': []}}} abs_path = os.path.join(os.path.dirname(__file__), "css.css") @@ -41,7 +41,30 @@ import gradio as gr from gradio_image_annotation import image_annotator -example = { + +example_annotation = { + "image": "https://gradio-builds.s3.amazonaws.com/demo-files/base.png", + "boxes": [ + { + "xmin": 636, + "ymin": 575, + "xmax": 801, + "ymax": 697, + "label": "Vehicle", + "color": (255, 0, 0) + }, + { + "xmin": 360, + "ymin": 615, + "xmax": 386, + "ymax": 702, + "label": "Person", + "color": (0, 255, 0) + } + ] +} + +example_crop = { "image": "https://raw.githubusercontent.com/gradio-app/gradio/main/guides/assets/logo.png", "boxes": [ { @@ -49,8 +72,7 @@ "ymin": 70, "xmax": 530, "ymax": 500, - "label": "Gradio", - "color": (250, 185, 0), + "color": (100, 200, 255) } ] } @@ -69,19 +91,25 @@ def crop(annotations): def get_boxes_json(annotations): return annotations["boxes"] + with gr.Blocks() as demo: with gr.Tab("Object annotation"): annotator = image_annotator( - {"image": "https://gradio-builds.s3.amazonaws.com/demo-files/base.png"}, + example_annotation, label_list=["Person", "Vehicle"], label_colors=[(0, 255, 0), (255, 0, 0)], ) button_get = gr.Button("Get bounding boxes") json_boxes = gr.JSON() button_get.click(get_boxes_json, annotator, json_boxes) + with gr.Tab("Crop"): with gr.Row(): - annotator_crop = image_annotator(example, image_type="numpy") + annotator_crop = image_annotator( + example_crop, + image_type="numpy", + disable_edit_boxes=True + ) image_crop = gr.Image() button_crop = gr.Button("Crop") button_crop.click(crop, annotator_crop, image_crop)