@algorisys/yappydraw 0.8.253

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 (43) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +45 -0
  3. package/chunks/AllPackages-DNX4gUvL.js +6879 -0
  4. package/chunks/BaseConfiguration-iE_YypNt.js +4401 -0
  5. package/chunks/Entities-XwxJEcR3.js +467 -0
  6. package/chunks/Factory--zguTNZ7.js +2768 -0
  7. package/chunks/InputJax-BYq2tqUz.js +42 -0
  8. package/chunks/MathItem-DD5NNBjZ.js +76 -0
  9. package/chunks/Options-BStFr0zv.js +199 -0
  10. package/chunks/PrioritizedList-TjDg4i-s.js +39 -0
  11. package/chunks/Styles-DdTYCumM.js +397 -0
  12. package/chunks/TeXAtom-Bp5xoo7F.js +2175 -0
  13. package/chunks/ai-providers-CycU8sO1.js +229 -0
  14. package/chunks/canva-ai-BREIRXSl.js +285 -0
  15. package/chunks/design-generator-C89SKTqv.js +149 -0
  16. package/chunks/drawing-engine-DLFI-cNg.js +903 -0
  17. package/chunks/drawings-store-C-PoHakg.js +109 -0
  18. package/chunks/ds-operations-D5B9Z5vO.js +253 -0
  19. package/chunks/export-game-DOlM1w0F.js +104 -0
  20. package/chunks/game-runtime-Hn9umSvi.js +346 -0
  21. package/chunks/gifenc.esm-48qFK9lH.js +278 -0
  22. package/chunks/html-DxnOvKy4.js +1694 -0
  23. package/chunks/image-utils-CJQBaGoQ.js +37 -0
  24. package/chunks/index-Bm3Inzn8.js +62744 -0
  25. package/chunks/lengths-DNFHULBn.js +70 -0
  26. package/chunks/liteAdaptor-BZby1Qz2.js +919 -0
  27. package/chunks/lucide-solid-D_6t_rbY.js +35452 -0
  28. package/chunks/markdown-to-slides-_1GIcD8M.js +96 -0
  29. package/chunks/mathjax-CnUrFnFS.js +117 -0
  30. package/chunks/mathjax-D6cR72fZ.js +26 -0
  31. package/chunks/morph-animator-7qX2s9j_.js +25 -0
  32. package/chunks/onboarding-tour-CthiVc3W.js +192 -0
  33. package/chunks/rocket-settings-CU8w9S9I.js +100 -0
  34. package/chunks/search-CnWoMV6A.js +384 -0
  35. package/chunks/slide-generator-BG0Oacui.js +553 -0
  36. package/chunks/svg-BvVc02XL.js +12498 -0
  37. package/chunks/tex-Cfi4Kfun.js +442 -0
  38. package/chunks/tinyfly-engine-Wfa50sVI.js +1804 -0
  39. package/chunks/turntable-ai-Bfq-oSsD.js +120 -0
  40. package/chunks/yappy-NspTXSPk.css +1 -0
  41. package/package.json +21 -0
  42. package/yappy.d.ts +34 -0
  43. package/yappy.js +9 -0
