fansunited-widgets-cdn 0.0.85 → 0.0.86-RC2

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.
Files changed (75) hide show
  1. package/chunks/Alert-CuOsmojH.js +149 -0
  2. package/chunks/AspectRatio-D3Sgxj7p.js +125 -0
  3. package/chunks/Avatar-BTsEKfhc.js +186 -0
  4. package/chunks/Button-BV7YIFkS.js +858 -0
  5. package/chunks/Card-DRIT0wtY.js +129 -0
  6. package/chunks/CardContent-CD-WZh1l.js +60 -0
  7. package/chunks/ChevronRight-BrCKlr3T.js +11 -0
  8. package/chunks/Chip-6HLNTHMI.js +281 -0
  9. package/chunks/ClassicQuizWrapper-t04e9_6c.js +4883 -0
  10. package/chunks/CollectLeadForm-DtmR2Vuf-B_3JkHJC.js +1560 -0
  11. package/chunks/CollectLeadWrapper-CVAVswua.js +1294 -0
  12. package/chunks/DialogActions-C5kAgHal.js +45 -0
  13. package/chunks/DialogContent-MIXff4nd.js +60 -0
  14. package/chunks/EitherOrById-CAo8gPjm.js +1496 -0
  15. package/chunks/EitherOrPreviewWrapper-DFi2bviS.js +47 -0
  16. package/chunks/Error-DhQL89pn-BwTV1meb.js +418 -0
  17. package/chunks/EventGameWrapper-BxyLL3eA.js +7633 -0
  18. package/chunks/Grid-Dpv_ZL23.js +279 -0
  19. package/chunks/IconButton-Lt9Xks7c.js +207 -0
  20. package/chunks/Link-DLuj1USf.js +228 -0
  21. package/chunks/List-DLPlZGTP.js +397 -0
  22. package/chunks/ListItemDecorator-CE2eQLip.js +1882 -0
  23. package/chunks/MatchPredictionContainer-Ct6gXvLw.js +751 -0
  24. package/chunks/MatchQuizWrapper-Fu6RfWVn.js +11046 -0
  25. package/chunks/ModalDialog-Ci3hulZA.js +619 -0
  26. package/chunks/NotFoundSkeleton-BYJTzYJR-Be3R34nS.js +2764 -0
  27. package/chunks/OverlayLeadAfterCollection-DnqztPJ5-CpELr0AC.js +896 -0
  28. package/chunks/OverlayScoreStateSkeleton-C9FUhcnd-DMFELrvA.js +146 -0
  29. package/chunks/PersonalityQuizWrapper-MpUK4n3Y.js +34374 -0
  30. package/chunks/PlayerOfTheMatch-D4vuR7pz.js +1406 -0
  31. package/chunks/PollWrapper-CzKj8xxE.js +4198 -0
  32. package/chunks/Portal-BWqqFvVm-TuHZWjxn.js +12717 -0
  33. package/chunks/Portal-DA1mxzSo.js +41 -0
  34. package/chunks/PreviewQuizById-WWS_LyJR.js +4864 -0
  35. package/chunks/Select-p_cHpLhi.js +3418 -0
  36. package/chunks/Sheet-BaCzogZK.js +167 -0
  37. package/chunks/Snackbar-DHxnbCA3.js +358 -0
  38. package/chunks/Stack-Dgf2LXN0.js +117 -0
  39. package/chunks/Tabs-CSu_cWNi.js +784 -0
  40. package/chunks/TeamNextMatchPrediction-C7HilNqW.js +6 -0
  41. package/chunks/Tutorial-DFNZxmAx.js +427 -0
  42. package/chunks/createLucideIcon-B6NxpYkb.js +79 -0
  43. package/chunks/createSvgIcon-7h7XC877.js +119 -0
  44. package/chunks/createSvgIcon-DVA0KIUd.js +2490 -0
  45. package/chunks/dataAttributeParser-CF9vxaVN.js +28 -0
  46. package/chunks/default-quiz-bg-CTzaADn7.js +4 -0
  47. package/chunks/getReactElementRef-BD-S8A24.js +25 -0
  48. package/chunks/index-24AwmTVJ.js +85 -0
  49. package/chunks/index-3vJS8JzK.js +63 -0
  50. package/chunks/index-BSD7mvEU.js +57 -0
  51. package/chunks/index-BU6iona7.js +57 -0
  52. package/chunks/index-BqCHiyI6.js +59 -0
  53. package/chunks/index-C5qRf4TV.js +20 -0
  54. package/chunks/index-C9MpfjqV.js +35 -0
  55. package/chunks/index-CMmQs5A5.js +56 -0
  56. package/chunks/index-CicEY2Jv.js +5 -0
  57. package/chunks/index-DNeawo0R.js +17 -0
  58. package/chunks/index-DePIySlY.js +29 -0
  59. package/chunks/index-DoRYU_1L.js +41 -0
  60. package/chunks/index-DvgG9XJj.js +20 -0
  61. package/chunks/index-QpZE-92Y.js +33 -0
  62. package/chunks/index-rgFj976B.js +17 -0
  63. package/chunks/index-tzsdMoo-.js +16 -0
  64. package/chunks/index.es-CHqz6mjo.js +6162 -0
  65. package/chunks/init-BEkECL0v.js +32 -0
  66. package/chunks/main-XP7dqk6g.js +39843 -0
  67. package/chunks/resolveProps-BfYZubfk.js +37 -0
  68. package/chunks/users-D_xgC4iQ.js +16 -0
  69. package/chunks/variantColorInheritance-DI3wUohX.js +28 -0
  70. package/fu-widgets-loader.es.js +73 -0
  71. package/fu-widgets-loader.js +1 -0
  72. package/fu-widgets.es.js +4 -0
  73. package/fu-widgets.iife.js +621 -682
  74. package/manifest.json +84 -0
  75. package/package.json +9 -2
