import { a6 as gt, I as O, g as we, a7 as bt, D as I, a8 as Se, q as U, a9 as A, h as y, aa as R, ab as Ne, b as ye, a as K, H as wt, ac as Oe, ad as L, ae as B, af as te, k as D, ag as Ye, ah as yt, ai as Y, aj as re, ak as Ie, B as mt, al as Tt, am as Ve, an as me, f as At, ao as M, s as F, C as qe, d as Te, ap as Z, aq as Ae, ar as Et, as as St, at as Nt, au as Ge, av as Ot, aw as We, ax as ze, ay as oe, az as It, aA as Lt, aB as Rt, aC as Ct, aD as Pt, aE as Mt, aF as ue, aG as Ke, aH as Xe, aI as Dt, aJ as le, e as P, aK as kt, aL as $t, aM as Ht, aN as xt, v as Ze, aO as Bt, aP as Ft, t as Je, aQ as Le, aR as Re, aS as jt, aT as Qe, aU as Ee, aV as et, aW as Ce, aX as Pe, aY as Ut, aZ as Yt, a_ as Vt, a$ as qt, b0 as Gt, b1 as Wt, b2 as zt, b3 as Kt, b4 as se, b5 as Xt, b6 as Zt, b7 as Jt, b8 as Qt, b9 as er, U as tr, ba as rr, bb as Me, bc as De, bd as sr, w as C, be as ce, bf as ir, bg as ar, bh as nr, G as tt, bi as fr, Y as or, bj as ke, bk as rt, bl as ur, bm as lr, bn as st, bo as cr, bp as dr, bq as hr, br as vr, bs as _r, bt as pr, n as de, m as gr, bu as br, x as H, y as x, A as ie, z as J } from "./index-BxjwuJ6T.js";
function wr(e) {
  let t = 0, r = we(0), s;
  return () => {
    gt() && (O(r), bt(() => (t === 0 && (s = I(() => e(() => Se(r)))), t += 1, () => {
      U(() => {
        t -= 1, t === 0 && (s?.(), s = void 0, Se(r));
      });
    })));
  };
}
var yr = Ae | Et;
function mr(e, t, r, s) {
  new Tr(e, t, r, s);
}
class Tr {
  /** @type {Boundary | null} */
  parent;
  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}
   */
  transform_error;
  /** @type {TemplateNode} */
  #e;
  /** @type {TemplateNode | null} */
  #t = y ? A : null;
  /** @type {BoundaryProps} */
  #r;
  /** @type {((anchor: Node) => void)} */
  #f;
  /** @type {Effect} */
  #s;
  /** @type {Effect | null} */
  #a = null;
  /** @type {Effect | null} */
  #i = null;
  /** @type {Effect | null} */
  #n = null;
  /** @type {DocumentFragment | null} */
  #o = null;
  #c = 0;
  #l = 0;
  #d = !1;
  /** @type {Set<Effect>} */
  #_ = /* @__PURE__ */ new Set();
  /** @type {Set<Effect>} */
  #p = /* @__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}
   */
  #u = null;
  #y = wr(() => (this.#u = we(this.#c), () => {
    this.#u = null;
  }));
  /**
   * @param {TemplateNode} node
   * @param {BoundaryProps} props
   * @param {((anchor: Node) => void)} children
   * @param {((error: unknown) => unknown) | undefined} [transform_error]
   */
  constructor(t, r, s, a) {
    this.#e = t, this.#r = r, this.#f = (i) => {
      var n = (
        /** @type {Effect} */
        R
      );
      n.b = this, n.f |= Ne, s(i);
    }, this.parent = /** @type {Effect} */
    R.b, this.transform_error = a ?? this.parent?.transform_error ?? ((i) => i), this.#s = ye(() => {
      if (y) {
        const i = (
          /** @type {Comment} */
          this.#t
        );
        K();
        const n = i.data === wt;
        if (i.data.startsWith(Oe)) {
          const o = JSON.parse(i.data.slice(Oe.length));
          this.#T(o);
        } else n ? this.#A() : this.#m();
      } else
        this.#g();
    }, yr), y && (this.#e = A);
  }
  #m() {
    try {
      this.#a = L(() => this.#f(this.#e));
    } catch (t) {
      this.error(t);
    }
  }
  /**
   * @param {unknown} error The deserialized error from the server's hydration comment
   */
  #T(t) {
    const r = this.#r.failed;
    r && (this.#n = L(() => {
      r(
        this.#e,
        () => t,
        () => () => {
        }
      );
    }));
  }
  #A() {
    const t = this.#r.pending;
    t && (this.is_pending = !0, this.#i = L(() => t(this.#e)), U(() => {
      var r = this.#o = document.createDocumentFragment(), s = B();
      r.append(s), this.#a = this.#v(() => L(() => this.#f(s))), this.#l === 0 && (this.#e.before(r), this.#o = null, te(
        /** @type {Effect} */
        this.#i,
        () => {
          this.#i = null;
        }
      ), this.#h(
        /** @type {Batch} */
        D
      ));
    }));
  }
  #g() {
    try {
      if (this.is_pending = this.has_pending_snippet(), this.#l = 0, this.#c = 0, this.#a = L(() => {
        this.#f(this.#e);
      }), this.#l > 0) {
        var t = this.#o = document.createDocumentFragment();
        Ye(this.#a, t);
        const r = (
          /** @type {(anchor: Node) => void} */
          this.#r.pending
        );
        this.#i = L(() => r(this.#e));
      } else
        this.#h(
          /** @type {Batch} */
          D
        );
    } catch (r) {
      this.error(r);
    }
  }
  /**
   * @param {Batch} batch
   */
  #h(t) {
    this.is_pending = !1, t.transfer_effects(this.#_, this.#p);
  }
  /**
   * Defer an effect inside a pending boundary until the boundary resolves
   * @param {Effect} effect
   */
  defer_effect(t) {
    yt(t, this.#_, this.#p);
  }
  /**
   * 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 !!this.#r.pending;
  }
  /**
   * @template T
   * @param {() => T} fn
   */
  #v(t) {
    var r = R, s = Ve, a = me;
    Y(this.#s), re(this.#s), Ie(this.#s.ctx);
    try {
      return mt.ensure(), t();
    } catch (i) {
      return Tt(i), null;
    } finally {
      Y(r), re(s), Ie(a);
    }
  }
  /**
   * 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
   * @param {Batch} batch
   */
  #b(t, r) {
    if (!this.has_pending_snippet()) {
      this.parent && this.parent.#b(t, r);
      return;
    }
    this.#l += t, this.#l === 0 && (this.#h(r), this.#i && te(this.#i, () => {
      this.#i = null;
    }), this.#o && (this.#e.before(this.#o), this.#o = null));
  }
  /**
   * 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
   * @param {Batch} batch
   */
  update_pending_count(t, r) {
    this.#b(t, r), this.#c += t, !(!this.#u || this.#d) && (this.#d = !0, U(() => {
      this.#d = !1, this.#u && At(this.#u, this.#c);
    }));
  }
  get_effect_pending() {
    return this.#y(), O(
      /** @type {Source<number>} */
      this.#u
    );
  }
  /** @param {unknown} error */
  error(t) {
    if (!this.#r.onerror && !this.#r.failed)
      throw t;
    D?.is_fork ? (this.#a && D.skip_effect(this.#a), this.#i && D.skip_effect(this.#i), this.#n && D.skip_effect(this.#n), D.on_fork_commit(() => {
      this.#w(t);
    })) : this.#w(t);
  }
  /**
   * @param {unknown} error
   */
  #w(t) {
    this.#a && (M(this.#a), this.#a = null), this.#i && (M(this.#i), this.#i = null), this.#n && (M(this.#n), this.#n = null), y && (F(
      /** @type {TemplateNode} */
      this.#t
    ), qe(), F(Te()));
    var r = this.#r.onerror;
    let s = this.#r.failed;
    var a = !1, i = !1;
    const n = () => {
      if (a) {
        Nt();
        return;
      }
      a = !0, i && St(), this.#n !== null && te(this.#n, () => {
        this.#n = null;
      }), this.#v(() => {
        this.#g();
      });
    }, f = (o) => {
      try {
        i = !0, r?.(o, n), i = !1;
      } catch (u) {
        Z(u, this.#s && this.#s.parent);
      }
      s && (this.#n = this.#v(() => {
        try {
          return L(() => {
            var u = (
              /** @type {Effect} */
              R
            );
            u.b = this, u.f |= Ne, s(
              this.#e,
              () => o,
              () => n
            );
          });
        } catch (u) {
          return Z(
            u,
            /** @type {Effect} */
            this.#s.parent
          ), null;
        }
      }));
    };
    U(() => {
      var o;
      try {
        o = this.transform_error(t);
      } catch (u) {
        Z(u, this.#s && this.#s.parent);
        return;
      }
      o !== null && typeof o == "object" && typeof /** @type {any} */
      o.then == "function" ? o.then(
        f,
        /** @param {unknown} e */
        (u) => Z(u, this.#s && this.#s.parent)
      ) : f(o);
    });
  }
}
function Ar(e) {
  return e.endsWith("capture") && e !== "gotpointercapture" && e !== "lostpointercapture";
}
const Er = [
  "beforeinput",
  "click",
  "change",
  "dblclick",
  "contextmenu",
  "focusin",
  "focusout",
  "input",
  "keydown",
  "keyup",
  "mousedown",
  "mousemove",
  "mouseout",
  "mouseover",
  "mouseup",
  "pointerdown",
  "pointermove",
  "pointerout",
  "pointerover",
  "pointerup",
  "touchend",
  "touchmove",
  "touchstart"
];
function Sr(e) {
  return Er.includes(e);
}
const Nr = {
  // no `class: 'className'` because we handle that separately
  formnovalidate: "formNoValidate",
  ismap: "isMap",
  nomodule: "noModule",
  playsinline: "playsInline",
  readonly: "readOnly",
  defaultvalue: "defaultValue",
  defaultchecked: "defaultChecked",
  srcobject: "srcObject",
  novalidate: "noValidate",
  allowfullscreen: "allowFullscreen",
  disablepictureinpicture: "disablePictureInPicture",
  disableremoteplayback: "disableRemotePlayback"
};
function Or(e) {
  return e = e.toLowerCase(), Nr[e] ?? e;
}
const Ir = ["touchstart", "touchmove"];
function Lr(e) {
  return Ir.includes(e);
}
const W = /* @__PURE__ */ Symbol("events"), it = /* @__PURE__ */ new Set(), he = /* @__PURE__ */ new Set();
function at(e, t, r, s = {}) {
  function a(i) {
    if (s.capture || _e.call(t, i), !i.cancelBubble)
      return Ot(() => r?.call(this, i));
  }
  return e.startsWith("pointer") || e.startsWith("touch") || e === "wheel" ? U(() => {
    t.addEventListener(e, a, s);
  }) : t.addEventListener(e, a, s), a;
}
function ls(e, t, r, s, a) {
  var i = { capture: s, passive: a }, n = at(e, t, r, 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) && Ge(() => {
    t.removeEventListener(e, n, i);
  });
}
function ve(e, t, r) {
  (t[W] ??= {})[e] = r;
}
function nt(e) {
  for (var t = 0; t < e.length; t++)
    it.add(e[t]);
  for (var r of he)
    r(e);
}
let $e = null;
function _e(e) {
  var t = this, r = (
    /** @type {Node} */
    t.ownerDocument
  ), s = e.type, a = e.composedPath?.() || [], i = (
    /** @type {null | Element} */
    a[0] || e.target
  );
  $e = e;
  var n = 0, f = $e === e && e[W];
  if (f) {
    var o = a.indexOf(f);
    if (o !== -1 && (t === document || t === /** @type {any} */
    window)) {
      e[W] = t;
      return;
    }
    var u = a.indexOf(t);
    if (u === -1)
      return;
    o <= u && (n = o);
  }
  if (i = /** @type {Element} */
  a[n] || e.target, i !== t) {
    We(e, "currentTarget", {
      configurable: !0,
      get() {
        return i || r;
      }
    });
    var d = Ve, v = R;
    re(null), Y(null);
    try {
      for (var c, _ = []; i !== null && i !== t; ) {
        try {
          var p = i[W]?.[s];
          p != 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) && p.call(i, e);
        } catch (h) {
          c ? _.push(h) : c = h;
        }
        if (e.cancelBubble) break;
        n++, i = n < a.length ? (
          /** @type {Element} */
          a[n]
        ) : null;
      }
      if (c) {
        for (let h of _)
          queueMicrotask(() => {
            throw h;
          });
        throw c;
      }
    } finally {
      e[W] = t, delete e.currentTarget, re(d), Y(v);
    }
  }
}
const Rr = (
  // We gotta write it like this because after downleveling the pure comment may end up in the wrong location
  globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", {
    /** @param {string} html */
    createHTML: (e) => e
  })
);
function Cr(e) {
  return (
    /** @type {string} */
    Rr?.createHTML(e) ?? e
  );
}
function Pr(e) {
  var t = ze("template");
  return t.innerHTML = Cr(e.replaceAll("<!>", "<!---->")), t.content;
}
function k(e, t) {
  var r = (
    /** @type {Effect} */
    R
  );
  r.nodes === null && (r.nodes = { start: e, end: t, a: null, t: null });
}
// @__NO_SIDE_EFFECTS__
function X(e, t) {
  var r = (t & Mt) !== 0, s = (t & Lt) !== 0, a, i = !e.startsWith("<!>");
  return () => {
    if (y)
      return k(A, null), A;
    a === void 0 && (a = Pr(i ? e : "<!>" + e), r || (a = /** @type {TemplateNode} */
    oe(a)));
    var n = (
      /** @type {TemplateNode} */
      s || It ? document.importNode(a, !0) : a.cloneNode(!0)
    );
    if (r) {
      var f = (
        /** @type {TemplateNode} */
        oe(n)
      ), o = (
        /** @type {TemplateNode} */
        n.lastChild
      );
      k(f, o);
    } else
      k(n, n);
    return n;
  };
}
function cs(e = "") {
  if (!y) {
    var t = B(e + "");
    return k(t, t), t;
  }
  var r = A;
  return r.nodeType !== Rt ? (r.before(r = B()), F(r)) : Ct(
    /** @type {Text} */
    r
  ), k(r, r), r;
}
function ds() {
  if (y)
    return k(A, null), A;
  var e = document.createDocumentFragment(), t = document.createComment(""), r = B();
  return e.append(t, r), k(t, r), e;
}
function V(e, t) {
  if (y) {
    var r = (
      /** @type {Effect & { nodes: EffectNodes }} */
      R
    );
    ((r.f & Pt) === 0 || r.nodes.end === null) && (r.nodes.end = A), K();
    return;
  }
  e !== null && e.before(
    /** @type {Node} */
    t
  );
}
function ae(e, t) {
  var r = t == null ? "" : typeof t == "object" ? `${t}` : t;
  r !== /** @type {any} */
  (e[Le] ??= e.nodeValue) && (e[Le] = r, e.nodeValue = `${r}`);
}
function ft(e, t) {
  return ot(e, t);
}
function Mr(e, t) {
  ue(), t.intro = t.intro ?? !1;
  const r = t.target, s = y, a = A;
  try {
    for (var i = oe(r); i && (i.nodeType !== Ke || /** @type {Comment} */
    i.data !== Xe); )
      i = Dt(i);
    if (!i)
      throw le;
    P(!0), F(
      /** @type {Comment} */
      i
    );
    const n = ot(e, { ...t, anchor: i });
    return P(!1), /**  @type {Exports} */
    n;
  } catch (n) {
    if (n instanceof Error && n.message.split(`
`).some((f) => f.startsWith("https://svelte.dev/e/")))
      throw n;
    return n !== le && console.warn("Failed to hydrate: ", n), t.recover === !1 && kt(), ue(), $t(r), P(!1), ft(e, t);
  } finally {
    P(s), F(a);
  }
}
const Q = /* @__PURE__ */ new Map();
function ot(e, { target: t, anchor: r, props: s = {}, events: a, context: i, intro: n = !0, transformError: f }) {
  ue();
  var o = void 0, u = Ht(() => {
    var d = r ?? t.appendChild(B());
    mr(
      /** @type {TemplateNode} */
      d,
      {
        pending: () => {
        }
      },
      (_) => {
        Ze({});
        var p = (
          /** @type {ComponentContext} */
          me
        );
        if (i && (p.c = i), a && (s.$$events = a), y && k(
          /** @type {TemplateNode} */
          _,
          null
        ), o = e(_, s) || {}, y && (R.nodes.end = A, A === null || A.nodeType !== Ke || /** @type {Comment} */
        A.data !== Bt))
          throw Ft(), le;
        Je();
      },
      f
    );
    var v = /* @__PURE__ */ new Set(), c = (_) => {
      for (var p = 0; p < _.length; p++) {
        var h = _[p];
        if (!v.has(h)) {
          v.add(h);
          var E = Lr(h);
          for (const T of [t, document]) {
            var l = Q.get(T);
            l === void 0 && (l = /* @__PURE__ */ new Map(), Q.set(T, l));
            var b = l.get(h);
            b === void 0 ? (T.addEventListener(h, _e, { passive: E }), l.set(h, 1)) : l.set(h, b + 1);
          }
        }
      }
    };
    return c(xt(it)), he.add(c), () => {
      for (var _ of v)
        for (const E of [t, document]) {
          var p = (
            /** @type {Map<string, number>} */
            Q.get(E)
          ), h = (
            /** @type {number} */
            p.get(_)
          );
          --h == 0 ? (E.removeEventListener(_, _e), p.delete(_), p.size === 0 && Q.delete(E)) : p.set(_, h);
        }
      he.delete(c), d !== r && d.parentNode?.removeChild(d);
    };
  });
  return pe.set(o, u), o;
}
let pe = /* @__PURE__ */ new WeakMap();
function Dr(e, t) {
  const r = pe.get(e);
  return r ? (pe.delete(e), r(t)) : Promise.resolve();
}
class ut {
  /** @type {TemplateNode} */
  anchor;
  /** @type {Map<Batch, Key>} */
  #e = /* @__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>}
   */
  #t = /* @__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>}
   */
  #r = /* @__PURE__ */ new Map();
  /**
   * Keys of effects that are currently outroing
   * @type {Set<Key>}
   */
  #f = /* @__PURE__ */ new Set();
  /**
   * Whether to pause (i.e. outro) on change, or destroy immediately.
   * This is necessary for `<svelte:element>`
   */
  #s = !0;
  /**
   * @param {TemplateNode} anchor
   * @param {boolean} transition
   */
  constructor(t, r = !0) {
    this.anchor = t, this.#s = r;
  }
  /**
   * @param {Batch} batch
   */
  #a = (t) => {
    if (this.#e.has(t)) {
      var r = (
        /** @type {Key} */
        this.#e.get(t)
      ), s = this.#t.get(r);
      if (s)
        Re(s), this.#f.delete(r);
      else {
        var a = this.#r.get(r);
        a && (Re(a.effect), this.#t.set(r, a.effect), this.#r.delete(r), a.fragment.lastChild.remove(), this.anchor.before(a.fragment), s = a.effect);
      }
      for (const [i, n] of this.#e) {
        if (this.#e.delete(i), i === t)
          break;
        const f = this.#r.get(n);
        f && (M(f.effect), this.#r.delete(n));
      }
      for (const [i, n] of this.#t) {
        if (i === r || this.#f.has(i)) continue;
        const f = () => {
          if (Array.from(this.#e.values()).includes(i)) {
            var u = document.createDocumentFragment();
            Ye(n, u), u.append(B()), this.#r.set(i, { effect: n, fragment: u });
          } else
            M(n);
          this.#f.delete(i), this.#t.delete(i);
        };
        this.#s || !s ? (this.#f.add(i), te(n, f, !1)) : f();
      }
    }
  };
  /**
   * @param {Batch} batch
   */
  #i = (t) => {
    this.#e.delete(t);
    const r = Array.from(this.#e.values());
    for (const [s, a] of this.#r)
      r.includes(s) || (M(a.effect), this.#r.delete(s));
  };
  /**
   *
   * @param {any} key
   * @param {null | ((target: TemplateNode) => void)} fn
   */
  ensure(t, r) {
    var s = (
      /** @type {Batch} */
      D
    ), a = jt();
    if (r && !this.#t.has(t) && !this.#r.has(t))
      if (a) {
        var i = document.createDocumentFragment(), n = B();
        i.append(n), this.#r.set(t, {
          effect: L(() => r(n)),
          fragment: i
        });
      } else
        this.#t.set(
          t,
          L(() => r(this.anchor))
        );
    if (this.#e.set(s, t), a) {
      for (const [f, o] of this.#t)
        f === t ? s.unskip_effect(o) : s.skip_effect(o);
      for (const [f, o] of this.#r)
        f === t ? s.unskip_effect(o.effect) : s.skip_effect(o.effect);
      s.oncommit(this.#a), s.ondiscard(this.#i);
    } else
      y && (this.anchor = A), this.#a(s);
  }
}
function ee(e, t, r = !1) {
  var s;
  y && (s = A, K());
  var a = new ut(e), i = r ? Ae : 0;
  function n(f, o) {
    if (y) {
      var u = Qe(
        /** @type {TemplateNode} */
        s
      );
      if (f !== parseInt(u.substring(1))) {
        var d = Te();
        F(d), a.anchor = d, P(!1), a.ensure(f, o), P(!0);
        return;
      }
    }
    a.ensure(f, o);
  }
  ye(() => {
    var f = !1;
    t((o, u = 0) => {
      f = !0, n(u, o);
    }), f || n(-1, null);
  }, i);
}
function hs(e, t, r, s, a) {
  y && K();
  var i = t.$$slots?.[r], n = !1;
  i === !0 && (i = t[r === "default" ? "children" : r], n = !0), i === void 0 || i(e, n ? () => s : s);
}
function vs(e, t, r) {
  var s;
  y && (s = A, K());
  var a = new ut(e);
  ye(() => {
    var i = t() ?? null;
    if (y) {
      var n = Qe(
        /** @type {TemplateNode} */
        s
      ), f = n === Xe, o = i !== null;
      if (f !== o) {
        var u = Te();
        F(u), a.anchor = u, P(!1), a.ensure(i, i && ((d) => r(d, i))), P(!0);
        return;
      }
    }
    a.ensure(i, i && ((d) => r(d, i)));
  }, Ae);
}
function _s(e, t) {
  Ee(() => {
    var r = e.getRootNode(), s = (
      /** @type {ShadowRoot} */
      r.host ? (
        /** @type {ShadowRoot} */
        r
      ) : (
        /** @type {Document} */
        r.head ?? /** @type {Document} */
        r.ownerDocument.head
      )
    );
    if (!s.querySelector("#" + t.hash)) {
      const a = ze("style");
      a.id = t.hash, a.textContent = t.code, s.appendChild(a);
    }
  });
}
function kr(e, t) {
  var r = void 0, s;
  et(() => {
    r !== (r = t()) && (s && (M(s), s = null), r && (s = L(() => {
      Ee(() => (
        /** @type {(node: Element) => void} */
        r(e)
      ));
    })));
  });
}
function lt(e) {
  var t, r, s = "";
  if (typeof e == "string" || typeof e == "number") s += e;
  else if (typeof e == "object") if (Array.isArray(e)) {
    var a = e.length;
    for (t = 0; t < a; t++) e[t] && (r = lt(e[t])) && (s && (s += " "), s += r);
  } else for (r in e) e[r] && (s && (s += " "), s += r);
  return s;
}
function $r() {
  for (var e, t, r = 0, s = "", a = arguments.length; r < a; r++) (e = arguments[r]) && (t = lt(e)) && (s && (s += " "), s += t);
  return s;
}
function Hr(e) {
  return typeof e == "object" ? $r(e) : e ?? "";
}
const He = [...` 	
\r\f \v\uFEFF`];
function xr(e, t, r) {
  var s = e == null ? "" : "" + e;
  if (t && (s = s ? s + " " + t : t), r) {
    for (var a of Object.keys(r))
      if (r[a])
        s = s ? s + " " + a : a;
      else if (s.length)
        for (var i = a.length, n = 0; (n = s.indexOf(a, n)) >= 0; ) {
          var f = n + i;
          (n === 0 || He.includes(s[n - 1])) && (f === s.length || He.includes(s[f])) ? s = (n === 0 ? "" : s.substring(0, n)) + s.substring(f + 1) : n = f;
        }
  }
  return s === "" ? null : s;
}
function xe(e, t = !1) {
  var r = t ? " !important;" : ";", s = "";
  for (var a of Object.keys(e)) {
    var i = e[a];
    i != null && i !== "" && (s += " " + a + ": " + i + r);
  }
  return s;
}
function ne(e) {
  return e[0] !== "-" || e[1] !== "-" ? e.toLowerCase() : e;
}
function Br(e, t) {
  if (t) {
    var r = "", s, a;
    if (Array.isArray(t) ? (s = t[0], a = t[1]) : s = t, e) {
      e = String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g, "").trim();
      var i = !1, n = 0, f = !1, o = [];
      s && o.push(...Object.keys(s).map(ne)), a && o.push(...Object.keys(a).map(ne));
      var u = 0, d = -1;
      const h = e.length;
      for (var v = 0; v < h; v++) {
        var c = e[v];
        if (f ? c === "/" && e[v - 1] === "*" && (f = !1) : i ? i === c && (i = !1) : c === "/" && e[v + 1] === "*" ? f = !0 : c === '"' || c === "'" ? i = c : c === "(" ? n++ : c === ")" && n--, !f && i === !1 && n === 0) {
          if (c === ":" && d === -1)
            d = v;
          else if (c === ";" || v === h - 1) {
            if (d !== -1) {
              var _ = ne(e.substring(u, d).trim());
              if (!o.includes(_)) {
                c !== ";" && v++;
                var p = e.substring(u, v).trim();
                r += " " + p + ";";
              }
            }
            u = v + 1, d = -1;
          }
        }
      }
    }
    return s && (r += xe(s)), a && (r += xe(a, !0)), r = r.trim(), r === "" ? null : r;
  }
  return e == null ? null : String(e);
}
function Fr(e, t, r, s, a, i) {
  var n = (
    /** @type {any} */
    e[Ce]
  );
  if (y || n !== r || n === void 0) {
    var f = xr(r, s, i);
    (!y || f !== e.getAttribute("class")) && (f == null ? e.removeAttribute("class") : t ? e.className = f : e.setAttribute("class", f)), e[Ce] = r;
  } else if (i && a !== i)
    for (var o in i) {
      var u = !!i[o];
      (a == null || u !== !!a[o]) && e.classList.toggle(o, u);
    }
  return i;
}
function fe(e, t = {}, r, s) {
  for (var a in r) {
    var i = r[a];
    t[a] !== i && (r[a] == null ? e.style.removeProperty(a) : e.style.setProperty(a, i, s));
  }
}
function jr(e, t, r, s) {
  var a = (
    /** @type {any} */
    e[Pe]
  );
  if (y || a !== t) {
    var i = Br(t, s);
    (!y || i !== e.getAttribute("style")) && (i == null ? e.removeAttribute("style") : e.style.cssText = i), e[Pe] = t;
  } else s && (Array.isArray(s) ? (fe(e, r?.[0], s[0]), fe(e, r?.[1], s[1], "important")) : fe(e, r, s));
  return s;
}
function ge(e, t, r = !1) {
  if (e.multiple) {
    if (t == null)
      return;
    if (!Ut(t))
      return Yt();
    for (var s of e.options)
      s.selected = t.includes(Be(s));
    return;
  }
  for (s of e.options) {
    var a = Be(s);
    if (Vt(a, t)) {
      s.selected = !0;
      return;
    }
  }
  (!r || t !== void 0) && (e.selectedIndex = -1);
}
function Ur(e) {
  var t = new MutationObserver(() => {
    ge(e, e.__value);
  });
  t.observe(e, {
    // Listen to option element changes
    childList: !0,
    subtree: !0,
    // because of <optgroup>
    // Listen to option element value attribute changes
    // (doesn't get notified of select value changes,
    // because that property is not reflected as an attribute)
    attributes: !0,
    attributeFilter: ["value"]
  }), Ge(() => {
    t.disconnect();
  });
}
function Be(e) {
  return "__value" in e ? e.__value : e.value;
}
const q = /* @__PURE__ */ Symbol("class"), G = /* @__PURE__ */ Symbol("style"), ct = /* @__PURE__ */ Symbol("is custom element"), dt = /* @__PURE__ */ Symbol("is html"), Yr = se ? "link" : "LINK", Vr = se ? "input" : "INPUT", qr = se ? "option" : "OPTION", Gr = se ? "select" : "SELECT";
function Wr(e) {
  if (y) {
    var t = !1, r = () => {
      if (!t) {
        if (t = !0, e.hasAttribute("value")) {
          var s = e.value;
          z(e, "value", null), e.value = s;
        }
        if (e.hasAttribute("checked")) {
          var a = e.checked;
          z(e, "checked", null), e.checked = a;
        }
      }
    };
    e[Jt] = r, U(r), Qt();
  }
}
function zr(e, t) {
  t ? e.hasAttribute("selected") || e.setAttribute("selected", "") : e.removeAttribute("selected");
}
function z(e, t, r, s) {
  var a = ht(e);
  y && (a[t] = e.getAttribute(t), t === "src" || t === "srcset" || t === "href" && e.nodeName === Yr) || a[t] !== (a[t] = r) && (t === "loading" && (e[Kt] = r), r == null ? e.removeAttribute(t) : typeof r != "string" && vt(e).includes(t) ? e[t] = r : e.setAttribute(t, r));
}
function Kr(e, t, r, s, a = !1, i = !1) {
  if (y && a && e.nodeName === Vr) {
    var n = (
      /** @type {HTMLInputElement} */
      e
    ), f = n.type === "checkbox" ? "defaultChecked" : "defaultValue";
    f in r || Wr(n);
  }
  var o = ht(e), u = o[ct], d = !o[dt];
  let v = y && u;
  v && P(!1);
  var c = t || {}, _ = e.nodeName === qr;
  for (var p in t)
    p in r || (r[p] = null);
  r.class ? r.class = Hr(r.class) : (s || r[q]) && (r.class = null), r[G] && (r.style ??= null);
  var h = vt(e);
  for (const w in r) {
    let m = r[w];
    if (_ && w === "value" && m == null) {
      e.value = e.__value = "", c[w] = m;
      continue;
    }
    if (w === "class") {
      var E = e.namespaceURI === "http://www.w3.org/1999/xhtml";
      Fr(e, E, m, s, t?.[q], r[q]), c[w] = m, c[q] = r[q];
      continue;
    }
    if (w === "style") {
      jr(e, m, t?.[G], r[G]), c[w] = m, c[G] = r[G];
      continue;
    }
    var l = c[w];
    if (!(m === l && !(m === void 0 && e.hasAttribute(w)))) {
      c[w] = m;
      var b = w[0] + w[1];
      if (b !== "$$")
        if (b === "on") {
          const N = {}, j = "$$" + w;
          let S = w.slice(2);
          var T = Sr(S);
          if (Ar(S) && (S = S.slice(0, -7), N.capture = !0), !T && l) {
            if (m != null) continue;
            e.removeEventListener(S, c[j], N), c[j] = null;
          }
          if (T)
            ve(S, e, m), nt([S]);
          else if (m != null) {
            let _t = function(pt) {
              c[w].call(this, pt);
            };
            c[j] = at(S, e, _t, N);
          }
        } else if (w === "style")
          z(e, w, m);
        else if (w === "autofocus")
          er(
            /** @type {HTMLElement} */
            e,
            !!m
          );
        else if (!u && (w === "__value" || w === "value" && m != null))
          e.value = e.__value = m;
        else if (w === "selected" && _)
          zr(
            /** @type {HTMLOptionElement} */
            e,
            m
          );
        else {
          var g = w;
          d || (g = Or(g));
          var $ = g === "defaultValue" || g === "defaultChecked";
          if (m == null && !u && !$)
            if (o[w] = null, g === "value" || g === "checked") {
              let N = (
                /** @type {HTMLInputElement} */
                e
              );
              const j = t === void 0;
              if (g === "value") {
                let S = N.defaultValue;
                N.removeAttribute(g), N.defaultValue = S, N.value = N.__value = j ? S : null;
              } else {
                let S = N.defaultChecked;
                N.removeAttribute(g), N.defaultChecked = S, N.checked = j ? S : !1;
              }
            } else
              e.removeAttribute(w);
          else $ || h.includes(g) && (u || typeof m != "string") ? (e[g] = m, g in o && (o[g] = tr)) : typeof m != "function" && z(e, g, m);
        }
    }
  }
  return v && P(!0), c;
}
function ps(e, t, r = [], s = [], a = [], i, n = !1, f = !1) {
  Xt(a, r, s, (o) => {
    var u = void 0, d = {}, v = e.nodeName === Gr, c = !1;
    if (et(() => {
      var p = t(...o.map(O)), h = Kr(
        e,
        u,
        p,
        i,
        n,
        f
      );
      c && v && "value" in p && ge(
        /** @type {HTMLSelectElement} */
        e,
        p.value
      );
      for (let l of Object.getOwnPropertySymbols(d))
        p[l] || M(d[l]);
      for (let l of Object.getOwnPropertySymbols(p)) {
        var E = p[l];
        l.description === Zt && (!u || E !== u[l]) && (d[l] && M(d[l]), d[l] = L(() => kr(e, () => E))), h[l] = E;
      }
      u = h;
    }), v) {
      var _ = (
        /** @type {HTMLSelectElement} */
        e
      );
      Ee(() => {
        ge(
          _,
          /** @type {Record<string | symbol, any>} */
          u.value,
          !0
        ), Ur(_);
      });
    }
    c = !0;
  });
}
function ht(e) {
  return (
    /** @type {Record<string | symbol, unknown>} **/
    /** @type {any} */
    e[qt] ??= {
      [ct]: e.nodeName.includes("-"),
      [dt]: e.namespaceURI === Gt
    }
  );
}
var Fe = /* @__PURE__ */ new Map();
function vt(e) {
  var t = e.getAttribute("is") || e.nodeName, r = Fe.get(t);
  if (r) return r;
  Fe.set(t, r = []);
  for (var s, a = e, i = Element.prototype; i !== a; ) {
    s = zt(a);
    for (var n in s)
      s[n].set && // better safe than sorry, we don't want spread attributes to mess with HTML content
      n !== "innerHTML" && n !== "textContent" && n !== "innerText" && r.push(n);
    a = Wt(a);
  }
  return r;
}
function Xr(e = !1) {
  const t = (
    /** @type {ComponentContextLegacy} */
    me
  ), r = t.l.u;
  if (!r) return;
  let s = () => C(t.s);
  if (e) {
    let a = 0, i = (
      /** @type {Record<string, any>} */
      {}
    );
    const n = ce(() => {
      let f = !1;
      const o = t.s;
      for (const u in o)
        o[u] !== i[u] && (i[u] = o[u], f = !0);
      return f && a++, a;
    });
    s = () => O(n);
  }
  r.b.length && rr(() => {
    je(t, s), De(r.b);
  }), Me(() => {
    const a = I(() => r.m.map(sr));
    return () => {
      for (const i of a)
        typeof i == "function" && i();
    };
  }), r.a.length && Me(() => {
    je(t, s), De(r.a);
  });
}
function je(e, t) {
  if (e.l.s)
    for (const r of e.l.s) O(r);
  t();
}
function Zr(e, t, r) {
  e.$$events ||= {}, e.$$events[t] ||= [], e.$$events[t].push(r);
}
function Jr(e) {
  for (var t in e)
    t in this && (this[t] = e[t]);
}
const Qr = {
  get(e, t) {
    if (!e.exclude.includes(t))
      return O(e.version), t in e.special ? e.special[t]() : e.props[t];
  },
  set(e, t, r) {
    if (!(t in e.special)) {
      var s = R;
      try {
        Y(e.parent_effect), e.special[t] = be(
          {
            get [t]() {
              return e.props[t];
            }
          },
          /** @type {string} */
          t,
          rt
        );
      } finally {
        Y(s);
      }
    }
    return e.special[t](r), ke(e.version), !0;
  },
  getOwnPropertyDescriptor(e, t) {
    if (!e.exclude.includes(t) && t in e.props)
      return {
        enumerable: !0,
        configurable: !0,
        value: e.props[t]
      };
  },
  deleteProperty(e, t) {
    return e.exclude.includes(t) || (e.exclude.push(t), ke(e.version)), !0;
  },
  has(e, t) {
    return e.exclude.includes(t) ? !1 : t in e.props;
  },
  ownKeys(e) {
    return Reflect.ownKeys(e.props).filter((t) => !e.exclude.includes(t));
  }
};
function gs(e, t) {
  return new Proxy(
    {
      props: e,
      exclude: t,
      special: {},
      version: we(0),
      // TODO this is only necessary because we need to track component
      // destruction inside `prop`, because of `bind:this`, but it
      // seems likely that we can simplify `bind:this` instead
      parent_effect: (
        /** @type {Effect} */
        R
      )
    },
    Qr
  );
}
function be(e, t, r, s) {
  var a = !hr || (r & vr) !== 0, i = (r & dr) !== 0, n = (r & _r) !== 0, f = (
    /** @type {V} */
    s
  ), o = !0, u = (
    /** @type {Derived<V> | undefined} */
    void 0
  ), d = () => n && a ? (u ??= ce(
    /** @type {() => V} */
    s
  ), O(u)) : (o && (o = !1, f = n ? I(
    /** @type {() => V} */
    s
  ) : (
    /** @type {V} */
    s
  )), f);
  let v;
  if (i) {
    var c = lr in e || st in e;
    v = ir(e, t)?.set ?? (c && t in e ? (g) => e[t] = g : void 0);
  }
  var _, p = !1;
  i ? [_, p] = ar(() => (
    /** @type {V} */
    e[t]
  )) : _ = /** @type {V} */
  e[t], _ === void 0 && s !== void 0 && (_ = d(), v && (a && pr(), v(_)));
  var h;
  if (a ? h = () => {
    var g = (
      /** @type {V} */
      e[t]
    );
    return g === void 0 ? d() : (o = !0, g);
  } : h = () => {
    var g = (
      /** @type {V} */
      e[t]
    );
    return g !== void 0 && (f = /** @type {V} */
    void 0), g === void 0 ? f : g;
  }, a && (r & rt) === 0)
    return h;
  if (v) {
    var E = e.$$legacy;
    return (
      /** @type {() => V} */
      (function(g, $) {
        return arguments.length > 0 ? ((!a || !$ || E || p) && v($ ? h() : g), g) : h();
      })
    );
  }
  var l = !1, b = ((r & cr) !== 0 ? ce : or)(() => (l = !1, h()));
  i && O(b);
  var T = (
    /** @type {Effect} */
    R
  );
  return (
    /** @type {() => V} */
    (function(g, $) {
      if (arguments.length > 0) {
        const w = $ ? O(b) : a && i ? nr(g) : g;
        return tt(b, w), l = !0, f !== void 0 && (f = w), g;
      }
      return ur && l || (T.f & fr) !== 0 ? b.v : O(b);
    })
  );
}
function es(e) {
  return new ts(e);
}
class ts {
  /** @type {any} */
  #e;
  /** @type {Record<string, any>} */
  #t;
  /**
   * @param {ComponentConstructorOptions & {
   *  component: any;
   * }} options
   */
  constructor(t) {
    var r = /* @__PURE__ */ new Map(), s = (i, n) => {
      var f = gr(n, !1, !1);
      return r.set(i, f), f;
    };
    const a = new Proxy(
      { ...t.props || {}, $$events: {} },
      {
        get(i, n) {
          return O(r.get(n) ?? s(n, Reflect.get(i, n)));
        },
        has(i, n) {
          return n === st ? !0 : (O(r.get(n) ?? s(n, Reflect.get(i, n))), Reflect.has(i, n));
        },
        set(i, n, f) {
          return tt(r.get(n) ?? s(n, f), f), Reflect.set(i, n, f);
        }
      }
    );
    this.#t = (t.hydrate ? Mr : ft)(t.component, {
      target: t.target,
      anchor: t.anchor,
      props: a,
      context: t.context,
      intro: t.intro ?? !1,
      recover: t.recover,
      transformError: t.transformError
    }), (!t?.props?.$$host || t.sync === !1) && de(), this.#e = a.$$events;
    for (const i of Object.keys(this.#t))
      i === "$set" || i === "$destroy" || i === "$on" || We(this, i, {
        get() {
          return this.#t[i];
        },
        /** @param {any} value */
        set(n) {
          this.#t[i] = n;
        },
        enumerable: !0
      });
    this.#t.$set = /** @param {Record<string, any>} next */
    (i) => {
      Object.assign(a, i);
    }, this.#t.$destroy = () => {
      Dr(this.#t);
    };
  }
  /** @param {Record<string, any>} props */
  $set(t) {
    this.#t.$set(t);
  }
  /**
   * @param {string} event
   * @param {(...args: any[]) => any} callback
   * @returns {any}
   */
  $on(t, r) {
    this.#e[t] = this.#e[t] || [];
    const s = (...a) => r.call(this, ...a);
    return this.#e[t].push(s), () => {
      this.#e[t] = this.#e[t].filter(
        /** @param {any} fn */
        (a) => a !== s
      );
    };
  }
  $destroy() {
    this.#t.$destroy();
  }
}
const rs = "5";
typeof window < "u" && ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add(rs);
br();
function Ue(e) {
  return e?.replace(/^ipfs:\/\/ipfs\//, "https://ipfs.io/ipfs/")?.replace(/^ipfs:\/\//, "https://ipfs.io/ipfs/");
}
var ss = /* @__PURE__ */ X('<img alt="Asset" class="crtw-w-full crtw-h-full crtw-object-cover"/>'), is = /* @__PURE__ */ X('<p class="crtw-text-xl crtw-font-bold crtw-text-gray-900"> <span class="crtw-text-[10px] crtw-text-gray-400 crtw-align-top crtw-uppercase">usd</span></p>'), as = /* @__PURE__ */ X('<h3 class="crtw-font-bold crtw-text-gray-800"> </h3>'), ns = /* @__PURE__ */ X('<p class="crtw-text-xs crtw-text-gray-500 crtw-leading-tight"> </p>'), fs = /* @__PURE__ */ X('<div role="button" tabindex="0" class="crtw-flex crtw-flex-1 crtw-max-w-[120px] crtw-cursor-pointer"><div><div class="crtx-flex crtw-h-[120px] crtw-aspect-square crtw-bg-[#B4A7D6] crtw-rounded-sm crtw-mb-4 crtw-overflow-hidden"><!></div> <div class="crtw-space-y-1"><!> <!> <!></div></div></div>');
function os(e, t) {
  if (new.target) return es({ component: os, ...e });
  Ze(t, !1);
  let r = be(t, "asset", 12), s = be(t, "onSelect", 12);
  var a = {
    get asset() {
      return r();
    },
    set asset(l) {
      r(l), de();
    },
    get onSelect() {
      return s();
    },
    set onSelect(l) {
      s(l), de();
    },
    $set: Jr,
    $on: (l, b) => Zr(t, l, b)
  };
  Xr();
  var i = fs(), n = H(i), f = H(n), o = H(f);
  {
    var u = (l) => {
      var b = ss();
      J((T) => z(b, "src", T), [
        () => (C(Ue), C(r()), I(() => Ue(r().metadata?.image || r().metadata?.image_url)))
      ]), V(l, b);
    };
    ee(o, (l) => {
      C(r()), I(() => r().metadata?.image || r().metadata?.image_url) && l(u);
    });
  }
  x(f);
  var d = ie(f, 2), v = H(d);
  {
    var c = (l) => {
      var b = is(), T = H(b);
      qe(), x(b), J(() => ae(T, `${C(r()), I(() => r().metadata?.price) ?? ""} `)), V(l, b);
    };
    ee(v, (l) => {
      C(r()), I(() => r().metadata?.price) && l(c);
    });
  }
  var _ = ie(v, 2);
  {
    var p = (l) => {
      var b = as(), T = H(b, !0);
      x(b), J(() => ae(T, (C(r()), I(() => r().metadata?.name)))), V(l, b);
    };
    ee(_, (l) => {
      C(r()), I(() => r().metadata?.name) && l(p);
    });
  }
  var h = ie(_, 2);
  {
    var E = (l) => {
      var b = ns(), T = H(b, !0);
      x(b), J(() => ae(T, (C(r()), I(() => r().metadata?.description)))), V(l, b);
    };
    ee(h, (l) => {
      C(r()), I(() => r().metadata?.description) && l(E);
    });
  }
  return x(d), x(n), x(i), ve("click", i, () => s()(r())), ve("keydown", i, () => {
  }), V(e, i), Je(a);
}
nt(["click", "keydown"]);
export {
  os as A,
  ut as B,
  q as C,
  ds as a,
  V as b,
  es as c,
  Zr as d,
  ls as e,
  X as f,
  hs as g,
  Xr as h,
  ee as i,
  jr as j,
  Fr as k,
  gs as l,
  _s as m,
  vs as n,
  ae as o,
  be as p,
  zr as q,
  Wr as r,
  z as s,
  cs as t,
  Jr as u,
  ps as v,
  k as w,
  Hr as x,
  Ue as y
};
//# sourceMappingURL=AssetItem-CFsdMEwW.js.map
