@mkbabb/keyframes.js 6.4.0 → 6.6.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.
@@ -1,5 +1,5 @@
1
- import { C as e, E as t, O as n, S as r, _ as i, c as a, d as o, h as s, i as c, l, m as u, n as d, o as f, p, r as m, s as h, t as ee, v as g, y as _ } from "../sequence-CPGHHEVM.js";
2
- import { C as v, E as y, S as b, T as x, _ as te, a as ne, b as re, c as ie, d as ae, f as oe, g as se, h as ce, i as le, l as ue, m as de, n as fe, o as pe, p as me, r as he, s as ge, t as _e, u as ve, v as ye, w as be, x as xe, y as S } from "../registry-8bG0FhGi.js";
1
+ import { C as e, M as t, O as n, P as r, T as i, b as a, c as o, d as s, g as c, i as l, k as u, l as d, n as f, o as p, r as m, s as h, t as ee, w as g, x as _ } from "../sequence-BzJ-b_HG.js";
2
+ import { C as v, E as y, S as b, T as x, _ as te, a as ne, b as re, c as ie, d as ae, f as oe, g as se, h as ce, i as le, l as ue, m as de, n as fe, o as pe, p as me, r as he, s as ge, t as _e, u as ve, v as ye, w as be, x as xe, y as S } from "../registry-BZOrCZZh.js";
3
3
  import { clamp as Se, lerp as C, lerpArray as Ce, scale as we } from "@mkbabb/value.js/math";
4
4
  import { easeInOutCubic as Te } from "@mkbabb/value.js/easing";
5
5
  import { convertColor as Ee, mixColors as De, oklab as Oe } from "@mkbabb/value.js/color";
@@ -701,24 +701,24 @@ var Lt = (e) => {
701
701
  to: i,
702
702
  out: new Float64Array(t.length)
703
703
  };
704
- }, zt = (n, r) => {
705
- if (typeof r == "function") return { fn: r };
706
- if (typeof r == "object") {
707
- if (typeof r.fn == "function") return r;
708
- throw new t(n, r, "an Easing must carry a callable `fn`");
709
- }
710
- if (typeof r != "string") throw new t(n, r, "a timing-function name or CSS timing-function literal must be a string");
711
- let i;
704
+ }, zt = (e, n) => {
705
+ if (typeof n == "function") return { fn: n };
706
+ if (typeof n == "object") {
707
+ if (typeof n.fn == "function") return n;
708
+ throw new t(e, n, "an Easing must carry a callable `fn`");
709
+ }
710
+ if (typeof n != "string") throw new t(e, n, "a timing-function name or CSS timing-function literal must be a string");
711
+ let r;
712
712
  try {
713
- i = _e(r);
713
+ r = _e(n);
714
714
  } catch {
715
- throw new t(n, r, "unknown timing function — pass a callable TimingFunction, a typed Easing, a registry name, or a cubic-bezier() literal", "UNKNOWN_TIMING_FN");
715
+ throw new t(e, n, "unknown timing function — pass a callable TimingFunction, a typed Easing, a registry name, or a cubic-bezier() literal", "UNKNOWN_TIMING_FN");
716
716
  }
717
- let a = e(r);
718
- return a ? {
719
- fn: i,
720
- css: a
721
- } : { fn: i };
717
+ let i = u(n);
718
+ return i ? {
719
+ fn: r,
720
+ css: i
721
+ } : { fn: r };
722
722
  };
723
723
  //#endregion
724
724
  //#region src/animation/compile/frame/compiler.ts
