@vezham/start 0.0.1-poc-test

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