@algorisys/tinyfly 0.82.0 → 0.86.2

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.
Files changed (60) hide show
  1. package/README.md +11 -4
  2. package/lib/addons/adapters.js +363 -248
  3. package/lib/addons/characters.js +1652 -1470
  4. package/lib/addons/dom-adapter-Cphr2HZn.js +372 -0
  5. package/lib/addons/gsap-compat.js +197 -187
  6. package/lib/addons/load-scene-vp14_Jj-.js +324 -0
  7. package/lib/addons/scene-3d-webgl.js +237 -0
  8. package/lib/addons/scene-3d.js +306 -0
  9. package/lib/addons/shading-ByG9UXd0.js +85 -0
  10. package/lib/browser/tinyfly-scene-3d-webgl.iife.js +114 -0
  11. package/lib/browser/tinyfly-scene-3d.iife.js +3 -0
  12. package/lib/browser/tinyfly.iife.js +4 -4
  13. package/lib/browser/tinyfly.js +3028 -2480
  14. package/lib/browser/tinyfly.umd.js +4 -4
  15. package/lib/cli/tools.js +137 -22
  16. package/lib/embed/tinyfly-embed.iife.js +4 -4
  17. package/lib/embed/tinyfly-embed.js +921 -833
  18. package/lib/engine/tinyfly-engine.js +1022 -776
  19. package/lib/engine/tinyfly-engine.umd.cjs +2 -2
  20. package/lib/headless/headless.js +264 -7
  21. package/lib/player/tinyfly-player.es.js +459 -371
  22. package/lib/player/tinyfly-player.iife.js +2 -2
  23. package/lib/player/tinyfly-player.umd.js +2 -2
  24. package/lib/types/adapters/canvas/canvas-adapter.d.ts +36 -0
  25. package/lib/types/adapters/transform-3d.d.ts +99 -0
  26. package/lib/types/adapters/webgl/webgl-adapter.d.ts +17 -0
  27. package/lib/types/characters/character.d.ts +20 -1
  28. package/lib/types/characters/index.d.ts +2 -0
  29. package/lib/types/characters/rig/body-plan.d.ts +3 -1
  30. package/lib/types/characters/rig/skeleton.d.ts +57 -0
  31. package/lib/types/characters/scene-objects.d.ts +2 -0
  32. package/lib/types/compat/gsap/vars.d.ts +8 -0
  33. package/lib/types/engine/core/bake.d.ts +3 -1
  34. package/lib/types/engine/index.d.ts +1 -0
  35. package/lib/types/engine/interpolation/interpolators.d.ts +10 -3
  36. package/lib/types/engine/math/index.d.ts +11 -0
  37. package/lib/types/engine/math/mat4.d.ts +37 -0
  38. package/lib/types/engine/math/quat.d.ts +39 -0
  39. package/lib/types/engine/math/vec3.d.ts +16 -0
  40. package/lib/types/engine/types.d.ts +23 -2
  41. package/lib/types/scene-3d/camera.d.ts +27 -0
  42. package/lib/types/scene-3d/canvas-2d-renderer.d.ts +21 -0
  43. package/lib/types/scene-3d/geometry/extrude.d.ts +17 -0
  44. package/lib/types/scene-3d/geometry/mesh.d.ts +36 -0
  45. package/lib/types/scene-3d/geometry/primitives.d.ts +16 -0
  46. package/lib/types/scene-3d/geometry/triangulate.d.ts +24 -0
  47. package/lib/types/scene-3d/index.d.ts +20 -0
  48. package/lib/types/scene-3d/load-scene.d.ts +31 -0
  49. package/lib/types/scene-3d/object-kind.d.ts +54 -0
  50. package/lib/types/scene-3d/resolve-scene.d.ts +122 -0
  51. package/lib/types/scene-3d/scene-3d-adapter.d.ts +46 -0
  52. package/lib/types/scene-3d/scene-types.d.ts +191 -0
  53. package/lib/types/scene-3d/shading.d.ts +20 -0
  54. package/lib/types/scene-3d/validate-scene.d.ts +11 -0
  55. package/lib/types/scene-3d/webgl/gl-data.d.ts +28 -0
  56. package/lib/types/scene-3d/webgl/index.d.ts +16 -0
  57. package/lib/types/scene-3d/webgl/shaders.d.ts +29 -0
  58. package/lib/types/scene-3d/webgl/webgl2-renderer.d.ts +33 -0
  59. package/package.json +10 -2
  60. package/lib/addons/dom-adapter-CrNwoomd.js +0 -243
