@mobielnl/elements 0.12.24 → 0.12.25
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/dist/elements.css +1 -1
- package/dist/elements.js +5 -5
- package/dist/elements.umd.cjs +138 -136
- package/dist/{index-D3B78uDJ.js → index-BkgkTFrf.js} +27196 -26687
- package/dist/index-CSAejUDF.js +1678 -0
- package/dist/index.d.ts +61 -16
- package/package.json +3 -3
- package/dist/index-V6otpA26.js +0 -1763
|
@@ -0,0 +1,1678 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { n as ne, i as Ot, a as z, m as ie, r as $e, h as je, b as Ft, w as se, c as Te, d as Ce, e as qe, f as de, g as De, t as L, j as Rt, k as H, l as E, o as $, p as Kt, s as R, v as Lt, M as j, W as ze, q as xe, N as Et, u as Bt, x as Gt, y as Nt, z as Ht, K as Xe, A as _t, B as Ae, C as Wt, D as Ut, E as $t, F as jt, G as Ye, H as qt, I as zt, J as Xt, L as Pe, O as ke, P as Y, Q as Ie, R as Yt, V as Zt, S as Jt, T as Qt, U as en, X as tn, Y as nn, Z as Ze, _ as sn, $ as rn, a0 as on, a1 as an, a2 as cn, a3 as Je, a4 as Qe, a5 as et, a6 as tt, a7 as ln } from "./index-BkgkTFrf.js";
|
|
3
|
+
import { Fragment as un } from "react";
|
|
4
|
+
var It = typeof globalThis < "u" && globalThis.process ? globalThis.process : { env: { NODE_ENV: "production" } };
|
|
5
|
+
const re = (...t) => t.reduce((e, n) => (i) => n(e(i))), nt = /* @__NO_SIDE_EFFECTS__ */ (t, e, n) => {
|
|
6
|
+
const i = e - t;
|
|
7
|
+
return i ? (n - t) / i : 1;
|
|
8
|
+
}, it = (t, e, n) => (((1 - 3 * n + 3 * e) * t + (3 * n - 6 * e)) * t + 3 * e) * t, fn = 1e-7, dn = 12;
|
|
9
|
+
function hn(t, e, n, i, s) {
|
|
10
|
+
let r, a, o = 0;
|
|
11
|
+
do
|
|
12
|
+
a = e + (n - e) / 2, r = it(a, i, s) - t, r > 0 ? n = a : e = a;
|
|
13
|
+
while (Math.abs(r) > fn && ++o < dn);
|
|
14
|
+
return a;
|
|
15
|
+
}
|
|
16
|
+
// @__NO_SIDE_EFFECTS__
|
|
17
|
+
function X(t, e, n, i) {
|
|
18
|
+
if (t === e && n === i)
|
|
19
|
+
return ne;
|
|
20
|
+
const s = (r) => hn(r, 0, 1, t, n);
|
|
21
|
+
return (r) => r === 0 || r === 1 ? r : it(s(r), e, i);
|
|
22
|
+
}
|
|
23
|
+
const st = /* @__NO_SIDE_EFFECTS__ */ (t) => (e) => e <= 0.5 ? t(2 * e) / 2 : (2 - t(2 * (1 - e))) / 2, rt = /* @__NO_SIDE_EFFECTS__ */ (t) => (e) => 1 - t(1 - e), ot = /* @__PURE__ */ X(0.33, 1.53, 0.69, 0.99), we = /* @__PURE__ */ rt(ot), at = /* @__PURE__ */ st(we), ct = (t) => t >= 1 ? 1 : (t *= 2) < 1 ? 0.5 * we(t) : 0.5 * (2 - Math.pow(2, -10 * (t - 1))), Se = (t) => 1 - Math.sin(Math.acos(t)), mn = /* @__PURE__ */ rt(Se), lt = /* @__PURE__ */ st(Se), pn = /* @__PURE__ */ X(0.42, 0, 1, 1), gn = /* @__PURE__ */ X(0, 0, 0.58, 1), ut = /* @__PURE__ */ X(0.42, 0, 0.58, 1), yn = /* @__NO_SIDE_EFFECTS__ */ (t) => Array.isArray(t) && typeof t[0] != "number", Oe = {
|
|
24
|
+
linear: ne,
|
|
25
|
+
easeIn: pn,
|
|
26
|
+
easeInOut: ut,
|
|
27
|
+
easeOut: gn,
|
|
28
|
+
circIn: Se,
|
|
29
|
+
circInOut: lt,
|
|
30
|
+
circOut: mn,
|
|
31
|
+
backIn: we,
|
|
32
|
+
backInOut: at,
|
|
33
|
+
backOut: ot,
|
|
34
|
+
anticipate: ct
|
|
35
|
+
}, vn = (t) => typeof t == "string", Fe = (t) => {
|
|
36
|
+
if (Ot(t)) {
|
|
37
|
+
z(t.length === 4, "Cubic bezier arrays must contain four numerical values.", "cubic-bezier-length");
|
|
38
|
+
const [e, n, i, s] = t;
|
|
39
|
+
return /* @__PURE__ */ X(e, n, i, s);
|
|
40
|
+
} else if (vn(t))
|
|
41
|
+
return z(Oe[t] !== void 0, `Invalid easing type '${t}'`, "invalid-easing-type"), Oe[t];
|
|
42
|
+
return t;
|
|
43
|
+
};
|
|
44
|
+
function oe(t, e, n) {
|
|
45
|
+
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;
|
|
46
|
+
}
|
|
47
|
+
function bn({ hue: t, saturation: e, lightness: n, alpha: i }) {
|
|
48
|
+
t /= 360, e /= 100, n /= 100;
|
|
49
|
+
let s = 0, r = 0, a = 0;
|
|
50
|
+
if (!e)
|
|
51
|
+
s = r = a = n;
|
|
52
|
+
else {
|
|
53
|
+
const o = n < 0.5 ? n * (1 + e) : n + e - n * e, u = 2 * n - o;
|
|
54
|
+
s = oe(u, o, t + 1 / 3), r = oe(u, o, t), a = oe(u, o, t - 1 / 3);
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
red: Math.round(s * 255),
|
|
58
|
+
green: Math.round(r * 255),
|
|
59
|
+
blue: Math.round(a * 255),
|
|
60
|
+
alpha: i
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function J(t, e) {
|
|
64
|
+
return (n) => n > 0 ? e : t;
|
|
65
|
+
}
|
|
66
|
+
const ae = (t, e, n) => {
|
|
67
|
+
const i = t * t, s = n * (e * e - i) + i;
|
|
68
|
+
return s < 0 ? 0 : Math.sqrt(s);
|
|
69
|
+
}, Tn = [Ft, $e, je], xn = (t) => Tn.find((e) => e.test(t));
|
|
70
|
+
function Re(t) {
|
|
71
|
+
const e = xn(t);
|
|
72
|
+
if (se(!!e, `'${t}' is not an animatable color. Use the equivalent color code instead.`, "color-not-animatable"), !e)
|
|
73
|
+
return !1;
|
|
74
|
+
let n = e.parse(t);
|
|
75
|
+
return e === je && (n = bn(n)), n;
|
|
76
|
+
}
|
|
77
|
+
const Ke = (t, e) => {
|
|
78
|
+
const n = Re(t), i = Re(e);
|
|
79
|
+
if (!n || !i)
|
|
80
|
+
return J(t, e);
|
|
81
|
+
const s = { ...n };
|
|
82
|
+
return (r) => (s.red = ae(n.red, i.red, r), s.green = ae(n.green, i.green, r), s.blue = ae(n.blue, i.blue, r), s.alpha = ie(n.alpha, i.alpha, r), $e.transform(s));
|
|
83
|
+
}, he = /* @__PURE__ */ new Set(["none", "hidden"]);
|
|
84
|
+
function An(t, e) {
|
|
85
|
+
return he.has(t) ? (n) => n <= 0 ? t : e : (n) => n >= 1 ? e : t;
|
|
86
|
+
}
|
|
87
|
+
function wn(t, e) {
|
|
88
|
+
return (n) => ie(t, e, n);
|
|
89
|
+
}
|
|
90
|
+
function Ve(t) {
|
|
91
|
+
return typeof t == "number" ? wn : typeof t == "string" ? Te(t) ? J : Ce.test(t) ? Ke : Mn : Array.isArray(t) ? ft : typeof t == "object" ? Ce.test(t) ? Ke : Sn : J;
|
|
92
|
+
}
|
|
93
|
+
function ft(t, e) {
|
|
94
|
+
const n = [...t], i = n.length, s = t.map((r, a) => Ve(r)(r, e[a]));
|
|
95
|
+
return (r) => {
|
|
96
|
+
for (let a = 0; a < i; a++)
|
|
97
|
+
n[a] = s[a](r);
|
|
98
|
+
return n;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function Sn(t, e) {
|
|
102
|
+
const n = { ...t, ...e }, i = {};
|
|
103
|
+
for (const s in n)
|
|
104
|
+
t[s] !== void 0 && e[s] !== void 0 && (i[s] = Ve(t[s])(t[s], e[s]));
|
|
105
|
+
return (s) => {
|
|
106
|
+
for (const r in i)
|
|
107
|
+
n[r] = i[r](s);
|
|
108
|
+
return n;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function Vn(t, e) {
|
|
112
|
+
const n = [], i = { color: 0, var: 0, number: 0 };
|
|
113
|
+
for (let s = 0; s < e.values.length; s++) {
|
|
114
|
+
const r = e.types[s], a = t.indexes[r][i[r]], o = t.values[a] ?? 0;
|
|
115
|
+
n[s] = o, i[r]++;
|
|
116
|
+
}
|
|
117
|
+
return n;
|
|
118
|
+
}
|
|
119
|
+
const Mn = (t, e) => {
|
|
120
|
+
const n = qe.createTransformer(e), i = de(t), s = de(e);
|
|
121
|
+
return i.indexes.var.length === s.indexes.var.length && i.indexes.color.length === s.indexes.color.length && i.indexes.number.length >= s.indexes.number.length ? he.has(t) && !s.values.length || he.has(e) && !i.values.length ? An(t, e) : re(ft(Vn(i, s), s.values), n) : (se(!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"), J(t, e));
|
|
122
|
+
};
|
|
123
|
+
function dt(t, e, n) {
|
|
124
|
+
return typeof t == "number" && typeof e == "number" && typeof n == "number" ? ie(t, e, n) : Ve(t)(t, e);
|
|
125
|
+
}
|
|
126
|
+
const Cn = (t) => {
|
|
127
|
+
const e = ({ timestamp: n }) => t(n);
|
|
128
|
+
return {
|
|
129
|
+
start: (n = !0) => H.update(e, n),
|
|
130
|
+
stop: () => Rt(e),
|
|
131
|
+
/**
|
|
132
|
+
* If we're processing this frame we can use the
|
|
133
|
+
* framelocked timestamp to keep things in sync.
|
|
134
|
+
*/
|
|
135
|
+
now: () => De.isProcessing ? De.timestamp : L.now()
|
|
136
|
+
};
|
|
137
|
+
}, Q = 2e4;
|
|
138
|
+
function Me(t) {
|
|
139
|
+
let e = 0;
|
|
140
|
+
const n = 50;
|
|
141
|
+
let i = t.next(e);
|
|
142
|
+
for (; !i.done && e < Q; )
|
|
143
|
+
e += n, i = t.next(e);
|
|
144
|
+
return e >= Q ? 1 / 0 : e;
|
|
145
|
+
}
|
|
146
|
+
function Dn(t, e = 100, n) {
|
|
147
|
+
const i = n({ ...t, keyframes: [0, e] }), s = Math.min(Me(i), Q);
|
|
148
|
+
return {
|
|
149
|
+
type: "keyframes",
|
|
150
|
+
ease: (r) => i.next(s * r).value / e,
|
|
151
|
+
duration: E(s)
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
const S = {
|
|
155
|
+
// Default spring physics
|
|
156
|
+
stiffness: 100,
|
|
157
|
+
damping: 10,
|
|
158
|
+
mass: 1,
|
|
159
|
+
velocity: 0,
|
|
160
|
+
// Default duration/bounce-based options
|
|
161
|
+
duration: 800,
|
|
162
|
+
// in ms
|
|
163
|
+
bounce: 0.3,
|
|
164
|
+
visualDuration: 0.3,
|
|
165
|
+
// in seconds
|
|
166
|
+
// Rest thresholds
|
|
167
|
+
restSpeed: {
|
|
168
|
+
granular: 0.01,
|
|
169
|
+
default: 2
|
|
170
|
+
},
|
|
171
|
+
restDelta: {
|
|
172
|
+
granular: 5e-3,
|
|
173
|
+
default: 0.5
|
|
174
|
+
},
|
|
175
|
+
// Limits
|
|
176
|
+
minDuration: 0.01,
|
|
177
|
+
// in seconds
|
|
178
|
+
maxDuration: 10,
|
|
179
|
+
// in seconds
|
|
180
|
+
minDamping: 0.05,
|
|
181
|
+
maxDamping: 1
|
|
182
|
+
};
|
|
183
|
+
function me(t, e) {
|
|
184
|
+
return t * Math.sqrt(1 - e * e);
|
|
185
|
+
}
|
|
186
|
+
const Pn = 12;
|
|
187
|
+
function kn(t, e, n) {
|
|
188
|
+
let i = n;
|
|
189
|
+
for (let s = 1; s < Pn; s++)
|
|
190
|
+
i = i - t(i) / e(i);
|
|
191
|
+
return i;
|
|
192
|
+
}
|
|
193
|
+
const ce = 1e-3;
|
|
194
|
+
function In({ duration: t = S.duration, bounce: e = S.bounce, velocity: n = S.velocity, mass: i = S.mass }) {
|
|
195
|
+
let s, r;
|
|
196
|
+
se(t <= R(S.maxDuration), "Spring duration must be 10 seconds or less", "spring-duration-limit");
|
|
197
|
+
let a = 1 - e;
|
|
198
|
+
a = $(S.minDamping, S.maxDamping, a), t = $(S.minDuration, S.maxDuration, E(t)), a < 1 ? (s = (l) => {
|
|
199
|
+
const c = l * a, f = c * t, d = c - n, v = me(l, a), h = Math.exp(-f);
|
|
200
|
+
return ce - d / v * h;
|
|
201
|
+
}, r = (l) => {
|
|
202
|
+
const f = l * a * t, d = f * n + n, v = Math.pow(a, 2) * Math.pow(l, 2) * t, h = Math.exp(-f), p = me(Math.pow(l, 2), a);
|
|
203
|
+
return (-s(l) + ce > 0 ? -1 : 1) * ((d - v) * h) / p;
|
|
204
|
+
}) : (s = (l) => {
|
|
205
|
+
const c = Math.exp(-l * t), f = (l - n) * t + 1;
|
|
206
|
+
return -ce + c * f;
|
|
207
|
+
}, r = (l) => {
|
|
208
|
+
const c = Math.exp(-l * t), f = (n - l) * (t * t);
|
|
209
|
+
return c * f;
|
|
210
|
+
});
|
|
211
|
+
const o = 5 / t, u = kn(s, r, o);
|
|
212
|
+
if (t = R(t), isNaN(u))
|
|
213
|
+
return {
|
|
214
|
+
stiffness: S.stiffness,
|
|
215
|
+
damping: S.damping,
|
|
216
|
+
duration: t
|
|
217
|
+
};
|
|
218
|
+
{
|
|
219
|
+
const l = Math.pow(u, 2) * i;
|
|
220
|
+
return {
|
|
221
|
+
stiffness: l,
|
|
222
|
+
damping: a * 2 * Math.sqrt(i * l),
|
|
223
|
+
duration: t
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
const On = ["duration", "bounce"], Fn = ["stiffness", "damping", "mass"];
|
|
228
|
+
function Le(t, e) {
|
|
229
|
+
return e.some((n) => t[n] !== void 0);
|
|
230
|
+
}
|
|
231
|
+
function Rn(t) {
|
|
232
|
+
let e = {
|
|
233
|
+
velocity: S.velocity,
|
|
234
|
+
stiffness: S.stiffness,
|
|
235
|
+
damping: S.damping,
|
|
236
|
+
mass: S.mass,
|
|
237
|
+
isResolvedFromDuration: !1,
|
|
238
|
+
...t
|
|
239
|
+
};
|
|
240
|
+
if (!Le(t, Fn) && Le(t, On))
|
|
241
|
+
if (e.velocity = 0, t.visualDuration) {
|
|
242
|
+
const n = t.visualDuration, i = 2 * Math.PI / (n * 1.2), s = i * i, r = 2 * $(0.05, 1, 1 - (t.bounce || 0)) * Math.sqrt(s);
|
|
243
|
+
e = {
|
|
244
|
+
...e,
|
|
245
|
+
mass: S.mass,
|
|
246
|
+
stiffness: s,
|
|
247
|
+
damping: r
|
|
248
|
+
};
|
|
249
|
+
} else {
|
|
250
|
+
const n = In({ ...t, velocity: 0 });
|
|
251
|
+
e = {
|
|
252
|
+
...e,
|
|
253
|
+
...n,
|
|
254
|
+
mass: S.mass
|
|
255
|
+
}, e.isResolvedFromDuration = !0;
|
|
256
|
+
}
|
|
257
|
+
return e;
|
|
258
|
+
}
|
|
259
|
+
function ee(t = S.visualDuration, e = S.bounce) {
|
|
260
|
+
const n = typeof t != "object" ? {
|
|
261
|
+
visualDuration: t,
|
|
262
|
+
keyframes: [0, 1],
|
|
263
|
+
bounce: e
|
|
264
|
+
} : t;
|
|
265
|
+
let { restSpeed: i, restDelta: s } = n;
|
|
266
|
+
const r = n.keyframes[0], a = n.keyframes[n.keyframes.length - 1], o = { done: !1, value: r }, { stiffness: u, damping: l, mass: c, duration: f, velocity: d, isResolvedFromDuration: v } = Rn({
|
|
267
|
+
...n,
|
|
268
|
+
velocity: -E(n.velocity || 0)
|
|
269
|
+
}), h = d || 0, p = l / (2 * Math.sqrt(u * c)), m = a - r, g = E(Math.sqrt(u / c)), T = Math.abs(m) < 5;
|
|
270
|
+
i || (i = T ? S.restSpeed.granular : S.restSpeed.default), s || (s = T ? S.restDelta.granular : S.restDelta.default);
|
|
271
|
+
let A, w, x, V, C, b;
|
|
272
|
+
if (p < 1)
|
|
273
|
+
x = me(g, p), V = (h + p * g * m) / x, A = (y) => {
|
|
274
|
+
const M = Math.exp(-p * g * y);
|
|
275
|
+
return a - M * (V * Math.sin(x * y) + m * Math.cos(x * y));
|
|
276
|
+
}, C = p * g * V + m * x, b = p * g * m - V * x, w = (y) => Math.exp(-p * g * y) * (C * Math.sin(x * y) + b * Math.cos(x * y));
|
|
277
|
+
else if (p === 1) {
|
|
278
|
+
A = (M) => a - Math.exp(-g * M) * (m + (h + g * m) * M);
|
|
279
|
+
const y = h + g * m;
|
|
280
|
+
w = (M) => Math.exp(-g * M) * (g * y * M - h);
|
|
281
|
+
} else {
|
|
282
|
+
const y = g * Math.sqrt(p * p - 1);
|
|
283
|
+
A = (O) => {
|
|
284
|
+
const K = Math.exp(-p * g * O), F = Math.min(y * O, 300);
|
|
285
|
+
return a - K * ((h + p * g * m) * Math.sinh(F) + y * m * Math.cosh(F)) / y;
|
|
286
|
+
};
|
|
287
|
+
const M = (h + p * g * m) / y, k = p * g * M - m * y, B = p * g * m - M * y;
|
|
288
|
+
w = (O) => {
|
|
289
|
+
const K = Math.exp(-p * g * O), F = Math.min(y * O, 300);
|
|
290
|
+
return K * (k * Math.sinh(F) + B * Math.cosh(F));
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
const D = {
|
|
294
|
+
calculatedDuration: v && f || null,
|
|
295
|
+
velocity: (y) => R(w(y)),
|
|
296
|
+
next: (y) => {
|
|
297
|
+
if (!v && p < 1) {
|
|
298
|
+
const k = Math.exp(-p * g * y), B = Math.sin(x * y), O = Math.cos(x * y), K = a - k * (V * B + m * O), F = R(k * (C * B + b * O));
|
|
299
|
+
return o.done = Math.abs(F) <= i && Math.abs(a - K) <= s, o.value = o.done ? a : K, o;
|
|
300
|
+
}
|
|
301
|
+
const M = A(y);
|
|
302
|
+
if (v)
|
|
303
|
+
o.done = y >= f;
|
|
304
|
+
else {
|
|
305
|
+
const k = R(w(y));
|
|
306
|
+
o.done = Math.abs(k) <= i && Math.abs(a - M) <= s;
|
|
307
|
+
}
|
|
308
|
+
return o.value = o.done ? a : M, o;
|
|
309
|
+
},
|
|
310
|
+
toString: () => {
|
|
311
|
+
const y = Math.min(Me(D), Q), M = Kt((k) => D.next(y * k).value, y, 30);
|
|
312
|
+
return y + "ms " + M;
|
|
313
|
+
},
|
|
314
|
+
toTransition: () => {
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
return D;
|
|
318
|
+
}
|
|
319
|
+
ee.applyToOptions = (t) => {
|
|
320
|
+
const e = Dn(t, 100, ee);
|
|
321
|
+
return t.ease = e.ease, t.duration = R(e.duration), t.type = "keyframes", t;
|
|
322
|
+
};
|
|
323
|
+
const Kn = 5;
|
|
324
|
+
function ht(t, e, n) {
|
|
325
|
+
const i = Math.max(e - Kn, 0);
|
|
326
|
+
return Lt(n - t(i), e - i);
|
|
327
|
+
}
|
|
328
|
+
function pe({ keyframes: t, velocity: e = 0, power: n = 0.8, timeConstant: i = 325, bounceDamping: s = 10, bounceStiffness: r = 500, modifyTarget: a, min: o, max: u, restDelta: l = 0.5, restSpeed: c }) {
|
|
329
|
+
const f = t[0], d = {
|
|
330
|
+
done: !1,
|
|
331
|
+
value: f
|
|
332
|
+
}, v = (b) => o !== void 0 && b < o || u !== void 0 && b > u, h = (b) => o === void 0 ? u : u === void 0 || Math.abs(o - b) < Math.abs(u - b) ? o : u;
|
|
333
|
+
let p = n * e;
|
|
334
|
+
const m = f + p, g = a === void 0 ? m : a(m);
|
|
335
|
+
g !== m && (p = g - f);
|
|
336
|
+
const T = (b) => -p * Math.exp(-b / i), A = (b) => g + T(b), w = (b) => {
|
|
337
|
+
const D = T(b), y = A(b);
|
|
338
|
+
d.done = Math.abs(D) <= l, d.value = d.done ? g : y;
|
|
339
|
+
};
|
|
340
|
+
let x, V;
|
|
341
|
+
const C = (b) => {
|
|
342
|
+
v(d.value) && (x = b, V = ee({
|
|
343
|
+
keyframes: [d.value, h(d.value)],
|
|
344
|
+
velocity: ht(A, b, d.value),
|
|
345
|
+
// TODO: This should be passing * 1000
|
|
346
|
+
damping: s,
|
|
347
|
+
stiffness: r,
|
|
348
|
+
restDelta: l,
|
|
349
|
+
restSpeed: c
|
|
350
|
+
}));
|
|
351
|
+
};
|
|
352
|
+
return C(0), {
|
|
353
|
+
calculatedDuration: null,
|
|
354
|
+
next: (b) => {
|
|
355
|
+
let D = !1;
|
|
356
|
+
return !V && x === void 0 && (D = !0, w(b), C(b)), x !== void 0 && b >= x ? V.next(b - x) : (!D && w(b), d);
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
function Ln(t, e, n) {
|
|
361
|
+
const i = [], s = n || j.mix || dt, r = t.length - 1;
|
|
362
|
+
for (let a = 0; a < r; a++) {
|
|
363
|
+
let o = s(t[a], t[a + 1]);
|
|
364
|
+
if (e) {
|
|
365
|
+
const u = Array.isArray(e) ? e[a] || ne : e;
|
|
366
|
+
o = re(u, o);
|
|
367
|
+
}
|
|
368
|
+
i.push(o);
|
|
369
|
+
}
|
|
370
|
+
return i;
|
|
371
|
+
}
|
|
372
|
+
function En(t, e, { clamp: n = !0, ease: i, mixer: s } = {}) {
|
|
373
|
+
const r = t.length;
|
|
374
|
+
if (z(r === e.length, "Both input and output ranges must be the same length", "range-length"), r === 1)
|
|
375
|
+
return () => e[0];
|
|
376
|
+
if (r === 2 && e[0] === e[1])
|
|
377
|
+
return () => e[1];
|
|
378
|
+
const a = t[0] === t[1];
|
|
379
|
+
t[0] > t[r - 1] && (t = [...t].reverse(), e = [...e].reverse());
|
|
380
|
+
const o = Ln(e, i, s), u = o.length, l = (c) => {
|
|
381
|
+
if (a && c < t[0])
|
|
382
|
+
return e[0];
|
|
383
|
+
let f = 0;
|
|
384
|
+
if (u > 1)
|
|
385
|
+
for (; f < t.length - 2 && !(c < t[f + 1]); f++)
|
|
386
|
+
;
|
|
387
|
+
const d = /* @__PURE__ */ nt(t[f], t[f + 1], c);
|
|
388
|
+
return o[f](d);
|
|
389
|
+
};
|
|
390
|
+
return n ? (c) => l($(t[0], t[r - 1], c)) : l;
|
|
391
|
+
}
|
|
392
|
+
function Bn(t, e) {
|
|
393
|
+
const n = t[t.length - 1];
|
|
394
|
+
for (let i = 1; i <= e; i++) {
|
|
395
|
+
const s = /* @__PURE__ */ nt(0, e, i);
|
|
396
|
+
t.push(ie(n, 1, s));
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
function Gn(t) {
|
|
400
|
+
const e = [0];
|
|
401
|
+
return Bn(e, t.length - 1), e;
|
|
402
|
+
}
|
|
403
|
+
function Nn(t, e) {
|
|
404
|
+
return t.map((n) => n * e);
|
|
405
|
+
}
|
|
406
|
+
function Hn(t, e) {
|
|
407
|
+
return t.map(() => e || ut).splice(0, t.length - 1);
|
|
408
|
+
}
|
|
409
|
+
function W({ duration: t = 300, keyframes: e, times: n, ease: i = "easeInOut" }) {
|
|
410
|
+
const s = /* @__PURE__ */ yn(i) ? i.map(Fe) : Fe(i), r = {
|
|
411
|
+
done: !1,
|
|
412
|
+
value: e[0]
|
|
413
|
+
}, a = Nn(
|
|
414
|
+
// Only use the provided offsets if they're the correct length
|
|
415
|
+
// TODO Maybe we should warn here if there's a length mismatch
|
|
416
|
+
n && n.length === e.length ? n : Gn(e),
|
|
417
|
+
t
|
|
418
|
+
), o = En(a, e, {
|
|
419
|
+
ease: Array.isArray(s) ? s : Hn(e, s)
|
|
420
|
+
});
|
|
421
|
+
return {
|
|
422
|
+
calculatedDuration: t,
|
|
423
|
+
next: (u) => (r.value = o(u), r.done = u >= t, r)
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
const _n = {
|
|
427
|
+
decay: pe,
|
|
428
|
+
inertia: pe,
|
|
429
|
+
tween: W,
|
|
430
|
+
keyframes: W,
|
|
431
|
+
spring: ee
|
|
432
|
+
};
|
|
433
|
+
function mt(t) {
|
|
434
|
+
typeof t.type == "string" && (t.type = _n[t.type]);
|
|
435
|
+
}
|
|
436
|
+
const Wn = (t) => t / 100;
|
|
437
|
+
class te extends ze {
|
|
438
|
+
constructor(e) {
|
|
439
|
+
super(), this.state = "idle", this.startTime = null, this.isStopped = !1, this.currentTime = 0, this.holdTime = null, this.playbackSpeed = 1, this.delayState = {
|
|
440
|
+
done: !1,
|
|
441
|
+
value: void 0
|
|
442
|
+
}, this.stop = () => {
|
|
443
|
+
const { motionValue: n } = this.options;
|
|
444
|
+
n && n.updatedAt !== L.now() && this.tick(L.now()), this.isStopped = !0, this.state !== "idle" && (this.teardown(), this.options.onStop?.());
|
|
445
|
+
}, this.options = e, this.initAnimation(), this.play(), e.autoplay === !1 && this.pause();
|
|
446
|
+
}
|
|
447
|
+
initAnimation() {
|
|
448
|
+
const { options: e } = this;
|
|
449
|
+
mt(e);
|
|
450
|
+
const { type: n = W, repeat: i = 0, repeatDelay: s = 0, repeatType: r, velocity: a = 0 } = e;
|
|
451
|
+
let { keyframes: o } = e;
|
|
452
|
+
const u = n || W;
|
|
453
|
+
It.env.NODE_ENV !== "production" && u !== W && z(o.length <= 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${o}`, "spring-two-frames"), u !== W && typeof o[0] != "number" && (this.mixKeyframes = re(Wn, dt(o[0], o[1])), o = [0, 100]);
|
|
454
|
+
const l = u({ ...e, keyframes: o });
|
|
455
|
+
r === "mirror" && (this.mirroredGenerator = u({
|
|
456
|
+
...e,
|
|
457
|
+
keyframes: [...o].reverse(),
|
|
458
|
+
velocity: -a
|
|
459
|
+
})), l.calculatedDuration === null && (l.calculatedDuration = Me(l));
|
|
460
|
+
const { calculatedDuration: c } = l;
|
|
461
|
+
this.calculatedDuration = c, this.resolvedDuration = c + s, this.totalDuration = this.resolvedDuration * (i + 1) - s, this.generator = l;
|
|
462
|
+
}
|
|
463
|
+
updateTime(e) {
|
|
464
|
+
const n = Math.round(e - this.startTime) * this.playbackSpeed;
|
|
465
|
+
this.holdTime !== null ? this.currentTime = this.holdTime : this.currentTime = n;
|
|
466
|
+
}
|
|
467
|
+
tick(e, n = !1) {
|
|
468
|
+
const { generator: i, totalDuration: s, mixKeyframes: r, mirroredGenerator: a, resolvedDuration: o, calculatedDuration: u } = this;
|
|
469
|
+
if (this.startTime === null)
|
|
470
|
+
return i.next(0);
|
|
471
|
+
const { delay: l = 0, keyframes: c, repeat: f, repeatType: d, repeatDelay: v, type: h, onUpdate: p, finalKeyframe: m } = this.options;
|
|
472
|
+
this.speed > 0 ? this.startTime = Math.min(this.startTime, e) : this.speed < 0 && (this.startTime = Math.min(e - s / this.speed, this.startTime)), n ? this.currentTime = e : this.updateTime(e);
|
|
473
|
+
const g = this.currentTime - l * (this.playbackSpeed >= 0 ? 1 : -1), T = this.playbackSpeed >= 0 ? g < 0 : g > s;
|
|
474
|
+
this.currentTime = Math.max(g, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = s);
|
|
475
|
+
let A = this.currentTime, w = i;
|
|
476
|
+
if (f) {
|
|
477
|
+
const b = Math.min(this.currentTime, s) / o;
|
|
478
|
+
let D = Math.floor(b), y = b % 1;
|
|
479
|
+
!y && b >= 1 && (y = 1), y === 1 && D--, D = Math.min(D, f + 1), D % 2 && (d === "reverse" ? (y = 1 - y, v && (y -= v / o)) : d === "mirror" && (w = a)), A = $(0, 1, y) * o;
|
|
480
|
+
}
|
|
481
|
+
let x;
|
|
482
|
+
T ? (this.delayState.value = c[0], x = this.delayState) : x = w.next(A), r && !T && (x.value = r(x.value));
|
|
483
|
+
let { done: V } = x;
|
|
484
|
+
!T && u !== null && (V = this.playbackSpeed >= 0 ? this.currentTime >= s : this.currentTime <= 0);
|
|
485
|
+
const C = this.holdTime === null && (this.state === "finished" || this.state === "running" && V);
|
|
486
|
+
return C && h !== pe && (x.value = xe(c, this.options, m, this.speed)), p && p(x.value), C && this.finish(), x;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Allows the returned animation to be awaited or promise-chained. Currently
|
|
490
|
+
* resolves when the animation finishes at all but in a future update could/should
|
|
491
|
+
* reject if its cancels.
|
|
492
|
+
*/
|
|
493
|
+
then(e, n) {
|
|
494
|
+
return this.finished.then(e, n);
|
|
495
|
+
}
|
|
496
|
+
get duration() {
|
|
497
|
+
return E(this.calculatedDuration);
|
|
498
|
+
}
|
|
499
|
+
get iterationDuration() {
|
|
500
|
+
const { delay: e = 0 } = this.options || {};
|
|
501
|
+
return this.duration + E(e);
|
|
502
|
+
}
|
|
503
|
+
get time() {
|
|
504
|
+
return E(this.currentTime);
|
|
505
|
+
}
|
|
506
|
+
set time(e) {
|
|
507
|
+
e = R(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 ? this.driver.start(!1) : (this.startTime = 0, this.state = "paused", this.holdTime = e, this.tick(e));
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Returns the generator's velocity at the current time in units/second.
|
|
511
|
+
* Uses the analytical derivative when available (springs), avoiding
|
|
512
|
+
* the MotionValue's frame-dependent velocity estimation.
|
|
513
|
+
*/
|
|
514
|
+
getGeneratorVelocity() {
|
|
515
|
+
const e = this.currentTime;
|
|
516
|
+
if (e <= 0)
|
|
517
|
+
return this.options.velocity || 0;
|
|
518
|
+
if (this.generator.velocity)
|
|
519
|
+
return this.generator.velocity(e);
|
|
520
|
+
const n = this.generator.next(e).value;
|
|
521
|
+
return ht((i) => this.generator.next(i).value, e, n);
|
|
522
|
+
}
|
|
523
|
+
get speed() {
|
|
524
|
+
return this.playbackSpeed;
|
|
525
|
+
}
|
|
526
|
+
set speed(e) {
|
|
527
|
+
const n = this.playbackSpeed !== e;
|
|
528
|
+
n && this.driver && this.updateTime(L.now()), this.playbackSpeed = e, n && this.driver && (this.time = E(this.currentTime));
|
|
529
|
+
}
|
|
530
|
+
play() {
|
|
531
|
+
if (this.isStopped)
|
|
532
|
+
return;
|
|
533
|
+
const { driver: e = Cn, startTime: n } = this.options;
|
|
534
|
+
this.driver || (this.driver = e((s) => this.tick(s))), this.options.onPlay?.();
|
|
535
|
+
const i = this.driver.now();
|
|
536
|
+
this.state === "finished" ? (this.updateFinished(), this.startTime = i) : this.holdTime !== null ? this.startTime = i - this.holdTime : this.startTime || (this.startTime = n ?? i), this.state === "finished" && this.speed < 0 && (this.startTime += this.calculatedDuration), this.holdTime = null, this.state = "running", this.driver.start();
|
|
537
|
+
}
|
|
538
|
+
pause() {
|
|
539
|
+
this.state = "paused", this.updateTime(L.now()), this.holdTime = this.currentTime;
|
|
540
|
+
}
|
|
541
|
+
complete() {
|
|
542
|
+
this.state !== "running" && this.play(), this.state = "finished", this.holdTime = null;
|
|
543
|
+
}
|
|
544
|
+
finish() {
|
|
545
|
+
this.notifyFinished(), this.teardown(), this.state = "finished", this.options.onComplete?.();
|
|
546
|
+
}
|
|
547
|
+
cancel() {
|
|
548
|
+
this.holdTime = null, this.startTime = 0, this.tick(0), this.teardown(), this.options.onCancel?.();
|
|
549
|
+
}
|
|
550
|
+
teardown() {
|
|
551
|
+
this.state = "idle", this.stopDriver(), this.startTime = this.holdTime = null;
|
|
552
|
+
}
|
|
553
|
+
stopDriver() {
|
|
554
|
+
this.driver && (this.driver.stop(), this.driver = void 0);
|
|
555
|
+
}
|
|
556
|
+
sample(e) {
|
|
557
|
+
return this.startTime = 0, this.tick(e, !0);
|
|
558
|
+
}
|
|
559
|
+
attachTimeline(e) {
|
|
560
|
+
return this.options.allowFlatten && (this.options.type = "keyframes", this.options.ease = "linear", this.initAnimation()), this.driver?.stop(), e.observe(this);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
const pt = {
|
|
564
|
+
anticipate: ct,
|
|
565
|
+
backInOut: at,
|
|
566
|
+
circInOut: lt
|
|
567
|
+
};
|
|
568
|
+
function Un(t) {
|
|
569
|
+
return t in pt;
|
|
570
|
+
}
|
|
571
|
+
function $n(t) {
|
|
572
|
+
typeof t.ease == "string" && Un(t.ease) && (t.ease = pt[t.ease]);
|
|
573
|
+
}
|
|
574
|
+
const le = 10;
|
|
575
|
+
class jn extends Et {
|
|
576
|
+
constructor(e) {
|
|
577
|
+
$n(e), mt(e), super(e), e.startTime !== void 0 && e.autoplay !== !1 && (this.startTime = e.startTime), this.options = e;
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* WAAPI doesn't natively have any interruption capabilities.
|
|
581
|
+
*
|
|
582
|
+
* Rather than read committed styles back out of the DOM, we can
|
|
583
|
+
* create a renderless JS animation and sample it twice to calculate
|
|
584
|
+
* its current value, "previous" value, and therefore allow
|
|
585
|
+
* Motion to calculate velocity for any subsequent animation.
|
|
586
|
+
*/
|
|
587
|
+
updateMotionValue(e) {
|
|
588
|
+
const { motionValue: n, onUpdate: i, onComplete: s, element: r, ...a } = this.options;
|
|
589
|
+
if (!n)
|
|
590
|
+
return;
|
|
591
|
+
if (e !== void 0) {
|
|
592
|
+
n.set(e);
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
const o = new te({
|
|
596
|
+
...a,
|
|
597
|
+
autoplay: !1
|
|
598
|
+
}), u = Math.max(le, L.now() - this.startTime), l = $(0, le, u - le), c = o.sample(u).value, { name: f } = this.options;
|
|
599
|
+
r && f && Bt(r, f, c), n.setWithVelocity(o.sample(Math.max(0, u - l)).value, c, l), o.stop();
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
const Ee = (t, e) => e === "zIndex" ? !1 : !!(typeof t == "number" || Array.isArray(t) || typeof t == "string" && // It's animatable if we have a string
|
|
603
|
+
(qe.test(t) || t === "0") && // And it contains numbers and/or colors
|
|
604
|
+
!t.startsWith("url("));
|
|
605
|
+
function qn(t) {
|
|
606
|
+
const e = t[0];
|
|
607
|
+
if (t.length === 1)
|
|
608
|
+
return !0;
|
|
609
|
+
for (let n = 0; n < t.length; n++)
|
|
610
|
+
if (t[n] !== e)
|
|
611
|
+
return !0;
|
|
612
|
+
}
|
|
613
|
+
function zn(t, e, n, i) {
|
|
614
|
+
const s = t[0];
|
|
615
|
+
if (s === null)
|
|
616
|
+
return !1;
|
|
617
|
+
if (e === "display" || e === "visibility")
|
|
618
|
+
return !0;
|
|
619
|
+
const r = t[t.length - 1], a = Ee(s, e), o = Ee(r, e);
|
|
620
|
+
return se(a === o, `You are trying to animate ${e} from "${s}" to "${r}". "${a ? r : s}" is not an animatable value.`, "value-not-animatable"), !a || !o ? !1 : qn(t) || (n === "spring" || Gt(n)) && i;
|
|
621
|
+
}
|
|
622
|
+
function ge(t) {
|
|
623
|
+
t.duration = 0, t.type = "keyframes";
|
|
624
|
+
}
|
|
625
|
+
const Xn = /^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;
|
|
626
|
+
function Yn(t) {
|
|
627
|
+
for (let e = 0; e < t.length; e++)
|
|
628
|
+
if (typeof t[e] == "string" && Xn.test(t[e]))
|
|
629
|
+
return !0;
|
|
630
|
+
return !1;
|
|
631
|
+
}
|
|
632
|
+
const Zn = /* @__PURE__ */ new Set([
|
|
633
|
+
"color",
|
|
634
|
+
"backgroundColor",
|
|
635
|
+
"outlineColor",
|
|
636
|
+
"fill",
|
|
637
|
+
"stroke",
|
|
638
|
+
"borderColor",
|
|
639
|
+
"borderTopColor",
|
|
640
|
+
"borderRightColor",
|
|
641
|
+
"borderBottomColor",
|
|
642
|
+
"borderLeftColor"
|
|
643
|
+
]), Jn = /* @__PURE__ */ Ht(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
|
|
644
|
+
function Qn(t) {
|
|
645
|
+
const { motionValue: e, name: n, repeatDelay: i, repeatType: s, damping: r, type: a, keyframes: o } = t;
|
|
646
|
+
if (!(e?.owner?.current instanceof HTMLElement))
|
|
647
|
+
return !1;
|
|
648
|
+
const { onUpdate: l, transformTemplate: c } = e.owner.getProps();
|
|
649
|
+
return Jn() && n && /**
|
|
650
|
+
* Force WAAPI for color properties with browser-only color formats
|
|
651
|
+
* (oklch, oklab, lab, lch, etc.) that the JS animation path can't parse.
|
|
652
|
+
*/
|
|
653
|
+
(Nt.has(n) || Zn.has(n) && Yn(o)) && (n !== "transform" || !c) && /**
|
|
654
|
+
* If we're outputting values to onUpdate then we can't use WAAPI as there's
|
|
655
|
+
* no way to read the value from WAAPI every frame.
|
|
656
|
+
*/
|
|
657
|
+
!l && !i && s !== "mirror" && r !== 0 && a !== "inertia";
|
|
658
|
+
}
|
|
659
|
+
const ei = 40;
|
|
660
|
+
class ti extends ze {
|
|
661
|
+
constructor({ autoplay: e = !0, delay: n = 0, type: i = "keyframes", repeat: s = 0, repeatDelay: r = 0, repeatType: a = "loop", keyframes: o, name: u, motionValue: l, element: c, ...f }) {
|
|
662
|
+
super(), this.stop = () => {
|
|
663
|
+
this._animation && (this._animation.stop(), this.stopTimeline?.()), this.keyframeResolver?.cancel();
|
|
664
|
+
}, this.createdAt = L.now();
|
|
665
|
+
const d = {
|
|
666
|
+
autoplay: e,
|
|
667
|
+
delay: n,
|
|
668
|
+
type: i,
|
|
669
|
+
repeat: s,
|
|
670
|
+
repeatDelay: r,
|
|
671
|
+
repeatType: a,
|
|
672
|
+
name: u,
|
|
673
|
+
motionValue: l,
|
|
674
|
+
element: c,
|
|
675
|
+
...f
|
|
676
|
+
}, v = c?.KeyframeResolver || Xe;
|
|
677
|
+
this.keyframeResolver = new v(o, (h, p, m) => this.onKeyframesResolved(h, p, d, !m), u, l, c), this.keyframeResolver?.scheduleResolve();
|
|
678
|
+
}
|
|
679
|
+
onKeyframesResolved(e, n, i, s) {
|
|
680
|
+
this.keyframeResolver = void 0;
|
|
681
|
+
const { name: r, type: a, velocity: o, delay: u, isHandoff: l, onUpdate: c } = i;
|
|
682
|
+
this.resolvedAt = L.now();
|
|
683
|
+
let f = !0;
|
|
684
|
+
zn(e, r, a, o) || (f = !1, (j.instantAnimations || !u) && c?.(xe(e, i, n)), e[0] = e[e.length - 1], ge(i), i.repeat = 0);
|
|
685
|
+
const v = {
|
|
686
|
+
startTime: s ? this.resolvedAt ? this.resolvedAt - this.createdAt > ei ? this.resolvedAt : this.createdAt : this.createdAt : void 0,
|
|
687
|
+
finalKeyframe: n,
|
|
688
|
+
...i,
|
|
689
|
+
keyframes: e
|
|
690
|
+
}, h = f && !l && Qn(v), p = v.motionValue?.owner?.current;
|
|
691
|
+
let m;
|
|
692
|
+
if (h)
|
|
693
|
+
try {
|
|
694
|
+
m = new jn({
|
|
695
|
+
...v,
|
|
696
|
+
element: p
|
|
697
|
+
});
|
|
698
|
+
} catch {
|
|
699
|
+
m = new te(v);
|
|
700
|
+
}
|
|
701
|
+
else
|
|
702
|
+
m = new te(v);
|
|
703
|
+
m.finished.then(() => {
|
|
704
|
+
this.notifyFinished();
|
|
705
|
+
}).catch(ne), this.pendingTimeline && (this.stopTimeline = m.attachTimeline(this.pendingTimeline), this.pendingTimeline = void 0), this._animation = m;
|
|
706
|
+
}
|
|
707
|
+
get finished() {
|
|
708
|
+
return this._animation ? this.animation.finished : this._finished;
|
|
709
|
+
}
|
|
710
|
+
then(e, n) {
|
|
711
|
+
return this.finished.finally(e).then(() => {
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
get animation() {
|
|
715
|
+
return this._animation || (this.keyframeResolver?.resume(), _t()), this._animation;
|
|
716
|
+
}
|
|
717
|
+
get duration() {
|
|
718
|
+
return this.animation.duration;
|
|
719
|
+
}
|
|
720
|
+
get iterationDuration() {
|
|
721
|
+
return this.animation.iterationDuration;
|
|
722
|
+
}
|
|
723
|
+
get time() {
|
|
724
|
+
return this.animation.time;
|
|
725
|
+
}
|
|
726
|
+
set time(e) {
|
|
727
|
+
this.animation.time = e;
|
|
728
|
+
}
|
|
729
|
+
get speed() {
|
|
730
|
+
return this.animation.speed;
|
|
731
|
+
}
|
|
732
|
+
get state() {
|
|
733
|
+
return this.animation.state;
|
|
734
|
+
}
|
|
735
|
+
set speed(e) {
|
|
736
|
+
this.animation.speed = e;
|
|
737
|
+
}
|
|
738
|
+
get startTime() {
|
|
739
|
+
return this.animation.startTime;
|
|
740
|
+
}
|
|
741
|
+
attachTimeline(e) {
|
|
742
|
+
return this._animation ? this.stopTimeline = this.animation.attachTimeline(e) : this.pendingTimeline = e, () => this.stop();
|
|
743
|
+
}
|
|
744
|
+
play() {
|
|
745
|
+
this.animation.play();
|
|
746
|
+
}
|
|
747
|
+
pause() {
|
|
748
|
+
this.animation.pause();
|
|
749
|
+
}
|
|
750
|
+
complete() {
|
|
751
|
+
this.animation.complete();
|
|
752
|
+
}
|
|
753
|
+
cancel() {
|
|
754
|
+
this._animation && this.animation.cancel(), this.keyframeResolver?.cancel();
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
function gt(t, e, n, i = 0, s = 1) {
|
|
758
|
+
const r = Array.from(t).sort((l, c) => l.sortNodePosition(c)).indexOf(e), a = t.size, o = (a - 1) * i;
|
|
759
|
+
return typeof n == "function" ? n(r, a) : s === 1 ? r * i : o - r * i;
|
|
760
|
+
}
|
|
761
|
+
function yt(t, e) {
|
|
762
|
+
if (t?.inherit && e) {
|
|
763
|
+
const { inherit: n, ...i } = t;
|
|
764
|
+
return { ...e, ...i };
|
|
765
|
+
}
|
|
766
|
+
return t;
|
|
767
|
+
}
|
|
768
|
+
function vt(t, e) {
|
|
769
|
+
const n = t?.[e] ?? t?.default ?? t;
|
|
770
|
+
return n !== t ? yt(n, t) : n;
|
|
771
|
+
}
|
|
772
|
+
const ni = {
|
|
773
|
+
type: "spring",
|
|
774
|
+
stiffness: 500,
|
|
775
|
+
damping: 25,
|
|
776
|
+
restSpeed: 10
|
|
777
|
+
}, ii = (t) => ({
|
|
778
|
+
type: "spring",
|
|
779
|
+
stiffness: 550,
|
|
780
|
+
damping: t === 0 ? 2 * Math.sqrt(550) : 30,
|
|
781
|
+
restSpeed: 10
|
|
782
|
+
}), si = {
|
|
783
|
+
type: "keyframes",
|
|
784
|
+
duration: 0.8
|
|
785
|
+
}, ri = {
|
|
786
|
+
type: "keyframes",
|
|
787
|
+
ease: [0.25, 0.1, 0.35, 1],
|
|
788
|
+
duration: 0.3
|
|
789
|
+
}, oi = (t, { keyframes: e }) => e.length > 2 ? si : Ae.has(t) ? t.startsWith("scale") ? ii(e[1]) : ni : ri, ai = /* @__PURE__ */ new Set([
|
|
790
|
+
"when",
|
|
791
|
+
"delay",
|
|
792
|
+
"delayChildren",
|
|
793
|
+
"staggerChildren",
|
|
794
|
+
"staggerDirection",
|
|
795
|
+
"repeat",
|
|
796
|
+
"repeatType",
|
|
797
|
+
"repeatDelay",
|
|
798
|
+
"from",
|
|
799
|
+
"elapsed"
|
|
800
|
+
]);
|
|
801
|
+
function ci(t) {
|
|
802
|
+
for (const e in t)
|
|
803
|
+
if (!ai.has(e))
|
|
804
|
+
return !0;
|
|
805
|
+
return !1;
|
|
806
|
+
}
|
|
807
|
+
const li = (t, e, n, i = {}, s, r) => (a) => {
|
|
808
|
+
const o = vt(i, t) || {}, u = o.delay || i.delay || 0;
|
|
809
|
+
let { elapsed: l = 0 } = i;
|
|
810
|
+
l = l - R(u);
|
|
811
|
+
const c = {
|
|
812
|
+
keyframes: Array.isArray(n) ? n : [null, n],
|
|
813
|
+
ease: "easeOut",
|
|
814
|
+
velocity: e.getVelocity(),
|
|
815
|
+
...o,
|
|
816
|
+
delay: -l,
|
|
817
|
+
onUpdate: (d) => {
|
|
818
|
+
e.set(d), o.onUpdate && o.onUpdate(d);
|
|
819
|
+
},
|
|
820
|
+
onComplete: () => {
|
|
821
|
+
a(), o.onComplete && o.onComplete();
|
|
822
|
+
},
|
|
823
|
+
name: t,
|
|
824
|
+
motionValue: e,
|
|
825
|
+
element: r ? void 0 : s
|
|
826
|
+
};
|
|
827
|
+
ci(o) || Object.assign(c, oi(t, c)), c.duration && (c.duration = R(c.duration)), c.repeatDelay && (c.repeatDelay = R(c.repeatDelay)), c.from !== void 0 && (c.keyframes[0] = c.from);
|
|
828
|
+
let f = !1;
|
|
829
|
+
if ((c.type === !1 || c.duration === 0 && !c.repeatDelay) && (ge(c), c.delay === 0 && (f = !0)), (j.instantAnimations || j.skipAnimations || s?.shouldSkipAnimations || o.skipAnimations) && (f = !0, ge(c), c.delay = 0), c.allowFlatten = !o.type && !o.ease, f && !r && e.get() !== void 0) {
|
|
830
|
+
const d = xe(c.keyframes, o);
|
|
831
|
+
if (d !== void 0) {
|
|
832
|
+
H.update(() => {
|
|
833
|
+
c.onUpdate(d), c.onComplete();
|
|
834
|
+
});
|
|
835
|
+
return;
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
return o.isSync ? new te(c) : new ti(c);
|
|
839
|
+
}, ui = (
|
|
840
|
+
// eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words
|
|
841
|
+
/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u
|
|
842
|
+
);
|
|
843
|
+
function fi(t) {
|
|
844
|
+
const e = ui.exec(t);
|
|
845
|
+
if (!e)
|
|
846
|
+
return [,];
|
|
847
|
+
const [, n, i, s] = e;
|
|
848
|
+
return [`--${n ?? i}`, s];
|
|
849
|
+
}
|
|
850
|
+
const di = 4;
|
|
851
|
+
function bt(t, e, n = 1) {
|
|
852
|
+
z(n <= di, `Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`, "max-css-var-depth");
|
|
853
|
+
const [i, s] = fi(t);
|
|
854
|
+
if (!i)
|
|
855
|
+
return;
|
|
856
|
+
const r = window.getComputedStyle(e).getPropertyValue(i);
|
|
857
|
+
if (r) {
|
|
858
|
+
const a = r.trim();
|
|
859
|
+
return Wt(a) ? parseFloat(a) : a;
|
|
860
|
+
}
|
|
861
|
+
return Te(s) ? bt(s, e, n + 1) : s;
|
|
862
|
+
}
|
|
863
|
+
function U(t, e, n) {
|
|
864
|
+
const i = t.getProps();
|
|
865
|
+
return Ut(i, e, n !== void 0 ? n : i.custom, t);
|
|
866
|
+
}
|
|
867
|
+
const Tt = /* @__PURE__ */ new Set([
|
|
868
|
+
"width",
|
|
869
|
+
"height",
|
|
870
|
+
"top",
|
|
871
|
+
"left",
|
|
872
|
+
"right",
|
|
873
|
+
"bottom",
|
|
874
|
+
...$t
|
|
875
|
+
]), ye = (t) => Array.isArray(t);
|
|
876
|
+
function hi(t, e, n) {
|
|
877
|
+
t.hasValue(e) ? t.getValue(e).set(n) : t.addValue(e, jt(n));
|
|
878
|
+
}
|
|
879
|
+
function mi(t) {
|
|
880
|
+
return ye(t) ? t[t.length - 1] || 0 : t;
|
|
881
|
+
}
|
|
882
|
+
function pi(t, e) {
|
|
883
|
+
const n = U(t, e);
|
|
884
|
+
let { transitionEnd: i = {}, transition: s = {}, ...r } = n || {};
|
|
885
|
+
r = { ...r, ...i };
|
|
886
|
+
for (const a in r) {
|
|
887
|
+
const o = mi(r[a]);
|
|
888
|
+
hi(t, a, o);
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
function gi(t) {
|
|
892
|
+
return !!(Ye(t) && t.add);
|
|
893
|
+
}
|
|
894
|
+
function yi(t, e) {
|
|
895
|
+
const n = t.getValue("willChange");
|
|
896
|
+
if (gi(n))
|
|
897
|
+
return n.add(e);
|
|
898
|
+
if (!n && j.WillChange) {
|
|
899
|
+
const i = new j.WillChange("auto");
|
|
900
|
+
t.addValue("willChange", i), i.add(e);
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
function vi(t) {
|
|
904
|
+
return t.props[qt];
|
|
905
|
+
}
|
|
906
|
+
function bi({ protectedKeys: t, needsAnimating: e }, n) {
|
|
907
|
+
const i = t.hasOwnProperty(n) && e[n] !== !0;
|
|
908
|
+
return e[n] = !1, i;
|
|
909
|
+
}
|
|
910
|
+
function xt(t, e, { delay: n = 0, transitionOverride: i, type: s } = {}) {
|
|
911
|
+
let { transition: r, transitionEnd: a, ...o } = e;
|
|
912
|
+
const u = t.getDefaultTransition();
|
|
913
|
+
r = r ? yt(r, u) : u;
|
|
914
|
+
const l = r?.reduceMotion, c = r?.skipAnimations;
|
|
915
|
+
i && (r = i);
|
|
916
|
+
const f = [], d = s && t.animationState && t.animationState.getState()[s], v = r?.path;
|
|
917
|
+
v && v.animateVisualElement(t, o, r, n, f);
|
|
918
|
+
for (const h in o) {
|
|
919
|
+
const p = t.getValue(h, t.latestValues[h] ?? null), m = o[h];
|
|
920
|
+
if (m === void 0 || d && bi(d, h))
|
|
921
|
+
continue;
|
|
922
|
+
const g = {
|
|
923
|
+
delay: n,
|
|
924
|
+
...vt(r || {}, h)
|
|
925
|
+
};
|
|
926
|
+
c && (g.skipAnimations = !0);
|
|
927
|
+
const T = p.get();
|
|
928
|
+
if (T !== void 0 && !p.isAnimating() && !Array.isArray(m) && m === T && !g.velocity) {
|
|
929
|
+
H.update(() => p.set(m));
|
|
930
|
+
continue;
|
|
931
|
+
}
|
|
932
|
+
let A = !1;
|
|
933
|
+
if (window.MotionHandoffAnimation) {
|
|
934
|
+
const V = vi(t);
|
|
935
|
+
if (V) {
|
|
936
|
+
const C = window.MotionHandoffAnimation(V, h, H);
|
|
937
|
+
C !== null && (g.startTime = C, A = !0);
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
yi(t, h);
|
|
941
|
+
const w = l ?? t.shouldReduceMotion;
|
|
942
|
+
p.start(li(h, p, m, w && Tt.has(h) ? { type: !1 } : g, t, A));
|
|
943
|
+
const x = p.animation;
|
|
944
|
+
x && f.push(x);
|
|
945
|
+
}
|
|
946
|
+
if (a) {
|
|
947
|
+
const h = () => H.update(() => {
|
|
948
|
+
a && pi(t, a);
|
|
949
|
+
});
|
|
950
|
+
f.length ? Promise.all(f).then(h) : h();
|
|
951
|
+
}
|
|
952
|
+
return f;
|
|
953
|
+
}
|
|
954
|
+
function ve(t, e, n = {}) {
|
|
955
|
+
const i = U(t, e, n.type === "exit" ? t.presenceContext?.custom : void 0);
|
|
956
|
+
let { transition: s = t.getDefaultTransition() || {} } = i || {};
|
|
957
|
+
n.transitionOverride && (s = n.transitionOverride);
|
|
958
|
+
const r = i ? () => Promise.all(xt(t, i, n)) : () => Promise.resolve(), a = t.variantChildren && t.variantChildren.size ? (u = 0) => {
|
|
959
|
+
const { delayChildren: l = 0, staggerChildren: c, staggerDirection: f } = s;
|
|
960
|
+
return Ti(t, e, u, l, c, f, n);
|
|
961
|
+
} : () => Promise.resolve(), { when: o } = s;
|
|
962
|
+
if (o) {
|
|
963
|
+
const [u, l] = o === "beforeChildren" ? [r, a] : [a, r];
|
|
964
|
+
return u().then(() => l());
|
|
965
|
+
} else
|
|
966
|
+
return Promise.all([r(), a(n.delay)]);
|
|
967
|
+
}
|
|
968
|
+
function Ti(t, e, n = 0, i = 0, s = 0, r = 1, a) {
|
|
969
|
+
const o = [];
|
|
970
|
+
for (const u of t.variantChildren)
|
|
971
|
+
u.notify("AnimationStart", e), o.push(ve(u, e, {
|
|
972
|
+
...a,
|
|
973
|
+
delay: n + (typeof i == "function" ? 0 : i) + gt(t.variantChildren, u, i, s, r)
|
|
974
|
+
}).then(() => u.notify("AnimationComplete", e)));
|
|
975
|
+
return Promise.all(o);
|
|
976
|
+
}
|
|
977
|
+
function xi(t, e, n = {}) {
|
|
978
|
+
t.notify("AnimationStart", e);
|
|
979
|
+
let i;
|
|
980
|
+
if (Array.isArray(e)) {
|
|
981
|
+
const s = e.map((r) => ve(t, r, n));
|
|
982
|
+
i = Promise.all(s);
|
|
983
|
+
} else if (typeof e == "string")
|
|
984
|
+
i = ve(t, e, n);
|
|
985
|
+
else {
|
|
986
|
+
const s = typeof e == "function" ? U(t, e, n.custom) : e;
|
|
987
|
+
i = Promise.all(xt(t, s, n));
|
|
988
|
+
}
|
|
989
|
+
return i.then(() => {
|
|
990
|
+
t.notify("AnimationComplete", e);
|
|
991
|
+
});
|
|
992
|
+
}
|
|
993
|
+
function Ai(t) {
|
|
994
|
+
return typeof t == "number" ? t === 0 : t !== null ? t === "none" || t === "0" || zt(t) : !0;
|
|
995
|
+
}
|
|
996
|
+
const wi = /* @__PURE__ */ new Set(["auto", "none", "0"]);
|
|
997
|
+
function Si(t, e, n) {
|
|
998
|
+
let i = 0, s;
|
|
999
|
+
for (; i < t.length && !s; ) {
|
|
1000
|
+
const r = t[i];
|
|
1001
|
+
typeof r == "string" && !wi.has(r) && de(r).values.length && (s = t[i]), i++;
|
|
1002
|
+
}
|
|
1003
|
+
if (s && n)
|
|
1004
|
+
for (const r of e)
|
|
1005
|
+
t[r] = Xt(n, s);
|
|
1006
|
+
}
|
|
1007
|
+
class Vi extends Xe {
|
|
1008
|
+
constructor(e, n, i, s, r) {
|
|
1009
|
+
super(e, n, i, s, r, !0);
|
|
1010
|
+
}
|
|
1011
|
+
readKeyframes() {
|
|
1012
|
+
const { unresolvedKeyframes: e, element: n, name: i } = this;
|
|
1013
|
+
if (!n || !n.current)
|
|
1014
|
+
return;
|
|
1015
|
+
super.readKeyframes();
|
|
1016
|
+
for (let c = 0; c < e.length; c++) {
|
|
1017
|
+
let f = e[c];
|
|
1018
|
+
if (typeof f == "string" && (f = f.trim(), Te(f))) {
|
|
1019
|
+
const d = bt(f, n.current);
|
|
1020
|
+
d !== void 0 && (e[c] = d), c === e.length - 1 && (this.finalKeyframe = f);
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
if (this.resolveNoneKeyframes(), !Tt.has(i) || e.length !== 2)
|
|
1024
|
+
return;
|
|
1025
|
+
const [s, r] = e, a = Pe(s), o = Pe(r), u = ke(s), l = ke(r);
|
|
1026
|
+
if (u !== l && Y[i]) {
|
|
1027
|
+
this.needsMeasurement = !0;
|
|
1028
|
+
return;
|
|
1029
|
+
}
|
|
1030
|
+
if (a !== o)
|
|
1031
|
+
if (Ie(a) && Ie(o))
|
|
1032
|
+
for (let c = 0; c < e.length; c++) {
|
|
1033
|
+
const f = e[c];
|
|
1034
|
+
typeof f == "string" && (e[c] = parseFloat(f));
|
|
1035
|
+
}
|
|
1036
|
+
else Y[i] && (this.needsMeasurement = !0);
|
|
1037
|
+
}
|
|
1038
|
+
resolveNoneKeyframes() {
|
|
1039
|
+
const { unresolvedKeyframes: e, name: n } = this, i = [];
|
|
1040
|
+
for (let s = 0; s < e.length; s++)
|
|
1041
|
+
(e[s] === null || Ai(e[s])) && i.push(s);
|
|
1042
|
+
i.length && Si(e, i, n);
|
|
1043
|
+
}
|
|
1044
|
+
measureInitialState() {
|
|
1045
|
+
const { element: e, unresolvedKeyframes: n, name: i } = this;
|
|
1046
|
+
if (!e || !e.current)
|
|
1047
|
+
return;
|
|
1048
|
+
i === "height" && (this.suspendedScrollY = window.pageYOffset), this.measuredOrigin = Y[i](e.measureViewportBox(), window.getComputedStyle(e.current)), n[0] = this.measuredOrigin;
|
|
1049
|
+
const s = n[n.length - 1];
|
|
1050
|
+
s !== void 0 && e.getValue(i, s).jump(s, !1);
|
|
1051
|
+
}
|
|
1052
|
+
measureEndState() {
|
|
1053
|
+
const { element: e, name: n, unresolvedKeyframes: i } = this;
|
|
1054
|
+
if (!e || !e.current)
|
|
1055
|
+
return;
|
|
1056
|
+
const s = e.getValue(n);
|
|
1057
|
+
s && s.jump(this.measuredOrigin, !1);
|
|
1058
|
+
const r = i.length - 1, a = i[r];
|
|
1059
|
+
i[r] = Y[n](e.measureViewportBox(), window.getComputedStyle(e.current)), a !== null && this.finalKeyframe === void 0 && (this.finalKeyframe = a), this.removedTransforms?.length && this.removedTransforms.forEach(([o, u]) => {
|
|
1060
|
+
e.getValue(o).set(u);
|
|
1061
|
+
}), this.resolveNoneKeyframes();
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
function Mi(t, e, n) {
|
|
1065
|
+
if (t == null)
|
|
1066
|
+
return [];
|
|
1067
|
+
if (t instanceof EventTarget)
|
|
1068
|
+
return [t];
|
|
1069
|
+
if (typeof t == "string") {
|
|
1070
|
+
let i = document;
|
|
1071
|
+
const s = n?.[t] ?? i.querySelectorAll(t);
|
|
1072
|
+
return s ? Array.from(s) : [];
|
|
1073
|
+
}
|
|
1074
|
+
return Array.from(t).filter((i) => i != null);
|
|
1075
|
+
}
|
|
1076
|
+
const Ci = {
|
|
1077
|
+
y: !1
|
|
1078
|
+
};
|
|
1079
|
+
function Di() {
|
|
1080
|
+
return Ci.y;
|
|
1081
|
+
}
|
|
1082
|
+
function At(t, e) {
|
|
1083
|
+
const n = Mi(t), i = new AbortController(), s = {
|
|
1084
|
+
passive: !0,
|
|
1085
|
+
...e,
|
|
1086
|
+
signal: i.signal
|
|
1087
|
+
};
|
|
1088
|
+
return [n, s, () => i.abort()];
|
|
1089
|
+
}
|
|
1090
|
+
function Pi(t) {
|
|
1091
|
+
return !(t.pointerType === "touch" || Di());
|
|
1092
|
+
}
|
|
1093
|
+
function ki(t, e, n = {}) {
|
|
1094
|
+
const [i, s, r] = At(t, n);
|
|
1095
|
+
return i.forEach((a) => {
|
|
1096
|
+
let o = !1, u = !1, l;
|
|
1097
|
+
const c = () => {
|
|
1098
|
+
a.removeEventListener("pointerleave", h);
|
|
1099
|
+
}, f = (m) => {
|
|
1100
|
+
l && (l(m), l = void 0), c();
|
|
1101
|
+
}, d = (m) => {
|
|
1102
|
+
o = !1, window.removeEventListener("pointerup", d), window.removeEventListener("pointercancel", d), u && (u = !1, f(m));
|
|
1103
|
+
}, v = () => {
|
|
1104
|
+
o = !0, window.addEventListener("pointerup", d, s), window.addEventListener("pointercancel", d, s);
|
|
1105
|
+
}, h = (m) => {
|
|
1106
|
+
if (m.pointerType !== "touch") {
|
|
1107
|
+
if (o) {
|
|
1108
|
+
u = !0;
|
|
1109
|
+
return;
|
|
1110
|
+
}
|
|
1111
|
+
f(m);
|
|
1112
|
+
}
|
|
1113
|
+
}, p = (m) => {
|
|
1114
|
+
if (!Pi(m))
|
|
1115
|
+
return;
|
|
1116
|
+
u = !1;
|
|
1117
|
+
const g = e(a, m);
|
|
1118
|
+
typeof g == "function" && (l = g, a.addEventListener("pointerleave", h, s));
|
|
1119
|
+
};
|
|
1120
|
+
a.addEventListener("pointerenter", p, s), a.addEventListener("pointerdown", v, s);
|
|
1121
|
+
}), r;
|
|
1122
|
+
}
|
|
1123
|
+
const wt = (t, e) => e ? t === e ? !0 : wt(t, e.parentElement) : !1, Ii = (t) => t.pointerType === "mouse" ? typeof t.button != "number" || t.button <= 0 : t.isPrimary !== !1, Oi = /* @__PURE__ */ new Set([
|
|
1124
|
+
"BUTTON",
|
|
1125
|
+
"INPUT",
|
|
1126
|
+
"SELECT",
|
|
1127
|
+
"TEXTAREA",
|
|
1128
|
+
"A"
|
|
1129
|
+
]);
|
|
1130
|
+
function Fi(t) {
|
|
1131
|
+
return Oi.has(t.tagName) || t.isContentEditable === !0;
|
|
1132
|
+
}
|
|
1133
|
+
const Z = /* @__PURE__ */ new WeakSet();
|
|
1134
|
+
function Be(t) {
|
|
1135
|
+
return (e) => {
|
|
1136
|
+
e.key === "Enter" && t(e);
|
|
1137
|
+
};
|
|
1138
|
+
}
|
|
1139
|
+
function ue(t, e) {
|
|
1140
|
+
t.dispatchEvent(new PointerEvent("pointer" + e, { isPrimary: !0, bubbles: !0 }));
|
|
1141
|
+
}
|
|
1142
|
+
const Ri = (t, e) => {
|
|
1143
|
+
const n = t.currentTarget;
|
|
1144
|
+
if (!n)
|
|
1145
|
+
return;
|
|
1146
|
+
const i = Be(() => {
|
|
1147
|
+
if (Z.has(n))
|
|
1148
|
+
return;
|
|
1149
|
+
ue(n, "down");
|
|
1150
|
+
const s = Be(() => {
|
|
1151
|
+
ue(n, "up");
|
|
1152
|
+
}), r = () => ue(n, "cancel");
|
|
1153
|
+
n.addEventListener("keyup", s, e), n.addEventListener("blur", r, e);
|
|
1154
|
+
});
|
|
1155
|
+
n.addEventListener("keydown", i, e), n.addEventListener("blur", () => n.removeEventListener("keydown", i), e);
|
|
1156
|
+
};
|
|
1157
|
+
function Ge(t) {
|
|
1158
|
+
return Ii(t) && !0;
|
|
1159
|
+
}
|
|
1160
|
+
const Ne = /* @__PURE__ */ new WeakSet();
|
|
1161
|
+
function Ki(t, e, n = {}) {
|
|
1162
|
+
const [i, s, r] = At(t, n), a = (o) => {
|
|
1163
|
+
const u = o.currentTarget;
|
|
1164
|
+
if (!Ge(o) || Ne.has(o))
|
|
1165
|
+
return;
|
|
1166
|
+
Z.add(u), n.stopPropagation && Ne.add(o);
|
|
1167
|
+
const l = e(u, o), c = { ...s, capture: !0 }, f = (h, p) => {
|
|
1168
|
+
window.removeEventListener("pointerup", d, c), window.removeEventListener("pointercancel", v, c), Z.has(u) && Z.delete(u), Ge(h) && typeof l == "function" && l(h, { success: p });
|
|
1169
|
+
}, d = (h) => {
|
|
1170
|
+
f(h, u === window || u === document || n.useGlobalTarget || wt(u, h.target));
|
|
1171
|
+
}, v = (h) => {
|
|
1172
|
+
f(h, !1);
|
|
1173
|
+
};
|
|
1174
|
+
window.addEventListener("pointerup", d, c), window.addEventListener("pointercancel", v, c);
|
|
1175
|
+
};
|
|
1176
|
+
return i.forEach((o) => {
|
|
1177
|
+
(n.useGlobalTarget ? window : o).addEventListener("pointerdown", a, s), Yt(o) && (o.addEventListener("focus", (l) => Ri(l, s)), !Fi(o) && !o.hasAttribute("tabindex") && (o.tabIndex = 0));
|
|
1178
|
+
}), r;
|
|
1179
|
+
}
|
|
1180
|
+
class St extends Zt {
|
|
1181
|
+
constructor() {
|
|
1182
|
+
super(...arguments), this.KeyframeResolver = Vi;
|
|
1183
|
+
}
|
|
1184
|
+
sortInstanceNodePosition(e, n) {
|
|
1185
|
+
return e.compareDocumentPosition(n) & 2 ? 1 : -1;
|
|
1186
|
+
}
|
|
1187
|
+
getBaseTargetFromProps(e, n) {
|
|
1188
|
+
const i = e.style;
|
|
1189
|
+
return i ? i[n] : void 0;
|
|
1190
|
+
}
|
|
1191
|
+
removeValueFromRenderState(e, { vars: n, style: i }) {
|
|
1192
|
+
delete n[e], delete i[e];
|
|
1193
|
+
}
|
|
1194
|
+
handleChildMotionValue() {
|
|
1195
|
+
this.childSubscription && (this.childSubscription(), delete this.childSubscription);
|
|
1196
|
+
const { children: e } = this.props;
|
|
1197
|
+
Ye(e) && (this.childSubscription = e.on("change", (n) => {
|
|
1198
|
+
this.current && (this.current.textContent = `${n}`);
|
|
1199
|
+
}));
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
class q {
|
|
1203
|
+
constructor(e) {
|
|
1204
|
+
this.isMounted = !1, this.node = e;
|
|
1205
|
+
}
|
|
1206
|
+
update() {
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
function Li({ top: t, left: e, right: n, bottom: i }) {
|
|
1210
|
+
return {
|
|
1211
|
+
x: { min: e, max: n },
|
|
1212
|
+
y: { min: t, max: i }
|
|
1213
|
+
};
|
|
1214
|
+
}
|
|
1215
|
+
function Ei(t, e) {
|
|
1216
|
+
if (!e)
|
|
1217
|
+
return t;
|
|
1218
|
+
const n = e({ x: t.left, y: t.top }), i = e({ x: t.right, y: t.bottom });
|
|
1219
|
+
return {
|
|
1220
|
+
top: n.y,
|
|
1221
|
+
left: n.x,
|
|
1222
|
+
bottom: i.y,
|
|
1223
|
+
right: i.x
|
|
1224
|
+
};
|
|
1225
|
+
}
|
|
1226
|
+
function Bi(t, e) {
|
|
1227
|
+
return Li(Ei(t.getBoundingClientRect(), e));
|
|
1228
|
+
}
|
|
1229
|
+
function Vt(t, { style: e, vars: n }, i, s) {
|
|
1230
|
+
const r = t.style;
|
|
1231
|
+
let a;
|
|
1232
|
+
for (a in e)
|
|
1233
|
+
r[a] = e[a];
|
|
1234
|
+
s?.applyProjectionStyles(r, i);
|
|
1235
|
+
for (a in n)
|
|
1236
|
+
r.setProperty(a, n[a]);
|
|
1237
|
+
}
|
|
1238
|
+
function Gi(t) {
|
|
1239
|
+
return window.getComputedStyle(t);
|
|
1240
|
+
}
|
|
1241
|
+
class Ni extends St {
|
|
1242
|
+
constructor() {
|
|
1243
|
+
super(...arguments), this.type = "html", this.renderInstance = Vt;
|
|
1244
|
+
}
|
|
1245
|
+
readValueFromInstance(e, n) {
|
|
1246
|
+
if (Ae.has(n))
|
|
1247
|
+
return this.projection?.isProjecting ? Jt(n) : Qt(e, n);
|
|
1248
|
+
{
|
|
1249
|
+
const i = Gi(e), s = (en(n) ? i.getPropertyValue(n) : i[n]) || 0;
|
|
1250
|
+
return typeof s == "string" ? s.trim() : s;
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
measureInstanceViewportBox(e, { transformPagePoint: n }) {
|
|
1254
|
+
return Bi(e, n);
|
|
1255
|
+
}
|
|
1256
|
+
build(e, n, i) {
|
|
1257
|
+
tn(e, n, i.transformTemplate);
|
|
1258
|
+
}
|
|
1259
|
+
scrapeMotionValuesFromProps(e, n, i) {
|
|
1260
|
+
return nn(e, n, i);
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
const Mt = /* @__PURE__ */ new Set([
|
|
1264
|
+
"baseFrequency",
|
|
1265
|
+
"diffuseConstant",
|
|
1266
|
+
"kernelMatrix",
|
|
1267
|
+
"kernelUnitLength",
|
|
1268
|
+
"keySplines",
|
|
1269
|
+
"keyTimes",
|
|
1270
|
+
"limitingConeAngle",
|
|
1271
|
+
"markerHeight",
|
|
1272
|
+
"markerWidth",
|
|
1273
|
+
"numOctaves",
|
|
1274
|
+
"targetX",
|
|
1275
|
+
"targetY",
|
|
1276
|
+
"surfaceScale",
|
|
1277
|
+
"specularConstant",
|
|
1278
|
+
"specularExponent",
|
|
1279
|
+
"stdDeviation",
|
|
1280
|
+
"tableValues",
|
|
1281
|
+
"viewBox",
|
|
1282
|
+
"gradientTransform",
|
|
1283
|
+
"pathLength",
|
|
1284
|
+
"startOffset",
|
|
1285
|
+
"textLength",
|
|
1286
|
+
"lengthAdjust"
|
|
1287
|
+
]);
|
|
1288
|
+
function Hi(t, e, n, i) {
|
|
1289
|
+
Vt(t, e, void 0, i);
|
|
1290
|
+
for (const s in e.attrs)
|
|
1291
|
+
t.setAttribute(Mt.has(s) ? s : Ze(s), e.attrs[s]);
|
|
1292
|
+
}
|
|
1293
|
+
class _i extends St {
|
|
1294
|
+
constructor() {
|
|
1295
|
+
super(...arguments), this.type = "svg", this.isSVGTag = !1, this.measureInstanceViewportBox = sn;
|
|
1296
|
+
}
|
|
1297
|
+
getBaseTargetFromProps(e, n) {
|
|
1298
|
+
return e[n];
|
|
1299
|
+
}
|
|
1300
|
+
readValueFromInstance(e, n) {
|
|
1301
|
+
if (Ae.has(n)) {
|
|
1302
|
+
const i = cn(n);
|
|
1303
|
+
return i && i.default || 0;
|
|
1304
|
+
}
|
|
1305
|
+
return n = Mt.has(n) ? n : Ze(n), e.getAttribute(n);
|
|
1306
|
+
}
|
|
1307
|
+
scrapeMotionValuesFromProps(e, n, i) {
|
|
1308
|
+
return rn(e, n, i);
|
|
1309
|
+
}
|
|
1310
|
+
build(e, n, i) {
|
|
1311
|
+
on(e, n, this.isSVGTag, i.transformTemplate, i.style);
|
|
1312
|
+
}
|
|
1313
|
+
renderInstance(e, n, i, s) {
|
|
1314
|
+
Hi(e, n, i, s);
|
|
1315
|
+
}
|
|
1316
|
+
mount(e) {
|
|
1317
|
+
this.isSVGTag = an(e.tagName), super.mount(e);
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
const Wi = Qe.length;
|
|
1321
|
+
function Ct(t) {
|
|
1322
|
+
if (!t)
|
|
1323
|
+
return;
|
|
1324
|
+
if (!t.isControllingVariants) {
|
|
1325
|
+
const n = t.parent ? Ct(t.parent) || {} : {};
|
|
1326
|
+
return t.props.initial !== void 0 && (n.initial = t.props.initial), n;
|
|
1327
|
+
}
|
|
1328
|
+
const e = {};
|
|
1329
|
+
for (let n = 0; n < Wi; n++) {
|
|
1330
|
+
const i = Qe[n], s = t.props[i];
|
|
1331
|
+
(Je(s) || s === !1) && (e[i] = s);
|
|
1332
|
+
}
|
|
1333
|
+
return e;
|
|
1334
|
+
}
|
|
1335
|
+
function Dt(t, e) {
|
|
1336
|
+
if (!Array.isArray(e))
|
|
1337
|
+
return !1;
|
|
1338
|
+
const n = e.length;
|
|
1339
|
+
if (n !== t.length)
|
|
1340
|
+
return !1;
|
|
1341
|
+
for (let i = 0; i < n; i++)
|
|
1342
|
+
if (e[i] !== t[i])
|
|
1343
|
+
return !1;
|
|
1344
|
+
return !0;
|
|
1345
|
+
}
|
|
1346
|
+
const Ui = [...tt].reverse(), $i = tt.length;
|
|
1347
|
+
function ji(t) {
|
|
1348
|
+
return (e) => Promise.all(e.map(({ animation: n, options: i }) => xi(t, n, i)));
|
|
1349
|
+
}
|
|
1350
|
+
function qi(t) {
|
|
1351
|
+
let e = ji(t), n = He(), i = !0, s = !1;
|
|
1352
|
+
const r = (l) => (c, f) => {
|
|
1353
|
+
const d = U(t, f, l === "exit" ? t.presenceContext?.custom : void 0);
|
|
1354
|
+
if (d) {
|
|
1355
|
+
const { transition: v, transitionEnd: h, ...p } = d;
|
|
1356
|
+
c = { ...c, ...p, ...h };
|
|
1357
|
+
}
|
|
1358
|
+
return c;
|
|
1359
|
+
};
|
|
1360
|
+
function a(l) {
|
|
1361
|
+
e = l(t);
|
|
1362
|
+
}
|
|
1363
|
+
function o(l) {
|
|
1364
|
+
const { props: c } = t, f = Ct(t.parent) || {}, d = [], v = /* @__PURE__ */ new Set();
|
|
1365
|
+
let h = {}, p = 1 / 0;
|
|
1366
|
+
for (let g = 0; g < $i; g++) {
|
|
1367
|
+
const T = Ui[g], A = n[T], w = c[T] !== void 0 ? c[T] : f[T], x = Je(w), V = T === l ? A.isActive : null;
|
|
1368
|
+
V === !1 && (p = g);
|
|
1369
|
+
let C = w === f[T] && w !== c[T] && x;
|
|
1370
|
+
if (C && (i || s) && t.manuallyAnimateOnMount && (C = !1), A.protectedKeys = { ...h }, // If it isn't active and hasn't *just* been set as inactive
|
|
1371
|
+
!A.isActive && V === null || // If we didn't and don't have any defined prop for this animation type
|
|
1372
|
+
!w && !A.prevProp || // Or if the prop doesn't define an animation
|
|
1373
|
+
et(w) || typeof w == "boolean")
|
|
1374
|
+
continue;
|
|
1375
|
+
if (T === "exit" && A.isActive && V !== !0) {
|
|
1376
|
+
A.prevResolvedValues && (h = {
|
|
1377
|
+
...h,
|
|
1378
|
+
...A.prevResolvedValues
|
|
1379
|
+
});
|
|
1380
|
+
continue;
|
|
1381
|
+
}
|
|
1382
|
+
const b = zi(A.prevProp, w);
|
|
1383
|
+
let D = b || // If we're making this variant active, we want to always make it active
|
|
1384
|
+
T === l && A.isActive && !C && x || // If we removed a higher-priority variant (i is in reverse order)
|
|
1385
|
+
g > p && x, y = !1;
|
|
1386
|
+
const M = Array.isArray(w) ? w : [w];
|
|
1387
|
+
let k = M.reduce(r(T), {});
|
|
1388
|
+
V === !1 && (k = {});
|
|
1389
|
+
const { prevResolvedValues: B = {} } = A, O = {
|
|
1390
|
+
...B,
|
|
1391
|
+
...k
|
|
1392
|
+
}, K = (P) => {
|
|
1393
|
+
D = !0, v.has(P) && (y = !0, v.delete(P)), A.needsAnimating[P] = !0;
|
|
1394
|
+
const I = t.getValue(P);
|
|
1395
|
+
I && (I.liveStyle = !1);
|
|
1396
|
+
};
|
|
1397
|
+
for (const P in O) {
|
|
1398
|
+
const I = k[P], G = B[P];
|
|
1399
|
+
if (h.hasOwnProperty(P))
|
|
1400
|
+
continue;
|
|
1401
|
+
let _ = !1;
|
|
1402
|
+
ye(I) && ye(G) ? _ = !Dt(I, G) || b : _ = I !== G, _ ? I != null ? K(P) : v.add(P) : I !== void 0 && v.has(P) ? K(P) : A.protectedKeys[P] = !0;
|
|
1403
|
+
}
|
|
1404
|
+
A.prevProp = w, A.prevResolvedValues = k, A.isActive && (h = { ...h, ...k }), (i || s) && t.blockInitialAnimation && (D = !1);
|
|
1405
|
+
const F = C && b;
|
|
1406
|
+
D && (!F || y) && d.push(...M.map((P) => {
|
|
1407
|
+
const I = { type: T };
|
|
1408
|
+
if (typeof P == "string" && (i || s) && !F && t.manuallyAnimateOnMount && t.parent) {
|
|
1409
|
+
const { parent: G } = t, _ = U(G, P);
|
|
1410
|
+
if (G.enteringChildren && _) {
|
|
1411
|
+
const { delayChildren: kt } = _.transition || {};
|
|
1412
|
+
I.delay = gt(G.enteringChildren, t, kt);
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
return {
|
|
1416
|
+
animation: P,
|
|
1417
|
+
options: I
|
|
1418
|
+
};
|
|
1419
|
+
}));
|
|
1420
|
+
}
|
|
1421
|
+
if (v.size) {
|
|
1422
|
+
const g = {};
|
|
1423
|
+
if (typeof c.initial != "boolean") {
|
|
1424
|
+
const T = U(t, Array.isArray(c.initial) ? c.initial[0] : c.initial);
|
|
1425
|
+
T && T.transition && (g.transition = T.transition);
|
|
1426
|
+
}
|
|
1427
|
+
v.forEach((T) => {
|
|
1428
|
+
const A = t.getBaseTarget(T), w = t.getValue(T);
|
|
1429
|
+
w && (w.liveStyle = !0), g[T] = A ?? null;
|
|
1430
|
+
}), d.push({ animation: g });
|
|
1431
|
+
}
|
|
1432
|
+
let m = !!d.length;
|
|
1433
|
+
return i && (c.initial === !1 || c.initial === c.animate) && !t.manuallyAnimateOnMount && (m = !1), i = !1, s = !1, m ? e(d) : Promise.resolve();
|
|
1434
|
+
}
|
|
1435
|
+
function u(l, c) {
|
|
1436
|
+
if (n[l].isActive === c)
|
|
1437
|
+
return Promise.resolve();
|
|
1438
|
+
t.variantChildren?.forEach((d) => d.animationState?.setActive(l, c)), n[l].isActive = c;
|
|
1439
|
+
const f = o(l);
|
|
1440
|
+
for (const d in n)
|
|
1441
|
+
n[d].protectedKeys = {};
|
|
1442
|
+
return f;
|
|
1443
|
+
}
|
|
1444
|
+
return {
|
|
1445
|
+
animateChanges: o,
|
|
1446
|
+
setActive: u,
|
|
1447
|
+
setAnimateFunction: a,
|
|
1448
|
+
getState: () => n,
|
|
1449
|
+
reset: () => {
|
|
1450
|
+
n = He(), s = !0;
|
|
1451
|
+
}
|
|
1452
|
+
};
|
|
1453
|
+
}
|
|
1454
|
+
function zi(t, e) {
|
|
1455
|
+
return typeof e == "string" ? e !== t : Array.isArray(e) ? !Dt(e, t) : !1;
|
|
1456
|
+
}
|
|
1457
|
+
function N(t = !1) {
|
|
1458
|
+
return {
|
|
1459
|
+
isActive: t,
|
|
1460
|
+
protectedKeys: {},
|
|
1461
|
+
needsAnimating: {},
|
|
1462
|
+
prevResolvedValues: {}
|
|
1463
|
+
};
|
|
1464
|
+
}
|
|
1465
|
+
function He() {
|
|
1466
|
+
return {
|
|
1467
|
+
animate: N(!0),
|
|
1468
|
+
whileInView: N(),
|
|
1469
|
+
whileHover: N(),
|
|
1470
|
+
whileTap: N(),
|
|
1471
|
+
whileDrag: N(),
|
|
1472
|
+
whileFocus: N(),
|
|
1473
|
+
exit: N()
|
|
1474
|
+
};
|
|
1475
|
+
}
|
|
1476
|
+
function _e(t, e, n, i = { passive: !0 }) {
|
|
1477
|
+
return t.addEventListener(e, n, i), () => t.removeEventListener(e, n, i);
|
|
1478
|
+
}
|
|
1479
|
+
const Xi = (t, e) => e.isSVG ?? ln(t) ? new _i(e) : new Ni(e, {
|
|
1480
|
+
allowProjection: t !== un
|
|
1481
|
+
});
|
|
1482
|
+
class Yi extends q {
|
|
1483
|
+
/**
|
|
1484
|
+
* We dynamically generate the AnimationState manager as it contains a reference
|
|
1485
|
+
* to the underlying animation library. We only want to load that if we load this,
|
|
1486
|
+
* so people can optionally code split it out using the `m` component.
|
|
1487
|
+
*/
|
|
1488
|
+
constructor(e) {
|
|
1489
|
+
super(e), e.animationState || (e.animationState = qi(e));
|
|
1490
|
+
}
|
|
1491
|
+
updateAnimationControlsSubscription() {
|
|
1492
|
+
const { animate: e } = this.node.getProps();
|
|
1493
|
+
et(e) && (this.unmountControls = e.subscribe(this.node));
|
|
1494
|
+
}
|
|
1495
|
+
/**
|
|
1496
|
+
* Subscribe any provided AnimationControls to the component's VisualElement
|
|
1497
|
+
*/
|
|
1498
|
+
mount() {
|
|
1499
|
+
this.updateAnimationControlsSubscription();
|
|
1500
|
+
}
|
|
1501
|
+
update() {
|
|
1502
|
+
const { animate: e } = this.node.getProps(), { animate: n } = this.node.prevProps || {};
|
|
1503
|
+
e !== n && this.updateAnimationControlsSubscription();
|
|
1504
|
+
}
|
|
1505
|
+
unmount() {
|
|
1506
|
+
this.node.animationState.reset(), this.unmountControls?.();
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
let Zi = 0;
|
|
1510
|
+
class Ji extends q {
|
|
1511
|
+
constructor() {
|
|
1512
|
+
super(...arguments), this.id = Zi++;
|
|
1513
|
+
}
|
|
1514
|
+
update() {
|
|
1515
|
+
if (!this.node.presenceContext)
|
|
1516
|
+
return;
|
|
1517
|
+
const { isPresent: e, onExitComplete: n } = this.node.presenceContext, { isPresent: i } = this.node.prevPresenceContext || {};
|
|
1518
|
+
if (!this.node.animationState || e === i)
|
|
1519
|
+
return;
|
|
1520
|
+
const s = this.node.animationState.setActive("exit", !e);
|
|
1521
|
+
n && !e && s.then(() => {
|
|
1522
|
+
n(this.id);
|
|
1523
|
+
});
|
|
1524
|
+
}
|
|
1525
|
+
mount() {
|
|
1526
|
+
const { register: e, onExitComplete: n } = this.node.presenceContext || {};
|
|
1527
|
+
n && n(this.id), e && (this.unmount = e(this.id));
|
|
1528
|
+
}
|
|
1529
|
+
unmount() {
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
const Qi = {
|
|
1533
|
+
animation: {
|
|
1534
|
+
Feature: Yi
|
|
1535
|
+
},
|
|
1536
|
+
exit: {
|
|
1537
|
+
Feature: Ji
|
|
1538
|
+
}
|
|
1539
|
+
};
|
|
1540
|
+
function Pt(t) {
|
|
1541
|
+
return {
|
|
1542
|
+
point: {
|
|
1543
|
+
x: t.pageX,
|
|
1544
|
+
y: t.pageY
|
|
1545
|
+
}
|
|
1546
|
+
};
|
|
1547
|
+
}
|
|
1548
|
+
function We(t, e, n) {
|
|
1549
|
+
const { props: i } = t;
|
|
1550
|
+
t.animationState && i.whileHover && t.animationState.setActive("whileHover", n === "Start");
|
|
1551
|
+
const s = "onHover" + n, r = i[s];
|
|
1552
|
+
r && H.postRender(() => r(e, Pt(e)));
|
|
1553
|
+
}
|
|
1554
|
+
class es extends q {
|
|
1555
|
+
mount() {
|
|
1556
|
+
const { current: e } = this.node;
|
|
1557
|
+
e && (this.unmount = ki(e, (n, i) => (We(this.node, i, "Start"), (s) => We(this.node, s, "End"))));
|
|
1558
|
+
}
|
|
1559
|
+
unmount() {
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
class ts extends q {
|
|
1563
|
+
constructor() {
|
|
1564
|
+
super(...arguments), this.isActive = !1;
|
|
1565
|
+
}
|
|
1566
|
+
onFocus() {
|
|
1567
|
+
let e = !1;
|
|
1568
|
+
try {
|
|
1569
|
+
e = this.node.current.matches(":focus-visible");
|
|
1570
|
+
} catch {
|
|
1571
|
+
e = !0;
|
|
1572
|
+
}
|
|
1573
|
+
!e || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !0), this.isActive = !0);
|
|
1574
|
+
}
|
|
1575
|
+
onBlur() {
|
|
1576
|
+
!this.isActive || !this.node.animationState || (this.node.animationState.setActive("whileFocus", !1), this.isActive = !1);
|
|
1577
|
+
}
|
|
1578
|
+
mount() {
|
|
1579
|
+
this.unmount = re(_e(this.node.current, "focus", () => this.onFocus()), _e(this.node.current, "blur", () => this.onBlur()));
|
|
1580
|
+
}
|
|
1581
|
+
unmount() {
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
function Ue(t, e, n) {
|
|
1585
|
+
const { props: i } = t;
|
|
1586
|
+
if (t.current instanceof HTMLButtonElement && t.current.disabled)
|
|
1587
|
+
return;
|
|
1588
|
+
t.animationState && i.whileTap && t.animationState.setActive("whileTap", n === "Start");
|
|
1589
|
+
const s = "onTap" + (n === "End" ? "" : n), r = i[s];
|
|
1590
|
+
r && H.postRender(() => r(e, Pt(e)));
|
|
1591
|
+
}
|
|
1592
|
+
class ns extends q {
|
|
1593
|
+
mount() {
|
|
1594
|
+
const { current: e } = this.node;
|
|
1595
|
+
e && (this.unmount = Ki(e, (n, i) => (Ue(this.node, i, "Start"), (s, { success: r }) => Ue(this.node, s, r ? "End" : "Cancel")), { useGlobalTarget: this.node.props.globalTapTarget }));
|
|
1596
|
+
}
|
|
1597
|
+
unmount() {
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
const be = /* @__PURE__ */ new WeakMap(), fe = /* @__PURE__ */ new WeakMap(), is = (t) => {
|
|
1601
|
+
const e = be.get(t.target);
|
|
1602
|
+
e && e(t);
|
|
1603
|
+
}, ss = (t) => {
|
|
1604
|
+
t.forEach(is);
|
|
1605
|
+
};
|
|
1606
|
+
function rs({ root: t, ...e }) {
|
|
1607
|
+
const n = t || document;
|
|
1608
|
+
fe.has(n) || fe.set(n, {});
|
|
1609
|
+
const i = fe.get(n), s = JSON.stringify(e);
|
|
1610
|
+
return i[s] || (i[s] = new IntersectionObserver(ss, { root: t, ...e })), i[s];
|
|
1611
|
+
}
|
|
1612
|
+
function os(t, e, n) {
|
|
1613
|
+
const i = rs(e);
|
|
1614
|
+
return be.set(t, n), i.observe(t), () => {
|
|
1615
|
+
be.delete(t), i.unobserve(t);
|
|
1616
|
+
};
|
|
1617
|
+
}
|
|
1618
|
+
const as = {
|
|
1619
|
+
some: 0,
|
|
1620
|
+
all: 1
|
|
1621
|
+
};
|
|
1622
|
+
class cs extends q {
|
|
1623
|
+
constructor() {
|
|
1624
|
+
super(...arguments), this.hasEnteredView = !1, this.isInView = !1;
|
|
1625
|
+
}
|
|
1626
|
+
startObserver() {
|
|
1627
|
+
this.unmount();
|
|
1628
|
+
const { viewport: e = {} } = this.node.getProps(), { root: n, margin: i, amount: s = "some", once: r } = e, a = {
|
|
1629
|
+
root: n ? n.current : void 0,
|
|
1630
|
+
rootMargin: i,
|
|
1631
|
+
threshold: typeof s == "number" ? s : as[s]
|
|
1632
|
+
}, o = (u) => {
|
|
1633
|
+
const { isIntersecting: l } = u;
|
|
1634
|
+
if (this.isInView === l || (this.isInView = l, r && !l && this.hasEnteredView))
|
|
1635
|
+
return;
|
|
1636
|
+
l && (this.hasEnteredView = !0), this.node.animationState && this.node.animationState.setActive("whileInView", l);
|
|
1637
|
+
const { onViewportEnter: c, onViewportLeave: f } = this.node.getProps(), d = l ? c : f;
|
|
1638
|
+
d && d(u);
|
|
1639
|
+
};
|
|
1640
|
+
return os(this.node.current, a, o);
|
|
1641
|
+
}
|
|
1642
|
+
mount() {
|
|
1643
|
+
this.startObserver();
|
|
1644
|
+
}
|
|
1645
|
+
update() {
|
|
1646
|
+
if (typeof IntersectionObserver > "u")
|
|
1647
|
+
return;
|
|
1648
|
+
const { props: e, prevProps: n } = this.node;
|
|
1649
|
+
["amount", "margin", "root"].some(ls(e, n)) && this.startObserver();
|
|
1650
|
+
}
|
|
1651
|
+
unmount() {
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
function ls({ viewport: t = {} }, { viewport: e = {} } = {}) {
|
|
1655
|
+
return (n) => t[n] !== e[n];
|
|
1656
|
+
}
|
|
1657
|
+
const us = {
|
|
1658
|
+
inView: {
|
|
1659
|
+
Feature: cs
|
|
1660
|
+
},
|
|
1661
|
+
tap: {
|
|
1662
|
+
Feature: ns
|
|
1663
|
+
},
|
|
1664
|
+
focus: {
|
|
1665
|
+
Feature: ts
|
|
1666
|
+
},
|
|
1667
|
+
hover: {
|
|
1668
|
+
Feature: es
|
|
1669
|
+
}
|
|
1670
|
+
}, fs = {
|
|
1671
|
+
renderer: Xi,
|
|
1672
|
+
...Qi,
|
|
1673
|
+
...us
|
|
1674
|
+
};
|
|
1675
|
+
var ps = fs;
|
|
1676
|
+
export {
|
|
1677
|
+
ps as default
|
|
1678
|
+
};
|