UNPKG

@konstructio/ui

Version:

A set of reusable and customizable React components built for konstruct.io

1,478 lines 164 kB
import { a as _r, n as Kr, r as $r } from "./chunk-cI0lbGMq.js"; import { Component as zr, Fragment as Yn, createContext as Mt, createElement as Hr, forwardRef as Gr, useCallback as qn, useContext as U, useEffect as ni, useId as Xr, useInsertionEffect as Zn, useLayoutEffect as Yr, useMemo as he, useRef as dt } from "react"; import { jsx as Jn, jsxs as qr } from "react/jsx-runtime"; var Qn = Mt({}); function Zr(t) { const e = dt(null); return e.current === null && (e.current = t()), e.current; } var Jr = typeof window < "u", Qr = Jr ? Yr : ni, si = /* @__PURE__ */ Mt(null); function ri(t, e) { t.indexOf(e) === -1 && t.push(e); } function ne(t, e) { const i = t.indexOf(e); i > -1 && t.splice(i, 1); } var tt = (t, e, i) => i > e ? e : i < t ? t : i; function Le(t, e) { return e ? `${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}` : t; } var Ct = () => { }, it = () => { }; typeof process < "u" && process.env.NODE_ENV !== "production" && (Ct = (t, e, i) => { !t && typeof console < "u" && console.warn(Le(e, i)); }, it = (t, e, i) => { if (!t) throw new Error(Le(e, i)); }); var rt = {}, ts = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t); function es(t) { return typeof t == "object" && t !== null; } var is = (t) => /^0[^.\s]+$/u.test(t); // @__NO_SIDE_EFFECTS__ function ns(t) { let e; return () => (e === void 0 && (e = t()), e); } var $ = /* @__NO_SIDE_EFFECTS__ */ (t) => t, to = (t, e) => (i) => e(t(i)), Wt = (...t) => t.reduce(to), Ot = /* @__NO_SIDE_EFFECTS__ */ (t, e, i) => { const n = e - t; return n === 0 ? 1 : (i - t) / n; }, oi = class { constructor() { this.subscriptions = []; } add(t) { return ri(this.subscriptions, t), () => ne(this.subscriptions, t); } notify(t, e, i) { const n = this.subscriptions.length; if (n) if (n === 1) this.subscriptions[0](t, e, i); else for (let s = 0; s < n; s++) { const o = this.subscriptions[s]; o && o(t, e, i); } } getSize() { return this.subscriptions.length; } clear() { this.subscriptions.length = 0; } }, W = /* @__NO_SIDE_EFFECTS__ */ (t) => t * 1e3, K = /* @__NO_SIDE_EFFECTS__ */ (t) => t / 1e3; function ss(t, e) { return e ? t * (1e3 / e) : 0; } var Ri = /* @__PURE__ */ new Set(); function ai(t, e, i) { t || Ri.has(e) || (console.warn(Le(e, i)), Ri.add(e)); } var rs = (t, e, i) => (((1 - 3 * i + 3 * e) * t + (3 * i - 6 * e)) * t + 3 * e) * t, eo = 1e-7, io = 12; function no(t, e, i, n, s) { let o, r, a = 0; do r = e + (i - e) / 2, o = rs(r, n, s) - t, o > 0 ? i = r : e = r; while (Math.abs(o) > eo && ++a < io); return r; } function _t(t, e, i, n) { if (t === e && i === n) return $; const s = (o) => no(o, 0, 1, t, i); return (o) => o === 0 || o === 1 ? o : rs(s(o), e, n); } var os = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, as = (t) => (e) => 1 - t(1 - e), ls = /* @__PURE__ */ _t(0.33, 1.53, 0.69, 0.99), li = /* @__PURE__ */ as(ls), us = /* @__PURE__ */ os(li), cs = (t) => t >= 1 ? 1 : (t *= 2) < 1 ? 0.5 * li(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), ui = (t) => 1 - Math.sin(Math.acos(t)), hs = as(ui), fs = os(ui), so = /* @__PURE__ */ _t(0.42, 0, 1, 1), ro = /* @__PURE__ */ _t(0, 0, 0.58, 1), ds = /* @__PURE__ */ _t(0.42, 0, 0.58, 1), oo = (t) => Array.isArray(t) && typeof t[0] != "number", ps = (t) => Array.isArray(t) && typeof t[0] == "number", Li = { linear: $, easeIn: so, easeInOut: ds, easeOut: ro, circIn: ui, circInOut: fs, circOut: hs, backIn: li, backInOut: us, backOut: ls, anticipate: cs }, ao = (t) => typeof t == "string", ki = (t) => { if (ps(t)) { it(t.length === 4, "Cubic bezier arrays must contain four numerical values.", "cubic-bezier-length"); const [e, i, n, s] = t; return _t(e, i, n, s); } else if (ao(t)) return it(Li[t] !== void 0, `Invalid easing type '${t}'`, "invalid-easing-type"), Li[t]; return t; }, zt = [ "setup", "read", "resolveKeyframes", "preUpdate", "update", "preRender", "render", "postRender" ], J = { value: null, addProjectionMetrics: null }; function lo(t, e) { let i = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), s = !1, o = !1; const r = /* @__PURE__ */ new WeakSet(); let a = { delta: 0, timestamp: 0, isProcessing: !1 }, l = 0; function c(h) { r.has(h) && (u.schedule(h), t()), l++, h(a); } const u = { schedule: (h, f = !1, p = !1) => { const d = p && s ? i : n; return f && r.add(h), d.add(h), h; }, cancel: (h) => { n.delete(h), r.delete(h); }, process: (h) => { if (a = h, s) { o = !0; return; } s = !0; const f = i; i = n, n = f, i.forEach(c), e && J.value && J.value.frameloop[e].push(l), l = 0, i.clear(), s = !1, o && (o = !1, u.process(h)); } }; return u; } var uo = 40; function ms(t, e) { let i = !1, n = !0; const s = { delta: 0, timestamp: 0, isProcessing: !1 }, o = () => i = !0, r = zt.reduce((y, w) => (y[w] = lo(o, e ? w : void 0), y), {}), { setup: a, read: l, resolveKeyframes: c, preUpdate: u, update: h, preRender: f, render: p, postRender: d } = r, m = () => { const y = rt.useManualTiming, w = y ? s.timestamp : performance.now(); i = !1, y || (s.delta = n ? 1e3 / 60 : Math.max(Math.min(w - s.timestamp, uo), 1)), s.timestamp = w, s.isProcessing = !0, a.process(s), l.process(s), c.process(s), u.process(s), h.process(s), f.process(s), p.process(s), d.process(s), s.isProcessing = !1, i && e && (n = !1, t(m)); }, g = () => { i = !0, n = !0, s.isProcessing || t(m); }; return { schedule: zt.reduce((y, w) => { const b = r[w]; return y[w] = (E, L = !1, P = !1) => (i || g(), b.schedule(E, L, P)), y; }, {}), cancel: (y) => { for (let w = 0; w < zt.length; w++) r[zt[w]].cancel(y); }, state: s, steps: r }; } var { schedule: A, cancel: ot, state: B, steps: ve } = /* @__PURE__ */ ms(typeof requestAnimationFrame < "u" ? requestAnimationFrame : $, !0), Yt; function co() { Yt = void 0; } var O = { now: () => (Yt === void 0 && O.set(B.isProcessing || rt.useManualTiming ? B.timestamp : performance.now()), Yt), set: (t) => { Yt = t, queueMicrotask(co); } }, vt = { layout: 0, mainThread: 0, waapi: 0 }, vs = (t) => (e) => typeof e == "string" && e.startsWith(t), gs = /* @__PURE__ */ vs("--"), ho = /* @__PURE__ */ vs("var(--"), ci = (t) => ho(t) ? fo.test(t.split("/*")[0].trim()) : !1, fo = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu; function Bi(t) { return typeof t != "string" ? !1 : t.split("/*")[0].includes("var(--"); } var Dt = { test: (t) => typeof t == "number", parse: parseFloat, transform: (t) => t }, jt = { ...Dt, transform: (t) => tt(0, 1, t) }, Ht = { ...Dt, default: 1 }, Bt = (t) => Math.round(t * 1e5) / 1e5, hi = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu; function po(t) { return t == null; } var mo = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, fi = (t, e) => (i) => !!(typeof i == "string" && mo.test(i) && i.startsWith(t) || e && !po(i) && Object.prototype.hasOwnProperty.call(i, e)), ys = (t, e, i) => (n) => { if (typeof n != "string") return n; const [s, o, r, a] = n.match(hi); return { [t]: parseFloat(s), [e]: parseFloat(o), [i]: parseFloat(r), alpha: a !== void 0 ? parseFloat(a) : 1 }; }, vo = (t) => tt(0, 255, t), ge = { ...Dt, transform: (t) => Math.round(vo(t)) }, pt = { test: /* @__PURE__ */ fi("rgb", "red"), parse: /* @__PURE__ */ ys("red", "green", "blue"), transform: ({ red: t, green: e, blue: i, alpha: n = 1 }) => "rgba(" + ge.transform(t) + ", " + ge.transform(e) + ", " + ge.transform(i) + ", " + Bt(jt.transform(n)) + ")" }; function go(t) { let e = "", i = "", n = "", s = ""; return t.length > 5 ? (e = t.substring(1, 3), i = t.substring(3, 5), n = t.substring(5, 7), s = t.substring(7, 9)) : (e = t.substring(1, 2), i = t.substring(2, 3), n = t.substring(3, 4), s = t.substring(4, 5), e += e, i += i, n += n, s += s), { red: parseInt(e, 16), green: parseInt(i, 16), blue: parseInt(n, 16), alpha: s ? parseInt(s, 16) / 255 : 1 }; } var ke = { test: /* @__PURE__ */ fi("#"), parse: go, transform: pt.transform }, Kt = /* @__NO_SIDE_EFFECTS__ */ (t) => ({ test: (e) => typeof e == "string" && e.endsWith(t) && e.split(" ").length === 1, parse: parseFloat, transform: (e) => `${e}${t}` }), nt = /* @__PURE__ */ Kt("deg"), Q = /* @__PURE__ */ Kt("%"), T = /* @__PURE__ */ Kt("px"), yo = /* @__PURE__ */ Kt("vh"), To = /* @__PURE__ */ Kt("vw"), Ii = { ...Q, parse: (t) => Q.parse(t) / 100, transform: (t) => Q.transform(t * 100) }, wt = { test: /* @__PURE__ */ fi("hsl", "hue"), parse: /* @__PURE__ */ ys("hue", "saturation", "lightness"), transform: ({ hue: t, saturation: e, lightness: i, alpha: n = 1 }) => "hsla(" + Math.round(t) + ", " + Q.transform(Bt(e)) + ", " + Q.transform(Bt(i)) + ", " + Bt(jt.transform(n)) + ")" }, D = { test: (t) => pt.test(t) || ke.test(t) || wt.test(t), parse: (t) => pt.test(t) ? pt.parse(t) : wt.test(t) ? wt.parse(t) : ke.parse(t), transform: (t) => typeof t == "string" ? t : t.hasOwnProperty("red") ? pt.transform(t) : wt.transform(t), getAnimatableNone: (t) => { const e = D.parse(t); return e.alpha = 0, D.transform(e); } }, xo = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu; function wo(t) { return isNaN(t) && typeof t == "string" && (t.match(hi)?.length || 0) + (t.match(xo)?.length || 0) > 0; } var Ts = "number", xs = "color", Po = "var", So = "var(", Fi = "${}", bo = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu; function At(t) { const e = t.toString(), i = [], n = { color: [], number: [], var: [] }, s = []; let o = 0; return { values: i, split: e.replace(bo, (r) => (D.test(r) ? (n.color.push(o), s.push(xs), i.push(D.parse(r))) : r.startsWith(So) ? (n.var.push(o), s.push(Po), i.push(r)) : (n.number.push(o), s.push(Ts), i.push(parseFloat(r))), ++o, Fi)).split(Fi), indexes: n, types: s }; } function Ao(t) { return At(t).values; } function ws({ split: t, types: e }) { const i = t.length; return (n) => { let s = ""; for (let o = 0; o < i; o++) if (s += t[o], n[o] !== void 0) { const r = e[o]; r === Ts ? s += Bt(n[o]) : r === xs ? s += D.transform(n[o]) : s += n[o]; } return s; }; } function Vo(t) { return ws(At(t)); } var Mo = (t) => typeof t == "number" ? 0 : D.test(t) ? D.getAnimatableNone(t) : t, Co = (t, e) => typeof t == "number" ? e?.trim().endsWith("/") ? t : 0 : Mo(t); function Do(t) { const e = At(t); return ws(e)(e.values.map((i, n) => Co(i, e.split[n]))); } var G = { test: wo, parse: Ao, createTransformer: Vo, getAnimatableNone: Do }; function ye(t, e, i) { return i < 0 && (i += 1), i > 1 && (i -= 1), i < 1 / 6 ? t + (e - t) * 6 * i : i < 1 / 2 ? e : i < 2 / 3 ? t + (e - t) * (2 / 3 - i) * 6 : t; } function Eo({ hue: t, saturation: e, lightness: i, alpha: n }) { t /= 360, e /= 100, i /= 100; let s = 0, o = 0, r = 0; if (!e) s = o = r = i; else { const a = i < 0.5 ? i * (1 + e) : i + e - i * e, l = 2 * i - a; s = ye(l, a, t + 1 / 3), o = ye(l, a, t), r = ye(l, a, t - 1 / 3); } return { red: Math.round(s * 255), green: Math.round(o * 255), blue: Math.round(r * 255), alpha: n }; } function se(t, e) { return (i) => i > 0 ? e : t; } var V = (t, e, i) => t + (e - t) * i, Te = (t, e, i) => { const n = t * t, s = i * (e * e - n) + n; return s < 0 ? 0 : Math.sqrt(s); }, Ro = [ ke, pt, wt ], Lo = (t) => Ro.find((e) => e.test(t)); function Oi(t) { const e = Lo(t); if (Ct(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`, "color-not-animatable"), !e) return !1; let i = e.parse(t); return e === wt && (i = Eo(i)), i; } var ji = (t, e) => { const i = Oi(t), n = Oi(e); if (!i || !n) return se(t, e); const s = { ...i }; return (o) => (s.red = Te(i.red, n.red, o), s.green = Te(i.green, n.green, o), s.blue = Te(i.blue, n.blue, o), s.alpha = V(i.alpha, n.alpha, o), pt.transform(s)); }, Be = /* @__PURE__ */ new Set(["none", "hidden"]); function ko(t, e) { return Be.has(t) ? (i) => i <= 0 ? t : e : (i) => i >= 1 ? e : t; } function Bo(t, e) { return (i) => V(t, e, i); } function di(t) { return typeof t == "number" ? Bo : typeof t == "string" ? ci(t) ? se : D.test(t) ? ji : Oo : Array.isArray(t) ? Ps : typeof t == "object" ? D.test(t) ? ji : Io : se; } function Ps(t, e) { const i = [...t], n = i.length, s = t.map((o, r) => di(o)(o, e[r])); return (o) => { for (let r = 0; r < n; r++) i[r] = s[r](o); return i; }; } function Io(t, e) { const i = { ...t, ...e }, n = {}; for (const s in i) t[s] !== void 0 && e[s] !== void 0 && (n[s] = di(t[s])(t[s], e[s])); return (s) => { for (const o in n) i[o] = n[o](s); return i; }; } function Fo(t, e) { const i = [], n = { color: 0, var: 0, number: 0 }; for (let s = 0; s < e.values.length; s++) { const o = e.types[s], r = t.indexes[o][n[o]]; i[s] = t.values[r] ?? 0, n[o]++; } return i; } var Oo = (t, e) => { const i = G.createTransformer(e), n = At(t), s = At(e); return n.indexes.var.length === s.indexes.var.length && n.indexes.color.length === s.indexes.color.length && n.indexes.number.length >= s.indexes.number.length ? Be.has(t) && !s.values.length || Be.has(e) && !n.values.length ? ko(t, e) : Wt(Ps(Fo(n, s), s.values), i) : (Ct(!0, `Complex values '${t}' and '${e}' 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.`, "complex-values-different"), se(t, e)); }; function Ss(t, e, i) { return typeof t == "number" && typeof e == "number" && typeof i == "number" ? V(t, e, i) : di(t)(t, e); } var jo = (t) => { const e = ({ timestamp: i }) => t(i); return { start: (i = !0) => A.update(e, i), stop: () => ot(e), now: () => B.isProcessing ? B.timestamp : O.now() }; }, bs = (t, e, i = 10) => { let n = ""; const s = Math.max(Math.round(e / i), 2); for (let o = 0; o < s; o++) n += Math.round(t(o / (s - 1)) * 1e4) / 1e4 + ", "; return `linear(${n.substring(0, n.length - 2)})`; }, As = 2e4; function pi(t) { let e = 0; const i = 50; let n = t.next(e); for (; !n.done && e < 2e4; ) e += i, n = t.next(e); return e >= 2e4 ? 1 / 0 : e; } function No(t, e = 100, i) { const n = i({ ...t, keyframes: [0, e] }), s = Math.min(pi(n), As); return { type: "keyframes", ease: (o) => n.next(s * o).value / e, duration: K(s) }; } var M = { stiffness: 100, damping: 10, mass: 1, velocity: 0, duration: 800, bounce: 0.3, visualDuration: 0.3, restSpeed: { granular: 0.01, default: 2 }, restDelta: { granular: 5e-3, default: 0.5 }, minDuration: 0.01, maxDuration: 10, minDamping: 0.05, maxDamping: 1 }; function Ie(t, e) { return t * Math.sqrt(1 - e * e); } var Uo = 12; function Wo(t, e, i) { let n = i; for (let s = 1; s < Uo; s++) n = n - t(n) / e(n); return n; } var xe = 1e-3; function _o({ duration: t = M.duration, bounce: e = M.bounce, velocity: i = M.velocity, mass: n = M.mass }) { let s, o; Ct(t <= W(M.maxDuration), "Spring duration must be 10 seconds or less", "spring-duration-limit"); let r = 1 - e; r = tt(M.minDamping, M.maxDamping, r), t = tt(M.minDuration, M.maxDuration, K(t)), r < 1 ? (s = (c) => { const u = c * r, h = u * t, f = u - i, p = Ie(c, r), d = Math.exp(-h); return xe - f / p * d; }, o = (c) => { const u = c * r * t, h = u * i + i, f = Math.pow(r, 2) * Math.pow(c, 2) * t, p = Math.exp(-u), d = Ie(Math.pow(c, 2), r); return (-s(c) + xe > 0 ? -1 : 1) * ((h - f) * p) / d; }) : (s = (c) => { const u = Math.exp(-c * t), h = (c - i) * t + 1; return -xe + u * h; }, o = (c) => Math.exp(-c * t) * ((i - c) * (t * t))); const a = 5 / t, l = Wo(s, o, a); if (t = W(t), isNaN(l)) return { stiffness: M.stiffness, damping: M.damping, duration: t }; { const c = Math.pow(l, 2) * n; return { stiffness: c, damping: r * 2 * Math.sqrt(n * c), duration: t }; } } var Ko = ["duration", "bounce"], $o = [ "stiffness", "damping", "mass" ]; function Ni(t, e) { return e.some((i) => t[i] !== void 0); } function zo(t) { let e = { velocity: M.velocity, stiffness: M.stiffness, damping: M.damping, mass: M.mass, isResolvedFromDuration: !1, ...t }; if (!Ni(t, $o) && Ni(t, Ko)) if (e.velocity = 0, t.visualDuration) { const i = t.visualDuration, n = 2 * Math.PI / (i * 1.2), s = n * n, o = 2 * tt(0.05, 1, 1 - (t.bounce || 0)) * Math.sqrt(s); e = { ...e, mass: M.mass, stiffness: s, damping: o }; } else { const i = _o({ ...t, velocity: 0 }); e = { ...e, ...i, mass: M.mass }, e.isResolvedFromDuration = !0; } return e; } function re(t = M.visualDuration, e = M.bounce) { const i = typeof t != "object" ? { visualDuration: t, keyframes: [0, 1], bounce: e } : t; let { restSpeed: n, restDelta: s } = i; const o = i.keyframes[0], r = i.keyframes[i.keyframes.length - 1], a = { done: !1, value: o }, { stiffness: l, damping: c, mass: u, duration: h, velocity: f, isResolvedFromDuration: p } = zo({ ...i, velocity: -K(i.velocity || 0) }), d = f || 0, m = c / (2 * Math.sqrt(l * u)), g = r - o, v = K(Math.sqrt(l / u)), x = Math.abs(g) < 5; n || (n = x ? M.restSpeed.granular : M.restSpeed.default), s || (s = x ? M.restDelta.granular : M.restDelta.default); let y, w, b, E, L, P; if (m < 1) b = Ie(v, m), E = (d + m * v * g) / b, y = (S) => r - Math.exp(-m * v * S) * (E * Math.sin(b * S) + g * Math.cos(b * S)), L = m * v * E + g * b, P = m * v * g - E * b, w = (S) => Math.exp(-m * v * S) * (L * Math.sin(b * S) + P * Math.cos(b * S)); else if (m === 1) { y = (F) => r - Math.exp(-v * F) * (g + (d + v * g) * F); const S = d + v * g; w = (F) => Math.exp(-v * F) * (v * S * F - d); } else { const S = v * Math.sqrt(m * m - 1); y = (X) => { const et = Math.exp(-m * v * X), Y = Math.min(S * X, 300); return r - et * ((d + m * v * g) * Math.sinh(Y) + S * g * Math.cosh(Y)) / S; }; const F = (d + m * v * g) / S, N = m * v * F - g * S, lt = m * v * g - F * S; w = (X) => { const et = Math.exp(-m * v * X), Y = Math.min(S * X, 300); return et * (N * Math.sinh(Y) + lt * Math.cosh(Y)); }; } const C = { calculatedDuration: p && h || null, velocity: (S) => W(w(S)), next: (S) => { if (!p && m < 1) { const N = Math.exp(-m * v * S), lt = Math.sin(b * S), X = Math.cos(b * S), et = r - N * (E * lt + g * X), Y = W(N * (L * lt + P * X)); return a.done = Math.abs(Y) <= n && Math.abs(r - et) <= s, a.value = a.done ? r : et, a; } const F = y(S); if (p) a.done = S >= h; else { const N = W(w(S)); a.done = Math.abs(N) <= n && Math.abs(r - F) <= s; } return a.value = a.done ? r : F, a; }, toString: () => { const S = Math.min(pi(C), As), F = bs((N) => C.next(S * N).value, S, 30); return S + "ms " + F; }, toTransition: () => { } }; return C; } re.applyToOptions = (t) => { const e = No(t, 100, re); return t.ease = e.ease, t.duration = W(e.duration), t.type = "keyframes", t; }; var Ho = 5; function Vs(t, e, i) { const n = Math.max(e - Ho, 0); return ss(i - t(n), e - n); } function Fe({ keyframes: t, velocity: e = 0, power: i = 0.8, timeConstant: n = 325, bounceDamping: s = 10, bounceStiffness: o = 500, modifyTarget: r, min: a, max: l, restDelta: c = 0.5, restSpeed: u }) { const h = t[0], f = { done: !1, value: h }, p = (P) => a !== void 0 && P < a || l !== void 0 && P > l, d = (P) => a === void 0 ? l : l === void 0 || Math.abs(a - P) < Math.abs(l - P) ? a : l; let m = i * e; const g = h + m, v = r === void 0 ? g : r(g); v !== g && (m = v - h); const x = (P) => -m * Math.exp(-P / n), y = (P) => v + x(P), w = (P) => { const C = x(P), S = y(P); f.done = Math.abs(C) <= c, f.value = f.done ? v : S; }; let b, E; const L = (P) => { p(f.value) && (b = P, E = re({ keyframes: [f.value, d(f.value)], velocity: Vs(y, P, f.value), damping: s, stiffness: o, restDelta: c, restSpeed: u })); }; return L(0), { calculatedDuration: null, next: (P) => { let C = !1; return !E && b === void 0 && (C = !0, w(P), L(P)), b !== void 0 && P >= b ? E.next(P - b) : (!C && w(P), f); } }; } function Go(t, e, i) { const n = [], s = i || rt.mix || Ss, o = t.length - 1; for (let r = 0; r < o; r++) { let a = s(t[r], t[r + 1]); e && (a = Wt(Array.isArray(e) ? e[r] || $ : e, a)), n.push(a); } return n; } function Xo(t, e, { clamp: i = !0, ease: n, mixer: s } = {}) { const o = t.length; if (it(o === e.length, "Both input and output ranges must be the same length", "range-length"), o === 1) return () => e[0]; if (o === 2 && e[0] === e[1]) return () => e[1]; const r = t[0] === t[1]; t[0] > t[o - 1] && (t = [...t].reverse(), e = [...e].reverse()); const a = Go(e, n, s), l = a.length, c = (u) => { if (r && u < t[0]) return e[0]; let h = 0; if (l > 1) for (; h < t.length - 2 && !(u < t[h + 1]); h++) ; const f = Ot(t[h], t[h + 1], u); return a[h](f); }; return i ? (u) => c(tt(t[0], t[o - 1], u)) : c; } function Yo(t, e) { const i = t[t.length - 1]; for (let n = 1; n <= e; n++) { const s = Ot(0, e, n); t.push(V(i, 1, s)); } } function qo(t) { const e = [0]; return Yo(e, t.length - 1), e; } function Zo(t, e) { return t.map((i) => i * e); } function Jo(t, e) { return t.map(() => e || ds).splice(0, t.length - 1); } function Pt({ duration: t = 300, keyframes: e, times: i, ease: n = "easeInOut" }) { const s = oo(n) ? n.map(ki) : ki(n), o = { done: !1, value: e[0] }, r = Xo(Zo(i && i.length === e.length ? i : qo(e), t), e, { ease: Array.isArray(s) ? s : Jo(e, s) }); return { calculatedDuration: t, next: (a) => (o.value = r(a), o.done = a >= t, o) }; } var Qo = (t) => t !== null; function fe(t, { repeat: e, repeatType: i = "loop" }, n, s = 1) { const o = t.filter(Qo), r = s < 0 || e && i !== "loop" && e % 2 === 1 ? 0 : o.length - 1; return !r || n === void 0 ? o[r] : n; } var ta = { decay: Fe, inertia: Fe, tween: Pt, keyframes: Pt, spring: re }; function Ms(t) { typeof t.type == "string" && (t.type = ta[t.type]); } var mi = class { constructor() { this.updateFinished(); } get finished() { return this._finished; } updateFinished() { this._finished = new Promise((t) => { this.resolve = t; }); } notifyFinished() { this.resolve(); } then(t, e) { return this.finished.then(t, e); } }, ea = (t) => t / 100, oe = class extends mi { constructor(t) { super(), this.state = "idle", this.startTime = null, this.isStopped = !1, this.currentTime = 0, this.holdTime = null, this.playbackSpeed = 1, this.delayState = { done: !1, value: void 0 }, this.stop = () => { const { motionValue: e } = this.options; e && e.updatedAt !== O.now() && this.tick(O.now()), this.isStopped = !0, this.state !== "idle" && (this.teardown(), this.options.onStop?.()); }, vt.mainThread++, this.options = t, this.initAnimation(), this.play(), t.autoplay === !1 && this.pause(); } initAnimation() { const { options: t } = this; Ms(t); const { type: e = Pt, repeat: i = 0, repeatDelay: n = 0, repeatType: s, velocity: o = 0 } = t; let { keyframes: r } = t; const a = e || Pt; process.env.NODE_ENV !== "production" && a !== Pt && it(r.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${r}`, "spring-two-frames"), a !== Pt && typeof r[0] != "number" && (this.mixKeyframes = Wt(ea, Ss(r[0], r[1])), r = [0, 100]); const l = a({ ...t, keyframes: r }); s === "mirror" && (this.mirroredGenerator = a({ ...t, keyframes: [...r].reverse(), velocity: -o })), l.calculatedDuration === null && (l.calculatedDuration = pi(l)); const { calculatedDuration: c } = l; this.calculatedDuration = c, this.resolvedDuration = c + n, this.totalDuration = this.resolvedDuration * (i + 1) - n, this.generator = l; } updateTime(t) { const e = Math.round(t - this.startTime) * this.playbackSpeed; this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = e; } tick(t, e = !1) { const { generator: i, totalDuration: n, mixKeyframes: s, mirroredGenerator: o, resolvedDuration: r, calculatedDuration: a } = this; if (this.startTime === null) return i.next(0); const { delay: l = 0, keyframes: c, repeat: u, repeatType: h, repeatDelay: f, type: p, onUpdate: d, finalKeyframe: m } = this.options; this.speed > 0 ? this.startTime = Math.min(this.startTime, t) : this.speed < 0 && (this.startTime = Math.min(t - n / this.speed, this.startTime)), e ? this.currentTime = t : this.updateTime(t); const g = this.currentTime - l * (this.playbackSpeed >= 0 ? 1 : -1), v = this.playbackSpeed >= 0 ? g < 0 : g > n; this.currentTime = Math.max(g, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = n); let x = this.currentTime, y = i; if (u) { const L = Math.min(this.currentTime, n) / r; let P = Math.floor(L), C = L % 1; !C && L >= 1 && (C = 1), C === 1 && P--, P = Math.min(P, u + 1), P % 2 && (h === "reverse" ? (C = 1 - C, f && (C -= f / r)) : h === "mirror" && (y = o)), x = tt(0, 1, C) * r; } let w; v ? (this.delayState.value = c[0], w = this.delayState) : w = y.next(x), s && !v && (w.value = s(w.value)); let { done: b } = w; !v && a !== null && (b = this.playbackSpeed >= 0 ? this.currentTime >= n : this.currentTime <= 0); const E = this.holdTime === null && (this.state === "finished" || this.state === "running" && b); return E && p !== Fe && (w.value = fe(c, this.options, m, this.speed)), d && d(w.value), E && this.finish(), w; } then(t, e) { return this.finished.then(t, e); } get duration() { return K(this.calculatedDuration); } get iterationDuration() { const { delay: t = 0 } = this.options || {}; return this.duration + K(t); } get time() { return K(this.currentTime); } set time(t) { t = W(t), this.currentTime = t, this.startTime === null || this.holdTime !== null || this.playbackSpeed === 0 ? this.holdTime = t : this.driver && (this.startTime = this.driver.now() - t / this.playbackSpeed), this.driver ? this.driver.start(!1) : (this.startTime = 0, this.state = "paused", this.holdTime = t, this.tick(t)); } getGeneratorVelocity() { const t = this.currentTime; if (t <= 0) return this.options.velocity || 0; if (this.generator.velocity) return this.generator.velocity(t); const e = this.generator.next(t).value; return Vs((i) => this.generator.next(i).value, t, e); } get speed() { return this.playbackSpeed; } set speed(t) { const e = this.playbackSpeed !== t; e && this.driver && this.updateTime(O.now()), this.playbackSpeed = t, e && this.driver && (this.time = K(this.currentTime)); } play() { if (this.isStopped) return; const { driver: t = jo, startTime: e } = this.options; this.driver || (this.driver = t((n) => this.tick(n))), this.options.onPlay?.(); const i = this.driver.now(); this.state === "finished" ? (this.updateFinished(), this.startTime = i) : this.holdTime !== null ? this.startTime = i - this.holdTime : this.startTime || (this.startTime = e ?? i), this.state === "finished" && this.speed < 0 && (this.startTime += this.calculatedDuration), this.holdTime = null, this.state = "running", this.driver.start(); } pause() { this.state = "paused", this.updateTime(O.now()), this.holdTime = this.currentTime; } complete() { this.state !== "running" && this.play(), this.state = "finished", this.holdTime = null; } finish() { this.notifyFinished(), this.teardown(), this.state = "finished", this.options.onComplete?.(); } cancel() { this.holdTime = null, this.startTime = 0, this.tick(0), this.teardown(), this.options.onCancel?.(); } teardown() { this.state = "idle", this.stopDriver(), this.startTime = this.holdTime = null, vt.mainThread--; } stopDriver() { this.driver && (this.driver.stop(), this.driver = void 0); } sample(t) { return this.startTime = 0, this.tick(t, !0); } attachTimeline(t) { return this.options.allowFlatten && (this.options.type = "keyframes", this.options.ease = "linear", this.initAnimation()), this.driver?.stop(), t.observe(this); } }; function ia(t) { for (let e = 1; e < t.length; e++) t[e] ?? (t[e] = t[e - 1]); } var mt = (t) => t * 180 / Math.PI, Oe = (t) => je(mt(Math.atan2(t[1], t[0]))), na = { x: 4, y: 5, translateX: 4, translateY: 5, scaleX: 0, scaleY: 3, scale: (t) => (Math.abs(t[0]) + Math.abs(t[3])) / 2, rotate: Oe, rotateZ: Oe, skewX: (t) => mt(Math.atan(t[1])), skewY: (t) => mt(Math.atan(t[2])), skew: (t) => (Math.abs(t[1]) + Math.abs(t[2])) / 2 }, je = (t) => (t = t % 360, t < 0 && (t += 360), t), Ui = Oe, Wi = (t) => Math.sqrt(t[0] * t[0] + t[1] * t[1]), _i = (t) => Math.sqrt(t[4] * t[4] + t[5] * t[5]), sa = { x: 12, y: 13, z: 14, translateX: 12, translateY: 13, translateZ: 14, scaleX: Wi, scaleY: _i, scale: (t) => (Wi(t) + _i(t)) / 2, rotateX: (t) => je(mt(Math.atan2(t[6], t[5]))), rotateY: (t) => je(mt(Math.atan2(-t[2], t[0]))), rotateZ: Ui, rotate: Ui, skewX: (t) => mt(Math.atan(t[4])), skewY: (t) => mt(Math.atan(t[1])), skew: (t) => (Math.abs(t[1]) + Math.abs(t[4])) / 2 }; function Ne(t) { return t.includes("scale") ? 1 : 0; } function Ue(t, e) { if (!t || t === "none") return Ne(e); const i = t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u); let n, s; if (i) n = sa, s = i; else { const a = t.match(/^matrix\(([-\d.e\s,]+)\)$/u); n = na, s = a; } if (!s) return Ne(e); const o = n[e], r = s[1].split(",").map(oa); return typeof o == "function" ? o(r) : r[o]; } var ra = (t, e) => { const { transform: i = "none" } = getComputedStyle(t); return Ue(i, e); }; function oa(t) { return parseFloat(t.trim()); } var Et = [ "transformPerspective", "x", "y", "z", "translateX", "translateY", "translateZ", "scale", "scaleX", "scaleY", "rotate", "rotateX", "rotateY", "rotateZ", "skew", "skewX", "skewY" ], Rt = new Set(Et), Ki = (t) => t === Dt || t === T, aa = /* @__PURE__ */ new Set([ "x", "y", "z" ]), la = Et.filter((t) => !aa.has(t)); function ua(t) { const e = []; return la.forEach((i) => { const n = t.getValue(i); n !== void 0 && (e.push([i, n.get()]), n.set(i.startsWith("scale") ? 1 : 0)); }), e; } var st = { width: ({ x: t }, { paddingLeft: e = "0", paddingRight: i = "0", boxSizing: n }) => { const s = t.max - t.min; return n === "border-box" ? s : s - parseFloat(e) - parseFloat(i); }, height: ({ y: t }, { paddingTop: e = "0", paddingBottom: i = "0", boxSizing: n }) => { const s = t.max - t.min; return n === "border-box" ? s : s - parseFloat(e) - parseFloat(i); }, top: (t, { top: e }) => parseFloat(e), left: (t, { left: e }) => parseFloat(e), bottom: ({ y: t }, { top: e }) => parseFloat(e) + (t.max - t.min), right: ({ x: t }, { left: e }) => parseFloat(e) + (t.max - t.min), x: (t, { transform: e }) => Ue(e, "x"), y: (t, { transform: e }) => Ue(e, "y") }; st.translateX = st.x; st.translateY = st.y; var gt = /* @__PURE__ */ new Set(), We = !1, _e = !1, Ke = !1; function Cs() { if (_e) { const t = Array.from(gt).filter((n) => n.needsMeasurement), e = new Set(t.map((n) => n.element)), i = /* @__PURE__ */ new Map(); e.forEach((n) => { const s = ua(n); s.length && (i.set(n, s), n.render()); }), t.forEach((n) => n.measureInitialState()), e.forEach((n) => { n.render(); const s = i.get(n); s && s.forEach(([o, r]) => { n.getValue(o)?.set(r); }); }), t.forEach((n) => n.measureEndState()), t.forEach((n) => { n.suspendedScrollY !== void 0 && window.scrollTo(0, n.suspendedScrollY); }); } _e = !1, We = !1, gt.forEach((t) => t.complete(Ke)), gt.clear(); } function Ds() { gt.forEach((t) => { t.readKeyframes(), t.needsMeasurement && (_e = !0); }); } function ca() { Ke = !0, Ds(), Cs(), Ke = !1; } var vi = class { constructor(t, e, i, n, s, o = !1) { this.state = "pending", this.isAsync = !1, this.needsMeasurement = !1, this.unresolvedKeyframes = [...t], this.onComplete = e, this.name = i, this.motionValue = n, this.element = s, this.isAsync = o; } scheduleResolve() { this.state = "scheduled", this.isAsync ? (gt.add(this), We || (We = !0, A.read(Ds), A.resolveKeyframes(Cs))) : (this.readKeyframes(), this.complete()); } readKeyframes() { const { unresolvedKeyframes: t, name: e, element: i, motionValue: n } = this; if (t[0] === null) { const s = n?.get(), o = t[t.length - 1]; if (s !== void 0) t[0] = s; else if (i && e) { const r = i.readValue(e, o); r != null && (t[0] = r); } t[0] === void 0 && (t[0] = o), n && s === void 0 && n.set(t[0]); } ia(t); } setFinalKeyframe() { } measureInitialState() { } renderEndStyles() { } measureEndState() { } complete(t = !1) { this.state = "complete", this.onComplete(this.unresolvedKeyframes, this.finalKeyframe, t), gt.delete(this); } cancel() { this.state === "scheduled" && (gt.delete(this), this.state = "pending"); } resume() { this.state === "pending" && this.scheduleResolve(); } }, ha = (t) => t.startsWith("--"); function Es(t, e, i) { ha(e) ? t.style.setProperty(e, i) : t.style[e] = i; } var fa = {}; function Rs(t, e) { const i = /* @__PURE__ */ ns(t); return () => fa[e] ?? i(); } var da = /* @__PURE__ */ Rs(() => window.ScrollTimeline !== void 0, "scrollTimeline"), Ls = /* @__PURE__ */ Rs(() => { try { document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" }); } catch { return !1; } return !0; }, "linearEasing"), kt = ([t, e, i, n]) => `cubic-bezier(${t}, ${e}, ${i}, ${n})`, $i = { linear: "linear", ease: "ease", easeIn: "ease-in", easeOut: "ease-out", easeInOut: "ease-in-out", circIn: /* @__PURE__ */ kt([ 0, 0.65, 0.55, 1 ]), circOut: /* @__PURE__ */ kt([ 0.55, 0, 1, 0.45 ]), backIn: /* @__PURE__ */ kt([ 0.31, 0.01, 0.66, -0.59 ]), backOut: /* @__PURE__ */ kt([ 0.33, 1.53, 0.69, 0.99 ]) }; function ks(t, e) { if (t) return typeof t == "function" ? Ls() ? bs(t, e) : "ease-out" : ps(t) ? kt(t) : Array.isArray(t) ? t.map((i) => ks(i, e) || $i.easeOut) : $i[t]; } function pa(t, e, i, { delay: n = 0, duration: s = 300, repeat: o = 0, repeatType: r = "loop", ease: a = "easeOut", times: l } = {}, c = void 0) { const u = { [e]: i }; l && (u.offset = l); const h = ks(a, s); Array.isArray(h) && (u.easing = h), J.value && vt.waapi++; const f = { delay: n, duration: s, easing: Array.isArray(h) ? "linear" : h, fill: "both", iterations: o + 1, direction: r === "reverse" ? "alternate" : "normal" }; c && (f.pseudoElement = c); const p = t.animate(u, f); return J.value && p.finished.finally(() => { vt.waapi--; }), p; } function Bs(t) { return typeof t == "function" && "applyToOptions" in t; } function ma({ type: t, ...e }) { return Bs(t) && Ls() ? t.applyToOptions(e) : (e.duration ?? (e.duration = 300), e.ease ?? (e.ease = "easeOut"), e); } var Is = class extends mi { constructor(t) { if (super(), this.finishedTime = null, this.isStopped = !1, this.manualStartTime = null, !t) return; const { element: e, name: i, keyframes: n, pseudoElement: s, allowFlatten: o = !1, finalKeyframe: r, onComplete: a } = t; this.isPseudoElement = !!s, this.allowFlatten = o, this.options = t, it(typeof t.type != "string", `Mini animate() doesn't support "type" as a string.`, "mini-spring"); const l = ma(t); this.animation = pa(e, i, n, l, s), l.autoplay === !1 && this.animation.pause(), this.animation.onfinish = () => { if (this.finishedTime = this.time, !s) { const c = fe(n, this.options, r, this.speed); this.updateMotionValue && this.updateMotionValue(c), Es(e, i, c), this.animation.cancel(); } a?.(), this.notifyFinished(); }; } play() { this.isStopped || (this.manualStartTime = null, this.animation.play(), this.state === "finished" && this.updateFinished()); } pause() { this.animation.pause(); } complete() { this.animation.finish?.(); } cancel() { try { this.animation.cancel(); } catch { } } stop() { if (this.isStopped) return; this.isStopped = !0; const { state: t } = this; t === "idle" || t === "finished" || (this.updateMotionValue ? this.updateMotionValue() : this.commitStyles(), this.isPseudoElement || this.cancel()); } commitStyles() { const t = this.options?.element; !this.isPseudoElement && t?.isConnected && this.animation.commitStyles?.(); } get duration() { const t = this.animation.effect?.getComputedTiming?.().duration || 0; return K(Number(t)); } get iterationDuration() { const { delay: t = 0 } = this.options || {}; return this.duration + K(t); } get time() { return K(Number(this.animation.currentTime) || 0); } set time(t) { const e = this.finishedTime !== null; this.manualStartTime = null, this.finishedTime = null, this.animation.currentTime = W(t), e && this.animation.pause(); } get speed() { return this.animation.playbackRate; } set speed(t) { t < 0 && (this.finishedTime = null), this.animation.playbackRate = t; } get state() { return this.finishedTime !== null ? "finished" : this.animation.playState; } get startTime() { return this.manualStartTime ?? Number(this.animation.startTime); } set startTime(t) { this.manualStartTime = this.animation.startTime = t; } attachTimeline({ timeline: t, rangeStart: e, rangeEnd: i, observe: n }) { return this.allowFlatten && this.animation.effect?.updateTiming({ easing: "linear" }), this.animation.onfinish = null, t && da() ? (this.animation.timeline = t, e && (this.animation.rangeStart = e), i && (this.animation.rangeEnd = i), $) : n(this); } }, Fs = { anticipate: cs, backInOut: us, circInOut: fs }; function va(t) { return t in Fs; } function ga(t) { typeof t.ease == "string" && va(t.ease) && (t.ease = Fs[t.ease]); } var we = 10, ya = class extends Is { constructor(t) { ga(t), Ms(t), super(t), t.startTime !== void 0 && t.autoplay !== !1 && (this.startTime = t.startTime), this.options = t; } updateMotionValue(t) { const { motionValue: e, onUpdate: i, onComplete: n, element: s, ...o } = this.options; if (!e) return; if (t !== void 0) { e.set(t); return; } const r = new oe({ ...o, autoplay: !1 }), a = Math.max(we, O.now() - this.startTime), l = tt(0, we, a - we), c = r.sample(a).value, { name: u } = this.options; s && u && Es(s, u, c), e.setWithVelocity(r.sample(Math.max(0, a - l)).value, c, l), r.stop(); } }, zi = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && (G.test(t) || t === "0") && !t.startsWith("url(")); function Ta(t) { const e = t[0]; if (t.length === 1) return !0; for (let i = 0; i < t.length; i++) if (t[i] !== e) return !0; } function xa(t, e, i, n) { const s = t[0]; if (s === null) return !1; if (e === "display" || e === "visibility") return !0; const o = t[t.length - 1], r = zi(s, e), a = zi(o, e); return Ct(r === a, `You are trying to animate ${e} from "${s}" to "${o}". "${r ? o : s}" is not an animatable value.`, "value-not-animatable"), !r || !a ? !1 : Ta(t) || (i === "spring" || Bs(i)) && n; } function $e(t) { t.duration = 0, t.type = "keyframes"; } var Os = /* @__PURE__ */ new Set([ "opacity", "clipPath", "filter", "transform" ]), wa = /^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/; function Pa(t) { for (let e = 0; e < t.length; e++) if (typeof t[e] == "string" && wa.test(t[e])) return !0; return !1; } var Sa = /* @__PURE__ */ new Set([ "color", "backgroundColor", "outlineColor", "fill", "stroke", "borderColor", "borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor" ]), ba = /* @__PURE__ */ ns(() => Object.hasOwnProperty.call(Element.prototype, "animate")); function Aa(t) { const { motionValue: e, name: i, repeatDelay: n, repeatType: s, damping: o, type: r, keyframes: a } = t; if (!(e?.owner?.current instanceof HTMLElement)) return !1; const { onUpdate: l, transformTemplate: c } = e.owner.getProps(); return ba() && i && (Os.has(i) || Sa.has(i) && Pa(a)) && (i !== "transform" || !c) && !l && !n && s !== "mirror" && o !== 0 && r !== "inertia"; } var Va = 40, Ma = class extends mi { constructor({ autoplay: t = !0, delay: e = 0, type: i = "keyframes", repeat: n = 0, repeatDelay: s = 0, repeatType: o = "loop", keyframes: r, name: a, motionValue: l, element: c, ...u }) { super(), this.stop = () => { this._animation && (this._animation.stop(), this.stopTimeline?.()), this.keyframeResolver?.cancel(); }, this.createdAt = O.now(); const h = { autoplay: t, delay: e, type: i, repeat: n, repeatDelay: s, repeatType: o, name: a, motionValue: l, element: c, ...u }, f = c?.KeyframeResolver || vi; this.keyframeResolver = new f(r, (p, d, m) => this.onKeyframesResolved(p, d, h, !m), a, l, c), this.keyframeResolver?.scheduleResolve(); } onKeyframesResolved(t, e, i, n) { this.keyframeResolver = void 0; const { name: s, type: o, velocity: r, delay: a, isHandoff: l, onUpdate: c } = i; this.resolvedAt = O.now(); let u = !0; xa(t, s, o, r) || (u = !1, (rt.instantAnimations || !a) && c?.(fe(t, i, e)), t[0] = t[t.length - 1], $e(i), i.repeat = 0); const h = { startTime: n ? this.resolvedAt ? this.resolvedAt - this.createdAt > Va ? this.resolvedAt : this.createdAt : this.createdAt : void 0, finalKeyframe: e, ...i, keyframes: t }, f = u && !l && Aa(h), p = h.motionValue?.owner?.current; let d; if (f) try { d = new ya({ ...h, element: p }); } catch { d = new oe(h); } else d = new oe(h); d.finished.then(() => { this.notifyFinished(); }).catch($), this.pendingTimeline && (this.stopTimeline = d.attachTimeline(this.pendingTimeline), this.pendingTimeline = void 0), this._animation = d; } get finished() { return this._animation ? this.animation.finished : this._finished; } then(t, e) { return this.finished.finally(t).then(() => { }); } get animation() { return this._animation || (this.keyframeResolver?.resume(), ca()), this._animation; } get duration() { return this.animation.duration; } get iterationDuration() { return this.animation.iterationDuration; } get time() { return this.animation.time; } set time(t) { this.animation.time = t; } get speed() { return this.animation.speed; } get state() { return this.animation.state; } set speed(t) { this.animation.speed = t; } get startTime() { return this.animation.startTime; } attachTimeline(t) { return this._animation ? this.stopTimeline = this.animation.attachTimeline(t) : this.pendingTimeline = t, () => this.stop(); } play() { this.animation.play(); } pause() { this.animation.pause(); } complete() { this.animation.complete(); } cancel() { this._animation && this.animation.cancel(), this.keyframeResolver?.cancel(); } }; function js(t, e, i, n = 0, s = 1) { const o = Array.from(t).sort((l, c) => l.sortNodePosition(c)).indexOf(e), r = t.size, a = (r - 1) * n; return typeof i == "function" ? i(o, r) : s === 1 ? o * n : a - o * n; } var Ca = /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u; function Da(t) { const e = Ca.exec(t); if (!e) return [,]; const [, i, n, s] = e; return [`--${i ?? n}`, s]; } var Ea = 4; function Ns(t, e, i = 1) { it(i <= Ea, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`, "max-css-var-depth"); const [n, s] = Da(t); if (!n) return; const o = window.getComputedStyle(e).getPropertyValue(n); if (o) { const r = o.trim(); return ts(r) ? parseFloat(r) : r; } return ci(s) ? Ns(s, e, i + 1) : s; } var Ra = { type: "spring", stiffness: 500, damping: 25, restSpeed: 10 }, La = (t) => ({ type: "spring", stiffness: 550, damping: t === 0 ? 2 * Math.sqrt(550) : 30, restSpeed: 10 }), ka = { type: "keyframes", duration: 0.8 }, Ba = { type: "keyframes", ease: [ 0.25, 0.1, 0.35, 1 ], duration: 0.3 }, Ia = (t, { keyframes: e }) => e.length > 2 ? ka : Rt.has(t) ? t.startsWith("scale") ? La(e[1]) : Ra : Ba; function Us(t, e) { if (t?.inherit && e) { const { inherit: i, ...n } = t; return { ...e, ...n }; } return t; } function gi(t, e) { const i = t?.[e] ?? t?.default ?? t; return i !== t ? Us(i, t) : i; } var Fa = /* @__PURE__ */ new Set([ "when", "delay", "delayChildren", "staggerChildren", "staggerDirection", "repeat", "repeatType", "repeatDelay", "from", "elapsed" ]); function Oa(t) { for (const e in t) if (!Fa.has(e)) return !0; return !1; } var yi = (t, e, i, n = {}, s, o) => (r) => { const a = gi(n, t) || {}, l = a.delay || n.delay || 0; let { elapsed: c = 0 } = n; c = c - W(l); const u = { keyframes: Array.isArray(i) ? i : [null, i], ease: "easeOut", velocity: e.getVelocity(), ...a, delay: -c, onUpdate: (f) => { e.set(f), a.onUpdate && a.onUpdate(f); }, onComplete: () => { r(), a.onComplete && a.onComplete(); }, name: t, motionValue: e, element: o ? void 0 : s }; Oa(a) || Object.assign(u, Ia(t, u)), u.duration && (u.duration = W(u.duration)), u.repeatDelay && (u.repeatDelay = W(u.repeatDelay)), u.from !== void 0 && (u.keyframes[0] = u.from); let h = !1; if ((u.type === !1 || u.duration === 0 && !u.repeatDelay) && ($e(u), u.delay === 0 && (h = !0)), (rt.instantAnimations || rt.skipAnimations || s?.shouldSkipAnimations) && (h = !0, $e(u), u.delay = 0), u.allowFlatten = !a.type && !a.ease, h && !o && e.get() !== void 0) { const f = fe(u.keyframes, a); if (f !== void 0) { A.update(() => { u.onUpdate(f), u.onComplete(); }); return; } } return a.isSync ? new oe(u) : new Ma(u); }; function Hi(t) { const e = [{}, {}]; return t?.values.forEach((i, n) => { e[0][n] = i.get(), e[1][n] = i.getVelocity(); }), e; } function Ti(t, e, i, n) { if (typeof e == "function") { const [s, o] = Hi(n); e = e(i !== void 0 ? i : t.custom, s, o); } if (typeof e == "string" && (e = t.variants && t.variants[e]), typeof e == "function") { const [s, o] = Hi(n); e = e(i !== void 0 ? i : t.custom, s, o); } return e; } function yt(t, e, i) { const n = t.getProps(); return Ti(n, e, i !== void 0 ? i : n.custom, t); } var Ws = /* @__PURE__ */ new Set([ "width", "height", "top", "left", "right", "bottom", ...Et ]), Gi = 30, ja = (t) => !isNaN(parseFloat(t)), Xi = { current: void 0 }, Na = class { constructor(t, e = {}) { this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (i) => { const n = O.now(); if (this.updatedAt !== n && this.setPrevFrameValue(), this.prev = this.current, this.setCurrent(i), this.current !== this.prev && (this.events.change?.notify(this.current), this.dependents)) for (const s of this.dependents) s.dirty(); }, this.hasAnimated = !1, this.setCurrent(t), this.owner = e.owner; } setCurrent(t) { this.current = t, this.updatedAt = O.now(), this.canTrackVelocity === null && t !== void 0 && (this.canTrackVelocity = ja(this.current)); } setPrevFrameValue(t = this.current) { this.prevFrameValue = t, this.prevUpdatedAt = this.updatedAt; } onChange(t) { return process.env.NODE_ENV !== "production" && ai(!1, 'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'), this.on("change", t); } on(t, e) { this.events[t] || (this.events[t] = new oi()); const i = this.events[t].add(e); return t === "change" ? () => { i(), A.read(() => { this.events.change.getSize() || this.stop(); }); } : i; } clearListeners() { for (const t in this.events) this.events[t].clear(); } attach(t, e) { this.passiveEffect = t, this.stopPassiveEffect = e; } set(t) { this.passiveEffect ? this.passiveEffect(t, this.updateAndNotify) : this.updateAndNotify(t); } setWithVelocity(t, e, i) { this.set(e), this.prev = void 0, this.prevFrameValue = t, this.prevUpdatedAt = this.updatedAt - i