UNPKG

@acrool/react-jackpot

Version:
1,492 lines 177 kB
import zr, { createContext as Dt, useRef as It, useLayoutEffect as Hr, useEffect as Mt, useContext as $, useId as Xr, useCallback as fe, useMemo as de, useInsertionEffect as qr, forwardRef as Zr, Fragment as ii, createElement as Jr, Component as Qr, useState as cn } from "react"; var Ie = { exports: {} }, Ot = {}; /** * @license React * react-jsx-runtime.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var Wn; function to() { if (Wn) return Ot; Wn = 1; var t = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment"); function n(s, i, o) { var r = null; if (o !== void 0 && (r = "" + o), i.key !== void 0 && (r = "" + i.key), "key" in i) { o = {}; for (var a in i) a !== "key" && (o[a] = i[a]); } else o = i; return i = o.ref, { $$typeof: t, type: s, key: r, ref: i !== void 0 ? i : null, props: o }; } return Ot.Fragment = e, Ot.jsx = n, Ot.jsxs = n, Ot; } var jt = {}; /** * @license React * react-jsx-runtime.development.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var Kn; function eo() { return Kn || (Kn = 1, process.env.NODE_ENV !== "production" && function() { function t(m) { if (m == null) return null; if (typeof m == "function") return m.$$typeof === U ? null : m.displayName || m.name || null; if (typeof m == "string") return m; switch (m) { case p: return "Fragment"; case y: return "Profiler"; case T: return "StrictMode"; case b: return "Suspense"; case V: return "SuspenseList"; case F: return "Activity"; } if (typeof m == "object") switch (typeof m.tag == "number" && console.error( "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." ), m.$$typeof) { case g: return "Portal"; case v: return (m.displayName || "Context") + ".Provider"; case S: return (m._context.displayName || "Context") + ".Consumer"; case w: var A = m.render; return m = m.displayName, m || (m = A.displayName || A.name || "", m = m !== "" ? "ForwardRef(" + m + ")" : "ForwardRef"), m; case R: return A = m.displayName || null, A !== null ? A : t(m.type) || "Memo"; case P: A = m._payload, m = m._init; try { return t(m(A)); } catch { } } return null; } function e(m) { return "" + m; } function n(m) { try { e(m); var A = !1; } catch { A = !0; } if (A) { A = console; var D = A.error, B = typeof Symbol == "function" && Symbol.toStringTag && m[Symbol.toStringTag] || m.constructor.name || "Object"; return D.call( A, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", B ), e(m); } } function s(m) { if (m === p) return "<>"; if (typeof m == "object" && m !== null && m.$$typeof === P) return "<...>"; try { var A = t(m); return A ? "<" + A + ">" : "<...>"; } catch { return "<...>"; } } function i() { var m = J.A; return m === null ? null : m.getOwner(); } function o() { return Error("react-stack-top-frame"); } function r(m) { if (Lt.call(m, "key")) { var A = Object.getOwnPropertyDescriptor(m, "key").get; if (A && A.isReactWarning) return !1; } return m.key !== void 0; } function a(m, A) { function D() { ve || (ve = !0, console.error( "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", A )); } D.isReactWarning = !0, Object.defineProperty(m, "key", { get: D, configurable: !0 }); } function l() { var m = t(this.type); return Te[m] || (Te[m] = !0, console.error( "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release." )), m = this.props.ref, m !== void 0 ? m : null; } function u(m, A, D, B, it, Q, xe, be) { return D = Q.ref, m = { $$typeof: d, type: m, key: A, props: Q, _owner: it }, (D !== void 0 ? D : null) !== null ? Object.defineProperty(m, "ref", { enumerable: !1, get: l }) : Object.defineProperty(m, "ref", { enumerable: !1, value: null }), m._store = {}, Object.defineProperty(m._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: 0 }), Object.defineProperty(m, "_debugInfo", { configurable: !1, enumerable: !1, writable: !0, value: null }), Object.defineProperty(m, "_debugStack", { configurable: !1, enumerable: !1, writable: !0, value: xe }), Object.defineProperty(m, "_debugTask", { configurable: !1, enumerable: !1, writable: !0, value: be }), Object.freeze && (Object.freeze(m.props), Object.freeze(m)), m; } function c(m, A, D, B, it, Q, xe, be) { var I = A.children; if (I !== void 0) if (B) if (ye(I)) { for (B = 0; B < I.length; B++) h(I[B]); Object.freeze && Object.freeze(I); } else console.error( "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead." ); else h(I); if (Lt.call(A, "key")) { I = t(m); var yt = Object.keys(A).filter(function(Gr) { return Gr !== "key"; }); B = 0 < yt.length ? "{key: someKey, " + yt.join(": ..., ") + ": ...}" : "{key: someKey}", gt[I + B] || (yt = 0 < yt.length ? "{" + yt.join(": ..., ") + ": ...}" : "{}", console.error( `A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; <%s key={someKey} {...props} />`, B, I, yt, I ), gt[I + B] = !0); } if (I = null, D !== void 0 && (n(D), I = "" + D), r(A) && (n(A.key), I = "" + A.key), "key" in A) { D = {}; for (var Se in A) Se !== "key" && (D[Se] = A[Se]); } else D = A; return I && a( D, typeof m == "function" ? m.displayName || m.name || "Unknown" : m ), u( m, I, Q, it, i(), D, xe, be ); } function h(m) { typeof m == "object" && m !== null && m.$$typeof === d && m._store && (m._store.validated = 1); } var f = zr, d = Symbol.for("react.transitional.element"), g = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), T = Symbol.for("react.strict_mode"), y = Symbol.for("react.profiler"), S = Symbol.for("react.consumer"), v = Symbol.for("react.context"), w = Symbol.for("react.forward_ref"), b = Symbol.for("react.suspense"), V = Symbol.for("react.suspense_list"), R = Symbol.for("react.memo"), P = Symbol.for("react.lazy"), F = Symbol.for("react.activity"), U = Symbol.for("react.client.reference"), J = f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Lt = Object.prototype.hasOwnProperty, ye = Array.isArray, pt = console.createTask ? console.createTask : function() { return null; }; f = { "react-stack-bottom-frame": function(m) { return m(); } }; var ve, Te = {}, O = f["react-stack-bottom-frame"].bind( f, o )(), Y = pt(s(o)), gt = {}; jt.Fragment = p, jt.jsx = function(m, A, D, B, it) { var Q = 1e4 > J.recentlyCreatedOwnerStacks++; return c( m, A, D, !1, B, it, Q ? Error("react-stack-top-frame") : O, Q ? pt(s(m)) : Y ); }, jt.jsxs = function(m, A, D, B, it) { var Q = 1e4 > J.recentlyCreatedOwnerStacks++; return c( m, A, D, !0, B, it, Q ? Error("react-stack-top-frame") : O, Q ? pt(s(m)) : Y ); }; }()), jt; } process.env.NODE_ENV === "production" ? Ie.exports = to() : Ie.exports = eo(); var K = Ie.exports; function ri(t) { var e, n, s = ""; if (typeof t == "string" || typeof t == "number") s += t; else if (typeof t == "object") if (Array.isArray(t)) { var i = t.length; for (e = 0; e < i; e++) t[e] && (n = ri(t[e])) && (s && (s += " "), s += n); } else for (n in t) t[n] && (s && (s += " "), s += n); return s; } function oi() { for (var t, e, n = 0, s = "", i = arguments.length; n < i; n++) (t = arguments[n]) && (e = ri(t)) && (s && (s += " "), s += e); return s; } const no = "acrool-react-jackpot__root", so = "acrool-react-jackpot__motion", io = "acrool-react-jackpot__num", At = { root: no, motion: so, num: io }, ai = Dt({}); function li(t) { const e = It(null); return e.current === null && (e.current = t()), e.current; } const un = typeof window < "u", ci = un ? Hr : Mt, hn = /* @__PURE__ */ Dt(null); function fn(t, e) { t.indexOf(e) === -1 && t.push(e); } function dn(t, e) { const n = t.indexOf(e); n > -1 && t.splice(n, 1); } const nt = (t, e, n) => n > e ? e : n < t ? t : n; let Et = () => { }, Z = () => { }; process.env.NODE_ENV !== "production" && (Et = (t, e) => { !t && typeof console < "u" && console.warn(e); }, Z = (t, e) => { if (!t) throw new Error(e); }); const st = {}, ui = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t); function hi(t) { return typeof t == "object" && t !== null; } const fi = (t) => /^0[^.\s]+$/u.test(t); // @__NO_SIDE_EFFECTS__ function mn(t) { let e; return () => (e === void 0 && (e = t()), e); } const H = /* @__NO_SIDE_EFFECTS__ */ (t) => t, ro = (t, e) => (n) => e(t(n)), qt = (...t) => t.reduce(ro), Wt = /* @__NO_SIDE_EFFECTS__ */ (t, e, n) => { const s = e - t; return s === 0 ? 1 : (n - t) / s; }; class pn { constructor() { this.subscriptions = []; } add(e) { return fn(this.subscriptions, e), () => dn(this.subscriptions, e); } notify(e, n, s) { const i = this.subscriptions.length; if (i) if (i === 1) this.subscriptions[0](e, n, s); else for (let o = 0; o < i; o++) { const r = this.subscriptions[o]; r && r(e, n, s); } } getSize() { return this.subscriptions.length; } clear() { this.subscriptions.length = 0; } } const q = /* @__NO_SIDE_EFFECTS__ */ (t) => t * 1e3, tt = /* @__NO_SIDE_EFFECTS__ */ (t) => t / 1e3; function di(t, e) { return e ? t * (1e3 / e) : 0; } const Yn = /* @__PURE__ */ new Set(); function gn(t, e, n) { t || Yn.has(e) || (console.warn(e), n && console.warn(n), Yn.add(e)); } const mi = (t, e, n) => (((1 - 3 * n + 3 * e) * t + (3 * n - 6 * e)) * t + 3 * e) * t, oo = 1e-7, ao = 12; function lo(t, e, n, s, i) { let o, r, a = 0; do r = e + (n - e) / 2, o = mi(r, s, i) - t, o > 0 ? n = r : e = r; while (Math.abs(o) > oo && ++a < ao); return r; } function Zt(t, e, n, s) { if (t === e && n === s) return H; const i = (o) => lo(o, 0, 1, t, n); return (o) => o === 0 || o === 1 ? o : mi(i(o), e, s); } const pi = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, gi = (t) => (e) => 1 - t(1 - e), yi = /* @__PURE__ */ Zt(0.33, 1.53, 0.69, 0.99), yn = /* @__PURE__ */ gi(yi), vi = /* @__PURE__ */ pi(yn), Ti = (t) => (t *= 2) < 1 ? 0.5 * yn(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), vn = (t) => 1 - Math.sin(Math.acos(t)), xi = gi(vn), bi = pi(vn), co = /* @__PURE__ */ Zt(0.42, 0, 1, 1), uo = /* @__PURE__ */ Zt(0, 0, 0.58, 1), Si = /* @__PURE__ */ Zt(0.42, 0, 0.58, 1), ho = (t) => Array.isArray(t) && typeof t[0] != "number", Pi = (t) => Array.isArray(t) && typeof t[0] == "number", Gn = { linear: H, easeIn: co, easeInOut: Si, easeOut: uo, circIn: vn, circInOut: bi, circOut: xi, backIn: yn, backInOut: vi, backOut: yi, anticipate: Ti }, fo = (t) => typeof t == "string", zn = (t) => { if (Pi(t)) { Z(t.length === 4, "Cubic bezier arrays must contain four numerical values."); const [e, n, s, i] = t; return Zt(e, n, s, i); } else if (fo(t)) return Z(Gn[t] !== void 0, `Invalid easing type '${t}'`), Gn[t]; return t; }, te = [ "setup", // Compute "read", // Read "resolveKeyframes", // Write/Read/Write/Read "preUpdate", // Compute "update", // Compute "preRender", // Compute "render", // Write "postRender" // Compute ], Hn = { value: null, addProjectionMetrics: null }; function mo(t, e) { let n = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), i = !1, o = !1; const r = /* @__PURE__ */ new WeakSet(); let a = { delta: 0, timestamp: 0, isProcessing: !1 }, l = 0; function u(h) { r.has(h) && (c.schedule(h), t()), l++, h(a); } const c = { /** * Schedule a process to run on the next frame. */ schedule: (h, f = !1, d = !1) => { const p = d && i ? n : s; return f && r.add(h), p.has(h) || p.add(h), h; }, /** * Cancel the provided callback from running on the next frame. */ cancel: (h) => { s.delete(h), r.delete(h); }, /** * Execute all schedule callbacks. */ process: (h) => { if (a = h, i) { o = !0; return; } i = !0, [n, s] = [s, n], n.forEach(u), e && Hn.value && Hn.value.frameloop[e].push(l), l = 0, n.clear(), i = !1, o && (o = !1, c.process(h)); } }; return c; } const po = 40; function Ai(t, e) { let n = !1, s = !0; const i = { delta: 0, timestamp: 0, isProcessing: !1 }, o = () => n = !0, r = te.reduce((v, w) => (v[w] = mo(o, e ? w : void 0), v), {}), { setup: a, read: l, resolveKeyframes: u, preUpdate: c, update: h, preRender: f, render: d, postRender: g } = r, p = () => { const v = st.useManualTiming ? i.timestamp : performance.now(); n = !1, st.useManualTiming || (i.delta = s ? 1e3 / 60 : Math.max(Math.min(v - i.timestamp, po), 1)), i.timestamp = v, i.isProcessing = !0, a.process(i), l.process(i), u.process(i), c.process(i), h.process(i), f.process(i), d.process(i), g.process(i), i.isProcessing = !1, n && e && (s = !1, t(p)); }, T = () => { n = !0, s = !0, i.isProcessing || t(p); }; return { schedule: te.reduce((v, w) => { const b = r[w]; return v[w] = (V, R = !1, P = !1) => (n || T(), b.schedule(V, R, P)), v; }, {}), cancel: (v) => { for (let w = 0; w < te.length; w++) r[te[w]].cancel(v); }, state: i, steps: r }; } const { schedule: C, cancel: ot, state: j, steps: Pe } = /* @__PURE__ */ Ai(typeof requestAnimationFrame < "u" ? requestAnimationFrame : H, !0); let se; function go() { se = void 0; } const W = { now: () => (se === void 0 && W.set(j.isProcessing || st.useManualTiming ? j.timestamp : performance.now()), se), set: (t) => { se = t, queueMicrotask(go); } }, wi = (t) => (e) => typeof e == "string" && e.startsWith(t), Tn = /* @__PURE__ */ wi("--"), yo = /* @__PURE__ */ wi("var(--"), xn = (t) => yo(t) ? vo.test(t.split("/*")[0].trim()) : !1, vo = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, Ct = { test: (t) => typeof t == "number", parse: parseFloat, transform: (t) => t }, Kt = { ...Ct, transform: (t) => nt(0, 1, t) }, ee = { ...Ct, default: 1 }, Nt = (t) => Math.round(t * 1e5) / 1e5, bn = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu; function To(t) { return t == null; } const xo = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, Sn = (t, e) => (n) => !!(typeof n == "string" && xo.test(n) && n.startsWith(t) || e && !To(n) && Object.prototype.hasOwnProperty.call(n, e)), Vi = (t, e, n) => (s) => { if (typeof s != "string") return s; const [i, o, r, a] = s.match(bn); return { [t]: parseFloat(i), [e]: parseFloat(o), [n]: parseFloat(r), alpha: a !== void 0 ? parseFloat(a) : 1 }; }, bo = (t) => nt(0, 255, t), Ae = { ...Ct, transform: (t) => Math.round(bo(t)) }, ht = { test: /* @__PURE__ */ Sn("rgb", "red"), parse: /* @__PURE__ */ Vi("red", "green", "blue"), transform: ({ red: t, green: e, blue: n, alpha: s = 1 }) => "rgba(" + Ae.transform(t) + ", " + Ae.transform(e) + ", " + Ae.transform(n) + ", " + Nt(Kt.transform(s)) + ")" }; function So(t) { let e = "", n = "", s = "", i = ""; return t.length > 5 ? (e = t.substring(1, 3), n = t.substring(3, 5), s = t.substring(5, 7), i = t.substring(7, 9)) : (e = t.substring(1, 2), n = t.substring(2, 3), s = t.substring(3, 4), i = t.substring(4, 5), e += e, n += n, s += s, i += i), { red: parseInt(e, 16), green: parseInt(n, 16), blue: parseInt(s, 16), alpha: i ? parseInt(i, 16) / 255 : 1 }; } const Ne = { test: /* @__PURE__ */ Sn("#"), parse: So, transform: ht.transform }, Jt = /* @__NO_SIDE_EFFECTS__ */ (t) => ({ test: (e) => typeof e == "string" && e.endsWith(t) && e.split(" ").length === 1, parse: parseFloat, transform: (e) => `${e}${t}` }), rt = /* @__PURE__ */ Jt("deg"), et = /* @__PURE__ */ Jt("%"), x = /* @__PURE__ */ Jt("px"), Po = /* @__PURE__ */ Jt("vh"), Ao = /* @__PURE__ */ Jt("vw"), Xn = /* @__PURE__ */ (() => ({ ...et, parse: (t) => et.parse(t) / 100, transform: (t) => et.transform(t * 100) }))(), vt = { test: /* @__PURE__ */ Sn("hsl", "hue"), parse: /* @__PURE__ */ Vi("hue", "saturation", "lightness"), transform: ({ hue: t, saturation: e, lightness: n, alpha: s = 1 }) => "hsla(" + Math.round(t) + ", " + et.transform(Nt(e)) + ", " + et.transform(Nt(n)) + ", " + Nt(Kt.transform(s)) + ")" }, L = { test: (t) => ht.test(t) || Ne.test(t) || vt.test(t), parse: (t) => ht.test(t) ? ht.parse(t) : vt.test(t) ? vt.parse(t) : Ne.parse(t), transform: (t) => typeof t == "string" ? t : t.hasOwnProperty("red") ? ht.transform(t) : vt.transform(t), getAnimatableNone: (t) => { const e = L.parse(t); return e.alpha = 0, L.transform(e); } }, wo = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu; function Vo(t) { var e, n; return isNaN(t) && typeof t == "string" && (((e = t.match(bn)) == null ? void 0 : e.length) || 0) + (((n = t.match(wo)) == null ? void 0 : n.length) || 0) > 0; } const Di = "number", Mi = "color", Do = "var", Mo = "var(", qn = "${}", Eo = /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 Yt(t) { const e = t.toString(), n = [], s = { color: [], number: [], var: [] }, i = []; let o = 0; const a = e.replace(Eo, (l) => (L.test(l) ? (s.color.push(o), i.push(Mi), n.push(L.parse(l))) : l.startsWith(Mo) ? (s.var.push(o), i.push(Do), n.push(l)) : (s.number.push(o), i.push(Di), n.push(parseFloat(l))), ++o, qn)).split(qn); return { values: n, split: a, indexes: s, types: i }; } function Ei(t) { return Yt(t).values; } function Ci(t) { const { split: e, types: n } = Yt(t), s = e.length; return (i) => { let o = ""; for (let r = 0; r < s; r++) if (o += e[r], i[r] !== void 0) { const a = n[r]; a === Di ? o += Nt(i[r]) : a === Mi ? o += L.transform(i[r]) : o += i[r]; } return o; }; } const Co = (t) => typeof t == "number" ? 0 : L.test(t) ? L.getAnimatableNone(t) : t; function Ro(t) { const e = Ei(t); return Ci(t)(e.map(Co)); } const at = { test: Vo, parse: Ei, createTransformer: Ci, getAnimatableNone: Ro }; function we(t, e, n) { return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? t + (e - t) * 6 * n : n < 1 / 2 ? e : n < 2 / 3 ? t + (e - t) * (2 / 3 - n) * 6 : t; } function ko({ hue: t, saturation: e, lightness: n, alpha: s }) { t /= 360, e /= 100, n /= 100; let i = 0, o = 0, r = 0; if (!e) i = o = r = n; else { const a = n < 0.5 ? n * (1 + e) : n + e - n * e, l = 2 * n - a; i = we(l, a, t + 1 / 3), o = we(l, a, t), r = we(l, a, t - 1 / 3); } return { red: Math.round(i * 255), green: Math.round(o * 255), blue: Math.round(r * 255), alpha: s }; } function ae(t, e) { return (n) => n > 0 ? e : t; } const E = (t, e, n) => t + (e - t) * n, Ve = (t, e, n) => { const s = t * t, i = n * (e * e - s) + s; return i < 0 ? 0 : Math.sqrt(i); }, Lo = [Ne, ht, vt], Oo = (t) => Lo.find((e) => e.test(t)); function Zn(t) { const e = Oo(t); if (Et(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`), !e) return !1; let n = e.parse(t); return e === vt && (n = ko(n)), n; } const Jn = (t, e) => { const n = Zn(t), s = Zn(e); if (!n || !s) return ae(t, e); const i = { ...n }; return (o) => (i.red = Ve(n.red, s.red, o), i.green = Ve(n.green, s.green, o), i.blue = Ve(n.blue, s.blue, o), i.alpha = E(n.alpha, s.alpha, o), ht.transform(i)); }, _e = /* @__PURE__ */ new Set(["none", "hidden"]); function jo(t, e) { return _e.has(t) ? (n) => n <= 0 ? t : e : (n) => n >= 1 ? e : t; } function Fo(t, e) { return (n) => E(t, e, n); } function Pn(t) { return typeof t == "number" ? Fo : typeof t == "string" ? xn(t) ? ae : L.test(t) ? Jn : No : Array.isArray(t) ? Ri : typeof t == "object" ? L.test(t) ? Jn : Bo : ae; } function Ri(t, e) { const n = [...t], s = n.length, i = t.map((o, r) => Pn(o)(o, e[r])); return (o) => { for (let r = 0; r < s; r++) n[r] = i[r](o); return n; }; } function Bo(t, e) { const n = { ...t, ...e }, s = {}; for (const i in n) t[i] !== void 0 && e[i] !== void 0 && (s[i] = Pn(t[i])(t[i], e[i])); return (i) => { for (const o in s) n[o] = s[o](i); return n; }; } function Io(t, e) { const n = [], s = { color: 0, var: 0, number: 0 }; for (let i = 0; i < e.values.length; i++) { const o = e.types[i], r = t.indexes[o][s[o]], a = t.values[r] ?? 0; n[i] = a, s[o]++; } return n; } const No = (t, e) => { const n = at.createTransformer(e), s = Yt(t), i = Yt(e); return s.indexes.var.length === i.indexes.var.length && s.indexes.color.length === i.indexes.color.length && s.indexes.number.length >= i.indexes.number.length ? _e.has(t) && !i.values.length || _e.has(e) && !s.values.length ? jo(t, e) : qt(Ri(Io(s, i), i.values), n) : (Et(!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.`), ae(t, e)); }; function ki(t, e, n) { return typeof t == "number" && typeof e == "number" && typeof n == "number" ? E(t, e, n) : Pn(t)(t, e); } const _o = (t) => { const e = ({ timestamp: n }) => t(n); return { start: (n = !0) => C.update(e, n), stop: () => ot(e), /** * If we're processing this frame we can use the * framelocked timestamp to keep things in sync. */ now: () => j.isProcessing ? j.timestamp : W.now() }; }, Li = (t, e, n = 10) => { let s = ""; const i = Math.max(Math.round(e / n), 2); for (let o = 0; o < i; o++) s += Math.round(t(o / (i - 1)) * 1e4) / 1e4 + ", "; return `linear(${s.substring(0, s.length - 2)})`; }, le = 2e4; function An(t) { let e = 0; const n = 50; let s = t.next(e); for (; !s.done && e < le; ) e += n, s = t.next(e); return e >= le ? 1 / 0 : e; } function Uo(t, e = 100, n) { const s = n({ ...t, keyframes: [0, e] }), i = Math.min(An(s), le); return { type: "keyframes", ease: (o) => s.next(i * o).value / e, duration: /* @__PURE__ */ tt(i) }; } const $o = 5; function Oi(t, e, n) { const s = Math.max(e - $o, 0); return di(n - t(s), e - s); } const M = { // Default spring physics stiffness: 100, damping: 10, mass: 1, velocity: 0, // Default duration/bounce-based options duration: 800, // in ms bounce: 0.3, visualDuration: 0.3, // in seconds // Rest thresholds restSpeed: { granular: 0.01, default: 2 }, restDelta: { granular: 5e-3, default: 0.5 }, // Limits minDuration: 0.01, // in seconds maxDuration: 10, // in seconds minDamping: 0.05, maxDamping: 1 }, De = 1e-3; function Wo({ duration: t = M.duration, bounce: e = M.bounce, velocity: n = M.velocity, mass: s = M.mass }) { let i, o; Et(t <= /* @__PURE__ */ q(M.maxDuration), "Spring duration must be 10 seconds or less"); let r = 1 - e; r = nt(M.minDamping, M.maxDamping, r), t = nt(M.minDuration, M.maxDuration, /* @__PURE__ */ tt(t)), r < 1 ? (i = (u) => { const c = u * r, h = c * t, f = c - n, d = Ue(u, r), g = Math.exp(-h); return De - f / d * g; }, o = (u) => { const h = u * r * t, f = h * n + n, d = Math.pow(r, 2) * Math.pow(u, 2) * t, g = Math.exp(-h), p = Ue(Math.pow(u, 2), r); return (-i(u) + De > 0 ? -1 : 1) * ((f - d) * g) / p; }) : (i = (u) => { const c = Math.exp(-u * t), h = (u - n) * t + 1; return -De + c * h; }, o = (u) => { const c = Math.exp(-u * t), h = (n - u) * (t * t); return c * h; }); const a = 5 / t, l = Yo(i, o, a); if (t = /* @__PURE__ */ q(t), isNaN(l)) return { stiffness: M.stiffness, damping: M.damping, duration: t }; { const u = Math.pow(l, 2) * s; return { stiffness: u, damping: r * 2 * Math.sqrt(s * u), duration: t }; } } const Ko = 12; function Yo(t, e, n) { let s = n; for (let i = 1; i < Ko; i++) s = s - t(s) / e(s); return s; } function Ue(t, e) { return t * Math.sqrt(1 - e * e); } const Go = ["duration", "bounce"], zo = ["stiffness", "damping", "mass"]; function Qn(t, e) { return e.some((n) => t[n] !== void 0); } function Ho(t) { let e = { velocity: M.velocity, stiffness: M.stiffness, damping: M.damping, mass: M.mass, isResolvedFromDuration: !1, ...t }; if (!Qn(t, zo) && Qn(t, Go)) if (t.visualDuration) { const n = t.visualDuration, s = 2 * Math.PI / (n * 1.2), i = s * s, o = 2 * nt(0.05, 1, 1 - (t.bounce || 0)) * Math.sqrt(i); e = { ...e, mass: M.mass, stiffness: i, damping: o }; } else { const n = Wo(t); e = { ...e, ...n, mass: M.mass }, e.isResolvedFromDuration = !0; } return e; } function ce(t = M.visualDuration, e = M.bounce) { const n = typeof t != "object" ? { visualDuration: t, keyframes: [0, 1], bounce: e } : t; let { restSpeed: s, restDelta: i } = n; const o = n.keyframes[0], r = n.keyframes[n.keyframes.length - 1], a = { done: !1, value: o }, { stiffness: l, damping: u, mass: c, duration: h, velocity: f, isResolvedFromDuration: d } = Ho({ ...n, velocity: -/* @__PURE__ */ tt(n.velocity || 0) }), g = f || 0, p = u / (2 * Math.sqrt(l * c)), T = r - o, y = /* @__PURE__ */ tt(Math.sqrt(l / c)), S = Math.abs(T) < 5; s || (s = S ? M.restSpeed.granular : M.restSpeed.default), i || (i = S ? M.restDelta.granular : M.restDelta.default); let v; if (p < 1) { const b = Ue(y, p); v = (V) => { const R = Math.exp(-p * y * V); return r - R * ((g + p * y * T) / b * Math.sin(b * V) + T * Math.cos(b * V)); }; } else if (p === 1) v = (b) => r - Math.exp(-y * b) * (T + (g + y * T) * b); else { const b = y * Math.sqrt(p * p - 1); v = (V) => { const R = Math.exp(-p * y * V), P = Math.min(b * V, 300); return r - R * ((g + p * y * T) * Math.sinh(P) + b * T * Math.cosh(P)) / b; }; } const w = { calculatedDuration: d && h || null, next: (b) => { const V = v(b); if (d) a.done = b >= h; else { let R = b === 0 ? g : 0; p < 1 && (R = b === 0 ? /* @__PURE__ */ q(g) : Oi(v, b, V)); const P = Math.abs(R) <= s, F = Math.abs(r - V) <= i; a.done = P && F; } return a.value = a.done ? r : V, a; }, toString: () => { const b = Math.min(An(w), le), V = Li((R) => w.next(b * R).value, b, 30); return b + "ms " + V; }, toTransition: () => { } }; return w; } ce.applyToOptions = (t) => { const e = Uo(t, 100, ce); return t.ease = e.ease, t.duration = /* @__PURE__ */ q(e.duration), t.type = "keyframes", t; }; function $e({ keyframes: t, velocity: e = 0, power: n = 0.8, timeConstant: s = 325, bounceDamping: i = 10, bounceStiffness: o = 500, modifyTarget: r, min: a, max: l, restDelta: u = 0.5, restSpeed: c }) { const h = t[0], f = { done: !1, value: h }, d = (P) => a !== void 0 && P < a || l !== void 0 && P > l, g = (P) => a === void 0 ? l : l === void 0 || Math.abs(a - P) < Math.abs(l - P) ? a : l; let p = n * e; const T = h + p, y = r === void 0 ? T : r(T); y !== T && (p = y - h); const S = (P) => -p * Math.exp(-P / s), v = (P) => y + S(P), w = (P) => { const F = S(P), U = v(P); f.done = Math.abs(F) <= u, f.value = f.done ? y : U; }; let b, V; const R = (P) => { d(f.value) && (b = P, V = ce({ keyframes: [f.value, g(f.value)], velocity: Oi(v, P, f.value), // TODO: This should be passing * 1000 damping: i, stiffness: o, restDelta: u, restSpeed: c })); }; return R(0), { calculatedDuration: null, next: (P) => { let F = !1; return !V && b === void 0 && (F = !0, w(P), R(P)), b !== void 0 && P >= b ? V.next(P - b) : (!F && w(P), f); } }; } function Xo(t, e, n) { const s = [], i = n || st.mix || ki, o = t.length - 1; for (let r = 0; r < o; r++) { let a = i(t[r], t[r + 1]); if (e) { const l = Array.isArray(e) ? e[r] || H : e; a = qt(l, a); } s.push(a); } return s; } function qo(t, e, { clamp: n = !0, ease: s, mixer: i } = {}) { const o = t.length; if (Z(o === e.length, "Both input and output ranges must be the same 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 = Xo(e, s, i), l = a.length, u = (c) => { if (r && c < t[0]) return e[0]; let h = 0; if (l > 1) for (; h < t.length - 2 && !(c < t[h + 1]); h++) ; const f = /* @__PURE__ */ Wt(t[h], t[h + 1], c); return a[h](f); }; return n ? (c) => u(nt(t[0], t[o - 1], c)) : u; } function Zo(t, e) { const n = t[t.length - 1]; for (let s = 1; s <= e; s++) { const i = /* @__PURE__ */ Wt(0, e, s); t.push(E(n, 1, i)); } } function Jo(t) { const e = [0]; return Zo(e, t.length - 1), e; } function Qo(t, e) { return t.map((n) => n * e); } function ta(t, e) { return t.map(() => e || Si).splice(0, t.length - 1); } function Tt({ duration: t = 300, keyframes: e, times: n, ease: s = "easeInOut" }) { const i = ho(s) ? s.map(zn) : zn(s), o = { done: !1, value: e[0] }, r = Qo( // 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 === e.length ? n : Jo(e), t ), a = qo(r, e, { ease: Array.isArray(i) ? i : ta(e, i) }); return { calculatedDuration: t, next: (l) => (o.value = a(l), o.done = l >= t, o) }; } const ea = (t) => t !== null; function wn(t, { repeat: e, repeatType: n = "loop" }, s, i = 1) { const o = t.filter(ea), a = i < 0 || e && n !== "loop" && e % 2 === 1 ? 0 : o.length - 1; return !a || s === void 0 ? o[a] : s; } const na = { decay: $e, inertia: $e, tween: Tt, keyframes: Tt, spring: ce }; function ji(t) { typeof t.type == "string" && (t.type = na[t.type]); } class Vn { constructor() { this.updateFinished(); } get finished() { return this._finished; } updateFinished() { this._finished = new Promise((e) => { this.resolve = e; }); } notifyFinished() { this.resolve(); } /** * Allows the animation to be awaited. * * @deprecated Use `finished` instead. */ then(e, n) { return this.finished.then(e, n); } } const sa = (t) => t / 100; class Dn extends Vn { constructor(e) { super(), this.state = "idle", this.startTime = null, this.isStopped = !1, this.currentTime = 0, this.holdTime = null, this.playbackSpeed = 1, this.stop = () => { var s, i; const { motionValue: n } = this.options; n && n.updatedAt !== W.now() && this.tick(W.now()), this.isStopped = !0, this.state !== "idle" && (this.teardown(), (i = (s = this.options).onStop) == null || i.call(s)); }, this.options = e, this.initAnimation(), this.play(), e.autoplay === !1 && this.pause(); } initAnimation() { const { options: e } = this; ji(e); const { type: n = Tt, repeat: s = 0, repeatDelay: i = 0, repeatType: o, velocity: r = 0 } = e; let { keyframes: a } = e; const l = n || Tt; process.env.NODE_ENV !== "production" && l !== Tt && Z(a.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${a}`), l !== Tt && typeof a[0] != "number" && (this.mixKeyframes = qt(sa, ki(a[0], a[1])), a = [0, 100]); const u = l({ ...e, keyframes: a }); o === "mirror" && (this.mirroredGenerator = l({ ...e, keyframes: [...a].reverse(), velocity: -r })), u.calculatedDuration === null && (u.calculatedDuration = An(u)); const { calculatedDuration: c } = u; this.calculatedDuration = c, this.resolvedDuration = c + i, this.totalDuration = this.resolvedDuration * (s + 1) - i, this.generator = u; } updateTime(e) { const n = Math.round(e - this.startTime) * this.playbackSpeed; this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = n; } tick(e, n = !1) { const { generator: s, totalDuration: i, mixKeyframes: o, mirroredGenerator: r, resolvedDuration: a, calculatedDuration: l } = this; if (this.startTime === null) return s.next(0); const { delay: u = 0, keyframes: c, repeat: h, repeatType: f, repeatDelay: d, type: g, onUpdate: p, finalKeyframe: T } = this.options; this.speed > 0 ? this.startTime = Math.min(this.startTime, e) : this.speed < 0 && (this.startTime = Math.min(e - i / this.speed, this.startTime)), n ? this.currentTime = e : this.updateTime(e); const y = this.currentTime - u * (this.playbackSpeed >= 0 ? 1 : -1), S = this.playbackSpeed >= 0 ? y < 0 : y > i; this.currentTime = Math.max(y, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = i); let v = this.currentTime, w = s; if (h) { const P = Math.min(this.currentTime, i) / a; let F = Math.floor(P), U = P % 1; !U && P >= 1 && (U = 1), U === 1 && F--, F = Math.min(F, h + 1), !!(F % 2) && (f === "reverse" ? (U = 1 - U, d && (U -= d / a)) : f === "mirror" && (w = r)), v = nt(0, 1, U) * a; } const b = S ? { done: !1, value: c[0] } : w.next(v); o && (b.value = o(b.value)); let { done: V } = b; !S && l !== null && (V = this.playbackSpeed >= 0 ? this.currentTime >= i : this.currentTime <= 0); const R = this.holdTime === null && (this.state === "finished" || this.state === "running" && V); return R && g !== $e && (b.value = wn(c, this.options, T, this.speed)), p && p(b.value), R && this.finish(), b; } /** * Allows the returned animation to be awaited or promise-chained. Currently * resolves when the animation finishes at all but in a future update could/should * reject if its cancels. */ then(e, n) { return this.finished.then(e, n); } get duration() { return /* @__PURE__ */ tt(this.calculatedDuration); } get time() { return /* @__PURE__ */ tt(this.currentTime); } set time(e) { var n; e = /* @__PURE__ */ q(e), this.currentTime = e, this.startTime === null || this.holdTime !== null || this.playbackSpeed === 0 ? this.holdTime = e : this.driver && (this.startTime = this.driver.now() - e / this.playbackSpeed), (n = this.driver) == null || n.start(!1); } get speed() { return this.playbackSpeed; } set speed(e) { this.updateTime(W.now()); const n = this.playbackSpeed !== e; this.playbackSpeed = e, n && (this.time = /* @__PURE__ */ tt(this.currentTime)); } play() { var i, o; if (this.isStopped) return; const { driver: e = _o, startTime: n } = this.options; this.driver || (this.driver = e((r) => this.tick(r))), (o = (i = this.options).onPlay) == null || o.call(i); const s = this.driver.now(); this.state === "finished" ? (this.updateFinished(), this.startTime = s) : this.holdTime !== null ? this.startTime = s - this.holdTime : this.startTime || (this.startTime = n ?? s), 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(W.now()), this.holdTime = this.currentTime; } complete() { this.state !== "running" && this.play(), this.state = "finished", this.holdTime = null; } finish() { var e, n; this.notifyFinished(), this.teardown(), this.state = "finished", (n = (e = this.options).onComplete) == null || n.call(e); } cancel() { var e, n; this.holdTime = null, this.startTime = 0, this.tick(0), this.teardown(), (n = (e = this.options).onCancel) == null || n.call(e); } teardown() { this.state = "idle", this.stopDriver(), this.startTime = this.holdTime = null; } stopDriver() { this.driver && (this.driver.stop(), this.driver = void 0); } sample(e) { return this.startTime = 0, this.tick(e, !0); } attachTimeline(e) { var n; return this.options.allowFlatten && (this.options.type = "keyframes", this.options.ease = "linear", this.initAnimation()), (n = this.driver) == null || n.stop(), e.observe(this); } } function ia(t) { for (let e = 1; e < t.length; e++) t[e] ?? (t[e] = t[e - 1]); } const ft = (t) => t * 180 / Math.PI, We = (t) => { const e = ft(Math.atan2(t[1], t[0])); return Ke(e); }, ra = { x: 4, y: 5, translateX: 4, translateY: 5, scaleX: 0, scaleY: 3, scale: (t) => (Math.abs(t[0]) + Math.abs(t[3])) / 2, rotate: We, rotateZ: We, skewX: (t) => ft(Math.atan(t[1])), skewY: (t) => ft(Math.atan(t[2])), skew: (t) => (Math.abs(t[1]) + Math.abs(t[2])) / 2 }, Ke = (t) => (t = t % 360, t < 0 && (t += 360), t), ts = We, es = (t) => Math.sqrt(t[0] * t[0] + t[1] * t[1]), ns = (t) => Math.sqrt(t[4] * t[4] + t[5] * t[5]), oa = { x: 12, y: 13, z: 14, translateX: 12, translateY: 13, translateZ: 14, scaleX: es, scaleY: ns, scale: (t) => (es(t) + ns(t)) / 2, rotateX: (t) => Ke(ft(Math.atan2(t[6], t[5]))), rotateY: (t) => Ke(ft(Math.atan2(-t[2], t[0]))), rotateZ: ts, rotate: ts, skewX: (t) => ft(Math.atan(t[4])), skewY: (t) => ft(Math.atan(t[1])), skew: (t) => (Math.abs(t[1]) + Math.abs(t[4])) / 2 }; function Ye(t) { return t.includes("scale") ? 1 : 0; } function Ge(t, e) { if (!t || t === "none") return Ye(e); const n = t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u); let s, i; if (n) s = oa, i = n; else { const a = t.match(/^matrix\(([-\d.e\s,]+)\)$/u); s = ra, i = a; } if (!i) return Ye(e); const o = s[e], r = i[1].split(",").map(la); return typeof o == "function" ? o(r) : r[o]; } const aa = (t, e) => { const { transform: n = "none" } = getComputedStyle(t); return Ge(n, e); }; function la(t) { return parseFloat(t.trim()); } const Rt = [ "transformPerspective", "x", "y", "z", "translateX", "translateY", "translateZ", "scale", "scaleX", "scaleY", "rotate", "rotateX", "rotateY", "rotateZ", "skew", "skewX", "skewY" ], kt = /* @__PURE__ */ (() => new Set(Rt))(), ss = (t) => t === Ct || t === x, ca = /* @__PURE__ */ new Set(["x", "y", "z"]), ua = Rt.filter((t) => !ca.has(t)); function ha(t) { const e = []; return ua.forEach((n) => { const s = t.getValue(n); s !== void 0 && (e.push([n, s.get()]), s.set(n.startsWith("scale") ? 1 : 0)); }), e; } const dt = { // Dimensions width: ({ x: t }, { paddingLeft: e = "0", paddingRight: n = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(n), height: ({ y: t }, { paddingTop: e = "0", paddingBottom: n = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(n), 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), // Transform x: (t, { transform: e }) => Ge(e, "x"), y: (t, { transform: e }) => Ge(e, "y") }; dt.translateX = dt.x; dt.translateY = dt.y; const mt = /* @__PURE__ */ new Set(); let ze = !1, He = !1, Xe = !1; function Fi() { if (He) { const t = Array.from(mt).filter((s) => s.needsMeasurement), e = new Set(t.map((s) => s.element)), n = /* @__PURE__ */ new Map(); e.forEach((s) => { const i = ha(s); i.length && (n.set(s, i), s.render()); }), t.forEach((s) => s.measureInitialState()), e.forEach((s) => { s.render(); const i = n.get(s); i && i.forEach(([o, r]) => { var a; (a = s.getValue(o)) == null || a.set(r); }); }), t.forEach((s) => s.measureEndState()), t.forEach((s) => { s.suspendedScrollY !== void 0 && window.scrollTo(0, s.suspendedScrollY); }); } He = !1, ze = !1, mt.forEach((t) => t.complete(Xe)), mt.clear(); } function Bi() { mt.forEach((t) => { t.readKeyframes(), t.needsMeasurement && (He = !0); }); } function fa() { Xe = !0, Bi(), Fi(), Xe = !1; } class Mn { constructor(e, n, s, i, o, r = !1) { this.state = "pending", this.isAsync = !1, this.needsMeasurement = !1, this.unresolvedKeyframes = [...e], this.onComplete = n, this.name = s, this.motionValue = i, this.element = o, this.isAsync = r; } scheduleResolve() { this.state = "scheduled", this.isAsync ? (mt.add(this), ze || (ze = !0, C.read(Bi), C.resolveKeyframes(Fi))) : (this.readKeyframes(), this.complete()); } readKeyframes() { const { unresolvedKeyframes: e, name: n, element: s, motionValue: i } = this; if (e[0] === null) { const o = i == null ? void 0 : i.get(), r = e[e.length - 1]; if (o !== void 0) e[0] = o; else if (s && n) { const a = s.readValue(n, r); a != null && (e[0] = a); } e[0] === void 0 && (e[0] = r), i && o === void 0 && i.set(e[0]); } ia(e); } setFinalKeyframe() { } measureInitialState() { } renderEndStyles() { } measureEndState() { } complete(e = !1) { this.state = "complete", this.onComplete(this.unresolvedKeyframes, this.finalKeyframe, e), mt.delete(this); } cancel() { this.state === "scheduled" && (mt.delete(this), this.state = "pending"); } resume() { this.state === "pending" && this.scheduleResolve(); } } const da = (t) => t.startsWith("--"); function ma(t, e, n) { da(e) ? t.style.setProperty(e, n) : t.style[e] = n; } const pa = /* @__PURE__ */ mn(() => window.ScrollTimeline !== void 0), ga = {}; function ya(t, e) { const n = /* @__PURE__ */ mn(t); return () => ga[e] ?? n(); } const Ii = /* @__PURE__ */ ya(() => { try { document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" }); } catch { return !1; } return !0; }, "linearEasing"), Bt = ([t, e, n, s]) => `cubic-bezier(${t}, ${e}, ${n}, ${s})`, is = { linear: "linear", ease: "ease", easeIn: "ease-in", easeOut: "ease-out", easeInOut: "ease-in-out", circIn: /* @__PURE__ */ Bt([0, 0.65, 0.55, 1]), circOut: /* @__PURE__ */ Bt([0.55, 0, 1, 0.45]), backIn: /* @__PURE__ */ Bt([0.31, 0.01, 0.66, -0.59]), backOut: /* @__PURE__ */ Bt([0.33, 1.53, 0.69, 0.99]) }; function Ni(t, e) { if (t) return typeof t == "function" ? Ii() ? Li(t, e) : "ease-out" : Pi(t) ? Bt(t) : Array.isArray(t) ? t.map((n) => Ni(n, e) || is.easeOut) : is[t]; } function va(t, e, n, { delay: s = 0, duration: i = 300, repeat: o = 0, repeatType: r = "loop", ease: a = "easeOut", times: l } = {}, u = void 0) { const c = { [e]: n }; l && (c.offset = l); const h = Ni(a, i); Array.isArray(h) && (c.easing = h); const f = { delay: s, duration: i, easing: Array.isArray(h) ? "linear" : h, fill: "both", iterations: o + 1, direction: r === "reverse" ? "alternate" : "normal" }; return u && (f.pseudoElement = u), t.animate(c, f); } function _i(t) { return typeof t == "function" && "applyToOptions" in t; } function Ta({ type: t, ...e }) { return _i(t) && Ii() ? t.applyToOptions(e) : (e.duration ?? (e.duration = 300), e.ease ?? (e.ease = "easeOut"), e); } class xa extends Vn { constructor(e) { if (super(), this.finishedTime = null, this.isStopped = !1, !e) return; const { element: n, name: s, keyframes: i, pseudoElement: o, allowFlatten: r = !1, finalKeyframe: a, onComplete: l } = e; this.isPseudoElement = !!o, this.allowFlatten = r, this.options = e, Z(typeof e.type != "string", `animateMini doesn't support "type" as a string. Did you mean to import { spring } from "motion"?`); const u = Ta(e); this.animation = va(n, s, i, u, o), u.autoplay === !1 && this.animation.pause(), this.animation.onfinish = () => { if (this.finishedTime = this.time, !o) { const c = wn(i, this.options, a, this.speed); this.updateMotionValue ? this.updateMotionValue(c) : ma(n, s, c), this.animation.cancel(); } l == null || l(), this.notifyFinished(); }; } play() { this.isStopped || (this.animation.play(), this.state === "finished" && this.updateFinished()); } pause() { this.animation.pause(); } complete() { var e, n; (n = (e = this.animation).finish) == null || n.call(e); } cancel() { try { this.animation.cancel(); } catch { } } stop() { if (this.isStopped) return; this.isStopped = !0; const { state: e } = this; e === "idle" || e === "finished" || (this.updateMotionValue ? this.updateMotionValue() : this.commitStyles(), this.isPseudoElement || this.cancel()); } /** * WAAPI doesn't natively have any interruption capabilities. * * In this method, we commit styles back to the DOM before cancelling * the animation. * * This is designed to be overridden by NativeAnimationExtended, which * will create a renderless JS animation and sample it twice to calculate * its current value, "previous" value, and therefore allow * Motion to also correctly calculate velocity for any subsequent animation * while deferring the commit until the next animation frame. */ commitStyles() { var e, n; this.isPseudoElement || (n = (e = this.animation).commitStyles) == null || n.call(e); } get duration() { var n, s; const e = ((s = (n = this.animation.effect) == null ? void 0 : n.getComputedTiming) == null ? void 0 : s.call(n).duration) || 0; return /* @__PURE__ */ tt(Number(e)); } get time() { return /* @__PURE__ */ tt(Number(this.animation.currentTime) || 0); } set time(e) { this.finishedTime = null, this.animation.currentTime = /* @__PURE__ */ q(e); } /** * The playback speed of the animation. * 1 = normal speed, 2 = double speed, 0.5 = half speed. */ get speed() { return this.animation.playbackRate; } set speed(e) { e < 0 && (this.finishedTime = null), this.animation.playbackRate = e; } get state() { return this.finishedTime !== null ? "finished" : this.animation.playState; } get startTime() { return Number(this.animation.startTime); } set startTime(e) { this.animation.startTime = e; } /** * Attaches a timeline to the animation, for instance the `ScrollTimeline`. */ attachTimeline({ timeline: e, observe: n }) { var s; return this.allowFlatten && ((s = this.animation.effect) == null || s.updateTiming({ easing: "linear" })), this.animation.onfinish = null, e && pa() ? (this.animation.timeline = e, H) : n(this); } } const Ui = { anticipate: Ti, backInOut: vi, circInOut: bi }; function ba(t) { return t in Ui; } function Sa(t) { typeof t.ease == "string" && ba(t.ease) && (t.ease = Ui[t.ease]); } const rs = 10; class Pa extends xa { constructor(e) { Sa(e), ji(e), super(e), e.startTime && (this.startTime = e.startTime), this.options = e; } /** * WAAPI doesn't natively have any interruption capabilities. * * Rather than read commited styles back out of the DOM, we can * create a renderless JS animation and sample it twice to calculate * its current value, "previous" value, and therefore allow * Motion to calculate velocity for any subsequent animation. */ updateMotionValue(e) { const { motionValue: n, onUpdate: s, onComplete: i, element: o, ...r } = this.options; if (!n) return; if (e !== void 0) { n.set(e); return; } const a = new Dn({ .