@@ -0,0 +1,1804 @@
1
+ function ce(t) {
2
+ return typeof t == "object" && t !== null && t.type === "cubic-bezier";
3
+ }
4
+ function dt(t) {
5
+ return t.property === "text" && "textConfig" in t;
6
+ }
7
+ function Y(t) {
8
+ return t.kind === "inertia" && "inertia" in t;
9
+ }
10
+ function V(t) {
11
+ return t.kind === "spring" && "spring" in t;
12
+ }
13
+ function Et(t) {
14
+ return t.property === "motionPath" && "motionPathConfig" in t;
15
+ }
16
+ function dr(t) {
17
+ return typeof t == "object" && t !== null && "x" in t && "y" in t && "angle" in t;
18
+ }
19
+ function he(t) {
20
+ return "keyframes" in t;
21
+ }
22
+ class yr {
23
+ _currentTime = 0;
24
+ _isRunning = !1;
25
+ onTick = null;
26
+ get currentTime() {
27
+ return this._currentTime;
28
+ }
29
+ get isRunning() {
30
+ return this._isRunning;
31
+ }
32
+ start() {
33
+ this._isRunning = !0;
34
+ }
35
+ stop() {
36
+ this._isRunning = !1;
37
+ }
38
+ tick(e) {
39
+ this._currentTime += e, this.onTick?.(e, this._currentTime);
40
+ }
41
+ reset() {
42
+ this._currentTime = 0;
43
+ }
44
+ seek(e) {
45
+ this._currentTime = e;
46
+ }
47
+ }
48
+ class _r {
49
+ _currentTime = 0;
50
+ _isRunning = !1;
51
+ _lastFrameTime = null;
52
+ _rafId = null;
53
+ _speed;
54
+ onTick = null;
55
+ constructor(e = {}) {
56
+ this._speed = e.speed ?? 1;
57
+ }
58
+ get currentTime() {
59
+ return this._currentTime;
60
+ }
61
+ get isRunning() {
62
+ return this._isRunning;
63
+ }
64
+ get speed() {
65
+ return this._speed;
66
+ }
67
+ set speed(e) {
68
+ this._speed = e;
69
+ }
70
+ start() {
71
+ this._isRunning || (this._isRunning = !0, this._lastFrameTime = null, this._scheduleFrame());
72
+ }
73
+ stop() {
74
+ this._isRunning = !1, this._rafId !== null && (cancelAnimationFrame(this._rafId), this._rafId = null);
75
+ }
76
+ reset() {
77
+ this._currentTime = 0, this._lastFrameTime = null;
78
+ }
79
+ seek(e) {
80
+ this._currentTime = e;
81
+ }
82
+ _scheduleFrame() {
83
+ this._rafId = requestAnimationFrame(this._onFrame.bind(this));
84
+ }
85
+ _onFrame(e) {
86
+ if (this._isRunning) {
87
+ if (this._lastFrameTime !== null) {
88
+ const r = (e - this._lastFrameTime) * this._speed;
89
+ this._currentTime += r, this.onTick?.(r, this._currentTime);
90
+ }
91
+ this._lastFrameTime = e, this._scheduleFrame();
92
+ }
93
+ }
94
+ }
95
+ function Ot(t, e, r = "start") {
96
+ if (e <= 1) return 0;
97
+ if (typeof r == "number") {
98
+ const n = Math.max(0, Math.min(e - 1, r));
99
+ return Math.abs(t - n);
100
+ }
101
+ switch (r) {
102
+ case "end":
103
+ return e - 1 - t;
104
+ case "center":
105
+ return Math.abs(t - (e - 1) / 2);
106
+ case "edges":
107
+ return (e - 1) / 2 - Math.abs(t - (e - 1) / 2);
108
+ default:
109
+ return t;
110
+ }
111
+ }
112
+ function ue(t, e = "start") {
113
+ if (t <= 1) return 0;
114
+ let r = 0;
115
+ for (let n = 0; n < t; n++)
116
+ r = Math.max(r, Ot(n, t, e));
117
+ return r;
118
+ }
119
+ function Xt(t, e, r) {
120
+ const n = r.from ?? "start", s = Ot(t, e, n);
121
+ if (r.amount !== void 0) {
122
+ const a = ue(e, n);
123
+ return a === 0 ? 0 : r.amount * s / a;
124
+ }
125
+ return r.each !== void 0 ? r.each * s : 0;
126
+ }
127
+ function le(t, e) {
128
+ return Array.from({ length: t }, (r, n) => Xt(n, t, e));
129
+ }
130
+ function yt(t, e) {
131
+ return t <= 1 ? 0 : Math.max(...le(t, e));
132
+ }
133
+ const K = 1, Nt = 6e4, tt = Nt / K, R = {
134
+ stiffness: 180,
135
+ damping: 12,
136
+ mass: 1,
137
+ velocity: 0,
138
+ restDelta: 0.01,
139
+ restSpeed: 0.1
140
+ }, kr = {
141
+ gentle: { stiffness: 120, damping: 18, mass: 1 },
142
+ default: { stiffness: 180, damping: 12, mass: 1 },
143
+ snappy: { stiffness: 280, damping: 20, mass: 1 },
144
+ bouncy: { stiffness: 220, damping: 8, mass: 1 },
145
+ wobbly: { stiffness: 180, damping: 5, mass: 1 },
146
+ stiff: { stiffness: 400, damping: 30, mass: 1 }
147
+ };
148
+ class rt {
149
+ from;
150
+ to;
151
+ stiffness;
152
+ damping;
153
+ mass;
154
+ restDelta;
155
+ restSpeed;
156
+ /** value[i] is the spring's position at time i * SPRING_STEP_MS */
157
+ /**
158
+ * Travel distance, used to scale the rest thresholds.
159
+ *
160
+ * Without this the thresholds are absolute, and a spring animating `scale`
161
+ * from 0 to 1 hits them ~100x sooner than one animating `x` from 0 to 100 —
162
+ * so the small one is declared "settled" at its first pass through the
163
+ * target and never shows the overshoot at all. Scaling by travel makes
164
+ * settling depend on the spring's parameters, not on the units of whatever
165
+ * property it happens to drive.
166
+ */
167
+ distance;
168
+ samples;
169
+ velocity;
170
+ /** Once at rest we stop simulating; every later time returns `to`. */
171
+ settledStep = null;
172
+ constructor(e) {
173
+ this.from = e.from, this.to = e.to, this.stiffness = e.stiffness ?? R.stiffness, this.damping = e.damping ?? R.damping, this.mass = e.mass ?? R.mass, this.restDelta = e.restDelta ?? R.restDelta, this.restSpeed = e.restSpeed ?? R.restSpeed, this.distance = Math.abs(this.to - this.from) || 1, this.samples = [this.from], this.velocity = e.velocity ?? R.velocity, this.isAtRest(this.from) && (this.settledStep = 0);
174
+ }
175
+ /**
176
+ * Whether a position/velocity pair counts as settled.
177
+ *
178
+ * Both thresholds are fractions of the spring's travel distance:
179
+ * `restDelta` as a fraction of the distance, and `restSpeed` as a fraction
180
+ * of the distance per second. That keeps settling scale-invariant.
181
+ */
182
+ isAtRest(e) {
183
+ return Math.abs(e - this.to) < this.restDelta * this.distance && Math.abs(this.velocity) < this.restSpeed * this.distance;
184
+ }
185
+ /**
186
+ * Position at `timeMs`. Times before 0 clamp to the start value; times past
187
+ * settling return the target exactly.
188
+ */
189
+ valueAt(e) {
190
+ if (e <= 0) return this.from;
191
+ const r = Math.floor(e / K);
192
+ if (this.simulateTo(r + 1), this.settledStep !== null && r >= this.settledStep)
193
+ return this.to;
194
+ const n = this.samples[Math.min(r, this.samples.length - 1)], s = this.samples[Math.min(r + 1, this.samples.length - 1)], a = e / K - r;
195
+ return n + (s - n) * a;
196
+ }
197
+ /**
198
+ * How long the spring takes to settle, in milliseconds — the natural duration
199
+ * of a spring track. Runs the simulation to completion once.
200
+ */
201
+ settleTime() {
202
+ return this.simulateTo(tt + 1), this.settledStep !== null ? this.settledStep * K : Nt;
203
+ }
204
+ /** Advance the cached simulation until it holds at least `steps` samples. */
205
+ simulateTo(e) {
206
+ if (this.settledStep !== null) return;
207
+ const r = Math.min(e, tt + 1), n = K / 1e3;
208
+ for (; this.samples.length < r; ) {
209
+ const s = this.samples[this.samples.length - 1], a = s - this.to, i = -this.stiffness * a, o = -this.damping * this.velocity, c = (i + o) / this.mass;
210
+ this.velocity += c * n;
211
+ const h = s + this.velocity * n;
212
+ if (this.samples.push(h), this.isAtRest(h)) {
213
+ this.settledStep = this.samples.length - 1;
214
+ return;
215
+ }
216
+ }
217
+ this.samples.length > tt && (this.settledStep = tt);
218
+ }
219
+ }
220
+ function Mr(t, e) {
221
+ return new rt(t).valueAt(e);
222
+ }
223
+ function Tr(t) {
224
+ return new rt(t).settleTime();
225
+ }
226
+ function br(t) {
227
+ const e = t.stiffness ?? R.stiffness, r = t.damping ?? R.damping, n = t.mass ?? R.mass;
228
+ return r < 2 * Math.sqrt(e * n);
229
+ }
230
+ function vr(t) {
231
+ const e = t.stiffness ?? R.stiffness, r = t.mass ?? R.mass;
232
+ return 2 * Math.sqrt(e * r);
233
+ }
234
+ const Tt = 4, fe = 2e-3, ge = 1e-4, me = 6e4;
235
+ function nt(t) {
236
+ const e = t.friction ?? Tt;
237
+ return e > 0 ? e : Tt;
238
+ }
239
+ function pe(t) {
240
+ return t.from + t.velocity / nt(t);
241
+ }
242
+ function de(t, e) {
243
+ if (e === void 0) return t;
244
+ if (typeof e == "number")
245
+ return e > 0 ? Math.round(t / e) * e : t;
246
+ if (e.length === 0) return t;
247
+ let r = e[0];
248
+ for (const n of e)
249
+ Math.abs(n - t) < Math.abs(r - t) && (r = n);
250
+ return r;
251
+ }
252
+ function st(t) {
253
+ let e = de(pe(t), t.end);
254
+ return t.min !== void 0 && (e = Math.max(t.min, e)), t.max !== void 0 && (e = Math.min(t.max, e)), e;
255
+ }
256
+ function at(t) {
257
+ const e = Math.abs(st(t) - t.from);
258
+ if (e === 0) return 0;
259
+ const r = t.restDelta ?? Math.max(ge, e * fe);
260
+ if (r >= e) return 0;
261
+ const n = Math.log(e / r) / nt(t);
262
+ return Math.min(me, n * 1e3);
263
+ }
264
+ function mt(t, e) {
265
+ if (e <= 0) return t.from;
266
+ const r = st(t);
267
+ if (e >= at(t)) return r;
268
+ const n = nt(t);
269
+ return t.from + (r - t.from) * (1 - Math.exp(-n * e / 1e3));
270
+ }
271
+ function xr(t, e) {
272
+ const r = nt(t), n = st(t);
273
+ return e >= at(t) ? 0 : (n - t.from) * r * Math.exp(-r * Math.max(0, e) / 1e3);
274
+ }
275
+ const Yt = (t) => t, ye = (t) => t * t, _e = (t) => 1 - (1 - t) * (1 - t), ke = (t) => t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2, Vt = (t) => t * t * t, zt = (t) => 1 - Math.pow(1 - t, 3), Wt = (t) => t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2, Me = Vt, Te = zt, be = Wt, ve = {
276
+ linear: Yt,
277
+ "ease-in": Me,
278
+ "ease-out": Te,
279
+ "ease-in-out": be,
280
+ "ease-in-quad": ye,
281
+ "ease-out-quad": _e,
282
+ "ease-in-out-quad": ke,
283
+ "ease-in-cubic": Vt,
284
+ "ease-out-cubic": zt,
285
+ "ease-in-out-cubic": Wt
286
+ };
287
+ function xe(t) {
288
+ const [e, r, n, s] = t, a = 3 * e, i = 3 * (n - e) - a, o = 1 - a - i, c = 3 * r, h = 3 * (s - r) - c, u = 1 - c - h, l = (f) => ((o * f + i) * f + a) * f, g = (f) => ((u * f + h) * f + c) * f, m = (f) => (3 * o * f + 2 * i) * f + a, _ = (f) => {
289
+ let p = f;
290
+ for (let $ = 0; $ < 8; $++) {
291
+ const b = l(p) - f;
292
+ if (Math.abs(b) < 1e-7)
293
+ return p;
294
+ const d = m(p);
295
+ if (Math.abs(d) < 1e-7)
296
+ break;
297
+ p -= b / d;
298
+ }
299
+ let y = 0, k = 1;
300
+ for (p = f; y < k; ) {
301
+ const $ = l(p);
302
+ if (Math.abs($ - f) < 1e-7)
303
+ return p;
304
+ f > $ ? y = p : k = p, p = (y + k) / 2;
305
+ }
306
+ return p;
307
+ };
308
+ return (f) => {
309
+ if (f <= 0) return 0;
310
+ if (f >= 1) return 1;
311
+ const p = _(f);
312
+ return g(p);
313
+ };
314
+ }
315
+ function qt(t) {
316
+ return t === void 0 ? Yt : ce(t) ? xe(t.points) : ve[t];
317
+ }
318
+ const bt = 32, Se = 256, W = /* @__PURE__ */ new Map(), $e = /[MmLlHhVvCcSsQqTtAaZz]/, we = /^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/, Pe = {
319
+ M: 2,
320
+ L: 2,
321
+ H: 1,
322
+ V: 1,
323
+ C: 6,
324
+ S: 4,
325
+ Q: 4,
326
+ T: 2,
327
+ A: 7,
328
+ Z: 0
329
+ };
330
+ function Ie(t) {
331
+ const e = [];
332
+ let r = 0, n = null;
333
+ const s = () => {
334
+ for (; r < t.length && /[\s,]/.test(t[r]); ) r++;
335
+ };
336
+ for (; r < t.length && (s(), !(r >= t.length)); ) {
337
+ const a = t[r];
338
+ if ($e.test(a)) {
339
+ n = { type: a, args: [] }, e.push(n), r++;
340
+ continue;
341
+ }
342
+ if (!n) break;
343
+ const i = n.type === "A" || n.type === "a", o = n.args.length % 7;
344
+ if (i && (o === 3 || o === 4)) {
345
+ if (a !== "0" && a !== "1") break;
346
+ n.args.push(a === "1" ? 1 : 0), r++;
347
+ continue;
348
+ }
349
+ const c = we.exec(t.slice(r));
350
+ if (!c) break;
351
+ n.args.push(parseFloat(c[0])), r += c[0].length;
352
+ }
353
+ return e;
354
+ }
355
+ function Ae(t, e, r, n, s, a, i, o, c) {
356
+ if (t === o && e === c) return [];
357
+ let h = Math.abs(r), u = Math.abs(n);
358
+ if (h === 0 || u === 0) return [[t, e, o, c, o, c]];
359
+ const l = s * Math.PI / 180, g = Math.cos(l), m = Math.sin(l), _ = (t - o) / 2, f = (e - c) / 2, p = g * _ + m * f, y = -m * _ + g * f, k = p * p / (h * h) + y * y / (u * u);
360
+ if (k > 1) {
361
+ const x = Math.sqrt(k);
362
+ h *= x, u *= x;
363
+ }
364
+ const $ = a === i ? -1 : 1, b = h * h * u * u - h * h * y * y - u * u * p * p, d = h * h * y * y + u * u * p * p, T = $ * Math.sqrt(Math.max(0, b / d)), M = T * h * y / u, L = -T * u * p / h, B = g * M - m * L + (t + o) / 2, v = m * M + g * L + (e + c) / 2, A = (x, I, D, z) => {
365
+ const ot = x * D + I * z, J = Math.sqrt((x * x + I * I) * (D * D + z * z)), H = Math.acos(Math.max(-1, Math.min(1, ot / J)));
366
+ return x * z - I * D < 0 ? -H : H;
367
+ }, w = A(1, 0, (p - M) / h, (y - L) / u);
368
+ let P = A((p - M) / h, (y - L) / u, (-p - M) / h, (-y - L) / u);
369
+ !i && P > 0 && (P -= 2 * Math.PI), i && P < 0 && (P += 2 * Math.PI);
370
+ const X = Math.max(1, Math.ceil(Math.abs(P) / (Math.PI / 2))), it = P / X, G = 4 / 3 * Math.tan(it / 4), _t = (x) => {
371
+ const I = h * Math.cos(x), D = u * Math.sin(x);
372
+ return [g * I - m * D + B, m * I + g * D + v];
373
+ }, kt = (x) => {
374
+ const I = -h * Math.sin(x), D = u * Math.cos(x);
375
+ return [g * I - m * D, m * I + g * D];
376
+ }, Mt = [];
377
+ for (let x = 0; x < X; x++) {
378
+ const I = w + x * it, D = I + it, [z, ot] = _t(I), [J, H] = x === X - 1 ? [o, c] : _t(D), [se, ae] = kt(I), [ie, oe] = kt(D);
379
+ Mt.push([z + G * se, ot + G * ae, J - G * ie, H - G * oe, J, H]);
380
+ }
381
+ return Mt;
382
+ }
383
+ function O(t, e, r, n, s) {
384
+ const a = 1 - s;
385
+ return a * a * a * t + 3 * a * a * s * e + 3 * a * s * s * r + s * s * s * n;
386
+ }
387
+ function vt(t, e, r, n, s) {
388
+ const a = 1 - s;
389
+ return 3 * a * a * (e - t) + 6 * a * s * (r - e) + 3 * s * s * (n - r);
390
+ }
391
+ function Z(t, e, r, n) {
392
+ return {
393
+ subpath: 0,
394
+ type: "L",
395
+ points: [r, n],
396
+ startX: t,
397
+ startY: e,
398
+ endX: r,
399
+ endY: n,
400
+ length: Math.hypot(r - t, n - e)
401
+ };
402
+ }
403
+ function et(t, e, r) {
404
+ const [n, s, a, i, o, c] = r, h = [0];
405
+ let u = t, l = e, g = 0;
406
+ for (let m = 1; m <= bt; m++) {
407
+ const _ = m / bt, f = O(t, n, a, o, _), p = O(e, s, i, c, _);
408
+ g += Math.hypot(f - u, p - l), h.push(g), u = f, l = p;
409
+ }
410
+ return {
411
+ subpath: 0,
412
+ type: "C",
413
+ points: [n, s, a, i, o, c],
414
+ startX: t,
415
+ startY: e,
416
+ endX: o,
417
+ endY: c,
418
+ length: g,
419
+ lengths: h
420
+ };
421
+ }
422
+ function U(t) {
423
+ const e = W.get(t);
424
+ if (e) return e;
425
+ const r = [];
426
+ let n = 0, s = 0, a = 0, i = 0, o = null, c = null, h = -1;
427
+ const u = /* @__PURE__ */ new Set(), l = (f) => {
428
+ h < 0 && (h = 0), f.subpath = h, r.push(f);
429
+ };
430
+ for (const { type: f, args: p } of Ie(t)) {
431
+ const y = f.toUpperCase(), k = f !== y, $ = Pe[y];
432
+ if (y === "Z") {
433
+ (n !== a || s !== i) && l(Z(n, s, a, i)), h >= 0 && u.add(h), n = a, s = i, o = c = null;
434
+ continue;
435
+ }
436
+ for (let b = 0; b + $ <= p.length; b += $) {
437
+ const d = p.slice(b, b + $), T = k ? n : 0, M = k ? s : 0;
438
+ let L = null, B = null;
439
+ switch (y) {
440
+ case "M":
441
+ b === 0 ? (n = d[0] + T, s = d[1] + M, a = n, i = s, (h < 0 || r[r.length - 1]?.subpath === h) && h++) : (l(Z(n, s, d[0] + T, d[1] + M)), n = d[0] + T, s = d[1] + M);
442
+ break;
443
+ case "L":
444
+ l(Z(n, s, d[0] + T, d[1] + M)), n = d[0] + T, s = d[1] + M;
445
+ break;
446
+ case "H":
447
+ l(Z(n, s, d[0] + T, s)), n = d[0] + T;
448
+ break;
449
+ case "V":
450
+ l(Z(n, s, n, d[0] + M)), s = d[0] + M;
451
+ break;
452
+ case "C": {
453
+ const v = [d[0] + T, d[1] + M, d[2] + T, d[3] + M, d[4] + T, d[5] + M];
454
+ l(et(n, s, v)), L = [v[2], v[3]], n = v[4], s = v[5];
455
+ break;
456
+ }
457
+ case "S": {
458
+ const [v, A] = o ? [2 * n - o[0], 2 * s - o[1]] : [n, s], w = [v, A, d[0] + T, d[1] + M, d[2] + T, d[3] + M];
459
+ l(et(n, s, w)), L = [w[2], w[3]], n = w[4], s = w[5];
460
+ break;
461
+ }
462
+ case "Q":
463
+ case "T": {
464
+ let v = n, A = s;
465
+ y === "Q" ? (v = d[0] + T, A = d[1] + M) : c && (v = 2 * n - c[0], A = 2 * s - c[1]);
466
+ const w = y === "Q" ? d[2] + T : d[0] + T, P = y === "Q" ? d[3] + M : d[1] + M;
467
+ l(
468
+ et(n, s, [
469
+ n + 2 / 3 * (v - n),
470
+ s + 2 / 3 * (A - s),
471
+ w + 2 / 3 * (v - w),
472
+ P + 2 / 3 * (A - P),
473
+ w,
474
+ P
475
+ ])
476
+ ), B = [v, A], n = w, s = P;
477
+ break;
478
+ }
479
+ case "A": {
480
+ const v = d[5] + T, A = d[6] + M;
481
+ let w = n, P = s;
482
+ for (const X of Ae(n, s, d[0], d[1], d[2], d[3], d[4], v, A))
483
+ l(et(w, P, X)), w = X[4], P = X[5];
484
+ n = v, s = A;
485
+ break;
486
+ }
487
+ }
488
+ o = L, c = B;
489
+ }
490
+ }
491
+ const g = r.reduce((f, p) => f + p.length, 0), m = [];
492
+ for (let f = 0; f < r.length; ) {
493
+ const p = r[f].subpath;
494
+ let y = f, k = 0;
495
+ for (; y < r.length && r[y].subpath === p; ) k += r[y++].length;
496
+ const $ = r[f], b = r[y - 1], d = u.has(p) || Math.abs(b.endX - $.startX) < 1e-9 && Math.abs(b.endY - $.startY) < 1e-9;
497
+ m.push({ start: f, end: y, length: k, closed: d }), f = y;
498
+ }
499
+ const _ = { segments: r, totalLength: g, subpaths: m };
500
+ return W.size >= Se && W.delete(W.keys().next().value), W.set(t, _), _;
501
+ }
502
+ function De(t, e) {
503
+ const r = t.lengths;
504
+ if (e <= 0) return 0;
505
+ if (e >= t.length) return 1;
506
+ let n = 0, s = r.length - 1;
507
+ for (; n < s - 1; ) {
508
+ const o = n + s >> 1;
509
+ r[o] < e ? n = o : s = o;
510
+ }
511
+ const a = r[s] - r[n], i = a > 0 ? (e - r[n]) / a : 0;
512
+ return (n + i) / (r.length - 1);
513
+ }
514
+ function Re(t, e) {
515
+ if (t.type === "L") {
516
+ const l = t.length > 0 ? Math.max(0, Math.min(1, e / t.length)) : 0;
517
+ return {
518
+ x: t.startX + (t.endX - t.startX) * l,
519
+ y: t.startY + (t.endY - t.startY) * l,
520
+ angle: Math.atan2(t.endY - t.startY, t.endX - t.startX) * 180 / Math.PI
521
+ };
522
+ }
523
+ const [r, n, s, a, i, o] = t.points, c = De(t, e);
524
+ let h = vt(t.startX, r, s, i, c), u = vt(t.startY, n, a, o, c);
525
+ if (Math.hypot(h, u) < 1e-9) {
526
+ const l = c < 0.5 ? Math.min(1, c + 1e-3) : Math.max(0, c - 1e-3), g = O(t.startX, r, s, i, l), m = O(t.startY, n, a, o, l), _ = O(t.startX, r, s, i, c), f = O(t.startY, n, a, o, c);
527
+ h = c < 0.5 ? g - _ : _ - g, u = c < 0.5 ? m - f : f - m;
528
+ }
529
+ return {
530
+ x: O(t.startX, r, s, i, c),
531
+ y: O(t.startY, n, a, o, c),
532
+ angle: Math.atan2(u, h) * 180 / Math.PI
533
+ };
534
+ }
535
+ function Ut(t, e, r = 0, n = t.length) {
536
+ if (n <= r) return { x: 0, y: 0, angle: 0 };
537
+ let s = 0;
538
+ for (let a = r; a < n; a++) {
539
+ const i = t[a];
540
+ if (s + i.length >= e || a === n - 1)
541
+ return Re(i, e - s);
542
+ s += i.length;
543
+ }
544
+ return { x: 0, y: 0, angle: 0 };
545
+ }
546
+ function Ce(t, e) {
547
+ const { segments: r, totalLength: n } = U(t);
548
+ return Ut(r, Math.max(0, Math.min(1, e)) * n);
549
+ }
550
+ function Sr() {
551
+ W.clear();
552
+ }
553
+ function $r(t) {
554
+ return U(t).totalLength;
555
+ }
556
+ const Fe = 24, Le = 320, Ee = 2.5, j = 72, wr = 64, Oe = 128, q = /* @__PURE__ */ new Map(), xt = (t) => Math.round(t * 100) / 100;
557
+ function St(t, e) {
558
+ const { segments: r, subpaths: n, totalLength: s } = U(t);
559
+ if (r.length === 0) return [];
560
+ if (e) {
561
+ const a = n.every((i) => i.closed);
562
+ return [{ segments: r, start: 0, end: r.length, length: s, closed: a }];
563
+ }
564
+ return n.filter((a) => a.length > 0).map((a) => ({ segments: r, start: a.start, end: a.end, length: a.length, closed: a.closed }));
565
+ }
566
+ function pt(t, e) {
567
+ const r = t.closed ? (e % 1 + 1) % 1 : Math.max(0, Math.min(1, e)), n = Ut(t.segments, r * t.length, t.start, t.end);
568
+ return [n.x, n.y];
569
+ }
570
+ function $t(t) {
571
+ const e = [];
572
+ let r = 0;
573
+ for (let n = t.start; n < t.end; n++)
574
+ r += t.segments[n].length, t.length > 0 && e.push(r / t.length);
575
+ return e;
576
+ }
577
+ function wt(t, e) {
578
+ const r = [];
579
+ for (let n = 0; n < e; n++)
580
+ r.push(pt(t, t.closed ? n / e : n / (e - 1)));
581
+ return r;
582
+ }
583
+ function Pt(t) {
584
+ let e = 0, r = 0;
585
+ for (const [n, s] of t)
586
+ e += n, r += s;
587
+ return e /= t.length, r /= t.length, t.map(([n, s]) => [n - e, s - r]);
588
+ }
589
+ function Xe(t, e, r) {
590
+ const n = t.closed && e.closed;
591
+ if (r !== void 0)
592
+ return { offset: n ? Math.abs(r) % j / j : 0, reversed: r < 0 };
593
+ const s = Pt(wt(t, j)), a = Pt(wt(e, j)), i = j;
594
+ let o = { offset: 0, reversed: !1 }, c = 1 / 0;
595
+ for (const h of [!1, !0]) {
596
+ const u = n ? i : 1;
597
+ for (let l = 0; l < u; l++) {
598
+ let g = 0;
599
+ for (let m = 0; m < i && g < c; m++) {
600
+ const _ = n ? h ? (l - m + i) % i : (m + l) % i : h ? i - 1 - m : m, f = s[m][0] - a[_][0], p = s[m][1] - a[_][1];
601
+ g += f * f + p * p;
602
+ }
603
+ g < c && (c = g, o = { offset: n ? l / i : 0, reversed: h });
604
+ }
605
+ }
606
+ return o;
607
+ }
608
+ function Ne(t, e, r) {
609
+ return r ? ((e.reversed ? e.offset - t : t + e.offset) % 1 + 1) % 1 : e.reversed ? 1 - t : t;
610
+ }
611
+ function Ye(t, e, r) {
612
+ return r ? ((e.reversed ? e.offset - t : t - e.offset) % 1 + 1) % 1 : e.reversed ? 1 - t : t;
613
+ }
614
+ function Ve(t, e, r) {
615
+ const n = t.closed && e.closed, s = Xe(t, e, r.shapeIndex), a = Math.max(
616
+ Fe,
617
+ Math.min(Le, Math.ceil(Math.max(t.length, e.length) / Ee))
618
+ ), i = /* @__PURE__ */ new Set(), o = (l) => i.add(Math.round(l * 1e7) / 1e7);
619
+ for (let l = 0; l <= a; l++) o(l / a);
620
+ for (const l of $t(t)) o(l);
621
+ for (const l of $t(e)) o(Ye(l, s, n));
622
+ let c = [...i].sort((l, g) => l - g);
623
+ n && (c = c.filter((l) => l < 1));
624
+ const h = [], u = [];
625
+ for (const l of c)
626
+ h.push(...pt(t, l)), u.push(...pt(e, Ne(l, s, n)));
627
+ return { from: h, to: u, closed: n };
628
+ }
629
+ function ze(t, e, r) {
630
+ const n = `${r.shapeIndex ?? "auto"}|${t}|${e}`, s = q.get(n);
631
+ if (s) return s;
632
+ const a = U(t).subpaths.filter((h) => h.length > 0).length === U(e).subpaths.filter((h) => h.length > 0).length, i = St(t, !a), o = St(e, !a), c = {
633
+ pairs: i.map((h, u) => Ve(h, o[u], r))
634
+ };
635
+ return q.size >= Oe && q.delete(q.keys().next().value), q.set(n, c), c;
636
+ }
637
+ function We(t, e, r, n = {}) {
638
+ if (!t) return e;
639
+ if (!e) return t;
640
+ const s = Math.max(0, Math.min(1, r));
641
+ if (s === 0) return t;
642
+ if (s === 1) return e;
643
+ const a = ze(t, e, n);
644
+ if (a.pairs.length === 0) return s < 0.5 ? t : e;
645
+ let i = "";
646
+ for (const o of a.pairs) {
647
+ for (let c = 0; c < o.from.length; c += 2) {
648
+ const h = xt(o.from[c] + (o.to[c] - o.from[c]) * s), u = xt(o.from[c + 1] + (o.to[c + 1] - o.from[c + 1]) * s);
649
+ i += `${c === 0 ? i ? " M" : "M" : " L"}${h} ${u}`;
650
+ }
651
+ o.closed && (i += " Z");
652
+ }
653
+ return i;
654
+ }
655
+ function Pr() {
656
+ q.clear();
657
+ }
658
+ function qe(t) {
659
+ return /^\s*[Mm]\s*[-+]?(?:\d|\.\d)/.test(t);
660
+ }
661
+ const E = (t, e, r) => t + (e - t) * r, Qt = 512, ct = /* @__PURE__ */ new Map(), ht = /* @__PURE__ */ new Map();
662
+ function It(t) {
663
+ const e = ct.get(t);
664
+ if (e) return e;
665
+ const r = t.replace("#", ""), n = [
666
+ parseInt(r.slice(0, 2), 16),
667
+ parseInt(r.slice(2, 4), 16),
668
+ parseInt(r.slice(4, 6), 16)
669
+ ];
670
+ return ct.size < Qt && ct.set(t, n), n;
671
+ }
672
+ const At = (t) => t.charCodeAt(0) === 35, Dt = (t) => t.startsWith("rgb"), Rt = (t) => t.startsWith("rgba"), Ue = /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/, ut = (t) => Math.round(t).toString(16).padStart(2, "0");
673
+ function Qe(t, e, r) {
674
+ return `#${ut(t)}${ut(e)}${ut(r)}`;
675
+ }
676
+ function Ct(t) {
677
+ const e = ht.get(t);
678
+ if (e) return e;
679
+ const r = t.match(Ue);
680
+ if (!r)
681
+ throw new Error(`Invalid rgb color: ${t}`);
682
+ const n = parseInt(r[1], 10), s = parseInt(r[2], 10), a = parseInt(r[3], 10), i = r[4] !== void 0 ? [n, s, a, parseFloat(r[4])] : [n, s, a];
683
+ return ht.size < Qt && ht.set(t, i), i;
684
+ }
685
+ const He = (t, e, r) => {
686
+ if (At(t) && At(e)) {
687
+ const [n, s, a] = It(t), [i, o, c] = It(e), h = E(n, i, r), u = E(s, o, r), l = E(a, c, r);
688
+ return Qe(h, u, l);
689
+ }
690
+ if ((Dt(t) || Rt(t)) && (Dt(e) || Rt(e))) {
691
+ const n = Ct(t), s = Ct(e), a = Math.round(E(n[0], s[0], r)), i = Math.round(E(n[1], s[1], r)), o = Math.round(E(n[2], s[2], r));
692
+ if (n.length === 4 || s.length === 4) {
693
+ const c = n[3] ?? 1, h = s[3] ?? 1, u = E(c, h, r);
694
+ return `rgba(${a}, ${i}, ${o}, ${u})`;
695
+ }
696
+ return `rgb(${a}, ${i}, ${o})`;
697
+ }
698
+ return r < 1 ? t : e;
699
+ }, Ze = (t, e, r) => {
700
+ const n = Math.min(t.length, e.length), s = [];
701
+ for (let a = 0; a < n; a++)
702
+ s.push(E(t[a], e[a], r));
703
+ return s;
704
+ }, Ft = (t, e, r) => r < 1 ? t : e, je = (t, e, r) => We(t, e, r);
705
+ function Ht(t) {
706
+ return typeof t == "number" ? E : Array.isArray(t) ? Ze : typeof t == "string" ? t.startsWith("#") || t.startsWith("rgb") ? He : qe(t) ? je : Ft : Ft;
707
+ }
708
+ const Zt = 1e3 / 60;
709
+ function jt(t, e = {}) {
710
+ if (!V(t))
711
+ throw new Error(`bakeSpringTrack: track "${t.id}" is not a spring track`);
712
+ const r = new rt(t.spring);
713
+ return Bt(t, (n) => r.valueAt(n), r.settleTime(), t.spring.from, t.spring.to, e);
714
+ }
715
+ function Kt(t, e = {}) {
716
+ if (!Y(t))
717
+ throw new Error(`bakeInertiaTrack: track "${t.id}" is not an inertia track`);
718
+ const r = t.inertia;
719
+ return Bt(
720
+ t,
721
+ (n) => mt(r, n),
722
+ at(r),
723
+ r.from,
724
+ st(r),
725
+ e
726
+ );
727
+ }
728
+ function Bt(t, e, r, n, s, a) {
729
+ const i = a.intervalMs ?? Zt, o = a.tolerance ?? 0.01, c = t.delay ?? 0, h = [];
730
+ for (let l = 0; l <= r; l += i)
731
+ h.push({ time: l + c, value: e(l), easing: "linear" });
732
+ const u = h[h.length - 1];
733
+ return !u || u.time < r + c ? h.push({ time: r + c, value: s, easing: "linear" }) : u.value = s, c > 0 && h.unshift({ time: 0, value: n, easing: "linear" }), {
734
+ id: t.id,
735
+ target: t.target,
736
+ property: t.property,
737
+ keyframes: o > 0 ? Ke(h, o) : h,
738
+ ...t.targets && { targets: [...t.targets] },
739
+ ...t.stagger && { stagger: { ...t.stagger } }
740
+ };
741
+ }
742
+ function Ir(t, e, r, n = {}) {
743
+ const s = n.intervalMs ?? Zt, a = typeof r == "function" ? r : qt(r), i = Ht(t.value), o = e.time - t.time;
744
+ if (o <= 0) return [e];
745
+ const c = [];
746
+ for (let u = s; u < o; u += s) {
747
+ const l = u / o;
748
+ c.push({
749
+ time: t.time + u,
750
+ value: i(t.value, e.value, a(l)),
751
+ easing: "linear"
752
+ });
753
+ }
754
+ const h = a(1);
755
+ return c.push({ ...e, ...h !== 1 && { value: i(t.value, e.value, h) }, easing: "linear" }), c;
756
+ }
757
+ function Ar(t, e) {
758
+ return V(t) ? jt(t, e) : Y(t) ? Kt(t, e) : t;
759
+ }
760
+ function Dr(t, e) {
761
+ return t.filter(he).concat(
762
+ t.filter(V).map((r) => jt(r, e)),
763
+ t.filter(Y).map((r) => Kt(r, e))
764
+ );
765
+ }
766
+ function Ke(t, e) {
767
+ if (t.length <= 2) return t;
768
+ const r = [t[0]];
769
+ for (let n = 1; n < t.length - 1; n++) {
770
+ const s = r[r.length - 1], a = t[n], i = t[n + 1], o = i.time - s.time;
771
+ if (o <= 0) continue;
772
+ const c = (a.time - s.time) / o, h = s.value + (i.value - s.value) * c;
773
+ Math.abs(a.value - h) > e && r.push(a);
774
+ }
775
+ return r.push(t[t.length - 1]), r;
776
+ }
777
+ function Be(t) {
778
+ const e = [...t.keyframes].sort((r, n) => r.time - n.time);
779
+ return {
780
+ ...t,
781
+ keyframes: e
782
+ };
783
+ }
784
+ function N(t) {
785
+ return t.targets && t.targets.length > 0 ? t.targets : [t.target];
786
+ }
787
+ function Q(t, e, r, n) {
788
+ const s = r ?? 0;
789
+ return !n || e <= 1 ? s : s + Xt(t, e, n);
790
+ }
791
+ class lt {
792
+ track;
793
+ targets;
794
+ constructor(e) {
795
+ this.track = e, this.targets = N(e);
796
+ }
797
+ /**
798
+ * Get the interpolated value at a specific time.
799
+ *
800
+ * For a multi-target track this returns the *first* target's value; callers
801
+ * that need every target should use `getTargetValues`.
802
+ */
803
+ getValueAtTime(e) {
804
+ return this.valueForOffset(e - Q(0, this.targets.length, this.track.delay, this.track.stagger));
805
+ }
806
+ /**
807
+ * Every target's value at a specific time, in target order.
808
+ *
809
+ * Single-target tracks yield one entry; staggered tracks yield one per target,
810
+ * each sampled at its own offset time.
811
+ */
812
+ getTargetValues(e) {
813
+ const r = this.targets.length, n = [];
814
+ for (let s = 0; s < r; s++) {
815
+ const a = Q(s, r, this.track.delay, this.track.stagger), i = this.valueForOffset(e - a);
816
+ i !== void 0 && n.push({ target: this.targets[s], value: i, start: a + this.track.keyframes[0].time });
817
+ }
818
+ return n;
819
+ }
820
+ /**
821
+ * Get the duration of this track — the last keyframe, plus any delay, the
822
+ * widest stagger offset, and any trailing hold.
823
+ */
824
+ getDuration() {
825
+ const { keyframes: e } = this.track;
826
+ if (e.length === 0)
827
+ return 0;
828
+ const r = e[e.length - 1].time, n = this.track.stagger ? yt(this.targets.length, this.track.stagger) : 0;
829
+ return r + (this.track.delay ?? 0) + n + (this.track.endDelay ?? 0);
830
+ }
831
+ /**
832
+ * Get the track metadata.
833
+ */
834
+ getTrack() {
835
+ return this.track;
836
+ }
837
+ /** Interpolated value at a time already shifted into the track's own frame. */
838
+ valueForOffset(e) {
839
+ const { keyframes: r } = this.track;
840
+ if (r.length === 0)
841
+ return;
842
+ if (r.length === 1 || e <= r[0].time)
843
+ return r[0].value;
844
+ if (e >= r[r.length - 1].time)
845
+ return r[r.length - 1].value;
846
+ const { from: n, to: s } = this.findSurroundingKeyframes(e);
847
+ if (!n || !s)
848
+ return;
849
+ if (n.time === e)
850
+ return n.value;
851
+ const a = s.time - n.time, i = (e - n.time) / a, o = qt(s.easing)(i);
852
+ return Ht(n.value)(n.value, s.value, o);
853
+ }
854
+ /**
855
+ * Find the keyframes surrounding a given time.
856
+ */
857
+ findSurroundingKeyframes(e) {
858
+ const { keyframes: r } = this.track;
859
+ for (let n = 0; n < r.length - 1; n++)
860
+ if (e >= r[n].time && e <= r[n + 1].time)
861
+ return { from: r[n], to: r[n + 1] };
862
+ return { from: null, to: null };
863
+ }
864
+ }
865
+ class Ge {
866
+ track;
867
+ targets;
868
+ sampler;
869
+ constructor(e) {
870
+ this.track = e, this.targets = N(e), this.sampler = new rt(e.spring);
871
+ }
872
+ getValueAtTime(e) {
873
+ return this.sampler.valueAt(e - Q(0, this.targets.length, this.track.delay, this.track.stagger));
874
+ }
875
+ getTargetValues(e) {
876
+ const r = this.targets.length, n = [];
877
+ for (let s = 0; s < r; s++) {
878
+ const a = Q(s, r, this.track.delay, this.track.stagger);
879
+ n.push({ target: this.targets[s], value: this.sampler.valueAt(e - a), start: a });
880
+ }
881
+ return n;
882
+ }
883
+ /** Settle time plus delay and the widest stagger offset. */
884
+ getDuration() {
885
+ const e = this.track.stagger ? yt(this.targets.length, this.track.stagger) : 0;
886
+ return this.sampler.settleTime() + (this.track.delay ?? 0) + e;
887
+ }
888
+ getTrack() {
889
+ return this.track;
890
+ }
891
+ }
892
+ class Je {
893
+ track;
894
+ targets;
895
+ duration;
896
+ constructor(e) {
897
+ this.track = e, this.targets = N(e), this.duration = at(e.inertia);
898
+ }
899
+ getValueAtTime(e) {
900
+ return mt(this.track.inertia, e - Q(0, this.targets.length, this.track.delay, this.track.stagger));
901
+ }
902
+ getTargetValues(e) {
903
+ const r = this.targets.length, n = [];
904
+ for (let s = 0; s < r; s++) {
905
+ const a = Q(s, r, this.track.delay, this.track.stagger);
906
+ n.push({ target: this.targets[s], value: mt(this.track.inertia, e - a), start: a });
907
+ }
908
+ return n;
909
+ }
910
+ /** Settle time plus delay and the widest stagger offset. */
911
+ getDuration() {
912
+ const e = this.track.stagger ? yt(this.targets.length, this.track.stagger) : 0;
913
+ return this.duration + (this.track.delay ?? 0) + e;
914
+ }
915
+ getTrack() {
916
+ return this.track;
917
+ }
918
+ }
919
+ function Gt(t, e) {
920
+ const r = { ...Ce(t.pathData, e) };
921
+ if (t.matrix) {
922
+ const [n, s, a, i, o, c] = t.matrix, { x: h, y: u } = r;
923
+ r.x = n * h + a * u + o, r.y = s * h + i * u + c;
924
+ const l = r.angle * Math.PI / 180, g = Math.cos(l), m = Math.sin(l);
925
+ r.angle = Math.atan2(s * g + i * m, n * g + a * m) * 180 / Math.PI;
926
+ }
927
+ return t.autoRotate && t.rotateOffset && (r.angle += t.rotateOffset), r;
928
+ }
929
+ function Rr(t, e, r, n) {
930
+ const s = e + (r - e) * n;
931
+ return Gt(t, s);
932
+ }
933
+ const ft = {
934
+ upperCase: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
935
+ lowerCase: "abcdefghijklmnopqrstuvwxyz",
936
+ upperAndLowerCase: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
937
+ numbers: "0123456789"
938
+ }, tr = 20;
939
+ function er(t) {
940
+ const e = ft[t ?? "upperCase"] ?? t ?? ft.upperCase, r = Array.from(e);
941
+ return r.length > 0 ? r : Array.from(ft.upperCase);
942
+ }
943
+ function rr(t, e, r) {
944
+ let n = (t | 0) ^ Math.imul(e + 1, 2654435761) ^ Math.imul(r + 1, 2246822507);
945
+ return n = Math.imul(n ^ n >>> 16, 2146121005), n = Math.imul(n ^ n >>> 15, 2221713035), (n ^ n >>> 16) >>> 0;
946
+ }
947
+ function nr(t, e, r = 0) {
948
+ const n = t.from ?? "", s = t.to, a = Math.max(0, Math.min(1, e));
949
+ if (a <= 0) return n;
950
+ if (a >= 1) return s;
951
+ const i = Array.from(n), o = Array.from(s), c = t.rightToLeft ?? !1;
952
+ if (t.mode === "type") {
953
+ const k = Math.round(a * Math.max(i.length, o.length));
954
+ return c ? i.slice(0, Math.max(0, i.length - k)).join("") + o.slice(Math.max(0, o.length - k)).join("") : o.slice(0, k).join("") + i.slice(k).join("");
955
+ }
956
+ const h = Math.max(0, Math.min(0.999, t.revealDelay ?? 0)), u = Math.max(0, (a - h) / (1 - h)), l = Math.floor(u * o.length), g = t.tweenLength === !1 ? o.length : Math.round(i.length + (o.length - i.length) * a), m = er(t.chars), _ = t.refreshRate ?? tr, f = _ > 0 ? Math.floor(r * _ / 1e3) : 0, p = t.seed ?? 1;
957
+ let y = "";
958
+ for (let k = 0; k < g; k++) {
959
+ const $ = c ? k >= g - l : k < l, b = c ? o[o.length - (g - k)] : o[k];
960
+ $ && b !== void 0 || b === " " || b === `
961
+ ` ? y += b : y += m[rr(p, k, f) % m.length];
962
+ }
963
+ return y;
964
+ }
965
+ class sr {
966
+ id;
967
+ name;
968
+ _tracks = [];
969
+ _trackPlayers = /* @__PURE__ */ new Map();
970
+ _motionPathTracks = /* @__PURE__ */ new Map();
971
+ _springTracks = /* @__PURE__ */ new Map();
972
+ _textTracks = /* @__PURE__ */ new Map();
973
+ _config;
974
+ _currentTime = 0;
975
+ _playbackState = "idle";
976
+ _direction = "forward";
977
+ _loopIteration = 0;
978
+ _explicitDuration;
979
+ /** Milliseconds still to wait at a loop boundary before the next iteration */
980
+ _repeatDelayRemaining = 0;
981
+ /**
982
+ * A forward loop reached its end with a repeat delay armed: the playhead
983
+ * holds on the last frame for the delay, then returns to the start.
984
+ */
985
+ _wrapAfterDelay = !1;
986
+ onUpdate = null;
987
+ onComplete = null;
988
+ constructor(e) {
989
+ if (this.id = e.id, this.name = e.name, this._config = e.config ?? {}, this._explicitDuration = e.config?.duration, e.tracks)
990
+ for (const r of e.tracks)
991
+ this.addTrack(r);
992
+ }
993
+ get tracks() {
994
+ return [...this._tracks];
995
+ }
996
+ get duration() {
997
+ return this._explicitDuration !== void 0 ? this._explicitDuration : this._calculateDuration();
998
+ }
999
+ /**
1000
+ * Set an explicit timeline duration (ms). Pass `undefined` to fall back to the
1001
+ * duration calculated from the last keyframe across all tracks.
1002
+ */
1003
+ setDuration(e) {
1004
+ this._explicitDuration = e, e !== void 0 && (this._config = { ...this._config, duration: e });
1005
+ }
1006
+ get currentTime() {
1007
+ return this._currentTime;
1008
+ }
1009
+ get playbackState() {
1010
+ return this._playbackState;
1011
+ }
1012
+ get direction() {
1013
+ return this._direction;
1014
+ }
1015
+ get loopIteration() {
1016
+ return this._loopIteration;
1017
+ }
1018
+ get speed() {
1019
+ return this._config.speed ?? 1;
1020
+ }
1021
+ set speed(e) {
1022
+ this._config.speed = e;
1023
+ }
1024
+ /**
1025
+ * Start or resume playback.
1026
+ * If at the end and direction is forward, reset to beginning.
1027
+ * If at the beginning and direction is reverse, reset to end.
1028
+ */
1029
+ play() {
1030
+ const e = this.duration;
1031
+ this._direction === "forward" && this._currentTime >= e && e > 0 ? (this._currentTime = 0, this._loopIteration = 0) : this._direction === "reverse" && this._currentTime <= 0 && e > 0 && (this._currentTime = e, this._loopIteration = 0), this._playbackState = "playing";
1032
+ }
1033
+ /**
1034
+ * Pause playback at current position.
1035
+ */
1036
+ pause() {
1037
+ this._playbackState = "paused";
1038
+ }
1039
+ /**
1040
+ * Stop playback and reset to beginning.
1041
+ */
1042
+ stop() {
1043
+ this._playbackState = "idle", this._repeatDelayRemaining = 0, this._wrapAfterDelay = !1, this._currentTime = 0, this._loopIteration = 0, this._direction = "forward";
1044
+ }
1045
+ /**
1046
+ * Seek to a specific time.
1047
+ */
1048
+ seek(e) {
1049
+ const r = this.duration > 0 ? this.duration : 1 / 0;
1050
+ this._currentTime = Math.max(0, Math.min(e, r)), this._repeatDelayRemaining = 0, this._wrapAfterDelay = !1;
1051
+ }
1052
+ /**
1053
+ * Toggle or set playback direction.
1054
+ */
1055
+ reverse() {
1056
+ this._direction = this._direction === "forward" ? "reverse" : "forward";
1057
+ }
1058
+ /**
1059
+ * Advance the timeline by delta milliseconds.
1060
+ * Call this from your animation loop or clock.
1061
+ */
1062
+ tick(e) {
1063
+ if (this._playbackState !== "playing")
1064
+ return;
1065
+ const r = this.duration;
1066
+ if (r <= 0)
1067
+ return;
1068
+ let n = e * this.speed;
1069
+ if (this._repeatDelayRemaining > 0) {
1070
+ const i = Math.min(this._repeatDelayRemaining, n);
1071
+ if (this._repeatDelayRemaining -= i, n -= i, this._repeatDelayRemaining > 0) {
1072
+ this.onUpdate?.(this.getStateAtTime(this._currentTime));
1073
+ return;
1074
+ }
1075
+ this._wrapAfterDelay && (this._wrapAfterDelay = !1, this._currentTime = 0);
1076
+ }
1077
+ const s = 1e3;
1078
+ for (let i = 0; i < s && n > 0 && this._playbackState === "playing"; i++)
1079
+ if (this._direction === "forward") {
1080
+ const o = r - this._currentTime;
1081
+ if (n >= o) {
1082
+ if (n -= o, this._currentTime = r, !this._handleEndReached())
1083
+ break;
1084
+ } else
1085
+ this._currentTime += n, n = 0;
1086
+ } else {
1087
+ const o = this._currentTime;
1088
+ if (n >= o) {
1089
+ if (n -= o, this._currentTime = 0, !this._handleStartReached())
1090
+ break;
1091
+ } else
1092
+ this._currentTime -= n, n = 0;
1093
+ }
1094
+ const a = this.getStateAtTime(this._currentTime);
1095
+ this.onUpdate?.(a);
1096
+ }
1097
+ /**
1098
+ * Get the animation state at a specific time.
1099
+ */
1100
+ getStateAtTime(e) {
1101
+ const r = /* @__PURE__ */ new Map();
1102
+ if (this._hasSharedWrites())
1103
+ this._resolveShared(e, r);
1104
+ else
1105
+ for (const [n, s] of this._trackPlayers) {
1106
+ const a = s.getTrack().property;
1107
+ for (const { target: i, value: o, start: c } of s.getTargetValues(e))
1108
+ this._write(r, n, i, a, o, e - c);
1109
+ }
1110
+ return {
1111
+ values: r,
1112
+ currentTime: this._currentTime,
1113
+ playbackState: this._playbackState,
1114
+ direction: this._direction,
1115
+ loopIteration: this._loopIteration
1116
+ };
1117
+ }
1118
+ /**
1119
+ * Several tracks drive the same target+property. Which one applies at `time`:
1120
+ *
1121
+ * 1. Of the tracks that have started (their first keyframe, plus delay and
1122
+ * stagger, is at or before `time`), the one that started LAST.
1123
+ * 2. If none has started yet, the one that starts FIRST — so the value before
1124
+ * anything plays is the first animation's starting value.
1125
+ * 3. Ties on start time go to the track added LAST.
1126
+ *
1127
+ * This is what makes a sequence of tweens on one property play as a sequence:
1128
+ * a later tween holds its starting value, but does not apply it until its
1129
+ * turn. `findConflicts()` reports overlaps by the same rule.
1130
+ */
1131
+ _resolveShared(e, r) {
1132
+ const n = /* @__PURE__ */ new Map();
1133
+ for (const [s, a] of this._trackPlayers) {
1134
+ const i = a.getTrack().property;
1135
+ for (const { target: o, value: c, start: h } of a.getTargetValues(e)) {
1136
+ const u = `${o}\0${i}`, l = h <= e, g = n.get(u);
1137
+ (!g || (l !== g.started ? l : l ? h >= g.start : h <= g.start)) && n.set(u, { trackId: s, target: o, property: i, value: c, start: h, started: l });
1138
+ }
1139
+ }
1140
+ for (const { trackId: s, target: a, property: i, value: o, start: c } of n.values())
1141
+ this._write(r, s, a, i, o, e - c);
1142
+ }
1143
+ /**
1144
+ * Write one track's value for a target, expanding the progress of motion paths
1145
+ * (into x/y/rotation) and text tracks (into the string). `elapsed` is the time
1146
+ * since this target's animation on the track started.
1147
+ */
1148
+ _write(e, r, n, s, a, i) {
1149
+ if (a === void 0) return;
1150
+ let o = e.get(n);
1151
+ o || (o = /* @__PURE__ */ new Map(), e.set(n, o));
1152
+ const c = this._textTracks.get(r);
1153
+ if (c && typeof a == "number") {
1154
+ o.set("text", nr(c.textConfig, a, Math.max(0, i)));
1155
+ return;
1156
+ }
1157
+ const h = this._motionPathTracks.get(r);
1158
+ if (h && typeof a == "number") {
1159
+ const u = Gt(h.motionPathConfig, a);
1160
+ o.set("motionPathX", u.x), o.set("motionPathY", u.y), h.motionPathConfig.autoRotate && o.set("motionPathRotate", u.angle);
1161
+ } else
1162
+ o.set(s, a);
1163
+ }
1164
+ /** Cached: does any target+property have more than one track? */
1165
+ _sharedWrites = null;
1166
+ _hasSharedWrites() {
1167
+ if (this._sharedWrites === null) {
1168
+ const e = /* @__PURE__ */ new Set();
1169
+ this._sharedWrites = !1;
1170
+ t: for (const r of this._tracks)
1171
+ for (const n of N(r)) {
1172
+ const s = `${n}\0${r.property}`;
1173
+ if (e.has(s)) {
1174
+ this._sharedWrites = !0;
1175
+ break t;
1176
+ }
1177
+ e.add(s);
1178
+ }
1179
+ }
1180
+ return this._sharedWrites;
1181
+ }
1182
+ /**
1183
+ * Add a track to the timeline.
1184
+ */
1185
+ addTrack(e) {
1186
+ if (this._tracks.push(e), this._sharedWrites = null, Y(e)) {
1187
+ this._trackPlayers.set(e.id, new Je(e));
1188
+ return;
1189
+ }
1190
+ if (V(e)) {
1191
+ this._trackPlayers.set(e.id, new Ge(e)), this._springTracks.set(e.id, e);
1192
+ return;
1193
+ }
1194
+ if (dt(e))
1195
+ this._trackPlayers.set(e.id, new lt(e)), this._textTracks.set(e.id, e);
1196
+ else if (Et(e)) {
1197
+ const r = {
1198
+ id: e.id,
1199
+ target: e.target,
1200
+ property: e.property,
1201
+ keyframes: e.keyframes,
1202
+ delay: e.delay,
1203
+ endDelay: e.endDelay,
1204
+ targets: e.targets,
1205
+ stagger: e.stagger
1206
+ };
1207
+ this._trackPlayers.set(e.id, new lt(r)), this._motionPathTracks.set(e.id, e);
1208
+ } else
1209
+ this._trackPlayers.set(e.id, new lt(e));
1210
+ }
1211
+ /**
1212
+ * Replace a track with a new version, keeping its place in the track order
1213
+ * (which decides ties when tracks overlap). The new track may have a
1214
+ * different id. Does nothing if no track has `trackId`.
1215
+ */
1216
+ replaceTrack(e, r) {
1217
+ const n = this._tracks.findIndex((a) => a.id === e);
1218
+ if (n < 0) return;
1219
+ const s = this._tracks.slice(n + 1);
1220
+ this.removeTrack(e);
1221
+ for (const a of s) this.removeTrack(a.id);
1222
+ this.addTrack(r);
1223
+ for (const a of s) this.addTrack(a);
1224
+ }
1225
+ /**
1226
+ * Remove a track by its ID.
1227
+ */
1228
+ removeTrack(e) {
1229
+ this._tracks = this._tracks.filter((r) => r.id !== e), this._sharedWrites = null, this._trackPlayers.delete(e), this._motionPathTracks.delete(e), this._springTracks.delete(e), this._textTracks.delete(e);
1230
+ }
1231
+ /**
1232
+ * Tracks matching a filter. All provided fields must match (AND).
1233
+ *
1234
+ * This is the closest principled equivalent to GSAP's per-tween handle: we
1235
+ * have no live tween objects to hold, so a "tween" is addressed by describing
1236
+ * the tracks it produced.
1237
+ */
1238
+ getTracks(e = {}) {
1239
+ return this._tracks.filter((r) => this._matches(r, e));
1240
+ }
1241
+ /**
1242
+ * Remove every track matching a filter. Returns the ids removed.
1243
+ *
1244
+ * `timeline.removeTracks({ target: 'box' })` is the equivalent of killing all
1245
+ * tweens on an element.
1246
+ */
1247
+ removeTracks(e = {}) {
1248
+ const r = this.getTracks(e).map((n) => n.id);
1249
+ for (const n of r)
1250
+ this.removeTrack(n);
1251
+ return r;
1252
+ }
1253
+ /**
1254
+ * The time span a track is active over: [start, end] in milliseconds.
1255
+ */
1256
+ getTrackSpan(e) {
1257
+ const r = this._trackPlayers.get(e);
1258
+ if (!r) return;
1259
+ const n = r.getTrack(), s = n.delay ?? 0;
1260
+ if (V(n) || Y(n))
1261
+ return { from: s, to: r.getDuration() };
1262
+ const a = n.keyframes;
1263
+ if (!(!a || a.length === 0))
1264
+ return { from: a[0].time + s, to: r.getDuration() };
1265
+ }
1266
+ /**
1267
+ * Overlapping writes to the same target+property.
1268
+ *
1269
+ * Where two spans overlap, the track that starts later wins from the moment it
1270
+ * starts (ties: the one added later) — see `_resolveShared`. That is
1271
+ * predictable but silent, so an authoring tool should call this and warn,
1272
+ * because a silently discarded stretch of a track looks like a bug.
1273
+ */
1274
+ findConflicts() {
1275
+ const e = [];
1276
+ for (let r = 0; r < this._tracks.length; r++) {
1277
+ const n = this._tracks[r], s = this.getTrackSpan(n.id);
1278
+ if (s)
1279
+ for (let a = 0; a < r; a++) {
1280
+ const i = this._tracks[a];
1281
+ if (i.property !== n.property) continue;
1282
+ const o = N(i).filter((u) => N(n).includes(u));
1283
+ if (o.length === 0) continue;
1284
+ const c = this.getTrackSpan(i.id);
1285
+ if (!c || !(c.from <= s.to && s.from <= c.to)) continue;
1286
+ const h = s.from >= c.from;
1287
+ for (const u of o)
1288
+ e.push({
1289
+ target: u,
1290
+ property: n.property,
1291
+ losingTrackId: h ? i.id : n.id,
1292
+ winningTrackId: h ? n.id : i.id
1293
+ });
1294
+ }
1295
+ }
1296
+ return e;
1297
+ }
1298
+ _matches(e, r) {
1299
+ if (r.id !== void 0 && e.id !== r.id || r.property !== void 0 && e.property !== r.property || r.target !== void 0 && !N(e).includes(r.target)) return !1;
1300
+ if (r.timeRange) {
1301
+ const n = this.getTrackSpan(e.id);
1302
+ if (!n || n.to < r.timeRange.from || n.from > r.timeRange.to) return !1;
1303
+ }
1304
+ return !0;
1305
+ }
1306
+ /**
1307
+ * Export timeline as a serializable definition.
1308
+ */
1309
+ toDefinition() {
1310
+ return {
1311
+ id: this.id,
1312
+ name: this.name,
1313
+ config: { ...this._config },
1314
+ tracks: [...this._tracks]
1315
+ };
1316
+ }
1317
+ /** Start the between-iterations pause, if the timeline configures one. */
1318
+ _armRepeatDelay() {
1319
+ this._repeatDelayRemaining = this._config.repeatDelay ?? 0;
1320
+ }
1321
+ _calculateDuration() {
1322
+ let e = 0;
1323
+ for (const [, r] of this._trackPlayers)
1324
+ e = Math.max(e, r.getDuration());
1325
+ return e;
1326
+ }
1327
+ /**
1328
+ * Handle reaching the end of the timeline.
1329
+ * Returns true if we looped and should continue, false if we stopped.
1330
+ */
1331
+ _handleEndReached() {
1332
+ const e = this._config.loop ?? 0;
1333
+ return e === -1 || this._loopIteration < e ? (this._loopIteration++, this._armRepeatDelay(), this._config.alternate ? this._direction = "reverse" : this._repeatDelayRemaining > 0 ? this._wrapAfterDelay = !0 : this._currentTime = 0, this._repeatDelayRemaining === 0) : (this._playbackState = "idle", this.onComplete?.(), !1);
1334
+ }
1335
+ /**
1336
+ * Handle reaching the start of the timeline (in reverse).
1337
+ * Returns true if we looped and should continue, false if we stopped.
1338
+ */
1339
+ _handleStartReached() {
1340
+ const e = this._config.loop ?? 0;
1341
+ return this._config.alternate && (e === -1 || this._loopIteration < e) ? (this._loopIteration++, this._armRepeatDelay(), this._direction = "forward", this._repeatDelayRemaining === 0) : (this._playbackState = "idle", this.onComplete?.(), !1);
1342
+ }
1343
+ }
1344
+ function ar(t) {
1345
+ return Y(t) ? {
1346
+ id: t.id,
1347
+ target: t.target,
1348
+ property: t.property,
1349
+ kind: "inertia",
1350
+ inertia: Jt(t.inertia),
1351
+ ...F(t)
1352
+ } : V(t) ? {
1353
+ id: t.id,
1354
+ target: t.target,
1355
+ property: t.property,
1356
+ kind: "spring",
1357
+ spring: { ...t.spring },
1358
+ ...F(t)
1359
+ } : dt(t) ? {
1360
+ id: t.id,
1361
+ target: t.target,
1362
+ property: "text",
1363
+ textConfig: { ...t.textConfig },
1364
+ keyframes: t.keyframes.map(gt),
1365
+ ...F(t)
1366
+ } : Et(t) ? {
1367
+ id: t.id,
1368
+ target: t.target,
1369
+ property: "motionPath",
1370
+ motionPathConfig: { ...t.motionPathConfig },
1371
+ keyframes: t.keyframes.map(gt),
1372
+ ...F(t)
1373
+ } : {
1374
+ id: t.id,
1375
+ target: t.target,
1376
+ property: t.property,
1377
+ keyframes: t.keyframes.map(gt),
1378
+ ...F(t)
1379
+ };
1380
+ }
1381
+ function Jt(t) {
1382
+ return { ...t, ...Array.isArray(t.end) && { end: [...t.end] } };
1383
+ }
1384
+ function gt(t) {
1385
+ return {
1386
+ time: t.time,
1387
+ value: t.value,
1388
+ ...t.easing && { easing: t.easing }
1389
+ };
1390
+ }
1391
+ function F(t) {
1392
+ const e = t.endDelay;
1393
+ return {
1394
+ ...t.delay !== void 0 && { delay: t.delay },
1395
+ ...e !== void 0 && { endDelay: e },
1396
+ ...t.targets !== void 0 && { targets: [...t.targets] },
1397
+ ...t.stagger !== void 0 && { stagger: { ...t.stagger } }
1398
+ };
1399
+ }
1400
+ function ir(t) {
1401
+ if (Y(t)) {
1402
+ const e = t;
1403
+ return {
1404
+ id: e.id,
1405
+ target: e.target,
1406
+ property: e.property,
1407
+ kind: "inertia",
1408
+ inertia: Jt(e.inertia),
1409
+ ...F(e)
1410
+ };
1411
+ }
1412
+ if (V(t)) {
1413
+ const e = t;
1414
+ return {
1415
+ id: e.id,
1416
+ target: e.target,
1417
+ property: e.property,
1418
+ kind: "spring",
1419
+ spring: { ...e.spring },
1420
+ ...F(e)
1421
+ };
1422
+ }
1423
+ if (dt(t)) {
1424
+ const e = t;
1425
+ return {
1426
+ id: e.id,
1427
+ target: e.target,
1428
+ property: "text",
1429
+ textConfig: { ...e.textConfig },
1430
+ keyframes: [...e.keyframes].sort((r, n) => r.time - n.time),
1431
+ ...F(e)
1432
+ };
1433
+ }
1434
+ if (t.property === "motionPath" && "motionPathConfig" in t) {
1435
+ const e = t, r = [...e.keyframes].sort((n, s) => n.time - s.time);
1436
+ return {
1437
+ id: e.id,
1438
+ target: e.target,
1439
+ property: "motionPath",
1440
+ motionPathConfig: { ...e.motionPathConfig },
1441
+ keyframes: r,
1442
+ ...F(e)
1443
+ };
1444
+ }
1445
+ return Be({
1446
+ id: t.id,
1447
+ target: t.target,
1448
+ property: t.property,
1449
+ keyframes: t.keyframes,
1450
+ ...F(t)
1451
+ });
1452
+ }
1453
+ function or(t) {
1454
+ return {
1455
+ id: t.id,
1456
+ name: t.name,
1457
+ config: {
1458
+ duration: t.duration > 0 ? t.duration : void 0,
1459
+ loop: t._config.loop,
1460
+ speed: t._config.speed,
1461
+ alternate: t._config.alternate,
1462
+ repeatDelay: t._config.repeatDelay
1463
+ },
1464
+ tracks: t.tracks.map(ar)
1465
+ };
1466
+ }
1467
+ function cr(t) {
1468
+ return new sr({
1469
+ id: t.id,
1470
+ name: t.name,
1471
+ config: t.config,
1472
+ tracks: t.tracks.map(ir)
1473
+ });
1474
+ }
1475
+ function Cr(t) {
1476
+ return JSON.stringify(or(t));
1477
+ }
1478
+ function Fr(t) {
1479
+ const e = JSON.parse(t);
1480
+ return cr(e);
1481
+ }
1482
+ function Lr(t) {
1483
+ let e = 2166136261;
1484
+ for (let r = 0; r < t.length; r++)
1485
+ e ^= t.charCodeAt(r), e = Math.imul(e, 16777619);
1486
+ return e >>> 0;
1487
+ }
1488
+ function hr(t) {
1489
+ let e = t >>> 0 || 2654435769;
1490
+ return {
1491
+ seed: t >>> 0,
1492
+ next() {
1493
+ return e ^= e << 13, e >>>= 0, e ^= e >> 17, e ^= e << 5, e >>>= 0, e / 4294967296;
1494
+ }
1495
+ };
1496
+ }
1497
+ function te(t, e, r) {
1498
+ return e + t.next() * (r - e);
1499
+ }
1500
+ function ur(t, e, r, n) {
1501
+ if (n <= 0) return te(t, e, r);
1502
+ const s = Math.floor((r - e) / n), a = Math.round(t.next() * s);
1503
+ return e + a * n;
1504
+ }
1505
+ function Er(t, e) {
1506
+ if (e.length !== 0)
1507
+ return e[Math.floor(t.next() * e.length)];
1508
+ }
1509
+ const ee = /^([+\-*/])=\s*(-?[\d.]+)$/, re = /^random\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*(?:,\s*(-?[\d.]+)\s*)?\)$/i;
1510
+ function Or(t) {
1511
+ return typeof t != "string" ? !1 : ee.test(t.trim()) || re.test(t.trim());
1512
+ }
1513
+ function ne(t, e = {}) {
1514
+ if (typeof t != "string") return t;
1515
+ const r = t.trim(), n = ee.exec(r);
1516
+ if (n) {
1517
+ const [, a, i] = n, o = e.base ?? 0, c = Number.parseFloat(i);
1518
+ switch (a) {
1519
+ case "+":
1520
+ return o + c;
1521
+ case "-":
1522
+ return o - c;
1523
+ case "*":
1524
+ return o * c;
1525
+ case "/":
1526
+ return c === 0 ? o : o / c;
1527
+ }
1528
+ }
1529
+ const s = re.exec(r);
1530
+ if (s) {
1531
+ if (!e.random)
1532
+ throw new Error(
1533
+ `resolveValue: "${r}" needs a random source — pass one via context.random`
1534
+ );
1535
+ const a = Number.parseFloat(s[1]), i = Number.parseFloat(s[2]), o = s[3] !== void 0 ? Number.parseFloat(s[3]) : void 0;
1536
+ return o !== void 0 ? ur(e.random, a, i, o) : te(e.random, a, i);
1537
+ }
1538
+ return t;
1539
+ }
1540
+ function lr(t, e = 0, r) {
1541
+ const n = [];
1542
+ let s = e;
1543
+ for (const a of t) {
1544
+ const i = ne(a, { base: s, random: r });
1545
+ n.push(i), typeof i == "number" && (s = i);
1546
+ }
1547
+ return n;
1548
+ }
1549
+ class Xr {
1550
+ random;
1551
+ constructor(e) {
1552
+ this.random = hr(e);
1553
+ }
1554
+ /** The seed, to be stored alongside the timeline so this can be reproduced. */
1555
+ get seed() {
1556
+ return this.random.seed;
1557
+ }
1558
+ resolve(e, r = 0) {
1559
+ return ne(e, { base: r, random: this.random });
1560
+ }
1561
+ resolveSequence(e, r = 0) {
1562
+ return lr(e, r, this.random);
1563
+ }
1564
+ }
1565
+ const fr = 600;
1566
+ function Nr(t) {
1567
+ if (Array.isArray(t)) {
1568
+ const [g, m, _, f] = t;
1569
+ return { fn: Lt(g, m, _, f), bezier: [g, m, _, f] };
1570
+ }
1571
+ const { segments: e } = U(t);
1572
+ if (e.length === 0) throw new Error(`customEase: no curve in "${t}"`);
1573
+ const r = e[0].startX, n = e[0].startY, s = e[e.length - 1], a = s.endX - r, i = s.endY - n;
1574
+ if (a === 0 || i === 0) throw new Error(`customEase: "${t}" must move along both axes`);
1575
+ const o = (g) => (g - r) / a, c = (g) => (g - n) / i;
1576
+ if (e.length === 1 && s.type === "C") {
1577
+ const [g, m, _, f] = s.points, p = [o(g), c(m), o(_), c(f)];
1578
+ return { fn: Lt(...p), bezier: p };
1579
+ }
1580
+ const h = [], u = [], l = Math.max(8, Math.ceil(fr / e.length));
1581
+ for (const g of e)
1582
+ for (let m = h.length === 0 ? 0 : 1; m <= l; m++) {
1583
+ const [_, f] = gr(g, m / l);
1584
+ h.push(o(_)), u.push(c(f));
1585
+ }
1586
+ return { fn: mr(h, u) };
1587
+ }
1588
+ function Yr(t = {}) {
1589
+ const e = 0.1 + Math.max(0, Math.min(1, t.strength ?? 0.7)) * 0.7, r = [1];
1590
+ for (let s = e; s > 2e-3; s *= e) r.push(2 * Math.sqrt(s));
1591
+ const n = r.reduce((s, a) => s + a, 0);
1592
+ return (s) => {
1593
+ if (s <= 0) return 0;
1594
+ if (s >= 1) return 1;
1595
+ let a = s * n;
1596
+ for (let i = 0; i < r.length; i++) {
1597
+ if (a <= r[i]) {
1598
+ if (i === 0) return (a / r[0]) ** 2;
1599
+ const o = r[i] / 2, c = o * o, h = a - o;
1600
+ return 1 - (c - h * h);
1601
+ }
1602
+ a -= r[i];
1603
+ }
1604
+ return 1;
1605
+ };
1606
+ }
1607
+ function Vr(t = {}) {
1608
+ const e = Math.max(1, t.wiggles ?? 10), r = t.type ?? "easeOut", n = (s) => r === "uniform" ? 1 : r === "easeInOut" ? Math.sin(Math.PI * s) : (1 - s) ** 2;
1609
+ return (s) => s <= 0 || s >= 1 ? 0 : Math.sin(s * e * Math.PI * 2) * n(s);
1610
+ }
1611
+ function gr(t, e) {
1612
+ if (t.type === "L") {
1613
+ const [h, u] = t.points;
1614
+ return [t.startX + (h - t.startX) * e, t.startY + (u - t.startY) * e];
1615
+ }
1616
+ const [r, n, s, a, i, o] = t.points, c = 1 - e;
1617
+ return [
1618
+ c * c * c * t.startX + 3 * c * c * e * r + 3 * c * e * e * s + e * e * e * i,
1619
+ c * c * c * t.startY + 3 * c * c * e * n + 3 * c * e * e * a + e * e * e * o
1620
+ ];
1621
+ }
1622
+ function mr(t, e) {
1623
+ return (r) => {
1624
+ if (r <= t[0]) return e[0];
1625
+ if (r >= t[t.length - 1]) return e[e.length - 1];
1626
+ let n = 0, s = t.length - 1;
1627
+ for (; s - n > 1; ) {
1628
+ const i = n + s >> 1;
1629
+ t[i] <= r ? n = i : s = i;
1630
+ }
1631
+ const a = t[s] - t[n];
1632
+ return a === 0 ? e[s] : e[n] + (r - t[n]) / a * (e[s] - e[n]);
1633
+ };
1634
+ }
1635
+ function Lt(t, e, r, n) {
1636
+ const s = (i, o, c) => 3 * (1 - i) * (1 - i) * i * o + 3 * (1 - i) * i * i * c + i * i * i, a = (i, o, c) => 3 * (1 - i) * (1 - i) * o + 6 * (1 - i) * i * (c - o) + 3 * i * i * (1 - c);
1637
+ return (i) => {
1638
+ if (i <= 0) return 0;
1639
+ if (i >= 1) return 1;
1640
+ let o = i;
1641
+ for (let u = 0; u < 8; u++) {
1642
+ const l = s(o, t, r) - i, g = a(o, t, r);
1643
+ if (Math.abs(l) < 1e-6) return s(o, e, n);
1644
+ if (Math.abs(g) < 1e-6) break;
1645
+ o -= l / g;
1646
+ }
1647
+ let c = 0, h = 1;
1648
+ o = i;
1649
+ for (let u = 0; u < 40; u++)
1650
+ s(o, t, r) < i ? c = o : h = o, o = (c + h) / 2;
1651
+ return s(o, e, n);
1652
+ };
1653
+ }
1654
+ const C = (t) => Math.round(t * 1e3) / 1e3;
1655
+ function zr(t, e = {}) {
1656
+ if (t.length === 0) return "";
1657
+ const r = e.curviness ?? 1, n = e.closed ?? !1, s = t.length;
1658
+ let a = `M${C(t[0].x)} ${C(t[0].y)}`;
1659
+ if (s === 1) return a;
1660
+ const i = (c) => n ? t[(c % s + s) % s] : t[Math.max(0, Math.min(s - 1, c))], o = n ? s : s - 1;
1661
+ for (let c = 0; c < o; c++) {
1662
+ const h = i(c - 1), u = i(c), l = i(c + 1), g = i(c + 2);
1663
+ if (r === 0) {
1664
+ a += ` L${C(l.x)} ${C(l.y)}`;
1665
+ continue;
1666
+ }
1667
+ const m = r / 6, _ = u.x + (l.x - h.x) * m, f = u.y + (l.y - h.y) * m, p = l.x - (g.x - u.x) * m, y = l.y - (g.y - u.y) * m;
1668
+ a += ` C${C(_)} ${C(f)} ${C(p)} ${C(y)} ${C(l.x)} ${C(l.y)}`;
1669
+ }
1670
+ return n ? `${a} Z` : a;
1671
+ }
1672
+ const S = (t, e = 0) => {
1673
+ const r = parseFloat(t ?? "");
1674
+ return Number.isFinite(r) ? r : e;
1675
+ };
1676
+ function pr(t) {
1677
+ const e = (t ?? "").trim().split(/[\s,]+/).filter(Boolean).map(Number), r = [];
1678
+ for (let n = 0; n + 1 < e.length; n += 2) r.push({ x: e[n], y: e[n + 1] });
1679
+ return r;
1680
+ }
1681
+ function Wr(t) {
1682
+ const e = t.attributes;
1683
+ switch (t.tag.toLowerCase()) {
1684
+ case "path":
1685
+ return e.d ?? null;
1686
+ case "circle":
1687
+ case "ellipse": {
1688
+ const r = S(e.cx), n = S(e.cy), s = t.tag.toLowerCase() === "circle" ? S(e.r) : S(e.rx), a = t.tag.toLowerCase() === "circle" ? S(e.r) : S(e.ry);
1689
+ return `M${r + s} ${n} A${s} ${a} 0 1 1 ${r - s} ${n} A${s} ${a} 0 1 1 ${r + s} ${n} Z`;
1690
+ }
1691
+ case "rect": {
1692
+ const r = S(e.x), n = S(e.y), s = S(e.width), a = S(e.height);
1693
+ let i = e.rx != null ? S(e.rx) : e.ry != null ? S(e.ry) : 0, o = e.ry != null ? S(e.ry) : i;
1694
+ return i = Math.min(i, s / 2), o = Math.min(o, a / 2), i === 0 || o === 0 ? `M${r} ${n} H${r + s} V${n + a} H${r} Z` : `M${r + i} ${n} H${r + s - i} A${i} ${o} 0 0 1 ${r + s} ${n + o} V${n + a - o} A${i} ${o} 0 0 1 ${r + s - i} ${n + a} H${r + i} A${i} ${o} 0 0 1 ${r} ${n + a - o} V${n + o} A${i} ${o} 0 0 1 ${r + i} ${n} Z`;
1695
+ }
1696
+ case "line":
1697
+ return `M${S(e.x1)} ${S(e.y1)} L${S(e.x2)} ${S(e.y2)}`;
1698
+ case "polyline":
1699
+ case "polygon": {
1700
+ const r = pr(e.points);
1701
+ if (r.length === 0) return null;
1702
+ const n = r.map((s, a) => `${a === 0 ? "M" : "L"}${s.x} ${s.y}`).join(" ");
1703
+ return t.tag.toLowerCase() === "polygon" ? `${n} Z` : n;
1704
+ }
1705
+ default:
1706
+ return null;
1707
+ }
1708
+ }
1709
+ export {
1710
+ _r as Clock,
1711
+ Zt as DEFAULT_BAKE_INTERVAL_MS,
1712
+ Tt as DEFAULT_INERTIA_FRICTION,
1713
+ R as DEFAULT_SPRING,
1714
+ me as INERTIA_MAX_DURATION_MS,
1715
+ Je as InertiaTrackPlayer,
1716
+ wr as MORPH_SAMPLES,
1717
+ yr as ManualClock,
1718
+ Nt as SPRING_MAX_DURATION_MS,
1719
+ kr as SPRING_PRESETS,
1720
+ K as SPRING_STEP_MS,
1721
+ rt as SpringSampler,
1722
+ Ge as SpringTrackPlayer,
1723
+ sr as Timeline,
1724
+ lt as TrackPlayer,
1725
+ Xr as ValueResolver,
1726
+ Ir as bakeEasing,
1727
+ Kt as bakeInertiaTrack,
1728
+ jt as bakeSpringTrack,
1729
+ er as charactersFor,
1730
+ Pr as clearMorphCache,
1731
+ Sr as clearPathCache,
1732
+ xe as createCubicBezier,
1733
+ hr as createRandom,
1734
+ Be as createTrack,
1735
+ vr as criticalDamping,
1736
+ Yr as customBounce,
1737
+ Nr as customEase,
1738
+ Vr as customWiggle,
1739
+ cr as deserializeTimeline,
1740
+ ir as deserializeTrack,
1741
+ Me as easeIn,
1742
+ Vt as easeInCubic,
1743
+ be as easeInOut,
1744
+ Wt as easeInOutCubic,
1745
+ ke as easeInOutQuad,
1746
+ ye as easeInQuad,
1747
+ Te as easeOut,
1748
+ zt as easeOutCubic,
1749
+ _e as easeOutQuad,
1750
+ Fr as fromJSON,
1751
+ qt as getEasingFunction,
1752
+ Ht as getInterpolator,
1753
+ Gt as getMotionPathPoint,
1754
+ $r as getPathLength,
1755
+ Ce as getPointAtProgress,
1756
+ he as hasKeyframes,
1757
+ Lr as hashSeed,
1758
+ at as inertiaDuration,
1759
+ st as inertiaRest,
1760
+ mt as inertiaValueAt,
1761
+ xr as inertiaVelocityAt,
1762
+ Ze as interpolateArray,
1763
+ He as interpolateColor,
1764
+ Rr as interpolateMotionPath,
1765
+ E as interpolateNumber,
1766
+ je as interpolatePathString,
1767
+ Ft as interpolateString,
1768
+ ce as isCubicBezierEasing,
1769
+ Y as isInertiaTrack,
1770
+ dr as isMotionPathPoint,
1771
+ Et as isMotionPathTrack,
1772
+ qe as isPathData,
1773
+ V as isSpringTrack,
1774
+ dt as isTextTrack,
1775
+ br as isUnderdamped,
1776
+ Or as isUnresolved,
1777
+ Yt as linear,
1778
+ ue as maxStaggerDistance,
1779
+ We as morphPath,
1780
+ pe as naturalRest,
1781
+ U as parsePath,
1782
+ Ut as pointAtDistance,
1783
+ zr as pointsToPath,
1784
+ te as randomBetween,
1785
+ Er as randomChoice,
1786
+ ur as randomSnapped,
1787
+ lr as resolveSequence,
1788
+ ne as resolveValue,
1789
+ or as serializeTimeline,
1790
+ ar as serializeTrack,
1791
+ Wr as shapeToPathData,
1792
+ Ke as simplifyKeyframes,
1793
+ Tr as springDuration,
1794
+ Mr as springValueAt,
1795
+ Ot as staggerDistance,
1796
+ Xt as staggerOffset,
1797
+ le as staggerOffsets,
1798
+ yt as staggerSpan,
1799
+ nr as textAt,
1800
+ Cr as toJSON,
1801
+ Ar as toKeyframedTrack,
1802
+ Dr as toKeyframedTracks,
1803
+ N as trackTargets
1804
+ };