@wix/motion 2.1.4 → 2.1.6

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
@@ -9,8 +9,8 @@ class I {
9
9
  }
10
10
  _getAnimationWithLongestEndTime() {
11
11
  return this.animations.reduce((e, n) => {
12
- const i = e.effect?.getComputedTiming().endTime ?? 0, r = n.effect?.getComputedTiming().endTime ?? 0;
13
- return i > r ? e : n;
12
+ const i = e.effect?.getComputedTiming().endTime ?? 0, s = n.effect?.getComputedTiming().endTime ?? 0;
13
+ return i > s ? e : n;
14
14
  }, this.animations[0]);
15
15
  }
16
16
  getProgress() {
@@ -34,8 +34,8 @@ class I {
34
34
  }
35
35
  progress(e) {
36
36
  for (const n of this.animations) {
37
- const { delay: i, duration: r, iterations: s } = n.effect.getTiming(), u = (Number.isFinite(r) ? r : 0) * (Number.isFinite(s) ? s : 1);
38
- n.currentTime = ((i || 0) + u) * e;
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;
39
39
  }
40
40
  }
41
41
  cancel() {
@@ -53,8 +53,8 @@ class I {
53
53
  if (n && !this.isCSS) {
54
54
  const i = n.effect?.target;
55
55
  if (i) {
56
- const r = new Event("animationend");
57
- i.dispatchEvent(r);
56
+ const s = new Event("animationend");
57
+ i.dispatchEvent(s);
58
58
  }
59
59
  }
60
60
  e();
@@ -69,10 +69,10 @@ class I {
69
69
  if (n.name === "AbortError") {
70
70
  const i = this.animations[0];
71
71
  if (i && !this.isCSS) {
72
- const r = i.effect?.target;
73
- if (r) {
74
- const s = new Event("animationcancel");
75
- r.dispatchEvent(s);
72
+ const s = i.effect?.target;
73
+ if (s) {
74
+ const r = new Event("animationcancel");
75
+ s.dispatchEvent(r);
76
76
  }
77
77
  }
78
78
  e();
@@ -87,11 +87,11 @@ class I {
87
87
  }
88
88
  getTimingOptions() {
89
89
  return this.animations.map((e) => {
90
- const n = e.effect?.getTiming(), i = n?.delay ?? 0, r = Number(n?.duration) || 0, s = n?.iterations ?? 1;
90
+ const n = e.effect?.getTiming(), i = n?.delay ?? 0, s = Number(n?.duration) || 0, r = n?.iterations ?? 1;
91
91
  return {
92
92
  delay: i,
93
- duration: r,
94
- iterations: s
93
+ duration: s,
94
+ iterations: r
95
95
  };
96
96
  });
97
97
  }
@@ -160,7 +160,7 @@ function gt(t) {
160
160
  return t ? z[t] || t : z.linear;
161
161
  }
162
162
  function yt(t, e, n, i) {
163
- const r = 3 * t, s = 3 * (n - t) - r, u = 1 - r - s, a = 3 * e, m = 3 * (i - e) - a, l = 1 - a - m, o = (h) => ((u * h + s) * h + r) * h, c = (h) => ((l * h + m) * h + a) * h, f = (h) => (3 * u * h + 2 * s) * h + r;
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;
164
164
  function p(h) {
165
165
  let d = h;
166
166
  for (let y = 0; y < 8; y++) {
@@ -178,63 +178,63 @@ function yt(t, e, n, i) {
178
178
  }
179
179
  return d;
180
180
  }
181
- return (h) => h <= 0 ? 0 : h >= 1 ? 1 : c(p(h));
181
+ return (h) => h <= 0 ? 0 : h >= 1 ? 1 : u(p(h));
182
182
  }
183
183
  function bt(t) {
184
184
  const e = t.match(
185
185
  /^cubic-bezier\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*\)$/
186
186
  );
187
187
  if (!e) return;
188
- const n = parseFloat(e[1]), i = parseFloat(e[2]), r = parseFloat(e[3]), s = parseFloat(e[4]);
189
- if (![n, i, r, s].some(isNaN))
190
- return yt(n, i, r, s);
188
+ const n = parseFloat(e[1]), i = parseFloat(e[2]), s = parseFloat(e[3]), r = parseFloat(e[4]);
189
+ if (![n, i, s, r].some(isNaN))
190
+ return yt(n, i, s, r);
191
191
  }
192
192
  function vt(t) {
193
193
  const e = t.match(/^linear\((.+)\)$/);
194
194
  if (!e) return;
195
- const n = e[1].split(",").map((u) => u.trim()).filter(Boolean);
195
+ const n = e[1].split(",").map((c) => c.trim()).filter(Boolean);
196
196
  if (n.length === 0) return;
197
197
  const i = [];
198
- for (const u of n) {
199
- const a = u.split(/\s+/), m = parseFloat(a[0]);
198
+ for (const c of n) {
199
+ const a = c.split(/\s+/), m = parseFloat(a[0]);
200
200
  if (isNaN(m)) return;
201
201
  const l = [];
202
202
  for (let o = 1; o < a.length; o++)
203
203
  if (a[o].endsWith("%")) {
204
- const c = parseFloat(a[o]) / 100;
205
- if (isNaN(c)) return;
206
- l.push(c);
204
+ const u = parseFloat(a[o]) / 100;
205
+ if (isNaN(u)) return;
206
+ l.push(u);
207
207
  }
208
208
  l.length === 0 ? i.push({ output: m, pos: null }) : l.length === 1 ? i.push({ output: m, pos: l[0] }) : (i.push({ output: m, pos: l[0] }), i.push({ output: m, pos: l[1] }));
209
209
  }
210
210
  if (i.length === 0) return;
211
211
  i[0].pos === null && (i[0].pos = 0), i[i.length - 1].pos === null && (i[i.length - 1].pos = 1);
212
- let r = 0;
213
- for (; r < i.length; )
214
- if (i[r].pos === null) {
215
- const u = r - 1;
216
- let a = r;
212
+ let s = 0;
213
+ for (; s < i.length; )
214
+ if (i[s].pos === null) {
215
+ const c = s - 1;
216
+ let a = s;
217
217
  for (; a < i.length && i[a].pos === null; ) a++;
218
- const m = i[u].pos, l = i[a].pos, o = a - u;
219
- for (let c = u + 1; c < a; c++)
220
- i[c].pos = m + (l - m) * (c - u) / o;
221
- r = a + 1;
218
+ const m = i[c].pos, l = i[a].pos, o = a - c;
219
+ for (let u = c + 1; u < a; u++)
220
+ i[u].pos = m + (l - m) * (u - c) / o;
221
+ s = a + 1;
222
222
  } else
223
- r++;
224
- for (let u = 1; u < i.length; u++)
225
- i[u].pos < i[u - 1].pos && (i[u].pos = i[u - 1].pos);
226
- const s = i;
227
- return (u) => {
228
- if (u <= s[0].pos) return s[0].output;
229
- const a = s[s.length - 1];
230
- if (u >= a.pos) return a.output;
231
- let m = 0, l = s.length - 1;
223
+ s++;
224
+ for (let c = 1; c < i.length; c++)
225
+ i[c].pos < i[c - 1].pos && (i[c].pos = i[c - 1].pos);
226
+ const r = i;
227
+ return (c) => {
228
+ if (c <= r[0].pos) return r[0].output;
229
+ const a = r[r.length - 1];
230
+ if (c >= a.pos) return a.output;
231
+ let m = 0, l = r.length - 1;
232
232
  for (; m < l - 1; ) {
233
233
  const f = m + l >>> 1;
234
- s[f].pos <= u ? m = f : l = f;
234
+ r[f].pos <= c ? m = f : l = f;
235
235
  }
236
- const o = s[m], c = s[l];
237
- return c.pos === o.pos ? c.output : o.output + (c.output - o.output) * (u - o.pos) / (c.pos - o.pos);
236
+ const o = r[m], u = r[l];
237
+ return u.pos === o.pos ? u.output : o.output + (u.output - o.output) * (c - o.pos) / (u.pos - o.pos);
238
238
  };
239
239
  }
240
240
  function D(t) {
@@ -249,12 +249,12 @@ class Et extends I {
249
249
  offsetEasing;
250
250
  timingOptions;
251
251
  constructor(e, n = {}) {
252
- const i = e.flatMap((r) => [...r.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((r) => r.getTimingOptions().map(({ delay: s, duration: u, iterations: a }) => ({
254
- delay: s,
255
- duration: Number.isFinite(u) ? u : 0,
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 }) => ({
254
+ delay: r,
255
+ duration: Number.isFinite(c) ? c : 0,
256
256
  iterations: Number.isFinite(a) ? a : 1
257
- }))), this.applyOffsets(), this.ready = Promise.all(e.map((r) => r.ready)).then(() => {
257
+ }))), this.applyOffsets(), this.ready = Promise.all(e.map((s) => s.ready)).then(() => {
258
258
  });
259
259
  }
260
260
  /**
@@ -268,30 +268,30 @@ class Et extends I {
268
268
  const n = e - 1;
269
269
  return Array.from(
270
270
  { length: e },
271
- (i, r) => this.offsetEasing(r / n) * n * this.offset | 0
271
+ (i, s) => this.offsetEasing(s / n) * n * this.offset | 0
272
272
  );
273
273
  }
274
274
  applyOffsets() {
275
275
  if (this.animationGroups.length === 0 || this.animations.length === 0) return;
276
276
  const e = this.calculateOffsets(), n = this.getSequenceActiveDuration(e);
277
- this.animationGroups.forEach((i, r) => {
278
- i.animations.forEach((s, u) => {
279
- const a = s.effect;
277
+ this.animationGroups.forEach((i, s) => {
278
+ i.animations.forEach((r, c) => {
279
+ const a = r.effect;
280
280
  if (!a) return;
281
- const { delay: m, duration: l, iterations: o } = this.timingOptions[r][u], c = m + e[r], f = n - (c + l * o);
282
- a.updateTiming({ delay: c + this.delay, endDelay: f });
281
+ const { delay: m, duration: l, iterations: o } = this.timingOptions[s][c], u = m + e[s], f = n - (u + l * o);
282
+ a.updateTiming({ delay: u + this.delay, endDelay: f });
283
283
  });
284
284
  });
285
285
  }
286
286
  getSequenceActiveDuration(e) {
287
287
  const n = [];
288
288
  for (let i = 0; i < this.timingOptions.length; i++) {
289
- const r = this.timingOptions[i].reduce((s, u) => {
290
- if (!u) return s;
291
- const { delay: a, duration: m, iterations: l } = u;
292
- return Math.max(s, a + m * l);
289
+ const s = this.timingOptions[i].reduce((r, c) => {
290
+ if (!c) return r;
291
+ const { delay: a, duration: m, iterations: l } = c;
292
+ return Math.max(r, a + m * l);
293
293
  }, 0);
294
- n.push(e[i] + r);
294
+ n.push(e[i] + s);
295
295
  }
296
296
  return Math.max(...n);
297
297
  }
@@ -302,12 +302,12 @@ class Et extends I {
302
302
  */
303
303
  addGroups(e) {
304
304
  if (e.length === 0) return;
305
- const n = [...e].sort((i, r) => r.index - i.index);
306
- for (const { index: i, group: r } of n) {
307
- const s = Math.min(i, this.animationGroups.length);
308
- this.animationGroups.splice(s, 0, r), this.timingOptions.splice(s, 0, r.getTimingOptions());
309
- const u = [...r.animations], a = this.animationGroups.slice(0, s).reduce((m, l) => m + l.animations.length, 0);
310
- this.animations.splice(a, 0, ...u);
305
+ const n = [...e].sort((i, s) => s.index - i.index);
306
+ for (const { index: i, group: s } of n) {
307
+ const r = Math.min(i, this.animationGroups.length);
308
+ this.animationGroups.splice(r, 0, s), this.timingOptions.splice(r, 0, s.getTimingOptions());
309
+ const c = [...s.animations], a = this.animationGroups.slice(0, r).reduce((m, l) => m + l.animations.length, 0);
310
+ this.animations.splice(a, 0, ...c);
311
311
  }
312
312
  this.applyOffsets(), this.ready = Promise.all(this.animationGroups.map((i) => i.ready)).then(() => {
313
313
  });
@@ -318,13 +318,13 @@ class Et extends I {
318
318
  * groups are returned.
319
319
  */
320
320
  removeGroups(e) {
321
- const n = [], i = [], r = [];
322
- for (let s = 0; s < this.animationGroups.length; s++)
323
- e(this.animationGroups[s]) ? n.push(this.animationGroups[s]) : (i.push(this.animationGroups[s]), r.push(this.timingOptions[s]));
321
+ const n = [], i = [], s = [];
322
+ 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]));
324
324
  if (n.length === 0) return n;
325
- for (const s of n)
326
- s.cancel();
327
- return this.animationGroups = i, this.timingOptions = r, this.animations = i.flatMap((s) => [...s.animations]), this.applyOffsets(), this.ready = Promise.all(this.animationGroups.map((s) => s.ready)).then(() => {
325
+ for (const r of n)
326
+ r.cancel();
327
+ 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
328
  }), n;
329
329
  }
330
330
  async onFinish(e) {
@@ -341,12 +341,12 @@ class _t {
341
341
  progress;
342
342
  _tickCbId;
343
343
  _finishHandler;
344
- constructor(e, n, i, r) {
345
- const s = new KeyframeEffect(n, [], {
344
+ constructor(e, n, i, s) {
345
+ const r = new KeyframeEffect(n, [], {
346
346
  ...i,
347
347
  composite: "add"
348
- }), { timeline: u } = r;
349
- this._animation = new Animation(s, u), this._tickCbId = null, this.progress = null, this.customEffect = (a) => e(s.target, a), this._finishHandler = (a) => {
348
+ }), { 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) => {
350
350
  this.effect.target?.getAnimations().find((m) => m === this._animation) || this.cancel();
351
351
  }, this.addEventListener("finish", this._finishHandler), this.addEventListener("remove", this._finishHandler);
352
352
  }
@@ -486,12 +486,12 @@ function Ot() {
486
486
  }, i = e.requestAnimationFrame || e.webkitRequestAnimationFrame || e.mozRequestAnimationFrame || e.msRequestAnimationFrame || function(o) {
487
487
  return setTimeout(o, 16);
488
488
  };
489
- function r() {
489
+ function s() {
490
490
  var o = this;
491
491
  o.reads = [], o.writes = [], o.raf = i.bind(e);
492
492
  }
493
- r.prototype = {
494
- constructor: r,
493
+ s.prototype = {
494
+ constructor: s,
495
495
  /**
496
496
  * We run this inside a try catch
497
497
  * so that if any jobs error, we
@@ -501,7 +501,7 @@ function Ot() {
501
501
  * @param {Array} tasks
502
502
  */
503
503
  runTasks: function(o) {
504
- for (var c; c = o.shift(); ) c();
504
+ for (var u; u = o.shift(); ) u();
505
505
  },
506
506
  /**
507
507
  * Adds a job to the read batch and
@@ -511,9 +511,9 @@ function Ot() {
511
511
  * @param {Object} ctx the context to be bound to `fn` (optional).
512
512
  * @public
513
513
  */
514
- measure: function(o, c) {
515
- var f = c ? o.bind(c) : o;
516
- return this.reads.push(f), s(this), f;
514
+ measure: function(o, u) {
515
+ var f = u ? o.bind(u) : o;
516
+ return this.reads.push(f), r(this), f;
517
517
  },
518
518
  /**
519
519
  * Adds a job to the
@@ -524,9 +524,9 @@ function Ot() {
524
524
  * @param {Object} ctx the context to be bound to `fn` (optional).
525
525
  * @public
526
526
  */
527
- mutate: function(o, c) {
528
- var f = c ? o.bind(c) : o;
529
- return this.writes.push(f), s(this), f;
527
+ mutate: function(o, u) {
528
+ var f = u ? o.bind(u) : o;
529
+ return this.writes.push(f), r(this), f;
530
530
  },
531
531
  /**
532
532
  * Clears a scheduled 'read' or 'write' task.
@@ -574,37 +574,37 @@ function Ot() {
574
574
  */
575
575
  extend: function(o) {
576
576
  if (typeof o != "object") throw new Error("expected object");
577
- var c = Object.create(this);
578
- return m(c, o), c.fastdom = this, c.initialize && c.initialize(), c;
577
+ var u = Object.create(this);
578
+ return m(u, o), u.fastdom = this, u.initialize && u.initialize(), u;
579
579
  },
580
580
  // override this with a function
581
581
  // to prevent Errors in console
582
582
  // when tasks throw
583
583
  catch: null
584
584
  };
585
- function s(o) {
586
- o.scheduled || (o.scheduled = !0, o.raf(u.bind(null, o)));
585
+ function r(o) {
586
+ o.scheduled || (o.scheduled = !0, o.raf(c.bind(null, o)));
587
587
  }
588
- function u(o) {
589
- var c = o.writes, f = o.reads, p;
588
+ function c(o) {
589
+ var u = o.writes, f = o.reads, p;
590
590
  try {
591
- n("flushing reads", f.length), o.runTasks(f), n("flushing writes", c.length), o.runTasks(c);
591
+ n("flushing reads", f.length), o.runTasks(f), n("flushing writes", u.length), o.runTasks(u);
592
592
  } catch (h) {
593
593
  p = h;
594
594
  }
595
- if (o.scheduled = !1, (f.length || c.length) && s(o), p)
595
+ if (o.scheduled = !1, (f.length || u.length) && r(o), p)
596
596
  if (n("task errored", p.message), o.catch) o.catch(p);
597
597
  else throw p;
598
598
  }
599
- function a(o, c) {
600
- var f = o.indexOf(c);
599
+ function a(o, u) {
600
+ var f = o.indexOf(u);
601
601
  return !!~f && !!o.splice(f, 1);
602
602
  }
603
- function m(o, c) {
604
- for (var f in c)
605
- c.hasOwnProperty(f) && (o[f] = c[f]);
603
+ function m(o, u) {
604
+ for (var f in u)
605
+ u.hasOwnProperty(f) && (o[f] = u[f]);
606
606
  }
607
- var l = e.fastdom = e.fastdom || new r();
607
+ var l = e.fastdom = e.fastdom || new s();
608
608
  t.exports = l;
609
609
  })(typeof window < "u" ? window : typeof F < "u" ? F : globalThis);
610
610
  })(A)), A.exports;
@@ -653,51 +653,51 @@ function O(t) {
653
653
  return typeof e == "string" ? At(e) : null;
654
654
  } else if (t.keyframeEffect) {
655
655
  const e = (i) => {
656
- const { name: r, keyframes: s } = i.keyframeEffect;
657
- return [{ ...i, name: r, keyframes: s }];
656
+ const { name: s, keyframes: r } = i.keyframeEffect;
657
+ return [{ ...i, name: s, keyframes: r }];
658
658
  };
659
659
  return { web: e, style: e, getNames: (i) => {
660
- const { effectId: r } = i, { name: s } = i.keyframeEffect, u = s || r;
661
- return u ? [u] : [];
660
+ const { effectId: s } = i, { name: r } = i.keyframeEffect, c = r || s;
661
+ return c ? [c] : [];
662
662
  } };
663
663
  } else if (t.customEffect)
664
664
  return (e) => [{ ...e, keyframes: [] }];
665
665
  return null;
666
666
  }
667
- function H(t, e, n) {
668
- return t.map((i, r) => {
669
- const s = {
670
- fill: i.fill,
671
- easing: gt(i.easing),
672
- iterations: i.iterations === 0 ? 1 / 0 : i.iterations || 1,
673
- composite: i.composite,
674
- direction: kt(i)
667
+ function H(t, e, n, i) {
668
+ return t.map((s, r) => {
669
+ const c = {
670
+ fill: s.fill,
671
+ easing: gt(s.easing),
672
+ iterations: s.iterations === 0 ? 1 / 0 : s.iterations || 1,
673
+ composite: s.composite,
674
+ direction: kt(s)
675
675
  };
676
- return S(e) ? (s.duration = i.duration, s.delay = i.delay || 0) : window.ViewTimeline && e?.trigger === "view-progress" ? s.duration = "auto" : (s.duration = 99.99, s.delay = 0.01), {
677
- effect: i,
678
- options: s,
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), {
677
+ effect: s,
678
+ options: c,
679
679
  id: n && `${n}-${r + 1}`,
680
- part: i.part
680
+ part: s.part
681
681
  };
682
682
  });
683
683
  }
684
684
  function S(t) {
685
685
  return !t || t.trigger !== "pointer-move" && t.trigger !== "view-progress";
686
686
  }
687
- function N(t, e, n, i, r) {
687
+ function N(t, e, n, i, s) {
688
688
  if (t) {
689
- if (S(i) && (e.duration = e.duration || 1, r?.reducedMotion))
689
+ if (S(i) && (e.duration = e.duration || 1, s?.reducedMotion))
690
690
  if (e.iterations === 1 || e.iterations == null)
691
691
  e = { ...e, duration: 1 };
692
692
  else
693
693
  return [];
694
- let s;
695
- return n instanceof HTMLElement && (s = { measure: L(n), mutate: j(n) }), t.web ? t.web(e, s, r) : t(e, s, r);
694
+ 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);
696
696
  }
697
697
  return [];
698
698
  }
699
- function W(t, e, n, i, r) {
700
- const s = t instanceof HTMLElement ? t : w(t, r);
699
+ function W(t, e, n, i, s) {
700
+ const r = t instanceof HTMLElement ? t : w(t, s);
701
701
  if (n?.trigger === "pointer-move" && !e.keyframeEffect) {
702
702
  let f = e;
703
703
  e.customEffect && (f = {
@@ -709,16 +709,16 @@ function W(t, e, n, i, r) {
709
709
  ), h = N(
710
710
  p,
711
711
  e,
712
- s,
712
+ r,
713
713
  n,
714
714
  i
715
715
  );
716
- return typeof h != "function" ? null : h(s);
716
+ return typeof h != "function" ? null : h(r);
717
717
  }
718
- const u = O(e), a = N(
719
- u,
718
+ const c = O(e), a = N(
719
+ c,
720
720
  e,
721
- s,
721
+ r,
722
722
  n,
723
723
  i
724
724
  );
@@ -730,8 +730,8 @@ function W(t, e, n, i, r) {
730
730
  o && window.ViewTimeline && (l = new ViewTimeline({
731
731
  subject: n.element || w(n.componentId)
732
732
  }));
733
- const c = m.map(({ effect: f, options: p, id: h, part: d }) => {
734
- const v = d ? Tt(s, d) : s, g = new KeyframeEffect(v || null, [], p);
733
+ const u = m.map(({ effect: f, options: p, id: h, part: d }) => {
734
+ const v = d ? Tt(r, d) : r, g = new KeyframeEffect(v || null, [], p);
735
735
  E.mutate(() => {
736
736
  "timing" in f && g.updateTiming(f.timing), g.setKeyframes(f.keyframes);
737
737
  });
@@ -767,7 +767,7 @@ function W(t, e, n, i, r) {
767
767
  }
768
768
  return h && (b.id = h), b;
769
769
  });
770
- return new I(c, {
770
+ return new I(u, {
771
771
  ...e,
772
772
  trigger: { ...n || {} },
773
773
  // make sure the group is ready after all animation targets are measured and mutated
@@ -778,34 +778,34 @@ function $t(t, e) {
778
778
  return t ? `#${t}${e ? `[data-motion-part~="${e}"]` : ""}` : "";
779
779
  }
780
780
  function St(t, e) {
781
- const { duration: n, delay: i, iterations: r = 1, fill: s, easing: u = "linear", direction: a } = t.options, m = t.effect.name, l = n === "auto";
782
- return `${m} ${l ? "auto" : `${n}ms`}${l ? " " : ` ${i || 1}ms `}${u}${s && s !== "none" ? ` ${s}` : ""} ${!r || r === 1 / 0 ? "infinite" : r}${a === "normal" ? "" : ` ${a}`} ${e ? "" : "paused"}`;
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"}`;
783
783
  }
784
784
  function qt(t, e, n) {
785
785
  return t?.style ? (S(n) && (e.duration = e.duration || 1), t.style(e)) : [];
786
786
  }
787
787
  function Gt(t, e, n) {
788
- const i = O(e), r = qt(i, e), s = H(r, n, e.effectId), u = n?.trigger === "view-progress";
789
- return s.map((a, m) => {
790
- const { start: l, end: o } = u ? R(a.effect) : {};
788
+ const i = O(e), s = qt(i, e), r = H(s, n, e.effectId, !0), c = n?.trigger === "view-progress";
789
+ return r.map((a, m) => {
790
+ const { start: l, end: o } = c ? R(a.effect) : {};
791
791
  return {
792
792
  target: $t(t, a.part),
793
- animation: St(a, u),
793
+ animation: St(a, c),
794
794
  composition: a.options.composite,
795
795
  custom: a.effect.custom,
796
796
  name: a.effect.name,
797
797
  keyframes: a.effect.keyframes,
798
798
  id: a.id && `${a.id}-${m + 1}`,
799
- animationTimeline: u ? `--${n?.id}` : "",
799
+ animationTimeline: c ? `--${n?.id}` : "",
800
800
  animationRange: l || o ? `${l} ${o}` : ""
801
801
  };
802
802
  });
803
803
  }
804
804
  function Pt(t, e, n) {
805
- const i = O(e), r = t instanceof HTMLElement ? t : w(t);
806
- if (i && i.prepare && r) {
807
- const s = { measure: L(r), mutate: j(r) };
808
- i.prepare(e, s);
805
+ const i = O(e), s = t instanceof HTMLElement ? t : w(t);
806
+ if (i && i.prepare && s) {
807
+ const r = { measure: L(s), mutate: j(s) };
808
+ i.prepare(e, r);
809
809
  }
810
810
  n && E.mutate(n);
811
811
  }
@@ -815,35 +815,35 @@ function Ct(t, e) {
815
815
  return null;
816
816
  if (!n.style)
817
817
  return e.effectId && t ? zt(t, e.effectId) : null;
818
- const i = n.getNames(e), s = (typeof t == "string" ? w(t) : t)?.getAnimations(), u = s?.map((m) => m.animationName) || [], a = [];
818
+ const i = n.getNames(e), r = (typeof t == "string" ? w(t) : t)?.getAnimations(), c = r?.map((m) => m.animationName) || [], a = [];
819
819
  return i.forEach((m) => {
820
- u.includes(m) && a.push(
821
- s?.find((l) => l.animationName === m)
820
+ c.includes(m) && a.push(
821
+ r?.find((l) => l.animationName === m)
822
822
  );
823
823
  }), a?.length ? new I(a) : null;
824
824
  }
825
825
  function zt(t, e) {
826
- const i = (typeof t == "string" ? w(t) : t)?.getAnimations().filter((r) => {
827
- const s = r.id || r.animationName;
828
- return s ? s.startsWith(e) : !0;
826
+ const i = (typeof t == "string" ? w(t) : t)?.getAnimations().filter((s) => {
827
+ const r = s.id || s.animationName;
828
+ return r ? r.startsWith(e) : !0;
829
829
  });
830
830
  return i?.length ? new I(i) : null;
831
831
  }
832
832
  function Dt(t, e, n, i = {}) {
833
- const { disabled: r, allowActiveEvent: s, ...u } = i, a = W(t, e, n, u);
833
+ const { disabled: s, allowActiveEvent: r, ...c } = i, a = W(t, e, n, c);
834
834
  if (!a)
835
835
  return null;
836
836
  let m = {};
837
837
  if (n.trigger === "view-progress" && !window.ViewTimeline) {
838
838
  const l = n.element || w(n.componentId), { ready: o } = a;
839
- return a.animations.map((c) => ({
839
+ return a.animations.map((u) => ({
840
840
  /* we use getters for start and end in order to access the animation's start and end
841
841
  only when initializing the scrub scene rather than immediately */
842
842
  get start() {
843
- return c.start;
843
+ return u.start;
844
844
  },
845
845
  get end() {
846
- return c.end;
846
+ return u.end;
847
847
  },
848
848
  viewSource: l,
849
849
  ready: o,
@@ -851,16 +851,16 @@ function Dt(t, e, n, i = {}) {
851
851
  return a.getProgress();
852
852
  },
853
853
  effect(f, p) {
854
- const { activeDuration: h } = c.effect.getComputedTiming(), { delay: d } = c.effect.getTiming();
855
- c.currentTime = ((d || 0) + (h || 0)) * p;
854
+ const { activeDuration: h } = u.effect.getComputedTiming(), { delay: d } = u.effect.getTiming();
855
+ u.currentTime = ((d || 0) + (h || 0)) * p;
856
856
  },
857
- disabled: r,
857
+ disabled: s,
858
858
  destroy() {
859
- c.cancel();
859
+ u.cancel();
860
860
  }
861
861
  }));
862
862
  } else if (n.trigger === "pointer-move") {
863
- const l = e, { centeredToTarget: o, transitionDuration: c, transitionEasing: f } = l, p = n.axis;
863
+ const l = e, { centeredToTarget: o, transitionDuration: u, transitionEasing: f } = l, p = n.axis;
864
864
  if (l.keyframeEffect) {
865
865
  const h = a;
866
866
  return h.animations?.length === 0 ? null : {
@@ -875,7 +875,7 @@ function Dt(t, e, n, i = {}) {
875
875
  const y = p === "x" ? g.x : g.y;
876
876
  this._currentProgress = y, h.progress(y);
877
877
  },
878
- disabled: r ?? !1,
878
+ disabled: s ?? !1,
879
879
  destroy() {
880
880
  h.cancel();
881
881
  }
@@ -883,47 +883,47 @@ function Dt(t, e, n, i = {}) {
883
883
  }
884
884
  m = {
885
885
  centeredToTarget: o,
886
- allowActiveEvent: s
887
- }, e.customEffect && c && (m.transitionDuration = c, m.transitionEasing = D(f)), m.target = a.target;
886
+ allowActiveEvent: r
887
+ }, e.customEffect && u && (m.transitionDuration = u, m.transitionEasing = D(f)), m.target = a.target;
888
888
  }
889
889
  return {
890
890
  ...m,
891
891
  getProgress() {
892
892
  return a.getProgress();
893
893
  },
894
- effect(l, o, c, f) {
894
+ effect(l, o, u, f) {
895
895
  a.progress(
896
- c ? {
896
+ u ? {
897
897
  // @ts-expect-error spread error on p
898
898
  ...o,
899
- v: c,
899
+ v: u,
900
900
  active: f
901
901
  } : o
902
902
  );
903
903
  },
904
- disabled: r,
904
+ disabled: s,
905
905
  destroy() {
906
906
  a.cancel();
907
907
  }
908
908
  };
909
909
  }
910
910
  function Ft(t, e, n, i = !1) {
911
- const r = Ct(t, e);
912
- return r ? (r.ready = new Promise((s) => {
913
- Pt(t, e, s);
914
- }), r) : W(t, e, n, { reducedMotion: i });
911
+ const s = Ct(t, e);
912
+ return s ? (s.ready = new Promise((r) => {
913
+ Pt(t, e, r);
914
+ }), s) : W(t, e, n, { reducedMotion: i });
915
915
  }
916
916
  function xt(t) {
917
917
  return t === null ? [null] : typeof t == "string" ? Array.from(document.querySelectorAll(t)) : Array.isArray(t) ? t : [t];
918
918
  }
919
919
  function Mt(t, e) {
920
920
  const n = [];
921
- for (const { target: i, options: r } of t) {
922
- const s = xt(i);
923
- for (const u of s) {
921
+ for (const { target: i, options: s } of t) {
922
+ const r = xt(i);
923
+ for (const c of r) {
924
924
  const a = Ft(
925
- u,
926
- r,
925
+ c,
926
+ s,
927
927
  void 0,
928
928
  e?.reducedMotion
929
929
  );