@telegraph/tooltip 0.0.54 → 0.0.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,54 +1,57 @@
1
- import { jsx as R, jsxs as hn } from "react/jsx-runtime";
2
- import * as ot from "@radix-ui/react-tooltip";
3
- import { useControllableState as Os } from "@radix-ui/react-use-controllable-state";
4
- import { OverrideAppearance as Ds } from "@telegraph/appearance";
5
- import { RefToTgphRef as Is } from "@telegraph/helpers";
6
- import { Stack as Rs } from "@telegraph/layout";
7
- import { Text as Es } from "@telegraph/typography";
8
- import lt, { createContext as Q, useRef as ut, useLayoutEffect as ks, useEffect as ce, useState as Ns, useContext as k, useMemo as It, useCallback as Ls, useInsertionEffect as Bs, forwardRef as Ks, Fragment as pn, createElement as Ws } from "react";
9
- const $s = Q({});
10
- function js(t) {
11
- const e = ut(null);
1
+ import { jsx as R, jsxs as mn } from "react/jsx-runtime";
2
+ import * as lt from "@radix-ui/react-tooltip";
3
+ import { useControllableState as Rs } from "@radix-ui/react-use-controllable-state";
4
+ import { OverrideAppearance as Es } from "@telegraph/appearance";
5
+ import { RefToTgphRef as ks } from "@telegraph/helpers";
6
+ import { Stack as Ns } from "@telegraph/layout";
7
+ import { Text as Ls } from "@telegraph/typography";
8
+ import et, { createContext as st, useRef as dt, useLayoutEffect as Bs, useEffect as de, useState as Ks, useContext as k, useMemo as Et, Fragment as gn, createElement as Ws, useCallback as $s, useInsertionEffect as js, forwardRef as Gs } from "react";
9
+ const _s = st({});
10
+ function Hs(t) {
11
+ const e = dt(null);
12
12
  return e.current === null && (e.current = t()), e.current;
13
13
  }
14
- const le = typeof window < "u", _s = le ? ks : ce, mn = /* @__PURE__ */ Q(null);
15
- function Gs(t, e) {
14
+ const he = typeof window < "u", Us = he ? Bs : de, yn = /* @__PURE__ */ st(null);
15
+ function zs(t, e) {
16
16
  t.indexOf(e) === -1 && t.push(e);
17
17
  }
18
- function Us(t, e) {
18
+ function Ys(t, e) {
19
19
  const n = t.indexOf(e);
20
20
  n > -1 && t.splice(n, 1);
21
21
  }
22
- const z = (t, e, n) => n > e ? e : n < t ? t : n;
23
- let mt = () => {
24
- }, Y = () => {
22
+ const Y = (t, e, n) => n > e ? e : n < t ? t : n;
23
+ function zt(t, e) {
24
+ return e ? `${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}` : t;
25
+ }
26
+ let yt = () => {
27
+ }, X = () => {
25
28
  };
26
- process.env.NODE_ENV !== "production" && (mt = (t, e) => {
27
- !t && typeof console < "u" && console.warn(e);
28
- }, Y = (t, e) => {
29
+ process.env.NODE_ENV !== "production" && (yt = (t, e, n) => {
30
+ !t && typeof console < "u" && console.warn(zt(e, n));
31
+ }, X = (t, e, n) => {
29
32
  if (!t)
30
- throw new Error(e);
33
+ throw new Error(zt(e, n));
31
34
  });
32
- const W = {}, gn = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);
33
- function Hs(t) {
35
+ const $ = {}, bn = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);
36
+ function Xs(t) {
34
37
  return typeof t == "object" && t !== null;
35
38
  }
36
- const yn = (t) => /^0[^.\s]+$/u.test(t);
39
+ const Tn = (t) => /^0[^.\s]+$/u.test(t);
37
40
  // @__NO_SIDE_EFFECTS__
38
- function fe(t) {
41
+ function pe(t) {
39
42
  let e;
40
43
  return () => (e === void 0 && (e = t()), e);
41
44
  }
42
- const tt = /* @__NO_SIDE_EFFECTS__ */ (t) => t, zs = (t, e) => (n) => e(t(n)), Rt = (...t) => t.reduce(zs), bn = /* @__NO_SIDE_EFFECTS__ */ (t, e, n) => {
45
+ const it = /* @__NO_SIDE_EFFECTS__ */ (t) => t, qs = (t, e) => (n) => e(t(n)), kt = (...t) => t.reduce(qs), vn = /* @__NO_SIDE_EFFECTS__ */ (t, e, n) => {
43
46
  const s = e - t;
44
47
  return s === 0 ? 1 : (n - t) / s;
45
48
  };
46
- class Tn {
49
+ class wn {
47
50
  constructor() {
48
51
  this.subscriptions = [];
49
52
  }
50
53
  add(e) {
51
- return Gs(this.subscriptions, e), () => Us(this.subscriptions, e);
54
+ return zs(this.subscriptions, e), () => Ys(this.subscriptions, e);
52
55
  }
53
56
  notify(e, n, s) {
54
57
  const i = this.subscriptions.length;
@@ -68,49 +71,49 @@ class Tn {
68
71
  this.subscriptions.length = 0;
69
72
  }
70
73
  }
71
- const L = /* @__NO_SIDE_EFFECTS__ */ (t) => t * 1e3, K = /* @__NO_SIDE_EFFECTS__ */ (t) => t / 1e3;
72
- function vn(t, e) {
74
+ const L = /* @__NO_SIDE_EFFECTS__ */ (t) => t * 1e3, W = /* @__NO_SIDE_EFFECTS__ */ (t) => t / 1e3;
75
+ function Sn(t, e) {
73
76
  return e ? t * (1e3 / e) : 0;
74
77
  }
75
- const ke = /* @__PURE__ */ new Set();
76
- function wn(t, e, n) {
77
- t || ke.has(e) || (console.warn(e), ke.add(e));
78
+ const Le = /* @__PURE__ */ new Set();
79
+ function Vn(t, e, n) {
80
+ t || Le.has(e) || (console.warn(zt(e, n)), Le.add(e));
78
81
  }
79
- const Sn = (t, e, n) => (((1 - 3 * n + 3 * e) * t + (3 * n - 6 * e)) * t + 3 * e) * t, Ys = 1e-7, Xs = 12;
80
- function qs(t, e, n, s, i) {
82
+ const An = (t, e, n) => (((1 - 3 * n + 3 * e) * t + (3 * n - 6 * e)) * t + 3 * e) * t, Zs = 1e-7, Js = 12;
83
+ function Qs(t, e, n, s, i) {
81
84
  let r, o, a = 0;
82
85
  do
83
- o = e + (n - e) / 2, r = Sn(o, s, i) - t, r > 0 ? n = o : e = o;
84
- while (Math.abs(r) > Ys && ++a < Xs);
86
+ o = e + (n - e) / 2, r = An(o, s, i) - t, r > 0 ? n = o : e = o;
87
+ while (Math.abs(r) > Zs && ++a < Js);
85
88
  return o;
86
89
  }
87
- function gt(t, e, n, s) {
90
+ function bt(t, e, n, s) {
88
91
  if (t === e && n === s)
89
- return tt;
90
- const i = (r) => qs(r, 0, 1, t, n);
91
- return (r) => r === 0 || r === 1 ? r : Sn(i(r), e, s);
92
- }
93
- const Vn = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, An = (t) => (e) => 1 - t(1 - e), xn = /* @__PURE__ */ gt(0.33, 1.53, 0.69, 0.99), de = /* @__PURE__ */ An(xn), Mn = /* @__PURE__ */ Vn(de), Cn = (t) => (t *= 2) < 1 ? 0.5 * de(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), he = (t) => 1 - Math.sin(Math.acos(t)), Zs = An(he), Pn = Vn(he), Js = /* @__PURE__ */ gt(0.42, 0, 1, 1), Qs = /* @__PURE__ */ gt(0, 0, 0.58, 1), Fn = /* @__PURE__ */ gt(0.42, 0, 0.58, 1), ti = (t) => Array.isArray(t) && typeof t[0] != "number", On = (t) => Array.isArray(t) && typeof t[0] == "number", Ne = {
94
- linear: tt,
95
- easeIn: Js,
96
- easeInOut: Fn,
97
- easeOut: Qs,
98
- circIn: he,
99
- circInOut: Pn,
100
- circOut: Zs,
101
- backIn: de,
102
- backInOut: Mn,
103
- backOut: xn,
104
- anticipate: Cn
105
- }, ei = (t) => typeof t == "string", Le = (t) => {
106
- if (On(t)) {
107
- Y(t.length === 4, "Cubic bezier arrays must contain four numerical values.");
92
+ return it;
93
+ const i = (r) => Qs(r, 0, 1, t, n);
94
+ return (r) => r === 0 || r === 1 ? r : An(i(r), e, s);
95
+ }
96
+ const xn = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, Mn = (t) => (e) => 1 - t(1 - e), Cn = /* @__PURE__ */ bt(0.33, 1.53, 0.69, 0.99), me = /* @__PURE__ */ Mn(Cn), Pn = /* @__PURE__ */ xn(me), Fn = (t) => (t *= 2) < 1 ? 0.5 * me(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), ge = (t) => 1 - Math.sin(Math.acos(t)), ti = Mn(ge), On = xn(ge), ei = /* @__PURE__ */ bt(0.42, 0, 1, 1), ni = /* @__PURE__ */ bt(0, 0, 0.58, 1), Dn = /* @__PURE__ */ bt(0.42, 0, 0.58, 1), si = (t) => Array.isArray(t) && typeof t[0] != "number", In = (t) => Array.isArray(t) && typeof t[0] == "number", Be = {
97
+ linear: it,
98
+ easeIn: ei,
99
+ easeInOut: Dn,
100
+ easeOut: ni,
101
+ circIn: ge,
102
+ circInOut: On,
103
+ circOut: ti,
104
+ backIn: me,
105
+ backInOut: Pn,
106
+ backOut: Cn,
107
+ anticipate: Fn
108
+ }, ii = (t) => typeof t == "string", Ke = (t) => {
109
+ if (In(t)) {
110
+ X(t.length === 4, "Cubic bezier arrays must contain four numerical values.", "cubic-bezier-length");
108
111
  const [e, n, s, i] = t;
109
- return gt(e, n, s, i);
110
- } else if (ei(t))
111
- return Y(Ne[t] !== void 0, `Invalid easing type '${t}'`), Ne[t];
112
+ return bt(e, n, s, i);
113
+ } else if (ii(t))
114
+ return X(Be[t] !== void 0, `Invalid easing type '${t}'`, "invalid-easing-type"), Be[t];
112
115
  return t;
113
- }, St = [
116
+ }, At = [
114
117
  "setup",
115
118
  // Compute
116
119
  "read",
@@ -128,7 +131,7 @@ const Vn = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, An
128
131
  "postRender"
129
132
  // Compute
130
133
  ];
131
- function ni(t, e) {
134
+ function ri(t, e) {
132
135
  let n = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), i = !1, r = !1;
133
136
  const o = /* @__PURE__ */ new WeakSet();
134
137
  let a = {
@@ -143,9 +146,9 @@ function ni(t, e) {
143
146
  /**
144
147
  * Schedule a process to run on the next frame.
145
148
  */
146
- schedule: (u, d = !1, f = !1) => {
147
- const y = f && i ? n : s;
148
- return d && o.add(u), y.has(u) || y.add(u), u;
149
+ schedule: (u, f = !1, d = !1) => {
150
+ const y = d && i ? n : s;
151
+ return f && o.add(u), y.has(u) || y.add(u), u;
149
152
  },
150
153
  /**
151
154
  * Cancel the provided callback from running on the next frame.
@@ -166,70 +169,70 @@ function ni(t, e) {
166
169
  };
167
170
  return l;
168
171
  }
169
- const si = 40;
170
- function Dn(t, e) {
172
+ const oi = 40;
173
+ function Rn(t, e) {
171
174
  let n = !1, s = !0;
172
175
  const i = {
173
176
  delta: 0,
174
177
  timestamp: 0,
175
178
  isProcessing: !1
176
- }, r = () => n = !0, o = St.reduce((m, A) => (m[A] = ni(r), m), {}), { setup: a, read: c, resolveKeyframes: l, preUpdate: u, update: d, preRender: f, render: h, postRender: y } = o, b = () => {
177
- const m = W.useManualTiming ? i.timestamp : performance.now();
178
- n = !1, W.useManualTiming || (i.delta = s ? 1e3 / 60 : Math.max(Math.min(m - i.timestamp, si), 1)), i.timestamp = m, i.isProcessing = !0, a.process(i), c.process(i), l.process(i), u.process(i), d.process(i), f.process(i), h.process(i), y.process(i), i.isProcessing = !1, n && e && (s = !1, t(b));
179
+ }, r = () => n = !0, o = At.reduce((m, A) => (m[A] = ri(r), m), {}), { setup: a, read: c, resolveKeyframes: l, preUpdate: u, update: f, preRender: d, render: h, postRender: y } = o, b = () => {
180
+ const m = $.useManualTiming ? i.timestamp : performance.now();
181
+ n = !1, $.useManualTiming || (i.delta = s ? 1e3 / 60 : Math.max(Math.min(m - i.timestamp, oi), 1)), i.timestamp = m, i.isProcessing = !0, a.process(i), c.process(i), l.process(i), u.process(i), f.process(i), d.process(i), h.process(i), y.process(i), i.isProcessing = !1, n && e && (s = !1, t(b));
179
182
  }, v = () => {
180
183
  n = !0, s = !0, i.isProcessing || t(b);
181
184
  };
182
- return { schedule: St.reduce((m, A) => {
185
+ return { schedule: At.reduce((m, A) => {
183
186
  const T = o[A];
184
187
  return m[A] = (V, M = !1, w = !1) => (n || v(), T.schedule(V, M, w)), m;
185
188
  }, {}), cancel: (m) => {
186
- for (let A = 0; A < St.length; A++)
187
- o[St[A]].cancel(m);
189
+ for (let A = 0; A < At.length; A++)
190
+ o[At[A]].cancel(m);
188
191
  }, state: i, steps: o };
189
192
  }
190
- const { schedule: N, cancel: Ht, state: Mt } = /* @__PURE__ */ Dn(typeof requestAnimationFrame < "u" ? requestAnimationFrame : tt, !0);
191
- let At;
192
- function ii() {
193
- At = void 0;
193
+ const { schedule: N, cancel: Yt, state: Pt } = /* @__PURE__ */ Rn(typeof requestAnimationFrame < "u" ? requestAnimationFrame : it, !0);
194
+ let Mt;
195
+ function ai() {
196
+ Mt = void 0;
194
197
  }
195
198
  const E = {
196
- now: () => (At === void 0 && E.set(Mt.isProcessing || W.useManualTiming ? Mt.timestamp : performance.now()), At),
199
+ now: () => (Mt === void 0 && E.set(Pt.isProcessing || $.useManualTiming ? Pt.timestamp : performance.now()), Mt),
197
200
  set: (t) => {
198
- At = t, queueMicrotask(ii);
201
+ Mt = t, queueMicrotask(ai);
199
202
  }
200
- }, In = (t) => (e) => typeof e == "string" && e.startsWith(t), Rn = /* @__PURE__ */ In("--"), ri = /* @__PURE__ */ In("var(--"), pe = (t) => ri(t) ? oi.test(t.split("/*")[0].trim()) : !1, oi = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, et = {
203
+ }, En = (t) => (e) => typeof e == "string" && e.startsWith(t), kn = /* @__PURE__ */ En("--"), ui = /* @__PURE__ */ En("var(--"), ye = (t) => ui(t) ? ci.test(t.split("/*")[0].trim()) : !1, ci = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, rt = {
201
204
  test: (t) => typeof t == "number",
202
205
  parse: parseFloat,
203
206
  transform: (t) => t
204
- }, ft = {
205
- ...et,
206
- transform: (t) => z(0, 1, t)
207
- }, Vt = {
208
- ...et,
207
+ }, pt = {
208
+ ...rt,
209
+ transform: (t) => Y(0, 1, t)
210
+ }, xt = {
211
+ ...rt,
209
212
  default: 1
210
- }, ct = (t) => Math.round(t * 1e5) / 1e5, me = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
211
- function ai(t) {
213
+ }, ht = (t) => Math.round(t * 1e5) / 1e5, be = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
214
+ function li(t) {
212
215
  return t == null;
213
216
  }
214
- const ui = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, ge = (t, e) => (n) => !!(typeof n == "string" && ui.test(n) && n.startsWith(t) || e && !ai(n) && Object.prototype.hasOwnProperty.call(n, e)), En = (t, e, n) => (s) => {
217
+ const fi = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, Te = (t, e) => (n) => !!(typeof n == "string" && fi.test(n) && n.startsWith(t) || e && !li(n) && Object.prototype.hasOwnProperty.call(n, e)), Nn = (t, e, n) => (s) => {
215
218
  if (typeof s != "string")
216
219
  return s;
217
- const [i, r, o, a] = s.match(me);
220
+ const [i, r, o, a] = s.match(be);
218
221
  return {
219
222
  [t]: parseFloat(i),
220
223
  [e]: parseFloat(r),
221
224
  [n]: parseFloat(o),
222
225
  alpha: a !== void 0 ? parseFloat(a) : 1
223
226
  };
224
- }, ci = (t) => z(0, 255, t), Kt = {
225
- ...et,
226
- transform: (t) => Math.round(ci(t))
227
+ }, di = (t) => Y(0, 255, t), Wt = {
228
+ ...rt,
229
+ transform: (t) => Math.round(di(t))
227
230
  }, _ = {
228
- test: /* @__PURE__ */ ge("rgb", "red"),
229
- parse: /* @__PURE__ */ En("red", "green", "blue"),
230
- transform: ({ red: t, green: e, blue: n, alpha: s = 1 }) => "rgba(" + Kt.transform(t) + ", " + Kt.transform(e) + ", " + Kt.transform(n) + ", " + ct(ft.transform(s)) + ")"
231
+ test: /* @__PURE__ */ Te("rgb", "red"),
232
+ parse: /* @__PURE__ */ Nn("red", "green", "blue"),
233
+ transform: ({ red: t, green: e, blue: n, alpha: s = 1 }) => "rgba(" + Wt.transform(t) + ", " + Wt.transform(e) + ", " + Wt.transform(n) + ", " + ht(pt.transform(s)) + ")"
231
234
  };
232
- function li(t) {
235
+ function hi(t) {
233
236
  let e = "", n = "", s = "", i = "";
234
237
  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), {
235
238
  red: parseInt(e, 16),
@@ -238,83 +241,83 @@ function li(t) {
238
241
  alpha: i ? parseInt(i, 16) / 255 : 1
239
242
  };
240
243
  }
241
- const zt = {
242
- test: /* @__PURE__ */ ge("#"),
243
- parse: li,
244
+ const Xt = {
245
+ test: /* @__PURE__ */ Te("#"),
246
+ parse: hi,
244
247
  transform: _.transform
245
- }, yt = /* @__NO_SIDE_EFFECTS__ */ (t) => ({
248
+ }, Tt = /* @__NO_SIDE_EFFECTS__ */ (t) => ({
246
249
  test: (e) => typeof e == "string" && e.endsWith(t) && e.split(" ").length === 1,
247
250
  parse: parseFloat,
248
251
  transform: (e) => `${e}${t}`
249
- }), $ = /* @__PURE__ */ yt("deg"), Z = /* @__PURE__ */ yt("%"), g = /* @__PURE__ */ yt("px"), fi = /* @__PURE__ */ yt("vh"), di = /* @__PURE__ */ yt("vw"), Be = {
250
- ...Z,
251
- parse: (t) => Z.parse(t) / 100,
252
- transform: (t) => Z.transform(t * 100)
253
- }, X = {
254
- test: /* @__PURE__ */ ge("hsl", "hue"),
255
- parse: /* @__PURE__ */ En("hue", "saturation", "lightness"),
256
- transform: ({ hue: t, saturation: e, lightness: n, alpha: s = 1 }) => "hsla(" + Math.round(t) + ", " + Z.transform(ct(e)) + ", " + Z.transform(ct(n)) + ", " + ct(ft.transform(s)) + ")"
257
- }, C = {
258
- test: (t) => _.test(t) || zt.test(t) || X.test(t),
259
- parse: (t) => _.test(t) ? _.parse(t) : X.test(t) ? X.parse(t) : zt.parse(t),
260
- transform: (t) => typeof t == "string" ? t : t.hasOwnProperty("red") ? _.transform(t) : X.transform(t),
252
+ }), j = /* @__PURE__ */ Tt("deg"), Q = /* @__PURE__ */ Tt("%"), g = /* @__PURE__ */ Tt("px"), pi = /* @__PURE__ */ Tt("vh"), mi = /* @__PURE__ */ Tt("vw"), We = {
253
+ ...Q,
254
+ parse: (t) => Q.parse(t) / 100,
255
+ transform: (t) => Q.transform(t * 100)
256
+ }, Z = {
257
+ test: /* @__PURE__ */ Te("hsl", "hue"),
258
+ parse: /* @__PURE__ */ Nn("hue", "saturation", "lightness"),
259
+ transform: ({ hue: t, saturation: e, lightness: n, alpha: s = 1 }) => "hsla(" + Math.round(t) + ", " + Q.transform(ht(e)) + ", " + Q.transform(ht(n)) + ", " + ht(pt.transform(s)) + ")"
260
+ }, P = {
261
+ test: (t) => _.test(t) || Xt.test(t) || Z.test(t),
262
+ parse: (t) => _.test(t) ? _.parse(t) : Z.test(t) ? Z.parse(t) : Xt.parse(t),
263
+ transform: (t) => typeof t == "string" ? t : t.hasOwnProperty("red") ? _.transform(t) : Z.transform(t),
261
264
  getAnimatableNone: (t) => {
262
- const e = C.parse(t);
263
- return e.alpha = 0, C.transform(e);
265
+ const e = P.parse(t);
266
+ return e.alpha = 0, P.transform(e);
264
267
  }
265
- }, hi = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
266
- function pi(t) {
268
+ }, gi = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
269
+ function yi(t) {
267
270
  var e, n;
268
- return isNaN(t) && typeof t == "string" && (((e = t.match(me)) == null ? void 0 : e.length) || 0) + (((n = t.match(hi)) == null ? void 0 : n.length) || 0) > 0;
271
+ return isNaN(t) && typeof t == "string" && (((e = t.match(be)) == null ? void 0 : e.length) || 0) + (((n = t.match(gi)) == null ? void 0 : n.length) || 0) > 0;
269
272
  }
270
- const kn = "number", Nn = "color", mi = "var", gi = "var(", Ke = "${}", yi = /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;
271
- function dt(t) {
273
+ const Ln = "number", Bn = "color", bi = "var", Ti = "var(", $e = "${}", vi = /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;
274
+ function mt(t) {
272
275
  const e = t.toString(), n = [], s = {
273
276
  color: [],
274
277
  number: [],
275
278
  var: []
276
279
  }, i = [];
277
280
  let r = 0;
278
- const a = e.replace(yi, (c) => (C.test(c) ? (s.color.push(r), i.push(Nn), n.push(C.parse(c))) : c.startsWith(gi) ? (s.var.push(r), i.push(mi), n.push(c)) : (s.number.push(r), i.push(kn), n.push(parseFloat(c))), ++r, Ke)).split(Ke);
281
+ const a = e.replace(vi, (c) => (P.test(c) ? (s.color.push(r), i.push(Bn), n.push(P.parse(c))) : c.startsWith(Ti) ? (s.var.push(r), i.push(bi), n.push(c)) : (s.number.push(r), i.push(Ln), n.push(parseFloat(c))), ++r, $e)).split($e);
279
282
  return { values: n, split: a, indexes: s, types: i };
280
283
  }
281
- function Ln(t) {
282
- return dt(t).values;
284
+ function Kn(t) {
285
+ return mt(t).values;
283
286
  }
284
- function Bn(t) {
285
- const { split: e, types: n } = dt(t), s = e.length;
287
+ function Wn(t) {
288
+ const { split: e, types: n } = mt(t), s = e.length;
286
289
  return (i) => {
287
290
  let r = "";
288
291
  for (let o = 0; o < s; o++)
289
292
  if (r += e[o], i[o] !== void 0) {
290
293
  const a = n[o];
291
- a === kn ? r += ct(i[o]) : a === Nn ? r += C.transform(i[o]) : r += i[o];
294
+ a === Ln ? r += ht(i[o]) : a === Bn ? r += P.transform(i[o]) : r += i[o];
292
295
  }
293
296
  return r;
294
297
  };
295
298
  }
296
- const bi = (t) => typeof t == "number" ? 0 : C.test(t) ? C.getAnimatableNone(t) : t;
297
- function Ti(t) {
298
- const e = Ln(t);
299
- return Bn(t)(e.map(bi));
299
+ const wi = (t) => typeof t == "number" ? 0 : P.test(t) ? P.getAnimatableNone(t) : t;
300
+ function Si(t) {
301
+ const e = Kn(t);
302
+ return Wn(t)(e.map(wi));
300
303
  }
301
- const nt = {
302
- test: pi,
303
- parse: Ln,
304
- createTransformer: Bn,
305
- getAnimatableNone: Ti
304
+ const ot = {
305
+ test: yi,
306
+ parse: Kn,
307
+ createTransformer: Wn,
308
+ getAnimatableNone: Si
306
309
  };
307
- function Wt(t, e, n) {
310
+ function $t(t, e, n) {
308
311
  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;
309
312
  }
310
- function vi({ hue: t, saturation: e, lightness: n, alpha: s }) {
313
+ function Vi({ hue: t, saturation: e, lightness: n, alpha: s }) {
311
314
  t /= 360, e /= 100, n /= 100;
312
315
  let i = 0, r = 0, o = 0;
313
316
  if (!e)
314
317
  i = r = o = n;
315
318
  else {
316
319
  const a = n < 0.5 ? n * (1 + e) : n + e - n * e, c = 2 * n - a;
317
- i = Wt(c, a, t + 1 / 3), r = Wt(c, a, t), o = Wt(c, a, t - 1 / 3);
320
+ i = $t(c, a, t + 1 / 3), r = $t(c, a, t), o = $t(c, a, t - 1 / 3);
318
321
  }
319
322
  return {
320
323
  red: Math.round(i * 255),
@@ -323,55 +326,55 @@ function vi({ hue: t, saturation: e, lightness: n, alpha: s }) {
323
326
  alpha: s
324
327
  };
325
328
  }
326
- function Ct(t, e) {
329
+ function Ft(t, e) {
327
330
  return (n) => n > 0 ? e : t;
328
331
  }
329
- const Et = (t, e, n) => t + (e - t) * n, $t = (t, e, n) => {
332
+ const Nt = (t, e, n) => t + (e - t) * n, jt = (t, e, n) => {
330
333
  const s = t * t, i = n * (e * e - s) + s;
331
334
  return i < 0 ? 0 : Math.sqrt(i);
332
- }, wi = [zt, _, X], Si = (t) => wi.find((e) => e.test(t));
333
- function We(t) {
334
- const e = Si(t);
335
- if (mt(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`), !e)
335
+ }, Ai = [Xt, _, Z], xi = (t) => Ai.find((e) => e.test(t));
336
+ function je(t) {
337
+ const e = xi(t);
338
+ if (yt(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`, "color-not-animatable"), !e)
336
339
  return !1;
337
340
  let n = e.parse(t);
338
- return e === X && (n = vi(n)), n;
341
+ return e === Z && (n = Vi(n)), n;
339
342
  }
340
- const $e = (t, e) => {
341
- const n = We(t), s = We(e);
343
+ const Ge = (t, e) => {
344
+ const n = je(t), s = je(e);
342
345
  if (!n || !s)
343
- return Ct(t, e);
346
+ return Ft(t, e);
344
347
  const i = { ...n };
345
- return (r) => (i.red = $t(n.red, s.red, r), i.green = $t(n.green, s.green, r), i.blue = $t(n.blue, s.blue, r), i.alpha = Et(n.alpha, s.alpha, r), _.transform(i));
346
- }, Yt = /* @__PURE__ */ new Set(["none", "hidden"]);
347
- function Vi(t, e) {
348
- return Yt.has(t) ? (n) => n <= 0 ? t : e : (n) => n >= 1 ? e : t;
348
+ return (r) => (i.red = jt(n.red, s.red, r), i.green = jt(n.green, s.green, r), i.blue = jt(n.blue, s.blue, r), i.alpha = Nt(n.alpha, s.alpha, r), _.transform(i));
349
+ }, qt = /* @__PURE__ */ new Set(["none", "hidden"]);
350
+ function Mi(t, e) {
351
+ return qt.has(t) ? (n) => n <= 0 ? t : e : (n) => n >= 1 ? e : t;
349
352
  }
350
- function Ai(t, e) {
351
- return (n) => Et(t, e, n);
353
+ function Ci(t, e) {
354
+ return (n) => Nt(t, e, n);
352
355
  }
353
- function ye(t) {
354
- return typeof t == "number" ? Ai : typeof t == "string" ? pe(t) ? Ct : C.test(t) ? $e : Ci : Array.isArray(t) ? Kn : typeof t == "object" ? C.test(t) ? $e : xi : Ct;
356
+ function ve(t) {
357
+ return typeof t == "number" ? Ci : typeof t == "string" ? ye(t) ? Ft : P.test(t) ? Ge : Oi : Array.isArray(t) ? $n : typeof t == "object" ? P.test(t) ? Ge : Pi : Ft;
355
358
  }
356
- function Kn(t, e) {
357
- const n = [...t], s = n.length, i = t.map((r, o) => ye(r)(r, e[o]));
359
+ function $n(t, e) {
360
+ const n = [...t], s = n.length, i = t.map((r, o) => ve(r)(r, e[o]));
358
361
  return (r) => {
359
362
  for (let o = 0; o < s; o++)
360
363
  n[o] = i[o](r);
361
364
  return n;
362
365
  };
363
366
  }
364
- function xi(t, e) {
367
+ function Pi(t, e) {
365
368
  const n = { ...t, ...e }, s = {};
366
369
  for (const i in n)
367
- t[i] !== void 0 && e[i] !== void 0 && (s[i] = ye(t[i])(t[i], e[i]));
370
+ t[i] !== void 0 && e[i] !== void 0 && (s[i] = ve(t[i])(t[i], e[i]));
368
371
  return (i) => {
369
372
  for (const r in s)
370
373
  n[r] = s[r](i);
371
374
  return n;
372
375
  };
373
376
  }
374
- function Mi(t, e) {
377
+ function Fi(t, e) {
375
378
  const n = [], s = { color: 0, var: 0, number: 0 };
376
379
  for (let i = 0; i < e.values.length; i++) {
377
380
  const r = e.types[i], o = t.indexes[r][s[r]], a = t.values[o] ?? 0;
@@ -379,51 +382,51 @@ function Mi(t, e) {
379
382
  }
380
383
  return n;
381
384
  }
382
- const Ci = (t, e) => {
383
- const n = nt.createTransformer(e), s = dt(t), i = dt(e);
384
- 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 ? Yt.has(t) && !i.values.length || Yt.has(e) && !s.values.length ? Vi(t, e) : Rt(Kn(Mi(s, i), i.values), n) : (mt(!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.`), Ct(t, e));
385
+ const Oi = (t, e) => {
386
+ const n = ot.createTransformer(e), s = mt(t), i = mt(e);
387
+ 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 ? qt.has(t) && !i.values.length || qt.has(e) && !s.values.length ? Mi(t, e) : kt($n(Fi(s, i), i.values), n) : (yt(!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"), Ft(t, e));
385
388
  };
386
- function Wn(t, e, n) {
387
- return typeof t == "number" && typeof e == "number" && typeof n == "number" ? Et(t, e, n) : ye(t)(t, e);
389
+ function jn(t, e, n) {
390
+ return typeof t == "number" && typeof e == "number" && typeof n == "number" ? Nt(t, e, n) : ve(t)(t, e);
388
391
  }
389
- const Pi = (t) => {
392
+ const Di = (t) => {
390
393
  const e = ({ timestamp: n }) => t(n);
391
394
  return {
392
395
  start: (n = !0) => N.update(e, n),
393
- stop: () => Ht(e),
396
+ stop: () => Yt(e),
394
397
  /**
395
398
  * If we're processing this frame we can use the
396
399
  * framelocked timestamp to keep things in sync.
397
400
  */
398
- now: () => Mt.isProcessing ? Mt.timestamp : E.now()
401
+ now: () => Pt.isProcessing ? Pt.timestamp : E.now()
399
402
  };
400
- }, $n = (t, e, n = 10) => {
403
+ }, Gn = (t, e, n = 10) => {
401
404
  let s = "";
402
405
  const i = Math.max(Math.round(e / n), 2);
403
406
  for (let r = 0; r < i; r++)
404
407
  s += Math.round(t(r / (i - 1)) * 1e4) / 1e4 + ", ";
405
408
  return `linear(${s.substring(0, s.length - 2)})`;
406
- }, Pt = 2e4;
407
- function be(t) {
409
+ }, Ot = 2e4;
410
+ function we(t) {
408
411
  let e = 0;
409
412
  const n = 50;
410
413
  let s = t.next(e);
411
- for (; !s.done && e < Pt; )
414
+ for (; !s.done && e < Ot; )
412
415
  e += n, s = t.next(e);
413
- return e >= Pt ? 1 / 0 : e;
416
+ return e >= Ot ? 1 / 0 : e;
414
417
  }
415
- function Fi(t, e = 100, n) {
416
- const s = n({ ...t, keyframes: [0, e] }), i = Math.min(be(s), Pt);
418
+ function Ii(t, e = 100, n) {
419
+ const s = n({ ...t, keyframes: [0, e] }), i = Math.min(we(s), Ot);
417
420
  return {
418
421
  type: "keyframes",
419
422
  ease: (r) => s.next(i * r).value / e,
420
- duration: /* @__PURE__ */ K(i)
423
+ duration: /* @__PURE__ */ W(i)
421
424
  };
422
425
  }
423
- const Oi = 5;
424
- function jn(t, e, n) {
425
- const s = Math.max(e - Oi, 0);
426
- return vn(n - t(s), e - s);
426
+ const Ri = 5;
427
+ function _n(t, e, n) {
428
+ const s = Math.max(e - Ri, 0);
429
+ return Sn(n - t(s), e - s);
427
430
  }
428
431
  const x = {
429
432
  // Default spring physics
@@ -453,25 +456,25 @@ const x = {
453
456
  // in seconds
454
457
  minDamping: 0.05,
455
458
  maxDamping: 1
456
- }, jt = 1e-3;
457
- function Di({ duration: t = x.duration, bounce: e = x.bounce, velocity: n = x.velocity, mass: s = x.mass }) {
459
+ }, Gt = 1e-3;
460
+ function Ei({ duration: t = x.duration, bounce: e = x.bounce, velocity: n = x.velocity, mass: s = x.mass }) {
458
461
  let i, r;
459
- mt(t <= /* @__PURE__ */ L(x.maxDuration), "Spring duration must be 10 seconds or less");
462
+ yt(t <= /* @__PURE__ */ L(x.maxDuration), "Spring duration must be 10 seconds or less", "spring-duration-limit");
460
463
  let o = 1 - e;
461
- o = z(x.minDamping, x.maxDamping, o), t = z(x.minDuration, x.maxDuration, /* @__PURE__ */ K(t)), o < 1 ? (i = (l) => {
462
- const u = l * o, d = u * t, f = u - n, h = Xt(l, o), y = Math.exp(-d);
463
- return jt - f / h * y;
464
+ o = Y(x.minDamping, x.maxDamping, o), t = Y(x.minDuration, x.maxDuration, /* @__PURE__ */ W(t)), o < 1 ? (i = (l) => {
465
+ const u = l * o, f = u * t, d = u - n, h = Zt(l, o), y = Math.exp(-f);
466
+ return Gt - d / h * y;
464
467
  }, r = (l) => {
465
- const d = l * o * t, f = d * n + n, h = Math.pow(o, 2) * Math.pow(l, 2) * t, y = Math.exp(-d), b = Xt(Math.pow(l, 2), o);
466
- return (-i(l) + jt > 0 ? -1 : 1) * ((f - h) * y) / b;
468
+ const f = l * o * t, d = f * n + n, h = Math.pow(o, 2) * Math.pow(l, 2) * t, y = Math.exp(-f), b = Zt(Math.pow(l, 2), o);
469
+ return (-i(l) + Gt > 0 ? -1 : 1) * ((d - h) * y) / b;
467
470
  }) : (i = (l) => {
468
- const u = Math.exp(-l * t), d = (l - n) * t + 1;
469
- return -jt + u * d;
471
+ const u = Math.exp(-l * t), f = (l - n) * t + 1;
472
+ return -Gt + u * f;
470
473
  }, r = (l) => {
471
- const u = Math.exp(-l * t), d = (n - l) * (t * t);
472
- return u * d;
474
+ const u = Math.exp(-l * t), f = (n - l) * (t * t);
475
+ return u * f;
473
476
  });
474
- const a = 5 / t, c = Ri(i, r, a);
477
+ const a = 5 / t, c = Ni(i, r, a);
475
478
  if (t = /* @__PURE__ */ L(t), isNaN(c))
476
479
  return {
477
480
  stiffness: x.stiffness,
@@ -487,21 +490,21 @@ function Di({ duration: t = x.duration, bounce: e = x.bounce, velocity: n = x.ve
487
490
  };
488
491
  }
489
492
  }
490
- const Ii = 12;
491
- function Ri(t, e, n) {
493
+ const ki = 12;
494
+ function Ni(t, e, n) {
492
495
  let s = n;
493
- for (let i = 1; i < Ii; i++)
496
+ for (let i = 1; i < ki; i++)
494
497
  s = s - t(s) / e(s);
495
498
  return s;
496
499
  }
497
- function Xt(t, e) {
500
+ function Zt(t, e) {
498
501
  return t * Math.sqrt(1 - e * e);
499
502
  }
500
- const Ei = ["duration", "bounce"], ki = ["stiffness", "damping", "mass"];
501
- function je(t, e) {
503
+ const Li = ["duration", "bounce"], Bi = ["stiffness", "damping", "mass"];
504
+ function _e(t, e) {
502
505
  return e.some((n) => t[n] !== void 0);
503
506
  }
504
- function Ni(t) {
507
+ function Ki(t) {
505
508
  let e = {
506
509
  velocity: x.velocity,
507
510
  stiffness: x.stiffness,
@@ -510,9 +513,9 @@ function Ni(t) {
510
513
  isResolvedFromDuration: !1,
511
514
  ...t
512
515
  };
513
- if (!je(t, ki) && je(t, Ei))
516
+ if (!_e(t, Bi) && _e(t, Li))
514
517
  if (t.visualDuration) {
515
- const n = t.visualDuration, s = 2 * Math.PI / (n * 1.2), i = s * s, r = 2 * z(0.05, 1, 1 - (t.bounce || 0)) * Math.sqrt(i);
518
+ const n = t.visualDuration, s = 2 * Math.PI / (n * 1.2), i = s * s, r = 2 * Y(0.05, 1, 1 - (t.bounce || 0)) * Math.sqrt(i);
516
519
  e = {
517
520
  ...e,
518
521
  mass: x.mass,
@@ -520,7 +523,7 @@ function Ni(t) {
520
523
  damping: r
521
524
  };
522
525
  } else {
523
- const n = Di(t);
526
+ const n = Ei(t);
524
527
  e = {
525
528
  ...e,
526
529
  ...n,
@@ -529,21 +532,21 @@ function Ni(t) {
529
532
  }
530
533
  return e;
531
534
  }
532
- function Ft(t = x.visualDuration, e = x.bounce) {
535
+ function Dt(t = x.visualDuration, e = x.bounce) {
533
536
  const n = typeof t != "object" ? {
534
537
  visualDuration: t,
535
538
  keyframes: [0, 1],
536
539
  bounce: e
537
540
  } : t;
538
541
  let { restSpeed: s, restDelta: i } = n;
539
- const r = n.keyframes[0], o = n.keyframes[n.keyframes.length - 1], a = { done: !1, value: r }, { stiffness: c, damping: l, mass: u, duration: d, velocity: f, isResolvedFromDuration: h } = Ni({
542
+ const r = n.keyframes[0], o = n.keyframes[n.keyframes.length - 1], a = { done: !1, value: r }, { stiffness: c, damping: l, mass: u, duration: f, velocity: d, isResolvedFromDuration: h } = Ki({
540
543
  ...n,
541
- velocity: -/* @__PURE__ */ K(n.velocity || 0)
542
- }), y = f || 0, b = l / (2 * Math.sqrt(c * u)), v = o - r, p = /* @__PURE__ */ K(Math.sqrt(c / u)), S = Math.abs(v) < 5;
544
+ velocity: -/* @__PURE__ */ W(n.velocity || 0)
545
+ }), y = d || 0, b = l / (2 * Math.sqrt(c * u)), v = o - r, p = /* @__PURE__ */ W(Math.sqrt(c / u)), S = Math.abs(v) < 5;
543
546
  s || (s = S ? x.restSpeed.granular : x.restSpeed.default), i || (i = S ? x.restDelta.granular : x.restDelta.default);
544
547
  let m;
545
548
  if (b < 1) {
546
- const T = Xt(p, b);
549
+ const T = Zt(p, b);
547
550
  m = (V) => {
548
551
  const M = Math.exp(-b * p * V);
549
552
  return o - M * ((y + b * p * v) / T * Math.sin(T * V) + v * Math.cos(T * V));
@@ -558,21 +561,21 @@ function Ft(t = x.visualDuration, e = x.bounce) {
558
561
  };
559
562
  }
560
563
  const A = {
561
- calculatedDuration: h && d || null,
564
+ calculatedDuration: h && f || null,
562
565
  next: (T) => {
563
566
  const V = m(T);
564
567
  if (h)
565
- a.done = T >= d;
568
+ a.done = T >= f;
566
569
  else {
567
570
  let M = T === 0 ? y : 0;
568
- b < 1 && (M = T === 0 ? /* @__PURE__ */ L(y) : jn(m, T, V));
569
- const w = Math.abs(M) <= s, F = Math.abs(o - V) <= i;
570
- a.done = w && F;
571
+ b < 1 && (M = T === 0 ? /* @__PURE__ */ L(y) : _n(m, T, V));
572
+ const w = Math.abs(M) <= s, O = Math.abs(o - V) <= i;
573
+ a.done = w && O;
571
574
  }
572
575
  return a.value = a.done ? o : V, a;
573
576
  },
574
577
  toString: () => {
575
- const T = Math.min(be(A), Pt), V = $n((M) => A.next(T * M).value, T, 30);
578
+ const T = Math.min(we(A), Ot), V = Gn((M) => A.next(T * M).value, T, 30);
576
579
  return T + "ms " + V;
577
580
  },
578
581
  toTransition: () => {
@@ -580,27 +583,27 @@ function Ft(t = x.visualDuration, e = x.bounce) {
580
583
  };
581
584
  return A;
582
585
  }
583
- Ft.applyToOptions = (t) => {
584
- const e = Fi(t, 100, Ft);
586
+ Dt.applyToOptions = (t) => {
587
+ const e = Ii(t, 100, Dt);
585
588
  return t.ease = e.ease, t.duration = /* @__PURE__ */ L(e.duration), t.type = "keyframes", t;
586
589
  };
587
- function qt({ keyframes: t, velocity: e = 0, power: n = 0.8, timeConstant: s = 325, bounceDamping: i = 10, bounceStiffness: r = 500, modifyTarget: o, min: a, max: c, restDelta: l = 0.5, restSpeed: u }) {
588
- const d = t[0], f = {
590
+ function Jt({ keyframes: t, velocity: e = 0, power: n = 0.8, timeConstant: s = 325, bounceDamping: i = 10, bounceStiffness: r = 500, modifyTarget: o, min: a, max: c, restDelta: l = 0.5, restSpeed: u }) {
591
+ const f = t[0], d = {
589
592
  done: !1,
590
- value: d
593
+ value: f
591
594
  }, h = (w) => a !== void 0 && w < a || c !== void 0 && w > c, y = (w) => a === void 0 ? c : c === void 0 || Math.abs(a - w) < Math.abs(c - w) ? a : c;
592
595
  let b = n * e;
593
- const v = d + b, p = o === void 0 ? v : o(v);
594
- p !== v && (b = p - d);
596
+ const v = f + b, p = o === void 0 ? v : o(v);
597
+ p !== v && (b = p - f);
595
598
  const S = (w) => -b * Math.exp(-w / s), m = (w) => p + S(w), A = (w) => {
596
- const F = S(w), D = m(w);
597
- f.done = Math.abs(F) <= l, f.value = f.done ? p : D;
599
+ const O = S(w), D = m(w);
600
+ d.done = Math.abs(O) <= l, d.value = d.done ? p : D;
598
601
  };
599
602
  let T, V;
600
603
  const M = (w) => {
601
- h(f.value) && (T = w, V = Ft({
602
- keyframes: [f.value, y(f.value)],
603
- velocity: jn(m, w, f.value),
604
+ h(d.value) && (T = w, V = Dt({
605
+ keyframes: [d.value, y(d.value)],
606
+ velocity: _n(m, w, d.value),
604
607
  // TODO: This should be passing * 1000
605
608
  damping: i,
606
609
  stiffness: r,
@@ -611,93 +614,93 @@ function qt({ keyframes: t, velocity: e = 0, power: n = 0.8, timeConstant: s = 3
611
614
  return M(0), {
612
615
  calculatedDuration: null,
613
616
  next: (w) => {
614
- let F = !1;
615
- return !V && T === void 0 && (F = !0, A(w), M(w)), T !== void 0 && w >= T ? V.next(w - T) : (!F && A(w), f);
617
+ let O = !1;
618
+ return !V && T === void 0 && (O = !0, A(w), M(w)), T !== void 0 && w >= T ? V.next(w - T) : (!O && A(w), d);
616
619
  }
617
620
  };
618
621
  }
619
- function Li(t, e, n) {
620
- const s = [], i = n || W.mix || Wn, r = t.length - 1;
622
+ function Wi(t, e, n) {
623
+ const s = [], i = n || $.mix || jn, r = t.length - 1;
621
624
  for (let o = 0; o < r; o++) {
622
625
  let a = i(t[o], t[o + 1]);
623
626
  if (e) {
624
- const c = Array.isArray(e) ? e[o] || tt : e;
625
- a = Rt(c, a);
627
+ const c = Array.isArray(e) ? e[o] || it : e;
628
+ a = kt(c, a);
626
629
  }
627
630
  s.push(a);
628
631
  }
629
632
  return s;
630
633
  }
631
- function Bi(t, e, { clamp: n = !0, ease: s, mixer: i } = {}) {
634
+ function $i(t, e, { clamp: n = !0, ease: s, mixer: i } = {}) {
632
635
  const r = t.length;
633
- if (Y(r === e.length, "Both input and output ranges must be the same length"), r === 1)
636
+ if (X(r === e.length, "Both input and output ranges must be the same length", "range-length"), r === 1)
634
637
  return () => e[0];
635
638
  if (r === 2 && e[0] === e[1])
636
639
  return () => e[1];
637
640
  const o = t[0] === t[1];
638
641
  t[0] > t[r - 1] && (t = [...t].reverse(), e = [...e].reverse());
639
- const a = Li(e, s, i), c = a.length, l = (u) => {
642
+ const a = Wi(e, s, i), c = a.length, l = (u) => {
640
643
  if (o && u < t[0])
641
644
  return e[0];
642
- let d = 0;
645
+ let f = 0;
643
646
  if (c > 1)
644
- for (; d < t.length - 2 && !(u < t[d + 1]); d++)
647
+ for (; f < t.length - 2 && !(u < t[f + 1]); f++)
645
648
  ;
646
- const f = /* @__PURE__ */ bn(t[d], t[d + 1], u);
647
- return a[d](f);
649
+ const d = /* @__PURE__ */ vn(t[f], t[f + 1], u);
650
+ return a[f](d);
648
651
  };
649
- return n ? (u) => l(z(t[0], t[r - 1], u)) : l;
652
+ return n ? (u) => l(Y(t[0], t[r - 1], u)) : l;
650
653
  }
651
- function Ki(t, e) {
654
+ function ji(t, e) {
652
655
  const n = t[t.length - 1];
653
656
  for (let s = 1; s <= e; s++) {
654
- const i = /* @__PURE__ */ bn(0, e, s);
655
- t.push(Et(n, 1, i));
657
+ const i = /* @__PURE__ */ vn(0, e, s);
658
+ t.push(Nt(n, 1, i));
656
659
  }
657
660
  }
658
- function Wi(t) {
661
+ function Gi(t) {
659
662
  const e = [0];
660
- return Ki(e, t.length - 1), e;
663
+ return ji(e, t.length - 1), e;
661
664
  }
662
- function $i(t, e) {
665
+ function _i(t, e) {
663
666
  return t.map((n) => n * e);
664
667
  }
665
- function ji(t, e) {
666
- return t.map(() => e || Fn).splice(0, t.length - 1);
668
+ function Hi(t, e) {
669
+ return t.map(() => e || Dn).splice(0, t.length - 1);
667
670
  }
668
- function q({ duration: t = 300, keyframes: e, times: n, ease: s = "easeInOut" }) {
669
- const i = ti(s) ? s.map(Le) : Le(s), r = {
671
+ function J({ duration: t = 300, keyframes: e, times: n, ease: s = "easeInOut" }) {
672
+ const i = si(s) ? s.map(Ke) : Ke(s), r = {
670
673
  done: !1,
671
674
  value: e[0]
672
- }, o = $i(
675
+ }, o = _i(
673
676
  // Only use the provided offsets if they're the correct length
674
677
  // TODO Maybe we should warn here if there's a length mismatch
675
- n && n.length === e.length ? n : Wi(e),
678
+ n && n.length === e.length ? n : Gi(e),
676
679
  t
677
- ), a = Bi(o, e, {
678
- ease: Array.isArray(i) ? i : ji(e, i)
680
+ ), a = $i(o, e, {
681
+ ease: Array.isArray(i) ? i : Hi(e, i)
679
682
  });
680
683
  return {
681
684
  calculatedDuration: t,
682
685
  next: (c) => (r.value = a(c), r.done = c >= t, r)
683
686
  };
684
687
  }
685
- const _i = (t) => t !== null;
686
- function Te(t, { repeat: e, repeatType: n = "loop" }, s, i = 1) {
687
- const r = t.filter(_i), a = i < 0 || e && n !== "loop" && e % 2 === 1 ? 0 : r.length - 1;
688
+ const Ui = (t) => t !== null;
689
+ function Se(t, { repeat: e, repeatType: n = "loop" }, s, i = 1) {
690
+ const r = t.filter(Ui), a = i < 0 || e && n !== "loop" && e % 2 === 1 ? 0 : r.length - 1;
688
691
  return !a || s === void 0 ? r[a] : s;
689
692
  }
690
- const Gi = {
691
- decay: qt,
692
- inertia: qt,
693
- tween: q,
694
- keyframes: q,
695
- spring: Ft
693
+ const zi = {
694
+ decay: Jt,
695
+ inertia: Jt,
696
+ tween: J,
697
+ keyframes: J,
698
+ spring: Dt
696
699
  };
697
- function _n(t) {
698
- typeof t.type == "string" && (t.type = Gi[t.type]);
700
+ function Hn(t) {
701
+ typeof t.type == "string" && (t.type = zi[t.type]);
699
702
  }
700
- class ve {
703
+ class Ve {
701
704
  constructor() {
702
705
  this.updateFinished();
703
706
  }
@@ -721,8 +724,8 @@ class ve {
721
724
  return this.finished.then(e, n);
722
725
  }
723
726
  }
724
- const Ui = (t) => t / 100;
725
- class we extends ve {
727
+ const Yi = (t) => t / 100;
728
+ class Ae extends Ve {
726
729
  constructor(e) {
727
730
  super(), this.state = "idle", this.startTime = null, this.isStopped = !1, this.currentTime = 0, this.holdTime = null, this.playbackSpeed = 1, this.stop = () => {
728
731
  var s, i;
@@ -732,17 +735,17 @@ class we extends ve {
732
735
  }
733
736
  initAnimation() {
734
737
  const { options: e } = this;
735
- _n(e);
736
- const { type: n = q, repeat: s = 0, repeatDelay: i = 0, repeatType: r, velocity: o = 0 } = e;
738
+ Hn(e);
739
+ const { type: n = J, repeat: s = 0, repeatDelay: i = 0, repeatType: r, velocity: o = 0 } = e;
737
740
  let { keyframes: a } = e;
738
- const c = n || q;
739
- process.env.NODE_ENV !== "production" && c !== q && Y(a.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${a}`), c !== q && typeof a[0] != "number" && (this.mixKeyframes = Rt(Ui, Wn(a[0], a[1])), a = [0, 100]);
741
+ const c = n || J;
742
+ process.env.NODE_ENV !== "production" && c !== J && X(a.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${a}`, "spring-two-frames"), c !== J && typeof a[0] != "number" && (this.mixKeyframes = kt(Yi, jn(a[0], a[1])), a = [0, 100]);
740
743
  const l = c({ ...e, keyframes: a });
741
744
  r === "mirror" && (this.mirroredGenerator = c({
742
745
  ...e,
743
746
  keyframes: [...a].reverse(),
744
747
  velocity: -o
745
- })), l.calculatedDuration === null && (l.calculatedDuration = be(l));
748
+ })), l.calculatedDuration === null && (l.calculatedDuration = we(l));
746
749
  const { calculatedDuration: u } = l;
747
750
  this.calculatedDuration = u, this.resolvedDuration = u + i, this.totalDuration = this.resolvedDuration * (s + 1) - i, this.generator = l;
748
751
  }
@@ -754,22 +757,22 @@ class we extends ve {
754
757
  const { generator: s, totalDuration: i, mixKeyframes: r, mirroredGenerator: o, resolvedDuration: a, calculatedDuration: c } = this;
755
758
  if (this.startTime === null)
756
759
  return s.next(0);
757
- const { delay: l = 0, keyframes: u, repeat: d, repeatType: f, repeatDelay: h, type: y, onUpdate: b, finalKeyframe: v } = this.options;
760
+ const { delay: l = 0, keyframes: u, repeat: f, repeatType: d, repeatDelay: h, type: y, onUpdate: b, finalKeyframe: v } = this.options;
758
761
  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);
759
762
  const p = this.currentTime - l * (this.playbackSpeed >= 0 ? 1 : -1), S = this.playbackSpeed >= 0 ? p < 0 : p > i;
760
763
  this.currentTime = Math.max(p, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = i);
761
764
  let m = this.currentTime, A = s;
762
- if (d) {
765
+ if (f) {
763
766
  const w = Math.min(this.currentTime, i) / a;
764
- let F = Math.floor(w), D = w % 1;
765
- !D && w >= 1 && (D = 1), D === 1 && F--, F = Math.min(F, d + 1), !!(F % 2) && (f === "reverse" ? (D = 1 - D, h && (D -= h / a)) : f === "mirror" && (A = o)), m = z(0, 1, D) * a;
767
+ let O = Math.floor(w), D = w % 1;
768
+ !D && w >= 1 && (D = 1), D === 1 && O--, O = Math.min(O, f + 1), !!(O % 2) && (d === "reverse" ? (D = 1 - D, h && (D -= h / a)) : d === "mirror" && (A = o)), m = Y(0, 1, D) * a;
766
769
  }
767
770
  const T = S ? { done: !1, value: u[0] } : A.next(m);
768
771
  r && (T.value = r(T.value));
769
772
  let { done: V } = T;
770
773
  !S && c !== null && (V = this.playbackSpeed >= 0 ? this.currentTime >= i : this.currentTime <= 0);
771
774
  const M = this.holdTime === null && (this.state === "finished" || this.state === "running" && V);
772
- return M && y !== qt && (T.value = Te(u, this.options, v, this.speed)), b && b(T.value), M && this.finish(), T;
775
+ return M && y !== Jt && (T.value = Se(u, this.options, v, this.speed)), b && b(T.value), M && this.finish(), T;
773
776
  }
774
777
  /**
775
778
  * Allows the returned animation to be awaited or promise-chained. Currently
@@ -780,10 +783,10 @@ class we extends ve {
780
783
  return this.finished.then(e, n);
781
784
  }
782
785
  get duration() {
783
- return /* @__PURE__ */ K(this.calculatedDuration);
786
+ return /* @__PURE__ */ W(this.calculatedDuration);
784
787
  }
785
788
  get time() {
786
- return /* @__PURE__ */ K(this.currentTime);
789
+ return /* @__PURE__ */ W(this.currentTime);
787
790
  }
788
791
  set time(e) {
789
792
  var n;
@@ -795,13 +798,13 @@ class we extends ve {
795
798
  set speed(e) {
796
799
  this.updateTime(E.now());
797
800
  const n = this.playbackSpeed !== e;
798
- this.playbackSpeed = e, n && (this.time = /* @__PURE__ */ K(this.currentTime));
801
+ this.playbackSpeed = e, n && (this.time = /* @__PURE__ */ W(this.currentTime));
799
802
  }
800
803
  play() {
801
804
  var i, r;
802
805
  if (this.isStopped)
803
806
  return;
804
- const { driver: e = Pi, startTime: n } = this.options;
807
+ const { driver: e = Di, startTime: n } = this.options;
805
808
  this.driver || (this.driver = e((o) => this.tick(o))), (r = (i = this.options).onPlay) == null || r.call(i);
806
809
  const s = this.driver.now();
807
810
  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();
@@ -834,14 +837,14 @@ class we extends ve {
834
837
  return this.options.allowFlatten && (this.options.type = "keyframes", this.options.ease = "linear", this.initAnimation()), (n = this.driver) == null || n.stop(), e.observe(this);
835
838
  }
836
839
  }
837
- function Hi(t) {
840
+ function Xi(t) {
838
841
  for (let e = 1; e < t.length; e++)
839
842
  t[e] ?? (t[e] = t[e - 1]);
840
843
  }
841
- const G = (t) => t * 180 / Math.PI, Zt = (t) => {
842
- const e = G(Math.atan2(t[1], t[0]));
843
- return Jt(e);
844
- }, zi = {
844
+ const H = (t) => t * 180 / Math.PI, Qt = (t) => {
845
+ const e = H(Math.atan2(t[1], t[0]));
846
+ return te(e);
847
+ }, qi = {
845
848
  x: 4,
846
849
  y: 5,
847
850
  translateX: 4,
@@ -849,56 +852,56 @@ const G = (t) => t * 180 / Math.PI, Zt = (t) => {
849
852
  scaleX: 0,
850
853
  scaleY: 3,
851
854
  scale: (t) => (Math.abs(t[0]) + Math.abs(t[3])) / 2,
852
- rotate: Zt,
853
- rotateZ: Zt,
854
- skewX: (t) => G(Math.atan(t[1])),
855
- skewY: (t) => G(Math.atan(t[2])),
855
+ rotate: Qt,
856
+ rotateZ: Qt,
857
+ skewX: (t) => H(Math.atan(t[1])),
858
+ skewY: (t) => H(Math.atan(t[2])),
856
859
  skew: (t) => (Math.abs(t[1]) + Math.abs(t[2])) / 2
857
- }, Jt = (t) => (t = t % 360, t < 0 && (t += 360), t), _e = Zt, Ge = (t) => Math.sqrt(t[0] * t[0] + t[1] * t[1]), Ue = (t) => Math.sqrt(t[4] * t[4] + t[5] * t[5]), Yi = {
860
+ }, te = (t) => (t = t % 360, t < 0 && (t += 360), t), He = Qt, Ue = (t) => Math.sqrt(t[0] * t[0] + t[1] * t[1]), ze = (t) => Math.sqrt(t[4] * t[4] + t[5] * t[5]), Zi = {
858
861
  x: 12,
859
862
  y: 13,
860
863
  z: 14,
861
864
  translateX: 12,
862
865
  translateY: 13,
863
866
  translateZ: 14,
864
- scaleX: Ge,
865
- scaleY: Ue,
866
- scale: (t) => (Ge(t) + Ue(t)) / 2,
867
- rotateX: (t) => Jt(G(Math.atan2(t[6], t[5]))),
868
- rotateY: (t) => Jt(G(Math.atan2(-t[2], t[0]))),
869
- rotateZ: _e,
870
- rotate: _e,
871
- skewX: (t) => G(Math.atan(t[4])),
872
- skewY: (t) => G(Math.atan(t[1])),
867
+ scaleX: Ue,
868
+ scaleY: ze,
869
+ scale: (t) => (Ue(t) + ze(t)) / 2,
870
+ rotateX: (t) => te(H(Math.atan2(t[6], t[5]))),
871
+ rotateY: (t) => te(H(Math.atan2(-t[2], t[0]))),
872
+ rotateZ: He,
873
+ rotate: He,
874
+ skewX: (t) => H(Math.atan(t[4])),
875
+ skewY: (t) => H(Math.atan(t[1])),
873
876
  skew: (t) => (Math.abs(t[1]) + Math.abs(t[4])) / 2
874
877
  };
875
- function Qt(t) {
878
+ function ee(t) {
876
879
  return t.includes("scale") ? 1 : 0;
877
880
  }
878
- function te(t, e) {
881
+ function ne(t, e) {
879
882
  if (!t || t === "none")
880
- return Qt(e);
883
+ return ee(e);
881
884
  const n = t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);
882
885
  let s, i;
883
886
  if (n)
884
- s = Yi, i = n;
887
+ s = Zi, i = n;
885
888
  else {
886
889
  const a = t.match(/^matrix\(([-\d.e\s,]+)\)$/u);
887
- s = zi, i = a;
890
+ s = qi, i = a;
888
891
  }
889
892
  if (!i)
890
- return Qt(e);
891
- const r = s[e], o = i[1].split(",").map(qi);
893
+ return ee(e);
894
+ const r = s[e], o = i[1].split(",").map(Qi);
892
895
  return typeof r == "function" ? r(o) : o[r];
893
896
  }
894
- const Xi = (t, e) => {
897
+ const Ji = (t, e) => {
895
898
  const { transform: n = "none" } = getComputedStyle(t);
896
- return te(n, e);
899
+ return ne(n, e);
897
900
  };
898
- function qi(t) {
901
+ function Qi(t) {
899
902
  return parseFloat(t.trim());
900
903
  }
901
- const st = [
904
+ const at = [
902
905
  "transformPerspective",
903
906
  "x",
904
907
  "y",
@@ -916,10 +919,10 @@ const st = [
916
919
  "skew",
917
920
  "skewX",
918
921
  "skewY"
919
- ], it = new Set(st), He = (t) => t === et || t === g, Zi = /* @__PURE__ */ new Set(["x", "y", "z"]), Ji = st.filter((t) => !Zi.has(t));
920
- function Qi(t) {
922
+ ], ut = new Set(at), Ye = (t) => t === rt || t === g, tr = /* @__PURE__ */ new Set(["x", "y", "z"]), er = at.filter((t) => !tr.has(t));
923
+ function nr(t) {
921
924
  const e = [];
922
- return Ji.forEach((n) => {
925
+ return er.forEach((n) => {
923
926
  const s = t.getValue(n);
924
927
  s !== void 0 && (e.push([n, s.get()]), s.set(n.startsWith("scale") ? 1 : 0));
925
928
  }), e;
@@ -933,18 +936,18 @@ const U = {
933
936
  bottom: ({ y: t }, { top: e }) => parseFloat(e) + (t.max - t.min),
934
937
  right: ({ x: t }, { left: e }) => parseFloat(e) + (t.max - t.min),
935
938
  // Transform
936
- x: (t, { transform: e }) => te(e, "x"),
937
- y: (t, { transform: e }) => te(e, "y")
939
+ x: (t, { transform: e }) => ne(e, "x"),
940
+ y: (t, { transform: e }) => ne(e, "y")
938
941
  };
939
942
  U.translateX = U.x;
940
943
  U.translateY = U.y;
941
- const H = /* @__PURE__ */ new Set();
942
- let ee = !1, ne = !1, se = !1;
943
- function Gn() {
944
- if (ne) {
945
- const t = Array.from(H).filter((s) => s.needsMeasurement), e = new Set(t.map((s) => s.element)), n = /* @__PURE__ */ new Map();
944
+ const z = /* @__PURE__ */ new Set();
945
+ let se = !1, ie = !1, re = !1;
946
+ function Un() {
947
+ if (ie) {
948
+ const t = Array.from(z).filter((s) => s.needsMeasurement), e = new Set(t.map((s) => s.element)), n = /* @__PURE__ */ new Map();
946
949
  e.forEach((s) => {
947
- const i = Qi(s);
950
+ const i = nr(s);
948
951
  i.length && (n.set(s, i), s.render());
949
952
  }), t.forEach((s) => s.measureInitialState()), e.forEach((s) => {
950
953
  s.render();
@@ -957,22 +960,22 @@ function Gn() {
957
960
  s.suspendedScrollY !== void 0 && window.scrollTo(0, s.suspendedScrollY);
958
961
  });
959
962
  }
960
- ne = !1, ee = !1, H.forEach((t) => t.complete(se)), H.clear();
963
+ ie = !1, se = !1, z.forEach((t) => t.complete(re)), z.clear();
961
964
  }
962
- function Un() {
963
- H.forEach((t) => {
964
- t.readKeyframes(), t.needsMeasurement && (ne = !0);
965
+ function zn() {
966
+ z.forEach((t) => {
967
+ t.readKeyframes(), t.needsMeasurement && (ie = !0);
965
968
  });
966
969
  }
967
- function tr() {
968
- se = !0, Un(), Gn(), se = !1;
970
+ function sr() {
971
+ re = !0, zn(), Un(), re = !1;
969
972
  }
970
- class Se {
973
+ class xe {
971
974
  constructor(e, n, s, i, r, o = !1) {
972
975
  this.state = "pending", this.isAsync = !1, this.needsMeasurement = !1, this.unresolvedKeyframes = [...e], this.onComplete = n, this.name = s, this.motionValue = i, this.element = r, this.isAsync = o;
973
976
  }
974
977
  scheduleResolve() {
975
- this.state = "scheduled", this.isAsync ? (H.add(this), ee || (ee = !0, N.read(Un), N.resolveKeyframes(Gn))) : (this.readKeyframes(), this.complete());
978
+ this.state = "scheduled", this.isAsync ? (z.add(this), se || (se = !0, N.read(zn), N.resolveKeyframes(Un))) : (this.readKeyframes(), this.complete());
976
979
  }
977
980
  readKeyframes() {
978
981
  const { unresolvedKeyframes: e, name: n, element: s, motionValue: i } = this;
@@ -986,7 +989,7 @@ class Se {
986
989
  }
987
990
  e[0] === void 0 && (e[0] = o), i && r === void 0 && i.set(e[0]);
988
991
  }
989
- Hi(e);
992
+ Xi(e);
990
993
  }
991
994
  setFinalKeyframe() {
992
995
  }
@@ -997,80 +1000,80 @@ class Se {
997
1000
  measureEndState() {
998
1001
  }
999
1002
  complete(e = !1) {
1000
- this.state = "complete", this.onComplete(this.unresolvedKeyframes, this.finalKeyframe, e), H.delete(this);
1003
+ this.state = "complete", this.onComplete(this.unresolvedKeyframes, this.finalKeyframe, e), z.delete(this);
1001
1004
  }
1002
1005
  cancel() {
1003
- this.state === "scheduled" && (H.delete(this), this.state = "pending");
1006
+ this.state === "scheduled" && (z.delete(this), this.state = "pending");
1004
1007
  }
1005
1008
  resume() {
1006
1009
  this.state === "pending" && this.scheduleResolve();
1007
1010
  }
1008
1011
  }
1009
- const er = (t) => t.startsWith("--");
1010
- function nr(t, e, n) {
1011
- er(e) ? t.style.setProperty(e, n) : t.style[e] = n;
1012
+ const ir = (t) => t.startsWith("--");
1013
+ function rr(t, e, n) {
1014
+ ir(e) ? t.style.setProperty(e, n) : t.style[e] = n;
1012
1015
  }
1013
- const sr = /* @__PURE__ */ fe(() => window.ScrollTimeline !== void 0), ir = {};
1014
- function rr(t, e) {
1015
- const n = /* @__PURE__ */ fe(t);
1016
- return () => ir[e] ?? n();
1016
+ const or = /* @__PURE__ */ pe(() => window.ScrollTimeline !== void 0), ar = {};
1017
+ function ur(t, e) {
1018
+ const n = /* @__PURE__ */ pe(t);
1019
+ return () => ar[e] ?? n();
1017
1020
  }
1018
- const Hn = /* @__PURE__ */ rr(() => {
1021
+ const Yn = /* @__PURE__ */ ur(() => {
1019
1022
  try {
1020
1023
  document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
1021
1024
  } catch {
1022
1025
  return !1;
1023
1026
  }
1024
1027
  return !0;
1025
- }, "linearEasing"), at = ([t, e, n, s]) => `cubic-bezier(${t}, ${e}, ${n}, ${s})`, ze = {
1028
+ }, "linearEasing"), ft = ([t, e, n, s]) => `cubic-bezier(${t}, ${e}, ${n}, ${s})`, Xe = {
1026
1029
  linear: "linear",
1027
1030
  ease: "ease",
1028
1031
  easeIn: "ease-in",
1029
1032
  easeOut: "ease-out",
1030
1033
  easeInOut: "ease-in-out",
1031
- circIn: /* @__PURE__ */ at([0, 0.65, 0.55, 1]),
1032
- circOut: /* @__PURE__ */ at([0.55, 0, 1, 0.45]),
1033
- backIn: /* @__PURE__ */ at([0.31, 0.01, 0.66, -0.59]),
1034
- backOut: /* @__PURE__ */ at([0.33, 1.53, 0.69, 0.99])
1034
+ circIn: /* @__PURE__ */ ft([0, 0.65, 0.55, 1]),
1035
+ circOut: /* @__PURE__ */ ft([0.55, 0, 1, 0.45]),
1036
+ backIn: /* @__PURE__ */ ft([0.31, 0.01, 0.66, -0.59]),
1037
+ backOut: /* @__PURE__ */ ft([0.33, 1.53, 0.69, 0.99])
1035
1038
  };
1036
- function zn(t, e) {
1039
+ function Xn(t, e) {
1037
1040
  if (t)
1038
- return typeof t == "function" ? Hn() ? $n(t, e) : "ease-out" : On(t) ? at(t) : Array.isArray(t) ? t.map((n) => zn(n, e) || ze.easeOut) : ze[t];
1041
+ return typeof t == "function" ? Yn() ? Gn(t, e) : "ease-out" : In(t) ? ft(t) : Array.isArray(t) ? t.map((n) => Xn(n, e) || Xe.easeOut) : Xe[t];
1039
1042
  }
1040
- function or(t, e, n, { delay: s = 0, duration: i = 300, repeat: r = 0, repeatType: o = "loop", ease: a = "easeOut", times: c } = {}, l = void 0) {
1043
+ function cr(t, e, n, { delay: s = 0, duration: i = 300, repeat: r = 0, repeatType: o = "loop", ease: a = "easeOut", times: c } = {}, l = void 0) {
1041
1044
  const u = {
1042
1045
  [e]: n
1043
1046
  };
1044
1047
  c && (u.offset = c);
1045
- const d = zn(a, i);
1046
- Array.isArray(d) && (u.easing = d);
1047
- const f = {
1048
+ const f = Xn(a, i);
1049
+ Array.isArray(f) && (u.easing = f);
1050
+ const d = {
1048
1051
  delay: s,
1049
1052
  duration: i,
1050
- easing: Array.isArray(d) ? "linear" : d,
1053
+ easing: Array.isArray(f) ? "linear" : f,
1051
1054
  fill: "both",
1052
1055
  iterations: r + 1,
1053
1056
  direction: o === "reverse" ? "alternate" : "normal"
1054
1057
  };
1055
- return l && (f.pseudoElement = l), t.animate(u, f);
1058
+ return l && (d.pseudoElement = l), t.animate(u, d);
1056
1059
  }
1057
- function Yn(t) {
1060
+ function qn(t) {
1058
1061
  return typeof t == "function" && "applyToOptions" in t;
1059
1062
  }
1060
- function ar({ type: t, ...e }) {
1061
- return Yn(t) && Hn() ? t.applyToOptions(e) : (e.duration ?? (e.duration = 300), e.ease ?? (e.ease = "easeOut"), e);
1063
+ function lr({ type: t, ...e }) {
1064
+ return qn(t) && Yn() ? t.applyToOptions(e) : (e.duration ?? (e.duration = 300), e.ease ?? (e.ease = "easeOut"), e);
1062
1065
  }
1063
- class ur extends ve {
1066
+ class fr extends Ve {
1064
1067
  constructor(e) {
1065
1068
  if (super(), this.finishedTime = null, this.isStopped = !1, !e)
1066
1069
  return;
1067
1070
  const { element: n, name: s, keyframes: i, pseudoElement: r, allowFlatten: o = !1, finalKeyframe: a, onComplete: c } = e;
1068
- this.isPseudoElement = !!r, this.allowFlatten = o, this.options = e, Y(typeof e.type != "string", `animateMini doesn't support "type" as a string. Did you mean to import { spring } from "motion"?`);
1069
- const l = ar(e);
1070
- this.animation = or(n, s, i, l, r), l.autoplay === !1 && this.animation.pause(), this.animation.onfinish = () => {
1071
+ this.isPseudoElement = !!r, this.allowFlatten = o, this.options = e, X(typeof e.type != "string", `Mini animate() doesn't support "type" as a string.`, "mini-spring");
1072
+ const l = lr(e);
1073
+ this.animation = cr(n, s, i, l, r), l.autoplay === !1 && this.animation.pause(), this.animation.onfinish = () => {
1071
1074
  if (this.finishedTime = this.time, !r) {
1072
- const u = Te(i, this.options, a, this.speed);
1073
- this.updateMotionValue ? this.updateMotionValue(u) : nr(n, s, u), this.animation.cancel();
1075
+ const u = Se(i, this.options, a, this.speed);
1076
+ this.updateMotionValue ? this.updateMotionValue(u) : rr(n, s, u), this.animation.cancel();
1074
1077
  }
1075
1078
  c == null || c(), this.notifyFinished();
1076
1079
  };
@@ -1117,10 +1120,10 @@ class ur extends ve {
1117
1120
  get duration() {
1118
1121
  var n, s;
1119
1122
  const e = ((s = (n = this.animation.effect) == null ? void 0 : n.getComputedTiming) == null ? void 0 : s.call(n).duration) || 0;
1120
- return /* @__PURE__ */ K(Number(e));
1123
+ return /* @__PURE__ */ W(Number(e));
1121
1124
  }
1122
1125
  get time() {
1123
- return /* @__PURE__ */ K(Number(this.animation.currentTime) || 0);
1126
+ return /* @__PURE__ */ W(Number(this.animation.currentTime) || 0);
1124
1127
  }
1125
1128
  set time(e) {
1126
1129
  this.finishedTime = null, this.animation.currentTime = /* @__PURE__ */ L(e);
@@ -1149,24 +1152,24 @@ class ur extends ve {
1149
1152
  */
1150
1153
  attachTimeline({ timeline: e, observe: n }) {
1151
1154
  var s;
1152
- return this.allowFlatten && ((s = this.animation.effect) == null || s.updateTiming({ easing: "linear" })), this.animation.onfinish = null, e && sr() ? (this.animation.timeline = e, tt) : n(this);
1155
+ return this.allowFlatten && ((s = this.animation.effect) == null || s.updateTiming({ easing: "linear" })), this.animation.onfinish = null, e && or() ? (this.animation.timeline = e, it) : n(this);
1153
1156
  }
1154
1157
  }
1155
- const Xn = {
1156
- anticipate: Cn,
1157
- backInOut: Mn,
1158
- circInOut: Pn
1158
+ const Zn = {
1159
+ anticipate: Fn,
1160
+ backInOut: Pn,
1161
+ circInOut: On
1159
1162
  };
1160
- function cr(t) {
1161
- return t in Xn;
1163
+ function dr(t) {
1164
+ return t in Zn;
1162
1165
  }
1163
- function lr(t) {
1164
- typeof t.ease == "string" && cr(t.ease) && (t.ease = Xn[t.ease]);
1166
+ function hr(t) {
1167
+ typeof t.ease == "string" && dr(t.ease) && (t.ease = Zn[t.ease]);
1165
1168
  }
1166
- const Ye = 10;
1167
- class fr extends ur {
1169
+ const qe = 10;
1170
+ class pr extends fr {
1168
1171
  constructor(e) {
1169
- lr(e), _n(e), super(e), e.startTime && (this.startTime = e.startTime), this.options = e;
1172
+ hr(e), Hn(e), super(e), e.startTime && (this.startTime = e.startTime), this.options = e;
1170
1173
  }
1171
1174
  /**
1172
1175
  * WAAPI doesn't natively have any interruption capabilities.
@@ -1184,17 +1187,17 @@ class fr extends ur {
1184
1187
  n.set(e);
1185
1188
  return;
1186
1189
  }
1187
- const a = new we({
1190
+ const a = new Ae({
1188
1191
  ...o,
1189
1192
  autoplay: !1
1190
1193
  }), c = /* @__PURE__ */ L(this.finishedTime ?? this.time);
1191
- n.setWithVelocity(a.sample(c - Ye).value, a.sample(c).value, Ye), a.stop();
1194
+ n.setWithVelocity(a.sample(c - qe).value, a.sample(c).value, qe), a.stop();
1192
1195
  }
1193
1196
  }
1194
- const Xe = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string
1195
- (nt.test(t) || t === "0") && // And it contains numbers and/or colors
1197
+ const Ze = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string
1198
+ (ot.test(t) || t === "0") && // And it contains numbers and/or colors
1196
1199
  !t.startsWith("url("));
1197
- function dr(t) {
1200
+ function mr(t) {
1198
1201
  const e = t[0];
1199
1202
  if (t.length === 1)
1200
1203
  return !0;
@@ -1202,47 +1205,47 @@ function dr(t) {
1202
1205
  if (t[n] !== e)
1203
1206
  return !0;
1204
1207
  }
1205
- function hr(t, e, n, s) {
1208
+ function gr(t, e, n, s) {
1206
1209
  const i = t[0];
1207
1210
  if (i === null)
1208
1211
  return !1;
1209
1212
  if (e === "display" || e === "visibility")
1210
1213
  return !0;
1211
- const r = t[t.length - 1], o = Xe(i, e), a = Xe(r, e);
1212
- return mt(o === a, `You are trying to animate ${e} from "${i}" to "${r}". ${i} is not an animatable value - to enable this animation set ${i} to a value animatable to ${r} via the \`style\` property.`), !o || !a ? !1 : dr(t) || (n === "spring" || Yn(n)) && s;
1214
+ const r = t[t.length - 1], o = Ze(i, e), a = Ze(r, e);
1215
+ return yt(o === a, `You are trying to animate ${e} from "${i}" to "${r}". "${o ? r : i}" is not an animatable value.`, "value-not-animatable"), !o || !a ? !1 : mr(t) || (n === "spring" || qn(n)) && s;
1213
1216
  }
1214
- function qn(t) {
1215
- return Hs(t) && "offsetHeight" in t;
1217
+ function oe(t) {
1218
+ t.duration = 0, t.type;
1216
1219
  }
1217
- const pr = /* @__PURE__ */ new Set([
1220
+ const yr = /* @__PURE__ */ new Set([
1218
1221
  "opacity",
1219
1222
  "clipPath",
1220
1223
  "filter",
1221
1224
  "transform"
1222
1225
  // TODO: Could be re-enabled now we have support for linear() easing
1223
1226
  // "background-color"
1224
- ]), mr = /* @__PURE__ */ fe(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
1225
- function gr(t) {
1226
- var l;
1227
+ ]), br = /* @__PURE__ */ pe(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
1228
+ function Tr(t) {
1229
+ var u;
1227
1230
  const { motionValue: e, name: n, repeatDelay: s, repeatType: i, damping: r, type: o } = t;
1228
- if (!qn((l = e == null ? void 0 : e.owner) == null ? void 0 : l.current))
1231
+ if (!(((u = e == null ? void 0 : e.owner) == null ? void 0 : u.current) instanceof HTMLElement))
1229
1232
  return !1;
1230
- const { onUpdate: a, transformTemplate: c } = e.owner.getProps();
1231
- return mr() && n && pr.has(n) && (n !== "transform" || !c) && /**
1233
+ const { onUpdate: c, transformTemplate: l } = e.owner.getProps();
1234
+ return br() && n && yr.has(n) && (n !== "transform" || !l) && /**
1232
1235
  * If we're outputting values to onUpdate then we can't use WAAPI as there's
1233
1236
  * no way to read the value from WAAPI every frame.
1234
1237
  */
1235
- !a && !s && i !== "mirror" && r !== 0 && o !== "inertia";
1238
+ !c && !s && i !== "mirror" && r !== 0 && o !== "inertia";
1236
1239
  }
1237
- const yr = 40;
1238
- class br extends ve {
1239
- constructor({ autoplay: e = !0, delay: n = 0, type: s = "keyframes", repeat: i = 0, repeatDelay: r = 0, repeatType: o = "loop", keyframes: a, name: c, motionValue: l, element: u, ...d }) {
1240
+ const vr = 40;
1241
+ class wr extends Ve {
1242
+ constructor({ autoplay: e = !0, delay: n = 0, type: s = "keyframes", repeat: i = 0, repeatDelay: r = 0, repeatType: o = "loop", keyframes: a, name: c, motionValue: l, element: u, ...f }) {
1240
1243
  var y;
1241
1244
  super(), this.stop = () => {
1242
1245
  var b, v;
1243
1246
  this._animation && (this._animation.stop(), (b = this.stopTimeline) == null || b.call(this)), (v = this.keyframeResolver) == null || v.cancel();
1244
1247
  }, this.createdAt = E.now();
1245
- const f = {
1248
+ const d = {
1246
1249
  autoplay: e,
1247
1250
  delay: n,
1248
1251
  type: s,
@@ -1252,24 +1255,24 @@ class br extends ve {
1252
1255
  name: c,
1253
1256
  motionValue: l,
1254
1257
  element: u,
1255
- ...d
1256
- }, h = (u == null ? void 0 : u.KeyframeResolver) || Se;
1257
- this.keyframeResolver = new h(a, (b, v, p) => this.onKeyframesResolved(b, v, f, !p), c, l, u), (y = this.keyframeResolver) == null || y.scheduleResolve();
1258
+ ...f
1259
+ }, h = (u == null ? void 0 : u.KeyframeResolver) || xe;
1260
+ this.keyframeResolver = new h(a, (b, v, p) => this.onKeyframesResolved(b, v, d, !p), c, l, u), (y = this.keyframeResolver) == null || y.scheduleResolve();
1258
1261
  }
1259
1262
  onKeyframesResolved(e, n, s, i) {
1260
1263
  this.keyframeResolver = void 0;
1261
1264
  const { name: r, type: o, velocity: a, delay: c, isHandoff: l, onUpdate: u } = s;
1262
- this.resolvedAt = E.now(), hr(e, r, o, a) || ((W.instantAnimations || !c) && (u == null || u(Te(e, s, n))), e[0] = e[e.length - 1], s.duration = 0, s.repeat = 0);
1263
- const f = {
1264
- startTime: i ? this.resolvedAt ? this.resolvedAt - this.createdAt > yr ? this.resolvedAt : this.createdAt : this.createdAt : void 0,
1265
+ this.resolvedAt = E.now(), gr(e, r, o, a) || (($.instantAnimations || !c) && (u == null || u(Se(e, s, n))), e[0] = e[e.length - 1], oe(s), s.repeat = 0);
1266
+ const d = {
1267
+ startTime: i ? this.resolvedAt ? this.resolvedAt - this.createdAt > vr ? this.resolvedAt : this.createdAt : this.createdAt : void 0,
1265
1268
  finalKeyframe: n,
1266
1269
  ...s,
1267
1270
  keyframes: e
1268
- }, h = !l && gr(f) ? new fr({
1269
- ...f,
1270
- element: f.motionValue.owner.current
1271
- }) : new we(f);
1272
- h.finished.then(() => this.notifyFinished()).catch(tt), this.pendingTimeline && (this.stopTimeline = h.attachTimeline(this.pendingTimeline), this.pendingTimeline = void 0), this._animation = h;
1271
+ }, h = !l && Tr(d) ? new pr({
1272
+ ...d,
1273
+ element: d.motionValue.owner.current
1274
+ }) : new Ae(d);
1275
+ h.finished.then(() => this.notifyFinished()).catch(it), this.pendingTimeline && (this.stopTimeline = h.attachTimeline(this.pendingTimeline), this.pendingTimeline = void 0), this._animation = h;
1273
1276
  }
1274
1277
  get finished() {
1275
1278
  return this._animation ? this.animation.finished : this._finished;
@@ -1280,7 +1283,7 @@ class br extends ve {
1280
1283
  }
1281
1284
  get animation() {
1282
1285
  var e;
1283
- return this._animation || ((e = this.keyframeResolver) == null || e.resume(), tr()), this._animation;
1286
+ return this._animation || ((e = this.keyframeResolver) == null || e.resume(), sr()), this._animation;
1284
1287
  }
1285
1288
  get duration() {
1286
1289
  return this.animation.duration;
@@ -1320,81 +1323,81 @@ class br extends ve {
1320
1323
  this._animation && this.animation.cancel(), (e = this.keyframeResolver) == null || e.cancel();
1321
1324
  }
1322
1325
  }
1323
- const Tr = (
1326
+ const Sr = (
1324
1327
  // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words
1325
1328
  /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u
1326
1329
  );
1327
- function vr(t) {
1328
- const e = Tr.exec(t);
1330
+ function Vr(t) {
1331
+ const e = Sr.exec(t);
1329
1332
  if (!e)
1330
1333
  return [,];
1331
1334
  const [, n, s, i] = e;
1332
1335
  return [`--${n ?? s}`, i];
1333
1336
  }
1334
- const wr = 4;
1335
- function Zn(t, e, n = 1) {
1336
- Y(n <= wr, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);
1337
- const [s, i] = vr(t);
1337
+ const Ar = 4;
1338
+ function Jn(t, e, n = 1) {
1339
+ X(n <= Ar, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`, "max-css-var-depth");
1340
+ const [s, i] = Vr(t);
1338
1341
  if (!s)
1339
1342
  return;
1340
1343
  const r = window.getComputedStyle(e).getPropertyValue(s);
1341
1344
  if (r) {
1342
1345
  const o = r.trim();
1343
- return gn(o) ? parseFloat(o) : o;
1346
+ return bn(o) ? parseFloat(o) : o;
1344
1347
  }
1345
- return pe(i) ? Zn(i, e, n + 1) : i;
1348
+ return ye(i) ? Jn(i, e, n + 1) : i;
1346
1349
  }
1347
- function Jn(t, e) {
1350
+ function Qn(t, e) {
1348
1351
  return (t == null ? void 0 : t[e]) ?? (t == null ? void 0 : t.default) ?? t;
1349
1352
  }
1350
- const Qn = /* @__PURE__ */ new Set([
1353
+ const ts = /* @__PURE__ */ new Set([
1351
1354
  "width",
1352
1355
  "height",
1353
1356
  "top",
1354
1357
  "left",
1355
1358
  "right",
1356
1359
  "bottom",
1357
- ...st
1358
- ]), Sr = {
1360
+ ...at
1361
+ ]), xr = {
1359
1362
  test: (t) => t === "auto",
1360
1363
  parse: (t) => t
1361
- }, ts = (t) => (e) => e.test(t), es = [et, g, Z, $, di, fi, Sr], qe = (t) => es.find(ts(t));
1362
- function Vr(t) {
1363
- return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || yn(t) : !0;
1364
+ }, es = (t) => (e) => e.test(t), ns = [rt, g, Q, j, mi, pi, xr], Je = (t) => ns.find(es(t));
1365
+ function Mr(t) {
1366
+ return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || Tn(t) : !0;
1364
1367
  }
1365
- const Ar = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]);
1366
- function xr(t) {
1368
+ const Cr = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]);
1369
+ function Pr(t) {
1367
1370
  const [e, n] = t.slice(0, -1).split("(");
1368
1371
  if (e === "drop-shadow")
1369
1372
  return t;
1370
- const [s] = n.match(me) || [];
1373
+ const [s] = n.match(be) || [];
1371
1374
  if (!s)
1372
1375
  return t;
1373
1376
  const i = n.replace(s, "");
1374
- let r = Ar.has(e) ? 1 : 0;
1377
+ let r = Cr.has(e) ? 1 : 0;
1375
1378
  return s !== n && (r *= 100), e + "(" + r + i + ")";
1376
1379
  }
1377
- const Mr = /\b([a-z-]*)\(.*?\)/gu, ie = {
1378
- ...nt,
1380
+ const Fr = /\b([a-z-]*)\(.*?\)/gu, ae = {
1381
+ ...ot,
1379
1382
  getAnimatableNone: (t) => {
1380
- const e = t.match(Mr);
1381
- return e ? e.map(xr).join(" ") : t;
1383
+ const e = t.match(Fr);
1384
+ return e ? e.map(Pr).join(" ") : t;
1382
1385
  }
1383
- }, Ze = {
1384
- ...et,
1386
+ }, Qe = {
1387
+ ...rt,
1385
1388
  transform: Math.round
1386
- }, Cr = {
1387
- rotate: $,
1388
- rotateX: $,
1389
- rotateY: $,
1390
- rotateZ: $,
1391
- scale: Vt,
1392
- scaleX: Vt,
1393
- scaleY: Vt,
1394
- scaleZ: Vt,
1395
- skew: $,
1396
- skewX: $,
1397
- skewY: $,
1389
+ }, Or = {
1390
+ rotate: j,
1391
+ rotateX: j,
1392
+ rotateY: j,
1393
+ rotateZ: j,
1394
+ scale: xt,
1395
+ scaleX: xt,
1396
+ scaleY: xt,
1397
+ scaleZ: xt,
1398
+ skew: j,
1399
+ skewX: j,
1400
+ skewY: j,
1398
1401
  distance: g,
1399
1402
  translateX: g,
1400
1403
  translateY: g,
@@ -1404,11 +1407,11 @@ const Mr = /\b([a-z-]*)\(.*?\)/gu, ie = {
1404
1407
  z: g,
1405
1408
  perspective: g,
1406
1409
  transformPerspective: g,
1407
- opacity: ft,
1408
- originX: Be,
1409
- originY: Be,
1410
+ opacity: pt,
1411
+ originX: We,
1412
+ originY: We,
1410
1413
  originZ: g
1411
- }, Ve = {
1414
+ }, Me = {
1412
1415
  // Border props
1413
1416
  borderWidth: g,
1414
1417
  borderTopWidth: g,
@@ -1444,45 +1447,45 @@ const Mr = /\b([a-z-]*)\(.*?\)/gu, ie = {
1444
1447
  // Misc
1445
1448
  backgroundPositionX: g,
1446
1449
  backgroundPositionY: g,
1447
- ...Cr,
1448
- zIndex: Ze,
1450
+ ...Or,
1451
+ zIndex: Qe,
1449
1452
  // SVG
1450
- fillOpacity: ft,
1451
- strokeOpacity: ft,
1452
- numOctaves: Ze
1453
- }, Pr = {
1454
- ...Ve,
1453
+ fillOpacity: pt,
1454
+ strokeOpacity: pt,
1455
+ numOctaves: Qe
1456
+ }, Dr = {
1457
+ ...Me,
1455
1458
  // Color props
1456
- color: C,
1457
- backgroundColor: C,
1458
- outlineColor: C,
1459
- fill: C,
1460
- stroke: C,
1459
+ color: P,
1460
+ backgroundColor: P,
1461
+ outlineColor: P,
1462
+ fill: P,
1463
+ stroke: P,
1461
1464
  // Border props
1462
- borderColor: C,
1463
- borderTopColor: C,
1464
- borderRightColor: C,
1465
- borderBottomColor: C,
1466
- borderLeftColor: C,
1467
- filter: ie,
1468
- WebkitFilter: ie
1469
- }, ns = (t) => Pr[t];
1470
- function ss(t, e) {
1471
- let n = ns(t);
1472
- return n !== ie && (n = nt), n.getAnimatableNone ? n.getAnimatableNone(e) : void 0;
1473
- }
1474
- const Fr = /* @__PURE__ */ new Set(["auto", "none", "0"]);
1475
- function Or(t, e, n) {
1465
+ borderColor: P,
1466
+ borderTopColor: P,
1467
+ borderRightColor: P,
1468
+ borderBottomColor: P,
1469
+ borderLeftColor: P,
1470
+ filter: ae,
1471
+ WebkitFilter: ae
1472
+ }, ss = (t) => Dr[t];
1473
+ function is(t, e) {
1474
+ let n = ss(t);
1475
+ return n !== ae && (n = ot), n.getAnimatableNone ? n.getAnimatableNone(e) : void 0;
1476
+ }
1477
+ const Ir = /* @__PURE__ */ new Set(["auto", "none", "0"]);
1478
+ function Rr(t, e, n) {
1476
1479
  let s = 0, i;
1477
1480
  for (; s < t.length && !i; ) {
1478
1481
  const r = t[s];
1479
- typeof r == "string" && !Fr.has(r) && dt(r).values.length && (i = t[s]), s++;
1482
+ typeof r == "string" && !Ir.has(r) && mt(r).values.length && (i = t[s]), s++;
1480
1483
  }
1481
1484
  if (i && n)
1482
1485
  for (const r of e)
1483
- t[r] = ss(n, i);
1486
+ t[r] = is(n, i);
1484
1487
  }
1485
- class Dr extends Se {
1488
+ class Er extends xe {
1486
1489
  constructor(e, n, s, i, r) {
1487
1490
  super(e, n, s, i, r, !0);
1488
1491
  }
@@ -1493,16 +1496,16 @@ class Dr extends Se {
1493
1496
  super.readKeyframes();
1494
1497
  for (let c = 0; c < e.length; c++) {
1495
1498
  let l = e[c];
1496
- if (typeof l == "string" && (l = l.trim(), pe(l))) {
1497
- const u = Zn(l, n.current);
1499
+ if (typeof l == "string" && (l = l.trim(), ye(l))) {
1500
+ const u = Jn(l, n.current);
1498
1501
  u !== void 0 && (e[c] = u), c === e.length - 1 && (this.finalKeyframe = l);
1499
1502
  }
1500
1503
  }
1501
- if (this.resolveNoneKeyframes(), !Qn.has(s) || e.length !== 2)
1504
+ if (this.resolveNoneKeyframes(), !ts.has(s) || e.length !== 2)
1502
1505
  return;
1503
- const [i, r] = e, o = qe(i), a = qe(r);
1506
+ const [i, r] = e, o = Je(i), a = Je(r);
1504
1507
  if (o !== a)
1505
- if (He(o) && He(a))
1508
+ if (Ye(o) && Ye(a))
1506
1509
  for (let c = 0; c < e.length; c++) {
1507
1510
  const l = e[c];
1508
1511
  typeof l == "string" && (e[c] = parseFloat(l));
@@ -1512,8 +1515,8 @@ class Dr extends Se {
1512
1515
  resolveNoneKeyframes() {
1513
1516
  const { unresolvedKeyframes: e, name: n } = this, s = [];
1514
1517
  for (let i = 0; i < e.length; i++)
1515
- (e[i] === null || Vr(e[i])) && s.push(i);
1516
- s.length && Or(e, s, n);
1518
+ (e[i] === null || Mr(e[i])) && s.push(i);
1519
+ s.length && Rr(e, s, n);
1517
1520
  }
1518
1521
  measureInitialState() {
1519
1522
  const { element: e, unresolvedKeyframes: n, name: s } = this;
@@ -1536,7 +1539,7 @@ class Dr extends Se {
1536
1539
  }), this.resolveNoneKeyframes();
1537
1540
  }
1538
1541
  }
1539
- function Ir(t, e, n) {
1542
+ function kr(t, e, n) {
1540
1543
  if (t instanceof EventTarget)
1541
1544
  return [t];
1542
1545
  if (typeof t == "string") {
@@ -1546,8 +1549,12 @@ function Ir(t, e, n) {
1546
1549
  }
1547
1550
  return Array.from(t);
1548
1551
  }
1549
- const is = (t, e) => e && typeof t == "number" ? e.transform(t) : t, Je = 30, Rr = (t) => !isNaN(parseFloat(t));
1550
- class Er {
1552
+ const rs = (t, e) => e && typeof t == "number" ? e.transform(t) : t;
1553
+ function Nr(t) {
1554
+ return Xs(t) && "offsetHeight" in t;
1555
+ }
1556
+ const tn = 30, Lr = (t) => !isNaN(parseFloat(t));
1557
+ class Br {
1551
1558
  /**
1552
1559
  * @param init - The initiating value
1553
1560
  * @param config - Optional configuration options
@@ -1555,17 +1562,16 @@ class Er {
1555
1562
  * - `transformer`: A function to transform incoming values with.
1556
1563
  */
1557
1564
  constructor(e, n = {}) {
1558
- this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (s, i = !0) => {
1559
- var o, a;
1560
- const r = E.now();
1561
- if (this.updatedAt !== r && this.setPrevFrameValue(), this.prev = this.current, this.setCurrent(s), this.current !== this.prev && ((o = this.events.change) == null || o.notify(this.current), this.dependents))
1562
- for (const c of this.dependents)
1563
- c.dirty();
1564
- i && ((a = this.events.renderRequest) == null || a.notify(this.current));
1565
+ this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (s) => {
1566
+ var r;
1567
+ const i = E.now();
1568
+ if (this.updatedAt !== i && this.setPrevFrameValue(), this.prev = this.current, this.setCurrent(s), this.current !== this.prev && ((r = this.events.change) == null || r.notify(this.current), this.dependents))
1569
+ for (const o of this.dependents)
1570
+ o.dirty();
1565
1571
  }, this.hasAnimated = !1, this.setCurrent(e), this.owner = n.owner;
1566
1572
  }
1567
1573
  setCurrent(e) {
1568
- this.current = e, this.updatedAt = E.now(), this.canTrackVelocity === null && e !== void 0 && (this.canTrackVelocity = Rr(this.current));
1574
+ this.current = e, this.updatedAt = E.now(), this.canTrackVelocity === null && e !== void 0 && (this.canTrackVelocity = Lr(this.current));
1569
1575
  }
1570
1576
  setPrevFrameValue(e = this.current) {
1571
1577
  this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt;
@@ -1611,10 +1617,10 @@ class Er {
1611
1617
  * @deprecated
1612
1618
  */
1613
1619
  onChange(e) {
1614
- return process.env.NODE_ENV !== "production" && wn(!1, 'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'), this.on("change", e);
1620
+ return process.env.NODE_ENV !== "production" && Vn(!1, 'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'), this.on("change", e);
1615
1621
  }
1616
1622
  on(e, n) {
1617
- this.events[e] || (this.events[e] = new Tn());
1623
+ this.events[e] || (this.events[e] = new wn());
1618
1624
  const s = this.events[e].add(n);
1619
1625
  return e === "change" ? () => {
1620
1626
  s(), N.read(() => {
@@ -1647,8 +1653,8 @@ class Er {
1647
1653
  *
1648
1654
  * @public
1649
1655
  */
1650
- set(e, n = !0) {
1651
- !n || !this.passiveEffect ? this.updateAndNotify(e, n) : this.passiveEffect(e, this.updateAndNotify);
1656
+ set(e) {
1657
+ this.passiveEffect ? this.passiveEffect(e, this.updateAndNotify) : this.updateAndNotify(e);
1652
1658
  }
1653
1659
  setWithVelocity(e, n, s) {
1654
1660
  this.set(n), this.prev = void 0, this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt - s;
@@ -1695,10 +1701,10 @@ class Er {
1695
1701
  */
1696
1702
  getVelocity() {
1697
1703
  const e = E.now();
1698
- if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > Je)
1704
+ if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > tn)
1699
1705
  return 0;
1700
- const n = Math.min(this.updatedAt - this.prevUpdatedAt, Je);
1701
- return vn(parseFloat(this.current) - parseFloat(this.prevFrameValue), n);
1706
+ const n = Math.min(this.updatedAt - this.prevUpdatedAt, tn);
1707
+ return Sn(parseFloat(this.current) - parseFloat(this.prevFrameValue), n);
1702
1708
  }
1703
1709
  /**
1704
1710
  * Registers a new animation to control this `MotionValue`. Only one
@@ -1750,35 +1756,35 @@ class Er {
1750
1756
  (e = this.dependents) == null || e.clear(), (n = this.events.destroy) == null || n.notify(), this.clearListeners(), this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
1751
1757
  }
1752
1758
  }
1753
- function Ot(t, e) {
1754
- return new Er(t, e);
1759
+ function It(t, e) {
1760
+ return new Br(t, e);
1755
1761
  }
1756
- const { schedule: kr } = /* @__PURE__ */ Dn(queueMicrotask, !1), Nr = {
1762
+ const { schedule: Kr } = /* @__PURE__ */ Rn(queueMicrotask, !1), Wr = {
1757
1763
  y: !1
1758
1764
  };
1759
- function Lr() {
1760
- return Nr.y;
1765
+ function $r() {
1766
+ return Wr.y;
1761
1767
  }
1762
- function rs(t, e) {
1763
- const n = Ir(t), s = new AbortController(), i = {
1768
+ function os(t, e) {
1769
+ const n = kr(t), s = new AbortController(), i = {
1764
1770
  passive: !0,
1765
1771
  ...e,
1766
1772
  signal: s.signal
1767
1773
  };
1768
1774
  return [n, i, () => s.abort()];
1769
1775
  }
1770
- function Qe(t) {
1771
- return !(t.pointerType === "touch" || Lr());
1776
+ function en(t) {
1777
+ return !(t.pointerType === "touch" || $r());
1772
1778
  }
1773
- function Br(t, e, n = {}) {
1774
- const [s, i, r] = rs(t, n), o = (a) => {
1775
- if (!Qe(a))
1779
+ function jr(t, e, n = {}) {
1780
+ const [s, i, r] = os(t, n), o = (a) => {
1781
+ if (!en(a))
1776
1782
  return;
1777
1783
  const { target: c } = a, l = e(c, a);
1778
1784
  if (typeof l != "function" || !c)
1779
1785
  return;
1780
- const u = (d) => {
1781
- Qe(d) && (l(d), c.removeEventListener("pointerleave", u));
1786
+ const u = (f) => {
1787
+ en(f) && (l(f), c.removeEventListener("pointerleave", u));
1782
1788
  };
1783
1789
  c.addEventListener("pointerleave", u, i);
1784
1790
  };
@@ -1786,18 +1792,18 @@ function Br(t, e, n = {}) {
1786
1792
  a.addEventListener("pointerenter", o, i);
1787
1793
  }), r;
1788
1794
  }
1789
- const os = (t, e) => e ? t === e ? !0 : os(t, e.parentElement) : !1, Kr = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1, Wr = /* @__PURE__ */ new Set([
1795
+ const as = (t, e) => e ? t === e ? !0 : as(t, e.parentElement) : !1, Gr = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1, _r = /* @__PURE__ */ new Set([
1790
1796
  "BUTTON",
1791
1797
  "INPUT",
1792
1798
  "SELECT",
1793
1799
  "TEXTAREA",
1794
1800
  "A"
1795
1801
  ]);
1796
- function $r(t) {
1797
- return Wr.has(t.tagName) || t.tabIndex !== -1;
1802
+ function Hr(t) {
1803
+ return _r.has(t.tagName) || t.tabIndex !== -1;
1798
1804
  }
1799
- const xt = /* @__PURE__ */ new WeakSet();
1800
- function tn(t) {
1805
+ const Ct = /* @__PURE__ */ new WeakSet();
1806
+ function nn(t) {
1801
1807
  return (e) => {
1802
1808
  e.key === "Enter" && t(e);
1803
1809
  };
@@ -1805,48 +1811,48 @@ function tn(t) {
1805
1811
  function _t(t, e) {
1806
1812
  t.dispatchEvent(new PointerEvent("pointer" + e, { isPrimary: !0, bubbles: !0 }));
1807
1813
  }
1808
- const jr = (t, e) => {
1814
+ const Ur = (t, e) => {
1809
1815
  const n = t.currentTarget;
1810
1816
  if (!n)
1811
1817
  return;
1812
- const s = tn(() => {
1813
- if (xt.has(n))
1818
+ const s = nn(() => {
1819
+ if (Ct.has(n))
1814
1820
  return;
1815
1821
  _t(n, "down");
1816
- const i = tn(() => {
1822
+ const i = nn(() => {
1817
1823
  _t(n, "up");
1818
1824
  }), r = () => _t(n, "cancel");
1819
1825
  n.addEventListener("keyup", i, e), n.addEventListener("blur", r, e);
1820
1826
  });
1821
1827
  n.addEventListener("keydown", s, e), n.addEventListener("blur", () => n.removeEventListener("keydown", s), e);
1822
1828
  };
1823
- function en(t) {
1824
- return Kr(t) && !0;
1829
+ function sn(t) {
1830
+ return Gr(t) && !0;
1825
1831
  }
1826
- function _r(t, e, n = {}) {
1827
- const [s, i, r] = rs(t, n), o = (a) => {
1832
+ function zr(t, e, n = {}) {
1833
+ const [s, i, r] = os(t, n), o = (a) => {
1828
1834
  const c = a.currentTarget;
1829
- if (!en(a))
1835
+ if (!sn(a))
1830
1836
  return;
1831
- xt.add(c);
1837
+ Ct.add(c);
1832
1838
  const l = e(c, a), u = (h, y) => {
1833
- window.removeEventListener("pointerup", d), window.removeEventListener("pointercancel", f), xt.has(c) && xt.delete(c), en(h) && typeof l == "function" && l(h, { success: y });
1834
- }, d = (h) => {
1835
- u(h, c === window || c === document || n.useGlobalTarget || os(c, h.target));
1839
+ window.removeEventListener("pointerup", f), window.removeEventListener("pointercancel", d), Ct.has(c) && Ct.delete(c), sn(h) && typeof l == "function" && l(h, { success: y });
1836
1840
  }, f = (h) => {
1841
+ u(h, c === window || c === document || n.useGlobalTarget || as(c, h.target));
1842
+ }, d = (h) => {
1837
1843
  u(h, !1);
1838
1844
  };
1839
- window.addEventListener("pointerup", d, i), window.addEventListener("pointercancel", f, i);
1845
+ window.addEventListener("pointerup", f, i), window.addEventListener("pointercancel", d, i);
1840
1846
  };
1841
1847
  return s.forEach((a) => {
1842
- (n.useGlobalTarget ? window : a).addEventListener("pointerdown", o, i), qn(a) && (a.addEventListener("focus", (l) => jr(l, i)), !$r(a) && !a.hasAttribute("tabindex") && (a.tabIndex = 0));
1848
+ (n.useGlobalTarget ? window : a).addEventListener("pointerdown", o, i), Nr(a) && (a.addEventListener("focus", (l) => Ur(l, i)), !Hr(a) && !a.hasAttribute("tabindex") && (a.tabIndex = 0));
1843
1849
  }), r;
1844
1850
  }
1845
- const I = (t) => !!(t && t.getVelocity), Gr = [...es, C, nt], Ur = (t) => Gr.find(ts(t)), as = Q({
1851
+ const I = (t) => !!(t && t.getVelocity), Yr = [...ns, P, ot], Xr = (t) => Yr.find(es(t)), us = st({
1846
1852
  transformPagePoint: (t) => t,
1847
1853
  isStatic: !1,
1848
1854
  reducedMotion: "never"
1849
- }), Ae = Q({ strict: !1 }), nn = {
1855
+ }), Ce = st({ strict: !1 }), rn = {
1850
1856
  animation: [
1851
1857
  "animate",
1852
1858
  "variants",
@@ -1865,34 +1871,34 @@ const I = (t) => !!(t && t.getVelocity), Gr = [...es, C, nt], Ur = (t) => Gr.fin
1865
1871
  pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"],
1866
1872
  inView: ["whileInView", "onViewportEnter", "onViewportLeave"],
1867
1873
  layout: ["layout", "layoutId"]
1868
- }, J = {};
1869
- for (const t in nn)
1870
- J[t] = {
1871
- isEnabled: (e) => nn[t].some((n) => !!e[n])
1874
+ }, nt = {};
1875
+ for (const t in rn)
1876
+ nt[t] = {
1877
+ isEnabled: (e) => rn[t].some((n) => !!e[n])
1872
1878
  };
1873
- function sn(t) {
1879
+ function on(t) {
1874
1880
  for (const e in t)
1875
- J[e] = {
1876
- ...J[e],
1881
+ nt[e] = {
1882
+ ...nt[e],
1877
1883
  ...t[e]
1878
1884
  };
1879
1885
  }
1880
- function Hr({ children: t, features: e, strict: n = !1 }) {
1881
- const [, s] = Ns(!Gt(e)), i = ut(void 0);
1882
- if (!Gt(e)) {
1886
+ function qr({ children: t, features: e, strict: n = !1 }) {
1887
+ const [, s] = Ks(!Ht(e)), i = dt(void 0);
1888
+ if (!Ht(e)) {
1883
1889
  const { renderer: r, ...o } = e;
1884
- i.current = r, sn(o);
1890
+ i.current = r, on(o);
1885
1891
  }
1886
- return ce(() => {
1887
- Gt(e) && e().then(({ renderer: r, ...o }) => {
1888
- sn(o), i.current = r, s(!0);
1892
+ return de(() => {
1893
+ Ht(e) && e().then(({ renderer: r, ...o }) => {
1894
+ on(o), i.current = r, s(!0);
1889
1895
  });
1890
- }, []), R(Ae.Provider, { value: { renderer: i.current, strict: n }, children: t });
1896
+ }, []), R(Ce.Provider, { value: { renderer: i.current, strict: n }, children: t });
1891
1897
  }
1892
- function Gt(t) {
1898
+ function Ht(t) {
1893
1899
  return typeof t == "function";
1894
1900
  }
1895
- const zr = /* @__PURE__ */ new Set([
1901
+ const Zr = /* @__PURE__ */ new Set([
1896
1902
  "animate",
1897
1903
  "exit",
1898
1904
  "variants",
@@ -1924,32 +1930,32 @@ const zr = /* @__PURE__ */ new Set([
1924
1930
  "ignoreStrict",
1925
1931
  "viewport"
1926
1932
  ]);
1927
- function Dt(t) {
1928
- return t.startsWith("while") || t.startsWith("drag") && t !== "draggable" || t.startsWith("layout") || t.startsWith("onTap") || t.startsWith("onPan") || t.startsWith("onLayout") || zr.has(t);
1933
+ function Rt(t) {
1934
+ return t.startsWith("while") || t.startsWith("drag") && t !== "draggable" || t.startsWith("layout") || t.startsWith("onTap") || t.startsWith("onPan") || t.startsWith("onLayout") || Zr.has(t);
1929
1935
  }
1930
- let us = (t) => !Dt(t);
1931
- function Yr(t) {
1932
- typeof t == "function" && (us = (e) => e.startsWith("on") ? !Dt(e) : t(e));
1936
+ let cs = (t) => !Rt(t);
1937
+ function Jr(t) {
1938
+ typeof t == "function" && (cs = (e) => e.startsWith("on") ? !Rt(e) : t(e));
1933
1939
  }
1934
1940
  try {
1935
- Yr(require("@emotion/is-prop-valid").default);
1941
+ Jr(require("@emotion/is-prop-valid").default);
1936
1942
  } catch {
1937
1943
  }
1938
- function Xr(t, e, n) {
1944
+ function Qr(t, e, n) {
1939
1945
  const s = {};
1940
1946
  for (const i in t)
1941
- i === "values" && typeof t.values == "object" || (us(i) || n === !0 && Dt(i) || !e && !Dt(i) || // If trying to use native HTML drag events, forward drag listeners
1947
+ i === "values" && typeof t.values == "object" || (cs(i) || n === !0 && Rt(i) || !e && !Rt(i) || // If trying to use native HTML drag events, forward drag listeners
1942
1948
  t.draggable && i.startsWith("onDrag")) && (s[i] = t[i]);
1943
1949
  return s;
1944
1950
  }
1945
- const kt = /* @__PURE__ */ Q({});
1946
- function Nt(t) {
1951
+ const Lt = /* @__PURE__ */ st({});
1952
+ function Bt(t) {
1947
1953
  return t !== null && typeof t == "object" && typeof t.start == "function";
1948
1954
  }
1949
- function ht(t) {
1955
+ function gt(t) {
1950
1956
  return typeof t == "string" || Array.isArray(t);
1951
1957
  }
1952
- const xe = [
1958
+ const Pe = [
1953
1959
  "animate",
1954
1960
  "whileInView",
1955
1961
  "whileFocus",
@@ -1957,158 +1963,52 @@ const xe = [
1957
1963
  "whileTap",
1958
1964
  "whileDrag",
1959
1965
  "exit"
1960
- ], Me = ["initial", ...xe];
1961
- function Lt(t) {
1962
- return Nt(t.animate) || Me.some((e) => ht(t[e]));
1966
+ ], Fe = ["initial", ...Pe];
1967
+ function Kt(t) {
1968
+ return Bt(t.animate) || Fe.some((e) => gt(t[e]));
1963
1969
  }
1964
- function cs(t) {
1965
- return !!(Lt(t) || t.variants);
1970
+ function ls(t) {
1971
+ return !!(Kt(t) || t.variants);
1966
1972
  }
1967
- function qr(t, e) {
1968
- if (Lt(t)) {
1973
+ function to(t, e) {
1974
+ if (Kt(t)) {
1969
1975
  const { initial: n, animate: s } = t;
1970
1976
  return {
1971
- initial: n === !1 || ht(n) ? n : void 0,
1972
- animate: ht(s) ? s : void 0
1977
+ initial: n === !1 || gt(n) ? n : void 0,
1978
+ animate: gt(s) ? s : void 0
1973
1979
  };
1974
1980
  }
1975
1981
  return t.inherit !== !1 ? e : {};
1976
1982
  }
1977
- function Zr(t) {
1978
- const { initial: e, animate: n } = qr(t, k(kt));
1979
- return It(() => ({ initial: e, animate: n }), [rn(e), rn(n)]);
1983
+ function eo(t) {
1984
+ const { initial: e, animate: n } = to(t, k(Lt));
1985
+ return Et(() => ({ initial: e, animate: n }), [an(e), an(n)]);
1980
1986
  }
1981
- function rn(t) {
1987
+ function an(t) {
1982
1988
  return Array.isArray(t) ? t.join(" ") : t;
1983
1989
  }
1984
- const Jr = Symbol.for("motionComponentSymbol");
1985
- function ls(t) {
1986
- return t && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "current");
1987
- }
1988
- function Qr(t, e, n) {
1989
- return Ls(
1990
- (s) => {
1991
- s && t.onMount && t.onMount(s), e && (s ? e.mount(s) : e.unmount()), n && (typeof n == "function" ? n(s) : ls(n) && (n.current = s));
1992
- },
1993
- /**
1994
- * Only pass a new ref callback to React if we've received a visual element
1995
- * factory. Otherwise we'll be mounting/remounting every time externalRef
1996
- * or other dependencies change.
1997
- */
1998
- [e]
1999
- );
2000
- }
2001
- const Ce = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), to = "framerAppearId", fs = "data-" + Ce(to), eo = Q({});
2002
- function no(t, e, n, s, i) {
2003
- var b, v;
2004
- const { visualElement: r } = k(kt), o = k(Ae), a = k(mn), c = k(as).reducedMotion, l = ut(null);
2005
- s = s || o.renderer, !l.current && s && (l.current = s(t, {
2006
- visualState: e,
2007
- parent: r,
2008
- props: n,
2009
- presenceContext: a,
2010
- blockInitialAnimation: a ? a.initial === !1 : !1,
2011
- reducedMotionConfig: c
2012
- }));
2013
- const u = l.current, d = k(eo);
2014
- u && !u.projection && i && (u.type === "html" || u.type === "svg") && so(l.current, n, i, d);
2015
- const f = ut(!1);
2016
- Bs(() => {
2017
- u && f.current && u.update(n, a);
2018
- });
2019
- const h = n[fs], y = ut(!!h && !((b = window.MotionHandoffIsComplete) != null && b.call(window, h)) && ((v = window.MotionHasOptimisedAnimation) == null ? void 0 : v.call(window, h)));
2020
- return _s(() => {
2021
- u && (f.current = !0, window.MotionIsMounted = !0, u.updateFeatures(), kr.render(u.render), y.current && u.animationState && u.animationState.animateChanges());
2022
- }), ce(() => {
2023
- u && (!y.current && u.animationState && u.animationState.animateChanges(), y.current && (queueMicrotask(() => {
2024
- var p;
2025
- (p = window.MotionHandoffMarkAsComplete) == null || p.call(window, h);
2026
- }), y.current = !1));
2027
- }), u;
2028
- }
2029
- function so(t, e, n, s) {
2030
- const { layoutId: i, layout: r, drag: o, dragConstraints: a, layoutScroll: c, layoutRoot: l, layoutCrossfade: u } = e;
2031
- t.projection = new n(t.latestValues, e["data-framer-portal-id"] ? void 0 : ds(t.parent)), t.projection.setOptions({
2032
- layoutId: i,
2033
- layout: r,
2034
- alwaysMeasureLayout: !!o || a && ls(a),
2035
- visualElement: t,
2036
- /**
2037
- * TODO: Update options in an effect. This could be tricky as it'll be too late
2038
- * to update by the time layout animations run.
2039
- * We also need to fix this safeToRemove by linking it up to the one returned by usePresence,
2040
- * ensuring it gets called if there's no potential layout animations.
2041
- *
2042
- */
2043
- animationType: typeof r == "string" ? r : "both",
2044
- initialPromotionConfig: s,
2045
- crossfade: u,
2046
- layoutScroll: c,
2047
- layoutRoot: l
2048
- });
2049
- }
2050
- function ds(t) {
2051
- if (t)
2052
- return t.options.allowProjection !== !1 ? t.projection : ds(t.parent);
2053
- }
2054
- function io({ preloadedFeatures: t, createVisualElement: e, useRender: n, useVisualState: s, Component: i }) {
2055
- function r(a, c) {
2056
- let l;
2057
- const u = {
2058
- ...k(as),
2059
- ...a,
2060
- layoutId: ro(a)
2061
- }, { isStatic: d } = u, f = Zr(a), h = s(a, d);
2062
- if (!d && le) {
2063
- oo(u, t);
2064
- const y = ao(u);
2065
- l = y.MeasureLayout, f.visualElement = no(i, h, u, e, y.ProjectionNode);
2066
- }
2067
- return hn(kt.Provider, { value: f, children: [l && f.visualElement ? R(l, { visualElement: f.visualElement, ...u }) : null, n(i, a, Qr(h, f.visualElement, c), h, d, f.visualElement)] });
2068
- }
2069
- r.displayName = `motion.${typeof i == "string" ? i : `create(${i.displayName ?? i.name ?? ""})`}`;
2070
- const o = Ks(r);
2071
- return o[Jr] = i, o;
2072
- }
2073
- function ro({ layoutId: t }) {
2074
- const e = k($s).id;
2075
- return e && t !== void 0 ? e + "-" + t : t;
2076
- }
2077
- function oo(t, e) {
2078
- k(Ae).strict, process.env.NODE_ENV;
2079
- }
2080
- function ao(t) {
2081
- const { drag: e, layout: n } = J;
2082
- if (!e && !n)
2083
- return {};
2084
- const s = { ...e, ...n };
2085
- return {
2086
- MeasureLayout: e != null && e.isEnabled(t) || n != null && n.isEnabled(t) ? s.MeasureLayout : void 0,
2087
- ProjectionNode: s.ProjectionNode
2088
- };
2089
- }
2090
- const uo = {};
2091
- function hs(t, { layout: e, layoutId: n }) {
2092
- return it.has(t) || t.startsWith("origin") || (e || n !== void 0) && (!!uo[t] || t === "opacity");
1990
+ const no = {};
1991
+ function fs(t, { layout: e, layoutId: n }) {
1992
+ return ut.has(t) || t.startsWith("origin") || (e || n !== void 0) && (!!no[t] || t === "opacity");
2093
1993
  }
2094
- const co = {
1994
+ const so = {
2095
1995
  x: "translateX",
2096
1996
  y: "translateY",
2097
1997
  z: "translateZ",
2098
1998
  transformPerspective: "perspective"
2099
- }, lo = st.length;
2100
- function fo(t, e, n) {
1999
+ }, io = at.length;
2000
+ function ro(t, e, n) {
2101
2001
  let s = "", i = !0;
2102
- for (let r = 0; r < lo; r++) {
2103
- const o = st[r], a = t[o];
2002
+ for (let r = 0; r < io; r++) {
2003
+ const o = at[r], a = t[o];
2104
2004
  if (a === void 0)
2105
2005
  continue;
2106
2006
  let c = !0;
2107
2007
  if (typeof a == "number" ? c = a === (o.startsWith("scale") ? 1 : 0) : c = parseFloat(a) === 0, !c || n) {
2108
- const l = is(a, Ve[o]);
2008
+ const l = rs(a, Me[o]);
2109
2009
  if (!c) {
2110
2010
  i = !1;
2111
- const u = co[o] || o;
2011
+ const u = so[o] || o;
2112
2012
  s += `${u}(${l}) `;
2113
2013
  }
2114
2014
  n && (e[o] = l);
@@ -2116,66 +2016,66 @@ function fo(t, e, n) {
2116
2016
  }
2117
2017
  return s = s.trim(), n ? s = n(e, i ? "" : s) : i && (s = "none"), s;
2118
2018
  }
2119
- function Pe(t, e, n) {
2019
+ function Oe(t, e, n) {
2120
2020
  const { style: s, vars: i, transformOrigin: r } = t;
2121
2021
  let o = !1, a = !1;
2122
2022
  for (const c in e) {
2123
2023
  const l = e[c];
2124
- if (it.has(c)) {
2024
+ if (ut.has(c)) {
2125
2025
  o = !0;
2126
2026
  continue;
2127
- } else if (Rn(c)) {
2027
+ } else if (kn(c)) {
2128
2028
  i[c] = l;
2129
2029
  continue;
2130
2030
  } else {
2131
- const u = is(l, Ve[c]);
2031
+ const u = rs(l, Me[c]);
2132
2032
  c.startsWith("origin") ? (a = !0, r[c] = u) : s[c] = u;
2133
2033
  }
2134
2034
  }
2135
- if (e.transform || (o || n ? s.transform = fo(e, t.transform, n) : s.transform && (s.transform = "none")), a) {
2035
+ if (e.transform || (o || n ? s.transform = ro(e, t.transform, n) : s.transform && (s.transform = "none")), a) {
2136
2036
  const { originX: c = "50%", originY: l = "50%", originZ: u = 0 } = r;
2137
2037
  s.transformOrigin = `${c} ${l} ${u}`;
2138
2038
  }
2139
2039
  }
2140
- const Fe = () => ({
2040
+ const De = () => ({
2141
2041
  style: {},
2142
2042
  transform: {},
2143
2043
  transformOrigin: {},
2144
2044
  vars: {}
2145
2045
  });
2146
- function ps(t, e, n) {
2046
+ function ds(t, e, n) {
2147
2047
  for (const s in e)
2148
- !I(e[s]) && !hs(s, n) && (t[s] = e[s]);
2048
+ !I(e[s]) && !fs(s, n) && (t[s] = e[s]);
2149
2049
  }
2150
- function ho({ transformTemplate: t }, e) {
2151
- return It(() => {
2152
- const n = Fe();
2153
- return Pe(n, e, t), Object.assign({}, n.vars, n.style);
2050
+ function oo({ transformTemplate: t }, e) {
2051
+ return Et(() => {
2052
+ const n = De();
2053
+ return Oe(n, e, t), Object.assign({}, n.vars, n.style);
2154
2054
  }, [e]);
2155
2055
  }
2156
- function po(t, e) {
2056
+ function ao(t, e) {
2157
2057
  const n = t.style || {}, s = {};
2158
- return ps(s, n, t), Object.assign(s, ho(t, e)), s;
2058
+ return ds(s, n, t), Object.assign(s, oo(t, e)), s;
2159
2059
  }
2160
- function mo(t, e) {
2161
- const n = {}, s = po(t, e);
2060
+ function uo(t, e) {
2061
+ const n = {}, s = ao(t, e);
2162
2062
  return t.drag && t.dragListener !== !1 && (n.draggable = !1, s.userSelect = s.WebkitUserSelect = s.WebkitTouchCallout = "none", s.touchAction = t.drag === !0 ? "none" : `pan-${t.drag === "x" ? "y" : "x"}`), t.tabIndex === void 0 && (t.onTap || t.onTapStart || t.whileTap) && (n.tabIndex = 0), n.style = s, n;
2163
2063
  }
2164
- const go = {
2064
+ const co = {
2165
2065
  offset: "stroke-dashoffset",
2166
2066
  array: "stroke-dasharray"
2167
- }, yo = {
2067
+ }, lo = {
2168
2068
  offset: "strokeDashoffset",
2169
2069
  array: "strokeDasharray"
2170
2070
  };
2171
- function bo(t, e, n = 1, s = 0, i = !0) {
2071
+ function fo(t, e, n = 1, s = 0, i = !0) {
2172
2072
  t.pathLength = 1;
2173
- const r = i ? go : yo;
2073
+ const r = i ? co : lo;
2174
2074
  t[r.offset] = g.transform(-s);
2175
2075
  const o = g.transform(e), a = g.transform(n);
2176
2076
  t[r.array] = `${o} ${a}`;
2177
2077
  }
2178
- function ms(t, {
2078
+ function hs(t, {
2179
2079
  attrX: e,
2180
2080
  attrY: n,
2181
2081
  attrScale: s,
@@ -2185,33 +2085,33 @@ function ms(t, {
2185
2085
  // This is object creation, which we try to avoid per-frame.
2186
2086
  ...a
2187
2087
  }, c, l, u) {
2188
- if (Pe(t, a, l), c) {
2088
+ if (Oe(t, a, l), c) {
2189
2089
  t.style.viewBox && (t.attrs.viewBox = t.style.viewBox);
2190
2090
  return;
2191
2091
  }
2192
2092
  t.attrs = t.style, t.style = {};
2193
- const { attrs: d, style: f } = t;
2194
- d.transform && (f.transform = d.transform, delete d.transform), (f.transform || d.transformOrigin) && (f.transformOrigin = d.transformOrigin ?? "50% 50%", delete d.transformOrigin), f.transform && (f.transformBox = (u == null ? void 0 : u.transformBox) ?? "fill-box", delete d.transformBox), e !== void 0 && (d.x = e), n !== void 0 && (d.y = n), s !== void 0 && (d.scale = s), i !== void 0 && bo(d, i, r, o, !1);
2093
+ const { attrs: f, style: d } = t;
2094
+ f.transform && (d.transform = f.transform, delete f.transform), (d.transform || f.transformOrigin) && (d.transformOrigin = f.transformOrigin ?? "50% 50%", delete f.transformOrigin), d.transform && (d.transformBox = (u == null ? void 0 : u.transformBox) ?? "fill-box", delete f.transformBox), e !== void 0 && (f.x = e), n !== void 0 && (f.y = n), s !== void 0 && (f.scale = s), i !== void 0 && fo(f, i, r, o, !1);
2195
2095
  }
2196
- const gs = () => ({
2197
- ...Fe(),
2096
+ const ps = () => ({
2097
+ ...De(),
2198
2098
  attrs: {}
2199
- }), ys = (t) => typeof t == "string" && t.toLowerCase() === "svg";
2200
- function To(t, e, n, s) {
2201
- const i = It(() => {
2202
- const r = gs();
2203
- return ms(r, e, ys(s), t.transformTemplate, t.style), {
2099
+ }), ms = (t) => typeof t == "string" && t.toLowerCase() === "svg";
2100
+ function ho(t, e, n, s) {
2101
+ const i = Et(() => {
2102
+ const r = ps();
2103
+ return hs(r, e, ms(s), t.transformTemplate, t.style), {
2204
2104
  ...r.attrs,
2205
2105
  style: { ...r.style }
2206
2106
  };
2207
2107
  }, [e]);
2208
2108
  if (t.style) {
2209
2109
  const r = {};
2210
- ps(r, t.style, t), i.style = { ...r, ...i.style };
2110
+ ds(r, t.style, t), i.style = { ...r, ...i.style };
2211
2111
  }
2212
2112
  return i;
2213
2113
  }
2214
- const vo = [
2114
+ const po = [
2215
2115
  "animate",
2216
2116
  "circle",
2217
2117
  "defs",
@@ -2238,7 +2138,7 @@ const vo = [
2238
2138
  "use",
2239
2139
  "view"
2240
2140
  ];
2241
- function Oe(t) {
2141
+ function Ie(t) {
2242
2142
  return (
2243
2143
  /**
2244
2144
  * If it's not a string, it's a custom React component. Currently we only support
@@ -2251,66 +2151,60 @@ function Oe(t) {
2251
2151
  /**
2252
2152
  * If it's in our list of lowercase SVG tags, it's an SVG component
2253
2153
  */
2254
- !!(vo.indexOf(t) > -1 || /**
2154
+ !!(po.indexOf(t) > -1 || /**
2255
2155
  * If it contains a capital letter, it's an SVG component
2256
2156
  */
2257
2157
  /[A-Z]/u.test(t))
2258
2158
  )
2259
2159
  );
2260
2160
  }
2261
- function wo(t = !1) {
2262
- return (n, s, i, { latestValues: r }, o) => {
2263
- const c = (Oe(n) ? To : mo)(s, r, o, n), l = Xr(s, typeof n == "string", t), u = n !== pn ? { ...l, ...c, ref: i } : {}, { children: d } = s, f = It(() => I(d) ? d.get() : d, [d]);
2264
- return Ws(n, {
2265
- ...u,
2266
- children: f
2267
- });
2268
- };
2161
+ function mo(t, e, n, { latestValues: s }, i, r = !1) {
2162
+ const a = (Ie(t) ? ho : uo)(e, s, i, t), c = Qr(e, typeof t == "string", r), l = t !== gn ? { ...c, ...a, ref: n } : {}, { children: u } = e, f = Et(() => I(u) ? u.get() : u, [u]);
2163
+ return Ws(t, {
2164
+ ...l,
2165
+ children: f
2166
+ });
2269
2167
  }
2270
- function on(t) {
2168
+ function un(t) {
2271
2169
  const e = [{}, {}];
2272
2170
  return t == null || t.values.forEach((n, s) => {
2273
2171
  e[0][s] = n.get(), e[1][s] = n.getVelocity();
2274
2172
  }), e;
2275
2173
  }
2276
- function De(t, e, n, s) {
2174
+ function Re(t, e, n, s) {
2277
2175
  if (typeof e == "function") {
2278
- const [i, r] = on(s);
2176
+ const [i, r] = un(s);
2279
2177
  e = e(n !== void 0 ? n : t.custom, i, r);
2280
2178
  }
2281
2179
  if (typeof e == "string" && (e = t.variants && t.variants[e]), typeof e == "function") {
2282
- const [i, r] = on(s);
2180
+ const [i, r] = un(s);
2283
2181
  e = e(n !== void 0 ? n : t.custom, i, r);
2284
2182
  }
2285
2183
  return e;
2286
2184
  }
2287
- function So(t) {
2185
+ function go(t) {
2288
2186
  return I(t) ? t.get() : t;
2289
2187
  }
2290
- function Vo({ scrapeMotionValuesFromProps: t, createRenderState: e }, n, s, i) {
2188
+ function yo({ scrapeMotionValuesFromProps: t, createRenderState: e }, n, s, i) {
2291
2189
  return {
2292
- latestValues: Ao(n, s, i, t),
2190
+ latestValues: bo(n, s, i, t),
2293
2191
  renderState: e()
2294
2192
  };
2295
2193
  }
2296
- const bs = (t) => (e, n) => {
2297
- const s = k(kt), i = k(mn), r = () => Vo(t, e, s, i);
2298
- return n ? r() : js(r);
2299
- };
2300
- function Ao(t, e, n, s) {
2194
+ function bo(t, e, n, s) {
2301
2195
  const i = {}, r = s(t, {});
2302
- for (const f in r)
2303
- i[f] = So(r[f]);
2196
+ for (const d in r)
2197
+ i[d] = go(r[d]);
2304
2198
  let { initial: o, animate: a } = t;
2305
- const c = Lt(t), l = cs(t);
2199
+ const c = Kt(t), l = ls(t);
2306
2200
  e && l && !c && t.inherit !== !1 && (o === void 0 && (o = e.initial), a === void 0 && (a = e.animate));
2307
2201
  let u = n ? n.initial === !1 : !1;
2308
2202
  u = u || o === !1;
2309
- const d = u ? a : o;
2310
- if (d && typeof d != "boolean" && !Nt(d)) {
2311
- const f = Array.isArray(d) ? d : [d];
2312
- for (let h = 0; h < f.length; h++) {
2313
- const y = De(t, f[h]);
2203
+ const f = u ? a : o;
2204
+ if (f && typeof f != "boolean" && !Bt(f)) {
2205
+ const d = Array.isArray(f) ? f : [f];
2206
+ for (let h = 0; h < d.length; h++) {
2207
+ const y = Re(t, d[h]);
2314
2208
  if (y) {
2315
2209
  const { transitionEnd: b, transition: v, ...p } = y;
2316
2210
  for (const S in p) {
@@ -2328,953 +2222,1071 @@ function Ao(t, e, n, s) {
2328
2222
  }
2329
2223
  return i;
2330
2224
  }
2331
- function Ie(t, e, n) {
2225
+ const gs = (t) => (e, n) => {
2226
+ const s = k(Lt), i = k(yn), r = () => yo(t, e, s, i);
2227
+ return n ? r() : Hs(r);
2228
+ };
2229
+ function Ee(t, e, n) {
2332
2230
  var r;
2333
2231
  const { style: s } = t, i = {};
2334
2232
  for (const o in s)
2335
- (I(s[o]) || e.style && I(e.style[o]) || hs(o, t) || ((r = n == null ? void 0 : n.getValue(o)) == null ? void 0 : r.liveStyle) !== void 0) && (i[o] = s[o]);
2233
+ (I(s[o]) || e.style && I(e.style[o]) || fs(o, t) || ((r = n == null ? void 0 : n.getValue(o)) == null ? void 0 : r.liveStyle) !== void 0) && (i[o] = s[o]);
2336
2234
  return i;
2337
2235
  }
2338
- const xo = {
2339
- useVisualState: bs({
2340
- scrapeMotionValuesFromProps: Ie,
2341
- createRenderState: Fe
2342
- })
2343
- };
2344
- function Ts(t, e, n) {
2345
- const s = Ie(t, e, n);
2236
+ const To = /* @__PURE__ */ gs({
2237
+ scrapeMotionValuesFromProps: Ee,
2238
+ createRenderState: De
2239
+ });
2240
+ function ys(t, e, n) {
2241
+ const s = Ee(t, e, n);
2346
2242
  for (const i in t)
2347
2243
  if (I(t[i]) || I(e[i])) {
2348
- const r = st.indexOf(i) !== -1 ? "attr" + i.charAt(0).toUpperCase() + i.substring(1) : i;
2244
+ const r = at.indexOf(i) !== -1 ? "attr" + i.charAt(0).toUpperCase() + i.substring(1) : i;
2349
2245
  s[r] = t[i];
2350
2246
  }
2351
2247
  return s;
2352
2248
  }
2353
- const Mo = {
2354
- useVisualState: bs({
2355
- scrapeMotionValuesFromProps: Ts,
2356
- createRenderState: gs
2357
- })
2358
- };
2359
- function Co(t, e) {
2360
- return function(s, { forwardMotionProps: i } = { forwardMotionProps: !1 }) {
2361
- const o = {
2362
- ...Oe(s) ? Mo : xo,
2363
- preloadedFeatures: t,
2364
- useRender: wo(i),
2365
- createVisualElement: e,
2366
- Component: s
2367
- };
2368
- return io(o);
2369
- };
2370
- }
2371
- const Po = /* @__PURE__ */ Co();
2372
- function pt(t, e, n) {
2373
- const s = t.getProps();
2374
- return De(s, e, n !== void 0 ? n : s.custom, t);
2249
+ const vo = /* @__PURE__ */ gs({
2250
+ scrapeMotionValuesFromProps: ys,
2251
+ createRenderState: ps
2252
+ }), wo = Symbol.for("motionComponentSymbol");
2253
+ function bs(t) {
2254
+ return t && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "current");
2375
2255
  }
2376
- const re = (t) => Array.isArray(t);
2377
- function Fo(t, e, n) {
2378
- t.hasValue(e) ? t.getValue(e).set(n) : t.addValue(e, Ot(n));
2256
+ function So(t, e, n) {
2257
+ return $s(
2258
+ (s) => {
2259
+ s && t.onMount && t.onMount(s), e && (s ? e.mount(s) : e.unmount()), n && (typeof n == "function" ? n(s) : bs(n) && (n.current = s));
2260
+ },
2261
+ /**
2262
+ * Only pass a new ref callback to React if we've received a visual element
2263
+ * factory. Otherwise we'll be mounting/remounting every time externalRef
2264
+ * or other dependencies change.
2265
+ */
2266
+ [e]
2267
+ );
2379
2268
  }
2380
- function Oo(t) {
2381
- return re(t) ? t[t.length - 1] || 0 : t;
2269
+ const ke = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), Vo = "framerAppearId", Ts = "data-" + ke(Vo), Ao = st({});
2270
+ function xo(t, e, n, s, i) {
2271
+ var b, v;
2272
+ const { visualElement: r } = k(Lt), o = k(Ce), a = k(yn), c = k(us).reducedMotion, l = dt(null);
2273
+ s = s || o.renderer, !l.current && s && (l.current = s(t, {
2274
+ visualState: e,
2275
+ parent: r,
2276
+ props: n,
2277
+ presenceContext: a,
2278
+ blockInitialAnimation: a ? a.initial === !1 : !1,
2279
+ reducedMotionConfig: c
2280
+ }));
2281
+ const u = l.current, f = k(Ao);
2282
+ u && !u.projection && i && (u.type === "html" || u.type === "svg") && Mo(l.current, n, i, f);
2283
+ const d = dt(!1);
2284
+ js(() => {
2285
+ u && d.current && u.update(n, a);
2286
+ });
2287
+ const h = n[Ts], y = dt(!!h && !((b = window.MotionHandoffIsComplete) != null && b.call(window, h)) && ((v = window.MotionHasOptimisedAnimation) == null ? void 0 : v.call(window, h)));
2288
+ return Us(() => {
2289
+ u && (d.current = !0, window.MotionIsMounted = !0, u.updateFeatures(), u.scheduleRenderMicrotask(), y.current && u.animationState && u.animationState.animateChanges());
2290
+ }), de(() => {
2291
+ u && (!y.current && u.animationState && u.animationState.animateChanges(), y.current && (queueMicrotask(() => {
2292
+ var p;
2293
+ (p = window.MotionHandoffMarkAsComplete) == null || p.call(window, h);
2294
+ }), y.current = !1), u.enteringChildren = void 0);
2295
+ }), u;
2382
2296
  }
2383
- function Do(t, e) {
2384
- const n = pt(t, e);
2385
- let { transitionEnd: s = {}, transition: i = {}, ...r } = n || {};
2386
- r = { ...r, ...s };
2387
- for (const o in r) {
2388
- const a = Oo(r[o]);
2389
- Fo(t, o, a);
2390
- }
2297
+ function Mo(t, e, n, s) {
2298
+ const { layoutId: i, layout: r, drag: o, dragConstraints: a, layoutScroll: c, layoutRoot: l, layoutCrossfade: u } = e;
2299
+ t.projection = new n(t.latestValues, e["data-framer-portal-id"] ? void 0 : vs(t.parent)), t.projection.setOptions({
2300
+ layoutId: i,
2301
+ layout: r,
2302
+ alwaysMeasureLayout: !!o || a && bs(a),
2303
+ visualElement: t,
2304
+ /**
2305
+ * TODO: Update options in an effect. This could be tricky as it'll be too late
2306
+ * to update by the time layout animations run.
2307
+ * We also need to fix this safeToRemove by linking it up to the one returned by usePresence,
2308
+ * ensuring it gets called if there's no potential layout animations.
2309
+ *
2310
+ */
2311
+ animationType: typeof r == "string" ? r : "both",
2312
+ initialPromotionConfig: s,
2313
+ crossfade: u,
2314
+ layoutScroll: c,
2315
+ layoutRoot: l
2316
+ });
2391
2317
  }
2392
- function Io(t) {
2393
- return !!(I(t) && t.add);
2318
+ function vs(t) {
2319
+ if (t)
2320
+ return t.options.allowProjection !== !1 ? t.projection : vs(t.parent);
2394
2321
  }
2395
- function Ro(t, e) {
2396
- const n = t.getValue("willChange");
2397
- if (Io(n))
2398
- return n.add(e);
2399
- if (!n && W.WillChange) {
2400
- const s = new W.WillChange("auto");
2401
- t.addValue("willChange", s), s.add(e);
2322
+ function Co(t, { forwardMotionProps: e = !1 } = {}, n, s) {
2323
+ const i = Ie(t) ? vo : To;
2324
+ function r(a, c) {
2325
+ let l;
2326
+ const u = {
2327
+ ...k(us),
2328
+ ...a,
2329
+ layoutId: Po(a)
2330
+ }, { isStatic: f } = u, d = eo(a), h = i(a, f);
2331
+ if (!f && he) {
2332
+ Fo(u, n);
2333
+ const y = Oo(u);
2334
+ l = y.MeasureLayout, d.visualElement = xo(t, h, u, s, y.ProjectionNode);
2335
+ }
2336
+ return mn(Lt.Provider, { value: d, children: [l && d.visualElement ? R(l, { visualElement: d.visualElement, ...u }) : null, mo(t, a, So(h, d.visualElement, c), h, f, e)] });
2402
2337
  }
2338
+ r.displayName = `motion.${typeof t == "string" ? t : `create(${t.displayName ?? t.name ?? ""})`}`;
2339
+ const o = Gs(r);
2340
+ return o[wo] = t, o;
2403
2341
  }
2404
- function Eo(t) {
2405
- return t.props[fs];
2342
+ function Po({ layoutId: t }) {
2343
+ const e = k(_s).id;
2344
+ return e && t !== void 0 ? e + "-" + t : t;
2406
2345
  }
2407
- const ko = (t) => t !== null;
2408
- function No(t, { repeat: e, repeatType: n = "loop" }, s) {
2409
- const i = t.filter(ko), r = e && n !== "loop" && e % 2 === 1 ? 0 : i.length - 1;
2410
- return i[r];
2346
+ function Fo(t, e) {
2347
+ k(Ce).strict, process.env.NODE_ENV;
2411
2348
  }
2412
- const Lo = {
2413
- type: "spring",
2414
- stiffness: 500,
2415
- damping: 25,
2416
- restSpeed: 10
2417
- }, Bo = (t) => ({
2418
- type: "spring",
2419
- stiffness: 550,
2420
- damping: t === 0 ? 2 * Math.sqrt(550) : 30,
2421
- restSpeed: 10
2422
- }), Ko = {
2423
- type: "keyframes",
2424
- duration: 0.8
2425
- }, Wo = {
2426
- type: "keyframes",
2427
- ease: [0.25, 0.1, 0.35, 1],
2428
- duration: 0.3
2429
- }, $o = (t, { keyframes: e }) => e.length > 2 ? Ko : it.has(t) ? t.startsWith("scale") ? Bo(e[1]) : Lo : Wo;
2430
- function jo({ when: t, delay: e, delayChildren: n, staggerChildren: s, staggerDirection: i, repeat: r, repeatType: o, repeatDelay: a, from: c, elapsed: l, ...u }) {
2431
- return !!Object.keys(u).length;
2349
+ function Oo(t) {
2350
+ const { drag: e, layout: n } = nt;
2351
+ if (!e && !n)
2352
+ return {};
2353
+ const s = { ...e, ...n };
2354
+ return {
2355
+ MeasureLayout: e != null && e.isEnabled(t) || n != null && n.isEnabled(t) ? s.MeasureLayout : void 0,
2356
+ ProjectionNode: s.ProjectionNode
2357
+ };
2432
2358
  }
2433
- const _o = (t, e, n, s = {}, i, r) => (o) => {
2434
- const a = Jn(s, t) || {}, c = a.delay || s.delay || 0;
2435
- let { elapsed: l = 0 } = s;
2436
- l = l - /* @__PURE__ */ L(c);
2437
- const u = {
2438
- keyframes: Array.isArray(n) ? n : [null, n],
2439
- ease: "easeOut",
2440
- velocity: e.getVelocity(),
2441
- ...a,
2442
- delay: -l,
2443
- onUpdate: (f) => {
2444
- e.set(f), a.onUpdate && a.onUpdate(f);
2445
- },
2446
- onComplete: () => {
2447
- o(), a.onComplete && a.onComplete();
2448
- },
2449
- name: t,
2450
- motionValue: e,
2451
- element: r ? void 0 : i
2359
+ function Do({ top: t, left: e, right: n, bottom: s }) {
2360
+ return {
2361
+ x: { min: e, max: n },
2362
+ y: { min: t, max: s }
2452
2363
  };
2453
- jo(a) || Object.assign(u, $o(t, u)), u.duration && (u.duration = /* @__PURE__ */ L(u.duration)), u.repeatDelay && (u.repeatDelay = /* @__PURE__ */ L(u.repeatDelay)), u.from !== void 0 && (u.keyframes[0] = u.from);
2454
- let d = !1;
2455
- if ((u.type === !1 || u.duration === 0 && !u.repeatDelay) && (u.duration = 0, u.delay === 0 && (d = !0)), (W.instantAnimations || W.skipAnimations) && (d = !0, u.duration = 0, u.delay = 0), u.allowFlatten = !a.type && !a.ease, d && !r && e.get() !== void 0) {
2456
- const f = No(u.keyframes, a);
2457
- if (f !== void 0) {
2458
- N.update(() => {
2459
- u.onUpdate(f), u.onComplete();
2460
- });
2461
- return;
2462
- }
2463
- }
2464
- return a.isSync ? new we(u) : new br(u);
2465
- };
2466
- function Go({ protectedKeys: t, needsAnimating: e }, n) {
2467
- const s = t.hasOwnProperty(n) && e[n] !== !0;
2468
- return e[n] = !1, s;
2469
2364
  }
2470
- function vs(t, e, { delay: n = 0, transitionOverride: s, type: i } = {}) {
2471
- let { transition: r = t.getDefaultTransition(), transitionEnd: o, ...a } = e;
2472
- s && (r = s);
2473
- const c = [], l = i && t.animationState && t.animationState.getState()[i];
2474
- for (const u in a) {
2475
- const d = t.getValue(u, t.latestValues[u] ?? null), f = a[u];
2476
- if (f === void 0 || l && Go(l, u))
2477
- continue;
2478
- const h = {
2479
- delay: n,
2480
- ...Jn(r || {}, u)
2481
- }, y = d.get();
2482
- if (y !== void 0 && !d.isAnimating && !Array.isArray(f) && f === y && !h.velocity)
2483
- continue;
2484
- let b = !1;
2485
- if (window.MotionHandoffAnimation) {
2486
- const p = Eo(t);
2487
- if (p) {
2488
- const S = window.MotionHandoffAnimation(p, u, N);
2489
- S !== null && (h.startTime = S, b = !0);
2490
- }
2491
- }
2492
- Ro(t, u), d.start(_o(u, d, f, t.shouldReduceMotion && Qn.has(u) ? { type: !1 } : h, t, b));
2493
- const v = d.animation;
2494
- v && c.push(v);
2495
- }
2496
- return o && Promise.all(c).then(() => {
2497
- N.update(() => {
2498
- o && Do(t, o);
2499
- });
2500
- }), c;
2365
+ function Io(t, e) {
2366
+ if (!e)
2367
+ return t;
2368
+ const n = e({ x: t.left, y: t.top }), s = e({ x: t.right, y: t.bottom });
2369
+ return {
2370
+ top: n.y,
2371
+ left: n.x,
2372
+ bottom: s.y,
2373
+ right: s.x
2374
+ };
2501
2375
  }
2502
- function oe(t, e, n = {}) {
2503
- var c;
2504
- const s = pt(t, e, n.type === "exit" ? (c = t.presenceContext) == null ? void 0 : c.custom : void 0);
2505
- let { transition: i = t.getDefaultTransition() || {} } = s || {};
2506
- n.transitionOverride && (i = n.transitionOverride);
2507
- const r = s ? () => Promise.all(vs(t, s, n)) : () => Promise.resolve(), o = t.variantChildren && t.variantChildren.size ? (l = 0) => {
2508
- const { delayChildren: u = 0, staggerChildren: d, staggerDirection: f } = i;
2509
- return Uo(t, e, l, u, d, f, n);
2510
- } : () => Promise.resolve(), { when: a } = i;
2511
- if (a) {
2512
- const [l, u] = a === "beforeChildren" ? [r, o] : [o, r];
2513
- return l().then(() => u());
2514
- } else
2515
- return Promise.all([r(), o(n.delay)]);
2516
- }
2517
- function Uo(t, e, n = 0, s = 0, i = 0, r = 1, o) {
2518
- const a = [], c = t.variantChildren.size, l = (c - 1) * i, u = typeof s == "function", d = u ? (f) => s(f, c) : (
2519
- // Support deprecated staggerChildren
2520
- r === 1 ? (f = 0) => f * i : (f = 0) => l - f * i
2521
- );
2522
- return Array.from(t.variantChildren).sort(Ho).forEach((f, h) => {
2523
- f.notify("AnimationStart", e), a.push(oe(f, e, {
2524
- ...o,
2525
- delay: n + (u ? 0 : s) + d(h)
2526
- }).then(() => f.notify("AnimationComplete", e)));
2527
- }), Promise.all(a);
2376
+ function Ro(t, e) {
2377
+ return Do(Io(t.getBoundingClientRect(), e));
2528
2378
  }
2529
- function Ho(t, e) {
2530
- return t.sortNodePosition(e);
2379
+ const cn = () => ({ min: 0, max: 0 }), ws = () => ({
2380
+ x: cn(),
2381
+ y: cn()
2382
+ }), ue = { current: null }, Ss = { current: !1 };
2383
+ function Eo() {
2384
+ if (Ss.current = !0, !!he)
2385
+ if (window.matchMedia) {
2386
+ const t = window.matchMedia("(prefers-reduced-motion)"), e = () => ue.current = t.matches;
2387
+ t.addEventListener("change", e), e();
2388
+ } else
2389
+ ue.current = !1;
2531
2390
  }
2532
- function zo(t, e, n = {}) {
2533
- t.notify("AnimationStart", e);
2534
- let s;
2535
- if (Array.isArray(e)) {
2536
- const i = e.map((r) => oe(t, r, n));
2537
- s = Promise.all(i);
2538
- } else if (typeof e == "string")
2539
- s = oe(t, e, n);
2540
- else {
2541
- const i = typeof e == "function" ? pt(t, e, n.custom) : e;
2542
- s = Promise.all(vs(t, i, n));
2391
+ const ko = /* @__PURE__ */ new WeakMap();
2392
+ function No(t, e, n) {
2393
+ for (const s in e) {
2394
+ const i = e[s], r = n[s];
2395
+ if (I(i))
2396
+ t.addValue(s, i);
2397
+ else if (I(r))
2398
+ t.addValue(s, It(i, { owner: t }));
2399
+ else if (r !== i)
2400
+ if (t.hasValue(s)) {
2401
+ const o = t.getValue(s);
2402
+ o.liveStyle === !0 ? o.jump(i) : o.hasAnimated || o.set(i);
2403
+ } else {
2404
+ const o = t.getStaticValue(s);
2405
+ t.addValue(s, It(o !== void 0 ? o : i, { owner: t }));
2406
+ }
2543
2407
  }
2544
- return s.then(() => {
2545
- t.notify("AnimationComplete", e);
2546
- });
2547
- }
2548
- function ws(t, e) {
2549
- if (!Array.isArray(e))
2550
- return !1;
2551
- const n = e.length;
2552
- if (n !== t.length)
2553
- return !1;
2554
- for (let s = 0; s < n; s++)
2555
- if (e[s] !== t[s])
2556
- return !1;
2557
- return !0;
2408
+ for (const s in n)
2409
+ e[s] === void 0 && t.removeValue(s);
2410
+ return e;
2558
2411
  }
2559
- const Yo = Me.length;
2560
- function Ss(t) {
2561
- if (!t)
2562
- return;
2563
- if (!t.isControllingVariants) {
2564
- const n = t.parent ? Ss(t.parent) || {} : {};
2565
- return t.props.initial !== void 0 && (n.initial = t.props.initial), n;
2412
+ const ln = [
2413
+ "AnimationStart",
2414
+ "AnimationComplete",
2415
+ "Update",
2416
+ "BeforeLayoutMeasure",
2417
+ "LayoutMeasure",
2418
+ "LayoutAnimationStart",
2419
+ "LayoutAnimationComplete"
2420
+ ];
2421
+ class Lo {
2422
+ /**
2423
+ * This method takes React props and returns found MotionValues. For example, HTML
2424
+ * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
2425
+ *
2426
+ * This isn't an abstract method as it needs calling in the constructor, but it is
2427
+ * intended to be one.
2428
+ */
2429
+ scrapeMotionValuesFromProps(e, n, s) {
2430
+ return {};
2566
2431
  }
2567
- const e = {};
2568
- for (let n = 0; n < Yo; n++) {
2569
- const s = Me[n], i = t.props[s];
2570
- (ht(i) || i === !1) && (e[s] = i);
2432
+ constructor({ parent: e, props: n, presenceContext: s, reducedMotionConfig: i, blockInitialAnimation: r, visualState: o }, a = {}) {
2433
+ this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = xe, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => {
2434
+ this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection));
2435
+ }, this.renderScheduledAt = 0, this.scheduleRender = () => {
2436
+ const d = E.now();
2437
+ this.renderScheduledAt < d && (this.renderScheduledAt = d, N.render(this.render, !1, !0));
2438
+ };
2439
+ const { latestValues: c, renderState: l } = o;
2440
+ this.latestValues = c, this.baseTarget = { ...c }, this.initialValues = n.initial ? { ...c } : {}, this.renderState = l, this.parent = e, this.props = n, this.presenceContext = s, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = i, this.options = a, this.blockInitialAnimation = !!r, this.isControllingVariants = Kt(n), this.isVariantNode = ls(n), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current);
2441
+ const { willChange: u, ...f } = this.scrapeMotionValuesFromProps(n, {}, this);
2442
+ for (const d in f) {
2443
+ const h = f[d];
2444
+ c[d] !== void 0 && I(h) && h.set(c[d]);
2445
+ }
2571
2446
  }
2572
- return e;
2573
- }
2574
- const Xo = [...xe].reverse(), qo = xe.length;
2575
- function Zo(t) {
2576
- return (e) => Promise.all(e.map(({ animation: n, options: s }) => zo(t, n, s)));
2577
- }
2578
- function Jo(t) {
2579
- let e = Zo(t), n = an(), s = !0;
2580
- const i = (c) => (l, u) => {
2581
- var f;
2582
- const d = pt(t, u, c === "exit" ? (f = t.presenceContext) == null ? void 0 : f.custom : void 0);
2583
- if (d) {
2584
- const { transition: h, transitionEnd: y, ...b } = d;
2585
- l = { ...l, ...b, ...y };
2447
+ mount(e) {
2448
+ var n;
2449
+ this.current = e, ko.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((s, i) => this.bindToMotionValue(i, s)), Ss.current || Eo(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : ue.current, process.env.NODE_ENV !== "production" && Vn(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected.", "reduced-motion-disabled"), (n = this.parent) == null || n.addChild(this), this.update(this.props, this.presenceContext);
2450
+ }
2451
+ unmount() {
2452
+ var e;
2453
+ this.projection && this.projection.unmount(), Yt(this.notifyUpdate), Yt(this.render), this.valueSubscriptions.forEach((n) => n()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), (e = this.parent) == null || e.removeChild(this);
2454
+ for (const n in this.events)
2455
+ this.events[n].clear();
2456
+ for (const n in this.features) {
2457
+ const s = this.features[n];
2458
+ s && (s.unmount(), s.isMounted = !1);
2586
2459
  }
2587
- return l;
2588
- };
2589
- function r(c) {
2590
- e = c(t);
2460
+ this.current = null;
2591
2461
  }
2592
- function o(c) {
2593
- const { props: l } = t, u = Ss(t.parent) || {}, d = [], f = /* @__PURE__ */ new Set();
2594
- let h = {}, y = 1 / 0;
2595
- for (let v = 0; v < qo; v++) {
2596
- const p = Xo[v], S = n[p], m = l[p] !== void 0 ? l[p] : u[p], A = ht(m), T = p === c ? S.isActive : null;
2597
- T === !1 && (y = v);
2598
- let V = m === u[p] && m !== l[p] && A;
2599
- if (V && s && t.manuallyAnimateOnMount && (V = !1), S.protectedKeys = { ...h }, // If it isn't active and hasn't *just* been set as inactive
2600
- !S.isActive && T === null || // If we didn't and don't have any defined prop for this animation type
2601
- !m && !S.prevProp || // Or if the prop doesn't define an animation
2602
- Nt(m) || typeof m == "boolean")
2462
+ addChild(e) {
2463
+ this.children.add(e), this.enteringChildren ?? (this.enteringChildren = /* @__PURE__ */ new Set()), this.enteringChildren.add(e);
2464
+ }
2465
+ removeChild(e) {
2466
+ this.children.delete(e), this.enteringChildren && this.enteringChildren.delete(e);
2467
+ }
2468
+ bindToMotionValue(e, n) {
2469
+ this.valueSubscriptions.has(e) && this.valueSubscriptions.get(e)();
2470
+ const s = ut.has(e);
2471
+ s && this.onBindTransform && this.onBindTransform();
2472
+ const i = n.on("change", (o) => {
2473
+ this.latestValues[e] = o, this.props.onUpdate && N.preRender(this.notifyUpdate), s && this.projection && (this.projection.isTransformDirty = !0), this.scheduleRender();
2474
+ });
2475
+ let r;
2476
+ window.MotionCheckAppearSync && (r = window.MotionCheckAppearSync(this, e, n)), this.valueSubscriptions.set(e, () => {
2477
+ i(), r && r(), n.owner && n.stop();
2478
+ });
2479
+ }
2480
+ sortNodePosition(e) {
2481
+ return !this.current || !this.sortInstanceNodePosition || this.type !== e.type ? 0 : this.sortInstanceNodePosition(this.current, e.current);
2482
+ }
2483
+ updateFeatures() {
2484
+ let e = "animation";
2485
+ for (e in nt) {
2486
+ const n = nt[e];
2487
+ if (!n)
2603
2488
  continue;
2604
- const M = Qo(S.prevProp, m);
2605
- let w = M || // If we're making this variant active, we want to always make it active
2606
- p === c && S.isActive && !V && A || // If we removed a higher-priority variant (i is in reverse order)
2607
- v > y && A, F = !1;
2608
- const D = Array.isArray(m) ? m : [m];
2609
- let B = D.reduce(i(p), {});
2610
- T === !1 && (B = {});
2611
- const { prevResolvedValues: bt = {} } = S, Tt = {
2612
- ...bt,
2613
- ...B
2614
- }, vt = (P) => {
2615
- w = !0, f.has(P) && (F = !0, f.delete(P)), S.needsAnimating[P] = !0;
2616
- const O = t.getValue(P);
2617
- O && (O.liveStyle = !1);
2618
- };
2619
- for (const P in Tt) {
2620
- const O = B[P], wt = bt[P];
2621
- if (h.hasOwnProperty(P))
2622
- continue;
2623
- let Bt = !1;
2624
- re(O) && re(wt) ? Bt = !ws(O, wt) : Bt = O !== wt, Bt ? O != null ? vt(P) : f.add(P) : O !== void 0 && f.has(P) ? vt(P) : S.protectedKeys[P] = !0;
2625
- }
2626
- S.prevProp = m, S.prevResolvedValues = B, S.isActive && (h = { ...h, ...B }), s && t.blockInitialAnimation && (w = !1), w && (!(V && M) || F) && d.push(...D.map((P) => ({
2627
- animation: P,
2628
- options: { type: p }
2629
- })));
2630
- }
2631
- if (f.size) {
2632
- const v = {};
2633
- if (typeof l.initial != "boolean") {
2634
- const p = pt(t, Array.isArray(l.initial) ? l.initial[0] : l.initial);
2635
- p && p.transition && (v.transition = p.transition);
2489
+ const { isEnabled: s, Feature: i } = n;
2490
+ if (!this.features[e] && i && s(this.props) && (this.features[e] = new i(this)), this.features[e]) {
2491
+ const r = this.features[e];
2492
+ r.isMounted ? r.update() : (r.mount(), r.isMounted = !0);
2636
2493
  }
2637
- f.forEach((p) => {
2638
- const S = t.getBaseTarget(p), m = t.getValue(p);
2639
- m && (m.liveStyle = !0), v[p] = S ?? null;
2640
- }), d.push({ animation: v });
2641
2494
  }
2642
- let b = !!d.length;
2643
- return s && (l.initial === !1 || l.initial === l.animate) && !t.manuallyAnimateOnMount && (b = !1), s = !1, b ? e(d) : Promise.resolve();
2644
2495
  }
2645
- function a(c, l) {
2646
- var d;
2647
- if (n[c].isActive === l)
2648
- return Promise.resolve();
2649
- (d = t.variantChildren) == null || d.forEach((f) => {
2650
- var h;
2651
- return (h = f.animationState) == null ? void 0 : h.setActive(c, l);
2652
- }), n[c].isActive = l;
2653
- const u = o(c);
2654
- for (const f in n)
2655
- n[f].protectedKeys = {};
2656
- return u;
2496
+ triggerBuild() {
2497
+ this.build(this.renderState, this.latestValues, this.props);
2657
2498
  }
2658
- return {
2659
- animateChanges: o,
2660
- setActive: a,
2661
- setAnimateFunction: r,
2662
- getState: () => n,
2663
- reset: () => {
2664
- n = an(), s = !0;
2665
- }
2666
- };
2667
- }
2668
- function Qo(t, e) {
2669
- return typeof e == "string" ? e !== t : Array.isArray(e) ? !ws(e, t) : !1;
2670
- }
2671
- function j(t = !1) {
2672
- return {
2673
- isActive: t,
2674
- protectedKeys: {},
2675
- needsAnimating: {},
2676
- prevResolvedValues: {}
2677
- };
2678
- }
2679
- function an() {
2680
- return {
2681
- animate: j(!0),
2682
- whileInView: j(),
2683
- whileHover: j(),
2684
- whileTap: j(),
2685
- whileDrag: j(),
2686
- whileFocus: j(),
2687
- exit: j()
2688
- };
2689
- }
2690
- class rt {
2691
- constructor(e) {
2692
- this.isMounted = !1, this.node = e;
2499
+ /**
2500
+ * Measure the current viewport box with or without transforms.
2501
+ * Only measures axis-aligned boxes, rotate and skew must be manually
2502
+ * removed with a re-render to work.
2503
+ */
2504
+ measureViewportBox() {
2505
+ return this.current ? this.measureInstanceViewportBox(this.current, this.props) : ws();
2693
2506
  }
2694
- update() {
2507
+ getStaticValue(e) {
2508
+ return this.latestValues[e];
2509
+ }
2510
+ setStaticValue(e, n) {
2511
+ this.latestValues[e] = n;
2695
2512
  }
2696
- }
2697
- class ta extends rt {
2698
2513
  /**
2699
- * We dynamically generate the AnimationState manager as it contains a reference
2700
- * to the underlying animation library. We only want to load that if we load this,
2701
- * so people can optionally code split it out using the `m` component.
2514
+ * Update the provided props. Ensure any newly-added motion values are
2515
+ * added to our map, old ones removed, and listeners updated.
2702
2516
  */
2703
- constructor(e) {
2704
- super(e), e.animationState || (e.animationState = Jo(e));
2517
+ update(e, n) {
2518
+ (e.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = e, this.prevPresenceContext = this.presenceContext, this.presenceContext = n;
2519
+ for (let s = 0; s < ln.length; s++) {
2520
+ const i = ln[s];
2521
+ this.propEventSubscriptions[i] && (this.propEventSubscriptions[i](), delete this.propEventSubscriptions[i]);
2522
+ const r = "on" + i, o = e[r];
2523
+ o && (this.propEventSubscriptions[i] = this.on(i, o));
2524
+ }
2525
+ this.prevMotionValues = No(this, this.scrapeMotionValuesFromProps(e, this.prevProps, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue();
2705
2526
  }
2706
- updateAnimationControlsSubscription() {
2707
- const { animate: e } = this.node.getProps();
2708
- Nt(e) && (this.unmountControls = e.subscribe(this.node));
2527
+ getProps() {
2528
+ return this.props;
2709
2529
  }
2710
2530
  /**
2711
- * Subscribe any provided AnimationControls to the component's VisualElement
2531
+ * Returns the variant definition with a given name.
2712
2532
  */
2713
- mount() {
2714
- this.updateAnimationControlsSubscription();
2533
+ getVariant(e) {
2534
+ return this.props.variants ? this.props.variants[e] : void 0;
2715
2535
  }
2716
- update() {
2717
- const { animate: e } = this.node.getProps(), { animate: n } = this.node.prevProps || {};
2718
- e !== n && this.updateAnimationControlsSubscription();
2536
+ /**
2537
+ * Returns the defined default transition on this component.
2538
+ */
2539
+ getDefaultTransition() {
2540
+ return this.props.transition;
2719
2541
  }
2720
- unmount() {
2721
- var e;
2722
- this.node.animationState.reset(), (e = this.unmountControls) == null || e.call(this);
2542
+ getTransformPagePoint() {
2543
+ return this.props.transformPagePoint;
2723
2544
  }
2724
- }
2725
- let ea = 0;
2726
- class na extends rt {
2727
- constructor() {
2728
- super(...arguments), this.id = ea++;
2545
+ getClosestVariantNode() {
2546
+ return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0;
2729
2547
  }
2730
- update() {
2731
- if (!this.node.presenceContext)
2732
- return;
2733
- const { isPresent: e, onExitComplete: n } = this.node.presenceContext, { isPresent: s } = this.node.prevPresenceContext || {};
2734
- if (!this.node.animationState || e === s)
2735
- return;
2736
- const i = this.node.animationState.setActive("exit", !e);
2737
- n && !e && i.then(() => {
2738
- n(this.id);
2739
- });
2548
+ /**
2549
+ * Add a child visual element to our set of children.
2550
+ */
2551
+ addVariantChild(e) {
2552
+ const n = this.getClosestVariantNode();
2553
+ if (n)
2554
+ return n.variantChildren && n.variantChildren.add(e), () => n.variantChildren.delete(e);
2740
2555
  }
2741
- mount() {
2742
- const { register: e, onExitComplete: n } = this.node.presenceContext || {};
2743
- n && n(this.id), e && (this.unmount = e(this.id));
2556
+ /**
2557
+ * Add a motion value and bind it to this visual element.
2558
+ */
2559
+ addValue(e, n) {
2560
+ const s = this.values.get(e);
2561
+ n !== s && (s && this.removeValue(e), this.bindToMotionValue(e, n), this.values.set(e, n), this.latestValues[e] = n.get());
2744
2562
  }
2745
- unmount() {
2563
+ /**
2564
+ * Remove a motion value and unbind any active subscriptions.
2565
+ */
2566
+ removeValue(e) {
2567
+ this.values.delete(e);
2568
+ const n = this.valueSubscriptions.get(e);
2569
+ n && (n(), this.valueSubscriptions.delete(e)), delete this.latestValues[e], this.removeValueFromRenderState(e, this.renderState);
2746
2570
  }
2747
- }
2748
- const sa = {
2749
- animation: {
2750
- Feature: ta
2751
- },
2752
- exit: {
2753
- Feature: na
2571
+ /**
2572
+ * Check whether we have a motion value for this key
2573
+ */
2574
+ hasValue(e) {
2575
+ return this.values.has(e);
2754
2576
  }
2755
- };
2756
- function un(t, e, n, s = { passive: !0 }) {
2757
- return t.addEventListener(e, n, s), () => t.removeEventListener(e, n);
2758
- }
2759
- function Vs(t) {
2760
- return {
2761
- point: {
2762
- x: t.pageX,
2763
- y: t.pageY
2764
- }
2765
- };
2766
- }
2767
- function ia({ top: t, left: e, right: n, bottom: s }) {
2768
- return {
2769
- x: { min: e, max: n },
2770
- y: { min: t, max: s }
2771
- };
2772
- }
2773
- function ra(t, e) {
2774
- if (!e)
2775
- return t;
2776
- const n = e({ x: t.left, y: t.top }), s = e({ x: t.right, y: t.bottom });
2777
- return {
2778
- top: n.y,
2779
- left: n.x,
2780
- bottom: s.y,
2781
- right: s.x
2782
- };
2783
- }
2784
- const cn = () => ({ min: 0, max: 0 }), As = () => ({
2785
- x: cn(),
2786
- y: cn()
2787
- });
2788
- function oa(t, e) {
2789
- return ia(ra(t.getBoundingClientRect(), e));
2790
- }
2791
- function ln(t, e, n) {
2792
- const { props: s } = t;
2793
- t.animationState && s.whileHover && t.animationState.setActive("whileHover", n === "Start");
2794
- const i = "onHover" + n, r = s[i];
2795
- r && N.postRender(() => r(e, Vs(e)));
2796
- }
2797
- class aa extends rt {
2798
- mount() {
2799
- const { current: e } = this.node;
2800
- e && (this.unmount = Br(e, (n, s) => (ln(this.node, s, "Start"), (i) => ln(this.node, i, "End"))));
2577
+ getValue(e, n) {
2578
+ if (this.props.values && this.props.values[e])
2579
+ return this.props.values[e];
2580
+ let s = this.values.get(e);
2581
+ return s === void 0 && n !== void 0 && (s = It(n === null ? void 0 : n, { owner: this }), this.addValue(e, s)), s;
2801
2582
  }
2802
- unmount() {
2583
+ /**
2584
+ * If we're trying to animate to a previously unencountered value,
2585
+ * we need to check for it in our state and as a last resort read it
2586
+ * directly from the instance (which might have performance implications).
2587
+ */
2588
+ readValue(e, n) {
2589
+ let s = this.latestValues[e] !== void 0 || !this.current ? this.latestValues[e] : this.getBaseTargetFromProps(this.props, e) ?? this.readValueFromInstance(this.current, e, this.options);
2590
+ return s != null && (typeof s == "string" && (bn(s) || Tn(s)) ? s = parseFloat(s) : !Xr(s) && ot.test(n) && (s = is(e, n)), this.setBaseTarget(e, I(s) ? s.get() : s)), I(s) ? s.get() : s;
2803
2591
  }
2804
- }
2805
- class ua extends rt {
2806
- constructor() {
2807
- super(...arguments), this.isActive = !1;
2592
+ /**
2593
+ * Set the base target to later animate back to. This is currently
2594
+ * only hydrated on creation and when we first read a value.
2595
+ */
2596
+ setBaseTarget(e, n) {
2597
+ this.baseTarget[e] = n;
2808
2598
  }
2809
- onFocus() {
2810
- let e = !1;
2811
- try {
2812
- e = this.node.current.matches(":focus-visible");
2813
- } catch {
2814
- e = !0;
2599
+ /**
2600
+ * Find the base target for a value thats been removed from all animation
2601
+ * props.
2602
+ */
2603
+ getBaseTarget(e) {
2604
+ var r;
2605
+ const { initial: n } = this.props;
2606
+ let s;
2607
+ if (typeof n == "string" || typeof n == "object") {
2608
+ const o = Re(this.props, n, (r = this.presenceContext) == null ? void 0 : r.custom);
2609
+ o && (s = o[e]);
2815
2610
  }
2816
- !e || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !0), this.isActive = !0);
2611
+ if (n && s !== void 0)
2612
+ return s;
2613
+ const i = this.getBaseTargetFromProps(this.props, e);
2614
+ return i !== void 0 && !I(i) ? i : this.initialValues[e] !== void 0 && s === void 0 ? void 0 : this.baseTarget[e];
2817
2615
  }
2818
- onBlur() {
2819
- !this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1);
2616
+ on(e, n) {
2617
+ return this.events[e] || (this.events[e] = new wn()), this.events[e].add(n);
2820
2618
  }
2821
- mount() {
2822
- this.unmount = Rt(un(this.node.current, "focus", () => this.onFocus()), un(this.node.current, "blur", () => this.onBlur()));
2619
+ notify(e, ...n) {
2620
+ this.events[e] && this.events[e].notify(...n);
2823
2621
  }
2824
- unmount() {
2622
+ scheduleRenderMicrotask() {
2623
+ Kr.render(this.render);
2825
2624
  }
2826
2625
  }
2827
- function fn(t, e, n) {
2828
- const { props: s } = t;
2829
- if (t.current instanceof HTMLButtonElement && t.current.disabled)
2830
- return;
2831
- t.animationState && s.whileTap && t.animationState.setActive("whileTap", n === "Start");
2832
- const i = "onTap" + (n === "End" ? "" : n), r = s[i];
2833
- r && N.postRender(() => r(e, Vs(e)));
2834
- }
2835
- class ca extends rt {
2836
- mount() {
2837
- const { current: e } = this.node;
2838
- e && (this.unmount = _r(e, (n, s) => (fn(this.node, s, "Start"), (i, { success: r }) => fn(this.node, i, r ? "End" : "Cancel")), { useGlobalTarget: this.node.props.globalTapTarget }));
2626
+ class Vs extends Lo {
2627
+ constructor() {
2628
+ super(...arguments), this.KeyframeResolver = Er;
2839
2629
  }
2840
- unmount() {
2630
+ sortInstanceNodePosition(e, n) {
2631
+ return e.compareDocumentPosition(n) & 2 ? 1 : -1;
2632
+ }
2633
+ getBaseTargetFromProps(e, n) {
2634
+ return e.style ? e.style[n] : void 0;
2635
+ }
2636
+ removeValueFromRenderState(e, { vars: n, style: s }) {
2637
+ delete n[e], delete s[e];
2638
+ }
2639
+ handleChildMotionValue() {
2640
+ this.childSubscription && (this.childSubscription(), delete this.childSubscription);
2641
+ const { children: e } = this.props;
2642
+ I(e) && (this.childSubscription = e.on("change", (n) => {
2643
+ this.current && (this.current.textContent = `${n}`);
2644
+ }));
2841
2645
  }
2842
2646
  }
2843
- const ae = /* @__PURE__ */ new WeakMap(), Ut = /* @__PURE__ */ new WeakMap(), la = (t) => {
2844
- const e = ae.get(t.target);
2845
- e && e(t);
2846
- }, fa = (t) => {
2847
- t.forEach(la);
2848
- };
2849
- function da({ root: t, ...e }) {
2850
- const n = t || document;
2851
- Ut.has(n) || Ut.set(n, {});
2852
- const s = Ut.get(n), i = JSON.stringify(e);
2853
- return s[i] || (s[i] = new IntersectionObserver(fa, { root: t, ...e })), s[i];
2647
+ function As(t, { style: e, vars: n }, s, i) {
2648
+ const r = t.style;
2649
+ let o;
2650
+ for (o in e)
2651
+ r[o] = e[o];
2652
+ i == null || i.applyProjectionStyles(r, s);
2653
+ for (o in n)
2654
+ r.setProperty(o, n[o]);
2854
2655
  }
2855
- function ha(t, e, n) {
2856
- const s = da(e);
2857
- return ae.set(t, n), s.observe(t), () => {
2858
- ae.delete(t), s.unobserve(t);
2859
- };
2656
+ function Bo(t) {
2657
+ return window.getComputedStyle(t);
2860
2658
  }
2861
- const pa = {
2862
- some: 0,
2863
- all: 1
2864
- };
2865
- class ma extends rt {
2659
+ class Ko extends Vs {
2866
2660
  constructor() {
2867
- super(...arguments), this.hasEnteredView = !1, this.isInView = !1;
2661
+ super(...arguments), this.type = "html", this.renderInstance = As;
2868
2662
  }
2869
- startObserver() {
2870
- this.unmount();
2871
- const { viewport: e = {} } = this.node.getProps(), { root: n, margin: s, amount: i = "some", once: r } = e, o = {
2872
- root: n ? n.current : void 0,
2873
- rootMargin: s,
2874
- threshold: typeof i == "number" ? i : pa[i]
2875
- }, a = (c) => {
2876
- const { isIntersecting: l } = c;
2877
- if (this.isInView === l || (this.isInView = l, r && !l && this.hasEnteredView))
2878
- return;
2879
- l && (this.hasEnteredView = !0), this.node.animationState && this.node.animationState.setActive("whileInView", l);
2880
- const { onViewportEnter: u, onViewportLeave: d } = this.node.getProps(), f = l ? u : d;
2881
- f && f(c);
2882
- };
2883
- return ha(this.node.current, o, a);
2663
+ readValueFromInstance(e, n) {
2664
+ var s;
2665
+ if (ut.has(n))
2666
+ return (s = this.projection) != null && s.isProjecting ? ee(n) : Ji(e, n);
2667
+ {
2668
+ const i = Bo(e), r = (kn(n) ? i.getPropertyValue(n) : i[n]) || 0;
2669
+ return typeof r == "string" ? r.trim() : r;
2670
+ }
2884
2671
  }
2885
- mount() {
2886
- this.startObserver();
2672
+ measureInstanceViewportBox(e, { transformPagePoint: n }) {
2673
+ return Ro(e, n);
2887
2674
  }
2888
- update() {
2889
- if (typeof IntersectionObserver > "u")
2890
- return;
2891
- const { props: e, prevProps: n } = this.node;
2892
- ["amount", "margin", "root"].some(ga(e, n)) && this.startObserver();
2675
+ build(e, n, s) {
2676
+ Oe(e, n, s.transformTemplate);
2893
2677
  }
2894
- unmount() {
2678
+ scrapeMotionValuesFromProps(e, n, s) {
2679
+ return Ee(e, n, s);
2895
2680
  }
2896
2681
  }
2897
- function ga({ viewport: t = {} }, { viewport: e = {} } = {}) {
2898
- return (n) => t[n] !== e[n];
2682
+ const xs = /* @__PURE__ */ new Set([
2683
+ "baseFrequency",
2684
+ "diffuseConstant",
2685
+ "kernelMatrix",
2686
+ "kernelUnitLength",
2687
+ "keySplines",
2688
+ "keyTimes",
2689
+ "limitingConeAngle",
2690
+ "markerHeight",
2691
+ "markerWidth",
2692
+ "numOctaves",
2693
+ "targetX",
2694
+ "targetY",
2695
+ "surfaceScale",
2696
+ "specularConstant",
2697
+ "specularExponent",
2698
+ "stdDeviation",
2699
+ "tableValues",
2700
+ "viewBox",
2701
+ "gradientTransform",
2702
+ "pathLength",
2703
+ "startOffset",
2704
+ "textLength",
2705
+ "lengthAdjust"
2706
+ ]);
2707
+ function Wo(t, e, n, s) {
2708
+ As(t, e, void 0, s);
2709
+ for (const i in e.attrs)
2710
+ t.setAttribute(xs.has(i) ? i : ke(i), e.attrs[i]);
2899
2711
  }
2900
- const ya = {
2901
- inView: {
2902
- Feature: ma
2903
- },
2904
- tap: {
2905
- Feature: ca
2906
- },
2907
- focus: {
2908
- Feature: ua
2909
- },
2910
- hover: {
2911
- Feature: aa
2712
+ class $o extends Vs {
2713
+ constructor() {
2714
+ super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = ws;
2912
2715
  }
2913
- }, ue = { current: null }, xs = { current: !1 };
2914
- function ba() {
2915
- if (xs.current = !0, !!le)
2916
- if (window.matchMedia) {
2917
- const t = window.matchMedia("(prefers-reduced-motion)"), e = () => ue.current = t.matches;
2918
- t.addEventListener("change", e), e();
2919
- } else
2920
- ue.current = !1;
2921
- }
2922
- const Ta = /* @__PURE__ */ new WeakMap();
2923
- function va(t, e, n) {
2924
- for (const s in e) {
2925
- const i = e[s], r = n[s];
2926
- if (I(i))
2927
- t.addValue(s, i);
2928
- else if (I(r))
2929
- t.addValue(s, Ot(i, { owner: t }));
2930
- else if (r !== i)
2931
- if (t.hasValue(s)) {
2932
- const o = t.getValue(s);
2933
- o.liveStyle === !0 ? o.jump(i) : o.hasAnimated || o.set(i);
2934
- } else {
2935
- const o = t.getStaticValue(s);
2936
- t.addValue(s, Ot(o !== void 0 ? o : i, { owner: t }));
2937
- }
2716
+ getBaseTargetFromProps(e, n) {
2717
+ return e[n];
2718
+ }
2719
+ readValueFromInstance(e, n) {
2720
+ if (ut.has(n)) {
2721
+ const s = ss(n);
2722
+ return s && s.default || 0;
2723
+ }
2724
+ return n = xs.has(n) ? n : ke(n), e.getAttribute(n);
2938
2725
  }
2939
- for (const s in n)
2940
- e[s] === void 0 && t.removeValue(s);
2941
- return e;
2942
- }
2943
- const dn = [
2944
- "AnimationStart",
2945
- "AnimationComplete",
2946
- "Update",
2947
- "BeforeLayoutMeasure",
2948
- "LayoutMeasure",
2949
- "LayoutAnimationStart",
2950
- "LayoutAnimationComplete"
2951
- ];
2952
- class wa {
2953
- /**
2954
- * This method takes React props and returns found MotionValues. For example, HTML
2955
- * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
2956
- *
2957
- * This isn't an abstract method as it needs calling in the constructor, but it is
2958
- * intended to be one.
2959
- */
2960
2726
  scrapeMotionValuesFromProps(e, n, s) {
2961
- return {};
2727
+ return ys(e, n, s);
2962
2728
  }
2963
- constructor({ parent: e, props: n, presenceContext: s, reducedMotionConfig: i, blockInitialAnimation: r, visualState: o }, a = {}) {
2964
- this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = Se, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => {
2965
- this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection));
2966
- }, this.renderScheduledAt = 0, this.scheduleRender = () => {
2967
- const f = E.now();
2968
- this.renderScheduledAt < f && (this.renderScheduledAt = f, N.render(this.render, !1, !0));
2969
- };
2970
- const { latestValues: c, renderState: l } = o;
2971
- this.latestValues = c, this.baseTarget = { ...c }, this.initialValues = n.initial ? { ...c } : {}, this.renderState = l, this.parent = e, this.props = n, this.presenceContext = s, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = i, this.options = a, this.blockInitialAnimation = !!r, this.isControllingVariants = Lt(n), this.isVariantNode = cs(n), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current);
2972
- const { willChange: u, ...d } = this.scrapeMotionValuesFromProps(n, {}, this);
2973
- for (const f in d) {
2974
- const h = d[f];
2975
- c[f] !== void 0 && I(h) && h.set(c[f], !1);
2976
- }
2729
+ build(e, n, s) {
2730
+ hs(e, n, this.isSVGTag, s.transformTemplate, s.style);
2731
+ }
2732
+ renderInstance(e, n, s, i) {
2733
+ Wo(e, n, s, i);
2977
2734
  }
2978
2735
  mount(e) {
2979
- this.current = e, Ta.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((n, s) => this.bindToMotionValue(s, n)), xs.current || ba(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : ue.current, process.env.NODE_ENV !== "production" && wn(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected."), this.parent && this.parent.children.add(this), this.update(this.props, this.presenceContext);
2736
+ this.isSVGTag = ms(e.tagName), super.mount(e);
2980
2737
  }
2981
- unmount() {
2982
- this.projection && this.projection.unmount(), Ht(this.notifyUpdate), Ht(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent && this.parent.children.delete(this);
2983
- for (const e in this.events)
2984
- this.events[e].clear();
2985
- for (const e in this.features) {
2986
- const n = this.features[e];
2987
- n && (n.unmount(), n.isMounted = !1);
2988
- }
2989
- this.current = null;
2738
+ }
2739
+ const jo = (t, e) => Ie(t) ? new $o(e) : new Ko(e, {
2740
+ allowProjection: t !== gn
2741
+ });
2742
+ function tt(t, e, n) {
2743
+ const s = t.getProps();
2744
+ return Re(s, e, n !== void 0 ? n : s.custom, t);
2745
+ }
2746
+ const ce = (t) => Array.isArray(t);
2747
+ function Go(t, e, n) {
2748
+ t.hasValue(e) ? t.getValue(e).set(n) : t.addValue(e, It(n));
2749
+ }
2750
+ function _o(t) {
2751
+ return ce(t) ? t[t.length - 1] || 0 : t;
2752
+ }
2753
+ function Ho(t, e) {
2754
+ const n = tt(t, e);
2755
+ let { transitionEnd: s = {}, transition: i = {}, ...r } = n || {};
2756
+ r = { ...r, ...s };
2757
+ for (const o in r) {
2758
+ const a = _o(r[o]);
2759
+ Go(t, o, a);
2990
2760
  }
2991
- bindToMotionValue(e, n) {
2992
- this.valueSubscriptions.has(e) && this.valueSubscriptions.get(e)();
2993
- const s = it.has(e);
2994
- s && this.onBindTransform && this.onBindTransform();
2995
- const i = n.on("change", (a) => {
2996
- this.latestValues[e] = a, this.props.onUpdate && N.preRender(this.notifyUpdate), s && this.projection && (this.projection.isTransformDirty = !0);
2997
- }), r = n.on("renderRequest", this.scheduleRender);
2998
- let o;
2999
- window.MotionCheckAppearSync && (o = window.MotionCheckAppearSync(this, e, n)), this.valueSubscriptions.set(e, () => {
3000
- i(), r(), o && o(), n.owner && n.stop();
3001
- });
2761
+ }
2762
+ function Uo(t) {
2763
+ return !!(I(t) && t.add);
2764
+ }
2765
+ function zo(t, e) {
2766
+ const n = t.getValue("willChange");
2767
+ if (Uo(n))
2768
+ return n.add(e);
2769
+ if (!n && $.WillChange) {
2770
+ const s = new $.WillChange("auto");
2771
+ t.addValue("willChange", s), s.add(e);
3002
2772
  }
3003
- sortNodePosition(e) {
3004
- return !this.current || !this.sortInstanceNodePosition || this.type !== e.type ? 0 : this.sortInstanceNodePosition(this.current, e.current);
2773
+ }
2774
+ function Yo(t) {
2775
+ return t.props[Ts];
2776
+ }
2777
+ const Xo = (t) => t !== null;
2778
+ function qo(t, { repeat: e, repeatType: n = "loop" }, s) {
2779
+ const i = t.filter(Xo), r = e && n !== "loop" && e % 2 === 1 ? 0 : i.length - 1;
2780
+ return i[r];
2781
+ }
2782
+ const Zo = {
2783
+ type: "spring",
2784
+ stiffness: 500,
2785
+ damping: 25,
2786
+ restSpeed: 10
2787
+ }, Jo = (t) => ({
2788
+ type: "spring",
2789
+ stiffness: 550,
2790
+ damping: t === 0 ? 2 * Math.sqrt(550) : 30,
2791
+ restSpeed: 10
2792
+ }), Qo = {
2793
+ type: "keyframes",
2794
+ duration: 0.8
2795
+ }, ta = {
2796
+ type: "keyframes",
2797
+ ease: [0.25, 0.1, 0.35, 1],
2798
+ duration: 0.3
2799
+ }, ea = (t, { keyframes: e }) => e.length > 2 ? Qo : ut.has(t) ? t.startsWith("scale") ? Jo(e[1]) : Zo : ta;
2800
+ function na({ when: t, delay: e, delayChildren: n, staggerChildren: s, staggerDirection: i, repeat: r, repeatType: o, repeatDelay: a, from: c, elapsed: l, ...u }) {
2801
+ return !!Object.keys(u).length;
2802
+ }
2803
+ const sa = (t, e, n, s = {}, i, r) => (o) => {
2804
+ const a = Qn(s, t) || {}, c = a.delay || s.delay || 0;
2805
+ let { elapsed: l = 0 } = s;
2806
+ l = l - /* @__PURE__ */ L(c);
2807
+ const u = {
2808
+ keyframes: Array.isArray(n) ? n : [null, n],
2809
+ ease: "easeOut",
2810
+ velocity: e.getVelocity(),
2811
+ ...a,
2812
+ delay: -l,
2813
+ onUpdate: (d) => {
2814
+ e.set(d), a.onUpdate && a.onUpdate(d);
2815
+ },
2816
+ onComplete: () => {
2817
+ o(), a.onComplete && a.onComplete();
2818
+ },
2819
+ name: t,
2820
+ motionValue: e,
2821
+ element: r ? void 0 : i
2822
+ };
2823
+ na(a) || Object.assign(u, ea(t, u)), u.duration && (u.duration = /* @__PURE__ */ L(u.duration)), u.repeatDelay && (u.repeatDelay = /* @__PURE__ */ L(u.repeatDelay)), u.from !== void 0 && (u.keyframes[0] = u.from);
2824
+ let f = !1;
2825
+ if ((u.type === !1 || u.duration === 0 && !u.repeatDelay) && (oe(u), u.delay === 0 && (f = !0)), ($.instantAnimations || $.skipAnimations) && (f = !0, oe(u), u.delay = 0), u.allowFlatten = !a.type && !a.ease, f && !r && e.get() !== void 0) {
2826
+ const d = qo(u.keyframes, a);
2827
+ if (d !== void 0) {
2828
+ N.update(() => {
2829
+ u.onUpdate(d), u.onComplete();
2830
+ });
2831
+ return;
2832
+ }
3005
2833
  }
3006
- updateFeatures() {
3007
- let e = "animation";
3008
- for (e in J) {
3009
- const n = J[e];
3010
- if (!n)
3011
- continue;
3012
- const { isEnabled: s, Feature: i } = n;
3013
- if (!this.features[e] && i && s(this.props) && (this.features[e] = new i(this)), this.features[e]) {
3014
- const r = this.features[e];
3015
- r.isMounted ? r.update() : (r.mount(), r.isMounted = !0);
2834
+ return a.isSync ? new Ae(u) : new wr(u);
2835
+ };
2836
+ function ia({ protectedKeys: t, needsAnimating: e }, n) {
2837
+ const s = t.hasOwnProperty(n) && e[n] !== !0;
2838
+ return e[n] = !1, s;
2839
+ }
2840
+ function Ms(t, e, { delay: n = 0, transitionOverride: s, type: i } = {}) {
2841
+ let { transition: r = t.getDefaultTransition(), transitionEnd: o, ...a } = e;
2842
+ s && (r = s);
2843
+ const c = [], l = i && t.animationState && t.animationState.getState()[i];
2844
+ for (const u in a) {
2845
+ const f = t.getValue(u, t.latestValues[u] ?? null), d = a[u];
2846
+ if (d === void 0 || l && ia(l, u))
2847
+ continue;
2848
+ const h = {
2849
+ delay: n,
2850
+ ...Qn(r || {}, u)
2851
+ }, y = f.get();
2852
+ if (y !== void 0 && !f.isAnimating && !Array.isArray(d) && d === y && !h.velocity)
2853
+ continue;
2854
+ let b = !1;
2855
+ if (window.MotionHandoffAnimation) {
2856
+ const p = Yo(t);
2857
+ if (p) {
2858
+ const S = window.MotionHandoffAnimation(p, u, N);
2859
+ S !== null && (h.startTime = S, b = !0);
3016
2860
  }
3017
2861
  }
2862
+ zo(t, u), f.start(sa(u, f, d, t.shouldReduceMotion && ts.has(u) ? { type: !1 } : h, t, b));
2863
+ const v = f.animation;
2864
+ v && c.push(v);
3018
2865
  }
3019
- triggerBuild() {
3020
- this.build(this.renderState, this.latestValues, this.props);
3021
- }
3022
- /**
3023
- * Measure the current viewport box with or without transforms.
3024
- * Only measures axis-aligned boxes, rotate and skew must be manually
3025
- * removed with a re-render to work.
3026
- */
3027
- measureViewportBox() {
3028
- return this.current ? this.measureInstanceViewportBox(this.current, this.props) : As();
2866
+ return o && Promise.all(c).then(() => {
2867
+ N.update(() => {
2868
+ o && Ho(t, o);
2869
+ });
2870
+ }), c;
2871
+ }
2872
+ function Cs(t, e, n, s = 0, i = 1) {
2873
+ const r = Array.from(t).sort((l, u) => l.sortNodePosition(u)).indexOf(e), o = t.size, a = (o - 1) * s;
2874
+ return typeof n == "function" ? n(r, o) : i === 1 ? r * s : a - r * s;
2875
+ }
2876
+ function le(t, e, n = {}) {
2877
+ var c;
2878
+ const s = tt(t, e, n.type === "exit" ? (c = t.presenceContext) == null ? void 0 : c.custom : void 0);
2879
+ let { transition: i = t.getDefaultTransition() || {} } = s || {};
2880
+ n.transitionOverride && (i = n.transitionOverride);
2881
+ const r = s ? () => Promise.all(Ms(t, s, n)) : () => Promise.resolve(), o = t.variantChildren && t.variantChildren.size ? (l = 0) => {
2882
+ const { delayChildren: u = 0, staggerChildren: f, staggerDirection: d } = i;
2883
+ return ra(t, e, l, u, f, d, n);
2884
+ } : () => Promise.resolve(), { when: a } = i;
2885
+ if (a) {
2886
+ const [l, u] = a === "beforeChildren" ? [r, o] : [o, r];
2887
+ return l().then(() => u());
2888
+ } else
2889
+ return Promise.all([r(), o(n.delay)]);
2890
+ }
2891
+ function ra(t, e, n = 0, s = 0, i = 0, r = 1, o) {
2892
+ const a = [];
2893
+ for (const c of t.variantChildren)
2894
+ c.notify("AnimationStart", e), a.push(le(c, e, {
2895
+ ...o,
2896
+ delay: n + (typeof s == "function" ? 0 : s) + Cs(t.variantChildren, c, s, i, r)
2897
+ }).then(() => c.notify("AnimationComplete", e)));
2898
+ return Promise.all(a);
2899
+ }
2900
+ function oa(t, e, n = {}) {
2901
+ t.notify("AnimationStart", e);
2902
+ let s;
2903
+ if (Array.isArray(e)) {
2904
+ const i = e.map((r) => le(t, r, n));
2905
+ s = Promise.all(i);
2906
+ } else if (typeof e == "string")
2907
+ s = le(t, e, n);
2908
+ else {
2909
+ const i = typeof e == "function" ? tt(t, e, n.custom) : e;
2910
+ s = Promise.all(Ms(t, i, n));
3029
2911
  }
3030
- getStaticValue(e) {
3031
- return this.latestValues[e];
2912
+ return s.then(() => {
2913
+ t.notify("AnimationComplete", e);
2914
+ });
2915
+ }
2916
+ function Ps(t, e) {
2917
+ if (!Array.isArray(e))
2918
+ return !1;
2919
+ const n = e.length;
2920
+ if (n !== t.length)
2921
+ return !1;
2922
+ for (let s = 0; s < n; s++)
2923
+ if (e[s] !== t[s])
2924
+ return !1;
2925
+ return !0;
2926
+ }
2927
+ const aa = Fe.length;
2928
+ function Fs(t) {
2929
+ if (!t)
2930
+ return;
2931
+ if (!t.isControllingVariants) {
2932
+ const n = t.parent ? Fs(t.parent) || {} : {};
2933
+ return t.props.initial !== void 0 && (n.initial = t.props.initial), n;
3032
2934
  }
3033
- setStaticValue(e, n) {
3034
- this.latestValues[e] = n;
2935
+ const e = {};
2936
+ for (let n = 0; n < aa; n++) {
2937
+ const s = Fe[n], i = t.props[s];
2938
+ (gt(i) || i === !1) && (e[s] = i);
3035
2939
  }
3036
- /**
3037
- * Update the provided props. Ensure any newly-added motion values are
3038
- * added to our map, old ones removed, and listeners updated.
3039
- */
3040
- update(e, n) {
3041
- (e.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = e, this.prevPresenceContext = this.presenceContext, this.presenceContext = n;
3042
- for (let s = 0; s < dn.length; s++) {
3043
- const i = dn[s];
3044
- this.propEventSubscriptions[i] && (this.propEventSubscriptions[i](), delete this.propEventSubscriptions[i]);
3045
- const r = "on" + i, o = e[r];
3046
- o && (this.propEventSubscriptions[i] = this.on(i, o));
2940
+ return e;
2941
+ }
2942
+ const ua = [...Pe].reverse(), ca = Pe.length;
2943
+ function la(t) {
2944
+ return (e) => Promise.all(e.map(({ animation: n, options: s }) => oa(t, n, s)));
2945
+ }
2946
+ function fa(t) {
2947
+ let e = la(t), n = fn(), s = !0;
2948
+ const i = (c) => (l, u) => {
2949
+ var d;
2950
+ const f = tt(t, u, c === "exit" ? (d = t.presenceContext) == null ? void 0 : d.custom : void 0);
2951
+ if (f) {
2952
+ const { transition: h, transitionEnd: y, ...b } = f;
2953
+ l = { ...l, ...b, ...y };
3047
2954
  }
3048
- this.prevMotionValues = va(this, this.scrapeMotionValuesFromProps(e, this.prevProps, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue();
3049
- }
3050
- getProps() {
3051
- return this.props;
3052
- }
3053
- /**
3054
- * Returns the variant definition with a given name.
3055
- */
3056
- getVariant(e) {
3057
- return this.props.variants ? this.props.variants[e] : void 0;
3058
- }
3059
- /**
3060
- * Returns the defined default transition on this component.
3061
- */
3062
- getDefaultTransition() {
3063
- return this.props.transition;
3064
- }
3065
- getTransformPagePoint() {
3066
- return this.props.transformPagePoint;
3067
- }
3068
- getClosestVariantNode() {
3069
- return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0;
3070
- }
3071
- /**
3072
- * Add a child visual element to our set of children.
3073
- */
3074
- addVariantChild(e) {
3075
- const n = this.getClosestVariantNode();
3076
- if (n)
3077
- return n.variantChildren && n.variantChildren.add(e), () => n.variantChildren.delete(e);
2955
+ return l;
2956
+ };
2957
+ function r(c) {
2958
+ e = c(t);
3078
2959
  }
3079
- /**
3080
- * Add a motion value and bind it to this visual element.
3081
- */
3082
- addValue(e, n) {
3083
- const s = this.values.get(e);
3084
- n !== s && (s && this.removeValue(e), this.bindToMotionValue(e, n), this.values.set(e, n), this.latestValues[e] = n.get());
2960
+ function o(c) {
2961
+ const { props: l } = t, u = Fs(t.parent) || {}, f = [], d = /* @__PURE__ */ new Set();
2962
+ let h = {}, y = 1 / 0;
2963
+ for (let v = 0; v < ca; v++) {
2964
+ const p = ua[v], S = n[p], m = l[p] !== void 0 ? l[p] : u[p], A = gt(m), T = p === c ? S.isActive : null;
2965
+ T === !1 && (y = v);
2966
+ let V = m === u[p] && m !== l[p] && A;
2967
+ if (V && s && t.manuallyAnimateOnMount && (V = !1), S.protectedKeys = { ...h }, // If it isn't active and hasn't *just* been set as inactive
2968
+ !S.isActive && T === null || // If we didn't and don't have any defined prop for this animation type
2969
+ !m && !S.prevProp || // Or if the prop doesn't define an animation
2970
+ Bt(m) || typeof m == "boolean")
2971
+ continue;
2972
+ const M = da(S.prevProp, m);
2973
+ let w = M || // If we're making this variant active, we want to always make it active
2974
+ p === c && S.isActive && !V && A || // If we removed a higher-priority variant (i is in reverse order)
2975
+ v > y && A, O = !1;
2976
+ const D = Array.isArray(m) ? m : [m];
2977
+ let B = D.reduce(i(p), {});
2978
+ T === !1 && (B = {});
2979
+ const { prevResolvedValues: vt = {} } = S, wt = {
2980
+ ...vt,
2981
+ ...B
2982
+ }, St = (F) => {
2983
+ w = !0, d.has(F) && (O = !0, d.delete(F)), S.needsAnimating[F] = !0;
2984
+ const C = t.getValue(F);
2985
+ C && (C.liveStyle = !1);
2986
+ };
2987
+ for (const F in wt) {
2988
+ const C = B[F], K = vt[F];
2989
+ if (h.hasOwnProperty(F))
2990
+ continue;
2991
+ let q = !1;
2992
+ ce(C) && ce(K) ? q = !Ps(C, K) : q = C !== K, q ? C != null ? St(F) : d.add(F) : C !== void 0 && d.has(F) ? St(F) : S.protectedKeys[F] = !0;
2993
+ }
2994
+ S.prevProp = m, S.prevResolvedValues = B, S.isActive && (h = { ...h, ...B }), s && t.blockInitialAnimation && (w = !1);
2995
+ const Vt = V && M;
2996
+ w && (!Vt || O) && f.push(...D.map((F) => {
2997
+ const C = { type: p };
2998
+ if (typeof F == "string" && s && !Vt && t.manuallyAnimateOnMount && t.parent) {
2999
+ const { parent: K } = t, q = tt(K, F);
3000
+ if (K.enteringChildren && q) {
3001
+ const { delayChildren: Is } = q.transition || {};
3002
+ C.delay = Cs(K.enteringChildren, t, Is);
3003
+ }
3004
+ }
3005
+ return {
3006
+ animation: F,
3007
+ options: C
3008
+ };
3009
+ }));
3010
+ }
3011
+ if (d.size) {
3012
+ const v = {};
3013
+ if (typeof l.initial != "boolean") {
3014
+ const p = tt(t, Array.isArray(l.initial) ? l.initial[0] : l.initial);
3015
+ p && p.transition && (v.transition = p.transition);
3016
+ }
3017
+ d.forEach((p) => {
3018
+ const S = t.getBaseTarget(p), m = t.getValue(p);
3019
+ m && (m.liveStyle = !0), v[p] = S ?? null;
3020
+ }), f.push({ animation: v });
3021
+ }
3022
+ let b = !!f.length;
3023
+ return s && (l.initial === !1 || l.initial === l.animate) && !t.manuallyAnimateOnMount && (b = !1), s = !1, b ? e(f) : Promise.resolve();
3085
3024
  }
3086
- /**
3087
- * Remove a motion value and unbind any active subscriptions.
3088
- */
3089
- removeValue(e) {
3090
- this.values.delete(e);
3091
- const n = this.valueSubscriptions.get(e);
3092
- n && (n(), this.valueSubscriptions.delete(e)), delete this.latestValues[e], this.removeValueFromRenderState(e, this.renderState);
3025
+ function a(c, l) {
3026
+ var f;
3027
+ if (n[c].isActive === l)
3028
+ return Promise.resolve();
3029
+ (f = t.variantChildren) == null || f.forEach((d) => {
3030
+ var h;
3031
+ return (h = d.animationState) == null ? void 0 : h.setActive(c, l);
3032
+ }), n[c].isActive = l;
3033
+ const u = o(c);
3034
+ for (const d in n)
3035
+ n[d].protectedKeys = {};
3036
+ return u;
3093
3037
  }
3094
- /**
3095
- * Check whether we have a motion value for this key
3096
- */
3097
- hasValue(e) {
3098
- return this.values.has(e);
3038
+ return {
3039
+ animateChanges: o,
3040
+ setActive: a,
3041
+ setAnimateFunction: r,
3042
+ getState: () => n,
3043
+ reset: () => {
3044
+ n = fn(), s = !0;
3045
+ }
3046
+ };
3047
+ }
3048
+ function da(t, e) {
3049
+ return typeof e == "string" ? e !== t : Array.isArray(e) ? !Ps(e, t) : !1;
3050
+ }
3051
+ function G(t = !1) {
3052
+ return {
3053
+ isActive: t,
3054
+ protectedKeys: {},
3055
+ needsAnimating: {},
3056
+ prevResolvedValues: {}
3057
+ };
3058
+ }
3059
+ function fn() {
3060
+ return {
3061
+ animate: G(!0),
3062
+ whileInView: G(),
3063
+ whileHover: G(),
3064
+ whileTap: G(),
3065
+ whileDrag: G(),
3066
+ whileFocus: G(),
3067
+ exit: G()
3068
+ };
3069
+ }
3070
+ class ct {
3071
+ constructor(e) {
3072
+ this.isMounted = !1, this.node = e;
3099
3073
  }
3100
- getValue(e, n) {
3101
- if (this.props.values && this.props.values[e])
3102
- return this.props.values[e];
3103
- let s = this.values.get(e);
3104
- return s === void 0 && n !== void 0 && (s = Ot(n === null ? void 0 : n, { owner: this }), this.addValue(e, s)), s;
3074
+ update() {
3105
3075
  }
3076
+ }
3077
+ class ha extends ct {
3106
3078
  /**
3107
- * If we're trying to animate to a previously unencountered value,
3108
- * we need to check for it in our state and as a last resort read it
3109
- * directly from the instance (which might have performance implications).
3079
+ * We dynamically generate the AnimationState manager as it contains a reference
3080
+ * to the underlying animation library. We only want to load that if we load this,
3081
+ * so people can optionally code split it out using the `m` component.
3110
3082
  */
3111
- readValue(e, n) {
3112
- let s = this.latestValues[e] !== void 0 || !this.current ? this.latestValues[e] : this.getBaseTargetFromProps(this.props, e) ?? this.readValueFromInstance(this.current, e, this.options);
3113
- return s != null && (typeof s == "string" && (gn(s) || yn(s)) ? s = parseFloat(s) : !Ur(s) && nt.test(n) && (s = ss(e, n)), this.setBaseTarget(e, I(s) ? s.get() : s)), I(s) ? s.get() : s;
3083
+ constructor(e) {
3084
+ super(e), e.animationState || (e.animationState = fa(e));
3114
3085
  }
3115
- /**
3116
- * Set the base target to later animate back to. This is currently
3117
- * only hydrated on creation and when we first read a value.
3118
- */
3119
- setBaseTarget(e, n) {
3120
- this.baseTarget[e] = n;
3086
+ updateAnimationControlsSubscription() {
3087
+ const { animate: e } = this.node.getProps();
3088
+ Bt(e) && (this.unmountControls = e.subscribe(this.node));
3121
3089
  }
3122
3090
  /**
3123
- * Find the base target for a value thats been removed from all animation
3124
- * props.
3091
+ * Subscribe any provided AnimationControls to the component's VisualElement
3125
3092
  */
3126
- getBaseTarget(e) {
3127
- var r;
3128
- const { initial: n } = this.props;
3129
- let s;
3130
- if (typeof n == "string" || typeof n == "object") {
3131
- const o = De(this.props, n, (r = this.presenceContext) == null ? void 0 : r.custom);
3132
- o && (s = o[e]);
3133
- }
3134
- if (n && s !== void 0)
3135
- return s;
3136
- const i = this.getBaseTargetFromProps(this.props, e);
3137
- return i !== void 0 && !I(i) ? i : this.initialValues[e] !== void 0 && s === void 0 ? void 0 : this.baseTarget[e];
3093
+ mount() {
3094
+ this.updateAnimationControlsSubscription();
3138
3095
  }
3139
- on(e, n) {
3140
- return this.events[e] || (this.events[e] = new Tn()), this.events[e].add(n);
3096
+ update() {
3097
+ const { animate: e } = this.node.getProps(), { animate: n } = this.node.prevProps || {};
3098
+ e !== n && this.updateAnimationControlsSubscription();
3141
3099
  }
3142
- notify(e, ...n) {
3143
- this.events[e] && this.events[e].notify(...n);
3100
+ unmount() {
3101
+ var e;
3102
+ this.node.animationState.reset(), (e = this.unmountControls) == null || e.call(this);
3144
3103
  }
3145
3104
  }
3146
- class Ms extends wa {
3105
+ let pa = 0;
3106
+ class ma extends ct {
3147
3107
  constructor() {
3148
- super(...arguments), this.KeyframeResolver = Dr;
3108
+ super(...arguments), this.id = pa++;
3149
3109
  }
3150
- sortInstanceNodePosition(e, n) {
3151
- return e.compareDocumentPosition(n) & 2 ? 1 : -1;
3110
+ update() {
3111
+ if (!this.node.presenceContext)
3112
+ return;
3113
+ const { isPresent: e, onExitComplete: n } = this.node.presenceContext, { isPresent: s } = this.node.prevPresenceContext || {};
3114
+ if (!this.node.animationState || e === s)
3115
+ return;
3116
+ const i = this.node.animationState.setActive("exit", !e);
3117
+ n && !e && i.then(() => {
3118
+ n(this.id);
3119
+ });
3152
3120
  }
3153
- getBaseTargetFromProps(e, n) {
3154
- return e.style ? e.style[n] : void 0;
3121
+ mount() {
3122
+ const { register: e, onExitComplete: n } = this.node.presenceContext || {};
3123
+ n && n(this.id), e && (this.unmount = e(this.id));
3155
3124
  }
3156
- removeValueFromRenderState(e, { vars: n, style: s }) {
3157
- delete n[e], delete s[e];
3125
+ unmount() {
3158
3126
  }
3159
- handleChildMotionValue() {
3160
- this.childSubscription && (this.childSubscription(), delete this.childSubscription);
3161
- const { children: e } = this.props;
3162
- I(e) && (this.childSubscription = e.on("change", (n) => {
3163
- this.current && (this.current.textContent = `${n}`);
3164
- }));
3127
+ }
3128
+ const ga = {
3129
+ animation: {
3130
+ Feature: ha
3131
+ },
3132
+ exit: {
3133
+ Feature: ma
3165
3134
  }
3135
+ };
3136
+ function dn(t, e, n, s = { passive: !0 }) {
3137
+ return t.addEventListener(e, n, s), () => t.removeEventListener(e, n);
3166
3138
  }
3167
- function Cs(t, { style: e, vars: n }, s, i) {
3168
- const r = t.style;
3169
- let o;
3170
- for (o in e)
3171
- r[o] = e[o];
3172
- i == null || i.applyProjectionStyles(r, s);
3173
- for (o in n)
3174
- r.setProperty(o, n[o]);
3139
+ function Os(t) {
3140
+ return {
3141
+ point: {
3142
+ x: t.pageX,
3143
+ y: t.pageY
3144
+ }
3145
+ };
3175
3146
  }
3176
- function Sa(t) {
3177
- return window.getComputedStyle(t);
3147
+ function hn(t, e, n) {
3148
+ const { props: s } = t;
3149
+ t.animationState && s.whileHover && t.animationState.setActive("whileHover", n === "Start");
3150
+ const i = "onHover" + n, r = s[i];
3151
+ r && N.postRender(() => r(e, Os(e)));
3178
3152
  }
3179
- class Va extends Ms {
3153
+ class ya extends ct {
3154
+ mount() {
3155
+ const { current: e } = this.node;
3156
+ e && (this.unmount = jr(e, (n, s) => (hn(this.node, s, "Start"), (i) => hn(this.node, i, "End"))));
3157
+ }
3158
+ unmount() {
3159
+ }
3160
+ }
3161
+ class ba extends ct {
3180
3162
  constructor() {
3181
- super(...arguments), this.type = "html", this.renderInstance = Cs;
3163
+ super(...arguments), this.isActive = !1;
3182
3164
  }
3183
- readValueFromInstance(e, n) {
3184
- var s;
3185
- if (it.has(n))
3186
- return (s = this.projection) != null && s.isProjecting ? Qt(n) : Xi(e, n);
3187
- {
3188
- const i = Sa(e), r = (Rn(n) ? i.getPropertyValue(n) : i[n]) || 0;
3189
- return typeof r == "string" ? r.trim() : r;
3165
+ onFocus() {
3166
+ let e = !1;
3167
+ try {
3168
+ e = this.node.current.matches(":focus-visible");
3169
+ } catch {
3170
+ e = !0;
3190
3171
  }
3172
+ !e || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !0), this.isActive = !0);
3191
3173
  }
3192
- measureInstanceViewportBox(e, { transformPagePoint: n }) {
3193
- return oa(e, n);
3174
+ onBlur() {
3175
+ !this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1);
3194
3176
  }
3195
- build(e, n, s) {
3196
- Pe(e, n, s.transformTemplate);
3177
+ mount() {
3178
+ this.unmount = kt(dn(this.node.current, "focus", () => this.onFocus()), dn(this.node.current, "blur", () => this.onBlur()));
3197
3179
  }
3198
- scrapeMotionValuesFromProps(e, n, s) {
3199
- return Ie(e, n, s);
3180
+ unmount() {
3200
3181
  }
3201
3182
  }
3202
- const Ps = /* @__PURE__ */ new Set([
3203
- "baseFrequency",
3204
- "diffuseConstant",
3205
- "kernelMatrix",
3206
- "kernelUnitLength",
3207
- "keySplines",
3208
- "keyTimes",
3209
- "limitingConeAngle",
3210
- "markerHeight",
3211
- "markerWidth",
3212
- "numOctaves",
3213
- "targetX",
3214
- "targetY",
3215
- "surfaceScale",
3216
- "specularConstant",
3217
- "specularExponent",
3218
- "stdDeviation",
3219
- "tableValues",
3220
- "viewBox",
3221
- "gradientTransform",
3222
- "pathLength",
3223
- "startOffset",
3224
- "textLength",
3225
- "lengthAdjust"
3226
- ]);
3227
- function Aa(t, e, n, s) {
3228
- Cs(t, e, void 0, s);
3229
- for (const i in e.attrs)
3230
- t.setAttribute(Ps.has(i) ? i : Ce(i), e.attrs[i]);
3183
+ function pn(t, e, n) {
3184
+ const { props: s } = t;
3185
+ if (t.current instanceof HTMLButtonElement && t.current.disabled)
3186
+ return;
3187
+ t.animationState && s.whileTap && t.animationState.setActive("whileTap", n === "Start");
3188
+ const i = "onTap" + (n === "End" ? "" : n), r = s[i];
3189
+ r && N.postRender(() => r(e, Os(e)));
3231
3190
  }
3232
- class xa extends Ms {
3233
- constructor() {
3234
- super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = As;
3191
+ class Ta extends ct {
3192
+ mount() {
3193
+ const { current: e } = this.node;
3194
+ e && (this.unmount = zr(e, (n, s) => (pn(this.node, s, "Start"), (i, { success: r }) => pn(this.node, i, r ? "End" : "Cancel")), { useGlobalTarget: this.node.props.globalTapTarget }));
3235
3195
  }
3236
- getBaseTargetFromProps(e, n) {
3237
- return e[n];
3196
+ unmount() {
3238
3197
  }
3239
- readValueFromInstance(e, n) {
3240
- if (it.has(n)) {
3241
- const s = ns(n);
3242
- return s && s.default || 0;
3243
- }
3244
- return n = Ps.has(n) ? n : Ce(n), e.getAttribute(n);
3198
+ }
3199
+ const fe = /* @__PURE__ */ new WeakMap(), Ut = /* @__PURE__ */ new WeakMap(), va = (t) => {
3200
+ const e = fe.get(t.target);
3201
+ e && e(t);
3202
+ }, wa = (t) => {
3203
+ t.forEach(va);
3204
+ };
3205
+ function Sa({ root: t, ...e }) {
3206
+ const n = t || document;
3207
+ Ut.has(n) || Ut.set(n, {});
3208
+ const s = Ut.get(n), i = JSON.stringify(e);
3209
+ return s[i] || (s[i] = new IntersectionObserver(wa, { root: t, ...e })), s[i];
3210
+ }
3211
+ function Va(t, e, n) {
3212
+ const s = Sa(e);
3213
+ return fe.set(t, n), s.observe(t), () => {
3214
+ fe.delete(t), s.unobserve(t);
3215
+ };
3216
+ }
3217
+ const Aa = {
3218
+ some: 0,
3219
+ all: 1
3220
+ };
3221
+ class xa extends ct {
3222
+ constructor() {
3223
+ super(...arguments), this.hasEnteredView = !1, this.isInView = !1;
3245
3224
  }
3246
- scrapeMotionValuesFromProps(e, n, s) {
3247
- return Ts(e, n, s);
3225
+ startObserver() {
3226
+ this.unmount();
3227
+ const { viewport: e = {} } = this.node.getProps(), { root: n, margin: s, amount: i = "some", once: r } = e, o = {
3228
+ root: n ? n.current : void 0,
3229
+ rootMargin: s,
3230
+ threshold: typeof i == "number" ? i : Aa[i]
3231
+ }, a = (c) => {
3232
+ const { isIntersecting: l } = c;
3233
+ if (this.isInView === l || (this.isInView = l, r && !l && this.hasEnteredView))
3234
+ return;
3235
+ l && (this.hasEnteredView = !0), this.node.animationState && this.node.animationState.setActive("whileInView", l);
3236
+ const { onViewportEnter: u, onViewportLeave: f } = this.node.getProps(), d = l ? u : f;
3237
+ d && d(c);
3238
+ };
3239
+ return Va(this.node.current, o, a);
3248
3240
  }
3249
- build(e, n, s) {
3250
- ms(e, n, this.isSVGTag, s.transformTemplate, s.style);
3241
+ mount() {
3242
+ this.startObserver();
3251
3243
  }
3252
- renderInstance(e, n, s, i) {
3253
- Aa(e, n, s, i);
3244
+ update() {
3245
+ if (typeof IntersectionObserver > "u")
3246
+ return;
3247
+ const { props: e, prevProps: n } = this.node;
3248
+ ["amount", "margin", "root"].some(Ma(e, n)) && this.startObserver();
3254
3249
  }
3255
- mount(e) {
3256
- this.isSVGTag = ys(e.tagName), super.mount(e);
3250
+ unmount() {
3251
+ }
3252
+ }
3253
+ function Ma({ viewport: t = {} }, { viewport: e = {} } = {}) {
3254
+ return (n) => t[n] !== e[n];
3255
+ }
3256
+ const Ca = {
3257
+ inView: {
3258
+ Feature: xa
3259
+ },
3260
+ tap: {
3261
+ Feature: Ta
3262
+ },
3263
+ focus: {
3264
+ Feature: ba
3265
+ },
3266
+ hover: {
3267
+ Feature: ya
3257
3268
  }
3269
+ }, Pa = {
3270
+ renderer: jo,
3271
+ ...ga,
3272
+ ...Ca
3273
+ };
3274
+ function Fa(t, e) {
3275
+ return Co(t, e);
3258
3276
  }
3259
- const Ma = (t, e) => Oe(t) ? new xa(e) : new Va(e, {
3260
- allowProjection: t !== pn
3261
- }), Ca = {
3262
- renderer: Ma,
3263
- ...sa,
3264
- ...ya
3265
- }, Pa = /* @__PURE__ */ Po("div"), Fa = {
3277
+ const Oa = /* @__PURE__ */ Fa("div"), Da = {
3266
3278
  light: {
3267
3279
  border: "px",
3268
3280
  shadow: "2"
3269
3281
  },
3270
3282
  dark: {}
3271
- }, Fs = lt.createContext({
3283
+ }, Ds = et.createContext({
3272
3284
  groupOpen: !1,
3273
3285
  setGroupOpen: () => {
3274
3286
  }
3275
- }), Oa = ({ open: t, delay: e = 600 }) => {
3276
- const n = lt.useContext(Fs);
3277
- return lt.useEffect(() => {
3287
+ }), Ia = ({ open: t, delay: e = 600 }) => {
3288
+ const n = et.useContext(Ds);
3289
+ return et.useEffect(() => {
3278
3290
  let s = null;
3279
3291
  return n.setGroupOpen && (t === !0 && n.setGroupOpen(!0), t === !1 && (s = setTimeout(() => {
3280
3292
  n.setGroupOpen && n.setGroupOpen(!1);
@@ -3284,10 +3296,10 @@ const Ma = (t, e) => Oe(t) ? new xa(e) : new Va(e, {
3284
3296
  }, [t, n, e]), {
3285
3297
  groupOpen: n.groupOpen
3286
3298
  };
3287
- }, Ba = ({ children: t }) => {
3288
- const [e, n] = lt.useState(!1);
3289
- return /* @__PURE__ */ R(Fs.Provider, { value: { groupOpen: e, setGroupOpen: n }, children: t });
3290
- }, Ka = ({
3299
+ }, Wa = ({ children: t }) => {
3300
+ const [e, n] = et.useState(!1);
3301
+ return /* @__PURE__ */ R(Ds.Provider, { value: { groupOpen: e, setGroupOpen: n }, children: t });
3302
+ }, $a = ({
3291
3303
  // Radix Tooltip Provider Props
3292
3304
  delayDuration: t = 400,
3293
3305
  skipDelayDuration: e,
@@ -3302,8 +3314,8 @@ const Ma = (t, e) => Oe(t) ? new xa(e) : new Va(e, {
3302
3314
  onPointerDownOutside: c,
3303
3315
  forceMount: l,
3304
3316
  side: u = "bottom",
3305
- sideOffset: d = 4,
3306
- align: f = "center",
3317
+ sideOffset: f = 4,
3318
+ align: d = "center",
3307
3319
  alignOffset: h,
3308
3320
  avoidCollisions: y,
3309
3321
  collisionBoundary: b,
@@ -3318,56 +3330,56 @@ const Ma = (t, e) => Oe(t) ? new xa(e) : new Va(e, {
3318
3330
  // Telegraph Props
3319
3331
  enabled: M = !0,
3320
3332
  appearance: w = "dark",
3321
- triggerRef: F,
3333
+ triggerRef: O,
3322
3334
  children: D
3323
3335
  }) => {
3324
- const [B, bt] = Os({
3336
+ const [B, vt] = Rs({
3325
3337
  prop: i,
3326
3338
  onChange: r,
3327
3339
  defaultProp: s ?? !1
3328
- }), { groupOpen: Tt } = Oa({ open: !!B, delay: t }), vt = lt.Children.toArray(D).some(
3329
- (O) => O.props.disabled
3330
- ), Re = Tt || vt ? 0 : t, Ee = !Tt, P = (O) => {
3331
- if (O === "top")
3340
+ }), { groupOpen: wt } = Ia({ open: !!B, delay: t }), St = et.Children.toArray(D).some(
3341
+ (C) => et.isValidElement(C) ? C.props.disabled : !1
3342
+ ), Vt = wt || St ? 0 : t, Ne = !wt, F = (C) => {
3343
+ if (C === "top")
3332
3344
  return {
3333
3345
  y: -5
3334
3346
  };
3335
- if (O === "bottom")
3347
+ if (C === "bottom")
3336
3348
  return {
3337
3349
  y: 5
3338
3350
  };
3339
- if (O === "left")
3351
+ if (C === "left")
3340
3352
  return {
3341
3353
  x: -5
3342
3354
  };
3343
- if (O === "right")
3355
+ if (C === "right")
3344
3356
  return {
3345
3357
  x: 5
3346
3358
  };
3347
3359
  };
3348
- return /* @__PURE__ */ R(Hr, { features: Ca, children: /* @__PURE__ */ R(
3349
- ot.Provider,
3360
+ return /* @__PURE__ */ R(qr, { features: Pa, children: /* @__PURE__ */ R(
3361
+ lt.Provider,
3350
3362
  {
3351
- delayDuration: Re,
3363
+ delayDuration: Vt,
3352
3364
  skipDelayDuration: e,
3353
3365
  disableHoverableContent: n,
3354
- children: /* @__PURE__ */ hn(
3355
- ot.Root,
3366
+ children: /* @__PURE__ */ mn(
3367
+ lt.Root,
3356
3368
  {
3357
3369
  open: M === !1 ? !1 : B,
3358
- onOpenChange: bt,
3370
+ onOpenChange: vt,
3359
3371
  children: [
3360
- /* @__PURE__ */ R(ot.Trigger, { asChild: !0, ref: F, children: /* @__PURE__ */ R(Is, { children: D }) }),
3361
- /* @__PURE__ */ R(ot.Portal, { children: /* @__PURE__ */ R(
3362
- ot.Content,
3372
+ /* @__PURE__ */ R(lt.Trigger, { asChild: !0, ref: O, children: /* @__PURE__ */ R(ks, { children: D }) }),
3373
+ /* @__PURE__ */ R(lt.Portal, { children: /* @__PURE__ */ R(
3374
+ lt.Content,
3363
3375
  {
3364
3376
  "aria-label": o,
3365
3377
  onEscapeKeyDown: a,
3366
3378
  onPointerDownOutside: c,
3367
3379
  forceMount: l,
3368
3380
  side: u,
3369
- sideOffset: d,
3370
- align: f,
3381
+ sideOffset: f,
3382
+ align: d,
3371
3383
  alignOffset: h,
3372
3384
  avoidCollisions: y,
3373
3385
  collisionBoundary: b,
@@ -3378,15 +3390,15 @@ const Ma = (t, e) => Oe(t) ? new xa(e) : new Va(e, {
3378
3390
  style: {
3379
3391
  zIndex: "var(--tgph-zIndex-tooltip)"
3380
3392
  },
3381
- children: /* @__PURE__ */ R(Ds, { appearance: w, asChild: !0, children: /* @__PURE__ */ R(
3382
- Rs,
3393
+ children: /* @__PURE__ */ R(Es, { appearance: w, asChild: !0, children: /* @__PURE__ */ R(
3394
+ Ns,
3383
3395
  {
3384
- as: Pa,
3396
+ as: Oa,
3385
3397
  className: "tgph",
3386
- initial: Ee && !A ? {
3398
+ initial: Ne && !A ? {
3387
3399
  opacity: 0,
3388
3400
  scale: 0.5,
3389
- ...P(u)
3401
+ ...F(u)
3390
3402
  } : {},
3391
3403
  animate: {
3392
3404
  opacity: 1,
@@ -3409,8 +3421,8 @@ const Ma = (t, e) => Oe(t) ? new xa(e) : new Va(e, {
3409
3421
  transformOrigin: "var(--radix-tooltip-content-transform-origin)"
3410
3422
  },
3411
3423
  ...V ? { labelProps: V } : {},
3412
- ...Fa[w],
3413
- children: typeof T == "string" ? /* @__PURE__ */ R(Es, { as: "span", size: "1", children: T }) : T
3424
+ ...Da[w],
3425
+ children: typeof T == "string" ? /* @__PURE__ */ R(Ls, { as: "span", size: "1", children: T }) : T
3414
3426
  }
3415
3427
  ) })
3416
3428
  }
@@ -3422,7 +3434,7 @@ const Ma = (t, e) => Oe(t) ? new xa(e) : new Va(e, {
3422
3434
  ) });
3423
3435
  };
3424
3436
  export {
3425
- Ka as Tooltip,
3426
- Ba as TooltipGroupProvider
3437
+ $a as Tooltip,
3438
+ Wa as TooltipGroupProvider
3427
3439
  };
3428
3440
  //# sourceMappingURL=index.mjs.map