@algorisys/tinyfly 0.64.0 → 0.66.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.
@@ -4,14 +4,14 @@ function ae(e) {
4
4
  function oe(e) {
5
5
  return typeof e == "object" && e !== null && e.type !== "cubic-bezier";
6
6
  }
7
- const Z = 1;
7
+ const K = 1;
8
8
  function Ut(e) {
9
9
  return e.property === "text" && "textConfig" in e;
10
10
  }
11
- function pt(e) {
11
+ function mt(e) {
12
12
  return e.kind === "inertia" && "inertia" in e;
13
13
  }
14
- function mt(e) {
14
+ function gt(e) {
15
15
  return e.kind === "spring" && "spring" in e;
16
16
  }
17
17
  function ce(e) {
@@ -53,10 +53,10 @@ function Ht(e, t, s) {
53
53
  function he(e, t) {
54
54
  return Array.from({ length: e }, (s, n) => Ht(n, e, t));
55
55
  }
56
- function kt(e, t) {
56
+ function Mt(e, t) {
57
57
  return e <= 1 ? 0 : Math.max(...he(e, t));
58
58
  }
59
- const Q = 1, zt = 6e4, J = zt / Q, q = {
59
+ const Z = 1, zt = 6e4, tt = zt / Z, V = {
60
60
  stiffness: 180,
61
61
  damping: 12,
62
62
  mass: 1,
@@ -89,7 +89,7 @@ class ue {
89
89
  /** Once at rest we stop simulating; every later time returns `to`. */
90
90
  settledStep = null;
91
91
  constructor(t) {
92
- this.from = t.from, this.to = t.to, this.stiffness = t.stiffness ?? q.stiffness, this.damping = t.damping ?? q.damping, this.mass = t.mass ?? q.mass, this.restDelta = t.restDelta ?? q.restDelta, this.restSpeed = t.restSpeed ?? q.restSpeed, this.distance = Math.abs(this.to - this.from) || 1, this.samples = [this.from], this.velocity = t.velocity ?? q.velocity, this.isAtRest(this.from) && (this.settledStep = 0);
92
+ this.from = t.from, this.to = t.to, this.stiffness = t.stiffness ?? V.stiffness, this.damping = t.damping ?? V.damping, this.mass = t.mass ?? V.mass, this.restDelta = t.restDelta ?? V.restDelta, this.restSpeed = t.restSpeed ?? V.restSpeed, this.distance = Math.abs(this.to - this.from) || 1, this.samples = [this.from], this.velocity = t.velocity ?? V.velocity, this.isAtRest(this.from) && (this.settledStep = 0);
93
93
  }
94
94
  /**
95
95
  * Whether a position/velocity pair counts as settled.
@@ -107,10 +107,10 @@ class ue {
107
107
  */
108
108
  valueAt(t) {
109
109
  if (t <= 0) return this.from;
110
- const s = Math.floor(t / Q);
110
+ const s = Math.floor(t / Z);
111
111
  if (this.simulateTo(s + 1), this.settledStep !== null && s >= this.settledStep)
112
112
  return this.to;
113
- const n = this.samples[Math.min(s, this.samples.length - 1)], i = this.samples[Math.min(s + 1, this.samples.length - 1)], r = t / Q - s;
113
+ const n = this.samples[Math.min(s, this.samples.length - 1)], i = this.samples[Math.min(s + 1, this.samples.length - 1)], r = t / Z - s;
114
114
  return n + (i - n) * r;
115
115
  }
116
116
  /**
@@ -118,31 +118,31 @@ class ue {
118
118
  * of a spring track. Runs the simulation to completion once.
119
119
  */
120
120
  settleTime() {
121
- return this.simulateTo(J + 1), this.settledStep !== null ? this.settledStep * Q : zt;
121
+ return this.simulateTo(tt + 1), this.settledStep !== null ? this.settledStep * Z : zt;
122
122
  }
123
123
  /** Advance the cached simulation until it holds at least `steps` samples. */
124
124
  simulateTo(t) {
125
125
  if (this.settledStep !== null) return;
126
- const s = Math.min(t, J + 1), n = Q / 1e3;
126
+ const s = Math.min(t, tt + 1), n = Z / 1e3;
127
127
  for (; this.samples.length < s; ) {
128
- const i = this.samples[this.samples.length - 1], r = i - this.to, a = -this.stiffness * r, o = -this.damping * this.velocity, l = (a + o) / this.mass;
129
- this.velocity += l * n;
130
- const c = i + this.velocity * n;
131
- if (this.samples.push(c), this.isAtRest(c)) {
128
+ const i = this.samples[this.samples.length - 1], r = i - this.to, a = -this.stiffness * r, o = -this.damping * this.velocity, c = (a + o) / this.mass;
129
+ this.velocity += c * n;
130
+ const l = i + this.velocity * n;
131
+ if (this.samples.push(l), this.isAtRest(l)) {
132
132
  this.settledStep = this.samples.length - 1;
133
133
  return;
134
134
  }
135
135
  }
136
- this.samples.length > J && (this.settledStep = J);
136
+ this.samples.length > tt && (this.settledStep = tt);
137
137
  }
138
138
  }
139
139
  const wt = 4, fe = 2e-3, de = 1e-4, pe = 6e4;
140
- function Mt(e) {
140
+ function Tt(e) {
141
141
  const t = e.friction ?? wt;
142
142
  return t > 0 ? t : wt;
143
143
  }
144
144
  function me(e) {
145
- return e.from + e.velocity / Mt(e);
145
+ return e.from + e.velocity / Tt(e);
146
146
  }
147
147
  function ge(e, t) {
148
148
  if (t === void 0) return e;
@@ -163,18 +163,18 @@ function Qt(e) {
163
163
  if (t === 0) return 0;
164
164
  const s = e.restDelta ?? Math.max(de, t * fe);
165
165
  if (s >= t) return 0;
166
- const n = Math.log(t / s) / Mt(e);
166
+ const n = Math.log(t / s) / Tt(e);
167
167
  return Math.min(pe, n * 1e3);
168
168
  }
169
169
  function xt(e, t) {
170
170
  if (t <= 0) return e.from;
171
171
  const s = Gt(e);
172
172
  if (t >= Qt(e)) return s;
173
- const n = Mt(e);
173
+ const n = Tt(e);
174
174
  return e.from + (s - e.from) * (1 - Math.exp(-n * t / 1e3));
175
175
  }
176
- const gt = (e) => e, ye = (e) => e * e, be = (e) => 1 - (1 - e) * (1 - e), ke = (e) => e < 0.5 ? 2 * e * e : 1 - Math.pow(-2 * e + 2, 2) / 2, Zt = (e) => e * e * e, Kt = (e) => 1 - Math.pow(1 - e, 3), Jt = (e) => e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2, Me = Zt, Te = Kt, Se = Jt, we = {
177
- linear: gt,
176
+ const yt = (e) => e, ye = (e) => e * e, be = (e) => 1 - (1 - e) * (1 - e), ke = (e) => e < 0.5 ? 2 * e * e : 1 - Math.pow(-2 * e + 2, 2) / 2, Zt = (e) => e * e * e, Kt = (e) => 1 - Math.pow(1 - e, 3), Jt = (e) => e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2, Me = Zt, Te = Kt, Se = Jt, we = {
177
+ linear: yt,
178
178
  "ease-in": Me,
179
179
  "ease-out": Te,
180
180
  "ease-in-out": Se,
@@ -186,34 +186,34 @@ const gt = (e) => e, ye = (e) => e * e, be = (e) => 1 - (1 - e) * (1 - e), ke =
186
186
  "ease-in-out-cubic": Jt
187
187
  };
188
188
  function xe(e) {
189
- const [t, s, n, i] = e, r = 3 * t, a = 3 * (n - t) - r, o = 1 - r - a, l = 3 * s, c = 3 * (i - s) - l, u = 1 - l - c, h = (p) => ((o * p + a) * p + r) * p, f = (p) => ((u * p + c) * p + l) * p, d = (p) => (3 * o * p + 2 * a) * p + r, k = (p) => {
189
+ const [t, s, n, i] = e, r = 3 * t, a = 3 * (n - t) - r, o = 1 - r - a, c = 3 * s, l = 3 * (i - s) - c, u = 1 - c - l, h = (p) => ((o * p + a) * p + r) * p, f = (p) => ((u * p + l) * p + c) * p, d = (p) => (3 * o * p + 2 * a) * p + r, b = (p) => {
190
190
  let m = p;
191
191
  for (let T = 0; T < 8; T++) {
192
- const x = h(m) - p;
193
- if (Math.abs(x) < 1e-7)
192
+ const w = h(m) - p;
193
+ if (Math.abs(w) < 1e-7)
194
194
  return m;
195
195
  const g = d(m);
196
196
  if (Math.abs(g) < 1e-7)
197
197
  break;
198
- m -= x / g;
198
+ m -= w / g;
199
199
  }
200
- let y = 0, b = 1;
201
- for (m = p; y < b; ) {
200
+ let k = 0, y = 1;
201
+ for (m = p; k < y; ) {
202
202
  const T = h(m);
203
203
  if (Math.abs(T - p) < 1e-7)
204
204
  return m;
205
- p > T ? y = m : b = m, m = (y + b) / 2;
205
+ p > T ? k = m : y = m, m = (k + y) / 2;
206
206
  }
207
207
  return m;
208
208
  };
209
209
  return (p) => {
210
210
  if (p <= 0) return 0;
211
211
  if (p >= 1) return 1;
212
- const m = k(p);
212
+ const m = b(p);
213
213
  return f(m);
214
214
  };
215
215
  }
216
- function ot(e, t = "out") {
216
+ function ct(e, t = "out") {
217
217
  if (t === "out") return e;
218
218
  const s = (n) => 1 - e(1 - n);
219
219
  return t === "in" ? s : (n) => n < 0.5 ? s(n * 2) / 2 : e(n * 2 - 1) / 2 + 0.5;
@@ -268,17 +268,17 @@ function Ie(e) {
268
268
  case "steps":
269
269
  return Pe(e.count, e.position);
270
270
  case "elastic":
271
- return ot(_e(e.amplitude, e.period), e.mode);
271
+ return ct(_e(e.amplitude, e.period), e.mode);
272
272
  case "bounce":
273
- return ot(ve, e.mode);
273
+ return ct(ve, e.mode);
274
274
  case "back":
275
- return ot(Ae(e.overshoot), e.mode);
275
+ return ct(Ae(e.overshoot), e.mode);
276
276
  }
277
277
  }
278
278
  function Ce(e) {
279
- return e === void 0 ? gt : ae(e) ? xe(e.points) : oe(e) ? Ie(e) : we[e] ?? gt;
279
+ return e === void 0 ? yt : ae(e) ? xe(e.points) : oe(e) ? Ie(e) : we[e] ?? yt;
280
280
  }
281
- const _t = 32, Re = 256, j = /* @__PURE__ */ new Map(), Ee = /[MmLlHhVvCcSsQqTtAaZz]/, $e = /^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/, De = {
281
+ const _t = 32, Re = 256, H = /* @__PURE__ */ new Map(), Ee = /[MmLlHhVvCcSsQqTtAaZz]/, $e = /^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/, De = {
282
282
  M: 2,
283
283
  L: 2,
284
284
  H: 1,
@@ -309,39 +309,39 @@ function Oe(e) {
309
309
  n.args.push(r === "1" ? 1 : 0), s++;
310
310
  continue;
311
311
  }
312
- const l = $e.exec(e.slice(s));
313
- if (!l) break;
314
- n.args.push(parseFloat(l[0])), s += l[0].length;
312
+ const c = $e.exec(e.slice(s));
313
+ if (!c) break;
314
+ n.args.push(parseFloat(c[0])), s += c[0].length;
315
315
  }
316
316
  return t;
317
317
  }
318
- function Le(e, t, s, n, i, r, a, o, l) {
319
- if (e === o && t === l) return [];
320
- let c = Math.abs(s), u = Math.abs(n);
321
- if (c === 0 || u === 0) return [[e, t, o, l, o, l]];
322
- const h = i * Math.PI / 180, f = Math.cos(h), d = Math.sin(h), k = (e - o) / 2, p = (t - l) / 2, m = f * k + d * p, y = -d * k + f * p, b = m * m / (c * c) + y * y / (u * u);
323
- if (b > 1) {
324
- const P = Math.sqrt(b);
325
- c *= P, u *= P;
326
- }
327
- const T = r === a ? -1 : 1, x = c * c * u * u - c * c * y * y - u * u * m * m, g = c * c * y * y + u * u * m * m, _ = T * Math.sqrt(Math.max(0, x / g)), S = _ * c * y / u, I = -_ * u * m / c, O = f * S - d * I + (e + o) / 2, v = d * S + f * I + (t + l) / 2, A = (P, E, $, Y) => {
328
- const at = P * $ + E * Y, K = Math.sqrt((P * P + E * E) * ($ * $ + Y * Y)), U = Math.acos(Math.max(-1, Math.min(1, at / K)));
329
- return P * Y - E * $ < 0 ? -U : U;
330
- }, M = A(1, 0, (m - S) / c, (y - I) / u);
331
- let w = A((m - S) / c, (y - I) / u, (-m - S) / c, (-y - I) / u);
332
- !a && w > 0 && (w -= 2 * Math.PI), a && w < 0 && (w += 2 * Math.PI);
333
- const C = Math.max(1, Math.ceil(Math.abs(w) / (Math.PI / 2))), D = w / C, R = 4 / 3 * Math.tan(D / 4), W = (P) => {
334
- const E = c * Math.cos(P), $ = u * Math.sin(P);
335
- return [f * E - d * $ + O, d * E + f * $ + v];
318
+ function Le(e, t, s, n, i, r, a, o, c) {
319
+ if (e === o && t === c) return [];
320
+ let l = Math.abs(s), u = Math.abs(n);
321
+ if (l === 0 || u === 0) return [[e, t, o, c, o, c]];
322
+ const h = i * Math.PI / 180, f = Math.cos(h), d = Math.sin(h), b = (e - o) / 2, p = (t - c) / 2, m = f * b + d * p, k = -d * b + f * p, y = m * m / (l * l) + k * k / (u * u);
323
+ if (y > 1) {
324
+ const P = Math.sqrt(y);
325
+ l *= P, u *= P;
326
+ }
327
+ const T = r === a ? -1 : 1, w = l * l * u * u - l * l * k * k - u * u * m * m, g = l * l * k * k + u * u * m * m, x = T * Math.sqrt(Math.max(0, w / g)), S = x * l * k / u, I = -x * u * m / l, Y = f * S - d * I + (e + o) / 2, _ = d * S + f * I + (t + c) / 2, C = (P, R, D, q) => {
328
+ const ot = P * D + R * q, J = Math.sqrt((P * P + R * R) * (D * D + q * q)), j = Math.acos(Math.max(-1, Math.min(1, ot / J)));
329
+ return P * q - R * D < 0 ? -j : j;
330
+ }, A = C(1, 0, (m - S) / l, (k - I) / u);
331
+ let M = C((m - S) / l, (k - I) / u, (-m - S) / l, (-k - I) / u);
332
+ !a && M > 0 && (M -= 2 * Math.PI), a && M < 0 && (M += 2 * Math.PI);
333
+ const v = Math.max(1, Math.ceil(Math.abs(M) / (Math.PI / 2))), O = M / v, E = 4 / 3 * Math.tan(O / 4), $ = (P) => {
334
+ const R = l * Math.cos(P), D = u * Math.sin(P);
335
+ return [f * R - d * D + Y, d * R + f * D + _];
336
336
  }, B = (P) => {
337
- const E = -c * Math.sin(P), $ = u * Math.cos(P);
338
- return [f * E - d * $, d * E + f * $];
339
- }, St = [];
340
- for (let P = 0; P < C; P++) {
341
- const E = M + P * D, $ = E + D, [Y, at] = W(E), [K, U] = P === C - 1 ? [o, l] : W($), [se, ne] = B(E), [ie, re] = B($);
342
- St.push([Y + R * se, at + R * ne, K - R * ie, U - R * re, K, U]);
337
+ const R = -l * Math.sin(P), D = u * Math.cos(P);
338
+ return [f * R - d * D, d * R + f * D];
339
+ }, U = [];
340
+ for (let P = 0; P < v; P++) {
341
+ const R = A + P * O, D = R + O, [q, ot] = $(R), [J, j] = P === v - 1 ? [o, c] : $(D), [se, ne] = B(R), [ie, re] = B(D);
342
+ U.push([q + E * se, ot + E * ne, J - E * ie, j - E * re, J, j]);
343
343
  }
344
- return St;
344
+ return U;
345
345
  }
346
346
  function N(e, t, s, n, i) {
347
347
  const r = 1 - i;
@@ -351,7 +351,7 @@ function vt(e, t, s, n, i) {
351
351
  const r = 1 - i;
352
352
  return 3 * r * r * (t - e) + 6 * r * i * (s - t) + 3 * i * i * (n - s);
353
353
  }
354
- function H(e, t, s, n) {
354
+ function z(e, t, s, n) {
355
355
  return {
356
356
  subpath: 0,
357
357
  type: "L",
@@ -363,104 +363,104 @@ function H(e, t, s, n) {
363
363
  length: Math.hypot(s - e, n - t)
364
364
  };
365
365
  }
366
- function tt(e, t, s) {
367
- const [n, i, r, a, o, l] = s, c = [0];
366
+ function et(e, t, s) {
367
+ const [n, i, r, a, o, c] = s, l = [0];
368
368
  let u = e, h = t, f = 0;
369
369
  for (let d = 1; d <= _t; d++) {
370
- const k = d / _t, p = N(e, n, r, o, k), m = N(t, i, a, l, k);
371
- f += Math.hypot(p - u, m - h), c.push(f), u = p, h = m;
370
+ const b = d / _t, p = N(e, n, r, o, b), m = N(t, i, a, c, b);
371
+ f += Math.hypot(p - u, m - h), l.push(f), u = p, h = m;
372
372
  }
373
373
  return {
374
374
  subpath: 0,
375
375
  type: "C",
376
- points: [n, i, r, a, o, l],
376
+ points: [n, i, r, a, o, c],
377
377
  startX: e,
378
378
  startY: t,
379
379
  endX: o,
380
- endY: l,
380
+ endY: c,
381
381
  length: f,
382
- lengths: c
382
+ lengths: l
383
383
  };
384
384
  }
385
- function nt(e) {
386
- const t = j.get(e);
385
+ function it(e) {
386
+ const t = H.get(e);
387
387
  if (t) return t;
388
388
  const s = [];
389
- let n = 0, i = 0, r = 0, a = 0, o = null, l = null, c = -1;
389
+ let n = 0, i = 0, r = 0, a = 0, o = null, c = null, l = -1;
390
390
  const u = /* @__PURE__ */ new Set(), h = (p) => {
391
- c < 0 && (c = 0), p.subpath = c, s.push(p);
391
+ l < 0 && (l = 0), p.subpath = l, s.push(p);
392
392
  };
393
393
  for (const { type: p, args: m } of Oe(e)) {
394
- const y = p.toUpperCase(), b = p !== y, T = De[y];
395
- if (y === "Z") {
396
- (n !== r || i !== a) && h(H(n, i, r, a)), c >= 0 && u.add(c), n = r, i = a, o = l = null;
394
+ const k = p.toUpperCase(), y = p !== k, T = De[k];
395
+ if (k === "Z") {
396
+ (n !== r || i !== a) && h(z(n, i, r, a)), l >= 0 && u.add(l), n = r, i = a, o = c = null;
397
397
  continue;
398
398
  }
399
- for (let x = 0; x + T <= m.length; x += T) {
400
- const g = m.slice(x, x + T), _ = b ? n : 0, S = b ? i : 0;
401
- let I = null, O = null;
402
- switch (y) {
399
+ for (let w = 0; w + T <= m.length; w += T) {
400
+ const g = m.slice(w, w + T), x = y ? n : 0, S = y ? i : 0;
401
+ let I = null, Y = null;
402
+ switch (k) {
403
403
  case "M":
404
- x === 0 ? (n = g[0] + _, i = g[1] + S, r = n, a = i, (c < 0 || s[s.length - 1]?.subpath === c) && c++) : (h(H(n, i, g[0] + _, g[1] + S)), n = g[0] + _, i = g[1] + S);
404
+ w === 0 ? (n = g[0] + x, i = g[1] + S, r = n, a = i, (l < 0 || s[s.length - 1]?.subpath === l) && l++) : (h(z(n, i, g[0] + x, g[1] + S)), n = g[0] + x, i = g[1] + S);
405
405
  break;
406
406
  case "L":
407
- h(H(n, i, g[0] + _, g[1] + S)), n = g[0] + _, i = g[1] + S;
407
+ h(z(n, i, g[0] + x, g[1] + S)), n = g[0] + x, i = g[1] + S;
408
408
  break;
409
409
  case "H":
410
- h(H(n, i, g[0] + _, i)), n = g[0] + _;
410
+ h(z(n, i, g[0] + x, i)), n = g[0] + x;
411
411
  break;
412
412
  case "V":
413
- h(H(n, i, n, g[0] + S)), i = g[0] + S;
413
+ h(z(n, i, n, g[0] + S)), i = g[0] + S;
414
414
  break;
415
415
  case "C": {
416
- const v = [g[0] + _, g[1] + S, g[2] + _, g[3] + S, g[4] + _, g[5] + S];
417
- h(tt(n, i, v)), I = [v[2], v[3]], n = v[4], i = v[5];
416
+ const _ = [g[0] + x, g[1] + S, g[2] + x, g[3] + S, g[4] + x, g[5] + S];
417
+ h(et(n, i, _)), I = [_[2], _[3]], n = _[4], i = _[5];
418
418
  break;
419
419
  }
420
420
  case "S": {
421
- const [v, A] = o ? [2 * n - o[0], 2 * i - o[1]] : [n, i], M = [v, A, g[0] + _, g[1] + S, g[2] + _, g[3] + S];
422
- h(tt(n, i, M)), I = [M[2], M[3]], n = M[4], i = M[5];
421
+ const [_, C] = o ? [2 * n - o[0], 2 * i - o[1]] : [n, i], A = [_, C, g[0] + x, g[1] + S, g[2] + x, g[3] + S];
422
+ h(et(n, i, A)), I = [A[2], A[3]], n = A[4], i = A[5];
423
423
  break;
424
424
  }
425
425
  case "Q":
426
426
  case "T": {
427
- let v = n, A = i;
428
- y === "Q" ? (v = g[0] + _, A = g[1] + S) : l && (v = 2 * n - l[0], A = 2 * i - l[1]);
429
- const M = y === "Q" ? g[2] + _ : g[0] + _, w = y === "Q" ? g[3] + S : g[1] + S;
427
+ let _ = n, C = i;
428
+ k === "Q" ? (_ = g[0] + x, C = g[1] + S) : c && (_ = 2 * n - c[0], C = 2 * i - c[1]);
429
+ const A = k === "Q" ? g[2] + x : g[0] + x, M = k === "Q" ? g[3] + S : g[1] + S;
430
430
  h(
431
- tt(n, i, [
432
- n + 2 / 3 * (v - n),
433
- i + 2 / 3 * (A - i),
434
- M + 2 / 3 * (v - M),
435
- w + 2 / 3 * (A - w),
436
- M,
437
- w
431
+ et(n, i, [
432
+ n + 2 / 3 * (_ - n),
433
+ i + 2 / 3 * (C - i),
434
+ A + 2 / 3 * (_ - A),
435
+ M + 2 / 3 * (C - M),
436
+ A,
437
+ M
438
438
  ])
439
- ), O = [v, A], n = M, i = w;
439
+ ), Y = [_, C], n = A, i = M;
440
440
  break;
441
441
  }
442
442
  case "A": {
443
- const v = g[5] + _, A = g[6] + S;
444
- let M = n, w = i;
445
- for (const C of Le(n, i, g[0], g[1], g[2], g[3], g[4], v, A))
446
- h(tt(M, w, C)), M = C[4], w = C[5];
447
- n = v, i = A;
443
+ const _ = g[5] + x, C = g[6] + S;
444
+ let A = n, M = i;
445
+ for (const v of Le(n, i, g[0], g[1], g[2], g[3], g[4], _, C))
446
+ h(et(A, M, v)), A = v[4], M = v[5];
447
+ n = _, i = C;
448
448
  break;
449
449
  }
450
450
  }
451
- o = I, l = O;
451
+ o = I, c = Y;
452
452
  }
453
453
  }
454
454
  const f = s.reduce((p, m) => p + m.length, 0), d = [];
455
455
  for (let p = 0; p < s.length; ) {
456
456
  const m = s[p].subpath;
457
- let y = p, b = 0;
458
- for (; y < s.length && s[y].subpath === m; ) b += s[y++].length;
459
- const T = s[p], x = s[y - 1], g = u.has(m) || Math.abs(x.endX - T.startX) < 1e-9 && Math.abs(x.endY - T.startY) < 1e-9;
460
- d.push({ start: p, end: y, length: b, closed: g }), p = y;
457
+ let k = p, y = 0;
458
+ for (; k < s.length && s[k].subpath === m; ) y += s[k++].length;
459
+ const T = s[p], w = s[k - 1], g = u.has(m) || Math.abs(w.endX - T.startX) < 1e-9 && Math.abs(w.endY - T.startY) < 1e-9;
460
+ d.push({ start: p, end: k, length: y, closed: g }), p = k;
461
461
  }
462
- const k = { segments: s, totalLength: f, subpaths: d };
463
- return j.size >= Re && j.delete(j.keys().next().value), j.set(e, k), k;
462
+ const b = { segments: s, totalLength: f, subpaths: d };
463
+ return H.size >= Re && H.delete(H.keys().next().value), H.set(e, b), b;
464
464
  }
465
465
  function Ne(e, t) {
466
466
  const s = e.lengths;
@@ -474,7 +474,7 @@ function Ne(e, t) {
474
474
  const r = s[i] - s[n], a = r > 0 ? (t - s[n]) / r : 0;
475
475
  return (n + a) / (s.length - 1);
476
476
  }
477
- function Xe(e, t) {
477
+ function Fe(e, t) {
478
478
  if (e.type === "L") {
479
479
  const h = e.length > 0 ? Math.max(0, Math.min(1, t / e.length)) : 0;
480
480
  return {
@@ -483,16 +483,16 @@ function Xe(e, t) {
483
483
  angle: Math.atan2(e.endY - e.startY, e.endX - e.startX) * 180 / Math.PI
484
484
  };
485
485
  }
486
- const [s, n, i, r, a, o] = e.points, l = Ne(e, t);
487
- let c = vt(e.startX, s, i, a, l), u = vt(e.startY, n, r, o, l);
488
- if (Math.hypot(c, u) < 1e-9) {
489
- const h = l < 0.5 ? Math.min(1, l + 1e-3) : Math.max(0, l - 1e-3), f = N(e.startX, s, i, a, h), d = N(e.startY, n, r, o, h), k = N(e.startX, s, i, a, l), p = N(e.startY, n, r, o, l);
490
- c = l < 0.5 ? f - k : k - f, u = l < 0.5 ? d - p : p - d;
486
+ const [s, n, i, r, a, o] = e.points, c = Ne(e, t);
487
+ let l = vt(e.startX, s, i, a, c), u = vt(e.startY, n, r, o, c);
488
+ if (Math.hypot(l, u) < 1e-9) {
489
+ const h = c < 0.5 ? Math.min(1, c + 1e-3) : Math.max(0, c - 1e-3), f = N(e.startX, s, i, a, h), d = N(e.startY, n, r, o, h), b = N(e.startX, s, i, a, c), p = N(e.startY, n, r, o, c);
490
+ l = c < 0.5 ? f - b : b - f, u = c < 0.5 ? d - p : p - d;
491
491
  }
492
492
  return {
493
- x: N(e.startX, s, i, a, l),
494
- y: N(e.startY, n, r, o, l),
495
- angle: Math.atan2(u, c) * 180 / Math.PI
493
+ x: N(e.startX, s, i, a, c),
494
+ y: N(e.startY, n, r, o, c),
495
+ angle: Math.atan2(u, l) * 180 / Math.PI
496
496
  };
497
497
  }
498
498
  function te(e, t, s = 0, n = e.length) {
@@ -501,20 +501,20 @@ function te(e, t, s = 0, n = e.length) {
501
501
  for (let r = s; r < n; r++) {
502
502
  const a = e[r];
503
503
  if (i + a.length >= t || r === n - 1)
504
- return Xe(a, t - i);
504
+ return Fe(a, t - i);
505
505
  i += a.length;
506
506
  }
507
507
  return { x: 0, y: 0, angle: 0 };
508
508
  }
509
- function Fe(e, t) {
510
- const { segments: s, totalLength: n } = nt(e);
509
+ function Xe(e, t) {
510
+ const { segments: s, totalLength: n } = it(e);
511
511
  return te(s, Math.max(0, Math.min(1, t)) * n);
512
512
  }
513
- const Ye = 24, qe = 320, Ve = 2.5, z = 72, We = 0.2, Be = 128, et = /* @__PURE__ */ new Map();
514
- let ct = 0, X;
513
+ const Ye = 24, qe = 320, Ve = 2.5, G = 72, We = 0.2, Be = 128, st = /* @__PURE__ */ new Map();
514
+ let lt = 0, F;
515
515
  const At = (e) => Math.round(e * 100) / 100;
516
516
  function Pt(e, t) {
517
- const { segments: s, subpaths: n, totalLength: i } = nt(e);
517
+ const { segments: s, subpaths: n, totalLength: i } = it(e);
518
518
  if (s.length === 0) return [];
519
519
  if (t) {
520
520
  const r = n.every((a) => a.closed);
@@ -522,7 +522,7 @@ function Pt(e, t) {
522
522
  }
523
523
  return n.filter((r) => r.length > 0).map((r) => ({ segments: s, start: r.start, end: r.end, length: r.length, closed: r.closed }));
524
524
  }
525
- function yt(e, t) {
525
+ function bt(e, t) {
526
526
  const s = e.closed ? (t % 1 + 1) % 1 : Math.max(0, Math.min(1, t)), n = te(e.segments, s * e.length, e.start, e.end);
527
527
  return [n.x, n.y];
528
528
  }
@@ -536,7 +536,7 @@ function It(e) {
536
536
  function Ct(e, t) {
537
537
  const s = [];
538
538
  for (let n = 0; n < t; n++)
539
- s.push(yt(e, e.closed ? n / t : n / (t - 1)));
539
+ s.push(bt(e, e.closed ? n / t : n / (t - 1)));
540
540
  return s;
541
541
  }
542
542
  function Rt(e) {
@@ -548,18 +548,18 @@ function Rt(e) {
548
548
  function Ue(e, t, s) {
549
549
  const n = e.closed && t.closed;
550
550
  if (s !== void 0)
551
- return { offset: n ? Math.abs(s) % z / z : 0, reversed: s < 0 };
552
- const i = Rt(Ct(e, z)), r = Rt(Ct(t, z)), a = z;
553
- let o = { offset: 0, reversed: !1 }, l = 1 / 0;
554
- for (const c of [!1, !0]) {
551
+ return { offset: n ? Math.abs(s) % G / G : 0, reversed: s < 0 };
552
+ const i = Rt(Ct(e, G)), r = Rt(Ct(t, G)), a = G;
553
+ let o = { offset: 0, reversed: !1 }, c = 1 / 0;
554
+ for (const l of [!1, !0]) {
555
555
  const u = n ? a : 1;
556
556
  for (let h = 0; h < u; h++) {
557
557
  let f = 0;
558
- for (let d = 0; d < a && f < l; d++) {
559
- const k = n ? c ? (h - d + a) % a : (d + h) % a : c ? a - 1 - d : d, p = i[d][0] - r[k][0], m = i[d][1] - r[k][1];
558
+ for (let d = 0; d < a && f < c; d++) {
559
+ const b = n ? l ? (h - d + a) % a : (d + h) % a : l ? a - 1 - d : d, p = i[d][0] - r[b][0], m = i[d][1] - r[b][1];
560
560
  f += p * p + m * m;
561
561
  }
562
- f < l && (l = f, o = { offset: n ? h / a : 0, reversed: c });
562
+ f < c && (c = f, o = { offset: n ? h / a : 0, reversed: l });
563
563
  }
564
564
  }
565
565
  return o;
@@ -578,12 +578,12 @@ function ze(e, t, s) {
578
578
  for (let h = 0; h <= r; h++) o(h / r);
579
579
  for (const h of It(e)) o(h);
580
580
  for (const h of It(t)) o(He(h, i, n));
581
- let l = [...a].sort((h, f) => h - f);
582
- n && (l = l.filter((h) => h < 1));
583
- const c = [], u = [];
584
- for (const h of l)
585
- c.push(...yt(e, h)), u.push(...yt(t, je(h, i, n)));
586
- return Ge({ from: c, to: u, closed: n });
581
+ let c = [...a].sort((h, f) => h - f);
582
+ n && (c = c.filter((h) => h < 1));
583
+ const l = [], u = [];
584
+ for (const h of c)
585
+ l.push(...bt(e, h)), u.push(...bt(t, je(h, i, n)));
586
+ return Ge({ from: l, to: u, closed: n });
587
587
  }
588
588
  function Ge(e) {
589
589
  const t = e.from.length / 2;
@@ -593,12 +593,12 @@ function Ge(e) {
593
593
  const n = [[0, t - 1]];
594
594
  for (; n.length > 0; ) {
595
595
  const [a, o] = n.pop();
596
- let l = -1, c = We;
596
+ let c = -1, l = We;
597
597
  for (let u = a + 1; u < o; u++) {
598
598
  const h = Math.max(Et(e.from, a, o, u), Et(e.to, a, o, u));
599
- h > c && (c = h, l = u);
599
+ h > l && (l = h, c = u);
600
600
  }
601
- l !== -1 && (s[l] = 1, n.push([a, l], [l, o]));
601
+ c !== -1 && (s[c] = 1, n.push([a, c], [c, o]));
602
602
  }
603
603
  const i = [], r = [];
604
604
  for (let a = 0; a < t; a++)
@@ -606,23 +606,23 @@ function Ge(e) {
606
606
  return { from: i, to: r, closed: e.closed };
607
607
  }
608
608
  function Et(e, t, s, n) {
609
- const i = e[t * 2], r = e[t * 2 + 1], a = e[s * 2] - i, o = e[s * 2 + 1] - r, l = e[n * 2] - i, c = e[n * 2 + 1] - r, u = a * a + o * o, h = u === 0 ? 0 : Math.max(0, Math.min(1, (l * a + c * o) / u));
610
- return Math.hypot(l - h * a, c - h * o);
609
+ const i = e[t * 2], r = e[t * 2 + 1], a = e[s * 2] - i, o = e[s * 2 + 1] - r, c = e[n * 2] - i, l = e[n * 2 + 1] - r, u = a * a + o * o, h = u === 0 ? 0 : Math.max(0, Math.min(1, (c * a + l * o) / u));
610
+ return Math.hypot(c - h * a, l - h * o);
611
611
  }
612
612
  function Qe(e, t, s) {
613
613
  const n = s.shapeIndex;
614
- if (X && X.from === e && X.to === t && X.shapeIndex === n) return X.plan;
615
- const r = et.get(String(n ?? "auto"))?.get(e)?.get(t);
614
+ if (F && F.from === e && F.to === t && F.shapeIndex === n) return F.plan;
615
+ const r = st.get(String(n ?? "auto"))?.get(e)?.get(t);
616
616
  if (r)
617
- return X = { from: e, to: t, shapeIndex: n, plan: r }, r;
618
- const a = nt(e).subpaths.filter((d) => d.length > 0).length === nt(t).subpaths.filter((d) => d.length > 0).length, o = Pt(e, !a), l = Pt(t, !a), c = {
619
- pairs: o.map((d, k) => ze(d, l[k], s))
617
+ return F = { from: e, to: t, shapeIndex: n, plan: r }, r;
618
+ const a = it(e).subpaths.filter((d) => d.length > 0).length === it(t).subpaths.filter((d) => d.length > 0).length, o = Pt(e, !a), c = Pt(t, !a), l = {
619
+ pairs: o.map((d, b) => ze(d, c[b], s))
620
620
  };
621
- ct >= Be && (et.clear(), ct = 0);
622
- const u = String(n ?? "auto"), h = et.get(u) ?? /* @__PURE__ */ new Map();
623
- et.set(u, h);
621
+ lt >= Be && (st.clear(), lt = 0);
622
+ const u = String(n ?? "auto"), h = st.get(u) ?? /* @__PURE__ */ new Map();
623
+ st.set(u, h);
624
624
  const f = h.get(e) ?? /* @__PURE__ */ new Map();
625
- return h.set(e, f), f.set(t, c), ct++, X = { from: e, to: t, shapeIndex: n, plan: c }, c;
625
+ return h.set(e, f), f.set(t, l), lt++, F = { from: e, to: t, shapeIndex: n, plan: l }, l;
626
626
  }
627
627
  function Ze(e, t, s, n = {}) {
628
628
  if (!e) return t;
@@ -634,9 +634,9 @@ function Ze(e, t, s, n = {}) {
634
634
  if (r.pairs.length === 0) return i < 0.5 ? e : t;
635
635
  let a = "";
636
636
  for (const o of r.pairs) {
637
- for (let l = 0; l < o.from.length; l += 2) {
638
- const c = At(o.from[l] + (o.to[l] - o.from[l]) * i), u = At(o.from[l + 1] + (o.to[l + 1] - o.from[l + 1]) * i);
639
- a += `${l === 0 ? a ? " M" : "M" : " L"}${c} ${u}`;
637
+ for (let c = 0; c < o.from.length; c += 2) {
638
+ const l = At(o.from[c] + (o.to[c] - o.from[c]) * i), u = At(o.from[c + 1] + (o.to[c + 1] - o.from[c + 1]) * i);
639
+ a += `${c === 0 ? a ? " M" : "M" : " L"}${l} ${u}`;
640
640
  }
641
641
  o.closed && (a += " Z");
642
642
  }
@@ -645,39 +645,39 @@ function Ze(e, t, s, n = {}) {
645
645
  function Ke(e) {
646
646
  return /^\s*[Mm]\s*[-+]?(?:\d|\.\d)/.test(e);
647
647
  }
648
- const L = (e, t, s) => e + (t - e) * s, ee = 512, lt = /* @__PURE__ */ new Map(), ht = /* @__PURE__ */ new Map();
648
+ const L = (e, t, s) => e + (t - e) * s, ee = 512, ht = /* @__PURE__ */ new Map(), ut = /* @__PURE__ */ new Map();
649
649
  function $t(e) {
650
- const t = lt.get(e);
650
+ const t = ht.get(e);
651
651
  if (t) return t;
652
652
  const s = e.replace("#", ""), n = [
653
653
  parseInt(s.slice(0, 2), 16),
654
654
  parseInt(s.slice(2, 4), 16),
655
655
  parseInt(s.slice(4, 6), 16)
656
656
  ];
657
- return lt.size < ee && lt.set(e, n), n;
657
+ return ht.size < ee && ht.set(e, n), n;
658
658
  }
659
- const Dt = (e) => e.charCodeAt(0) === 35, Ot = (e) => e.startsWith("rgb"), Lt = (e) => e.startsWith("rgba"), Je = /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/, ut = (e) => Math.round(e).toString(16).padStart(2, "0");
659
+ const Dt = (e) => e.charCodeAt(0) === 35, Ot = (e) => e.startsWith("rgb"), Lt = (e) => e.startsWith("rgba"), Je = /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/, ft = (e) => Math.round(e).toString(16).padStart(2, "0");
660
660
  function ts(e, t, s) {
661
- return `#${ut(e)}${ut(t)}${ut(s)}`;
661
+ return `#${ft(e)}${ft(t)}${ft(s)}`;
662
662
  }
663
663
  function Nt(e) {
664
- const t = ht.get(e);
664
+ const t = ut.get(e);
665
665
  if (t) return t;
666
666
  const s = e.match(Je);
667
667
  if (!s)
668
668
  throw new Error(`Invalid rgb color: ${e}`);
669
669
  const n = parseInt(s[1], 10), i = parseInt(s[2], 10), r = parseInt(s[3], 10), a = s[4] !== void 0 ? [n, i, r, parseFloat(s[4])] : [n, i, r];
670
- return ht.size < ee && ht.set(e, a), a;
670
+ return ut.size < ee && ut.set(e, a), a;
671
671
  }
672
672
  const es = (e, t, s) => {
673
673
  if (Dt(e) && Dt(t)) {
674
- const [n, i, r] = $t(e), [a, o, l] = $t(t), c = L(n, a, s), u = L(i, o, s), h = L(r, l, s);
675
- return ts(c, u, h);
674
+ const [n, i, r] = $t(e), [a, o, c] = $t(t), l = L(n, a, s), u = L(i, o, s), h = L(r, c, s);
675
+ return ts(l, u, h);
676
676
  }
677
677
  if ((Ot(e) || Lt(e)) && (Ot(t) || Lt(t))) {
678
678
  const n = Nt(e), i = Nt(t), r = Math.round(L(n[0], i[0], s)), a = Math.round(L(n[1], i[1], s)), o = Math.round(L(n[2], i[2], s));
679
679
  if (n.length === 4 || i.length === 4) {
680
- const l = n[3] ?? 1, c = i[3] ?? 1, u = L(l, c, s);
680
+ const c = n[3] ?? 1, l = i[3] ?? 1, u = L(c, l, s);
681
681
  return `rgba(${r}, ${a}, ${o}, ${u})`;
682
682
  }
683
683
  return `rgb(${r}, ${a}, ${o})`;
@@ -688,9 +688,9 @@ const es = (e, t, s) => {
688
688
  for (let r = 0; r < n; r++)
689
689
  i.push(L(e[r], t[r], s));
690
690
  return i;
691
- }, Xt = (e, t, s) => s < 1 ? e : t, ns = (e, t, s) => Ze(e, t, s);
691
+ }, Ft = (e, t, s) => s < 1 ? e : t, ns = (e, t, s) => Ze(e, t, s);
692
692
  function is(e) {
693
- return typeof e == "number" ? L : Array.isArray(e) ? ss : typeof e == "string" ? e.startsWith("#") || e.startsWith("rgb") ? es : Ke(e) ? ns : Xt : Xt;
693
+ return typeof e == "number" ? L : Array.isArray(e) ? ss : typeof e == "string" ? e.startsWith("#") || e.startsWith("rgb") ? es : Ke(e) ? ns : Ft : Ft;
694
694
  }
695
695
  function rs(e) {
696
696
  const t = [...e.keyframes].sort((s, n) => s.time - n.time);
@@ -699,18 +699,18 @@ function rs(e) {
699
699
  keyframes: t
700
700
  };
701
701
  }
702
- function F(e) {
702
+ function X(e) {
703
703
  return e.targets && e.targets.length > 0 ? e.targets : [e.target];
704
704
  }
705
- function V(e, t, s, n) {
705
+ function W(e, t, s, n) {
706
706
  const i = s ?? 0;
707
707
  return !n || t <= 1 ? i : i + Ht(e, t, n);
708
708
  }
709
- class ft {
709
+ class dt {
710
710
  track;
711
711
  targets;
712
712
  constructor(t) {
713
- this.track = t, this.targets = F(t);
713
+ this.track = t, this.targets = X(t);
714
714
  }
715
715
  /**
716
716
  * Get the interpolated value at a specific time.
@@ -719,7 +719,7 @@ class ft {
719
719
  * that need every target should use `getTargetValues`.
720
720
  */
721
721
  getValueAtTime(t) {
722
- return this.valueForOffset(t - V(0, this.targets.length, this.track.delay, this.track.stagger));
722
+ return this.valueForOffset(t - W(0, this.targets.length, this.track.delay, this.track.stagger));
723
723
  }
724
724
  /**
725
725
  * Every target's value at a specific time, in target order.
@@ -730,7 +730,7 @@ class ft {
730
730
  getTargetValues(t) {
731
731
  const s = this.targets.length, n = [];
732
732
  for (let i = 0; i < s; i++) {
733
- const r = V(i, s, this.track.delay, this.track.stagger), a = this.valueForOffset(t - r);
733
+ const r = W(i, s, this.track.delay, this.track.stagger), a = this.valueForOffset(t - r);
734
734
  a !== void 0 && n.push({ target: this.targets[i], value: a, start: r + this.track.keyframes[0].time });
735
735
  }
736
736
  return n;
@@ -743,7 +743,7 @@ class ft {
743
743
  const { keyframes: t } = this.track;
744
744
  if (t.length === 0)
745
745
  return 0;
746
- const s = t[t.length - 1].time, n = this.track.stagger ? kt(this.targets.length, this.track.stagger) : 0;
746
+ const s = t[t.length - 1].time, n = this.track.stagger ? Mt(this.targets.length, this.track.stagger) : 0;
747
747
  return s + (this.track.delay ?? 0) + n + (this.track.endDelay ?? 0);
748
748
  }
749
749
  /**
@@ -766,8 +766,8 @@ class ft {
766
766
  return;
767
767
  if (n.time === t)
768
768
  return n.value;
769
- const r = i.time - n.time, a = (t - n.time) / r, l = Ce(i.easing)(a);
770
- return is(n.value)(n.value, i.value, l);
769
+ const r = i.time - n.time, a = (t - n.time) / r, c = Ce(i.easing)(a);
770
+ return is(n.value)(n.value, i.value, c);
771
771
  }
772
772
  /**
773
773
  * Find the keyframes surrounding a given time.
@@ -785,22 +785,22 @@ class as {
785
785
  targets;
786
786
  sampler;
787
787
  constructor(t) {
788
- this.track = t, this.targets = F(t), this.sampler = new ue(t.spring);
788
+ this.track = t, this.targets = X(t), this.sampler = new ue(t.spring);
789
789
  }
790
790
  getValueAtTime(t) {
791
- return this.sampler.valueAt(t - V(0, this.targets.length, this.track.delay, this.track.stagger));
791
+ return this.sampler.valueAt(t - W(0, this.targets.length, this.track.delay, this.track.stagger));
792
792
  }
793
793
  getTargetValues(t) {
794
794
  const s = this.targets.length, n = [];
795
795
  for (let i = 0; i < s; i++) {
796
- const r = V(i, s, this.track.delay, this.track.stagger);
796
+ const r = W(i, s, this.track.delay, this.track.stagger);
797
797
  n.push({ target: this.targets[i], value: this.sampler.valueAt(t - r), start: r });
798
798
  }
799
799
  return n;
800
800
  }
801
801
  /** Settle time plus delay and the widest stagger offset. */
802
802
  getDuration() {
803
- const t = this.track.stagger ? kt(this.targets.length, this.track.stagger) : 0;
803
+ const t = this.track.stagger ? Mt(this.targets.length, this.track.stagger) : 0;
804
804
  return this.sampler.settleTime() + (this.track.delay ?? 0) + t;
805
805
  }
806
806
  getTrack() {
@@ -812,22 +812,22 @@ class os {
812
812
  targets;
813
813
  duration;
814
814
  constructor(t) {
815
- this.track = t, this.targets = F(t), this.duration = Qt(t.inertia);
815
+ this.track = t, this.targets = X(t), this.duration = Qt(t.inertia);
816
816
  }
817
817
  getValueAtTime(t) {
818
- return xt(this.track.inertia, t - V(0, this.targets.length, this.track.delay, this.track.stagger));
818
+ return xt(this.track.inertia, t - W(0, this.targets.length, this.track.delay, this.track.stagger));
819
819
  }
820
820
  getTargetValues(t) {
821
821
  const s = this.targets.length, n = [];
822
822
  for (let i = 0; i < s; i++) {
823
- const r = V(i, s, this.track.delay, this.track.stagger);
823
+ const r = W(i, s, this.track.delay, this.track.stagger);
824
824
  n.push({ target: this.targets[i], value: xt(this.track.inertia, t - r), start: r });
825
825
  }
826
826
  return n;
827
827
  }
828
828
  /** Settle time plus delay and the widest stagger offset. */
829
829
  getDuration() {
830
- const t = this.track.stagger ? kt(this.targets.length, this.track.stagger) : 0;
830
+ const t = this.track.stagger ? Mt(this.targets.length, this.track.stagger) : 0;
831
831
  return this.duration + (this.track.delay ?? 0) + t;
832
832
  }
833
833
  getTrack() {
@@ -835,24 +835,24 @@ class os {
835
835
  }
836
836
  }
837
837
  function cs(e, t) {
838
- const s = { ...Fe(e.pathData, t) };
838
+ const s = { ...Xe(e.pathData, t) };
839
839
  if (e.matrix) {
840
- const [n, i, r, a, o, l] = e.matrix, { x: c, y: u } = s;
841
- s.x = n * c + r * u + o, s.y = i * c + a * u + l;
840
+ const [n, i, r, a, o, c] = e.matrix, { x: l, y: u } = s;
841
+ s.x = n * l + r * u + o, s.y = i * l + a * u + c;
842
842
  const h = s.angle * Math.PI / 180, f = Math.cos(h), d = Math.sin(h);
843
843
  s.angle = Math.atan2(i * f + a * d, n * f + r * d) * 180 / Math.PI;
844
844
  }
845
845
  return e.autoRotate && e.rotateOffset && (s.angle += e.rotateOffset), s;
846
846
  }
847
- const dt = {
847
+ const pt = {
848
848
  upperCase: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
849
849
  lowerCase: "abcdefghijklmnopqrstuvwxyz",
850
850
  upperAndLowerCase: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
851
851
  numbers: "0123456789"
852
852
  }, ls = 20;
853
853
  function hs(e) {
854
- const t = dt[e ?? "upperCase"] ?? e ?? dt.upperCase, s = Array.from(t);
855
- return s.length > 0 ? s : Array.from(dt.upperCase);
854
+ const t = pt[e ?? "upperCase"] ?? e ?? pt.upperCase, s = Array.from(t);
855
+ return s.length > 0 ? s : Array.from(pt.upperCase);
856
856
  }
857
857
  function us(e, t, s) {
858
858
  let n = (e | 0) ^ Math.imul(t + 1, 2654435761) ^ Math.imul(s + 1, 2246822507);
@@ -862,25 +862,24 @@ function fs(e, t, s = 0) {
862
862
  const n = e.from ?? "", i = e.to, r = Math.max(0, Math.min(1, t));
863
863
  if (r <= 0) return n;
864
864
  if (r >= 1) return i;
865
- const a = Array.from(n), o = Array.from(i), l = e.rightToLeft ?? !1;
865
+ const a = Array.from(n), o = Array.from(i), c = e.rightToLeft ?? !1;
866
866
  if (e.mode === "type") {
867
- const b = Math.round(r * Math.max(a.length, o.length));
868
- return l ? 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("");
867
+ const y = Math.round(r * Math.max(a.length, o.length));
868
+ return c ? a.slice(0, Math.max(0, a.length - y)).join("") + o.slice(Math.max(0, o.length - y)).join("") : o.slice(0, y).join("") + a.slice(y).join("");
869
869
  }
870
- const c = Math.max(0, Math.min(0.999, e.revealDelay ?? 0)), u = Math.max(0, (r - c) / (1 - c)), h = Math.floor(u * o.length), f = e.tweenLength === !1 ? o.length : Math.round(a.length + (o.length - a.length) * r), d = hs(e.chars), k = e.refreshRate ?? ls, p = k > 0 ? Math.floor(s * k / 1e3) : 0, m = e.seed ?? 1;
871
- let y = "";
872
- for (let b = 0; b < f; b++) {
873
- const T = l ? b >= f - h : b < h, x = l ? o[o.length - (f - b)] : o[b];
874
- T && x !== void 0 || x === " " || x === `
875
- ` ? y += x : y += d[us(m, b, p) % d.length];
870
+ const l = Math.max(0, Math.min(0.999, e.revealDelay ?? 0)), u = Math.max(0, (r - l) / (1 - l)), h = Math.floor(u * o.length), f = e.tweenLength === !1 ? o.length : Math.round(a.length + (o.length - a.length) * r), d = hs(e.chars), b = e.refreshRate ?? ls, p = b > 0 ? Math.floor(s * b / 1e3) : 0, m = e.seed ?? 1;
871
+ let k = "";
872
+ for (let y = 0; y < f; y++) {
873
+ const T = c ? y >= f - h : y < h, w = c ? o[o.length - (f - y)] : o[y];
874
+ T && w !== void 0 || w === " " || w === `
875
+ ` ? k += w : k += d[us(m, y, p) % d.length];
876
876
  }
877
- return y;
877
+ return k;
878
878
  }
879
879
  class ds {
880
880
  id;
881
881
  name;
882
- /** Caption text per language, per marker id */
883
- captions;
882
+ _captions;
884
883
  _tracks = [];
885
884
  _trackPlayers = /* @__PURE__ */ new Map();
886
885
  _motionPathTracks = /* @__PURE__ */ new Map();
@@ -902,7 +901,7 @@ class ds {
902
901
  onUpdate = null;
903
902
  onComplete = null;
904
903
  constructor(t) {
905
- if (this.id = t.id, this.name = t.name, this.captions = t.captions, this._config = t.config ?? {}, this._explicitDuration = t.config?.duration, t.tracks)
904
+ if (this.id = t.id, this.name = t.name, this._captions = t.captions, this._config = t.config ?? {}, this._explicitDuration = t.config?.duration, t.tracks)
906
905
  for (const s of t.tracks)
907
906
  this.addTrack(s);
908
907
  }
@@ -1002,16 +1001,16 @@ class ds {
1002
1001
  const r = 1e3;
1003
1002
  for (let o = 0; o < r && i > 0 && this._playbackState === "playing"; o++)
1004
1003
  if (this._direction === "forward") {
1005
- const l = s - this._currentTime;
1006
- if (i >= l) {
1007
- if (i -= l, this._currentTime = s, !this._handleEndReached())
1004
+ const c = s - this._currentTime;
1005
+ if (i >= c) {
1006
+ if (i -= c, this._currentTime = s, !this._handleEndReached())
1008
1007
  break;
1009
1008
  } else
1010
1009
  this._currentTime += i, i = 0;
1011
1010
  } else {
1012
- const l = this._currentTime;
1013
- if (i >= l) {
1014
- if (i -= l, this._currentTime = 0, !this._handleStartReached())
1011
+ const c = this._currentTime;
1012
+ if (i >= c) {
1013
+ if (i -= c, this._currentTime = 0, !this._handleStartReached())
1015
1014
  break;
1016
1015
  } else
1017
1016
  this._currentTime -= i, i = 0;
@@ -1029,8 +1028,8 @@ class ds {
1029
1028
  else
1030
1029
  for (const [n, i] of this._trackPlayers) {
1031
1030
  const r = i.getTrack().property;
1032
- for (const { target: a, value: o, start: l } of i.getTargetValues(t))
1033
- this._write(s, n, a, r, o, t - l);
1031
+ for (const { target: a, value: o, start: c } of i.getTargetValues(t))
1032
+ this._write(s, n, a, r, o, t - c);
1034
1033
  }
1035
1034
  return {
1036
1035
  values: s,
@@ -1057,13 +1056,13 @@ class ds {
1057
1056
  const n = /* @__PURE__ */ new Map();
1058
1057
  for (const [i, r] of this._trackPlayers) {
1059
1058
  const a = r.getTrack().property;
1060
- for (const { target: o, value: l, start: c } of r.getTargetValues(t)) {
1061
- const u = `${o}\0${a}`, h = c <= t, f = n.get(u);
1062
- (!f || (h !== f.started ? h : h ? c >= f.start : c <= f.start)) && n.set(u, { trackId: i, target: o, property: a, value: l, start: c, started: h });
1059
+ for (const { target: o, value: c, start: l } of r.getTargetValues(t)) {
1060
+ const u = `${o}\0${a}`, h = l <= t, f = n.get(u);
1061
+ (!f || (h !== f.started ? h : h ? l >= f.start : l <= f.start)) && n.set(u, { trackId: i, target: o, property: a, value: c, start: l, started: h });
1063
1062
  }
1064
1063
  }
1065
- for (const { trackId: i, target: r, property: a, value: o, start: l } of n.values())
1066
- this._write(s, i, r, a, o, t - l);
1064
+ for (const { trackId: i, target: r, property: a, value: o, start: c } of n.values())
1065
+ this._write(s, i, r, a, o, t - c);
1067
1066
  }
1068
1067
  /**
1069
1068
  * Write one track's value for a target, expanding the progress of motion paths
@@ -1074,15 +1073,15 @@ class ds {
1074
1073
  if (r === void 0) return;
1075
1074
  let o = t.get(n);
1076
1075
  o || (o = /* @__PURE__ */ new Map(), t.set(n, o));
1077
- const l = this._textTracks.get(s);
1078
- if (l && typeof r == "number") {
1079
- o.set("text", fs(l.textConfig, r, Math.max(0, a)));
1076
+ const c = this._textTracks.get(s);
1077
+ if (c && typeof r == "number") {
1078
+ o.set("text", fs(c.textConfig, r, Math.max(0, a)));
1080
1079
  return;
1081
1080
  }
1082
- const c = this._motionPathTracks.get(s);
1083
- if (c && typeof r == "number") {
1084
- const u = cs(c.motionPathConfig, r);
1085
- o.set("motionPathX", u.x), o.set("motionPathY", u.y), c.motionPathConfig.autoRotate && o.set("motionPathRotate", u.angle);
1081
+ const l = this._motionPathTracks.get(s);
1082
+ if (l && typeof r == "number") {
1083
+ const u = cs(l.motionPathConfig, r);
1084
+ o.set("motionPathX", u.x), o.set("motionPathY", u.y), l.motionPathConfig.autoRotate && o.set("motionPathRotate", u.angle);
1086
1085
  } else
1087
1086
  o.set(i, r);
1088
1087
  }
@@ -1093,7 +1092,7 @@ class ds {
1093
1092
  const t = /* @__PURE__ */ new Set();
1094
1093
  this._sharedWrites = !1;
1095
1094
  t: for (const s of this._tracks)
1096
- for (const n of F(s)) {
1095
+ for (const n of X(s)) {
1097
1096
  const i = `${n}\0${s.property}`;
1098
1097
  if (t.has(i)) {
1099
1098
  this._sharedWrites = !0;
@@ -1108,16 +1107,16 @@ class ds {
1108
1107
  * Add a track to the timeline.
1109
1108
  */
1110
1109
  addTrack(t) {
1111
- if (this._tracks.push(t), this._sharedWrites = null, pt(t)) {
1110
+ if (this._tracks.push(t), this._sharedWrites = null, mt(t)) {
1112
1111
  this._trackPlayers.set(t.id, new os(t));
1113
1112
  return;
1114
1113
  }
1115
- if (mt(t)) {
1114
+ if (gt(t)) {
1116
1115
  this._trackPlayers.set(t.id, new as(t)), this._springTracks.set(t.id, t);
1117
1116
  return;
1118
1117
  }
1119
1118
  if (Ut(t))
1120
- this._trackPlayers.set(t.id, new ft(t)), this._textTracks.set(t.id, t);
1119
+ this._trackPlayers.set(t.id, new dt(t)), this._textTracks.set(t.id, t);
1121
1120
  else if (ce(t)) {
1122
1121
  const s = {
1123
1122
  id: t.id,
@@ -1129,9 +1128,9 @@ class ds {
1129
1128
  targets: t.targets,
1130
1129
  stagger: t.stagger
1131
1130
  };
1132
- this._trackPlayers.set(t.id, new ft(s)), this._motionPathTracks.set(t.id, t);
1131
+ this._trackPlayers.set(t.id, new dt(s)), this._motionPathTracks.set(t.id, t);
1133
1132
  } else
1134
- this._trackPlayers.set(t.id, new ft(t));
1133
+ this._trackPlayers.set(t.id, new dt(t));
1135
1134
  }
1136
1135
  /**
1137
1136
  * Replace a track with a new version, keeping its place in the track order
@@ -1182,7 +1181,7 @@ class ds {
1182
1181
  const s = this._trackPlayers.get(t);
1183
1182
  if (!s) return;
1184
1183
  const n = s.getTrack(), i = n.delay ?? 0;
1185
- if (mt(n) || pt(n))
1184
+ if (gt(n) || mt(n))
1186
1185
  return { from: i, to: s.getDuration() };
1187
1186
  const r = n.keyframes;
1188
1187
  if (!(!r || r.length === 0))
@@ -1204,11 +1203,11 @@ class ds {
1204
1203
  for (let r = 0; r < s; r++) {
1205
1204
  const a = this._tracks[r];
1206
1205
  if (a.property !== n.property) continue;
1207
- const o = F(a).filter((h) => F(n).includes(h));
1206
+ const o = X(a).filter((h) => X(n).includes(h));
1208
1207
  if (o.length === 0) continue;
1209
- const l = this.getTrackSpan(a.id);
1210
- if (!l || !(l.from <= i.to && i.from <= l.to)) continue;
1211
- const u = i.from >= l.from;
1208
+ const c = this.getTrackSpan(a.id);
1209
+ if (!c || !(c.from <= i.to && i.from <= c.to)) continue;
1210
+ const u = i.from >= c.from;
1212
1211
  for (const h of o)
1213
1212
  t.push({
1214
1213
  target: h,
@@ -1221,7 +1220,7 @@ class ds {
1221
1220
  return t;
1222
1221
  }
1223
1222
  _matches(t, s) {
1224
- if (s.id !== void 0 && t.id !== s.id || s.property !== void 0 && t.property !== s.property || s.target !== void 0 && !F(t).includes(s.target)) return !1;
1223
+ if (s.id !== void 0 && t.id !== s.id || s.property !== void 0 && t.property !== s.property || s.target !== void 0 && !X(t).includes(s.target)) return !1;
1225
1224
  if (s.timeRange) {
1226
1225
  const n = this.getTrackSpan(t.id);
1227
1226
  if (!n || n.to < s.timeRange.from || n.from > s.timeRange.to) return !1;
@@ -1233,7 +1232,7 @@ class ds {
1233
1232
  */
1234
1233
  toDefinition() {
1235
1234
  return {
1236
- formatVersion: Z,
1235
+ formatVersion: K,
1237
1236
  id: this.id,
1238
1237
  name: this.name,
1239
1238
  config: { ...this._config },
@@ -1249,6 +1248,21 @@ class ds {
1249
1248
  get markers() {
1250
1249
  return [...this._config.markers ?? []].sort((t, s) => t.time - s.time);
1251
1250
  }
1251
+ /** Replace the markers (kept in time order); an empty list removes them. */
1252
+ setMarkers(t) {
1253
+ const s = t && t.length > 0 ? [...t].sort((i, r) => i.time - r.time).map((i) => ({ ...i })) : void 0, n = { ...this._config };
1254
+ s ? n.markers = s : delete n.markers, this._config = n;
1255
+ }
1256
+ /** Caption text per language, per marker id */
1257
+ get captions() {
1258
+ return this._captions;
1259
+ }
1260
+ /** Replace the captions; languages with no captions are dropped. */
1261
+ setCaptions(t) {
1262
+ const s = {};
1263
+ for (const [n, i] of Object.entries(t ?? {})) s[n] = { ...i };
1264
+ this._captions = Object.keys(s).length > 0 ? s : void 0;
1265
+ }
1252
1266
  /** Start the between-iterations pause, if the timeline configures one. */
1253
1267
  _armRepeatDelay() {
1254
1268
  this._repeatDelayRemaining = this._config.repeatDelay ?? 0;
@@ -1278,26 +1292,26 @@ class ds {
1278
1292
  }
1279
1293
  const ps = 100;
1280
1294
  function ms(e, t, s, n) {
1281
- const i = [], r = [], { duration: a, alternate: o } = n, l = (d, k, p, m) => {
1282
- r.push([d, k]);
1283
- const y = [];
1284
- e.forEach((b, T) => {
1285
- (p === "forward" ? (m ? b >= d : b > d) && b <= k : (m ? b <= d : b < d) && b >= k) && y.push(T);
1286
- }), y.sort((b, T) => (p === "forward" ? e[b] - e[T] : e[T] - e[b]) || b - T);
1287
- for (const b of y) i.push({ kind: "event", index: b, direction: p });
1295
+ const i = [], r = [], { duration: a, alternate: o } = n, c = (d, b, p, m) => {
1296
+ r.push([d, b]);
1297
+ const k = [];
1298
+ e.forEach((y, T) => {
1299
+ (p === "forward" ? (m ? y >= d : y > d) && y <= b : (m ? y <= d : y < d) && y >= b) && k.push(T);
1300
+ }), k.sort((y, T) => (p === "forward" ? e[y] - e[T] : e[T] - e[y]) || y - T);
1301
+ for (const y of k) i.push({ kind: "event", index: y, direction: p });
1288
1302
  };
1289
- let c = t.time, u = t.direction, h = t.fresh === !0;
1303
+ let l = t.time, u = t.direction, h = t.fresh === !0;
1290
1304
  const f = Math.min(ps, Math.max(0, s.iteration - t.iteration));
1291
1305
  for (let d = 0; d < f; d++) {
1292
- const k = u === "forward" ? a : 0;
1293
- l(c, k, u, h), i.push({ kind: "repeat" }), o ? (u = u === "forward" ? "reverse" : "forward", c = k, h = !1) : (c = u === "forward" ? 0 : a, h = !0);
1306
+ const b = u === "forward" ? a : 0;
1307
+ c(l, b, u, h), i.push({ kind: "repeat" }), o ? (u = u === "forward" ? "reverse" : "forward", l = b, h = !1) : (l = u === "forward" ? 0 : a, h = !0);
1294
1308
  }
1295
- return f > 0 && n.holding && !o ? { crossings: i, passes: r } : (l(c, s.time, u, h), { crossings: i, passes: r });
1309
+ return f > 0 && n.holding && !o ? { crossings: i, passes: r } : (c(l, s.time, u, h), { crossings: i, passes: r });
1296
1310
  }
1297
1311
  function gs(e) {
1298
1312
  return { ...e, ...Array.isArray(e.end) && { end: [...e.end] } };
1299
1313
  }
1300
- function G(e) {
1314
+ function Q(e) {
1301
1315
  const t = e.endDelay;
1302
1316
  return {
1303
1317
  ...e.delay !== void 0 && { delay: e.delay },
@@ -1307,7 +1321,7 @@ function G(e) {
1307
1321
  };
1308
1322
  }
1309
1323
  function ys(e) {
1310
- if (pt(e)) {
1324
+ if (mt(e)) {
1311
1325
  const t = e;
1312
1326
  return {
1313
1327
  id: t.id,
@@ -1315,10 +1329,10 @@ function ys(e) {
1315
1329
  property: t.property,
1316
1330
  kind: "inertia",
1317
1331
  inertia: gs(t.inertia),
1318
- ...G(t)
1332
+ ...Q(t)
1319
1333
  };
1320
1334
  }
1321
- if (mt(e)) {
1335
+ if (gt(e)) {
1322
1336
  const t = e;
1323
1337
  return {
1324
1338
  id: t.id,
@@ -1326,7 +1340,7 @@ function ys(e) {
1326
1340
  property: t.property,
1327
1341
  kind: "spring",
1328
1342
  spring: { ...t.spring },
1329
- ...G(t)
1343
+ ...Q(t)
1330
1344
  };
1331
1345
  }
1332
1346
  if (Ut(e)) {
@@ -1337,7 +1351,7 @@ function ys(e) {
1337
1351
  property: "text",
1338
1352
  textConfig: { ...t.textConfig },
1339
1353
  keyframes: [...t.keyframes].sort((s, n) => s.time - n.time),
1340
- ...G(t)
1354
+ ...Q(t)
1341
1355
  };
1342
1356
  }
1343
1357
  if (e.property === "motionPath" && "motionPathConfig" in e) {
@@ -1348,7 +1362,7 @@ function ys(e) {
1348
1362
  property: "motionPath",
1349
1363
  motionPathConfig: { ...t.motionPathConfig },
1350
1364
  keyframes: s,
1351
- ...G(t)
1365
+ ...Q(t)
1352
1366
  };
1353
1367
  }
1354
1368
  return rs({
@@ -1356,14 +1370,14 @@ function ys(e) {
1356
1370
  target: e.target,
1357
1371
  property: e.property,
1358
1372
  keyframes: e.keyframes,
1359
- ...G(e)
1373
+ ...Q(e)
1360
1374
  });
1361
1375
  }
1362
- function it(e) {
1376
+ function rt(e) {
1363
1377
  const t = e.formatVersion ?? 1;
1364
- if (t > Z)
1378
+ if (t > K)
1365
1379
  throw new Error(
1366
- `tinyfly: this animation uses format version ${t}, but this tinyfly reads up to version ${Z}. Update tinyfly to play it.`
1380
+ `tinyfly: this animation uses format version ${t}, but this tinyfly reads up to version ${K}. Update tinyfly to play it.`
1367
1381
  );
1368
1382
  return new ds({
1369
1383
  id: e.id,
@@ -1405,7 +1419,7 @@ function ws(e) {
1405
1419
  const t = e.style;
1406
1420
  !t || t.transformBox || (t.transformBox = "fill-box", t.transformOrigin || (t.transformOrigin = "50% 50%"));
1407
1421
  }
1408
- const Ft = /* @__PURE__ */ new Set([
1422
+ const Xt = /* @__PURE__ */ new Set([
1409
1423
  "width",
1410
1424
  "height",
1411
1425
  "top",
@@ -1465,7 +1479,7 @@ const Ft = /* @__PURE__ */ new Set([
1465
1479
  fillOpacity: "fillOpacity",
1466
1480
  strokeOpacity: "strokeOpacity"
1467
1481
  }, Ps = "http://www.w3.org/2000/svg";
1468
- class bt {
1482
+ class kt {
1469
1483
  targets = /* @__PURE__ */ new Map();
1470
1484
  /**
1471
1485
  * Register an HTML element as an animation target.
@@ -1506,12 +1520,12 @@ class bt {
1506
1520
  applyProperties(t, s) {
1507
1521
  const n = [];
1508
1522
  let i = null, r = null, a = null;
1509
- const o = s.has("motionPathX"), l = s.has("motionPathY"), c = s.has("motionPathRotate");
1523
+ const o = s.has("motionPathX"), c = s.has("motionPathY"), l = s.has("motionPathRotate");
1510
1524
  for (const [f, d] of s)
1511
- if (!(f === "x" && o) && !(f === "y" && l) && !((f === "rotate" || f === "rotateZ") && c)) {
1525
+ if (!(f === "x" && o) && !(f === "y" && c) && !((f === "rotate" || f === "rotateZ") && l)) {
1512
1526
  if (xs.has(f)) {
1513
- const k = this.buildTransformPart(f, d);
1514
- k && n.push(k);
1527
+ const b = this.buildTransformPart(f, d);
1528
+ b && n.push(b);
1515
1529
  } else if (_s.has(f))
1516
1530
  typeof d == "number" && ((i ??= {})[f] = d);
1517
1531
  else if (vs.has(f))
@@ -1522,8 +1536,8 @@ class bt {
1522
1536
  if (f !== "shine") if (f === "text" && typeof d == "string")
1523
1537
  Ss(t, d);
1524
1538
  else if (f === "d" && typeof d == "string") {
1525
- const k = t;
1526
- (k.tagName?.toLowerCase() === "path" ? k : k.querySelector?.("path"))?.setAttribute?.("d", d);
1539
+ const b = t;
1540
+ (b.tagName?.toLowerCase() === "path" ? b : b.querySelector?.("path"))?.setAttribute?.("d", d);
1527
1541
  } else
1528
1542
  this.applyStyleProperty(t, f, d);
1529
1543
  }
@@ -1536,8 +1550,8 @@ class bt {
1536
1550
  t.style.transformOrigin = `${f}% ${d}%`;
1537
1551
  }
1538
1552
  if (r) {
1539
- const f = r.clipTop ?? 0, d = r.clipRight ?? 0, k = r.clipBottom ?? 0, p = r.clipLeft ?? 0;
1540
- t.style.clipPath = `inset(${f}% ${d}% ${k}% ${p}%)`;
1553
+ const f = r.clipTop ?? 0, d = r.clipRight ?? 0, b = r.clipBottom ?? 0, p = r.clipLeft ?? 0;
1554
+ t.style.clipPath = `inset(${f}% ${d}% ${b}% ${p}%)`;
1541
1555
  }
1542
1556
  if (a) {
1543
1557
  const f = Ts(a);
@@ -1606,7 +1620,7 @@ class bt {
1606
1620
  return;
1607
1621
  } else s === "fill" && t.dataset?.elementType === "text" ? i = "color" : i = As[s] ?? s;
1608
1622
  let a;
1609
- typeof n == "number" ? Ft.has(s) || Ft.has(i) ? a = `${n}px` : a = String(n) : Array.isArray(n) ? a = n.join(", ") : a = n, t.style[i] = a;
1623
+ typeof n == "number" ? Xt.has(s) || Xt.has(i) ? a = `${n}px` : a = String(n) : Array.isArray(n) ? a = n.join(", ") : a = n, t.style[i] = a;
1610
1624
  }
1611
1625
  }
1612
1626
  class qt {
@@ -1656,7 +1670,7 @@ function Is(e, t, s, n, i) {
1656
1670
  }
1657
1671
  e.update(r, n);
1658
1672
  }
1659
- class Tt {
1673
+ class St {
1660
1674
  container;
1661
1675
  timeline = null;
1662
1676
  adapter;
@@ -1692,7 +1706,7 @@ class Tt {
1692
1706
  this.container = n;
1693
1707
  } else
1694
1708
  this.container = t;
1695
- this.options = s, this.adapter = new bt();
1709
+ this.options = s, this.adapter = new kt();
1696
1710
  }
1697
1711
  /**
1698
1712
  * Load animation from a URL or JSON object.
@@ -1706,7 +1720,7 @@ class Tt {
1706
1720
  s = await n.json();
1707
1721
  } else
1708
1722
  s = t;
1709
- this.options.speed !== void 0 && (s.config = { ...s.config, speed: this.options.speed }), this.options.loop !== void 0 && (s.config = { ...s.config, loop: this.options.loop }), this.options.alternate !== void 0 && (s.config = { ...s.config, alternate: this.options.alternate }), this.timeline = it(s), this.markerList = this.timeline.markers, this.lastMarkerId = null, this.options.onComplete && (this.timeline.onComplete = this.options.onComplete), this.options.onUpdate && (this.timeline.onUpdate = this.options.onUpdate), this.autoRegisterTargets(), this.setupSymbolInstances(), this.scanMedia(), this.showInitialFrame(), this.watchReducedMotion(), this.watchVisibility(), this.options.autoplay && !this.reducedMotion && (this.options.playWhenVisible && !this.onScreen ? this.autoplayWhenSeen = !0 : this.play());
1723
+ this.options.speed !== void 0 && (s.config = { ...s.config, speed: this.options.speed }), this.options.loop !== void 0 && (s.config = { ...s.config, loop: this.options.loop }), this.options.alternate !== void 0 && (s.config = { ...s.config, alternate: this.options.alternate }), this.timeline = rt(s), this.markerList = this.timeline.markers, this.lastMarkerId = null, this.options.onComplete && (this.timeline.onComplete = this.options.onComplete), this.options.onUpdate && (this.timeline.onUpdate = this.options.onUpdate), this.autoRegisterTargets(), this.setupSymbolInstances(), this.scanMedia(), this.showInitialFrame(), this.watchReducedMotion(), this.watchVisibility(), this.options.autoplay && !this.reducedMotion && (this.options.playWhenVisible && !this.onScreen ? this.autoplayWhenSeen = !0 : this.play());
1710
1724
  }
1711
1725
  // --- teaching: frames, markers, reduced motion, visibility -----------------
1712
1726
  /**
@@ -1872,11 +1886,11 @@ class Tt {
1872
1886
  if (!i) return;
1873
1887
  const r = s.get(i);
1874
1888
  if (!r || !r.timeline.tracks?.length) return;
1875
- const a = new bt();
1889
+ const a = new kt();
1876
1890
  n.querySelectorAll("[data-tinyfly]").forEach((o) => {
1877
- const l = o.getAttribute("data-tinyfly");
1878
- l && a.registerTarget(l, o);
1879
- }), this.symbolInstances.push({ adapter: a, timeline: it(r.timeline) });
1891
+ const c = o.getAttribute("data-tinyfly");
1892
+ c && a.registerTarget(c, o);
1893
+ }), this.symbolInstances.push({ adapter: a, timeline: rt(r.timeline) });
1880
1894
  });
1881
1895
  }
1882
1896
  /**
@@ -2013,12 +2027,12 @@ class Tt {
2013
2027
  }
2014
2028
  }
2015
2029
  }
2016
- async function Bs(e, t, s = {}) {
2017
- const n = new Tt(e, { ...s, autoplay: !0 });
2030
+ async function Us(e, t, s = {}) {
2031
+ const n = new St(e, { ...s, autoplay: !0 });
2018
2032
  return await n.load(t), n;
2019
2033
  }
2020
- function Us(e, t = {}) {
2021
- return new Tt(e, t);
2034
+ function js(e, t = {}) {
2035
+ return new St(e, t);
2022
2036
  }
2023
2037
  const Cs = {
2024
2038
  play: "Play",
@@ -2030,7 +2044,8 @@ const Cs = {
2030
2044
  speed: "Speed",
2031
2045
  reveal: "Reveal",
2032
2046
  step: "Step",
2033
- of: "of"
2047
+ of: "of",
2048
+ stepFormat: "{index} / {total}"
2034
2049
  }, Vt = "tinyfly-controls-style", Rs = `
2035
2050
  .tf-ctl { --tf-ctl-fg: #1d1d1f; --tf-ctl-bg: #f4f2ee; --tf-ctl-accent: #c2410c; --tf-ctl-radius: 8px;
2036
2051
  font: 14px/1.4 var(--tf-ctl-font, system-ui, sans-serif); color: var(--tf-ctl-fg); margin-top: 8px; }
@@ -2047,6 +2062,9 @@ const Cs = {
2047
2062
  .tf-ctl-caption { margin: 6px 2px 0; min-height: 1.4em; }
2048
2063
  .tf-ctl-question { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 2px 0; font-weight: 600; }
2049
2064
  .tf-ctl-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
2065
+ /* The hidden attribute only hides through the browser's default stylesheet; any rule
2066
+ above that sets display would override it, so enforce it for everything here. */
2067
+ .tf-ctl [hidden] { display: none !important; }
2050
2068
  `;
2051
2069
  function Es(e) {
2052
2070
  if (e.getElementById(Vt)) return;
@@ -2056,64 +2074,64 @@ function Es(e) {
2056
2074
  function $s(e, t, s = {}) {
2057
2075
  const n = t.ownerDocument;
2058
2076
  Es(n);
2059
- const i = { ...Cs, ...s.labels }, r = s.speeds ?? [0.5, 1, 2], a = () => e.markers.length > 0, o = n.createElement("div");
2060
- o.className = "tf-ctl";
2077
+ const i = { ...Cs, ...s.labels }, r = s.speeds ?? [0.5, 1, 2], a = () => e.markers.length > 0, o = () => e.markers.some((M) => M.label !== void 0 || e.caption(M.id) !== void 0), c = n.createElement("div");
2078
+ c.className = "tf-ctl";
2061
2079
  const l = n.createElement("div");
2062
2080
  l.className = "tf-ctl-bar", l.setAttribute("role", "group");
2063
- const c = (M, w, C, D = "") => {
2064
- const R = n.createElement("button");
2065
- return R.type = "button", R.className = `tf-ctl-btn ${D}`.trim(), R.setAttribute("aria-label", M), R.title = M, R.textContent = w, R.addEventListener("click", C), R;
2066
- }, u = c(i.restart, "⟲", () => {
2081
+ const u = (M, v, O, E = "") => {
2082
+ const $ = n.createElement("button");
2083
+ return $.type = "button", $.className = `tf-ctl-btn ${E}`.trim(), $.setAttribute("aria-label", M), $.title = M, $.textContent = v, $.addEventListener("click", O), $;
2084
+ }, h = u(i.restart, "⟲", () => {
2067
2085
  e.pause(), e.seek(0);
2068
- }), h = c(i.prev, "◀", () => e.prev()), f = c(i.play, "▶", () => e.isPlaying ? e.pause() : k(), "tf-ctl-primary"), d = c(i.next, "▶|", () => e.next()), k = () => {
2086
+ }), f = u(i.prev, "◀", () => e.prev()), d = u(i.play, "▶", () => e.isPlaying ? e.pause() : p(), "tf-ctl-primary"), b = u(i.next, "▶|", () => e.next()), p = () => {
2069
2087
  e.currentTime >= e.duration - 0.5 && e.seek(0), e.play();
2070
- }, p = n.createElement("input");
2071
- p.type = "range", p.className = "tf-ctl-scrub", p.min = "0", p.max = "1000", p.step = "1", p.setAttribute("aria-label", i.scrub), p.addEventListener("input", () => {
2072
- e.pause(), e.seek(Number(p.value) / 1e3 * e.duration);
2088
+ }, m = n.createElement("input");
2089
+ m.type = "range", m.className = "tf-ctl-scrub", m.min = "0", m.max = "1000", m.step = "1", m.setAttribute("aria-label", i.scrub), m.addEventListener("input", () => {
2090
+ e.pause(), e.seek(Number(m.value) / 1e3 * e.duration);
2073
2091
  });
2074
- const m = n.createElement("span");
2075
- m.className = "tf-ctl-step";
2092
+ const k = n.createElement("span");
2093
+ k.className = "tf-ctl-step";
2076
2094
  const y = n.createElement("select");
2077
2095
  y.className = "tf-ctl-speed", y.setAttribute("aria-label", i.speed);
2078
2096
  for (const M of r) {
2079
- const w = n.createElement("option");
2080
- w.value = String(M), w.textContent = `${M}×`, M === 1 && (w.selected = !0), y.appendChild(w);
2081
- }
2082
- y.addEventListener("change", () => e.setSpeed(Number(y.value))), l.append(u, h, f, d, p, m), r.length > 0 && l.append(y), o.append(l);
2083
- const b = n.createElement("p");
2084
- b.className = "tf-ctl-caption", b.setAttribute("aria-live", "polite"), s.captions !== !1 && o.append(b);
2085
- const T = n.createElement("div");
2086
- T.className = "tf-ctl-question", T.hidden = !0;
2087
- const x = n.createElement("span"), g = c(i.reveal, i.reveal, () => e.play(), "tf-ctl-primary");
2088
- T.append(x, g), o.append(T);
2089
- const _ = s.mount;
2090
- _ ? _.appendChild(o) : t.insertAdjacentElement("afterend", o);
2091
- const S = () => {
2097
+ const v = n.createElement("option");
2098
+ v.value = String(M), v.textContent = `${M}×`, M === 1 && (v.selected = !0), y.appendChild(v);
2099
+ }
2100
+ y.addEventListener("change", () => e.setSpeed(Number(y.value))), l.append(h, f, d, b, m, k), r.length > 0 && l.append(y), c.append(l);
2101
+ const T = n.createElement("p");
2102
+ T.className = "tf-ctl-caption", T.setAttribute("aria-live", "polite"), s.captions !== !1 && c.append(T);
2103
+ const w = n.createElement("div");
2104
+ w.className = "tf-ctl-question", w.hidden = !0;
2105
+ const g = n.createElement("span"), x = u(i.reveal, i.reveal, () => e.play(), "tf-ctl-primary");
2106
+ w.append(g, x), c.append(w);
2107
+ const S = s.mount;
2108
+ S ? S.appendChild(c) : t.insertAdjacentElement("afterend", c);
2109
+ const I = () => {
2092
2110
  const M = e.isPlaying;
2093
- f.textContent = M ? "❚❚" : "▶", f.setAttribute("aria-label", M ? i.pause : i.play), f.title = M ? i.pause : i.play;
2094
- const w = e.duration;
2095
- n.activeElement !== p && (p.value = String(w > 0 ? Math.round(e.currentTime / w * 1e3) : 0));
2096
- const C = e.markers;
2097
- if (h.hidden = d.hidden = m.hidden = C.length === 0, C.length > 0) {
2098
- const D = e.currentMarker, R = D ? C.indexOf(D) + 1 : 0;
2099
- m.textContent = `${R} / ${C.length}`, m.setAttribute("aria-label", `${i.step} ${R} ${i.of} ${C.length}`), h.disabled = e.currentTime <= 0.5, d.disabled = e.currentTime >= w - 0.5;
2100
- const W = e.caption() ?? "";
2101
- b.textContent !== W && (b.textContent = W);
2102
- const B = !M && D?.question !== void 0 && Math.abs(e.currentTime - D.time) < 1;
2103
- T.hidden = !B, B && x.textContent !== D.question && (x.textContent = D.question);
2111
+ d.textContent = M ? "❚❚" : "▶", d.setAttribute("aria-label", M ? i.pause : i.play), d.title = M ? i.pause : i.play;
2112
+ const v = e.duration;
2113
+ n.activeElement !== m && (m.value = String(v > 0 ? Math.round(e.currentTime / v * 1e3) : 0));
2114
+ const O = e.markers;
2115
+ if (f.hidden = b.hidden = k.hidden = O.length === 0, O.length > 0) {
2116
+ const E = e.currentMarker, $ = E ? O.indexOf(E) + 1 : 0;
2117
+ k.textContent = i.stepFormat.replace("{index}", String($)).replace("{total}", String(O.length)), k.setAttribute("aria-label", `${i.step} ${$} ${i.of} ${O.length}`), f.disabled = e.currentTime <= 0.5, b.disabled = e.currentTime >= v - 0.5;
2118
+ const B = e.caption() ?? "";
2119
+ T.textContent !== B && (T.textContent = B), T.hidden = !o();
2120
+ const U = !M && E?.question !== void 0 && Math.abs(e.currentTime - E.time) < 1;
2121
+ w.hidden = !U, U && g.textContent !== E.question && (g.textContent = E.question);
2104
2122
  } else
2105
- T.hidden = !0;
2106
- }, I = e.subscribe(S);
2107
- S();
2108
- const O = s.keyboardScope ?? t;
2109
- !O.hasAttribute("tabindex") && O.tabIndex < 0 && (O.tabIndex = 0);
2110
- const v = /* @__PURE__ */ new WeakSet(), A = (M) => {
2111
- if (v.has(M) || (v.add(M), M.defaultPrevented || M.altKey || M.ctrlKey || M.metaKey)) return;
2112
- const w = M.target;
2113
- if (!(w.tagName === "INPUT" || w.tagName === "SELECT") && !(M.key === " " && w.tagName === "BUTTON"))
2123
+ w.hidden = !0, T.hidden = !0;
2124
+ }, Y = e.subscribe(I);
2125
+ I();
2126
+ const _ = s.keyboardScope ?? t;
2127
+ !_.hasAttribute("tabindex") && _.tabIndex < 0 && (_.tabIndex = 0);
2128
+ const C = /* @__PURE__ */ new WeakSet(), A = (M) => {
2129
+ if (C.has(M) || (C.add(M), M.defaultPrevented || M.altKey || M.ctrlKey || M.metaKey)) return;
2130
+ const v = M.target;
2131
+ if (!(v.tagName === "INPUT" || v.tagName === "SELECT") && !(M.key === " " && v.tagName === "BUTTON"))
2114
2132
  switch (M.key) {
2115
2133
  case " ":
2116
- M.preventDefault(), e.isPlaying ? e.pause() : k();
2134
+ M.preventDefault(), e.isPlaying ? e.pause() : p();
2117
2135
  break;
2118
2136
  case "ArrowRight":
2119
2137
  if (!a()) return;
@@ -2128,16 +2146,16 @@ function $s(e, t, s = {}) {
2128
2146
  break;
2129
2147
  }
2130
2148
  };
2131
- return O.addEventListener("keydown", A), o.addEventListener("keydown", A), {
2132
- element: o,
2149
+ return _.addEventListener("keydown", A), c.addEventListener("keydown", A), {
2150
+ element: c,
2133
2151
  destroy() {
2134
- I(), O.removeEventListener("keydown", A), o.removeEventListener("keydown", A), o.remove();
2152
+ Y(), _.removeEventListener("keydown", A), c.removeEventListener("keydown", A), c.remove();
2135
2153
  }
2136
2154
  };
2137
2155
  }
2138
- const rt = /* @__PURE__ */ new WeakMap();
2156
+ const at = /* @__PURE__ */ new WeakMap();
2139
2157
  let Ds = 0;
2140
- function st(e, t, s) {
2158
+ function nt(e, t, s) {
2141
2159
  if (e)
2142
2160
  try {
2143
2161
  return JSON.parse(e);
@@ -2147,120 +2165,138 @@ function st(e, t, s) {
2147
2165
  }
2148
2166
  }
2149
2167
  async function Os(e, t = {}) {
2150
- const s = rt.get(e);
2168
+ const s = at.get(e);
2151
2169
  if (s) return s;
2152
- const n = e.querySelector("script[data-tinyfly-timeline]"), i = e.getAttribute("data-src"), r = n ? st(n.textContent, "timeline", e) : void 0;
2153
- if (!r && !i) {
2170
+ const n = e.querySelector("script[data-tinyfly-timeline]"), i = e.getAttribute("data-src");
2171
+ let r = n ? nt(n.textContent, "timeline", e) : void 0;
2172
+ const a = Ls(e.getAttribute("data-markers"));
2173
+ if (!r && i && a) {
2174
+ const h = await fetch(i);
2175
+ h.ok && (r = await h.json());
2176
+ }
2177
+ if (r && a && !r.config.markers?.length && (r.config = { ...r.config, markers: a.map((h, f) => ({ id: `step-${f + 1}`, time: h })) }), !r && !i) {
2154
2178
  console.warn('tinyfly: embed has no timeline (a <script type="application/json" data-tinyfly-timeline> or data-src)', e);
2155
2179
  return;
2156
2180
  }
2157
- const a = st(e.querySelector("script[data-tinyfly-captions]")?.textContent, "captions", e), o = {
2181
+ const o = nt(e.querySelector("script[data-tinyfly-captions]")?.textContent, "captions", e), c = {
2158
2182
  playWhenVisible: !0,
2159
2183
  ...t.player,
2160
- ...a && { captions: a },
2161
- ...st(e.getAttribute("data-options"), "data-options", e)
2184
+ ...o && { captions: o },
2185
+ ...nt(e.getAttribute("data-options"), "data-options", e)
2162
2186
  };
2163
- Ns(e);
2164
- const l = new Tt(e, o), c = { element: e, player: l };
2165
- if (rt.set(e, c), e.setAttribute("data-tinyfly-mounted", ""), await l.load(r ?? i), e.getAttribute("data-controls") !== "false") {
2166
- const u = st(e.getAttribute("data-labels"), "data-labels", e), h = e.querySelector("figcaption");
2167
- c.controls = $s(l, e, {
2187
+ Fs(e);
2188
+ const l = new St(e, c), u = { element: e, player: l };
2189
+ if (at.set(e, u), e.setAttribute("data-tinyfly-mounted", ""), await l.load(r ?? i), e.getAttribute("data-controls") !== "false") {
2190
+ const h = nt(e.getAttribute("data-labels"), "data-labels", e), f = e.querySelector("figcaption");
2191
+ u.controls = $s(l, e, {
2168
2192
  ...t.controls,
2169
- labels: { ...t.controls?.labels, ...u },
2193
+ labels: { ...t.controls?.labels, ...h },
2170
2194
  // Inside the figure, before its figcaption, so the caption stays last.
2171
2195
  mount: void 0
2172
- }), h ? e.insertBefore(c.controls.element, h) : e.appendChild(c.controls.element);
2196
+ }), f ? e.insertBefore(u.controls.element, f) : e.appendChild(u.controls.element);
2173
2197
  }
2174
- return c;
2198
+ return u;
2199
+ }
2200
+ function Ls(e) {
2201
+ if (!e) return;
2202
+ const t = e.split(/[\s,]+/).filter(Boolean).map(Number).filter((s) => Number.isFinite(s) && s >= 0).sort((s, n) => s - n);
2203
+ return t.length > 0 ? t : void 0;
2175
2204
  }
2176
- async function Ls(e = document, t = {}) {
2205
+ async function Ns(e = document, t = {}) {
2177
2206
  const s = Array.from(e.querySelectorAll("[data-tinyfly-embed]"));
2178
2207
  return (await Promise.all(s.map((i) => Os(i, t)))).filter((i) => i !== void 0);
2179
2208
  }
2180
- function js(e) {
2181
- const t = rt.get(e);
2182
- t && (t.controls?.destroy(), t.player.destroy(), rt.delete(e), e.removeAttribute("data-tinyfly-mounted"));
2209
+ function Hs(e) {
2210
+ const t = at.get(e);
2211
+ t && (t.controls?.destroy(), t.player.destroy(), at.delete(e), e.removeAttribute("data-tinyfly-mounted"));
2183
2212
  }
2184
- function Ns(e) {
2213
+ function Fs(e) {
2185
2214
  const t = e.querySelector("svg");
2186
2215
  if (!t || t.hasAttribute("role") || t.hasAttribute("aria-hidden")) return;
2187
2216
  const s = e.getAttribute("data-alt"), n = e.querySelector("figcaption");
2188
2217
  t.setAttribute("role", "img"), s ? t.setAttribute("aria-label", s) : n && (n.id ||= `tinyfly-caption-${++Ds}`, t.setAttribute("aria-labelledby", n.id));
2189
2218
  }
2190
- function Xs(e) {
2219
+ function Xs() {
2220
+ if (!(typeof document < "u" ? document.currentScript : null)?.hasAttribute("data-tinyfly-auto")) return;
2221
+ const t = () => {
2222
+ Ns();
2223
+ };
2224
+ document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", t, { once: !0 }) : t();
2225
+ }
2226
+ function Ys(e) {
2191
2227
  const t = /* @__PURE__ */ new Set();
2192
2228
  for (const s of e.matchAll(/data-tinyfly\s*=\s*("([^"]*)"|'([^']*)')/g)) t.add(s[2] ?? s[3]);
2193
2229
  return [...t];
2194
2230
  }
2195
- function Hs(e, t = {}) {
2196
- const s = [], n = (c) => s.push({ level: "error", message: c }), i = (c) => s.push({ level: "warning", message: c });
2197
- if ((e.formatVersion ?? 1) > Z)
2198
- return n(`format version ${e.formatVersion} is newer than this tinyfly reads (${Z})`), s;
2231
+ function zs(e, t = {}) {
2232
+ const s = [], n = (l) => s.push({ level: "error", message: l }), i = (l) => s.push({ level: "warning", message: l });
2233
+ if ((e.formatVersion ?? 1) > K)
2234
+ return n(`format version ${e.formatVersion} is newer than this tinyfly reads (${K})`), s;
2199
2235
  let r = 0;
2200
2236
  try {
2201
- r = it(e).duration;
2202
- } catch (c) {
2203
- return n(`the timeline does not load: ${c instanceof Error ? c.message : String(c)}`), s;
2237
+ r = rt(e).duration;
2238
+ } catch (l) {
2239
+ return n(`the timeline does not load: ${l instanceof Error ? l.message : String(l)}`), s;
2204
2240
  }
2205
2241
  const a = e.config?.duration;
2206
2242
  if (a !== void 0)
2207
- for (const c of e.tracks) {
2208
- if (!("keyframes" in c)) continue;
2209
- const u = c.keyframes.filter((h) => h.time > a);
2210
- u.length > 0 && n(`track "${c.id}" has a keyframe at ${u[0].time}ms, after the ${a}ms duration`);
2243
+ for (const l of e.tracks) {
2244
+ if (!("keyframes" in l)) continue;
2245
+ const u = l.keyframes.filter((h) => h.time > a);
2246
+ u.length > 0 && n(`track "${l.id}" has a keyframe at ${u[0].time}ms, after the ${a}ms duration`);
2211
2247
  }
2212
- const o = e.config?.markers ?? [], l = /* @__PURE__ */ new Set();
2213
- o.forEach((c, u) => {
2214
- l.has(c.id) && n(`marker id "${c.id}" is used more than once`), l.add(c.id), (c.time < 0 || c.time > r) && n(`marker "${c.id}" at ${c.time}ms is outside the animation (0–${r}ms)`), u > 0 && c.time < o[u - 1].time && n(`marker "${c.id}" comes before "${o[u - 1].id}" in time; list markers in order`);
2248
+ const o = e.config?.markers ?? [], c = /* @__PURE__ */ new Set();
2249
+ o.forEach((l, u) => {
2250
+ c.has(l.id) && n(`marker id "${l.id}" is used more than once`), c.add(l.id), (l.time < 0 || l.time > r) && n(`marker "${l.id}" at ${l.time}ms is outside the animation (0–${r}ms)`), u > 0 && l.time < o[u - 1].time && n(`marker "${l.id}" comes before "${o[u - 1].id}" in time; list markers in order`);
2215
2251
  });
2216
- for (const [c, u] of Object.entries(e.captions ?? {})) {
2252
+ for (const [l, u] of Object.entries(e.captions ?? {})) {
2217
2253
  for (const h of Object.keys(u))
2218
- l.has(h) || n(`caption "${h}" (${c}) has no marker with that id`);
2219
- for (const h of l)
2220
- h in u || i(`marker "${h}" has no ${c} caption; its label is shown instead`);
2254
+ c.has(h) || n(`caption "${h}" (${l}) has no marker with that id`);
2255
+ for (const h of c)
2256
+ h in u || i(`marker "${h}" has no ${l} caption; its label is shown instead`);
2221
2257
  }
2222
2258
  if (t.markup !== void 0) {
2223
- const c = new Set(Xs(t.markup)), u = /* @__PURE__ */ new Set();
2259
+ const l = new Set(Ys(t.markup)), u = /* @__PURE__ */ new Set();
2224
2260
  for (const h of e.tracks)
2225
2261
  for (const f of [h.target, ...h.targets ?? []])
2226
- u.add(f), c.has(f) || n(`track "${h.id}" targets "${f}", but no element has data-tinyfly="${f}"`);
2227
- for (const h of c) u.has(h) || i(`data-tinyfly="${h}" is never animated`);
2262
+ u.add(f), l.has(f) || n(`track "${h.id}" targets "${f}", but no element has data-tinyfly="${f}"`);
2263
+ for (const h of l) u.has(h) || i(`data-tinyfly="${h}" is never animated`);
2228
2264
  }
2229
2265
  return s;
2230
2266
  }
2231
- function zs(e, t, s = "end") {
2232
- const n = it(t), i = t.config?.markers ?? [], r = s === "start" ? 0 : s === "end" ? n.duration : typeof s == "number" ? s : i.find((f) => f.id === s)?.time ?? n.duration, a = n.getStateAtTime(Math.max(0, Math.min(n.duration, r))), o = new bt(), l = /* @__PURE__ */ new Map(), c = Ys(e);
2267
+ function Gs(e, t, s = "end") {
2268
+ const n = rt(t), i = t.config?.markers ?? [], r = s === "start" ? 0 : s === "end" ? n.duration : typeof s == "number" ? s : i.find((f) => f.id === s)?.time ?? n.duration, a = n.getStateAtTime(Math.max(0, Math.min(n.duration, r))), o = new kt(), c = /* @__PURE__ */ new Map(), l = Vs(e);
2233
2269
  for (const f of e.matchAll(Wt)) {
2234
2270
  const d = /data-tinyfly\s*=\s*("([^"]*)"|'([^']*)')/.exec(f[2] ?? "");
2235
2271
  if (!d) continue;
2236
- const k = d[2] ?? d[3];
2237
- if (l.has(k)) continue;
2238
- const p = Fs(c(f.index ?? 0));
2239
- l.set(k, p), o.registerTarget(k, p);
2272
+ const b = d[2] ?? d[3];
2273
+ if (c.has(b)) continue;
2274
+ const p = qs(l(f.index ?? 0));
2275
+ c.set(b, p), o.registerTarget(b, p);
2240
2276
  }
2241
2277
  o.applyState(a);
2242
2278
  let u = "", h = 0;
2243
2279
  for (const f of e.matchAll(Wt)) {
2244
- const [d, k, p = "", m] = f, y = f.index ?? 0, b = /data-tinyfly\s*=\s*("([^"]*)"|'([^']*)')/.exec(p), T = b ? l.get(b[2] ?? b[3]) : void 0;
2280
+ const [d, b, p = "", m] = f, k = f.index ?? 0, y = /data-tinyfly\s*=\s*("([^"]*)"|'([^']*)')/.exec(p), T = y ? c.get(y[2] ?? y[3]) : void 0;
2245
2281
  if (!T || Object.keys(T.style).length === 0 && T.text === void 0) continue;
2246
- u += e.slice(h, y);
2247
- const x = Object.entries(T.style).map(([S, I]) => `${qs(S)}: ${I}`).join("; "), g = /\sstyle\s*=\s*("([^"]*)"|'([^']*)')/.exec(p);
2248
- let _ = p;
2249
- if (x)
2282
+ u += e.slice(h, k);
2283
+ const w = Object.entries(T.style).map(([S, I]) => `${Ws(S)}: ${I}`).join("; "), g = /\sstyle\s*=\s*("([^"]*)"|'([^']*)')/.exec(p);
2284
+ let x = p;
2285
+ if (w)
2250
2286
  if (g) {
2251
- const S = `${(g[2] ?? g[3]).trim().replace(/;?$/, ";")} ${x}`.trim();
2252
- _ = p.replace(g[0], ` style="${Bt(S)}"`);
2287
+ const S = `${(g[2] ?? g[3]).trim().replace(/;?$/, ";")} ${w}`.trim();
2288
+ x = p.replace(g[0], ` style="${Bt(S)}"`);
2253
2289
  } else
2254
- _ = `${p} style="${Bt(x)}"`;
2255
- if (u += `<${k}${_}${m ? " /" : ""}>`, h = y + d.length, T.text !== void 0 && !m) {
2256
- const S = e.indexOf(`</${k}`, h), I = S === -1 ? "" : e.slice(h, S);
2257
- S !== -1 && !I.includes("<") && (u += Vs(T.text), h = S);
2290
+ x = `${p} style="${Bt(w)}"`;
2291
+ if (u += `<${b}${x}${m ? " /" : ""}>`, h = k + d.length, T.text !== void 0 && !m) {
2292
+ const S = e.indexOf(`</${b}`, h), I = S === -1 ? "" : e.slice(h, S);
2293
+ S !== -1 && !I.includes("<") && (u += Bs(T.text), h = S);
2258
2294
  }
2259
2295
  }
2260
2296
  return u + e.slice(h);
2261
2297
  }
2262
2298
  const Wt = /<([a-zA-Z][\w:-]*)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?)*)\s*(\/?)>/g;
2263
- function Fs(e) {
2299
+ function qs(e) {
2264
2300
  const t = {
2265
2301
  style: {},
2266
2302
  dataset: {},
@@ -2275,7 +2311,7 @@ function Fs(e) {
2275
2311
  };
2276
2312
  return e && (t.ownerSVGElement = null), t;
2277
2313
  }
2278
- function Ys(e) {
2314
+ function Vs(e) {
2279
2315
  const t = [], s = /<svg[\s>]/gi;
2280
2316
  let n;
2281
2317
  for (; n = s.exec(e); ) {
@@ -2284,33 +2320,27 @@ function Ys(e) {
2284
2320
  }
2285
2321
  return (i) => t.some(([r, a]) => i > r && i < a);
2286
2322
  }
2287
- function qs(e) {
2323
+ function Ws(e) {
2288
2324
  const t = e.replace(/[A-Z]/g, (s) => `-${s.toLowerCase()}`);
2289
2325
  return /^(webkit|moz|ms)-/.test(t) ? `-${t}` : t;
2290
2326
  }
2291
2327
  function Bt(e) {
2292
2328
  return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;");
2293
2329
  }
2294
- function Vs(e) {
2330
+ function Bs(e) {
2295
2331
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;");
2296
2332
  }
2297
- const Ws = typeof document < "u" ? document.currentScript : null;
2298
- if (Ws?.hasAttribute("data-tinyfly-auto")) {
2299
- const e = () => {
2300
- Ls();
2301
- };
2302
- document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", e, { once: !0 }) : e();
2303
- }
2333
+ Xs();
2304
2334
  export {
2305
2335
  Cs as DEFAULT_LABELS,
2306
- Tt as TinyflyPlayer,
2307
- Us as create,
2336
+ St as TinyflyPlayer,
2337
+ js as create,
2308
2338
  $s as createControls,
2309
2339
  Os as mount,
2310
- Ls as mountAll,
2311
- Bs as play,
2312
- zs as renderFrame,
2313
- Xs as targetNamesIn,
2314
- js as unmount,
2315
- Hs as validateEmbed
2340
+ Ns as mountAll,
2341
+ Us as play,
2342
+ Gs as renderFrame,
2343
+ Ys as targetNamesIn,
2344
+ Hs as unmount,
2345
+ zs as validateEmbed
2316
2346
  };