@telegraph/tooltip 0.0.50 → 0.0.52

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