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