@@ -859,14 +859,14 @@ function Kt(e) {
859
859
  //#endregion
860
860
  //#region src/animation/engine/play-lifecycle/transport.ts
861
861
  function qt(e) {
862
- e._playback.started && (e._playback.paused = !0);
862
+ e._playback.started && (e._playback.paused = !0, e._playback.anchorTick = void 0);
863
863
  }
864
864
  function Jt(e) {
865
865
  if (e._playback.started && e._playback.paused) if (e._playback.paused = !1, e._playback._waAnimations.length > 0) for (let t of e._playback._waAnimations) t.play();
866
866
  else e.playback.running || e.playback.loop(e._playback._boundFrame);
867
867
  }
868
868
  function Yt(e) {
869
- c(e._playback, () => qt(e), () => Jt(e));
869
+ l(e._playback, () => qt(e), () => Jt(e));
870
870
  }
871
871
  function Xt(e) {
872
872
  tn(e), e.playback.stop(), N(e), en(e);
@@ -1037,21 +1037,21 @@ function hn(e, t, n) {
1037
1037
  //#endregion
1038
1038
  //#region src/animation/waapi/emission.ts
1039
1039
  function gn(e) {
1040
- let t = e.options.duration, n = [], r = e.frames.length > 1, i = r && dn(e), a = r && !i ? e.frames[0]?.timingFunction.css : void 0;
1041
- if (r && !i && a === void 0) throw TypeError("A multi-segment structural WAAPI animation requires a faithful CSS easing.");
1042
- let o = /* @__PURE__ */ new Set();
1043
- for (let t of e.frames) o.add(t.time.start), o.add(t.time.stop);
1044
- let s = [...o].sort((e, t) => e - t), c = new Set(s);
1045
- if (i) for (let n of hn(e, s, t)) c.add(n);
1046
- let l = s.at(-1);
1047
- for (let r of [...c].sort((e, t) => e - t)) {
1048
- let i = e.interpFrames(r, !1);
1049
- if (Object.keys(i).length === 0) continue;
1050
- let o = {
1051
- offset: _(r / t, 0, 1),
1052
- ...i
1040
+ let t = e.options.duration, n = [], r = e.frames.length > 1, a = r && dn(e), o = r && !a ? e.frames[0]?.timingFunction.css : void 0;
1041
+ if (r && !a && o === void 0) throw TypeError("A multi-segment structural WAAPI animation requires a faithful CSS easing.");
1042
+ let s = /* @__PURE__ */ new Set();
1043
+ for (let t of e.frames) s.add(t.time.start), s.add(t.time.stop);
1044
+ let c = [...s].sort((e, t) => e - t), l = new Set(c);
1045
+ if (a) for (let n of hn(e, c, t)) l.add(n);
1046
+ let u = c.at(-1);
1047
+ for (let r of [...l].sort((e, t) => e - t)) {
1048
+ let a = e.interpFrames(r, !1);
1049
+ if (Object.keys(a).length === 0) continue;
1050
+ let s = {
1051
+ offset: i(r / t, 0, 1),
1052
+ ...a
1053
1053
  };
1054
- a !== void 0 && r !== l && (o.easing = a), n.push(o);
1054
+ o !== void 0 && r !== u && (s.easing = o), n.push(s);
1055
1055
  }
1056
1056
  return n;
1057
1057
  }
@@ -1094,27 +1094,27 @@ function xn(e) {
1094
1094
  }
1095
1095
  //#endregion
1096
1096
  //#region src/animation/waapi/delegation.ts
1097
- async function Sn(e, t) {
1098
- let n = gn(e), r = xn(e), a = e.targets.map((e) => e.animate(n, r));
1099
- e._playback._waAnimations = a;
1097
+ async function Sn(t, n) {
1098
+ let r = gn(t), i = xn(t), a = t.targets.map((e) => e.animate(r, i));
1099
+ t._playback._waAnimations = a;
1100
1100
  let o = () => {
1101
- if (!e.paused) {
1102
- for (let t of a) if (t.playState === "paused") {
1103
- e.pause();
1101
+ if (!t.paused) {
1102
+ for (let e of a) if (e.playState === "paused") {
1103
+ t.pause();
1104
1104
  break;
1105
1105
  }
1106
1106
  }
1107
- if (e.paused) for (let e of a) e.pause();
1108
- return !e.done;
1107
+ if (t.paused) for (let e of a) e.pause();
1108
+ return !t.done;
1109
1109
  };
1110
- e.playback.loop((n) => e.done ? !1 : i(e.options.respectReducedMotion, () => !0, () => !1) ? (t.snapToReducedMotion(), !1) : (e.advanceTo(n), o()));
1110
+ t.playback.loop((r) => t.done ? !1 : e(t.options.respectReducedMotion, () => !0, () => !1) ? (n.snapToReducedMotion(), !1) : (t.advanceTo(r), o()));
1111
1111
  try {
1112
1112
  await Promise.all(a.map((e) => e.finished));
1113
- for (let t of a) try {
1114
- e.restPosition === "final" && typeof t.commitStyles == "function" && t.commitStyles(), t.cancel();
1113
+ for (let e of a) try {
1114
+ t.restPosition === "final" && typeof e.commitStyles == "function" && e.commitStyles(), e.cancel();
1115
1115
  } catch {}
1116
1116
  } catch {} finally {
1117
- e.playback.stop(), e._playback._waAnimations = [];
1117
+ t.playback.stop(), t._playback._waAnimations = [];
1118
1118
  }
1119
1119
  }
1120
1120
  function Cn(e, t, n) {
@@ -1153,14 +1153,14 @@ async function En(e) {
1153
1153
  function Dn(e) {
1154
1154
  tn(e), e.fillForwards(), e._playback.iteration = 0, e._playback.done = !0, e.dispatchAnimationEvent("animationend"), N(e), en(e);
1155
1155
  }
1156
- async function On(e) {
1157
- if (e.managed) throw Error("Animation.play() called on a managed animation — the AnimationGroup owns the rAF loop. Call group.play() instead.");
1158
- return e.assertNoUnresolvedNamedSelector(), d(e._playback, () => i(e.options.respectReducedMotion, () => (e.waapiIneligibleReason = void 0, En(e)), () => {
1159
- if (e.options.useWAAPI) {
1160
- let t = P(e);
1161
- return t.eligible ? (e.waapiIneligibleReason = void 0, Tn(e)) : (e.waapiIneligibleReason = t.reason, wn(e));
1156
+ async function On(t) {
1157
+ if (t.managed) throw Error("Animation.play() called on a managed animation — the AnimationGroup owns the rAF loop. Call group.play() instead.");
1158
+ return t.assertNoUnresolvedNamedSelector(), f(t._playback, () => e(t.options.respectReducedMotion, () => (t.waapiIneligibleReason = void 0, En(t)), () => {
1159
+ if (t.options.useWAAPI) {
1160
+ let e = P(t);
1161
+ return e.eligible ? (t.waapiIneligibleReason = void 0, Tn(t)) : (t.waapiIneligibleReason = e.reason, wn(t));
1162
1162
  }
1163
- return e.waapiIneligibleReason = void 0, wn(e);
1163
+ return t.waapiIneligibleReason = void 0, wn(t);
1164
1164
  }));
1165
1165
  }
1166
1166
  //#endregion
@@ -1207,8 +1207,8 @@ function Fn(e, t, n) {
1207
1207
  }
1208
1208
  return e._playback.t;
1209
1209
  }
1210
- function In(e, t) {
1211
- return i(e.options.respectReducedMotion, () => !0, () => !1) ? (Dn(e), !1) : (Pn(e, t), Ln(e, e.advanceTo(t)));
1210
+ function In(t, n) {
1211
+ return e(t.options.respectReducedMotion, () => !0, () => !1) ? (Dn(t), !1) : (Pn(t, n), Ln(t, t.advanceTo(n)));
1212
1212
  }
1213
1213
  function Ln(e, t) {
1214
1214
  return e._playback.paused ? !1 : e._playback.done ? (N(e), en(e), !1) : (e.interpFrames(t, !0, e._playback._interpOut), !0);
@@ -1310,12 +1310,12 @@ function Yn(e, t, n = !1) {
1310
1310
  let i = I(e, Se(t, 0, 1) * e.options.duration, n);
1311
1311
  return e._playback.reversed = r, i;
1312
1312
  }
1313
- function I(e, t, n = !1, i) {
1313
+ function I(e, t, r = !1, i) {
1314
1314
  let a = t < 0;
1315
1315
  a && (t = 0);
1316
1316
  let o = e.options.fillMode === "backwards" || e.options.fillMode === "both";
1317
1317
  t = e._playback.reversed ? e.options.duration - t : t;
1318
- let s = e.frames, c = s.length, l = a && !o ? -1 : r(s, t, (e) => e.time.start, (e) => e.time.stop);
1318
+ let s = e.frames, c = s.length, l = a && !o ? -1 : n(s, t, (e) => e.time.start, (e) => e.time.stop);
1319
1319
  if (l === -1) return i === void 0 ? {} : (Xn(e, i), i);
1320
1320
  let u = l, d = l;
1321
1321
  for (let e = l - 1; e >= 0; e--) {
@@ -1328,7 +1328,7 @@ function I(e, t, n = !1, i) {
1328
1328
  if (t < n.time.start || t > n.time.stop) break;
1329
1329
  d = e;
1330
1330
  }
1331
- for (let r = u; r <= d; r++) Zn(e, s[r], t, n);
1331
+ for (let n = u; n <= d; n++) Zn(e, s[n], t, r);
1332
1332
  if (u === d) {
1333
1333
  let t = s[l].flatVars;
1334
1334
  return i === void 0 ? t : (Xn(e, i), Object.assign(i, t), i);
@@ -1377,19 +1377,19 @@ function er(e) {
1377
1377
  return e == null ? E.timingFunction : zt("timingFunction", e);
1378
1378
  }
1379
1379
  function tr(e) {
1380
- return e == null ? E.iterationCount : e === "infinite" || e === "∞" || e === "Infinity" || e === Infinity ? Infinity : n("iterationCount", e, (e) => {
1380
+ return e == null ? E.iterationCount : e === "infinite" || e === "∞" || e === "Infinity" || e === Infinity ? Infinity : r("iterationCount", e, (e) => {
1381
1381
  let t = typeof e == "string" ? Number.parseFloat(e.trim()) : e;
1382
1382
  return typeof t == "number" && !Number.isNaN(t) && t >= 0 ? t : void 0;
1383
1383
  }, "expected a non-negative count, \"infinite\", or Infinity");
1384
1384
  }
1385
1385
  function nr(e) {
1386
- if (e != null) return n("duration", e, (e) => {
1386
+ if (e != null) return r("duration", e, (e) => {
1387
1387
  let t = typeof e == "string" ? $n(e) : e;
1388
1388
  return typeof t == "number" && isFinite(t) && t > 0 ? t : void 0;
1389
1389
  }, "expected a positive duration in milliseconds or a CSS time string");
1390
1390
  }
1391
1391
  function rr(e) {
1392
- return e == null ? E.delay : n("delay", e, (e) => {
1392
+ return e == null ? E.delay : r("delay", e, (e) => {
1393
1393
  let t = typeof e == "string" ? $n(e) : e;
1394
1394
  return typeof t == "number" && isFinite(t) ? t : void 0;
1395
1395
  }, "expected a delay in milliseconds or a CSS time string");
@@ -1788,7 +1788,7 @@ var H = (e) => typeof e == "string" ? e : e.name ?? String(e.id), ti = 0, ni = c
1788
1788
  superKey;
1789
1789
  targets;
1790
1790
  options;
1791
- playback = new s();
1791
+ playback = new _();
1792
1792
  _playback;
1793
1793
  get startTime() {
1794
1794
  return this._playback.startTime;
@@ -2141,28 +2141,28 @@ var mi = (e) => typeof e != "object" || !e ? !1 : typeof e.clone == "function",
2141
2141
  }
2142
2142
  propertyRegistry = /* @__PURE__ */ new Map();
2143
2143
  scrollOptions;
2144
- fromString(t, n) {
2145
- n = this.beginIngest(n);
2146
- let r = li(t);
2147
- this.propertyRegistry = r.properties;
2148
- let i = fi(r.stylesheet);
2149
- i === void 0 ? delete this.scrollOptions : this.scrollOptions = i, this.diagnostics = [...r.diagnostics];
2150
- let a = di(r.options);
2151
- Object.keys(a).length > 0 && this.setOptions({
2152
- ...a,
2144
+ fromString(e, t) {
2145
+ t = this.beginIngest(t);
2146
+ let n = li(e);
2147
+ this.propertyRegistry = n.properties;
2148
+ let r = fi(n.stylesheet);
2149
+ r === void 0 ? delete this.scrollOptions : this.scrollOptions = r, this.diagnostics = [...n.diagnostics];
2150
+ let i = di(n.options);
2151
+ Object.keys(i).length > 0 && this.setOptions({
2152
+ ...i,
2153
2153
  ...this._ctorOptions
2154
2154
  });
2155
- for (let [t, i] of r.keyframes.entries()) {
2156
- let a = Object.fromEntries(Object.entries(i).map(([e, t]) => [e, mi(t) ? t.clone() : t])), o = r.timingFunctions.get(t), s = o ? _e(o) : void 0, c;
2157
- if (s) {
2158
- let t = o ? e(o) : void 0;
2159
- c = t ? {
2160
- fn: s,
2161
- css: t
2162
- } : { fn: s };
2155
+ for (let [e, r] of n.keyframes.entries()) {
2156
+ let i = Object.fromEntries(Object.entries(r).map(([e, t]) => [e, mi(t) ? t.clone() : t])), a = n.timingFunctions.get(e), o = a ? _e(a) : void 0, s;
2157
+ if (o) {
2158
+ let e = a ? u(a) : void 0;
2159
+ s = e ? {
2160
+ fn: o,
2161
+ css: e
2162
+ } : { fn: o };
2163
2163
  }
2164
- let l = r.composition.get(t);
2165
- this.addFrame(t, a, n, c, l);
2164
+ let c = n.composition.get(e);
2165
+ this.addFrame(e, i, t, s, c);
2166
2166
  }
2167
2167
  return this.parse(), pi(this.propertyRegistry, this.diagnostics), this;
2168
2168
  }
@@ -2281,18 +2281,18 @@ function Oi(e) {
2281
2281
  let t = e.resolvePromise;
2282
2282
  e.resolvePromise = null, t?.();
2283
2283
  }
2284
- async function ki(e) {
2285
- return e._playingPromise && e.resolvePromise && !e.started && !e.paused && !e.playback.running && e.playback.loop(e._boundFrame), d(e, () => i(e.respectReducedMotion, () => Ai(e), () => {
2286
- let t = wi(e);
2287
- return t && (e._waAnimations.push(...t), e._waapiDelegated = !0), new Promise((t) => {
2288
- e.resolvePromise = t, e.playback.loop(e._boundFrame);
2284
+ async function ki(t) {
2285
+ return t._playingPromise && t.resolvePromise && !t.started && !t.paused && !t.playback.running && t.playback.loop(t._boundFrame), f(t, () => e(t.respectReducedMotion, () => Ai(t), () => {
2286
+ let e = wi(t);
2287
+ return e && (t._waAnimations.push(...e), t._waapiDelegated = !0), new Promise((e) => {
2288
+ t.resolvePromise = e, t.playback.loop(t._boundFrame);
2289
2289
  });
2290
2290
  }));
2291
2291
  }
2292
2292
  function Ai(e) {
2293
2293
  e.started = !0;
2294
2294
  let t = e.lastTickTime;
2295
- return yi(e.getEntries()), e.singleTarget && e.render(t), e.settle(), Promise.resolve();
2295
+ return yi(e.getEntries()), e.singleTarget && e.render(t), e.settle(), e._snappedToFinal = !0, Promise.resolve();
2296
2296
  }
2297
2297
  function ji(e) {
2298
2298
  if (!e.started || e.paused) return;
@@ -2308,7 +2308,7 @@ function Mi(e) {
2308
2308
  !e.started || !e.paused || (e.paused = !1, bi(e.getEntries(), !1), e._waapiDelegated && Di(e), e.playback.loop(e._boundFrame));
2309
2309
  }
2310
2310
  function Ni(e) {
2311
- c(e, () => ji(e), () => Mi(e));
2311
+ l(e, () => ji(e), () => Mi(e));
2312
2312
  }
2313
2313
  function Pi(e) {
2314
2314
  e._waapiDelegated && Ti(e);
@@ -2316,11 +2316,12 @@ function Pi(e) {
2316
2316
  e.started = !1, e.done = !1, e.paused = !1, e.lastTickTime = 0;
2317
2317
  }
2318
2318
  function Fi(e) {
2319
- for (let t of e.getEntries()) {
2320
- let e = t.animation;
2321
- (e.started || e.t !== 0) && e.frames.length > 0 && e.interpFrames(0, !0);
2319
+ let t = e._snappedToFinal;
2320
+ for (let n of e.getEntries()) {
2321
+ let e = n.animation;
2322
+ (t || e.started || e.t !== 0) && e.frames.length > 0 && e.interpFrames(0, !0);
2322
2323
  }
2323
- e.settle();
2324
+ e.settle(), e._snappedToFinal = !1;
2324
2325
  }
2325
2326
  function Ii(e) {
2326
2327
  e.playback.stop(), e.reset(), Oi(e);
@@ -2391,7 +2392,7 @@ var Ji = (e, t) => {
2391
2392
  }, Yi = async (e, t, n) => {
2392
2393
  for (let r = 0; r < e.length; r += n) Ji(e.slice(r, r + n), t), r + n < e.length && await qi();
2393
2394
  }, Xi = (e, t, n) => {
2394
- let r = new p({
2395
+ let r = new c({
2395
2396
  ...n,
2396
2397
  initial: e
2397
2398
  });
@@ -2574,7 +2575,7 @@ function sa(e, t, n) {
2574
2575
  let r = gi(e.animations, t, "transitionLayer").layer, i = Si(n.weight);
2575
2576
  r.op = "replace";
2576
2577
  let a = r.weightSpring;
2577
- a instanceof p ? a.target = i : r.weightSpring = Xi(Si(r.weight), i, n.spring), e._hasLayerSprings = !0, e.invalidateEntries();
2578
+ a instanceof c ? a.target = i : r.weightSpring = Xi(Si(r.weight), i, n.spring), e._hasLayerSprings = !0, e.invalidateEntries();
2578
2579
  }
2579
2580
  function ca(e, t, n, r) {
2580
2581
  let i = r?.spring;
@@ -2618,9 +2619,10 @@ var la = class e {
2618
2619
  }
2619
2620
  unflatten = !1;
2620
2621
  lastTickTime = 0;
2621
- playback = new s();
2622
+ playback = new _();
2622
2623
  _waAnimations = [];
2623
2624
  _waapiDelegated = !1;
2625
+ _snappedToFinal = !1;
2624
2626
  resolvePromise = null;
2625
2627
  _playingPromise = null;
2626
2628
  _boundFrame;
@@ -3170,7 +3172,7 @@ var Ta = class extends ua {
3170
3172
  css: ao,
3171
3173
  options: {
3172
3174
  duration: 900,
3173
- timingFunction: l(mo),
3175
+ timingFunction: d(mo),
3174
3176
  fillMode: "none"
3175
3177
  },
3176
3178
  group: "enter"
@@ -3195,7 +3197,7 @@ var Ta = class extends ua {
3195
3197
  css: ho.springScaleInKeyframes,
3196
3198
  options: {
3197
3199
  duration: 600,
3198
- timingFunction: l(lo)
3200
+ timingFunction: d(lo)
3199
3201
  },
3200
3202
  group: "enter"
3201
3203
  },
@@ -3203,7 +3205,7 @@ var Ta = class extends ua {
3203
3205
  css: ho.springSlideInKeyframes,
3204
3206
  options: {
3205
3207
  duration: 600,
3206
- timingFunction: l(co)
3208
+ timingFunction: d(co)
3207
3209
  },
3208
3210
  group: "enter"
3209
3211
  },
@@ -3211,7 +3213,7 @@ var Ta = class extends ua {
3211
3213
  css: ho.springPopKeyframes,
3212
3214
  options: {
3213
3215
  duration: 700,
3214
- timingFunction: l(lo)
3216
+ timingFunction: d(lo)
3215
3217
  },
3216
3218
  group: "attention"
3217
3219
  },
@@ -3219,7 +3221,7 @@ var Ta = class extends ua {
3219
3221
  css: ho.springWobbleKeyframes,
3220
3222
  options: {
3221
3223
  duration: 800,
3222
- timingFunction: l(uo)
3224
+ timingFunction: d(uo)
3223
3225
  },
3224
3226
  group: "attention"
3225
3227
  }
@@ -3503,22 +3505,22 @@ var ks = class {
3503
3505
  subscribers = new Map([["enter", /* @__PURE__ */ new Set()], ["leave", /* @__PURE__ */ new Set()]]);
3504
3506
  constructor(e = {}) {
3505
3507
  if (this.resolvedRange = Os(e.range), this.scrubSeconds = e.scrub ?? 0, this.snapPoints = e.snap != null && e.snap.length > 0 ? e.snap : void 0, this.scrubSeconds > 0) {
3506
- let t = _(1 / (this.scrubSeconds * 60 + 1), .01, 1);
3507
- this.smoother = new u({
3508
+ let t = i(1 / (this.scrubSeconds * 60 + 1), .01, 1);
3509
+ this.smoother = new a({
3508
3510
  damping: t,
3509
3511
  clamp: !0,
3510
3512
  ...e.smoothing
3511
3513
  });
3512
3514
  }
3513
- this.snapPoints != null && (this.snapSpring = new p({ ...e.snapSpring }));
3515
+ this.snapPoints != null && (this.snapSpring = new c({ ...e.snapSpring }));
3514
3516
  }
3515
3517
  get range() {
3516
3518
  return this.resolvedRange;
3517
3519
  }
3518
3520
  scrollProgress(e) {
3519
- this.rawScroll = _(e, 0, 1);
3520
- let { start: t, end: n } = this.resolvedRange, r = n - t, i = r > 0 ? _((this.rawScroll - t) / r, 0, 1) : 0, a = this.rawScroll >= t && this.rawScroll <= n;
3521
- return a && !this.wasInside && this.fire("enter", i), !a && this.wasInside && this.fire("leave", i), this.wasInside = a, this.smoother ? (this.smoother.setTarget(i), this.localProgress = this.smoother.current) : this.localProgress = i, this.localProgress;
3521
+ this.rawScroll = i(e, 0, 1);
3522
+ let { start: t, end: n } = this.resolvedRange, r = n - t, a = r > 0 ? i((this.rawScroll - t) / r, 0, 1) : 0, o = this.rawScroll >= t && this.rawScroll <= n;
3523
+ return o && !this.wasInside && this.fire("enter", a), !o && this.wasInside && this.fire("leave", a), this.wasInside = o, this.smoother ? (this.smoother.setTarget(a), this.localProgress = this.smoother.current) : this.localProgress = a, this.localProgress;
3522
3524
  }
3523
3525
  tick(e) {
3524
3526
  return this.smoother && (this.smoother.tickDt(e), this.localProgress = this.smoother.current), this.localProgress;
@@ -3531,7 +3533,7 @@ var ks = class {
3531
3533
  }
3532
3534
  snapTo(e = 0) {
3533
3535
  if (this.snapPoints == null || this.snapSpring == null) return null;
3534
- let t = _(f({
3536
+ let t = i(p({
3535
3537
  initial: this.localProgress,
3536
3538
  velocity: e
3537
3539
  }), 0, 1), n = this.snapPoints[0], r = Math.abs(t - n);
@@ -3643,22 +3645,22 @@ var Ps = class {
3643
3645
  return Ns();
3644
3646
  }
3645
3647
  triggerProgress(e) {
3646
- let t = _(e, 0, 1), { start: n, end: r } = this.triggerRange, i = r - n, a = i > 0 ? _((t - n) / i, 0, 1) : 0, o = t >= n && t <= r, s = o && !this.wasInside, c = !o && this.wasInside, l = c && t > r;
3648
+ let t = i(e, 0, 1), { start: n, end: r } = this.triggerRange, a = r - n, o = a > 0 ? i((t - n) / a, 0, 1) : 0, s = t >= n && t <= r, c = s && !this.wasInside, l = !s && this.wasInside, u = l && t > r;
3647
3649
  switch (this.type) {
3648
3650
  case "repeat":
3649
- this.stepRepeat(o, s, c, a);
3651
+ this.stepRepeat(s, c, l, o);
3650
3652
  break;
3651
3653
  case "alternate":
3652
- this.stepAlternate(o, s, c, a);
3654
+ this.stepAlternate(s, c, l, o);
3653
3655
  break;
3654
3656
  case "state":
3655
- this.stepState(o, a);
3657
+ this.stepState(s, o);
3656
3658
  break;
3657
3659
  default:
3658
- this.stepOnce(s, l, a);
3660
+ this.stepOnce(c, u, o);
3659
3661
  break;
3660
3662
  }
3661
- return this.wasInside = o, this._state;
3663
+ return this.wasInside = s, this._state;
3662
3664
  }
3663
3665
  reset() {
3664
3666
  this._state = "idle", this._direction = "forward", this._playhead = 0, this._cycles = 0, this.wasInside = !1, this.everEntered = !1;
@@ -3794,7 +3796,7 @@ function q(e) {
3794
3796
  //#region src/animation/compile/emit/easing-serialize.ts
3795
3797
  var Ys = /^(linear|ease|ease-in|ease-out|ease-in-out|step-start|step-end)$/;
3796
3798
  function Xs(e, t = 32) {
3797
- return o(Array.from({ length: t + 1 }, (n, r) => e(r / t)));
3799
+ return s(Array.from({ length: t + 1 }, (n, r) => e(r / t)));
3798
3800
  }
3799
3801
  function J(e) {
3800
3802
  if (e.css !== void 0) return e.css;
@@ -3889,7 +3891,7 @@ function rc(e, t, n) {
3889
3891
  }
3890
3892
  var ic = async (e) => {
3891
3893
  let t = J(e.options.timingFunction);
3892
- return e.templateFrames.map((n, r) => `${a(n.start)}\n${rc(e, r, t)}\n`);
3894
+ return e.templateFrames.map((n, r) => `${o(n.start)}\n${rc(e, r, t)}\n`);
3893
3895
  };
3894
3896
  function ac(e) {
3895
3897
  let t = e.indexOf("{"), n = t === -1 ? e : e.slice(t + 1), r = n.lastIndexOf("}");
@@ -3897,18 +3899,18 @@ function ac(e) {
3897
3899
  }
3898
3900
  function oc(e, t, n) {
3899
3901
  let r = J(e.options.timingFunction), i = /* @__PURE__ */ new Map();
3900
- e.templateFrames.forEach((t, o) => {
3901
- let s = n?.get(o) ?? rc(e, o, r), c = i.get(s), l = a(t.start);
3902
+ e.templateFrames.forEach((t, a) => {
3903
+ let s = n?.get(a) ?? rc(e, a, r), c = i.get(s), l = o(t.start);
3902
3904
  c ? c.push(l) : i.set(s, [l]);
3903
3905
  });
3904
- let o = "";
3905
- for (let [e, t] of i) o += ` ${t.join(", ")} ${e.replace(/\n/g, "\n ")}\n`;
3906
- return `@keyframes ${t} {\n${o}}`;
3906
+ let a = "";
3907
+ for (let [e, t] of i) a += ` ${t.join(", ")} ${e.replace(/\n/g, "\n ")}\n`;
3908
+ return `@keyframes ${t} {\n${a}}`;
3907
3909
  }
3908
3910
  function sc(e, t, n) {
3909
3911
  let r = J(e.options.timingFunction), i = /* @__PURE__ */ new Map();
3910
3912
  for (let t = 0; t < e.templateFrames.length; t++) {
3911
- let o = e.templateFrames[t], s = e.parsedVars[t] ?? {}, c = {};
3913
+ let a = e.templateFrames[t], s = e.parsedVars[t] ?? {}, c = {};
3912
3914
  for (let [e, t] of Object.entries(s)) {
3913
3915
  let r = nc(t, n);
3914
3916
  if (r === void 0) return {
@@ -3917,27 +3919,27 @@ function sc(e, t, n) {
3917
3919
  };
3918
3920
  c[e] = r;
3919
3921
  }
3920
- let l = Object.entries(c).map(([e, t]) => ` ${k(e)}: ${y(t)};`), u = o.timingFunction ? J(o.timingFunction) : r;
3922
+ let l = Object.entries(c).map(([e, t]) => ` ${k(e)}: ${y(t)};`), u = a.timingFunction ? J(a.timingFunction) : r;
3921
3923
  u !== r && l.push(` animation-timing-function: ${u};`);
3922
- let d = o.composition;
3924
+ let d = a.composition;
3923
3925
  d != null && d !== "replace" && l.push(` animation-composition: ${d};`);
3924
- let f = `{\n${l.join("\n")}\n}`, p = i.get(f), m = a(o.start);
3926
+ let f = `{\n${l.join("\n")}\n}`, p = i.get(f), m = o(a.start);
3925
3927
  p ? p.push(m) : i.set(f, [m]);
3926
3928
  }
3927
- let o = "";
3928
- for (let [e, t] of i) o += ` ${t.join(", ")} ${e.replace(/\n/g, "\n ")}\n`;
3929
- return { block: `@keyframes ${t} {\n${o}}` };
3929
+ let a = "";
3930
+ for (let [e, t] of i) a += ` ${t.join(", ")} ${e.replace(/\n/g, "\n ")}\n`;
3931
+ return { block: `@keyframes ${t} {\n${a}}` };
3930
3932
  }
3931
3933
  async function cc(e, t = "animation") {
3932
3934
  let n = e.options, r = /* @__PURE__ */ new Map(), i = J(n.timingFunction);
3933
3935
  e.templateFrames.forEach((t, n) => {
3934
- let o = a(t.start), s = rc(e, n, i);
3935
- r.has(s) ? r.get(s).push(o) : r.set(s, [o]);
3936
+ let a = o(t.start), s = rc(e, n, i);
3937
+ r.has(s) ? r.get(s).push(a) : r.set(s, [a]);
3936
3938
  });
3937
- let o = "";
3938
- for (let [e, t] of r) o += ` ${t.join(", ")} ${e.replace(/\n/g, "\n ")}\n`;
3939
+ let a = "";
3940
+ for (let [e, t] of r) a += ` ${t.join(", ")} ${e.replace(/\n/g, "\n ")}\n`;
3939
3941
  let s = Zs(n, t), c = ec(e);
3940
- return `${`${c ? `${c}\n\n` : ""}${s}\n@keyframes ${t} {\n${o}}`.replace(/\(\s*\{/g, "{").replace(/\}\s*\)/g, "}")}\n`;
3942
+ return `${`${c ? `${c}\n\n` : ""}${s}\n@keyframes ${t} {\n${a}}`.replace(/\(\s*\{/g, "{").replace(/\}\s*\)/g, "}")}\n`;
3941
3943
  }
3942
3944
  //#endregion
3943
3945
  //#region src/animation/compile/emit/densify.ts