@algorisys/tinyfly 0.101.0 → 0.103.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +17 -6
  2. package/bin/tinyfly.mjs +9 -3
  3. package/docs/DEPLOYMENT.md +2 -0
  4. package/docs/api-reference.md +61 -0
  5. package/docs/dance.md +150 -1
  6. package/docs/editor-guide.md +11 -4
  7. package/docs/examples.md +22 -1
  8. package/docs/getting-started.md +1 -1
  9. package/docs/gsap-compat.md +1 -1
  10. package/docs/llm-guide.md +38 -3
  11. package/docs/maps.md +2 -2
  12. package/docs/scene-3d.md +138 -6
  13. package/docs/teaching.md +1 -1
  14. package/docs/video-rendering.md +44 -1
  15. package/lib/addons/adapters.js +168 -123
  16. package/lib/addons/characters.js +5802 -5506
  17. package/lib/addons/scene-3d-webgl.js +30 -30
  18. package/lib/addons/scene-3d.js +650 -341
  19. package/lib/browser/tinyfly-scene-3d-webgl.iife.js +2 -2
  20. package/lib/browser/tinyfly-scene-3d.iife.js +2 -2
  21. package/lib/browser/tinyfly.iife.js +14 -14
  22. package/lib/browser/tinyfly.js +5798 -5467
  23. package/lib/browser/tinyfly.umd.js +14 -14
  24. package/lib/engine/tinyfly-engine.js +1207 -1172
  25. package/lib/engine/tinyfly-engine.umd.cjs +2 -2
  26. package/lib/headless/headless.js +150 -6
  27. package/lib/types/adapters/canvas/framing.d.ts +27 -0
  28. package/lib/types/adapters/canvas/index.d.ts +1 -0
  29. package/lib/types/characters/capabilities.d.ts +1 -0
  30. package/lib/types/characters/character-script-3d.d.ts +34 -4
  31. package/lib/types/characters/dance-circle.d.ts +59 -0
  32. package/lib/types/characters/dance-contact.d.ts +52 -0
  33. package/lib/types/characters/human-dance.d.ts +86 -0
  34. package/lib/types/characters/index.d.ts +5 -1
  35. package/lib/types/characters/rig/reach.d.ts +6 -3
  36. package/lib/types/characters/staging-3d.d.ts +56 -0
  37. package/lib/types/engine/authoring/framing.d.ts +48 -0
  38. package/lib/types/engine/authoring/index.d.ts +1 -0
  39. package/lib/types/headless/audio-mix.d.ts +40 -0
  40. package/lib/types/headless/ffmpeg-args.d.ts +2 -0
  41. package/lib/types/headless/frame-renderer.d.ts +7 -1
  42. package/lib/types/headless/index.d.ts +1 -0
  43. package/lib/types/headless/node-audio.d.ts +19 -0
  44. package/lib/types/headless/node-video.d.ts +2 -0
  45. package/lib/types/headless/video-scene.d.ts +12 -0
  46. package/lib/types/scene-3d/index.d.ts +3 -0
  47. package/lib/types/scene-3d/lighting.d.ts +58 -0
  48. package/lib/types/scene-3d/resolve-scene.d.ts +5 -1
  49. package/lib/types/scene-3d/scene-3d-adapter.d.ts +2 -0
  50. package/lib/types/scene-3d/scene-types.d.ts +14 -2
  51. package/lib/types/scene-3d/shots.d.ts +162 -0
  52. package/lib/types/scene-3d/software-renderer.d.ts +40 -0
  53. package/llms-full.txt +474 -23
  54. package/llms.txt +29 -29
  55. package/package.json +1 -1
  56. package/skills/tinyfly/SKILL.md +32 -1
  57. package/lib/types/characters/polyline.d.ts +0 -12
  58. package/lib/types/characters/sketch.d.ts +0 -54
  59. package/lib/types/compat/gsap/playhead-crossings.d.ts +0 -47
@@ -1,36 +1,36 @@
1
1
  import { h as q, e as D, i as G, a as Z, b as j, p as J, t as Q, g as K, c as W, q as ee, F as te, s as ie, d as oe } from "./dom-adapter-Cphr2HZn.js";
