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