@mkbabb/keyframes.js 6.0.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/keyframes.js CHANGED
@@ -1,6 +1,6 @@
1
- import { C as e, S as t, _ as n, a as r, b as i, c as a, d as o, f as s, g as c, h as l, l as u, m as d, o as f, p, s as m, t as h, u as g, v as _, x as v } from "./sequence-BvpIpCGp.js";
1
+ import { C as e, E as t, T as n, a as r, b as i, c as a, d as o, f as s, g as c, h as l, l as u, m as d, o as f, p, s as m, t as h, u as g, v as _, w as v, x as y, y as b } from "./sequence-BUgKKePR.js";
2
2
  //#region src/animation/physics/numeric.ts
3
- var y = class {
3
+ var x = class {
4
4
  _out = new Float64Array();
5
5
  keyframes;
6
6
  segments;
@@ -9,15 +9,15 @@ var y = class {
9
9
  _duration;
10
10
  _respectReducedMotion;
11
11
  _easingFn;
12
- _playback = new s();
13
- constructor(e, n) {
12
+ _playback = new d();
13
+ constructor(e, t) {
14
14
  if (e.length < 2) throw Error("NumericAnimation requires at least 2 keyframes.");
15
- this.keyframes = e.map((e) => ({ ...e })), this._duration = n?.duration ?? 0, this._respectReducedMotion = n?.respectReducedMotion ?? !1;
16
- let r = n?.timingFunction;
17
- if (typeof r == "string") throw new t("timingFunction", r, "NumericAnimation accepts a callable TimingFunction or a typed Easing; resolve a string name first via `await resolveEasing(name)`.");
18
- if (this._easingFn = r == null ? (e) => e : v(r).fn, n?.positions) {
19
- if (n.positions.length !== e.length) throw Error("positions length must match keyframes length.");
20
- this.positions = n.positions;
15
+ this.keyframes = e.map((e) => ({ ...e })), this._duration = t?.duration ?? 0, this._respectReducedMotion = t?.respectReducedMotion ?? !1;
16
+ let r = t?.timingFunction;
17
+ if (typeof r == "string") throw new n("timingFunction", r, "NumericAnimation accepts a callable TimingFunction or a typed Easing; resolve a string name first via `await resolveEasing(name)`.");
18
+ if (this._easingFn = r == null ? (e) => e : v(r).fn, t?.positions) {
19
+ if (t.positions.length !== e.length) throw Error("positions length must match keyframes length.");
20
+ this.positions = t.positions;
21
21
  } else this.positions = e.map((t, n) => n / (e.length - 1) * 100);
22
22
  this.result = { ...e[0] }, this.segments = this.buildSegments();
23
23
  }
@@ -42,12 +42,12 @@ var y = class {
42
42
  };
43
43
  }
44
44
  at(e) {
45
- let t = l(e, 0, 1) * 100, r = _(this.segments, t, (e) => e.startPos, (e) => e.stopPos);
46
- r === -1 && (r = this.segments.length - 1);
47
- let i = this.segments[r], a = n(l(t, i.startPos, i.stopPos), i.startPos, i.stopPos, 0, 1), o = i.timingFunction(a), s = i.keys.length;
48
- this._out.length < s && (this._out = new Float64Array(s)), c(i.from, i.to, o, this._out);
49
- let u = this.result;
50
- for (let e = 0; e < s; e++) u[i.keys[e]] = this._out[e];
45
+ let t = _(e, 0, 1) * 100, n = y(this.segments, t, (e) => e.startPos, (e) => e.stopPos);
46
+ n === -1 && (n = this.segments.length - 1);
47
+ let r = this.segments[n], a = i(_(t, r.startPos, r.stopPos), r.startPos, r.stopPos, 0, 1), o = r.timingFunction(a), s = r.keys.length;
48
+ this._out.length < s && (this._out = new Float64Array(s)), b(r.from, r.to, o, this._out);
49
+ let c = this.result;
50
+ for (let e = 0; e < s; e++) c[r.keys[e]] = this._out[e];
51
51
  return this.result;
52
52
  }
53
53
  updateKeyframe(e, t) {
@@ -67,12 +67,12 @@ var y = class {
67
67
  };
68
68
  //#endregion
69
69
  //#region src/animation/physics/spring/solver/reseat.ts
70
- function b(e) {
70
+ function S(e) {
71
71
  let t = e.curr.time - e.prev.time;
72
72
  return t <= 0 ? 0 : (e.curr.value - e.prev.value) / (t / 1e3);
73
73
  }
74
- function x(e, t, n) {
75
- let r = b(e), i = new g({
74
+ function C(e, t, n) {
75
+ let r = S(e), i = new s({
76
76
  ...n,
77
77
  initial: e.curr.value,
78
78
  initialVelocity: r
@@ -81,7 +81,7 @@ function x(e, t, n) {
81
81
  }
82
82
  //#endregion
83
83
  //#region src/animation/physics/morph.ts
84
- var S = (e) => {
84
+ var w = (e) => {
85
85
  if (e instanceof HTMLElement) {
86
86
  let t = e.getBoundingClientRect();
87
87
  return {
@@ -92,7 +92,7 @@ var S = (e) => {
92
92
  };
93
93
  }
94
94
  return e;
95
- }, C = class {
95
+ }, T = class {
96
96
  animation;
97
97
  transformOrigin;
98
98
  timingFunction;
@@ -101,8 +101,8 @@ var S = (e) => {
101
101
  this.transformOrigin = n?.transformOrigin ?? "top left", this.timingFunction = n?.timingFunction, this.duration = n?.duration ?? 0, this.measure(e, t);
102
102
  }
103
103
  measure(e, t) {
104
- let n = S(e), r = S(t), i = r.x - n.x, a = r.y - n.y, o = n.width === 0 ? 1 : r.width / n.width, s = n.height === 0 ? 1 : r.height / n.height;
105
- return this.animation = new y([{
104
+ let n = w(e), r = w(t), i = r.x - n.x, a = r.y - n.y, o = n.width === 0 ? 1 : r.width / n.width, s = n.height === 0 ? 1 : r.height / n.height;
105
+ return this.animation = new x([{
106
106
  translateX: 0,
107
107
  translateY: 0,
108
108
  scaleX: 1,
@@ -136,19 +136,19 @@ var S = (e) => {
136
136
  stop() {
137
137
  this.animation.stop();
138
138
  }
139
- }, w = class {
139
+ }, E = class {
140
140
  smoother;
141
141
  _easingFn;
142
142
  currentProgress = 0;
143
143
  boundaryEpsilon;
144
144
  constructor(e) {
145
145
  this.boundaryEpsilon = e?.boundaryEpsilon ?? .005;
146
- let n = e?.easing;
147
- if (typeof n == "string") throw new t("easing", n, "Timeline accepts a callable TimingFunction or a typed Easing; resolve a string name first via `await resolveEasing(name)`.");
148
- this._easingFn = n == null ? (e) => e : v(n).fn, e?.smoothing === !1 ? this.smoother = null : this.smoother = new o(e?.smoothing);
146
+ let t = e?.easing;
147
+ if (typeof t == "string") throw new n("easing", t, "Timeline accepts a callable TimingFunction or a typed Easing; resolve a string name first via `await resolveEasing(name)`.");
148
+ this._easingFn = t == null ? (e) => e : v(t).fn, e?.smoothing === !1 ? this.smoother = null : this.smoother = new p(e?.smoothing);
149
149
  }
150
150
  applyPipeline() {
151
- let e = l(this.sample(), 0, 1);
151
+ let e = _(this.sample(), 0, 1);
152
152
  e = this._easingFn(e);
153
153
  let t = this.boundaryEpsilon;
154
154
  return e <= t ? e = 0 : e >= 1 - t && (e = 1), e;
@@ -176,7 +176,7 @@ var S = (e) => {
176
176
  let t = e ?? 0;
177
177
  this.smoother && this.smoother.reset(t), this.currentProgress = t;
178
178
  }
179
- }, T = class extends w {
179
+ }, ee = class extends E {
180
180
  threshold;
181
181
  getScrollY;
182
182
  getViewportHeight;
@@ -187,7 +187,7 @@ var S = (e) => {
187
187
  let e = this.getViewportHeight() * this.threshold;
188
188
  return e <= 0 ? 0 : this.getScrollY() / e;
189
189
  }
190
- }, E = class extends w {
190
+ }, te = class extends E {
191
191
  value = 0;
192
192
  constructor(e) {
193
193
  super({
@@ -201,17 +201,17 @@ var S = (e) => {
201
201
  sample() {
202
202
  return this.value;
203
203
  }
204
- }, ee = 2 * Math.PI;
205
- function D(e, t) {
204
+ }, D = 2 * Math.PI;
205
+ function O(e, t) {
206
206
  let n = e - Math.floor(e);
207
207
  switch (t) {
208
- case "sine": return Math.sin(ee * n);
208
+ case "sine": return Math.sin(D * n);
209
209
  case "triangle": return n < .5 ? 4 * n - 1 : 3 - 4 * n;
210
210
  case "square": return n < .5 ? 1 : -1;
211
211
  case "sawtooth": return 2 * n - 1;
212
212
  }
213
213
  }
214
- var O = class {
214
+ var ne = class {
215
215
  frequency;
216
216
  waveform;
217
217
  phase = 0;
@@ -223,43 +223,43 @@ var O = class {
223
223
  return this.phase = t - Math.floor(t), this.phase;
224
224
  }
225
225
  get value() {
226
- return D(this.phase, this.waveform);
226
+ return O(this.phase, this.waveform);
227
227
  }
228
228
  sample(e) {
229
- return D(e * this.frequency, this.waveform);
229
+ return O(e * this.frequency, this.waveform);
230
230
  }
231
231
  reset(e = 0) {
232
232
  this.phase = e - Math.floor(e);
233
233
  }
234
234
  }, k = (e, t) => {
235
- if (typeof e == "number") return l(e, 0, Math.max(0, t - 1));
235
+ if (typeof e == "number") return _(e, 0, Math.max(0, t - 1));
236
236
  switch (e) {
237
237
  case "first": return 0;
238
238
  case "last": return t - 1;
239
239
  case "center": return (t - 1) / 2;
240
240
  case "edges": return -1;
241
241
  }
242
- }, te = (e, t, n) => n === "edges" ? Math.min(e, t - 1 - e) : Math.abs(e - k(n, t)), ne = (e, t) => {
242
+ }, re = (e, t, n) => n === "edges" ? Math.min(e, t - 1 - e) : Math.abs(e - k(n, t)), ie = (e, t) => {
243
243
  if (e <= 1) return 0;
244
244
  if (t === "edges") return Math.floor((e - 1) / 2);
245
245
  let n = k(t, e);
246
246
  return Math.max(n, e - 1 - n);
247
247
  };
248
- function A(e, n = {}) {
249
- let { each: r = 100, from: i = "first", ease: a } = n;
250
- if (typeof a == "string") throw new t("ease", a, "stagger accepts a callable TimingFunction or a typed Easing; resolve a string name first via `await resolveEasing(name)`.");
248
+ function A(e, t = {}) {
249
+ let { each: r = 100, from: i = "first", ease: a } = t;
250
+ if (typeof a == "string") throw new n("ease", a, "stagger accepts a callable TimingFunction or a typed Easing; resolve a string name first via `await resolveEasing(name)`.");
251
251
  let o = a ? v(a).fn : void 0, s = typeof e == "number" ? e : e.length, c = (e, t) => {
252
252
  if (t <= 1) return 0;
253
- let n = ne(t, i);
253
+ let n = ie(t, i);
254
254
  if (n === 0) return 0;
255
- let a = te(e, t, i);
255
+ let a = re(e, t, i);
256
256
  return o ? o(a / n) * r * n : a * r;
257
257
  }, l = ((e, t = s) => c(e, t));
258
258
  return l.delays = (e = s) => Array.from({ length: e }, (t, n) => c(n, e)), l;
259
259
  }
260
260
  //#endregion
261
261
  //#region src/animation/orchestration/flip.ts
262
- var j = 300, M = (e) => {
262
+ var ae = 300, j = "translate(0px, 0px) scale(1, 1)", M = (e) => {
263
263
  let t = e.getBoundingClientRect();
264
264
  return {
265
265
  x: t.x,
@@ -267,75 +267,108 @@ var j = 300, M = (e) => {
267
267
  width: t.width,
268
268
  height: t.height
269
269
  };
270
- }, N = (e, t) => {
271
- let n = e.at(1), r = n.translateX, i = n.translateY, a = n.scaleX, o = n.scaleY, s = e.at(t);
272
- return `translate(${s.translateX - r}px, ${s.translateY - i}px) scale(${a === 0 ? 1 : s.scaleX / a}, ${o === 0 ? 1 : s.scaleY / o})`;
273
- }, P = (e, t, n, r) => (e.style.transformOrigin = r, e.style.transform = N(t, 0), n <= 0 ? (e.style.transform = N(t, 1), Promise.resolve()) : new s().play(n, (n) => {
274
- e.style.transform = N(t, n);
275
- }));
276
- function F(e, t, n = {}) {
277
- let { duration: r = j, timingFunction: i, transformOrigin: a = "top left" } = n, o = M(e);
278
- return t(), P(e, new C(o, M(e), {
279
- ...i === void 0 ? {} : { timingFunction: i },
280
- transformOrigin: a
281
- }), r, a);
282
- }
283
- function I(e, t, n = {}) {
284
- let { duration: r = j, timingFunction: i, transformOrigin: a = "top left" } = n, o = new C(M(e), M(t), {
285
- ...i === void 0 ? {} : { timingFunction: i },
286
- duration: r,
287
- transformOrigin: a
270
+ }, N = /* @__PURE__ */ new WeakMap(), P = (e) => {
271
+ let t = N.get(e);
272
+ return t === void 0 ? !1 : (t(), e.style.transform = j, !0);
273
+ }, F = (e, t, n, r) => {
274
+ let { translateX: i, translateY: a, scaleX: o, scaleY: s } = e.at(r);
275
+ return `translate(${t.x + i - n.x}px, ${t.y + a - n.y}px) scale(${n.width === 0 ? 1 : t.width * o / n.width}, ${n.height === 0 ? 1 : t.height * s / n.height})`;
276
+ }, I = (e, t, n, r, i) => {
277
+ let { duration: a = ae, timingFunction: o, transformOrigin: s = "top left" } = i, c = new T(t, r, {
278
+ ...o === void 0 ? {} : { timingFunction: o },
279
+ transformOrigin: s
280
+ });
281
+ if (e.style.transformOrigin = s, e.style.transform = F(c, t, n, 0), a <= 0) return e.style.transform = F(c, t, n, 1), Object.assign(Promise.resolve(), { cancel: () => {} });
282
+ let l = new d(), u = () => {
283
+ l.stop(), N.get(e) === u && N.delete(e);
284
+ };
285
+ N.set(e, u);
286
+ let f = l.play(a, (r) => {
287
+ e.style.transform = F(c, t, n, r);
288
+ }).then(() => {
289
+ N.get(e) === u && N.delete(e);
288
290
  });
289
- return o.apply(e, 0), r <= 0 ? (o.apply(e, 1), Promise.resolve()) : o.play(e, r);
291
+ return Object.assign(f, { cancel: u });
292
+ };
293
+ function oe(e, t, n = {}) {
294
+ let r = M(e);
295
+ P(e), t();
296
+ let i = M(e);
297
+ return I(e, r, i, i, n);
298
+ }
299
+ function L(e, t, n = {}) {
300
+ let r = M(e);
301
+ return I(e, r, P(e) ? M(e) : r, M(t), n);
290
302
  }
291
303
  //#endregion
292
304
  //#region src/animation/orchestration/split-text/refuse.ts
293
- var re = {
305
+ var se = {
294
306
  unmeasurable: "the container yielded no laid-out client rects (detached, display:none, or zero-area) — a line-split cannot group fragments without a measured line box. Use by:\"word\" (layout-independent), or split after the element is laid out.",
295
307
  unstable: "the line measurement could not converge — the container's size depends on its own content flow (a container-query / intrinsic-size feedback loop), so the line grouping oscillates on every reflow. Refused rather than latch a stale line map.",
296
308
  empty: "there is no text content to split into lines."
297
- }, L = class e extends Error {
309
+ }, R = class e extends Error {
298
310
  name = "SplitTextRefusalError";
299
311
  reason;
300
312
  constructor(t, n) {
301
- super(`splitText refused a by:"line" split (${t}): ` + (n ?? re[t])), this.reason = t, Object.setPrototypeOf(this, e.prototype);
313
+ super(`splitText refused a by:"line" split (${t}): ` + (n ?? se[t])), this.reason = t, Object.setPrototypeOf(this, e.prototype);
302
314
  }
303
- }, R = (e) => e.length === 0 || /^\s+$/u.test(e), z = typeof Intl < "u" && typeof Intl.Segmenter == "function";
304
- function B(e, t) {
305
- if (z) {
306
- let n = new Intl.Segmenter(t, { granularity: "word" }), r = [];
307
- for (let { segment: t } of n.segment(e)) r.push({
315
+ }, z = (e) => e.length === 0 || /^\s+$/u.test(e), B = typeof Intl < "u" && typeof Intl.Segmenter == "function";
316
+ function V(e, t) {
317
+ if (B) {
318
+ let n = new Intl.Segmenter(t, { granularity: "word" }), r = [], i = "", a = !1;
319
+ for (let { segment: t, isWordLike: o } of n.segment(e)) z(t) ? (i && r.push({
320
+ text: i,
321
+ kind: "unit"
322
+ }), i = "", r.push({
308
323
  text: t,
309
- kind: R(t) ? "space" : "unit"
310
- });
311
- return r;
324
+ kind: "space"
325
+ }), a = !1) : o ? (r.push({
326
+ text: i + t,
327
+ kind: "unit"
328
+ }), i = "", a = !0) : a ? r[r.length - 1].text += t : i += t;
329
+ return i && r.push({
330
+ text: i,
331
+ kind: "unit"
332
+ }), r;
312
333
  }
313
334
  return e.split(/(\s+)/u).filter((e) => e.length > 0).map((e) => ({
314
335
  text: e,
315
- kind: R(e) ? "space" : "unit"
336
+ kind: z(e) ? "space" : "unit"
316
337
  }));
317
338
  }
318
- function V(e, t) {
319
- if (z) {
339
+ function H(e, t) {
340
+ if (B) {
320
341
  let n = new Intl.Segmenter(t, { granularity: "grapheme" }), r = [];
321
342
  for (let { segment: t } of n.segment(e)) r.push({
322
343
  text: t,
323
- kind: R(t) ? "space" : "unit"
344
+ kind: z(t) ? "space" : "unit"
324
345
  });
325
346
  return r;
326
347
  }
327
348
  return Array.from(e).map((e) => ({
328
349
  text: e,
329
- kind: R(e) ? "space" : "unit"
350
+ kind: z(e) ? "space" : "unit"
330
351
  }));
331
352
  }
332
353
  //#endregion
333
354
  //#region src/animation/orchestration/split-text/split-text.ts
334
- var H = (e) => Math.round(e), U = (e) => e.some((e) => {
355
+ var U = (e) => Math.round(e), W = (e) => e.some((e) => {
335
356
  let t = e.getBoundingClientRect();
336
357
  return t.width > 0 || t.height > 0;
337
- });
338
- function W(e, t, n, r) {
358
+ }), G = new Set(/* @__PURE__ */ "article.aside.blockquote.button.details.dialog.fieldset.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.img.input.li.main.menu.meter.nav.ol.optgroup.option.output.progress.search.section.select.summary.table.td.textarea.th.tr.ul".split("."));
359
+ function ce(e) {
360
+ if (e.hasAttribute("role")) return !0;
361
+ let t = e.tagName.toLowerCase();
362
+ return t === "a" || t === "area" ? e.hasAttribute("href") : G.has(t);
363
+ }
364
+ function le(e) {
365
+ if (!e.isConnected || !W([e])) return !1;
366
+ let t = e.ownerDocument.createElement("span");
367
+ t.textContent = "x", t.style.cssText = "position:absolute;visibility:hidden", e.appendChild(t);
368
+ let n = W([t]);
369
+ return t.remove(), n;
370
+ }
371
+ function ue(e, t, n, r) {
339
372
  let i = e.createDocumentFragment(), a = [];
340
373
  for (let o of t) {
341
374
  if (o.kind === "space") {
@@ -350,9 +383,10 @@ function W(e, t, n, r) {
350
383
  fragments: a
351
384
  };
352
385
  }
353
- function G(e, t, n, r, i) {
354
- if (t.trim().length === 0) throw new L("empty");
355
- let a = e.ownerDocument, o = B(t, n), s = [], c = [], l = /* @__PURE__ */ new Map();
386
+ function K(e, t, n, r, i) {
387
+ if (t.trim().length === 0) throw new R("empty");
388
+ if (!le(e)) throw new R("unmeasurable");
389
+ let a = e.ownerDocument, o = V(t, n), s = [], c = [], l = /* @__PURE__ */ new Map();
356
390
  for (let e of o) {
357
391
  if (e.kind === "space") {
358
392
  s.push(a.createTextNode(e.text));
@@ -361,7 +395,7 @@ function G(e, t, n, r, i) {
361
395
  let t = a.createElement("span");
362
396
  t.textContent = e.text, c.push(t), l.set(t, e), s.push(t);
363
397
  }
364
- if (e.replaceChildren(...s), !e.isConnected || !U(c)) throw new L("unmeasurable");
398
+ e.replaceChildren(...s);
365
399
  let u = [], d = [], f = null;
366
400
  for (let e of s) {
367
401
  let t = e instanceof HTMLElement ? l.get(e) : {
@@ -370,7 +404,7 @@ function G(e, t, n, r, i) {
370
404
  };
371
405
  if (t) {
372
406
  if (t.kind === "unit" && e instanceof HTMLElement) {
373
- let t = H(e.getBoundingClientRect().top);
407
+ let t = U(e.getBoundingClientRect().top);
374
408
  f === null ? f = t : t !== f && (d.length > 0 && u.push(d), d = [], f = t);
375
409
  }
376
410
  d.push(t);
@@ -384,63 +418,61 @@ function G(e, t, n, r, i) {
384
418
  }
385
419
  return e.replaceChildren(p), m;
386
420
  }
387
- function K(e, t, n) {
388
- e.setAttribute("aria-label", t);
389
- let r = e.hasAttribute("role");
390
- return r || e.setAttribute("role", n), r;
421
+ function q(e, t, n) {
422
+ return e.setAttribute("aria-label", t), n === null || ce(e) ? !1 : (e.setAttribute("role", n), !0);
391
423
  }
392
- function q(e, t = {}) {
393
- let { by: n = "word", a11y: r = !0, role: i = "img", locale: a, stagger: o, fragmentClass: s = "kf-split", onRefuse: c } = t, l = e.ownerDocument, u = e.textContent ?? "", d = e.innerHTML, f;
394
- if (n === "line") f = G(e, u, a, s, r);
424
+ function de(e, t = {}) {
425
+ let { by: n = "word", a11y: r = !0, role: i = "img", locale: a, stagger: o, fragmentClass: s = "kf-split", onRefuse: c } = t, l = e.ownerDocument, u = e.textContent ?? "", d = e.innerHTML, f = e.getAttribute("aria-label"), p;
426
+ if (n === "line") p = K(e, u, a, s, r);
395
427
  else {
396
- let t = W(l, n === "grapheme" ? V(u, a) : B(u, a), s, r);
397
- e.replaceChildren(t.frag), f = t.fragments;
428
+ let t = ue(l, n === "grapheme" ? H(u, a) : V(u, a), s, r);
429
+ e.replaceChildren(t.frag), p = t.fragments;
398
430
  }
399
- let p = r ? K(e, u, i) : e.hasAttribute("role"), m = A(f.length, o), h = m.delays(f.length), g = null, _ = 0, v = 0, y = () => {
400
- n === "line" && (f = G(e, u, a, s, r), r && K(e, u, i), m = A(f.length, o), h = m.delays(f.length));
401
- }, b = () => {
402
- g?.disconnect(), g = null;
431
+ let m = r ? q(e, u, i) : !1, h = A(p.length, o), g = h.delays(p.length), _ = null, v = 0, y = 0, b = () => {
432
+ n === "line" && (p = K(e, u, a, s, r), r && q(e, u, i), h = A(p.length, o), g = h.delays(p.length));
433
+ }, x = () => {
434
+ _?.disconnect(), _ = null;
403
435
  };
404
- return n === "line" && typeof ResizeObserver < "u" && (g = new ResizeObserver(() => {
436
+ return n === "line" && typeof ResizeObserver < "u" && (_ = new ResizeObserver(() => {
405
437
  let e = typeof performance < "u" ? performance.now() : Date.now();
406
- if (e - v > 500 && (v = e, _ = 0), ++_ > 12) {
407
- let e = new L("unstable");
408
- b(), c?.(e);
438
+ if (e - y > 500 && (y = e, v = 0), ++v > 12) {
439
+ let e = new R("unstable");
440
+ x(), c?.(e);
409
441
  return;
410
442
  }
411
443
  try {
412
- y();
444
+ b();
413
445
  } catch (e) {
414
- if (e instanceof L) {
415
- b(), c?.(e);
446
+ if (e instanceof R) {
447
+ x(), c?.(e);
416
448
  return;
417
449
  }
418
450
  throw e;
419
451
  }
420
- }), g.observe(e)), {
452
+ }), _.observe(e)), {
421
453
  container: e,
422
454
  by: n,
423
455
  text: u,
424
456
  get fragments() {
425
- return f;
457
+ return p;
426
458
  },
427
459
  get stagger() {
428
- return m;
460
+ return h;
429
461
  },
430
462
  get delays() {
431
- return h;
463
+ return g;
432
464
  },
433
465
  revert: () => {
434
- b(), e.innerHTML = d, e.removeAttribute("aria-label"), r && !p && e.removeAttribute("role");
466
+ x(), e.innerHTML = d, r && (f === null ? e.removeAttribute("aria-label") : e.setAttribute("aria-label", f), m && e.removeAttribute("role"));
435
467
  },
436
- remeasure: y,
437
- dispose: b
468
+ remeasure: b,
469
+ dispose: x
438
470
  };
439
471
  }
440
472
  //#endregion
441
473
  //#region src/animation/orchestration/view-transition/view-transition.ts
442
- var J = 300, Y = () => typeof document < "u" && typeof document.startViewTransition == "function", X = (e) => e.then(() => void 0, () => void 0);
443
- function Z(e) {
474
+ var fe = 300, pe = () => typeof document < "u" && typeof document.startViewTransition == "function", J = (e) => e.then(() => void 0, () => void 0);
475
+ function Y(e) {
444
476
  let t = Promise.resolve(e()).then(() => void 0, () => void 0);
445
477
  return {
446
478
  ready: t,
@@ -450,22 +482,22 @@ function Z(e) {
450
482
  backend: "immediate"
451
483
  };
452
484
  }
453
- function ie(e, t, n, r) {
454
- if (t.length === 0) return Z(e);
485
+ function me(e, t, n, r) {
486
+ if (t.length === 0) return Y(e);
455
487
  let i = {
456
488
  duration: n,
457
489
  ...r === void 0 ? {} : { timingFunction: r }
458
490
  }, a = Promise.resolve(e()).then(() => void 0, () => void 0);
459
491
  return {
460
492
  ready: a,
461
- finished: a.then(() => Promise.all(t.map(([e, t]) => I(e, t, i)))).then(() => void 0, () => void 0),
493
+ finished: a.then(() => Promise.all(t.map(([e, t]) => L(e, t, i)))).then(() => void 0, () => void 0),
462
494
  updateCallbackDone: a,
463
495
  skip: () => {},
464
496
  backend: "flip"
465
497
  };
466
498
  }
467
- function ae(e, t = {}) {
468
- let { types: n, duration: r = J, timingFunction: i, shared: a = [], fallback: o = "flip", respectReducedMotion: s = !0 } = t, c = () => {
499
+ function he(e, t = {}) {
500
+ let { types: n, duration: r = fe, timingFunction: i, shared: a = [], fallback: o = "flip", respectReducedMotion: s = !0 } = t, l = () => {
469
501
  if (typeof o == "function") {
470
502
  let t = o(e).then(() => void 0, () => void 0);
471
503
  return {
@@ -476,35 +508,35 @@ function ae(e, t = {}) {
476
508
  backend: "flip"
477
509
  };
478
510
  }
479
- return o === "none" ? Z(e) : ie(e, a, r, i);
511
+ return o === "none" ? Y(e) : me(e, a, r, i);
480
512
  };
481
- return d(s, () => Z(e), () => {
482
- if (!Y()) return c();
483
- let t = document.startViewTransition, r;
513
+ return c(s, () => Y(e), () => {
514
+ if (!pe()) return l();
515
+ let t = document, r = t.startViewTransition.bind(t), i;
484
516
  try {
485
- r = n && n.length > 0 ? t({
517
+ i = n && n.length > 0 ? r({
486
518
  update: e,
487
519
  types: n
488
- }) : t(e);
520
+ }) : r(e);
489
521
  } catch {
490
522
  try {
491
- r = t(e);
523
+ i = r(e);
492
524
  } catch {
493
- return c();
525
+ return l();
494
526
  }
495
527
  }
496
528
  return {
497
- ready: X(r.ready),
498
- finished: X(r.finished),
499
- updateCallbackDone: X(r.updateCallbackDone),
500
- skip: () => r.skipTransition?.(),
529
+ ready: J(i.ready),
530
+ finished: J(i.finished),
531
+ updateCallbackDone: J(i.updateCallbackDone),
532
+ skip: () => i.skipTransition?.(),
501
533
  backend: "view-transition"
502
534
  };
503
535
  });
504
536
  }
505
537
  //#endregion
506
538
  //#region src/animation/orchestration/drag/draggable.ts
507
- var oe = 100, se = .4, ce = 5, Q = class {
539
+ var ge = 100, _e = .4, ve = 5, X = class {
508
540
  spring;
509
541
  axis;
510
542
  transform;
@@ -521,7 +553,7 @@ var oe = 100, se = .4, ce = 5, Q = class {
521
553
  onPointerMove = (e) => this.handleMove(e);
522
554
  onPointerUp = (e) => this.handleUp(e);
523
555
  constructor(e) {
524
- this.axis = e?.axis ?? "x", this.transform = e?.transform ?? ((e) => e), this.velocityWindow = e?.velocityWindow ?? oe, this.bounds = e?.bounds, this.rubberBand = e?.rubberBand ?? se, this.snap = e?.snap !== void 0 && e.snap.length > 0 ? e.snap : void 0, this.spring = e?.spring ?? new g(e?.springOptions);
556
+ this.axis = e?.axis ?? "x", this.transform = e?.transform ?? ((e) => e), this.velocityWindow = e?.velocityWindow ?? ge, this.bounds = e?.bounds, this.rubberBand = e?.rubberBand ?? _e, this.snap = e?.snap !== void 0 && e.snap.length > 0 ? e.snap : void 0, this.spring = e?.spring ?? new s(e?.springOptions);
525
557
  }
526
558
  get dragging() {
527
559
  return this.capturedPointerId !== void 0;
@@ -584,14 +616,14 @@ var oe = 100, se = .4, ce = 5, Q = class {
584
616
  let e = f({
585
617
  initial: n,
586
618
  velocity: r,
587
- friction: ce
619
+ friction: ve
588
620
  }), t = this.nearestSnap(e);
589
- this.bounds && (t = l(t, this.bounds.min, this.bounds.max)), this.spring.reset(n, r), this.spring.target = t;
621
+ this.bounds && (t = _(t, this.bounds.min, this.bounds.max)), this.spring.reset(n, r), this.spring.target = t;
590
622
  return;
591
623
  }
592
624
  if (this.spring.reset(n, r), this.bounds) {
593
625
  let e = this.spring.value;
594
- (e < this.bounds.min || e > this.bounds.max) && (this.spring.target = l(e, this.bounds.min, this.bounds.max));
626
+ (e < this.bounds.min || e > this.bounds.max) && (this.spring.target = _(e, this.bounds.min, this.bounds.max));
595
627
  }
596
628
  }
597
629
  nearestSnap(e) {
@@ -621,17 +653,17 @@ var oe = 100, se = .4, ce = 5, Q = class {
621
653
  return r <= 0 ? 0 : (n.value - t.value) / r * 1e3;
622
654
  }
623
655
  };
624
- function le(e, t) {
625
- let n = new Q(t);
656
+ function Z(e, t) {
657
+ let n = new X(t);
626
658
  return n.attach(e), n;
627
659
  }
628
660
  //#endregion
629
- //#region src/animation/orchestration/drag/drag-2d.ts
630
- function ue(e, t) {
631
- let n = new Q({
661
+ //#region src/animation/orchestration/drag/2d.ts
662
+ function ye(e, t) {
663
+ let n = new X({
632
664
  ...t?.x,
633
665
  axis: "x"
634
- }), r = new Q({
666
+ }), r = new X({
635
667
  ...t?.y,
636
668
  axis: "y"
637
669
  });
@@ -668,8 +700,10 @@ function ue(e, t) {
668
700
  }
669
701
  //#endregion
670
702
  //#region src/animation/load-engine.ts
671
- var de, $ = () => de ??= import("./engine/index.js"), fe = () => {
703
+ var Q, $ = () => Q ??= import("./engine/index.js").catch((e) => {
704
+ throw Q = void 0, e;
705
+ }), be = () => {
672
706
  $();
673
707
  };
674
708
  //#endregion
675
- export { t as AnimationOptionError, Q as Draggable, C as ElementMorph, T as KeyframesScrollTimeline, E as ManualTimeline, y as NumericAnimation, O as Oscillator, s as RAFPlayback, h as Sequence, o as SmoothProgress, L as SplitTextRefusalError, g as SpringProgress, w as Timeline, e as UnknownEasingError, m as createNativeTimeline, r as decay, f as decayRest, le as drag, ue as drag2D, F as flip, I as flipShared, $ as loadAnimationEngine, b as probeVelocity, p as reducedMotionScale, x as reseatToSpring, i as resolveEasing, q as splitText, u as springLinearStops, a as springTimingFunction, A as stagger, v as toEasing, ae as viewTransition, fe as warmEngine, D as waveformValue };
709
+ export { n as AnimationOptionError, X as Draggable, T as ElementMorph, ee as KeyframesScrollTimeline, te as ManualTimeline, x as NumericAnimation, ne as Oscillator, d as RAFPlayback, h as Sequence, p as SmoothProgress, R as SplitTextRefusalError, s as SpringProgress, E as Timeline, t as UnknownEasingError, m as createNativeTimeline, r as decay, f as decayRest, Z as drag, ye as drag2D, oe as flip, L as flipShared, g as linearFromSamples, $ as loadAnimationEngine, S as probeVelocity, l as reducedMotionScale, C as reseatToSpring, e as resolveEasing, de as splitText, o as springLinearStops, a as springTimingFunction, u as springTimingLUT, A as stagger, v as toEasing, he as viewTransition, be as warmEngine, O as waveformValue };