@tomo-inc/wallet-connect-kit 0.0.6 → 0.0.8

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