@@ -0,0 +1,4864 @@
1
+ import { r as P, j as A, u as oo, B as Nt, a as ro, b as ao } from "./main-XP7dqk6g.js";
2
+ import { u as lo } from "./index-24AwmTVJ.js";
3
+ import { d as uo } from "./default-quiz-bg-CTzaADn7.js";
4
+ import { S as Bt } from "./Stack-Dgf2LXN0.js";
5
+ import { A as co } from "./AspectRatio-D3Sgxj7p.js";
6
+ import { C as ho } from "./Chip-6HLNTHMI.js";
7
+ import { T as vt, B as fo } from "./Button-BV7YIFkS.js";
8
+ import { c as Le } from "./createLucideIcon-B6NxpYkb.js";
9
+ import { U as mo } from "./users-D_xgC4iQ.js";
10
+ import { C as po } from "./Card-DRIT0wtY.js";
11
+ const Ms = P.createContext({});
12
+ function go(t) {
13
+ const e = P.useRef(null);
14
+ return e.current === null && (e.current = t()), e.current;
15
+ }
16
+ const Fe = P.createContext(null), Rs = P.createContext({
17
+ transformPagePoint: (t) => t,
18
+ isStatic: !1,
19
+ reducedMotion: "never"
20
+ });
21
+ function yo(t = !0) {
22
+ const e = P.useContext(Fe);
23
+ if (e === null)
24
+ return [!0, null];
25
+ const { isPresent: n, onExitComplete: s, register: i } = e, r = P.useId();
26
+ P.useEffect(() => {
27
+ t && i(r);
28
+ }, [t]);
29
+ const o = P.useCallback(() => t && s && s(r), [r, s, t]);
30
+ return !n && s ? [!1, o] : [!0];
31
+ }
32
+ const je = typeof window < "u", vo = je ? P.useLayoutEffect : P.useEffect, I = /* @__NO_SIDE_EFFECTS__ */ (t) => t;
33
+ let Es = I;
34
+ // @__NO_SIDE_EFFECTS__
35
+ function Be(t) {
36
+ let e;
37
+ return () => (e === void 0 && (e = t()), e);
38
+ }
39
+ const ft = /* @__NO_SIDE_EFFECTS__ */ (t, e, n) => {
40
+ const s = e - t;
41
+ return s === 0 ? 1 : (n - t) / s;
42
+ }, G = /* @__NO_SIDE_EFFECTS__ */ (t) => t * 1e3, H = /* @__NO_SIDE_EFFECTS__ */ (t) => t / 1e3, xo = {
43
+ useManualTiming: !1
44
+ };
45
+ function To(t) {
46
+ let e = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), s = !1, i = !1;
47
+ const r = /* @__PURE__ */ new WeakSet();
48
+ let o = {
49
+ delta: 0,
50
+ timestamp: 0,
51
+ isProcessing: !1
52
+ };
53
+ function a(u) {
54
+ r.has(u) && (l.schedule(u), t()), u(o);
55
+ }
56
+ const l = {
57
+ /**
58
+ * Schedule a process to run on the next frame.
59
+ */
60
+ schedule: (u, c = !1, h = !1) => {
61
+ const d = h && s ? e : n;
62
+ return c && r.add(u), d.has(u) || d.add(u), u;
63
+ },
64
+ /**
65
+ * Cancel the provided callback from running on the next frame.
66
+ */
67
+ cancel: (u) => {
68
+ n.delete(u), r.delete(u);
69
+ },
70
+ /**
71
+ * Execute all schedule callbacks.
72
+ */
73
+ process: (u) => {
74
+ if (o = u, s) {
75
+ i = !0;
76
+ return;
77
+ }
78
+ s = !0, [e, n] = [n, e], e.forEach(a), e.clear(), s = !1, i && (i = !1, l.process(u));
79
+ }
80
+ };
81
+ return l;
82
+ }
83
+ const kt = [
84
+ "read",
85
+ // Read
86
+ "resolveKeyframes",
87
+ // Write/Read/Write/Read
88
+ "update",
89
+ // Compute
90
+ "preRender",
91
+ // Compute
92
+ "render",
93
+ // Write
94
+ "postRender"
95
+ // Compute
96
+ ], Po = 40;
97
+ function Ls(t, e) {
98
+ let n = !1, s = !0;
99
+ const i = {
100
+ delta: 0,
101
+ timestamp: 0,
102
+ isProcessing: !1
103
+ }, r = () => n = !0, o = kt.reduce((g, v) => (g[v] = To(r), g), {}), { read: a, resolveKeyframes: l, update: u, preRender: c, render: h, postRender: f } = o, d = () => {
104
+ const g = performance.now();
105
+ n = !1, i.delta = s ? 1e3 / 60 : Math.max(Math.min(g - i.timestamp, Po), 1), i.timestamp = g, i.isProcessing = !0, a.process(i), l.process(i), u.process(i), c.process(i), h.process(i), f.process(i), i.isProcessing = !1, n && e && (s = !1, t(d));
106
+ }, m = () => {
107
+ n = !0, s = !0, i.isProcessing || t(d);
108
+ };
109
+ return { schedule: kt.reduce((g, v) => {
110
+ const T = o[v];
111
+ return g[v] = (w, S = !1, V = !1) => (n || m(), T.schedule(w, S, V)), g;
112
+ }, {}), cancel: (g) => {
113
+ for (let v = 0; v < kt.length; v++)
114
+ o[kt[v]].cancel(g);
115
+ }, state: i, steps: o };
116
+ }
117
+ const { schedule: C, cancel: Y, state: L, steps: se } = Ls(typeof requestAnimationFrame < "u" ? requestAnimationFrame : I, !0), Fs = P.createContext({ strict: !1 }), mn = {
118
+ animation: [
119
+ "animate",
120
+ "variants",
121
+ "whileHover",
122
+ "whileTap",
123
+ "exit",
124
+ "whileInView",
125
+ "whileFocus",
126
+ "whileDrag"
127
+ ],
128
+ exit: ["exit"],
129
+ drag: ["drag", "dragControls"],
130
+ focus: ["whileFocus"],
131
+ hover: ["whileHover", "onHoverStart", "onHoverEnd"],
132
+ tap: ["whileTap", "onTap", "onTapStart", "onTapCancel"],
133
+ pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"],
134
+ inView: ["whileInView", "onViewportEnter", "onViewportLeave"],
135
+ layout: ["layout", "layoutId"]
136
+ }, dt = {};
137
+ for (const t in mn)
138
+ dt[t] = {
139
+ isEnabled: (e) => mn[t].some((n) => !!e[n])
140
+ };
141
+ function So(t) {
142
+ for (const e in t)
143
+ dt[e] = {
144
+ ...dt[e],
145
+ ...t[e]
146
+ };
147
+ }
148
+ const bo = /* @__PURE__ */ new Set([
149
+ "animate",
150
+ "exit",
151
+ "variants",
152
+ "initial",
153
+ "style",
154
+ "values",
155
+ "variants",
156
+ "transition",
157
+ "transformTemplate",
158
+ "custom",
159
+ "inherit",
160
+ "onBeforeLayoutMeasure",
161
+ "onAnimationStart",
162
+ "onAnimationComplete",
163
+ "onUpdate",
164
+ "onDragStart",
165
+ "onDrag",
166
+ "onDragEnd",
167
+ "onMeasureDragConstraints",
168
+ "onDirectionLock",
169
+ "onDragTransitionEnd",
170
+ "_dragX",
171
+ "_dragY",
172
+ "onHoverStart",
173
+ "onHoverEnd",
174
+ "onViewportEnter",
175
+ "onViewportLeave",
176
+ "globalTapTarget",
177
+ "ignoreStrict",
178
+ "viewport"
179
+ ]);
180
+ function zt(t) {
181
+ return t.startsWith("while") || t.startsWith("drag") && t !== "draggable" || t.startsWith("layout") || t.startsWith("onTap") || t.startsWith("onPan") || t.startsWith("onLayout") || bo.has(t);
182
+ }
183
+ let js = (t) => !zt(t);
184
+ function Ao(t) {
185
+ t && (js = (e) => e.startsWith("on") ? !zt(e) : t(e));
186
+ }
187
+ try {
188
+ Ao(require("@emotion/is-prop-valid").default);
189
+ } catch {
190
+ }
191
+ function wo(t, e, n) {
192
+ const s = {};
193
+ for (const i in t)
194
+ i === "values" && typeof t.values == "object" || (js(i) || n === !0 && zt(i) || !e && !zt(i) || // If trying to use native HTML drag events, forward drag listeners
195
+ t.draggable && i.startsWith("onDrag")) && (s[i] = t[i]);
196
+ return s;
197
+ }
198
+ function Vo(t) {
199
+ if (typeof Proxy > "u")
200
+ return t;
201
+ const e = /* @__PURE__ */ new Map(), n = (...s) => t(...s);
202
+ return new Proxy(n, {
203
+ /**
204
+ * Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc.
205
+ * The prop name is passed through as `key` and we can use that to generate a `motion`
206
+ * DOM component with that name.
207
+ */
208
+ get: (s, i) => i === "create" ? t : (e.has(i) || e.set(i, t(i)), e.get(i))
209
+ });
210
+ }
211
+ const Yt = P.createContext({});
212
+ function Vt(t) {
213
+ return typeof t == "string" || Array.isArray(t);
214
+ }
215
+ function Zt(t) {
216
+ return t !== null && typeof t == "object" && typeof t.start == "function";
217
+ }
218
+ const ke = [
219
+ "animate",
220
+ "whileInView",
221
+ "whileFocus",
222
+ "whileHover",
223
+ "whileTap",
224
+ "whileDrag",
225
+ "exit"
226
+ ], Ie = ["initial", ...ke];
227
+ function Qt(t) {
228
+ return Zt(t.animate) || Ie.some((e) => Vt(t[e]));
229
+ }
230
+ function Bs(t) {
231
+ return !!(Qt(t) || t.variants);
232
+ }
233
+ function Co(t, e) {
234
+ if (Qt(t)) {
235
+ const { initial: n, animate: s } = t;
236
+ return {
237
+ initial: n === !1 || Vt(n) ? n : void 0,
238
+ animate: Vt(s) ? s : void 0
239
+ };
240
+ }
241
+ return t.inherit !== !1 ? e : {};
242
+ }
243
+ function Do(t) {
244
+ const { initial: e, animate: n } = Co(t, P.useContext(Yt));
245
+ return P.useMemo(() => ({ initial: e, animate: n }), [pn(e), pn(n)]);
246
+ }
247
+ function pn(t) {
248
+ return Array.isArray(t) ? t.join(" ") : t;
249
+ }
250
+ const Mo = Symbol.for("motionComponentSymbol");
251
+ function at(t) {
252
+ return t && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "current");
253
+ }
254
+ function Ro(t, e, n) {
255
+ return P.useCallback(
256
+ (s) => {
257
+ s && t.onMount && t.onMount(s), e && (s ? e.mount(s) : e.unmount()), n && (typeof n == "function" ? n(s) : at(n) && (n.current = s));
258
+ },
259
+ /**
260
+ * Only pass a new ref callback to React if we've received a visual element
261
+ * factory. Otherwise we'll be mounting/remounting every time externalRef
262
+ * or other dependencies change.
263
+ */
264
+ [e]
265
+ );
266
+ }
267
+ const Oe = (t) => t.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase(), Eo = "framerAppearId", ks = "data-" + Oe(Eo), { schedule: Ne } = Ls(queueMicrotask, !1), Is = P.createContext({});
268
+ function Lo(t, e, n, s, i) {
269
+ var r, o;
270
+ const { visualElement: a } = P.useContext(Yt), l = P.useContext(Fs), u = P.useContext(Fe), c = P.useContext(Rs).reducedMotion, h = P.useRef(null);
271
+ s = s || l.renderer, !h.current && s && (h.current = s(t, {
272
+ visualState: e,
273
+ parent: a,
274
+ props: n,
275
+ presenceContext: u,
276
+ blockInitialAnimation: u ? u.initial === !1 : !1,
277
+ reducedMotionConfig: c
278
+ }));
279
+ const f = h.current, d = P.useContext(Is);
280
+ f && !f.projection && i && (f.type === "html" || f.type === "svg") && Fo(h.current, n, i, d);
281
+ const m = P.useRef(!1);
282
+ P.useInsertionEffect(() => {
283
+ f && m.current && f.update(n, u);
284
+ });
285
+ const p = n[ks], y = P.useRef(!!p && !(!((r = window.MotionHandoffIsComplete) === null || r === void 0) && r.call(window, p)) && ((o = window.MotionHasOptimisedAnimation) === null || o === void 0 ? void 0 : o.call(window, p)));
286
+ return vo(() => {
287
+ f && (m.current = !0, window.MotionIsMounted = !0, f.updateFeatures(), Ne.render(f.render), y.current && f.animationState && f.animationState.animateChanges());
288
+ }), P.useEffect(() => {
289
+ f && (!y.current && f.animationState && f.animationState.animateChanges(), y.current && (queueMicrotask(() => {
290
+ var g;
291
+ (g = window.MotionHandoffMarkAsComplete) === null || g === void 0 || g.call(window, p);
292
+ }), y.current = !1));
293
+ }), f;
294
+ }
295
+ function Fo(t, e, n, s) {
296
+ const { layoutId: i, layout: r, drag: o, dragConstraints: a, layoutScroll: l, layoutRoot: u } = e;
297
+ t.projection = new n(t.latestValues, e["data-framer-portal-id"] ? void 0 : Os(t.parent)), t.projection.setOptions({
298
+ layoutId: i,
299
+ layout: r,
300
+ alwaysMeasureLayout: !!o || a && at(a),
301
+ visualElement: t,
302
+ /**
303
+ * TODO: Update options in an effect. This could be tricky as it'll be too late
304
+ * to update by the time layout animations run.
305
+ * We also need to fix this safeToRemove by linking it up to the one returned by usePresence,
306
+ * ensuring it gets called if there's no potential layout animations.
307
+ *
308
+ */
309
+ animationType: typeof r == "string" ? r : "both",
310
+ initialPromotionConfig: s,
311
+ layoutScroll: l,
312
+ layoutRoot: u
313
+ });
314
+ }
315
+ function Os(t) {
316
+ if (t)
317
+ return t.options.allowProjection !== !1 ? t.projection : Os(t.parent);
318
+ }
319
+ function jo({ preloadedFeatures: t, createVisualElement: e, useRender: n, useVisualState: s, Component: i }) {
320
+ var r, o;
321
+ t && So(t);
322
+ function a(u, c) {
323
+ let h;
324
+ const f = {
325
+ ...P.useContext(Rs),
326
+ ...u,
327
+ layoutId: Bo(u)
328
+ }, { isStatic: d } = f, m = Do(u), p = s(u, d);
329
+ if (!d && je) {
330
+ ko();
331
+ const y = Io(f);
332
+ h = y.MeasureLayout, m.visualElement = Lo(i, p, f, e, y.ProjectionNode);
333
+ }
334
+ return A.jsxs(Yt.Provider, { value: m, children: [h && m.visualElement ? A.jsx(h, { visualElement: m.visualElement, ...f }) : null, n(i, u, Ro(p, m.visualElement, c), p, d, m.visualElement)] });
335
+ }
336
+ a.displayName = `motion.${typeof i == "string" ? i : `create(${(o = (r = i.displayName) !== null && r !== void 0 ? r : i.name) !== null && o !== void 0 ? o : ""})`}`;
337
+ const l = P.forwardRef(a);
338
+ return l[Mo] = i, l;
339
+ }
340
+ function Bo({ layoutId: t }) {
341
+ const e = P.useContext(Ms).id;
342
+ return e && t !== void 0 ? e + "-" + t : t;
343
+ }
344
+ function ko(t, e) {
345
+ P.useContext(Fs).strict;
346
+ }
347
+ function Io(t) {
348
+ const { drag: e, layout: n } = dt;
349
+ if (!e && !n)
350
+ return {};
351
+ const s = { ...e, ...n };
352
+ return {
353
+ MeasureLayout: e != null && e.isEnabled(t) || n != null && n.isEnabled(t) ? s.MeasureLayout : void 0,
354
+ ProjectionNode: s.ProjectionNode
355
+ };
356
+ }
357
+ const Oo = [
358
+ "animate",
359
+ "circle",
360
+ "defs",
361
+ "desc",
362
+ "ellipse",
363
+ "g",
364
+ "image",
365
+ "line",
366
+ "filter",
367
+ "marker",
368
+ "mask",
369
+ "metadata",
370
+ "path",
371
+ "pattern",
372
+ "polygon",
373
+ "polyline",
374
+ "rect",
375
+ "stop",
376
+ "switch",
377
+ "symbol",
378
+ "svg",
379
+ "text",
380
+ "tspan",
381
+ "use",
382
+ "view"
383
+ ];
384
+ function Ue(t) {
385
+ return (
386
+ /**
387
+ * If it's not a string, it's a custom React component. Currently we only support
388
+ * HTML custom React components.
389
+ */
390
+ typeof t != "string" || /**
391
+ * If it contains a dash, the element is a custom HTML webcomponent.
392
+ */
393
+ t.includes("-") ? !1 : (
394
+ /**
395
+ * If it's in our list of lowercase SVG tags, it's an SVG component
396
+ */
397
+ !!(Oo.indexOf(t) > -1 || /**
398
+ * If it contains a capital letter, it's an SVG component
399
+ */
400
+ /[A-Z]/u.test(t))
401
+ )
402
+ );
403
+ }
404
+ function gn(t) {
405
+ const e = [{}, {}];
406
+ return t == null || t.values.forEach((n, s) => {
407
+ e[0][s] = n.get(), e[1][s] = n.getVelocity();
408
+ }), e;
409
+ }
410
+ function _e(t, e, n, s) {
411
+ if (typeof e == "function") {
412
+ const [i, r] = gn(s);
413
+ e = e(n !== void 0 ? n : t.custom, i, r);
414
+ }
415
+ if (typeof e == "string" && (e = t.variants && t.variants[e]), typeof e == "function") {
416
+ const [i, r] = gn(s);
417
+ e = e(n !== void 0 ? n : t.custom, i, r);
418
+ }
419
+ return e;
420
+ }
421
+ const ge = (t) => Array.isArray(t), No = (t) => !!(t && typeof t == "object" && t.mix && t.toValue), Uo = (t) => ge(t) ? t[t.length - 1] || 0 : t, j = (t) => !!(t && t.getVelocity);
422
+ function Ut(t) {
423
+ const e = j(t) ? t.get() : t;
424
+ return No(e) ? e.toValue() : e;
425
+ }
426
+ function _o({ scrapeMotionValuesFromProps: t, createRenderState: e, onUpdate: n }, s, i, r) {
427
+ const o = {
428
+ latestValues: Ko(s, i, r, t),
429
+ renderState: e()
430
+ };
431
+ return n && (o.onMount = (a) => n({ props: s, current: a, ...o }), o.onUpdate = (a) => n(a)), o;
432
+ }
433
+ const Ns = (t) => (e, n) => {
434
+ const s = P.useContext(Yt), i = P.useContext(Fe), r = () => _o(t, e, s, i);
435
+ return n ? r() : go(r);
436
+ };
437
+ function Ko(t, e, n, s) {
438
+ const i = {}, r = s(t, {});
439
+ for (const f in r)
440
+ i[f] = Ut(r[f]);
441
+ let { initial: o, animate: a } = t;
442
+ const l = Qt(t), u = Bs(t);
443
+ e && u && !l && t.inherit !== !1 && (o === void 0 && (o = e.initial), a === void 0 && (a = e.animate));
444
+ let c = n ? n.initial === !1 : !1;
445
+ c = c || o === !1;
446
+ const h = c ? a : o;
447
+ if (h && typeof h != "boolean" && !Zt(h)) {
448
+ const f = Array.isArray(h) ? h : [h];
449
+ for (let d = 0; d < f.length; d++) {
450
+ const m = _e(t, f[d]);
451
+ if (m) {
452
+ const { transitionEnd: p, transition: y, ...g } = m;
453
+ for (const v in g) {
454
+ let T = g[v];
455
+ if (Array.isArray(T)) {
456
+ const w = c ? T.length - 1 : 0;
457
+ T = T[w];
458
+ }
459
+ T !== null && (i[v] = T);
460
+ }
461
+ for (const v in p)
462
+ i[v] = p[v];
463
+ }
464
+ }
465
+ }
466
+ return i;
467
+ }
468
+ const pt = [
469
+ "transformPerspective",
470
+ "x",
471
+ "y",
472
+ "z",
473
+ "translateX",
474
+ "translateY",
475
+ "translateZ",
476
+ "scale",
477
+ "scaleX",
478
+ "scaleY",
479
+ "rotate",
480
+ "rotateX",
481
+ "rotateY",
482
+ "rotateZ",
483
+ "skew",
484
+ "skewX",
485
+ "skewY"
486
+ ], it = new Set(pt), Us = (t) => (e) => typeof e == "string" && e.startsWith(t), _s = /* @__PURE__ */ Us("--"), zo = /* @__PURE__ */ Us("var(--"), Ke = (t) => zo(t) ? Wo.test(t.split("/*")[0].trim()) : !1, Wo = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu, Ks = (t, e) => e && typeof t == "number" ? e.transform(t) : t, X = (t, e, n) => n > e ? e : n < t ? t : n, gt = {
487
+ test: (t) => typeof t == "number",
488
+ parse: parseFloat,
489
+ transform: (t) => t
490
+ }, Ct = {
491
+ ...gt,
492
+ transform: (t) => X(0, 1, t)
493
+ }, It = {
494
+ ...gt,
495
+ default: 1
496
+ }, Et = (t) => ({
497
+ test: (e) => typeof e == "string" && e.endsWith(t) && e.split(" ").length === 1,
498
+ parse: parseFloat,
499
+ transform: (e) => `${e}${t}`
500
+ }), q = /* @__PURE__ */ Et("deg"), z = /* @__PURE__ */ Et("%"), x = /* @__PURE__ */ Et("px"), $o = /* @__PURE__ */ Et("vh"), Go = /* @__PURE__ */ Et("vw"), yn = {
501
+ ...z,
502
+ parse: (t) => z.parse(t) / 100,
503
+ transform: (t) => z.transform(t * 100)
504
+ }, Ho = {
505
+ // Border props
506
+ borderWidth: x,
507
+ borderTopWidth: x,
508
+ borderRightWidth: x,
509
+ borderBottomWidth: x,
510
+ borderLeftWidth: x,
511
+ borderRadius: x,
512
+ radius: x,
513
+ borderTopLeftRadius: x,
514
+ borderTopRightRadius: x,
515
+ borderBottomRightRadius: x,
516
+ borderBottomLeftRadius: x,
517
+ // Positioning props
518
+ width: x,
519
+ maxWidth: x,
520
+ height: x,
521
+ maxHeight: x,
522
+ top: x,
523
+ right: x,
524
+ bottom: x,
525
+ left: x,
526
+ // Spacing props
527
+ padding: x,
528
+ paddingTop: x,
529
+ paddingRight: x,
530
+ paddingBottom: x,
531
+ paddingLeft: x,
532
+ margin: x,
533
+ marginTop: x,
534
+ marginRight: x,
535
+ marginBottom: x,
536
+ marginLeft: x,
537
+ // Misc
538
+ backgroundPositionX: x,
539
+ backgroundPositionY: x
540
+ }, Xo = {
541
+ rotate: q,
542
+ rotateX: q,
543
+ rotateY: q,
544
+ rotateZ: q,
545
+ scale: It,
546
+ scaleX: It,
547
+ scaleY: It,
548
+ scaleZ: It,
549
+ skew: q,
550
+ skewX: q,
551
+ skewY: q,
552
+ distance: x,
553
+ translateX: x,
554
+ translateY: x,
555
+ translateZ: x,
556
+ x,
557
+ y: x,
558
+ z: x,
559
+ perspective: x,
560
+ transformPerspective: x,
561
+ opacity: Ct,
562
+ originX: yn,
563
+ originY: yn,
564
+ originZ: x
565
+ }, vn = {
566
+ ...gt,
567
+ transform: Math.round
568
+ }, ze = {
569
+ ...Ho,
570
+ ...Xo,
571
+ zIndex: vn,
572
+ size: x,
573
+ // SVG
574
+ fillOpacity: Ct,
575
+ strokeOpacity: Ct,
576
+ numOctaves: vn
577
+ }, qo = {
578
+ x: "translateX",
579
+ y: "translateY",
580
+ z: "translateZ",
581
+ transformPerspective: "perspective"
582
+ }, Yo = pt.length;
583
+ function Zo(t, e, n) {
584
+ let s = "", i = !0;
585
+ for (let r = 0; r < Yo; r++) {
586
+ const o = pt[r], a = t[o];
587
+ if (a === void 0)
588
+ continue;
589
+ let l = !0;
590
+ if (typeof a == "number" ? l = a === (o.startsWith("scale") ? 1 : 0) : l = parseFloat(a) === 0, !l || n) {
591
+ const u = Ks(a, ze[o]);
592
+ if (!l) {
593
+ i = !1;
594
+ const c = qo[o] || o;
595
+ s += `${c}(${u}) `;
596
+ }
597
+ n && (e[o] = u);
598
+ }
599
+ }
600
+ return s = s.trim(), n ? s = n(e, i ? "" : s) : i && (s = "none"), s;
601
+ }
602
+ function We(t, e, n) {
603
+ const { style: s, vars: i, transformOrigin: r } = t;
604
+ let o = !1, a = !1;
605
+ for (const l in e) {
606
+ const u = e[l];
607
+ if (it.has(l)) {
608
+ o = !0;
609
+ continue;
610
+ } else if (_s(l)) {
611
+ i[l] = u;
612
+ continue;
613
+ } else {
614
+ const c = Ks(u, ze[l]);
615
+ l.startsWith("origin") ? (a = !0, r[l] = c) : s[l] = c;
616
+ }
617
+ }
618
+ if (e.transform || (o || n ? s.transform = Zo(e, t.transform, n) : s.transform && (s.transform = "none")), a) {
619
+ const { originX: l = "50%", originY: u = "50%", originZ: c = 0 } = r;
620
+ s.transformOrigin = `${l} ${u} ${c}`;
621
+ }
622
+ }
623
+ const Qo = {
624
+ offset: "stroke-dashoffset",
625
+ array: "stroke-dasharray"
626
+ }, Jo = {
627
+ offset: "strokeDashoffset",
628
+ array: "strokeDasharray"
629
+ };
630
+ function tr(t, e, n = 1, s = 0, i = !0) {
631
+ t.pathLength = 1;
632
+ const r = i ? Qo : Jo;
633
+ t[r.offset] = x.transform(-s);
634
+ const o = x.transform(e), a = x.transform(n);
635
+ t[r.array] = `${o} ${a}`;
636
+ }
637
+ function xn(t, e, n) {
638
+ return typeof t == "string" ? t : x.transform(e + n * t);
639
+ }
640
+ function er(t, e, n) {
641
+ const s = xn(e, t.x, t.width), i = xn(n, t.y, t.height);
642
+ return `${s} ${i}`;
643
+ }
644
+ function $e(t, {
645
+ attrX: e,
646
+ attrY: n,
647
+ attrScale: s,
648
+ originX: i,
649
+ originY: r,
650
+ pathLength: o,
651
+ pathSpacing: a = 1,
652
+ pathOffset: l = 0,
653
+ // This is object creation, which we try to avoid per-frame.
654
+ ...u
655
+ }, c, h) {
656
+ if (We(t, u, h), c) {
657
+ t.style.viewBox && (t.attrs.viewBox = t.style.viewBox);
658
+ return;
659
+ }
660
+ t.attrs = t.style, t.style = {};
661
+ const { attrs: f, style: d, dimensions: m } = t;
662
+ f.transform && (m && (d.transform = f.transform), delete f.transform), m && (i !== void 0 || r !== void 0 || d.transform) && (d.transformOrigin = er(m, i !== void 0 ? i : 0.5, r !== void 0 ? r : 0.5)), e !== void 0 && (f.x = e), n !== void 0 && (f.y = n), s !== void 0 && (f.scale = s), o !== void 0 && tr(f, o, a, l, !1);
663
+ }
664
+ const Ge = () => ({
665
+ style: {},
666
+ transform: {},
667
+ transformOrigin: {},
668
+ vars: {}
669
+ }), zs = () => ({
670
+ ...Ge(),
671
+ attrs: {}
672
+ }), He = (t) => typeof t == "string" && t.toLowerCase() === "svg";
673
+ function Ws(t, { style: e, vars: n }, s, i) {
674
+ Object.assign(t.style, e, i && i.getProjectionStyles(s));
675
+ for (const r in n)
676
+ t.style.setProperty(r, n[r]);
677
+ }
678
+ const $s = /* @__PURE__ */ new Set([
679
+ "baseFrequency",
680
+ "diffuseConstant",
681
+ "kernelMatrix",
682
+ "kernelUnitLength",
683
+ "keySplines",
684
+ "keyTimes",
685
+ "limitingConeAngle",
686
+ "markerHeight",
687
+ "markerWidth",
688
+ "numOctaves",
689
+ "targetX",
690
+ "targetY",
691
+ "surfaceScale",
692
+ "specularConstant",
693
+ "specularExponent",
694
+ "stdDeviation",
695
+ "tableValues",
696
+ "viewBox",
697
+ "gradientTransform",
698
+ "pathLength",
699
+ "startOffset",
700
+ "textLength",
701
+ "lengthAdjust"
702
+ ]);
703
+ function Gs(t, e, n, s) {
704
+ Ws(t, e, void 0, s);
705
+ for (const i in e.attrs)
706
+ t.setAttribute($s.has(i) ? i : Oe(i), e.attrs[i]);
707
+ }
708
+ const Wt = {};
709
+ function nr(t) {
710
+ Object.assign(Wt, t);
711
+ }
712
+ function Hs(t, { layout: e, layoutId: n }) {
713
+ return it.has(t) || t.startsWith("origin") || (e || n !== void 0) && (!!Wt[t] || t === "opacity");
714
+ }
715
+ function Xe(t, e, n) {
716
+ var s;
717
+ const { style: i } = t, r = {};
718
+ for (const o in i)
719
+ (j(i[o]) || e.style && j(e.style[o]) || Hs(o, t) || ((s = n == null ? void 0 : n.getValue(o)) === null || s === void 0 ? void 0 : s.liveStyle) !== void 0) && (r[o] = i[o]);
720
+ return r;
721
+ }
722
+ function Xs(t, e, n) {
723
+ const s = Xe(t, e, n);
724
+ for (const i in t)
725
+ if (j(t[i]) || j(e[i])) {
726
+ const r = pt.indexOf(i) !== -1 ? "attr" + i.charAt(0).toUpperCase() + i.substring(1) : i;
727
+ s[r] = t[i];
728
+ }
729
+ return s;
730
+ }
731
+ function sr(t, e) {
732
+ try {
733
+ e.dimensions = typeof t.getBBox == "function" ? t.getBBox() : t.getBoundingClientRect();
734
+ } catch {
735
+ e.dimensions = {
736
+ x: 0,
737
+ y: 0,
738
+ width: 0,
739
+ height: 0
740
+ };
741
+ }
742
+ }
743
+ const Tn = ["x", "y", "width", "height", "cx", "cy", "r"], ir = {
744
+ useVisualState: Ns({
745
+ scrapeMotionValuesFromProps: Xs,
746
+ createRenderState: zs,
747
+ onUpdate: ({ props: t, prevProps: e, current: n, renderState: s, latestValues: i }) => {
748
+ if (!n)
749
+ return;
750
+ let r = !!t.drag;
751
+ if (!r) {
752
+ for (const a in i)
753
+ if (it.has(a)) {
754
+ r = !0;
755
+ break;
756
+ }
757
+ }
758
+ if (!r)
759
+ return;
760
+ let o = !e;
761
+ if (e)
762
+ for (let a = 0; a < Tn.length; a++) {
763
+ const l = Tn[a];
764
+ t[l] !== e[l] && (o = !0);
765
+ }
766
+ o && C.read(() => {
767
+ sr(n, s), C.render(() => {
768
+ $e(s, i, He(n.tagName), t.transformTemplate), Gs(n, s);
769
+ });
770
+ });
771
+ }
772
+ })
773
+ }, or = {
774
+ useVisualState: Ns({
775
+ scrapeMotionValuesFromProps: Xe,
776
+ createRenderState: Ge
777
+ })
778
+ };
779
+ function qs(t, e, n) {
780
+ for (const s in e)
781
+ !j(e[s]) && !Hs(s, n) && (t[s] = e[s]);
782
+ }
783
+ function rr({ transformTemplate: t }, e) {
784
+ return P.useMemo(() => {
785
+ const n = Ge();
786
+ return We(n, e, t), Object.assign({}, n.vars, n.style);
787
+ }, [e]);
788
+ }
789
+ function ar(t, e) {
790
+ const n = t.style || {}, s = {};
791
+ return qs(s, n, t), Object.assign(s, rr(t, e)), s;
792
+ }
793
+ function lr(t, e) {
794
+ const n = {}, s = ar(t, e);
795
+ return t.drag && t.dragListener !== !1 && (n.draggable = !1, s.userSelect = s.WebkitUserSelect = s.WebkitTouchCallout = "none", s.touchAction = t.drag === !0 ? "none" : `pan-${t.drag === "x" ? "y" : "x"}`), t.tabIndex === void 0 && (t.onTap || t.onTapStart || t.whileTap) && (n.tabIndex = 0), n.style = s, n;
796
+ }
797
+ function ur(t, e, n, s) {
798
+ const i = P.useMemo(() => {
799
+ const r = zs();
800
+ return $e(r, e, He(s), t.transformTemplate), {
801
+ ...r.attrs,
802
+ style: { ...r.style }
803
+ };
804
+ }, [e]);
805
+ if (t.style) {
806
+ const r = {};
807
+ qs(r, t.style, t), i.style = { ...r, ...i.style };
808
+ }
809
+ return i;
810
+ }
811
+ function cr(t = !1) {
812
+ return (n, s, i, { latestValues: r }, o) => {
813
+ const l = (Ue(n) ? ur : lr)(s, r, o, n), u = wo(s, typeof n == "string", t), c = n !== P.Fragment ? { ...u, ...l, ref: i } : {}, { children: h } = s, f = P.useMemo(() => j(h) ? h.get() : h, [h]);
814
+ return P.createElement(n, {
815
+ ...c,
816
+ children: f
817
+ });
818
+ };
819
+ }
820
+ function hr(t, e) {
821
+ return function(s, { forwardMotionProps: i } = { forwardMotionProps: !1 }) {
822
+ const o = {
823
+ ...Ue(s) ? ir : or,
824
+ preloadedFeatures: t,
825
+ useRender: cr(i),
826
+ createVisualElement: e,
827
+ Component: s
828
+ };
829
+ return jo(o);
830
+ };
831
+ }
832
+ function Ys(t, e) {
833
+ if (!Array.isArray(e))
834
+ return !1;
835
+ const n = e.length;
836
+ if (n !== t.length)
837
+ return !1;
838
+ for (let s = 0; s < n; s++)
839
+ if (e[s] !== t[s])
840
+ return !1;
841
+ return !0;
842
+ }
843
+ function Jt(t, e, n) {
844
+ const s = t.getProps();
845
+ return _e(s, e, n !== void 0 ? n : s.custom, t);
846
+ }
847
+ const fr = /* @__PURE__ */ Be(() => window.ScrollTimeline !== void 0);
848
+ class dr {
849
+ constructor(e) {
850
+ this.stop = () => this.runAll("stop"), this.animations = e.filter(Boolean);
851
+ }
852
+ get finished() {
853
+ return Promise.all(this.animations.map((e) => "finished" in e ? e.finished : e));
854
+ }
855
+ /**
856
+ * TODO: Filter out cancelled or stopped animations before returning
857
+ */
858
+ getAll(e) {
859
+ return this.animations[0][e];
860
+ }
861
+ setAll(e, n) {
862
+ for (let s = 0; s < this.animations.length; s++)
863
+ this.animations[s][e] = n;
864
+ }
865
+ attachTimeline(e, n) {
866
+ const s = this.animations.map((i) => {
867
+ if (fr() && i.attachTimeline)
868
+ return i.attachTimeline(e);
869
+ if (typeof n == "function")
870
+ return n(i);
871
+ });
872
+ return () => {
873
+ s.forEach((i, r) => {
874
+ i && i(), this.animations[r].stop();
875
+ });
876
+ };
877
+ }
878
+ get time() {
879
+ return this.getAll("time");
880
+ }
881
+ set time(e) {
882
+ this.setAll("time", e);
883
+ }
884
+ get speed() {
885
+ return this.getAll("speed");
886
+ }
887
+ set speed(e) {
888
+ this.setAll("speed", e);
889
+ }
890
+ get startTime() {
891
+ return this.getAll("startTime");
892
+ }
893
+ get duration() {
894
+ let e = 0;
895
+ for (let n = 0; n < this.animations.length; n++)
896
+ e = Math.max(e, this.animations[n].duration);
897
+ return e;
898
+ }
899
+ runAll(e) {
900
+ this.animations.forEach((n) => n[e]());
901
+ }
902
+ flatten() {
903
+ this.runAll("flatten");
904
+ }
905
+ play() {
906
+ this.runAll("play");
907
+ }
908
+ pause() {
909
+ this.runAll("pause");
910
+ }
911
+ cancel() {
912
+ this.runAll("cancel");
913
+ }
914
+ complete() {
915
+ this.runAll("complete");
916
+ }
917
+ }
918
+ class mr extends dr {
919
+ then(e, n) {
920
+ return Promise.all(this.animations).then(e).catch(n);
921
+ }
922
+ }
923
+ function qe(t, e) {
924
+ return t ? t[e] || t.default || t : void 0;
925
+ }
926
+ const ye = 2e4;
927
+ function Zs(t) {
928
+ let e = 0;
929
+ const n = 50;
930
+ let s = t.next(e);
931
+ for (; !s.done && e < ye; )
932
+ e += n, s = t.next(e);
933
+ return e >= ye ? 1 / 0 : e;
934
+ }
935
+ function Ye(t) {
936
+ return typeof t == "function";
937
+ }
938
+ function Pn(t, e) {
939
+ t.timeline = e, t.onfinish = null;
940
+ }
941
+ const Ze = (t) => Array.isArray(t) && typeof t[0] == "number", pr = {
942
+ linearEasing: void 0
943
+ };
944
+ function gr(t, e) {
945
+ const n = /* @__PURE__ */ Be(t);
946
+ return () => {
947
+ var s;
948
+ return (s = pr[e]) !== null && s !== void 0 ? s : n();
949
+ };
950
+ }
951
+ const $t = /* @__PURE__ */ gr(() => {
952
+ try {
953
+ document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
954
+ } catch {
955
+ return !1;
956
+ }
957
+ return !0;
958
+ }, "linearEasing"), Qs = (t, e, n = 10) => {
959
+ let s = "";
960
+ const i = Math.max(Math.round(e / n), 2);
961
+ for (let r = 0; r < i; r++)
962
+ s += t(/* @__PURE__ */ ft(0, i - 1, r)) + ", ";
963
+ return `linear(${s.substring(0, s.length - 2)})`;
964
+ };
965
+ function Js(t) {
966
+ return !!(typeof t == "function" && $t() || !t || typeof t == "string" && (t in ve || $t()) || Ze(t) || Array.isArray(t) && t.every(Js));
967
+ }
968
+ const xt = ([t, e, n, s]) => `cubic-bezier(${t}, ${e}, ${n}, ${s})`, ve = {
969
+ linear: "linear",
970
+ ease: "ease",
971
+ easeIn: "ease-in",
972
+ easeOut: "ease-out",
973
+ easeInOut: "ease-in-out",
974
+ circIn: /* @__PURE__ */ xt([0, 0.65, 0.55, 1]),
975
+ circOut: /* @__PURE__ */ xt([0.55, 0, 1, 0.45]),
976
+ backIn: /* @__PURE__ */ xt([0.31, 0.01, 0.66, -0.59]),
977
+ backOut: /* @__PURE__ */ xt([0.33, 1.53, 0.69, 0.99])
978
+ };
979
+ function ti(t, e) {
980
+ if (t)
981
+ return typeof t == "function" && $t() ? Qs(t, e) : Ze(t) ? xt(t) : Array.isArray(t) ? t.map((n) => ti(n, e) || ve.easeOut) : ve[t];
982
+ }
983
+ const K = {
984
+ x: !1,
985
+ y: !1
986
+ };
987
+ function ei() {
988
+ return K.x || K.y;
989
+ }
990
+ function yr(t, e, n) {
991
+ var s;
992
+ if (t instanceof Element)
993
+ return [t];
994
+ if (typeof t == "string") {
995
+ let i = document;
996
+ const r = (s = void 0) !== null && s !== void 0 ? s : i.querySelectorAll(t);
997
+ return r ? Array.from(r) : [];
998
+ }
999
+ return Array.from(t);
1000
+ }
1001
+ function ni(t, e) {
1002
+ const n = yr(t), s = new AbortController(), i = {
1003
+ passive: !0,
1004
+ ...e,
1005
+ signal: s.signal
1006
+ };
1007
+ return [n, i, () => s.abort()];
1008
+ }
1009
+ function Sn(t) {
1010
+ return (e) => {
1011
+ e.pointerType === "touch" || ei() || t(e);
1012
+ };
1013
+ }
1014
+ function vr(t, e, n = {}) {
1015
+ const [s, i, r] = ni(t, n), o = Sn((a) => {
1016
+ const { target: l } = a, u = e(a);
1017
+ if (typeof u != "function" || !l)
1018
+ return;
1019
+ const c = Sn((h) => {
1020
+ u(h), l.removeEventListener("pointerleave", c);
1021
+ });
1022
+ l.addEventListener("pointerleave", c, i);
1023
+ });
1024
+ return s.forEach((a) => {
1025
+ a.addEventListener("pointerenter", o, i);
1026
+ }), r;
1027
+ }
1028
+ const si = (t, e) => e ? t === e ? !0 : si(t, e.parentElement) : !1, Qe = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1, xr = /* @__PURE__ */ new Set([
1029
+ "BUTTON",
1030
+ "INPUT",
1031
+ "SELECT",
1032
+ "TEXTAREA",
1033
+ "A"
1034
+ ]);
1035
+ function Tr(t) {
1036
+ return xr.has(t.tagName) || t.tabIndex !== -1;
1037
+ }
1038
+ const Tt = /* @__PURE__ */ new WeakSet();
1039
+ function bn(t) {
1040
+ return (e) => {
1041
+ e.key === "Enter" && t(e);
1042
+ };
1043
+ }
1044
+ function ie(t, e) {
1045
+ t.dispatchEvent(new PointerEvent("pointer" + e, { isPrimary: !0, bubbles: !0 }));
1046
+ }
1047
+ const Pr = (t, e) => {
1048
+ const n = t.currentTarget;
1049
+ if (!n)
1050
+ return;
1051
+ const s = bn(() => {
1052
+ if (Tt.has(n))
1053
+ return;
1054
+ ie(n, "down");
1055
+ const i = bn(() => {
1056
+ ie(n, "up");
1057
+ }), r = () => ie(n, "cancel");
1058
+ n.addEventListener("keyup", i, e), n.addEventListener("blur", r, e);
1059
+ });
1060
+ n.addEventListener("keydown", s, e), n.addEventListener("blur", () => n.removeEventListener("keydown", s), e);
1061
+ };
1062
+ function An(t) {
1063
+ return Qe(t) && !ei();
1064
+ }
1065
+ function Sr(t, e, n = {}) {
1066
+ const [s, i, r] = ni(t, n), o = (a) => {
1067
+ const l = a.currentTarget;
1068
+ if (!An(a) || Tt.has(l))
1069
+ return;
1070
+ Tt.add(l);
1071
+ const u = e(a), c = (d, m) => {
1072
+ window.removeEventListener("pointerup", h), window.removeEventListener("pointercancel", f), !(!An(d) || !Tt.has(l)) && (Tt.delete(l), typeof u == "function" && u(d, { success: m }));
1073
+ }, h = (d) => {
1074
+ c(d, n.useGlobalTarget || si(l, d.target));
1075
+ }, f = (d) => {
1076
+ c(d, !1);
1077
+ };
1078
+ window.addEventListener("pointerup", h, i), window.addEventListener("pointercancel", f, i);
1079
+ };
1080
+ return s.forEach((a) => {
1081
+ !Tr(a) && a.getAttribute("tabindex") === null && (a.tabIndex = 0), (n.useGlobalTarget ? window : a).addEventListener("pointerdown", o, i), a.addEventListener("focus", (u) => Pr(u, i), i);
1082
+ }), r;
1083
+ }
1084
+ function br(t) {
1085
+ return t === "x" || t === "y" ? K[t] ? null : (K[t] = !0, () => {
1086
+ K[t] = !1;
1087
+ }) : K.x || K.y ? null : (K.x = K.y = !0, () => {
1088
+ K.x = K.y = !1;
1089
+ });
1090
+ }
1091
+ const ii = /* @__PURE__ */ new Set([
1092
+ "width",
1093
+ "height",
1094
+ "top",
1095
+ "left",
1096
+ "right",
1097
+ "bottom",
1098
+ ...pt
1099
+ ]);
1100
+ let _t;
1101
+ function Ar() {
1102
+ _t = void 0;
1103
+ }
1104
+ const W = {
1105
+ now: () => (_t === void 0 && W.set(L.isProcessing || xo.useManualTiming ? L.timestamp : performance.now()), _t),
1106
+ set: (t) => {
1107
+ _t = t, queueMicrotask(Ar);
1108
+ }
1109
+ };
1110
+ function Je(t, e) {
1111
+ t.indexOf(e) === -1 && t.push(e);
1112
+ }
1113
+ function tn(t, e) {
1114
+ const n = t.indexOf(e);
1115
+ n > -1 && t.splice(n, 1);
1116
+ }
1117
+ class en {
1118
+ constructor() {
1119
+ this.subscriptions = [];
1120
+ }
1121
+ add(e) {
1122
+ return Je(this.subscriptions, e), () => tn(this.subscriptions, e);
1123
+ }
1124
+ notify(e, n, s) {
1125
+ const i = this.subscriptions.length;
1126
+ if (i)
1127
+ if (i === 1)
1128
+ this.subscriptions[0](e, n, s);
1129
+ else
1130
+ for (let r = 0; r < i; r++) {
1131
+ const o = this.subscriptions[r];
1132
+ o && o(e, n, s);
1133
+ }
1134
+ }
1135
+ getSize() {
1136
+ return this.subscriptions.length;
1137
+ }
1138
+ clear() {
1139
+ this.subscriptions.length = 0;
1140
+ }
1141
+ }
1142
+ function oi(t, e) {
1143
+ return e ? t * (1e3 / e) : 0;
1144
+ }
1145
+ const wn = 30, wr = (t) => !isNaN(parseFloat(t));
1146
+ class Vr {
1147
+ /**
1148
+ * @param init - The initiating value
1149
+ * @param config - Optional configuration options
1150
+ *
1151
+ * - `transformer`: A function to transform incoming values with.
1152
+ *
1153
+ * @internal
1154
+ */
1155
+ constructor(e, n = {}) {
1156
+ this.version = "11.18.2", this.canTrackVelocity = null, this.events = {}, this.updateAndNotify = (s, i = !0) => {
1157
+ const r = W.now();
1158
+ this.updatedAt !== r && this.setPrevFrameValue(), this.prev = this.current, this.setCurrent(s), this.current !== this.prev && this.events.change && this.events.change.notify(this.current), i && this.events.renderRequest && this.events.renderRequest.notify(this.current);
1159
+ }, this.hasAnimated = !1, this.setCurrent(e), this.owner = n.owner;
1160
+ }
1161
+ setCurrent(e) {
1162
+ this.current = e, this.updatedAt = W.now(), this.canTrackVelocity === null && e !== void 0 && (this.canTrackVelocity = wr(this.current));
1163
+ }
1164
+ setPrevFrameValue(e = this.current) {
1165
+ this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt;
1166
+ }
1167
+ /**
1168
+ * Adds a function that will be notified when the `MotionValue` is updated.
1169
+ *
1170
+ * It returns a function that, when called, will cancel the subscription.
1171
+ *
1172
+ * When calling `onChange` inside a React component, it should be wrapped with the
1173
+ * `useEffect` hook. As it returns an unsubscribe function, this should be returned
1174
+ * from the `useEffect` function to ensure you don't add duplicate subscribers..
1175
+ *
1176
+ * ```jsx
1177
+ * export const MyComponent = () => {
1178
+ * const x = useMotionValue(0)
1179
+ * const y = useMotionValue(0)
1180
+ * const opacity = useMotionValue(1)
1181
+ *
1182
+ * useEffect(() => {
1183
+ * function updateOpacity() {
1184
+ * const maxXY = Math.max(x.get(), y.get())
1185
+ * const newOpacity = transform(maxXY, [0, 100], [1, 0])
1186
+ * opacity.set(newOpacity)
1187
+ * }
1188
+ *
1189
+ * const unsubscribeX = x.on("change", updateOpacity)
1190
+ * const unsubscribeY = y.on("change", updateOpacity)
1191
+ *
1192
+ * return () => {
1193
+ * unsubscribeX()
1194
+ * unsubscribeY()
1195
+ * }
1196
+ * }, [])
1197
+ *
1198
+ * return <motion.div style={{ x }} />
1199
+ * }
1200
+ * ```
1201
+ *
1202
+ * @param subscriber - A function that receives the latest value.
1203
+ * @returns A function that, when called, will cancel this subscription.
1204
+ *
1205
+ * @deprecated
1206
+ */
1207
+ onChange(e) {
1208
+ return this.on("change", e);
1209
+ }
1210
+ on(e, n) {
1211
+ this.events[e] || (this.events[e] = new en());
1212
+ const s = this.events[e].add(n);
1213
+ return e === "change" ? () => {
1214
+ s(), C.read(() => {
1215
+ this.events.change.getSize() || this.stop();
1216
+ });
1217
+ } : s;
1218
+ }
1219
+ clearListeners() {
1220
+ for (const e in this.events)
1221
+ this.events[e].clear();
1222
+ }
1223
+ /**
1224
+ * Attaches a passive effect to the `MotionValue`.
1225
+ *
1226
+ * @internal
1227
+ */
1228
+ attach(e, n) {
1229
+ this.passiveEffect = e, this.stopPassiveEffect = n;
1230
+ }
1231
+ /**
1232
+ * Sets the state of the `MotionValue`.
1233
+ *
1234
+ * @remarks
1235
+ *
1236
+ * ```jsx
1237
+ * const x = useMotionValue(0)
1238
+ * x.set(10)
1239
+ * ```
1240
+ *
1241
+ * @param latest - Latest value to set.
1242
+ * @param render - Whether to notify render subscribers. Defaults to `true`
1243
+ *
1244
+ * @public
1245
+ */
1246
+ set(e, n = !0) {
1247
+ !n || !this.passiveEffect ? this.updateAndNotify(e, n) : this.passiveEffect(e, this.updateAndNotify);
1248
+ }
1249
+ setWithVelocity(e, n, s) {
1250
+ this.set(n), this.prev = void 0, this.prevFrameValue = e, this.prevUpdatedAt = this.updatedAt - s;
1251
+ }
1252
+ /**
1253
+ * Set the state of the `MotionValue`, stopping any active animations,
1254
+ * effects, and resets velocity to `0`.
1255
+ */
1256
+ jump(e, n = !0) {
1257
+ this.updateAndNotify(e), this.prev = e, this.prevUpdatedAt = this.prevFrameValue = void 0, n && this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
1258
+ }
1259
+ /**
1260
+ * Returns the latest state of `MotionValue`
1261
+ *
1262
+ * @returns - The latest state of `MotionValue`
1263
+ *
1264
+ * @public
1265
+ */
1266
+ get() {
1267
+ return this.current;
1268
+ }
1269
+ /**
1270
+ * @public
1271
+ */
1272
+ getPrevious() {
1273
+ return this.prev;
1274
+ }
1275
+ /**
1276
+ * Returns the latest velocity of `MotionValue`
1277
+ *
1278
+ * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
1279
+ *
1280
+ * @public
1281
+ */
1282
+ getVelocity() {
1283
+ const e = W.now();
1284
+ if (!this.canTrackVelocity || this.prevFrameValue === void 0 || e - this.updatedAt > wn)
1285
+ return 0;
1286
+ const n = Math.min(this.updatedAt - this.prevUpdatedAt, wn);
1287
+ return oi(parseFloat(this.current) - parseFloat(this.prevFrameValue), n);
1288
+ }
1289
+ /**
1290
+ * Registers a new animation to control this `MotionValue`. Only one
1291
+ * animation can drive a `MotionValue` at one time.
1292
+ *
1293
+ * ```jsx
1294
+ * value.start()
1295
+ * ```
1296
+ *
1297
+ * @param animation - A function that starts the provided animation
1298
+ *
1299
+ * @internal
1300
+ */
1301
+ start(e) {
1302
+ return this.stop(), new Promise((n) => {
1303
+ this.hasAnimated = !0, this.animation = e(n), this.events.animationStart && this.events.animationStart.notify();
1304
+ }).then(() => {
1305
+ this.events.animationComplete && this.events.animationComplete.notify(), this.clearAnimation();
1306
+ });
1307
+ }
1308
+ /**
1309
+ * Stop the currently active animation.
1310
+ *
1311
+ * @public
1312
+ */
1313
+ stop() {
1314
+ this.animation && (this.animation.stop(), this.events.animationCancel && this.events.animationCancel.notify()), this.clearAnimation();
1315
+ }
1316
+ /**
1317
+ * Returns `true` if this value is currently animating.
1318
+ *
1319
+ * @public
1320
+ */
1321
+ isAnimating() {
1322
+ return !!this.animation;
1323
+ }
1324
+ clearAnimation() {
1325
+ delete this.animation;
1326
+ }
1327
+ /**
1328
+ * Destroy and clean up subscribers to this `MotionValue`.
1329
+ *
1330
+ * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
1331
+ * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
1332
+ * created a `MotionValue` via the `motionValue` function.
1333
+ *
1334
+ * @public
1335
+ */
1336
+ destroy() {
1337
+ this.clearListeners(), this.stop(), this.stopPassiveEffect && this.stopPassiveEffect();
1338
+ }
1339
+ }
1340
+ function Dt(t, e) {
1341
+ return new Vr(t, e);
1342
+ }
1343
+ function Cr(t, e, n) {
1344
+ t.hasValue(e) ? t.getValue(e).set(n) : t.addValue(e, Dt(n));
1345
+ }
1346
+ function Dr(t, e) {
1347
+ const n = Jt(t, e);
1348
+ let { transitionEnd: s = {}, transition: i = {}, ...r } = n || {};
1349
+ r = { ...r, ...s };
1350
+ for (const o in r) {
1351
+ const a = Uo(r[o]);
1352
+ Cr(t, o, a);
1353
+ }
1354
+ }
1355
+ function Mr(t) {
1356
+ return !!(j(t) && t.add);
1357
+ }
1358
+ function xe(t, e) {
1359
+ const n = t.getValue("willChange");
1360
+ if (Mr(n))
1361
+ return n.add(e);
1362
+ }
1363
+ function ri(t) {
1364
+ return t.props[ks];
1365
+ }
1366
+ const ai = (t, e, n) => (((1 - 3 * n + 3 * e) * t + (3 * n - 6 * e)) * t + 3 * e) * t, Rr = 1e-7, Er = 12;
1367
+ function Lr(t, e, n, s, i) {
1368
+ let r, o, a = 0;
1369
+ do
1370
+ o = e + (n - e) / 2, r = ai(o, s, i) - t, r > 0 ? n = o : e = o;
1371
+ while (Math.abs(r) > Rr && ++a < Er);
1372
+ return o;
1373
+ }
1374
+ function Lt(t, e, n, s) {
1375
+ if (t === e && n === s)
1376
+ return I;
1377
+ const i = (r) => Lr(r, 0, 1, t, n);
1378
+ return (r) => r === 0 || r === 1 ? r : ai(i(r), e, s);
1379
+ }
1380
+ const li = (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, ui = (t) => (e) => 1 - t(1 - e), ci = /* @__PURE__ */ Lt(0.33, 1.53, 0.69, 0.99), nn = /* @__PURE__ */ ui(ci), hi = /* @__PURE__ */ li(nn), fi = (t) => (t *= 2) < 1 ? 0.5 * nn(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), sn = (t) => 1 - Math.sin(Math.acos(t)), di = ui(sn), mi = li(sn), pi = (t) => /^0[^.\s]+$/u.test(t);
1381
+ function Fr(t) {
1382
+ return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || pi(t) : !0;
1383
+ }
1384
+ const St = (t) => Math.round(t * 1e5) / 1e5, on = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
1385
+ function jr(t) {
1386
+ return t == null;
1387
+ }
1388
+ const Br = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu, rn = (t, e) => (n) => !!(typeof n == "string" && Br.test(n) && n.startsWith(t) || e && !jr(n) && Object.prototype.hasOwnProperty.call(n, e)), gi = (t, e, n) => (s) => {
1389
+ if (typeof s != "string")
1390
+ return s;
1391
+ const [i, r, o, a] = s.match(on);
1392
+ return {
1393
+ [t]: parseFloat(i),
1394
+ [e]: parseFloat(r),
1395
+ [n]: parseFloat(o),
1396
+ alpha: a !== void 0 ? parseFloat(a) : 1
1397
+ };
1398
+ }, kr = (t) => X(0, 255, t), oe = {
1399
+ ...gt,
1400
+ transform: (t) => Math.round(kr(t))
1401
+ }, nt = {
1402
+ test: /* @__PURE__ */ rn("rgb", "red"),
1403
+ parse: /* @__PURE__ */ gi("red", "green", "blue"),
1404
+ transform: ({ red: t, green: e, blue: n, alpha: s = 1 }) => "rgba(" + oe.transform(t) + ", " + oe.transform(e) + ", " + oe.transform(n) + ", " + St(Ct.transform(s)) + ")"
1405
+ };
1406
+ function Ir(t) {
1407
+ let e = "", n = "", s = "", i = "";
1408
+ return t.length > 5 ? (e = t.substring(1, 3), n = t.substring(3, 5), s = t.substring(5, 7), i = t.substring(7, 9)) : (e = t.substring(1, 2), n = t.substring(2, 3), s = t.substring(3, 4), i = t.substring(4, 5), e += e, n += n, s += s, i += i), {
1409
+ red: parseInt(e, 16),
1410
+ green: parseInt(n, 16),
1411
+ blue: parseInt(s, 16),
1412
+ alpha: i ? parseInt(i, 16) / 255 : 1
1413
+ };
1414
+ }
1415
+ const Te = {
1416
+ test: /* @__PURE__ */ rn("#"),
1417
+ parse: Ir,
1418
+ transform: nt.transform
1419
+ }, lt = {
1420
+ test: /* @__PURE__ */ rn("hsl", "hue"),
1421
+ parse: /* @__PURE__ */ gi("hue", "saturation", "lightness"),
1422
+ transform: ({ hue: t, saturation: e, lightness: n, alpha: s = 1 }) => "hsla(" + Math.round(t) + ", " + z.transform(St(e)) + ", " + z.transform(St(n)) + ", " + St(Ct.transform(s)) + ")"
1423
+ }, F = {
1424
+ test: (t) => nt.test(t) || Te.test(t) || lt.test(t),
1425
+ parse: (t) => nt.test(t) ? nt.parse(t) : lt.test(t) ? lt.parse(t) : Te.parse(t),
1426
+ transform: (t) => typeof t == "string" ? t : t.hasOwnProperty("red") ? nt.transform(t) : lt.transform(t)
1427
+ }, Or = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
1428
+ function Nr(t) {
1429
+ var e, n;
1430
+ return isNaN(t) && typeof t == "string" && (((e = t.match(on)) === null || e === void 0 ? void 0 : e.length) || 0) + (((n = t.match(Or)) === null || n === void 0 ? void 0 : n.length) || 0) > 0;
1431
+ }
1432
+ const yi = "number", vi = "color", Ur = "var", _r = "var(", Vn = "${}", Kr = /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;
1433
+ function Mt(t) {
1434
+ const e = t.toString(), n = [], s = {
1435
+ color: [],
1436
+ number: [],
1437
+ var: []
1438
+ }, i = [];
1439
+ let r = 0;
1440
+ const a = e.replace(Kr, (l) => (F.test(l) ? (s.color.push(r), i.push(vi), n.push(F.parse(l))) : l.startsWith(_r) ? (s.var.push(r), i.push(Ur), n.push(l)) : (s.number.push(r), i.push(yi), n.push(parseFloat(l))), ++r, Vn)).split(Vn);
1441
+ return { values: n, split: a, indexes: s, types: i };
1442
+ }
1443
+ function xi(t) {
1444
+ return Mt(t).values;
1445
+ }
1446
+ function Ti(t) {
1447
+ const { split: e, types: n } = Mt(t), s = e.length;
1448
+ return (i) => {
1449
+ let r = "";
1450
+ for (let o = 0; o < s; o++)
1451
+ if (r += e[o], i[o] !== void 0) {
1452
+ const a = n[o];
1453
+ a === yi ? r += St(i[o]) : a === vi ? r += F.transform(i[o]) : r += i[o];
1454
+ }
1455
+ return r;
1456
+ };
1457
+ }
1458
+ const zr = (t) => typeof t == "number" ? 0 : t;
1459
+ function Wr(t) {
1460
+ const e = xi(t);
1461
+ return Ti(t)(e.map(zr));
1462
+ }
1463
+ const Z = {
1464
+ test: Nr,
1465
+ parse: xi,
1466
+ createTransformer: Ti,
1467
+ getAnimatableNone: Wr
1468
+ }, $r = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]);
1469
+ function Gr(t) {
1470
+ const [e, n] = t.slice(0, -1).split("(");
1471
+ if (e === "drop-shadow")
1472
+ return t;
1473
+ const [s] = n.match(on) || [];
1474
+ if (!s)
1475
+ return t;
1476
+ const i = n.replace(s, "");
1477
+ let r = $r.has(e) ? 1 : 0;
1478
+ return s !== n && (r *= 100), e + "(" + r + i + ")";
1479
+ }
1480
+ const Hr = /\b([a-z-]*)\(.*?\)/gu, Pe = {
1481
+ ...Z,
1482
+ getAnimatableNone: (t) => {
1483
+ const e = t.match(Hr);
1484
+ return e ? e.map(Gr).join(" ") : t;
1485
+ }
1486
+ }, Xr = {
1487
+ ...ze,
1488
+ // Color props
1489
+ color: F,
1490
+ backgroundColor: F,
1491
+ outlineColor: F,
1492
+ fill: F,
1493
+ stroke: F,
1494
+ // Border props
1495
+ borderColor: F,
1496
+ borderTopColor: F,
1497
+ borderRightColor: F,
1498
+ borderBottomColor: F,
1499
+ borderLeftColor: F,
1500
+ filter: Pe,
1501
+ WebkitFilter: Pe
1502
+ }, an = (t) => Xr[t];
1503
+ function Pi(t, e) {
1504
+ let n = an(t);
1505
+ return n !== Pe && (n = Z), n.getAnimatableNone ? n.getAnimatableNone(e) : void 0;
1506
+ }
1507
+ const qr = /* @__PURE__ */ new Set(["auto", "none", "0"]);
1508
+ function Yr(t, e, n) {
1509
+ let s = 0, i;
1510
+ for (; s < t.length && !i; ) {
1511
+ const r = t[s];
1512
+ typeof r == "string" && !qr.has(r) && Mt(r).values.length && (i = t[s]), s++;
1513
+ }
1514
+ if (i && n)
1515
+ for (const r of e)
1516
+ t[r] = Pi(n, i);
1517
+ }
1518
+ const Cn = (t) => t === gt || t === x, Dn = (t, e) => parseFloat(t.split(", ")[e]), Mn = (t, e) => (n, { transform: s }) => {
1519
+ if (s === "none" || !s)
1520
+ return 0;
1521
+ const i = s.match(/^matrix3d\((.+)\)$/u);
1522
+ if (i)
1523
+ return Dn(i[1], e);
1524
+ {
1525
+ const r = s.match(/^matrix\((.+)\)$/u);
1526
+ return r ? Dn(r[1], t) : 0;
1527
+ }
1528
+ }, Zr = /* @__PURE__ */ new Set(["x", "y", "z"]), Qr = pt.filter((t) => !Zr.has(t));
1529
+ function Jr(t) {
1530
+ const e = [];
1531
+ return Qr.forEach((n) => {
1532
+ const s = t.getValue(n);
1533
+ s !== void 0 && (e.push([n, s.get()]), s.set(n.startsWith("scale") ? 1 : 0));
1534
+ }), e;
1535
+ }
1536
+ const mt = {
1537
+ // Dimensions
1538
+ width: ({ x: t }, { paddingLeft: e = "0", paddingRight: n = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(n),
1539
+ height: ({ y: t }, { paddingTop: e = "0", paddingBottom: n = "0" }) => t.max - t.min - parseFloat(e) - parseFloat(n),
1540
+ top: (t, { top: e }) => parseFloat(e),
1541
+ left: (t, { left: e }) => parseFloat(e),
1542
+ bottom: ({ y: t }, { top: e }) => parseFloat(e) + (t.max - t.min),
1543
+ right: ({ x: t }, { left: e }) => parseFloat(e) + (t.max - t.min),
1544
+ // Transform
1545
+ x: Mn(4, 13),
1546
+ y: Mn(5, 14)
1547
+ };
1548
+ mt.translateX = mt.x;
1549
+ mt.translateY = mt.y;
1550
+ const st = /* @__PURE__ */ new Set();
1551
+ let Se = !1, be = !1;
1552
+ function Si() {
1553
+ if (be) {
1554
+ const t = Array.from(st).filter((s) => s.needsMeasurement), e = new Set(t.map((s) => s.element)), n = /* @__PURE__ */ new Map();
1555
+ e.forEach((s) => {
1556
+ const i = Jr(s);
1557
+ i.length && (n.set(s, i), s.render());
1558
+ }), t.forEach((s) => s.measureInitialState()), e.forEach((s) => {
1559
+ s.render();
1560
+ const i = n.get(s);
1561
+ i && i.forEach(([r, o]) => {
1562
+ var a;
1563
+ (a = s.getValue(r)) === null || a === void 0 || a.set(o);
1564
+ });
1565
+ }), t.forEach((s) => s.measureEndState()), t.forEach((s) => {
1566
+ s.suspendedScrollY !== void 0 && window.scrollTo(0, s.suspendedScrollY);
1567
+ });
1568
+ }
1569
+ be = !1, Se = !1, st.forEach((t) => t.complete()), st.clear();
1570
+ }
1571
+ function bi() {
1572
+ st.forEach((t) => {
1573
+ t.readKeyframes(), t.needsMeasurement && (be = !0);
1574
+ });
1575
+ }
1576
+ function ta() {
1577
+ bi(), Si();
1578
+ }
1579
+ class ln {
1580
+ constructor(e, n, s, i, r, o = !1) {
1581
+ this.isComplete = !1, this.isAsync = !1, this.needsMeasurement = !1, this.isScheduled = !1, this.unresolvedKeyframes = [...e], this.onComplete = n, this.name = s, this.motionValue = i, this.element = r, this.isAsync = o;
1582
+ }
1583
+ scheduleResolve() {
1584
+ this.isScheduled = !0, this.isAsync ? (st.add(this), Se || (Se = !0, C.read(bi), C.resolveKeyframes(Si))) : (this.readKeyframes(), this.complete());
1585
+ }
1586
+ readKeyframes() {
1587
+ const { unresolvedKeyframes: e, name: n, element: s, motionValue: i } = this;
1588
+ for (let r = 0; r < e.length; r++)
1589
+ if (e[r] === null)
1590
+ if (r === 0) {
1591
+ const o = i == null ? void 0 : i.get(), a = e[e.length - 1];
1592
+ if (o !== void 0)
1593
+ e[0] = o;
1594
+ else if (s && n) {
1595
+ const l = s.readValue(n, a);
1596
+ l != null && (e[0] = l);
1597
+ }
1598
+ e[0] === void 0 && (e[0] = a), i && o === void 0 && i.set(e[0]);
1599
+ } else
1600
+ e[r] = e[r - 1];
1601
+ }
1602
+ setFinalKeyframe() {
1603
+ }
1604
+ measureInitialState() {
1605
+ }
1606
+ renderEndStyles() {
1607
+ }
1608
+ measureEndState() {
1609
+ }
1610
+ complete() {
1611
+ this.isComplete = !0, this.onComplete(this.unresolvedKeyframes, this.finalKeyframe), st.delete(this);
1612
+ }
1613
+ cancel() {
1614
+ this.isComplete || (this.isScheduled = !1, st.delete(this));
1615
+ }
1616
+ resume() {
1617
+ this.isComplete || this.scheduleResolve();
1618
+ }
1619
+ }
1620
+ const Ai = (t) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t), ea = (
1621
+ // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words
1622
+ /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u
1623
+ );
1624
+ function na(t) {
1625
+ const e = ea.exec(t);
1626
+ if (!e)
1627
+ return [,];
1628
+ const [, n, s, i] = e;
1629
+ return [`--${n ?? s}`, i];
1630
+ }
1631
+ function wi(t, e, n = 1) {
1632
+ const [s, i] = na(t);
1633
+ if (!s)
1634
+ return;
1635
+ const r = window.getComputedStyle(e).getPropertyValue(s);
1636
+ if (r) {
1637
+ const o = r.trim();
1638
+ return Ai(o) ? parseFloat(o) : o;
1639
+ }
1640
+ return Ke(i) ? wi(i, e, n + 1) : i;
1641
+ }
1642
+ const Vi = (t) => (e) => e.test(t), sa = {
1643
+ test: (t) => t === "auto",
1644
+ parse: (t) => t
1645
+ }, Ci = [gt, x, z, q, Go, $o, sa], Rn = (t) => Ci.find(Vi(t));
1646
+ class Di extends ln {
1647
+ constructor(e, n, s, i, r) {
1648
+ super(e, n, s, i, r, !0);
1649
+ }
1650
+ readKeyframes() {
1651
+ const { unresolvedKeyframes: e, element: n, name: s } = this;
1652
+ if (!n || !n.current)
1653
+ return;
1654
+ super.readKeyframes();
1655
+ for (let l = 0; l < e.length; l++) {
1656
+ let u = e[l];
1657
+ if (typeof u == "string" && (u = u.trim(), Ke(u))) {
1658
+ const c = wi(u, n.current);
1659
+ c !== void 0 && (e[l] = c), l === e.length - 1 && (this.finalKeyframe = u);
1660
+ }
1661
+ }
1662
+ if (this.resolveNoneKeyframes(), !ii.has(s) || e.length !== 2)
1663
+ return;
1664
+ const [i, r] = e, o = Rn(i), a = Rn(r);
1665
+ if (o !== a)
1666
+ if (Cn(o) && Cn(a))
1667
+ for (let l = 0; l < e.length; l++) {
1668
+ const u = e[l];
1669
+ typeof u == "string" && (e[l] = parseFloat(u));
1670
+ }
1671
+ else
1672
+ this.needsMeasurement = !0;
1673
+ }
1674
+ resolveNoneKeyframes() {
1675
+ const { unresolvedKeyframes: e, name: n } = this, s = [];
1676
+ for (let i = 0; i < e.length; i++)
1677
+ Fr(e[i]) && s.push(i);
1678
+ s.length && Yr(e, s, n);
1679
+ }
1680
+ measureInitialState() {
1681
+ const { element: e, unresolvedKeyframes: n, name: s } = this;
1682
+ if (!e || !e.current)
1683
+ return;
1684
+ s === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = mt[s](e.measureViewportBox(), window.getComputedStyle(e.current)), n[0] = this.measuredOrigin;
1685
+ const i = n[n.length - 1];
1686
+ i !== void 0 && e.getValue(s, i).jump(i, !1);
1687
+ }
1688
+ measureEndState() {
1689
+ var e;
1690
+ const { element: n, name: s, unresolvedKeyframes: i } = this;
1691
+ if (!n || !n.current)
1692
+ return;
1693
+ const r = n.getValue(s);
1694
+ r && r.jump(this.measuredOrigin, !1);
1695
+ const o = i.length - 1, a = i[o];
1696
+ i[o] = mt[s](n.measureViewportBox(), window.getComputedStyle(n.current)), a !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = a), !((e = this.removedTransforms) === null || e === void 0) && e.length && this.removedTransforms.forEach(([l, u]) => {
1697
+ n.getValue(l).set(u);
1698
+ }), this.resolveNoneKeyframes();
1699
+ }
1700
+ }
1701
+ const En = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string
1702
+ (Z.test(t) || t === "0") && // And it contains numbers and/or colors
1703
+ !t.startsWith("url("));
1704
+ function ia(t) {
1705
+ const e = t[0];
1706
+ if (t.length === 1)
1707
+ return !0;
1708
+ for (let n = 0; n < t.length; n++)
1709
+ if (t[n] !== e)
1710
+ return !0;
1711
+ }
1712
+ function oa(t, e, n, s) {
1713
+ const i = t[0];
1714
+ if (i === null)
1715
+ return !1;
1716
+ if (e === "display" || e === "visibility")
1717
+ return !0;
1718
+ const r = t[t.length - 1], o = En(i, e), a = En(r, e);
1719
+ return !o || !a ? !1 : ia(t) || (n === "spring" || Ye(n)) && s;
1720
+ }
1721
+ const ra = (t) => t !== null;
1722
+ function te(t, { repeat: e, repeatType: n = "loop" }, s) {
1723
+ const i = t.filter(ra), r = e && n !== "loop" && e % 2 === 1 ? 0 : i.length - 1;
1724
+ return !r || s === void 0 ? i[r] : s;
1725
+ }
1726
+ const aa = 40;
1727
+ class Mi {
1728
+ constructor({ autoplay: e = !0, delay: n = 0, type: s = "keyframes", repeat: i = 0, repeatDelay: r = 0, repeatType: o = "loop", ...a }) {
1729
+ this.isStopped = !1, this.hasAttemptedResolve = !1, this.createdAt = W.now(), this.options = {
1730
+ autoplay: e,
1731
+ delay: n,
1732
+ type: s,
1733
+ repeat: i,
1734
+ repeatDelay: r,
1735
+ repeatType: o,
1736
+ ...a
1737
+ }, this.updateFinishedPromise();
1738
+ }
1739
+ /**
1740
+ * This method uses the createdAt and resolvedAt to calculate the
1741
+ * animation startTime. *Ideally*, we would use the createdAt time as t=0
1742
+ * as the following frame would then be the first frame of the animation in
1743
+ * progress, which would feel snappier.
1744
+ *
1745
+ * However, if there's a delay (main thread work) between the creation of
1746
+ * the animation and the first commited frame, we prefer to use resolvedAt
1747
+ * to avoid a sudden jump into the animation.
1748
+ */
1749
+ calcStartTime() {
1750
+ return this.resolvedAt ? this.resolvedAt - this.createdAt > aa ? this.resolvedAt : this.createdAt : this.createdAt;
1751
+ }
1752
+ /**
1753
+ * A getter for resolved data. If keyframes are not yet resolved, accessing
1754
+ * this.resolved will synchronously flush all pending keyframe resolvers.
1755
+ * This is a deoptimisation, but at its worst still batches read/writes.
1756
+ */
1757
+ get resolved() {
1758
+ return !this._resolved && !this.hasAttemptedResolve && ta(), this._resolved;
1759
+ }
1760
+ /**
1761
+ * A method to be called when the keyframes resolver completes. This method
1762
+ * will check if its possible to run the animation and, if not, skip it.
1763
+ * Otherwise, it will call initPlayback on the implementing class.
1764
+ */
1765
+ onKeyframesResolved(e, n) {
1766
+ this.resolvedAt = W.now(), this.hasAttemptedResolve = !0;
1767
+ const { name: s, type: i, velocity: r, delay: o, onComplete: a, onUpdate: l, isGenerator: u } = this.options;
1768
+ if (!u && !oa(e, s, i, r))
1769
+ if (o)
1770
+ this.options.duration = 0;
1771
+ else {
1772
+ l && l(te(e, this.options, n)), a && a(), this.resolveFinishedPromise();
1773
+ return;
1774
+ }
1775
+ const c = this.initPlayback(e, n);
1776
+ c !== !1 && (this._resolved = {
1777
+ keyframes: e,
1778
+ finalKeyframe: n,
1779
+ ...c
1780
+ }, this.onPostResolved());
1781
+ }
1782
+ onPostResolved() {
1783
+ }
1784
+ /**
1785
+ * Allows the returned animation to be awaited or promise-chained. Currently
1786
+ * resolves when the animation finishes at all but in a future update could/should
1787
+ * reject if its cancels.
1788
+ */
1789
+ then(e, n) {
1790
+ return this.currentFinishedPromise.then(e, n);
1791
+ }
1792
+ flatten() {
1793
+ this.options.type = "keyframes", this.options.ease = "linear";
1794
+ }
1795
+ updateFinishedPromise() {
1796
+ this.currentFinishedPromise = new Promise((e) => {
1797
+ this.resolveFinishedPromise = e;
1798
+ });
1799
+ }
1800
+ }
1801
+ const D = (t, e, n) => t + (e - t) * n;
1802
+ function re(t, e, n) {
1803
+ return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? t + (e - t) * 6 * n : n < 1 / 2 ? e : n < 2 / 3 ? t + (e - t) * (2 / 3 - n) * 6 : t;
1804
+ }
1805
+ function la({ hue: t, saturation: e, lightness: n, alpha: s }) {
1806
+ t /= 360, e /= 100, n /= 100;
1807
+ let i = 0, r = 0, o = 0;
1808
+ if (!e)
1809
+ i = r = o = n;
1810
+ else {
1811
+ const a = n < 0.5 ? n * (1 + e) : n + e - n * e, l = 2 * n - a;
1812
+ i = re(l, a, t + 1 / 3), r = re(l, a, t), o = re(l, a, t - 1 / 3);
1813
+ }
1814
+ return {
1815
+ red: Math.round(i * 255),
1816
+ green: Math.round(r * 255),
1817
+ blue: Math.round(o * 255),
1818
+ alpha: s
1819
+ };
1820
+ }
1821
+ function Gt(t, e) {
1822
+ return (n) => n > 0 ? e : t;
1823
+ }
1824
+ const ae = (t, e, n) => {
1825
+ const s = t * t, i = n * (e * e - s) + s;
1826
+ return i < 0 ? 0 : Math.sqrt(i);
1827
+ }, ua = [Te, nt, lt], ca = (t) => ua.find((e) => e.test(t));
1828
+ function Ln(t) {
1829
+ const e = ca(t);
1830
+ if (!e)
1831
+ return !1;
1832
+ let n = e.parse(t);
1833
+ return e === lt && (n = la(n)), n;
1834
+ }
1835
+ const Fn = (t, e) => {
1836
+ const n = Ln(t), s = Ln(e);
1837
+ if (!n || !s)
1838
+ return Gt(t, e);
1839
+ const i = { ...n };
1840
+ return (r) => (i.red = ae(n.red, s.red, r), i.green = ae(n.green, s.green, r), i.blue = ae(n.blue, s.blue, r), i.alpha = D(n.alpha, s.alpha, r), nt.transform(i));
1841
+ }, ha = (t, e) => (n) => e(t(n)), Ft = (...t) => t.reduce(ha), Ae = /* @__PURE__ */ new Set(["none", "hidden"]);
1842
+ function fa(t, e) {
1843
+ return Ae.has(t) ? (n) => n <= 0 ? t : e : (n) => n >= 1 ? e : t;
1844
+ }
1845
+ function da(t, e) {
1846
+ return (n) => D(t, e, n);
1847
+ }
1848
+ function un(t) {
1849
+ return typeof t == "number" ? da : typeof t == "string" ? Ke(t) ? Gt : F.test(t) ? Fn : ga : Array.isArray(t) ? Ri : typeof t == "object" ? F.test(t) ? Fn : ma : Gt;
1850
+ }
1851
+ function Ri(t, e) {
1852
+ const n = [...t], s = n.length, i = t.map((r, o) => un(r)(r, e[o]));
1853
+ return (r) => {
1854
+ for (let o = 0; o < s; o++)
1855
+ n[o] = i[o](r);
1856
+ return n;
1857
+ };
1858
+ }
1859
+ function ma(t, e) {
1860
+ const n = { ...t, ...e }, s = {};
1861
+ for (const i in n)
1862
+ t[i] !== void 0 && e[i] !== void 0 && (s[i] = un(t[i])(t[i], e[i]));
1863
+ return (i) => {
1864
+ for (const r in s)
1865
+ n[r] = s[r](i);
1866
+ return n;
1867
+ };
1868
+ }
1869
+ function pa(t, e) {
1870
+ var n;
1871
+ const s = [], i = { color: 0, var: 0, number: 0 };
1872
+ for (let r = 0; r < e.values.length; r++) {
1873
+ const o = e.types[r], a = t.indexes[o][i[o]], l = (n = t.values[a]) !== null && n !== void 0 ? n : 0;
1874
+ s[r] = l, i[o]++;
1875
+ }
1876
+ return s;
1877
+ }
1878
+ const ga = (t, e) => {
1879
+ const n = Z.createTransformer(e), s = Mt(t), i = Mt(e);
1880
+ return s.indexes.var.length === i.indexes.var.length && s.indexes.color.length === i.indexes.color.length && s.indexes.number.length >= i.indexes.number.length ? Ae.has(t) && !i.values.length || Ae.has(e) && !s.values.length ? fa(t, e) : Ft(Ri(pa(s, i), i.values), n) : Gt(t, e);
1881
+ };
1882
+ function Ei(t, e, n) {
1883
+ return typeof t == "number" && typeof e == "number" && typeof n == "number" ? D(t, e, n) : un(t)(t, e);
1884
+ }
1885
+ const ya = 5;
1886
+ function Li(t, e, n) {
1887
+ const s = Math.max(e - ya, 0);
1888
+ return oi(n - t(s), e - s);
1889
+ }
1890
+ const M = {
1891
+ // Default spring physics
1892
+ stiffness: 100,
1893
+ damping: 10,
1894
+ mass: 1,
1895
+ velocity: 0,
1896
+ // Default duration/bounce-based options
1897
+ duration: 800,
1898
+ // in ms
1899
+ bounce: 0.3,
1900
+ visualDuration: 0.3,
1901
+ // in seconds
1902
+ // Rest thresholds
1903
+ restSpeed: {
1904
+ granular: 0.01,
1905
+ default: 2
1906
+ },
1907
+ restDelta: {
1908
+ granular: 5e-3,
1909
+ default: 0.5
1910
+ },
1911
+ // Limits
1912
+ minDuration: 0.01,
1913
+ // in seconds
1914
+ maxDuration: 10,
1915
+ // in seconds
1916
+ minDamping: 0.05,
1917
+ maxDamping: 1
1918
+ }, le = 1e-3;
1919
+ function va({ duration: t = M.duration, bounce: e = M.bounce, velocity: n = M.velocity, mass: s = M.mass }) {
1920
+ let i, r, o = 1 - e;
1921
+ o = X(M.minDamping, M.maxDamping, o), t = X(M.minDuration, M.maxDuration, /* @__PURE__ */ H(t)), o < 1 ? (i = (u) => {
1922
+ const c = u * o, h = c * t, f = c - n, d = we(u, o), m = Math.exp(-h);
1923
+ return le - f / d * m;
1924
+ }, r = (u) => {
1925
+ const h = u * o * t, f = h * n + n, d = Math.pow(o, 2) * Math.pow(u, 2) * t, m = Math.exp(-h), p = we(Math.pow(u, 2), o);
1926
+ return (-i(u) + le > 0 ? -1 : 1) * ((f - d) * m) / p;
1927
+ }) : (i = (u) => {
1928
+ const c = Math.exp(-u * t), h = (u - n) * t + 1;
1929
+ return -le + c * h;
1930
+ }, r = (u) => {
1931
+ const c = Math.exp(-u * t), h = (n - u) * (t * t);
1932
+ return c * h;
1933
+ });
1934
+ const a = 5 / t, l = Ta(i, r, a);
1935
+ if (t = /* @__PURE__ */ G(t), isNaN(l))
1936
+ return {
1937
+ stiffness: M.stiffness,
1938
+ damping: M.damping,
1939
+ duration: t
1940
+ };
1941
+ {
1942
+ const u = Math.pow(l, 2) * s;
1943
+ return {
1944
+ stiffness: u,
1945
+ damping: o * 2 * Math.sqrt(s * u),
1946
+ duration: t
1947
+ };
1948
+ }
1949
+ }
1950
+ const xa = 12;
1951
+ function Ta(t, e, n) {
1952
+ let s = n;
1953
+ for (let i = 1; i < xa; i++)
1954
+ s = s - t(s) / e(s);
1955
+ return s;
1956
+ }
1957
+ function we(t, e) {
1958
+ return t * Math.sqrt(1 - e * e);
1959
+ }
1960
+ const Pa = ["duration", "bounce"], Sa = ["stiffness", "damping", "mass"];
1961
+ function jn(t, e) {
1962
+ return e.some((n) => t[n] !== void 0);
1963
+ }
1964
+ function ba(t) {
1965
+ let e = {
1966
+ velocity: M.velocity,
1967
+ stiffness: M.stiffness,
1968
+ damping: M.damping,
1969
+ mass: M.mass,
1970
+ isResolvedFromDuration: !1,
1971
+ ...t
1972
+ };
1973
+ if (!jn(t, Sa) && jn(t, Pa))
1974
+ if (t.visualDuration) {
1975
+ const n = t.visualDuration, s = 2 * Math.PI / (n * 1.2), i = s * s, r = 2 * X(0.05, 1, 1 - (t.bounce || 0)) * Math.sqrt(i);
1976
+ e = {
1977
+ ...e,
1978
+ mass: M.mass,
1979
+ stiffness: i,
1980
+ damping: r
1981
+ };
1982
+ } else {
1983
+ const n = va(t);
1984
+ e = {
1985
+ ...e,
1986
+ ...n,
1987
+ mass: M.mass
1988
+ }, e.isResolvedFromDuration = !0;
1989
+ }
1990
+ return e;
1991
+ }
1992
+ function Fi(t = M.visualDuration, e = M.bounce) {
1993
+ const n = typeof t != "object" ? {
1994
+ visualDuration: t,
1995
+ keyframes: [0, 1],
1996
+ bounce: e
1997
+ } : t;
1998
+ let { restSpeed: s, restDelta: i } = n;
1999
+ const r = n.keyframes[0], o = n.keyframes[n.keyframes.length - 1], a = { done: !1, value: r }, { stiffness: l, damping: u, mass: c, duration: h, velocity: f, isResolvedFromDuration: d } = ba({
2000
+ ...n,
2001
+ velocity: -/* @__PURE__ */ H(n.velocity || 0)
2002
+ }), m = f || 0, p = u / (2 * Math.sqrt(l * c)), y = o - r, g = /* @__PURE__ */ H(Math.sqrt(l / c)), v = Math.abs(y) < 5;
2003
+ s || (s = v ? M.restSpeed.granular : M.restSpeed.default), i || (i = v ? M.restDelta.granular : M.restDelta.default);
2004
+ let T;
2005
+ if (p < 1) {
2006
+ const S = we(g, p);
2007
+ T = (V) => {
2008
+ const E = Math.exp(-p * g * V);
2009
+ return o - E * ((m + p * g * y) / S * Math.sin(S * V) + y * Math.cos(S * V));
2010
+ };
2011
+ } else if (p === 1)
2012
+ T = (S) => o - Math.exp(-g * S) * (y + (m + g * y) * S);
2013
+ else {
2014
+ const S = g * Math.sqrt(p * p - 1);
2015
+ T = (V) => {
2016
+ const E = Math.exp(-p * g * V), b = Math.min(S * V, 300);
2017
+ return o - E * ((m + p * g * y) * Math.sinh(b) + S * y * Math.cosh(b)) / S;
2018
+ };
2019
+ }
2020
+ const w = {
2021
+ calculatedDuration: d && h || null,
2022
+ next: (S) => {
2023
+ const V = T(S);
2024
+ if (d)
2025
+ a.done = S >= h;
2026
+ else {
2027
+ let E = 0;
2028
+ p < 1 && (E = S === 0 ? /* @__PURE__ */ G(m) : Li(T, S, V));
2029
+ const b = Math.abs(E) <= s, k = Math.abs(o - V) <= i;
2030
+ a.done = b && k;
2031
+ }
2032
+ return a.value = a.done ? o : V, a;
2033
+ },
2034
+ toString: () => {
2035
+ const S = Math.min(Zs(w), ye), V = Qs((E) => w.next(S * E).value, S, 30);
2036
+ return S + "ms " + V;
2037
+ }
2038
+ };
2039
+ return w;
2040
+ }
2041
+ function Bn({ keyframes: t, velocity: e = 0, power: n = 0.8, timeConstant: s = 325, bounceDamping: i = 10, bounceStiffness: r = 500, modifyTarget: o, min: a, max: l, restDelta: u = 0.5, restSpeed: c }) {
2042
+ const h = t[0], f = {
2043
+ done: !1,
2044
+ value: h
2045
+ }, d = (b) => a !== void 0 && b < a || l !== void 0 && b > l, m = (b) => a === void 0 ? l : l === void 0 || Math.abs(a - b) < Math.abs(l - b) ? a : l;
2046
+ let p = n * e;
2047
+ const y = h + p, g = o === void 0 ? y : o(y);
2048
+ g !== y && (p = g - h);
2049
+ const v = (b) => -p * Math.exp(-b / s), T = (b) => g + v(b), w = (b) => {
2050
+ const k = v(b), N = T(b);
2051
+ f.done = Math.abs(k) <= u, f.value = f.done ? g : N;
2052
+ };
2053
+ let S, V;
2054
+ const E = (b) => {
2055
+ d(f.value) && (S = b, V = Fi({
2056
+ keyframes: [f.value, m(f.value)],
2057
+ velocity: Li(T, b, f.value),
2058
+ // TODO: This should be passing * 1000
2059
+ damping: i,
2060
+ stiffness: r,
2061
+ restDelta: u,
2062
+ restSpeed: c
2063
+ }));
2064
+ };
2065
+ return E(0), {
2066
+ calculatedDuration: null,
2067
+ next: (b) => {
2068
+ let k = !1;
2069
+ return !V && S === void 0 && (k = !0, w(b), E(b)), S !== void 0 && b >= S ? V.next(b - S) : (!k && w(b), f);
2070
+ }
2071
+ };
2072
+ }
2073
+ const Aa = /* @__PURE__ */ Lt(0.42, 0, 1, 1), wa = /* @__PURE__ */ Lt(0, 0, 0.58, 1), ji = /* @__PURE__ */ Lt(0.42, 0, 0.58, 1), Va = (t) => Array.isArray(t) && typeof t[0] != "number", Ca = {
2074
+ linear: I,
2075
+ easeIn: Aa,
2076
+ easeInOut: ji,
2077
+ easeOut: wa,
2078
+ circIn: sn,
2079
+ circInOut: mi,
2080
+ circOut: di,
2081
+ backIn: nn,
2082
+ backInOut: hi,
2083
+ backOut: ci,
2084
+ anticipate: fi
2085
+ }, kn = (t) => {
2086
+ if (Ze(t)) {
2087
+ Es(t.length === 4);
2088
+ const [e, n, s, i] = t;
2089
+ return Lt(e, n, s, i);
2090
+ } else if (typeof t == "string")
2091
+ return Ca[t];
2092
+ return t;
2093
+ };
2094
+ function Da(t, e, n) {
2095
+ const s = [], i = n || Ei, r = t.length - 1;
2096
+ for (let o = 0; o < r; o++) {
2097
+ let a = i(t[o], t[o + 1]);
2098
+ if (e) {
2099
+ const l = Array.isArray(e) ? e[o] || I : e;
2100
+ a = Ft(l, a);
2101
+ }
2102
+ s.push(a);
2103
+ }
2104
+ return s;
2105
+ }
2106
+ function Ma(t, e, { clamp: n = !0, ease: s, mixer: i } = {}) {
2107
+ const r = t.length;
2108
+ if (Es(r === e.length), r === 1)
2109
+ return () => e[0];
2110
+ if (r === 2 && e[0] === e[1])
2111
+ return () => e[1];
2112
+ const o = t[0] === t[1];
2113
+ t[0] > t[r - 1] && (t = [...t].reverse(), e = [...e].reverse());
2114
+ const a = Da(e, s, i), l = a.length, u = (c) => {
2115
+ if (o && c < t[0])
2116
+ return e[0];
2117
+ let h = 0;
2118
+ if (l > 1)
2119
+ for (; h < t.length - 2 && !(c < t[h + 1]); h++)
2120
+ ;
2121
+ const f = /* @__PURE__ */ ft(t[h], t[h + 1], c);
2122
+ return a[h](f);
2123
+ };
2124
+ return n ? (c) => u(X(t[0], t[r - 1], c)) : u;
2125
+ }
2126
+ function Ra(t, e) {
2127
+ const n = t[t.length - 1];
2128
+ for (let s = 1; s <= e; s++) {
2129
+ const i = /* @__PURE__ */ ft(0, e, s);
2130
+ t.push(D(n, 1, i));
2131
+ }
2132
+ }
2133
+ function Ea(t) {
2134
+ const e = [0];
2135
+ return Ra(e, t.length - 1), e;
2136
+ }
2137
+ function La(t, e) {
2138
+ return t.map((n) => n * e);
2139
+ }
2140
+ function Fa(t, e) {
2141
+ return t.map(() => e || ji).splice(0, t.length - 1);
2142
+ }
2143
+ function Ht({ duration: t = 300, keyframes: e, times: n, ease: s = "easeInOut" }) {
2144
+ const i = Va(s) ? s.map(kn) : kn(s), r = {
2145
+ done: !1,
2146
+ value: e[0]
2147
+ }, o = La(
2148
+ // Only use the provided offsets if they're the correct length
2149
+ // TODO Maybe we should warn here if there's a length mismatch
2150
+ n && n.length === e.length ? n : Ea(e),
2151
+ t
2152
+ ), a = Ma(o, e, {
2153
+ ease: Array.isArray(i) ? i : Fa(e, i)
2154
+ });
2155
+ return {
2156
+ calculatedDuration: t,
2157
+ next: (l) => (r.value = a(l), r.done = l >= t, r)
2158
+ };
2159
+ }
2160
+ const ja = (t) => {
2161
+ const e = ({ timestamp: n }) => t(n);
2162
+ return {
2163
+ start: () => C.update(e, !0),
2164
+ stop: () => Y(e),
2165
+ /**
2166
+ * If we're processing this frame we can use the
2167
+ * framelocked timestamp to keep things in sync.
2168
+ */
2169
+ now: () => L.isProcessing ? L.timestamp : W.now()
2170
+ };
2171
+ }, Ba = {
2172
+ decay: Bn,
2173
+ inertia: Bn,
2174
+ tween: Ht,
2175
+ keyframes: Ht,
2176
+ spring: Fi
2177
+ }, ka = (t) => t / 100;
2178
+ class cn extends Mi {
2179
+ constructor(e) {
2180
+ super(e), this.holdTime = null, this.cancelTime = null, this.currentTime = 0, this.playbackSpeed = 1, this.pendingPlayState = "running", this.startTime = null, this.state = "idle", this.stop = () => {
2181
+ if (this.resolver.cancel(), this.isStopped = !0, this.state === "idle")
2182
+ return;
2183
+ this.teardown();
2184
+ const { onStop: l } = this.options;
2185
+ l && l();
2186
+ };
2187
+ const { name: n, motionValue: s, element: i, keyframes: r } = this.options, o = (i == null ? void 0 : i.KeyframeResolver) || ln, a = (l, u) => this.onKeyframesResolved(l, u);
2188
+ this.resolver = new o(r, a, n, s, i), this.resolver.scheduleResolve();
2189
+ }
2190
+ flatten() {
2191
+ super.flatten(), this._resolved && Object.assign(this._resolved, this.initPlayback(this._resolved.keyframes));
2192
+ }
2193
+ initPlayback(e) {
2194
+ const { type: n = "keyframes", repeat: s = 0, repeatDelay: i = 0, repeatType: r, velocity: o = 0 } = this.options, a = Ye(n) ? n : Ba[n] || Ht;
2195
+ let l, u;
2196
+ a !== Ht && typeof e[0] != "number" && (l = Ft(ka, Ei(e[0], e[1])), e = [0, 100]);
2197
+ const c = a({ ...this.options, keyframes: e });
2198
+ r === "mirror" && (u = a({
2199
+ ...this.options,
2200
+ keyframes: [...e].reverse(),
2201
+ velocity: -o
2202
+ })), c.calculatedDuration === null && (c.calculatedDuration = Zs(c));
2203
+ const { calculatedDuration: h } = c, f = h + i, d = f * (s + 1) - i;
2204
+ return {
2205
+ generator: c,
2206
+ mirroredGenerator: u,
2207
+ mapPercentToKeyframes: l,
2208
+ calculatedDuration: h,
2209
+ resolvedDuration: f,
2210
+ totalDuration: d
2211
+ };
2212
+ }
2213
+ onPostResolved() {
2214
+ const { autoplay: e = !0 } = this.options;
2215
+ this.play(), this.pendingPlayState === "paused" || !e ? this.pause() : this.state = this.pendingPlayState;
2216
+ }
2217
+ tick(e, n = !1) {
2218
+ const { resolved: s } = this;
2219
+ if (!s) {
2220
+ const { keyframes: b } = this.options;
2221
+ return { done: !0, value: b[b.length - 1] };
2222
+ }
2223
+ const { finalKeyframe: i, generator: r, mirroredGenerator: o, mapPercentToKeyframes: a, keyframes: l, calculatedDuration: u, totalDuration: c, resolvedDuration: h } = s;
2224
+ if (this.startTime === null)
2225
+ return r.next(0);
2226
+ const { delay: f, repeat: d, repeatType: m, repeatDelay: p, onUpdate: y } = this.options;
2227
+ this.speed > 0 ? this.startTime = Math.min(this.startTime, e) : this.speed < 0 && (this.startTime = Math.min(e - c / this.speed, this.startTime)), n ? this.currentTime = e : this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = Math.round(e - this.startTime) * this.speed;
2228
+ const g = this.currentTime - f * (this.speed >= 0 ? 1 : -1), v = this.speed >= 0 ? g < 0 : g > c;
2229
+ this.currentTime = Math.max(g, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = c);
2230
+ let T = this.currentTime, w = r;
2231
+ if (d) {
2232
+ const b = Math.min(this.currentTime, c) / h;
2233
+ let k = Math.floor(b), N = b % 1;
2234
+ !N && b >= 1 && (N = 1), N === 1 && k--, k = Math.min(k, d + 1), !!(k % 2) && (m === "reverse" ? (N = 1 - N, p && (N -= p / h)) : m === "mirror" && (w = o)), T = X(0, 1, N) * h;
2235
+ }
2236
+ const S = v ? { done: !1, value: l[0] } : w.next(T);
2237
+ a && (S.value = a(S.value));
2238
+ let { done: V } = S;
2239
+ !v && u !== null && (V = this.speed >= 0 ? this.currentTime >= c : this.currentTime <= 0);
2240
+ const E = this.holdTime === null && (this.state === "finished" || this.state === "running" && V);
2241
+ return E && i !== void 0 && (S.value = te(l, this.options, i)), y && y(S.value), E && this.finish(), S;
2242
+ }
2243
+ get duration() {
2244
+ const { resolved: e } = this;
2245
+ return e ? /* @__PURE__ */ H(e.calculatedDuration) : 0;
2246
+ }
2247
+ get time() {
2248
+ return /* @__PURE__ */ H(this.currentTime);
2249
+ }
2250
+ set time(e) {
2251
+ e = /* @__PURE__ */ G(e), this.currentTime = e, this.holdTime !== null || this.speed === 0 ? this.holdTime = e : this.driver && (this.startTime = this.driver.now() - e / this.speed);
2252
+ }
2253
+ get speed() {
2254
+ return this.playbackSpeed;
2255
+ }
2256
+ set speed(e) {
2257
+ const n = this.playbackSpeed !== e;
2258
+ this.playbackSpeed = e, n && (this.time = /* @__PURE__ */ H(this.currentTime));
2259
+ }
2260
+ play() {
2261
+ if (this.resolver.isScheduled || this.resolver.resume(), !this._resolved) {
2262
+ this.pendingPlayState = "running";
2263
+ return;
2264
+ }
2265
+ if (this.isStopped)
2266
+ return;
2267
+ const { driver: e = ja, onPlay: n, startTime: s } = this.options;
2268
+ this.driver || (this.driver = e((r) => this.tick(r))), n && n();
2269
+ const i = this.driver.now();
2270
+ this.holdTime !== null ? this.startTime = i - this.holdTime : this.startTime ? this.state === "finished" && (this.startTime = i) : this.startTime = s ?? this.calcStartTime(), this.state === "finished" && this.updateFinishedPromise(), this.cancelTime = this.startTime, this.holdTime = null, this.state = "running", this.driver.start();
2271
+ }
2272
+ pause() {
2273
+ var e;
2274
+ if (!this._resolved) {
2275
+ this.pendingPlayState = "paused";
2276
+ return;
2277
+ }
2278
+ this.state = "paused", this.holdTime = (e = this.currentTime) !== null && e !== void 0 ? e : 0;
2279
+ }
2280
+ complete() {
2281
+ this.state !== "running" && this.play(), this.pendingPlayState = this.state = "finished", this.holdTime = null;
2282
+ }
2283
+ finish() {
2284
+ this.teardown(), this.state = "finished";
2285
+ const { onComplete: e } = this.options;
2286
+ e && e();
2287
+ }
2288
+ cancel() {
2289
+ this.cancelTime !== null && this.tick(this.cancelTime), this.teardown(), this.updateFinishedPromise();
2290
+ }
2291
+ teardown() {
2292
+ this.state = "idle", this.stopDriver(), this.resolveFinishedPromise(), this.updateFinishedPromise(), this.startTime = this.cancelTime = null, this.resolver.cancel();
2293
+ }
2294
+ stopDriver() {
2295
+ this.driver && (this.driver.stop(), this.driver = void 0);
2296
+ }
2297
+ sample(e) {
2298
+ return this.startTime = 0, this.tick(e, !0);
2299
+ }
2300
+ }
2301
+ const Ia = /* @__PURE__ */ new Set([
2302
+ "opacity",
2303
+ "clipPath",
2304
+ "filter",
2305
+ "transform"
2306
+ // TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved
2307
+ // or until we implement support for linear() easing.
2308
+ // "background-color"
2309
+ ]);
2310
+ function Oa(t, e, n, { delay: s = 0, duration: i = 300, repeat: r = 0, repeatType: o = "loop", ease: a = "easeInOut", times: l } = {}) {
2311
+ const u = { [e]: n };
2312
+ l && (u.offset = l);
2313
+ const c = ti(a, i);
2314
+ return Array.isArray(c) && (u.easing = c), t.animate(u, {
2315
+ delay: s,
2316
+ duration: i,
2317
+ easing: Array.isArray(c) ? "linear" : c,
2318
+ fill: "both",
2319
+ iterations: r + 1,
2320
+ direction: o === "reverse" ? "alternate" : "normal"
2321
+ });
2322
+ }
2323
+ const Na = /* @__PURE__ */ Be(() => Object.hasOwnProperty.call(Element.prototype, "animate")), Xt = 10, Ua = 2e4;
2324
+ function _a(t) {
2325
+ return Ye(t.type) || t.type === "spring" || !Js(t.ease);
2326
+ }
2327
+ function Ka(t, e) {
2328
+ const n = new cn({
2329
+ ...e,
2330
+ keyframes: t,
2331
+ repeat: 0,
2332
+ delay: 0,
2333
+ isGenerator: !0
2334
+ });
2335
+ let s = { done: !1, value: t[0] };
2336
+ const i = [];
2337
+ let r = 0;
2338
+ for (; !s.done && r < Ua; )
2339
+ s = n.sample(r), i.push(s.value), r += Xt;
2340
+ return {
2341
+ times: void 0,
2342
+ keyframes: i,
2343
+ duration: r - Xt,
2344
+ ease: "linear"
2345
+ };
2346
+ }
2347
+ const Bi = {
2348
+ anticipate: fi,
2349
+ backInOut: hi,
2350
+ circInOut: mi
2351
+ };
2352
+ function za(t) {
2353
+ return t in Bi;
2354
+ }
2355
+ class In extends Mi {
2356
+ constructor(e) {
2357
+ super(e);
2358
+ const { name: n, motionValue: s, element: i, keyframes: r } = this.options;
2359
+ this.resolver = new Di(r, (o, a) => this.onKeyframesResolved(o, a), n, s, i), this.resolver.scheduleResolve();
2360
+ }
2361
+ initPlayback(e, n) {
2362
+ let { duration: s = 300, times: i, ease: r, type: o, motionValue: a, name: l, startTime: u } = this.options;
2363
+ if (!a.owner || !a.owner.current)
2364
+ return !1;
2365
+ if (typeof r == "string" && $t() && za(r) && (r = Bi[r]), _a(this.options)) {
2366
+ const { onComplete: h, onUpdate: f, motionValue: d, element: m, ...p } = this.options, y = Ka(e, p);
2367
+ e = y.keyframes, e.length === 1 && (e[1] = e[0]), s = y.duration, i = y.times, r = y.ease, o = "keyframes";
2368
+ }
2369
+ const c = Oa(a.owner.current, l, e, { ...this.options, duration: s, times: i, ease: r });
2370
+ return c.startTime = u ?? this.calcStartTime(), this.pendingTimeline ? (Pn(c, this.pendingTimeline), this.pendingTimeline = void 0) : c.onfinish = () => {
2371
+ const { onComplete: h } = this.options;
2372
+ a.set(te(e, this.options, n)), h && h(), this.cancel(), this.resolveFinishedPromise();
2373
+ }, {
2374
+ animation: c,
2375
+ duration: s,
2376
+ times: i,
2377
+ type: o,
2378
+ ease: r,
2379
+ keyframes: e
2380
+ };
2381
+ }
2382
+ get duration() {
2383
+ const { resolved: e } = this;
2384
+ if (!e)
2385
+ return 0;
2386
+ const { duration: n } = e;
2387
+ return /* @__PURE__ */ H(n);
2388
+ }
2389
+ get time() {
2390
+ const { resolved: e } = this;
2391
+ if (!e)
2392
+ return 0;
2393
+ const { animation: n } = e;
2394
+ return /* @__PURE__ */ H(n.currentTime || 0);
2395
+ }
2396
+ set time(e) {
2397
+ const { resolved: n } = this;
2398
+ if (!n)
2399
+ return;
2400
+ const { animation: s } = n;
2401
+ s.currentTime = /* @__PURE__ */ G(e);
2402
+ }
2403
+ get speed() {
2404
+ const { resolved: e } = this;
2405
+ if (!e)
2406
+ return 1;
2407
+ const { animation: n } = e;
2408
+ return n.playbackRate;
2409
+ }
2410
+ set speed(e) {
2411
+ const { resolved: n } = this;
2412
+ if (!n)
2413
+ return;
2414
+ const { animation: s } = n;
2415
+ s.playbackRate = e;
2416
+ }
2417
+ get state() {
2418
+ const { resolved: e } = this;
2419
+ if (!e)
2420
+ return "idle";
2421
+ const { animation: n } = e;
2422
+ return n.playState;
2423
+ }
2424
+ get startTime() {
2425
+ const { resolved: e } = this;
2426
+ if (!e)
2427
+ return null;
2428
+ const { animation: n } = e;
2429
+ return n.startTime;
2430
+ }
2431
+ /**
2432
+ * Replace the default DocumentTimeline with another AnimationTimeline.
2433
+ * Currently used for scroll animations.
2434
+ */
2435
+ attachTimeline(e) {
2436
+ if (!this._resolved)
2437
+ this.pendingTimeline = e;
2438
+ else {
2439
+ const { resolved: n } = this;
2440
+ if (!n)
2441
+ return I;
2442
+ const { animation: s } = n;
2443
+ Pn(s, e);
2444
+ }
2445
+ return I;
2446
+ }
2447
+ play() {
2448
+ if (this.isStopped)
2449
+ return;
2450
+ const { resolved: e } = this;
2451
+ if (!e)
2452
+ return;
2453
+ const { animation: n } = e;
2454
+ n.playState === "finished" && this.updateFinishedPromise(), n.play();
2455
+ }
2456
+ pause() {
2457
+ const { resolved: e } = this;
2458
+ if (!e)
2459
+ return;
2460
+ const { animation: n } = e;
2461
+ n.pause();
2462
+ }
2463
+ stop() {
2464
+ if (this.resolver.cancel(), this.isStopped = !0, this.state === "idle")
2465
+ return;
2466
+ this.resolveFinishedPromise(), this.updateFinishedPromise();
2467
+ const { resolved: e } = this;
2468
+ if (!e)
2469
+ return;
2470
+ const { animation: n, keyframes: s, duration: i, type: r, ease: o, times: a } = e;
2471
+ if (n.playState === "idle" || n.playState === "finished")
2472
+ return;
2473
+ if (this.time) {
2474
+ const { motionValue: u, onUpdate: c, onComplete: h, element: f, ...d } = this.options, m = new cn({
2475
+ ...d,
2476
+ keyframes: s,
2477
+ duration: i,
2478
+ type: r,
2479
+ ease: o,
2480
+ times: a,
2481
+ isGenerator: !0
2482
+ }), p = /* @__PURE__ */ G(this.time);
2483
+ u.setWithVelocity(m.sample(p - Xt).value, m.sample(p).value, Xt);
2484
+ }
2485
+ const { onStop: l } = this.options;
2486
+ l && l(), this.cancel();
2487
+ }
2488
+ complete() {
2489
+ const { resolved: e } = this;
2490
+ e && e.animation.finish();
2491
+ }
2492
+ cancel() {
2493
+ const { resolved: e } = this;
2494
+ e && e.animation.cancel();
2495
+ }
2496
+ static supports(e) {
2497
+ const { motionValue: n, name: s, repeatDelay: i, repeatType: r, damping: o, type: a } = e;
2498
+ if (!n || !n.owner || !(n.owner.current instanceof HTMLElement))
2499
+ return !1;
2500
+ const { onUpdate: l, transformTemplate: u } = n.owner.getProps();
2501
+ return Na() && s && Ia.has(s) && /**
2502
+ * If we're outputting values to onUpdate then we can't use WAAPI as there's
2503
+ * no way to read the value from WAAPI every frame.
2504
+ */
2505
+ !l && !u && !i && r !== "mirror" && o !== 0 && a !== "inertia";
2506
+ }
2507
+ }
2508
+ const Wa = {
2509
+ type: "spring",
2510
+ stiffness: 500,
2511
+ damping: 25,
2512
+ restSpeed: 10
2513
+ }, $a = (t) => ({
2514
+ type: "spring",
2515
+ stiffness: 550,
2516
+ damping: t === 0 ? 2 * Math.sqrt(550) : 30,
2517
+ restSpeed: 10
2518
+ }), Ga = {
2519
+ type: "keyframes",
2520
+ duration: 0.8
2521
+ }, Ha = {
2522
+ type: "keyframes",
2523
+ ease: [0.25, 0.1, 0.35, 1],
2524
+ duration: 0.3
2525
+ }, Xa = (t, { keyframes: e }) => e.length > 2 ? Ga : it.has(t) ? t.startsWith("scale") ? $a(e[1]) : Wa : Ha;
2526
+ function qa({ when: t, delay: e, delayChildren: n, staggerChildren: s, staggerDirection: i, repeat: r, repeatType: o, repeatDelay: a, from: l, elapsed: u, ...c }) {
2527
+ return !!Object.keys(c).length;
2528
+ }
2529
+ const hn = (t, e, n, s = {}, i, r) => (o) => {
2530
+ const a = qe(s, t) || {}, l = a.delay || s.delay || 0;
2531
+ let { elapsed: u = 0 } = s;
2532
+ u = u - /* @__PURE__ */ G(l);
2533
+ let c = {
2534
+ keyframes: Array.isArray(n) ? n : [null, n],
2535
+ ease: "easeOut",
2536
+ velocity: e.getVelocity(),
2537
+ ...a,
2538
+ delay: -u,
2539
+ onUpdate: (f) => {
2540
+ e.set(f), a.onUpdate && a.onUpdate(f);
2541
+ },
2542
+ onComplete: () => {
2543
+ o(), a.onComplete && a.onComplete();
2544
+ },
2545
+ name: t,
2546
+ motionValue: e,
2547
+ element: r ? void 0 : i
2548
+ };
2549
+ qa(a) || (c = {
2550
+ ...c,
2551
+ ...Xa(t, c)
2552
+ }), c.duration && (c.duration = /* @__PURE__ */ G(c.duration)), c.repeatDelay && (c.repeatDelay = /* @__PURE__ */ G(c.repeatDelay)), c.from !== void 0 && (c.keyframes[0] = c.from);
2553
+ let h = !1;
2554
+ if ((c.type === !1 || c.duration === 0 && !c.repeatDelay) && (c.duration = 0, c.delay === 0 && (h = !0)), h && !r && e.get() !== void 0) {
2555
+ const f = te(c.keyframes, a);
2556
+ if (f !== void 0)
2557
+ return C.update(() => {
2558
+ c.onUpdate(f), c.onComplete();
2559
+ }), new mr([]);
2560
+ }
2561
+ return !r && In.supports(c) ? new In(c) : new cn(c);
2562
+ };
2563
+ function Ya({ protectedKeys: t, needsAnimating: e }, n) {
2564
+ const s = t.hasOwnProperty(n) && e[n] !== !0;
2565
+ return e[n] = !1, s;
2566
+ }
2567
+ function ki(t, e, { delay: n = 0, transitionOverride: s, type: i } = {}) {
2568
+ var r;
2569
+ let { transition: o = t.getDefaultTransition(), transitionEnd: a, ...l } = e;
2570
+ s && (o = s);
2571
+ const u = [], c = i && t.animationState && t.animationState.getState()[i];
2572
+ for (const h in l) {
2573
+ const f = t.getValue(h, (r = t.latestValues[h]) !== null && r !== void 0 ? r : null), d = l[h];
2574
+ if (d === void 0 || c && Ya(c, h))
2575
+ continue;
2576
+ const m = {
2577
+ delay: n,
2578
+ ...qe(o || {}, h)
2579
+ };
2580
+ let p = !1;
2581
+ if (window.MotionHandoffAnimation) {
2582
+ const g = ri(t);
2583
+ if (g) {
2584
+ const v = window.MotionHandoffAnimation(g, h, C);
2585
+ v !== null && (m.startTime = v, p = !0);
2586
+ }
2587
+ }
2588
+ xe(t, h), f.start(hn(h, f, d, t.shouldReduceMotion && ii.has(h) ? { type: !1 } : m, t, p));
2589
+ const y = f.animation;
2590
+ y && u.push(y);
2591
+ }
2592
+ return a && Promise.all(u).then(() => {
2593
+ C.update(() => {
2594
+ a && Dr(t, a);
2595
+ });
2596
+ }), u;
2597
+ }
2598
+ function Ve(t, e, n = {}) {
2599
+ var s;
2600
+ const i = Jt(t, e, n.type === "exit" ? (s = t.presenceContext) === null || s === void 0 ? void 0 : s.custom : void 0);
2601
+ let { transition: r = t.getDefaultTransition() || {} } = i || {};
2602
+ n.transitionOverride && (r = n.transitionOverride);
2603
+ const o = i ? () => Promise.all(ki(t, i, n)) : () => Promise.resolve(), a = t.variantChildren && t.variantChildren.size ? (u = 0) => {
2604
+ const { delayChildren: c = 0, staggerChildren: h, staggerDirection: f } = r;
2605
+ return Za(t, e, c + u, h, f, n);
2606
+ } : () => Promise.resolve(), { when: l } = r;
2607
+ if (l) {
2608
+ const [u, c] = l === "beforeChildren" ? [o, a] : [a, o];
2609
+ return u().then(() => c());
2610
+ } else
2611
+ return Promise.all([o(), a(n.delay)]);
2612
+ }
2613
+ function Za(t, e, n = 0, s = 0, i = 1, r) {
2614
+ const o = [], a = (t.variantChildren.size - 1) * s, l = i === 1 ? (u = 0) => u * s : (u = 0) => a - u * s;
2615
+ return Array.from(t.variantChildren).sort(Qa).forEach((u, c) => {
2616
+ u.notify("AnimationStart", e), o.push(Ve(u, e, {
2617
+ ...r,
2618
+ delay: n + l(c)
2619
+ }).then(() => u.notify("AnimationComplete", e)));
2620
+ }), Promise.all(o);
2621
+ }
2622
+ function Qa(t, e) {
2623
+ return t.sortNodePosition(e);
2624
+ }
2625
+ function Ja(t, e, n = {}) {
2626
+ t.notify("AnimationStart", e);
2627
+ let s;
2628
+ if (Array.isArray(e)) {
2629
+ const i = e.map((r) => Ve(t, r, n));
2630
+ s = Promise.all(i);
2631
+ } else if (typeof e == "string")
2632
+ s = Ve(t, e, n);
2633
+ else {
2634
+ const i = typeof e == "function" ? Jt(t, e, n.custom) : e;
2635
+ s = Promise.all(ki(t, i, n));
2636
+ }
2637
+ return s.then(() => {
2638
+ t.notify("AnimationComplete", e);
2639
+ });
2640
+ }
2641
+ const tl = Ie.length;
2642
+ function Ii(t) {
2643
+ if (!t)
2644
+ return;
2645
+ if (!t.isControllingVariants) {
2646
+ const n = t.parent ? Ii(t.parent) || {} : {};
2647
+ return t.props.initial !== void 0 && (n.initial = t.props.initial), n;
2648
+ }
2649
+ const e = {};
2650
+ for (let n = 0; n < tl; n++) {
2651
+ const s = Ie[n], i = t.props[s];
2652
+ (Vt(i) || i === !1) && (e[s] = i);
2653
+ }
2654
+ return e;
2655
+ }
2656
+ const el = [...ke].reverse(), nl = ke.length;
2657
+ function sl(t) {
2658
+ return (e) => Promise.all(e.map(({ animation: n, options: s }) => Ja(t, n, s)));
2659
+ }
2660
+ function il(t) {
2661
+ let e = sl(t), n = On(), s = !0;
2662
+ const i = (l) => (u, c) => {
2663
+ var h;
2664
+ const f = Jt(t, c, l === "exit" ? (h = t.presenceContext) === null || h === void 0 ? void 0 : h.custom : void 0);
2665
+ if (f) {
2666
+ const { transition: d, transitionEnd: m, ...p } = f;
2667
+ u = { ...u, ...p, ...m };
2668
+ }
2669
+ return u;
2670
+ };
2671
+ function r(l) {
2672
+ e = l(t);
2673
+ }
2674
+ function o(l) {
2675
+ const { props: u } = t, c = Ii(t.parent) || {}, h = [], f = /* @__PURE__ */ new Set();
2676
+ let d = {}, m = 1 / 0;
2677
+ for (let y = 0; y < nl; y++) {
2678
+ const g = el[y], v = n[g], T = u[g] !== void 0 ? u[g] : c[g], w = Vt(T), S = g === l ? v.isActive : null;
2679
+ S === !1 && (m = y);
2680
+ let V = T === c[g] && T !== u[g] && w;
2681
+ if (V && s && t.manuallyAnimateOnMount && (V = !1), v.protectedKeys = { ...d }, // If it isn't active and hasn't *just* been set as inactive
2682
+ !v.isActive && S === null || // If we didn't and don't have any defined prop for this animation type
2683
+ !T && !v.prevProp || // Or if the prop doesn't define an animation
2684
+ Zt(T) || typeof T == "boolean")
2685
+ continue;
2686
+ const E = ol(v.prevProp, T);
2687
+ let b = E || // If we're making this variant active, we want to always make it active
2688
+ g === l && v.isActive && !V && w || // If we removed a higher-priority variant (i is in reverse order)
2689
+ y > m && w, k = !1;
2690
+ const N = Array.isArray(T) ? T : [T];
2691
+ let ot = N.reduce(i(g), {});
2692
+ S === !1 && (ot = {});
2693
+ const { prevResolvedValues: fn = {} } = v, io = {
2694
+ ...fn,
2695
+ ...ot
2696
+ }, dn = (B) => {
2697
+ b = !0, f.has(B) && (k = !0, f.delete(B)), v.needsAnimating[B] = !0;
2698
+ const $ = t.getValue(B);
2699
+ $ && ($.liveStyle = !1);
2700
+ };
2701
+ for (const B in io) {
2702
+ const $ = ot[B], ee = fn[B];
2703
+ if (d.hasOwnProperty(B))
2704
+ continue;
2705
+ let ne = !1;
2706
+ ge($) && ge(ee) ? ne = !Ys($, ee) : ne = $ !== ee, ne ? $ != null ? dn(B) : f.add(B) : $ !== void 0 && f.has(B) ? dn(B) : v.protectedKeys[B] = !0;
2707
+ }
2708
+ v.prevProp = T, v.prevResolvedValues = ot, v.isActive && (d = { ...d, ...ot }), s && t.blockInitialAnimation && (b = !1), b && (!(V && E) || k) && h.push(...N.map((B) => ({
2709
+ animation: B,
2710
+ options: { type: g }
2711
+ })));
2712
+ }
2713
+ if (f.size) {
2714
+ const y = {};
2715
+ f.forEach((g) => {
2716
+ const v = t.getBaseTarget(g), T = t.getValue(g);
2717
+ T && (T.liveStyle = !0), y[g] = v ?? null;
2718
+ }), h.push({ animation: y });
2719
+ }
2720
+ let p = !!h.length;
2721
+ return s && (u.initial === !1 || u.initial === u.animate) && !t.manuallyAnimateOnMount && (p = !1), s = !1, p ? e(h) : Promise.resolve();
2722
+ }
2723
+ function a(l, u) {
2724
+ var c;
2725
+ if (n[l].isActive === u)
2726
+ return Promise.resolve();
2727
+ (c = t.variantChildren) === null || c === void 0 || c.forEach((f) => {
2728
+ var d;
2729
+ return (d = f.animationState) === null || d === void 0 ? void 0 : d.setActive(l, u);
2730
+ }), n[l].isActive = u;
2731
+ const h = o(l);
2732
+ for (const f in n)
2733
+ n[f].protectedKeys = {};
2734
+ return h;
2735
+ }
2736
+ return {
2737
+ animateChanges: o,
2738
+ setActive: a,
2739
+ setAnimateFunction: r,
2740
+ getState: () => n,
2741
+ reset: () => {
2742
+ n = On(), s = !0;
2743
+ }
2744
+ };
2745
+ }
2746
+ function ol(t, e) {
2747
+ return typeof e == "string" ? e !== t : Array.isArray(e) ? !Ys(e, t) : !1;
2748
+ }
2749
+ function J(t = !1) {
2750
+ return {
2751
+ isActive: t,
2752
+ protectedKeys: {},
2753
+ needsAnimating: {},
2754
+ prevResolvedValues: {}
2755
+ };
2756
+ }
2757
+ function On() {
2758
+ return {
2759
+ animate: J(!0),
2760
+ whileInView: J(),
2761
+ whileHover: J(),
2762
+ whileTap: J(),
2763
+ whileDrag: J(),
2764
+ whileFocus: J(),
2765
+ exit: J()
2766
+ };
2767
+ }
2768
+ class Q {
2769
+ constructor(e) {
2770
+ this.isMounted = !1, this.node = e;
2771
+ }
2772
+ update() {
2773
+ }
2774
+ }
2775
+ class rl extends Q {
2776
+ /**
2777
+ * We dynamically generate the AnimationState manager as it contains a reference
2778
+ * to the underlying animation library. We only want to load that if we load this,
2779
+ * so people can optionally code split it out using the `m` component.
2780
+ */
2781
+ constructor(e) {
2782
+ super(e), e.animationState || (e.animationState = il(e));
2783
+ }
2784
+ updateAnimationControlsSubscription() {
2785
+ const { animate: e } = this.node.getProps();
2786
+ Zt(e) && (this.unmountControls = e.subscribe(this.node));
2787
+ }
2788
+ /**
2789
+ * Subscribe any provided AnimationControls to the component's VisualElement
2790
+ */
2791
+ mount() {
2792
+ this.updateAnimationControlsSubscription();
2793
+ }
2794
+ update() {
2795
+ const { animate: e } = this.node.getProps(), { animate: n } = this.node.prevProps || {};
2796
+ e !== n && this.updateAnimationControlsSubscription();
2797
+ }
2798
+ unmount() {
2799
+ var e;
2800
+ this.node.animationState.reset(), (e = this.unmountControls) === null || e === void 0 || e.call(this);
2801
+ }
2802
+ }
2803
+ let al = 0;
2804
+ class ll extends Q {
2805
+ constructor() {
2806
+ super(...arguments), this.id = al++;
2807
+ }
2808
+ update() {
2809
+ if (!this.node.presenceContext)
2810
+ return;
2811
+ const { isPresent: e, onExitComplete: n } = this.node.presenceContext, { isPresent: s } = this.node.prevPresenceContext || {};
2812
+ if (!this.node.animationState || e === s)
2813
+ return;
2814
+ const i = this.node.animationState.setActive("exit", !e);
2815
+ n && !e && i.then(() => n(this.id));
2816
+ }
2817
+ mount() {
2818
+ const { register: e } = this.node.presenceContext || {};
2819
+ e && (this.unmount = e(this.id));
2820
+ }
2821
+ unmount() {
2822
+ }
2823
+ }
2824
+ const ul = {
2825
+ animation: {
2826
+ Feature: rl
2827
+ },
2828
+ exit: {
2829
+ Feature: ll
2830
+ }
2831
+ };
2832
+ function Rt(t, e, n, s = { passive: !0 }) {
2833
+ return t.addEventListener(e, n, s), () => t.removeEventListener(e, n);
2834
+ }
2835
+ function jt(t) {
2836
+ return {
2837
+ point: {
2838
+ x: t.pageX,
2839
+ y: t.pageY
2840
+ }
2841
+ };
2842
+ }
2843
+ const cl = (t) => (e) => Qe(e) && t(e, jt(e));
2844
+ function bt(t, e, n, s) {
2845
+ return Rt(t, e, cl(n), s);
2846
+ }
2847
+ const Nn = (t, e) => Math.abs(t - e);
2848
+ function hl(t, e) {
2849
+ const n = Nn(t.x, e.x), s = Nn(t.y, e.y);
2850
+ return Math.sqrt(n ** 2 + s ** 2);
2851
+ }
2852
+ class Oi {
2853
+ constructor(e, n, { transformPagePoint: s, contextWindow: i, dragSnapToOrigin: r = !1 } = {}) {
2854
+ if (this.startEvent = null, this.lastMoveEvent = null, this.lastMoveEventInfo = null, this.handlers = {}, this.contextWindow = window, this.updatePoint = () => {
2855
+ if (!(this.lastMoveEvent && this.lastMoveEventInfo))
2856
+ return;
2857
+ const h = ce(this.lastMoveEventInfo, this.history), f = this.startEvent !== null, d = hl(h.offset, { x: 0, y: 0 }) >= 3;
2858
+ if (!f && !d)
2859
+ return;
2860
+ const { point: m } = h, { timestamp: p } = L;
2861
+ this.history.push({ ...m, timestamp: p });
2862
+ const { onStart: y, onMove: g } = this.handlers;
2863
+ f || (y && y(this.lastMoveEvent, h), this.startEvent = this.lastMoveEvent), g && g(this.lastMoveEvent, h);
2864
+ }, this.handlePointerMove = (h, f) => {
2865
+ this.lastMoveEvent = h, this.lastMoveEventInfo = ue(f, this.transformPagePoint), C.update(this.updatePoint, !0);
2866
+ }, this.handlePointerUp = (h, f) => {
2867
+ this.end();
2868
+ const { onEnd: d, onSessionEnd: m, resumeAnimation: p } = this.handlers;
2869
+ if (this.dragSnapToOrigin && p && p(), !(this.lastMoveEvent && this.lastMoveEventInfo))
2870
+ return;
2871
+ const y = ce(h.type === "pointercancel" ? this.lastMoveEventInfo : ue(f, this.transformPagePoint), this.history);
2872
+ this.startEvent && d && d(h, y), m && m(h, y);
2873
+ }, !Qe(e))
2874
+ return;
2875
+ this.dragSnapToOrigin = r, this.handlers = n, this.transformPagePoint = s, this.contextWindow = i || window;
2876
+ const o = jt(e), a = ue(o, this.transformPagePoint), { point: l } = a, { timestamp: u } = L;
2877
+ this.history = [{ ...l, timestamp: u }];
2878
+ const { onSessionStart: c } = n;
2879
+ c && c(e, ce(a, this.history)), this.removeListeners = Ft(bt(this.contextWindow, "pointermove", this.handlePointerMove), bt(this.contextWindow, "pointerup", this.handlePointerUp), bt(this.contextWindow, "pointercancel", this.handlePointerUp));
2880
+ }
2881
+ updateHandlers(e) {
2882
+ this.handlers = e;
2883
+ }
2884
+ end() {
2885
+ this.removeListeners && this.removeListeners(), Y(this.updatePoint);
2886
+ }
2887
+ }
2888
+ function ue(t, e) {
2889
+ return e ? { point: e(t.point) } : t;
2890
+ }
2891
+ function Un(t, e) {
2892
+ return { x: t.x - e.x, y: t.y - e.y };
2893
+ }
2894
+ function ce({ point: t }, e) {
2895
+ return {
2896
+ point: t,
2897
+ delta: Un(t, Ni(e)),
2898
+ offset: Un(t, fl(e)),
2899
+ velocity: dl(e, 0.1)
2900
+ };
2901
+ }
2902
+ function fl(t) {
2903
+ return t[0];
2904
+ }
2905
+ function Ni(t) {
2906
+ return t[t.length - 1];
2907
+ }
2908
+ function dl(t, e) {
2909
+ if (t.length < 2)
2910
+ return { x: 0, y: 0 };
2911
+ let n = t.length - 1, s = null;
2912
+ const i = Ni(t);
2913
+ for (; n >= 0 && (s = t[n], !(i.timestamp - s.timestamp > /* @__PURE__ */ G(e))); )
2914
+ n--;
2915
+ if (!s)
2916
+ return { x: 0, y: 0 };
2917
+ const r = /* @__PURE__ */ H(i.timestamp - s.timestamp);
2918
+ if (r === 0)
2919
+ return { x: 0, y: 0 };
2920
+ const o = {
2921
+ x: (i.x - s.x) / r,
2922
+ y: (i.y - s.y) / r
2923
+ };
2924
+ return o.x === 1 / 0 && (o.x = 0), o.y === 1 / 0 && (o.y = 0), o;
2925
+ }
2926
+ const Ui = 1e-4, ml = 1 - Ui, pl = 1 + Ui, _i = 0.01, gl = 0 - _i, yl = 0 + _i;
2927
+ function O(t) {
2928
+ return t.max - t.min;
2929
+ }
2930
+ function vl(t, e, n) {
2931
+ return Math.abs(t - e) <= n;
2932
+ }
2933
+ function _n(t, e, n, s = 0.5) {
2934
+ t.origin = s, t.originPoint = D(e.min, e.max, t.origin), t.scale = O(n) / O(e), t.translate = D(n.min, n.max, t.origin) - t.originPoint, (t.scale >= ml && t.scale <= pl || isNaN(t.scale)) && (t.scale = 1), (t.translate >= gl && t.translate <= yl || isNaN(t.translate)) && (t.translate = 0);
2935
+ }
2936
+ function At(t, e, n, s) {
2937
+ _n(t.x, e.x, n.x, s ? s.originX : void 0), _n(t.y, e.y, n.y, s ? s.originY : void 0);
2938
+ }
2939
+ function Kn(t, e, n) {
2940
+ t.min = n.min + e.min, t.max = t.min + O(e);
2941
+ }
2942
+ function xl(t, e, n) {
2943
+ Kn(t.x, e.x, n.x), Kn(t.y, e.y, n.y);
2944
+ }
2945
+ function zn(t, e, n) {
2946
+ t.min = e.min - n.min, t.max = t.min + O(e);
2947
+ }
2948
+ function wt(t, e, n) {
2949
+ zn(t.x, e.x, n.x), zn(t.y, e.y, n.y);
2950
+ }
2951
+ function Tl(t, { min: e, max: n }, s) {
2952
+ return e !== void 0 && t < e ? t = s ? D(e, t, s.min) : Math.max(t, e) : n !== void 0 && t > n && (t = s ? D(n, t, s.max) : Math.min(t, n)), t;
2953
+ }
2954
+ function Wn(t, e, n) {
2955
+ return {
2956
+ min: e !== void 0 ? t.min + e : void 0,
2957
+ max: n !== void 0 ? t.max + n - (t.max - t.min) : void 0
2958
+ };
2959
+ }
2960
+ function Pl(t, { top: e, left: n, bottom: s, right: i }) {
2961
+ return {
2962
+ x: Wn(t.x, n, i),
2963
+ y: Wn(t.y, e, s)
2964
+ };
2965
+ }
2966
+ function $n(t, e) {
2967
+ let n = e.min - t.min, s = e.max - t.max;
2968
+ return e.max - e.min < t.max - t.min && ([n, s] = [s, n]), { min: n, max: s };
2969
+ }
2970
+ function Sl(t, e) {
2971
+ return {
2972
+ x: $n(t.x, e.x),
2973
+ y: $n(t.y, e.y)
2974
+ };
2975
+ }
2976
+ function bl(t, e) {
2977
+ let n = 0.5;
2978
+ const s = O(t), i = O(e);
2979
+ return i > s ? n = /* @__PURE__ */ ft(e.min, e.max - s, t.min) : s > i && (n = /* @__PURE__ */ ft(t.min, t.max - i, e.min)), X(0, 1, n);
2980
+ }
2981
+ function Al(t, e) {
2982
+ const n = {};
2983
+ return e.min !== void 0 && (n.min = e.min - t.min), e.max !== void 0 && (n.max = e.max - t.min), n;
2984
+ }
2985
+ const Ce = 0.35;
2986
+ function wl(t = Ce) {
2987
+ return t === !1 ? t = 0 : t === !0 && (t = Ce), {
2988
+ x: Gn(t, "left", "right"),
2989
+ y: Gn(t, "top", "bottom")
2990
+ };
2991
+ }
2992
+ function Gn(t, e, n) {
2993
+ return {
2994
+ min: Hn(t, e),
2995
+ max: Hn(t, n)
2996
+ };
2997
+ }
2998
+ function Hn(t, e) {
2999
+ return typeof t == "number" ? t : t[e] || 0;
3000
+ }
3001
+ const Xn = () => ({
3002
+ translate: 0,
3003
+ scale: 1,
3004
+ origin: 0,
3005
+ originPoint: 0
3006
+ }), ut = () => ({
3007
+ x: Xn(),
3008
+ y: Xn()
3009
+ }), qn = () => ({ min: 0, max: 0 }), R = () => ({
3010
+ x: qn(),
3011
+ y: qn()
3012
+ });
3013
+ function _(t) {
3014
+ return [t("x"), t("y")];
3015
+ }
3016
+ function Ki({ top: t, left: e, right: n, bottom: s }) {
3017
+ return {
3018
+ x: { min: e, max: n },
3019
+ y: { min: t, max: s }
3020
+ };
3021
+ }
3022
+ function Vl({ x: t, y: e }) {
3023
+ return { top: e.min, right: t.max, bottom: e.max, left: t.min };
3024
+ }
3025
+ function Cl(t, e) {
3026
+ if (!e)
3027
+ return t;
3028
+ const n = e({ x: t.left, y: t.top }), s = e({ x: t.right, y: t.bottom });
3029
+ return {
3030
+ top: n.y,
3031
+ left: n.x,
3032
+ bottom: s.y,
3033
+ right: s.x
3034
+ };
3035
+ }
3036
+ function he(t) {
3037
+ return t === void 0 || t === 1;
3038
+ }
3039
+ function De({ scale: t, scaleX: e, scaleY: n }) {
3040
+ return !he(t) || !he(e) || !he(n);
3041
+ }
3042
+ function tt(t) {
3043
+ return De(t) || zi(t) || t.z || t.rotate || t.rotateX || t.rotateY || t.skewX || t.skewY;
3044
+ }
3045
+ function zi(t) {
3046
+ return Yn(t.x) || Yn(t.y);
3047
+ }
3048
+ function Yn(t) {
3049
+ return t && t !== "0%";
3050
+ }
3051
+ function qt(t, e, n) {
3052
+ const s = t - n, i = e * s;
3053
+ return n + i;
3054
+ }
3055
+ function Zn(t, e, n, s, i) {
3056
+ return i !== void 0 && (t = qt(t, i, s)), qt(t, n, s) + e;
3057
+ }
3058
+ function Me(t, e = 0, n = 1, s, i) {
3059
+ t.min = Zn(t.min, e, n, s, i), t.max = Zn(t.max, e, n, s, i);
3060
+ }
3061
+ function Wi(t, { x: e, y: n }) {
3062
+ Me(t.x, e.translate, e.scale, e.originPoint), Me(t.y, n.translate, n.scale, n.originPoint);
3063
+ }
3064
+ const Qn = 0.999999999999, Jn = 1.0000000000001;
3065
+ function Dl(t, e, n, s = !1) {
3066
+ const i = n.length;
3067
+ if (!i)
3068
+ return;
3069
+ e.x = e.y = 1;
3070
+ let r, o;
3071
+ for (let a = 0; a < i; a++) {
3072
+ r = n[a], o = r.projectionDelta;
3073
+ const { visualElement: l } = r.options;
3074
+ l && l.props.style && l.props.style.display === "contents" || (s && r.options.layoutScroll && r.scroll && r !== r.root && ht(t, {
3075
+ x: -r.scroll.offset.x,
3076
+ y: -r.scroll.offset.y
3077
+ }), o && (e.x *= o.x.scale, e.y *= o.y.scale, Wi(t, o)), s && tt(r.latestValues) && ht(t, r.latestValues));
3078
+ }
3079
+ e.x < Jn && e.x > Qn && (e.x = 1), e.y < Jn && e.y > Qn && (e.y = 1);
3080
+ }
3081
+ function ct(t, e) {
3082
+ t.min = t.min + e, t.max = t.max + e;
3083
+ }
3084
+ function ts(t, e, n, s, i = 0.5) {
3085
+ const r = D(t.min, t.max, i);
3086
+ Me(t, e, n, r, s);
3087
+ }
3088
+ function ht(t, e) {
3089
+ ts(t.x, e.x, e.scaleX, e.scale, e.originX), ts(t.y, e.y, e.scaleY, e.scale, e.originY);
3090
+ }
3091
+ function $i(t, e) {
3092
+ return Ki(Cl(t.getBoundingClientRect(), e));
3093
+ }
3094
+ function Ml(t, e, n) {
3095
+ const s = $i(t, n), { scroll: i } = e;
3096
+ return i && (ct(s.x, i.offset.x), ct(s.y, i.offset.y)), s;
3097
+ }
3098
+ const Gi = ({ current: t }) => t ? t.ownerDocument.defaultView : null, Rl = /* @__PURE__ */ new WeakMap();
3099
+ class El {
3100
+ constructor(e) {
3101
+ this.openDragLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = { x: 0, y: 0 }, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = R(), this.visualElement = e;
3102
+ }
3103
+ start(e, { snapToCursor: n = !1 } = {}) {
3104
+ const { presenceContext: s } = this.visualElement;
3105
+ if (s && s.isPresent === !1)
3106
+ return;
3107
+ const i = (c) => {
3108
+ const { dragSnapToOrigin: h } = this.getProps();
3109
+ h ? this.pauseAnimation() : this.stopAnimation(), n && this.snapToCursor(jt(c).point);
3110
+ }, r = (c, h) => {
3111
+ const { drag: f, dragPropagation: d, onDragStart: m } = this.getProps();
3112
+ if (f && !d && (this.openDragLock && this.openDragLock(), this.openDragLock = br(f), !this.openDragLock))
3113
+ return;
3114
+ this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), _((y) => {
3115
+ let g = this.getAxisMotionValue(y).get() || 0;
3116
+ if (z.test(g)) {
3117
+ const { projection: v } = this.visualElement;
3118
+ if (v && v.layout) {
3119
+ const T = v.layout.layoutBox[y];
3120
+ T && (g = O(T) * (parseFloat(g) / 100));
3121
+ }
3122
+ }
3123
+ this.originPoint[y] = g;
3124
+ }), m && C.postRender(() => m(c, h)), xe(this.visualElement, "transform");
3125
+ const { animationState: p } = this.visualElement;
3126
+ p && p.setActive("whileDrag", !0);
3127
+ }, o = (c, h) => {
3128
+ const { dragPropagation: f, dragDirectionLock: d, onDirectionLock: m, onDrag: p } = this.getProps();
3129
+ if (!f && !this.openDragLock)
3130
+ return;
3131
+ const { offset: y } = h;
3132
+ if (d && this.currentDirection === null) {
3133
+ this.currentDirection = Ll(y), this.currentDirection !== null && m && m(this.currentDirection);
3134
+ return;
3135
+ }
3136
+ this.updateAxis("x", h.point, y), this.updateAxis("y", h.point, y), this.visualElement.render(), p && p(c, h);
3137
+ }, a = (c, h) => this.stop(c, h), l = () => _((c) => {
3138
+ var h;
3139
+ return this.getAnimationState(c) === "paused" && ((h = this.getAxisMotionValue(c).animation) === null || h === void 0 ? void 0 : h.play());
3140
+ }), { dragSnapToOrigin: u } = this.getProps();
3141
+ this.panSession = new Oi(e, {
3142
+ onSessionStart: i,
3143
+ onStart: r,
3144
+ onMove: o,
3145
+ onSessionEnd: a,
3146
+ resumeAnimation: l
3147
+ }, {
3148
+ transformPagePoint: this.visualElement.getTransformPagePoint(),
3149
+ dragSnapToOrigin: u,
3150
+ contextWindow: Gi(this.visualElement)
3151
+ });
3152
+ }
3153
+ stop(e, n) {
3154
+ const s = this.isDragging;
3155
+ if (this.cancel(), !s)
3156
+ return;
3157
+ const { velocity: i } = n;
3158
+ this.startAnimation(i);
3159
+ const { onDragEnd: r } = this.getProps();
3160
+ r && C.postRender(() => r(e, n));
3161
+ }
3162
+ cancel() {
3163
+ this.isDragging = !1;
3164
+ const { projection: e, animationState: n } = this.visualElement;
3165
+ e && (e.isAnimationBlocked = !1), this.panSession && this.panSession.end(), this.panSession = void 0;
3166
+ const { dragPropagation: s } = this.getProps();
3167
+ !s && this.openDragLock && (this.openDragLock(), this.openDragLock = null), n && n.setActive("whileDrag", !1);
3168
+ }
3169
+ updateAxis(e, n, s) {
3170
+ const { drag: i } = this.getProps();
3171
+ if (!s || !Ot(e, i, this.currentDirection))
3172
+ return;
3173
+ const r = this.getAxisMotionValue(e);
3174
+ let o = this.originPoint[e] + s[e];
3175
+ this.constraints && this.constraints[e] && (o = Tl(o, this.constraints[e], this.elastic[e])), r.set(o);
3176
+ }
3177
+ resolveConstraints() {
3178
+ var e;
3179
+ const { dragConstraints: n, dragElastic: s } = this.getProps(), i = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : (e = this.visualElement.projection) === null || e === void 0 ? void 0 : e.layout, r = this.constraints;
3180
+ n && at(n) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : n && i ? this.constraints = Pl(i.layoutBox, n) : this.constraints = !1, this.elastic = wl(s), r !== this.constraints && i && this.constraints && !this.hasMutatedConstraints && _((o) => {
3181
+ this.constraints !== !1 && this.getAxisMotionValue(o) && (this.constraints[o] = Al(i.layoutBox[o], this.constraints[o]));
3182
+ });
3183
+ }
3184
+ resolveRefConstraints() {
3185
+ const { dragConstraints: e, onMeasureDragConstraints: n } = this.getProps();
3186
+ if (!e || !at(e))
3187
+ return !1;
3188
+ const s = e.current, { projection: i } = this.visualElement;
3189
+ if (!i || !i.layout)
3190
+ return !1;
3191
+ const r = Ml(s, i.root, this.visualElement.getTransformPagePoint());
3192
+ let o = Sl(i.layout.layoutBox, r);
3193
+ if (n) {
3194
+ const a = n(Vl(o));
3195
+ this.hasMutatedConstraints = !!a, a && (o = Ki(a));
3196
+ }
3197
+ return o;
3198
+ }
3199
+ startAnimation(e) {
3200
+ const { drag: n, dragMomentum: s, dragElastic: i, dragTransition: r, dragSnapToOrigin: o, onDragTransitionEnd: a } = this.getProps(), l = this.constraints || {}, u = _((c) => {
3201
+ if (!Ot(c, n, this.currentDirection))
3202
+ return;
3203
+ let h = l && l[c] || {};
3204
+ o && (h = { min: 0, max: 0 });
3205
+ const f = i ? 200 : 1e6, d = i ? 40 : 1e7, m = {
3206
+ type: "inertia",
3207
+ velocity: s ? e[c] : 0,
3208
+ bounceStiffness: f,
3209
+ bounceDamping: d,
3210
+ timeConstant: 750,
3211
+ restDelta: 1,
3212
+ restSpeed: 10,
3213
+ ...r,
3214
+ ...h
3215
+ };
3216
+ return this.startAxisValueAnimation(c, m);
3217
+ });
3218
+ return Promise.all(u).then(a);
3219
+ }
3220
+ startAxisValueAnimation(e, n) {
3221
+ const s = this.getAxisMotionValue(e);
3222
+ return xe(this.visualElement, e), s.start(hn(e, s, 0, n, this.visualElement, !1));
3223
+ }
3224
+ stopAnimation() {
3225
+ _((e) => this.getAxisMotionValue(e).stop());
3226
+ }
3227
+ pauseAnimation() {
3228
+ _((e) => {
3229
+ var n;
3230
+ return (n = this.getAxisMotionValue(e).animation) === null || n === void 0 ? void 0 : n.pause();
3231
+ });
3232
+ }
3233
+ getAnimationState(e) {
3234
+ var n;
3235
+ return (n = this.getAxisMotionValue(e).animation) === null || n === void 0 ? void 0 : n.state;
3236
+ }
3237
+ /**
3238
+ * Drag works differently depending on which props are provided.
3239
+ *
3240
+ * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.
3241
+ * - Otherwise, we apply the delta to the x/y motion values.
3242
+ */
3243
+ getAxisMotionValue(e) {
3244
+ const n = `_drag${e.toUpperCase()}`, s = this.visualElement.getProps(), i = s[n];
3245
+ return i || this.visualElement.getValue(e, (s.initial ? s.initial[e] : void 0) || 0);
3246
+ }
3247
+ snapToCursor(e) {
3248
+ _((n) => {
3249
+ const { drag: s } = this.getProps();
3250
+ if (!Ot(n, s, this.currentDirection))
3251
+ return;
3252
+ const { projection: i } = this.visualElement, r = this.getAxisMotionValue(n);
3253
+ if (i && i.layout) {
3254
+ const { min: o, max: a } = i.layout.layoutBox[n];
3255
+ r.set(e[n] - D(o, a, 0.5));
3256
+ }
3257
+ });
3258
+ }
3259
+ /**
3260
+ * When the viewport resizes we want to check if the measured constraints
3261
+ * have changed and, if so, reposition the element within those new constraints
3262
+ * relative to where it was before the resize.
3263
+ */
3264
+ scalePositionWithinConstraints() {
3265
+ if (!this.visualElement.current)
3266
+ return;
3267
+ const { drag: e, dragConstraints: n } = this.getProps(), { projection: s } = this.visualElement;
3268
+ if (!at(n) || !s || !this.constraints)
3269
+ return;
3270
+ this.stopAnimation();
3271
+ const i = { x: 0, y: 0 };
3272
+ _((o) => {
3273
+ const a = this.getAxisMotionValue(o);
3274
+ if (a && this.constraints !== !1) {
3275
+ const l = a.get();
3276
+ i[o] = bl({ min: l, max: l }, this.constraints[o]);
3277
+ }
3278
+ });
3279
+ const { transformTemplate: r } = this.visualElement.getProps();
3280
+ this.visualElement.current.style.transform = r ? r({}, "") : "none", s.root && s.root.updateScroll(), s.updateLayout(), this.resolveConstraints(), _((o) => {
3281
+ if (!Ot(o, e, null))
3282
+ return;
3283
+ const a = this.getAxisMotionValue(o), { min: l, max: u } = this.constraints[o];
3284
+ a.set(D(l, u, i[o]));
3285
+ });
3286
+ }
3287
+ addListeners() {
3288
+ if (!this.visualElement.current)
3289
+ return;
3290
+ Rl.set(this.visualElement, this);
3291
+ const e = this.visualElement.current, n = bt(e, "pointerdown", (l) => {
3292
+ const { drag: u, dragListener: c = !0 } = this.getProps();
3293
+ u && c && this.start(l);
3294
+ }), s = () => {
3295
+ const { dragConstraints: l } = this.getProps();
3296
+ at(l) && l.current && (this.constraints = this.resolveRefConstraints());
3297
+ }, { projection: i } = this.visualElement, r = i.addEventListener("measure", s);
3298
+ i && !i.layout && (i.root && i.root.updateScroll(), i.updateLayout()), C.read(s);
3299
+ const o = Rt(window, "resize", () => this.scalePositionWithinConstraints()), a = i.addEventListener("didUpdate", (({ delta: l, hasLayoutChanged: u }) => {
3300
+ this.isDragging && u && (_((c) => {
3301
+ const h = this.getAxisMotionValue(c);
3302
+ h && (this.originPoint[c] += l[c].translate, h.set(h.get() + l[c].translate));
3303
+ }), this.visualElement.render());
3304
+ }));
3305
+ return () => {
3306
+ o(), n(), r(), a && a();
3307
+ };
3308
+ }
3309
+ getProps() {
3310
+ const e = this.visualElement.getProps(), { drag: n = !1, dragDirectionLock: s = !1, dragPropagation: i = !1, dragConstraints: r = !1, dragElastic: o = Ce, dragMomentum: a = !0 } = e;
3311
+ return {
3312
+ ...e,
3313
+ drag: n,
3314
+ dragDirectionLock: s,
3315
+ dragPropagation: i,
3316
+ dragConstraints: r,
3317
+ dragElastic: o,
3318
+ dragMomentum: a
3319
+ };
3320
+ }
3321
+ }
3322
+ function Ot(t, e, n) {
3323
+ return (e === !0 || e === t) && (n === null || n === t);
3324
+ }
3325
+ function Ll(t, e = 10) {
3326
+ let n = null;
3327
+ return Math.abs(t.y) > e ? n = "y" : Math.abs(t.x) > e && (n = "x"), n;
3328
+ }
3329
+ class Fl extends Q {
3330
+ constructor(e) {
3331
+ super(e), this.removeGroupControls = I, this.removeListeners = I, this.controls = new El(e);
3332
+ }
3333
+ mount() {
3334
+ const { dragControls: e } = this.node.getProps();
3335
+ e && (this.removeGroupControls = e.subscribe(this.controls)), this.removeListeners = this.controls.addListeners() || I;
3336
+ }
3337
+ unmount() {
3338
+ this.removeGroupControls(), this.removeListeners();
3339
+ }
3340
+ }
3341
+ const es = (t) => (e, n) => {
3342
+ t && C.postRender(() => t(e, n));
3343
+ };
3344
+ class jl extends Q {
3345
+ constructor() {
3346
+ super(...arguments), this.removePointerDownListener = I;
3347
+ }
3348
+ onPointerDown(e) {
3349
+ this.session = new Oi(e, this.createPanHandlers(), {
3350
+ transformPagePoint: this.node.getTransformPagePoint(),
3351
+ contextWindow: Gi(this.node)
3352
+ });
3353
+ }
3354
+ createPanHandlers() {
3355
+ const { onPanSessionStart: e, onPanStart: n, onPan: s, onPanEnd: i } = this.node.getProps();
3356
+ return {
3357
+ onSessionStart: es(e),
3358
+ onStart: es(n),
3359
+ onMove: s,
3360
+ onEnd: (r, o) => {
3361
+ delete this.session, i && C.postRender(() => i(r, o));
3362
+ }
3363
+ };
3364
+ }
3365
+ mount() {
3366
+ this.removePointerDownListener = bt(this.node.current, "pointerdown", (e) => this.onPointerDown(e));
3367
+ }
3368
+ update() {
3369
+ this.session && this.session.updateHandlers(this.createPanHandlers());
3370
+ }
3371
+ unmount() {
3372
+ this.removePointerDownListener(), this.session && this.session.end();
3373
+ }
3374
+ }
3375
+ const Kt = {
3376
+ /**
3377
+ * Global flag as to whether the tree has animated since the last time
3378
+ * we resized the window
3379
+ */
3380
+ hasAnimatedSinceResize: !0,
3381
+ /**
3382
+ * We set this to true once, on the first update. Any nodes added to the tree beyond that
3383
+ * update will be given a `data-projection-id` attribute.
3384
+ */
3385
+ hasEverUpdated: !1
3386
+ };
3387
+ function ns(t, e) {
3388
+ return e.max === e.min ? 0 : t / (e.max - e.min) * 100;
3389
+ }
3390
+ const yt = {
3391
+ correct: (t, e) => {
3392
+ if (!e.target)
3393
+ return t;
3394
+ if (typeof t == "string")
3395
+ if (x.test(t))
3396
+ t = parseFloat(t);
3397
+ else
3398
+ return t;
3399
+ const n = ns(t, e.target.x), s = ns(t, e.target.y);
3400
+ return `${n}% ${s}%`;
3401
+ }
3402
+ }, Bl = {
3403
+ correct: (t, { treeScale: e, projectionDelta: n }) => {
3404
+ const s = t, i = Z.parse(t);
3405
+ if (i.length > 5)
3406
+ return s;
3407
+ const r = Z.createTransformer(t), o = typeof i[0] != "number" ? 1 : 0, a = n.x.scale * e.x, l = n.y.scale * e.y;
3408
+ i[0 + o] /= a, i[1 + o] /= l;
3409
+ const u = D(a, l, 0.5);
3410
+ return typeof i[2 + o] == "number" && (i[2 + o] /= u), typeof i[3 + o] == "number" && (i[3 + o] /= u), r(i);
3411
+ }
3412
+ };
3413
+ class kl extends P.Component {
3414
+ /**
3415
+ * This only mounts projection nodes for components that
3416
+ * need measuring, we might want to do it for all components
3417
+ * in order to incorporate transforms
3418
+ */
3419
+ componentDidMount() {
3420
+ const { visualElement: e, layoutGroup: n, switchLayoutGroup: s, layoutId: i } = this.props, { projection: r } = e;
3421
+ nr(Il), r && (n.group && n.group.add(r), s && s.register && i && s.register(r), r.root.didUpdate(), r.addEventListener("animationComplete", () => {
3422
+ this.safeToRemove();
3423
+ }), r.setOptions({
3424
+ ...r.options,
3425
+ onExitComplete: () => this.safeToRemove()
3426
+ })), Kt.hasEverUpdated = !0;
3427
+ }
3428
+ getSnapshotBeforeUpdate(e) {
3429
+ const { layoutDependency: n, visualElement: s, drag: i, isPresent: r } = this.props, o = s.projection;
3430
+ return o && (o.isPresent = r, i || e.layoutDependency !== n || n === void 0 ? o.willUpdate() : this.safeToRemove(), e.isPresent !== r && (r ? o.promote() : o.relegate() || C.postRender(() => {
3431
+ const a = o.getStack();
3432
+ (!a || !a.members.length) && this.safeToRemove();
3433
+ }))), null;
3434
+ }
3435
+ componentDidUpdate() {
3436
+ const { projection: e } = this.props.visualElement;
3437
+ e && (e.root.didUpdate(), Ne.postRender(() => {
3438
+ !e.currentAnimation && e.isLead() && this.safeToRemove();
3439
+ }));
3440
+ }
3441
+ componentWillUnmount() {
3442
+ const { visualElement: e, layoutGroup: n, switchLayoutGroup: s } = this.props, { projection: i } = e;
3443
+ i && (i.scheduleCheckAfterUnmount(), n && n.group && n.group.remove(i), s && s.deregister && s.deregister(i));
3444
+ }
3445
+ safeToRemove() {
3446
+ const { safeToRemove: e } = this.props;
3447
+ e && e();
3448
+ }
3449
+ render() {
3450
+ return null;
3451
+ }
3452
+ }
3453
+ function Hi(t) {
3454
+ const [e, n] = yo(), s = P.useContext(Ms);
3455
+ return A.jsx(kl, { ...t, layoutGroup: s, switchLayoutGroup: P.useContext(Is), isPresent: e, safeToRemove: n });
3456
+ }
3457
+ const Il = {
3458
+ borderRadius: {
3459
+ ...yt,
3460
+ applyTo: [
3461
+ "borderTopLeftRadius",
3462
+ "borderTopRightRadius",
3463
+ "borderBottomLeftRadius",
3464
+ "borderBottomRightRadius"
3465
+ ]
3466
+ },
3467
+ borderTopLeftRadius: yt,
3468
+ borderTopRightRadius: yt,
3469
+ borderBottomLeftRadius: yt,
3470
+ borderBottomRightRadius: yt,
3471
+ boxShadow: Bl
3472
+ };
3473
+ function Ol(t, e, n) {
3474
+ const s = j(t) ? t : Dt(t);
3475
+ return s.start(hn("", s, e, n)), s.animation;
3476
+ }
3477
+ function Nl(t) {
3478
+ return t instanceof SVGElement && t.tagName !== "svg";
3479
+ }
3480
+ const Ul = (t, e) => t.depth - e.depth;
3481
+ class _l {
3482
+ constructor() {
3483
+ this.children = [], this.isDirty = !1;
3484
+ }
3485
+ add(e) {
3486
+ Je(this.children, e), this.isDirty = !0;
3487
+ }
3488
+ remove(e) {
3489
+ tn(this.children, e), this.isDirty = !0;
3490
+ }
3491
+ forEach(e) {
3492
+ this.isDirty && this.children.sort(Ul), this.isDirty = !1, this.children.forEach(e);
3493
+ }
3494
+ }
3495
+ function Kl(t, e) {
3496
+ const n = W.now(), s = ({ timestamp: i }) => {
3497
+ const r = i - n;
3498
+ r >= e && (Y(s), t(r - e));
3499
+ };
3500
+ return C.read(s, !0), () => Y(s);
3501
+ }
3502
+ const Xi = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], zl = Xi.length, ss = (t) => typeof t == "string" ? parseFloat(t) : t, is = (t) => typeof t == "number" || x.test(t);
3503
+ function Wl(t, e, n, s, i, r) {
3504
+ i ? (t.opacity = D(
3505
+ 0,
3506
+ // TODO Reinstate this if only child
3507
+ n.opacity !== void 0 ? n.opacity : 1,
3508
+ $l(s)
3509
+ ), t.opacityExit = D(e.opacity !== void 0 ? e.opacity : 1, 0, Gl(s))) : r && (t.opacity = D(e.opacity !== void 0 ? e.opacity : 1, n.opacity !== void 0 ? n.opacity : 1, s));
3510
+ for (let o = 0; o < zl; o++) {
3511
+ const a = `border${Xi[o]}Radius`;
3512
+ let l = os(e, a), u = os(n, a);
3513
+ if (l === void 0 && u === void 0)
3514
+ continue;
3515
+ l || (l = 0), u || (u = 0), l === 0 || u === 0 || is(l) === is(u) ? (t[a] = Math.max(D(ss(l), ss(u), s), 0), (z.test(u) || z.test(l)) && (t[a] += "%")) : t[a] = u;
3516
+ }
3517
+ (e.rotate || n.rotate) && (t.rotate = D(e.rotate || 0, n.rotate || 0, s));
3518
+ }
3519
+ function os(t, e) {
3520
+ return t[e] !== void 0 ? t[e] : t.borderRadius;
3521
+ }
3522
+ const $l = /* @__PURE__ */ qi(0, 0.5, di), Gl = /* @__PURE__ */ qi(0.5, 0.95, I);
3523
+ function qi(t, e, n) {
3524
+ return (s) => s < t ? 0 : s > e ? 1 : n(/* @__PURE__ */ ft(t, e, s));
3525
+ }
3526
+ function rs(t, e) {
3527
+ t.min = e.min, t.max = e.max;
3528
+ }
3529
+ function U(t, e) {
3530
+ rs(t.x, e.x), rs(t.y, e.y);
3531
+ }
3532
+ function as(t, e) {
3533
+ t.translate = e.translate, t.scale = e.scale, t.originPoint = e.originPoint, t.origin = e.origin;
3534
+ }
3535
+ function ls(t, e, n, s, i) {
3536
+ return t -= e, t = qt(t, 1 / n, s), i !== void 0 && (t = qt(t, 1 / i, s)), t;
3537
+ }
3538
+ function Hl(t, e = 0, n = 1, s = 0.5, i, r = t, o = t) {
3539
+ if (z.test(e) && (e = parseFloat(e), e = D(o.min, o.max, e / 100) - o.min), typeof e != "number")
3540
+ return;
3541
+ let a = D(r.min, r.max, s);
3542
+ t === r && (a -= e), t.min = ls(t.min, e, n, a, i), t.max = ls(t.max, e, n, a, i);
3543
+ }
3544
+ function us(t, e, [n, s, i], r, o) {
3545
+ Hl(t, e[n], e[s], e[i], e.scale, r, o);
3546
+ }
3547
+ const Xl = ["x", "scaleX", "originX"], ql = ["y", "scaleY", "originY"];
3548
+ function cs(t, e, n, s) {
3549
+ us(t.x, e, Xl, n ? n.x : void 0, s ? s.x : void 0), us(t.y, e, ql, n ? n.y : void 0, s ? s.y : void 0);
3550
+ }
3551
+ function hs(t) {
3552
+ return t.translate === 0 && t.scale === 1;
3553
+ }
3554
+ function Yi(t) {
3555
+ return hs(t.x) && hs(t.y);
3556
+ }
3557
+ function fs(t, e) {
3558
+ return t.min === e.min && t.max === e.max;
3559
+ }
3560
+ function Yl(t, e) {
3561
+ return fs(t.x, e.x) && fs(t.y, e.y);
3562
+ }
3563
+ function ds(t, e) {
3564
+ return Math.round(t.min) === Math.round(e.min) && Math.round(t.max) === Math.round(e.max);
3565
+ }
3566
+ function Zi(t, e) {
3567
+ return ds(t.x, e.x) && ds(t.y, e.y);
3568
+ }
3569
+ function ms(t) {
3570
+ return O(t.x) / O(t.y);
3571
+ }
3572
+ function ps(t, e) {
3573
+ return t.translate === e.translate && t.scale === e.scale && t.originPoint === e.originPoint;
3574
+ }
3575
+ class Zl {
3576
+ constructor() {
3577
+ this.members = [];
3578
+ }
3579
+ add(e) {
3580
+ Je(this.members, e), e.scheduleRender();
3581
+ }
3582
+ remove(e) {
3583
+ if (tn(this.members, e), e === this.prevLead && (this.prevLead = void 0), e === this.lead) {
3584
+ const n = this.members[this.members.length - 1];
3585
+ n && this.promote(n);
3586
+ }
3587
+ }
3588
+ relegate(e) {
3589
+ const n = this.members.findIndex((i) => e === i);
3590
+ if (n === 0)
3591
+ return !1;
3592
+ let s;
3593
+ for (let i = n; i >= 0; i--) {
3594
+ const r = this.members[i];
3595
+ if (r.isPresent !== !1) {
3596
+ s = r;
3597
+ break;
3598
+ }
3599
+ }
3600
+ return s ? (this.promote(s), !0) : !1;
3601
+ }
3602
+ promote(e, n) {
3603
+ const s = this.lead;
3604
+ if (e !== s && (this.prevLead = s, this.lead = e, e.show(), s)) {
3605
+ s.instance && s.scheduleRender(), e.scheduleRender(), e.resumeFrom = s, n && (e.resumeFrom.preserveOpacity = !0), s.snapshot && (e.snapshot = s.snapshot, e.snapshot.latestValues = s.animationValues || s.latestValues), e.root && e.root.isUpdating && (e.isLayoutDirty = !0);
3606
+ const { crossfade: i } = e.options;
3607
+ i === !1 && s.hide();
3608
+ }
3609
+ }
3610
+ exitAnimationComplete() {
3611
+ this.members.forEach((e) => {
3612
+ const { options: n, resumingFrom: s } = e;
3613
+ n.onExitComplete && n.onExitComplete(), s && s.options.onExitComplete && s.options.onExitComplete();
3614
+ });
3615
+ }
3616
+ scheduleRender() {
3617
+ this.members.forEach((e) => {
3618
+ e.instance && e.scheduleRender(!1);
3619
+ });
3620
+ }
3621
+ /**
3622
+ * Clear any leads that have been removed this render to prevent them from being
3623
+ * used in future animations and to prevent memory leaks
3624
+ */
3625
+ removeLeadSnapshot() {
3626
+ this.lead && this.lead.snapshot && (this.lead.snapshot = void 0);
3627
+ }
3628
+ }
3629
+ function Ql(t, e, n) {
3630
+ let s = "";
3631
+ const i = t.x.translate / e.x, r = t.y.translate / e.y, o = (n == null ? void 0 : n.z) || 0;
3632
+ if ((i || r || o) && (s = `translate3d(${i}px, ${r}px, ${o}px) `), (e.x !== 1 || e.y !== 1) && (s += `scale(${1 / e.x}, ${1 / e.y}) `), n) {
3633
+ const { transformPerspective: u, rotate: c, rotateX: h, rotateY: f, skewX: d, skewY: m } = n;
3634
+ u && (s = `perspective(${u}px) ${s}`), c && (s += `rotate(${c}deg) `), h && (s += `rotateX(${h}deg) `), f && (s += `rotateY(${f}deg) `), d && (s += `skewX(${d}deg) `), m && (s += `skewY(${m}deg) `);
3635
+ }
3636
+ const a = t.x.scale * e.x, l = t.y.scale * e.y;
3637
+ return (a !== 1 || l !== 1) && (s += `scale(${a}, ${l})`), s || "none";
3638
+ }
3639
+ const et = {
3640
+ type: "projectionFrame",
3641
+ totalNodes: 0,
3642
+ resolvedTargetDeltas: 0,
3643
+ recalculatedProjection: 0
3644
+ }, Pt = typeof window < "u" && window.MotionDebug !== void 0, fe = ["", "X", "Y", "Z"], Jl = { visibility: "hidden" }, gs = 1e3;
3645
+ let tu = 0;
3646
+ function de(t, e, n, s) {
3647
+ const { latestValues: i } = e;
3648
+ i[t] && (n[t] = i[t], e.setStaticValue(t, 0), s && (s[t] = 0));
3649
+ }
3650
+ function Qi(t) {
3651
+ if (t.hasCheckedOptimisedAppear = !0, t.root === t)
3652
+ return;
3653
+ const { visualElement: e } = t.options;
3654
+ if (!e)
3655
+ return;
3656
+ const n = ri(e);
3657
+ if (window.MotionHasOptimisedAnimation(n, "transform")) {
3658
+ const { layout: i, layoutId: r } = t.options;
3659
+ window.MotionCancelOptimisedAnimation(n, "transform", C, !(i || r));
3660
+ }
3661
+ const { parent: s } = t;
3662
+ s && !s.hasCheckedOptimisedAppear && Qi(s);
3663
+ }
3664
+ function Ji({ attachResizeListener: t, defaultParent: e, measureScroll: n, checkIsScrollRoot: s, resetTransform: i }) {
3665
+ return class {
3666
+ constructor(o = {}, a = e == null ? void 0 : e()) {
3667
+ this.id = tu++, this.animationId = 0, this.children = /* @__PURE__ */ new Set(), this.options = {}, this.isTreeAnimating = !1, this.isAnimationBlocked = !1, this.isLayoutDirty = !1, this.isProjectionDirty = !1, this.isSharedProjectionDirty = !1, this.isTransformDirty = !1, this.updateManuallyBlocked = !1, this.updateBlockedByResize = !1, this.isUpdating = !1, this.isSVG = !1, this.needsReset = !1, this.shouldResetTransform = !1, this.hasCheckedOptimisedAppear = !1, this.treeScale = { x: 1, y: 1 }, this.eventHandlers = /* @__PURE__ */ new Map(), this.hasTreeAnimated = !1, this.updateScheduled = !1, this.scheduleUpdate = () => this.update(), this.projectionUpdateScheduled = !1, this.checkUpdateFailed = () => {
3668
+ this.isUpdating && (this.isUpdating = !1, this.clearAllSnapshots());
3669
+ }, this.updateProjection = () => {
3670
+ this.projectionUpdateScheduled = !1, Pt && (et.totalNodes = et.resolvedTargetDeltas = et.recalculatedProjection = 0), this.nodes.forEach(su), this.nodes.forEach(lu), this.nodes.forEach(uu), this.nodes.forEach(iu), Pt && window.MotionDebug.record(et);
3671
+ }, this.resolvedRelativeTargetAt = 0, this.hasProjected = !1, this.isVisible = !0, this.animationProgress = 0, this.sharedNodes = /* @__PURE__ */ new Map(), this.latestValues = o, this.root = a ? a.root || a : this, this.path = a ? [...a.path, a] : [], this.parent = a, this.depth = a ? a.depth + 1 : 0;
3672
+ for (let l = 0; l < this.path.length; l++)
3673
+ this.path[l].shouldResetTransform = !0;
3674
+ this.root === this && (this.nodes = new _l());
3675
+ }
3676
+ addEventListener(o, a) {
3677
+ return this.eventHandlers.has(o) || this.eventHandlers.set(o, new en()), this.eventHandlers.get(o).add(a);
3678
+ }
3679
+ notifyListeners(o, ...a) {
3680
+ const l = this.eventHandlers.get(o);
3681
+ l && l.notify(...a);
3682
+ }
3683
+ hasListeners(o) {
3684
+ return this.eventHandlers.has(o);
3685
+ }
3686
+ /**
3687
+ * Lifecycles
3688
+ */
3689
+ mount(o, a = this.root.hasTreeAnimated) {
3690
+ if (this.instance)
3691
+ return;
3692
+ this.isSVG = Nl(o), this.instance = o;
3693
+ const { layoutId: l, layout: u, visualElement: c } = this.options;
3694
+ if (c && !c.current && c.mount(o), this.root.nodes.add(this), this.parent && this.parent.children.add(this), a && (u || l) && (this.isLayoutDirty = !0), t) {
3695
+ let h;
3696
+ const f = () => this.root.updateBlockedByResize = !1;
3697
+ t(o, () => {
3698
+ this.root.updateBlockedByResize = !0, h && h(), h = Kl(f, 250), Kt.hasAnimatedSinceResize && (Kt.hasAnimatedSinceResize = !1, this.nodes.forEach(vs));
3699
+ });
3700
+ }
3701
+ l && this.root.registerSharedNode(l, this), this.options.animate !== !1 && c && (l || u) && this.addEventListener("didUpdate", ({ delta: h, hasLayoutChanged: f, hasRelativeTargetChanged: d, layout: m }) => {
3702
+ if (this.isTreeAnimationBlocked()) {
3703
+ this.target = void 0, this.relativeTarget = void 0;
3704
+ return;
3705
+ }
3706
+ const p = this.options.transition || c.getDefaultTransition() || mu, { onLayoutAnimationStart: y, onLayoutAnimationComplete: g } = c.getProps(), v = !this.targetLayout || !Zi(this.targetLayout, m) || d, T = !f && d;
3707
+ if (this.options.layoutRoot || this.resumeFrom && this.resumeFrom.instance || T || f && (v || !this.currentAnimation)) {
3708
+ this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0), this.setAnimationOrigin(h, T);
3709
+ const w = {
3710
+ ...qe(p, "layout"),
3711
+ onPlay: y,
3712
+ onComplete: g
3713
+ };
3714
+ (c.shouldReduceMotion || this.options.layoutRoot) && (w.delay = 0, w.type = !1), this.startAnimation(w);
3715
+ } else
3716
+ f || vs(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete();
3717
+ this.targetLayout = m;
3718
+ });
3719
+ }
3720
+ unmount() {
3721
+ this.options.layoutId && this.willUpdate(), this.root.nodes.remove(this);
3722
+ const o = this.getStack();
3723
+ o && o.remove(this), this.parent && this.parent.children.delete(this), this.instance = void 0, Y(this.updateProjection);
3724
+ }
3725
+ // only on the root
3726
+ blockUpdate() {
3727
+ this.updateManuallyBlocked = !0;
3728
+ }
3729
+ unblockUpdate() {
3730
+ this.updateManuallyBlocked = !1;
3731
+ }
3732
+ isUpdateBlocked() {
3733
+ return this.updateManuallyBlocked || this.updateBlockedByResize;
3734
+ }
3735
+ isTreeAnimationBlocked() {
3736
+ return this.isAnimationBlocked || this.parent && this.parent.isTreeAnimationBlocked() || !1;
3737
+ }
3738
+ // Note: currently only running on root node
3739
+ startUpdate() {
3740
+ this.isUpdateBlocked() || (this.isUpdating = !0, this.nodes && this.nodes.forEach(cu), this.animationId++);
3741
+ }
3742
+ getTransformTemplate() {
3743
+ const { visualElement: o } = this.options;
3744
+ return o && o.getProps().transformTemplate;
3745
+ }
3746
+ willUpdate(o = !0) {
3747
+ if (this.root.hasTreeAnimated = !0, this.root.isUpdateBlocked()) {
3748
+ this.options.onExitComplete && this.options.onExitComplete();
3749
+ return;
3750
+ }
3751
+ if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear && Qi(this), !this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty)
3752
+ return;
3753
+ this.isLayoutDirty = !0;
3754
+ for (let c = 0; c < this.path.length; c++) {
3755
+ const h = this.path[c];
3756
+ h.shouldResetTransform = !0, h.updateScroll("snapshot"), h.options.layoutRoot && h.willUpdate(!1);
3757
+ }
3758
+ const { layoutId: a, layout: l } = this.options;
3759
+ if (a === void 0 && !l)
3760
+ return;
3761
+ const u = this.getTransformTemplate();
3762
+ this.prevTransformTemplateValue = u ? u(this.latestValues, "") : void 0, this.updateSnapshot(), o && this.notifyListeners("willUpdate");
3763
+ }
3764
+ update() {
3765
+ if (this.updateScheduled = !1, this.isUpdateBlocked()) {
3766
+ this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(ys);
3767
+ return;
3768
+ }
3769
+ this.isUpdating || this.nodes.forEach(ru), this.isUpdating = !1, this.nodes.forEach(au), this.nodes.forEach(eu), this.nodes.forEach(nu), this.clearAllSnapshots();
3770
+ const a = W.now();
3771
+ L.delta = X(0, 1e3 / 60, a - L.timestamp), L.timestamp = a, L.isProcessing = !0, se.update.process(L), se.preRender.process(L), se.render.process(L), L.isProcessing = !1;
3772
+ }
3773
+ didUpdate() {
3774
+ this.updateScheduled || (this.updateScheduled = !0, Ne.read(this.scheduleUpdate));
3775
+ }
3776
+ clearAllSnapshots() {
3777
+ this.nodes.forEach(ou), this.sharedNodes.forEach(hu);
3778
+ }
3779
+ scheduleUpdateProjection() {
3780
+ this.projectionUpdateScheduled || (this.projectionUpdateScheduled = !0, C.preRender(this.updateProjection, !1, !0));
3781
+ }
3782
+ scheduleCheckAfterUnmount() {
3783
+ C.postRender(() => {
3784
+ this.isLayoutDirty ? this.root.didUpdate() : this.root.checkUpdateFailed();
3785
+ });
3786
+ }
3787
+ /**
3788
+ * Update measurements
3789
+ */
3790
+ updateSnapshot() {
3791
+ this.snapshot || !this.instance || (this.snapshot = this.measure());
3792
+ }
3793
+ updateLayout() {
3794
+ if (!this.instance || (this.updateScroll(), !(this.options.alwaysMeasureLayout && this.isLead()) && !this.isLayoutDirty))
3795
+ return;
3796
+ if (this.resumeFrom && !this.resumeFrom.instance)
3797
+ for (let l = 0; l < this.path.length; l++)
3798
+ this.path[l].updateScroll();
3799
+ const o = this.layout;
3800
+ this.layout = this.measure(!1), this.layoutCorrected = R(), this.isLayoutDirty = !1, this.projectionDelta = void 0, this.notifyListeners("measure", this.layout.layoutBox);
3801
+ const { visualElement: a } = this.options;
3802
+ a && a.notify("LayoutMeasure", this.layout.layoutBox, o ? o.layoutBox : void 0);
3803
+ }
3804
+ updateScroll(o = "measure") {
3805
+ let a = !!(this.options.layoutScroll && this.instance);
3806
+ if (this.scroll && this.scroll.animationId === this.root.animationId && this.scroll.phase === o && (a = !1), a) {
3807
+ const l = s(this.instance);
3808
+ this.scroll = {
3809
+ animationId: this.root.animationId,
3810
+ phase: o,
3811
+ isRoot: l,
3812
+ offset: n(this.instance),
3813
+ wasRoot: this.scroll ? this.scroll.isRoot : l
3814
+ };
3815
+ }
3816
+ }
3817
+ resetTransform() {
3818
+ if (!i)
3819
+ return;
3820
+ const o = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout, a = this.projectionDelta && !Yi(this.projectionDelta), l = this.getTransformTemplate(), u = l ? l(this.latestValues, "") : void 0, c = u !== this.prevTransformTemplateValue;
3821
+ o && (a || tt(this.latestValues) || c) && (i(this.instance, u), this.shouldResetTransform = !1, this.scheduleRender());
3822
+ }
3823
+ measure(o = !0) {
3824
+ const a = this.measurePageBox();
3825
+ let l = this.removeElementScroll(a);
3826
+ return o && (l = this.removeTransform(l)), pu(l), {
3827
+ animationId: this.root.animationId,
3828
+ measuredBox: a,
3829
+ layoutBox: l,
3830
+ latestValues: {},
3831
+ source: this.id
3832
+ };
3833
+ }
3834
+ measurePageBox() {
3835
+ var o;
3836
+ const { visualElement: a } = this.options;
3837
+ if (!a)
3838
+ return R();
3839
+ const l = a.measureViewportBox();
3840
+ if (!(((o = this.scroll) === null || o === void 0 ? void 0 : o.wasRoot) || this.path.some(gu))) {
3841
+ const { scroll: c } = this.root;
3842
+ c && (ct(l.x, c.offset.x), ct(l.y, c.offset.y));
3843
+ }
3844
+ return l;
3845
+ }
3846
+ removeElementScroll(o) {
3847
+ var a;
3848
+ const l = R();
3849
+ if (U(l, o), !((a = this.scroll) === null || a === void 0) && a.wasRoot)
3850
+ return l;
3851
+ for (let u = 0; u < this.path.length; u++) {
3852
+ const c = this.path[u], { scroll: h, options: f } = c;
3853
+ c !== this.root && h && f.layoutScroll && (h.wasRoot && U(l, o), ct(l.x, h.offset.x), ct(l.y, h.offset.y));
3854
+ }
3855
+ return l;
3856
+ }
3857
+ applyTransform(o, a = !1) {
3858
+ const l = R();
3859
+ U(l, o);
3860
+ for (let u = 0; u < this.path.length; u++) {
3861
+ const c = this.path[u];
3862
+ !a && c.options.layoutScroll && c.scroll && c !== c.root && ht(l, {
3863
+ x: -c.scroll.offset.x,
3864
+ y: -c.scroll.offset.y
3865
+ }), tt(c.latestValues) && ht(l, c.latestValues);
3866
+ }
3867
+ return tt(this.latestValues) && ht(l, this.latestValues), l;
3868
+ }
3869
+ removeTransform(o) {
3870
+ const a = R();
3871
+ U(a, o);
3872
+ for (let l = 0; l < this.path.length; l++) {
3873
+ const u = this.path[l];
3874
+ if (!u.instance || !tt(u.latestValues))
3875
+ continue;
3876
+ De(u.latestValues) && u.updateSnapshot();
3877
+ const c = R(), h = u.measurePageBox();
3878
+ U(c, h), cs(a, u.latestValues, u.snapshot ? u.snapshot.layoutBox : void 0, c);
3879
+ }
3880
+ return tt(this.latestValues) && cs(a, this.latestValues), a;
3881
+ }
3882
+ setTargetDelta(o) {
3883
+ this.targetDelta = o, this.root.scheduleUpdateProjection(), this.isProjectionDirty = !0;
3884
+ }
3885
+ setOptions(o) {
3886
+ this.options = {
3887
+ ...this.options,
3888
+ ...o,
3889
+ crossfade: o.crossfade !== void 0 ? o.crossfade : !0
3890
+ };
3891
+ }
3892
+ clearMeasurements() {
3893
+ this.scroll = void 0, this.layout = void 0, this.snapshot = void 0, this.prevTransformTemplateValue = void 0, this.targetDelta = void 0, this.target = void 0, this.isLayoutDirty = !1;
3894
+ }
3895
+ forceRelativeParentToResolveTarget() {
3896
+ this.relativeParent && this.relativeParent.resolvedRelativeTargetAt !== L.timestamp && this.relativeParent.resolveTargetDelta(!0);
3897
+ }
3898
+ resolveTargetDelta(o = !1) {
3899
+ var a;
3900
+ const l = this.getLead();
3901
+ this.isProjectionDirty || (this.isProjectionDirty = l.isProjectionDirty), this.isTransformDirty || (this.isTransformDirty = l.isTransformDirty), this.isSharedProjectionDirty || (this.isSharedProjectionDirty = l.isSharedProjectionDirty);
3902
+ const u = !!this.resumingFrom || this !== l;
3903
+ if (!(o || u && this.isSharedProjectionDirty || this.isProjectionDirty || !((a = this.parent) === null || a === void 0) && a.isProjectionDirty || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize))
3904
+ return;
3905
+ const { layout: h, layoutId: f } = this.options;
3906
+ if (!(!this.layout || !(h || f))) {
3907
+ if (this.resolvedRelativeTargetAt = L.timestamp, !this.targetDelta && !this.relativeTarget) {
3908
+ const d = this.getClosestProjectingParent();
3909
+ d && d.layout && this.animationProgress !== 1 ? (this.relativeParent = d, this.forceRelativeParentToResolveTarget(), this.relativeTarget = R(), this.relativeTargetOrigin = R(), wt(this.relativeTargetOrigin, this.layout.layoutBox, d.layout.layoutBox), U(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0;
3910
+ }
3911
+ if (!(!this.relativeTarget && !this.targetDelta)) {
3912
+ if (this.target || (this.target = R(), this.targetWithTransforms = R()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), xl(this.target, this.relativeTarget, this.relativeParent.target)) : this.targetDelta ? (this.resumingFrom ? this.target = this.applyTransform(this.layout.layoutBox) : U(this.target, this.layout.layoutBox), Wi(this.target, this.targetDelta)) : U(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget) {
3913
+ this.attemptToResolveRelativeTarget = !1;
3914
+ const d = this.getClosestProjectingParent();
3915
+ d && !!d.resumingFrom == !!this.resumingFrom && !d.options.layoutScroll && d.target && this.animationProgress !== 1 ? (this.relativeParent = d, this.forceRelativeParentToResolveTarget(), this.relativeTarget = R(), this.relativeTargetOrigin = R(), wt(this.relativeTargetOrigin, this.target, d.target), U(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0;
3916
+ }
3917
+ Pt && et.resolvedTargetDeltas++;
3918
+ }
3919
+ }
3920
+ }
3921
+ getClosestProjectingParent() {
3922
+ if (!(!this.parent || De(this.parent.latestValues) || zi(this.parent.latestValues)))
3923
+ return this.parent.isProjecting() ? this.parent : this.parent.getClosestProjectingParent();
3924
+ }
3925
+ isProjecting() {
3926
+ return !!((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
3927
+ }
3928
+ calcProjection() {
3929
+ var o;
3930
+ const a = this.getLead(), l = !!this.resumingFrom || this !== a;
3931
+ let u = !0;
3932
+ if ((this.isProjectionDirty || !((o = this.parent) === null || o === void 0) && o.isProjectionDirty) && (u = !1), l && (this.isSharedProjectionDirty || this.isTransformDirty) && (u = !1), this.resolvedRelativeTargetAt === L.timestamp && (u = !1), u)
3933
+ return;
3934
+ const { layout: c, layoutId: h } = this.options;
3935
+ if (this.isTreeAnimating = !!(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation), this.isTreeAnimating || (this.targetDelta = this.relativeTarget = void 0), !this.layout || !(c || h))
3936
+ return;
3937
+ U(this.layoutCorrected, this.layout.layoutBox);
3938
+ const f = this.treeScale.x, d = this.treeScale.y;
3939
+ Dl(this.layoutCorrected, this.treeScale, this.path, l), a.layout && !a.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1) && (a.target = a.layout.layoutBox, a.targetWithTransforms = R());
3940
+ const { target: m } = a;
3941
+ if (!m) {
3942
+ this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender());
3943
+ return;
3944
+ }
3945
+ !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (as(this.prevProjectionDelta.x, this.projectionDelta.x), as(this.prevProjectionDelta.y, this.projectionDelta.y)), At(this.projectionDelta, this.layoutCorrected, m, this.latestValues), (this.treeScale.x !== f || this.treeScale.y !== d || !ps(this.projectionDelta.x, this.prevProjectionDelta.x) || !ps(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", m)), Pt && et.recalculatedProjection++;
3946
+ }
3947
+ hide() {
3948
+ this.isVisible = !1;
3949
+ }
3950
+ show() {
3951
+ this.isVisible = !0;
3952
+ }
3953
+ scheduleRender(o = !0) {
3954
+ var a;
3955
+ if ((a = this.options.visualElement) === null || a === void 0 || a.scheduleRender(), o) {
3956
+ const l = this.getStack();
3957
+ l && l.scheduleRender();
3958
+ }
3959
+ this.resumingFrom && !this.resumingFrom.instance && (this.resumingFrom = void 0);
3960
+ }
3961
+ createProjectionDeltas() {
3962
+ this.prevProjectionDelta = ut(), this.projectionDelta = ut(), this.projectionDeltaWithTransform = ut();
3963
+ }
3964
+ setAnimationOrigin(o, a = !1) {
3965
+ const l = this.snapshot, u = l ? l.latestValues : {}, c = { ...this.latestValues }, h = ut();
3966
+ (!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !a;
3967
+ const f = R(), d = l ? l.source : void 0, m = this.layout ? this.layout.source : void 0, p = d !== m, y = this.getStack(), g = !y || y.members.length <= 1, v = !!(p && !g && this.options.crossfade === !0 && !this.path.some(du));
3968
+ this.animationProgress = 0;
3969
+ let T;
3970
+ this.mixTargetDelta = (w) => {
3971
+ const S = w / 1e3;
3972
+ xs(h.x, o.x, S), xs(h.y, o.y, S), this.setTargetDelta(h), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (wt(f, this.layout.layoutBox, this.relativeParent.layout.layoutBox), fu(this.relativeTarget, this.relativeTargetOrigin, f, S), T && Yl(this.relativeTarget, T) && (this.isProjectionDirty = !1), T || (T = R()), U(T, this.relativeTarget)), p && (this.animationValues = c, Wl(c, u, this.latestValues, S, v, g)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = S;
3973
+ }, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0);
3974
+ }
3975
+ startAnimation(o) {
3976
+ this.notifyListeners("animationStart"), this.currentAnimation && this.currentAnimation.stop(), this.resumingFrom && this.resumingFrom.currentAnimation && this.resumingFrom.currentAnimation.stop(), this.pendingAnimation && (Y(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = C.update(() => {
3977
+ Kt.hasAnimatedSinceResize = !0, this.currentAnimation = Ol(0, gs, {
3978
+ ...o,
3979
+ onUpdate: (a) => {
3980
+ this.mixTargetDelta(a), o.onUpdate && o.onUpdate(a);
3981
+ },
3982
+ onComplete: () => {
3983
+ o.onComplete && o.onComplete(), this.completeAnimation();
3984
+ }
3985
+ }), this.resumingFrom && (this.resumingFrom.currentAnimation = this.currentAnimation), this.pendingAnimation = void 0;
3986
+ });
3987
+ }
3988
+ completeAnimation() {
3989
+ this.resumingFrom && (this.resumingFrom.currentAnimation = void 0, this.resumingFrom.preserveOpacity = void 0);
3990
+ const o = this.getStack();
3991
+ o && o.exitAnimationComplete(), this.resumingFrom = this.currentAnimation = this.animationValues = void 0, this.notifyListeners("animationComplete");
3992
+ }
3993
+ finishAnimation() {
3994
+ this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(gs), this.currentAnimation.stop()), this.completeAnimation();
3995
+ }
3996
+ applyTransformsToTarget() {
3997
+ const o = this.getLead();
3998
+ let { targetWithTransforms: a, target: l, layout: u, latestValues: c } = o;
3999
+ if (!(!a || !l || !u)) {
4000
+ if (this !== o && this.layout && u && to(this.options.animationType, this.layout.layoutBox, u.layoutBox)) {
4001
+ l = this.target || R();
4002
+ const h = O(this.layout.layoutBox.x);
4003
+ l.x.min = o.target.x.min, l.x.max = l.x.min + h;
4004
+ const f = O(this.layout.layoutBox.y);
4005
+ l.y.min = o.target.y.min, l.y.max = l.y.min + f;
4006
+ }
4007
+ U(a, l), ht(a, c), At(this.projectionDeltaWithTransform, this.layoutCorrected, a, c);
4008
+ }
4009
+ }
4010
+ registerSharedNode(o, a) {
4011
+ this.sharedNodes.has(o) || this.sharedNodes.set(o, new Zl()), this.sharedNodes.get(o).add(a);
4012
+ const u = a.options.initialPromotionConfig;
4013
+ a.promote({
4014
+ transition: u ? u.transition : void 0,
4015
+ preserveFollowOpacity: u && u.shouldPreserveFollowOpacity ? u.shouldPreserveFollowOpacity(a) : void 0
4016
+ });
4017
+ }
4018
+ isLead() {
4019
+ const o = this.getStack();
4020
+ return o ? o.lead === this : !0;
4021
+ }
4022
+ getLead() {
4023
+ var o;
4024
+ const { layoutId: a } = this.options;
4025
+ return a ? ((o = this.getStack()) === null || o === void 0 ? void 0 : o.lead) || this : this;
4026
+ }
4027
+ getPrevLead() {
4028
+ var o;
4029
+ const { layoutId: a } = this.options;
4030
+ return a ? (o = this.getStack()) === null || o === void 0 ? void 0 : o.prevLead : void 0;
4031
+ }
4032
+ getStack() {
4033
+ const { layoutId: o } = this.options;
4034
+ if (o)
4035
+ return this.root.sharedNodes.get(o);
4036
+ }
4037
+ promote({ needsReset: o, transition: a, preserveFollowOpacity: l } = {}) {
4038
+ const u = this.getStack();
4039
+ u && u.promote(this, l), o && (this.projectionDelta = void 0, this.needsReset = !0), a && this.setOptions({ transition: a });
4040
+ }
4041
+ relegate() {
4042
+ const o = this.getStack();
4043
+ return o ? o.relegate(this) : !1;
4044
+ }
4045
+ resetSkewAndRotation() {
4046
+ const { visualElement: o } = this.options;
4047
+ if (!o)
4048
+ return;
4049
+ let a = !1;
4050
+ const { latestValues: l } = o;
4051
+ if ((l.z || l.rotate || l.rotateX || l.rotateY || l.rotateZ || l.skewX || l.skewY) && (a = !0), !a)
4052
+ return;
4053
+ const u = {};
4054
+ l.z && de("z", o, u, this.animationValues);
4055
+ for (let c = 0; c < fe.length; c++)
4056
+ de(`rotate${fe[c]}`, o, u, this.animationValues), de(`skew${fe[c]}`, o, u, this.animationValues);
4057
+ o.render();
4058
+ for (const c in u)
4059
+ o.setStaticValue(c, u[c]), this.animationValues && (this.animationValues[c] = u[c]);
4060
+ o.scheduleRender();
4061
+ }
4062
+ getProjectionStyles(o) {
4063
+ var a, l;
4064
+ if (!this.instance || this.isSVG)
4065
+ return;
4066
+ if (!this.isVisible)
4067
+ return Jl;
4068
+ const u = {
4069
+ visibility: ""
4070
+ }, c = this.getTransformTemplate();
4071
+ if (this.needsReset)
4072
+ return this.needsReset = !1, u.opacity = "", u.pointerEvents = Ut(o == null ? void 0 : o.pointerEvents) || "", u.transform = c ? c(this.latestValues, "") : "none", u;
4073
+ const h = this.getLead();
4074
+ if (!this.projectionDelta || !this.layout || !h.target) {
4075
+ const p = {};
4076
+ return this.options.layoutId && (p.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1, p.pointerEvents = Ut(o == null ? void 0 : o.pointerEvents) || ""), this.hasProjected && !tt(this.latestValues) && (p.transform = c ? c({}, "") : "none", this.hasProjected = !1), p;
4077
+ }
4078
+ const f = h.animationValues || h.latestValues;
4079
+ this.applyTransformsToTarget(), u.transform = Ql(this.projectionDeltaWithTransform, this.treeScale, f), c && (u.transform = c(f, u.transform));
4080
+ const { x: d, y: m } = this.projectionDelta;
4081
+ u.transformOrigin = `${d.origin * 100}% ${m.origin * 100}% 0`, h.animationValues ? u.opacity = h === this ? (l = (a = f.opacity) !== null && a !== void 0 ? a : this.latestValues.opacity) !== null && l !== void 0 ? l : 1 : this.preserveOpacity ? this.latestValues.opacity : f.opacityExit : u.opacity = h === this ? f.opacity !== void 0 ? f.opacity : "" : f.opacityExit !== void 0 ? f.opacityExit : 0;
4082
+ for (const p in Wt) {
4083
+ if (f[p] === void 0)
4084
+ continue;
4085
+ const { correct: y, applyTo: g } = Wt[p], v = u.transform === "none" ? f[p] : y(f[p], h);
4086
+ if (g) {
4087
+ const T = g.length;
4088
+ for (let w = 0; w < T; w++)
4089
+ u[g[w]] = v;
4090
+ } else
4091
+ u[p] = v;
4092
+ }
4093
+ return this.options.layoutId && (u.pointerEvents = h === this ? Ut(o == null ? void 0 : o.pointerEvents) || "" : "none"), u;
4094
+ }
4095
+ clearSnapshot() {
4096
+ this.resumeFrom = this.snapshot = void 0;
4097
+ }
4098
+ // Only run on root
4099
+ resetTree() {
4100
+ this.root.nodes.forEach((o) => {
4101
+ var a;
4102
+ return (a = o.currentAnimation) === null || a === void 0 ? void 0 : a.stop();
4103
+ }), this.root.nodes.forEach(ys), this.root.sharedNodes.clear();
4104
+ }
4105
+ };
4106
+ }
4107
+ function eu(t) {
4108
+ t.updateLayout();
4109
+ }
4110
+ function nu(t) {
4111
+ var e;
4112
+ const n = ((e = t.resumeFrom) === null || e === void 0 ? void 0 : e.snapshot) || t.snapshot;
4113
+ if (t.isLead() && t.layout && n && t.hasListeners("didUpdate")) {
4114
+ const { layoutBox: s, measuredBox: i } = t.layout, { animationType: r } = t.options, o = n.source !== t.layout.source;
4115
+ r === "size" ? _((h) => {
4116
+ const f = o ? n.measuredBox[h] : n.layoutBox[h], d = O(f);
4117
+ f.min = s[h].min, f.max = f.min + d;
4118
+ }) : to(r, n.layoutBox, s) && _((h) => {
4119
+ const f = o ? n.measuredBox[h] : n.layoutBox[h], d = O(s[h]);
4120
+ f.max = f.min + d, t.relativeTarget && !t.currentAnimation && (t.isProjectionDirty = !0, t.relativeTarget[h].max = t.relativeTarget[h].min + d);
4121
+ });
4122
+ const a = ut();
4123
+ At(a, s, n.layoutBox);
4124
+ const l = ut();
4125
+ o ? At(l, t.applyTransform(i, !0), n.measuredBox) : At(l, s, n.layoutBox);
4126
+ const u = !Yi(a);
4127
+ let c = !1;
4128
+ if (!t.resumeFrom) {
4129
+ const h = t.getClosestProjectingParent();
4130
+ if (h && !h.resumeFrom) {
4131
+ const { snapshot: f, layout: d } = h;
4132
+ if (f && d) {
4133
+ const m = R();
4134
+ wt(m, n.layoutBox, f.layoutBox);
4135
+ const p = R();
4136
+ wt(p, s, d.layoutBox), Zi(m, p) || (c = !0), h.options.layoutRoot && (t.relativeTarget = p, t.relativeTargetOrigin = m, t.relativeParent = h);
4137
+ }
4138
+ }
4139
+ }
4140
+ t.notifyListeners("didUpdate", {
4141
+ layout: s,
4142
+ snapshot: n,
4143
+ delta: l,
4144
+ layoutDelta: a,
4145
+ hasLayoutChanged: u,
4146
+ hasRelativeTargetChanged: c
4147
+ });
4148
+ } else if (t.isLead()) {
4149
+ const { onExitComplete: s } = t.options;
4150
+ s && s();
4151
+ }
4152
+ t.options.transition = void 0;
4153
+ }
4154
+ function su(t) {
4155
+ Pt && et.totalNodes++, t.parent && (t.isProjecting() || (t.isProjectionDirty = t.parent.isProjectionDirty), t.isSharedProjectionDirty || (t.isSharedProjectionDirty = !!(t.isProjectionDirty || t.parent.isProjectionDirty || t.parent.isSharedProjectionDirty)), t.isTransformDirty || (t.isTransformDirty = t.parent.isTransformDirty));
4156
+ }
4157
+ function iu(t) {
4158
+ t.isProjectionDirty = t.isSharedProjectionDirty = t.isTransformDirty = !1;
4159
+ }
4160
+ function ou(t) {
4161
+ t.clearSnapshot();
4162
+ }
4163
+ function ys(t) {
4164
+ t.clearMeasurements();
4165
+ }
4166
+ function ru(t) {
4167
+ t.isLayoutDirty = !1;
4168
+ }
4169
+ function au(t) {
4170
+ const { visualElement: e } = t.options;
4171
+ e && e.getProps().onBeforeLayoutMeasure && e.notify("BeforeLayoutMeasure"), t.resetTransform();
4172
+ }
4173
+ function vs(t) {
4174
+ t.finishAnimation(), t.targetDelta = t.relativeTarget = t.target = void 0, t.isProjectionDirty = !0;
4175
+ }
4176
+ function lu(t) {
4177
+ t.resolveTargetDelta();
4178
+ }
4179
+ function uu(t) {
4180
+ t.calcProjection();
4181
+ }
4182
+ function cu(t) {
4183
+ t.resetSkewAndRotation();
4184
+ }
4185
+ function hu(t) {
4186
+ t.removeLeadSnapshot();
4187
+ }
4188
+ function xs(t, e, n) {
4189
+ t.translate = D(e.translate, 0, n), t.scale = D(e.scale, 1, n), t.origin = e.origin, t.originPoint = e.originPoint;
4190
+ }
4191
+ function Ts(t, e, n, s) {
4192
+ t.min = D(e.min, n.min, s), t.max = D(e.max, n.max, s);
4193
+ }
4194
+ function fu(t, e, n, s) {
4195
+ Ts(t.x, e.x, n.x, s), Ts(t.y, e.y, n.y, s);
4196
+ }
4197
+ function du(t) {
4198
+ return t.animationValues && t.animationValues.opacityExit !== void 0;
4199
+ }
4200
+ const mu = {
4201
+ duration: 0.45,
4202
+ ease: [0.4, 0, 0.1, 1]
4203
+ }, Ps = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), Ss = Ps("applewebkit/") && !Ps("chrome/") ? Math.round : I;
4204
+ function bs(t) {
4205
+ t.min = Ss(t.min), t.max = Ss(t.max);
4206
+ }
4207
+ function pu(t) {
4208
+ bs(t.x), bs(t.y);
4209
+ }
4210
+ function to(t, e, n) {
4211
+ return t === "position" || t === "preserve-aspect" && !vl(ms(e), ms(n), 0.2);
4212
+ }
4213
+ function gu(t) {
4214
+ var e;
4215
+ return t !== t.root && ((e = t.scroll) === null || e === void 0 ? void 0 : e.wasRoot);
4216
+ }
4217
+ const yu = Ji({
4218
+ attachResizeListener: (t, e) => Rt(t, "resize", e),
4219
+ measureScroll: () => ({
4220
+ x: document.documentElement.scrollLeft || document.body.scrollLeft,
4221
+ y: document.documentElement.scrollTop || document.body.scrollTop
4222
+ }),
4223
+ checkIsScrollRoot: () => !0
4224
+ }), me = {
4225
+ current: void 0
4226
+ }, eo = Ji({
4227
+ measureScroll: (t) => ({
4228
+ x: t.scrollLeft,
4229
+ y: t.scrollTop
4230
+ }),
4231
+ defaultParent: () => {
4232
+ if (!me.current) {
4233
+ const t = new yu({});
4234
+ t.mount(window), t.setOptions({ layoutScroll: !0 }), me.current = t;
4235
+ }
4236
+ return me.current;
4237
+ },
4238
+ resetTransform: (t, e) => {
4239
+ t.style.transform = e !== void 0 ? e : "none";
4240
+ },
4241
+ checkIsScrollRoot: (t) => window.getComputedStyle(t).position === "fixed"
4242
+ }), vu = {
4243
+ pan: {
4244
+ Feature: jl
4245
+ },
4246
+ drag: {
4247
+ Feature: Fl,
4248
+ ProjectionNode: eo,
4249
+ MeasureLayout: Hi
4250
+ }
4251
+ };
4252
+ function As(t, e, n) {
4253
+ const { props: s } = t;
4254
+ t.animationState && s.whileHover && t.animationState.setActive("whileHover", n === "Start");
4255
+ const i = "onHover" + n, r = s[i];
4256
+ r && C.postRender(() => r(e, jt(e)));
4257
+ }
4258
+ class xu extends Q {
4259
+ mount() {
4260
+ const { current: e } = this.node;
4261
+ e && (this.unmount = vr(e, (n) => (As(this.node, n, "Start"), (s) => As(this.node, s, "End"))));
4262
+ }
4263
+ unmount() {
4264
+ }
4265
+ }
4266
+ class Tu extends Q {
4267
+ constructor() {
4268
+ super(...arguments), this.isActive = !1;
4269
+ }
4270
+ onFocus() {
4271
+ let e = !1;
4272
+ try {
4273
+ e = this.node.current.matches(":focus-visible");
4274
+ } catch {
4275
+ e = !0;
4276
+ }
4277
+ !e || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !0), this.isActive = !0);
4278
+ }
4279
+ onBlur() {
4280
+ !this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1);
4281
+ }
4282
+ mount() {
4283
+ this.unmount = Ft(Rt(this.node.current, "focus", () => this.onFocus()), Rt(this.node.current, "blur", () => this.onBlur()));
4284
+ }
4285
+ unmount() {
4286
+ }
4287
+ }
4288
+ function ws(t, e, n) {
4289
+ const { props: s } = t;
4290
+ t.animationState && s.whileTap && t.animationState.setActive("whileTap", n === "Start");
4291
+ const i = "onTap" + (n === "End" ? "" : n), r = s[i];
4292
+ r && C.postRender(() => r(e, jt(e)));
4293
+ }
4294
+ class Pu extends Q {
4295
+ mount() {
4296
+ const { current: e } = this.node;
4297
+ e && (this.unmount = Sr(e, (n) => (ws(this.node, n, "Start"), (s, { success: i }) => ws(this.node, s, i ? "End" : "Cancel")), { useGlobalTarget: this.node.props.globalTapTarget }));
4298
+ }
4299
+ unmount() {
4300
+ }
4301
+ }
4302
+ const Re = /* @__PURE__ */ new WeakMap(), pe = /* @__PURE__ */ new WeakMap(), Su = (t) => {
4303
+ const e = Re.get(t.target);
4304
+ e && e(t);
4305
+ }, bu = (t) => {
4306
+ t.forEach(Su);
4307
+ };
4308
+ function Au({ root: t, ...e }) {
4309
+ const n = t || document;
4310
+ pe.has(n) || pe.set(n, {});
4311
+ const s = pe.get(n), i = JSON.stringify(e);
4312
+ return s[i] || (s[i] = new IntersectionObserver(bu, { root: t, ...e })), s[i];
4313
+ }
4314
+ function wu(t, e, n) {
4315
+ const s = Au(e);
4316
+ return Re.set(t, n), s.observe(t), () => {
4317
+ Re.delete(t), s.unobserve(t);
4318
+ };
4319
+ }
4320
+ const Vu = {
4321
+ some: 0,
4322
+ all: 1
4323
+ };
4324
+ class Cu extends Q {
4325
+ constructor() {
4326
+ super(...arguments), this.hasEnteredView = !1, this.isInView = !1;
4327
+ }
4328
+ startObserver() {
4329
+ this.unmount();
4330
+ const { viewport: e = {} } = this.node.getProps(), { root: n, margin: s, amount: i = "some", once: r } = e, o = {
4331
+ root: n ? n.current : void 0,
4332
+ rootMargin: s,
4333
+ threshold: typeof i == "number" ? i : Vu[i]
4334
+ }, a = (l) => {
4335
+ const { isIntersecting: u } = l;
4336
+ if (this.isInView === u || (this.isInView = u, r && !u && this.hasEnteredView))
4337
+ return;
4338
+ u && (this.hasEnteredView = !0), this.node.animationState && this.node.animationState.setActive("whileInView", u);
4339
+ const { onViewportEnter: c, onViewportLeave: h } = this.node.getProps(), f = u ? c : h;
4340
+ f && f(l);
4341
+ };
4342
+ return wu(this.node.current, o, a);
4343
+ }
4344
+ mount() {
4345
+ this.startObserver();
4346
+ }
4347
+ update() {
4348
+ if (typeof IntersectionObserver > "u")
4349
+ return;
4350
+ const { props: e, prevProps: n } = this.node;
4351
+ ["amount", "margin", "root"].some(Du(e, n)) && this.startObserver();
4352
+ }
4353
+ unmount() {
4354
+ }
4355
+ }
4356
+ function Du({ viewport: t = {} }, { viewport: e = {} } = {}) {
4357
+ return (n) => t[n] !== e[n];
4358
+ }
4359
+ const Mu = {
4360
+ inView: {
4361
+ Feature: Cu
4362
+ },
4363
+ tap: {
4364
+ Feature: Pu
4365
+ },
4366
+ focus: {
4367
+ Feature: Tu
4368
+ },
4369
+ hover: {
4370
+ Feature: xu
4371
+ }
4372
+ }, Ru = {
4373
+ layout: {
4374
+ ProjectionNode: eo,
4375
+ MeasureLayout: Hi
4376
+ }
4377
+ }, Ee = { current: null }, no = { current: !1 };
4378
+ function Eu() {
4379
+ if (no.current = !0, !!je)
4380
+ if (window.matchMedia) {
4381
+ const t = window.matchMedia("(prefers-reduced-motion)"), e = () => Ee.current = t.matches;
4382
+ t.addListener(e), e();
4383
+ } else
4384
+ Ee.current = !1;
4385
+ }
4386
+ const Lu = [...Ci, F, Z], Fu = (t) => Lu.find(Vi(t)), Vs = /* @__PURE__ */ new WeakMap();
4387
+ function ju(t, e, n) {
4388
+ for (const s in e) {
4389
+ const i = e[s], r = n[s];
4390
+ if (j(i))
4391
+ t.addValue(s, i);
4392
+ else if (j(r))
4393
+ t.addValue(s, Dt(i, { owner: t }));
4394
+ else if (r !== i)
4395
+ if (t.hasValue(s)) {
4396
+ const o = t.getValue(s);
4397
+ o.liveStyle === !0 ? o.jump(i) : o.hasAnimated || o.set(i);
4398
+ } else {
4399
+ const o = t.getStaticValue(s);
4400
+ t.addValue(s, Dt(o !== void 0 ? o : i, { owner: t }));
4401
+ }
4402
+ }
4403
+ for (const s in n)
4404
+ e[s] === void 0 && t.removeValue(s);
4405
+ return e;
4406
+ }
4407
+ const Cs = [
4408
+ "AnimationStart",
4409
+ "AnimationComplete",
4410
+ "Update",
4411
+ "BeforeLayoutMeasure",
4412
+ "LayoutMeasure",
4413
+ "LayoutAnimationStart",
4414
+ "LayoutAnimationComplete"
4415
+ ];
4416
+ class Bu {
4417
+ /**
4418
+ * This method takes React props and returns found MotionValues. For example, HTML
4419
+ * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
4420
+ *
4421
+ * This isn't an abstract method as it needs calling in the constructor, but it is
4422
+ * intended to be one.
4423
+ */
4424
+ scrapeMotionValuesFromProps(e, n, s) {
4425
+ return {};
4426
+ }
4427
+ constructor({ parent: e, props: n, presenceContext: s, reducedMotionConfig: i, blockInitialAnimation: r, visualState: o }, a = {}) {
4428
+ this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.KeyframeResolver = ln, this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => {
4429
+ this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection));
4430
+ }, this.renderScheduledAt = 0, this.scheduleRender = () => {
4431
+ const d = W.now();
4432
+ this.renderScheduledAt < d && (this.renderScheduledAt = d, C.render(this.render, !1, !0));
4433
+ };
4434
+ const { latestValues: l, renderState: u, onUpdate: c } = o;
4435
+ this.onUpdate = c, this.latestValues = l, this.baseTarget = { ...l }, this.initialValues = n.initial ? { ...l } : {}, this.renderState = u, this.parent = e, this.props = n, this.presenceContext = s, this.depth = e ? e.depth + 1 : 0, this.reducedMotionConfig = i, this.options = a, this.blockInitialAnimation = !!r, this.isControllingVariants = Qt(n), this.isVariantNode = Bs(n), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(e && e.current);
4436
+ const { willChange: h, ...f } = this.scrapeMotionValuesFromProps(n, {}, this);
4437
+ for (const d in f) {
4438
+ const m = f[d];
4439
+ l[d] !== void 0 && j(m) && m.set(l[d], !1);
4440
+ }
4441
+ }
4442
+ mount(e) {
4443
+ this.current = e, Vs.set(e, this), this.projection && !this.projection.instance && this.projection.mount(e), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((n, s) => this.bindToMotionValue(s, n)), no.current || Eu(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : Ee.current, this.parent && this.parent.children.add(this), this.update(this.props, this.presenceContext);
4444
+ }
4445
+ unmount() {
4446
+ Vs.delete(this.current), this.projection && this.projection.unmount(), Y(this.notifyUpdate), Y(this.render), this.valueSubscriptions.forEach((e) => e()), this.valueSubscriptions.clear(), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent && this.parent.children.delete(this);
4447
+ for (const e in this.events)
4448
+ this.events[e].clear();
4449
+ for (const e in this.features) {
4450
+ const n = this.features[e];
4451
+ n && (n.unmount(), n.isMounted = !1);
4452
+ }
4453
+ this.current = null;
4454
+ }
4455
+ bindToMotionValue(e, n) {
4456
+ this.valueSubscriptions.has(e) && this.valueSubscriptions.get(e)();
4457
+ const s = it.has(e), i = n.on("change", (a) => {
4458
+ this.latestValues[e] = a, this.props.onUpdate && C.preRender(this.notifyUpdate), s && this.projection && (this.projection.isTransformDirty = !0);
4459
+ }), r = n.on("renderRequest", this.scheduleRender);
4460
+ let o;
4461
+ window.MotionCheckAppearSync && (o = window.MotionCheckAppearSync(this, e, n)), this.valueSubscriptions.set(e, () => {
4462
+ i(), r(), o && o(), n.owner && n.stop();
4463
+ });
4464
+ }
4465
+ sortNodePosition(e) {
4466
+ return !this.current || !this.sortInstanceNodePosition || this.type !== e.type ? 0 : this.sortInstanceNodePosition(this.current, e.current);
4467
+ }
4468
+ updateFeatures() {
4469
+ let e = "animation";
4470
+ for (e in dt) {
4471
+ const n = dt[e];
4472
+ if (!n)
4473
+ continue;
4474
+ const { isEnabled: s, Feature: i } = n;
4475
+ if (!this.features[e] && i && s(this.props) && (this.features[e] = new i(this)), this.features[e]) {
4476
+ const r = this.features[e];
4477
+ r.isMounted ? r.update() : (r.mount(), r.isMounted = !0);
4478
+ }
4479
+ }
4480
+ }
4481
+ triggerBuild() {
4482
+ this.build(this.renderState, this.latestValues, this.props);
4483
+ }
4484
+ /**
4485
+ * Measure the current viewport box with or without transforms.
4486
+ * Only measures axis-aligned boxes, rotate and skew must be manually
4487
+ * removed with a re-render to work.
4488
+ */
4489
+ measureViewportBox() {
4490
+ return this.current ? this.measureInstanceViewportBox(this.current, this.props) : R();
4491
+ }
4492
+ getStaticValue(e) {
4493
+ return this.latestValues[e];
4494
+ }
4495
+ setStaticValue(e, n) {
4496
+ this.latestValues[e] = n;
4497
+ }
4498
+ /**
4499
+ * Update the provided props. Ensure any newly-added motion values are
4500
+ * added to our map, old ones removed, and listeners updated.
4501
+ */
4502
+ update(e, n) {
4503
+ (e.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = e, this.prevPresenceContext = this.presenceContext, this.presenceContext = n;
4504
+ for (let s = 0; s < Cs.length; s++) {
4505
+ const i = Cs[s];
4506
+ this.propEventSubscriptions[i] && (this.propEventSubscriptions[i](), delete this.propEventSubscriptions[i]);
4507
+ const r = "on" + i, o = e[r];
4508
+ o && (this.propEventSubscriptions[i] = this.on(i, o));
4509
+ }
4510
+ this.prevMotionValues = ju(this, this.scrapeMotionValuesFromProps(e, this.prevProps, this), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue(), this.onUpdate && this.onUpdate(this);
4511
+ }
4512
+ getProps() {
4513
+ return this.props;
4514
+ }
4515
+ /**
4516
+ * Returns the variant definition with a given name.
4517
+ */
4518
+ getVariant(e) {
4519
+ return this.props.variants ? this.props.variants[e] : void 0;
4520
+ }
4521
+ /**
4522
+ * Returns the defined default transition on this component.
4523
+ */
4524
+ getDefaultTransition() {
4525
+ return this.props.transition;
4526
+ }
4527
+ getTransformPagePoint() {
4528
+ return this.props.transformPagePoint;
4529
+ }
4530
+ getClosestVariantNode() {
4531
+ return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0;
4532
+ }
4533
+ /**
4534
+ * Add a child visual element to our set of children.
4535
+ */
4536
+ addVariantChild(e) {
4537
+ const n = this.getClosestVariantNode();
4538
+ if (n)
4539
+ return n.variantChildren && n.variantChildren.add(e), () => n.variantChildren.delete(e);
4540
+ }
4541
+ /**
4542
+ * Add a motion value and bind it to this visual element.
4543
+ */
4544
+ addValue(e, n) {
4545
+ const s = this.values.get(e);
4546
+ n !== s && (s && this.removeValue(e), this.bindToMotionValue(e, n), this.values.set(e, n), this.latestValues[e] = n.get());
4547
+ }
4548
+ /**
4549
+ * Remove a motion value and unbind any active subscriptions.
4550
+ */
4551
+ removeValue(e) {
4552
+ this.values.delete(e);
4553
+ const n = this.valueSubscriptions.get(e);
4554
+ n && (n(), this.valueSubscriptions.delete(e)), delete this.latestValues[e], this.removeValueFromRenderState(e, this.renderState);
4555
+ }
4556
+ /**
4557
+ * Check whether we have a motion value for this key
4558
+ */
4559
+ hasValue(e) {
4560
+ return this.values.has(e);
4561
+ }
4562
+ getValue(e, n) {
4563
+ if (this.props.values && this.props.values[e])
4564
+ return this.props.values[e];
4565
+ let s = this.values.get(e);
4566
+ return s === void 0 && n !== void 0 && (s = Dt(n === null ? void 0 : n, { owner: this }), this.addValue(e, s)), s;
4567
+ }
4568
+ /**
4569
+ * If we're trying to animate to a previously unencountered value,
4570
+ * we need to check for it in our state and as a last resort read it
4571
+ * directly from the instance (which might have performance implications).
4572
+ */
4573
+ readValue(e, n) {
4574
+ var s;
4575
+ let i = this.latestValues[e] !== void 0 || !this.current ? this.latestValues[e] : (s = this.getBaseTargetFromProps(this.props, e)) !== null && s !== void 0 ? s : this.readValueFromInstance(this.current, e, this.options);
4576
+ return i != null && (typeof i == "string" && (Ai(i) || pi(i)) ? i = parseFloat(i) : !Fu(i) && Z.test(n) && (i = Pi(e, n)), this.setBaseTarget(e, j(i) ? i.get() : i)), j(i) ? i.get() : i;
4577
+ }
4578
+ /**
4579
+ * Set the base target to later animate back to. This is currently
4580
+ * only hydrated on creation and when we first read a value.
4581
+ */
4582
+ setBaseTarget(e, n) {
4583
+ this.baseTarget[e] = n;
4584
+ }
4585
+ /**
4586
+ * Find the base target for a value thats been removed from all animation
4587
+ * props.
4588
+ */
4589
+ getBaseTarget(e) {
4590
+ var n;
4591
+ const { initial: s } = this.props;
4592
+ let i;
4593
+ if (typeof s == "string" || typeof s == "object") {
4594
+ const o = _e(this.props, s, (n = this.presenceContext) === null || n === void 0 ? void 0 : n.custom);
4595
+ o && (i = o[e]);
4596
+ }
4597
+ if (s && i !== void 0)
4598
+ return i;
4599
+ const r = this.getBaseTargetFromProps(this.props, e);
4600
+ return r !== void 0 && !j(r) ? r : this.initialValues[e] !== void 0 && i === void 0 ? void 0 : this.baseTarget[e];
4601
+ }
4602
+ on(e, n) {
4603
+ return this.events[e] || (this.events[e] = new en()), this.events[e].add(n);
4604
+ }
4605
+ notify(e, ...n) {
4606
+ this.events[e] && this.events[e].notify(...n);
4607
+ }
4608
+ }
4609
+ class so extends Bu {
4610
+ constructor() {
4611
+ super(...arguments), this.KeyframeResolver = Di;
4612
+ }
4613
+ sortInstanceNodePosition(e, n) {
4614
+ return e.compareDocumentPosition(n) & 2 ? 1 : -1;
4615
+ }
4616
+ getBaseTargetFromProps(e, n) {
4617
+ return e.style ? e.style[n] : void 0;
4618
+ }
4619
+ removeValueFromRenderState(e, { vars: n, style: s }) {
4620
+ delete n[e], delete s[e];
4621
+ }
4622
+ handleChildMotionValue() {
4623
+ this.childSubscription && (this.childSubscription(), delete this.childSubscription);
4624
+ const { children: e } = this.props;
4625
+ j(e) && (this.childSubscription = e.on("change", (n) => {
4626
+ this.current && (this.current.textContent = `${n}`);
4627
+ }));
4628
+ }
4629
+ }
4630
+ function ku(t) {
4631
+ return window.getComputedStyle(t);
4632
+ }
4633
+ class Iu extends so {
4634
+ constructor() {
4635
+ super(...arguments), this.type = "html", this.renderInstance = Ws;
4636
+ }
4637
+ readValueFromInstance(e, n) {
4638
+ if (it.has(n)) {
4639
+ const s = an(n);
4640
+ return s && s.default || 0;
4641
+ } else {
4642
+ const s = ku(e), i = (_s(n) ? s.getPropertyValue(n) : s[n]) || 0;
4643
+ return typeof i == "string" ? i.trim() : i;
4644
+ }
4645
+ }
4646
+ measureInstanceViewportBox(e, { transformPagePoint: n }) {
4647
+ return $i(e, n);
4648
+ }
4649
+ build(e, n, s) {
4650
+ We(e, n, s.transformTemplate);
4651
+ }
4652
+ scrapeMotionValuesFromProps(e, n, s) {
4653
+ return Xe(e, n, s);
4654
+ }
4655
+ }
4656
+ class Ou extends so {
4657
+ constructor() {
4658
+ super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = R;
4659
+ }
4660
+ getBaseTargetFromProps(e, n) {
4661
+ return e[n];
4662
+ }
4663
+ readValueFromInstance(e, n) {
4664
+ if (it.has(n)) {
4665
+ const s = an(n);
4666
+ return s && s.default || 0;
4667
+ }
4668
+ return n = $s.has(n) ? n : Oe(n), e.getAttribute(n);
4669
+ }
4670
+ scrapeMotionValuesFromProps(e, n, s) {
4671
+ return Xs(e, n, s);
4672
+ }
4673
+ build(e, n, s) {
4674
+ $e(e, n, this.isSVGTag, s.transformTemplate);
4675
+ }
4676
+ renderInstance(e, n, s, i) {
4677
+ Gs(e, n, s, i);
4678
+ }
4679
+ mount(e) {
4680
+ this.isSVGTag = He(e.tagName), super.mount(e);
4681
+ }
4682
+ }
4683
+ const Nu = (t, e) => Ue(t) ? new Ou(e) : new Iu(e, {
4684
+ allowProjection: t !== P.Fragment
4685
+ }), Uu = /* @__PURE__ */ hr({
4686
+ ...ul,
4687
+ ...Mu,
4688
+ ...vu,
4689
+ ...Ru
4690
+ }, Nu), _u = /* @__PURE__ */ Vo(Uu);
4691
+ /**
4692
+ * @license lucide-react v0.474.0 - ISC
4693
+ *
4694
+ * This source code is licensed under the ISC license.
4695
+ * See the LICENSE file in the root directory of this source tree.
4696
+ */
4697
+ const Ku = [
4698
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
4699
+ ["path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3", key: "1u773s" }],
4700
+ ["path", { d: "M12 17h.01", key: "p32p05" }]
4701
+ ], zu = Le("CircleHelp", Ku);
4702
+ /**
4703
+ * @license lucide-react v0.474.0 - ISC
4704
+ *
4705
+ * This source code is licensed under the ISC license.
4706
+ * See the LICENSE file in the root directory of this source tree.
4707
+ */
4708
+ const Wu = [
4709
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
4710
+ ["polyline", { points: "12 6 12 12 16 14", key: "68esgv" }]
4711
+ ], $u = Le("Clock", Wu);
4712
+ /**
4713
+ * @license lucide-react v0.474.0 - ISC
4714
+ *
4715
+ * This source code is licensed under the ISC license.
4716
+ * See the LICENSE file in the root directory of this source tree.
4717
+ */
4718
+ const Gu = [
4719
+ [
4720
+ "path",
4721
+ {
4722
+ d: "M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",
4723
+ key: "1xq2db"
4724
+ }
4725
+ ]
4726
+ ], Hu = Le("Zap", Gu), Xu = ({ description: t, quizStyles: e }) => {
4727
+ const n = lo("(max-width:600px)"), [s, i] = P.useState("");
4728
+ return P.useEffect(() => {
4729
+ if (!t) return;
4730
+ const r = n ? 90 : 500, a = String(t).replace(/<[^>]*>/g, "");
4731
+ a.length > r ? i(a.substring(0, r) + "...") : i(a);
4732
+ }, [t, n]), /* @__PURE__ */ A.jsx("div", { className: "quiz-description", style: e, dangerouslySetInnerHTML: { __html: s } });
4733
+ }, rt = {
4734
+ heroSection: {
4735
+ position: "relative",
4736
+ borderRadius: "sm",
4737
+ overflow: "hidden"
4738
+ },
4739
+ heroImage: {
4740
+ objectFit: "cover",
4741
+ filter: "brightness(0.85)"
4742
+ },
4743
+ heroOverlay: {
4744
+ position: "absolute",
4745
+ top: 0,
4746
+ left: 0,
4747
+ right: 0,
4748
+ bottom: 0,
4749
+ background: "linear-gradient(180deg, rgba(0,0,0,0.0) 30%, rgba(0,0,0,0.7) 100%)",
4750
+ display: "flex",
4751
+ flexDirection: "column",
4752
+ justifyContent: "flex-end",
4753
+ py: 0,
4754
+ px: 2
4755
+ },
4756
+ heroTitle: {
4757
+ color: "white",
4758
+ lineHeight: "1.2",
4759
+ textShadow: "0 2px 4px rgba(0,0,0,0.3)",
4760
+ fontSize: { xs: "xl", sm: "xl3" }
4761
+ },
4762
+ heroDescription: {
4763
+ color: "#fff",
4764
+ fontFamily: "Inter, sans-serif",
4765
+ fontSize: { xs: "xs", sm: "md" }
4766
+ },
4767
+ startButtonContainer: {
4768
+ py: 1.5,
4769
+ fontSize: "md",
4770
+ "--Button-gap": "1em"
4771
+ }
4772
+ }, qu = {
4773
+ defaultImage: uo
4774
+ }, Ds = () => qu.defaultImage, Yu = (t) => {
4775
+ var e, n;
4776
+ return t ? (e = t.images) != null && e.main ? t.images.main : (n = t.images) != null && n.cover ? t.images.cover : Ds() : Ds();
4777
+ };
4778
+ function Zu({ quiz: t, onStart: e }) {
4779
+ const { t: n } = oo(), s = n("quizzes.buttons.start"), i = t.questionsCount;
4780
+ return t ? /* @__PURE__ */ A.jsxs(Bt, { spacing: 2, children: [
4781
+ /* @__PURE__ */ A.jsxs(Nt, { sx: rt.heroSection, children: [
4782
+ /* @__PURE__ */ A.jsx(co, { ratio: 16 / 9, children: /* @__PURE__ */ A.jsx("img", { src: Yu(t), alt: t.title, style: rt.heroImage, loading: "lazy" }) }),
4783
+ /* @__PURE__ */ A.jsx(Nt, { sx: rt.heroOverlay, children: /* @__PURE__ */ A.jsxs(_u.div, { initial: { opacity: 0, y: 20 }, animate: { opacity: 1, y: 0 }, transition: { delay: 0.2 }, children: [
4784
+ /* @__PURE__ */ A.jsxs(Nt, { sx: { display: "flex", gap: 1.5, alignItems: "center", mb: 1 }, children: [
4785
+ /* @__PURE__ */ A.jsx(ho, { size: "sm", children: n("quizzes.label", { count: 1 }) }),
4786
+ /* @__PURE__ */ A.jsxs(Bt, { direction: "row", spacing: 2, sx: { color: "neutral.300" }, children: [
4787
+ /* @__PURE__ */ A.jsx(
4788
+ vt,
4789
+ {
4790
+ title: n("quizzes.question", { count: i }),
4791
+ level: "body-sm",
4792
+ textColor: "white",
4793
+ startDecorator: /* @__PURE__ */ A.jsx(zu, { size: 16, color: "white" }),
4794
+ children: t.questionsCount
4795
+ }
4796
+ ),
4797
+ /* @__PURE__ */ A.jsxs(
4798
+ vt,
4799
+ {
4800
+ title: n("common.labels.time"),
4801
+ level: "body-sm",
4802
+ textColor: "white",
4803
+ startDecorator: /* @__PURE__ */ A.jsx($u, { size: 16, color: "white" }),
4804
+ children: [
4805
+ i > 3 ? 2 : 1,
4806
+ "m"
4807
+ ]
4808
+ }
4809
+ ),
4810
+ /* @__PURE__ */ A.jsx(
4811
+ vt,
4812
+ {
4813
+ title: n("quizzes.participant", { count: t.participationCount }),
4814
+ level: "body-sm",
4815
+ textColor: "white",
4816
+ startDecorator: /* @__PURE__ */ A.jsx(mo, { size: 16, color: "white" }),
4817
+ children: t.participationCount
4818
+ }
4819
+ )
4820
+ ] })
4821
+ ] }),
4822
+ /* @__PURE__ */ A.jsxs(Bt, { mb: 1, spacing: 0.5, children: [
4823
+ /* @__PURE__ */ A.jsx(vt, { level: "h1", sx: rt.heroTitle, children: t.title }),
4824
+ /* @__PURE__ */ A.jsx(Xu, { description: t.description, quizStyles: rt.heroDescription })
4825
+ ] })
4826
+ ] }) })
4827
+ ] }),
4828
+ /* @__PURE__ */ A.jsx(Bt, { spacing: 1, children: /* @__PURE__ */ A.jsx(fo, { fullWidth: !0, size: "sm", onClick: e, startDecorator: /* @__PURE__ */ A.jsx(Hu, {}), sx: rt.startButtonContainer, children: s }) })
4829
+ ] }) : null;
4830
+ }
4831
+ const hc = ({ initialQuizId: t, url: e }) => {
4832
+ const [n, s] = P.useState(null), [i, r] = P.useState({}), [o, a] = P.useState(!0), [l, u] = P.useState(null), c = ro();
4833
+ return P.useEffect(() => {
4834
+ t && s(t);
4835
+ }, [t]), P.useEffect(() => {
4836
+ n && (a(!0), u(null), c.miniGames.getClassicQuizById(n, !0).then((h) => {
4837
+ r(h), a(!1);
4838
+ }).catch((h) => {
4839
+ console.error("Failed to fetch quiz:", h), u("Failed to load quiz. Please try again."), a(!1);
4840
+ }));
4841
+ }, [n]), /* @__PURE__ */ A.jsx(A.Fragment, { children: o ? /* @__PURE__ */ A.jsx(Nt, { minHeight: "200px", display: "flex", justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ A.jsx(ao, {}) }) : l ? /* @__PURE__ */ A.jsx(A.Fragment, {}) : i ? /* @__PURE__ */ A.jsx(
4842
+ po,
4843
+ {
4844
+ sx: {
4845
+ borderColor: "divider",
4846
+ "&:hover": {
4847
+ borderColor: "divider"
4848
+ }
4849
+ },
4850
+ children: /* @__PURE__ */ A.jsx(
4851
+ Zu,
4852
+ {
4853
+ quiz: i,
4854
+ onStart: () => {
4855
+ location.href = e;
4856
+ }
4857
+ }
4858
+ )
4859
+ }
4860
+ ) : /* @__PURE__ */ A.jsx(vt, { children: "No quiz data available" }) });
4861
+ };
4862
+ export {
4863
+ hc as default
4864
+ };