@attraccess/plugins-frontend-ui 0.0.4

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.
@@ -0,0 +1,2522 @@
1
+ import { c as Dn, M as $, n as ke, a as wt, b as q, p as ve, i as Ke, d as St, t as xt, e as En, v as On, f as In, g as Rn, w as Mt, r as Ct, h as N, o as Nn, j as le, k as Pt, l as Ft, m as Dt, q as Et, s as kn, u as Kn, x as Bn, y as Xe, z as Ln, A as _n, B as $n, C as Ot, D as Gn, E as Un, F as jn, G as Wn } from "./index-ZwVKNfcP.mjs";
2
+ import { Fragment as qn } from "react";
3
+ function Hn(t, e) {
4
+ t.indexOf(e) === -1 && t.push(e);
5
+ }
6
+ function zn(t, e) {
7
+ const n = t.indexOf(e);
8
+ n > -1 && t.splice(n, 1);
9
+ }
10
+ let te = () => {
11
+ }, G = () => {
12
+ };
13
+ process.env.NODE_ENV !== "production" && (te = (t, e) => {
14
+ !t && typeof console < "u" && console.warn(e);
15
+ }, G = (t, e) => {
16
+ if (!t)
17
+ throw new Error(e);
18
+ });
19
+ const It = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t), Rt = (t) => /^0[^.\s]+$/u.test(t);
20
+ // @__NO_SIDE_EFFECTS__
21
+ function Be(t) {
22
+ let e;
23
+ return () => (e === void 0 && (e = t()), e);
24
+ }
25
+ const H = /* @__NO_SIDE_EFFECTS__ */ (t) => t, Yn = (t, e) => (n) => e(t(n)), ce = (...t) => t.reduce(Yn), Nt = /* @__NO_SIDE_EFFECTS__ */ (t, e, n) => {
26
+ const s = e - t;
27
+ return s === 0 ? 1 : (n - t) / s;
28
+ };
29
+ class kt {
30
+ constructor() {
31
+ this.subscriptions = [];
32
+ }
33
+ add(e) {
34
+ return Hn(this.subscriptions, e), () => zn(this.subscriptions, e);
35
+ }
36
+ notify(e, n, s) {
37
+ const i = this.subscriptions.length;
38
+ if (i)
39
+ if (i === 1)
40
+ this.subscriptions[0](e, n, s);
41
+ else
42
+ for (let r = 0; r < i; r++) {
43
+ const a = this.subscriptions[r];
44
+ a && a(e, n, s);
45
+ }
46
+ }
47
+ getSize() {
48
+ return this.subscriptions.length;
49
+ }
50
+ clear() {
51
+ this.subscriptions.length = 0;
52
+ }
53
+ }
54
+ const O = /* @__NO_SIDE_EFFECTS__ */ (t) => t * 1e3, R = /* @__NO_SIDE_EFFECTS__ */ (t) => t / 1e3;
55
+ function Kt(t, e) {
56
+ return e ? t * (1e3 / e) : 0;
57
+ }
58
+ const Bt = (t, e, n) => (((1 - 3 * n + 3 * e) * t + (3 * n - 6 * e)) * t + 3 * e) * t, Xn = 1e-7, Zn = 12;
59
+ function Jn(t, e, n, s, i) {
60
+ let r, a, o = 0;
61
+ do
62
+ a = e + (n - e) / 2, r = Bt(a, s, i) - t, r > 0 ? n = a : e = a;
63
+ while (Math.abs(r) > Xn && ++o < Zn);
64
+ return a;
65
+ }
66
+ function ne(t, e, n, s) {
67
+ if (t === e && n === s)
68
+ return H;
69
+ const i = (r) => Jn(r, 0, 1, t, n);
70
+ return (r) => r === 0 || r === 1 ? r : Bt(i(r), e, s);
71
+ }
72
+ const Lt = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, _t = (t) => (e) => 1 - t(1 - e), $t = /* @__PURE__ */ ne(0.33, 1.53, 0.69, 0.99), Le = /* @__PURE__ */ _t($t), Gt = /* @__PURE__ */ Lt(Le), Ut = (t) => (t *= 2) < 1 ? 0.5 * Le(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), _e = (t) => 1 - Math.sin(Math.acos(t)), Qn = _t(_e), jt = Lt(_e), es = /* @__PURE__ */ ne(0.42, 0, 1, 1), ts = /* @__PURE__ */ ne(0, 0, 0.58, 1), Wt = /* @__PURE__ */ ne(0.42, 0, 0.58, 1), ns = (t) => Array.isArray(t) && typeof t[0] != "number", qt = (t) => Array.isArray(t) && typeof t[0] == "number", Ze = {
73
+ linear: H,
74
+ easeIn: es,
75
+ easeInOut: Wt,
76
+ easeOut: ts,
77
+ circIn: _e,
78
+ circInOut: jt,
79
+ circOut: Qn,
80
+ backIn: Le,
81
+ backInOut: Gt,
82
+ backOut: $t,
83
+ anticipate: Ut
84
+ }, ss = (t) => typeof t == "string", Je = (t) => {
85
+ if (qt(t)) {
86
+ G(t.length === 4, "Cubic bezier arrays must contain four numerical values.");
87
+ const [e, n, s, i] = t;
88
+ return ne(e, n, s, i);
89
+ } else if (ss(t))
90
+ return G(Ze[t] !== void 0, `Invalid easing type '${t}'`), Ze[t];
91
+ return t;
92
+ }, { schedule: E, cancel: Te, state: ie } = /* @__PURE__ */ Dn(typeof requestAnimationFrame < "u" ? requestAnimationFrame : H, !0);
93
+ let se;
94
+ function is() {
95
+ se = void 0;
96
+ }
97
+ const D = {
98
+ now: () => (se === void 0 && D.set(ie.isProcessing || $.useManualTiming ? ie.timestamp : performance.now()), se),
99
+ set: (t) => {
100
+ se = t, queueMicrotask(is);
101
+ }
102
+ }, J = (t) => Math.round(t * 1e5) / 1e5, $e = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
103
+ function rs(t) {
104
+ return t == null;
105
+ }
106
+ const as = /^(?:#[\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" && as.test(n) && n.startsWith(t) || e && !rs(n) && Object.prototype.hasOwnProperty.call(n, e)), Ht = (t, e, n) => (s) => {
107
+ if (typeof s != "string")
108
+ return s;
109
+ const [i, r, a, o] = s.match($e);
110
+ return {
111
+ [t]: parseFloat(i),
112
+ [e]: parseFloat(r),
113
+ [n]: parseFloat(a),
114
+ alpha: o !== void 0 ? parseFloat(o) : 1
115
+ };
116
+ }, os = (t) => q(0, 255, t), pe = {
117
+ ...ke,
118
+ transform: (t) => Math.round(os(t))
119
+ }, K = {
120
+ test: /* @__PURE__ */ Ge("rgb", "red"),
121
+ parse: /* @__PURE__ */ Ht("red", "green", "blue"),
122
+ transform: ({ red: t, green: e, blue: n, alpha: s = 1 }) => "rgba(" + pe.transform(t) + ", " + pe.transform(e) + ", " + pe.transform(n) + ", " + J(wt.transform(s)) + ")"
123
+ };
124
+ function us(t) {
125
+ let e = "", n = "", s = "", i = "";
126
+ 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), {
127
+ red: parseInt(e, 16),
128
+ green: parseInt(n, 16),
129
+ blue: parseInt(s, 16),
130
+ alpha: i ? parseInt(i, 16) / 255 : 1
131
+ };
132
+ }
133
+ const Ve = {
134
+ test: /* @__PURE__ */ Ge("#"),
135
+ parse: us,
136
+ transform: K.transform
137
+ }, j = {
138
+ test: /* @__PURE__ */ Ge("hsl", "hue"),
139
+ parse: /* @__PURE__ */ Ht("hue", "saturation", "lightness"),
140
+ transform: ({ hue: t, saturation: e, lightness: n, alpha: s = 1 }) => "hsla(" + Math.round(t) + ", " + ve.transform(J(e)) + ", " + ve.transform(J(n)) + ", " + J(wt.transform(s)) + ")"
141
+ }, x = {
142
+ test: (t) => K.test(t) || Ve.test(t) || j.test(t),
143
+ parse: (t) => K.test(t) ? K.parse(t) : j.test(t) ? j.parse(t) : Ve.parse(t),
144
+ transform: (t) => typeof t == "string" ? t : t.hasOwnProperty("red") ? K.transform(t) : j.transform(t)
145
+ }, ls = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
146
+ function cs(t) {
147
+ var e, n;
148
+ return isNaN(t) && typeof t == "string" && (((e = t.match($e)) == null ? void 0 : e.length) || 0) + (((n = t.match(ls)) == null ? void 0 : n.length) || 0) > 0;
149
+ }
150
+ const zt = "number", Yt = "color", hs = "var", fs = "var(", Qe = "${}", ds = /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;
151
+ function Q(t) {
152
+ const e = t.toString(), n = [], s = {
153
+ color: [],
154
+ number: [],
155
+ var: []
156
+ }, i = [];
157
+ let r = 0;
158
+ const o = e.replace(ds, (u) => (x.test(u) ? (s.color.push(r), i.push(Yt), n.push(x.parse(u))) : u.startsWith(fs) ? (s.var.push(r), i.push(hs), n.push(u)) : (s.number.push(r), i.push(zt), n.push(parseFloat(u))), ++r, Qe)).split(Qe);
159
+ return { values: n, split: o, indexes: s, types: i };
160
+ }
161
+ function Xt(t) {
162
+ return Q(t).values;
163
+ }
164
+ function Zt(t) {
165
+ const { split: e, types: n } = Q(t), s = e.length;
166
+ return (i) => {
167
+ let r = "";
168
+ for (let a = 0; a < s; a++)
169
+ if (r += e[a], i[a] !== void 0) {
170
+ const o = n[a];
171
+ o === zt ? r += J(i[a]) : o === Yt ? r += x.transform(i[a]) : r += i[a];
172
+ }
173
+ return r;
174
+ };
175
+ }
176
+ const ps = (t) => typeof t == "number" ? 0 : t;
177
+ function ms(t) {
178
+ const e = Xt(t);
179
+ return Zt(t)(e.map(ps));
180
+ }
181
+ const z = {
182
+ test: cs,
183
+ parse: Xt,
184
+ createTransformer: Zt,
185
+ getAnimatableNone: ms
186
+ };
187
+ function me(t, e, n) {
188
+ 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;
189
+ }
190
+ function gs({ hue: t, saturation: e, lightness: n, alpha: s }) {
191
+ t /= 360, e /= 100, n /= 100;
192
+ let i = 0, r = 0, a = 0;
193
+ if (!e)
194
+ i = r = a = n;
195
+ else {
196
+ const o = n < 0.5 ? n * (1 + e) : n + e - n * e, u = 2 * n - o;
197
+ i = me(u, o, t + 1 / 3), r = me(u, o, t), a = me(u, o, t - 1 / 3);
198
+ }
199
+ return {
200
+ red: Math.round(i * 255),
201
+ green: Math.round(r * 255),
202
+ blue: Math.round(a * 255),
203
+ alpha: s
204
+ };
205
+ }
206
+ function re(t, e) {
207
+ return (n) => n > 0 ? e : t;
208
+ }
209
+ const he = (t, e, n) => t + (e - t) * n, ge = (t, e, n) => {
210
+ const s = t * t, i = n * (e * e - s) + s;
211
+ return i < 0 ? 0 : Math.sqrt(i);
212
+ }, ys = [Ve, K, j], bs = (t) => ys.find((e) => e.test(t));
213
+ function et(t) {
214
+ const e = bs(t);
215
+ if (te(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`), !e)
216
+ return !1;
217
+ let n = e.parse(t);
218
+ return e === j && (n = gs(n)), n;
219
+ }
220
+ const tt = (t, e) => {
221
+ const n = et(t), s = et(e);
222
+ if (!n || !s)
223
+ return re(t, e);
224
+ const i = { ...n };
225
+ return (r) => (i.red = ge(n.red, s.red, r), i.green = ge(n.green, s.green, r), i.blue = ge(n.blue, s.blue, r), i.alpha = he(n.alpha, s.alpha, r), K.transform(i));
226
+ }, Ae = /* @__PURE__ */ new Set(["none", "hidden"]);
227
+ function vs(t, e) {
228
+ return Ae.has(t) ? (n) => n <= 0 ? t : e : (n) => n >= 1 ? e : t;
229
+ }
230
+ function Ts(t, e) {
231
+ return (n) => he(t, e, n);
232
+ }
233
+ function Ue(t) {
234
+ return typeof t == "number" ? Ts : typeof t == "string" ? Ke(t) ? re : x.test(t) ? tt : ws : Array.isArray(t) ? Jt : typeof t == "object" ? x.test(t) ? tt : Vs : re;
235
+ }
236
+ function Jt(t, e) {
237
+ const n = [...t], s = n.length, i = t.map((r, a) => Ue(r)(r, e[a]));
238
+ return (r) => {
239
+ for (let a = 0; a < s; a++)
240
+ n[a] = i[a](r);
241
+ return n;
242
+ };
243
+ }
244
+ function Vs(t, e) {
245
+ const n = { ...t, ...e }, s = {};
246
+ for (const i in n)
247
+ t[i] !== void 0 && e[i] !== void 0 && (s[i] = Ue(t[i])(t[i], e[i]));
248
+ return (i) => {
249
+ for (const r in s)
250
+ n[r] = s[r](i);
251
+ return n;
252
+ };
253
+ }
254
+ function As(t, e) {
255
+ const n = [], s = { color: 0, var: 0, number: 0 };
256
+ for (let i = 0; i < e.values.length; i++) {
257
+ const r = e.types[i], a = t.indexes[r][s[r]], o = t.values[a] ?? 0;
258
+ n[i] = o, s[r]++;
259
+ }
260
+ return n;
261
+ }
262
+ const ws = (t, e) => {
263
+ const n = z.createTransformer(e), s = Q(t), i = Q(e);
264
+ 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 ? Ae.has(t) && !i.values.length || Ae.has(e) && !s.values.length ? vs(t, e) : ce(Jt(As(s, i), i.values), n) : (te(!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.`), re(t, e));
265
+ };
266
+ function Qt(t, e, n) {
267
+ return typeof t == "number" && typeof e == "number" && typeof n == "number" ? he(t, e, n) : Ue(t)(t, e);
268
+ }
269
+ const Ss = (t) => {
270
+ const e = ({ timestamp: n }) => t(n);
271
+ return {
272
+ start: () => E.update(e, !0),
273
+ stop: () => Te(e),
274
+ /**
275
+ * If we're processing this frame we can use the
276
+ * framelocked timestamp to keep things in sync.
277
+ */
278
+ now: () => ie.isProcessing ? ie.timestamp : D.now()
279
+ };
280
+ }, en = (t, e, n = 10) => {
281
+ let s = "";
282
+ const i = Math.max(Math.round(e / n), 2);
283
+ for (let r = 0; r < i; r++)
284
+ s += t(r / (i - 1)) + ", ";
285
+ return `linear(${s.substring(0, s.length - 2)})`;
286
+ }, ae = 2e4;
287
+ function je(t) {
288
+ let e = 0;
289
+ const n = 50;
290
+ let s = t.next(e);
291
+ for (; !s.done && e < ae; )
292
+ e += n, s = t.next(e);
293
+ return e >= ae ? 1 / 0 : e;
294
+ }
295
+ function xs(t, e = 100, n) {
296
+ const s = n({ ...t, keyframes: [0, e] }), i = Math.min(je(s), ae);
297
+ return {
298
+ type: "keyframes",
299
+ ease: (r) => s.next(i * r).value / e,
300
+ duration: /* @__PURE__ */ R(i)
301
+ };
302
+ }
303
+ const Ms = 5;
304
+ function tn(t, e, n) {
305
+ const s = Math.max(e - Ms, 0);
306
+ return Kt(n - t(s), e - s);
307
+ }
308
+ const w = {
309
+ // Default spring physics
310
+ stiffness: 100,
311
+ damping: 10,
312
+ mass: 1,
313
+ velocity: 0,
314
+ // Default duration/bounce-based options
315
+ duration: 800,
316
+ // in ms
317
+ bounce: 0.3,
318
+ visualDuration: 0.3,
319
+ // in seconds
320
+ // Rest thresholds
321
+ restSpeed: {
322
+ granular: 0.01,
323
+ default: 2
324
+ },
325
+ restDelta: {
326
+ granular: 5e-3,
327
+ default: 0.5
328
+ },
329
+ // Limits
330
+ minDuration: 0.01,
331
+ // in seconds
332
+ maxDuration: 10,
333
+ // in seconds
334
+ minDamping: 0.05,
335
+ maxDamping: 1
336
+ }, nt = 1e-3;
337
+ function Cs({ duration: t = w.duration, bounce: e = w.bounce, velocity: n = w.velocity, mass: s = w.mass }) {
338
+ let i, r;
339
+ te(t <= /* @__PURE__ */ O(w.maxDuration), "Spring duration must be 10 seconds or less");
340
+ let a = 1 - e;
341
+ a = q(w.minDamping, w.maxDamping, a), t = q(w.minDuration, w.maxDuration, /* @__PURE__ */ R(t)), a < 1 ? (i = (l) => {
342
+ const c = l * a, f = c * t, h = c - n, d = we(l, a), v = Math.exp(-f);
343
+ return nt - h / d * v;
344
+ }, r = (l) => {
345
+ const f = l * a * t, h = f * n + n, d = Math.pow(a, 2) * Math.pow(l, 2) * t, v = Math.exp(-f), y = we(Math.pow(l, 2), a);
346
+ return (-i(l) + nt > 0 ? -1 : 1) * ((h - d) * v) / y;
347
+ }) : (i = (l) => {
348
+ const c = Math.exp(-l * t), f = (l - n) * t + 1;
349
+ return -1e-3 + c * f;
350
+ }, r = (l) => {
351
+ const c = Math.exp(-l * t), f = (n - l) * (t * t);
352
+ return c * f;
353
+ });
354
+ const o = 5 / t, u = Fs(i, r, o);
355
+ if (t = /* @__PURE__ */ O(t), isNaN(u))
356
+ return {
357
+ stiffness: w.stiffness,
358
+ damping: w.damping,
359
+ duration: t
360
+ };
361
+ {
362
+ const l = Math.pow(u, 2) * s;
363
+ return {
364
+ stiffness: l,
365
+ damping: a * 2 * Math.sqrt(s * l),
366
+ duration: t
367
+ };
368
+ }
369
+ }
370
+ const Ps = 12;
371
+ function Fs(t, e, n) {
372
+ let s = n;
373
+ for (let i = 1; i < Ps; i++)
374
+ s = s - t(s) / e(s);
375
+ return s;
376
+ }
377
+ function we(t, e) {
378
+ return t * Math.sqrt(1 - e * e);
379
+ }
380
+ const Ds = ["duration", "bounce"], Es = ["stiffness", "damping", "mass"];
381
+ function st(t, e) {
382
+ return e.some((n) => t[n] !== void 0);
383
+ }
384
+ function Os(t) {
385
+ let e = {
386
+ velocity: w.velocity,
387
+ stiffness: w.stiffness,
388
+ damping: w.damping,
389
+ mass: w.mass,
390
+ isResolvedFromDuration: !1,
391
+ ...t
392
+ };
393
+ if (!st(t, Es) && st(t, Ds))
394
+ if (t.visualDuration) {
395
+ const n = t.visualDuration, s = 2 * Math.PI / (n * 1.2), i = s * s, r = 2 * q(0.05, 1, 1 - (t.bounce || 0)) * Math.sqrt(i);
396
+ e = {
397
+ ...e,
398
+ mass: w.mass,
399
+ stiffness: i,
400
+ damping: r
401
+ };
402
+ } else {
403
+ const n = Cs(t);
404
+ e = {
405
+ ...e,
406
+ ...n,
407
+ mass: w.mass
408
+ }, e.isResolvedFromDuration = !0;
409
+ }
410
+ return e;
411
+ }
412
+ function oe(t = w.visualDuration, e = w.bounce) {
413
+ const n = typeof t != "object" ? {
414
+ visualDuration: t,
415
+ keyframes: [0, 1],
416
+ bounce: e
417
+ } : t;
418
+ let { restSpeed: s, restDelta: i } = n;
419
+ const r = n.keyframes[0], a = n.keyframes[n.keyframes.length - 1], o = { done: !1, value: r }, { stiffness: u, damping: l, mass: c, duration: f, velocity: h, isResolvedFromDuration: d } = Os({
420
+ ...n,
421
+ velocity: -/* @__PURE__ */ R(n.velocity || 0)
422
+ }), v = h || 0, y = l / (2 * Math.sqrt(u * c)), b = a - r, p = /* @__PURE__ */ R(Math.sqrt(u / c)), T = Math.abs(b) < 5;
423
+ s || (s = T ? w.restSpeed.granular : w.restSpeed.default), i || (i = T ? w.restDelta.granular : w.restDelta.default);
424
+ let V;
425
+ if (y < 1) {
426
+ const m = we(p, y);
427
+ V = (A) => {
428
+ const S = Math.exp(-y * p * A);
429
+ return a - S * ((v + y * p * b) / m * Math.sin(m * A) + b * Math.cos(m * A));
430
+ };
431
+ } else if (y === 1)
432
+ V = (m) => a - Math.exp(-p * m) * (b + (v + p * b) * m);
433
+ else {
434
+ const m = p * Math.sqrt(y * y - 1);
435
+ V = (A) => {
436
+ const S = Math.exp(-y * p * A), g = Math.min(m * A, 300);
437
+ return a - S * ((v + y * p * b) * Math.sinh(g) + m * b * Math.cosh(g)) / m;
438
+ };
439
+ }
440
+ const P = {
441
+ calculatedDuration: d && f || null,
442
+ next: (m) => {
443
+ const A = V(m);
444
+ if (d)
445
+ o.done = m >= f;
446
+ else {
447
+ let S = m === 0 ? v : 0;
448
+ y < 1 && (S = m === 0 ? /* @__PURE__ */ O(v) : tn(V, m, A));
449
+ const g = Math.abs(S) <= s, C = Math.abs(a - A) <= i;
450
+ o.done = g && C;
451
+ }
452
+ return o.value = o.done ? a : A, o;
453
+ },
454
+ toString: () => {
455
+ const m = Math.min(je(P), ae), A = en((S) => P.next(m * S).value, m, 30);
456
+ return m + "ms " + A;
457
+ },
458
+ toTransition: () => {
459
+ }
460
+ };
461
+ return P;
462
+ }
463
+ oe.applyToOptions = (t) => {
464
+ const e = xs(t, 100, oe);
465
+ return t.ease = e.ease, t.duration = /* @__PURE__ */ O(e.duration), t.type = "keyframes", t;
466
+ };
467
+ function Se({ keyframes: t, velocity: e = 0, power: n = 0.8, timeConstant: s = 325, bounceDamping: i = 10, bounceStiffness: r = 500, modifyTarget: a, min: o, max: u, restDelta: l = 0.5, restSpeed: c }) {
468
+ const f = t[0], h = {
469
+ done: !1,
470
+ value: f
471
+ }, d = (g) => o !== void 0 && g < o || u !== void 0 && g > u, v = (g) => o === void 0 ? u : u === void 0 || Math.abs(o - g) < Math.abs(u - g) ? o : u;
472
+ let y = n * e;
473
+ const b = f + y, p = a === void 0 ? b : a(b);
474
+ p !== b && (y = p - f);
475
+ const T = (g) => -y * Math.exp(-g / s), V = (g) => p + T(g), P = (g) => {
476
+ const C = T(g), F = V(g);
477
+ h.done = Math.abs(C) <= l, h.value = h.done ? p : F;
478
+ };
479
+ let m, A;
480
+ const S = (g) => {
481
+ d(h.value) && (m = g, A = oe({
482
+ keyframes: [h.value, v(h.value)],
483
+ velocity: tn(V, g, h.value),
484
+ // TODO: This should be passing * 1000
485
+ damping: i,
486
+ stiffness: r,
487
+ restDelta: l,
488
+ restSpeed: c
489
+ }));
490
+ };
491
+ return S(0), {
492
+ calculatedDuration: null,
493
+ next: (g) => {
494
+ let C = !1;
495
+ return !A && m === void 0 && (C = !0, P(g), S(g)), m !== void 0 && g >= m ? A.next(g - m) : (!C && P(g), h);
496
+ }
497
+ };
498
+ }
499
+ function Is(t, e, n) {
500
+ const s = [], i = n || $.mix || Qt, r = t.length - 1;
501
+ for (let a = 0; a < r; a++) {
502
+ let o = i(t[a], t[a + 1]);
503
+ if (e) {
504
+ const u = Array.isArray(e) ? e[a] || H : e;
505
+ o = ce(u, o);
506
+ }
507
+ s.push(o);
508
+ }
509
+ return s;
510
+ }
511
+ function Rs(t, e, { clamp: n = !0, ease: s, mixer: i } = {}) {
512
+ const r = t.length;
513
+ if (G(r === e.length, "Both input and output ranges must be the same length"), r === 1)
514
+ return () => e[0];
515
+ if (r === 2 && e[0] === e[1])
516
+ return () => e[1];
517
+ const a = t[0] === t[1];
518
+ t[0] > t[r - 1] && (t = [...t].reverse(), e = [...e].reverse());
519
+ const o = Is(e, s, i), u = o.length, l = (c) => {
520
+ if (a && c < t[0])
521
+ return e[0];
522
+ let f = 0;
523
+ if (u > 1)
524
+ for (; f < t.length - 2 && !(c < t[f + 1]); f++)
525
+ ;
526
+ const h = /* @__PURE__ */ Nt(t[f], t[f + 1], c);
527
+ return o[f](h);
528
+ };
529
+ return n ? (c) => l(q(t[0], t[r - 1], c)) : l;
530
+ }
531
+ function Ns(t, e) {
532
+ const n = t[t.length - 1];
533
+ for (let s = 1; s <= e; s++) {
534
+ const i = /* @__PURE__ */ Nt(0, e, s);
535
+ t.push(he(n, 1, i));
536
+ }
537
+ }
538
+ function ks(t) {
539
+ const e = [0];
540
+ return Ns(e, t.length - 1), e;
541
+ }
542
+ function Ks(t, e) {
543
+ return t.map((n) => n * e);
544
+ }
545
+ function Bs(t, e) {
546
+ return t.map(() => e || Wt).splice(0, t.length - 1);
547
+ }
548
+ function W({ duration: t = 300, keyframes: e, times: n, ease: s = "easeInOut" }) {
549
+ const i = ns(s) ? s.map(Je) : Je(s), r = {
550
+ done: !1,
551
+ value: e[0]
552
+ }, a = Ks(
553
+ // Only use the provided offsets if they're the correct length
554
+ // TODO Maybe we should warn here if there's a length mismatch
555
+ n && n.length === e.length ? n : ks(e),
556
+ t
557
+ ), o = Rs(a, e, {
558
+ ease: Array.isArray(i) ? i : Bs(e, i)
559
+ });
560
+ return {
561
+ calculatedDuration: t,
562
+ next: (u) => (r.value = o(u), r.done = u >= t, r)
563
+ };
564
+ }
565
+ const Ls = (t) => t !== null;
566
+ function We(t, { repeat: e, repeatType: n = "loop" }, s, i = 1) {
567
+ const r = t.filter(Ls), o = i < 0 || e && n !== "loop" && e % 2 === 1 ? 0 : r.length - 1;
568
+ return !o || s === void 0 ? r[o] : s;
569
+ }
570
+ const _s = {
571
+ decay: Se,
572
+ inertia: Se,
573
+ tween: W,
574
+ keyframes: W,
575
+ spring: oe
576
+ };
577
+ function nn(t) {
578
+ typeof t.type == "string" && (t.type = _s[t.type]);
579
+ }
580
+ class qe {
581
+ constructor() {
582
+ this.count = 0, this.updateFinished();
583
+ }
584
+ get finished() {
585
+ return this._finished;
586
+ }
587
+ updateFinished() {
588
+ this.count++, this._finished = new Promise((e) => {
589
+ this.resolve = e;
590
+ });
591
+ }
592
+ notifyFinished() {
593
+ this.resolve();
594
+ }
595
+ /**
596
+ * Allows the animation to be awaited.
597
+ *
598
+ * @deprecated Use `finished` instead.
599
+ */
600
+ then(e, n) {
601
+ return this.finished.then(e, n);
602
+ }
603
+ }
604
+ const $s = (t) => t / 100;
605
+ class sn extends qe {
606
+ constructor(e) {
607
+ super(), this.state = "idle", this.startTime = null, this.isStopped = !1, this.currentTime = 0, this.holdTime = null, this.playbackSpeed = 1, this.stop = () => {
608
+ const { motionValue: n } = this.options;
609
+ if (n && n.updatedAt !== D.now() && this.tick(D.now()), this.isStopped = !0, this.state === "idle")
610
+ return;
611
+ this.teardown();
612
+ const { onStop: s } = this.options;
613
+ s && s();
614
+ }, this.options = e, this.initAnimation(), this.play(), e.autoplay === !1 && this.pause();
615
+ }
616
+ initAnimation() {
617
+ const { options: e } = this;
618
+ nn(e);
619
+ const { type: n = W, repeat: s = 0, repeatDelay: i = 0, repeatType: r, velocity: a = 0 } = e;
620
+ let { keyframes: o } = e;
621
+ const u = n || W;
622
+ process.env.NODE_ENV !== "production" && u !== W && G(o.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${o}`), u !== W && typeof o[0] != "number" && (this.mixKeyframes = ce($s, Qt(o[0], o[1])), o = [0, 100]);
623
+ const l = u({ ...e, keyframes: o });
624
+ r === "mirror" && (this.mirroredGenerator = u({
625
+ ...e,
626
+ keyframes: [...o].reverse(),
627
+ velocity: -a
628
+ })), l.calculatedDuration === null && (l.calculatedDuration = je(l));
629
+ const { calculatedDuration: c } = l;
630
+ this.calculatedDuration = c, this.resolvedDuration = c + i, this.totalDuration = this.resolvedDuration * (s + 1) - i, this.generator = l;
631
+ }
632
+ updateTime(e) {
633
+ const n = Math.round(e - this.startTime) * this.playbackSpeed;
634
+ this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = n;
635
+ }
636
+ tick(e, n = !1) {
637
+ const { generator: s, totalDuration: i, mixKeyframes: r, mirroredGenerator: a, resolvedDuration: o, calculatedDuration: u } = this;
638
+ if (this.startTime === null)
639
+ return s.next(0);
640
+ const { delay: l = 0, keyframes: c, repeat: f, repeatType: h, repeatDelay: d, type: v, onUpdate: y, finalKeyframe: b } = this.options;
641
+ 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);
642
+ const p = this.currentTime - l * (this.playbackSpeed >= 0 ? 1 : -1), T = this.playbackSpeed >= 0 ? p < 0 : p > i;
643
+ this.currentTime = Math.max(p, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = i);
644
+ let V = this.currentTime, P = s;
645
+ if (f) {
646
+ const g = Math.min(this.currentTime, i) / o;
647
+ let C = Math.floor(g), F = g % 1;
648
+ !F && g >= 1 && (F = 1), F === 1 && C--, C = Math.min(C, f + 1), !!(C % 2) && (h === "reverse" ? (F = 1 - F, d && (F -= d / o)) : h === "mirror" && (P = a)), V = q(0, 1, F) * o;
649
+ }
650
+ const m = T ? { done: !1, value: c[0] } : P.next(V);
651
+ r && (m.value = r(m.value));
652
+ let { done: A } = m;
653
+ !T && u !== null && (A = this.playbackSpeed >= 0 ? this.currentTime >= i : this.currentTime <= 0);
654
+ const S = this.holdTime === null && (this.state === "finished" || this.state === "running" && A);
655
+ return S && v !== Se && (m.value = We(c, this.options, b, this.speed)), y && y(m.value), S && this.finish(), m;
656
+ }
657
+ /**
658
+ * Allows the returned animation to be awaited or promise-chained. Currently
659
+ * resolves when the animation finishes at all but in a future update could/should
660
+ * reject if its cancels.
661
+ */
662
+ then(e, n) {
663
+ return this.finished.then(e, n);
664
+ }
665
+ get duration() {
666
+ return /* @__PURE__ */ R(this.calculatedDuration);
667
+ }
668
+ get time() {
669
+ return /* @__PURE__ */ R(this.currentTime);
670
+ }
671
+ set time(e) {
672
+ e = /* @__PURE__ */ O(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);
673
+ }
674
+ get speed() {
675
+ return this.playbackSpeed;
676
+ }
677
+ set speed(e) {
678
+ this.updateTime(D.now());
679
+ const n = this.playbackSpeed !== e;
680
+ this.playbackSpeed = e, n && (this.time = /* @__PURE__ */ R(this.currentTime));
681
+ }
682
+ play() {
683
+ if (this.isStopped)
684
+ return;
685
+ const { driver: e = Ss, onPlay: n, startTime: s } = this.options;
686
+ this.driver || (this.driver = e((r) => this.tick(r))), n && n();
687
+ const i = this.driver.now();
688
+ this.state === "finished" ? (this.updateFinished(), this.startTime = i) : this.holdTime !== null ? this.startTime = i - this.holdTime : this.startTime || (this.startTime = s ?? i), this.state === "finished" && this.speed < 0 && (this.startTime += this.calculatedDuration), this.holdTime = null, this.state = "running", this.driver.start();
689
+ }
690
+ pause() {
691
+ this.state = "paused", this.updateTime(D.now()), this.holdTime = this.currentTime;
692
+ }
693
+ complete() {
694
+ this.state !== "running" && this.play(), this.state = "finished", this.holdTime = null;
695
+ }
696
+ finish() {
697
+ this.teardown(), this.state = "finished";
698
+ const { onComplete: e } = this.options;
699
+ e && e();
700
+ }
701
+ cancel() {
702
+ this.holdTime = null, this.startTime = 0, this.tick(0), this.teardown();
703
+ }
704
+ teardown() {
705
+ this.notifyFinished(), this.state = "idle", this.stopDriver(), this.startTime = this.holdTime = null;
706
+ }
707
+ stopDriver() {
708
+ this.driver && (this.driver.stop(), this.driver = void 0);
709
+ }
710
+ sample(e) {
711
+ return this.startTime = 0, this.tick(e, !0);
712
+ }
713
+ attachTimeline(e) {
714
+ return this.options.allowFlatten && (this.options.type = "keyframes", this.options.ease = "linear", this.initAnimation()), e.observe(this);
715
+ }
716
+ }
717
+ function Gs(t) {
718
+ for (let e = 1; e < t.length; e++)
719
+ t[e] ?? (t[e] = t[e - 1]);
720
+ }
721
+ const B = (t) => t * 180 / Math.PI, xe = (t) => {
722
+ const e = B(Math.atan2(t[1], t[0]));
723
+ return Me(e);
724
+ }, Us = {
725
+ x: 4,
726
+ y: 5,
727
+ translateX: 4,
728
+ translateY: 5,
729
+ scaleX: 0,
730
+ scaleY: 3,
731
+ scale: (t) => (Math.abs(t[0]) + Math.abs(t[3])) / 2,
732
+ rotate: xe,
733
+ rotateZ: xe,
734
+ skewX: (t) => B(Math.atan(t[1])),
735
+ skewY: (t) => B(Math.atan(t[2])),
736
+ skew: (t) => (Math.abs(t[1]) + Math.abs(t[2])) / 2
737
+ }, Me = (t) => (t = t % 360, t < 0 && (t += 360), t), it = xe, rt = (t) => Math.sqrt(t[0] * t[0] + t[1] * t[1]), at = (t) => Math.sqrt(t[4] * t[4] + t[5] * t[5]), js = {
738
+ x: 12,
739
+ y: 13,
740
+ z: 14,
741
+ translateX: 12,
742
+ translateY: 13,
743
+ translateZ: 14,
744
+ scaleX: rt,
745
+ scaleY: at,
746
+ scale: (t) => (rt(t) + at(t)) / 2,
747
+ rotateX: (t) => Me(B(Math.atan2(t[6], t[5]))),
748
+ rotateY: (t) => Me(B(Math.atan2(-t[2], t[0]))),
749
+ rotateZ: it,
750
+ rotate: it,
751
+ skewX: (t) => B(Math.atan(t[4])),
752
+ skewY: (t) => B(Math.atan(t[1])),
753
+ skew: (t) => (Math.abs(t[1]) + Math.abs(t[4])) / 2
754
+ };
755
+ function ot(t) {
756
+ return t.includes("scale") ? 1 : 0;
757
+ }
758
+ function Ce(t, e) {
759
+ if (!t || t === "none")
760
+ return ot(e);
761
+ const n = t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);
762
+ let s, i;
763
+ if (n)
764
+ s = js, i = n;
765
+ else {
766
+ const o = t.match(/^matrix\(([-\d.e\s,]+)\)$/u);
767
+ s = Us, i = o;
768
+ }
769
+ if (!i)
770
+ return ot(e);
771
+ const r = s[e], a = i[1].split(",").map(qs);
772
+ return typeof r == "function" ? r(a) : a[r];
773
+ }
774
+ const Ws = (t, e) => {
775
+ const { transform: n = "none" } = getComputedStyle(t);
776
+ return Ce(n, e);
777
+ };
778
+ function qs(t) {
779
+ return parseFloat(t.trim());
780
+ }
781
+ const ut = (t) => t === ke || t === St, Hs = /* @__PURE__ */ new Set(["x", "y", "z"]), zs = xt.filter((t) => !Hs.has(t));
782
+ function Ys(t) {
783
+ const e = [];
784
+ return zs.forEach((n) => {
785
+ const s = t.getValue(n);
786
+ s !== void 0 && (e.push([n, s.get()]), s.set(n.startsWith("scale") ? 1 : 0));
787
+ }), e;
788
+ }
789
+ const L = {
790
+ // Dimensions
791
+ width: ({ x: t }, { paddingLeft: e = "0", paddingRight: n = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(n),
792
+ height: ({ y: t }, { paddingTop: e = "0", paddingBottom: n = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(n),
793
+ top: (t, { top: e }) => parseFloat(e),
794
+ left: (t, { left: e }) => parseFloat(e),
795
+ bottom: ({ y: t }, { top: e }) => parseFloat(e) + (t.max - t.min),
796
+ right: ({ x: t }, { left: e }) => parseFloat(e) + (t.max - t.min),
797
+ // Transform
798
+ x: (t, { transform: e }) => Ce(e, "x"),
799
+ y: (t, { transform: e }) => Ce(e, "y")
800
+ };
801
+ L.translateX = L.x;
802
+ L.translateY = L.y;
803
+ const _ = /* @__PURE__ */ new Set();
804
+ let Pe = !1, Fe = !1, De = !1;
805
+ function rn() {
806
+ if (Fe) {
807
+ const t = Array.from(_).filter((s) => s.needsMeasurement), e = new Set(t.map((s) => s.element)), n = /* @__PURE__ */ new Map();
808
+ e.forEach((s) => {
809
+ const i = Ys(s);
810
+ i.length && (n.set(s, i), s.render());
811
+ }), t.forEach((s) => s.measureInitialState()), e.forEach((s) => {
812
+ s.render();
813
+ const i = n.get(s);
814
+ i && i.forEach(([r, a]) => {
815
+ var o;
816
+ (o = s.getValue(r)) == null || o.set(a);
817
+ });
818
+ }), t.forEach((s) => s.measureEndState()), t.forEach((s) => {
819
+ s.suspendedScrollY !== void 0 && window.scrollTo(0, s.suspendedScrollY);
820
+ });
821
+ }
822
+ Fe = !1, Pe = !1, _.forEach((t) => t.complete(De)), _.clear();
823
+ }
824
+ function an() {
825
+ _.forEach((t) => {
826
+ t.readKeyframes(), t.needsMeasurement && (Fe = !0);
827
+ });
828
+ }
829
+ function Xs() {
830
+ De = !0, an(), rn(), De = !1;
831
+ }
832
+ class He {
833
+ constructor(e, n, s, i, r, a = !1) {
834
+ this.isComplete = !1, this.isAsync = !1, this.needsMeasurement = !1, this.isScheduled = !1, this.unresolvedKeyframes = [...e], this.onComplete = n, this.name = s, this.motionValue = i, this.element = r, this.isAsync = a;
835
+ }
836
+ scheduleResolve() {
837
+ this.isScheduled = !0, this.isAsync ? (_.add(this), Pe || (Pe = !0, E.read(an), E.resolveKeyframes(rn))) : (this.readKeyframes(), this.complete());
838
+ }
839
+ readKeyframes() {
840
+ const { unresolvedKeyframes: e, name: n, element: s, motionValue: i } = this;
841
+ if (e[0] === null) {
842
+ const r = i == null ? void 0 : i.get(), a = e[e.length - 1];
843
+ if (r !== void 0)
844
+ e[0] = r;
845
+ else if (s && n) {
846
+ const o = s.readValue(n, a);
847
+ o != null && (e[0] = o);
848
+ }
849
+ e[0] === void 0 && (e[0] = a), i && r === void 0 && i.set(e[0]);
850
+ }
851
+ Gs(e);
852
+ }
853
+ setFinalKeyframe() {
854
+ }
855
+ measureInitialState() {
856
+ }
857
+ renderEndStyles() {
858
+ }
859
+ measureEndState() {
860
+ }
861
+ complete(e = !1) {
862
+ this.isComplete = !0, this.onComplete(this.unresolvedKeyframes, this.finalKeyframe, e), _.delete(this);
863
+ }
864
+ cancel() {
865
+ this.isComplete || (this.isScheduled = !1, _.delete(this));
866
+ }
867
+ resume() {
868
+ this.isComplete || this.scheduleResolve();
869
+ }
870
+ }
871
+ const Zs = (t) => t.startsWith("--");
872
+ function Js(t, e, n) {
873
+ Zs(e) ? t.style.setProperty(e, n) : t.style[e] = n;
874
+ }
875
+ const Qs = /* @__PURE__ */ Be(() => window.ScrollTimeline !== void 0), ei = {};
876
+ function ti(t, e) {
877
+ const n = /* @__PURE__ */ Be(t);
878
+ return () => ei[e] ?? n();
879
+ }
880
+ const on = /* @__PURE__ */ ti(() => {
881
+ try {
882
+ document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
883
+ } catch {
884
+ return !1;
885
+ }
886
+ return !0;
887
+ }, "linearEasing"), X = ([t, e, n, s]) => `cubic-bezier(${t}, ${e}, ${n}, ${s})`, lt = {
888
+ linear: "linear",
889
+ ease: "ease",
890
+ easeIn: "ease-in",
891
+ easeOut: "ease-out",
892
+ easeInOut: "ease-in-out",
893
+ circIn: /* @__PURE__ */ X([0, 0.65, 0.55, 1]),
894
+ circOut: /* @__PURE__ */ X([0.55, 0, 1, 0.45]),
895
+ backIn: /* @__PURE__ */ X([0.31, 0.01, 0.66, -0.59]),
896
+ backOut: /* @__PURE__ */ X([0.33, 1.53, 0.69, 0.99])
897
+ };
898
+ function un(t, e) {
899
+ if (t)
900
+ return typeof t == "function" ? on() ? en(t, e) : "ease-out" : qt(t) ? X(t) : Array.isArray(t) ? t.map((n) => un(n, e) || lt.easeOut) : lt[t];
901
+ }
902
+ function ni(t, e, n, { delay: s = 0, duration: i = 300, repeat: r = 0, repeatType: a = "loop", ease: o = "easeOut", times: u } = {}, l = void 0) {
903
+ const c = {
904
+ [e]: n
905
+ };
906
+ u && (c.offset = u);
907
+ const f = un(o, i);
908
+ Array.isArray(f) && (c.easing = f);
909
+ const h = {
910
+ delay: s,
911
+ duration: i,
912
+ easing: Array.isArray(f) ? "linear" : f,
913
+ fill: "both",
914
+ iterations: r + 1,
915
+ direction: a === "reverse" ? "alternate" : "normal"
916
+ };
917
+ return l && (h.pseudoElement = l), t.animate(c, h);
918
+ }
919
+ function ln(t) {
920
+ return typeof t == "function" && "applyToOptions" in t;
921
+ }
922
+ function si({ type: t, ...e }) {
923
+ return ln(t) && on() ? t.applyToOptions(e) : (e.duration ?? (e.duration = 300), e.ease ?? (e.ease = "easeOut"), e);
924
+ }
925
+ class ii extends qe {
926
+ constructor(e) {
927
+ if (super(), this.finishedTime = null, this.isStopped = !1, !e)
928
+ return;
929
+ const { element: n, name: s, keyframes: i, pseudoElement: r, allowFlatten: a = !1, finalKeyframe: o, onComplete: u } = e;
930
+ this.isPseudoElement = !!r, this.allowFlatten = a, this.options = e, G(typeof e.type != "string", `animateMini doesn't support "type" as a string. Did you mean to import { spring } from "motion"?`);
931
+ const l = si(e);
932
+ this.animation = ni(n, s, i, l, r), l.autoplay === !1 && this.animation.pause(), this.animation.onfinish = () => {
933
+ if (this.finishedTime = this.time, !r) {
934
+ const c = We(i, this.options, o, this.speed);
935
+ this.updateMotionValue ? this.updateMotionValue(c) : Js(n, s, c), this.animation.cancel();
936
+ }
937
+ u == null || u(), this.notifyFinished();
938
+ }, this.animation.oncancel = () => this.notifyFinished();
939
+ }
940
+ play() {
941
+ this.isStopped || (this.animation.play(), this.state === "finished" && this.updateFinished());
942
+ }
943
+ pause() {
944
+ this.animation.pause();
945
+ }
946
+ complete() {
947
+ var e, n;
948
+ (n = (e = this.animation).finish) == null || n.call(e);
949
+ }
950
+ cancel() {
951
+ try {
952
+ this.animation.cancel();
953
+ } catch {
954
+ }
955
+ }
956
+ stop() {
957
+ if (this.isStopped)
958
+ return;
959
+ this.isStopped = !0;
960
+ const { state: e } = this;
961
+ e === "idle" || e === "finished" || (this.updateMotionValue ? this.updateMotionValue() : this.commitStyles(), this.isPseudoElement || this.cancel());
962
+ }
963
+ /**
964
+ * WAAPI doesn't natively have any interruption capabilities.
965
+ *
966
+ * In this method, we commit styles back to the DOM before cancelling
967
+ * the animation.
968
+ *
969
+ * This is designed to be overridden by NativeAnimationExtended, which
970
+ * will create a renderless JS animation and sample it twice to calculate
971
+ * its current value, "previous" value, and therefore allow
972
+ * Motion to also correctly calculate velocity for any subsequent animation
973
+ * while deferring the commit until the next animation frame.
974
+ */
975
+ commitStyles() {
976
+ var e, n;
977
+ this.isPseudoElement || (n = (e = this.animation).commitStyles) == null || n.call(e);
978
+ }
979
+ get duration() {
980
+ var n, s;
981
+ const e = ((s = (n = this.animation.effect) == null ? void 0 : n.getComputedTiming) == null ? void 0 : s.call(n).duration) || 0;
982
+ return /* @__PURE__ */ R(Number(e));
983
+ }
984
+ get time() {
985
+ return /* @__PURE__ */ R(Number(this.animation.currentTime) || 0);
986
+ }
987
+ set time(e) {
988
+ this.finishedTime = null, this.animation.currentTime = /* @__PURE__ */ O(e);
989
+ }
990
+ /**
991
+ * The playback speed of the animation.
992
+ * 1 = normal speed, 2 = double speed, 0.5 = half speed.
993
+ */
994
+ get speed() {
995
+ return this.animation.playbackRate;
996
+ }
997
+ set speed(e) {
998
+ e < 0 && (this.finishedTime = null), this.animation.playbackRate = e;
999
+ }
1000
+ get state() {
1001
+ return this.finishedTime !== null ? "finished" : this.animation.playState;
1002
+ }
1003
+ get startTime() {
1004
+ return Number(this.animation.startTime);
1005
+ }
1006
+ set startTime(e) {
1007
+ this.animation.startTime = e;
1008
+ }
1009
+ /**
1010
+ * Attaches a timeline to the animation, for instance the `ScrollTimeline`.
1011
+ */
1012
+ attachTimeline({ timeline: e, observe: n }) {
1013
+ var s;
1014
+ return this.allowFlatten && ((s = this.animation.effect) == null || s.updateTiming({ easing: "linear" })), this.animation.onfinish = null, e && Qs() ? (this.animation.timeline = e, H) : n(this);
1015
+ }
1016
+ }
1017
+ const cn = {
1018
+ anticipate: Ut,
1019
+ backInOut: Gt,
1020
+ circInOut: jt
1021
+ };
1022
+ function ri(t) {
1023
+ return t in cn;
1024
+ }
1025
+ function ai(t) {
1026
+ typeof t.ease == "string" && ri(t.ease) && (t.ease = cn[t.ease]);
1027
+ }
1028
+ const ct = 10;
1029
+ class oi extends ii {
1030
+ constructor(e) {
1031
+ ai(e), nn(e), super(e), e.startTime && (this.startTime = e.startTime), this.options = e;
1032
+ }
1033
+ /**
1034
+ * WAAPI doesn't natively have any interruption capabilities.
1035
+ *
1036
+ * Rather than read commited styles back out of the DOM, we can
1037
+ * create a renderless JS animation and sample it twice to calculate
1038
+ * its current value, "previous" value, and therefore allow
1039
+ * Motion to calculate velocity for any subsequent animation.
1040
+ */
1041
+ updateMotionValue(e) {
1042
+ const { motionValue: n, onUpdate: s, onComplete: i, element: r, ...a } = this.options;
1043
+ if (!n)
1044
+ return;
1045
+ if (e !== void 0) {
1046
+ n.set(e);
1047
+ return;
1048
+ }
1049
+ const o = new sn({
1050
+ ...a,
1051
+ autoplay: !1
1052
+ }), u = /* @__PURE__ */ O(this.finishedTime ?? this.time);
1053
+ n.setWithVelocity(o.sample(u - ct).value, o.sample(u).value, ct), o.stop();
1054
+ }
1055
+ }
1056
+ const ht = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string
1057
+ (z.test(t) || t === "0") && // And it contains numbers and/or colors
1058
+ !t.startsWith("url("));
1059
+ function ui(t) {
1060
+ const e = t[0];
1061
+ if (t.length === 1)
1062
+ return !0;
1063
+ for (let n = 0; n < t.length; n++)
1064
+ if (t[n] !== e)
1065
+ return !0;
1066
+ }
1067
+ function li(t, e, n, s) {
1068
+ const i = t[0];
1069
+ if (i === null)
1070
+ return !1;
1071
+ if (e === "display" || e === "visibility")
1072
+ return !0;
1073
+ const r = t[t.length - 1], a = ht(i, e), o = ht(r, e);
1074
+ return te(a === o, `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.`), !a || !o ? !1 : ui(t) || (n === "spring" || ln(n)) && s;
1075
+ }
1076
+ const ci = /* @__PURE__ */ new Set([
1077
+ "opacity",
1078
+ "clipPath",
1079
+ "filter",
1080
+ "transform"
1081
+ // TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved
1082
+ // or until we implement support for linear() easing.
1083
+ // "background-color"
1084
+ ]), hi = /* @__PURE__ */ Be(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
1085
+ function fi(t) {
1086
+ const { motionValue: e, name: n, repeatDelay: s, repeatType: i, damping: r, type: a } = t;
1087
+ if (!e || !e.owner || !(e.owner.current instanceof HTMLElement))
1088
+ return !1;
1089
+ const { onUpdate: o, transformTemplate: u } = e.owner.getProps();
1090
+ return hi() && n && ci.has(n) && (n !== "transform" || !u) && /**
1091
+ * If we're outputting values to onUpdate then we can't use WAAPI as there's
1092
+ * no way to read the value from WAAPI every frame.
1093
+ */
1094
+ !o && !s && i !== "mirror" && r !== 0 && a !== "inertia";
1095
+ }
1096
+ const di = 40;
1097
+ class pi extends qe {
1098
+ constructor({ autoplay: e = !0, delay: n = 0, type: s = "keyframes", repeat: i = 0, repeatDelay: r = 0, repeatType: a = "loop", keyframes: o, name: u, motionValue: l, element: c, ...f }) {
1099
+ var v;
1100
+ super(), this.stop = () => {
1101
+ var y, b;
1102
+ this._animation ? (this._animation.stop(), (y = this.stopTimeline) == null || y.call(this)) : (b = this.keyframeResolver) == null || b.cancel();
1103
+ }, this.createdAt = D.now();
1104
+ const h = {
1105
+ autoplay: e,
1106
+ delay: n,
1107
+ type: s,
1108
+ repeat: i,
1109
+ repeatDelay: r,
1110
+ repeatType: a,
1111
+ name: u,
1112
+ motionValue: l,
1113
+ element: c,
1114
+ ...f
1115
+ }, d = (c == null ? void 0 : c.KeyframeResolver) || He;
1116
+ this.keyframeResolver = new d(o, (y, b, p) => this.onKeyframesResolved(y, b, h, !p), u, l, c), (v = this.keyframeResolver) == null || v.scheduleResolve();
1117
+ }
1118
+ onKeyframesResolved(e, n, s, i) {
1119
+ this.keyframeResolver = void 0;
1120
+ const { name: r, type: a, velocity: o, delay: u, isHandoff: l, onUpdate: c } = s;
1121
+ this.resolvedAt = D.now(), li(e, r, a, o) || (($.instantAnimations || !u) && (c == null || c(We(e, s, n))), e[0] = e[e.length - 1], s.duration = 0, s.repeat = 0);
1122
+ const h = {
1123
+ startTime: i ? this.resolvedAt ? this.resolvedAt - this.createdAt > di ? this.resolvedAt : this.createdAt : this.createdAt : void 0,
1124
+ finalKeyframe: n,
1125
+ ...s,
1126
+ keyframes: e
1127
+ }, d = !l && fi(h) ? new oi({
1128
+ ...h,
1129
+ element: h.motionValue.owner.current
1130
+ }) : new sn(h);
1131
+ d.finished.then(() => this.notifyFinished()).catch(H), this.pendingTimeline && (this.stopTimeline = d.attachTimeline(this.pendingTimeline), this.pendingTimeline = void 0), this._animation = d;
1132
+ }
1133
+ get finished() {
1134
+ return this._animation ? this.animation.finished : this._finished;
1135
+ }
1136
+ then(e, n) {
1137
+ return this.finished.finally(e).then(() => {
1138
+ });
1139
+ }
1140
+ get animation() {
1141
+ return this._animation || Xs(), this._animation;
1142
+ }
1143
+ get duration() {
1144
+ return this.animation.duration;
1145
+ }
1146
+ get time() {
1147
+ return this.animation.time;
1148
+ }
1149
+ set time(e) {
1150
+ this.animation.time = e;
1151
+ }
1152
+ get speed() {
1153
+ return this.animation.speed;
1154
+ }
1155
+ get state() {
1156
+ return this.animation.state;
1157
+ }
1158
+ set speed(e) {
1159
+ this.animation.speed = e;
1160
+ }
1161
+ get startTime() {
1162
+ return this.animation.startTime;
1163
+ }
1164
+ attachTimeline(e) {
1165
+ return this._animation ? this.stopTimeline = this.animation.attachTimeline(e) : this.pendingTimeline = e, () => this.stop();
1166
+ }
1167
+ play() {
1168
+ this.animation.play();
1169
+ }
1170
+ pause() {
1171
+ this.animation.pause();
1172
+ }
1173
+ complete() {
1174
+ this.animation.complete();
1175
+ }
1176
+ cancel() {
1177
+ this.animation.cancel();
1178
+ }
1179
+ }
1180
+ const mi = (
1181
+ // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words
1182
+ /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u
1183
+ );
1184
+ function gi(t) {
1185
+ const e = mi.exec(t);
1186
+ if (!e)
1187
+ return [,];
1188
+ const [, n, s, i] = e;
1189
+ return [`--${n ?? s}`, i];
1190
+ }
1191
+ const yi = 4;
1192
+ function hn(t, e, n = 1) {
1193
+ G(n <= yi, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);
1194
+ const [s, i] = gi(t);
1195
+ if (!s)
1196
+ return;
1197
+ const r = window.getComputedStyle(e).getPropertyValue(s);
1198
+ if (r) {
1199
+ const a = r.trim();
1200
+ return It(a) ? parseFloat(a) : a;
1201
+ }
1202
+ return Ke(i) ? hn(i, e, n + 1) : i;
1203
+ }
1204
+ function fn(t, e) {
1205
+ return (t == null ? void 0 : t[e]) ?? (t == null ? void 0 : t.default) ?? t;
1206
+ }
1207
+ const dn = /* @__PURE__ */ new Set([
1208
+ "width",
1209
+ "height",
1210
+ "top",
1211
+ "left",
1212
+ "right",
1213
+ "bottom",
1214
+ ...xt
1215
+ ]), bi = {
1216
+ test: (t) => t === "auto",
1217
+ parse: (t) => t
1218
+ }, pn = (t) => (e) => e.test(t), mn = [ke, St, ve, En, On, In, bi], ft = (t) => mn.find(pn(t));
1219
+ function vi(t) {
1220
+ return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || Rt(t) : !0;
1221
+ }
1222
+ const Ti = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]);
1223
+ function Vi(t) {
1224
+ const [e, n] = t.slice(0, -1).split("(");
1225
+ if (e === "drop-shadow")
1226
+ return t;
1227
+ const [s] = n.match($e) || [];
1228
+ if (!s)
1229
+ return t;
1230
+ const i = n.replace(s, "");
1231
+ let r = Ti.has(e) ? 1 : 0;
1232
+ return s !== n && (r *= 100), e + "(" + r + i + ")";
1233
+ }
1234
+ const Ai = /\b([a-z-]*)\(.*?\)/gu, Ee = {
1235
+ ...z,
1236
+ getAnimatableNone: (t) => {
1237
+ const e = t.match(Ai);
1238
+ return e ? e.map(Vi).join(" ") : t;
1239
+ }
1240
+ }, wi = {
1241
+ ...Rn,
1242
+ // Color props
1243
+ color: x,
1244
+ backgroundColor: x,
1245
+ outlineColor: x,
1246
+ fill: x,
1247
+ stroke: x,
1248
+ // Border props
1249
+ borderColor: x,
1250
+ borderTopColor: x,
1251
+ borderRightColor: x,
1252
+ borderBottomColor: x,
1253
+ borderLeftColor: x,
1254
+ filter: Ee,
1255
+ WebkitFilter: Ee
1256
+ }, gn = (t) => wi[t];
1257
+ function yn(t, e) {
1258
+ let n = gn(t);
1259
+ return n !== Ee && (n = z), n.getAnimatableNone ? n.getAnimatableNone(e) : void 0;
1260
+ }
1261
+ const Si = /* @__PURE__ */ new Set(["auto", "none", "0"]);
1262
+ function xi(t, e, n) {
1263
+ let s = 0, i;
1264
+ for (; s < t.length && !i; ) {
1265
+ const r = t[s];
1266
+ typeof r == "string" && !Si.has(r) && Q(r).values.length && (i = t[s]), s++;
1267
+ }
1268
+ if (i && n)
1269
+ for (const r of e)
1270
+ t[r] = yn(n, i);
1271
+ }
1272
+ class Mi extends He {
1273
+ constructor(e, n, s, i, r) {
1274
+ super(e, n, s, i, r, !0);
1275
+ }
1276
+ readKeyframes() {
1277
+ const { unresolvedKeyframes: e, element: n, name: s } = this;
1278
+ if (!n || !n.current)
1279
+ return;
1280
+ super.readKeyframes();
1281
+ for (let u = 0; u < e.length; u++) {
1282
+ let l = e[u];
1283
+ if (typeof l == "string" && (l = l.trim(), Ke(l))) {
1284
+ const c = hn(l, n.current);
1285
+ c !== void 0 && (e[u] = c), u === e.length - 1 && (this.finalKeyframe = l);
1286
+ }
1287
+ }
1288
+ if (this.resolveNoneKeyframes(), !dn.has(s) || e.length !== 2)
1289
+ return;
1290
+ const [i, r] = e, a = ft(i), o = ft(r);
1291
+ if (a !== o)
1292
+ if (ut(a) && ut(o))
1293
+ for (let u = 0; u < e.length; u++) {
1294
+ const l = e[u];
1295
+ typeof l == "string" && (e[u] = parseFloat(l));
1296
+ }
1297
+ else L[s] && (this.needsMeasurement = !0);
1298
+ }
1299
+ resolveNoneKeyframes() {
1300
+ const { unresolvedKeyframes: e, name: n } = this, s = [];
1301
+ for (let i = 0; i < e.length; i++)
1302
+ (e[i] === null || vi(e[i])) && s.push(i);
1303
+ s.length && xi(e, s, n);
1304
+ }
1305
+ measureInitialState() {
1306
+ const { element: e, unresolvedKeyframes: n, name: s } = this;
1307
+ if (!e || !e.current)
1308
+ return;
1309
+ s === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = L[s](e.measureViewportBox(), window.getComputedStyle(e.current)), n[0] = this.measuredOrigin;
1310
+ const i = n[n.length - 1];
1311
+ i !== void 0 && e.getValue(s, i).jump(i, !1);
1312
+ }
1313
+ measureEndState() {
1314
+ var o;
1315
+ const { element: e, name: n, unresolvedKeyframes: s } = this;
1316
+ if (!e || !e.current)
1317
+ return;
1318
+ const i = e.getValue(n);
1319
+ i && i.jump(this.measuredOrigin, !1);
1320
+ const r = s.length - 1, a = s[r];
1321
+ s[r] = L[n](e.measureViewportBox(), window.getComputedStyle(e.current)), a !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = a), (o = this.removedTransforms) != null && o.length && this.removedTransforms.forEach(([u, l]) => {
1322
+ e.getValue(u).set(l);
1323
+ }), this.resolveNoneKeyframes();
1324
+ }
1325
+ }
1326
+ function Ci(t, e, n) {
1327
+ if (t instanceof EventTarget)
1328
+ return [t];
1329
+ if (typeof t == "string") {
1330
+ let s = document;
1331
+ const i = (n == null ? void 0 : n[t]) ?? s.querySelectorAll(t);
1332
+ return i ? Array.from(i) : [];
1333
+ }
1334
+ return Array.from(t);
1335
+ }
1336
+ const dt = 30, Pi = (t) => !isNaN(parseFloat(t));
1337
+ class Fi {
1338
+ /**
1339
+ * @param init - The initiating value
1340
+ * @param config - Optional configuration options
1341
+ *
1342
+ * - `transformer`: A function to transform incoming values with.
1343
+ */
1344
+ constructor(e, n = {}) {
1345
+ this.version = "__VERSION__", this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (s, i = !0) => {
1346
+ var a, o;
1347
+ const r = D.now();
1348
+ if (this.updatedAt !== r && this.setPrevFrameValue(), this.prev = this.current, this.setCurrent(s), this.current !== this.prev && ((a = this.events.change) == null || a.notify(this.current), this.dependents))
1349
+ for (const u of this.dependents)
1350
+ u.dirty();
1351
+ i && ((o = this.events.renderRequest) == null || o.notify(this.current));
1352
+ }, this.hasAnimated = !1, this.setCurrent(e), this.owner = n.owner;
1353
+ }
1354
+ setCurrent(e) {
1355
+ this.current = e, this.updatedAt = D.now(), this.canTrackVelocity === null && e !== void 0 && (this.canTrackVelocity = Pi(this.current));
1356
+ }
1357
+ setPrevFrameValue(e = this.current) {
1358
+ this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt;
1359
+ }
1360
+ /**
1361
+ * Adds a function that will be notified when the `MotionValue` is updated.
1362
+ *
1363
+ * It returns a function that, when called, will cancel the subscription.
1364
+ *
1365
+ * When calling `onChange` inside a React component, it should be wrapped with the
1366
+ * `useEffect` hook. As it returns an unsubscribe function, this should be returned
1367
+ * from the `useEffect` function to ensure you don't add duplicate subscribers..
1368
+ *
1369
+ * ```jsx
1370
+ * export const MyComponent = () => {
1371
+ * const x = useMotionValue(0)
1372
+ * const y = useMotionValue(0)
1373
+ * const opacity = useMotionValue(1)
1374
+ *
1375
+ * useEffect(() => {
1376
+ * function updateOpacity() {
1377
+ * const maxXY = Math.max(x.get(), y.get())
1378
+ * const newOpacity = transform(maxXY, [0, 100], [1, 0])
1379
+ * opacity.set(newOpacity)
1380
+ * }
1381
+ *
1382
+ * const unsubscribeX = x.on("change", updateOpacity)
1383
+ * const unsubscribeY = y.on("change", updateOpacity)
1384
+ *
1385
+ * return () => {
1386
+ * unsubscribeX()
1387
+ * unsubscribeY()
1388
+ * }
1389
+ * }, [])
1390
+ *
1391
+ * return <motion.div style={{ x }} />
1392
+ * }
1393
+ * ```
1394
+ *
1395
+ * @param subscriber - A function that receives the latest value.
1396
+ * @returns A function that, when called, will cancel this subscription.
1397
+ *
1398
+ * @deprecated
1399
+ */
1400
+ onChange(e) {
1401
+ return process.env.NODE_ENV !== "production" && Mt(!1, 'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'), this.on("change", e);
1402
+ }
1403
+ on(e, n) {
1404
+ this.events[e] || (this.events[e] = new kt());
1405
+ const s = this.events[e].add(n);
1406
+ return e === "change" ? () => {
1407
+ s(), E.read(() => {
1408
+ this.events.change.getSize() || this.stop();
1409
+ });
1410
+ } : s;
1411
+ }
1412
+ clearListeners() {
1413
+ for (const e in this.events)
1414
+ this.events[e].clear();
1415
+ }
1416
+ /**
1417
+ * Attaches a passive effect to the `MotionValue`.
1418
+ */
1419
+ attach(e, n) {
1420
+ this.passiveEffect = e, this.stopPassiveEffect = n;
1421
+ }
1422
+ /**
1423
+ * Sets the state of the `MotionValue`.
1424
+ *
1425
+ * @remarks
1426
+ *
1427
+ * ```jsx
1428
+ * const x = useMotionValue(0)
1429
+ * x.set(10)
1430
+ * ```
1431
+ *
1432
+ * @param latest - Latest value to set.
1433
+ * @param render - Whether to notify render subscribers. Defaults to `true`
1434
+ *
1435
+ * @public
1436
+ */
1437
+ set(e, n = !0) {
1438
+ !n || !this.passiveEffect ? this.updateAndNotify(e, n) : this.passiveEffect(e, this.updateAndNotify);
1439
+ }
1440
+ setWithVelocity(e, n, s) {
1441
+ this.set(n), this.prev = void 0, this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt - s;
1442
+ }
1443
+ /**
1444
+ * Set the state of the `MotionValue`, stopping any active animations,
1445
+ * effects, and resets velocity to `0`.
1446
+ */
1447
+ jump(e, n = !0) {
1448
+ this.updateAndNotify(e), this.prev = e, this.prevUpdatedAt = this.prevFrameValue = void 0, n && this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
1449
+ }
1450
+ dirty() {
1451
+ var e;
1452
+ (e = this.events.change) == null || e.notify(this.current);
1453
+ }
1454
+ addDependent(e) {
1455
+ this.dependents || (this.dependents = /* @__PURE__ */ new Set()), this.dependents.add(e);
1456
+ }
1457
+ removeDependent(e) {
1458
+ this.dependents && this.dependents.delete(e);
1459
+ }
1460
+ /**
1461
+ * Returns the latest state of `MotionValue`
1462
+ *
1463
+ * @returns - The latest state of `MotionValue`
1464
+ *
1465
+ * @public
1466
+ */
1467
+ get() {
1468
+ return this.current;
1469
+ }
1470
+ /**
1471
+ * @public
1472
+ */
1473
+ getPrevious() {
1474
+ return this.prev;
1475
+ }
1476
+ /**
1477
+ * Returns the latest velocity of `MotionValue`
1478
+ *
1479
+ * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
1480
+ *
1481
+ * @public
1482
+ */
1483
+ getVelocity() {
1484
+ const e = D.now();
1485
+ if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > dt)
1486
+ return 0;
1487
+ const n = Math.min(this.updatedAt - this.prevUpdatedAt, dt);
1488
+ return Kt(parseFloat(this.current) - parseFloat(this.prevFrameValue), n);
1489
+ }
1490
+ /**
1491
+ * Registers a new animation to control this `MotionValue`. Only one
1492
+ * animation can drive a `MotionValue` at one time.
1493
+ *
1494
+ * ```jsx
1495
+ * value.start()
1496
+ * ```
1497
+ *
1498
+ * @param animation - A function that starts the provided animation
1499
+ */
1500
+ start(e) {
1501
+ return this.stop(), new Promise((n) => {
1502
+ this.hasAnimated = !0, this.animation = e(n), this.events.animationStart && this.events.animationStart.notify();
1503
+ }).then(() => {
1504
+ this.events.animationComplete && this.events.animationComplete.notify(), this.clearAnimation();
1505
+ });
1506
+ }
1507
+ /**
1508
+ * Stop the currently active animation.
1509
+ *
1510
+ * @public
1511
+ */
1512
+ stop() {
1513
+ this.animation && (this.animation.stop(), this.events.animationCancel && this.events.animationCancel.notify()), this.clearAnimation();
1514
+ }
1515
+ /**
1516
+ * Returns `true` if this value is currently animating.
1517
+ *
1518
+ * @public
1519
+ */
1520
+ isAnimating() {
1521
+ return !!this.animation;
1522
+ }
1523
+ clearAnimation() {
1524
+ delete this.animation;
1525
+ }
1526
+ /**
1527
+ * Destroy and clean up subscribers to this `MotionValue`.
1528
+ *
1529
+ * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
1530
+ * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
1531
+ * created a `MotionValue` via the `motionValue` function.
1532
+ *
1533
+ * @public
1534
+ */
1535
+ destroy() {
1536
+ var e, n;
1537
+ (e = this.dependents) == null || e.clear(), (n = this.events.destroy) == null || n.notify(), this.clearListeners(), this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
1538
+ }
1539
+ }
1540
+ function ue(t, e) {
1541
+ return new Fi(t, e);
1542
+ }
1543
+ const Di = {
1544
+ y: !1
1545
+ };
1546
+ function Ei() {
1547
+ return Di.y;
1548
+ }
1549
+ function bn(t, e) {
1550
+ const n = Ci(t), s = new AbortController(), i = {
1551
+ passive: !0,
1552
+ ...e,
1553
+ signal: s.signal
1554
+ };
1555
+ return [n, i, () => s.abort()];
1556
+ }
1557
+ function pt(t) {
1558
+ return !(t.pointerType === "touch" || Ei());
1559
+ }
1560
+ function Oi(t, e, n = {}) {
1561
+ const [s, i, r] = bn(t, n), a = (o) => {
1562
+ if (!pt(o))
1563
+ return;
1564
+ const { target: u } = o, l = e(u, o);
1565
+ if (typeof l != "function" || !u)
1566
+ return;
1567
+ const c = (f) => {
1568
+ pt(f) && (l(f), u.removeEventListener("pointerleave", c));
1569
+ };
1570
+ u.addEventListener("pointerleave", c, i);
1571
+ };
1572
+ return s.forEach((o) => {
1573
+ o.addEventListener("pointerenter", a, i);
1574
+ }), r;
1575
+ }
1576
+ const vn = (t, e) => e ? t === e ? !0 : vn(t, e.parentElement) : !1, Ii = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1, Ri = /* @__PURE__ */ new Set([
1577
+ "BUTTON",
1578
+ "INPUT",
1579
+ "SELECT",
1580
+ "TEXTAREA",
1581
+ "A"
1582
+ ]);
1583
+ function Ni(t) {
1584
+ return Ri.has(t.tagName) || t.tabIndex !== -1;
1585
+ }
1586
+ const Z = /* @__PURE__ */ new WeakSet();
1587
+ function mt(t) {
1588
+ return (e) => {
1589
+ e.key === "Enter" && t(e);
1590
+ };
1591
+ }
1592
+ function ye(t, e) {
1593
+ t.dispatchEvent(new PointerEvent("pointer" + e, { isPrimary: !0, bubbles: !0 }));
1594
+ }
1595
+ const ki = (t, e) => {
1596
+ const n = t.currentTarget;
1597
+ if (!n)
1598
+ return;
1599
+ const s = mt(() => {
1600
+ if (Z.has(n))
1601
+ return;
1602
+ ye(n, "down");
1603
+ const i = mt(() => {
1604
+ ye(n, "up");
1605
+ }), r = () => ye(n, "cancel");
1606
+ n.addEventListener("keyup", i, e), n.addEventListener("blur", r, e);
1607
+ });
1608
+ n.addEventListener("keydown", s, e), n.addEventListener("blur", () => n.removeEventListener("keydown", s), e);
1609
+ };
1610
+ function gt(t) {
1611
+ return Ii(t) && !0;
1612
+ }
1613
+ function Ki(t, e, n = {}) {
1614
+ const [s, i, r] = bn(t, n), a = (o) => {
1615
+ const u = o.currentTarget;
1616
+ if (!gt(o) || Z.has(u))
1617
+ return;
1618
+ Z.add(u);
1619
+ const l = e(u, o), c = (d, v) => {
1620
+ window.removeEventListener("pointerup", f), window.removeEventListener("pointercancel", h), Z.has(u) && Z.delete(u), gt(d) && typeof l == "function" && l(d, { success: v });
1621
+ }, f = (d) => {
1622
+ c(d, u === window || u === document || n.useGlobalTarget || vn(u, d.target));
1623
+ }, h = (d) => {
1624
+ c(d, !1);
1625
+ };
1626
+ window.addEventListener("pointerup", f, i), window.addEventListener("pointercancel", h, i);
1627
+ };
1628
+ return s.forEach((o) => {
1629
+ (n.useGlobalTarget ? window : o).addEventListener("pointerdown", a, i), o instanceof HTMLElement && (o.addEventListener("focus", (l) => ki(l, i)), !Ni(o) && !o.hasAttribute("tabindex") && (o.tabIndex = 0));
1630
+ }), r;
1631
+ }
1632
+ const Bi = [...mn, x, z], Li = (t) => Bi.find(pn(t));
1633
+ function ee(t, e, n) {
1634
+ const s = t.getProps();
1635
+ return Ct(s, e, n !== void 0 ? n : s.custom, t);
1636
+ }
1637
+ const Oe = (t) => Array.isArray(t);
1638
+ function _i(t, e, n) {
1639
+ t.hasValue(e) ? t.getValue(e).set(n) : t.addValue(e, ue(n));
1640
+ }
1641
+ function $i(t) {
1642
+ return Oe(t) ? t[t.length - 1] || 0 : t;
1643
+ }
1644
+ function Gi(t, e) {
1645
+ const n = ee(t, e);
1646
+ let { transitionEnd: s = {}, transition: i = {}, ...r } = n || {};
1647
+ r = { ...r, ...s };
1648
+ for (const a in r) {
1649
+ const o = $i(r[a]);
1650
+ _i(t, a, o);
1651
+ }
1652
+ }
1653
+ function Ui(t) {
1654
+ return !!(N(t) && t.add);
1655
+ }
1656
+ function ji(t, e) {
1657
+ const n = t.getValue("willChange");
1658
+ if (Ui(n))
1659
+ return n.add(e);
1660
+ if (!n && $.WillChange) {
1661
+ const s = new $.WillChange("auto");
1662
+ t.addValue("willChange", s), s.add(e);
1663
+ }
1664
+ }
1665
+ function Wi(t) {
1666
+ return t.props[Nn];
1667
+ }
1668
+ const qi = (t) => t !== null;
1669
+ function Hi(t, { repeat: e, repeatType: n = "loop" }, s) {
1670
+ const i = t.filter(qi), r = e && n !== "loop" && e % 2 === 1 ? 0 : i.length - 1;
1671
+ return i[r];
1672
+ }
1673
+ const zi = {
1674
+ type: "spring",
1675
+ stiffness: 500,
1676
+ damping: 25,
1677
+ restSpeed: 10
1678
+ }, Yi = (t) => ({
1679
+ type: "spring",
1680
+ stiffness: 550,
1681
+ damping: t === 0 ? 2 * Math.sqrt(550) : 30,
1682
+ restSpeed: 10
1683
+ }), Xi = {
1684
+ type: "keyframes",
1685
+ duration: 0.8
1686
+ }, Zi = {
1687
+ type: "keyframes",
1688
+ ease: [0.25, 0.1, 0.35, 1],
1689
+ duration: 0.3
1690
+ }, Ji = (t, { keyframes: e }) => e.length > 2 ? Xi : le.has(t) ? t.startsWith("scale") ? Yi(e[1]) : zi : Zi;
1691
+ function Qi({ when: t, delay: e, delayChildren: n, staggerChildren: s, staggerDirection: i, repeat: r, repeatType: a, repeatDelay: o, from: u, elapsed: l, ...c }) {
1692
+ return !!Object.keys(c).length;
1693
+ }
1694
+ const er = (t, e, n, s = {}, i, r) => (a) => {
1695
+ const o = fn(s, t) || {}, u = o.delay || s.delay || 0;
1696
+ let { elapsed: l = 0 } = s;
1697
+ l = l - /* @__PURE__ */ O(u);
1698
+ const c = {
1699
+ keyframes: Array.isArray(n) ? n : [null, n],
1700
+ ease: "easeOut",
1701
+ velocity: e.getVelocity(),
1702
+ ...o,
1703
+ delay: -l,
1704
+ onUpdate: (h) => {
1705
+ e.set(h), o.onUpdate && o.onUpdate(h);
1706
+ },
1707
+ onComplete: () => {
1708
+ a(), o.onComplete && o.onComplete();
1709
+ },
1710
+ name: t,
1711
+ motionValue: e,
1712
+ element: r ? void 0 : i
1713
+ };
1714
+ Qi(o) || Object.assign(c, Ji(t, c)), c.duration && (c.duration = /* @__PURE__ */ O(c.duration)), c.repeatDelay && (c.repeatDelay = /* @__PURE__ */ O(c.repeatDelay)), c.from !== void 0 && (c.keyframes[0] = c.from);
1715
+ let f = !1;
1716
+ if ((c.type === !1 || c.duration === 0 && !c.repeatDelay) && (c.duration = 0, c.delay === 0 && (f = !0)), ($.instantAnimations || $.skipAnimations) && (f = !0, c.duration = 0, c.delay = 0), c.allowFlatten = !o.type && !o.ease, f && !r && e.get() !== void 0) {
1717
+ const h = Hi(c.keyframes, o);
1718
+ if (h !== void 0) {
1719
+ E.update(() => {
1720
+ c.onUpdate(h), c.onComplete();
1721
+ });
1722
+ return;
1723
+ }
1724
+ }
1725
+ return new pi(c);
1726
+ };
1727
+ function tr({ protectedKeys: t, needsAnimating: e }, n) {
1728
+ const s = t.hasOwnProperty(n) && e[n] !== !0;
1729
+ return e[n] = !1, s;
1730
+ }
1731
+ function Tn(t, e, { delay: n = 0, transitionOverride: s, type: i } = {}) {
1732
+ let { transition: r = t.getDefaultTransition(), transitionEnd: a, ...o } = e;
1733
+ s && (r = s);
1734
+ const u = [], l = i && t.animationState && t.animationState.getState()[i];
1735
+ for (const c in o) {
1736
+ const f = t.getValue(c, t.latestValues[c] ?? null), h = o[c];
1737
+ if (h === void 0 || l && tr(l, c))
1738
+ continue;
1739
+ const d = {
1740
+ delay: n,
1741
+ ...fn(r || {}, c)
1742
+ }, v = f.get();
1743
+ if (v !== void 0 && !f.isAnimating && !Array.isArray(h) && h === v && !d.velocity)
1744
+ continue;
1745
+ let y = !1;
1746
+ if (window.MotionHandoffAnimation) {
1747
+ const p = Wi(t);
1748
+ if (p) {
1749
+ const T = window.MotionHandoffAnimation(p, c, E);
1750
+ T !== null && (d.startTime = T, y = !0);
1751
+ }
1752
+ }
1753
+ ji(t, c), f.start(er(c, f, h, t.shouldReduceMotion && dn.has(c) ? { type: !1 } : d, t, y));
1754
+ const b = f.animation;
1755
+ b && u.push(b);
1756
+ }
1757
+ return a && Promise.all(u).then(() => {
1758
+ E.update(() => {
1759
+ a && Gi(t, a);
1760
+ });
1761
+ }), u;
1762
+ }
1763
+ function Ie(t, e, n = {}) {
1764
+ var u;
1765
+ const s = ee(t, e, n.type === "exit" ? (u = t.presenceContext) == null ? void 0 : u.custom : void 0);
1766
+ let { transition: i = t.getDefaultTransition() || {} } = s || {};
1767
+ n.transitionOverride && (i = n.transitionOverride);
1768
+ const r = s ? () => Promise.all(Tn(t, s, n)) : () => Promise.resolve(), a = t.variantChildren && t.variantChildren.size ? (l = 0) => {
1769
+ const { delayChildren: c = 0, staggerChildren: f, staggerDirection: h } = i;
1770
+ return nr(t, e, c + l, f, h, n);
1771
+ } : () => Promise.resolve(), { when: o } = i;
1772
+ if (o) {
1773
+ const [l, c] = o === "beforeChildren" ? [r, a] : [a, r];
1774
+ return l().then(() => c());
1775
+ } else
1776
+ return Promise.all([r(), a(n.delay)]);
1777
+ }
1778
+ function nr(t, e, n = 0, s = 0, i = 1, r) {
1779
+ const a = [], o = (t.variantChildren.size - 1) * s, u = i === 1 ? (l = 0) => l * s : (l = 0) => o - l * s;
1780
+ return Array.from(t.variantChildren).sort(sr).forEach((l, c) => {
1781
+ l.notify("AnimationStart", e), a.push(Ie(l, e, {
1782
+ ...r,
1783
+ delay: n + u(c)
1784
+ }).then(() => l.notify("AnimationComplete", e)));
1785
+ }), Promise.all(a);
1786
+ }
1787
+ function sr(t, e) {
1788
+ return t.sortNodePosition(e);
1789
+ }
1790
+ function ir(t, e, n = {}) {
1791
+ t.notify("AnimationStart", e);
1792
+ let s;
1793
+ if (Array.isArray(e)) {
1794
+ const i = e.map((r) => Ie(t, r, n));
1795
+ s = Promise.all(i);
1796
+ } else if (typeof e == "string")
1797
+ s = Ie(t, e, n);
1798
+ else {
1799
+ const i = typeof e == "function" ? ee(t, e, n.custom) : e;
1800
+ s = Promise.all(Tn(t, i, n));
1801
+ }
1802
+ return s.then(() => {
1803
+ t.notify("AnimationComplete", e);
1804
+ });
1805
+ }
1806
+ function Vn(t, e) {
1807
+ if (!Array.isArray(e))
1808
+ return !1;
1809
+ const n = e.length;
1810
+ if (n !== t.length)
1811
+ return !1;
1812
+ for (let s = 0; s < n; s++)
1813
+ if (e[s] !== t[s])
1814
+ return !1;
1815
+ return !0;
1816
+ }
1817
+ const rr = Ft.length;
1818
+ function An(t) {
1819
+ if (!t)
1820
+ return;
1821
+ if (!t.isControllingVariants) {
1822
+ const n = t.parent ? An(t.parent) || {} : {};
1823
+ return t.props.initial !== void 0 && (n.initial = t.props.initial), n;
1824
+ }
1825
+ const e = {};
1826
+ for (let n = 0; n < rr; n++) {
1827
+ const s = Ft[n], i = t.props[s];
1828
+ (Pt(i) || i === !1) && (e[s] = i);
1829
+ }
1830
+ return e;
1831
+ }
1832
+ const ar = [...Et].reverse(), or = Et.length;
1833
+ function ur(t) {
1834
+ return (e) => Promise.all(e.map(({ animation: n, options: s }) => ir(t, n, s)));
1835
+ }
1836
+ function lr(t) {
1837
+ let e = ur(t), n = yt(), s = !0;
1838
+ const i = (u) => (l, c) => {
1839
+ var h;
1840
+ const f = ee(t, c, u === "exit" ? (h = t.presenceContext) == null ? void 0 : h.custom : void 0);
1841
+ if (f) {
1842
+ const { transition: d, transitionEnd: v, ...y } = f;
1843
+ l = { ...l, ...y, ...v };
1844
+ }
1845
+ return l;
1846
+ };
1847
+ function r(u) {
1848
+ e = u(t);
1849
+ }
1850
+ function a(u) {
1851
+ const { props: l } = t, c = An(t.parent) || {}, f = [], h = /* @__PURE__ */ new Set();
1852
+ let d = {}, v = 1 / 0;
1853
+ for (let b = 0; b < or; b++) {
1854
+ const p = ar[b], T = n[p], V = l[p] !== void 0 ? l[p] : c[p], P = Pt(V), m = p === u ? T.isActive : null;
1855
+ m === !1 && (v = b);
1856
+ let A = V === c[p] && V !== l[p] && P;
1857
+ if (A && s && t.manuallyAnimateOnMount && (A = !1), T.protectedKeys = { ...d }, // If it isn't active and hasn't *just* been set as inactive
1858
+ !T.isActive && m === null || // If we didn't and don't have any defined prop for this animation type
1859
+ !V && !T.prevProp || // Or if the prop doesn't define an animation
1860
+ Dt(V) || typeof V == "boolean")
1861
+ continue;
1862
+ const S = cr(T.prevProp, V);
1863
+ let g = S || // If we're making this variant active, we want to always make it active
1864
+ p === u && T.isActive && !A && P || // If we removed a higher-priority variant (i is in reverse order)
1865
+ b > v && P, C = !1;
1866
+ const F = Array.isArray(V) ? V : [V];
1867
+ let U = F.reduce(i(p), {});
1868
+ m === !1 && (U = {});
1869
+ const { prevResolvedValues: ze = {} } = T, Fn = {
1870
+ ...ze,
1871
+ ...U
1872
+ }, Ye = (M) => {
1873
+ g = !0, h.has(M) && (C = !0, h.delete(M)), T.needsAnimating[M] = !0;
1874
+ const I = t.getValue(M);
1875
+ I && (I.liveStyle = !1);
1876
+ };
1877
+ for (const M in Fn) {
1878
+ const I = U[M], fe = ze[M];
1879
+ if (d.hasOwnProperty(M))
1880
+ continue;
1881
+ let de = !1;
1882
+ Oe(I) && Oe(fe) ? de = !Vn(I, fe) : de = I !== fe, de ? I != null ? Ye(M) : h.add(M) : I !== void 0 && h.has(M) ? Ye(M) : T.protectedKeys[M] = !0;
1883
+ }
1884
+ T.prevProp = V, T.prevResolvedValues = U, T.isActive && (d = { ...d, ...U }), s && t.blockInitialAnimation && (g = !1), g && (!(A && S) || C) && f.push(...F.map((M) => ({
1885
+ animation: M,
1886
+ options: { type: p }
1887
+ })));
1888
+ }
1889
+ if (h.size) {
1890
+ const b = {};
1891
+ if (typeof l.initial != "boolean") {
1892
+ const p = ee(t, Array.isArray(l.initial) ? l.initial[0] : l.initial);
1893
+ p && p.transition && (b.transition = p.transition);
1894
+ }
1895
+ h.forEach((p) => {
1896
+ const T = t.getBaseTarget(p), V = t.getValue(p);
1897
+ V && (V.liveStyle = !0), b[p] = T ?? null;
1898
+ }), f.push({ animation: b });
1899
+ }
1900
+ let y = !!f.length;
1901
+ return s && (l.initial === !1 || l.initial === l.animate) && !t.manuallyAnimateOnMount && (y = !1), s = !1, y ? e(f) : Promise.resolve();
1902
+ }
1903
+ function o(u, l) {
1904
+ var f;
1905
+ if (n[u].isActive === l)
1906
+ return Promise.resolve();
1907
+ (f = t.variantChildren) == null || f.forEach((h) => {
1908
+ var d;
1909
+ return (d = h.animationState) == null ? void 0 : d.setActive(u, l);
1910
+ }), n[u].isActive = l;
1911
+ const c = a(u);
1912
+ for (const h in n)
1913
+ n[h].protectedKeys = {};
1914
+ return c;
1915
+ }
1916
+ return {
1917
+ animateChanges: a,
1918
+ setActive: o,
1919
+ setAnimateFunction: r,
1920
+ getState: () => n,
1921
+ reset: () => {
1922
+ n = yt(), s = !0;
1923
+ }
1924
+ };
1925
+ }
1926
+ function cr(t, e) {
1927
+ return typeof e == "string" ? e !== t : Array.isArray(e) ? !Vn(e, t) : !1;
1928
+ }
1929
+ function k(t = !1) {
1930
+ return {
1931
+ isActive: t,
1932
+ protectedKeys: {},
1933
+ needsAnimating: {},
1934
+ prevResolvedValues: {}
1935
+ };
1936
+ }
1937
+ function yt() {
1938
+ return {
1939
+ animate: k(!0),
1940
+ whileInView: k(),
1941
+ whileHover: k(),
1942
+ whileTap: k(),
1943
+ whileDrag: k(),
1944
+ whileFocus: k(),
1945
+ exit: k()
1946
+ };
1947
+ }
1948
+ class Y {
1949
+ constructor(e) {
1950
+ this.isMounted = !1, this.node = e;
1951
+ }
1952
+ update() {
1953
+ }
1954
+ }
1955
+ class hr extends Y {
1956
+ /**
1957
+ * We dynamically generate the AnimationState manager as it contains a reference
1958
+ * to the underlying animation library. We only want to load that if we load this,
1959
+ * so people can optionally code split it out using the `m` component.
1960
+ */
1961
+ constructor(e) {
1962
+ super(e), e.animationState || (e.animationState = lr(e));
1963
+ }
1964
+ updateAnimationControlsSubscription() {
1965
+ const { animate: e } = this.node.getProps();
1966
+ Dt(e) && (this.unmountControls = e.subscribe(this.node));
1967
+ }
1968
+ /**
1969
+ * Subscribe any provided AnimationControls to the component's VisualElement
1970
+ */
1971
+ mount() {
1972
+ this.updateAnimationControlsSubscription();
1973
+ }
1974
+ update() {
1975
+ const { animate: e } = this.node.getProps(), { animate: n } = this.node.prevProps || {};
1976
+ e !== n && this.updateAnimationControlsSubscription();
1977
+ }
1978
+ unmount() {
1979
+ var e;
1980
+ this.node.animationState.reset(), (e = this.unmountControls) == null || e.call(this);
1981
+ }
1982
+ }
1983
+ let fr = 0;
1984
+ class dr extends Y {
1985
+ constructor() {
1986
+ super(...arguments), this.id = fr++;
1987
+ }
1988
+ update() {
1989
+ if (!this.node.presenceContext)
1990
+ return;
1991
+ const { isPresent: e, onExitComplete: n } = this.node.presenceContext, { isPresent: s } = this.node.prevPresenceContext || {};
1992
+ if (!this.node.animationState || e === s)
1993
+ return;
1994
+ const i = this.node.animationState.setActive("exit", !e);
1995
+ n && !e && i.then(() => {
1996
+ n(this.id);
1997
+ });
1998
+ }
1999
+ mount() {
2000
+ const { register: e, onExitComplete: n } = this.node.presenceContext || {};
2001
+ n && n(this.id), e && (this.unmount = e(this.id));
2002
+ }
2003
+ unmount() {
2004
+ }
2005
+ }
2006
+ const pr = {
2007
+ animation: {
2008
+ Feature: hr
2009
+ },
2010
+ exit: {
2011
+ Feature: dr
2012
+ }
2013
+ };
2014
+ function bt(t, e, n, s = { passive: !0 }) {
2015
+ return t.addEventListener(e, n, s), () => t.removeEventListener(e, n);
2016
+ }
2017
+ function wn(t) {
2018
+ return {
2019
+ point: {
2020
+ x: t.pageX,
2021
+ y: t.pageY
2022
+ }
2023
+ };
2024
+ }
2025
+ function mr({ top: t, left: e, right: n, bottom: s }) {
2026
+ return {
2027
+ x: { min: e, max: n },
2028
+ y: { min: t, max: s }
2029
+ };
2030
+ }
2031
+ function gr(t, e) {
2032
+ if (!e)
2033
+ return t;
2034
+ const n = e({ x: t.left, y: t.top }), s = e({ x: t.right, y: t.bottom });
2035
+ return {
2036
+ top: n.y,
2037
+ left: n.x,
2038
+ bottom: s.y,
2039
+ right: s.x
2040
+ };
2041
+ }
2042
+ const vt = () => ({ min: 0, max: 0 }), Sn = () => ({
2043
+ x: vt(),
2044
+ y: vt()
2045
+ });
2046
+ function yr(t, e) {
2047
+ return mr(gr(t.getBoundingClientRect(), e));
2048
+ }
2049
+ function Tt(t, e, n) {
2050
+ const { props: s } = t;
2051
+ t.animationState && s.whileHover && t.animationState.setActive("whileHover", n === "Start");
2052
+ const i = "onHover" + n, r = s[i];
2053
+ r && E.postRender(() => r(e, wn(e)));
2054
+ }
2055
+ class br extends Y {
2056
+ mount() {
2057
+ const { current: e } = this.node;
2058
+ e && (this.unmount = Oi(e, (n, s) => (Tt(this.node, s, "Start"), (i) => Tt(this.node, i, "End"))));
2059
+ }
2060
+ unmount() {
2061
+ }
2062
+ }
2063
+ class vr extends Y {
2064
+ constructor() {
2065
+ super(...arguments), this.isActive = !1;
2066
+ }
2067
+ onFocus() {
2068
+ let e = !1;
2069
+ try {
2070
+ e = this.node.current.matches(":focus-visible");
2071
+ } catch {
2072
+ e = !0;
2073
+ }
2074
+ !e || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !0), this.isActive = !0);
2075
+ }
2076
+ onBlur() {
2077
+ !this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1);
2078
+ }
2079
+ mount() {
2080
+ this.unmount = ce(bt(this.node.current, "focus", () => this.onFocus()), bt(this.node.current, "blur", () => this.onBlur()));
2081
+ }
2082
+ unmount() {
2083
+ }
2084
+ }
2085
+ function Vt(t, e, n) {
2086
+ const { props: s } = t;
2087
+ if (t.current instanceof HTMLButtonElement && t.current.disabled)
2088
+ return;
2089
+ t.animationState && s.whileTap && t.animationState.setActive("whileTap", n === "Start");
2090
+ const i = "onTap" + (n === "End" ? "" : n), r = s[i];
2091
+ r && E.postRender(() => r(e, wn(e)));
2092
+ }
2093
+ class Tr extends Y {
2094
+ mount() {
2095
+ const { current: e } = this.node;
2096
+ e && (this.unmount = Ki(e, (n, s) => (Vt(this.node, s, "Start"), (i, { success: r }) => Vt(this.node, i, r ? "End" : "Cancel")), { useGlobalTarget: this.node.props.globalTapTarget }));
2097
+ }
2098
+ unmount() {
2099
+ }
2100
+ }
2101
+ const Re = /* @__PURE__ */ new WeakMap(), be = /* @__PURE__ */ new WeakMap(), Vr = (t) => {
2102
+ const e = Re.get(t.target);
2103
+ e && e(t);
2104
+ }, Ar = (t) => {
2105
+ t.forEach(Vr);
2106
+ };
2107
+ function wr({ root: t, ...e }) {
2108
+ const n = t || document;
2109
+ be.has(n) || be.set(n, {});
2110
+ const s = be.get(n), i = JSON.stringify(e);
2111
+ return s[i] || (s[i] = new IntersectionObserver(Ar, { root: t, ...e })), s[i];
2112
+ }
2113
+ function Sr(t, e, n) {
2114
+ const s = wr(e);
2115
+ return Re.set(t, n), s.observe(t), () => {
2116
+ Re.delete(t), s.unobserve(t);
2117
+ };
2118
+ }
2119
+ const xr = {
2120
+ some: 0,
2121
+ all: 1
2122
+ };
2123
+ class Mr extends Y {
2124
+ constructor() {
2125
+ super(...arguments), this.hasEnteredView = !1, this.isInView = !1;
2126
+ }
2127
+ startObserver() {
2128
+ this.unmount();
2129
+ const { viewport: e = {} } = this.node.getProps(), { root: n, margin: s, amount: i = "some", once: r } = e, a = {
2130
+ root: n ? n.current : void 0,
2131
+ rootMargin: s,
2132
+ threshold: typeof i == "number" ? i : xr[i]
2133
+ }, o = (u) => {
2134
+ const { isIntersecting: l } = u;
2135
+ if (this.isInView === l || (this.isInView = l, r && !l && this.hasEnteredView))
2136
+ return;
2137
+ l && (this.hasEnteredView = !0), this.node.animationState && this.node.animationState.setActive("whileInView", l);
2138
+ const { onViewportEnter: c, onViewportLeave: f } = this.node.getProps(), h = l ? c : f;
2139
+ h && h(u);
2140
+ };
2141
+ return Sr(this.node.current, a, o);
2142
+ }
2143
+ mount() {
2144
+ this.startObserver();
2145
+ }
2146
+ update() {
2147
+ if (typeof IntersectionObserver > "u")
2148
+ return;
2149
+ const { props: e, prevProps: n } = this.node;
2150
+ ["amount", "margin", "root"].some(Cr(e, n)) && this.startObserver();
2151
+ }
2152
+ unmount() {
2153
+ }
2154
+ }
2155
+ function Cr({ viewport: t = {} }, { viewport: e = {} } = {}) {
2156
+ return (n) => t[n] !== e[n];
2157
+ }
2158
+ const Pr = {
2159
+ inView: {
2160
+ Feature: Mr
2161
+ },
2162
+ tap: {
2163
+ Feature: Tr
2164
+ },
2165
+ focus: {
2166
+ Feature: vr
2167
+ },
2168
+ hover: {
2169
+ Feature: br
2170
+ }
2171
+ }, Ne = { current: null }, xn = { current: !1 };
2172
+ function Fr() {
2173
+ if (xn.current = !0, !!kn)
2174
+ if (window.matchMedia) {
2175
+ const t = window.matchMedia("(prefers-reduced-motion)"), e = () => Ne.current = t.matches;
2176
+ t.addListener(e), e();
2177
+ } else
2178
+ Ne.current = !1;
2179
+ }
2180
+ const Dr = /* @__PURE__ */ new WeakMap();
2181
+ function Er(t, e, n) {
2182
+ for (const s in e) {
2183
+ const i = e[s], r = n[s];
2184
+ if (N(i))
2185
+ t.addValue(s, i);
2186
+ else if (N(r))
2187
+ t.addValue(s, ue(i, { owner: t }));
2188
+ else if (r !== i)
2189
+ if (t.hasValue(s)) {
2190
+ const a = t.getValue(s);
2191
+ a.liveStyle === !0 ? a.jump(i) : a.hasAnimated || a.set(i);
2192
+ } else {
2193
+ const a = t.getStaticValue(s);
2194
+ t.addValue(s, ue(a !== void 0 ? a : i, { owner: t }));
2195
+ }
2196
+ }
2197
+ for (const s in n)
2198
+ e[s] === void 0 && t.removeValue(s);
2199
+ return e;
2200
+ }
2201
+ const At = [
2202
+ "AnimationStart",
2203
+ "AnimationComplete",
2204
+ "Update",
2205
+ "BeforeLayoutMeasure",
2206
+ "LayoutMeasure",
2207
+ "LayoutAnimationStart",
2208
+ "LayoutAnimationComplete"
2209
+ ];
2210
+ class Or {
2211
+ /**
2212
+ * This method takes React props and returns found MotionValues. For example, HTML
2213
+ * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
2214
+ *
2215
+ * This isn't an abstract method as it needs calling in the constructor, but it is
2216
+ * intended to be one.
2217
+ */
2218
+ scrapeMotionValuesFromProps(e, n, s) {
2219
+ return {};
2220
+ }
2221
+ constructor({ parent: e, props: n, presenceContext: s, reducedMotionConfig: i, blockInitialAnimation: r, visualState: a }, o = {}) {
2222
+ this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = He, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => {
2223
+ this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection));
2224
+ }, this.renderScheduledAt = 0, this.scheduleRender = () => {
2225
+ const h = D.now();
2226
+ this.renderScheduledAt < h && (this.renderScheduledAt = h, E.render(this.render, !1, !0));
2227
+ };
2228
+ const { latestValues: u, renderState: l } = a;
2229
+ this.latestValues = u, this.baseTarget = { ...u }, this.initialValues = n.initial ? { ...u } : {}, this.renderState = l, this.parent = e, this.props = n, this.presenceContext = s, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = i, this.options = o, this.blockInitialAnimation = !!r, this.isControllingVariants = Kn(n), this.isVariantNode = Bn(n), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current);
2230
+ const { willChange: c, ...f } = this.scrapeMotionValuesFromProps(n, {}, this);
2231
+ for (const h in f) {
2232
+ const d = f[h];
2233
+ u[h] !== void 0 && N(d) && d.set(u[h], !1);
2234
+ }
2235
+ }
2236
+ mount(e) {
2237
+ this.current = e, Dr.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)), xn.current || Fr(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : Ne.current, process.env.NODE_ENV !== "production" && Mt(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);
2238
+ }
2239
+ unmount() {
2240
+ this.projection && this.projection.unmount(), Te(this.notifyUpdate), Te(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent && this.parent.children.delete(this);
2241
+ for (const e in this.events)
2242
+ this.events[e].clear();
2243
+ for (const e in this.features) {
2244
+ const n = this.features[e];
2245
+ n && (n.unmount(), n.isMounted = !1);
2246
+ }
2247
+ this.current = null;
2248
+ }
2249
+ bindToMotionValue(e, n) {
2250
+ this.valueSubscriptions.has(e) && this.valueSubscriptions.get(e)();
2251
+ const s = le.has(e);
2252
+ s && this.onBindTransform && this.onBindTransform();
2253
+ const i = n.on("change", (o) => {
2254
+ this.latestValues[e] = o, this.props.onUpdate && E.preRender(this.notifyUpdate), s && this.projection && (this.projection.isTransformDirty = !0);
2255
+ }), r = n.on("renderRequest", this.scheduleRender);
2256
+ let a;
2257
+ window.MotionCheckAppearSync && (a = window.MotionCheckAppearSync(this, e, n)), this.valueSubscriptions.set(e, () => {
2258
+ i(), r(), a && a(), n.owner && n.stop();
2259
+ });
2260
+ }
2261
+ sortNodePosition(e) {
2262
+ return !this.current || !this.sortInstanceNodePosition || this.type !== e.type ? 0 : this.sortInstanceNodePosition(this.current, e.current);
2263
+ }
2264
+ updateFeatures() {
2265
+ let e = "animation";
2266
+ for (e in Xe) {
2267
+ const n = Xe[e];
2268
+ if (!n)
2269
+ continue;
2270
+ const { isEnabled: s, Feature: i } = n;
2271
+ if (!this.features[e] && i && s(this.props) && (this.features[e] = new i(this)), this.features[e]) {
2272
+ const r = this.features[e];
2273
+ r.isMounted ? r.update() : (r.mount(), r.isMounted = !0);
2274
+ }
2275
+ }
2276
+ }
2277
+ triggerBuild() {
2278
+ this.build(this.renderState, this.latestValues, this.props);
2279
+ }
2280
+ /**
2281
+ * Measure the current viewport box with or without transforms.
2282
+ * Only measures axis-aligned boxes, rotate and skew must be manually
2283
+ * removed with a re-render to work.
2284
+ */
2285
+ measureViewportBox() {
2286
+ return this.current ? this.measureInstanceViewportBox(this.current, this.props) : Sn();
2287
+ }
2288
+ getStaticValue(e) {
2289
+ return this.latestValues[e];
2290
+ }
2291
+ setStaticValue(e, n) {
2292
+ this.latestValues[e] = n;
2293
+ }
2294
+ /**
2295
+ * Update the provided props. Ensure any newly-added motion values are
2296
+ * added to our map, old ones removed, and listeners updated.
2297
+ */
2298
+ update(e, n) {
2299
+ (e.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = e, this.prevPresenceContext = this.presenceContext, this.presenceContext = n;
2300
+ for (let s = 0; s < At.length; s++) {
2301
+ const i = At[s];
2302
+ this.propEventSubscriptions[i] && (this.propEventSubscriptions[i](), delete this.propEventSubscriptions[i]);
2303
+ const r = "on" + i, a = e[r];
2304
+ a && (this.propEventSubscriptions[i] = this.on(i, a));
2305
+ }
2306
+ this.prevMotionValues = Er(this, this.scrapeMotionValuesFromProps(e, this.prevProps, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue();
2307
+ }
2308
+ getProps() {
2309
+ return this.props;
2310
+ }
2311
+ /**
2312
+ * Returns the variant definition with a given name.
2313
+ */
2314
+ getVariant(e) {
2315
+ return this.props.variants ? this.props.variants[e] : void 0;
2316
+ }
2317
+ /**
2318
+ * Returns the defined default transition on this component.
2319
+ */
2320
+ getDefaultTransition() {
2321
+ return this.props.transition;
2322
+ }
2323
+ getTransformPagePoint() {
2324
+ return this.props.transformPagePoint;
2325
+ }
2326
+ getClosestVariantNode() {
2327
+ return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0;
2328
+ }
2329
+ /**
2330
+ * Add a child visual element to our set of children.
2331
+ */
2332
+ addVariantChild(e) {
2333
+ const n = this.getClosestVariantNode();
2334
+ if (n)
2335
+ return n.variantChildren && n.variantChildren.add(e), () => n.variantChildren.delete(e);
2336
+ }
2337
+ /**
2338
+ * Add a motion value and bind it to this visual element.
2339
+ */
2340
+ addValue(e, n) {
2341
+ const s = this.values.get(e);
2342
+ n !== s && (s && this.removeValue(e), this.bindToMotionValue(e, n), this.values.set(e, n), this.latestValues[e] = n.get());
2343
+ }
2344
+ /**
2345
+ * Remove a motion value and unbind any active subscriptions.
2346
+ */
2347
+ removeValue(e) {
2348
+ this.values.delete(e);
2349
+ const n = this.valueSubscriptions.get(e);
2350
+ n && (n(), this.valueSubscriptions.delete(e)), delete this.latestValues[e], this.removeValueFromRenderState(e, this.renderState);
2351
+ }
2352
+ /**
2353
+ * Check whether we have a motion value for this key
2354
+ */
2355
+ hasValue(e) {
2356
+ return this.values.has(e);
2357
+ }
2358
+ getValue(e, n) {
2359
+ if (this.props.values && this.props.values[e])
2360
+ return this.props.values[e];
2361
+ let s = this.values.get(e);
2362
+ return s === void 0 && n !== void 0 && (s = ue(n === null ? void 0 : n, { owner: this }), this.addValue(e, s)), s;
2363
+ }
2364
+ /**
2365
+ * If we're trying to animate to a previously unencountered value,
2366
+ * we need to check for it in our state and as a last resort read it
2367
+ * directly from the instance (which might have performance implications).
2368
+ */
2369
+ readValue(e, n) {
2370
+ let s = this.latestValues[e] !== void 0 || !this.current ? this.latestValues[e] : this.getBaseTargetFromProps(this.props, e) ?? this.readValueFromInstance(this.current, e, this.options);
2371
+ return s != null && (typeof s == "string" && (It(s) || Rt(s)) ? s = parseFloat(s) : !Li(s) && z.test(n) && (s = yn(e, n)), this.setBaseTarget(e, N(s) ? s.get() : s)), N(s) ? s.get() : s;
2372
+ }
2373
+ /**
2374
+ * Set the base target to later animate back to. This is currently
2375
+ * only hydrated on creation and when we first read a value.
2376
+ */
2377
+ setBaseTarget(e, n) {
2378
+ this.baseTarget[e] = n;
2379
+ }
2380
+ /**
2381
+ * Find the base target for a value thats been removed from all animation
2382
+ * props.
2383
+ */
2384
+ getBaseTarget(e) {
2385
+ var r;
2386
+ const { initial: n } = this.props;
2387
+ let s;
2388
+ if (typeof n == "string" || typeof n == "object") {
2389
+ const a = Ct(this.props, n, (r = this.presenceContext) == null ? void 0 : r.custom);
2390
+ a && (s = a[e]);
2391
+ }
2392
+ if (n && s !== void 0)
2393
+ return s;
2394
+ const i = this.getBaseTargetFromProps(this.props, e);
2395
+ return i !== void 0 && !N(i) ? i : this.initialValues[e] !== void 0 && s === void 0 ? void 0 : this.baseTarget[e];
2396
+ }
2397
+ on(e, n) {
2398
+ return this.events[e] || (this.events[e] = new kt()), this.events[e].add(n);
2399
+ }
2400
+ notify(e, ...n) {
2401
+ this.events[e] && this.events[e].notify(...n);
2402
+ }
2403
+ }
2404
+ class Mn extends Or {
2405
+ constructor() {
2406
+ super(...arguments), this.KeyframeResolver = Mi;
2407
+ }
2408
+ sortInstanceNodePosition(e, n) {
2409
+ return e.compareDocumentPosition(n) & 2 ? 1 : -1;
2410
+ }
2411
+ getBaseTargetFromProps(e, n) {
2412
+ return e.style ? e.style[n] : void 0;
2413
+ }
2414
+ removeValueFromRenderState(e, { vars: n, style: s }) {
2415
+ delete n[e], delete s[e];
2416
+ }
2417
+ handleChildMotionValue() {
2418
+ this.childSubscription && (this.childSubscription(), delete this.childSubscription);
2419
+ const { children: e } = this.props;
2420
+ N(e) && (this.childSubscription = e.on("change", (n) => {
2421
+ this.current && (this.current.textContent = `${n}`);
2422
+ }));
2423
+ }
2424
+ }
2425
+ function Cn(t, { style: e, vars: n }, s, i) {
2426
+ Object.assign(t.style, e, i && i.getProjectionStyles(s));
2427
+ for (const r in n)
2428
+ t.style.setProperty(r, n[r]);
2429
+ }
2430
+ function Ir(t) {
2431
+ return window.getComputedStyle(t);
2432
+ }
2433
+ class Rr extends Mn {
2434
+ constructor() {
2435
+ super(...arguments), this.type = "html", this.renderInstance = Cn;
2436
+ }
2437
+ readValueFromInstance(e, n) {
2438
+ if (le.has(n))
2439
+ return Ws(e, n);
2440
+ {
2441
+ const s = Ir(e), i = (Ln(n) ? s.getPropertyValue(n) : s[n]) || 0;
2442
+ return typeof i == "string" ? i.trim() : i;
2443
+ }
2444
+ }
2445
+ measureInstanceViewportBox(e, { transformPagePoint: n }) {
2446
+ return yr(e, n);
2447
+ }
2448
+ build(e, n, s) {
2449
+ _n(e, n, s.transformTemplate);
2450
+ }
2451
+ scrapeMotionValuesFromProps(e, n, s) {
2452
+ return $n(e, n, s);
2453
+ }
2454
+ }
2455
+ const Pn = /* @__PURE__ */ new Set([
2456
+ "baseFrequency",
2457
+ "diffuseConstant",
2458
+ "kernelMatrix",
2459
+ "kernelUnitLength",
2460
+ "keySplines",
2461
+ "keyTimes",
2462
+ "limitingConeAngle",
2463
+ "markerHeight",
2464
+ "markerWidth",
2465
+ "numOctaves",
2466
+ "targetX",
2467
+ "targetY",
2468
+ "surfaceScale",
2469
+ "specularConstant",
2470
+ "specularExponent",
2471
+ "stdDeviation",
2472
+ "tableValues",
2473
+ "viewBox",
2474
+ "gradientTransform",
2475
+ "pathLength",
2476
+ "startOffset",
2477
+ "textLength",
2478
+ "lengthAdjust"
2479
+ ]);
2480
+ function Nr(t, e, n, s) {
2481
+ Cn(t, e, void 0, s);
2482
+ for (const i in e.attrs)
2483
+ t.setAttribute(Pn.has(i) ? i : Ot(i), e.attrs[i]);
2484
+ }
2485
+ class kr extends Mn {
2486
+ constructor() {
2487
+ super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = Sn;
2488
+ }
2489
+ getBaseTargetFromProps(e, n) {
2490
+ return e[n];
2491
+ }
2492
+ readValueFromInstance(e, n) {
2493
+ if (le.has(n)) {
2494
+ const s = gn(n);
2495
+ return s && s.default || 0;
2496
+ }
2497
+ return n = Pn.has(n) ? n : Ot(n), e.getAttribute(n);
2498
+ }
2499
+ scrapeMotionValuesFromProps(e, n, s) {
2500
+ return Gn(e, n, s);
2501
+ }
2502
+ build(e, n, s) {
2503
+ Un(e, n, this.isSVGTag, s.transformTemplate, s.style);
2504
+ }
2505
+ renderInstance(e, n, s, i) {
2506
+ Nr(e, n, s, i);
2507
+ }
2508
+ mount(e) {
2509
+ this.isSVGTag = jn(e.tagName), super.mount(e);
2510
+ }
2511
+ }
2512
+ const Kr = (t, e) => Wn(t) ? new kr(e) : new Rr(e, {
2513
+ allowProjection: t !== qn
2514
+ }), Br = {
2515
+ renderer: Kr,
2516
+ ...pr,
2517
+ ...Pr
2518
+ };
2519
+ var Ur = Br;
2520
+ export {
2521
+ Ur as default
2522
+ };