@wix/interact 2.2.2 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +322 -246
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/react.js +1 -1
- package/dist/cjs/web.js +1 -1
- package/dist/es/index.js +1 -1
- package/dist/es/react.js +2 -2
- package/dist/es/web.js +2 -2
- package/dist/index-C6u4q815.mjs +3291 -0
- package/dist/index-C6u4q815.mjs.map +1 -0
- package/dist/index-Qg46rn0Y.js +21 -0
- package/dist/index-Qg46rn0Y.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/core/add.d.ts.map +1 -1
- package/dist/types/core/css.d.ts +17 -2
- package/dist/types/core/css.d.ts.map +1 -1
- package/dist/types/core/cssUtils.d.ts +8 -0
- package/dist/types/core/cssUtils.d.ts.map +1 -0
- package/dist/types/core/resolvers.d.ts +4 -0
- package/dist/types/core/resolvers.d.ts.map +1 -0
- package/dist/types/core/utilities.d.ts +6 -0
- package/dist/types/core/utilities.d.ts.map +1 -1
- package/dist/types/handlers/animationEnd.d.ts +1 -1
- package/dist/types/handlers/animationEnd.d.ts.map +1 -1
- package/dist/types/handlers/viewProgress.d.ts.map +1 -1
- package/dist/types/types/config.d.ts +23 -2
- package/dist/types/types/config.d.ts.map +1 -1
- package/dist/types/types/css.d.ts +26 -0
- package/dist/types/types/css.d.ts.map +1 -0
- package/dist/types/types/effects.d.ts +12 -0
- package/dist/types/types/effects.d.ts.map +1 -1
- package/dist/types/types/external.d.ts +3 -3
- package/dist/types/types/external.d.ts.map +1 -1
- package/dist/types/types/handlers.d.ts +2 -1
- package/dist/types/types/handlers.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/types/internal.d.ts +1 -1
- package/dist/types/types/internal.d.ts.map +1 -1
- package/dist/types/utils.d.ts +11 -2
- package/dist/types/utils.d.ts.map +1 -1
- package/docs/README.md +1 -1
- package/docs/api/README.md +4 -4
- package/docs/api/functions.md +157 -42
- package/docs/examples/entrance-animations.md +7 -5
- package/docs/guides/getting-started.md +1 -1
- package/docs/integration/react.md +8 -8
- package/package.json +6 -3
- package/rules/full-lean.md +24 -15
- package/rules/integration.md +23 -17
- package/rules/viewenter.md +4 -2
- package/rules/viewprogress.md +52 -0
- package/dist/index-A2Q0e94t.js +0 -18
- package/dist/index-A2Q0e94t.js.map +0 -1
- package/dist/index-HeFaJMEX.mjs +0 -2839
- package/dist/index-HeFaJMEX.mjs.map +0 -1
|
@@ -0,0 +1,3291 @@
|
|
|
1
|
+
function vt(t) {
|
|
2
|
+
return [...t.matchAll(/\[([-\w]+)]/g)].map(([e, n]) => n);
|
|
3
|
+
}
|
|
4
|
+
function $(t, e) {
|
|
5
|
+
const n = vt(e);
|
|
6
|
+
let s = 0;
|
|
7
|
+
return n.length ? t.replace(/\[]/g, () => {
|
|
8
|
+
const i = n[s++];
|
|
9
|
+
return i !== void 0 ? `[${i}]` : "[]";
|
|
10
|
+
}) : t;
|
|
11
|
+
}
|
|
12
|
+
function yt(t, e) {
|
|
13
|
+
return t.trigger === "viewEnter" && e.triggerType === "once" && G(t) === G(e);
|
|
14
|
+
}
|
|
15
|
+
function G(t) {
|
|
16
|
+
const { key: e, listContainer: n, listItemSelector: s, selector: i } = t;
|
|
17
|
+
return `${e}\0${n || ""}\0${s || ""}\0${i || ""}`;
|
|
18
|
+
}
|
|
19
|
+
function He(t) {
|
|
20
|
+
let e = 0, n = 0;
|
|
21
|
+
for (let s = 0; s < t.length; s++) {
|
|
22
|
+
const i = t.charCodeAt(s);
|
|
23
|
+
e = (e << 5) - e + i | 0, n = n << 3 ^ n >>> 2 ^ i | 0;
|
|
24
|
+
}
|
|
25
|
+
return ((e >>> 0) * 1048576 + (n >>> 0) % 1048576).toString(36);
|
|
26
|
+
}
|
|
27
|
+
class V {
|
|
28
|
+
animations;
|
|
29
|
+
options;
|
|
30
|
+
ready;
|
|
31
|
+
isCSS;
|
|
32
|
+
longestAnimation;
|
|
33
|
+
constructor(e, n) {
|
|
34
|
+
this.animations = e, this.options = n, this.ready = n?.measured || Promise.resolve(), this.isCSS = e[0] instanceof CSSAnimation, this.longestAnimation = this._getAnimationWithLongestEndTime();
|
|
35
|
+
}
|
|
36
|
+
_getAnimationWithLongestEndTime() {
|
|
37
|
+
return this.animations.reduce((e, n) => {
|
|
38
|
+
const s = e.effect?.getComputedTiming().endTime ?? 0, i = n.effect?.getComputedTiming().endTime ?? 0;
|
|
39
|
+
return s > i ? e : n;
|
|
40
|
+
}, this.animations[0]);
|
|
41
|
+
}
|
|
42
|
+
getProgress() {
|
|
43
|
+
return this.longestAnimation?.effect?.getComputedTiming().progress || 0;
|
|
44
|
+
}
|
|
45
|
+
async play(e) {
|
|
46
|
+
await this.ready;
|
|
47
|
+
for (const n of this.animations)
|
|
48
|
+
n.play();
|
|
49
|
+
await Promise.all(this.animations.map((n) => n.ready)), e && e();
|
|
50
|
+
}
|
|
51
|
+
pause() {
|
|
52
|
+
for (const e of this.animations)
|
|
53
|
+
e.pause();
|
|
54
|
+
}
|
|
55
|
+
async reverse(e) {
|
|
56
|
+
await this.ready;
|
|
57
|
+
for (const n of this.animations)
|
|
58
|
+
n.reverse();
|
|
59
|
+
await Promise.all(this.animations.map((n) => n.ready)), e && e();
|
|
60
|
+
}
|
|
61
|
+
progress(e) {
|
|
62
|
+
for (const n of this.animations) {
|
|
63
|
+
const { delay: s, duration: i, iterations: r } = n.effect.getTiming(), o = (Number.isFinite(i) ? i : 0) * (Number.isFinite(r) ? r : 1);
|
|
64
|
+
n.currentTime = ((s || 0) + o) * e;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
cancel() {
|
|
68
|
+
for (const e of this.animations)
|
|
69
|
+
e.cancel();
|
|
70
|
+
}
|
|
71
|
+
setPlaybackRate(e) {
|
|
72
|
+
for (const n of this.animations)
|
|
73
|
+
n.playbackRate = e;
|
|
74
|
+
}
|
|
75
|
+
async onFinish(e) {
|
|
76
|
+
try {
|
|
77
|
+
await Promise.all(this.animations.map((s) => s.finished));
|
|
78
|
+
const n = this.animations[0];
|
|
79
|
+
if (n && !this.isCSS) {
|
|
80
|
+
const s = n.effect?.target;
|
|
81
|
+
if (s) {
|
|
82
|
+
const i = this.options?.effectId || n.id, r = new CustomEvent("animationend", { detail: { effectId: i } });
|
|
83
|
+
s.dispatchEvent(r);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
e();
|
|
87
|
+
} catch (n) {
|
|
88
|
+
console.warn("animation was interrupted - aborting onFinish callback - ", n);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
async onAbort(e) {
|
|
92
|
+
try {
|
|
93
|
+
await Promise.all(this.animations.map((n) => n.finished));
|
|
94
|
+
} catch (n) {
|
|
95
|
+
if (n.name === "AbortError") {
|
|
96
|
+
const s = this.animations[0];
|
|
97
|
+
if (s && !this.isCSS) {
|
|
98
|
+
const i = s.effect?.target;
|
|
99
|
+
if (i) {
|
|
100
|
+
const r = new Event("animationcancel");
|
|
101
|
+
i.dispatchEvent(r);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
e();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
get finished() {
|
|
109
|
+
return Promise.all(this.animations.map((e) => e.finished));
|
|
110
|
+
}
|
|
111
|
+
get playState() {
|
|
112
|
+
return this.animations.some((e) => e.playState === "running") ? "running" : this.animations[0]?.playState;
|
|
113
|
+
}
|
|
114
|
+
hasAnimationName(e) {
|
|
115
|
+
return this.animations.some((n) => n.animationName === e);
|
|
116
|
+
}
|
|
117
|
+
hasAnimationId(e) {
|
|
118
|
+
return this.animations.some((n) => n.id === e);
|
|
119
|
+
}
|
|
120
|
+
getTimingOptions() {
|
|
121
|
+
return this.animations.map((e) => {
|
|
122
|
+
const n = e.effect?.getTiming(), s = n?.delay ?? 0, i = Number(n?.duration) || 0, r = n?.iterations ?? 1;
|
|
123
|
+
return {
|
|
124
|
+
delay: s,
|
|
125
|
+
duration: i,
|
|
126
|
+
iterations: r
|
|
127
|
+
};
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
const je = (t) => t, Et = (t) => 1 - Math.cos(t * Math.PI / 2), wt = (t) => Math.sin(t * Math.PI / 2), bt = (t) => -(Math.cos(Math.PI * t) - 1) / 2, St = (t) => t ** 2, Tt = (t) => 1 - (1 - t) ** 2, It = (t) => t < 0.5 ? 2 * t ** 2 : 1 - (-2 * t + 2) ** 2 / 2, Ot = (t) => t ** 3, At = (t) => 1 - (1 - t) ** 3, Ct = (t) => t < 0.5 ? 4 * t ** 3 : 1 - (-2 * t + 2) ** 3 / 2, kt = (t) => t ** 4, $t = (t) => 1 - (1 - t) ** 4, _t = (t) => t < 0.5 ? 8 * t ** 4 : 1 - (-2 * t + 2) ** 4 / 2, qt = (t) => t ** 5, Mt = (t) => 1 - (1 - t) ** 5, xt = (t) => t < 0.5 ? 16 * t ** 5 : 1 - (-2 * t + 2) ** 5 / 2, Pt = (t) => t === 0 ? 0 : 2 ** (10 * t - 10), Lt = (t) => t === 1 ? 1 : 1 - 2 ** (-10 * t), Rt = (t) => t === 0 ? 0 : t === 1 ? 1 : t < 0.5 ? 2 ** (20 * t - 10) / 2 : (2 - 2 ** (-20 * t + 10)) / 2, Ft = (t) => 1 - Math.sqrt(1 - t ** 2), Nt = (t) => Math.sqrt(1 - (t - 1) ** 2), zt = (t) => t < 0.5 ? (1 - Math.sqrt(1 - 4 * t ** 2)) / 2 : (Math.sqrt(-(2 * t - 3) * (2 * t - 1)) + 1) / 2, Ht = (t) => 2.70158 * t ** 3 - 1.70158 * t ** 2, jt = (t) => 1 + 2.70158 * (t - 1) ** 3 + 1.70158 * (t - 1) ** 2, Dt = (t, e = 1.70158 * 1.525) => t < 0.5 ? (2 * t) ** 2 * ((e + 1) * 2 * t - e) / 2 : ((2 * t - 2) ** 2 * ((e + 1) * (t * 2 - 2) + e) + 2) / 2, Te = {
|
|
132
|
+
linear: je,
|
|
133
|
+
sineIn: Et,
|
|
134
|
+
sineOut: wt,
|
|
135
|
+
sineInOut: bt,
|
|
136
|
+
quadIn: St,
|
|
137
|
+
quadOut: Tt,
|
|
138
|
+
quadInOut: It,
|
|
139
|
+
cubicIn: Ot,
|
|
140
|
+
cubicOut: At,
|
|
141
|
+
cubicInOut: Ct,
|
|
142
|
+
quartIn: kt,
|
|
143
|
+
quartOut: $t,
|
|
144
|
+
quartInOut: _t,
|
|
145
|
+
quintIn: qt,
|
|
146
|
+
quintOut: Mt,
|
|
147
|
+
quintInOut: xt,
|
|
148
|
+
expoIn: Pt,
|
|
149
|
+
expoOut: Lt,
|
|
150
|
+
expoInOut: Rt,
|
|
151
|
+
circIn: Ft,
|
|
152
|
+
circOut: Nt,
|
|
153
|
+
circInOut: zt,
|
|
154
|
+
backIn: Ht,
|
|
155
|
+
backOut: jt,
|
|
156
|
+
backInOut: Dt
|
|
157
|
+
}, Ie = {
|
|
158
|
+
linear: "linear",
|
|
159
|
+
ease: "ease",
|
|
160
|
+
easeIn: "ease-in",
|
|
161
|
+
easeOut: "ease-out",
|
|
162
|
+
easeInOut: "ease-in-out",
|
|
163
|
+
sineIn: "cubic-bezier(0.47, 0, 0.745, 0.715)",
|
|
164
|
+
sineOut: "cubic-bezier(0.39, 0.575, 0.565, 1)",
|
|
165
|
+
sineInOut: "cubic-bezier(0.445, 0.05, 0.55, 0.95)",
|
|
166
|
+
quadIn: "cubic-bezier(0.55, 0.085, 0.68, 0.53)",
|
|
167
|
+
quadOut: "cubic-bezier(0.25, 0.46, 0.45, 0.94)",
|
|
168
|
+
quadInOut: "cubic-bezier(0.455, 0.03, 0.515, 0.955)",
|
|
169
|
+
cubicIn: "cubic-bezier(0.55, 0.055, 0.675, 0.19)",
|
|
170
|
+
cubicOut: "cubic-bezier(0.215, 0.61, 0.355, 1)",
|
|
171
|
+
cubicInOut: "cubic-bezier(0.645, 0.045, 0.355, 1)",
|
|
172
|
+
quartIn: "cubic-bezier(0.895, 0.03, 0.685, 0.22)",
|
|
173
|
+
quartOut: "cubic-bezier(0.165, 0.84, 0.44, 1)",
|
|
174
|
+
quartInOut: "cubic-bezier(0.77, 0, 0.175, 1)",
|
|
175
|
+
quintIn: "cubic-bezier(0.755, 0.05, 0.855, 0.06)",
|
|
176
|
+
quintOut: "cubic-bezier(0.23, 1, 0.32, 1)",
|
|
177
|
+
quintInOut: "cubic-bezier(0.86, 0, 0.07, 1)",
|
|
178
|
+
expoIn: "cubic-bezier(0.95, 0.05, 0.795, 0.035)",
|
|
179
|
+
expoOut: "cubic-bezier(0.19, 1, 0.22, 1)",
|
|
180
|
+
expoInOut: "cubic-bezier(1, 0, 0, 1)",
|
|
181
|
+
circIn: "cubic-bezier(0.6, 0.04, 0.98, 0.335)",
|
|
182
|
+
circOut: "cubic-bezier(0.075, 0.82, 0.165, 1)",
|
|
183
|
+
circInOut: "cubic-bezier(0.785, 0.135, 0.15, 0.86)",
|
|
184
|
+
backIn: "cubic-bezier(0.6, -0.28, 0.735, 0.045)",
|
|
185
|
+
backOut: "cubic-bezier(0.175, 0.885, 0.32, 1.275)",
|
|
186
|
+
backInOut: "cubic-bezier(0.68, -0.55, 0.265, 1.55)"
|
|
187
|
+
};
|
|
188
|
+
function Gt(t) {
|
|
189
|
+
return t === "percentage" ? "%" : t || "px";
|
|
190
|
+
}
|
|
191
|
+
function J(t) {
|
|
192
|
+
return t ? Ie[t] || t : Ie.linear;
|
|
193
|
+
}
|
|
194
|
+
function Wt(t, e, n, s) {
|
|
195
|
+
const i = 3 * t, r = 3 * (n - t) - i, o = 1 - i - r, a = 3 * e, c = 3 * (s - e) - a, l = 1 - a - c, f = (p) => ((o * p + r) * p + i) * p, u = (p) => ((l * p + c) * p + a) * p, d = (p) => (3 * o * p + 2 * r) * p + i;
|
|
196
|
+
function g(p) {
|
|
197
|
+
let m = p;
|
|
198
|
+
for (let y = 0; y < 8; y++) {
|
|
199
|
+
const E = f(m) - p;
|
|
200
|
+
if (Math.abs(E) < 1e-7) return m;
|
|
201
|
+
const w = d(m);
|
|
202
|
+
if (Math.abs(w) < 1e-6) break;
|
|
203
|
+
m -= E / w;
|
|
204
|
+
}
|
|
205
|
+
let h = 0, v = 1;
|
|
206
|
+
for (m = (h + v) / 2; v - h > 1e-7; ) {
|
|
207
|
+
const y = f(m);
|
|
208
|
+
if (Math.abs(y - p) < 1e-7) return m;
|
|
209
|
+
p > y ? h = m : v = m, m = (h + v) / 2;
|
|
210
|
+
}
|
|
211
|
+
return m;
|
|
212
|
+
}
|
|
213
|
+
return (p) => p <= 0 ? 0 : p >= 1 ? 1 : u(g(p));
|
|
214
|
+
}
|
|
215
|
+
function Vt(t) {
|
|
216
|
+
const e = t.match(
|
|
217
|
+
/^cubic-bezier\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*\)$/
|
|
218
|
+
);
|
|
219
|
+
if (!e) return;
|
|
220
|
+
const n = parseFloat(e[1]), s = parseFloat(e[2]), i = parseFloat(e[3]), r = parseFloat(e[4]);
|
|
221
|
+
if (![n, s, i, r].some(isNaN))
|
|
222
|
+
return Wt(n, s, i, r);
|
|
223
|
+
}
|
|
224
|
+
function Yt(t) {
|
|
225
|
+
const e = t.match(/^linear\((.+)\)$/);
|
|
226
|
+
if (!e) return;
|
|
227
|
+
const n = e[1].split(",").map((o) => o.trim()).filter(Boolean);
|
|
228
|
+
if (n.length === 0) return;
|
|
229
|
+
const s = [];
|
|
230
|
+
for (const o of n) {
|
|
231
|
+
const a = o.split(/\s+/), c = parseFloat(a[0]);
|
|
232
|
+
if (isNaN(c)) return;
|
|
233
|
+
const l = [];
|
|
234
|
+
for (let f = 1; f < a.length; f++)
|
|
235
|
+
if (a[f].endsWith("%")) {
|
|
236
|
+
const u = parseFloat(a[f]) / 100;
|
|
237
|
+
if (isNaN(u)) return;
|
|
238
|
+
l.push(u);
|
|
239
|
+
}
|
|
240
|
+
l.length === 0 ? s.push({ output: c, pos: null }) : l.length === 1 ? s.push({ output: c, pos: l[0] }) : (s.push({ output: c, pos: l[0] }), s.push({ output: c, pos: l[1] }));
|
|
241
|
+
}
|
|
242
|
+
if (s.length === 0) return;
|
|
243
|
+
s[0].pos === null && (s[0].pos = 0), s[s.length - 1].pos === null && (s[s.length - 1].pos = 1);
|
|
244
|
+
let i = 0;
|
|
245
|
+
for (; i < s.length; )
|
|
246
|
+
if (s[i].pos === null) {
|
|
247
|
+
const o = i - 1;
|
|
248
|
+
let a = i;
|
|
249
|
+
for (; a < s.length && s[a].pos === null; ) a++;
|
|
250
|
+
const c = s[o].pos, l = s[a].pos, f = a - o;
|
|
251
|
+
for (let u = o + 1; u < a; u++)
|
|
252
|
+
s[u].pos = c + (l - c) * (u - o) / f;
|
|
253
|
+
i = a + 1;
|
|
254
|
+
} else
|
|
255
|
+
i++;
|
|
256
|
+
for (let o = 1; o < s.length; o++)
|
|
257
|
+
s[o].pos < s[o - 1].pos && (s[o].pos = s[o - 1].pos);
|
|
258
|
+
const r = s;
|
|
259
|
+
return (o) => {
|
|
260
|
+
if (o <= r[0].pos) return r[0].output;
|
|
261
|
+
const a = r[r.length - 1];
|
|
262
|
+
if (o >= a.pos) return a.output;
|
|
263
|
+
let c = 0, l = r.length - 1;
|
|
264
|
+
for (; c < l - 1; ) {
|
|
265
|
+
const d = c + l >>> 1;
|
|
266
|
+
r[d].pos <= o ? c = d : l = d;
|
|
267
|
+
}
|
|
268
|
+
const f = r[c], u = r[l];
|
|
269
|
+
return u.pos === f.pos ? u.output : f.output + (u.output - f.output) * (o - f.pos) / (u.pos - f.pos);
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
function be(t) {
|
|
273
|
+
if (!t) return;
|
|
274
|
+
const e = Te[t];
|
|
275
|
+
return e || (Vt(t) ?? Yt(t) ?? Te.linear);
|
|
276
|
+
}
|
|
277
|
+
class Bt extends V {
|
|
278
|
+
animationGroups;
|
|
279
|
+
delay;
|
|
280
|
+
offset;
|
|
281
|
+
offsetEasing;
|
|
282
|
+
timingOptions;
|
|
283
|
+
constructor(e, n = {}) {
|
|
284
|
+
const s = e.flatMap((i) => [...i.animations]);
|
|
285
|
+
super(s), this.animationGroups = e, this.delay = n.delay ?? 0, this.offset = n.offset ?? 0, this.offsetEasing = typeof n.offsetEasing == "function" ? n.offsetEasing : be(n.offsetEasing) ?? je, this.timingOptions = this.animationGroups.map((i) => i.getTimingOptions().map(({ delay: r, duration: o, iterations: a }) => ({
|
|
286
|
+
delay: r,
|
|
287
|
+
duration: Number.isFinite(o) ? o : 0,
|
|
288
|
+
iterations: Number.isFinite(a) ? a : 1
|
|
289
|
+
}))), this.applyOffsets(), this.ready = Promise.all(e.map((i) => i.ready)).then(() => {
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Calculates stagger delay offsets for each animation group using the formula:
|
|
294
|
+
* easing(i / last) * last * offset
|
|
295
|
+
* where i is the group index and last is the index of the final group.
|
|
296
|
+
*/
|
|
297
|
+
calculateOffsets() {
|
|
298
|
+
const e = this.animationGroups.length;
|
|
299
|
+
if (e <= 1) return [0];
|
|
300
|
+
const n = e - 1;
|
|
301
|
+
return Array.from(
|
|
302
|
+
{ length: e },
|
|
303
|
+
(s, i) => this.offsetEasing(i / n) * n * this.offset | 0
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
applyOffsets() {
|
|
307
|
+
if (this.animationGroups.length === 0 || this.animations.length === 0) return;
|
|
308
|
+
const e = this.calculateOffsets(), n = this.getSequenceActiveDuration(e);
|
|
309
|
+
this.animationGroups.forEach((s, i) => {
|
|
310
|
+
s.animations.forEach((r, o) => {
|
|
311
|
+
const a = r.effect;
|
|
312
|
+
if (!a) return;
|
|
313
|
+
const { delay: c, duration: l, iterations: f } = this.timingOptions[i][o], u = c + e[i], d = n - (u + l * f);
|
|
314
|
+
a.updateTiming({ delay: u + this.delay, endDelay: d });
|
|
315
|
+
});
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
getSequenceActiveDuration(e) {
|
|
319
|
+
const n = [];
|
|
320
|
+
for (let s = 0; s < this.timingOptions.length; s++) {
|
|
321
|
+
const i = this.timingOptions[s].reduce((r, o) => {
|
|
322
|
+
if (!o) return r;
|
|
323
|
+
const { delay: a, duration: c, iterations: l } = o;
|
|
324
|
+
return Math.max(r, a + c * l);
|
|
325
|
+
}, 0);
|
|
326
|
+
n.push(e[s] + i);
|
|
327
|
+
}
|
|
328
|
+
return Math.max(...n);
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Inserts new AnimationGroups at specified indices, then recalculates
|
|
332
|
+
* stagger offsets for all groups. Each entry specifies the target index
|
|
333
|
+
* in the animationGroups array where the group should be inserted.
|
|
334
|
+
*/
|
|
335
|
+
addGroups(e) {
|
|
336
|
+
if (e.length === 0) return;
|
|
337
|
+
const n = [...e].sort((s, i) => i.index - s.index);
|
|
338
|
+
for (const { index: s, group: i } of n) {
|
|
339
|
+
const r = Math.min(s, this.animationGroups.length);
|
|
340
|
+
this.animationGroups.splice(r, 0, i), this.timingOptions.splice(r, 0, i.getTimingOptions());
|
|
341
|
+
const o = [...i.animations], a = this.animationGroups.slice(0, r).reduce((c, l) => c + l.animations.length, 0);
|
|
342
|
+
this.animations.splice(a, 0, ...o);
|
|
343
|
+
}
|
|
344
|
+
this.applyOffsets(), this.ready = Promise.all(this.animationGroups.map((s) => s.ready)).then(() => {
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Removes AnimationGroups that match the predicate, then recalculates
|
|
349
|
+
* stagger offsets for remaining groups. Cancelled animations in removed
|
|
350
|
+
* groups are returned.
|
|
351
|
+
*/
|
|
352
|
+
removeGroups(e) {
|
|
353
|
+
const n = [], s = [], i = [];
|
|
354
|
+
for (let r = 0; r < this.animationGroups.length; r++)
|
|
355
|
+
e(this.animationGroups[r]) ? n.push(this.animationGroups[r]) : (s.push(this.animationGroups[r]), i.push(this.timingOptions[r]));
|
|
356
|
+
if (n.length === 0) return n;
|
|
357
|
+
for (const r of n)
|
|
358
|
+
r.cancel();
|
|
359
|
+
return this.animationGroups = s, this.timingOptions = i, this.animations = s.flatMap((r) => [...r.animations]), this.applyOffsets(), this.ready = Promise.all(this.animationGroups.map((r) => r.ready)).then(() => {
|
|
360
|
+
}), n;
|
|
361
|
+
}
|
|
362
|
+
async onFinish(e) {
|
|
363
|
+
try {
|
|
364
|
+
await Promise.all(this.animationGroups.map((n) => n.finished)), e();
|
|
365
|
+
} catch (n) {
|
|
366
|
+
console.warn("animation was interrupted - aborting onFinish callback - ", n);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
class Kt {
|
|
371
|
+
_animation;
|
|
372
|
+
customEffect;
|
|
373
|
+
progress;
|
|
374
|
+
_tickCbId;
|
|
375
|
+
_finishHandler;
|
|
376
|
+
constructor(e, n, s, i) {
|
|
377
|
+
const r = new KeyframeEffect(n, [], {
|
|
378
|
+
...s,
|
|
379
|
+
composite: "add"
|
|
380
|
+
}), { timeline: o } = i;
|
|
381
|
+
this._animation = new Animation(r, o), this._tickCbId = null, this.progress = null, this.customEffect = (a) => e(r.target, a), this._finishHandler = (a) => {
|
|
382
|
+
this.effect.target?.getAnimations().find((c) => c === this._animation) || this.cancel();
|
|
383
|
+
}, this.addEventListener("finish", this._finishHandler), this.addEventListener("remove", this._finishHandler);
|
|
384
|
+
}
|
|
385
|
+
// private tick method for customEffect loop implementation
|
|
386
|
+
_tick() {
|
|
387
|
+
try {
|
|
388
|
+
const e = this.effect?.getComputedTiming().progress ?? null;
|
|
389
|
+
e !== this.progress && (this.customEffect?.(e), this.progress = e), this._tickCbId = requestAnimationFrame(() => {
|
|
390
|
+
this._tick();
|
|
391
|
+
});
|
|
392
|
+
} catch (e) {
|
|
393
|
+
this._tickCbId = null, console.error(
|
|
394
|
+
`failed to run customEffect! effectId: ${this.id}, error: ${e instanceof Error ? e.message : e}`
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
// Animation timing properties
|
|
399
|
+
get currentTime() {
|
|
400
|
+
return this._animation.currentTime;
|
|
401
|
+
}
|
|
402
|
+
set currentTime(e) {
|
|
403
|
+
this._animation.currentTime = e;
|
|
404
|
+
}
|
|
405
|
+
get startTime() {
|
|
406
|
+
return this._animation.startTime;
|
|
407
|
+
}
|
|
408
|
+
set startTime(e) {
|
|
409
|
+
this._animation.startTime = e;
|
|
410
|
+
}
|
|
411
|
+
get playbackRate() {
|
|
412
|
+
return this._animation.playbackRate;
|
|
413
|
+
}
|
|
414
|
+
set playbackRate(e) {
|
|
415
|
+
this._animation.playbackRate = e;
|
|
416
|
+
}
|
|
417
|
+
// Animation basic properties
|
|
418
|
+
get id() {
|
|
419
|
+
return this._animation.id;
|
|
420
|
+
}
|
|
421
|
+
set id(e) {
|
|
422
|
+
this._animation.id = e;
|
|
423
|
+
}
|
|
424
|
+
get effect() {
|
|
425
|
+
return this._animation.effect;
|
|
426
|
+
}
|
|
427
|
+
set effect(e) {
|
|
428
|
+
this._animation.effect = e;
|
|
429
|
+
}
|
|
430
|
+
get timeline() {
|
|
431
|
+
return this._animation.timeline;
|
|
432
|
+
}
|
|
433
|
+
set timeline(e) {
|
|
434
|
+
this._animation.timeline = e;
|
|
435
|
+
}
|
|
436
|
+
// Animation readonly state properties
|
|
437
|
+
get finished() {
|
|
438
|
+
return this._animation.finished;
|
|
439
|
+
}
|
|
440
|
+
get pending() {
|
|
441
|
+
return this._animation.pending;
|
|
442
|
+
}
|
|
443
|
+
get playState() {
|
|
444
|
+
return this._animation.playState;
|
|
445
|
+
}
|
|
446
|
+
get ready() {
|
|
447
|
+
return this._animation.ready;
|
|
448
|
+
}
|
|
449
|
+
get replaceState() {
|
|
450
|
+
return this._animation.replaceState;
|
|
451
|
+
}
|
|
452
|
+
// Animation event handlers
|
|
453
|
+
get oncancel() {
|
|
454
|
+
return this._animation.oncancel;
|
|
455
|
+
}
|
|
456
|
+
set oncancel(e) {
|
|
457
|
+
this._animation.oncancel = e;
|
|
458
|
+
}
|
|
459
|
+
get onfinish() {
|
|
460
|
+
return this._animation.onfinish;
|
|
461
|
+
}
|
|
462
|
+
set onfinish(e) {
|
|
463
|
+
this._animation.onfinish = e;
|
|
464
|
+
}
|
|
465
|
+
get onremove() {
|
|
466
|
+
return this._animation.onremove;
|
|
467
|
+
}
|
|
468
|
+
set onremove(e) {
|
|
469
|
+
this._animation.onremove = e;
|
|
470
|
+
}
|
|
471
|
+
// CustomAnimation overridden methods
|
|
472
|
+
play() {
|
|
473
|
+
this._animation.play(), cancelAnimationFrame(this._tickCbId), this._tickCbId = requestAnimationFrame(() => this._tick());
|
|
474
|
+
}
|
|
475
|
+
pause() {
|
|
476
|
+
this._animation.pause(), cancelAnimationFrame(this._tickCbId), this._tickCbId = null;
|
|
477
|
+
}
|
|
478
|
+
cancel() {
|
|
479
|
+
this.removeEventListener("finish", this._finishHandler), this.removeEventListener("remove", this._finishHandler), this._animation.cancel(), this.customEffect(null), cancelAnimationFrame(this._tickCbId), this._tickCbId = null;
|
|
480
|
+
}
|
|
481
|
+
commitStyles() {
|
|
482
|
+
console.warn(
|
|
483
|
+
"CustomEffect animations do not support commitStyles method as they have no style to commit"
|
|
484
|
+
);
|
|
485
|
+
}
|
|
486
|
+
// Animation methods without override
|
|
487
|
+
finish() {
|
|
488
|
+
this._animation.finish();
|
|
489
|
+
}
|
|
490
|
+
persist() {
|
|
491
|
+
this._animation.persist();
|
|
492
|
+
}
|
|
493
|
+
reverse() {
|
|
494
|
+
this._animation.reverse();
|
|
495
|
+
}
|
|
496
|
+
updatePlaybackRate(e) {
|
|
497
|
+
this._animation.updatePlaybackRate(e);
|
|
498
|
+
}
|
|
499
|
+
// Animation events API
|
|
500
|
+
addEventListener(e, n, s) {
|
|
501
|
+
this._animation.addEventListener(e, n, s);
|
|
502
|
+
}
|
|
503
|
+
removeEventListener(e, n, s) {
|
|
504
|
+
this._animation.removeEventListener(e, n, s);
|
|
505
|
+
}
|
|
506
|
+
dispatchEvent(e) {
|
|
507
|
+
return this._animation.dispatchEvent(e);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
function Qt(t) {
|
|
511
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
512
|
+
}
|
|
513
|
+
var ee = { exports: {} }, Oe = ee.exports, Ae;
|
|
514
|
+
function Ut() {
|
|
515
|
+
return Ae || (Ae = 1, (function(t) {
|
|
516
|
+
(function(e) {
|
|
517
|
+
var n = function() {
|
|
518
|
+
}, s = e.requestAnimationFrame || e.webkitRequestAnimationFrame || e.mozRequestAnimationFrame || e.msRequestAnimationFrame || function(f) {
|
|
519
|
+
return setTimeout(f, 16);
|
|
520
|
+
};
|
|
521
|
+
function i() {
|
|
522
|
+
var f = this;
|
|
523
|
+
f.reads = [], f.writes = [], f.raf = s.bind(e);
|
|
524
|
+
}
|
|
525
|
+
i.prototype = {
|
|
526
|
+
constructor: i,
|
|
527
|
+
/**
|
|
528
|
+
* We run this inside a try catch
|
|
529
|
+
* so that if any jobs error, we
|
|
530
|
+
* are able to recover and continue
|
|
531
|
+
* to flush the batch until it's empty.
|
|
532
|
+
*
|
|
533
|
+
* @param {Array} tasks
|
|
534
|
+
*/
|
|
535
|
+
runTasks: function(f) {
|
|
536
|
+
for (var u; u = f.shift(); ) u();
|
|
537
|
+
},
|
|
538
|
+
/**
|
|
539
|
+
* Adds a job to the read batch and
|
|
540
|
+
* schedules a new frame if need be.
|
|
541
|
+
*
|
|
542
|
+
* @param {Function} fn
|
|
543
|
+
* @param {Object} ctx the context to be bound to `fn` (optional).
|
|
544
|
+
* @public
|
|
545
|
+
*/
|
|
546
|
+
measure: function(f, u) {
|
|
547
|
+
var d = u ? f.bind(u) : f;
|
|
548
|
+
return this.reads.push(d), r(this), d;
|
|
549
|
+
},
|
|
550
|
+
/**
|
|
551
|
+
* Adds a job to the
|
|
552
|
+
* write batch and schedules
|
|
553
|
+
* a new frame if need be.
|
|
554
|
+
*
|
|
555
|
+
* @param {Function} fn
|
|
556
|
+
* @param {Object} ctx the context to be bound to `fn` (optional).
|
|
557
|
+
* @public
|
|
558
|
+
*/
|
|
559
|
+
mutate: function(f, u) {
|
|
560
|
+
var d = u ? f.bind(u) : f;
|
|
561
|
+
return this.writes.push(d), r(this), d;
|
|
562
|
+
},
|
|
563
|
+
/**
|
|
564
|
+
* Clears a scheduled 'read' or 'write' task.
|
|
565
|
+
*
|
|
566
|
+
* @param {Object} task
|
|
567
|
+
* @return {Boolean} success
|
|
568
|
+
* @public
|
|
569
|
+
*/
|
|
570
|
+
clear: function(f) {
|
|
571
|
+
return a(this.reads, f) || a(this.writes, f);
|
|
572
|
+
},
|
|
573
|
+
/**
|
|
574
|
+
* Extend this FastDom with some
|
|
575
|
+
* custom functionality.
|
|
576
|
+
*
|
|
577
|
+
* Because fastdom must *always* be a
|
|
578
|
+
* singleton, we're actually extending
|
|
579
|
+
* the fastdom instance. This means tasks
|
|
580
|
+
* scheduled by an extension still enter
|
|
581
|
+
* fastdom's global task queue.
|
|
582
|
+
*
|
|
583
|
+
* The 'super' instance can be accessed
|
|
584
|
+
* from `this.fastdom`.
|
|
585
|
+
*
|
|
586
|
+
* @example
|
|
587
|
+
*
|
|
588
|
+
* var myFastdom = fastdom.extend({
|
|
589
|
+
* initialize: function() {
|
|
590
|
+
* // runs on creation
|
|
591
|
+
* },
|
|
592
|
+
*
|
|
593
|
+
* // override a method
|
|
594
|
+
* measure: function(fn) {
|
|
595
|
+
* // do extra stuff ...
|
|
596
|
+
*
|
|
597
|
+
* // then call the original
|
|
598
|
+
* return this.fastdom.measure(fn);
|
|
599
|
+
* },
|
|
600
|
+
*
|
|
601
|
+
* ...
|
|
602
|
+
* });
|
|
603
|
+
*
|
|
604
|
+
* @param {Object} props properties to mixin
|
|
605
|
+
* @return {FastDom}
|
|
606
|
+
*/
|
|
607
|
+
extend: function(f) {
|
|
608
|
+
if (typeof f != "object") throw new Error("expected object");
|
|
609
|
+
var u = Object.create(this);
|
|
610
|
+
return c(u, f), u.fastdom = this, u.initialize && u.initialize(), u;
|
|
611
|
+
},
|
|
612
|
+
// override this with a function
|
|
613
|
+
// to prevent Errors in console
|
|
614
|
+
// when tasks throw
|
|
615
|
+
catch: null
|
|
616
|
+
};
|
|
617
|
+
function r(f) {
|
|
618
|
+
f.scheduled || (f.scheduled = !0, f.raf(o.bind(null, f)));
|
|
619
|
+
}
|
|
620
|
+
function o(f) {
|
|
621
|
+
var u = f.writes, d = f.reads, g;
|
|
622
|
+
try {
|
|
623
|
+
n("flushing reads", d.length), f.runTasks(d), n("flushing writes", u.length), f.runTasks(u);
|
|
624
|
+
} catch (p) {
|
|
625
|
+
g = p;
|
|
626
|
+
}
|
|
627
|
+
if (f.scheduled = !1, (d.length || u.length) && r(f), g)
|
|
628
|
+
if (n("task errored", g.message), f.catch) f.catch(g);
|
|
629
|
+
else throw g;
|
|
630
|
+
}
|
|
631
|
+
function a(f, u) {
|
|
632
|
+
var d = f.indexOf(u);
|
|
633
|
+
return !!~d && !!f.splice(d, 1);
|
|
634
|
+
}
|
|
635
|
+
function c(f, u) {
|
|
636
|
+
for (var d in u)
|
|
637
|
+
u.hasOwnProperty(d) && (f[d] = u[d]);
|
|
638
|
+
}
|
|
639
|
+
var l = e.fastdom = e.fastdom || new i();
|
|
640
|
+
t.exports = l;
|
|
641
|
+
})(typeof window < "u" ? window : typeof Oe < "u" ? Oe : globalThis);
|
|
642
|
+
})(ee)), ee.exports;
|
|
643
|
+
}
|
|
644
|
+
var Xt = Ut();
|
|
645
|
+
const O = /* @__PURE__ */ Qt(Xt), de = {};
|
|
646
|
+
function Zt(t) {
|
|
647
|
+
Object.assign(de, t);
|
|
648
|
+
}
|
|
649
|
+
function Jt(t) {
|
|
650
|
+
return t in de ? de[t] : (console.warn(
|
|
651
|
+
`${t} not found in registry. Please make sure to import and register the preset.`
|
|
652
|
+
), null);
|
|
653
|
+
}
|
|
654
|
+
function N(t, e) {
|
|
655
|
+
return t ? (e || document).getElementById(t) : null;
|
|
656
|
+
}
|
|
657
|
+
function en(t, e) {
|
|
658
|
+
return t?.matches(`[data-motion-part~="${e}"]`) ? t : t?.querySelector(`[data-motion-part~="${e}"]`);
|
|
659
|
+
}
|
|
660
|
+
function tn(t) {
|
|
661
|
+
const e = t.alternate ? "alternate" : "";
|
|
662
|
+
return t.reversed ? `${e ? `${e}-` : ""}reverse` : e || "normal";
|
|
663
|
+
}
|
|
664
|
+
function ce(t) {
|
|
665
|
+
return `${t.value}${Gt(t.unit)}`;
|
|
666
|
+
}
|
|
667
|
+
function Ce(t, e, n) {
|
|
668
|
+
return `${t.name || "cover"} ${n && t.offset.unit !== "percentage" ? `calc(100% + ${ce(t.offset)}${e ? ` + ${e}` : ""})` : e ? `calc(${ce(t.offset)} + ${e})` : ce(t.offset)}`;
|
|
669
|
+
}
|
|
670
|
+
function De(t) {
|
|
671
|
+
return {
|
|
672
|
+
start: Ce(t.startOffset, t.startOffsetAdd),
|
|
673
|
+
end: Ce(t.endOffset, t.endOffsetAdd, !0)
|
|
674
|
+
};
|
|
675
|
+
}
|
|
676
|
+
function Ge(t) {
|
|
677
|
+
return (e) => O.measure(() => e(t));
|
|
678
|
+
}
|
|
679
|
+
function We(t) {
|
|
680
|
+
return (e) => O.mutate(() => e(t));
|
|
681
|
+
}
|
|
682
|
+
function W(t) {
|
|
683
|
+
if (t.namedEffect) {
|
|
684
|
+
const e = t.namedEffect.type;
|
|
685
|
+
return typeof e == "string" ? Jt(e) : null;
|
|
686
|
+
} else if (t.keyframeEffect) {
|
|
687
|
+
const e = (s) => {
|
|
688
|
+
const { name: i, keyframes: r } = s.keyframeEffect;
|
|
689
|
+
return [{ ...s, name: i, keyframes: r }];
|
|
690
|
+
};
|
|
691
|
+
return { web: e, style: e, getNames: (s) => {
|
|
692
|
+
const { effectId: i } = s, { name: r } = s.keyframeEffect, o = r || i;
|
|
693
|
+
return o ? [o] : [];
|
|
694
|
+
} };
|
|
695
|
+
} else if (t.customEffect)
|
|
696
|
+
return (e) => [{ ...e, keyframes: [] }];
|
|
697
|
+
return null;
|
|
698
|
+
}
|
|
699
|
+
function Ve(t, e, n, s) {
|
|
700
|
+
return t.map((i, r) => {
|
|
701
|
+
const o = {
|
|
702
|
+
fill: i.fill,
|
|
703
|
+
easing: J(i.easing),
|
|
704
|
+
iterations: i.iterations === 0 ? 1 / 0 : i.iterations || 1,
|
|
705
|
+
composite: i.composite,
|
|
706
|
+
direction: tn(i)
|
|
707
|
+
};
|
|
708
|
+
return Se(e) ? (o.duration = i.duration, o.delay = i.delay || 0) : e?.trigger === "view-progress" && (s || window.ViewTimeline) ? o.duration = "auto" : (o.duration = 99.99, o.delay = 0.01), {
|
|
709
|
+
effect: i,
|
|
710
|
+
options: o,
|
|
711
|
+
id: n && `${n}-${r + 1}`,
|
|
712
|
+
part: i.part
|
|
713
|
+
};
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
function Se(t) {
|
|
717
|
+
return !t || t.trigger !== "pointer-move" && t.trigger !== "view-progress";
|
|
718
|
+
}
|
|
719
|
+
function ke(t, e, n, s, i) {
|
|
720
|
+
if (t) {
|
|
721
|
+
if (Se(s) && (e.duration = e.duration || 1, i?.reducedMotion))
|
|
722
|
+
if (e.iterations === 1 || e.iterations == null)
|
|
723
|
+
e = { ...e, duration: 1 };
|
|
724
|
+
else
|
|
725
|
+
return [];
|
|
726
|
+
let r;
|
|
727
|
+
return n instanceof HTMLElement && (r = { measure: Ge(n), mutate: We(n) }), t.web ? t.web(e, r, i) : t(e, r, i);
|
|
728
|
+
}
|
|
729
|
+
return [];
|
|
730
|
+
}
|
|
731
|
+
function Ye(t, e, n, s, i) {
|
|
732
|
+
const r = t instanceof HTMLElement ? t : N(t, i);
|
|
733
|
+
if (n?.trigger === "pointer-move" && !e.keyframeEffect) {
|
|
734
|
+
let d = e;
|
|
735
|
+
e.customEffect && (d = {
|
|
736
|
+
...e,
|
|
737
|
+
namedEffect: { id: "", type: "CustomMouse" }
|
|
738
|
+
});
|
|
739
|
+
const g = W(
|
|
740
|
+
d
|
|
741
|
+
), p = ke(
|
|
742
|
+
g,
|
|
743
|
+
e,
|
|
744
|
+
r,
|
|
745
|
+
n,
|
|
746
|
+
s
|
|
747
|
+
);
|
|
748
|
+
return typeof p != "function" ? null : p(r);
|
|
749
|
+
}
|
|
750
|
+
const o = W(e), a = ke(
|
|
751
|
+
o,
|
|
752
|
+
e,
|
|
753
|
+
r,
|
|
754
|
+
n,
|
|
755
|
+
s
|
|
756
|
+
);
|
|
757
|
+
if (!a || a.length === 0)
|
|
758
|
+
return null;
|
|
759
|
+
const c = Ve(a, n, e.effectId);
|
|
760
|
+
let l;
|
|
761
|
+
const f = n?.trigger === "view-progress";
|
|
762
|
+
f && window.ViewTimeline && (l = new ViewTimeline({
|
|
763
|
+
subject: n.element || N(n.componentId)
|
|
764
|
+
}));
|
|
765
|
+
const u = c.map(({ effect: d, options: g, id: p, part: m }) => {
|
|
766
|
+
const h = m ? en(r, m) : r, v = new KeyframeEffect(h || null, [], g);
|
|
767
|
+
O.mutate(() => {
|
|
768
|
+
"timing" in d && v.updateTiming(d.timing), v.setKeyframes(d.keyframes);
|
|
769
|
+
});
|
|
770
|
+
const y = f && l ? { timeline: l } : {}, E = typeof d.customEffect == "function" ? new Kt(
|
|
771
|
+
d.customEffect,
|
|
772
|
+
h || null,
|
|
773
|
+
g,
|
|
774
|
+
y
|
|
775
|
+
) : new Animation(v, y.timeline);
|
|
776
|
+
if (f)
|
|
777
|
+
if (l)
|
|
778
|
+
O.mutate(() => {
|
|
779
|
+
const { start: w, end: S } = De(d);
|
|
780
|
+
E.rangeStart = w, E.rangeEnd = S, E.play();
|
|
781
|
+
});
|
|
782
|
+
else {
|
|
783
|
+
const { startOffset: w, endOffset: S } = e;
|
|
784
|
+
O.mutate(() => {
|
|
785
|
+
const T = d.startOffset || w, I = d.endOffset || S;
|
|
786
|
+
Object.assign(E, {
|
|
787
|
+
start: {
|
|
788
|
+
name: T.name,
|
|
789
|
+
offset: T.offset?.value,
|
|
790
|
+
add: d.startOffsetAdd
|
|
791
|
+
},
|
|
792
|
+
end: {
|
|
793
|
+
name: I.name,
|
|
794
|
+
offset: I.offset?.value,
|
|
795
|
+
add: d.endOffsetAdd
|
|
796
|
+
}
|
|
797
|
+
});
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
return p && (E.id = p), E;
|
|
801
|
+
});
|
|
802
|
+
return new V(u, {
|
|
803
|
+
...e,
|
|
804
|
+
trigger: { ...n || {} },
|
|
805
|
+
// make sure the group is ready after all animation targets are measured and mutated
|
|
806
|
+
measured: new Promise((d) => O.mutate(d))
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
function nn(t, e) {
|
|
810
|
+
return t ? `#${t}${e ? `[data-motion-part~="${e}"]` : ""}` : "";
|
|
811
|
+
}
|
|
812
|
+
function sn(t, e) {
|
|
813
|
+
const { duration: n, delay: s, iterations: i = 1, fill: r, easing: o = "linear", direction: a } = t.options, c = t.effect.name, l = n === "auto";
|
|
814
|
+
return `${c} ${l ? "auto" : `${n}ms`}${l ? " " : ` ${s || 1}ms `}${o}${r && r !== "none" ? ` ${r}` : ""} ${!i || i === 1 / 0 ? "infinite" : i}${a === "normal" ? "" : ` ${a}`} ${e ? "" : "paused"}`;
|
|
815
|
+
}
|
|
816
|
+
function rn(t, e, n) {
|
|
817
|
+
return t?.style ? (Se(n) && (e.duration = e.duration || 1), t.style(e)) : [];
|
|
818
|
+
}
|
|
819
|
+
function on(t, e, n) {
|
|
820
|
+
const s = W(e), i = rn(s, e), r = Ve(i, n, e.effectId, !0), o = n?.trigger === "view-progress";
|
|
821
|
+
return r.map((a, c) => {
|
|
822
|
+
const { start: l, end: f } = o ? De(a.effect) : {};
|
|
823
|
+
return {
|
|
824
|
+
target: nn(t, a.part),
|
|
825
|
+
animation: sn(a, o),
|
|
826
|
+
composition: a.options.composite,
|
|
827
|
+
custom: a.effect.custom,
|
|
828
|
+
name: a.effect.name,
|
|
829
|
+
keyframes: a.effect.keyframes,
|
|
830
|
+
id: a.id && `${a.id}-${c + 1}`,
|
|
831
|
+
animationTimeline: o ? `--${n?.id}` : "",
|
|
832
|
+
animationRange: l || f ? `${l} ${f}` : ""
|
|
833
|
+
};
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
function an(t, e, n) {
|
|
837
|
+
const s = W(e), i = t instanceof HTMLElement ? t : N(t);
|
|
838
|
+
if (s && s.prepare && i) {
|
|
839
|
+
const r = { measure: Ge(i), mutate: We(i) };
|
|
840
|
+
s.prepare(e, r);
|
|
841
|
+
}
|
|
842
|
+
n && O.mutate(n);
|
|
843
|
+
}
|
|
844
|
+
function Be(t, e) {
|
|
845
|
+
const n = W(e);
|
|
846
|
+
if (!n)
|
|
847
|
+
return null;
|
|
848
|
+
if (!n.style)
|
|
849
|
+
return e.effectId && t ? cn(t, e.effectId) : null;
|
|
850
|
+
const s = n.getNames(e), r = (typeof t == "string" ? N(t) : t)?.getAnimations(), o = r?.map((c) => c.animationName) || [], a = [];
|
|
851
|
+
return s.forEach((c) => {
|
|
852
|
+
o.includes(c) && a.push(
|
|
853
|
+
r?.find((l) => l.animationName === c)
|
|
854
|
+
);
|
|
855
|
+
}), a?.length ? new V(a) : null;
|
|
856
|
+
}
|
|
857
|
+
function cn(t, e) {
|
|
858
|
+
const s = (typeof t == "string" ? N(t) : t)?.getAnimations().filter((i) => {
|
|
859
|
+
const r = i.id || i.animationName;
|
|
860
|
+
return r ? r.startsWith(e) : !0;
|
|
861
|
+
});
|
|
862
|
+
return s?.length ? new V(s) : null;
|
|
863
|
+
}
|
|
864
|
+
function Ke(t, e, n, s = {}) {
|
|
865
|
+
const { disabled: i, allowActiveEvent: r, ...o } = s, a = Ye(t, e, n, o);
|
|
866
|
+
if (!a)
|
|
867
|
+
return null;
|
|
868
|
+
let c = {};
|
|
869
|
+
if (n.trigger === "view-progress" && !window.ViewTimeline) {
|
|
870
|
+
const l = n.element || N(n.componentId), { ready: f } = a;
|
|
871
|
+
return a.animations.map((u) => ({
|
|
872
|
+
/* we use getters for start and end in order to access the animation's start and end
|
|
873
|
+
only when initializing the scrub scene rather than immediately */
|
|
874
|
+
get start() {
|
|
875
|
+
return u.start;
|
|
876
|
+
},
|
|
877
|
+
get end() {
|
|
878
|
+
return u.end;
|
|
879
|
+
},
|
|
880
|
+
viewSource: l,
|
|
881
|
+
ready: f,
|
|
882
|
+
getProgress() {
|
|
883
|
+
return a.getProgress();
|
|
884
|
+
},
|
|
885
|
+
effect(d, g) {
|
|
886
|
+
const { activeDuration: p } = u.effect.getComputedTiming(), { delay: m } = u.effect.getTiming();
|
|
887
|
+
u.currentTime = ((m || 0) + (p || 0)) * g;
|
|
888
|
+
},
|
|
889
|
+
disabled: i,
|
|
890
|
+
destroy() {
|
|
891
|
+
u.cancel();
|
|
892
|
+
}
|
|
893
|
+
}));
|
|
894
|
+
} else if (n.trigger === "pointer-move") {
|
|
895
|
+
const l = e, { centeredToTarget: f, transitionDuration: u, transitionEasing: d } = l, g = n.axis;
|
|
896
|
+
if (l.keyframeEffect) {
|
|
897
|
+
const p = a;
|
|
898
|
+
return p.animations?.length === 0 ? null : {
|
|
899
|
+
target: void 0,
|
|
900
|
+
centeredToTarget: f,
|
|
901
|
+
ready: p.ready,
|
|
902
|
+
_currentProgress: 0,
|
|
903
|
+
getProgress() {
|
|
904
|
+
return this._currentProgress;
|
|
905
|
+
},
|
|
906
|
+
effect(h, v) {
|
|
907
|
+
const y = g === "x" ? v.x : v.y;
|
|
908
|
+
this._currentProgress = y, p.progress(y);
|
|
909
|
+
},
|
|
910
|
+
disabled: i ?? !1,
|
|
911
|
+
destroy() {
|
|
912
|
+
p.cancel();
|
|
913
|
+
}
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
c = {
|
|
917
|
+
centeredToTarget: f,
|
|
918
|
+
allowActiveEvent: r
|
|
919
|
+
}, e.customEffect && u && (c.transitionDuration = u, c.transitionEasing = be(d)), c.target = a.target;
|
|
920
|
+
}
|
|
921
|
+
return {
|
|
922
|
+
...c,
|
|
923
|
+
getProgress() {
|
|
924
|
+
return a.getProgress();
|
|
925
|
+
},
|
|
926
|
+
effect(l, f, u, d) {
|
|
927
|
+
a.progress(
|
|
928
|
+
u ? {
|
|
929
|
+
// @ts-expect-error spread error on p
|
|
930
|
+
...f,
|
|
931
|
+
v: u,
|
|
932
|
+
active: d
|
|
933
|
+
} : f
|
|
934
|
+
);
|
|
935
|
+
},
|
|
936
|
+
disabled: i,
|
|
937
|
+
destroy() {
|
|
938
|
+
a.cancel();
|
|
939
|
+
}
|
|
940
|
+
};
|
|
941
|
+
}
|
|
942
|
+
function Y(t, e, n, s = !1) {
|
|
943
|
+
const i = Be(t, e);
|
|
944
|
+
return i ? (i.ready = new Promise((r) => {
|
|
945
|
+
an(t, e, r);
|
|
946
|
+
}), i) : Ye(t, e, n, { reducedMotion: s });
|
|
947
|
+
}
|
|
948
|
+
function fn(t) {
|
|
949
|
+
return t === null ? [null] : typeof t == "string" ? Array.from(document.querySelectorAll(t)) : Array.isArray(t) ? t : [t];
|
|
950
|
+
}
|
|
951
|
+
function Qe(t, e) {
|
|
952
|
+
const n = [];
|
|
953
|
+
for (const { target: s, options: i } of t) {
|
|
954
|
+
const r = fn(s);
|
|
955
|
+
for (const o of r) {
|
|
956
|
+
const a = Y(
|
|
957
|
+
o,
|
|
958
|
+
i,
|
|
959
|
+
void 0,
|
|
960
|
+
e?.reducedMotion
|
|
961
|
+
);
|
|
962
|
+
a instanceof V && n.push(a);
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
return n;
|
|
966
|
+
}
|
|
967
|
+
function ln(t, e, n) {
|
|
968
|
+
const s = Qe(e, n);
|
|
969
|
+
return new Bt(s, t);
|
|
970
|
+
}
|
|
971
|
+
function un(t, e = 2) {
|
|
972
|
+
return parseFloat(t.toFixed(e));
|
|
973
|
+
}
|
|
974
|
+
function dn(t) {
|
|
975
|
+
return /\[]/g.test(t);
|
|
976
|
+
}
|
|
977
|
+
function hn(t) {
|
|
978
|
+
return `--${t.join("-")}`;
|
|
979
|
+
}
|
|
980
|
+
function mn(t) {
|
|
981
|
+
return t.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
|
|
982
|
+
}
|
|
983
|
+
function pn(t, e, n, s) {
|
|
984
|
+
const i = t.length - 1;
|
|
985
|
+
t.forEach((r, o) => {
|
|
986
|
+
if (r) {
|
|
987
|
+
const a = o ? s(o / i) * i * n | 0 : 0;
|
|
988
|
+
r.delay = e + a + (r.delay || 0);
|
|
989
|
+
}
|
|
990
|
+
});
|
|
991
|
+
}
|
|
992
|
+
function te(t, e) {
|
|
993
|
+
return e.includes("&") ? e.replace(/&/g, t) : `${t}${e}`;
|
|
994
|
+
}
|
|
995
|
+
function k() {
|
|
996
|
+
return "wi-12343210".replace(
|
|
997
|
+
/\d/g,
|
|
998
|
+
(t) => String.fromCharCode(
|
|
999
|
+
(+t ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +t / 4) + 97
|
|
1000
|
+
)
|
|
1001
|
+
// 97 for "a"
|
|
1002
|
+
);
|
|
1003
|
+
}
|
|
1004
|
+
function Ue(t) {
|
|
1005
|
+
let { transition: e, transitionProperties: n } = t, s = [];
|
|
1006
|
+
if (e?.styleProperties) {
|
|
1007
|
+
const { duration: i, easing: r, delay: o } = e;
|
|
1008
|
+
i && (e.styleProperties.some(
|
|
1009
|
+
(c) => c.name.startsWith("--")
|
|
1010
|
+
) ? s = [
|
|
1011
|
+
`all ${i}ms ${J(r || "ease")}${o ? ` ${o}ms` : ""}`,
|
|
1012
|
+
"visibility 0s"
|
|
1013
|
+
] : s = e.styleProperties.map(
|
|
1014
|
+
(c) => `${c.name} ${i}ms ${J(
|
|
1015
|
+
r || "ease"
|
|
1016
|
+
)}${o ? ` ${o}ms` : ""}`
|
|
1017
|
+
));
|
|
1018
|
+
} else
|
|
1019
|
+
s = n?.filter((i) => i.duration).map(
|
|
1020
|
+
(i) => `${i.name} ${i.duration}ms ${J(i.easing) || "ease"}${i.delay ? ` ${i.delay}ms` : ""}`
|
|
1021
|
+
) || [];
|
|
1022
|
+
return s;
|
|
1023
|
+
}
|
|
1024
|
+
function gn({
|
|
1025
|
+
key: t,
|
|
1026
|
+
effectId: e,
|
|
1027
|
+
transition: n,
|
|
1028
|
+
transitionProperties: s,
|
|
1029
|
+
childSelector: i = "> :first-child",
|
|
1030
|
+
selectorCondition: r
|
|
1031
|
+
}) {
|
|
1032
|
+
const o = Ue({
|
|
1033
|
+
transition: n,
|
|
1034
|
+
transitionProperties: s
|
|
1035
|
+
}), a = (n?.styleProperties || s)?.map(
|
|
1036
|
+
(p) => `${p.name}: ${p.value};`
|
|
1037
|
+
) || [], c = t.replace(/"/g, "'"), l = `:is(:state(${e}), :--${e}) ${i}`, f = `[data-interact-effect~="${e}"] ${i}`, u = r ? te(l, r) : l, d = r ? te(f, r) : f, g = [
|
|
1038
|
+
`${u},
|
|
1039
|
+
${d} {
|
|
1040
|
+
${a.join(`
|
|
1041
|
+
`)}
|
|
1042
|
+
}`
|
|
1043
|
+
];
|
|
1044
|
+
if (o.length) {
|
|
1045
|
+
const p = `[data-interact-key="${c}"] ${i}`, m = r ? te(p, r) : p;
|
|
1046
|
+
g.push(`@media (prefers-reduced-motion: no-preference) { ${m} {
|
|
1047
|
+
transition: ${o.join(", ")};
|
|
1048
|
+
} }`);
|
|
1049
|
+
}
|
|
1050
|
+
return g;
|
|
1051
|
+
}
|
|
1052
|
+
function ae(t, e, n) {
|
|
1053
|
+
const s = (t || []).filter((i) => e[i]?.type === n && e[i].predicate).map((i) => e[i].predicate).join(") and (");
|
|
1054
|
+
return s && `(${s})`;
|
|
1055
|
+
}
|
|
1056
|
+
function _(t, e) {
|
|
1057
|
+
const n = ae(t, e, "media");
|
|
1058
|
+
return n && window.matchMedia(n);
|
|
1059
|
+
}
|
|
1060
|
+
function L(t, e) {
|
|
1061
|
+
return (t || []).filter((n) => e[n]?.type === "selector" && e[n].predicate).map((n) => `:is(${e[n].predicate})`).join("");
|
|
1062
|
+
}
|
|
1063
|
+
const K = {
|
|
1064
|
+
rangeStart: { name: "cover", offset: { value: 0, unit: "percentage" } },
|
|
1065
|
+
rangeEnd: { name: "cover", offset: { value: 100, unit: "percentage" } }
|
|
1066
|
+
};
|
|
1067
|
+
function vn(t, e) {
|
|
1068
|
+
const n = t?.name ?? K.rangeStart.name, s = e?.name ?? t?.name ?? K.rangeEnd.name, i = {
|
|
1069
|
+
name: n,
|
|
1070
|
+
offset: t?.offset || K.rangeStart.offset
|
|
1071
|
+
}, r = {
|
|
1072
|
+
name: s,
|
|
1073
|
+
offset: e?.offset || K.rangeEnd.offset
|
|
1074
|
+
};
|
|
1075
|
+
return { startOffset: i, endOffset: r };
|
|
1076
|
+
}
|
|
1077
|
+
function q(t) {
|
|
1078
|
+
if ("keyframeEffect" in t && !t.keyframeEffect.name && "effectId" in t && (t.keyframeEffect.name = t.effectId), "duration" in t)
|
|
1079
|
+
return {
|
|
1080
|
+
id: "",
|
|
1081
|
+
...t
|
|
1082
|
+
};
|
|
1083
|
+
const { rangeStart: e, rangeEnd: n, ...s } = t, { startOffset: i, endOffset: r } = vn(e, n);
|
|
1084
|
+
return {
|
|
1085
|
+
id: "",
|
|
1086
|
+
startOffset: i,
|
|
1087
|
+
endOffset: r,
|
|
1088
|
+
...s
|
|
1089
|
+
};
|
|
1090
|
+
}
|
|
1091
|
+
function C(t, e, n) {
|
|
1092
|
+
let s = t.get(e);
|
|
1093
|
+
s || (s = /* @__PURE__ */ new Set(), t.set(e, s)), s.add(n);
|
|
1094
|
+
}
|
|
1095
|
+
function B(t, e) {
|
|
1096
|
+
t.get(e)?.forEach((s) => {
|
|
1097
|
+
const { source: i, target: r, cleanup: o } = s;
|
|
1098
|
+
o();
|
|
1099
|
+
const a = i === e ? r : i;
|
|
1100
|
+
t.get(a)?.delete(s);
|
|
1101
|
+
}), t.delete(e);
|
|
1102
|
+
}
|
|
1103
|
+
const yn = {
|
|
1104
|
+
root: null,
|
|
1105
|
+
rootMargin: "0px 0px -10% 0px",
|
|
1106
|
+
threshold: [0]
|
|
1107
|
+
}, En = {
|
|
1108
|
+
root: null,
|
|
1109
|
+
rootMargin: "0px",
|
|
1110
|
+
threshold: [0]
|
|
1111
|
+
}, wn = 0.2;
|
|
1112
|
+
function bn(t) {
|
|
1113
|
+
const e = t.trim().split(/\s+/), n = e[0], s = e.length > 1 ? e[1] : e[0], i = (r) => r.startsWith("-") ? r.slice(1) : parseFloat(r) ? `-${r}` : r;
|
|
1114
|
+
return `${i(n)} 0px ${i(s)}`;
|
|
1115
|
+
}
|
|
1116
|
+
const D = {}, M = /* @__PURE__ */ new WeakMap(), re = /* @__PURE__ */ new WeakSet(), z = /* @__PURE__ */ new WeakMap();
|
|
1117
|
+
let Xe = {}, H = null;
|
|
1118
|
+
function Sn(t) {
|
|
1119
|
+
Xe = t;
|
|
1120
|
+
}
|
|
1121
|
+
function Ze(t, e, n) {
|
|
1122
|
+
M.get(t)?.forEach(({ source: i, handler: r }) => {
|
|
1123
|
+
i === t && r(e, n);
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
function $e() {
|
|
1127
|
+
return H || (H = new IntersectionObserver((t) => {
|
|
1128
|
+
t.forEach((e) => {
|
|
1129
|
+
const n = e.target;
|
|
1130
|
+
e.isIntersecting || Ze(n, !1, !0);
|
|
1131
|
+
});
|
|
1132
|
+
}, En), H);
|
|
1133
|
+
}
|
|
1134
|
+
function Je(t, e = !1) {
|
|
1135
|
+
const n = JSON.stringify({ ...t, isSafeMode: e });
|
|
1136
|
+
if (D[n])
|
|
1137
|
+
return D[n];
|
|
1138
|
+
const s = t.threshold ?? wn, i = e ? yn : {
|
|
1139
|
+
root: null,
|
|
1140
|
+
rootMargin: t.inset ? bn(t.inset) : "0px",
|
|
1141
|
+
threshold: s
|
|
1142
|
+
}, r = new IntersectionObserver((o) => {
|
|
1143
|
+
o.forEach((a) => {
|
|
1144
|
+
const c = a.target, l = !re.has(c);
|
|
1145
|
+
if (l && (re.add(c), t.useSafeViewEnter && !a.isIntersecting)) {
|
|
1146
|
+
O.measure(() => {
|
|
1147
|
+
const f = a.boundingClientRect.height, u = a.rootBounds?.height;
|
|
1148
|
+
if (!u)
|
|
1149
|
+
return;
|
|
1150
|
+
const d = Array.isArray(t.threshold) ? Math.min(...t.threshold) : t.threshold;
|
|
1151
|
+
d && f * d > u && O.mutate(() => {
|
|
1152
|
+
r.unobserve(c);
|
|
1153
|
+
const p = Je(t, !0);
|
|
1154
|
+
z.set(c, p), p.observe(c);
|
|
1155
|
+
});
|
|
1156
|
+
});
|
|
1157
|
+
return;
|
|
1158
|
+
}
|
|
1159
|
+
(a.isIntersecting || !l) && Ze(c, a.isIntersecting);
|
|
1160
|
+
});
|
|
1161
|
+
}, i);
|
|
1162
|
+
return D[n] = r, r;
|
|
1163
|
+
}
|
|
1164
|
+
function Tn(t, e, n, s = {}, { reducedMotion: i, selectorCondition: r, animation: o } = {}) {
|
|
1165
|
+
const a = { ...Xe, ...s }, c = n.triggerType || "once", l = o || Y(
|
|
1166
|
+
e,
|
|
1167
|
+
q(n),
|
|
1168
|
+
void 0,
|
|
1169
|
+
i
|
|
1170
|
+
);
|
|
1171
|
+
if (!l)
|
|
1172
|
+
return;
|
|
1173
|
+
const f = Je(a);
|
|
1174
|
+
c !== "once" && l.persist?.();
|
|
1175
|
+
let u = !0, d = !1, g;
|
|
1176
|
+
g = { source: t, target: e, handler: (h, v) => {
|
|
1177
|
+
if (!(r && !e.matches(r)))
|
|
1178
|
+
if (c === "once") {
|
|
1179
|
+
if (h && !d) {
|
|
1180
|
+
d = !0, M.get(t)?.delete(g), M.get(e)?.delete(g);
|
|
1181
|
+
const y = M.get(t);
|
|
1182
|
+
(!y || y.size === 0) && ((z.get(t) || f).unobserve(t), re.delete(t)), l.play(() => {
|
|
1183
|
+
const E = () => {
|
|
1184
|
+
e.dataset.interactEnter = "start";
|
|
1185
|
+
};
|
|
1186
|
+
if (l.isCSS) {
|
|
1187
|
+
O.mutate(() => {
|
|
1188
|
+
requestAnimationFrame(E);
|
|
1189
|
+
});
|
|
1190
|
+
const w = () => {
|
|
1191
|
+
O.mutate(() => {
|
|
1192
|
+
e.dataset.interactEnter = "done";
|
|
1193
|
+
});
|
|
1194
|
+
};
|
|
1195
|
+
l.onFinish(w), l.onAbort(w);
|
|
1196
|
+
} else
|
|
1197
|
+
O.mutate(E);
|
|
1198
|
+
});
|
|
1199
|
+
}
|
|
1200
|
+
} else c === "alternate" ? u && h ? (u = !1, l.play()) : u || l.reverse() : c === "repeat" ? h ? (l.progress(0), l.play()) : v && (l.pause(), l.progress(0)) : c === "state" && (h ? l.play() : v && l.pause());
|
|
1201
|
+
}, cleanup: () => {
|
|
1202
|
+
(z.get(t) || f).unobserve(t), (c === "repeat" || c === "state") && $e().unobserve(t), l.cancel(), re.delete(t), z.delete(t);
|
|
1203
|
+
} }, C(M, t, g), C(M, e, g), z.set(t, f), f.observe(t), (c === "repeat" || c === "state") && $e().observe(t);
|
|
1204
|
+
}
|
|
1205
|
+
function In(t) {
|
|
1206
|
+
B(M, t);
|
|
1207
|
+
}
|
|
1208
|
+
function On() {
|
|
1209
|
+
H = null, Object.keys(D).forEach((t) => delete D[t]);
|
|
1210
|
+
}
|
|
1211
|
+
const _e = {
|
|
1212
|
+
add: Tn,
|
|
1213
|
+
remove: In,
|
|
1214
|
+
setOptions: Sn,
|
|
1215
|
+
reset: On
|
|
1216
|
+
};
|
|
1217
|
+
function et(t, e) {
|
|
1218
|
+
return Object.assign(Object.create(e), t);
|
|
1219
|
+
}
|
|
1220
|
+
function An(t, e, n, s) {
|
|
1221
|
+
let i = t * (1 - n) + e * n;
|
|
1222
|
+
if (s) {
|
|
1223
|
+
const r = i - t;
|
|
1224
|
+
Math.abs(r) < s && (i = t + s * Math.sign(r));
|
|
1225
|
+
const o = e - i;
|
|
1226
|
+
if (Math.abs(o) < s)
|
|
1227
|
+
return e;
|
|
1228
|
+
}
|
|
1229
|
+
return i;
|
|
1230
|
+
}
|
|
1231
|
+
function Cn(t) {
|
|
1232
|
+
let e = !1;
|
|
1233
|
+
return function() {
|
|
1234
|
+
e || (e = !0, window.requestAnimationFrame(() => {
|
|
1235
|
+
e = !1, t();
|
|
1236
|
+
}));
|
|
1237
|
+
};
|
|
1238
|
+
}
|
|
1239
|
+
function qe(t, e) {
|
|
1240
|
+
let n = 0;
|
|
1241
|
+
return function() {
|
|
1242
|
+
n && window.clearTimeout(n), n = window.setTimeout(() => {
|
|
1243
|
+
n = 0, t();
|
|
1244
|
+
}, e);
|
|
1245
|
+
};
|
|
1246
|
+
}
|
|
1247
|
+
function kn(t, e) {
|
|
1248
|
+
const n = t.match(/^calc\s*\(\s*(-?\d+((px)|([lsd]?vh)|([lsd]?vw)))\s*\+\s*(-?\d+((px)|([lsd]?vh)|([lsd]?vw)))\s*\)\s*$/);
|
|
1249
|
+
return oe(n[1], e) + oe(n[6], e);
|
|
1250
|
+
}
|
|
1251
|
+
function oe(t, e) {
|
|
1252
|
+
return t ? /^-?\d+px$/.test(t) ? parseInt(t) : /^-?\d+[lsd]?vh$/.test(t) ? parseInt(t) * e.viewportHeight / 100 : /^-?\d+[lsd]?vw$/.test(t) ? parseInt(t) * e.viewportWidth / 100 : /^calc\s*\(\s*-?\d+((px)|([lsd]?vh)|([lsd]?vw))\s*\+\s*-?\d+((px)|([lsd]?vh)|([lsd]?vw))\s*\)\s*$/.test(t) ? kn(t, e) : parseInt(t) || 0 : 0;
|
|
1253
|
+
}
|
|
1254
|
+
function R(t, e, n) {
|
|
1255
|
+
const { name: s, offset: i = 0 } = t, { start: r, end: o } = n, a = o - r, c = i / 100;
|
|
1256
|
+
let l, f;
|
|
1257
|
+
return s === "entry" ? (l = r - e, f = Math.min(e, a)) : s === "entry-crossing" ? (l = r - e, f = a) : s === "contain" ? (l = Math.min(o - e, r), f = Math.abs(e - a)) : s === "exit" ? (l = Math.max(r, o - e), f = Math.min(e, a)) : s === "exit-crossing" ? (l = r, f = a) : s === "cover" && (l = r - e, f = a + e), l + c * f | 0;
|
|
1258
|
+
}
|
|
1259
|
+
function fe(t, e, n, s, i) {
|
|
1260
|
+
let r = 0;
|
|
1261
|
+
const o = { start: e, end: n };
|
|
1262
|
+
return t.forEach((a, c) => {
|
|
1263
|
+
r += a.offset;
|
|
1264
|
+
const l = a.sticky;
|
|
1265
|
+
if (l) {
|
|
1266
|
+
if ("end" in l && t[c - 1]?.element) {
|
|
1267
|
+
const d = ((i ? a.element.offsetWidth : a.element.offsetHeight) || 0) + l.end - s, g = r + d - a.offset, p = g < o.start, m = !p && g <= n;
|
|
1268
|
+
let h = 0;
|
|
1269
|
+
(p || m) && (h = a.offset, o.end += h), p && (o.start += h);
|
|
1270
|
+
}
|
|
1271
|
+
if ("start" in l) {
|
|
1272
|
+
const f = r - l.start, u = f < o.start, d = !u && f <= o.end;
|
|
1273
|
+
let g = 0;
|
|
1274
|
+
const p = t[c - 1]?.element;
|
|
1275
|
+
if (p) {
|
|
1276
|
+
if (u || d) {
|
|
1277
|
+
const m = (i ? p.offsetWidth : p.offsetHeight) || 0, h = a.offset, v = (i ? a.element.offsetWidth : a.element.offsetHeight) || 0;
|
|
1278
|
+
g = m - (h + v), r += g, o.end += g;
|
|
1279
|
+
}
|
|
1280
|
+
u && (o.start += g);
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
}), o;
|
|
1285
|
+
}
|
|
1286
|
+
function $n(t, e, n, s, i, r) {
|
|
1287
|
+
const { start: o, end: a, duration: c } = t;
|
|
1288
|
+
let l = o, f = a, u = t.startRange, d = t.endRange, g;
|
|
1289
|
+
if (typeof c == "string") {
|
|
1290
|
+
u = { name: c, offset: 0 }, d = { name: c, offset: 100 }, l = R(u, n, e), f = R(d, n, e), g = f - l;
|
|
1291
|
+
const p = fe(r, l, f, n, s);
|
|
1292
|
+
l = p.start, f = p.end;
|
|
1293
|
+
} else {
|
|
1294
|
+
if (u || o?.name) {
|
|
1295
|
+
u = u || o;
|
|
1296
|
+
const p = oe(u.add, i), m = R({ ...u, offset: 0 }, n, e), h = R({ ...u, offset: 100 }, n, e), v = fe(r, m, h, n, s);
|
|
1297
|
+
l = v.start + u.offset / 100 * (v.end - v.start) + p;
|
|
1298
|
+
}
|
|
1299
|
+
if (d || a?.name) {
|
|
1300
|
+
d = d || a;
|
|
1301
|
+
const p = oe(d.add, i), m = R({ ...d, offset: 0 }, n, e), h = R({ ...d, offset: 100 }, n, e), v = fe(r, m, h, n, s);
|
|
1302
|
+
f = v.start + d.offset / 100 * (v.end - v.start) + p;
|
|
1303
|
+
} else typeof c == "number" && (f = l + c);
|
|
1304
|
+
}
|
|
1305
|
+
return !g && !c && (g = f - l), { ...t, start: l, end: f, startRange: u, endRange: d, duration: g || c };
|
|
1306
|
+
}
|
|
1307
|
+
function _n(t) {
|
|
1308
|
+
return t.position === "sticky";
|
|
1309
|
+
}
|
|
1310
|
+
function qn(t, e, n) {
|
|
1311
|
+
return t.position === "fixed" && (!e || e === window.document.body || e === n);
|
|
1312
|
+
}
|
|
1313
|
+
function Mn(t, e) {
|
|
1314
|
+
return parseInt(e ? t.left : t.top);
|
|
1315
|
+
}
|
|
1316
|
+
function xn(t, e) {
|
|
1317
|
+
return parseInt(e ? t.right : t.bottom);
|
|
1318
|
+
}
|
|
1319
|
+
function Pn(t, e, n) {
|
|
1320
|
+
n && (t.style.position = "static");
|
|
1321
|
+
const s = (e ? t.offsetLeft : t.offsetTop) || 0;
|
|
1322
|
+
return n && (t.style.position = null), s;
|
|
1323
|
+
}
|
|
1324
|
+
function Ln(t, e) {
|
|
1325
|
+
let n;
|
|
1326
|
+
const s = Mn(t, e), i = xn(t, e), r = !isNaN(s), o = !isNaN(i);
|
|
1327
|
+
return (r || o) && (n = {}, r && (n.start = s), o && (n.end = i)), n;
|
|
1328
|
+
}
|
|
1329
|
+
function Q(t, e, n, s, i) {
|
|
1330
|
+
const r = t[0].viewSource, o = [];
|
|
1331
|
+
let a = (s ? r.offsetWidth : r.offsetHeight) || 0, c = 0, l = r;
|
|
1332
|
+
for (; l; ) {
|
|
1333
|
+
const u = window.getComputedStyle(l), d = _n(u), g = d ? Ln(u, s) : void 0, p = Pn(l, s, d);
|
|
1334
|
+
if ((!g || !("end" in g)) && (c += p), o.push({ element: l, offset: p, sticky: g }), l = l.offsetParent, qn(u, l, e))
|
|
1335
|
+
break;
|
|
1336
|
+
if (l === e) {
|
|
1337
|
+
o.push({ element: l, offset: 0 });
|
|
1338
|
+
break;
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
return o.reverse(), t.map((u) => ({
|
|
1342
|
+
...$n(
|
|
1343
|
+
u,
|
|
1344
|
+
{ start: c, end: c + a },
|
|
1345
|
+
n,
|
|
1346
|
+
s,
|
|
1347
|
+
i,
|
|
1348
|
+
o
|
|
1349
|
+
)
|
|
1350
|
+
}));
|
|
1351
|
+
}
|
|
1352
|
+
const Me = 100, Rn = {
|
|
1353
|
+
horizontal: !1,
|
|
1354
|
+
observeViewportEntry: !0,
|
|
1355
|
+
viewportRootMargin: "7% 7%",
|
|
1356
|
+
observeViewportResize: !1,
|
|
1357
|
+
observeSourcesResize: !1,
|
|
1358
|
+
observeContentResize: !1
|
|
1359
|
+
};
|
|
1360
|
+
function Fn(t, e, n, s) {
|
|
1361
|
+
let i = 0;
|
|
1362
|
+
return t >= e && t <= n ? i = s ? (t - e) / s : 1 : t > n && (i = 1), i;
|
|
1363
|
+
}
|
|
1364
|
+
function xe(t, e) {
|
|
1365
|
+
return t === window ? e ? window.document.documentElement.clientWidth : window.document.documentElement.clientHeight : e ? t.clientWidth : t.clientHeight;
|
|
1366
|
+
}
|
|
1367
|
+
function Nn() {
|
|
1368
|
+
return {
|
|
1369
|
+
viewportWidth: window.document.documentElement.clientWidth,
|
|
1370
|
+
viewportHeight: window.document.documentElement.clientHeight
|
|
1371
|
+
};
|
|
1372
|
+
}
|
|
1373
|
+
function zn(t) {
|
|
1374
|
+
const e = et(t, Rn), n = e.root, s = e.horizontal, i = /* @__PURE__ */ new WeakMap();
|
|
1375
|
+
let r = xe(n, s), o, a, c, l, f;
|
|
1376
|
+
const u = [], d = Nn();
|
|
1377
|
+
if (e.scenes = Object.values(
|
|
1378
|
+
// TODO(ameerf): find a polyfill and use groupBy instead of following reduce
|
|
1379
|
+
t.scenes.reduce(
|
|
1380
|
+
(m, h, v) => {
|
|
1381
|
+
const y = h.groupId ? `group-${h.groupId}` : String(v);
|
|
1382
|
+
return m[y] ? m[y].push(h) : m[y] = [h], m;
|
|
1383
|
+
},
|
|
1384
|
+
{}
|
|
1385
|
+
)
|
|
1386
|
+
).flatMap((m) => (m.every((h) => h.viewSource && (typeof h.duration == "string" || h.start?.name)) ? (m = Q(m, n, r, s, d), (e.observeSourcesResize || e.observeContentResize) && u.push(m)) : m.forEach((h) => {
|
|
1387
|
+
h.end == null && (h.end = h.start + h.duration), h.duration == null && (h.duration = h.end - h.start);
|
|
1388
|
+
}), m)), e.scenes.forEach((m, h) => {
|
|
1389
|
+
m.index = h;
|
|
1390
|
+
}), u.length) {
|
|
1391
|
+
const m = /* @__PURE__ */ new Map();
|
|
1392
|
+
window.ResizeObserver && (c = new window.ResizeObserver(function(h) {
|
|
1393
|
+
h.forEach((v) => {
|
|
1394
|
+
const y = m.get(v.target), E = Q(y, n, r, s, d);
|
|
1395
|
+
E.forEach((w, S) => {
|
|
1396
|
+
e.scenes[w.index] = E[S];
|
|
1397
|
+
}), u.splice(u.indexOf(y), 1, E);
|
|
1398
|
+
});
|
|
1399
|
+
}), u.forEach((h) => {
|
|
1400
|
+
c.observe(h[0].viewSource, { box: "border-box" }), m.set(h[0].viewSource, h);
|
|
1401
|
+
}), e.observeContentResize && e.contentRoot && new window.ResizeObserver(qe(() => {
|
|
1402
|
+
const v = u.map((y) => {
|
|
1403
|
+
const E = Q(y, n, r, s, d);
|
|
1404
|
+
return E.forEach((w, S) => {
|
|
1405
|
+
e.scenes[w.index] = E[S];
|
|
1406
|
+
}), E;
|
|
1407
|
+
});
|
|
1408
|
+
u.length = 0, u.push(...v), u.forEach((y) => {
|
|
1409
|
+
m.set(y[0].viewSource, y);
|
|
1410
|
+
});
|
|
1411
|
+
}, Me)).observe(e.contentRoot, { box: "border-box" })), e.observeViewportResize && (l = qe(function() {
|
|
1412
|
+
r = xe(n, s);
|
|
1413
|
+
const h = u.map((v) => {
|
|
1414
|
+
const y = Q(v, n, r, s, d);
|
|
1415
|
+
return y.forEach((E, w) => {
|
|
1416
|
+
e.scenes[E.index] = y[w];
|
|
1417
|
+
}), y;
|
|
1418
|
+
});
|
|
1419
|
+
u.length = 0, u.push(...h), u.forEach((v) => {
|
|
1420
|
+
m.set(v[0].viewSource, v);
|
|
1421
|
+
});
|
|
1422
|
+
}, Me), n === window ? window.addEventListener("resize", l) : window.ResizeObserver && (f = new window.ResizeObserver(l), f.observe(n, { box: "border-box" })));
|
|
1423
|
+
}
|
|
1424
|
+
e.observeViewportEntry && window.IntersectionObserver && (a = new window.IntersectionObserver(function(m) {
|
|
1425
|
+
m.forEach((h) => {
|
|
1426
|
+
(i.get(h.target) || []).forEach((v) => {
|
|
1427
|
+
v.disabled = !h.isIntersecting;
|
|
1428
|
+
});
|
|
1429
|
+
});
|
|
1430
|
+
}, {
|
|
1431
|
+
root: n === window ? window.document : n,
|
|
1432
|
+
rootMargin: e.viewportRootMargin,
|
|
1433
|
+
threshold: 0
|
|
1434
|
+
}), e.scenes.forEach((m) => {
|
|
1435
|
+
if (m.viewSource) {
|
|
1436
|
+
let h = i.get(m.viewSource);
|
|
1437
|
+
h || (h = [], i.set(m.viewSource, h), a.observe(m.viewSource)), h.push(m);
|
|
1438
|
+
}
|
|
1439
|
+
}));
|
|
1440
|
+
function g({ p: m, vp: h }) {
|
|
1441
|
+
m = +m.toFixed(1);
|
|
1442
|
+
const v = +h.toFixed(4);
|
|
1443
|
+
if (m !== o) {
|
|
1444
|
+
for (let y of e.scenes)
|
|
1445
|
+
if (!y.disabled) {
|
|
1446
|
+
const { start: E, end: w, duration: S } = y, T = Fn(m, E, w, S);
|
|
1447
|
+
y.effect(y, T, v);
|
|
1448
|
+
}
|
|
1449
|
+
o = m;
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
function p() {
|
|
1453
|
+
e.scenes.forEach((m) => m.destroy?.()), a && (a.disconnect(), a = null), c && (c.disconnect(), c = null), l && (f ? (f.disconnect(), f = null) : window.removeEventListener("resize", l));
|
|
1454
|
+
}
|
|
1455
|
+
return {
|
|
1456
|
+
tick: g,
|
|
1457
|
+
destroy: p
|
|
1458
|
+
};
|
|
1459
|
+
}
|
|
1460
|
+
const Hn = {
|
|
1461
|
+
transitionActive: !1,
|
|
1462
|
+
transitionFriction: 0.9,
|
|
1463
|
+
transitionEpsilon: 1,
|
|
1464
|
+
velocityActive: !1,
|
|
1465
|
+
velocityMax: 1
|
|
1466
|
+
};
|
|
1467
|
+
class jn {
|
|
1468
|
+
constructor(e = {}) {
|
|
1469
|
+
this.config = et(e, Hn), this.progress = {
|
|
1470
|
+
p: 0,
|
|
1471
|
+
prevP: 0,
|
|
1472
|
+
vp: 0
|
|
1473
|
+
}, this.currentProgress = {
|
|
1474
|
+
p: 0,
|
|
1475
|
+
prevP: 0,
|
|
1476
|
+
vp: 0
|
|
1477
|
+
}, this._lerpFrameId = 0, this.effect = null;
|
|
1478
|
+
const n = !this.config.root || this.config.root === window.document.body;
|
|
1479
|
+
this.config.root = n ? window : this.config.root, this.config.contentRoot = this.config.contentRoot || (n ? window.document.body : this.config.root.firstElementChild), this.config.resetProgress = this.config.resetProgress || this.resetProgress.bind(this), this._measure = this.config.measure || (() => {
|
|
1480
|
+
const s = this.config.root;
|
|
1481
|
+
this.progress.p = this.config.horizontal ? s.scrollX || s.scrollLeft || 0 : s.scrollY || s.scrollTop || 0;
|
|
1482
|
+
}), this._trigger = Cn(() => {
|
|
1483
|
+
this._measure?.(), this.tick(!0);
|
|
1484
|
+
});
|
|
1485
|
+
}
|
|
1486
|
+
/**
|
|
1487
|
+
* Setup event and effect, and reset progress and frame.
|
|
1488
|
+
*/
|
|
1489
|
+
start() {
|
|
1490
|
+
this.setupEffect(), this.setupEvent(), this.resetProgress(), this.tick();
|
|
1491
|
+
}
|
|
1492
|
+
/**
|
|
1493
|
+
* Removes event listener.
|
|
1494
|
+
*/
|
|
1495
|
+
pause() {
|
|
1496
|
+
this.removeEvent();
|
|
1497
|
+
}
|
|
1498
|
+
/**
|
|
1499
|
+
* Reset progress in the DOM and inner state to given x and y.
|
|
1500
|
+
*
|
|
1501
|
+
* @param {Object} [scrollPosition]
|
|
1502
|
+
* @param {number} [scrollPosition.x]
|
|
1503
|
+
* @param {number} [scrollPosition.y]
|
|
1504
|
+
*/
|
|
1505
|
+
resetProgress(e = {}) {
|
|
1506
|
+
const n = this.config.root, s = e.x || e.x === 0 ? e.x : n.scrollX || n.scrollLeft || 0, i = e.y || e.y === 0 ? e.y : n.scrollY || n.scrollTop || 0, r = this.config.horizontal ? s : i;
|
|
1507
|
+
this.progress.p = r, this.progress.prevP = r, this.progress.vp = 0, this.config.transitionActive && (this.currentProgress.p = r, this.currentProgress.prevP = r, this.currentProgress.vp = 0), e && this.config.root.scrollTo(s, i);
|
|
1508
|
+
}
|
|
1509
|
+
/**
|
|
1510
|
+
* Handle animation frame work.
|
|
1511
|
+
*
|
|
1512
|
+
* @param {boolean} [clearLerpFrame] whether to cancel an existing lerp frame
|
|
1513
|
+
*/
|
|
1514
|
+
tick(e) {
|
|
1515
|
+
const n = this.config.transitionActive;
|
|
1516
|
+
n && this.lerp();
|
|
1517
|
+
const s = n ? this.currentProgress : this.progress;
|
|
1518
|
+
if (this.config.velocityActive) {
|
|
1519
|
+
const i = s.p - s.prevP, r = i < 0 ? -1 : 1;
|
|
1520
|
+
s.vp = Math.min(this.config.velocityMax, Math.abs(i)) / this.config.velocityMax * r;
|
|
1521
|
+
}
|
|
1522
|
+
this.effect.tick(s), n && s.p !== this.progress.p && (e && this._lerpFrameId && window.cancelAnimationFrame(this._lerpFrameId), this._lerpFrameId = window.requestAnimationFrame(() => this.tick())), s.prevP = s.p;
|
|
1523
|
+
}
|
|
1524
|
+
/**
|
|
1525
|
+
* Calculate current progress.
|
|
1526
|
+
*/
|
|
1527
|
+
lerp() {
|
|
1528
|
+
this.currentProgress.p = An(this.currentProgress.p, this.progress.p, +(1 - this.config.transitionFriction).toFixed(3), this.config.transitionEpsilon);
|
|
1529
|
+
}
|
|
1530
|
+
/**
|
|
1531
|
+
* Stop the event and effect, and remove all DOM side-effects.
|
|
1532
|
+
*/
|
|
1533
|
+
destroy() {
|
|
1534
|
+
this.pause(), this.removeEffect();
|
|
1535
|
+
}
|
|
1536
|
+
/**
|
|
1537
|
+
* Register to scroll for triggering update.
|
|
1538
|
+
*/
|
|
1539
|
+
setupEvent() {
|
|
1540
|
+
this.removeEvent(), this.config.root.addEventListener("scroll", this._trigger);
|
|
1541
|
+
}
|
|
1542
|
+
/**
|
|
1543
|
+
* Remove scroll handler.
|
|
1544
|
+
*/
|
|
1545
|
+
removeEvent() {
|
|
1546
|
+
this.config.root.removeEventListener("scroll", this._trigger);
|
|
1547
|
+
}
|
|
1548
|
+
/**
|
|
1549
|
+
* Reset registered effect.
|
|
1550
|
+
*/
|
|
1551
|
+
setupEffect() {
|
|
1552
|
+
this.removeEffect(), this.effect = zn(this.config);
|
|
1553
|
+
}
|
|
1554
|
+
/**
|
|
1555
|
+
* Remove registered effect.
|
|
1556
|
+
*/
|
|
1557
|
+
removeEffect() {
|
|
1558
|
+
this.effect && this.effect.destroy(), this.effect = null;
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
const he = /* @__PURE__ */ new WeakMap();
|
|
1562
|
+
let tt = () => ({});
|
|
1563
|
+
function Dn(t) {
|
|
1564
|
+
tt = t;
|
|
1565
|
+
}
|
|
1566
|
+
function Gn(t, e, n, s, { reducedMotion: i }) {
|
|
1567
|
+
if (i)
|
|
1568
|
+
return;
|
|
1569
|
+
const r = {
|
|
1570
|
+
trigger: "view-progress",
|
|
1571
|
+
element: t
|
|
1572
|
+
}, o = q(n);
|
|
1573
|
+
let a;
|
|
1574
|
+
if ("ViewTimeline" in window) {
|
|
1575
|
+
const l = Y(
|
|
1576
|
+
e,
|
|
1577
|
+
o,
|
|
1578
|
+
r
|
|
1579
|
+
);
|
|
1580
|
+
l && !l.isCSS && (l.play(), a = () => {
|
|
1581
|
+
l.ready.then(() => {
|
|
1582
|
+
l.cancel();
|
|
1583
|
+
});
|
|
1584
|
+
});
|
|
1585
|
+
} else {
|
|
1586
|
+
const l = Ke(e, o, r);
|
|
1587
|
+
if (l) {
|
|
1588
|
+
const f = Array.isArray(l) ? l : [l], u = new jn({
|
|
1589
|
+
viewSource: t,
|
|
1590
|
+
scenes: f,
|
|
1591
|
+
observeViewportEntry: !1,
|
|
1592
|
+
observeViewportResize: !1,
|
|
1593
|
+
observeSourcesResize: !0,
|
|
1594
|
+
root: document.body,
|
|
1595
|
+
...tt()
|
|
1596
|
+
});
|
|
1597
|
+
a = () => {
|
|
1598
|
+
u.destroy();
|
|
1599
|
+
}, Promise.all(f.map((d) => d.ready || Promise.resolve())).then(
|
|
1600
|
+
() => {
|
|
1601
|
+
u.start();
|
|
1602
|
+
}
|
|
1603
|
+
);
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
if (!a) return;
|
|
1607
|
+
const c = { source: t, target: e, cleanup: a };
|
|
1608
|
+
C(he, t, c), C(he, e, c);
|
|
1609
|
+
}
|
|
1610
|
+
function Wn(t) {
|
|
1611
|
+
B(he, t);
|
|
1612
|
+
}
|
|
1613
|
+
const Vn = {
|
|
1614
|
+
add: Gn,
|
|
1615
|
+
remove: Wn,
|
|
1616
|
+
registerOptionsGetter: Dn
|
|
1617
|
+
};
|
|
1618
|
+
function Pe(t, e, n) {
|
|
1619
|
+
return Math.min(Math.max(t, n), e);
|
|
1620
|
+
}
|
|
1621
|
+
function Le(t) {
|
|
1622
|
+
let e = !1;
|
|
1623
|
+
return function() {
|
|
1624
|
+
if (!e)
|
|
1625
|
+
return e = !0, window.requestAnimationFrame(() => {
|
|
1626
|
+
e = !1, t();
|
|
1627
|
+
});
|
|
1628
|
+
};
|
|
1629
|
+
}
|
|
1630
|
+
function Yn(t) {
|
|
1631
|
+
let e = t, n = 0, s = 0;
|
|
1632
|
+
if (e.offsetParent)
|
|
1633
|
+
do
|
|
1634
|
+
n += e.offsetLeft, s += e.offsetTop, e = e.offsetParent;
|
|
1635
|
+
while (e);
|
|
1636
|
+
return {
|
|
1637
|
+
left: n,
|
|
1638
|
+
top: s,
|
|
1639
|
+
width: t.offsetWidth,
|
|
1640
|
+
height: t.offsetHeight
|
|
1641
|
+
};
|
|
1642
|
+
}
|
|
1643
|
+
function Bn() {
|
|
1644
|
+
const t = window.devicePixelRatio;
|
|
1645
|
+
let e = !1;
|
|
1646
|
+
if (t === 1)
|
|
1647
|
+
return !1;
|
|
1648
|
+
document.body.addEventListener("pointerdown", (s) => {
|
|
1649
|
+
e = s.offsetX !== 10;
|
|
1650
|
+
}, { once: !0 });
|
|
1651
|
+
const n = new PointerEvent("pointerdown", {
|
|
1652
|
+
clientX: 10
|
|
1653
|
+
});
|
|
1654
|
+
return document.body.dispatchEvent(n), e;
|
|
1655
|
+
}
|
|
1656
|
+
function Kn() {
|
|
1657
|
+
return new Promise((t) => {
|
|
1658
|
+
const e = window.scrollY;
|
|
1659
|
+
let n = !1, s;
|
|
1660
|
+
function i() {
|
|
1661
|
+
document.body.addEventListener("pointerdown", (a) => {
|
|
1662
|
+
s === void 0 ? s = a.offsetY : n = a.offsetY === s;
|
|
1663
|
+
}, { once: !0 });
|
|
1664
|
+
const o = new PointerEvent("pointerdown", {
|
|
1665
|
+
clientY: 500
|
|
1666
|
+
});
|
|
1667
|
+
document.body.dispatchEvent(o);
|
|
1668
|
+
}
|
|
1669
|
+
function r() {
|
|
1670
|
+
window.scrollY !== e && (window.removeEventListener("scroll", r), i(), t(n));
|
|
1671
|
+
}
|
|
1672
|
+
i(), window.addEventListener("scroll", r), window.scrollY > 0 && window.scrollBy(0, -1);
|
|
1673
|
+
});
|
|
1674
|
+
}
|
|
1675
|
+
function Qn(t) {
|
|
1676
|
+
Kn().then((e) => {
|
|
1677
|
+
t.fixRequired = e, e && (window.addEventListener("scroll", t.scrollHandler), t.scrollHandler());
|
|
1678
|
+
});
|
|
1679
|
+
}
|
|
1680
|
+
let U = 0;
|
|
1681
|
+
const ne = /* @__PURE__ */ new Set();
|
|
1682
|
+
function Un() {
|
|
1683
|
+
const t = (n) => {
|
|
1684
|
+
for (let s of n.changedTouches)
|
|
1685
|
+
ne.add(s.identifier);
|
|
1686
|
+
}, e = (n) => {
|
|
1687
|
+
for (let s of n.changedTouches)
|
|
1688
|
+
ne.delete(s.identifier);
|
|
1689
|
+
};
|
|
1690
|
+
return document.addEventListener("touchstart", t, { passive: !0 }), document.addEventListener("touchend", e, { passive: !0 }), function() {
|
|
1691
|
+
ne.clear(), document.removeEventListener("touchstart", t), document.removeEventListener("touchend", e);
|
|
1692
|
+
};
|
|
1693
|
+
}
|
|
1694
|
+
function Xn(t, e) {
|
|
1695
|
+
if ("onscrollend" in window)
|
|
1696
|
+
return t.addEventListener("scrollend", e), function() {
|
|
1697
|
+
t.removeEventListener("scrollend", e);
|
|
1698
|
+
};
|
|
1699
|
+
let n = 0, s;
|
|
1700
|
+
U || (s = Un()), U += 1;
|
|
1701
|
+
function i(r) {
|
|
1702
|
+
clearTimeout(n), n = setTimeout(() => {
|
|
1703
|
+
ne.size ? setTimeout(i, 100) : (e(r), n = 0);
|
|
1704
|
+
}, 100);
|
|
1705
|
+
}
|
|
1706
|
+
return t.addEventListener("scroll", i), function() {
|
|
1707
|
+
t.removeEventListener("scroll", i), U -= 1, U || s();
|
|
1708
|
+
};
|
|
1709
|
+
}
|
|
1710
|
+
function Zn(t, e, n) {
|
|
1711
|
+
return {
|
|
1712
|
+
x(s) {
|
|
1713
|
+
const i = t.left - n.x + t.width / 2, r = i >= e.width / 2, o = (r ? i : e.width - i) * 2, a = r ? 0 : i - o / 2;
|
|
1714
|
+
return (s - a) / o;
|
|
1715
|
+
},
|
|
1716
|
+
y(s) {
|
|
1717
|
+
const i = t.top - n.y + t.height / 2, r = i >= e.height / 2, o = (r ? i : e.height - i) * 2, a = r ? 0 : i - o / 2;
|
|
1718
|
+
return (s - a) / o;
|
|
1719
|
+
}
|
|
1720
|
+
};
|
|
1721
|
+
}
|
|
1722
|
+
function Jn(t, e) {
|
|
1723
|
+
this.x = window.scrollX, this.y = window.scrollY, requestAnimationFrame(() => t && t(e));
|
|
1724
|
+
}
|
|
1725
|
+
function es(t) {
|
|
1726
|
+
t.rect.width = window.document.documentElement.clientWidth, t.rect.height = window.document.documentElement.clientHeight;
|
|
1727
|
+
}
|
|
1728
|
+
function ts(t) {
|
|
1729
|
+
const e = new ResizeObserver((n) => {
|
|
1730
|
+
n.forEach((s) => {
|
|
1731
|
+
t.rect.width = s.borderBoxSize[0].inlineSize, t.rect.height = s.borderBoxSize[0].blockSize;
|
|
1732
|
+
});
|
|
1733
|
+
});
|
|
1734
|
+
return e.observe(t.root, { box: "border-box" }), e;
|
|
1735
|
+
}
|
|
1736
|
+
function ns(t) {
|
|
1737
|
+
let e = !1, n = { x: t.rect.width / 2, y: t.rect.height / 2, vx: 0, vy: 0 }, s, i, r, o, a;
|
|
1738
|
+
const c = { x: 0, y: 0 };
|
|
1739
|
+
t.scenes.forEach((f) => {
|
|
1740
|
+
f.target && f.centeredToTarget && (f.transform = Zn(Yn(f.target), t.rect, c), e = !0), t.root ? i = ts(t) : (r = es.bind(null, t), window.addEventListener("resize", r));
|
|
1741
|
+
}), s = function(f) {
|
|
1742
|
+
for (let u of t.scenes)
|
|
1743
|
+
if (!u.disabled) {
|
|
1744
|
+
const d = u.transform?.x(f.x) || f.x / t.rect.width, g = u.transform?.y(f.y) || f.y / t.rect.height, p = +Pe(0, 1, d).toPrecision(4), m = +Pe(0, 1, g).toPrecision(4), h = { x: f.vx, y: f.vy };
|
|
1745
|
+
t.allowActiveEvent && (f.active = d <= 1 && g <= 1 && d >= 0 && g >= 0), u.effect(u, { x: p, y: m }, h, f.active);
|
|
1746
|
+
}
|
|
1747
|
+
Object.assign(n, f);
|
|
1748
|
+
}, e && (o = Jn.bind(c, s, n), a = Xn(document, o));
|
|
1749
|
+
function l() {
|
|
1750
|
+
t.scenes.forEach((f) => f.destroy?.()), a?.(), i ? (i.disconnect(), i = null) : (window.removeEventListener("resize", r), r = null), s = null, n = null;
|
|
1751
|
+
}
|
|
1752
|
+
return {
|
|
1753
|
+
tick: s,
|
|
1754
|
+
destroy: l
|
|
1755
|
+
};
|
|
1756
|
+
}
|
|
1757
|
+
const ss = 1e3 / 60 * 3;
|
|
1758
|
+
let X;
|
|
1759
|
+
function is() {
|
|
1760
|
+
F.x = window.scrollX, F.y = window.scrollY;
|
|
1761
|
+
}
|
|
1762
|
+
const F = { x: 0, y: 0, scrollHandler: is, fixRequired: void 0 };
|
|
1763
|
+
class rs {
|
|
1764
|
+
constructor(e = {}) {
|
|
1765
|
+
this.config = { ...e }, this.effect = null, this._nextTick = null, this._nextTransitionTick = null, this._startTime = 0;
|
|
1766
|
+
let n;
|
|
1767
|
+
this.config.transitionDuration ? n = this.config.noThrottle ? () => this.transition() : Le(() => this.transition()) : n = this.config.noThrottle ? () => (this.tick(), null) : Le(() => {
|
|
1768
|
+
this.tick();
|
|
1769
|
+
}), this.config.rect = this.config.root ? {
|
|
1770
|
+
width: this.config.root.offsetWidth,
|
|
1771
|
+
height: this.config.root.offsetHeight
|
|
1772
|
+
} : {
|
|
1773
|
+
width: window.document.documentElement.clientWidth,
|
|
1774
|
+
height: window.document.documentElement.clientHeight
|
|
1775
|
+
}, this.progress = {
|
|
1776
|
+
x: this.config.rect.width / 2,
|
|
1777
|
+
y: this.config.rect.height / 2,
|
|
1778
|
+
vx: 0,
|
|
1779
|
+
vy: 0
|
|
1780
|
+
}, this.previousProgress = { ...this.progress }, this.currentProgress = null;
|
|
1781
|
+
const s = (i) => {
|
|
1782
|
+
const r = this.config.root ? i.offsetX : i.x, o = this.config.root ? i.offsetY : i.y;
|
|
1783
|
+
this.progress.vx = r - this.progress.x, this.progress.vy = o - this.progress.y, this.progress.x = r, this.progress.y = o, this._nextTick = n();
|
|
1784
|
+
};
|
|
1785
|
+
if (this._pointerLeave = () => {
|
|
1786
|
+
this.progress.active = !1, this.progress.vx = 0, this.progress.vy = 0, this._nextTick = n();
|
|
1787
|
+
}, this._pointerEnter = () => {
|
|
1788
|
+
this.progress.active = !0, this._nextTick = n();
|
|
1789
|
+
}, this.config.root) {
|
|
1790
|
+
X = typeof X == "boolean" ? X : Bn();
|
|
1791
|
+
const i = X ? window.devicePixelRatio : 1;
|
|
1792
|
+
typeof F.fixRequired > "u" && Qn(F), this._measure = (r) => {
|
|
1793
|
+
if (r.target !== this.config.root) {
|
|
1794
|
+
const o = new PointerEvent("pointermove", {
|
|
1795
|
+
bubbles: !0,
|
|
1796
|
+
cancelable: !0,
|
|
1797
|
+
clientX: r.x * i + F.x,
|
|
1798
|
+
clientY: r.y * i + F.y
|
|
1799
|
+
});
|
|
1800
|
+
r.stopPropagation(), this.config.root.dispatchEvent(o);
|
|
1801
|
+
} else
|
|
1802
|
+
s(r);
|
|
1803
|
+
};
|
|
1804
|
+
} else
|
|
1805
|
+
this._measure = s;
|
|
1806
|
+
}
|
|
1807
|
+
/**
|
|
1808
|
+
* Setup event and effect, and reset progress and frame.
|
|
1809
|
+
*/
|
|
1810
|
+
start() {
|
|
1811
|
+
this.setupEffect(), this.setupEvent();
|
|
1812
|
+
}
|
|
1813
|
+
/**
|
|
1814
|
+
* Removes event listener.
|
|
1815
|
+
*/
|
|
1816
|
+
pause() {
|
|
1817
|
+
this.removeEvent();
|
|
1818
|
+
}
|
|
1819
|
+
/**
|
|
1820
|
+
* Handle animation frame work.
|
|
1821
|
+
*/
|
|
1822
|
+
tick() {
|
|
1823
|
+
this.effect.tick(this.progress);
|
|
1824
|
+
}
|
|
1825
|
+
/**
|
|
1826
|
+
* Starts a transition from the previous progress to the current progress.
|
|
1827
|
+
*
|
|
1828
|
+
* @returns {number} the requestAnimationFrame id for the transition tick.
|
|
1829
|
+
*/
|
|
1830
|
+
transition() {
|
|
1831
|
+
const e = this.config.transitionDuration, n = this.config.transitionEasing || ((o) => o), s = performance.now();
|
|
1832
|
+
let i = !1;
|
|
1833
|
+
const r = (o) => {
|
|
1834
|
+
const a = (o - this._startTime) / e, c = n(Math.min(1, a));
|
|
1835
|
+
i && (this.progress.vx = 0, this.progress.vy = 0, i = !1), this.currentProgress = Object.entries(this.progress).reduce((l, [f, u]) => (f === "active" ? l[f] = u : l[f] = this.previousProgress[f] + (u - this.previousProgress[f]) * c, l), this.currentProgress || {}), a < 1 && (this._nextTransitionTick = requestAnimationFrame(r), i = o - this._startTime > ss), this.effect.tick(this.currentProgress);
|
|
1836
|
+
};
|
|
1837
|
+
return this._startTime ? (this._nextTransitionTick && cancelAnimationFrame(this._nextTransitionTick), Object.assign(this.previousProgress, this.currentProgress), this._startTime = s, r(s)) : this._startTime = s, this._nextTransitionTick;
|
|
1838
|
+
}
|
|
1839
|
+
/**
|
|
1840
|
+
* Stop the event and effect, and remove all DOM side effects.
|
|
1841
|
+
*/
|
|
1842
|
+
destroy() {
|
|
1843
|
+
this.pause(), this.removeEffect(), this._nextTick && cancelAnimationFrame(this._nextTick), this._nextTransitionTick && cancelAnimationFrame(this._nextTransitionTick);
|
|
1844
|
+
}
|
|
1845
|
+
/**
|
|
1846
|
+
* Register to pointermove for triggering update.
|
|
1847
|
+
*/
|
|
1848
|
+
setupEvent() {
|
|
1849
|
+
this.removeEvent();
|
|
1850
|
+
const e = this.config.root || window;
|
|
1851
|
+
e.addEventListener("pointermove", this._measure, { passive: !0 }), this.config.eventSource && this.config.eventSource.addEventListener("pointermove", this._measure, { passive: !0 }), this.config.allowActiveEvent && (e.addEventListener("pointerleave", this._pointerLeave, { passive: !0 }), e.addEventListener("pointerenter", this._pointerEnter, { passive: !0 }), this.config.eventSource && (this.config.eventSource.addEventListener("pointerleave", this._pointerLeave, { passive: !0 }), this.config.eventSource.addEventListener("pointerenter", this._pointerEnter, { passive: !0 })));
|
|
1852
|
+
}
|
|
1853
|
+
/**
|
|
1854
|
+
* Remove pointermove handler.
|
|
1855
|
+
*/
|
|
1856
|
+
removeEvent() {
|
|
1857
|
+
const e = this.config.root || window;
|
|
1858
|
+
e.removeEventListener("pointermove", this._measure), this.config.eventSource && this.config.eventSource.removeEventListener("pointermove", this._measure), this.config.allowActiveEvent && (e.removeEventListener("pointerleave", this._pointerLeave), e.removeEventListener("pointerenter", this._pointerEnter), this.config.eventSource && (this.config.eventSource.removeEventListener("pointerleave", this._pointerLeave), this.config.eventSource.removeEventListener("pointerenter", this._pointerEnter)));
|
|
1859
|
+
}
|
|
1860
|
+
/**
|
|
1861
|
+
* Reset registered effect.
|
|
1862
|
+
*/
|
|
1863
|
+
setupEffect() {
|
|
1864
|
+
this.removeEffect(), this.effect = ns(this.config);
|
|
1865
|
+
}
|
|
1866
|
+
/**
|
|
1867
|
+
* Remove registered effect.
|
|
1868
|
+
*/
|
|
1869
|
+
removeEffect() {
|
|
1870
|
+
this.effect && this.effect.destroy(), this.effect = null;
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
const me = /* @__PURE__ */ new WeakMap();
|
|
1874
|
+
let nt = () => ({});
|
|
1875
|
+
function os(t) {
|
|
1876
|
+
nt = t;
|
|
1877
|
+
}
|
|
1878
|
+
function as(t, e, n, s = {}, { reducedMotion: i }) {
|
|
1879
|
+
if (i)
|
|
1880
|
+
return;
|
|
1881
|
+
const r = {
|
|
1882
|
+
trigger: "pointer-move",
|
|
1883
|
+
element: t,
|
|
1884
|
+
axis: s.axis ?? "y"
|
|
1885
|
+
}, o = Ke(e, q(n), r);
|
|
1886
|
+
if (o) {
|
|
1887
|
+
const a = Array.isArray(o) ? o : [o], c = new rs({
|
|
1888
|
+
root: s.hitArea === "self" ? t : void 0,
|
|
1889
|
+
scenes: a,
|
|
1890
|
+
...nt()
|
|
1891
|
+
}), f = { source: t, target: e, cleanup: () => {
|
|
1892
|
+
c.destroy();
|
|
1893
|
+
} };
|
|
1894
|
+
C(me, t, f), C(me, e, f), Promise.all(
|
|
1895
|
+
a.map((u) => u.ready || Promise.resolve())
|
|
1896
|
+
).then(() => {
|
|
1897
|
+
c.start();
|
|
1898
|
+
});
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
function cs(t) {
|
|
1902
|
+
B(me, t);
|
|
1903
|
+
}
|
|
1904
|
+
const fs = {
|
|
1905
|
+
add: as,
|
|
1906
|
+
remove: cs,
|
|
1907
|
+
registerOptionsGetter: os
|
|
1908
|
+
}, pe = /* @__PURE__ */ new WeakMap();
|
|
1909
|
+
function ls(t, e, n, s, {
|
|
1910
|
+
reducedMotion: i,
|
|
1911
|
+
selectorCondition: r,
|
|
1912
|
+
animation: o,
|
|
1913
|
+
sourceAnimationOptions: a
|
|
1914
|
+
}) {
|
|
1915
|
+
const c = o || Y(
|
|
1916
|
+
e,
|
|
1917
|
+
q(n),
|
|
1918
|
+
void 0,
|
|
1919
|
+
i
|
|
1920
|
+
);
|
|
1921
|
+
if (!c)
|
|
1922
|
+
return;
|
|
1923
|
+
const { effectId: l } = s, f = (g) => {
|
|
1924
|
+
if (r && !e.matches(r)) return;
|
|
1925
|
+
const p = g.animationName, m = g.detail?.effectId, h = a ? Be(t, a) : null;
|
|
1926
|
+
if (h) {
|
|
1927
|
+
if (h.playState === "running" || p && !h.hasAnimationName(p))
|
|
1928
|
+
return;
|
|
1929
|
+
if (m && m !== l && !h.hasAnimationId(m))
|
|
1930
|
+
return;
|
|
1931
|
+
}
|
|
1932
|
+
c.play();
|
|
1933
|
+
}, d = { source: t, target: e, cleanup: () => {
|
|
1934
|
+
c.cancel(), t.removeEventListener("animationend", f);
|
|
1935
|
+
} };
|
|
1936
|
+
C(pe, t, d), C(pe, e, d), t.addEventListener("animationend", f);
|
|
1937
|
+
}
|
|
1938
|
+
function us(t) {
|
|
1939
|
+
B(pe, t);
|
|
1940
|
+
}
|
|
1941
|
+
const ds = {
|
|
1942
|
+
add: ls,
|
|
1943
|
+
remove: us
|
|
1944
|
+
};
|
|
1945
|
+
function hs(t, e, n = !1, s, i, r) {
|
|
1946
|
+
const o = r || Y(
|
|
1947
|
+
t,
|
|
1948
|
+
q(e),
|
|
1949
|
+
void 0,
|
|
1950
|
+
n
|
|
1951
|
+
);
|
|
1952
|
+
if (!o)
|
|
1953
|
+
return null;
|
|
1954
|
+
let a = !0;
|
|
1955
|
+
const c = e.triggerType || "alternate";
|
|
1956
|
+
return (l) => {
|
|
1957
|
+
if (s && !t.matches(s)) return;
|
|
1958
|
+
const f = !i, u = i?.enter?.includes(l.type), d = i?.leave?.includes(l.type);
|
|
1959
|
+
if (u || f) {
|
|
1960
|
+
if (c === "alternate" || c === "state")
|
|
1961
|
+
a ? (a = !1, o.play()) : c === "alternate" ? o.reverse() : c === "state" && (o.playState === "running" ? o.pause() : o.playState !== "finished" && o.play());
|
|
1962
|
+
else {
|
|
1963
|
+
if (o.progress(0), delete t.dataset.interactEnter, o.isCSS) {
|
|
1964
|
+
const g = () => {
|
|
1965
|
+
O.mutate(() => {
|
|
1966
|
+
t.dataset.interactEnter = "done";
|
|
1967
|
+
});
|
|
1968
|
+
};
|
|
1969
|
+
o.onFinish(g), o.onAbort(g);
|
|
1970
|
+
}
|
|
1971
|
+
o.play();
|
|
1972
|
+
}
|
|
1973
|
+
return;
|
|
1974
|
+
}
|
|
1975
|
+
d && (c === "alternate" ? o.reverse() : c === "repeat" ? (o.cancel(), O.mutate(() => {
|
|
1976
|
+
delete t.dataset.interactEnter;
|
|
1977
|
+
})) : c === "state" && o.playState === "running" && o.pause());
|
|
1978
|
+
};
|
|
1979
|
+
}
|
|
1980
|
+
function ms(t, e, {
|
|
1981
|
+
effectId: n,
|
|
1982
|
+
listContainer: s,
|
|
1983
|
+
listItemSelector: i,
|
|
1984
|
+
stateAction: r
|
|
1985
|
+
}, o, a) {
|
|
1986
|
+
const c = !!s, l = r ?? "toggle", f = l === "toggle";
|
|
1987
|
+
return (u) => {
|
|
1988
|
+
if (o && !t.matches(o)) return;
|
|
1989
|
+
const d = c ? t.closest(
|
|
1990
|
+
`${s} > ${i || ""}:has(:scope)`
|
|
1991
|
+
) : void 0, g = !a, p = a?.enter?.includes(u.type), m = a?.leave?.includes(u.type);
|
|
1992
|
+
g ? e.toggleEffect(n, l, d) : (p && e.toggleEffect(n, f ? "add" : l, d), m && f && e.toggleEffect(n, "remove", d));
|
|
1993
|
+
};
|
|
1994
|
+
}
|
|
1995
|
+
const ge = /* @__PURE__ */ new WeakMap();
|
|
1996
|
+
function Re(t, e) {
|
|
1997
|
+
return (n) => {
|
|
1998
|
+
const s = n;
|
|
1999
|
+
t.contains(s.relatedTarget) || e(s);
|
|
2000
|
+
};
|
|
2001
|
+
}
|
|
2002
|
+
function ps(t) {
|
|
2003
|
+
return (e) => {
|
|
2004
|
+
const n = e;
|
|
2005
|
+
n.pointerType && t(n);
|
|
2006
|
+
};
|
|
2007
|
+
}
|
|
2008
|
+
function gs(t) {
|
|
2009
|
+
return (e) => {
|
|
2010
|
+
const n = e;
|
|
2011
|
+
n.code === "Space" ? (n.preventDefault(), t(n)) : n.code === "Enter" && t(n);
|
|
2012
|
+
};
|
|
2013
|
+
}
|
|
2014
|
+
const vs = {
|
|
2015
|
+
focusin: (t, e) => Re(t, e),
|
|
2016
|
+
focusout: (t, e) => Re(t, e),
|
|
2017
|
+
click: (t, e) => ps(e),
|
|
2018
|
+
keydown: (t, e) => gs(e)
|
|
2019
|
+
};
|
|
2020
|
+
function ys(t, e, n) {
|
|
2021
|
+
const s = vs[t];
|
|
2022
|
+
return s ? s(e, n) : (i) => n(i);
|
|
2023
|
+
}
|
|
2024
|
+
function Es(t) {
|
|
2025
|
+
return typeof t == "object" && !Array.isArray(t) && ("enter" in t || "leave" in t);
|
|
2026
|
+
}
|
|
2027
|
+
function ws(t) {
|
|
2028
|
+
if (typeof t == "string")
|
|
2029
|
+
return { toggle: [t] };
|
|
2030
|
+
if (Array.isArray(t))
|
|
2031
|
+
return { toggle: [...t] };
|
|
2032
|
+
if (Es(t)) {
|
|
2033
|
+
const e = t.enter ? [...t.enter] : [], n = t.leave ? [...t.leave] : [];
|
|
2034
|
+
return { enter: e, leave: n };
|
|
2035
|
+
}
|
|
2036
|
+
return {};
|
|
2037
|
+
}
|
|
2038
|
+
function bs(t) {
|
|
2039
|
+
return !!(t.enter?.length || t.leave?.length);
|
|
2040
|
+
}
|
|
2041
|
+
function Ss(t) {
|
|
2042
|
+
return bs(t) ? { enter: t.enter ?? [], leave: t.leave ?? [] } : void 0;
|
|
2043
|
+
}
|
|
2044
|
+
function Ts(t, e, n, s, {
|
|
2045
|
+
reducedMotion: i,
|
|
2046
|
+
targetController: r,
|
|
2047
|
+
selectorCondition: o,
|
|
2048
|
+
animation: a
|
|
2049
|
+
}) {
|
|
2050
|
+
const c = ws(s.eventConfig), l = n.transition || n.transitionProperties, f = Ss(c);
|
|
2051
|
+
let u, d = !1;
|
|
2052
|
+
if (l ? u = ms(
|
|
2053
|
+
e,
|
|
2054
|
+
r,
|
|
2055
|
+
n,
|
|
2056
|
+
o,
|
|
2057
|
+
f
|
|
2058
|
+
) : (u = hs(
|
|
2059
|
+
e,
|
|
2060
|
+
n,
|
|
2061
|
+
i,
|
|
2062
|
+
o,
|
|
2063
|
+
f,
|
|
2064
|
+
a
|
|
2065
|
+
), d = n.triggerType === "once"), !u)
|
|
2066
|
+
return;
|
|
2067
|
+
const g = u, p = new AbortController();
|
|
2068
|
+
function m(y, E, w) {
|
|
2069
|
+
const S = ys(E, t, g);
|
|
2070
|
+
y.addEventListener(E, S, { ...w, signal: p.signal });
|
|
2071
|
+
}
|
|
2072
|
+
const v = { source: t, target: e, cleanup: () => {
|
|
2073
|
+
p.abort();
|
|
2074
|
+
} };
|
|
2075
|
+
if (C(ge, t, v), C(ge, e, v), f) {
|
|
2076
|
+
const y = c.enter, E = c.leave;
|
|
2077
|
+
y.forEach((T) => {
|
|
2078
|
+
T === "focusin" && (t.tabIndex = 0), m(t, T, { passive: !0, once: d });
|
|
2079
|
+
});
|
|
2080
|
+
const w = !n.stateAction || n.stateAction === "toggle";
|
|
2081
|
+
(l ? w : n.triggerType !== "once") && E.forEach((T) => {
|
|
2082
|
+
if (T === "focusout") {
|
|
2083
|
+
m(t, T, { once: d });
|
|
2084
|
+
return;
|
|
2085
|
+
}
|
|
2086
|
+
m(t, T, { passive: !0 });
|
|
2087
|
+
});
|
|
2088
|
+
} else
|
|
2089
|
+
(c.toggle ?? []).forEach((E) => {
|
|
2090
|
+
m(t, E, { once: d, passive: E !== "keydown" });
|
|
2091
|
+
});
|
|
2092
|
+
}
|
|
2093
|
+
function Is(t) {
|
|
2094
|
+
B(ge, t);
|
|
2095
|
+
}
|
|
2096
|
+
const j = {
|
|
2097
|
+
add: Ts,
|
|
2098
|
+
remove: Is
|
|
2099
|
+
}, ve = {
|
|
2100
|
+
click: ["click"],
|
|
2101
|
+
activate: ["click", "keydown"],
|
|
2102
|
+
hover: { enter: ["mouseenter"], leave: ["mouseleave"] },
|
|
2103
|
+
interest: {
|
|
2104
|
+
enter: ["mouseenter", "focusin"],
|
|
2105
|
+
leave: ["mouseleave", "focusout"]
|
|
2106
|
+
}
|
|
2107
|
+
}, Fe = {
|
|
2108
|
+
click: ve.activate,
|
|
2109
|
+
hover: ve.interest
|
|
2110
|
+
};
|
|
2111
|
+
function Z(t) {
|
|
2112
|
+
const e = ve[t];
|
|
2113
|
+
return (n, s, i, r, o) => {
|
|
2114
|
+
const a = o?.allowA11yTriggers && t in Fe ? Fe[t] : e;
|
|
2115
|
+
j.add(n, s, i, { eventConfig: a }, o ?? {});
|
|
2116
|
+
};
|
|
2117
|
+
}
|
|
2118
|
+
const x = {
|
|
2119
|
+
viewEnter: _e,
|
|
2120
|
+
hover: {
|
|
2121
|
+
add: Z("hover"),
|
|
2122
|
+
remove: j.remove
|
|
2123
|
+
},
|
|
2124
|
+
click: {
|
|
2125
|
+
add: Z("click"),
|
|
2126
|
+
remove: j.remove
|
|
2127
|
+
},
|
|
2128
|
+
pageVisible: _e,
|
|
2129
|
+
animationEnd: ds,
|
|
2130
|
+
viewProgress: Vn,
|
|
2131
|
+
pointerMove: fs,
|
|
2132
|
+
activate: {
|
|
2133
|
+
add: Z("activate"),
|
|
2134
|
+
remove: j.remove
|
|
2135
|
+
},
|
|
2136
|
+
interest: {
|
|
2137
|
+
add: Z("interest"),
|
|
2138
|
+
remove: j.remove
|
|
2139
|
+
}
|
|
2140
|
+
};
|
|
2141
|
+
function Os(t) {
|
|
2142
|
+
return t.replace(/\[([-\w]+)]/g, "[]");
|
|
2143
|
+
}
|
|
2144
|
+
class b {
|
|
2145
|
+
static defineInteractElement;
|
|
2146
|
+
dataCache;
|
|
2147
|
+
addedInteractions;
|
|
2148
|
+
mediaQueryListeners;
|
|
2149
|
+
listInteractionsCache;
|
|
2150
|
+
controllers;
|
|
2151
|
+
static forceReducedMotion = !1;
|
|
2152
|
+
static allowA11yTriggers = !0;
|
|
2153
|
+
static instances = [];
|
|
2154
|
+
static controllerCache = /* @__PURE__ */ new Map();
|
|
2155
|
+
static sequenceCache = /* @__PURE__ */ new Map();
|
|
2156
|
+
static elementSequenceMap = /* @__PURE__ */ new WeakMap();
|
|
2157
|
+
constructor() {
|
|
2158
|
+
this.dataCache = { effects: {}, sequences: {}, conditions: {}, interactions: {} }, this.addedInteractions = {}, this.mediaQueryListeners = /* @__PURE__ */ new Map(), this.listInteractionsCache = {}, this.controllers = /* @__PURE__ */ new Set();
|
|
2159
|
+
}
|
|
2160
|
+
init(e, n) {
|
|
2161
|
+
if (typeof window > "u" || !window.customElements)
|
|
2162
|
+
return;
|
|
2163
|
+
const s = n?.useCustomElement ?? !!b.defineInteractElement;
|
|
2164
|
+
this.dataCache = Cs(e, s);
|
|
2165
|
+
const i = b.defineInteractElement?.();
|
|
2166
|
+
s && i === !1 ? document.querySelectorAll("interact-element").forEach((r) => {
|
|
2167
|
+
r.connect();
|
|
2168
|
+
}) : b.controllerCache.forEach(
|
|
2169
|
+
(r, o) => r.connect(o)
|
|
2170
|
+
);
|
|
2171
|
+
}
|
|
2172
|
+
destroy() {
|
|
2173
|
+
for (const e of this.controllers)
|
|
2174
|
+
e.disconnect();
|
|
2175
|
+
for (const [, e] of this.mediaQueryListeners.entries())
|
|
2176
|
+
e.mql.removeEventListener("change", e.handler);
|
|
2177
|
+
this.mediaQueryListeners.clear(), this.addedInteractions = {}, this.listInteractionsCache = {}, this.controllers.clear(), this.dataCache = { effects: {}, sequences: {}, conditions: {}, interactions: {} }, b.instances.splice(b.instances.indexOf(this), 1);
|
|
2178
|
+
}
|
|
2179
|
+
setController(e, n) {
|
|
2180
|
+
this.controllers.add(n), b.setController(e, n);
|
|
2181
|
+
}
|
|
2182
|
+
deleteController(e, n = !1) {
|
|
2183
|
+
const s = b.controllerCache.get(e);
|
|
2184
|
+
this.clearInteractionStateForKey(e), this.clearMediaQueryListenersForKey(e), s && n && (this.controllers.delete(s), b.deleteController(e));
|
|
2185
|
+
}
|
|
2186
|
+
has(e) {
|
|
2187
|
+
return !!this.get(e);
|
|
2188
|
+
}
|
|
2189
|
+
get(e) {
|
|
2190
|
+
const n = Os(e);
|
|
2191
|
+
return this.dataCache.interactions[n];
|
|
2192
|
+
}
|
|
2193
|
+
clearMediaQueryListenersForKey(e) {
|
|
2194
|
+
for (const [n, s] of this.mediaQueryListeners.entries())
|
|
2195
|
+
s.key === e && (s.mql.removeEventListener("change", s.handler), this.mediaQueryListeners.delete(n));
|
|
2196
|
+
}
|
|
2197
|
+
clearInteractionStateForKey(e) {
|
|
2198
|
+
(this.get(e)?.interactionIds || []).forEach((i) => {
|
|
2199
|
+
const r = $(i, e);
|
|
2200
|
+
delete this.addedInteractions[r];
|
|
2201
|
+
});
|
|
2202
|
+
const s = `${e}::seq::`;
|
|
2203
|
+
for (const i of b.sequenceCache.keys())
|
|
2204
|
+
i.startsWith(s) && (b.sequenceCache.delete(i), delete this.addedInteractions[i]);
|
|
2205
|
+
}
|
|
2206
|
+
setupMediaQueryListener(e, n, s, i) {
|
|
2207
|
+
this.mediaQueryListeners.has(e) || (n.addEventListener("change", i), this.mediaQueryListeners.set(e, {
|
|
2208
|
+
mql: n,
|
|
2209
|
+
handler: i,
|
|
2210
|
+
key: s
|
|
2211
|
+
}));
|
|
2212
|
+
}
|
|
2213
|
+
static create(e, n) {
|
|
2214
|
+
const s = new b();
|
|
2215
|
+
return b.instances.push(s), s.init(e, n), s;
|
|
2216
|
+
}
|
|
2217
|
+
static destroy() {
|
|
2218
|
+
b.controllerCache.forEach((e) => {
|
|
2219
|
+
e.disconnect();
|
|
2220
|
+
}), b.instances.length = 0, b.controllerCache.clear(), b.sequenceCache.clear(), b.elementSequenceMap = /* @__PURE__ */ new WeakMap();
|
|
2221
|
+
}
|
|
2222
|
+
static setup(e) {
|
|
2223
|
+
e.scrollOptionsGetter && x.viewProgress.registerOptionsGetter?.(
|
|
2224
|
+
e.scrollOptionsGetter
|
|
2225
|
+
), e.pointerOptionsGetter && x.pointerMove.registerOptionsGetter?.(
|
|
2226
|
+
e.pointerOptionsGetter
|
|
2227
|
+
), e.viewEnter && x.viewEnter.setOptions(
|
|
2228
|
+
e.viewEnter
|
|
2229
|
+
), e.allowA11yTriggers !== void 0 && (b.allowA11yTriggers = e.allowA11yTriggers);
|
|
2230
|
+
}
|
|
2231
|
+
static getInstance(e) {
|
|
2232
|
+
const n = b.instances.find((s) => s.has(e));
|
|
2233
|
+
return n || console.warn(`Interact: Instance for key "${e}" not found`), n;
|
|
2234
|
+
}
|
|
2235
|
+
static getController(e) {
|
|
2236
|
+
const n = e ? b.controllerCache.get(e) : void 0;
|
|
2237
|
+
return n || console.warn(`Interact: Controller for key "${e}" not found`), n;
|
|
2238
|
+
}
|
|
2239
|
+
static setController(e, n) {
|
|
2240
|
+
b.controllerCache.set(e, n);
|
|
2241
|
+
}
|
|
2242
|
+
static deleteController(e) {
|
|
2243
|
+
b.controllerCache.delete(e);
|
|
2244
|
+
}
|
|
2245
|
+
static registerEffects = Zt;
|
|
2246
|
+
static getSequence(e, n, s, i) {
|
|
2247
|
+
const r = b.sequenceCache.get(e);
|
|
2248
|
+
if (r) return r;
|
|
2249
|
+
const o = ln(n, s, i);
|
|
2250
|
+
return b.sequenceCache.set(e, o), b._registerSequenceElements(s, o), o;
|
|
2251
|
+
}
|
|
2252
|
+
static addToSequence(e, n, s, i) {
|
|
2253
|
+
const r = b.sequenceCache.get(e);
|
|
2254
|
+
if (!r) return !1;
|
|
2255
|
+
const a = Qe(n, i).map((c, l) => ({
|
|
2256
|
+
index: s[l] ?? r.animationGroups.length,
|
|
2257
|
+
group: c
|
|
2258
|
+
}));
|
|
2259
|
+
return r.addGroups(a), b._registerSequenceElements(n, r), !0;
|
|
2260
|
+
}
|
|
2261
|
+
static _registerSequenceElements(e, n) {
|
|
2262
|
+
for (const { target: s } of e) {
|
|
2263
|
+
const i = Array.isArray(s) ? s : s instanceof HTMLElement ? [s] : [];
|
|
2264
|
+
for (const r of i) {
|
|
2265
|
+
let o = b.elementSequenceMap.get(r);
|
|
2266
|
+
o || (o = /* @__PURE__ */ new Set(), b.elementSequenceMap.set(r, o)), o.add(n);
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2270
|
+
static removeFromSequences(e) {
|
|
2271
|
+
for (const n of e) {
|
|
2272
|
+
const s = b.elementSequenceMap.get(n);
|
|
2273
|
+
if (s) {
|
|
2274
|
+
for (const i of s)
|
|
2275
|
+
i.removeGroups(
|
|
2276
|
+
(r) => r.animations.some((o) => o.effect?.target === n)
|
|
2277
|
+
);
|
|
2278
|
+
b.elementSequenceMap.delete(n);
|
|
2279
|
+
}
|
|
2280
|
+
}
|
|
2281
|
+
}
|
|
2282
|
+
}
|
|
2283
|
+
let As = 0;
|
|
2284
|
+
function P(t, {
|
|
2285
|
+
asCombinator: e = !1,
|
|
2286
|
+
addItemFilter: n = !1,
|
|
2287
|
+
useFirstChild: s = !1
|
|
2288
|
+
} = {}) {
|
|
2289
|
+
if (t.listContainer) {
|
|
2290
|
+
const i = `${n && t.listItemSelector ? ` > ${t.listItemSelector}` : ""}`;
|
|
2291
|
+
return t.selector ? `${t.listContainer}${i} ${t.selector}` : `${t.listContainer}${i || " > *"}`;
|
|
2292
|
+
} else if (t.selector)
|
|
2293
|
+
return t.selector;
|
|
2294
|
+
return s ? e ? "> :first-child" : ":scope > :first-child" : "";
|
|
2295
|
+
}
|
|
2296
|
+
function Ne(t) {
|
|
2297
|
+
return "sequenceId" in t && !("effects" in t);
|
|
2298
|
+
}
|
|
2299
|
+
function le(t, e) {
|
|
2300
|
+
return t[e] || (t[e] = {
|
|
2301
|
+
triggers: [],
|
|
2302
|
+
effects: {},
|
|
2303
|
+
sequences: {},
|
|
2304
|
+
interactionIds: /* @__PURE__ */ new Set(),
|
|
2305
|
+
selectors: /* @__PURE__ */ new Set()
|
|
2306
|
+
}), t[e];
|
|
2307
|
+
}
|
|
2308
|
+
function Cs(t, e = !1) {
|
|
2309
|
+
const { effects: n = {}, sequences: s = {}, conditions: i = {} } = t, r = {};
|
|
2310
|
+
return t.interactions?.forEach((o) => {
|
|
2311
|
+
const a = o.key, c = ++As, { effects: l, sequences: f, ...u } = o;
|
|
2312
|
+
if (!a) {
|
|
2313
|
+
console.error(`Interaction ${c} is missing a key for source element.`);
|
|
2314
|
+
return;
|
|
2315
|
+
}
|
|
2316
|
+
le(r, a);
|
|
2317
|
+
const d = l ? Array.from(l) : [];
|
|
2318
|
+
d.reverse();
|
|
2319
|
+
const g = f?.map((h) => {
|
|
2320
|
+
if (Ne(h)) {
|
|
2321
|
+
const y = s[h.sequenceId];
|
|
2322
|
+
return y ? { ...y, ...h } : (console.warn(`Interact: Sequence "${h.sequenceId}" not found in config`), h);
|
|
2323
|
+
}
|
|
2324
|
+
const v = h;
|
|
2325
|
+
return v.sequenceId || (v.sequenceId = k()), v;
|
|
2326
|
+
}), p = {
|
|
2327
|
+
...u,
|
|
2328
|
+
effects: d.length > 0 ? d : void 0,
|
|
2329
|
+
sequences: g
|
|
2330
|
+
};
|
|
2331
|
+
r[a].triggers.push(p), r[a].selectors.add(
|
|
2332
|
+
P(p, { useFirstChild: e })
|
|
2333
|
+
);
|
|
2334
|
+
const m = p.listContainer;
|
|
2335
|
+
d.forEach((h) => {
|
|
2336
|
+
let v = h.key;
|
|
2337
|
+
if (!v && h.effectId) {
|
|
2338
|
+
const S = n[h.effectId];
|
|
2339
|
+
S && (v = S.key);
|
|
2340
|
+
}
|
|
2341
|
+
h.effectId || (h.effectId = k()), v = v || a, h.key = v;
|
|
2342
|
+
const y = h.effectId;
|
|
2343
|
+
if (m && h.listContainer && (v !== a || h.listContainer !== m))
|
|
2344
|
+
return;
|
|
2345
|
+
const E = `${a}::${v}::${y}::${c}`;
|
|
2346
|
+
if (h.interactionId = E, r[a].interactionIds.add(E), v === a)
|
|
2347
|
+
return;
|
|
2348
|
+
const w = le(r, v);
|
|
2349
|
+
w.effects[E] || (w.effects[E] = [], w.interactionIds.add(E)), w.effects[E].push({ ...u, effect: h }), w.selectors.add(P(h, { useFirstChild: e }));
|
|
2350
|
+
}), g?.forEach((h) => {
|
|
2351
|
+
if (!h || Ne(h)) return;
|
|
2352
|
+
const v = h, y = v.sequenceId || k(), E = v.effects;
|
|
2353
|
+
for (const w of E) {
|
|
2354
|
+
w.effectId || (w.effectId = k());
|
|
2355
|
+
let S = w.key;
|
|
2356
|
+
if (!S && w.effectId) {
|
|
2357
|
+
const I = n[w.effectId];
|
|
2358
|
+
I && (S = I.key);
|
|
2359
|
+
}
|
|
2360
|
+
S = S || a;
|
|
2361
|
+
const T = P(w, { useFirstChild: e });
|
|
2362
|
+
if (T && r[a].selectors.add(T), S !== a) {
|
|
2363
|
+
const I = le(r, S), A = `${S}::seq::${y}::${c}`;
|
|
2364
|
+
I.sequences[A] || (I.sequences[A] = [], I.interactionIds.add(A)), I.sequences[A].push({
|
|
2365
|
+
...u,
|
|
2366
|
+
sequence: v
|
|
2367
|
+
}), I.selectors.add(T);
|
|
2368
|
+
}
|
|
2369
|
+
}
|
|
2370
|
+
});
|
|
2371
|
+
}), {
|
|
2372
|
+
effects: n,
|
|
2373
|
+
sequences: s,
|
|
2374
|
+
conditions: i,
|
|
2375
|
+
interactions: r
|
|
2376
|
+
};
|
|
2377
|
+
}
|
|
2378
|
+
function ye(t, e, n) {
|
|
2379
|
+
if (t.listContainer) {
|
|
2380
|
+
const s = e.querySelector(t.listContainer);
|
|
2381
|
+
return s ? t.selector ? Array.from(s.querySelectorAll(t.selector)) : Array.from(s.children) : (console.warn(`Interact: No container found for list container "${t.listContainer}"`), []);
|
|
2382
|
+
}
|
|
2383
|
+
if (t.selector) {
|
|
2384
|
+
const s = e.querySelectorAll(t.selector);
|
|
2385
|
+
if (s.length > 0)
|
|
2386
|
+
return Array.from(s);
|
|
2387
|
+
console.warn(`Interact: No elements found for selector "${t.selector}"`);
|
|
2388
|
+
}
|
|
2389
|
+
return n ? e.firstElementChild : e;
|
|
2390
|
+
}
|
|
2391
|
+
function Ee(t, e) {
|
|
2392
|
+
return e.map((n) => t.selector ? n.querySelector(t.selector) : n).filter(Boolean);
|
|
2393
|
+
}
|
|
2394
|
+
function st(t, e, n, s, i, r, o, a) {
|
|
2395
|
+
return [
|
|
2396
|
+
o ? Ee(t, o) : ye(t, n, s),
|
|
2397
|
+
a ? Ee(e, a) : ye(e, i, r)
|
|
2398
|
+
];
|
|
2399
|
+
}
|
|
2400
|
+
function it(t, e, n, s, i, r, o, a) {
|
|
2401
|
+
const c = Array.isArray(s), l = Array.isArray(i);
|
|
2402
|
+
c ? s.forEach((f, u) => {
|
|
2403
|
+
const d = l ? i[u] : i;
|
|
2404
|
+
d && ze(
|
|
2405
|
+
t,
|
|
2406
|
+
f,
|
|
2407
|
+
e.trigger,
|
|
2408
|
+
d,
|
|
2409
|
+
n,
|
|
2410
|
+
e.params,
|
|
2411
|
+
r,
|
|
2412
|
+
o,
|
|
2413
|
+
a
|
|
2414
|
+
);
|
|
2415
|
+
}) : (l ? i : [i]).forEach((u) => {
|
|
2416
|
+
ze(
|
|
2417
|
+
t,
|
|
2418
|
+
s,
|
|
2419
|
+
e.trigger,
|
|
2420
|
+
u,
|
|
2421
|
+
n,
|
|
2422
|
+
e.params,
|
|
2423
|
+
r,
|
|
2424
|
+
o,
|
|
2425
|
+
a
|
|
2426
|
+
);
|
|
2427
|
+
});
|
|
2428
|
+
}
|
|
2429
|
+
function rt(t, e, n, s, i) {
|
|
2430
|
+
const r = {}, o = [];
|
|
2431
|
+
(s.effects || []).forEach((a) => {
|
|
2432
|
+
const c = a.effectId, l = {
|
|
2433
|
+
...n.dataCache.effects[c] || {},
|
|
2434
|
+
...a,
|
|
2435
|
+
effectId: c
|
|
2436
|
+
}, f = l.key, u = $(a.interactionId, t);
|
|
2437
|
+
if (r[u] || n.addedInteractions[u] && !i)
|
|
2438
|
+
return;
|
|
2439
|
+
const d = _(l.conditions || [], n.dataCache.conditions);
|
|
2440
|
+
if (d && n.setupMediaQueryListener(u, d, t, () => {
|
|
2441
|
+
e.update();
|
|
2442
|
+
}), !d || d.matches) {
|
|
2443
|
+
r[u] = !0;
|
|
2444
|
+
const g = f && $(f, t);
|
|
2445
|
+
let p;
|
|
2446
|
+
if (g) {
|
|
2447
|
+
if (p = b.getController(g), !p)
|
|
2448
|
+
return;
|
|
2449
|
+
l.listContainer && p.watchChildList(l.listContainer);
|
|
2450
|
+
} else
|
|
2451
|
+
p = e;
|
|
2452
|
+
const [m, h] = st(
|
|
2453
|
+
s,
|
|
2454
|
+
l,
|
|
2455
|
+
e.element,
|
|
2456
|
+
e.useFirstChild,
|
|
2457
|
+
p.element,
|
|
2458
|
+
p.useFirstChild,
|
|
2459
|
+
i
|
|
2460
|
+
);
|
|
2461
|
+
if (!m || !h)
|
|
2462
|
+
return;
|
|
2463
|
+
n.addedInteractions[u] = !0;
|
|
2464
|
+
const v = g || s.key, y = L(
|
|
2465
|
+
l.conditions || [],
|
|
2466
|
+
n.dataCache.conditions
|
|
2467
|
+
);
|
|
2468
|
+
o.push([
|
|
2469
|
+
v,
|
|
2470
|
+
s,
|
|
2471
|
+
l,
|
|
2472
|
+
m,
|
|
2473
|
+
h,
|
|
2474
|
+
y,
|
|
2475
|
+
p.useFirstChild,
|
|
2476
|
+
t
|
|
2477
|
+
]);
|
|
2478
|
+
}
|
|
2479
|
+
}), o.reverse().forEach((a) => {
|
|
2480
|
+
it(...a);
|
|
2481
|
+
}), $s(t, e, n, s, i);
|
|
2482
|
+
}
|
|
2483
|
+
function ks(t) {
|
|
2484
|
+
return "sequenceId" in t && !("effects" in t);
|
|
2485
|
+
}
|
|
2486
|
+
function ot(t, e, n, s, i, r, o) {
|
|
2487
|
+
const a = _(t.conditions || [], i.dataCache.conditions);
|
|
2488
|
+
if (a && i.setupMediaQueryListener(e, a, r.updateKey, r.onUpdate), a && !a.matches) return null;
|
|
2489
|
+
const c = t.effects || [], l = [];
|
|
2490
|
+
let f = !1;
|
|
2491
|
+
for (const u of c) {
|
|
2492
|
+
const d = u.effectId, p = {
|
|
2493
|
+
...d ? i.dataCache.effects[d] || {} : {},
|
|
2494
|
+
...u
|
|
2495
|
+
}, m = _(p.conditions || [], i.dataCache.conditions);
|
|
2496
|
+
if (m) {
|
|
2497
|
+
const T = `${e}::${d || "eff"}`;
|
|
2498
|
+
i.setupMediaQueryListener(
|
|
2499
|
+
T,
|
|
2500
|
+
m,
|
|
2501
|
+
r.updateKey,
|
|
2502
|
+
r.onUpdate
|
|
2503
|
+
);
|
|
2504
|
+
}
|
|
2505
|
+
if (m && !m.matches) continue;
|
|
2506
|
+
const h = p.key, v = h && $(h, n);
|
|
2507
|
+
let y;
|
|
2508
|
+
if (v) {
|
|
2509
|
+
if (y = b.getController(v), !y) return null;
|
|
2510
|
+
} else
|
|
2511
|
+
y = s;
|
|
2512
|
+
const E = v || n;
|
|
2513
|
+
let w;
|
|
2514
|
+
if (o && E === o.controllerKey && p.listContainer === o.listContainer ? (w = Ee(p, o.elements), w.length > 0 && (f = !0)) : w = ye(
|
|
2515
|
+
p,
|
|
2516
|
+
y.element,
|
|
2517
|
+
y.useFirstChild
|
|
2518
|
+
), !w || Array.isArray(w) && w.length === 0) return null;
|
|
2519
|
+
const S = q(p);
|
|
2520
|
+
l.push({ target: w, options: S });
|
|
2521
|
+
}
|
|
2522
|
+
return o && !f ? null : l.length > 0 ? l : null;
|
|
2523
|
+
}
|
|
2524
|
+
function at(t, e, n) {
|
|
2525
|
+
const r = (t.useFirstChild ? t.element.firstElementChild : t.element)?.querySelector(e);
|
|
2526
|
+
if (!r) return n.map((a, c) => c);
|
|
2527
|
+
const o = Array.from(r.children);
|
|
2528
|
+
return n.map((a) => {
|
|
2529
|
+
const c = o.indexOf(a);
|
|
2530
|
+
return c >= 0 ? c : o.length;
|
|
2531
|
+
});
|
|
2532
|
+
}
|
|
2533
|
+
function $s(t, e, n, s, i) {
|
|
2534
|
+
s.sequences?.forEach((r) => {
|
|
2535
|
+
let o;
|
|
2536
|
+
if (ks(r)) {
|
|
2537
|
+
const g = n.dataCache.sequences[r.sequenceId];
|
|
2538
|
+
if (!g) {
|
|
2539
|
+
console.warn(`Interact: Sequence "${r.sequenceId}" not found in cache`);
|
|
2540
|
+
return;
|
|
2541
|
+
}
|
|
2542
|
+
o = { ...g, ...r };
|
|
2543
|
+
} else
|
|
2544
|
+
o = r;
|
|
2545
|
+
const a = o.sequenceId || k(), c = $(`${t}::seq::${a}`, t);
|
|
2546
|
+
if (n.addedInteractions[c] && !i) return;
|
|
2547
|
+
const l = i && s.listContainer ? { controllerKey: t, listContainer: s.listContainer, elements: i } : void 0, f = ot(
|
|
2548
|
+
o,
|
|
2549
|
+
c,
|
|
2550
|
+
t,
|
|
2551
|
+
e,
|
|
2552
|
+
n,
|
|
2553
|
+
{ updateKey: t, onUpdate: () => e.update() },
|
|
2554
|
+
l
|
|
2555
|
+
);
|
|
2556
|
+
if (!f) return;
|
|
2557
|
+
if (i && n.addedInteractions[c]) {
|
|
2558
|
+
const g = at(
|
|
2559
|
+
e,
|
|
2560
|
+
s.listContainer,
|
|
2561
|
+
i
|
|
2562
|
+
);
|
|
2563
|
+
b.addToSequence(c, f, g, {
|
|
2564
|
+
reducedMotion: b.forceReducedMotion
|
|
2565
|
+
});
|
|
2566
|
+
return;
|
|
2567
|
+
}
|
|
2568
|
+
const u = b.getSequence(c, o, f, {
|
|
2569
|
+
reducedMotion: b.forceReducedMotion
|
|
2570
|
+
});
|
|
2571
|
+
n.addedInteractions[c] = !0;
|
|
2572
|
+
const d = L(
|
|
2573
|
+
s.conditions || [],
|
|
2574
|
+
n.dataCache.conditions
|
|
2575
|
+
);
|
|
2576
|
+
x[s.trigger]?.add(
|
|
2577
|
+
e.element,
|
|
2578
|
+
e.element,
|
|
2579
|
+
{ triggerType: o.triggerType },
|
|
2580
|
+
s.params || {},
|
|
2581
|
+
{
|
|
2582
|
+
reducedMotion: b.forceReducedMotion,
|
|
2583
|
+
selectorCondition: d,
|
|
2584
|
+
animation: u,
|
|
2585
|
+
allowA11yTriggers: b.allowA11yTriggers
|
|
2586
|
+
}
|
|
2587
|
+
);
|
|
2588
|
+
});
|
|
2589
|
+
}
|
|
2590
|
+
function _s(t, e, n, s, i) {
|
|
2591
|
+
const r = n.get(t)?.sequences || {};
|
|
2592
|
+
Object.keys(r).forEach((a) => {
|
|
2593
|
+
r[a].some(({ sequence: l, ...f }) => {
|
|
2594
|
+
const u = _(
|
|
2595
|
+
f.conditions || [],
|
|
2596
|
+
n.dataCache.conditions
|
|
2597
|
+
);
|
|
2598
|
+
if (u && !u.matches)
|
|
2599
|
+
return !1;
|
|
2600
|
+
const d = f.key && $(f.key, t), g = b.getController(d);
|
|
2601
|
+
if (!g)
|
|
2602
|
+
return !0;
|
|
2603
|
+
const p = l.sequenceId || k(), m = $(`${d}::seq::${p}`, d);
|
|
2604
|
+
if (n.addedInteractions[m] && !i)
|
|
2605
|
+
return !0;
|
|
2606
|
+
const v = ot(
|
|
2607
|
+
l,
|
|
2608
|
+
m,
|
|
2609
|
+
d,
|
|
2610
|
+
g,
|
|
2611
|
+
n,
|
|
2612
|
+
{ updateKey: t, onUpdate: () => e.update() },
|
|
2613
|
+
i && s ? { controllerKey: t, listContainer: s, elements: i } : void 0
|
|
2614
|
+
);
|
|
2615
|
+
if (!v) return !0;
|
|
2616
|
+
if (i && n.addedInteractions[m]) {
|
|
2617
|
+
const w = at(e, s, i);
|
|
2618
|
+
return b.addToSequence(m, v, w, {
|
|
2619
|
+
reducedMotion: b.forceReducedMotion
|
|
2620
|
+
}), !0;
|
|
2621
|
+
}
|
|
2622
|
+
const y = b.getSequence(m, l, v, {
|
|
2623
|
+
reducedMotion: b.forceReducedMotion
|
|
2624
|
+
});
|
|
2625
|
+
n.addedInteractions[m] = !0;
|
|
2626
|
+
const E = L(
|
|
2627
|
+
f.conditions || [],
|
|
2628
|
+
n.dataCache.conditions
|
|
2629
|
+
);
|
|
2630
|
+
return x[f.trigger]?.add(
|
|
2631
|
+
g.element,
|
|
2632
|
+
g.element,
|
|
2633
|
+
{ triggerType: l.triggerType },
|
|
2634
|
+
f.params || {},
|
|
2635
|
+
{
|
|
2636
|
+
reducedMotion: b.forceReducedMotion,
|
|
2637
|
+
selectorCondition: E,
|
|
2638
|
+
animation: y,
|
|
2639
|
+
allowA11yTriggers: b.allowA11yTriggers
|
|
2640
|
+
}
|
|
2641
|
+
), !0;
|
|
2642
|
+
});
|
|
2643
|
+
});
|
|
2644
|
+
}
|
|
2645
|
+
function ct(t, e, n, s, i) {
|
|
2646
|
+
const r = n.get(t), o = r?.effects || {}, a = Object.keys(o), c = [];
|
|
2647
|
+
a.forEach((f) => {
|
|
2648
|
+
const u = $(f, t);
|
|
2649
|
+
if (n.addedInteractions[u] && !i)
|
|
2650
|
+
return;
|
|
2651
|
+
o[f].some(({ effect: g, ...p }) => {
|
|
2652
|
+
const m = _(
|
|
2653
|
+
p.conditions || [],
|
|
2654
|
+
n.dataCache.conditions
|
|
2655
|
+
);
|
|
2656
|
+
if (m && !m.matches)
|
|
2657
|
+
return !1;
|
|
2658
|
+
const h = g.effectId, v = {
|
|
2659
|
+
...n.dataCache.effects[h] || {},
|
|
2660
|
+
...g,
|
|
2661
|
+
effectId: h
|
|
2662
|
+
};
|
|
2663
|
+
if (s && v.listContainer !== s)
|
|
2664
|
+
return !1;
|
|
2665
|
+
const y = _(v.conditions || [], n.dataCache.conditions);
|
|
2666
|
+
if (y && n.setupMediaQueryListener(u, y, t, () => {
|
|
2667
|
+
e.update();
|
|
2668
|
+
}), !y || y.matches) {
|
|
2669
|
+
const E = p.key && $(p.key, t), w = b.getController(E);
|
|
2670
|
+
if (!w)
|
|
2671
|
+
return !0;
|
|
2672
|
+
v.listContainer && e.watchChildList(v.listContainer);
|
|
2673
|
+
const [S, T] = st(
|
|
2674
|
+
p,
|
|
2675
|
+
v,
|
|
2676
|
+
w.element,
|
|
2677
|
+
w.useFirstChild,
|
|
2678
|
+
e.element,
|
|
2679
|
+
e.useFirstChild,
|
|
2680
|
+
void 0,
|
|
2681
|
+
i
|
|
2682
|
+
);
|
|
2683
|
+
if (!S || !T)
|
|
2684
|
+
return !0;
|
|
2685
|
+
n.addedInteractions[u] = !0;
|
|
2686
|
+
const I = L(
|
|
2687
|
+
v.conditions || [],
|
|
2688
|
+
n.dataCache.conditions
|
|
2689
|
+
);
|
|
2690
|
+
return c.push([
|
|
2691
|
+
t,
|
|
2692
|
+
p,
|
|
2693
|
+
v,
|
|
2694
|
+
S,
|
|
2695
|
+
T,
|
|
2696
|
+
I,
|
|
2697
|
+
e.useFirstChild,
|
|
2698
|
+
E || void 0
|
|
2699
|
+
]), !0;
|
|
2700
|
+
}
|
|
2701
|
+
return !1;
|
|
2702
|
+
});
|
|
2703
|
+
}), c.reverse().forEach((f) => {
|
|
2704
|
+
it(...f);
|
|
2705
|
+
}), _s(t, e, n, s, i);
|
|
2706
|
+
const l = Object.keys(r?.sequences || {}).length > 0;
|
|
2707
|
+
return a.length > 0 || l;
|
|
2708
|
+
}
|
|
2709
|
+
function ze(t, e, n, s, i, r, o, a, c) {
|
|
2710
|
+
let l;
|
|
2711
|
+
if (i.transition || i.transitionProperties) {
|
|
2712
|
+
const u = {
|
|
2713
|
+
key: t,
|
|
2714
|
+
effectId: i.effectId,
|
|
2715
|
+
transition: i.transition,
|
|
2716
|
+
transitionProperties: i.transitionProperties,
|
|
2717
|
+
childSelector: P(i, {
|
|
2718
|
+
asCombinator: !0,
|
|
2719
|
+
addItemFilter: !0,
|
|
2720
|
+
useFirstChild: a
|
|
2721
|
+
}),
|
|
2722
|
+
selectorCondition: o
|
|
2723
|
+
};
|
|
2724
|
+
if (l = b.getController(t), !l)
|
|
2725
|
+
return;
|
|
2726
|
+
l.renderStyle(gn(u));
|
|
2727
|
+
}
|
|
2728
|
+
let f;
|
|
2729
|
+
if (n === "animationEnd") {
|
|
2730
|
+
const u = r.effectId, g = (c ? b.getInstance(c) : void 0)?.dataCache.effects[u];
|
|
2731
|
+
g && (f = q(g));
|
|
2732
|
+
}
|
|
2733
|
+
x[n]?.add(e, s, i, r, {
|
|
2734
|
+
reducedMotion: b.forceReducedMotion,
|
|
2735
|
+
targetController: l,
|
|
2736
|
+
selectorCondition: o,
|
|
2737
|
+
allowA11yTriggers: b.allowA11yTriggers,
|
|
2738
|
+
sourceAnimationOptions: f
|
|
2739
|
+
});
|
|
2740
|
+
}
|
|
2741
|
+
function qs(t) {
|
|
2742
|
+
const e = t.key, n = b.getInstance(e);
|
|
2743
|
+
if (!n)
|
|
2744
|
+
return console.warn(`No instance found for key: ${e}`), b.setController(e, t), !1;
|
|
2745
|
+
const { triggers: s = [] } = n?.get(e) || {}, i = s.length > 0;
|
|
2746
|
+
n.setController(e, t), s.forEach((o, a) => {
|
|
2747
|
+
const c = _(o.conditions, n.dataCache.conditions);
|
|
2748
|
+
if (c) {
|
|
2749
|
+
const l = `${e}::trigger::${a}`;
|
|
2750
|
+
n.setupMediaQueryListener(l, c, e, () => {
|
|
2751
|
+
t.update();
|
|
2752
|
+
});
|
|
2753
|
+
}
|
|
2754
|
+
(!c || c.matches) && (o.listContainer && t.watchChildList(o.listContainer), rt(e, t, n, o));
|
|
2755
|
+
});
|
|
2756
|
+
let r = !1;
|
|
2757
|
+
return n && (r = ct(e, t, n)), i || r;
|
|
2758
|
+
}
|
|
2759
|
+
function Ms(t, e, n) {
|
|
2760
|
+
const s = t.key, i = b.getInstance(s);
|
|
2761
|
+
if (i) {
|
|
2762
|
+
const { triggers: r = [] } = i?.get(s) || {};
|
|
2763
|
+
r.forEach((o, a) => {
|
|
2764
|
+
if (o.listContainer !== e)
|
|
2765
|
+
return;
|
|
2766
|
+
const c = _(o.conditions, i.dataCache.conditions);
|
|
2767
|
+
if (c) {
|
|
2768
|
+
const l = `${s}::listTrigger::${e}::${a}`;
|
|
2769
|
+
i.setupMediaQueryListener(l, c, s, () => {
|
|
2770
|
+
t.update();
|
|
2771
|
+
});
|
|
2772
|
+
}
|
|
2773
|
+
(!c || c.matches) && rt(s, t, i, o, n);
|
|
2774
|
+
}), ct(s, t, i, e, n);
|
|
2775
|
+
}
|
|
2776
|
+
}
|
|
2777
|
+
function xs(t, e = !1) {
|
|
2778
|
+
const n = t.key, s = b.getInstance(n);
|
|
2779
|
+
if (!s)
|
|
2780
|
+
return;
|
|
2781
|
+
const i = [...s.get(n)?.selectors.values() || []].filter(Boolean).join(",");
|
|
2782
|
+
let r;
|
|
2783
|
+
i ? (r = [...t.element.querySelectorAll(i)], t.useFirstChild || r.push(t.element)) : r = [t.element], ft(r), s.deleteController(n, e);
|
|
2784
|
+
}
|
|
2785
|
+
function ft(t) {
|
|
2786
|
+
const e = Object.values(x);
|
|
2787
|
+
for (const n of t)
|
|
2788
|
+
for (const s of e)
|
|
2789
|
+
s.remove(n);
|
|
2790
|
+
b.removeFromSequences(t);
|
|
2791
|
+
}
|
|
2792
|
+
const ue = "interactEffect";
|
|
2793
|
+
class Ps {
|
|
2794
|
+
element;
|
|
2795
|
+
key;
|
|
2796
|
+
connected;
|
|
2797
|
+
sheet;
|
|
2798
|
+
useFirstChild;
|
|
2799
|
+
_observers;
|
|
2800
|
+
constructor(e, n, s) {
|
|
2801
|
+
this.element = e, this.key = n, this.connected = !1, this.sheet = null, this._observers = /* @__PURE__ */ new WeakMap(), this.useFirstChild = s?.useFirstChild ?? !1;
|
|
2802
|
+
}
|
|
2803
|
+
connect(e) {
|
|
2804
|
+
if (this.connected)
|
|
2805
|
+
return;
|
|
2806
|
+
const n = this.element.dataset.interactKey;
|
|
2807
|
+
if (e = e || this.key || n, !e) {
|
|
2808
|
+
console.warn("Interact: No key provided");
|
|
2809
|
+
return;
|
|
2810
|
+
}
|
|
2811
|
+
n !== e && (n && console.warn(
|
|
2812
|
+
`Interact: Key mismatch between element ${n} and parameter ${e}, updating element key`
|
|
2813
|
+
), this.element.dataset.interactKey = e), this.key = e, this.connected = qs(this);
|
|
2814
|
+
}
|
|
2815
|
+
disconnect({ removeFromCache: e = !1 } = {}) {
|
|
2816
|
+
if ((this.key || this.element.dataset.interactKey) && xs(this, e), this.sheet) {
|
|
2817
|
+
const s = this.element?.getRootNode(), i = s.host ? s : document;
|
|
2818
|
+
i.adoptedStyleSheets.indexOf(this.sheet) !== -1 && (i.adoptedStyleSheets = i.adoptedStyleSheets.filter(
|
|
2819
|
+
(o) => o !== this.sheet
|
|
2820
|
+
));
|
|
2821
|
+
}
|
|
2822
|
+
this._observers = /* @__PURE__ */ new WeakMap(), this.sheet = null, this.connected = !1;
|
|
2823
|
+
}
|
|
2824
|
+
update() {
|
|
2825
|
+
this.disconnect(), this.connect();
|
|
2826
|
+
}
|
|
2827
|
+
renderStyle(e) {
|
|
2828
|
+
const n = this.element?.getRootNode(), s = n.host ? n : document;
|
|
2829
|
+
if (!this.sheet)
|
|
2830
|
+
this.sheet = new CSSStyleSheet(), this.sheet.replaceSync(e.join(`
|
|
2831
|
+
`)), s.adoptedStyleSheets = [...s.adoptedStyleSheets || [], this.sheet];
|
|
2832
|
+
else {
|
|
2833
|
+
let i = this.sheet.cssRules.length;
|
|
2834
|
+
for (const r of e)
|
|
2835
|
+
try {
|
|
2836
|
+
this.sheet.insertRule(r, i), i++;
|
|
2837
|
+
} catch (o) {
|
|
2838
|
+
console.error(o);
|
|
2839
|
+
}
|
|
2840
|
+
}
|
|
2841
|
+
}
|
|
2842
|
+
toggleEffect(e, n, s, i) {
|
|
2843
|
+
if (s === null)
|
|
2844
|
+
return;
|
|
2845
|
+
if (!i && this.element.toggleEffect) {
|
|
2846
|
+
this.element.toggleEffect(e, n, s);
|
|
2847
|
+
return;
|
|
2848
|
+
}
|
|
2849
|
+
const r = new Set(
|
|
2850
|
+
this.element.dataset[ue]?.split(" ") || []
|
|
2851
|
+
);
|
|
2852
|
+
n === "toggle" ? r.has(e) ? r.delete(e) : r.add(e) : n === "add" ? r.add(e) : n === "remove" ? r.delete(e) : n === "clear" && r.clear(), (s || this.element).dataset[ue] = Array.from(r).join(" ");
|
|
2853
|
+
}
|
|
2854
|
+
getActiveEffects() {
|
|
2855
|
+
const n = (this.element.dataset[ue] || "").trim();
|
|
2856
|
+
return n ? n.split(/\s+/) : [];
|
|
2857
|
+
}
|
|
2858
|
+
watchChildList(e) {
|
|
2859
|
+
const n = this.element.querySelector(e);
|
|
2860
|
+
if (n) {
|
|
2861
|
+
let s = this._observers.get(n);
|
|
2862
|
+
s || (s = new MutationObserver(this._childListChangeHandler.bind(this, e)), this._observers.set(n, s), s.observe(n, { childList: !0 }));
|
|
2863
|
+
}
|
|
2864
|
+
}
|
|
2865
|
+
_childListChangeHandler(e, n) {
|
|
2866
|
+
const s = this.key || this.element.dataset.interactKey, i = [], r = [];
|
|
2867
|
+
n.forEach((o) => {
|
|
2868
|
+
o.removedNodes.forEach((a) => {
|
|
2869
|
+
a instanceof HTMLElement && i.push(a);
|
|
2870
|
+
}), o.addedNodes.forEach((a) => {
|
|
2871
|
+
a instanceof HTMLElement && r.push(a);
|
|
2872
|
+
});
|
|
2873
|
+
}), ft(i), s && Ms(this, e, r);
|
|
2874
|
+
}
|
|
2875
|
+
}
|
|
2876
|
+
function Us(t, e) {
|
|
2877
|
+
new Ps(t, e).connect();
|
|
2878
|
+
}
|
|
2879
|
+
function Xs(t) {
|
|
2880
|
+
const e = b.getController(t);
|
|
2881
|
+
e && e.disconnect({ removeFromCache: !0 });
|
|
2882
|
+
}
|
|
2883
|
+
const lt = /* @__PURE__ */ new Map([
|
|
2884
|
+
["viewEnter", "once"],
|
|
2885
|
+
["pageVisible", "once"],
|
|
2886
|
+
["animationEnd", "once"],
|
|
2887
|
+
["hover", "alternate"],
|
|
2888
|
+
["click", "alternate"],
|
|
2889
|
+
["activate", "alternate"],
|
|
2890
|
+
["interest", "alternate"]
|
|
2891
|
+
]);
|
|
2892
|
+
function ut(t, e, n) {
|
|
2893
|
+
const { effects: s = {}, conditions: i = {} } = n, { key: r, trigger: o } = e, a = o === "pointerMove";
|
|
2894
|
+
t.effectId || (t.effectId = k());
|
|
2895
|
+
const { effectId: c } = t, l = { ...s[c] || {}, ...t };
|
|
2896
|
+
let { key: f, conditions: u, triggerType: d } = l;
|
|
2897
|
+
if (!f) {
|
|
2898
|
+
if (!r)
|
|
2899
|
+
return null;
|
|
2900
|
+
f = r;
|
|
2901
|
+
}
|
|
2902
|
+
if (dn(f))
|
|
2903
|
+
return null;
|
|
2904
|
+
u = [
|
|
2905
|
+
...new Set((u || []).filter((w) => i[w]))
|
|
2906
|
+
], d || (d = lt.get(o));
|
|
2907
|
+
const { namedEffect: g, customEffect: p, keyframeEffect: m, transition: h, transitionProperties: v, ...y } = {
|
|
2908
|
+
...l,
|
|
2909
|
+
key: f,
|
|
2910
|
+
conditions: u,
|
|
2911
|
+
effectId: c,
|
|
2912
|
+
triggerType: d
|
|
2913
|
+
}, E = yt(e, y);
|
|
2914
|
+
if (g)
|
|
2915
|
+
return a || !g.type ? null : { namedEffect: g, initial: E, ...y };
|
|
2916
|
+
if (m) {
|
|
2917
|
+
if (!m.name) {
|
|
2918
|
+
const w = c && !(s[c] && "keyframeEffect" in t);
|
|
2919
|
+
m.name = w ? c : k();
|
|
2920
|
+
}
|
|
2921
|
+
return { keyframeEffect: m, initial: E, ...y };
|
|
2922
|
+
} else return p ? a ? null : { initial: E, ...y } : h ? { transition: h, initial: E, ...y } : v ? { transitionProperties: v, initial: E, ...y } : { initial: E, ...y };
|
|
2923
|
+
}
|
|
2924
|
+
function Ls(t, e, n) {
|
|
2925
|
+
const { sequences: s = {}, conditions: i = {} } = n;
|
|
2926
|
+
t.sequenceId || (t.sequenceId = k());
|
|
2927
|
+
const { sequenceId: r } = t, o = { ...s[r] || {}, ...t };
|
|
2928
|
+
let {
|
|
2929
|
+
effects: a,
|
|
2930
|
+
conditions: c,
|
|
2931
|
+
triggerType: l,
|
|
2932
|
+
delay: f = 0,
|
|
2933
|
+
offset: u = 0,
|
|
2934
|
+
offsetEasing: d = "linear"
|
|
2935
|
+
} = o;
|
|
2936
|
+
l || (l = lt.get(e.trigger)), c = [
|
|
2937
|
+
...new Set((c || []).filter((m) => i[m]))
|
|
2938
|
+
];
|
|
2939
|
+
const g = a.map((m) => (m.conditions ? m.conditions.push(...c) : m.conditions = [...c], ut({ ...m, triggerType: l }, e, n)));
|
|
2940
|
+
typeof d != "function" && (d = be(d) || ((m) => m)), pn(g, f, u, d);
|
|
2941
|
+
const p = g.filter((m) => m !== null);
|
|
2942
|
+
return p.length ? {
|
|
2943
|
+
sequenceId: r,
|
|
2944
|
+
triggerType: l,
|
|
2945
|
+
conditions: c,
|
|
2946
|
+
delay: f,
|
|
2947
|
+
offset: u,
|
|
2948
|
+
offsetEasing: d,
|
|
2949
|
+
effects: p
|
|
2950
|
+
} : null;
|
|
2951
|
+
}
|
|
2952
|
+
function Rs(t) {
|
|
2953
|
+
return t === "cssFloat" ? "float" : t === "easing" ? "animation-timing-function" : t === "cssOffset" ? "offset" : t === "composite" ? "animation-composition" : t.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
2954
|
+
}
|
|
2955
|
+
function Fs(t) {
|
|
2956
|
+
if (!t.length)
|
|
2957
|
+
return [];
|
|
2958
|
+
const e = t.map((i) => ({ ...i }));
|
|
2959
|
+
e[0].offset === void 0 && (e[0].offset = 0), (e[e.length - 1].offset === void 0 || e.length === 1) && (e[e.length - 1].offset = 1);
|
|
2960
|
+
let n = 0, s = e[0].offset;
|
|
2961
|
+
for (let i = 1; i < e.length; i++)
|
|
2962
|
+
if (e[i].offset !== void 0) {
|
|
2963
|
+
const r = e[i].offset;
|
|
2964
|
+
if (r < s)
|
|
2965
|
+
return console.error("Offsets must be monotonically non-decreasing"), [];
|
|
2966
|
+
if (r > 1)
|
|
2967
|
+
return console.error("Offsets must be in the range [0,1]"), [];
|
|
2968
|
+
const o = i - n;
|
|
2969
|
+
for (let a = n + 1; a < i; a++) {
|
|
2970
|
+
const c = (a - n) / o;
|
|
2971
|
+
e[a].offset = s + (r - s) * c;
|
|
2972
|
+
}
|
|
2973
|
+
n = i, s = r;
|
|
2974
|
+
}
|
|
2975
|
+
return e;
|
|
2976
|
+
}
|
|
2977
|
+
function Ns(t, e) {
|
|
2978
|
+
const n = Object.entries(t).filter(([s, i]) => s !== "offset" && i !== void 0 && i !== null).map(([s, i]) => `${Rs(s)}: ${i};`).join(`
|
|
2979
|
+
`);
|
|
2980
|
+
return `${e}% {
|
|
2981
|
+
${n}
|
|
2982
|
+
}`;
|
|
2983
|
+
}
|
|
2984
|
+
function zs(t, e) {
|
|
2985
|
+
const n = Fs(e);
|
|
2986
|
+
if (!n.length)
|
|
2987
|
+
return "";
|
|
2988
|
+
let s = n.map((i) => {
|
|
2989
|
+
const r = i.offset, o = un(r * 100);
|
|
2990
|
+
return Ns(i, o);
|
|
2991
|
+
}).join(`
|
|
2992
|
+
`);
|
|
2993
|
+
return `@keyframes ${t} {
|
|
2994
|
+
${s}
|
|
2995
|
+
}`;
|
|
2996
|
+
}
|
|
2997
|
+
function Hs(t) {
|
|
2998
|
+
const { key: e, childSelector: n, declarations: s, media: i, states: r, selectorCondition: o, addInitialSelector: a } = t;
|
|
2999
|
+
if (!s.length)
|
|
3000
|
+
return "";
|
|
3001
|
+
let c = `[data-interact-key="${e}"]`;
|
|
3002
|
+
if (r && r.length) {
|
|
3003
|
+
const u = r.map((d) => `:state(${d}), :--${d}, [data-interact-effect~="${d}"]`).join(", ");
|
|
3004
|
+
c = `${c}:is(${u})`;
|
|
3005
|
+
}
|
|
3006
|
+
n && (c = `${c} ${n}`), a && (c = `${c}:not([data-interact-enter])`), o && (c = te(c, o));
|
|
3007
|
+
const l = s.map(({ name: u, value: d }) => `${u}: ${d};`).join(`
|
|
3008
|
+
`), f = `${c} {
|
|
3009
|
+
${l}
|
|
3010
|
+
}`;
|
|
3011
|
+
return i ? `@media ${i} {
|
|
3012
|
+
${f}
|
|
3013
|
+
}` : f;
|
|
3014
|
+
}
|
|
3015
|
+
function dt(t, e, n, s) {
|
|
3016
|
+
const { key: i, childSelector: r, properties: o } = t, a = Object.entries(o).filter(
|
|
3017
|
+
(l) => l[1] && l[1].varNames.length
|
|
3018
|
+
).map(([l, { fallback: f, varNames: u }]) => ({
|
|
3019
|
+
name: l,
|
|
3020
|
+
value: u.map((d) => `var(${d}, ${f})`).join(", ")
|
|
3021
|
+
})), c = { key: i, childSelector: r, declarations: a };
|
|
3022
|
+
return e && c.declarations.forEach((l) => {
|
|
3023
|
+
l.name = e[l.name];
|
|
3024
|
+
}), n && (c.media = ae(n, s || {}, "media"), c.selectorCondition = L(n, s || {})), c;
|
|
3025
|
+
}
|
|
3026
|
+
const js = [
|
|
3027
|
+
{ name: "visibility", value: "hidden" },
|
|
3028
|
+
{ name: "transform", value: "none" },
|
|
3029
|
+
{ name: "translate", value: "none" },
|
|
3030
|
+
{ name: "scale", value: "none" },
|
|
3031
|
+
{ name: "rotate", value: "none" }
|
|
3032
|
+
], se = [
|
|
3033
|
+
"animation",
|
|
3034
|
+
"animation-composition",
|
|
3035
|
+
"animation-timeline",
|
|
3036
|
+
"animation-range"
|
|
3037
|
+
], we = ["transition", ...se], Ds = {
|
|
3038
|
+
animation: "animation",
|
|
3039
|
+
"animation-composition": "composition",
|
|
3040
|
+
"animation-timeline": "animationTimeline",
|
|
3041
|
+
"animation-range": "animationRange"
|
|
3042
|
+
}, ie = {
|
|
3043
|
+
animation: "none",
|
|
3044
|
+
"animation-composition": "replace",
|
|
3045
|
+
transition: "_",
|
|
3046
|
+
"animation-timeline": "auto",
|
|
3047
|
+
"animation-range": "normal"
|
|
3048
|
+
};
|
|
3049
|
+
function ht(t, e, n) {
|
|
3050
|
+
const s = t.get(e);
|
|
3051
|
+
s ? n.forEach((i) => s.add(i)) : t.set(e, new Set(n));
|
|
3052
|
+
}
|
|
3053
|
+
function mt(t, e, n, s) {
|
|
3054
|
+
const { key: i, childSelector: r } = n, o = s ? we.filter((c) => s.has(c)) : we;
|
|
3055
|
+
t.has(e) || t.set(e, { key: i, childSelector: r, properties: {} });
|
|
3056
|
+
const { properties: a } = t.get(e);
|
|
3057
|
+
for (const c of o)
|
|
3058
|
+
a[c] || (a[c] = { fallback: ie[c], varNames: [] }), a[c].varNames.push(n[c]);
|
|
3059
|
+
}
|
|
3060
|
+
function pt(t, e) {
|
|
3061
|
+
return we.reduce(
|
|
3062
|
+
(n, s) => (n[s] = hn([s, ...t, e]), n),
|
|
3063
|
+
{}
|
|
3064
|
+
);
|
|
3065
|
+
}
|
|
3066
|
+
function Gs(t, e, n, s, i) {
|
|
3067
|
+
return s.has(t) || s.set(t, {
|
|
3068
|
+
key: e,
|
|
3069
|
+
childSelector: i,
|
|
3070
|
+
...pt([n], He(t))
|
|
3071
|
+
}), s.get(t);
|
|
3072
|
+
}
|
|
3073
|
+
function Ws(t, e, n) {
|
|
3074
|
+
return pt([e, n], He(t));
|
|
3075
|
+
}
|
|
3076
|
+
function Vs(t, e, n, s = !0) {
|
|
3077
|
+
const { key: i, conditions: r } = t, o = ae(r, e, "media"), a = L(r, e), c = P(t, {
|
|
3078
|
+
asCombinator: !0,
|
|
3079
|
+
useFirstChild: s,
|
|
3080
|
+
addItemFilter: !0
|
|
3081
|
+
});
|
|
3082
|
+
return {
|
|
3083
|
+
key: i,
|
|
3084
|
+
media: o,
|
|
3085
|
+
selectorCondition: a,
|
|
3086
|
+
childSelector: c,
|
|
3087
|
+
// invalidating earlier cascaded custom properties affected from earlier transitionEffects
|
|
3088
|
+
// to implement same-interaction-cascade
|
|
3089
|
+
declarations: [
|
|
3090
|
+
{
|
|
3091
|
+
name: "view-timeline",
|
|
3092
|
+
value: `--${n}`
|
|
3093
|
+
}
|
|
3094
|
+
]
|
|
3095
|
+
};
|
|
3096
|
+
}
|
|
3097
|
+
function Ys(t, e, n, s, i) {
|
|
3098
|
+
const {
|
|
3099
|
+
key: r,
|
|
3100
|
+
effectId: o,
|
|
3101
|
+
conditions: a,
|
|
3102
|
+
namedEffect: c,
|
|
3103
|
+
keyframeEffect: l,
|
|
3104
|
+
transition: f,
|
|
3105
|
+
transitionProperties: u,
|
|
3106
|
+
initial: d
|
|
3107
|
+
} = t, g = ae(a, e, "media"), p = L(a, e), m = [
|
|
3108
|
+
{
|
|
3109
|
+
key: r,
|
|
3110
|
+
media: g,
|
|
3111
|
+
selectorCondition: p,
|
|
3112
|
+
childSelector: i,
|
|
3113
|
+
declarations: []
|
|
3114
|
+
}
|
|
3115
|
+
];
|
|
3116
|
+
let h = [];
|
|
3117
|
+
const { declarations: v } = m[0];
|
|
3118
|
+
let y = [];
|
|
3119
|
+
if (c || l) {
|
|
3120
|
+
y = [...se];
|
|
3121
|
+
const E = q(t), w = on(null, E, s).filter(
|
|
3122
|
+
(T) => T.name
|
|
3123
|
+
);
|
|
3124
|
+
h = w.map((T) => ({
|
|
3125
|
+
name: T.name,
|
|
3126
|
+
keyframes: T.keyframes
|
|
3127
|
+
})), v.push(
|
|
3128
|
+
...w.flatMap(
|
|
3129
|
+
({ custom: T }) => Object.entries(T || {}).filter(([I, A]) => A !== void 0).map(([I, A]) => ({ name: I, value: A }))
|
|
3130
|
+
)
|
|
3131
|
+
);
|
|
3132
|
+
const S = se.map((T) => ({
|
|
3133
|
+
name: n[T],
|
|
3134
|
+
value: w.map((I) => {
|
|
3135
|
+
const A = Ds[T];
|
|
3136
|
+
return I[A];
|
|
3137
|
+
}).join(", ") || ie[T]
|
|
3138
|
+
}));
|
|
3139
|
+
d ? m.push({
|
|
3140
|
+
key: r,
|
|
3141
|
+
media: g,
|
|
3142
|
+
selectorCondition: p,
|
|
3143
|
+
childSelector: i,
|
|
3144
|
+
declarations: S.concat(js),
|
|
3145
|
+
addInitialSelector: !0
|
|
3146
|
+
}) : v.push(...S);
|
|
3147
|
+
} else if (f || u) {
|
|
3148
|
+
y = ["transition"];
|
|
3149
|
+
const E = f?.styleProperties || u || [], w = Ue(t);
|
|
3150
|
+
v.push({
|
|
3151
|
+
name: n.transition,
|
|
3152
|
+
value: w.join(", ") || ie.transition
|
|
3153
|
+
}), m.push({
|
|
3154
|
+
key: r,
|
|
3155
|
+
media: g,
|
|
3156
|
+
selectorCondition: p,
|
|
3157
|
+
childSelector: i,
|
|
3158
|
+
states: [o],
|
|
3159
|
+
declarations: E
|
|
3160
|
+
});
|
|
3161
|
+
} else
|
|
3162
|
+
v.push(
|
|
3163
|
+
...se.map((E) => ({
|
|
3164
|
+
name: n[E],
|
|
3165
|
+
value: ie[E]
|
|
3166
|
+
}))
|
|
3167
|
+
);
|
|
3168
|
+
return { rules: m.filter((E) => E.declarations.length), keyframes: h, usedProperties: y };
|
|
3169
|
+
}
|
|
3170
|
+
function gt(t, e, n, s, i, r, o = !0, a, c) {
|
|
3171
|
+
const { key: l } = n, f = c ?? G(n), u = P(n, {
|
|
3172
|
+
asCombinator: !0,
|
|
3173
|
+
useFirstChild: o,
|
|
3174
|
+
addItemFilter: !0
|
|
3175
|
+
}), g = { ...Gs(
|
|
3176
|
+
f,
|
|
3177
|
+
l,
|
|
3178
|
+
e,
|
|
3179
|
+
s,
|
|
3180
|
+
u
|
|
3181
|
+
) };
|
|
3182
|
+
a && Object.assign(g, a);
|
|
3183
|
+
const { rules: p, keyframes: m, usedProperties: h } = Ys(
|
|
3184
|
+
n,
|
|
3185
|
+
t,
|
|
3186
|
+
g,
|
|
3187
|
+
r,
|
|
3188
|
+
u
|
|
3189
|
+
);
|
|
3190
|
+
return m.forEach(({ name: v, keyframes: y }) => i.set(v, y)), { rules: p, usedProperties: h };
|
|
3191
|
+
}
|
|
3192
|
+
function Bs(t, e, n, s, i, r, o = !0, a) {
|
|
3193
|
+
const c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), f = [];
|
|
3194
|
+
for (const d of n.effects) {
|
|
3195
|
+
const g = G(d), { key: p } = d, m = P(d, {
|
|
3196
|
+
asCombinator: !0,
|
|
3197
|
+
useFirstChild: o,
|
|
3198
|
+
addItemFilter: !0
|
|
3199
|
+
}), h = l.get(g) || 0;
|
|
3200
|
+
l.set(g, h + 1);
|
|
3201
|
+
const v = Ws(g, e, h), { rules: y, usedProperties: E } = gt(
|
|
3202
|
+
t,
|
|
3203
|
+
e,
|
|
3204
|
+
d,
|
|
3205
|
+
s,
|
|
3206
|
+
i,
|
|
3207
|
+
r,
|
|
3208
|
+
o,
|
|
3209
|
+
v,
|
|
3210
|
+
g
|
|
3211
|
+
);
|
|
3212
|
+
f.push(...y);
|
|
3213
|
+
const w = new Set(E);
|
|
3214
|
+
mt(
|
|
3215
|
+
c,
|
|
3216
|
+
g,
|
|
3217
|
+
{ key: p, childSelector: m, ...v },
|
|
3218
|
+
w
|
|
3219
|
+
), a && ht(a, g, E);
|
|
3220
|
+
}
|
|
3221
|
+
const { conditions: u } = n;
|
|
3222
|
+
return c.forEach((d, g) => {
|
|
3223
|
+
const p = s.get(g);
|
|
3224
|
+
f.push(dt(d, p, u, t));
|
|
3225
|
+
}), f;
|
|
3226
|
+
}
|
|
3227
|
+
function Ks(t, e, n, s, i, r = !0) {
|
|
3228
|
+
const { effects: o = [], sequences: a = [] } = e, c = t.conditions || {}, l = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), u = o.map((h) => ut(h, e, t)).filter((h) => h !== null), d = [], { trigger: g } = e, p = {
|
|
3229
|
+
trigger: mn(g),
|
|
3230
|
+
id: ["trigger", n].join("-")
|
|
3231
|
+
};
|
|
3232
|
+
g === "viewProgress" && d.push(Vs(e, c, p.id, r));
|
|
3233
|
+
for (const h of u) {
|
|
3234
|
+
const v = G(h), { rules: y, usedProperties: E } = gt(
|
|
3235
|
+
c,
|
|
3236
|
+
n,
|
|
3237
|
+
h,
|
|
3238
|
+
l,
|
|
3239
|
+
i,
|
|
3240
|
+
p,
|
|
3241
|
+
r
|
|
3242
|
+
);
|
|
3243
|
+
d.push(...y), ht(f, v, E);
|
|
3244
|
+
}
|
|
3245
|
+
const m = a.map((h) => Ls(h, e, t)).filter((h) => h !== null);
|
|
3246
|
+
return d.push(
|
|
3247
|
+
...m.flatMap(
|
|
3248
|
+
(h) => Bs(
|
|
3249
|
+
c,
|
|
3250
|
+
n,
|
|
3251
|
+
h,
|
|
3252
|
+
l,
|
|
3253
|
+
i,
|
|
3254
|
+
p,
|
|
3255
|
+
r,
|
|
3256
|
+
f
|
|
3257
|
+
)
|
|
3258
|
+
)
|
|
3259
|
+
), l.forEach((h, v) => {
|
|
3260
|
+
mt(
|
|
3261
|
+
s,
|
|
3262
|
+
v,
|
|
3263
|
+
h,
|
|
3264
|
+
f.get(v)
|
|
3265
|
+
);
|
|
3266
|
+
}), d;
|
|
3267
|
+
}
|
|
3268
|
+
function Qs(t, e = !0) {
|
|
3269
|
+
const n = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i = t.interactions.flatMap(
|
|
3270
|
+
(r, o) => Ks(t, r, o, n, s, e)
|
|
3271
|
+
);
|
|
3272
|
+
return n.forEach((r) => {
|
|
3273
|
+
i.push(dt(r));
|
|
3274
|
+
}), { keyframes: s, cssRules: i };
|
|
3275
|
+
}
|
|
3276
|
+
function Zs(t, e = !0) {
|
|
3277
|
+
const { cssRules: n, keyframes: s } = Qs(t, e);
|
|
3278
|
+
return [
|
|
3279
|
+
...[...s.entries()].map(([r, o]) => zs(r, o)),
|
|
3280
|
+
...n.map(Hs)
|
|
3281
|
+
].join(`
|
|
3282
|
+
`);
|
|
3283
|
+
}
|
|
3284
|
+
export {
|
|
3285
|
+
Ps as I,
|
|
3286
|
+
b as a,
|
|
3287
|
+
Us as b,
|
|
3288
|
+
Zs as g,
|
|
3289
|
+
Xs as r
|
|
3290
|
+
};
|
|
3291
|
+
//# sourceMappingURL=index-C6u4q815.mjs.map
|