@zydon/common 1.1.70 → 1.1.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2992 @@
1
+ import { p as rt, f as C, n as B, r as mn, c as gn, i as tt, d as Ts, a as yn, v as Vs, w as ie, b as yt, e as $, g as R, t as Pt, h as et, j as Ss, k as bs, l as k, m as nt, o as vn, q as xt, s as vt, u as As, x as Ds, y as Cs, z as at, A as Ms, B as Pn, C as $t, D as xn, E as Tn, F as w, G as zt, H as dt, P as ws, I as Ls, L as Rs, S as Bs, J as Vn, K as Sn, M as bn, N as Et, O as jt, Q as ye, R as Ht, T as Fs, U as An, V as Dn, W as Es, X as js, Y as Cn, Z as Mn, _ as ks, $ as Is, a0 as Os, a1 as Us, a2 as Ns, a3 as Gs, a4 as Ks, a5 as $s, a6 as zs, a7 as Hs } from "./index-be3b99f0.js";
2
+ import wn, { useContext as _t, useId as _s, useEffect as Ws } from "react";
3
+ import "@mui/material";
4
+ import "@emotion/react";
5
+ import "react-dom";
6
+ import "@mui/x-date-pickers-pro";
7
+ import "@mui/lab";
8
+ import "@mui/x-data-grid-premium";
9
+ import "@emotion/styled";
10
+ import "react-hook-form";
11
+ function N(e, t, n, s = { passive: !0 }) {
12
+ return e.addEventListener(t, n, s), () => e.removeEventListener(t, n);
13
+ }
14
+ const Ln = (e) => e.pointerType === "mouse" ? typeof e.button != "number" || e.button <= 0 : e.isPrimary !== !1;
15
+ function Rt(e, t = "page") {
16
+ return {
17
+ point: {
18
+ x: e[t + "X"],
19
+ y: e[t + "Y"]
20
+ }
21
+ };
22
+ }
23
+ const Ys = (e) => (t) => Ln(t) && e(t, Rt(t));
24
+ function G(e, t, n, s) {
25
+ return N(e, t, Ys(n), s);
26
+ }
27
+ function Rn(e) {
28
+ let t = null;
29
+ return () => {
30
+ const n = () => {
31
+ t = null;
32
+ };
33
+ return t === null ? (t = e, n) : !1;
34
+ };
35
+ }
36
+ const ve = Rn("dragHorizontal"), Pe = Rn("dragVertical");
37
+ function Bn(e) {
38
+ let t = !1;
39
+ if (e === "y")
40
+ t = Pe();
41
+ else if (e === "x")
42
+ t = ve();
43
+ else {
44
+ const n = ve(), s = Pe();
45
+ n && s ? t = () => {
46
+ n(), s();
47
+ } : (n && n(), s && s());
48
+ }
49
+ return t;
50
+ }
51
+ function Fn() {
52
+ const e = Bn(!0);
53
+ return e ? (e(), !1) : !0;
54
+ }
55
+ class q {
56
+ constructor(t) {
57
+ this.isMounted = !1, this.node = t;
58
+ }
59
+ update() {
60
+ }
61
+ }
62
+ function xe(e, t) {
63
+ const n = "pointer" + (t ? "enter" : "leave"), s = "onHover" + (t ? "Start" : "End"), o = (c, i) => {
64
+ if (c.type === "touch" || Fn())
65
+ return;
66
+ const r = e.getProps();
67
+ e.animationState && r.whileHover && e.animationState.setActive("whileHover", t), r[s] && C.update(() => r[s](c, i));
68
+ };
69
+ return G(e.current, n, o, {
70
+ passive: !e.getProps()[s]
71
+ });
72
+ }
73
+ class qs extends q {
74
+ mount() {
75
+ this.unmount = rt(xe(this.node, !0), xe(this.node, !1));
76
+ }
77
+ unmount() {
78
+ }
79
+ }
80
+ class Xs extends q {
81
+ constructor() {
82
+ super(...arguments), this.isActive = !1;
83
+ }
84
+ onFocus() {
85
+ let t = !1;
86
+ try {
87
+ t = this.node.current.matches(":focus-visible");
88
+ } catch {
89
+ t = !0;
90
+ }
91
+ !t || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !0), this.isActive = !0);
92
+ }
93
+ onBlur() {
94
+ !this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1);
95
+ }
96
+ mount() {
97
+ this.unmount = rt(N(this.node.current, "focus", () => this.onFocus()), N(this.node.current, "blur", () => this.onBlur()));
98
+ }
99
+ unmount() {
100
+ }
101
+ }
102
+ const En = (e, t) => t ? e === t ? !0 : En(e, t.parentElement) : !1;
103
+ function kt(e, t) {
104
+ if (!t)
105
+ return;
106
+ const n = new PointerEvent("pointer" + e);
107
+ t(n, Rt(n));
108
+ }
109
+ class Zs extends q {
110
+ constructor() {
111
+ super(...arguments), this.removeStartListeners = B, this.removeEndListeners = B, this.removeAccessibleListeners = B, this.startPointerPress = (t, n) => {
112
+ if (this.removeEndListeners(), this.isPressing)
113
+ return;
114
+ const s = this.node.getProps(), c = G(window, "pointerup", (r, a) => {
115
+ if (!this.checkPressEnd())
116
+ return;
117
+ const { onTap: l, onTapCancel: u } = this.node.getProps();
118
+ C.update(() => {
119
+ En(this.node.current, r.target) ? l && l(r, a) : u && u(r, a);
120
+ });
121
+ }, { passive: !(s.onTap || s.onPointerUp) }), i = G(window, "pointercancel", (r, a) => this.cancelPress(r, a), { passive: !(s.onTapCancel || s.onPointerCancel) });
122
+ this.removeEndListeners = rt(c, i), this.startPress(t, n);
123
+ }, this.startAccessiblePress = () => {
124
+ const t = (c) => {
125
+ if (c.key !== "Enter" || this.isPressing)
126
+ return;
127
+ const i = (r) => {
128
+ r.key !== "Enter" || !this.checkPressEnd() || kt("up", (a, l) => {
129
+ const { onTap: u } = this.node.getProps();
130
+ u && C.update(() => u(a, l));
131
+ });
132
+ };
133
+ this.removeEndListeners(), this.removeEndListeners = N(this.node.current, "keyup", i), kt("down", (r, a) => {
134
+ this.startPress(r, a);
135
+ });
136
+ }, n = N(this.node.current, "keydown", t), s = () => {
137
+ this.isPressing && kt("cancel", (c, i) => this.cancelPress(c, i));
138
+ }, o = N(this.node.current, "blur", s);
139
+ this.removeAccessibleListeners = rt(n, o);
140
+ };
141
+ }
142
+ startPress(t, n) {
143
+ this.isPressing = !0;
144
+ const { onTapStart: s, whileTap: o } = this.node.getProps();
145
+ o && this.node.animationState && this.node.animationState.setActive("whileTap", !0), s && C.update(() => s(t, n));
146
+ }
147
+ checkPressEnd() {
148
+ return this.removeEndListeners(), this.isPressing = !1, this.node.getProps().whileTap && this.node.animationState && this.node.animationState.setActive("whileTap", !1), !Fn();
149
+ }
150
+ cancelPress(t, n) {
151
+ if (!this.checkPressEnd())
152
+ return;
153
+ const { onTapCancel: s } = this.node.getProps();
154
+ s && C.update(() => s(t, n));
155
+ }
156
+ mount() {
157
+ const t = this.node.getProps(), n = G(this.node.current, "pointerdown", this.startPointerPress, { passive: !(t.onTapStart || t.onPointerStart) }), s = N(this.node.current, "focus", this.startAccessiblePress);
158
+ this.removeStartListeners = rt(n, s);
159
+ }
160
+ unmount() {
161
+ this.removeStartListeners(), this.removeEndListeners(), this.removeAccessibleListeners();
162
+ }
163
+ }
164
+ const Wt = /* @__PURE__ */ new WeakMap(), It = /* @__PURE__ */ new WeakMap(), Js = (e) => {
165
+ const t = Wt.get(e.target);
166
+ t && t(e);
167
+ }, Qs = (e) => {
168
+ e.forEach(Js);
169
+ };
170
+ function ti({ root: e, ...t }) {
171
+ const n = e || document;
172
+ It.has(n) || It.set(n, {});
173
+ const s = It.get(n), o = JSON.stringify(t);
174
+ return s[o] || (s[o] = new IntersectionObserver(Qs, { root: e, ...t })), s[o];
175
+ }
176
+ function ei(e, t, n) {
177
+ const s = ti(t);
178
+ return Wt.set(e, n), s.observe(e), () => {
179
+ Wt.delete(e), s.unobserve(e);
180
+ };
181
+ }
182
+ const ni = {
183
+ some: 0,
184
+ all: 1
185
+ };
186
+ class si extends q {
187
+ constructor() {
188
+ super(...arguments), this.hasEnteredView = !1, this.isInView = !1;
189
+ }
190
+ startObserver() {
191
+ this.unmount();
192
+ const { viewport: t = {} } = this.node.getProps(), { root: n, margin: s, amount: o = "some", once: c } = t, i = {
193
+ root: n ? n.current : void 0,
194
+ rootMargin: s,
195
+ threshold: typeof o == "number" ? o : ni[o]
196
+ }, r = (a) => {
197
+ const { isIntersecting: l } = a;
198
+ if (this.isInView === l || (this.isInView = l, c && !l && this.hasEnteredView))
199
+ return;
200
+ l && (this.hasEnteredView = !0), this.node.animationState && this.node.animationState.setActive("whileInView", l);
201
+ const { onViewportEnter: u, onViewportLeave: h } = this.node.getProps(), f = l ? u : h;
202
+ f && f(a);
203
+ };
204
+ return ei(this.node.current, i, r);
205
+ }
206
+ mount() {
207
+ this.startObserver();
208
+ }
209
+ update() {
210
+ if (typeof IntersectionObserver > "u")
211
+ return;
212
+ const { props: t, prevProps: n } = this.node;
213
+ ["amount", "margin", "root"].some(ii(t, n)) && this.startObserver();
214
+ }
215
+ unmount() {
216
+ }
217
+ }
218
+ function ii({ viewport: e = {} }, { viewport: t = {} } = {}) {
219
+ return (n) => e[n] !== t[n];
220
+ }
221
+ const oi = {
222
+ inView: {
223
+ Feature: si
224
+ },
225
+ tap: {
226
+ Feature: Zs
227
+ },
228
+ focus: {
229
+ Feature: Xs
230
+ },
231
+ hover: {
232
+ Feature: qs
233
+ }
234
+ };
235
+ function jn(e, t) {
236
+ if (!Array.isArray(t))
237
+ return !1;
238
+ const n = t.length;
239
+ if (n !== e.length)
240
+ return !1;
241
+ for (let s = 0; s < n; s++)
242
+ if (t[s] !== e[s])
243
+ return !1;
244
+ return !0;
245
+ }
246
+ function ri(e) {
247
+ const t = {};
248
+ return e.values.forEach((n, s) => t[s] = n.get()), t;
249
+ }
250
+ function ai(e) {
251
+ const t = {};
252
+ return e.values.forEach((n, s) => t[s] = n.getVelocity()), t;
253
+ }
254
+ function Bt(e, t, n) {
255
+ const s = e.getProps();
256
+ return mn(s, t, n !== void 0 ? n : s.custom, ri(e), ai(e));
257
+ }
258
+ const li = "framerAppearId", ci = "data-" + gn(li), Y = (e) => e * 1e3, K = (e) => e / 1e3, ui = {
259
+ current: !1
260
+ }, kn = (e) => Array.isArray(e) && typeof e[0] == "number";
261
+ function In(e) {
262
+ return !!(!e || typeof e == "string" && On[e] || kn(e) || Array.isArray(e) && e.every(In));
263
+ }
264
+ const pt = ([e, t, n, s]) => `cubic-bezier(${e}, ${t}, ${n}, ${s})`, On = {
265
+ linear: "linear",
266
+ ease: "ease",
267
+ easeIn: "ease-in",
268
+ easeOut: "ease-out",
269
+ easeInOut: "ease-in-out",
270
+ circIn: pt([0, 0.65, 0.55, 1]),
271
+ circOut: pt([0.55, 0, 1, 0.45]),
272
+ backIn: pt([0.31, 0.01, 0.66, -0.59]),
273
+ backOut: pt([0.33, 1.53, 0.69, 0.99])
274
+ };
275
+ function Un(e) {
276
+ if (e)
277
+ return kn(e) ? pt(e) : Array.isArray(e) ? e.map(Un) : On[e];
278
+ }
279
+ function hi(e, t, n, { delay: s = 0, duration: o, repeat: c = 0, repeatType: i = "loop", ease: r, times: a } = {}) {
280
+ const l = { [t]: n };
281
+ a && (l.offset = a);
282
+ const u = Un(r);
283
+ return Array.isArray(u) && (l.easing = u), e.animate(l, {
284
+ delay: s,
285
+ duration: o,
286
+ easing: Array.isArray(u) ? "linear" : u,
287
+ fill: "both",
288
+ iterations: c + 1,
289
+ direction: i === "reverse" ? "alternate" : "normal"
290
+ });
291
+ }
292
+ function fi(e, { repeat: t, repeatType: n = "loop" }) {
293
+ const s = t && n !== "loop" && t % 2 === 1 ? 0 : e.length - 1;
294
+ return e[s];
295
+ }
296
+ const Nn = (e, t, n) => (((1 - 3 * n + 3 * t) * e + (3 * n - 6 * t)) * e + 3 * t) * e, di = 1e-7, pi = 12;
297
+ function mi(e, t, n, s, o) {
298
+ let c, i, r = 0;
299
+ do
300
+ i = t + (n - t) / 2, c = Nn(i, s, o) - e, c > 0 ? n = i : t = i;
301
+ while (Math.abs(c) > di && ++r < pi);
302
+ return i;
303
+ }
304
+ function Tt(e, t, n, s) {
305
+ if (e === t && n === s)
306
+ return B;
307
+ const o = (c) => mi(c, 0, 1, e, n);
308
+ return (c) => c === 0 || c === 1 ? c : Nn(o(c), t, s);
309
+ }
310
+ const gi = Tt(0.42, 0, 1, 1), yi = Tt(0, 0, 0.58, 1), Gn = Tt(0.42, 0, 0.58, 1), vi = (e) => Array.isArray(e) && typeof e[0] != "number", Kn = (e) => (t) => t <= 0.5 ? e(2 * t) / 2 : (2 - e(2 * (1 - t))) / 2, $n = (e) => (t) => 1 - e(1 - t), zn = (e) => 1 - Math.sin(Math.acos(e)), oe = $n(zn), Pi = Kn(oe), Hn = Tt(0.33, 1.53, 0.69, 0.99), re = $n(Hn), xi = Kn(re), Ti = (e) => (e *= 2) < 1 ? 0.5 * re(e) : 0.5 * (2 - Math.pow(2, -10 * (e - 1))), Te = {
311
+ linear: B,
312
+ easeIn: gi,
313
+ easeInOut: Gn,
314
+ easeOut: yi,
315
+ circIn: zn,
316
+ circInOut: Pi,
317
+ circOut: oe,
318
+ backIn: re,
319
+ backInOut: xi,
320
+ backOut: Hn,
321
+ anticipate: Ti
322
+ }, Ve = (e) => {
323
+ if (Array.isArray(e)) {
324
+ tt(e.length === 4, "Cubic bezier arrays must contain four numerical values.");
325
+ const [t, n, s, o] = e;
326
+ return Tt(t, n, s, o);
327
+ } else if (typeof e == "string")
328
+ return tt(Te[e] !== void 0, `Invalid easing type '${e}'`), Te[e];
329
+ return e;
330
+ };
331
+ function Vi(e, t) {
332
+ return e.map((n) => n * t);
333
+ }
334
+ function Si(e, t) {
335
+ return e.map(() => t || Gn).splice(0, e.length - 1);
336
+ }
337
+ function Ct({ duration: e = 300, keyframes: t, times: n, ease: s = "easeInOut" }) {
338
+ const o = vi(s) ? s.map(Ve) : Ve(s), c = {
339
+ done: !1,
340
+ value: t[0]
341
+ }, i = Vi(
342
+ // Only use the provided offsets if they're the correct length
343
+ // TODO Maybe we should warn here if there's a length mismatch
344
+ n && n.length === t.length ? n : Ts(t),
345
+ e
346
+ ), r = yn(i, t, {
347
+ ease: Array.isArray(o) ? o : Si(t, o)
348
+ });
349
+ return {
350
+ calculatedDuration: e,
351
+ next: (a) => (c.value = r(a), c.done = a >= e, c)
352
+ };
353
+ }
354
+ const bi = 5;
355
+ function _n(e, t, n) {
356
+ const s = Math.max(t - bi, 0);
357
+ return Vs(n - e(s), t - s);
358
+ }
359
+ const Ot = 1e-3, Ai = 0.01, Se = 10, Di = 0.05, Ci = 1;
360
+ function Mi({ duration: e = 800, bounce: t = 0.25, velocity: n = 0, mass: s = 1 }) {
361
+ let o, c;
362
+ ie(e <= Y(Se), "Spring duration must be 10 seconds or less");
363
+ let i = 1 - t;
364
+ i = yt(Di, Ci, i), e = yt(Ai, Se, K(e)), i < 1 ? (o = (l) => {
365
+ const u = l * i, h = u * e, f = u - n, d = Yt(l, i), p = Math.exp(-h);
366
+ return Ot - f / d * p;
367
+ }, c = (l) => {
368
+ const h = l * i * e, f = h * n + n, d = Math.pow(i, 2) * Math.pow(l, 2) * e, p = Math.exp(-h), m = Yt(Math.pow(l, 2), i);
369
+ return (-o(l) + Ot > 0 ? -1 : 1) * ((f - d) * p) / m;
370
+ }) : (o = (l) => {
371
+ const u = Math.exp(-l * e), h = (l - n) * e + 1;
372
+ return -Ot + u * h;
373
+ }, c = (l) => {
374
+ const u = Math.exp(-l * e), h = (n - l) * (e * e);
375
+ return u * h;
376
+ });
377
+ const r = 5 / e, a = Li(o, c, r);
378
+ if (e = Y(e), isNaN(a))
379
+ return {
380
+ stiffness: 100,
381
+ damping: 10,
382
+ duration: e
383
+ };
384
+ {
385
+ const l = Math.pow(a, 2) * s;
386
+ return {
387
+ stiffness: l,
388
+ damping: i * 2 * Math.sqrt(s * l),
389
+ duration: e
390
+ };
391
+ }
392
+ }
393
+ const wi = 12;
394
+ function Li(e, t, n) {
395
+ let s = n;
396
+ for (let o = 1; o < wi; o++)
397
+ s = s - e(s) / t(s);
398
+ return s;
399
+ }
400
+ function Yt(e, t) {
401
+ return e * Math.sqrt(1 - t * t);
402
+ }
403
+ const Ri = ["duration", "bounce"], Bi = ["stiffness", "damping", "mass"];
404
+ function be(e, t) {
405
+ return t.some((n) => e[n] !== void 0);
406
+ }
407
+ function Fi(e) {
408
+ let t = {
409
+ velocity: 0,
410
+ stiffness: 100,
411
+ damping: 10,
412
+ mass: 1,
413
+ isResolvedFromDuration: !1,
414
+ ...e
415
+ };
416
+ if (!be(e, Bi) && be(e, Ri)) {
417
+ const n = Mi(e);
418
+ t = {
419
+ ...t,
420
+ ...n,
421
+ velocity: 0,
422
+ mass: 1
423
+ }, t.isResolvedFromDuration = !0;
424
+ }
425
+ return t;
426
+ }
427
+ function Wn({ keyframes: e, restDelta: t, restSpeed: n, ...s }) {
428
+ const o = e[0], c = e[e.length - 1], i = { done: !1, value: o }, { stiffness: r, damping: a, mass: l, velocity: u, duration: h, isResolvedFromDuration: f } = Fi(s), d = u ? -K(u) : 0, p = a / (2 * Math.sqrt(r * l)), m = c - o, v = K(Math.sqrt(r / l)), V = Math.abs(m) < 5;
429
+ n || (n = V ? 0.01 : 2), t || (t = V ? 5e-3 : 0.5);
430
+ let y;
431
+ if (p < 1) {
432
+ const g = Yt(v, p);
433
+ y = (P) => {
434
+ const x = Math.exp(-p * v * P);
435
+ return c - x * ((d + p * v * m) / g * Math.sin(g * P) + m * Math.cos(g * P));
436
+ };
437
+ } else if (p === 1)
438
+ y = (g) => c - Math.exp(-v * g) * (m + (d + v * m) * g);
439
+ else {
440
+ const g = v * Math.sqrt(p * p - 1);
441
+ y = (P) => {
442
+ const x = Math.exp(-p * v * P), F = Math.min(g * P, 300);
443
+ return c - x * ((d + p * v * m) * Math.sinh(F) + g * m * Math.cosh(F)) / g;
444
+ };
445
+ }
446
+ return {
447
+ calculatedDuration: f && h || null,
448
+ next: (g) => {
449
+ const P = y(g);
450
+ if (f)
451
+ i.done = g >= h;
452
+ else {
453
+ let x = d;
454
+ g !== 0 && (p < 1 ? x = _n(y, g, P) : x = 0);
455
+ const F = Math.abs(x) <= n, S = Math.abs(c - P) <= t;
456
+ i.done = F && S;
457
+ }
458
+ return i.value = i.done ? c : P, i;
459
+ }
460
+ };
461
+ }
462
+ function Ae({ keyframes: e, velocity: t = 0, power: n = 0.8, timeConstant: s = 325, bounceDamping: o = 10, bounceStiffness: c = 500, modifyTarget: i, min: r, max: a, restDelta: l = 0.5, restSpeed: u }) {
463
+ const h = e[0], f = {
464
+ done: !1,
465
+ value: h
466
+ }, d = (T) => r !== void 0 && T < r || a !== void 0 && T > a, p = (T) => r === void 0 ? a : a === void 0 || Math.abs(r - T) < Math.abs(a - T) ? r : a;
467
+ let m = n * t;
468
+ const v = h + m, V = i === void 0 ? v : i(v);
469
+ V !== v && (m = V - h);
470
+ const y = (T) => -m * Math.exp(-T / s), g = (T) => V + y(T), P = (T) => {
471
+ const A = y(T), O = g(T);
472
+ f.done = Math.abs(A) <= l, f.value = f.done ? V : O;
473
+ };
474
+ let x, F;
475
+ const S = (T) => {
476
+ d(f.value) && (x = T, F = Wn({
477
+ keyframes: [f.value, p(f.value)],
478
+ velocity: _n(g, T, f.value),
479
+ damping: o,
480
+ stiffness: c,
481
+ restDelta: l,
482
+ restSpeed: u
483
+ }));
484
+ };
485
+ return S(0), {
486
+ calculatedDuration: null,
487
+ next: (T) => {
488
+ let A = !1;
489
+ return !F && x === void 0 && (A = !0, P(T), S(T)), x !== void 0 && T > x ? F.next(T - x) : (!A && P(T), f);
490
+ }
491
+ };
492
+ }
493
+ const Ei = (e) => {
494
+ const t = ({ timestamp: n }) => e(n);
495
+ return {
496
+ start: () => C.update(t, !0),
497
+ stop: () => $(t),
498
+ /**
499
+ * If we're processing this frame we can use the
500
+ * framelocked timestamp to keep things in sync.
501
+ */
502
+ now: () => R.isProcessing ? R.timestamp : performance.now()
503
+ };
504
+ }, De = 2e4;
505
+ function Ce(e) {
506
+ let t = 0;
507
+ const n = 50;
508
+ let s = e.next(t);
509
+ for (; !s.done && t < De; )
510
+ t += n, s = e.next(t);
511
+ return t >= De ? 1 / 0 : t;
512
+ }
513
+ const ji = {
514
+ decay: Ae,
515
+ inertia: Ae,
516
+ tween: Ct,
517
+ keyframes: Ct,
518
+ spring: Wn
519
+ };
520
+ function Mt({ autoplay: e = !0, delay: t = 0, driver: n = Ei, keyframes: s, type: o = "keyframes", repeat: c = 0, repeatDelay: i = 0, repeatType: r = "loop", onPlay: a, onStop: l, onComplete: u, onUpdate: h, ...f }) {
521
+ let d = 1, p = !1, m, v;
522
+ const V = () => {
523
+ v = new Promise((b) => {
524
+ m = b;
525
+ });
526
+ };
527
+ V();
528
+ let y;
529
+ const g = ji[o] || Ct;
530
+ let P;
531
+ g !== Ct && typeof s[0] != "number" && (P = yn([0, 100], s, {
532
+ clamp: !1
533
+ }), s = [0, 100]);
534
+ const x = g({ ...f, keyframes: s });
535
+ let F;
536
+ r === "mirror" && (F = g({
537
+ ...f,
538
+ keyframes: [...s].reverse(),
539
+ velocity: -(f.velocity || 0)
540
+ }));
541
+ let S = "idle", T = null, A = null, O = null;
542
+ x.calculatedDuration === null && c && (x.calculatedDuration = Ce(x));
543
+ const { calculatedDuration: U } = x;
544
+ let z = 1 / 0, H = 1 / 0;
545
+ U !== null && (z = U + i, H = z * (c + 1) - i);
546
+ let L = 0;
547
+ const M = (b) => {
548
+ if (A === null)
549
+ return;
550
+ d > 0 && (A = Math.min(A, b)), d < 0 && (A = Math.min(b - H / d, A)), T !== null ? L = T : L = Math.round(b - A) * d;
551
+ const ct = L - t * (d >= 0 ? 1 : -1), he = d >= 0 ? ct < 0 : ct > H;
552
+ L = Math.max(ct, 0), S === "finished" && T === null && (L = H);
553
+ let fe = L, de = x;
554
+ if (c) {
555
+ const Ft = L / z;
556
+ let Vt = Math.floor(Ft), X = Ft % 1;
557
+ !X && Ft >= 1 && (X = 1), X === 1 && Vt--, Vt = Math.min(Vt, c + 1);
558
+ const me = !!(Vt % 2);
559
+ me && (r === "reverse" ? (X = 1 - X, i && (X -= i / z)) : r === "mirror" && (de = F));
560
+ let ge = yt(0, 1, X);
561
+ L > H && (ge = r === "reverse" && me ? 1 : 0), fe = ge * z;
562
+ }
563
+ const ut = he ? { done: !1, value: s[0] } : de.next(fe);
564
+ P && (ut.value = P(ut.value));
565
+ let { done: pe } = ut;
566
+ !he && U !== null && (pe = d >= 0 ? L >= H : L <= 0);
567
+ const xs = T === null && (S === "finished" || S === "running" && pe);
568
+ return h && h(ut.value), xs && Ps(), ut;
569
+ }, _ = () => {
570
+ y && y.stop(), y = void 0;
571
+ }, st = () => {
572
+ S = "idle", _(), m(), V(), A = O = null;
573
+ }, Ps = () => {
574
+ S = "finished", u && u(), _(), m();
575
+ }, ce = () => {
576
+ if (p)
577
+ return;
578
+ y || (y = n(M));
579
+ const b = y.now();
580
+ a && a(), T !== null ? A = b - T : (!A || S === "finished") && (A = b), S === "finished" && V(), O = A, T = null, S = "running", y.start();
581
+ };
582
+ e && ce();
583
+ const ue = {
584
+ then(b, ct) {
585
+ return v.then(b, ct);
586
+ },
587
+ get time() {
588
+ return K(L);
589
+ },
590
+ set time(b) {
591
+ b = Y(b), L = b, T !== null || !y || d === 0 ? T = b : A = y.now() - b / d;
592
+ },
593
+ get duration() {
594
+ const b = x.calculatedDuration === null ? Ce(x) : x.calculatedDuration;
595
+ return K(b);
596
+ },
597
+ get speed() {
598
+ return d;
599
+ },
600
+ set speed(b) {
601
+ b === d || !y || (d = b, ue.time = K(L));
602
+ },
603
+ get state() {
604
+ return S;
605
+ },
606
+ play: ce,
607
+ pause: () => {
608
+ S = "paused", T = L;
609
+ },
610
+ stop: () => {
611
+ p = !0, S !== "idle" && (S = "idle", l && l(), st());
612
+ },
613
+ cancel: () => {
614
+ O !== null && M(O), st();
615
+ },
616
+ complete: () => {
617
+ S = "finished";
618
+ },
619
+ sample: (b) => (A = 0, M(b))
620
+ };
621
+ return ue;
622
+ }
623
+ function ki(e) {
624
+ let t;
625
+ return () => (t === void 0 && (t = e()), t);
626
+ }
627
+ const Ii = ki(() => Object.hasOwnProperty.call(Element.prototype, "animate")), Oi = /* @__PURE__ */ new Set([
628
+ "opacity",
629
+ "clipPath",
630
+ "filter",
631
+ "transform",
632
+ "backgroundColor"
633
+ ]), St = 10, Ui = 2e4, Ni = (e, t) => t.type === "spring" || e === "backgroundColor" || !In(t.ease);
634
+ function Gi(e, t, { onUpdate: n, onComplete: s, ...o }) {
635
+ if (!(Ii() && Oi.has(t) && !o.repeatDelay && o.repeatType !== "mirror" && o.damping !== 0 && o.type !== "inertia"))
636
+ return !1;
637
+ let i = !1, r, a;
638
+ const l = () => {
639
+ a = new Promise((y) => {
640
+ r = y;
641
+ });
642
+ };
643
+ l();
644
+ let { keyframes: u, duration: h = 300, ease: f, times: d } = o;
645
+ if (Ni(t, o)) {
646
+ const y = Mt({
647
+ ...o,
648
+ repeat: 0,
649
+ delay: 0
650
+ });
651
+ let g = { done: !1, value: u[0] };
652
+ const P = [];
653
+ let x = 0;
654
+ for (; !g.done && x < Ui; )
655
+ g = y.sample(x), P.push(g.value), x += St;
656
+ d = void 0, u = P, h = x - St, f = "linear";
657
+ }
658
+ const p = hi(e.owner.current, t, u, {
659
+ ...o,
660
+ duration: h,
661
+ /**
662
+ * This function is currently not called if ease is provided
663
+ * as a function so the cast is safe.
664
+ *
665
+ * However it would be possible for a future refinement to port
666
+ * in easing pregeneration from Motion One for browsers that
667
+ * support the upcoming `linear()` easing function.
668
+ */
669
+ ease: f,
670
+ times: d
671
+ });
672
+ o.syncStart && (p.startTime = R.isProcessing ? R.timestamp : document.timeline ? document.timeline.currentTime : performance.now());
673
+ const m = () => p.cancel(), v = () => {
674
+ C.update(m), r(), l();
675
+ };
676
+ return p.onfinish = () => {
677
+ e.set(fi(u, o)), s && s(), v();
678
+ }, {
679
+ then(y, g) {
680
+ return a.then(y, g);
681
+ },
682
+ attachTimeline(y) {
683
+ return p.timeline = y, p.onfinish = null, B;
684
+ },
685
+ get time() {
686
+ return K(p.currentTime || 0);
687
+ },
688
+ set time(y) {
689
+ p.currentTime = Y(y);
690
+ },
691
+ get speed() {
692
+ return p.playbackRate;
693
+ },
694
+ set speed(y) {
695
+ p.playbackRate = y;
696
+ },
697
+ get duration() {
698
+ return K(h);
699
+ },
700
+ play: () => {
701
+ i || (p.play(), $(m));
702
+ },
703
+ pause: () => p.pause(),
704
+ stop: () => {
705
+ if (i = !0, p.playState === "idle")
706
+ return;
707
+ const { currentTime: y } = p;
708
+ if (y) {
709
+ const g = Mt({
710
+ ...o,
711
+ autoplay: !1
712
+ });
713
+ e.setWithVelocity(g.sample(y - St).value, g.sample(y).value, St);
714
+ }
715
+ v();
716
+ },
717
+ complete: () => p.finish(),
718
+ cancel: v
719
+ };
720
+ }
721
+ function Ki({ keyframes: e, delay: t, onUpdate: n, onComplete: s }) {
722
+ const o = () => (n && n(e[e.length - 1]), s && s(), {
723
+ time: 0,
724
+ speed: 1,
725
+ duration: 0,
726
+ play: B,
727
+ pause: B,
728
+ stop: B,
729
+ then: (c) => (c(), Promise.resolve()),
730
+ cancel: B,
731
+ complete: B
732
+ });
733
+ return t ? Mt({
734
+ keyframes: [0, 1],
735
+ duration: 0,
736
+ delay: t,
737
+ onComplete: o
738
+ }) : o();
739
+ }
740
+ const $i = {
741
+ type: "spring",
742
+ stiffness: 500,
743
+ damping: 25,
744
+ restSpeed: 10
745
+ }, zi = (e) => ({
746
+ type: "spring",
747
+ stiffness: 550,
748
+ damping: e === 0 ? 2 * Math.sqrt(550) : 30,
749
+ restSpeed: 10
750
+ }), Hi = {
751
+ type: "keyframes",
752
+ duration: 0.8
753
+ }, _i = {
754
+ type: "keyframes",
755
+ ease: [0.25, 0.1, 0.35, 1],
756
+ duration: 0.3
757
+ }, Wi = (e, { keyframes: t }) => t.length > 2 ? Hi : Pt.has(e) ? e.startsWith("scale") ? zi(t[1]) : $i : _i, qt = (e, t) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string
758
+ (et.test(t) || t === "0") && // And it contains numbers and/or colors
759
+ !t.startsWith("url(")), Yi = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]);
760
+ function qi(e) {
761
+ const [t, n] = e.slice(0, -1).split("(");
762
+ if (t === "drop-shadow")
763
+ return e;
764
+ const [s] = n.match(Ss) || [];
765
+ if (!s)
766
+ return e;
767
+ const o = n.replace(s, "");
768
+ let c = Yi.has(t) ? 1 : 0;
769
+ return s !== n && (c *= 100), t + "(" + c + o + ")";
770
+ }
771
+ const Xi = /([a-z-]*)\(.*?\)/g, Xt = {
772
+ ...et,
773
+ getAnimatableNone: (e) => {
774
+ const t = e.match(Xi);
775
+ return t ? t.map(qi).join(" ") : e;
776
+ }
777
+ }, Zi = {
778
+ ...bs,
779
+ // Color props
780
+ color: k,
781
+ backgroundColor: k,
782
+ outlineColor: k,
783
+ fill: k,
784
+ stroke: k,
785
+ // Border props
786
+ borderColor: k,
787
+ borderTopColor: k,
788
+ borderRightColor: k,
789
+ borderBottomColor: k,
790
+ borderLeftColor: k,
791
+ filter: Xt,
792
+ WebkitFilter: Xt
793
+ }, ae = (e) => Zi[e];
794
+ function Yn(e, t) {
795
+ let n = ae(e);
796
+ return n !== Xt && (n = et), n.getAnimatableNone ? n.getAnimatableNone(t) : void 0;
797
+ }
798
+ const qn = (e) => /^0[^.\s]+$/.test(e);
799
+ function Ji(e) {
800
+ if (typeof e == "number")
801
+ return e === 0;
802
+ if (e !== null)
803
+ return e === "none" || e === "0" || qn(e);
804
+ }
805
+ function Qi(e, t, n, s) {
806
+ const o = qt(t, n);
807
+ let c;
808
+ Array.isArray(n) ? c = [...n] : c = [null, n];
809
+ const i = s.from !== void 0 ? s.from : e.get();
810
+ let r;
811
+ const a = [];
812
+ for (let l = 0; l < c.length; l++)
813
+ c[l] === null && (c[l] = l === 0 ? i : c[l - 1]), Ji(c[l]) && a.push(l), typeof c[l] == "string" && c[l] !== "none" && c[l] !== "0" && (r = c[l]);
814
+ if (o && a.length && r)
815
+ for (let l = 0; l < a.length; l++) {
816
+ const u = a[l];
817
+ c[u] = Yn(t, r);
818
+ }
819
+ return c;
820
+ }
821
+ function to({ when: e, delay: t, delayChildren: n, staggerChildren: s, staggerDirection: o, repeat: c, repeatType: i, repeatDelay: r, from: a, elapsed: l, ...u }) {
822
+ return !!Object.keys(u).length;
823
+ }
824
+ function Xn(e, t) {
825
+ return e[t] || e.default || e;
826
+ }
827
+ const le = (e, t, n, s = {}) => (o) => {
828
+ const c = Xn(s, e) || {}, i = c.delay || s.delay || 0;
829
+ let { elapsed: r = 0 } = s;
830
+ r = r - Y(i);
831
+ const a = Qi(t, e, n, c), l = a[0], u = a[a.length - 1], h = qt(e, l), f = qt(e, u);
832
+ ie(h === f, `You are trying to animate ${e} from "${l}" to "${u}". ${l} is not an animatable value - to enable this animation set ${l} to a value animatable to ${u} via the \`style\` property.`);
833
+ let d = {
834
+ keyframes: a,
835
+ velocity: t.getVelocity(),
836
+ ease: "easeOut",
837
+ ...c,
838
+ delay: -r,
839
+ onUpdate: (p) => {
840
+ t.set(p), c.onUpdate && c.onUpdate(p);
841
+ },
842
+ onComplete: () => {
843
+ o(), c.onComplete && c.onComplete();
844
+ }
845
+ };
846
+ if (to(c) || (d = {
847
+ ...d,
848
+ ...Wi(e, d)
849
+ }), d.duration && (d.duration = Y(d.duration)), d.repeatDelay && (d.repeatDelay = Y(d.repeatDelay)), !h || !f || ui.current || c.type === !1)
850
+ return Ki(d);
851
+ if (t.owner && t.owner.current instanceof HTMLElement && !t.owner.getProps().onUpdate) {
852
+ const p = Gi(t, e, d);
853
+ if (p)
854
+ return p;
855
+ }
856
+ return Mt(d);
857
+ };
858
+ function wt(e) {
859
+ return !!(nt(e) && e.add);
860
+ }
861
+ const Zn = (e) => /^\-?\d*\.?\d+$/.test(e), Jn = (e) => (t) => t.test(e), eo = {
862
+ test: (e) => e === "auto",
863
+ parse: (e) => e
864
+ }, Qn = [vn, xt, vt, As, Ds, Cs, eo], ht = (e) => Qn.find(Jn(e)), no = [...Qn, k, et], so = (e) => no.find(Jn(e));
865
+ function io(e, t, n) {
866
+ e.hasValue(t) ? e.getValue(t).set(n) : e.addValue(t, at(n));
867
+ }
868
+ function oo(e, t) {
869
+ const n = Bt(e, t);
870
+ let { transitionEnd: s = {}, transition: o = {}, ...c } = n ? e.makeTargetAnimatable(n, !1) : {};
871
+ c = { ...c, ...s };
872
+ for (const i in c) {
873
+ const r = Ms(c[i]);
874
+ io(e, i, r);
875
+ }
876
+ }
877
+ function ro(e, t, n) {
878
+ var s, o;
879
+ const c = Object.keys(t).filter((r) => !e.hasValue(r)), i = c.length;
880
+ if (i)
881
+ for (let r = 0; r < i; r++) {
882
+ const a = c[r], l = t[a];
883
+ let u = null;
884
+ Array.isArray(l) && (u = l[0]), u === null && (u = (o = (s = n[a]) !== null && s !== void 0 ? s : e.readValue(a)) !== null && o !== void 0 ? o : t[a]), u != null && (typeof u == "string" && (Zn(u) || qn(u)) ? u = parseFloat(u) : !so(u) && et.test(l) && (u = Yn(a, l)), e.addValue(a, at(u, { owner: e })), n[a] === void 0 && (n[a] = u), u !== null && e.setBaseTarget(a, u));
885
+ }
886
+ }
887
+ function ao(e, t) {
888
+ return t ? (t[e] || t.default || t).from : void 0;
889
+ }
890
+ function lo(e, t, n) {
891
+ const s = {};
892
+ for (const o in e) {
893
+ const c = ao(o, t);
894
+ if (c !== void 0)
895
+ s[o] = c;
896
+ else {
897
+ const i = n.getValue(o);
898
+ i && (s[o] = i.get());
899
+ }
900
+ }
901
+ return s;
902
+ }
903
+ function co({ protectedKeys: e, needsAnimating: t }, n) {
904
+ const s = e.hasOwnProperty(n) && t[n] !== !0;
905
+ return t[n] = !1, s;
906
+ }
907
+ function ts(e, t, { delay: n = 0, transitionOverride: s, type: o } = {}) {
908
+ let { transition: c = e.getDefaultTransition(), transitionEnd: i, ...r } = e.makeTargetAnimatable(t);
909
+ const a = e.getValue("willChange");
910
+ s && (c = s);
911
+ const l = [], u = o && e.animationState && e.animationState.getState()[o];
912
+ for (const h in r) {
913
+ const f = e.getValue(h), d = r[h];
914
+ if (!f || d === void 0 || u && co(u, h))
915
+ continue;
916
+ const p = {
917
+ delay: n,
918
+ elapsed: 0,
919
+ ...c
920
+ };
921
+ if (window.HandoffAppearAnimations && !f.hasAnimated) {
922
+ const v = e.getProps()[ci];
923
+ v && (p.elapsed = window.HandoffAppearAnimations(v, h, f, C), p.syncStart = !0);
924
+ }
925
+ f.start(le(h, f, d, e.shouldReduceMotion && Pt.has(h) ? { type: !1 } : p));
926
+ const m = f.animation;
927
+ wt(a) && (a.add(h), m.then(() => a.remove(h))), l.push(m);
928
+ }
929
+ return i && Promise.all(l).then(() => {
930
+ i && oo(e, i);
931
+ }), l;
932
+ }
933
+ function Zt(e, t, n = {}) {
934
+ const s = Bt(e, t, n.custom);
935
+ let { transition: o = e.getDefaultTransition() || {} } = s || {};
936
+ n.transitionOverride && (o = n.transitionOverride);
937
+ const c = s ? () => Promise.all(ts(e, s, n)) : () => Promise.resolve(), i = e.variantChildren && e.variantChildren.size ? (a = 0) => {
938
+ const { delayChildren: l = 0, staggerChildren: u, staggerDirection: h } = o;
939
+ return uo(e, t, l + a, u, h, n);
940
+ } : () => Promise.resolve(), { when: r } = o;
941
+ if (r) {
942
+ const [a, l] = r === "beforeChildren" ? [c, i] : [i, c];
943
+ return a().then(() => l());
944
+ } else
945
+ return Promise.all([c(), i(n.delay)]);
946
+ }
947
+ function uo(e, t, n = 0, s = 0, o = 1, c) {
948
+ const i = [], r = (e.variantChildren.size - 1) * s, a = o === 1 ? (l = 0) => l * s : (l = 0) => r - l * s;
949
+ return Array.from(e.variantChildren).sort(ho).forEach((l, u) => {
950
+ l.notify("AnimationStart", t), i.push(Zt(l, t, {
951
+ ...c,
952
+ delay: n + a(u)
953
+ }).then(() => l.notify("AnimationComplete", t)));
954
+ }), Promise.all(i);
955
+ }
956
+ function ho(e, t) {
957
+ return e.sortNodePosition(t);
958
+ }
959
+ function fo(e, t, n = {}) {
960
+ e.notify("AnimationStart", t);
961
+ let s;
962
+ if (Array.isArray(t)) {
963
+ const o = t.map((c) => Zt(e, c, n));
964
+ s = Promise.all(o);
965
+ } else if (typeof t == "string")
966
+ s = Zt(e, t, n);
967
+ else {
968
+ const o = typeof t == "function" ? Bt(e, t, n.custom) : t;
969
+ s = Promise.all(ts(e, o, n));
970
+ }
971
+ return s.then(() => e.notify("AnimationComplete", t));
972
+ }
973
+ const po = [...xn].reverse(), mo = xn.length;
974
+ function go(e) {
975
+ return (t) => Promise.all(t.map(({ animation: n, options: s }) => fo(e, n, s)));
976
+ }
977
+ function yo(e) {
978
+ let t = go(e);
979
+ const n = Po();
980
+ let s = !0;
981
+ const o = (a, l) => {
982
+ const u = Bt(e, l);
983
+ if (u) {
984
+ const { transition: h, transitionEnd: f, ...d } = u;
985
+ a = { ...a, ...d, ...f };
986
+ }
987
+ return a;
988
+ };
989
+ function c(a) {
990
+ t = a(e);
991
+ }
992
+ function i(a, l) {
993
+ const u = e.getProps(), h = e.getVariantContext(!0) || {}, f = [], d = /* @__PURE__ */ new Set();
994
+ let p = {}, m = 1 / 0;
995
+ for (let V = 0; V < mo; V++) {
996
+ const y = po[V], g = n[y], P = u[y] !== void 0 ? u[y] : h[y], x = Tn(P), F = y === l ? g.isActive : null;
997
+ F === !1 && (m = V);
998
+ let S = P === h[y] && P !== u[y] && x;
999
+ if (S && s && e.manuallyAnimateOnMount && (S = !1), g.protectedKeys = { ...p }, // If it isn't active and hasn't *just* been set as inactive
1000
+ !g.isActive && F === null || // If we didn't and don't have any defined prop for this animation type
1001
+ !P && !g.prevProp || // Or if the prop doesn't define an animation
1002
+ Pn(P) || typeof P == "boolean")
1003
+ continue;
1004
+ const T = vo(g.prevProp, P);
1005
+ let A = T || // If we're making this variant active, we want to always make it active
1006
+ y === l && g.isActive && !S && x || // If we removed a higher-priority variant (i is in reverse order)
1007
+ V > m && x;
1008
+ const O = Array.isArray(P) ? P : [P];
1009
+ let U = O.reduce(o, {});
1010
+ F === !1 && (U = {});
1011
+ const { prevResolvedValues: z = {} } = g, H = {
1012
+ ...z,
1013
+ ...U
1014
+ }, L = (M) => {
1015
+ A = !0, d.delete(M), g.needsAnimating[M] = !0;
1016
+ };
1017
+ for (const M in H) {
1018
+ const _ = U[M], st = z[M];
1019
+ p.hasOwnProperty(M) || (_ !== st ? $t(_) && $t(st) ? !jn(_, st) || T ? L(M) : g.protectedKeys[M] = !0 : _ !== void 0 ? L(M) : d.add(M) : _ !== void 0 && d.has(M) ? L(M) : g.protectedKeys[M] = !0);
1020
+ }
1021
+ g.prevProp = P, g.prevResolvedValues = U, g.isActive && (p = { ...p, ...U }), s && e.blockInitialAnimation && (A = !1), A && !S && f.push(...O.map((M) => ({
1022
+ animation: M,
1023
+ options: { type: y, ...a }
1024
+ })));
1025
+ }
1026
+ if (d.size) {
1027
+ const V = {};
1028
+ d.forEach((y) => {
1029
+ const g = e.getBaseTarget(y);
1030
+ g !== void 0 && (V[y] = g);
1031
+ }), f.push({ animation: V });
1032
+ }
1033
+ let v = !!f.length;
1034
+ return s && u.initial === !1 && !e.manuallyAnimateOnMount && (v = !1), s = !1, v ? t(f) : Promise.resolve();
1035
+ }
1036
+ function r(a, l, u) {
1037
+ var h;
1038
+ if (n[a].isActive === l)
1039
+ return Promise.resolve();
1040
+ (h = e.variantChildren) === null || h === void 0 || h.forEach((d) => {
1041
+ var p;
1042
+ return (p = d.animationState) === null || p === void 0 ? void 0 : p.setActive(a, l);
1043
+ }), n[a].isActive = l;
1044
+ const f = i(u, a);
1045
+ for (const d in n)
1046
+ n[d].protectedKeys = {};
1047
+ return f;
1048
+ }
1049
+ return {
1050
+ animateChanges: i,
1051
+ setActive: r,
1052
+ setAnimateFunction: c,
1053
+ getState: () => n
1054
+ };
1055
+ }
1056
+ function vo(e, t) {
1057
+ return typeof t == "string" ? t !== e : Array.isArray(t) ? !jn(t, e) : !1;
1058
+ }
1059
+ function Z(e = !1) {
1060
+ return {
1061
+ isActive: e,
1062
+ protectedKeys: {},
1063
+ needsAnimating: {},
1064
+ prevResolvedValues: {}
1065
+ };
1066
+ }
1067
+ function Po() {
1068
+ return {
1069
+ animate: Z(!0),
1070
+ whileInView: Z(),
1071
+ whileHover: Z(),
1072
+ whileTap: Z(),
1073
+ whileDrag: Z(),
1074
+ whileFocus: Z(),
1075
+ exit: Z()
1076
+ };
1077
+ }
1078
+ class xo extends q {
1079
+ /**
1080
+ * We dynamically generate the AnimationState manager as it contains a reference
1081
+ * to the underlying animation library. We only want to load that if we load this,
1082
+ * so people can optionally code split it out using the `m` component.
1083
+ */
1084
+ constructor(t) {
1085
+ super(t), t.animationState || (t.animationState = yo(t));
1086
+ }
1087
+ updateAnimationControlsSubscription() {
1088
+ const { animate: t } = this.node.getProps();
1089
+ this.unmount(), Pn(t) && (this.unmount = t.subscribe(this.node));
1090
+ }
1091
+ /**
1092
+ * Subscribe any provided AnimationControls to the component's VisualElement
1093
+ */
1094
+ mount() {
1095
+ this.updateAnimationControlsSubscription();
1096
+ }
1097
+ update() {
1098
+ const { animate: t } = this.node.getProps(), { animate: n } = this.node.prevProps || {};
1099
+ t !== n && this.updateAnimationControlsSubscription();
1100
+ }
1101
+ unmount() {
1102
+ }
1103
+ }
1104
+ let To = 0;
1105
+ class Vo extends q {
1106
+ constructor() {
1107
+ super(...arguments), this.id = To++;
1108
+ }
1109
+ update() {
1110
+ if (!this.node.presenceContext)
1111
+ return;
1112
+ const { isPresent: t, onExitComplete: n, custom: s } = this.node.presenceContext, { isPresent: o } = this.node.prevPresenceContext || {};
1113
+ if (!this.node.animationState || t === o)
1114
+ return;
1115
+ const c = this.node.animationState.setActive("exit", !t, { custom: s ?? this.node.getProps().custom });
1116
+ n && !t && c.then(() => n(this.id));
1117
+ }
1118
+ mount() {
1119
+ const { register: t } = this.node.presenceContext || {};
1120
+ t && (this.unmount = t(this.id));
1121
+ }
1122
+ unmount() {
1123
+ }
1124
+ }
1125
+ const So = {
1126
+ animation: {
1127
+ Feature: xo
1128
+ },
1129
+ exit: {
1130
+ Feature: Vo
1131
+ }
1132
+ }, Me = (e, t) => Math.abs(e - t);
1133
+ function bo(e, t) {
1134
+ const n = Me(e.x, t.x), s = Me(e.y, t.y);
1135
+ return Math.sqrt(n ** 2 + s ** 2);
1136
+ }
1137
+ class es {
1138
+ constructor(t, n, { transformPagePoint: s } = {}) {
1139
+ if (this.startEvent = null, this.lastMoveEvent = null, this.lastMoveEventInfo = null, this.handlers = {}, this.updatePoint = () => {
1140
+ if (!(this.lastMoveEvent && this.lastMoveEventInfo))
1141
+ return;
1142
+ const l = Nt(this.lastMoveEventInfo, this.history), u = this.startEvent !== null, h = bo(l.offset, { x: 0, y: 0 }) >= 3;
1143
+ if (!u && !h)
1144
+ return;
1145
+ const { point: f } = l, { timestamp: d } = R;
1146
+ this.history.push({ ...f, timestamp: d });
1147
+ const { onStart: p, onMove: m } = this.handlers;
1148
+ u || (p && p(this.lastMoveEvent, l), this.startEvent = this.lastMoveEvent), m && m(this.lastMoveEvent, l);
1149
+ }, this.handlePointerMove = (l, u) => {
1150
+ this.lastMoveEvent = l, this.lastMoveEventInfo = Ut(u, this.transformPagePoint), C.update(this.updatePoint, !0);
1151
+ }, this.handlePointerUp = (l, u) => {
1152
+ if (this.end(), !(this.lastMoveEvent && this.lastMoveEventInfo))
1153
+ return;
1154
+ const { onEnd: h, onSessionEnd: f } = this.handlers, d = Nt(l.type === "pointercancel" ? this.lastMoveEventInfo : Ut(u, this.transformPagePoint), this.history);
1155
+ this.startEvent && h && h(l, d), f && f(l, d);
1156
+ }, !Ln(t))
1157
+ return;
1158
+ this.handlers = n, this.transformPagePoint = s;
1159
+ const o = Rt(t), c = Ut(o, this.transformPagePoint), { point: i } = c, { timestamp: r } = R;
1160
+ this.history = [{ ...i, timestamp: r }];
1161
+ const { onSessionStart: a } = n;
1162
+ a && a(t, Nt(c, this.history)), this.removeListeners = rt(G(window, "pointermove", this.handlePointerMove), G(window, "pointerup", this.handlePointerUp), G(window, "pointercancel", this.handlePointerUp));
1163
+ }
1164
+ updateHandlers(t) {
1165
+ this.handlers = t;
1166
+ }
1167
+ end() {
1168
+ this.removeListeners && this.removeListeners(), $(this.updatePoint);
1169
+ }
1170
+ }
1171
+ function Ut(e, t) {
1172
+ return t ? { point: t(e.point) } : e;
1173
+ }
1174
+ function we(e, t) {
1175
+ return { x: e.x - t.x, y: e.y - t.y };
1176
+ }
1177
+ function Nt({ point: e }, t) {
1178
+ return {
1179
+ point: e,
1180
+ delta: we(e, ns(t)),
1181
+ offset: we(e, Ao(t)),
1182
+ velocity: Do(t, 0.1)
1183
+ };
1184
+ }
1185
+ function Ao(e) {
1186
+ return e[0];
1187
+ }
1188
+ function ns(e) {
1189
+ return e[e.length - 1];
1190
+ }
1191
+ function Do(e, t) {
1192
+ if (e.length < 2)
1193
+ return { x: 0, y: 0 };
1194
+ let n = e.length - 1, s = null;
1195
+ const o = ns(e);
1196
+ for (; n >= 0 && (s = e[n], !(o.timestamp - s.timestamp > Y(t))); )
1197
+ n--;
1198
+ if (!s)
1199
+ return { x: 0, y: 0 };
1200
+ const c = K(o.timestamp - s.timestamp);
1201
+ if (c === 0)
1202
+ return { x: 0, y: 0 };
1203
+ const i = {
1204
+ x: (o.x - s.x) / c,
1205
+ y: (o.y - s.y) / c
1206
+ };
1207
+ return i.x === 1 / 0 && (i.x = 0), i.y === 1 / 0 && (i.y = 0), i;
1208
+ }
1209
+ function E(e) {
1210
+ return e.max - e.min;
1211
+ }
1212
+ function Jt(e, t = 0, n = 0.01) {
1213
+ return Math.abs(e - t) <= n;
1214
+ }
1215
+ function Le(e, t, n, s = 0.5) {
1216
+ e.origin = s, e.originPoint = w(t.min, t.max, e.origin), e.scale = E(n) / E(t), (Jt(e.scale, 1, 1e-4) || isNaN(e.scale)) && (e.scale = 1), e.translate = w(n.min, n.max, e.origin) - e.originPoint, (Jt(e.translate) || isNaN(e.translate)) && (e.translate = 0);
1217
+ }
1218
+ function mt(e, t, n, s) {
1219
+ Le(e.x, t.x, n.x, s ? s.originX : void 0), Le(e.y, t.y, n.y, s ? s.originY : void 0);
1220
+ }
1221
+ function Re(e, t, n) {
1222
+ e.min = n.min + t.min, e.max = e.min + E(t);
1223
+ }
1224
+ function Co(e, t, n) {
1225
+ Re(e.x, t.x, n.x), Re(e.y, t.y, n.y);
1226
+ }
1227
+ function Be(e, t, n) {
1228
+ e.min = t.min - n.min, e.max = e.min + E(t);
1229
+ }
1230
+ function gt(e, t, n) {
1231
+ Be(e.x, t.x, n.x), Be(e.y, t.y, n.y);
1232
+ }
1233
+ function Mo(e, { min: t, max: n }, s) {
1234
+ return t !== void 0 && e < t ? e = s ? w(t, e, s.min) : Math.max(e, t) : n !== void 0 && e > n && (e = s ? w(n, e, s.max) : Math.min(e, n)), e;
1235
+ }
1236
+ function Fe(e, t, n) {
1237
+ return {
1238
+ min: t !== void 0 ? e.min + t : void 0,
1239
+ max: n !== void 0 ? e.max + n - (e.max - e.min) : void 0
1240
+ };
1241
+ }
1242
+ function wo(e, { top: t, left: n, bottom: s, right: o }) {
1243
+ return {
1244
+ x: Fe(e.x, n, o),
1245
+ y: Fe(e.y, t, s)
1246
+ };
1247
+ }
1248
+ function Ee(e, t) {
1249
+ let n = t.min - e.min, s = t.max - e.max;
1250
+ return t.max - t.min < e.max - e.min && ([n, s] = [s, n]), { min: n, max: s };
1251
+ }
1252
+ function Lo(e, t) {
1253
+ return {
1254
+ x: Ee(e.x, t.x),
1255
+ y: Ee(e.y, t.y)
1256
+ };
1257
+ }
1258
+ function Ro(e, t) {
1259
+ let n = 0.5;
1260
+ const s = E(e), o = E(t);
1261
+ return o > s ? n = zt(t.min, t.max - s, e.min) : s > o && (n = zt(e.min, e.max - o, t.min)), yt(0, 1, n);
1262
+ }
1263
+ function Bo(e, t) {
1264
+ const n = {};
1265
+ return t.min !== void 0 && (n.min = t.min - e.min), t.max !== void 0 && (n.max = t.max - e.min), n;
1266
+ }
1267
+ const Qt = 0.35;
1268
+ function Fo(e = Qt) {
1269
+ return e === !1 ? e = 0 : e === !0 && (e = Qt), {
1270
+ x: je(e, "left", "right"),
1271
+ y: je(e, "top", "bottom")
1272
+ };
1273
+ }
1274
+ function je(e, t, n) {
1275
+ return {
1276
+ min: ke(e, t),
1277
+ max: ke(e, n)
1278
+ };
1279
+ }
1280
+ function ke(e, t) {
1281
+ return typeof e == "number" ? e : e[t] || 0;
1282
+ }
1283
+ const Ie = () => ({
1284
+ translate: 0,
1285
+ scale: 1,
1286
+ origin: 0,
1287
+ originPoint: 0
1288
+ }), it = () => ({
1289
+ x: Ie(),
1290
+ y: Ie()
1291
+ }), Oe = () => ({ min: 0, max: 0 }), D = () => ({
1292
+ x: Oe(),
1293
+ y: Oe()
1294
+ });
1295
+ function I(e) {
1296
+ return [e("x"), e("y")];
1297
+ }
1298
+ function ss({ top: e, left: t, right: n, bottom: s }) {
1299
+ return {
1300
+ x: { min: t, max: n },
1301
+ y: { min: e, max: s }
1302
+ };
1303
+ }
1304
+ function Eo({ x: e, y: t }) {
1305
+ return { top: t.min, right: e.max, bottom: t.max, left: e.min };
1306
+ }
1307
+ function jo(e, t) {
1308
+ if (!t)
1309
+ return e;
1310
+ const n = t({ x: e.left, y: e.top }), s = t({ x: e.right, y: e.bottom });
1311
+ return {
1312
+ top: n.y,
1313
+ left: n.x,
1314
+ bottom: s.y,
1315
+ right: s.x
1316
+ };
1317
+ }
1318
+ function Gt(e) {
1319
+ return e === void 0 || e === 1;
1320
+ }
1321
+ function te({ scale: e, scaleX: t, scaleY: n }) {
1322
+ return !Gt(e) || !Gt(t) || !Gt(n);
1323
+ }
1324
+ function J(e) {
1325
+ return te(e) || is(e) || e.z || e.rotate || e.rotateX || e.rotateY;
1326
+ }
1327
+ function is(e) {
1328
+ return Ue(e.x) || Ue(e.y);
1329
+ }
1330
+ function Ue(e) {
1331
+ return e && e !== "0%";
1332
+ }
1333
+ function Lt(e, t, n) {
1334
+ const s = e - n, o = t * s;
1335
+ return n + o;
1336
+ }
1337
+ function Ne(e, t, n, s, o) {
1338
+ return o !== void 0 && (e = Lt(e, o, s)), Lt(e, n, s) + t;
1339
+ }
1340
+ function ee(e, t = 0, n = 1, s, o) {
1341
+ e.min = Ne(e.min, t, n, s, o), e.max = Ne(e.max, t, n, s, o);
1342
+ }
1343
+ function os(e, { x: t, y: n }) {
1344
+ ee(e.x, t.translate, t.scale, t.originPoint), ee(e.y, n.translate, n.scale, n.originPoint);
1345
+ }
1346
+ function ko(e, t, n, s = !1) {
1347
+ const o = n.length;
1348
+ if (!o)
1349
+ return;
1350
+ t.x = t.y = 1;
1351
+ let c, i;
1352
+ for (let r = 0; r < o; r++) {
1353
+ c = n[r], i = c.projectionDelta;
1354
+ const a = c.instance;
1355
+ a && a.style && a.style.display === "contents" || (s && c.options.layoutScroll && c.scroll && c !== c.root && ot(e, {
1356
+ x: -c.scroll.offset.x,
1357
+ y: -c.scroll.offset.y
1358
+ }), i && (t.x *= i.x.scale, t.y *= i.y.scale, os(e, i)), s && J(c.latestValues) && ot(e, c.latestValues));
1359
+ }
1360
+ t.x = Ge(t.x), t.y = Ge(t.y);
1361
+ }
1362
+ function Ge(e) {
1363
+ return Number.isInteger(e) || e > 1.0000000000001 || e < 0.999999999999 ? e : 1;
1364
+ }
1365
+ function W(e, t) {
1366
+ e.min = e.min + t, e.max = e.max + t;
1367
+ }
1368
+ function Ke(e, t, [n, s, o]) {
1369
+ const c = t[o] !== void 0 ? t[o] : 0.5, i = w(e.min, e.max, c);
1370
+ ee(e, t[n], t[s], i, t.scale);
1371
+ }
1372
+ const Io = ["x", "scaleX", "originX"], Oo = ["y", "scaleY", "originY"];
1373
+ function ot(e, t) {
1374
+ Ke(e.x, t, Io), Ke(e.y, t, Oo);
1375
+ }
1376
+ function rs(e, t) {
1377
+ return ss(jo(e.getBoundingClientRect(), t));
1378
+ }
1379
+ function Uo(e, t, n) {
1380
+ const s = rs(e, n), { scroll: o } = t;
1381
+ return o && (W(s.x, o.offset.x), W(s.y, o.offset.y)), s;
1382
+ }
1383
+ const No = /* @__PURE__ */ new WeakMap();
1384
+ class Go {
1385
+ constructor(t) {
1386
+ this.openGlobalLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = { x: 0, y: 0 }, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = D(), this.visualElement = t;
1387
+ }
1388
+ start(t, { snapToCursor: n = !1 } = {}) {
1389
+ const { presenceContext: s } = this.visualElement;
1390
+ if (s && s.isPresent === !1)
1391
+ return;
1392
+ const o = (a) => {
1393
+ this.stopAnimation(), n && this.snapToCursor(Rt(a, "page").point);
1394
+ }, c = (a, l) => {
1395
+ const { drag: u, dragPropagation: h, onDragStart: f } = this.getProps();
1396
+ if (u && !h && (this.openGlobalLock && this.openGlobalLock(), this.openGlobalLock = Bn(u), !this.openGlobalLock))
1397
+ return;
1398
+ this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), I((p) => {
1399
+ let m = this.getAxisMotionValue(p).get() || 0;
1400
+ if (vt.test(m)) {
1401
+ const { projection: v } = this.visualElement;
1402
+ if (v && v.layout) {
1403
+ const V = v.layout.layoutBox[p];
1404
+ V && (m = E(V) * (parseFloat(m) / 100));
1405
+ }
1406
+ }
1407
+ this.originPoint[p] = m;
1408
+ }), f && C.update(() => f(a, l), !1, !0);
1409
+ const { animationState: d } = this.visualElement;
1410
+ d && d.setActive("whileDrag", !0);
1411
+ }, i = (a, l) => {
1412
+ const { dragPropagation: u, dragDirectionLock: h, onDirectionLock: f, onDrag: d } = this.getProps();
1413
+ if (!u && !this.openGlobalLock)
1414
+ return;
1415
+ const { offset: p } = l;
1416
+ if (h && this.currentDirection === null) {
1417
+ this.currentDirection = Ko(p), this.currentDirection !== null && f && f(this.currentDirection);
1418
+ return;
1419
+ }
1420
+ this.updateAxis("x", l.point, p), this.updateAxis("y", l.point, p), this.visualElement.render(), d && d(a, l);
1421
+ }, r = (a, l) => this.stop(a, l);
1422
+ this.panSession = new es(t, {
1423
+ onSessionStart: o,
1424
+ onStart: c,
1425
+ onMove: i,
1426
+ onSessionEnd: r
1427
+ }, { transformPagePoint: this.visualElement.getTransformPagePoint() });
1428
+ }
1429
+ stop(t, n) {
1430
+ const s = this.isDragging;
1431
+ if (this.cancel(), !s)
1432
+ return;
1433
+ const { velocity: o } = n;
1434
+ this.startAnimation(o);
1435
+ const { onDragEnd: c } = this.getProps();
1436
+ c && C.update(() => c(t, n));
1437
+ }
1438
+ cancel() {
1439
+ this.isDragging = !1;
1440
+ const { projection: t, animationState: n } = this.visualElement;
1441
+ t && (t.isAnimationBlocked = !1), this.panSession && this.panSession.end(), this.panSession = void 0;
1442
+ const { dragPropagation: s } = this.getProps();
1443
+ !s && this.openGlobalLock && (this.openGlobalLock(), this.openGlobalLock = null), n && n.setActive("whileDrag", !1);
1444
+ }
1445
+ updateAxis(t, n, s) {
1446
+ const { drag: o } = this.getProps();
1447
+ if (!s || !bt(t, o, this.currentDirection))
1448
+ return;
1449
+ const c = this.getAxisMotionValue(t);
1450
+ let i = this.originPoint[t] + s[t];
1451
+ this.constraints && this.constraints[t] && (i = Mo(i, this.constraints[t], this.elastic[t])), c.set(i);
1452
+ }
1453
+ resolveConstraints() {
1454
+ const { dragConstraints: t, dragElastic: n } = this.getProps(), { layout: s } = this.visualElement.projection || {}, o = this.constraints;
1455
+ t && dt(t) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : t && s ? this.constraints = wo(s.layoutBox, t) : this.constraints = !1, this.elastic = Fo(n), o !== this.constraints && s && this.constraints && !this.hasMutatedConstraints && I((c) => {
1456
+ this.getAxisMotionValue(c) && (this.constraints[c] = Bo(s.layoutBox[c], this.constraints[c]));
1457
+ });
1458
+ }
1459
+ resolveRefConstraints() {
1460
+ const { dragConstraints: t, onMeasureDragConstraints: n } = this.getProps();
1461
+ if (!t || !dt(t))
1462
+ return !1;
1463
+ const s = t.current;
1464
+ tt(s !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");
1465
+ const { projection: o } = this.visualElement;
1466
+ if (!o || !o.layout)
1467
+ return !1;
1468
+ const c = Uo(s, o.root, this.visualElement.getTransformPagePoint());
1469
+ let i = Lo(o.layout.layoutBox, c);
1470
+ if (n) {
1471
+ const r = n(Eo(i));
1472
+ this.hasMutatedConstraints = !!r, r && (i = ss(r));
1473
+ }
1474
+ return i;
1475
+ }
1476
+ startAnimation(t) {
1477
+ const { drag: n, dragMomentum: s, dragElastic: o, dragTransition: c, dragSnapToOrigin: i, onDragTransitionEnd: r } = this.getProps(), a = this.constraints || {}, l = I((u) => {
1478
+ if (!bt(u, n, this.currentDirection))
1479
+ return;
1480
+ let h = a && a[u] || {};
1481
+ i && (h = { min: 0, max: 0 });
1482
+ const f = o ? 200 : 1e6, d = o ? 40 : 1e7, p = {
1483
+ type: "inertia",
1484
+ velocity: s ? t[u] : 0,
1485
+ bounceStiffness: f,
1486
+ bounceDamping: d,
1487
+ timeConstant: 750,
1488
+ restDelta: 1,
1489
+ restSpeed: 10,
1490
+ ...c,
1491
+ ...h
1492
+ };
1493
+ return this.startAxisValueAnimation(u, p);
1494
+ });
1495
+ return Promise.all(l).then(r);
1496
+ }
1497
+ startAxisValueAnimation(t, n) {
1498
+ const s = this.getAxisMotionValue(t);
1499
+ return s.start(le(t, s, 0, n));
1500
+ }
1501
+ stopAnimation() {
1502
+ I((t) => this.getAxisMotionValue(t).stop());
1503
+ }
1504
+ /**
1505
+ * Drag works differently depending on which props are provided.
1506
+ *
1507
+ * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.
1508
+ * - Otherwise, we apply the delta to the x/y motion values.
1509
+ */
1510
+ getAxisMotionValue(t) {
1511
+ const n = "_drag" + t.toUpperCase(), s = this.visualElement.getProps(), o = s[n];
1512
+ return o || this.visualElement.getValue(t, (s.initial ? s.initial[t] : void 0) || 0);
1513
+ }
1514
+ snapToCursor(t) {
1515
+ I((n) => {
1516
+ const { drag: s } = this.getProps();
1517
+ if (!bt(n, s, this.currentDirection))
1518
+ return;
1519
+ const { projection: o } = this.visualElement, c = this.getAxisMotionValue(n);
1520
+ if (o && o.layout) {
1521
+ const { min: i, max: r } = o.layout.layoutBox[n];
1522
+ c.set(t[n] - w(i, r, 0.5));
1523
+ }
1524
+ });
1525
+ }
1526
+ /**
1527
+ * When the viewport resizes we want to check if the measured constraints
1528
+ * have changed and, if so, reposition the element within those new constraints
1529
+ * relative to where it was before the resize.
1530
+ */
1531
+ scalePositionWithinConstraints() {
1532
+ if (!this.visualElement.current)
1533
+ return;
1534
+ const { drag: t, dragConstraints: n } = this.getProps(), { projection: s } = this.visualElement;
1535
+ if (!dt(n) || !s || !this.constraints)
1536
+ return;
1537
+ this.stopAnimation();
1538
+ const o = { x: 0, y: 0 };
1539
+ I((i) => {
1540
+ const r = this.getAxisMotionValue(i);
1541
+ if (r) {
1542
+ const a = r.get();
1543
+ o[i] = Ro({ min: a, max: a }, this.constraints[i]);
1544
+ }
1545
+ });
1546
+ const { transformTemplate: c } = this.visualElement.getProps();
1547
+ this.visualElement.current.style.transform = c ? c({}, "") : "none", s.root && s.root.updateScroll(), s.updateLayout(), this.resolveConstraints(), I((i) => {
1548
+ if (!bt(i, t, null))
1549
+ return;
1550
+ const r = this.getAxisMotionValue(i), { min: a, max: l } = this.constraints[i];
1551
+ r.set(w(a, l, o[i]));
1552
+ });
1553
+ }
1554
+ addListeners() {
1555
+ if (!this.visualElement.current)
1556
+ return;
1557
+ No.set(this.visualElement, this);
1558
+ const t = this.visualElement.current, n = G(t, "pointerdown", (a) => {
1559
+ const { drag: l, dragListener: u = !0 } = this.getProps();
1560
+ l && u && this.start(a);
1561
+ }), s = () => {
1562
+ const { dragConstraints: a } = this.getProps();
1563
+ dt(a) && (this.constraints = this.resolveRefConstraints());
1564
+ }, { projection: o } = this.visualElement, c = o.addEventListener("measure", s);
1565
+ o && !o.layout && (o.root && o.root.updateScroll(), o.updateLayout()), s();
1566
+ const i = N(window, "resize", () => this.scalePositionWithinConstraints()), r = o.addEventListener("didUpdate", ({ delta: a, hasLayoutChanged: l }) => {
1567
+ this.isDragging && l && (I((u) => {
1568
+ const h = this.getAxisMotionValue(u);
1569
+ h && (this.originPoint[u] += a[u].translate, h.set(h.get() + a[u].translate));
1570
+ }), this.visualElement.render());
1571
+ });
1572
+ return () => {
1573
+ i(), n(), c(), r && r();
1574
+ };
1575
+ }
1576
+ getProps() {
1577
+ const t = this.visualElement.getProps(), { drag: n = !1, dragDirectionLock: s = !1, dragPropagation: o = !1, dragConstraints: c = !1, dragElastic: i = Qt, dragMomentum: r = !0 } = t;
1578
+ return {
1579
+ ...t,
1580
+ drag: n,
1581
+ dragDirectionLock: s,
1582
+ dragPropagation: o,
1583
+ dragConstraints: c,
1584
+ dragElastic: i,
1585
+ dragMomentum: r
1586
+ };
1587
+ }
1588
+ }
1589
+ function bt(e, t, n) {
1590
+ return (t === !0 || t === e) && (n === null || n === e);
1591
+ }
1592
+ function Ko(e, t = 10) {
1593
+ let n = null;
1594
+ return Math.abs(e.y) > t ? n = "y" : Math.abs(e.x) > t && (n = "x"), n;
1595
+ }
1596
+ class $o extends q {
1597
+ constructor(t) {
1598
+ super(t), this.removeGroupControls = B, this.removeListeners = B, this.controls = new Go(t);
1599
+ }
1600
+ mount() {
1601
+ const { dragControls: t } = this.node.getProps();
1602
+ t && (this.removeGroupControls = t.subscribe(this.controls)), this.removeListeners = this.controls.addListeners() || B;
1603
+ }
1604
+ unmount() {
1605
+ this.removeGroupControls(), this.removeListeners();
1606
+ }
1607
+ }
1608
+ const $e = (e) => (t, n) => {
1609
+ e && C.update(() => e(t, n));
1610
+ };
1611
+ class zo extends q {
1612
+ constructor() {
1613
+ super(...arguments), this.removePointerDownListener = B;
1614
+ }
1615
+ onPointerDown(t) {
1616
+ this.session = new es(t, this.createPanHandlers(), { transformPagePoint: this.node.getTransformPagePoint() });
1617
+ }
1618
+ createPanHandlers() {
1619
+ const { onPanSessionStart: t, onPanStart: n, onPan: s, onPanEnd: o } = this.node.getProps();
1620
+ return {
1621
+ onSessionStart: $e(t),
1622
+ onStart: $e(n),
1623
+ onMove: s,
1624
+ onEnd: (c, i) => {
1625
+ delete this.session, o && C.update(() => o(c, i));
1626
+ }
1627
+ };
1628
+ }
1629
+ mount() {
1630
+ this.removePointerDownListener = G(this.node.current, "pointerdown", (t) => this.onPointerDown(t));
1631
+ }
1632
+ update() {
1633
+ this.session && this.session.updateHandlers(this.createPanHandlers());
1634
+ }
1635
+ unmount() {
1636
+ this.removePointerDownListener(), this.session && this.session.end();
1637
+ }
1638
+ }
1639
+ function Ho() {
1640
+ const e = _t(ws);
1641
+ if (e === null)
1642
+ return [!0, null];
1643
+ const { isPresent: t, onExitComplete: n, register: s } = e, o = _s();
1644
+ return Ws(() => s(o), []), !t && n ? [!1, () => n && n(o)] : [!0];
1645
+ }
1646
+ const Dt = {
1647
+ /**
1648
+ * Global flag as to whether the tree has animated since the last time
1649
+ * we resized the window
1650
+ */
1651
+ hasAnimatedSinceResize: !0,
1652
+ /**
1653
+ * We set this to true once, on the first update. Any nodes added to the tree beyond that
1654
+ * update will be given a `data-projection-id` attribute.
1655
+ */
1656
+ hasEverUpdated: !1
1657
+ };
1658
+ function ze(e, t) {
1659
+ return t.max === t.min ? 0 : e / (t.max - t.min) * 100;
1660
+ }
1661
+ const ft = {
1662
+ correct: (e, t) => {
1663
+ if (!t.target)
1664
+ return e;
1665
+ if (typeof e == "string")
1666
+ if (xt.test(e))
1667
+ e = parseFloat(e);
1668
+ else
1669
+ return e;
1670
+ const n = ze(e, t.target.x), s = ze(e, t.target.y);
1671
+ return `${n}% ${s}%`;
1672
+ }
1673
+ }, _o = {
1674
+ correct: (e, { treeScale: t, projectionDelta: n }) => {
1675
+ const s = e, o = et.parse(e);
1676
+ if (o.length > 5)
1677
+ return s;
1678
+ const c = et.createTransformer(e), i = typeof o[0] != "number" ? 1 : 0, r = n.x.scale * t.x, a = n.y.scale * t.y;
1679
+ o[0 + i] /= r, o[1 + i] /= a;
1680
+ const l = w(r, a, 0.5);
1681
+ return typeof o[2 + i] == "number" && (o[2 + i] /= l), typeof o[3 + i] == "number" && (o[3 + i] /= l), c(o);
1682
+ }
1683
+ };
1684
+ class Wo extends wn.Component {
1685
+ /**
1686
+ * This only mounts projection nodes for components that
1687
+ * need measuring, we might want to do it for all components
1688
+ * in order to incorporate transforms
1689
+ */
1690
+ componentDidMount() {
1691
+ const { visualElement: t, layoutGroup: n, switchLayoutGroup: s, layoutId: o } = this.props, { projection: c } = t;
1692
+ Ls(Yo), c && (n.group && n.group.add(c), s && s.register && o && s.register(c), c.root.didUpdate(), c.addEventListener("animationComplete", () => {
1693
+ this.safeToRemove();
1694
+ }), c.setOptions({
1695
+ ...c.options,
1696
+ onExitComplete: () => this.safeToRemove()
1697
+ })), Dt.hasEverUpdated = !0;
1698
+ }
1699
+ getSnapshotBeforeUpdate(t) {
1700
+ const { layoutDependency: n, visualElement: s, drag: o, isPresent: c } = this.props, i = s.projection;
1701
+ return i && (i.isPresent = c, o || t.layoutDependency !== n || n === void 0 ? i.willUpdate() : this.safeToRemove(), t.isPresent !== c && (c ? i.promote() : i.relegate() || C.postRender(() => {
1702
+ const r = i.getStack();
1703
+ (!r || !r.members.length) && this.safeToRemove();
1704
+ }))), null;
1705
+ }
1706
+ componentDidUpdate() {
1707
+ const { projection: t } = this.props.visualElement;
1708
+ t && (t.root.didUpdate(), queueMicrotask(() => {
1709
+ !t.currentAnimation && t.isLead() && this.safeToRemove();
1710
+ }));
1711
+ }
1712
+ componentWillUnmount() {
1713
+ const { visualElement: t, layoutGroup: n, switchLayoutGroup: s } = this.props, { projection: o } = t;
1714
+ o && (o.scheduleCheckAfterUnmount(), n && n.group && n.group.remove(o), s && s.deregister && s.deregister(o));
1715
+ }
1716
+ safeToRemove() {
1717
+ const { safeToRemove: t } = this.props;
1718
+ t && t();
1719
+ }
1720
+ render() {
1721
+ return null;
1722
+ }
1723
+ }
1724
+ function as(e) {
1725
+ const [t, n] = Ho(), s = _t(Rs);
1726
+ return wn.createElement(Wo, { ...e, layoutGroup: s, switchLayoutGroup: _t(Bs), isPresent: t, safeToRemove: n });
1727
+ }
1728
+ const Yo = {
1729
+ borderRadius: {
1730
+ ...ft,
1731
+ applyTo: [
1732
+ "borderTopLeftRadius",
1733
+ "borderTopRightRadius",
1734
+ "borderBottomLeftRadius",
1735
+ "borderBottomRightRadius"
1736
+ ]
1737
+ },
1738
+ borderTopLeftRadius: ft,
1739
+ borderTopRightRadius: ft,
1740
+ borderBottomLeftRadius: ft,
1741
+ borderBottomRightRadius: ft,
1742
+ boxShadow: _o
1743
+ }, ls = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], qo = ls.length, He = (e) => typeof e == "string" ? parseFloat(e) : e, _e = (e) => typeof e == "number" || xt.test(e);
1744
+ function Xo(e, t, n, s, o, c) {
1745
+ o ? (e.opacity = w(
1746
+ 0,
1747
+ // TODO Reinstate this if only child
1748
+ n.opacity !== void 0 ? n.opacity : 1,
1749
+ Zo(s)
1750
+ ), e.opacityExit = w(t.opacity !== void 0 ? t.opacity : 1, 0, Jo(s))) : c && (e.opacity = w(t.opacity !== void 0 ? t.opacity : 1, n.opacity !== void 0 ? n.opacity : 1, s));
1751
+ for (let i = 0; i < qo; i++) {
1752
+ const r = `border${ls[i]}Radius`;
1753
+ let a = We(t, r), l = We(n, r);
1754
+ if (a === void 0 && l === void 0)
1755
+ continue;
1756
+ a || (a = 0), l || (l = 0), a === 0 || l === 0 || _e(a) === _e(l) ? (e[r] = Math.max(w(He(a), He(l), s), 0), (vt.test(l) || vt.test(a)) && (e[r] += "%")) : e[r] = l;
1757
+ }
1758
+ (t.rotate || n.rotate) && (e.rotate = w(t.rotate || 0, n.rotate || 0, s));
1759
+ }
1760
+ function We(e, t) {
1761
+ return e[t] !== void 0 ? e[t] : e.borderRadius;
1762
+ }
1763
+ const Zo = cs(0, 0.5, oe), Jo = cs(0.5, 0.95, B);
1764
+ function cs(e, t, n) {
1765
+ return (s) => s < e ? 0 : s > t ? 1 : n(zt(e, t, s));
1766
+ }
1767
+ function Ye(e, t) {
1768
+ e.min = t.min, e.max = t.max;
1769
+ }
1770
+ function j(e, t) {
1771
+ Ye(e.x, t.x), Ye(e.y, t.y);
1772
+ }
1773
+ function qe(e, t, n, s, o) {
1774
+ return e -= t, e = Lt(e, 1 / n, s), o !== void 0 && (e = Lt(e, 1 / o, s)), e;
1775
+ }
1776
+ function Qo(e, t = 0, n = 1, s = 0.5, o, c = e, i = e) {
1777
+ if (vt.test(t) && (t = parseFloat(t), t = w(i.min, i.max, t / 100) - i.min), typeof t != "number")
1778
+ return;
1779
+ let r = w(c.min, c.max, s);
1780
+ e === c && (r -= t), e.min = qe(e.min, t, n, r, o), e.max = qe(e.max, t, n, r, o);
1781
+ }
1782
+ function Xe(e, t, [n, s, o], c, i) {
1783
+ Qo(e, t[n], t[s], t[o], t.scale, c, i);
1784
+ }
1785
+ const tr = ["x", "scaleX", "originX"], er = ["y", "scaleY", "originY"];
1786
+ function Ze(e, t, n, s) {
1787
+ Xe(e.x, t, tr, n ? n.x : void 0, s ? s.x : void 0), Xe(e.y, t, er, n ? n.y : void 0, s ? s.y : void 0);
1788
+ }
1789
+ function Je(e) {
1790
+ return e.translate === 0 && e.scale === 1;
1791
+ }
1792
+ function us(e) {
1793
+ return Je(e.x) && Je(e.y);
1794
+ }
1795
+ function nr(e, t) {
1796
+ return e.x.min === t.x.min && e.x.max === t.x.max && e.y.min === t.y.min && e.y.max === t.y.max;
1797
+ }
1798
+ function hs(e, t) {
1799
+ return Math.round(e.x.min) === Math.round(t.x.min) && Math.round(e.x.max) === Math.round(t.x.max) && Math.round(e.y.min) === Math.round(t.y.min) && Math.round(e.y.max) === Math.round(t.y.max);
1800
+ }
1801
+ function Qe(e) {
1802
+ return E(e.x) / E(e.y);
1803
+ }
1804
+ class sr {
1805
+ constructor() {
1806
+ this.members = [];
1807
+ }
1808
+ add(t) {
1809
+ Vn(this.members, t), t.scheduleRender();
1810
+ }
1811
+ remove(t) {
1812
+ if (Sn(this.members, t), t === this.prevLead && (this.prevLead = void 0), t === this.lead) {
1813
+ const n = this.members[this.members.length - 1];
1814
+ n && this.promote(n);
1815
+ }
1816
+ }
1817
+ relegate(t) {
1818
+ const n = this.members.findIndex((o) => t === o);
1819
+ if (n === 0)
1820
+ return !1;
1821
+ let s;
1822
+ for (let o = n; o >= 0; o--) {
1823
+ const c = this.members[o];
1824
+ if (c.isPresent !== !1) {
1825
+ s = c;
1826
+ break;
1827
+ }
1828
+ }
1829
+ return s ? (this.promote(s), !0) : !1;
1830
+ }
1831
+ promote(t, n) {
1832
+ const s = this.lead;
1833
+ if (t !== s && (this.prevLead = s, this.lead = t, t.show(), s)) {
1834
+ s.instance && s.scheduleRender(), t.scheduleRender(), t.resumeFrom = s, n && (t.resumeFrom.preserveOpacity = !0), s.snapshot && (t.snapshot = s.snapshot, t.snapshot.latestValues = s.animationValues || s.latestValues), t.root && t.root.isUpdating && (t.isLayoutDirty = !0);
1835
+ const { crossfade: o } = t.options;
1836
+ o === !1 && s.hide();
1837
+ }
1838
+ }
1839
+ exitAnimationComplete() {
1840
+ this.members.forEach((t) => {
1841
+ const { options: n, resumingFrom: s } = t;
1842
+ n.onExitComplete && n.onExitComplete(), s && s.options.onExitComplete && s.options.onExitComplete();
1843
+ });
1844
+ }
1845
+ scheduleRender() {
1846
+ this.members.forEach((t) => {
1847
+ t.instance && t.scheduleRender(!1);
1848
+ });
1849
+ }
1850
+ /**
1851
+ * Clear any leads that have been removed this render to prevent them from being
1852
+ * used in future animations and to prevent memory leaks
1853
+ */
1854
+ removeLeadSnapshot() {
1855
+ this.lead && this.lead.snapshot && (this.lead.snapshot = void 0);
1856
+ }
1857
+ }
1858
+ function tn(e, t, n) {
1859
+ let s = "";
1860
+ const o = e.x.translate / t.x, c = e.y.translate / t.y;
1861
+ if ((o || c) && (s = `translate3d(${o}px, ${c}px, 0) `), (t.x !== 1 || t.y !== 1) && (s += `scale(${1 / t.x}, ${1 / t.y}) `), n) {
1862
+ const { rotate: a, rotateX: l, rotateY: u } = n;
1863
+ a && (s += `rotate(${a}deg) `), l && (s += `rotateX(${l}deg) `), u && (s += `rotateY(${u}deg) `);
1864
+ }
1865
+ const i = e.x.scale * t.x, r = e.y.scale * t.y;
1866
+ return (i !== 1 || r !== 1) && (s += `scale(${i}, ${r})`), s || "none";
1867
+ }
1868
+ const ir = (e, t) => e.depth - t.depth;
1869
+ class or {
1870
+ constructor() {
1871
+ this.children = [], this.isDirty = !1;
1872
+ }
1873
+ add(t) {
1874
+ Vn(this.children, t), this.isDirty = !0;
1875
+ }
1876
+ remove(t) {
1877
+ Sn(this.children, t), this.isDirty = !0;
1878
+ }
1879
+ forEach(t) {
1880
+ this.isDirty && this.children.sort(ir), this.isDirty = !1, this.children.forEach(t);
1881
+ }
1882
+ }
1883
+ function rr(e, t) {
1884
+ const n = performance.now(), s = ({ timestamp: o }) => {
1885
+ const c = o - n;
1886
+ c >= t && ($(s), e(c - t));
1887
+ };
1888
+ return C.read(s, !0), () => $(s);
1889
+ }
1890
+ function ar(e) {
1891
+ window.MotionDebug && window.MotionDebug.record(e);
1892
+ }
1893
+ function lr(e) {
1894
+ return e instanceof SVGElement && e.tagName !== "svg";
1895
+ }
1896
+ function cr(e, t, n) {
1897
+ const s = nt(e) ? e : at(e);
1898
+ return s.start(le("", s, t, n)), s.animation;
1899
+ }
1900
+ const en = ["", "X", "Y", "Z"], nn = 1e3;
1901
+ let ur = 0;
1902
+ const Q = {
1903
+ type: "projectionFrame",
1904
+ totalNodes: 0,
1905
+ resolvedTargetDeltas: 0,
1906
+ recalculatedProjection: 0
1907
+ };
1908
+ function fs({ attachResizeListener: e, defaultParent: t, measureScroll: n, checkIsScrollRoot: s, resetTransform: o }) {
1909
+ return class {
1910
+ constructor(i = {}, r = t == null ? void 0 : t()) {
1911
+ this.id = ur++, 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.treeScale = { x: 1, y: 1 }, this.eventHandlers = /* @__PURE__ */ new Map(), this.hasTreeAnimated = !1, this.updateScheduled = !1, this.checkUpdateFailed = () => {
1912
+ this.isUpdating && (this.isUpdating = !1, this.clearAllSnapshots());
1913
+ }, this.updateProjection = () => {
1914
+ Q.totalNodes = Q.resolvedTargetDeltas = Q.recalculatedProjection = 0, this.nodes.forEach(dr), this.nodes.forEach(vr), this.nodes.forEach(Pr), this.nodes.forEach(pr), ar(Q);
1915
+ }, this.hasProjected = !1, this.isVisible = !0, this.animationProgress = 0, this.sharedNodes = /* @__PURE__ */ new Map(), this.latestValues = i, this.root = r ? r.root || r : this, this.path = r ? [...r.path, r] : [], this.parent = r, this.depth = r ? r.depth + 1 : 0;
1916
+ for (let a = 0; a < this.path.length; a++)
1917
+ this.path[a].shouldResetTransform = !0;
1918
+ this.root === this && (this.nodes = new or());
1919
+ }
1920
+ addEventListener(i, r) {
1921
+ return this.eventHandlers.has(i) || this.eventHandlers.set(i, new bn()), this.eventHandlers.get(i).add(r);
1922
+ }
1923
+ notifyListeners(i, ...r) {
1924
+ const a = this.eventHandlers.get(i);
1925
+ a && a.notify(...r);
1926
+ }
1927
+ hasListeners(i) {
1928
+ return this.eventHandlers.has(i);
1929
+ }
1930
+ /**
1931
+ * Lifecycles
1932
+ */
1933
+ mount(i, r = this.root.hasTreeAnimated) {
1934
+ if (this.instance)
1935
+ return;
1936
+ this.isSVG = lr(i), this.instance = i;
1937
+ const { layoutId: a, layout: l, visualElement: u } = this.options;
1938
+ if (u && !u.current && u.mount(i), this.root.nodes.add(this), this.parent && this.parent.children.add(this), r && (l || a) && (this.isLayoutDirty = !0), e) {
1939
+ let h;
1940
+ const f = () => this.root.updateBlockedByResize = !1;
1941
+ e(i, () => {
1942
+ this.root.updateBlockedByResize = !0, h && h(), h = rr(f, 250), Dt.hasAnimatedSinceResize && (Dt.hasAnimatedSinceResize = !1, this.nodes.forEach(on));
1943
+ });
1944
+ }
1945
+ a && this.root.registerSharedNode(a, this), this.options.animate !== !1 && u && (a || l) && this.addEventListener("didUpdate", ({ delta: h, hasLayoutChanged: f, hasRelativeTargetChanged: d, layout: p }) => {
1946
+ if (this.isTreeAnimationBlocked()) {
1947
+ this.target = void 0, this.relativeTarget = void 0;
1948
+ return;
1949
+ }
1950
+ const m = this.options.transition || u.getDefaultTransition() || br, { onLayoutAnimationStart: v, onLayoutAnimationComplete: V } = u.getProps(), y = !this.targetLayout || !hs(this.targetLayout, p) || d, g = !f && d;
1951
+ if (this.options.layoutRoot || this.resumeFrom && this.resumeFrom.instance || g || f && (y || !this.currentAnimation)) {
1952
+ this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0), this.setAnimationOrigin(h, g);
1953
+ const P = {
1954
+ ...Xn(m, "layout"),
1955
+ onPlay: v,
1956
+ onComplete: V
1957
+ };
1958
+ (u.shouldReduceMotion || this.options.layoutRoot) && (P.delay = 0, P.type = !1), this.startAnimation(P);
1959
+ } else
1960
+ f || on(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete();
1961
+ this.targetLayout = p;
1962
+ });
1963
+ }
1964
+ unmount() {
1965
+ this.options.layoutId && this.willUpdate(), this.root.nodes.remove(this);
1966
+ const i = this.getStack();
1967
+ i && i.remove(this), this.parent && this.parent.children.delete(this), this.instance = void 0, $(this.updateProjection);
1968
+ }
1969
+ // only on the root
1970
+ blockUpdate() {
1971
+ this.updateManuallyBlocked = !0;
1972
+ }
1973
+ unblockUpdate() {
1974
+ this.updateManuallyBlocked = !1;
1975
+ }
1976
+ isUpdateBlocked() {
1977
+ return this.updateManuallyBlocked || this.updateBlockedByResize;
1978
+ }
1979
+ isTreeAnimationBlocked() {
1980
+ return this.isAnimationBlocked || this.parent && this.parent.isTreeAnimationBlocked() || !1;
1981
+ }
1982
+ // Note: currently only running on root node
1983
+ startUpdate() {
1984
+ this.isUpdateBlocked() || (this.isUpdating = !0, this.nodes && this.nodes.forEach(xr), this.animationId++);
1985
+ }
1986
+ getTransformTemplate() {
1987
+ const { visualElement: i } = this.options;
1988
+ return i && i.getProps().transformTemplate;
1989
+ }
1990
+ willUpdate(i = !0) {
1991
+ if (this.root.hasTreeAnimated = !0, this.root.isUpdateBlocked()) {
1992
+ this.options.onExitComplete && this.options.onExitComplete();
1993
+ return;
1994
+ }
1995
+ if (!this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty)
1996
+ return;
1997
+ this.isLayoutDirty = !0;
1998
+ for (let u = 0; u < this.path.length; u++) {
1999
+ const h = this.path[u];
2000
+ h.shouldResetTransform = !0, h.updateScroll("snapshot"), h.options.layoutRoot && h.willUpdate(!1);
2001
+ }
2002
+ const { layoutId: r, layout: a } = this.options;
2003
+ if (r === void 0 && !a)
2004
+ return;
2005
+ const l = this.getTransformTemplate();
2006
+ this.prevTransformTemplateValue = l ? l(this.latestValues, "") : void 0, this.updateSnapshot(), i && this.notifyListeners("willUpdate");
2007
+ }
2008
+ update() {
2009
+ if (this.updateScheduled = !1, this.isUpdateBlocked()) {
2010
+ this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(sn);
2011
+ return;
2012
+ }
2013
+ this.isUpdating || this.nodes.forEach(gr), this.isUpdating = !1, this.nodes.forEach(yr), this.nodes.forEach(hr), this.nodes.forEach(fr), this.clearAllSnapshots();
2014
+ const r = performance.now();
2015
+ R.delta = yt(0, 1e3 / 60, r - R.timestamp), R.timestamp = r, R.isProcessing = !0, Et.update.process(R), Et.preRender.process(R), Et.render.process(R), R.isProcessing = !1;
2016
+ }
2017
+ didUpdate() {
2018
+ this.updateScheduled || (this.updateScheduled = !0, queueMicrotask(() => this.update()));
2019
+ }
2020
+ clearAllSnapshots() {
2021
+ this.nodes.forEach(mr), this.sharedNodes.forEach(Tr);
2022
+ }
2023
+ scheduleUpdateProjection() {
2024
+ C.preRender(this.updateProjection, !1, !0);
2025
+ }
2026
+ scheduleCheckAfterUnmount() {
2027
+ C.postRender(() => {
2028
+ this.isLayoutDirty ? this.root.didUpdate() : this.root.checkUpdateFailed();
2029
+ });
2030
+ }
2031
+ /**
2032
+ * Update measurements
2033
+ */
2034
+ updateSnapshot() {
2035
+ this.snapshot || !this.instance || (this.snapshot = this.measure());
2036
+ }
2037
+ updateLayout() {
2038
+ if (!this.instance || (this.updateScroll(), !(this.options.alwaysMeasureLayout && this.isLead()) && !this.isLayoutDirty))
2039
+ return;
2040
+ if (this.resumeFrom && !this.resumeFrom.instance)
2041
+ for (let a = 0; a < this.path.length; a++)
2042
+ this.path[a].updateScroll();
2043
+ const i = this.layout;
2044
+ this.layout = this.measure(!1), this.layoutCorrected = D(), this.isLayoutDirty = !1, this.projectionDelta = void 0, this.notifyListeners("measure", this.layout.layoutBox);
2045
+ const { visualElement: r } = this.options;
2046
+ r && r.notify("LayoutMeasure", this.layout.layoutBox, i ? i.layoutBox : void 0);
2047
+ }
2048
+ updateScroll(i = "measure") {
2049
+ let r = !!(this.options.layoutScroll && this.instance);
2050
+ this.scroll && this.scroll.animationId === this.root.animationId && this.scroll.phase === i && (r = !1), r && (this.scroll = {
2051
+ animationId: this.root.animationId,
2052
+ phase: i,
2053
+ isRoot: s(this.instance),
2054
+ offset: n(this.instance)
2055
+ });
2056
+ }
2057
+ resetTransform() {
2058
+ if (!o)
2059
+ return;
2060
+ const i = this.isLayoutDirty || this.shouldResetTransform, r = this.projectionDelta && !us(this.projectionDelta), a = this.getTransformTemplate(), l = a ? a(this.latestValues, "") : void 0, u = l !== this.prevTransformTemplateValue;
2061
+ i && (r || J(this.latestValues) || u) && (o(this.instance, l), this.shouldResetTransform = !1, this.scheduleRender());
2062
+ }
2063
+ measure(i = !0) {
2064
+ const r = this.measurePageBox();
2065
+ let a = this.removeElementScroll(r);
2066
+ return i && (a = this.removeTransform(a)), Ar(a), {
2067
+ animationId: this.root.animationId,
2068
+ measuredBox: r,
2069
+ layoutBox: a,
2070
+ latestValues: {},
2071
+ source: this.id
2072
+ };
2073
+ }
2074
+ measurePageBox() {
2075
+ const { visualElement: i } = this.options;
2076
+ if (!i)
2077
+ return D();
2078
+ const r = i.measureViewportBox(), { scroll: a } = this.root;
2079
+ return a && (W(r.x, a.offset.x), W(r.y, a.offset.y)), r;
2080
+ }
2081
+ removeElementScroll(i) {
2082
+ const r = D();
2083
+ j(r, i);
2084
+ for (let a = 0; a < this.path.length; a++) {
2085
+ const l = this.path[a], { scroll: u, options: h } = l;
2086
+ if (l !== this.root && u && h.layoutScroll) {
2087
+ if (u.isRoot) {
2088
+ j(r, i);
2089
+ const { scroll: f } = this.root;
2090
+ f && (W(r.x, -f.offset.x), W(r.y, -f.offset.y));
2091
+ }
2092
+ W(r.x, u.offset.x), W(r.y, u.offset.y);
2093
+ }
2094
+ }
2095
+ return r;
2096
+ }
2097
+ applyTransform(i, r = !1) {
2098
+ const a = D();
2099
+ j(a, i);
2100
+ for (let l = 0; l < this.path.length; l++) {
2101
+ const u = this.path[l];
2102
+ !r && u.options.layoutScroll && u.scroll && u !== u.root && ot(a, {
2103
+ x: -u.scroll.offset.x,
2104
+ y: -u.scroll.offset.y
2105
+ }), J(u.latestValues) && ot(a, u.latestValues);
2106
+ }
2107
+ return J(this.latestValues) && ot(a, this.latestValues), a;
2108
+ }
2109
+ removeTransform(i) {
2110
+ const r = D();
2111
+ j(r, i);
2112
+ for (let a = 0; a < this.path.length; a++) {
2113
+ const l = this.path[a];
2114
+ if (!l.instance || !J(l.latestValues))
2115
+ continue;
2116
+ te(l.latestValues) && l.updateSnapshot();
2117
+ const u = D(), h = l.measurePageBox();
2118
+ j(u, h), Ze(r, l.latestValues, l.snapshot ? l.snapshot.layoutBox : void 0, u);
2119
+ }
2120
+ return J(this.latestValues) && Ze(r, this.latestValues), r;
2121
+ }
2122
+ setTargetDelta(i) {
2123
+ this.targetDelta = i, this.root.scheduleUpdateProjection(), this.isProjectionDirty = !0;
2124
+ }
2125
+ setOptions(i) {
2126
+ this.options = {
2127
+ ...this.options,
2128
+ ...i,
2129
+ crossfade: i.crossfade !== void 0 ? i.crossfade : !0
2130
+ };
2131
+ }
2132
+ clearMeasurements() {
2133
+ 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;
2134
+ }
2135
+ forceRelativeParentToResolveTarget() {
2136
+ this.relativeParent && this.relativeParent.resolvedRelativeTargetAt !== R.timestamp && this.relativeParent.resolveTargetDelta(!0);
2137
+ }
2138
+ resolveTargetDelta(i = !1) {
2139
+ var r;
2140
+ const a = this.getLead();
2141
+ this.isProjectionDirty || (this.isProjectionDirty = a.isProjectionDirty), this.isTransformDirty || (this.isTransformDirty = a.isTransformDirty), this.isSharedProjectionDirty || (this.isSharedProjectionDirty = a.isSharedProjectionDirty);
2142
+ const l = !!this.resumingFrom || this !== a;
2143
+ if (!(i || l && this.isSharedProjectionDirty || this.isProjectionDirty || !((r = this.parent) === null || r === void 0) && r.isProjectionDirty || this.attemptToResolveRelativeTarget))
2144
+ return;
2145
+ const { layout: h, layoutId: f } = this.options;
2146
+ if (!(!this.layout || !(h || f))) {
2147
+ if (this.resolvedRelativeTargetAt = R.timestamp, !this.targetDelta && !this.relativeTarget) {
2148
+ const d = this.getClosestProjectingParent();
2149
+ d && d.layout && this.animationProgress !== 1 ? (this.relativeParent = d, this.forceRelativeParentToResolveTarget(), this.relativeTarget = D(), this.relativeTargetOrigin = D(), gt(this.relativeTargetOrigin, this.layout.layoutBox, d.layout.layoutBox), j(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0;
2150
+ }
2151
+ if (!(!this.relativeTarget && !this.targetDelta)) {
2152
+ if (this.target || (this.target = D(), this.targetWithTransforms = D()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), Co(this.target, this.relativeTarget, this.relativeParent.target)) : this.targetDelta ? (this.resumingFrom ? this.target = this.applyTransform(this.layout.layoutBox) : j(this.target, this.layout.layoutBox), os(this.target, this.targetDelta)) : j(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget) {
2153
+ this.attemptToResolveRelativeTarget = !1;
2154
+ const d = this.getClosestProjectingParent();
2155
+ d && !!d.resumingFrom == !!this.resumingFrom && !d.options.layoutScroll && d.target && this.animationProgress !== 1 ? (this.relativeParent = d, this.forceRelativeParentToResolveTarget(), this.relativeTarget = D(), this.relativeTargetOrigin = D(), gt(this.relativeTargetOrigin, this.target, d.target), j(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0;
2156
+ }
2157
+ Q.resolvedTargetDeltas++;
2158
+ }
2159
+ }
2160
+ }
2161
+ getClosestProjectingParent() {
2162
+ if (!(!this.parent || te(this.parent.latestValues) || is(this.parent.latestValues)))
2163
+ return this.parent.isProjecting() ? this.parent : this.parent.getClosestProjectingParent();
2164
+ }
2165
+ isProjecting() {
2166
+ return !!((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
2167
+ }
2168
+ calcProjection() {
2169
+ var i;
2170
+ const r = this.getLead(), a = !!this.resumingFrom || this !== r;
2171
+ let l = !0;
2172
+ if ((this.isProjectionDirty || !((i = this.parent) === null || i === void 0) && i.isProjectionDirty) && (l = !1), a && (this.isSharedProjectionDirty || this.isTransformDirty) && (l = !1), this.resolvedRelativeTargetAt === R.timestamp && (l = !1), l)
2173
+ return;
2174
+ const { layout: u, layoutId: h } = this.options;
2175
+ if (this.isTreeAnimating = !!(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation), this.isTreeAnimating || (this.targetDelta = this.relativeTarget = void 0), !this.layout || !(u || h))
2176
+ return;
2177
+ j(this.layoutCorrected, this.layout.layoutBox);
2178
+ const f = this.treeScale.x, d = this.treeScale.y;
2179
+ ko(this.layoutCorrected, this.treeScale, this.path, a), r.layout && !r.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1) && (r.target = r.layout.layoutBox);
2180
+ const { target: p } = r;
2181
+ if (!p) {
2182
+ this.projectionTransform && (this.projectionDelta = it(), this.projectionTransform = "none", this.scheduleRender());
2183
+ return;
2184
+ }
2185
+ this.projectionDelta || (this.projectionDelta = it(), this.projectionDeltaWithTransform = it());
2186
+ const m = this.projectionTransform;
2187
+ mt(this.projectionDelta, this.layoutCorrected, p, this.latestValues), this.projectionTransform = tn(this.projectionDelta, this.treeScale), (this.projectionTransform !== m || this.treeScale.x !== f || this.treeScale.y !== d) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", p)), Q.recalculatedProjection++;
2188
+ }
2189
+ hide() {
2190
+ this.isVisible = !1;
2191
+ }
2192
+ show() {
2193
+ this.isVisible = !0;
2194
+ }
2195
+ scheduleRender(i = !0) {
2196
+ if (this.options.scheduleRender && this.options.scheduleRender(), i) {
2197
+ const r = this.getStack();
2198
+ r && r.scheduleRender();
2199
+ }
2200
+ this.resumingFrom && !this.resumingFrom.instance && (this.resumingFrom = void 0);
2201
+ }
2202
+ setAnimationOrigin(i, r = !1) {
2203
+ const a = this.snapshot, l = a ? a.latestValues : {}, u = { ...this.latestValues }, h = it();
2204
+ (!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !r;
2205
+ const f = D(), d = a ? a.source : void 0, p = this.layout ? this.layout.source : void 0, m = d !== p, v = this.getStack(), V = !v || v.members.length <= 1, y = !!(m && !V && this.options.crossfade === !0 && !this.path.some(Sr));
2206
+ this.animationProgress = 0;
2207
+ let g;
2208
+ this.mixTargetDelta = (P) => {
2209
+ const x = P / 1e3;
2210
+ rn(h.x, i.x, x), rn(h.y, i.y, x), this.setTargetDelta(h), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (gt(f, this.layout.layoutBox, this.relativeParent.layout.layoutBox), Vr(this.relativeTarget, this.relativeTargetOrigin, f, x), g && nr(this.relativeTarget, g) && (this.isProjectionDirty = !1), g || (g = D()), j(g, this.relativeTarget)), m && (this.animationValues = u, Xo(u, l, this.latestValues, x, y, V)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = x;
2211
+ }, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0);
2212
+ }
2213
+ startAnimation(i) {
2214
+ this.notifyListeners("animationStart"), this.currentAnimation && this.currentAnimation.stop(), this.resumingFrom && this.resumingFrom.currentAnimation && this.resumingFrom.currentAnimation.stop(), this.pendingAnimation && ($(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = C.update(() => {
2215
+ Dt.hasAnimatedSinceResize = !0, this.currentAnimation = cr(0, nn, {
2216
+ ...i,
2217
+ onUpdate: (r) => {
2218
+ this.mixTargetDelta(r), i.onUpdate && i.onUpdate(r);
2219
+ },
2220
+ onComplete: () => {
2221
+ i.onComplete && i.onComplete(), this.completeAnimation();
2222
+ }
2223
+ }), this.resumingFrom && (this.resumingFrom.currentAnimation = this.currentAnimation), this.pendingAnimation = void 0;
2224
+ });
2225
+ }
2226
+ completeAnimation() {
2227
+ this.resumingFrom && (this.resumingFrom.currentAnimation = void 0, this.resumingFrom.preserveOpacity = void 0);
2228
+ const i = this.getStack();
2229
+ i && i.exitAnimationComplete(), this.resumingFrom = this.currentAnimation = this.animationValues = void 0, this.notifyListeners("animationComplete");
2230
+ }
2231
+ finishAnimation() {
2232
+ this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(nn), this.currentAnimation.stop()), this.completeAnimation();
2233
+ }
2234
+ applyTransformsToTarget() {
2235
+ const i = this.getLead();
2236
+ let { targetWithTransforms: r, target: a, layout: l, latestValues: u } = i;
2237
+ if (!(!r || !a || !l)) {
2238
+ if (this !== i && this.layout && l && ds(this.options.animationType, this.layout.layoutBox, l.layoutBox)) {
2239
+ a = this.target || D();
2240
+ const h = E(this.layout.layoutBox.x);
2241
+ a.x.min = i.target.x.min, a.x.max = a.x.min + h;
2242
+ const f = E(this.layout.layoutBox.y);
2243
+ a.y.min = i.target.y.min, a.y.max = a.y.min + f;
2244
+ }
2245
+ j(r, a), ot(r, u), mt(this.projectionDeltaWithTransform, this.layoutCorrected, r, u);
2246
+ }
2247
+ }
2248
+ registerSharedNode(i, r) {
2249
+ this.sharedNodes.has(i) || this.sharedNodes.set(i, new sr()), this.sharedNodes.get(i).add(r);
2250
+ const l = r.options.initialPromotionConfig;
2251
+ r.promote({
2252
+ transition: l ? l.transition : void 0,
2253
+ preserveFollowOpacity: l && l.shouldPreserveFollowOpacity ? l.shouldPreserveFollowOpacity(r) : void 0
2254
+ });
2255
+ }
2256
+ isLead() {
2257
+ const i = this.getStack();
2258
+ return i ? i.lead === this : !0;
2259
+ }
2260
+ getLead() {
2261
+ var i;
2262
+ const { layoutId: r } = this.options;
2263
+ return r ? ((i = this.getStack()) === null || i === void 0 ? void 0 : i.lead) || this : this;
2264
+ }
2265
+ getPrevLead() {
2266
+ var i;
2267
+ const { layoutId: r } = this.options;
2268
+ return r ? (i = this.getStack()) === null || i === void 0 ? void 0 : i.prevLead : void 0;
2269
+ }
2270
+ getStack() {
2271
+ const { layoutId: i } = this.options;
2272
+ if (i)
2273
+ return this.root.sharedNodes.get(i);
2274
+ }
2275
+ promote({ needsReset: i, transition: r, preserveFollowOpacity: a } = {}) {
2276
+ const l = this.getStack();
2277
+ l && l.promote(this, a), i && (this.projectionDelta = void 0, this.needsReset = !0), r && this.setOptions({ transition: r });
2278
+ }
2279
+ relegate() {
2280
+ const i = this.getStack();
2281
+ return i ? i.relegate(this) : !1;
2282
+ }
2283
+ resetRotation() {
2284
+ const { visualElement: i } = this.options;
2285
+ if (!i)
2286
+ return;
2287
+ let r = !1;
2288
+ const { latestValues: a } = i;
2289
+ if ((a.rotate || a.rotateX || a.rotateY || a.rotateZ) && (r = !0), !r)
2290
+ return;
2291
+ const l = {};
2292
+ for (let u = 0; u < en.length; u++) {
2293
+ const h = "rotate" + en[u];
2294
+ a[h] && (l[h] = a[h], i.setStaticValue(h, 0));
2295
+ }
2296
+ i.render();
2297
+ for (const u in l)
2298
+ i.setStaticValue(u, l[u]);
2299
+ i.scheduleRender();
2300
+ }
2301
+ getProjectionStyles(i = {}) {
2302
+ var r, a;
2303
+ const l = {};
2304
+ if (!this.instance || this.isSVG)
2305
+ return l;
2306
+ if (this.isVisible)
2307
+ l.visibility = "";
2308
+ else
2309
+ return { visibility: "hidden" };
2310
+ const u = this.getTransformTemplate();
2311
+ if (this.needsReset)
2312
+ return this.needsReset = !1, l.opacity = "", l.pointerEvents = jt(i.pointerEvents) || "", l.transform = u ? u(this.latestValues, "") : "none", l;
2313
+ const h = this.getLead();
2314
+ if (!this.projectionDelta || !this.layout || !h.target) {
2315
+ const m = {};
2316
+ return this.options.layoutId && (m.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1, m.pointerEvents = jt(i.pointerEvents) || ""), this.hasProjected && !J(this.latestValues) && (m.transform = u ? u({}, "") : "none", this.hasProjected = !1), m;
2317
+ }
2318
+ const f = h.animationValues || h.latestValues;
2319
+ this.applyTransformsToTarget(), l.transform = tn(this.projectionDeltaWithTransform, this.treeScale, f), u && (l.transform = u(f, l.transform));
2320
+ const { x: d, y: p } = this.projectionDelta;
2321
+ l.transformOrigin = `${d.origin * 100}% ${p.origin * 100}% 0`, h.animationValues ? l.opacity = h === this ? (a = (r = f.opacity) !== null && r !== void 0 ? r : this.latestValues.opacity) !== null && a !== void 0 ? a : 1 : this.preserveOpacity ? this.latestValues.opacity : f.opacityExit : l.opacity = h === this ? f.opacity !== void 0 ? f.opacity : "" : f.opacityExit !== void 0 ? f.opacityExit : 0;
2322
+ for (const m in ye) {
2323
+ if (f[m] === void 0)
2324
+ continue;
2325
+ const { correct: v, applyTo: V } = ye[m], y = l.transform === "none" ? f[m] : v(f[m], h);
2326
+ if (V) {
2327
+ const g = V.length;
2328
+ for (let P = 0; P < g; P++)
2329
+ l[V[P]] = y;
2330
+ } else
2331
+ l[m] = y;
2332
+ }
2333
+ return this.options.layoutId && (l.pointerEvents = h === this ? jt(i.pointerEvents) || "" : "none"), l;
2334
+ }
2335
+ clearSnapshot() {
2336
+ this.resumeFrom = this.snapshot = void 0;
2337
+ }
2338
+ // Only run on root
2339
+ resetTree() {
2340
+ this.root.nodes.forEach((i) => {
2341
+ var r;
2342
+ return (r = i.currentAnimation) === null || r === void 0 ? void 0 : r.stop();
2343
+ }), this.root.nodes.forEach(sn), this.root.sharedNodes.clear();
2344
+ }
2345
+ };
2346
+ }
2347
+ function hr(e) {
2348
+ e.updateLayout();
2349
+ }
2350
+ function fr(e) {
2351
+ var t;
2352
+ const n = ((t = e.resumeFrom) === null || t === void 0 ? void 0 : t.snapshot) || e.snapshot;
2353
+ if (e.isLead() && e.layout && n && e.hasListeners("didUpdate")) {
2354
+ const { layoutBox: s, measuredBox: o } = e.layout, { animationType: c } = e.options, i = n.source !== e.layout.source;
2355
+ c === "size" ? I((h) => {
2356
+ const f = i ? n.measuredBox[h] : n.layoutBox[h], d = E(f);
2357
+ f.min = s[h].min, f.max = f.min + d;
2358
+ }) : ds(c, n.layoutBox, s) && I((h) => {
2359
+ const f = i ? n.measuredBox[h] : n.layoutBox[h], d = E(s[h]);
2360
+ f.max = f.min + d, e.relativeTarget && !e.currentAnimation && (e.isProjectionDirty = !0, e.relativeTarget[h].max = e.relativeTarget[h].min + d);
2361
+ });
2362
+ const r = it();
2363
+ mt(r, s, n.layoutBox);
2364
+ const a = it();
2365
+ i ? mt(a, e.applyTransform(o, !0), n.measuredBox) : mt(a, s, n.layoutBox);
2366
+ const l = !us(r);
2367
+ let u = !1;
2368
+ if (!e.resumeFrom) {
2369
+ const h = e.getClosestProjectingParent();
2370
+ if (h && !h.resumeFrom) {
2371
+ const { snapshot: f, layout: d } = h;
2372
+ if (f && d) {
2373
+ const p = D();
2374
+ gt(p, n.layoutBox, f.layoutBox);
2375
+ const m = D();
2376
+ gt(m, s, d.layoutBox), hs(p, m) || (u = !0), h.options.layoutRoot && (e.relativeTarget = m, e.relativeTargetOrigin = p, e.relativeParent = h);
2377
+ }
2378
+ }
2379
+ }
2380
+ e.notifyListeners("didUpdate", {
2381
+ layout: s,
2382
+ snapshot: n,
2383
+ delta: a,
2384
+ layoutDelta: r,
2385
+ hasLayoutChanged: l,
2386
+ hasRelativeTargetChanged: u
2387
+ });
2388
+ } else if (e.isLead()) {
2389
+ const { onExitComplete: s } = e.options;
2390
+ s && s();
2391
+ }
2392
+ e.options.transition = void 0;
2393
+ }
2394
+ function dr(e) {
2395
+ Q.totalNodes++, e.parent && (e.isProjecting() || (e.isProjectionDirty = e.parent.isProjectionDirty), e.isSharedProjectionDirty || (e.isSharedProjectionDirty = !!(e.isProjectionDirty || e.parent.isProjectionDirty || e.parent.isSharedProjectionDirty)), e.isTransformDirty || (e.isTransformDirty = e.parent.isTransformDirty));
2396
+ }
2397
+ function pr(e) {
2398
+ e.isProjectionDirty = e.isSharedProjectionDirty = e.isTransformDirty = !1;
2399
+ }
2400
+ function mr(e) {
2401
+ e.clearSnapshot();
2402
+ }
2403
+ function sn(e) {
2404
+ e.clearMeasurements();
2405
+ }
2406
+ function gr(e) {
2407
+ e.isLayoutDirty = !1;
2408
+ }
2409
+ function yr(e) {
2410
+ const { visualElement: t } = e.options;
2411
+ t && t.getProps().onBeforeLayoutMeasure && t.notify("BeforeLayoutMeasure"), e.resetTransform();
2412
+ }
2413
+ function on(e) {
2414
+ e.finishAnimation(), e.targetDelta = e.relativeTarget = e.target = void 0, e.isProjectionDirty = !0;
2415
+ }
2416
+ function vr(e) {
2417
+ e.resolveTargetDelta();
2418
+ }
2419
+ function Pr(e) {
2420
+ e.calcProjection();
2421
+ }
2422
+ function xr(e) {
2423
+ e.resetRotation();
2424
+ }
2425
+ function Tr(e) {
2426
+ e.removeLeadSnapshot();
2427
+ }
2428
+ function rn(e, t, n) {
2429
+ e.translate = w(t.translate, 0, n), e.scale = w(t.scale, 1, n), e.origin = t.origin, e.originPoint = t.originPoint;
2430
+ }
2431
+ function an(e, t, n, s) {
2432
+ e.min = w(t.min, n.min, s), e.max = w(t.max, n.max, s);
2433
+ }
2434
+ function Vr(e, t, n, s) {
2435
+ an(e.x, t.x, n.x, s), an(e.y, t.y, n.y, s);
2436
+ }
2437
+ function Sr(e) {
2438
+ return e.animationValues && e.animationValues.opacityExit !== void 0;
2439
+ }
2440
+ const br = {
2441
+ duration: 0.45,
2442
+ ease: [0.4, 0, 0.1, 1]
2443
+ }, ln = (e) => typeof navigator < "u" && navigator.userAgent.toLowerCase().includes(e), cn = ln("applewebkit/") && !ln("chrome/") ? Math.round : B;
2444
+ function un(e) {
2445
+ e.min = cn(e.min), e.max = cn(e.max);
2446
+ }
2447
+ function Ar(e) {
2448
+ un(e.x), un(e.y);
2449
+ }
2450
+ function ds(e, t, n) {
2451
+ return e === "position" || e === "preserve-aspect" && !Jt(Qe(t), Qe(n), 0.2);
2452
+ }
2453
+ const Dr = fs({
2454
+ attachResizeListener: (e, t) => N(e, "resize", t),
2455
+ measureScroll: () => ({
2456
+ x: document.documentElement.scrollLeft || document.body.scrollLeft,
2457
+ y: document.documentElement.scrollTop || document.body.scrollTop
2458
+ }),
2459
+ checkIsScrollRoot: () => !0
2460
+ }), Kt = {
2461
+ current: void 0
2462
+ }, ps = fs({
2463
+ measureScroll: (e) => ({
2464
+ x: e.scrollLeft,
2465
+ y: e.scrollTop
2466
+ }),
2467
+ defaultParent: () => {
2468
+ if (!Kt.current) {
2469
+ const e = new Dr({});
2470
+ e.mount(window), e.setOptions({ layoutScroll: !0 }), Kt.current = e;
2471
+ }
2472
+ return Kt.current;
2473
+ },
2474
+ resetTransform: (e, t) => {
2475
+ e.style.transform = t !== void 0 ? t : "none";
2476
+ },
2477
+ checkIsScrollRoot: (e) => window.getComputedStyle(e).position === "fixed"
2478
+ }), Cr = {
2479
+ pan: {
2480
+ Feature: zo
2481
+ },
2482
+ drag: {
2483
+ Feature: $o,
2484
+ ProjectionNode: ps,
2485
+ MeasureLayout: as
2486
+ }
2487
+ }, Mr = /var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;
2488
+ function wr(e) {
2489
+ const t = Mr.exec(e);
2490
+ if (!t)
2491
+ return [,];
2492
+ const [, n, s] = t;
2493
+ return [n, s];
2494
+ }
2495
+ const Lr = 4;
2496
+ function ne(e, t, n = 1) {
2497
+ tt(n <= Lr, `Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`);
2498
+ const [s, o] = wr(e);
2499
+ if (!s)
2500
+ return;
2501
+ const c = window.getComputedStyle(t).getPropertyValue(s);
2502
+ if (c) {
2503
+ const i = c.trim();
2504
+ return Zn(i) ? parseFloat(i) : i;
2505
+ } else
2506
+ return Ht(o) ? ne(o, t, n + 1) : o;
2507
+ }
2508
+ function Rr(e, { ...t }, n) {
2509
+ const s = e.current;
2510
+ if (!(s instanceof Element))
2511
+ return { target: t, transitionEnd: n };
2512
+ n && (n = { ...n }), e.values.forEach((o) => {
2513
+ const c = o.get();
2514
+ if (!Ht(c))
2515
+ return;
2516
+ const i = ne(c, s);
2517
+ i && o.set(i);
2518
+ });
2519
+ for (const o in t) {
2520
+ const c = t[o];
2521
+ if (!Ht(c))
2522
+ continue;
2523
+ const i = ne(c, s);
2524
+ i && (t[o] = i, n || (n = {}), n[o] === void 0 && (n[o] = c));
2525
+ }
2526
+ return { target: t, transitionEnd: n };
2527
+ }
2528
+ const Br = /* @__PURE__ */ new Set([
2529
+ "width",
2530
+ "height",
2531
+ "top",
2532
+ "left",
2533
+ "right",
2534
+ "bottom",
2535
+ "x",
2536
+ "y",
2537
+ "translateX",
2538
+ "translateY"
2539
+ ]), ms = (e) => Br.has(e), Fr = (e) => Object.keys(e).some(ms), At = (e) => e === vn || e === xt, hn = (e, t) => parseFloat(e.split(", ")[t]), fn = (e, t) => (n, { transform: s }) => {
2540
+ if (s === "none" || !s)
2541
+ return 0;
2542
+ const o = s.match(/^matrix3d\((.+)\)$/);
2543
+ if (o)
2544
+ return hn(o[1], t);
2545
+ {
2546
+ const c = s.match(/^matrix\((.+)\)$/);
2547
+ return c ? hn(c[1], e) : 0;
2548
+ }
2549
+ }, Er = /* @__PURE__ */ new Set(["x", "y", "z"]), jr = Fs.filter((e) => !Er.has(e));
2550
+ function kr(e) {
2551
+ const t = [];
2552
+ return jr.forEach((n) => {
2553
+ const s = e.getValue(n);
2554
+ s !== void 0 && (t.push([n, s.get()]), s.set(n.startsWith("scale") ? 1 : 0));
2555
+ }), t.length && e.render(), t;
2556
+ }
2557
+ const lt = {
2558
+ // Dimensions
2559
+ width: ({ x: e }, { paddingLeft: t = "0", paddingRight: n = "0" }) => e.max - e.min - parseFloat(t) - parseFloat(n),
2560
+ height: ({ y: e }, { paddingTop: t = "0", paddingBottom: n = "0" }) => e.max - e.min - parseFloat(t) - parseFloat(n),
2561
+ top: (e, { top: t }) => parseFloat(t),
2562
+ left: (e, { left: t }) => parseFloat(t),
2563
+ bottom: ({ y: e }, { top: t }) => parseFloat(t) + (e.max - e.min),
2564
+ right: ({ x: e }, { left: t }) => parseFloat(t) + (e.max - e.min),
2565
+ // Transform
2566
+ x: fn(4, 13),
2567
+ y: fn(5, 14)
2568
+ };
2569
+ lt.translateX = lt.x;
2570
+ lt.translateY = lt.y;
2571
+ const Ir = (e, t, n) => {
2572
+ const s = t.measureViewportBox(), o = t.current, c = getComputedStyle(o), { display: i } = c, r = {};
2573
+ i === "none" && t.setStaticValue("display", e.display || "block"), n.forEach((l) => {
2574
+ r[l] = lt[l](s, c);
2575
+ }), t.render();
2576
+ const a = t.measureViewportBox();
2577
+ return n.forEach((l) => {
2578
+ const u = t.getValue(l);
2579
+ u && u.jump(r[l]), e[l] = lt[l](a, c);
2580
+ }), e;
2581
+ }, Or = (e, t, n = {}, s = {}) => {
2582
+ t = { ...t }, s = { ...s };
2583
+ const o = Object.keys(t).filter(ms);
2584
+ let c = [], i = !1;
2585
+ const r = [];
2586
+ if (o.forEach((a) => {
2587
+ const l = e.getValue(a);
2588
+ if (!e.hasValue(a))
2589
+ return;
2590
+ let u = n[a], h = ht(u);
2591
+ const f = t[a];
2592
+ let d;
2593
+ if ($t(f)) {
2594
+ const p = f.length, m = f[0] === null ? 1 : 0;
2595
+ u = f[m], h = ht(u);
2596
+ for (let v = m; v < p && f[v] !== null; v++)
2597
+ d ? tt(ht(f[v]) === d, "All keyframes must be of the same type") : (d = ht(f[v]), tt(d === h || At(h) && At(d), "Keyframes must be of the same dimension as the current value"));
2598
+ } else
2599
+ d = ht(f);
2600
+ if (h !== d)
2601
+ if (At(h) && At(d)) {
2602
+ const p = l.get();
2603
+ typeof p == "string" && l.set(parseFloat(p)), typeof f == "string" ? t[a] = parseFloat(f) : Array.isArray(f) && d === xt && (t[a] = f.map(parseFloat));
2604
+ } else
2605
+ h != null && h.transform && (d != null && d.transform) && (u === 0 || f === 0) ? u === 0 ? l.set(d.transform(u)) : t[a] = h.transform(f) : (i || (c = kr(e), i = !0), r.push(a), s[a] = s[a] !== void 0 ? s[a] : t[a], l.jump(f));
2606
+ }), r.length) {
2607
+ const a = r.indexOf("height") >= 0 ? window.pageYOffset : null, l = Ir(t, e, r);
2608
+ return c.length && c.forEach(([u, h]) => {
2609
+ e.getValue(u).set(h);
2610
+ }), e.render(), An && a !== null && window.scrollTo({ top: a }), { target: l, transitionEnd: s };
2611
+ } else
2612
+ return { target: t, transitionEnd: s };
2613
+ };
2614
+ function Ur(e, t, n, s) {
2615
+ return Fr(t) ? Or(e, t, n, s) : { target: t, transitionEnd: s };
2616
+ }
2617
+ const Nr = (e, t, n, s) => {
2618
+ const o = Rr(e, t, s);
2619
+ return t = o.target, s = o.transitionEnd, Ur(e, t, n, s);
2620
+ }, se = { current: null }, gs = { current: !1 };
2621
+ function Gr() {
2622
+ if (gs.current = !0, !!An)
2623
+ if (window.matchMedia) {
2624
+ const e = window.matchMedia("(prefers-reduced-motion)"), t = () => se.current = e.matches;
2625
+ e.addListener(t), t();
2626
+ } else
2627
+ se.current = !1;
2628
+ }
2629
+ function Kr(e, t, n) {
2630
+ const { willChange: s } = t;
2631
+ for (const o in t) {
2632
+ const c = t[o], i = n[o];
2633
+ if (nt(c))
2634
+ e.addValue(o, c), wt(s) && s.add(o), process.env.NODE_ENV === "development" && Dn(c.version === "10.16.4", `Attempting to mix Framer Motion versions ${c.version} with 10.16.4 may not work as expected.`);
2635
+ else if (nt(i))
2636
+ e.addValue(o, at(c, { owner: e })), wt(s) && s.remove(o);
2637
+ else if (i !== c)
2638
+ if (e.hasValue(o)) {
2639
+ const r = e.getValue(o);
2640
+ !r.hasAnimated && r.set(c);
2641
+ } else {
2642
+ const r = e.getStaticValue(o);
2643
+ e.addValue(o, at(r !== void 0 ? r : c, { owner: e }));
2644
+ }
2645
+ }
2646
+ for (const o in n)
2647
+ t[o] === void 0 && e.removeValue(o);
2648
+ return t;
2649
+ }
2650
+ const dn = /* @__PURE__ */ new WeakMap(), ys = Object.keys(Cn), $r = ys.length, pn = [
2651
+ "AnimationStart",
2652
+ "AnimationComplete",
2653
+ "Update",
2654
+ "BeforeLayoutMeasure",
2655
+ "LayoutMeasure",
2656
+ "LayoutAnimationStart",
2657
+ "LayoutAnimationComplete"
2658
+ ], zr = Mn.length;
2659
+ class Hr {
2660
+ constructor({ parent: t, props: n, presenceContext: s, reducedMotionConfig: o, visualState: c }, i = {}) {
2661
+ this.current = null, this.children = /* @__PURE__ */ new Set(), this.isVariantNode = !1, this.isControllingVariants = !1, this.shouldReduceMotion = null, this.values = /* @__PURE__ */ new Map(), this.features = {}, this.valueSubscriptions = /* @__PURE__ */ new Map(), this.prevMotionValues = {}, this.events = {}, this.propEventSubscriptions = {}, this.notifyUpdate = () => this.notify("Update", this.latestValues), this.render = () => {
2662
+ this.current && (this.triggerBuild(), this.renderInstance(this.current, this.renderState, this.props.style, this.projection));
2663
+ }, this.scheduleRender = () => C.render(this.render, !1, !0);
2664
+ const { latestValues: r, renderState: a } = c;
2665
+ this.latestValues = r, this.baseTarget = { ...r }, this.initialValues = n.initial ? { ...r } : {}, this.renderState = a, this.parent = t, this.props = n, this.presenceContext = s, this.depth = t ? t.depth + 1 : 0, this.reducedMotionConfig = o, this.options = i, this.isControllingVariants = Es(n), this.isVariantNode = js(n), this.isVariantNode && (this.variantChildren = /* @__PURE__ */ new Set()), this.manuallyAnimateOnMount = !!(t && t.current);
2666
+ const { willChange: l, ...u } = this.scrapeMotionValuesFromProps(n, {});
2667
+ for (const h in u) {
2668
+ const f = u[h];
2669
+ r[h] !== void 0 && nt(f) && (f.set(r[h], !1), wt(l) && l.add(h));
2670
+ }
2671
+ }
2672
+ /**
2673
+ * This method takes React props and returns found MotionValues. For example, HTML
2674
+ * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
2675
+ *
2676
+ * This isn't an abstract method as it needs calling in the constructor, but it is
2677
+ * intended to be one.
2678
+ */
2679
+ scrapeMotionValuesFromProps(t, n) {
2680
+ return {};
2681
+ }
2682
+ mount(t) {
2683
+ this.current = t, dn.set(t, this), this.projection && !this.projection.instance && this.projection.mount(t), this.parent && this.isVariantNode && !this.isControllingVariants && (this.removeFromVariantTree = this.parent.addVariantChild(this)), this.values.forEach((n, s) => this.bindToMotionValue(s, n)), gs.current || Gr(), this.shouldReduceMotion = this.reducedMotionConfig === "never" ? !1 : this.reducedMotionConfig === "always" ? !0 : se.current, process.env.NODE_ENV !== "production" && Dn(this.shouldReduceMotion !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected."), this.parent && this.parent.children.add(this), this.update(this.props, this.presenceContext);
2684
+ }
2685
+ unmount() {
2686
+ dn.delete(this.current), this.projection && this.projection.unmount(), $(this.notifyUpdate), $(this.render), this.valueSubscriptions.forEach((t) => t()), this.removeFromVariantTree && this.removeFromVariantTree(), this.parent && this.parent.children.delete(this);
2687
+ for (const t in this.events)
2688
+ this.events[t].clear();
2689
+ for (const t in this.features)
2690
+ this.features[t].unmount();
2691
+ this.current = null;
2692
+ }
2693
+ bindToMotionValue(t, n) {
2694
+ const s = Pt.has(t), o = n.on("change", (i) => {
2695
+ this.latestValues[t] = i, this.props.onUpdate && C.update(this.notifyUpdate, !1, !0), s && this.projection && (this.projection.isTransformDirty = !0);
2696
+ }), c = n.on("renderRequest", this.scheduleRender);
2697
+ this.valueSubscriptions.set(t, () => {
2698
+ o(), c();
2699
+ });
2700
+ }
2701
+ sortNodePosition(t) {
2702
+ return !this.current || !this.sortInstanceNodePosition || this.type !== t.type ? 0 : this.sortInstanceNodePosition(this.current, t.current);
2703
+ }
2704
+ loadFeatures({ children: t, ...n }, s, o, c) {
2705
+ let i, r;
2706
+ if (process.env.NODE_ENV !== "production" && o && s) {
2707
+ const a = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";
2708
+ n.ignoreStrict ? ie(!1, a) : tt(!1, a);
2709
+ }
2710
+ for (let a = 0; a < $r; a++) {
2711
+ const l = ys[a], { isEnabled: u, Feature: h, ProjectionNode: f, MeasureLayout: d } = Cn[l];
2712
+ f && (i = f), u(n) && (!this.features[l] && h && (this.features[l] = new h(this)), d && (r = d));
2713
+ }
2714
+ if (!this.projection && i) {
2715
+ this.projection = new i(this.latestValues, this.parent && this.parent.projection);
2716
+ const { layoutId: a, layout: l, drag: u, dragConstraints: h, layoutScroll: f, layoutRoot: d } = n;
2717
+ this.projection.setOptions({
2718
+ layoutId: a,
2719
+ layout: l,
2720
+ alwaysMeasureLayout: !!u || h && dt(h),
2721
+ visualElement: this,
2722
+ scheduleRender: () => this.scheduleRender(),
2723
+ /**
2724
+ * TODO: Update options in an effect. This could be tricky as it'll be too late
2725
+ * to update by the time layout animations run.
2726
+ * We also need to fix this safeToRemove by linking it up to the one returned by usePresence,
2727
+ * ensuring it gets called if there's no potential layout animations.
2728
+ *
2729
+ */
2730
+ animationType: typeof l == "string" ? l : "both",
2731
+ initialPromotionConfig: c,
2732
+ layoutScroll: f,
2733
+ layoutRoot: d
2734
+ });
2735
+ }
2736
+ return r;
2737
+ }
2738
+ updateFeatures() {
2739
+ for (const t in this.features) {
2740
+ const n = this.features[t];
2741
+ n.isMounted ? n.update() : (n.mount(), n.isMounted = !0);
2742
+ }
2743
+ }
2744
+ triggerBuild() {
2745
+ this.build(this.renderState, this.latestValues, this.options, this.props);
2746
+ }
2747
+ /**
2748
+ * Measure the current viewport box with or without transforms.
2749
+ * Only measures axis-aligned boxes, rotate and skew must be manually
2750
+ * removed with a re-render to work.
2751
+ */
2752
+ measureViewportBox() {
2753
+ return this.current ? this.measureInstanceViewportBox(this.current, this.props) : D();
2754
+ }
2755
+ getStaticValue(t) {
2756
+ return this.latestValues[t];
2757
+ }
2758
+ setStaticValue(t, n) {
2759
+ this.latestValues[t] = n;
2760
+ }
2761
+ /**
2762
+ * Make a target animatable by Popmotion. For instance, if we're
2763
+ * trying to animate width from 100px to 100vw we need to measure 100vw
2764
+ * in pixels to determine what we really need to animate to. This is also
2765
+ * pluggable to support Framer's custom value types like Color,
2766
+ * and CSS variables.
2767
+ */
2768
+ makeTargetAnimatable(t, n = !0) {
2769
+ return this.makeTargetAnimatableFromInstance(t, this.props, n);
2770
+ }
2771
+ /**
2772
+ * Update the provided props. Ensure any newly-added motion values are
2773
+ * added to our map, old ones removed, and listeners updated.
2774
+ */
2775
+ update(t, n) {
2776
+ (t.transformTemplate || this.props.transformTemplate) && this.scheduleRender(), this.prevProps = this.props, this.props = t, this.prevPresenceContext = this.presenceContext, this.presenceContext = n;
2777
+ for (let s = 0; s < pn.length; s++) {
2778
+ const o = pn[s];
2779
+ this.propEventSubscriptions[o] && (this.propEventSubscriptions[o](), delete this.propEventSubscriptions[o]);
2780
+ const c = t["on" + o];
2781
+ c && (this.propEventSubscriptions[o] = this.on(o, c));
2782
+ }
2783
+ this.prevMotionValues = Kr(this, this.scrapeMotionValuesFromProps(t, this.prevProps), this.prevMotionValues), this.handleChildMotionValue && this.handleChildMotionValue();
2784
+ }
2785
+ getProps() {
2786
+ return this.props;
2787
+ }
2788
+ /**
2789
+ * Returns the variant definition with a given name.
2790
+ */
2791
+ getVariant(t) {
2792
+ return this.props.variants ? this.props.variants[t] : void 0;
2793
+ }
2794
+ /**
2795
+ * Returns the defined default transition on this component.
2796
+ */
2797
+ getDefaultTransition() {
2798
+ return this.props.transition;
2799
+ }
2800
+ getTransformPagePoint() {
2801
+ return this.props.transformPagePoint;
2802
+ }
2803
+ getClosestVariantNode() {
2804
+ return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0;
2805
+ }
2806
+ getVariantContext(t = !1) {
2807
+ if (t)
2808
+ return this.parent ? this.parent.getVariantContext() : void 0;
2809
+ if (!this.isControllingVariants) {
2810
+ const s = this.parent ? this.parent.getVariantContext() || {} : {};
2811
+ return this.props.initial !== void 0 && (s.initial = this.props.initial), s;
2812
+ }
2813
+ const n = {};
2814
+ for (let s = 0; s < zr; s++) {
2815
+ const o = Mn[s], c = this.props[o];
2816
+ (Tn(c) || c === !1) && (n[o] = c);
2817
+ }
2818
+ return n;
2819
+ }
2820
+ /**
2821
+ * Add a child visual element to our set of children.
2822
+ */
2823
+ addVariantChild(t) {
2824
+ const n = this.getClosestVariantNode();
2825
+ if (n)
2826
+ return n.variantChildren && n.variantChildren.add(t), () => n.variantChildren.delete(t);
2827
+ }
2828
+ /**
2829
+ * Add a motion value and bind it to this visual element.
2830
+ */
2831
+ addValue(t, n) {
2832
+ n !== this.values.get(t) && (this.removeValue(t), this.bindToMotionValue(t, n)), this.values.set(t, n), this.latestValues[t] = n.get();
2833
+ }
2834
+ /**
2835
+ * Remove a motion value and unbind any active subscriptions.
2836
+ */
2837
+ removeValue(t) {
2838
+ this.values.delete(t);
2839
+ const n = this.valueSubscriptions.get(t);
2840
+ n && (n(), this.valueSubscriptions.delete(t)), delete this.latestValues[t], this.removeValueFromRenderState(t, this.renderState);
2841
+ }
2842
+ /**
2843
+ * Check whether we have a motion value for this key
2844
+ */
2845
+ hasValue(t) {
2846
+ return this.values.has(t);
2847
+ }
2848
+ getValue(t, n) {
2849
+ if (this.props.values && this.props.values[t])
2850
+ return this.props.values[t];
2851
+ let s = this.values.get(t);
2852
+ return s === void 0 && n !== void 0 && (s = at(n, { owner: this }), this.addValue(t, s)), s;
2853
+ }
2854
+ /**
2855
+ * If we're trying to animate to a previously unencountered value,
2856
+ * we need to check for it in our state and as a last resort read it
2857
+ * directly from the instance (which might have performance implications).
2858
+ */
2859
+ readValue(t) {
2860
+ var n;
2861
+ return this.latestValues[t] !== void 0 || !this.current ? this.latestValues[t] : (n = this.getBaseTargetFromProps(this.props, t)) !== null && n !== void 0 ? n : this.readValueFromInstance(this.current, t, this.options);
2862
+ }
2863
+ /**
2864
+ * Set the base target to later animate back to. This is currently
2865
+ * only hydrated on creation and when we first read a value.
2866
+ */
2867
+ setBaseTarget(t, n) {
2868
+ this.baseTarget[t] = n;
2869
+ }
2870
+ /**
2871
+ * Find the base target for a value thats been removed from all animation
2872
+ * props.
2873
+ */
2874
+ getBaseTarget(t) {
2875
+ var n;
2876
+ const { initial: s } = this.props, o = typeof s == "string" || typeof s == "object" ? (n = mn(this.props, s)) === null || n === void 0 ? void 0 : n[t] : void 0;
2877
+ if (s && o !== void 0)
2878
+ return o;
2879
+ const c = this.getBaseTargetFromProps(this.props, t);
2880
+ return c !== void 0 && !nt(c) ? c : this.initialValues[t] !== void 0 && o === void 0 ? void 0 : this.baseTarget[t];
2881
+ }
2882
+ on(t, n) {
2883
+ return this.events[t] || (this.events[t] = new bn()), this.events[t].add(n);
2884
+ }
2885
+ notify(t, ...n) {
2886
+ this.events[t] && this.events[t].notify(...n);
2887
+ }
2888
+ }
2889
+ class vs extends Hr {
2890
+ sortInstanceNodePosition(t, n) {
2891
+ return t.compareDocumentPosition(n) & 2 ? 1 : -1;
2892
+ }
2893
+ getBaseTargetFromProps(t, n) {
2894
+ return t.style ? t.style[n] : void 0;
2895
+ }
2896
+ removeValueFromRenderState(t, { vars: n, style: s }) {
2897
+ delete n[t], delete s[t];
2898
+ }
2899
+ makeTargetAnimatableFromInstance({ transition: t, transitionEnd: n, ...s }, { transformValues: o }, c) {
2900
+ let i = lo(s, t || {}, this);
2901
+ if (o && (n && (n = o(n)), s && (s = o(s)), i && (i = o(i))), c) {
2902
+ ro(this, s, i);
2903
+ const r = Nr(this, s, i, n);
2904
+ n = r.transitionEnd, s = r.target;
2905
+ }
2906
+ return {
2907
+ transition: t,
2908
+ transitionEnd: n,
2909
+ ...s
2910
+ };
2911
+ }
2912
+ }
2913
+ function _r(e) {
2914
+ return window.getComputedStyle(e);
2915
+ }
2916
+ class Wr extends vs {
2917
+ readValueFromInstance(t, n) {
2918
+ if (Pt.has(n)) {
2919
+ const s = ae(n);
2920
+ return s && s.default || 0;
2921
+ } else {
2922
+ const s = _r(t), o = (ks(n) ? s.getPropertyValue(n) : s[n]) || 0;
2923
+ return typeof o == "string" ? o.trim() : o;
2924
+ }
2925
+ }
2926
+ measureInstanceViewportBox(t, { transformPagePoint: n }) {
2927
+ return rs(t, n);
2928
+ }
2929
+ build(t, n, s, o) {
2930
+ Is(t, n, s, o.transformTemplate);
2931
+ }
2932
+ scrapeMotionValuesFromProps(t, n) {
2933
+ return Os(t, n);
2934
+ }
2935
+ handleChildMotionValue() {
2936
+ this.childSubscription && (this.childSubscription(), delete this.childSubscription);
2937
+ const { children: t } = this.props;
2938
+ nt(t) && (this.childSubscription = t.on("change", (n) => {
2939
+ this.current && (this.current.textContent = `${n}`);
2940
+ }));
2941
+ }
2942
+ renderInstance(t, n, s, o) {
2943
+ Us(t, n, s, o);
2944
+ }
2945
+ }
2946
+ class Yr extends vs {
2947
+ constructor() {
2948
+ super(...arguments), this.isSVGTag = !1;
2949
+ }
2950
+ getBaseTargetFromProps(t, n) {
2951
+ return t[n];
2952
+ }
2953
+ readValueFromInstance(t, n) {
2954
+ if (Pt.has(n)) {
2955
+ const s = ae(n);
2956
+ return s && s.default || 0;
2957
+ }
2958
+ return n = Ns.has(n) ? n : gn(n), t.getAttribute(n);
2959
+ }
2960
+ measureInstanceViewportBox() {
2961
+ return D();
2962
+ }
2963
+ scrapeMotionValuesFromProps(t, n) {
2964
+ return Gs(t, n);
2965
+ }
2966
+ build(t, n, s, o) {
2967
+ Ks(t, n, s, this.isSVGTag, o.transformTemplate);
2968
+ }
2969
+ renderInstance(t, n, s, o) {
2970
+ $s(t, n, s, o);
2971
+ }
2972
+ mount(t) {
2973
+ this.isSVGTag = zs(t.tagName), super.mount(t);
2974
+ }
2975
+ }
2976
+ const qr = (e, t) => Hs(e) ? new Yr(t, { enableHardwareAcceleration: !1 }) : new Wr(t, { enableHardwareAcceleration: !0 }), Xr = {
2977
+ layout: {
2978
+ ProjectionNode: ps,
2979
+ MeasureLayout: as
2980
+ }
2981
+ }, Zr = {
2982
+ renderer: qr,
2983
+ ...So,
2984
+ ...oi
2985
+ }, ca = {
2986
+ ...Zr,
2987
+ ...Cr,
2988
+ ...Xr
2989
+ };
2990
+ export {
2991
+ ca as default
2992
+ };