import { a as ki, n as Ue, o as Mi, r as ji } from "./rolldown-runtime.js";
import { i as Bi, t as Ii } from "./vendor/react.js";
import { A as Oi, B as He, Ct as Fi, Dt as Ui, Et as Dt, G as _t, H as We, I as A, J as Hi, K as ht, L as W, M as ze, N as at, P as jt, Q as Wi, R as zi, S as Ni, St as Gi, T as Ne, Tt as Ge, U as _i, V as _e, W as Xi, X as $i, Y as N, Z as Yi, _ as O, _t as Xt, a as qi, at as lt, b as F, bt as Xe, c as Ki, ct as $e, d as Zi, dt as D, f as Ji, ft as pt, g as vt, gt as Qi, h as $t, ht as ts, i as es, it as T, j as Ye, k as qe, l as is, lt as Y, m as ss, n as ns, o as os, ot as rs, p as as, pt as U, q as Yt, r as ls, s as cs, st as yt, t as Ke, u as qt, ut as E, v as us, vt as hs, w as fs, wt as Ze, x as ds, xt as G, y as Kt, yt as Lt, z as Je } from "./MotionConfigContext.js";
var Vt = Ii(), v = /* @__PURE__ */ Mi(Bi(), 1), Qe = (0, v.createContext)({}), ms = typeof window < "u", ps = ms ? v.useLayoutEffect : v.useEffect, Bt = /* @__PURE__ */ (0, v.createContext)(null);
function ti(t, e, i, s = 0, o = 1) {
  const c = Array.from(t).sort((a, h) => a.sortNodePosition(h)).indexOf(e), n = t.size, r = (n - 1) * s;
  return typeof i == "function" ? i(c, n) : o === 1 ? c * s : r - c * s;
}
function Rt(t, e, i = {}) {
  const s = N(t, e, i.type === "exit" ? t.presenceContext?.custom : void 0);
  let { transition: o = t.getDefaultTransition() || {} } = s || {};
  i.transitionOverride && (o = i.transitionOverride);
  const c = s ? () => Promise.all(We(t, s, i)) : () => Promise.resolve(), n = t.variantChildren && t.variantChildren.size ? (a = 0) => {
    const { delayChildren: h = 0, staggerChildren: l, staggerDirection: u } = o;
    return vs(t, e, a, h, l, u, i);
  } : () => Promise.resolve(), { when: r } = o;
  if (r) {
    const [a, h] = r === "beforeChildren" ? [c, n] : [n, c];
    return a().then(() => h());
  } else return Promise.all([c(), n(i.delay)]);
}
function vs(t, e, i = 0, s = 0, o = 0, c = 1, n) {
  const r = [];
  for (const a of t.variantChildren)
    a.notify("AnimationStart", e), r.push(Rt(a, e, {
      ...n,
      delay: i + (typeof s == "function" ? 0 : s) + ti(t.variantChildren, a, s, o, c)
    }).then(() => a.notify("AnimationComplete", e)));
  return Promise.all(r);
}
function ys(t, e, i = {}) {
  t.notify("AnimationStart", e);
  let s;
  if (Array.isArray(e)) {
    const o = e.map((c) => Rt(t, c, i));
    s = Promise.all(o);
  } else if (typeof e == "string") s = Rt(t, e, i);
  else {
    const o = typeof e == "function" ? N(t, e, i.custom) : e;
    s = Promise.all(We(t, o, i));
  }
  return s.then(() => {
    t.notify("AnimationComplete", e);
  });
}
function gs(t) {
  return Gi(t) && "offsetHeight" in t && !("ownerSVGElement" in t);
}
var R = {
  x: !1,
  y: !1
};
function ei() {
  return R.x || R.y;
}
function xs(t) {
  return t === "x" || t === "y" ? R[t] ? null : (R[t] = !0, () => {
    R[t] = !1;
  }) : R.x || R.y ? null : (R.x = R.y = !0, () => {
    R.x = R.y = !1;
  });
}
function ii(t, e) {
  const i = _e(t), s = new AbortController(), o = {
    passive: !0,
    ...e,
    signal: s.signal
  };
  return [
    i,
    o,
    () => s.abort()
  ];
}
function Ps(t) {
  return !(t.pointerType === "touch" || ei());
}
function ws(t, e, i = {}) {
  const [s, o, c] = ii(t, i);
  return s.forEach((n) => {
    let r = !1, a = !1, h;
    const l = () => {
      n.removeEventListener("pointerleave", d);
    }, u = (y) => {
      h && (h(y), h = void 0), l();
    }, f = (y) => {
      r = !1, window.removeEventListener("pointerup", f), window.removeEventListener("pointercancel", f), a && (a = !1, u(y));
    }, m = () => {
      r = !0, window.addEventListener("pointerup", f, o), window.addEventListener("pointercancel", f, o);
    }, d = (y) => {
      if (y.pointerType !== "touch") {
        if (r) {
          a = !0;
          return;
        }
        u(y);
      }
    }, P = (y) => {
      if (!Ps(y)) return;
      a = !1;
      const x = e(n, y);
      typeof x == "function" && (h = x, n.addEventListener("pointerleave", d, o));
    };
    n.addEventListener("pointerenter", P, o), n.addEventListener("pointerdown", m, o);
  }), c;
}
var si = (t, e) => e ? t === e ? !0 : si(t, e.parentElement) : !1, It = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1, Ts = /* @__PURE__ */ new Set([
  "BUTTON",
  "INPUT",
  "SELECT",
  "TEXTAREA",
  "A"
]);
function Ss(t) {
  return Ts.has(t.tagName) || t.isContentEditable === !0;
}
var As = /* @__PURE__ */ new Set([
  "INPUT",
  "SELECT",
  "TEXTAREA"
]);
function Es(t) {
  return As.has(t.tagName) || t.isContentEditable === !0;
}
var et = /* @__PURE__ */ new WeakSet();
function Zt(t) {
  return (e) => {
    e.key === "Enter" && t(e);
  };
}
function gt(t, e) {
  t.dispatchEvent(new PointerEvent("pointer" + e, {
    isPrimary: !0,
    bubbles: !0
  }));
}
var Cs = (t, e) => {
  const i = t.currentTarget;
  if (!i) return;
  const s = Zt(() => {
    if (et.has(i)) return;
    gt(i, "down");
    const o = Zt(() => {
      gt(i, "up");
    }), c = () => gt(i, "cancel");
    i.addEventListener("keyup", o, e), i.addEventListener("blur", c, e);
  });
  i.addEventListener("keydown", s, e), i.addEventListener("blur", () => i.removeEventListener("keydown", s), e);
};
function Jt(t) {
  return It(t) && !ei();
}
var Qt = /* @__PURE__ */ new WeakSet();
function Ds(t, e, i = {}) {
  const [s, o, c] = ii(t, i), n = (r) => {
    const a = r.currentTarget;
    if (!Jt(r) || Qt.has(r)) return;
    et.add(a), i.stopPropagation && Qt.add(r);
    const h = e(a, r), l = (m, d) => {
      window.removeEventListener("pointerup", u), window.removeEventListener("pointercancel", f), et.has(a) && et.delete(a), Jt(m) && typeof h == "function" && h(m, { success: d });
    }, u = (m) => {
      l(m, a === window || a === document || i.useGlobalTarget || si(a, m.target));
    }, f = (m) => {
      l(m, !1);
    };
    window.addEventListener("pointerup", u, o), window.addEventListener("pointercancel", f, o);
  };
  return s.forEach((r) => {
    (i.useGlobalTarget ? window : r).addEventListener("pointerdown", n, o), gs(r) && (r.addEventListener("focus", (a) => Cs(a, o)), !Ss(r) && !r.hasAttribute("tabindex") && (r.tabIndex = 0));
  }), c;
}
var it = /* @__PURE__ */ new WeakMap(), st, ni = (t, e, i) => (s, o) => o && o[0] ? o[0][t + "Size"] : Je(s) && "getBBox" in s ? s.getBBox()[e] : s[i], Ls = /* @__PURE__ */ ni("inline", "width", "offsetWidth"), Vs = /* @__PURE__ */ ni("block", "height", "offsetHeight");
function Rs({ target: t, borderBoxSize: e }) {
  it.get(t)?.forEach((i) => {
    i(t, {
      get width() {
        return Ls(t, e);
      },
      get height() {
        return Vs(t, e);
      }
    });
  });
}
function bs(t) {
  t.forEach(Rs);
}
function ks() {
  typeof ResizeObserver > "u" || (st = new ResizeObserver(bs));
}
function Ms(t, e) {
  st || ks();
  const i = _e(t);
  return i.forEach((s) => {
    let o = it.get(s);
    o || (o = /* @__PURE__ */ new Set(), it.set(s, o)), o.add(e), st?.observe(s);
  }), () => {
    i.forEach((s) => {
      const o = it.get(s);
      o?.delete(e), o?.size || st?.unobserve(s);
    });
  };
}
var nt = /* @__PURE__ */ new Set(), z;
function js() {
  z = () => {
    const t = {
      get width() {
        return window.innerWidth;
      },
      get height() {
        return window.innerHeight;
      }
    };
    nt.forEach((e) => e(t));
  }, window.addEventListener("resize", z);
}
function Bs(t) {
  return nt.add(t), z || js(), () => {
    nt.delete(t), !nt.size && typeof z == "function" && (window.removeEventListener("resize", z), z = void 0);
  };
}
function te(t, e) {
  return typeof t == "function" ? Bs(t) : Ms(t, e);
}
var k = class {
  constructor(t) {
    this.isMounted = !1, this.node = t;
  }
  update() {
  }
}, Is = ze.length;
function oi(t) {
  if (!t) return;
  if (!t.isControllingVariants) {
    const i = t.parent ? oi(t.parent) || {} : {};
    return t.props.initial !== void 0 && (i.initial = t.props.initial), i;
  }
  const e = {};
  for (let i = 0; i < Is; i++) {
    const s = ze[i], o = t.props[s];
    (at(o) || o === !1) && (e[s] = o);
  }
  return e;
}
function ri(t, e) {
  if (!Array.isArray(e)) return !1;
  const i = e.length;
  if (i !== t.length) return !1;
  for (let s = 0; s < i; s++) if (e[s] !== t[s]) return !1;
  return !0;
}
var Os = [...Ye].reverse(), Fs = Ye.length;
function Us(t) {
  return (e) => Promise.all(e.map(({ animation: i, options: s }) => ys(t, i, s)));
}
function Hs(t) {
  let e = Us(t), i = ee(), s = !0, o = !1;
  const c = (h) => (l, u) => {
    const f = N(t, u, h === "exit" ? t.presenceContext?.custom : void 0);
    if (f) {
      const { transition: m, transitionEnd: d, ...P } = f;
      l = {
        ...l,
        ...P,
        ...d
      };
    }
    return l;
  };
  function n(h) {
    e = h(t);
  }
  function r(h) {
    const { props: l } = t, u = oi(t.parent) || {}, f = [], m = /* @__PURE__ */ new Set();
    let d = {}, P = 1 / 0;
    for (let x = 0; x < Fs; x++) {
      const p = Os[x], g = i[p], w = l[p] !== void 0 ? l[p] : u[p], dt = at(w), Z = p === h ? g.isActive : null;
      Z === !1 && (P = x);
      let J = w === u[p] && w !== l[p] && dt;
      if (J && (s || o) && t.manuallyAnimateOnMount && (J = !1), g.protectedKeys = { ...d }, !g.isActive && Z === null || !w && !g.prevProp || jt(w) || typeof w == "boolean") continue;
      if (p === "exit" && g.isActive && Z !== !0) {
        g.prevResolvedValues && (d = {
          ...d,
          ...g.prevResolvedValues
        });
        continue;
      }
      const Ut = Ws(g.prevProp, w);
      let mt = Ut || p === h && g.isActive && !J && dt || x > P && dt, Ht = !1;
      const Wt = Array.isArray(w) ? w : [w];
      let _ = Wt.reduce(c(p), {});
      Z === !1 && (_ = {});
      const { prevResolvedValues: zt = {} } = g, Ri = {
        ...zt,
        ..._
      }, Nt = (S) => {
        mt = !0, m.has(S) && (Ht = !0, m.delete(S)), g.needsAnimating[S] = !0;
        const L = t.getValue(S);
        L && (L.liveStyle = !1);
      };
      for (const S in Ri) {
        const L = _[S], M = zt[S];
        if (d.hasOwnProperty(S)) continue;
        let I = !1;
        Yt(L) && Yt(M) ? I = !ri(L, M) : I = L !== M, I ? L != null ? Nt(S) : m.add(S) : L !== void 0 && m.has(S) ? Nt(S) : g.protectedKeys[S] = !0;
      }
      g.prevProp = w, g.prevResolvedValues = _, g.isActive && (d = {
        ...d,
        ..._
      }), (s || o) && t.blockInitialAnimation && (mt = !1);
      const Gt = J && Ut;
      mt && (!Gt || Ht) && f.push(...Wt.map((S) => {
        const L = { type: p };
        if (typeof S == "string" && (s || o) && !Gt && t.manuallyAnimateOnMount && t.parent) {
          const { parent: M } = t, I = N(M, S);
          if (M.enteringChildren && I) {
            const { delayChildren: bi } = I.transition || {};
            L.delay = ti(M.enteringChildren, t, bi);
          }
        }
        return {
          animation: S,
          options: L
        };
      }));
    }
    if (m.size) {
      const x = {};
      if (typeof l.initial != "boolean") {
        const p = N(t, Array.isArray(l.initial) ? l.initial[0] : l.initial);
        p && p.transition && (x.transition = p.transition);
      }
      m.forEach((p) => {
        const g = t.getBaseTarget(p), w = t.getValue(p);
        w && (w.liveStyle = !0), x[p] = g ?? null;
      }), f.push({ animation: x });
    }
    let y = !!f.length;
    return s && (l.initial === !1 || l.initial === l.animate) && !t.manuallyAnimateOnMount && (y = !1), s = !1, o = !1, y ? e(f) : Promise.resolve();
  }
  function a(h, l) {
    if (i[h].isActive === l) return Promise.resolve();
    t.variantChildren?.forEach((f) => f.animationState?.setActive(h, l)), i[h].isActive = l;
    const u = r(h);
    for (const f in i) i[f].protectedKeys = {};
    return u;
  }
  return {
    animateChanges: r,
    setActive: a,
    setAnimateFunction: n,
    getState: () => i,
    reset: () => {
      i = ee(), o = !0;
    }
  };
}
function Ws(t, e) {
  return typeof e == "string" ? e !== t : Array.isArray(e) ? !ri(e, t) : !1;
}
function j(t = !1) {
  return {
    isActive: t,
    protectedKeys: {},
    needsAnimating: {},
    prevResolvedValues: {}
  };
}
function ee() {
  return {
    animate: j(!0),
    whileInView: j(),
    whileHover: j(),
    whileTap: j(),
    whileDrag: j(),
    whileFocus: j(),
    exit: j()
  };
}
function bt(t, e) {
  t.min = e.min, t.max = e.max;
}
function V(t, e) {
  bt(t.x, e.x), bt(t.y, e.y);
}
function ie(t, e) {
  t.translate = e.translate, t.scale = e.scale, t.originPoint = e.originPoint, t.origin = e.origin;
}
var ai = 1e-4, zs = 1 - ai, Ns = 1 + ai, li = 0.01, Gs = 0 - li, _s = 0 + li;
function C(t) {
  return t.max - t.min;
}
function Xs(t, e, i) {
  return Math.abs(t - e) <= i;
}
function se(t, e, i, s = 0.5) {
  t.origin = s, t.originPoint = T(e.min, e.max, t.origin), t.scale = C(i) / C(e), t.translate = T(i.min, i.max, t.origin) - t.originPoint, (t.scale >= zs && t.scale <= Ns || isNaN(t.scale)) && (t.scale = 1), (t.translate >= Gs && t.translate <= _s || isNaN(t.translate)) && (t.translate = 0);
}
function X(t, e, i, s) {
  se(t.x, e.x, i.x, s ? s.originX : void 0), se(t.y, e.y, i.y, s ? s.originY : void 0);
}
function ne(t, e, i, s = 0) {
  t.min = (s ? T(i.min, i.max, s) : i.min) + e.min, t.max = t.min + C(e);
}
function $s(t, e, i, s) {
  ne(t.x, e.x, i.x, s?.x), ne(t.y, e.y, i.y, s?.y);
}
function oe(t, e, i, s = 0) {
  const o = s ? T(i.min, i.max, s) : i.min;
  t.min = e.min - o, t.max = t.min + C(e);
}
function ct(t, e, i, s) {
  oe(t.x, e.x, i.x, s?.x), oe(t.y, e.y, i.y, s?.y);
}
function re(t, e, i, s, o) {
  return t -= e, t = $t(t, 1 / i, s), o !== void 0 && (t = $t(t, 1 / o, s)), t;
}
function Ys(t, e = 0, i = 1, s = 0.5, o, c = t, n = t) {
  if (lt.test(e) && (e = parseFloat(e), e = T(n.min, n.max, e / 100) - n.min), typeof e != "number") return;
  let r = T(c.min, c.max, s);
  t === c && (r -= e), t.min = re(t.min, e, i, r, o), t.max = re(t.max, e, i, r, o);
}
function ae(t, e, [i, s, o], c, n) {
  Ys(t, e[i], e[s], e[o], e.scale, c, n);
}
var qs = [
  "x",
  "scaleX",
  "originX"
], Ks = [
  "y",
  "scaleY",
  "originY"
];
function le(t, e, i, s) {
  ae(t.x, e, qs, i ? i.x : void 0, s ? s.x : void 0), ae(t.y, e, Ks, i ? i.y : void 0, s ? s.y : void 0);
}
function ce(t) {
  return t.translate === 0 && t.scale === 1;
}
function ci(t) {
  return ce(t.x) && ce(t.y);
}
function ue(t, e) {
  return t.min === e.min && t.max === e.max;
}
function Zs(t, e) {
  return ue(t.x, e.x) && ue(t.y, e.y);
}
function he(t, e) {
  return Math.round(t.min) === Math.round(e.min) && Math.round(t.max) === Math.round(e.max);
}
function ui(t, e) {
  return he(t.x, e.x) && he(t.y, e.y);
}
function fe(t) {
  return C(t.x) / C(t.y);
}
function de(t, e) {
  return t.translate === e.translate && t.scale === e.scale && t.originPoint === e.originPoint;
}
function b(t) {
  return [t("x"), t("y")];
}
function Js(t, e, i) {
  let s = "";
  const o = t.x.translate / e.x, c = t.y.translate / e.y, n = i?.z || 0;
  if ((o || c || n) && (s = `translate3d(${o}px, ${c}px, ${n}px) `), (e.x !== 1 || e.y !== 1) && (s += `scale(${1 / e.x}, ${1 / e.y}) `), i) {
    const { transformPerspective: h, rotate: l, rotateX: u, rotateY: f, skewX: m, skewY: d } = i;
    h && (s = `perspective(${h}px) ${s}`), l && (s += `rotate(${l}deg) `), u && (s += `rotateX(${u}deg) `), f && (s += `rotateY(${f}deg) `), m && (s += `skewX(${m}deg) `), d && (s += `skewY(${d}deg) `);
  }
  const r = t.x.scale * e.x, a = t.y.scale * e.y;
  return (r !== 1 || a !== 1) && (s += `scale(${r}, ${a})`), s || "none";
}
var hi = [
  "borderTopLeftRadius",
  "borderTopRightRadius",
  "borderBottomLeftRadius",
  "borderBottomRightRadius"
], Qs = hi.length, me = (t) => typeof t == "string" ? parseFloat(t) : t, pe = (t) => typeof t == "number" || rs.test(t);
function tn(t, e, i, s, o, c) {
  o ? (t.opacity = T(0, i.opacity ?? 1, en(s)), t.opacityExit = T(e.opacity ?? 1, 0, sn(s))) : c && (t.opacity = T(e.opacity ?? 1, i.opacity ?? 1, s));
  for (let n = 0; n < Qs; n++) {
    const r = hi[n];
    let a = ve(e, r), h = ve(i, r);
    a === void 0 && h === void 0 || (a || (a = 0), h || (h = 0), a === 0 || h === 0 || pe(a) === pe(h) ? (t[r] = Math.max(T(me(a), me(h), s), 0), (lt.test(h) || lt.test(a)) && (t[r] += "%")) : t[r] = h);
  }
  (e.rotate || i.rotate) && (t.rotate = T(e.rotate || 0, i.rotate || 0, s));
}
function ve(t, e) {
  return t[e] !== void 0 ? t[e] : t.borderRadius;
}
var en = /* @__PURE__ */ fi(0, 0.5, ts), sn = /* @__PURE__ */ fi(0.5, 0.95, G);
function fi(t, e, i) {
  return (s) => s < t ? 0 : s > e ? 1 : i(Lt(t, e, s));
}
function q(t, e, i, s = { passive: !0 }) {
  return t.addEventListener(e, i, s), () => t.removeEventListener(e, i);
}
var nn = (t, e) => t.depth - e.depth, on = class {
  constructor() {
    this.children = [], this.isDirty = !1;
  }
  add(t) {
    Ge(this.children, t), this.isDirty = !0;
  }
  remove(t) {
    Dt(this.children, t), this.isDirty = !0;
  }
  forEach(t) {
    this.isDirty && this.children.sort(nn), this.isDirty = !1, this.children.forEach(t);
  }
};
function rn(t, e) {
  const i = $e.now(), s = ({ timestamp: o }) => {
    const c = o - i;
    c >= e && (Y(s), t(c - e));
  };
  return E.setup(s, !0), () => Y(s);
}
function ot(t) {
  return ht(t) ? t.get() : t;
}
var an = class {
  constructor() {
    this.members = [];
  }
  add(t) {
    Ge(this.members, t);
    for (let e = this.members.length - 1; e >= 0; e--) {
      const i = this.members[e];
      if (i === t || i === this.lead || i === this.prevLead) continue;
      const s = i.instance;
      (!s || s.isConnected === !1) && !i.snapshot && (Dt(this.members, i), i.unmount());
    }
    t.scheduleRender();
  }
  remove(t) {
    if (Dt(this.members, t), t === this.prevLead && (this.prevLead = void 0), t === this.lead) {
      const e = this.members[this.members.length - 1];
      e && this.promote(e);
    }
  }
  relegate(t) {
    for (let e = this.members.indexOf(t) - 1; e >= 0; e--) {
      const i = this.members[e];
      if (i.isPresent !== !1 && i.instance?.isConnected !== !1)
        return this.promote(i), !0;
    }
    return !1;
  }
  promote(t, e) {
    const i = this.lead;
    if (t !== i && (this.prevLead = i, this.lead = t, t.show(), i)) {
      i.updateSnapshot(), t.scheduleRender();
      const { layoutDependency: s } = i.options, { layoutDependency: o } = t.options;
      (s === void 0 || s !== o) && (t.resumeFrom = i, e && (i.preserveOpacity = !0), i.snapshot && (t.snapshot = i.snapshot, t.snapshot.latestValues = i.animationValues || i.latestValues), t.root?.isUpdating && (t.isLayoutDirty = !0)), t.options.crossfade === !1 && i.hide();
    }
  }
  exitAnimationComplete() {
    this.members.forEach((t) => {
      t.options.onExitComplete?.(), t.resumingFrom?.options.onExitComplete?.();
    });
  }
  scheduleRender() {
    this.members.forEach((t) => t.instance && t.scheduleRender(!1));
  }
  removeLeadSnapshot() {
    this.lead?.snapshot && (this.lead.snapshot = void 0);
  }
}, rt = {
  hasAnimatedSinceResize: !0,
  hasEverUpdated: !1
}, B = {
  nodes: 0,
  calculatedTargetDeltas: 0,
  calculatedProjections: 0
}, xt = [
  "",
  "X",
  "Y",
  "Z"
], ln = 1e3, cn = 0;
function Pt(t, e, i, s) {
  const { latestValues: o } = e;
  o[t] && (i[t] = o[t], e.setStaticValue(t, 0), s && (s[t] = 0));
}
function di(t) {
  if (t.hasCheckedOptimisedAppear = !0, t.root === t) return;
  const { visualElement: e } = t.options;
  if (!e) return;
  const i = _i(e);
  if (window.MotionHasOptimisedAnimation(i, "transform")) {
    const { layout: o, layoutId: c } = t.options;
    window.MotionCancelOptimisedAnimation(i, "transform", E, !(o || c));
  }
  const { parent: s } = t;
  s && !s.hasCheckedOptimisedAppear && di(s);
}
function mi({ attachResizeListener: t, defaultParent: e, measureScroll: i, checkIsScrollRoot: s, resetTransform: o }) {
  return class {
    constructor(n = {}, r = e?.()) {
      this.id = cn++, this.animationId = 0, this.animationCommitId = 0, this.children = /* @__PURE__ */ new Set(), this.options = {}, this.isTreeAnimating = !1, this.isAnimationBlocked = !1, this.isLayoutDirty = !1, this.isProjectionDirty = !1, this.isSharedProjectionDirty = !1, this.isTransformDirty = !1, this.updateManuallyBlocked = !1, this.updateBlockedByResize = !1, this.isUpdating = !1, this.isSVG = !1, this.needsReset = !1, this.shouldResetTransform = !1, this.hasCheckedOptimisedAppear = !1, this.treeScale = {
        x: 1,
        y: 1
      }, this.eventHandlers = /* @__PURE__ */ new Map(), this.hasTreeAnimated = !1, this.layoutVersion = 0, this.updateScheduled = !1, this.scheduleUpdate = () => this.update(), this.projectionUpdateScheduled = !1, this.checkUpdateFailed = () => {
        this.isUpdating && (this.isUpdating = !1, this.clearAllSnapshots());
      }, this.updateProjection = () => {
        this.projectionUpdateScheduled = !1, U.value && (B.nodes = B.calculatedTargetDeltas = B.calculatedProjections = 0), this.nodes.forEach(fn), this.nodes.forEach(gn), this.nodes.forEach(xn), this.nodes.forEach(dn), U.addProjectionMetrics && U.addProjectionMetrics(B);
      }, this.resolvedRelativeTargetAt = 0, this.linkedParentVersion = 0, this.hasProjected = !1, this.isVisible = !0, this.animationProgress = 0, this.sharedNodes = /* @__PURE__ */ new Map(), this.latestValues = n, this.root = r ? r.root || r : this, this.path = r ? [...r.path, r] : [], this.parent = r, this.depth = r ? r.depth + 1 : 0;
      for (let a = 0; a < this.path.length; a++) this.path[a].shouldResetTransform = !0;
      this.root === this && (this.nodes = new on());
    }
    addEventListener(n, r) {
      return this.eventHandlers.has(n) || this.eventHandlers.set(n, new hs()), this.eventHandlers.get(n).add(r);
    }
    notifyListeners(n, ...r) {
      const a = this.eventHandlers.get(n);
      a && a.notify(...r);
    }
    hasListeners(n) {
      return this.eventHandlers.has(n);
    }
    mount(n) {
      if (this.instance) return;
      this.isSVG = Je(n) && !zi(n), this.instance = n;
      const { layoutId: r, layout: a, visualElement: h } = this.options;
      if (h && !h.current && h.mount(n), this.root.nodes.add(this), this.parent && this.parent.children.add(this), this.root.hasTreeAnimated && (a || r) && (this.isLayoutDirty = !0), t) {
        let l, u = 0;
        const f = () => this.root.updateBlockedByResize = !1;
        E.read(() => {
          u = window.innerWidth;
        }), t(n, () => {
          const m = window.innerWidth;
          m !== u && (u = m, this.root.updateBlockedByResize = !0, l && l(), l = rn(f, 250), rt.hasAnimatedSinceResize && (rt.hasAnimatedSinceResize = !1, this.nodes.forEach(xe)));
        });
      }
      r && this.root.registerSharedNode(r, this), this.options.animate !== !1 && h && (r || a) && this.addEventListener("didUpdate", ({ delta: l, hasLayoutChanged: u, hasRelativeLayoutChanged: f, layout: m }) => {
        if (this.isTreeAnimationBlocked()) {
          this.target = void 0, this.relativeTarget = void 0;
          return;
        }
        const d = this.options.transition || h.getDefaultTransition() || An, { onLayoutAnimationStart: P, onLayoutAnimationComplete: y } = h.getProps(), x = !this.targetLayout || !ui(this.targetLayout, m), p = !u && f;
        if (this.options.layoutRoot || this.resumeFrom || p || u && (x || !this.currentAnimation)) {
          this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0);
          const g = {
            ...Wi(d, "layout"),
            onPlay: P,
            onComplete: y
          };
          (h.shouldReduceMotion || this.options.layoutRoot) && (g.delay = 0, g.type = !1), this.startAnimation(g), this.setAnimationOrigin(l, p);
        } else
          u || xe(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete();
        this.targetLayout = m;
      });
    }
    unmount() {
      this.options.layoutId && this.willUpdate(), this.root.nodes.remove(this);
      const n = this.getStack();
      n && n.remove(this), this.parent && this.parent.children.delete(this), this.instance = void 0, this.eventHandlers.clear(), Y(this.updateProjection);
    }
    blockUpdate() {
      this.updateManuallyBlocked = !0;
    }
    unblockUpdate() {
      this.updateManuallyBlocked = !1;
    }
    isUpdateBlocked() {
      return this.updateManuallyBlocked || this.updateBlockedByResize;
    }
    isTreeAnimationBlocked() {
      return this.isAnimationBlocked || this.parent && this.parent.isTreeAnimationBlocked() || !1;
    }
    startUpdate() {
      this.isUpdateBlocked() || (this.isUpdating = !0, this.nodes && this.nodes.forEach(Pn), this.animationId++);
    }
    getTransformTemplate() {
      const { visualElement: n } = this.options;
      return n && n.getProps().transformTemplate;
    }
    willUpdate(n = !0) {
      if (this.root.hasTreeAnimated = !0, this.root.isUpdateBlocked()) {
        this.options.onExitComplete && this.options.onExitComplete();
        return;
      }
      if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear && di(this), !this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty) return;
      this.isLayoutDirty = !0;
      for (let l = 0; l < this.path.length; l++) {
        const u = this.path[l];
        u.shouldResetTransform = !0, (typeof u.latestValues.x == "string" || typeof u.latestValues.y == "string") && (u.isLayoutDirty = !0), u.updateScroll("snapshot"), u.options.layoutRoot && u.willUpdate(!1);
      }
      const { layoutId: r, layout: a } = this.options;
      if (r === void 0 && !a) return;
      const h = this.getTransformTemplate();
      this.prevTransformTemplateValue = h ? h(this.latestValues, "") : void 0, this.updateSnapshot(), n && this.notifyListeners("willUpdate");
    }
    update() {
      if (this.updateScheduled = !1, this.isUpdateBlocked()) {
        const r = this.updateBlockedByResize;
        this.unblockUpdate(), this.updateBlockedByResize = !1, this.clearAllSnapshots(), r && this.nodes.forEach(pn), this.nodes.forEach(ye);
        return;
      }
      if (this.animationId <= this.animationCommitId) {
        this.nodes.forEach(ge);
        return;
      }
      this.animationCommitId = this.animationId, this.isUpdating ? (this.isUpdating = !1, this.nodes.forEach(vn), this.nodes.forEach(yn), this.nodes.forEach(un), this.nodes.forEach(hn)) : this.nodes.forEach(ge), this.clearAllSnapshots();
      const n = $e.now();
      D.delta = Ze(0, 1e3 / 60, n - D.timestamp), D.timestamp = n, D.isProcessing = !0, pt.update.process(D), pt.preRender.process(D), pt.render.process(D), D.isProcessing = !1;
    }
    didUpdate() {
      this.updateScheduled || (this.updateScheduled = !0, He.read(this.scheduleUpdate));
    }
    clearAllSnapshots() {
      this.nodes.forEach(mn), this.sharedNodes.forEach(wn);
    }
    scheduleUpdateProjection() {
      this.projectionUpdateScheduled || (this.projectionUpdateScheduled = !0, E.preRender(this.updateProjection, !1, !0));
    }
    scheduleCheckAfterUnmount() {
      E.postRender(() => {
        this.isLayoutDirty ? this.root.didUpdate() : this.root.checkUpdateFailed();
      });
    }
    updateSnapshot() {
      this.snapshot || !this.instance || (this.snapshot = this.measure(), this.snapshot && !C(this.snapshot.measuredBox.x) && !C(this.snapshot.measuredBox.y) && (this.snapshot = void 0));
    }
    updateLayout() {
      if (!this.instance || (this.updateScroll(), !(this.options.alwaysMeasureLayout && this.isLead()) && !this.isLayoutDirty)) return;
      if (this.resumeFrom && !this.resumeFrom.instance) for (let a = 0; a < this.path.length; a++) this.path[a].updateScroll();
      const n = this.layout;
      this.layout = this.measure(!1), this.layoutVersion++, this.layoutCorrected || (this.layoutCorrected = A()), this.isLayoutDirty = !1, this.projectionDelta = void 0, this.notifyListeners("measure", this.layout.layoutBox);
      const { visualElement: r } = this.options;
      r && r.notify("LayoutMeasure", this.layout.layoutBox, n ? n.layoutBox : void 0);
    }
    updateScroll(n = "measure") {
      let r = !!(this.options.layoutScroll && this.instance);
      if (this.scroll && this.scroll.animationId === this.root.animationId && this.scroll.phase === n && (r = !1), r && this.instance) {
        const a = s(this.instance);
        this.scroll = {
          animationId: this.root.animationId,
          phase: n,
          isRoot: a,
          offset: i(this.instance),
          wasRoot: this.scroll ? this.scroll.isRoot : a
        };
      }
    }
    resetTransform() {
      if (!o) return;
      const n = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout, r = this.projectionDelta && !ci(this.projectionDelta), a = this.getTransformTemplate(), h = a ? a(this.latestValues, "") : void 0, l = h !== this.prevTransformTemplateValue;
      n && this.instance && (r || F(this.latestValues) || l) && (o(this.instance, h), this.shouldResetTransform = !1, this.scheduleRender());
    }
    measure(n = !0) {
      const r = this.measurePageBox();
      let a = this.removeElementScroll(r);
      return n && (a = this.removeTransform(a)), En(a), {
        animationId: this.root.animationId,
        measuredBox: r,
        layoutBox: a,
        latestValues: {},
        source: this.id
      };
    }
    measurePageBox() {
      const { visualElement: n } = this.options;
      if (!n) return A();
      const r = n.measureViewportBox();
      if (!(this.scroll?.wasRoot || this.path.some(Cn))) {
        const { scroll: a } = this.root;
        a && (O(r.x, a.offset.x), O(r.y, a.offset.y));
      }
      return r;
    }
    removeElementScroll(n) {
      const r = A();
      if (V(r, n), this.scroll?.wasRoot) return r;
      for (let a = 0; a < this.path.length; a++) {
        const h = this.path[a], { scroll: l, options: u } = h;
        h !== this.root && l && u.layoutScroll && (l.wasRoot && V(r, n), O(r.x, l.offset.x), O(r.y, l.offset.y));
      }
      return r;
    }
    applyTransform(n, r = !1, a) {
      const h = a || A();
      V(h, n);
      for (let l = 0; l < this.path.length; l++) {
        const u = this.path[l];
        !r && u.options.layoutScroll && u.scroll && u !== u.root && (O(h.x, -u.scroll.offset.x), O(h.y, -u.scroll.offset.y)), F(u.latestValues) && vt(h, u.latestValues, u.layout?.layoutBox);
      }
      return F(this.latestValues) && vt(h, this.latestValues, this.layout?.layoutBox), h;
    }
    removeTransform(n) {
      const r = A();
      V(r, n);
      for (let a = 0; a < this.path.length; a++) {
        const h = this.path[a];
        if (!F(h.latestValues)) continue;
        let l;
        h.instance && (Kt(h.latestValues) && h.updateSnapshot(), l = A(), V(l, h.measurePageBox())), le(r, h.latestValues, h.snapshot?.layoutBox, l);
      }
      return F(this.latestValues) && le(r, this.latestValues), r;
    }
    setTargetDelta(n) {
      this.targetDelta = n, this.root.scheduleUpdateProjection(), this.isProjectionDirty = !0;
    }
    setOptions(n) {
      this.options = {
        ...this.options,
        ...n,
        crossfade: n.crossfade !== void 0 ? n.crossfade : !0
      };
    }
    clearMeasurements() {
      this.scroll = void 0, this.layout = void 0, this.snapshot = void 0, this.prevTransformTemplateValue = void 0, this.targetDelta = void 0, this.target = void 0, this.isLayoutDirty = !1;
    }
    forceRelativeParentToResolveTarget() {
      this.relativeParent && this.relativeParent.resolvedRelativeTargetAt !== D.timestamp && this.relativeParent.resolveTargetDelta(!0);
    }
    resolveTargetDelta(n = !1) {
      const r = this.getLead();
      this.isProjectionDirty || (this.isProjectionDirty = r.isProjectionDirty), this.isTransformDirty || (this.isTransformDirty = r.isTransformDirty), this.isSharedProjectionDirty || (this.isSharedProjectionDirty = r.isSharedProjectionDirty);
      const a = !!this.resumingFrom || this !== r;
      if (!(n || a && this.isSharedProjectionDirty || this.isProjectionDirty || this.parent?.isProjectionDirty || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize)) return;
      const { layout: h, layoutId: l } = this.options;
      if (!this.layout || !(h || l)) return;
      this.resolvedRelativeTargetAt = D.timestamp;
      const u = this.getClosestProjectingParent();
      u && this.linkedParentVersion !== u.layoutVersion && !u.options.layoutRoot && this.removeRelativeTarget(), !this.targetDelta && !this.relativeTarget && (this.options.layoutAnchor !== !1 && u && u.layout ? this.createRelativeTarget(u, this.layout.layoutBox, u.layout.layoutBox) : this.removeRelativeTarget()), !(!this.relativeTarget && !this.targetDelta) && (this.target || (this.target = A(), this.targetWithTransforms = A()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), $s(this.target, this.relativeTarget, this.relativeParent.target, this.options.layoutAnchor || void 0)) : this.targetDelta ? (this.resumingFrom ? this.applyTransform(this.layout.layoutBox, !1, this.target) : V(this.target, this.layout.layoutBox), as(this.target, this.targetDelta)) : V(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget && (this.attemptToResolveRelativeTarget = !1, this.options.layoutAnchor !== !1 && u && !!u.resumingFrom == !!this.resumingFrom && !u.options.layoutScroll && u.target && this.animationProgress !== 1 ? this.createRelativeTarget(u, this.target, u.target) : this.relativeParent = this.relativeTarget = void 0), U.value && B.calculatedTargetDeltas++);
    }
    getClosestProjectingParent() {
      if (!(!this.parent || Kt(this.parent.latestValues) || us(this.parent.latestValues)))
        return this.parent.isProjecting() ? this.parent : this.parent.getClosestProjectingParent();
    }
    isProjecting() {
      return !!((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
    }
    createRelativeTarget(n, r, a) {
      this.relativeParent = n, this.linkedParentVersion = n.layoutVersion, this.forceRelativeParentToResolveTarget(), this.relativeTarget = A(), this.relativeTargetOrigin = A(), ct(this.relativeTargetOrigin, r, a, this.options.layoutAnchor || void 0), V(this.relativeTarget, this.relativeTargetOrigin);
    }
    removeRelativeTarget() {
      this.relativeParent = this.relativeTarget = void 0;
    }
    calcProjection() {
      const n = this.getLead(), r = !!this.resumingFrom || this !== n;
      let a = !0;
      if ((this.isProjectionDirty || this.parent?.isProjectionDirty) && (a = !1), r && (this.isSharedProjectionDirty || this.isTransformDirty) && (a = !1), this.resolvedRelativeTargetAt === D.timestamp && (a = !1), a) return;
      const { layout: h, layoutId: l } = this.options;
      if (this.isTreeAnimating = !!(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation), this.isTreeAnimating || (this.targetDelta = this.relativeTarget = void 0), !this.layout || !(h || l)) return;
      V(this.layoutCorrected, this.layout.layoutBox);
      const u = this.treeScale.x, f = this.treeScale.y;
      ss(this.layoutCorrected, this.treeScale, this.path, r), n.layout && !n.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1) && (n.target = n.layout.layoutBox, n.targetWithTransforms = A());
      const { target: m } = n;
      if (!m) {
        this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender());
        return;
      }
      !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (ie(this.prevProjectionDelta.x, this.projectionDelta.x), ie(this.prevProjectionDelta.y, this.projectionDelta.y)), X(this.projectionDelta, this.layoutCorrected, m, this.latestValues), (this.treeScale.x !== u || this.treeScale.y !== f || !de(this.projectionDelta.x, this.prevProjectionDelta.x) || !de(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", m)), U.value && B.calculatedProjections++;
    }
    hide() {
      this.isVisible = !1;
    }
    show() {
      this.isVisible = !0;
    }
    scheduleRender(n = !0) {
      if (this.options.visualElement?.scheduleRender(), n) {
        const r = this.getStack();
        r && r.scheduleRender();
      }
      this.resumingFrom && !this.resumingFrom.instance && (this.resumingFrom = void 0);
    }
    createProjectionDeltas() {
      this.prevProjectionDelta = W(), this.projectionDelta = W(), this.projectionDeltaWithTransform = W();
    }
    setAnimationOrigin(n, r = !1) {
      const a = this.snapshot, h = a ? a.latestValues : {}, l = { ...this.latestValues }, u = W();
      (!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !r;
      const f = A(), m = (a ? a.source : void 0) !== (this.layout ? this.layout.source : void 0), d = this.getStack(), P = !d || d.members.length <= 1, y = !!(m && !P && this.options.crossfade === !0 && !this.path.some(Sn));
      this.animationProgress = 0;
      let x;
      this.mixTargetDelta = (p) => {
        const g = p / 1e3;
        Pe(u.x, n.x, g), Pe(u.y, n.y, g), this.setTargetDelta(u), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (ct(f, this.layout.layoutBox, this.relativeParent.layout.layoutBox, this.options.layoutAnchor || void 0), Tn(this.relativeTarget, this.relativeTargetOrigin, f, g), x && Zs(this.relativeTarget, x) && (this.isProjectionDirty = !1), x || (x = A()), V(x, this.relativeTarget)), m && (this.animationValues = l, tn(l, h, this.latestValues, g, y, P)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = g;
      }, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0);
    }
    startAnimation(n) {
      this.notifyListeners("animationStart"), this.currentAnimation?.stop(), this.resumingFrom?.currentAnimation?.stop(), this.pendingAnimation && (Y(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = E.update(() => {
        rt.hasAnimatedSinceResize = !0, yt.layout++, this.motionValue || (this.motionValue = Hi(0)), this.motionValue.jump(0, !1), this.currentAnimation = ns(this.motionValue, [0, 1e3], {
          ...n,
          velocity: 0,
          isSync: !0,
          onUpdate: (r) => {
            this.mixTargetDelta(r), n.onUpdate && n.onUpdate(r);
          },
          onStop: () => {
            yt.layout--;
          },
          onComplete: () => {
            yt.layout--, n.onComplete && n.onComplete(), this.completeAnimation();
          }
        }), this.resumingFrom && (this.resumingFrom.currentAnimation = this.currentAnimation), this.pendingAnimation = void 0;
      });
    }
    completeAnimation() {
      this.resumingFrom && (this.resumingFrom.currentAnimation = void 0, this.resumingFrom.preserveOpacity = void 0);
      const n = this.getStack();
      n && n.exitAnimationComplete(), this.resumingFrom = this.currentAnimation = this.animationValues = void 0, this.notifyListeners("animationComplete");
    }
    finishAnimation() {
      this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(ln), this.currentAnimation.stop()), this.completeAnimation();
    }
    applyTransformsToTarget() {
      const n = this.getLead();
      let { targetWithTransforms: r, target: a, layout: h, latestValues: l } = n;
      if (!(!r || !a || !h)) {
        if (this !== n && this.layout && h && pi(this.options.animationType, this.layout.layoutBox, h.layoutBox)) {
          a = this.target || A();
          const u = C(this.layout.layoutBox.x);
          a.x.min = n.target.x.min, a.x.max = a.x.min + u;
          const f = C(this.layout.layoutBox.y);
          a.y.min = n.target.y.min, a.y.max = a.y.min + f;
        }
        V(r, a), vt(r, l), X(this.projectionDeltaWithTransform, this.layoutCorrected, r, l);
      }
    }
    registerSharedNode(n, r) {
      this.sharedNodes.has(n) || this.sharedNodes.set(n, new an()), this.sharedNodes.get(n).add(r);
      const a = r.options.initialPromotionConfig;
      r.promote({
        transition: a ? a.transition : void 0,
        preserveFollowOpacity: a && a.shouldPreserveFollowOpacity ? a.shouldPreserveFollowOpacity(r) : void 0
      });
    }
    isLead() {
      const n = this.getStack();
      return n ? n.lead === this : !0;
    }
    getLead() {
      const { layoutId: n } = this.options;
      return n ? this.getStack()?.lead || this : this;
    }
    getPrevLead() {
      const { layoutId: n } = this.options;
      return n ? this.getStack()?.prevLead : void 0;
    }
    getStack() {
      const { layoutId: n } = this.options;
      if (n) return this.root.sharedNodes.get(n);
    }
    promote({ needsReset: n, transition: r, preserveFollowOpacity: a } = {}) {
      const h = this.getStack();
      h && h.promote(this, a), n && (this.projectionDelta = void 0, this.needsReset = !0), r && this.setOptions({ transition: r });
    }
    relegate() {
      const n = this.getStack();
      return n ? n.relegate(this) : !1;
    }
    resetSkewAndRotation() {
      const { visualElement: n } = this.options;
      if (!n) return;
      let r = !1;
      const { latestValues: a } = n;
      if ((a.z || a.rotate || a.rotateX || a.rotateY || a.rotateZ || a.skewX || a.skewY) && (r = !0), !r) return;
      const h = {};
      a.z && Pt("z", n, h, this.animationValues);
      for (let l = 0; l < xt.length; l++)
        Pt(`rotate${xt[l]}`, n, h, this.animationValues), Pt(`skew${xt[l]}`, n, h, this.animationValues);
      n.render();
      for (const l in h)
        n.setStaticValue(l, h[l]), this.animationValues && (this.animationValues[l] = h[l]);
      n.scheduleRender();
    }
    applyProjectionStyles(n, r) {
      if (!this.instance || this.isSVG) return;
      if (!this.isVisible) {
        n.visibility = "hidden";
        return;
      }
      const a = this.getTransformTemplate();
      if (this.needsReset) {
        this.needsReset = !1, n.visibility = "", n.opacity = "", n.pointerEvents = ot(r?.pointerEvents) || "", n.transform = a ? a(this.latestValues, "") : "none";
        return;
      }
      const h = this.getLead();
      if (!this.projectionDelta || !this.layout || !h.target) {
        this.options.layoutId && (n.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1, n.pointerEvents = ot(r?.pointerEvents) || ""), this.hasProjected && !F(this.latestValues) && (n.transform = a ? a({}, "") : "none", this.hasProjected = !1);
        return;
      }
      n.visibility = "";
      const l = h.animationValues || h.latestValues;
      this.applyTransformsToTarget();
      let u = Js(this.projectionDeltaWithTransform, this.treeScale, l);
      a && (u = a(l, u)), n.transform = u;
      const { x: f, y: m } = this.projectionDelta;
      n.transformOrigin = `${f.origin * 100}% ${m.origin * 100}% 0`, h.animationValues ? n.opacity = h === this ? l.opacity ?? this.latestValues.opacity ?? 1 : this.preserveOpacity ? this.latestValues.opacity : l.opacityExit : n.opacity = h === this ? l.opacity !== void 0 ? l.opacity : "" : l.opacityExit !== void 0 ? l.opacityExit : 0;
      for (const d in qt) {
        if (l[d] === void 0) continue;
        const { correct: P, applyTo: y, isCSSVariable: x } = qt[d], p = u === "none" ? l[d] : P(l[d], h);
        if (y) {
          const g = y.length;
          for (let w = 0; w < g; w++) n[y[w]] = p;
        } else x ? this.options.visualElement.renderState.vars[d] = p : n[d] = p;
      }
      this.options.layoutId && (n.pointerEvents = h === this ? ot(r?.pointerEvents) || "" : "none");
    }
    clearSnapshot() {
      this.resumeFrom = this.snapshot = void 0;
    }
    resetTree() {
      this.root.nodes.forEach((n) => n.currentAnimation?.stop()), this.root.nodes.forEach(ye), this.root.sharedNodes.clear();
    }
  };
}
function un(t) {
  t.updateLayout();
}
function hn(t) {
  const e = t.resumeFrom?.snapshot || t.snapshot;
  if (t.isLead() && t.layout && e && t.hasListeners("didUpdate")) {
    const { layoutBox: i, measuredBox: s } = t.layout, { animationType: o } = t.options, c = e.source !== t.layout.source;
    if (o === "size") b((l) => {
      const u = c ? e.measuredBox[l] : e.layoutBox[l], f = C(u);
      u.min = i[l].min, u.max = u.min + f;
    });
    else if (o === "x" || o === "y") {
      const l = o === "x" ? "y" : "x";
      bt(c ? e.measuredBox[l] : e.layoutBox[l], i[l]);
    } else pi(o, e.layoutBox, i) && b((l) => {
      const u = c ? e.measuredBox[l] : e.layoutBox[l], f = C(i[l]);
      u.max = u.min + f, t.relativeTarget && !t.currentAnimation && (t.isProjectionDirty = !0, t.relativeTarget[l].max = t.relativeTarget[l].min + f);
    });
    const n = W();
    X(n, i, e.layoutBox);
    const r = W();
    c ? X(r, t.applyTransform(s, !0), e.measuredBox) : X(r, i, e.layoutBox);
    const a = !ci(n);
    let h = !1;
    if (!t.resumeFrom) {
      const l = t.getClosestProjectingParent();
      if (l && !l.resumeFrom) {
        const { snapshot: u, layout: f } = l;
        if (u && f) {
          const m = t.options.layoutAnchor || void 0, d = A();
          ct(d, e.layoutBox, u.layoutBox, m);
          const P = A();
          ct(P, i, f.layoutBox, m), ui(d, P) || (h = !0), l.options.layoutRoot && (t.relativeTarget = P, t.relativeTargetOrigin = d, t.relativeParent = l);
        }
      }
    }
    t.notifyListeners("didUpdate", {
      layout: i,
      snapshot: e,
      delta: r,
      layoutDelta: n,
      hasLayoutChanged: a,
      hasRelativeLayoutChanged: h
    });
  } else if (t.isLead()) {
    const { onExitComplete: i } = t.options;
    i && i();
  }
  t.options.transition = void 0;
}
function fn(t) {
  U.value && B.nodes++, t.parent && (t.isProjecting() || (t.isProjectionDirty = t.parent.isProjectionDirty), t.isSharedProjectionDirty || (t.isSharedProjectionDirty = !!(t.isProjectionDirty || t.parent.isProjectionDirty || t.parent.isSharedProjectionDirty)), t.isTransformDirty || (t.isTransformDirty = t.parent.isTransformDirty));
}
function dn(t) {
  t.isProjectionDirty = t.isSharedProjectionDirty = t.isTransformDirty = !1;
}
function mn(t) {
  t.clearSnapshot();
}
function ye(t) {
  t.clearMeasurements();
}
function pn(t) {
  t.isLayoutDirty = !0, t.updateLayout();
}
function ge(t) {
  t.isLayoutDirty = !1;
}
function vn(t) {
  t.isAnimationBlocked && t.layout && !t.isLayoutDirty && (t.snapshot = t.layout, t.isLayoutDirty = !0);
}
function yn(t) {
  const { visualElement: e } = t.options;
  e && e.getProps().onBeforeLayoutMeasure && e.notify("BeforeLayoutMeasure"), t.resetTransform();
}
function xe(t) {
  t.finishAnimation(), t.targetDelta = t.relativeTarget = t.target = void 0, t.isProjectionDirty = !0;
}
function gn(t) {
  t.resolveTargetDelta();
}
function xn(t) {
  t.calcProjection();
}
function Pn(t) {
  t.resetSkewAndRotation();
}
function wn(t) {
  t.removeLeadSnapshot();
}
function Pe(t, e, i) {
  t.translate = T(e.translate, 0, i), t.scale = T(e.scale, 1, i), t.origin = e.origin, t.originPoint = e.originPoint;
}
function we(t, e, i, s) {
  t.min = T(e.min, i.min, s), t.max = T(e.max, i.max, s);
}
function Tn(t, e, i, s) {
  we(t.x, e.x, i.x, s), we(t.y, e.y, i.y, s);
}
function Sn(t) {
  return t.animationValues && t.animationValues.opacityExit !== void 0;
}
var An = {
  duration: 0.45,
  ease: [
    0.4,
    0,
    0.1,
    1
  ]
}, Te = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), Se = Te("applewebkit/") && !Te("chrome/") ? Math.round : G;
function Ae(t) {
  t.min = Se(t.min), t.max = Se(t.max);
}
function En(t) {
  Ae(t.x), Ae(t.y);
}
function pi(t, e, i) {
  return t === "position" || t === "preserve-aspect" && !Xs(fe(e), fe(i), 0.2);
}
function Cn(t) {
  return t !== t.root && t.scroll?.wasRoot;
}
var Dn = mi({
  attachResizeListener: (t, e) => q(t, "resize", e),
  measureScroll: () => ({
    x: document.documentElement.scrollLeft || document.body?.scrollLeft || 0,
    y: document.documentElement.scrollTop || document.body?.scrollTop || 0
  }),
  checkIsScrollRoot: () => !0
}), wt = { current: void 0 }, vi = mi({
  measureScroll: (t) => ({
    x: t.scrollLeft,
    y: t.scrollTop
  }),
  defaultParent: () => {
    if (!wt.current) {
      const t = new Dn({});
      t.mount(window), t.setOptions({ layoutScroll: !0 }), wt.current = t;
    }
    return wt.current;
  },
  resetTransform: (t, e) => {
    t.style.transform = e !== void 0 ? e : "none";
  },
  checkIsScrollRoot: (t) => window.getComputedStyle(t).position === "fixed"
});
function Ln(t = !0) {
  const e = (0, v.useContext)(Bt);
  if (e === null) return [!0, null];
  const { isPresent: i, onExitComplete: s, register: o } = e, c = (0, v.useId)();
  (0, v.useEffect)(() => {
    if (t) return o(c);
  }, [t]);
  const n = (0, v.useCallback)(() => t && s && s(c), [
    c,
    s,
    t
  ]);
  return !i && s ? [!1, n] : [!0];
}
var yi = (0, v.createContext)({ strict: !1 }), Ee = {
  animation: [
    "animate",
    "variants",
    "whileHover",
    "whileTap",
    "exit",
    "whileInView",
    "whileFocus",
    "whileDrag"
  ],
  exit: ["exit"],
  drag: ["drag", "dragControls"],
  focus: ["whileFocus"],
  hover: [
    "whileHover",
    "onHoverStart",
    "onHoverEnd"
  ],
  tap: [
    "whileTap",
    "onTap",
    "onTapStart",
    "onTapCancel"
  ],
  pan: [
    "onPan",
    "onPanStart",
    "onPanSessionStart",
    "onPanEnd"
  ],
  inView: [
    "whileInView",
    "onViewportEnter",
    "onViewportLeave"
  ],
  layout: ["layout", "layoutId"]
}, Ce = !1;
function Vn() {
  if (Ce) return;
  const t = {};
  for (const e in Ee) t[e] = { isEnabled: (i) => Ee[e].some((s) => !!i[s]) };
  Ne(t), Ce = !0;
}
function gi() {
  return Vn(), fs();
}
function Rn(t) {
  const e = gi();
  for (const i in t) e[i] = {
    ...e[i],
    ...t[i]
  };
  Ne(e);
}
var bn = /* @__PURE__ */ new Set([
  "animate",
  "exit",
  "variants",
  "initial",
  "style",
  "values",
  "variants",
  "transition",
  "transformTemplate",
  "custom",
  "inherit",
  "onBeforeLayoutMeasure",
  "onAnimationStart",
  "onAnimationComplete",
  "onUpdate",
  "onDragStart",
  "onDrag",
  "onDragEnd",
  "onMeasureDragConstraints",
  "onDirectionLock",
  "onDragTransitionEnd",
  "_dragX",
  "_dragY",
  "onHoverStart",
  "onHoverEnd",
  "onViewportEnter",
  "onViewportLeave",
  "globalTapTarget",
  "propagate",
  "ignoreStrict",
  "viewport"
]);
function ut(t) {
  return t.startsWith("while") || t.startsWith("drag") && t !== "draggable" || t.startsWith("layout") || t.startsWith("onTap") || t.startsWith("onPan") || t.startsWith("onLayout") || bn.has(t);
}
function kn(t) {
  var e = /* @__PURE__ */ Object.create(null);
  return function(i) {
    return e[i] === void 0 && (e[i] = t(i)), e[i];
  };
}
var Mn = Ue((() => {
})), jn = /* @__PURE__ */ ji({ default: () => xi }), De, xi, Bn = Ue((() => {
  Mn(), De = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/, xi = /* @__PURE__ */ kn(function(t) {
    return De.test(t) || t.charCodeAt(0) === 111 && t.charCodeAt(1) === 110 && t.charCodeAt(2) < 91;
  });
})), Pi = (t) => !ut(t);
function In(t) {
  typeof t == "function" && (Pi = (e) => e.startsWith("on") ? !ut(e) : t(e));
}
try {
  In((Bn(), ki(jn)).default);
} catch {
}
function On(t, e, i) {
  const s = {};
  for (const o in t)
    o === "values" && typeof t.values == "object" || ht(t[o]) || (Pi(o) || i === !0 && ut(o) || !e && !ut(o) || t.draggable && o.startsWith("onDrag")) && (s[o] = t[o]);
  return s;
}
var ft = /* @__PURE__ */ (0, v.createContext)({});
function Fn(t, e) {
  if (qe(t)) {
    const { initial: i, animate: s } = t;
    return {
      initial: i === !1 || at(i) ? i : void 0,
      animate: at(s) ? s : void 0
    };
  }
  return t.inherit !== !1 ? e : {};
}
function Un(t) {
  const { initial: e, animate: i } = Fn(t, (0, v.useContext)(ft));
  return (0, v.useMemo)(() => ({
    initial: e,
    animate: i
  }), [Le(e), Le(i)]);
}
function Le(t) {
  return Array.isArray(t) ? t.join(" ") : t;
}
var Ot = () => ({
  style: {},
  transform: {},
  transformOrigin: {},
  vars: {}
});
function wi(t, e, i) {
  for (const s in e) !ht(e[s]) && !is(s, i) && (t[s] = e[s]);
}
function Hn({ transformTemplate: t }, e) {
  return (0, v.useMemo)(() => {
    const i = Ot();
    return Zi(i, e, t), Object.assign({}, i.vars, i.style);
  }, [e]);
}
function Wn(t, e) {
  const i = t.style || {}, s = {};
  return wi(s, i, t), Object.assign(s, Hn(t, e)), s;
}
function zn(t, e) {
  const i = {}, s = Wn(t, e);
  return t.drag && t.dragListener !== !1 && (i.draggable = !1, s.userSelect = s.WebkitUserSelect = s.WebkitTouchCallout = "none", s.touchAction = t.drag === !0 ? "none" : `pan-${t.drag === "x" ? "y" : "x"}`), t.tabIndex === void 0 && (t.onTap || t.onTapStart || t.whileTap) && (i.tabIndex = 0), i.style = s, i;
}
var Ti = () => ({
  ...Ot(),
  attrs: {}
});
function Nn(t, e, i, s) {
  const o = (0, v.useMemo)(() => {
    const c = Ti();
    return os(c, e, qi(s), t.transformTemplate, t.style), {
      ...c.attrs,
      style: { ...c.style }
    };
  }, [e]);
  if (t.style) {
    const c = {};
    wi(c, t.style, t), o.style = {
      ...c,
      ...o.style
    };
  }
  return o;
}
var Gn = [
  "animate",
  "circle",
  "defs",
  "desc",
  "ellipse",
  "g",
  "image",
  "line",
  "filter",
  "marker",
  "mask",
  "metadata",
  "path",
  "pattern",
  "polygon",
  "polyline",
  "rect",
  "stop",
  "switch",
  "symbol",
  "svg",
  "text",
  "tspan",
  "use",
  "view"
];
function Ft(t) {
  return typeof t != "string" || t.includes("-") ? !1 : !!(Gn.indexOf(t) > -1 || /[A-Z]/u.test(t));
}
function _n(t, e, i, { latestValues: s }, o, c = !1, n) {
  const r = (n ?? Ft(t) ? Nn : zn)(e, s, o, t), a = On(e, typeof t == "string", c), h = t !== v.Fragment ? {
    ...a,
    ...r,
    ref: i
  } : {}, { children: l } = e, u = (0, v.useMemo)(() => ht(l) ? l.get() : l, [l]);
  return (0, v.createElement)(t, {
    ...h,
    children: u
  });
}
function Xn({ scrapeMotionValuesFromProps: t, createRenderState: e }, i, s, o) {
  return {
    latestValues: $n(i, s, o, t),
    renderState: e()
  };
}
function $n(t, e, i, s) {
  const o = {}, c = s(t, {});
  for (const f in c) o[f] = ot(c[f]);
  let { initial: n, animate: r } = t;
  const a = qe(t), h = Oi(t);
  e && h && !a && t.inherit !== !1 && (n === void 0 && (n = e.initial), r === void 0 && (r = e.animate));
  let l = i ? i.initial === !1 : !1;
  l = l || n === !1;
  const u = l ? r : n;
  if (u && typeof u != "boolean" && !jt(u)) {
    const f = Array.isArray(u) ? u : [u];
    for (let m = 0; m < f.length; m++) {
      const d = $i(t, f[m]);
      if (d) {
        const { transitionEnd: P, transition: y, ...x } = d;
        for (const p in x) {
          let g = x[p];
          if (Array.isArray(g)) {
            const w = l ? g.length - 1 : 0;
            g = g[w];
          }
          g !== null && (o[p] = g);
        }
        for (const p in P) o[p] = P[p];
      }
    }
  }
  return o;
}
var Si = (t) => (e, i) => {
  const s = (0, v.useContext)(ft), o = (0, v.useContext)(Bt), c = () => Xn(t, e, s, o);
  return i ? c() : Ui(c);
}, Yn = /* @__PURE__ */ Si({
  scrapeMotionValuesFromProps: Ki,
  createRenderState: Ot
}), qn = /* @__PURE__ */ Si({
  scrapeMotionValuesFromProps: es,
  createRenderState: Ti
}), Kn = /* @__PURE__ */ Symbol.for("motionComponentSymbol");
function Zn(t, e, i) {
  const s = (0, v.useRef)(i);
  (0, v.useInsertionEffect)(() => {
    s.current = i;
  });
  const o = (0, v.useRef)(null);
  return (0, v.useCallback)((c) => {
    c && t.onMount?.(c);
    const n = s.current;
    if (typeof n == "function") if (c) {
      const r = n(c);
      typeof r == "function" && (o.current = r);
    } else o.current ? (o.current(), o.current = null) : n(c);
    else n && (n.current = c);
    e && (c ? e.mount(c) : e.unmount());
  }, [e]);
}
var Ai = (0, v.createContext)({});
function H(t) {
  return t && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "current");
}
function Jn(t, e, i, s, o, c) {
  const { visualElement: n } = (0, v.useContext)(ft), r = (0, v.useContext)(yi), a = (0, v.useContext)(Bt), h = (0, v.useContext)(Ke), l = h.reducedMotion, u = h.skipAnimations, f = (0, v.useRef)(null), m = (0, v.useRef)(!1);
  s = s || r.renderer, !f.current && s && (f.current = s(t, {
    visualState: e,
    parent: n,
    props: i,
    presenceContext: a,
    blockInitialAnimation: a ? a.initial === !1 : !1,
    reducedMotionConfig: l,
    skipAnimations: u,
    isSVG: c
  }), m.current && f.current && (f.current.manuallyAnimateOnMount = !0));
  const d = f.current, P = (0, v.useContext)(Ai);
  d && !d.projection && o && (d.type === "html" || d.type === "svg") && Qn(f.current, i, o, P);
  const y = (0, v.useRef)(!1);
  (0, v.useInsertionEffect)(() => {
    d && y.current && d.update(i, a);
  });
  const x = i[Xi], p = (0, v.useRef)(!!x && typeof window < "u" && !window.MotionHandoffIsComplete?.(x) && window.MotionHasOptimisedAnimation?.(x));
  return ps(() => {
    m.current = !0, d && (y.current = !0, window.MotionIsMounted = !0, d.updateFeatures(), d.scheduleRenderMicrotask(), p.current && d.animationState && d.animationState.animateChanges());
  }), (0, v.useEffect)(() => {
    d && (!p.current && d.animationState && d.animationState.animateChanges(), p.current && (queueMicrotask(() => {
      window.MotionHandoffMarkAsComplete?.(x);
    }), p.current = !1), d.enteringChildren = void 0);
  }), d;
}
function Qn(t, e, i, s) {
  const { layoutId: o, layout: c, drag: n, dragConstraints: r, layoutScroll: a, layoutRoot: h, layoutAnchor: l, layoutCrossfade: u } = e;
  t.projection = new i(t.latestValues, e["data-framer-portal-id"] ? void 0 : Ei(t.parent)), t.projection.setOptions({
    layoutId: o,
    layout: c,
    alwaysMeasureLayout: !!n || r && H(r),
    visualElement: t,
    animationType: typeof c == "string" ? c : "both",
    initialPromotionConfig: s,
    crossfade: u,
    layoutScroll: a,
    layoutRoot: h,
    layoutAnchor: l
  });
}
function Ei(t) {
  if (t)
    return t.options.allowProjection !== !1 ? t.projection : Ei(t.parent);
}
function Tt(t, { forwardMotionProps: e = !1, type: i } = {}, s, o) {
  s && Rn(s);
  const c = i ? i === "svg" : Ft(t), n = c ? qn : Yn;
  function r(h, l) {
    let u;
    const f = {
      ...(0, v.useContext)(Ke),
      ...h,
      layoutId: to(h)
    }, { isStatic: m } = f, d = Un(h), P = n(h, m);
    if (!m && typeof window < "u") {
      eo(f, s);
      const y = io(f);
      u = y.MeasureLayout, d.visualElement = Jn(t, P, f, o, y.ProjectionNode, c);
    }
    return (0, Vt.jsxs)(ft.Provider, {
      value: d,
      children: [u && d.visualElement ? (0, Vt.jsx)(u, {
        visualElement: d.visualElement,
        ...f
      }) : null, _n(t, h, Zn(P, d.visualElement, l), P, m, e, c)]
    });
  }
  r.displayName = `motion.${typeof t == "string" ? t : `create(${t.displayName ?? t.name ?? ""})`}`;
  const a = (0, v.forwardRef)(r);
  return a[Kn] = t, a;
}
function to({ layoutId: t }) {
  const e = (0, v.useContext)(Qe).id;
  return e && t !== void 0 ? e + "-" + t : t;
}
function eo(t, e) {
  (0, v.useContext)(yi).strict;
}
function io(t) {
  const { drag: e, layout: i } = gi();
  if (!e && !i) return {};
  const s = {
    ...e,
    ...i
  };
  return {
    MeasureLayout: e?.isEnabled(t) || i?.isEnabled(t) ? s.MeasureLayout : void 0,
    ProjectionNode: s.ProjectionNode
  };
}
function so(t, e) {
  if (typeof Proxy > "u") return Tt;
  const i = /* @__PURE__ */ new Map(), s = (c, n) => Tt(c, n, t, e), o = (c, n) => s(c, n);
  return new Proxy(o, { get: (c, n) => n === "create" ? s : (i.has(n) || i.set(n, Tt(n, void 0, t, e)), i.get(n)) });
}
var no = (t, e) => e.isSVG ?? Ft(t) ? new ls(e) : new cs(e, { allowProjection: t !== v.Fragment }), oo = class extends k {
  constructor(t) {
    super(t), t.animationState || (t.animationState = Hs(t));
  }
  updateAnimationControlsSubscription() {
    const { animate: t } = this.node.getProps();
    jt(t) && (this.unmountControls = t.subscribe(this.node));
  }
  mount() {
    this.updateAnimationControlsSubscription();
  }
  update() {
    const { animate: t } = this.node.getProps(), { animate: e } = this.node.prevProps || {};
    t !== e && this.updateAnimationControlsSubscription();
  }
  unmount() {
    this.node.animationState.reset(), this.unmountControls?.();
  }
}, ro = 0, ao = class extends k {
  constructor() {
    super(...arguments), this.id = ro++, this.isExitComplete = !1;
  }
  update() {
    if (!this.node.presenceContext) return;
    const { isPresent: t, onExitComplete: e } = this.node.presenceContext, { isPresent: i } = this.node.prevPresenceContext || {};
    if (!this.node.animationState || t === i) return;
    if (t && i === !1) {
      if (this.isExitComplete) {
        const { initial: o, custom: c } = this.node.getProps();
        if (typeof o == "string") {
          const n = N(this.node, o, c);
          if (n) {
            const { transition: r, transitionEnd: a, ...h } = n;
            for (const l in h) this.node.getValue(l)?.jump(h[l]);
          }
        }
        this.node.animationState.reset(), this.node.animationState.animateChanges();
      } else this.node.animationState.setActive("exit", !1);
      this.isExitComplete = !1;
      return;
    }
    const s = this.node.animationState.setActive("exit", !t);
    e && !t && s.then(() => {
      this.isExitComplete = !0, e(this.id);
    });
  }
  mount() {
    const { register: t, onExitComplete: e } = this.node.presenceContext || {};
    e && e(this.id), t && (this.unmount = t(this.id));
  }
  unmount() {
  }
}, lo = {
  animation: { Feature: oo },
  exit: { Feature: ao }
};
function K(t) {
  return { point: {
    x: t.pageX,
    y: t.pageY
  } };
}
var co = (t) => (e) => It(e) && t(e, K(e));
function $(t, e, i, s) {
  return q(t, e, co(i), s);
}
var Ci = ({ current: t }) => t ? t.ownerDocument.defaultView : null, Ve = (t, e) => Math.abs(t - e);
function uo(t, e) {
  const i = Ve(t.x, e.x), s = Ve(t.y, e.y);
  return Math.sqrt(i ** 2 + s ** 2);
}
var Re = /* @__PURE__ */ new Set(["auto", "scroll"]), Di = class {
  constructor(t, e, { transformPagePoint: i, contextWindow: s = window, dragSnapToOrigin: o = !1, distanceThreshold: c = 3, element: n } = {}) {
    if (this.startEvent = null, this.lastMoveEvent = null, this.lastMoveEventInfo = null, this.lastRawMoveEventInfo = null, this.handlers = {}, this.contextWindow = window, this.scrollPositions = /* @__PURE__ */ new Map(), this.removeScrollListeners = null, this.onElementScroll = (u) => {
      this.handleScroll(u.target);
    }, this.onWindowScroll = () => {
      this.handleScroll(window);
    }, this.updatePoint = () => {
      if (!(this.lastMoveEvent && this.lastMoveEventInfo)) return;
      this.lastRawMoveEventInfo && (this.lastMoveEventInfo = Q(this.lastRawMoveEventInfo, this.transformPagePoint));
      const u = St(this.lastMoveEventInfo, this.history), f = this.startEvent !== null, m = uo(u.offset, {
        x: 0,
        y: 0
      }) >= this.distanceThreshold;
      if (!f && !m) return;
      const { point: d } = u, { timestamp: P } = D;
      this.history.push({
        ...d,
        timestamp: P
      });
      const { onStart: y, onMove: x } = this.handlers;
      f || (y && y(this.lastMoveEvent, u), this.startEvent = this.lastMoveEvent), x && x(this.lastMoveEvent, u);
    }, this.handlePointerMove = (u, f) => {
      this.lastMoveEvent = u, this.lastRawMoveEventInfo = f, this.lastMoveEventInfo = Q(f, this.transformPagePoint), E.update(this.updatePoint, !0);
    }, this.handlePointerUp = (u, f) => {
      this.end();
      const { onEnd: m, onSessionEnd: d, resumeAnimation: P } = this.handlers;
      if ((this.dragSnapToOrigin || !this.startEvent) && P && P(), !(this.lastMoveEvent && this.lastMoveEventInfo)) return;
      const y = St(u.type === "pointercancel" ? this.lastMoveEventInfo : Q(f, this.transformPagePoint), this.history);
      this.startEvent && m && m(u, y), d && d(u, y);
    }, !It(t)) return;
    this.dragSnapToOrigin = o, this.handlers = e, this.transformPagePoint = i, this.distanceThreshold = c, this.contextWindow = s || window;
    const r = Q(K(t), this.transformPagePoint), { point: a } = r, { timestamp: h } = D;
    this.history = [{
      ...a,
      timestamp: h
    }];
    const { onSessionStart: l } = e;
    l && l(t, St(r, this.history)), this.removeListeners = Xe($(this.contextWindow, "pointermove", this.handlePointerMove), $(this.contextWindow, "pointerup", this.handlePointerUp), $(this.contextWindow, "pointercancel", this.handlePointerUp)), n && this.startScrollTracking(n);
  }
  startScrollTracking(t) {
    let e = t.parentElement;
    for (; e; ) {
      const i = getComputedStyle(e);
      (Re.has(i.overflowX) || Re.has(i.overflowY)) && this.scrollPositions.set(e, {
        x: e.scrollLeft,
        y: e.scrollTop
      }), e = e.parentElement;
    }
    this.scrollPositions.set(window, {
      x: window.scrollX,
      y: window.scrollY
    }), window.addEventListener("scroll", this.onElementScroll, { capture: !0 }), window.addEventListener("scroll", this.onWindowScroll), this.removeScrollListeners = () => {
      window.removeEventListener("scroll", this.onElementScroll, { capture: !0 }), window.removeEventListener("scroll", this.onWindowScroll);
    };
  }
  handleScroll(t) {
    const e = this.scrollPositions.get(t);
    if (!e) return;
    const i = t === window, s = i ? {
      x: window.scrollX,
      y: window.scrollY
    } : {
      x: t.scrollLeft,
      y: t.scrollTop
    }, o = {
      x: s.x - e.x,
      y: s.y - e.y
    };
    o.x === 0 && o.y === 0 || (i ? this.lastMoveEventInfo && (this.lastMoveEventInfo.point.x += o.x, this.lastMoveEventInfo.point.y += o.y) : this.history.length > 0 && (this.history[0].x -= o.x, this.history[0].y -= o.y), this.scrollPositions.set(t, s), E.update(this.updatePoint, !0));
  }
  updateHandlers(t) {
    this.handlers = t;
  }
  end() {
    this.removeListeners && this.removeListeners(), this.removeScrollListeners && this.removeScrollListeners(), this.scrollPositions.clear(), Y(this.updatePoint);
  }
};
function Q(t, e) {
  return e ? { point: e(t.point) } : t;
}
function be(t, e) {
  return {
    x: t.x - e.x,
    y: t.y - e.y
  };
}
function St({ point: t }, e) {
  return {
    point: t,
    delta: be(t, Li(e)),
    offset: be(t, ho(e)),
    velocity: fo(e, 0.1)
  };
}
function ho(t) {
  return t[0];
}
function Li(t) {
  return t[t.length - 1];
}
function fo(t, e) {
  if (t.length < 2) return {
    x: 0,
    y: 0
  };
  let i = t.length - 1, s = null;
  const o = Li(t);
  for (; i >= 0 && (s = t[i], !(o.timestamp - s.timestamp > Xt(e))); )
    i--;
  if (!s) return {
    x: 0,
    y: 0
  };
  s === t[0] && t.length > 2 && o.timestamp - s.timestamp > Xt(e) * 2 && (s = t[1]);
  const c = Qi(o.timestamp - s.timestamp);
  if (c === 0) return {
    x: 0,
    y: 0
  };
  const n = {
    x: (o.x - s.x) / c,
    y: (o.y - s.y) / c
  };
  return n.x === 1 / 0 && (n.x = 0), n.y === 1 / 0 && (n.y = 0), n;
}
function mo(t, { min: e, max: i }, s) {
  return e !== void 0 && t < e ? t = s ? T(e, t, s.min) : Math.max(t, e) : i !== void 0 && t > i && (t = s ? T(i, t, s.max) : Math.min(t, i)), t;
}
function ke(t, e, i) {
  return {
    min: e !== void 0 ? t.min + e : void 0,
    max: i !== void 0 ? t.max + i - (t.max - t.min) : void 0
  };
}
function po(t, { top: e, left: i, bottom: s, right: o }) {
  return {
    x: ke(t.x, i, o),
    y: ke(t.y, e, s)
  };
}
function Me(t, e) {
  let i = e.min - t.min, s = e.max - t.max;
  return e.max - e.min < t.max - t.min && ([i, s] = [s, i]), {
    min: i,
    max: s
  };
}
function vo(t, e) {
  return {
    x: Me(t.x, e.x),
    y: Me(t.y, e.y)
  };
}
function yo(t, e) {
  let i = 0.5;
  const s = C(t), o = C(e);
  return o > s ? i = Lt(e.min, e.max - s, t.min) : s > o && (i = Lt(t.min, t.max - o, e.min)), Ze(0, 1, i);
}
function go(t, e) {
  const i = {};
  return e.min !== void 0 && (i.min = e.min - t.min), e.max !== void 0 && (i.max = e.max - t.min), i;
}
var kt = 0.35;
function xo(t = kt) {
  return t === !1 ? t = 0 : t === !0 && (t = kt), {
    x: je(t, "left", "right"),
    y: je(t, "top", "bottom")
  };
}
function je(t, e, i) {
  return {
    min: Be(t, e),
    max: Be(t, i)
  };
}
function Be(t, e) {
  return typeof t == "number" ? t : t[e] || 0;
}
var Po = /* @__PURE__ */ new WeakMap(), wo = class {
  constructor(t) {
    this.openDragLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = {
      x: 0,
      y: 0
    }, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = A(), this.latestPointerEvent = null, this.latestPanInfo = null, this.visualElement = t;
  }
  start(t, { snapToCursor: e = !1, distanceThreshold: i } = {}) {
    const { presenceContext: s } = this.visualElement;
    if (s && s.isPresent === !1) return;
    const o = (l) => {
      e && this.snapToCursor(K(l).point), this.stopAnimation();
    }, c = (l, u) => {
      const { drag: f, dragPropagation: m, onDragStart: d } = this.getProps();
      if (f && !m && (this.openDragLock && this.openDragLock(), this.openDragLock = xs(f), !this.openDragLock))
        return;
      this.latestPointerEvent = l, this.latestPanInfo = u, this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), b((y) => {
        let x = this.getAxisMotionValue(y).get() || 0;
        if (lt.test(x)) {
          const { projection: p } = this.visualElement;
          if (p && p.layout) {
            const g = p.layout.layoutBox[y];
            g && (x = C(g) * (parseFloat(x) / 100));
          }
        }
        this.originPoint[y] = x;
      }), d && E.update(() => d(l, u), !1, !0), _t(this.visualElement, "transform");
      const { animationState: P } = this.visualElement;
      P && P.setActive("whileDrag", !0);
    }, n = (l, u) => {
      this.latestPointerEvent = l, this.latestPanInfo = u;
      const { dragPropagation: f, dragDirectionLock: m, onDirectionLock: d, onDrag: P } = this.getProps();
      if (!f && !this.openDragLock) return;
      const { offset: y } = u;
      if (m && this.currentDirection === null) {
        this.currentDirection = So(y), this.currentDirection !== null && d && d(this.currentDirection);
        return;
      }
      this.updateAxis("x", u.point, y), this.updateAxis("y", u.point, y), this.visualElement.render(), P && E.update(() => P(l, u), !1, !0);
    }, r = (l, u) => {
      this.latestPointerEvent = l, this.latestPanInfo = u, this.stop(l, u), this.latestPointerEvent = null, this.latestPanInfo = null;
    }, a = () => {
      const { dragSnapToOrigin: l } = this.getProps();
      (l || this.constraints) && this.startAnimation({
        x: 0,
        y: 0
      });
    }, { dragSnapToOrigin: h } = this.getProps();
    this.panSession = new Di(t, {
      onSessionStart: o,
      onStart: c,
      onMove: n,
      onSessionEnd: r,
      resumeAnimation: a
    }, {
      transformPagePoint: this.visualElement.getTransformPagePoint(),
      dragSnapToOrigin: h,
      distanceThreshold: i,
      contextWindow: Ci(this.visualElement),
      element: this.visualElement.current
    });
  }
  stop(t, e) {
    const i = t || this.latestPointerEvent, s = e || this.latestPanInfo, o = this.isDragging;
    if (this.cancel(), !o || !s || !i) return;
    const { velocity: c } = s;
    this.startAnimation(c);
    const { onDragEnd: n } = this.getProps();
    n && E.postRender(() => n(i, s));
  }
  cancel() {
    this.isDragging = !1;
    const { projection: t, animationState: e } = this.visualElement;
    t && (t.isAnimationBlocked = !1), this.endPanSession();
    const { dragPropagation: i } = this.getProps();
    !i && this.openDragLock && (this.openDragLock(), this.openDragLock = null), e && e.setActive("whileDrag", !1);
  }
  endPanSession() {
    this.panSession && this.panSession.end(), this.panSession = void 0;
  }
  updateAxis(t, e, i) {
    const { drag: s } = this.getProps();
    if (!i || !tt(t, s, this.currentDirection)) return;
    const o = this.getAxisMotionValue(t);
    let c = this.originPoint[t] + i[t];
    this.constraints && this.constraints[t] && (c = mo(c, this.constraints[t], this.elastic[t])), o.set(c);
  }
  resolveConstraints() {
    const { dragConstraints: t, dragElastic: e } = this.getProps(), i = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : this.visualElement.projection?.layout, s = this.constraints;
    t && H(t) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : t && i ? this.constraints = po(i.layoutBox, t) : this.constraints = !1, this.elastic = xo(e), s !== this.constraints && !H(t) && i && this.constraints && !this.hasMutatedConstraints && b((o) => {
      this.constraints !== !1 && this.getAxisMotionValue(o) && (this.constraints[o] = go(i.layoutBox[o], this.constraints[o]));
    });
  }
  resolveRefConstraints() {
    const { dragConstraints: t, onMeasureDragConstraints: e } = this.getProps();
    if (!t || !H(t)) return !1;
    const i = t.current;
    Fi(i !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.", "drag-constraints-ref");
    const { projection: s } = this.visualElement;
    if (!s || !s.layout) return !1;
    const o = Ji(i, s.root, this.visualElement.getTransformPagePoint());
    let c = vo(s.layout.layoutBox, o);
    if (e) {
      const n = e(Ni(c));
      this.hasMutatedConstraints = !!n, n && (c = ds(n));
    }
    return c;
  }
  startAnimation(t) {
    const { drag: e, dragMomentum: i, dragElastic: s, dragTransition: o, dragSnapToOrigin: c, onDragTransitionEnd: n } = this.getProps(), r = this.constraints || {}, a = b((h) => {
      if (!tt(h, e, this.currentDirection)) return;
      let l = r && r[h] || {};
      (c === !0 || c === h) && (l = {
        min: 0,
        max: 0
      });
      const u = s ? 200 : 1e6, f = s ? 40 : 1e7, m = {
        type: "inertia",
        velocity: i ? t[h] : 0,
        bounceStiffness: u,
        bounceDamping: f,
        timeConstant: 750,
        restDelta: 1,
        restSpeed: 10,
        ...o,
        ...l
      };
      return this.startAxisValueAnimation(h, m);
    });
    return Promise.all(a).then(n);
  }
  startAxisValueAnimation(t, e) {
    const i = this.getAxisMotionValue(t);
    return _t(this.visualElement, t), i.start(Yi(t, i, 0, e, this.visualElement, !1));
  }
  stopAnimation() {
    b((t) => this.getAxisMotionValue(t).stop());
  }
  getAxisMotionValue(t) {
    const e = `_drag${t.toUpperCase()}`, i = this.visualElement.getProps(), s = i[e];
    return s || this.visualElement.getValue(t, (i.initial ? i.initial[t] : void 0) || 0);
  }
  snapToCursor(t) {
    b((e) => {
      const { drag: i } = this.getProps();
      if (!tt(e, i, this.currentDirection)) return;
      const { projection: s } = this.visualElement, o = this.getAxisMotionValue(e);
      if (s && s.layout) {
        const { min: c, max: n } = s.layout.layoutBox[e], r = o.get() || 0;
        o.set(t[e] - T(c, n, 0.5) + r);
      }
    });
  }
  scalePositionWithinConstraints() {
    if (!this.visualElement.current) return;
    const { drag: t, dragConstraints: e } = this.getProps(), { projection: i } = this.visualElement;
    if (!H(e) || !i || !this.constraints) return;
    this.stopAnimation();
    const s = {
      x: 0,
      y: 0
    };
    b((c) => {
      const n = this.getAxisMotionValue(c);
      if (n && this.constraints !== !1) {
        const r = n.get();
        s[c] = yo({
          min: r,
          max: r
        }, this.constraints[c]);
      }
    });
    const { transformTemplate: o } = this.visualElement.getProps();
    this.visualElement.current.style.transform = o ? o({}, "") : "none", i.root && i.root.updateScroll(), i.updateLayout(), this.constraints = !1, this.resolveConstraints(), b((c) => {
      if (!tt(c, t, null)) return;
      const n = this.getAxisMotionValue(c), { min: r, max: a } = this.constraints[c];
      n.set(T(r, a, s[c]));
    }), this.visualElement.render();
  }
  addListeners() {
    if (!this.visualElement.current) return;
    Po.set(this.visualElement, this);
    const t = this.visualElement.current, e = $(t, "pointerdown", (a) => {
      const { drag: h, dragListener: l = !0 } = this.getProps(), u = a.target, f = u !== t && Es(u);
      h && l && !f && this.start(a);
    });
    let i;
    const s = () => {
      const { dragConstraints: a } = this.getProps();
      H(a) && a.current && (this.constraints = this.resolveRefConstraints(), i || (i = To(t, a.current, () => this.scalePositionWithinConstraints())));
    }, { projection: o } = this.visualElement, c = o.addEventListener("measure", s);
    o && !o.layout && (o.root && o.root.updateScroll(), o.updateLayout()), E.read(s);
    const n = q(window, "resize", () => this.scalePositionWithinConstraints()), r = o.addEventListener("didUpdate", (({ delta: a, hasLayoutChanged: h }) => {
      this.isDragging && h && (b((l) => {
        const u = this.getAxisMotionValue(l);
        u && (this.originPoint[l] += a[l].translate, u.set(u.get() + a[l].translate));
      }), this.visualElement.render());
    }));
    return () => {
      n(), e(), c(), r && r(), i && i();
    };
  }
  getProps() {
    const t = this.visualElement.getProps(), { drag: e = !1, dragDirectionLock: i = !1, dragPropagation: s = !1, dragConstraints: o = !1, dragElastic: c = kt, dragMomentum: n = !0 } = t;
    return {
      ...t,
      drag: e,
      dragDirectionLock: i,
      dragPropagation: s,
      dragConstraints: o,
      dragElastic: c,
      dragMomentum: n
    };
  }
};
function Ie(t) {
  let e = !0;
  return () => {
    if (e) {
      e = !1;
      return;
    }
    t();
  };
}
function To(t, e, i) {
  const s = te(t, Ie(i)), o = te(e, Ie(i));
  return () => {
    s(), o();
  };
}
function tt(t, e, i) {
  return (e === !0 || e === t) && (i === null || i === t);
}
function So(t, e = 10) {
  let i = null;
  return Math.abs(t.y) > e ? i = "y" : Math.abs(t.x) > e && (i = "x"), i;
}
var Ao = class extends k {
  constructor(t) {
    super(t), this.removeGroupControls = G, this.removeListeners = G, this.controls = new wo(t);
  }
  mount() {
    const { dragControls: t } = this.node.getProps();
    t && (this.removeGroupControls = t.subscribe(this.controls)), this.removeListeners = this.controls.addListeners() || G;
  }
  update() {
    const { dragControls: t } = this.node.getProps(), { dragControls: e } = this.node.prevProps || {};
    t !== e && (this.removeGroupControls(), t && (this.removeGroupControls = t.subscribe(this.controls)));
  }
  unmount() {
    this.removeGroupControls(), this.removeListeners(), this.controls.isDragging || this.controls.endPanSession();
  }
}, At = (t) => (e, i) => {
  t && E.update(() => t(e, i), !1, !0);
}, Eo = class extends k {
  constructor() {
    super(...arguments), this.removePointerDownListener = G;
  }
  onPointerDown(t) {
    this.session = new Di(t, this.createPanHandlers(), {
      transformPagePoint: this.node.getTransformPagePoint(),
      contextWindow: Ci(this.node)
    });
  }
  createPanHandlers() {
    const { onPanSessionStart: t, onPanStart: e, onPan: i, onPanEnd: s } = this.node.getProps();
    return {
      onSessionStart: At(t),
      onStart: At(e),
      onMove: At(i),
      onEnd: (o, c) => {
        delete this.session, s && E.postRender(() => s(o, c));
      }
    };
  }
  mount() {
    this.removePointerDownListener = $(this.node.current, "pointerdown", (t) => this.onPointerDown(t));
  }
  update() {
    this.session && this.session.updateHandlers(this.createPanHandlers());
  }
  unmount() {
    this.removePointerDownListener(), this.session && this.session.end();
  }
}, Et = !1, Co = class extends v.Component {
  componentDidMount() {
    const { visualElement: t, layoutGroup: e, switchLayoutGroup: i, layoutId: s } = this.props, { projection: o } = t;
    o && (e.group && e.group.add(o), i && i.register && s && i.register(o), Et && o.root.didUpdate(), o.addEventListener("animationComplete", () => {
      this.safeToRemove();
    }), o.setOptions({
      ...o.options,
      layoutDependency: this.props.layoutDependency,
      onExitComplete: () => this.safeToRemove()
    })), rt.hasEverUpdated = !0;
  }
  getSnapshotBeforeUpdate(t) {
    const { layoutDependency: e, visualElement: i, drag: s, isPresent: o } = this.props, { projection: c } = i;
    return c && (c.isPresent = o, t.layoutDependency !== e && c.setOptions({
      ...c.options,
      layoutDependency: e
    }), Et = !0, s || t.layoutDependency !== e || e === void 0 || t.isPresent !== o ? c.willUpdate() : this.safeToRemove(), t.isPresent !== o && (o ? c.promote() : c.relegate() || E.postRender(() => {
      const n = c.getStack();
      (!n || !n.members.length) && this.safeToRemove();
    }))), null;
  }
  componentDidUpdate() {
    const { visualElement: t, layoutAnchor: e } = this.props, { projection: i } = t;
    i && (i.options.layoutAnchor = e, i.root.didUpdate(), He.postRender(() => {
      !i.currentAnimation && i.isLead() && this.safeToRemove();
    }));
  }
  componentWillUnmount() {
    const { visualElement: t, layoutGroup: e, switchLayoutGroup: i } = this.props, { projection: s } = t;
    Et = !0, s && (s.scheduleCheckAfterUnmount(), e && e.group && e.group.remove(s), i && i.deregister && i.deregister(s));
  }
  safeToRemove() {
    const { safeToRemove: t } = this.props;
    t && t();
  }
  render() {
    return null;
  }
};
function Vi(t) {
  const [e, i] = Ln(), s = (0, v.useContext)(Qe);
  return (0, Vt.jsx)(Co, {
    ...t,
    layoutGroup: s,
    switchLayoutGroup: (0, v.useContext)(Ai),
    isPresent: e,
    safeToRemove: i
  });
}
var Do = {
  pan: { Feature: Eo },
  drag: {
    Feature: Ao,
    ProjectionNode: vi,
    MeasureLayout: Vi
  }
};
function Oe(t, e, i) {
  const { props: s } = t;
  t.animationState && s.whileHover && t.animationState.setActive("whileHover", i === "Start");
  const o = s["onHover" + i];
  o && E.postRender(() => o(e, K(e)));
}
var Lo = class extends k {
  mount() {
    const { current: t } = this.node;
    t && (this.unmount = ws(t, (e, i) => (Oe(this.node, i, "Start"), (s) => Oe(this.node, s, "End"))));
  }
  unmount() {
  }
}, Vo = class extends k {
  constructor() {
    super(...arguments), this.isActive = !1;
  }
  onFocus() {
    let t = !1;
    try {
      t = this.node.current.matches(":focus-visible");
    } catch {
      t = !0;
    }
    !t || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !0), this.isActive = !0);
  }
  onBlur() {
    !this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1);
  }
  mount() {
    this.unmount = Xe(q(this.node.current, "focus", () => this.onFocus()), q(this.node.current, "blur", () => this.onBlur()));
  }
  unmount() {
  }
};
function Fe(t, e, i) {
  const { props: s } = t;
  if (t.current instanceof HTMLButtonElement && t.current.disabled) return;
  t.animationState && s.whileTap && t.animationState.setActive("whileTap", i === "Start");
  const o = s["onTap" + (i === "End" ? "" : i)];
  o && E.postRender(() => o(e, K(e)));
}
var Ro = class extends k {
  mount() {
    const { current: t } = this.node;
    if (!t) return;
    const { globalTapTarget: e, propagate: i } = this.node.props;
    this.unmount = Ds(t, (s, o) => (Fe(this.node, o, "Start"), (c, { success: n }) => Fe(this.node, c, n ? "End" : "Cancel")), {
      useGlobalTarget: e,
      stopPropagation: i?.tap === !1
    });
  }
  unmount() {
  }
}, Mt = /* @__PURE__ */ new WeakMap(), Ct = /* @__PURE__ */ new WeakMap(), bo = (t) => {
  const e = Mt.get(t.target);
  e && e(t);
}, ko = (t) => {
  t.forEach(bo);
};
function Mo({ root: t, ...e }) {
  const i = t || document;
  Ct.has(i) || Ct.set(i, {});
  const s = Ct.get(i), o = JSON.stringify(e);
  return s[o] || (s[o] = new IntersectionObserver(ko, {
    root: t,
    ...e
  })), s[o];
}
function jo(t, e, i) {
  const s = Mo(e);
  return Mt.set(t, i), s.observe(t), () => {
    Mt.delete(t), s.unobserve(t);
  };
}
var Bo = {
  some: 0,
  all: 1
}, Io = class extends k {
  constructor() {
    super(...arguments), this.hasEnteredView = !1, this.isInView = !1;
  }
  startObserver() {
    this.stopObserver?.();
    const { viewport: t = {} } = this.node.getProps(), { root: e, margin: i, amount: s = "some", once: o } = t, c = {
      root: e ? e.current : void 0,
      rootMargin: i,
      threshold: typeof s == "number" ? s : Bo[s]
    }, n = (r) => {
      const { isIntersecting: a } = r;
      if (this.isInView === a || (this.isInView = a, o && !a && this.hasEnteredView)) return;
      a && (this.hasEnteredView = !0), this.node.animationState && this.node.animationState.setActive("whileInView", a);
      const { onViewportEnter: h, onViewportLeave: l } = this.node.getProps(), u = a ? h : l;
      u && u(r);
    };
    this.stopObserver = jo(this.node.current, c, n);
  }
  mount() {
    this.startObserver();
  }
  update() {
    if (typeof IntersectionObserver > "u") return;
    const { props: t, prevProps: e } = this.node;
    [
      "amount",
      "margin",
      "root"
    ].some(Oo(t, e)) && this.startObserver();
  }
  unmount() {
    this.stopObserver?.(), this.hasEnteredView = !1, this.isInView = !1;
  }
};
function Oo({ viewport: t = {} }, { viewport: e = {} } = {}) {
  return (i) => t[i] !== e[i];
}
var Fo = {
  inView: { Feature: Io },
  tap: { Feature: Ro },
  focus: { Feature: Vo },
  hover: { Feature: Lo }
}, Uo = { layout: {
  ProjectionNode: vi,
  MeasureLayout: Vi
} }, Ho = {
  ...lo,
  ...Fo,
  ...Do,
  ...Uo
}, _o = /* @__PURE__ */ so(Ho, no);
export {
  ps as a,
  Bt as i,
  Ln as n,
  Qe as o,
  gs as r,
  _o as t
};

//# sourceMappingURL=proxy.js.map