@vezham/react 0.3.3 → 0.4.0-alpha.0

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,1509 @@
1
+ import { dw as L, dx as ue, dy as tt, dz as ce, dA as v, dB as E, dC as S, dD as fe, dE as Ft, dF as de, dG as O, dH as me, dI as pe, dJ as J, dK as Nt, dL as y, dM as U, dN as ge, dO as ye, dP as ve, dQ as et, dR as Wt, dS as z, dT as xe, dU as Gt, dV as M, dW as zt, dX as st, dY as Pe, dZ as Te, d_ as De, d$ as Ee, e0 as $t, e1 as Se, e2 as Ht, e3 as Xt, e4 as Yt, e5 as _t, e6 as Ae, e7 as it, e8 as Re, e9 as Le, ea as $, eb as B, ec as F, ed as N, ee as nt, ef as Ve, eg as Ce, eh as Be, ei as j, ej as H, ek as ot, el as je, dv as Me } from "./chunk-Z6XE2VH2-zmwNjh3V.js";
2
+ import { em as Ys, f4 as _s, fl as qs, eK as Ks, f5 as Zs, fm as Js, en as Qs, eo as ti, ep as ei, eH as si, eI as ii, eA as ni, g0 as oi, f6 as ai, f7 as ri, eJ as li, eF as hi, ez as ui, fx as ci, ge as fi, g7 as di, eB as mi, er as pi, eR as gi, fy as yi, eS as vi, eT as xi, eU as Pi, eD as Ti, fh as Di, eV as Ei, eW as Si, g1 as Ai, fq as Ri, fj as Li, fA as Vi, eX as Ci, fs as Bi, fe as ji, fo as Mi, fF as wi, ga as ki, gh as bi, g8 as Ii, eY as Oi, eZ as Ui, e_ as Fi, f3 as Ni, fp as Wi, fr as Gi, et as zi, g9 as $i, gn as Hi, fn as Xi, fz as Yi, gm as _i, gb as qi, fR as Ki, go as Zi, f8 as Ji, g2 as Qi, fC as tn, g3 as en, g4 as sn, fd as nn, fM as on, fW as an, f1 as rn, eu as ln, fa as hn, fb as un, fB as cn, f2 as fn, fk as dn, fN as mn, fE as pn, eM as gn, eC as yn, eN as vn, ff as xn, eq as Pn, fc as Tn, es as Dn, ft as En, fi as Sn, eO as An, e$ as Rn, fO as Ln, fS as Vn, fP as Cn, fT as Bn, fV as jn, fQ as Mn, fU as wn, fX as kn, gf as bn, gc as In, eG as On, f9 as Un, fG as Fn, fJ as Nn, fD as Wn, gi as Gn, fH as zn, fY as $n, f0 as Hn, g5 as Xn, g6 as Yn, gg as _n, fI as qn, fg as Kn, fv as Zn, fu as Jn, fw as Qn, fZ as to, f_ as eo, f$ as so, gl as io, fK as no, fL as oo, gd as ao, ev as ro, ew as lo, ex as ho, ey as uo, eP as co, gj as fo, eE as mo, gk as po, eQ as go, eL as yo } from "./chunk-Z6XE2VH2-zmwNjh3V.js";
3
+ import { jsx as we } from "react/jsx-runtime";
4
+ import { useContext as at, Component as ke } from "react";
5
+ function be(t) {
6
+ return t === "x" || t === "y" ? L[t] ? null : (L[t] = !0, () => {
7
+ L[t] = !1;
8
+ }) : L.x || L.y ? null : (L.x = L.y = !0, () => {
9
+ L.x = L.y = !1;
10
+ });
11
+ }
12
+ function qt(t) {
13
+ return ue(t) && "ownerSVGElement" in t;
14
+ }
15
+ function Ie(t) {
16
+ return qt(t) && t.tagName === "svg";
17
+ }
18
+ function k(t, e, i, n) {
19
+ return tt(t, e, ce(i), n);
20
+ }
21
+ const Kt = 1e-4, Oe = 1 - Kt, Ue = 1 + Kt, Zt = 0.01, Fe = 0 - Zt, Ne = 0 + Zt;
22
+ function D(t) {
23
+ return t.max - t.min;
24
+ }
25
+ function We(t, e, i) {
26
+ return Math.abs(t - e) <= i;
27
+ }
28
+ function rt(t, e, i, n = 0.5) {
29
+ t.origin = n, t.originPoint = v(e.min, e.max, t.origin), t.scale = D(i) / D(e), t.translate = v(i.min, i.max, t.origin) - t.originPoint, (t.scale >= Oe && t.scale <= Ue || isNaN(t.scale)) && (t.scale = 1), (t.translate >= Fe && t.translate <= Ne || isNaN(t.translate)) && (t.translate = 0);
30
+ }
31
+ function b(t, e, i, n) {
32
+ rt(t.x, e.x, i.x, n ? n.originX : void 0), rt(t.y, e.y, i.y, n ? n.originY : void 0);
33
+ }
34
+ function lt(t, e, i) {
35
+ t.min = i.min + e.min, t.max = t.min + D(e);
36
+ }
37
+ function Ge(t, e, i) {
38
+ lt(t.x, e.x, i.x), lt(t.y, e.y, i.y);
39
+ }
40
+ function ht(t, e, i) {
41
+ t.min = e.min - i.min, t.max = t.min + D(e);
42
+ }
43
+ function I(t, e, i) {
44
+ ht(t.x, e.x, i.x), ht(t.y, e.y, i.y);
45
+ }
46
+ function R(t) {
47
+ return [t("x"), t("y")];
48
+ }
49
+ const Jt = ({ current: t }) => t ? t.ownerDocument.defaultView : null, ut = (t, e) => Math.abs(t - e);
50
+ function ze(t, e) {
51
+ const i = ut(t.x, e.x), n = ut(t.y, e.y);
52
+ return Math.sqrt(i ** 2 + n ** 2);
53
+ }
54
+ class Qt {
55
+ constructor(e, i, { transformPagePoint: n, contextWindow: r = window, dragSnapToOrigin: u = !1, distanceThreshold: s = 3 } = {}) {
56
+ if (this.startEvent = null, this.lastMoveEvent = null, this.lastMoveEventInfo = null, this.handlers = {}, this.contextWindow = window, this.updatePoint = () => {
57
+ if (!(this.lastMoveEvent && this.lastMoveEventInfo))
58
+ return;
59
+ const f = Y(this.lastMoveEventInfo, this.history), d = this.startEvent !== null, m = ze(f.offset, { x: 0, y: 0 }) >= this.distanceThreshold;
60
+ if (!d && !m)
61
+ return;
62
+ const { point: x } = f, { timestamp: g } = E;
63
+ this.history.push({ ...x, timestamp: g });
64
+ const { onStart: p, onMove: P } = this.handlers;
65
+ d || (p && p(this.lastMoveEvent, f), this.startEvent = this.lastMoveEvent), P && P(this.lastMoveEvent, f);
66
+ }, this.handlePointerMove = (f, d) => {
67
+ this.lastMoveEvent = f, this.lastMoveEventInfo = X(d, this.transformPagePoint), S.update(this.updatePoint, !0);
68
+ }, this.handlePointerUp = (f, d) => {
69
+ this.end();
70
+ const { onEnd: m, onSessionEnd: x, resumeAnimation: g } = this.handlers;
71
+ if (this.dragSnapToOrigin && g && g(), !(this.lastMoveEvent && this.lastMoveEventInfo))
72
+ return;
73
+ const p = Y(f.type === "pointercancel" ? this.lastMoveEventInfo : X(d, this.transformPagePoint), this.history);
74
+ this.startEvent && m && m(f, p), x && x(f, p);
75
+ }, !fe(e))
76
+ return;
77
+ this.dragSnapToOrigin = u, this.handlers = i, this.transformPagePoint = n, this.distanceThreshold = s, this.contextWindow = r || window;
78
+ const o = Ft(e), a = X(o, this.transformPagePoint), { point: l } = a, { timestamp: h } = E;
79
+ this.history = [{ ...l, timestamp: h }];
80
+ const { onSessionStart: c } = i;
81
+ c && c(e, Y(a, this.history)), this.removeListeners = de(k(this.contextWindow, "pointermove", this.handlePointerMove), k(this.contextWindow, "pointerup", this.handlePointerUp), k(this.contextWindow, "pointercancel", this.handlePointerUp));
82
+ }
83
+ updateHandlers(e) {
84
+ this.handlers = e;
85
+ }
86
+ end() {
87
+ this.removeListeners && this.removeListeners(), O(this.updatePoint);
88
+ }
89
+ }
90
+ function X(t, e) {
91
+ return e ? { point: e(t.point) } : t;
92
+ }
93
+ function ct(t, e) {
94
+ return { x: t.x - e.x, y: t.y - e.y };
95
+ }
96
+ function Y({ point: t }, e) {
97
+ return {
98
+ point: t,
99
+ delta: ct(t, te(e)),
100
+ offset: ct(t, $e(e)),
101
+ velocity: He(e, 0.1)
102
+ };
103
+ }
104
+ function $e(t) {
105
+ return t[0];
106
+ }
107
+ function te(t) {
108
+ return t[t.length - 1];
109
+ }
110
+ function He(t, e) {
111
+ if (t.length < 2)
112
+ return { x: 0, y: 0 };
113
+ let i = t.length - 1, n = null;
114
+ const r = te(t);
115
+ for (; i >= 0 && (n = t[i], !(r.timestamp - n.timestamp > me(e))); )
116
+ i--;
117
+ if (!n)
118
+ return { x: 0, y: 0 };
119
+ const u = pe(r.timestamp - n.timestamp);
120
+ if (u === 0)
121
+ return { x: 0, y: 0 };
122
+ const s = {
123
+ x: (r.x - n.x) / u,
124
+ y: (r.y - n.y) / u
125
+ };
126
+ return s.x === 1 / 0 && (s.x = 0), s.y === 1 / 0 && (s.y = 0), s;
127
+ }
128
+ function Xe(t, { min: e, max: i }, n) {
129
+ return e !== void 0 && t < e ? t = n ? v(e, t, n.min) : Math.max(t, e) : i !== void 0 && t > i && (t = n ? v(i, t, n.max) : Math.min(t, i)), t;
130
+ }
131
+ function ft(t, e, i) {
132
+ return {
133
+ min: e !== void 0 ? t.min + e : void 0,
134
+ max: i !== void 0 ? t.max + i - (t.max - t.min) : void 0
135
+ };
136
+ }
137
+ function Ye(t, { top: e, left: i, bottom: n, right: r }) {
138
+ return {
139
+ x: ft(t.x, i, r),
140
+ y: ft(t.y, e, n)
141
+ };
142
+ }
143
+ function dt(t, e) {
144
+ let i = e.min - t.min, n = e.max - t.max;
145
+ return e.max - e.min < t.max - t.min && ([i, n] = [n, i]), { min: i, max: n };
146
+ }
147
+ function _e(t, e) {
148
+ return {
149
+ x: dt(t.x, e.x),
150
+ y: dt(t.y, e.y)
151
+ };
152
+ }
153
+ function qe(t, e) {
154
+ let i = 0.5;
155
+ const n = D(t), r = D(e);
156
+ return r > n ? i = J(e.min, e.max - n, t.min) : n > r && (i = J(t.min, t.max - r, e.min)), Nt(0, 1, i);
157
+ }
158
+ function Ke(t, e) {
159
+ const i = {};
160
+ return e.min !== void 0 && (i.min = e.min - t.min), e.max !== void 0 && (i.max = e.max - t.min), i;
161
+ }
162
+ const Q = 0.35;
163
+ function Ze(t = Q) {
164
+ return t === !1 ? t = 0 : t === !0 && (t = Q), {
165
+ x: mt(t, "left", "right"),
166
+ y: mt(t, "top", "bottom")
167
+ };
168
+ }
169
+ function mt(t, e, i) {
170
+ return {
171
+ min: pt(t, e),
172
+ max: pt(t, i)
173
+ };
174
+ }
175
+ function pt(t, e) {
176
+ return typeof t == "number" ? t : t[e] || 0;
177
+ }
178
+ const Je = /* @__PURE__ */ new WeakMap();
179
+ class Qe {
180
+ constructor(e) {
181
+ this.openDragLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = { x: 0, y: 0 }, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = y(), this.latestPointerEvent = null, this.latestPanInfo = null, this.visualElement = e;
182
+ }
183
+ start(e, { snapToCursor: i = !1, distanceThreshold: n } = {}) {
184
+ const { presenceContext: r } = this.visualElement;
185
+ if (r && r.isPresent === !1)
186
+ return;
187
+ const u = (c) => {
188
+ const { dragSnapToOrigin: f } = this.getProps();
189
+ f ? this.pauseAnimation() : this.stopAnimation(), i && this.snapToCursor(Ft(c).point);
190
+ }, s = (c, f) => {
191
+ const { drag: d, dragPropagation: m, onDragStart: x } = this.getProps();
192
+ if (d && !m && (this.openDragLock && this.openDragLock(), this.openDragLock = be(d), !this.openDragLock))
193
+ return;
194
+ this.latestPointerEvent = c, this.latestPanInfo = f, this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), R((p) => {
195
+ let P = this.getAxisMotionValue(p).get() || 0;
196
+ if (z.test(P)) {
197
+ const { projection: T } = this.visualElement;
198
+ if (T && T.layout) {
199
+ const V = T.layout.layoutBox[p];
200
+ V && (P = D(V) * (parseFloat(P) / 100));
201
+ }
202
+ }
203
+ this.originPoint[p] = P;
204
+ }), x && S.postRender(() => x(c, f)), et(this.visualElement, "transform");
205
+ const { animationState: g } = this.visualElement;
206
+ g && g.setActive("whileDrag", !0);
207
+ }, o = (c, f) => {
208
+ this.latestPointerEvent = c, this.latestPanInfo = f;
209
+ const { dragPropagation: d, dragDirectionLock: m, onDirectionLock: x, onDrag: g } = this.getProps();
210
+ if (!d && !this.openDragLock)
211
+ return;
212
+ const { offset: p } = f;
213
+ if (m && this.currentDirection === null) {
214
+ this.currentDirection = ts(p), this.currentDirection !== null && x && x(this.currentDirection);
215
+ return;
216
+ }
217
+ this.updateAxis("x", f.point, p), this.updateAxis("y", f.point, p), this.visualElement.render(), g && g(c, f);
218
+ }, a = (c, f) => {
219
+ this.latestPointerEvent = c, this.latestPanInfo = f, this.stop(c, f), this.latestPointerEvent = null, this.latestPanInfo = null;
220
+ }, l = () => R((c) => this.getAnimationState(c) === "paused" && this.getAxisMotionValue(c).animation?.play()), { dragSnapToOrigin: h } = this.getProps();
221
+ this.panSession = new Qt(e, {
222
+ onSessionStart: u,
223
+ onStart: s,
224
+ onMove: o,
225
+ onSessionEnd: a,
226
+ resumeAnimation: l
227
+ }, {
228
+ transformPagePoint: this.visualElement.getTransformPagePoint(),
229
+ dragSnapToOrigin: h,
230
+ distanceThreshold: n,
231
+ contextWindow: Jt(this.visualElement)
232
+ });
233
+ }
234
+ /**
235
+ * @internal
236
+ */
237
+ stop(e, i) {
238
+ const n = e || this.latestPointerEvent, r = i || this.latestPanInfo, u = this.isDragging;
239
+ if (this.cancel(), !u || !r || !n)
240
+ return;
241
+ const { velocity: s } = r;
242
+ this.startAnimation(s);
243
+ const { onDragEnd: o } = this.getProps();
244
+ o && S.postRender(() => o(n, r));
245
+ }
246
+ /**
247
+ * @internal
248
+ */
249
+ cancel() {
250
+ this.isDragging = !1;
251
+ const { projection: e, animationState: i } = this.visualElement;
252
+ e && (e.isAnimationBlocked = !1), this.panSession && this.panSession.end(), this.panSession = void 0;
253
+ const { dragPropagation: n } = this.getProps();
254
+ !n && this.openDragLock && (this.openDragLock(), this.openDragLock = null), i && i.setActive("whileDrag", !1);
255
+ }
256
+ updateAxis(e, i, n) {
257
+ const { drag: r } = this.getProps();
258
+ if (!n || !W(e, r, this.currentDirection))
259
+ return;
260
+ const u = this.getAxisMotionValue(e);
261
+ let s = this.originPoint[e] + n[e];
262
+ this.constraints && this.constraints[e] && (s = Xe(s, this.constraints[e], this.elastic[e])), u.set(s);
263
+ }
264
+ resolveConstraints() {
265
+ const { dragConstraints: e, dragElastic: i } = this.getProps(), n = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : this.visualElement.projection?.layout, r = this.constraints;
266
+ e && U(e) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : e && n ? this.constraints = Ye(n.layoutBox, e) : this.constraints = !1, this.elastic = Ze(i), r !== this.constraints && n && this.constraints && !this.hasMutatedConstraints && R((u) => {
267
+ this.constraints !== !1 && this.getAxisMotionValue(u) && (this.constraints[u] = Ke(n.layoutBox[u], this.constraints[u]));
268
+ });
269
+ }
270
+ resolveRefConstraints() {
271
+ const { dragConstraints: e, onMeasureDragConstraints: i } = this.getProps();
272
+ if (!e || !U(e))
273
+ return !1;
274
+ const n = e.current;
275
+ xe(n !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.", "drag-constraints-ref");
276
+ const { projection: r } = this.visualElement;
277
+ if (!r || !r.layout)
278
+ return !1;
279
+ const u = ge(n, r.root, this.visualElement.getTransformPagePoint());
280
+ let s = _e(r.layout.layoutBox, u);
281
+ if (i) {
282
+ const o = i(ye(s));
283
+ this.hasMutatedConstraints = !!o, o && (s = ve(o));
284
+ }
285
+ return s;
286
+ }
287
+ startAnimation(e) {
288
+ const { drag: i, dragMomentum: n, dragElastic: r, dragTransition: u, dragSnapToOrigin: s, onDragTransitionEnd: o } = this.getProps(), a = this.constraints || {}, l = R((h) => {
289
+ if (!W(h, i, this.currentDirection))
290
+ return;
291
+ let c = a && a[h] || {};
292
+ s && (c = { min: 0, max: 0 });
293
+ const f = r ? 200 : 1e6, d = r ? 40 : 1e7, m = {
294
+ type: "inertia",
295
+ velocity: n ? e[h] : 0,
296
+ bounceStiffness: f,
297
+ bounceDamping: d,
298
+ timeConstant: 750,
299
+ restDelta: 1,
300
+ restSpeed: 10,
301
+ ...u,
302
+ ...c
303
+ };
304
+ return this.startAxisValueAnimation(h, m);
305
+ });
306
+ return Promise.all(l).then(o);
307
+ }
308
+ startAxisValueAnimation(e, i) {
309
+ const n = this.getAxisMotionValue(e);
310
+ return et(this.visualElement, e), n.start(Wt(e, n, 0, i, this.visualElement, !1));
311
+ }
312
+ stopAnimation() {
313
+ R((e) => this.getAxisMotionValue(e).stop());
314
+ }
315
+ pauseAnimation() {
316
+ R((e) => this.getAxisMotionValue(e).animation?.pause());
317
+ }
318
+ getAnimationState(e) {
319
+ return this.getAxisMotionValue(e).animation?.state;
320
+ }
321
+ /**
322
+ * Drag works differently depending on which props are provided.
323
+ *
324
+ * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.
325
+ * - Otherwise, we apply the delta to the x/y motion values.
326
+ */
327
+ getAxisMotionValue(e) {
328
+ const i = `_drag${e.toUpperCase()}`, n = this.visualElement.getProps(), r = n[i];
329
+ return r || this.visualElement.getValue(e, (n.initial ? n.initial[e] : void 0) || 0);
330
+ }
331
+ snapToCursor(e) {
332
+ R((i) => {
333
+ const { drag: n } = this.getProps();
334
+ if (!W(i, n, this.currentDirection))
335
+ return;
336
+ const { projection: r } = this.visualElement, u = this.getAxisMotionValue(i);
337
+ if (r && r.layout) {
338
+ const { min: s, max: o } = r.layout.layoutBox[i];
339
+ u.set(e[i] - v(s, o, 0.5));
340
+ }
341
+ });
342
+ }
343
+ /**
344
+ * When the viewport resizes we want to check if the measured constraints
345
+ * have changed and, if so, reposition the element within those new constraints
346
+ * relative to where it was before the resize.
347
+ */
348
+ scalePositionWithinConstraints() {
349
+ if (!this.visualElement.current)
350
+ return;
351
+ const { drag: e, dragConstraints: i } = this.getProps(), { projection: n } = this.visualElement;
352
+ if (!U(i) || !n || !this.constraints)
353
+ return;
354
+ this.stopAnimation();
355
+ const r = { x: 0, y: 0 };
356
+ R((s) => {
357
+ const o = this.getAxisMotionValue(s);
358
+ if (o && this.constraints !== !1) {
359
+ const a = o.get();
360
+ r[s] = qe({ min: a, max: a }, this.constraints[s]);
361
+ }
362
+ });
363
+ const { transformTemplate: u } = this.visualElement.getProps();
364
+ this.visualElement.current.style.transform = u ? u({}, "") : "none", n.root && n.root.updateScroll(), n.updateLayout(), this.resolveConstraints(), R((s) => {
365
+ if (!W(s, e, null))
366
+ return;
367
+ const o = this.getAxisMotionValue(s), { min: a, max: l } = this.constraints[s];
368
+ o.set(v(a, l, r[s]));
369
+ });
370
+ }
371
+ addListeners() {
372
+ if (!this.visualElement.current)
373
+ return;
374
+ Je.set(this.visualElement, this);
375
+ const e = this.visualElement.current, i = k(e, "pointerdown", (a) => {
376
+ const { drag: l, dragListener: h = !0 } = this.getProps();
377
+ l && h && this.start(a);
378
+ }), n = () => {
379
+ const { dragConstraints: a } = this.getProps();
380
+ U(a) && a.current && (this.constraints = this.resolveRefConstraints());
381
+ }, { projection: r } = this.visualElement, u = r.addEventListener("measure", n);
382
+ r && !r.layout && (r.root && r.root.updateScroll(), r.updateLayout()), S.read(n);
383
+ const s = tt(window, "resize", () => this.scalePositionWithinConstraints()), o = r.addEventListener("didUpdate", (({ delta: a, hasLayoutChanged: l }) => {
384
+ this.isDragging && l && (R((h) => {
385
+ const c = this.getAxisMotionValue(h);
386
+ c && (this.originPoint[h] += a[h].translate, c.set(c.get() + a[h].translate));
387
+ }), this.visualElement.render());
388
+ }));
389
+ return () => {
390
+ s(), i(), u(), o && o();
391
+ };
392
+ }
393
+ getProps() {
394
+ const e = this.visualElement.getProps(), { drag: i = !1, dragDirectionLock: n = !1, dragPropagation: r = !1, dragConstraints: u = !1, dragElastic: s = Q, dragMomentum: o = !0 } = e;
395
+ return {
396
+ ...e,
397
+ drag: i,
398
+ dragDirectionLock: n,
399
+ dragPropagation: r,
400
+ dragConstraints: u,
401
+ dragElastic: s,
402
+ dragMomentum: o
403
+ };
404
+ }
405
+ }
406
+ function W(t, e, i) {
407
+ return (e === !0 || e === t) && (i === null || i === t);
408
+ }
409
+ function ts(t, e = 10) {
410
+ let i = null;
411
+ return Math.abs(t.y) > e ? i = "y" : Math.abs(t.x) > e && (i = "x"), i;
412
+ }
413
+ class es extends Gt {
414
+ constructor(e) {
415
+ super(e), this.removeGroupControls = M, this.removeListeners = M, this.controls = new Qe(e);
416
+ }
417
+ mount() {
418
+ const { dragControls: e } = this.node.getProps();
419
+ e && (this.removeGroupControls = e.subscribe(this.controls)), this.removeListeners = this.controls.addListeners() || M;
420
+ }
421
+ unmount() {
422
+ this.removeGroupControls(), this.removeListeners();
423
+ }
424
+ }
425
+ const gt = (t) => (e, i) => {
426
+ t && S.postRender(() => t(e, i));
427
+ };
428
+ class ss extends Gt {
429
+ constructor() {
430
+ super(...arguments), this.removePointerDownListener = M;
431
+ }
432
+ onPointerDown(e) {
433
+ this.session = new Qt(e, this.createPanHandlers(), {
434
+ transformPagePoint: this.node.getTransformPagePoint(),
435
+ contextWindow: Jt(this.node)
436
+ });
437
+ }
438
+ createPanHandlers() {
439
+ const { onPanSessionStart: e, onPanStart: i, onPan: n, onPanEnd: r } = this.node.getProps();
440
+ return {
441
+ onSessionStart: gt(e),
442
+ onStart: gt(i),
443
+ onMove: n,
444
+ onEnd: (u, s) => {
445
+ delete this.session, r && S.postRender(() => r(u, s));
446
+ }
447
+ };
448
+ }
449
+ mount() {
450
+ this.removePointerDownListener = k(this.node.current, "pointerdown", (e) => this.onPointerDown(e));
451
+ }
452
+ update() {
453
+ this.session && this.session.updateHandlers(this.createPanHandlers());
454
+ }
455
+ unmount() {
456
+ this.removePointerDownListener(), this.session && this.session.end();
457
+ }
458
+ }
459
+ const G = {
460
+ /**
461
+ * Global flag as to whether the tree has animated since the last time
462
+ * we resized the window
463
+ */
464
+ hasAnimatedSinceResize: !0,
465
+ /**
466
+ * We set this to true once, on the first update. Any nodes added to the tree beyond that
467
+ * update will be given a `data-projection-id` attribute.
468
+ */
469
+ hasEverUpdated: !1
470
+ };
471
+ function yt(t, e) {
472
+ return e.max === e.min ? 0 : t / (e.max - e.min) * 100;
473
+ }
474
+ const w = {
475
+ correct: (t, e) => {
476
+ if (!e.target)
477
+ return t;
478
+ if (typeof t == "string")
479
+ if (zt.test(t))
480
+ t = parseFloat(t);
481
+ else
482
+ return t;
483
+ const i = yt(t, e.target.x), n = yt(t, e.target.y);
484
+ return `${i}% ${n}%`;
485
+ }
486
+ }, is = {
487
+ correct: (t, { treeScale: e, projectionDelta: i }) => {
488
+ const n = t, r = st.parse(t);
489
+ if (r.length > 5)
490
+ return n;
491
+ const u = st.createTransformer(t), s = typeof r[0] != "number" ? 1 : 0, o = i.x.scale * e.x, a = i.y.scale * e.y;
492
+ r[0 + s] /= o, r[1 + s] /= a;
493
+ const l = v(o, a, 0.5);
494
+ return typeof r[2 + s] == "number" && (r[2 + s] /= l), typeof r[3 + s] == "number" && (r[3 + s] /= l), u(r);
495
+ }
496
+ };
497
+ let _ = !1;
498
+ class ns extends ke {
499
+ /**
500
+ * This only mounts projection nodes for components that
501
+ * need measuring, we might want to do it for all components
502
+ * in order to incorporate transforms
503
+ */
504
+ componentDidMount() {
505
+ const { visualElement: e, layoutGroup: i, switchLayoutGroup: n, layoutId: r } = this.props, { projection: u } = e;
506
+ Ee(os), u && (i.group && i.group.add(u), n && n.register && r && n.register(u), _ && u.root.didUpdate(), u.addEventListener("animationComplete", () => {
507
+ this.safeToRemove();
508
+ }), u.setOptions({
509
+ ...u.options,
510
+ onExitComplete: () => this.safeToRemove()
511
+ })), G.hasEverUpdated = !0;
512
+ }
513
+ getSnapshotBeforeUpdate(e) {
514
+ const { layoutDependency: i, visualElement: n, drag: r, isPresent: u } = this.props, { projection: s } = n;
515
+ return s && (s.isPresent = u, _ = !0, r || e.layoutDependency !== i || i === void 0 || e.isPresent !== u ? s.willUpdate() : this.safeToRemove(), e.isPresent !== u && (u ? s.promote() : s.relegate() || S.postRender(() => {
516
+ const o = s.getStack();
517
+ (!o || !o.members.length) && this.safeToRemove();
518
+ }))), null;
519
+ }
520
+ componentDidUpdate() {
521
+ const { projection: e } = this.props.visualElement;
522
+ e && (e.root.didUpdate(), $t.postRender(() => {
523
+ !e.currentAnimation && e.isLead() && this.safeToRemove();
524
+ }));
525
+ }
526
+ componentWillUnmount() {
527
+ const { visualElement: e, layoutGroup: i, switchLayoutGroup: n } = this.props, { projection: r } = e;
528
+ _ = !0, r && (r.scheduleCheckAfterUnmount(), i && i.group && i.group.remove(r), n && n.deregister && n.deregister(r));
529
+ }
530
+ safeToRemove() {
531
+ const { safeToRemove: e } = this.props;
532
+ e && e();
533
+ }
534
+ render() {
535
+ return null;
536
+ }
537
+ }
538
+ function ee(t) {
539
+ const [e, i] = Pe(), n = at(Te);
540
+ return we(ns, { ...t, layoutGroup: n, switchLayoutGroup: at(De), isPresent: e, safeToRemove: i });
541
+ }
542
+ const os = {
543
+ borderRadius: {
544
+ ...w,
545
+ applyTo: [
546
+ "borderTopLeftRadius",
547
+ "borderTopRightRadius",
548
+ "borderBottomLeftRadius",
549
+ "borderBottomRightRadius"
550
+ ]
551
+ },
552
+ borderTopLeftRadius: w,
553
+ borderTopRightRadius: w,
554
+ borderBottomLeftRadius: w,
555
+ borderBottomRightRadius: w,
556
+ boxShadow: is
557
+ };
558
+ function as(t, e, i) {
559
+ const n = Se(t) ? t : Ht(t);
560
+ return n.start(Wt("", n, e, i)), n.animation;
561
+ }
562
+ const rs = (t, e) => t.depth - e.depth;
563
+ class ls {
564
+ constructor() {
565
+ this.children = [], this.isDirty = !1;
566
+ }
567
+ add(e) {
568
+ Xt(this.children, e), this.isDirty = !0;
569
+ }
570
+ remove(e) {
571
+ Yt(this.children, e), this.isDirty = !0;
572
+ }
573
+ forEach(e) {
574
+ this.isDirty && this.children.sort(rs), this.isDirty = !1, this.children.forEach(e);
575
+ }
576
+ }
577
+ function hs(t, e) {
578
+ const i = _t.now(), n = ({ timestamp: r }) => {
579
+ const u = r - i;
580
+ u >= e && (O(n), t(u - e));
581
+ };
582
+ return S.setup(n, !0), () => O(n);
583
+ }
584
+ const se = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"], us = se.length, vt = (t) => typeof t == "string" ? parseFloat(t) : t, xt = (t) => typeof t == "number" || zt.test(t);
585
+ function cs(t, e, i, n, r, u) {
586
+ r ? (t.opacity = v(0, i.opacity ?? 1, fs(n)), t.opacityExit = v(e.opacity ?? 1, 0, ds(n))) : u && (t.opacity = v(e.opacity ?? 1, i.opacity ?? 1, n));
587
+ for (let s = 0; s < us; s++) {
588
+ const o = `border${se[s]}Radius`;
589
+ let a = Pt(e, o), l = Pt(i, o);
590
+ if (a === void 0 && l === void 0)
591
+ continue;
592
+ a || (a = 0), l || (l = 0), a === 0 || l === 0 || xt(a) === xt(l) ? (t[o] = Math.max(v(vt(a), vt(l), n), 0), (z.test(l) || z.test(a)) && (t[o] += "%")) : t[o] = l;
593
+ }
594
+ (e.rotate || i.rotate) && (t.rotate = v(e.rotate || 0, i.rotate || 0, n));
595
+ }
596
+ function Pt(t, e) {
597
+ return t[e] !== void 0 ? t[e] : t.borderRadius;
598
+ }
599
+ const fs = /* @__PURE__ */ ie(0, 0.5, Ae), ds = /* @__PURE__ */ ie(0.5, 0.95, M);
600
+ function ie(t, e, i) {
601
+ return (n) => n < t ? 0 : n > e ? 1 : i(J(t, e, n));
602
+ }
603
+ function Tt(t, e) {
604
+ t.min = e.min, t.max = e.max;
605
+ }
606
+ function A(t, e) {
607
+ Tt(t.x, e.x), Tt(t.y, e.y);
608
+ }
609
+ function Dt(t, e) {
610
+ t.translate = e.translate, t.scale = e.scale, t.originPoint = e.originPoint, t.origin = e.origin;
611
+ }
612
+ function Et(t, e, i, n, r) {
613
+ return t -= e, t = it(t, 1 / i, n), r !== void 0 && (t = it(t, 1 / r, n)), t;
614
+ }
615
+ function ms(t, e = 0, i = 1, n = 0.5, r, u = t, s = t) {
616
+ if (z.test(e) && (e = parseFloat(e), e = v(s.min, s.max, e / 100) - s.min), typeof e != "number")
617
+ return;
618
+ let o = v(u.min, u.max, n);
619
+ t === u && (o -= e), t.min = Et(t.min, e, i, o, r), t.max = Et(t.max, e, i, o, r);
620
+ }
621
+ function St(t, e, [i, n, r], u, s) {
622
+ ms(t, e[i], e[n], e[r], e.scale, u, s);
623
+ }
624
+ const ps = ["x", "scaleX", "originX"], gs = ["y", "scaleY", "originY"];
625
+ function At(t, e, i, n) {
626
+ St(t.x, e, ps, i ? i.x : void 0, n ? n.x : void 0), St(t.y, e, gs, i ? i.y : void 0, n ? n.y : void 0);
627
+ }
628
+ function Rt(t) {
629
+ return t.translate === 0 && t.scale === 1;
630
+ }
631
+ function ne(t) {
632
+ return Rt(t.x) && Rt(t.y);
633
+ }
634
+ function Lt(t, e) {
635
+ return t.min === e.min && t.max === e.max;
636
+ }
637
+ function ys(t, e) {
638
+ return Lt(t.x, e.x) && Lt(t.y, e.y);
639
+ }
640
+ function Vt(t, e) {
641
+ return Math.round(t.min) === Math.round(e.min) && Math.round(t.max) === Math.round(e.max);
642
+ }
643
+ function oe(t, e) {
644
+ return Vt(t.x, e.x) && Vt(t.y, e.y);
645
+ }
646
+ function Ct(t) {
647
+ return D(t.x) / D(t.y);
648
+ }
649
+ function Bt(t, e) {
650
+ return t.translate === e.translate && t.scale === e.scale && t.originPoint === e.originPoint;
651
+ }
652
+ class vs {
653
+ constructor() {
654
+ this.members = [];
655
+ }
656
+ add(e) {
657
+ Xt(this.members, e), e.scheduleRender();
658
+ }
659
+ remove(e) {
660
+ if (Yt(this.members, e), e === this.prevLead && (this.prevLead = void 0), e === this.lead) {
661
+ const i = this.members[this.members.length - 1];
662
+ i && this.promote(i);
663
+ }
664
+ }
665
+ relegate(e) {
666
+ const i = this.members.findIndex((r) => e === r);
667
+ if (i === 0)
668
+ return !1;
669
+ let n;
670
+ for (let r = i; r >= 0; r--) {
671
+ const u = this.members[r];
672
+ if (u.isPresent !== !1) {
673
+ n = u;
674
+ break;
675
+ }
676
+ }
677
+ return n ? (this.promote(n), !0) : !1;
678
+ }
679
+ promote(e, i) {
680
+ const n = this.lead;
681
+ if (e !== n && (this.prevLead = n, this.lead = e, e.show(), n)) {
682
+ n.instance && n.scheduleRender(), e.scheduleRender(), e.resumeFrom = n, i && (e.resumeFrom.preserveOpacity = !0), n.snapshot && (e.snapshot = n.snapshot, e.snapshot.latestValues = n.animationValues || n.latestValues), e.root && e.root.isUpdating && (e.isLayoutDirty = !0);
683
+ const { crossfade: r } = e.options;
684
+ r === !1 && n.hide();
685
+ }
686
+ }
687
+ exitAnimationComplete() {
688
+ this.members.forEach((e) => {
689
+ const { options: i, resumingFrom: n } = e;
690
+ i.onExitComplete && i.onExitComplete(), n && n.options.onExitComplete && n.options.onExitComplete();
691
+ });
692
+ }
693
+ scheduleRender() {
694
+ this.members.forEach((e) => {
695
+ e.instance && e.scheduleRender(!1);
696
+ });
697
+ }
698
+ /**
699
+ * Clear any leads that have been removed this render to prevent them from being
700
+ * used in future animations and to prevent memory leaks
701
+ */
702
+ removeLeadSnapshot() {
703
+ this.lead && this.lead.snapshot && (this.lead.snapshot = void 0);
704
+ }
705
+ }
706
+ function xs(t, e, i) {
707
+ let n = "";
708
+ const r = t.x.translate / e.x, u = t.y.translate / e.y, s = i?.z || 0;
709
+ if ((r || u || s) && (n = `translate3d(${r}px, ${u}px, ${s}px) `), (e.x !== 1 || e.y !== 1) && (n += `scale(${1 / e.x}, ${1 / e.y}) `), i) {
710
+ const { transformPerspective: l, rotate: h, rotateX: c, rotateY: f, skewX: d, skewY: m } = i;
711
+ l && (n = `perspective(${l}px) ${n}`), h && (n += `rotate(${h}deg) `), c && (n += `rotateX(${c}deg) `), f && (n += `rotateY(${f}deg) `), d && (n += `skewX(${d}deg) `), m && (n += `skewY(${m}deg) `);
712
+ }
713
+ const o = t.x.scale * e.x, a = t.y.scale * e.y;
714
+ return (o !== 1 || a !== 1) && (n += `scale(${o}, ${a})`), n || "none";
715
+ }
716
+ const q = ["", "X", "Y", "Z"], Ps = 1e3;
717
+ let Ts = 0;
718
+ function K(t, e, i, n) {
719
+ const { latestValues: r } = e;
720
+ r[t] && (i[t] = r[t], e.setStaticValue(t, 0), n && (n[t] = 0));
721
+ }
722
+ function ae(t) {
723
+ if (t.hasCheckedOptimisedAppear = !0, t.root === t)
724
+ return;
725
+ const { visualElement: e } = t.options;
726
+ if (!e)
727
+ return;
728
+ const i = je(e);
729
+ if (window.MotionHasOptimisedAnimation(i, "transform")) {
730
+ const { layout: r, layoutId: u } = t.options;
731
+ window.MotionCancelOptimisedAnimation(i, "transform", S, !(r || u));
732
+ }
733
+ const { parent: n } = t;
734
+ n && !n.hasCheckedOptimisedAppear && ae(n);
735
+ }
736
+ function re({ attachResizeListener: t, defaultParent: e, measureScroll: i, checkIsScrollRoot: n, resetTransform: r }) {
737
+ return class {
738
+ constructor(s = {}, o = e?.()) {
739
+ this.id = Ts++, this.animationId = 0, this.animationCommitId = 0, this.children = /* @__PURE__ */ new Set(), this.options = {}, this.isTreeAnimating = !1, this.isAnimationBlocked = !1, this.isLayoutDirty = !1, this.isProjectionDirty = !1, this.isSharedProjectionDirty = !1, this.isTransformDirty = !1, this.updateManuallyBlocked = !1, this.updateBlockedByResize = !1, this.isUpdating = !1, this.isSVG = !1, this.needsReset = !1, this.shouldResetTransform = !1, this.hasCheckedOptimisedAppear = !1, this.treeScale = { x: 1, y: 1 }, this.eventHandlers = /* @__PURE__ */ new Map(), this.hasTreeAnimated = !1, this.updateScheduled = !1, this.scheduleUpdate = () => this.update(), this.projectionUpdateScheduled = !1, this.checkUpdateFailed = () => {
740
+ this.isUpdating && (this.isUpdating = !1, this.clearAllSnapshots());
741
+ }, this.updateProjection = () => {
742
+ this.projectionUpdateScheduled = !1, this.nodes.forEach(Ss), this.nodes.forEach(Vs), this.nodes.forEach(Cs), this.nodes.forEach(As);
743
+ }, this.resolvedRelativeTargetAt = 0, this.hasProjected = !1, this.isVisible = !0, this.animationProgress = 0, this.sharedNodes = /* @__PURE__ */ new Map(), this.latestValues = s, this.root = o ? o.root || o : this, this.path = o ? [...o.path, o] : [], this.parent = o, this.depth = o ? o.depth + 1 : 0;
744
+ for (let a = 0; a < this.path.length; a++)
745
+ this.path[a].shouldResetTransform = !0;
746
+ this.root === this && (this.nodes = new ls());
747
+ }
748
+ addEventListener(s, o) {
749
+ return this.eventHandlers.has(s) || this.eventHandlers.set(s, new Re()), this.eventHandlers.get(s).add(o);
750
+ }
751
+ notifyListeners(s, ...o) {
752
+ const a = this.eventHandlers.get(s);
753
+ a && a.notify(...o);
754
+ }
755
+ hasListeners(s) {
756
+ return this.eventHandlers.has(s);
757
+ }
758
+ /**
759
+ * Lifecycles
760
+ */
761
+ mount(s) {
762
+ if (this.instance)
763
+ return;
764
+ this.isSVG = qt(s) && !Ie(s), this.instance = s;
765
+ const { layoutId: o, layout: a, visualElement: l } = this.options;
766
+ if (l && !l.current && l.mount(s), this.root.nodes.add(this), this.parent && this.parent.children.add(this), this.root.hasTreeAnimated && (a || o) && (this.isLayoutDirty = !0), t) {
767
+ let h, c = 0;
768
+ const f = () => this.root.updateBlockedByResize = !1;
769
+ S.read(() => {
770
+ c = window.innerWidth;
771
+ }), t(s, () => {
772
+ const d = window.innerWidth;
773
+ d !== c && (c = d, this.root.updateBlockedByResize = !0, h && h(), h = hs(f, 250), G.hasAnimatedSinceResize && (G.hasAnimatedSinceResize = !1, this.nodes.forEach(wt)));
774
+ });
775
+ }
776
+ o && this.root.registerSharedNode(o, this), this.options.animate !== !1 && l && (o || a) && this.addEventListener("didUpdate", ({ delta: h, hasLayoutChanged: c, hasRelativeLayoutChanged: f, layout: d }) => {
777
+ if (this.isTreeAnimationBlocked()) {
778
+ this.target = void 0, this.relativeTarget = void 0;
779
+ return;
780
+ }
781
+ const m = this.options.transition || l.getDefaultTransition() || ks, { onLayoutAnimationStart: x, onLayoutAnimationComplete: g } = l.getProps(), p = !this.targetLayout || !oe(this.targetLayout, d), P = !c && f;
782
+ if (this.options.layoutRoot || this.resumeFrom || P || c && (p || !this.currentAnimation)) {
783
+ this.resumeFrom && (this.resumingFrom = this.resumeFrom, this.resumingFrom.resumingFrom = void 0);
784
+ const T = {
785
+ ...Le(m, "layout"),
786
+ onPlay: x,
787
+ onComplete: g
788
+ };
789
+ (l.shouldReduceMotion || this.options.layoutRoot) && (T.delay = 0, T.type = !1), this.startAnimation(T), this.setAnimationOrigin(h, P);
790
+ } else
791
+ c || wt(this), this.isLead() && this.options.onExitComplete && this.options.onExitComplete();
792
+ this.targetLayout = d;
793
+ });
794
+ }
795
+ unmount() {
796
+ this.options.layoutId && this.willUpdate(), this.root.nodes.remove(this);
797
+ const s = this.getStack();
798
+ s && s.remove(this), this.parent && this.parent.children.delete(this), this.instance = void 0, this.eventHandlers.clear(), O(this.updateProjection);
799
+ }
800
+ // only on the root
801
+ blockUpdate() {
802
+ this.updateManuallyBlocked = !0;
803
+ }
804
+ unblockUpdate() {
805
+ this.updateManuallyBlocked = !1;
806
+ }
807
+ isUpdateBlocked() {
808
+ return this.updateManuallyBlocked || this.updateBlockedByResize;
809
+ }
810
+ isTreeAnimationBlocked() {
811
+ return this.isAnimationBlocked || this.parent && this.parent.isTreeAnimationBlocked() || !1;
812
+ }
813
+ // Note: currently only running on root node
814
+ startUpdate() {
815
+ this.isUpdateBlocked() || (this.isUpdating = !0, this.nodes && this.nodes.forEach(Bs), this.animationId++);
816
+ }
817
+ getTransformTemplate() {
818
+ const { visualElement: s } = this.options;
819
+ return s && s.getProps().transformTemplate;
820
+ }
821
+ willUpdate(s = !0) {
822
+ if (this.root.hasTreeAnimated = !0, this.root.isUpdateBlocked()) {
823
+ this.options.onExitComplete && this.options.onExitComplete();
824
+ return;
825
+ }
826
+ if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear && ae(this), !this.root.isUpdating && this.root.startUpdate(), this.isLayoutDirty)
827
+ return;
828
+ this.isLayoutDirty = !0;
829
+ for (let h = 0; h < this.path.length; h++) {
830
+ const c = this.path[h];
831
+ c.shouldResetTransform = !0, c.updateScroll("snapshot"), c.options.layoutRoot && c.willUpdate(!1);
832
+ }
833
+ const { layoutId: o, layout: a } = this.options;
834
+ if (o === void 0 && !a)
835
+ return;
836
+ const l = this.getTransformTemplate();
837
+ this.prevTransformTemplateValue = l ? l(this.latestValues, "") : void 0, this.updateSnapshot(), s && this.notifyListeners("willUpdate");
838
+ }
839
+ update() {
840
+ if (this.updateScheduled = !1, this.isUpdateBlocked()) {
841
+ this.unblockUpdate(), this.clearAllSnapshots(), this.nodes.forEach(jt);
842
+ return;
843
+ }
844
+ if (this.animationId <= this.animationCommitId) {
845
+ this.nodes.forEach(Mt);
846
+ return;
847
+ }
848
+ this.animationCommitId = this.animationId, this.isUpdating ? (this.isUpdating = !1, this.nodes.forEach(Ls), this.nodes.forEach(Ds), this.nodes.forEach(Es)) : this.nodes.forEach(Mt), this.clearAllSnapshots();
849
+ const o = _t.now();
850
+ E.delta = Nt(0, 1e3 / 60, o - E.timestamp), E.timestamp = o, E.isProcessing = !0, $.update.process(E), $.preRender.process(E), $.render.process(E), E.isProcessing = !1;
851
+ }
852
+ didUpdate() {
853
+ this.updateScheduled || (this.updateScheduled = !0, $t.read(this.scheduleUpdate));
854
+ }
855
+ clearAllSnapshots() {
856
+ this.nodes.forEach(Rs), this.sharedNodes.forEach(js);
857
+ }
858
+ scheduleUpdateProjection() {
859
+ this.projectionUpdateScheduled || (this.projectionUpdateScheduled = !0, S.preRender(this.updateProjection, !1, !0));
860
+ }
861
+ scheduleCheckAfterUnmount() {
862
+ S.postRender(() => {
863
+ this.isLayoutDirty ? this.root.didUpdate() : this.root.checkUpdateFailed();
864
+ });
865
+ }
866
+ /**
867
+ * Update measurements
868
+ */
869
+ updateSnapshot() {
870
+ this.snapshot || !this.instance || (this.snapshot = this.measure(), this.snapshot && !D(this.snapshot.measuredBox.x) && !D(this.snapshot.measuredBox.y) && (this.snapshot = void 0));
871
+ }
872
+ updateLayout() {
873
+ if (!this.instance || (this.updateScroll(), !(this.options.alwaysMeasureLayout && this.isLead()) && !this.isLayoutDirty))
874
+ return;
875
+ if (this.resumeFrom && !this.resumeFrom.instance)
876
+ for (let a = 0; a < this.path.length; a++)
877
+ this.path[a].updateScroll();
878
+ const s = this.layout;
879
+ this.layout = this.measure(!1), this.layoutCorrected = y(), this.isLayoutDirty = !1, this.projectionDelta = void 0, this.notifyListeners("measure", this.layout.layoutBox);
880
+ const { visualElement: o } = this.options;
881
+ o && o.notify("LayoutMeasure", this.layout.layoutBox, s ? s.layoutBox : void 0);
882
+ }
883
+ updateScroll(s = "measure") {
884
+ let o = !!(this.options.layoutScroll && this.instance);
885
+ if (this.scroll && this.scroll.animationId === this.root.animationId && this.scroll.phase === s && (o = !1), o && this.instance) {
886
+ const a = n(this.instance);
887
+ this.scroll = {
888
+ animationId: this.root.animationId,
889
+ phase: s,
890
+ isRoot: a,
891
+ offset: i(this.instance),
892
+ wasRoot: this.scroll ? this.scroll.isRoot : a
893
+ };
894
+ }
895
+ }
896
+ resetTransform() {
897
+ if (!r)
898
+ return;
899
+ const s = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout, o = this.projectionDelta && !ne(this.projectionDelta), a = this.getTransformTemplate(), l = a ? a(this.latestValues, "") : void 0, h = l !== this.prevTransformTemplateValue;
900
+ s && this.instance && (o || B(this.latestValues) || h) && (r(this.instance, l), this.shouldResetTransform = !1, this.scheduleRender());
901
+ }
902
+ measure(s = !0) {
903
+ const o = this.measurePageBox();
904
+ let a = this.removeElementScroll(o);
905
+ return s && (a = this.removeTransform(a)), bs(a), {
906
+ animationId: this.root.animationId,
907
+ measuredBox: o,
908
+ layoutBox: a,
909
+ latestValues: {},
910
+ source: this.id
911
+ };
912
+ }
913
+ measurePageBox() {
914
+ const { visualElement: s } = this.options;
915
+ if (!s)
916
+ return y();
917
+ const o = s.measureViewportBox();
918
+ if (!(this.scroll?.wasRoot || this.path.some(Is))) {
919
+ const { scroll: l } = this.root;
920
+ l && (F(o.x, l.offset.x), F(o.y, l.offset.y));
921
+ }
922
+ return o;
923
+ }
924
+ removeElementScroll(s) {
925
+ const o = y();
926
+ if (A(o, s), this.scroll?.wasRoot)
927
+ return o;
928
+ for (let a = 0; a < this.path.length; a++) {
929
+ const l = this.path[a], { scroll: h, options: c } = l;
930
+ l !== this.root && h && c.layoutScroll && (h.wasRoot && A(o, s), F(o.x, h.offset.x), F(o.y, h.offset.y));
931
+ }
932
+ return o;
933
+ }
934
+ applyTransform(s, o = !1) {
935
+ const a = y();
936
+ A(a, s);
937
+ for (let l = 0; l < this.path.length; l++) {
938
+ const h = this.path[l];
939
+ !o && h.options.layoutScroll && h.scroll && h !== h.root && N(a, {
940
+ x: -h.scroll.offset.x,
941
+ y: -h.scroll.offset.y
942
+ }), B(h.latestValues) && N(a, h.latestValues);
943
+ }
944
+ return B(this.latestValues) && N(a, this.latestValues), a;
945
+ }
946
+ removeTransform(s) {
947
+ const o = y();
948
+ A(o, s);
949
+ for (let a = 0; a < this.path.length; a++) {
950
+ const l = this.path[a];
951
+ if (!l.instance || !B(l.latestValues))
952
+ continue;
953
+ nt(l.latestValues) && l.updateSnapshot();
954
+ const h = y(), c = l.measurePageBox();
955
+ A(h, c), At(o, l.latestValues, l.snapshot ? l.snapshot.layoutBox : void 0, h);
956
+ }
957
+ return B(this.latestValues) && At(o, this.latestValues), o;
958
+ }
959
+ setTargetDelta(s) {
960
+ this.targetDelta = s, this.root.scheduleUpdateProjection(), this.isProjectionDirty = !0;
961
+ }
962
+ setOptions(s) {
963
+ this.options = {
964
+ ...this.options,
965
+ ...s,
966
+ crossfade: s.crossfade !== void 0 ? s.crossfade : !0
967
+ };
968
+ }
969
+ clearMeasurements() {
970
+ 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;
971
+ }
972
+ forceRelativeParentToResolveTarget() {
973
+ this.relativeParent && this.relativeParent.resolvedRelativeTargetAt !== E.timestamp && this.relativeParent.resolveTargetDelta(!0);
974
+ }
975
+ resolveTargetDelta(s = !1) {
976
+ const o = this.getLead();
977
+ this.isProjectionDirty || (this.isProjectionDirty = o.isProjectionDirty), this.isTransformDirty || (this.isTransformDirty = o.isTransformDirty), this.isSharedProjectionDirty || (this.isSharedProjectionDirty = o.isSharedProjectionDirty);
978
+ const a = !!this.resumingFrom || this !== o;
979
+ if (!(s || a && this.isSharedProjectionDirty || this.isProjectionDirty || this.parent?.isProjectionDirty || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize))
980
+ return;
981
+ const { layout: h, layoutId: c } = this.options;
982
+ if (!(!this.layout || !(h || c))) {
983
+ if (this.resolvedRelativeTargetAt = E.timestamp, !this.targetDelta && !this.relativeTarget) {
984
+ const f = this.getClosestProjectingParent();
985
+ f && f.layout && this.animationProgress !== 1 ? (this.relativeParent = f, this.forceRelativeParentToResolveTarget(), this.relativeTarget = y(), this.relativeTargetOrigin = y(), I(this.relativeTargetOrigin, this.layout.layoutBox, f.layout.layoutBox), A(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0;
986
+ }
987
+ if (!(!this.relativeTarget && !this.targetDelta) && (this.target || (this.target = y(), this.targetWithTransforms = y()), this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target ? (this.forceRelativeParentToResolveTarget(), Ge(this.target, this.relativeTarget, this.relativeParent.target)) : this.targetDelta ? (this.resumingFrom ? this.target = this.applyTransform(this.layout.layoutBox) : A(this.target, this.layout.layoutBox), Ve(this.target, this.targetDelta)) : A(this.target, this.layout.layoutBox), this.attemptToResolveRelativeTarget)) {
988
+ this.attemptToResolveRelativeTarget = !1;
989
+ const f = this.getClosestProjectingParent();
990
+ f && !!f.resumingFrom == !!this.resumingFrom && !f.options.layoutScroll && f.target && this.animationProgress !== 1 ? (this.relativeParent = f, this.forceRelativeParentToResolveTarget(), this.relativeTarget = y(), this.relativeTargetOrigin = y(), I(this.relativeTargetOrigin, this.target, f.target), A(this.relativeTarget, this.relativeTargetOrigin)) : this.relativeParent = this.relativeTarget = void 0;
991
+ }
992
+ }
993
+ }
994
+ getClosestProjectingParent() {
995
+ if (!(!this.parent || nt(this.parent.latestValues) || Ce(this.parent.latestValues)))
996
+ return this.parent.isProjecting() ? this.parent : this.parent.getClosestProjectingParent();
997
+ }
998
+ isProjecting() {
999
+ return !!((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
1000
+ }
1001
+ calcProjection() {
1002
+ const s = this.getLead(), o = !!this.resumingFrom || this !== s;
1003
+ let a = !0;
1004
+ if ((this.isProjectionDirty || this.parent?.isProjectionDirty) && (a = !1), o && (this.isSharedProjectionDirty || this.isTransformDirty) && (a = !1), this.resolvedRelativeTargetAt === E.timestamp && (a = !1), a)
1005
+ return;
1006
+ const { layout: l, layoutId: h } = this.options;
1007
+ if (this.isTreeAnimating = !!(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation), this.isTreeAnimating || (this.targetDelta = this.relativeTarget = void 0), !this.layout || !(l || h))
1008
+ return;
1009
+ A(this.layoutCorrected, this.layout.layoutBox);
1010
+ const c = this.treeScale.x, f = this.treeScale.y;
1011
+ Be(this.layoutCorrected, this.treeScale, this.path, o), s.layout && !s.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1) && (s.target = s.layout.layoutBox, s.targetWithTransforms = y());
1012
+ const { target: d } = s;
1013
+ if (!d) {
1014
+ this.prevProjectionDelta && (this.createProjectionDeltas(), this.scheduleRender());
1015
+ return;
1016
+ }
1017
+ !this.projectionDelta || !this.prevProjectionDelta ? this.createProjectionDeltas() : (Dt(this.prevProjectionDelta.x, this.projectionDelta.x), Dt(this.prevProjectionDelta.y, this.projectionDelta.y)), b(this.projectionDelta, this.layoutCorrected, d, this.latestValues), (this.treeScale.x !== c || this.treeScale.y !== f || !Bt(this.projectionDelta.x, this.prevProjectionDelta.x) || !Bt(this.projectionDelta.y, this.prevProjectionDelta.y)) && (this.hasProjected = !0, this.scheduleRender(), this.notifyListeners("projectionUpdate", d));
1018
+ }
1019
+ hide() {
1020
+ this.isVisible = !1;
1021
+ }
1022
+ show() {
1023
+ this.isVisible = !0;
1024
+ }
1025
+ scheduleRender(s = !0) {
1026
+ if (this.options.visualElement?.scheduleRender(), s) {
1027
+ const o = this.getStack();
1028
+ o && o.scheduleRender();
1029
+ }
1030
+ this.resumingFrom && !this.resumingFrom.instance && (this.resumingFrom = void 0);
1031
+ }
1032
+ createProjectionDeltas() {
1033
+ this.prevProjectionDelta = j(), this.projectionDelta = j(), this.projectionDeltaWithTransform = j();
1034
+ }
1035
+ setAnimationOrigin(s, o = !1) {
1036
+ const a = this.snapshot, l = a ? a.latestValues : {}, h = { ...this.latestValues }, c = j();
1037
+ (!this.relativeParent || !this.relativeParent.options.layoutRoot) && (this.relativeTarget = this.relativeTargetOrigin = void 0), this.attemptToResolveRelativeTarget = !o;
1038
+ const f = y(), d = a ? a.source : void 0, m = this.layout ? this.layout.source : void 0, x = d !== m, g = this.getStack(), p = !g || g.members.length <= 1, P = !!(x && !p && this.options.crossfade === !0 && !this.path.some(ws));
1039
+ this.animationProgress = 0;
1040
+ let T;
1041
+ this.mixTargetDelta = (V) => {
1042
+ const C = V / 1e3;
1043
+ kt(c.x, s.x, C), kt(c.y, s.y, C), this.setTargetDelta(c), this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout && (I(f, this.layout.layoutBox, this.relativeParent.layout.layoutBox), Ms(this.relativeTarget, this.relativeTargetOrigin, f, C), T && ys(this.relativeTarget, T) && (this.isProjectionDirty = !1), T || (T = y()), A(T, this.relativeTarget)), x && (this.animationValues = h, cs(h, l, this.latestValues, C, P, p)), this.root.scheduleUpdateProjection(), this.scheduleRender(), this.animationProgress = C;
1044
+ }, this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0);
1045
+ }
1046
+ startAnimation(s) {
1047
+ this.notifyListeners("animationStart"), this.currentAnimation?.stop(), this.resumingFrom?.currentAnimation?.stop(), this.pendingAnimation && (O(this.pendingAnimation), this.pendingAnimation = void 0), this.pendingAnimation = S.update(() => {
1048
+ G.hasAnimatedSinceResize = !0, this.motionValue || (this.motionValue = Ht(0)), this.currentAnimation = as(this.motionValue, [0, 1e3], {
1049
+ ...s,
1050
+ velocity: 0,
1051
+ isSync: !0,
1052
+ onUpdate: (o) => {
1053
+ this.mixTargetDelta(o), s.onUpdate && s.onUpdate(o);
1054
+ },
1055
+ onStop: () => {
1056
+ },
1057
+ onComplete: () => {
1058
+ s.onComplete && s.onComplete(), this.completeAnimation();
1059
+ }
1060
+ }), this.resumingFrom && (this.resumingFrom.currentAnimation = this.currentAnimation), this.pendingAnimation = void 0;
1061
+ });
1062
+ }
1063
+ completeAnimation() {
1064
+ this.resumingFrom && (this.resumingFrom.currentAnimation = void 0, this.resumingFrom.preserveOpacity = void 0);
1065
+ const s = this.getStack();
1066
+ s && s.exitAnimationComplete(), this.resumingFrom = this.currentAnimation = this.animationValues = void 0, this.notifyListeners("animationComplete");
1067
+ }
1068
+ finishAnimation() {
1069
+ this.currentAnimation && (this.mixTargetDelta && this.mixTargetDelta(Ps), this.currentAnimation.stop()), this.completeAnimation();
1070
+ }
1071
+ applyTransformsToTarget() {
1072
+ const s = this.getLead();
1073
+ let { targetWithTransforms: o, target: a, layout: l, latestValues: h } = s;
1074
+ if (!(!o || !a || !l)) {
1075
+ if (this !== s && this.layout && l && le(this.options.animationType, this.layout.layoutBox, l.layoutBox)) {
1076
+ a = this.target || y();
1077
+ const c = D(this.layout.layoutBox.x);
1078
+ a.x.min = s.target.x.min, a.x.max = a.x.min + c;
1079
+ const f = D(this.layout.layoutBox.y);
1080
+ a.y.min = s.target.y.min, a.y.max = a.y.min + f;
1081
+ }
1082
+ A(o, a), N(o, h), b(this.projectionDeltaWithTransform, this.layoutCorrected, o, h);
1083
+ }
1084
+ }
1085
+ registerSharedNode(s, o) {
1086
+ this.sharedNodes.has(s) || this.sharedNodes.set(s, new vs()), this.sharedNodes.get(s).add(o);
1087
+ const l = o.options.initialPromotionConfig;
1088
+ o.promote({
1089
+ transition: l ? l.transition : void 0,
1090
+ preserveFollowOpacity: l && l.shouldPreserveFollowOpacity ? l.shouldPreserveFollowOpacity(o) : void 0
1091
+ });
1092
+ }
1093
+ isLead() {
1094
+ const s = this.getStack();
1095
+ return s ? s.lead === this : !0;
1096
+ }
1097
+ getLead() {
1098
+ const { layoutId: s } = this.options;
1099
+ return s ? this.getStack()?.lead || this : this;
1100
+ }
1101
+ getPrevLead() {
1102
+ const { layoutId: s } = this.options;
1103
+ return s ? this.getStack()?.prevLead : void 0;
1104
+ }
1105
+ getStack() {
1106
+ const { layoutId: s } = this.options;
1107
+ if (s)
1108
+ return this.root.sharedNodes.get(s);
1109
+ }
1110
+ promote({ needsReset: s, transition: o, preserveFollowOpacity: a } = {}) {
1111
+ const l = this.getStack();
1112
+ l && l.promote(this, a), s && (this.projectionDelta = void 0, this.needsReset = !0), o && this.setOptions({ transition: o });
1113
+ }
1114
+ relegate() {
1115
+ const s = this.getStack();
1116
+ return s ? s.relegate(this) : !1;
1117
+ }
1118
+ resetSkewAndRotation() {
1119
+ const { visualElement: s } = this.options;
1120
+ if (!s)
1121
+ return;
1122
+ let o = !1;
1123
+ const { latestValues: a } = s;
1124
+ if ((a.z || a.rotate || a.rotateX || a.rotateY || a.rotateZ || a.skewX || a.skewY) && (o = !0), !o)
1125
+ return;
1126
+ const l = {};
1127
+ a.z && K("z", s, l, this.animationValues);
1128
+ for (let h = 0; h < q.length; h++)
1129
+ K(`rotate${q[h]}`, s, l, this.animationValues), K(`skew${q[h]}`, s, l, this.animationValues);
1130
+ s.render();
1131
+ for (const h in l)
1132
+ s.setStaticValue(h, l[h]), this.animationValues && (this.animationValues[h] = l[h]);
1133
+ s.scheduleRender();
1134
+ }
1135
+ applyProjectionStyles(s, o) {
1136
+ if (!this.instance || this.isSVG)
1137
+ return;
1138
+ if (!this.isVisible) {
1139
+ s.visibility = "hidden";
1140
+ return;
1141
+ }
1142
+ const a = this.getTransformTemplate();
1143
+ if (this.needsReset) {
1144
+ this.needsReset = !1, s.visibility = "", s.opacity = "", s.pointerEvents = H(o?.pointerEvents) || "", s.transform = a ? a(this.latestValues, "") : "none";
1145
+ return;
1146
+ }
1147
+ const l = this.getLead();
1148
+ if (!this.projectionDelta || !this.layout || !l.target) {
1149
+ this.options.layoutId && (s.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1, s.pointerEvents = H(o?.pointerEvents) || ""), this.hasProjected && !B(this.latestValues) && (s.transform = a ? a({}, "") : "none", this.hasProjected = !1);
1150
+ return;
1151
+ }
1152
+ s.visibility = "";
1153
+ const h = l.animationValues || l.latestValues;
1154
+ this.applyTransformsToTarget();
1155
+ let c = xs(this.projectionDeltaWithTransform, this.treeScale, h);
1156
+ a && (c = a(h, c)), s.transform = c;
1157
+ const { x: f, y: d } = this.projectionDelta;
1158
+ s.transformOrigin = `${f.origin * 100}% ${d.origin * 100}% 0`, l.animationValues ? s.opacity = l === this ? h.opacity ?? this.latestValues.opacity ?? 1 : this.preserveOpacity ? this.latestValues.opacity : h.opacityExit : s.opacity = l === this ? h.opacity !== void 0 ? h.opacity : "" : h.opacityExit !== void 0 ? h.opacityExit : 0;
1159
+ for (const m in ot) {
1160
+ if (h[m] === void 0)
1161
+ continue;
1162
+ const { correct: x, applyTo: g, isCSSVariable: p } = ot[m], P = c === "none" ? h[m] : x(h[m], l);
1163
+ if (g) {
1164
+ const T = g.length;
1165
+ for (let V = 0; V < T; V++)
1166
+ s[g[V]] = P;
1167
+ } else
1168
+ p ? this.options.visualElement.renderState.vars[m] = P : s[m] = P;
1169
+ }
1170
+ this.options.layoutId && (s.pointerEvents = l === this ? H(o?.pointerEvents) || "" : "none");
1171
+ }
1172
+ clearSnapshot() {
1173
+ this.resumeFrom = this.snapshot = void 0;
1174
+ }
1175
+ // Only run on root
1176
+ resetTree() {
1177
+ this.root.nodes.forEach((s) => s.currentAnimation?.stop()), this.root.nodes.forEach(jt), this.root.sharedNodes.clear();
1178
+ }
1179
+ };
1180
+ }
1181
+ function Ds(t) {
1182
+ t.updateLayout();
1183
+ }
1184
+ function Es(t) {
1185
+ const e = t.resumeFrom?.snapshot || t.snapshot;
1186
+ if (t.isLead() && t.layout && e && t.hasListeners("didUpdate")) {
1187
+ const { layoutBox: i, measuredBox: n } = t.layout, { animationType: r } = t.options, u = e.source !== t.layout.source;
1188
+ r === "size" ? R((h) => {
1189
+ const c = u ? e.measuredBox[h] : e.layoutBox[h], f = D(c);
1190
+ c.min = i[h].min, c.max = c.min + f;
1191
+ }) : le(r, e.layoutBox, i) && R((h) => {
1192
+ const c = u ? e.measuredBox[h] : e.layoutBox[h], f = D(i[h]);
1193
+ c.max = c.min + f, t.relativeTarget && !t.currentAnimation && (t.isProjectionDirty = !0, t.relativeTarget[h].max = t.relativeTarget[h].min + f);
1194
+ });
1195
+ const s = j();
1196
+ b(s, i, e.layoutBox);
1197
+ const o = j();
1198
+ u ? b(o, t.applyTransform(n, !0), e.measuredBox) : b(o, i, e.layoutBox);
1199
+ const a = !ne(s);
1200
+ let l = !1;
1201
+ if (!t.resumeFrom) {
1202
+ const h = t.getClosestProjectingParent();
1203
+ if (h && !h.resumeFrom) {
1204
+ const { snapshot: c, layout: f } = h;
1205
+ if (c && f) {
1206
+ const d = y();
1207
+ I(d, e.layoutBox, c.layoutBox);
1208
+ const m = y();
1209
+ I(m, i, f.layoutBox), oe(d, m) || (l = !0), h.options.layoutRoot && (t.relativeTarget = m, t.relativeTargetOrigin = d, t.relativeParent = h);
1210
+ }
1211
+ }
1212
+ }
1213
+ t.notifyListeners("didUpdate", {
1214
+ layout: i,
1215
+ snapshot: e,
1216
+ delta: o,
1217
+ layoutDelta: s,
1218
+ hasLayoutChanged: a,
1219
+ hasRelativeLayoutChanged: l
1220
+ });
1221
+ } else if (t.isLead()) {
1222
+ const { onExitComplete: i } = t.options;
1223
+ i && i();
1224
+ }
1225
+ t.options.transition = void 0;
1226
+ }
1227
+ function Ss(t) {
1228
+ t.parent && (t.isProjecting() || (t.isProjectionDirty = t.parent.isProjectionDirty), t.isSharedProjectionDirty || (t.isSharedProjectionDirty = !!(t.isProjectionDirty || t.parent.isProjectionDirty || t.parent.isSharedProjectionDirty)), t.isTransformDirty || (t.isTransformDirty = t.parent.isTransformDirty));
1229
+ }
1230
+ function As(t) {
1231
+ t.isProjectionDirty = t.isSharedProjectionDirty = t.isTransformDirty = !1;
1232
+ }
1233
+ function Rs(t) {
1234
+ t.clearSnapshot();
1235
+ }
1236
+ function jt(t) {
1237
+ t.clearMeasurements();
1238
+ }
1239
+ function Mt(t) {
1240
+ t.isLayoutDirty = !1;
1241
+ }
1242
+ function Ls(t) {
1243
+ const { visualElement: e } = t.options;
1244
+ e && e.getProps().onBeforeLayoutMeasure && e.notify("BeforeLayoutMeasure"), t.resetTransform();
1245
+ }
1246
+ function wt(t) {
1247
+ t.finishAnimation(), t.targetDelta = t.relativeTarget = t.target = void 0, t.isProjectionDirty = !0;
1248
+ }
1249
+ function Vs(t) {
1250
+ t.resolveTargetDelta();
1251
+ }
1252
+ function Cs(t) {
1253
+ t.calcProjection();
1254
+ }
1255
+ function Bs(t) {
1256
+ t.resetSkewAndRotation();
1257
+ }
1258
+ function js(t) {
1259
+ t.removeLeadSnapshot();
1260
+ }
1261
+ function kt(t, e, i) {
1262
+ t.translate = v(e.translate, 0, i), t.scale = v(e.scale, 1, i), t.origin = e.origin, t.originPoint = e.originPoint;
1263
+ }
1264
+ function bt(t, e, i, n) {
1265
+ t.min = v(e.min, i.min, n), t.max = v(e.max, i.max, n);
1266
+ }
1267
+ function Ms(t, e, i, n) {
1268
+ bt(t.x, e.x, i.x, n), bt(t.y, e.y, i.y, n);
1269
+ }
1270
+ function ws(t) {
1271
+ return t.animationValues && t.animationValues.opacityExit !== void 0;
1272
+ }
1273
+ const ks = {
1274
+ duration: 0.45,
1275
+ ease: [0.4, 0, 0.1, 1]
1276
+ }, It = (t) => typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(t), Ot = It("applewebkit/") && !It("chrome/") ? Math.round : M;
1277
+ function Ut(t) {
1278
+ t.min = Ot(t.min), t.max = Ot(t.max);
1279
+ }
1280
+ function bs(t) {
1281
+ Ut(t.x), Ut(t.y);
1282
+ }
1283
+ function le(t, e, i) {
1284
+ return t === "position" || t === "preserve-aspect" && !We(Ct(e), Ct(i), 0.2);
1285
+ }
1286
+ function Is(t) {
1287
+ return t !== t.root && t.scroll?.wasRoot;
1288
+ }
1289
+ const Os = re({
1290
+ attachResizeListener: (t, e) => tt(t, "resize", e),
1291
+ measureScroll: () => ({
1292
+ x: document.documentElement.scrollLeft || document.body.scrollLeft,
1293
+ y: document.documentElement.scrollTop || document.body.scrollTop
1294
+ }),
1295
+ checkIsScrollRoot: () => !0
1296
+ }), Z = {
1297
+ current: void 0
1298
+ }, he = re({
1299
+ measureScroll: (t) => ({
1300
+ x: t.scrollLeft,
1301
+ y: t.scrollTop
1302
+ }),
1303
+ defaultParent: () => {
1304
+ if (!Z.current) {
1305
+ const t = new Os({});
1306
+ t.mount(window), t.setOptions({ layoutScroll: !0 }), Z.current = t;
1307
+ }
1308
+ return Z.current;
1309
+ },
1310
+ resetTransform: (t, e) => {
1311
+ t.style.transform = e !== void 0 ? e : "none";
1312
+ },
1313
+ checkIsScrollRoot: (t) => window.getComputedStyle(t).position === "fixed"
1314
+ }), Us = {
1315
+ pan: {
1316
+ Feature: ss
1317
+ },
1318
+ drag: {
1319
+ Feature: es,
1320
+ ProjectionNode: he,
1321
+ MeasureLayout: ee
1322
+ }
1323
+ }, Fs = {
1324
+ layout: {
1325
+ ProjectionNode: he,
1326
+ MeasureLayout: ee
1327
+ }
1328
+ }, $s = {
1329
+ ...Me,
1330
+ ...Us,
1331
+ ...Fs
1332
+ };
1333
+ export {
1334
+ Ys as AnimatePresence,
1335
+ _s as AsyncMotionValueAnimation,
1336
+ qs as DOMKeyframesResolver,
1337
+ Ks as DeprecatedLayoutGroupContext,
1338
+ Zs as JSAnimation,
1339
+ Js as KeyframeResolver,
1340
+ Qs as LayoutGroup,
1341
+ Te as LayoutGroupContext,
1342
+ ti as LazyMotion,
1343
+ ei as MotionConfig,
1344
+ si as MotionConfigContext,
1345
+ ii as MotionContext,
1346
+ ni as MotionGlobalConfig,
1347
+ oi as MotionValue,
1348
+ ai as NativeAnimation,
1349
+ ri as NativeAnimationExtended,
1350
+ li as PresenceContext,
1351
+ Re as SubscriptionManager,
1352
+ De as SwitchLayoutGroupContext,
1353
+ hi as VisualElement,
1354
+ ui as WillChangeMotionValue,
1355
+ ci as acceleratedValues,
1356
+ k as addPointerEvent,
1357
+ ce as addPointerInfo,
1358
+ Ee as addScaleCorrector,
1359
+ Xt as addUniqueItem,
1360
+ fi as alpha,
1361
+ di as analyseComplexValue,
1362
+ mi as animateVisualElement,
1363
+ pi as animations,
1364
+ gi as anticipate,
1365
+ yi as applyGeneratorOptions,
1366
+ vi as backIn,
1367
+ xi as backInOut,
1368
+ Pi as backOut,
1369
+ Ti as buildTransform,
1370
+ Di as calcGeneratorDuration,
1371
+ D as calcLength,
1372
+ O as cancelFrame,
1373
+ Ei as circIn,
1374
+ Si as circInOut,
1375
+ Ae as circOut,
1376
+ Nt as clamp,
1377
+ Ai as color,
1378
+ st as complex,
1379
+ Ri as convertOffsetToTimes,
1380
+ y as createBox,
1381
+ Li as createGeneratorEasing,
1382
+ Vi as createRenderBatcher,
1383
+ Ci as cubicBezier,
1384
+ Bi as cubicBezierAsString,
1385
+ ji as defaultEasing,
1386
+ Mi as defaultOffset,
1387
+ wi as defaultTransformValue,
1388
+ ki as defaultValueTypes,
1389
+ bi as degrees,
1390
+ hs as delay,
1391
+ Ii as dimensionValueTypes,
1392
+ ut as distance,
1393
+ ze as distance2D,
1394
+ Me as domAnimation,
1395
+ $s as domMax,
1396
+ Oi as easeIn,
1397
+ Ui as easeInOut,
1398
+ Fi as easeOut,
1399
+ Ni as easingDefinitionToFunction,
1400
+ Wi as fillOffset,
1401
+ Gi as fillWildcards,
1402
+ zi as filterProps,
1403
+ $i as findDimensionValueType,
1404
+ Hi as findValueType,
1405
+ Xi as flushKeyframeResolvers,
1406
+ S as frame,
1407
+ E as frameData,
1408
+ $ as frameSteps,
1409
+ Yi as generateLinearEasing,
1410
+ _i as getAnimatableNone,
1411
+ qi as getDefaultValueType,
1412
+ Ki as getMixer,
1413
+ Zi as getValueAsType,
1414
+ Le as getValueTransition,
1415
+ Ji as getVariableValue,
1416
+ Qi as hex,
1417
+ tn as hover,
1418
+ en as hsla,
1419
+ sn as hslaToRgba,
1420
+ nn as inertia,
1421
+ on as interpolate,
1422
+ xe as invariant,
1423
+ an as invisibleValues,
1424
+ rn as isBezierDefinition,
1425
+ ln as isBrowser,
1426
+ hn as isCSSVariableName,
1427
+ un as isCSSVariableToken,
1428
+ cn as isDragActive,
1429
+ L as isDragging,
1430
+ fn as isEasingArray,
1431
+ dn as isGenerator,
1432
+ mn as isHTMLElement,
1433
+ Se as isMotionValue,
1434
+ pn as isNodeOrChild,
1435
+ gn as isNumericalString,
1436
+ ue as isObject,
1437
+ fe as isPrimaryPointer,
1438
+ qt as isSVGElement,
1439
+ Ie as isSVGSVGElement,
1440
+ yn as isValidMotionProp,
1441
+ vn as isZeroValueString,
1442
+ xn as keyframes,
1443
+ Pn as m,
1444
+ Tn as makeAnimationInstant,
1445
+ Dn as makeUseVisualState,
1446
+ En as mapEasingToNativeEasing,
1447
+ Sn as maxGeneratorDuration,
1448
+ An as memo,
1449
+ $t as microtask,
1450
+ pe as millisecondsToSeconds,
1451
+ Rn as mirrorEasing,
1452
+ Ln as mix,
1453
+ Vn as mixArray,
1454
+ Cn as mixColor,
1455
+ Bn as mixComplex,
1456
+ jn as mixImmediate,
1457
+ Mn as mixLinearColor,
1458
+ v as mixNumber,
1459
+ wn as mixObject,
1460
+ kn as mixVisibility,
1461
+ Ht as motionValue,
1462
+ M as noop,
1463
+ bn as number,
1464
+ In as numberValueTypes,
1465
+ On as optimizedAppearDataAttribute,
1466
+ Un as parseCSSVariable,
1467
+ Fn as parseValueFromTransform,
1468
+ z as percent,
1469
+ de as pipe,
1470
+ Nn as positionalKeys,
1471
+ Wn as press,
1472
+ J as progress,
1473
+ Gn as progressPercentage,
1474
+ zt as px,
1475
+ zn as readTransformValue,
1476
+ Yt as removeItem,
1477
+ $n as resolveElements,
1478
+ H as resolveMotionValue,
1479
+ Hn as reverseEasing,
1480
+ Xn as rgbUnit,
1481
+ Yn as rgba,
1482
+ _n as scale,
1483
+ me as secondsToMilliseconds,
1484
+ be as setDragLock,
1485
+ qn as setStyle,
1486
+ Kn as spring,
1487
+ Zn as startWaapiAnimation,
1488
+ Jn as supportedWaapiEasing,
1489
+ Qn as supportsBrowserAnimation,
1490
+ to as supportsFlags,
1491
+ eo as supportsLinearEasing,
1492
+ so as supportsScrollTimeline,
1493
+ io as testValueType,
1494
+ _t as time,
1495
+ no as transformPropOrder,
1496
+ oo as transformProps,
1497
+ ao as transformValueTypes,
1498
+ ro as useComposedRefs,
1499
+ lo as useForceUpdate,
1500
+ ho as useIsomorphicLayoutEffect,
1501
+ Pe as usePresence,
1502
+ uo as useWillChange,
1503
+ co as velocityPerSecond,
1504
+ fo as vh,
1505
+ mo as visualElementStore,
1506
+ po as vw,
1507
+ go as warnOnce,
1508
+ yo as warning
1509
+ };