@wix/motion 2.1.6 → 2.1.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/dist/es/motion.js CHANGED
@@ -1,68 +1,68 @@
1
- class I {
1
+ class O {
2
2
  animations;
3
3
  options;
4
4
  ready;
5
5
  isCSS;
6
6
  longestAnimation;
7
- constructor(e, n) {
8
- this.animations = e, this.options = n, this.ready = n?.measured || Promise.resolve(), this.isCSS = e[0] instanceof CSSAnimation, this.longestAnimation = this._getAnimationWithLongestEndTime();
7
+ constructor(t, n) {
8
+ this.animations = t, this.options = n, this.ready = n?.measured || Promise.resolve(), this.isCSS = t[0] instanceof CSSAnimation, this.longestAnimation = this._getAnimationWithLongestEndTime();
9
9
  }
10
10
  _getAnimationWithLongestEndTime() {
11
- return this.animations.reduce((e, n) => {
12
- const i = e.effect?.getComputedTiming().endTime ?? 0, s = n.effect?.getComputedTiming().endTime ?? 0;
13
- return i > s ? e : n;
11
+ return this.animations.reduce((t, n) => {
12
+ const i = t.effect?.getComputedTiming().endTime ?? 0, s = n.effect?.getComputedTiming().endTime ?? 0;
13
+ return i > s ? t : n;
14
14
  }, this.animations[0]);
15
15
  }
16
16
  getProgress() {
17
17
  return this.longestAnimation?.effect?.getComputedTiming().progress || 0;
18
18
  }
19
- async play(e) {
19
+ async play(t) {
20
20
  await this.ready;
21
21
  for (const n of this.animations)
22
22
  n.play();
23
- await Promise.all(this.animations.map((n) => n.ready)), e && e();
23
+ await Promise.all(this.animations.map((n) => n.ready)), t && t();
24
24
  }
25
25
  pause() {
26
- for (const e of this.animations)
27
- e.pause();
26
+ for (const t of this.animations)
27
+ t.pause();
28
28
  }
29
- async reverse(e) {
29
+ async reverse(t) {
30
30
  await this.ready;
31
31
  for (const n of this.animations)
32
32
  n.reverse();
33
- await Promise.all(this.animations.map((n) => n.ready)), e && e();
33
+ await Promise.all(this.animations.map((n) => n.ready)), t && t();
34
34
  }
35
- progress(e) {
35
+ progress(t) {
36
36
  for (const n of this.animations) {
37
37
  const { delay: i, duration: s, iterations: r } = n.effect.getTiming(), c = (Number.isFinite(s) ? s : 0) * (Number.isFinite(r) ? r : 1);
38
- n.currentTime = ((i || 0) + c) * e;
38
+ n.currentTime = ((i || 0) + c) * t;
39
39
  }
40
40
  }
41
41
  cancel() {
42
- for (const e of this.animations)
43
- e.cancel();
42
+ for (const t of this.animations)
43
+ t.cancel();
44
44
  }
45
- setPlaybackRate(e) {
45
+ setPlaybackRate(t) {
46
46
  for (const n of this.animations)
47
- n.playbackRate = e;
47
+ n.playbackRate = t;
48
48
  }
49
- async onFinish(e) {
49
+ async onFinish(t) {
50
50
  try {
51
51
  await Promise.all(this.animations.map((i) => i.finished));
52
52
  const n = this.animations[0];
53
53
  if (n && !this.isCSS) {
54
54
  const i = n.effect?.target;
55
55
  if (i) {
56
- const s = new Event("animationend");
57
- i.dispatchEvent(s);
56
+ const s = this.options?.effectId || n.id, r = new CustomEvent("animationend", { detail: { effectId: s } });
57
+ i.dispatchEvent(r);
58
58
  }
59
59
  }
60
- e();
60
+ t();
61
61
  } catch (n) {
62
62
  console.warn("animation was interrupted - aborting onFinish callback - ", n);
63
63
  }
64
64
  }
65
- async onAbort(e) {
65
+ async onAbort(t) {
66
66
  try {
67
67
  await Promise.all(this.animations.map((n) => n.finished));
68
68
  } catch (n) {
@@ -75,19 +75,25 @@ class I {
75
75
  s.dispatchEvent(r);
76
76
  }
77
77
  }
78
- e();
78
+ t();
79
79
  }
80
80
  }
81
81
  }
82
82
  get finished() {
83
- return Promise.all(this.animations.map((e) => e.finished));
83
+ return Promise.all(this.animations.map((t) => t.finished));
84
84
  }
85
85
  get playState() {
86
- return this.animations[0]?.playState;
86
+ return this.animations.some((t) => t.playState === "running") ? "running" : this.animations[0]?.playState;
87
+ }
88
+ hasAnimationName(t) {
89
+ return this.animations.some((n) => n.animationName === t);
90
+ }
91
+ hasAnimationId(t) {
92
+ return this.animations.some((n) => n.id === t);
87
93
  }
88
94
  getTimingOptions() {
89
- return this.animations.map((e) => {
90
- const n = e.effect?.getTiming(), i = n?.delay ?? 0, s = Number(n?.duration) || 0, r = n?.iterations ?? 1;
95
+ return this.animations.map((t) => {
96
+ const n = t.effect?.getTiming(), i = n?.delay ?? 0, s = Number(n?.duration) || 0, r = n?.iterations ?? 1;
91
97
  return {
92
98
  delay: i,
93
99
  duration: s,
@@ -96,7 +102,7 @@ class I {
96
102
  });
97
103
  }
98
104
  }
99
- const G = (t) => t, V = (t) => 1 - Math.cos(t * Math.PI / 2), B = (t) => Math.sin(t * Math.PI / 2), K = (t) => -(Math.cos(Math.PI * t) - 1) / 2, X = (t) => t ** 2, J = (t) => 1 - (1 - t) ** 2, U = (t) => t < 0.5 ? 2 * t ** 2 : 1 - (-2 * t + 2) ** 2 / 2, Y = (t) => t ** 3, Q = (t) => 1 - (1 - t) ** 3, Z = (t) => t < 0.5 ? 4 * t ** 3 : 1 - (-2 * t + 2) ** 3 / 2, tt = (t) => t ** 4, et = (t) => 1 - (1 - t) ** 4, nt = (t) => t < 0.5 ? 8 * t ** 4 : 1 - (-2 * t + 2) ** 4 / 2, it = (t) => t ** 5, st = (t) => 1 - (1 - t) ** 5, rt = (t) => t < 0.5 ? 16 * t ** 5 : 1 - (-2 * t + 2) ** 5 / 2, ot = (t) => t === 0 ? 0 : 2 ** (10 * t - 10), at = (t) => t === 1 ? 1 : 1 - 2 ** (-10 * t), ct = (t) => t === 0 ? 0 : t === 1 ? 1 : t < 0.5 ? 2 ** (20 * t - 10) / 2 : (2 - 2 ** (-20 * t + 10)) / 2, ut = (t) => 1 - Math.sqrt(1 - t ** 2), ft = (t) => Math.sqrt(1 - (t - 1) ** 2), mt = (t) => t < 0.5 ? (1 - Math.sqrt(1 - 4 * t ** 2)) / 2 : (Math.sqrt(-(2 * t - 3) * (2 * t - 1)) + 1) / 2, lt = (t) => 2.70158 * t ** 3 - 1.70158 * t ** 2, ht = (t) => 1 + 2.70158 * (t - 1) ** 3 + 1.70158 * (t - 1) ** 2, dt = (t, e = 1.70158 * 1.525) => t < 0.5 ? (2 * t) ** 2 * ((e + 1) * 2 * t - e) / 2 : ((2 * t - 2) ** 2 * ((e + 1) * (t * 2 - 2) + e) + 2) / 2, C = {
105
+ const G = (e) => e, V = (e) => 1 - Math.cos(e * Math.PI / 2), B = (e) => Math.sin(e * Math.PI / 2), K = (e) => -(Math.cos(Math.PI * e) - 1) / 2, X = (e) => e ** 2, J = (e) => 1 - (1 - e) ** 2, U = (e) => e < 0.5 ? 2 * e ** 2 : 1 - (-2 * e + 2) ** 2 / 2, Y = (e) => e ** 3, Q = (e) => 1 - (1 - e) ** 3, Z = (e) => e < 0.5 ? 4 * e ** 3 : 1 - (-2 * e + 2) ** 3 / 2, tt = (e) => e ** 4, et = (e) => 1 - (1 - e) ** 4, nt = (e) => e < 0.5 ? 8 * e ** 4 : 1 - (-2 * e + 2) ** 4 / 2, it = (e) => e ** 5, st = (e) => 1 - (1 - e) ** 5, rt = (e) => e < 0.5 ? 16 * e ** 5 : 1 - (-2 * e + 2) ** 5 / 2, ot = (e) => e === 0 ? 0 : 2 ** (10 * e - 10), at = (e) => e === 1 ? 1 : 1 - 2 ** (-10 * e), ct = (e) => e === 0 ? 0 : e === 1 ? 1 : e < 0.5 ? 2 ** (20 * e - 10) / 2 : (2 - 2 ** (-20 * e + 10)) / 2, ut = (e) => 1 - Math.sqrt(1 - e ** 2), ft = (e) => Math.sqrt(1 - (e - 1) ** 2), mt = (e) => e < 0.5 ? (1 - Math.sqrt(1 - 4 * e ** 2)) / 2 : (Math.sqrt(-(2 * e - 3) * (2 * e - 1)) + 1) / 2, lt = (e) => 2.70158 * e ** 3 - 1.70158 * e ** 2, ht = (e) => 1 + 2.70158 * (e - 1) ** 3 + 1.70158 * (e - 1) ** 2, dt = (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, C = {
100
106
  linear: G,
101
107
  sineIn: V,
102
108
  sineOut: B,
@@ -153,14 +159,14 @@ const G = (t) => t, V = (t) => 1 - Math.cos(t * Math.PI / 2), B = (t) => Math.si
153
159
  backOut: "cubic-bezier(0.175, 0.885, 0.32, 1.275)",
154
160
  backInOut: "cubic-bezier(0.68, -0.55, 0.265, 1.55)"
155
161
  };
156
- function pt(t) {
157
- return t === "percentage" ? "%" : t || "px";
162
+ function pt(e) {
163
+ return e === "percentage" ? "%" : e || "px";
158
164
  }
159
- function gt(t) {
160
- return t ? z[t] || t : z.linear;
165
+ function gt(e) {
166
+ return e ? z[e] || e : z.linear;
161
167
  }
162
- function yt(t, e, n, i) {
163
- const s = 3 * t, r = 3 * (n - t) - s, c = 1 - s - r, a = 3 * e, m = 3 * (i - e) - a, l = 1 - a - m, o = (h) => ((c * h + r) * h + s) * h, u = (h) => ((l * h + m) * h + a) * h, f = (h) => (3 * c * h + 2 * r) * h + s;
168
+ function yt(e, t, n, i) {
169
+ const s = 3 * e, r = 3 * (n - e) - s, c = 1 - s - r, a = 3 * t, m = 3 * (i - t) - a, l = 1 - a - m, o = (h) => ((c * h + r) * h + s) * h, u = (h) => ((l * h + m) * h + a) * h, f = (h) => (3 * c * h + 2 * r) * h + s;
164
170
  function p(h) {
165
171
  let d = h;
166
172
  for (let y = 0; y < 8; y++) {
@@ -180,19 +186,19 @@ function yt(t, e, n, i) {
180
186
  }
181
187
  return (h) => h <= 0 ? 0 : h >= 1 ? 1 : u(p(h));
182
188
  }
183
- function bt(t) {
184
- const e = t.match(
189
+ function bt(e) {
190
+ const t = e.match(
185
191
  /^cubic-bezier\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*\)$/
186
192
  );
187
- if (!e) return;
188
- const n = parseFloat(e[1]), i = parseFloat(e[2]), s = parseFloat(e[3]), r = parseFloat(e[4]);
193
+ if (!t) return;
194
+ const n = parseFloat(t[1]), i = parseFloat(t[2]), s = parseFloat(t[3]), r = parseFloat(t[4]);
189
195
  if (![n, i, s, r].some(isNaN))
190
196
  return yt(n, i, s, r);
191
197
  }
192
- function vt(t) {
193
- const e = t.match(/^linear\((.+)\)$/);
194
- if (!e) return;
195
- const n = e[1].split(",").map((c) => c.trim()).filter(Boolean);
198
+ function vt(e) {
199
+ const t = e.match(/^linear\((.+)\)$/);
200
+ if (!t) return;
201
+ const n = t[1].split(",").map((c) => c.trim()).filter(Boolean);
196
202
  if (n.length === 0) return;
197
203
  const i = [];
198
204
  for (const c of n) {
@@ -237,24 +243,24 @@ function vt(t) {
237
243
  return u.pos === o.pos ? u.output : o.output + (u.output - o.output) * (c - o.pos) / (u.pos - o.pos);
238
244
  };
239
245
  }
240
- function D(t) {
241
- if (!t) return;
242
- const e = C[t];
243
- return e || (bt(t) ?? vt(t) ?? C.linear);
246
+ function D(e) {
247
+ if (!e) return;
248
+ const t = C[e];
249
+ return t || (bt(e) ?? vt(e) ?? C.linear);
244
250
  }
245
- class Et extends I {
251
+ class Et extends O {
246
252
  animationGroups;
247
253
  delay;
248
254
  offset;
249
255
  offsetEasing;
250
256
  timingOptions;
251
- constructor(e, n = {}) {
252
- const i = e.flatMap((s) => [...s.animations]);
253
- super(i), this.animationGroups = e, this.delay = n.delay ?? 0, this.offset = n.offset ?? 0, this.offsetEasing = typeof n.offsetEasing == "function" ? n.offsetEasing : D(n.offsetEasing) ?? G, this.timingOptions = this.animationGroups.map((s) => s.getTimingOptions().map(({ delay: r, duration: c, iterations: a }) => ({
257
+ constructor(t, n = {}) {
258
+ const i = t.flatMap((s) => [...s.animations]);
259
+ super(i), this.animationGroups = t, this.delay = n.delay ?? 0, this.offset = n.offset ?? 0, this.offsetEasing = typeof n.offsetEasing == "function" ? n.offsetEasing : D(n.offsetEasing) ?? G, this.timingOptions = this.animationGroups.map((s) => s.getTimingOptions().map(({ delay: r, duration: c, iterations: a }) => ({
254
260
  delay: r,
255
261
  duration: Number.isFinite(c) ? c : 0,
256
262
  iterations: Number.isFinite(a) ? a : 1
257
- }))), this.applyOffsets(), this.ready = Promise.all(e.map((s) => s.ready)).then(() => {
263
+ }))), this.applyOffsets(), this.ready = Promise.all(t.map((s) => s.ready)).then(() => {
258
264
  });
259
265
  }
260
266
  /**
@@ -263,27 +269,27 @@ class Et extends I {
263
269
  * where i is the group index and last is the index of the final group.
264
270
  */
265
271
  calculateOffsets() {
266
- const e = this.animationGroups.length;
267
- if (e <= 1) return [0];
268
- const n = e - 1;
272
+ const t = this.animationGroups.length;
273
+ if (t <= 1) return [0];
274
+ const n = t - 1;
269
275
  return Array.from(
270
- { length: e },
276
+ { length: t },
271
277
  (i, s) => this.offsetEasing(s / n) * n * this.offset | 0
272
278
  );
273
279
  }
274
280
  applyOffsets() {
275
281
  if (this.animationGroups.length === 0 || this.animations.length === 0) return;
276
- const e = this.calculateOffsets(), n = this.getSequenceActiveDuration(e);
282
+ const t = this.calculateOffsets(), n = this.getSequenceActiveDuration(t);
277
283
  this.animationGroups.forEach((i, s) => {
278
284
  i.animations.forEach((r, c) => {
279
285
  const a = r.effect;
280
286
  if (!a) return;
281
- const { delay: m, duration: l, iterations: o } = this.timingOptions[s][c], u = m + e[s], f = n - (u + l * o);
287
+ const { delay: m, duration: l, iterations: o } = this.timingOptions[s][c], u = m + t[s], f = n - (u + l * o);
282
288
  a.updateTiming({ delay: u + this.delay, endDelay: f });
283
289
  });
284
290
  });
285
291
  }
286
- getSequenceActiveDuration(e) {
292
+ getSequenceActiveDuration(t) {
287
293
  const n = [];
288
294
  for (let i = 0; i < this.timingOptions.length; i++) {
289
295
  const s = this.timingOptions[i].reduce((r, c) => {
@@ -291,7 +297,7 @@ class Et extends I {
291
297
  const { delay: a, duration: m, iterations: l } = c;
292
298
  return Math.max(r, a + m * l);
293
299
  }, 0);
294
- n.push(e[i] + s);
300
+ n.push(t[i] + s);
295
301
  }
296
302
  return Math.max(...n);
297
303
  }
@@ -300,9 +306,9 @@ class Et extends I {
300
306
  * stagger offsets for all groups. Each entry specifies the target index
301
307
  * in the animationGroups array where the group should be inserted.
302
308
  */
303
- addGroups(e) {
304
- if (e.length === 0) return;
305
- const n = [...e].sort((i, s) => s.index - i.index);
309
+ addGroups(t) {
310
+ if (t.length === 0) return;
311
+ const n = [...t].sort((i, s) => s.index - i.index);
306
312
  for (const { index: i, group: s } of n) {
307
313
  const r = Math.min(i, this.animationGroups.length);
308
314
  this.animationGroups.splice(r, 0, s), this.timingOptions.splice(r, 0, s.getTimingOptions());
@@ -317,19 +323,19 @@ class Et extends I {
317
323
  * stagger offsets for remaining groups. Cancelled animations in removed
318
324
  * groups are returned.
319
325
  */
320
- removeGroups(e) {
326
+ removeGroups(t) {
321
327
  const n = [], i = [], s = [];
322
328
  for (let r = 0; r < this.animationGroups.length; r++)
323
- e(this.animationGroups[r]) ? n.push(this.animationGroups[r]) : (i.push(this.animationGroups[r]), s.push(this.timingOptions[r]));
329
+ t(this.animationGroups[r]) ? n.push(this.animationGroups[r]) : (i.push(this.animationGroups[r]), s.push(this.timingOptions[r]));
324
330
  if (n.length === 0) return n;
325
331
  for (const r of n)
326
332
  r.cancel();
327
333
  return this.animationGroups = i, this.timingOptions = s, this.animations = i.flatMap((r) => [...r.animations]), this.applyOffsets(), this.ready = Promise.all(this.animationGroups.map((r) => r.ready)).then(() => {
328
334
  }), n;
329
335
  }
330
- async onFinish(e) {
336
+ async onFinish(t) {
331
337
  try {
332
- await Promise.all(this.animationGroups.map((n) => n.finished)), e();
338
+ await Promise.all(this.animationGroups.map((n) => n.finished)), t();
333
339
  } catch (n) {
334
340
  console.warn("animation was interrupted - aborting onFinish callback - ", n);
335
341
  }
@@ -341,25 +347,25 @@ class _t {
341
347
  progress;
342
348
  _tickCbId;
343
349
  _finishHandler;
344
- constructor(e, n, i, s) {
350
+ constructor(t, n, i, s) {
345
351
  const r = new KeyframeEffect(n, [], {
346
352
  ...i,
347
353
  composite: "add"
348
354
  }), { timeline: c } = s;
349
- this._animation = new Animation(r, c), this._tickCbId = null, this.progress = null, this.customEffect = (a) => e(r.target, a), this._finishHandler = (a) => {
355
+ this._animation = new Animation(r, c), this._tickCbId = null, this.progress = null, this.customEffect = (a) => t(r.target, a), this._finishHandler = (a) => {
350
356
  this.effect.target?.getAnimations().find((m) => m === this._animation) || this.cancel();
351
357
  }, this.addEventListener("finish", this._finishHandler), this.addEventListener("remove", this._finishHandler);
352
358
  }
353
359
  // private tick method for customEffect loop implementation
354
360
  _tick() {
355
361
  try {
356
- const e = this.effect?.getComputedTiming().progress ?? null;
357
- e !== this.progress && (this.customEffect?.(e), this.progress = e), this._tickCbId = requestAnimationFrame(() => {
362
+ const t = this.effect?.getComputedTiming().progress ?? null;
363
+ t !== this.progress && (this.customEffect?.(t), this.progress = t), this._tickCbId = requestAnimationFrame(() => {
358
364
  this._tick();
359
365
  });
360
- } catch (e) {
366
+ } catch (t) {
361
367
  this._tickCbId = null, console.error(
362
- `failed to run customEffect! effectId: ${this.id}, error: ${e instanceof Error ? e.message : e}`
368
+ `failed to run customEffect! effectId: ${this.id}, error: ${t instanceof Error ? t.message : t}`
363
369
  );
364
370
  }
365
371
  }
@@ -367,39 +373,39 @@ class _t {
367
373
  get currentTime() {
368
374
  return this._animation.currentTime;
369
375
  }
370
- set currentTime(e) {
371
- this._animation.currentTime = e;
376
+ set currentTime(t) {
377
+ this._animation.currentTime = t;
372
378
  }
373
379
  get startTime() {
374
380
  return this._animation.startTime;
375
381
  }
376
- set startTime(e) {
377
- this._animation.startTime = e;
382
+ set startTime(t) {
383
+ this._animation.startTime = t;
378
384
  }
379
385
  get playbackRate() {
380
386
  return this._animation.playbackRate;
381
387
  }
382
- set playbackRate(e) {
383
- this._animation.playbackRate = e;
388
+ set playbackRate(t) {
389
+ this._animation.playbackRate = t;
384
390
  }
385
391
  // Animation basic properties
386
392
  get id() {
387
393
  return this._animation.id;
388
394
  }
389
- set id(e) {
390
- this._animation.id = e;
395
+ set id(t) {
396
+ this._animation.id = t;
391
397
  }
392
398
  get effect() {
393
399
  return this._animation.effect;
394
400
  }
395
- set effect(e) {
396
- this._animation.effect = e;
401
+ set effect(t) {
402
+ this._animation.effect = t;
397
403
  }
398
404
  get timeline() {
399
405
  return this._animation.timeline;
400
406
  }
401
- set timeline(e) {
402
- this._animation.timeline = e;
407
+ set timeline(t) {
408
+ this._animation.timeline = t;
403
409
  }
404
410
  // Animation readonly state properties
405
411
  get finished() {
@@ -421,20 +427,20 @@ class _t {
421
427
  get oncancel() {
422
428
  return this._animation.oncancel;
423
429
  }
424
- set oncancel(e) {
425
- this._animation.oncancel = e;
430
+ set oncancel(t) {
431
+ this._animation.oncancel = t;
426
432
  }
427
433
  get onfinish() {
428
434
  return this._animation.onfinish;
429
435
  }
430
- set onfinish(e) {
431
- this._animation.onfinish = e;
436
+ set onfinish(t) {
437
+ this._animation.onfinish = t;
432
438
  }
433
439
  get onremove() {
434
440
  return this._animation.onremove;
435
441
  }
436
- set onremove(e) {
437
- this._animation.onremove = e;
442
+ set onremove(t) {
443
+ this._animation.onremove = t;
438
444
  }
439
445
  // CustomAnimation overridden methods
440
446
  play() {
@@ -461,34 +467,34 @@ class _t {
461
467
  reverse() {
462
468
  this._animation.reverse();
463
469
  }
464
- updatePlaybackRate(e) {
465
- this._animation.updatePlaybackRate(e);
470
+ updatePlaybackRate(t) {
471
+ this._animation.updatePlaybackRate(t);
466
472
  }
467
473
  // Animation events API
468
- addEventListener(e, n, i) {
469
- this._animation.addEventListener(e, n, i);
474
+ addEventListener(t, n, i) {
475
+ this._animation.addEventListener(t, n, i);
470
476
  }
471
- removeEventListener(e, n, i) {
472
- this._animation.removeEventListener(e, n, i);
477
+ removeEventListener(t, n, i) {
478
+ this._animation.removeEventListener(t, n, i);
473
479
  }
474
- dispatchEvent(e) {
475
- return this._animation.dispatchEvent(e);
480
+ dispatchEvent(t) {
481
+ return this._animation.dispatchEvent(t);
476
482
  }
477
483
  }
478
- function wt(t) {
479
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
484
+ function wt(e) {
485
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
480
486
  }
481
487
  var A = { exports: {} }, F = A.exports, x;
482
- function Ot() {
483
- return x || (x = 1, (function(t) {
484
- (function(e) {
488
+ function It() {
489
+ return x || (x = 1, (function(e) {
490
+ (function(t) {
485
491
  var n = function() {
486
- }, i = e.requestAnimationFrame || e.webkitRequestAnimationFrame || e.mozRequestAnimationFrame || e.msRequestAnimationFrame || function(o) {
492
+ }, i = t.requestAnimationFrame || t.webkitRequestAnimationFrame || t.mozRequestAnimationFrame || t.msRequestAnimationFrame || function(o) {
487
493
  return setTimeout(o, 16);
488
494
  };
489
495
  function s() {
490
496
  var o = this;
491
- o.reads = [], o.writes = [], o.raf = i.bind(e);
497
+ o.reads = [], o.writes = [], o.raf = i.bind(t);
492
498
  }
493
499
  s.prototype = {
494
500
  constructor: s,
@@ -604,68 +610,68 @@ function Ot() {
604
610
  for (var f in u)
605
611
  u.hasOwnProperty(f) && (o[f] = u[f]);
606
612
  }
607
- var l = e.fastdom = e.fastdom || new s();
608
- t.exports = l;
613
+ var l = t.fastdom = t.fastdom || new s();
614
+ e.exports = l;
609
615
  })(typeof window < "u" ? window : typeof F < "u" ? F : globalThis);
610
616
  })(A)), A.exports;
611
617
  }
612
- var It = Ot();
613
- const E = /* @__PURE__ */ wt(It), $ = {};
614
- function Nt(t) {
615
- Object.assign($, t);
618
+ var Ot = It();
619
+ const E = /* @__PURE__ */ wt(Ot), $ = {};
620
+ function Nt(e) {
621
+ Object.assign($, e);
616
622
  }
617
- function At(t) {
618
- return t in $ ? $[t] : (console.warn(
619
- `${t} not found in registry. Please make sure to import and register the preset.`
623
+ function At(e) {
624
+ return e in $ ? $[e] : (console.warn(
625
+ `${e} not found in registry. Please make sure to import and register the preset.`
620
626
  ), null);
621
627
  }
622
- function w(t, e) {
623
- return t ? (e || document).getElementById(t) : null;
628
+ function w(e, t) {
629
+ return e ? (t || document).getElementById(e) : null;
624
630
  }
625
- function Tt(t, e) {
626
- return t?.matches(`[data-motion-part~="${e}"]`) ? t : t?.querySelector(`[data-motion-part~="${e}"]`);
631
+ function Tt(e, t) {
632
+ return e?.matches(`[data-motion-part~="${t}"]`) ? e : e?.querySelector(`[data-motion-part~="${t}"]`);
627
633
  }
628
- function kt(t) {
629
- const e = t.alternate ? "alternate" : "";
630
- return t.reversed ? `${e ? `${e}-` : ""}reverse` : e || "normal";
634
+ function kt(e) {
635
+ const t = e.alternate ? "alternate" : "";
636
+ return e.reversed ? `${t ? `${t}-` : ""}reverse` : t || "normal";
631
637
  }
632
- function k(t) {
633
- return `${t.value}${pt(t.unit)}`;
638
+ function k(e) {
639
+ return `${e.value}${pt(e.unit)}`;
634
640
  }
635
- function M(t, e, n) {
636
- return `${t.name || "cover"} ${n && t.offset.unit !== "percentage" ? `calc(100% + ${k(t.offset)}${e ? ` + ${e}` : ""})` : e ? `calc(${k(t.offset)} + ${e})` : k(t.offset)}`;
641
+ function M(e, t, n) {
642
+ return `${e.name || "cover"} ${n && e.offset.unit !== "percentage" ? `calc(100% + ${k(e.offset)}${t ? ` + ${t}` : ""})` : t ? `calc(${k(e.offset)} + ${t})` : k(e.offset)}`;
637
643
  }
638
- function R(t) {
644
+ function R(e) {
639
645
  return {
640
- start: M(t.startOffset, t.startOffsetAdd),
641
- end: M(t.endOffset, t.endOffsetAdd, !0)
646
+ start: M(e.startOffset, e.startOffsetAdd),
647
+ end: M(e.endOffset, e.endOffsetAdd, !0)
642
648
  };
643
649
  }
644
- function L(t) {
645
- return (e) => E.measure(() => e(t));
650
+ function L(e) {
651
+ return (t) => E.measure(() => t(e));
646
652
  }
647
- function j(t) {
648
- return (e) => E.mutate(() => e(t));
653
+ function j(e) {
654
+ return (t) => E.mutate(() => t(e));
649
655
  }
650
- function O(t) {
651
- if (t.namedEffect) {
652
- const e = t.namedEffect.type;
653
- return typeof e == "string" ? At(e) : null;
654
- } else if (t.keyframeEffect) {
655
- const e = (i) => {
656
+ function I(e) {
657
+ if (e.namedEffect) {
658
+ const t = e.namedEffect.type;
659
+ return typeof t == "string" ? At(t) : null;
660
+ } else if (e.keyframeEffect) {
661
+ const t = (i) => {
656
662
  const { name: s, keyframes: r } = i.keyframeEffect;
657
663
  return [{ ...i, name: s, keyframes: r }];
658
664
  };
659
- return { web: e, style: e, getNames: (i) => {
665
+ return { web: t, style: t, getNames: (i) => {
660
666
  const { effectId: s } = i, { name: r } = i.keyframeEffect, c = r || s;
661
667
  return c ? [c] : [];
662
668
  } };
663
- } else if (t.customEffect)
664
- return (e) => [{ ...e, keyframes: [] }];
669
+ } else if (e.customEffect)
670
+ return (t) => [{ ...t, keyframes: [] }];
665
671
  return null;
666
672
  }
667
- function H(t, e, n, i) {
668
- return t.map((s, r) => {
673
+ function H(e, t, n, i) {
674
+ return e.map((s, r) => {
669
675
  const c = {
670
676
  fill: s.fill,
671
677
  easing: gt(s.easing),
@@ -673,7 +679,7 @@ function H(t, e, n, i) {
673
679
  composite: s.composite,
674
680
  direction: kt(s)
675
681
  };
676
- return S(e) ? (c.duration = s.duration, c.delay = s.delay || 0) : e?.trigger === "view-progress" && (i || window.ViewTimeline) ? c.duration = "auto" : (c.duration = 99.99, c.delay = 0.01), {
682
+ return S(t) ? (c.duration = s.duration, c.delay = s.delay || 0) : t?.trigger === "view-progress" && (i || window.ViewTimeline) ? c.duration = "auto" : (c.duration = 99.99, c.delay = 0.01), {
677
683
  effect: s,
678
684
  options: c,
679
685
  id: n && `${n}-${r + 1}`,
@@ -681,50 +687,50 @@ function H(t, e, n, i) {
681
687
  };
682
688
  });
683
689
  }
684
- function S(t) {
685
- return !t || t.trigger !== "pointer-move" && t.trigger !== "view-progress";
690
+ function S(e) {
691
+ return !e || e.trigger !== "pointer-move" && e.trigger !== "view-progress";
686
692
  }
687
- function N(t, e, n, i, s) {
688
- if (t) {
689
- if (S(i) && (e.duration = e.duration || 1, s?.reducedMotion))
690
- if (e.iterations === 1 || e.iterations == null)
691
- e = { ...e, duration: 1 };
693
+ function N(e, t, n, i, s) {
694
+ if (e) {
695
+ if (S(i) && (t.duration = t.duration || 1, s?.reducedMotion))
696
+ if (t.iterations === 1 || t.iterations == null)
697
+ t = { ...t, duration: 1 };
692
698
  else
693
699
  return [];
694
700
  let r;
695
- return n instanceof HTMLElement && (r = { measure: L(n), mutate: j(n) }), t.web ? t.web(e, r, s) : t(e, r, s);
701
+ return n instanceof HTMLElement && (r = { measure: L(n), mutate: j(n) }), e.web ? e.web(t, r, s) : e(t, r, s);
696
702
  }
697
703
  return [];
698
704
  }
699
- function W(t, e, n, i, s) {
700
- const r = t instanceof HTMLElement ? t : w(t, s);
701
- if (n?.trigger === "pointer-move" && !e.keyframeEffect) {
702
- let f = e;
703
- e.customEffect && (f = {
704
- ...e,
705
+ function W(e, t, n, i, s) {
706
+ const r = e instanceof HTMLElement ? e : w(e, s);
707
+ if (n?.trigger === "pointer-move" && !t.keyframeEffect) {
708
+ let f = t;
709
+ t.customEffect && (f = {
710
+ ...t,
705
711
  namedEffect: { id: "", type: "CustomMouse" }
706
712
  });
707
- const p = O(
713
+ const p = I(
708
714
  f
709
715
  ), h = N(
710
716
  p,
711
- e,
717
+ t,
712
718
  r,
713
719
  n,
714
720
  i
715
721
  );
716
722
  return typeof h != "function" ? null : h(r);
717
723
  }
718
- const c = O(e), a = N(
724
+ const c = I(t), a = N(
719
725
  c,
720
- e,
726
+ t,
721
727
  r,
722
728
  n,
723
729
  i
724
730
  );
725
731
  if (!a || a.length === 0)
726
732
  return null;
727
- const m = H(a, n, e.effectId);
733
+ const m = H(a, n, t.effectId);
728
734
  let l;
729
735
  const o = n?.trigger === "view-progress";
730
736
  o && window.ViewTimeline && (l = new ViewTimeline({
@@ -748,7 +754,7 @@ function W(t, e, n, i, s) {
748
754
  b.rangeStart = _, b.rangeEnd = T, b.play();
749
755
  });
750
756
  else {
751
- const { startOffset: _, endOffset: T } = e;
757
+ const { startOffset: _, endOffset: T } = t;
752
758
  E.mutate(() => {
753
759
  const q = f.startOffset || _, P = f.endOffset || T;
754
760
  Object.assign(b, {
@@ -767,29 +773,29 @@ function W(t, e, n, i, s) {
767
773
  }
768
774
  return h && (b.id = h), b;
769
775
  });
770
- return new I(u, {
771
- ...e,
776
+ return new O(u, {
777
+ ...t,
772
778
  trigger: { ...n || {} },
773
779
  // make sure the group is ready after all animation targets are measured and mutated
774
780
  measured: new Promise((f) => E.mutate(f))
775
781
  });
776
782
  }
777
- function $t(t, e) {
778
- return t ? `#${t}${e ? `[data-motion-part~="${e}"]` : ""}` : "";
783
+ function $t(e, t) {
784
+ return e ? `#${e}${t ? `[data-motion-part~="${t}"]` : ""}` : "";
779
785
  }
780
- function St(t, e) {
781
- const { duration: n, delay: i, iterations: s = 1, fill: r, easing: c = "linear", direction: a } = t.options, m = t.effect.name, l = n === "auto";
782
- return `${m} ${l ? "auto" : `${n}ms`}${l ? " " : ` ${i || 1}ms `}${c}${r && r !== "none" ? ` ${r}` : ""} ${!s || s === 1 / 0 ? "infinite" : s}${a === "normal" ? "" : ` ${a}`} ${e ? "" : "paused"}`;
786
+ function St(e, t) {
787
+ const { duration: n, delay: i, iterations: s = 1, fill: r, easing: c = "linear", direction: a } = e.options, m = e.effect.name, l = n === "auto";
788
+ return `${m} ${l ? "auto" : `${n}ms`}${l ? " " : ` ${i || 1}ms `}${c}${r && r !== "none" ? ` ${r}` : ""} ${!s || s === 1 / 0 ? "infinite" : s}${a === "normal" ? "" : ` ${a}`} ${t ? "" : "paused"}`;
783
789
  }
784
- function qt(t, e, n) {
785
- return t?.style ? (S(n) && (e.duration = e.duration || 1), t.style(e)) : [];
790
+ function qt(e, t, n) {
791
+ return e?.style ? (S(n) && (t.duration = t.duration || 1), e.style(t)) : [];
786
792
  }
787
- function Gt(t, e, n) {
788
- const i = O(e), s = qt(i, e), r = H(s, n, e.effectId, !0), c = n?.trigger === "view-progress";
793
+ function Gt(e, t, n) {
794
+ const i = I(t), s = qt(i, t), r = H(s, n, t.effectId, !0), c = n?.trigger === "view-progress";
789
795
  return r.map((a, m) => {
790
796
  const { start: l, end: o } = c ? R(a.effect) : {};
791
797
  return {
792
- target: $t(t, a.part),
798
+ target: $t(e, a.part),
793
799
  animation: St(a, c),
794
800
  composition: a.options.composite,
795
801
  custom: a.effect.custom,
@@ -801,36 +807,36 @@ function Gt(t, e, n) {
801
807
  };
802
808
  });
803
809
  }
804
- function Pt(t, e, n) {
805
- const i = O(e), s = t instanceof HTMLElement ? t : w(t);
810
+ function Pt(e, t, n) {
811
+ const i = I(t), s = e instanceof HTMLElement ? e : w(e);
806
812
  if (i && i.prepare && s) {
807
813
  const r = { measure: L(s), mutate: j(s) };
808
- i.prepare(e, r);
814
+ i.prepare(t, r);
809
815
  }
810
816
  n && E.mutate(n);
811
817
  }
812
- function Ct(t, e) {
813
- const n = O(e);
818
+ function Ct(e, t) {
819
+ const n = I(t);
814
820
  if (!n)
815
821
  return null;
816
822
  if (!n.style)
817
- return e.effectId && t ? zt(t, e.effectId) : null;
818
- const i = n.getNames(e), r = (typeof t == "string" ? w(t) : t)?.getAnimations(), c = r?.map((m) => m.animationName) || [], a = [];
823
+ return t.effectId && e ? zt(e, t.effectId) : null;
824
+ const i = n.getNames(t), r = (typeof e == "string" ? w(e) : e)?.getAnimations(), c = r?.map((m) => m.animationName) || [], a = [];
819
825
  return i.forEach((m) => {
820
826
  c.includes(m) && a.push(
821
827
  r?.find((l) => l.animationName === m)
822
828
  );
823
- }), a?.length ? new I(a) : null;
829
+ }), a?.length ? new O(a) : null;
824
830
  }
825
- function zt(t, e) {
826
- const i = (typeof t == "string" ? w(t) : t)?.getAnimations().filter((s) => {
831
+ function zt(e, t) {
832
+ const i = (typeof e == "string" ? w(e) : e)?.getAnimations().filter((s) => {
827
833
  const r = s.id || s.animationName;
828
- return r ? r.startsWith(e) : !0;
834
+ return r ? r.startsWith(t) : !0;
829
835
  });
830
- return i?.length ? new I(i) : null;
836
+ return i?.length ? new O(i) : null;
831
837
  }
832
- function Dt(t, e, n, i = {}) {
833
- const { disabled: s, allowActiveEvent: r, ...c } = i, a = W(t, e, n, c);
838
+ function Dt(e, t, n, i = {}) {
839
+ const { disabled: s, allowActiveEvent: r, ...c } = i, a = W(e, t, n, c);
834
840
  if (!a)
835
841
  return null;
836
842
  let m = {};
@@ -860,7 +866,7 @@ function Dt(t, e, n, i = {}) {
860
866
  }
861
867
  }));
862
868
  } else if (n.trigger === "pointer-move") {
863
- const l = e, { centeredToTarget: o, transitionDuration: u, transitionEasing: f } = l, p = n.axis;
869
+ const l = t, { centeredToTarget: o, transitionDuration: u, transitionEasing: f } = l, p = n.axis;
864
870
  if (l.keyframeEffect) {
865
871
  const h = a;
866
872
  return h.animations?.length === 0 ? null : {
@@ -884,7 +890,7 @@ function Dt(t, e, n, i = {}) {
884
890
  m = {
885
891
  centeredToTarget: o,
886
892
  allowActiveEvent: r
887
- }, e.customEffect && u && (m.transitionDuration = u, m.transitionEasing = D(f)), m.target = a.target;
893
+ }, t.customEffect && u && (m.transitionDuration = u, m.transitionEasing = D(f)), m.target = a.target;
888
894
  }
889
895
  return {
890
896
  ...m,
@@ -907,34 +913,34 @@ function Dt(t, e, n, i = {}) {
907
913
  }
908
914
  };
909
915
  }
910
- function Ft(t, e, n, i = !1) {
911
- const s = Ct(t, e);
916
+ function Ft(e, t, n, i = !1) {
917
+ const s = Ct(e, t);
912
918
  return s ? (s.ready = new Promise((r) => {
913
- Pt(t, e, r);
914
- }), s) : W(t, e, n, { reducedMotion: i });
919
+ Pt(e, t, r);
920
+ }), s) : W(e, t, n, { reducedMotion: i });
915
921
  }
916
- function xt(t) {
917
- return t === null ? [null] : typeof t == "string" ? Array.from(document.querySelectorAll(t)) : Array.isArray(t) ? t : [t];
922
+ function xt(e) {
923
+ return e === null ? [null] : typeof e == "string" ? Array.from(document.querySelectorAll(e)) : Array.isArray(e) ? e : [e];
918
924
  }
919
- function Mt(t, e) {
925
+ function Mt(e, t) {
920
926
  const n = [];
921
- for (const { target: i, options: s } of t) {
927
+ for (const { target: i, options: s } of e) {
922
928
  const r = xt(i);
923
929
  for (const c of r) {
924
930
  const a = Ft(
925
931
  c,
926
932
  s,
927
933
  void 0,
928
- e?.reducedMotion
934
+ t?.reducedMotion
929
935
  );
930
- a instanceof I && n.push(a);
936
+ a instanceof O && n.push(a);
931
937
  }
932
938
  }
933
939
  return n;
934
940
  }
935
- function Rt(t, e, n) {
936
- const i = Mt(e, n);
937
- return new Et(i, t);
941
+ function Rt(e, t, n) {
942
+ const i = Mt(t, n);
943
+ return new Et(i, e);
938
944
  }
939
945
  export {
940
946
  lt as backIn,