import { createContext as Rn, useRef as Bn, useContext as In, useId as kn, useEffect as Nn } from "react";
const $n = Rn(null), Pt = typeof document < "u", $e = (e) => e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), jn = "framerAppearId", Ln = "data-" + $e(jn);
function Kn(e) {
  return typeof e == "object" && Object.prototype.hasOwnProperty.call(e, "current");
}
function Dt(e) {
  return typeof e == "string" || Array.isArray(e);
}
function Wn(e) {
  return typeof e == "object" && typeof e.start == "function";
}
const zn = [
  "animate",
  "whileInView",
  "whileFocus",
  "whileHover",
  "whileTap",
  "whileDrag",
  "exit"
], je = ["initial", ...zn];
function Ot(e) {
  return Wn(e.animate) || je.some((t) => Dt(e[t]));
}
function Gn(e) {
  return !!(Ot(e) || e.variants);
}
const tt = {
  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"]
}, Le = {};
for (const e in tt)
  Le[e] = {
    isEnabled: (t) => tt[e].some((n) => !!t[n])
  };
const Rt = {};
function co(e) {
  Object.assign(Rt, e);
}
const ne = [
  "transformPerspective",
  "x",
  "y",
  "z",
  "translateX",
  "translateY",
  "translateZ",
  "scale",
  "scaleX",
  "scaleY",
  "rotate",
  "rotateX",
  "rotateY",
  "rotateZ",
  "skew",
  "skewX",
  "skewY"
], L = new Set(ne);
function Un(e, { layout: t, layoutId: n }) {
  return L.has(e) || e.startsWith("origin") || (t || n !== void 0) && (!!Rt[e] || e === "opacity");
}
const O = (e) => !!(e && e.getVelocity), En = {
  x: "translateX",
  y: "translateY",
  z: "translateZ",
  transformPerspective: "perspective"
}, _n = ne.length;
function qn(e, { enableHardwareAcceleration: t = !0, allowTransformNone: n = !0 }, s, r) {
  let o = "";
  for (let i = 0; i < _n; i++) {
    const c = ne[i];
    if (e[c] !== void 0) {
      const a = En[c] || c;
      o += `${a}(${e[c]}) `;
    }
  }
  return t && !e.z && (o += "translateZ(0)"), o = o.trim(), r ? o = r(e, s ? "" : o) : n && s && (o = "none"), o;
}
const Bt = (e) => (t) => typeof t == "string" && t.startsWith(e), It = Bt("--"), Fe = Bt("var(--"), Hn = /var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g, Yn = (e, t) => t && typeof e == "number" ? t.transform(e) : e, E = (e, t, n) => Math.min(Math.max(n, e), t), K = {
  test: (e) => typeof e == "number",
  parse: parseFloat,
  transform: (e) => e
}, ee = {
  ...K,
  transform: (e) => E(0, 1, e)
}, le = {
  ...K,
  default: 1
}, te = (e) => Math.round(e * 1e5) / 1e5, be = /(-)?([\d]*\.?[\d])+/g, kt = /(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi, Xn = /^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;
function se(e) {
  return typeof e == "string";
}
const re = (e) => ({
  test: (t) => se(t) && t.endsWith(e) && t.split(" ").length === 1,
  parse: parseFloat,
  transform: (t) => `${t}${e}`
}), B = re("deg"), U = re("%"), m = re("px"), Zn = re("vh"), Qn = re("vw"), nt = {
  ...U,
  parse: (e) => U.parse(e) / 100,
  transform: (e) => U.transform(e * 100)
}, st = {
  ...K,
  transform: Math.round
}, Nt = {
  // Border props
  borderWidth: m,
  borderTopWidth: m,
  borderRightWidth: m,
  borderBottomWidth: m,
  borderLeftWidth: m,
  borderRadius: m,
  radius: m,
  borderTopLeftRadius: m,
  borderTopRightRadius: m,
  borderBottomRightRadius: m,
  borderBottomLeftRadius: m,
  // Positioning props
  width: m,
  maxWidth: m,
  height: m,
  maxHeight: m,
  size: m,
  top: m,
  right: m,
  bottom: m,
  left: m,
  // Spacing props
  padding: m,
  paddingTop: m,
  paddingRight: m,
  paddingBottom: m,
  paddingLeft: m,
  margin: m,
  marginTop: m,
  marginRight: m,
  marginBottom: m,
  marginLeft: m,
  // Transform props
  rotate: B,
  rotateX: B,
  rotateY: B,
  rotateZ: B,
  scale: le,
  scaleX: le,
  scaleY: le,
  scaleZ: le,
  skew: B,
  skewX: B,
  skewY: B,
  distance: m,
  translateX: m,
  translateY: m,
  translateZ: m,
  x: m,
  y: m,
  z: m,
  perspective: m,
  transformPerspective: m,
  opacity: ee,
  originX: nt,
  originY: nt,
  originZ: m,
  // Misc
  zIndex: st,
  // SVG
  fillOpacity: ee,
  strokeOpacity: ee,
  numOctaves: st
};
function $t(e, t, n, s) {
  const { style: r, vars: o, transform: i, transformOrigin: c } = e;
  let a = !1, l = !1, u = !0;
  for (const f in t) {
    const d = t[f];
    if (It(f)) {
      o[f] = d;
      continue;
    }
    const h = Nt[f], p = Yn(d, h);
    if (L.has(f)) {
      if (a = !0, i[f] = p, !u)
        continue;
      d !== (h.default || 0) && (u = !1);
    } else
      f.startsWith("origin") ? (l = !0, c[f] = p) : r[f] = p;
  }
  if (t.transform || (a || s ? r.transform = qn(e.transform, n, u, s) : r.transform && (r.transform = "none")), l) {
    const { originX: f = "50%", originY: d = "50%", originZ: h = 0 } = c;
    r.transformOrigin = `${f} ${d} ${h}`;
  }
}
function rt(e, t, n) {
  return typeof e == "string" ? e : m.transform(t + n * e);
}
function Jn(e, t, n) {
  const s = rt(t, e.x, e.width), r = rt(n, e.y, e.height);
  return `${s} ${r}`;
}
const es = {
  offset: "stroke-dashoffset",
  array: "stroke-dasharray"
}, ts = {
  offset: "strokeDashoffset",
  array: "strokeDasharray"
};
function ns(e, t, n = 1, s = 0, r = !0) {
  e.pathLength = 1;
  const o = r ? es : ts;
  e[o.offset] = m.transform(-s);
  const i = m.transform(t), c = m.transform(n);
  e[o.array] = `${i} ${c}`;
}
function ss(e, {
  attrX: t,
  attrY: n,
  attrScale: s,
  originX: r,
  originY: o,
  pathLength: i,
  pathSpacing: c = 1,
  pathOffset: a = 0,
  // This is object creation, which we try to avoid per-frame.
  ...l
}, u, f, d) {
  if ($t(e, l, u, d), f) {
    e.style.viewBox && (e.attrs.viewBox = e.style.viewBox);
    return;
  }
  e.attrs = e.style, e.style = {};
  const { attrs: h, style: p, dimensions: y } = e;
  h.transform && (y && (p.transform = h.transform), delete h.transform), y && (r !== void 0 || o !== void 0 || p.transform) && (p.transformOrigin = Jn(y, r !== void 0 ? r : 0.5, o !== void 0 ? o : 0.5)), t !== void 0 && (h.x = t), n !== void 0 && (h.y = n), s !== void 0 && (h.scale = s), i !== void 0 && ns(h, i, c, a, !1);
}
const rs = (e) => typeof e == "string" && e.toLowerCase() === "svg";
function jt(e, { style: t, vars: n }, s, r) {
  Object.assign(e.style, t, r && r.getProjectionStyles(s));
  for (const o in n)
    e.style.setProperty(o, n[o]);
}
const Lt = /* @__PURE__ */ new Set([
  "baseFrequency",
  "diffuseConstant",
  "kernelMatrix",
  "kernelUnitLength",
  "keySplines",
  "keyTimes",
  "limitingConeAngle",
  "markerHeight",
  "markerWidth",
  "numOctaves",
  "targetX",
  "targetY",
  "surfaceScale",
  "specularConstant",
  "specularExponent",
  "stdDeviation",
  "tableValues",
  "viewBox",
  "gradientTransform",
  "pathLength",
  "startOffset",
  "textLength",
  "lengthAdjust"
]);
function os(e, t, n, s) {
  jt(e, t, void 0, s);
  for (const r in t.attrs)
    e.setAttribute(Lt.has(r) ? r : $e(r), t.attrs[r]);
}
function Kt(e, t) {
  const { style: n } = e, s = {};
  for (const r in n)
    (O(n[r]) || t.style && O(t.style[r]) || Un(r, e)) && (s[r] = n[r]);
  return s;
}
function is(e, t) {
  const n = Kt(e, t);
  for (const s in e)
    if (O(e[s]) || O(t[s])) {
      const r = ne.indexOf(s) !== -1 ? "attr" + s.charAt(0).toUpperCase() + s.substring(1) : s;
      n[r] = e[s];
    }
  return n;
}
function Wt(e, t, n, s = {}, r = {}) {
  return typeof t == "function" && (t = t(n !== void 0 ? n : e.custom, s, r)), typeof t == "string" && (t = e.variants && e.variants[t]), typeof t == "function" && (t = t(n !== void 0 ? n : e.custom, s, r)), t;
}
function lo(e) {
  const t = Bn(null);
  return t.current === null && (t.current = e()), t.current;
}
const zt = (e) => Array.isArray(e), uo = (e) => !!(e && typeof e == "object" && e.mix && e.toValue), as = (e) => zt(e) ? e[e.length - 1] || 0 : e, P = (e) => e;
class ot {
  constructor() {
    this.order = [], this.scheduled = /* @__PURE__ */ new Set();
  }
  add(t) {
    if (!this.scheduled.has(t))
      return this.scheduled.add(t), this.order.push(t), !0;
  }
  remove(t) {
    const n = this.order.indexOf(t);
    n !== -1 && (this.order.splice(n, 1), this.scheduled.delete(t));
  }
  clear() {
    this.order.length = 0, this.scheduled.clear();
  }
}
function cs(e) {
  let t = new ot(), n = new ot(), s = 0, r = !1, o = !1;
  const i = /* @__PURE__ */ new WeakSet(), c = {
    /**
     * Schedule a process to run on the next frame.
     */
    schedule: (a, l = !1, u = !1) => {
      const f = u && r, d = f ? t : n;
      return l && i.add(a), d.add(a) && f && r && (s = t.order.length), a;
    },
    /**
     * Cancel the provided callback from running on the next frame.
     */
    cancel: (a) => {
      n.remove(a), i.delete(a);
    },
    /**
     * Execute all schedule callbacks.
     */
    process: (a) => {
      if (r) {
        o = !0;
        return;
      }
      if (r = !0, [t, n] = [n, t], n.clear(), s = t.order.length, s)
        for (let l = 0; l < s; l++) {
          const u = t.order[l];
          u(a), i.has(u) && (c.schedule(u), e());
        }
      r = !1, o && (o = !1, c.process(a));
    }
  };
  return c;
}
const ue = [
  "prepare",
  "read",
  "update",
  "preRender",
  "render",
  "postRender"
], ls = 40;
function us(e, t) {
  let n = !1, s = !0;
  const r = {
    delta: 0,
    timestamp: 0,
    isProcessing: !1
  }, o = ue.reduce((f, d) => (f[d] = cs(() => n = !0), f), {}), i = (f) => o[f].process(r), c = () => {
    const f = performance.now();
    n = !1, r.delta = s ? 1e3 / 60 : Math.max(Math.min(f - r.timestamp, ls), 1), r.timestamp = f, r.isProcessing = !0, ue.forEach(i), r.isProcessing = !1, n && t && (s = !1, e(c));
  }, a = () => {
    n = !0, s = !0, r.isProcessing || e(c);
  };
  return { schedule: ue.reduce((f, d) => {
    const h = o[d];
    return f[d] = (p, y = !1, V = !1) => (n || a(), h.schedule(p, y, V)), f;
  }, {}), cancel: (f) => ue.forEach((d) => o[d].cancel(f)), state: r, steps: o };
}
const { schedule: I, cancel: de, state: Pe, steps: fo } = us(typeof requestAnimationFrame < "u" ? requestAnimationFrame : P, !0), fs = (e, t) => (n) => t(e(n)), Gt = (...e) => e.reduce(fs);
function hs(e) {
  const t = {};
  return e.values.forEach((n, s) => t[s] = n.get()), t;
}
function ds(e) {
  const t = {};
  return e.values.forEach((n, s) => t[s] = n.getVelocity()), t;
}
function ps(e, t, n) {
  const s = e.getProps();
  return Wt(s, t, n !== void 0 ? n : s.custom, hs(e), ds(e));
}
let oe = P, R = P;
process.env.NODE_ENV !== "production" && (oe = (e, t) => {
  !e && typeof console < "u" && console.warn(t);
}, R = (e, t) => {
  if (!e)
    throw new Error(t);
});
const j = (e) => e * 1e3, k = (e) => e / 1e3, ms = {
  current: !1
}, Ut = (e) => Array.isArray(e) && typeof e[0] == "number";
function Et(e) {
  return !!(!e || typeof e == "string" && _t[e] || Ut(e) || Array.isArray(e) && e.every(Et));
}
const J = ([e, t, n, s]) => `cubic-bezier(${e}, ${t}, ${n}, ${s})`, _t = {
  linear: "linear",
  ease: "ease",
  easeIn: "ease-in",
  easeOut: "ease-out",
  easeInOut: "ease-in-out",
  circIn: J([0, 0.65, 0.55, 1]),
  circOut: J([0.55, 0, 1, 0.45]),
  backIn: J([0.31, 0.01, 0.66, -0.59]),
  backOut: J([0.33, 1.53, 0.69, 0.99])
};
function qt(e) {
  if (e)
    return Ut(e) ? J(e) : Array.isArray(e) ? e.map(qt) : _t[e];
}
function gs(e, t, n, { delay: s = 0, duration: r, repeat: o = 0, repeatType: i = "loop", ease: c, times: a } = {}) {
  const l = { [t]: n };
  a && (l.offset = a);
  const u = qt(c);
  return Array.isArray(u) && (l.easing = u), e.animate(l, {
    delay: s,
    duration: r,
    easing: Array.isArray(u) ? "linear" : u,
    fill: "both",
    iterations: o + 1,
    direction: i === "reverse" ? "alternate" : "normal"
  });
}
function ys(e, { repeat: t, repeatType: n = "loop" }) {
  const s = t && n !== "loop" && t % 2 === 1 ? 0 : e.length - 1;
  return e[s];
}
const Ht = (e, t, n) => (((1 - 3 * n + 3 * t) * e + (3 * n - 6 * t)) * e + 3 * t) * e, bs = 1e-7, Vs = 12;
function xs(e, t, n, s, r) {
  let o, i, c = 0;
  do
    i = t + (n - t) / 2, o = Ht(i, s, r) - e, o > 0 ? n = i : t = i;
  while (Math.abs(o) > bs && ++c < Vs);
  return i;
}
function ie(e, t, n, s) {
  if (e === t && n === s)
    return P;
  const r = (o) => xs(o, 0, 1, e, n);
  return (o) => o === 0 || o === 1 ? o : Ht(r(o), t, s);
}
const vs = ie(0.42, 0, 1, 1), Ts = ie(0, 0, 0.58, 1), Yt = ie(0.42, 0, 0.58, 1), ws = (e) => Array.isArray(e) && typeof e[0] != "number", Xt = (e) => (t) => t <= 0.5 ? e(2 * t) / 2 : (2 - e(2 * (1 - t))) / 2, Zt = (e) => (t) => 1 - e(1 - t), Ke = (e) => 1 - Math.sin(Math.acos(e)), Ms = Zt(Ke), As = Xt(Ke), Qt = ie(0.33, 1.53, 0.69, 0.99), We = Zt(Qt), Cs = Xt(We), Ss = (e) => (e *= 2) < 1 ? 0.5 * We(e) : 0.5 * (2 - Math.pow(2, -10 * (e - 1))), it = {
  linear: P,
  easeIn: vs,
  easeInOut: Yt,
  easeOut: Ts,
  circIn: Ke,
  circInOut: As,
  circOut: Ms,
  backIn: We,
  backInOut: Cs,
  backOut: Qt,
  anticipate: Ss
}, at = (e) => {
  if (Array.isArray(e)) {
    R(e.length === 4, "Cubic bezier arrays must contain four numerical values.");
    const [t, n, s, r] = e;
    return ie(t, n, s, r);
  } else if (typeof e == "string")
    return R(it[e] !== void 0, `Invalid easing type '${e}'`), it[e];
  return e;
}, ze = (e, t) => (n) => !!(se(n) && Xn.test(n) && n.startsWith(e) || t && Object.prototype.hasOwnProperty.call(n, t)), Jt = (e, t, n) => (s) => {
  if (!se(s))
    return s;
  const [r, o, i, c] = s.match(be);
  return {
    [e]: parseFloat(r),
    [t]: parseFloat(o),
    [n]: parseFloat(i),
    alpha: c !== void 0 ? parseFloat(c) : 1
  };
}, Fs = (e) => E(0, 255, e), Te = {
  ...K,
  transform: (e) => Math.round(Fs(e))
}, $ = {
  test: ze("rgb", "red"),
  parse: Jt("red", "green", "blue"),
  transform: ({ red: e, green: t, blue: n, alpha: s = 1 }) => "rgba(" + Te.transform(e) + ", " + Te.transform(t) + ", " + Te.transform(n) + ", " + te(ee.transform(s)) + ")"
};
function Ps(e) {
  let t = "", n = "", s = "", r = "";
  return e.length > 5 ? (t = e.substring(1, 3), n = e.substring(3, 5), s = e.substring(5, 7), r = e.substring(7, 9)) : (t = e.substring(1, 2), n = e.substring(2, 3), s = e.substring(3, 4), r = e.substring(4, 5), t += t, n += n, s += s, r += r), {
    red: parseInt(t, 16),
    green: parseInt(n, 16),
    blue: parseInt(s, 16),
    alpha: r ? parseInt(r, 16) / 255 : 1
  };
}
const De = {
  test: ze("#"),
  parse: Ps,
  transform: $.transform
}, G = {
  test: ze("hsl", "hue"),
  parse: Jt("hue", "saturation", "lightness"),
  transform: ({ hue: e, saturation: t, lightness: n, alpha: s = 1 }) => "hsla(" + Math.round(e) + ", " + U.transform(te(t)) + ", " + U.transform(te(n)) + ", " + te(ee.transform(s)) + ")"
}, S = {
  test: (e) => $.test(e) || De.test(e) || G.test(e),
  parse: (e) => $.test(e) ? $.parse(e) : G.test(e) ? G.parse(e) : De.parse(e),
  transform: (e) => se(e) ? e : e.hasOwnProperty("red") ? $.transform(e) : G.transform(e)
}, ae = (e, t, n) => -n * e + n * t + e;
function we(e, t, n) {
  return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? e + (t - e) * 6 * n : n < 1 / 2 ? t : n < 2 / 3 ? e + (t - e) * (2 / 3 - n) * 6 : e;
}
function Ds({ hue: e, saturation: t, lightness: n, alpha: s }) {
  e /= 360, t /= 100, n /= 100;
  let r = 0, o = 0, i = 0;
  if (!t)
    r = o = i = n;
  else {
    const c = n < 0.5 ? n * (1 + t) : n + t - n * t, a = 2 * n - c;
    r = we(a, c, e + 1 / 3), o = we(a, c, e), i = we(a, c, e - 1 / 3);
  }
  return {
    red: Math.round(r * 255),
    green: Math.round(o * 255),
    blue: Math.round(i * 255),
    alpha: s
  };
}
const Me = (e, t, n) => {
  const s = e * e;
  return Math.sqrt(Math.max(0, n * (t * t - s) + s));
}, Os = [De, $, G], Rs = (e) => Os.find((t) => t.test(e));
function ct(e) {
  const t = Rs(e);
  R(!!t, `'${e}' is not an animatable color. Use the equivalent color code instead.`);
  let n = t.parse(e);
  return t === G && (n = Ds(n)), n;
}
const en = (e, t) => {
  const n = ct(e), s = ct(t), r = { ...n };
  return (o) => (r.red = Me(n.red, s.red, o), r.green = Me(n.green, s.green, o), r.blue = Me(n.blue, s.blue, o), r.alpha = ae(n.alpha, s.alpha, o), $.transform(r));
};
function Bs(e) {
  var t, n;
  return isNaN(e) && se(e) && (((t = e.match(be)) === null || t === void 0 ? void 0 : t.length) || 0) + (((n = e.match(kt)) === null || n === void 0 ? void 0 : n.length) || 0) > 0;
}
const tn = {
  regex: Hn,
  countKey: "Vars",
  token: "${v}",
  parse: P
}, nn = {
  regex: kt,
  countKey: "Colors",
  token: "${c}",
  parse: S.parse
}, sn = {
  regex: be,
  countKey: "Numbers",
  token: "${n}",
  parse: K.parse
};
function Ae(e, { regex: t, countKey: n, token: s, parse: r }) {
  const o = e.tokenised.match(t);
  o && (e["num" + n] = o.length, e.tokenised = e.tokenised.replace(t, s), e.values.push(...o.map(r)));
}
function pe(e) {
  const t = e.toString(), n = {
    value: t,
    tokenised: t,
    values: [],
    numVars: 0,
    numColors: 0,
    numNumbers: 0
  };
  return n.value.includes("var(--") && Ae(n, tn), Ae(n, nn), Ae(n, sn), n;
}
function rn(e) {
  return pe(e).values;
}
function on(e) {
  const { values: t, numColors: n, numVars: s, tokenised: r } = pe(e), o = t.length;
  return (i) => {
    let c = r;
    for (let a = 0; a < o; a++)
      a < s ? c = c.replace(tn.token, i[a]) : a < s + n ? c = c.replace(nn.token, S.transform(i[a])) : c = c.replace(sn.token, te(i[a]));
    return c;
  };
}
const Is = (e) => typeof e == "number" ? 0 : e;
function ks(e) {
  const t = rn(e);
  return on(e)(t.map(Is));
}
const H = {
  test: Bs,
  parse: rn,
  createTransformer: on,
  getAnimatableNone: ks
}, an = (e, t) => (n) => `${n > 0 ? t : e}`;
function cn(e, t) {
  return typeof e == "number" ? (n) => ae(e, t, n) : S.test(e) ? en(e, t) : e.startsWith("var(") ? an(e, t) : un(e, t);
}
const ln = (e, t) => {
  const n = [...e], s = n.length, r = e.map((o, i) => cn(o, t[i]));
  return (o) => {
    for (let i = 0; i < s; i++)
      n[i] = r[i](o);
    return n;
  };
}, Ns = (e, t) => {
  const n = { ...e, ...t }, s = {};
  for (const r in n)
    e[r] !== void 0 && t[r] !== void 0 && (s[r] = cn(e[r], t[r]));
  return (r) => {
    for (const o in s)
      n[o] = s[o](r);
    return n;
  };
}, un = (e, t) => {
  const n = H.createTransformer(t), s = pe(e), r = pe(t);
  return s.numVars === r.numVars && s.numColors === r.numColors && s.numNumbers >= r.numNumbers ? Gt(ln(s.values, r.values), n) : (oe(!0, `Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`), an(e, t));
}, fn = (e, t, n) => {
  const s = t - e;
  return s === 0 ? 1 : (n - e) / s;
}, lt = (e, t) => (n) => ae(e, t, n);
function $s(e) {
  return typeof e == "number" ? lt : typeof e == "string" ? S.test(e) ? en : un : Array.isArray(e) ? ln : typeof e == "object" ? Ns : lt;
}
function js(e, t, n) {
  const s = [], r = n || $s(e[0]), o = e.length - 1;
  for (let i = 0; i < o; i++) {
    let c = r(e[i], e[i + 1]);
    if (t) {
      const a = Array.isArray(t) ? t[i] || P : t;
      c = Gt(a, c);
    }
    s.push(c);
  }
  return s;
}
function hn(e, t, { clamp: n = !0, ease: s, mixer: r } = {}) {
  const o = e.length;
  if (R(o === t.length, "Both input and output ranges must be the same length"), o === 1)
    return () => t[0];
  e[0] > e[o - 1] && (e = [...e].reverse(), t = [...t].reverse());
  const i = js(t, s, r), c = i.length, a = (l) => {
    let u = 0;
    if (c > 1)
      for (; u < e.length - 2 && !(l < e[u + 1]); u++)
        ;
    const f = fn(e[u], e[u + 1], l);
    return i[u](f);
  };
  return n ? (l) => a(E(e[0], e[o - 1], l)) : a;
}
function Ls(e, t) {
  const n = e[e.length - 1];
  for (let s = 1; s <= t; s++) {
    const r = fn(0, t, s);
    e.push(ae(n, 1, r));
  }
}
function Ks(e) {
  const t = [0];
  return Ls(t, e.length - 1), t;
}
function Ws(e, t) {
  return e.map((n) => n * t);
}
function zs(e, t) {
  return e.map(() => t || Yt).splice(0, e.length - 1);
}
function me({ duration: e = 300, keyframes: t, times: n, ease: s = "easeInOut" }) {
  const r = ws(s) ? s.map(at) : at(s), o = {
    done: !1,
    value: t[0]
  }, i = Ws(
    // Only use the provided offsets if they're the correct length
    // TODO Maybe we should warn here if there's a length mismatch
    n && n.length === t.length ? n : Ks(t),
    e
  ), c = hn(i, t, {
    ease: Array.isArray(r) ? r : zs(t, r)
  });
  return {
    calculatedDuration: e,
    next: (a) => (o.value = c(a), o.done = a >= e, o)
  };
}
function dn(e, t) {
  return t ? e * (1e3 / t) : 0;
}
const Gs = 5;
function pn(e, t, n) {
  const s = Math.max(t - Gs, 0);
  return dn(n - e(s), t - s);
}
const Ce = 1e-3, Us = 0.01, ut = 10, Es = 0.05, _s = 1;
function qs({ duration: e = 800, bounce: t = 0.25, velocity: n = 0, mass: s = 1 }) {
  let r, o;
  oe(e <= j(ut), "Spring duration must be 10 seconds or less");
  let i = 1 - t;
  i = E(Es, _s, i), e = E(Us, ut, k(e)), i < 1 ? (r = (l) => {
    const u = l * i, f = u * e, d = u - n, h = Oe(l, i), p = Math.exp(-f);
    return Ce - d / h * p;
  }, o = (l) => {
    const f = l * i * e, d = f * n + n, h = Math.pow(i, 2) * Math.pow(l, 2) * e, p = Math.exp(-f), y = Oe(Math.pow(l, 2), i);
    return (-r(l) + Ce > 0 ? -1 : 1) * ((d - h) * p) / y;
  }) : (r = (l) => {
    const u = Math.exp(-l * e), f = (l - n) * e + 1;
    return -Ce + u * f;
  }, o = (l) => {
    const u = Math.exp(-l * e), f = (n - l) * (e * e);
    return u * f;
  });
  const c = 5 / e, a = Ys(r, o, c);
  if (e = j(e), isNaN(a))
    return {
      stiffness: 100,
      damping: 10,
      duration: e
    };
  {
    const l = Math.pow(a, 2) * s;
    return {
      stiffness: l,
      damping: i * 2 * Math.sqrt(s * l),
      duration: e
    };
  }
}
const Hs = 12;
function Ys(e, t, n) {
  let s = n;
  for (let r = 1; r < Hs; r++)
    s = s - e(s) / t(s);
  return s;
}
function Oe(e, t) {
  return e * Math.sqrt(1 - t * t);
}
const Xs = ["duration", "bounce"], Zs = ["stiffness", "damping", "mass"];
function ft(e, t) {
  return t.some((n) => e[n] !== void 0);
}
function Qs(e) {
  let t = {
    velocity: 0,
    stiffness: 100,
    damping: 10,
    mass: 1,
    isResolvedFromDuration: !1,
    ...e
  };
  if (!ft(e, Zs) && ft(e, Xs)) {
    const n = qs(e);
    t = {
      ...t,
      ...n,
      velocity: 0,
      mass: 1
    }, t.isResolvedFromDuration = !0;
  }
  return t;
}
function mn({ keyframes: e, restDelta: t, restSpeed: n, ...s }) {
  const r = e[0], o = e[e.length - 1], i = { done: !1, value: r }, { stiffness: c, damping: a, mass: l, velocity: u, duration: f, isResolvedFromDuration: d } = Qs(s), h = u ? -k(u) : 0, p = a / (2 * Math.sqrt(c * l)), y = o - r, V = k(Math.sqrt(c / l)), C = Math.abs(y) < 5;
  n || (n = C ? 0.01 : 2), t || (t = C ? 5e-3 : 0.5);
  let g;
  if (p < 1) {
    const x = Oe(V, p);
    g = (w) => {
      const v = Math.exp(-p * V * w);
      return o - v * ((h + p * V * y) / x * Math.sin(x * w) + y * Math.cos(x * w));
    };
  } else if (p === 1)
    g = (x) => o - Math.exp(-V * x) * (y + (h + V * y) * x);
  else {
    const x = V * Math.sqrt(p * p - 1);
    g = (w) => {
      const v = Math.exp(-p * V * w), D = Math.min(x * w, 300);
      return o - v * ((h + p * V * y) * Math.sinh(D) + x * y * Math.cosh(D)) / x;
    };
  }
  return {
    calculatedDuration: d && f || null,
    next: (x) => {
      const w = g(x);
      if (d)
        i.done = x >= f;
      else {
        let v = h;
        x !== 0 && (p < 1 ? v = pn(g, x, w) : v = 0);
        const D = Math.abs(v) <= n, M = Math.abs(o - w) <= t;
        i.done = D && M;
      }
      return i.value = i.done ? o : w, i;
    }
  };
}
function ht({ keyframes: e, velocity: t = 0, power: n = 0.8, timeConstant: s = 325, bounceDamping: r = 10, bounceStiffness: o = 500, modifyTarget: i, min: c, max: a, restDelta: l = 0.5, restSpeed: u }) {
  const f = e[0], d = {
    done: !1,
    value: f
  }, h = (b) => c !== void 0 && b < c || a !== void 0 && b > a, p = (b) => c === void 0 ? a : a === void 0 || Math.abs(c - b) < Math.abs(a - b) ? c : a;
  let y = n * t;
  const V = f + y, C = i === void 0 ? V : i(V);
  C !== V && (y = C - f);
  const g = (b) => -y * Math.exp(-b / s), x = (b) => C + g(b), w = (b) => {
    const A = g(b), W = x(b);
    d.done = Math.abs(A) <= l, d.value = d.done ? C : W;
  };
  let v, D;
  const M = (b) => {
    h(d.value) && (v = b, D = mn({
      keyframes: [d.value, p(d.value)],
      velocity: pn(x, b, d.value),
      damping: r,
      stiffness: o,
      restDelta: l,
      restSpeed: u
    }));
  };
  return M(0), {
    calculatedDuration: null,
    next: (b) => {
      let A = !1;
      return !D && v === void 0 && (A = !0, w(b), M(b)), v !== void 0 && b > v ? D.next(b - v) : (!A && w(b), d);
    }
  };
}
const Js = (e) => {
  const t = ({ timestamp: n }) => e(n);
  return {
    start: () => I.update(t, !0),
    stop: () => de(t),
    /**
     * If we're processing this frame we can use the
     * framelocked timestamp to keep things in sync.
     */
    now: () => Pe.isProcessing ? Pe.timestamp : performance.now()
  };
}, dt = 2e4;
function pt(e) {
  let t = 0;
  const n = 50;
  let s = e.next(t);
  for (; !s.done && t < dt; )
    t += n, s = e.next(t);
  return t >= dt ? 1 / 0 : t;
}
const er = {
  decay: ht,
  inertia: ht,
  tween: me,
  keyframes: me,
  spring: mn
};
function ge({ autoplay: e = !0, delay: t = 0, driver: n = Js, keyframes: s, type: r = "keyframes", repeat: o = 0, repeatDelay: i = 0, repeatType: c = "loop", onPlay: a, onStop: l, onComplete: u, onUpdate: f, ...d }) {
  let h = 1, p = !1, y, V;
  const C = () => {
    V = new Promise((T) => {
      y = T;
    });
  };
  C();
  let g;
  const x = er[r] || me;
  let w;
  x !== me && typeof s[0] != "number" && (w = hn([0, 100], s, {
    clamp: !1
  }), s = [0, 100]);
  const v = x({ ...d, keyframes: s });
  let D;
  c === "mirror" && (D = x({
    ...d,
    keyframes: [...s].reverse(),
    velocity: -(d.velocity || 0)
  }));
  let M = "idle", b = null, A = null, W = null;
  v.calculatedDuration === null && o && (v.calculatedDuration = pt(v));
  const { calculatedDuration: Ve } = v;
  let Y = 1 / 0, z = 1 / 0;
  Ve !== null && (Y = Ve + i, z = Y * (o + 1) - i);
  let F = 0;
  const xe = (T) => {
    if (A === null)
      return;
    h > 0 && (A = Math.min(A, T)), h < 0 && (A = Math.min(T - z / h, A)), b !== null ? F = b : F = Math.round(T - A) * h;
    const X = F - t * (h >= 0 ? 1 : -1), Ye = h >= 0 ? X < 0 : X > z;
    F = Math.max(X, 0), M === "finished" && b === null && (F = z);
    let Xe = F, Ze = v;
    if (o) {
      const ve = F / Y;
      let ce = Math.floor(ve), N = ve % 1;
      !N && ve >= 1 && (N = 1), N === 1 && ce--, ce = Math.min(ce, o + 1);
      const Je = !!(ce % 2);
      Je && (c === "reverse" ? (N = 1 - N, i && (N -= i / Y)) : c === "mirror" && (Ze = D));
      let et = E(0, 1, N);
      F > z && (et = c === "reverse" && Je ? 1 : 0), Xe = et * Y;
    }
    const Z = Ye ? { done: !1, value: s[0] } : Ze.next(Xe);
    w && (Z.value = w(Z.value));
    let { done: Qe } = Z;
    !Ye && Ve !== null && (Qe = h >= 0 ? F >= z : F <= 0);
    const On = b === null && (M === "finished" || M === "running" && Qe);
    return f && f(Z.value), On && Dn(), Z;
  }, Ee = () => {
    g && g.stop(), g = void 0;
  }, _e = () => {
    M = "idle", Ee(), y(), C(), A = W = null;
  }, Dn = () => {
    M = "finished", u && u(), Ee(), y();
  }, qe = () => {
    if (p)
      return;
    g || (g = n(xe));
    const T = g.now();
    a && a(), b !== null ? A = T - b : (!A || M === "finished") && (A = T), M === "finished" && C(), W = A, b = null, M = "running", g.start();
  };
  e && qe();
  const He = {
    then(T, X) {
      return V.then(T, X);
    },
    get time() {
      return k(F);
    },
    set time(T) {
      T = j(T), F = T, b !== null || !g || h === 0 ? b = T : A = g.now() - T / h;
    },
    get duration() {
      const T = v.calculatedDuration === null ? pt(v) : v.calculatedDuration;
      return k(T);
    },
    get speed() {
      return h;
    },
    set speed(T) {
      T === h || !g || (h = T, He.time = k(F));
    },
    get state() {
      return M;
    },
    play: qe,
    pause: () => {
      M = "paused", b = F;
    },
    stop: () => {
      p = !0, M !== "idle" && (M = "idle", l && l(), _e());
    },
    cancel: () => {
      W !== null && xe(W), _e();
    },
    complete: () => {
      M = "finished";
    },
    sample: (T) => (A = 0, xe(T))
  };
  return He;
}
function tr(e) {
  let t;
  return () => (t === void 0 && (t = e()), t);
}
const nr = tr(() => Object.hasOwnProperty.call(Element.prototype, "animate")), sr = /* @__PURE__ */ new Set([
  "opacity",
  "clipPath",
  "filter",
  "transform",
  "backgroundColor"
]), fe = 10, rr = 2e4, or = (e, t) => t.type === "spring" || e === "backgroundColor" || !Et(t.ease);
function ir(e, t, { onUpdate: n, onComplete: s, ...r }) {
  if (!(nr() && sr.has(t) && !r.repeatDelay && r.repeatType !== "mirror" && r.damping !== 0 && r.type !== "inertia"))
    return !1;
  let i = !1, c, a;
  const l = () => {
    a = new Promise((g) => {
      c = g;
    });
  };
  l();
  let { keyframes: u, duration: f = 300, ease: d, times: h } = r;
  if (or(t, r)) {
    const g = ge({
      ...r,
      repeat: 0,
      delay: 0
    });
    let x = { done: !1, value: u[0] };
    const w = [];
    let v = 0;
    for (; !x.done && v < rr; )
      x = g.sample(v), w.push(x.value), v += fe;
    h = void 0, u = w, f = v - fe, d = "linear";
  }
  const p = gs(e.owner.current, t, u, {
    ...r,
    duration: f,
    /**
     * This function is currently not called if ease is provided
     * as a function so the cast is safe.
     *
     * However it would be possible for a future refinement to port
     * in easing pregeneration from Motion One for browsers that
     * support the upcoming `linear()` easing function.
     */
    ease: d,
    times: h
  }), y = () => p.cancel(), V = () => {
    I.update(y), c(), l();
  };
  return p.onfinish = () => {
    e.set(ys(u, r)), s && s(), V();
  }, {
    then(g, x) {
      return a.then(g, x);
    },
    attachTimeline(g) {
      return p.timeline = g, p.onfinish = null, P;
    },
    get time() {
      return k(p.currentTime || 0);
    },
    set time(g) {
      p.currentTime = j(g);
    },
    get speed() {
      return p.playbackRate;
    },
    set speed(g) {
      p.playbackRate = g;
    },
    get duration() {
      return k(f);
    },
    play: () => {
      i || (p.play(), de(y));
    },
    pause: () => p.pause(),
    stop: () => {
      if (i = !0, p.playState === "idle")
        return;
      const { currentTime: g } = p;
      if (g) {
        const x = ge({
          ...r,
          autoplay: !1
        });
        e.setWithVelocity(x.sample(g - fe).value, x.sample(g).value, fe);
      }
      V();
    },
    complete: () => p.finish(),
    cancel: V
  };
}
function ar({ keyframes: e, delay: t, onUpdate: n, onComplete: s }) {
  const r = () => (n && n(e[e.length - 1]), s && s(), {
    time: 0,
    speed: 1,
    duration: 0,
    play: P,
    pause: P,
    stop: P,
    then: (o) => (o(), Promise.resolve()),
    cancel: P,
    complete: P
  });
  return t ? ge({
    keyframes: [0, 1],
    duration: 0,
    delay: t,
    onComplete: r
  }) : r();
}
const cr = {
  type: "spring",
  stiffness: 500,
  damping: 25,
  restSpeed: 10
}, lr = (e) => ({
  type: "spring",
  stiffness: 550,
  damping: e === 0 ? 2 * Math.sqrt(550) : 30,
  restSpeed: 10
}), ur = {
  type: "keyframes",
  duration: 0.8
}, fr = {
  type: "keyframes",
  ease: [0.25, 0.1, 0.35, 1],
  duration: 0.3
}, hr = (e, { keyframes: t }) => t.length > 2 ? ur : L.has(e) ? e.startsWith("scale") ? lr(t[1]) : cr : fr, Re = (e, t) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string
(H.test(t) || t === "0") && // And it contains numbers and/or colors
!t.startsWith("url(")), dr = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]);
function pr(e) {
  const [t, n] = e.slice(0, -1).split("(");
  if (t === "drop-shadow")
    return e;
  const [s] = n.match(be) || [];
  if (!s)
    return e;
  const r = n.replace(s, "");
  let o = dr.has(t) ? 1 : 0;
  return s !== n && (o *= 100), t + "(" + o + r + ")";
}
const mr = /([a-z-]*)\(.*?\)/g, Be = {
  ...H,
  getAnimatableNone: (e) => {
    const t = e.match(mr);
    return t ? t.map(pr).join(" ") : e;
  }
}, gr = {
  ...Nt,
  // Color props
  color: S,
  backgroundColor: S,
  outlineColor: S,
  fill: S,
  stroke: S,
  // Border props
  borderColor: S,
  borderTopColor: S,
  borderRightColor: S,
  borderBottomColor: S,
  borderLeftColor: S,
  filter: Be,
  WebkitFilter: Be
}, Ge = (e) => gr[e];
function gn(e, t) {
  let n = Ge(e);
  return n !== Be && (n = H), n.getAnimatableNone ? n.getAnimatableNone(t) : void 0;
}
const yn = (e) => /^0[^.\s]+$/.test(e);
function yr(e) {
  if (typeof e == "number")
    return e === 0;
  if (e !== null)
    return e === "none" || e === "0" || yn(e);
}
function br(e, t, n, s) {
  const r = Re(t, n);
  let o;
  Array.isArray(n) ? o = [...n] : o = [null, n];
  const i = s.from !== void 0 ? s.from : e.get();
  let c;
  const a = [];
  for (let l = 0; l < o.length; l++)
    o[l] === null && (o[l] = l === 0 ? i : o[l - 1]), yr(o[l]) && a.push(l), typeof o[l] == "string" && o[l] !== "none" && o[l] !== "0" && (c = o[l]);
  if (r && a.length && c)
    for (let l = 0; l < a.length; l++) {
      const u = a[l];
      o[u] = gn(t, c);
    }
  return o;
}
function Vr({ when: e, delay: t, delayChildren: n, staggerChildren: s, staggerDirection: r, repeat: o, repeatType: i, repeatDelay: c, from: a, elapsed: l, ...u }) {
  return !!Object.keys(u).length;
}
function bn(e, t) {
  return e[t] || e.default || e;
}
const Vn = (e, t, n, s = {}) => (r) => {
  const o = bn(s, e) || {}, i = o.delay || s.delay || 0;
  let { elapsed: c = 0 } = s;
  c = c - j(i);
  const a = br(t, e, n, o), l = a[0], u = a[a.length - 1], f = Re(e, l), d = Re(e, u);
  oe(f === d, `You are trying to animate ${e} from "${l}" to "${u}". ${l} is not an animatable value - to enable this animation set ${l} to a value animatable to ${u} via the \`style\` property.`);
  let h = {
    keyframes: a,
    velocity: t.getVelocity(),
    ease: "easeOut",
    ...o,
    delay: -c,
    onUpdate: (p) => {
      t.set(p), o.onUpdate && o.onUpdate(p);
    },
    onComplete: () => {
      r(), o.onComplete && o.onComplete();
    }
  };
  if (Vr(o) || (h = {
    ...h,
    ...hr(e, h)
  }), h.duration && (h.duration = j(h.duration)), h.repeatDelay && (h.repeatDelay = j(h.repeatDelay)), !f || !d || ms.current || o.type === !1)
    return ar(h);
  if (
    /**
     * If this is a handoff animation, the optimised animation will be running via
     * WAAPI. Therefore, this animation must be JS to ensure it runs "under" the
     * optimised animation.
     */
    !s.isHandoff && t.owner && t.owner.current instanceof HTMLElement && /**
     * If we're outputting values to onUpdate then we can't use WAAPI as there's
     * no way to read the value from WAAPI every frame.
     */
    !t.owner.getProps().onUpdate
  ) {
    const p = ir(t, e, h);
    if (p)
      return p;
  }
  return ge(h);
};
function ye(e) {
  return !!(O(e) && e.add);
}
const xn = (e) => /^\-?\d*\.?\d+$/.test(e);
function xr(e, t) {
  e.indexOf(t) === -1 && e.push(t);
}
function vr(e, t) {
  const n = e.indexOf(t);
  n > -1 && e.splice(n, 1);
}
class vn {
  constructor() {
    this.subscriptions = [];
  }
  add(t) {
    return xr(this.subscriptions, t), () => vr(this.subscriptions, t);
  }
  notify(t, n, s) {
    const r = this.subscriptions.length;
    if (r)
      if (r === 1)
        this.subscriptions[0](t, n, s);
      else
        for (let o = 0; o < r; o++) {
          const i = this.subscriptions[o];
          i && i(t, n, s);
        }
  }
  getSize() {
    return this.subscriptions.length;
  }
  clear() {
    this.subscriptions.length = 0;
  }
}
const mt = /* @__PURE__ */ new Set();
function Ue(e, t, n) {
  e || mt.has(t) || (console.warn(t), n && console.warn(n), mt.add(t));
}
const Tr = (e) => !isNaN(parseFloat(e));
class wr {
  /**
   * @param init - The initiating value
   * @param config - Optional configuration options
   *
   * -  `transformer`: A function to transform incoming values with.
   *
   * @internal
   */
  constructor(t, n = {}) {
    this.version = "10.16.16", this.timeDelta = 0, this.lastUpdated = 0, this.canTrackVelocity = !1, this.events = {}, this.updateAndNotify = (s, r = !0) => {
      this.prev = this.current, this.current = s;
      const { delta: o, timestamp: i } = Pe;
      this.lastUpdated !== i && (this.timeDelta = o, this.lastUpdated = i, I.postRender(this.scheduleVelocityCheck)), this.prev !== this.current && this.events.change && this.events.change.notify(this.current), this.events.velocityChange && this.events.velocityChange.notify(this.getVelocity()), r && this.events.renderRequest && this.events.renderRequest.notify(this.current);
    }, this.scheduleVelocityCheck = () => I.postRender(this.velocityCheck), this.velocityCheck = ({ timestamp: s }) => {
      s !== this.lastUpdated && (this.prev = this.current, this.events.velocityChange && this.events.velocityChange.notify(this.getVelocity()));
    }, this.hasAnimated = !1, this.prev = this.current = t, this.canTrackVelocity = Tr(this.current), this.owner = n.owner;
  }
  /**
   * Adds a function that will be notified when the `MotionValue` is updated.
   *
   * It returns a function that, when called, will cancel the subscription.
   *
   * When calling `onChange` inside a React component, it should be wrapped with the
   * `useEffect` hook. As it returns an unsubscribe function, this should be returned
   * from the `useEffect` function to ensure you don't add duplicate subscribers..
   *
   * ```jsx
   * export const MyComponent = () => {
   *   const x = useMotionValue(0)
   *   const y = useMotionValue(0)
   *   const opacity = useMotionValue(1)
   *
   *   useEffect(() => {
   *     function updateOpacity() {
   *       const maxXY = Math.max(x.get(), y.get())
   *       const newOpacity = transform(maxXY, [0, 100], [1, 0])
   *       opacity.set(newOpacity)
   *     }
   *
   *     const unsubscribeX = x.on("change", updateOpacity)
   *     const unsubscribeY = y.on("change", updateOpacity)
   *
   *     return () => {
   *       unsubscribeX()
   *       unsubscribeY()
   *     }
   *   }, [])
   *
   *   return <motion.div style={{ x }} />
   * }
   * ```
   *
   * @param subscriber - A function that receives the latest value.
   * @returns A function that, when called, will cancel this subscription.
   *
   * @deprecated
   */
  onChange(t) {
    return process.env.NODE_ENV !== "production" && Ue(!1, 'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'), this.on("change", t);
  }
  on(t, n) {
    this.events[t] || (this.events[t] = new vn());
    const s = this.events[t].add(n);
    return t === "change" ? () => {
      s(), I.read(() => {
        this.events.change.getSize() || this.stop();
      });
    } : s;
  }
  clearListeners() {
    for (const t in this.events)
      this.events[t].clear();
  }
  /**
   * Attaches a passive effect to the `MotionValue`.
   *
   * @internal
   */
  attach(t, n) {
    this.passiveEffect = t, this.stopPassiveEffect = n;
  }
  /**
   * Sets the state of the `MotionValue`.
   *
   * @remarks
   *
   * ```jsx
   * const x = useMotionValue(0)
   * x.set(10)
   * ```
   *
   * @param latest - Latest value to set.
   * @param render - Whether to notify render subscribers. Defaults to `true`
   *
   * @public
   */
  set(t, n = !0) {
    !n || !this.passiveEffect ? this.updateAndNotify(t, n) : this.passiveEffect(t, this.updateAndNotify);
  }
  setWithVelocity(t, n, s) {
    this.set(n), this.prev = t, this.timeDelta = s;
  }
  /**
   * Set the state of the `MotionValue`, stopping any active animations,
   * effects, and resets velocity to `0`.
   */
  jump(t) {
    this.updateAndNotify(t), this.prev = t, this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
  }
  /**
   * Returns the latest state of `MotionValue`
   *
   * @returns - The latest state of `MotionValue`
   *
   * @public
   */
  get() {
    return this.current;
  }
  /**
   * @public
   */
  getPrevious() {
    return this.prev;
  }
  /**
   * Returns the latest velocity of `MotionValue`
   *
   * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
   *
   * @public
   */
  getVelocity() {
    return this.canTrackVelocity ? (
      // These casts could be avoided if parseFloat would be typed better
      dn(parseFloat(this.current) - parseFloat(this.prev), this.timeDelta)
    ) : 0;
  }
  /**
   * Registers a new animation to control this `MotionValue`. Only one
   * animation can drive a `MotionValue` at one time.
   *
   * ```jsx
   * value.start()
   * ```
   *
   * @param animation - A function that starts the provided animation
   *
   * @internal
   */
  start(t) {
    return this.stop(), new Promise((n) => {
      this.hasAnimated = !0, this.animation = t(n), this.events.animationStart && this.events.animationStart.notify();
    }).then(() => {
      this.events.animationComplete && this.events.animationComplete.notify(), this.clearAnimation();
    });
  }
  /**
   * Stop the currently active animation.
   *
   * @public
   */
  stop() {
    this.animation && (this.animation.stop(), this.events.animationCancel && this.events.animationCancel.notify()), this.clearAnimation();
  }
  /**
   * Returns `true` if this value is currently animating.
   *
   * @public
   */
  isAnimating() {
    return !!this.animation;
  }
  clearAnimation() {
    delete this.animation;
  }
  /**
   * Destroy and clean up subscribers to this `MotionValue`.
   *
   * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
   * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
   * created a `MotionValue` via the `motionValue` function.
   *
   * @public
   */
  destroy() {
    this.clearListeners(), this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
  }
}
function _(e, t) {
  return new wr(e, t);
}
const Tn = (e) => (t) => t.test(e), Mr = {
  test: (e) => e === "auto",
  parse: (e) => e
}, wn = [K, m, U, B, Qn, Zn, Mr], Q = (e) => wn.find(Tn(e)), Ar = [...wn, S, H], Cr = (e) => Ar.find(Tn(e));
function Sr(e, t, n) {
  e.hasValue(t) ? e.getValue(t).set(n) : e.addValue(t, _(n));
}
function Fr(e, t) {
  const n = ps(e, t);
  let { transitionEnd: s = {}, transition: r = {}, ...o } = n ? e.makeTargetAnimatable(n, !1) : {};
  o = { ...o, ...s };
  for (const i in o) {
    const c = as(o[i]);
    Sr(e, i, c);
  }
}
function Pr(e, t, n) {
  var s, r;
  const o = Object.keys(t).filter((c) => !e.hasValue(c)), i = o.length;
  if (i)
    for (let c = 0; c < i; c++) {
      const a = o[c], l = t[a];
      let u = null;
      Array.isArray(l) && (u = l[0]), u === null && (u = (r = (s = n[a]) !== null && s !== void 0 ? s : e.readValue(a)) !== null && r !== void 0 ? r : t[a]), u != null && (typeof u == "string" && (xn(u) || yn(u)) ? u = parseFloat(u) : !Cr(u) && H.test(l) && (u = gn(a, l)), e.addValue(a, _(u, { owner: e })), n[a] === void 0 && (n[a] = u), u !== null && e.setBaseTarget(a, u));
    }
}
function Dr(e, t) {
  return t ? (t[e] || t.default || t).from : void 0;
}
function Or(e, t, n) {
  const s = {};
  for (const r in e) {
    const o = Dr(r, t);
    if (o !== void 0)
      s[r] = o;
    else {
      const i = n.getValue(r);
      i && (s[r] = i.get());
    }
  }
  return s;
}
function Rr({ protectedKeys: e, needsAnimating: t }, n) {
  const s = e.hasOwnProperty(n) && t[n] !== !0;
  return t[n] = !1, s;
}
function Br(e, t) {
  const n = e.get();
  if (Array.isArray(t)) {
    for (let s = 0; s < t.length; s++)
      if (t[s] !== n)
        return !0;
  } else
    return n !== t;
}
function ho(e, t, { delay: n = 0, transitionOverride: s, type: r } = {}) {
  let { transition: o = e.getDefaultTransition(), transitionEnd: i, ...c } = e.makeTargetAnimatable(t);
  const a = e.getValue("willChange");
  s && (o = s);
  const l = [], u = r && e.animationState && e.animationState.getState()[r];
  for (const f in c) {
    const d = e.getValue(f), h = c[f];
    if (!d || h === void 0 || u && Rr(u, f))
      continue;
    const p = {
      delay: n,
      elapsed: 0,
      ...bn(o || {}, f)
    };
    if (window.HandoffAppearAnimations) {
      const C = e.getProps()[Ln];
      if (C) {
        const g = window.HandoffAppearAnimations(C, f, d, I);
        g !== null && (p.elapsed = g, p.isHandoff = !0);
      }
    }
    let y = !p.isHandoff && !Br(d, h);
    if (p.type === "spring" && (d.getVelocity() || p.velocity) && (y = !1), d.animation && (y = !1), y)
      continue;
    d.start(Vn(f, d, h, e.shouldReduceMotion && L.has(f) ? { type: !1 } : p));
    const V = d.animation;
    ye(a) && (a.add(f), V.then(() => a.remove(f))), l.push(V);
  }
  return i && Promise.all(l).then(() => {
    i && Fr(e, i);
  }), l;
}
const gt = () => ({
  translate: 0,
  scale: 1,
  origin: 0,
  originPoint: 0
}), po = () => ({
  x: gt(),
  y: gt()
}), yt = () => ({ min: 0, max: 0 }), Mn = () => ({
  x: yt(),
  y: yt()
});
function Ir({ top: e, left: t, right: n, bottom: s }) {
  return {
    x: { min: t, max: n },
    y: { min: e, max: s }
  };
}
function mo({ x: e, y: t }) {
  return { top: t.min, right: e.max, bottom: t.max, left: e.min };
}
function kr(e, t) {
  if (!t)
    return e;
  const n = t({ x: e.left, y: e.top }), s = t({ x: e.right, y: e.bottom });
  return {
    top: n.y,
    left: n.x,
    bottom: s.y,
    right: s.x
  };
}
function Se(e) {
  return e === void 0 || e === 1;
}
function Nr({ scale: e, scaleX: t, scaleY: n }) {
  return !Se(e) || !Se(t) || !Se(n);
}
function $r(e) {
  return Nr(e) || jr(e) || e.z || e.rotate || e.rotateX || e.rotateY;
}
function jr(e) {
  return bt(e.x) || bt(e.y);
}
function bt(e) {
  return e && e !== "0%";
}
function Vt(e, t, n) {
  const s = e - n, r = t * s;
  return n + r;
}
function xt(e, t, n, s, r) {
  return r !== void 0 && (e = Vt(e, r, s)), Vt(e, n, s) + t;
}
function Ie(e, t = 0, n = 1, s, r) {
  e.min = xt(e.min, t, n, s, r), e.max = xt(e.max, t, n, s, r);
}
function Lr(e, { x: t, y: n }) {
  Ie(e.x, t.translate, t.scale, t.originPoint), Ie(e.y, n.translate, n.scale, n.originPoint);
}
function go(e, t, n, s = !1) {
  const r = n.length;
  if (!r)
    return;
  t.x = t.y = 1;
  let o, i;
  for (let c = 0; c < r; c++) {
    o = n[c], i = o.projectionDelta;
    const a = o.instance;
    a && a.style && a.style.display === "contents" || (s && o.options.layoutScroll && o.scroll && o !== o.root && Mt(e, {
      x: -o.scroll.offset.x,
      y: -o.scroll.offset.y
    }), i && (t.x *= i.x.scale, t.y *= i.y.scale, Lr(e, i)), s && $r(o.latestValues) && Mt(e, o.latestValues));
  }
  t.x = vt(t.x), t.y = vt(t.y);
}
function vt(e) {
  return Number.isInteger(e) || e > 1.0000000000001 || e < 0.999999999999 ? e : 1;
}
function Tt(e, t) {
  e.min = e.min + t, e.max = e.max + t;
}
function wt(e, t, [n, s, r]) {
  const o = t[r] !== void 0 ? t[r] : 0.5, i = ae(e.min, e.max, o);
  Ie(e, t[n], t[s], i, t.scale);
}
const Kr = ["x", "scaleX", "originX"], Wr = ["y", "scaleY", "originY"];
function Mt(e, t) {
  wt(e.x, t, Kr), wt(e.y, t, Wr);
}
function An(e, t) {
  return Ir(kr(e.getBoundingClientRect(), t));
}
function yo(e, t, n) {
  const s = An(e, n), { scroll: r } = t;
  return r && (Tt(s.x, r.offset.x), Tt(s.y, r.offset.y)), s;
}
function bo() {
  const e = In($n);
  if (e === null)
    return [!0, null];
  const { isPresent: t, onExitComplete: n, register: s } = e, r = kn();
  return Nn(() => s(r), []), !t && n ? [!1, () => n && n(r)] : [!0];
}
function Vo(e) {
  return e instanceof SVGElement && e.tagName !== "svg";
}
function xo(e, t, n) {
  const s = O(e) ? e : _(e);
  return s.start(Vn("", s, t, n)), s.animation;
}
const zr = /var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;
function Gr(e) {
  const t = zr.exec(e);
  if (!t)
    return [,];
  const [, n, s] = t;
  return [n, s];
}
const Ur = 4;
function ke(e, t, n = 1) {
  R(n <= Ur, `Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`);
  const [s, r] = Gr(e);
  if (!s)
    return;
  const o = window.getComputedStyle(t).getPropertyValue(s);
  if (o) {
    const i = o.trim();
    return xn(i) ? parseFloat(i) : i;
  } else
    return Fe(r) ? ke(r, t, n + 1) : r;
}
function Er(e, { ...t }, n) {
  const s = e.current;
  if (!(s instanceof Element))
    return { target: t, transitionEnd: n };
  n && (n = { ...n }), e.values.forEach((r) => {
    const o = r.get();
    if (!Fe(o))
      return;
    const i = ke(o, s);
    i && r.set(i);
  });
  for (const r in t) {
    const o = t[r];
    if (!Fe(o))
      continue;
    const i = ke(o, s);
    i && (t[r] = i, n || (n = {}), n[r] === void 0 && (n[r] = o));
  }
  return { target: t, transitionEnd: n };
}
const _r = /* @__PURE__ */ new Set([
  "width",
  "height",
  "top",
  "left",
  "right",
  "bottom",
  "x",
  "y",
  "translateX",
  "translateY"
]), Cn = (e) => _r.has(e), qr = (e) => Object.keys(e).some(Cn), he = (e) => e === K || e === m, At = (e, t) => parseFloat(e.split(", ")[t]), Ct = (e, t) => (n, { transform: s }) => {
  if (s === "none" || !s)
    return 0;
  const r = s.match(/^matrix3d\((.+)\)$/);
  if (r)
    return At(r[1], t);
  {
    const o = s.match(/^matrix\((.+)\)$/);
    return o ? At(o[1], e) : 0;
  }
}, Hr = /* @__PURE__ */ new Set(["x", "y", "z"]), Yr = ne.filter((e) => !Hr.has(e));
function Xr(e) {
  const t = [];
  return Yr.forEach((n) => {
    const s = e.getValue(n);
    s !== void 0 && (t.push([n, s.get()]), s.set(n.startsWith("scale") ? 1 : 0));
  }), t.length && e.render(), t;
}
const q = {
  // Dimensions
  width: ({ x: e }, { paddingLeft: t = "0", paddingRight: n = "0" }) => e.max - e.min - parseFloat(t) - parseFloat(n),
  height: ({ y: e }, { paddingTop: t = "0", paddingBottom: n = "0" }) => e.max - e.min - parseFloat(t) - parseFloat(n),
  top: (e, { top: t }) => parseFloat(t),
  left: (e, { left: t }) => parseFloat(t),
  bottom: ({ y: e }, { top: t }) => parseFloat(t) + (e.max - e.min),
  right: ({ x: e }, { left: t }) => parseFloat(t) + (e.max - e.min),
  // Transform
  x: Ct(4, 13),
  y: Ct(5, 14)
};
q.translateX = q.x;
q.translateY = q.y;
const Zr = (e, t, n) => {
  const s = t.measureViewportBox(), r = t.current, o = getComputedStyle(r), { display: i } = o, c = {};
  i === "none" && t.setStaticValue("display", e.display || "block"), n.forEach((l) => {
    c[l] = q[l](s, o);
  }), t.render();
  const a = t.measureViewportBox();
  return n.forEach((l) => {
    const u = t.getValue(l);
    u && u.jump(c[l]), e[l] = q[l](a, o);
  }), e;
}, Qr = (e, t, n = {}, s = {}) => {
  t = { ...t }, s = { ...s };
  const r = Object.keys(t).filter(Cn);
  let o = [], i = !1;
  const c = [];
  if (r.forEach((a) => {
    const l = e.getValue(a);
    if (!e.hasValue(a))
      return;
    let u = n[a], f = Q(u);
    const d = t[a];
    let h;
    if (zt(d)) {
      const p = d.length, y = d[0] === null ? 1 : 0;
      u = d[y], f = Q(u);
      for (let V = y; V < p && d[V] !== null; V++)
        h ? R(Q(d[V]) === h, "All keyframes must be of the same type") : (h = Q(d[V]), R(h === f || he(f) && he(h), "Keyframes must be of the same dimension as the current value"));
    } else
      h = Q(d);
    if (f !== h)
      if (he(f) && he(h)) {
        const p = l.get();
        typeof p == "string" && l.set(parseFloat(p)), typeof d == "string" ? t[a] = parseFloat(d) : Array.isArray(d) && h === m && (t[a] = d.map(parseFloat));
      } else
        f != null && f.transform && (h != null && h.transform) && (u === 0 || d === 0) ? u === 0 ? l.set(h.transform(u)) : t[a] = f.transform(d) : (i || (o = Xr(e), i = !0), c.push(a), s[a] = s[a] !== void 0 ? s[a] : t[a], l.jump(d));
  }), c.length) {
    const a = c.indexOf("height") >= 0 ? window.pageYOffset : null, l = Zr(t, e, c);
    return o.length && o.forEach(([u, f]) => {
      e.getValue(u).set(f);
    }), e.render(), Pt && a !== null && window.scrollTo({ top: a }), { target: l, transitionEnd: s };
  } else
    return { target: t, transitionEnd: s };
};
function Jr(e, t, n, s) {
  return qr(t) ? Qr(e, t, n, s) : { target: t, transitionEnd: s };
}
const eo = (e, t, n, s) => {
  const r = Er(e, t, s);
  return t = r.target, s = r.transitionEnd, Jr(e, t, n, s);
}, Ne = { current: null }, Sn = { current: !1 };
function to() {
  if (Sn.current = !0, !!Pt)
    if (window.matchMedia) {
      const e = window.matchMedia("(prefers-reduced-motion)"), t = () => Ne.current = e.matches;
      e.addListener(t), t();
    } else
      Ne.current = !1;
}
function no(e, t, n) {
  const { willChange: s } = t;
  for (const r in t) {
    const o = t[r], i = n[r];
    if (O(o))
      e.addValue(r, o), ye(s) && s.add(r), process.env.NODE_ENV === "development" && Ue(o.version === "10.16.16", `Attempting to mix Framer Motion versions ${o.version} with 10.16.16 may not work as expected.`);
    else if (O(i))
      e.addValue(r, _(o, { owner: e })), ye(s) && s.remove(r);
    else if (i !== o)
      if (e.hasValue(r)) {
        const c = e.getValue(r);
        !c.hasAnimated && c.set(o);
      } else {
        const c = e.getStaticValue(r);
        e.addValue(r, _(c !== void 0 ? c : o, { owner: e }));
      }
  }
  for (const r in n)
    t[r] === void 0 && e.removeValue(r);
  return t;
}
const St = /* @__PURE__ */ new WeakMap(), Fn = Object.keys(Le), so = Fn.length, Ft = [
  "AnimationStart",
  "AnimationComplete",
  "Update",
  "BeforeLayoutMeasure",
  "LayoutMeasure",
  "LayoutAnimationStart",
  "LayoutAnimationComplete"
], ro = je.length;
class oo {
  constructor({ parent: t, props: n, presenceContext: s, reducedMotionConfig: r, visualState: o }, i = {}) {
    this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => {
      this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection));
    }, this.scheduleRender = () => I.render(this.render, !1, !0);
    const { latestValues: c, renderState: a } = o;
    this.latestValues = c, this.baseTarget = { ...c }, this.initialValues = n.initial ? { ...c } : {}, this.renderState = a, this.parent = t, this.props = n, this.presenceContext = s, this.depth = t ? t.depth + 1 : 0, this.reducedMotionConfig = r, this.options = i, this.isControllingVariants = Ot(n), this.isVariantNode = Gn(n), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(t && t.current);
    const { willChange: l, ...u } = this.scrapeMotionValuesFromProps(n, {});
    for (const f in u) {
      const d = u[f];
      c[f] !== void 0 && O(d) && (d.set(c[f], !1), ye(l) && l.add(f));
    }
  }
  /**
   * This method takes React props and returns found MotionValues. For example, HTML
   * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
   *
   * This isn't an abstract method as it needs calling in the constructor, but it is
   * intended to be one.
   */
  scrapeMotionValuesFromProps(t, n) {
    return {};
  }
  mount(t) {
    this.current = t, St.set(t, this), this.projection && !this.projection.instance && this.projection.mount(t), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((n, s) => this.bindToMotionValue(s, n)), Sn.current || to(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : Ne.current, process.env.NODE_ENV !== "production" && Ue(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected."), this.parent && this.parent.children.add(this), this.update(this.props, this.presenceContext);
  }
  unmount() {
    St.delete(this.current), this.projection && this.projection.unmount(), de(this.notifyUpdate), de(this.render), this.valueSubscriptions.forEach((t) => t()), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent && this.parent.children.delete(this);
    for (const t in this.events)
      this.events[t].clear();
    for (const t in this.features)
      this.features[t].unmount();
    this.current = null;
  }
  bindToMotionValue(t, n) {
    const s = L.has(t), r = n.on("change", (i) => {
      this.latestValues[t] = i, this.props.onUpdate && I.update(this.notifyUpdate, !1, !0), s && this.projection && (this.projection.isTransformDirty = !0);
    }), o = n.on("renderRequest", this.scheduleRender);
    this.valueSubscriptions.set(t, () => {
      r(), o();
    });
  }
  sortNodePosition(t) {
    return !this.current || !this.sortInstanceNodePosition || this.type !== t.type ? 0 : this.sortInstanceNodePosition(this.current, t.current);
  }
  loadFeatures({ children: t, ...n }, s, r, o) {
    let i, c;
    if (process.env.NODE_ENV !== "production" && r && s) {
      const a = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";
      n.ignoreStrict ? oe(!1, a) : R(!1, a);
    }
    for (let a = 0; a < so; a++) {
      const l = Fn[a], { isEnabled: u, Feature: f, ProjectionNode: d, MeasureLayout: h } = Le[l];
      d && (i = d), u(n) && (!this.features[l] && f && (this.features[l] = new f(this)), h && (c = h));
    }
    if (!this.projection && i) {
      this.projection = new i(this.latestValues, this.parent && this.parent.projection);
      const { layoutId: a, layout: l, drag: u, dragConstraints: f, layoutScroll: d, layoutRoot: h } = n;
      this.projection.setOptions({
        layoutId: a,
        layout: l,
        alwaysMeasureLayout: !!u || f && Kn(f),
        visualElement: this,
        scheduleRender: () => this.scheduleRender(),
        /**
         * TODO: Update options in an effect. This could be tricky as it'll be too late
         * to update by the time layout animations run.
         * We also need to fix this safeToRemove by linking it up to the one returned by usePresence,
         * ensuring it gets called if there's no potential layout animations.
         *
         */
        animationType: typeof l == "string" ? l : "both",
        initialPromotionConfig: o,
        layoutScroll: d,
        layoutRoot: h
      });
    }
    return c;
  }
  updateFeatures() {
    for (const t in this.features) {
      const n = this.features[t];
      n.isMounted ? n.update() : (n.mount(), n.isMounted = !0);
    }
  }
  triggerBuild() {
    this.build(this.renderState, this.latestValues, this.options, this.props);
  }
  /**
   * Measure the current viewport box with or without transforms.
   * Only measures axis-aligned boxes, rotate and skew must be manually
   * removed with a re-render to work.
   */
  measureViewportBox() {
    return this.current ? this.measureInstanceViewportBox(this.current, this.props) : Mn();
  }
  getStaticValue(t) {
    return this.latestValues[t];
  }
  setStaticValue(t, n) {
    this.latestValues[t] = n;
  }
  /**
   * Make a target animatable by Popmotion. For instance, if we're
   * trying to animate width from 100px to 100vw we need to measure 100vw
   * in pixels to determine what we really need to animate to. This is also
   * pluggable to support Framer's custom value types like Color,
   * and CSS variables.
   */
  makeTargetAnimatable(t, n = !0) {
    return this.makeTargetAnimatableFromInstance(t, this.props, n);
  }
  /**
   * Update the provided props. Ensure any newly-added motion values are
   * added to our map, old ones removed, and listeners updated.
   */
  update(t, n) {
    (t.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = t, this.prevPresenceContext = this.presenceContext, this.presenceContext = n;
    for (let s = 0; s < Ft.length; s++) {
      const r = Ft[s];
      this.propEventSubscriptions[r] && (this.propEventSubscriptions[r](), delete this.propEventSubscriptions[r]);
      const o = t["on" + r];
      o && (this.propEventSubscriptions[r] = this.on(r, o));
    }
    this.prevMotionValues = no(this, this.scrapeMotionValuesFromProps(t, this.prevProps), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue();
  }
  getProps() {
    return this.props;
  }
  /**
   * Returns the variant definition with a given name.
   */
  getVariant(t) {
    return this.props.variants ? this.props.variants[t] : void 0;
  }
  /**
   * Returns the defined default transition on this component.
   */
  getDefaultTransition() {
    return this.props.transition;
  }
  getTransformPagePoint() {
    return this.props.transformPagePoint;
  }
  getClosestVariantNode() {
    return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0;
  }
  getVariantContext(t = !1) {
    if (t)
      return this.parent ? this.parent.getVariantContext() : void 0;
    if (!this.isControllingVariants) {
      const s = this.parent ? this.parent.getVariantContext() || {} : {};
      return this.props.initial !== void 0 && (s.initial = this.props.initial), s;
    }
    const n = {};
    for (let s = 0; s < ro; s++) {
      const r = je[s], o = this.props[r];
      (Dt(o) || o === !1) && (n[r] = o);
    }
    return n;
  }
  /**
   * Add a child visual element to our set of children.
   */
  addVariantChild(t) {
    const n = this.getClosestVariantNode();
    if (n)
      return n.variantChildren && n.variantChildren.add(t), () => n.variantChildren.delete(t);
  }
  /**
   * Add a motion value and bind it to this visual element.
   */
  addValue(t, n) {
    n !== this.values.get(t) && (this.removeValue(t), this.bindToMotionValue(t, n)), this.values.set(t, n), this.latestValues[t] = n.get();
  }
  /**
   * Remove a motion value and unbind any active subscriptions.
   */
  removeValue(t) {
    this.values.delete(t);
    const n = this.valueSubscriptions.get(t);
    n && (n(), this.valueSubscriptions.delete(t)), delete this.latestValues[t], this.removeValueFromRenderState(t, this.renderState);
  }
  /**
   * Check whether we have a motion value for this key
   */
  hasValue(t) {
    return this.values.has(t);
  }
  getValue(t, n) {
    if (this.props.values && this.props.values[t])
      return this.props.values[t];
    let s = this.values.get(t);
    return s === void 0 && n !== void 0 && (s = _(n, { owner: this }), this.addValue(t, s)), s;
  }
  /**
   * If we're trying to animate to a previously unencountered value,
   * we need to check for it in our state and as a last resort read it
   * directly from the instance (which might have performance implications).
   */
  readValue(t) {
    var n;
    return this.latestValues[t] !== void 0 || !this.current ? this.latestValues[t] : (n = this.getBaseTargetFromProps(this.props, t)) !== null && n !== void 0 ? n : this.readValueFromInstance(this.current, t, this.options);
  }
  /**
   * Set the base target to later animate back to. This is currently
   * only hydrated on creation and when we first read a value.
   */
  setBaseTarget(t, n) {
    this.baseTarget[t] = n;
  }
  /**
   * Find the base target for a value thats been removed from all animation
   * props.
   */
  getBaseTarget(t) {
    var n;
    const { initial: s } = this.props, r = typeof s == "string" || typeof s == "object" ? (n = Wt(this.props, s)) === null || n === void 0 ? void 0 : n[t] : void 0;
    if (s && r !== void 0)
      return r;
    const o = this.getBaseTargetFromProps(this.props, t);
    return o !== void 0 && !O(o) ? o : this.initialValues[t] !== void 0 && r === void 0 ? void 0 : this.baseTarget[t];
  }
  on(t, n) {
    return this.events[t] || (this.events[t] = new vn()), this.events[t].add(n);
  }
  notify(t, ...n) {
    this.events[t] && this.events[t].notify(...n);
  }
}
class Pn extends oo {
  sortInstanceNodePosition(t, n) {
    return t.compareDocumentPosition(n) & 2 ? 1 : -1;
  }
  getBaseTargetFromProps(t, n) {
    return t.style ? t.style[n] : void 0;
  }
  removeValueFromRenderState(t, { vars: n, style: s }) {
    delete n[t], delete s[t];
  }
  makeTargetAnimatableFromInstance({ transition: t, transitionEnd: n, ...s }, { transformValues: r }, o) {
    let i = Or(s, t || {}, this);
    if (r && (n && (n = r(n)), s && (s = r(s)), i && (i = r(i))), o) {
      Pr(this, s, i);
      const c = eo(this, s, i, n);
      n = c.transitionEnd, s = c.target;
    }
    return {
      transition: t,
      transitionEnd: n,
      ...s
    };
  }
}
function io(e) {
  return window.getComputedStyle(e);
}
class vo extends Pn {
  readValueFromInstance(t, n) {
    if (L.has(n)) {
      const s = Ge(n);
      return s && s.default || 0;
    } else {
      const s = io(t), r = (It(n) ? s.getPropertyValue(n) : s[n]) || 0;
      return typeof r == "string" ? r.trim() : r;
    }
  }
  measureInstanceViewportBox(t, { transformPagePoint: n }) {
    return An(t, n);
  }
  build(t, n, s, r) {
    $t(t, n, s, r.transformTemplate);
  }
  scrapeMotionValuesFromProps(t, n) {
    return Kt(t, n);
  }
  handleChildMotionValue() {
    this.childSubscription && (this.childSubscription(), delete this.childSubscription);
    const { children: t } = this.props;
    O(t) && (this.childSubscription = t.on("change", (n) => {
      this.current && (this.current.textContent = `${n}`);
    }));
  }
  renderInstance(t, n, s, r) {
    jt(t, n, s, r);
  }
}
class To extends Pn {
  constructor() {
    super(...arguments), this.isSVGTag = !1;
  }
  getBaseTargetFromProps(t, n) {
    return t[n];
  }
  readValueFromInstance(t, n) {
    if (L.has(n)) {
      const s = Ge(n);
      return s && s.default || 0;
    }
    return n = Lt.has(n) ? n : $e(n), t.getAttribute(n);
  }
  measureInstanceViewportBox() {
    return Mn();
  }
  scrapeMotionValuesFromProps(t, n) {
    return is(t, n);
  }
  build(t, n, s, r) {
    ss(t, n, s, this.isSVGTag, r.transformTemplate);
  }
  renderInstance(t, n, s, r) {
    os(t, n, s, r);
  }
  mount(t) {
    this.isSVGTag = rs(t.tagName), super.mount(t);
  }
}
export {
  U as $,
  Dt as A,
  Le as B,
  Un as C,
  $t as D,
  ss as E,
  rs as F,
  uo as G,
  vo as H,
  Gn as I,
  Wn as J,
  Wt as K,
  is as L,
  os as M,
  Kt as N,
  Gt as O,
  $n as P,
  P as Q,
  ps as R,
  To as S,
  zt as T,
  zn as U,
  Pe as V,
  E as W,
  Mn as X,
  yo as Y,
  mo as Z,
  Vn as _,
  R as a,
  Ir as a0,
  m as a1,
  H as a2,
  co as a3,
  Ms as a4,
  Vt as a5,
  xr as a6,
  vn as a7,
  bn as a8,
  fo as a9,
  $r as aa,
  Tt as ab,
  Mt as ac,
  Nr as ad,
  Lr as ae,
  jr as af,
  go as ag,
  po as ah,
  Rt as ai,
  Vo as b,
  de as c,
  pt as d,
  dt as e,
  I as f,
  k as g,
  ws as h,
  Pt as i,
  ae as j,
  O as k,
  Ks as l,
  tr as m,
  Ls as n,
  j as o,
  fn as p,
  xo as q,
  vr as r,
  mn as s,
  ho as t,
  lo as u,
  St as v,
  bo as w,
  Ln as x,
  Kn as y,
  Ot as z
};