2
- import { D as Ve } from "./dom-adapter-Cphr2HZn.js";
3
- import { C as qe, I as Ze, a as je, b as Je, c as Qe, d as Ke, e as et, f as tt } from "./target-properties-BtN9skb-.js";
4
- import { createTrack as se, parsePath as N, ribbon as ne, ribbonHeadCap as re, similarityMatrix as ae, powSimilarity as le, createRandom as ce, hashSeed as he, mat4 as v } from "@algorisys/tinyfly";
5
- import { p as fe, s as de } from "./sketch-CYPUbk3Q.js";
6
- import { c as ot, a as st, b as nt } from "./sketch-CYPUbk3Q.js";
7
- function ue(s) {
2
+ import { D as Je } from "./dom-adapter-Cphr2HZn.js";
3
+ import { C as Ke, I as et, a as tt, b as it, c as ot, d as st, e as nt, f as rt } from "./target-properties-BtN9skb-.js";
4
+ import { createTrack as se, parsePath as N, ribbon as ne, ribbonHeadCap as re, similarityMatrix as ae, powSimilarity as le, createRandom as ce, hashSeed as he, frameRect as fe, safeAreas as de, mat4 as T } from "@algorisys/tinyfly";
5
+ import { p as ue, s as pe } from "./sketch-CYPUbk3Q.js";
6
+ import { c as lt, a as ct, b as ht } from "./sketch-CYPUbk3Q.js";
7
+ function me(s) {
8
8
  const e = /* @__PURE__ */ new Map();
9
9
  for (const { name: t, element: i } of s)
10
10
  e.set(t, U(i));
11
11
  return { measurements: e };
12
12
  }
13
- function pe(s, e, t = {}) {
13
+ function ye(s, e, t = {}) {
14
14
  const i = t.duration ?? 600, o = t.easing ?? "ease-out", n = t.scale !== !1, a = t.idPrefix ?? "flip", r = [];
15
15
  for (const { name: l, element: c } of e) {
16
16
  const h = s.measurements.get(l);
17
17
  if (!h) continue;
18
18
  const f = U(c), m = h.left + h.width / 2 - (f.left + f.width / 2), d = h.top + h.height / 2 - (f.top + f.height / 2);
19
19
  if ((m !== 0 || d !== 0) && r.push(
20
- A(`${a}-${l}-x`, l, "x", m, 0, i, o),
21
- A(`${a}-${l}-y`, l, "y", d, 0, i, o)
20
+ k(`${a}-${l}-x`, l, "x", m, 0, i, o),
21
+ k(`${a}-${l}-y`, l, "y", d, 0, i, o)
22
22
  ), n && f.width > 0 && f.height > 0) {
23
23
  const p = h.width / f.width, u = h.height / f.height;
24
- p !== 1 && r.push(A(`${a}-${l}-sx`, l, "scaleX", p, 1, i, o)), u !== 1 && r.push(A(`${a}-${l}-sy`, l, "scaleY", u, 1, i, o));
24
+ p !== 1 && r.push(k(`${a}-${l}-sx`, l, "scaleX", p, 1, i, o)), u !== 1 && r.push(k(`${a}-${l}-sy`, l, "scaleY", u, 1, i, o));
25
25
  }
26
26
  }
27
27
  return r;
28
28
  }
29
- function _e(s, e, t = {}) {
30
- const i = ue(s);
31
- return e(), pe(i, s, t);
29
+ function Oe(s, e, t = {}) {
30
+ const i = me(s);
31
+ return e(), ye(i, s, t);
32
32
  }
33
- function A(s, e, t, i, o, n, a) {
33
+ function k(s, e, t, i, o, n, a) {
34
34
  return se({
35
35
  id: s,
36
36
  target: e,
@@ -58,8 +58,8 @@ function H(s, e, t = {}) {
58
58
  l.offset > 0 && l.offset < 1 && a.push(l);
59
59
  return a.push({ offset: 1, color: e }), a.sort((l, c) => l.offset - c.offset), a;
60
60
  }
61
- const _ = 12;
62
- function x(s) {
61
+ const $ = 12;
62
+ function I(s) {
63
63
  const e = [];
64
64
  let t, i = -1;
65
65
  for (const o of N(s).segments) {
@@ -69,8 +69,8 @@ function x(s) {
69
69
  }
70
70
  t = void 0;
71
71
  const [n, a, r, l, c, h] = o.points, f = [];
72
- for (let m = 0; m <= _; m++) {
73
- const d = m / _, p = 1 - d;
72
+ for (let m = 0; m <= $; m++) {
73
+ const d = m / $, p = 1 - d;
74
74
  f.push({
75
75
  x: p * p * p * o.startX + 3 * p * p * d * n + 3 * p * d * d * r + d * d * d * c,
76
76
  y: p * p * p * o.startY + 3 * p * p * d * a + 3 * p * d * d * l + d * d * d * h
@@ -80,11 +80,11 @@ function x(s) {
80
80
  }
81
81
  return e;
82
82
  }
83
- function me(s, e, t, i, o = 0) {
83
+ function we(s, e, t, i, o = 0) {
84
84
  const n = Math.max(0, Math.min(o, t / 2, i / 2));
85
- if (n === 0) return x(`M${s},${e} H${s + t} V${e + i} H${s} Z`);
85
+ if (n === 0) return I(`M${s},${e} H${s + t} V${e + i} H${s} Z`);
86
86
  const a = s + t, r = e + i;
87
- return x(
87
+ return I(
88
88
  `M${s + n},${e} H${a - n} A${n},${n} 0 0 1 ${a},${e + n} V${r - n} A${n},${n} 0 0 1 ${a - n},${r} H${s + n} A${n},${n} 0 0 1 ${s},${r - n} V${e + n} A${n},${n} 0 0 1 ${s + n},${e} Z`
89
89
  );
90
90
  }
@@ -99,13 +99,13 @@ function C(s, e, t, i) {
99
99
  continue;
100
100
  }
101
101
  if (l <= 0) continue;
102
- const c = fe(r.points, l);
102
+ const c = ue(r.points, l);
103
103
  s.moveTo(c[0].x, c[0].y);
104
104
  for (const h of c.slice(1)) s.lineTo(h.x, h.y);
105
105
  }
106
106
  i || s.stroke();
107
107
  }
108
- function k(s, e, t) {
108
+ function S(s, e, t) {
109
109
  if (typeof OffscreenCanvas < "u") return new OffscreenCanvas(e, t);
110
110
  const i = s.canvas;
111
111
  if (i?.ownerDocument) {
@@ -118,10 +118,10 @@ function k(s, e, t) {
118
118
  return null;
119
119
  }
120
120
  }
121
- function $e(s) {
121
+ function xe(s) {
122
122
  return typeof s == "object" && s !== null && "type" in s;
123
123
  }
124
- class I {
124
+ class X {
125
125
  targets = /* @__PURE__ */ new Map();
126
126
  targetOrder = [];
127
127
  // Store animation offsets separately - these are applied via ctx.translate() during rendering
@@ -186,12 +186,12 @@ class I {
186
186
  if (!o) continue;
187
187
  const n = this.aliases.get(t) ?? t, a = this.animationOffsets.get(n) ?? { x: 0, y: 0 };
188
188
  for (const [r, l] of i)
189
- if (I.OFFSET_PROPERTIES.has(r) && typeof l == "number")
189
+ if (X.OFFSET_PROPERTIES.has(r) && typeof l == "number")
190
190
  r === "x" || r === "motionPathX" ? a.x = l : (r === "y" || r === "motionPathY") && (a.y = l);
191
191
  else if (o.type === "custom" && o.props && (r in o.props || o.acceptsProp?.(r)))
192
192
  o.props[r] = l;
193
193
  else {
194
- const c = I.PROPERTY_MAP[r] ?? r;
194
+ const c = X.PROPERTY_MAP[r] ?? r;
195
195
  o[c] = l;
196
196
  }
197
197
  this.animationOffsets.set(n, a);
@@ -267,7 +267,7 @@ class I {
267
267
  const t = e.canvas?.width ?? 0, i = e.canvas?.height ?? 0;
268
268
  if (!(t > 0 && i > 0)) return null;
269
269
  if (!this.layer || this.layer.width !== t || this.layer.height !== i) {
270
- const n = k(e, t, i), a = n?.getContext("2d");
270
+ const n = S(e, t, i), a = n?.getContext("2d");
271
271
  if (this.layer = n && a ? { canvas: n, ctx: a, width: t, height: i } : null, !this.layer) return null;
272
272
  }
273
273
  const o = this.layer.ctx;
@@ -405,7 +405,7 @@ class I {
405
405
  renderOutlined(e, t, i, o) {
406
406
  const n = Math.min(1, Math.max(0, t.drawOn ?? 1));
407
407
  if (i && t.fillStyle && n >= 1 && i(), !t.strokeStyle || n <= 0) return;
408
- const a = t.sketch ? de(e, t.sketch, this.time) : void 0;
408
+ const a = t.sketch ? pe(e, t.sketch, this.time) : void 0;
409
409
  a && (e.lineCap = t.lineCap ?? "round", e.lineJoin = t.lineJoin ?? "round"), o(n, a);
410
410
  }
411
411
  /**
@@ -420,7 +420,7 @@ class I {
420
420
  () => {
421
421
  e.beginPath(), t.borderRadius && t.borderRadius > 0 ? this.roundRect(e, i, o, n, a, t.borderRadius) : e.rect(i, o, n, a), e.fill();
422
422
  },
423
- (r, l) => C(e, me(i, o, n, a, t.borderRadius), r, l)
423
+ (r, l) => C(e, we(i, o, n, a, t.borderRadius), r, l)
424
424
  );
425
425
  }
426
426
  e.beginPath(), t.borderRadius && t.borderRadius > 0 ? this.roundRect(e, t.x, t.y, t.width, t.height, t.borderRadius) : e.rect(t.x, t.y, t.width, t.height), t.fillStyle && e.fill(), t.strokeStyle && e.stroke(), e.closePath();
@@ -497,7 +497,7 @@ class I {
497
497
  e,
498
498
  t,
499
499
  () => e.fill(i),
500
- (o, n) => C(e, x(t.d), o, n)
500
+ (o, n) => C(e, I(t.d), o, n)
501
501
  );
502
502
  t.fillStyle && e.fill(i), t.strokeStyle && e.stroke(i);
503
503
  }
@@ -621,7 +621,7 @@ class I {
621
621
  });
622
622
  }
623
623
  }
624
- function ye(s, e) {
624
+ function be(s, e) {
625
625
  const t = s.length / 4, i = new Float32Array(t * 3), o = Math.min(0.999, Math.max(0, e));
626
626
  for (let n = 0; n < t; n++) {
627
627
  const a = s[n * 4] / 255, r = s[n * 4 + 1] / 255, l = s[n * 4 + 2] / 255, c = s[n * 4 + 3] / 255, h = Math.max(a, r, l);
@@ -631,7 +631,7 @@ function ye(s, e) {
631
631
  }
632
632
  return i;
633
633
  }
634
- function $(s, e, t, i, o) {
634
+ function Y(s, e, t, i, o) {
635
635
  const n = new Float32Array(s.length), a = o ? t : e, r = o ? e : t, l = (h, f) => (o ? h * e + f : f * e + h) * 3, c = i * 2 + 1;
636
636
  for (let h = 0; h < a; h++)
637
637
  for (let f = 0; f < 3; f++) {
@@ -645,48 +645,48 @@ function $(s, e, t, i, o) {
645
645
  }
646
646
  return n;
647
647
  }
648
- function Y(s, e, t, i) {
648
+ function O(s, e, t, i) {
649
649
  const o = Math.max(1, Math.round(i / Math.sqrt(3)));
650
650
  let n = s;
651
651
  for (let a = 0; a < 3; a++)
652
- n = $(n, e, t, o, !0), n = $(n, e, t, o, !1);
652
+ n = Y(n, e, t, o, !0), n = Y(n, e, t, o, !1);
653
653
  return n;
654
654
  }
655
- function Ye(s, e = {}) {
655
+ function Be(s, e = {}) {
656
656
  const t = s.canvas, i = t.width, o = t.height;
657
657
  if (!(i > 0 && o > 0)) return;
658
- const n = Math.max(1, Math.round(e.downsample ?? 4)), a = Math.max(1, Math.ceil(i / n)), r = Math.max(1, Math.ceil(o / n)), l = k(s, a, r), c = l?.getContext("2d");
658
+ const n = Math.max(1, Math.round(e.downsample ?? 4)), a = Math.max(1, Math.ceil(i / n)), r = Math.max(1, Math.ceil(o / n)), l = S(s, a, r), c = l?.getContext("2d");
659
659
  if (!l || !c) return;
660
660
  c.imageSmoothingEnabled = !0, c.drawImage(s.canvas, 0, 0, a, r);
661
- const h = ye(c.getImageData(0, 0, a, r).data, e.threshold ?? 0.55), f = (e.radius ?? Math.max(i, o) * 0.02) / n, m = Y(h, a, r, f), d = Y(h, a, r, f * 3), p = e.halo ?? 0.6, u = c.createImageData(a, r);
661
+ const h = be(c.getImageData(0, 0, a, r).data, e.threshold ?? 0.55), f = (e.radius ?? Math.max(i, o) * 0.02) / n, m = O(h, a, r, f), d = O(h, a, r, f * 3), p = e.halo ?? 0.6, u = c.createImageData(a, r);
662
662
  for (let y = 0; y < a * r; y++) {
663
663
  for (let w = 0; w < 3; w++) u.data[y * 4 + w] = Math.round(Math.min(1, m[y * 3 + w] + d[y * 3 + w] * p) * 255);
664
664
  u.data[y * 4 + 3] = 255;
665
665
  }
666
666
  c.putImageData(u, 0, 0), s.save(), s.setTransform(1, 0, 0, 1, 0, 0), s.globalCompositeOperation = "lighter", s.globalAlpha = Math.max(0, e.strength ?? 0.9), s.imageSmoothingEnabled = !0, s.drawImage(l, 0, 0, i, o), s.restore();
667
667
  }
668
- function Oe(s, e, t) {
668
+ function Le(s, e, t) {
669
669
  const i = t.width ?? 6, o = t.taper ?? 1, n = t.fade ?? 1, a = t.opacity ?? 1, r = t.blend === "add";
670
670
  if (s.save(), e.length >= 2) {
671
- const c = be(e, i, o, n, a);
672
- r ? (s.globalCompositeOperation = "lighter", X(s, c, t.color)) : ve(s, c, t.color);
671
+ const c = ve(e, i, o, n, a);
672
+ r ? (s.globalCompositeOperation = "lighter", _(s, c, t.color)) : Me(s, c, t.color);
673
673
  }
674
674
  const l = e[e.length - 1];
675
675
  if (t.head && l && t.head.radius > 0) {
676
676
  r && (s.globalCompositeOperation = "lighter");
677
677
  const c = t.head.color ?? t.color, h = s.createRadialGradient(l.at.x, l.at.y, 0, l.at.x, l.at.y, t.head.radius);
678
- h.addColorStop(0, c), h.addColorStop(0.35, c), h.addColorStop(1, we(s, c)), s.globalAlpha = a, s.fillStyle = h, s.beginPath(), s.arc(l.at.x, l.at.y, t.head.radius, 0, Math.PI * 2), s.fill();
678
+ h.addColorStop(0, c), h.addColorStop(0.35, c), h.addColorStop(1, Te(s, c)), s.globalAlpha = a, s.fillStyle = h, s.beginPath(), s.arc(l.at.x, l.at.y, t.head.radius, 0, Math.PI * 2), s.fill();
679
679
  }
680
680
  s.restore();
681
681
  }
682
- function we(s, e) {
682
+ function Te(s, e) {
683
683
  s.fillStyle = e;
684
684
  const t = String(s.fillStyle), i = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i.exec(t);
685
685
  if (i) return `rgba(${parseInt(i[1], 16)}, ${parseInt(i[2], 16)}, ${parseInt(i[3], 16)}, 0)`;
686
686
  const o = /^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)/i.exec(t);
687
687
  return o ? `rgba(${o[1]}, ${o[2]}, ${o[3]}, 0)` : "rgba(0, 0, 0, 0)";
688
688
  }
689
- function be(s, e, t, i, o) {
689
+ function ve(s, e, t, i, o) {
690
690
  const n = s.map((c) => ({ x: c.at.x, y: c.at.y, width: e * (1 - t * c.age) })), a = ne(n), r = re(n) ?? void 0, l = [];
691
691
  for (let c = 0; c + 1 < s.length; c++) {
692
692
  const h = (s[c].age + s[c + 1].age) / 2, f = o * (1 - i * h);
@@ -696,14 +696,14 @@ function be(s, e, t, i, o) {
696
696
  }
697
697
  return l;
698
698
  }
699
- function X(s, e, t) {
699
+ function _(s, e, t) {
700
700
  s.fillStyle = t;
701
701
  for (const i of e) {
702
702
  const [o, n, a, r] = i.corners;
703
703
  s.globalAlpha = Math.min(1, i.alpha), s.beginPath(), s.moveTo(o.x, o.y), s.lineTo(n.x, n.y), i.cap && s.arc(i.cap.x, i.cap.y, i.cap.radius, i.cap.start, i.cap.start - Math.PI, !0), s.lineTo(a.x, a.y), s.lineTo(r.x, r.y), s.closePath(), s.fill();
704
704
  }
705
705
  }
706
- function ve(s, e, t) {
706
+ function Me(s, e, t) {
707
707
  const i = typeof s.getTransform == "function" ? s.getTransform() : null, o = (u) => i ? { x: i.a * u.x + i.c * u.y + i.e, y: i.b * u.x + i.d * u.y + i.f } : u, n = i ? Math.sqrt(Math.abs(i.a * i.d - i.b * i.c)) : 1, a = e.map((u) => ({
708
708
  ...u,
709
709
  corners: u.corners.map(o),
@@ -716,20 +716,20 @@ function ve(s, e, t) {
716
716
  r = Math.min(r, w.x), l = Math.min(l, w.y), c = Math.max(c, w.x), h = Math.max(h, w.y);
717
717
  }
718
718
  if (!(c > r && h > l)) return;
719
- const f = Math.floor(r) - 1, m = Math.floor(l) - 1, d = i ? k(s, Math.ceil(c) + 1 - f, Math.ceil(h) + 1 - m) : null, p = d?.getContext("2d");
719
+ const f = Math.floor(r) - 1, m = Math.floor(l) - 1, d = i ? S(s, Math.ceil(c) + 1 - f, Math.ceil(h) + 1 - m) : null, p = d?.getContext("2d");
720
720
  if (!d || !p) {
721
- X(s, e, t);
721
+ _(s, e, t);
722
722
  return;
723
723
  }
724
- p.translate(-f, -m), p.globalCompositeOperation = "lighter", X(p, a, t), s.save(), s.setTransform(1, 0, 0, 1, 0, 0), s.globalAlpha = 1, s.drawImage(d, f, m), s.restore();
724
+ p.translate(-f, -m), p.globalCompositeOperation = "lighter", _(p, a, t), s.save(), s.setTransform(1, 0, 0, 1, 0, 0), s.globalAlpha = 1, s.drawImage(d, f, m), s.restore();
725
725
  }
726
- function Te(s, e, t) {
726
+ function Se(s, e, t) {
727
727
  return le(s, e - t);
728
728
  }
729
- function Be(s, e) {
729
+ function Fe(s, e) {
730
730
  const [t, i] = e.levels ?? [-4, 24], o = e.minSize ?? 1, n = [];
731
731
  for (let l = Math.ceil(t); l <= Math.floor(i); l++) {
732
- const c = Te(e.step, l, e.phase);
732
+ const c = Se(e.step, l, e.phase);
733
733
  c.scale * e.extent < o || n.push({ level: l, scale: c.scale, transform: c });
734
734
  }
735
735
  n.sort((l, c) => c.scale - l.scale);
@@ -741,10 +741,10 @@ function Be(s, e) {
741
741
  s.save(), s.transform(...ae(h)), e.draw(s, l, c), s.restore(), r.push(l);
742
742
  return r;
743
743
  }
744
- function Le(s, e = {}) {
744
+ function De(s, e = {}) {
745
745
  const t = s.canvas, i = t.width, o = t.height;
746
746
  if (!(i > 0 && o > 0)) return;
747
- const n = k(s, i, o), a = n?.getContext("2d");
747
+ const n = S(s, i, o), a = n?.getContext("2d");
748
748
  if (!n || !a) return;
749
749
  a.drawImage(s.canvas, 0, 0);
750
750
  const r = Math.max(1, Math.round(e.samples ?? 8)), l = e.strength ?? 0.08, c = e.centre?.x ?? i / 2, h = e.centre?.y ?? o / 2, f = e.blend === "add", m = Math.min(1, Math.max(0, e.amount ?? 1));
@@ -755,24 +755,66 @@ function Le(s, e = {}) {
755
755
  }
756
756
  s.restore();
757
757
  }
758
- function Fe(s, e = {}) {
758
+ function Ge(s, e = {}) {
759
759
  const t = s.canvas, i = e.centre?.x ?? t.width / 2, o = e.centre?.y ?? t.height / 2, n = Math.hypot(t.width, t.height) / 2, a = e.inner ?? n * 0.15, r = e.outer ?? n * 1.1, l = Math.max(1, r - a), c = (e.length ?? 0.35) * l, h = Math.max(1, Math.round(e.count ?? 28)), f = ce(typeof e.seed == "string" ? he(e.seed) : e.seed ?? 1), m = e.phase ?? 0, d = e.direction === "in" ? -1 : 1;
760
760
  s.save(), s.strokeStyle = e.color ?? "#ffffff", s.lineCap = "round", e.blend === "add" && (s.globalCompositeOperation = "lighter");
761
761
  const p = e.width ?? 3, u = e.opacity ?? 0.8;
762
762
  for (let y = 0; y < h; y++) {
763
- const w = (y + f.next() * 0.6) / h * Math.PI * 2, T = f.next(), M = 0.6 + f.next() * 0.8, z = ((T + d * m) % 1 + 1) % 1, b = a + z * l, S = b + c * M, P = Math.cos(w), g = Math.sin(w), R = s.createLinearGradient(i + P * b, o + g * b, i + P * S, o + g * S);
764
- R.addColorStop(0, "rgba(0,0,0,0)"), R.addColorStop(0.5, e.color ?? "#ffffff"), R.addColorStop(1, "rgba(0,0,0,0)"), s.strokeStyle = R, s.globalAlpha = u * Math.min(1, (b - a) / l + 0.3), s.lineWidth = p * (0.4 + 0.6 * (b - a) / l), s.beginPath(), s.moveTo(i + P * b, o + g * b), s.lineTo(i + P * Math.min(S, r + c), o + g * Math.min(S, r + c)), s.stroke();
763
+ const w = (y + f.next() * 0.6) / h * Math.PI * 2, v = f.next(), M = 0.6 + f.next() * 0.8, z = ((v + d * m) % 1 + 1) % 1, b = a + z * l, P = b + c * M, g = Math.cos(w), R = Math.sin(w), A = s.createLinearGradient(i + g * b, o + R * b, i + g * P, o + R * P);
764
+ A.addColorStop(0, "rgba(0,0,0,0)"), A.addColorStop(0.5, e.color ?? "#ffffff"), A.addColorStop(1, "rgba(0,0,0,0)"), s.strokeStyle = A, s.globalAlpha = u * Math.min(1, (b - a) / l + 0.3), s.lineWidth = p * (0.4 + 0.6 * (b - a) / l), s.beginPath(), s.moveTo(i + g * b, o + R * b), s.lineTo(i + g * Math.min(P, r + c), o + R * Math.min(P, r + c)), s.stroke();
765
765
  }
766
766
  s.restore();
767
767
  }
768
- function De(s, e, t = {}) {
768
+ function We(s, e, t = {}) {
769
769
  const i = { top: t.top ?? "#f3f4f6", left: t.left ?? "#9ca3af", right: t.right ?? "#4b5563" };
770
770
  s.save(), s.lineJoin = "round";
771
771
  for (const o of e)
772
772
  s.beginPath(), o.points.forEach((n, a) => a === 0 ? s.moveTo(n.x, n.y) : s.lineTo(n.x, n.y)), s.closePath(), s.fillStyle = t.fill?.(o) ?? i[o.side], s.fill(), t.outline && (s.strokeStyle = t.outline, s.lineWidth = t.lineWidth ?? 2, s.stroke());
773
773
  s.restore();
774
774
  }
775
- const E = "http://www.w3.org/2000/svg", Me = /* @__PURE__ */ new Set([
775
+ function Ne(s, e, t, i = "#000000") {
776
+ const o = fe(e, t);
777
+ return s.save(), s.fillStyle = i, o.y > 0 && (s.fillRect(0, 0, e.width, o.y), s.fillRect(0, o.y + o.height, e.width, e.height - o.y - o.height)), o.x > 0 && (s.fillRect(0, 0, o.x, e.height), s.fillRect(o.x + o.width, 0, e.width - o.x - o.width, e.height)), s.restore(), o;
778
+ }
779
+ function Ue(s, e, t = {}) {
780
+ const i = de(e, t);
781
+ s.save(), s.strokeStyle = t.color ?? "rgba(255, 255, 255, 0.6)", s.lineWidth = 1, s.setLineDash([6, 4]);
782
+ for (const o of [i.action, i.title]) s.strokeRect(o.x + 0.5, o.y + 0.5, o.width - 1, o.height - 1);
783
+ s.restore();
784
+ }
785
+ function He(s, e, t) {
786
+ const { width: i, height: o, draw: n } = t, a = Math.min(1, Math.max(0, e.progress));
787
+ if (e.kind === "dipToBlack") {
788
+ n(s, a < 0.5 ? e.from.camera : e.to.camera), s.save(), s.globalAlpha = 1 - Math.abs(a * 2 - 1), s.fillStyle = e.color, s.fillRect(0, 0, i, o), s.restore();
789
+ return;
790
+ }
791
+ n(s, e.from.camera);
792
+ const r = S(s, i, o), l = r?.getContext("2d");
793
+ if (!r || !l) {
794
+ a >= 0.5 && n(s, e.to.camera);
795
+ return;
796
+ }
797
+ if (n(l, e.to.camera), s.save(), e.kind === "crossfade")
798
+ s.globalAlpha = a;
799
+ else {
800
+ switch (s.beginPath(), e.direction) {
801
+ case "right":
802
+ s.rect(i * (1 - a), 0, i * a, o);
803
+ break;
804
+ case "up":
805
+ s.rect(0, o * (1 - a), i, o * a);
806
+ break;
807
+ case "down":
808
+ s.rect(0, 0, i, o * a);
809
+ break;
810
+ default:
811
+ s.rect(0, 0, i * a, o);
812
+ }
813
+ s.clip();
814
+ }
815
+ s.drawImage(r, 0, 0), s.restore();
816
+ }
817
+ const E = "http://www.w3.org/2000/svg", Pe = /* @__PURE__ */ new Set([
776
818
  "fill",
777
819
  "stroke",
778
820
  "d",
@@ -792,7 +834,7 @@ const E = "http://www.w3.org/2000/svg", Me = /* @__PURE__ */ new Set([
792
834
  "height",
793
835
  "viewBox",
794
836
  "preserveAspectRatio"
795
- ]), O = {
837
+ ]), x = {
796
838
  strokeWidth: "stroke-width",
797
839
  strokeLinecap: "stroke-linecap",
798
840
  strokeLinejoin: "stroke-linejoin",
@@ -803,7 +845,7 @@ const E = "http://www.w3.org/2000/svg", Me = /* @__PURE__ */ new Set([
803
845
  strokeOpacity: "stroke-opacity",
804
846
  borderRadius: "rx"
805
847
  // Map CSS borderRadius to SVG rx
806
- }, Se = /* @__PURE__ */ new Set([
848
+ }, ge = /* @__PURE__ */ new Set([
807
849
  "x",
808
850
  // Position x treated as translateX
809
851
  "y",
@@ -824,8 +866,8 @@ const E = "http://www.w3.org/2000/svg", Me = /* @__PURE__ */ new Set([
824
866
  "motionPathX",
825
867
  "motionPathY",
826
868
  "motionPathRotate"
827
- ]), Pe = /* @__PURE__ */ new Set(["clipTop", "clipRight", "clipBottom", "clipLeft"]);
828
- class Ge {
869
+ ]), Re = /* @__PURE__ */ new Set(["clipTop", "clipRight", "clipBottom", "clipLeft"]);
870
+ class Ve {
829
871
  targets = /* @__PURE__ */ new Map();
830
872
  /**
831
873
  * Register an SVG element as an animation target.
@@ -869,7 +911,7 @@ class Ge {
869
911
  const n = {}, a = {}, r = {};
870
912
  let l = !1;
871
913
  for (const [c, h] of t)
872
- c !== "drawOn" && (Se.has(c) ? i[c] = h : c === "quaternion" ? o = ee(h) : c === "originX" || c === "originY" ? typeof h == "number" && (n[c] = h) : c === "perspective" ? typeof h == "number" && (i.perspective = h) : Pe.has(c) ? typeof h == "number" && (a[c] = h) : te.has(c) ? (r[c] = h, l = !0) : c === "text" ? typeof h == "string" && ie(e, h) : c === "shine" ? typeof h == "number" && this.applyShine(e, h) : c === "opacity" ? (e.setAttribute("fill-opacity", String(h)), e.setAttribute("stroke-opacity", String(h))) : this.applyAttribute(e, c, h));
914
+ c !== "drawOn" && (ge.has(c) ? i[c] = h : c === "quaternion" ? o = ee(h) : c === "originX" || c === "originY" ? typeof h == "number" && (n[c] = h) : c === "perspective" ? typeof h == "number" && (i.perspective = h) : Re.has(c) ? typeof h == "number" && (a[c] = h) : te.has(c) ? (r[c] = h, l = !0) : c === "text" ? typeof h == "string" && ie(e, h) : c === "shine" ? typeof h == "number" && this.applyShine(e, h) : c === "opacity" ? (e.setAttribute("fill-opacity", String(h)), e.setAttribute("stroke-opacity", String(h))) : this.applyAttribute(e, c, h));
873
915
  if (Object.keys(i).length > 0 || o) {
874
916
  const c = this.buildCssTransformString(i, o);
875
917
  e.style.transform = c, oe(e);
@@ -930,12 +972,12 @@ class Ge {
930
972
  }
931
973
  applyAttribute(e, t, i) {
932
974
  let o = t;
933
- O[t] ? o = O[t] : Me.has(t) && (o = t);
975
+ x[t] ? o = x[t] : Pe.has(t) && (o = t);
934
976
  const n = Array.isArray(i) ? i.join(" ") : String(i);
935
977
  e.setAttribute(o, n);
936
978
  }
937
979
  }
938
- const ge = `
980
+ const Ae = `
939
981
  attribute vec2 a_position;
940
982
  attribute vec2 a_texCoord;
941
983
  uniform mat4 u_matrix;
@@ -945,7 +987,7 @@ void main() {
945
987
  gl_Position = u_matrix * vec4(a_position, 0.0, 1.0);
946
988
  v_texCoord = a_texCoord;
947
989
  }
948
- `, Re = `
990
+ `, ke = `
949
991
  precision mediump float;
950
992
  uniform vec4 u_color;
951
993
  uniform sampler2D u_texture;
@@ -956,7 +998,7 @@ void main() {
956
998
  vec4 color = u_useTexture ? texture2D(u_texture, v_texCoord) : u_color;
957
999
  gl_FragColor = vec4(color.rgb, color.a * u_opacity);
958
1000
  }
959
- `, Ae = /* @__PURE__ */ new Set([
1001
+ `, Ce = /* @__PURE__ */ new Set([
960
1002
  "x",
961
1003
  "y",
962
1004
  "width",
@@ -977,7 +1019,7 @@ void main() {
977
1019
  "motionPathY",
978
1020
  "motionPathRotate"
979
1021
  ]);
980
- class We {
1022
+ class ze {
981
1023
  gl;
982
1024
  program;
983
1025
  positionBuffer;
@@ -988,7 +1030,7 @@ class We {
988
1030
  basePositions = /* @__PURE__ */ new Map();
989
1031
  locations;
990
1032
  constructor(e) {
991
- this.gl = e, this.program = Ee(e, ge, Re), this.locations = {
1033
+ this.gl = e, this.program = Xe(e, Ae, ke), this.locations = {
992
1034
  position: e.getAttribLocation(this.program, "a_position"),
993
1035
  texCoord: e.getAttribLocation(this.program, "a_texCoord"),
994
1036
  matrix: e.getUniformLocation(this.program, "u_matrix"),
@@ -1036,7 +1078,7 @@ class We {
1036
1078
  e.rotate = o;
1037
1079
  return;
1038
1080
  }
1039
- if (Ae.has(i)) {
1081
+ if (Ce.has(i)) {
1040
1082
  e[i] = o;
1041
1083
  return;
1042
1084
  }
@@ -1053,12 +1095,12 @@ class We {
1053
1095
  drawTarget(e, t, i, o) {
1054
1096
  const n = this.gl;
1055
1097
  if (t.backfaceVisibility === "hidden" && G(V(t))) return;
1056
- const a = ke(t, i, o);
1098
+ const a = Ee(t, i, o);
1057
1099
  if (n.uniformMatrix4fv(this.locations.matrix, !1, a), n.uniform1f(this.locations.opacity, t.opacity ?? 1), t.texture)
1058
1100
  n.bindTexture(n.TEXTURE_2D, this.textureFor(e, t.texture)), n.uniform1i(this.locations.useTexture, 1), n.uniform1i(this.locations.texture, 0);
1059
1101
  else {
1060
1102
  n.uniform1i(this.locations.useTexture, 0);
1061
- const [r, l, c] = Ce(t.fill ?? "#ffffff");
1103
+ const [r, l, c] = Ie(t.fill ?? "#ffffff");
1062
1104
  n.uniform4f(this.locations.color, r, l, c, 1);
1063
1105
  }
1064
1106
  n.drawArrays(n.TRIANGLES, 0, 6);
@@ -1074,32 +1116,32 @@ class We {
1074
1116
  this.clearTargets(), this.gl.deleteProgram(this.program), this.gl.deleteBuffer(this.positionBuffer), this.gl.deleteBuffer(this.texCoordBuffer);
1075
1117
  }
1076
1118
  }
1077
- function Ne(s, e, t) {
1078
- const i = (s.scale ?? s.scaleX ?? 1) * s.width, o = (s.scale ?? s.scaleY ?? 1) * s.height, n = (s.originX ?? 50) / 100, a = (s.originY ?? 50) / 100, r = (s.rotate ?? 0) * Math.PI / 180, l = Math.cos(r), c = Math.sin(r), h = -n, f = -a, m = l * i, d = c * i, p = -c * o, u = l * o, y = s.x + m * h + p * f, w = s.y + d * h + u * f, T = 2 / e, M = -2 / t;
1119
+ function qe(s, e, t) {
1120
+ const i = (s.scale ?? s.scaleX ?? 1) * s.width, o = (s.scale ?? s.scaleY ?? 1) * s.height, n = (s.originX ?? 50) / 100, a = (s.originY ?? 50) / 100, r = (s.rotate ?? 0) * Math.PI / 180, l = Math.cos(r), c = Math.sin(r), h = -n, f = -a, m = l * i, d = c * i, p = -c * o, u = l * o, y = s.x + m * h + p * f, w = s.y + d * h + u * f, v = 2 / e, M = -2 / t;
1079
1121
  return new Float32Array([
1080
- m * T,
1122
+ m * v,
1081
1123
  d * M,
1082
1124
  0,
1083
- p * T,
1125
+ p * v,
1084
1126
  u * M,
1085
1127
  0,
1086
- y * T - 1,
1128
+ y * v - 1,
1087
1129
  w * M + 1,
1088
1130
  1
1089
1131
  ]);
1090
1132
  }
1091
1133
  function V(s) {
1092
- const e = (s.originX ?? 50) / 100, t = (s.originY ?? 50) / 100, i = { x: s.x, y: s.y }, o = v.multiply(
1093
- v.translation([s.x, s.y, 0]),
1094
- v.multiply(v.scaling([s.width, s.height, 1]), v.translation([-e, -t, 0]))
1134
+ const e = (s.originX ?? 50) / 100, t = (s.originY ?? 50) / 100, i = { x: s.x, y: s.y }, o = T.multiply(
1135
+ T.translation([s.x, s.y, 0]),
1136
+ T.multiply(T.scaling([s.width, s.height, 1]), T.translation([-e, -t, 0]))
1095
1137
  );
1096
- return v.multiply(D(s, { x: 0, y: 0 }, i), o);
1138
+ return T.multiply(D(s, { x: 0, y: 0 }, i), o);
1097
1139
  }
1098
- function ke(s, e, t) {
1140
+ function Ee(s, e, t) {
1099
1141
  const i = [2 / e, 0, 0, 0, 0, -2 / t, 0, 0, 0, 0, 0, 0, -1, 1, 0, 1];
1100
- return new Float32Array(v.multiply(i, V(s)));
1142
+ return new Float32Array(T.multiply(i, V(s)));
1101
1143
  }
1102
- function Ce(s) {
1144
+ function Ie(s) {
1103
1145
  const e = s.trim().replace("#", "");
1104
1146
  return e.length === 3 ? [
1105
1147
  Number.parseInt(e[0] + e[0], 16) / 255,
@@ -1111,7 +1153,7 @@ function Ce(s) {
1111
1153
  Number.parseInt(e.slice(4, 6), 16) / 255
1112
1154
  ] : [1, 1, 1];
1113
1155
  }
1114
- function Ee(s, e, t) {
1156
+ function Xe(s, e, t) {
1115
1157
  const i = s.createProgram();
1116
1158
  if (!i) throw new Error("WebGLAdapter: could not create a program");
1117
1159
  if (s.attachShader(i, B(s, s.VERTEX_SHADER, e)), s.attachShader(i, B(s, s.FRAGMENT_SHADER, t)), s.linkProgram(i), !s.getProgramParameter(i, s.LINK_STATUS))
@@ -1134,43 +1176,46 @@ function F(s, e, t) {
1134
1176
  t < 0 || (s.bindBuffer(s.ARRAY_BUFFER, e), s.enableVertexAttribArray(t), s.vertexAttribPointer(t, 2, s.FLOAT, !1, 0, 0));
1135
1177
  }
1136
1178
  export {
1137
- qe as CANVAS_PROPERTIES,
1138
- I as CanvasAdapter,
1139
- Ve as DOMAdapter,
1140
- Ze as IDENTITY_CAMERA,
1141
- Ge as SVGAdapter,
1142
- We as WebGLAdapter,
1143
- je as animatableProperties,
1144
- Ye as applyBloom,
1145
- Je as applyCamera,
1146
- Le as applyZoomBlur,
1147
- ot as boilFrame,
1148
- Y as boxBlur,
1149
- ye as brightPass,
1150
- pe as buildFlipTracks,
1151
- Qe as cameraFromValues,
1152
- Ke as cameraPoint,
1153
- k as canvasLike,
1154
- et as checkTracks,
1155
- tt as describeTarget,
1156
- Fe as drawDiveLines,
1157
- De as drawIsometricFaces,
1179
+ Ke as CANVAS_PROPERTIES,
1180
+ X as CanvasAdapter,
1181
+ Je as DOMAdapter,
1182
+ et as IDENTITY_CAMERA,
1183
+ Ve as SVGAdapter,
1184
+ ze as WebGLAdapter,
1185
+ tt as animatableProperties,
1186
+ Be as applyBloom,
1187
+ it as applyCamera,
1188
+ De as applyZoomBlur,
1189
+ lt as boilFrame,
1190
+ O as boxBlur,
1191
+ be as brightPass,
1192
+ ye as buildFlipTracks,
1193
+ ot as cameraFromValues,
1194
+ st as cameraPoint,
1195
+ S as canvasLike,
1196
+ nt as checkTracks,
1197
+ rt as describeTarget,
1198
+ Ge as drawDiveLines,
1199
+ We as drawIsometricFaces,
1200
+ Ne as drawLetterbox,
1158
1201
  C as drawOutline,
1159
- Oe as drawTrail,
1160
- _e as flip,
1161
- $e as isGradient,
1162
- Be as nestedZoom,
1163
- Te as nestedZoomTransform,
1164
- Ce as parseColor,
1165
- fe as partialPath,
1166
- st as pathLength,
1167
- x as pathOutline,
1168
- nt as pointAlong,
1169
- Ne as quadMatrix,
1170
- ke as quadMatrix3d,
1171
- ue as recordFlipState,
1172
- me as rectOutline,
1202
+ Ue as drawSafeAreas,
1203
+ Le as drawTrail,
1204
+ He as drawTransition,
1205
+ Oe as flip,
1206
+ xe as isGradient,
1207
+ Fe as nestedZoom,
1208
+ Se as nestedZoomTransform,
1209
+ Ie as parseColor,
1210
+ ue as partialPath,
1211
+ ct as pathLength,
1212
+ I as pathOutline,
1213
+ ht as pointAlong,
1214
+ qe as quadMatrix,
1215
+ Ee as quadMatrix3d,
1216
+ me as recordFlipState,
1217
+ we as rectOutline,
1173
1218
  ie as setTextContent,
1174
- de as sketchPen,
1175
- be as trailQuads
1219
+ pe as sketchPen,
1220
+ ve as trailQuads
1176
1221
  };