@algorisys/tinyfly 0.79.0 → 0.82.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,29 +1,29 @@
1
- function de(t) {
1
+ function _e(t) {
2
2
  return typeof t == "object" && t !== null && t.type === "cubic-bezier";
3
3
  }
4
- function _t(t) {
4
+ function Mt(t) {
5
5
  return typeof t == "object" && t !== null && t.type !== "cubic-bezier";
6
6
  }
7
- const rt = 1;
7
+ const it = 1;
8
8
  function kt(t) {
9
9
  return t.property === "text" && "textConfig" in t;
10
10
  }
11
- function U(t) {
11
+ function V(t) {
12
12
  return t.kind === "inertia" && "inertia" in t;
13
13
  }
14
- function V(t) {
14
+ function H(t) {
15
15
  return t.kind === "spring" && "spring" in t;
16
16
  }
17
- function Ht(t) {
17
+ function qt(t) {
18
18
  return t.property === "motionPath" && "motionPathConfig" in t;
19
19
  }
20
- function Fn(t) {
20
+ function Yn(t) {
21
21
  return typeof t == "object" && t !== null && "x" in t && "y" in t && "angle" in t;
22
22
  }
23
- function ge(t) {
23
+ function Me(t) {
24
24
  return "keyframes" in t;
25
25
  }
26
- class On {
26
+ class Un {
27
27
  _currentTime = 0;
28
28
  _isRunning = !1;
29
29
  onTick = null;
@@ -49,7 +49,7 @@ class On {
49
49
  this._currentTime = e;
50
50
  }
51
51
  }
52
- class Nn {
52
+ class Vn {
53
53
  _currentTime = 0;
54
54
  _isRunning = !1;
55
55
  _lastFrameTime = null;
@@ -89,18 +89,18 @@ class Nn {
89
89
  _onFrame(e) {
90
90
  if (this._isRunning) {
91
91
  if (this._lastFrameTime !== null) {
92
- const s = (e - this._lastFrameTime) * this._speed;
93
- this._currentTime += s, this.onTick?.(s, this._currentTime);
92
+ const r = (e - this._lastFrameTime) * this._speed;
93
+ this._currentTime += r, this.onTick?.(r, this._currentTime);
94
94
  }
95
95
  this._lastFrameTime = e, this._scheduleFrame();
96
96
  }
97
97
  }
98
98
  }
99
- function zt(t, e, n = "start") {
99
+ function Wt(t, e, n = "start") {
100
100
  if (e <= 1) return 0;
101
101
  if (typeof n == "number") {
102
- const s = Math.max(0, Math.min(e - 1, n));
103
- return Math.abs(t - s);
102
+ const r = Math.max(0, Math.min(e - 1, n));
103
+ return Math.abs(t - r);
104
104
  }
105
105
  switch (n) {
106
106
  case "end":
@@ -113,36 +113,36 @@ function zt(t, e, n = "start") {
113
113
  return t;
114
114
  }
115
115
  }
116
- function me(t, e = "start") {
116
+ function be(t, e = "start") {
117
117
  if (t <= 1) return 0;
118
118
  let n = 0;
119
- for (let s = 0; s < t; s++)
120
- n = Math.max(n, zt(s, t, e));
119
+ for (let r = 0; r < t; r++)
120
+ n = Math.max(n, Wt(r, t, e));
121
121
  return n;
122
122
  }
123
- function qt(t, e, n) {
123
+ function jt(t, e, n) {
124
124
  if (n.offsets) return n.offsets[t] ?? 0;
125
- const s = n.from ?? "start", r = zt(t, e, s);
125
+ const r = n.from ?? "start", s = Wt(t, e, r);
126
126
  if (n.amount !== void 0) {
127
- const i = me(e, s);
128
- return i === 0 ? 0 : n.amount * r / i;
127
+ const i = be(e, r);
128
+ return i === 0 ? 0 : n.amount * s / i;
129
129
  }
130
- return n.each !== void 0 ? n.each * r : 0;
130
+ return n.each !== void 0 ? n.each * s : 0;
131
131
  }
132
- function ye(t, e) {
133
- return Array.from({ length: t }, (n, s) => qt(s, t, e));
132
+ function Te(t, e) {
133
+ return Array.from({ length: t }, (n, r) => jt(r, t, e));
134
134
  }
135
- function xt(t, e) {
136
- return t <= 1 ? 0 : Math.max(...ye(t, e));
135
+ function vt(t, e) {
136
+ return t <= 1 ? 0 : Math.max(...Te(t, e));
137
137
  }
138
- const G = 1, Wt = 6e4, et = Wt / G, C = {
138
+ const Z = 1, Kt = 6e4, nt = Kt / Z, E = {
139
139
  stiffness: 180,
140
140
  damping: 12,
141
141
  mass: 1,
142
142
  velocity: 0,
143
143
  restDelta: 0.01,
144
144
  restSpeed: 0.1
145
- }, Xn = {
145
+ }, Hn = {
146
146
  gentle: { stiffness: 120, damping: 18, mass: 1 },
147
147
  default: { stiffness: 180, damping: 12, mass: 1 },
148
148
  snappy: { stiffness: 280, damping: 20, mass: 1 },
@@ -150,7 +150,7 @@ const G = 1, Wt = 6e4, et = Wt / G, C = {
150
150
  wobbly: { stiffness: 180, damping: 5, mass: 1 },
151
151
  stiff: { stiffness: 400, damping: 30, mass: 1 }
152
152
  };
153
- class it {
153
+ class at {
154
154
  from;
155
155
  to;
156
156
  stiffness;
@@ -175,7 +175,7 @@ class it {
175
175
  /** Once at rest we stop simulating; every later time returns `to`. */
176
176
  settledStep = null;
177
177
  constructor(e) {
178
- this.from = e.from, this.to = e.to, this.stiffness = e.stiffness ?? C.stiffness, this.damping = e.damping ?? C.damping, this.mass = e.mass ?? C.mass, this.restDelta = e.restDelta ?? C.restDelta, this.restSpeed = e.restSpeed ?? C.restSpeed, this.distance = Math.abs(this.to - this.from) || 1, this.samples = [this.from], this.velocity = e.velocity ?? C.velocity, this.isAtRest(this.from) && (this.settledStep = 0);
178
+ this.from = e.from, this.to = e.to, this.stiffness = e.stiffness ?? E.stiffness, this.damping = e.damping ?? E.damping, this.mass = e.mass ?? E.mass, this.restDelta = e.restDelta ?? E.restDelta, this.restSpeed = e.restSpeed ?? E.restSpeed, this.distance = Math.abs(this.to - this.from) || 1, this.samples = [this.from], this.velocity = e.velocity ?? E.velocity, this.isAtRest(this.from) && (this.settledStep = 0);
179
179
  }
180
180
  /**
181
181
  * Whether a position/velocity pair counts as settled.
@@ -193,155 +193,155 @@ class it {
193
193
  */
194
194
  valueAt(e) {
195
195
  if (e <= 0) return this.from;
196
- const n = Math.floor(e / G);
196
+ const n = Math.floor(e / Z);
197
197
  if (this.simulateTo(n + 1), this.settledStep !== null && n >= this.settledStep)
198
198
  return this.to;
199
- const s = this.samples[Math.min(n, this.samples.length - 1)], r = this.samples[Math.min(n + 1, this.samples.length - 1)], i = e / G - n;
200
- return s + (r - s) * i;
199
+ const r = this.samples[Math.min(n, this.samples.length - 1)], s = this.samples[Math.min(n + 1, this.samples.length - 1)], i = e / Z - n;
200
+ return r + (s - r) * i;
201
201
  }
202
202
  /**
203
203
  * How long the spring takes to settle, in milliseconds — the natural duration
204
204
  * of a spring track. Runs the simulation to completion once.
205
205
  */
206
206
  settleTime() {
207
- return this.simulateTo(et + 1), this.settledStep !== null ? this.settledStep * G : Wt;
207
+ return this.simulateTo(nt + 1), this.settledStep !== null ? this.settledStep * Z : Kt;
208
208
  }
209
209
  /** Advance the cached simulation until it holds at least `steps` samples. */
210
210
  simulateTo(e) {
211
211
  if (this.settledStep !== null) return;
212
- const n = Math.min(e, et + 1), s = G / 1e3;
212
+ const n = Math.min(e, nt + 1), r = Z / 1e3;
213
213
  for (; this.samples.length < n; ) {
214
- const r = this.samples[this.samples.length - 1], i = r - this.to, a = -this.stiffness * i, o = -this.damping * this.velocity, c = (a + o) / this.mass;
215
- this.velocity += c * s;
216
- const u = r + this.velocity * s;
214
+ const s = this.samples[this.samples.length - 1], i = s - this.to, a = -this.stiffness * i, o = -this.damping * this.velocity, c = (a + o) / this.mass;
215
+ this.velocity += c * r;
216
+ const u = s + this.velocity * r;
217
217
  if (this.samples.push(u), this.isAtRest(u)) {
218
218
  this.settledStep = this.samples.length - 1;
219
219
  return;
220
220
  }
221
221
  }
222
- this.samples.length > et && (this.settledStep = et);
222
+ this.samples.length > nt && (this.settledStep = nt);
223
223
  }
224
224
  }
225
- function Yn(t, e) {
226
- return new it(t).valueAt(e);
225
+ function zn(t, e) {
226
+ return new at(t).valueAt(e);
227
227
  }
228
- function Un(t) {
229
- return new it(t).settleTime();
228
+ function Bn(t) {
229
+ return new at(t).settleTime();
230
230
  }
231
- function Vn(t) {
232
- const e = t.stiffness ?? C.stiffness, n = t.damping ?? C.damping, s = t.mass ?? C.mass;
233
- return n < 2 * Math.sqrt(e * s);
231
+ function qn(t) {
232
+ const e = t.stiffness ?? E.stiffness, n = t.damping ?? E.damping, r = t.mass ?? E.mass;
233
+ return n < 2 * Math.sqrt(e * r);
234
234
  }
235
- function Hn(t) {
236
- const e = t.stiffness ?? C.stiffness, n = t.mass ?? C.mass;
235
+ function Wn(t) {
236
+ const e = t.stiffness ?? E.stiffness, n = t.mass ?? E.mass;
237
237
  return 2 * Math.sqrt(e * n);
238
238
  }
239
- const wt = 4, _e = 2e-3, Me = 1e-4, Te = 6e4;
240
- function at(t) {
241
- const e = t.friction ?? wt;
242
- return e > 0 ? e : wt;
239
+ const Rt = 4, xe = 2e-3, ke = 1e-4, ve = 6e4;
240
+ function ot(t) {
241
+ const e = t.friction ?? Rt;
242
+ return e > 0 ? e : Rt;
243
243
  }
244
- function be(t) {
245
- return t.from + t.velocity / at(t);
244
+ function Se(t) {
245
+ return t.from + t.velocity / ot(t);
246
246
  }
247
- function ke(t, e) {
247
+ function Ae(t, e) {
248
248
  if (e === void 0) return t;
249
249
  if (typeof e == "number")
250
250
  return e > 0 ? Math.round(t / e) * e : t;
251
251
  if (e.length === 0) return t;
252
252
  let n = e[0];
253
- for (const s of e)
254
- Math.abs(s - t) < Math.abs(n - t) && (n = s);
253
+ for (const r of e)
254
+ Math.abs(r - t) < Math.abs(n - t) && (n = r);
255
255
  return n;
256
256
  }
257
- function ot(t) {
258
- let e = ke(be(t), t.end);
257
+ function ct(t) {
258
+ let e = Ae(Se(t), t.end);
259
259
  return t.min !== void 0 && (e = Math.max(t.min, e)), t.max !== void 0 && (e = Math.min(t.max, e)), e;
260
260
  }
261
- function ct(t) {
262
- const e = Math.abs(ot(t) - t.from);
261
+ function ut(t) {
262
+ const e = Math.abs(ct(t) - t.from);
263
263
  if (e === 0) return 0;
264
- const n = t.restDelta ?? Math.max(Me, e * _e);
264
+ const n = t.restDelta ?? Math.max(ke, e * xe);
265
265
  if (n >= e) return 0;
266
- const s = Math.log(e / n) / at(t);
267
- return Math.min(Te, s * 1e3);
266
+ const r = Math.log(e / n) / ot(t);
267
+ return Math.min(ve, r * 1e3);
268
268
  }
269
- function Mt(t, e) {
269
+ function bt(t, e) {
270
270
  if (e <= 0) return t.from;
271
- const n = ot(t);
272
- if (e >= ct(t)) return n;
273
- const s = at(t);
274
- return t.from + (n - t.from) * (1 - Math.exp(-s * e / 1e3));
271
+ const n = ct(t);
272
+ if (e >= ut(t)) return n;
273
+ const r = ot(t);
274
+ return t.from + (n - t.from) * (1 - Math.exp(-r * e / 1e3));
275
275
  }
276
- function zn(t, e) {
277
- const n = at(t), s = ot(t);
278
- return e >= ct(t) ? 0 : (s - t.from) * n * Math.exp(-n * Math.max(0, e) / 1e3);
276
+ function jn(t, e) {
277
+ const n = ot(t), r = ct(t);
278
+ return e >= ut(t) ? 0 : (r - t.from) * n * Math.exp(-n * Math.max(0, e) / 1e3);
279
279
  }
280
- const Tt = (t) => t, xe = (t) => t * t, ve = (t) => 1 - (1 - t) * (1 - t), Se = (t) => t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2, jt = (t) => t * t * t, Kt = (t) => 1 - Math.pow(1 - t, 3), Qt = (t) => t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2, Ae = jt, we = Kt, Pe = Qt, $e = {
280
+ const Tt = (t) => t, we = (t) => t * t, Pe = (t) => 1 - (1 - t) * (1 - t), $e = (t) => t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2, Qt = (t) => t * t * t, Gt = (t) => 1 - Math.pow(1 - t, 3), Zt = (t) => t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2, Re = Qt, De = Gt, Ce = Zt, Ie = {
281
281
  linear: Tt,
282
- "ease-in": Ae,
283
- "ease-out": we,
284
- "ease-in-out": Pe,
285
- "ease-in-quad": xe,
286
- "ease-out-quad": ve,
287
- "ease-in-out-quad": Se,
288
- "ease-in-cubic": jt,
289
- "ease-out-cubic": Kt,
290
- "ease-in-out-cubic": Qt
282
+ "ease-in": Re,
283
+ "ease-out": De,
284
+ "ease-in-out": Ce,
285
+ "ease-in-quad": we,
286
+ "ease-out-quad": Pe,
287
+ "ease-in-out-quad": $e,
288
+ "ease-in-cubic": Qt,
289
+ "ease-out-cubic": Gt,
290
+ "ease-in-out-cubic": Zt
291
291
  };
292
- function Re(t) {
293
- const [e, n, s, r] = t, i = 3 * e, a = 3 * (s - e) - i, o = 1 - i - a, c = 3 * n, u = 3 * (r - n) - c, l = 1 - c - u, h = (d) => ((o * d + a) * d + i) * d, p = (d) => ((l * d + u) * d + c) * d, f = (d) => (3 * o * d + 2 * a) * d + i, M = (d) => {
292
+ function Ee(t) {
293
+ const [e, n, r, s] = t, i = 3 * e, a = 3 * (r - e) - i, o = 1 - i - a, c = 3 * n, u = 3 * (s - n) - c, l = 1 - c - u, h = (d) => ((o * d + a) * d + i) * d, p = (d) => ((l * d + u) * d + c) * d, f = (d) => (3 * o * d + 2 * a) * d + i, _ = (d) => {
294
294
  let g = d;
295
- for (let T = 0; T < 8; T++) {
296
- const k = h(g) - d;
297
- if (Math.abs(k) < 1e-7)
295
+ for (let k = 0; k < 8; k++) {
296
+ const A = h(g) - d;
297
+ if (Math.abs(A) < 1e-7)
298
298
  return g;
299
- const m = f(g);
300
- if (Math.abs(m) < 1e-7)
299
+ const y = f(g);
300
+ if (Math.abs(y) < 1e-7)
301
301
  break;
302
- g -= k / m;
302
+ g -= A / y;
303
303
  }
304
- let y = 0, _ = 1;
305
- for (g = d; y < _; ) {
306
- const T = h(g);
307
- if (Math.abs(T - d) < 1e-7)
304
+ let M = 0, b = 1;
305
+ for (g = d; M < b; ) {
306
+ const k = h(g);
307
+ if (Math.abs(k - d) < 1e-7)
308
308
  return g;
309
- d > T ? y = g : _ = g, g = (y + _) / 2;
309
+ d > k ? M = g : b = g, g = (M + b) / 2;
310
310
  }
311
311
  return g;
312
312
  };
313
313
  return (d) => {
314
314
  if (d <= 0) return 0;
315
315
  if (d >= 1) return 1;
316
- const g = M(d);
316
+ const g = _(d);
317
317
  return p(g);
318
318
  };
319
319
  }
320
- function ht(t, e = "out") {
320
+ function ft(t, e = "out") {
321
321
  if (e === "out") return t;
322
- const n = (s) => 1 - t(1 - s);
323
- return e === "in" ? n : (s) => s < 0.5 ? n(s * 2) / 2 : t(s * 2 - 1) / 2 + 0.5;
322
+ const n = (r) => 1 - t(1 - r);
323
+ return e === "in" ? n : (r) => r < 0.5 ? n(r * 2) / 2 : t(r * 2 - 1) / 2 + 0.5;
324
324
  }
325
- function De(t = 1, e = 0.3) {
326
- const n = Math.max(1, t), s = e / (2 * Math.PI) * Math.asin(1 / n);
327
- return (r) => r <= 0 ? 0 : r >= 1 ? 1 : n * Math.pow(2, -10 * r) * Math.sin((r - s) * (2 * Math.PI) / e) + 1;
325
+ function Le(t = 1, e = 0.3) {
326
+ const n = Math.max(1, t), r = e / (2 * Math.PI) * Math.asin(1 / n);
327
+ return (s) => s <= 0 ? 0 : s >= 1 ? 1 : n * Math.pow(2, -10 * s) * Math.sin((s - r) * (2 * Math.PI) / e) + 1;
328
328
  }
329
- const Ce = (t) => {
329
+ const Fe = (t) => {
330
330
  if (t <= 0) return 0;
331
331
  if (t >= 1) return 1;
332
332
  if (t < 1 / 2.75) return 7.5625 * t * t;
333
333
  if (t < 2 / 2.75) {
334
- const r = t - 0.5454545454545454;
335
- return 7.5625 * r * r + 0.75;
334
+ const s = t - 0.5454545454545454;
335
+ return 7.5625 * s * s + 0.75;
336
336
  }
337
337
  if (t < 2.5 / 2.75) {
338
- const r = t - 0.8181818181818182;
339
- return 7.5625 * r * r + 0.9375;
338
+ const s = t - 0.8181818181818182;
339
+ return 7.5625 * s * s + 0.9375;
340
340
  }
341
- const s = t - 2.625 / 2.75;
342
- return 7.5625 * s * s + 0.984375;
341
+ const r = t - 2.625 / 2.75;
342
+ return 7.5625 * r * r + 0.984375;
343
343
  };
344
- function Ie(t = 1.70158) {
344
+ function Oe(t = 1.70158) {
345
345
  return (e) => {
346
346
  if (e <= 0) return 0;
347
347
  if (e >= 1) return 1;
@@ -349,40 +349,40 @@ function Ie(t = 1.70158) {
349
349
  return n * n * ((t + 1) * n + t) + 1;
350
350
  };
351
351
  }
352
- function Ee(t, e = "end") {
352
+ function Ne(t, e = "end") {
353
353
  const n = Math.max(1, Math.floor(t));
354
- return (s) => {
355
- if (s >= 1) return 1;
356
- if (s <= 0) return e === "start" || e === "both" ? e === "start" ? 1 / n : 1 / (n + 1) : 0;
357
- const r = Math.floor(s * n);
354
+ return (r) => {
355
+ if (r >= 1) return 1;
356
+ if (r <= 0) return e === "start" || e === "both" ? e === "start" ? 1 / n : 1 / (n + 1) : 0;
357
+ const s = Math.floor(r * n);
358
358
  switch (e) {
359
359
  case "start":
360
- return Math.min(1, (r + 1) / n);
360
+ return Math.min(1, (s + 1) / n);
361
361
  case "both":
362
- return (r + 1) / (n + 1);
362
+ return (s + 1) / (n + 1);
363
363
  case "none":
364
- return n === 1 ? 0 : Math.min(1, r / (n - 1));
364
+ return n === 1 ? 0 : Math.min(1, s / (n - 1));
365
365
  default:
366
- return r / n;
366
+ return s / n;
367
367
  }
368
368
  };
369
369
  }
370
- function Le(t) {
370
+ function Xe(t) {
371
371
  switch (t.type) {
372
372
  case "steps":
373
- return Ee(t.count, t.position);
373
+ return Ne(t.count, t.position);
374
374
  case "elastic":
375
- return ht(De(t.amplitude, t.period), t.mode);
375
+ return ft(Le(t.amplitude, t.period), t.mode);
376
376
  case "bounce":
377
- return ht(Ce, t.mode);
377
+ return ft(Fe, t.mode);
378
378
  case "back":
379
- return ht(Ie(t.overshoot), t.mode);
379
+ return ft(Oe(t.overshoot), t.mode);
380
380
  }
381
381
  }
382
- function Gt(t) {
383
- return t === void 0 ? Tt : de(t) ? Re(t.points) : _t(t) ? Le(t) : $e[t] ?? Tt;
382
+ function Jt(t) {
383
+ return t === void 0 ? Tt : _e(t) ? Ee(t.points) : Mt(t) ? Xe(t) : Ie[t] ?? Tt;
384
384
  }
385
- const Pt = 32, Fe = 256, z = /* @__PURE__ */ new Map(), Oe = /[MmLlHhVvCcSsQqTtAaZz]/, Ne = /^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/, Xe = {
385
+ const Dt = 32, Ye = 256, q = /* @__PURE__ */ new Map(), Ue = /[MmLlHhVvCcSsQqTtAaZz]/, Ve = /^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/, He = {
386
386
  M: 2,
387
387
  L: 2,
388
388
  H: 1,
@@ -394,90 +394,90 @@ const Pt = 32, Fe = 256, z = /* @__PURE__ */ new Map(), Oe = /[MmLlHhVvCcSsQqTtA
394
394
  A: 7,
395
395
  Z: 0
396
396
  };
397
- function Ye(t) {
397
+ function ze(t) {
398
398
  const e = [];
399
- let n = 0, s = null;
400
- const r = () => {
399
+ let n = 0, r = null;
400
+ const s = () => {
401
401
  for (; n < t.length && /[\s,]/.test(t[n]); ) n++;
402
402
  };
403
- for (; n < t.length && (r(), !(n >= t.length)); ) {
403
+ for (; n < t.length && (s(), !(n >= t.length)); ) {
404
404
  const i = t[n];
405
- if (Oe.test(i)) {
406
- s = { type: i, args: [] }, e.push(s), n++;
405
+ if (Ue.test(i)) {
406
+ r = { type: i, args: [] }, e.push(r), n++;
407
407
  continue;
408
408
  }
409
- if (!s) break;
410
- const a = s.type === "A" || s.type === "a", o = s.args.length % 7;
409
+ if (!r) break;
410
+ const a = r.type === "A" || r.type === "a", o = r.args.length % 7;
411
411
  if (a && (o === 3 || o === 4)) {
412
412
  if (i !== "0" && i !== "1") break;
413
- s.args.push(i === "1" ? 1 : 0), n++;
413
+ r.args.push(i === "1" ? 1 : 0), n++;
414
414
  continue;
415
415
  }
416
- const c = Ne.exec(t.slice(n));
416
+ const c = Ve.exec(t.slice(n));
417
417
  if (!c) break;
418
- s.args.push(parseFloat(c[0])), n += c[0].length;
418
+ r.args.push(parseFloat(c[0])), n += c[0].length;
419
419
  }
420
420
  return e;
421
421
  }
422
- function Ue(t, e, n, s, r, i, a, o, c) {
422
+ function Be(t, e, n, r, s, i, a, o, c) {
423
423
  if (t === o && e === c) return [];
424
- let u = Math.abs(n), l = Math.abs(s);
424
+ let u = Math.abs(n), l = Math.abs(r);
425
425
  if (u === 0 || l === 0) return [[t, e, o, c, o, c]];
426
- const h = r * Math.PI / 180, p = Math.cos(h), f = Math.sin(h), M = (t - o) / 2, d = (e - c) / 2, g = p * M + f * d, y = -f * M + p * d, _ = g * g / (u * u) + y * y / (l * l);
427
- if (_ > 1) {
428
- const S = Math.sqrt(_);
429
- u *= S, l *= S;
430
- }
431
- const T = i === a ? -1 : 1, k = u * u * l * l - u * u * y * y - l * l * g * g, m = u * u * y * y + l * l * g * g, x = T * Math.sqrt(Math.max(0, k / m)), b = x * u * y / l, L = -x * l * g / u, Z = p * b - f * L + (t + o) / 2, v = f * b + p * L + (e + c) / 2, R = (S, $, D, H) => {
432
- const lt = S * D + $ * H, tt = Math.sqrt((S * S + $ * $) * (D * D + H * H)), j = Math.acos(Math.max(-1, Math.min(1, lt / tt)));
433
- return S * H - $ * D < 0 ? -j : j;
434
- }, w = R(1, 0, (g - b) / u, (y - L) / l);
435
- let P = R((g - b) / u, (y - L) / l, (-g - b) / u, (-y - L) / l);
436
- !a && P > 0 && (P -= 2 * Math.PI), a && P < 0 && (P += 2 * Math.PI);
437
- const X = Math.max(1, Math.ceil(Math.abs(P) / (Math.PI / 2))), ut = P / X, J = 4 / 3 * Math.tan(ut / 4), vt = (S) => {
438
- const $ = u * Math.cos(S), D = l * Math.sin(S);
439
- return [p * $ - f * D + Z, f * $ + p * D + v];
440
- }, St = (S) => {
441
- const $ = -u * Math.sin(S), D = l * Math.cos(S);
442
- return [p * $ - f * D, f * $ + p * D];
443
- }, At = [];
444
- for (let S = 0; S < X; S++) {
445
- const $ = w + S * ut, D = $ + ut, [H, lt] = vt($), [tt, j] = S === X - 1 ? [o, c] : vt(D), [le, he] = St($), [fe, pe] = St(D);
446
- At.push([H + J * le, lt + J * he, tt - J * fe, j - J * pe, tt, j]);
447
- }
448
- return At;
449
- }
450
- function N(t, e, n, s, r) {
451
- const i = 1 - r;
452
- return i * i * i * t + 3 * i * i * r * e + 3 * i * r * r * n + r * r * r * s;
453
- }
454
- function $t(t, e, n, s, r) {
455
- const i = 1 - r;
456
- return 3 * i * i * (e - t) + 6 * i * r * (n - e) + 3 * r * r * (s - n);
457
- }
458
- function K(t, e, n, s) {
426
+ const h = s * Math.PI / 180, p = Math.cos(h), f = Math.sin(h), _ = (t - o) / 2, d = (e - c) / 2, g = p * _ + f * d, M = -f * _ + p * d, b = g * g / (u * u) + M * M / (l * l);
427
+ if (b > 1) {
428
+ const P = Math.sqrt(b);
429
+ u *= P, l *= P;
430
+ }
431
+ const k = i === a ? -1 : 1, A = u * u * l * l - u * u * M * M - l * l * g * g, y = u * u * M * M + l * l * g * g, w = k * Math.sqrt(Math.max(0, A / y)), S = w * u * M / l, I = -w * l * g / u, m = p * S - f * I + (t + o) / 2, T = f * S + p * I + (e + c) / 2, x = (P, D, C, z) => {
432
+ const ht = P * C + D * z, et = Math.sqrt((P * P + D * D) * (C * C + z * z)), K = Math.acos(Math.max(-1, Math.min(1, ht / et)));
433
+ return P * z - D * C < 0 ? -K : K;
434
+ }, v = x(1, 0, (g - S) / u, (M - I) / l);
435
+ let $ = x((g - S) / u, (M - I) / l, (-g - S) / u, (-M - I) / l);
436
+ !a && $ > 0 && ($ -= 2 * Math.PI), a && $ < 0 && ($ += 2 * Math.PI);
437
+ const Y = Math.max(1, Math.ceil(Math.abs($) / (Math.PI / 2))), lt = $ / Y, tt = 4 / 3 * Math.tan(lt / 4), wt = (P) => {
438
+ const D = u * Math.cos(P), C = l * Math.sin(P);
439
+ return [p * D - f * C + m, f * D + p * C + T];
440
+ }, Pt = (P) => {
441
+ const D = -u * Math.sin(P), C = l * Math.cos(P);
442
+ return [p * D - f * C, f * D + p * C];
443
+ }, $t = [];
444
+ for (let P = 0; P < Y; P++) {
445
+ const D = v + P * lt, C = D + lt, [z, ht] = wt(D), [et, K] = P === Y - 1 ? [o, c] : wt(C), [de, ge] = Pt(D), [me, ye] = Pt(C);
446
+ $t.push([z + tt * de, ht + tt * ge, et - tt * me, K - tt * ye, et, K]);
447
+ }
448
+ return $t;
449
+ }
450
+ function X(t, e, n, r, s) {
451
+ const i = 1 - s;
452
+ return i * i * i * t + 3 * i * i * s * e + 3 * i * s * s * n + s * s * s * r;
453
+ }
454
+ function Ct(t, e, n, r, s) {
455
+ const i = 1 - s;
456
+ return 3 * i * i * (e - t) + 6 * i * s * (n - e) + 3 * s * s * (r - n);
457
+ }
458
+ function Q(t, e, n, r) {
459
459
  return {
460
460
  subpath: 0,
461
461
  type: "L",
462
- points: [n, s],
462
+ points: [n, r],
463
463
  startX: t,
464
464
  startY: e,
465
465
  endX: n,
466
- endY: s,
467
- length: Math.hypot(n - t, s - e)
466
+ endY: r,
467
+ length: Math.hypot(n - t, r - e)
468
468
  };
469
469
  }
470
- function nt(t, e, n) {
471
- const [s, r, i, a, o, c] = n, u = [0];
470
+ function rt(t, e, n) {
471
+ const [r, s, i, a, o, c] = n, u = [0];
472
472
  let l = t, h = e, p = 0;
473
- for (let f = 1; f <= Pt; f++) {
474
- const M = f / Pt, d = N(t, s, i, o, M), g = N(e, r, a, c, M);
473
+ for (let f = 1; f <= Dt; f++) {
474
+ const _ = f / Dt, d = X(t, r, i, o, _), g = X(e, s, a, c, _);
475
475
  p += Math.hypot(d - l, g - h), u.push(p), l = d, h = g;
476
476
  }
477
477
  return {
478
478
  subpath: 0,
479
479
  type: "C",
480
- points: [s, r, i, a, o, c],
480
+ points: [r, s, i, a, o, c],
481
481
  startX: t,
482
482
  startY: e,
483
483
  endX: o,
@@ -486,99 +486,99 @@ function nt(t, e, n) {
486
486
  lengths: u
487
487
  };
488
488
  }
489
- function q(t) {
490
- const e = z.get(t);
489
+ function W(t) {
490
+ const e = q.get(t);
491
491
  if (e) return e;
492
492
  const n = [];
493
- let s = 0, r = 0, i = 0, a = 0, o = null, c = null, u = -1;
493
+ let r = 0, s = 0, i = 0, a = 0, o = null, c = null, u = -1;
494
494
  const l = /* @__PURE__ */ new Set(), h = (d) => {
495
495
  u < 0 && (u = 0), d.subpath = u, n.push(d);
496
496
  };
497
- for (const { type: d, args: g } of Ye(t)) {
498
- const y = d.toUpperCase(), _ = d !== y, T = Xe[y];
499
- if (y === "Z") {
500
- (s !== i || r !== a) && h(K(s, r, i, a)), u >= 0 && l.add(u), s = i, r = a, o = c = null;
497
+ for (const { type: d, args: g } of ze(t)) {
498
+ const M = d.toUpperCase(), b = d !== M, k = He[M];
499
+ if (M === "Z") {
500
+ (r !== i || s !== a) && h(Q(r, s, i, a)), u >= 0 && l.add(u), r = i, s = a, o = c = null;
501
501
  continue;
502
502
  }
503
- for (let k = 0; k + T <= g.length; k += T) {
504
- const m = g.slice(k, k + T), x = _ ? s : 0, b = _ ? r : 0;
505
- let L = null, Z = null;
506
- switch (y) {
503
+ for (let A = 0; A + k <= g.length; A += k) {
504
+ const y = g.slice(A, A + k), w = b ? r : 0, S = b ? s : 0;
505
+ let I = null, m = null;
506
+ switch (M) {
507
507
  case "M":
508
- k === 0 ? (s = m[0] + x, r = m[1] + b, i = s, a = r, (u < 0 || n[n.length - 1]?.subpath === u) && u++) : (h(K(s, r, m[0] + x, m[1] + b)), s = m[0] + x, r = m[1] + b);
508
+ A === 0 ? (r = y[0] + w, s = y[1] + S, i = r, a = s, (u < 0 || n[n.length - 1]?.subpath === u) && u++) : (h(Q(r, s, y[0] + w, y[1] + S)), r = y[0] + w, s = y[1] + S);
509
509
  break;
510
510
  case "L":
511
- h(K(s, r, m[0] + x, m[1] + b)), s = m[0] + x, r = m[1] + b;
511
+ h(Q(r, s, y[0] + w, y[1] + S)), r = y[0] + w, s = y[1] + S;
512
512
  break;
513
513
  case "H":
514
- h(K(s, r, m[0] + x, r)), s = m[0] + x;
514
+ h(Q(r, s, y[0] + w, s)), r = y[0] + w;
515
515
  break;
516
516
  case "V":
517
- h(K(s, r, s, m[0] + b)), r = m[0] + b;
517
+ h(Q(r, s, r, y[0] + S)), s = y[0] + S;
518
518
  break;
519
519
  case "C": {
520
- const v = [m[0] + x, m[1] + b, m[2] + x, m[3] + b, m[4] + x, m[5] + b];
521
- h(nt(s, r, v)), L = [v[2], v[3]], s = v[4], r = v[5];
520
+ const T = [y[0] + w, y[1] + S, y[2] + w, y[3] + S, y[4] + w, y[5] + S];
521
+ h(rt(r, s, T)), I = [T[2], T[3]], r = T[4], s = T[5];
522
522
  break;
523
523
  }
524
524
  case "S": {
525
- const [v, R] = o ? [2 * s - o[0], 2 * r - o[1]] : [s, r], w = [v, R, m[0] + x, m[1] + b, m[2] + x, m[3] + b];
526
- h(nt(s, r, w)), L = [w[2], w[3]], s = w[4], r = w[5];
525
+ const [T, x] = o ? [2 * r - o[0], 2 * s - o[1]] : [r, s], v = [T, x, y[0] + w, y[1] + S, y[2] + w, y[3] + S];
526
+ h(rt(r, s, v)), I = [v[2], v[3]], r = v[4], s = v[5];
527
527
  break;
528
528
  }
529
529
  case "Q":
530
530
  case "T": {
531
- let v = s, R = r;
532
- y === "Q" ? (v = m[0] + x, R = m[1] + b) : c && (v = 2 * s - c[0], R = 2 * r - c[1]);
533
- const w = y === "Q" ? m[2] + x : m[0] + x, P = y === "Q" ? m[3] + b : m[1] + b;
531
+ let T = r, x = s;
532
+ M === "Q" ? (T = y[0] + w, x = y[1] + S) : c && (T = 2 * r - c[0], x = 2 * s - c[1]);
533
+ const v = M === "Q" ? y[2] + w : y[0] + w, $ = M === "Q" ? y[3] + S : y[1] + S;
534
534
  h(
535
- nt(s, r, [
536
- s + 2 / 3 * (v - s),
537
- r + 2 / 3 * (R - r),
538
- w + 2 / 3 * (v - w),
539
- P + 2 / 3 * (R - P),
540
- w,
541
- P
535
+ rt(r, s, [
536
+ r + 2 / 3 * (T - r),
537
+ s + 2 / 3 * (x - s),
538
+ v + 2 / 3 * (T - v),
539
+ $ + 2 / 3 * (x - $),
540
+ v,
541
+ $
542
542
  ])
543
- ), Z = [v, R], s = w, r = P;
543
+ ), m = [T, x], r = v, s = $;
544
544
  break;
545
545
  }
546
546
  case "A": {
547
- const v = m[5] + x, R = m[6] + b;
548
- let w = s, P = r;
549
- for (const X of Ue(s, r, m[0], m[1], m[2], m[3], m[4], v, R))
550
- h(nt(w, P, X)), w = X[4], P = X[5];
551
- s = v, r = R;
547
+ const T = y[5] + w, x = y[6] + S;
548
+ let v = r, $ = s;
549
+ for (const Y of Be(r, s, y[0], y[1], y[2], y[3], y[4], T, x))
550
+ h(rt(v, $, Y)), v = Y[4], $ = Y[5];
551
+ r = T, s = x;
552
552
  break;
553
553
  }
554
554
  }
555
- o = L, c = Z;
555
+ o = I, c = m;
556
556
  }
557
557
  }
558
558
  const p = n.reduce((d, g) => d + g.length, 0), f = [];
559
559
  for (let d = 0; d < n.length; ) {
560
560
  const g = n[d].subpath;
561
- let y = d, _ = 0;
562
- for (; y < n.length && n[y].subpath === g; ) _ += n[y++].length;
563
- const T = n[d], k = n[y - 1], m = l.has(g) || Math.abs(k.endX - T.startX) < 1e-9 && Math.abs(k.endY - T.startY) < 1e-9;
564
- f.push({ start: d, end: y, length: _, closed: m }), d = y;
561
+ let M = d, b = 0;
562
+ for (; M < n.length && n[M].subpath === g; ) b += n[M++].length;
563
+ const k = n[d], A = n[M - 1], y = l.has(g) || Math.abs(A.endX - k.startX) < 1e-9 && Math.abs(A.endY - k.startY) < 1e-9;
564
+ f.push({ start: d, end: M, length: b, closed: y }), d = M;
565
565
  }
566
- const M = { segments: n, totalLength: p, subpaths: f };
567
- return z.size >= Fe && z.delete(z.keys().next().value), z.set(t, M), M;
566
+ const _ = { segments: n, totalLength: p, subpaths: f };
567
+ return q.size >= Ye && q.delete(q.keys().next().value), q.set(t, _), _;
568
568
  }
569
- function Ve(t, e) {
569
+ function qe(t, e) {
570
570
  const n = t.lengths;
571
571
  if (e <= 0) return 0;
572
572
  if (e >= t.length) return 1;
573
- let s = 0, r = n.length - 1;
574
- for (; s < r - 1; ) {
575
- const o = s + r >> 1;
576
- n[o] < e ? s = o : r = o;
573
+ let r = 0, s = n.length - 1;
574
+ for (; r < s - 1; ) {
575
+ const o = r + s >> 1;
576
+ n[o] < e ? r = o : s = o;
577
577
  }
578
- const i = n[r] - n[s], a = i > 0 ? (e - n[s]) / i : 0;
579
- return (s + a) / (n.length - 1);
578
+ const i = n[s] - n[r], a = i > 0 ? (e - n[r]) / i : 0;
579
+ return (r + a) / (n.length - 1);
580
580
  }
581
- function He(t, e) {
581
+ function We(t, e) {
582
582
  if (t.type === "L") {
583
583
  const h = t.length > 0 ? Math.max(0, Math.min(1, e / t.length)) : 0;
584
584
  return {
@@ -587,263 +587,263 @@ function He(t, e) {
587
587
  angle: Math.atan2(t.endY - t.startY, t.endX - t.startX) * 180 / Math.PI
588
588
  };
589
589
  }
590
- const [n, s, r, i, a, o] = t.points, c = Ve(t, e);
591
- let u = $t(t.startX, n, r, a, c), l = $t(t.startY, s, i, o, c);
590
+ const [n, r, s, i, a, o] = t.points, c = qe(t, e);
591
+ let u = Ct(t.startX, n, s, a, c), l = Ct(t.startY, r, i, o, c);
592
592
  if (Math.hypot(u, l) < 1e-9) {
593
- const h = c < 0.5 ? Math.min(1, c + 1e-3) : Math.max(0, c - 1e-3), p = N(t.startX, n, r, a, h), f = N(t.startY, s, i, o, h), M = N(t.startX, n, r, a, c), d = N(t.startY, s, i, o, c);
594
- u = c < 0.5 ? p - M : M - p, l = c < 0.5 ? f - d : d - f;
593
+ const h = c < 0.5 ? Math.min(1, c + 1e-3) : Math.max(0, c - 1e-3), p = X(t.startX, n, s, a, h), f = X(t.startY, r, i, o, h), _ = X(t.startX, n, s, a, c), d = X(t.startY, r, i, o, c);
594
+ u = c < 0.5 ? p - _ : _ - p, l = c < 0.5 ? f - d : d - f;
595
595
  }
596
596
  return {
597
- x: N(t.startX, n, r, a, c),
598
- y: N(t.startY, s, i, o, c),
597
+ x: X(t.startX, n, s, a, c),
598
+ y: X(t.startY, r, i, o, c),
599
599
  angle: Math.atan2(l, u) * 180 / Math.PI
600
600
  };
601
601
  }
602
- function Bt(t, e, n = 0, s = t.length) {
603
- if (s <= n) return { x: 0, y: 0, angle: 0 };
604
- let r = 0;
605
- for (let i = n; i < s; i++) {
602
+ function te(t, e, n = 0, r = t.length) {
603
+ if (r <= n) return { x: 0, y: 0, angle: 0 };
604
+ let s = 0;
605
+ for (let i = n; i < r; i++) {
606
606
  const a = t[i];
607
- if (r + a.length >= e || i === s - 1)
608
- return He(a, e - r);
609
- r += a.length;
607
+ if (s + a.length >= e || i === r - 1)
608
+ return We(a, e - s);
609
+ s += a.length;
610
610
  }
611
611
  return { x: 0, y: 0, angle: 0 };
612
612
  }
613
- function ze(t, e) {
614
- const { segments: n, totalLength: s } = q(t);
615
- return Bt(n, Math.max(0, Math.min(1, e)) * s);
613
+ function je(t, e) {
614
+ const { segments: n, totalLength: r } = W(t);
615
+ return te(n, Math.max(0, Math.min(1, e)) * r);
616
616
  }
617
- function qn() {
618
- z.clear();
617
+ function Kn() {
618
+ q.clear();
619
619
  }
620
- function Wn(t) {
621
- return q(t).totalLength;
620
+ function Qn(t) {
621
+ return W(t).totalLength;
622
622
  }
623
- const qe = 24, We = 320, je = 2.5, Q = 72, jn = 64, Ke = 0.2, Qe = 128, B = /* @__PURE__ */ new Map();
624
- let st = 0, O;
625
- const Rt = (t) => Math.round(t * 100) / 100;
626
- function Dt(t, e) {
627
- const { segments: n, subpaths: s, totalLength: r } = q(t);
623
+ const Ke = 24, Qe = 320, Ge = 2.5, G = 72, Gn = 64, Ze = 0.2, Je = 128, J = /* @__PURE__ */ new Map();
624
+ let st = 0, N;
625
+ const It = (t) => Math.round(t * 100) / 100;
626
+ function Et(t, e) {
627
+ const { segments: n, subpaths: r, totalLength: s } = W(t);
628
628
  if (n.length === 0) return [];
629
629
  if (e) {
630
- const i = s.every((a) => a.closed);
631
- return [{ segments: n, start: 0, end: n.length, length: r, closed: i }];
630
+ const i = r.every((a) => a.closed);
631
+ return [{ segments: n, start: 0, end: n.length, length: s, closed: i }];
632
632
  }
633
- return s.filter((i) => i.length > 0).map((i) => ({ segments: n, start: i.start, end: i.end, length: i.length, closed: i.closed }));
633
+ return r.filter((i) => i.length > 0).map((i) => ({ segments: n, start: i.start, end: i.end, length: i.length, closed: i.closed }));
634
634
  }
635
- function bt(t, e) {
636
- const n = t.closed ? (e % 1 + 1) % 1 : Math.max(0, Math.min(1, e)), s = Bt(t.segments, n * t.length, t.start, t.end);
637
- return [s.x, s.y];
635
+ function xt(t, e) {
636
+ const n = t.closed ? (e % 1 + 1) % 1 : Math.max(0, Math.min(1, e)), r = te(t.segments, n * t.length, t.start, t.end);
637
+ return [r.x, r.y];
638
638
  }
639
- function Ct(t) {
639
+ function Lt(t) {
640
640
  const e = [];
641
641
  let n = 0;
642
- for (let s = t.start; s < t.end; s++)
643
- n += t.segments[s].length, t.length > 0 && e.push(n / t.length);
642
+ for (let r = t.start; r < t.end; r++)
643
+ n += t.segments[r].length, t.length > 0 && e.push(n / t.length);
644
644
  return e;
645
645
  }
646
- function It(t, e) {
646
+ function Ft(t, e) {
647
647
  const n = [];
648
- for (let s = 0; s < e; s++)
649
- n.push(bt(t, t.closed ? s / e : s / (e - 1)));
648
+ for (let r = 0; r < e; r++)
649
+ n.push(xt(t, t.closed ? r / e : r / (e - 1)));
650
650
  return n;
651
651
  }
652
- function Et(t) {
652
+ function Ot(t) {
653
653
  let e = 0, n = 0;
654
- for (const [s, r] of t)
655
- e += s, n += r;
656
- return e /= t.length, n /= t.length, t.map(([s, r]) => [s - e, r - n]);
654
+ for (const [r, s] of t)
655
+ e += r, n += s;
656
+ return e /= t.length, n /= t.length, t.map(([r, s]) => [r - e, s - n]);
657
657
  }
658
- function Ge(t, e, n) {
659
- const s = t.closed && e.closed;
658
+ function tn(t, e, n) {
659
+ const r = t.closed && e.closed;
660
660
  if (n !== void 0)
661
- return { offset: s ? Math.abs(n) % Q / Q : 0, reversed: n < 0 };
662
- const r = Et(It(t, Q)), i = Et(It(e, Q)), a = Q;
661
+ return { offset: r ? Math.abs(n) % G / G : 0, reversed: n < 0 };
662
+ const s = Ot(Ft(t, G)), i = Ot(Ft(e, G)), a = G;
663
663
  let o = { offset: 0, reversed: !1 }, c = 1 / 0;
664
664
  for (const u of [!1, !0]) {
665
- const l = s ? a : 1;
665
+ const l = r ? a : 1;
666
666
  for (let h = 0; h < l; h++) {
667
667
  let p = 0;
668
668
  for (let f = 0; f < a && p < c; f++) {
669
- const M = s ? u ? (h - f + a) % a : (f + h) % a : u ? a - 1 - f : f, d = r[f][0] - i[M][0], g = r[f][1] - i[M][1];
669
+ const _ = r ? u ? (h - f + a) % a : (f + h) % a : u ? a - 1 - f : f, d = s[f][0] - i[_][0], g = s[f][1] - i[_][1];
670
670
  p += d * d + g * g;
671
671
  }
672
- p < c && (c = p, o = { offset: s ? h / a : 0, reversed: u });
672
+ p < c && (c = p, o = { offset: r ? h / a : 0, reversed: u });
673
673
  }
674
674
  }
675
675
  return o;
676
676
  }
677
- function Be(t, e, n) {
677
+ function en(t, e, n) {
678
678
  return n ? ((e.reversed ? e.offset - t : t + e.offset) % 1 + 1) % 1 : e.reversed ? 1 - t : t;
679
679
  }
680
- function Ze(t, e, n) {
680
+ function nn(t, e, n) {
681
681
  return n ? ((e.reversed ? e.offset - t : t - e.offset) % 1 + 1) % 1 : e.reversed ? 1 - t : t;
682
682
  }
683
- function Je(t, e, n) {
684
- const s = t.closed && e.closed, r = Ge(t, e, n.shapeIndex), i = Math.max(
685
- qe,
686
- Math.min(We, Math.ceil(Math.max(t.length, e.length) / je))
683
+ function rn(t, e, n) {
684
+ const r = t.closed && e.closed, s = tn(t, e, n.shapeIndex), i = Math.max(
685
+ Ke,
686
+ Math.min(Qe, Math.ceil(Math.max(t.length, e.length) / Ge))
687
687
  ), a = /* @__PURE__ */ new Set(), o = (h) => a.add(Math.round(h * 1e7) / 1e7);
688
688
  for (let h = 0; h <= i; h++) o(h / i);
689
- for (const h of Ct(t)) o(h);
690
- for (const h of Ct(e)) o(Ze(h, r, s));
689
+ for (const h of Lt(t)) o(h);
690
+ for (const h of Lt(e)) o(nn(h, s, r));
691
691
  let c = [...a].sort((h, p) => h - p);
692
- s && (c = c.filter((h) => h < 1));
692
+ r && (c = c.filter((h) => h < 1));
693
693
  const u = [], l = [];
694
694
  for (const h of c)
695
- u.push(...bt(t, h)), l.push(...bt(e, Be(h, r, s)));
696
- return tn({ from: u, to: l, closed: s });
695
+ u.push(...xt(t, h)), l.push(...xt(e, en(h, s, r)));
696
+ return sn({ from: u, to: l, closed: r });
697
697
  }
698
- function tn(t) {
698
+ function sn(t) {
699
699
  const e = t.from.length / 2;
700
700
  if (e <= 3) return t;
701
701
  const n = new Uint8Array(e);
702
702
  n[0] = 1, n[e - 1] = 1;
703
- const s = [[0, e - 1]];
704
- for (; s.length > 0; ) {
705
- const [a, o] = s.pop();
706
- let c = -1, u = Ke;
703
+ const r = [[0, e - 1]];
704
+ for (; r.length > 0; ) {
705
+ const [a, o] = r.pop();
706
+ let c = -1, u = Ze;
707
707
  for (let l = a + 1; l < o; l++) {
708
- const h = Math.max(Lt(t.from, a, o, l), Lt(t.to, a, o, l));
708
+ const h = Math.max(Nt(t.from, a, o, l), Nt(t.to, a, o, l));
709
709
  h > u && (u = h, c = l);
710
710
  }
711
- c !== -1 && (n[c] = 1, s.push([a, c], [c, o]));
711
+ c !== -1 && (n[c] = 1, r.push([a, c], [c, o]));
712
712
  }
713
- const r = [], i = [];
713
+ const s = [], i = [];
714
714
  for (let a = 0; a < e; a++)
715
- n[a] && (r.push(t.from[a * 2], t.from[a * 2 + 1]), i.push(t.to[a * 2], t.to[a * 2 + 1]));
716
- return { from: r, to: i, closed: t.closed };
715
+ n[a] && (s.push(t.from[a * 2], t.from[a * 2 + 1]), i.push(t.to[a * 2], t.to[a * 2 + 1]));
716
+ return { from: s, to: i, closed: t.closed };
717
717
  }
718
- function Lt(t, e, n, s) {
719
- const r = t[e * 2], i = t[e * 2 + 1], a = t[n * 2] - r, o = t[n * 2 + 1] - i, c = t[s * 2] - r, u = t[s * 2 + 1] - i, l = a * a + o * o, h = l === 0 ? 0 : Math.max(0, Math.min(1, (c * a + u * o) / l));
718
+ function Nt(t, e, n, r) {
719
+ const s = t[e * 2], i = t[e * 2 + 1], a = t[n * 2] - s, o = t[n * 2 + 1] - i, c = t[r * 2] - s, u = t[r * 2 + 1] - i, l = a * a + o * o, h = l === 0 ? 0 : Math.max(0, Math.min(1, (c * a + u * o) / l));
720
720
  return Math.hypot(c - h * a, u - h * o);
721
721
  }
722
- function en(t, e, n) {
723
- const s = n.shapeIndex;
724
- if (O && O.from === t && O.to === e && O.shapeIndex === s) return O.plan;
725
- const i = B.get(String(s ?? "auto"))?.get(t)?.get(e);
722
+ function an(t, e, n) {
723
+ const r = n.shapeIndex;
724
+ if (N && N.from === t && N.to === e && N.shapeIndex === r) return N.plan;
725
+ const i = J.get(String(r ?? "auto"))?.get(t)?.get(e);
726
726
  if (i)
727
- return O = { from: t, to: e, shapeIndex: s, plan: i }, i;
728
- const a = q(t).subpaths.filter((f) => f.length > 0).length === q(e).subpaths.filter((f) => f.length > 0).length, o = Dt(t, !a), c = Dt(e, !a), u = {
729
- pairs: o.map((f, M) => Je(f, c[M], n))
727
+ return N = { from: t, to: e, shapeIndex: r, plan: i }, i;
728
+ const a = W(t).subpaths.filter((f) => f.length > 0).length === W(e).subpaths.filter((f) => f.length > 0).length, o = Et(t, !a), c = Et(e, !a), u = {
729
+ pairs: o.map((f, _) => rn(f, c[_], n))
730
730
  };
731
- st >= Qe && (B.clear(), st = 0);
732
- const l = String(s ?? "auto"), h = B.get(l) ?? /* @__PURE__ */ new Map();
733
- B.set(l, h);
731
+ st >= Je && (J.clear(), st = 0);
732
+ const l = String(r ?? "auto"), h = J.get(l) ?? /* @__PURE__ */ new Map();
733
+ J.set(l, h);
734
734
  const p = h.get(t) ?? /* @__PURE__ */ new Map();
735
- return h.set(t, p), p.set(e, u), st++, O = { from: t, to: e, shapeIndex: s, plan: u }, u;
735
+ return h.set(t, p), p.set(e, u), st++, N = { from: t, to: e, shapeIndex: r, plan: u }, u;
736
736
  }
737
- function nn(t, e, n, s = {}) {
737
+ function on(t, e, n, r = {}) {
738
738
  if (!t) return e;
739
739
  if (!e) return t;
740
- const r = Math.max(0, Math.min(1, n));
741
- if (r === 0) return t;
742
- if (r === 1) return e;
743
- const i = en(t, e, s);
744
- if (i.pairs.length === 0) return r < 0.5 ? t : e;
740
+ const s = Math.max(0, Math.min(1, n));
741
+ if (s === 0) return t;
742
+ if (s === 1) return e;
743
+ const i = an(t, e, r);
744
+ if (i.pairs.length === 0) return s < 0.5 ? t : e;
745
745
  let a = "";
746
746
  for (const o of i.pairs) {
747
747
  for (let c = 0; c < o.from.length; c += 2) {
748
- const u = Rt(o.from[c] + (o.to[c] - o.from[c]) * r), l = Rt(o.from[c + 1] + (o.to[c + 1] - o.from[c + 1]) * r);
748
+ const u = It(o.from[c] + (o.to[c] - o.from[c]) * s), l = It(o.from[c + 1] + (o.to[c + 1] - o.from[c + 1]) * s);
749
749
  a += `${c === 0 ? a ? " M" : "M" : " L"}${u} ${l}`;
750
750
  }
751
751
  o.closed && (a += " Z");
752
752
  }
753
753
  return a;
754
754
  }
755
- function Kn() {
756
- B.clear(), st = 0, O = void 0;
755
+ function Zn() {
756
+ J.clear(), st = 0, N = void 0;
757
757
  }
758
- function sn(t) {
758
+ function cn(t) {
759
759
  return /^\s*[Mm]\s*[-+]?(?:\d|\.\d)/.test(t);
760
760
  }
761
- const F = (t, e, n) => t + (e - t) * n, Zt = 512, ft = /* @__PURE__ */ new Map(), pt = /* @__PURE__ */ new Map();
762
- function Ft(t) {
763
- const e = ft.get(t);
761
+ const O = (t, e, n) => t + (e - t) * n, ee = 512, pt = /* @__PURE__ */ new Map(), dt = /* @__PURE__ */ new Map();
762
+ function Xt(t) {
763
+ const e = pt.get(t);
764
764
  if (e) return e;
765
- const n = t.replace("#", ""), s = [
765
+ const n = t.replace("#", ""), r = [
766
766
  parseInt(n.slice(0, 2), 16),
767
767
  parseInt(n.slice(2, 4), 16),
768
768
  parseInt(n.slice(4, 6), 16)
769
769
  ];
770
- return ft.size < Zt && ft.set(t, s), s;
770
+ return pt.size < ee && pt.set(t, r), r;
771
771
  }
772
- const Ot = (t) => t.charCodeAt(0) === 35, Nt = (t) => t.startsWith("rgb"), Xt = (t) => t.startsWith("rgba"), rn = /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/, dt = (t) => Math.round(t).toString(16).padStart(2, "0");
773
- function an(t, e, n) {
774
- return `#${dt(t)}${dt(e)}${dt(n)}`;
772
+ const Yt = (t) => t.charCodeAt(0) === 35, Ut = (t) => t.startsWith("rgb"), Vt = (t) => t.startsWith("rgba"), un = /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/, gt = (t) => Math.round(t).toString(16).padStart(2, "0");
773
+ function ln(t, e, n) {
774
+ return `#${gt(t)}${gt(e)}${gt(n)}`;
775
775
  }
776
- function Yt(t) {
777
- const e = pt.get(t);
776
+ function Ht(t) {
777
+ const e = dt.get(t);
778
778
  if (e) return e;
779
- const n = t.match(rn);
779
+ const n = t.match(un);
780
780
  if (!n)
781
781
  throw new Error(`Invalid rgb color: ${t}`);
782
- const s = parseInt(n[1], 10), r = parseInt(n[2], 10), i = parseInt(n[3], 10), a = n[4] !== void 0 ? [s, r, i, parseFloat(n[4])] : [s, r, i];
783
- return pt.size < Zt && pt.set(t, a), a;
784
- }
785
- const on = (t, e, n) => {
786
- if (Ot(t) && Ot(e)) {
787
- const [s, r, i] = Ft(t), [a, o, c] = Ft(e), u = F(s, a, n), l = F(r, o, n), h = F(i, c, n);
788
- return an(u, l, h);
789
- }
790
- if ((Nt(t) || Xt(t)) && (Nt(e) || Xt(e))) {
791
- const s = Yt(t), r = Yt(e), i = Math.round(F(s[0], r[0], n)), a = Math.round(F(s[1], r[1], n)), o = Math.round(F(s[2], r[2], n));
792
- if (s.length === 4 || r.length === 4) {
793
- const c = s[3] ?? 1, u = r[3] ?? 1, l = F(c, u, n);
782
+ const r = parseInt(n[1], 10), s = parseInt(n[2], 10), i = parseInt(n[3], 10), a = n[4] !== void 0 ? [r, s, i, parseFloat(n[4])] : [r, s, i];
783
+ return dt.size < ee && dt.set(t, a), a;
784
+ }
785
+ const hn = (t, e, n) => {
786
+ if (Yt(t) && Yt(e)) {
787
+ const [r, s, i] = Xt(t), [a, o, c] = Xt(e), u = O(r, a, n), l = O(s, o, n), h = O(i, c, n);
788
+ return ln(u, l, h);
789
+ }
790
+ if ((Ut(t) || Vt(t)) && (Ut(e) || Vt(e))) {
791
+ const r = Ht(t), s = Ht(e), i = Math.round(O(r[0], s[0], n)), a = Math.round(O(r[1], s[1], n)), o = Math.round(O(r[2], s[2], n));
792
+ if (r.length === 4 || s.length === 4) {
793
+ const c = r[3] ?? 1, u = s[3] ?? 1, l = O(c, u, n);
794
794
  return `rgba(${i}, ${a}, ${o}, ${l})`;
795
795
  }
796
796
  return `rgb(${i}, ${a}, ${o})`;
797
797
  }
798
798
  return n < 1 ? t : e;
799
- }, cn = (t, e, n) => {
800
- const s = Math.min(t.length, e.length), r = [];
801
- for (let i = 0; i < s; i++)
802
- r.push(F(t[i], e[i], n));
803
- return r;
804
- }, Ut = (t, e, n) => n < 1 ? t : e, un = (t, e, n) => nn(t, e, n);
805
- function Jt(t) {
806
- return typeof t == "number" ? F : Array.isArray(t) ? cn : typeof t == "string" ? t.startsWith("#") || t.startsWith("rgb") ? on : sn(t) ? un : Ut : Ut;
799
+ }, fn = (t, e, n) => {
800
+ const r = Math.min(t.length, e.length), s = [];
801
+ for (let i = 0; i < r; i++)
802
+ s.push(O(t[i], e[i], n));
803
+ return s;
804
+ }, zt = (t, e, n) => n < 1 ? t : e, pn = (t, e, n) => on(t, e, n);
805
+ function ne(t) {
806
+ return typeof t == "number" ? O : Array.isArray(t) ? fn : typeof t == "string" ? t.startsWith("#") || t.startsWith("rgb") ? hn : cn(t) ? pn : zt : zt;
807
807
  }
808
- const te = 1e3 / 60;
809
- function ee(t, e = {}) {
810
- if (!V(t))
808
+ const re = 1e3 / 60;
809
+ function se(t, e = {}) {
810
+ if (!H(t))
811
811
  throw new Error(`bakeSpringTrack: track "${t.id}" is not a spring track`);
812
- const n = new it(t.spring);
813
- return se(t, (s) => n.valueAt(s), n.settleTime(), t.spring.from, t.spring.to, e);
812
+ const n = new at(t.spring);
813
+ return ae(t, (r) => n.valueAt(r), n.settleTime(), t.spring.from, t.spring.to, e);
814
814
  }
815
- function ne(t, e = {}) {
816
- if (!U(t))
815
+ function ie(t, e = {}) {
816
+ if (!V(t))
817
817
  throw new Error(`bakeInertiaTrack: track "${t.id}" is not an inertia track`);
818
818
  const n = t.inertia;
819
- return se(
819
+ return ae(
820
820
  t,
821
- (s) => Mt(n, s),
822
- ct(n),
821
+ (r) => bt(n, r),
822
+ ut(n),
823
823
  n.from,
824
- ot(n),
824
+ ct(n),
825
825
  e
826
826
  );
827
827
  }
828
- function se(t, e, n, s, r, i) {
829
- const a = i.intervalMs ?? te, o = i.tolerance ?? 0.01, c = t.delay ?? 0, u = [];
828
+ function ae(t, e, n, r, s, i) {
829
+ const a = i.intervalMs ?? re, o = i.tolerance ?? 0.01, c = t.delay ?? 0, u = [];
830
830
  for (let h = 0; h <= n; h += a)
831
831
  u.push({ time: h + c, value: e(h), easing: "linear" });
832
832
  const l = u[u.length - 1];
833
- return !l || l.time < n + c ? u.push({ time: n + c, value: r, easing: "linear" }) : l.value = r, c > 0 && u.unshift({ time: 0, value: s, easing: "linear" }), {
833
+ return !l || l.time < n + c ? u.push({ time: n + c, value: s, easing: "linear" }) : l.value = s, c > 0 && u.unshift({ time: 0, value: r, easing: "linear" }), {
834
834
  id: t.id,
835
835
  target: t.target,
836
836
  property: t.property,
837
- keyframes: o > 0 ? fn(u, o) : u,
837
+ keyframes: o > 0 ? mn(u, o) : u,
838
838
  ...t.targets && { targets: [...t.targets] },
839
839
  ...t.stagger && { stagger: { ...t.stagger } }
840
840
  };
841
841
  }
842
- function ln(t, e, n, s = {}) {
843
- const r = s.intervalMs ?? te, i = typeof n == "function" ? n : Gt(n), a = Jt(t.value), o = e.time - t.time;
842
+ function dn(t, e, n, r = {}) {
843
+ const s = r.intervalMs ?? re, i = typeof n == "function" ? n : Jt(n), a = ne(t.value), o = e.time - t.time;
844
844
  if (o <= 0) return [e];
845
845
  const c = [];
846
- for (let l = r; l < o; l += r) {
846
+ for (let l = s; l < o; l += s) {
847
847
  const h = l / o;
848
848
  c.push({
849
849
  time: t.time + l,
@@ -854,55 +854,55 @@ function ln(t, e, n, s = {}) {
854
854
  const u = i(1);
855
855
  return c.push({ ...e, ...u !== 1 && { value: a(t.value, e.value, u) }, easing: "linear" }), c;
856
856
  }
857
- function Qn(t, e) {
858
- return V(t) ? ee(t, e) : U(t) ? ne(t, e) : t;
857
+ function Jn(t, e) {
858
+ return H(t) ? se(t, e) : V(t) ? ie(t, e) : t;
859
859
  }
860
- function hn(t, e = {}) {
860
+ function gn(t, e = {}) {
861
861
  const n = t.keyframes;
862
- if (!n.some((r) => _t(r.easing))) return t;
863
- const s = n.length > 0 ? [n[0]] : [];
864
- for (let r = 1; r < n.length; r++) {
865
- const i = n[r];
866
- _t(i.easing) ? s.push(...ln(n[r - 1], i, i.easing, e)) : s.push(i);
867
- }
868
- return { ...t, keyframes: s };
869
- }
870
- function Gn(t, e) {
871
- return t.filter(ge).map((n) => hn(n, e)).concat(
872
- t.filter(V).map((n) => ee(n, e)),
873
- t.filter(U).map((n) => ne(n, e))
862
+ if (!n.some((s) => Mt(s.easing))) return t;
863
+ const r = n.length > 0 ? [n[0]] : [];
864
+ for (let s = 1; s < n.length; s++) {
865
+ const i = n[s];
866
+ Mt(i.easing) ? r.push(...dn(n[s - 1], i, i.easing, e)) : r.push(i);
867
+ }
868
+ return { ...t, keyframes: r };
869
+ }
870
+ function tr(t, e) {
871
+ return t.filter(Me).map((n) => gn(n, e)).concat(
872
+ t.filter(H).map((n) => se(n, e)),
873
+ t.filter(V).map((n) => ie(n, e))
874
874
  );
875
875
  }
876
- function fn(t, e) {
876
+ function mn(t, e) {
877
877
  if (t.length <= 2) return t;
878
878
  const n = [t[0]];
879
- for (let s = 1; s < t.length - 1; s++) {
880
- const r = n[n.length - 1], i = t[s], a = t[s + 1], o = a.time - r.time;
879
+ for (let r = 1; r < t.length - 1; r++) {
880
+ const s = n[n.length - 1], i = t[r], a = t[r + 1], o = a.time - s.time;
881
881
  if (o <= 0) continue;
882
- const c = (i.time - r.time) / o, u = r.value + (a.value - r.value) * c;
882
+ const c = (i.time - s.time) / o, u = s.value + (a.value - s.value) * c;
883
883
  Math.abs(i.value - u) > e && n.push(i);
884
884
  }
885
885
  return n.push(t[t.length - 1]), n;
886
886
  }
887
- function pn(t) {
888
- const e = [...t.keyframes].sort((n, s) => n.time - s.time);
887
+ function yn(t) {
888
+ const e = [...t.keyframes].sort((n, r) => n.time - r.time);
889
889
  return {
890
890
  ...t,
891
891
  keyframes: e
892
892
  };
893
893
  }
894
- function Y(t) {
894
+ function U(t) {
895
895
  return t.targets && t.targets.length > 0 ? t.targets : [t.target];
896
896
  }
897
- function W(t, e, n, s) {
898
- const r = n ?? 0;
899
- return !s || e <= 1 ? r : r + qt(t, e, s);
897
+ function j(t, e, n, r) {
898
+ const s = n ?? 0;
899
+ return !r || e <= 1 ? s : s + jt(t, e, r);
900
900
  }
901
- class gt {
901
+ class mt {
902
902
  track;
903
903
  targets;
904
904
  constructor(e) {
905
- this.track = e, this.targets = Y(e);
905
+ this.track = e, this.targets = U(e);
906
906
  }
907
907
  /**
908
908
  * Get the interpolated value at a specific time.
@@ -911,7 +911,7 @@ class gt {
911
911
  * that need every target should use `getTargetValues`.
912
912
  */
913
913
  getValueAtTime(e) {
914
- return this.valueForOffset(e - W(0, this.targets.length, this.track.delay, this.track.stagger));
914
+ return this.valueForOffset(e - j(0, this.targets.length, this.track.delay, this.track.stagger));
915
915
  }
916
916
  /**
917
917
  * Every target's value at a specific time, in target order.
@@ -920,12 +920,12 @@ class gt {
920
920
  * each sampled at its own offset time.
921
921
  */
922
922
  getTargetValues(e) {
923
- const n = this.targets.length, s = [];
924
- for (let r = 0; r < n; r++) {
925
- const i = W(r, n, this.track.delay, this.track.stagger), a = this.valueForOffset(e - i);
926
- a !== void 0 && s.push({ target: this.targets[r], value: a, start: i + this.track.keyframes[0].time });
923
+ const n = this.targets.length, r = [];
924
+ for (let s = 0; s < n; s++) {
925
+ const i = j(s, n, this.track.delay, this.track.stagger), a = this.valueForOffset(e - i);
926
+ a !== void 0 && r.push({ target: this.targets[s], value: a, start: i + this.track.keyframes[0].time });
927
927
  }
928
- return s;
928
+ return r;
929
929
  }
930
930
  /**
931
931
  * Get the duration of this track — the last keyframe, plus any delay, the
@@ -935,8 +935,8 @@ class gt {
935
935
  const { keyframes: e } = this.track;
936
936
  if (e.length === 0)
937
937
  return 0;
938
- const n = e[e.length - 1].time, s = this.track.stagger ? xt(this.targets.length, this.track.stagger) : 0;
939
- return n + (this.track.delay ?? 0) + s + (this.track.endDelay ?? 0);
938
+ const n = e[e.length - 1].time, r = this.track.stagger ? vt(this.targets.length, this.track.stagger) : 0;
939
+ return n + (this.track.delay ?? 0) + r + (this.track.endDelay ?? 0);
940
940
  }
941
941
  /**
942
942
  * Get the track metadata.
@@ -953,126 +953,126 @@ class gt {
953
953
  return n[0].value;
954
954
  if (e >= n[n.length - 1].time)
955
955
  return n[n.length - 1].value;
956
- const { from: s, to: r } = this.findSurroundingKeyframes(e);
957
- if (!s || !r)
956
+ const { from: r, to: s } = this.findSurroundingKeyframes(e);
957
+ if (!r || !s)
958
958
  return;
959
- if (s.time === e)
960
- return s.value;
961
- const i = r.time - s.time, a = (e - s.time) / i, c = Gt(r.easing)(a);
962
- return Jt(s.value)(s.value, r.value, c);
959
+ if (r.time === e)
960
+ return r.value;
961
+ const i = s.time - r.time, a = (e - r.time) / i, c = Jt(s.easing)(a);
962
+ return ne(r.value)(r.value, s.value, c);
963
963
  }
964
964
  /**
965
965
  * Find the keyframes surrounding a given time.
966
966
  */
967
967
  findSurroundingKeyframes(e) {
968
968
  const { keyframes: n } = this.track;
969
- for (let s = 0; s < n.length - 1; s++)
970
- if (e >= n[s].time && e <= n[s + 1].time)
971
- return { from: n[s], to: n[s + 1] };
969
+ for (let r = 0; r < n.length - 1; r++)
970
+ if (e >= n[r].time && e <= n[r + 1].time)
971
+ return { from: n[r], to: n[r + 1] };
972
972
  return { from: null, to: null };
973
973
  }
974
974
  }
975
- class dn {
975
+ class _n {
976
976
  track;
977
977
  targets;
978
978
  sampler;
979
979
  constructor(e) {
980
- this.track = e, this.targets = Y(e), this.sampler = new it(e.spring);
980
+ this.track = e, this.targets = U(e), this.sampler = new at(e.spring);
981
981
  }
982
982
  getValueAtTime(e) {
983
- return this.sampler.valueAt(e - W(0, this.targets.length, this.track.delay, this.track.stagger));
983
+ return this.sampler.valueAt(e - j(0, this.targets.length, this.track.delay, this.track.stagger));
984
984
  }
985
985
  getTargetValues(e) {
986
- const n = this.targets.length, s = [];
987
- for (let r = 0; r < n; r++) {
988
- const i = W(r, n, this.track.delay, this.track.stagger);
989
- s.push({ target: this.targets[r], value: this.sampler.valueAt(e - i), start: i });
986
+ const n = this.targets.length, r = [];
987
+ for (let s = 0; s < n; s++) {
988
+ const i = j(s, n, this.track.delay, this.track.stagger);
989
+ r.push({ target: this.targets[s], value: this.sampler.valueAt(e - i), start: i });
990
990
  }
991
- return s;
991
+ return r;
992
992
  }
993
993
  /** Settle time plus delay and the widest stagger offset. */
994
994
  getDuration() {
995
- const e = this.track.stagger ? xt(this.targets.length, this.track.stagger) : 0;
995
+ const e = this.track.stagger ? vt(this.targets.length, this.track.stagger) : 0;
996
996
  return this.sampler.settleTime() + (this.track.delay ?? 0) + e;
997
997
  }
998
998
  getTrack() {
999
999
  return this.track;
1000
1000
  }
1001
1001
  }
1002
- class gn {
1002
+ class Mn {
1003
1003
  track;
1004
1004
  targets;
1005
1005
  duration;
1006
1006
  constructor(e) {
1007
- this.track = e, this.targets = Y(e), this.duration = ct(e.inertia);
1007
+ this.track = e, this.targets = U(e), this.duration = ut(e.inertia);
1008
1008
  }
1009
1009
  getValueAtTime(e) {
1010
- return Mt(this.track.inertia, e - W(0, this.targets.length, this.track.delay, this.track.stagger));
1010
+ return bt(this.track.inertia, e - j(0, this.targets.length, this.track.delay, this.track.stagger));
1011
1011
  }
1012
1012
  getTargetValues(e) {
1013
- const n = this.targets.length, s = [];
1014
- for (let r = 0; r < n; r++) {
1015
- const i = W(r, n, this.track.delay, this.track.stagger);
1016
- s.push({ target: this.targets[r], value: Mt(this.track.inertia, e - i), start: i });
1013
+ const n = this.targets.length, r = [];
1014
+ for (let s = 0; s < n; s++) {
1015
+ const i = j(s, n, this.track.delay, this.track.stagger);
1016
+ r.push({ target: this.targets[s], value: bt(this.track.inertia, e - i), start: i });
1017
1017
  }
1018
- return s;
1018
+ return r;
1019
1019
  }
1020
1020
  /** Settle time plus delay and the widest stagger offset. */
1021
1021
  getDuration() {
1022
- const e = this.track.stagger ? xt(this.targets.length, this.track.stagger) : 0;
1022
+ const e = this.track.stagger ? vt(this.targets.length, this.track.stagger) : 0;
1023
1023
  return this.duration + (this.track.delay ?? 0) + e;
1024
1024
  }
1025
1025
  getTrack() {
1026
1026
  return this.track;
1027
1027
  }
1028
1028
  }
1029
- function re(t, e) {
1030
- const n = { ...ze(t.pathData, e) };
1029
+ function oe(t, e) {
1030
+ const n = { ...je(t.pathData, e) };
1031
1031
  if (t.matrix) {
1032
- const [s, r, i, a, o, c] = t.matrix, { x: u, y: l } = n;
1033
- n.x = s * u + i * l + o, n.y = r * u + a * l + c;
1032
+ const [r, s, i, a, o, c] = t.matrix, { x: u, y: l } = n;
1033
+ n.x = r * u + i * l + o, n.y = s * u + a * l + c;
1034
1034
  const h = n.angle * Math.PI / 180, p = Math.cos(h), f = Math.sin(h);
1035
- n.angle = Math.atan2(r * p + a * f, s * p + i * f) * 180 / Math.PI;
1035
+ n.angle = Math.atan2(s * p + a * f, r * p + i * f) * 180 / Math.PI;
1036
1036
  }
1037
1037
  return t.autoRotate && t.rotateOffset && (n.angle += t.rotateOffset), n;
1038
1038
  }
1039
- function Bn(t, e, n, s) {
1040
- const r = e + (n - e) * s;
1041
- return re(t, r);
1039
+ function er(t, e, n, r) {
1040
+ const s = e + (n - e) * r;
1041
+ return oe(t, s);
1042
1042
  }
1043
- const mt = {
1043
+ const yt = {
1044
1044
  upperCase: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
1045
1045
  lowerCase: "abcdefghijklmnopqrstuvwxyz",
1046
1046
  upperAndLowerCase: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
1047
1047
  numbers: "0123456789"
1048
- }, mn = 20;
1049
- function yn(t) {
1050
- const e = mt[t ?? "upperCase"] ?? t ?? mt.upperCase, n = Array.from(e);
1051
- return n.length > 0 ? n : Array.from(mt.upperCase);
1052
- }
1053
- function _n(t, e, n) {
1054
- let s = (t | 0) ^ Math.imul(e + 1, 2654435761) ^ Math.imul(n + 1, 2246822507);
1055
- return s = Math.imul(s ^ s >>> 16, 2146121005), s = Math.imul(s ^ s >>> 15, 2221713035), (s ^ s >>> 16) >>> 0;
1056
- }
1057
- function Mn(t, e, n = 0) {
1058
- const s = t.from ?? "", r = t.to, i = Math.max(0, Math.min(1, e));
1059
- if (i <= 0) return s;
1060
- if (i >= 1) return r;
1061
- const a = Array.from(s), o = Array.from(r), c = t.rightToLeft ?? !1;
1048
+ }, bn = 20;
1049
+ function Tn(t) {
1050
+ const e = yt[t ?? "upperCase"] ?? t ?? yt.upperCase, n = Array.from(e);
1051
+ return n.length > 0 ? n : Array.from(yt.upperCase);
1052
+ }
1053
+ function xn(t, e, n) {
1054
+ let r = (t | 0) ^ Math.imul(e + 1, 2654435761) ^ Math.imul(n + 1, 2246822507);
1055
+ return r = Math.imul(r ^ r >>> 16, 2146121005), r = Math.imul(r ^ r >>> 15, 2221713035), (r ^ r >>> 16) >>> 0;
1056
+ }
1057
+ function kn(t, e, n = 0) {
1058
+ const r = t.from ?? "", s = t.to, i = Math.max(0, Math.min(1, e));
1059
+ if (i <= 0) return r;
1060
+ if (i >= 1) return s;
1061
+ const a = Array.from(r), o = Array.from(s), c = t.rightToLeft ?? !1;
1062
1062
  if (t.mode === "type") {
1063
- const _ = Math.round(i * Math.max(a.length, o.length));
1064
- return c ? a.slice(0, Math.max(0, a.length - _)).join("") + o.slice(Math.max(0, o.length - _)).join("") : o.slice(0, _).join("") + a.slice(_).join("");
1063
+ const b = Math.round(i * Math.max(a.length, o.length));
1064
+ return c ? a.slice(0, Math.max(0, a.length - b)).join("") + o.slice(Math.max(0, o.length - b)).join("") : o.slice(0, b).join("") + a.slice(b).join("");
1065
1065
  }
1066
- const u = Math.max(0, Math.min(0.999, t.revealDelay ?? 0)), l = Math.max(0, (i - u) / (1 - u)), h = Math.floor(l * o.length), p = t.tweenLength === !1 ? o.length : Math.round(a.length + (o.length - a.length) * i), f = yn(t.chars), M = t.refreshRate ?? mn, d = M > 0 ? Math.floor(n * M / 1e3) : 0, g = t.seed ?? 1;
1067
- let y = "";
1068
- for (let _ = 0; _ < p; _++) {
1069
- const T = c ? _ >= p - h : _ < h, k = c ? o[o.length - (p - _)] : o[_];
1070
- T && k !== void 0 || k === " " || k === `
1071
- ` ? y += k : y += f[_n(g, _, d) % f.length];
1066
+ const u = Math.max(0, Math.min(0.999, t.revealDelay ?? 0)), l = Math.max(0, (i - u) / (1 - u)), h = Math.floor(l * o.length), p = t.tweenLength === !1 ? o.length : Math.round(a.length + (o.length - a.length) * i), f = Tn(t.chars), _ = t.refreshRate ?? bn, d = _ > 0 ? Math.floor(n * _ / 1e3) : 0, g = t.seed ?? 1;
1067
+ let M = "";
1068
+ for (let b = 0; b < p; b++) {
1069
+ const k = c ? b >= p - h : b < h, A = c ? o[o.length - (p - b)] : o[b];
1070
+ k && A !== void 0 || A === " " || A === `
1071
+ ` ? M += A : M += f[xn(g, b, d) % f.length];
1072
1072
  }
1073
- return y;
1073
+ return M;
1074
1074
  }
1075
- class Tn {
1075
+ class vn {
1076
1076
  id;
1077
1077
  name;
1078
1078
  _captions;
@@ -1185,31 +1185,31 @@ class Tn {
1185
1185
  const n = this.duration;
1186
1186
  if (n <= 0)
1187
1187
  return;
1188
- let r = e * this.speed;
1188
+ let s = e * this.speed;
1189
1189
  if (this._repeatDelayRemaining > 0) {
1190
- const o = Math.min(this._repeatDelayRemaining, r);
1191
- if (this._repeatDelayRemaining -= o, r -= o, this._repeatDelayRemaining > 0) {
1190
+ const o = Math.min(this._repeatDelayRemaining, s);
1191
+ if (this._repeatDelayRemaining -= o, s -= o, this._repeatDelayRemaining > 0) {
1192
1192
  this.onUpdate?.(this.getStateAtTime(this._currentTime));
1193
1193
  return;
1194
1194
  }
1195
1195
  this._wrapAfterDelay && (this._wrapAfterDelay = !1, this._currentTime = 0);
1196
1196
  }
1197
1197
  const i = 1e3;
1198
- for (let o = 0; o < i && r > 0 && this._playbackState === "playing"; o++)
1198
+ for (let o = 0; o < i && s > 0 && this._playbackState === "playing"; o++)
1199
1199
  if (this._direction === "forward") {
1200
1200
  const c = n - this._currentTime;
1201
- if (r >= c) {
1202
- if (r -= c, this._currentTime = n, !this._handleEndReached())
1201
+ if (s >= c) {
1202
+ if (s -= c, this._currentTime = n, !this._handleEndReached())
1203
1203
  break;
1204
1204
  } else
1205
- this._currentTime += r, r = 0;
1205
+ this._currentTime += s, s = 0;
1206
1206
  } else {
1207
1207
  const c = this._currentTime;
1208
- if (r >= c) {
1209
- if (r -= c, this._currentTime = 0, !this._handleStartReached())
1208
+ if (s >= c) {
1209
+ if (s -= c, this._currentTime = 0, !this._handleStartReached())
1210
1210
  break;
1211
1211
  } else
1212
- this._currentTime -= r, r = 0;
1212
+ this._currentTime -= s, s = 0;
1213
1213
  }
1214
1214
  const a = this.getStateAtTime(this._currentTime);
1215
1215
  this.onUpdate?.(a);
@@ -1222,10 +1222,10 @@ class Tn {
1222
1222
  if (this._hasSharedWrites())
1223
1223
  this._resolveShared(e, n);
1224
1224
  else
1225
- for (const [s, r] of this._trackPlayers) {
1226
- const i = r.getTrack().property;
1227
- for (const { target: a, value: o, start: c } of r.getTargetValues(e))
1228
- this._write(n, s, a, i, o, e - c);
1225
+ for (const [r, s] of this._trackPlayers) {
1226
+ const i = s.getTrack().property;
1227
+ for (const { target: a, value: o, start: c } of s.getTargetValues(e))
1228
+ this._write(n, r, a, i, o, e - c);
1229
1229
  }
1230
1230
  return {
1231
1231
  values: n,
@@ -1249,37 +1249,37 @@ class Tn {
1249
1249
  * turn. `findConflicts()` reports overlaps by the same rule.
1250
1250
  */
1251
1251
  _resolveShared(e, n) {
1252
- const s = /* @__PURE__ */ new Map();
1253
- for (const [r, i] of this._trackPlayers) {
1252
+ const r = /* @__PURE__ */ new Map();
1253
+ for (const [s, i] of this._trackPlayers) {
1254
1254
  const a = i.getTrack().property;
1255
1255
  for (const { target: o, value: c, start: u } of i.getTargetValues(e)) {
1256
- const l = `${o}\0${a}`, h = u <= e, p = s.get(l);
1257
- (!p || (h !== p.started ? h : h ? u >= p.start : u <= p.start)) && s.set(l, { trackId: r, target: o, property: a, value: c, start: u, started: h });
1256
+ const l = `${o}\0${a}`, h = u <= e, p = r.get(l);
1257
+ (!p || (h !== p.started ? h : h ? u >= p.start : u <= p.start)) && r.set(l, { trackId: s, target: o, property: a, value: c, start: u, started: h });
1258
1258
  }
1259
1259
  }
1260
- for (const { trackId: r, target: i, property: a, value: o, start: c } of s.values())
1261
- this._write(n, r, i, a, o, e - c);
1260
+ for (const { trackId: s, target: i, property: a, value: o, start: c } of r.values())
1261
+ this._write(n, s, i, a, o, e - c);
1262
1262
  }
1263
1263
  /**
1264
1264
  * Write one track's value for a target, expanding the progress of motion paths
1265
1265
  * (into x/y/rotation) and text tracks (into the string). `elapsed` is the time
1266
1266
  * since this target's animation on the track started.
1267
1267
  */
1268
- _write(e, n, s, r, i, a) {
1268
+ _write(e, n, r, s, i, a) {
1269
1269
  if (i === void 0) return;
1270
- let o = e.get(s);
1271
- o || (o = /* @__PURE__ */ new Map(), e.set(s, o));
1270
+ let o = e.get(r);
1271
+ o || (o = /* @__PURE__ */ new Map(), e.set(r, o));
1272
1272
  const c = this._textTracks.get(n);
1273
1273
  if (c && typeof i == "number") {
1274
- o.set("text", Mn(c.textConfig, i, Math.max(0, a)));
1274
+ o.set("text", kn(c.textConfig, i, Math.max(0, a)));
1275
1275
  return;
1276
1276
  }
1277
1277
  const u = this._motionPathTracks.get(n);
1278
1278
  if (u && typeof i == "number") {
1279
- const l = re(u.motionPathConfig, i);
1279
+ const l = oe(u.motionPathConfig, i);
1280
1280
  o.set("motionPathX", l.x), o.set("motionPathY", l.y), u.motionPathConfig.autoRotate && o.set("motionPathRotate", l.angle);
1281
1281
  } else
1282
- o.set(r, i);
1282
+ o.set(s, i);
1283
1283
  }
1284
1284
  /** Cached: does any target+property have more than one track? */
1285
1285
  _sharedWrites = null;
@@ -1288,13 +1288,13 @@ class Tn {
1288
1288
  const e = /* @__PURE__ */ new Set();
1289
1289
  this._sharedWrites = !1;
1290
1290
  t: for (const n of this._tracks)
1291
- for (const s of Y(n)) {
1292
- const r = `${s}\0${n.property}`;
1293
- if (e.has(r)) {
1291
+ for (const r of U(n)) {
1292
+ const s = `${r}\0${n.property}`;
1293
+ if (e.has(s)) {
1294
1294
  this._sharedWrites = !0;
1295
1295
  break t;
1296
1296
  }
1297
- e.add(r);
1297
+ e.add(s);
1298
1298
  }
1299
1299
  }
1300
1300
  return this._sharedWrites;
@@ -1303,17 +1303,17 @@ class Tn {
1303
1303
  * Add a track to the timeline.
1304
1304
  */
1305
1305
  addTrack(e) {
1306
- if (this._tracks.push(e), this._sharedWrites = null, U(e)) {
1307
- this._trackPlayers.set(e.id, new gn(e));
1306
+ if (this._tracks.push(e), this._sharedWrites = null, V(e)) {
1307
+ this._trackPlayers.set(e.id, new Mn(e));
1308
1308
  return;
1309
1309
  }
1310
- if (V(e)) {
1311
- this._trackPlayers.set(e.id, new dn(e)), this._springTracks.set(e.id, e);
1310
+ if (H(e)) {
1311
+ this._trackPlayers.set(e.id, new _n(e)), this._springTracks.set(e.id, e);
1312
1312
  return;
1313
1313
  }
1314
1314
  if (kt(e))
1315
- this._trackPlayers.set(e.id, new gt(e)), this._textTracks.set(e.id, e);
1316
- else if (Ht(e)) {
1315
+ this._trackPlayers.set(e.id, new mt(e)), this._textTracks.set(e.id, e);
1316
+ else if (qt(e)) {
1317
1317
  const n = {
1318
1318
  id: e.id,
1319
1319
  target: e.target,
@@ -1324,9 +1324,9 @@ class Tn {
1324
1324
  targets: e.targets,
1325
1325
  stagger: e.stagger
1326
1326
  };
1327
- this._trackPlayers.set(e.id, new gt(n)), this._motionPathTracks.set(e.id, e);
1327
+ this._trackPlayers.set(e.id, new mt(n)), this._motionPathTracks.set(e.id, e);
1328
1328
  } else
1329
- this._trackPlayers.set(e.id, new gt(e));
1329
+ this._trackPlayers.set(e.id, new mt(e));
1330
1330
  }
1331
1331
  /**
1332
1332
  * Replace a track with a new version, keeping its place in the track order
@@ -1334,13 +1334,13 @@ class Tn {
1334
1334
  * different id. Does nothing if no track has `trackId`.
1335
1335
  */
1336
1336
  replaceTrack(e, n) {
1337
- const s = this._tracks.findIndex((i) => i.id === e);
1338
- if (s < 0) return;
1339
- const r = this._tracks.slice(s + 1);
1337
+ const r = this._tracks.findIndex((i) => i.id === e);
1338
+ if (r < 0) return;
1339
+ const s = this._tracks.slice(r + 1);
1340
1340
  this.removeTrack(e);
1341
- for (const i of r) this.removeTrack(i.id);
1341
+ for (const i of s) this.removeTrack(i.id);
1342
1342
  this.addTrack(n);
1343
- for (const i of r) this.addTrack(i);
1343
+ for (const i of s) this.addTrack(i);
1344
1344
  }
1345
1345
  /**
1346
1346
  * Remove a track by its ID.
@@ -1365,9 +1365,9 @@ class Tn {
1365
1365
  * tweens on an element.
1366
1366
  */
1367
1367
  removeTracks(e = {}) {
1368
- const n = this.getTracks(e).map((s) => s.id);
1369
- for (const s of n)
1370
- this.removeTrack(s);
1368
+ const n = this.getTracks(e).map((r) => r.id);
1369
+ for (const r of n)
1370
+ this.removeTrack(r);
1371
1371
  return n;
1372
1372
  }
1373
1373
  /**
@@ -1376,12 +1376,12 @@ class Tn {
1376
1376
  getTrackSpan(e) {
1377
1377
  const n = this._trackPlayers.get(e);
1378
1378
  if (!n) return;
1379
- const s = n.getTrack(), r = s.delay ?? 0;
1380
- if (V(s) || U(s))
1381
- return { from: r, to: n.getDuration() };
1382
- const i = s.keyframes;
1379
+ const r = n.getTrack(), s = r.delay ?? 0;
1380
+ if (H(r) || V(r))
1381
+ return { from: s, to: n.getDuration() };
1382
+ const i = r.keyframes;
1383
1383
  if (!(!i || i.length === 0))
1384
- return { from: i[0].time + r, to: n.getDuration() };
1384
+ return { from: i[0].time + s, to: n.getDuration() };
1385
1385
  }
1386
1386
  /**
1387
1387
  * Overlapping writes to the same target+property.
@@ -1394,32 +1394,32 @@ class Tn {
1394
1394
  findConflicts() {
1395
1395
  const e = [];
1396
1396
  for (let n = 0; n < this._tracks.length; n++) {
1397
- const s = this._tracks[n], r = this.getTrackSpan(s.id);
1398
- if (r)
1397
+ const r = this._tracks[n], s = this.getTrackSpan(r.id);
1398
+ if (s)
1399
1399
  for (let i = 0; i < n; i++) {
1400
1400
  const a = this._tracks[i];
1401
- if (a.property !== s.property) continue;
1402
- const o = Y(a).filter((h) => Y(s).includes(h));
1401
+ if (a.property !== r.property) continue;
1402
+ const o = U(a).filter((h) => U(r).includes(h));
1403
1403
  if (o.length === 0) continue;
1404
1404
  const c = this.getTrackSpan(a.id);
1405
- if (!c || !(c.from <= r.to && r.from <= c.to)) continue;
1406
- const l = r.from >= c.from;
1405
+ if (!c || !(c.from <= s.to && s.from <= c.to)) continue;
1406
+ const l = s.from >= c.from;
1407
1407
  for (const h of o)
1408
1408
  e.push({
1409
1409
  target: h,
1410
- property: s.property,
1411
- losingTrackId: l ? a.id : s.id,
1412
- winningTrackId: l ? s.id : a.id
1410
+ property: r.property,
1411
+ losingTrackId: l ? a.id : r.id,
1412
+ winningTrackId: l ? r.id : a.id
1413
1413
  });
1414
1414
  }
1415
1415
  }
1416
1416
  return e;
1417
1417
  }
1418
1418
  _matches(e, n) {
1419
- if (n.id !== void 0 && e.id !== n.id || n.property !== void 0 && e.property !== n.property || n.target !== void 0 && !Y(e).includes(n.target)) return !1;
1419
+ if (n.id !== void 0 && e.id !== n.id || n.property !== void 0 && e.property !== n.property || n.target !== void 0 && !U(e).includes(n.target)) return !1;
1420
1420
  if (n.timeRange) {
1421
- const s = this.getTrackSpan(e.id);
1422
- if (!s || s.to < n.timeRange.from || s.from > n.timeRange.to) return !1;
1421
+ const r = this.getTrackSpan(e.id);
1422
+ if (!r || r.to < n.timeRange.from || r.from > n.timeRange.to) return !1;
1423
1423
  }
1424
1424
  return !0;
1425
1425
  }
@@ -1428,7 +1428,7 @@ class Tn {
1428
1428
  */
1429
1429
  toDefinition() {
1430
1430
  return {
1431
- formatVersion: rt,
1431
+ formatVersion: it,
1432
1432
  id: this.id,
1433
1433
  name: this.name,
1434
1434
  config: { ...this._config },
@@ -1446,8 +1446,8 @@ class Tn {
1446
1446
  }
1447
1447
  /** Replace the markers (kept in time order); an empty list removes them. */
1448
1448
  setMarkers(e) {
1449
- const n = e && e.length > 0 ? [...e].sort((r, i) => r.time - i.time).map((r) => ({ ...r })) : void 0, s = { ...this._config };
1450
- n ? s.markers = n : delete s.markers, this._config = s;
1449
+ const n = e && e.length > 0 ? [...e].sort((s, i) => s.time - i.time).map((s) => ({ ...s })) : void 0, r = { ...this._config };
1450
+ n ? r.markers = n : delete r.markers, this._config = r;
1451
1451
  }
1452
1452
  /** Caption text per language, per marker id */
1453
1453
  get captions() {
@@ -1456,7 +1456,7 @@ class Tn {
1456
1456
  /** Replace the captions; languages with no captions are dropped. */
1457
1457
  setCaptions(e) {
1458
1458
  const n = {};
1459
- for (const [s, r] of Object.entries(e ?? {})) n[s] = { ...r };
1459
+ for (const [r, s] of Object.entries(e ?? {})) n[r] = { ...s };
1460
1460
  this._captions = Object.keys(n).length > 0 ? n : void 0;
1461
1461
  }
1462
1462
  /** Start the between-iterations pause, if the timeline configures one. */
@@ -1486,72 +1486,72 @@ class Tn {
1486
1486
  return this._config.alternate && (e === -1 || this._loopIteration < e) ? (this._loopIteration++, this._armRepeatDelay(), this._direction = "forward", this._repeatDelayRemaining === 0) : (this._playbackState = "idle", this.onComplete?.(), !1);
1487
1487
  }
1488
1488
  }
1489
- const bn = 100;
1490
- function Zn(t, e, n, s) {
1491
- const r = [], i = [], { duration: a, alternate: o } = s, c = (f, M, d, g) => {
1492
- i.push([f, M]);
1493
- const y = [];
1494
- t.forEach((_, T) => {
1495
- (d === "forward" ? (g ? _ >= f : _ > f) && _ <= M : (g ? _ <= f : _ < f) && _ >= M) && y.push(T);
1496
- }), y.sort((_, T) => (d === "forward" ? t[_] - t[T] : t[T] - t[_]) || _ - T);
1497
- for (const _ of y) r.push({ kind: "event", index: _, direction: d });
1489
+ const Sn = 100;
1490
+ function nr(t, e, n, r) {
1491
+ const s = [], i = [], { duration: a, alternate: o } = r, c = (f, _, d, g) => {
1492
+ i.push([f, _]);
1493
+ const M = [];
1494
+ t.forEach((b, k) => {
1495
+ (d === "forward" ? (g ? b >= f : b > f) && b <= _ : (g ? b <= f : b < f) && b >= _) && M.push(k);
1496
+ }), M.sort((b, k) => (d === "forward" ? t[b] - t[k] : t[k] - t[b]) || b - k);
1497
+ for (const b of M) s.push({ kind: "event", index: b, direction: d });
1498
1498
  };
1499
1499
  let u = e.time, l = e.direction, h = e.fresh === !0;
1500
- const p = Math.min(bn, Math.max(0, n.iteration - e.iteration));
1500
+ const p = Math.min(Sn, Math.max(0, n.iteration - e.iteration));
1501
1501
  for (let f = 0; f < p; f++) {
1502
- const M = l === "forward" ? a : 0;
1503
- c(u, M, l, h), r.push({ kind: "repeat" }), o ? (l = l === "forward" ? "reverse" : "forward", u = M, h = !1) : (u = l === "forward" ? 0 : a, h = !0);
1502
+ const _ = l === "forward" ? a : 0;
1503
+ c(u, _, l, h), s.push({ kind: "repeat" }), o ? (l = l === "forward" ? "reverse" : "forward", u = _, h = !1) : (u = l === "forward" ? 0 : a, h = !0);
1504
1504
  }
1505
- return p > 0 && s.holding && !o ? { crossings: r, passes: i } : (c(u, n.time, l, h), { crossings: r, passes: i });
1505
+ return p > 0 && r.holding && !o ? { crossings: s, passes: i } : (c(u, n.time, l, h), { crossings: s, passes: i });
1506
1506
  }
1507
- function kn(t) {
1508
- return U(t) ? {
1507
+ function An(t) {
1508
+ return V(t) ? {
1509
1509
  id: t.id,
1510
1510
  target: t.target,
1511
1511
  property: t.property,
1512
1512
  kind: "inertia",
1513
- inertia: ie(t.inertia),
1514
- ...E(t)
1515
- } : V(t) ? {
1513
+ inertia: ce(t.inertia),
1514
+ ...F(t)
1515
+ } : H(t) ? {
1516
1516
  id: t.id,
1517
1517
  target: t.target,
1518
1518
  property: t.property,
1519
1519
  kind: "spring",
1520
1520
  spring: { ...t.spring },
1521
- ...E(t)
1521
+ ...F(t)
1522
1522
  } : kt(t) ? {
1523
1523
  id: t.id,
1524
1524
  target: t.target,
1525
1525
  property: "text",
1526
1526
  textConfig: { ...t.textConfig },
1527
- keyframes: t.keyframes.map(yt),
1528
- ...E(t)
1529
- } : Ht(t) ? {
1527
+ keyframes: t.keyframes.map(_t),
1528
+ ...F(t)
1529
+ } : qt(t) ? {
1530
1530
  id: t.id,
1531
1531
  target: t.target,
1532
1532
  property: "motionPath",
1533
1533
  motionPathConfig: { ...t.motionPathConfig },
1534
- keyframes: t.keyframes.map(yt),
1535
- ...E(t)
1534
+ keyframes: t.keyframes.map(_t),
1535
+ ...F(t)
1536
1536
  } : {
1537
1537
  id: t.id,
1538
1538
  target: t.target,
1539
1539
  property: t.property,
1540
- keyframes: t.keyframes.map(yt),
1541
- ...E(t)
1540
+ keyframes: t.keyframes.map(_t),
1541
+ ...F(t)
1542
1542
  };
1543
1543
  }
1544
- function ie(t) {
1544
+ function ce(t) {
1545
1545
  return { ...t, ...Array.isArray(t.end) && { end: [...t.end] } };
1546
1546
  }
1547
- function yt(t) {
1547
+ function _t(t) {
1548
1548
  return {
1549
1549
  time: t.time,
1550
1550
  value: t.value,
1551
1551
  ...t.easing && { easing: t.easing }
1552
1552
  };
1553
1553
  }
1554
- function E(t) {
1554
+ function F(t) {
1555
1555
  const e = t.endDelay;
1556
1556
  return {
1557
1557
  ...t.delay !== void 0 && { delay: t.delay },
@@ -1560,19 +1560,19 @@ function E(t) {
1560
1560
  ...t.stagger !== void 0 && { stagger: { ...t.stagger } }
1561
1561
  };
1562
1562
  }
1563
- function xn(t) {
1564
- if (U(t)) {
1563
+ function wn(t) {
1564
+ if (V(t)) {
1565
1565
  const e = t;
1566
1566
  return {
1567
1567
  id: e.id,
1568
1568
  target: e.target,
1569
1569
  property: e.property,
1570
1570
  kind: "inertia",
1571
- inertia: ie(e.inertia),
1572
- ...E(e)
1571
+ inertia: ce(e.inertia),
1572
+ ...F(e)
1573
1573
  };
1574
1574
  }
1575
- if (V(t)) {
1575
+ if (H(t)) {
1576
1576
  const e = t;
1577
1577
  return {
1578
1578
  id: e.id,
@@ -1580,7 +1580,7 @@ function xn(t) {
1580
1580
  property: e.property,
1581
1581
  kind: "spring",
1582
1582
  spring: { ...e.spring },
1583
- ...E(e)
1583
+ ...F(e)
1584
1584
  };
1585
1585
  }
1586
1586
  if (kt(t)) {
@@ -1590,33 +1590,33 @@ function xn(t) {
1590
1590
  target: e.target,
1591
1591
  property: "text",
1592
1592
  textConfig: { ...e.textConfig },
1593
- keyframes: [...e.keyframes].sort((n, s) => n.time - s.time),
1594
- ...E(e)
1593
+ keyframes: [...e.keyframes].sort((n, r) => n.time - r.time),
1594
+ ...F(e)
1595
1595
  };
1596
1596
  }
1597
1597
  if (t.property === "motionPath" && "motionPathConfig" in t) {
1598
- const e = t, n = [...e.keyframes].sort((s, r) => s.time - r.time);
1598
+ const e = t, n = [...e.keyframes].sort((r, s) => r.time - s.time);
1599
1599
  return {
1600
1600
  id: e.id,
1601
1601
  target: e.target,
1602
1602
  property: "motionPath",
1603
1603
  motionPathConfig: { ...e.motionPathConfig },
1604
1604
  keyframes: n,
1605
- ...E(e)
1605
+ ...F(e)
1606
1606
  };
1607
1607
  }
1608
- return pn({
1608
+ return yn({
1609
1609
  id: t.id,
1610
1610
  target: t.target,
1611
1611
  property: t.property,
1612
1612
  keyframes: t.keyframes,
1613
- ...E(t)
1613
+ ...F(t)
1614
1614
  });
1615
1615
  }
1616
- function vn(t) {
1616
+ function Pn(t) {
1617
1617
  const e = t._config.markers;
1618
1618
  return {
1619
- formatVersion: rt,
1619
+ formatVersion: it,
1620
1620
  id: t.id,
1621
1621
  name: t.name,
1622
1622
  config: {
@@ -1627,38 +1627,38 @@ function vn(t) {
1627
1627
  repeatDelay: t._config.repeatDelay,
1628
1628
  ...e && { markers: e.map((n) => ({ ...n })) }
1629
1629
  },
1630
- tracks: t.tracks.map(kn),
1630
+ tracks: t.tracks.map(An),
1631
1631
  ...t.captions && { captions: JSON.parse(JSON.stringify(t.captions)) }
1632
1632
  };
1633
1633
  }
1634
- function Sn(t) {
1634
+ function $n(t) {
1635
1635
  const e = t.formatVersion ?? 1;
1636
- if (e > rt)
1636
+ if (e > it)
1637
1637
  throw new Error(
1638
- `tinyfly: this animation uses format version ${e}, but this tinyfly reads up to version ${rt}. Update tinyfly to play it.`
1638
+ `tinyfly: this animation uses format version ${e}, but this tinyfly reads up to version ${it}. Update tinyfly to play it.`
1639
1639
  );
1640
- return new Tn({
1640
+ return new vn({
1641
1641
  id: t.id,
1642
1642
  name: t.name,
1643
1643
  config: t.config,
1644
- tracks: t.tracks.map(xn),
1644
+ tracks: t.tracks.map(wn),
1645
1645
  captions: t.captions
1646
1646
  });
1647
1647
  }
1648
- function Jn(t) {
1649
- return JSON.stringify(vn(t));
1648
+ function rr(t) {
1649
+ return JSON.stringify(Pn(t));
1650
1650
  }
1651
- function ts(t) {
1651
+ function sr(t) {
1652
1652
  const e = JSON.parse(t);
1653
- return Sn(e);
1653
+ return $n(e);
1654
1654
  }
1655
- function es(t) {
1655
+ function ir(t) {
1656
1656
  let e = 2166136261;
1657
1657
  for (let n = 0; n < t.length; n++)
1658
1658
  e ^= t.charCodeAt(n), e = Math.imul(e, 16777619);
1659
1659
  return e >>> 0;
1660
1660
  }
1661
- function An(t) {
1661
+ function Rn(t) {
1662
1662
  let e = t >>> 0 || 2654435769;
1663
1663
  return {
1664
1664
  seed: t >>> 0,
@@ -1667,27 +1667,27 @@ function An(t) {
1667
1667
  }
1668
1668
  };
1669
1669
  }
1670
- function ae(t, e, n) {
1670
+ function ue(t, e, n) {
1671
1671
  return e + t.next() * (n - e);
1672
1672
  }
1673
- function wn(t, e, n, s) {
1674
- if (s <= 0) return ae(t, e, n);
1675
- const r = Math.floor((n - e) / s), i = Math.round(t.next() * r);
1676
- return e + i * s;
1673
+ function Dn(t, e, n, r) {
1674
+ if (r <= 0) return ue(t, e, n);
1675
+ const s = Math.floor((n - e) / r), i = Math.round(t.next() * s);
1676
+ return e + i * r;
1677
1677
  }
1678
- function ns(t, e) {
1678
+ function ar(t, e) {
1679
1679
  if (e.length !== 0)
1680
1680
  return e[Math.floor(t.next() * e.length)];
1681
1681
  }
1682
- const oe = /^([+\-*/])=\s*(-?[\d.]+)$/, ce = /^random\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*(?:,\s*(-?[\d.]+)\s*)?\)$/i;
1683
- function ss(t) {
1684
- return typeof t != "string" ? !1 : oe.test(t.trim()) || ce.test(t.trim());
1682
+ const le = /^([+\-*/])=\s*(-?[\d.]+)$/, he = /^random\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*(?:,\s*(-?[\d.]+)\s*)?\)$/i;
1683
+ function or(t) {
1684
+ return typeof t != "string" ? !1 : le.test(t.trim()) || he.test(t.trim());
1685
1685
  }
1686
- function ue(t, e = {}) {
1686
+ function fe(t, e = {}) {
1687
1687
  if (typeof t != "string") return t;
1688
- const n = t.trim(), s = oe.exec(n);
1689
- if (s) {
1690
- const [, i, a] = s, o = e.base ?? 0, c = Number.parseFloat(a);
1688
+ const n = t.trim(), r = le.exec(n);
1689
+ if (r) {
1690
+ const [, i, a] = r, o = e.base ?? 0, c = Number.parseFloat(a);
1691
1691
  switch (i) {
1692
1692
  case "+":
1693
1693
  return o + c;
@@ -1699,134 +1699,134 @@ function ue(t, e = {}) {
1699
1699
  return c === 0 ? o : o / c;
1700
1700
  }
1701
1701
  }
1702
- const r = ce.exec(n);
1703
- if (r) {
1702
+ const s = he.exec(n);
1703
+ if (s) {
1704
1704
  if (!e.random)
1705
1705
  throw new Error(
1706
1706
  `resolveValue: "${n}" needs a random source — pass one via context.random`
1707
1707
  );
1708
- const i = Number.parseFloat(r[1]), a = Number.parseFloat(r[2]), o = r[3] !== void 0 ? Number.parseFloat(r[3]) : void 0;
1709
- return o !== void 0 ? wn(e.random, i, a, o) : ae(e.random, i, a);
1708
+ const i = Number.parseFloat(s[1]), a = Number.parseFloat(s[2]), o = s[3] !== void 0 ? Number.parseFloat(s[3]) : void 0;
1709
+ return o !== void 0 ? Dn(e.random, i, a, o) : ue(e.random, i, a);
1710
1710
  }
1711
1711
  return t;
1712
1712
  }
1713
- function Pn(t, e = 0, n) {
1714
- const s = [];
1715
- let r = e;
1713
+ function Cn(t, e = 0, n) {
1714
+ const r = [];
1715
+ let s = e;
1716
1716
  for (const i of t) {
1717
- const a = ue(i, { base: r, random: n });
1718
- s.push(a), typeof a == "number" && (r = a);
1717
+ const a = fe(i, { base: s, random: n });
1718
+ r.push(a), typeof a == "number" && (s = a);
1719
1719
  }
1720
- return s;
1720
+ return r;
1721
1721
  }
1722
- class rs {
1722
+ class cr {
1723
1723
  random;
1724
1724
  constructor(e) {
1725
- this.random = An(e);
1725
+ this.random = Rn(e);
1726
1726
  }
1727
1727
  /** The seed, to be stored alongside the timeline so this can be reproduced. */
1728
1728
  get seed() {
1729
1729
  return this.random.seed;
1730
1730
  }
1731
1731
  resolve(e, n = 0) {
1732
- return ue(e, { base: n, random: this.random });
1732
+ return fe(e, { base: n, random: this.random });
1733
1733
  }
1734
1734
  resolveSequence(e, n = 0) {
1735
- return Pn(e, n, this.random);
1735
+ return Cn(e, n, this.random);
1736
1736
  }
1737
1737
  }
1738
- const $n = 600;
1739
- function is(t) {
1738
+ const In = 600;
1739
+ function ur(t) {
1740
1740
  if (Array.isArray(t)) {
1741
- const [p, f, M, d] = t;
1742
- return { fn: Vt(p, f, M, d), bezier: [p, f, M, d] };
1741
+ const [p, f, _, d] = t;
1742
+ return { fn: Bt(p, f, _, d), bezier: [p, f, _, d] };
1743
1743
  }
1744
- const { segments: e } = q(t);
1744
+ const { segments: e } = W(t);
1745
1745
  if (e.length === 0) throw new Error(`customEase: no curve in "${t}"`);
1746
- const n = e[0].startX, s = e[0].startY, r = e[e.length - 1], i = r.endX - n, a = r.endY - s;
1746
+ const n = e[0].startX, r = e[0].startY, s = e[e.length - 1], i = s.endX - n, a = s.endY - r;
1747
1747
  if (i === 0 || a === 0) throw new Error(`customEase: "${t}" must move along both axes`);
1748
- const o = (p) => (p - n) / i, c = (p) => (p - s) / a;
1749
- if (e.length === 1 && r.type === "C") {
1750
- const [p, f, M, d] = r.points, g = [o(p), c(f), o(M), c(d)];
1751
- return { fn: Vt(...g), bezier: g };
1748
+ const o = (p) => (p - n) / i, c = (p) => (p - r) / a;
1749
+ if (e.length === 1 && s.type === "C") {
1750
+ const [p, f, _, d] = s.points, g = [o(p), c(f), o(_), c(d)];
1751
+ return { fn: Bt(...g), bezier: g };
1752
1752
  }
1753
- const u = [], l = [], h = Math.max(8, Math.ceil($n / e.length));
1753
+ const u = [], l = [], h = Math.max(8, Math.ceil(In / e.length));
1754
1754
  for (const p of e)
1755
1755
  for (let f = u.length === 0 ? 0 : 1; f <= h; f++) {
1756
- const [M, d] = Rn(p, f / h);
1757
- u.push(o(M)), l.push(c(d));
1756
+ const [_, d] = En(p, f / h);
1757
+ u.push(o(_)), l.push(c(d));
1758
1758
  }
1759
- return { fn: Dn(u, l) };
1759
+ return { fn: Ln(u, l) };
1760
1760
  }
1761
- function as(t = {}) {
1762
- const n = 0.1 + Math.max(0, Math.min(1, t.strength ?? 0.7)) * 0.7, s = [1];
1763
- for (let i = n; i > 2e-3; i *= n) s.push(2 * Math.sqrt(i));
1764
- const r = s.reduce((i, a) => i + a, 0);
1761
+ function lr(t = {}) {
1762
+ const n = 0.1 + Math.max(0, Math.min(1, t.strength ?? 0.7)) * 0.7, r = [1];
1763
+ for (let i = n; i > 2e-3; i *= n) r.push(2 * Math.sqrt(i));
1764
+ const s = r.reduce((i, a) => i + a, 0);
1765
1765
  return (i) => {
1766
1766
  if (i <= 0) return 0;
1767
1767
  if (i >= 1) return 1;
1768
- let a = i * r;
1769
- for (let o = 0; o < s.length; o++) {
1770
- if (a <= s[o]) {
1771
- if (o === 0) return (a / s[0]) ** 2;
1772
- const c = s[o] / 2, u = c * c, l = a - c;
1768
+ let a = i * s;
1769
+ for (let o = 0; o < r.length; o++) {
1770
+ if (a <= r[o]) {
1771
+ if (o === 0) return (a / r[0]) ** 2;
1772
+ const c = r[o] / 2, u = c * c, l = a - c;
1773
1773
  return 1 - (u - l * l);
1774
1774
  }
1775
- a -= s[o];
1775
+ a -= r[o];
1776
1776
  }
1777
1777
  return 1;
1778
1778
  };
1779
1779
  }
1780
- function os(t = {}) {
1781
- const e = Math.max(1, t.wiggles ?? 10), n = t.type ?? "easeOut", s = (r) => n === "uniform" ? 1 : n === "easeInOut" ? Math.sin(Math.PI * r) : (1 - r) ** 2;
1782
- return (r) => r <= 0 || r >= 1 ? 0 : Math.sin(r * e * Math.PI * 2) * s(r);
1780
+ function hr(t = {}) {
1781
+ const e = Math.max(1, t.wiggles ?? 10), n = t.type ?? "easeOut", r = (s) => n === "uniform" ? 1 : n === "easeInOut" ? Math.sin(Math.PI * s) : (1 - s) ** 2;
1782
+ return (s) => s <= 0 || s >= 1 ? 0 : Math.sin(s * e * Math.PI * 2) * r(s);
1783
1783
  }
1784
- function Rn(t, e) {
1784
+ function En(t, e) {
1785
1785
  if (t.type === "L") {
1786
1786
  const [u, l] = t.points;
1787
1787
  return [t.startX + (u - t.startX) * e, t.startY + (l - t.startY) * e];
1788
1788
  }
1789
- const [n, s, r, i, a, o] = t.points, c = 1 - e;
1789
+ const [n, r, s, i, a, o] = t.points, c = 1 - e;
1790
1790
  return [
1791
- c * c * c * t.startX + 3 * c * c * e * n + 3 * c * e * e * r + e * e * e * a,
1792
- c * c * c * t.startY + 3 * c * c * e * s + 3 * c * e * e * i + e * e * e * o
1791
+ c * c * c * t.startX + 3 * c * c * e * n + 3 * c * e * e * s + e * e * e * a,
1792
+ c * c * c * t.startY + 3 * c * c * e * r + 3 * c * e * e * i + e * e * e * o
1793
1793
  ];
1794
1794
  }
1795
- function Dn(t, e) {
1795
+ function Ln(t, e) {
1796
1796
  return (n) => {
1797
1797
  if (n <= t[0]) return e[0];
1798
1798
  if (n >= t[t.length - 1]) return e[e.length - 1];
1799
- let s = 0, r = t.length - 1;
1800
- for (; r - s > 1; ) {
1801
- const a = s + r >> 1;
1802
- t[a] <= n ? s = a : r = a;
1799
+ let r = 0, s = t.length - 1;
1800
+ for (; s - r > 1; ) {
1801
+ const a = r + s >> 1;
1802
+ t[a] <= n ? r = a : s = a;
1803
1803
  }
1804
- const i = t[r] - t[s];
1805
- return i === 0 ? e[r] : e[s] + (n - t[s]) / i * (e[r] - e[s]);
1804
+ const i = t[s] - t[r];
1805
+ return i === 0 ? e[s] : e[r] + (n - t[r]) / i * (e[s] - e[r]);
1806
1806
  };
1807
1807
  }
1808
- function Vt(t, e, n, s) {
1809
- const r = (a, o, c) => 3 * (1 - a) * (1 - a) * a * o + 3 * (1 - a) * a * a * c + a * a * a, i = (a, o, c) => 3 * (1 - a) * (1 - a) * o + 6 * (1 - a) * a * (c - o) + 3 * a * a * (1 - c);
1808
+ function Bt(t, e, n, r) {
1809
+ const s = (a, o, c) => 3 * (1 - a) * (1 - a) * a * o + 3 * (1 - a) * a * a * c + a * a * a, i = (a, o, c) => 3 * (1 - a) * (1 - a) * o + 6 * (1 - a) * a * (c - o) + 3 * a * a * (1 - c);
1810
1810
  return (a) => {
1811
1811
  if (a <= 0) return 0;
1812
1812
  if (a >= 1) return 1;
1813
1813
  let o = a;
1814
1814
  for (let l = 0; l < 8; l++) {
1815
- const h = r(o, t, n) - a, p = i(o, t, n);
1816
- if (Math.abs(h) < 1e-6) return r(o, e, s);
1815
+ const h = s(o, t, n) - a, p = i(o, t, n);
1816
+ if (Math.abs(h) < 1e-6) return s(o, e, r);
1817
1817
  if (Math.abs(p) < 1e-6) break;
1818
1818
  o -= h / p;
1819
1819
  }
1820
1820
  let c = 0, u = 1;
1821
1821
  o = a;
1822
1822
  for (let l = 0; l < 40; l++)
1823
- r(o, t, n) < a ? c = o : u = o, o = (c + u) / 2;
1824
- return r(o, e, s);
1823
+ s(o, t, n) < a ? c = o : u = o, o = (c + u) / 2;
1824
+ return s(o, e, r);
1825
1825
  };
1826
1826
  }
1827
- const Cn = 350, In = 300, En = 550;
1828
- function cs(t, e = {}) {
1829
- const n = e.lead ?? Cn, s = e.gap ?? In, r = e.tail ?? En, i = [];
1827
+ const Fn = 350, On = 300, Nn = 550;
1828
+ function fr(t, e = {}) {
1829
+ const n = e.lead ?? Fn, r = e.gap ?? On, s = e.tail ?? Nn, i = [];
1830
1830
  let a = 0;
1831
1831
  return t.forEach((o, c) => {
1832
1832
  const u = [];
@@ -1834,7 +1834,7 @@ function cs(t, e = {}) {
1834
1834
  o.lines.forEach((p, f) => {
1835
1835
  if (!(p.duration >= 0))
1836
1836
  throw new Error(`narration: scene ${c} line ${f} has an invalid duration (${p.duration})`);
1837
- f > 0 && (l += s), u.push({
1837
+ f > 0 && (l += r), u.push({
1838
1838
  id: p.id ?? `s${c}-l${f}`,
1839
1839
  scene: c,
1840
1840
  line: f,
@@ -1843,180 +1843,257 @@ function cs(t, e = {}) {
1843
1843
  text: p.text
1844
1844
  }), l += p.duration;
1845
1845
  });
1846
- const h = l + r + (o.tail ?? 0);
1846
+ const h = l + s + (o.tail ?? 0);
1847
1847
  i.push({ id: o.id ?? `s${c}`, start: a, duration: h - a, cues: u }), a = h;
1848
1848
  }), { duration: a, scenes: i, cues: i.flatMap((o) => o.cues) };
1849
1849
  }
1850
- function us(t) {
1850
+ function pr(t) {
1851
1851
  return t.cues.map((e) => ({ id: e.id, time: e.start, label: e.text }));
1852
1852
  }
1853
- function ls(t, e) {
1853
+ function dr(t, e) {
1854
1854
  let n = t.scenes[0];
1855
- for (const s of t.scenes)
1856
- if (e >= s.start) n = s;
1855
+ for (const r of t.scenes)
1856
+ if (e >= r.start) n = r;
1857
1857
  else break;
1858
1858
  return n;
1859
1859
  }
1860
- const I = (t) => Math.round(t * 1e3) / 1e3;
1861
- function hs(t, e = {}) {
1860
+ const pe = (t) => 6e4 / t.bpm;
1861
+ function St(t, e) {
1862
+ return t.offset + e * pe(t);
1863
+ }
1864
+ function At(t, e) {
1865
+ return (e - t.offset) / pe(t);
1866
+ }
1867
+ function gr(t, e) {
1868
+ return St(t, Math.round(At(t, e)));
1869
+ }
1870
+ function mr(t, e) {
1871
+ return St(t, Math.ceil(At(t, e) - 1e-9));
1872
+ }
1873
+ function yr(t, e, n) {
1874
+ const r = Math.max(1, Math.round(t.beatsPerBar ?? 4)), s = [];
1875
+ if (!(t.bpm > 0) || n < e) return s;
1876
+ for (let i = Math.ceil(At(t, e) - 1e-9); ; i++) {
1877
+ const a = St(t, i);
1878
+ if (a > n + 1e-9) break;
1879
+ s.push({ time: a, bar: (i % r + r) % r === 0, n: i });
1880
+ }
1881
+ return s;
1882
+ }
1883
+ const B = 100;
1884
+ function _r(t, e, n = {}) {
1885
+ const r = n.minBpm ?? 70, s = n.maxBpm ?? 180, i = Math.max(1, Math.round(e / B)), a = Math.min(t.length, Math.round((n.maxSeconds ?? 60) * e)), o = Math.floor(a / i);
1886
+ if (o < 4) return { bpm: 120, offset: 0, confidence: 0 };
1887
+ const c = new Float64Array(o);
1888
+ for (let m = 0; m < o; m++) {
1889
+ let T = 0;
1890
+ for (let x = m * i; x < (m + 1) * i; x++) T += t[x] * t[x];
1891
+ c[m] = Math.log(1e-6 + T / i);
1892
+ }
1893
+ const u = new Float64Array(o);
1894
+ for (let m = 1; m < o; m++) u[m] = Math.max(0, c[m] - c[m - 1]);
1895
+ const l = u.reduce((m, T) => m + T, 0) / o;
1896
+ for (let m = 0; m < o; m++) u[m] = Math.max(0, u[m] - l);
1897
+ const h = Math.max(1, Math.floor(60 * B / s)), p = Math.min(o - 1, Math.ceil(60 * B / r)), f = (m) => {
1898
+ let T = 0;
1899
+ for (let x = m; x < o; x++) T += u[x] * u[x - m];
1900
+ return T / (o - m);
1901
+ };
1902
+ let _ = 0;
1903
+ for (let m = 0; m < o; m++) _ += u[m] * u[m];
1904
+ _ /= o;
1905
+ let d = h, g = -1 / 0;
1906
+ for (let m = h; m <= p; m++) {
1907
+ const T = 60 * B / m, x = Math.exp(-0.5 * (Math.log2(T / 120) / 0.9) ** 2), v = f(m) * x;
1908
+ v > g && (g = v, d = m);
1909
+ }
1910
+ const M = (m) => {
1911
+ const T = Math.floor(m);
1912
+ return T < 0 || T + 1 >= o ? 0 : u[T] + (u[T + 1] - u[T]) * (m - T);
1913
+ }, b = (m, T) => {
1914
+ let x = 0;
1915
+ for (let v = T; v < o; v += m) x += M(v);
1916
+ return x;
1917
+ };
1918
+ let k = d, A = 0, y = -1 / 0;
1919
+ for (let m = d - 0.6; m <= d + 0.6 + 1e-9; m += 0.02) {
1920
+ if (m < 1) continue;
1921
+ const T = Math.max(1, Math.round(m * 4));
1922
+ for (let x = 0; x < T; x++) {
1923
+ const v = x / T * m, $ = b(m, v);
1924
+ $ > y && (y = $, A = v, k = m);
1925
+ }
1926
+ }
1927
+ const w = 60 * B / k, S = _ > 0 ? Math.max(0, Math.min(1, f(d) / _)) : 0, I = (A + 0.5) * 1e3 / B;
1928
+ return { bpm: Math.round(w * 100) / 100, offset: Math.round(I % (6e4 / w)), confidence: S };
1929
+ }
1930
+ const L = (t) => Math.round(t * 1e3) / 1e3;
1931
+ function Mr(t, e = {}) {
1862
1932
  if (t.length === 0) return "";
1863
- const n = e.curviness ?? 1, s = e.closed ?? !1, r = t.length;
1864
- let i = `M${I(t[0].x)} ${I(t[0].y)}`;
1865
- if (r === 1) return i;
1866
- const a = (c) => s ? t[(c % r + r) % r] : t[Math.max(0, Math.min(r - 1, c))], o = s ? r : r - 1;
1933
+ const n = e.curviness ?? 1, r = e.closed ?? !1, s = t.length;
1934
+ let i = `M${L(t[0].x)} ${L(t[0].y)}`;
1935
+ if (s === 1) return i;
1936
+ const a = (c) => r ? t[(c % s + s) % s] : t[Math.max(0, Math.min(s - 1, c))], o = r ? s : s - 1;
1867
1937
  for (let c = 0; c < o; c++) {
1868
1938
  const u = a(c - 1), l = a(c), h = a(c + 1), p = a(c + 2);
1869
1939
  if (n === 0) {
1870
- i += ` L${I(h.x)} ${I(h.y)}`;
1940
+ i += ` L${L(h.x)} ${L(h.y)}`;
1871
1941
  continue;
1872
1942
  }
1873
- const f = n / 6, M = l.x + (h.x - u.x) * f, d = l.y + (h.y - u.y) * f, g = h.x - (p.x - l.x) * f, y = h.y - (p.y - l.y) * f;
1874
- i += ` C${I(M)} ${I(d)} ${I(g)} ${I(y)} ${I(h.x)} ${I(h.y)}`;
1943
+ const f = n / 6, _ = l.x + (h.x - u.x) * f, d = l.y + (h.y - u.y) * f, g = h.x - (p.x - l.x) * f, M = h.y - (p.y - l.y) * f;
1944
+ i += ` C${L(_)} ${L(d)} ${L(g)} ${L(M)} ${L(h.x)} ${L(h.y)}`;
1875
1945
  }
1876
- return s ? `${i} Z` : i;
1946
+ return r ? `${i} Z` : i;
1877
1947
  }
1878
- const A = (t, e = 0) => {
1948
+ const R = (t, e = 0) => {
1879
1949
  const n = parseFloat(t ?? "");
1880
1950
  return Number.isFinite(n) ? n : e;
1881
1951
  };
1882
- function Ln(t) {
1952
+ function Xn(t) {
1883
1953
  const e = (t ?? "").trim().split(/[\s,]+/).filter(Boolean).map(Number), n = [];
1884
- for (let s = 0; s + 1 < e.length; s += 2) n.push({ x: e[s], y: e[s + 1] });
1954
+ for (let r = 0; r + 1 < e.length; r += 2) n.push({ x: e[r], y: e[r + 1] });
1885
1955
  return n;
1886
1956
  }
1887
- function fs(t) {
1957
+ function br(t) {
1888
1958
  const e = t.attributes;
1889
1959
  switch (t.tag.toLowerCase()) {
1890
1960
  case "path":
1891
1961
  return e.d ?? null;
1892
1962
  case "circle":
1893
1963
  case "ellipse": {
1894
- const n = A(e.cx), s = A(e.cy), r = t.tag.toLowerCase() === "circle" ? A(e.r) : A(e.rx), i = t.tag.toLowerCase() === "circle" ? A(e.r) : A(e.ry);
1895
- return `M${n + r} ${s} A${r} ${i} 0 1 1 ${n - r} ${s} A${r} ${i} 0 1 1 ${n + r} ${s} Z`;
1964
+ const n = R(e.cx), r = R(e.cy), s = t.tag.toLowerCase() === "circle" ? R(e.r) : R(e.rx), i = t.tag.toLowerCase() === "circle" ? R(e.r) : R(e.ry);
1965
+ return `M${n + s} ${r} A${s} ${i} 0 1 1 ${n - s} ${r} A${s} ${i} 0 1 1 ${n + s} ${r} Z`;
1896
1966
  }
1897
1967
  case "rect": {
1898
- const n = A(e.x), s = A(e.y), r = A(e.width), i = A(e.height);
1899
- let a = e.rx != null ? A(e.rx) : e.ry != null ? A(e.ry) : 0, o = e.ry != null ? A(e.ry) : a;
1900
- return a = Math.min(a, r / 2), o = Math.min(o, i / 2), a === 0 || o === 0 ? `M${n} ${s} H${n + r} V${s + i} H${n} Z` : `M${n + a} ${s} H${n + r - a} A${a} ${o} 0 0 1 ${n + r} ${s + o} V${s + i - o} A${a} ${o} 0 0 1 ${n + r - a} ${s + i} H${n + a} A${a} ${o} 0 0 1 ${n} ${s + i - o} V${s + o} A${a} ${o} 0 0 1 ${n + a} ${s} Z`;
1968
+ const n = R(e.x), r = R(e.y), s = R(e.width), i = R(e.height);
1969
+ let a = e.rx != null ? R(e.rx) : e.ry != null ? R(e.ry) : 0, o = e.ry != null ? R(e.ry) : a;
1970
+ return a = Math.min(a, s / 2), o = Math.min(o, i / 2), a === 0 || o === 0 ? `M${n} ${r} H${n + s} V${r + i} H${n} Z` : `M${n + a} ${r} H${n + s - a} A${a} ${o} 0 0 1 ${n + s} ${r + o} V${r + i - o} A${a} ${o} 0 0 1 ${n + s - a} ${r + i} H${n + a} A${a} ${o} 0 0 1 ${n} ${r + i - o} V${r + o} A${a} ${o} 0 0 1 ${n + a} ${r} Z`;
1901
1971
  }
1902
1972
  case "line":
1903
- return `M${A(e.x1)} ${A(e.y1)} L${A(e.x2)} ${A(e.y2)}`;
1973
+ return `M${R(e.x1)} ${R(e.y1)} L${R(e.x2)} ${R(e.y2)}`;
1904
1974
  case "polyline":
1905
1975
  case "polygon": {
1906
- const n = Ln(e.points);
1976
+ const n = Xn(e.points);
1907
1977
  if (n.length === 0) return null;
1908
- const s = n.map((r, i) => `${i === 0 ? "M" : "L"}${r.x} ${r.y}`).join(" ");
1909
- return t.tag.toLowerCase() === "polygon" ? `${s} Z` : s;
1978
+ const r = n.map((s, i) => `${i === 0 ? "M" : "L"}${s.x} ${s.y}`).join(" ");
1979
+ return t.tag.toLowerCase() === "polygon" ? `${r} Z` : r;
1910
1980
  }
1911
1981
  default:
1912
1982
  return null;
1913
1983
  }
1914
1984
  }
1915
1985
  export {
1916
- Nn as Clock,
1917
- te as DEFAULT_BAKE_INTERVAL_MS,
1918
- wt as DEFAULT_INERTIA_FRICTION,
1919
- C as DEFAULT_SPRING,
1920
- rt as FORMAT_VERSION,
1921
- Te as INERTIA_MAX_DURATION_MS,
1922
- gn as InertiaTrackPlayer,
1923
- jn as MORPH_SAMPLES,
1924
- On as ManualClock,
1925
- Wt as SPRING_MAX_DURATION_MS,
1926
- Xn as SPRING_PRESETS,
1927
- G as SPRING_STEP_MS,
1928
- it as SpringSampler,
1929
- dn as SpringTrackPlayer,
1930
- Tn as Timeline,
1931
- gt as TrackPlayer,
1932
- rs as ValueResolver,
1933
- Ie as backOut,
1934
- ln as bakeEasing,
1935
- ne as bakeInertiaTrack,
1936
- ee as bakeSpringTrack,
1937
- Ce as bounceOut,
1938
- yn as charactersFor,
1939
- Kn as clearMorphCache,
1940
- qn as clearPathCache,
1941
- Re as createCubicBezier,
1942
- An as createRandom,
1943
- pn as createTrack,
1944
- Hn as criticalDamping,
1945
- as as customBounce,
1946
- is as customEase,
1947
- os as customWiggle,
1948
- Sn as deserializeTimeline,
1949
- xn as deserializeTrack,
1950
- Ae as easeIn,
1951
- jt as easeInCubic,
1952
- Pe as easeInOut,
1953
- Qt as easeInOutCubic,
1954
- Se as easeInOutQuad,
1955
- xe as easeInQuad,
1956
- we as easeOut,
1957
- Kt as easeOutCubic,
1958
- ve as easeOutQuad,
1959
- De as elasticOut,
1960
- hn as expandParametricEasings,
1961
- ts as fromJSON,
1962
- Gt as getEasingFunction,
1963
- Jt as getInterpolator,
1964
- re as getMotionPathPoint,
1965
- Wn as getPathLength,
1966
- ze as getPointAtProgress,
1967
- ge as hasKeyframes,
1968
- es as hashSeed,
1969
- ct as inertiaDuration,
1970
- ot as inertiaRest,
1971
- Mt as inertiaValueAt,
1972
- zn as inertiaVelocityAt,
1973
- cn as interpolateArray,
1974
- on as interpolateColor,
1975
- Bn as interpolateMotionPath,
1976
- F as interpolateNumber,
1977
- un as interpolatePathString,
1978
- Ut as interpolateString,
1979
- de as isCubicBezierEasing,
1980
- U as isInertiaTrack,
1981
- Fn as isMotionPathPoint,
1982
- Ht as isMotionPathTrack,
1983
- _t as isParametricEasing,
1984
- sn as isPathData,
1985
- V as isSpringTrack,
1986
+ Vn as Clock,
1987
+ re as DEFAULT_BAKE_INTERVAL_MS,
1988
+ Rt as DEFAULT_INERTIA_FRICTION,
1989
+ E as DEFAULT_SPRING,
1990
+ it as FORMAT_VERSION,
1991
+ ve as INERTIA_MAX_DURATION_MS,
1992
+ Mn as InertiaTrackPlayer,
1993
+ Gn as MORPH_SAMPLES,
1994
+ Un as ManualClock,
1995
+ Kt as SPRING_MAX_DURATION_MS,
1996
+ Hn as SPRING_PRESETS,
1997
+ Z as SPRING_STEP_MS,
1998
+ at as SpringSampler,
1999
+ _n as SpringTrackPlayer,
2000
+ vn as Timeline,
2001
+ mt as TrackPlayer,
2002
+ cr as ValueResolver,
2003
+ Oe as backOut,
2004
+ dn as bakeEasing,
2005
+ ie as bakeInertiaTrack,
2006
+ se as bakeSpringTrack,
2007
+ At as beatAtTime,
2008
+ pe as beatLength,
2009
+ St as beatTime,
2010
+ yr as beatsBetween,
2011
+ Fe as bounceOut,
2012
+ Tn as charactersFor,
2013
+ Zn as clearMorphCache,
2014
+ Kn as clearPathCache,
2015
+ Ee as createCubicBezier,
2016
+ Rn as createRandom,
2017
+ yn as createTrack,
2018
+ Wn as criticalDamping,
2019
+ lr as customBounce,
2020
+ ur as customEase,
2021
+ hr as customWiggle,
2022
+ $n as deserializeTimeline,
2023
+ wn as deserializeTrack,
2024
+ _r as detectTempo,
2025
+ Re as easeIn,
2026
+ Qt as easeInCubic,
2027
+ Ce as easeInOut,
2028
+ Zt as easeInOutCubic,
2029
+ $e as easeInOutQuad,
2030
+ we as easeInQuad,
2031
+ De as easeOut,
2032
+ Gt as easeOutCubic,
2033
+ Pe as easeOutQuad,
2034
+ Le as elasticOut,
2035
+ gn as expandParametricEasings,
2036
+ sr as fromJSON,
2037
+ Jt as getEasingFunction,
2038
+ ne as getInterpolator,
2039
+ oe as getMotionPathPoint,
2040
+ Qn as getPathLength,
2041
+ je as getPointAtProgress,
2042
+ Me as hasKeyframes,
2043
+ ir as hashSeed,
2044
+ ut as inertiaDuration,
2045
+ ct as inertiaRest,
2046
+ bt as inertiaValueAt,
2047
+ jn as inertiaVelocityAt,
2048
+ fn as interpolateArray,
2049
+ hn as interpolateColor,
2050
+ er as interpolateMotionPath,
2051
+ O as interpolateNumber,
2052
+ pn as interpolatePathString,
2053
+ zt as interpolateString,
2054
+ _e as isCubicBezierEasing,
2055
+ V as isInertiaTrack,
2056
+ Yn as isMotionPathPoint,
2057
+ qt as isMotionPathTrack,
2058
+ Mt as isParametricEasing,
2059
+ cn as isPathData,
2060
+ H as isSpringTrack,
1986
2061
  kt as isTextTrack,
1987
- Vn as isUnderdamped,
1988
- ss as isUnresolved,
2062
+ qn as isUnderdamped,
2063
+ or as isUnresolved,
1989
2064
  Tt as linear,
1990
- me as maxStaggerDistance,
1991
- nn as morphPath,
1992
- us as narrationMarkers,
1993
- ls as narrationSceneAt,
1994
- be as naturalRest,
1995
- Le as parametricEasing,
1996
- q as parsePath,
1997
- cs as planNarration,
1998
- Zn as playheadCrossings,
1999
- Bt as pointAtDistance,
2000
- hs as pointsToPath,
2001
- ae as randomBetween,
2002
- ns as randomChoice,
2003
- wn as randomSnapped,
2004
- Pn as resolveSequence,
2005
- ue as resolveValue,
2006
- vn as serializeTimeline,
2007
- kn as serializeTrack,
2008
- fs as shapeToPathData,
2009
- fn as simplifyKeyframes,
2010
- Un as springDuration,
2011
- Yn as springValueAt,
2012
- zt as staggerDistance,
2013
- qt as staggerOffset,
2014
- ye as staggerOffsets,
2015
- xt as staggerSpan,
2016
- Ee as stepsEasing,
2017
- Mn as textAt,
2018
- Jn as toJSON,
2019
- Qn as toKeyframedTrack,
2020
- Gn as toKeyframedTracks,
2021
- Y as trackTargets
2065
+ be as maxStaggerDistance,
2066
+ on as morphPath,
2067
+ pr as narrationMarkers,
2068
+ dr as narrationSceneAt,
2069
+ Se as naturalRest,
2070
+ gr as nearestBeat,
2071
+ mr as nextBeat,
2072
+ Xe as parametricEasing,
2073
+ W as parsePath,
2074
+ fr as planNarration,
2075
+ nr as playheadCrossings,
2076
+ te as pointAtDistance,
2077
+ Mr as pointsToPath,
2078
+ ue as randomBetween,
2079
+ ar as randomChoice,
2080
+ Dn as randomSnapped,
2081
+ Cn as resolveSequence,
2082
+ fe as resolveValue,
2083
+ Pn as serializeTimeline,
2084
+ An as serializeTrack,
2085
+ br as shapeToPathData,
2086
+ mn as simplifyKeyframes,
2087
+ Bn as springDuration,
2088
+ zn as springValueAt,
2089
+ Wt as staggerDistance,
2090
+ jt as staggerOffset,
2091
+ Te as staggerOffsets,
2092
+ vt as staggerSpan,
2093
+ Ne as stepsEasing,
2094
+ kn as textAt,
2095
+ rr as toJSON,
2096
+ Jn as toKeyframedTrack,
2097
+ tr as toKeyframedTracks,
2098
+ U as trackTargets
2022
2099
  };