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