@telegraph/tag 0.0.89 → 0.0.91

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