var Ri = Object.defineProperty;
var ur = (e) => {
  throw TypeError(e);
};
var Oi = (e, t, n) => t in e ? Ri(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
var D = (e, t, n) => Oi(e, typeof t != "symbol" ? t + "" : t, n), bn = (e, t, n) => t.has(e) || ur("Cannot " + n);
var u = (e, t, n) => (bn(e, t, "read from private field"), n ? n.call(e) : t.get(e)), $ = (e, t, n) => t.has(e) ? ur("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), b = (e, t, n, r) => (bn(e, t, "write to private field"), r ? r.call(e, n) : t.set(e, n), n), L = (e, t, n) => (bn(e, t, "access private method"), n);
const Ci = "5";
var Tr;
typeof window < "u" && ((Tr = window.__svelte ?? (window.__svelte = {})).v ?? (Tr.v = /* @__PURE__ */ new Set())).add(Ci);
let kt = !1, Mi = !1;
function Di() {
  kt = !0;
}
Di();
const Li = 1, Ii = 2, Pi = 16, Fi = 2, ji = 8, qi = 2, Yn = "[", an = "[!", cr = "[?", Kn = "]", yt = {}, q = Symbol(), Nr = "http://www.w3.org/1999/xhtml", En = !1;
var Rr = Array.isArray, zi = Array.prototype.indexOf, $t = Array.prototype.includes, un = Array.from, rn = Object.keys, sn = Object.defineProperty, rt = Object.getOwnPropertyDescriptor, Hi = Object.getOwnPropertyDescriptors, Bi = Object.prototype, Vi = Array.prototype, Or = Object.getPrototypeOf, dr = Object.isExtensible;
const Ui = () => {
};
function Yi(e) {
  return e();
}
function xn(e) {
  for (var t = 0; t < e.length; t++)
    e[t]();
}
function Cr() {
  var e, t, n = new Promise((r, s) => {
    e = r, t = s;
  });
  return { promise: n, resolve: e, reject: t };
}
const H = 2, zt = 4, Ht = 8, Mr = 1 << 24, De = 16, me = 32, We = 64, Sn = 128, le = 512, F = 1024, B = 2048, pe = 4096, ee = 8192, Oe = 16384, Ye = 32768, Et = 65536, hr = 1 << 17, Dr = 1 << 18, ut = 1 << 19, Lr = 1 << 20, je = 1 << 25, ot = 65536, Tn = 1 << 21, Wn = 1 << 22, He = 1 << 23, it = Symbol("$state"), Ir = Symbol("legacy props"), Ki = Symbol(""), Ge = new class extends Error {
  constructor() {
    super(...arguments);
    D(this, "name", "StaleReactionError");
    D(this, "message", "The reaction that called `getAbortSignal()` was re-run or destroyed");
  }
}();
var kr;
const Wi = (
  // We gotta write it like this because after downleveling the pure comment may end up in the wrong location
  !!((kr = globalThis.document) != null && kr.contentType) && /* @__PURE__ */ globalThis.document.contentType.includes("xml")
), cn = 3, Bt = 8;
function Gi(e) {
  throw new Error("https://svelte.dev/e/lifecycle_outside_component");
}
function Ji() {
  throw new Error("https://svelte.dev/e/async_derived_orphan");
}
function Xi(e, t, n) {
  throw new Error("https://svelte.dev/e/each_key_duplicate");
}
function Zi(e) {
  throw new Error("https://svelte.dev/e/effect_in_teardown");
}
function Qi() {
  throw new Error("https://svelte.dev/e/effect_in_unowned_derived");
}
function es(e) {
  throw new Error("https://svelte.dev/e/effect_orphan");
}
function ts() {
  throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
}
function ns() {
  throw new Error("https://svelte.dev/e/hydration_failed");
}
function rs(e) {
  throw new Error("https://svelte.dev/e/props_invalid_value");
}
function is() {
  throw new Error("https://svelte.dev/e/state_descriptors_fixed");
}
function ss() {
  throw new Error("https://svelte.dev/e/state_prototype_fixed");
}
function ls() {
  throw new Error("https://svelte.dev/e/state_unsafe_mutation");
}
function fs() {
  throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror");
}
function dn(e) {
  console.warn("https://svelte.dev/e/hydration_mismatch");
}
function os() {
  console.warn("https://svelte.dev/e/svelte_boundary_reset_noop");
}
let R = !1;
function Re(e) {
  R = e;
}
let S;
function te(e) {
  if (e === null)
    throw dn(), yt;
  return S = e;
}
function Vt() {
  return te(/* @__PURE__ */ Se(S));
}
function de(e) {
  if (R) {
    if (/* @__PURE__ */ Se(S) !== null)
      throw dn(), yt;
    S = e;
  }
}
function Gn(e = 1) {
  if (R) {
    for (var t = e, n = S; t--; )
      n = /** @type {TemplateNode} */
      /* @__PURE__ */ Se(n);
    S = n;
  }
}
function ln(e = !0) {
  for (var t = 0, n = S; ; ) {
    if (n.nodeType === Bt) {
      var r = (
        /** @type {Comment} */
        n.data
      );
      if (r === Kn) {
        if (t === 0) return n;
        t -= 1;
      } else (r === Yn || r === an || // "[1", "[2", etc. for if blocks
      r[0] === "[" && !isNaN(Number(r.slice(1)))) && (t += 1);
    }
    var s = (
      /** @type {TemplateNode} */
      /* @__PURE__ */ Se(n)
    );
    e && n.remove(), n = s;
  }
}
function Pr(e) {
  if (!e || e.nodeType !== Bt)
    throw dn(), yt;
  return (
    /** @type {Comment} */
    e.data
  );
}
function Fr(e) {
  return e === this.v;
}
function as(e, t) {
  return e != e ? t == t : e !== t || e !== null && typeof e == "object" || typeof e == "function";
}
function jr(e) {
  return !as(e, this.v);
}
let P = null;
function xt(e) {
  P = e;
}
function hn(e, t = !1, n) {
  P = {
    p: P,
    i: !1,
    c: null,
    e: null,
    s: e,
    x: null,
    l: kt && !t ? { s: null, u: null, $: [] } : null
  };
}
function vn(e) {
  var t = (
    /** @type {ComponentContext} */
    P
  ), n = t.e;
  if (n !== null) {
    t.e = null;
    for (var r of n)
      ui(r);
  }
  return e !== void 0 && (t.x = e), t.i = !0, P = t.p, e ?? /** @type {T} */
  {};
}
function Ut() {
  return !kt || P !== null && P.l === null;
}
let Je = [];
function qr() {
  var e = Je;
  Je = [], xn(e);
}
function Ce(e) {
  if (Je.length === 0 && !Ot) {
    var t = Je;
    queueMicrotask(() => {
      t === Je && qr();
    });
  }
  Je.push(e);
}
function us() {
  for (; Je.length > 0; )
    qr();
}
function zr(e) {
  var t = k;
  if (t === null)
    return x.f |= He, e;
  if (!(t.f & Ye) && !(t.f & zt))
    throw e;
  qe(e, t);
}
function qe(e, t) {
  for (; t !== null; ) {
    if (t.f & Sn) {
      if (!(t.f & Ye))
        throw e;
      try {
        t.b.error(e);
        return;
      } catch (n) {
        e = n;
      }
    }
    t = t.parent;
  }
  throw e;
}
const cs = -7169;
function I(e, t) {
  e.f = e.f & cs | t;
}
function Jn(e) {
  e.f & le || e.deps === null ? I(e, F) : I(e, pe);
}
function Hr(e) {
  if (e !== null)
    for (const t of e)
      !(t.f & H) || !(t.f & ot) || (t.f ^= ot, Hr(
        /** @type {Derived} */
        t.deps
      ));
}
function Br(e, t, n) {
  e.f & B ? t.add(e) : e.f & pe && n.add(e), Hr(e.deps), I(e, F);
}
const Gt = /* @__PURE__ */ new Set();
let w = null, kn = null, z = null, K = [], _n = null, An = !1, Ot = !1;
var vt, _t, Ze, pt, It, Pt, Qe, Te, gt, ne, Nn, Rn, On, Vr;
const ar = class ar {
  constructor() {
    $(this, ne);
    /**
     * The current values of any sources that are updated in this batch
     * They keys of this map are identical to `this.#previous`
     * @type {Map<Source, any>}
     */
    D(this, "current", /* @__PURE__ */ new Map());
    /**
     * The values of any sources that are updated in this batch _before_ those updates took place.
     * They keys of this map are identical to `this.#current`
     * @type {Map<Source, any>}
     */
    D(this, "previous", /* @__PURE__ */ new Map());
    /**
     * When the batch is committed (and the DOM is updated), we need to remove old branches
     * and append new ones by calling the functions added inside (if/each/key/etc) blocks
     * @type {Set<() => void>}
     */
    $(this, vt, /* @__PURE__ */ new Set());
    /**
     * If a fork is discarded, we need to destroy any effects that are no longer needed
     * @type {Set<(batch: Batch) => void>}
     */
    $(this, _t, /* @__PURE__ */ new Set());
    /**
     * The number of async effects that are currently in flight
     */
    $(this, Ze, 0);
    /**
     * The number of async effects that are currently in flight, _not_ inside a pending boundary
     */
    $(this, pt, 0);
    /**
     * A deferred that resolves when the batch is committed, used with `settled()`
     * TODO replace with Promise.withResolvers once supported widely enough
     * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
     */
    $(this, It, null);
    /**
     * Deferred effects (which run after async work has completed) that are DIRTY
     * @type {Set<Effect>}
     */
    $(this, Pt, /* @__PURE__ */ new Set());
    /**
     * Deferred effects that are MAYBE_DIRTY
     * @type {Set<Effect>}
     */
    $(this, Qe, /* @__PURE__ */ new Set());
    /**
     * A map of branches that still exist, but will be destroyed when this batch
     * is committed — we skip over these during `process`.
     * The value contains child effects that were dirty/maybe_dirty before being reset,
     * so they can be rescheduled if the branch survives.
     * @type {Map<Effect, { d: Effect[], m: Effect[] }>}
     */
    $(this, Te, /* @__PURE__ */ new Map());
    D(this, "is_fork", !1);
    $(this, gt, !1);
  }
  /**
   * Add an effect to the #skipped_branches map and reset its children
   * @param {Effect} effect
   */
  skip_effect(t) {
    u(this, Te).has(t) || u(this, Te).set(t, { d: [], m: [] });
  }
  /**
   * Remove an effect from the #skipped_branches map and reschedule
   * any tracked dirty/maybe_dirty child effects
   * @param {Effect} effect
   */
  unskip_effect(t) {
    var n = u(this, Te).get(t);
    if (n) {
      u(this, Te).delete(t);
      for (var r of n.d)
        I(r, B), ve(r);
      for (r of n.m)
        I(r, pe), ve(r);
    }
  }
  /**
   *
   * @param {Effect[]} root_effects
   */
  process(t) {
    var s;
    K = [], this.apply();
    var n = [], r = [];
    for (const i of t)
      L(this, ne, Rn).call(this, i, n, r);
    if (L(this, ne, Nn).call(this)) {
      L(this, ne, On).call(this, r), L(this, ne, On).call(this, n);
      for (const [i, f] of u(this, Te))
        Wr(i, f);
    } else {
      for (const i of u(this, vt)) i();
      u(this, vt).clear(), u(this, Ze) === 0 && L(this, ne, Vr).call(this), kn = this, w = null, vr(r), vr(n), kn = null, (s = u(this, It)) == null || s.resolve();
    }
    z = null;
  }
  /**
   * Associate a change to a given source with the current
   * batch, noting its previous and current values
   * @param {Source} source
   * @param {any} value
   */
  capture(t, n) {
    n !== q && !this.previous.has(t) && this.previous.set(t, n), t.f & He || (this.current.set(t, t.v), z == null || z.set(t, t.v));
  }
  activate() {
    w = this, this.apply();
  }
  deactivate() {
    w === this && (w = null, z = null);
  }
  flush() {
    if (this.activate(), K.length > 0) {
      if (Ur(), w !== null && w !== this)
        return;
    } else u(this, Ze) === 0 && this.process([]);
    this.deactivate();
  }
  discard() {
    for (const t of u(this, _t)) t(this);
    u(this, _t).clear();
  }
  /**
   *
   * @param {boolean} blocking
   */
  increment(t) {
    b(this, Ze, u(this, Ze) + 1), t && b(this, pt, u(this, pt) + 1);
  }
  /**
   *
   * @param {boolean} blocking
   */
  decrement(t) {
    b(this, Ze, u(this, Ze) - 1), t && b(this, pt, u(this, pt) - 1), !u(this, gt) && (b(this, gt, !0), Ce(() => {
      b(this, gt, !1), L(this, ne, Nn).call(this) ? K.length > 0 && this.flush() : this.revive();
    }));
  }
  revive() {
    for (const t of u(this, Pt))
      u(this, Qe).delete(t), I(t, B), ve(t);
    for (const t of u(this, Qe))
      I(t, pe), ve(t);
    this.flush();
  }
  /** @param {() => void} fn */
  oncommit(t) {
    u(this, vt).add(t);
  }
  /** @param {(batch: Batch) => void} fn */
  ondiscard(t) {
    u(this, _t).add(t);
  }
  settled() {
    return (u(this, It) ?? b(this, It, Cr())).promise;
  }
  static ensure() {
    if (w === null) {
      const t = w = new ar();
      Gt.add(w), Ot || Ce(() => {
        w === t && t.flush();
      });
    }
    return w;
  }
  apply() {
  }
};
vt = new WeakMap(), _t = new WeakMap(), Ze = new WeakMap(), pt = new WeakMap(), It = new WeakMap(), Pt = new WeakMap(), Qe = new WeakMap(), Te = new WeakMap(), gt = new WeakMap(), ne = new WeakSet(), Nn = function() {
  return this.is_fork || u(this, pt) > 0;
}, /**
 * Traverse the effect tree, executing effects or stashing
 * them for later execution as appropriate
 * @param {Effect} root
 * @param {Effect[]} effects
 * @param {Effect[]} render_effects
 */
Rn = function(t, n, r) {
  t.f ^= F;
  for (var s = t.first; s !== null; ) {
    var i = s.f, f = (i & (me | We)) !== 0, l = f && (i & F) !== 0, o = l || (i & ee) !== 0 || u(this, Te).has(s);
    if (!o && s.fn !== null) {
      f ? s.f ^= F : i & zt ? n.push(s) : Yt(s) && (i & De && u(this, Qe).add(s), Tt(s));
      var a = s.first;
      if (a !== null) {
        s = a;
        continue;
      }
    }
    for (; s !== null; ) {
      var c = s.next;
      if (c !== null) {
        s = c;
        break;
      }
      s = s.parent;
    }
  }
}, /**
 * @param {Effect[]} effects
 */
On = function(t) {
  for (var n = 0; n < t.length; n += 1)
    Br(t[n], u(this, Pt), u(this, Qe));
}, Vr = function() {
  var s;
  if (Gt.size > 1) {
    this.previous.clear();
    var t = z, n = !0;
    for (const i of Gt) {
      if (i === this) {
        n = !1;
        continue;
      }
      const f = [];
      for (const [o, a] of this.current) {
        if (i.current.has(o))
          if (n && a !== i.current.get(o))
            i.current.set(o, a);
          else
            continue;
        f.push(o);
      }
      if (f.length === 0)
        continue;
      const l = [...i.current.keys()].filter((o) => !this.current.has(o));
      if (l.length > 0) {
        var r = K;
        K = [];
        const o = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map();
        for (const c of f)
          Yr(c, l, o, a);
        if (K.length > 0) {
          w = i, i.apply();
          for (const c of K)
            L(s = i, ne, Rn).call(s, c, [], []);
          i.deactivate();
        }
        K = r;
      }
    }
    w = null, z = t;
  }
  Gt.delete(this);
};
let Me = ar;
function Ee(e) {
  var t = Ot;
  Ot = !0;
  try {
    for (var n; ; ) {
      if (us(), K.length === 0 && (w == null || w.flush(), K.length === 0))
        return _n = null, /** @type {T} */
        n;
      Ur();
    }
  } finally {
    Ot = t;
  }
}
function Ur() {
  An = !0;
  var e = null;
  try {
    for (var t = 0; K.length > 0; ) {
      var n = Me.ensure();
      if (t++ > 1e3) {
        var r, s;
        ds();
      }
      n.process(K), Be.clear();
    }
  } finally {
    K = [], An = !1, _n = null;
  }
}
function ds() {
  try {
    ts();
  } catch (e) {
    qe(e, _n);
  }
}
let ae = null;
function vr(e) {
  var t = e.length;
  if (t !== 0) {
    for (var n = 0; n < t; ) {
      var r = e[n++];
      if (!(r.f & (Oe | ee)) && Yt(r) && (ae = /* @__PURE__ */ new Set(), Tt(r), r.deps === null && r.first === null && r.nodes === null && r.teardown === null && r.ac === null && hi(r), (ae == null ? void 0 : ae.size) > 0)) {
        Be.clear();
        for (const s of ae) {
          if (s.f & (Oe | ee)) continue;
          const i = [s];
          let f = s.parent;
          for (; f !== null; )
            ae.has(f) && (ae.delete(f), i.push(f)), f = f.parent;
          for (let l = i.length - 1; l >= 0; l--) {
            const o = i[l];
            o.f & (Oe | ee) || Tt(o);
          }
        }
        ae.clear();
      }
    }
    ae = null;
  }
}
function Yr(e, t, n, r) {
  if (!n.has(e) && (n.add(e), e.reactions !== null))
    for (const s of e.reactions) {
      const i = s.f;
      i & H ? Yr(
        /** @type {Derived} */
        s,
        t,
        n,
        r
      ) : i & (Wn | De) && !(i & B) && Kr(s, t, r) && (I(s, B), ve(
        /** @type {Effect} */
        s
      ));
    }
}
function Kr(e, t, n) {
  const r = n.get(e);
  if (r !== void 0) return r;
  if (e.deps !== null)
    for (const s of e.deps) {
      if ($t.call(t, s))
        return !0;
      if (s.f & H && Kr(
        /** @type {Derived} */
        s,
        t,
        n
      ))
        return n.set(
          /** @type {Derived} */
          s,
          !0
        ), !0;
    }
  return n.set(e, !1), !1;
}
function ve(e) {
  var t = _n = e, n = t.b;
  if (n != null && n.is_pending && e.f & (zt | Ht | Mr) && !(e.f & Ye)) {
    n.defer_effect(e);
    return;
  }
  for (; t.parent !== null; ) {
    t = t.parent;
    var r = t.f;
    if (An && t === k && r & De && !(r & Dr) && r & Ye)
      return;
    if (r & (We | me)) {
      if (!(r & F))
        return;
      t.f ^= F;
    }
  }
  K.push(t);
}
function Wr(e, t) {
  if (!(e.f & me && e.f & F)) {
    e.f & B ? t.d.push(e) : e.f & pe && t.m.push(e), I(e, F);
    for (var n = e.first; n !== null; )
      Wr(n, t), n = n.next;
  }
}
function hs(e) {
  let t = 0, n = at(0), r;
  return () => {
    nr() && (y(n), gn(() => (t === 0 && (r = Ue(() => e(() => Ct(n)))), t += 1, () => {
      Ce(() => {
        t -= 1, t === 0 && (r == null || r(), r = void 0, Ct(n));
      });
    })));
  };
}
var vs = Et | ut;
function _s(e, t, n, r) {
  new ps(e, t, n, r);
}
var X, Ft, we, et, Y, ye, Z, ue, ke, tt, Fe, mt, bt, wt, Ae, fn, C, Gr, Jr, Xr, Cn, Qt, en, Mn;
class ps {
  /**
   * @param {TemplateNode} node
   * @param {BoundaryProps} props
   * @param {((anchor: Node) => void)} children
   * @param {((error: unknown) => unknown) | undefined} [transform_error]
   */
  constructor(t, n, r, s) {
    $(this, C);
    /** @type {Boundary | null} */
    D(this, "parent");
    D(this, "is_pending", !1);
    /**
     * API-level transformError transform function. Transforms errors before they reach the `failed` snippet.
     * Inherited from parent boundary, or defaults to identity.
     * @type {(error: unknown) => unknown}
     */
    D(this, "transform_error");
    /** @type {TemplateNode} */
    $(this, X);
    /** @type {TemplateNode | null} */
    $(this, Ft, R ? S : null);
    /** @type {BoundaryProps} */
    $(this, we);
    /** @type {((anchor: Node) => void)} */
    $(this, et);
    /** @type {Effect} */
    $(this, Y);
    /** @type {Effect | null} */
    $(this, ye, null);
    /** @type {Effect | null} */
    $(this, Z, null);
    /** @type {Effect | null} */
    $(this, ue, null);
    /** @type {DocumentFragment | null} */
    $(this, ke, null);
    $(this, tt, 0);
    $(this, Fe, 0);
    $(this, mt, !1);
    /** @type {Set<Effect>} */
    $(this, bt, /* @__PURE__ */ new Set());
    /** @type {Set<Effect>} */
    $(this, wt, /* @__PURE__ */ new Set());
    /**
     * A source containing the number of pending async deriveds/expressions.
     * Only created if `$effect.pending()` is used inside the boundary,
     * otherwise updating the source results in needless `Batch.ensure()`
     * calls followed by no-op flushes
     * @type {Source<number> | null}
     */
    $(this, Ae, null);
    $(this, fn, hs(() => (b(this, Ae, at(u(this, tt))), () => {
      b(this, Ae, null);
    })));
    var i;
    b(this, X, t), b(this, we, n), b(this, et, (f) => {
      var l = (
        /** @type {Effect} */
        k
      );
      l.b = this, l.f |= Sn, r(f);
    }), this.parent = /** @type {Effect} */
    k.b, this.transform_error = s ?? ((i = this.parent) == null ? void 0 : i.transform_error) ?? ((f) => f), b(this, Y, rr(() => {
      if (R) {
        const f = (
          /** @type {Comment} */
          u(this, Ft)
        );
        Vt();
        const l = f.data === an;
        if (f.data.startsWith(cr)) {
          const a = JSON.parse(f.data.slice(cr.length));
          L(this, C, Jr).call(this, a);
        } else l ? L(this, C, Xr).call(this) : L(this, C, Gr).call(this);
      } else
        L(this, C, Cn).call(this);
    }, vs)), R && b(this, X, S);
  }
  /**
   * Defer an effect inside a pending boundary until the boundary resolves
   * @param {Effect} effect
   */
  defer_effect(t) {
    Br(t, u(this, bt), u(this, wt));
  }
  /**
   * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
   * @returns {boolean}
   */
  is_rendered() {
    return !this.is_pending && (!this.parent || this.parent.is_rendered());
  }
  has_pending_snippet() {
    return !!u(this, we).pending;
  }
  /**
   * Update the source that powers `$effect.pending()` inside this boundary,
   * and controls when the current `pending` snippet (if any) is removed.
   * Do not call from inside the class
   * @param {1 | -1} d
   */
  update_pending_count(t) {
    L(this, C, Mn).call(this, t), b(this, tt, u(this, tt) + t), !(!u(this, Ae) || u(this, mt)) && (b(this, mt, !0), Ce(() => {
      b(this, mt, !1), u(this, Ae) && St(u(this, Ae), u(this, tt));
    }));
  }
  get_effect_pending() {
    return u(this, fn).call(this), y(
      /** @type {Source<number>} */
      u(this, Ae)
    );
  }
  /** @param {unknown} error */
  error(t) {
    var n = u(this, we).onerror;
    let r = u(this, we).failed;
    if (!n && !r)
      throw t;
    u(this, ye) && (U(u(this, ye)), b(this, ye, null)), u(this, Z) && (U(u(this, Z)), b(this, Z, null)), u(this, ue) && (U(u(this, ue)), b(this, ue, null)), R && (te(
      /** @type {TemplateNode} */
      u(this, Ft)
    ), Gn(), te(ln()));
    var s = !1, i = !1;
    const f = () => {
      if (s) {
        os();
        return;
      }
      s = !0, i && fs(), u(this, ue) !== null && st(u(this, ue), () => {
        b(this, ue, null);
      }), L(this, C, en).call(this, () => {
        Me.ensure(), L(this, C, Cn).call(this);
      });
    }, l = (o) => {
      try {
        i = !0, n == null || n(o, f), i = !1;
      } catch (a) {
        qe(a, u(this, Y) && u(this, Y).parent);
      }
      r && b(this, ue, L(this, C, en).call(this, () => {
        Me.ensure();
        try {
          return se(() => {
            var a = (
              /** @type {Effect} */
              k
            );
            a.b = this, a.f |= Sn, r(
              u(this, X),
              () => o,
              () => f
            );
          });
        } catch (a) {
          return qe(
            a,
            /** @type {Effect} */
            u(this, Y).parent
          ), null;
        }
      }));
    };
    Ce(() => {
      var o;
      try {
        o = this.transform_error(t);
      } catch (a) {
        qe(a, u(this, Y) && u(this, Y).parent);
        return;
      }
      o !== null && typeof o == "object" && typeof /** @type {any} */
      o.then == "function" ? o.then(
        l,
        /** @param {unknown} e */
        (a) => qe(a, u(this, Y) && u(this, Y).parent)
      ) : l(o);
    });
  }
}
X = new WeakMap(), Ft = new WeakMap(), we = new WeakMap(), et = new WeakMap(), Y = new WeakMap(), ye = new WeakMap(), Z = new WeakMap(), ue = new WeakMap(), ke = new WeakMap(), tt = new WeakMap(), Fe = new WeakMap(), mt = new WeakMap(), bt = new WeakMap(), wt = new WeakMap(), Ae = new WeakMap(), fn = new WeakMap(), C = new WeakSet(), Gr = function() {
  try {
    b(this, ye, se(() => u(this, et).call(this, u(this, X))));
  } catch (t) {
    this.error(t);
  }
}, /**
 * @param {unknown} error The deserialized error from the server's hydration comment
 */
Jr = function(t) {
  const n = u(this, we).failed;
  n && b(this, ue, se(() => {
    n(
      u(this, X),
      () => t,
      () => () => {
      }
    );
  }));
}, Xr = function() {
  const t = u(this, we).pending;
  t && (this.is_pending = !0, b(this, Z, se(() => t(u(this, X)))), Ce(() => {
    var n = b(this, ke, document.createDocumentFragment()), r = ge();
    n.append(r), b(this, ye, L(this, C, en).call(this, () => (Me.ensure(), se(() => u(this, et).call(this, r))))), u(this, Fe) === 0 && (u(this, X).before(n), b(this, ke, null), st(
      /** @type {Effect} */
      u(this, Z),
      () => {
        b(this, Z, null);
      }
    ), L(this, C, Qt).call(this));
  }));
}, Cn = function() {
  try {
    if (this.is_pending = this.has_pending_snippet(), b(this, Fe, 0), b(this, tt, 0), b(this, ye, se(() => {
      u(this, et).call(this, u(this, X));
    })), u(this, Fe) > 0) {
      var t = b(this, ke, document.createDocumentFragment());
      pi(u(this, ye), t);
      const n = (
        /** @type {(anchor: Node) => void} */
        u(this, we).pending
      );
      b(this, Z, se(() => n(u(this, X))));
    } else
      L(this, C, Qt).call(this);
  } catch (n) {
    this.error(n);
  }
}, Qt = function() {
  this.is_pending = !1;
  for (const t of u(this, bt))
    I(t, B), ve(t);
  for (const t of u(this, wt))
    I(t, pe), ve(t);
  u(this, bt).clear(), u(this, wt).clear();
}, /**
 * @template T
 * @param {() => T} fn
 */
en = function(t) {
  var n = k, r = x, s = P;
  xe(u(this, Y)), oe(u(this, Y)), xt(u(this, Y).ctx);
  try {
    return t();
  } catch (i) {
    return zr(i), null;
  } finally {
    xe(n), oe(r), xt(s);
  }
}, /**
 * Updates the pending count associated with the currently visible pending snippet,
 * if any, such that we can replace the snippet with content once work is done
 * @param {1 | -1} d
 */
Mn = function(t) {
  var n;
  if (!this.has_pending_snippet()) {
    this.parent && L(n = this.parent, C, Mn).call(n, t);
    return;
  }
  b(this, Fe, u(this, Fe) + t), u(this, Fe) === 0 && (L(this, C, Qt).call(this), u(this, Z) && st(u(this, Z), () => {
    b(this, Z, null);
  }), u(this, ke) && (u(this, X).before(u(this, ke)), b(this, ke, null)));
};
function gs(e, t, n, r) {
  const s = Ut() ? Xn : Zn;
  var i = e.filter((h) => !h.settled);
  if (n.length === 0 && i.length === 0) {
    r(t.map(s));
    return;
  }
  var f = (
    /** @type {Effect} */
    k
  ), l = ms(), o = i.length === 1 ? i[0].promise : i.length > 1 ? Promise.all(i.map((h) => h.promise)) : null;
  function a(h) {
    l();
    try {
      r(h);
    } catch (v) {
      f.f & Oe || qe(v, f);
    }
    Dn();
  }
  if (n.length === 0) {
    o.then(() => a(t.map(s)));
    return;
  }
  function c() {
    l(), Promise.all(n.map((h) => /* @__PURE__ */ ws(h))).then((h) => a([...t.map(s), ...h])).catch((h) => qe(h, f));
  }
  o ? o.then(c) : c();
}
function ms() {
  var e = k, t = x, n = P, r = w;
  return function(i = !0) {
    xe(e), oe(t), xt(n), i && (r == null || r.activate());
  };
}
function Dn(e = !0) {
  xe(null), oe(null), xt(null), e && (w == null || w.deactivate());
}
function bs() {
  var e = (
    /** @type {Boundary} */
    /** @type {Effect} */
    k.b
  ), t = (
    /** @type {Batch} */
    w
  ), n = e.is_rendered();
  return e.update_pending_count(1), t.increment(n), () => {
    e.update_pending_count(-1), t.decrement(n);
  };
}
// @__NO_SIDE_EFFECTS__
function Xn(e) {
  var t = H | B, n = x !== null && x.f & H ? (
    /** @type {Derived} */
    x
  ) : null;
  return k !== null && (k.f |= ut), {
    ctx: P,
    deps: null,
    effects: null,
    equals: Fr,
    f: t,
    fn: e,
    reactions: null,
    rv: 0,
    v: (
      /** @type {V} */
      q
    ),
    wv: 0,
    parent: n ?? k,
    ac: null
  };
}
// @__NO_SIDE_EFFECTS__
function ws(e, t, n) {
  /** @type {Effect | null} */
  k === null && Ji();
  var s = (
    /** @type {Promise<V>} */
    /** @type {unknown} */
    void 0
  ), i = at(
    /** @type {V} */
    q
  ), f = !x, l = /* @__PURE__ */ new Map();
  return Os(() => {
    var v;
    var o = Cr();
    s = o.promise;
    try {
      Promise.resolve(e()).then(o.resolve, o.reject).finally(Dn);
    } catch (p) {
      o.reject(p), Dn();
    }
    var a = (
      /** @type {Batch} */
      w
    );
    if (f) {
      var c = bs();
      (v = l.get(a)) == null || v.reject(Ge), l.delete(a), l.set(a, o);
    }
    const h = (p, d = void 0) => {
      if (a.activate(), d)
        d !== Ge && (i.f |= He, St(i, d));
      else {
        i.f & He && (i.f ^= He), St(i, p);
        for (const [_, g] of l) {
          if (l.delete(_), _ === a) break;
          g.reject(Ge);
        }
      }
      c && c();
    };
    o.promise.then(h, (p) => h(null, p || "unknown"));
  }), ai(() => {
    for (const o of l.values())
      o.reject(Ge);
  }), new Promise((o) => {
    function a(c) {
      function h() {
        c === s ? o(i) : a(s);
      }
      c.then(h, h);
    }
    a(s);
  });
}
// @__NO_SIDE_EFFECTS__
function Zn(e) {
  const t = /* @__PURE__ */ Xn(e);
  return t.equals = jr, t;
}
function ys(e) {
  var t = e.effects;
  if (t !== null) {
    e.effects = null;
    for (var n = 0; n < t.length; n += 1)
      U(
        /** @type {Effect} */
        t[n]
      );
  }
}
function $s(e) {
  for (var t = e.parent; t !== null; ) {
    if (!(t.f & H))
      return t.f & Oe ? null : (
        /** @type {Effect} */
        t
      );
    t = t.parent;
  }
  return null;
}
function Qn(e) {
  var t, n = k;
  xe($s(e));
  try {
    e.f &= ~ot, ys(e), t = wi(e);
  } finally {
    xe(n);
  }
  return t;
}
function Zr(e) {
  var t = Qn(e);
  if (!e.equals(t) && (e.wv = mi(), (!(w != null && w.is_fork) || e.deps === null) && (e.v = t, e.deps === null))) {
    I(e, F);
    return;
  }
  Ke || (z !== null ? (nr() || w != null && w.is_fork) && z.set(e, t) : Jn(e));
}
function Es(e) {
  var t, n;
  if (e.effects !== null)
    for (const r of e.effects)
      (r.teardown || r.ac) && ((t = r.teardown) == null || t.call(r), (n = r.ac) == null || n.abort(Ge), r.teardown = Ui, r.ac = null, Dt(r, 0), ir(r));
}
function Qr(e) {
  if (e.effects !== null)
    for (const t of e.effects)
      t.teardown && Tt(t);
}
let Ln = /* @__PURE__ */ new Set();
const Be = /* @__PURE__ */ new Map();
let ei = !1;
function at(e, t) {
  var n = {
    f: 0,
    // TODO ideally we could skip this altogether, but it causes type errors
    v: e,
    reactions: null,
    equals: Fr,
    rv: 0,
    wv: 0
  };
  return n;
}
// @__NO_SIDE_EFFECTS__
function Le(e, t) {
  const n = at(e);
  return Ds(n), n;
}
// @__NO_SIDE_EFFECTS__
function Ve(e, t = !1, n = !0) {
  var s;
  const r = at(e);
  return t || (r.equals = jr), kt && n && P !== null && P.l !== null && ((s = P.l).s ?? (s.s = [])).push(r), r;
}
function V(e, t, n = !1) {
  x !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
  // to ensure we error if state is set inside an inspect effect
  (!_e || x.f & hr) && Ut() && x.f & (H | De | Wn | hr) && (fe === null || !$t.call(fe, e)) && ls();
  let r = n ? ht(t) : t;
  return St(e, r);
}
function St(e, t) {
  if (!e.equals(t)) {
    var n = e.v;
    Ke ? Be.set(e, t) : Be.set(e, n), e.v = t;
    var r = Me.ensure();
    if (r.capture(e, n), e.f & H) {
      const s = (
        /** @type {Derived} */
        e
      );
      e.f & B && Qn(s), Jn(s);
    }
    e.wv = mi(), ti(e, B), Ut() && k !== null && k.f & F && !(k.f & (me | We)) && (re === null ? Ls([e]) : re.push(e)), !r.is_fork && Ln.size > 0 && !ei && xs();
  }
  return t;
}
function xs() {
  ei = !1;
  for (const e of Ln)
    e.f & F && I(e, pe), Yt(e) && Tt(e);
  Ln.clear();
}
function Ct(e) {
  V(e, e.v + 1);
}
function ti(e, t) {
  var n = e.reactions;
  if (n !== null)
    for (var r = Ut(), s = n.length, i = 0; i < s; i++) {
      var f = n[i], l = f.f;
      if (!(!r && f === k)) {
        var o = (l & B) === 0;
        if (o && I(f, t), l & H) {
          var a = (
            /** @type {Derived} */
            f
          );
          z == null || z.delete(a), l & ot || (l & le && (f.f |= ot), ti(a, pe));
        } else o && (l & De && ae !== null && ae.add(
          /** @type {Effect} */
          f
        ), ve(
          /** @type {Effect} */
          f
        ));
      }
    }
}
function ht(e) {
  if (typeof e != "object" || e === null || it in e)
    return e;
  const t = Or(e);
  if (t !== Bi && t !== Vi)
    return e;
  var n = /* @__PURE__ */ new Map(), r = Rr(e), s = /* @__PURE__ */ Le(0), i = lt, f = (l) => {
    if (lt === i)
      return l();
    var o = x, a = lt;
    oe(null), mr(i);
    var c = l();
    return oe(o), mr(a), c;
  };
  return r && n.set("length", /* @__PURE__ */ Le(
    /** @type {any[]} */
    e.length
  )), new Proxy(
    /** @type {any} */
    e,
    {
      defineProperty(l, o, a) {
        (!("value" in a) || a.configurable === !1 || a.enumerable === !1 || a.writable === !1) && is();
        var c = n.get(o);
        return c === void 0 ? f(() => {
          var h = /* @__PURE__ */ Le(a.value);
          return n.set(o, h), h;
        }) : V(c, a.value, !0), !0;
      },
      deleteProperty(l, o) {
        var a = n.get(o);
        if (a === void 0) {
          if (o in l) {
            const c = f(() => /* @__PURE__ */ Le(q));
            n.set(o, c), Ct(s);
          }
        } else
          V(a, q), Ct(s);
        return !0;
      },
      get(l, o, a) {
        var p;
        if (o === it)
          return e;
        var c = n.get(o), h = o in l;
        if (c === void 0 && (!h || (p = rt(l, o)) != null && p.writable) && (c = f(() => {
          var d = ht(h ? l[o] : q), _ = /* @__PURE__ */ Le(d);
          return _;
        }), n.set(o, c)), c !== void 0) {
          var v = y(c);
          return v === q ? void 0 : v;
        }
        return Reflect.get(l, o, a);
      },
      getOwnPropertyDescriptor(l, o) {
        var a = Reflect.getOwnPropertyDescriptor(l, o);
        if (a && "value" in a) {
          var c = n.get(o);
          c && (a.value = y(c));
        } else if (a === void 0) {
          var h = n.get(o), v = h == null ? void 0 : h.v;
          if (h !== void 0 && v !== q)
            return {
              enumerable: !0,
              configurable: !0,
              value: v,
              writable: !0
            };
        }
        return a;
      },
      has(l, o) {
        var v;
        if (o === it)
          return !0;
        var a = n.get(o), c = a !== void 0 && a.v !== q || Reflect.has(l, o);
        if (a !== void 0 || k !== null && (!c || (v = rt(l, o)) != null && v.writable)) {
          a === void 0 && (a = f(() => {
            var p = c ? ht(l[o]) : q, d = /* @__PURE__ */ Le(p);
            return d;
          }), n.set(o, a));
          var h = y(a);
          if (h === q)
            return !1;
        }
        return c;
      },
      set(l, o, a, c) {
        var T;
        var h = n.get(o), v = o in l;
        if (r && o === "length")
          for (var p = a; p < /** @type {Source<number>} */
          h.v; p += 1) {
            var d = n.get(p + "");
            d !== void 0 ? V(d, q) : p in l && (d = f(() => /* @__PURE__ */ Le(q)), n.set(p + "", d));
          }
        if (h === void 0)
          (!v || (T = rt(l, o)) != null && T.writable) && (h = f(() => /* @__PURE__ */ Le(void 0)), V(h, ht(a)), n.set(o, h));
        else {
          v = h.v !== q;
          var _ = f(() => ht(a));
          V(h, _);
        }
        var g = Reflect.getOwnPropertyDescriptor(l, o);
        if (g != null && g.set && g.set.call(c, a), !v) {
          if (r && typeof o == "string") {
            var A = (
              /** @type {Source<number>} */
              n.get("length")
            ), N = Number(o);
            Number.isInteger(N) && N >= A.v && V(A, N + 1);
          }
          Ct(s);
        }
        return !0;
      },
      ownKeys(l) {
        y(s);
        var o = Reflect.ownKeys(l).filter((h) => {
          var v = n.get(h);
          return v === void 0 || v.v !== q;
        });
        for (var [a, c] of n)
          c.v !== q && !(a in l) && o.push(a);
        return o;
      },
      setPrototypeOf() {
        ss();
      }
    }
  );
}
var _r, ni, ri, ii;
function In() {
  if (_r === void 0) {
    _r = window, ni = /Firefox/.test(navigator.userAgent);
    var e = Element.prototype, t = Node.prototype, n = Text.prototype;
    ri = rt(t, "firstChild").get, ii = rt(t, "nextSibling").get, dr(e) && (e.__click = void 0, e.__className = void 0, e.__attributes = null, e.__style = void 0, e.__e = void 0), dr(n) && (n.__t = void 0);
  }
}
function ge(e = "") {
  return document.createTextNode(e);
}
// @__NO_SIDE_EFFECTS__
function Mt(e) {
  return (
    /** @type {TemplateNode | null} */
    ri.call(e)
  );
}
// @__NO_SIDE_EFFECTS__
function Se(e) {
  return (
    /** @type {TemplateNode | null} */
    ii.call(e)
  );
}
function he(e, t) {
  if (!R)
    return /* @__PURE__ */ Mt(e);
  var n = /* @__PURE__ */ Mt(S);
  if (n === null)
    n = S.appendChild(ge());
  else if (t && n.nodeType !== cn) {
    var r = ge();
    return n == null || n.before(r), te(r), r;
  }
  return t && tr(
    /** @type {Text} */
    n
  ), te(n), n;
}
function Ss(e, t = !1) {
  if (!R) {
    var n = /* @__PURE__ */ Mt(e);
    return n instanceof Comment && n.data === "" ? /* @__PURE__ */ Se(n) : n;
  }
  if (t) {
    if ((S == null ? void 0 : S.nodeType) !== cn) {
      var r = ge();
      return S == null || S.before(r), te(r), r;
    }
    tr(
      /** @type {Text} */
      S
    );
  }
  return S;
}
function Pn(e, t = 1, n = !1) {
  let r = R ? S : e;
  for (var s; t--; )
    s = r, r = /** @type {TemplateNode} */
    /* @__PURE__ */ Se(r);
  if (!R)
    return r;
  if (n) {
    if ((r == null ? void 0 : r.nodeType) !== cn) {
      var i = ge();
      return r === null ? s == null || s.after(i) : r.before(i), te(i), i;
    }
    tr(
      /** @type {Text} */
      r
    );
  }
  return te(r), r;
}
function si(e) {
  e.textContent = "";
}
function li() {
  return !1;
}
function er(e, t, n) {
  return (
    /** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */
    document.createElementNS(Nr, e, void 0)
  );
}
function tr(e) {
  if (
    /** @type {string} */
    e.nodeValue.length < 65536
  )
    return;
  let t = e.nextSibling;
  for (; t !== null && t.nodeType === cn; )
    t.remove(), e.nodeValue += /** @type {string} */
    t.nodeValue, t = e.nextSibling;
}
let pr = !1;
function fi() {
  pr || (pr = !0, document.addEventListener(
    "reset",
    (e) => {
      Promise.resolve().then(() => {
        var t;
        if (!e.defaultPrevented)
          for (
            const n of
            /**@type {HTMLFormElement} */
            e.target.elements
          )
            (t = n.__on_r) == null || t.call(n);
      });
    },
    // In the capture phase to guarantee we get noticed of it (no possibility of stopPropagation)
    { capture: !0 }
  ));
}
function pn(e) {
  var t = x, n = k;
  oe(null), xe(null);
  try {
    return e();
  } finally {
    oe(t), xe(n);
  }
}
function Ts(e, t, n, r = n) {
  e.addEventListener(t, () => pn(n));
  const s = e.__on_r;
  s ? e.__on_r = () => {
    s(), r(!0);
  } : e.__on_r = () => r(!0), fi();
}
function oi(e) {
  k === null && (x === null && es(), Qi()), Ke && Zi();
}
function ks(e, t) {
  var n = t.last;
  n === null ? t.last = t.first = e : (n.next = e, e.prev = n, t.last = e);
}
function be(e, t, n) {
  var r = k;
  r !== null && r.f & ee && (e |= ee);
  var s = {
    ctx: P,
    deps: null,
    nodes: null,
    f: e | B | le,
    first: null,
    fn: t,
    last: null,
    next: null,
    parent: r,
    b: r && r.b,
    prev: null,
    teardown: null,
    wv: 0,
    ac: null
  };
  if (n)
    try {
      Tt(s);
    } catch (l) {
      throw U(s), l;
    }
  else t !== null && ve(s);
  var i = s;
  if (n && i.deps === null && i.teardown === null && i.nodes === null && i.first === i.last && // either `null`, or a singular child
  !(i.f & ut) && (i = i.first, e & De && e & Et && i !== null && (i.f |= Et)), i !== null && (i.parent = r, r !== null && ks(i, r), x !== null && x.f & H && !(e & We))) {
    var f = (
      /** @type {Derived} */
      x
    );
    (f.effects ?? (f.effects = [])).push(i);
  }
  return s;
}
function nr() {
  return x !== null && !_e;
}
function ai(e) {
  const t = be(Ht, null, !1);
  return I(t, F), t.teardown = e, t;
}
function Fn(e) {
  oi();
  var t = (
    /** @type {Effect} */
    k.f
  ), n = !x && (t & me) !== 0 && (t & Ye) === 0;
  if (n) {
    var r = (
      /** @type {ComponentContext} */
      P
    );
    (r.e ?? (r.e = [])).push(e);
  } else
    return ui(e);
}
function ui(e) {
  return be(zt | Lr, e, !1);
}
function As(e) {
  return oi(), be(Ht | Lr, e, !0);
}
function Ns(e) {
  Me.ensure();
  const t = be(We | ut, e, !0);
  return () => {
    U(t);
  };
}
function Rs(e) {
  Me.ensure();
  const t = be(We | ut, e, !0);
  return (n = {}) => new Promise((r) => {
    n.outro ? st(t, () => {
      U(t), r(void 0);
    }) : (U(t), r(void 0));
  });
}
function ci(e) {
  return be(zt, e, !1);
}
function Os(e) {
  return be(Wn | ut, e, !0);
}
function gn(e, t = 0) {
  return be(Ht | t, e, !0);
}
function jn(e, t = [], n = [], r = []) {
  gs(r, t, n, (s) => {
    be(Ht, () => e(...s.map(y)), !0);
  });
}
function rr(e, t = 0) {
  var n = be(De | t, e, !0);
  return n;
}
function se(e) {
  return be(me | ut, e, !0);
}
function di(e) {
  var t = e.teardown;
  if (t !== null) {
    const n = Ke, r = x;
    gr(!0), oe(null);
    try {
      t.call(null);
    } finally {
      gr(n), oe(r);
    }
  }
}
function ir(e, t = !1) {
  var n = e.first;
  for (e.first = e.last = null; n !== null; ) {
    const s = n.ac;
    s !== null && pn(() => {
      s.abort(Ge);
    });
    var r = n.next;
    n.f & We ? n.parent = null : U(n, t), n = r;
  }
}
function Cs(e) {
  for (var t = e.first; t !== null; ) {
    var n = t.next;
    t.f & me || U(t), t = n;
  }
}
function U(e, t = !0) {
  var n = !1;
  (t || e.f & Dr) && e.nodes !== null && e.nodes.end !== null && (Ms(
    e.nodes.start,
    /** @type {TemplateNode} */
    e.nodes.end
  ), n = !0), ir(e, t && !n), Dt(e, 0), I(e, Oe);
  var r = e.nodes && e.nodes.t;
  if (r !== null)
    for (const i of r)
      i.stop();
  di(e);
  var s = e.parent;
  s !== null && s.first !== null && hi(e), e.next = e.prev = e.teardown = e.ctx = e.deps = e.fn = e.nodes = e.ac = null;
}
function Ms(e, t) {
  for (; e !== null; ) {
    var n = e === t ? null : /* @__PURE__ */ Se(e);
    e.remove(), e = n;
  }
}
function hi(e) {
  var t = e.parent, n = e.prev, r = e.next;
  n !== null && (n.next = r), r !== null && (r.prev = n), t !== null && (t.first === e && (t.first = r), t.last === e && (t.last = n));
}
function st(e, t, n = !0) {
  var r = [];
  vi(e, r, !0);
  var s = () => {
    n && U(e), t && t();
  }, i = r.length;
  if (i > 0) {
    var f = () => --i || s();
    for (var l of r)
      l.out(f);
  } else
    s();
}
function vi(e, t, n) {
  if (!(e.f & ee)) {
    e.f ^= ee;
    var r = e.nodes && e.nodes.t;
    if (r !== null)
      for (const l of r)
        (l.is_global || n) && t.push(l);
    for (var s = e.first; s !== null; ) {
      var i = s.next, f = (s.f & Et) !== 0 || // If this is a branch effect without a block effect parent,
      // it means the parent block effect was pruned. In that case,
      // transparency information was transferred to the branch effect.
      (s.f & me) !== 0 && (e.f & De) !== 0;
      vi(s, t, f ? n : !1), s = i;
    }
  }
}
function sr(e) {
  _i(e, !0);
}
function _i(e, t) {
  if (e.f & ee) {
    e.f ^= ee, e.f & F || (I(e, B), ve(e));
    for (var n = e.first; n !== null; ) {
      var r = n.next, s = (n.f & Et) !== 0 || (n.f & me) !== 0;
      _i(n, s ? t : !1), n = r;
    }
    var i = e.nodes && e.nodes.t;
    if (i !== null)
      for (const f of i)
        (f.is_global || t) && f.in();
  }
}
function pi(e, t) {
  if (e.nodes)
    for (var n = e.nodes.start, r = e.nodes.end; n !== null; ) {
      var s = n === r ? null : /* @__PURE__ */ Se(n);
      t.append(n), n = s;
    }
}
let tn = !1, Ke = !1;
function gr(e) {
  Ke = e;
}
let x = null, _e = !1;
function oe(e) {
  x = e;
}
let k = null;
function xe(e) {
  k = e;
}
let fe = null;
function Ds(e) {
  x !== null && (fe === null ? fe = [e] : fe.push(e));
}
let W = null, J = 0, re = null;
function Ls(e) {
  re = e;
}
let gi = 1, Xe = 0, lt = Xe;
function mr(e) {
  lt = e;
}
function mi() {
  return ++gi;
}
function Yt(e) {
  var t = e.f;
  if (t & B)
    return !0;
  if (t & H && (e.f &= ~ot), t & pe) {
    for (var n = (
      /** @type {Value[]} */
      e.deps
    ), r = n.length, s = 0; s < r; s++) {
      var i = n[s];
      if (Yt(
        /** @type {Derived} */
        i
      ) && Zr(
        /** @type {Derived} */
        i
      ), i.wv > e.wv)
        return !0;
    }
    t & le && // During time traveling we don't want to reset the status so that
    // traversal of the graph in the other batches still happens
    z === null && I(e, F);
  }
  return !1;
}
function bi(e, t, n = !0) {
  var r = e.reactions;
  if (r !== null && !(fe !== null && $t.call(fe, e)))
    for (var s = 0; s < r.length; s++) {
      var i = r[s];
      i.f & H ? bi(
        /** @type {Derived} */
        i,
        t,
        !1
      ) : t === i && (n ? I(i, B) : i.f & F && I(i, pe), ve(
        /** @type {Effect} */
        i
      ));
    }
}
function wi(e) {
  var _;
  var t = W, n = J, r = re, s = x, i = fe, f = P, l = _e, o = lt, a = e.f;
  W = /** @type {null | Value[]} */
  null, J = 0, re = null, x = a & (me | We) ? null : e, fe = null, xt(e.ctx), _e = !1, lt = ++Xe, e.ac !== null && (pn(() => {
    e.ac.abort(Ge);
  }), e.ac = null);
  try {
    e.f |= Tn;
    var c = (
      /** @type {Function} */
      e.fn
    ), h = c();
    e.f |= Ye;
    var v = e.deps, p = w == null ? void 0 : w.is_fork;
    if (W !== null) {
      var d;
      if (p || Dt(e, J), v !== null && J > 0)
        for (v.length = J + W.length, d = 0; d < W.length; d++)
          v[J + d] = W[d];
      else
        e.deps = v = W;
      if (nr() && e.f & le)
        for (d = J; d < v.length; d++)
          ((_ = v[d]).reactions ?? (_.reactions = [])).push(e);
    } else !p && v !== null && J < v.length && (Dt(e, J), v.length = J);
    if (Ut() && re !== null && !_e && v !== null && !(e.f & (H | pe | B)))
      for (d = 0; d < /** @type {Source[]} */
      re.length; d++)
        bi(
          re[d],
          /** @type {Effect} */
          e
        );
    if (s !== null && s !== e) {
      if (Xe++, s.deps !== null)
        for (let g = 0; g < n; g += 1)
          s.deps[g].rv = Xe;
      if (t !== null)
        for (const g of t)
          g.rv = Xe;
      re !== null && (r === null ? r = re : r.push(.../** @type {Source[]} */
      re));
    }
    return e.f & He && (e.f ^= He), h;
  } catch (g) {
    return zr(g);
  } finally {
    e.f ^= Tn, W = t, J = n, re = r, x = s, fe = i, xt(f), _e = l, lt = o;
  }
}
function Is(e, t) {
  let n = t.reactions;
  if (n !== null) {
    var r = zi.call(n, e);
    if (r !== -1) {
      var s = n.length - 1;
      s === 0 ? n = t.reactions = null : (n[r] = n[s], n.pop());
    }
  }
  if (n === null && t.f & H && // Destroying a child effect while updating a parent effect can cause a dependency to appear
  // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
  // allows us to skip the expensive work of disconnecting and immediately reconnecting it
  (W === null || !$t.call(W, t))) {
    var i = (
      /** @type {Derived} */
      t
    );
    i.f & le && (i.f ^= le, i.f &= ~ot), Jn(i), Es(i), Dt(i, 0);
  }
}
function Dt(e, t) {
  var n = e.deps;
  if (n !== null)
    for (var r = t; r < n.length; r++)
      Is(e, n[r]);
}
function Tt(e) {
  var t = e.f;
  if (!(t & Oe)) {
    I(e, F);
    var n = k, r = tn;
    k = e, tn = !0;
    try {
      t & (De | Mr) ? Cs(e) : ir(e), di(e);
      var s = wi(e);
      e.teardown = typeof s == "function" ? s : null, e.wv = gi;
      var i;
      En && Mi && e.f & B && e.deps;
    } finally {
      tn = r, k = n;
    }
  }
}
async function Ps() {
  await Promise.resolve(), Ee();
}
function y(e) {
  var t = e.f, n = (t & H) !== 0;
  if (x !== null && !_e) {
    var r = k !== null && (k.f & Oe) !== 0;
    if (!r && (fe === null || !$t.call(fe, e))) {
      var s = x.deps;
      if (x.f & Tn)
        e.rv < Xe && (e.rv = Xe, W === null && s !== null && s[J] === e ? J++ : W === null ? W = [e] : W.push(e));
      else {
        (x.deps ?? (x.deps = [])).push(e);
        var i = e.reactions;
        i === null ? e.reactions = [x] : $t.call(i, x) || i.push(x);
      }
    }
  }
  if (Ke && Be.has(e))
    return Be.get(e);
  if (n) {
    var f = (
      /** @type {Derived} */
      e
    );
    if (Ke) {
      var l = f.v;
      return (!(f.f & F) && f.reactions !== null || $i(f)) && (l = Qn(f)), Be.set(f, l), l;
    }
    var o = (f.f & le) === 0 && !_e && x !== null && (tn || (x.f & le) !== 0), a = (f.f & Ye) === 0;
    Yt(f) && (o && (f.f |= le), Zr(f)), o && !a && (Qr(f), yi(f));
  }
  if (z != null && z.has(e))
    return z.get(e);
  if (e.f & He)
    throw e.v;
  return e.v;
}
function yi(e) {
  if (e.f |= le, e.deps !== null)
    for (const t of e.deps)
      (t.reactions ?? (t.reactions = [])).push(e), t.f & H && !(t.f & le) && (Qr(
        /** @type {Derived} */
        t
      ), yi(
        /** @type {Derived} */
        t
      ));
}
function $i(e) {
  if (e.v === q) return !0;
  if (e.deps === null) return !1;
  for (const t of e.deps)
    if (Be.has(t) || t.f & H && $i(
      /** @type {Derived} */
      t
    ))
      return !0;
  return !1;
}
function Ue(e) {
  var t = _e;
  try {
    return _e = !0, e();
  } finally {
    _e = t;
  }
}
function Fs(e) {
  if (!(typeof e != "object" || !e || e instanceof EventTarget)) {
    if (it in e)
      qn(e);
    else if (!Array.isArray(e))
      for (let t in e) {
        const n = e[t];
        typeof n == "object" && n && it in n && qn(n);
      }
  }
}
function qn(e, t = /* @__PURE__ */ new Set()) {
  if (typeof e == "object" && e !== null && // We don't want to traverse DOM elements
  !(e instanceof EventTarget) && !t.has(e)) {
    t.add(e), e instanceof Date && e.getTime();
    for (let r in e)
      try {
        qn(e[r], t);
      } catch {
      }
    const n = Or(e);
    if (n !== Object.prototype && n !== Array.prototype && n !== Map.prototype && n !== Set.prototype && n !== Date.prototype) {
      const r = Hi(n);
      for (let s in r) {
        const i = r[s].get;
        if (i)
          try {
            i.call(e);
          } catch {
          }
      }
    }
  }
}
const Jt = Symbol("events"), js = /* @__PURE__ */ new Set(), br = /* @__PURE__ */ new Set();
function qs(e, t, n, r = {}) {
  function s(i) {
    if (r.capture || zn.call(t, i), !i.cancelBubble)
      return pn(() => n == null ? void 0 : n.call(this, i));
  }
  return e.startsWith("pointer") || e.startsWith("touch") || e === "wheel" ? Ce(() => {
    t.addEventListener(e, s, r);
  }) : t.addEventListener(e, s, r), s;
}
function ft(e, t, n, r, s) {
  var i = { capture: r, passive: s }, f = qs(e, t, n, i);
  (t === document.body || // @ts-ignore
  t === window || // @ts-ignore
  t === document || // Firefox has quirky behavior, it can happen that we still get "canplay" events when the element is already removed
  t instanceof HTMLMediaElement) && ai(() => {
    t.removeEventListener(e, f, i);
  });
}
let wr = null;
function zn(e) {
  var g, A;
  var t = this, n = (
    /** @type {Node} */
    t.ownerDocument
  ), r = e.type, s = ((g = e.composedPath) == null ? void 0 : g.call(e)) || [], i = (
    /** @type {null | Element} */
    s[0] || e.target
  );
  wr = e;
  var f = 0, l = wr === e && e[Jt];
  if (l) {
    var o = s.indexOf(l);
    if (o !== -1 && (t === document || t === /** @type {any} */
    window)) {
      e[Jt] = t;
      return;
    }
    var a = s.indexOf(t);
    if (a === -1)
      return;
    o <= a && (f = o);
  }
  if (i = /** @type {Element} */
  s[f] || e.target, i !== t) {
    sn(e, "currentTarget", {
      configurable: !0,
      get() {
        return i || n;
      }
    });
    var c = x, h = k;
    oe(null), xe(null);
    try {
      for (var v, p = []; i !== null; ) {
        var d = i.assignedSlot || i.parentNode || /** @type {any} */
        i.host || null;
        try {
          var _ = (A = i[Jt]) == null ? void 0 : A[r];
          _ != null && (!/** @type {any} */
          i.disabled || // DOM could've been updated already by the time this is reached, so we check this as well
          // -> the target could not have been disabled because it emits the event in the first place
          e.target === i) && _.call(i, e);
        } catch (N) {
          v ? p.push(N) : v = N;
        }
        if (e.cancelBubble || d === t || d === null)
          break;
        i = d;
      }
      if (v) {
        for (let N of p)
          queueMicrotask(() => {
            throw N;
          });
        throw v;
      }
    } finally {
      e[Jt] = t, delete e.currentTarget, oe(c), xe(h);
    }
  }
}
var Ar;
const wn = (
  // We gotta write it like this because after downleveling the pure comment may end up in the wrong location
  ((Ar = globalThis == null ? void 0 : globalThis.window) == null ? void 0 : Ar.trustedTypes) && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", {
    /** @param {string} html */
    createHTML: (e) => e
  })
);
function zs(e) {
  return (
    /** @type {string} */
    (wn == null ? void 0 : wn.createHTML(e)) ?? e
  );
}
function Hs(e) {
  var t = er("template");
  return t.innerHTML = zs(e.replaceAll("<!>", "<!---->")), t.content;
}
function Lt(e, t) {
  var n = (
    /** @type {Effect} */
    k
  );
  n.nodes === null && (n.nodes = { start: e, end: t, a: null, t: null });
}
// @__NO_SIDE_EFFECTS__
function At(e, t) {
  var n = (t & qi) !== 0, r, s = !e.startsWith("<!>");
  return () => {
    if (R)
      return Lt(S, null), S;
    r === void 0 && (r = Hs(s ? e : "<!>" + e), r = /** @type {TemplateNode} */
    /* @__PURE__ */ Mt(r));
    var i = (
      /** @type {TemplateNode} */
      n || ni ? document.importNode(r, !0) : r.cloneNode(!0)
    );
    return Lt(i, i), i;
  };
}
function Bs() {
  if (R)
    return Lt(S, null), S;
  var e = document.createDocumentFragment(), t = document.createComment(""), n = ge();
  return e.append(t, n), Lt(t, n), e;
}
function Pe(e, t) {
  if (R) {
    var n = (
      /** @type {Effect & { nodes: EffectNodes }} */
      k
    );
    (!(n.f & Ye) || n.nodes.end === null) && (n.nodes.end = S), Vt();
    return;
  }
  e !== null && e.before(
    /** @type {Node} */
    t
  );
}
const Vs = ["touchstart", "touchmove"];
function Us(e) {
  return Vs.includes(e);
}
function Hn(e, t) {
  var n = t == null ? "" : typeof t == "object" ? t + "" : t;
  n !== (e.__t ?? (e.__t = e.nodeValue)) && (e.__t = n, e.nodeValue = n + "");
}
function Ei(e, t) {
  return xi(e, t);
}
function Ys(e, t) {
  In(), t.intro = t.intro ?? !1;
  const n = t.target, r = R, s = S;
  try {
    for (var i = /* @__PURE__ */ Mt(n); i && (i.nodeType !== Bt || /** @type {Comment} */
    i.data !== Yn); )
      i = /* @__PURE__ */ Se(i);
    if (!i)
      throw yt;
    Re(!0), te(
      /** @type {Comment} */
      i
    );
    const f = xi(e, { ...t, anchor: i });
    return Re(!1), /**  @type {Exports} */
    f;
  } catch (f) {
    if (f instanceof Error && f.message.split(`
`).some((l) => l.startsWith("https://svelte.dev/e/")))
      throw f;
    return f !== yt && console.warn("Failed to hydrate: ", f), t.recover === !1 && ns(), In(), si(n), Re(!1), Ei(e, t);
  } finally {
    Re(r), te(s);
  }
}
const Xt = /* @__PURE__ */ new Map();
function xi(e, { target: t, anchor: n, props: r = {}, events: s, context: i, intro: f = !0, transformError: l }) {
  In();
  var o = void 0, a = Rs(() => {
    var c = n ?? t.appendChild(ge());
    _s(
      /** @type {TemplateNode} */
      c,
      {
        pending: () => {
        }
      },
      (p) => {
        hn({});
        var d = (
          /** @type {ComponentContext} */
          P
        );
        if (i && (d.c = i), s && (r.$$events = s), R && Lt(
          /** @type {TemplateNode} */
          p,
          null
        ), o = e(p, r) || {}, R && (k.nodes.end = S, S === null || S.nodeType !== Bt || /** @type {Comment} */
        S.data !== Kn))
          throw dn(), yt;
        vn();
      },
      l
    );
    var h = /* @__PURE__ */ new Set(), v = (p) => {
      for (var d = 0; d < p.length; d++) {
        var _ = p[d];
        if (!h.has(_)) {
          h.add(_);
          var g = Us(_);
          for (const T of [t, document]) {
            var A = Xt.get(T);
            A === void 0 && (A = /* @__PURE__ */ new Map(), Xt.set(T, A));
            var N = A.get(_);
            N === void 0 ? (T.addEventListener(_, zn, { passive: g }), A.set(_, 1)) : A.set(_, N + 1);
          }
        }
      }
    };
    return v(un(js)), br.add(v), () => {
      var g;
      for (var p of h)
        for (const A of [t, document]) {
          var d = (
            /** @type {Map<string, number>} */
            Xt.get(A)
          ), _ = (
            /** @type {number} */
            d.get(p)
          );
          --_ == 0 ? (A.removeEventListener(p, zn), d.delete(p), d.size === 0 && Xt.delete(A)) : d.set(p, _);
        }
      br.delete(v), c !== n && ((g = c.parentNode) == null || g.removeChild(c));
    };
  });
  return Bn.set(o, a), o;
}
let Bn = /* @__PURE__ */ new WeakMap();
function Ks(e, t) {
  const n = Bn.get(e);
  return n ? (Bn.delete(e), n(t)) : Promise.resolve();
}
var ce, $e, Q, nt, jt, qt, on;
class Ws {
  /**
   * @param {TemplateNode} anchor
   * @param {boolean} transition
   */
  constructor(t, n = !0) {
    /** @type {TemplateNode} */
    D(this, "anchor");
    /** @type {Map<Batch, Key>} */
    $(this, ce, /* @__PURE__ */ new Map());
    /**
     * Map of keys to effects that are currently rendered in the DOM.
     * These effects are visible and actively part of the document tree.
     * Example:
     * ```
     * {#if condition}
     * 	foo
     * {:else}
     * 	bar
     * {/if}
     * ```
     * Can result in the entries `true->Effect` and `false->Effect`
     * @type {Map<Key, Effect>}
     */
    $(this, $e, /* @__PURE__ */ new Map());
    /**
     * Similar to #onscreen with respect to the keys, but contains branches that are not yet
     * in the DOM, because their insertion is deferred.
     * @type {Map<Key, Branch>}
     */
    $(this, Q, /* @__PURE__ */ new Map());
    /**
     * Keys of effects that are currently outroing
     * @type {Set<Key>}
     */
    $(this, nt, /* @__PURE__ */ new Set());
    /**
     * Whether to pause (i.e. outro) on change, or destroy immediately.
     * This is necessary for `<svelte:element>`
     */
    $(this, jt, !0);
    $(this, qt, () => {
      var t = (
        /** @type {Batch} */
        w
      );
      if (u(this, ce).has(t)) {
        var n = (
          /** @type {Key} */
          u(this, ce).get(t)
        ), r = u(this, $e).get(n);
        if (r)
          sr(r), u(this, nt).delete(n);
        else {
          var s = u(this, Q).get(n);
          s && (u(this, $e).set(n, s.effect), u(this, Q).delete(n), s.fragment.lastChild.remove(), this.anchor.before(s.fragment), r = s.effect);
        }
        for (const [i, f] of u(this, ce)) {
          if (u(this, ce).delete(i), i === t)
            break;
          const l = u(this, Q).get(f);
          l && (U(l.effect), u(this, Q).delete(f));
        }
        for (const [i, f] of u(this, $e)) {
          if (i === n || u(this, nt).has(i)) continue;
          const l = () => {
            if (Array.from(u(this, ce).values()).includes(i)) {
              var a = document.createDocumentFragment();
              pi(f, a), a.append(ge()), u(this, Q).set(i, { effect: f, fragment: a });
            } else
              U(f);
            u(this, nt).delete(i), u(this, $e).delete(i);
          };
          u(this, jt) || !r ? (u(this, nt).add(i), st(f, l, !1)) : l();
        }
      }
    });
    /**
     * @param {Batch} batch
     */
    $(this, on, (t) => {
      u(this, ce).delete(t);
      const n = Array.from(u(this, ce).values());
      for (const [r, s] of u(this, Q))
        n.includes(r) || (U(s.effect), u(this, Q).delete(r));
    });
    this.anchor = t, b(this, jt, n);
  }
  /**
   *
   * @param {any} key
   * @param {null | ((target: TemplateNode) => void)} fn
   */
  ensure(t, n) {
    var r = (
      /** @type {Batch} */
      w
    ), s = li();
    if (n && !u(this, $e).has(t) && !u(this, Q).has(t))
      if (s) {
        var i = document.createDocumentFragment(), f = ge();
        i.append(f), u(this, Q).set(t, {
          effect: se(() => n(f)),
          fragment: i
        });
      } else
        u(this, $e).set(
          t,
          se(() => n(this.anchor))
        );
    if (u(this, ce).set(r, t), s) {
      for (const [l, o] of u(this, $e))
        l === t ? r.unskip_effect(o) : r.skip_effect(o);
      for (const [l, o] of u(this, Q))
        l === t ? r.unskip_effect(o.effect) : r.skip_effect(o.effect);
      r.oncommit(u(this, qt)), r.ondiscard(u(this, on));
    } else
      R && (this.anchor = S), u(this, qt).call(this);
  }
}
ce = new WeakMap(), $e = new WeakMap(), Q = new WeakMap(), nt = new WeakMap(), jt = new WeakMap(), qt = new WeakMap(), on = new WeakMap();
function Si(e) {
  P === null && Gi(), kt && P.l !== null ? Gs(P).m.push(e) : Fn(() => {
    const t = Ue(e);
    if (typeof t == "function") return (
      /** @type {() => void} */
      t
    );
  });
}
function Gs(e) {
  var t = (
    /** @type {ComponentContextLegacy} */
    e.l
  );
  return t.u ?? (t.u = { a: [], b: [], m: [] });
}
function yr(e, t, n = !1) {
  R && Vt();
  var r = new Ws(e), s = n ? Et : 0;
  function i(f, l) {
    if (R) {
      const c = Pr(e);
      var o;
      if (c === Yn ? o = 0 : c === an ? o = !1 : o = parseInt(c.substring(1)), f !== o) {
        var a = ln();
        te(a), r.anchor = a, Re(!1), r.ensure(f, l), Re(!0);
        return;
      }
    }
    r.ensure(f, l);
  }
  rr(() => {
    var f = !1;
    t((l, o = 0) => {
      f = !0, i(o, l);
    }), f || i(!1, null);
  }, s);
}
function Js(e, t) {
  return t;
}
function Xs(e, t, n) {
  for (var r = [], s = t.length, i, f = t.length, l = 0; l < s; l++) {
    let h = t[l];
    st(
      h,
      () => {
        if (i) {
          if (i.pending.delete(h), i.done.add(h), i.pending.size === 0) {
            var v = (
              /** @type {Set<EachOutroGroup>} */
              e.outrogroups
            );
            Vn(un(i.done)), v.delete(i), v.size === 0 && (e.outrogroups = null);
          }
        } else
          f -= 1;
      },
      !1
    );
  }
  if (f === 0) {
    var o = r.length === 0 && n !== null;
    if (o) {
      var a = (
        /** @type {Element} */
        n
      ), c = (
        /** @type {Element} */
        a.parentNode
      );
      si(c), c.append(a), e.items.clear();
    }
    Vn(t, !o);
  } else
    i = {
      pending: new Set(t),
      done: /* @__PURE__ */ new Set()
    }, (e.outrogroups ?? (e.outrogroups = /* @__PURE__ */ new Set())).add(i);
}
function Vn(e, t = !0) {
  for (var n = 0; n < e.length; n++)
    U(e[n], t);
}
var $r;
function Zs(e, t, n, r, s, i = null) {
  var f = e, l = /* @__PURE__ */ new Map();
  R && Vt();
  var o = null, a = /* @__PURE__ */ Zn(() => {
    var _ = n();
    return Rr(_) ? _ : _ == null ? [] : un(_);
  }), c, h = !0;
  function v() {
    d.fallback = o, Qs(d, c, f, t, r), o !== null && (c.length === 0 ? o.f & je ? (o.f ^= je, Rt(o, null, f)) : sr(o) : st(o, () => {
      o = null;
    }));
  }
  var p = rr(() => {
    c = /** @type {V[]} */
    y(a);
    var _ = c.length;
    let g = !1;
    if (R) {
      var A = Pr(f) === an;
      A !== (_ === 0) && (f = ln(), te(f), Re(!1), g = !0);
    }
    for (var N = /* @__PURE__ */ new Set(), T = (
      /** @type {Batch} */
      w
    ), E = li(), O = 0; O < _; O += 1) {
      R && S.nodeType === Bt && /** @type {Comment} */
      S.data === Kn && (f = /** @type {Comment} */
      S, g = !0, Re(!1));
      var m = c[O], M = r(m, O), j = h ? null : l.get(M);
      j ? (j.v && St(j.v, m), j.i && St(j.i, O), E && T.unskip_effect(j.e)) : (j = el(
        l,
        h ? f : $r ?? ($r = ge()),
        m,
        M,
        O,
        s,
        t,
        n
      ), h || (j.e.f |= je), l.set(M, j)), N.add(M);
    }
    if (_ === 0 && i && !o && (h ? o = se(() => i(f)) : (o = se(() => i($r ?? ($r = ge()))), o.f |= je)), _ > N.size && Xi(), R && _ > 0 && te(ln()), !h)
      if (E) {
        for (const [G, ct] of l)
          N.has(G) || T.skip_effect(ct.e);
        T.oncommit(v), T.ondiscard(() => {
        });
      } else
        v();
    g && Re(!0), y(a);
  }), d = { effect: p, items: l, outrogroups: null, fallback: o };
  h = !1, R && (f = S);
}
function Nt(e) {
  for (; e !== null && !(e.f & me); )
    e = e.next;
  return e;
}
function Qs(e, t, n, r, s) {
  var j;
  var i = t.length, f = e.items, l = Nt(e.effect.first), o, a = null, c = [], h = [], v, p, d, _;
  for (_ = 0; _ < i; _ += 1) {
    if (v = t[_], p = s(v, _), d = /** @type {EachItem} */
    f.get(p).e, e.outrogroups !== null)
      for (const G of e.outrogroups)
        G.pending.delete(d), G.done.delete(d);
    if (d.f & je)
      if (d.f ^= je, d === l)
        Rt(d, null, n);
      else {
        var g = a ? a.next : l;
        d === e.effect.last && (e.effect.last = d.prev), d.prev && (d.prev.next = d.next), d.next && (d.next.prev = d.prev), Ie(e, a, d), Ie(e, d, g), Rt(d, g, n), a = d, c = [], h = [], l = Nt(a.next);
        continue;
      }
    if (d.f & ee && sr(d), d !== l) {
      if (o !== void 0 && o.has(d)) {
        if (c.length < h.length) {
          var A = h[0], N;
          a = A.prev;
          var T = c[0], E = c[c.length - 1];
          for (N = 0; N < c.length; N += 1)
            Rt(c[N], A, n);
          for (N = 0; N < h.length; N += 1)
            o.delete(h[N]);
          Ie(e, T.prev, E.next), Ie(e, a, T), Ie(e, E, A), l = A, a = E, _ -= 1, c = [], h = [];
        } else
          o.delete(d), Rt(d, l, n), Ie(e, d.prev, d.next), Ie(e, d, a === null ? e.effect.first : a.next), Ie(e, a, d), a = d;
        continue;
      }
      for (c = [], h = []; l !== null && l !== d; )
        (o ?? (o = /* @__PURE__ */ new Set())).add(l), h.push(l), l = Nt(l.next);
      if (l === null)
        continue;
    }
    d.f & je || c.push(d), a = d, l = Nt(d.next);
  }
  if (e.outrogroups !== null) {
    for (const G of e.outrogroups)
      G.pending.size === 0 && (Vn(un(G.done)), (j = e.outrogroups) == null || j.delete(G));
    e.outrogroups.size === 0 && (e.outrogroups = null);
  }
  if (l !== null || o !== void 0) {
    var O = [];
    if (o !== void 0)
      for (d of o)
        d.f & ee || O.push(d);
    for (; l !== null; )
      !(l.f & ee) && l !== e.fallback && O.push(l), l = Nt(l.next);
    var m = O.length;
    if (m > 0) {
      var M = null;
      Xs(e, O, M);
    }
  }
}
function el(e, t, n, r, s, i, f, l) {
  var o = f & Li ? f & Pi ? at(n) : /* @__PURE__ */ Ve(n, !1, !1) : null, a = f & Ii ? at(s) : null;
  return {
    v: o,
    i: a,
    e: se(() => (i(t, o ?? n, a ?? s, l), () => {
      e.delete(r);
    }))
  };
}
function Rt(e, t, n) {
  if (e.nodes)
    for (var r = e.nodes.start, s = e.nodes.end, i = t && !(t.f & je) ? (
      /** @type {EffectNodes} */
      t.nodes.start
    ) : n; r !== null; ) {
      var f = (
        /** @type {TemplateNode} */
        /* @__PURE__ */ Se(r)
      );
      if (i.before(r), r === s)
        return;
      r = f;
    }
}
function Ie(e, t, n) {
  t === null ? e.effect.first = n : t.next = n, n === null ? e.effect.last = t : n.prev = t;
}
function tl(e, t, n, r, s) {
  var l;
  R && Vt();
  var i = (l = t.$$slots) == null ? void 0 : l[n], f = !1;
  i === !0 && (i = t.children, f = !0), i === void 0 || i(e, f ? () => r : r);
}
function lr(e, t) {
  ci(() => {
    var n = e.getRootNode(), r = (
      /** @type {ShadowRoot} */
      n.host ? (
        /** @type {ShadowRoot} */
        n
      ) : (
        /** @type {Document} */
        n.head ?? /** @type {Document} */
        n.ownerDocument.head
      )
    );
    if (!r.querySelector("#" + t.hash)) {
      const s = er("style");
      s.id = t.hash, s.textContent = t.code, r.appendChild(s);
    }
  });
}
const nl = Symbol("is custom element"), rl = Symbol("is html"), il = Wi ? "link" : "LINK";
function sl(e) {
  if (R) {
    var t = !1, n = () => {
      if (!t) {
        if (t = !0, e.hasAttribute("value")) {
          var r = e.value;
          Er(e, "value", null), e.value = r;
        }
        if (e.hasAttribute("checked")) {
          var s = e.checked;
          Er(e, "checked", null), e.checked = s;
        }
      }
    };
    e.__on_r = n, Ce(n), fi();
  }
}
function Er(e, t, n, r) {
  var s = ll(e);
  R && (s[t] = e.getAttribute(t), t === "src" || t === "srcset" || t === "href" && e.nodeName === il) || s[t] !== (s[t] = n) && (t === "loading" && (e[Ki] = n), e.removeAttribute(t));
}
function ll(e) {
  return (
    /** @type {Record<string | symbol, unknown>} **/
    // @ts-expect-error
    e.__attributes ?? (e.__attributes = {
      [nl]: e.nodeName.includes("-"),
      [rl]: e.namespaceURI === Nr
    })
  );
}
function fl(e, t, n = t) {
  var r = /* @__PURE__ */ new WeakSet();
  Ts(e, "input", async (s) => {
    var i = s ? e.defaultValue : e.value;
    if (i = yn(e) ? $n(i) : i, n(i), w !== null && r.add(w), await Ps(), i !== (i = t())) {
      var f = e.selectionStart, l = e.selectionEnd, o = e.value.length;
      if (e.value = i ?? "", l !== null) {
        var a = e.value.length;
        f === l && l === o && a > o ? (e.selectionStart = a, e.selectionEnd = a) : (e.selectionStart = f, e.selectionEnd = Math.min(l, a));
      }
    }
  }), // If we are hydrating and the value has since changed,
  // then use the updated value from the input instead.
  (R && e.defaultValue !== e.value || // If defaultValue is set, then value == defaultValue
  // TODO Svelte 6: remove input.value check and set to empty string?
  Ue(t) == null && e.value) && (n(yn(e) ? $n(e.value) : e.value), w !== null && r.add(w)), gn(() => {
    var s = t();
    if (e === document.activeElement) {
      var i = (
        /** @type {Batch} */
        kn ?? w
      );
      if (r.has(i))
        return;
    }
    yn(e) && s === $n(e.value) || e.type === "date" && !s && !e.value || s !== e.value && (e.value = s ?? "");
  });
}
function yn(e) {
  var t = e.type;
  return t === "number" || t === "range";
}
function $n(e) {
  return e === "" ? null : +e;
}
function xr(e, t) {
  return e === t || (e == null ? void 0 : e[it]) === t;
}
function Un(e = {}, t, n, r) {
  return ci(() => {
    var s, i;
    return gn(() => {
      s = i, i = [], Ue(() => {
        e !== n(...i) && (t(e, ...i), s && xr(n(...s), e) && t(null, ...s));
      });
    }), () => {
      Ce(() => {
        i && xr(n(...i), e) && t(null, ...i);
      });
    };
  }), e;
}
function ol(e) {
  return function(...t) {
    var n = (
      /** @type {Event} */
      t[0]
    );
    return n.preventDefault(), e == null ? void 0 : e.apply(this, t);
  };
}
function fr(e = !1) {
  const t = (
    /** @type {ComponentContextLegacy} */
    P
  ), n = t.l.u;
  if (!n) return;
  let r = () => Fs(t.s);
  if (e) {
    let s = 0, i = (
      /** @type {Record<string, any>} */
      {}
    );
    const f = /* @__PURE__ */ Xn(() => {
      let l = !1;
      const o = t.s;
      for (const a in o)
        o[a] !== i[a] && (i[a] = o[a], l = !0);
      return l && s++, s;
    });
    r = () => y(f);
  }
  n.b.length && As(() => {
    Sr(t, r), xn(n.b);
  }), Fn(() => {
    const s = Ue(() => n.m.map(Yi));
    return () => {
      for (const i of s)
        typeof i == "function" && i();
    };
  }), n.a.length && Fn(() => {
    Sr(t, r), xn(n.a);
  });
}
function Sr(e, t) {
  if (e.l.s)
    for (const n of e.l.s) y(n);
  t();
}
let Zt = !1;
function al(e) {
  var t = Zt;
  try {
    return Zt = !1, [e(), Zt];
  } finally {
    Zt = t;
  }
}
function ze(e, t, n, r) {
  var N;
  var s = !kt || (n & Fi) !== 0, i = (n & ji) !== 0, f = (
    /** @type {V} */
    r
  ), l = !0, o = () => (l && (l = !1, f = /** @type {V} */
  r), f), a;
  {
    var c = it in e || Ir in e;
    a = ((N = rt(e, t)) == null ? void 0 : N.set) ?? (c && t in e ? (T) => e[t] = T : void 0);
  }
  var h, v = !1;
  [h, v] = al(() => (
    /** @type {V} */
    e[t]
  )), h === void 0 && r !== void 0 && (h = o(), a && (s && rs(), a(h)));
  var p;
  if (s ? p = () => {
    var T = (
      /** @type {V} */
      e[t]
    );
    return T === void 0 ? o() : (l = !0, T);
  } : p = () => {
    var T = (
      /** @type {V} */
      e[t]
    );
    return T !== void 0 && (f = /** @type {V} */
    void 0), T === void 0 ? f : T;
  }, a) {
    var d = e.$$legacy;
    return (
      /** @type {() => V} */
      function(T, E) {
        return arguments.length > 0 ? ((!s || !E || d || v) && a(E ? p() : T), T) : p();
      }
    );
  }
  var _ = !1, g = /* @__PURE__ */ Zn(() => (_ = !1, p()));
  y(g);
  var A = (
    /** @type {Effect} */
    k
  );
  return (
    /** @type {() => V} */
    function(T, E) {
      if (arguments.length > 0) {
        const O = E ? y(g) : s && i ? ht(T) : T;
        return V(g, O), _ = !0, f !== void 0 && (f = O), T;
      }
      return Ke && _ || A.f & Oe ? g.v : y(g);
    }
  );
}
function ul(e) {
  return new cl(e);
}
var Ne, ie;
class cl {
  /**
   * @param {ComponentConstructorOptions & {
   *  component: any;
   * }} options
   */
  constructor(t) {
    /** @type {any} */
    $(this, Ne);
    /** @type {Record<string, any>} */
    $(this, ie);
    var i;
    var n = /* @__PURE__ */ new Map(), r = (f, l) => {
      var o = /* @__PURE__ */ Ve(l, !1, !1);
      return n.set(f, o), o;
    };
    const s = new Proxy(
      { ...t.props || {}, $$events: {} },
      {
        get(f, l) {
          return y(n.get(l) ?? r(l, Reflect.get(f, l)));
        },
        has(f, l) {
          return l === Ir ? !0 : (y(n.get(l) ?? r(l, Reflect.get(f, l))), Reflect.has(f, l));
        },
        set(f, l, o) {
          return V(n.get(l) ?? r(l, o), o), Reflect.set(f, l, o);
        }
      }
    );
    b(this, ie, (t.hydrate ? Ys : Ei)(t.component, {
      target: t.target,
      anchor: t.anchor,
      props: s,
      context: t.context,
      intro: t.intro ?? !1,
      recover: t.recover,
      transformError: t.transformError
    })), (!((i = t == null ? void 0 : t.props) != null && i.$$host) || t.sync === !1) && Ee(), b(this, Ne, s.$$events);
    for (const f of Object.keys(u(this, ie)))
      f === "$set" || f === "$destroy" || f === "$on" || sn(this, f, {
        get() {
          return u(this, ie)[f];
        },
        /** @param {any} value */
        set(l) {
          u(this, ie)[f] = l;
        },
        enumerable: !0
      });
    u(this, ie).$set = /** @param {Record<string, any>} next */
    (f) => {
      Object.assign(s, f);
    }, u(this, ie).$destroy = () => {
      Ks(u(this, ie));
    };
  }
  /** @param {Record<string, any>} props */
  $set(t) {
    u(this, ie).$set(t);
  }
  /**
   * @param {string} event
   * @param {(...args: any[]) => any} callback
   * @returns {any}
   */
  $on(t, n) {
    u(this, Ne)[t] = u(this, Ne)[t] || [];
    const r = (...s) => n.call(this, ...s);
    return u(this, Ne)[t].push(r), () => {
      u(this, Ne)[t] = u(this, Ne)[t].filter(
        /** @param {any} fn */
        (s) => s !== r
      );
    };
  }
  $destroy() {
    u(this, ie).$destroy();
  }
}
Ne = new WeakMap(), ie = new WeakMap();
let Ti;
typeof HTMLElement == "function" && (Ti = class extends HTMLElement {
  /**
   * @param {*} $$componentCtor
   * @param {*} $$slots
   * @param {ShadowRootInit | undefined} shadow_root_init
   */
  constructor(t, n, r) {
    super();
    /** The Svelte component constructor */
    D(this, "$$ctor");
    /** Slots */
    D(this, "$$s");
    /** @type {any} The Svelte component instance */
    D(this, "$$c");
    /** Whether or not the custom element is connected */
    D(this, "$$cn", !1);
    /** @type {Record<string, any>} Component props data */
    D(this, "$$d", {});
    /** `true` if currently in the process of reflecting component props back to attributes */
    D(this, "$$r", !1);
    /** @type {Record<string, CustomElementPropDefinition>} Props definition (name, reflected, type etc) */
    D(this, "$$p_d", {});
    /** @type {Record<string, EventListenerOrEventListenerObject[]>} Event listeners */
    D(this, "$$l", {});
    /** @type {Map<EventListenerOrEventListenerObject, Function>} Event listener unsubscribe functions */
    D(this, "$$l_u", /* @__PURE__ */ new Map());
    /** @type {any} The managed render effect for reflecting attributes */
    D(this, "$$me");
    /** @type {ShadowRoot | null} The ShadowRoot of the custom element */
    D(this, "$$shadowRoot", null);
    this.$$ctor = t, this.$$s = n, r && (this.$$shadowRoot = this.attachShadow(r));
  }
  /**
   * @param {string} type
   * @param {EventListenerOrEventListenerObject} listener
   * @param {boolean | AddEventListenerOptions} [options]
   */
  addEventListener(t, n, r) {
    if (this.$$l[t] = this.$$l[t] || [], this.$$l[t].push(n), this.$$c) {
      const s = this.$$c.$on(t, n);
      this.$$l_u.set(n, s);
    }
    super.addEventListener(t, n, r);
  }
  /**
   * @param {string} type
   * @param {EventListenerOrEventListenerObject} listener
   * @param {boolean | AddEventListenerOptions} [options]
   */
  removeEventListener(t, n, r) {
    if (super.removeEventListener(t, n, r), this.$$c) {
      const s = this.$$l_u.get(n);
      s && (s(), this.$$l_u.delete(n));
    }
  }
  async connectedCallback() {
    if (this.$$cn = !0, !this.$$c) {
      let n = function(i) {
        return (f) => {
          const l = er("slot");
          i !== "default" && (l.name = i), Pe(f, l);
        };
      };
      var t = n;
      if (await Promise.resolve(), !this.$$cn || this.$$c)
        return;
      const r = {}, s = dl(this);
      for (const i of this.$$s)
        i in s && (i === "default" && !this.$$d.children ? (this.$$d.children = n(i), r.default = !0) : r[i] = n(i));
      for (const i of this.attributes) {
        const f = this.$$g_p(i.name);
        f in this.$$d || (this.$$d[f] = nn(f, i.value, this.$$p_d, "toProp"));
      }
      for (const i in this.$$p_d)
        !(i in this.$$d) && this[i] !== void 0 && (this.$$d[i] = this[i], delete this[i]);
      this.$$c = ul({
        component: this.$$ctor,
        target: this.$$shadowRoot || this,
        props: {
          ...this.$$d,
          $$slots: r,
          $$host: this
        }
      }), this.$$me = Ns(() => {
        gn(() => {
          var i;
          this.$$r = !0;
          for (const f of rn(this.$$c)) {
            if (!((i = this.$$p_d[f]) != null && i.reflect)) continue;
            this.$$d[f] = this.$$c[f];
            const l = nn(
              f,
              this.$$d[f],
              this.$$p_d,
              "toAttribute"
            );
            l == null ? this.removeAttribute(this.$$p_d[f].attribute || f) : this.setAttribute(this.$$p_d[f].attribute || f, l);
          }
          this.$$r = !1;
        });
      });
      for (const i in this.$$l)
        for (const f of this.$$l[i]) {
          const l = this.$$c.$on(i, f);
          this.$$l_u.set(f, l);
        }
      this.$$l = {};
    }
  }
  // We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte
  // and setting attributes through setAttribute etc, this is helpful
  /**
   * @param {string} attr
   * @param {string} _oldValue
   * @param {string} newValue
   */
  attributeChangedCallback(t, n, r) {
    var s;
    this.$$r || (t = this.$$g_p(t), this.$$d[t] = nn(t, r, this.$$p_d, "toProp"), (s = this.$$c) == null || s.$set({ [t]: this.$$d[t] }));
  }
  disconnectedCallback() {
    this.$$cn = !1, Promise.resolve().then(() => {
      !this.$$cn && this.$$c && (this.$$c.$destroy(), this.$$me(), this.$$c = void 0);
    });
  }
  /**
   * @param {string} attribute_name
   */
  $$g_p(t) {
    return rn(this.$$p_d).find(
      (n) => this.$$p_d[n].attribute === t || !this.$$p_d[n].attribute && n.toLowerCase() === t
    ) || t;
  }
});
function nn(e, t, n, r) {
  var i;
  const s = (i = n[e]) == null ? void 0 : i.type;
  if (t = s === "Boolean" && typeof t != "boolean" ? t != null : t, !r || !n[e])
    return t;
  if (r === "toAttribute")
    switch (s) {
      case "Object":
      case "Array":
        return t == null ? null : JSON.stringify(t);
      case "Boolean":
        return t ? "" : null;
      case "Number":
        return t ?? null;
      default:
        return t;
    }
  else
    switch (s) {
      case "Object":
      case "Array":
        return t && JSON.parse(t);
      case "Boolean":
        return t;
      case "Number":
        return t != null ? +t : t;
      default:
        return t;
    }
}
function dl(e) {
  const t = {};
  return e.childNodes.forEach((n) => {
    t[
      /** @type {Element} node */
      n.slot || "default"
    ] = !0;
  }), t;
}
function or(e, t, n, r, s, i) {
  let f = class extends Ti {
    constructor() {
      super(e, n, s), this.$$p_d = t;
    }
    static get observedAttributes() {
      return rn(t).map(
        (l) => (t[l].attribute || l).toLowerCase()
      );
    }
  };
  return rn(t).forEach((l) => {
    sn(f.prototype, l, {
      get() {
        return this.$$c && l in this.$$c ? this.$$c[l] : this.$$d[l];
      },
      set(o) {
        var h;
        o = nn(l, o, t), this.$$d[l] = o;
        var a = this.$$c;
        if (a) {
          var c = (h = rt(a, l)) == null ? void 0 : h.get;
          c ? a[l] = o : a.$set({ [l]: o });
        }
      }
    });
  }), r.forEach((l) => {
    sn(f.prototype, l, {
      get() {
        var o;
        return (o = this.$$c) == null ? void 0 : o[l];
      }
    });
  }), e.element = /** @type {any} */
  f, f;
}
var hl = /* @__PURE__ */ At('<div class="overlay svelte-128flmn" role="presentation"><div class="panel svelte-128flmn" role="dialog" aria-modal="true" tabindex="-1"><header class="header svelte-128flmn"><h3 class="svelte-128flmn"> </h3> <button type="button" class="close svelte-128flmn" aria-label="Close">×</button></header> <section class="body svelte-128flmn"><!></section></div></div>');
const vl = {
  hash: "svelte-128flmn",
  code: ":host {display:block;}.overlay.svelte-128flmn {position:fixed;inset:0;background:var(--ui-overlay);display:none;place-items:center;z-index:1000;}:host([open]) .overlay.svelte-128flmn {display:grid;}.panel.svelte-128flmn {width:min(640px, calc(100vw - 32px));max-height:calc(100vh - 48px);overflow:auto;background:var(--ui-panel);border-radius:var(--ui-radius);box-shadow:var(--ui-shadow);outline:none;}.header.svelte-128flmn {display:flex;align-items:center;justify-content:space-between;padding:14px 16px;border-bottom:1px solid var(--ui-border);}h3.svelte-128flmn {margin:0;font-size:1rem;}.close.svelte-128flmn {border:0;background:transparent;font-size:1.4rem;cursor:pointer;}.body.svelte-128flmn {padding:12px 16px 16px;}"
};
function _l(e, t) {
  hn(t, !1), lr(e, vl);
  let n = ze(t, "title", 12, ""), r = /* @__PURE__ */ Ve(), s = /* @__PURE__ */ Ve(), i;
  function f() {
    return !!(i != null && i.hasAttribute("open"));
  }
  function l() {
    i == null || i.removeAttribute("open"), i == null || i.dispatchEvent(new CustomEvent("ui:close", { bubbles: !0, composed: !0 }));
  }
  function o(E) {
    if (f()) {
      if (E.key === "Escape") {
        E.preventDefault(), l();
        return;
      }
      E.key === "Tab" && a(E);
    }
  }
  function a(E) {
    var G, ct;
    const O = (G = y(s)) == null ? void 0 : G.querySelectorAll('a[href], button:not([disabled]), textarea, input, select, [tabindex]:not([tabindex="-1"])');
    if (!O || O.length === 0) {
      E.preventDefault(), (ct = y(s)) == null || ct.focus();
      return;
    }
    const m = O[0], M = O[O.length - 1], j = document.activeElement;
    if (E.shiftKey && j === m) {
      E.preventDefault(), M.focus();
      return;
    }
    !E.shiftKey && j === M && (E.preventDefault(), m.focus());
  }
  function c(E) {
    E.target === E.currentTarget && l();
  }
  Si(() => {
    i = y(r).getRootNode().host;
    const E = new MutationObserver(() => {
      f() && setTimeout(
        () => {
          var m, M;
          (M = ((m = y(s)) == null ? void 0 : m.querySelector("[autofocus]")) || y(s)) == null || M.focus();
        },
        0
      );
    });
    return E.observe(i, { attributes: !0, attributeFilter: ["open"] }), f() && setTimeout(
      () => {
        var O;
        (O = y(s)) == null || O.focus();
      },
      0
    ), () => E.disconnect();
  });
  var h = {
    get title() {
      return n();
    },
    set title(E) {
      n(E), Ee();
    }
  };
  fr();
  var v = hl(), p = he(v), d = he(p), _ = he(d), g = he(_, !0);
  de(_);
  var A = Pn(_, 2);
  de(d);
  var N = Pn(d, 2), T = he(N);
  return tl(T, t, "default", {}), de(N), de(p), Un(p, (E) => V(s, E), () => y(s)), de(v), Un(v, (E) => V(r, E), () => y(r)), jn(() => Hn(g, n())), ft("click", A, l), ft("click", v, c), ft("keydown", v, o), Pe(e, v), vn(h);
}
customElements.define("ui-modal", or(_l, { title: {} }, ["default"], [], { mode: "open" }));
var pl = /* @__PURE__ */ At('<div class="empty svelte-j52qxt">No options</div>'), gl = /* @__PURE__ */ At('<button type="button" class="item svelte-j52qxt"> </button>'), ml = /* @__PURE__ */ At('<div class="menu svelte-j52qxt" role="listbox"><!></div>'), bl = /* @__PURE__ */ At('<div class="dropdown svelte-j52qxt"><button type="button" class="trigger svelte-j52qxt"><span> </span> <span aria-hidden="true">▾</span></button> <!></div>');
const wl = {
  hash: "svelte-j52qxt",
  code: ".dropdown.svelte-j52qxt {position:relative;display:inline-block;min-width:180px;}.trigger.svelte-j52qxt {width:100%;display:flex;align-items:center;justify-content:space-between;padding:10px 12px;border:1px solid var(--ui-border);border-radius:8px;background:var(--ui-bg);cursor:pointer;}.menu.svelte-j52qxt {position:absolute;z-index:30;left:0;right:0;margin-top:6px;border:1px solid var(--ui-border);background:var(--ui-bg);border-radius:8px;box-shadow:var(--ui-shadow);overflow:hidden;}.item.svelte-j52qxt {width:100%;text-align:left;border:0;background:transparent;padding:10px 12px;cursor:pointer;}.item.svelte-j52qxt:hover {background:#f3f4f6;}.empty.svelte-j52qxt {padding:10px 12px;color:var(--ui-muted);}"
};
function yl(e, t) {
  hn(t, !1), lr(e, wl);
  let n = ze(t, "value", 12, ""), r = ze(t, "name", 12, ""), s = ze(t, "placeholder", 12, "Select..."), i = ze(t, "disabled", 12, !1), f = /* @__PURE__ */ Ve(), l, o, a = /* @__PURE__ */ Ve(!1), c = /* @__PURE__ */ Ve([]);
  function h() {
    if (V(c, Array.from(l.querySelectorAll("option")).map((m) => {
      var M;
      return {
        value: m.value,
        label: ((M = m.textContent) == null ? void 0 : M.trim()) || m.value
      };
    })), !n()) {
      const m = l.querySelector("option[selected]");
      m && n(m.value);
    }
  }
  function v() {
    var m;
    return n() && ((m = y(c).find((M) => M.value === n())) == null ? void 0 : m.label) || s();
  }
  function p(m) {
    n(m), V(a, !1), d(), l.dispatchEvent(new Event("change", { bubbles: !0 })), l.dispatchEvent(new CustomEvent("ui:change", { detail: { value: n() }, bubbles: !0, composed: !0 }));
  }
  function d() {
    o && (o.name = r(), o.value = n(), o.disabled = i() || !r());
  }
  Si(() => {
    if (l = y(f).getRootNode().host, !l) return;
    o = l.querySelector('input[data-ui-dropdown-hidden="true"]'), o || (o = document.createElement("input"), o.type = "hidden", o.setAttribute("data-ui-dropdown-hidden", "true"), l.appendChild(o)), h(), d();
    const m = new MutationObserver(() => {
      h(), d();
    });
    return m.observe(l, { childList: !0, subtree: !0, attributes: !0 }), () => m.disconnect();
  });
  var _ = {
    get value() {
      return n();
    },
    set value(m) {
      n(m), Ee();
    },
    get name() {
      return r();
    },
    set name(m) {
      r(m), Ee();
    },
    get placeholder() {
      return s();
    },
    set placeholder(m) {
      s(m), Ee();
    },
    get disabled() {
      return i();
    },
    set disabled(m) {
      i(m), Ee();
    }
  };
  fr();
  var g = bl(), A = he(g), N = he(A), T = he(N, !0);
  de(N), Gn(2), de(A);
  var E = Pn(A, 2);
  {
    var O = (m) => {
      var M = ml(), j = he(M);
      {
        var G = (dt) => {
          var Kt = pl();
          Pe(dt, Kt);
        }, ct = (dt) => {
          var Kt = Bs(), ki = Ss(Kt);
          Zs(ki, 1, () => y(c), Js, (Ai, mn) => {
            var Wt = gl(), Ni = he(Wt, !0);
            de(Wt), jn(() => Hn(Ni, (y(mn), Ue(() => y(mn).label)))), ft("click", Wt, () => p(y(mn).value)), Pe(Ai, Wt);
          }), Pe(dt, Kt);
        };
        yr(j, (dt) => {
          y(c), Ue(() => y(c).length === 0) ? dt(G) : dt(ct, !1);
        });
      }
      de(M), Pe(m, M);
    };
    yr(E, (m) => {
      y(a) && m(O);
    });
  }
  return de(g), Un(g, (m) => V(f, m), () => y(f)), jn(
    (m) => {
      A.disabled = i(), Hn(T, m);
    },
    [() => Ue(v)]
  ), ft("click", A, () => V(a, !y(a))), Pe(e, g), vn(_);
}
customElements.define("ui-drop-down", or(yl, { value: {}, name: {}, placeholder: {}, disabled: {} }, [], [], { mode: "open" }));
var $l = /* @__PURE__ */ At('<form class="toolbar svelte-12g6igs"><input type="search" placeholder="Search..." class="svelte-12g6igs"/> <button type="submit" class="svelte-12g6igs">Search</button></form>');
const El = {
  hash: "svelte-12g6igs",
  code: ".toolbar.svelte-12g6igs {display:flex;gap:8px;align-items:center;margin-bottom:12px;}input[type='search'].svelte-12g6igs {flex:1;min-width:180px;padding:10px;border:1px solid var(--ui-border);border-radius:8px;}button.svelte-12g6igs {border:0;border-radius:8px;background:var(--ui-primary);color:var(--ui-primary-contrast);padding:10px 12px;cursor:pointer;}"
};
function xl(e, t) {
  hn(t, !1), lr(e, El);
  let n = ze(t, "endpoint", 12, ""), r = ze(t, "target", 12, ""), s = ze(t, "pageSize", 12, 10), i = /* @__PURE__ */ Ve("");
  function f(c = 1) {
    if (!n() || !r()) return;
    const h = new URLSearchParams();
    y(i).trim() && h.set("q", y(i).trim()), h.set("page", String(c)), h.set("pageSize", String(s()));
    const v = `${n()}${n().includes("?") ? "&" : "?"}${h.toString()}`, p = window.htmx;
    if (p && typeof p.ajax == "function") {
      p.ajax("GET", v, { target: r() });
      return;
    }
    const d = document.querySelector(r());
    d && fetch(v).then((_) => _.text()).then((_) => {
      d.innerHTML = _;
    }).catch(() => {
    });
  }
  var l = {
    get endpoint() {
      return n();
    },
    set endpoint(c) {
      n(c), Ee();
    },
    get target() {
      return r();
    },
    set target(c) {
      r(c), Ee();
    },
    get pageSize() {
      return s();
    },
    set pageSize(c) {
      s(c), Ee();
    }
  };
  fr();
  var o = $l(), a = he(o);
  return sl(a), Gn(2), de(o), fl(a, () => y(i), (c) => V(i, c)), ft("keydown", a, (c) => c.key === "Enter" && f(1)), ft("submit", o, ol(() => f(1))), Pe(e, o), vn(l);
}
customElements.define("ui-data-table-shell", or(xl, { endpoint: {}, target: {}, pageSize: {} }, [], [], { mode: "open" }));
