@vezham/start 0.2.0

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