UNPKG

simple-beautiful-bracket

Version:

A simple and beautiful React component for visualizing tournament brackets.

1,471 lines 1.05 MB
import * as $1 from "react"; import J1, { createContext as nm, useRef as $i, useLayoutEffect as hD, useEffect as xf, useId as W1, useContext as ra, useInsertionEffect as yA, useMemo as Ca, useCallback as gA, Children as mD, isValidElement as pD, useState as Ki, Fragment as vA, createElement as Mv, forwardRef as F1, Component as yD } from "react"; import bA from "react-dom"; var yv = { exports: {} }, tg = {}; /** * @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 V2; function gD() { if (V2) return tg; V2 = 1; var o = Symbol.for("react.transitional.element"), s = Symbol.for("react.fragment"); function d(m, y, b) { var v = null; if (b !== void 0 && (v = "" + b), y.key !== void 0 && (v = "" + y.key), "key" in y) { b = {}; for (var x in y) x !== "key" && (b[x] = y[x]); } else b = y; return y = b.ref, { $$typeof: o, type: m, key: v, ref: y !== void 0 ? y : null, props: b }; } return tg.Fragment = s, tg.jsx = d, tg.jsxs = d, tg; } var eg = {}; /** * @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 B2; function vD() { return B2 || (B2 = 1, process.env.NODE_ENV !== "production" && function() { function o(Z) { if (Z == null) return null; if (typeof Z == "function") return Z.$$typeof === Tt ? null : Z.displayName || Z.name || null; if (typeof Z == "string") return Z; switch (Z) { case ht: return "Fragment"; case st: return "Profiler"; case rt: return "StrictMode"; case gt: return "Suspense"; case ot: return "SuspenseList"; case ft: return "Activity"; } if (typeof Z == "object") switch (typeof Z.tag == "number" && console.error( "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." ), Z.$$typeof) { case et: return "Portal"; case it: return (Z.displayName || "Context") + ".Provider"; case ut: return (Z._context.displayName || "Context") + ".Consumer"; case bt: var Rt = Z.render; return Z = Z.displayName, Z || (Z = Rt.displayName || Rt.name || "", Z = Z !== "" ? "ForwardRef(" + Z + ")" : "ForwardRef"), Z; case lt: return Rt = Z.displayName || null, Rt !== null ? Rt : o(Z.type) || "Memo"; case tt: Rt = Z._payload, Z = Z._init; try { return o(Z(Rt)); } catch { } } return null; } function s(Z) { return "" + Z; } function d(Z) { try { s(Z); var Rt = !1; } catch { Rt = !0; } if (Rt) { Rt = console; var pt = Rt.error, wt = typeof Symbol == "function" && Symbol.toStringTag && Z[Symbol.toStringTag] || Z.constructor.name || "Object"; return pt.call( Rt, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", wt ), s(Z); } } function m(Z) { if (Z === ht) return "<>"; if (typeof Z == "object" && Z !== null && Z.$$typeof === tt) return "<...>"; try { var Rt = o(Z); return Rt ? "<" + Rt + ">" : "<...>"; } catch { return "<...>"; } } function y() { var Z = vt.A; return Z === null ? null : Z.getOwner(); } function b() { return Error("react-stack-top-frame"); } function v(Z) { if (Dt.call(Z, "key")) { var Rt = Object.getOwnPropertyDescriptor(Z, "key").get; if (Rt && Rt.isReactWarning) return !1; } return Z.key !== void 0; } function x(Z, Rt) { function pt() { ye || (ye = !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)", Rt )); } pt.isReactWarning = !0, Object.defineProperty(Z, "key", { get: pt, configurable: !0 }); } function A() { var Z = o(this.type); return N[Z] || (N[Z] = !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." )), Z = this.props.ref, Z !== void 0 ? Z : null; } function M(Z, Rt, pt, wt, Jt, Te, ee, Wi) { return pt = Te.ref, Z = { $$typeof: L, type: Z, key: Rt, props: Te, _owner: Jt }, (pt !== void 0 ? pt : null) !== null ? Object.defineProperty(Z, "ref", { enumerable: !1, get: A }) : Object.defineProperty(Z, "ref", { enumerable: !1, value: null }), Z._store = {}, Object.defineProperty(Z._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: 0 }), Object.defineProperty(Z, "_debugInfo", { configurable: !1, enumerable: !1, writable: !0, value: null }), Object.defineProperty(Z, "_debugStack", { configurable: !1, enumerable: !1, writable: !0, value: ee }), Object.defineProperty(Z, "_debugTask", { configurable: !1, enumerable: !1, writable: !0, value: Wi }), Object.freeze && (Object.freeze(Z.props), Object.freeze(Z)), Z; } function D(Z, Rt, pt, wt, Jt, Te, ee, Wi) { var He = Rt.children; if (He !== void 0) if (wt) if (le(He)) { for (wt = 0; wt < He.length; wt++) C(He[wt]); Object.freeze && Object.freeze(He); } 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 C(He); if (Dt.call(Rt, "key")) { He = o(Z); var pn = Object.keys(Rt).filter(function(Zu) { return Zu !== "key"; }); wt = 0 < pn.length ? "{key: someKey, " + pn.join(": ..., ") + ": ...}" : "{key: someKey}", Mt[He + wt] || (pn = 0 < pn.length ? "{" + pn.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} />`, wt, He, pn, He ), Mt[He + wt] = !0); } if (He = null, pt !== void 0 && (d(pt), He = "" + pt), v(Rt) && (d(Rt.key), He = "" + Rt.key), "key" in Rt) { pt = {}; for (var wa in Rt) wa !== "key" && (pt[wa] = Rt[wa]); } else pt = Rt; return He && x( pt, typeof Z == "function" ? Z.displayName || Z.name || "Unknown" : Z ), M( Z, He, Te, Jt, y(), pt, ee, Wi ); } function C(Z) { typeof Z == "object" && Z !== null && Z.$$typeof === L && Z._store && (Z._store.validated = 1); } var z = J1, L = Symbol.for("react.transitional.element"), et = Symbol.for("react.portal"), ht = Symbol.for("react.fragment"), rt = Symbol.for("react.strict_mode"), st = Symbol.for("react.profiler"), ut = Symbol.for("react.consumer"), it = Symbol.for("react.context"), bt = Symbol.for("react.forward_ref"), gt = Symbol.for("react.suspense"), ot = Symbol.for("react.suspense_list"), lt = Symbol.for("react.memo"), tt = Symbol.for("react.lazy"), ft = Symbol.for("react.activity"), Tt = Symbol.for("react.client.reference"), vt = z.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Dt = Object.prototype.hasOwnProperty, le = Array.isArray, Xt = console.createTask ? console.createTask : function() { return null; }; z = { "react-stack-bottom-frame": function(Z) { return Z(); } }; var ye, N = {}, P = z["react-stack-bottom-frame"].bind( z, b )(), ct = Xt(m(b)), Mt = {}; eg.Fragment = ht, eg.jsx = function(Z, Rt, pt, wt, Jt) { var Te = 1e4 > vt.recentlyCreatedOwnerStacks++; return D( Z, Rt, pt, !1, wt, Jt, Te ? Error("react-stack-top-frame") : P, Te ? Xt(m(Z)) : ct ); }, eg.jsxs = function(Z, Rt, pt, wt, Jt) { var Te = 1e4 > vt.recentlyCreatedOwnerStacks++; return D( Z, Rt, pt, !0, wt, Jt, Te ? Error("react-stack-top-frame") : P, Te ? Xt(m(Z)) : ct ); }; }()), eg; } var N2; function bD() { return N2 || (N2 = 1, process.env.NODE_ENV === "production" ? yv.exports = gD() : yv.exports = vD()), yv.exports; } var J = bD(); const P1 = nm({}); function I1(o) { const s = $i(null); return s.current === null && (s.current = o()), s.current; } const tS = typeof window < "u", SA = tS ? hD : xf, Bv = /* @__PURE__ */ nm(null); function eS(o, s) { o.indexOf(s) === -1 && o.push(s); } function nS(o, s) { const d = o.indexOf(s); d > -1 && o.splice(d, 1); } const as = (o, s, d) => d > s ? s : d < o ? o : d; function R1(o, s) { return s ? `${o}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${s}` : o; } let am = () => { }, ls = () => { }; process.env.NODE_ENV !== "production" && (am = (o, s, d) => { !o && typeof console < "u" && console.warn(R1(s, d)); }, ls = (o, s, d) => { if (!o) throw new Error(R1(s, d)); }); const is = {}, TA = (o) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(o); function xA(o) { return typeof o == "object" && o !== null; } const AA = (o) => /^0[^.\s]+$/u.test(o); // @__NO_SIDE_EFFECTS__ function aS(o) { let s; return () => (s === void 0 && (s = o()), s); } const fi = /* @__NO_SIDE_EFFECTS__ */ (o) => o, SD = (o, s) => (d) => s(o(d)), gg = (...o) => o.reduce(SD), rg = /* @__NO_SIDE_EFFECTS__ */ (o, s, d) => { const m = s - o; return m === 0 ? 1 : (d - o) / m; }; class lS { constructor() { this.subscriptions = []; } add(s) { return eS(this.subscriptions, s), () => nS(this.subscriptions, s); } notify(s, d, m) { const y = this.subscriptions.length; if (y) if (y === 1) this.subscriptions[0](s, d, m); else for (let b = 0; b < y; b++) { const v = this.subscriptions[b]; v && v(s, d, m); } } getSize() { return this.subscriptions.length; } clear() { this.subscriptions.length = 0; } } const Ji = /* @__NO_SIDE_EFFECTS__ */ (o) => o * 1e3, Xu = /* @__NO_SIDE_EFFECTS__ */ (o) => o / 1e3; function EA(o, s) { return s ? o * (1e3 / s) : 0; } const j2 = /* @__PURE__ */ new Set(); function iS(o, s, d) { o || j2.has(s) || (console.warn(R1(s, d)), j2.add(s)); } const RA = (o, s, d) => (((1 - 3 * d + 3 * s) * o + (3 * d - 6 * s)) * o + 3 * s) * o, TD = 1e-7, xD = 12; function AD(o, s, d, m, y) { let b, v, x = 0; do v = s + (d - s) / 2, b = RA(v, m, y) - o, b > 0 ? d = v : s = v; while (Math.abs(b) > TD && ++x < xD); return v; } function vg(o, s, d, m) { if (o === s && d === m) return fi; const y = (b) => AD(b, 0, 1, o, d); return (b) => b === 0 || b === 1 ? b : RA(y(b), s, m); } const DA = (o) => (s) => s <= 0.5 ? o(2 * s) / 2 : (2 - o(2 * (1 - s))) / 2, MA = (o) => (s) => 1 - o(1 - s), OA = /* @__PURE__ */ vg(0.33, 1.53, 0.69, 0.99), uS = /* @__PURE__ */ MA(OA), CA = /* @__PURE__ */ DA(uS), zA = (o) => (o *= 2) < 1 ? 0.5 * uS(o) : 0.5 * (2 - Math.pow(2, -10 * (o - 1))), oS = (o) => 1 - Math.sin(Math.acos(o)), wA = MA(oS), UA = DA(oS), ED = /* @__PURE__ */ vg(0.42, 0, 1, 1), RD = /* @__PURE__ */ vg(0, 0, 0.58, 1), HA = /* @__PURE__ */ vg(0.42, 0, 0.58, 1), DD = (o) => Array.isArray(o) && typeof o[0] != "number", VA = (o) => Array.isArray(o) && typeof o[0] == "number", L2 = { linear: fi, easeIn: ED, easeInOut: HA, easeOut: RD, circIn: oS, circInOut: UA, circOut: wA, backIn: uS, backInOut: CA, backOut: OA, anticipate: zA }, MD = (o) => typeof o == "string", _2 = (o) => { if (VA(o)) { ls(o.length === 4, "Cubic bezier arrays must contain four numerical values.", "cubic-bezier-length"); const [s, d, m, y] = o; return vg(s, d, m, y); } else if (MD(o)) return ls(L2[o] !== void 0, `Invalid easing type '${o}'`, "invalid-easing-type"), L2[o]; return o; }, gv = [ "setup", // Compute "read", // Read "resolveKeyframes", // Write/Read/Write/Read "preUpdate", // Compute "update", // Compute "preRender", // Compute "render", // Write "postRender" // Compute ]; function OD(o, s) { let d = /* @__PURE__ */ new Set(), m = /* @__PURE__ */ new Set(), y = !1, b = !1; const v = /* @__PURE__ */ new WeakSet(); let x = { delta: 0, timestamp: 0, isProcessing: !1 }; function A(D) { v.has(D) && (M.schedule(D), o()), D(x); } const M = { /** * Schedule a process to run on the next frame. */ schedule: (D, C = !1, z = !1) => { const et = z && y ? d : m; return C && v.add(D), et.has(D) || et.add(D), D; }, /** * Cancel the provided callback from running on the next frame. */ cancel: (D) => { m.delete(D), v.delete(D); }, /** * Execute all schedule callbacks. */ process: (D) => { if (x = D, y) { b = !0; return; } y = !0, [d, m] = [m, d], d.forEach(A), d.clear(), y = !1, b && (b = !1, M.process(D)); } }; return M; } const CD = 40; function BA(o, s) { let d = !1, m = !0; const y = { delta: 0, timestamp: 0, isProcessing: !1 }, b = () => d = !0, v = gv.reduce((it, bt) => (it[bt] = OD(b), it), {}), { setup: x, read: A, resolveKeyframes: M, preUpdate: D, update: C, preRender: z, render: L, postRender: et } = v, ht = () => { const it = is.useManualTiming ? y.timestamp : performance.now(); d = !1, is.useManualTiming || (y.delta = m ? 1e3 / 60 : Math.max(Math.min(it - y.timestamp, CD), 1)), y.timestamp = it, y.isProcessing = !0, x.process(y), A.process(y), M.process(y), D.process(y), C.process(y), z.process(y), L.process(y), et.process(y), y.isProcessing = !1, d && s && (m = !1, o(ht)); }, rt = () => { d = !0, m = !0, y.isProcessing || o(ht); }; return { schedule: gv.reduce((it, bt) => { const gt = v[bt]; return it[bt] = (ot, lt = !1, tt = !1) => (d || rt(), gt.schedule(ot, lt, tt)), it; }, {}), cancel: (it) => { for (let bt = 0; bt < gv.length; bt++) v[gv[bt]].cancel(it); }, state: y, steps: v }; } const { schedule: Ge, cancel: Rc, state: Kn, steps: o1 } = /* @__PURE__ */ BA(typeof requestAnimationFrame < "u" ? requestAnimationFrame : fi, !0); let Av; function zD() { Av = void 0; } const Fa = { now: () => (Av === void 0 && Fa.set(Kn.isProcessing || is.useManualTiming ? Kn.timestamp : performance.now()), Av), set: (o) => { Av = o, queueMicrotask(zD); } }, NA = (o) => (s) => typeof s == "string" && s.startsWith(o), sS = /* @__PURE__ */ NA("--"), wD = /* @__PURE__ */ NA("var(--"), cS = (o) => wD(o) ? UD.test(o.split("/*")[0].trim()) : !1, UD = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, lm = { test: (o) => typeof o == "number", parse: parseFloat, transform: (o) => o }, fg = { ...lm, transform: (o) => as(0, 1, o) }, vv = { ...lm, default: 1 }, ug = (o) => Math.round(o * 1e5) / 1e5, rS = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu; function HD(o) { return o == null; } const VD = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, fS = (o, s) => (d) => !!(typeof d == "string" && VD.test(d) && d.startsWith(o) || s && !HD(d) && Object.prototype.hasOwnProperty.call(d, s)), jA = (o, s, d) => (m) => { if (typeof m != "string") return m; const [y, b, v, x] = m.match(rS); return { [o]: parseFloat(y), [s]: parseFloat(b), [d]: parseFloat(v), alpha: x !== void 0 ? parseFloat(x) : 1 }; }, BD = (o) => as(0, 255, o), s1 = { ...lm, transform: (o) => Math.round(BD(o)) }, vf = { test: /* @__PURE__ */ fS("rgb", "red"), parse: /* @__PURE__ */ jA("red", "green", "blue"), transform: ({ red: o, green: s, blue: d, alpha: m = 1 }) => "rgba(" + s1.transform(o) + ", " + s1.transform(s) + ", " + s1.transform(d) + ", " + ug(fg.transform(m)) + ")" }; function ND(o) { let s = "", d = "", m = "", y = ""; return o.length > 5 ? (s = o.substring(1, 3), d = o.substring(3, 5), m = o.substring(5, 7), y = o.substring(7, 9)) : (s = o.substring(1, 2), d = o.substring(2, 3), m = o.substring(3, 4), y = o.substring(4, 5), s += s, d += d, m += m, y += y), { red: parseInt(s, 16), green: parseInt(d, 16), blue: parseInt(m, 16), alpha: y ? parseInt(y, 16) / 255 : 1 }; } const D1 = { test: /* @__PURE__ */ fS("#"), parse: ND, transform: vf.transform }, bg = /* @__NO_SIDE_EFFECTS__ */ (o) => ({ test: (s) => typeof s == "string" && s.endsWith(o) && s.split(" ").length === 1, parse: parseFloat, transform: (s) => `${s}${o}` }), Ac = /* @__PURE__ */ bg("deg"), Qu = /* @__PURE__ */ bg("%"), Nt = /* @__PURE__ */ bg("px"), jD = /* @__PURE__ */ bg("vh"), LD = /* @__PURE__ */ bg("vw"), q2 = { ...Qu, parse: (o) => Qu.parse(o) / 100, transform: (o) => Qu.transform(o * 100) }, $h = { test: /* @__PURE__ */ fS("hsl", "hue"), parse: /* @__PURE__ */ jA("hue", "saturation", "lightness"), transform: ({ hue: o, saturation: s, lightness: d, alpha: m = 1 }) => "hsla(" + Math.round(o) + ", " + Qu.transform(ug(s)) + ", " + Qu.transform(ug(d)) + ", " + ug(fg.transform(m)) + ")" }, mn = { test: (o) => vf.test(o) || D1.test(o) || $h.test(o), parse: (o) => vf.test(o) ? vf.parse(o) : $h.test(o) ? $h.parse(o) : D1.parse(o), transform: (o) => typeof o == "string" ? o : o.hasOwnProperty("red") ? vf.transform(o) : $h.transform(o), getAnimatableNone: (o) => { const s = mn.parse(o); return s.alpha = 0, mn.transform(s); } }, _D = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu; function qD(o) { return isNaN(o) && typeof o == "string" && (o.match(rS)?.length || 0) + (o.match(_D)?.length || 0) > 0; } const LA = "number", _A = "color", YD = "var", GD = "var(", Y2 = "${}", XD = /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 dg(o) { const s = o.toString(), d = [], m = { color: [], number: [], var: [] }, y = []; let b = 0; const x = s.replace(XD, (A) => (mn.test(A) ? (m.color.push(b), y.push(_A), d.push(mn.parse(A))) : A.startsWith(GD) ? (m.var.push(b), y.push(YD), d.push(A)) : (m.number.push(b), y.push(LA), d.push(parseFloat(A))), ++b, Y2)).split(Y2); return { values: d, split: x, indexes: m, types: y }; } function qA(o) { return dg(o).values; } function YA(o) { const { split: s, types: d } = dg(o), m = s.length; return (y) => { let b = ""; for (let v = 0; v < m; v++) if (b += s[v], y[v] !== void 0) { const x = d[v]; x === LA ? b += ug(y[v]) : x === _A ? b += mn.transform(y[v]) : b += y[v]; } return b; }; } const QD = (o) => typeof o == "number" ? 0 : mn.test(o) ? mn.getAnimatableNone(o) : o; function ZD(o) { const s = qA(o); return YA(o)(s.map(QD)); } const Dc = { test: qD, parse: qA, createTransformer: YA, getAnimatableNone: ZD }; function c1(o, s, d) { return d < 0 && (d += 1), d > 1 && (d -= 1), d < 1 / 6 ? o + (s - o) * 6 * d : d < 1 / 2 ? s : d < 2 / 3 ? o + (s - o) * (2 / 3 - d) * 6 : o; } function kD({ hue: o, saturation: s, lightness: d, alpha: m }) { o /= 360, s /= 100, d /= 100; let y = 0, b = 0, v = 0; if (!s) y = b = v = d; else { const x = d < 0.5 ? d * (1 + s) : d + s - d * s, A = 2 * d - x; y = c1(A, x, o + 1 / 3), b = c1(A, x, o), v = c1(A, x, o - 1 / 3); } return { red: Math.round(y * 255), green: Math.round(b * 255), blue: Math.round(v * 255), alpha: m }; } function Ov(o, s) { return (d) => d > 0 ? s : o; } const Ze = (o, s, d) => o + (s - o) * d, r1 = (o, s, d) => { const m = o * o, y = d * (s * s - m) + m; return y < 0 ? 0 : Math.sqrt(y); }, KD = [D1, vf, $h], $D = (o) => KD.find((s) => s.test(o)); function G2(o) { const s = $D(o); if (am(!!s, `'${o}' is not an animatable color. Use the equivalent color code instead.`, "color-not-animatable"), !s) return !1; let d = s.parse(o); return s === $h && (d = kD(d)), d; } const X2 = (o, s) => { const d = G2(o), m = G2(s); if (!d || !m) return Ov(o, s); const y = { ...d }; return (b) => (y.red = r1(d.red, m.red, b), y.green = r1(d.green, m.green, b), y.blue = r1(d.blue, m.blue, b), y.alpha = Ze(d.alpha, m.alpha, b), vf.transform(y)); }, M1 = /* @__PURE__ */ new Set(["none", "hidden"]); function JD(o, s) { return M1.has(o) ? (d) => d <= 0 ? o : s : (d) => d >= 1 ? s : o; } function WD(o, s) { return (d) => Ze(o, s, d); } function dS(o) { return typeof o == "number" ? WD : typeof o == "string" ? cS(o) ? Ov : mn.test(o) ? X2 : ID : Array.isArray(o) ? GA : typeof o == "object" ? mn.test(o) ? X2 : FD : Ov; } function GA(o, s) { const d = [...o], m = d.length, y = o.map((b, v) => dS(b)(b, s[v])); return (b) => { for (let v = 0; v < m; v++) d[v] = y[v](b); return d; }; } function FD(o, s) { const d = { ...o, ...s }, m = {}; for (const y in d) o[y] !== void 0 && s[y] !== void 0 && (m[y] = dS(o[y])(o[y], s[y])); return (y) => { for (const b in m) d[b] = m[b](y); return d; }; } function PD(o, s) { const d = [], m = { color: 0, var: 0, number: 0 }; for (let y = 0; y < s.values.length; y++) { const b = s.types[y], v = o.indexes[b][m[b]], x = o.values[v] ?? 0; d[y] = x, m[b]++; } return d; } const ID = (o, s) => { const d = Dc.createTransformer(s), m = dg(o), y = dg(s); return m.indexes.var.length === y.indexes.var.length && m.indexes.color.length === y.indexes.color.length && m.indexes.number.length >= y.indexes.number.length ? M1.has(o) && !y.values.length || M1.has(s) && !m.values.length ? JD(o, s) : gg(GA(PD(m, y), y.values), d) : (am(!0, `Complex values '${o}' and '${s}' 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"), Ov(o, s)); }; function XA(o, s, d) { return typeof o == "number" && typeof s == "number" && typeof d == "number" ? Ze(o, s, d) : dS(o)(o, s); } const tM = (o) => { const s = ({ timestamp: d }) => o(d); return { start: (d = !0) => Ge.update(s, d), stop: () => Rc(s), /** * If we're processing this frame we can use the * framelocked timestamp to keep things in sync. */ now: () => Kn.isProcessing ? Kn.timestamp : Fa.now() }; }, QA = (o, s, d = 10) => { let m = ""; const y = Math.max(Math.round(s / d), 2); for (let b = 0; b < y; b++) m += Math.round(o(b / (y - 1)) * 1e4) / 1e4 + ", "; return `linear(${m.substring(0, m.length - 2)})`; }, Cv = 2e4; function hS(o) { let s = 0; const d = 50; let m = o.next(s); for (; !m.done && s < Cv; ) s += d, m = o.next(s); return s >= Cv ? 1 / 0 : s; } function eM(o, s = 100, d) { const m = d({ ...o, keyframes: [0, s] }), y = Math.min(hS(m), Cv); return { type: "keyframes", ease: (b) => m.next(y * b).value / s, duration: /* @__PURE__ */ Xu(y) }; } const nM = 5; function ZA(o, s, d) { const m = Math.max(s - nM, 0); return EA(d - o(m), s - m); } const Qe = { // 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 }, f1 = 1e-3; function aM({ duration: o = Qe.duration, bounce: s = Qe.bounce, velocity: d = Qe.velocity, mass: m = Qe.mass }) { let y, b; am(o <= /* @__PURE__ */ Ji(Qe.maxDuration), "Spring duration must be 10 seconds or less", "spring-duration-limit"); let v = 1 - s; v = as(Qe.minDamping, Qe.maxDamping, v), o = as(Qe.minDuration, Qe.maxDuration, /* @__PURE__ */ Xu(o)), v < 1 ? (y = (M) => { const D = M * v, C = D * o, z = D - d, L = O1(M, v), et = Math.exp(-C); return f1 - z / L * et; }, b = (M) => { const C = M * v * o, z = C * d + d, L = Math.pow(v, 2) * Math.pow(M, 2) * o, et = Math.exp(-C), ht = O1(Math.pow(M, 2), v); return (-y(M) + f1 > 0 ? -1 : 1) * ((z - L) * et) / ht; }) : (y = (M) => { const D = Math.exp(-M * o), C = (M - d) * o + 1; return -f1 + D * C; }, b = (M) => { const D = Math.exp(-M * o), C = (d - M) * (o * o); return D * C; }); const x = 5 / o, A = iM(y, b, x); if (o = /* @__PURE__ */ Ji(o), isNaN(A)) return { stiffness: Qe.stiffness, damping: Qe.damping, duration: o }; { const M = Math.pow(A, 2) * m; return { stiffness: M, damping: v * 2 * Math.sqrt(m * M), duration: o }; } } const lM = 12; function iM(o, s, d) { let m = d; for (let y = 1; y < lM; y++) m = m - o(m) / s(m); return m; } function O1(o, s) { return o * Math.sqrt(1 - s * s); } const uM = ["duration", "bounce"], oM = ["stiffness", "damping", "mass"]; function Q2(o, s) { return s.some((d) => o[d] !== void 0); } function sM(o) { let s = { velocity: Qe.velocity, stiffness: Qe.stiffness, damping: Qe.damping, mass: Qe.mass, isResolvedFromDuration: !1, ...o }; if (!Q2(o, oM) && Q2(o, uM)) if (o.visualDuration) { const d = o.visualDuration, m = 2 * Math.PI / (d * 1.2), y = m * m, b = 2 * as(0.05, 1, 1 - (o.bounce || 0)) * Math.sqrt(y); s = { ...s, mass: Qe.mass, stiffness: y, damping: b }; } else { const d = aM(o); s = { ...s, ...d, mass: Qe.mass }, s.isResolvedFromDuration = !0; } return s; } function zv(o = Qe.visualDuration, s = Qe.bounce) { const d = typeof o != "object" ? { visualDuration: o, keyframes: [0, 1], bounce: s } : o; let { restSpeed: m, restDelta: y } = d; const b = d.keyframes[0], v = d.keyframes[d.keyframes.length - 1], x = { done: !1, value: b }, { stiffness: A, damping: M, mass: D, duration: C, velocity: z, isResolvedFromDuration: L } = sM({ ...d, velocity: -/* @__PURE__ */ Xu(d.velocity || 0) }), et = z || 0, ht = M / (2 * Math.sqrt(A * D)), rt = v - b, st = /* @__PURE__ */ Xu(Math.sqrt(A / D)), ut = Math.abs(rt) < 5; m || (m = ut ? Qe.restSpeed.granular : Qe.restSpeed.default), y || (y = ut ? Qe.restDelta.granular : Qe.restDelta.default); let it; if (ht < 1) { const gt = O1(st, ht); it = (ot) => { const lt = Math.exp(-ht * st * ot); return v - lt * ((et + ht * st * rt) / gt * Math.sin(gt * ot) + rt * Math.cos(gt * ot)); }; } else if (ht === 1) it = (gt) => v - Math.exp(-st * gt) * (rt + (et + st * rt) * gt); else { const gt = st * Math.sqrt(ht * ht - 1); it = (ot) => { const lt = Math.exp(-ht * st * ot), tt = Math.min(gt * ot, 300); return v - lt * ((et + ht * st * rt) * Math.sinh(tt) + gt * rt * Math.cosh(tt)) / gt; }; } const bt = { calculatedDuration: L && C || null, next: (gt) => { const ot = it(gt); if (L) x.done = gt >= C; else { let lt = gt === 0 ? et : 0; ht < 1 && (lt = gt === 0 ? /* @__PURE__ */ Ji(et) : ZA(it, gt, ot)); const tt = Math.abs(lt) <= m, ft = Math.abs(v - ot) <= y; x.done = tt && ft; } return x.value = x.done ? v : ot, x; }, toString: () => { const gt = Math.min(hS(bt), Cv), ot = QA((lt) => bt.next(gt * lt).value, gt, 30); return gt + "ms " + ot; }, toTransition: () => { } }; return bt; } zv.applyToOptions = (o) => { const s = eM(o, 100, zv); return o.ease = s.ease, o.duration = /* @__PURE__ */ Ji(s.duration), o.type = "keyframes", o; }; function C1({ keyframes: o, velocity: s = 0, power: d = 0.8, timeConstant: m = 325, bounceDamping: y = 10, bounceStiffness: b = 500, modifyTarget: v, min: x, max: A, restDelta: M = 0.5, restSpeed: D }) { const C = o[0], z = { done: !1, value: C }, L = (tt) => x !== void 0 && tt < x || A !== void 0 && tt > A, et = (tt) => x === void 0 ? A : A === void 0 || Math.abs(x - tt) < Math.abs(A - tt) ? x : A; let ht = d * s; const rt = C + ht, st = v === void 0 ? rt : v(rt); st !== rt && (ht = st - C); const ut = (tt) => -ht * Math.exp(-tt / m), it = (tt) => st + ut(tt), bt = (tt) => { const ft = ut(tt), Tt = it(tt); z.done = Math.abs(ft) <= M, z.value = z.done ? st : Tt; }; let gt, ot; const lt = (tt) => { L(z.value) && (gt = tt, ot = zv({ keyframes: [z.value, et(z.value)], velocity: ZA(it, tt, z.value), // TODO: This should be passing * 1000 damping: y, stiffness: b, restDelta: M, restSpeed: D })); }; return lt(0), { calculatedDuration: null, next: (tt) => { let ft = !1; return !ot && gt === void 0 && (ft = !0, bt(tt), lt(tt)), gt !== void 0 && tt >= gt ? ot.next(tt - gt) : (!ft && bt(tt), z); } }; } function cM(o, s, d) { const m = [], y = d || is.mix || XA, b = o.length - 1; for (let v = 0; v < b; v++) { let x = y(o[v], o[v + 1]); if (s) { const A = Array.isArray(s) ? s[v] || fi : s; x = gg(A, x); } m.push(x); } return m; } function rM(o, s, { clamp: d = !0, ease: m, mixer: y } = {}) { const b = o.length; if (ls(b === s.length, "Both input and output ranges must be the same length", "range-length"), b === 1) return () => s[0]; if (b === 2 && s[0] === s[1]) return () => s[1]; const v = o[0] === o[1]; o[0] > o[b - 1] && (o = [...o].reverse(), s = [...s].reverse()); const x = cM(s, m, y), A = x.length, M = (D) => { if (v && D < o[0]) return s[0]; let C = 0; if (A > 1) for (; C < o.length - 2 && !(D < o[C + 1]); C++) ; const z = /* @__PURE__ */ rg(o[C], o[C + 1], D); return x[C](z); }; return d ? (D) => M(as(o[0], o[b - 1], D)) : M; } function fM(o, s) { const d = o[o.length - 1]; for (let m = 1; m <= s; m++) { const y = /* @__PURE__ */ rg(0, s, m); o.push(Ze(d, 1, y)); } } function dM(o) { const s = [0]; return fM(s, o.length - 1), s; } function hM(o, s) { return o.map((d) => d * s); } function mM(o, s) { return o.map(() => s || HA).splice(0, o.length - 1); } function Jh({ duration: o = 300, keyframes: s, times: d, ease: m = "easeInOut" }) { const y = DD(m) ? m.map(_2) : _2(m), b = { done: !1, value: s[0] }, v = hM( // Only use the provided offsets if they're the correct length // TODO Maybe we should warn here if there's a length mismatch d && d.length === s.length ? d : dM(s), o ), x = rM(v, s, { ease: Array.isArray(y) ? y : mM(s, y) }); return { calculatedDuration: o, next: (A) => (b.value = x(A), b.done = A >= o, b) }; } const pM = (o) => o !== null; function mS(o, { repeat: s, repeatType: d = "loop" }, m, y = 1) { const b = o.filter(pM), x = y < 0 || s && d !== "loop" && s % 2 === 1 ? 0 : b.length - 1; return !x || m === void 0 ? b[x] : m; } const yM = { decay: C1, inertia: C1, tween: Jh, keyframes: Jh, spring: zv }; function kA(o) { typeof o.type == "string" && (o.type = yM[o.type]); } class pS { constructor() { this.updateFinished(); } get finished() { return this._finished; } updateFinished() { this._finished = new Promise((s) => { this.resolve = s; }); } notifyFinished() { this.resolve(); } /** * Allows the animation to be awaited. * * @deprecated Use `finished` instead. */ then(s, d) { return this.finished.then(s, d); } } const gM = (o) => o / 100; class yS extends pS { constructor(s) { super(), this.state = "idle", this.startTime = null, this.isStopped = !1, this.currentTime = 0, this.holdTime = null, this.playbackSpeed = 1, this.stop = () => { const { motionValue: d } = this.options; d && d.updatedAt !== Fa.now() && this.tick(Fa.now()), this.isStopped = !0, this.state !== "idle" && (this.teardown(), this.options.onStop?.()); }, this.options = s, this.initAnimation(), this.play(), s.autoplay === !1 && this.pause(); } initAnimation() { const { options: s } = this; kA(s); const { type: d = Jh, repeat: m = 0, repeatDelay: y = 0, repeatType: b, velocity: v = 0 } = s; let { keyframes: x } = s; const A = d || Jh; process.env.NODE_ENV !== "production" && A !== Jh && ls(x.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${x}`, "spring-two-frames"), A !== Jh && typeof x[0] != "number" && (this.mixKeyframes = gg(gM, XA(x[0], x[1])), x = [0, 100]); const M = A({ ...s, keyframes: x }); b === "mirror" && (this.mirroredGenerator = A({ ...s, keyframes: [...x].reverse(), velocity: -v })), M.calculatedDuration === null && (M.calculatedDuration = hS(M)); const { calculatedDuration: D } = M; this.calculatedDuration = D, this.resolvedDuration = D + y, this.totalDuration = this.resolvedDuration * (m + 1) - y, this.generator = M; } updateTime(s) { const d = Math.round(s - this.startTime) * this.playbackSpeed; this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = d; } tick(s, d = !1) { const { generator: m, totalDuration: y, mixKeyframes: b, mirroredGenerator: v, resolvedDuration: x, calculatedDuration: A } = this; if (this.startTime === null) return m.next(0); const { delay: M = 0, keyframes: D, repeat: C, repeatType: z, repeatDelay: L, type: et, onUpdate: ht, finalKeyframe: rt } = this.options; this.speed > 0 ? this.startTime = Math.min(this.startTime, s) : this.speed < 0 && (this.startTime = Math.min(s - y / this.speed, this.startTime)), d ? this.currentTime = s : this.updateTime(s); const st = this.currentTime - M * (this.playbackSpeed >= 0 ? 1 : -1), ut = this.playbackSpeed >= 0 ? st < 0 : st > y; this.currentTime = Math.max(st, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = y); let it = this.currentTime, bt = m; if (C) { const tt = Math.min(this.currentTime, y) / x; let ft = Math.floor(tt), Tt = tt % 1; !Tt && tt >= 1 && (Tt = 1), Tt === 1 && ft--, ft = Math.min(ft, C + 1), !!(ft % 2) && (z === "reverse" ? (Tt = 1 - Tt, L && (Tt -= L / x)) : z === "mirror" && (bt = v)), it = as(0, 1, Tt) * x; } const gt = ut ? { done: !1, value: D[0] } : bt.next(it); b && (gt.value = b(gt.value)); let { done: ot } = gt; !ut && A !== null && (ot = this.playbackSpeed >= 0 ? this.currentTime >= y : this.currentTime <= 0); const lt = this.holdTime === null && (this.state === "finished" || this.state === "running" && ot); return lt && et !== C1 && (gt.value = mS(D, this.options, rt, this.speed)), ht && ht(gt.value), lt && this.finish(), gt; } /** * 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(s, d) { return this.finished.then(s, d); } get duration() { return /* @__PURE__ */ Xu(this.calculatedDuration); } get time() { return /* @__PURE__ */ Xu(this.currentTime); } set time(s) { s = /* @__PURE__ */ Ji(s), this.currentTime = s, this.startTime === null || this.holdTime !== null || this.playbackSpeed === 0 ? this.holdTime = s : this.driver && (this.startTime = this.driver.now() - s / this.playbackSpeed), this.driver?.start(!1); } get speed() { return this.playbackSpeed; } set speed(s) { this.updateTime(Fa.now()); const d = this.playbackSpeed !== s; this.playbackSpeed = s, d && (this.time = /* @__PURE__ */ Xu(this.currentTime)); } play() { if (this.isStopped) return; const { driver: s = tM, startTime: d } = this.options; this.driver || (this.driver = s((y) => this.tick(y))), this.options.onPlay?.(); const m = this.driver.now(); this.state === "finished" ? (this.updateFinished(), this.startTime = m) : this.holdTime !== null ? this.startTime = m - this.holdTime : this.startTime || (this.startTime = d ?? m), 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(Fa.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; } stopDriver() { this.driver && (this.driver.stop(), this.driver = void 0); } sample(s) { return this.startTime = 0, this.tick(s, !0); } attachTimeline(s) { return this.options.allowFlatten && (this.options.type = "keyframes", this.options.ease = "linear", this.initAnimation()), this.driver?.stop(), s.observe(this); } } function vM(o) { for (let s = 1; s < o.length; s++) o[s] ?? (o[s] = o[s - 1]); } const bf = (o) => o * 180 / Math.PI, z1 = (o) => { const s = bf(Math.atan2(o[1], o[0])); return w1(s); }, bM = { x: 4, y: 5, translateX: 4, translateY: 5, scaleX: 0, scaleY: 3, scale: (o) => (Math.abs(o[0]) + Math.abs(o[3])) / 2, rotate: z1, rotateZ: z1, skewX: (o) => bf(Math.atan(o[1])), skewY: (o) => bf(Math.atan(o[2])), skew: (o) => (Math.abs(o[1]) + Math.abs(o[2])) / 2 }, w1 = (o) => (o = o % 360, o < 0 && (o += 360), o), Z2 = z1, k2 = (o) => Math.sqrt(o[0] * o[0] + o[1] * o[1]), K2 = (o) => Math.sqrt(o[4] * o[4] + o[5] * o[5]), SM = { x: 12, y: 13, z: 14, translateX: 12, translateY: 13, translateZ: 14, scaleX: k2, scaleY: K2, scale: (o) => (k2(o) + K2(o)) / 2, rotateX: (o) => w1(bf(Math.atan2(o[6], o[5]))), rotateY: (o) => w1(bf(Math.atan2(-o[2], o[0]))), rotateZ: Z2, rotate: Z2, skewX: (o) => bf(Math.atan(o[4])), skewY: (o) => bf(Math.atan(o[1])), skew: (o) => (Math.abs(o[1]) + Math.abs(o[4])) / 2 }; function U1(o) { return o.includes("scale") ? 1 : 0; } function H1(o, s) { if (!o || o === "none") return U1(s); const d = o.match(/^matrix3d\(([-\d.e\s,]+)\)$/u); let m, y; if (d) m = SM, y = d; else { const x = o.match(/^matrix\(([-\d.e\s,]+)\)$/u); m = bM, y = x; } if (!y) return U1(s); const b = m[s], v = y[1].split(",").map(xM); return typeof b == "function" ? b(v) : v[b]; } const TM = (o, s) => { const { transform: d = "none" } = getComputedStyle(o); return H1(d, s); }; function xM(o) { return parseFloat(o.trim()); } const im = [ "transformPerspective", "x", "y", "z", "translateX", "translateY", "translateZ", "scale", "scaleX", "scaleY", "rotate", "rotateX", "rotateY", "rotateZ", "skew", "skewX", "skewY" ], um = new Set(im), $2 = (o) => o === lm || o === Nt, AM = /* @__PURE__ */ new Set(["x", "y", "z"]), EM = im.filter((o) => !AM.has(o)); function RM(o) { const s = []; return EM.forEach((d) => { const m = o.getValue(d); m !== void 0 && (s.push([d, m.get()]), m.set(d.startsWith("scale") ? 1 : 0)); }), s; } const Sf = { // Dimensions width: ({ x: o }, { paddingLeft: s = "0", paddingRight: d = "0" }) => o.max - o.min - parseFloat(s) - parseFloat(d), height: ({ y: o }, { paddingTop: s = "0", paddingBottom: d = "0" }) => o.max - o.min - parseFloat(s) - parseFloat(d), top: (o, { top: s }) => parseFloat(s), left: (o, { left: s }) => parseFloat(s), bottom: ({ y: o }, { top: s }) => parseFloat(s) + (o.max - o.min), right: ({ x: o }, { left: s }) => parseFloat(s) + (o.max - o.min), // Transform x: (o, { transform: s }) => H1(s, "x"), y: (o, { transform: s }) => H1(s, "y") }; Sf.translateX = Sf.x; Sf.translateY = Sf.y; const Tf = /* @__PURE__ */ new Set(); let V1 = !1, B1 = !1, N1 = !1; function KA() { if (B1) { const o = Array.from(Tf).filter((m) => m.needsMeasurement), s = new Set(o.map((m) => m.element)), d = /* @__PURE__ */ new Map(); s.forEach((m) => { const y = RM(m); y.length && (d.set(m, y), m.render()); }), o.forEach((m) => m.measureInitialState()), s.forEach((m) => { m.render(); const y = d.get(m); y && y.forEach(([b, v]) => { m.getValue(b)?.set(v); }); }), o.forEach((m) => m.measureEndState()), o.forEach((m) => { m.suspendedScrollY !== void 0 && window.scrollTo(0, m.suspendedScrollY); }); } B1 = !1, V1 = !1, Tf.forEach((o) => o.complete(N1)), Tf.clear(); } function $A() { Tf.forEach((o) => { o.readKeyframes(), o.needsMeasurement && (B1 = !0); }); } function DM() { N1 = !0, $A(), KA(), N1 = !1; } class gS { constructor(s, d, m, y, b, v = !1) { this.state = "pending", this.isAsync = !1, this.needsMeasurement = !1, this.unresolvedKeyframes = [...s], this.onComplete = d, this.name = m, this.motionValue = y, this.element = b, this.isAsync = v; } scheduleResolve() { this.state = "scheduled", this.isAsync ? (Tf.add(this), V1 || (V1 = !0, Ge.read($A), Ge.resolveKeyframes(KA))) : (this.readKeyframes(), this.complete()); } readKeyframes() { const { unresolvedKeyframes: s, name: d, element: m, motionValue: y } = this; if (s[0] === null) { const b = y?.get(), v = s[s.length - 1]; if (b !== void 0) s[0] = b; else if (m && d) { const x = m.readValue(d, v); x != null && (s[0] = x); } s[0] === void 0 && (s[0] = v), y && b === void 0 && y.set(s[0]); } vM(s); } setFinalKeyframe() { } measureInitialState() { } renderEndStyles() { } measureEndState() { } complete(s = !1) { this.state = "complete", this.onComplete(this.unresolvedKeyframes, this.finalKeyframe, s), Tf.delete(this); } cancel() { this.state === "scheduled" && (Tf.delete(this), this.state = "pending"); } resume() { this.state === "pending" && this.scheduleResolve(); } } const MM = (o) => o.startsWith("--"); function OM(o, s, d) { MM(s) ? o.style.setProperty(s, d) : o.style[s] = d; } const CM = /* @__PURE__ */ aS(() => window.ScrollTimeline !== void 0), zM = {}; function wM(o, s) { const d = /* @__PURE__ */ aS(o); return () => zM[s] ?? d(); } const JA = /* @__PURE__ */ wM(() => { try { document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" }); } catch { return !1; } return !0; }, "linearEasing"), ig = ([o, s, d, m]) => `cubic-bezier(${o}, ${s}, ${d}, ${m})`, J2 = { linear: "linear", ease: "ease", easeIn: "ease-in", easeOut: "ease-out", easeInOut: "ease-in-out", circIn: /* @__PURE__ */ ig([0, 0.65, 0.55, 1]), circOut: /* @__PURE__ */ ig([0.55, 0, 1, 0.45]), backIn: /* @__PURE__ */ ig([0.31, 0.01, 0.66, -0.59]), backOut: /* @__PURE__ */ ig([0.33, 1.53, 0.69, 0.99]) }; function WA(o, s) { if (o) return typeof o == "function" ? JA() ? QA(o, s) : "ease-out" : VA(o) ? ig(o) : Array.isArray(o) ? o.map((d) => WA(d, s) || J2.easeOut) : J2[o]; } function UM(o, s, d, { delay: m = 0, duration: y = 300, repeat: b = 0, repeatType: v = "loop", ease: x = "easeOut", times: A } = {}, M = void 0) { const D = { [s]: d }; A && (D.offset = A); const C = WA(x, y); Array.isArray(C) && (D.easing = C); const z = { delay: m, duration: y, easing: Array.isArray(C) ? "linear" : C, fill: "both", iterations: b + 1, direction: v === "reverse" ? "alternate" : "normal" }; return M && (z.pseudoElement = M), o.animate(D, z); } function FA(o) { return typeof o == "function" && "applyToOptions" in o; } function HM({ type: o, ...s }) { return FA(o) && JA() ? o.applyToOptions(s) : (s.duration ?? (s.duration = 300), s.ease ?? (s.ease = "easeOut"), s); } class VM extends pS { constructor(s) { if (super(), this.finishedTime = null, this.isStopped = !1, !s) return; const { element: d, name: m, keyframes: y, pseudoElement: b, allowFlatten: v = !1, finalKeyframe: x, onComplete: A } = s; this.isPseudoElement = !!b, this.allowFlatten = v, this.options = s, ls(typeof s.type != "string", `Mini animate() doesn't support "type" as a string.`, "mini-spring"); const M = HM(s); this.animation = UM(d, m, y, M, b), M.autoplay === !1 && this.animation.pause(), this.animation.onfinish = () => { if (this.finishedTime = this.time, !b) { const D = mS(y, this.options, x, this.speed); this.updateMotionValue ? this.updateMotionValue(D) : OM(d, m, D), this.animation.cancel(); } A?.(), this.notifyFinished(); }; } play() { this.isStopped || (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: s } = this; s === "idle" || s === "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() { this.isPseudoElement || this.animation.commitStyles?.(); } get duration() { const s = this.animation.effect?.getComputedTiming?.().duration || 0; return /* @__PURE__ */ Xu(Number(s)); } get time() { return /* @__PURE__ */ Xu(Number(this.animation.currentTime) || 0); } set time(s) { this.finishedTime = null, this.animation.currentTime = /* @__PURE__ */ Ji(s); } /** * The playback speed of the animation. * 1 = normal speed, 2 = double speed, 0.5 = half speed. */ get speed() { return this.animation.playbackRate; } set speed(s) { s < 0 && (this.finishedTime = null), this.animation.playbackRate = s; } get state() { return this.finishedTime !== null ? "finished" : this.animation.playState; } get startTime() { return Number(this.animation.startTime); } set startTime(s) { this.animation.startTime = s; } /** * Attaches a timeline to the animation, for instance the `ScrollTimeline`. */ attachTimeline({ timeline: s, observe: d }) { return this.allowFlatten && this.animation.effect?.updateTiming({ easing: "linear" }), this.animation.onfinish = null, s && CM() ? (this.animation.timeline = s, fi) : d(this); } } const PA = { anticipate: zA, backInOut: CA, circInOut: UA }; function BM(o) { return o in PA; } function NM(o) { typeof o.ease == "string" && BM(o.ease) && (o.ease = PA[o.ease]); } const W2 = 10; class jM extends VM { constructor(s) { NM(s), kA(s), super(s), s.startTime && (this.startTime = s.startTime), this.options = s; } /** * 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(s) { const { motionValue: d, onUpdate: m, onComplete: y, element: b, ...v } = this.options; if (!d) return; if (s !== void 0) { d.set(s); return; } const x = new yS({ ...v, autoplay: !1 }), A = /* @__PURE__ */ Ji(this.finishedTime ?? this.time); d.setWithVelocity(x.sample(A - W2).value, x.sample(A).value, W2), x.stop(); } } const F2 = (o, s) => s === "zIndex" ? !1 : !!(typeof o == "number" || Array.isArray(o) || typeof o == "string" && // It's animatable if we have a string (Dc.test(o) || o === "0") && // And it contains numbers and/or colors !o.startsWith("url(")); function LM(o) { const s = o[0]; if (o.length === 1) return !0; for (let d = 0; d < o.length; d++) if (o[d] !== s) return !0; } function _M(o, s, d,