const Ia = [
  { color: "red", primary: 600, secondary: 100 },
  { color: "green", primary: 600, secondary: 100 },
  { color: "blue", primary: 600, secondary: 100 },
  { color: "yellow", primary: 500, secondary: 100 },
  { color: "purple", primary: 600, secondary: 100 },
  { color: "teal", primary: 600, secondary: 100 },
  { color: "orange", primary: 600, secondary: 100 },
  { color: "cyan", primary: 600, secondary: 100 },
  { color: "lime", primary: 500, secondary: 100 },
  { color: "pink", primary: 600, secondary: 100 }
], oi = {
  inherit: "inherit",
  current: "currentColor",
  transparent: "transparent",
  black: "#000",
  white: "#fff",
  slate: {
    50: "#f8fafc",
    100: "#f1f5f9",
    200: "#e2e8f0",
    300: "#cbd5e1",
    400: "#94a3b8",
    500: "#64748b",
    600: "#475569",
    700: "#334155",
    800: "#1e293b",
    900: "#0f172a",
    950: "#020617"
  },
  gray: {
    50: "#f9fafb",
    100: "#f3f4f6",
    200: "#e5e7eb",
    300: "#d1d5db",
    400: "#9ca3af",
    500: "#6b7280",
    600: "#4b5563",
    700: "#374151",
    800: "#1f2937",
    900: "#111827",
    950: "#030712"
  },
  zinc: {
    50: "#fafafa",
    100: "#f4f4f5",
    200: "#e4e4e7",
    300: "#d4d4d8",
    400: "#a1a1aa",
    500: "#71717a",
    600: "#52525b",
    700: "#3f3f46",
    800: "#27272a",
    900: "#18181b",
    950: "#09090b"
  },
  neutral: {
    50: "#fafafa",
    100: "#f5f5f5",
    200: "#e5e5e5",
    300: "#d4d4d4",
    400: "#a3a3a3",
    500: "#737373",
    600: "#525252",
    700: "#404040",
    800: "#262626",
    900: "#171717",
    950: "#0a0a0a"
  },
  stone: {
    50: "#fafaf9",
    100: "#f5f5f4",
    200: "#e7e5e4",
    300: "#d6d3d1",
    400: "#a8a29e",
    500: "#78716c",
    600: "#57534e",
    700: "#44403c",
    800: "#292524",
    900: "#1c1917",
    950: "#0c0a09"
  },
  red: {
    50: "#fef2f2",
    100: "#fee2e2",
    200: "#fecaca",
    300: "#fca5a5",
    400: "#f87171",
    500: "#ef4444",
    600: "#dc2626",
    700: "#b91c1c",
    800: "#991b1b",
    900: "#7f1d1d",
    950: "#450a0a"
  },
  orange: {
    50: "#fff7ed",
    100: "#ffedd5",
    200: "#fed7aa",
    300: "#fdba74",
    400: "#fb923c",
    500: "#f97316",
    600: "#ea580c",
    700: "#c2410c",
    800: "#9a3412",
    900: "#7c2d12",
    950: "#431407"
  },
  amber: {
    50: "#fffbeb",
    100: "#fef3c7",
    200: "#fde68a",
    300: "#fcd34d",
    400: "#fbbf24",
    500: "#f59e0b",
    600: "#d97706",
    700: "#b45309",
    800: "#92400e",
    900: "#78350f",
    950: "#451a03"
  },
  yellow: {
    50: "#fefce8",
    100: "#fef9c3",
    200: "#fef08a",
    300: "#fde047",
    400: "#facc15",
    500: "#eab308",
    600: "#ca8a04",
    700: "#a16207",
    800: "#854d0e",
    900: "#713f12",
    950: "#422006"
  },
  lime: {
    50: "#f7fee7",
    100: "#ecfccb",
    200: "#d9f99d",
    300: "#bef264",
    400: "#a3e635",
    500: "#84cc16",
    600: "#65a30d",
    700: "#4d7c0f",
    800: "#3f6212",
    900: "#365314",
    950: "#1a2e05"
  },
  green: {
    50: "#f0fdf4",
    100: "#dcfce7",
    200: "#bbf7d0",
    300: "#86efac",
    400: "#4ade80",
    500: "#22c55e",
    600: "#16a34a",
    700: "#15803d",
    800: "#166534",
    900: "#14532d",
    950: "#052e16"
  },
  emerald: {
    50: "#ecfdf5",
    100: "#d1fae5",
    200: "#a7f3d0",
    300: "#6ee7b7",
    400: "#34d399",
    500: "#10b981",
    600: "#059669",
    700: "#047857",
    800: "#065f46",
    900: "#064e3b",
    950: "#022c22"
  },
  teal: {
    50: "#f0fdfa",
    100: "#ccfbf1",
    200: "#99f6e4",
    300: "#5eead4",
    400: "#2dd4bf",
    500: "#14b8a6",
    600: "#0d9488",
    700: "#0f766e",
    800: "#115e59",
    900: "#134e4a",
    950: "#042f2e"
  },
  cyan: {
    50: "#ecfeff",
    100: "#cffafe",
    200: "#a5f3fc",
    300: "#67e8f9",
    400: "#22d3ee",
    500: "#06b6d4",
    600: "#0891b2",
    700: "#0e7490",
    800: "#155e75",
    900: "#164e63",
    950: "#083344"
  },
  sky: {
    50: "#f0f9ff",
    100: "#e0f2fe",
    200: "#bae6fd",
    300: "#7dd3fc",
    400: "#38bdf8",
    500: "#0ea5e9",
    600: "#0284c7",
    700: "#0369a1",
    800: "#075985",
    900: "#0c4a6e",
    950: "#082f49"
  },
  blue: {
    50: "#eff6ff",
    100: "#dbeafe",
    200: "#bfdbfe",
    300: "#93c5fd",
    400: "#60a5fa",
    500: "#3b82f6",
    600: "#2563eb",
    700: "#1d4ed8",
    800: "#1e40af",
    900: "#1e3a8a",
    950: "#172554"
  },
  indigo: {
    50: "#eef2ff",
    100: "#e0e7ff",
    200: "#c7d2fe",
    300: "#a5b4fc",
    400: "#818cf8",
    500: "#6366f1",
    600: "#4f46e5",
    700: "#4338ca",
    800: "#3730a3",
    900: "#312e81",
    950: "#1e1b4b"
  },
  violet: {
    50: "#f5f3ff",
    100: "#ede9fe",
    200: "#ddd6fe",
    300: "#c4b5fd",
    400: "#a78bfa",
    500: "#8b5cf6",
    600: "#7c3aed",
    700: "#6d28d9",
    800: "#5b21b6",
    900: "#4c1d95",
    950: "#2e1065"
  },
  purple: {
    50: "#faf5ff",
    100: "#f3e8ff",
    200: "#e9d5ff",
    300: "#d8b4fe",
    400: "#c084fc",
    500: "#a855f7",
    600: "#9333ea",
    700: "#7e22ce",
    800: "#6b21a8",
    900: "#581c87",
    950: "#3b0764"
  },
  fuchsia: {
    50: "#fdf4ff",
    100: "#fae8ff",
    200: "#f5d0fe",
    300: "#f0abfc",
    400: "#e879f9",
    500: "#d946ef",
    600: "#c026d3",
    700: "#a21caf",
    800: "#86198f",
    900: "#701a75",
    950: "#4a044e"
  },
  pink: {
    50: "#fdf2f8",
    100: "#fce7f3",
    200: "#fbcfe8",
    300: "#f9a8d4",
    400: "#f472b6",
    500: "#ec4899",
    600: "#db2777",
    700: "#be185d",
    800: "#9d174d",
    900: "#831843",
    950: "#500724"
  },
  rose: {
    50: "#fff1f2",
    100: "#ffe4e6",
    200: "#fecdd3",
    300: "#fda4af",
    400: "#fb7185",
    500: "#f43f5e",
    600: "#e11d48",
    700: "#be123c",
    800: "#9f1239",
    900: "#881337",
    950: "#4c0519"
  }
};
Ia.reduce(
  (t, { color: e, primary: n, secondary: r }) => ({
    ...t,
    [e]: {
      primary: oi[e][n],
      secondary: oi[e][r]
    }
  }),
  {}
);
function Na(t) {
  let e, n = t[0], r = 1;
  for (; r < t.length; ) {
    const i = t[r], o = t[r + 1];
    if (r += 2, (i === "optionalAccess" || i === "optionalCall") && n == null)
      return;
    i === "access" || i === "optionalAccess" ? (e = n, n = o(n)) : (i === "call" || i === "optionalCall") && (n = o((...a) => n.call(e, ...a)), e = void 0);
  }
  return n;
}
class sn extends Error {
  constructor(e) {
    super(e), this.name = "ShareError";
  }
}
async function Oa(t, e) {
  if (window.__gradio_space__ == null)
    throw new sn("Must be on Spaces to share.");
  let n, r, i;
  if (e === "url") {
    const l = await fetch(t);
    n = await l.blob(), r = l.headers.get("content-type") || "", i = l.headers.get("content-disposition") || "";
  } else
    n = La(t), r = t.split(";")[0].split(":")[1], i = "file" + r.split("/")[1];
  const o = new File([n], i, { type: r }), a = await fetch("https://huggingface.co/uploads", {
    method: "POST",
    body: o,
    headers: {
      "Content-Type": o.type,
      "X-Requested-With": "XMLHttpRequest"
    }
  });
  if (!a.ok) {
    if (Na([a, "access", (l) => l.headers, "access", (l) => l.get, "call", (l) => l("content-type"), "optionalAccess", (l) => l.includes, "call", (l) => l("application/json")])) {
      const l = await a.json();
      throw new sn(`Upload failed: ${l.error}`);
    }
    throw new sn("Upload failed.");
  }
  return await a.text();
}
function La(t) {
  for (var e = t.split(","), n = e[0].match(/:(.*?);/)[1], r = atob(e[1]), i = r.length, o = new Uint8Array(i); i--; )
    o[i] = r.charCodeAt(i);
  return new Blob([o], { type: n });
}
const {
  SvelteComponent: Ra,
  assign: Ma,
  create_slot: Da,
  detach: Ua,
  element: xa,
  get_all_dirty_from_scope: Ga,
  get_slot_changes: Fa,
  get_spread_update: ja,
  init: qa,
  insert: za,
  safe_not_equal: Va,
  set_dynamic_element_data: ai,
  set_style: pe,
  toggle_class: Fe,
  transition_in: yo,
  transition_out: Eo,
  update_slot_base: Wa
} = window.__gradio__svelte__internal;
function Xa(t) {
  let e, n, r;
  const i = (
    /*#slots*/
    t[18].default
  ), o = Da(
    i,
    t,
    /*$$scope*/
    t[17],
    null
  );
  let a = [
    { "data-testid": (
      /*test_id*/
      t[7]
    ) },
    { id: (
      /*elem_id*/
      t[2]
    ) },
    {
      class: n = "block " + /*elem_classes*/
      t[3].join(" ") + " svelte-1t38q2d"
    }
  ], s = {};
  for (let l = 0; l < a.length; l += 1)
    s = Ma(s, a[l]);
  return {
    c() {
      e = xa(
        /*tag*/
        t[14]
      ), o && o.c(), ai(
        /*tag*/
        t[14]
      )(e, s), Fe(
        e,
        "hidden",
        /*visible*/
        t[10] === !1
      ), Fe(
        e,
        "padded",
        /*padding*/
        t[6]
      ), Fe(
        e,
        "border_focus",
        /*border_mode*/
        t[5] === "focus"
      ), Fe(e, "hide-container", !/*explicit_call*/
      t[8] && !/*container*/
      t[9]), pe(
        e,
        "height",
        /*get_dimension*/
        t[15](
          /*height*/
          t[0]
        )
      ), pe(e, "width", typeof /*width*/
      t[1] == "number" ? `calc(min(${/*width*/
      t[1]}px, 100%))` : (
        /*get_dimension*/
        t[15](
          /*width*/
          t[1]
        )
      )), pe(
        e,
        "border-style",
        /*variant*/
        t[4]
      ), pe(
        e,
        "overflow",
        /*allow_overflow*/
        t[11] ? "visible" : "hidden"
      ), pe(
        e,
        "flex-grow",
        /*scale*/
        t[12]
      ), pe(e, "min-width", `calc(min(${/*min_width*/
      t[13]}px, 100%))`), pe(e, "border-width", "var(--block-border-width)");
    },
    m(l, c) {
      za(l, e, c), o && o.m(e, null), r = !0;
    },
    p(l, c) {
      o && o.p && (!r || c & /*$$scope*/
      131072) && Wa(
        o,
        i,
        l,
        /*$$scope*/
        l[17],
        r ? Fa(
          i,
          /*$$scope*/
          l[17],
          c,
          null
        ) : Ga(
          /*$$scope*/
          l[17]
        ),
        null
      ), ai(
        /*tag*/
        l[14]
      )(e, s = ja(a, [
        (!r || c & /*test_id*/
        128) && { "data-testid": (
          /*test_id*/
          l[7]
        ) },
        (!r || c & /*elem_id*/
        4) && { id: (
          /*elem_id*/
          l[2]
        ) },
        (!r || c & /*elem_classes*/
        8 && n !== (n = "block " + /*elem_classes*/
        l[3].join(" ") + " svelte-1t38q2d")) && { class: n }
      ])), Fe(
        e,
        "hidden",
        /*visible*/
        l[10] === !1
      ), Fe(
        e,
        "padded",
        /*padding*/
        l[6]
      ), Fe(
        e,
        "border_focus",
        /*border_mode*/
        l[5] === "focus"
      ), Fe(e, "hide-container", !/*explicit_call*/
      l[8] && !/*container*/
      l[9]), c & /*height*/
      1 && pe(
        e,
        "height",
        /*get_dimension*/
        l[15](
          /*height*/
          l[0]
        )
      ), c & /*width*/
      2 && pe(e, "width", typeof /*width*/
      l[1] == "number" ? `calc(min(${/*width*/
      l[1]}px, 100%))` : (
        /*get_dimension*/
        l[15](
          /*width*/
          l[1]
        )
      )), c & /*variant*/
      16 && pe(
        e,
        "border-style",
        /*variant*/
        l[4]
      ), c & /*allow_overflow*/
      2048 && pe(
        e,
        "overflow",
        /*allow_overflow*/
        l[11] ? "visible" : "hidden"
      ), c & /*scale*/
      4096 && pe(
        e,
        "flex-grow",
        /*scale*/
        l[12]
      ), c & /*min_width*/
      8192 && pe(e, "min-width", `calc(min(${/*min_width*/
      l[13]}px, 100%))`);
    },
    i(l) {
      r || (yo(o, l), r = !0);
    },
    o(l) {
      Eo(o, l), r = !1;
    },
    d(l) {
      l && Ua(e), o && o.d(l);
    }
  };
}
function Za(t) {
  let e, n = (
    /*tag*/
    t[14] && Xa(t)
  );
  return {
    c() {
      n && n.c();
    },
    m(r, i) {
      n && n.m(r, i), e = !0;
    },
    p(r, [i]) {
      /*tag*/
      r[14] && n.p(r, i);
    },
    i(r) {
      e || (yo(n, r), e = !0);
    },
    o(r) {
      Eo(n, r), e = !1;
    },
    d(r) {
      n && n.d(r);
    }
  };
}
function Ja(t, e, n) {
  let { $$slots: r = {}, $$scope: i } = e, { height: o = void 0 } = e, { width: a = void 0 } = e, { elem_id: s = "" } = e, { elem_classes: l = [] } = e, { variant: c = "solid" } = e, { border_mode: u = "base" } = e, { padding: f = !0 } = e, { type: h = "normal" } = e, { test_id: _ = void 0 } = e, { explicit_call: g = !1 } = e, { container: m = !0 } = e, { visible: v = !0 } = e, { allow_overflow: b = !0 } = e, { scale: y = null } = e, { min_width: C = 0 } = e, H = h === "fieldset" ? "fieldset" : "div";
  const I = (p) => {
    if (p !== void 0) {
      if (typeof p == "number")
        return p + "px";
      if (typeof p == "string")
        return p;
    }
  };
  return t.$$set = (p) => {
    "height" in p && n(0, o = p.height), "width" in p && n(1, a = p.width), "elem_id" in p && n(2, s = p.elem_id), "elem_classes" in p && n(3, l = p.elem_classes), "variant" in p && n(4, c = p.variant), "border_mode" in p && n(5, u = p.border_mode), "padding" in p && n(6, f = p.padding), "type" in p && n(16, h = p.type), "test_id" in p && n(7, _ = p.test_id), "explicit_call" in p && n(8, g = p.explicit_call), "container" in p && n(9, m = p.container), "visible" in p && n(10, v = p.visible), "allow_overflow" in p && n(11, b = p.allow_overflow), "scale" in p && n(12, y = p.scale), "min_width" in p && n(13, C = p.min_width), "$$scope" in p && n(17, i = p.$$scope);
  }, [
    o,
    a,
    s,
    l,
    c,
    u,
    f,
    _,
    g,
    m,
    v,
    b,
    y,
    C,
    H,
    I,
    h,
    i,
    r
  ];
}
class So extends Ra {
  constructor(e) {
    super(), qa(this, e, Ja, Za, Va, {
      height: 0,
      width: 1,
      elem_id: 2,
      elem_classes: 3,
      variant: 4,
      border_mode: 5,
      padding: 6,
      type: 16,
      test_id: 7,
      explicit_call: 8,
      container: 9,
      visible: 10,
      allow_overflow: 11,
      scale: 12,
      min_width: 13
    });
  }
}
const {
  SvelteComponent: Qa,
  append: qn,
  attr: Yt,
  create_component: Ya,
  destroy_component: Ka,
  detach: $a,
  element: li,
  init: el,
  insert: tl,
  mount_component: nl,
  safe_not_equal: rl,
  set_data: il,
  space: ol,
  text: al,
  toggle_class: je,
  transition_in: ll,
  transition_out: sl
} = window.__gradio__svelte__internal;
function ul(t) {
  let e, n, r, i, o, a;
  return r = new /*Icon*/
  t[1]({}), {
    c() {
      e = li("label"), n = li("span"), Ya(r.$$.fragment), i = ol(), o = al(
        /*label*/
        t[0]
      ), Yt(n, "class", "svelte-9gxdi0"), Yt(e, "for", ""), Yt(e, "data-testid", "block-label"), Yt(e, "class", "svelte-9gxdi0"), je(e, "hide", !/*show_label*/
      t[2]), je(e, "sr-only", !/*show_label*/
      t[2]), je(
        e,
        "float",
        /*float*/
        t[4]
      ), je(
        e,
        "hide-label",
        /*disable*/
        t[3]
      );
    },
    m(s, l) {
      tl(s, e, l), qn(e, n), nl(r, n, null), qn(e, i), qn(e, o), a = !0;
    },
    p(s, [l]) {
      (!a || l & /*label*/
      1) && il(
        o,
        /*label*/
        s[0]
      ), (!a || l & /*show_label*/
      4) && je(e, "hide", !/*show_label*/
      s[2]), (!a || l & /*show_label*/
      4) && je(e, "sr-only", !/*show_label*/
      s[2]), (!a || l & /*float*/
      16) && je(
        e,
        "float",
        /*float*/
        s[4]
      ), (!a || l & /*disable*/
      8) && je(
        e,
        "hide-label",
        /*disable*/
        s[3]
      );
    },
    i(s) {
      a || (ll(r.$$.fragment, s), a = !0);
    },
    o(s) {
      sl(r.$$.fragment, s), a = !1;
    },
    d(s) {
      s && $a(e), Ka(r);
    }
  };
}
function cl(t, e, n) {
  let { label: r = null } = e, { Icon: i } = e, { show_label: o = !0 } = e, { disable: a = !1 } = e, { float: s = !0 } = e;
  return t.$$set = (l) => {
    "label" in l && n(0, r = l.label), "Icon" in l && n(1, i = l.Icon), "show_label" in l && n(2, o = l.show_label), "disable" in l && n(3, a = l.disable), "float" in l && n(4, s = l.float);
  }, [r, i, o, a, s];
}
class Wr extends Qa {
  constructor(e) {
    super(), el(this, e, cl, ul, rl, {
      label: 0,
      Icon: 1,
      show_label: 2,
      disable: 3,
      float: 4
    });
  }
}
const {
  SvelteComponent: fl,
  append: Sr,
  attr: Ue,
  bubble: hl,
  create_component: _l,
  destroy_component: dl,
  detach: ko,
  element: kr,
  init: ml,
  insert: To,
  listen: gl,
  mount_component: pl,
  safe_not_equal: bl,
  set_data: vl,
  set_style: Kt,
  space: wl,
  text: yl,
  toggle_class: Ae,
  transition_in: El,
  transition_out: Sl
} = window.__gradio__svelte__internal;
function si(t) {
  let e, n;
  return {
    c() {
      e = kr("span"), n = yl(
        /*label*/
        t[1]
      ), Ue(e, "class", "svelte-lpi64a");
    },
    m(r, i) {
      To(r, e, i), Sr(e, n);
    },
    p(r, i) {
      i & /*label*/
      2 && vl(
        n,
        /*label*/
        r[1]
      );
    },
    d(r) {
      r && ko(e);
    }
  };
}
function kl(t) {
  let e, n, r, i, o, a, s, l = (
    /*show_label*/
    t[2] && si(t)
  );
  return i = new /*Icon*/
  t[0]({}), {
    c() {
      e = kr("button"), l && l.c(), n = wl(), r = kr("div"), _l(i.$$.fragment), Ue(r, "class", "svelte-lpi64a"), Ae(
        r,
        "small",
        /*size*/
        t[4] === "small"
      ), Ae(
        r,
        "large",
        /*size*/
        t[4] === "large"
      ), e.disabled = /*disabled*/
      t[7], Ue(
        e,
        "aria-label",
        /*label*/
        t[1]
      ), Ue(
        e,
        "aria-haspopup",
        /*hasPopup*/
        t[8]
      ), Ue(
        e,
        "title",
        /*label*/
        t[1]
      ), Ue(e, "class", "svelte-lpi64a"), Ae(
        e,
        "pending",
        /*pending*/
        t[3]
      ), Ae(
        e,
        "padded",
        /*padded*/
        t[5]
      ), Ae(
        e,
        "highlight",
        /*highlight*/
        t[6]
      ), Ae(
        e,
        "transparent",
        /*transparent*/
        t[9]
      ), Kt(e, "color", !/*disabled*/
      t[7] && /*_color*/
      t[11] ? (
        /*_color*/
        t[11]
      ) : "var(--block-label-text-color)"), Kt(e, "--bg-color", /*disabled*/
      t[7] ? "auto" : (
        /*background*/
        t[10]
      ));
    },
    m(c, u) {
      To(c, e, u), l && l.m(e, null), Sr(e, n), Sr(e, r), pl(i, r, null), o = !0, a || (s = gl(
        e,
        "click",
        /*click_handler*/
        t[13]
      ), a = !0);
    },
    p(c, [u]) {
      /*show_label*/
      c[2] ? l ? l.p(c, u) : (l = si(c), l.c(), l.m(e, n)) : l && (l.d(1), l = null), (!o || u & /*size*/
      16) && Ae(
        r,
        "small",
        /*size*/
        c[4] === "small"
      ), (!o || u & /*size*/
      16) && Ae(
        r,
        "large",
        /*size*/
        c[4] === "large"
      ), (!o || u & /*disabled*/
      128) && (e.disabled = /*disabled*/
      c[7]), (!o || u & /*label*/
      2) && Ue(
        e,
        "aria-label",
        /*label*/
        c[1]
      ), (!o || u & /*hasPopup*/
      256) && Ue(
        e,
        "aria-haspopup",
        /*hasPopup*/
        c[8]
      ), (!o || u & /*label*/
      2) && Ue(
        e,
        "title",
        /*label*/
        c[1]
      ), (!o || u & /*pending*/
      8) && Ae(
        e,
        "pending",
        /*pending*/
        c[3]
      ), (!o || u & /*padded*/
      32) && Ae(
        e,
        "padded",
        /*padded*/
        c[5]
      ), (!o || u & /*highlight*/
      64) && Ae(
        e,
        "highlight",
        /*highlight*/
        c[6]
      ), (!o || u & /*transparent*/
      512) && Ae(
        e,
        "transparent",
        /*transparent*/
        c[9]
      ), u & /*disabled, _color*/
      2176 && Kt(e, "color", !/*disabled*/
      c[7] && /*_color*/
      c[11] ? (
        /*_color*/
        c[11]
      ) : "var(--block-label-text-color)"), u & /*disabled, background*/
      1152 && Kt(e, "--bg-color", /*disabled*/
      c[7] ? "auto" : (
        /*background*/
        c[10]
      ));
    },
    i(c) {
      o || (El(i.$$.fragment, c), o = !0);
    },
    o(c) {
      Sl(i.$$.fragment, c), o = !1;
    },
    d(c) {
      c && ko(e), l && l.d(), dl(i), a = !1, s();
    }
  };
}
function Tl(t, e, n) {
  let r, { Icon: i } = e, { label: o = "" } = e, { show_label: a = !1 } = e, { pending: s = !1 } = e, { size: l = "small" } = e, { padded: c = !0 } = e, { highlight: u = !1 } = e, { disabled: f = !1 } = e, { hasPopup: h = !1 } = e, { color: _ = "var(--block-label-text-color)" } = e, { transparent: g = !1 } = e, { background: m = "var(--background-fill-primary)" } = e;
  function v(b) {
    hl.call(this, t, b);
  }
  return t.$$set = (b) => {
    "Icon" in b && n(0, i = b.Icon), "label" in b && n(1, o = b.label), "show_label" in b && n(2, a = b.show_label), "pending" in b && n(3, s = b.pending), "size" in b && n(4, l = b.size), "padded" in b && n(5, c = b.padded), "highlight" in b && n(6, u = b.highlight), "disabled" in b && n(7, f = b.disabled), "hasPopup" in b && n(8, h = b.hasPopup), "color" in b && n(12, _ = b.color), "transparent" in b && n(9, g = b.transparent), "background" in b && n(10, m = b.background);
  }, t.$$.update = () => {
    t.$$.dirty & /*highlight, color*/
    4160 && n(11, r = u ? "var(--color-accent)" : _);
  }, [
    i,
    o,
    a,
    s,
    l,
    c,
    u,
    f,
    h,
    g,
    m,
    r,
    _,
    v
  ];
}
class Xr extends fl {
  constructor(e) {
    super(), ml(this, e, Tl, kl, bl, {
      Icon: 0,
      label: 1,
      show_label: 2,
      pending: 3,
      size: 4,
      padded: 5,
      highlight: 6,
      disabled: 7,
      hasPopup: 8,
      color: 12,
      transparent: 9,
      background: 10
    });
  }
}
const {
  SvelteComponent: Al,
  append: Bl,
  attr: zn,
  binding_callbacks: Cl,
  create_slot: Hl,
  detach: Pl,
  element: ui,
  get_all_dirty_from_scope: Il,
  get_slot_changes: Nl,
  init: Ol,
  insert: Ll,
  safe_not_equal: Rl,
  toggle_class: qe,
  transition_in: Ml,
  transition_out: Dl,
  update_slot_base: Ul
} = window.__gradio__svelte__internal;
function xl(t) {
  let e, n, r;
  const i = (
    /*#slots*/
    t[5].default
  ), o = Hl(
    i,
    t,
    /*$$scope*/
    t[4],
    null
  );
  return {
    c() {
      e = ui("div"), n = ui("div"), o && o.c(), zn(n, "class", "icon svelte-3w3rth"), zn(e, "class", "empty svelte-3w3rth"), zn(e, "aria-label", "Empty value"), qe(
        e,
        "small",
        /*size*/
        t[0] === "small"
      ), qe(
        e,
        "large",
        /*size*/
        t[0] === "large"
      ), qe(
        e,
        "unpadded_box",
        /*unpadded_box*/
        t[1]
      ), qe(
        e,
        "small_parent",
        /*parent_height*/
        t[3]
      );
    },
    m(a, s) {
      Ll(a, e, s), Bl(e, n), o && o.m(n, null), t[6](e), r = !0;
    },
    p(a, [s]) {
      o && o.p && (!r || s & /*$$scope*/
      16) && Ul(
        o,
        i,
        a,
        /*$$scope*/
        a[4],
        r ? Nl(
          i,
          /*$$scope*/
          a[4],
          s,
          null
        ) : Il(
          /*$$scope*/
          a[4]
        ),
        null
      ), (!r || s & /*size*/
      1) && qe(
        e,
        "small",
        /*size*/
        a[0] === "small"
      ), (!r || s & /*size*/
      1) && qe(
        e,
        "large",
        /*size*/
        a[0] === "large"
      ), (!r || s & /*unpadded_box*/
      2) && qe(
        e,
        "unpadded_box",
        /*unpadded_box*/
        a[1]
      ), (!r || s & /*parent_height*/
      8) && qe(
        e,
        "small_parent",
        /*parent_height*/
        a[3]
      );
    },
    i(a) {
      r || (Ml(o, a), r = !0);
    },
    o(a) {
      Dl(o, a), r = !1;
    },
    d(a) {
      a && Pl(e), o && o.d(a), t[6](null);
    }
  };
}
function Gl(t) {
  let e, n = t[0], r = 1;
  for (; r < t.length; ) {
    const i = t[r], o = t[r + 1];
    if (r += 2, (i === "optionalAccess" || i === "optionalCall") && n == null)
      return;
    i === "access" || i === "optionalAccess" ? (e = n, n = o(n)) : (i === "call" || i === "optionalCall") && (n = o((...a) => n.call(e, ...a)), e = void 0);
  }
  return n;
}
function Fl(t, e, n) {
  let r, { $$slots: i = {}, $$scope: o } = e, { size: a = "small" } = e, { unpadded_box: s = !1 } = e, l;
  function c(f) {
    if (!f)
      return !1;
    const { height: h } = f.getBoundingClientRect(), { height: _ } = Gl([
      f,
      "access",
      (g) => g.parentElement,
      "optionalAccess",
      (g) => g.getBoundingClientRect,
      "call",
      (g) => g()
    ]) || { height: h };
    return h > _ + 2;
  }
  function u(f) {
    Cl[f ? "unshift" : "push"](() => {
      l = f, n(2, l);
    });
  }
  return t.$$set = (f) => {
    "size" in f && n(0, a = f.size), "unpadded_box" in f && n(1, s = f.unpadded_box), "$$scope" in f && n(4, o = f.$$scope);
  }, t.$$.update = () => {
    t.$$.dirty & /*el*/
    4 && n(3, r = c(l));
  }, [a, s, l, r, o, i, u];
}
class jl extends Al {
  constructor(e) {
    super(), Ol(this, e, Fl, xl, Rl, { size: 0, unpadded_box: 1 });
  }
}
const {
  SvelteComponent: ql,
  append: ci,
  attr: he,
  detach: zl,
  init: Vl,
  insert: Wl,
  noop: Vn,
  safe_not_equal: Xl,
  svg_element: Wn
} = window.__gradio__svelte__internal;
function Zl(t) {
  let e, n, r;
  return {
    c() {
      e = Wn("svg"), n = Wn("path"), r = Wn("circle"), he(n, "d", "M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"), he(r, "cx", "12"), he(r, "cy", "13"), he(r, "r", "4"), he(e, "xmlns", "http://www.w3.org/2000/svg"), he(e, "width", "100%"), he(e, "height", "100%"), he(e, "viewBox", "0 0 24 24"), he(e, "fill", "none"), he(e, "stroke", "currentColor"), he(e, "stroke-width", "1.5"), he(e, "stroke-linecap", "round"), he(e, "stroke-linejoin", "round"), he(e, "class", "feather feather-camera");
    },
    m(i, o) {
      Wl(i, e, o), ci(e, n), ci(e, r);
    },
    p: Vn,
    i: Vn,
    o: Vn,
    d(i) {
      i && zl(e);
    }
  };
}
class Jl extends ql {
  constructor(e) {
    super(), Vl(this, e, null, Zl, Xl, {});
  }
}
const {
  SvelteComponent: Ql,
  append: Yl,
  attr: He,
  detach: Kl,
  init: $l,
  insert: es,
  noop: Xn,
  safe_not_equal: ts,
  svg_element: fi
} = window.__gradio__svelte__internal;
function ns(t) {
  let e, n;
  return {
    c() {
      e = fi("svg"), n = fi("circle"), He(n, "cx", "12"), He(n, "cy", "12"), He(n, "r", "10"), He(e, "xmlns", "http://www.w3.org/2000/svg"), He(e, "width", "100%"), He(e, "height", "100%"), He(e, "viewBox", "0 0 24 24"), He(e, "stroke-width", "1.5"), He(e, "stroke-linecap", "round"), He(e, "stroke-linejoin", "round"), He(e, "class", "feather feather-circle");
    },
    m(r, i) {
      es(r, e, i), Yl(e, n);
    },
    p: Xn,
    i: Xn,
    o: Xn,
    d(r) {
      r && Kl(e);
    }
  };
}
class rs extends Ql {
  constructor(e) {
    super(), $l(this, e, null, ns, ts, {});
  }
}
const {
  SvelteComponent: is,
  append: Zn,
  attr: Pe,
  detach: os,
  init: as,
  insert: ls,
  noop: Jn,
  safe_not_equal: ss,
  set_style: Oe,
  svg_element: $t
} = window.__gradio__svelte__internal;
function us(t) {
  let e, n, r, i;
  return {
    c() {
      e = $t("svg"), n = $t("g"), r = $t("path"), i = $t("path"), Pe(r, "d", "M18,6L6.087,17.913"), Oe(r, "fill", "none"), Oe(r, "fill-rule", "nonzero"), Oe(r, "stroke-width", "2px"), Pe(n, "transform", "matrix(1.14096,-0.140958,-0.140958,1.14096,-0.0559523,0.0559523)"), Pe(i, "d", "M4.364,4.364L19.636,19.636"), Oe(i, "fill", "none"), Oe(i, "fill-rule", "nonzero"), Oe(i, "stroke-width", "2px"), Pe(e, "width", "100%"), Pe(e, "height", "100%"), Pe(e, "viewBox", "0 0 24 24"), Pe(e, "version", "1.1"), Pe(e, "xmlns", "http://www.w3.org/2000/svg"), Pe(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), Pe(e, "xml:space", "preserve"), Pe(e, "stroke", "currentColor"), Oe(e, "fill-rule", "evenodd"), Oe(e, "clip-rule", "evenodd"), Oe(e, "stroke-linecap", "round"), Oe(e, "stroke-linejoin", "round");
    },
    m(o, a) {
      ls(o, e, a), Zn(e, n), Zn(n, r), Zn(e, i);
    },
    p: Jn,
    i: Jn,
    o: Jn,
    d(o) {
      o && os(e);
    }
  };
}
class cs extends is {
  constructor(e) {
    super(), as(this, e, null, us, ss, {});
  }
}
const {
  SvelteComponent: fs,
  append: hs,
  attr: It,
  detach: _s,
  init: ds,
  insert: ms,
  noop: Qn,
  safe_not_equal: gs,
  svg_element: hi
} = window.__gradio__svelte__internal;
function ps(t) {
  let e, n;
  return {
    c() {
      e = hi("svg"), n = hi("path"), It(n, "d", "M23,20a5,5,0,0,0-3.89,1.89L11.8,17.32a4.46,4.46,0,0,0,0-2.64l7.31-4.57A5,5,0,1,0,18,7a4.79,4.79,0,0,0,.2,1.32l-7.31,4.57a5,5,0,1,0,0,6.22l7.31,4.57A4.79,4.79,0,0,0,18,25a5,5,0,1,0,5-5ZM23,4a3,3,0,1,1-3,3A3,3,0,0,1,23,4ZM7,19a3,3,0,1,1,3-3A3,3,0,0,1,7,19Zm16,9a3,3,0,1,1,3-3A3,3,0,0,1,23,28Z"), It(n, "fill", "currentColor"), It(e, "id", "icon"), It(e, "xmlns", "http://www.w3.org/2000/svg"), It(e, "viewBox", "0 0 32 32");
    },
    m(r, i) {
      ms(r, e, i), hs(e, n);
    },
    p: Qn,
    i: Qn,
    o: Qn,
    d(r) {
      r && _s(e);
    }
  };
}
class bs extends fs {
  constructor(e) {
    super(), ds(this, e, null, ps, gs, {});
  }
}
const {
  SvelteComponent: vs,
  append: ws,
  attr: ft,
  detach: ys,
  init: Es,
  insert: Ss,
  noop: Yn,
  safe_not_equal: ks,
  svg_element: _i
} = window.__gradio__svelte__internal;
function Ts(t) {
  let e, n;
  return {
    c() {
      e = _i("svg"), n = _i("path"), ft(n, "fill", "currentColor"), ft(n, "d", "M26 24v4H6v-4H4v4a2 2 0 0 0 2 2h20a2 2 0 0 0 2-2v-4zm0-10l-1.41-1.41L17 20.17V2h-2v18.17l-7.59-7.58L6 14l10 10l10-10z"), ft(e, "xmlns", "http://www.w3.org/2000/svg"), ft(e, "width", "100%"), ft(e, "height", "100%"), ft(e, "viewBox", "0 0 32 32");
    },
    m(r, i) {
      Ss(r, e, i), ws(e, n);
    },
    p: Yn,
    i: Yn,
    o: Yn,
    d(r) {
      r && ys(e);
    }
  };
}
class As extends vs {
  constructor(e) {
    super(), Es(this, e, null, Ts, ks, {});
  }
}
const {
  SvelteComponent: Bs,
  append: Cs,
  attr: ht,
  detach: Hs,
  init: Ps,
  insert: Is,
  noop: Kn,
  safe_not_equal: Ns,
  svg_element: di
} = window.__gradio__svelte__internal;
function Os(t) {
  let e, n;
  return {
    c() {
      e = di("svg"), n = di("path"), ht(n, "d", "M5 8l4 4 4-4z"), ht(e, "class", "dropdown-arrow svelte-145leq6"), ht(e, "xmlns", "http://www.w3.org/2000/svg"), ht(e, "width", "100%"), ht(e, "height", "100%"), ht(e, "viewBox", "0 0 18 18");
    },
    m(r, i) {
      Is(r, e, i), Cs(e, n);
    },
    p: Kn,
    i: Kn,
    o: Kn,
    d(r) {
      r && Hs(e);
    }
  };
}
class Ao extends Bs {
  constructor(e) {
    super(), Ps(this, e, null, Os, Ns, {});
  }
}
const {
  SvelteComponent: Ls,
  append: $n,
  attr: J,
  detach: Rs,
  init: Ms,
  insert: Ds,
  noop: er,
  safe_not_equal: Us,
  svg_element: en
} = window.__gradio__svelte__internal;
function xs(t) {
  let e, n, r, i;
  return {
    c() {
      e = en("svg"), n = en("rect"), r = en("circle"), i = en("polyline"), J(n, "x", "3"), J(n, "y", "3"), J(n, "width", "18"), J(n, "height", "18"), J(n, "rx", "2"), J(n, "ry", "2"), J(r, "cx", "8.5"), J(r, "cy", "8.5"), J(r, "r", "1.5"), J(i, "points", "21 15 16 10 5 21"), J(e, "xmlns", "http://www.w3.org/2000/svg"), J(e, "width", "100%"), J(e, "height", "100%"), J(e, "viewBox", "0 0 24 24"), J(e, "fill", "none"), J(e, "stroke", "currentColor"), J(e, "stroke-width", "1.5"), J(e, "stroke-linecap", "round"), J(e, "stroke-linejoin", "round"), J(e, "class", "feather feather-image");
    },
    m(o, a) {
      Ds(o, e, a), $n(e, n), $n(e, r), $n(e, i);
    },
    p: er,
    i: er,
    o: er,
    d(o) {
      o && Rs(e);
    }
  };
}
let En = class extends Ls {
  constructor(e) {
    super(), Ms(this, e, null, xs, Us, {});
  }
};
const {
  SvelteComponent: Gs,
  append: Fs,
  attr: _t,
  detach: js,
  init: qs,
  insert: zs,
  noop: tr,
  safe_not_equal: Vs,
  svg_element: mi
} = window.__gradio__svelte__internal;
function Ws(t) {
  let e, n;
  return {
    c() {
      e = mi("svg"), n = mi("path"), _t(n, "fill", "currentColor"), _t(n, "d", "M13.75 2a2.25 2.25 0 0 1 2.236 2.002V4h1.764A2.25 2.25 0 0 1 20 6.25V11h-1.5V6.25a.75.75 0 0 0-.75-.75h-2.129c-.404.603-1.091 1-1.871 1h-3.5c-.78 0-1.467-.397-1.871-1H6.25a.75.75 0 0 0-.75.75v13.5c0 .414.336.75.75.75h4.78a3.99 3.99 0 0 0 .505 1.5H6.25A2.25 2.25 0 0 1 4 19.75V6.25A2.25 2.25 0 0 1 6.25 4h1.764a2.25 2.25 0 0 1 2.236-2h3.5Zm2.245 2.096L16 4.25c0-.052-.002-.103-.005-.154ZM13.75 3.5h-3.5a.75.75 0 0 0 0 1.5h3.5a.75.75 0 0 0 0-1.5ZM15 12a3 3 0 0 0-3 3v5c0 .556.151 1.077.415 1.524l3.494-3.494a2.25 2.25 0 0 1 3.182 0l3.494 3.494c.264-.447.415-.968.415-1.524v-5a3 3 0 0 0-3-3h-5Zm0 11a2.985 2.985 0 0 1-1.524-.415l3.494-3.494a.75.75 0 0 1 1.06 0l3.494 3.494A2.985 2.985 0 0 1 20 23h-5Zm5-7a1 1 0 1 1 0-2a1 1 0 0 1 0 2Z"), _t(e, "xmlns", "http://www.w3.org/2000/svg"), _t(e, "width", "100%"), _t(e, "height", "100%"), _t(e, "viewBox", "0 0 24 24");
    },
    m(r, i) {
      zs(r, e, i), Fs(e, n);
    },
    p: tr,
    i: tr,
    o: tr,
    d(r) {
      r && js(e);
    }
  };
}
class Xs extends Gs {
  constructor(e) {
    super(), qs(this, e, null, Ws, Vs, {});
  }
}
const {
  SvelteComponent: Zs,
  append: tn,
  attr: Q,
  detach: Js,
  init: Qs,
  insert: Ys,
  noop: nr,
  safe_not_equal: Ks,
  svg_element: Nt
} = window.__gradio__svelte__internal;
function $s(t) {
  let e, n, r, i, o;
  return {
    c() {
      e = Nt("svg"), n = Nt("path"), r = Nt("path"), i = Nt("line"), o = Nt("line"), Q(n, "d", "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"), Q(r, "d", "M19 10v2a7 7 0 0 1-14 0v-2"), Q(i, "x1", "12"), Q(i, "y1", "19"), Q(i, "x2", "12"), Q(i, "y2", "23"), Q(o, "x1", "8"), Q(o, "y1", "23"), Q(o, "x2", "16"), Q(o, "y2", "23"), 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", "2"), Q(e, "stroke-linecap", "round"), Q(e, "stroke-linejoin", "round"), Q(e, "class", "feather feather-mic");
    },
    m(a, s) {
      Ys(a, e, s), tn(e, n), tn(e, r), tn(e, i), tn(e, o);
    },
    p: nr,
    i: nr,
    o: nr,
    d(a) {
      a && Js(e);
    }
  };
}
class eu extends Zs {
  constructor(e) {
    super(), Qs(this, e, null, $s, Ks, {});
  }
}
const {
  SvelteComponent: tu,
  append: nu,
  attr: _e,
  detach: ru,
  init: iu,
  insert: ou,
  noop: rr,
  safe_not_equal: au,
  svg_element: gi
} = window.__gradio__svelte__internal;
function lu(t) {
  let e, n;
  return {
    c() {
      e = gi("svg"), n = gi("rect"), _e(n, "x", "3"), _e(n, "y", "3"), _e(n, "width", "18"), _e(n, "height", "18"), _e(n, "rx", "2"), _e(n, "ry", "2"), _e(e, "xmlns", "http://www.w3.org/2000/svg"), _e(e, "width", "100%"), _e(e, "height", "100%"), _e(e, "viewBox", "0 0 24 24"), _e(e, "stroke-width", "1.5"), _e(e, "stroke-linecap", "round"), _e(e, "stroke-linejoin", "round"), _e(e, "class", "feather feather-square");
    },
    m(r, i) {
      ou(r, e, i), nu(e, n);
    },
    p: rr,
    i: rr,
    o: rr,
    d(r) {
      r && ru(e);
    }
  };
}
class su extends tu {
  constructor(e) {
    super(), iu(this, e, null, lu, au, {});
  }
}
const {
  SvelteComponent: uu,
  append: ir,
  attr: ie,
  detach: cu,
  init: fu,
  insert: hu,
  noop: or,
  safe_not_equal: _u,
  svg_element: nn
} = window.__gradio__svelte__internal;
function du(t) {
  let e, n, r, i;
  return {
    c() {
      e = nn("svg"), n = nn("path"), r = nn("polyline"), i = nn("line"), ie(n, "d", "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"), ie(r, "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) {
      hu(o, e, a), ir(e, n), ir(e, r), ir(e, i);
    },
    p: or,
    i: or,
    o: or,
    d(o) {
      o && cu(e);
    }
  };
}
let mu = class extends uu {
  constructor(e) {
    super(), fu(this, e, null, du, _u, {});
  }
};
const {
  SvelteComponent: gu,
  append: pi,
  attr: ze,
  detach: pu,
  init: bu,
  insert: vu,
  noop: ar,
  safe_not_equal: wu,
  svg_element: lr
} = window.__gradio__svelte__internal;
function yu(t) {
  let e, n, r;
  return {
    c() {
      e = lr("svg"), n = lr("path"), r = lr("path"), ze(n, "fill", "currentColor"), ze(n, "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"), ze(r, "fill", "currentColor"), ze(r, "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"), ze(e, "xmlns", "http://www.w3.org/2000/svg"), ze(e, "width", "100%"), ze(e, "height", "100%"), ze(e, "viewBox", "0 0 24 24");
    },
    m(i, o) {
      vu(i, e, o), pi(e, n), pi(e, r);
    },
    p: ar,
    i: ar,
    o: ar,
    d(i) {
      i && pu(e);
    }
  };
}
let Eu = class extends gu {
  constructor(e) {
    super(), bu(this, e, null, yu, wu, {});
  }
};
const {
  SvelteComponent: Su,
  create_component: ku,
  destroy_component: Tu,
  init: Au,
  mount_component: Bu,
  safe_not_equal: Cu,
  transition_in: Hu,
  transition_out: Pu
} = window.__gradio__svelte__internal, { createEventDispatcher: Iu } = window.__gradio__svelte__internal;
function Nu(t) {
  let e, n;
  return e = new Xr({
    props: {
      Icon: bs,
      label: (
        /*i18n*/
        t[2]("common.share")
      ),
      pending: (
        /*pending*/
        t[3]
      )
    }
  }), e.$on(
    "click",
    /*click_handler*/
    t[5]
  ), {
    c() {
      ku(e.$$.fragment);
    },
    m(r, i) {
      Bu(e, r, i), n = !0;
    },
    p(r, [i]) {
      const o = {};
      i & /*i18n*/
      4 && (o.label = /*i18n*/
      r[2]("common.share")), i & /*pending*/
      8 && (o.pending = /*pending*/
      r[3]), e.$set(o);
    },
    i(r) {
      n || (Hu(e.$$.fragment, r), n = !0);
    },
    o(r) {
      Pu(e.$$.fragment, r), n = !1;
    },
    d(r) {
      Tu(e, r);
    }
  };
}
function Ou(t, e, n) {
  const r = Iu();
  let { formatter: i } = e, { value: o } = e, { i18n: a } = e, s = !1;
  const l = async () => {
    try {
      n(3, s = !0);
      const c = await i(o);
      r("share", { description: c });
    } catch (c) {
      console.error(c);
      let u = c instanceof sn ? c.message : "Share failed.";
      r("error", u);
    } finally {
      n(3, s = !1);
    }
  };
  return t.$$set = (c) => {
    "formatter" in c && n(0, i = c.formatter), "value" in c && n(1, o = c.value), "i18n" in c && n(2, a = c.i18n);
  }, [i, o, a, s, r, l];
}
class Lu extends Su {
  constructor(e) {
    super(), Au(this, e, Ou, Nu, Cu, { formatter: 0, value: 1, i18n: 2 });
  }
}
const {
  SvelteComponent: Ru,
  append: sr,
  attr: Le,
  check_outros: Lt,
  create_component: Sn,
  destroy_component: kn,
  detach: At,
  element: zt,
  empty: Mu,
  group_outros: Rt,
  init: Du,
  insert: Bt,
  listen: Tn,
  mount_component: An,
  safe_not_equal: Uu,
  space: ur,
  toggle_class: Ze,
  transition_in: K,
  transition_out: de
} = window.__gradio__svelte__internal;
function bi(t) {
  let e, n = (
    /*sources*/
    t[1].includes("upload")
  ), r, i = (
    /*sources*/
    t[1].includes("microphone")
  ), o, a = (
    /*sources*/
    t[1].includes("webcam")
  ), s, l = (
    /*sources*/
    t[1].includes("clipboard")
  ), c, u = n && vi(t), f = i && wi(t), h = a && yi(t), _ = l && Ei(t);
  return {
    c() {
      e = zt("span"), u && u.c(), r = ur(), f && f.c(), o = ur(), h && h.c(), s = ur(), _ && _.c(), Le(e, "class", "source-selection svelte-1jp3vgd"), Le(e, "data-testid", "source-select");
    },
    m(g, m) {
      Bt(g, e, m), u && u.m(e, null), sr(e, r), f && f.m(e, null), sr(e, o), h && h.m(e, null), sr(e, s), _ && _.m(e, null), c = !0;
    },
    p(g, m) {
      m & /*sources*/
      2 && (n = /*sources*/
      g[1].includes("upload")), n ? u ? (u.p(g, m), m & /*sources*/
      2 && K(u, 1)) : (u = vi(g), u.c(), K(u, 1), u.m(e, r)) : u && (Rt(), de(u, 1, 1, () => {
        u = null;
      }), Lt()), m & /*sources*/
      2 && (i = /*sources*/
      g[1].includes("microphone")), i ? f ? (f.p(g, m), m & /*sources*/
      2 && K(f, 1)) : (f = wi(g), f.c(), K(f, 1), f.m(e, o)) : f && (Rt(), de(f, 1, 1, () => {
        f = null;
      }), Lt()), m & /*sources*/
      2 && (a = /*sources*/
      g[1].includes("webcam")), a ? h ? (h.p(g, m), m & /*sources*/
      2 && K(h, 1)) : (h = yi(g), h.c(), K(h, 1), h.m(e, s)) : h && (Rt(), de(h, 1, 1, () => {
        h = null;
      }), Lt()), m & /*sources*/
      2 && (l = /*sources*/
      g[1].includes("clipboard")), l ? _ ? (_.p(g, m), m & /*sources*/
      2 && K(_, 1)) : (_ = Ei(g), _.c(), K(_, 1), _.m(e, null)) : _ && (Rt(), de(_, 1, 1, () => {
        _ = null;
      }), Lt());
    },
    i(g) {
      c || (K(u), K(f), K(h), K(_), c = !0);
    },
    o(g) {
      de(u), de(f), de(h), de(_), c = !1;
    },
    d(g) {
      g && At(e), u && u.d(), f && f.d(), h && h.d(), _ && _.d();
    }
  };
}
function vi(t) {
  let e, n, r, i, o;
  return n = new mu({}), {
    c() {
      e = zt("button"), Sn(n.$$.fragment), Le(e, "class", "icon svelte-1jp3vgd"), Le(e, "aria-label", "Upload file"), Ze(
        e,
        "selected",
        /*active_source*/
        t[0] === "upload" || !/*active_source*/
        t[0]
      );
    },
    m(a, s) {
      Bt(a, e, s), An(n, e, null), r = !0, i || (o = Tn(
        e,
        "click",
        /*click_handler*/
        t[6]
      ), i = !0);
    },
    p(a, s) {
      (!r || s & /*active_source*/
      1) && Ze(
        e,
        "selected",
        /*active_source*/
        a[0] === "upload" || !/*active_source*/
        a[0]
      );
    },
    i(a) {
      r || (K(n.$$.fragment, a), r = !0);
    },
    o(a) {
      de(n.$$.fragment, a), r = !1;
    },
    d(a) {
      a && At(e), kn(n), i = !1, o();
    }
  };
}
function wi(t) {
  let e, n, r, i, o;
  return n = new eu({}), {
    c() {
      e = zt("button"), Sn(n.$$.fragment), Le(e, "class", "icon svelte-1jp3vgd"), Le(e, "aria-label", "Record audio"), Ze(
        e,
        "selected",
        /*active_source*/
        t[0] === "microphone"
      );
    },
    m(a, s) {
      Bt(a, e, s), An(n, e, null), r = !0, i || (o = Tn(
        e,
        "click",
        /*click_handler_1*/
        t[7]
      ), i = !0);
    },
    p(a, s) {
      (!r || s & /*active_source*/
      1) && Ze(
        e,
        "selected",
        /*active_source*/
        a[0] === "microphone"
      );
    },
    i(a) {
      r || (K(n.$$.fragment, a), r = !0);
    },
    o(a) {
      de(n.$$.fragment, a), r = !1;
    },
    d(a) {
      a && At(e), kn(n), i = !1, o();
    }
  };
}
function yi(t) {
  let e, n, r, i, o;
  return n = new Eu({}), {
    c() {
      e = zt("button"), Sn(n.$$.fragment), Le(e, "class", "icon svelte-1jp3vgd"), Le(e, "aria-label", "Capture from camera"), Ze(
        e,
        "selected",
        /*active_source*/
        t[0] === "webcam"
      );
    },
    m(a, s) {
      Bt(a, e, s), An(n, e, null), r = !0, i || (o = Tn(
        e,
        "click",
        /*click_handler_2*/
        t[8]
      ), i = !0);
    },
    p(a, s) {
      (!r || s & /*active_source*/
      1) && Ze(
        e,
        "selected",
        /*active_source*/
        a[0] === "webcam"
      );
    },
    i(a) {
      r || (K(n.$$.fragment, a), r = !0);
    },
    o(a) {
      de(n.$$.fragment, a), r = !1;
    },
    d(a) {
      a && At(e), kn(n), i = !1, o();
    }
  };
}
function Ei(t) {
  let e, n, r, i, o;
  return n = new Xs({}), {
    c() {
      e = zt("button"), Sn(n.$$.fragment), Le(e, "class", "icon svelte-1jp3vgd"), Le(e, "aria-label", "Paste from clipboard"), Ze(
        e,
        "selected",
        /*active_source*/
        t[0] === "clipboard"
      );
    },
    m(a, s) {
      Bt(a, e, s), An(n, e, null), r = !0, i || (o = Tn(
        e,
        "click",
        /*click_handler_3*/
        t[9]
      ), i = !0);
    },
    p(a, s) {
      (!r || s & /*active_source*/
      1) && Ze(
        e,
        "selected",
        /*active_source*/
        a[0] === "clipboard"
      );
    },
    i(a) {
      r || (K(n.$$.fragment, a), r = !0);
    },
    o(a) {
      de(n.$$.fragment, a), r = !1;
    },
    d(a) {
      a && At(e), kn(n), i = !1, o();
    }
  };
}
function xu(t) {
  let e, n, r = (
    /*unique_sources*/
    t[2].length > 1 && bi(t)
  );
  return {
    c() {
      r && r.c(), e = Mu();
    },
    m(i, o) {
      r && r.m(i, o), Bt(i, e, o), n = !0;
    },
    p(i, [o]) {
      /*unique_sources*/
      i[2].length > 1 ? r ? (r.p(i, o), o & /*unique_sources*/
      4 && K(r, 1)) : (r = bi(i), r.c(), K(r, 1), r.m(e.parentNode, e)) : r && (Rt(), de(r, 1, 1, () => {
        r = null;
      }), Lt());
    },
    i(i) {
      n || (K(r), n = !0);
    },
    o(i) {
      de(r), n = !1;
    },
    d(i) {
      i && At(e), r && r.d(i);
    }
  };
}
function Gu(t, e, n) {
  let r, { sources: i } = e, { active_source: o } = e, { handle_clear: a = () => {
  } } = e, { handle_select: s = () => {
  } } = e;
  async function l(_) {
    a(), n(0, o = _), s(_);
  }
  const c = () => l("upload"), u = () => l("microphone"), f = () => l("webcam"), h = () => l("clipboard");
  return t.$$set = (_) => {
    "sources" in _ && n(1, i = _.sources), "active_source" in _ && n(0, o = _.active_source), "handle_clear" in _ && n(4, a = _.handle_clear), "handle_select" in _ && n(5, s = _.handle_select);
  }, t.$$.update = () => {
    t.$$.dirty & /*sources*/
    2 && n(2, r = [...new Set(i)]);
  }, [
    o,
    i,
    r,
    l,
    a,
    s,
    c,
    u,
    f,
    h
  ];
}
class Fu extends Ru {
  constructor(e) {
    super(), Du(this, e, Gu, xu, Uu, {
      sources: 1,
      active_source: 0,
      handle_clear: 4,
      handle_select: 5
    });
  }
}
const Bo = (t) => {
  let e;
  if (t.currentTarget instanceof Element)
    e = t.currentTarget.querySelector("img");
  else
    return [NaN, NaN];
  const n = e.getBoundingClientRect(), r = e.naturalWidth / n.width, i = e.naturalHeight / n.height;
  if (r > i) {
    const s = e.naturalHeight / r, l = (n.height - s) / 2;
    var o = Math.round((t.clientX - n.left) * r), a = Math.round((t.clientY - n.top - l) * r);
  } else {
    const s = e.naturalWidth / i, l = (n.width - s) / 2;
    var o = Math.round((t.clientX - n.left - l) * i), a = Math.round((t.clientY - n.top) * i);
  }
  return o < 0 || o >= e.naturalWidth || a < 0 || a >= e.naturalHeight ? null : [o, a];
}, { setContext: D_, getContext: ju } = window.__gradio__svelte__internal, qu = "WORKER_PROXY_CONTEXT_KEY";
function Co() {
  return ju(qu);
}
function zu(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 Ho(t, e) {
  const n = e.toLowerCase();
  for (const [r, i] of Object.entries(t))
    if (r.toLowerCase() === n)
      return i;
}
function Po(t) {
  if (t == null)
    return !1;
  const e = new URL(t);
  return !(!zu(e) || e.protocol !== "http:" && e.protocol !== "https:");
}
async function Vu(t) {
  if (t == null || !Po(t))
    return t;
  const e = Co();
  if (e == null)
    return t;
  const r = new URL(t).pathname;
  return e.httpRequest({
    method: "GET",
    path: r,
    headers: {},
    query_string: ""
  }).then((i) => {
    if (i.status !== 200)
      throw new Error(`Failed to get file ${r} from the Wasm worker.`);
    const o = new Blob([i.body], {
      type: Ho(i.headers, "content-type")
    });
    return URL.createObjectURL(o);
  });
}
const {
  SvelteComponent: Wu,
  assign: dn,
  check_outros: Io,
  compute_rest_props: Si,
  create_slot: Zr,
  detach: Bn,
  element: No,
  empty: Oo,
  exclude_internal_props: Xu,
  get_all_dirty_from_scope: Jr,
  get_slot_changes: Qr,
  get_spread_update: Lo,
  group_outros: Ro,
  init: Zu,
  insert: Cn,
  listen: Mo,
  prevent_default: Ju,
  safe_not_equal: Qu,
  set_attributes: mn,
  transition_in: rt,
  transition_out: it,
  update_slot_base: Yr
} = window.__gradio__svelte__internal, { createEventDispatcher: Yu } = window.__gradio__svelte__internal;
function Ku(t) {
  let e, n, r, i, o;
  const a = (
    /*#slots*/
    t[8].default
  ), s = Zr(
    a,
    t,
    /*$$scope*/
    t[7],
    null
  );
  let l = [
    { href: (
      /*href*/
      t[0]
    ) },
    {
      target: n = typeof window < "u" && window.__is_colab__ ? "_blank" : null
    },
    { rel: "noopener noreferrer" },
    { download: (
      /*download*/
      t[1]
    ) },
    /*$$restProps*/
    t[6]
  ], c = {};
  for (let u = 0; u < l.length; u += 1)
    c = dn(c, l[u]);
  return {
    c() {
      e = No("a"), s && s.c(), mn(e, c);
    },
    m(u, f) {
      Cn(u, e, f), s && s.m(e, null), r = !0, i || (o = Mo(
        e,
        "click",
        /*dispatch*/
        t[3].bind(null, "click")
      ), i = !0);
    },
    p(u, f) {
      s && s.p && (!r || f & /*$$scope*/
      128) && Yr(
        s,
        a,
        u,
        /*$$scope*/
        u[7],
        r ? Qr(
          a,
          /*$$scope*/
          u[7],
          f,
          null
        ) : Jr(
          /*$$scope*/
          u[7]
        ),
        null
      ), mn(e, c = Lo(l, [
        (!r || f & /*href*/
        1) && { href: (
          /*href*/
          u[0]
        ) },
        { target: n },
        { rel: "noopener noreferrer" },
        (!r || f & /*download*/
        2) && { download: (
          /*download*/
          u[1]
        ) },
        f & /*$$restProps*/
        64 && /*$$restProps*/
        u[6]
      ]));
    },
    i(u) {
      r || (rt(s, u), r = !0);
    },
    o(u) {
      it(s, u), r = !1;
    },
    d(u) {
      u && Bn(e), s && s.d(u), i = !1, o();
    }
  };
}
function $u(t) {
  let e, n, r, i;
  const o = [tc, ec], a = [];
  function s(l, c) {
    return (
      /*is_downloading*/
      l[2] ? 0 : 1
    );
  }
  return e = s(t), n = a[e] = o[e](t), {
    c() {
      n.c(), r = Oo();
    },
    m(l, c) {
      a[e].m(l, c), Cn(l, r, c), i = !0;
    },
    p(l, c) {
      let u = e;
      e = s(l), e === u ? a[e].p(l, c) : (Ro(), it(a[u], 1, 1, () => {
        a[u] = null;
      }), Io(), n = a[e], n ? n.p(l, c) : (n = a[e] = o[e](l), n.c()), rt(n, 1), n.m(r.parentNode, r));
    },
    i(l) {
      i || (rt(n), i = !0);
    },
    o(l) {
      it(n), i = !1;
    },
    d(l) {
      l && Bn(r), a[e].d(l);
    }
  };
}
function ec(t) {
  let e, n, r, i;
  const o = (
    /*#slots*/
    t[8].default
  ), a = Zr(
    o,
    t,
    /*$$scope*/
    t[7],
    null
  );
  let s = [
    /*$$restProps*/
    t[6],
    { href: (
      /*href*/
      t[0]
    ) }
  ], l = {};
  for (let c = 0; c < s.length; c += 1)
    l = dn(l, s[c]);
  return {
    c() {
      e = No("a"), a && a.c(), mn(e, l);
    },
    m(c, u) {
      Cn(c, e, u), a && a.m(e, null), n = !0, r || (i = Mo(e, "click", Ju(
        /*wasm_click_handler*/
        t[5]
      )), r = !0);
    },
    p(c, u) {
      a && a.p && (!n || u & /*$$scope*/
      128) && Yr(
        a,
        o,
        c,
        /*$$scope*/
        c[7],
        n ? Qr(
          o,
          /*$$scope*/
          c[7],
          u,
          null
        ) : Jr(
          /*$$scope*/
          c[7]
        ),
        null
      ), mn(e, l = Lo(s, [
        u & /*$$restProps*/
        64 && /*$$restProps*/
        c[6],
        (!n || u & /*href*/
        1) && { href: (
          /*href*/
          c[0]
        ) }
      ]));
    },
    i(c) {
      n || (rt(a, c), n = !0);
    },
    o(c) {
      it(a, c), n = !1;
    },
    d(c) {
      c && Bn(e), a && a.d(c), r = !1, i();
    }
  };
}
function tc(t) {
  let e;
  const n = (
    /*#slots*/
    t[8].default
  ), r = Zr(
    n,
    t,
    /*$$scope*/
    t[7],
    null
  );
  return {
    c() {
      r && r.c();
    },
    m(i, o) {
      r && r.m(i, o), e = !0;
    },
    p(i, o) {
      r && r.p && (!e || o & /*$$scope*/
      128) && Yr(
        r,
        n,
        i,
        /*$$scope*/
        i[7],
        e ? Qr(
          n,
          /*$$scope*/
          i[7],
          o,
          null
        ) : Jr(
          /*$$scope*/
          i[7]
        ),
        null
      );
    },
    i(i) {
      e || (rt(r, i), e = !0);
    },
    o(i) {
      it(r, i), e = !1;
    },
    d(i) {
      r && r.d(i);
    }
  };
}
function nc(t) {
  let e, n, r, i, o;
  const a = [$u, Ku], s = [];
  function l(c, u) {
    return u & /*href*/
    1 && (e = null), e == null && (e = !!/*worker_proxy*/
    (c[4] && Po(
      /*href*/
      c[0]
    ))), e ? 0 : 1;
  }
  return n = l(t, -1), r = s[n] = a[n](t), {
    c() {
      r.c(), i = Oo();
    },
    m(c, u) {
      s[n].m(c, u), Cn(c, i, u), o = !0;
    },
    p(c, [u]) {
      let f = n;
      n = l(c, u), n === f ? s[n].p(c, u) : (Ro(), it(s[f], 1, 1, () => {
        s[f] = null;
      }), Io(), r = s[n], r ? r.p(c, u) : (r = s[n] = a[n](c), r.c()), rt(r, 1), r.m(i.parentNode, i));
    },
    i(c) {
      o || (rt(r), o = !0);
    },
    o(c) {
      it(r), o = !1;
    },
    d(c) {
      c && Bn(i), s[n].d(c);
    }
  };
}
function rc(t, e, n) {
  const r = ["href", "download"];
  let i = Si(e, r), { $$slots: o = {}, $$scope: a } = e, { href: s = void 0 } = e, { download: l } = e;
  const c = Yu();
  let u = !1;
  const f = Co();
  async function h() {
    if (u)
      return;
    if (c("click"), s == null)
      throw new Error("href is not defined.");
    if (f == null)
      throw new Error("Wasm worker proxy is not available.");
    const g = new URL(s).pathname;
    n(2, u = !0), f.httpRequest({
      method: "GET",
      path: g,
      headers: {},
      query_string: ""
    }).then((m) => {
      if (m.status !== 200)
        throw new Error(`Failed to get file ${g} from the Wasm worker.`);
      const v = new Blob(
        [m.body],
        {
          type: Ho(m.headers, "content-type")
        }
      ), b = URL.createObjectURL(v), y = document.createElement("a");
      y.href = b, y.download = l, y.click(), URL.revokeObjectURL(b);
    }).finally(() => {
      n(2, u = !1);
    });
  }
  return t.$$set = (_) => {
    e = dn(dn({}, e), Xu(_)), n(6, i = Si(e, r)), "href" in _ && n(0, s = _.href), "download" in _ && n(1, l = _.download), "$$scope" in _ && n(7, a = _.$$scope);
  }, [
    s,
    l,
    u,
    c,
    f,
    h,
    i,
    a,
    o
  ];
}
class ic extends Wu {
  constructor(e) {
    super(), Zu(this, e, rc, nc, Qu, { href: 0, download: 1 });
  }
}
const {
  SvelteComponent: oc,
  assign: Tr,
  compute_rest_props: ki,
  detach: ac,
  element: lc,
  exclude_internal_props: sc,
  get_spread_update: uc,
  init: cc,
  insert: fc,
  noop: Ti,
  safe_not_equal: hc,
  set_attributes: Ai,
  src_url_equal: _c
} = window.__gradio__svelte__internal;
function dc(t) {
  let e, n, r = [
    {
      src: n = /*resolved_src*/
      t[0]
    },
    /*$$restProps*/
    t[1]
  ], i = {};
  for (let o = 0; o < r.length; o += 1)
    i = Tr(i, r[o]);
  return {
    c() {
      e = lc("img"), Ai(e, i);
    },
    m(o, a) {
      fc(o, e, a);
    },
    p(o, [a]) {
      Ai(e, i = uc(r, [
        a & /*resolved_src*/
        1 && !_c(e.src, n = /*resolved_src*/
        o[0]) && { src: n },
        a & /*$$restProps*/
        2 && /*$$restProps*/
        o[1]
      ]));
    },
    i: Ti,
    o: Ti,
    d(o) {
      o && ac(e);
    }
  };
}
function mc(t, e, n) {
  const r = ["src"];
  let i = ki(e, r), { src: o = void 0 } = e, a, s;
  return t.$$set = (l) => {
    e = Tr(Tr({}, e), sc(l)), n(1, i = ki(e, r)), "src" in l && n(2, o = l.src);
  }, t.$$.update = () => {
    if (t.$$.dirty & /*src, latest_src*/
    12) {
      n(0, a = o), n(3, s = o);
      const l = o;
      Vu(l).then((c) => {
        s === l && n(0, a = c);
      });
    }
  }, [a, i, o, s];
}
class Kr extends oc {
  constructor(e) {
    super(), cc(this, e, mc, dc, hc, { src: 2 });
  }
}
var cr = new Intl.Collator(0, { numeric: 1 }).compare;
function Bi(t, e, n) {
  return t = t.split("."), e = e.split("."), cr(t[0], e[0]) || cr(t[1], e[1]) || (e[2] = e.slice(2).join("."), n = /[.-]/.test(t[2] = t.slice(2).join(".")), n == /[.-]/.test(e[2]) ? cr(t[2], e[2]) : n ? -1 : 1);
}
function Do(t, e, n) {
  return e.startsWith("http://") || e.startsWith("https://") ? n ? t : e : t + e;
}
function fr(t) {
  if (t.startsWith("http")) {
    const { protocol: e, host: n } = new URL(t);
    return n.endsWith("hf.space") ? {
      ws_protocol: "wss",
      host: n,
      http_protocol: e
    } : {
      ws_protocol: e === "https:" ? "wss" : "ws",
      http_protocol: e,
      host: n
    };
  } else if (t.startsWith("file:"))
    return {
      ws_protocol: "ws",
      http_protocol: "http:",
      host: "lite.local"
      // Special fake hostname only used for this case. This matches the hostname allowed in `is_self_host()` in `js/wasm/network/host.ts`.
    };
  return {
    ws_protocol: "wss",
    http_protocol: "https:",
    host: t
  };
}
const Uo = /^[^\/]*\/[^\/]*$/, gc = /.*hf\.space\/{0,1}$/;
async function pc(t, e) {
  const n = {};
  e && (n.Authorization = `Bearer ${e}`);
  const r = t.trim();
  if (Uo.test(r))
    try {
      const i = await fetch(
        `https://huggingface.co/api/spaces/${r}/host`,
        { headers: n }
      );
      if (i.status !== 200)
        throw new Error("Space metadata could not be loaded.");
      const o = (await i.json()).host;
      return {
        space_id: t,
        ...fr(o)
      };
    } catch (i) {
      throw new Error("Space metadata could not be loaded." + i.message);
    }
  if (gc.test(r)) {
    const { ws_protocol: i, http_protocol: o, host: a } = fr(r);
    return {
      space_id: a.replace(".hf.space", ""),
      ws_protocol: i,
      http_protocol: o,
      host: a
    };
  }
  return {
    space_id: !1,
    ...fr(r)
  };
}
function bc(t) {
  let e = {};
  return t.forEach(({ api_name: n }, r) => {
    n && (e[n] = r);
  }), e;
}
const vc = /^(?=[^]*\b[dD]iscussions{0,1}\b)(?=[^]*\b[dD]isabled\b)[^]*$/;
async function Ci(t) {
  try {
    const n = (await fetch(
      `https://huggingface.co/api/spaces/${t}/discussions`,
      {
        method: "HEAD"
      }
    )).headers.get("x-error-message");
    return !(n && vc.test(n));
  } catch {
    return !1;
  }
}
function xe(t, e, n) {
  if (t == null)
    return null;
  if (Array.isArray(t)) {
    const r = [];
    for (const i of t)
      i == null ? r.push(null) : r.push(xe(i, e, n));
    return r;
  }
  return t.is_stream ? n == null ? new pt({
    ...t,
    url: e + "/stream/" + t.path
  }) : new pt({
    ...t,
    url: "/proxy=" + n + "stream/" + t.path
  }) : new pt({
    ...t,
    url: yc(t.path, e, n)
  });
}
function wc(t) {
  try {
    const e = new URL(t);
    return e.protocol === "http:" || e.protocol === "https:";
  } catch {
    return !1;
  }
}
function yc(t, e, n) {
  return t == null ? n ? `/proxy=${n}file=` : `${e}/file=` : wc(t) ? t : n ? `/proxy=${n}file=${t}` : `${e}/file=${t}`;
}
async function xo(t, e, n, r = Sc) {
  let i = (Array.isArray(t) ? t : [t]).map(
    (o) => o.blob
  );
  return await Promise.all(
    await r(e, i, void 0, n).then(
      async (o) => {
        if (o.error)
          throw new Error(o.error);
        return o.files ? o.files.map((a, s) => {
          const l = new pt({ ...t[s], path: a });
          return xe(l, e, null);
        }) : [];
      }
    )
  );
}
async function Go(t, e) {
  return t.map(
    (n, r) => new pt({
      path: n.name,
      orig_name: n.name,
      blob: n,
      size: n.size,
      mime_type: n.type,
      is_stream: e
    })
  );
}
class pt {
  constructor({
    path: e,
    url: n,
    orig_name: r,
    size: i,
    blob: o,
    is_stream: a,
    mime_type: s,
    alt_text: l
  }) {
    this.path = e, this.url = n, this.orig_name = r, this.size = i, this.blob = n ? void 0 : o, this.is_stream = a, this.mime_type = s, this.alt_text = l;
  }
}
const Fo = "This application is too busy. Keep trying!", Qe = "Connection errored out.";
let jo;
function Ec(t, e) {
  return { post_data: n, upload_files: r, client: i, handle_blob: o };
  async function n(a, s, l) {
    const c = { "Content-Type": "application/json" };
    l && (c.Authorization = `Bearer ${l}`);
    try {
      var u = await t(a, {
        method: "POST",
        body: JSON.stringify(s),
        headers: c
      });
    } catch {
      return [{ error: Qe }, 500];
    }
    let f, h;
    try {
      f = await u.json(), h = u.status;
    } catch (_) {
      f = { error: `Could not parse server response: ${_}` }, h = 500;
    }
    return [f, h];
  }
  async function r(a, s, l, c) {
    const u = {};
    l && (u.Authorization = `Bearer ${l}`);
    const f = 1e3, h = [];
    for (let g = 0; g < s.length; g += f) {
      const m = s.slice(g, g + f), v = new FormData();
      m.forEach((y) => {
        v.append("files", y);
      });
      try {
        const y = c ? `${a}/upload?upload_id=${c}` : `${a}/upload`;
        var _ = await t(y, {
          method: "POST",
          body: v,
          headers: u
        });
      } catch {
        return { error: Qe };
      }
      const b = await _.json();
      h.push(...b);
    }
    return { files: h };
  }
  async function i(a, s = { normalise_files: !0 }) {
    return new Promise(async (l) => {
      const { status_callback: c, hf_token: u, normalise_files: f } = s, h = {
        predict: j,
        submit: Ie,
        view_api: Ne,
        component_server: Je
      }, _ = f ?? !0;
      if ((typeof window > "u" || !("WebSocket" in window)) && !global.Websocket) {
        const d = await import("./wrapper-6f348d45-f837cf34.js");
        jo = (await import("./__vite-browser-external-2447137e.js")).Blob, global.WebSocket = d.WebSocket;
      }
      const { ws_protocol: g, http_protocol: m, host: v, space_id: b } = await pc(a, u), y = Math.random().toString(36).substring(2), C = {};
      let H = !1, I = {}, p = null;
      const D = {}, S = /* @__PURE__ */ new Set();
      let w, Z = {}, G = !1;
      u && b && (G = await Tc(b, u));
      async function le(d) {
        if (w = d, Z = bc((d == null ? void 0 : d.dependencies) || []), w.auth_required)
          return {
            config: w,
            ...h
          };
        try {
          ne = await Ne(w);
        } catch (A) {
          console.error(`Could not get api details: ${A.message}`);
        }
        return {
          config: w,
          ...h
        };
      }
      let ne;
      async function T(d) {
        if (c && c(d), d.status === "running")
          try {
            w = await Ni(
              t,
              `${m}//${v}`,
              u
            );
            const A = await le(w);
            l(A);
          } catch (A) {
            console.error(A), c && c({
              status: "error",
              message: "Could not load this space.",
              load_status: "error",
              detail: "NOT_FOUND"
            });
          }
      }
      try {
        w = await Ni(
          t,
          `${m}//${v}`,
          u
        );
        const d = await le(w);
        l(d);
      } catch (d) {
        console.error(d), b ? Br(
          b,
          Uo.test(b) ? "space_name" : "subdomain",
          T
        ) : c && c({
          status: "error",
          message: "Could not load this space.",
          load_status: "error",
          detail: "NOT_FOUND"
        });
      }
      function j(d, A, O) {
        let L = !1, k = !1, Y;
        if (typeof d == "number")
          Y = w.dependencies[d];
        else {
          const V = d.replace(/^\//, "");
          Y = w.dependencies[Z[V]];
        }
        if (Y.types.continuous)
          throw new Error(
            "Cannot call predict on this function as it may run forever. Use submit instead"
          );
        return new Promise((V, Se) => {
          const De = Ie(d, A, O);
          let B;
          De.on("data", (ke) => {
            k && (De.destroy(), V(ke)), L = !0, B = ke;
          }).on("status", (ke) => {
            ke.stage === "error" && Se(ke), ke.stage === "complete" && (k = !0, L && (De.destroy(), V(B)));
          });
        });
      }
      function Ie(d, A, O, L = null) {
        let k, Y;
        if (typeof d == "number")
          k = d, Y = ne.unnamed_endpoints[k];
        else {
          const $ = d.replace(/^\//, "");
          k = Z[$], Y = ne.named_endpoints[d.trim()];
        }
        if (typeof k != "number")
          throw new Error(
            "There is no endpoint matching that name of fn_index matching that number."
          );
        let V, Se, De = w.protocol ?? "ws";
        const B = typeof d == "number" ? "/predict" : d;
        let ke, Be = null, ge = !1;
        const Pt = {};
        let Ge = "";
        typeof window < "u" && (Ge = new URLSearchParams(window.location.search).toString()), o(`${w.root}`, A, Y, u).then(
          ($) => {
            if (ke = {
              data: $ || [],
              event_data: O,
              fn_index: k,
              trigger_id: L
            }, Ac(k, w))
              R({
                type: "status",
                endpoint: B,
                stage: "pending",
                queue: !1,
                fn_index: k,
                time: /* @__PURE__ */ new Date()
              }), n(
                `${w.root}/run${B.startsWith("/") ? B : `/${B}`}${Ge ? "?" + Ge : ""}`,
                {
                  ...ke,
                  session_hash: y
                },
                u
              ).then(([q, X]) => {
                const Ce = _ ? rn(
                  q.data,
                  Y,
                  w.root,
                  w.root_url
                ) : q.data;
                X == 200 ? (R({
                  type: "data",
                  endpoint: B,
                  fn_index: k,
                  data: Ce,
                  time: /* @__PURE__ */ new Date()
                }), R({
                  type: "status",
                  endpoint: B,
                  fn_index: k,
                  stage: "complete",
                  eta: q.average_duration,
                  queue: !1,
                  time: /* @__PURE__ */ new Date()
                })) : R({
                  type: "status",
                  stage: "error",
                  endpoint: B,
                  fn_index: k,
                  message: q.error,
                  queue: !1,
                  time: /* @__PURE__ */ new Date()
                });
              }).catch((q) => {
                R({
                  type: "status",
                  stage: "error",
                  message: q.message,
                  endpoint: B,
                  fn_index: k,
                  queue: !1,
                  time: /* @__PURE__ */ new Date()
                });
              });
            else if (De == "ws") {
              R({
                type: "status",
                stage: "pending",
                queue: !0,
                endpoint: B,
                fn_index: k,
                time: /* @__PURE__ */ new Date()
              });
              let q = new URL(`${g}://${Do(
                v,
                w.path,
                !0
              )}
							/queue/join${Ge ? "?" + Ge : ""}`);
              G && q.searchParams.set("__sign", G), V = new WebSocket(q), V.onclose = (X) => {
                X.wasClean || R({
                  type: "status",
                  stage: "error",
                  broken: !0,
                  message: Qe,
                  queue: !0,
                  endpoint: B,
                  fn_index: k,
                  time: /* @__PURE__ */ new Date()
                });
              }, V.onmessage = function(X) {
                const Ce = JSON.parse(X.data), { type: re, status: U, data: x } = hr(
                  Ce,
                  C[k]
                );
                if (re === "update" && U && !ge)
                  R({
                    type: "status",
                    endpoint: B,
                    fn_index: k,
                    time: /* @__PURE__ */ new Date(),
                    ...U
                  }), U.stage === "error" && V.close();
                else if (re === "hash") {
                  V.send(JSON.stringify({ fn_index: k, session_hash: y }));
                  return;
                } else
                  re === "data" ? V.send(JSON.stringify({ ...ke, session_hash: y })) : re === "complete" ? ge = U : re === "log" ? R({
                    type: "log",
                    log: x.log,
                    level: x.level,
                    endpoint: B,
                    fn_index: k
                  }) : re === "generating" && R({
                    type: "status",
                    time: /* @__PURE__ */ new Date(),
                    ...U,
                    stage: U == null ? void 0 : U.stage,
                    queue: !0,
                    endpoint: B,
                    fn_index: k
                  });
                x && (R({
                  type: "data",
                  time: /* @__PURE__ */ new Date(),
                  data: _ ? rn(
                    x.data,
                    Y,
                    w.root,
                    w.root_url
                  ) : x.data,
                  endpoint: B,
                  fn_index: k
                }), ge && (R({
                  type: "status",
                  time: /* @__PURE__ */ new Date(),
                  ...ge,
                  stage: U == null ? void 0 : U.stage,
                  queue: !0,
                  endpoint: B,
                  fn_index: k
                }), V.close()));
              }, Bi(w.version || "2.0.0", "3.6") < 0 && addEventListener(
                "open",
                () => V.send(JSON.stringify({ hash: y }))
              );
            } else if (De == "sse") {
              R({
                type: "status",
                stage: "pending",
                queue: !0,
                endpoint: B,
                fn_index: k,
                time: /* @__PURE__ */ new Date()
              });
              var Te = new URLSearchParams({
                fn_index: k.toString(),
                session_hash: y
              }).toString();
              let q = new URL(
                `${w.root}/queue/join?${Ge ? Ge + "&" : ""}${Te}`
              );
              Se = e(q), Se.onmessage = async function(X) {
                const Ce = JSON.parse(X.data), { type: re, status: U, data: x } = hr(
                  Ce,
                  C[k]
                );
                if (re === "update" && U && !ge)
                  R({
                    type: "status",
                    endpoint: B,
                    fn_index: k,
                    time: /* @__PURE__ */ new Date(),
                    ...U
                  }), U.stage === "error" && Se.close();
                else if (re === "data") {
                  Be = Ce.event_id;
                  let [ct, Pa] = await n(
                    `${w.root}/queue/data`,
                    {
                      ...ke,
                      session_hash: y,
                      event_id: Be
                    },
                    u
                  );
                  Pa !== 200 && (R({
                    type: "status",
                    stage: "error",
                    message: Qe,
                    queue: !0,
                    endpoint: B,
                    fn_index: k,
                    time: /* @__PURE__ */ new Date()
                  }), Se.close());
                } else
                  re === "complete" ? ge = U : re === "log" ? R({
                    type: "log",
                    log: x.log,
                    level: x.level,
                    endpoint: B,
                    fn_index: k
                  }) : re === "generating" && R({
                    type: "status",
                    time: /* @__PURE__ */ new Date(),
                    ...U,
                    stage: U == null ? void 0 : U.stage,
                    queue: !0,
                    endpoint: B,
                    fn_index: k
                  });
                x && (R({
                  type: "data",
                  time: /* @__PURE__ */ new Date(),
                  data: _ ? rn(
                    x.data,
                    Y,
                    w.root,
                    w.root_url
                  ) : x.data,
                  endpoint: B,
                  fn_index: k
                }), ge && (R({
                  type: "status",
                  time: /* @__PURE__ */ new Date(),
                  ...ge,
                  stage: U == null ? void 0 : U.stage,
                  queue: !0,
                  endpoint: B,
                  fn_index: k
                }), Se.close()));
              };
            } else
              De == "sse_v1" && (R({
                type: "status",
                stage: "pending",
                queue: !0,
                endpoint: B,
                fn_index: k,
                time: /* @__PURE__ */ new Date()
              }), n(
                `${w.root}/queue/join?${Ge}`,
                {
                  ...ke,
                  session_hash: y
                },
                u
              ).then(([q, X]) => {
                if (X === 503)
                  R({
                    type: "status",
                    stage: "error",
                    message: Fo,
                    queue: !0,
                    endpoint: B,
                    fn_index: k,
                    time: /* @__PURE__ */ new Date()
                  });
                else if (X !== 200)
                  R({
                    type: "status",
                    stage: "error",
                    message: Qe,
                    queue: !0,
                    endpoint: B,
                    fn_index: k,
                    time: /* @__PURE__ */ new Date()
                  });
                else {
                  Be = q.event_id;
                  let Ce = async function(re) {
                    try {
                      const { type: U, status: x, data: ct } = hr(
                        re,
                        C[k]
                      );
                      if (U == "heartbeat")
                        return;
                      if (U === "update" && x && !ge)
                        R({
                          type: "status",
                          endpoint: B,
                          fn_index: k,
                          time: /* @__PURE__ */ new Date(),
                          ...x
                        });
                      else if (U === "complete")
                        ge = x;
                      else if (U == "unexpected_error")
                        console.error("Unexpected error", x == null ? void 0 : x.message), R({
                          type: "status",
                          stage: "error",
                          message: (x == null ? void 0 : x.message) || "An Unexpected Error Occurred!",
                          queue: !0,
                          endpoint: B,
                          fn_index: k,
                          time: /* @__PURE__ */ new Date()
                        });
                      else if (U === "log") {
                        R({
                          type: "log",
                          log: ct.log,
                          level: ct.level,
                          endpoint: B,
                          fn_index: k
                        });
                        return;
                      } else
                        U === "generating" && R({
                          type: "status",
                          time: /* @__PURE__ */ new Date(),
                          ...x,
                          stage: x == null ? void 0 : x.stage,
                          queue: !0,
                          endpoint: B,
                          fn_index: k
                        });
                      ct && (R({
                        type: "data",
                        time: /* @__PURE__ */ new Date(),
                        data: _ ? rn(
                          ct.data,
                          Y,
                          w.root,
                          w.root_url
                        ) : ct.data,
                        endpoint: B,
                        fn_index: k
                      }), ge && R({
                        type: "status",
                        time: /* @__PURE__ */ new Date(),
                        ...ge,
                        stage: x == null ? void 0 : x.stage,
                        queue: !0,
                        endpoint: B,
                        fn_index: k
                      })), ((x == null ? void 0 : x.stage) === "complete" || (x == null ? void 0 : x.stage) === "error") && D[Be] && delete D[Be];
                    } catch (U) {
                      console.error("Unexpected client exception", U), R({
                        type: "status",
                        stage: "error",
                        message: "An Unexpected Error Occurred!",
                        queue: !0,
                        endpoint: B,
                        fn_index: k,
                        time: /* @__PURE__ */ new Date()
                      }), Me();
                    }
                  };
                  Be in I && (I[Be].forEach(
                    (re) => Ce(re)
                  ), delete I[Be]), D[Be] = Ce, S.add(Be), H || E();
                }
              }));
          }
        );
        function R($) {
          const q = Pt[$.type] || [];
          q == null || q.forEach((X) => X($));
        }
        function Gn($, Te) {
          const q = Pt, X = q[$] || [];
          return q[$] = X, X == null || X.push(Te), { on: Gn, off: Qt, cancel: Fn, destroy: jn };
        }
        function Qt($, Te) {
          const q = Pt;
          let X = q[$] || [];
          return X = X == null ? void 0 : X.filter((Ce) => Ce !== Te), q[$] = X, { on: Gn, off: Qt, cancel: Fn, destroy: jn };
        }
        async function Fn() {
          const $ = {
            stage: "complete",
            queue: !1,
            time: /* @__PURE__ */ new Date()
          };
          ge = $, R({
            ...$,
            type: "status",
            endpoint: B,
            fn_index: k
          });
          let Te = {};
          De === "ws" ? (V && V.readyState === 0 ? V.addEventListener("open", () => {
            V.close();
          }) : V.close(), Te = { fn_index: k, session_hash: y }) : (Se.close(), Te = { event_id: Be });
          try {
            await t(`${w.root}/reset`, {
              headers: { "Content-Type": "application/json" },
              method: "POST",
              body: JSON.stringify(Te)
            });
          } catch {
            console.warn(
              "The `/reset` endpoint could not be called. Subsequent endpoint results may be unreliable."
            );
          }
        }
        function jn() {
          for (const $ in Pt)
            Pt[$].forEach((Te) => {
              Qt($, Te);
            });
        }
        return {
          on: Gn,
          off: Qt,
          cancel: Fn,
          destroy: jn
        };
      }
      function E() {
        H = !0;
        let d = new URLSearchParams({
          session_hash: y
        }).toString(), A = new URL(`${w.root}/queue/data?${d}`);
        p = e(A), p.onmessage = async function(O) {
          let L = JSON.parse(O.data);
          const k = L.event_id;
          if (!k)
            await Promise.all(
              Object.keys(D).map(
                (Y) => D[Y](L)
              )
            );
          else if (D[k]) {
            L.msg === "process_completed" && (S.delete(k), S.size === 0 && Me());
            let Y = D[k];
            window.setTimeout(Y, 0, L);
          } else
            I[k] || (I[k] = []), I[k].push(L);
        }, p.onerror = async function(O) {
          await Promise.all(
            Object.keys(D).map(
              (L) => D[L]({
                msg: "unexpected_error",
                message: Qe
              })
            )
          ), Me();
        };
      }
      function Me() {
        H = !1, p == null || p.close();
      }
      async function Je(d, A, O) {
        var L;
        const k = { "Content-Type": "application/json" };
        u && (k.Authorization = `Bearer ${u}`);
        let Y, V = w.components.find(
          (B) => B.id === d
        );
        (L = V == null ? void 0 : V.props) != null && L.root_url ? Y = V.props.root_url : Y = w.root;
        const Se = await t(
          `${Y}/component_server/`,
          {
            method: "POST",
            body: JSON.stringify({
              data: O,
              component_id: d,
              fn_name: A,
              session_hash: y
            }),
            headers: k
          }
        );
        if (!Se.ok)
          throw new Error(
            "Could not connect to component server: " + Se.statusText
          );
        return await Se.json();
      }
      async function Ne(d) {
        if (ne)
          return ne;
        const A = { "Content-Type": "application/json" };
        u && (A.Authorization = `Bearer ${u}`);
        let O;
        if (Bi(d.version || "2.0.0", "3.30") < 0 ? O = await t(
          "https://gradio-space-api-fetcher-v2.hf.space/api",
          {
            method: "POST",
            body: JSON.stringify({
              serialize: !1,
              config: JSON.stringify(d)
            }),
            headers: A
          }
        ) : O = await t(`${d.root}/info`, {
          headers: A
        }), !O.ok)
          throw new Error(Qe);
        let L = await O.json();
        return "api" in L && (L = L.api), L.named_endpoints["/predict"] && !L.unnamed_endpoints[0] && (L.unnamed_endpoints[0] = L.named_endpoints["/predict"]), kc(L, d, Z);
      }
    });
  }
  async function o(a, s, l, c) {
    const u = await Ar(
      s,
      void 0,
      [],
      !0,
      l
    );
    return Promise.all(
      u.map(async ({ path: f, blob: h, type: _ }) => {
        if (h) {
          const g = (await r(a, [h], c)).files[0];
          return { path: f, file_url: g, type: _, name: h == null ? void 0 : h.name };
        }
        return { path: f, type: _ };
      })
    ).then((f) => (f.forEach(({ path: h, file_url: _, type: g, name: m }) => {
      if (g === "Gallery")
        Ii(s, _, h);
      else if (_) {
        const v = new pt({ path: _, orig_name: m });
        Ii(s, v, h);
      }
    }), s));
  }
}
const { post_data: U_, upload_files: Sc, client: x_, handle_blob: G_ } = Ec(
  fetch,
  (...t) => new EventSource(...t)
);
function rn(t, e, n, r) {
  return t.map((i, o) => {
    var a, s, l, c;
    return ((s = (a = e == null ? void 0 : e.returns) == null ? void 0 : a[o]) == null ? void 0 : s.component) === "File" ? xe(i, n, r) : ((c = (l = e == null ? void 0 : e.returns) == null ? void 0 : l[o]) == null ? void 0 : c.component) === "Gallery" ? i.map((u) => Array.isArray(u) ? [xe(u[0], n, r), u[1]] : [xe(u, n, r), null]) : typeof i == "object" && i.path ? xe(i, n, r) : i;
  });
}
function Hi(t, e, n, r) {
  switch (t.type) {
    case "string":
      return "string";
    case "boolean":
      return "boolean";
    case "number":
      return "number";
  }
  if (n === "JSONSerializable" || n === "StringSerializable")
    return "any";
  if (n === "ListStringSerializable")
    return "string[]";
  if (e === "Image")
    return r === "parameter" ? "Blob | File | Buffer" : "string";
  if (n === "FileSerializable")
    return (t == null ? void 0 : t.type) === "array" ? r === "parameter" ? "(Blob | File | Buffer)[]" : "{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}[]" : r === "parameter" ? "Blob | File | Buffer" : "{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}";
  if (n === "GallerySerializable")
    return r === "parameter" ? "[(Blob | File | Buffer), (string | null)][]" : "[{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}, (string | null))][]";
}
function Pi(t, e) {
  return e === "GallerySerializable" ? "array of [file, label] tuples" : e === "ListStringSerializable" ? "array of strings" : e === "FileSerializable" ? "array of files or single file" : t.description;
}
function kc(t, e, n) {
  const r = {
    named_endpoints: {},
    unnamed_endpoints: {}
  };
  for (const i in t) {
    const o = t[i];
    for (const a in o) {
      const s = e.dependencies[a] ? a : n[a.replace("/", "")], l = o[a];
      r[i][a] = {}, r[i][a].parameters = {}, r[i][a].returns = {}, r[i][a].type = e.dependencies[s].types, r[i][a].parameters = l.parameters.map(
        ({ label: c, component: u, type: f, serializer: h }) => ({
          label: c,
          component: u,
          type: Hi(f, u, h, "parameter"),
          description: Pi(f, h)
        })
      ), r[i][a].returns = l.returns.map(
        ({ label: c, component: u, type: f, serializer: h }) => ({
          label: c,
          component: u,
          type: Hi(f, u, h, "return"),
          description: Pi(f, h)
        })
      );
    }
  }
  return r;
}
async function Tc(t, e) {
  try {
    return (await (await fetch(`https://huggingface.co/api/spaces/${t}/jwt`, {
      headers: {
        Authorization: `Bearer ${e}`
      }
    })).json()).token || !1;
  } catch (n) {
    return console.error(n), !1;
  }
}
function Ii(t, e, n) {
  for (; n.length > 1; )
    t = t[n.shift()];
  t[n.shift()] = e;
}
async function Ar(t, e = void 0, n = [], r = !1, i = void 0) {
  if (Array.isArray(t)) {
    let o = [];
    return await Promise.all(
      t.map(async (a, s) => {
        var l;
        let c = n.slice();
        c.push(s);
        const u = await Ar(
          t[s],
          r ? ((l = i == null ? void 0 : i.parameters[s]) == null ? void 0 : l.component) || void 0 : e,
          c,
          !1,
          i
        );
        o = o.concat(u);
      })
    ), o;
  } else {
    if (globalThis.Buffer && t instanceof globalThis.Buffer)
      return [
        {
          path: n,
          blob: e === "Image" ? !1 : new jo([t]),
          type: e
        }
      ];
    if (typeof t == "object") {
      let o = [];
      for (let a in t)
        if (t.hasOwnProperty(a)) {
          let s = n.slice();
          s.push(a), o = o.concat(
            await Ar(
              t[a],
              void 0,
              s,
              !1,
              i
            )
          );
        }
      return o;
    }
  }
  return [];
}
function Ac(t, e) {
  var n, r, i, o;
  return !(((r = (n = e == null ? void 0 : e.dependencies) == null ? void 0 : n[t]) == null ? void 0 : r.queue) === null ? e.enable_queue : (o = (i = e == null ? void 0 : e.dependencies) == null ? void 0 : i[t]) != null && o.queue) || !1;
}
async function Ni(t, e, n) {
  const r = {};
  if (n && (r.Authorization = `Bearer ${n}`), typeof window < "u" && window.gradio_config && location.origin !== "http://localhost:9876" && !window.gradio_config.dev_mode) {
    const i = window.gradio_config.root, o = window.gradio_config;
    return o.root = Do(e, o.root, !1), { ...o, path: i };
  } else if (e) {
    let i = await t(`${e}/config`, {
      headers: r
    });
    if (i.status === 200) {
      const o = await i.json();
      return o.path = o.path ?? "", o.root = e, o;
    }
    throw new Error("Could not get config.");
  }
  throw new Error("No config or app endpoint found");
}
async function Br(t, e, n) {
  let r = e === "subdomain" ? `https://huggingface.co/api/spaces/by-subdomain/${t}` : `https://huggingface.co/api/spaces/${t}`, i, o;
  try {
    if (i = await fetch(r), o = i.status, o !== 200)
      throw new Error();
    i = await i.json();
  } catch {
    n({
      status: "error",
      load_status: "error",
      message: "Could not get space status",
      detail: "NOT_FOUND"
    });
    return;
  }
  if (!i || o !== 200)
    return;
  const {
    runtime: { stage: a },
    id: s
  } = i;
  switch (a) {
    case "STOPPED":
    case "SLEEPING":
      n({
        status: "sleeping",
        load_status: "pending",
        message: "Space is asleep. Waking it up...",
        detail: a
      }), setTimeout(() => {
        Br(t, e, n);
      }, 1e3);
      break;
    case "PAUSED":
      n({
        status: "paused",
        load_status: "error",
        message: "This space has been paused by the author. If you would like to try this demo, consider duplicating the space.",
        detail: a,
        discussions_enabled: await Ci(s)
      });
      break;
    case "RUNNING":
    case "RUNNING_BUILDING":
      n({
        status: "running",
        load_status: "complete",
        message: "",
        detail: a
      });
      break;
    case "BUILDING":
      n({
        status: "building",
        load_status: "pending",
        message: "Space is building...",
        detail: a
      }), setTimeout(() => {
        Br(t, e, n);
      }, 1e3);
      break;
    default:
      n({
        status: "space_error",
        load_status: "error",
        message: "This space is experiencing an issue.",
        detail: a,
        discussions_enabled: await Ci(s)
      });
      break;
  }
}
function hr(t, e) {
  switch (t.msg) {
    case "send_data":
      return { type: "data" };
    case "send_hash":
      return { type: "hash" };
    case "queue_full":
      return {
        type: "update",
        status: {
          queue: !0,
          message: Fo,
          stage: "error",
          code: t.code,
          success: t.success
        }
      };
    case "heartbeat":
      return {
        type: "heartbeat"
      };
    case "unexpected_error":
      return {
        type: "unexpected_error",
        status: {
          queue: !0,
          message: t.message,
          stage: "error",
          success: !1
        }
      };
    case "estimation":
      return {
        type: "update",
        status: {
          queue: !0,
          stage: e || "pending",
          code: t.code,
          size: t.queue_size,
          position: t.rank,
          eta: t.rank_eta,
          success: t.success
        }
      };
    case "progress":
      return {
        type: "update",
        status: {
          queue: !0,
          stage: "pending",
          code: t.code,
          progress_data: t.progress_data,
          success: t.success
        }
      };
    case "log":
      return { type: "log", data: t };
    case "process_generating":
      return {
        type: "generating",
        status: {
          queue: !0,
          message: t.success ? null : t.output.error,
          stage: t.success ? "generating" : "error",
          code: t.code,
          progress_data: t.progress_data,
          eta: t.average_duration
        },
        data: t.success ? t.output : null
      };
    case "process_completed":
      return "error" in t.output ? {
        type: "update",
        status: {
          queue: !0,
          message: t.output.error,
          stage: "error",
          code: t.code,
          success: t.success
        }
      } : {
        type: "complete",
        status: {
          queue: !0,
          message: t.success ? void 0 : t.output.error,
          stage: t.success ? "complete" : "error",
          code: t.code,
          progress_data: t.progress_data
        },
        data: t.success ? t.output : null
      };
    case "process_starts":
      return {
        type: "update",
        status: {
          queue: !0,
          stage: "pending",
          code: t.code,
          size: t.rank,
          position: 0,
          success: t.success,
          eta: t.eta
        }
      };
  }
  return { type: "none", status: { stage: "error", queue: !0 } };
}
const {
  SvelteComponent: Bc,
  append: Oi,
  attr: _r,
  bubble: Li,
  check_outros: Cr,
  create_component: at,
  destroy_component: lt,
  detach: Dt,
  element: dr,
  empty: Cc,
  group_outros: Hr,
  init: Hc,
  insert: Ut,
  listen: Pc,
  mount_component: st,
  safe_not_equal: Ic,
  space: Pr,
  toggle_class: Ri,
  transition_in: ce,
  transition_out: ve
} = window.__gradio__svelte__internal, { createEventDispatcher: Nc } = window.__gradio__svelte__internal;
function Oc(t) {
  let e, n, r, i, o, a, s, l, c, u = (
    /*show_download_button*/
    t[3] && Mi(t)
  ), f = (
    /*show_share_button*/
    t[5] && Di(t)
  );
  return a = new Kr({
    props: {
      src: (
        /*value*/
        t[0].url
      ),
      alt: "",
      loading: "lazy"
    }
  }), {
    c() {
      e = dr("div"), u && u.c(), n = Pr(), f && f.c(), r = Pr(), i = dr("button"), o = dr("div"), at(a.$$.fragment), _r(e, "class", "icon-buttons svelte-n22rtv"), _r(o, "class", "image-container svelte-n22rtv"), Ri(
        o,
        "selectable",
        /*selectable*/
        t[4]
      ), _r(i, "class", "svelte-n22rtv");
    },
    m(h, _) {
      Ut(h, e, _), u && u.m(e, null), Oi(e, n), f && f.m(e, null), Ut(h, r, _), Ut(h, i, _), Oi(i, o), st(a, o, null), s = !0, l || (c = Pc(
        i,
        "click",
        /*handle_click*/
        t[7]
      ), l = !0);
    },
    p(h, _) {
      /*show_download_button*/
      h[3] ? u ? (u.p(h, _), _ & /*show_download_button*/
      8 && ce(u, 1)) : (u = Mi(h), u.c(), ce(u, 1), u.m(e, n)) : u && (Hr(), ve(u, 1, 1, () => {
        u = null;
      }), Cr()), /*show_share_button*/
      h[5] ? f ? (f.p(h, _), _ & /*show_share_button*/
      32 && ce(f, 1)) : (f = Di(h), f.c(), ce(f, 1), f.m(e, null)) : f && (Hr(), ve(f, 1, 1, () => {
        f = null;
      }), Cr());
      const g = {};
      _ & /*value*/
      1 && (g.src = /*value*/
      h[0].url), a.$set(g), (!s || _ & /*selectable*/
      16) && Ri(
        o,
        "selectable",
        /*selectable*/
        h[4]
      );
    },
    i(h) {
      s || (ce(u), ce(f), ce(a.$$.fragment, h), s = !0);
    },
    o(h) {
      ve(u), ve(f), ve(a.$$.fragment, h), s = !1;
    },
    d(h) {
      h && (Dt(e), Dt(r), Dt(i)), u && u.d(), f && f.d(), lt(a), l = !1, c();
    }
  };
}
function Lc(t) {
  let e, n;
  return e = new jl({
    props: {
      unpadded_box: !0,
      size: "large",
      $$slots: { default: [Mc] },
      $$scope: { ctx: t }
    }
  }), {
    c() {
      at(e.$$.fragment);
    },
    m(r, i) {
      st(e, r, i), n = !0;
    },
    p(r, i) {
      const o = {};
      i & /*$$scope*/
      4096 && (o.$$scope = { dirty: i, ctx: r }), e.$set(o);
    },
    i(r) {
      n || (ce(e.$$.fragment, r), n = !0);
    },
    o(r) {
      ve(e.$$.fragment, r), n = !1;
    },
    d(r) {
      lt(e, r);
    }
  };
}
function Mi(t) {
  let e, n;
  return e = new ic({
    props: {
      href: (
        /*value*/
        t[0].url
      ),
      download: (
        /*value*/
        t[0].orig_name || "image"
      ),
      $$slots: { default: [Rc] },
      $$scope: { ctx: t }
    }
  }), {
    c() {
      at(e.$$.fragment);
    },
    m(r, i) {
      st(e, r, i), n = !0;
    },
    p(r, i) {
      const o = {};
      i & /*value*/
      1 && (o.href = /*value*/
      r[0].url), i & /*value*/
      1 && (o.download = /*value*/
      r[0].orig_name || "image"), i & /*$$scope, i18n*/
      4160 && (o.$$scope = { dirty: i, ctx: r }), e.$set(o);
    },
    i(r) {
      n || (ce(e.$$.fragment, r), n = !0);
    },
    o(r) {
      ve(e.$$.fragment, r), n = !1;
    },
    d(r) {
      lt(e, r);
    }
  };
}
function Rc(t) {
  let e, n;
  return e = new Xr({
    props: {
      Icon: As,
      label: (
        /*i18n*/
        t[6]("common.download")
      )
    }
  }), {
    c() {
      at(e.$$.fragment);
    },
    m(r, i) {
      st(e, r, i), n = !0;
    },
    p(r, i) {
      const o = {};
      i & /*i18n*/
      64 && (o.label = /*i18n*/
      r[6]("common.download")), e.$set(o);
    },
    i(r) {
      n || (ce(e.$$.fragment, r), n = !0);
    },
    o(r) {
      ve(e.$$.fragment, r), n = !1;
    },
    d(r) {
      lt(e, r);
    }
  };
}
function Di(t) {
  let e, n;
  return e = new Lu({
    props: {
      i18n: (
        /*i18n*/
        t[6]
      ),
      formatter: (
        /*func*/
        t[8]
      ),
      value: (
        /*value*/
        t[0]
      )
    }
  }), e.$on(
    "share",
    /*share_handler*/
    t[9]
  ), e.$on(
    "error",
    /*error_handler*/
    t[10]
  ), {
    c() {
      at(e.$$.fragment);
    },
    m(r, i) {
      st(e, r, i), n = !0;
    },
    p(r, i) {
      const o = {};
      i & /*i18n*/
      64 && (o.i18n = /*i18n*/
      r[6]), i & /*value*/
      1 && (o.value = /*value*/
      r[0]), e.$set(o);
    },
    i(r) {
      n || (ce(e.$$.fragment, r), n = !0);
    },
    o(r) {
      ve(e.$$.fragment, r), n = !1;
    },
    d(r) {
      lt(e, r);
    }
  };
}
function Mc(t) {
  let e, n;
  return e = new En({}), {
    c() {
      at(e.$$.fragment);
    },
    m(r, i) {
      st(e, r, i), n = !0;
    },
    i(r) {
      n || (ce(e.$$.fragment, r), n = !0);
    },
    o(r) {
      ve(e.$$.fragment, r), n = !1;
    },
    d(r) {
      lt(e, r);
    }
  };
}
function Dc(t) {
  let e, n, r, i, o, a;
  e = new Wr({
    props: {
      show_label: (
        /*show_label*/
        t[2]
      ),
      Icon: En,
      label: (
        /*label*/
        t[1] || /*i18n*/
        t[6]("image.image")
      )
    }
  });
  const s = [Lc, Oc], l = [];
  function c(u, f) {
    return (
      /*value*/
      u[0] === null || !/*value*/
      u[0].url ? 0 : 1
    );
  }
  return r = c(t), i = l[r] = s[r](t), {
    c() {
      at(e.$$.fragment), n = Pr(), i.c(), o = Cc();
    },
    m(u, f) {
      st(e, u, f), Ut(u, n, f), l[r].m(u, f), Ut(u, o, f), a = !0;
    },
    p(u, [f]) {
      const h = {};
      f & /*show_label*/
      4 && (h.show_label = /*show_label*/
      u[2]), f & /*label, i18n*/
      66 && (h.label = /*label*/
      u[1] || /*i18n*/
      u[6]("image.image")), e.$set(h);
      let _ = r;
      r = c(u), r === _ ? l[r].p(u, f) : (Hr(), ve(l[_], 1, 1, () => {
        l[_] = null;
      }), Cr(), i = l[r], i ? i.p(u, f) : (i = l[r] = s[r](u), i.c()), ce(i, 1), i.m(o.parentNode, o));
    },
    i(u) {
      a || (ce(e.$$.fragment, u), ce(i), a = !0);
    },
    o(u) {
      ve(e.$$.fragment, u), ve(i), a = !1;
    },
    d(u) {
      u && (Dt(n), Dt(o)), lt(e, u), l[r].d(u);
    }
  };
}
function Uc(t, e, n) {
  let { value: r } = e, { label: i = void 0 } = e, { show_label: o } = e, { show_download_button: a = !0 } = e, { selectable: s = !1 } = e, { show_share_button: l = !1 } = e, { i18n: c } = e;
  const u = Nc(), f = (m) => {
    let v = Bo(m);
    v && u("select", { index: v, value: null });
  }, h = async (m) => m ? `<img src="${await Oa(m, "base64")}" />` : "";
  function _(m) {
    Li.call(this, t, m);
  }
  function g(m) {
    Li.call(this, t, m);
  }
  return t.$$set = (m) => {
    "value" in m && n(0, r = m.value), "label" in m && n(1, i = m.label), "show_label" in m && n(2, o = m.show_label), "show_download_button" in m && n(3, a = m.show_download_button), "selectable" in m && n(4, s = m.selectable), "show_share_button" in m && n(5, l = m.show_share_button), "i18n" in m && n(6, c = m.i18n);
  }, [
    r,
    i,
    o,
    a,
    s,
    l,
    c,
    f,
    h,
    _,
    g
  ];
}
class xc extends Bc {
  constructor(e) {
    super(), Hc(this, e, Uc, Dc, Ic, {
      value: 0,
      label: 1,
      show_label: 2,
      show_download_button: 3,
      selectable: 4,
      show_share_button: 5,
      i18n: 6
    });
  }
}
function bt() {
}
function Gc(t) {
  return t();
}
function Fc(t) {
  t.forEach(Gc);
}
function jc(t) {
  return typeof t == "function";
}
function qc(t, e) {
  return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function";
}
function zc(t, ...e) {
  if (t == null) {
    for (const r of e)
      r(void 0);
    return bt;
  }
  const n = t.subscribe(...e);
  return n.unsubscribe ? () => n.unsubscribe() : n;
}
const dt = [];
function Vc(t, e) {
  return {
    subscribe: Hn(t, e).subscribe
  };
}
function Hn(t, e = bt) {
  let n;
  const r = /* @__PURE__ */ new Set();
  function i(s) {
    if (qc(t, s) && (t = s, n)) {
      const l = !dt.length;
      for (const c of r)
        c[1](), dt.push(c, t);
      if (l) {
        for (let c = 0; c < dt.length; c += 2)
          dt[c][0](dt[c + 1]);
        dt.length = 0;
      }
    }
  }
  function o(s) {
    i(s(t));
  }
  function a(s, l = bt) {
    const c = [s, l];
    return r.add(c), r.size === 1 && (n = e(i, o) || bt), s(t), () => {
      r.delete(c), r.size === 0 && n && (n(), n = null);
    };
  }
  return { set: i, update: o, subscribe: a };
}
function Ct(t, e, n) {
  const r = !Array.isArray(t), i = r ? [t] : t;
  if (!i.every(Boolean))
    throw new Error("derived() expects stores as input, got a falsy value");
  const o = e.length < 2;
  return Vc(n, (a, s) => {
    let l = !1;
    const c = [];
    let u = 0, f = bt;
    const h = () => {
      if (u)
        return;
      f();
      const g = e(r ? c[0] : c, a, s);
      o ? a(g) : f = jc(g) ? g : bt;
    }, _ = i.map(
      (g, m) => zc(
        g,
        (v) => {
          c[m] = v, u &= ~(1 << m), l && h();
        },
        () => {
          u |= 1 << m;
        }
      )
    );
    return l = !0, h(), function() {
      Fc(_), f(), l = !1;
    };
  });
}
const {
  SvelteComponent: Wc,
  attr: Xc,
  create_component: Zc,
  destroy_component: Jc,
  detach: Qc,
  element: Yc,
  init: Kc,
  insert: $c,
  mount_component: ef,
  safe_not_equal: tf,
  toggle_class: mt,
  transition_in: nf,
  transition_out: rf
} = window.__gradio__svelte__internal;
function of(t) {
  var i;
  let e, n, r;
  return n = new Kr({
    props: {
      src: (
        /*samples_dir*/
        t[1] + /*value*/
        ((i = t[0]) == null ? void 0 : i.path)
      ),
      alt: ""
    }
  }), {
    c() {
      e = Yc("div"), Zc(n.$$.fragment), Xc(e, "class", "container svelte-wo3k18"), mt(
        e,
        "table",
        /*type*/
        t[2] === "table"
      ), mt(
        e,
        "gallery",
        /*type*/
        t[2] === "gallery"
      ), mt(
        e,
        "selected",
        /*selected*/
        t[3]
      );
    },
    m(o, a) {
      $c(o, e, a), ef(n, e, null), r = !0;
    },
    p(o, [a]) {
      var l;
      const s = {};
      a & /*samples_dir, value*/
      3 && (s.src = /*samples_dir*/
      o[1] + /*value*/
      ((l = o[0]) == null ? void 0 : l.path)), n.$set(s), (!r || a & /*type*/
      4) && mt(
        e,
        "table",
        /*type*/
        o[2] === "table"
      ), (!r || a & /*type*/
      4) && mt(
        e,
        "gallery",
        /*type*/
        o[2] === "gallery"
      ), (!r || a & /*selected*/
      8) && mt(
        e,
        "selected",
        /*selected*/
        o[3]
      );
    },
    i(o) {
      r || (nf(n.$$.fragment, o), r = !0);
    },
    o(o) {
      rf(n.$$.fragment, o), r = !1;
    },
    d(o) {
      o && Qc(e), Jc(n);
    }
  };
}
function af(t, e, n) {
  let { value: r } = e, { samples_dir: i } = e, { type: o } = e, { selected: a = !1 } = e;
  return t.$$set = (s) => {
    "value" in s && n(0, r = s.value), "samples_dir" in s && n(1, i = s.samples_dir), "type" in s && n(2, o = s.type), "selected" in s && n(3, a = s.selected);
  }, [r, i, o, a];
}
class F_ extends Wc {
  constructor(e) {
    super(), Kc(this, e, af, of, tf, {
      value: 0,
      samples_dir: 1,
      type: 2,
      selected: 3
    });
  }
}
const {
  SvelteComponent: lf,
  action_destroyer: sf,
  append: Re,
  attr: W,
  binding_callbacks: uf,
  check_outros: xt,
  create_component: Vt,
  destroy_component: Wt,
  destroy_each: cf,
  detach: we,
  element: Ee,
  empty: $r,
  ensure_array_like: Ui,
  group_outros: Gt,
  init: ff,
  insert: ye,
  is_function: hf,
  listen: Pn,
  mount_component: Xt,
  noop: _f,
  run_all: df,
  safe_not_equal: mf,
  set_data: qo,
  set_input_value: Ir,
  space: Ft,
  stop_propagation: gf,
  text: zo,
  toggle_class: xi,
  transition_in: te,
  transition_out: fe
} = window.__gradio__svelte__internal, { createEventDispatcher: pf, onMount: bf } = window.__gradio__svelte__internal;
function Gi(t, e, n) {
  const r = t.slice();
  return r[28] = e[n], r;
}
function Fi(t) {
  let e, n, r, i, o, a, s, l, c, u, f;
  const h = [wf, vf], _ = [];
  function g(b, y) {
    return (
      /*mode*/
      b[1] === "video" ? 0 : 1
    );
  }
  r = g(t), i = _[r] = h[r](t);
  let m = !/*recording*/
  t[6] && ji(t), v = (
    /*options_open*/
    t[8] && qi(t)
  );
  return {
    c() {
      e = Ee("div"), n = Ee("button"), i.c(), a = Ft(), m && m.c(), s = Ft(), v && v.c(), l = $r(), W(n, "aria-label", o = /*mode*/
      t[1] === "image" ? "capture photo" : "start recording"), W(n, "class", "svelte-1gj8oi8"), W(e, "class", "button-wrap svelte-1gj8oi8");
    },
    m(b, y) {
      ye(b, e, y), Re(e, n), _[r].m(n, null), Re(e, a), m && m.m(e, null), ye(b, s, y), v && v.m(b, y), ye(b, l, y), c = !0, u || (f = Pn(n, "click", function() {
        hf(
          /*mode*/
          t[1] === "image" ? (
            /*take_picture*/
            t[9]
          ) : (
            /*take_recording*/
            t[10]
          )
        ) && /*mode*/
        (t[1] === "image" ? (
          /*take_picture*/
          t[9]
        ) : (
          /*take_recording*/
          t[10]
        )).apply(this, arguments);
      }), u = !0);
    },
    p(b, y) {
      t = b;
      let C = r;
      r = g(t), r === C ? _[r].p(t, y) : (Gt(), fe(_[C], 1, 1, () => {
        _[C] = null;
      }), xt(), i = _[r], i ? i.p(t, y) : (i = _[r] = h[r](t), i.c()), te(i, 1), i.m(n, null)), (!c || y & /*mode*/
      2 && o !== (o = /*mode*/
      t[1] === "image" ? "capture photo" : "start recording")) && W(n, "aria-label", o), /*recording*/
      t[6] ? m && (Gt(), fe(m, 1, 1, () => {
        m = null;
      }), xt()) : m ? (m.p(t, y), y & /*recording*/
      64 && te(m, 1)) : (m = ji(t), m.c(), te(m, 1), m.m(e, null)), /*options_open*/
      t[8] ? v ? (v.p(t, y), y & /*options_open*/
      256 && te(v, 1)) : (v = qi(t), v.c(), te(v, 1), v.m(l.parentNode, l)) : v && (Gt(), fe(v, 1, 1, () => {
        v = null;
      }), xt());
    },
    i(b) {
      c || (te(i), te(m), te(v), c = !0);
    },
    o(b) {
      fe(i), fe(m), fe(v), c = !1;
    },
    d(b) {
      b && (we(e), we(s), we(l)), _[r].d(), m && m.d(), v && v.d(b), u = !1, f();
    }
  };
}
function vf(t) {
  let e, n, r;
  return n = new Jl({}), {
    c() {
      e = Ee("div"), Vt(n.$$.fragment), W(e, "class", "icon svelte-1gj8oi8"), W(e, "title", "capture photo");
    },
    m(i, o) {
      ye(i, e, o), Xt(n, e, null), r = !0;
    },
    p: _f,
    i(i) {
      r || (te(n.$$.fragment, i), r = !0);
    },
    o(i) {
      fe(n.$$.fragment, i), r = !1;
    },
    d(i) {
      i && we(e), Wt(n);
    }
  };
}
function wf(t) {
  let e, n, r, i;
  const o = [Ef, yf], a = [];
  function s(l, c) {
    return (
      /*recording*/
      l[6] ? 0 : 1
    );
  }
  return e = s(t), n = a[e] = o[e](t), {
    c() {
      n.c(), r = $r();
    },
    m(l, c) {
      a[e].m(l, c), ye(l, r, c), i = !0;
    },
    p(l, c) {
      let u = e;
      e = s(l), e !== u && (Gt(), fe(a[u], 1, 1, () => {
        a[u] = null;
      }), xt(), n = a[e], n || (n = a[e] = o[e](l), n.c()), te(n, 1), n.m(r.parentNode, r));
    },
    i(l) {
      i || (te(n), i = !0);
    },
    o(l) {
      fe(n), i = !1;
    },
    d(l) {
      l && we(r), a[e].d(l);
    }
  };
}
function yf(t) {
  let e, n, r;
  return n = new rs({}), {
    c() {
      e = Ee("div"), Vt(n.$$.fragment), W(e, "class", "icon red svelte-1gj8oi8"), W(e, "title", "start recording");
    },
    m(i, o) {
      ye(i, e, o), Xt(n, e, null), r = !0;
    },
    i(i) {
      r || (te(n.$$.fragment, i), r = !0);
    },
    o(i) {
      fe(n.$$.fragment, i), r = !1;
    },
    d(i) {
      i && we(e), Wt(n);
    }
  };
}
function Ef(t) {
  let e, n, r;
  return n = new su({}), {
    c() {
      e = Ee("div"), Vt(n.$$.fragment), W(e, "class", "icon red svelte-1gj8oi8"), W(e, "title", "stop recording");
    },
    m(i, o) {
      ye(i, e, o), Xt(n, e, null), r = !0;
    },
    i(i) {
      r || (te(n.$$.fragment, i), r = !0);
    },
    o(i) {
      fe(n.$$.fragment, i), r = !1;
    },
    d(i) {
      i && we(e), Wt(n);
    }
  };
}
function ji(t) {
  let e, n, r, i, o, a, s;
  return r = new Ao({}), {
    c() {
      e = Ee("button"), n = Ee("div"), Vt(r.$$.fragment), W(n, "class", "icon svelte-1gj8oi8"), W(n, "title", "select video source"), W(e, "aria-label", i = /*mode*/
      t[1] === "image" ? "capture photo" : "start recording"), W(e, "class", "svelte-1gj8oi8");
    },
    m(l, c) {
      ye(l, e, c), Re(e, n), Xt(r, n, null), o = !0, a || (s = Pn(
        e,
        "click",
        /*select_source*/
        t[11]
      ), a = !0);
    },
    p(l, c) {
      (!o || c & /*mode*/
      2 && i !== (i = /*mode*/
      l[1] === "image" ? "capture photo" : "start recording")) && W(e, "aria-label", i);
    },
    i(l) {
      o || (te(r.$$.fragment, l), o = !0);
    },
    o(l) {
      fe(r.$$.fragment, l), o = !1;
    },
    d(l) {
      l && we(e), Wt(r), a = !1, s();
    }
  };
}
function qi(t) {
  let e, n, r, i, o, a, s;
  r = new Ao({});
  function l(f, h) {
    return (
      /*video_sources*/
      f[7].length === 0 ? kf : Sf
    );
  }
  let c = l(t), u = c(t);
  return {
    c() {
      e = Ee("select"), n = Ee("button"), Vt(r.$$.fragment), i = Ft(), u.c(), W(n, "class", "inset-icon svelte-1gj8oi8"), W(e, "class", "select-wrap svelte-1gj8oi8"), W(e, "aria-label", "select source");
    },
    m(f, h) {
      ye(f, e, h), Re(e, n), Xt(r, n, null), Re(n, i), u.m(e, null), o = !0, a || (s = [
        Pn(n, "click", gf(
          /*click_handler*/
          t[18]
        )),
        sf(ei.call(
          null,
          e,
          /*handle_click_outside*/
          t[13]
        ))
      ], a = !0);
    },
    p(f, h) {
      c === (c = l(f)) && u ? u.p(f, h) : (u.d(1), u = c(f), u && (u.c(), u.m(e, null)));
    },
    i(f) {
      o || (te(r.$$.fragment, f), o = !0);
    },
    o(f) {
      fe(r.$$.fragment, f), o = !1;
    },
    d(f) {
      f && we(e), Wt(r), u.d(), a = !1, df(s);
    }
  };
}
function Sf(t) {
  let e, n = Ui(
    /*video_sources*/
    t[7]
  ), r = [];
  for (let i = 0; i < n.length; i += 1)
    r[i] = zi(Gi(t, n, i));
  return {
    c() {
      for (let i = 0; i < r.length; i += 1)
        r[i].c();
      e = $r();
    },
    m(i, o) {
      for (let a = 0; a < r.length; a += 1)
        r[a] && r[a].m(i, o);
      ye(i, e, o);
    },
    p(i, o) {
      if (o & /*video_sources, selectVideoSource*/
      4224) {
        n = Ui(
          /*video_sources*/
          i[7]
        );
        let a;
        for (a = 0; a < n.length; a += 1) {
          const s = Gi(i, n, a);
          r[a] ? r[a].p(s, o) : (r[a] = zi(s), r[a].c(), r[a].m(e.parentNode, e));
        }
        for (; a < r.length; a += 1)
          r[a].d(1);
        r.length = n.length;
      }
    },
    d(i) {
      i && we(e), cf(r, i);
    }
  };
}
function kf(t) {
  let e, n = (
    /*i18n*/
    t[3]("common.no_devices") + ""
  ), r;
  return {
    c() {
      e = Ee("option"), r = zo(n), e.__value = "", Ir(e, e.__value), W(e, "class", "svelte-1gj8oi8");
    },
    m(i, o) {
      ye(i, e, o), Re(e, r);
    },
    p(i, o) {
      o & /*i18n*/
      8 && n !== (n = /*i18n*/
      i[3]("common.no_devices") + "") && qo(r, n);
    },
    d(i) {
      i && we(e);
    }
  };
}
function zi(t) {
  let e, n = (
    /*source*/
    t[28].label + ""
  ), r, i, o, a, s;
  function l() {
    return (
      /*click_handler_1*/
      t[19](
        /*source*/
        t[28]
      )
    );
  }
  return {
    c() {
      e = Ee("option"), r = zo(n), i = Ft(), e.__value = o = `
							` + /*source*/
      t[28].label + `
						`, Ir(e, e.__value), W(e, "class", "svelte-1gj8oi8");
    },
    m(c, u) {
      ye(c, e, u), Re(e, r), Re(e, i), a || (s = Pn(e, "click", l), a = !0);
    },
    p(c, u) {
      t = c, u & /*video_sources*/
      128 && n !== (n = /*source*/
      t[28].label + "") && qo(r, n), u & /*video_sources*/
      128 && o !== (o = `
							` + /*source*/
      t[28].label + `
						`) && (e.__value = o, Ir(e, e.__value));
    },
    d(c) {
      c && we(e), a = !1, s();
    }
  };
}
function Tf(t) {
  let e, n, r, i, o = !/*streaming*/
  t[0] && Fi(t);
  return {
    c() {
      e = Ee("div"), n = Ee("video"), r = Ft(), o && o.c(), W(n, "class", "svelte-1gj8oi8"), xi(
        n,
        "flip",
        /*mirror_webcam*/
        t[2]
      ), W(e, "class", "wrap svelte-1gj8oi8");
    },
    m(a, s) {
      ye(a, e, s), Re(e, n), t[17](n), Re(e, r), o && o.m(e, null), i = !0;
    },
    p(a, [s]) {
      (!i || s & /*mirror_webcam*/
      4) && xi(
        n,
        "flip",
        /*mirror_webcam*/
        a[2]
      ), /*streaming*/
      a[0] ? o && (Gt(), fe(o, 1, 1, () => {
        o = null;
      }), xt()) : o ? (o.p(a, s), s & /*streaming*/
      1 && te(o, 1)) : (o = Fi(a), o.c(), te(o, 1), o.m(e, null));
    },
    i(a) {
      i || (te(o), i = !0);
    },
    o(a) {
      fe(o), i = !1;
    },
    d(a) {
      a && we(e), t[17](null), o && o.d();
    }
  };
}
async function Af(t) {
  let e, n = t[0], r = 1;
  for (; r < t.length; ) {
    const i = t[r], o = t[r + 1];
    if (r += 2, (i === "optionalAccess" || i === "optionalCall") && n == null)
      return;
    i === "access" || i === "optionalAccess" ? (e = n, n = await o(n)) : (i === "call" || i === "optionalCall") && (n = await o((...a) => n.call(e, ...a)), e = void 0);
  }
  return n;
}
function ei(t, e) {
  const n = (r) => {
    t && !t.contains(r.target) && !r.defaultPrevented && e(r);
  };
  return document.addEventListener("click", n, !0), {
    destroy() {
      document.removeEventListener("click", n, !0);
    }
  };
}
function Bf(t, e, n) {
  let r, i, { streaming: o = !1 } = e, { pending: a = !1 } = e, { root: s = "" } = e, { mode: l = "image" } = e, { mirror_webcam: c } = e, { include_audio: u } = e, { i18n: f } = e;
  const h = pf();
  bf(() => i = document.createElement("canvas"));
  const _ = {
    width: { ideal: 1920 },
    height: { ideal: 1440 }
  };
  async function g(T) {
    if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {
      h("error", f("image.no_webcam_support"));
      return;
    }
    try {
      y = await navigator.mediaDevices.getUserMedia({
        video: T ? { deviceId: { exact: T }, ..._ } : _,
        audio: u
      }), n(5, r.srcObject = y, r), n(5, r.muted = !0, r), r.play();
    } catch (j) {
      if (j instanceof DOMException && j.name == "NotAllowedError")
        h("error", f("image.allow_webcam_access"));
      else
        throw j;
    }
  }
  function m() {
    var T = i.getContext("2d");
    r.videoWidth && r.videoHeight && (i.width = r.videoWidth, i.height = r.videoHeight, T.drawImage(r, 0, 0, r.videoWidth, r.videoHeight), c && (T.scale(-1, 1), T.drawImage(r, -r.videoWidth, 0)), i.toBlob(
      (j) => {
        h(o ? "stream" : "capture", j);
      },
      "image/png",
      0.8
    ));
  }
  let v = !1, b = [], y, C, H;
  function I() {
    if (v) {
      H.stop();
      let T = new Blob(b, { type: C }), j = new FileReader();
      j.onload = async function(Ie) {
        if (Ie.target) {
          let E = new File([T], "sample." + C.substring(6));
          const Me = await Go([E]);
          let Je = (await Af([
            await xo(Me, s),
            "optionalAccess",
            async (Ne) => Ne.filter,
            "call",
            async (Ne) => Ne(Boolean)
          ]))[0];
          h("capture", Je), h("stop_recording");
        }
      }, j.readAsDataURL(T);
    } else {
      h("start_recording"), b = [];
      let T = ["video/webm", "video/mp4"];
      for (let j of T)
        if (MediaRecorder.isTypeSupported(j)) {
          C = j;
          break;
        }
      if (C === null) {
        console.error("No supported MediaRecorder mimeType");
        return;
      }
      H = new MediaRecorder(y, { mimeType: C }), H.addEventListener("dataavailable", function(j) {
        b.push(j.data);
      }), H.start(200);
    }
    n(6, v = !v);
  }
  g(), o && l === "image" && window.setInterval(
    () => {
      r && !a && m();
    },
    500
  );
  async function p() {
    const T = await navigator.mediaDevices.enumerateDevices();
    n(7, D = T.filter((j) => j.kind === "videoinput")), n(8, w = !0);
  }
  let D = [];
  async function S(T) {
    await g(T), n(8, w = !1);
  }
  let w = !1;
  function Z(T) {
    T.preventDefault(), T.stopPropagation(), n(8, w = !1);
  }
  function G(T) {
    uf[T ? "unshift" : "push"](() => {
      r = T, n(5, r);
    });
  }
  const le = () => n(8, w = !1), ne = (T) => S(T.deviceId);
  return t.$$set = (T) => {
    "streaming" in T && n(0, o = T.streaming), "pending" in T && n(14, a = T.pending), "root" in T && n(15, s = T.root), "mode" in T && n(1, l = T.mode), "mirror_webcam" in T && n(2, c = T.mirror_webcam), "include_audio" in T && n(16, u = T.include_audio), "i18n" in T && n(3, f = T.i18n);
  }, [
    o,
    l,
    c,
    f,
    ei,
    r,
    v,
    D,
    w,
    m,
    I,
    p,
    S,
    Z,
    a,
    s,
    u,
    G,
    le,
    ne
  ];
}
class Cf extends lf {
  constructor(e) {
    super(), ff(this, e, Bf, Tf, mf, {
      streaming: 0,
      pending: 14,
      root: 15,
      mode: 1,
      mirror_webcam: 2,
      include_audio: 16,
      i18n: 3,
      click_outside: 4
    });
  }
  get click_outside() {
    return ei;
  }
}
function Hf(t) {
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
}
var Pf = function(e) {
  return If(e) && !Nf(e);
};
function If(t) {
  return !!t && typeof t == "object";
}
function Nf(t) {
  var e = Object.prototype.toString.call(t);
  return e === "[object RegExp]" || e === "[object Date]" || Rf(t);
}
var Of = typeof Symbol == "function" && Symbol.for, Lf = Of ? Symbol.for("react.element") : 60103;
function Rf(t) {
  return t.$$typeof === Lf;
}
function Mf(t) {
  return Array.isArray(t) ? [] : {};
}
function jt(t, e) {
  return e.clone !== !1 && e.isMergeableObject(t) ? vt(Mf(t), t, e) : t;
}
function Df(t, e, n) {
  return t.concat(e).map(function(r) {
    return jt(r, n);
  });
}
function Uf(t, e) {
  if (!e.customMerge)
    return vt;
  var n = e.customMerge(t);
  return typeof n == "function" ? n : vt;
}
function xf(t) {
  return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(t).filter(function(e) {
    return Object.propertyIsEnumerable.call(t, e);
  }) : [];
}
function Vi(t) {
  return Object.keys(t).concat(xf(t));
}
function Vo(t, e) {
  try {
    return e in t;
  } catch {
    return !1;
  }
}
function Gf(t, e) {
  return Vo(t, e) && !(Object.hasOwnProperty.call(t, e) && Object.propertyIsEnumerable.call(t, e));
}
function Ff(t, e, n) {
  var r = {};
  return n.isMergeableObject(t) && Vi(t).forEach(function(i) {
    r[i] = jt(t[i], n);
  }), Vi(e).forEach(function(i) {
    Gf(t, i) || (Vo(t, i) && n.isMergeableObject(e[i]) ? r[i] = Uf(i, n)(t[i], e[i], n) : r[i] = jt(e[i], n));
  }), r;
}
function vt(t, e, n) {
  n = n || {}, n.arrayMerge = n.arrayMerge || Df, n.isMergeableObject = n.isMergeableObject || Pf, n.cloneUnlessOtherwiseSpecified = jt;
  var r = Array.isArray(e), i = Array.isArray(t), o = r === i;
  return o ? r ? n.arrayMerge(t, e, n) : Ff(t, e, n) : jt(e, n);
}
vt.all = function(e, n) {
  if (!Array.isArray(e))
    throw new Error("first argument should be an array");
  return e.reduce(function(r, i) {
    return vt(r, i, n);
  }, {});
};
var jf = vt, qf = jf;
const zf = /* @__PURE__ */ Hf(qf);
var Nr = function(t, e) {
  return Nr = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
    n.__proto__ = r;
  } || function(n, r) {
    for (var i in r)
      Object.prototype.hasOwnProperty.call(r, i) && (n[i] = r[i]);
  }, Nr(t, e);
};
function In(t, e) {
  if (typeof e != "function" && e !== null)
    throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
  Nr(t, e);
  function n() {
    this.constructor = t;
  }
  t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
}
var M = function() {
  return M = Object.assign || function(e) {
    for (var n, r = 1, i = arguments.length; r < i; r++) {
      n = arguments[r];
      for (var o in n)
        Object.prototype.hasOwnProperty.call(n, o) && (e[o] = n[o]);
    }
    return e;
  }, M.apply(this, arguments);
};
function mr(t, e, n) {
  if (n || arguments.length === 2)
    for (var r = 0, i = e.length, o; r < i; r++)
      (o || !(r in e)) && (o || (o = Array.prototype.slice.call(e, 0, r)), o[r] = e[r]);
  return t.concat(o || Array.prototype.slice.call(e));
}
var P;
(function(t) {
  t[t.EXPECT_ARGUMENT_CLOSING_BRACE = 1] = "EXPECT_ARGUMENT_CLOSING_BRACE", t[t.EMPTY_ARGUMENT = 2] = "EMPTY_ARGUMENT", t[t.MALFORMED_ARGUMENT = 3] = "MALFORMED_ARGUMENT", t[t.EXPECT_ARGUMENT_TYPE = 4] = "EXPECT_ARGUMENT_TYPE", t[t.INVALID_ARGUMENT_TYPE = 5] = "INVALID_ARGUMENT_TYPE", t[t.EXPECT_ARGUMENT_STYLE = 6] = "EXPECT_ARGUMENT_STYLE", t[t.INVALID_NUMBER_SKELETON = 7] = "INVALID_NUMBER_SKELETON", t[t.INVALID_DATE_TIME_SKELETON = 8] = "INVALID_DATE_TIME_SKELETON", t[t.EXPECT_NUMBER_SKELETON = 9] = "EXPECT_NUMBER_SKELETON", t[t.EXPECT_DATE_TIME_SKELETON = 10] = "EXPECT_DATE_TIME_SKELETON", t[t.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE = 11] = "UNCLOSED_QUOTE_IN_ARGUMENT_STYLE", t[t.EXPECT_SELECT_ARGUMENT_OPTIONS = 12] = "EXPECT_SELECT_ARGUMENT_OPTIONS", t[t.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE = 13] = "EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE", t[t.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE = 14] = "INVALID_PLURAL_ARGUMENT_OFFSET_VALUE", t[t.EXPECT_SELECT_ARGUMENT_SELECTOR = 15] = "EXPECT_SELECT_ARGUMENT_SELECTOR", t[t.EXPECT_PLURAL_ARGUMENT_SELECTOR = 16] = "EXPECT_PLURAL_ARGUMENT_SELECTOR", t[t.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT = 17] = "EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT", t[t.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT = 18] = "EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT", t[t.INVALID_PLURAL_ARGUMENT_SELECTOR = 19] = "INVALID_PLURAL_ARGUMENT_SELECTOR", t[t.DUPLICATE_PLURAL_ARGUMENT_SELECTOR = 20] = "DUPLICATE_PLURAL_ARGUMENT_SELECTOR", t[t.DUPLICATE_SELECT_ARGUMENT_SELECTOR = 21] = "DUPLICATE_SELECT_ARGUMENT_SELECTOR", t[t.MISSING_OTHER_CLAUSE = 22] = "MISSING_OTHER_CLAUSE", t[t.INVALID_TAG = 23] = "INVALID_TAG", t[t.INVALID_TAG_NAME = 25] = "INVALID_TAG_NAME", t[t.UNMATCHED_CLOSING_TAG = 26] = "UNMATCHED_CLOSING_TAG", t[t.UNCLOSED_TAG = 27] = "UNCLOSED_TAG";
})(P || (P = {}));
var F;
(function(t) {
  t[t.literal = 0] = "literal", t[t.argument = 1] = "argument", t[t.number = 2] = "number", t[t.date = 3] = "date", t[t.time = 4] = "time", t[t.select = 5] = "select", t[t.plural = 6] = "plural", t[t.pound = 7] = "pound", t[t.tag = 8] = "tag";
})(F || (F = {}));
var wt;
(function(t) {
  t[t.number = 0] = "number", t[t.dateTime = 1] = "dateTime";
})(wt || (wt = {}));
function Wi(t) {
  return t.type === F.literal;
}
function Vf(t) {
  return t.type === F.argument;
}
function Wo(t) {
  return t.type === F.number;
}
function Xo(t) {
  return t.type === F.date;
}
function Zo(t) {
  return t.type === F.time;
}
function Jo(t) {
  return t.type === F.select;
}
function Qo(t) {
  return t.type === F.plural;
}
function Wf(t) {
  return t.type === F.pound;
}
function Yo(t) {
  return t.type === F.tag;
}
function Ko(t) {
  return !!(t && typeof t == "object" && t.type === wt.number);
}
function Or(t) {
  return !!(t && typeof t == "object" && t.type === wt.dateTime);
}
var $o = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/, Xf = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;
function Zf(t) {
  var e = {};
  return t.replace(Xf, function(n) {
    var r = n.length;
    switch (n[0]) {
      case "G":
        e.era = r === 4 ? "long" : r === 5 ? "narrow" : "short";
        break;
      case "y":
        e.year = r === 2 ? "2-digit" : "numeric";
        break;
      case "Y":
      case "u":
      case "U":
      case "r":
        throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");
      case "q":
      case "Q":
        throw new RangeError("`q/Q` (quarter) patterns are not supported");
      case "M":
      case "L":
        e.month = ["numeric", "2-digit", "short", "long", "narrow"][r - 1];
        break;
      case "w":
      case "W":
        throw new RangeError("`w/W` (week) patterns are not supported");
      case "d":
        e.day = ["numeric", "2-digit"][r - 1];
        break;
      case "D":
      case "F":
      case "g":
        throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");
      case "E":
        e.weekday = r === 4 ? "short" : r === 5 ? "narrow" : "short";
        break;
      case "e":
        if (r < 4)
          throw new RangeError("`e..eee` (weekday) patterns are not supported");
        e.weekday = ["short", "long", "narrow", "short"][r - 4];
        break;
      case "c":
        if (r < 4)
          throw new RangeError("`c..ccc` (weekday) patterns are not supported");
        e.weekday = ["short", "long", "narrow", "short"][r - 4];
        break;
      case "a":
        e.hour12 = !0;
        break;
      case "b":
      case "B":
        throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");
      case "h":
        e.hourCycle = "h12", e.hour = ["numeric", "2-digit"][r - 1];
        break;
      case "H":
        e.hourCycle = "h23", e.hour = ["numeric", "2-digit"][r - 1];
        break;
      case "K":
        e.hourCycle = "h11", e.hour = ["numeric", "2-digit"][r - 1];
        break;
      case "k":
        e.hourCycle = "h24", e.hour = ["numeric", "2-digit"][r - 1];
        break;
      case "j":
      case "J":
      case "C":
        throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");
      case "m":
        e.minute = ["numeric", "2-digit"][r - 1];
        break;
      case "s":
        e.second = ["numeric", "2-digit"][r - 1];
        break;
      case "S":
      case "A":
        throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead");
      case "z":
        e.timeZoneName = r < 4 ? "short" : "long";
        break;
      case "Z":
      case "O":
      case "v":
      case "V":
      case "X":
      case "x":
        throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead");
    }
    return "";
  }), e;
}
var Jf = /[\t-\r \x85\u200E\u200F\u2028\u2029]/i;
function Qf(t) {
  if (t.length === 0)
    throw new Error("Number skeleton cannot be empty");
  for (var e = t.split(Jf).filter(function(h) {
    return h.length > 0;
  }), n = [], r = 0, i = e; r < i.length; r++) {
    var o = i[r], a = o.split("/");
    if (a.length === 0)
      throw new Error("Invalid number skeleton");
    for (var s = a[0], l = a.slice(1), c = 0, u = l; c < u.length; c++) {
      var f = u[c];
      if (f.length === 0)
        throw new Error("Invalid number skeleton");
    }
    n.push({ stem: s, options: l });
  }
  return n;
}
function Yf(t) {
  return t.replace(/^(.*?)-/, "");
}
var Xi = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g, ea = /^(@+)?(\+|#+)?[rs]?$/g, Kf = /(\*)(0+)|(#+)(0+)|(0+)/g, ta = /^(0+)$/;
function Zi(t) {
  var e = {};
  return t[t.length - 1] === "r" ? e.roundingPriority = "morePrecision" : t[t.length - 1] === "s" && (e.roundingPriority = "lessPrecision"), t.replace(ea, function(n, r, i) {
    return typeof i != "string" ? (e.minimumSignificantDigits = r.length, e.maximumSignificantDigits = r.length) : i === "+" ? e.minimumSignificantDigits = r.length : r[0] === "#" ? e.maximumSignificantDigits = r.length : (e.minimumSignificantDigits = r.length, e.maximumSignificantDigits = r.length + (typeof i == "string" ? i.length : 0)), "";
  }), e;
}
function na(t) {
  switch (t) {
    case "sign-auto":
      return {
        signDisplay: "auto"
      };
    case "sign-accounting":
    case "()":
      return {
        currencySign: "accounting"
      };
    case "sign-always":
    case "+!":
      return {
        signDisplay: "always"
      };
    case "sign-accounting-always":
    case "()!":
      return {
        signDisplay: "always",
        currencySign: "accounting"
      };
    case "sign-except-zero":
    case "+?":
      return {
        signDisplay: "exceptZero"
      };
    case "sign-accounting-except-zero":
    case "()?":
      return {
        signDisplay: "exceptZero",
        currencySign: "accounting"
      };
    case "sign-never":
    case "+_":
      return {
        signDisplay: "never"
      };
  }
}
function $f(t) {
  var e;
  if (t[0] === "E" && t[1] === "E" ? (e = {
    notation: "engineering"
  }, t = t.slice(2)) : t[0] === "E" && (e = {
    notation: "scientific"
  }, t = t.slice(1)), e) {
    var n = t.slice(0, 2);
    if (n === "+!" ? (e.signDisplay = "always", t = t.slice(2)) : n === "+?" && (e.signDisplay = "exceptZero", t = t.slice(2)), !ta.test(t))
      throw new Error("Malformed concise eng/scientific notation");
    e.minimumIntegerDigits = t.length;
  }
  return e;
}
function Ji(t) {
  var e = {}, n = na(t);
  return n || e;
}
function eh(t) {
  for (var e = {}, n = 0, r = t; n < r.length; n++) {
    var i = r[n];
    switch (i.stem) {
      case "percent":
      case "%":
        e.style = "percent";
        continue;
      case "%x100":
        e.style = "percent", e.scale = 100;
        continue;
      case "currency":
        e.style = "currency", e.currency = i.options[0];
        continue;
      case "group-off":
      case ",_":
        e.useGrouping = !1;
        continue;
      case "precision-integer":
      case ".":
        e.maximumFractionDigits = 0;
        continue;
      case "measure-unit":
      case "unit":
        e.style = "unit", e.unit = Yf(i.options[0]);
        continue;
      case "compact-short":
      case "K":
        e.notation = "compact", e.compactDisplay = "short";
        continue;
      case "compact-long":
      case "KK":
        e.notation = "compact", e.compactDisplay = "long";
        continue;
      case "scientific":
        e = M(M(M({}, e), { notation: "scientific" }), i.options.reduce(function(l, c) {
          return M(M({}, l), Ji(c));
        }, {}));
        continue;
      case "engineering":
        e = M(M(M({}, e), { notation: "engineering" }), i.options.reduce(function(l, c) {
          return M(M({}, l), Ji(c));
        }, {}));
        continue;
      case "notation-simple":
        e.notation = "standard";
        continue;
      case "unit-width-narrow":
        e.currencyDisplay = "narrowSymbol", e.unitDisplay = "narrow";
        continue;
      case "unit-width-short":
        e.currencyDisplay = "code", e.unitDisplay = "short";
        continue;
      case "unit-width-full-name":
        e.currencyDisplay = "name", e.unitDisplay = "long";
        continue;
      case "unit-width-iso-code":
        e.currencyDisplay = "symbol";
        continue;
      case "scale":
        e.scale = parseFloat(i.options[0]);
        continue;
      case "integer-width":
        if (i.options.length > 1)
          throw new RangeError("integer-width stems only accept a single optional option");
        i.options[0].replace(Kf, function(l, c, u, f, h, _) {
          if (c)
            e.minimumIntegerDigits = u.length;
          else {
            if (f && h)
              throw new Error("We currently do not support maximum integer digits");
            if (_)
              throw new Error("We currently do not support exact integer digits");
          }
          return "";
        });
        continue;
    }
    if (ta.test(i.stem)) {
      e.minimumIntegerDigits = i.stem.length;
      continue;
    }
    if (Xi.test(i.stem)) {
      if (i.options.length > 1)
        throw new RangeError("Fraction-precision stems only accept a single optional option");
      i.stem.replace(Xi, function(l, c, u, f, h, _) {
        return u === "*" ? e.minimumFractionDigits = c.length : f && f[0] === "#" ? e.maximumFractionDigits = f.length : h && _ ? (e.minimumFractionDigits = h.length, e.maximumFractionDigits = h.length + _.length) : (e.minimumFractionDigits = c.length, e.maximumFractionDigits = c.length), "";
      });
      var o = i.options[0];
      o === "w" ? e = M(M({}, e), { trailingZeroDisplay: "stripIfInteger" }) : o && (e = M(M({}, e), Zi(o)));
      continue;
    }
    if (ea.test(i.stem)) {
      e = M(M({}, e), Zi(i.stem));
      continue;
    }
    var a = na(i.stem);
    a && (e = M(M({}, e), a));
    var s = $f(i.stem);
    s && (e = M(M({}, e), s));
  }
  return e;
}
var on = {
  AX: [
    "H"
  ],
  BQ: [
    "H"
  ],
  CP: [
    "H"
  ],
  CZ: [
    "H"
  ],
  DK: [
    "H"
  ],
  FI: [
    "H"
  ],
  ID: [
    "H"
  ],
  IS: [
    "H"
  ],
  ML: [
    "H"
  ],
  NE: [
    "H"
  ],
  RU: [
    "H"
  ],
  SE: [
    "H"
  ],
  SJ: [
    "H"
  ],
  SK: [
    "H"
  ],
  AS: [
    "h",
    "H"
  ],
  BT: [
    "h",
    "H"
  ],
  DJ: [
    "h",
    "H"
  ],
  ER: [
    "h",
    "H"
  ],
  GH: [
    "h",
    "H"
  ],
  IN: [
    "h",
    "H"
  ],
  LS: [
    "h",
    "H"
  ],
  PG: [
    "h",
    "H"
  ],
  PW: [
    "h",
    "H"
  ],
  SO: [
    "h",
    "H"
  ],
  TO: [
    "h",
    "H"
  ],
  VU: [
    "h",
    "H"
  ],
  WS: [
    "h",
    "H"
  ],
  "001": [
    "H",
    "h"
  ],
  AL: [
    "h",
    "H",
    "hB"
  ],
  TD: [
    "h",
    "H",
    "hB"
  ],
  "ca-ES": [
    "H",
    "h",
    "hB"
  ],
  CF: [
    "H",
    "h",
    "hB"
  ],
  CM: [
    "H",
    "h",
    "hB"
  ],
  "fr-CA": [
    "H",
    "h",
    "hB"
  ],
  "gl-ES": [
    "H",
    "h",
    "hB"
  ],
  "it-CH": [
    "H",
    "h",
    "hB"
  ],
  "it-IT": [
    "H",
    "h",
    "hB"
  ],
  LU: [
    "H",
    "h",
    "hB"
  ],
  NP: [
    "H",
    "h",
    "hB"
  ],
  PF: [
    "H",
    "h",
    "hB"
  ],
  SC: [
    "H",
    "h",
    "hB"
  ],
  SM: [
    "H",
    "h",
    "hB"
  ],
  SN: [
    "H",
    "h",
    "hB"
  ],
  TF: [
    "H",
    "h",
    "hB"
  ],
  VA: [
    "H",
    "h",
    "hB"
  ],
  CY: [
    "h",
    "H",
    "hb",
    "hB"
  ],
  GR: [
    "h",
    "H",
    "hb",
    "hB"
  ],
  CO: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  DO: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  KP: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  KR: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  NA: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  PA: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  PR: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  VE: [
    "h",
    "H",
    "hB",
    "hb"
  ],
  AC: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  AI: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  BW: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  BZ: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  CC: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  CK: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  CX: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  DG: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  FK: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  GB: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  GG: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  GI: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  IE: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  IM: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  IO: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  JE: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  LT: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  MK: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  MN: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  MS: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  NF: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  NG: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  NR: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  NU: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  PN: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  SH: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  SX: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  TA: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  ZA: [
    "H",
    "h",
    "hb",
    "hB"
  ],
  "af-ZA": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  AR: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  CL: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  CR: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  CU: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  EA: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  "es-BO": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  "es-BR": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  "es-EC": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  "es-ES": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  "es-GQ": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  "es-PE": [
    "H",
    "h",
    "hB",
    "hb"
  ],
  GT: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  HN: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  IC: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  KG: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  KM: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  LK: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  MA: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  MX: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  NI: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  PY: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  SV: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  UY: [
    "H",
    "h",
    "hB",
    "hb"
  ],
  JP: [
    "H",
    "h",
    "K"
  ],
  AD: [
    "H",
    "hB"
  ],
  AM: [
    "H",
    "hB"
  ],
  AO: [
    "H",
    "hB"
  ],
  AT: [
    "H",
    "hB"
  ],
  AW: [
    "H",
    "hB"
  ],
  BE: [
    "H",
    "hB"
  ],
  BF: [
    "H",
    "hB"
  ],
  BJ: [
    "H",
    "hB"
  ],
  BL: [
    "H",
    "hB"
  ],
  BR: [
    "H",
    "hB"
  ],
  CG: [
    "H",
    "hB"
  ],
  CI: [
    "H",
    "hB"
  ],
  CV: [
    "H",
    "hB"
  ],
  DE: [
    "H",
    "hB"
  ],
  EE: [
    "H",
    "hB"
  ],
  FR: [
    "H",
    "hB"
  ],
  GA: [
    "H",
    "hB"
  ],
  GF: [
    "H",
    "hB"
  ],
  GN: [
    "H",
    "hB"
  ],
  GP: [
    "H",
    "hB"
  ],
  GW: [
    "H",
    "hB"
  ],
  HR: [
    "H",
    "hB"
  ],
  IL: [
    "H",
    "hB"
  ],
  IT: [
    "H",
    "hB"
  ],
  KZ: [
    "H",
    "hB"
  ],
  MC: [
    "H",
    "hB"
  ],
  MD: [
    "H",
    "hB"
  ],
  MF: [
    "H",
    "hB"
  ],
  MQ: [
    "H",
    "hB"
  ],
  MZ: [
    "H",
    "hB"
  ],
  NC: [
    "H",
    "hB"
  ],
  NL: [
    "H",
    "hB"
  ],
  PM: [
    "H",
    "hB"
  ],
  PT: [
    "H",
    "hB"
  ],
  RE: [
    "H",
    "hB"
  ],
  RO: [
    "H",
    "hB"
  ],
  SI: [
    "H",
    "hB"
  ],
  SR: [
    "H",
    "hB"
  ],
  ST: [
    "H",
    "hB"
  ],
  TG: [
    "H",
    "hB"
  ],
  TR: [
    "H",
    "hB"
  ],
  WF: [
    "H",
    "hB"
  ],
  YT: [
    "H",
    "hB"
  ],
  BD: [
    "h",
    "hB",
    "H"
  ],
  PK: [
    "h",
    "hB",
    "H"
  ],
  AZ: [
    "H",
    "hB",
    "h"
  ],
  BA: [
    "H",
    "hB",
    "h"
  ],
  BG: [
    "H",
    "hB",
    "h"
  ],
  CH: [
    "H",
    "hB",
    "h"
  ],
  GE: [
    "H",
    "hB",
    "h"
  ],
  LI: [
    "H",
    "hB",
    "h"
  ],
  ME: [
    "H",
    "hB",
    "h"
  ],
  RS: [
    "H",
    "hB",
    "h"
  ],
  UA: [
    "H",
    "hB",
    "h"
  ],
  UZ: [
    "H",
    "hB",
    "h"
  ],
  XK: [
    "H",
    "hB",
    "h"
  ],
  AG: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  AU: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  BB: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  BM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  BS: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  CA: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  DM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  "en-001": [
    "h",
    "hb",
    "H",
    "hB"
  ],
  FJ: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  FM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  GD: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  GM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  GU: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  GY: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  JM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  KI: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  KN: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  KY: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  LC: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  LR: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  MH: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  MP: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  MW: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  NZ: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  SB: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  SG: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  SL: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  SS: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  SZ: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  TC: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  TT: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  UM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  US: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  VC: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  VG: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  VI: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  ZM: [
    "h",
    "hb",
    "H",
    "hB"
  ],
  BO: [
    "H",
    "hB",
    "h",
    "hb"
  ],
  EC: [
    "H",
    "hB",
    "h",
    "hb"
  ],
  ES: [
    "H",
    "hB",
    "h",
    "hb"
  ],
  GQ: [
    "H",
    "hB",
    "h",
    "hb"
  ],
  PE: [
    "H",
    "hB",
    "h",
    "hb"
  ],
  AE: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  "ar-001": [
    "h",
    "hB",
    "hb",
    "H"
  ],
  BH: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  DZ: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  EG: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  EH: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  HK: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  IQ: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  JO: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  KW: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  LB: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  LY: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  MO: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  MR: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  OM: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  PH: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  PS: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  QA: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  SA: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  SD: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  SY: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  TN: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  YE: [
    "h",
    "hB",
    "hb",
    "H"
  ],
  AF: [
    "H",
    "hb",
    "hB",
    "h"
  ],
  LA: [
    "H",
    "hb",
    "hB",
    "h"
  ],
  CN: [
    "H",
    "hB",
    "hb",
    "h"
  ],
  LV: [
    "H",
    "hB",
    "hb",
    "h"
  ],
  TL: [
    "H",
    "hB",
    "hb",
    "h"
  ],
  "zu-ZA": [
    "H",
    "hB",
    "hb",
    "h"
  ],
  CD: [
    "hB",
    "H"
  ],
  IR: [
    "hB",
    "H"
  ],
  "hi-IN": [
    "hB",
    "h",
    "H"
  ],
  "kn-IN": [
    "hB",
    "h",
    "H"
  ],
  "ml-IN": [
    "hB",
    "h",
    "H"
  ],
  "te-IN": [
    "hB",
    "h",
    "H"
  ],
  KH: [
    "hB",
    "h",
    "H",
    "hb"
  ],
  "ta-IN": [
    "hB",
    "h",
    "hb",
    "H"
  ],
  BN: [
    "hb",
    "hB",
    "h",
    "H"
  ],
  MY: [
    "hb",
    "hB",
    "h",
    "H"
  ],
  ET: [
    "hB",
    "hb",
    "h",
    "H"
  ],
  "gu-IN": [
    "hB",
    "hb",
    "h",
    "H"
  ],
  "mr-IN": [
    "hB",
    "hb",
    "h",
    "H"
  ],
  "pa-IN": [
    "hB",
    "hb",
    "h",
    "H"
  ],
  TW: [
    "hB",
    "hb",
    "h",
    "H"
  ],
  KE: [
    "hB",
    "hb",
    "H",
    "h"
  ],
  MM: [
    "hB",
    "hb",
    "H",
    "h"
  ],
  TZ: [
    "hB",
    "hb",
    "H",
    "h"
  ],
  UG: [
    "hB",
    "hb",
    "H",
    "h"
  ]
};
function th(t, e) {
  for (var n = "", r = 0; r < t.length; r++) {
    var i = t.charAt(r);
    if (i === "j") {
      for (var o = 0; r + 1 < t.length && t.charAt(r + 1) === i; )
        o++, r++;
      var a = 1 + (o & 1), s = o < 2 ? 1 : 3 + (o >> 1), l = "a", c = nh(e);
      for ((c == "H" || c == "k") && (s = 0); s-- > 0; )
        n += l;
      for (; a-- > 0; )
        n = c + n;
    } else
      i === "J" ? n += "H" : n += i;
  }
  return n;
}
function nh(t) {
  var e = t.hourCycle;
  if (e === void 0 && // @ts-ignore hourCycle(s) is not identified yet
  t.hourCycles && // @ts-ignore
  t.hourCycles.length && (e = t.hourCycles[0]), e)
    switch (e) {
      case "h24":
        return "k";
      case "h23":
        return "H";
      case "h12":
        return "h";
      case "h11":
        return "K";
      default:
        throw new Error("Invalid hourCycle");
    }
  var n = t.language, r;
  n !== "root" && (r = t.maximize().region);
  var i = on[r || ""] || on[n || ""] || on["".concat(n, "-001")] || on["001"];
  return i[0];
}
var gr, rh = new RegExp("^".concat($o.source, "*")), ih = new RegExp("".concat($o.source, "*$"));
function N(t, e) {
  return { start: t, end: e };
}
var oh = !!String.prototype.startsWith, ah = !!String.fromCodePoint, lh = !!Object.fromEntries, sh = !!String.prototype.codePointAt, uh = !!String.prototype.trimStart, ch = !!String.prototype.trimEnd, fh = !!Number.isSafeInteger, hh = fh ? Number.isSafeInteger : function(t) {
  return typeof t == "number" && isFinite(t) && Math.floor(t) === t && Math.abs(t) <= 9007199254740991;
}, Lr = !0;
try {
  var _h = ia("([^\\p{White_Space}\\p{Pattern_Syntax}]*)", "yu");
  Lr = ((gr = _h.exec("a")) === null || gr === void 0 ? void 0 : gr[0]) === "a";
} catch {
  Lr = !1;
}
var Qi = oh ? (
  // Native
  function(e, n, r) {
    return e.startsWith(n, r);
  }
) : (
  // For IE11
  function(e, n, r) {
    return e.slice(r, r + n.length) === n;
  }
), Rr = ah ? String.fromCodePoint : (
  // IE11
  function() {
    for (var e = [], n = 0; n < arguments.length; n++)
      e[n] = arguments[n];
    for (var r = "", i = e.length, o = 0, a; i > o; ) {
      if (a = e[o++], a > 1114111)
        throw RangeError(a + " is not a valid code point");
      r += a < 65536 ? String.fromCharCode(a) : String.fromCharCode(((a -= 65536) >> 10) + 55296, a % 1024 + 56320);
    }
    return r;
  }
), Yi = (
  // native
  lh ? Object.fromEntries : (
    // Ponyfill
    function(e) {
      for (var n = {}, r = 0, i = e; r < i.length; r++) {
        var o = i[r], a = o[0], s = o[1];
        n[a] = s;
      }
      return n;
    }
  )
), ra = sh ? (
  // Native
  function(e, n) {
    return e.codePointAt(n);
  }
) : (
  // IE 11
  function(e, n) {
    var r = e.length;
    if (!(n < 0 || n >= r)) {
      var i = e.charCodeAt(n), o;
      return i < 55296 || i > 56319 || n + 1 === r || (o = e.charCodeAt(n + 1)) < 56320 || o > 57343 ? i : (i - 55296 << 10) + (o - 56320) + 65536;
    }
  }
), dh = uh ? (
  // Native
  function(e) {
    return e.trimStart();
  }
) : (
  // Ponyfill
  function(e) {
    return e.replace(rh, "");
  }
), mh = ch ? (
  // Native
  function(e) {
    return e.trimEnd();
  }
) : (
  // Ponyfill
  function(e) {
    return e.replace(ih, "");
  }
);
function ia(t, e) {
  return new RegExp(t, e);
}
var Mr;
if (Lr) {
  var Ki = ia("([^\\p{White_Space}\\p{Pattern_Syntax}]*)", "yu");
  Mr = function(e, n) {
    var r;
    Ki.lastIndex = n;
    var i = Ki.exec(e);
    return (r = i[1]) !== null && r !== void 0 ? r : "";
  };
} else
  Mr = function(e, n) {
    for (var r = []; ; ) {
      var i = ra(e, n);
      if (i === void 0 || oa(i) || vh(i))
        break;
      r.push(i), n += i >= 65536 ? 2 : 1;
    }
    return Rr.apply(void 0, r);
  };
var gh = (
  /** @class */
  function() {
    function t(e, n) {
      n === void 0 && (n = {}), this.message = e, this.position = { offset: 0, line: 1, column: 1 }, this.ignoreTag = !!n.ignoreTag, this.locale = n.locale, this.requiresOtherClause = !!n.requiresOtherClause, this.shouldParseSkeletons = !!n.shouldParseSkeletons;
    }
    return t.prototype.parse = function() {
      if (this.offset() !== 0)
        throw Error("parser can only be used once");
      return this.parseMessage(0, "", !1);
    }, t.prototype.parseMessage = function(e, n, r) {
      for (var i = []; !this.isEOF(); ) {
        var o = this.char();
        if (o === 123) {
          var a = this.parseArgument(e, r);
          if (a.err)
            return a;
          i.push(a.val);
        } else {
          if (o === 125 && e > 0)
            break;
          if (o === 35 && (n === "plural" || n === "selectordinal")) {
            var s = this.clonePosition();
            this.bump(), i.push({
              type: F.pound,
              location: N(s, this.clonePosition())
            });
          } else if (o === 60 && !this.ignoreTag && this.peek() === 47) {
            if (r)
              break;
            return this.error(P.UNMATCHED_CLOSING_TAG, N(this.clonePosition(), this.clonePosition()));
          } else if (o === 60 && !this.ignoreTag && Dr(this.peek() || 0)) {
            var a = this.parseTag(e, n);
            if (a.err)
              return a;
            i.push(a.val);
          } else {
            var a = this.parseLiteral(e, n);
            if (a.err)
              return a;
            i.push(a.val);
          }
        }
      }
      return { val: i, err: null };
    }, t.prototype.parseTag = function(e, n) {
      var r = this.clonePosition();
      this.bump();
      var i = this.parseTagName();
      if (this.bumpSpace(), this.bumpIf("/>"))
        return {
          val: {
            type: F.literal,
            value: "<".concat(i, "/>"),
            location: N(r, this.clonePosition())
          },
          err: null
        };
      if (this.bumpIf(">")) {
        var o = this.parseMessage(e + 1, n, !0);
        if (o.err)
          return o;
        var a = o.val, s = this.clonePosition();
        if (this.bumpIf("</")) {
          if (this.isEOF() || !Dr(this.char()))
            return this.error(P.INVALID_TAG, N(s, this.clonePosition()));
          var l = this.clonePosition(), c = this.parseTagName();
          return i !== c ? this.error(P.UNMATCHED_CLOSING_TAG, N(l, this.clonePosition())) : (this.bumpSpace(), this.bumpIf(">") ? {
            val: {
              type: F.tag,
              value: i,
              children: a,
              location: N(r, this.clonePosition())
            },
            err: null
          } : this.error(P.INVALID_TAG, N(s, this.clonePosition())));
        } else
          return this.error(P.UNCLOSED_TAG, N(r, this.clonePosition()));
      } else
        return this.error(P.INVALID_TAG, N(r, this.clonePosition()));
    }, t.prototype.parseTagName = function() {
      var e = this.offset();
      for (this.bump(); !this.isEOF() && bh(this.char()); )
        this.bump();
      return this.message.slice(e, this.offset());
    }, t.prototype.parseLiteral = function(e, n) {
      for (var r = this.clonePosition(), i = ""; ; ) {
        var o = this.tryParseQuote(n);
        if (o) {
          i += o;
          continue;
        }
        var a = this.tryParseUnquoted(e, n);
        if (a) {
          i += a;
          continue;
        }
        var s = this.tryParseLeftAngleBracket();
        if (s) {
          i += s;
          continue;
        }
        break;
      }
      var l = N(r, this.clonePosition());
      return {
        val: { type: F.literal, value: i, location: l },
        err: null
      };
    }, t.prototype.tryParseLeftAngleBracket = function() {
      return !this.isEOF() && this.char() === 60 && (this.ignoreTag || // If at the opening tag or closing tag position, bail.
      !ph(this.peek() || 0)) ? (this.bump(), "<") : null;
    }, t.prototype.tryParseQuote = function(e) {
      if (this.isEOF() || this.char() !== 39)
        return null;
      switch (this.peek()) {
        case 39:
          return this.bump(), this.bump(), "'";
        case 123:
        case 60:
        case 62:
        case 125:
          break;
        case 35:
          if (e === "plural" || e === "selectordinal")
            break;
          return null;
        default:
          return null;
      }
      this.bump();
      var n = [this.char()];
      for (this.bump(); !this.isEOF(); ) {
        var r = this.char();
        if (r === 39)
          if (this.peek() === 39)
            n.push(39), this.bump();
          else {
            this.bump();
            break;
          }
        else
          n.push(r);
        this.bump();
      }
      return Rr.apply(void 0, n);
    }, t.prototype.tryParseUnquoted = function(e, n) {
      if (this.isEOF())
        return null;
      var r = this.char();
      return r === 60 || r === 123 || r === 35 && (n === "plural" || n === "selectordinal") || r === 125 && e > 0 ? null : (this.bump(), Rr(r));
    }, t.prototype.parseArgument = function(e, n) {
      var r = this.clonePosition();
      if (this.bump(), this.bumpSpace(), this.isEOF())
        return this.error(P.EXPECT_ARGUMENT_CLOSING_BRACE, N(r, this.clonePosition()));
      if (this.char() === 125)
        return this.bump(), this.error(P.EMPTY_ARGUMENT, N(r, this.clonePosition()));
      var i = this.parseIdentifierIfPossible().value;
      if (!i)
        return this.error(P.MALFORMED_ARGUMENT, N(r, this.clonePosition()));
      if (this.bumpSpace(), this.isEOF())
        return this.error(P.EXPECT_ARGUMENT_CLOSING_BRACE, N(r, this.clonePosition()));
      switch (this.char()) {
        case 125:
          return this.bump(), {
            val: {
              type: F.argument,
              // value does not include the opening and closing braces.
              value: i,
              location: N(r, this.clonePosition())
            },
            err: null
          };
        case 44:
          return this.bump(), this.bumpSpace(), this.isEOF() ? this.error(P.EXPECT_ARGUMENT_CLOSING_BRACE, N(r, this.clonePosition())) : this.parseArgumentOptions(e, n, i, r);
        default:
          return this.error(P.MALFORMED_ARGUMENT, N(r, this.clonePosition()));
      }
    }, t.prototype.parseIdentifierIfPossible = function() {
      var e = this.clonePosition(), n = this.offset(), r = Mr(this.message, n), i = n + r.length;
      this.bumpTo(i);
      var o = this.clonePosition(), a = N(e, o);
      return { value: r, location: a };
    }, t.prototype.parseArgumentOptions = function(e, n, r, i) {
      var o, a = this.clonePosition(), s = this.parseIdentifierIfPossible().value, l = this.clonePosition();
      switch (s) {
        case "":
          return this.error(P.EXPECT_ARGUMENT_TYPE, N(a, l));
        case "number":
        case "date":
        case "time": {
          this.bumpSpace();
          var c = null;
          if (this.bumpIf(",")) {
            this.bumpSpace();
            var u = this.clonePosition(), f = this.parseSimpleArgStyleIfPossible();
            if (f.err)
              return f;
            var h = mh(f.val);
            if (h.length === 0)
              return this.error(P.EXPECT_ARGUMENT_STYLE, N(this.clonePosition(), this.clonePosition()));
            var _ = N(u, this.clonePosition());
            c = { style: h, styleLocation: _ };
          }
          var g = this.tryParseArgumentClose(i);
          if (g.err)
            return g;
          var m = N(i, this.clonePosition());
          if (c && Qi(c == null ? void 0 : c.style, "::", 0)) {
            var v = dh(c.style.slice(2));
            if (s === "number") {
              var f = this.parseNumberSkeletonFromString(v, c.styleLocation);
              return f.err ? f : {
                val: { type: F.number, value: r, location: m, style: f.val },
                err: null
              };
            } else {
              if (v.length === 0)
                return this.error(P.EXPECT_DATE_TIME_SKELETON, m);
              var b = v;
              this.locale && (b = th(v, this.locale));
              var h = {
                type: wt.dateTime,
                pattern: b,
                location: c.styleLocation,
                parsedOptions: this.shouldParseSkeletons ? Zf(b) : {}
              }, y = s === "date" ? F.date : F.time;
              return {
                val: { type: y, value: r, location: m, style: h },
                err: null
              };
            }
          }
          return {
            val: {
              type: s === "number" ? F.number : s === "date" ? F.date : F.time,
              value: r,
              location: m,
              style: (o = c == null ? void 0 : c.style) !== null && o !== void 0 ? o : null
            },
            err: null
          };
        }
        case "plural":
        case "selectordinal":
        case "select": {
          var C = this.clonePosition();
          if (this.bumpSpace(), !this.bumpIf(","))
            return this.error(P.EXPECT_SELECT_ARGUMENT_OPTIONS, N(C, M({}, C)));
          this.bumpSpace();
          var H = this.parseIdentifierIfPossible(), I = 0;
          if (s !== "select" && H.value === "offset") {
            if (!this.bumpIf(":"))
              return this.error(P.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, N(this.clonePosition(), this.clonePosition()));
            this.bumpSpace();
            var f = this.tryParseDecimalInteger(P.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, P.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);
            if (f.err)
              return f;
            this.bumpSpace(), H = this.parseIdentifierIfPossible(), I = f.val;
          }
          var p = this.tryParsePluralOrSelectOptions(e, s, n, H);
          if (p.err)
            return p;
          var g = this.tryParseArgumentClose(i);
          if (g.err)
            return g;
          var D = N(i, this.clonePosition());
          return s === "select" ? {
            val: {
              type: F.select,
              value: r,
              options: Yi(p.val),
              location: D
            },
            err: null
          } : {
            val: {
              type: F.plural,
              value: r,
              options: Yi(p.val),
              offset: I,
              pluralType: s === "plural" ? "cardinal" : "ordinal",
              location: D
            },
            err: null
          };
        }
        default:
          return this.error(P.INVALID_ARGUMENT_TYPE, N(a, l));
      }
    }, t.prototype.tryParseArgumentClose = function(e) {
      return this.isEOF() || this.char() !== 125 ? this.error(P.EXPECT_ARGUMENT_CLOSING_BRACE, N(e, this.clonePosition())) : (this.bump(), { val: !0, err: null });
    }, t.prototype.parseSimpleArgStyleIfPossible = function() {
      for (var e = 0, n = this.clonePosition(); !this.isEOF(); ) {
        var r = this.char();
        switch (r) {
          case 39: {
            this.bump();
            var i = this.clonePosition();
            if (!this.bumpUntil("'"))
              return this.error(P.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE, N(i, this.clonePosition()));
            this.bump();
            break;
          }
          case 123: {
            e += 1, this.bump();
            break;
          }
          case 125: {
            if (e > 0)
              e -= 1;
            else
              return {
                val: this.message.slice(n.offset, this.offset()),
                err: null
              };
            break;
          }
          default:
            this.bump();
            break;
        }
      }
      return {
        val: this.message.slice(n.offset, this.offset()),
        err: null
      };
    }, t.prototype.parseNumberSkeletonFromString = function(e, n) {
      var r = [];
      try {
        r = Qf(e);
      } catch {
        return this.error(P.INVALID_NUMBER_SKELETON, n);
      }
      return {
        val: {
          type: wt.number,
          tokens: r,
          location: n,
          parsedOptions: this.shouldParseSkeletons ? eh(r) : {}
        },
        err: null
      };
    }, t.prototype.tryParsePluralOrSelectOptions = function(e, n, r, i) {
      for (var o, a = !1, s = [], l = /* @__PURE__ */ new Set(), c = i.value, u = i.location; ; ) {
        if (c.length === 0) {
          var f = this.clonePosition();
          if (n !== "select" && this.bumpIf("=")) {
            var h = this.tryParseDecimalInteger(P.EXPECT_PLURAL_ARGUMENT_SELECTOR, P.INVALID_PLURAL_ARGUMENT_SELECTOR);
            if (h.err)
              return h;
            u = N(f, this.clonePosition()), c = this.message.slice(f.offset, this.offset());
          } else
            break;
        }
        if (l.has(c))
          return this.error(n === "select" ? P.DUPLICATE_SELECT_ARGUMENT_SELECTOR : P.DUPLICATE_PLURAL_ARGUMENT_SELECTOR, u);
        c === "other" && (a = !0), this.bumpSpace();
        var _ = this.clonePosition();
        if (!this.bumpIf("{"))
          return this.error(n === "select" ? P.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT : P.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT, N(this.clonePosition(), this.clonePosition()));
        var g = this.parseMessage(e + 1, n, r);
        if (g.err)
          return g;
        var m = this.tryParseArgumentClose(_);
        if (m.err)
          return m;
        s.push([
          c,
          {
            value: g.val,
            location: N(_, this.clonePosition())
          }
        ]), l.add(c), this.bumpSpace(), o = this.parseIdentifierIfPossible(), c = o.value, u = o.location;
      }
      return s.length === 0 ? this.error(n === "select" ? P.EXPECT_SELECT_ARGUMENT_SELECTOR : P.EXPECT_PLURAL_ARGUMENT_SELECTOR, N(this.clonePosition(), this.clonePosition())) : this.requiresOtherClause && !a ? this.error(P.MISSING_OTHER_CLAUSE, N(this.clonePosition(), this.clonePosition())) : { val: s, err: null };
    }, t.prototype.tryParseDecimalInteger = function(e, n) {
      var r = 1, i = this.clonePosition();
      this.bumpIf("+") || this.bumpIf("-") && (r = -1);
      for (var o = !1, a = 0; !this.isEOF(); ) {
        var s = this.char();
        if (s >= 48 && s <= 57)
          o = !0, a = a * 10 + (s - 48), this.bump();
        else
          break;
      }
      var l = N(i, this.clonePosition());
      return o ? (a *= r, hh(a) ? { val: a, err: null } : this.error(n, l)) : this.error(e, l);
    }, t.prototype.offset = function() {
      return this.position.offset;
    }, t.prototype.isEOF = function() {
      return this.offset() === this.message.length;
    }, t.prototype.clonePosition = function() {
      return {
        offset: this.position.offset,
        line: this.position.line,
        column: this.position.column
      };
    }, t.prototype.char = function() {
      var e = this.position.offset;
      if (e >= this.message.length)
        throw Error("out of bound");
      var n = ra(this.message, e);
      if (n === void 0)
        throw Error("Offset ".concat(e, " is at invalid UTF-16 code unit boundary"));
      return n;
    }, t.prototype.error = function(e, n) {
      return {
        val: null,
        err: {
          kind: e,
          message: this.message,
          location: n
        }
      };
    }, t.prototype.bump = function() {
      if (!this.isEOF()) {
        var e = this.char();
        e === 10 ? (this.position.line += 1, this.position.column = 1, this.position.offset += 1) : (this.position.column += 1, this.position.offset += e < 65536 ? 1 : 2);
      }
    }, t.prototype.bumpIf = function(e) {
      if (Qi(this.message, e, this.offset())) {
        for (var n = 0; n < e.length; n++)
          this.bump();
        return !0;
      }
      return !1;
    }, t.prototype.bumpUntil = function(e) {
      var n = this.offset(), r = this.message.indexOf(e, n);
      return r >= 0 ? (this.bumpTo(r), !0) : (this.bumpTo(this.message.length), !1);
    }, t.prototype.bumpTo = function(e) {
      if (this.offset() > e)
        throw Error("targetOffset ".concat(e, " must be greater than or equal to the current offset ").concat(this.offset()));
      for (e = Math.min(e, this.message.length); ; ) {
        var n = this.offset();
        if (n === e)
          break;
        if (n > e)
          throw Error("targetOffset ".concat(e, " is at invalid UTF-16 code unit boundary"));
        if (this.bump(), this.isEOF())
          break;
      }
    }, t.prototype.bumpSpace = function() {
      for (; !this.isEOF() && oa(this.char()); )
        this.bump();
    }, t.prototype.peek = function() {
      if (this.isEOF())
        return null;
      var e = this.char(), n = this.offset(), r = this.message.charCodeAt(n + (e >= 65536 ? 2 : 1));
      return r ?? null;
    }, t;
  }()
);
function Dr(t) {
  return t >= 97 && t <= 122 || t >= 65 && t <= 90;
}
function ph(t) {
  return Dr(t) || t === 47;
}
function bh(t) {
  return t === 45 || t === 46 || t >= 48 && t <= 57 || t === 95 || t >= 97 && t <= 122 || t >= 65 && t <= 90 || t == 183 || t >= 192 && t <= 214 || t >= 216 && t <= 246 || t >= 248 && t <= 893 || t >= 895 && t <= 8191 || t >= 8204 && t <= 8205 || t >= 8255 && t <= 8256 || t >= 8304 && t <= 8591 || t >= 11264 && t <= 12271 || t >= 12289 && t <= 55295 || t >= 63744 && t <= 64975 || t >= 65008 && t <= 65533 || t >= 65536 && t <= 983039;
}
function oa(t) {
  return t >= 9 && t <= 13 || t === 32 || t === 133 || t >= 8206 && t <= 8207 || t === 8232 || t === 8233;
}
function vh(t) {
  return t >= 33 && t <= 35 || t === 36 || t >= 37 && t <= 39 || t === 40 || t === 41 || t === 42 || t === 43 || t === 44 || t === 45 || t >= 46 && t <= 47 || t >= 58 && t <= 59 || t >= 60 && t <= 62 || t >= 63 && t <= 64 || t === 91 || t === 92 || t === 93 || t === 94 || t === 96 || t === 123 || t === 124 || t === 125 || t === 126 || t === 161 || t >= 162 && t <= 165 || t === 166 || t === 167 || t === 169 || t === 171 || t === 172 || t === 174 || t === 176 || t === 177 || t === 182 || t === 187 || t === 191 || t === 215 || t === 247 || t >= 8208 && t <= 8213 || t >= 8214 && t <= 8215 || t === 8216 || t === 8217 || t === 8218 || t >= 8219 && t <= 8220 || t === 8221 || t === 8222 || t === 8223 || t >= 8224 && t <= 8231 || t >= 8240 && t <= 8248 || t === 8249 || t === 8250 || t >= 8251 && t <= 8254 || t >= 8257 && t <= 8259 || t === 8260 || t === 8261 || t === 8262 || t >= 8263 && t <= 8273 || t === 8274 || t === 8275 || t >= 8277 && t <= 8286 || t >= 8592 && t <= 8596 || t >= 8597 && t <= 8601 || t >= 8602 && t <= 8603 || t >= 8604 && t <= 8607 || t === 8608 || t >= 8609 && t <= 8610 || t === 8611 || t >= 8612 && t <= 8613 || t === 8614 || t >= 8615 && t <= 8621 || t === 8622 || t >= 8623 && t <= 8653 || t >= 8654 && t <= 8655 || t >= 8656 && t <= 8657 || t === 8658 || t === 8659 || t === 8660 || t >= 8661 && t <= 8691 || t >= 8692 && t <= 8959 || t >= 8960 && t <= 8967 || t === 8968 || t === 8969 || t === 8970 || t === 8971 || t >= 8972 && t <= 8991 || t >= 8992 && t <= 8993 || t >= 8994 && t <= 9e3 || t === 9001 || t === 9002 || t >= 9003 && t <= 9083 || t === 9084 || t >= 9085 && t <= 9114 || t >= 9115 && t <= 9139 || t >= 9140 && t <= 9179 || t >= 9180 && t <= 9185 || t >= 9186 && t <= 9254 || t >= 9255 && t <= 9279 || t >= 9280 && t <= 9290 || t >= 9291 && t <= 9311 || t >= 9472 && t <= 9654 || t === 9655 || t >= 9656 && t <= 9664 || t === 9665 || t >= 9666 && t <= 9719 || t >= 9720 && t <= 9727 || t >= 9728 && t <= 9838 || t === 9839 || t >= 9840 && t <= 10087 || t === 10088 || t === 10089 || t === 10090 || t === 10091 || t === 10092 || t === 10093 || t === 10094 || t === 10095 || t === 10096 || t === 10097 || t === 10098 || t === 10099 || t === 10100 || t === 10101 || t >= 10132 && t <= 10175 || t >= 10176 && t <= 10180 || t === 10181 || t === 10182 || t >= 10183 && t <= 10213 || t === 10214 || t === 10215 || t === 10216 || t === 10217 || t === 10218 || t === 10219 || t === 10220 || t === 10221 || t === 10222 || t === 10223 || t >= 10224 && t <= 10239 || t >= 10240 && t <= 10495 || t >= 10496 && t <= 10626 || t === 10627 || t === 10628 || t === 10629 || t === 10630 || t === 10631 || t === 10632 || t === 10633 || t === 10634 || t === 10635 || t === 10636 || t === 10637 || t === 10638 || t === 10639 || t === 10640 || t === 10641 || t === 10642 || t === 10643 || t === 10644 || t === 10645 || t === 10646 || t === 10647 || t === 10648 || t >= 10649 && t <= 10711 || t === 10712 || t === 10713 || t === 10714 || t === 10715 || t >= 10716 && t <= 10747 || t === 10748 || t === 10749 || t >= 10750 && t <= 11007 || t >= 11008 && t <= 11055 || t >= 11056 && t <= 11076 || t >= 11077 && t <= 11078 || t >= 11079 && t <= 11084 || t >= 11085 && t <= 11123 || t >= 11124 && t <= 11125 || t >= 11126 && t <= 11157 || t === 11158 || t >= 11159 && t <= 11263 || t >= 11776 && t <= 11777 || t === 11778 || t === 11779 || t === 11780 || t === 11781 || t >= 11782 && t <= 11784 || t === 11785 || t === 11786 || t === 11787 || t === 11788 || t === 11789 || t >= 11790 && t <= 11798 || t === 11799 || t >= 11800 && t <= 11801 || t === 11802 || t === 11803 || t === 11804 || t === 11805 || t >= 11806 && t <= 11807 || t === 11808 || t === 11809 || t === 11810 || t === 11811 || t === 11812 || t === 11813 || t === 11814 || t === 11815 || t === 11816 || t === 11817 || t >= 11818 && t <= 11822 || t === 11823 || t >= 11824 && t <= 11833 || t >= 11834 && t <= 11835 || t >= 11836 && t <= 11839 || t === 11840 || t === 11841 || t === 11842 || t >= 11843 && t <= 11855 || t >= 11856 && t <= 11857 || t === 11858 || t >= 11859 && t <= 11903 || t >= 12289 && t <= 12291 || t === 12296 || t === 12297 || t === 12298 || t === 12299 || t === 12300 || t === 12301 || t === 12302 || t === 12303 || t === 12304 || t === 12305 || t >= 12306 && t <= 12307 || t === 12308 || t === 12309 || t === 12310 || t === 12311 || t === 12312 || t === 12313 || t === 12314 || t === 12315 || t === 12316 || t === 12317 || t >= 12318 && t <= 12319 || t === 12320 || t === 12336 || t === 64830 || t === 64831 || t >= 65093 && t <= 65094;
}
function Ur(t) {
  t.forEach(function(e) {
    if (delete e.location, Jo(e) || Qo(e))
      for (var n in e.options)
        delete e.options[n].location, Ur(e.options[n].value);
    else
      Wo(e) && Ko(e.style) || (Xo(e) || Zo(e)) && Or(e.style) ? delete e.style.location : Yo(e) && Ur(e.children);
  });
}
function wh(t, e) {
  e === void 0 && (e = {}), e = M({ shouldParseSkeletons: !0, requiresOtherClause: !0 }, e);
  var n = new gh(t, e).parse();
  if (n.err) {
    var r = SyntaxError(P[n.err.kind]);
    throw r.location = n.err.location, r.originalMessage = n.err.message, r;
  }
  return e != null && e.captureLocation || Ur(n.val), n.val;
}
function pr(t, e) {
  var n = e && e.cache ? e.cache : Ah, r = e && e.serializer ? e.serializer : Th, i = e && e.strategy ? e.strategy : Eh;
  return i(t, {
    cache: n,
    serializer: r
  });
}
function yh(t) {
  return t == null || typeof t == "number" || typeof t == "boolean";
}
function aa(t, e, n, r) {
  var i = yh(r) ? r : n(r), o = e.get(i);
  return typeof o > "u" && (o = t.call(this, r), e.set(i, o)), o;
}
function la(t, e, n) {
  var r = Array.prototype.slice.call(arguments, 3), i = n(r), o = e.get(i);
  return typeof o > "u" && (o = t.apply(this, r), e.set(i, o)), o;
}
function ti(t, e, n, r, i) {
  return n.bind(e, t, r, i);
}
function Eh(t, e) {
  var n = t.length === 1 ? aa : la;
  return ti(t, this, n, e.cache.create(), e.serializer);
}
function Sh(t, e) {
  return ti(t, this, la, e.cache.create(), e.serializer);
}
function kh(t, e) {
  return ti(t, this, aa, e.cache.create(), e.serializer);
}
var Th = function() {
  return JSON.stringify(arguments);
};
function ni() {
  this.cache = /* @__PURE__ */ Object.create(null);
}
ni.prototype.get = function(t) {
  return this.cache[t];
};
ni.prototype.set = function(t, e) {
  this.cache[t] = e;
};
var Ah = {
  create: function() {
    return new ni();
  }
}, br = {
  variadic: Sh,
  monadic: kh
}, yt;
(function(t) {
  t.MISSING_VALUE = "MISSING_VALUE", t.INVALID_VALUE = "INVALID_VALUE", t.MISSING_INTL_API = "MISSING_INTL_API";
})(yt || (yt = {}));
var Nn = (
  /** @class */
  function(t) {
    In(e, t);
    function e(n, r, i) {
      var o = t.call(this, n) || this;
      return o.code = r, o.originalMessage = i, o;
    }
    return e.prototype.toString = function() {
      return "[formatjs Error: ".concat(this.code, "] ").concat(this.message);
    }, e;
  }(Error)
), $i = (
  /** @class */
  function(t) {
    In(e, t);
    function e(n, r, i, o) {
      return t.call(this, 'Invalid values for "'.concat(n, '": "').concat(r, '". Options are "').concat(Object.keys(i).join('", "'), '"'), yt.INVALID_VALUE, o) || this;
    }
    return e;
  }(Nn)
), Bh = (
  /** @class */
  function(t) {
    In(e, t);
    function e(n, r, i) {
      return t.call(this, 'Value for "'.concat(n, '" must be of type ').concat(r), yt.INVALID_VALUE, i) || this;
    }
    return e;
  }(Nn)
), Ch = (
  /** @class */
  function(t) {
    In(e, t);
    function e(n, r) {
      return t.call(this, 'The intl string context variable "'.concat(n, '" was not provided to the string "').concat(r, '"'), yt.MISSING_VALUE, r) || this;
    }
    return e;
  }(Nn)
), se;
(function(t) {
  t[t.literal = 0] = "literal", t[t.object = 1] = "object";
})(se || (se = {}));
function Hh(t) {
  return t.length < 2 ? t : t.reduce(function(e, n) {
    var r = e[e.length - 1];
    return !r || r.type !== se.literal || n.type !== se.literal ? e.push(n) : r.value += n.value, e;
  }, []);
}
function Ph(t) {
  return typeof t == "function";
}
function un(t, e, n, r, i, o, a) {
  if (t.length === 1 && Wi(t[0]))
    return [
      {
        type: se.literal,
        value: t[0].value
      }
    ];
  for (var s = [], l = 0, c = t; l < c.length; l++) {
    var u = c[l];
    if (Wi(u)) {
      s.push({
        type: se.literal,
        value: u.value
      });
      continue;
    }
    if (Wf(u)) {
      typeof o == "number" && s.push({
        type: se.literal,
        value: n.getNumberFormat(e).format(o)
      });
      continue;
    }
    var f = u.value;
    if (!(i && f in i))
      throw new Ch(f, a);
    var h = i[f];
    if (Vf(u)) {
      (!h || typeof h == "string" || typeof h == "number") && (h = typeof h == "string" || typeof h == "number" ? String(h) : ""), s.push({
        type: typeof h == "string" ? se.literal : se.object,
        value: h
      });
      continue;
    }
    if (Xo(u)) {
      var _ = typeof u.style == "string" ? r.date[u.style] : Or(u.style) ? u.style.parsedOptions : void 0;
      s.push({
        type: se.literal,
        value: n.getDateTimeFormat(e, _).format(h)
      });
      continue;
    }
    if (Zo(u)) {
      var _ = typeof u.style == "string" ? r.time[u.style] : Or(u.style) ? u.style.parsedOptions : r.time.medium;
      s.push({
        type: se.literal,
        value: n.getDateTimeFormat(e, _).format(h)
      });
      continue;
    }
    if (Wo(u)) {
      var _ = typeof u.style == "string" ? r.number[u.style] : Ko(u.style) ? u.style.parsedOptions : void 0;
      _ && _.scale && (h = h * (_.scale || 1)), s.push({
        type: se.literal,
        value: n.getNumberFormat(e, _).format(h)
      });
      continue;
    }
    if (Yo(u)) {
      var g = u.children, m = u.value, v = i[m];
      if (!Ph(v))
        throw new Bh(m, "function", a);
      var b = un(g, e, n, r, i, o), y = v(b.map(function(I) {
        return I.value;
      }));
      Array.isArray(y) || (y = [y]), s.push.apply(s, y.map(function(I) {
        return {
          type: typeof I == "string" ? se.literal : se.object,
          value: I
        };
      }));
    }
    if (Jo(u)) {
      var C = u.options[h] || u.options.other;
      if (!C)
        throw new $i(u.value, h, Object.keys(u.options), a);
      s.push.apply(s, un(C.value, e, n, r, i));
      continue;
    }
    if (Qo(u)) {
      var C = u.options["=".concat(h)];
      if (!C) {
        if (!Intl.PluralRules)
          throw new Nn(`Intl.PluralRules is not available in this environment.
Try polyfilling it using "@formatjs/intl-pluralrules"
`, yt.MISSING_INTL_API, a);
        var H = n.getPluralRules(e, { type: u.pluralType }).select(h - (u.offset || 0));
        C = u.options[H] || u.options.other;
      }
      if (!C)
        throw new $i(u.value, h, Object.keys(u.options), a);
      s.push.apply(s, un(C.value, e, n, r, i, h - (u.offset || 0)));
      continue;
    }
  }
  return Hh(s);
}
function Ih(t, e) {
  return e ? M(M(M({}, t || {}), e || {}), Object.keys(t).reduce(function(n, r) {
    return n[r] = M(M({}, t[r]), e[r] || {}), n;
  }, {})) : t;
}
function Nh(t, e) {
  return e ? Object.keys(t).reduce(function(n, r) {
    return n[r] = Ih(t[r], e[r]), n;
  }, M({}, t)) : t;
}
function vr(t) {
  return {
    create: function() {
      return {
        get: function(e) {
          return t[e];
        },
        set: function(e, n) {
          t[e] = n;
        }
      };
    }
  };
}
function Oh(t) {
  return t === void 0 && (t = {
    number: {},
    dateTime: {},
    pluralRules: {}
  }), {
    getNumberFormat: pr(function() {
      for (var e, n = [], r = 0; r < arguments.length; r++)
        n[r] = arguments[r];
      return new ((e = Intl.NumberFormat).bind.apply(e, mr([void 0], n, !1)))();
    }, {
      cache: vr(t.number),
      strategy: br.variadic
    }),
    getDateTimeFormat: pr(function() {
      for (var e, n = [], r = 0; r < arguments.length; r++)
        n[r] = arguments[r];
      return new ((e = Intl.DateTimeFormat).bind.apply(e, mr([void 0], n, !1)))();
    }, {
      cache: vr(t.dateTime),
      strategy: br.variadic
    }),
    getPluralRules: pr(function() {
      for (var e, n = [], r = 0; r < arguments.length; r++)
        n[r] = arguments[r];
      return new ((e = Intl.PluralRules).bind.apply(e, mr([void 0], n, !1)))();
    }, {
      cache: vr(t.pluralRules),
      strategy: br.variadic
    })
  };
}
var Lh = (
  /** @class */
  function() {
    function t(e, n, r, i) {
      var o = this;
      if (n === void 0 && (n = t.defaultLocale), this.formatterCache = {
        number: {},
        dateTime: {},
        pluralRules: {}
      }, this.format = function(a) {
        var s = o.formatToParts(a);
        if (s.length === 1)
          return s[0].value;
        var l = s.reduce(function(c, u) {
          return !c.length || u.type !== se.literal || typeof c[c.length - 1] != "string" ? c.push(u.value) : c[c.length - 1] += u.value, c;
        }, []);
        return l.length <= 1 ? l[0] || "" : l;
      }, this.formatToParts = function(a) {
        return un(o.ast, o.locales, o.formatters, o.formats, a, void 0, o.message);
      }, this.resolvedOptions = function() {
        return {
          locale: o.resolvedLocale.toString()
        };
      }, this.getAst = function() {
        return o.ast;
      }, this.locales = n, this.resolvedLocale = t.resolveLocale(n), typeof e == "string") {
        if (this.message = e, !t.__parse)
          throw new TypeError("IntlMessageFormat.__parse must be set to process `message` of type `string`");
        this.ast = t.__parse(e, {
          ignoreTag: i == null ? void 0 : i.ignoreTag,
          locale: this.resolvedLocale
        });
      } else
        this.ast = e;
      if (!Array.isArray(this.ast))
        throw new TypeError("A message must be provided as a String or AST.");
      this.formats = Nh(t.formats, r), this.formatters = i && i.formatters || Oh(this.formatterCache);
    }
    return Object.defineProperty(t, "defaultLocale", {
      get: function() {
        return t.memoizedDefaultLocale || (t.memoizedDefaultLocale = new Intl.NumberFormat().resolvedOptions().locale), t.memoizedDefaultLocale;
      },
      enumerable: !1,
      configurable: !0
    }), t.memoizedDefaultLocale = null, t.resolveLocale = function(e) {
      var n = Intl.NumberFormat.supportedLocalesOf(e);
      return n.length > 0 ? new Intl.Locale(n[0]) : new Intl.Locale(typeof e == "string" ? e : e[0]);
    }, t.__parse = wh, t.formats = {
      number: {
        integer: {
          maximumFractionDigits: 0
        },
        currency: {
          style: "currency"
        },
        percent: {
          style: "percent"
        }
      },
      date: {
        short: {
          month: "numeric",
          day: "numeric",
          year: "2-digit"
        },
        medium: {
          month: "short",
          day: "numeric",
          year: "numeric"
        },
        long: {
          month: "long",
          day: "numeric",
          year: "numeric"
        },
        full: {
          weekday: "long",
          month: "long",
          day: "numeric",
          year: "numeric"
        }
      },
      time: {
        short: {
          hour: "numeric",
          minute: "numeric"
        },
        medium: {
          hour: "numeric",
          minute: "numeric",
          second: "numeric"
        },
        long: {
          hour: "numeric",
          minute: "numeric",
          second: "numeric",
          timeZoneName: "short"
        },
        full: {
          hour: "numeric",
          minute: "numeric",
          second: "numeric",
          timeZoneName: "short"
        }
      }
    }, t;
  }()
);
function Rh(t, e) {
  if (e == null)
    return;
  if (e in t)
    return t[e];
  const n = e.split(".");
  let r = t;
  for (let i = 0; i < n.length; i++)
    if (typeof r == "object") {
      if (i > 0) {
        const o = n.slice(i, n.length).join(".");
        if (o in r) {
          r = r[o];
          break;
        }
      }
      r = r[n[i]];
    } else
      r = void 0;
  return r;
}
const Ve = {}, Mh = (t, e, n) => n && (e in Ve || (Ve[e] = {}), t in Ve[e] || (Ve[e][t] = n), n), sa = (t, e) => {
  if (e == null)
    return;
  if (e in Ve && t in Ve[e])
    return Ve[e][t];
  const n = On(e);
  for (let r = 0; r < n.length; r++) {
    const i = n[r], o = Uh(i, t);
    if (o)
      return Mh(t, e, o);
  }
};
let ri;
const Zt = Hn({});
function Dh(t) {
  return ri[t] || null;
}
function ua(t) {
  return t in ri;
}
function Uh(t, e) {
  if (!ua(t))
    return null;
  const n = Dh(t);
  return Rh(n, e);
}
function xh(t) {
  if (t == null)
    return;
  const e = On(t);
  for (let n = 0; n < e.length; n++) {
    const r = e[n];
    if (ua(r))
      return r;
  }
}
function Gh(t, ...e) {
  delete Ve[t], Zt.update((n) => (n[t] = zf.all([n[t] || {}, ...e]), n));
}
Ct(
  [Zt],
  ([t]) => Object.keys(t)
);
Zt.subscribe((t) => ri = t);
const cn = {};
function Fh(t, e) {
  cn[t].delete(e), cn[t].size === 0 && delete cn[t];
}
function ca(t) {
  return cn[t];
}
function jh(t) {
  return On(t).map((e) => {
    const n = ca(e);
    return [e, n ? [...n] : []];
  }).filter(([, e]) => e.length > 0);
}
function xr(t) {
  return t == null ? !1 : On(t).some(
    (e) => {
      var n;
      return (n = ca(e)) == null ? void 0 : n.size;
    }
  );
}
function qh(t, e) {
  return Promise.all(
    e.map((r) => (Fh(t, r), r().then((i) => i.default || i)))
  ).then((r) => Gh(t, ...r));
}
const Ot = {};
function fa(t) {
  if (!xr(t))
    return t in Ot ? Ot[t] : Promise.resolve();
  const e = jh(t);
  return Ot[t] = Promise.all(
    e.map(
      ([n, r]) => qh(n, r)
    )
  ).then(() => {
    if (xr(t))
      return fa(t);
    delete Ot[t];
  }), Ot[t];
}
const zh = {
  number: {
    scientific: { notation: "scientific" },
    engineering: { notation: "engineering" },
    compactLong: { notation: "compact", compactDisplay: "long" },
    compactShort: { notation: "compact", compactDisplay: "short" }
  },
  date: {
    short: { month: "numeric", day: "numeric", year: "2-digit" },
    medium: { month: "short", day: "numeric", year: "numeric" },
    long: { month: "long", day: "numeric", year: "numeric" },
    full: { weekday: "long", month: "long", day: "numeric", year: "numeric" }
  },
  time: {
    short: { hour: "numeric", minute: "numeric" },
    medium: { hour: "numeric", minute: "numeric", second: "numeric" },
    long: {
      hour: "numeric",
      minute: "numeric",
      second: "numeric",
      timeZoneName: "short"
    },
    full: {
      hour: "numeric",
      minute: "numeric",
      second: "numeric",
      timeZoneName: "short"
    }
  }
}, Vh = {
  fallbackLocale: null,
  loadingDelay: 200,
  formats: zh,
  warnOnMissingMessages: !0,
  handleMissingMessage: void 0,
  ignoreTag: !0
}, Wh = Vh;
function Et() {
  return Wh;
}
const wr = Hn(!1);
var Xh = Object.defineProperty, Zh = Object.defineProperties, Jh = Object.getOwnPropertyDescriptors, eo = Object.getOwnPropertySymbols, Qh = Object.prototype.hasOwnProperty, Yh = Object.prototype.propertyIsEnumerable, to = (t, e, n) => e in t ? Xh(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, Kh = (t, e) => {
  for (var n in e || (e = {}))
    Qh.call(e, n) && to(t, n, e[n]);
  if (eo)
    for (var n of eo(e))
      Yh.call(e, n) && to(t, n, e[n]);
  return t;
}, $h = (t, e) => Zh(t, Jh(e));
let Gr;
const gn = Hn(null);
function no(t) {
  return t.split("-").map((e, n, r) => r.slice(0, n + 1).join("-")).reverse();
}
function On(t, e = Et().fallbackLocale) {
  const n = no(t);
  return e ? [.../* @__PURE__ */ new Set([...n, ...no(e)])] : n;
}
function ut() {
  return Gr ?? void 0;
}
gn.subscribe((t) => {
  Gr = t ?? void 0, typeof window < "u" && t != null && document.documentElement.setAttribute("lang", t);
});
const e0 = (t) => {
  if (t && xh(t) && xr(t)) {
    const { loadingDelay: e } = Et();
    let n;
    return typeof window < "u" && ut() != null && e ? n = window.setTimeout(
      () => wr.set(!0),
      e
    ) : wr.set(!0), fa(t).then(() => {
      gn.set(t);
    }).finally(() => {
      clearTimeout(n), wr.set(!1);
    });
  }
  return gn.set(t);
}, Jt = $h(Kh({}, gn), {
  set: e0
}), Ln = (t) => {
  const e = /* @__PURE__ */ Object.create(null);
  return (r) => {
    const i = JSON.stringify(r);
    return i in e ? e[i] : e[i] = t(r);
  };
};
var t0 = Object.defineProperty, pn = Object.getOwnPropertySymbols, ha = Object.prototype.hasOwnProperty, _a = Object.prototype.propertyIsEnumerable, ro = (t, e, n) => e in t ? t0(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, ii = (t, e) => {
  for (var n in e || (e = {}))
    ha.call(e, n) && ro(t, n, e[n]);
  if (pn)
    for (var n of pn(e))
      _a.call(e, n) && ro(t, n, e[n]);
  return t;
}, Ht = (t, e) => {
  var n = {};
  for (var r in t)
    ha.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
  if (t != null && pn)
    for (var r of pn(t))
      e.indexOf(r) < 0 && _a.call(t, r) && (n[r] = t[r]);
  return n;
};
const qt = (t, e) => {
  const { formats: n } = Et();
  if (t in n && e in n[t])
    return n[t][e];
  throw new Error(`[svelte-i18n] Unknown "${e}" ${t} format.`);
}, n0 = Ln(
  (t) => {
    var e = t, { locale: n, format: r } = e, i = Ht(e, ["locale", "format"]);
    if (n == null)
      throw new Error('[svelte-i18n] A "locale" must be set to format numbers');
    return r && (i = qt("number", r)), new Intl.NumberFormat(n, i);
  }
), r0 = Ln(
  (t) => {
    var e = t, { locale: n, format: r } = e, i = Ht(e, ["locale", "format"]);
    if (n == null)
      throw new Error('[svelte-i18n] A "locale" must be set to format dates');
    return r ? i = qt("date", r) : Object.keys(i).length === 0 && (i = qt("date", "short")), new Intl.DateTimeFormat(n, i);
  }
), i0 = Ln(
  (t) => {
    var e = t, { locale: n, format: r } = e, i = Ht(e, ["locale", "format"]);
    if (n == null)
      throw new Error(
        '[svelte-i18n] A "locale" must be set to format time values'
      );
    return r ? i = qt("time", r) : Object.keys(i).length === 0 && (i = qt("time", "short")), new Intl.DateTimeFormat(n, i);
  }
), o0 = (t = {}) => {
  var e = t, {
    locale: n = ut()
  } = e, r = Ht(e, [
    "locale"
  ]);
  return n0(ii({ locale: n }, r));
}, a0 = (t = {}) => {
  var e = t, {
    locale: n = ut()
  } = e, r = Ht(e, [
    "locale"
  ]);
  return r0(ii({ locale: n }, r));
}, l0 = (t = {}) => {
  var e = t, {
    locale: n = ut()
  } = e, r = Ht(e, [
    "locale"
  ]);
  return i0(ii({ locale: n }, r));
}, s0 = Ln(
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
  (t, e = ut()) => new Lh(t, e, Et().formats, {
    ignoreTag: Et().ignoreTag
  })
), u0 = (t, e = {}) => {
  var n, r, i, o;
  let a = e;
  typeof t == "object" && (a = t, t = a.id);
  const {
    values: s,
    locale: l = ut(),
    default: c
  } = a;
  if (l == null)
    throw new Error(
      "[svelte-i18n] Cannot format a message without first setting the initial locale."
    );
  let u = sa(t, l);
  if (!u)
    u = (o = (i = (r = (n = Et()).handleMissingMessage) == null ? void 0 : r.call(n, { locale: l, id: t, defaultValue: c })) != null ? i : c) != null ? o : t;
  else if (typeof u != "string")
    return console.warn(
      `[svelte-i18n] Message with id "${t}" must be of type "string", found: "${typeof u}". Gettin its value through the "$format" method is deprecated; use the "json" method instead.`
    ), u;
  if (!s)
    return u;
  let f = u;
  try {
    f = s0(u, l).format(s);
  } catch (h) {
    h instanceof Error && console.warn(
      `[svelte-i18n] Message "${t}" has syntax error:`,
      h.message
    );
  }
  return f;
}, c0 = (t, e) => l0(e).format(t), f0 = (t, e) => a0(e).format(t), h0 = (t, e) => o0(e).format(t), _0 = (t, e = ut()) => sa(t, e);
Ct([Jt, Zt], () => u0);
Ct([Jt], () => c0);
Ct([Jt], () => f0);
Ct([Jt], () => h0);
Ct([Jt, Zt], () => _0);
const {
  SvelteComponent: d0,
  append: me,
  attr: et,
  detach: da,
  element: tt,
  init: m0,
  insert: ma,
  noop: io,
  safe_not_equal: g0,
  set_data: bn,
  set_style: yr,
  space: Fr,
  text: gt,
  toggle_class: oo
} = window.__gradio__svelte__internal, { onMount: p0, createEventDispatcher: b0, getContext: v0 } = window.__gradio__svelte__internal;
function ao(t) {
  let e, n, r, i, o = Mt(
    /*file_to_display*/
    t[2]
  ) + "", a, s, l, c, u = (
    /*file_to_display*/
    t[2].orig_name + ""
  ), f;
  return {
    c() {
      e = tt("div"), n = tt("span"), r = tt("div"), i = tt("progress"), a = gt(o), l = Fr(), c = tt("span"), f = gt(u), yr(i, "visibility", "hidden"), yr(i, "height", "0"), yr(i, "width", "0"), i.value = s = Mt(
        /*file_to_display*/
        t[2]
      ), et(i, "max", "100"), et(i, "class", "svelte-12ckl9l"), et(r, "class", "progress-bar svelte-12ckl9l"), et(c, "class", "file-name svelte-12ckl9l"), et(e, "class", "file svelte-12ckl9l");
    },
    m(h, _) {
      ma(h, e, _), me(e, n), me(n, r), me(r, i), me(i, a), me(e, l), me(e, c), me(c, f);
    },
    p(h, _) {
      _ & /*file_to_display*/
      4 && o !== (o = Mt(
        /*file_to_display*/
        h[2]
      ) + "") && bn(a, o), _ & /*file_to_display*/
      4 && s !== (s = Mt(
        /*file_to_display*/
        h[2]
      )) && (i.value = s), _ & /*file_to_display*/
      4 && u !== (u = /*file_to_display*/
      h[2].orig_name + "") && bn(f, u);
    },
    d(h) {
      h && da(e);
    }
  };
}
function w0(t) {
  let e, n, r, i = (
    /*files_with_progress*/
    t[0].length + ""
  ), o, a, s = (
    /*files_with_progress*/
    t[0].length > 1 ? "files" : "file"
  ), l, c, u, f = (
    /*file_to_display*/
    t[2] && ao(t)
  );
  return {
    c() {
      e = tt("div"), n = tt("span"), r = gt("Uploading "), o = gt(i), a = Fr(), l = gt(s), c = gt("..."), u = Fr(), f && f.c(), et(n, "class", "uploading svelte-12ckl9l"), et(e, "class", "wrap svelte-12ckl9l"), oo(
        e,
        "progress",
        /*progress*/
        t[1]
      );
    },
    m(h, _) {
      ma(h, e, _), me(e, n), me(n, r), me(n, o), me(n, a), me(n, l), me(n, c), me(e, u), f && f.m(e, null);
    },
    p(h, [_]) {
      _ & /*files_with_progress*/
      1 && i !== (i = /*files_with_progress*/
      h[0].length + "") && bn(o, i), _ & /*files_with_progress*/
      1 && s !== (s = /*files_with_progress*/
      h[0].length > 1 ? "files" : "file") && bn(l, s), /*file_to_display*/
      h[2] ? f ? f.p(h, _) : (f = ao(h), f.c(), f.m(e, null)) : f && (f.d(1), f = null), _ & /*progress*/
      2 && oo(
        e,
        "progress",
        /*progress*/
        h[1]
      );
    },
    i: io,
    o: io,
    d(h) {
      h && da(e), f && f.d();
    }
  };
}
function Mt(t) {
  return t.progress * 100 / (t.size || 0) || 0;
}
function y0(t) {
  let e = 0;
  return t.forEach((n) => {
    e += Mt(n);
  }), document.documentElement.style.setProperty("--upload-progress-width", (e / t.length).toFixed(2) + "%"), e / t.length;
}
function E0(t, e, n) {
  let { upload_id: r } = e, { root: i } = e, { files: o } = e, a, s = !1, l, c, u = o.map((g) => ({ ...g, progress: 0 }));
  const f = b0();
  function h(g, m) {
    n(0, u = u.map((v) => (v.orig_name === g && (v.progress += m), v)));
  }
  const _ = v0("EventSource_factory");
  return p0(() => {
    a = _(new URL(`${i}/upload_progress?upload_id=${r}`)), a.onmessage = async function(g) {
      const m = JSON.parse(g.data);
      s || n(1, s = !0), m.msg === "done" ? (a.close(), f("done")) : (n(6, l = m), h(m.orig_name, m.chunk_size));
    };
  }), t.$$set = (g) => {
    "upload_id" in g && n(3, r = g.upload_id), "root" in g && n(4, i = g.root), "files" in g && n(5, o = g.files);
  }, t.$$.update = () => {
    t.$$.dirty & /*files_with_progress*/
    1 && y0(u), t.$$.dirty & /*current_file_upload, files_with_progress*/
    65 && n(2, c = l || u[0]);
  }, [
    u,
    s,
    c,
    r,
    i,
    o,
    l
  ];
}
class S0 extends d0 {
  constructor(e) {
    super(), m0(this, e, E0, w0, g0, { upload_id: 3, root: 4, files: 5 });
  }
}
const {
  SvelteComponent: k0,
  append: lo,
  attr: oe,
  binding_callbacks: T0,
  bubble: Ye,
  check_outros: ga,
  create_component: A0,
  create_slot: pa,
  destroy_component: B0,
  detach: Rn,
  element: jr,
  empty: ba,
  get_all_dirty_from_scope: va,
  get_slot_changes: wa,
  group_outros: ya,
  init: C0,
  insert: Mn,
  listen: be,
  mount_component: H0,
  prevent_default: Ke,
  run_all: P0,
  safe_not_equal: I0,
  set_style: Ea,
  space: N0,
  stop_propagation: $e,
  toggle_class: ae,
  transition_in: Xe,
  transition_out: ot,
  update_slot_base: Sa
} = window.__gradio__svelte__internal, { createEventDispatcher: O0, tick: L0, getContext: R0 } = window.__gradio__svelte__internal;
function M0(t) {
  let e, n, r, i, o, a, s, l, c, u;
  const f = (
    /*#slots*/
    t[22].default
  ), h = pa(
    f,
    t,
    /*$$scope*/
    t[21],
    null
  );
  return {
    c() {
      e = jr("button"), h && h.c(), n = N0(), r = jr("input"), oe(r, "aria-label", "file upload"), oe(r, "data-testid", "file-upload"), oe(r, "type", "file"), oe(
        r,
        "accept",
        /*accept_file_types*/
        t[12]
      ), r.multiple = i = /*file_count*/
      t[5] === "multiple" || void 0, oe(r, "webkitdirectory", o = /*file_count*/
      t[5] === "directory" || void 0), oe(r, "mozdirectory", a = /*file_count*/
      t[5] === "directory" || void 0), oe(r, "class", "svelte-1aq8tno"), oe(e, "tabindex", s = /*hidden*/
      t[7] ? -1 : 0), oe(e, "class", "svelte-1aq8tno"), ae(
        e,
        "hidden",
        /*hidden*/
        t[7]
      ), ae(
        e,
        "center",
        /*center*/
        t[3]
      ), ae(
        e,
        "boundedheight",
        /*boundedheight*/
        t[2]
      ), ae(
        e,
        "flex",
        /*flex*/
        t[4]
      ), Ea(e, "height", "100%");
    },
    m(_, g) {
      Mn(_, e, g), h && h.m(e, null), lo(e, n), lo(e, r), t[30](r), l = !0, c || (u = [
        be(
          r,
          "change",
          /*load_files_from_upload*/
          t[15]
        ),
        be(e, "drag", $e(Ke(
          /*drag_handler*/
          t[23]
        ))),
        be(e, "dragstart", $e(Ke(
          /*dragstart_handler*/
          t[24]
        ))),
        be(e, "dragend", $e(Ke(
          /*dragend_handler*/
          t[25]
        ))),
        be(e, "dragover", $e(Ke(
          /*dragover_handler*/
          t[26]
        ))),
        be(e, "dragenter", $e(Ke(
          /*dragenter_handler*/
          t[27]
        ))),
        be(e, "dragleave", $e(Ke(
          /*dragleave_handler*/
          t[28]
        ))),
        be(e, "drop", $e(Ke(
          /*drop_handler*/
          t[29]
        ))),
        be(
          e,
          "click",
          /*open_file_upload*/
          t[9]
        ),
        be(
          e,
          "drop",
          /*loadFilesFromDrop*/
          t[16]
        ),
        be(
          e,
          "dragenter",
          /*updateDragging*/
          t[14]
        ),
        be(
          e,
          "dragleave",
          /*updateDragging*/
          t[14]
        )
      ], c = !0);
    },
    p(_, g) {
      h && h.p && (!l || g[0] & /*$$scope*/
      2097152) && Sa(
        h,
        f,
        _,
        /*$$scope*/
        _[21],
        l ? wa(
          f,
          /*$$scope*/
          _[21],
          g,
          null
        ) : va(
          /*$$scope*/
          _[21]
        ),
        null
      ), (!l || g[0] & /*accept_file_types*/
      4096) && oe(
        r,
        "accept",
        /*accept_file_types*/
        _[12]
      ), (!l || g[0] & /*file_count*/
      32 && i !== (i = /*file_count*/
      _[5] === "multiple" || void 0)) && (r.multiple = i), (!l || g[0] & /*file_count*/
      32 && o !== (o = /*file_count*/
      _[5] === "directory" || void 0)) && oe(r, "webkitdirectory", o), (!l || g[0] & /*file_count*/
      32 && a !== (a = /*file_count*/
      _[5] === "directory" || void 0)) && oe(r, "mozdirectory", a), (!l || g[0] & /*hidden*/
      128 && s !== (s = /*hidden*/
      _[7] ? -1 : 0)) && oe(e, "tabindex", s), (!l || g[0] & /*hidden*/
      128) && ae(
        e,
        "hidden",
        /*hidden*/
        _[7]
      ), (!l || g[0] & /*center*/
      8) && ae(
        e,
        "center",
        /*center*/
        _[3]
      ), (!l || g[0] & /*boundedheight*/
      4) && ae(
        e,
        "boundedheight",
        /*boundedheight*/
        _[2]
      ), (!l || g[0] & /*flex*/
      16) && ae(
        e,
        "flex",
        /*flex*/
        _[4]
      );
    },
    i(_) {
      l || (Xe(h, _), l = !0);
    },
    o(_) {
      ot(h, _), l = !1;
    },
    d(_) {
      _ && Rn(e), h && h.d(_), t[30](null), c = !1, P0(u);
    }
  };
}
function D0(t) {
  let e, n, r = !/*hidden*/
  t[7] && so(t);
  return {
    c() {
      r && r.c(), e = ba();
    },
    m(i, o) {
      r && r.m(i, o), Mn(i, e, o), n = !0;
    },
    p(i, o) {
      /*hidden*/
      i[7] ? r && (ya(), ot(r, 1, 1, () => {
        r = null;
      }), ga()) : r ? (r.p(i, o), o[0] & /*hidden*/
      128 && Xe(r, 1)) : (r = so(i), r.c(), Xe(r, 1), r.m(e.parentNode, e));
    },
    i(i) {
      n || (Xe(r), n = !0);
    },
    o(i) {
      ot(r), n = !1;
    },
    d(i) {
      i && Rn(e), r && r.d(i);
    }
  };
}
function U0(t) {
  let e, n, r, i, o;
  const a = (
    /*#slots*/
    t[22].default
  ), s = pa(
    a,
    t,
    /*$$scope*/
    t[21],
    null
  );
  return {
    c() {
      e = jr("button"), s && s.c(), oe(e, "tabindex", n = /*hidden*/
      t[7] ? -1 : 0), oe(e, "class", "svelte-1aq8tno"), ae(
        e,
        "hidden",
        /*hidden*/
        t[7]
      ), ae(
        e,
        "center",
        /*center*/
        t[3]
      ), ae(
        e,
        "boundedheight",
        /*boundedheight*/
        t[2]
      ), ae(
        e,
        "flex",
        /*flex*/
        t[4]
      ), Ea(e, "height", "100%");
    },
    m(l, c) {
      Mn(l, e, c), s && s.m(e, null), r = !0, i || (o = be(
        e,
        "click",
        /*paste_clipboard*/
        t[8]
      ), i = !0);
    },
    p(l, c) {
      s && s.p && (!r || c[0] & /*$$scope*/
      2097152) && Sa(
        s,
        a,
        l,
        /*$$scope*/
        l[21],
        r ? wa(
          a,
          /*$$scope*/
          l[21],
          c,
          null
        ) : va(
          /*$$scope*/
          l[21]
        ),
        null
      ), (!r || c[0] & /*hidden*/
      128 && n !== (n = /*hidden*/
      l[7] ? -1 : 0)) && oe(e, "tabindex", n), (!r || c[0] & /*hidden*/
      128) && ae(
        e,
        "hidden",
        /*hidden*/
        l[7]
      ), (!r || c[0] & /*center*/
      8) && ae(
        e,
        "center",
        /*center*/
        l[3]
      ), (!r || c[0] & /*boundedheight*/
      4) && ae(
        e,
        "boundedheight",
        /*boundedheight*/
        l[2]
      ), (!r || c[0] & /*flex*/
      16) && ae(
        e,
        "flex",
        /*flex*/
        l[4]
      );
    },
    i(l) {
      r || (Xe(s, l), r = !0);
    },
    o(l) {
      ot(s, l), r = !1;
    },
    d(l) {
      l && Rn(e), s && s.d(l), i = !1, o();
    }
  };
}
function so(t) {
  let e, n;
  return e = new S0({
    props: {
      root: (
        /*root*/
        t[6]
      ),
      upload_id: (
        /*upload_id*/
        t[10]
      ),
      files: (
        /*file_data*/
        t[11]
      )
    }
  }), {
    c() {
      A0(e.$$.fragment);
    },
    m(r, i) {
      H0(e, r, i), n = !0;
    },
    p(r, i) {
      const o = {};
      i[0] & /*root*/
      64 && (o.root = /*root*/
      r[6]), i[0] & /*upload_id*/
      1024 && (o.upload_id = /*upload_id*/
      r[10]), i[0] & /*file_data*/
      2048 && (o.files = /*file_data*/
      r[11]), e.$set(o);
    },
    i(r) {
      n || (Xe(e.$$.fragment, r), n = !0);
    },
    o(r) {
      ot(e.$$.fragment, r), n = !1;
    },
    d(r) {
      B0(e, r);
    }
  };
}
function x0(t) {
  let e, n, r, i;
  const o = [U0, D0, M0], a = [];
  function s(l, c) {
    return (
      /*filetype*/
      l[0] === "clipboard" ? 0 : (
        /*uploading*/
        l[1] ? 1 : 2
      )
    );
  }
  return e = s(t), n = a[e] = o[e](t), {
    c() {
      n.c(), r = ba();
    },
    m(l, c) {
      a[e].m(l, c), Mn(l, r, c), i = !0;
    },
    p(l, c) {
      let u = e;
      e = s(l), e === u ? a[e].p(l, c) : (ya(), ot(a[u], 1, 1, () => {
        a[u] = null;
      }), ga(), n = a[e], n ? n.p(l, c) : (n = a[e] = o[e](l), n.c()), Xe(n, 1), n.m(r.parentNode, r));
    },
    i(l) {
      i || (Xe(n), i = !0);
    },
    o(l) {
      ot(n), i = !1;
    },
    d(l) {
      l && Rn(r), a[e].d(l);
    }
  };
}
function uo(t) {
  let e, n = t[0], r = 1;
  for (; r < t.length; ) {
    const i = t[r], o = t[r + 1];
    if (r += 2, (i === "optionalAccess" || i === "optionalCall") && n == null)
      return;
    i === "access" || i === "optionalAccess" ? (e = n, n = o(n)) : (i === "call" || i === "optionalCall") && (n = o((...a) => n.call(e, ...a)), e = void 0);
  }
  return n;
}
function G0(t, e) {
  return !t || t === "*" || t === "file/*" ? !0 : (typeof t == "string" && t.endsWith("/*") && (t = t.split(",")), Array.isArray(t) ? t.includes(e) || t.some((n) => {
    const [r] = n.split("/");
    return n.endsWith("/*") && e.startsWith(r + "/");
  }) : t === e);
}
function F0(t, e, n) {
  let { $$slots: r = {}, $$scope: i } = e, { filetype: o = null } = e, { dragging: a = !1 } = e, { boundedheight: s = !0 } = e, { center: l = !0 } = e, { flex: c = !0 } = e, { file_count: u = "single" } = e, { disable_click: f = !1 } = e, { root: h } = e, { hidden: _ = !1 } = e, { format: g = "file" } = e, { uploading: m = !1 } = e, v, b, y;
  const C = R0("upload_files");
  let H;
  const I = O0();
  function p() {
    n(17, a = !a);
  }
  function D() {
    navigator.clipboard.read().then(async (d) => {
      for (let A = 0; A < d.length; A++) {
        const O = d[A].types.find((L) => L.startsWith("image/"));
        if (O) {
          d[A].getType(O).then(async (L) => {
            const k = new File([L], `clipboard.${O.replace("image/", "")}`);
            await Z([k]);
          });
          break;
        }
      }
    });
  }
  function S() {
    f || (n(13, H.value = "", H), H.click());
  }
  async function w(d) {
    await L0(), n(10, v = Math.random().toString(36).substring(2, 15)), n(1, m = !0);
    const A = await xo(d, h, v, C);
    return I("load", u === "single" ? uo([A, "optionalAccess", (O) => O[0]]) : A), n(1, m = !1), A || [];
  }
  async function Z(d) {
    if (!d.length)
      return;
    let A = d.map((O) => new File([O], O.name));
    return n(11, b = await Go(A)), await w(b);
  }
  async function G(d) {
    const A = d.target;
    if (A.files)
      if (g != "blob")
        await Z(Array.from(A.files));
      else {
        if (u === "single") {
          I("load", A.files[0]);
          return;
        }
        I("load", A.files);
      }
  }
  async function le(d) {
    if (n(17, a = !1), !uo([d, "access", (O) => O.dataTransfer, "optionalAccess", (O) => O.files]))
      return;
    const A = Array.from(d.dataTransfer.files).filter((O) => {
      const L = "." + O.name.split(".").pop();
      return O.type && G0(o, O.type) || (L && Array.isArray(o) ? o.includes(L) : L === o) ? !0 : (I("error", `Invalid file type only ${o} allowed.`), !1);
    });
    await Z(A);
  }
  function ne(d) {
    Ye.call(this, t, d);
  }
  function T(d) {
    Ye.call(this, t, d);
  }
  function j(d) {
    Ye.call(this, t, d);
  }
  function Ie(d) {
    Ye.call(this, t, d);
  }
  function E(d) {
    Ye.call(this, t, d);
  }
  function Me(d) {
    Ye.call(this, t, d);
  }
  function Je(d) {
    Ye.call(this, t, d);
  }
  function Ne(d) {
    T0[d ? "unshift" : "push"](() => {
      H = d, n(13, H);
    });
  }
  return t.$$set = (d) => {
    "filetype" in d && n(0, o = d.filetype), "dragging" in d && n(17, a = d.dragging), "boundedheight" in d && n(2, s = d.boundedheight), "center" in d && n(3, l = d.center), "flex" in d && n(4, c = d.flex), "file_count" in d && n(5, u = d.file_count), "disable_click" in d && n(18, f = d.disable_click), "root" in d && n(6, h = d.root), "hidden" in d && n(7, _ = d.hidden), "format" in d && n(19, g = d.format), "uploading" in d && n(1, m = d.uploading), "$$scope" in d && n(21, i = d.$$scope);
  }, t.$$.update = () => {
    t.$$.dirty[0] & /*filetype*/
    1 && (o == null || typeof o == "string" ? n(12, y = o) : (n(0, o = o.map((d) => d.startsWith(".") ? d : d + "/*")), n(12, y = o.join(", "))));
  }, [
    o,
    m,
    s,
    l,
    c,
    u,
    h,
    _,
    D,
    S,
    v,
    b,
    y,
    H,
    p,
    G,
    le,
    a,
    f,
    g,
    Z,
    i,
    r,
    ne,
    T,
    j,
    Ie,
    E,
    Me,
    Je,
    Ne
  ];
}
class j0 extends k0 {
  constructor(e) {
    super(), C0(
      this,
      e,
      F0,
      x0,
      I0,
      {
        filetype: 0,
        dragging: 17,
        boundedheight: 2,
        center: 3,
        flex: 4,
        file_count: 5,
        disable_click: 18,
        root: 6,
        hidden: 7,
        format: 19,
        uploading: 1,
        paste_clipboard: 8,
        open_file_upload: 9,
        load_files: 20
      },
      null,
      [-1, -1]
    );
  }
  get paste_clipboard() {
    return this.$$.ctx[8];
  }
  get open_file_upload() {
    return this.$$.ctx[9];
  }
  get load_files() {
    return this.$$.ctx[20];
  }
}
const {
  SvelteComponent: q0,
  attr: z0,
  create_component: V0,
  destroy_component: W0,
  detach: X0,
  element: Z0,
  init: J0,
  insert: Q0,
  mount_component: Y0,
  noop: K0,
  safe_not_equal: $0,
  transition_in: e_,
  transition_out: t_
} = window.__gradio__svelte__internal, { createEventDispatcher: n_ } = window.__gradio__svelte__internal;
function r_(t) {
  let e, n, r;
  return n = new Xr({
    props: { Icon: cs, label: "Remove Image" }
  }), n.$on(
    "click",
    /*click_handler*/
    t[1]
  ), {
    c() {
      e = Z0("div"), V0(n.$$.fragment), z0(e, "class", "svelte-1g74h68");
    },
    m(i, o) {
      Q0(i, e, o), Y0(n, e, null), r = !0;
    },
    p: K0,
    i(i) {
      r || (e_(n.$$.fragment, i), r = !0);
    },
    o(i) {
      t_(n.$$.fragment, i), r = !1;
    },
    d(i) {
      i && X0(e), W0(n);
    }
  };
}
function i_(t) {
  const e = n_();
  return [e, (r) => {
    e("remove_image"), r.stopPropagation();
  }];
}
class o_ extends q0 {
  constructor(e) {
    super(), J0(this, e, i_, r_, $0, {});
  }
}
const {
  SvelteComponent: a_,
  add_flush_callback: qr,
  append: an,
  attr: fn,
  bind: zr,
  binding_callbacks: vn,
  bubble: Er,
  check_outros: hn,
  create_component: St,
  create_slot: l_,
  destroy_component: kt,
  detach: wn,
  element: Vr,
  empty: s_,
  get_all_dirty_from_scope: u_,
  get_slot_changes: c_,
  group_outros: _n,
  init: f_,
  insert: yn,
  listen: h_,
  mount_component: Tt,
  noop: __,
  safe_not_equal: d_,
  space: ln,
  toggle_class: co,
  transition_in: ee,
  transition_out: ue,
  update_slot_base: m_
} = window.__gradio__svelte__internal, { createEventDispatcher: g_, tick: p_ } = window.__gradio__svelte__internal;
function fo(t) {
  let e, n;
  return e = new o_({}), e.$on(
    "remove_image",
    /*remove_image_handler*/
    t[22]
  ), {
    c() {
      St(e.$$.fragment);
    },
    m(r, i) {
      Tt(e, r, i), n = !0;
    },
    p: __,
    i(r) {
      n || (ee(e.$$.fragment, r), n = !0);
    },
    o(r) {
      ue(e.$$.fragment, r), n = !1;
    },
    d(r) {
      kt(e, r);
    }
  };
}
function ho(t) {
  let e;
  const n = (
    /*#slots*/
    t[21].default
  ), r = l_(
    n,
    t,
    /*$$scope*/
    t[33],
    null
  );
  return {
    c() {
      r && r.c();
    },
    m(i, o) {
      r && r.m(i, o), e = !0;
    },
    p(i, o) {
      r && r.p && (!e || o[1] & /*$$scope*/
      4) && m_(
        r,
        n,
        i,
        /*$$scope*/
        i[33],
        e ? c_(
          n,
          /*$$scope*/
          i[33],
          o,
          null
        ) : u_(
          /*$$scope*/
          i[33]
        ),
        null
      );
    },
    i(i) {
      e || (ee(r, i), e = !0);
    },
    o(i) {
      ue(r, i), e = !1;
    },
    d(i) {
      r && r.d(i);
    }
  };
}
function b_(t) {
  let e, n, r = (
    /*value*/
    t[0] === null && ho(t)
  );
  return {
    c() {
      r && r.c(), e = s_();
    },
    m(i, o) {
      r && r.m(i, o), yn(i, e, o), n = !0;
    },
    p(i, o) {
      /*value*/
      i[0] === null ? r ? (r.p(i, o), o[0] & /*value*/
      1 && ee(r, 1)) : (r = ho(i), r.c(), ee(r, 1), r.m(e.parentNode, e)) : r && (_n(), ue(r, 1, 1, () => {
        r = null;
      }), hn());
    },
    i(i) {
      n || (ee(r), n = !0);
    },
    o(i) {
      ue(r), n = !1;
    },
    d(i) {
      i && wn(e), r && r.d(i);
    }
  };
}
function v_(t) {
  let e, n, r, i, o;
  return n = new Kr({
    props: {
      src: (
        /*value*/
        t[0].url
      ),
      alt: (
        /*value*/
        t[0].alt_text
      )
    }
  }), {
    c() {
      e = Vr("div"), St(n.$$.fragment), fn(e, "class", "image-frame svelte-xgcoa0"), co(
        e,
        "selectable",
        /*selectable*/
        t[7]
      );
    },
    m(a, s) {
      yn(a, e, s), Tt(n, e, null), r = !0, i || (o = h_(
        e,
        "click",
        /*handle_click*/
        t[18]
      ), i = !0);
    },
    p(a, s) {
      const l = {};
      s[0] & /*value*/
      1 && (l.src = /*value*/
      a[0].url), s[0] & /*value*/
      1 && (l.alt = /*value*/
      a[0].alt_text), n.$set(l), (!r || s[0] & /*selectable*/
      128) && co(
        e,
        "selectable",
        /*selectable*/
        a[7]
      );
    },
    i(a) {
      r || (ee(n.$$.fragment, a), r = !0);
    },
    o(a) {
      ue(n.$$.fragment, a), r = !1;
    },
    d(a) {
      a && wn(e), kt(n), i = !1, o();
    }
  };
}
function w_(t) {
  let e, n;
  return e = new Cf({
    props: {
      root: (
        /*root*/
        t[8]
      ),
      mirror_webcam: (
        /*mirror_webcam*/
        t[6]
      ),
      streaming: (
        /*streaming*/
        t[5]
      ),
      mode: "image",
      include_audio: !1,
      i18n: (
        /*i18n*/
        t[9]
      )
    }
  }), e.$on(
    "capture",
    /*capture_handler*/
    t[27]
  ), e.$on(
    "stream",
    /*stream_handler*/
    t[28]
  ), e.$on(
    "error",
    /*error_handler_1*/
    t[29]
  ), e.$on(
    "drag",
    /*drag_handler*/
    t[30]
  ), e.$on(
    "upload",
    /*upload_handler*/
    t[31]
  ), {
    c() {
      St(e.$$.fragment);
    },
    m(r, i) {
      Tt(e, r, i), n = !0;
    },
    p(r, i) {
      const o = {};
      i[0] & /*root*/
      256 && (o.root = /*root*/
      r[8]), i[0] & /*mirror_webcam*/
      64 && (o.mirror_webcam = /*mirror_webcam*/
      r[6]), i[0] & /*streaming*/
      32 && (o.streaming = /*streaming*/
      r[5]), i[0] & /*i18n*/
      512 && (o.i18n = /*i18n*/
      r[9]), e.$set(o);
    },
    i(r) {
      n || (ee(e.$$.fragment, r), n = !0);
    },
    o(r) {
      ue(e.$$.fragment, r), n = !1;
    },
    d(r) {
      kt(e, r);
    }
  };
}
function _o(t) {
  let e, n, r;
  function i(a) {
    t[32](a);
  }
  let o = {
    sources: (
      /*sources*/
      t[4]
    ),
    handle_clear: (
      /*handle_clear*/
      t[15]
    ),
    handle_select: (
      /*handle_select_source*/
      t[19]
    )
  };
  return (
    /*active_source*/
    t[1] !== void 0 && (o.active_source = /*active_source*/
    t[1]), e = new Fu({ props: o }), vn.push(() => zr(e, "active_source", i)), {
      c() {
        St(e.$$.fragment);
      },
      m(a, s) {
        Tt(e, a, s), r = !0;
      },
      p(a, s) {
        const l = {};
        s[0] & /*sources*/
        16 && (l.sources = /*sources*/
        a[4]), !n && s[0] & /*active_source*/
        2 && (n = !0, l.active_source = /*active_source*/
        a[1], qr(() => n = !1)), e.$set(l);
      },
      i(a) {
        r || (ee(e.$$.fragment, a), r = !0);
      },
      o(a) {
        ue(e.$$.fragment, a), r = !1;
      },
      d(a) {
        kt(e, a);
      }
    }
  );
}
function y_(t) {
  var D;
  let e, n, r, i, o, a, s, l, c, u, f, h, _ = (
    /*sources*/
    t[4].length > 1 || /*sources*/
    t[4].includes("clipboard")
  ), g;
  e = new Wr({
    props: {
      show_label: (
        /*show_label*/
        t[3]
      ),
      Icon: En,
      label: (
        /*label*/
        t[2] || "Image"
      )
    }
  });
  let m = (
    /*value*/
    ((D = t[0]) == null ? void 0 : D.url) && !/*active_streaming*/
    t[12] && fo(t)
  );
  function v(S) {
    t[24](S);
  }
  function b(S) {
    t[25](S);
  }
  let y = {
    hidden: (
      /*value*/
      t[0] !== null || /*active_source*/
      t[1] === "webcam"
    ),
    filetype: (
      /*active_source*/
      t[1] === "clipboard" ? "clipboard" : "image/*"
    ),
    root: (
      /*root*/
      t[8]
    ),
    disable_click: !/*sources*/
    t[4].includes("upload"),
    $$slots: { default: [b_] },
    $$scope: { ctx: t }
  };
  /*uploading*/
  t[10] !== void 0 && (y.uploading = /*uploading*/
  t[10]), /*dragging*/
  t[11] !== void 0 && (y.dragging = /*dragging*/
  t[11]), a = new j0({ props: y }), t[23](a), vn.push(() => zr(a, "uploading", v)), vn.push(() => zr(a, "dragging", b)), a.$on(
    "load",
    /*handle_upload*/
    t[14]
  ), a.$on(
    "error",
    /*error_handler*/
    t[26]
  );
  const C = [w_, v_], H = [];
  function I(S, w) {
    return (
      /*active_source*/
      S[1] === "webcam" && /*streaming*/
      (S[5] || !/*streaming*/
      S[5] && !/*value*/
      S[0]) ? 0 : (
        /*value*/
        S[0] !== null && !/*streaming*/
        S[5] ? 1 : -1
      )
    );
  }
  ~(u = I(t)) && (f = H[u] = C[u](t));
  let p = _ && _o(t);
  return {
    c() {
      St(e.$$.fragment), n = ln(), r = Vr("div"), m && m.c(), i = ln(), o = Vr("div"), St(a.$$.fragment), c = ln(), f && f.c(), h = ln(), p && p.c(), fn(o, "class", "upload-container svelte-xgcoa0"), fn(r, "data-testid", "image"), fn(r, "class", "image-container svelte-xgcoa0");
    },
    m(S, w) {
      Tt(e, S, w), yn(S, n, w), yn(S, r, w), m && m.m(r, null), an(r, i), an(r, o), Tt(a, o, null), an(o, c), ~u && H[u].m(o, null), an(r, h), p && p.m(r, null), g = !0;
    },
    p(S, w) {
      var ne;
      const Z = {};
      w[0] & /*show_label*/
      8 && (Z.show_label = /*show_label*/
      S[3]), w[0] & /*label*/
      4 && (Z.label = /*label*/
      S[2] || "Image"), e.$set(Z), /*value*/
      (ne = S[0]) != null && ne.url && !/*active_streaming*/
      S[12] ? m ? (m.p(S, w), w[0] & /*value, active_streaming*/
      4097 && ee(m, 1)) : (m = fo(S), m.c(), ee(m, 1), m.m(r, i)) : m && (_n(), ue(m, 1, 1, () => {
        m = null;
      }), hn());
      const G = {};
      w[0] & /*value, active_source*/
      3 && (G.hidden = /*value*/
      S[0] !== null || /*active_source*/
      S[1] === "webcam"), w[0] & /*active_source*/
      2 && (G.filetype = /*active_source*/
      S[1] === "clipboard" ? "clipboard" : "image/*"), w[0] & /*root*/
      256 && (G.root = /*root*/
      S[8]), w[0] & /*sources*/
      16 && (G.disable_click = !/*sources*/
      S[4].includes("upload")), w[0] & /*value*/
      1 | w[1] & /*$$scope*/
      4 && (G.$$scope = { dirty: w, ctx: S }), !s && w[0] & /*uploading*/
      1024 && (s = !0, G.uploading = /*uploading*/
      S[10], qr(() => s = !1)), !l && w[0] & /*dragging*/
      2048 && (l = !0, G.dragging = /*dragging*/
      S[11], qr(() => l = !1)), a.$set(G);
      let le = u;
      u = I(S), u === le ? ~u && H[u].p(S, w) : (f && (_n(), ue(H[le], 1, 1, () => {
        H[le] = null;
      }), hn()), ~u ? (f = H[u], f ? f.p(S, w) : (f = H[u] = C[u](S), f.c()), ee(f, 1), f.m(o, null)) : f = null), w[0] & /*sources*/
      16 && (_ = /*sources*/
      S[4].length > 1 || /*sources*/
      S[4].includes("clipboard")), _ ? p ? (p.p(S, w), w[0] & /*sources*/
      16 && ee(p, 1)) : (p = _o(S), p.c(), ee(p, 1), p.m(r, null)) : p && (_n(), ue(p, 1, 1, () => {
        p = null;
      }), hn());
    },
    i(S) {
      g || (ee(e.$$.fragment, S), ee(m), ee(a.$$.fragment, S), ee(f), ee(p), g = !0);
    },
    o(S) {
      ue(e.$$.fragment, S), ue(m), ue(a.$$.fragment, S), ue(f), ue(p), g = !1;
    },
    d(S) {
      S && (wn(n), wn(r)), kt(e, S), m && m.d(), t[23](null), kt(a), ~u && H[u].d(), p && p.d();
    }
  };
}
function E_(t) {
  let e, n = t[0], r = 1;
  for (; r < t.length; ) {
    const i = t[r], o = t[r + 1];
    if (r += 2, (i === "optionalAccess" || i === "optionalCall") && n == null)
      return;
    i === "access" || i === "optionalAccess" ? (e = n, n = o(n)) : (i === "call" || i === "optionalCall") && (n = o((...a) => n.call(e, ...a)), e = void 0);
  }
  return n;
}
function S_(t, e, n) {
  let r, { $$slots: i = {}, $$scope: o } = e, { value: a } = e, { label: s = void 0 } = e, { show_label: l } = e, { sources: c = ["upload", "clipboard", "webcam"] } = e, { streaming: u = !1 } = e, { pending: f = !1 } = e, { mirror_webcam: h } = e, { selectable: _ = !1 } = e, { root: g } = e, { i18n: m } = e, v, b = !1, { active_source: y = null } = e;
  function C({ detail: d }) {
    n(0, a = xe(d, g, null)), p("upload");
  }
  function H() {
    n(0, a = null), p("clear"), p("change", null);
  }
  async function I(d) {
    n(20, f = !0);
    const A = await v.load_files([new File([d], "webcam.png")]);
    n(0, a = E_([A, "optionalAccess", (O) => O[0]]) || null), await p_(), p(u ? "stream" : "change"), n(20, f = !1);
  }
  const p = g_();
  let D = !1;
  function S(d) {
    let A = Bo(d);
    A && p("select", { index: A, value: null });
  }
  async function w(d) {
    switch (d) {
      case "clipboard":
        v.paste_clipboard();
        break;
    }
  }
  const Z = () => {
    n(0, a = null), p("clear");
  };
  function G(d) {
    vn[d ? "unshift" : "push"](() => {
      v = d, n(13, v);
    });
  }
  function le(d) {
    b = d, n(10, b);
  }
  function ne(d) {
    D = d, n(11, D);
  }
  function T(d) {
    Er.call(this, t, d);
  }
  const j = (d) => I(d.detail), Ie = (d) => I(d.detail);
  function E(d) {
    Er.call(this, t, d);
  }
  function Me(d) {
    Er.call(this, t, d);
  }
  const Je = (d) => I(d.detail);
  function Ne(d) {
    y = d, n(1, y), n(4, c);
  }
  return t.$$set = (d) => {
    "value" in d && n(0, a = d.value), "label" in d && n(2, s = d.label), "show_label" in d && n(3, l = d.show_label), "sources" in d && n(4, c = d.sources), "streaming" in d && n(5, u = d.streaming), "pending" in d && n(20, f = d.pending), "mirror_webcam" in d && n(6, h = d.mirror_webcam), "selectable" in d && n(7, _ = d.selectable), "root" in d && n(8, g = d.root), "i18n" in d && n(9, m = d.i18n), "active_source" in d && n(1, y = d.active_source), "$$scope" in d && n(33, o = d.$$scope);
  }, t.$$.update = () => {
    t.$$.dirty[0] & /*active_source, sources*/
    18 && !y && c && n(1, y = c[0]), t.$$.dirty[0] & /*streaming, active_source*/
    34 && n(12, r = u && y === "webcam"), t.$$.dirty[0] & /*uploading, active_streaming*/
    5120 && b && !r && n(0, a = null), t.$$.dirty[0] & /*value, root*/
    257 && a && !a.url && n(0, a = xe(a, g, null)), t.$$.dirty[0] & /*dragging*/
    2048 && p("drag", D);
  }, [
    a,
    y,
    s,
    l,
    c,
    u,
    h,
    _,
    g,
    m,
    b,
    D,
    r,
    v,
    C,
    H,
    I,
    p,
    S,
    w,
    f,
    i,
    Z,
    G,
    le,
    ne,
    T,
    j,
    Ie,
    E,
    Me,
    Je,
    Ne,
    o
  ];
}
class j_ extends a_ {
  constructor(e) {
    super(), f_(
      this,
      e,
      S_,
      y_,
      d_,
      {
        value: 0,
        label: 2,
        show_label: 3,
        sources: 4,
        streaming: 5,
        pending: 20,
        mirror_webcam: 6,
        selectable: 7,
        root: 8,
        i18n: 9,
        active_source: 1
      },
      null,
      [-1, -1]
    );
  }
}
const {
  SvelteComponent: k_,
  append: ka,
  attr: Ta,
  check_outros: mo,
  create_component: Dn,
  destroy_component: Un,
  detach: Aa,
  element: Ba,
  ensure_array_like: go,
  flush: z,
  group_outros: po,
  init: T_,
  insert: Ca,
  mount_component: xn,
  outro_and_destroy_block: A_,
  safe_not_equal: B_,
  space: Ha,
  transition_in: We,
  transition_out: nt,
  update_keyed_each: C_
} = window.__gradio__svelte__internal;
function bo(t, e, n) {
  const r = t.slice();
  return r[14] = e[n], r;
}
function vo(t) {
  let e, n;
  return e = new Wr({
    props: {
      show_label: (
        /*show_label*/
        t[4]
      ),
      Icon: En,
      float: !1,
      label: (
        /*label*/
        t[3] || "ImageFeed"
      )
    }
  }), {
    c() {
      Dn(e.$$.fragment);
    },
    m(r, i) {
      xn(e, r, i), n = !0;
    },
    p(r, i) {
      const o = {};
      i[0] & /*show_label*/
      16 && (o.show_label = /*show_label*/
      r[4]), i[0] & /*label*/
      8 && (o.label = /*label*/
      r[3] || "ImageFeed"), e.$set(o);
    },
    i(r) {
      n || (We(e.$$.fragment, r), n = !0);
    },
    o(r) {
      nt(e.$$.fragment, r), n = !1;
    },
    d(r) {
      Un(e, r);
    }
  };
}
function H_(t) {
  let e, n;
  return e = new xc({
    props: {
      value: (
        /*_value*/
        t[14]
      ),
      label: (
        /*label*/
        t[3]
      ),
      show_label: !1,
      show_download_button: (
        /*show_download_button*/
        t[5]
      ),
      selectable: (
        /*_selectable*/
        t[8]
      ),
      show_share_button: (
        /*show_share_button*/
        t[12]
      ),
      i18n: (
        /*gradio*/
        t[13].i18n
      )
    }
  }), e.$on(
    "select",
    /*select_handler*/
    t[27]
  ), e.$on(
    "share",
    /*share_handler*/
    t[28]
  ), e.$on(
    "error",
    /*error_handler*/
    t[29]
  ), {
    c() {
      Dn(e.$$.fragment);
    },
    m(r, i) {
      xn(e, r, i), n = !0;
    },
    p(r, i) {
      const o = {};
      i[0] & /*label*/
      8 && (o.label = /*label*/
      r[3]), i[0] & /*show_download_button*/
      32 && (o.show_download_button = /*show_download_button*/
      r[5]), i[0] & /*_selectable*/
      256 && (o.selectable = /*_selectable*/
      r[8]), i[0] & /*show_share_button*/
      4096 && (o.show_share_button = /*show_share_button*/
      r[12]), i[0] & /*gradio*/
      8192 && (o.i18n = /*gradio*/
      r[13].i18n), e.$set(o);
    },
    i(r) {
      n || (We(e.$$.fragment, r), n = !0);
    },
    o(r) {
      nt(e.$$.fragment, r), n = !1;
    },
    d(r) {
      Un(e, r);
    }
  };
}
function wo(t, e) {
  let n, r, i, o;
  return r = new So({
    props: {
      visible: (
        /*visible*/
        e[2]
      ),
      variant: "solid",
      border_mode: (
        /*dragging*/
        e[16] ? "focus" : "base"
      ),
      padding: !1,
      elem_id: (
        /*elem_id*/
        e[0]
      ),
      elem_classes: (
        /*elem_classes*/
        e[1]
      ),
      height: null,
      width: (
        /*width*/
        e[7]
      ),
      allow_overflow: !0,
      container: (
        /*container*/
        e[9]
      ),
      scale: (
        /*scale*/
        e[10]
      ),
      min_width: (
        /*min_width*/
        e[11]
      ),
      $$slots: { default: [H_] },
      $$scope: { ctx: e }
    }
  }), {
    key: t,
    first: null,
    c() {
      n = Ba("div"), Dn(r.$$.fragment), i = Ha(), Ta(n, "class", "image-component-wrapper svelte-14t3feh"), this.first = n;
    },
    m(a, s) {
      Ca(a, n, s), xn(r, n, null), ka(n, i), o = !0;
    },
    p(a, s) {
      e = a;
      const l = {};
      s[0] & /*visible*/
      4 && (l.visible = /*visible*/
      e[2]), s[0] & /*elem_id*/
      1 && (l.elem_id = /*elem_id*/
      e[0]), s[0] & /*elem_classes*/
      2 && (l.elem_classes = /*elem_classes*/
      e[1]), s[0] & /*width*/
      128 && (l.width = /*width*/
      e[7]), s[0] & /*container*/
      512 && (l.container = /*container*/
      e[9]), s[0] & /*scale*/
      1024 && (l.scale = /*scale*/
      e[10]), s[0] & /*min_width*/
      2048 && (l.min_width = /*min_width*/
      e[11]), s[0] & /*label, show_download_button, _selectable, show_share_button, gradio*/
      12584 | s[1] & /*$$scope*/
      2 && (l.$$scope = { dirty: s, ctx: e }), r.$set(l);
    },
    i(a) {
      o || (We(r.$$.fragment, a), o = !0);
    },
    o(a) {
      nt(r.$$.fragment, a), o = !1;
    },
    d(a) {
      a && Aa(n), Un(r);
    }
  };
}
function P_(t) {
  let e, n, r = [], i = /* @__PURE__ */ new Map(), o, a = (
    /*show_label*/
    t[4] && vo(t)
  ), s = go(
    /*values*/
    t[15]
  );
  const l = (c) => (
    /*_value*/
    c[14]
  );
  for (let c = 0; c < s.length; c += 1) {
    let u = bo(t, s, c), f = l(u);
    i.set(f, r[c] = wo(f, u));
  }
  return {
    c() {
      e = Ba("div"), a && a.c(), n = Ha();
      for (let c = 0; c < r.length; c += 1)
        r[c].c();
      Ta(e, "class", "wrapper svelte-14t3feh");
    },
    m(c, u) {
      Ca(c, e, u), a && a.m(e, null), ka(e, n);
      for (let f = 0; f < r.length; f += 1)
        r[f] && r[f].m(e, null);
      o = !0;
    },
    p(c, u) {
      /*show_label*/
      c[4] ? a ? (a.p(c, u), u[0] & /*show_label*/
      16 && We(a, 1)) : (a = vo(c), a.c(), We(a, 1), a.m(e, n)) : a && (po(), nt(a, 1, 1, () => {
        a = null;
      }), mo()), u[0] & /*visible, dragging, elem_id, elem_classes, width, container, scale, min_width, values, label, show_download_button, _selectable, show_share_button, gradio*/
      114607 && (s = go(
        /*values*/
        c[15]
      ), po(), r = C_(r, u, l, 1, c, s, i, e, A_, wo, null, bo), mo());
    },
    i(c) {
      if (!o) {
        We(a);
        for (let u = 0; u < s.length; u += 1)
          We(r[u]);
        o = !0;
      }
    },
    o(c) {
      nt(a);
      for (let u = 0; u < r.length; u += 1)
        nt(r[u]);
      o = !1;
    },
    d(c) {
      c && Aa(e), a && a.d();
      for (let u = 0; u < r.length; u += 1)
        r[u].d();
    }
  };
}
function I_(t) {
  let e, n;
  return e = new So({
    props: {
      visible: (
        /*visible*/
        t[2]
      ),
      variant: "solid",
      border_mode: (
        /*dragging*/
        t[16] ? "focus" : "base"
      ),
      padding: !1,
      elem_id: (
        /*elem_id*/
        t[0]
      ),
      elem_classes: (
        /*elem_classes*/
        t[1]
      ),
      height: (
        /*height*/
        t[6]
      ),
      width: (
        /*width*/
        t[7]
      ),
      allow_overflow: !1,
      container: (
        /*container*/
        t[9]
      ),
      scale: (
        /*scale*/
        t[10]
      ),
      min_width: (
        /*min_width*/
        t[11]
      ),
      $$slots: { default: [P_] },
      $$scope: { ctx: t }
    }
  }), {
    c() {
      Dn(e.$$.fragment);
    },
    m(r, i) {
      xn(e, r, i), n = !0;
    },
    p(r, i) {
      const o = {};
      i[0] & /*visible*/
      4 && (o.visible = /*visible*/
      r[2]), i[0] & /*elem_id*/
      1 && (o.elem_id = /*elem_id*/
      r[0]), i[0] & /*elem_classes*/
      2 && (o.elem_classes = /*elem_classes*/
      r[1]), i[0] & /*height*/
      64 && (o.height = /*height*/
      r[6]), i[0] & /*width*/
      128 && (o.width = /*width*/
      r[7]), i[0] & /*container*/
      512 && (o.container = /*container*/
      r[9]), i[0] & /*scale*/
      1024 && (o.scale = /*scale*/
      r[10]), i[0] & /*min_width*/
      2048 && (o.min_width = /*min_width*/
      r[11]), i[0] & /*visible, elem_id, elem_classes, width, container, scale, min_width, label, show_download_button, _selectable, show_share_button, gradio, show_label*/
      16319 | i[1] & /*$$scope*/
      2 && (o.$$scope = { dirty: i, ctx: r }), e.$set(o);
    },
    i(r) {
      n || (We(e.$$.fragment, r), n = !0);
    },
    o(r) {
      nt(e.$$.fragment, r), n = !1;
    },
    d(r) {
      Un(e, r);
    }
  };
}
function N_(t) {
  let e, n = t[0], r = 1;
  for (; r < t.length; ) {
    const i = t[r], o = t[r + 1];
    if (r += 2, (i === "optionalAccess" || i === "optionalCall") && n == null)
      return;
    i === "access" || i === "optionalAccess" ? (e = n, n = o(n)) : (i === "call" || i === "optionalCall") && (n = o((...a) => n.call(e, ...a)), e = void 0);
  }
  return n;
}
function O_(t, e, n) {
  let r, i, { elem_id: o = "" } = e, { elem_classes: a = [] } = e, { visible: s = !0 } = e, { value: l = null } = e, { label: c } = e, { show_label: u } = e, { show_download_button: f } = e, { root: h } = e, { proxy_url: _ } = e, { height: g = 600 } = e, { width: m } = e, { _selectable: v = !1 } = e, { container: b = !0 } = e, { scale: y = null } = e, { min_width: C = void 0 } = e, { loading_status: H } = e, { show_share_button: I = !1 } = e, { sources: p = ["upload", "clipboard", "webcam"] } = e, { interactive: D } = e, { streaming: S } = e, { pending: w } = e, { mirror_webcam: Z } = e, { gradio: G } = e, le = [], ne;
  const T = ({ detail: E }) => G.dispatch("select", E), j = ({ detail: E }) => G.dispatch("share", E), Ie = ({ detail: E }) => G.dispatch("error", E);
  return t.$$set = (E) => {
    "elem_id" in E && n(0, o = E.elem_id), "elem_classes" in E && n(1, a = E.elem_classes), "visible" in E && n(2, s = E.visible), "value" in E && n(17, l = E.value), "label" in E && n(3, c = E.label), "show_label" in E && n(4, u = E.show_label), "show_download_button" in E && n(5, f = E.show_download_button), "root" in E && n(18, h = E.root), "proxy_url" in E && n(19, _ = E.proxy_url), "height" in E && n(6, g = E.height), "width" in E && n(7, m = E.width), "_selectable" in E && n(8, v = E._selectable), "container" in E && n(9, b = E.container), "scale" in E && n(10, y = E.scale), "min_width" in E && n(11, C = E.min_width), "loading_status" in E && n(20, H = E.loading_status), "show_share_button" in E && n(12, I = E.show_share_button), "sources" in E && n(21, p = E.sources), "interactive" in E && n(22, D = E.interactive), "streaming" in E && n(23, S = E.streaming), "pending" in E && n(24, w = E.pending), "mirror_webcam" in E && n(25, Z = E.mirror_webcam), "gradio" in E && n(13, G = E.gradio);
  }, t.$$.update = () => {
    t.$$.dirty[0] & /*value, root, proxy_url*/
    917504 && n(14, r = xe(l, h, _)), t.$$.dirty[0] & /*_value*/
    16384 && n(26, i = N_([r, "optionalAccess", (E) => E.url])), t.$$.dirty[0] & /*url, gradio*/
    67117056 && G.dispatch("change"), t.$$.dirty[0] & /*_value*/
    16384 && r && le.unshift(r);
  }, [
    o,
    a,
    s,
    c,
    u,
    f,
    g,
    m,
    v,
    b,
    y,
    C,
    I,
    G,
    r,
    le,
    ne,
    l,
    h,
    _,
    H,
    p,
    D,
    S,
    w,
    Z,
    i,
    T,
    j,
    Ie
  ];
}
class q_ extends k_ {
  constructor(e) {
    super(), T_(
      this,
      e,
      O_,
      I_,
      B_,
      {
        elem_id: 0,
        elem_classes: 1,
        visible: 2,
        value: 17,
        label: 3,
        show_label: 4,
        show_download_button: 5,
        root: 18,
        proxy_url: 19,
        height: 6,
        width: 7,
        _selectable: 8,
        container: 9,
        scale: 10,
        min_width: 11,
        loading_status: 20,
        show_share_button: 12,
        sources: 21,
        interactive: 22,
        streaming: 23,
        pending: 24,
        mirror_webcam: 25,
        gradio: 13
      },
      null,
      [-1, -1]
    );
  }
  get elem_id() {
    return this.$$.ctx[0];
  }
  set elem_id(e) {
    this.$$set({ elem_id: e }), z();
  }
  get elem_classes() {
    return this.$$.ctx[1];
  }
  set elem_classes(e) {
    this.$$set({ elem_classes: e }), z();
  }
  get visible() {
    return this.$$.ctx[2];
  }
  set visible(e) {
    this.$$set({ visible: e }), z();
  }
  get value() {
    return this.$$.ctx[17];
  }
  set value(e) {
    this.$$set({ value: e }), z();
  }
  get label() {
    return this.$$.ctx[3];
  }
  set label(e) {
    this.$$set({ label: e }), z();
  }
  get show_label() {
    return this.$$.ctx[4];
  }
  set show_label(e) {
    this.$$set({ show_label: e }), z();
  }
  get show_download_button() {
    return this.$$.ctx[5];
  }
  set show_download_button(e) {
    this.$$set({ show_download_button: e }), z();
  }
  get root() {
    return this.$$.ctx[18];
  }
  set root(e) {
    this.$$set({ root: e }), z();
  }
  get proxy_url() {
    return this.$$.ctx[19];
  }
  set proxy_url(e) {
    this.$$set({ proxy_url: e }), z();
  }
  get height() {
    return this.$$.ctx[6];
  }
  set height(e) {
    this.$$set({ height: e }), z();
  }
  get width() {
    return this.$$.ctx[7];
  }
  set width(e) {
    this.$$set({ width: e }), z();
  }
  get _selectable() {
    return this.$$.ctx[8];
  }
  set _selectable(e) {
    this.$$set({ _selectable: e }), z();
  }
  get container() {
    return this.$$.ctx[9];
  }
  set container(e) {
    this.$$set({ container: e }), z();
  }
  get scale() {
    return this.$$.ctx[10];
  }
  set scale(e) {
    this.$$set({ scale: e }), z();
  }
  get min_width() {
    return this.$$.ctx[11];
  }
  set min_width(e) {
    this.$$set({ min_width: e }), z();
  }
  get loading_status() {
    return this.$$.ctx[20];
  }
  set loading_status(e) {
    this.$$set({ loading_status: e }), z();
  }
  get show_share_button() {
    return this.$$.ctx[12];
  }
  set show_share_button(e) {
    this.$$set({ show_share_button: e }), z();
  }
  get sources() {
    return this.$$.ctx[21];
  }
  set sources(e) {
    this.$$set({ sources: e }), z();
  }
  get interactive() {
    return this.$$.ctx[22];
  }
  set interactive(e) {
    this.$$set({ interactive: e }), z();
  }
  get streaming() {
    return this.$$.ctx[23];
  }
  set streaming(e) {
    this.$$set({ streaming: e }), z();
  }
  get pending() {
    return this.$$.ctx[24];
  }
  set pending(e) {
    this.$$set({ pending: e }), z();
  }
  get mirror_webcam() {
    return this.$$.ctx[25];
  }
  set mirror_webcam(e) {
    this.$$set({ mirror_webcam: e }), z();
  }
  get gradio() {
    return this.$$.ctx[13];
  }
  set gradio(e) {
    this.$$set({ gradio: e }), z();
  }
}
export {
  F_ as BaseExample,
  Kr as BaseImage,
  j_ as BaseImageUploader,
  xc as BaseStaticImage,
  Cf as Webcam,
  q_ as default
};
