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