@@ -1,27 +1,30 @@
1
- function he(e) {
1
+ function ue(e) {
2
2
  return typeof e == "object" && e !== null && e.type === "cubic-bezier";
3
3
  }
4
- function ue(e) {
4
+ function de(e) {
5
5
  return typeof e == "object" && e !== null && e.type !== "cubic-bezier";
6
6
  }
7
- const J = 1;
8
- function Ht(e) {
7
+ const st = 2;
8
+ function fe(e) {
9
+ return e.some((t) => t.interpolation !== void 0) ? 2 : 1;
10
+ }
11
+ function zt(e) {
9
12
  return e.property === "text" && "textConfig" in e;
10
13
  }
11
- function mt(e) {
14
+ function gt(e) {
12
15
  return e.kind === "inertia" && "inertia" in e;
13
16
  }
14
- function gt(e) {
17
+ function yt(e) {
15
18
  return e.kind === "spring" && "spring" in e;
16
19
  }
17
- function de(e) {
20
+ function pe(e) {
18
21
  return e.property === "motionPath" && "motionPathConfig" in e;
19
22
  }
20
- function zt(e, t, n = "start") {
23
+ function Qt(e, t, n = "start") {
21
24
  if (t <= 1) return 0;
22
25
  if (typeof n == "number") {
23
- const s = Math.max(0, Math.min(t - 1, n));
24
- return Math.abs(e - s);
26
+ const i = Math.max(0, Math.min(t - 1, n));
27
+ return Math.abs(e - i);
25
28
  }
26
29
  switch (n) {
27
30
  case "end":
@@ -34,29 +37,29 @@ function zt(e, t, n = "start") {
34
37
  return e;
35
38
  }
36
39
  }
37
- function fe(e, t = "start") {
40
+ function me(e, t = "start") {
38
41
  if (e <= 1) return 0;
39
42
  let n = 0;
40
- for (let s = 0; s < e; s++)
41
- n = Math.max(n, zt(s, e, t));
43
+ for (let i = 0; i < e; i++)
44
+ n = Math.max(n, Qt(i, e, t));
42
45
  return n;
43
46
  }
44
47
  function Gt(e, t, n) {
45
48
  if (n.offsets) return n.offsets[e] ?? 0;
46
- const s = n.from ?? "start", i = zt(e, t, s);
49
+ const i = n.from ?? "start", s = Qt(e, t, i);
47
50
  if (n.amount !== void 0) {
48
- const r = fe(t, s);
49
- return r === 0 ? 0 : n.amount * i / r;
51
+ const r = me(t, i);
52
+ return r === 0 ? 0 : n.amount * s / r;
50
53
  }
51
- return n.each !== void 0 ? n.each * i : 0;
54
+ return n.each !== void 0 ? n.each * s : 0;
52
55
  }
53
- function pe(e, t) {
54
- return Array.from({ length: e }, (n, s) => Gt(s, e, t));
56
+ function ge(e, t) {
57
+ return Array.from({ length: e }, (n, i) => Gt(i, e, t));
55
58
  }
56
- function xt(e, t) {
57
- return e <= 1 ? 0 : Math.max(...pe(e, t));
59
+ function wt(e, t) {
60
+ return e <= 1 ? 0 : Math.max(...ge(e, t));
58
61
  }
59
- const Z = 1, Qt = 6e4, et = Qt / Z, B = {
62
+ const Z = 1, Zt = 6e4, et = Zt / Z, B = {
60
63
  stiffness: 180,
61
64
  damping: 12,
62
65
  mass: 1,
@@ -64,7 +67,7 @@ const Z = 1, Qt = 6e4, et = Qt / Z, B = {
64
67
  restDelta: 0.01,
65
68
  restSpeed: 0.1
66
69
  };
67
- class me {
70
+ class ye {
68
71
  from;
69
72
  to;
70
73
  stiffness;
@@ -110,24 +113,24 @@ class me {
110
113
  const n = Math.floor(t / Z);
111
114
  if (this.simulateTo(n + 1), this.settledStep !== null && n >= this.settledStep)
112
115
  return this.to;
113
- const s = this.samples[Math.min(n, this.samples.length - 1)], i = this.samples[Math.min(n + 1, this.samples.length - 1)], r = t / Z - n;
114
- return s + (i - s) * r;
116
+ const i = this.samples[Math.min(n, this.samples.length - 1)], s = this.samples[Math.min(n + 1, this.samples.length - 1)], r = t / Z - n;
117
+ return i + (s - i) * r;
115
118
  }
116
119
  /**
117
120
  * How long the spring takes to settle, in milliseconds — the natural duration
118
121
  * of a spring track. Runs the simulation to completion once.
119
122
  */
120
123
  settleTime() {
121
- return this.simulateTo(et + 1), this.settledStep !== null ? this.settledStep * Z : Qt;
124
+ return this.simulateTo(et + 1), this.settledStep !== null ? this.settledStep * Z : Zt;
122
125
  }
123
126
  /** Advance the cached simulation until it holds at least `steps` samples. */
124
127
  simulateTo(t) {
125
128
  if (this.settledStep !== null) return;
126
- const n = Math.min(t, et + 1), s = Z / 1e3;
129
+ const n = Math.min(t, et + 1), i = Z / 1e3;
127
130
  for (; this.samples.length < n; ) {
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 * s;
130
- const l = i + this.velocity * s;
131
+ const s = this.samples[this.samples.length - 1], r = s - this.to, a = -this.stiffness * r, o = -this.damping * this.velocity, c = (a + o) / this.mass;
132
+ this.velocity += c * i;
133
+ const l = s + this.velocity * i;
131
134
  if (this.samples.push(l), this.isAtRest(l)) {
132
135
  this.settledStep = this.samples.length - 1;
133
136
  return;
@@ -136,108 +139,108 @@ class me {
136
139
  this.samples.length > et && (this.settledStep = et);
137
140
  }
138
141
  }
139
- const St = 4, ge = 2e-3, ye = 1e-4, be = 6e4;
140
- function wt(e) {
141
- const t = e.friction ?? St;
142
- return t > 0 ? t : St;
142
+ const Tt = 4, be = 2e-3, ve = 1e-4, ke = 6e4;
143
+ function Mt(e) {
144
+ const t = e.friction ?? Tt;
145
+ return t > 0 ? t : Tt;
143
146
  }
144
- function ve(e) {
145
- return e.from + e.velocity / wt(e);
147
+ function xe(e) {
148
+ return e.from + e.velocity / Mt(e);
146
149
  }
147
- function ke(e, t) {
150
+ function we(e, t) {
148
151
  if (t === void 0) return e;
149
152
  if (typeof t == "number")
150
153
  return t > 0 ? Math.round(e / t) * t : e;
151
154
  if (t.length === 0) return e;
152
155
  let n = t[0];
153
- for (const s of t)
154
- Math.abs(s - e) < Math.abs(n - e) && (n = s);
156
+ for (const i of t)
157
+ Math.abs(i - e) < Math.abs(n - e) && (n = i);
155
158
  return n;
156
159
  }
157
- function Zt(e) {
158
- let t = ke(ve(e), e.end);
160
+ function Kt(e) {
161
+ let t = we(xe(e), e.end);
159
162
  return e.min !== void 0 && (t = Math.max(e.min, t)), e.max !== void 0 && (t = Math.min(e.max, t)), t;
160
163
  }
161
- function Kt(e) {
162
- const t = Math.abs(Zt(e) - e.from);
164
+ function Jt(e) {
165
+ const t = Math.abs(Kt(e) - e.from);
163
166
  if (t === 0) return 0;
164
- const n = e.restDelta ?? Math.max(ye, t * ge);
167
+ const n = e.restDelta ?? Math.max(ve, t * be);
165
168
  if (n >= t) return 0;
166
- const s = Math.log(t / n) / wt(e);
167
- return Math.min(be, s * 1e3);
169
+ const i = Math.log(t / n) / Mt(e);
170
+ return Math.min(ke, i * 1e3);
168
171
  }
169
- function Tt(e, t) {
172
+ function _t(e, t) {
170
173
  if (t <= 0) return e.from;
171
- const n = Zt(e);
172
- if (t >= Kt(e)) return n;
173
- const s = wt(e);
174
- return e.from + (n - e.from) * (1 - Math.exp(-s * t / 1e3));
175
- }
176
- const yt = (e) => e, xe = (e) => e * e, we = (e) => 1 - (1 - e) * (1 - e), Me = (e) => e < 0.5 ? 2 * e * e : 1 - Math.pow(-2 * e + 2, 2) / 2, Jt = (e) => e * e * e, te = (e) => 1 - Math.pow(1 - e, 3), ee = (e) => e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2, Se = Jt, Te = te, _e = ee, Ae = {
177
- linear: yt,
178
- "ease-in": Se,
179
- "ease-out": Te,
180
- "ease-in-out": _e,
181
- "ease-in-quad": xe,
182
- "ease-out-quad": we,
183
- "ease-in-out-quad": Me,
184
- "ease-in-cubic": Jt,
185
- "ease-out-cubic": te,
186
- "ease-in-out-cubic": ee
174
+ const n = Kt(e);
175
+ if (t >= Jt(e)) return n;
176
+ const i = Mt(e);
177
+ return e.from + (n - e.from) * (1 - Math.exp(-i * t / 1e3));
178
+ }
179
+ const bt = (e) => e, Me = (e) => e * e, Se = (e) => 1 - (1 - e) * (1 - e), Te = (e) => e < 0.5 ? 2 * e * e : 1 - Math.pow(-2 * e + 2, 2) / 2, te = (e) => e * e * e, ee = (e) => 1 - Math.pow(1 - e, 3), ne = (e) => e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2, _e = te, Ae = ee, Ee = ne, Pe = {
180
+ linear: bt,
181
+ "ease-in": _e,
182
+ "ease-out": Ae,
183
+ "ease-in-out": Ee,
184
+ "ease-in-quad": Me,
185
+ "ease-out-quad": Se,
186
+ "ease-in-out-quad": Te,
187
+ "ease-in-cubic": te,
188
+ "ease-out-cubic": ee,
189
+ "ease-in-out-cubic": ne
187
190
  };
188
- function Ee(e) {
189
- const [t, n, s, i] = e, r = 3 * t, a = 3 * (s - t) - r, o = 1 - r - a, c = 3 * n, l = 3 * (i - n) - c, u = 1 - c - l, h = (p) => ((o * p + a) * p + r) * p, d = (p) => ((u * p + l) * p + c) * p, f = (p) => (3 * o * p + 2 * a) * p + r, g = (p) => {
190
- let m = p;
191
+ function Ce(e) {
192
+ const [t, n, i, s] = e, r = 3 * t, a = 3 * (i - t) - r, o = 1 - r - a, c = 3 * n, l = 3 * (s - n) - c, u = 1 - c - l, h = (d) => ((o * d + a) * d + r) * d, f = (d) => ((u * d + l) * d + c) * d, m = (d) => (3 * o * d + 2 * a) * d + r, p = (d) => {
193
+ let g = d;
191
194
  for (let k = 0; k < 8; k++) {
192
- const M = h(m) - p;
195
+ const M = h(g) - d;
193
196
  if (Math.abs(M) < 1e-7)
194
- return m;
195
- const y = f(m);
197
+ return g;
198
+ const y = m(g);
196
199
  if (Math.abs(y) < 1e-7)
197
200
  break;
198
- m -= M / y;
201
+ g -= M / y;
199
202
  }
200
203
  let b = 0, v = 1;
201
- for (m = p; b < v; ) {
202
- const k = h(m);
203
- if (Math.abs(k - p) < 1e-7)
204
- return m;
205
- p > k ? b = m : v = m, m = (b + v) / 2;
204
+ for (g = d; b < v; ) {
205
+ const k = h(g);
206
+ if (Math.abs(k - d) < 1e-7)
207
+ return g;
208
+ d > k ? b = g : v = g, g = (b + v) / 2;
206
209
  }
207
- return m;
210
+ return g;
208
211
  };
209
- return (p) => {
210
- if (p <= 0) return 0;
211
- if (p >= 1) return 1;
212
- const m = g(p);
213
- return d(m);
212
+ return (d) => {
213
+ if (d <= 0) return 0;
214
+ if (d >= 1) return 1;
215
+ const g = p(d);
216
+ return f(g);
214
217
  };
215
218
  }
216
- function ct(e, t = "out") {
219
+ function lt(e, t = "out") {
217
220
  if (t === "out") return e;
218
- const n = (s) => 1 - e(1 - s);
219
- return t === "in" ? n : (s) => s < 0.5 ? n(s * 2) / 2 : e(s * 2 - 1) / 2 + 0.5;
221
+ const n = (i) => 1 - e(1 - i);
222
+ return t === "in" ? n : (i) => i < 0.5 ? n(i * 2) / 2 : e(i * 2 - 1) / 2 + 0.5;
220
223
  }
221
- function Pe(e = 1, t = 0.3) {
222
- const n = Math.max(1, e), s = t / (2 * Math.PI) * Math.asin(1 / n);
223
- return (i) => i <= 0 ? 0 : i >= 1 ? 1 : n * Math.pow(2, -10 * i) * Math.sin((i - s) * (2 * Math.PI) / t) + 1;
224
+ function Ie(e = 1, t = 0.3) {
225
+ const n = Math.max(1, e), i = t / (2 * Math.PI) * Math.asin(1 / n);
226
+ return (s) => s <= 0 ? 0 : s >= 1 ? 1 : n * Math.pow(2, -10 * s) * Math.sin((s - i) * (2 * Math.PI) / t) + 1;
224
227
  }
225
- const Ce = (e) => {
228
+ const Re = (e) => {
226
229
  if (e <= 0) return 0;
227
230
  if (e >= 1) return 1;
228
231
  if (e < 1 / 2.75) return 7.5625 * e * e;
229
232
  if (e < 2 / 2.75) {
230
- const i = e - 0.5454545454545454;
231
- return 7.5625 * i * i + 0.75;
233
+ const s = e - 0.5454545454545454;
234
+ return 7.5625 * s * s + 0.75;
232
235
  }
233
236
  if (e < 2.5 / 2.75) {
234
- const i = e - 0.8181818181818182;
235
- return 7.5625 * i * i + 0.9375;
237
+ const s = e - 0.8181818181818182;
238
+ return 7.5625 * s * s + 0.9375;
236
239
  }
237
- const s = e - 2.625 / 2.75;
238
- return 7.5625 * s * s + 0.984375;
240
+ const i = e - 2.625 / 2.75;
241
+ return 7.5625 * i * i + 0.984375;
239
242
  };
240
- function Ie(e = 1.70158) {
243
+ function $e(e = 1.70158) {
241
244
  return (t) => {
242
245
  if (t <= 0) return 0;
243
246
  if (t >= 1) return 1;
@@ -245,40 +248,40 @@ function Ie(e = 1.70158) {
245
248
  return n * n * ((e + 1) * n + e) + 1;
246
249
  };
247
250
  }
248
- function Re(e, t = "end") {
251
+ function De(e, t = "end") {
249
252
  const n = Math.max(1, Math.floor(e));
250
- return (s) => {
251
- if (s >= 1) return 1;
252
- if (s <= 0) return t === "start" || t === "both" ? t === "start" ? 1 / n : 1 / (n + 1) : 0;
253
- const i = Math.floor(s * n);
253
+ return (i) => {
254
+ if (i >= 1) return 1;
255
+ if (i <= 0) return t === "start" || t === "both" ? t === "start" ? 1 / n : 1 / (n + 1) : 0;
256
+ const s = Math.floor(i * n);
254
257
  switch (t) {
255
258
  case "start":
256
- return Math.min(1, (i + 1) / n);
259
+ return Math.min(1, (s + 1) / n);
257
260
  case "both":
258
- return (i + 1) / (n + 1);
261
+ return (s + 1) / (n + 1);
259
262
  case "none":
260
- return n === 1 ? 0 : Math.min(1, i / (n - 1));
263
+ return n === 1 ? 0 : Math.min(1, s / (n - 1));
261
264
  default:
262
- return i / n;
265
+ return s / n;
263
266
  }
264
267
  };
265
268
  }
266
- function $e(e) {
269
+ function Le(e) {
267
270
  switch (e.type) {
268
271
  case "steps":
269
- return Re(e.count, e.position);
272
+ return De(e.count, e.position);
270
273
  case "elastic":
271
- return ct(Pe(e.amplitude, e.period), e.mode);
274
+ return lt(Ie(e.amplitude, e.period), e.mode);
272
275
  case "bounce":
273
- return ct(Ce, e.mode);
276
+ return lt(Re, e.mode);
274
277
  case "back":
275
- return ct(Ie(e.overshoot), e.mode);
278
+ return lt($e(e.overshoot), e.mode);
276
279
  }
277
280
  }
278
- function De(e) {
279
- return e === void 0 ? yt : he(e) ? Ee(e.points) : ue(e) ? $e(e) : Ae[e] ?? yt;
281
+ function Oe(e) {
282
+ return e === void 0 ? bt : ue(e) ? Ce(e.points) : de(e) ? Le(e) : Pe[e] ?? bt;
280
283
  }
281
- const _t = 32, Le = 256, H = /* @__PURE__ */ new Map(), Oe = /[MmLlHhVvCcSsQqTtAaZz]/, Ne = /^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/, Fe = {
284
+ const At = 32, Ne = 256, H = /* @__PURE__ */ new Map(), Fe = /[MmLlHhVvCcSsQqTtAaZz]/, Xe = /^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/, Ye = {
282
285
  M: 2,
283
286
  L: 2,
284
287
  H: 1,
@@ -290,191 +293,191 @@ const _t = 32, Le = 256, H = /* @__PURE__ */ new Map(), Oe = /[MmLlHhVvCcSsQqTtA
290
293
  A: 7,
291
294
  Z: 0
292
295
  };
293
- function Xe(e) {
296
+ function Ve(e) {
294
297
  const t = [];
295
- let n = 0, s = null;
296
- const i = () => {
298
+ let n = 0, i = null;
299
+ const s = () => {
297
300
  for (; n < e.length && /[\s,]/.test(e[n]); ) n++;
298
301
  };
299
- for (; n < e.length && (i(), !(n >= e.length)); ) {
302
+ for (; n < e.length && (s(), !(n >= e.length)); ) {
300
303
  const r = e[n];
301
- if (Oe.test(r)) {
302
- s = { type: r, args: [] }, t.push(s), n++;
304
+ if (Fe.test(r)) {
305
+ i = { type: r, args: [] }, t.push(i), n++;
303
306
  continue;
304
307
  }
305
- if (!s) break;
306
- const a = s.type === "A" || s.type === "a", o = s.args.length % 7;
308
+ if (!i) break;
309
+ const a = i.type === "A" || i.type === "a", o = i.args.length % 7;
307
310
  if (a && (o === 3 || o === 4)) {
308
311
  if (r !== "0" && r !== "1") break;
309
- s.args.push(r === "1" ? 1 : 0), n++;
312
+ i.args.push(r === "1" ? 1 : 0), n++;
310
313
  continue;
311
314
  }
312
- const c = Ne.exec(e.slice(n));
315
+ const c = Xe.exec(e.slice(n));
313
316
  if (!c) break;
314
- s.args.push(parseFloat(c[0])), n += c[0].length;
317
+ i.args.push(parseFloat(c[0])), n += c[0].length;
315
318
  }
316
319
  return t;
317
320
  }
318
- function Ye(e, t, n, s, i, r, a, o, c) {
321
+ function qe(e, t, n, i, s, r, a, o, c) {
319
322
  if (e === o && t === c) return [];
320
- let l = Math.abs(n), u = Math.abs(s);
323
+ let l = Math.abs(n), u = Math.abs(i);
321
324
  if (l === 0 || u === 0) return [[e, t, o, c, o, c]];
322
- const h = i * Math.PI / 180, d = Math.cos(h), f = Math.sin(h), g = (e - o) / 2, p = (t - c) / 2, m = d * g + f * p, b = -f * g + d * p, v = m * m / (l * l) + b * b / (u * u);
325
+ const h = s * Math.PI / 180, f = Math.cos(h), m = Math.sin(h), p = (e - o) / 2, d = (t - c) / 2, g = f * p + m * d, b = -m * p + f * d, v = g * g / (l * l) + b * b / (u * u);
323
326
  if (v > 1) {
324
327
  const A = Math.sqrt(v);
325
328
  l *= A, u *= A;
326
329
  }
327
- const k = r === a ? -1 : 1, M = l * l * u * u - l * l * b * b - u * u * m * m, y = l * l * b * b + u * u * m * m, S = k * Math.sqrt(Math.max(0, M / y)), x = S * l * b / u, P = -S * u * m / l, Y = d * x - f * P + (e + o) / 2, T = f * x + d * P + (t + c) / 2, R = (A, I, D, W) => {
328
- const ot = A * D + I * W, tt = Math.sqrt((A * A + I * I) * (D * D + W * W)), j = Math.acos(Math.max(-1, Math.min(1, ot / tt)));
330
+ const k = r === a ? -1 : 1, M = l * l * u * u - l * l * b * b - u * u * g * g, y = l * l * b * b + u * u * g * g, S = k * Math.sqrt(Math.max(0, M / y)), x = S * l * b / u, P = -S * u * g / l, Y = f * x - m * P + (e + o) / 2, T = m * x + f * P + (t + c) / 2, R = (A, I, D, W) => {
331
+ const ct = A * D + I * W, tt = Math.sqrt((A * A + I * I) * (D * D + W * W)), j = Math.acos(Math.max(-1, Math.min(1, ct / tt)));
329
332
  return A * W - I * D < 0 ? -j : j;
330
- }, _ = R(1, 0, (m - x) / l, (b - P) / u);
331
- let C = R((m - x) / l, (b - P) / u, (-m - x) / l, (-b - P) / u);
333
+ }, _ = R(1, 0, (g - x) / l, (b - P) / u);
334
+ let C = R((g - x) / l, (b - P) / u, (-g - x) / l, (-b - P) / u);
332
335
  !a && C > 0 && (C -= 2 * Math.PI), a && C < 0 && (C += 2 * Math.PI);
333
336
  const L = Math.max(1, Math.ceil(Math.abs(C) / (Math.PI / 2))), w = C / L, E = 4 / 3 * Math.tan(w / 4), N = (A) => {
334
337
  const I = l * Math.cos(A), D = u * Math.sin(A);
335
- return [d * I - f * D + Y, f * I + d * D + T];
338
+ return [f * I - m * D + Y, m * I + f * D + T];
336
339
  }, O = (A) => {
337
340
  const I = -l * Math.sin(A), D = u * Math.cos(A);
338
- return [d * I - f * D, f * I + d * D];
341
+ return [f * I - m * D, m * I + f * D];
339
342
  }, $ = [];
340
343
  for (let A = 0; A < L; A++) {
341
- const I = _ + A * w, D = I + w, [W, ot] = N(I), [tt, j] = A === L - 1 ? [o, c] : N(D), [ae, oe] = O(I), [ce, le] = O(D);
342
- $.push([W + E * ae, ot + E * oe, tt - E * ce, j - E * le, tt, j]);
344
+ const I = _ + A * w, D = I + w, [W, ct] = N(I), [tt, j] = A === L - 1 ? [o, c] : N(D), [oe, ce] = O(I), [le, he] = O(D);
345
+ $.push([W + E * oe, ct + E * ce, tt - E * le, j - E * he, tt, j]);
343
346
  }
344
347
  return $;
345
348
  }
346
- function X(e, t, n, s, i) {
347
- const r = 1 - i;
348
- return r * r * r * e + 3 * r * r * i * t + 3 * r * i * i * n + i * i * i * s;
349
+ function X(e, t, n, i, s) {
350
+ const r = 1 - s;
351
+ return r * r * r * e + 3 * r * r * s * t + 3 * r * s * s * n + s * s * s * i;
349
352
  }
350
- function At(e, t, n, s, i) {
351
- const r = 1 - i;
352
- return 3 * r * r * (t - e) + 6 * r * i * (n - t) + 3 * i * i * (s - n);
353
+ function Et(e, t, n, i, s) {
354
+ const r = 1 - s;
355
+ return 3 * r * r * (t - e) + 6 * r * s * (n - t) + 3 * s * s * (i - n);
353
356
  }
354
- function z(e, t, n, s) {
357
+ function z(e, t, n, i) {
355
358
  return {
356
359
  subpath: 0,
357
360
  type: "L",
358
- points: [n, s],
361
+ points: [n, i],
359
362
  startX: e,
360
363
  startY: t,
361
364
  endX: n,
362
- endY: s,
363
- length: Math.hypot(n - e, s - t)
365
+ endY: i,
366
+ length: Math.hypot(n - e, i - t)
364
367
  };
365
368
  }
366
369
  function nt(e, t, n) {
367
- const [s, i, r, a, o, c] = n, l = [0];
368
- let u = e, h = t, d = 0;
369
- for (let f = 1; f <= _t; f++) {
370
- const g = f / _t, p = X(e, s, r, o, g), m = X(t, i, a, c, g);
371
- d += Math.hypot(p - u, m - h), l.push(d), u = p, h = m;
370
+ const [i, s, r, a, o, c] = n, l = [0];
371
+ let u = e, h = t, f = 0;
372
+ for (let m = 1; m <= At; m++) {
373
+ const p = m / At, d = X(e, i, r, o, p), g = X(t, s, a, c, p);
374
+ f += Math.hypot(d - u, g - h), l.push(f), u = d, h = g;
372
375
  }
373
376
  return {
374
377
  subpath: 0,
375
378
  type: "C",
376
- points: [s, i, r, a, o, c],
379
+ points: [i, s, r, a, o, c],
377
380
  startX: e,
378
381
  startY: t,
379
382
  endX: o,
380
383
  endY: c,
381
- length: d,
384
+ length: f,
382
385
  lengths: l
383
386
  };
384
387
  }
385
- function it(e) {
388
+ function rt(e) {
386
389
  const t = H.get(e);
387
390
  if (t) return t;
388
391
  const n = [];
389
- let s = 0, i = 0, r = 0, a = 0, o = null, c = null, l = -1;
390
- const u = /* @__PURE__ */ new Set(), h = (p) => {
391
- l < 0 && (l = 0), p.subpath = l, n.push(p);
392
+ let i = 0, s = 0, r = 0, a = 0, o = null, c = null, l = -1;
393
+ const u = /* @__PURE__ */ new Set(), h = (d) => {
394
+ l < 0 && (l = 0), d.subpath = l, n.push(d);
392
395
  };
393
- for (const { type: p, args: m } of Xe(e)) {
394
- const b = p.toUpperCase(), v = p !== b, k = Fe[b];
396
+ for (const { type: d, args: g } of Ve(e)) {
397
+ const b = d.toUpperCase(), v = d !== b, k = Ye[b];
395
398
  if (b === "Z") {
396
- (s !== r || i !== a) && h(z(s, i, r, a)), l >= 0 && u.add(l), s = r, i = a, o = c = null;
399
+ (i !== r || s !== a) && h(z(i, s, r, a)), l >= 0 && u.add(l), i = r, s = a, o = c = null;
397
400
  continue;
398
401
  }
399
- for (let M = 0; M + k <= m.length; M += k) {
400
- const y = m.slice(M, M + k), S = v ? s : 0, x = v ? i : 0;
402
+ for (let M = 0; M + k <= g.length; M += k) {
403
+ const y = g.slice(M, M + k), S = v ? i : 0, x = v ? s : 0;
401
404
  let P = null, Y = null;
402
405
  switch (b) {
403
406
  case "M":
404
- M === 0 ? (s = y[0] + S, i = y[1] + x, r = s, a = i, (l < 0 || n[n.length - 1]?.subpath === l) && l++) : (h(z(s, i, y[0] + S, y[1] + x)), s = y[0] + S, i = y[1] + x);
407
+ M === 0 ? (i = y[0] + S, s = y[1] + x, r = i, a = s, (l < 0 || n[n.length - 1]?.subpath === l) && l++) : (h(z(i, s, y[0] + S, y[1] + x)), i = y[0] + S, s = y[1] + x);
405
408
  break;
406
409
  case "L":
407
- h(z(s, i, y[0] + S, y[1] + x)), s = y[0] + S, i = y[1] + x;
410
+ h(z(i, s, y[0] + S, y[1] + x)), i = y[0] + S, s = y[1] + x;
408
411
  break;
409
412
  case "H":
410
- h(z(s, i, y[0] + S, i)), s = y[0] + S;
413
+ h(z(i, s, y[0] + S, s)), i = y[0] + S;
411
414
  break;
412
415
  case "V":
413
- h(z(s, i, s, y[0] + x)), i = y[0] + x;
416
+ h(z(i, s, i, y[0] + x)), s = y[0] + x;
414
417
  break;
415
418
  case "C": {
416
419
  const T = [y[0] + S, y[1] + x, y[2] + S, y[3] + x, y[4] + S, y[5] + x];
417
- h(nt(s, i, T)), P = [T[2], T[3]], s = T[4], i = T[5];
420
+ h(nt(i, s, T)), P = [T[2], T[3]], i = T[4], s = T[5];
418
421
  break;
419
422
  }
420
423
  case "S": {
421
- const [T, R] = o ? [2 * s - o[0], 2 * i - o[1]] : [s, i], _ = [T, R, y[0] + S, y[1] + x, y[2] + S, y[3] + x];
422
- h(nt(s, i, _)), P = [_[2], _[3]], s = _[4], i = _[5];
424
+ const [T, R] = o ? [2 * i - o[0], 2 * s - o[1]] : [i, s], _ = [T, R, y[0] + S, y[1] + x, y[2] + S, y[3] + x];
425
+ h(nt(i, s, _)), P = [_[2], _[3]], i = _[4], s = _[5];
423
426
  break;
424
427
  }
425
428
  case "Q":
426
429
  case "T": {
427
- let T = s, R = i;
428
- b === "Q" ? (T = y[0] + S, R = y[1] + x) : c && (T = 2 * s - c[0], R = 2 * i - c[1]);
430
+ let T = i, R = s;
431
+ b === "Q" ? (T = y[0] + S, R = y[1] + x) : c && (T = 2 * i - c[0], R = 2 * s - c[1]);
429
432
  const _ = b === "Q" ? y[2] + S : y[0] + S, C = b === "Q" ? y[3] + x : y[1] + x;
430
433
  h(
431
- nt(s, i, [
432
- s + 2 / 3 * (T - s),
433
- i + 2 / 3 * (R - i),
434
+ nt(i, s, [
435
+ i + 2 / 3 * (T - i),
436
+ s + 2 / 3 * (R - s),
434
437
  _ + 2 / 3 * (T - _),
435
438
  C + 2 / 3 * (R - C),
436
439
  _,
437
440
  C
438
441
  ])
439
- ), Y = [T, R], s = _, i = C;
442
+ ), Y = [T, R], i = _, s = C;
440
443
  break;
441
444
  }
442
445
  case "A": {
443
446
  const T = y[5] + S, R = y[6] + x;
444
- let _ = s, C = i;
445
- for (const L of Ye(s, i, y[0], y[1], y[2], y[3], y[4], T, R))
447
+ let _ = i, C = s;
448
+ for (const L of qe(i, s, y[0], y[1], y[2], y[3], y[4], T, R))
446
449
  h(nt(_, C, L)), _ = L[4], C = L[5];
447
- s = T, i = R;
450
+ i = T, s = R;
448
451
  break;
449
452
  }
450
453
  }
451
454
  o = P, c = Y;
452
455
  }
453
456
  }
454
- const d = n.reduce((p, m) => p + m.length, 0), f = [];
455
- for (let p = 0; p < n.length; ) {
456
- const m = n[p].subpath;
457
- let b = p, v = 0;
458
- for (; b < n.length && n[b].subpath === m; ) v += n[b++].length;
459
- const k = n[p], M = n[b - 1], y = u.has(m) || Math.abs(M.endX - k.startX) < 1e-9 && Math.abs(M.endY - k.startY) < 1e-9;
460
- f.push({ start: p, end: b, length: v, closed: y }), p = b;
457
+ const f = n.reduce((d, g) => d + g.length, 0), m = [];
458
+ for (let d = 0; d < n.length; ) {
459
+ const g = n[d].subpath;
460
+ let b = d, v = 0;
461
+ for (; b < n.length && n[b].subpath === g; ) v += n[b++].length;
462
+ const k = n[d], M = n[b - 1], y = u.has(g) || Math.abs(M.endX - k.startX) < 1e-9 && Math.abs(M.endY - k.startY) < 1e-9;
463
+ m.push({ start: d, end: b, length: v, closed: y }), d = b;
461
464
  }
462
- const g = { segments: n, totalLength: d, subpaths: f };
463
- return H.size >= Le && H.delete(H.keys().next().value), H.set(e, g), g;
465
+ const p = { segments: n, totalLength: f, subpaths: m };
466
+ return H.size >= Ne && H.delete(H.keys().next().value), H.set(e, p), p;
464
467
  }
465
- function qe(e, t) {
468
+ function We(e, t) {
466
469
  const n = e.lengths;
467
470
  if (t <= 0) return 0;
468
471
  if (t >= e.length) return 1;
469
- let s = 0, i = n.length - 1;
470
- for (; s < i - 1; ) {
471
- const o = s + i >> 1;
472
- n[o] < t ? s = o : i = o;
472
+ let i = 0, s = n.length - 1;
473
+ for (; i < s - 1; ) {
474
+ const o = i + s >> 1;
475
+ n[o] < t ? i = o : s = o;
473
476
  }
474
- const r = n[i] - n[s], a = r > 0 ? (t - n[s]) / r : 0;
475
- return (s + a) / (n.length - 1);
477
+ const r = n[s] - n[i], a = r > 0 ? (t - n[i]) / r : 0;
478
+ return (i + a) / (n.length - 1);
476
479
  }
477
- function Ve(e, t) {
480
+ function Be(e, t) {
478
481
  if (e.type === "L") {
479
482
  const h = e.length > 0 ? Math.max(0, Math.min(1, t / e.length)) : 0;
480
483
  return {
@@ -483,234 +486,266 @@ function Ve(e, t) {
483
486
  angle: Math.atan2(e.endY - e.startY, e.endX - e.startX) * 180 / Math.PI
484
487
  };
485
488
  }
486
- const [n, s, i, r, a, o] = e.points, c = qe(e, t);
487
- let l = At(e.startX, n, i, a, c), u = At(e.startY, s, r, o, c);
489
+ const [n, i, s, r, a, o] = e.points, c = We(e, t);
490
+ let l = Et(e.startX, n, s, a, c), u = Et(e.startY, i, r, o, c);
488
491
  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), d = X(e.startX, n, i, a, h), f = X(e.startY, s, r, o, h), g = X(e.startX, n, i, a, c), p = X(e.startY, s, r, o, c);
490
- l = c < 0.5 ? d - g : g - d, u = c < 0.5 ? f - p : p - f;
492
+ const h = c < 0.5 ? Math.min(1, c + 1e-3) : Math.max(0, c - 1e-3), f = X(e.startX, n, s, a, h), m = X(e.startY, i, r, o, h), p = X(e.startX, n, s, a, c), d = X(e.startY, i, r, o, c);
493
+ l = c < 0.5 ? f - p : p - f, u = c < 0.5 ? m - d : d - m;
491
494
  }
492
495
  return {
493
- x: X(e.startX, n, i, a, c),
494
- y: X(e.startY, s, r, o, c),
496
+ x: X(e.startX, n, s, a, c),
497
+ y: X(e.startY, i, r, o, c),
495
498
  angle: Math.atan2(u, l) * 180 / Math.PI
496
499
  };
497
500
  }
498
- function ne(e, t, n = 0, s = e.length) {
499
- if (s <= n) return { x: 0, y: 0, angle: 0 };
500
- let i = 0;
501
- for (let r = n; r < s; r++) {
501
+ function ie(e, t, n = 0, i = e.length) {
502
+ if (i <= n) return { x: 0, y: 0, angle: 0 };
503
+ let s = 0;
504
+ for (let r = n; r < i; r++) {
502
505
  const a = e[r];
503
- if (i + a.length >= t || r === s - 1)
504
- return Ve(a, t - i);
505
- i += a.length;
506
+ if (s + a.length >= t || r === i - 1)
507
+ return Be(a, t - s);
508
+ s += a.length;
506
509
  }
507
510
  return { x: 0, y: 0, angle: 0 };
508
511
  }
509
- function We(e, t) {
510
- const { segments: n, totalLength: s } = it(e);
511
- return ne(n, Math.max(0, Math.min(1, t)) * s);
512
- }
513
- const Be = 24, Ue = 320, je = 2.5, G = 72, He = 0.2, ze = 128, st = /* @__PURE__ */ new Map();
514
- let lt = 0, q;
515
- const Et = (e) => Math.round(e * 100) / 100;
516
- function Pt(e, t) {
517
- const { segments: n, subpaths: s, totalLength: i } = it(e);
512
+ function Ue(e, t) {
513
+ const { segments: n, totalLength: i } = rt(e);
514
+ return ie(n, Math.max(0, Math.min(1, t)) * i);
515
+ }
516
+ const je = 24, He = 320, ze = 2.5, Q = 72, Qe = 0.2, Ge = 128, it = /* @__PURE__ */ new Map();
517
+ let ht = 0, V;
518
+ const Pt = (e) => Math.round(e * 100) / 100;
519
+ function Ct(e, t) {
520
+ const { segments: n, subpaths: i, totalLength: s } = rt(e);
518
521
  if (n.length === 0) return [];
519
522
  if (t) {
520
- const r = s.every((a) => a.closed);
521
- return [{ segments: n, start: 0, end: n.length, length: i, closed: r }];
523
+ const r = i.every((a) => a.closed);
524
+ return [{ segments: n, start: 0, end: n.length, length: s, closed: r }];
522
525
  }
523
- return s.filter((r) => r.length > 0).map((r) => ({ segments: n, start: r.start, end: r.end, length: r.length, closed: r.closed }));
526
+ return i.filter((r) => r.length > 0).map((r) => ({ segments: n, start: r.start, end: r.end, length: r.length, closed: r.closed }));
524
527
  }
525
- function bt(e, t) {
526
- const n = e.closed ? (t % 1 + 1) % 1 : Math.max(0, Math.min(1, t)), s = ne(e.segments, n * e.length, e.start, e.end);
527
- return [s.x, s.y];
528
+ function vt(e, t) {
529
+ const n = e.closed ? (t % 1 + 1) % 1 : Math.max(0, Math.min(1, t)), i = ie(e.segments, n * e.length, e.start, e.end);
530
+ return [i.x, i.y];
528
531
  }
529
- function Ct(e) {
532
+ function It(e) {
530
533
  const t = [];
531
534
  let n = 0;
532
- for (let s = e.start; s < e.end; s++)
533
- n += e.segments[s].length, e.length > 0 && t.push(n / e.length);
535
+ for (let i = e.start; i < e.end; i++)
536
+ n += e.segments[i].length, e.length > 0 && t.push(n / e.length);
534
537
  return t;
535
538
  }
536
- function It(e, t) {
539
+ function Rt(e, t) {
537
540
  const n = [];
538
- for (let s = 0; s < t; s++)
539
- n.push(bt(e, e.closed ? s / t : s / (t - 1)));
541
+ for (let i = 0; i < t; i++)
542
+ n.push(vt(e, e.closed ? i / t : i / (t - 1)));
540
543
  return n;
541
544
  }
542
- function Rt(e) {
545
+ function $t(e) {
543
546
  let t = 0, n = 0;
544
- for (const [s, i] of e)
545
- t += s, n += i;
546
- return t /= e.length, n /= e.length, e.map(([s, i]) => [s - t, i - n]);
547
+ for (const [i, s] of e)
548
+ t += i, n += s;
549
+ return t /= e.length, n /= e.length, e.map(([i, s]) => [i - t, s - n]);
547
550
  }
548
- function Ge(e, t, n) {
549
- const s = e.closed && t.closed;
551
+ function Ze(e, t, n) {
552
+ const i = e.closed && t.closed;
550
553
  if (n !== void 0)
551
- return { offset: s ? Math.abs(n) % G / G : 0, reversed: n < 0 };
552
- const i = Rt(It(e, G)), r = Rt(It(t, G)), a = G;
554
+ return { offset: i ? Math.abs(n) % Q / Q : 0, reversed: n < 0 };
555
+ const s = $t(Rt(e, Q)), r = $t(Rt(t, Q)), a = Q;
553
556
  let o = { offset: 0, reversed: !1 }, c = 1 / 0;
554
557
  for (const l of [!1, !0]) {
555
- const u = s ? a : 1;
558
+ const u = i ? a : 1;
556
559
  for (let h = 0; h < u; h++) {
557
- let d = 0;
558
- for (let f = 0; f < a && d < c; f++) {
559
- const g = s ? l ? (h - f + a) % a : (f + h) % a : l ? a - 1 - f : f, p = i[f][0] - r[g][0], m = i[f][1] - r[g][1];
560
- d += p * p + m * m;
560
+ let f = 0;
561
+ for (let m = 0; m < a && f < c; m++) {
562
+ const p = i ? l ? (h - m + a) % a : (m + h) % a : l ? a - 1 - m : m, d = s[m][0] - r[p][0], g = s[m][1] - r[p][1];
563
+ f += d * d + g * g;
561
564
  }
562
- d < c && (c = d, o = { offset: s ? h / a : 0, reversed: l });
565
+ f < c && (c = f, o = { offset: i ? h / a : 0, reversed: l });
563
566
  }
564
567
  }
565
568
  return o;
566
569
  }
567
- function Qe(e, t, n) {
570
+ function Ke(e, t, n) {
568
571
  return n ? ((t.reversed ? t.offset - e : e + t.offset) % 1 + 1) % 1 : t.reversed ? 1 - e : e;
569
572
  }
570
- function Ze(e, t, n) {
573
+ function Je(e, t, n) {
571
574
  return n ? ((t.reversed ? t.offset - e : e - t.offset) % 1 + 1) % 1 : t.reversed ? 1 - e : e;
572
575
  }
573
- function Ke(e, t, n) {
574
- const s = e.closed && t.closed, i = Ge(e, t, n.shapeIndex), r = Math.max(
575
- Be,
576
- Math.min(Ue, Math.ceil(Math.max(e.length, t.length) / je))
576
+ function tn(e, t, n) {
577
+ const i = e.closed && t.closed, s = Ze(e, t, n.shapeIndex), r = Math.max(
578
+ je,
579
+ Math.min(He, Math.ceil(Math.max(e.length, t.length) / ze))
577
580
  ), a = /* @__PURE__ */ new Set(), o = (h) => a.add(Math.round(h * 1e7) / 1e7);
578
581
  for (let h = 0; h <= r; h++) o(h / r);
579
- for (const h of Ct(e)) o(h);
580
- for (const h of Ct(t)) o(Ze(h, i, s));
581
- let c = [...a].sort((h, d) => h - d);
582
- s && (c = c.filter((h) => h < 1));
582
+ for (const h of It(e)) o(h);
583
+ for (const h of It(t)) o(Je(h, s, i));
584
+ let c = [...a].sort((h, f) => h - f);
585
+ i && (c = c.filter((h) => h < 1));
583
586
  const l = [], u = [];
584
587
  for (const h of c)
585
- l.push(...bt(e, h)), u.push(...bt(t, Qe(h, i, s)));
586
- return Je({ from: l, to: u, closed: s });
588
+ l.push(...vt(e, h)), u.push(...vt(t, Ke(h, s, i)));
589
+ return en({ from: l, to: u, closed: i });
587
590
  }
588
- function Je(e) {
591
+ function en(e) {
589
592
  const t = e.from.length / 2;
590
593
  if (t <= 3) return e;
591
594
  const n = new Uint8Array(t);
592
595
  n[0] = 1, n[t - 1] = 1;
593
- const s = [[0, t - 1]];
594
- for (; s.length > 0; ) {
595
- const [a, o] = s.pop();
596
- let c = -1, l = He;
596
+ const i = [[0, t - 1]];
597
+ for (; i.length > 0; ) {
598
+ const [a, o] = i.pop();
599
+ let c = -1, l = Qe;
597
600
  for (let u = a + 1; u < o; u++) {
598
- const h = Math.max($t(e.from, a, o, u), $t(e.to, a, o, u));
601
+ const h = Math.max(Dt(e.from, a, o, u), Dt(e.to, a, o, u));
599
602
  h > l && (l = h, c = u);
600
603
  }
601
- c !== -1 && (n[c] = 1, s.push([a, c], [c, o]));
604
+ c !== -1 && (n[c] = 1, i.push([a, c], [c, o]));
602
605
  }
603
- const i = [], r = [];
606
+ const s = [], r = [];
604
607
  for (let a = 0; a < t; a++)
605
- n[a] && (i.push(e.from[a * 2], e.from[a * 2 + 1]), r.push(e.to[a * 2], e.to[a * 2 + 1]));
606
- return { from: i, to: r, closed: e.closed };
608
+ n[a] && (s.push(e.from[a * 2], e.from[a * 2 + 1]), r.push(e.to[a * 2], e.to[a * 2 + 1]));
609
+ return { from: s, to: r, closed: e.closed };
607
610
  }
608
- function $t(e, t, n, s) {
609
- const i = e[t * 2], r = e[t * 2 + 1], a = e[n * 2] - i, o = e[n * 2 + 1] - r, c = e[s * 2] - i, l = e[s * 2 + 1] - r, u = a * a + o * o, h = u === 0 ? 0 : Math.max(0, Math.min(1, (c * a + l * o) / u));
611
+ function Dt(e, t, n, i) {
612
+ const s = e[t * 2], r = e[t * 2 + 1], a = e[n * 2] - s, o = e[n * 2 + 1] - r, c = e[i * 2] - s, l = e[i * 2 + 1] - r, u = a * a + o * o, h = u === 0 ? 0 : Math.max(0, Math.min(1, (c * a + l * o) / u));
610
613
  return Math.hypot(c - h * a, l - h * o);
611
614
  }
612
- function tn(e, t, n) {
613
- const s = n.shapeIndex;
614
- if (q && q.from === e && q.to === t && q.shapeIndex === s) return q.plan;
615
- const r = st.get(String(s ?? "auto"))?.get(e)?.get(t);
615
+ function nn(e, t, n) {
616
+ const i = n.shapeIndex;
617
+ if (V && V.from === e && V.to === t && V.shapeIndex === i) return V.plan;
618
+ const r = it.get(String(i ?? "auto"))?.get(e)?.get(t);
616
619
  if (r)
617
- return q = { from: e, to: t, shapeIndex: s, plan: r }, r;
618
- const a = it(e).subpaths.filter((f) => f.length > 0).length === it(t).subpaths.filter((f) => f.length > 0).length, o = Pt(e, !a), c = Pt(t, !a), l = {
619
- pairs: o.map((f, g) => Ke(f, c[g], n))
620
+ return V = { from: e, to: t, shapeIndex: i, plan: r }, r;
621
+ const a = rt(e).subpaths.filter((m) => m.length > 0).length === rt(t).subpaths.filter((m) => m.length > 0).length, o = Ct(e, !a), c = Ct(t, !a), l = {
622
+ pairs: o.map((m, p) => tn(m, c[p], n))
620
623
  };
621
- lt >= ze && (st.clear(), lt = 0);
622
- const u = String(s ?? "auto"), h = st.get(u) ?? /* @__PURE__ */ new Map();
623
- st.set(u, h);
624
- const d = h.get(e) ?? /* @__PURE__ */ new Map();
625
- return h.set(e, d), d.set(t, l), lt++, q = { from: e, to: t, shapeIndex: s, plan: l }, l;
624
+ ht >= Ge && (it.clear(), ht = 0);
625
+ const u = String(i ?? "auto"), h = it.get(u) ?? /* @__PURE__ */ new Map();
626
+ it.set(u, h);
627
+ const f = h.get(e) ?? /* @__PURE__ */ new Map();
628
+ return h.set(e, f), f.set(t, l), ht++, V = { from: e, to: t, shapeIndex: i, plan: l }, l;
626
629
  }
627
- function en(e, t, n, s = {}) {
630
+ function sn(e, t, n, i = {}) {
628
631
  if (!e) return t;
629
632
  if (!t) return e;
630
- const i = Math.max(0, Math.min(1, n));
631
- if (i === 0) return e;
632
- if (i === 1) return t;
633
- const r = tn(e, t, s);
634
- if (r.pairs.length === 0) return i < 0.5 ? e : t;
633
+ const s = Math.max(0, Math.min(1, n));
634
+ if (s === 0) return e;
635
+ if (s === 1) return t;
636
+ const r = nn(e, t, i);
637
+ if (r.pairs.length === 0) return s < 0.5 ? e : t;
635
638
  let a = "";
636
639
  for (const o of r.pairs) {
637
640
  for (let c = 0; c < o.from.length; c += 2) {
638
- const l = Et(o.from[c] + (o.to[c] - o.from[c]) * i), u = Et(o.from[c + 1] + (o.to[c + 1] - o.from[c + 1]) * i);
641
+ const l = Pt(o.from[c] + (o.to[c] - o.from[c]) * s), u = Pt(o.from[c + 1] + (o.to[c + 1] - o.from[c + 1]) * s);
639
642
  a += `${c === 0 ? a ? " M" : "M" : " L"}${l} ${u}`;
640
643
  }
641
644
  o.closed && (a += " Z");
642
645
  }
643
646
  return a;
644
647
  }
645
- function nn(e) {
648
+ function rn(e) {
646
649
  return /^\s*[Mm]\s*[-+]?(?:\d|\.\d)/.test(e);
647
650
  }
648
- const F = (e, t, n) => e + (t - e) * n, se = 512, ht = /* @__PURE__ */ new Map(), ut = /* @__PURE__ */ new Map();
649
- function Dt(e) {
650
- const t = ht.get(e);
651
+ const an = 0.9995;
652
+ function on() {
653
+ return [0, 0, 0, 1];
654
+ }
655
+ function cn(e, t) {
656
+ return e[0] * t[0] + e[1] * t[1] + e[2] * t[2] + e[3] * t[3];
657
+ }
658
+ function ln(e) {
659
+ return Math.hypot(e[0], e[1], e[2], e[3]);
660
+ }
661
+ function K(e) {
662
+ const t = ln(e);
663
+ return t === 0 ? on() : [e[0] / t, e[1] / t, e[2] / t, e[3] / t];
664
+ }
665
+ function hn(e, t, n) {
666
+ const i = K(e);
667
+ let s = K(t), r = cn(i, s);
668
+ if (r < 0 && (s = [-s[0], -s[1], -s[2], -s[3]], r = -r), r > an)
669
+ return K([
670
+ i[0] + (s[0] - i[0]) * n,
671
+ i[1] + (s[1] - i[1]) * n,
672
+ i[2] + (s[2] - i[2]) * n,
673
+ i[3] + (s[3] - i[3]) * n
674
+ ]);
675
+ const a = Math.acos(r), o = Math.sin(a), c = Math.sin((1 - n) * a) / o, l = Math.sin(n * a) / o;
676
+ return K([
677
+ i[0] * c + s[0] * l,
678
+ i[1] * c + s[1] * l,
679
+ i[2] * c + s[2] * l,
680
+ i[3] * c + s[3] * l
681
+ ]);
682
+ }
683
+ const F = (e, t, n) => e + (t - e) * n, se = 512, ut = /* @__PURE__ */ new Map(), dt = /* @__PURE__ */ new Map();
684
+ function Lt(e) {
685
+ const t = ut.get(e);
651
686
  if (t) return t;
652
- const n = e.replace("#", ""), s = [
687
+ const n = e.replace("#", ""), i = [
653
688
  parseInt(n.slice(0, 2), 16),
654
689
  parseInt(n.slice(2, 4), 16),
655
690
  parseInt(n.slice(4, 6), 16)
656
691
  ];
657
- return ht.size < se && ht.set(e, s), s;
692
+ return ut.size < se && ut.set(e, i), i;
658
693
  }
659
- const Lt = (e) => e.charCodeAt(0) === 35, Ot = (e) => e.startsWith("rgb"), Nt = (e) => e.startsWith("rgba"), sn = /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/, dt = (e) => Math.round(e).toString(16).padStart(2, "0");
660
- function rn(e, t, n) {
661
- return `#${dt(e)}${dt(t)}${dt(n)}`;
694
+ const Ot = (e) => e.charCodeAt(0) === 35, Nt = (e) => e.startsWith("rgb"), Ft = (e) => e.startsWith("rgba"), un = /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/, ft = (e) => Math.round(e).toString(16).padStart(2, "0");
695
+ function dn(e, t, n) {
696
+ return `#${ft(e)}${ft(t)}${ft(n)}`;
662
697
  }
663
- function Ft(e) {
664
- const t = ut.get(e);
698
+ function Xt(e) {
699
+ const t = dt.get(e);
665
700
  if (t) return t;
666
- const n = e.match(sn);
701
+ const n = e.match(un);
667
702
  if (!n)
668
703
  throw new Error(`Invalid rgb color: ${e}`);
669
- const s = parseInt(n[1], 10), i = parseInt(n[2], 10), r = parseInt(n[3], 10), a = n[4] !== void 0 ? [s, i, r, parseFloat(n[4])] : [s, i, r];
670
- return ut.size < se && ut.set(e, a), a;
671
- }
672
- const an = (e, t, n) => {
673
- if (Lt(e) && Lt(t)) {
674
- const [s, i, r] = Dt(e), [a, o, c] = Dt(t), l = F(s, a, n), u = F(i, o, n), h = F(r, c, n);
675
- return rn(l, u, h);
676
- }
677
- if ((Ot(e) || Nt(e)) && (Ot(t) || Nt(t))) {
678
- const s = Ft(e), i = Ft(t), r = Math.round(F(s[0], i[0], n)), a = Math.round(F(s[1], i[1], n)), o = Math.round(F(s[2], i[2], n));
679
- if (s.length === 4 || i.length === 4) {
680
- const c = s[3] ?? 1, l = i[3] ?? 1, u = F(c, l, n);
704
+ const i = parseInt(n[1], 10), s = parseInt(n[2], 10), r = parseInt(n[3], 10), a = n[4] !== void 0 ? [i, s, r, parseFloat(n[4])] : [i, s, r];
705
+ return dt.size < se && dt.set(e, a), a;
706
+ }
707
+ const fn = (e, t, n) => {
708
+ if (Ot(e) && Ot(t)) {
709
+ const [i, s, r] = Lt(e), [a, o, c] = Lt(t), l = F(i, a, n), u = F(s, o, n), h = F(r, c, n);
710
+ return dn(l, u, h);
711
+ }
712
+ if ((Nt(e) || Ft(e)) && (Nt(t) || Ft(t))) {
713
+ const i = Xt(e), s = Xt(t), r = Math.round(F(i[0], s[0], n)), a = Math.round(F(i[1], s[1], n)), o = Math.round(F(i[2], s[2], n));
714
+ if (i.length === 4 || s.length === 4) {
715
+ const c = i[3] ?? 1, l = s[3] ?? 1, u = F(c, l, n);
681
716
  return `rgba(${r}, ${a}, ${o}, ${u})`;
682
717
  }
683
718
  return `rgb(${r}, ${a}, ${o})`;
684
719
  }
685
720
  return n < 1 ? e : t;
686
- }, on = (e, t, n) => {
687
- const s = Math.min(e.length, t.length), i = [];
688
- for (let r = 0; r < s; r++)
689
- i.push(F(e[r], t[r], n));
690
- return i;
691
- }, Xt = (e, t, n) => n < 1 ? e : t, cn = (e, t, n) => en(e, t, n);
692
- function ln(e) {
693
- return typeof e == "number" ? F : Array.isArray(e) ? on : typeof e == "string" ? e.startsWith("#") || e.startsWith("rgb") ? an : nn(e) ? cn : Xt : Xt;
694
- }
695
- function hn(e) {
696
- const t = [...e.keyframes].sort((n, s) => n.time - s.time);
721
+ }, pn = (e, t, n) => {
722
+ const i = Math.min(e.length, t.length), s = [];
723
+ for (let r = 0; r < i; r++)
724
+ s.push(F(e[r], t[r], n));
725
+ return s;
726
+ }, mn = (e, t, n) => hn(e, t, n), Yt = (e, t, n) => n < 1 ? e : t, gn = (e, t, n) => sn(e, t, n);
727
+ function yn(e, t) {
728
+ return t === "slerp" ? mn : typeof e == "number" ? F : Array.isArray(e) ? pn : typeof e == "string" ? e.startsWith("#") || e.startsWith("rgb") ? fn : rn(e) ? gn : Yt : Yt;
729
+ }
730
+ function bn(e) {
731
+ const t = [...e.keyframes].sort((n, i) => n.time - i.time);
697
732
  return {
698
733
  ...e,
699
734
  keyframes: t
700
735
  };
701
736
  }
702
- function V(e) {
737
+ function q(e) {
703
738
  return e.targets && e.targets.length > 0 ? e.targets : [e.target];
704
739
  }
705
- function U(e, t, n, s) {
706
- const i = n ?? 0;
707
- return !s || t <= 1 ? i : i + Gt(e, t, s);
740
+ function U(e, t, n, i) {
741
+ const s = n ?? 0;
742
+ return !i || t <= 1 ? s : s + Gt(e, t, i);
708
743
  }
709
- class ft {
744
+ class pt {
710
745
  track;
711
746
  targets;
712
747
  constructor(t) {
713
- this.track = t, this.targets = V(t);
748
+ this.track = t, this.targets = q(t);
714
749
  }
715
750
  /**
716
751
  * Get the interpolated value at a specific time.
@@ -728,12 +763,12 @@ class ft {
728
763
  * each sampled at its own offset time.
729
764
  */
730
765
  getTargetValues(t) {
731
- const n = this.targets.length, s = [];
732
- for (let i = 0; i < n; i++) {
733
- const r = U(i, n, this.track.delay, this.track.stagger), a = this.valueForOffset(t - r);
734
- a !== void 0 && s.push({ target: this.targets[i], value: a, start: r + this.track.keyframes[0].time });
766
+ const n = this.targets.length, i = [];
767
+ for (let s = 0; s < n; s++) {
768
+ const r = U(s, n, this.track.delay, this.track.stagger), a = this.valueForOffset(t - r);
769
+ a !== void 0 && i.push({ target: this.targets[s], value: a, start: r + this.track.keyframes[0].time });
735
770
  }
736
- return s;
771
+ return i;
737
772
  }
738
773
  /**
739
774
  * Get the duration of this track — the last keyframe, plus any delay, the
@@ -743,8 +778,8 @@ class ft {
743
778
  const { keyframes: t } = this.track;
744
779
  if (t.length === 0)
745
780
  return 0;
746
- const n = t[t.length - 1].time, s = this.track.stagger ? xt(this.targets.length, this.track.stagger) : 0;
747
- return n + (this.track.delay ?? 0) + s + (this.track.endDelay ?? 0);
781
+ const n = t[t.length - 1].time, i = this.track.stagger ? wt(this.targets.length, this.track.stagger) : 0;
782
+ return n + (this.track.delay ?? 0) + i + (this.track.endDelay ?? 0);
748
783
  }
749
784
  /**
750
785
  * Get the track metadata.
@@ -761,122 +796,122 @@ class ft {
761
796
  return n[0].value;
762
797
  if (t >= n[n.length - 1].time)
763
798
  return n[n.length - 1].value;
764
- const { from: s, to: i } = this.findSurroundingKeyframes(t);
765
- if (!s || !i)
799
+ const { from: i, to: s } = this.findSurroundingKeyframes(t);
800
+ if (!i || !s)
766
801
  return;
767
- if (s.time === t)
768
- return s.value;
769
- const r = i.time - s.time, a = (t - s.time) / r, c = De(i.easing)(a);
770
- return ln(s.value)(s.value, i.value, c);
802
+ if (i.time === t)
803
+ return i.value;
804
+ const r = s.time - i.time, a = (t - i.time) / r, c = Oe(s.easing)(a);
805
+ return yn(i.value, this.track.interpolation)(i.value, s.value, c);
771
806
  }
772
807
  /**
773
808
  * Find the keyframes surrounding a given time.
774
809
  */
775
810
  findSurroundingKeyframes(t) {
776
811
  const { keyframes: n } = this.track;
777
- for (let s = 0; s < n.length - 1; s++)
778
- if (t >= n[s].time && t <= n[s + 1].time)
779
- return { from: n[s], to: n[s + 1] };
812
+ for (let i = 0; i < n.length - 1; i++)
813
+ if (t >= n[i].time && t <= n[i + 1].time)
814
+ return { from: n[i], to: n[i + 1] };
780
815
  return { from: null, to: null };
781
816
  }
782
817
  }
783
- class un {
818
+ class vn {
784
819
  track;
785
820
  targets;
786
821
  sampler;
787
822
  constructor(t) {
788
- this.track = t, this.targets = V(t), this.sampler = new me(t.spring);
823
+ this.track = t, this.targets = q(t), this.sampler = new ye(t.spring);
789
824
  }
790
825
  getValueAtTime(t) {
791
826
  return this.sampler.valueAt(t - U(0, this.targets.length, this.track.delay, this.track.stagger));
792
827
  }
793
828
  getTargetValues(t) {
794
- const n = this.targets.length, s = [];
795
- for (let i = 0; i < n; i++) {
796
- const r = U(i, n, this.track.delay, this.track.stagger);
797
- s.push({ target: this.targets[i], value: this.sampler.valueAt(t - r), start: r });
829
+ const n = this.targets.length, i = [];
830
+ for (let s = 0; s < n; s++) {
831
+ const r = U(s, n, this.track.delay, this.track.stagger);
832
+ i.push({ target: this.targets[s], value: this.sampler.valueAt(t - r), start: r });
798
833
  }
799
- return s;
834
+ return i;
800
835
  }
801
836
  /** Settle time plus delay and the widest stagger offset. */
802
837
  getDuration() {
803
- const t = this.track.stagger ? xt(this.targets.length, this.track.stagger) : 0;
838
+ const t = this.track.stagger ? wt(this.targets.length, this.track.stagger) : 0;
804
839
  return this.sampler.settleTime() + (this.track.delay ?? 0) + t;
805
840
  }
806
841
  getTrack() {
807
842
  return this.track;
808
843
  }
809
844
  }
810
- class dn {
845
+ class kn {
811
846
  track;
812
847
  targets;
813
848
  duration;
814
849
  constructor(t) {
815
- this.track = t, this.targets = V(t), this.duration = Kt(t.inertia);
850
+ this.track = t, this.targets = q(t), this.duration = Jt(t.inertia);
816
851
  }
817
852
  getValueAtTime(t) {
818
- return Tt(this.track.inertia, t - U(0, this.targets.length, this.track.delay, this.track.stagger));
853
+ return _t(this.track.inertia, t - U(0, this.targets.length, this.track.delay, this.track.stagger));
819
854
  }
820
855
  getTargetValues(t) {
821
- const n = this.targets.length, s = [];
822
- for (let i = 0; i < n; i++) {
823
- const r = U(i, n, this.track.delay, this.track.stagger);
824
- s.push({ target: this.targets[i], value: Tt(this.track.inertia, t - r), start: r });
856
+ const n = this.targets.length, i = [];
857
+ for (let s = 0; s < n; s++) {
858
+ const r = U(s, n, this.track.delay, this.track.stagger);
859
+ i.push({ target: this.targets[s], value: _t(this.track.inertia, t - r), start: r });
825
860
  }
826
- return s;
861
+ return i;
827
862
  }
828
863
  /** Settle time plus delay and the widest stagger offset. */
829
864
  getDuration() {
830
- const t = this.track.stagger ? xt(this.targets.length, this.track.stagger) : 0;
865
+ const t = this.track.stagger ? wt(this.targets.length, this.track.stagger) : 0;
831
866
  return this.duration + (this.track.delay ?? 0) + t;
832
867
  }
833
868
  getTrack() {
834
869
  return this.track;
835
870
  }
836
871
  }
837
- function fn(e, t) {
838
- const n = { ...We(e.pathData, t) };
872
+ function xn(e, t) {
873
+ const n = { ...Ue(e.pathData, t) };
839
874
  if (e.matrix) {
840
- const [s, i, r, a, o, c] = e.matrix, { x: l, y: u } = n;
841
- n.x = s * l + r * u + o, n.y = i * l + a * u + c;
842
- const h = n.angle * Math.PI / 180, d = Math.cos(h), f = Math.sin(h);
843
- n.angle = Math.atan2(i * d + a * f, s * d + r * f) * 180 / Math.PI;
875
+ const [i, s, r, a, o, c] = e.matrix, { x: l, y: u } = n;
876
+ n.x = i * l + r * u + o, n.y = s * l + a * u + c;
877
+ const h = n.angle * Math.PI / 180, f = Math.cos(h), m = Math.sin(h);
878
+ n.angle = Math.atan2(s * f + a * m, i * f + r * m) * 180 / Math.PI;
844
879
  }
845
880
  return e.autoRotate && e.rotateOffset && (n.angle += e.rotateOffset), n;
846
881
  }
847
- const pt = {
882
+ const mt = {
848
883
  upperCase: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
849
884
  lowerCase: "abcdefghijklmnopqrstuvwxyz",
850
885
  upperAndLowerCase: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
851
886
  numbers: "0123456789"
852
- }, pn = 20;
853
- function mn(e) {
854
- const t = pt[e ?? "upperCase"] ?? e ?? pt.upperCase, n = Array.from(t);
855
- return n.length > 0 ? n : Array.from(pt.upperCase);
856
- }
857
- function gn(e, t, n) {
858
- let s = (e | 0) ^ Math.imul(t + 1, 2654435761) ^ Math.imul(n + 1, 2246822507);
859
- return s = Math.imul(s ^ s >>> 16, 2146121005), s = Math.imul(s ^ s >>> 15, 2221713035), (s ^ s >>> 16) >>> 0;
860
- }
861
- function yn(e, t, n = 0) {
862
- const s = e.from ?? "", i = e.to, r = Math.max(0, Math.min(1, t));
863
- if (r <= 0) return s;
864
- if (r >= 1) return i;
865
- const a = Array.from(s), o = Array.from(i), c = e.rightToLeft ?? !1;
887
+ }, wn = 20;
888
+ function Mn(e) {
889
+ const t = mt[e ?? "upperCase"] ?? e ?? mt.upperCase, n = Array.from(t);
890
+ return n.length > 0 ? n : Array.from(mt.upperCase);
891
+ }
892
+ function Sn(e, t, n) {
893
+ let i = (e | 0) ^ Math.imul(t + 1, 2654435761) ^ Math.imul(n + 1, 2246822507);
894
+ return i = Math.imul(i ^ i >>> 16, 2146121005), i = Math.imul(i ^ i >>> 15, 2221713035), (i ^ i >>> 16) >>> 0;
895
+ }
896
+ function Tn(e, t, n = 0) {
897
+ const i = e.from ?? "", s = e.to, r = Math.max(0, Math.min(1, t));
898
+ if (r <= 0) return i;
899
+ if (r >= 1) return s;
900
+ const a = Array.from(i), o = Array.from(s), c = e.rightToLeft ?? !1;
866
901
  if (e.mode === "type") {
867
902
  const v = Math.round(r * Math.max(a.length, o.length));
868
903
  return c ? a.slice(0, Math.max(0, a.length - v)).join("") + o.slice(Math.max(0, o.length - v)).join("") : o.slice(0, v).join("") + a.slice(v).join("");
869
904
  }
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), d = e.tweenLength === !1 ? o.length : Math.round(a.length + (o.length - a.length) * r), f = mn(e.chars), g = e.refreshRate ?? pn, p = g > 0 ? Math.floor(n * g / 1e3) : 0, m = e.seed ?? 1;
905
+ 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), m = Mn(e.chars), p = e.refreshRate ?? wn, d = p > 0 ? Math.floor(n * p / 1e3) : 0, g = e.seed ?? 1;
871
906
  let b = "";
872
- for (let v = 0; v < d; v++) {
873
- const k = c ? v >= d - h : v < h, M = c ? o[o.length - (d - v)] : o[v];
907
+ for (let v = 0; v < f; v++) {
908
+ const k = c ? v >= f - h : v < h, M = c ? o[o.length - (f - v)] : o[v];
874
909
  k && M !== void 0 || M === " " || M === `
875
- ` ? b += M : b += f[gn(m, v, p) % f.length];
910
+ ` ? b += M : b += m[Sn(g, v, d) % m.length];
876
911
  }
877
912
  return b;
878
913
  }
879
- class bn {
914
+ class _n {
880
915
  id;
881
916
  name;
882
917
  _captions;
@@ -989,31 +1024,31 @@ class bn {
989
1024
  const n = this.duration;
990
1025
  if (n <= 0)
991
1026
  return;
992
- let i = t * this.speed;
1027
+ let s = t * this.speed;
993
1028
  if (this._repeatDelayRemaining > 0) {
994
- const o = Math.min(this._repeatDelayRemaining, i);
995
- if (this._repeatDelayRemaining -= o, i -= o, this._repeatDelayRemaining > 0) {
1029
+ const o = Math.min(this._repeatDelayRemaining, s);
1030
+ if (this._repeatDelayRemaining -= o, s -= o, this._repeatDelayRemaining > 0) {
996
1031
  this.onUpdate?.(this.getStateAtTime(this._currentTime));
997
1032
  return;
998
1033
  }
999
1034
  this._wrapAfterDelay && (this._wrapAfterDelay = !1, this._currentTime = 0);
1000
1035
  }
1001
1036
  const r = 1e3;
1002
- for (let o = 0; o < r && i > 0 && this._playbackState === "playing"; o++)
1037
+ for (let o = 0; o < r && s > 0 && this._playbackState === "playing"; o++)
1003
1038
  if (this._direction === "forward") {
1004
1039
  const c = n - this._currentTime;
1005
- if (i >= c) {
1006
- if (i -= c, this._currentTime = n, !this._handleEndReached())
1040
+ if (s >= c) {
1041
+ if (s -= c, this._currentTime = n, !this._handleEndReached())
1007
1042
  break;
1008
1043
  } else
1009
- this._currentTime += i, i = 0;
1044
+ this._currentTime += s, s = 0;
1010
1045
  } else {
1011
1046
  const c = this._currentTime;
1012
- if (i >= c) {
1013
- if (i -= c, this._currentTime = 0, !this._handleStartReached())
1047
+ if (s >= c) {
1048
+ if (s -= c, this._currentTime = 0, !this._handleStartReached())
1014
1049
  break;
1015
1050
  } else
1016
- this._currentTime -= i, i = 0;
1051
+ this._currentTime -= s, s = 0;
1017
1052
  }
1018
1053
  const a = this.getStateAtTime(this._currentTime);
1019
1054
  this.onUpdate?.(a);
@@ -1026,10 +1061,10 @@ class bn {
1026
1061
  if (this._hasSharedWrites())
1027
1062
  this._resolveShared(t, n);
1028
1063
  else
1029
- for (const [s, i] of this._trackPlayers) {
1030
- const r = i.getTrack().property;
1031
- for (const { target: a, value: o, start: c } of i.getTargetValues(t))
1032
- this._write(n, s, a, r, o, t - c);
1064
+ for (const [i, s] of this._trackPlayers) {
1065
+ const r = s.getTrack().property;
1066
+ for (const { target: a, value: o, start: c } of s.getTargetValues(t))
1067
+ this._write(n, i, a, r, o, t - c);
1033
1068
  }
1034
1069
  return {
1035
1070
  values: n,
@@ -1053,37 +1088,37 @@ class bn {
1053
1088
  * turn. `findConflicts()` reports overlaps by the same rule.
1054
1089
  */
1055
1090
  _resolveShared(t, n) {
1056
- const s = /* @__PURE__ */ new Map();
1057
- for (const [i, r] of this._trackPlayers) {
1091
+ const i = /* @__PURE__ */ new Map();
1092
+ for (const [s, r] of this._trackPlayers) {
1058
1093
  const a = r.getTrack().property;
1059
1094
  for (const { target: o, value: c, start: l } of r.getTargetValues(t)) {
1060
- const u = `${o}\0${a}`, h = l <= t, d = s.get(u);
1061
- (!d || (h !== d.started ? h : h ? l >= d.start : l <= d.start)) && s.set(u, { trackId: i, target: o, property: a, value: c, start: l, started: h });
1095
+ const u = `${o}\0${a}`, h = l <= t, f = i.get(u);
1096
+ (!f || (h !== f.started ? h : h ? l >= f.start : l <= f.start)) && i.set(u, { trackId: s, target: o, property: a, value: c, start: l, started: h });
1062
1097
  }
1063
1098
  }
1064
- for (const { trackId: i, target: r, property: a, value: o, start: c } of s.values())
1065
- this._write(n, i, r, a, o, t - c);
1099
+ for (const { trackId: s, target: r, property: a, value: o, start: c } of i.values())
1100
+ this._write(n, s, r, a, o, t - c);
1066
1101
  }
1067
1102
  /**
1068
1103
  * Write one track's value for a target, expanding the progress of motion paths
1069
1104
  * (into x/y/rotation) and text tracks (into the string). `elapsed` is the time
1070
1105
  * since this target's animation on the track started.
1071
1106
  */
1072
- _write(t, n, s, i, r, a) {
1107
+ _write(t, n, i, s, r, a) {
1073
1108
  if (r === void 0) return;
1074
- let o = t.get(s);
1075
- o || (o = /* @__PURE__ */ new Map(), t.set(s, o));
1109
+ let o = t.get(i);
1110
+ o || (o = /* @__PURE__ */ new Map(), t.set(i, o));
1076
1111
  const c = this._textTracks.get(n);
1077
1112
  if (c && typeof r == "number") {
1078
- o.set("text", yn(c.textConfig, r, Math.max(0, a)));
1113
+ o.set("text", Tn(c.textConfig, r, Math.max(0, a)));
1079
1114
  return;
1080
1115
  }
1081
1116
  const l = this._motionPathTracks.get(n);
1082
1117
  if (l && typeof r == "number") {
1083
- const u = fn(l.motionPathConfig, r);
1118
+ const u = xn(l.motionPathConfig, r);
1084
1119
  o.set("motionPathX", u.x), o.set("motionPathY", u.y), l.motionPathConfig.autoRotate && o.set("motionPathRotate", u.angle);
1085
1120
  } else
1086
- o.set(i, r);
1121
+ o.set(s, r);
1087
1122
  }
1088
1123
  /** Cached: does any target+property have more than one track? */
1089
1124
  _sharedWrites = null;
@@ -1092,13 +1127,13 @@ class bn {
1092
1127
  const t = /* @__PURE__ */ new Set();
1093
1128
  this._sharedWrites = !1;
1094
1129
  t: for (const n of this._tracks)
1095
- for (const s of V(n)) {
1096
- const i = `${s}\0${n.property}`;
1097
- if (t.has(i)) {
1130
+ for (const i of q(n)) {
1131
+ const s = `${i}\0${n.property}`;
1132
+ if (t.has(s)) {
1098
1133
  this._sharedWrites = !0;
1099
1134
  break t;
1100
1135
  }
1101
- t.add(i);
1136
+ t.add(s);
1102
1137
  }
1103
1138
  }
1104
1139
  return this._sharedWrites;
@@ -1107,17 +1142,17 @@ class bn {
1107
1142
  * Add a track to the timeline.
1108
1143
  */
1109
1144
  addTrack(t) {
1110
- if (this._tracks.push(t), this._sharedWrites = null, mt(t)) {
1111
- this._trackPlayers.set(t.id, new dn(t));
1145
+ if (this._tracks.push(t), this._sharedWrites = null, gt(t)) {
1146
+ this._trackPlayers.set(t.id, new kn(t));
1112
1147
  return;
1113
1148
  }
1114
- if (gt(t)) {
1115
- this._trackPlayers.set(t.id, new un(t)), this._springTracks.set(t.id, t);
1149
+ if (yt(t)) {
1150
+ this._trackPlayers.set(t.id, new vn(t)), this._springTracks.set(t.id, t);
1116
1151
  return;
1117
1152
  }
1118
- if (Ht(t))
1119
- this._trackPlayers.set(t.id, new ft(t)), this._textTracks.set(t.id, t);
1120
- else if (de(t)) {
1153
+ if (zt(t))
1154
+ this._trackPlayers.set(t.id, new pt(t)), this._textTracks.set(t.id, t);
1155
+ else if (pe(t)) {
1121
1156
  const n = {
1122
1157
  id: t.id,
1123
1158
  target: t.target,
@@ -1128,9 +1163,9 @@ class bn {
1128
1163
  targets: t.targets,
1129
1164
  stagger: t.stagger
1130
1165
  };
1131
- this._trackPlayers.set(t.id, new ft(n)), this._motionPathTracks.set(t.id, t);
1166
+ this._trackPlayers.set(t.id, new pt(n)), this._motionPathTracks.set(t.id, t);
1132
1167
  } else
1133
- this._trackPlayers.set(t.id, new ft(t));
1168
+ this._trackPlayers.set(t.id, new pt(t));
1134
1169
  }
1135
1170
  /**
1136
1171
  * Replace a track with a new version, keeping its place in the track order
@@ -1138,13 +1173,13 @@ class bn {
1138
1173
  * different id. Does nothing if no track has `trackId`.
1139
1174
  */
1140
1175
  replaceTrack(t, n) {
1141
- const s = this._tracks.findIndex((r) => r.id === t);
1142
- if (s < 0) return;
1143
- const i = this._tracks.slice(s + 1);
1176
+ const i = this._tracks.findIndex((r) => r.id === t);
1177
+ if (i < 0) return;
1178
+ const s = this._tracks.slice(i + 1);
1144
1179
  this.removeTrack(t);
1145
- for (const r of i) this.removeTrack(r.id);
1180
+ for (const r of s) this.removeTrack(r.id);
1146
1181
  this.addTrack(n);
1147
- for (const r of i) this.addTrack(r);
1182
+ for (const r of s) this.addTrack(r);
1148
1183
  }
1149
1184
  /**
1150
1185
  * Remove a track by its ID.
@@ -1169,9 +1204,9 @@ class bn {
1169
1204
  * tweens on an element.
1170
1205
  */
1171
1206
  removeTracks(t = {}) {
1172
- const n = this.getTracks(t).map((s) => s.id);
1173
- for (const s of n)
1174
- this.removeTrack(s);
1207
+ const n = this.getTracks(t).map((i) => i.id);
1208
+ for (const i of n)
1209
+ this.removeTrack(i);
1175
1210
  return n;
1176
1211
  }
1177
1212
  /**
@@ -1180,12 +1215,12 @@ class bn {
1180
1215
  getTrackSpan(t) {
1181
1216
  const n = this._trackPlayers.get(t);
1182
1217
  if (!n) return;
1183
- const s = n.getTrack(), i = s.delay ?? 0;
1184
- if (gt(s) || mt(s))
1185
- return { from: i, to: n.getDuration() };
1186
- const r = s.keyframes;
1218
+ const i = n.getTrack(), s = i.delay ?? 0;
1219
+ if (yt(i) || gt(i))
1220
+ return { from: s, to: n.getDuration() };
1221
+ const r = i.keyframes;
1187
1222
  if (!(!r || r.length === 0))
1188
- return { from: r[0].time + i, to: n.getDuration() };
1223
+ return { from: r[0].time + s, to: n.getDuration() };
1189
1224
  }
1190
1225
  /**
1191
1226
  * Overlapping writes to the same target+property.
@@ -1198,32 +1233,32 @@ class bn {
1198
1233
  findConflicts() {
1199
1234
  const t = [];
1200
1235
  for (let n = 0; n < this._tracks.length; n++) {
1201
- const s = this._tracks[n], i = this.getTrackSpan(s.id);
1202
- if (i)
1236
+ const i = this._tracks[n], s = this.getTrackSpan(i.id);
1237
+ if (s)
1203
1238
  for (let r = 0; r < n; r++) {
1204
1239
  const a = this._tracks[r];
1205
- if (a.property !== s.property) continue;
1206
- const o = V(a).filter((h) => V(s).includes(h));
1240
+ if (a.property !== i.property) continue;
1241
+ const o = q(a).filter((h) => q(i).includes(h));
1207
1242
  if (o.length === 0) continue;
1208
1243
  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;
1244
+ if (!c || !(c.from <= s.to && s.from <= c.to)) continue;
1245
+ const u = s.from >= c.from;
1211
1246
  for (const h of o)
1212
1247
  t.push({
1213
1248
  target: h,
1214
- property: s.property,
1215
- losingTrackId: u ? a.id : s.id,
1216
- winningTrackId: u ? s.id : a.id
1249
+ property: i.property,
1250
+ losingTrackId: u ? a.id : i.id,
1251
+ winningTrackId: u ? i.id : a.id
1217
1252
  });
1218
1253
  }
1219
1254
  }
1220
1255
  return t;
1221
1256
  }
1222
1257
  _matches(t, n) {
1223
- if (n.id !== void 0 && t.id !== n.id || n.property !== void 0 && t.property !== n.property || n.target !== void 0 && !V(t).includes(n.target)) return !1;
1258
+ if (n.id !== void 0 && t.id !== n.id || n.property !== void 0 && t.property !== n.property || n.target !== void 0 && !q(t).includes(n.target)) return !1;
1224
1259
  if (n.timeRange) {
1225
- const s = this.getTrackSpan(t.id);
1226
- if (!s || s.to < n.timeRange.from || s.from > n.timeRange.to) return !1;
1260
+ const i = this.getTrackSpan(t.id);
1261
+ if (!i || i.to < n.timeRange.from || i.from > n.timeRange.to) return !1;
1227
1262
  }
1228
1263
  return !0;
1229
1264
  }
@@ -1232,7 +1267,7 @@ class bn {
1232
1267
  */
1233
1268
  toDefinition() {
1234
1269
  return {
1235
- formatVersion: J,
1270
+ formatVersion: fe(this._tracks),
1236
1271
  id: this.id,
1237
1272
  name: this.name,
1238
1273
  config: { ...this._config },
@@ -1250,8 +1285,8 @@ class bn {
1250
1285
  }
1251
1286
  /** Replace the markers (kept in time order); an empty list removes them. */
1252
1287
  setMarkers(t) {
1253
- const n = t && t.length > 0 ? [...t].sort((i, r) => i.time - r.time).map((i) => ({ ...i })) : void 0, s = { ...this._config };
1254
- n ? s.markers = n : delete s.markers, this._config = s;
1288
+ const n = t && t.length > 0 ? [...t].sort((s, r) => s.time - r.time).map((s) => ({ ...s })) : void 0, i = { ...this._config };
1289
+ n ? i.markers = n : delete i.markers, this._config = i;
1255
1290
  }
1256
1291
  /** Caption text per language, per marker id */
1257
1292
  get captions() {
@@ -1260,7 +1295,7 @@ class bn {
1260
1295
  /** Replace the captions; languages with no captions are dropped. */
1261
1296
  setCaptions(t) {
1262
1297
  const n = {};
1263
- for (const [s, i] of Object.entries(t ?? {})) n[s] = { ...i };
1298
+ for (const [i, s] of Object.entries(t ?? {})) n[i] = { ...s };
1264
1299
  this._captions = Object.keys(n).length > 0 ? n : void 0;
1265
1300
  }
1266
1301
  /** Start the between-iterations pause, if the timeline configures one. */
@@ -1290,28 +1325,28 @@ class bn {
1290
1325
  return this._config.alternate && (t === -1 || this._loopIteration < t) ? (this._loopIteration++, this._armRepeatDelay(), this._direction = "forward", this._repeatDelayRemaining === 0) : (this._playbackState = "idle", this.onComplete?.(), !1);
1291
1326
  }
1292
1327
  }
1293
- const vn = 100;
1294
- function kn(e, t, n, s) {
1295
- const i = [], r = [], { duration: a, alternate: o } = s, c = (f, g, p, m) => {
1296
- r.push([f, g]);
1328
+ const An = 100;
1329
+ function En(e, t, n, i) {
1330
+ const s = [], r = [], { duration: a, alternate: o } = i, c = (m, p, d, g) => {
1331
+ r.push([m, p]);
1297
1332
  const b = [];
1298
1333
  e.forEach((v, k) => {
1299
- (p === "forward" ? (m ? v >= f : v > f) && v <= g : (m ? v <= f : v < f) && v >= g) && b.push(k);
1300
- }), b.sort((v, k) => (p === "forward" ? e[v] - e[k] : e[k] - e[v]) || v - k);
1301
- for (const v of b) i.push({ kind: "event", index: v, direction: p });
1334
+ (d === "forward" ? (g ? v >= m : v > m) && v <= p : (g ? v <= m : v < m) && v >= p) && b.push(k);
1335
+ }), b.sort((v, k) => (d === "forward" ? e[v] - e[k] : e[k] - e[v]) || v - k);
1336
+ for (const v of b) s.push({ kind: "event", index: v, direction: d });
1302
1337
  };
1303
1338
  let l = t.time, u = t.direction, h = t.fresh === !0;
1304
- const d = Math.min(vn, Math.max(0, n.iteration - t.iteration));
1305
- for (let f = 0; f < d; f++) {
1306
- const g = u === "forward" ? a : 0;
1307
- c(l, g, u, h), i.push({ kind: "repeat" }), o ? (u = u === "forward" ? "reverse" : "forward", l = g, h = !1) : (l = u === "forward" ? 0 : a, h = !0);
1339
+ const f = Math.min(An, Math.max(0, n.iteration - t.iteration));
1340
+ for (let m = 0; m < f; m++) {
1341
+ const p = u === "forward" ? a : 0;
1342
+ c(l, p, u, h), s.push({ kind: "repeat" }), o ? (u = u === "forward" ? "reverse" : "forward", l = p, h = !1) : (l = u === "forward" ? 0 : a, h = !0);
1308
1343
  }
1309
- return d > 0 && s.holding && !o ? { crossings: i, passes: r } : (c(l, n.time, u, h), { crossings: i, passes: r });
1344
+ return f > 0 && i.holding && !o ? { crossings: s, passes: r } : (c(l, n.time, u, h), { crossings: s, passes: r });
1310
1345
  }
1311
- function xn(e) {
1346
+ function Pn(e) {
1312
1347
  return { ...e, ...Array.isArray(e.end) && { end: [...e.end] } };
1313
1348
  }
1314
- function Q(e) {
1349
+ function G(e) {
1315
1350
  const t = e.endDelay;
1316
1351
  return {
1317
1352
  ...e.delay !== void 0 && { delay: e.delay },
@@ -1320,19 +1355,19 @@ function Q(e) {
1320
1355
  ...e.stagger !== void 0 && { stagger: { ...e.stagger } }
1321
1356
  };
1322
1357
  }
1323
- function wn(e) {
1324
- if (mt(e)) {
1358
+ function Cn(e) {
1359
+ if (gt(e)) {
1325
1360
  const t = e;
1326
1361
  return {
1327
1362
  id: t.id,
1328
1363
  target: t.target,
1329
1364
  property: t.property,
1330
1365
  kind: "inertia",
1331
- inertia: xn(t.inertia),
1332
- ...Q(t)
1366
+ inertia: Pn(t.inertia),
1367
+ ...G(t)
1333
1368
  };
1334
1369
  }
1335
- if (gt(e)) {
1370
+ if (yt(e)) {
1336
1371
  const t = e;
1337
1372
  return {
1338
1373
  id: t.id,
@@ -1340,54 +1375,79 @@ function wn(e) {
1340
1375
  property: t.property,
1341
1376
  kind: "spring",
1342
1377
  spring: { ...t.spring },
1343
- ...Q(t)
1378
+ ...G(t)
1344
1379
  };
1345
1380
  }
1346
- if (Ht(e)) {
1381
+ if (zt(e)) {
1347
1382
  const t = e;
1348
1383
  return {
1349
1384
  id: t.id,
1350
1385
  target: t.target,
1351
1386
  property: "text",
1352
1387
  textConfig: { ...t.textConfig },
1353
- keyframes: [...t.keyframes].sort((n, s) => n.time - s.time),
1354
- ...Q(t)
1388
+ keyframes: [...t.keyframes].sort((n, i) => n.time - i.time),
1389
+ ...G(t)
1355
1390
  };
1356
1391
  }
1357
1392
  if (e.property === "motionPath" && "motionPathConfig" in e) {
1358
- const t = e, n = [...t.keyframes].sort((s, i) => s.time - i.time);
1393
+ const t = e, n = [...t.keyframes].sort((i, s) => i.time - s.time);
1359
1394
  return {
1360
1395
  id: t.id,
1361
1396
  target: t.target,
1362
1397
  property: "motionPath",
1363
1398
  motionPathConfig: { ...t.motionPathConfig },
1364
1399
  keyframes: n,
1365
- ...Q(t)
1400
+ ...G(t)
1366
1401
  };
1367
1402
  }
1368
- return hn({
1403
+ return bn({
1369
1404
  id: e.id,
1370
1405
  target: e.target,
1371
1406
  property: e.property,
1372
1407
  keyframes: e.keyframes,
1373
- ...Q(e)
1408
+ ...e.interpolation !== void 0 && { interpolation: e.interpolation },
1409
+ ...G(e)
1374
1410
  });
1375
1411
  }
1376
- function rt(e) {
1412
+ function at(e) {
1377
1413
  const t = e.formatVersion ?? 1;
1378
- if (t > J)
1414
+ if (t > st)
1379
1415
  throw new Error(
1380
- `tinyfly: this animation uses format version ${t}, but this tinyfly reads up to version ${J}. Update tinyfly to play it.`
1416
+ `tinyfly: this animation uses format version ${t}, but this tinyfly reads up to version ${st}. Update tinyfly to play it.`
1381
1417
  );
1382
- return new bn({
1418
+ return new _n({
1383
1419
  id: e.id,
1384
1420
  name: e.name,
1385
1421
  config: e.config,
1386
- tracks: e.tracks.map(wn),
1422
+ tracks: e.tracks.map(Cn),
1387
1423
  captions: e.captions
1388
1424
  });
1389
1425
  }
1390
- const Mn = /* @__PURE__ */ new Set([
1426
+ function In(e) {
1427
+ const [t, n, i, s] = e;
1428
+ return [
1429
+ 1 - 2 * (n * n + i * i),
1430
+ 2 * (t * n + i * s),
1431
+ 2 * (t * i - n * s),
1432
+ 0,
1433
+ 2 * (t * n - i * s),
1434
+ 1 - 2 * (t * t + i * i),
1435
+ 2 * (n * i + t * s),
1436
+ 0,
1437
+ 2 * (t * i + n * s),
1438
+ 2 * (n * i - t * s),
1439
+ 1 - 2 * (t * t + n * n),
1440
+ 0,
1441
+ 0,
1442
+ 0,
1443
+ 0,
1444
+ 1
1445
+ ];
1446
+ }
1447
+ function Rn(e) {
1448
+ return !Array.isArray(e) || e.length !== 4 ? null : `matrix3d(${In(K(e)).map((n) => Math.round(n * 1e6) / 1e6 + 0).join(", ")})`;
1449
+ }
1450
+ const $n = /* @__PURE__ */ new Set([
1391
1451
  "blur",
1392
1452
  "brightness",
1393
1453
  "glow",
@@ -1396,30 +1456,30 @@ const Mn = /* @__PURE__ */ new Set([
1396
1456
  "shadowY",
1397
1457
  "shadowBlur",
1398
1458
  "shadowColor"
1399
- ]), Sn = "#ffffff", Tn = "rgba(0, 0, 0, 0.5)";
1400
- function _n(e) {
1459
+ ]), Dn = "#ffffff", Ln = "rgba(0, 0, 0, 0.5)";
1460
+ function On(e) {
1401
1461
  const t = [];
1402
- if (e.blur !== void 0 && t.push(`blur(${Math.max(0, e.blur)}px)`), e.brightness !== void 0 && t.push(`brightness(${Math.max(0, e.brightness)})`), e.glow !== void 0 && t.push(`drop-shadow(0 0 ${Math.max(0, e.glow)}px ${e.glowColor ?? Sn})`), e.shadowX !== void 0 || e.shadowY !== void 0 || e.shadowBlur !== void 0) {
1403
- const n = e.shadowX ?? 0, s = e.shadowY ?? 0, i = Math.max(0, e.shadowBlur ?? 0);
1404
- t.push(`drop-shadow(${n}px ${s}px ${i}px ${e.shadowColor ?? Tn})`);
1462
+ if (e.blur !== void 0 && t.push(`blur(${Math.max(0, e.blur)}px)`), e.brightness !== void 0 && t.push(`brightness(${Math.max(0, e.brightness)})`), e.glow !== void 0 && t.push(`drop-shadow(0 0 ${Math.max(0, e.glow)}px ${e.glowColor ?? Dn})`), e.shadowX !== void 0 || e.shadowY !== void 0 || e.shadowBlur !== void 0) {
1463
+ const n = e.shadowX ?? 0, i = e.shadowY ?? 0, s = Math.max(0, e.shadowBlur ?? 0);
1464
+ t.push(`drop-shadow(${n}px ${i}px ${s}px ${e.shadowColor ?? Ln})`);
1405
1465
  }
1406
1466
  return t.length > 0 ? t.join(" ") : null;
1407
1467
  }
1408
- function An(e, t) {
1468
+ function Nn(e, t) {
1409
1469
  const n = e.childNodes.length === 1 ? e.firstChild : null;
1410
1470
  if (n && n.nodeType === 3) {
1411
- const s = n;
1412
- s.data !== t && (s.data = t);
1471
+ const i = n;
1472
+ i.data !== t && (i.data = t);
1413
1473
  return;
1414
1474
  }
1415
1475
  e.textContent !== t && (e.textContent = t);
1416
1476
  }
1417
- function En(e) {
1477
+ function Fn(e) {
1418
1478
  if (!("ownerSVGElement" in e)) return;
1419
1479
  const t = e.style;
1420
1480
  !t || t.transformBox || (t.transformBox = "fill-box", t.transformOrigin || (t.transformOrigin = "50% 50%"));
1421
1481
  }
1422
- const Yt = /* @__PURE__ */ new Set([
1482
+ const Vt = /* @__PURE__ */ new Set([
1423
1483
  "width",
1424
1484
  "height",
1425
1485
  "top",
@@ -1445,7 +1505,7 @@ const Yt = /* @__PURE__ */ new Set([
1445
1505
  "gap",
1446
1506
  "rowGap",
1447
1507
  "columnGap"
1448
- ]), Pn = /* @__PURE__ */ new Set([
1508
+ ]), Xn = /* @__PURE__ */ new Set([
1449
1509
  "x",
1450
1510
  "y",
1451
1511
  "z",
@@ -1459,11 +1519,31 @@ const Yt = /* @__PURE__ */ new Set([
1459
1519
  "scaleZ",
1460
1520
  "skewX",
1461
1521
  "skewY",
1522
+ // A rotation as an [x, y, z, w] quaternion (a track with `interpolation: 'slerp'`)
1523
+ "quaternion",
1462
1524
  // Motion path properties
1463
1525
  "motionPathX",
1464
1526
  "motionPathY",
1465
1527
  "motionPathRotate"
1466
- ]), Cn = /* @__PURE__ */ new Set(["originX", "originY"]), In = /* @__PURE__ */ new Set(["clipTop", "clipRight", "clipBottom", "clipLeft"]), Rn = /* @__PURE__ */ new Set(["drawOn"]), $n = {
1528
+ ]), Yn = [
1529
+ "x",
1530
+ "motionPathX",
1531
+ "y",
1532
+ "motionPathY",
1533
+ "z",
1534
+ "rotate",
1535
+ "rotateZ",
1536
+ "motionPathRotate",
1537
+ "rotateX",
1538
+ "rotateY",
1539
+ "quaternion",
1540
+ "scale",
1541
+ "scaleX",
1542
+ "scaleY",
1543
+ "scaleZ",
1544
+ "skewX",
1545
+ "skewY"
1546
+ ], Vn = /* @__PURE__ */ new Set(["childPerspective", "perspectiveOriginX", "perspectiveOriginY"]), qn = /* @__PURE__ */ new Set(["originX", "originY"]), Wn = /* @__PURE__ */ new Set(["clipTop", "clipRight", "clipBottom", "clipLeft"]), Bn = /* @__PURE__ */ new Set(["drawOn"]), Un = {
1467
1547
  fill: "backgroundColor",
1468
1548
  stroke: "borderColor",
1469
1549
  strokeWidth: "borderWidth",
@@ -1478,8 +1558,8 @@ const Yt = /* @__PURE__ */ new Set([
1478
1558
  strokeDashoffset: "strokeDashoffset",
1479
1559
  fillOpacity: "fillOpacity",
1480
1560
  strokeOpacity: "strokeOpacity"
1481
- }, Dn = "http://www.w3.org/2000/svg";
1482
- class vt {
1561
+ }, jn = "http://www.w3.org/2000/svg";
1562
+ class kt {
1483
1563
  targets = /* @__PURE__ */ new Map();
1484
1564
  /**
1485
1565
  * Register an HTML element as an animation target.
@@ -1509,59 +1589,67 @@ class vt {
1509
1589
  * Apply animation state to all registered targets.
1510
1590
  */
1511
1591
  applyState(t) {
1512
- for (const [n, s] of t.values) {
1513
- const i = this.targets.get(n);
1514
- i && this.applyProperties(i, s);
1592
+ for (const [n, i] of t.values) {
1593
+ const s = this.targets.get(n);
1594
+ s && this.applyProperties(s, i);
1515
1595
  }
1516
1596
  }
1517
1597
  /**
1518
1598
  * Apply properties to a single element.
1519
1599
  */
1520
1600
  applyProperties(t, n) {
1521
- const s = [];
1522
- let i = null, r = null, a = null;
1523
- const o = n.has("motionPathX"), c = n.has("motionPathY"), l = n.has("motionPathRotate");
1524
- for (const [d, f] of n)
1525
- if (!(d === "x" && o) && !(d === "y" && c) && !((d === "rotate" || d === "rotateZ") && l) && !Rn.has(d)) {
1526
- if (Pn.has(d)) {
1527
- const g = this.buildTransformPart(d, f);
1528
- g && s.push(g);
1529
- } else if (Cn.has(d))
1530
- typeof f == "number" && ((i ??= {})[d] = f);
1531
- else if (In.has(d))
1532
- typeof f == "number" && ((r ??= {})[d] = f);
1533
- else if (Mn.has(d))
1534
- (a ??= {})[d] = f;
1535
- else if (d !== "perspective") {
1536
- if (d !== "shine") if (d === "text" && typeof f == "string")
1537
- An(t, f);
1538
- else if (d === "d" && typeof f == "string") {
1601
+ let i = null, s = null, r = null, a = null, o = null;
1602
+ const c = n.has("motionPathX"), l = n.has("motionPathY"), u = n.has("motionPathRotate");
1603
+ for (const [p, d] of n)
1604
+ if (!(p === "x" && c) && !(p === "y" && l) && !((p === "rotate" || p === "rotateZ") && u) && !Bn.has(p)) {
1605
+ if (Xn.has(p))
1606
+ (i ??= {})[p] = d;
1607
+ else if (Vn.has(p))
1608
+ typeof d == "number" && ((s ??= {})[p] = d);
1609
+ else if (qn.has(p))
1610
+ typeof d == "number" && ((r ??= {})[p] = d);
1611
+ else if (Wn.has(p))
1612
+ typeof d == "number" && ((a ??= {})[p] = d);
1613
+ else if ($n.has(p))
1614
+ (o ??= {})[p] = d;
1615
+ else if (p !== "perspective") {
1616
+ if (p !== "shine") if (p === "text" && typeof d == "string")
1617
+ Nn(t, d);
1618
+ else if (p === "d" && typeof d == "string") {
1539
1619
  const g = t;
1540
- (g.tagName?.toLowerCase() === "path" ? g : g.querySelector?.("path"))?.setAttribute?.("d", f);
1620
+ (g.tagName?.toLowerCase() === "path" ? g : g.querySelector?.("path"))?.setAttribute?.("d", d);
1541
1621
  } else
1542
- this.applyStyleProperty(t, d, f);
1622
+ this.applyStyleProperty(t, p, d);
1543
1623
  }
1544
1624
  }
1545
- const u = n.get("shine");
1546
- typeof u == "number" && this.applyShine(t, u);
1547
- const h = n.get("perspective");
1548
- if (typeof h == "number" && s.unshift(`perspective(${h}px)`), s.length > 0 && (t.style.transform = s.join(" "), En(t)), i) {
1549
- const d = i.originX ?? 50, f = i.originY ?? 50;
1550
- t.style.transformOrigin = `${d}% ${f}%`;
1551
- }
1552
- if (r) {
1553
- const d = r.clipTop ?? 0, f = r.clipRight ?? 0, g = r.clipBottom ?? 0, p = r.clipLeft ?? 0;
1554
- t.style.clipPath = `inset(${d}% ${f}% ${g}% ${p}%)`;
1625
+ const h = n.get("shine");
1626
+ typeof h == "number" && this.applyShine(t, h);
1627
+ const f = [], m = n.get("perspective");
1628
+ if (typeof m == "number" && m > 0 && f.push(`perspective(${m}px)`), i)
1629
+ for (const p of Yn) {
1630
+ const d = i[p];
1631
+ if (d === void 0) continue;
1632
+ const g = this.buildTransformPart(p, d);
1633
+ g && f.push(g);
1634
+ }
1635
+ if (f.length > 0 && (t.style.transform = f.join(" "), Fn(t)), s && (s.childPerspective !== void 0 && (t.style.perspective = `${s.childPerspective}px`), (s.perspectiveOriginX !== void 0 || s.perspectiveOriginY !== void 0) && (t.style.perspectiveOrigin = `${s.perspectiveOriginX ?? 50}% ${s.perspectiveOriginY ?? 50}%`)), r) {
1636
+ const p = r.originX ?? 50, d = r.originY ?? 50;
1637
+ t.style.transformOrigin = `${p}% ${d}%`;
1555
1638
  }
1556
1639
  if (a) {
1557
- const d = _n(a);
1558
- d && (t.style.filter = d);
1640
+ const p = a.clipTop ?? 0, d = a.clipRight ?? 0, g = a.clipBottom ?? 0, b = a.clipLeft ?? 0;
1641
+ t.style.clipPath = `inset(${p}% ${d}% ${g}% ${b}%)`;
1642
+ }
1643
+ if (o) {
1644
+ const p = On(o);
1645
+ p && (t.style.filter = p);
1559
1646
  }
1560
1647
  }
1561
1648
  /**
1562
1649
  * Build a transform function string for a property.
1563
1650
  */
1564
1651
  buildTransformPart(t, n) {
1652
+ if (t === "quaternion") return Rn(n);
1565
1653
  if (typeof n != "number") return null;
1566
1654
  switch (t) {
1567
1655
  case "x":
@@ -1606,24 +1694,24 @@ class vt {
1606
1694
  */
1607
1695
  applyShine(t, n) {
1608
1696
  t.dataset.shineBase || (t.dataset.shineBase = t.style.color || "currentColor");
1609
- const s = t.dataset.shineBase, i = -20 + n * 140, r = t.style;
1610
- r.color = "transparent", r.backgroundImage = `linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.9) 50%, transparent 60%), linear-gradient(${s}, ${s})`, r.backgroundSize = "250% 100%, 100% 100%", r.backgroundPosition = `${i}% 0, 0 0`, r.backgroundRepeat = "no-repeat", r.webkitBackgroundClip = "text", r.backgroundClip = "text";
1697
+ const i = t.dataset.shineBase, s = -20 + n * 140, r = t.style;
1698
+ r.color = "transparent", r.backgroundImage = `linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.9) 50%, transparent 60%), linear-gradient(${i}, ${i})`, r.backgroundSize = "250% 100%, 100% 100%", r.backgroundPosition = `${s}% 0, 0 0`, r.backgroundRepeat = "no-repeat", r.webkitBackgroundClip = "text", r.backgroundClip = "text";
1611
1699
  }
1612
1700
  /**
1613
1701
  * Apply a single style property to an element.
1614
1702
  */
1615
- applyStyleProperty(t, n, s) {
1616
- let i;
1617
- if (t.namespaceURI === Dn && n in qt) {
1618
- const o = Array.isArray(s) ? s.join(", ") : String(s);
1703
+ applyStyleProperty(t, n, i) {
1704
+ let s;
1705
+ if (t.namespaceURI === jn && n in qt) {
1706
+ const o = Array.isArray(i) ? i.join(", ") : String(i);
1619
1707
  t.style[qt[n]] = o;
1620
1708
  return;
1621
- } else n === "fill" && t.dataset?.elementType === "text" ? i = "color" : i = $n[n] ?? n;
1709
+ } else n === "fill" && t.dataset?.elementType === "text" ? s = "color" : s = Un[n] ?? n;
1622
1710
  let a;
1623
- typeof s == "number" ? Yt.has(n) || Yt.has(i) ? a = `${s}px` : a = String(s) : Array.isArray(s) ? a = s.join(", ") : a = s, t.style[i] = a;
1711
+ typeof i == "number" ? Vt.has(n) || Vt.has(s) ? a = `${i}px` : a = String(i) : Array.isArray(i) ? a = i.join(", ") : a = i, t.style[s] = a;
1624
1712
  }
1625
1713
  }
1626
- class Vt {
1714
+ class Wt {
1627
1715
  media;
1628
1716
  offset;
1629
1717
  driftTolerance;
@@ -1641,8 +1729,8 @@ class Vt {
1641
1729
  * @param isPlaying whether the timeline is playing
1642
1730
  */
1643
1731
  update(t, n) {
1644
- const s = this.targetTime(t);
1645
- n ? (this.media.paused && this.safePlay(), Math.abs(this.media.currentTime - s) > this.driftTolerance && (this.media.currentTime = s)) : (this.media.paused || this.media.pause(), this.media.currentTime !== s && (this.media.currentTime = s));
1732
+ const i = this.targetTime(t);
1733
+ n ? (this.media.paused && this.safePlay(), Math.abs(this.media.currentTime - i) > this.driftTolerance && (this.media.currentTime = i)) : (this.media.paused || this.media.pause(), this.media.currentTime !== i && (this.media.currentTime = i));
1646
1734
  }
1647
1735
  /** Hard-align the media to a timeline time (used on explicit seeks). */
1648
1736
  seek(t) {
@@ -1662,15 +1750,15 @@ class Vt {
1662
1750
  });
1663
1751
  }
1664
1752
  }
1665
- function Ln(e, t, n, s, i) {
1666
- const r = n - i;
1753
+ function Hn(e, t, n, i, s) {
1754
+ const r = n - s;
1667
1755
  if (r < 0) {
1668
1756
  t.paused || t.pause(), t.currentTime = 0;
1669
1757
  return;
1670
1758
  }
1671
- e.update(r, s);
1759
+ e.update(r, i);
1672
1760
  }
1673
- class Mt {
1761
+ class St {
1674
1762
  container;
1675
1763
  timeline = null;
1676
1764
  adapter;
@@ -1703,13 +1791,13 @@ class Mt {
1703
1791
  onDocumentVisibility = () => this.updateVisibility();
1704
1792
  constructor(t, n = {}) {
1705
1793
  if (typeof t == "string") {
1706
- const s = document.querySelector(t);
1707
- if (!s)
1794
+ const i = document.querySelector(t);
1795
+ if (!i)
1708
1796
  throw new Error(`Container not found: ${t}`);
1709
- this.container = s;
1797
+ this.container = i;
1710
1798
  } else
1711
1799
  this.container = t;
1712
- this.options = n, this.adapter = new vt();
1800
+ this.options = n, this.adapter = new kt();
1713
1801
  }
1714
1802
  /**
1715
1803
  * Load animation from a URL or JSON object.
@@ -1720,10 +1808,10 @@ class Mt {
1720
1808
  async loadSource(t) {
1721
1809
  let n;
1722
1810
  if (typeof t == "string") {
1723
- const s = await fetch(t);
1724
- if (!s.ok)
1725
- throw new Error(`Failed to load animation: ${s.statusText}`);
1726
- n = await s.json();
1811
+ const i = await fetch(t);
1812
+ if (!i.ok)
1813
+ throw new Error(`Failed to load animation: ${i.statusText}`);
1814
+ n = await i.json();
1727
1815
  } else
1728
1816
  n = t;
1729
1817
  this.useDefinition(n), this.showInitialFrame(), this.watchReducedMotion(), this.watchVisibility(), this.options.autoplay && !this.reducedMotion && (this.options.playWhenVisible && !this.onScreen ? this.autoplayWhenSeen = !0 : this.play());
@@ -1735,7 +1823,7 @@ class Mt {
1735
1823
  */
1736
1824
  useDefinition(t) {
1737
1825
  const n = { ...t.config };
1738
- this.options.speed !== void 0 && (n.speed = this.options.speed), this.options.loop !== void 0 && (n.loop = this.options.loop), this.options.alternate !== void 0 && (n.alternate = this.options.alternate), this.timeline = rt({ ...t, config: n }), 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();
1826
+ this.options.speed !== void 0 && (n.speed = this.options.speed), this.options.loop !== void 0 && (n.loop = this.options.loop), this.options.alternate !== void 0 && (n.alternate = this.options.alternate), this.timeline = at({ ...t, config: n }), 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();
1739
1827
  }
1740
1828
  // --- scenarios: the reader chooses which timeline plays --------------------
1741
1829
  /**
@@ -1745,14 +1833,14 @@ class Mt {
1745
1833
  */
1746
1834
  async loadScenarios(t, n = {}) {
1747
1835
  if (t.length === 0) throw new Error("tinyfly: loadScenarios needs at least one scenario");
1748
- const s = /* @__PURE__ */ new Set();
1836
+ const i = /* @__PURE__ */ new Set();
1749
1837
  for (const r of t) {
1750
- if (s.has(r.id)) throw new Error(`tinyfly: scenario id "${r.id}" is used more than once`);
1751
- s.add(r.id);
1838
+ if (i.has(r.id)) throw new Error(`tinyfly: scenario id "${r.id}" is used more than once`);
1839
+ i.add(r.id);
1752
1840
  }
1753
- const i = n.initial === void 0 ? t[0] : t.find((r) => r.id === n.initial);
1754
- if (!i) throw new Error(`tinyfly: there is no scenario "${n.initial}"`);
1755
- this.scenarioList = [...t], this.scenarioId = i.id, await this.loadSource(i.timeline);
1841
+ const s = n.initial === void 0 ? t[0] : t.find((r) => r.id === n.initial);
1842
+ if (!s) throw new Error(`tinyfly: there is no scenario "${n.initial}"`);
1843
+ this.scenarioList = [...t], this.scenarioId = s.id, await this.loadSource(s.timeline);
1756
1844
  }
1757
1845
  /** The scenarios to choose from (empty for a single timeline). */
1758
1846
  get scenarios() {
@@ -1773,25 +1861,25 @@ class Mt {
1773
1861
  const n = this.scenarioList.find((o) => o.id === t);
1774
1862
  if (!n || !this.timeline) return !1;
1775
1863
  if (t === this.scenarioId) return !0;
1776
- const s = this.isPlaying, i = this.currentTime >= this.duration - 0.5, r = this.currentMarker?.id;
1864
+ const i = this.isPlaying, s = this.currentTime >= this.duration - 0.5, r = this.currentMarker?.id;
1777
1865
  this.stopAnimationLoop(), this.stepping = !1, this.pausedByVisibility = !1, this.restoreAuthored(), this.scenarioId = t, this.useDefinition(n.timeline), this.lastMarkerId = null;
1778
1866
  let a = 0;
1779
- return this.reducedMotion || i ? a = this.duration : r !== void 0 && (a = this.markers.find((o) => o.id === r)?.time ?? 0), this.seek(a), s && !this.reducedMotion ? (this.stepping = this.options.stepMode === !0, this.startPlaying()) : this.notify(), !0;
1867
+ return this.reducedMotion || s ? a = this.duration : r !== void 0 && (a = this.markers.find((o) => o.id === r)?.time ?? 0), this.seek(a), i && !this.reducedMotion ? (this.stepping = this.options.stepMode === !0, this.startPlaying()) : this.notify(), !0;
1780
1868
  }
1781
1869
  /** Remember how an element was authored, the first time it becomes a target. */
1782
1870
  rememberAuthored(t) {
1783
1871
  if (this.authored.has(t)) return;
1784
1872
  const n = { style: t.getAttribute("style") };
1785
1873
  t.children.length === 0 && (n.text = t.textContent ?? "");
1786
- const s = t.tagName.toLowerCase() === "path" ? t : t.querySelector("path");
1787
- s && (n.path = { element: s, d: s.getAttribute("d") }), this.authored.set(t, n);
1874
+ const i = t.tagName.toLowerCase() === "path" ? t : t.querySelector("path");
1875
+ i && (n.path = { element: i, d: i.getAttribute("d") }), this.authored.set(t, n);
1788
1876
  }
1789
1877
  /** Put every target back the way it was authored. */
1790
1878
  restoreAuthored() {
1791
1879
  for (const [t, n] of this.authored) {
1792
1880
  n.style === null ? t.removeAttribute("style") : t.setAttribute("style", n.style), n.text !== void 0 && t.textContent !== n.text && (t.textContent = n.text), n.path && (n.path.d === null ? n.path.element.removeAttribute("d") : n.path.element.setAttribute("d", n.path.d));
1793
- const s = t.dataset;
1794
- s && delete s.shineBase;
1881
+ const i = t.dataset;
1882
+ i && delete i.shineBase;
1795
1883
  }
1796
1884
  }
1797
1885
  // --- teaching: frames, markers, reduced motion, visibility -----------------
@@ -1817,8 +1905,8 @@ class Mt {
1817
1905
  get currentMarker() {
1818
1906
  const t = this.currentTime;
1819
1907
  let n;
1820
- for (const s of this.markers)
1821
- if (s.time <= t + 0.5) n = s;
1908
+ for (const i of this.markers)
1909
+ if (i.time <= t + 0.5) n = i;
1822
1910
  else break;
1823
1911
  return n;
1824
1912
  }
@@ -1828,15 +1916,15 @@ class Mt {
1828
1916
  * marker's own label.
1829
1917
  */
1830
1918
  caption(t, n) {
1831
- const s = t ? this.markers.find((a) => a.id === t) : this.currentMarker;
1832
- if (!s) return;
1833
- const i = n ?? this.language(), r = (a) => a?.[i]?.[s.id] ?? a?.[i.split("-")[0]]?.[s.id];
1834
- return r(this.options.captions) ?? r(this.timeline?.captions) ?? s.label;
1919
+ const i = t ? this.markers.find((a) => a.id === t) : this.currentMarker;
1920
+ if (!i) return;
1921
+ const s = n ?? this.language(), r = (a) => a?.[s]?.[i.id] ?? a?.[s.split("-")[0]]?.[i.id];
1922
+ return r(this.options.captions) ?? r(this.timeline?.captions) ?? i.label;
1835
1923
  }
1836
1924
  /** Move to the next marker: animated, or a jump under reduced motion. At the last marker, to the end. */
1837
1925
  next() {
1838
1926
  if (!this.timeline) return;
1839
- const t = this.currentTime, n = this.markers.find((s) => s.time > t + 0.5);
1927
+ const t = this.currentTime, n = this.markers.find((i) => i.time > t + 0.5);
1840
1928
  if (this.reducedMotion) {
1841
1929
  this.seek(n ? n.time : this.duration);
1842
1930
  return;
@@ -1846,12 +1934,12 @@ class Mt {
1846
1934
  /** Jump back to the previous marker (or the start). */
1847
1935
  prev() {
1848
1936
  if (!this.timeline) return;
1849
- const t = this.currentTime, n = [...this.markers].reverse().find((s) => s.time < t - 0.5);
1937
+ const t = this.currentTime, n = [...this.markers].reverse().find((i) => i.time < t - 0.5);
1850
1938
  this.pause(), this.seek(n ? n.time : 0);
1851
1939
  }
1852
1940
  /** Jump to a marker by id, paused there. */
1853
1941
  goToMarker(t) {
1854
- const n = this.markers.find((s) => s.id === t);
1942
+ const n = this.markers.find((i) => i.id === t);
1855
1943
  n && (this.pause(), this.seek(n.time));
1856
1944
  }
1857
1945
  language() {
@@ -1875,7 +1963,7 @@ class Mt {
1875
1963
  if (!(!this.options.playWhenVisible || typeof window > "u")) {
1876
1964
  if (typeof IntersectionObserver == "function") {
1877
1965
  this.visibilityObserver?.disconnect(), this.visibilityObserver = new IntersectionObserver((n) => {
1878
- for (const s of n) this.onScreen = s.isIntersecting;
1966
+ for (const i of n) this.onScreen = i.isIntersecting;
1879
1967
  this.updateVisibility();
1880
1968
  }), this.visibilityObserver.observe(this.container);
1881
1969
  const t = this.container.getBoundingClientRect?.();
@@ -1901,14 +1989,14 @@ class Mt {
1901
1989
  */
1902
1990
  scanMedia() {
1903
1991
  this.mediaTargets = [], this.container.querySelectorAll("[data-tinyfly-media]").forEach((n) => {
1904
- const s = n, i = Number(s.getAttribute("data-tinyfly-start") ?? "0") || 0, r = s.getAttribute("data-volume");
1905
- r !== null && (s.volume = Math.max(0, Math.min(1, Number(r) || 0))), this.mediaTargets.push({ el: s, startTime: i, sync: new Vt(s) });
1992
+ const i = n, s = Number(i.getAttribute("data-tinyfly-start") ?? "0") || 0, r = i.getAttribute("data-volume");
1993
+ r !== null && (i.volume = Math.max(0, Math.min(1, Number(r) || 0))), this.mediaTargets.push({ el: i, startTime: s, sync: new Wt(i) });
1906
1994
  });
1907
1995
  }
1908
1996
  /** Sync all discovered media targets to a timeline time. */
1909
1997
  syncAllMedia(t, n) {
1910
- for (const s of this.mediaTargets)
1911
- Ln(s.sync, s.el, t, n, s.startTime);
1998
+ for (const i of this.mediaTargets)
1999
+ Hn(i.sync, i.el, t, n, i.startTime);
1912
2000
  }
1913
2001
  /**
1914
2002
  * Load animation from inline JSON string.
@@ -1922,8 +2010,8 @@ class Mt {
1922
2010
  */
1923
2011
  registerTarget(t, n) {
1924
2012
  if (typeof n == "string") {
1925
- const s = this.container.querySelector(n);
1926
- s && (this.rememberAuthored(s), this.targets[t] = s, this.adapter.registerTarget(t, s));
2013
+ const i = this.container.querySelector(n);
2014
+ i && (this.rememberAuthored(i), this.targets[t] = i, this.adapter.registerTarget(t, i));
1927
2015
  } else
1928
2016
  this.rememberAuthored(n), this.targets[t] = n, this.adapter.registerTarget(t, n);
1929
2017
  }
@@ -1932,14 +2020,14 @@ class Mt {
1932
2020
  */
1933
2021
  autoRegisterTargets() {
1934
2022
  this.container.querySelectorAll("[data-tinyfly]").forEach((n) => {
1935
- const s = n.closest("[data-tinyfly-symbol]");
1936
- if (s && s !== n) return;
1937
- const i = n.getAttribute("data-tinyfly");
1938
- i && this.registerTarget(i, n);
1939
- }), this.timeline && new Set(this.timeline.tracks.map((s) => s.target)).forEach((s) => {
1940
- if (!this.targets[s]) {
1941
- const i = this.container.querySelector(`[data-tinyfly="${s}"]`) || this.container.querySelector(`.${s}`) || this.container.querySelector(`#${s}`);
1942
- i && this.registerTarget(s, i);
2023
+ const i = n.closest("[data-tinyfly-symbol]");
2024
+ if (i && i !== n) return;
2025
+ const s = n.getAttribute("data-tinyfly");
2026
+ s && this.registerTarget(s, n);
2027
+ }), this.timeline && new Set(this.timeline.tracks.map((i) => i.target)).forEach((i) => {
2028
+ if (!this.targets[i]) {
2029
+ const s = this.container.querySelector(`[data-tinyfly="${i}"]`) || this.container.querySelector(`.${i}`) || this.container.querySelector(`#${i}`);
2030
+ s && this.registerTarget(i, s);
1943
2031
  }
1944
2032
  });
1945
2033
  }
@@ -1952,17 +2040,17 @@ class Mt {
1952
2040
  this.symbolInstances = [];
1953
2041
  const t = this.options.symbols;
1954
2042
  if (!t || t.length === 0) return;
1955
- const n = new Map(t.map((s) => [s.id, s]));
1956
- this.container.querySelectorAll("[data-tinyfly-symbol]").forEach((s) => {
1957
- const i = s.getAttribute("data-tinyfly-symbol");
1958
- if (!i) return;
1959
- const r = n.get(i);
2043
+ const n = new Map(t.map((i) => [i.id, i]));
2044
+ this.container.querySelectorAll("[data-tinyfly-symbol]").forEach((i) => {
2045
+ const s = i.getAttribute("data-tinyfly-symbol");
2046
+ if (!s) return;
2047
+ const r = n.get(s);
1960
2048
  if (!r || !r.timeline.tracks?.length) return;
1961
- const a = new vt();
1962
- s.querySelectorAll("[data-tinyfly]").forEach((o) => {
2049
+ const a = new kt();
2050
+ i.querySelectorAll("[data-tinyfly]").forEach((o) => {
1963
2051
  const c = o.getAttribute("data-tinyfly");
1964
2052
  c && a.registerTarget(c, o);
1965
- }), this.symbolInstances.push({ adapter: a, timeline: rt(r.timeline) });
2053
+ }), this.symbolInstances.push({ adapter: a, timeline: at(r.timeline) });
1966
2054
  });
1967
2055
  }
1968
2056
  /**
@@ -1972,7 +2060,7 @@ class Mt {
1972
2060
  * plays. Pass `{ offset }` to start the media at a timeline offset.
1973
2061
  */
1974
2062
  attachMedia(t, n) {
1975
- this.mediaSync = new Vt(t, n), this.timeline && (this.mediaSync.setRate(this.timeline.speed), this.mediaSync.update(this.timeline.currentTime, this.isPlaying));
2063
+ this.mediaSync = new Wt(t, n), this.timeline && (this.mediaSync.setRate(this.timeline.speed), this.mediaSync.update(this.timeline.currentTime, this.isPlaying));
1976
2064
  }
1977
2065
  /** Detach and pause the currently synced media, if any. */
1978
2066
  detachMedia() {
@@ -2053,10 +2141,10 @@ class Mt {
2053
2141
  this.lastTime = performance.now();
2054
2142
  const t = (n) => {
2055
2143
  if (this.isDestroyed || !this.timeline) return;
2056
- const s = n - (this.lastTime ?? n);
2144
+ const i = n - (this.lastTime ?? n);
2057
2145
  this.lastTime = n;
2058
- const i = this.playhead;
2059
- this.timeline.tick(s), this.stopAtMarker(i), this.applyState();
2146
+ const s = this.playhead;
2147
+ this.timeline.tick(i), this.stopAtMarker(s), this.applyState();
2060
2148
  const r = this.timeline.playbackState === "playing";
2061
2149
  this.mediaSync?.update(this.timeline.currentTime, r), this.syncAllMedia(this.timeline.currentTime, r), this.timeline.playbackState === "playing" ? this.animationFrameId = requestAnimationFrame(t) : (this.animationFrameId = void 0, this.notify());
2062
2150
  };
@@ -2067,19 +2155,19 @@ class Mt {
2067
2155
  * stepping, or any marker with `pause` — put the playhead exactly there and pause.
2068
2156
  */
2069
2157
  stopAtMarker(t) {
2070
- const n = this.timeline, s = { time: n.currentTime, iteration: n.loopIteration, direction: n.direction };
2071
- this.playhead = s;
2072
- const i = this.markers;
2073
- if (i.length === 0) return;
2074
- const { crossings: r } = kn(
2075
- i.map((a) => a.time),
2158
+ const n = this.timeline, i = { time: n.currentTime, iteration: n.loopIteration, direction: n.direction };
2159
+ this.playhead = i;
2160
+ const s = this.markers;
2161
+ if (s.length === 0) return;
2162
+ const { crossings: r } = En(
2163
+ s.map((a) => a.time),
2076
2164
  t,
2077
- s,
2165
+ i,
2078
2166
  { duration: n.duration, alternate: n.config.alternate === !0, holding: n.repeatDelayRemaining > 0 }
2079
2167
  );
2080
2168
  for (const a of r) {
2081
2169
  if (a.kind !== "event") continue;
2082
- const o = i[a.index];
2170
+ const o = s[a.index];
2083
2171
  if (this.stepping || o.pause) {
2084
2172
  this.stepping = !1, n.pause(), n.seek(o.time), this.playhead = { time: o.time, iteration: n.loopIteration, direction: n.direction };
2085
2173
  return;
@@ -2094,19 +2182,19 @@ class Mt {
2094
2182
  const t = this.timeline.currentTime;
2095
2183
  this.adapter.applyState(this.timeline.getStateAtTime(t)), this.announceMarker(), this.notify();
2096
2184
  for (const n of this.symbolInstances) {
2097
- const s = n.timeline.duration;
2098
- n.adapter.applyState(n.timeline.getStateAtTime(s > 0 ? t % s : t));
2185
+ const i = n.timeline.duration;
2186
+ n.adapter.applyState(n.timeline.getStateAtTime(i > 0 ? t % i : t));
2099
2187
  }
2100
2188
  }
2101
2189
  }
2102
- async function os(e, t, n = {}) {
2103
- const s = new Mt(e, { ...n, autoplay: !0 });
2104
- return await s.load(t), s;
2190
+ async function vi(e, t, n = {}) {
2191
+ const i = new St(e, { ...n, autoplay: !0 });
2192
+ return await i.load(t), i;
2105
2193
  }
2106
- function cs(e, t = {}) {
2107
- return new Mt(e, t);
2194
+ function ki(e, t = {}) {
2195
+ return new St(e, t);
2108
2196
  }
2109
- const On = {
2197
+ const zn = {
2110
2198
  play: "Play",
2111
2199
  pause: "Pause",
2112
2200
  prev: "Previous step",
@@ -2121,7 +2209,7 @@ const On = {
2121
2209
  scenario: "Scenario",
2122
2210
  fullscreen: "Full screen",
2123
2211
  exitFullscreen: "Exit full screen"
2124
- }, Wt = "tinyfly-controls-style", Nn = `
2212
+ }, Bt = "tinyfly-controls-style", Qn = `
2125
2213
  .tf-ctl { --tf-ctl-fg: #1d1d1f; --tf-ctl-bg: #f4f2ee; --tf-ctl-accent: #c2410c; --tf-ctl-radius: 8px;
2126
2214
  font: 14px/1.4 var(--tf-ctl-font, system-ui, sans-serif); color: var(--tf-ctl-fg); margin-top: 8px; }
2127
2215
  .tf-ctl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px; border-radius: var(--tf-ctl-radius); background: var(--tf-ctl-bg); }
@@ -2170,60 +2258,60 @@ const On = {
2170
2258
  .tf-fullscreen > :not(svg):not(canvas) { grid-column: 2; }
2171
2259
  }
2172
2260
  `;
2173
- let Fn = 0;
2174
- function Xn(e) {
2175
- if (e.getElementById(Wt)) return;
2261
+ let Gn = 0;
2262
+ function Zn(e) {
2263
+ if (e.getElementById(Bt)) return;
2176
2264
  const t = e.createElement("style");
2177
- t.id = Wt, t.textContent = Nn, e.head.appendChild(t);
2265
+ t.id = Bt, t.textContent = Qn, e.head.appendChild(t);
2178
2266
  }
2179
- function Yn(e, t, n = {}) {
2180
- const s = t.ownerDocument;
2181
- Xn(s);
2182
- const i = { ...On, ...n.labels }, r = n.speeds ?? [0.5, 1, 2], a = () => e.markers.length > 0, o = () => e.markers.some((w) => w.label !== void 0 || e.caption(w.id) !== void 0), c = s.createElement("div");
2267
+ function Kn(e, t, n = {}) {
2268
+ const i = t.ownerDocument;
2269
+ Zn(i);
2270
+ const s = { ...zn, ...n.labels }, r = n.speeds ?? [0.5, 1, 2], a = () => e.markers.length > 0, o = () => e.markers.some((w) => w.label !== void 0 || e.caption(w.id) !== void 0), c = i.createElement("div");
2183
2271
  c.className = "tf-ctl";
2184
- const l = s.createElement("div");
2272
+ const l = i.createElement("div");
2185
2273
  l.className = "tf-ctl-bar", l.setAttribute("role", "group");
2186
2274
  const u = (w, E, N, O = "") => {
2187
- const $ = s.createElement("button");
2275
+ const $ = i.createElement("button");
2188
2276
  return $.type = "button", $.className = `tf-ctl-btn ${O}`.trim(), $.setAttribute("aria-label", w), $.title = w, $.textContent = E, $.addEventListener("click", N), $;
2189
- }, h = u(i.restart, "⟲", () => {
2277
+ }, h = u(s.restart, "⟲", () => {
2190
2278
  e.pause(), e.seek(0);
2191
- }), d = u(i.prev, "|◀", () => e.prev()), f = u(i.play, "▶", () => e.isPlaying ? e.pause() : p(), "tf-ctl-primary"), g = u(i.next, "▶|", () => e.next()), p = () => {
2279
+ }), f = u(s.prev, "|◀", () => e.prev()), m = u(s.play, "▶", () => e.isPlaying ? e.pause() : d(), "tf-ctl-primary"), p = u(s.next, "▶|", () => e.next()), d = () => {
2192
2280
  e.currentTime >= e.duration - 0.5 && e.seek(0), e.play();
2193
- }, m = s.createElement("input");
2194
- 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", () => {
2195
- e.pause(), e.seek(Number(m.value) / 1e3 * e.duration);
2281
+ }, g = i.createElement("input");
2282
+ g.type = "range", g.className = "tf-ctl-scrub", g.min = "0", g.max = "1000", g.step = "1", g.setAttribute("aria-label", s.scrub), g.addEventListener("input", () => {
2283
+ e.pause(), e.seek(Number(g.value) / 1e3 * e.duration);
2196
2284
  });
2197
- const b = s.createElement("span");
2285
+ const b = i.createElement("span");
2198
2286
  b.className = "tf-ctl-step";
2199
- const v = s.createElement("select");
2200
- v.className = "tf-ctl-speed", v.setAttribute("aria-label", i.speed);
2287
+ const v = i.createElement("select");
2288
+ v.className = "tf-ctl-speed", v.setAttribute("aria-label", s.speed);
2201
2289
  for (const w of r) {
2202
- const E = s.createElement("option");
2290
+ const E = i.createElement("option");
2203
2291
  E.value = String(w), E.textContent = `${w}×`, w === 1 && (E.selected = !0), v.appendChild(E);
2204
2292
  }
2205
- v.addEventListener("change", () => e.setSpeed(Number(v.value))), l.append(h, d, f, g, m, b), r.length > 0 && l.append(v), c.append(l);
2206
- const k = n.fullscreen ? Bn(t, s, i) : void 0;
2293
+ v.addEventListener("change", () => e.setSpeed(Number(v.value))), l.append(h, f, m, p, g, b), r.length > 0 && l.append(v), c.append(l);
2294
+ const k = n.fullscreen ? ni(t, i, s) : void 0;
2207
2295
  k && l.append(k.button);
2208
- const M = s.createElement("p");
2296
+ const M = i.createElement("p");
2209
2297
  M.className = "tf-ctl-caption", M.setAttribute("aria-live", "polite"), n.captions !== !1 && c.append(M);
2210
- const y = s.createElement("div");
2298
+ const y = i.createElement("div");
2211
2299
  y.className = "tf-ctl-question", y.hidden = !0;
2212
- const S = s.createElement("span"), x = u(i.reveal, i.reveal, () => e.play(), "tf-ctl-primary");
2300
+ const S = i.createElement("span"), x = u(s.reveal, s.reveal, () => e.play(), "tf-ctl-primary");
2213
2301
  y.append(S, x), c.append(y);
2214
- const P = qn(e, s, i.scenario, n.scenarioControl ?? "buttons");
2302
+ const P = Jn(e, i, s.scenario, n.scenarioControl ?? "buttons");
2215
2303
  P && c.append(P.element);
2216
2304
  const Y = n.mount;
2217
2305
  Y ? Y.appendChild(c) : t.insertAdjacentElement("afterend", c);
2218
2306
  const T = () => {
2219
2307
  const w = e.isPlaying;
2220
- f.textContent = w ? "❚❚" : "▶", f.setAttribute("aria-label", w ? i.pause : i.play), f.title = w ? i.pause : i.play;
2308
+ m.textContent = w ? "❚❚" : "▶", m.setAttribute("aria-label", w ? s.pause : s.play), m.title = w ? s.pause : s.play;
2221
2309
  const E = e.duration;
2222
- s.activeElement !== m && (m.value = String(E > 0 ? Math.round(e.currentTime / E * 1e3) : 0));
2310
+ i.activeElement !== g && (g.value = String(E > 0 ? Math.round(e.currentTime / E * 1e3) : 0));
2223
2311
  const N = e.markers;
2224
- if (d.hidden = g.hidden = b.hidden = N.length === 0, N.length > 0) {
2312
+ if (f.hidden = p.hidden = b.hidden = N.length === 0, N.length > 0) {
2225
2313
  const O = e.currentMarker, $ = O ? N.indexOf(O) + 1 : 0;
2226
- b.textContent = i.stepFormat.replace("{index}", String($)).replace("{total}", String(N.length)), b.setAttribute("aria-label", `${i.step} ${$} ${i.of} ${N.length}`), d.disabled = e.currentTime <= 0.5, g.disabled = e.currentTime >= E - 0.5;
2314
+ b.textContent = s.stepFormat.replace("{index}", String($)).replace("{total}", String(N.length)), b.setAttribute("aria-label", `${s.step} ${$} ${s.of} ${N.length}`), f.disabled = e.currentTime <= 0.5, p.disabled = e.currentTime >= E - 0.5;
2227
2315
  const A = e.caption() ?? "";
2228
2316
  M.textContent !== A && (M.textContent = A), M.hidden = !o();
2229
2317
  const I = !w && O?.question !== void 0 && Math.abs(e.currentTime - O.time) < 1;
@@ -2241,7 +2329,7 @@ function Yn(e, t, n = {}) {
2241
2329
  if (!(E.tagName === "INPUT" || E.tagName === "SELECT") && !(w.key === " " && E.tagName === "BUTTON"))
2242
2330
  switch (w.key) {
2243
2331
  case " ":
2244
- w.preventDefault(), e.isPlaying ? e.pause() : p();
2332
+ w.preventDefault(), e.isPlaying ? e.pause() : d();
2245
2333
  break;
2246
2334
  case "ArrowRight":
2247
2335
  if (!a()) return;
@@ -2275,40 +2363,40 @@ function Yn(e, t, n = {}) {
2275
2363
  }
2276
2364
  };
2277
2365
  }
2278
- function qn(e, t, n, s) {
2279
- const i = e.scenarios;
2280
- if (i.length < 2) return;
2281
- if (s === "slider") {
2366
+ function Jn(e, t, n, i) {
2367
+ const s = e.scenarios;
2368
+ if (s.length < 2) return;
2369
+ if (i === "slider") {
2282
2370
  const u = t.createElement("div");
2283
2371
  u.className = "tf-ctl-choice-slider";
2284
2372
  const h = t.createElement("span");
2285
2373
  h.textContent = n, h.setAttribute("aria-hidden", "true");
2286
- const d = t.createElement("input");
2287
- d.type = "range", d.min = "0", d.max = String(i.length - 1), d.step = "1", d.setAttribute("aria-label", n);
2288
- const f = t.createElement("output");
2289
- return f.setAttribute("aria-hidden", "true"), d.addEventListener("input", () => {
2290
- const p = i[Number(d.value)];
2291
- p && e.setScenario(p.id);
2292
- }), u.append(h, d, f), { element: u, update: () => {
2293
- const p = Math.max(0, i.findIndex((b) => b.id === e.scenario));
2294
- t.activeElement !== d && (d.value = String(p));
2295
- const m = i[p].label;
2296
- f.textContent !== m && (f.textContent = m), d.setAttribute("aria-valuetext", m);
2374
+ const f = t.createElement("input");
2375
+ f.type = "range", f.min = "0", f.max = String(s.length - 1), f.step = "1", f.setAttribute("aria-label", n);
2376
+ const m = t.createElement("output");
2377
+ return m.setAttribute("aria-hidden", "true"), f.addEventListener("input", () => {
2378
+ const d = s[Number(f.value)];
2379
+ d && e.setScenario(d.id);
2380
+ }), u.append(h, f, m), { element: u, update: () => {
2381
+ const d = Math.max(0, s.findIndex((b) => b.id === e.scenario));
2382
+ t.activeElement !== f && (f.value = String(d));
2383
+ const g = s[d].label;
2384
+ m.textContent !== g && (m.textContent = g), f.setAttribute("aria-valuetext", g);
2297
2385
  } };
2298
2386
  }
2299
2387
  const r = t.createElement("fieldset");
2300
2388
  r.className = "tf-ctl-choices";
2301
2389
  const a = t.createElement("legend");
2302
2390
  a.textContent = n, r.append(a);
2303
- const o = `tf-ctl-scenario-${++Fn}`, c = i.map((u) => {
2391
+ const o = `tf-ctl-scenario-${++Gn}`, c = s.map((u) => {
2304
2392
  const h = t.createElement("label");
2305
2393
  h.className = "tf-ctl-choice";
2306
- const d = t.createElement("input");
2307
- d.type = "radio", d.name = o, d.value = u.id, d.addEventListener("change", () => {
2308
- d.checked && e.setScenario(u.id);
2394
+ const f = t.createElement("input");
2395
+ f.type = "radio", f.name = o, f.value = u.id, f.addEventListener("change", () => {
2396
+ f.checked && e.setScenario(u.id);
2309
2397
  });
2310
- const f = t.createElement("span");
2311
- return f.textContent = u.label, h.append(d, f), r.append(h), d;
2398
+ const m = t.createElement("span");
2399
+ return m.textContent = u.label, h.append(f, m), r.append(h), f;
2312
2400
  });
2313
2401
  return { element: r, update: () => {
2314
2402
  for (const u of c) {
@@ -2317,294 +2405,294 @@ function qn(e, t, n, s) {
2317
2405
  }
2318
2406
  } };
2319
2407
  }
2320
- const Vn = '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5"/></svg>', Wn = '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5"/></svg>';
2321
- function Bn(e, t, n) {
2322
- const s = t, i = e, r = t.createElement("button");
2408
+ const ti = '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5"/></svg>', ei = '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5"/></svg>';
2409
+ function ni(e, t, n) {
2410
+ const i = t, s = e, r = t.createElement("button");
2323
2411
  r.type = "button", r.className = "tf-ctl-btn tf-ctl-fullscreen";
2324
2412
  let a, o = "";
2325
2413
  const c = () => {
2326
- const p = a !== void 0;
2327
- r.innerHTML = p ? Wn : Vn;
2328
- const m = p ? n.exitFullscreen : n.fullscreen;
2329
- r.setAttribute("aria-label", m), r.title = m, r.setAttribute("aria-pressed", String(p)), e.classList.toggle("tf-fullscreen", p), e.classList.toggle("tf-fullscreen-overlay", a === "overlay");
2330
- }, l = () => s.fullscreenElement ?? s.webkitFullscreenElement ?? null, u = () => {
2414
+ const d = a !== void 0;
2415
+ r.innerHTML = d ? ei : ti;
2416
+ const g = d ? n.exitFullscreen : n.fullscreen;
2417
+ r.setAttribute("aria-label", g), r.title = g, r.setAttribute("aria-pressed", String(d)), e.classList.toggle("tf-fullscreen", d), e.classList.toggle("tf-fullscreen-overlay", a === "overlay");
2418
+ }, l = () => i.fullscreenElement ?? i.webkitFullscreenElement ?? null, u = () => {
2331
2419
  l() === e ? a = "native" : a === "native" && (a = void 0), c();
2332
- }, h = (p) => {
2333
- p.key === "Escape" && g();
2334
- }, d = () => {
2420
+ }, h = (d) => {
2421
+ d.key === "Escape" && p();
2422
+ }, f = () => {
2335
2423
  a = "overlay", o = t.documentElement.style.overflow, t.documentElement.style.overflow = "hidden", t.addEventListener("keydown", h), c();
2336
2424
  };
2337
- async function f() {
2425
+ async function m() {
2338
2426
  if (a) return;
2339
- const p = i.requestFullscreen?.bind(i) ?? i.webkitRequestFullscreen?.bind(i), m = s.fullscreenEnabled ?? s.webkitFullscreenEnabled ?? !1;
2340
- if (p && m)
2427
+ const d = s.requestFullscreen?.bind(s) ?? s.webkitRequestFullscreen?.bind(s), g = i.fullscreenEnabled ?? i.webkitFullscreenEnabled ?? !1;
2428
+ if (d && g)
2341
2429
  try {
2342
- if (await p(), l() === e) {
2430
+ if (await d(), l() === e) {
2343
2431
  a = "native", c();
2344
2432
  return;
2345
2433
  }
2346
2434
  } catch {
2347
2435
  }
2348
- d();
2436
+ f();
2349
2437
  }
2350
- async function g() {
2438
+ async function p() {
2351
2439
  if (a === "overlay")
2352
2440
  t.removeEventListener("keydown", h), t.documentElement.style.overflow = o, a = void 0, c();
2353
2441
  else if (a === "native") {
2354
2442
  a = void 0, c();
2355
- const p = s.exitFullscreen?.bind(s) ?? s.webkitExitFullscreen?.bind(s);
2356
- l() === e && p && await p();
2443
+ const d = i.exitFullscreen?.bind(i) ?? i.webkitExitFullscreen?.bind(i);
2444
+ l() === e && d && await d();
2357
2445
  }
2358
2446
  }
2359
2447
  return r.addEventListener("click", () => {
2360
- a ? g() : f();
2448
+ a ? p() : m();
2361
2449
  }), t.addEventListener("fullscreenchange", u), t.addEventListener("webkitfullscreenchange", u), c(), {
2362
2450
  button: r,
2363
2451
  get active() {
2364
2452
  return a !== void 0;
2365
2453
  },
2366
- enter: f,
2367
- exit: g,
2454
+ enter: m,
2455
+ exit: p,
2368
2456
  destroy() {
2369
- g(), t.removeEventListener("fullscreenchange", u), t.removeEventListener("webkitfullscreenchange", u), r.remove();
2457
+ p(), t.removeEventListener("fullscreenchange", u), t.removeEventListener("webkitfullscreenchange", u), r.remove();
2370
2458
  }
2371
2459
  };
2372
2460
  }
2373
- const Bt = "tinyfly-choices-style", Un = `
2461
+ const Ut = "tinyfly-choices-style", ii = `
2374
2462
  [data-tinyfly-choose] { cursor: pointer; }
2375
2463
  [data-tinyfly-choose]:focus-visible { outline: 2px solid var(--tf-ctl-accent, #c2410c); outline-offset: 2px; }
2376
2464
  `;
2377
- function jn(e) {
2378
- if (e.getElementById(Bt)) return;
2465
+ function si(e) {
2466
+ if (e.getElementById(Ut)) return;
2379
2467
  const t = e.createElement("style");
2380
- t.id = Bt, t.textContent = Un, e.head.appendChild(t);
2468
+ t.id = Ut, t.textContent = ii, e.head.appendChild(t);
2381
2469
  }
2382
- function Hn(e, t) {
2470
+ function ri(e, t) {
2383
2471
  const n = Array.from(t.querySelectorAll("[data-tinyfly-choose]"));
2384
2472
  if (n.length === 0) return () => {
2385
2473
  };
2386
- jn(t.ownerDocument);
2387
- const s = [], i = [];
2474
+ si(t.ownerDocument);
2475
+ const i = [], s = [];
2388
2476
  for (const o of n) {
2389
- const c = o.getAttribute("data-tinyfly-choose") ?? "", l = [], u = (g, p) => {
2390
- o.hasAttribute(g) || (o.setAttribute(g, p), l.push(g));
2477
+ const c = o.getAttribute("data-tinyfly-choose") ?? "", l = [], u = (p, d) => {
2478
+ o.hasAttribute(p) || (o.setAttribute(p, d), l.push(p));
2391
2479
  };
2392
2480
  u("role", "button"), u("tabindex", "0");
2393
- const h = e.scenarios.find((g) => g.id === c)?.label;
2394
- h !== void 0 && u("aria-label", h), o.setAttribute("aria-pressed", "false"), l.push("aria-pressed"), s.push({ element: o, attributes: l });
2395
- const d = () => e.setScenario(c), f = (g) => {
2396
- const p = g.key;
2397
- p !== "Enter" && p !== " " || (g.preventDefault(), d());
2481
+ const h = e.scenarios.find((p) => p.id === c)?.label;
2482
+ h !== void 0 && u("aria-label", h), o.setAttribute("aria-pressed", "false"), l.push("aria-pressed"), i.push({ element: o, attributes: l });
2483
+ const f = () => e.setScenario(c), m = (p) => {
2484
+ const d = p.key;
2485
+ d !== "Enter" && d !== " " || (p.preventDefault(), f());
2398
2486
  };
2399
- o.addEventListener("click", d), o.addEventListener("keydown", f), i.push(() => {
2400
- o.removeEventListener("click", d), o.removeEventListener("keydown", f);
2487
+ o.addEventListener("click", f), o.addEventListener("keydown", m), s.push(() => {
2488
+ o.removeEventListener("click", f), o.removeEventListener("keydown", m);
2401
2489
  });
2402
2490
  }
2403
2491
  const r = () => {
2404
- for (const { element: o } of s)
2492
+ for (const { element: o } of i)
2405
2493
  o.setAttribute("aria-pressed", String(o.getAttribute("data-tinyfly-choose") === e.scenario));
2406
2494
  }, a = e.subscribe(r);
2407
2495
  return r(), () => {
2408
2496
  a();
2409
- for (const o of i) o();
2410
- for (const { element: o, attributes: c } of s) for (const l of c) o.removeAttribute(l);
2497
+ for (const o of s) o();
2498
+ for (const { element: o, attributes: c } of i) for (const l of c) o.removeAttribute(l);
2411
2499
  };
2412
2500
  }
2413
- const at = /* @__PURE__ */ new WeakMap(), kt = /* @__PURE__ */ new WeakMap();
2414
- let zn = 0;
2415
- function K(e, t, n) {
2501
+ const ot = /* @__PURE__ */ new WeakMap(), xt = /* @__PURE__ */ new WeakMap();
2502
+ let ai = 0;
2503
+ function J(e, t, n) {
2416
2504
  if (e)
2417
2505
  try {
2418
2506
  return JSON.parse(e);
2419
- } catch (s) {
2420
- console.warn(`tinyfly: invalid ${t} JSON on`, n, s);
2507
+ } catch (i) {
2508
+ console.warn(`tinyfly: invalid ${t} JSON on`, n, i);
2421
2509
  return;
2422
2510
  }
2423
2511
  }
2424
- async function Gn(e, t = {}) {
2425
- const n = at.get(e);
2512
+ async function oi(e, t = {}) {
2513
+ const n = ot.get(e);
2426
2514
  if (n) return n;
2427
- const s = Array.from(e.querySelectorAll("script[data-tinyfly-timeline]")), i = s[0], r = e.getAttribute("data-src"), a = Zn(e.getAttribute("data-markers")), o = s.length > 1 || i?.hasAttribute("data-scenario") ? Qn(s, a, e) : void 0;
2515
+ const i = Array.from(e.querySelectorAll("script[data-tinyfly-timeline]")), s = i[0], r = e.getAttribute("data-src"), a = li(e.getAttribute("data-markers")), o = i.length > 1 || s?.hasAttribute("data-scenario") ? ci(i, a, e) : void 0;
2428
2516
  if (o && o.length === 0) return;
2429
- let c = i && !o ? K(i.textContent, "timeline", e) : void 0;
2517
+ let c = s && !o ? J(s.textContent, "timeline", e) : void 0;
2430
2518
  if (!c && r && a) {
2431
- const f = await fetch(r);
2432
- f.ok && (c = await f.json());
2519
+ const m = await fetch(r);
2520
+ m.ok && (c = await m.json());
2433
2521
  }
2434
- if (c && a && (c = ie(c, a)), !c && !r && !o) {
2522
+ if (c && a && (c = re(c, a)), !c && !r && !o) {
2435
2523
  console.warn('tinyfly: embed has no timeline (a <script type="application/json" data-tinyfly-timeline> or data-src)', e);
2436
2524
  return;
2437
2525
  }
2438
- const l = K(e.querySelector("script[data-tinyfly-captions]")?.textContent, "captions", e), u = {
2526
+ const l = J(e.querySelector("script[data-tinyfly-captions]")?.textContent, "captions", e), u = {
2439
2527
  playWhenVisible: !0,
2440
2528
  ...t.player,
2441
2529
  ...l && { captions: l },
2442
- ...K(e.getAttribute("data-options"), "data-options", e)
2530
+ ...J(e.getAttribute("data-options"), "data-options", e)
2443
2531
  };
2444
- Jn(e);
2445
- const h = new Mt(e, u), d = { element: e, player: h };
2446
- if (at.set(e, d), e.setAttribute("data-tinyfly-mounted", ""), o) {
2447
- const f = e.getAttribute("data-scenario") ?? void 0;
2448
- await h.loadScenarios(o, { initial: o.some((g) => g.id === f) ? f : void 0 }), kt.set(e, Hn(h, e));
2532
+ ui(e);
2533
+ const h = new St(e, u), f = { element: e, player: h };
2534
+ if (ot.set(e, f), e.setAttribute("data-tinyfly-mounted", ""), o) {
2535
+ const m = e.getAttribute("data-scenario") ?? void 0;
2536
+ await h.loadScenarios(o, { initial: o.some((p) => p.id === m) ? m : void 0 }), xt.set(e, ri(h, e));
2449
2537
  } else
2450
2538
  await h.load(c ?? r);
2451
2539
  if (e.getAttribute("data-controls") !== "false") {
2452
- const f = K(e.getAttribute("data-labels"), "data-labels", e), g = e.querySelector("figcaption"), p = e.getAttribute("data-scenario-legend"), m = e.getAttribute("data-scenario-control");
2453
- d.controls = Yn(h, e, {
2540
+ const m = J(e.getAttribute("data-labels"), "data-labels", e), p = e.querySelector("figcaption"), d = e.getAttribute("data-scenario-legend"), g = e.getAttribute("data-scenario-control");
2541
+ f.controls = Kn(h, e, {
2454
2542
  ...t.controls,
2455
2543
  ...e.getAttribute("data-fullscreen") === "true" ? { fullscreen: !0 } : {},
2456
- ...m === "slider" || m === "buttons" ? { scenarioControl: m } : {},
2457
- labels: { ...t.controls?.labels, ...f, ...p ? { scenario: p } : {} },
2544
+ ...g === "slider" || g === "buttons" ? { scenarioControl: g } : {},
2545
+ labels: { ...t.controls?.labels, ...m, ...d ? { scenario: d } : {} },
2458
2546
  // Inside the figure, before its figcaption, so the caption stays last.
2459
2547
  mount: void 0
2460
- }), g ? e.insertBefore(d.controls.element, g) : e.appendChild(d.controls.element);
2548
+ }), p ? e.insertBefore(f.controls.element, p) : e.appendChild(f.controls.element);
2461
2549
  }
2462
- return d;
2550
+ return f;
2463
2551
  }
2464
- function Qn(e, t, n) {
2465
- const s = [];
2466
- return e.forEach((i, r) => {
2467
- const a = K(i.textContent, "timeline", n);
2552
+ function ci(e, t, n) {
2553
+ const i = [];
2554
+ return e.forEach((s, r) => {
2555
+ const a = J(s.textContent, "timeline", n);
2468
2556
  if (!a) return;
2469
- const o = i.getAttribute("data-scenario") || `scenario-${r + 1}`;
2470
- if (s.some((l) => l.id === o)) {
2557
+ const o = s.getAttribute("data-scenario") || `scenario-${r + 1}`;
2558
+ if (i.some((l) => l.id === o)) {
2471
2559
  console.warn(`tinyfly: scenario id "${o}" is used more than once; the later one is skipped`, n);
2472
2560
  return;
2473
2561
  }
2474
- const c = i.getAttribute("data-scenario-label") ?? void 0;
2475
- s.push({ id: o, label: c, timeline: t ? ie(a, t) : a });
2476
- }), s;
2562
+ const c = s.getAttribute("data-scenario-label") ?? void 0;
2563
+ i.push({ id: o, label: c, timeline: t ? re(a, t) : a });
2564
+ }), i;
2477
2565
  }
2478
- function ie(e, t) {
2479
- return e.config.markers?.length ? e : { ...e, config: { ...e.config, markers: t.map((n, s) => ({ id: `step-${s + 1}`, time: n })) } };
2566
+ function re(e, t) {
2567
+ return e.config.markers?.length ? e : { ...e, config: { ...e.config, markers: t.map((n, i) => ({ id: `step-${i + 1}`, time: n })) } };
2480
2568
  }
2481
- function Zn(e) {
2569
+ function li(e) {
2482
2570
  if (!e) return;
2483
- const t = e.split(/[\s,]+/).filter(Boolean).map(Number).filter((n) => Number.isFinite(n) && n >= 0).sort((n, s) => n - s);
2571
+ const t = e.split(/[\s,]+/).filter(Boolean).map(Number).filter((n) => Number.isFinite(n) && n >= 0).sort((n, i) => n - i);
2484
2572
  return t.length > 0 ? t : void 0;
2485
2573
  }
2486
- async function Kn(e = document, t = {}) {
2574
+ async function hi(e = document, t = {}) {
2487
2575
  const n = Array.from(e.querySelectorAll("[data-tinyfly-embed]"));
2488
- return (await Promise.all(n.map((i) => Gn(i, t)))).filter((i) => i !== void 0);
2576
+ return (await Promise.all(n.map((s) => oi(s, t)))).filter((s) => s !== void 0);
2489
2577
  }
2490
- function ls(e) {
2491
- const t = at.get(e);
2492
- t && (kt.get(e)?.(), kt.delete(e), t.controls?.destroy(), t.player.destroy(), at.delete(e), e.removeAttribute("data-tinyfly-mounted"));
2578
+ function xi(e) {
2579
+ const t = ot.get(e);
2580
+ t && (xt.get(e)?.(), xt.delete(e), t.controls?.destroy(), t.player.destroy(), ot.delete(e), e.removeAttribute("data-tinyfly-mounted"));
2493
2581
  }
2494
- function Jn(e) {
2582
+ function ui(e) {
2495
2583
  const t = e.querySelector("svg");
2496
2584
  if (!t || t.hasAttribute("role") || t.hasAttribute("aria-hidden")) return;
2497
- const n = e.getAttribute("data-alt"), s = e.querySelector("figcaption");
2498
- t.setAttribute("role", "img"), n ? t.setAttribute("aria-label", n) : s && (s.id ||= `tinyfly-caption-${++zn}`, t.setAttribute("aria-labelledby", s.id));
2585
+ const n = e.getAttribute("data-alt"), i = e.querySelector("figcaption");
2586
+ t.setAttribute("role", "img"), n ? t.setAttribute("aria-label", n) : i && (i.id ||= `tinyfly-caption-${++ai}`, t.setAttribute("aria-labelledby", i.id));
2499
2587
  }
2500
- function ts() {
2588
+ function di() {
2501
2589
  if (!(typeof document < "u" ? document.currentScript : null)?.hasAttribute("data-tinyfly-auto")) return;
2502
2590
  const t = () => {
2503
- Kn();
2591
+ hi();
2504
2592
  };
2505
2593
  document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", t, { once: !0 }) : t();
2506
2594
  }
2507
- function re(e) {
2595
+ function ae(e) {
2508
2596
  const t = /* @__PURE__ */ new Set();
2509
2597
  for (const n of e.matchAll(/data-tinyfly\s*=\s*("([^"]*)"|'([^']*)')/g)) t.add(n[2] ?? n[3]);
2510
2598
  return [...t];
2511
2599
  }
2512
- function es(e, t = {}) {
2513
- const n = [], s = (l) => n.push({ level: "error", message: l }), i = (l) => n.push({ level: "warning", message: l });
2514
- if ((e.formatVersion ?? 1) > J)
2515
- return s(`format version ${e.formatVersion} is newer than this tinyfly reads (${J})`), n;
2600
+ function fi(e, t = {}) {
2601
+ const n = [], i = (l) => n.push({ level: "error", message: l }), s = (l) => n.push({ level: "warning", message: l });
2602
+ if ((e.formatVersion ?? 1) > st)
2603
+ return i(`format version ${e.formatVersion} is newer than this tinyfly reads (${st})`), n;
2516
2604
  let r = 0;
2517
2605
  try {
2518
- r = rt(e).duration;
2606
+ r = at(e).duration;
2519
2607
  } catch (l) {
2520
- return s(`the timeline does not load: ${l instanceof Error ? l.message : String(l)}`), n;
2608
+ return i(`the timeline does not load: ${l instanceof Error ? l.message : String(l)}`), n;
2521
2609
  }
2522
2610
  const a = e.config?.duration;
2523
2611
  if (a !== void 0)
2524
2612
  for (const l of e.tracks) {
2525
2613
  if (!("keyframes" in l)) continue;
2526
2614
  const u = l.keyframes.filter((h) => h.time > a);
2527
- u.length > 0 && s(`track "${l.id}" has a keyframe at ${u[0].time}ms, after the ${a}ms duration`);
2615
+ u.length > 0 && i(`track "${l.id}" has a keyframe at ${u[0].time}ms, after the ${a}ms duration`);
2528
2616
  }
2529
2617
  const o = e.config?.markers ?? [], c = /* @__PURE__ */ new Set();
2530
2618
  o.forEach((l, u) => {
2531
- c.has(l.id) && s(`marker id "${l.id}" is used more than once`), c.add(l.id), (l.time < 0 || l.time > r) && s(`marker "${l.id}" at ${l.time}ms is outside the animation (0–${r}ms)`), u > 0 && l.time < o[u - 1].time && s(`marker "${l.id}" comes before "${o[u - 1].id}" in time; list markers in order`);
2619
+ c.has(l.id) && i(`marker id "${l.id}" is used more than once`), c.add(l.id), (l.time < 0 || l.time > r) && i(`marker "${l.id}" at ${l.time}ms is outside the animation (0–${r}ms)`), u > 0 && l.time < o[u - 1].time && i(`marker "${l.id}" comes before "${o[u - 1].id}" in time; list markers in order`);
2532
2620
  });
2533
2621
  for (const [l, u] of Object.entries(e.captions ?? {})) {
2534
2622
  for (const h of Object.keys(u))
2535
- c.has(h) || s(`caption "${h}" (${l}) has no marker with that id`);
2623
+ c.has(h) || i(`caption "${h}" (${l}) has no marker with that id`);
2536
2624
  for (const h of c)
2537
- h in u || i(`marker "${h}" has no ${l} caption; its label is shown instead`);
2625
+ h in u || s(`marker "${h}" has no ${l} caption; its label is shown instead`);
2538
2626
  }
2539
2627
  if (t.markup !== void 0) {
2540
- const l = new Set(re(t.markup)), u = /* @__PURE__ */ new Set();
2628
+ const l = new Set(ae(t.markup)), u = /* @__PURE__ */ new Set();
2541
2629
  for (const h of e.tracks)
2542
- for (const d of [h.target, ...h.targets ?? []])
2543
- u.add(d), l.has(d) || s(`track "${h.id}" targets "${d}", but no element has data-tinyfly="${d}"`);
2544
- for (const h of l) u.has(h) || i(`data-tinyfly="${h}" is never animated`);
2630
+ for (const f of [h.target, ...h.targets ?? []])
2631
+ u.add(f), l.has(f) || i(`track "${h.id}" targets "${f}", but no element has data-tinyfly="${f}"`);
2632
+ for (const h of l) u.has(h) || s(`data-tinyfly="${h}" is never animated`);
2545
2633
  }
2546
2634
  return n;
2547
2635
  }
2548
- function ns(e) {
2636
+ function pi(e) {
2549
2637
  const t = /* @__PURE__ */ new Set();
2550
2638
  for (const n of e.matchAll(/data-tinyfly-choose\s*=\s*("([^"]*)"|'([^']*)')/g)) t.add(n[2] ?? n[3]);
2551
2639
  return [...t];
2552
2640
  }
2553
- function hs(e, t = {}) {
2641
+ function wi(e, t = {}) {
2554
2642
  const n = [];
2555
2643
  e.length === 1 && n.push({ level: "warning", message: "only one scenario, so the reader has nothing to choose" });
2556
- const s = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
2644
+ const i = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
2557
2645
  for (const r of e) {
2558
- if (s.has(r.id)) {
2646
+ if (i.has(r.id)) {
2559
2647
  n.push({ level: "error", message: `scenario id "${r.id}" is used more than once` });
2560
2648
  continue;
2561
2649
  }
2562
- s.add(r.id);
2563
- for (const a of es(r.timeline, t))
2650
+ i.add(r.id);
2651
+ for (const a of fi(r.timeline, t))
2564
2652
  /is never animated$/.test(a.message) || n.push({ level: a.level, message: `scenario "${r.id}": ${a.message}` });
2565
- for (const a of r.timeline.tracks) for (const o of [a.target, ...a.targets ?? []]) i.add(o);
2653
+ for (const a of r.timeline.tracks) for (const o of [a.target, ...a.targets ?? []]) s.add(o);
2566
2654
  }
2567
2655
  if (t.markup !== void 0) {
2568
- for (const r of ns(t.markup))
2569
- s.has(r) || n.push({ level: "error", message: `data-tinyfly-choose="${r}" names no scenario` });
2570
- for (const r of re(t.markup))
2571
- i.has(r) || n.push({ level: "warning", message: `data-tinyfly="${r}" is never animated in any scenario` });
2656
+ for (const r of pi(t.markup))
2657
+ i.has(r) || n.push({ level: "error", message: `data-tinyfly-choose="${r}" names no scenario` });
2658
+ for (const r of ae(t.markup))
2659
+ s.has(r) || n.push({ level: "warning", message: `data-tinyfly="${r}" is never animated in any scenario` });
2572
2660
  }
2573
2661
  return n;
2574
2662
  }
2575
- function us(e, t, n = "end") {
2576
- const s = rt(t), i = t.config?.markers ?? [], r = n === "start" ? 0 : n === "end" ? s.duration : typeof n == "number" ? n : i.find((d) => d.id === n)?.time ?? s.duration, a = s.getStateAtTime(Math.max(0, Math.min(s.duration, r))), o = new vt(), c = /* @__PURE__ */ new Map(), l = is(e);
2577
- for (const d of e.matchAll(Ut)) {
2578
- const f = /data-tinyfly\s*=\s*("([^"]*)"|'([^']*)')/.exec(d[2] ?? "");
2579
- if (!f) continue;
2580
- const g = f[2] ?? f[3];
2581
- if (c.has(g)) continue;
2582
- const p = ss(l(d.index ?? 0));
2583
- c.set(g, p), o.registerTarget(g, p);
2663
+ function Mi(e, t, n = "end") {
2664
+ const i = at(t), s = t.config?.markers ?? [], r = n === "start" ? 0 : n === "end" ? i.duration : typeof n == "number" ? n : s.find((f) => f.id === n)?.time ?? i.duration, a = i.getStateAtTime(Math.max(0, Math.min(i.duration, r))), o = new kt(), c = /* @__PURE__ */ new Map(), l = gi(e);
2665
+ for (const f of e.matchAll(jt)) {
2666
+ const m = /data-tinyfly\s*=\s*("([^"]*)"|'([^']*)')/.exec(f[2] ?? "");
2667
+ if (!m) continue;
2668
+ const p = m[2] ?? m[3];
2669
+ if (c.has(p)) continue;
2670
+ const d = mi(l(f.index ?? 0));
2671
+ c.set(p, d), o.registerTarget(p, d);
2584
2672
  }
2585
2673
  o.applyState(a);
2586
2674
  let u = "", h = 0;
2587
- for (const d of e.matchAll(Ut)) {
2588
- const [f, g, p = "", m] = d, b = d.index ?? 0, v = /data-tinyfly\s*=\s*("([^"]*)"|'([^']*)')/.exec(p), k = v ? c.get(v[2] ?? v[3]) : void 0;
2675
+ for (const f of e.matchAll(jt)) {
2676
+ const [m, p, d = "", g] = f, b = f.index ?? 0, v = /data-tinyfly\s*=\s*("([^"]*)"|'([^']*)')/.exec(d), k = v ? c.get(v[2] ?? v[3]) : void 0;
2589
2677
  if (!k || Object.keys(k.style).length === 0 && k.text === void 0) continue;
2590
2678
  u += e.slice(h, b);
2591
- const M = Object.entries(k.style).map(([x, P]) => `${rs(x)}: ${P}`).join("; "), y = /\sstyle\s*=\s*("([^"]*)"|'([^']*)')/.exec(p);
2592
- let S = p;
2679
+ const M = Object.entries(k.style).map(([x, P]) => `${yi(x)}: ${P}`).join("; "), y = /\sstyle\s*=\s*("([^"]*)"|'([^']*)')/.exec(d);
2680
+ let S = d;
2593
2681
  if (M)
2594
2682
  if (y) {
2595
2683
  const x = `${(y[2] ?? y[3]).trim().replace(/;?$/, ";")} ${M}`.trim();
2596
- S = p.replace(y[0], ` style="${jt(x)}"`);
2684
+ S = d.replace(y[0], ` style="${Ht(x)}"`);
2597
2685
  } else
2598
- S = `${p} style="${jt(M)}"`;
2599
- if (u += `<${g}${S}${m ? " /" : ""}>`, h = b + f.length, k.text !== void 0 && !m) {
2600
- const x = e.indexOf(`</${g}`, h), P = x === -1 ? "" : e.slice(h, x);
2601
- x !== -1 && !P.includes("<") && (u += as(k.text), h = x);
2686
+ S = `${d} style="${Ht(M)}"`;
2687
+ if (u += `<${p}${S}${g ? " /" : ""}>`, h = b + m.length, k.text !== void 0 && !g) {
2688
+ const x = e.indexOf(`</${p}`, h), P = x === -1 ? "" : e.slice(h, x);
2689
+ x !== -1 && !P.includes("<") && (u += bi(k.text), h = x);
2602
2690
  }
2603
2691
  }
2604
2692
  return u + e.slice(h);
2605
2693
  }
2606
- const Ut = /<([a-zA-Z][\w:-]*)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?)*)\s*(\/?)>/g;
2607
- function ss(e) {
2694
+ const jt = /<([a-zA-Z][\w:-]*)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?)*)\s*(\/?)>/g;
2695
+ function mi(e) {
2608
2696
  const t = {
2609
2697
  style: {},
2610
2698
  dataset: {},
@@ -2619,38 +2707,38 @@ function ss(e) {
2619
2707
  };
2620
2708
  return e && (t.ownerSVGElement = null), t;
2621
2709
  }
2622
- function is(e) {
2710
+ function gi(e) {
2623
2711
  const t = [], n = /<svg[\s>]/gi;
2624
- let s;
2625
- for (; s = n.exec(e); ) {
2626
- const i = e.toLowerCase().indexOf("</svg>", s.index);
2627
- t.push([s.index + 1, i === -1 ? e.length : i]);
2712
+ let i;
2713
+ for (; i = n.exec(e); ) {
2714
+ const s = e.toLowerCase().indexOf("</svg>", i.index);
2715
+ t.push([i.index + 1, s === -1 ? e.length : s]);
2628
2716
  }
2629
- return (i) => t.some(([r, a]) => i > r && i < a);
2717
+ return (s) => t.some(([r, a]) => s > r && s < a);
2630
2718
  }
2631
- function rs(e) {
2719
+ function yi(e) {
2632
2720
  const t = e.replace(/[A-Z]/g, (n) => `-${n.toLowerCase()}`);
2633
2721
  return /^(webkit|moz|ms)-/.test(t) ? `-${t}` : t;
2634
2722
  }
2635
- function jt(e) {
2723
+ function Ht(e) {
2636
2724
  return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;");
2637
2725
  }
2638
- function as(e) {
2726
+ function bi(e) {
2639
2727
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;");
2640
2728
  }
2641
- ts();
2729
+ di();
2642
2730
  export {
2643
- On as DEFAULT_LABELS,
2644
- Mt as TinyflyPlayer,
2645
- Hn as bindChoiceHotspots,
2646
- cs as create,
2647
- Yn as createControls,
2648
- Gn as mount,
2649
- Kn as mountAll,
2650
- os as play,
2651
- us as renderFrame,
2652
- re as targetNamesIn,
2653
- ls as unmount,
2654
- es as validateEmbed,
2655
- hs as validateScenarios
2731
+ zn as DEFAULT_LABELS,
2732
+ St as TinyflyPlayer,
2733
+ ri as bindChoiceHotspots,
2734
+ ki as create,
2735
+ Kn as createControls,
2736
+ oi as mount,
2737
+ hi as mountAll,
2738
+ vi as play,
2739
+ Mi as renderFrame,
2740
+ ae as targetNamesIn,
2741
+ xi as unmount,
2742
+ fi as validateEmbed,
2743
+ wi as validateScenarios
2656
2744
  };