@algorisys/tinyfly 0.112.0 → 0.114.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,12 @@
1
- import { H as we, w as bt, R as ce, x as Pe, y as Xt, z as on, A as at, B as ta, D as ye, E as oa, F as zo, G as nn, I as na, J as sa, K as Gs, L as sn, M as Ys, N as ra, O as aa, P as ia, Q as _e, S as la, T as Ke, U as Us, V as Xs, W as Pn, X as ha, Y as xe, Z as Le, _ as Oe, $ as ca, a0 as da, a1 as fa, a2 as Vs, a3 as Ae, a4 as $e, a5 as Js, a6 as ua, a7 as Lo, a8 as je, a9 as Zs, aa as ga, ab as pa, ac as Qs, ad as ma, ae as ya, af as ba, ag as wa, ah as ka, h as va, g as Sa, i as Ma, e as $a, c as Ea, b as Aa, d as Ta, C as Pa, ai as Oa, aj as Ha, ak as Ia, al as xa, am as ja, an as _a, ao as Ka } from "./cricket-play-Zm5cghdV.js";
2
- import { ap as Mf, aq as $f, ar as Ef, as as Af, at as Tf, au as Pf, av as Of, aw as Hf, ax as If, ay as xf, az as jf, aA as _f, aB as Kf, aC as Nf, aD as Cf, aE as Rf, aF as Wf, aG as zf, aH as Lf, aI as Ff, aJ as Df, aK as qf, aL as Bf, aM as Gf, aN as Yf, aO as Uf, aP as Xf, aQ as Vf, aR as Jf, aS as Zf, aT as Qf, aU as eu, aV as tu, aW as ou, aX as nu, aY as su, aZ as ru, a_ as au, a$ as iu, b0 as lu, b1 as hu, b2 as cu, b3 as du, b4 as fu, b5 as uu, b6 as gu, b7 as pu, b8 as mu, b9 as yu, ba as bu, bb as wu, bc as ku, bd as vu, be as Su, bf as Mu, bg as $u, bh as Eu, bi as Au, bj as Tu } from "./cricket-play-Zm5cghdV.js";
1
+ import { H as we, A as bt, R as ce, B as Pe, D as Xt, E as on, F as at, G as ta, I as ye, J as oa, K as zo, L as nn, M as na, N as sa, O as Gs, P as sn, Q as Ys, S as ra, T as aa, U as ia, V as _e, W as la, X as Ke, Y as Us, Z as Xs, _ as Pn, $ as ha, a0 as xe, a1 as Le, a2 as Oe, a3 as ca, a4 as da, a5 as fa, a6 as Vs, a7 as Ae, a8 as $e, a9 as Js, aa as ua, ab as Lo, ac as je, ad as Zs, ae as ga, af as pa, ag as Qs, ah as ma, ai as ya, aj as ba, ak as wa, al as ka, i as va, h as Sa, c as Ma, j as $a, f as Ea, d as Aa, b as Ta, e as Pa, C as Oa, am as Ha, an as Ia, ao as xa, ap as ja, aq as _a, ar as Ka, as as Ca, at as Na } from "./cricket-play-BZNhfgOK.js";
2
+ import { au as Ef, av as Af, aw as Tf, ax as Pf, ay as Of, az as Hf, aA as If, aB as xf, aC as jf, aD as _f, aE as Kf, aF as Cf, aG as Nf, aH as Rf, aI as Wf, aJ as zf, aK as Lf, aL as Ff, aM as Df, aN as qf, aO as Bf, aP as Gf, aQ as Yf, aR as Uf, aS as Xf, aT as Vf, aU as Jf, aV as Zf, aW as Qf, aX as eu, aY as tu, aZ as ou, a_ as nu, a$ as su, b0 as ru, b1 as au, b2 as iu, b3 as lu, b4 as hu, b5 as cu, b6 as du, b7 as fu, b8 as uu, b9 as gu, ba as pu, bb as mu, bc as yu, bd as bu, be as wu, bf as ku, bg as vu, bh as Su, bi as Mu, bj as $u, bk as Eu, bl as Au, bm as Tu, bn as Pu, bo as Ou, bp as Hu, bq as Iu, br as xu } from "./cricket-play-BZNhfgOK.js";
3
3
  import { getEasingFunction as mt, hashSeed as Fe, mat4 as ne, vec3 as ke, quat as We, Timeline as ve, unknownName as fe, createRandom as rn, springFollow as Bt, closestName as Fo } from "@algorisys/tinyfly";
4
- import { f as Vt, h as Na, a as er } from "./load-scene-oWNsYYC1.js";
4
+ import { f as Vt, h as Ra, a as er } from "./load-scene-oWNsYYC1.js";
5
5
  import { l as tr, f as or } from "./shading-0lPgnXmD.js";
6
- import { s as Ca, p as nr, b as an } from "./sketch-CYPUbk3Q.js";
7
- import { c as Ou, a as Hu } from "./sketch-CYPUbk3Q.js";
8
- import { C as Ra } from "./target-properties-BtN9skb-.js";
9
- import { I as xu, a as ju, b as _u, c as Ku, d as Nu, e as Cu, f as Ru } from "./target-properties-BtN9skb-.js";
6
+ import { s as Wa, p as nr, b as an } from "./sketch-CYPUbk3Q.js";
7
+ import { c as _u, a as Ku } from "./sketch-CYPUbk3Q.js";
8
+ import { C as za } from "./target-properties-BtN9skb-.js";
9
+ import { I as Nu, a as Ru, b as Wu, c as zu, d as Lu, e as Fu, f as Du } from "./target-properties-BtN9skb-.js";
10
10
  const bo = 0.5, Do = {
11
11
  /** Flag: fingers together and straight, thumb bent in */
12
12
  pataka: bt({ "thumb.curl": 0.3, "thumb.across": 0.6, "index.curl": 0, "middle.curl": 0, "ring.curl": 0, "pinky.curl": 0, spread: 0, turn: 2 }),
@@ -41,7 +41,7 @@ function sr(e, t, o) {
41
41
  return n;
42
42
  }
43
43
  const ln = (e, t) => (e % t + t) % t;
44
- function Wa(e, t, o, n) {
44
+ function La(e, t, o, n) {
45
45
  const a = sr(e, o, n);
46
46
  if (a.length === 0) return { pose: o, hands: n };
47
47
  const r = ln(t, e.beats);
@@ -53,7 +53,7 @@ function Wa(e, t, o, n) {
53
53
  hands: { left: Xt(i.left, h.left, f), right: Xt(i.right, h.right, f) }
54
54
  };
55
55
  }
56
- const za = [
56
+ const Fa = [
57
57
  ["leftShoulder", "rightShoulder"],
58
58
  ["leftElbow", "rightElbow"],
59
59
  ["leftWrist", "rightWrist"],
@@ -63,19 +63,19 @@ const za = [
63
63
  ["leftFootOut", "rightFootOut"],
64
64
  ["leftEye", "rightEye"],
65
65
  ["leftBrow", "rightBrow"]
66
- ], La = ["lean", "headTilt", "lookX", "spin"], Fa = /* @__PURE__ */ new Set(["leftShoulder", "rightShoulder", "leftElbow", "rightElbow", "leftWrist", "rightWrist", "leftHip", "rightHip", "leftKnee", "rightKnee"]);
67
- function Da(e) {
66
+ ], Da = ["lean", "headTilt", "lookX", "spin"], qa = /* @__PURE__ */ new Set(["leftShoulder", "rightShoulder", "leftElbow", "rightElbow", "leftWrist", "rightWrist", "leftHip", "rightHip", "leftKnee", "rightKnee"]);
67
+ function Ba(e) {
68
68
  const t = { ...e }, o = (e.turn ?? 0) >= 0.5;
69
- for (const [n, a] of za) {
70
- const r = o && Fa.has(n) ? -1 : 1;
69
+ for (const [n, a] of Fa) {
70
+ const r = o && qa.has(n) ? -1 : 1;
71
71
  t[n] = r * e[a], t[a] = r * e[n];
72
72
  }
73
- if (!o) for (const n of La) t[n] = -e[n];
73
+ if (!o) for (const n of Da) t[n] = -e[n];
74
74
  return t;
75
75
  }
76
- const qa = (e) => Math.min(1, Math.max(-1, (0.5 - e) * 4));
77
- function Ba(e, t, o) {
78
- const n = ln(o, 1), a = (1 + Math.cos(2 * Math.PI * n)) / 2, r = t.bounce * (t.accent === "up" ? 1 - a : a), s = Math.min(1, Math.max(0, e.turn ?? 0)), i = qa(s);
76
+ const Ga = (e) => Math.min(1, Math.max(-1, (0.5 - e) * 4));
77
+ function Ya(e, t, o) {
78
+ const n = ln(o, 1), a = (1 + Math.cos(2 * Math.PI * n)) / 2, r = t.bounce * (t.accent === "up" ? 1 - a : a), s = Math.min(1, Math.max(0, e.turn ?? 0)), i = Ga(s);
79
79
  return {
80
80
  ...e,
81
81
  leftHip: e.leftHip + i * r / 2,
@@ -98,8 +98,8 @@ function rr(e) {
98
98
  function wo(e, t, o) {
99
99
  const n = e.moves[t.move];
100
100
  if (!n) throw new Error(`dance: "${e.label}" has no move "${t.move}"`);
101
- const a = Wa(n, o, qo(e), rr(e));
102
- return t.mirror ? { pose: Da(a.pose), hands: { left: a.hands?.right, right: a.hands?.left } } : a;
101
+ const a = La(n, o, qo(e), rr(e));
102
+ return t.mirror ? { pose: Ba(a.pose), hands: { left: a.hands?.right, right: a.hands?.left } } : a;
103
103
  }
104
104
  function hn(e, t, o = {}) {
105
105
  const n = typeof e == "string" ? Je[e] : e;
@@ -119,24 +119,24 @@ function hn(e, t, o = {}) {
119
119
  };
120
120
  }
121
121
  }
122
- return { ...a, pose: Ba(a.pose, n.groove, t) };
122
+ return { ...a, pose: Ya(a.pose, n.groove, t) };
123
123
  }
124
- function bd(e, t, o = {}) {
124
+ function kd(e, t, o = {}) {
125
125
  return hn(e, t, o).pose;
126
126
  }
127
127
  function cn(e) {
128
128
  return (typeof e == "string" ? Je[e] : e).routine.reduce((o, n) => o + n.beats, 0);
129
129
  }
130
- const Ga = { leftToe: "rightToe", rightToe: "leftToe", leftHeel: "rightHeel", rightHeel: "leftHeel" };
130
+ const Ua = { leftToe: "rightToe", rightToe: "leftToe", leftHeel: "rightHeel", rightHeel: "leftHeel" };
131
131
  function On(e, t, o, n, a, r, s) {
132
132
  for (let i = 0; i * e.beats < o; i++)
133
133
  for (const h of e.keys) {
134
134
  const c = i * e.beats + h.beat, l = t + c;
135
135
  if (!(c >= o || l < r || l >= s))
136
- for (const d of h.taps ?? []) a.push({ beat: l, tap: n ? Ga[d] : d });
136
+ for (const d of h.taps ?? []) a.push({ beat: l, tap: n ? Ua[d] : d });
137
137
  }
138
138
  }
139
- function wd(e, t, o, n = {}) {
139
+ function vd(e, t, o, n = {}) {
140
140
  const a = typeof e == "string" ? Je[e] : e, r = [];
141
141
  if (o <= t) return r;
142
142
  if (n.move) {
@@ -170,18 +170,18 @@ function ko(e, t, o = {}) {
170
170
  }
171
171
  return h;
172
172
  }
173
- function Ya(e, t, o) {
173
+ function Xa(e, t, o) {
174
174
  const n = ar(e, o), a = [0];
175
175
  let r = 0;
176
176
  for (let s = 0; r < t; s = (s + 1) % n.length)
177
177
  r += n[s].beats, a.push(Math.min(r, t));
178
178
  return a;
179
179
  }
180
- const Ua = 8;
181
- function Xa(e, t, o) {
182
- const n = typeof t == "string" ? Je[t] : t, a = o.bpm ?? n.bpm, r = o.beats ?? (o.move ? n.moves[o.move].beats : cn(n)), s = Ya(n, r, o);
180
+ const Va = 8;
181
+ function Ja(e, t, o) {
182
+ const n = typeof t == "string" ? Je[t] : t, a = o.bpm ?? n.bpm, r = o.beats ?? (o.move ? n.moves[o.move].beats : cn(n)), s = Xa(n, r, o);
183
183
  if (s.every((T) => ko(n, T, o) === 0)) return;
184
- const i = Math.min(o.fade ?? 1, r / 2), h = mt("ease-in-out"), c = (T) => i <= 0 ? 1 : Math.min(h(Math.min(1, T / i)), h(Math.min(1, (r - T) / i))), l = Math.ceil(i * Ua), d = i <= 0 ? [] : Array.from({ length: l + 1 }, (T, H) => [H / l * i, r - H / l * i]).flat(), f = [.../* @__PURE__ */ new Set([...s, ...d])].sort((T, H) => T - H);
184
+ const i = Math.min(o.fade ?? 1, r / 2), h = mt("ease-in-out"), c = (T) => i <= 0 ? 1 : Math.min(h(Math.min(1, T / i)), h(Math.min(1, (r - T) / i))), l = Math.ceil(i * Va), d = i <= 0 ? [] : Array.from({ length: l + 1 }, (T, H) => [H / l * i, r - H / l * i]).flat(), f = [.../* @__PURE__ */ new Set([...s, ...d])].sort((T, H) => T - H);
185
185
  let u = 0;
186
186
  const p = f.map((T, H) => {
187
187
  if (H > 0) {
@@ -200,13 +200,13 @@ function Xa(e, t, o) {
200
200
  keyframes: p.map((T) => ({ time: g + T.beat * 6e4 / a, value: b + o.height * T.travel, easing: "linear" }))
201
201
  };
202
202
  }
203
- function kd(e, t, o = 0) {
203
+ function Sd(e, t, o = 0) {
204
204
  return (e - o) * t / 6e4;
205
205
  }
206
- function vd(e, t = {}) {
206
+ function Md(e, t = {}) {
207
207
  return (o) => hn(e, o, t);
208
208
  }
209
- function Sd(e, t) {
209
+ function $d(e, t) {
210
210
  const o = t.start ?? 0, n = 6e4 / t.bpm, a = o + t.beats * n, r = Math.min((t.fade ?? 1) * n, (a - o) / 2);
211
211
  return [
212
212
  {
@@ -231,7 +231,7 @@ function Sd(e, t) {
231
231
  }
232
232
  ];
233
233
  }
234
- function Md(e, t, o = {}) {
234
+ function Ed(e, t, o = {}) {
235
235
  const n = typeof t == "string" ? Je[t] : t, a = o.bpm ?? n.bpm, r = o.beats ?? (o.move ? n.moves[o.move].beats : cn(n)), s = o.samplesPerBeat ?? 4, i = o.start ?? 0, h = Math.round(r * s), c = Array.from({ length: h + 1 }, (g, b) => {
236
236
  const T = b / s;
237
237
  return { time: i + T * 6e4 / a, frame: hn(n, T, o) };
@@ -240,7 +240,7 @@ function Md(e, t, o = {}) {
240
240
  target: e,
241
241
  property: g,
242
242
  keyframes: c.map((T) => ({ time: T.time, value: b(T.frame) }))
243
- }), f = Object.keys(ce).filter((g) => c.some((b) => b.frame.pose[g] !== c[0].frame.pose[g]) || c[0].frame.pose[g] !== ce[g]).map((g) => l(g, (b) => b.pose[g])), u = o.height === void 0 ? void 0 : Xa(e, n, { ...o, bpm: a, beats: r, start: i, height: o.height, fade: 0 });
243
+ }), f = Object.keys(ce).filter((g) => c.some((b) => b.frame.pose[g] !== c[0].frame.pose[g]) || c[0].frame.pose[g] !== ce[g]).map((g) => l(g, (b) => b.pose[g])), u = o.height === void 0 ? void 0 : Ja(e, n, { ...o, bpm: a, beats: r, start: i, height: o.height, fade: 0 });
244
244
  if (u && f.push(u), o.hands === !1) return f;
245
245
  const p = [];
246
246
  for (const g of ["left", "right"])
@@ -250,7 +250,7 @@ function Md(e, t, o = {}) {
250
250
  }
251
251
  return [...f, ...p];
252
252
  }
253
- const $t = { type: "back", mode: "out", overshoot: 1.1 }, Se = "ease-out-cubic", Va = {
253
+ const $t = { type: "back", mode: "out", overshoot: 1.1 }, Se = "ease-out-cubic", Za = {
254
254
  label: "Disco",
255
255
  bpm: 120,
256
256
  stance: { leftHip: 10, rightHip: 10, leftKnee: 6, rightKnee: 6 },
@@ -298,7 +298,7 @@ const $t = { type: "back", mode: "out", overshoot: 1.1 }, Se = "ease-out-cubic",
298
298
  { move: "point", beats: 8, mirror: !0 },
299
299
  { move: "bump", beats: 8 }
300
300
  ]
301
- }, Ja = {
301
+ }, Qa = {
302
302
  label: "Hip hop",
303
303
  bpm: 95,
304
304
  stance: { leftHip: 14, rightHip: 14, leftKnee: 20, rightKnee: 20, leftShoulder: 22, rightShoulder: 22, leftElbow: -30, rightElbow: -30, leftFootOut: 0.15, rightFootOut: 0.15 },
@@ -350,7 +350,7 @@ const $t = { type: "back", mode: "out", overshoot: 1.1 }, Se = "ease-out-cubic",
350
350
  { move: "armWave", beats: 8 },
351
351
  { move: "bounce", beats: 4 }
352
352
  ]
353
- }, Za = {
353
+ }, ei = {
354
354
  label: "Breaking (toprock)",
355
355
  bpm: 110,
356
356
  stance: { leftHip: 14, rightHip: 14, leftKnee: 14, rightKnee: 14, leftShoulder: 35, rightShoulder: 35, leftElbow: -90, rightElbow: -90 },
@@ -392,7 +392,7 @@ const $t = { type: "back", mode: "out", overshoot: 1.1 }, Se = "ease-out-cubic",
392
392
  { move: "kick", beats: 4, mirror: !0 },
393
393
  { move: "freeze", beats: 4 }
394
394
  ]
395
- }, Qa = {
395
+ }, ti = {
396
396
  label: "Jazz",
397
397
  bpm: 130,
398
398
  stance: { leftHip: 10, rightHip: 10 },
@@ -453,7 +453,7 @@ const $t = { type: "back", mode: "out", overshoot: 1.1 }, Se = "ease-out-cubic",
453
453
  { move: "jazzHands", beats: 4 },
454
454
  { move: "splitDrop", beats: 8 }
455
455
  ]
456
- }, ei = {
456
+ }, oi = {
457
457
  label: "K-pop",
458
458
  bpm: 125,
459
459
  stance: { leftHip: 9, rightHip: 9, leftKnee: 4, rightKnee: 4 },
@@ -500,7 +500,7 @@ const $t = { type: "back", mode: "out", overshoot: 1.1 }, Se = "ease-out-cubic",
500
500
  { move: "pointCombo", beats: 8, mirror: !0 },
501
501
  { move: "isolations", beats: 4 }
502
502
  ]
503
- }, ti = {
503
+ }, ni = {
504
504
  label: "Bollywood",
505
505
  bpm: 120,
506
506
  stance: { leftHip: 10, rightHip: 10 },
@@ -545,7 +545,7 @@ const $t = { type: "back", mode: "out", overshoot: 1.1 }, Se = "ease-out-cubic",
545
545
  { move: "thumka", beats: 4, mirror: !0 },
546
546
  { move: "lightBulb", beats: 8, mirror: !0 }
547
547
  ]
548
- }, oi = {
548
+ }, si = {
549
549
  label: "Bhangra",
550
550
  bpm: 100,
551
551
  stance: { leftShoulder: 150, rightShoulder: 150, leftElbow: 18, rightElbow: 18, leftHip: 10, rightHip: 10 },
@@ -580,11 +580,11 @@ const $t = { type: "back", mode: "out", overshoot: 1.1 }, Se = "ease-out-cubic",
580
580
  { move: "basic", beats: 8 },
581
581
  { move: "dhamaal", beats: 4 }
582
582
  ]
583
- }, ni = { leftHip: 42, rightHip: 42, leftKnee: 82, rightKnee: 82, leftFootOut: 0.3, rightFootOut: 0.3 }, si = {
583
+ }, ri = { leftHip: 42, rightHip: 42, leftKnee: 82, rightKnee: 82, leftFootOut: 0.3, rightFootOut: 0.3 }, ai = {
584
584
  label: "Bharatanatyam",
585
585
  bpm: 80,
586
586
  // Natyarambhe: arms out at shoulder height, hands raised in pataka.
587
- stance: { ...ni, leftShoulder: 90, rightShoulder: 90, leftElbow: 0, rightElbow: 0, leftWrist: 75, rightWrist: 75 },
587
+ stance: { ...ri, leftShoulder: 90, rightShoulder: 90, leftElbow: 0, rightElbow: 0, leftWrist: 75, rightWrist: 75 },
588
588
  expression: { smile: 0.5, leftEye: 1.2, rightEye: 1.2, leftBrow: 0.3, rightBrow: 0.3 },
589
589
  hands: { left: "pataka", right: "pataka" },
590
590
  groove: { bounce: 0 },
@@ -626,7 +626,7 @@ const $t = { type: "back", mode: "out", overshoot: 1.1 }, Se = "ease-out-cubic",
626
626
  { move: "alapadma", beats: 8 },
627
627
  { move: "tatta", beats: 4 }
628
628
  ]
629
- }, ri = {
629
+ }, ii = {
630
630
  label: "Charleston",
631
631
  bpm: 150,
632
632
  stance: { leftHip: 10, rightHip: 10, leftKnee: 10, rightKnee: 10, leftShoulder: 30, rightShoulder: 30, leftElbow: 20, rightElbow: 20 },
@@ -676,7 +676,7 @@ const $t = { type: "back", mode: "out", overshoot: 1.1 }, Se = "ease-out-cubic",
676
676
  { move: "basic", beats: 8, mirror: !0 },
677
677
  { move: "twist", beats: 4 }
678
678
  ]
679
- }, ai = {
679
+ }, li = {
680
680
  label: "Tap",
681
681
  bpm: 120,
682
682
  // Three-quarters to side-on, so shuffles read as brushes forward and back. Side-on,
@@ -774,7 +774,7 @@ const $t = { type: "back", mode: "out", overshoot: 1.1 }, Se = "ease-out-cubic",
774
774
  { move: "heelToe", beats: 8 },
775
775
  { move: "crampRoll", beats: 4 }
776
776
  ]
777
- }, ii = {
777
+ }, hi = {
778
778
  label: "Popping (glides, moonwalk)",
779
779
  bpm: 100,
780
780
  stance: { leftHip: 9, rightHip: 9, leftShoulder: 16, rightShoulder: 16, leftElbow: -24, rightElbow: -24 },
@@ -848,18 +848,18 @@ const $t = { type: "back", mode: "out", overshoot: 1.1 }, Se = "ease-out-cubic",
848
848
  { move: "toeStand", beats: 4 }
849
849
  ]
850
850
  }, Je = {
851
- disco: Va,
852
- hipHop: Ja,
853
- breaking: Za,
854
- jazz: Qa,
855
- kpop: ei,
856
- bollywood: ti,
857
- bhangra: oi,
858
- bharatanatyam: si,
859
- charleston: ri,
860
- tap: ai,
861
- popping: ii
862
- }, it = (e, t) => (e % t + t) % t, In = (e) => e * e * (3 - 2 * e), li = (e) => Object.fromEntries(
851
+ disco: Za,
852
+ hipHop: Qa,
853
+ breaking: ei,
854
+ jazz: ti,
855
+ kpop: oi,
856
+ bollywood: ni,
857
+ bhangra: si,
858
+ bharatanatyam: ai,
859
+ charleston: ii,
860
+ tap: li,
861
+ popping: hi
862
+ }, it = (e, t) => (e % t + t) % t, In = (e) => e * e * (3 - 2 * e), ci = (e) => Object.fromEntries(
863
863
  ["left", "right"].flatMap((t) => Object.entries(we[e]).map(([o, n]) => [`hand.${t}.${o}`, n]))
864
864
  );
865
865
  function vo(e, t = !1) {
@@ -885,7 +885,7 @@ function vo(e, t = !1) {
885
885
  "arm.left.bend": -35 * f,
886
886
  "arm.right.bend": -35 * f,
887
887
  smile: 0.9,
888
- ...li(t ? "hold" : "spread")
888
+ ...ci(t ? "hold" : "spread")
889
889
  };
890
890
  if (!t)
891
891
  for (const p of Object.keys(a)) p.startsWith("arm.") && (u[p] += (a[p] - u[p]) * f);
@@ -917,7 +917,7 @@ function Zt(e, t, o = ye) {
917
917
  const f = Math.floor(t), u = t - f, p = u <= 0.6 ? 1 : 1 - In((u - 0.6) / 0.4), g = Math.max(0, ...n.strikes.map((b) => 1 - Math.min(it(a - b, n.beats), it(b - a, n.beats)) / 0.25));
918
918
  return { pose: d, contact: { side: it(f, 2) === 0 ? "left" : "right", start: f, weight: p }, strike: g };
919
919
  }
920
- function $d(e, t) {
920
+ function Ad(e, t) {
921
921
  const o = ir(t.style), n = t.bpm ?? o.bpm, a = t.beats ?? o.beats, r = t.samplesPerBeat ?? 16;
922
922
  if (![n, a, r].every((h) => Number.isFinite(h) && h > 0)) throw new Error("humanDanceTracks: bpm, beats and samplesPerBeat must be positive and finite");
923
923
  if (!Number.isFinite(t.start ?? 0)) throw new Error("humanDanceTracks: start must be finite");
@@ -937,7 +937,7 @@ function hr(e, t, o) {
937
937
  const n = lo(e.pose), a = fn(e).hip, r = na(e.character.plan, n, e.character.height), s = Te(Te(o, e.position), a), i = sa(s, (n.roll ?? 0) * Math.PI / 180), h = io(r.root, Gs(i, -(n.turn ?? 0) * Math.PI / 2));
938
938
  return zo(e.character.plan, n, t, h, { height: e.character.height });
939
939
  }
940
- function hi(e, t, o, n = "toe") {
940
+ function di(e, t, o, n = "toe") {
941
941
  const a = `leg.${t}`, r = n === "toe" ? 3 : 2;
942
942
  let s = { ...e, pose: lo(e.pose), position: [...e.position] };
943
943
  for (let h = 0; h < 6; h++) {
@@ -953,7 +953,7 @@ function xn(e, t) {
953
953
  const o = ut(e, `arm.${t}`, 2), n = ut(e, `arm.${t}`, 1);
954
954
  return io(o, Qt(lr(Te(o, n)), e.character.lineWidth * 0.5));
955
955
  }
956
- function Ed(e, t, o = {}) {
956
+ function Td(e, t, o = {}) {
957
957
  const n = Math.min(e.character.height, t.character.height), a = o.length ?? n * 0.22;
958
958
  if (!(a > 0) || !Number.isFinite(a)) throw new Error("meetDandiya: stick length must be positive and finite");
959
959
  const r = o.point ?? [(e.position[0] + t.position[0]) / 2, Math.max(e.position[1], t.position[1]) + n * 0.62, (e.position[2] + t.position[2]) / 2], s = (c, l) => {
@@ -975,7 +975,7 @@ function Ed(e, t, o = {}) {
975
975
  reached: [i.stick, h.stick].every((c) => dn(Te(c.tip, r)) < n * 2e-3)
976
976
  };
977
977
  }
978
- function ci(e, t) {
978
+ function fi(e, t) {
979
979
  const o = t.count ?? 8, n = t.beatsPerTurn ?? 32;
980
980
  if (!Number.isFinite(e) || !Number.isFinite(t.radius) || t.radius <= 0 || !Number.isInteger(o) || o < 1 || !Number.isFinite(n) || n <= 0) throw new Error("danceCircleAt: finite beat, positive radius/beatsPerTurn and a positive integer count are required");
981
981
  const a = t.center ?? [0, 0], r = t.direction ?? 1;
@@ -987,7 +987,7 @@ function ci(e, t) {
987
987
  return Array.from({ length: o }, (l, d) => {
988
988
  const f = h(e, d);
989
989
  if (t.plantFeet === !1) return { ...f, planted: !1 };
990
- const u = h(c.start, d), p = ut(u, `leg.${c.side}`, 3), g = hi(f, c.side, p);
990
+ const u = h(c.start, d), p = ut(u, `leg.${c.side}`, 3), g = di(f, c.side, p);
991
991
  return {
992
992
  ...f,
993
993
  pose: Ys(f.pose, g.pose, c.weight),
@@ -996,12 +996,12 @@ function ci(e, t) {
996
996
  };
997
997
  });
998
998
  }
999
- function Ad(e, t) {
999
+ function Pd(e, t) {
1000
1000
  if (t.count !== void 0 && t.count !== e.length) throw new Error("danceCircleTracks: count must match targets.length");
1001
1001
  const o = t.bpm ?? 120, n = t.samplesPerBeat ?? 16;
1002
1002
  if (!e.length || ![o, t.beats, n].every((h) => Number.isFinite(h) && h > 0)) throw new Error("danceCircleTracks: targets and positive finite bpm, beats and samplesPerBeat are required");
1003
1003
  if (!Number.isFinite(t.start ?? 0)) throw new Error("danceCircleTracks: start must be finite");
1004
- const a = Math.max(1, Math.ceil(t.beats * n)), r = Array.from({ length: a + 1 }, (h, c) => ({ time: (t.start ?? 0) + t.beats * c / a * 6e4 / o, members: ci(t.beats * c / a, { ...t, count: e.length }) })), s = r.some((h) => h.members.some((c) => c.pose.roll !== 0)), i = /* @__PURE__ */ new Set(["x", "y", "z", "rotateY", ...s ? ["turn", "roll"] : []]);
1004
+ const a = Math.max(1, Math.ceil(t.beats * n)), r = Array.from({ length: a + 1 }, (h, c) => ({ time: (t.start ?? 0) + t.beats * c / a * 6e4 / o, members: fi(t.beats * c / a, { ...t, count: e.length }) })), s = r.some((h) => h.members.some((c) => c.pose.roll !== 0)), i = /* @__PURE__ */ new Set(["x", "y", "z", "rotateY", ...s ? ["turn", "roll"] : []]);
1005
1005
  return e.flatMap((h, c) => {
1006
1006
  const l = r.map((d) => {
1007
1007
  const f = d.members[c], { turn: u, ...p } = f.pose;
@@ -1016,7 +1016,7 @@ function Ad(e, t) {
1016
1016
  });
1017
1017
  }
1018
1018
  const eo = (e) => Math.min(1, Math.max(0, e));
1019
- function di(e) {
1019
+ function ui(e) {
1020
1020
  const t = { ...ce, turn: e.view }, o = [];
1021
1021
  for (const n of e.keys) {
1022
1022
  const a = o[o.length - 1], r = !a || n.reset ? t : a.pose;
@@ -1024,33 +1024,33 @@ function di(e) {
1024
1024
  }
1025
1025
  return o;
1026
1026
  }
1027
- function fi(e) {
1028
- return e - ui * Math.sin(2 * Math.PI * e) / (2 * Math.PI);
1027
+ function gi(e) {
1028
+ return e - pi * Math.sin(2 * Math.PI * e) / (2 * Math.PI);
1029
1029
  }
1030
- const ui = 0.5;
1031
- function gi(e, t) {
1030
+ const pi = 0.5;
1031
+ function mi(e, t) {
1032
1032
  if (!(t <= e.takeoff || t >= e.landing))
1033
1033
  return (t - e.takeoff) / (e.landing - e.takeoff);
1034
1034
  }
1035
- function pi(e, t) {
1036
- const o = typeof e == "string" ? ho[e] : e, n = di(o), a = eo(t);
1035
+ function yi(e, t) {
1036
+ const o = typeof e == "string" ? ho[e] : e, n = ui(o), a = eo(t);
1037
1037
  let r = 0;
1038
1038
  for (let d = 0; d < n.length; d++) n[d].at <= a && (r = d);
1039
- const s = n[r], i = n[Math.min(r + 1, n.length - 1)], h = i.at > s.at ? (a - s.at) / (i.at - s.at) : 0, c = on(s.pose, i.pose, mt(i.easing ?? "ease-in-out")(eo(h))), l = gi(o, a);
1039
+ const s = n[r], i = n[Math.min(r + 1, n.length - 1)], h = i.at > s.at ? (a - s.at) / (i.at - s.at) : 0, c = on(s.pose, i.pose, mt(i.easing ?? "ease-in-out")(eo(h))), l = mi(o, a);
1040
1040
  return l === void 0 ? { ...c, spin: 0, rise: 0 } : {
1041
1041
  ...c,
1042
- spin: o.spin * fi(l),
1042
+ spin: o.spin * gi(l),
1043
1043
  rise: 4 * o.height * l * (1 - l)
1044
1044
  };
1045
1045
  }
1046
- function mi(e, t, o) {
1046
+ function bi(e, t, o) {
1047
1047
  const n = typeof e == "string" ? ho[e] : e, a = eo(t), r = eo((a - n.takeoff) / (n.landing - n.takeoff));
1048
1048
  return n.travel * o * r;
1049
1049
  }
1050
- function Td(e, t, o = {}) {
1050
+ function Od(e, t, o = {}) {
1051
1051
  const n = typeof t == "string" ? ho[t] : t, a = o.start ?? 0, r = o.duration ?? n.duration, s = o.samples ?? 48, i = Array.from({ length: s + 1 }, (l, d) => {
1052
1052
  const f = d / s;
1053
- return { time: a + f * r, progress: f, pose: pi(n, f) };
1053
+ return { time: a + f * r, progress: f, pose: yi(n, f) };
1054
1054
  }), c = Object.keys(ce).filter((l) => i.some((d) => d.pose[l] !== ce[l])).map((l) => ({
1055
1055
  id: `${e}-${l}`,
1056
1056
  target: e,
@@ -1063,12 +1063,12 @@ function Td(e, t, o = {}) {
1063
1063
  id: `${e}-x`,
1064
1064
  target: e,
1065
1065
  property: "x",
1066
- keyframes: i.map((d) => ({ time: d.time, value: (o.x ?? 0) + l * mi(n, d.progress, o.height) }))
1066
+ keyframes: i.map((d) => ({ time: d.time, value: (o.x ?? 0) + l * bi(n, d.progress, o.height) }))
1067
1067
  });
1068
1068
  }
1069
1069
  return c;
1070
1070
  }
1071
- const yi = {
1071
+ const wi = {
1072
1072
  leftHip: -55,
1073
1073
  leftKnee: -95,
1074
1074
  rightHip: 55,
@@ -1080,7 +1080,7 @@ const yi = {
1080
1080
  lean: 22,
1081
1081
  stretch: 0.94,
1082
1082
  headTilt: 6
1083
- }, bi = {
1083
+ }, ki = {
1084
1084
  leftHip: 0,
1085
1085
  leftKnee: 0,
1086
1086
  rightHip: 0,
@@ -1108,7 +1108,7 @@ const yi = {
1108
1108
  lean: 26,
1109
1109
  stretch: 1,
1110
1110
  headTilt: 14
1111
- }, wi = {
1111
+ }, vi = {
1112
1112
  leftHip: -22,
1113
1113
  leftKnee: -30,
1114
1114
  rightHip: 22,
@@ -1121,7 +1121,7 @@ const yi = {
1121
1121
  rightElbow: 0,
1122
1122
  lean: 8,
1123
1123
  headTilt: 0
1124
- }, ki = {
1124
+ }, Si = {
1125
1125
  leftHip: -58,
1126
1126
  leftKnee: -100,
1127
1127
  rightHip: 58,
@@ -1147,11 +1147,11 @@ function et(e, t, o, n, a, r = 1300) {
1147
1147
  duration: r,
1148
1148
  keys: [
1149
1149
  { at: 0, reset: !0 },
1150
- { at: 0.16, pose: yi },
1151
- { at: 0.27, pose: bi, easing: "ease-out-quad" },
1150
+ { at: 0.16, pose: wi },
1151
+ { at: 0.27, pose: ki, easing: "ease-out-quad" },
1152
1152
  ...a,
1153
- { at: 0.76, pose: wi },
1154
- { at: 0.86, pose: ki, easing: "ease-out-quad" },
1153
+ { at: 0.76, pose: vi },
1154
+ { at: 0.86, pose: Si, easing: "ease-out-quad" },
1155
1155
  { at: 1, reset: !0 }
1156
1156
  ]
1157
1157
  };
@@ -1248,7 +1248,7 @@ const ho = {
1248
1248
  { at: 0.6, pose: { leftHip: -40, rightHip: 40, leftKnee: -20, rightKnee: 20, lean: 6, headTilt: 0 } }
1249
1249
  ], 1200)
1250
1250
  };
1251
- function vi(e, t) {
1251
+ function Mi(e, t) {
1252
1252
  const o = Math.min(1, Math.max(0, e.turn ?? 0)), n = 1 - o, a = { ...ye, turn: o }, r = [
1253
1253
  { stick: "right", human: "left", s: 1 },
1254
1254
  { stick: "left", human: "right", s: -1 }
@@ -1257,23 +1257,23 @@ function vi(e, t) {
1257
1257
  const l = e[`${i}Shoulder`], d = e[`${i}Elbow`];
1258
1258
  a[`arm.${h}.spread`] = l * n, a[`arm.${h}.swing`] = c * l * o, a[`arm.${h}.bend`] = d * n, a[`arm.${h}.elbow`] = c * d * o;
1259
1259
  const f = e[`${i}Hip`], u = e[`${i}Knee`], p = n + c * o;
1260
- a[`leg.${h}.rotate`] = 90 * n, a[`leg.${h}.spread`] = 0, a[`leg.${h}.swing`] = f * p, a[`leg.${h}.knee`] = u * p, a[`leg.${h}.ankle`] = -(e[`${i}Ankle`] ?? 0), a[`leg.${h}.toeOut`] = (e[`${i}FootOut`] ?? 0) * Si, a[`eye.${h}`] = e[`${i}Eye`], a[`brow.${h}`] = e[`${i}Brow`], t && Object.assign(a, Mi(h, t[i] ?? Pe, e[`${i}Wrist`] ?? 0, o));
1260
+ a[`leg.${h}.rotate`] = 90 * n, a[`leg.${h}.spread`] = 0, a[`leg.${h}.swing`] = f * p, a[`leg.${h}.knee`] = u * p, a[`leg.${h}.ankle`] = -(e[`${i}Ankle`] ?? 0), a[`leg.${h}.toeOut`] = (e[`${i}FootOut`] ?? 0) * $i, a[`eye.${h}`] = e[`${i}Eye`], a[`brow.${h}`] = e[`${i}Brow`], t && Object.assign(a, Ei(h, t[i] ?? Pe, e[`${i}Wrist`] ?? 0, o));
1261
1261
  }
1262
1262
  const s = e.bend ?? 0;
1263
1263
  a.lean = e.lean * o, a.bend = s * o, a.side = (e.lean + s * 0.5) * n, a["head.tilt"] = (e.headTilt + s * 0.5) * n, a["head.nod"] = e.headTilt * o;
1264
1264
  for (const i of ["mouth", "smile", "mouthWidth", "blink", "browTilt", "lookX", "lookY", "stretch"]) a[i] = e[i];
1265
1265
  return a.lift = e.rise ?? 0, a.roll = e.spin ?? 0, a;
1266
1266
  }
1267
- const Si = 70;
1268
- function Mi(e, t, o, n) {
1267
+ const $i = 70;
1268
+ function Ei(e, t, o, n) {
1269
1269
  const a = e === "right" ? 1 - n : 1 + n, r = {};
1270
1270
  for (const s of Object.keys(Pe)) r[`hand.${e}.${s}`] = t[s] ?? Pe[s];
1271
1271
  return r[`hand.${e}.turn`] = (t.turn ?? 0) - a, r[`hand.${e}.roll`] = (t.roll ?? 0) + o, r;
1272
1272
  }
1273
1273
  function cr(e, t, o = {}) {
1274
- e.save(), $i(e, t, o), e.restore();
1274
+ e.save(), Ai(e, t, o), e.restore();
1275
1275
  }
1276
- function $i(e, t, o) {
1276
+ function Ai(e, t, o) {
1277
1277
  const n = dr(t, o);
1278
1278
  o.shadow !== !1 && fr(e, t, o);
1279
1279
  for (const a of t.under) jn(e, a, n, o);
@@ -1309,10 +1309,10 @@ function dr(e, t = {}) {
1309
1309
  function fr(e, t, o = {}) {
1310
1310
  t.shadow.opacity <= 0 || t.shadow.points.length < 3 || (e.save(), e.globalAlpha = t.shadow.opacity, co(e, t.shadow.points, o.ink ?? "#26262b", !1), e.restore());
1311
1311
  }
1312
- function Pd(e, t, o, n = {}) {
1312
+ function Hd(e, t, o, n = {}) {
1313
1313
  e.save(), Bo(e, t, o, n), e.restore();
1314
1314
  }
1315
- function Ei(e, t, o, n = {}) {
1315
+ function Ti(e, t, o, n = {}) {
1316
1316
  const a = n.style === "stick", r = t.flatMap((l) => {
1317
1317
  if (a && l.part.solidOnly) return [];
1318
1318
  const d = l.part.layer ?? 0;
@@ -1347,7 +1347,7 @@ function Ei(e, t, o, n = {}) {
1347
1347
  const f = h(l);
1348
1348
  if (!d) f.line(l.spine, o * 1.15);
1349
1349
  else {
1350
- const u = a ? ur(l, n) : d.light ? Ai(l, d, n) : gn(l);
1350
+ const u = a ? ur(l, n) : d.light ? Pi(l, d, n) : gn(l);
1351
1351
  u && (!a && n.look === "silhouette" ? f.shape(d.points, u, 0) : co(e, d.points, a || d.light ? u : mn(u, d.tone), !0, l.cut ? 1.6 : 0.8));
1352
1352
  const p = (l.part.outline ?? 1) * o;
1353
1353
  if (p > 0)
@@ -1372,7 +1372,7 @@ function gn(e) {
1372
1372
  const { part: t } = e;
1373
1373
  return t.glow && e.glow > 0 && t.fill ? pr(t.fill, t.glow.color, e.glow) : t.fill;
1374
1374
  }
1375
- function Ai(e, t, o) {
1375
+ function Pi(e, t, o) {
1376
1376
  const { part: n } = e;
1377
1377
  if (!n.fill) return;
1378
1378
  const a = gr(n.fill, t.light, t.fog ?? 0, o.fog);
@@ -1380,13 +1380,13 @@ function Ai(e, t, o) {
1380
1380
  }
1381
1381
  function ur(e, t) {
1382
1382
  const o = gn(e);
1383
- return o && (Pi(o) || e.glow > 0) ? o : t.paper ?? "#fbf8ef";
1383
+ return o && (Hi(o) || e.glow > 0) ? o : t.paper ?? "#fbf8ef";
1384
1384
  }
1385
1385
  function Bo(e, t, o, n) {
1386
1386
  t.opacity < 1 ? (e.save(), e.globalAlpha *= t.opacity, Kn(e, t, o, n), e.restore()) : Kn(e, t, o, n);
1387
1387
  }
1388
1388
  function Kn(e, t, o, n) {
1389
- if (n.style === "stick") return Ti(e, t, o, n);
1389
+ if (n.style === "stick") return Oi(e, t, o, n);
1390
1390
  const { part: a } = t, r = un(e, t, o, n), s = gn(t), i = n.look === "silhouette";
1391
1391
  for (const c of t.faces)
1392
1392
  s && (i ? r.shape(c.points, s, 0) : co(e, c.points, mn(s, c.tone)));
@@ -1395,7 +1395,7 @@ function Kn(e, t, o, n) {
1395
1395
  for (const c of t.edges) c.length > 1 && r.line(c, h);
1396
1396
  for (const c of t.marks) r.line(c, o * 0.7);
1397
1397
  }
1398
- function Ti(e, t, o, n) {
1398
+ function Oi(e, t, o, n) {
1399
1399
  const { part: a } = t;
1400
1400
  if (a.solidOnly) return;
1401
1401
  const r = un(e, t, o, n);
@@ -1410,7 +1410,7 @@ function Ti(e, t, o, n) {
1410
1410
  for (const h of t.edges) h.length > 1 && r.line(h, i);
1411
1411
  for (const h of t.marks) r.line(h, o * 0.7);
1412
1412
  }
1413
- function Pi(e) {
1413
+ function Hi(e) {
1414
1414
  const t = gt(e);
1415
1415
  return t ? (0.299 * t[0] + 0.587 * t[1] + 0.114 * t[2]) / 255 < 0.3 : !1;
1416
1416
  }
@@ -1441,7 +1441,7 @@ function pr(e, t, o) {
1441
1441
  const n = gt(e), a = gt(t);
1442
1442
  return !n || !a ? o < 0.5 ? e : t : pn(n.map((r, s) => r + (a[s] - r) * o));
1443
1443
  }
1444
- const Oi = /* @__PURE__ */ new Set([
1444
+ const Ii = /* @__PURE__ */ new Set([
1445
1445
  "x",
1446
1446
  "y",
1447
1447
  "z",
@@ -1457,29 +1457,29 @@ const Oi = /* @__PURE__ */ new Set([
1457
1457
  "visible",
1458
1458
  "opacity",
1459
1459
  "color"
1460
- ]), Hi = /* @__PURE__ */ new Set(["walk", "walking", "gait"]), Nn = (e) => typeof e == "number" ? e : void 0, Ii = 1.7;
1461
- function xi(e, t, o) {
1460
+ ]), xi = /* @__PURE__ */ new Set(["walk", "walking", "gait"]), Cn = (e) => typeof e == "number" ? e : void 0, ji = 1.7;
1461
+ function _i(e, t, o) {
1462
1462
  const n = Array.from({ length: 24 }, (a, r) => {
1463
1463
  const s = r / 24 * Math.PI * 2, i = t.toView([Math.cos(s) * o, 0, Math.sin(s) * o * 0.8]);
1464
1464
  return i[2] < -1e-3 ? t.toScreen(i) : null;
1465
1465
  });
1466
1466
  n.some((a) => a === null) || (e.beginPath(), n.forEach((a, r) => r === 0 ? e.moveTo(a.x, a.y) : e.lineTo(a.x, a.y)), e.closePath(), e.fillStyle = "rgba(0, 0, 0, 0.22)", e.fill());
1467
1467
  }
1468
- function ji(e) {
1468
+ function Ki(e) {
1469
1469
  const t = ke.dot([0, 1, 0], e);
1470
1470
  if (t > 0.999999) return ne.identity();
1471
1471
  if (t < -0.999999) return ne.fromQuat(We.fromAxisAngle([1, 0, 0], 180));
1472
1472
  const o = ke.cross([0, 1, 0], e);
1473
1473
  return ne.fromQuat(We.fromAxisAngle(o, Math.acos(t) * 180 / Math.PI));
1474
1474
  }
1475
- function _i(e, t, o, n, a) {
1475
+ function Ci(e, t, o, n, a) {
1476
1476
  const r = e.solid ?? {}, s = r.outline === !1 ? void 0 : r.outline ?? { width: 2, color: "#0f172a" }, i = { color: r.color ?? "#475569", shading: r.shading ?? "toon", outline: s }, h = { color: r.skin ?? "#f2c49b", shading: r.shading ?? "toon", outline: s }, c = { color: "#0f172a", shading: "unlit" }, l = n.height * 0.034, d = [], f = (M, m, P) => d.push({ mesh: M, world: ne.multiply(a, m), material: P }), u = (M, m, P) => f(t.sphere, ne.compose(M, [0, 0, 0, 1], [m, m, m]), P);
1477
1477
  for (const M of o.chains) {
1478
1478
  const m = n.chains[M.id], P = M.id === "spine" ? 1.9 : 1;
1479
1479
  M.bones.forEach((A, k) => {
1480
1480
  const y = m[k], v = m[k + 1], w = ke.distance(y, v), [E, O] = A.width ?? [1, 1], j = l * P * (E + O) / 2;
1481
1481
  if (w > 1e-6) {
1482
- const x = ke.lerp(y, v, 0.5), W = ji(ke.normalize(ke.subtract(v, y)));
1482
+ const x = ke.lerp(y, v, 0.5), W = Ki(ke.normalize(ke.subtract(v, y)));
1483
1483
  f(t.cylinder, ne.multiply(ne.translation(x), ne.multiply(W, ne.scaling([j, w, j]))), i);
1484
1484
  }
1485
1485
  u(y, l * P * E, i), u(v, l * P * O, i);
@@ -1493,7 +1493,7 @@ function _i(e, t, o, n, a) {
1493
1493
  }
1494
1494
  return d;
1495
1495
  }
1496
- const Od = {
1496
+ const Id = {
1497
1497
  kind: "character",
1498
1498
  validate(e) {
1499
1499
  const t = e;
@@ -1503,7 +1503,7 @@ const Od = {
1503
1503
  return {
1504
1504
  who: sn({ ...e.character, height: 1 }),
1505
1505
  cylinder: Vt(er(1, 1, 16)),
1506
- sphere: Vt(Na(1, 20))
1506
+ sphere: Vt(Ra(1, 20))
1507
1507
  };
1508
1508
  },
1509
1509
  // `lights` may be missing from a scene entry older than this add-on: treated as none.
@@ -1511,21 +1511,21 @@ const Od = {
1511
1511
  const h = e, c = t, l = c.who;
1512
1512
  let d = { ...ye, ...h.pose };
1513
1513
  for (const [y, v] of o)
1514
- typeof v == "number" && !Oi.has(y) && !Hi.has(y) && (d[y] = v);
1515
- const f = Math.max(0, Math.min(1, Nn(o.get("walking")) ?? h.walking ?? 0));
1514
+ typeof v == "number" && !Ii.has(y) && !xi.has(y) && (d[y] = v);
1515
+ const f = Math.max(0, Math.min(1, Cn(o.get("walking")) ?? h.walking ?? 0));
1516
1516
  if (f > 0) {
1517
- const y = typeof o.get("gait") == "string" ? o.get("gait") : h.gait, v = aa(y, Nn(o.get("walk")) ?? 0, d);
1517
+ const y = typeof o.get("gait") == "string" ? o.get("gait") : h.gait, v = aa(y, Cn(o.get("walk")) ?? 0, d);
1518
1518
  d = Object.fromEntries(Object.keys({ ...d, ...v }).map((w) => [w, (d[w] ?? 0) + ((v[w] ?? 0) - (d[w] ?? 0)) * f]));
1519
1519
  }
1520
- const u = h.height ?? Ii, p = ne.multiply(a.view, n), g = {
1520
+ const u = h.height ?? ji, p = ne.multiply(a.view, n), g = {
1521
1521
  toView: (y) => ne.transformPoint(p, y),
1522
1522
  toScreen: (y) => i(y)
1523
1523
  }, T = -g.toView([0, u / 2, 0])[2];
1524
1524
  if (T <= a.near) return null;
1525
- const H = h.shadow === !1 ? [] : [{ depth: T + u, draw: (y) => xi(y, g, u * 0.18) }];
1525
+ const H = h.shadow === !1 ? [] : [{ depth: T + u, draw: (y) => _i(y, g, u * 0.18) }];
1526
1526
  if (h.look === "solid") {
1527
1527
  const y = nn(l.plan, d, { height: u, contact: l.contact });
1528
- return { meshes: _i(h, c, l.plan, y, n), drawables: H };
1528
+ return { meshes: Ci(h, c, l.plan, y, n), drawables: H };
1529
1529
  }
1530
1530
  const M = ne.transformPoint(n, [0, u * 0.6, 0]), m = ke.normalize(ke.subtract(a.position, M)), P = tr(M, m, r).map((y) => Math.min(1, y));
1531
1531
  let A = l;
@@ -1563,7 +1563,7 @@ const Od = {
1563
1563
  l: { mouth: 0.3, mouthWidth: 1 },
1564
1564
  /** Other consonants: slightly open */
1565
1565
  c: { mouth: 0.2, mouthWidth: 1 }
1566
- }, wt = 1, Nt = 0.55, Cn = 0.35, Ki = 1.6, Rn = { a: "a", e: "e", i: "i", y: "i", o: "o", u: "u" }, Wn = { m: "m", b: "m", p: "m", f: "f", v: "f", w: "u", q: "u", l: "l", n: "l", d: "l", t: "l" }, zn = {
1566
+ }, wt = 1, Ct = 0.55, Nn = 0.35, Ni = 1.6, Rn = { a: "a", e: "e", i: "i", y: "i", o: "o", u: "u" }, Wn = { m: "m", b: "m", p: "m", f: "f", v: "f", w: "u", q: "u", l: "l", n: "l", d: "l", t: "l" }, zn = {
1567
1567
  अ: "a",
1568
1568
  आ: "a",
1569
1569
  इ: "i",
@@ -1590,41 +1590,41 @@ const Od = {
1590
1590
  "ौ": "o",
1591
1591
  "ॅ": "e",
1592
1592
  "ॉ": "o"
1593
- }, Ni = { प: "m", फ: "m", ब: "m", भ: "m", म: "m", व: "u" }, Ci = "्", Fn = "़", Ri = (e) => e >= "क" && e <= "ह", Dn = /* @__PURE__ */ new Set([".", ",", "!", "?", ";", ":", "…", "।", "॥", "—", "-"]);
1594
- function Wi(e) {
1593
+ }, Ri = { प: "m", फ: "m", ब: "m", भ: "m", म: "m", व: "u" }, Wi = "्", Fn = "़", zi = (e) => e >= "क" && e <= "ह", Dn = /* @__PURE__ */ new Set([".", ",", "!", "?", ";", ":", "…", "।", "॥", "—", "-"]);
1594
+ function Li(e) {
1595
1595
  const t = [], o = Array.from(e.toLowerCase()), n = (a, r) => {
1596
1596
  const s = t[t.length - 1];
1597
1597
  s && s.viseme === a ? s.weight += r * 0.5 : t.push({ viseme: a, weight: r });
1598
1598
  };
1599
1599
  for (let a = 0; a < o.length; a++) {
1600
1600
  const r = o[a], s = o[a + 1];
1601
- if (Dn.has(r)) n("rest", Ki);
1601
+ if (Dn.has(r)) n("rest", Ni);
1602
1602
  else if (/\s/.test(r)) {
1603
1603
  const i = t[t.length - 1];
1604
- i && i.viseme !== "rest" && t.push({ viseme: "c", weight: Cn });
1604
+ i && i.viseme !== "rest" && t.push({ viseme: "c", weight: Nn });
1605
1605
  } else if ((r === "o" || r === "e") && s === r)
1606
1606
  n(r === "o" ? "u" : "i", wt), a++;
1607
1607
  else if (r in Rn) n(Rn[r], wt);
1608
- else if (r in Wn) n(Wn[r], Nt);
1608
+ else if (r in Wn) n(Wn[r], Ct);
1609
1609
  else {
1610
1610
  if (r === "h") continue;
1611
- if (/[a-z]/.test(r)) n("c", Nt);
1611
+ if (/[a-z]/.test(r)) n("c", Ct);
1612
1612
  else if (r in zn) n(zn[r], wt);
1613
- else if (Ri(r)) {
1614
- const i = s === Fn ? r === "फ" ? "f" : void 0 : Ni[r];
1615
- n(i ?? "c", Nt);
1613
+ else if (zi(r)) {
1614
+ const i = s === Fn ? r === "फ" ? "f" : void 0 : Ri[r];
1615
+ n(i ?? "c", Ct);
1616
1616
  let h = a + 1;
1617
1617
  o[h] === Fn && h++;
1618
1618
  const c = o[h];
1619
- c === Ci ? a = h : c && c in Ln ? (n(Ln[c], wt), a = h) : (!c || /\s/.test(c) || Dn.has(c) || n("a", wt * 0.6), a = h - 1);
1620
- } else (r === "ं" || r === "ँ") && n("l", Nt * 0.6);
1619
+ c === Wi ? a = h : c && c in Ln ? (n(Ln[c], wt), a = h) : (!c || /\s/.test(c) || Dn.has(c) || n("a", wt * 0.6), a = h - 1);
1620
+ } else (r === "ं" || r === "ँ") && n("l", Ct * 0.6);
1621
1621
  }
1622
1622
  }
1623
- for (; t.length > 0 && (t[t.length - 1].viseme === "rest" || t[t.length - 1].weight === Cn); ) t.pop();
1623
+ for (; t.length > 0 && (t[t.length - 1].viseme === "rest" || t[t.length - 1].weight === Nn); ) t.pop();
1624
1624
  return t;
1625
1625
  }
1626
1626
  function mr(e, t = {}) {
1627
- const o = t.fields?.mouth ?? "mouth", n = t.fields?.mouthWidth ?? "mouthWidth", a = t.energy ?? 1, r = Wi(e.text), s = [{ time: e.start, value: Be.rest.mouth }], i = [{ time: e.start, value: Be.rest.mouthWidth }], h = r.reduce((l, d) => l + d.weight, 0), c = e.end - e.start;
1627
+ const o = t.fields?.mouth ?? "mouth", n = t.fields?.mouthWidth ?? "mouthWidth", a = t.energy ?? 1, r = Li(e.text), s = [{ time: e.start, value: Be.rest.mouth }], i = [{ time: e.start, value: Be.rest.mouthWidth }], h = r.reduce((l, d) => l + d.weight, 0), c = e.end - e.start;
1628
1628
  if (h > 0 && c > 0) {
1629
1629
  let l = e.start;
1630
1630
  for (const d of r) {
@@ -1638,7 +1638,7 @@ function mr(e, t = {}) {
1638
1638
  }
1639
1639
  return e.end > s[s.length - 1].time && (s.push({ time: e.end, value: Be.rest.mouth, easing: "ease-in-out" }), i.push({ time: e.end, value: Be.rest.mouthWidth, easing: "ease-in-out" })), { [o]: s, [n]: i };
1640
1640
  }
1641
- function Hd(e, t, o = {}) {
1641
+ function xd(e, t, o = {}) {
1642
1642
  const n = {};
1643
1643
  for (const a of [...t].sort((r, s) => r.start - s.start))
1644
1644
  for (const [r, s] of Object.entries(mr(a, o))) {
@@ -1665,7 +1665,7 @@ const Et = ([e, t, o]) => {
1665
1665
  const n = Math.hypot(e, t, o) || 1;
1666
1666
  return [e / n, t / n, o / n];
1667
1667
  };
1668
- function zi([e, t, o]) {
1668
+ function Fi([e, t, o]) {
1669
1669
  const [n, a, r] = [e / 2, t / 2, o / 2];
1670
1670
  return {
1671
1671
  vertices: [
@@ -1689,7 +1689,7 @@ function zi([e, t, o]) {
1689
1689
  };
1690
1690
  }
1691
1691
  const tt = (e, [t, o, n]) => e === "z" ? [t, o, n] : e === "x" ? [n, o, t] : [t, n, o];
1692
- function Li(e, t, o = "x", n = 20, a = 0) {
1692
+ function Di(e, t, o = "x", n = 20, a = 0) {
1693
1693
  const r = [], s = t / 2;
1694
1694
  for (const c of [-s, s])
1695
1695
  for (let l = 0; l < n; l++) {
@@ -1715,7 +1715,7 @@ function Li(e, t, o = "x", n = 20, a = 0) {
1715
1715
  }
1716
1716
  return { vertices: r, faces: i, marks: h, creases: !0 };
1717
1717
  }
1718
- function Fi([e, t, o], n = 16) {
1718
+ function qi([e, t, o], n = 16) {
1719
1719
  const a = Math.max(4, Math.round(n / 2)), r = [[0, t, 0]];
1720
1720
  for (let l = 1; l < a; l++) {
1721
1721
  const d = Math.PI * l / a;
@@ -1740,12 +1740,12 @@ function Fi([e, t, o], n = 16) {
1740
1740
  }
1741
1741
  return { vertices: r, faces: c, creases: !1 };
1742
1742
  }
1743
- const Di = (e) => e.reduce((t, [o, n], a) => {
1743
+ const Bi = (e) => e.reduce((t, [o, n], a) => {
1744
1744
  const [r, s] = e[(a + 1) % e.length];
1745
1745
  return t + o * s - r * n;
1746
1746
  }, 0) / 2;
1747
- function qi(e, t) {
1748
- const o = Di(e) < 0 ? [...e].reverse() : e, n = o.length, a = t / 2, r = [...o.map(([i, h]) => [a, h, i]), ...o.map(([i, h]) => [-a, h, i])], s = [
1747
+ function Gi(e, t) {
1748
+ const o = Bi(e) < 0 ? [...e].reverse() : e, n = o.length, a = t / 2, r = [...o.map(([i, h]) => [a, h, i]), ...o.map(([i, h]) => [-a, h, i])], s = [
1749
1749
  // Seen from +x, (forward, up) = (z, y) runs anticlockwise when z points left on screen: so reverse for the left cap.
1750
1750
  { corners: Array.from({ length: n }, (i, h) => n - 1 - h), normal: [1, 0, 0] },
1751
1751
  { corners: Array.from({ length: n }, (i, h) => n + h), normal: [-1, 0, 0] }
@@ -1756,7 +1756,7 @@ function qi(e, t) {
1756
1756
  }
1757
1757
  return { vertices: r, faces: s, creases: !0 };
1758
1758
  }
1759
- function Bi(e, t) {
1759
+ function Yi(e, t) {
1760
1760
  const o = {
1761
1761
  left: ([a, r]) => [0, r, a],
1762
1762
  right: ([a, r]) => [0, r, a],
@@ -1766,7 +1766,7 @@ function Bi(e, t) {
1766
1766
  }, n = { left: [1, 0, 0], right: [-1, 0, 0], front: [0, 0, 1], back: [0, 0, -1], up: [0, 1, 0] };
1767
1767
  return { vertices: e.map(o[t]), faces: [{ corners: e.map((a, r) => r), normal: n[t] }] };
1768
1768
  }
1769
- function Gi(e, t, o = 8) {
1769
+ function Ui(e, t, o = 8) {
1770
1770
  const n = (s) => Array.isArray(t) ? t[Math.min(s, t.length - 1)] : t, a = [], r = [];
1771
1771
  e.forEach((s, i) => {
1772
1772
  const h = e[Math.min(i + 1, e.length - 1)], c = e[Math.max(i - 1, 0)], l = Et([h[0] - c[0], h[1] - c[1], h[2] - c[2]]), d = Math.abs(l[1]) < 0.9 ? [0, 1, 0] : [1, 0, 0], f = Et(qn(l, d)), u = qn(f, l);
@@ -1785,20 +1785,20 @@ function Gi(e, t, o = 8) {
1785
1785
  function qn(e, t) {
1786
1786
  return [e[1] * t[2] - e[2] * t[1], e[2] * t[0] - e[0] * t[2], e[0] * t[1] - e[1] * t[0]];
1787
1787
  }
1788
- function Yi(e) {
1788
+ function Xi(e) {
1789
1789
  switch (e.type) {
1790
1790
  case "box":
1791
- return zi(e.size);
1791
+ return Fi(e.size);
1792
1792
  case "cylinder":
1793
- return Li(e.radius, e.length, e.axis, e.segments, e.spokes);
1793
+ return Di(e.radius, e.length, e.axis, e.segments, e.spokes);
1794
1794
  case "ellipsoid":
1795
- return Fi(e.radii, e.segments);
1795
+ return qi(e.radii, e.segments);
1796
1796
  case "extrude":
1797
- return qi(e.profile, e.width);
1797
+ return Gi(e.profile, e.width);
1798
1798
  case "panel":
1799
- return Bi(e.points, e.facing);
1799
+ return Yi(e.points, e.facing);
1800
1800
  case "tube":
1801
- return { ...Gi(e.points, e.radius, e.segments), joined: e.joined };
1801
+ return { ...Ui(e.points, e.radius, e.segments), joined: e.joined };
1802
1802
  }
1803
1803
  }
1804
1804
  function yr(e, t) {
@@ -1849,7 +1849,7 @@ function vr(e, t) {
1849
1849
  }
1850
1850
  return (o + n) / 2;
1851
1851
  }
1852
- const kt = 520, Bn = ["do", "at", "for", "to", "through", "toward", "speed", "pose", "gag", "say", "look", "turns", "dance", "bpm", "beats"], Ui = (e) => Math.max(700, Array.from(e).length * 65), Gn = 70, Yn = 35;
1852
+ const kt = 520, Bn = ["do", "at", "for", "to", "through", "toward", "speed", "pose", "gag", "say", "look", "turns", "dance", "bpm", "beats"], Vi = (e) => Math.max(700, Array.from(e).length * 65), Gn = 70, Yn = 35;
1853
1853
  function Sr(e, t) {
1854
1854
  const o = t[0] - e.x, n = t[1] - e.eyeHeight, a = t[2] - e.z, r = e.heading * Math.PI / 180, s = o * Math.cos(r) - a * Math.sin(r), i = o * Math.sin(r) + a * Math.cos(r), h = Math.atan2(s, i) * 180 / Math.PI, c = Math.hypot(s, i), l = -Math.atan2(n, c) * 180 / Math.PI, d = Math.max(-Gn, Math.min(Gn, h * 0.75)), f = Math.max(-Yn, Math.min(Yn, l * 0.7));
1855
1855
  return {
@@ -1859,7 +1859,7 @@ function Sr(e, t) {
1859
1859
  lookY: Math.max(-1, Math.min(1, (l - f) / 30))
1860
1860
  };
1861
1861
  }
1862
- const Xi = {
1862
+ const Ji = {
1863
1863
  walk: 1.3,
1864
1864
  bouncy: 1.4,
1865
1865
  doubleBounce: 1.2,
@@ -1868,8 +1868,8 @@ const Xi = {
1868
1868
  tired: 0.8,
1869
1869
  run: 3.6,
1870
1870
  shove: 0.7
1871
- }, Go = Object.keys(Ke), So = Object.keys(_e), Mo = Object.keys(Xs), Vi = 0.25, Ji = 700 / 180, Zi = 200, Qi = 300;
1872
- function el(e) {
1871
+ }, Go = Object.keys(Ke), So = Object.keys(_e), Mo = Object.keys(Xs), Zi = 0.25, Qi = 700 / 180, el = 200, tl = 300;
1872
+ function ol(e) {
1873
1873
  if (!Array.isArray(e)) return [{ beat: -1, message: `Beats must be an array of { do: … } objects (got ${typeof e}).` }];
1874
1874
  const t = [...Go, "face", "spin", "dance", "hold", "pose", "gag", "place", "say", "look"], o = [];
1875
1875
  return e.forEach((n, a) => {
@@ -1890,8 +1890,8 @@ function el(e) {
1890
1890
  s.do === "pose" && !(typeof s.pose == "object" && s.pose !== null) && !So.includes(s.pose) && r(fe("pose", s.pose, So)), s.do === "gag" && !Mo.includes(s.gag) && r(fe("gag", s.gag, Mo));
1891
1891
  }), o;
1892
1892
  }
1893
- function Id(e, t, o) {
1894
- const n = el(t);
1893
+ function jd(e, t, o) {
1894
+ const n = ol(t);
1895
1895
  if (n.length > 0) throw new Error(`characterScript3D: ${n.length} problem(s) in the beats:
1896
1896
  ${n.map((k) => ` beat ${k.beat}: ${k.message}`).join(`
1897
1897
  `)}`);
@@ -1917,7 +1917,7 @@ ${n.map((k) => ` beat ${k.beat}: ${k.message}`).join(`
1917
1917
  const w = to(c, y);
1918
1918
  if (Math.abs(w) < 1)
1919
1919
  return v !== void 0 && (p("rotateY", k, c), u("rotateY", k + v, c)), k + (v ?? 0);
1920
- const E = v ?? Math.max(Zi, Math.abs(w) * Ji);
1920
+ const E = v ?? Math.max(el, Math.abs(w) * Qi);
1921
1921
  return p("rotateY", k, c), c += w, u("rotateY", k + E, c, "ease-in-out"), k + E;
1922
1922
  }, b = (k, y, v, w = "ease-in-out") => {
1923
1923
  for (const [E, O] of Object.entries(v))
@@ -1925,15 +1925,15 @@ ${n.map((k) => ` beat ${k.beat}: ${k.message}`).join(`
1925
1925
  }, T = (k, y, v) => {
1926
1926
  const w = wr([[i, h], ...y.through ?? [y.to]]);
1927
1927
  if (w.length < 2) return v;
1928
- const E = g(v, lt(w[0].point, w[1].point)), O = w[w.length - 1].at, j = y.speed ?? Xi[k] * Math.sqrt(a / 1.7), x = y.for ?? O / j * 1e3, W = Us(k, a), G = mt("ease-in-out"), Y = Math.min(Qi, x / 4);
1928
+ const E = g(v, lt(w[0].point, w[1].point)), O = w[w.length - 1].at, j = y.speed ?? Ji[k] * Math.sqrt(a / 1.7), x = y.for ?? O / j * 1e3, W = Us(k, a), G = mt("ease-in-out"), Y = Math.min(tl, x / 4);
1929
1929
  f.push({ time: E, value: k }), p("walking", E, 0), u("walking", E + Y, 1, "ease-out"), u("walking", E + x - Y, 1), u("walking", E + x, 0, "ease-in");
1930
1930
  const oe = l;
1931
1931
  let q = c;
1932
- for (let I = 0; ; I = Math.min(O, I + Vi)) {
1933
- const N = E + vr(G, I / O) * x, { point: C, direction: S } = kr(w, I);
1932
+ for (let I = 0; ; I = Math.min(O, I + Zi)) {
1933
+ const C = E + vr(G, I / O) * x, { point: N, direction: S } = kr(w, I);
1934
1934
  q += to(q, lt([0, 0], S));
1935
1935
  const _ = I === 0 ? p : u;
1936
- if (_("x", N, C[0]), _("z", N, C[1]), _("rotateY", N, q), _("walk", N, oe + I / W), I >= O) break;
1936
+ if (_("x", C, N[0]), _("z", C, N[1]), _("rotateY", C, q), _("walk", C, oe + I / W), I >= O) break;
1937
1937
  }
1938
1938
  return l = oe + O / W, [i, h] = w[w.length - 1].point, c = q, E + x;
1939
1939
  }, H = [], M = [];
@@ -1952,8 +1952,8 @@ ${n.map((k) => ` beat ${k.beat}: ${k.message}`).join(`
1952
1952
  for (const Y of Object.keys(W[0])) {
1953
1953
  const oe = s(Y, j);
1954
1954
  Y === "turn" || Y === "roll" || W.every((q) => q[Y] === oe) || (p(Y, y, oe), W.slice(1).forEach((q, I) => {
1955
- const N = y + (v - y) * (I + 1) / x, C = Math.min(1, (N - y) / G), S = C * C * (3 - 2 * C);
1956
- u(Y, N, oe + (q[Y] - oe) * S);
1955
+ const C = y + (v - y) * (I + 1) / x, N = Math.min(1, (C - y) / G), S = N * N * (3 - 2 * N);
1956
+ u(Y, C, oe + (q[Y] - oe) * S);
1957
1957
  }), r[Y] = W[x][Y]);
1958
1958
  }
1959
1959
  } else if (k.do === "hold") v = y + (k.for ?? 1e3);
@@ -1970,7 +1970,7 @@ ${n.map((k) => ` beat ${k.beat}: ${k.message}`).join(`
1970
1970
  b(E.time, O.time, Object.fromEntries(Object.entries(O.pose).filter(([j, x]) => r[j] !== x)), O.easing ?? "ease-in-out"), E = O;
1971
1971
  v = E.time;
1972
1972
  } else if (k.do === "say") {
1973
- v = y + (k.for ?? Ui(k.say)), M.push({ text: k.say, start: y, end: v });
1973
+ v = y + (k.for ?? Vi(k.say)), M.push({ text: k.say, start: y, end: v });
1974
1974
  const w = { tilt: r["head.tilt"] ?? 0, left: r["brow.left"] ?? 0, right: r["brow.right"] ?? 0 };
1975
1975
  let E = 0;
1976
1976
  for (let O = y + kt; O < v - kt / 2; O += kt, E++) {
@@ -2000,7 +2000,7 @@ function Un(e, t, o = [0, 0, 0]) {
2000
2000
  return [h("x", o[0]), h("y", o[1]), h("z", o[2])];
2001
2001
  };
2002
2002
  }
2003
- function xd(e, t) {
2003
+ function _d(e, t) {
2004
2004
  const o = `${t.scene}/${t.character}`, n = t.height ?? 1.7, a = Math.max(1, t.every ?? 66), r = t.objects?.[t.character] ?? [0, 0, 0], s = new ve({ id: `${o}-own`, tracks: e.filter((d) => d.target === o) }), i = t.at, h = typeof i == "function" ? i : Array.isArray(i) ? () => i : "camera" in i ? Un(e, `${t.scene}/${i.camera}`, t.objects?.[i.camera] ?? [0, 1.6, 8]) : (() => {
2005
2005
  const d = Un(e, `${t.scene}/${i.object}`, t.objects?.[i.object] ?? [0, 0, 0]), f = i.eyeHeight ?? n * 0.9;
2006
2006
  return (u) => {
@@ -2018,7 +2018,7 @@ function xd(e, t) {
2018
2018
  }
2019
2019
  return c.map((d) => ({ id: `${o}-lookAt-${d}`, target: o, property: d, keyframes: l[d] }));
2020
2020
  }
2021
- function jd(e) {
2021
+ function Kd(e) {
2022
2022
  const t = Math.max(1, Math.round(e.count)), [o, n] = e.centre ?? [0, 0], a = e.spacing ?? 1.2, r = e.shape ?? "line", s = [];
2023
2023
  if (r === "circle") {
2024
2024
  const l = t < 2 ? 0 : Math.max(a, a * t / (Math.PI * 2));
@@ -2053,7 +2053,7 @@ function jd(e) {
2053
2053
  }
2054
2054
  return s;
2055
2055
  }
2056
- function tl(e, t, o = {}, n) {
2056
+ function nl(e, t, o = {}, n) {
2057
2057
  const a = o.length ?? 240, r = 9, s = 28, i = a - 22;
2058
2058
  e.save(), e.translate(t.x, t.y), e.rotate((o.angle ?? -30) * Math.PI / 180), e.fillStyle = o.color ?? "#f4c542", e.fillRect(s, -r, i - s, 2 * r), e.fillStyle = "#e8b4a0", e.fillRect(i, -r, a - i, 2 * r), e.fillStyle = "#f1dcbf", e.beginPath(), e.moveTo(0, 0), e.lineTo(s, -r), e.lineTo(s, r), e.closePath(), e.fill(), e.fillStyle = o.outline ?? "#2f2f33", e.beginPath(), e.moveTo(0, 0), e.lineTo(s * 0.35, -r * 0.35), e.lineTo(s * 0.35, r * 0.35), e.closePath(), e.fill(), e.strokeStyle = o.outline ?? "#2f2f33", e.lineWidth = 3, e.lineJoin = "round", e.lineCap = "round";
2059
2059
  const h = [
@@ -2086,15 +2086,15 @@ function Mr(e, t, o = {}, n) {
2086
2086
  }
2087
2087
  e.restore();
2088
2088
  }
2089
- const $r = 150, ol = { pencil: 44, eraser: 30 };
2089
+ const $r = 150, sl = { pencil: 44, eraser: 30 };
2090
2090
  function Er(e, t, o = {}, n) {
2091
2091
  const a = o.tool ?? "pencil", r = o.skin ?? "#f1c9a5", s = o.outline ?? "#2f2f33", i = o.scale ?? 1, h = Math.min(1, Math.max(0, o.lift ?? 0)), c = (o.angle ?? -30) * Math.PI / 180, l = n ? n.nudge(0.6) : { x: 0, y: 0 }, d = $r * i * (1 + 0.05 * h);
2092
2092
  h > 0 && (e.save(), e.fillStyle = s, e.globalAlpha = 0.15 * h, e.beginPath(), e.ellipse(t.x, t.y, 9 * i, 4 * i, 0, 0, Math.PI * 2), e.fill(), e.restore());
2093
2093
  const f = { x: t.x + l.x + 6 * h * i, y: t.y + l.y - 18 * h * i }, u = we.pencilGrip, p = (k) => {
2094
2094
  const y = k.fingers.thumb, v = k.fingers.index, w = k.fingers.middle, E = Xn([y.points[3], v.points[3], w.points[3]]), O = Xn([y.points[1], v.points[0]]), j = (y.depths[3] + v.depths[3] + w.depths[3]) / 3;
2095
2095
  return { pinch: E, direction: Math.atan2(O.y - E.y, O.x - E.x), depth: j };
2096
- }, g = Pn(u, { size: d }), b = c - p(g).direction, T = Pn(u, { size: d, angle: b * 180 / Math.PI }), H = p(T), M = ol[a] * i, m = { x: H.pinch.x - Math.cos(c) * M, y: H.pinch.y - Math.sin(c) * M }, P = { x: f.x - m.x, y: f.y - m.y }, A = T.axes.up;
2097
- nl(e, P, { x: -A.x, y: -A.y }, d, o.arm ?? 300 * i, r, o.sleeve ?? "#5b7db1", s), ha(e, P, u, {
2096
+ }, g = Pn(u, { size: d }), b = c - p(g).direction, T = Pn(u, { size: d, angle: b * 180 / Math.PI }), H = p(T), M = sl[a] * i, m = { x: H.pinch.x - Math.cos(c) * M, y: H.pinch.y - Math.sin(c) * M }, P = { x: f.x - m.x, y: f.y - m.y }, A = T.axes.up;
2097
+ rl(e, P, { x: -A.x, y: -A.y }, d, o.arm ?? 300 * i, r, o.sleeve ?? "#5b7db1", s), ha(e, P, u, {
2098
2098
  size: d,
2099
2099
  angle: b * 180 / Math.PI,
2100
2100
  skin: r,
@@ -2103,7 +2103,7 @@ function Er(e, t, o = {}, n) {
2103
2103
  prop: {
2104
2104
  depth: H.depth,
2105
2105
  draw: () => {
2106
- e.save(), e.translate(f.x, f.y), e.scale(i, i), a === "eraser" ? Mr(e, { x: 0, y: 0 }, { angle: c * 180 / Math.PI, outline: s }, n) : tl(e, { x: 0, y: 0 }, { angle: c * 180 / Math.PI, length: 190, outline: s }, n), e.restore();
2106
+ e.save(), e.translate(f.x, f.y), e.scale(i, i), a === "eraser" ? Mr(e, { x: 0, y: 0 }, { angle: c * 180 / Math.PI, outline: s }, n) : nl(e, { x: 0, y: 0 }, { angle: c * 180 / Math.PI, length: 190, outline: s }, n), e.restore();
2107
2107
  }
2108
2108
  }
2109
2109
  });
@@ -2112,19 +2112,19 @@ const Xn = (e) => ({
2112
2112
  x: e.reduce((t, o) => t + o.x, 0) / e.length,
2113
2113
  y: e.reduce((t, o) => t + o.y, 0) / e.length
2114
2114
  });
2115
- function nl(e, t, o, n, a, r, s, i) {
2115
+ function rl(e, t, o, n, a, r, s, i) {
2116
2116
  const h = { x: -o.y, y: o.x }, c = n * 0.15, l = (g, b, T) => ({
2117
2117
  x: t.x + o.x * g + h.x * b * T,
2118
2118
  y: t.y + o.y * g + h.y * b * T
2119
2119
  }), d = l(a, 0, 0), f = (g) => {
2120
2120
  const b = e.createLinearGradient(t.x, t.y, d.x, d.y);
2121
- return b.addColorStop(0, g), b.addColorStop(0.6, g), b.addColorStop(1, sl(g)), b;
2121
+ return b.addColorStop(0, g), b.addColorStop(0.6, g), b.addColorStop(1, al(g)), b;
2122
2122
  }, u = Math.min(n * 0.55, a * 0.35);
2123
2123
  e.save(), e.lineJoin = "round", e.lineCap = "round", e.lineWidth = 3 * (n / $r), e.beginPath(), e.moveTo(l(-n * 0.1, -1, c).x, l(-n * 0.1, -1, c).y), e.lineTo(l(u + 4, -1, c * 1.1).x, l(u + 4, -1, c * 1.1).y), e.lineTo(l(u + 4, 1, c * 1.1).x, l(u + 4, 1, c * 1.1).y), e.lineTo(l(-n * 0.1, 1, c).x, l(-n * 0.1, 1, c).y), e.closePath(), e.fillStyle = r, e.fill(), e.strokeStyle = i, e.beginPath(), e.moveTo(l(0, -1, c).x, l(0, -1, c).y), e.lineTo(l(u, -1, c * 1.1).x, l(u, -1, c * 1.1).y), e.moveTo(l(0, 1, c).x, l(0, 1, c).y), e.lineTo(l(u, 1, c * 1.1).x, l(u, 1, c * 1.1).y), e.stroke();
2124
2124
  const p = [l(u, -1, c * 1.3), l(a, -1, c * 1.5), l(a, 1, c * 1.5), l(u, 1, c * 1.3)];
2125
2125
  e.beginPath(), p.forEach((g, b) => b ? e.lineTo(g.x, g.y) : e.moveTo(g.x, g.y)), e.closePath(), e.fillStyle = f(s), e.fill(), e.strokeStyle = f(i), e.beginPath(), e.moveTo(p[1].x, p[1].y), e.lineTo(p[0].x, p[0].y), e.lineTo(p[3].x, p[3].y), e.lineTo(p[2].x, p[2].y), e.stroke(), e.restore();
2126
2126
  }
2127
- function _d(e, t, o = {}) {
2127
+ function Cd(e, t, o = {}) {
2128
2128
  const n = o.offstage ?? { x: 2e3, y: 1400 }, a = o.enter ?? 450, r = o.exit ?? 450, s = o.linger ?? 1500, i = [...e].filter((g) => g.path.length > 0).sort((g, b) => g.start - b.start), h = (g) => g.tool ?? "pencil", c = (g) => {
2129
2129
  const b = Math.min(1, Math.max(0, g));
2130
2130
  return b * b * (3 - 2 * b);
@@ -2148,7 +2148,7 @@ function _d(e, t, o = {}) {
2148
2148
  }
2149
2149
  return null;
2150
2150
  }
2151
- function Kd(e, t, o, n = 0.08, a = 32) {
2151
+ function Nd(e, t, o, n = 0.08, a = 32) {
2152
2152
  const r = Math.PI * 2 * (1 + n), s = [];
2153
2153
  for (let i = 0; i <= a; i++) {
2154
2154
  const h = -Math.PI / 2 + r * i / a;
@@ -2156,7 +2156,7 @@ function Kd(e, t, o, n = 0.08, a = 32) {
2156
2156
  }
2157
2157
  return s;
2158
2158
  }
2159
- function Nd(e) {
2159
+ function Rd(e) {
2160
2160
  const { path: t } = e, o = t.map((i) => i.x), n = t.map((i) => i.y), a = Math.min(...o), r = Math.min(...n), s = e.hand === !1 ? void 0 : e.hand === !0 || e.hand === void 0 ? {} : e.hand;
2161
2161
  return {
2162
2162
  type: "custom",
@@ -2168,12 +2168,12 @@ function Nd(e) {
2168
2168
  draw(i, h, c) {
2169
2169
  const l = Math.min(1, Math.max(0, Number(h.props?.draw ?? 0)));
2170
2170
  i.translate(-a, -r), i.strokeStyle = e.color ?? "#2f2f33", i.lineWidth = e.lineWidth ?? 5, i.lineCap = "round", i.lineJoin = "round";
2171
- const d = e.sketch ? Ca(i, e.sketch, c) : void 0;
2171
+ const d = e.sketch ? Wa(i, e.sketch, c) : void 0;
2172
2172
  l > 0 && (d ? e.smooth ? d.curve(t, l) : d.line(t, l) : Ar(i, nr(t, l))), s && l > 0 && l < 1 && Er(i, an(t, l), s, d);
2173
2173
  }
2174
2174
  };
2175
2175
  }
2176
- function sl(e) {
2176
+ function al(e) {
2177
2177
  const t = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
2178
2178
  if (!t) return "rgba(0, 0, 0, 0)";
2179
2179
  const o = t[1].length === 3 ? [...t[1]].map((s) => s + s).join("") : t[1], [n, a, r] = [0, 2, 4].map((s) => parseInt(o.slice(s, s + 2), 16));
@@ -2187,8 +2187,8 @@ function Ar(e, t, o) {
2187
2187
  e.stroke();
2188
2188
  }
2189
2189
  }
2190
- const Ct = 1e5;
2191
- function Cd(e, t, o, n, a = 6) {
2190
+ const Nt = 1e5;
2191
+ function Wd(e, t, o, n, a = 6) {
2192
2192
  const r = [], s = Math.max(1, Math.round(a));
2193
2193
  for (let i = 0; i <= s; i++)
2194
2194
  r.push({ x: i % 2 === 0 ? e : e + o, y: t + n * i / s });
@@ -2197,7 +2197,7 @@ function Cd(e, t, o, n, a = 6) {
2197
2197
  function Tr(e, t, o, n) {
2198
2198
  if (n <= 0 || t.length === 0) return;
2199
2199
  const a = nr(t, n), r = o / 2, s = (i) => {
2200
- e.beginPath(), e.rect(-Ct, -Ct, 2 * Ct, 2 * Ct), i(), e.clip("evenodd");
2200
+ e.beginPath(), e.rect(-Nt, -Nt, 2 * Nt, 2 * Nt), i(), e.clip("evenodd");
2201
2201
  };
2202
2202
  for (const i of a)
2203
2203
  s(() => {
@@ -2212,10 +2212,10 @@ function Tr(e, t, o, n) {
2212
2212
  });
2213
2213
  }
2214
2214
  }
2215
- function Rd(e, t, o, n, a) {
2215
+ function zd(e, t, o, n, a) {
2216
2216
  e.save(), Tr(e, t, o, n), a(), e.restore();
2217
2217
  }
2218
- function Wd(e, t) {
2218
+ function Ld(e, t) {
2219
2219
  const o = t.width ?? 40, n = t.hand === !0 ? {} : t.hand || void 0, a = t.eraser === !1 ? void 0 : t.eraser === !0 || t.eraser === void 0 ? {} : t.eraser;
2220
2220
  return {
2221
2221
  ...e,
@@ -2249,7 +2249,7 @@ function It() {
2249
2249
  id: `${o}-${n}`,
2250
2250
  target: o,
2251
2251
  property: n,
2252
- keyframes: rl(a)
2252
+ keyframes: il(a)
2253
2253
  }));
2254
2254
  }
2255
2255
  };
@@ -2269,10 +2269,10 @@ function Pt(e) {
2269
2269
  const t = [...e ?? []].sort((o, n) => o.time - n.time);
2270
2270
  return t.slice(1).flatMap((o, n) => o.value !== t[n].value ? [{ start: t[n].time, end: o.time }] : []);
2271
2271
  }
2272
- function rl(e) {
2272
+ function il(e) {
2273
2273
  return [...e].sort((o, n) => o.time - n.time).map((o) => ({ time: o.time, value: o.value, ...o.easing ? { easing: o.easing } : {} }));
2274
2274
  }
2275
- const al = 16e-4, il = 0.6, Ye = 33;
2275
+ const ll = 16e-4, hl = 0.6, Ye = 33;
2276
2276
  function fo(e) {
2277
2277
  const t = (r, s) => `piece.${r.id}.${s}`, o = (r, s) => ({
2278
2278
  x: r.home.x + e.valueAt(t(r, "x"), s),
@@ -2291,7 +2291,7 @@ function fo(e) {
2291
2291
  e.push(t(r, "x"), { time: i.time, value: i.x - r.home.x }), e.push(t(r, "y"), { time: i.time, value: i.y - r.home.y });
2292
2292
  },
2293
2293
  fling(r, s) {
2294
- const i = o(r, s.at), h = s.velocity ?? n(r, s.at) ?? { x: 0.5, y: -0.6 }, c = s.gravity ?? al, l = s.duration ?? 900, d = (s.spin ?? il) * (h.x < 0 ? -1 : 1), f = e.valueAt(t(r, "rotate"), s.at);
2294
+ const i = o(r, s.at), h = s.velocity ?? n(r, s.at) ?? { x: 0.5, y: -0.6 }, c = s.gravity ?? ll, l = s.duration ?? 900, d = (s.spin ?? hl) * (h.x < 0 ? -1 : 1), f = e.valueAt(t(r, "rotate"), s.at);
2295
2295
  a(r, s.at);
2296
2296
  for (let u = 0; u <= l; u += Ye) {
2297
2297
  const p = i.x + h.x * u, g = i.y + h.y * u + 0.5 * c * u * u;
@@ -2354,7 +2354,7 @@ function me(e, t, o, n) {
2354
2354
  height: n
2355
2355
  };
2356
2356
  }
2357
- const ll = {
2357
+ const cl = {
2358
2358
  background: "#1e1e2e",
2359
2359
  gutter: "#6c7086",
2360
2360
  text: "#cdd6f4",
@@ -2385,24 +2385,24 @@ const ll = {
2385
2385
  move: "a token; { at, to: an anchor name or { x, y }, duration? }: move the word there",
2386
2386
  fling: "a token; { at, velocity?, spin?, gravity?, duration? }: throw or kick the word away on a spinning arc"
2387
2387
  }
2388
- }, hl = 0.9, cl = 8;
2389
- function zd(e) {
2390
- const t = { ...ll, ...e.theme }, o = e.code.replace(/\t/g, " ").replace(/\n$/, "").split(`
2388
+ }, dl = 0.9, fl = 8;
2389
+ function Fd(e) {
2390
+ const t = { ...cl, ...e.theme }, o = e.code.replace(/\t/g, " ").replace(/\n$/, "").split(`
2391
2391
  `), n = e.fontSize ?? 16, a = (e.lineHeight ?? 1.6) * n, r = (e.charWidth ?? 0.6) * n, s = e.padding ?? 12, i = e.lineNumbers === !1 ? 0 : (String(o.length).length + 2) * r, h = Math.max(1, ...o.map((I) => I.length)), c = e.width ?? s * 2 + i + h * r, l = s * 2 + o.length * a, d = e.x + s + i, f = new Set(e.hidden ?? []), u = e.language ?? "plain";
2392
2392
  if (!Uo.includes(u)) throw new Error(`codePanel: ${fe("language", u, Uo)}`);
2393
- const p = o.map((I) => gl(I, u).flatMap((N) => Array.from(N.text, () => t[N.kind]))), g = It(), b = fo(g), T = [], H = /* @__PURE__ */ new Map(), M = [], m = [], P = (I) => {
2393
+ const p = o.map((I) => ml(I, u).flatMap((C) => Array.from(C.text, () => t[C.kind]))), g = It(), b = fo(g), T = [], H = /* @__PURE__ */ new Map(), M = [], m = [], P = (I) => {
2394
2394
  if (!Number.isInteger(I) || I < 1 || I > o.length) throw new Error(`codePanel: no line ${I} (it has ${o.length})`);
2395
- }, A = g.tween, k = g.last, y = (I, N, C, S, _, V = 300) => {
2396
- P(I), A(`line.${I}.${N}`, C, S, _, V);
2397
- }, v = (I, N) => T.filter((C) => C.line < I && C.closed <= N).length, w = me, E = (I) => e.y + s + (I - 1) * a, O = (I) => Array.isArray(I) ? I : [I], j = (I, N, C) => {
2395
+ }, A = g.tween, k = g.last, y = (I, C, N, S, _, V = 300) => {
2396
+ P(I), A(`line.${I}.${C}`, N, S, _, V);
2397
+ }, v = (I, C) => T.filter((N) => N.line < I && N.closed <= C).length, w = me, E = (I) => e.y + s + (I - 1) * a, O = (I) => Array.isArray(I) ? I : [I], j = (I, C, N) => {
2398
2398
  let S = -1;
2399
- for (let _ = 0; _ < C; _++)
2400
- if (S = o[I - 1].indexOf(N, S + 1), S < 0) throw new Error(`codePanel: line ${I} has no ${C > 1 ? `${C}th ` : ""}"${N}"`);
2399
+ for (let _ = 0; _ < N; _++)
2400
+ if (S = o[I - 1].indexOf(C, S + 1), S < 0) throw new Error(`codePanel: line ${I} has no ${N > 1 ? `${N}th ` : ""}"${C}"`);
2401
2401
  return S;
2402
2402
  }, x = {};
2403
- o.forEach((I, N) => {
2404
- const C = N + 1;
2405
- x[`line.${C}.highlight`] = 0, x[`line.${C}.strike`] = 0, x[`line.${C}.wipe`] = 0, x[`line.${C}.reveal`] = f.has(C) ? 0 : 1, x[`line.${C}.shift`] = 0;
2403
+ o.forEach((I, C) => {
2404
+ const N = C + 1;
2405
+ x[`line.${N}.highlight`] = 0, x[`line.${N}.strike`] = 0, x[`line.${N}.wipe`] = 0, x[`line.${N}.reveal`] = f.has(N) ? 0 : 1, x[`line.${N}.shift`] = 0;
2406
2406
  });
2407
2407
  const W = {
2408
2408
  type: "custom",
@@ -2416,12 +2416,12 @@ function zd(e) {
2416
2416
  summary: `${o.length} lines of ${u} code. Its lines and words are places in the scene (line(), token(), spot()); its edits are methods that record tracks (tracks()).`,
2417
2417
  // Pieces and inserts add props as they are made; these describe them by pattern.
2418
2418
  get props() {
2419
- return fl(Object.keys(x));
2419
+ return gl(Object.keys(x));
2420
2420
  },
2421
2421
  actions: Pr
2422
2422
  },
2423
- draw(I, N) {
2424
- const C = N.props ?? {}, S = (L) => Number(C[L] ?? x[L]), _ = s + i, V = (L) => s + (L - 1) * a - S(`line.${L}.shift`) * a;
2423
+ draw(I, C) {
2424
+ const N = C.props ?? {}, S = (L) => Number(N[L] ?? x[L]), _ = s + i, V = (L) => s + (L - 1) * a - S(`line.${L}.shift`) * a;
2425
2425
  I.fillStyle = t.background, Vn(I, 0, 0, c, l, 8), I.fill(), I.font = `${n}px ${t.font}`, I.textBaseline = "middle", I.textAlign = "left";
2426
2426
  const ee = (L, Q, re, K, X) => {
2427
2427
  const F = o[L - 1];
@@ -2432,7 +2432,7 @@ function zd(e) {
2432
2432
  const re = Q + 1, K = S(`line.${re}.wipe`);
2433
2433
  if (K >= 1) return;
2434
2434
  const X = V(re), F = X + a / 2, Z = Math.max(1, L.length) * r, se = Math.round(S(`line.${re}.reveal`) * L.length), ae = H.get(re) ?? { style: "wipe", from: "left" };
2435
- I.save(), K > 0 && dl(I, ae, K, { left: _ - i, top: X, width: i + Z + r, height: a }, c);
2435
+ I.save(), K > 0 && ul(I, ae, K, { left: _ - i, top: X, width: i + Z + r, height: a }, c);
2436
2436
  const ie = S(`line.${re}.highlight`);
2437
2437
  ie > 0 && (I.globalAlpha *= Math.min(1, ie), I.fillStyle = t.highlight, I.fillRect(_ - r / 2, X, Z + r, a), I.globalAlpha /= Math.min(1, ie)), i > 0 && se > 0 && (I.fillStyle = t.gutter, I.textAlign = "right", I.fillText(String(re), _ - r, F), I.textAlign = "left");
2438
2438
  const $ = [
@@ -2464,183 +2464,183 @@ function zd(e) {
2464
2464
  I.restore();
2465
2465
  }
2466
2466
  }, G = (I) => {
2467
- const { kind: N, rest: C } = pt(I), S = (_) => Ue("codePanel", I, Gt, _);
2468
- if (N === "box") {
2469
- if (C) throw S("box takes no arguments");
2470
- return { kind: N };
2467
+ const { kind: C, rest: N } = pt(I), S = (_) => Ue("codePanel", I, Gt, _);
2468
+ if (C === "box") {
2469
+ if (N) throw S("box takes no arguments");
2470
+ return { kind: C };
2471
2471
  }
2472
- if (N === "line") {
2473
- if (!/^\d+$/.test(C)) throw S("write it line:N");
2474
- return { kind: N, n: Number(C) };
2472
+ if (C === "line") {
2473
+ if (!/^\d+$/.test(N)) throw S("write it line:N");
2474
+ return { kind: C, n: Number(N) };
2475
2475
  }
2476
- if (N === "token") {
2477
- const _ = /^(\d+)(?:#(\d+))?:(.+)$/.exec(C);
2476
+ if (C === "token") {
2477
+ const _ = /^(\d+)(?:#(\d+))?:(.+)$/.exec(N);
2478
2478
  if (!_) throw S("write it token:N:TEXT, or token:N#K:TEXT for the Kth");
2479
- return { kind: N, n: Number(_[1]), occurrence: _[2] ? Number(_[2]) : 1, text: _[3] };
2479
+ return { kind: C, n: Number(_[1]), occurrence: _[2] ? Number(_[2]) : 1, text: _[3] };
2480
2480
  }
2481
- if (N === "spot") {
2482
- const _ = /^(\d+):(\d+)(?::(\d+))?$/.exec(C);
2481
+ if (C === "spot") {
2482
+ const _ = /^(\d+):(\d+)(?::(\d+))?$/.exec(N);
2483
2483
  if (!_) throw S("write it spot:N:C, or spot:N:C:W for W characters");
2484
- return { kind: N, n: Number(_[1]), column: Number(_[2]), width: _[3] ? Number(_[3]) : 1 };
2484
+ return { kind: C, n: Number(_[1]), column: Number(_[2]), width: _[3] ? Number(_[3]) : 1 };
2485
2485
  }
2486
2486
  throw S();
2487
- }, Y = (I, N, C, S = !1) => {
2488
- const _ = Array.isArray(N) ? N : [N];
2489
- if (_.length === 0 || S && _.length > 1) throw new Error(`codePanel.edit: ${I} takes ${S ? "one" : "at least one"} ${C} anchor`);
2487
+ }, Y = (I, C, N, S = !1) => {
2488
+ const _ = Array.isArray(C) ? C : [C];
2489
+ if (_.length === 0 || S && _.length > 1) throw new Error(`codePanel.edit: ${I} takes ${S ? "one" : "at least one"} ${N} anchor`);
2490
2490
  return _.map((V) => {
2491
2491
  const ee = G(V);
2492
- if (ee.kind !== C) throw new Error(`codePanel.edit: ${I} takes ${C} anchors (${C}:…), not "${V}"`);
2492
+ if (ee.kind !== N) throw new Error(`codePanel.edit: ${I} takes ${N} anchors (${N}:…), not "${V}"`);
2493
2493
  return ee;
2494
2494
  });
2495
- }, oe = (I, N) => {
2496
- if (typeof N.text != "string") throw new Error(`codePanel.edit: ${I} needs \`text\` (the text to write)`);
2497
- return N.text;
2495
+ }, oe = (I, C) => {
2496
+ if (typeof C.text != "string") throw new Error(`codePanel.edit: ${I} needs \`text\` (the text to write)`);
2497
+ return C.text;
2498
2498
  }, q = {
2499
2499
  kind: "code",
2500
2500
  about: Gt,
2501
2501
  target: W,
2502
2502
  lines: o,
2503
2503
  box: w(e.x, e.y, c, l),
2504
- line(I, N = 1 / 0) {
2505
- return P(I), w(d, E(I) - v(I, N) * a, Math.max(1, o[I - 1].length) * r, a);
2504
+ line(I, C = 1 / 0) {
2505
+ return P(I), w(d, E(I) - v(I, C) * a, Math.max(1, o[I - 1].length) * r, a);
2506
2506
  },
2507
- token(I, N, C = 1, S = 1 / 0) {
2507
+ token(I, C, N = 1, S = 1 / 0) {
2508
2508
  P(I);
2509
- const _ = j(I, N, C);
2510
- return w(d + _ * r, E(I) - v(I, S) * a, N.length * r, a);
2509
+ const _ = j(I, C, N);
2510
+ return w(d + _ * r, E(I) - v(I, S) * a, C.length * r, a);
2511
2511
  },
2512
- highlight(I, N) {
2513
- for (const C of O(I)) {
2514
- const S = k(`line.${C}.highlight`, 0);
2515
- y(C, "highlight", S, N.on === !1 ? 0 : 1, N, 200);
2512
+ highlight(I, C) {
2513
+ for (const N of O(I)) {
2514
+ const S = k(`line.${N}.highlight`, 0);
2515
+ y(N, "highlight", S, C.on === !1 ? 0 : 1, C, 200);
2516
2516
  }
2517
2517
  return q;
2518
2518
  },
2519
- strike(I, N) {
2520
- for (const C of O(I)) y(C, "strike", k(`line.${C}.strike`, 0), 1, N);
2519
+ strike(I, C) {
2520
+ for (const N of O(I)) y(N, "strike", k(`line.${N}.strike`, 0), 1, C);
2521
2521
  return q;
2522
2522
  },
2523
- remove(I, N) {
2524
- const C = O(I), S = N.style ?? "wipe";
2523
+ remove(I, C) {
2524
+ const N = O(I), S = C.style ?? "wipe";
2525
2525
  if (!Yo.includes(S)) throw new Error(`codePanel.remove: ${fe("style", S, Yo)}`);
2526
- const _ = S === "wipe" ? 300 : 450, V = N.at + (N.duration ?? _), ee = N.close ?? 250;
2527
- for (const L of C)
2528
- y(L, "wipe", 0, 1, { ...N, easing: N.easing ?? (S === "fly" ? "ease-in" : void 0) }, _), H.set(L, { style: S, from: N.from ?? "left" }), T.push({ line: L, closed: V + ee });
2526
+ const _ = S === "wipe" ? 300 : 450, V = C.at + (C.duration ?? _), ee = C.close ?? 250;
2527
+ for (const L of N)
2528
+ y(L, "wipe", 0, 1, { ...C, easing: C.easing ?? (S === "fly" ? "ease-in" : void 0) }, _), H.set(L, { style: S, from: C.from ?? "left" }), T.push({ line: L, closed: V + ee });
2529
2529
  for (let L = 1; L <= o.length; L++) {
2530
- if (C.includes(L)) continue;
2531
- const Q = C.filter((K) => K < L).length;
2530
+ if (N.includes(L)) continue;
2531
+ const Q = N.filter((K) => K < L).length;
2532
2532
  if (Q === 0) continue;
2533
2533
  const re = k(`line.${L}.shift`, 0);
2534
2534
  y(L, "shift", re, re + Q, { at: V, duration: ee, easing: "ease-in-out" });
2535
2535
  }
2536
2536
  return q;
2537
2537
  },
2538
- type(I, N) {
2539
- return y(I, "reveal", 0, 1, { duration: o[I - 1].length * 45, ...N }), q;
2538
+ type(I, C) {
2539
+ return y(I, "reveal", 0, 1, { duration: o[I - 1].length * 45, ...C }), q;
2540
2540
  },
2541
- piece(I, N, C = 1) {
2541
+ piece(I, C, N = 1) {
2542
2542
  if (typeof I == "string") {
2543
2543
  const L = G(I);
2544
2544
  if (L.kind !== "token") throw new Error(`codePanel.piece: a piece is a word, token:N:TEXT, not "${I}"`);
2545
2545
  return q.piece(L.n, L.text, L.occurrence);
2546
2546
  }
2547
2547
  const S = I;
2548
- if (N === void 0) throw new Error('codePanel.piece: which word? piece(n, text) or piece("token:N:TEXT")');
2548
+ if (C === void 0) throw new Error('codePanel.piece: which word? piece(n, text) or piece("token:N:TEXT")');
2549
2549
  P(S);
2550
- const _ = j(S, N, C), V = M.find((L) => L.line === S && L.column === _ && L.text === N);
2550
+ const _ = j(S, C, N), V = M.find((L) => L.line === S && L.column === _ && L.text === C);
2551
2551
  if (V) return V;
2552
- if (M.some((L) => L.line === S && _ < L.column + L.text.length && L.column < _ + N.length))
2553
- throw new Error(`codePanel: "${N}" on line ${S} overlaps another piece`);
2554
- const ee = { id: M.length + 1, line: S, column: _, text: N, home: q.token(S, N, C, 0) };
2552
+ if (M.some((L) => L.line === S && _ < L.column + L.text.length && L.column < _ + C.length))
2553
+ throw new Error(`codePanel: "${C}" on line ${S} overlaps another piece`);
2554
+ const ee = { id: M.length + 1, line: S, column: _, text: C, home: q.token(S, C, N, 0) };
2555
2555
  M.push(ee);
2556
2556
  for (const L of ["x", "y", "rotate", "write", "away"]) x[`piece.${ee.id}.${L}`] = 0;
2557
2557
  return x[`piece.${ee.id}.opacity`] = 1, ee;
2558
2558
  },
2559
- follow(I, N) {
2560
- return b.follow(I, N), q;
2559
+ follow(I, C) {
2560
+ return b.follow(I, C), q;
2561
2561
  },
2562
- fling(I, N) {
2563
- return b.fling(I, N), q;
2562
+ fling(I, C) {
2563
+ return b.fling(I, C), q;
2564
2564
  },
2565
- move(I, N) {
2566
- return b.move(I, N), q;
2565
+ move(I, C) {
2566
+ return b.move(I, C), q;
2567
2567
  },
2568
- write(I, N, C) {
2569
- return I.written = N, A(`piece.${I.id}.write`, 0, 1, { duration: Math.max(1, N.length) * 70, ...C }), q;
2568
+ write(I, C, N) {
2569
+ return I.written = C, A(`piece.${I.id}.write`, 0, 1, { duration: Math.max(1, C.length) * 70, ...N }), q;
2570
2570
  },
2571
- spot(I, N, C = 1, S = 1 / 0) {
2571
+ spot(I, C, N = 1, S = 1 / 0) {
2572
2572
  P(I);
2573
- const _ = m.filter((V) => V.line === I && V.column <= N && V.at <= S).reduce((V, ee) => V + ee.chars, 0);
2574
- return w(d + (N + _) * r, E(I) - v(I, S) * a, C * r, a);
2573
+ const _ = m.filter((V) => V.line === I && V.column <= C && V.at <= S).reduce((V, ee) => V + ee.chars, 0);
2574
+ return w(d + (C + _) * r, E(I) - v(I, S) * a, N * r, a);
2575
2575
  },
2576
- insert(I, N, C, S) {
2576
+ insert(I, C, N, S) {
2577
2577
  P(I);
2578
- const _ = { id: m.length + 1, line: I, column: N, chars: C.length, text: C, at: S.at };
2578
+ const _ = { id: m.length + 1, line: I, column: C, chars: N.length, text: N, at: S.at };
2579
2579
  m.push(_), x[`insert.${_.id}.open`] = 0, x[`insert.${_.id}.type`] = 0;
2580
- const V = S.duration ?? C.length * 70;
2580
+ const V = S.duration ?? N.length * 70;
2581
2581
  return A(`insert.${_.id}.open`, 0, 1, { at: S.at, duration: V * 0.6, easing: "ease-out" }), A(`insert.${_.id}.type`, 0, 1, { at: S.at, duration: V }), q;
2582
2582
  },
2583
- drop(I, N, C, S) {
2584
- P(N);
2585
- const _ = S.duration ?? 250, V = N === I.line, ee = S.easing ?? (V ? "linear" : "ease-out"), L = q.landing(I, N, C, S.at), Q = { id: m.length + 1, line: N, column: C, chars: I.text.length, at: S.at };
2583
+ drop(I, C, N, S) {
2584
+ P(C);
2585
+ const _ = S.duration ?? 250, V = C === I.line, ee = S.easing ?? (V ? "linear" : "ease-out"), L = q.landing(I, C, N, S.at), Q = { id: m.length + 1, line: C, column: N, chars: I.text.length, at: S.at };
2586
2586
  return m.push(Q), x[`insert.${Q.id}.open`] = 0, A(`insert.${Q.id}.open`, 0, 1, { at: S.at, duration: _, easing: V ? ee : "ease-out" }), A(`piece.${I.id}.away`, k(`piece.${I.id}.away`, 0), 1, { at: S.at, duration: _, easing: V ? ee : "ease-in-out" }), b.cutAfter(I, S.at), q.move(I, { at: S.at, duration: _, easing: ee, to: { x: L.x, y: L.y } }), A(`piece.${I.id}.rotate`, g.valueAt(`piece.${I.id}.rotate`, S.at), 0, { at: S.at, duration: _ }), q;
2587
2587
  },
2588
- landing(I, N, C, S = 1 / 0) {
2589
- const _ = q.spot(N, C, I.text.length, S), V = N === I.line && C > I.column ? I.text.length * r : 0;
2588
+ landing(I, C, N, S = 1 / 0) {
2589
+ const _ = q.spot(C, N, I.text.length, S), V = C === I.line && N > I.column ? I.text.length * r : 0;
2590
2590
  return w(_.left - V, _.top, _.width, _.height);
2591
2591
  },
2592
- ride(I, N, C) {
2592
+ ride(I, C, N) {
2593
2593
  const S = o.map((_, V) => {
2594
2594
  const ee = g.keys(`line.${V + 1}.shift`) ?? [];
2595
2595
  return { top: E(V + 1), offset: (L) => -bn(ee, L) * a, windows: Pt(ee) };
2596
2596
  });
2597
- return wn(I, N, { ground: C.ground, every: C.every ?? Ye, floors: S });
2597
+ return wn(I, C, { ground: N.ground, every: N.every ?? Ye, floors: S });
2598
2598
  },
2599
2599
  tracks: g.tracks,
2600
- anchor(I, N = 1 / 0) {
2601
- const C = G(I);
2602
- return C.kind === "box" ? q.box : C.kind === "line" ? q.line(C.n, N) : C.kind === "token" ? q.token(C.n, C.text, C.occurrence, N) : q.spot(C.n, C.column, C.width, N);
2603
- },
2604
- edit(I, N, C) {
2605
- const S = () => Y(I, N, "line").map((_) => _.n);
2606
- if (I === "highlight") return q.highlight(S(), C);
2607
- if (I === "strike") return q.strike(S(), C);
2608
- if (I === "remove") return q.remove(S(), C);
2600
+ anchor(I, C = 1 / 0) {
2601
+ const N = G(I);
2602
+ return N.kind === "box" ? q.box : N.kind === "line" ? q.line(N.n, C) : N.kind === "token" ? q.token(N.n, N.text, N.occurrence, C) : q.spot(N.n, N.column, N.width, C);
2603
+ },
2604
+ edit(I, C, N) {
2605
+ const S = () => Y(I, C, "line").map((_) => _.n);
2606
+ if (I === "highlight") return q.highlight(S(), N);
2607
+ if (I === "strike") return q.strike(S(), N);
2608
+ if (I === "remove") return q.remove(S(), N);
2609
2609
  if (I === "type") {
2610
- for (const _ of S()) q.type(_, C);
2610
+ for (const _ of S()) q.type(_, N);
2611
2611
  return q;
2612
2612
  }
2613
2613
  if (I === "insert") {
2614
- const [_] = Y(I, N, "spot", !0);
2615
- return q.insert(_.n, _.column, oe(I, C), C);
2614
+ const [_] = Y(I, C, "spot", !0);
2615
+ return q.insert(_.n, _.column, oe(I, N), N);
2616
2616
  }
2617
2617
  if (I === "write" || I === "drop" || I === "move" || I === "fling") {
2618
- const [_] = Y(I, N, "token", !0), V = q.piece(_.n, _.text, _.occurrence);
2619
- if (I === "write") return q.write(V, oe(I, C), C);
2620
- if (I === "fling") return q.fling(V, C);
2618
+ const [_] = Y(I, C, "token", !0), V = q.piece(_.n, _.text, _.occurrence);
2619
+ if (I === "write") return q.write(V, oe(I, N), N);
2620
+ if (I === "fling") return q.fling(V, N);
2621
2621
  if (I === "drop") {
2622
- const L = typeof C.into == "string" ? G(C.into) : void 0;
2622
+ const L = typeof N.into == "string" ? G(N.into) : void 0;
2623
2623
  if (L?.kind !== "spot") throw new Error("codePanel.edit: drop needs `into`, a spot anchor (spot:N:C)");
2624
- return q.drop(V, L.n, L.column, C);
2624
+ return q.drop(V, L.n, L.column, N);
2625
2625
  }
2626
- const ee = typeof C.to == "string" ? q.anchor(C.to, C.at) : C.to;
2626
+ const ee = typeof N.to == "string" ? q.anchor(N.to, N.at) : N.to;
2627
2627
  if (!ee || typeof ee.x != "number" || typeof ee.y != "number") throw new Error("codePanel.edit: move needs `to`, an anchor name or { x, y }");
2628
- return q.move(V, { ...C, to: ee });
2628
+ return q.move(V, { ...N, to: ee });
2629
2629
  }
2630
2630
  throw uo("codePanel", I, Gt);
2631
2631
  }
2632
2632
  };
2633
2633
  return q;
2634
2634
  }
2635
- function dl(e, t, o, n, a) {
2635
+ function ul(e, t, o, n, a) {
2636
2636
  if (t.style === "wipe") {
2637
2637
  e.beginPath(), t.from === "right" ? e.rect(n.left, n.top, n.width * (1 - o), n.height) : e.rect(n.left + o * n.width, n.top, n.width * (1 - o), n.height), e.clip();
2638
2638
  return;
2639
2639
  }
2640
- const r = cl * o;
2640
+ const r = fl * o;
2641
2641
  if (r > 0.2 && "filter" in e && (e.filter = `blur(${r.toFixed(1)}px)`), e.globalAlpha *= 1 - o, t.style === "fly") {
2642
2642
  const s = t.from === "right" ? -1 : 1;
2643
- e.translate(s * o * hl * a, 0), e.rotate(s * o * 0.08);
2643
+ e.translate(s * o * dl * a, 0), e.rotate(s * o * 0.08);
2644
2644
  } else {
2645
2645
  const s = 1 + 0.08 * o, i = n.left + n.width / 2, h = n.top + n.height / 2;
2646
2646
  e.translate(i, h), e.scale(s, s), e.translate(-i, -h);
@@ -2660,7 +2660,7 @@ const Pr = {
2660
2660
  drop: "drop(piece, n, column, { at, duration? }): put a piece into a line (into its own line it slides, the text closing behind it)",
2661
2661
  ride: "ride(tracks, figureId, { ground }): a figure’s tracks with it carried by the line it stands on"
2662
2662
  };
2663
- function fl(e) {
2663
+ function gl(e) {
2664
2664
  const t = [
2665
2665
  [/^line\.\d+\.highlight$/, { description: "How much the line is tinted", unit: "0..1", min: 0, max: 1 }],
2666
2666
  [/^line\.\d+\.strike$/, { description: "How far the strike-through has drawn", unit: "0..1", min: 0, max: 1 }],
@@ -2694,7 +2694,7 @@ const oo = {
2694
2694
  plain: []
2695
2695
  };
2696
2696
  oo.typescript = [...oo.javascript, "enum", "interface", "type", "implements", "private", "public", "readonly", "keyof", "as", "declare", "namespace"];
2697
- const Uo = Object.keys(oo), ul = {
2697
+ const Uo = Object.keys(oo), pl = {
2698
2698
  go: "//",
2699
2699
  rust: "//",
2700
2700
  csharp: "//",
@@ -2703,8 +2703,8 @@ const Uo = Object.keys(oo), ul = {
2703
2703
  python: "#",
2704
2704
  plain: null
2705
2705
  };
2706
- function gl(e, t) {
2707
- const o = new Set(oo[t]), n = ul[t], a = [], r = (i, h) => {
2706
+ function ml(e, t) {
2707
+ const o = new Set(oo[t]), n = pl[t], a = [], r = (i, h) => {
2708
2708
  const c = a[a.length - 1];
2709
2709
  c && c.kind === h ? c.text += i : a.push({ text: i, kind: h });
2710
2710
  };
@@ -2764,7 +2764,7 @@ const $o = '"Patrick Hand", "Segoe Print", "Bradley Hand", "Comic Sans MS", "Cha
2764
2764
  opacity: 1,
2765
2765
  rule: { color: "#c9d6ec", spacing: 1.55, margin: "#f0a3a3" }
2766
2766
  }
2767
- }, Jn = ["circle", "box", "underline", "arrow"], Ce = {
2767
+ }, Jn = ["circle", "box", "underline", "arrow"], Ne = {
2768
2768
  kind: "board",
2769
2769
  create: "whiteboard({ x, y, width, height, theme?: whiteboard | chalkboard | lines, fontSize?, items: [{ id, text, at: [x, y], size?, color?, hidden? } | { id, mark: circle | box | underline | arrow, around? | from?, to?, bend?, color?, hidden? }] })",
2770
2770
  anchors: {
@@ -2781,20 +2781,20 @@ const $o = '"Patrick Hand", "Segoe Print", "Bradley Hand", "Comic Sans MS", "Cha
2781
2781
  move: "a term; { at, to: an anchor name or { x, y }, duration? }: move the term there",
2782
2782
  fling: "a term; { at, velocity?, spin?, gravity?, duration? }: throw or knock the term off on a spinning arc"
2783
2783
  }
2784
- }, Zn = 90, Qn = 300, pl = 0.3;
2785
- function Ld(e) {
2784
+ }, Zn = 90, Qn = 300, yl = 0.3;
2785
+ function Dd(e) {
2786
2786
  const t = typeof e.theme == "string" ? e.theme : "whiteboard";
2787
2787
  if (!(t in Rt)) throw new Error(`whiteboard: ${fe("theme", t, Object.keys(Rt))}`);
2788
2788
  const o = typeof e.theme == "object" ? { ...Rt.whiteboard, ...e.theme } : Rt[t], n = e.fontSize ?? 28, a = e.charWidth ?? 0.55, r = (m) => m === void 0 ? o.ink : o.colors[m] ?? m, s = (m) => me(e.x + m.left, e.y + m.top, m.width, m.height), i = It(), h = fo(i), c = {}, l = /* @__PURE__ */ new Map(), d = [], f = [], u = (m, P, A, k) => {
2789
2789
  const y = l.get(m);
2790
- if (!y || y.kind !== "text") throw Ue("whiteboard", k, Ce, `there is no text "${m}" (texts: ${p().join(", ") || "none"})`);
2790
+ if (!y || y.kind !== "text") throw Ue("whiteboard", k, Ne, `there is no text "${m}" (texts: ${p().join(", ") || "none"})`);
2791
2791
  let v = -1;
2792
2792
  for (let E = 0; E < A; E++)
2793
- if (v = y.item.text.indexOf(P, v + 1), v < 0) throw Ue("whiteboard", k, Ce, `text "${m}" has no ${A > 1 ? `${A}th ` : ""}"${P}"`);
2793
+ if (v = y.item.text.indexOf(P, v + 1), v < 0) throw Ue("whiteboard", k, Ne, `text "${m}" has no ${A > 1 ? `${A}th ` : ""}"${P}"`);
2794
2794
  const w = y.size * a;
2795
2795
  return { column: v, box: me(y.box.left + v * w, y.box.top, P.length * w, y.box.height) };
2796
2796
  }, p = () => [...l.values()].filter((m) => m.kind === "text").map((m) => m.item.id), g = (m) => {
2797
- const { kind: P, rest: A } = pt(m), k = (y) => Ue("whiteboard", m, Ce, y);
2797
+ const { kind: P, rest: A } = pt(m), k = (y) => Ue("whiteboard", m, Ne, y);
2798
2798
  if (P === "box") {
2799
2799
  if (A) throw k("box takes no arguments");
2800
2800
  return { kind: P };
@@ -2816,7 +2816,7 @@ function Ld(e) {
2816
2816
  const A = l.get(P.id);
2817
2817
  if (!A || A.kind !== P.kind) {
2818
2818
  const k = [...l.values()].filter((y) => y.kind === P.kind).map((y) => y.item.id);
2819
- throw Ue("whiteboard", m, Ce, `there is no ${P.kind} "${P.id}" (${P.kind}s: ${k.join(", ") || "none"})`);
2819
+ throw Ue("whiteboard", m, Ne, `there is no ${P.kind} "${P.id}" (${P.kind}s: ${k.join(", ") || "none"})`);
2820
2820
  }
2821
2821
  return A.box;
2822
2822
  };
@@ -2832,8 +2832,8 @@ function Ld(e) {
2832
2832
  if (!Jn.includes(m.mark)) throw new Error(`whiteboard: mark "${m.id}": ${fe("mark", m.mark, Jn)}`);
2833
2833
  const P = m.mark === "arrow" ? ["from", "to"] : ["around"];
2834
2834
  for (const v of P) if (typeof m[v] != "string") throw new Error(`whiteboard: ${m.mark} "${m.id}" needs \`${v}\`, a place on the board (an item before it)`);
2835
- const A = new Set([m.from, m.to].filter((v) => typeof v == "string").map((v) => v.split(":")[1])), k = m.mark === "arrow" ? [...l.values()].filter((v) => v.kind === "text" && !A.has(v.item.id)).map((v) => v.box) : [], y = ml(m, b, n, k);
2836
- l.set(m.id, { kind: "mark", item: m, color: r(m.color), points: y, box: wl(y) }), c[`mark.${m.id}.draw`] = m.hidden ? 0 : 1, c[`mark.${m.id}.erase`] = 0;
2835
+ const A = new Set([m.from, m.to].filter((v) => typeof v == "string").map((v) => v.split(":")[1])), k = m.mark === "arrow" ? [...l.values()].filter((v) => v.kind === "text" && !A.has(v.item.id)).map((v) => v.box) : [], y = bl(m, b, n, k);
2836
+ l.set(m.id, { kind: "mark", item: m, color: r(m.color), points: y, box: vl(y) }), c[`mark.${m.id}.draw`] = m.hidden ? 0 : 1, c[`mark.${m.id}.erase`] = 0;
2837
2837
  }
2838
2838
  const T = (m) => d.filter((P) => P.item === m), H = {
2839
2839
  type: "custom",
@@ -2846,9 +2846,9 @@ function Ld(e) {
2846
2846
  kind: "whiteboard",
2847
2847
  summary: `A board with ${l.size} items. Its texts, terms and marks are places in the scene (anchor()); its edits record tracks (edit(), tracks()).`,
2848
2848
  get props() {
2849
- return kl(Object.keys(c));
2849
+ return Sl(Object.keys(c));
2850
2850
  },
2851
- actions: Ce.edits
2851
+ actions: Ne.edits
2852
2852
  },
2853
2853
  draw(m, P) {
2854
2854
  const A = P.props ?? {}, k = (y) => Number(A[y] ?? c[y] ?? 0);
@@ -2897,7 +2897,7 @@ function Ld(e) {
2897
2897
  }
2898
2898
  }, M = {
2899
2899
  kind: "board",
2900
- about: Ce,
2900
+ about: Ne,
2901
2901
  target: H,
2902
2902
  box: me(e.x, e.y, e.width, e.height),
2903
2903
  anchor(m) {
@@ -2967,7 +2967,7 @@ function Ld(e) {
2967
2967
  }
2968
2968
  if (m === "fling")
2969
2969
  return v(["term"], !0), M.fling(w(), A);
2970
- throw uo("whiteboard", m, Ce);
2970
+ throw uo("whiteboard", m, Ne);
2971
2971
  },
2972
2972
  follow(m, P) {
2973
2973
  return h.follow(m, P), M;
@@ -2985,14 +2985,14 @@ function Ld(e) {
2985
2985
  };
2986
2986
  return M;
2987
2987
  }
2988
- function ml(e, t, o, n = []) {
2989
- const a = rn(Fe(e.id)), r = (g) => (a.next() * 2 - 1) * g, s = o * pl;
2988
+ function bl(e, t, o, n = []) {
2989
+ const a = rn(Fe(e.id)), r = (g) => (a.next() * 2 - 1) * g, s = o * yl;
2990
2990
  if (e.mark === "arrow") {
2991
- const g = t(e.from), b = t(e.to), T = es(g, b, s * 0.6), H = es(b, g, s * 0.6), M = Math.hypot(H.x - T.x, H.y - T.y), m = bl(T, H);
2991
+ const g = t(e.from), b = t(e.to), T = es(g, b, s * 0.6), H = es(b, g, s * 0.6), M = Math.hypot(H.x - T.x, H.y - T.y), m = kl(T, H);
2992
2992
  let P = M * (0.06 + r(0.04));
2993
2993
  if (e.bend !== void 0) P = M * e.bend;
2994
2994
  else {
2995
- const y = yl(T, H, m, n, s);
2995
+ const y = wl(T, H, m, n, s);
2996
2996
  y !== 0 && (P = y);
2997
2997
  }
2998
2998
  const A = { x: (T.x + H.x) / 2 + m.x * P, y: (T.y + H.y) / 2 + m.y * P }, k = [];
@@ -3022,7 +3022,7 @@ function ml(e, t, o, n = []) {
3022
3022
  }
3023
3023
  return p;
3024
3024
  }
3025
- function yl(e, t, o, n, a) {
3025
+ function wl(e, t, o, n, a) {
3026
3026
  const r = Math.hypot(t.x - e.x, t.y - e.y);
3027
3027
  if (r < 1e-6) return 0;
3028
3028
  const s = { x: (t.x - e.x) / r, y: (t.y - e.y) / r };
@@ -3044,11 +3044,11 @@ function es(e, t, o) {
3044
3044
  const r = Math.min(n === 0 ? 1 / 0 : (e.width / 2 + o) / Math.abs(n), a === 0 ? 1 / 0 : (e.height / 2 + o) / Math.abs(a));
3045
3045
  return { x: e.x + n * r, y: e.y + a * r };
3046
3046
  }
3047
- function bl(e, t) {
3047
+ function kl(e, t) {
3048
3048
  const o = Math.hypot(t.x - e.x, t.y - e.y) || 1;
3049
3049
  return { x: -(t.y - e.y) / o, y: (t.x - e.x) / o };
3050
3050
  }
3051
- function wl(e) {
3051
+ function vl(e) {
3052
3052
  const t = e.map((r) => r.x), o = e.map((r) => r.y), n = Math.min(...t), a = Math.min(...o);
3053
3053
  return me(n, a, Math.max(...t) - n, Math.max(...o) - a);
3054
3054
  }
@@ -3082,7 +3082,7 @@ function Eo(e, t, o) {
3082
3082
  function os(e, t, o, n, a, r) {
3083
3083
  e.beginPath(), e.moveTo(t + r, o), e.arcTo(t + n, o, t + n, o + a, r), e.arcTo(t + n, o + a, t, o + a, r), e.arcTo(t, o + a, t, o, r), e.arcTo(t, o, t + n, o, r), e.closePath();
3084
3084
  }
3085
- function kl(e) {
3085
+ function Sl(e) {
3086
3086
  const t = [
3087
3087
  [/^text\..+\.write$/, { description: "How much of the text is written", unit: "0..1", min: 0, max: 1 }],
3088
3088
  [/^(text|mark)\..+\.erase$/, { description: "How far it has been wiped off, left to right", unit: "0..1", min: 0, max: 1 }],
@@ -3137,8 +3137,8 @@ const ns = ["bar", "line", "pie", "donut"], ss = 'system-ui, -apple-system, "Seg
3137
3137
  highlight: "bar, point or slice anchors; { at, duration?, on? }: colour it out (on: false clears)",
3138
3138
  pull: "slice anchors; { at, duration?, on? }: pull the slice out from the centre (on: false puts it back)"
3139
3139
  }
3140
- }, vl = 600, Sl = 500, Ml = 200, $l = 400, El = 0.14, Al = Math.PI * 2;
3141
- function Fd(e) {
3140
+ }, Ml = 600, $l = 500, El = 200, Al = 400, Tl = 0.14, Pl = Math.PI * 2;
3141
+ function qd(e) {
3142
3142
  if (!ns.includes(e.kind)) throw new Error(`chart: ${fe("kind", e.kind, ns)}`);
3143
3143
  const t = typeof e.theme == "string" ? e.theme : "light";
3144
3144
  if (!(t in Wt)) throw new Error(`chart: ${fe("theme", t, Object.keys(Wt))}`);
@@ -3164,7 +3164,7 @@ function Fd(e) {
3164
3164
  for (const z of s) d($, z);
3165
3165
  l.add($.id);
3166
3166
  }
3167
- const f = n === "bar" ? "bar" : n === "line" ? "point" : "slice", u = Math.max(...e.data.flatMap(($) => s.map((z) => d($, z)))), p = a ? e.data.reduce(($, z) => $ + d(z, s[0]), 0) : e.max ?? Tl(u * 1.1);
3167
+ const f = n === "bar" ? "bar" : n === "line" ? "point" : "slice", u = Math.max(...e.data.flatMap(($) => s.map((z) => d($, z)))), p = a ? e.data.reduce(($, z) => $ + d(z, s[0]), 0) : e.max ?? Ol(u * 1.1);
3168
3168
  if (!a && !(p > 0)) throw new Error(`chart: \`max\` must be above 0 (got ${p})`);
3169
3169
  const g = Math.max(10, Math.min(16, e.height / 20)), b = r && e.legend !== !1, T = a ? void 0 : e.axis?.x, H = a ? void 0 : e.axis?.y, M = e.title ? g * 2.3 : g * 0.5, m = {
3170
3170
  left: g * 3.6 + (H ? g * 1.5 : 0),
@@ -3183,15 +3183,15 @@ function Fd(e) {
3183
3183
  q.set(z.id, me($ - te, M, te, g * 1.4)), $ -= te + g * 0.6;
3184
3184
  }
3185
3185
  }
3186
- const I = It(), N = fo(I), C = {}, S = ($, z, U) => r ? `${f}.${$}.${z}.${U}` : `${f}.${$}.${U}`;
3186
+ const I = It(), C = fo(I), N = {}, S = ($, z, U) => r ? `${f}.${$}.${z}.${U}` : `${f}.${$}.${U}`;
3187
3187
  for (const $ of e.data)
3188
3188
  for (const z of s)
3189
- C[S($.id, z.id, "value")] = d($, z), C[S($.id, z.id, "show")] = $.hidden ? 0 : 1, C[S($.id, z.id, "highlight")] = 0, a && (C[S($.id, z.id, "pull")] = 0);
3190
- const _ = ($, z) => I.keys($)?.length ? bn(I.keys($), z) : C[$], V = ($, z, U) => _(S($, z, "value"), U) * (n === "bar" ? _(S($, z, "show"), U) : 1) * w, ee = ($) => {
3189
+ N[S($.id, z.id, "value")] = d($, z), N[S($.id, z.id, "show")] = $.hidden ? 0 : 1, N[S($.id, z.id, "highlight")] = 0, a && (N[S($.id, z.id, "pull")] = 0);
3190
+ const _ = ($, z) => I.keys($)?.length ? bn(I.keys($), z) : N[$], V = ($, z, U) => _(S($, z, "value"), U) * (n === "bar" ? _(S($, z, "show"), U) : 1) * w, ee = ($) => {
3191
3191
  const z = s[0].id, U = e.data.map((D) => Math.max(0, $(S(D.id, z, "value"))) * Math.max(0, Math.min(1, $(S(D.id, z, "show"))))), te = U.reduce((D, R) => D + R, 0), B = /* @__PURE__ */ new Map();
3192
3192
  let le = -Math.PI / 2;
3193
3193
  return e.data.forEach((D, R) => {
3194
- const J = te > 0 ? Al * U[R] / te : 0, he = le + J / 2, de = Math.max(0, Math.min(1, $(S(D.id, z, "pull")))) * G.r * El;
3194
+ const J = te > 0 ? Pl * U[R] / te : 0, he = le + J / 2, de = Math.max(0, Math.min(1, $(S(D.id, z, "pull")))) * G.r * Tl;
3195
3195
  B.set(D.id, {
3196
3196
  start: le,
3197
3197
  sweep: J,
@@ -3244,15 +3244,15 @@ function Fd(e) {
3244
3244
  y: e.y,
3245
3245
  width: e.width,
3246
3246
  height: e.height,
3247
- props: C,
3247
+ props: N,
3248
3248
  about: {
3249
3249
  kind: `${n} chart`,
3250
3250
  summary: `A ${n} chart of ${e.data.length} values (${e.data.map(($) => $.id).join(", ")})${r ? ` in ${s.length} series (${s.map(($) => $.id).join(", ")})` : ""}${a ? "" : `, scaled to ${p}`}. Its ${f}s and labels are places in the scene (anchor()); its edits record tracks (edit(), tracks()).`,
3251
- props: Object.fromEntries(Object.keys(C).map(($) => [$, Hl($)])),
3251
+ props: Object.fromEntries(Object.keys(N).map(($) => [$, xl($)])),
3252
3252
  actions: st.edits
3253
3253
  },
3254
3254
  draw($, z) {
3255
- const U = z.props ?? {}, te = (D) => Number(U[D] ?? C[D] ?? 0);
3255
+ const U = z.props ?? {}, te = (D) => Number(U[D] ?? N[D] ?? 0);
3256
3256
  if ($.save(), $.fillStyle = o.background, rs($, 0, 0, e.width, e.height, 8), $.fill(), $.font = `${g}px ${o.font}`, $.textBaseline = "middle", e.title && ($.fillStyle = o.text, $.textAlign = "left", $.font = `600 ${g * 1.2}px ${o.font}`, $.fillText(e.title, a ? g : m.left, g * 1.5), $.font = `${g}px ${o.font}`), b) {
3257
3257
  $.textAlign = "left";
3258
3258
  for (const D of s) {
@@ -3267,7 +3267,7 @@ function Fd(e) {
3267
3267
  $.lineWidth = 1, $.textAlign = "right";
3268
3268
  for (let D = 0; D <= 4; D++) {
3269
3269
  const R = m.bottom - P * D / 4;
3270
- $.strokeStyle = o.grid, $.beginPath(), $.moveTo(m.left, R), $.lineTo(m.right, R), $.stroke(), $.fillStyle = o.text, $.globalAlpha = 0.7, $.fillText(Pl(p * D / 4), m.left - g * 0.5, R), $.globalAlpha = 1;
3270
+ $.strokeStyle = o.grid, $.beginPath(), $.moveTo(m.left, R), $.lineTo(m.right, R), $.stroke(), $.fillStyle = o.text, $.globalAlpha = 0.7, $.fillText(Hl(p * D / 4), m.left - g * 0.5, R), $.globalAlpha = 1;
3271
3271
  }
3272
3272
  (H || T) && ($.fillStyle = o.text, $.textAlign = "center", $.globalAlpha = 0.85, H && ($.save(), $.translate(g * 0.9, (m.top + m.bottom) / 2), $.rotate(-Math.PI / 2), $.fillText(H, 0, 0), $.restore()), T && $.fillText(T, (m.left + m.right) / 2, m.bottom + g * 2.3), $.globalAlpha = 1);
3273
3273
  const B = (D, R) => te(S(D, R, "value")) * (n === "bar" ? te(S(D, R, "show")) : 1) * w, le = (D, R) => Ao(c(R), o.highlight, te(S(D, R, "highlight")));
@@ -3290,7 +3290,7 @@ function Fd(e) {
3290
3290
  for (const D of e.data) {
3291
3291
  for (const R of s) {
3292
3292
  const J = n === "bar" ? x(D.id, R.id) : O(D.id), he = B(D.id, R.id), de = te(S(D.id, R.id, "show"));
3293
- if ($.fillStyle = le(D.id, R.id), n === "bar" ? he > 0.5 && (Ol($, J - y / 2, m.bottom - he, y, he, Math.min(6, y / 4)), $.fill()) : de > 0 && ($.beginPath(), $.arc(J, m.bottom - he, v * Math.min(1, de * 1.5) * (1 + 0.3 * te(S(D.id, R.id, "highlight"))), 0, Math.PI * 2), $.fill()), e.values !== !1 && de > 0) {
3293
+ if ($.fillStyle = le(D.id, R.id), n === "bar" ? he > 0.5 && (Il($, J - y / 2, m.bottom - he, y, he, Math.min(6, y / 4)), $.fill()) : de > 0 && ($.beginPath(), $.arc(J, m.bottom - he, v * Math.min(1, de * 1.5) * (1 + 0.3 * te(S(D.id, R.id, "highlight"))), 0, Math.PI * 2), $.fill()), e.values !== !1 && de > 0) {
3294
3294
  $.globalAlpha = Math.min(1, de * 2), $.font = `600 ${r ? g * 0.85 : g}px ${o.font}`, $.fillStyle = Ao(o.text, o.highlight, te(S(D.id, R.id, "highlight")));
3295
3295
  const pe = m.bottom - he - (n === "line" ? v : 0) - g * 0.95;
3296
3296
  $.fillText(F(te(S(D.id, R.id, "value"))), J, pe), $.font = `${g}px ${o.font}`, $.globalAlpha = 1;
@@ -3335,8 +3335,8 @@ function Fd(e) {
3335
3335
  if (U) return U;
3336
3336
  const te = { id: Z.size + 1, datum: z.id, home: X(re(z, 0)) };
3337
3337
  Z.set(z.id, te);
3338
- for (const B of ["x", "y", "rotate"]) C[`piece.${te.id}.${B}`] = 0;
3339
- return C[`piece.${te.id}.opacity`] = 1, te;
3338
+ for (const B of ["x", "y", "rotate"]) N[`piece.${te.id}.${B}`] = 0;
3339
+ return N[`piece.${te.id}.opacity`] = 1, te;
3340
3340
  },
3341
3341
  edit($, z, U) {
3342
3342
  const te = Array.isArray(z) ? z : [z];
@@ -3352,19 +3352,19 @@ function Fd(e) {
3352
3352
  const R = (J) => S(le, D, J);
3353
3353
  if ($ === "set") {
3354
3354
  if (typeof U.value != "number" || !Number.isFinite(U.value)) throw new Error("chart.edit: set needs `value`, a number");
3355
- I.tween(R("value"), _(R("value"), U.at), U.value, U, vl);
3356
- } else $ === "show" ? I.tween(R("show"), _(R("show"), U.at), U.on === !1 ? 0 : 1, U, Sl) : $ === "pull" ? I.tween(R("pull"), _(R("pull"), U.at), U.on === !1 ? 0 : 1, U, $l) : I.tween(R("highlight"), _(R("highlight"), U.at), U.on === !1 ? 0 : 1, U, Ml);
3355
+ I.tween(R("value"), _(R("value"), U.at), U.value, U, Ml);
3356
+ } else $ === "show" ? I.tween(R("show"), _(R("show"), U.at), U.on === !1 ? 0 : 1, U, $l) : $ === "pull" ? I.tween(R("pull"), _(R("pull"), U.at), U.on === !1 ? 0 : 1, U, Al) : I.tween(R("highlight"), _(R("highlight"), U.at), U.on === !1 ? 0 : 1, U, El);
3357
3357
  }
3358
3358
  return ie;
3359
3359
  },
3360
3360
  follow($, z) {
3361
- return N.follow($, z), ie;
3361
+ return C.follow($, z), ie;
3362
3362
  },
3363
3363
  fling($, z) {
3364
- return N.fling($, z), ie;
3364
+ return C.fling($, z), ie;
3365
3365
  },
3366
3366
  move($, z) {
3367
- return N.move($, z), ie;
3367
+ return C.move($, z), ie;
3368
3368
  },
3369
3369
  ride($, z, U) {
3370
3370
  if (n !== "bar") return $;
@@ -3380,13 +3380,13 @@ function Fd(e) {
3380
3380
  };
3381
3381
  return ie;
3382
3382
  }
3383
- function Tl(e) {
3383
+ function Ol(e) {
3384
3384
  if (!(e > 0)) return 1;
3385
3385
  const t = 10 ** Math.floor(Math.log10(e));
3386
3386
  for (const o of [1, 2, 2.5, 5, 10]) if (o * t >= e - 1e-9) return o * t;
3387
3387
  return 10 * t;
3388
3388
  }
3389
- function Pl(e) {
3389
+ function Hl(e) {
3390
3390
  return Number.isInteger(e) ? String(e) : String(Number(e.toFixed(2)));
3391
3391
  }
3392
3392
  function Ao(e, t, o) {
@@ -3400,14 +3400,14 @@ function Ao(e, t, o) {
3400
3400
  function rs(e, t, o, n, a, r) {
3401
3401
  e.beginPath(), e.moveTo(t + r, o), e.arcTo(t + n, o, t + n, o + a, r), e.arcTo(t + n, o + a, t, o + a, r), e.arcTo(t, o + a, t, o, r), e.arcTo(t, o, t + n, o, r), e.closePath();
3402
3402
  }
3403
- function Ol(e, t, o, n, a, r) {
3403
+ function Il(e, t, o, n, a, r) {
3404
3404
  const s = Math.min(r, a);
3405
3405
  e.beginPath(), e.moveTo(t, o + a), e.lineTo(t, o + s), e.arcTo(t, o, t + s, o, s), e.lineTo(t + n - s, o), e.arcTo(t + n, o, t + n, o + s, s), e.lineTo(t + n, o + a), e.closePath();
3406
3406
  }
3407
- function Hl(e) {
3407
+ function xl(e) {
3408
3408
  return e.endsWith(".value") ? { description: "Its value (the bar’s height, the point’s, or the slice’s share, and its value label)", unit: "value" } : e.endsWith(".show") ? { description: "How much of it is shown: a bar grown in from the axis, the line drawn out to the point, a slice opened", unit: "0..1", min: 0, max: 1 } : e.endsWith(".pull") ? { description: "How far the slice is pulled out from the centre", unit: "0..1", min: 0, max: 1 } : e.startsWith("piece.") ? { description: e.endsWith(".opacity") ? "The loose slice’s opacity" : e.endsWith(".rotate") ? "The loose slice’s turn, degrees" : "The loose slice’s offset from home, px", unit: e.endsWith(".rotate") ? "degrees" : e.endsWith(".opacity") ? "0..1" : "px" } : { description: "How much it is coloured out", unit: "0..1", min: 0, max: 1 };
3409
3409
  }
3410
- const Il = {
3410
+ const jl = {
3411
3411
  animeBoy: {
3412
3412
  label: "Anime boy",
3413
3413
  group: "anime",
@@ -3569,7 +3569,7 @@ const Il = {
3569
3569
  outfit: { shirt: "#6d9b93", trousers: "#66597a", sleeves: "long", over: "cardigan", overColor: "#6d9b93", shoes: "boots" }
3570
3570
  }
3571
3571
  }
3572
- }, xl = {
3572
+ }, _l = {
3573
3573
  mangaYoungMan: {
3574
3574
  label: "Manga young man",
3575
3575
  group: "manga",
@@ -3746,10 +3746,10 @@ const Il = {
3746
3746
  scale: 0.97,
3747
3747
  options: { build: "stocky", hair: { style: "shoulderStraight", color: xe.blond }, hat: "sunHat", ears: !0, outfit: { shirt: "#d64535", trousers: "#4f6b3a", sleeves: "long" } }
3748
3748
  },
3749
- ...Il,
3750
- ...xl
3749
+ ...jl,
3750
+ ..._l
3751
3751
  };
3752
- function Dd(e, t = 300, o = {}) {
3752
+ function Bd(e, t = 300, o = {}) {
3753
3753
  const n = Or[e];
3754
3754
  if (!n) throw new Error(`castMember: unknown cast member '${e}'`);
3755
3755
  return { ...n.options, height: Math.round(t * n.scale), ...o };
@@ -3760,11 +3760,11 @@ const no = {
3760
3760
  fistBump: { height: 0.55, spacing: 0.44, lean: 6 },
3761
3761
  handOver: { height: 0.52, spacing: 0.46, lean: 8 }
3762
3762
  };
3763
- function qd(e, t, o) {
3763
+ function Gd(e, t, o) {
3764
3764
  return no[e].spacing * Math.min(t.height, o.height);
3765
3765
  }
3766
3766
  const as = 0.075;
3767
- function Bd(e, t, o, n = {}) {
3767
+ function Yd(e, t, o, n = {}) {
3768
3768
  const a = no[e];
3769
3769
  if (!a) throw new Error(`meetHands: unknown meeting '${e}' (one of ${Object.keys(no).join(", ")})`);
3770
3770
  const [r, s] = t.x <= o.x ? [t, o] : [o, t], i = n.view === "side", h = Math.min(r.character.height, s.character.height), c = { x: (r.x + s.x) / 2, y: -(n.height ?? a.height) * h }, l = (b, T) => {
@@ -3786,10 +3786,10 @@ function Bd(e, t, o, n = {}) {
3786
3786
  return t.x <= o.x ? { a: d, b: f, point: c, reached: g } : { a: f, b: d, point: c, reached: g };
3787
3787
  }
3788
3788
  const Xo = { spacing: 0.3, lean: 10, tilt: 8 };
3789
- function Gd(e, t) {
3789
+ function Ud(e, t) {
3790
3790
  return Xo.spacing * Math.min(e.height, t.height);
3791
3791
  }
3792
- function Yd(e, t, o = {}) {
3792
+ function Xd(e, t, o = {}) {
3793
3793
  const [n, a] = e.x <= t.x ? [e, t] : [t, e], r = o.view === "side", s = Math.min(n.character.height, a.character.height), i = (p, g, b) => ({
3794
3794
  over: { x: g.x - b * 0.02 * s - p.x, y: -0.72 * s, depth: -0.08 * s },
3795
3795
  round: { x: g.x - b * 0.04 * s - p.x, y: -0.5 * s, depth: 0.06 * s }
@@ -3805,10 +3805,10 @@ function Yd(e, t, o = {}) {
3805
3805
  return e.x <= t.x ? { a: c, b: l, reached: u } : { a: l, b: c, reached: u };
3806
3806
  }
3807
3807
  const rt = { spacing: 0.32, low: 0.3, high: 0.5, helperLean: 40, helperBend: 16 };
3808
- function Ud(e, t) {
3808
+ function Vd(e, t) {
3809
3809
  return rt.spacing * Math.min(e.height, t.height);
3810
3810
  }
3811
- function Xd(e, t, o, n = {}) {
3811
+ function Jd(e, t, o, n = {}) {
3812
3812
  const a = Math.max(0, Math.min(1, o)), r = n.view === "side", s = e.x <= t.x, i = Math.min(e.character.height, t.character.height), h = { x: (e.x + t.x) / 2, y: -(rt.low + (rt.high - rt.low) * a) * i }, c = (b) => b ? r ? 1 : 0.62 : r ? 3 : 3.38;
3813
3813
  let l = { ...ye, ...e.pose, turn: c(s), lean: (e.pose?.lean ?? 0) + rt.helperLean * (1 - a) + 4, bend: (e.pose?.bend ?? 0) + rt.helperBend * (1 - a), "head.nod": 18 * (1 - a) };
3814
3814
  l = Le(e.character, l, "arm.right", { x: h.x - e.x, y: h.y });
@@ -3821,8 +3821,8 @@ function Xd(e, t, o, n = {}) {
3821
3821
  };
3822
3822
  return { helper: l, sitter: u, point: h, reached: g(e, l) && g(t, u) };
3823
3823
  }
3824
- const jl = 0.7, _l = 50, Kl = 1.2, Nl = 0.8, Cl = 3, Rl = 30, Wl = 0.8, zl = 0.6, To = (e, t) => Math.max(-t, Math.min(t, e)), Ll = ["hair.swing", "hair.trail", "hair.lift"];
3825
- function Fl(e, t) {
3824
+ const Kl = 0.7, Cl = 50, Nl = 1.2, Rl = 0.8, Wl = 3, zl = 30, Ll = 0.8, Fl = 0.6, To = (e, t) => Math.max(-t, Math.min(t, e)), Dl = ["hair.swing", "hair.trail", "hair.lift"];
3825
+ function ql(e, t) {
3826
3826
  const o = t.start ?? 0, n = t.amount ?? 1, a = Math.max(1e-6, t.headRadius);
3827
3827
  let r = NaN, s = { x: 0, y: 0, turn: 0 };
3828
3828
  const i = (u) => (u !== r && (s = e(u), r = u), s), h = (u) => {
@@ -3830,16 +3830,16 @@ function Fl(e, t) {
3830
3830
  return p.turn * 90 + (p.headTurn ?? 0);
3831
3831
  }, c = { start: o, end: t.end, step: t.step, stiffness: t.stiffness ?? 70, damping: t.damping ?? 6 }, l = Bt(h, c), d = Bt((u) => i(u).x, c), f = Bt((u) => i(u).y, c);
3832
3832
  return l.map((u, p) => {
3833
- const g = i(u.time), b = u.value - h(u.time), T = d[p].value - g.x - (t.wind ?? 0) * jl * a, H = f[p].value - g.y, M = Math.sin(g.turn * Math.PI / 2), m = Math.cos(g.turn * Math.PI / 2), P = b * Cl + T * m / a * Rl, A = -T * M / a * Wl, k = -H / a * zl;
3833
+ const g = i(u.time), b = u.value - h(u.time), T = d[p].value - g.x - (t.wind ?? 0) * Kl * a, H = f[p].value - g.y, M = Math.sin(g.turn * Math.PI / 2), m = Math.cos(g.turn * Math.PI / 2), P = b * Wl + T * m / a * zl, A = -T * M / a * Ll, k = -H / a * Fl;
3834
3834
  return {
3835
3835
  time: u.time,
3836
- swing: To(P * n, _l),
3837
- trail: To(A * n, Kl),
3838
- lift: To(k * n, Nl)
3836
+ swing: To(P * n, Cl),
3837
+ trail: To(A * n, Nl),
3838
+ lift: To(k * n, Rl)
3839
3839
  };
3840
3840
  });
3841
3841
  }
3842
- function Vd(e, t) {
3842
+ function Zd(e, t) {
3843
3843
  if (e.length === 0) return { "hair.swing": 0, "hair.trail": 0, "hair.lift": 0 };
3844
3844
  if (t <= e[0].time) return is(e[0]);
3845
3845
  if (t >= e[e.length - 1].time) return is(e[e.length - 1]);
@@ -3855,8 +3855,8 @@ function Vd(e, t) {
3855
3855
  "hair.lift": a.lift + (r.lift - a.lift) * s
3856
3856
  };
3857
3857
  }
3858
- const is = (e) => ({ "hair.swing": e.swing, "hair.trail": e.trail, "hair.lift": e.lift }), ot = 16, Dl = 1500;
3859
- function Jd(e, t, o, n = {}) {
3858
+ const is = (e) => ({ "hair.swing": e.swing, "hair.trail": e.trail, "hair.lift": e.lift }), ot = 16, Bl = 1500;
3859
+ function Qd(e, t, o, n = {}) {
3860
3860
  const a = o.head.hair;
3861
3861
  if (!a || !ca(a)) return [];
3862
3862
  const r = t.filter((H) => H.target === e), s = r.reduce((H, M) => M.keyframes.reduce((m, P) => Math.max(m, P.time), H), 0), i = ye, h = /* @__PURE__ */ new Set(["x", "y", "turn", "head.turn"]), c = new ve({ id: `${e}-hair-follow`, tracks: r.filter((H) => h.has(H.property)) }), l = (H, M, m) => {
@@ -3875,7 +3875,7 @@ function Jd(e, t, o, n = {}) {
3875
3875
  }, g = (H) => {
3876
3876
  const M = Math.floor(H / ot), m = H / ot - M, P = p(M * ot), A = p((M + 1) * ot);
3877
3877
  return { x: P.x + (A.x - P.x) * m, y: P.y + (A.y - P.y) * m };
3878
- }, b = Fl(
3878
+ }, b = ql(
3879
3879
  (H) => {
3880
3880
  const M = g(H);
3881
3881
  return {
@@ -3887,7 +3887,7 @@ function Jd(e, t, o, n = {}) {
3887
3887
  },
3888
3888
  {
3889
3889
  start: 0,
3890
- end: s + (n.settle ?? Dl),
3890
+ end: s + (n.settle ?? Bl),
3891
3891
  headRadius: Oe(o, ye).head.rx,
3892
3892
  step: n.step,
3893
3893
  stiffness: n.stiffness,
@@ -3896,7 +3896,7 @@ function Jd(e, t, o, n = {}) {
3896
3896
  wind: n.wind
3897
3897
  }
3898
3898
  ), T = [];
3899
- for (const H of Ll) {
3899
+ for (const H of Dl) {
3900
3900
  const M = H.slice(5);
3901
3901
  let m = b.map((A) => ({ time: A.time, value: A[M] }));
3902
3902
  if (m.every((A) => Math.abs(A.value) < 1e-3)) continue;
@@ -3977,25 +3977,25 @@ function Hr(e) {
3977
3977
  const { base: t, ...o } = e;
3978
3978
  return { ...ht[t ?? "full"], ...o };
3979
3979
  }
3980
- const Vo = 160, ql = 120, Bl = 700, Po = 60, Gl = 90, zt = 3200, ct = 1, Xe = 1e-6;
3980
+ const Vo = 160, Gl = 120, Yl = 700, Po = 60, Ul = 90, zt = 3200, ct = 1, Xe = 1e-6;
3981
3981
  function kn(e, t, o = {}) {
3982
3982
  const n = Hr(o.style), a = o.seed ?? 1, r = {};
3983
3983
  if (e.length === 0) return r;
3984
3984
  const s = Object.keys(e[0].pose).filter((d) => e.some((f) => Math.abs(f.pose[d] - e[0].pose[d]) > Xe));
3985
- for (const d of s) r[d] = Yl(d, e, t, n, a);
3985
+ for (const d of s) r[d] = Xl(d, e, t, n, a);
3986
3986
  const i = t.blink, h = i !== void 0 && s.includes(i);
3987
3987
  if (n.blinks && i !== void 0 && !h && i in e[0].pose) {
3988
- const d = Ul(e, t, n, a, e[0].pose[i]);
3988
+ const d = Vl(e, t, n, a, e[0].pose[i]);
3989
3989
  d.length > 0 && (r[i] = d);
3990
3990
  }
3991
3991
  const { lift: c, stretch: l } = t;
3992
3992
  if (n.jumpSquash > 0 && c && l && s.includes(c) && !s.includes(l) && l in e[0].pose) {
3993
- const d = Xl(e, c, e[0].pose[l], n.jumpSquash);
3993
+ const d = Jl(e, c, e[0].pose[l], n.jumpSquash);
3994
3994
  d.length > 0 && (r[l] = d);
3995
3995
  }
3996
3996
  return r;
3997
3997
  }
3998
- function Yl(e, t, o, n, a) {
3998
+ function Xl(e, t, o, n, a) {
3999
3999
  const r = o.eyes.includes(e), s = o.limits[e], i = s !== void 0, h = r ? -n.eyeLead : (o.depth[e] ?? 1) * n.overlap, c = (u) => {
4000
4000
  const p = (t[u].time - t[u - 1].time) / 2;
4001
4001
  return Math.max(-p, Math.min(p, h));
@@ -4014,7 +4014,7 @@ function Yl(e, t, o, n, a) {
4014
4014
  const E = p.time + (M ? c(u) : 0);
4015
4015
  if (u === t.length - 1)
4016
4016
  Math.abs(f - b) > Xe && d(Math.max(E, H + Vo), b, "ease-in-out"), f = b;
4017
- else if (M && i && n.drift > 0 && o.drift.includes(e) && E - H >= Bl) {
4017
+ else if (M && i && n.drift > 0 && o.drift.includes(e) && E - H >= Yl) {
4018
4018
  const O = Fe(`${a}:${e}:${u}`) % 2 === 0 ? 1 : -1;
4019
4019
  f = b + O * n.drift * s, d(E, f, "ease-in-out");
4020
4020
  }
@@ -4039,7 +4039,7 @@ function Yl(e, t, o, n, a) {
4039
4039
  d(O, E, "ease-in-out"), n.hold > 0 && d(O + k * n.hold, E);
4040
4040
  }
4041
4041
  const v = u + 1 < t.length ? t[u + 1].time - p.time : 1 / 0, w = Math.min(n.settle, v / 2);
4042
- if (i && n.overshoot > 0 && s > 0 && k >= ql && w > ct) {
4042
+ if (i && n.overshoot > 0 && s > 0 && k >= Gl && w > ct) {
4043
4043
  const E = Math.min(Math.abs(T) * n.overshoot, s);
4044
4044
  d(A, b + y * E, p.easing ?? n.actionEase), d(A + w, b, n.settleEase);
4045
4045
  } else
@@ -4048,8 +4048,8 @@ function Yl(e, t, o, n, a) {
4048
4048
  }
4049
4049
  return l;
4050
4050
  }
4051
- function Ul(e, t, o, n, a) {
4052
- const r = [], s = Po + Gl;
4051
+ function Vl(e, t, o, n, a) {
4052
+ const r = [], s = Po + Ul;
4053
4053
  for (let u = 1; u < e.length; u++) {
4054
4054
  const p = e[u - 1].pose, g = e[u].pose;
4055
4055
  Object.entries(t.headTurns).some(([T, H]) => Math.abs((g[T] ?? 0) - (p[T] ?? 0)) > H) && e[u].act !== !1 && r.push(Math.max(e[0].time, e[u - 1].time - o.eyeLead));
@@ -4069,7 +4069,7 @@ function Ul(e, t, o, n, a) {
4069
4069
  }
4070
4070
  return f.length > 1 ? f : [];
4071
4071
  }
4072
- function Xl(e, t, o, n) {
4072
+ function Jl(e, t, o, n) {
4073
4073
  const a = o * (1 - 0.18 * n), r = o * (1 + 0.14 * n), s = [{ time: e[0].time, value: o }], i = (h, c, l) => {
4074
4074
  const d = s[s.length - 1];
4075
4075
  h <= d.time + ct || s.push({ time: h, value: c, ...l ? { easing: l } : {} });
@@ -4087,7 +4087,7 @@ function Xl(e, t, o, n) {
4087
4087
  }
4088
4088
  return s.length > 1 ? s : [];
4089
4089
  }
4090
- const Vl = {
4090
+ const Zl = {
4091
4091
  depth: {
4092
4092
  lean: 0,
4093
4093
  bend: 0,
@@ -4153,13 +4153,13 @@ const Vl = {
4153
4153
  lift: "rise",
4154
4154
  stretch: "stretch"
4155
4155
  };
4156
- function Jl(e) {
4156
+ function Ql(e) {
4157
4157
  return /^(turn|lean|bend|side|lift|roll|stretch)$/.test(e) ? { depth: 0, limit: { turn: 0.06, lean: 10, bend: 10, side: 8, lift: 0, roll: 25, stretch: 0.08 }[e] } : /^leg\.\w+\.(swing|spread|rotate)$/.test(e) ? { depth: 0, limit: 12 } : /^head\./.test(e) ? { depth: 1, limit: 12 } : /^arm\.\w+\.(swing|spread)$/.test(e) ? { depth: 1, limit: 20 } : /^leg\.\w+\.knee$/.test(e) ? { depth: 1, limit: 15 } : /^(brow\.|browTilt$)/.test(e) ? { depth: 1, limit: e === "browTilt" ? void 0 : 0.25 } : /^eye\./.test(e) ? { depth: 1, limit: 0.15 } : /^arm\.\w+\.(elbow|bend)$/.test(e) ? { depth: 2, limit: 18 } : /^leg\.\w+\.(ankle|toeOut)$/.test(e) ? { depth: 2, limit: 10 } : /^(mouth|smile|mouthWidth)$/.test(e) ? { depth: 2 } : /^hand\./.test(e) ? { depth: 3 } : { depth: 1 };
4158
4158
  }
4159
- function Zl() {
4159
+ function eh() {
4160
4160
  const e = {}, t = {};
4161
4161
  for (const o of Object.keys(ye)) {
4162
- const n = Jl(o);
4162
+ const n = Ql(o);
4163
4163
  e[o] = n.depth, n.limit !== void 0 && (t[o] = n.limit);
4164
4164
  }
4165
4165
  return {
@@ -4173,19 +4173,19 @@ function Zl() {
4173
4173
  stretch: "stretch"
4174
4174
  };
4175
4175
  }
4176
- const Ql = Zl();
4176
+ const th = eh();
4177
4177
  function Ir(e, t) {
4178
4178
  return Object.entries(t).map(([o, n]) => ({ id: `${e}-${o}`, target: e, property: o, keyframes: n }));
4179
4179
  }
4180
- function eh(e, t, o = {}) {
4180
+ function oh(e, t, o = {}) {
4181
4181
  const n = Vs(t), a = t.map((r, s) => ({ time: r.time, pose: { ...n[s] }, easing: r.easing, act: r.act }));
4182
- return Ir(e, kn(a, o.rig ?? Vl, o));
4182
+ return Ir(e, kn(a, o.rig ?? Zl, o));
4183
4183
  }
4184
- function th(e, t, o = {}) {
4184
+ function nh(e, t, o = {}) {
4185
4185
  const n = o.rest ?? ye, a = fa(t, n), r = t.map((s, i) => ({ time: s.time, pose: { ...n, ...a[i] }, easing: s.easing, act: s.act }));
4186
- return Ir(e, kn(r, o.rig ?? Ql, o));
4186
+ return Ir(e, kn(r, o.rig ?? th, o));
4187
4187
  }
4188
- const ls = $e.shocked, oh = $e.scared, Ve = {
4188
+ const ls = $e.shocked, sh = $e.scared, Ve = {
4189
4189
  /** The classic take: squash down in a squint, then shoot up stretched with eyes popping, hang, and land squashed. */
4190
4190
  take: (e) => [
4191
4191
  { after: 140, pose: { stretch: 0.8, bend: 10, lean: e.lean - 4, leftShoulder: 8, rightShoulder: 8, leftEye: 0.35, rightEye: 0.35, leftBrow: -0.6, rightBrow: -0.6, mouth: 0 }, easing: "ease-in-out" },
@@ -4219,7 +4219,7 @@ const ls = $e.shocked, oh = $e.scared, Ve = {
4219
4219
  ],
4220
4220
  /** A frightened shiver: small, fast shakes with wide eyes, then still. */
4221
4221
  tremble: (e) => {
4222
- const t = [{ after: 80, pose: { ...oh, bend: e.bend + 8, leftShoulder: 40, rightShoulder: 40, leftElbow: 110, rightElbow: 110, stretch: 0.94 }, easing: "ease-out" }];
4222
+ const t = [{ after: 80, pose: { ...sh, bend: e.bend + 8, leftShoulder: 40, rightShoulder: 40, leftElbow: 110, rightElbow: 110, stretch: 0.94 }, easing: "ease-out" }];
4223
4223
  for (let o = 1; o <= 14; o++) t.push({ after: 80 + o * 45, pose: { lean: e.lean + (o % 2 === 0 ? 2.5 : -2.5), headTilt: e.headTilt + (o % 2 === 0 ? -2 : 2) } });
4224
4224
  return t.push({ after: 755, pose: { lean: e.lean, headTilt: e.headTilt, bend: e.bend } }), t;
4225
4225
  },
@@ -4245,7 +4245,7 @@ function so(e, t = 1) {
4245
4245
  const o = Ve[e](ce);
4246
4246
  return o[o.length - 1].after * t;
4247
4247
  }
4248
- function nh(e, t, o = {}) {
4248
+ function rh(e, t, o = {}) {
4249
4249
  if (t.length < 2) return;
4250
4250
  const n = Math.max(1, Math.round(o.lines ?? 3)), a = o.spacing ?? 5, r = o.lineWidth ?? 2, s = o.opacity ?? 0.7;
4251
4251
  e.save(), e.strokeStyle = o.color ?? "#222", e.lineCap = "round";
@@ -4258,7 +4258,7 @@ function nh(e, t, o = {}) {
4258
4258
  }
4259
4259
  e.restore();
4260
4260
  }
4261
- const sh = {
4261
+ const ah = {
4262
4262
  hands: [
4263
4263
  { name: "left hand", at: (e) => e.hands.left },
4264
4264
  { name: "right hand", at: (e) => e.hands.right }
@@ -4273,7 +4273,7 @@ const sh = {
4273
4273
  { name: "neck", at: (e) => e.neck }
4274
4274
  ]
4275
4275
  };
4276
- function Zd(e, t, o, n, a = {}) {
4276
+ function ef(e, t, o, n, a = {}) {
4277
4277
  const r = o.stateAt;
4278
4278
  if (!r) return;
4279
4279
  const s = a.length ?? 120, i = Math.max(2, Math.round(a.samples ?? 8)), h = Math.max(0, o.time - s);
@@ -4283,7 +4283,7 @@ function Zd(e, t, o, n, a = {}) {
4283
4283
  const p = h + (o.time - h) * u / (i - 1);
4284
4284
  c.push(Js(t, { time: p, state: r(p) }, n).joints);
4285
4285
  }
4286
- const l = c[c.length - 1].height, d = (a.threshold ?? 1.2) * l, f = (a.parts ?? ["hands", "toes", "head"]).flatMap((u) => sh[u]);
4286
+ const l = c[c.length - 1].height, d = (a.threshold ?? 1.2) * l, f = (a.parts ?? ["hands", "toes", "head"]).flatMap((u) => ah[u]);
4287
4287
  for (const u of f) {
4288
4288
  const p = c.map(u.at);
4289
4289
  let g = 0;
@@ -4291,10 +4291,10 @@ function Zd(e, t, o, n, a = {}) {
4291
4291
  const b = g / ((o.time - h) / 1e3);
4292
4292
  if (b <= d) continue;
4293
4293
  const T = Math.min(1, (b - d) / (d * 0.5));
4294
- nh(e, p, { ...a, opacity: (a.opacity ?? 0.7) * T, spacing: a.spacing ?? l * 0.02 });
4294
+ rh(e, p, { ...a, opacity: (a.opacity ?? 0.7) * T, spacing: a.spacing ?? l * 0.02 });
4295
4295
  }
4296
4296
  }
4297
- function rh(e, t, o, n = {}) {
4297
+ function ih(e, t, o, n = {}) {
4298
4298
  if (o <= 0 || o >= 1) return;
4299
4299
  const a = n.size ?? 40, r = n.seed ?? 1, s = 0.45 + 0.55 * (1 - (1 - o) ** 3);
4300
4300
  e.save(), e.strokeStyle = n.color ?? "#555", e.lineWidth = Math.max(1, a * 0.03), e.globalAlpha = Math.min(1, o / 0.08) * (1 - o);
@@ -4304,17 +4304,17 @@ function rh(e, t, o, n = {}) {
4304
4304
  }
4305
4305
  e.restore();
4306
4306
  }
4307
- function Qd(e, t, o, n = {}) {
4307
+ function tf(e, t, o, n = {}) {
4308
4308
  if (o <= 0 || o >= 1) return;
4309
4309
  const a = n.size ?? 40, r = 5, s = 1 - (1 - o) ** 2;
4310
4310
  e.save(), e.strokeStyle = n.color ?? "#222", e.lineWidth = Math.max(1, a * 0.035), e.lineJoin = "round", e.globalAlpha = o < 0.7 ? 1 : (1 - o) / 0.3;
4311
4311
  for (let i = 0; i < r; i++) {
4312
4312
  const h = -Math.PI / 2 + (i - (r - 1) / 2) * Math.PI / (r + 1), c = a * (0.3 + 0.7 * s), l = t.x + Math.cos(h) * c, d = t.y + Math.sin(h) * c;
4313
- ah(e, l, d, a * 0.14, o * Math.PI + i), e.stroke();
4313
+ lh(e, l, d, a * 0.14, o * Math.PI + i), e.stroke();
4314
4314
  }
4315
4315
  e.restore();
4316
4316
  }
4317
- function ah(e, t, o, n, a) {
4317
+ function lh(e, t, o, n, a) {
4318
4318
  e.beginPath();
4319
4319
  for (let r = 0; r < 10; r++) {
4320
4320
  const s = r % 2 === 0 ? n : n * 0.45, i = a + r * Math.PI / 5 - Math.PI / 2, h = t + Math.cos(i) * s, c = o + Math.sin(i) * s;
@@ -4367,7 +4367,7 @@ function Kr(e = {}) {
4367
4367
  for (const [o, n] of Object.entries(e.actions ?? {})) t[o] = n.summary;
4368
4368
  return t;
4369
4369
  }
4370
- const Jo = ["do", "at", "for", "to", "toward", "mood", "say", "pose", "target", "onto"], ih = {
4370
+ const Jo = ["do", "at", "for", "to", "toward", "mood", "say", "pose", "target", "onto"], hh = {
4371
4371
  action: "do",
4372
4372
  type: "do",
4373
4373
  verb: "do",
@@ -4408,7 +4408,7 @@ function ro(e, t = {}) {
4408
4408
  }
4409
4409
  const f = h;
4410
4410
  for (const g of Object.keys(f))
4411
- Jo.includes(g) || l(fe("beat field", g, Jo, ih[g.toLowerCase()]));
4411
+ Jo.includes(g) || l(fe("beat field", g, Jo, hh[g.toLowerCase()]));
4412
4412
  const u = f.do;
4413
4413
  if (u === void 0) {
4414
4414
  l(`A beat needs \`do\` (what happens). Actions: ${n.join(", ")}`);
@@ -4450,13 +4450,13 @@ ${n.map((a) => ` ${a.beat >= 0 ? `beat ${a.beat}: ` : ""}${a.message}`).join(`
4450
4450
  `)}`);
4451
4451
  }
4452
4452
  ua(Kr);
4453
- function ef(e) {
4453
+ function of(e) {
4454
4454
  const t = "steps" in e && typeof e.steps == "function", o = "beats" in e && typeof e.beats == "function";
4455
4455
  if (t === o) throw new Error("defineAction: give either `steps: (from, beat) => [...]` or `beats: (beat) => [...]`");
4456
4456
  if (!e.summary) throw new Error("defineAction: give a `summary`: one line on what the figure does");
4457
4457
  return e;
4458
4458
  }
4459
- function tf(e) {
4459
+ function nf(e) {
4460
4460
  for (const t of ["swing", "knee", "arm", "elbow", "lean"])
4461
4461
  if (typeof e[t] != "number") throw new Error(`defineGait: \`${t}\` must be a number (degrees)`);
4462
4462
  if (e.cycle !== void 0 && !(e.cycle > 0)) throw new Error("defineGait: `cycle` is ms per two steps, above 0");
@@ -4474,7 +4474,7 @@ function vn(e, t = {}, o = 0) {
4474
4474
  return vn(r, t, o + 1);
4475
4475
  });
4476
4476
  }
4477
- function lh(e) {
4477
+ function ch(e) {
4478
4478
  return e.length === 0 ? 0 : Math.max(...e.map((t) => t.after));
4479
4479
  }
4480
4480
  const fs = {
@@ -4486,9 +4486,9 @@ const fs = {
4486
4486
  tired: 1500,
4487
4487
  shove: 1300,
4488
4488
  run: 560
4489
- }, hh = 450, ch = 2.4, dh = 160, us = 2.5, fh = 200, uh = 340, gh = 1.1, gs = [380, 900], ph = 0.35, Ft = 300, Oo = 150, mh = 260, yh = 1.2, Ho = 160, ps = 400, vt = 300, bh = 450, ms = 500, Io = 350, ys = 150, wh = 120, xo = 180, bs = 420, kh = 300, ws = 300, vh = 140, jo = 150, ks = 450, Sh = 450, _o = 150, vs = 350, Ss = 400, Mh = 12, $h = 600, Ms = 90, $s = 400, Eh = 200, Ah = 0.09, Es = 350, He = 450, Ko = 1200, Th = 700, nt = 320, Ie = 220, Ph = 65, Oh = 700, As = (e) => e in Ve, Hh = (e) => e in Ae;
4490
- function Ih(e) {
4491
- return Math.max(Oh, Array.from(e).length * Ph);
4489
+ }, dh = 450, fh = 2.4, uh = 160, us = 2.5, gh = 200, ph = 340, mh = 1.1, gs = [380, 900], yh = 0.35, Ft = 300, Oo = 150, bh = 260, wh = 1.2, Ho = 160, ps = 400, vt = 300, kh = 450, ms = 500, Io = 350, ys = 150, vh = 120, xo = 180, bs = 420, Sh = 300, ws = 300, Mh = 140, jo = 150, ks = 450, $h = 450, _o = 150, vs = 350, Ss = 400, Eh = 12, Ah = 600, Ms = 90, $s = 400, Th = 200, Ph = 0.09, Es = 350, He = 450, Ko = 1200, Oh = 700, nt = 320, Ie = 220, Hh = 65, Ih = 700, As = (e) => e in Ve, xh = (e) => e in Ae;
4490
+ function jh(e) {
4491
+ return Math.max(Ih, Array.from(e).length * Hh);
4492
4492
  }
4493
4493
  function Sn(e, t, o = {}) {
4494
4494
  const n = { actions: o.actions, gaits: o.gaits };
@@ -4537,17 +4537,17 @@ function Sn(e, t, o = {}) {
4537
4537
  X !== p ? F = j(_, X, S.mood) : g.turn < 1 && (F = _ + Ie, O(F, { turn: 1 }, S.mood));
4538
4538
  const Z = hs("windUp", { at: F, from: S.mood ? at(g, S.mood) : g });
4539
4539
  H.push(...Z), g = Z[Z.length - 1].pose;
4540
- const se = F + so("windUp"), ae = se + hh, ie = ae + Math.max(dh, Math.abs(K - f) / ch);
4540
+ const se = F + so("windUp"), ae = se + dh, ie = ae + Math.max(uh, Math.abs(K - f) / fh);
4541
4541
  k.push({ time: se, value: "run" }), A.push({ time: se, value: 0 }, { time: se + 80, value: 1, easing: "ease-out" }, { time: ie, value: 1 }, { time: ie + 120, value: 0 }), P.push({ time: se, value: b }, { time: ae, value: b + us, easing: "ease-in" }), b += us + (ie - ae) / fs.run * 1.5, P.push({ time: ie, value: b }), M.push({ time: ae, value: f - c }, { time: ie, value: K - c, easing: "ease-in" }), E.push({ kind: "dust", time: ae, x: f, y: u, length: 900 }), f = K, O(ie, {}), V = ie;
4542
4542
  } else if (S.do === "leap") {
4543
4543
  const K = S.to ?? f, X = S.onto ?? u;
4544
4544
  let F = K === f ? _ : W(_, K, S.mood);
4545
4545
  g.turn < 1 && (F += Ie, O(F, { turn: 1 }, S.mood));
4546
4546
  const Z = { leftShoulder: 35, rightShoulder: 35, leftElbow: -50, rightElbow: -50 };
4547
- O(F + fh, { stretch: 0.75, bend: 12, leftHip: 22, rightHip: 22, ...Z }, S.mood, !1);
4548
- const se = F + uh;
4547
+ O(F + gh, { stretch: 0.75, bend: 12, leftHip: 22, rightHip: 22, ...Z }, S.mood, !1);
4548
+ const se = F + ph;
4549
4549
  O(se - 40, { stretch: 0.72 }, void 0, !1), O(se, { stretch: 1.2, bend: -6, leftShoulder: 140, rightShoulder: 140, leftElbow: 20, rightElbow: 20, leftHip: 4, rightHip: 4 }, void 0, !1);
4550
- const ae = Math.hypot(K - f, X - u), ie = S.for ?? Math.min(gs[1], Math.max(gs[0], 300 + ae * gh)), $ = Math.min(u, X) - ph * d, z = Math.sqrt(u - $), U = Math.sqrt(X - $), te = se + ie * z / (z + U), B = se + ie;
4550
+ const ae = Math.hypot(K - f, X - u), ie = S.for ?? Math.min(gs[1], Math.max(gs[0], 300 + ae * mh)), $ = Math.min(u, X) - yh * d, z = Math.sqrt(u - $), U = Math.sqrt(X - $), te = se + ie * z / (z + U), B = se + ie;
4551
4551
  O(te, { stretch: 1, bend: 4, leftHip: -55, leftKnee: -80, rightHip: 55, rightKnee: 80, leftShoulder: 110, rightShoulder: 110 }, void 0, !1), O(B, { stretch: 0.72, bend: 12, leftShoulder: 75, rightShoulder: 75, leftElbow: 0, rightElbow: 0, leftHip: 18, rightHip: 18, leftKnee: 0, rightKnee: 0 }, void 0, !1), O(B + 180, { stretch: 1.05, bend: -3 }, void 0, !1), O(B + 340, { stretch: 1, bend: 0, leftHip: ce.leftHip, rightHip: ce.rightHip, leftShoulder: ce.leftShoulder, rightShoulder: ce.rightShoulder, leftElbow: ce.leftElbow, rightElbow: ce.rightElbow }, void 0, !1), M.push({ time: se, value: f - c }, { time: B, value: K - c }), m.push(
4552
4552
  { time: se, value: u - l },
4553
4553
  { time: te, value: $ - l, easing: "ease-out-quad" },
@@ -4555,7 +4555,7 @@ function Sn(e, t, o = {}) {
4555
4555
  ), f = K, u = X, E.push({ kind: "dust", time: B, x: f, y: u, length: 500 }), V = B + 340, ee = B;
4556
4556
  } else if (S.do === "point" && S.target) {
4557
4557
  const K = S.target, X = W(_, K.x, S.mood), F = { ...g, ...S.mood ? $e[S.mood] : {}, turn: Math.max(g.turn, 0.6), rightElbow: 0, rightWrist: 0, ...Q }, Z = je(F, { height: d, facing: p }).head.center, se = Math.abs(K.x - (f + Z.x)), ae = K.y - (u + Z.y), ie = X + He;
4558
- O(ie, { ...F, rightShoulder: G(F, K.x, K.y), lookX: 1, lookY: xh(ae / Math.max(1, Math.hypot(se, ae))) * 0.8 }), V = ie + (S.for ?? Ko), ee = ie, L = V;
4558
+ O(ie, { ...F, rightShoulder: G(F, K.x, K.y), lookX: 1, lookY: _h(ae / Math.max(1, Math.hypot(se, ae))) * 0.8 }), V = ie + (S.for ?? Ko), ee = ie, L = V;
4559
4559
  } else if (S.do === "swipe") {
4560
4560
  const K = S.target ?? { x: f + p * d * 0.5, y: u - d * 0.6 }, X = x(K.x), F = W(_, K.x, S.mood), Z = X === 1 ? K.left ?? K.x : K.right ?? K.x, se = X === 1 ? K.right ?? K.x : K.left ?? K.x, ae = { ...g, turn: 1, lean: -10, bend: -8, rightElbow: 40, lookX: 1, ...Q };
4561
4561
  O(F + Ft, { ...ae, rightShoulder: G(ae, f - p * d * 0.3, u - d * 1.1) }, S.mood, !1);
@@ -4563,7 +4563,7 @@ function Sn(e, t, o = {}) {
4563
4563
  I(F, Y(ie, Z, K.y, "arm"), Ft + Oo), O(F + Ft + Oo, { lean: -12 }, void 0, !1);
4564
4564
  const z = F + Ft + Oo + 80;
4565
4565
  O(z, { ...ie, rightShoulder: G(ie, Z, K.y) }, void 0, !1);
4566
- const U = z + (S.for ?? Math.max(mh, Math.abs(se - Z) / yh));
4566
+ const U = z + (S.for ?? Math.max(bh, Math.abs(se - Z) / wh));
4567
4567
  M.push({ time: z, value: f - c }), f = Y($, se, K.y, "arm"), M.push({ time: U, value: f - c }), O(U, { ...$, rightShoulder: G($, se, K.y) }, void 0, !1), O(U + Ho, { lean: 16, bend: 14, rightShoulder: G(g, se + X * d * 0.4, K.y + d * 0.25) }, void 0, !1), O(U + Ho + ps, { lean: 0, bend: 0, rightShoulder: ce.rightShoulder, rightElbow: ce.rightElbow }), V = U + Ho + ps, ee = z, L = U;
4568
4568
  } else if (S.do === "grab" && S.target) {
4569
4569
  const K = S.target, X = W(_, K.x, S.mood), F = K.y > u - d * 0.5, Z = {
@@ -4576,17 +4576,17 @@ function Sn(e, t, o = {}) {
4576
4576
  lookX: 1,
4577
4577
  lookY: F ? 0.8 : 0,
4578
4578
  ...Q
4579
- }, ae = I(X, Y(Z, K.x, K.y, "arm"), vt) + bh;
4579
+ }, ae = I(X, Y(Z, K.x, K.y, "arm"), vt) + kh;
4580
4580
  O(ae, { ...Z, rightShoulder: G(Z, K.x, K.y) }, S.mood, !1), O(ae + 120, {}, void 0, !1), O(ae + ms, { bend: 0, lean: -3, stretch: 1, rightShoulder: 165, rightElbow: 20, lookY: -0.6 }), V = ae + ms + 150, ee = ae;
4581
4581
  } else if (S.do === "throw") {
4582
4582
  const K = S.target?.x ?? S.to ?? f + p * d, X = W(_, K, S.mood), F = { ...g, turn: 1, lean: -12, bend: -10, rightElbow: 60, stretch: 0.95, lookX: 1, lookY: -0.3, ...Q };
4583
4583
  O(X + Io, { ...F, rightShoulder: G(F, f - p * d * 0.4, u - d * 1.05) }, S.mood, !1), O(X + Io + ys, { lean: -14 }, void 0, !1);
4584
- const Z = X + Io + ys + wh, se = { ...g, lean: 14, bend: 12, rightElbow: 0, stretch: 1.04 };
4584
+ const Z = X + Io + ys + vh, se = { ...g, lean: 14, bend: 12, rightElbow: 0, stretch: 1.04 };
4585
4585
  H.push({ time: Z, pose: g = { ...se, rightShoulder: G(se, f + p * d, u - d * 1.1) }, easing: "ease-in", act: !1 }), O(Z + xo, { lean: 18, bend: 14, rightShoulder: 55, stretch: 1 }, void 0, !1), O(Z + xo + bs, { lean: 0, bend: 0, rightShoulder: ce.rightShoulder, rightElbow: ce.rightElbow, lookY: 0 }), V = Z + xo + bs, ee = Z, L = Z;
4586
4586
  } else if (S.do === "kick" && S.target) {
4587
- const K = S.target, X = W(_, K.x, S.mood), F = { ...g, turn: 1, lean: -12, bend: -6, rightKnee: 0, leftShoulder: 100, rightShoulder: 70 }, Z = I(X, Y(F, K.x, K.y, "leg"), kh), se = { leftShoulder: 70, rightShoulder: 50, leftElbow: -20, rightElbow: 20 };
4587
+ const K = S.target, X = W(_, K.x, S.mood), F = { ...g, turn: 1, lean: -12, bend: -6, rightKnee: 0, leftShoulder: 100, rightShoulder: 70 }, Z = I(X, Y(F, K.x, K.y, "leg"), Sh), se = { leftShoulder: 70, rightShoulder: 50, leftElbow: -20, rightElbow: 20 };
4588
4588
  O(Z + ws, { turn: 1, lean: 8, bend: 6, rightHip: -40, rightKnee: 80, lookX: 1, lookY: 0.7, ...se, ...Q }, S.mood, !1);
4589
- const ae = Z + ws + vh, ie = G(F, K.x, K.y, "leg");
4589
+ const ae = Z + ws + Mh, ie = G(F, K.x, K.y, "leg");
4590
4590
  H.push({ time: ae, pose: g = { ...g, ...F, rightHip: ie }, easing: "ease-in", act: !1 }), O(ae + jo, { lean: -15, rightHip: ie + 20 }, void 0, !1), O(ae + jo + ks, {
4591
4591
  lean: 0,
4592
4592
  bend: 0,
@@ -4599,7 +4599,7 @@ function Sn(e, t, o = {}) {
4599
4599
  lookY: 0
4600
4600
  }), V = ae + jo + ks, ee = ae;
4601
4601
  } else if (S.do === "put" && S.target) {
4602
- const K = S.target, X = W(_, K.x, S.mood), F = K.y > u - d * 0.5, Z = { ...g, turn: 1, rightElbow: 0, rightWrist: 0, bend: F ? 35 : 0, lean: F ? 12 : 0, stretch: F ? 0.75 : 1, lookX: 1, lookY: F ? 0.8 : 0, ...Q }, ae = I(X, Y(Z, K.x, K.y, "arm"), vt) + Sh;
4602
+ const K = S.target, X = W(_, K.x, S.mood), F = K.y > u - d * 0.5, Z = { ...g, turn: 1, rightElbow: 0, rightWrist: 0, bend: F ? 35 : 0, lean: F ? 12 : 0, stretch: F ? 0.75 : 1, lookX: 1, lookY: F ? 0.8 : 0, ...Q }, ae = I(X, Y(Z, K.x, K.y, "arm"), vt) + $h;
4603
4603
  O(ae, { ...Z, rightShoulder: G(Z, K.x, K.y) }, S.mood, !1), O(ae + _o, {}, void 0, !1), O(ae + _o + vs, { bend: 0, lean: 0, stretch: 1, rightShoulder: ce.rightShoulder, rightElbow: ce.rightElbow, lookY: 0 }), V = ae + _o + vs, ee = ae;
4604
4604
  } else if (S.do === "write" && S.target) {
4605
4605
  const K = S.target, X = K.left ?? K.x, F = K.right ?? K.x, Z = W(_, (X + F) / 2, S.mood), se = { ...g, turn: 1, rightElbow: 0, rightWrist: 0, ...$e.thinking, lookX: 1, lookY: 0, ...Q }, ae = (D) => Y(se, D, K.y, "arm") + p * d * 0.08, ie = (D) => {
@@ -4607,7 +4607,7 @@ function Sn(e, t, o = {}) {
4607
4607
  return Math.hypot(R.x - D, R.y - K.y) < 2;
4608
4608
  }, $ = p === 1 ? X : F, z = I(Z, ae((X + F) / 2), vt), U = !ie(X) || !ie(F), te = U ? I(z, ae(X), vt) + Ss : z + Ss;
4609
4609
  O(te, { ...se, ...q(se, U ? X : $, K.y) }, S.mood, !1);
4610
- const B = S.for ?? Math.max($h, Math.abs(F - X) * Mh);
4610
+ const B = S.for ?? Math.max(Ah, Math.abs(F - X) * Eh);
4611
4611
  U && M.push({ time: te, value: f - c });
4612
4612
  for (let D = Ms, R = 0; D <= B; D += Ms, R++) {
4613
4613
  const J = X + (F - X) * Math.min(D, B) / B;
@@ -4618,18 +4618,18 @@ function Sn(e, t, o = {}) {
4618
4618
  const le = te + B;
4619
4619
  O(le, q(se, F, K.y), void 0, !1), O(le + $s, { rightShoulder: ce.rightShoulder, rightElbow: ce.rightElbow, ...$e.happy }), V = le + $s, ee = te, L = le;
4620
4620
  } else if (S.do === "push" && S.target) {
4621
- const K = S.target, X = S.to ?? K.x, F = W(_, f + (X >= K.x ? 1 : -1), S.mood), Z = p === 1 ? K.left ?? K.x : K.right ?? K.x, se = { ...g, turn: 1, lean: 16, bend: 8, rightWrist: 0, leftWrist: 0, lookX: 1, ...Q }, ae = Y(se, Z, K.y, "arm"), ie = I(F, ae + p * d * 0.06, vt), $ = q(se, Z, K.y), z = { ...se, ...$, leftShoulder: -$.rightShoulder, leftElbow: -$.rightElbow }, U = ie + Eh;
4621
+ const K = S.target, X = S.to ?? K.x, F = W(_, f + (X >= K.x ? 1 : -1), S.mood), Z = p === 1 ? K.left ?? K.x : K.right ?? K.x, se = { ...g, turn: 1, lean: 16, bend: 8, rightWrist: 0, leftWrist: 0, lookX: 1, ...Q }, ae = Y(se, Z, K.y, "arm"), ie = I(F, ae + p * d * 0.06, vt), $ = q(se, Z, K.y), z = { ...se, ...$, leftShoulder: -$.rightShoulder, leftElbow: -$.rightElbow }, U = ie + Th;
4622
4622
  O(U, z, S.mood, !1);
4623
- const te = Math.abs(X - K.x), B = U + (S.for ?? Math.max(600, te / Ah)), le = te / Lo("shove", d);
4623
+ const te = Math.abs(X - K.x), B = U + (S.for ?? Math.max(600, te / Ph)), le = te / Lo("shove", d);
4624
4624
  k.push({ time: U, value: "shove" }), A.push({ time: U, value: 0 }, { time: U + Ie, value: 1, easing: "ease-out" }, { time: B - Ie, value: 1 }, { time: B, value: 0, easing: "ease-in" }), P.push({ time: U, value: b }, { time: B, value: b + le }), b += le, M.push({ time: U, value: f - c }, { time: B, value: f + (X - K.x) - c }), f += X - K.x, O(B, {}, void 0, !1), O(B + Es, { lean: 0, bend: 0, rightShoulder: ce.rightShoulder, leftShoulder: ce.leftShoulder, rightElbow: ce.rightElbow, leftElbow: ce.leftElbow }), V = B + Es, ee = U, L = B;
4625
4625
  } else if (re) {
4626
4626
  const K = S.mood ? at(g, S.mood) : g, X = re.steps(K, S), F = xr(X, { at: _, from: K });
4627
- H.push(...F), g = F[F.length - 1].pose, V = _ + Math.max(lh(X), S.for ?? 0);
4627
+ H.push(...F), g = F[F.length - 1].pose, V = _ + Math.max(ch(X), S.for ?? 0);
4628
4628
  } else if (As(S.do)) {
4629
4629
  const K = hs(S.do, { at: _, from: S.mood ? at(g, S.mood) : g });
4630
4630
  H.push(...K), g = K[K.length - 1].pose, V = _ + so(S.do), S.do === "take" && E.push({ kind: "dust", time: _ + 900, x: f, y: u, length: 500 }), S.do === "land" && E.push({ kind: "dust", time: _ + 120, x: f, y: u, length: 500 });
4631
4631
  } else if (S.do === "look" || S.do === "face") {
4632
- const K = S.toward ?? "viewer", X = S.for ?? Th;
4632
+ const K = S.toward ?? "viewer", X = S.for ?? Oh;
4633
4633
  if (K === "viewer") O(_ + He, { turn: 0, lookX: 0, lookY: 0, ...Q }, S.mood);
4634
4634
  else if (K === "ahead") O(_ + He, { turn: S.do === "face" ? 1 : 0.6, lookX: 1, ...Q }, S.mood);
4635
4635
  else if (K === "back") O(_ + He, { turn: 0.2, lookX: -1, ...Q }, S.mood);
@@ -4638,20 +4638,20 @@ function Sn(e, t, o = {}) {
4638
4638
  F !== p && S.do === "face" ? (j(_, F, S.mood), O(_ + nt + 1, { lookX: 1, ...Q })) : F !== p ? O(_ + He, { turn: 0.25, lookX: -1, ...Q }, S.mood) : O(_ + He, { turn: S.do === "face" ? 1 : 0.6, lookX: 1, ...Q }, S.mood);
4639
4639
  }
4640
4640
  V = _ + Math.max(X, He);
4641
- } else if (Hh(S.do) || S.do === "stand") {
4641
+ } else if (xh(S.do) || S.do === "stand") {
4642
4642
  const K = S.do === "stand" ? o.rest ?? ce : Ae[S.do], X = K.turn !== ce.turn ? K.turn : g.turn, F = S.mood ? $e[S.mood] : { lookX: g.lookX, lookY: g.lookY };
4643
4643
  O(_ + He, { ...K, turn: X, ...F, ...Q }), V = _ + (S.for ?? Ko);
4644
4644
  } else {
4645
- const K = S.for ?? (S.say ? Ih(S.say) : Ko);
4645
+ const K = S.for ?? (S.say ? jh(S.say) : Ko);
4646
4646
  (S.mood || S.pose) && O(_ + Math.min(He, K / 2), Q, S.mood), V = _ + K;
4647
4647
  }
4648
4648
  if (S.say) {
4649
4649
  const K = s(S.do) || As(S.do) || re ? _ : _ + Math.min(150, (V - _) / 4), X = s(S.do) ? V : Math.max(K + 200, V - 100);
4650
- v.push({ text: S.say, start: K, end: X }), S.do === "say" && Kh(H, g, K, X);
4650
+ v.push({ text: S.say, start: K, end: X }), S.do === "say" && Nh(H, g, K, X);
4651
4651
  }
4652
4652
  S.onto !== void 0 && S.do !== "leap" && S.onto !== u && (m.push({ time: _, value: u - l }, { time: V, value: S.onto - l, easing: "ease-in-out" }), u = S.onto), V > H[H.length - 1].time && H.push({ time: V, pose: g }), w.push({ start: _, end: V, ...ee !== void 0 ? { contact: ee } : {}, ...L !== void 0 ? { release: L } : {} }), T = V;
4653
4653
  }
4654
- const N = eh(e, _h(H), o), C = [
4654
+ const C = oh(e, Ch(H), o), N = [
4655
4655
  { id: `${e}-x`, target: e, property: "x", keyframes: M },
4656
4656
  { id: `${e}-y`, target: e, property: "y", keyframes: m },
4657
4657
  { id: `${e}-walk`, target: e, property: "walk", keyframes: P },
@@ -4663,7 +4663,7 @@ function Sn(e, t, o = {}) {
4663
4663
  S.property === "facing" && S.keyframes[0].value === -1
4664
4664
  );
4665
4665
  return {
4666
- tracks: [...yn(e, N, v, { energy: o.energy }), ...C],
4666
+ tracks: [...yn(e, C, v, { energy: o.energy }), ...N],
4667
4667
  duration: T,
4668
4668
  lines: v,
4669
4669
  keys: H,
@@ -4671,16 +4671,16 @@ function Sn(e, t, o = {}) {
4671
4671
  effects: E
4672
4672
  };
4673
4673
  }
4674
- const xh = (e) => Math.max(-1, Math.min(1, e)), jh = 30;
4675
- function _h(e) {
4674
+ const _h = (e) => Math.max(-1, Math.min(1, e)), Kh = 30;
4675
+ function Ch(e) {
4676
4676
  const t = [];
4677
4677
  for (const o of e) {
4678
4678
  const n = t[t.length - 1];
4679
- n && o.time - n.time < jh ? t[t.length - 1] = { ...o, time: n.time } : t.push(o);
4679
+ n && o.time - n.time < Kh ? t[t.length - 1] = { ...o, time: n.time } : t.push(o);
4680
4680
  }
4681
4681
  return t;
4682
4682
  }
4683
- function Kh(e, t, o, n) {
4683
+ function Nh(e, t, o, n) {
4684
4684
  const r = e.filter((h) => h.time > o), s = e.filter((h) => h.time <= o), i = [];
4685
4685
  for (let h = o + 520, c = 0; h < n - 520 / 2; h += 520, c++) {
4686
4686
  const l = c % 2 === 0 ? 3 : -2;
@@ -4688,7 +4688,7 @@ function Kh(e, t, o, n) {
4688
4688
  }
4689
4689
  i.length > 0 && i.push({ time: n, pose: t }), e.length = 0, e.push(...s, ...i.filter((h) => !r.some((c) => Math.abs(c.time - h.time) < 60)), ...r), e.sort((h, c) => h.time - c.time);
4690
4690
  }
4691
- function Nr(e, t, o) {
4691
+ function Cr(e, t, o) {
4692
4692
  const n = new ve({ id: `${e}-hand`, tracks: t.filter((h) => h.target === e) }), a = Zs({ x: o.x, y: o.y, style: o.style, cast: o.cast }), r = o.side ?? "right", s = o.every ?? 33, i = [];
4693
4693
  for (let h = o.start; ; h = Math.min(o.end, h + s)) {
4694
4694
  const { joints: c } = Js(a, { time: h, state: n.getStateAtTime(h) }, e), l = c.hands[r], d = c.fingertips[r];
@@ -4696,16 +4696,16 @@ function Nr(e, t, o) {
4696
4696
  }
4697
4697
  return i;
4698
4698
  }
4699
- const At = ["start", "contact", "release", "end"], Nh = ["surface", "edit", "anchor", "at", "until"], Ch = ["carry"], Yt = (e) => !!e && typeof e == "object" && !Array.isArray(e) && "surface" in e && "anchor" in e, Rh = (e) => e.then === void 0 ? [] : Array.isArray(e.then) ? e.then : [e.then];
4700
- function of(e, t, o, n = {}) {
4701
- const a = Wh(o, t, n).filter((f) => f.level === "error");
4699
+ const At = ["start", "contact", "release", "end"], Rh = ["surface", "edit", "anchor", "at", "until"], Wh = ["carry"], Yt = (e) => !!e && typeof e == "object" && !Array.isArray(e) && "surface" in e && "anchor" in e, zh = (e) => e.then === void 0 ? [] : Array.isArray(e.then) ? e.then : [e.then];
4700
+ function sf(e, t, o, n = {}) {
4701
+ const a = Lh(o, t, n).filter((f) => f.level === "error");
4702
4702
  if (a.length > 0)
4703
4703
  throw new Error(`surfaceScript: ${a.length} problem(s) in the beats:
4704
4704
  ${a.map((f) => ` ${f.beat >= 0 ? `beat ${f.beat}: ` : ""}${f.message}`).join(`
4705
4705
  `)}`);
4706
- const r = o.map((f) => Cr(f, t)), s = Sn(e, r, n), i = zh(r, s.beats, n), h = n.ground ?? 0, c = (f) => n.ride === !1 ? f : Object.values(t).reduce((u, p) => p.ride(u, e, { ground: h }), f);
4706
+ const r = o.map((f) => Nr(f, t)), s = Sn(e, r, n), i = Fh(r, s.beats, n), h = n.ground ?? 0, c = (f) => n.ride === !1 ? f : Object.values(t).reduce((u, p) => p.ride(u, e, { ground: h }), f);
4707
4707
  o.forEach((f, u) => {
4708
- for (const p of Rh(f)) {
4708
+ for (const p of zh(f)) {
4709
4709
  const g = (m) => new Error(`surfaceScript: beat ${u} (${f.do}), ${p.edit} on ${p.surface}: ${m}`), b = (m, P) => {
4710
4710
  const A = typeof m == "object" ? m.beat : u, k = (typeof m == "object" ? m.at : m) ?? P ?? "start", y = i[A][k];
4711
4711
  if (y === void 0) {
@@ -4717,7 +4717,7 @@ ${a.map((f) => ` ${f.beat >= 0 ? `beat ${f.beat}: ` : ""}${f.message}`).join(`
4717
4717
  if (M !== void 0 && M < H) throw g(`it ends (${M} ms) before it starts (${H} ms)`);
4718
4718
  try {
4719
4719
  if (p.edit === "carry") {
4720
- const P = T.piece(p.anchor), A = Nr(e, c(s.tracks), {
4720
+ const P = T.piece(p.anchor), A = Cr(e, c(s.tracks), {
4721
4721
  x: n.from ?? 0,
4722
4722
  y: h,
4723
4723
  style: n.figureStyle ?? (n.height ? { height: n.height } : void 0),
@@ -4728,7 +4728,7 @@ ${a.map((f) => ` ${f.beat >= 0 ? `beat ${f.beat}: ` : ""}${f.message}`).join(`
4728
4728
  T.follow(P, A);
4729
4729
  continue;
4730
4730
  }
4731
- const m = Object.fromEntries(Object.entries(p).filter(([P]) => !Nh.includes(P)));
4731
+ const m = Object.fromEntries(Object.entries(p).filter(([P]) => !Rh.includes(P)));
4732
4732
  T.edit(p.edit, p.anchor, { ...m, at: H, ...M !== void 0 ? { duration: M - H } : {} });
4733
4733
  } catch (m) {
4734
4734
  throw g(m.message);
@@ -4738,7 +4738,7 @@ ${a.map((f) => ` ${f.beat >= 0 ? `beat ${f.beat}: ` : ""}${f.message}`).join(`
4738
4738
  const l = c(s.tracks), d = Object.entries(t).flatMap(([f, u]) => u.tracks(f));
4739
4739
  return { ...s, tracks: [...l, ...d], figureTracks: l };
4740
4740
  }
4741
- function Wh(e, t, o = {}) {
4741
+ function Lh(e, t, o = {}) {
4742
4742
  if (!Array.isArray(e)) return ro(e, o);
4743
4743
  const n = [], a = Object.keys(t), r = (c, l, d) => {
4744
4744
  const f = typeof l == "string" ? t[l] : void 0;
@@ -4777,7 +4777,7 @@ function Wh(e, t, o = {}) {
4777
4777
  }
4778
4778
  const p = u, g = r(l, p.surface, "`then`");
4779
4779
  if (!g) return;
4780
- const b = `\`then\` (${String(p.edit)} on ${String(p.surface)})`, T = [...Object.keys(g.about.edits), ...Ch];
4780
+ const b = `\`then\` (${String(p.edit)} on ${String(p.surface)})`, T = [...Object.keys(g.about.edits), ...Wh];
4781
4781
  if (typeof p.edit != "string" || !T.includes(p.edit)) {
4782
4782
  n.push({ level: "error", beat: l, message: `\`then\`: ${fe("edit", p.edit, T)}` });
4783
4783
  return;
@@ -4786,10 +4786,10 @@ function Wh(e, t, o = {}) {
4786
4786
  p.edit === "carry" && typeof p.anchor != "string" && n.push({ level: "error", beat: l, message: `${b}: \`carry\` takes one anchor, the piece it carries.` }), p.edit === "carry" && p.until === void 0 && n.push({ level: "error", beat: l, message: `${b}: \`carry\` needs \`until\` (when it lets go, such as { beat: ${l + 1}, at: 'release' }).` }), p.at !== void 0 && i(l, p.at, `${b} \`at\``), p.until !== void 0 && i(l, p.until, `${b} \`until\``), p.until !== void 0 && p.duration !== void 0 && n.push({ level: "error", beat: l, message: `${b}: give \`until\` or \`duration\`, not both.` });
4787
4787
  });
4788
4788
  });
4789
- const h = e.map((c) => c && typeof c == "object" && !Array.isArray(c) ? Cr(c, t, !0) : c);
4789
+ const h = e.map((c) => c && typeof c == "object" && !Array.isArray(c) ? Nr(c, t, !0) : c);
4790
4790
  return [...ro(h, o), ...n];
4791
4791
  }
4792
- function Cr(e, t, o = !1) {
4792
+ function Nr(e, t, o = !1) {
4793
4793
  const { then: n, ...a } = e, r = (i) => {
4794
4794
  try {
4795
4795
  return t[i.surface].anchor(i.anchor, 0);
@@ -4800,7 +4800,7 @@ function Cr(e, t, o = !1) {
4800
4800
  }, s = { ...a };
4801
4801
  return Yt(e.target) && (s.target = r(e.target)), Yt(e.to) && (s.to = r(e.to).x), Yt(e.onto) && (s.onto = r(e.onto).top), s;
4802
4802
  }
4803
- function zh(e, t, o) {
4803
+ function Fh(e, t, o) {
4804
4804
  let n = 0;
4805
4805
  return e.map((a) => {
4806
4806
  const r = vn([a], o.actions).length, s = t.slice(n, n + r);
@@ -4814,7 +4814,7 @@ function zh(e, t, o) {
4814
4814
  };
4815
4815
  });
4816
4816
  }
4817
- function nf(e) {
4817
+ function rf(e) {
4818
4818
  const t = { actions: e.actions, gaits: e.gaits }, o = _r(t);
4819
4819
  if (o.length > 0) throw new Error(`persona "${e.name}": ${o.join(" ")}`);
4820
4820
  const n = [...Object.keys(Ke), ...Object.keys(e.gaits ?? {})], a = e.gait ?? "walk";
@@ -4844,7 +4844,7 @@ function nf(e) {
4844
4844
  energy: e.energy
4845
4845
  }),
4846
4846
  check: (d) => ro(d, t),
4847
- handPath: (d, f, u) => Nr(d, f, { ...u, style: c, cast: t }),
4847
+ handPath: (d, f, u) => Cr(d, f, { ...u, style: c, cast: t }),
4848
4848
  describe: () => ({
4849
4849
  name: e.name,
4850
4850
  summary: l,
@@ -4860,18 +4860,18 @@ function nf(e) {
4860
4860
  })
4861
4861
  };
4862
4862
  }
4863
- const Lh = /* @__PURE__ */ new Set(["x", "y", "walking", "gait"]), Ts = 0.215 + 0.205;
4864
- function Fh(e, t, o = 1) {
4863
+ const Dh = /* @__PURE__ */ new Set(["x", "y", "walking", "gait"]), Ts = 0.215 + 0.205;
4864
+ function qh(e, t, o = 1) {
4865
4865
  const { points: n } = Oe(e, ye), a = n["hip.left"], r = n["knee.left"], s = n["ankle.left"], i = a && r && s ? Math.hypot(r.x - a.x, r.y - a.y) + Math.hypot(s.x - r.x, s.y - r.y) : Ts * e.height;
4866
4866
  return Us(t, i / Ts, o);
4867
4867
  }
4868
- function sf(e, t, o, n = {}) {
4869
- const a = Sn(e, o, { ...n, height: t.height, reach: n.reach ?? Dh(t) }), r = a.tracks.find((T) => T.property === "facing")?.keyframes ?? [], s = (T) => {
4868
+ function af(e, t, o, n = {}) {
4869
+ const a = Sn(e, o, { ...n, height: t.height, reach: n.reach ?? Bh(t) }), r = a.tracks.find((T) => T.property === "facing")?.keyframes ?? [], s = (T) => {
4870
4870
  let H = n.facing ?? 1;
4871
4871
  for (const M of r) M.time <= T && (H = M.value);
4872
4872
  return H;
4873
4873
  }, i = Vs(a.keys), h = a.keys.map((T, H) => {
4874
- const M = vi(i[H]);
4874
+ const M = Mi(i[H]);
4875
4875
  return {
4876
4876
  time: T.time,
4877
4877
  pose: s(T.time) < 0 ? pa(M) : M,
@@ -4879,16 +4879,16 @@ function sf(e, t, o, n = {}) {
4879
4879
  ...T.act === !1 ? { act: !1 } : {}
4880
4880
  };
4881
4881
  }), { rest: c, start: l, ...d } = n;
4882
- Gh(h, i, o, a, t, s, n);
4883
- const f = th(e, h, d), u = yn(e, f, a.lines, { energy: n.energy }), p = a.tracks.filter((T) => Lh.has(T.property)), g = a.tracks.find((T) => T.property === "walk");
4884
- return { tracks: g ? [...u, ...p, Zh(e, g, a.tracks, t, n)] : [...u, ...p], duration: a.duration, lines: a.lines, keys: h, beats: a.beats, effects: a.effects };
4882
+ Uh(h, i, o, a, t, s, n);
4883
+ const f = nh(e, h, d), u = yn(e, f, a.lines, { energy: n.energy }), p = a.tracks.filter((T) => Dh.has(T.property)), g = a.tracks.find((T) => T.property === "walk");
4884
+ return { tracks: g ? [...u, ...p, ec(e, g, a.tracks, t, n)] : [...u, ...p], duration: a.duration, lines: a.lines, keys: h, beats: a.beats, effects: a.effects };
4885
4885
  }
4886
- function Dh(e) {
4886
+ function Bh(e) {
4887
4887
  const t = Qs({ "arm.left.spread": 90, "arm.left.elbow": 0, "arm.left.bend": 0, "leg.left.knee": 0 }), o = Oe(e, t).points, n = Math.hypot(o["hand.left"].x - o["shoulder.left"].x, o["hand.left"].y - o["shoulder.left"].y), a = Math.hypot(o["toe.left"].x - o["hip.left"].x, o["toe.left"].y - o["hip.left"].y), r = je({ ...ce, rightShoulder: 90, rightElbow: 0, rightWrist: 0 }, { height: e.height, facing: 1 }), s = je({ ...ce, rightHip: 90, rightKnee: 0 }, { height: e.height, facing: 1 }), i = { x: (r.hands.right.x + r.fingertips.right.x) / 2, y: (r.hands.right.y + r.fingertips.right.y) / 2 }, h = Math.hypot(i.x - r.shoulders.right.x, i.y - r.shoulders.right.y), c = Math.hypot(s.feet.right.x - s.hip.x, s.feet.right.y - s.hip.y);
4888
4888
  return { arm: h > 0 ? n / h : 1, leg: c > 0 ? a / c : 1 };
4889
4889
  }
4890
- const qh = { point: "arm", grab: "arm", put: "arm", write: "arm", swipe: "arm", push: "arm", kick: "leg" }, Bh = /* @__PURE__ */ new Set(["point", "grab", "put", "kick"]);
4891
- function Gh(e, t, o, n, a, r, s) {
4890
+ const Gh = { point: "arm", grab: "arm", put: "arm", write: "arm", swipe: "arm", push: "arm", kick: "leg" }, Yh = /* @__PURE__ */ new Set(["point", "grab", "put", "kick"]);
4891
+ function Uh(e, t, o, n, a, r, s) {
4892
4892
  const i = n.beats;
4893
4893
  if (o.length !== i.length) return;
4894
4894
  const h = new ve({ id: "placed", tracks: n.tracks.filter((l) => l.property === "x" || l.property === "y") }), c = (l) => {
@@ -4896,17 +4896,17 @@ function Gh(e, t, o, n, a, r, s) {
4896
4896
  return { x: (s.from ?? 0) + Number(d?.get("x") ?? 0), y: (s.ground ?? 0) + Number(d?.get("y") ?? 0) };
4897
4897
  };
4898
4898
  o.forEach((l, d) => {
4899
- const f = qh[l.do], u = i[d];
4899
+ const f = Gh[l.do], u = i[d];
4900
4900
  if (!f || u.contact === void 0 || l.do !== "swipe" && !l.target) return;
4901
4901
  const p = u.contact, g = u.release ?? u.contact;
4902
4902
  e.forEach((b, T) => {
4903
4903
  if (b.time < p - 1 || b.time > g + 1) return;
4904
- const H = r(b.time), M = je(t[T], { height: a.height, facing: H < 0 ? -1 : 1 }), m = c(b.time), P = Bh.has(l.do) && l.target ? { x: l.target.x - m.x, y: l.target.y - m.y } : void 0, A = { x: (M.hands.right.x + M.fingertips.right.x) / 2, y: (M.hands.right.y + M.fingertips.right.y) / 2 }, k = P ?? (f === "arm" ? A : M.toes.right), y = H < 0 ? "right" : "left", v = `${f}.${y}`;
4904
+ const H = r(b.time), M = je(t[T], { height: a.height, facing: H < 0 ? -1 : 1 }), m = c(b.time), P = Yh.has(l.do) && l.target ? { x: l.target.x - m.x, y: l.target.y - m.y } : void 0, A = { x: (M.hands.right.x + M.fingertips.right.x) / 2, y: (M.hands.right.y + M.fingertips.right.y) / 2 }, k = P ?? (f === "arm" ? A : M.toes.right), y = H < 0 ? "right" : "left", v = `${f}.${y}`;
4905
4905
  let w = b.pose;
4906
4906
  if (l.do === "point")
4907
4907
  w = Le(a, w, v, k);
4908
4908
  else if (f === "arm")
4909
- w = Le(a, Jh(a, w, y, k), v, k);
4909
+ w = Le(a, Qh(a, w, y, k), v, k);
4910
4910
  else
4911
4911
  for (let E = 0; E < 3; E++) {
4912
4912
  const O = Oe(a, w).points, j = O[`ankle.${y}`], x = O[`toe.${y}`];
@@ -4916,23 +4916,23 @@ function Gh(e, t, o, n, a, r, s) {
4916
4916
  });
4917
4917
  });
4918
4918
  }
4919
- function Yh(e, t) {
4919
+ function Xh(e, t) {
4920
4920
  const o = Qs({ [`arm.${t}.spread`]: 90, [`arm.${t}.elbow`]: 0, [`arm.${t}.bend`]: 0 }), n = Oe(e, o).points;
4921
4921
  return Math.hypot(n[`hand.${t}`].x - n[`shoulder.${t}`].x, n[`hand.${t}`].y - n[`shoulder.${t}`].y);
4922
4922
  }
4923
- const Uh = 5, Xh = 4, Vh = 8;
4924
- function Jh(e, t, o, n) {
4925
- const a = Yh(e, o) * 0.9, r = (i) => {
4923
+ const Vh = 5, Jh = 4, Zh = 8;
4924
+ function Qh(e, t, o, n) {
4925
+ const a = Xh(e, o) * 0.9, r = (i) => {
4926
4926
  const h = Oe(e, i).points[`shoulder.${o}`];
4927
4927
  return Math.hypot(n.x - h.x, n.y - h.y) <= a;
4928
4928
  };
4929
4929
  if (r(t)) return t;
4930
4930
  let s = t;
4931
- for (let i = 1; i <= Vh; i++)
4932
- if (s = { ...t, lean: (t.lean ?? 0) + Uh * i, bend: (t.bend ?? 0) + Xh * i }, r(s)) return s;
4931
+ for (let i = 1; i <= Zh; i++)
4932
+ if (s = { ...t, lean: (t.lean ?? 0) + Vh * i, bend: (t.bend ?? 0) + Jh * i }, r(s)) return s;
4933
4933
  return s;
4934
4934
  }
4935
- function Zh(e, t, o, n, a) {
4935
+ function ec(e, t, o, n, a) {
4936
4936
  const r = o.find((d) => d.property === "gait"), s = r ? new ve({ id: `${e}-gait-of`, tracks: [r] }) : void 0, i = (d) => {
4937
4937
  const f = s?.getStateAtTime(d).values.get(e)?.get("gait");
4938
4938
  if (typeof f == "string")
@@ -4941,7 +4941,7 @@ function Zh(e, t, o, n, a) {
4941
4941
  let l = h[0]?.value ?? 0;
4942
4942
  return h.forEach((d, f) => {
4943
4943
  if (f > 0) {
4944
- const u = h[f - 1], p = i((u.time + d.time) / 2), g = Lo(p, n.height), b = Fh(n, p);
4944
+ const u = h[f - 1], p = i((u.time + d.time) / 2), g = Lo(p, n.height), b = qh(n, p);
4945
4945
  l += (d.value - u.value) * (b > 0 ? g / b : 1);
4946
4946
  } else
4947
4947
  l = d.value;
@@ -4961,7 +4961,7 @@ function Ps(e, t) {
4961
4961
  s !== i && o.push(Zo(r, n, t)), s && o.push(n);
4962
4962
  }), o.length >= 3 ? o : [];
4963
4963
  }
4964
- function Qh(e, t) {
4964
+ function tc(e, t) {
4965
4965
  if (e.every((a) => dt(a, t))) return [e];
4966
4966
  const o = [];
4967
4967
  let n = [];
@@ -4980,11 +4980,11 @@ function Os(e, t, o) {
4980
4980
  const a = Math.round(n / o);
4981
4981
  return Array.from({ length: a + 1 }, (r, s) => e + n * s / a);
4982
4982
  }
4983
- function ec(e, t, o) {
4983
+ function oc(e, t, o) {
4984
4984
  const n = (a, r) => Math.max(0, Math.min(a.length - 2, a.findIndex((s, i) => i > 0 && r <= s) - 1));
4985
4985
  return [n(e, o[0]), n(t, o[2])];
4986
4986
  }
4987
- function tc(e, t) {
4987
+ function nc(e, t) {
4988
4988
  const o = (n) => {
4989
4989
  const a = [t[0] * n[0] + t[4] * n[1] + t[8] * n[2], t[1] * n[0] + t[5] * n[1] + t[9] * n[2], t[2] * n[0] + t[6] * n[1] + t[10] * n[2]], r = Math.hypot(...a) || 1;
4990
4990
  return [a[0] / r, a[1] / r, a[2] / r];
@@ -5004,7 +5004,7 @@ function Dt(e, t, o, n) {
5004
5004
  a(s) && r.push(s);
5005
5005
  }), r.length >= 3 ? r : [];
5006
5006
  }
5007
- function oc(e, t, o) {
5007
+ function sc(e, t, o) {
5008
5008
  const n = e.faces.map((s) => ({ points: s.corners.map((i) => e.vertices[i]), normal: s.normal })), a = [], r = { x: t.slice(1, -1), z: o.slice(1, -1) };
5009
5009
  for (let s = 0; s + 1 < t.length; s++)
5010
5010
  for (let i = 0; i + 1 < o.length; i++) {
@@ -5021,37 +5021,37 @@ function oc(e, t, o) {
5021
5021
  }
5022
5022
  return a;
5023
5023
  }
5024
- const nc = /* @__PURE__ */ new WeakMap(), sc = /* @__PURE__ */ new WeakMap(), rc = 48, Rr = (e) => e.map((t) => Math.round(t * 1e5)).join(",");
5024
+ const rc = /* @__PURE__ */ new WeakMap(), ac = /* @__PURE__ */ new WeakMap(), ic = 48, Rr = (e) => e.map((t) => Math.round(t * 1e5)).join(",");
5025
5025
  function Wr(e, t, o, n) {
5026
5026
  let a = e.get(t);
5027
5027
  a || e.set(t, a = /* @__PURE__ */ new Map());
5028
5028
  let r = a.get(o);
5029
- return r === void 0 && (a.size >= rc && a.clear(), a.set(o, r = n())), r;
5029
+ return r === void 0 && (a.size >= ic && a.clear(), a.set(o, r = n())), r;
5030
5030
  }
5031
5031
  function Mn(e, t) {
5032
5032
  const o = Rr(t);
5033
- return Wr(nc, e, o, () => {
5034
- const n = tc(e, t), a = [1 / 0, 1 / 0, 1 / 0], r = [-1 / 0, -1 / 0, -1 / 0];
5033
+ return Wr(rc, e, o, () => {
5034
+ const n = nc(e, t), a = [1 / 0, 1 / 0, 1 / 0], r = [-1 / 0, -1 / 0, -1 / 0];
5035
5035
  for (const s of n.vertices) for (const i of [0, 1, 2])
5036
5036
  a[i] = Math.min(a[i], s[i]), r[i] = Math.max(r[i], s[i]);
5037
5037
  return { key: o, inSpace: n, low: a, high: r };
5038
5038
  });
5039
5039
  }
5040
- function ac(e, t) {
5040
+ function lc(e, t) {
5041
5041
  const o = e.map((l) => ({ ...l, ...Mn(l.mesh, l.local) })), n = [1 / 0, 1 / 0, 1 / 0], a = [-1 / 0, -1 / 0, -1 / 0];
5042
5042
  for (const l of o) for (const d of [0, 1, 2])
5043
5043
  n[d] = Math.min(n[d], l.low[d]), a[d] = Math.max(a[d], l.high[d]);
5044
5044
  const r = Os(n[0], a[0], t), s = Os(n[2], a[2], t), i = `${r.join(",")}|${s.join(",")}`, h = o.flatMap((l) => {
5045
5045
  if (l.high[0] - l.low[0] <= t * 2.5 && l.high[2] - l.low[2] <= t * 2.5 || l.whole || l.mesh.joined || (l.mesh.marks?.length ?? 0) > 0) {
5046
5046
  const f = [(l.low[0] + l.high[0]) / 2, (l.low[1] + l.high[1]) / 2, (l.low[2] + l.high[2]) / 2];
5047
- return [{ part: l.part, mesh: l.mesh, cut: !1, cell: ec(r, s, f) }];
5047
+ return [{ part: l.part, mesh: l.mesh, cut: !1, cell: oc(r, s, f) }];
5048
5048
  }
5049
- return Wr(sc, l.inSpace, i, () => oc(l.inSpace, r, s)).map((f) => ({ part: l.part, mesh: f.mesh, cut: !0, cell: f.cell }));
5049
+ return Wr(ac, l.inSpace, i, () => sc(l.inSpace, r, s)).map((f) => ({ part: l.part, mesh: f.mesh, cut: !0, cell: f.cell }));
5050
5050
  }), c = (n[1] + a[1]) / 2;
5051
5051
  return { pieces: h, middle: ([l, d]) => [(r[l] + r[l + 1]) / 2, c, (s[d] + s[d + 1]) / 2] };
5052
5052
  }
5053
- const Hs = 4e-3, No = 0.05, Is = /* @__PURE__ */ new WeakMap();
5054
- function ic(e) {
5053
+ const Hs = 4e-3, Co = 0.05, Is = /* @__PURE__ */ new WeakMap();
5054
+ function hc(e) {
5055
5055
  let t = Is.get(e);
5056
5056
  return t === void 0 && (t = !e.joined && !e.walls && e.faces.length >= 4 && e.faces.every((o) => {
5057
5057
  const n = e.vertices[o.corners[0]];
@@ -5060,7 +5060,7 @@ function ic(e) {
5060
5060
  }
5061
5061
  const xs = /* @__PURE__ */ new WeakMap();
5062
5062
  function zr(e) {
5063
- return e.filter(({ mesh: t }) => ic(t)).map(({ part: t, key: o, inSpace: n, low: a, high: r }) => {
5063
+ return e.filter(({ mesh: t }) => hc(t)).map(({ part: t, key: o, inSpace: n, low: a, high: r }) => {
5064
5064
  let s = xs.get(n);
5065
5065
  return s || (s = n.faces.map((i) => {
5066
5066
  const h = n.vertices[i.corners[0]];
@@ -5068,14 +5068,14 @@ function zr(e) {
5068
5068
  }), xs.set(n, s)), { part: t, key: o, planes: s, low: a, high: r };
5069
5069
  });
5070
5070
  }
5071
- function lc(e, t, o, n) {
5071
+ function cc(e, t, o, n) {
5072
5072
  const a = t.reduce((r, s) => [r[0] + s[0] / t.length, r[1] + s[1] / t.length, r[2] + s[2] / t.length], [0, 0, 0]);
5073
5073
  for (const r of n) {
5074
- if (r.part === e || [0, 1, 2].some((i) => a[i] < r.low[i] - No || a[i] > r.high[i] + No)) continue;
5074
+ if (r.part === e || [0, 1, 2].some((i) => a[i] < r.low[i] - Co || a[i] > r.high[i] + Co)) continue;
5075
5075
  if (r.planes.every((i) => {
5076
5076
  const h = i.normal[0] * o[0] + i.normal[1] * o[1] + i.normal[2] * o[2], c = t.map((d) => i.normal[0] * d[0] + i.normal[1] * d[1] + i.normal[2] * d[2] - i.offset);
5077
5077
  if (c.every((d) => Math.abs(d) <= Hs)) return h < -0.9;
5078
- const l = Math.abs(h) < 0.5 ? No : Hs;
5078
+ const l = Math.abs(h) < 0.5 ? Co : Hs;
5079
5079
  return c.every((d) => d <= l);
5080
5080
  })) return !0;
5081
5081
  }
@@ -5093,7 +5093,7 @@ function Lr(e, t, o, n, a) {
5093
5093
  const d = [o[0] * l[0] + o[4] * l[1] + o[8] * l[2], o[1] * l[0] + o[5] * l[1] + o[9] * l[2], o[2] * l[0] + o[6] * l[1] + o[10] * l[2]], f = Math.hypot(...d) || 1;
5094
5094
  return [d[0] / f, d[1] / f, d[2] / f];
5095
5095
  }, c = t.vertices.map((l) => ne.transformPoint(o, l));
5096
- i = t.faces.map((l) => lc(e, l.corners.map((d) => c[d]), h(l.normal), a)), s.set(r, i);
5096
+ i = t.faces.map((l) => cc(e, l.corners.map((d) => c[d]), h(l.normal), a)), s.set(r, i);
5097
5097
  }
5098
5098
  return i;
5099
5099
  }
@@ -5107,7 +5107,7 @@ const xt = {
5107
5107
  lean: { description: "The top sheared forward (+) or back (−): speed and drag", unit: "shear" },
5108
5108
  size: { description: "Its size, about the ground: 1 as built, 0 gone (pop it in or out)", unit: "factor", default: 1, min: 0 }
5109
5109
  }, Qo = Math.PI / 180;
5110
- function hc(e, t, o) {
5110
+ function dc(e, t, o) {
5111
5111
  return {
5112
5112
  toView: (n) => ma(Gs(n, e * 90 * Qo), -t * Qo),
5113
5113
  toScreen: (n) => ({ x: n[0] * o, y: -n[1] * o })
@@ -5115,7 +5115,7 @@ function hc(e, t, o) {
5115
5115
  }
5116
5116
  const _s = /* @__PURE__ */ new WeakMap(), ao = (e) => Ut(e), Ut = (e) => {
5117
5117
  let t = _s.get(e);
5118
- return t || _s.set(e, t = Yi(e)), t;
5118
+ return t || _s.set(e, t = Xi(e)), t;
5119
5119
  };
5120
5120
  function be(e, t, o) {
5121
5121
  return t[o] ?? e.controls[o]?.default ?? xt[o]?.default ?? 0;
@@ -5155,13 +5155,13 @@ function $n(e, t) {
5155
5155
  for (const s of e.parts) r(s);
5156
5156
  return n;
5157
5157
  }
5158
- const Co = (() => {
5158
+ const No = (() => {
5159
5159
  const e = [-0.45, 0.75, 0.5], t = Math.hypot(...e);
5160
5160
  return [e[0] / t, e[1] / t, e[2] / t];
5161
- })(), cc = Math.cos(35 * Qo);
5161
+ })(), fc = Math.cos(35 * Qo);
5162
5162
  function Fr(e, t, o, n, a = {}) {
5163
- const r = e.derive ? { ...t, ...e.derive(t) } : t, s = $n(e, r), i = o.toView([0, 0, 0]), h = (x) => (W) => [x[0] * W[0] + x[4] * W[1] + x[8] * W[2], x[1] * W[0] + x[5] * W[1] + x[9] * W[2], x[2] * W[0] + x[6] * W[1] + x[10] * W[2]], c = Ot(e, r), l = a.slice === void 0 ? null : ne.invert(c), d = l ? e.parts.map((x) => ({ part: x, mesh: Ut(x.shape), local: ne.multiply(l, s.get(x.id)), whole: x.shape.type === "tube" })) : void 0, f = d ? ac(d, a.slice) : void 0, u = d ? zr(d.map((x) => ({ part: x.part.id, mesh: x.mesh, ...Mn(x.mesh, x.local) }))) : void 0, p = (x, W, G, Y) => {
5164
- const oe = (R) => o.toView(ne.transformPoint(G, R)), q = W.vertices.map(oe), I = q.map((R) => o.toScreen(R)), N = a.perspective ? a.near : void 0, C = (R) => R.map((J) => o.toScreen(J)), S = (R) => N === void 0 ? R : Ps(R, N), _ = (R) => N === void 0 ? [R] : Qh(R, N), V = h(G), ee = W.faces.map((R) => {
5163
+ const r = e.derive ? { ...t, ...e.derive(t) } : t, s = $n(e, r), i = o.toView([0, 0, 0]), h = (x) => (W) => [x[0] * W[0] + x[4] * W[1] + x[8] * W[2], x[1] * W[0] + x[5] * W[1] + x[9] * W[2], x[2] * W[0] + x[6] * W[1] + x[10] * W[2]], c = Ot(e, r), l = a.slice === void 0 ? null : ne.invert(c), d = l ? e.parts.map((x) => ({ part: x, mesh: Ut(x.shape), local: ne.multiply(l, s.get(x.id)), whole: x.shape.type === "tube" })) : void 0, f = d ? lc(d, a.slice) : void 0, u = d ? zr(d.map((x) => ({ part: x.part.id, mesh: x.mesh, ...Mn(x.mesh, x.local) }))) : void 0, p = (x, W, G, Y) => {
5164
+ const oe = (R) => o.toView(ne.transformPoint(G, R)), q = W.vertices.map(oe), I = q.map((R) => o.toScreen(R)), C = a.perspective ? a.near : void 0, N = (R) => R.map((J) => o.toScreen(J)), S = (R) => C === void 0 ? R : Ps(R, C), _ = (R) => C === void 0 ? [R] : tc(R, C), V = h(G), ee = W.faces.map((R) => {
5165
5165
  const J = o.toView(V(R.normal)), he = [J[0] - i[0], J[1] - i[1], J[2] - i[2]], de = Math.hypot(...he) || 1;
5166
5166
  return [he[0] / de, he[1] / de, he[2] / de];
5167
5167
  }), L = u && Y ? Lr(x.id, W, Y, Rr(Y), u) : void 0, Q = (R) => L?.[R] ?? !1, re = ee.map((R, J) => {
@@ -5172,9 +5172,9 @@ function Fr(e, t, o, n, a = {}) {
5172
5172
  }), K = (R) => W.faces[R].corners.reduce((J, he) => J + q[he][2], 0) / W.faces[R].corners.length, X = W.faces.map((R, J) => ({ face: R, i: J })).filter(({ i: R }) => re[R]).map(({ face: R, i: J }) => ({
5173
5173
  i: J,
5174
5174
  solved: {
5175
- points: N === void 0 ? R.corners.map((he) => I[he]) : C(S(R.corners.map((he) => q[he]))),
5175
+ points: C === void 0 ? R.corners.map((he) => I[he]) : N(S(R.corners.map((he) => q[he]))),
5176
5176
  depth: K(J),
5177
- tone: 0.72 + 0.33 * Math.max(0, ee[J][0] * Co[0] + ee[J][1] * Co[1] + ee[J][2] * Co[2])
5177
+ tone: 0.72 + 0.33 * Math.max(0, ee[J][0] * No[0] + ee[J][1] * No[1] + ee[J][2] * No[2])
5178
5178
  }
5179
5179
  })).filter((R) => R.solved.points.length >= 3).sort((R, J) => R.solved.depth - J.solved.depth);
5180
5180
  if (a.light) {
@@ -5187,19 +5187,19 @@ function Fr(e, t, o, n, a = {}) {
5187
5187
  he.light = yt.light, he.fog = yt.fog;
5188
5188
  }
5189
5189
  }
5190
- const F = X.map((R) => R.solved), Z = dc(W), se = [], ae = [];
5190
+ const F = X.map((R) => R.solved), Z = uc(W), se = [], ae = [];
5191
5191
  for (const [R, J] of Z) {
5192
5192
  const he = J.filter((pe) => re[pe]).length;
5193
5193
  if (he === 0) continue;
5194
- const de = J.length === 2 && he === 2 && W.creases !== !1 && ee[J[0]][0] * ee[J[1]][0] + ee[J[0]][1] * ee[J[1]][1] + ee[J[0]][2] * ee[J[1]][2] < cc;
5195
- J.length === 1 && (W.joined || gc(W, R)) || (J.length === 1 || he === 1 || de) && (se.push(R.split("-").map(Number)), ae.push(J.filter((pe) => re[pe]).reduce((pe, ge) => K(ge) > K(pe) ? ge : pe)));
5194
+ const de = J.length === 2 && he === 2 && W.creases !== !1 && ee[J[0]][0] * ee[J[1]][0] + ee[J[0]][1] * ee[J[1]][1] + ee[J[0]][2] * ee[J[1]][2] < fc;
5195
+ J.length === 1 && (W.joined || mc(W, R)) || (J.length === 1 || he === 1 || de) && (se.push(R.split("-").map(Number)), ae.push(J.filter((pe) => re[pe]).reduce((pe, ge) => K(ge) > K(pe) ? ge : pe)));
5196
5196
  }
5197
- const ie = (R) => W.faces.findIndex((J) => J.corners.length > 4 && Math.sign(mc(W.vertices[R], J.normal)) > 0), $ = (W.marks ?? []).filter(([R]) => ie(R) < 0 || re[ie(R)]), z = ([R, J]) => N === void 0 ? [[I[R], I[J]]] : _([q[R], q[J]]).map(C), U = $.flatMap(z), te = (R) => N === void 0 ? [R.map((J) => I[J])] : _(R.map((J) => q[J])).map(C);
5197
+ const ie = (R) => W.faces.findIndex((J) => J.corners.length > 4 && Math.sign(bc(W.vertices[R], J.normal)) > 0), $ = (W.marks ?? []).filter(([R]) => ie(R) < 0 || re[ie(R)]), z = ([R, J]) => C === void 0 ? [[I[R], I[J]]] : _([q[R], q[J]]).map(N), U = $.flatMap(z), te = (R) => C === void 0 ? [R.map((J) => I[J])] : _(R.map((J) => q[J])).map(N);
5198
5198
  if (a.slice !== void 0) {
5199
5199
  const R = /* @__PURE__ */ new Map();
5200
5200
  se.forEach((J, he) => R.set(ae[he], [...R.get(ae[he]) ?? [], J]));
5201
5201
  for (const { i: J, solved: he } of X) {
5202
- he.edges = Ns(R.get(J) ?? []).flatMap(te);
5202
+ he.edges = Cs(R.get(J) ?? []).flatMap(te);
5203
5203
  const de = W.faces[J].corners;
5204
5204
  he.center = de.reduce((ge, Me) => [ge[0] + q[Me][0] / de.length, ge[1] + q[Me][1] / de.length, ge[2] + q[Me][2] / de.length], [0, 0, 0]), he.normal = ee[J];
5205
5205
  const pe = X[X.length - 1].i;
@@ -5211,11 +5211,11 @@ function Fr(e, t, o, n, a = {}) {
5211
5211
  part: x,
5212
5212
  depth: q.reduce((R, J) => R + J[2], 0) / Math.max(1, q.length),
5213
5213
  faces: F,
5214
- edges: Ns(se).flatMap(te),
5214
+ edges: Cs(se).flatMap(te),
5215
5215
  marks: U,
5216
5216
  glow: B,
5217
5217
  opacity: D,
5218
- ...x.shape.type === "tube" ? { spine: pc(_(x.shape.points.map(oe)).map(C)) } : {},
5218
+ ...x.shape.type === "tube" ? { spine: yc(_(x.shape.points.map(oe)).map(N)) } : {},
5219
5219
  ...W.walls ? { cut: !0 } : {}
5220
5220
  };
5221
5221
  }, g = new Map(d?.map((x) => [x.part.id, x.local])), T = (f ? f.pieces.map((x) => ({
@@ -5255,7 +5255,7 @@ function Fr(e, t, o, n, a = {}) {
5255
5255
  return { under: M(H.filter((x) => !x.part.overRider)), over: M(H.filter((x) => x.part.overRider)), ...m ? { cells: m } : {}, anchors: P, openings: j, shadow: O, pxPerUnit: n, sizePx: e.height * n };
5256
5256
  }
5257
5257
  const Ks = /* @__PURE__ */ new WeakMap();
5258
- function dc(e) {
5258
+ function uc(e) {
5259
5259
  let t = Ks.get(e);
5260
5260
  if (!t) {
5261
5261
  t = /* @__PURE__ */ new Map();
@@ -5270,7 +5270,7 @@ function dc(e) {
5270
5270
  }
5271
5271
  return t;
5272
5272
  }
5273
- function fc(e, t) {
5273
+ function gc(e, t) {
5274
5274
  const o = e.derive ? { ...t, ...e.derive(t) } : t, n = $n(e, o), a = ne.invert(Ot(e, o)) ?? ne.identity(), r = (s) => Math.max(0, Math.min(1, s));
5275
5275
  return e.parts.map((s) => {
5276
5276
  const i = s.fade ? r(be(e, o, s.fade.control)) : 0;
@@ -5283,7 +5283,7 @@ function fc(e, t) {
5283
5283
  };
5284
5284
  });
5285
5285
  }
5286
- function uc(e, t) {
5286
+ function pc(e, t) {
5287
5287
  const o = e.derive ? { ...t, ...e.derive(t) } : t, n = $n(e, o), a = Ot(e, o), r = {};
5288
5288
  for (const [s, i] of Object.entries(e.anchors ?? {})) {
5289
5289
  const h = i.part ? n.get(i.part) : a;
@@ -5292,16 +5292,16 @@ function uc(e, t) {
5292
5292
  }
5293
5293
  return r;
5294
5294
  }
5295
- function gc(e, t) {
5295
+ function mc(e, t) {
5296
5296
  if (!e.walls) return !1;
5297
5297
  const [o, n] = t.split("-").map((r) => e.vertices[Number(r)]), a = (r, s) => s.some((i) => Math.abs(o[r] - i) < 1e-6 && Math.abs(n[r] - i) < 1e-6);
5298
5298
  return a(0, e.walls.x) || a(2, e.walls.z);
5299
5299
  }
5300
- function pc(e) {
5300
+ function yc(e) {
5301
5301
  return e.reduce((t, o) => !t || o.length > t.length ? o : t, void 0);
5302
5302
  }
5303
- const mc = (e, t) => e[0] * t[0] + e[1] * t[1] + e[2] * t[2];
5304
- function Ns(e) {
5303
+ const bc = (e, t) => e[0] * t[0] + e[1] * t[1] + e[2] * t[2];
5304
+ function Cs(e) {
5305
5305
  const t = e.map((n) => [...n]), o = [];
5306
5306
  for (; t.length > 0; ) {
5307
5307
  const n = [...t.shift()];
@@ -5338,7 +5338,7 @@ function qr(e) {
5338
5338
  }
5339
5339
  return t;
5340
5340
  }
5341
- function yc(e) {
5341
+ function wc(e) {
5342
5342
  const { prop: t } = e, o = e.scale ?? 60, n = t.rig.length * o * 1.4, a = t.rig.height * o * 1.6, r = qr(t), s = {};
5343
5343
  for (const [h, c] of Object.entries(r)) s[h] = e.values?.[h] ?? c.default ?? 0;
5344
5344
  const i = { look: e.look, ink: e.ink, lineWidth: e.lineWidth, pencil: e.pencil, seed: e.seed, style: e.style, paper: e.paper };
@@ -5365,7 +5365,7 @@ function yc(e) {
5365
5365
  };
5366
5366
  }
5367
5367
  function jt(e, t, o) {
5368
- const n = hc(be(e.rig, t, "turn"), be(e.rig, t, "tilt"), o);
5368
+ const n = dc(be(e.rig, t, "turn"), be(e.rig, t, "tilt"), o);
5369
5369
  return Fr(e.rig, t, n, o);
5370
5370
  }
5371
5371
  function En(e, t, o) {
@@ -5385,7 +5385,7 @@ function En(e, t, o) {
5385
5385
  }
5386
5386
  };
5387
5387
  }
5388
- function rf(e, t, o, n, a = {}) {
5388
+ function lf(e, t, o, n, a = {}) {
5389
5389
  const r = En(t, o, n);
5390
5390
  return e.save(), e.translate(r.origin.x, r.origin.y), cr(e, r.solved, {
5391
5391
  ...t.propDraw,
@@ -5412,8 +5412,8 @@ const Mt = {
5412
5412
  move: "a part; { at, to: an anchor name or { x, y }, duration? }: carry the part there, loose",
5413
5413
  fling: "a part; { at, velocity?, spin?, gravity?, duration? }: knock the part off on a spinning arc"
5414
5414
  }
5415
- }, bc = 400, wc = 0.2;
5416
- function af(e, t = {}) {
5415
+ }, kc = 400, vc = 0.2;
5416
+ function hf(e, t = {}) {
5417
5417
  const { prop: o } = e, n = qr(o), a = Object.keys(n), r = Object.keys(o.rig.anchors ?? {}), s = o.rig.parts.map((A) => A.id), i = It(), h = fo(i), c = t.tracks?.length ? new ve({ id: `${o.kind}-surface`, tracks: t.tracks }) : void 0, l = Math.max(0, ...(t.tracks ?? []).flatMap((A) => A.keyframes.map((k) => k.time))), d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
5418
5418
  e.loose = f;
5419
5419
  const u = e.props, p = (A) => {
@@ -5460,7 +5460,7 @@ function af(e, t = {}) {
5460
5460
  const y = g(A), { values: v, origin: w, solved: E } = H(k);
5461
5461
  if (y.kind === "box") return me(w.x - e.width / 2, w.y - e.height, e.width, e.height);
5462
5462
  if (y.kind === "anchor") {
5463
- const x = E.anchors[y.name].point, W = wc * e.propScale;
5463
+ const x = E.anchors[y.name].point, W = vc * e.propScale;
5464
5464
  return me(w.x + x.x - W / 2, w.y + x.y - W / 2, W, W);
5465
5465
  }
5466
5466
  if (y.kind === "part") return j(/* @__PURE__ */ new Set([y.name]), `part "${y.name}" is`);
@@ -5468,12 +5468,12 @@ function af(e, t = {}) {
5468
5468
  if (O.size === 0) return me(w.x - e.width / 2, w.y - e.height, e.width, e.height);
5469
5469
  return j(O, `the parts control "${y.name}" moves are`);
5470
5470
  function j(x, W) {
5471
- const G = [...E.under, ...E.over].filter((N) => x.has(N.part.id)).flatMap((N) => N.faces.flatMap((C) => C.points));
5471
+ const G = [...E.under, ...E.over].filter((C) => x.has(C.part.id)).flatMap((C) => C.faces.flatMap((N) => N.points));
5472
5472
  if (G.length === 0) {
5473
- const N = Number.isFinite(k) ? `at ${k} ms` : "after its edits";
5474
- throw new Error(`${o.kind}: ${W} turned away from the viewer ${N}; aim at an anchor (${r.map((C) => `anchor:${C}`).join(", ") || "none"}) or box`);
5473
+ const C = Number.isFinite(k) ? `at ${k} ms` : "after its edits";
5474
+ throw new Error(`${o.kind}: ${W} turned away from the viewer ${C}; aim at an anchor (${r.map((N) => `anchor:${N}`).join(", ") || "none"}) or box`);
5475
5475
  }
5476
- const Y = G.map((N) => N.x), oe = G.map((N) => N.y), q = Math.min(...Y), I = Math.min(...oe);
5476
+ const Y = G.map((C) => C.x), oe = G.map((C) => C.y), q = Math.min(...Y), I = Math.min(...oe);
5477
5477
  return me(w.x + q, w.y + I, Math.max(...Y) - q, Math.max(...oe) - I);
5478
5478
  }
5479
5479
  }, m = (A, k) => {
@@ -5527,7 +5527,7 @@ function af(e, t = {}) {
5527
5527
  j = y.value;
5528
5528
  } else
5529
5529
  j = y.on === !1 ? O.default ?? O.min ?? 0 : O.max ?? 1;
5530
- i.tween(E.name, p(y.at).values[E.name], j, y, bc);
5530
+ i.tween(E.name, p(y.at).values[E.name], j, y, kc);
5531
5531
  }
5532
5532
  return P;
5533
5533
  },
@@ -5556,9 +5556,9 @@ function af(e, t = {}) {
5556
5556
  };
5557
5557
  return P;
5558
5558
  }
5559
- const kc = { body: "#e8574a", trim: "#3b3b44", glass: "#bfe3f2", tyre: "#2c2c33", hub: "#c9ccd3", light: "#fff4b8", tail: "#ff5a4f", inside: "#3b3640", seat: "#6d5d55" };
5559
+ const Sc = { body: "#e8574a", trim: "#3b3b44", glass: "#bfe3f2", tyre: "#2c2c33", hub: "#c9ccd3", light: "#fff4b8", tail: "#ff5a4f", inside: "#3b3640", seat: "#6d5d55" };
5560
5560
  function De(e) {
5561
- const t = { ...kc, ...e.colors }, o = [], { forwardMost: n, backMost: a, top: r } = Br(e);
5561
+ const t = { ...Sc, ...e.colors }, o = [], { forwardMost: n, backMost: a, top: r } = Br(e);
5562
5562
  e.body && o.push({ id: "body", shape: { type: "extrude", profile: e.body, width: e.width }, fill: t.body });
5563
5563
  for (const [l, d] of (e.frame ?? []).entries())
5564
5564
  o.push({ id: `frame-${l}`, shape: { type: "tube", points: d.points, radius: d.radius ?? 0.035, segments: 6 }, fill: d.color ?? t.body, outline: 0.7 });
@@ -5685,8 +5685,8 @@ function De(e) {
5685
5685
  family: "vehicle",
5686
5686
  summary: e.summary ?? "A wheeled vehicle",
5687
5687
  rig: c,
5688
- actions: Sc(e),
5689
- acting: vc,
5688
+ actions: $c(e),
5689
+ acting: Mc,
5690
5690
  colors: { body: t.body, ink: "#26262b" },
5691
5691
  follow: e.antenna ? [{ control: "antenna", of: "x", per: 0.9, stiffness: 140, damping: 7, limit: 35 }] : void 0,
5692
5692
  wheelRadius: s,
@@ -5707,7 +5707,7 @@ function Br(e) {
5707
5707
  ];
5708
5708
  return { forwardMost: Math.max(...t), backMost: Math.min(...t), top: Math.max(...o) };
5709
5709
  }
5710
- const vc = {
5710
+ const Mc = {
5711
5711
  depth: { turn: 0, lift: 0, lights: 0, pitch: 1, roll: 1, squash: 1, lean: 1, door: 2 },
5712
5712
  limits: { turn: 0.08, pitch: 5, roll: 4, lean: 0.1, squash: 0.06, door: 0.12, lift: 0 },
5713
5713
  eyes: [],
@@ -5718,8 +5718,8 @@ function qt(e, t, o, n, a, r, s = !1) {
5718
5718
  const i = e.facing() || Math.sign(n - e.x) || 1, h = e.values.wheelSpin ?? 0, c = (n - e.x) * i / e.scale;
5719
5719
  e.set("wheelSpin", t, h), e.move(t, o, n, { easing: a }), e.set("wheelSpin", o, s ? h : h + c / r * (180 / Math.PI), a);
5720
5720
  }
5721
- const Cs = 0.4;
5722
- function Sc(e) {
5721
+ const Ns = 0.4;
5722
+ function $c(e) {
5723
5723
  const t = e.wheels[0]?.radius ?? 0.4, { forwardMost: o, backMost: n } = Br(e), a = (o - n) / 2, r = (i, h, c) => {
5724
5724
  const l = i.exaggeration;
5725
5725
  let d = h;
@@ -5736,7 +5736,7 @@ function Sc(e) {
5736
5736
  run(i, h, c) {
5737
5737
  const l = Math.sign(h.to - i.x);
5738
5738
  if (l === 0) return { end: c };
5739
- const d = r(i, c, l), f = i.exaggeration, u = Math.abs(h.to - i.x), p = h.for ?? Math.max(500, u / (h.speed ?? Cs));
5739
+ const d = r(i, c, l), f = i.exaggeration, u = Math.abs(h.to - i.x), p = h.for ?? Math.max(500, u / (h.speed ?? Ns));
5740
5740
  return i.effect({ kind: "dust", time: d, x: i.x - l * a * i.scale, y: i.floor, length: 600, direction: -l }), i.key(d + 140, { pitch: -1.5 * f, squash: 1 + 0.05 * f, lean: 0.12 * f }, { act: !1, easing: "ease-out" }), i.key(d + Math.max(160, p - 160), { pitch: 0, lean: 0.08 * f, squash: 1.02 }, { act: !1 }), qt(i, d, d + p, h.to, "ease-in-out", t), s(i, d + p, !1), { end: d + p + 380, contact: d, release: d + p };
5741
5741
  }
5742
5742
  },
@@ -5747,7 +5747,7 @@ function Sc(e) {
5747
5747
  run(i, h, c) {
5748
5748
  const l = Math.sign(h.to - i.x);
5749
5749
  if (l === 0) return { end: c };
5750
- const d = r(i, c, l), f = i.exaggeration, u = i.x, p = Math.abs(h.to - u), g = h.for ?? Math.max(600, p / (h.speed ?? Cs * 1.2)), b = d + g * 0.55, T = u + (h.to - u) * 0.65;
5750
+ const d = r(i, c, l), f = i.exaggeration, u = i.x, p = Math.abs(h.to - u), g = h.for ?? Math.max(600, p / (h.speed ?? Ns * 1.2)), b = d + g * 0.55, T = u + (h.to - u) * 0.65;
5751
5751
  return i.key(d + 140, { pitch: -1.5 * f, squash: 1 + 0.06 * f, lean: 0.14 * f }, { act: !1, easing: "ease-out" }), qt(i, d, b, T, "ease-in", t), i.key(b + 80, { pitch: -7 * f, lean: -0.12 * f, squash: 0.94 }, { act: !1, easing: "ease-out" }), qt(i, b, d + g, h.to, "ease-out", t, !0), i.effect({ kind: "skid", time: b, x: T, toX: h.to, y: i.floor, length: g * 0.45 + 1500 }), i.effect({ kind: "dust", time: d + g, x: h.to + l * a * i.scale, y: i.floor, length: 600, direction: l }), s(i, d + g, !0), { end: d + g + 380, contact: b, release: d + g };
5752
5752
  }
5753
5753
  },
@@ -5788,7 +5788,7 @@ function Sc(e) {
5788
5788
  } : {}
5789
5789
  };
5790
5790
  }
5791
- function Mc(e = {}) {
5791
+ function Ec(e = {}) {
5792
5792
  return De({
5793
5793
  kind: "car",
5794
5794
  summary: "A cartoon car: drives, brakes, bumps, honks, opens its doors, lights up, and turns toward the camera.",
@@ -5806,7 +5806,7 @@ function Mc(e = {}) {
5806
5806
  colors: e.colors
5807
5807
  });
5808
5808
  }
5809
- function $c(e = {}) {
5809
+ function Ac(e = {}) {
5810
5810
  return De({
5811
5811
  kind: "truck",
5812
5812
  summary: "A box truck: drives, brakes, bumps, honks, opens its cab doors, lights up, turns toward the camera.",
@@ -5825,7 +5825,7 @@ function $c(e = {}) {
5825
5825
  colors: { body: "#2f6fb7", ...e.colors }
5826
5826
  });
5827
5827
  }
5828
- function Ec(e = {}) {
5828
+ function Tc(e = {}) {
5829
5829
  return De({
5830
5830
  kind: "bus",
5831
5831
  summary: "A bus: drives, brakes, bumps, honks, opens its front doors, lights its windows, turns toward the camera.",
@@ -5843,7 +5843,7 @@ function Ec(e = {}) {
5843
5843
  colors: { body: "#f2c230", ...e.colors }
5844
5844
  });
5845
5845
  }
5846
- function Ac(e = {}) {
5846
+ function Pc(e = {}) {
5847
5847
  return De({
5848
5848
  kind: "tractor",
5849
5849
  summary: "A tractor: big rear wheels and small front ones turning at their own rates; drives, brakes, bumps, honks.",
@@ -5863,7 +5863,7 @@ function Ac(e = {}) {
5863
5863
  colors: { body: "#3f9b47", hub: "#e9c64a", ...e.colors }
5864
5864
  });
5865
5865
  }
5866
- function Tc(e = {}) {
5866
+ function Oc(e = {}) {
5867
5867
  const t = e.colors?.body ?? "#a8743f";
5868
5868
  return De({
5869
5869
  kind: "cart",
@@ -5880,7 +5880,7 @@ function Tc(e = {}) {
5880
5880
  colors: { body: t, tyre: "#5a3a1f", ...e.colors }
5881
5881
  });
5882
5882
  }
5883
- function Pc(e = {}) {
5883
+ function Hc(e = {}) {
5884
5884
  return De({
5885
5885
  kind: "train carriage",
5886
5886
  summary: "A railway carriage: rolls along (drive), brakes, lights its windows, turns toward the camera.",
@@ -5898,7 +5898,7 @@ function Pc(e = {}) {
5898
5898
  colors: { body: "#2f7d6d", ...e.colors }
5899
5899
  });
5900
5900
  }
5901
- function Oc(e = {}) {
5901
+ function Ic(e = {}) {
5902
5902
  const t = e.colors?.body ?? "#e0473b", o = [0, 0.32, -0.05], n = [0, 0.86, -0.22], a = [0, 0.9, 0.42], r = [0, 0.34, 0.56], s = [0, 0.34, -0.56];
5903
5903
  return De({
5904
5904
  kind: "bike",
@@ -5923,7 +5923,7 @@ function Oc(e = {}) {
5923
5923
  colors: { body: t, tyre: "#2c2c33", ...e.colors }
5924
5924
  });
5925
5925
  }
5926
- function Hc(e = {}) {
5926
+ function xc(e = {}) {
5927
5927
  return De({
5928
5928
  kind: "motorbike",
5929
5929
  summary: "A motorbike: rides (drive) with a lunge, brakes into a skid, bumps, honks, lights up.",
@@ -5944,7 +5944,7 @@ function Hc(e = {}) {
5944
5944
  colors: { body: "#1f1f26", hub: "#c9ccd3", ...e.colors }
5945
5945
  });
5946
5946
  }
5947
- function Ic(e = {}) {
5947
+ function jc(e = {}) {
5948
5948
  const t = e.height ?? 2.4, o = e.trunkRadius ?? 0.16, n = e.canopy?.radius ?? 1.1, a = e.canopy?.shape === "tall", r = { trunk: "#8a5a3b", leaves: "#5cae5a", ...e.colors }, s = rn(e.canopy?.seed ?? 7), i = [
5949
5949
  { id: "trunk", shape: { type: "tube", points: [[0, 0, 0], [0.06, t * 0.5, 0], [-0.02, t, 0]], radius: o, segments: 8 }, fill: r.trunk },
5950
5950
  { id: "branch", parent: "trunk", shape: { type: "tube", points: [[0, 0, 0], [0.45, 0.4, 0.1]], radius: o * 0.45, segments: 6 }, at: [0.04, t * 0.62, 0], fill: r.trunk },
@@ -5975,19 +5975,19 @@ function Ic(e = {}) {
5975
5975
  family: "plant",
5976
5976
  summary: e.summary ?? "A tree: sways in the wind with its canopy trailing, shakes, sheds leaves, pops up.",
5977
5977
  rig: c,
5978
- actions: jc(),
5979
- acting: xc,
5978
+ actions: Kc(),
5979
+ acting: _c,
5980
5980
  colors: { body: r.leaves }
5981
5981
  };
5982
5982
  }
5983
- const xc = {
5983
+ const _c = {
5984
5984
  depth: { sway: 1, canopySway: 2, size: 0, squash: 1 },
5985
5985
  limits: { sway: 2, canopySway: 3, squash: 0.08 },
5986
5986
  eyes: [],
5987
5987
  headTurns: {},
5988
5988
  drift: []
5989
5989
  };
5990
- function jc() {
5990
+ function Kc() {
5991
5991
  const e = (t, o, n, a) => {
5992
5992
  const r = t.anchor("canopy");
5993
5993
  t.effect({ kind: "leaves", time: o, x: r.x, y: r.y, length: n, direction: a, toY: t.floor });
@@ -6030,7 +6030,7 @@ function jc() {
6030
6030
  }
6031
6031
  };
6032
6032
  }
6033
- function _c(e = {}) {
6033
+ function Cc(e = {}) {
6034
6034
  const t = e.width ?? 4, o = e.depth ?? 3.2, n = e.wallHeight ?? 2.5, a = e.roofHeight ?? 1.5, r = e.overhang ?? 0.25, s = { walls: "#f1d9a8", roof: "#b8433a", door: "#7a4b2a", doorway: "#3a2a22", glass: "#bfe3f2", lit: "#ffd66b", chimney: "#9b5a45", ...e.colors }, i = o / 2 + 0.01, h = e.door?.width ?? 0.9, c = e.door?.height ?? 1.9, l = e.door?.at ?? 0, d = e.windows ?? [
6035
6035
  { at: -1.25, low: 1, width: 0.8, height: 0.8 },
6036
6036
  { at: 1.25, low: 1, width: 0.8, height: 0.8 }
@@ -6095,19 +6095,19 @@ function _c(e = {}) {
6095
6095
  family: "building",
6096
6096
  summary: e.summary ?? "A house: opens its door, lights its windows, puffs chimney smoke, shakes, pops up.",
6097
6097
  rig: p,
6098
- actions: Nc(!!u),
6099
- acting: Kc,
6098
+ actions: Rc(!!u),
6099
+ acting: Nc,
6100
6100
  colors: { body: s.walls }
6101
6101
  };
6102
6102
  }
6103
- const Kc = {
6103
+ const Nc = {
6104
6104
  depth: { door: 1, lights: 0, roll: 1, squash: 1, size: 0 },
6105
6105
  limits: { door: 0.1, roll: 1.5, squash: 0.05 },
6106
6106
  eyes: [],
6107
6107
  headTurns: {},
6108
6108
  drift: []
6109
6109
  };
6110
- function Nc(e) {
6110
+ function Rc(e) {
6111
6111
  return {
6112
6112
  door: {
6113
6113
  summary: "Opens the front door (`open: true`) or shuts it (`open: false`).",
@@ -6148,7 +6148,7 @@ function Nc(e) {
6148
6148
  } : {}
6149
6149
  };
6150
6150
  }
6151
- function Cc(e = {}) {
6151
+ function Wc(e = {}) {
6152
6152
  const t = e.width ?? 0.46, o = e.depth ?? 0.46, n = e.seatHeight ?? 0.46, a = e.backHeight ?? 0.95, r = { wood: "#8a5a3b", seat: "#c48a4a", ...e.colors }, s = 0.05, i = 0.025, h = [
6153
6153
  { id: "seat", shape: { type: "box", size: [t, s, o] }, at: [0, n - s / 2, 0], fill: r.seat },
6154
6154
  { id: "back", shape: { type: "box", size: [t, a - n, s] }, at: [0, (a + n) / 2, -o / 2 + s / 2], fill: r.wood }
@@ -6174,19 +6174,19 @@ function Cc(e = {}) {
6174
6174
  family: "furniture",
6175
6175
  summary: e.summary ?? "A chair: a seat to sit on (`seat`), tips back on its rear legs and settles, or falls over.",
6176
6176
  rig: c,
6177
- actions: Wc(),
6178
- acting: Rc,
6177
+ actions: Lc(),
6178
+ acting: zc,
6179
6179
  colors: { body: r.seat }
6180
6180
  };
6181
6181
  }
6182
- const Rc = {
6182
+ const zc = {
6183
6183
  depth: { tip: 1, roll: 1, squash: 1, size: 0 },
6184
6184
  limits: { tip: 2, roll: 1, squash: 0.05 },
6185
6185
  eyes: [],
6186
6186
  headTurns: {},
6187
6187
  drift: []
6188
6188
  };
6189
- function Wc() {
6189
+ function Lc() {
6190
6190
  return {
6191
6191
  tip: {
6192
6192
  summary: "Tips back on its rear legs for `for` ms (default 1200), rocking a little, then settles down.",
@@ -6206,7 +6206,7 @@ function Wc() {
6206
6206
  }
6207
6207
  };
6208
6208
  }
6209
- function zc(e = {}) {
6209
+ function Fc(e = {}) {
6210
6210
  const t = e.width ?? 1.4, o = e.depth ?? 0.7, n = e.height ?? 0.75, a = { wood: "#8a5a3b", top: "#a9754a", knob: "#2b2b2b", ...e.colors }, r = 0.04, s = 0.03, i = 0.14, h = t * 0.4, c = [
6211
6211
  { id: "top", shape: { type: "box", size: [t, r, o] }, at: [0, n - r / 2, 0], fill: a.top },
6212
6212
  // The drawer: a box under the top on the left, sliding forward on its control.
@@ -6244,18 +6244,18 @@ function zc(e = {}) {
6244
6244
  }
6245
6245
  }
6246
6246
  },
6247
- acting: Lc,
6247
+ acting: Dc,
6248
6248
  colors: { body: a.top }
6249
6249
  };
6250
6250
  }
6251
- const Lc = {
6251
+ const Dc = {
6252
6252
  depth: { drawer: 1, roll: 1, squash: 1, size: 0 },
6253
6253
  limits: { drawer: 0.08, roll: 1, squash: 0.04 },
6254
6254
  eyes: [],
6255
6255
  headTurns: {},
6256
6256
  drift: []
6257
6257
  };
6258
- function Fc(e = {}) {
6258
+ function qc(e = {}) {
6259
6259
  const t = e.length ?? 2, o = e.width ?? 1, n = e.height ?? 0.55, a = e.headboard ?? 0.95, r = { wood: "#8a5a3b", mattress: "#f1ece2", blanket: "#5b7fb0", pillow: "#fbf8f2", ...e.colors }, s = 0.3, i = n - s, c = {
6260
6260
  parts: [
6261
6261
  { id: "frame", shape: { type: "box", size: [o, s, t] }, at: [0, s / 2, 0], fill: r.wood },
@@ -6292,18 +6292,18 @@ function Fc(e = {}) {
6292
6292
  }
6293
6293
  }
6294
6294
  },
6295
- acting: Dc,
6295
+ acting: Bc,
6296
6296
  colors: { body: r.blanket }
6297
6297
  };
6298
6298
  }
6299
- const Dc = {
6299
+ const Bc = {
6300
6300
  depth: { give: 1, roll: 1, squash: 1, size: 0 },
6301
6301
  limits: { give: 0.03, roll: 0.5, squash: 0.03 },
6302
6302
  eyes: [],
6303
6303
  headTurns: {},
6304
6304
  drift: []
6305
6305
  };
6306
- function qc(e = {}) {
6306
+ function Gc(e = {}) {
6307
6307
  const t = e.width ?? 0.9, o = e.height ?? 2.05, n = e.hinge ?? "left", a = { frame: "#d9d2c3", door: "#7a4b2a", handle: "#c9a227", beyond: "#2a2f3a", ...e.colors }, r = 0.1, s = n === "left" ? 1 : -1, i = s > 0 ? [[0, 0], [-t, 0], [-t, o], [0, o]] : [[0, 0], [t, 0], [t, o], [0, o]], c = {
6308
6308
  parts: [
6309
6309
  { id: "post-left", shape: { type: "box", size: [r, o + r, r] }, at: [t / 2 + r / 2, (o + r) / 2, 0], fill: a.frame },
@@ -6331,19 +6331,19 @@ function qc(e = {}) {
6331
6331
  family: "furniture",
6332
6332
  summary: e.summary ?? "A door in its frame: opens and shuts on its hinge (`open`), slams, rattles when knocked; a figure goes through the `doorway` from `front` to `beyond`.",
6333
6333
  rig: c,
6334
- actions: Gc(),
6335
- acting: Bc,
6334
+ actions: Uc(),
6335
+ acting: Yc,
6336
6336
  colors: { body: a.door }
6337
6337
  };
6338
6338
  }
6339
- const Bc = {
6339
+ const Yc = {
6340
6340
  depth: { open: 1, roll: 1, squash: 1, size: 0 },
6341
6341
  limits: { open: 0.08, roll: 0.6, squash: 0.03 },
6342
6342
  eyes: [],
6343
6343
  headTurns: {},
6344
6344
  drift: []
6345
6345
  };
6346
- function Gc() {
6346
+ function Uc() {
6347
6347
  return {
6348
6348
  open: {
6349
6349
  summary: "Opens the door (`open: true`, default) or shuts it (`open: false`), over `for` ms (default 600).",
@@ -6377,7 +6377,7 @@ function Gc() {
6377
6377
  };
6378
6378
  }
6379
6379
  const Gr = 1.4;
6380
- function Yc(e = {}) {
6380
+ function Xc(e = {}) {
6381
6381
  const t = e.width ?? 0.5, o = e.seatHeight ?? 0.5, n = e.wheelRadius ?? 0.3, a = 0.08, r = { frame: "#2b2f36", seat: "#3c6ea5", tyre: "#1f2328", ...e.colors }, s = 0.04, i = 0.018, h = 0.44, c = o + 0.5, l = -0.08, d = t / 2 + 0.06, f = [
6382
6382
  { id: "seat", shape: { type: "box", size: [t, s, h] }, at: [0, o - s / 2, 0], fill: r.seat },
6383
6383
  { id: "back", shape: { type: "box", size: [t, c - o - 0.02, s] }, at: [0, (c + o) / 2, -h / 2 + s / 2], fill: r.seat },
@@ -6435,14 +6435,14 @@ function Yc(e = {}) {
6435
6435
  family: "furniture",
6436
6436
  summary: e.summary ?? "A wheelchair: rolls to `to` with its wheels turning the distance (roll), brakes, tips back on its big wheels (wheelie); its `seat` is ridden in the `wheeling` pose and a pusher stands at `handles`.",
6437
6437
  rig: p,
6438
- actions: Xc(n),
6439
- acting: Uc,
6438
+ actions: Jc(n),
6439
+ acting: Vc,
6440
6440
  colors: { body: r.seat, ink: r.frame },
6441
6441
  wheelRadius: n,
6442
6442
  moves: { roll: { speed: Gr, perMetre: { wheelSpin: 180 / (Math.PI * n) } } }
6443
6443
  };
6444
6444
  }
6445
- const Uc = {
6445
+ const Vc = {
6446
6446
  depth: { wheelSpin: 0, tip: 1, roll: 1, squash: 1, size: 0 },
6447
6447
  limits: { tip: 2, roll: 1, squash: 0.03 },
6448
6448
  eyes: [],
@@ -6453,7 +6453,7 @@ function Rs(e, t, o, n, a, r, s = !1) {
6453
6453
  const i = e.facing() || Math.sign(n - e.x) || 1, h = e.values.wheelSpin ?? 0, c = (n - e.x) * i / e.scale;
6454
6454
  e.set("wheelSpin", t, h), e.move(t, o, n, { easing: a }), e.set("wheelSpin", o, s ? h : h + c / r * (180 / Math.PI), a);
6455
6455
  }
6456
- function Xc(e) {
6456
+ function Jc(e) {
6457
6457
  return {
6458
6458
  roll: {
6459
6459
  summary: "Rolls to `to` at `speed` px/ms (or over `for` ms): a small push-off, the wheels turning exactly the distance, and a gentle stop.",
@@ -6488,7 +6488,7 @@ function Xc(e) {
6488
6488
  }
6489
6489
  };
6490
6490
  }
6491
- function Vc(e = {}) {
6491
+ function Zc(e = {}) {
6492
6492
  const t = { body: "#3f86c8", glass: "#cfeaf5", trim: "#2c2c33", rotor: "#3b3b44", ...e.colors }, o = 2.15, a = {
6493
6493
  parts: [
6494
6494
  {
@@ -6541,7 +6541,7 @@ function Vc(e = {}) {
6541
6541
  family: "aircraft",
6542
6542
  summary: e.summary ?? "A cartoon helicopter: spools up and takes off, flies nose-down banking into its moves, hovers with a bob, and lands with a squash.",
6543
6543
  rig: a,
6544
- actions: Jc(),
6544
+ actions: Qc(),
6545
6545
  acting: Yr,
6546
6546
  colors: { body: t.body, ink: "#26262b" },
6547
6547
  // In world metres: flies with its rotor spinning (a blur), at the height a beat gives.
@@ -6555,7 +6555,7 @@ const Yr = {
6555
6555
  headTurns: {},
6556
6556
  drift: []
6557
6557
  }, Re = 2.6;
6558
- function Jc() {
6558
+ function Qc() {
6559
6559
  const e = (o, n, a, r, s) => {
6560
6560
  const i = o.values.rotor ?? 0;
6561
6561
  o.set("rotor", n, i);
@@ -6604,7 +6604,7 @@ function Jc() {
6604
6604
  }
6605
6605
  };
6606
6606
  }
6607
- function Zc(e = {}) {
6607
+ function e0(e = {}) {
6608
6608
  const t = { body: "#e9e4d8", wings: "#d9483b", glass: "#cfeaf5", trim: "#2c2c33", ...e.colors }, o = 3.15, a = {
6609
6609
  parts: [
6610
6610
  { id: "fuselage", shape: { type: "extrude", profile: [[-3.7, 1.55], [-2.6, 1.05], [2.4, 0.85], [3, 1], [3.1, 1.4], [2.7, 1.75], [1.4, 1.9], [-2.9, 1.85]], width: 1 }, fill: t.body },
@@ -6645,17 +6645,17 @@ function Zc(e = {}) {
6645
6645
  family: "aircraft",
6646
6646
  summary: e.summary ?? "A propeller plane: takes off from a run, flies banked, loops the loop, and lands with a flare and a squash.",
6647
6647
  rig: a,
6648
- actions: e0(),
6648
+ actions: o0(),
6649
6649
  acting: Yr,
6650
6650
  colors: { body: t.body, ink: "#26262b" },
6651
6651
  moves: { fly: { speed: 30, flies: !0, hold: { blur: 1 }, perSecond: { rotor: Re * 1e3 } } }
6652
6652
  };
6653
6653
  }
6654
- const Qc = 3.2;
6655
- function e0() {
6654
+ const t0 = 3.2;
6655
+ function o0() {
6656
6656
  const e = (o, n, a, r) => {
6657
6657
  const s = o.values.rotor ?? 0;
6658
- o.set("rotor", n, s), o.set("rotor", a, s + Qc * (a - n) * (r ? 0.5 : 1), r);
6658
+ o.set("rotor", n, s), o.set("rotor", a, s + t0 * (a - n) * (r ? 0.5 : 1), r);
6659
6659
  }, t = (o, n, a) => {
6660
6660
  const r = Math.sign(a - o.x);
6661
6661
  return r !== 0 && o.facing() !== r ? o.turnTo(n, r > 0 ? "right" : "left") : n;
@@ -6704,7 +6704,7 @@ function e0() {
6704
6704
  }
6705
6705
  };
6706
6706
  }
6707
- const _t = ["walk", "trot", "canter", "gallop"], lf = _t, Ur = ["fl", "fr", "hl", "hr"], po = {
6707
+ const _t = ["walk", "trot", "canter", "gallop"], cf = _t, Ur = ["fl", "fr", "hl", "hr"], po = {
6708
6708
  walk: { offsets: { hl: 0, fl: 0.25, hr: 0.5, fr: 0.75 }, swing: 16, lift: 45, bob: 0.02, rock: 0, cycle: 1100 },
6709
6709
  trot: { offsets: { fl: 0, hr: 0, fr: 0.5, hl: 0.5 }, swing: 22, lift: 75, bob: 0.05, rock: 0, cycle: 640 },
6710
6710
  canter: { offsets: { hr: 0, hl: 0.33, fr: 0.33, fl: 0.66 }, swing: 30, lift: 70, bob: 0.08, rock: 5, cycle: 560 },
@@ -6719,7 +6719,7 @@ function Ze(e) {
6719
6719
  // The neck tapers from the shoulders up to the head.
6720
6720
  { id: "neck", shape: { type: "tube", points: e.neck.points, radius: e.neck.points.map((d, f, u) => e.neck.radius * (1.25 - 0.4 * f / Math.max(1, u.length - 1))), segments: 12 }, at: e.neck.at, fill: o.coat },
6721
6721
  { id: "head", parent: "neck", shape: { type: "ellipsoid", radii: e.head.radii, segments: 14 }, at: e.head.at, rotate: e.head.rotate, fill: o.coat },
6722
- ...o0(e, o, a)
6722
+ ...s0(e, o, a)
6723
6723
  ];
6724
6724
  e.mane && s.push({ id: "mane", parent: "neck", shape: { type: "tube", points: e.mane.points, radius: e.mane.radius, segments: 6 }, fill: o.dark, outline: 0.7 }), e.muzzle && s.push({ id: "muzzle", parent: "head", shape: { type: "ellipsoid", radii: e.muzzle.radii, segments: 10 }, at: e.muzzle.at, fill: o.muzzle, outline: 0.8 });
6725
6725
  for (const d of [1, -1]) {
@@ -6766,7 +6766,7 @@ function Ze(e) {
6766
6766
  front: { at: [0, a, e.body.radii[2]] },
6767
6767
  ...e.anchors
6768
6768
  },
6769
- derive: (d) => n0(d, e, n)
6769
+ derive: (d) => r0(d, e, n)
6770
6770
  }, l = {
6771
6771
  legLength: n,
6772
6772
  upper: t.upper,
@@ -6785,17 +6785,17 @@ function Ze(e) {
6785
6785
  family: "animal",
6786
6786
  summary: e.summary,
6787
6787
  rig: c,
6788
- actions: { ...r0(e, l), ...e.actions?.(l) },
6788
+ actions: { ...i0(e, l), ...e.actions?.(l) },
6789
6789
  acting: Xr,
6790
6790
  colors: { body: o.coat, ink: "#26262b" },
6791
6791
  follow: [
6792
6792
  { control: "tail", of: "x", per: 0.6, stiffness: 90, damping: 6, limit: 40 },
6793
6793
  { control: "ears", of: "x", per: 1.4, stiffness: 150, damping: 8, limit: 45 }
6794
6794
  ],
6795
- moves: t0(e, n)
6795
+ moves: n0(e, n)
6796
6796
  };
6797
6797
  }
6798
- function t0(e, t) {
6798
+ function n0(e, t) {
6799
6799
  const o = (a) => {
6800
6800
  const r = An(t, a);
6801
6801
  return {
@@ -6808,7 +6808,7 @@ function t0(e, t) {
6808
6808
  return e.gaits.includes("gallop") && !n.gallop && (n.gallop = o("gallop")), n;
6809
6809
  }
6810
6810
  const Ee = Array.from({ length: 7 }, (e, t) => t === 0 ? "tail" : `tail-${t}`);
6811
- function o0(e, t, o) {
6811
+ function s0(e, t, o) {
6812
6812
  const n = yr(e.tail.points, Ee.length + 1), [, a, r] = e.body.radii, s = (e.tail.at[1] - o) / a, i = Math.abs(s) < 1 ? -r * Math.sqrt(1 - s * s) : e.tail.at[2], h = [e.tail.at[0], e.tail.at[1], i + Math.min(0.04, r * 0.08)], c = (u) => e.tail.radius * (1 - 0.5 * u / Ee.length), l = Ee.map((u, p) => {
6813
6813
  const g = n[p], b = n[p + 1], T = [b[0] - g[0], b[1] - g[1], b[2] - g[2]], H = p === 0 ? void 0 : n[p - 1];
6814
6814
  return {
@@ -6831,7 +6831,7 @@ function o0(e, t, o) {
6831
6831
  solidOnly: !0
6832
6832
  }), l;
6833
6833
  }
6834
- function n0(e, t, o) {
6834
+ function r0(e, t, o) {
6835
6835
  const n = Math.max(0, Math.min(1, e.walking ?? 0));
6836
6836
  if (n === 0) return {};
6837
6837
  const a = _t[Math.max(0, Math.min(3, Math.round(e.gait ?? 0)))], r = po[t.gaits.includes(a) ? a : t.gaits[0]], s = e.walk ?? 0, i = {};
@@ -6864,8 +6864,8 @@ const Xr = {
6864
6864
  eyes: [],
6865
6865
  headTurns: {},
6866
6866
  drift: []
6867
- }, hf = Xr;
6868
- function s0(e) {
6867
+ }, df = Xr;
6868
+ function a0(e) {
6869
6869
  const t = (e.upper + e.lower) * 0.32, o = Math.asin(Math.min(1, t / (e.upper + e.lower + e.foot))) / ze, n = {
6870
6870
  pitch: 0,
6871
6871
  lift: t - e.legLength,
@@ -6882,7 +6882,7 @@ function s0(e) {
6882
6882
  n[`${a}.swing`] = 70, n[`${a}.knee`] = -155, n[`${a}.ankle`] = 85;
6883
6883
  return n;
6884
6884
  }
6885
- function r0(e, t) {
6885
+ function i0(e, t) {
6886
6886
  const o = e.cycleScale ?? 1, n = (s) => ({
6887
6887
  summary: {
6888
6888
  walk: "Walks to `to` (four beats), its head bobbing.",
@@ -6928,7 +6928,7 @@ function r0(e, t) {
6928
6928
  summary: "Lies down for `for` ms (default 2000), head up and front paws forward (sinking back onto its haunches first), then gets up.",
6929
6929
  uses: ["for"],
6930
6930
  run(s, i, h) {
6931
- const c = s0(t), l = { ...Ws(t) }, d = h + 400, f = d + 450;
6931
+ const c = a0(t), l = { ...Ws(t) }, d = h + 400, f = d + 450;
6932
6932
  s.key(d, l, { act: !1, easing: "ease-in-out" }), s.key(f, c, { act: !1, easing: "ease-in-out" }), s.key(f + (i.for ?? 2e3), c, { act: !1 });
6933
6933
  const u = f + (i.for ?? 2e3) + 600, p = {};
6934
6934
  for (const g of /* @__PURE__ */ new Set([...Object.keys(c), ...Object.keys(l)])) p[g] = 0;
@@ -6974,7 +6974,7 @@ function r0(e, t) {
6974
6974
  }
6975
6975
  }), r;
6976
6976
  }
6977
- function a0(e = {}) {
6977
+ function l0(e = {}) {
6978
6978
  return Ze({
6979
6979
  kind: e.kind ?? "horse",
6980
6980
  summary: e.summary ?? "A cartoon horse: walks, trots, canters and gallops with its hooves in step with the ground, rears, bucks, neighs, grazes and swishes its tail.",
@@ -7014,7 +7014,7 @@ function a0(e = {}) {
7014
7014
  })
7015
7015
  });
7016
7016
  }
7017
- function i0(e = {}) {
7017
+ function h0(e = {}) {
7018
7018
  return Ze({
7019
7019
  kind: e.kind ?? "dog",
7020
7020
  summary: e.summary ?? "A cartoon dog: walks, trots and runs, barks, wags its tail, sits, jumps, sniffs the ground.",
@@ -7056,7 +7056,7 @@ function i0(e = {}) {
7056
7056
  })
7057
7057
  });
7058
7058
  }
7059
- function l0(e = {}) {
7059
+ function c0(e = {}) {
7060
7060
  return Ze({
7061
7061
  kind: e.kind ?? "cat",
7062
7062
  summary: e.summary ?? "A cartoon cat: walks, trots and runs, meows, arches its back, pounces, sits and swishes its tail.",
@@ -7101,7 +7101,7 @@ function l0(e = {}) {
7101
7101
  })
7102
7102
  });
7103
7103
  }
7104
- function h0(e = {}) {
7104
+ function d0(e = {}) {
7105
7105
  return Ze({
7106
7106
  kind: e.kind ?? "cow",
7107
7107
  summary: e.summary ?? "A cartoon cow: walks and trots, moos, grazes, sits and swishes its tail.",
@@ -7128,10 +7128,10 @@ function h0(e = {}) {
7128
7128
  grazes: !0
7129
7129
  });
7130
7130
  }
7131
- function cf(e) {
7131
+ function ff(e) {
7132
7132
  return An(1, e);
7133
7133
  }
7134
- function c0(e = {}) {
7134
+ function f0(e = {}) {
7135
7135
  return Ze({
7136
7136
  kind: e.kind ?? "goat",
7137
7137
  summary: e.summary ?? "A goat: walks, trots and gallops, bleats, grazes, sits, lies, jumps, and swishes its stubby tail.",
@@ -7157,7 +7157,7 @@ function c0(e = {}) {
7157
7157
  grazes: !0
7158
7158
  });
7159
7159
  }
7160
- function d0(e = {}) {
7160
+ function u0(e = {}) {
7161
7161
  return Ze({
7162
7162
  kind: e.kind ?? "rabbit",
7163
7163
  summary: e.summary ?? "A rabbit: walks and hops (gallop), squeaks, nibbles the ground (graze), sits, lies and jumps; long ears and a puff of a tail.",
@@ -7178,7 +7178,7 @@ function d0(e = {}) {
7178
7178
  grazes: !0
7179
7179
  });
7180
7180
  }
7181
- function f0(e = {}) {
7181
+ function g0(e = {}) {
7182
7182
  return Ze({
7183
7183
  kind: e.kind ?? "squirrel",
7184
7184
  summary: e.summary ?? "A squirrel: scampers (gallop) and walks, chatters, sits up, nibbles (graze), with a bushy tail curled over its back.",
@@ -7198,7 +7198,7 @@ function f0(e = {}) {
7198
7198
  grazes: !0
7199
7199
  });
7200
7200
  }
7201
- const Ne = 0.6, Vr = 75, Ro = 80;
7201
+ const Ce = 0.6, Vr = 75, Ro = 80;
7202
7202
  function Qe(e) {
7203
7203
  const { colors: t } = e, [o, n, a] = e.body.radii, r = (e.tail.raised ?? 15) * Math.PI / 180, s = e.tail.length * 0.4, i = [
7204
7204
  { id: "body", shape: { type: "ellipsoid", radii: e.body.radii, segments: 16 }, at: [0, e.body.height, 0], fill: t.body },
@@ -7240,8 +7240,8 @@ function Qe(e) {
7240
7240
  }), i.push({
7241
7241
  id: `wing-${d}-blade`,
7242
7242
  parent: `wing-${d}`,
7243
- shape: { type: "ellipsoid", radii: [e.wing.span * Ne / 2, e.wing.chord * 0.1, e.wing.chord / 2], segments: 12 },
7244
- at: [l * e.wing.span * Ne / 2, 0, -e.wing.chord * 0.1],
7243
+ shape: { type: "ellipsoid", radii: [e.wing.span * Ce / 2, e.wing.chord * 0.1, e.wing.chord / 2], segments: 12 },
7244
+ at: [l * e.wing.span * Ce / 2, 0, -e.wing.chord * 0.1],
7245
7245
  // Folded, the blade is rolled about its length so it lies flat against the body's side.
7246
7246
  rotate: [-Ro, 0, 0],
7247
7247
  fill: t.wing,
@@ -7249,8 +7249,8 @@ function Qe(e) {
7249
7249
  }), i.push({
7250
7250
  id: `wing-${d}-tip`,
7251
7251
  parent: `wing-${d}-blade`,
7252
- shape: { type: "ellipsoid", radii: [e.wing.span * Ne / 2.4, e.wing.chord * 0.06, e.wing.chord * 0.3], segments: 10 },
7253
- at: [l * e.wing.span * Ne / 4, 0, -e.wing.chord * 0.3],
7252
+ shape: { type: "ellipsoid", radii: [e.wing.span * Ce / 2.4, e.wing.chord * 0.06, e.wing.chord * 0.3], segments: 10 },
7253
+ at: [l * e.wing.span * Ce / 4, 0, -e.wing.chord * 0.3],
7254
7254
  rotate: [0, l * 14, 0],
7255
7255
  fill: t.wing,
7256
7256
  outline: 0.8
@@ -7265,8 +7265,8 @@ function Qe(e) {
7265
7265
  bind: [
7266
7266
  { parts: ["wing-left"], rotate: { axis: "y", degrees: -90 } },
7267
7267
  { parts: ["wing-right"], rotate: { axis: "y", degrees: 90 } },
7268
- { parts: ["wing-left-blade"], translate: [e.wing.span * (1 - Ne) / 2, 0, 0], rotate: { axis: "x", degrees: Ro }, scale: [1 / Ne, 1, 1] },
7269
- { parts: ["wing-right-blade"], translate: [-e.wing.span * (1 - Ne) / 2, 0, 0], rotate: { axis: "x", degrees: Ro }, scale: [1 / Ne, 1, 1] }
7268
+ { parts: ["wing-left-blade"], translate: [e.wing.span * (1 - Ce) / 2, 0, 0], rotate: { axis: "x", degrees: Ro }, scale: [1 / Ce, 1, 1] },
7269
+ { parts: ["wing-right-blade"], translate: [-e.wing.span * (1 - Ce) / 2, 0, 0], rotate: { axis: "x", degrees: Ro }, scale: [1 / Ce, 1, 1] }
7270
7270
  ]
7271
7271
  },
7272
7272
  flap: {
@@ -7318,24 +7318,24 @@ function Qe(e) {
7318
7318
  family: "bird",
7319
7319
  summary: e.summary,
7320
7320
  rig: c,
7321
- actions: p0(e),
7322
- acting: g0,
7321
+ actions: y0(e),
7322
+ acting: m0,
7323
7323
  colors: { body: t.body, ink: "#26262b" },
7324
- moves: u0(e)
7324
+ moves: p0(e)
7325
7325
  };
7326
7326
  }
7327
- function u0(e) {
7327
+ function p0(e) {
7328
7328
  const t = e.legs.length * 1.2, o = { walk: { speed: t / 0.42, hold: { stepping: 1 }, perMetre: { step: 0.5 / t } } };
7329
7329
  return e.flies !== !1 && (o.fly = { speed: 4 + e.wing.span * 12, flies: !0, hold: { flapping: 1, spread: 1 }, perSecond: { wingbeat: e.beatsPerSecond ?? 4 } }), o;
7330
7330
  }
7331
- const g0 = {
7331
+ const m0 = {
7332
7332
  depth: { turn: 0, lift: 0, pitch: 1, roll: 1, squash: 1, spread: 1, flap: 2, peck: 2 },
7333
7333
  limits: { pitch: 6, roll: 6, squash: 0.06, peck: 8, flap: 10, lift: 0 },
7334
7334
  eyes: [],
7335
7335
  headTurns: {},
7336
7336
  drift: []
7337
7337
  };
7338
- function p0(e) {
7338
+ function y0(e) {
7339
7339
  const t = (e.beatsPerSecond ?? 4) / 1e3, o = (s, i, h) => {
7340
7340
  const c = s.values.wingbeat ?? 0;
7341
7341
  s.set("wingbeat", i, c), s.set("wingbeat", h, c + (h - i) * t);
@@ -7431,7 +7431,7 @@ function p0(e) {
7431
7431
  }
7432
7432
  }, r;
7433
7433
  }
7434
- function m0(e = {}) {
7434
+ function b0(e = {}) {
7435
7435
  return Qe({
7436
7436
  kind: "songbird",
7437
7437
  summary: "A small songbird: hops, pecks, tweets, flaps, flies and lands (on the ground, a branch or a roof).",
@@ -7446,7 +7446,7 @@ function m0(e = {}) {
7446
7446
  beatsPerSecond: 9
7447
7447
  });
7448
7448
  }
7449
- function y0(e = {}) {
7449
+ function w0(e = {}) {
7450
7450
  return Qe({
7451
7451
  kind: "crow",
7452
7452
  summary: "A crow: walks and hops, pecks, caws, flaps, flies and lands (on the ground, a branch or a roof).",
@@ -7461,7 +7461,7 @@ function y0(e = {}) {
7461
7461
  beatsPerSecond: 4
7462
7462
  });
7463
7463
  }
7464
- function b0(e = {}) {
7464
+ function k0(e = {}) {
7465
7465
  return Qe({
7466
7466
  kind: "chicken",
7467
7467
  summary: "A chicken: walks with a bobbing head, pecks, clucks, and flutters up and down (it cannot really fly).",
@@ -7479,7 +7479,7 @@ function b0(e = {}) {
7479
7479
  flies: !1
7480
7480
  });
7481
7481
  }
7482
- function w0(e = {}) {
7482
+ function v0(e = {}) {
7483
7483
  return Qe({
7484
7484
  kind: "pigeon",
7485
7485
  summary: "A pigeon: walks with a bobbing head, pecks at crumbs, coos, flaps, flies and lands (on the ground, a ledge or a branch).",
@@ -7495,7 +7495,7 @@ function w0(e = {}) {
7495
7495
  stoop: 16
7496
7496
  });
7497
7497
  }
7498
- function k0(e = {}) {
7498
+ function S0(e = {}) {
7499
7499
  return Qe({
7500
7500
  kind: "duck",
7501
7501
  summary: "A duck: waddles, dabbles with its bill (peck), quacks, flaps, flies and lands (on the ground or the water’s edge).",
@@ -7512,7 +7512,7 @@ function k0(e = {}) {
7512
7512
  neckReach: 0.04
7513
7513
  });
7514
7514
  }
7515
- function v0(e = {}) {
7515
+ function M0(e = {}) {
7516
7516
  return Qe({
7517
7517
  kind: "owl",
7518
7518
  summary: "An owl: a big round head, slow silent wingbeats; hoots, turns its head, flies and lands on a branch.",
@@ -7528,7 +7528,7 @@ function v0(e = {}) {
7528
7528
  stoop: 6
7529
7529
  });
7530
7530
  }
7531
- function S0(e = {}) {
7531
+ function $0(e = {}) {
7532
7532
  return Qe({
7533
7533
  kind: "parrot",
7534
7534
  summary: "A parrot: bright, with a big hooked beak and a long tail; squawks, bobs, flies and lands on a perch, gripping it.",
@@ -7544,13 +7544,13 @@ function S0(e = {}) {
7544
7544
  stoop: 10
7545
7545
  });
7546
7546
  }
7547
- const Ht = { car: Mc, truck: $c, bus: Ec, tractor: Ac, cart: Tc, trainCar: Pc, bike: Oc, motorbike: Hc, tree: Ic, house: _c, chair: Cc, desk: zc, bed: Fc, door: qc, wheelchair: Yc, helicopter: Vc, airplane: Zc, horse: a0, dog: i0, cat: l0, cow: h0, goat: c0, rabbit: d0, squirrel: f0, songbird: m0, crow: y0, chicken: b0, pigeon: w0, duck: k0, owl: v0, parrot: S0 };
7547
+ const Ht = { car: Ec, truck: Ac, bus: Tc, tractor: Pc, cart: Oc, trainCar: Hc, bike: Ic, motorbike: xc, tree: jc, house: Cc, chair: Wc, desk: Fc, bed: qc, door: Gc, wheelchair: Xc, helicopter: Zc, airplane: e0, horse: l0, dog: h0, cat: c0, cow: d0, goat: f0, rabbit: u0, squirrel: g0, songbird: b0, crow: w0, chicken: k0, pigeon: v0, duck: S0, owl: M0, parrot: $0 };
7548
7548
  function Jr(e, t = {}) {
7549
7549
  const o = Ht[e];
7550
7550
  if (!o) throw new Error(fe("prop preset", e, Object.keys(Ht)));
7551
7551
  return o(t);
7552
7552
  }
7553
- const en = ["do", "at", "for", "to", "toward", "speed", "open", "on", "height", "wind"], tn = { viewer: 0, right: 1, away: 2, left: 3 }, M0 = 420, Zr = {
7553
+ const en = ["do", "at", "for", "to", "toward", "speed", "open", "on", "height", "wind"], tn = { viewer: 0, right: 1, away: 2, left: 3 }, E0 = 420, Zr = {
7554
7554
  hold: {
7555
7555
  summary: "Holds still (`for` ms, default 1000).",
7556
7556
  run: (e, t, o) => ({ end: o + (t.for ?? 1e3) })
@@ -7581,7 +7581,7 @@ function Tn(e) {
7581
7581
  return { ...Zr, ...e.actions };
7582
7582
  }
7583
7583
  const Wo = (e) => typeof e == "number" && Number.isFinite(e);
7584
- function $0(e, t) {
7584
+ function A0(e, t) {
7585
7585
  if (!Array.isArray(e)) return [{ level: "error", beat: -1, message: `Beats must be an array of { do: … } objects (got ${typeof e}).` }];
7586
7586
  const o = Tn(t), n = Object.keys(o), a = [];
7587
7587
  return e.forEach((r, s) => {
@@ -7602,8 +7602,8 @@ function $0(e, t) {
7602
7602
  h[c] !== void 0 && typeof h[c] != "boolean" && i(`\`${c}\` is true or false (got ${JSON.stringify(h[c])}).`);
7603
7603
  }), a;
7604
7604
  }
7605
- function E0(e, t, o, n = {}) {
7606
- const a = $0(o, t).filter((v) => v.level === "error");
7605
+ function T0(e, t, o, n = {}) {
7606
+ const a = A0(o, t).filter((v) => v.level === "error");
7607
7607
  if (a.length > 0) throw new Error(`propScript (${t.kind}): ${a.length} problem(s) in the beats:
7608
7608
  ${a.map((v) => ` beat ${v.beat}: ${v.message}`).join(`
7609
7609
  `)}`);
@@ -7644,7 +7644,7 @@ ${a.map((v) => ` beat ${v.beat}: ${v.message}`).join(`
7644
7644
  turnTo(v, w) {
7645
7645
  const E = typeof w == "number" ? w : tn[w], O = l.turn, x = [E - 4, E, E + 4].map((G) => ({ t: G, d: Math.abs(G - O) })).sort((G, Y) => G.d - Y.d || Math.abs(G.t) - Math.abs(Y.t))[0];
7646
7646
  if (x.d < 1e-3) return v;
7647
- const W = v + M0 * Math.max(1, x.d);
7647
+ const W = v + E0 * Math.max(1, x.d);
7648
7648
  return H.key(W, { turn: x.t }), W;
7649
7649
  },
7650
7650
  effect(v) {
@@ -7661,12 +7661,12 @@ ${a.map((v) => ` beat ${v.beat}: ${v.message}`).join(`
7661
7661
  const w = Math.max(v.at ?? m, d[d.length - 1].time), E = c[v.do].run(H, v, w);
7662
7662
  E.end > d[d.length - 1].time && d.push({ time: E.end, pose: { ...l } }), M.push({ start: w, end: E.end, ...E.contact !== void 0 ? { contact: E.contact } : {}, ...E.release !== void 0 ? { release: E.release } : {} }), m = E.end;
7663
7663
  }
7664
- const P = Hr(n.style ?? "snappy"), A = { ...P, anticipation: P.anticipation * h, overshoot: P.overshoot * h }, k = kn(O0(d), t.acting, { style: A }), y = [
7664
+ const P = Hr(n.style ?? "snappy"), A = { ...P, anticipation: P.anticipation * h, overshoot: P.overshoot * h }, k = kn(I0(d), t.acting, { style: A }), y = [
7665
7665
  // Controls keyed exactly (wheels, rotors) are not acted.
7666
7666
  ...Object.entries(k).filter(([v]) => !f.has(v)).map(([v, w]) => ({ id: `${e}-${v}`, target: e, property: v, keyframes: w })),
7667
- ...[...f].map(([v, w]) => ({ id: `${e}-${v}`, target: e, property: v, keyframes: H0(w) }))
7667
+ ...[...f].map(([v, w]) => ({ id: `${e}-${v}`, target: e, property: v, keyframes: x0(w) }))
7668
7668
  ];
7669
- for (const v of T0(e, t, y, m, d[0].pose)) {
7669
+ for (const v of O0(e, t, y, m, d[0].pose)) {
7670
7670
  const w = y.findIndex((j) => j.property === v.property);
7671
7671
  if (w < 0) {
7672
7672
  y.push(v);
@@ -7677,37 +7677,37 @@ ${a.map((v) => ` beat ${v.beat}: ${v.message}`).join(`
7677
7677
  }
7678
7678
  return { tracks: y, duration: m, beats: M, effects: u };
7679
7679
  }
7680
- const A0 = 1500;
7681
- function T0(e, t, o, n, a) {
7680
+ const P0 = 1500;
7681
+ function O0(e, t, o, n, a) {
7682
7682
  if (!t.follow?.length) return [];
7683
7683
  const r = new ve({ id: `${e}-follow`, tracks: o.filter((i) => i.property === "turn" || t.follow.some((h) => h.of === i.property)) }), s = (i, h) => {
7684
7684
  const c = r.getStateAtTime(i).values.get(e)?.get(h);
7685
7685
  return typeof c == "number" ? c : a[h] ?? 0;
7686
7686
  };
7687
7687
  return t.follow.map((i) => {
7688
- const h = n + A0, c = Bt((f) => s(f, i.of), { start: 0, end: h, stiffness: i.stiffness, damping: i.damping }), l = i.limit ?? 1 / 0, d = c.map(({ time: f, value: u }) => {
7688
+ const h = n + P0, c = Bt((f) => s(f, i.of), { start: 0, end: h, stiffness: i.stiffness, damping: i.damping }), l = i.limit ?? 1 / 0, d = c.map(({ time: f, value: u }) => {
7689
7689
  const p = Math.sin(s(f, "turn") * Math.PI / 2), g = (u - s(f, i.of)) * p;
7690
7690
  return { time: f, value: Math.max(-l, Math.min(l, g * i.per)) };
7691
7691
  });
7692
7692
  return { id: `${e}-${i.control}`, target: e, property: i.control, keyframes: d };
7693
7693
  });
7694
7694
  }
7695
- const P0 = 20;
7696
- function O0(e) {
7695
+ const H0 = 20;
7696
+ function I0(e) {
7697
7697
  const t = [...e].sort((n, a) => n.time - a.time), o = [];
7698
7698
  for (const n of t) {
7699
7699
  const a = o[o.length - 1];
7700
- a && n.time - a.time < P0 ? o[o.length - 1] = { ...n, time: a.time } : o.push(n);
7700
+ a && n.time - a.time < H0 ? o[o.length - 1] = { ...n, time: a.time } : o.push(n);
7701
7701
  }
7702
7702
  return o;
7703
7703
  }
7704
- function H0(e) {
7704
+ function x0(e) {
7705
7705
  const t = e.map((n, a) => ({ k: n, i: a })).sort((n, a) => n.k.time - a.k.time || n.i - a.i), o = [];
7706
7706
  for (const { k: n } of t)
7707
7707
  o.length > 0 && o[o.length - 1].time === n.time ? o[o.length - 1] = n : o.push(n);
7708
7708
  return o;
7709
7709
  }
7710
- const I0 = {
7710
+ const j0 = {
7711
7711
  linear: !0,
7712
7712
  "ease-in": !0,
7713
7713
  "ease-out": !0,
@@ -7719,18 +7719,18 @@ const I0 = {
7719
7719
  "ease-out-cubic": !0,
7720
7720
  "ease-in-out-cubic": !0
7721
7721
  };
7722
- function x0(e, t = {}) {
7722
+ function _0(e, t = {}) {
7723
7723
  const o = {};
7724
7724
  for (const n of Object.keys(Ke)) o[n] = { summary: `Walks to \`to\` in the ${n} gait.`, needs: ["to"] };
7725
7725
  for (const n of Object.keys(Ae)) o[n] = { summary: `Moves into the ${n} pose and holds it (\`for\` ms).` };
7726
7726
  for (const n of Object.keys(Ve)) o[n] = { summary: `The ${n} gag (${so(n)} ms).` };
7727
7727
  for (const [n, a] of Object.entries(go)) o[n] = { ...a };
7728
7728
  return {
7729
- sports: { cricket: { actions: { ...Pa }, formats: { ...Ta }, casts: { ...Aa }, fieldingPositions: { ...Ea }, markingProfiles: { ...$a }, cameras: { ...Ma }, playComponents: Sa, playExamples: va } },
7729
+ sports: { cricket: { actions: { ...Oa }, formats: { ...Pa }, casts: { ...Ta }, fieldingPositions: { ...Aa }, markingProfiles: { ...Ea }, cameras: { ...$a }, decisionCameras: Ma, playComponents: Sa, playExamples: va } },
7730
7730
  ...e ? { version: e } : {},
7731
7731
  timing: "JSON timelines and tracks are in milliseconds; the GSAP-style API (live.to, tf.timeline) takes seconds. Scene x grows right, y grows down, in px.",
7732
7732
  easings: {
7733
- named: Object.keys(I0),
7733
+ named: Object.keys(j0),
7734
7734
  parametric: {
7735
7735
  "cubic-bezier": '{ type: "cubic-bezier", points: [x1, y1, x2, y2] }',
7736
7736
  steps: '{ type: "steps", count, position?: start | end | none | both }',
@@ -7746,7 +7746,7 @@ function x0(e, t = {}) {
7746
7746
  motionPath: '{ property: "motionPath", path, align? }: moves along an SVG path',
7747
7747
  text: '{ property: "text", … }: types or scrambles text'
7748
7748
  },
7749
- canvasProperties: Ra,
7749
+ canvasProperties: za,
7750
7750
  stickFigure: {
7751
7751
  poseFields: ka,
7752
7752
  props: wa,
@@ -7819,6 +7819,8 @@ function x0(e, t = {}) {
7819
7819
  figureStyles: ["fluid", "stick", "organic"],
7820
7820
  body: {
7821
7821
  "body.torso · body.arm · body.leg · body.neck": "Organic half-width profiles: [{ at: 0..1, width: fractionOfHeight }], increasing from 0 to 1; independent of ink width.",
7822
+ "body.measurements": `Organic torso from tape-measure girths { height, bust, underbust?, waist, hip } in any one unit, or a named shape (${Object.keys(Na).join(" | ")}). Sets the front width, the side depth (bust forward, seat back, belly) and the hip and thigh spacing; reads correctly at every turn. An explicit torso / torsoFront / torsoBack / hipWidth still wins.`,
7823
+ "body.torsoFront · body.torsoBack": "Organic side-view depth from the spine line toward the chest/belly and toward the back/seat, same profile format; default torso × depth.",
7822
7824
  "body.fill · body.outline · body.shading": "Shared skin fill, outline { color, width }, cel material { mode: cel | none, light: [x,y], shadow, opacity, highlight }.",
7823
7825
  "softCartoonCharacter(name, options?)": "Original youngMan / youngWoman / childBoy / childGirl story presets. Children have larger head proportions, shorter limbs and rounded torsos; every face, hair, build, hand, clothing and material option can be overridden.",
7824
7826
  "face.projection": "Organic default volume follows the head axes, keeps both eyes in three-quarter views and projects a small nose above the mouth; opaque hair covers features. cartoon keeps the classic face slide.",
@@ -7827,19 +7829,19 @@ function x0(e, t = {}) {
7827
7829
  },
7828
7830
  poses: Object.keys(_e),
7829
7831
  dances: Object.keys(ft),
7830
- expressions: Object.keys(Ka),
7832
+ expressions: Object.keys(Ca),
7831
7833
  faceStyles: ["simple", "anime"],
7832
7834
  faceShapes: ["round", "angular"],
7833
7835
  gags: Object.keys(Xs),
7834
- builds: Object.keys(_a),
7835
- hair: Object.keys(ja),
7836
+ builds: Object.keys(Ka),
7837
+ hair: Object.keys(_a),
7836
7838
  hairColors: { ...xe },
7837
- facialHair: Object.keys(xa),
7838
- glasses: Object.keys(Ia),
7839
- hats: Object.keys(Ha),
7839
+ facialHair: Object.keys(ja),
7840
+ glasses: Object.keys(xa),
7841
+ hats: Object.keys(Ia),
7840
7842
  feet: [...ya],
7841
7843
  cast: Object.keys(Or),
7842
- heldItems: Object.fromEntries(Object.entries(Oa).map(([n, a]) => [n, a.hands])),
7844
+ heldItems: Object.fromEntries(Object.entries(Ha).map(([n, a]) => [n, a.hands])),
7843
7845
  handMeetings: Object.keys(no)
7844
7846
  },
7845
7847
  codePanel: {
@@ -7854,7 +7856,7 @@ function x0(e, t = {}) {
7854
7856
  },
7855
7857
  edits: Pr
7856
7858
  },
7857
- surfaces: { code: Gt, board: Ce, chart: st, prop: Mt },
7859
+ surfaces: { code: Gt, board: Ne, chart: st, prop: Mt },
7858
7860
  surfaceScript: {
7859
7861
  "surfaceScript(figureId, { name: surface }, beats, options)": "compiles beats that act on surfaces: returns the script result with `tracks` (the figure’s, ridden, then every surface’s, keyed by its name) and `figureTracks`; options are scriptTracks’ plus `figureStyle` (for carry) and `ride` (default true)",
7860
7862
  "checkSurfaceBeats(beats, surfaces, cast?)": "every problem checkBeats finds, plus unknown surfaces, places, edits and moments, with suggestions",
@@ -7884,8 +7886,8 @@ function x0(e, t = {}) {
7884
7886
  }
7885
7887
  const ue = (e) => e.map((t) => `\`${t}\``).join(", "), zs = (e) => Object.entries(e).map(([t, o]) => `| \`${t}\` | ${o.unit ?? o.kind ?? ""} | ${o.description} |`).join(`
7886
7888
  `);
7887
- function df(e, t = {}) {
7888
- const o = x0(e, t), n = o.stickFigure;
7889
+ function uf(e, t = {}) {
7890
+ const o = _0(e, t), n = o.stickFigure;
7889
7891
  return [
7890
7892
  `# tinyfly capabilities${o.version ? ` (v${o.version})` : ""}`,
7891
7893
  "",
@@ -8056,6 +8058,8 @@ function df(e, t = {}) {
8056
8058
  "",
8057
8059
  `Stock fielding labels (\`CRICKET_FIELDING_POSITIONS\`): ${Object.entries(o.sports.cricket.fieldingPositions).map(([r, s]) => `\`${r}\`: ${s}`).join(", ")}. Eleven fielders, two on-field batters and two umpires; nine batting teammates wait off-field. Mid-on is closer to the pitch; long-on is its deeper boundary alternative, not an extra stock fielder. For the right-handed striker, +x is off side and -x is on/leg side.`,
8058
8060
  "",
8061
+ "Decision review cameras: front-foot, striker-crease, bowler-crease. cricketCameraFraming returns owned defaults; cricketCameraReview returns a physical event without seeking. Optional cricketDecisionOverlay marks the crease reference. pitch 0–89, distance 0.5–2000, fov 10–100 before zoom, and fixed-view target customize framing. Ball-follow yaw rotates its default offset relative to 75 degrees; pitch/distance apply too. Export all camera tracks, including far for distant framing. These APIs never alter motion or rulings.",
8062
+ "",
8059
8063
  "## Camera shots (`cameraTracks(shots, { stage })`)",
8060
8064
  "",
8061
8065
  ...Object.entries(o.cameraShots).map(([r, s]) => `- **${r}**: \`${s}\``),
@@ -8071,16 +8075,16 @@ function df(e, t = {}) {
8071
8075
  ].join(`
8072
8076
  `);
8073
8077
  }
8074
- function ff(e, t, o, n = {}) {
8078
+ function gf(e, t, o, n = {}) {
8075
8079
  const a = n.color ?? "#555", r = n.size ?? 60;
8076
8080
  for (const s of t) {
8077
8081
  const i = (o - s.time) / s.length;
8078
8082
  if (i <= 0 || i >= 1) continue;
8079
8083
  const h = Fe(`${s.kind}:${s.time}:${s.x}`);
8080
- s.kind === "dust" ? rh(e, { x: s.x, y: s.y }, i, { size: r, color: a, seed: h }) : s.kind === "exhaust" ? K0(e, s, i, r, a, h) : s.kind === "skid" ? N0(e, s, i, o, a) : s.kind === "honk" ? C0(e, s, i, r, a) : s.kind === "smoke" ? j0(e, s, o, r, a) : s.kind === "leaves" && _0(e, s, i, r, n.leafColor ?? "#5cae5a", a, h);
8084
+ s.kind === "dust" ? ih(e, { x: s.x, y: s.y }, i, { size: r, color: a, seed: h }) : s.kind === "exhaust" ? N0(e, s, i, r, a, h) : s.kind === "skid" ? R0(e, s, i, o, a) : s.kind === "honk" ? W0(e, s, i, r, a) : s.kind === "smoke" ? K0(e, s, o, r, a) : s.kind === "leaves" && C0(e, s, i, r, n.leafColor ?? "#5cae5a", a, h);
8081
8085
  }
8082
8086
  }
8083
- function j0(e, t, o, n, a, r) {
8087
+ function K0(e, t, o, n, a, r) {
8084
8088
  const s = t.direction ?? 1, i = 380, h = 1500;
8085
8089
  e.save(), e.strokeStyle = a, e.lineWidth = Math.max(1, n * 0.025);
8086
8090
  for (let c = t.time; c <= t.time + t.length - h; c += i) {
@@ -8091,7 +8095,7 @@ function j0(e, t, o, n, a, r) {
8091
8095
  }
8092
8096
  e.restore();
8093
8097
  }
8094
- function _0(e, t, o, n, a, r, s) {
8098
+ function C0(e, t, o, n, a, r, s) {
8095
8099
  const i = t.direction ?? 1, h = t.toY ?? t.y + n * 3;
8096
8100
  e.save(), e.lineWidth = Math.max(1, n * 0.02), e.strokeStyle = r, e.fillStyle = a;
8097
8101
  for (let c = 0; c < 4; c++) {
@@ -8100,7 +8104,7 @@ function _0(e, t, o, n, a, r, s) {
8100
8104
  }
8101
8105
  e.restore();
8102
8106
  }
8103
- function K0(e, t, o, n, a, r) {
8107
+ function N0(e, t, o, n, a, r) {
8104
8108
  const s = t.direction ?? -1;
8105
8109
  e.save(), e.strokeStyle = a, e.lineWidth = Math.max(1, n * 0.025);
8106
8110
  for (let i = 0; i < 3; i++) {
@@ -8111,14 +8115,14 @@ function K0(e, t, o, n, a, r) {
8111
8115
  }
8112
8116
  e.restore();
8113
8117
  }
8114
- function N0(e, t, o, n, a) {
8118
+ function R0(e, t, o, n, a) {
8115
8119
  const r = t.toX ?? t.x, s = Math.min(1, (n - t.time) / t.length * 3), i = t.x + (r - t.x) * s;
8116
8120
  e.save(), e.strokeStyle = a, e.lineCap = "round", e.globalAlpha = o < 0.6 ? 0.8 : 0.8 * (1 - (o - 0.6) / 0.4), e.lineWidth = 3;
8117
8121
  for (const h of [-2, 4])
8118
8122
  e.beginPath(), e.moveTo(t.x, t.y + h), e.lineTo(i, t.y + h), e.stroke();
8119
8123
  e.restore();
8120
8124
  }
8121
- function C0(e, t, o, n, a) {
8125
+ function W0(e, t, o, n, a) {
8122
8126
  const r = t.direction ?? 1;
8123
8127
  e.save(), e.strokeStyle = a, e.lineWidth = Math.max(1.5, n * 0.04), e.lineCap = "round", e.globalAlpha = o < 0.7 ? 1 : (1 - o) / 0.3;
8124
8128
  const s = n * (0.15 + 0.5 * (1 - (1 - o) ** 2));
@@ -8128,7 +8132,7 @@ function C0(e, t, o, n, a) {
8128
8132
  }
8129
8133
  e.restore();
8130
8134
  }
8131
- function uf(e) {
8135
+ function pf(e) {
8132
8136
  const t = new ve({ id: `${e.propId}-ride`, tracks: e.propTracks.filter((l) => l.target === e.propId) }), o = e.every ?? 33, n = [], a = [], r = [], s = [];
8133
8137
  let i = 1;
8134
8138
  for (let l = e.start; ; l = Math.min(e.end, l + o)) {
@@ -8141,9 +8145,9 @@ function uf(e) {
8141
8145
  { id: `${h}-x`, target: h, property: "x", keyframes: n },
8142
8146
  { id: `${h}-y`, target: h, property: "y", keyframes: a }
8143
8147
  ];
8144
- return e.turn !== !1 && c.push({ id: `${h}-turn`, target: h, property: "turn", keyframes: r }, { id: `${h}-facing`, target: h, property: "facing", keyframes: R0(s) }), c;
8148
+ return e.turn !== !1 && c.push({ id: `${h}-turn`, target: h, property: "turn", keyframes: r }, { id: `${h}-facing`, target: h, property: "facing", keyframes: z0(s) }), c;
8145
8149
  }
8146
- function R0(e) {
8150
+ function z0(e) {
8147
8151
  const t = [];
8148
8152
  for (const o of e) {
8149
8153
  const n = t[t.length - 1];
@@ -8151,7 +8155,7 @@ function R0(e) {
8151
8155
  }
8152
8156
  return t;
8153
8157
  }
8154
- function gf(e, t, o) {
8158
+ function mf(e, t, o) {
8155
8159
  const n = (s) => `${s.target}\0${s.property}`, a = new Map(t.map((s) => [n(s), s]));
8156
8160
  return [...e.map((s) => {
8157
8161
  const i = a.get(n(s));
@@ -8161,7 +8165,7 @@ function gf(e, t, o) {
8161
8165
  return { ...s, keyframes: c };
8162
8166
  }), ...a.values()];
8163
8167
  }
8164
- function pf(e) {
8168
+ function yf(e) {
8165
8169
  const t = new ve({ id: `${e.leaderId}-tow`, tracks: e.leaderTracks.filter((u) => u.target === e.leaderId) }), o = e.every ?? 33, n = e.towed, a = n.x + n.width / 2, r = n.props, s = n.prop.wheelRadius, i = [], h = [], c = [];
8166
8170
  let l = r.wheelSpin ?? 0, d;
8167
8171
  for (let u = e.start; ; u = Math.min(e.end, u + o)) {
@@ -8182,7 +8186,7 @@ function pf(e) {
8182
8186
  ];
8183
8187
  }
8184
8188
  const Ls = /* @__PURE__ */ new WeakMap();
8185
- function W0(e, t) {
8189
+ function L0(e, t) {
8186
8190
  const o = t?.some(Boolean) ? t.map((f) => f ? 1 : 0).join("") : "";
8187
8191
  let n = Ls.get(e);
8188
8192
  n || Ls.set(e, n = /* @__PURE__ */ new Map());
@@ -8203,8 +8207,8 @@ function W0(e, t) {
8203
8207
  }), d = Vt({ positions: i, normals: l, indices: c });
8204
8208
  return n.size >= 16 && n.clear(), n.set(o, d), d;
8205
8209
  }
8206
- function z0(e, t, o = {}) {
8207
- const n = e.ink ?? o.ink ?? "#26262b", a = (o.outline ?? 2) * (e.outline ?? 1), r = e.glow && t.glow > 0 ? L0(e.glow.color, t.glow) : void 0;
8210
+ function F0(e, t, o = {}) {
8211
+ const n = e.ink ?? o.ink ?? "#26262b", a = (o.outline ?? 2) * (e.outline ?? 1), r = e.glow && t.glow > 0 ? D0(e.glow.color, t.glow) : void 0;
8208
8212
  return {
8209
8213
  // A part with no fill (a spoked wheel's wire) is drawn in its ink.
8210
8214
  color: e.fill ?? n,
@@ -8216,20 +8220,20 @@ function z0(e, t, o = {}) {
8216
8220
  ...e.seeThrough ? { opacity: 0.45 * t.opacity } : t.opacity < 1 ? { opacity: t.opacity } : {}
8217
8221
  };
8218
8222
  }
8219
- function L0(e, t) {
8223
+ function D0(e, t) {
8220
8224
  const o = /^#([0-9a-f]{6})$/i.exec(e.trim());
8221
8225
  return o ? `#${[0, 2, 4].map((a) => Math.round(parseInt(o[1].slice(a, a + 2), 16) * Math.max(0, Math.min(1, t)))).map((a) => a.toString(16).padStart(2, "0")).join("")}` : e;
8222
8226
  }
8223
- const F0 = Vt(er(1, 2e-3, 28));
8224
- function D0(e, t, o) {
8227
+ const q0 = Vt(er(1, 2e-3, 28));
8228
+ function B0(e, t, o) {
8225
8229
  const n = e.rig, [a, r] = n.footprint ?? [n.length * 0.45, n.length], s = Math.max(0, be(n, t, "lift")), i = Math.max(0, be(n, t, "size")) / (1 + s * 0.8);
8226
8230
  return {
8227
- mesh: F0,
8231
+ mesh: q0,
8228
8232
  world: ne.multiply(o, ne.compose([0, 4e-3, 0], [0, 0, 0, 1], [a * 0.55 * i || 1e-4, 1, r * 0.55 * i || 1e-4])),
8229
8233
  material: { color: "#000000", shading: "unlit", opacity: 0.16 * i }
8230
8234
  };
8231
8235
  }
8232
- const q0 = /* @__PURE__ */ new Set([
8236
+ const G0 = /* @__PURE__ */ new Set([
8233
8237
  "x",
8234
8238
  "y",
8235
8239
  "z",
@@ -8245,7 +8249,7 @@ const q0 = /* @__PURE__ */ new Set([
8245
8249
  "visible",
8246
8250
  "opacity",
8247
8251
  "color"
8248
- ]), B0 = 1, mf = {
8252
+ ]), Y0 = 1, bf = {
8249
8253
  kind: "prop",
8250
8254
  validate(e) {
8251
8255
  const t = e, o = typeof t.prop == "string" && t.prop in Ht ? [] : [fe("prop preset", t.prop, Object.keys(Ht))];
@@ -8261,7 +8265,7 @@ const q0 = /* @__PURE__ */ new Set([
8261
8265
  resolve({ object: e, prepared: t, values: o, world: n, camera: a, lights: r = [], fog: s, toScreen: i }) {
8262
8266
  const h = e, c = t, l = { ...h.values };
8263
8267
  for (const [k, y] of o)
8264
- typeof y == "number" && !q0.has(k) && (l[k] = y);
8268
+ typeof y == "number" && !G0.has(k) && (l[k] = y);
8265
8269
  l.turn = 0, l.tilt = 0;
8266
8270
  const d = ne.multiply(a.view, n), f = {
8267
8271
  toView: (k) => ne.transformPoint(d, k),
@@ -8269,37 +8273,37 @@ const q0 = /* @__PURE__ */ new Set([
8269
8273
  }, u = f.toView([0, c.rig.height / 2, 0]);
8270
8274
  if (-u[2] <= a.near) return null;
8271
8275
  if (h.look === "mesh") {
8272
- const k = fc(c.rig, l), y = k.map(({ part: E, local: O }) => ({ part: E.id, mesh: ao(E.shape), ...Mn(ao(E.shape), O) })), v = zr(y), w = k.map((E, O) => ({ ...E, hidden: Lr(E.part.id, y[O].mesh, E.local, y[O].key, v) })).filter(({ opacity: E }) => E > 0.01).map(({ part: E, matrix: O, glow: j, opacity: x, hidden: W }) => ({
8273
- mesh: W0(E.shape, W),
8276
+ const k = gc(c.rig, l), y = k.map(({ part: E, local: O }) => ({ part: E.id, mesh: ao(E.shape), ...Mn(ao(E.shape), O) })), v = zr(y), w = k.map((E, O) => ({ ...E, hidden: Lr(E.part.id, y[O].mesh, E.local, y[O].key, v) })).filter(({ opacity: E }) => E > 0.01).map(({ part: E, matrix: O, glow: j, opacity: x, hidden: W }) => ({
8277
+ mesh: L0(E.shape, W),
8274
8278
  world: ne.multiply(n, O),
8275
- material: z0(E, { glow: j, opacity: x }, { shading: h.shading, ink: h.ink, outline: h.outline })
8279
+ material: F0(E, { glow: j, opacity: x }, { shading: h.shading, ink: h.ink, outline: h.outline })
8276
8280
  }));
8277
- return { meshes: h.shadow === !1 ? w : [D0(c, l, n), ...w] };
8281
+ return { meshes: h.shadow === !1 ? w : [B0(c, l, n), ...w] };
8278
8282
  }
8279
8283
  const p = i(u), g = i(f.toView([0, c.rig.height / 2 + 1, 0])), b = Math.hypot(g.x - p.x, g.y - p.y), T = r.length === 0 ? void 0 : (k, y) => {
8280
8284
  const v = ne.transformPoint(n, k), w = [n[0] * y[0] + n[4] * y[1] + n[8] * y[2], n[1] * y[0] + n[5] * y[1] + n[9] * y[2], n[2] * y[0] + n[6] * y[1] + n[10] * y[2]], E = Math.hypot(...w) || 1;
8281
8285
  return { light: tr(v, [w[0] / E, w[1] / E, w[2] / E], r), fog: or(s, Math.hypot(v[0] - a.position[0], v[1] - a.position[1], v[2] - a.position[2])) };
8282
- }, H = Fr(c.rig, l, f, b, { perspective: !0, near: a.near, slice: B0, light: T }), M = { look: h.look, style: h.style, ink: h.ink, paper: h.paper, fog: s?.color }, m = dr(H), P = H.cells ?? [], A = Math.max(...P.map((k) => -k.depth), -u[2]);
8286
+ }, H = Fr(c.rig, l, f, b, { perspective: !0, near: a.near, slice: Y0, light: T }), M = { look: h.look, style: h.style, ink: h.ink, paper: h.paper, fog: s?.color }, m = dr(H), P = H.cells ?? [], A = Math.max(...P.map((k) => -k.depth), -u[2]);
8283
8287
  return {
8284
8288
  drawables: [
8285
8289
  ...h.shadow === !1 ? [] : [{ depth: A + c.rig.length, draw: (k) => fr(k, H, M) }],
8286
8290
  ...P.map((k) => ({
8287
8291
  depth: -k.depth,
8288
8292
  draw(y, v) {
8289
- y.lineCap = "round", y.lineJoin = "round", Ei(y, k.parts, m, { ...M, time: v.time });
8293
+ y.lineCap = "round", y.lineJoin = "round", Ti(y, k.parts, m, { ...M, time: v.time });
8290
8294
  }
8291
8295
  }))
8292
8296
  ]
8293
8297
  };
8294
8298
  }
8295
- }, Fs = ["do", "at", "for", "to", "through", "toward", "speed", "height", "open", "on", "wind"], G0 = 0.25, Y0 = 800 / 180, U0 = 220, X0 = 300, V0 = ["turn"];
8296
- function J0(e) {
8299
+ }, Fs = ["do", "at", "for", "to", "through", "toward", "speed", "height", "open", "on", "wind"], U0 = 0.25, X0 = 800 / 180, V0 = 220, J0 = 300, Z0 = ["turn"];
8300
+ function Q0(e) {
8297
8301
  const t = Tn(e), o = Object.keys(e.moves ?? {});
8298
- return Object.keys(t).filter((n) => !o.includes(n) && !V0.includes(n) && !(t[n].needs ?? []).includes("to"));
8302
+ return Object.keys(t).filter((n) => !o.includes(n) && !Z0.includes(n) && !(t[n].needs ?? []).includes("to"));
8299
8303
  }
8300
- function Z0(e, t) {
8304
+ function ed(e, t) {
8301
8305
  if (!Array.isArray(e)) return [{ beat: -1, message: `Beats must be an array of { do: … } objects (got ${typeof e}).` }];
8302
- const o = Object.keys(t.moves ?? {}), n = J0(t), a = [...o, "face", "hold", ...n.filter((s) => s !== "hold")], r = [];
8306
+ const o = Object.keys(t.moves ?? {}), n = Q0(t), a = [...o, "face", "hold", ...n.filter((s) => s !== "hold")], r = [];
8303
8307
  return e.forEach((s, i) => {
8304
8308
  const h = (d) => r.push({ beat: i, message: d });
8305
8309
  if (!s || typeof s != "object" || Array.isArray(s)) return h(`Each beat must be an object like { do: '${a[0] ?? "hold"}' }.`);
@@ -8312,8 +8316,8 @@ function Z0(e, t) {
8312
8316
  o.includes(c.do) && (c.to === void 0 && c.through === void 0 && h(`\`${c.do}\` needs \`to\` ([x, z] metres) or \`through\` (a list of them).`), c.to !== void 0 && !Ge(c.to) && h(`\`to\` is a point on the ground, [x, z] metres (got ${JSON.stringify(c.to)}).`), c.through !== void 0 && !(Array.isArray(c.through) && c.through.length > 0 && c.through.every(Ge)) && h("`through` is a list of points on the ground, each [x, z] metres.")), c.do === "face" && !(Ge(c.toward) || typeof c.toward == "number") && h("`face` needs `toward`: a point [x, z] or a heading in degrees.");
8313
8317
  }), r;
8314
8318
  }
8315
- function yf(e, t, o, n) {
8316
- const a = Z0(o, t);
8319
+ function wf(e, t, o, n) {
8320
+ const a = ed(o, t);
8317
8321
  if (a.length > 0) throw new Error(`propScript3D (${t.kind}): ${a.length} problem(s) in the beats:
8318
8322
  ${a.map((M) => ` beat ${M.beat}: ${M.message}`).join(`
8319
8323
  `)}`);
@@ -8328,12 +8332,12 @@ ${a.map((M) => ` beat ${M.beat}: ${M.message}`).join(`
8328
8332
  const f = (M, m) => {
8329
8333
  const P = to(h, m);
8330
8334
  if (Math.abs(P) < 1) return M;
8331
- const A = Math.max(U0, Math.abs(P) * Y0);
8335
+ const A = Math.max(V0, Math.abs(P) * X0);
8332
8336
  return d("rotateY", M, h), h += P, l("rotateY", M + A, h, "ease-in-out"), M + A;
8333
8337
  }, u = (M, m, P) => {
8334
8338
  const A = wr([[s, i], ...m.through ?? [m.to]]);
8335
8339
  if (A.length < 2) return P;
8336
- const k = f(P, lt(A[0].point, A[1].point)), y = A[A.length - 1].at, v = m.for ?? y / (m.speed ?? M.speed) * 1e3, w = mt("ease-in-out"), E = Math.min(X0, v / 4);
8340
+ const k = f(P, lt(A[0].point, A[1].point)), y = A[A.length - 1].at, v = m.for ?? y / (m.speed ?? M.speed) * 1e3, w = mt("ease-in-out"), E = Math.min(J0, v / 4);
8337
8341
  for (const [Y, oe] of Object.entries(M.set ?? {}))
8338
8342
  d(Y, k, r[Y]), l(Y, k + 1, oe), r[Y] = oe;
8339
8343
  const O = M.flies ? m.height ?? (r.lift > 0.05 ? r.lift : 2) : void 0, j = O !== void 0 && O > 0.05;
@@ -8342,20 +8346,20 @@ ${a.map((M) => ` beat ${M.beat}: ${M.message}`).join(`
8342
8346
  O !== void 0 && (d("lift", k, r.lift), l("lift", k + Math.min(v * 0.35, 1400), O, "ease-out"), l("lift", k + v, O), r.lift = O);
8343
8347
  const x = { ...r };
8344
8348
  let W = h;
8345
- for (let Y = 0; ; Y = Math.min(y, Y + G0)) {
8349
+ for (let Y = 0; ; Y = Math.min(y, Y + U0)) {
8346
8350
  const oe = k + vr(w, Y / y) * v, { point: q, direction: I } = kr(A, Y);
8347
8351
  W += to(W, lt([0, 0], I)), l("x", oe, q[0]), l("z", oe, q[1]), l("rotateY", oe, W);
8348
- for (const [N, C] of Object.entries(M.perMetre ?? {})) l(N, oe, x[N] + Y * C);
8349
- for (const [N, C] of Object.entries(M.perSecond ?? {})) l(N, oe, x[N] + (oe - k) / 1e3 * C);
8352
+ for (const [C, N] of Object.entries(M.perMetre ?? {})) l(C, oe, x[C] + Y * N);
8353
+ for (const [C, N] of Object.entries(M.perSecond ?? {})) l(C, oe, x[C] + (oe - k) / 1e3 * N);
8350
8354
  if (Y >= y) break;
8351
8355
  }
8352
8356
  for (const [Y, oe] of Object.entries(M.perMetre ?? {})) r[Y] = x[Y] + y * oe;
8353
8357
  for (const [Y, oe] of Object.entries(M.perSecond ?? {})) r[Y] = x[Y] + v / 1e3 * oe;
8354
8358
  return [s, i] = A[A.length - 1].point, h = W, k + v;
8355
8359
  }, p = (M, m) => {
8356
- const P = Object.fromEntries(Object.entries(M).filter(([k]) => !["at", "to", "through", "toward"].includes(k))), A = E0(e, t, [P], { start: { ...r, turn: 1 }, scale: 100, style: n.style, exaggeration: n.exaggeration });
8360
+ const P = Object.fromEntries(Object.entries(M).filter(([k]) => !["at", "to", "through", "toward"].includes(k))), A = T0(e, t, [P], { start: { ...r, turn: 1 }, scale: 100, style: n.style, exaggeration: n.exaggeration });
8357
8361
  for (const k of A.tracks) {
8358
- if (Q0.includes(k.property)) continue;
8362
+ if (td.includes(k.property)) continue;
8359
8363
  const y = k.keyframes ?? [], v = r[k.property];
8360
8364
  if (!y.every((w) => w.value === v)) {
8361
8365
  d(k.property, m, v);
@@ -8380,16 +8384,16 @@ ${a.map((M) => ` beat ${M.beat}: ${M.message}`).join(`
8380
8384
  keyframes: br(m)
8381
8385
  })), duration: b, beats: g, end: { position: [s, i], heading: h, values: { ...r } } };
8382
8386
  }
8383
- const Q0 = ["x", "y", "turn", "facing", "tilt"], ed = 0.35, Qr = {
8387
+ const td = ["x", "y", "turn", "facing", "tilt"], od = 0.35, Qr = {
8384
8388
  seated: _e.sit,
8385
8389
  astride: { ..._e.sit, "leg.left.spread": 26, "leg.right.spread": 26, "leg.left.swing": 40, "leg.right.swing": 40, "leg.left.knee": 70, "leg.right.knee": 70 },
8386
8390
  driving: { ..._e.sit, "arm.left.swing": 52, "arm.right.swing": 52, "arm.left.spread": 8, "arm.right.spread": 8, "arm.left.elbow": 38, "arm.right.elbow": 38, lean: 4 },
8387
8391
  wheeling: { ..._e.sit, "arm.left.swing": -6, "arm.right.swing": -6, "arm.left.spread": 16, "arm.right.spread": 16, "arm.left.elbow": 28, "arm.right.elbow": 28, "leg.left.knee": 80, "leg.right.knee": 80 },
8388
8392
  cycling: { ..._e.sit, lean: 22, bend: 10, "head.nod": -14, "arm.left.swing": 58, "arm.right.swing": 58, "arm.left.spread": 10, "arm.right.spread": 10, "arm.left.elbow": 22, "arm.right.elbow": 22, "leg.left.spread": 6, "leg.right.spread": 6 }
8389
- }, td = 22, Ds = 38;
8393
+ }, nd = 22, Ds = 38;
8390
8394
  function qs(e, t = Qr.cycling) {
8391
8395
  const o = e * Math.PI * 2, n = (s) => ({
8392
- swing: (t["leg.left.swing"] ?? 40) + td * Math.cos(o + s),
8396
+ swing: (t["leg.left.swing"] ?? 40) + nd * Math.cos(o + s),
8393
8397
  // The knee straightens as the foot pushes down and over the bottom of the stroke.
8394
8398
  knee: (t["leg.left.knee"] ?? 70) + Ds * (0.5 + 0.5 * Math.cos(o + s)) - Ds * 0.5,
8395
8399
  ankle: 12 * Math.sin(o + s)
@@ -8404,7 +8408,7 @@ function qs(e, t = Qr.cycling) {
8404
8408
  "leg.right.ankle": r.ankle
8405
8409
  };
8406
8410
  }
8407
- function bf(e) {
8411
+ function kf(e) {
8408
8412
  const t = e.cadence ?? 1.2, o = Math.max(2, e.samplesPerTurn ?? 8), n = 1e3 / t / o, a = [];
8409
8413
  for (let r = e.start, s = 0; r < e.end; r += n, s++)
8410
8414
  a.push({ time: Math.round(r), pose: qs((r - e.start) / 1e3 * t, e.base), ...s > 0 ? { act: !1 } : {} });
@@ -8414,7 +8418,7 @@ const Bs = (e, t) => {
8414
8418
  const o = t * Math.PI / 180;
8415
8419
  return [e[0] * Math.cos(o) + e[2] * Math.sin(o), e[1], -e[0] * Math.sin(o) + e[2] * Math.cos(o)];
8416
8420
  };
8417
- function wf(e) {
8421
+ function vf(e) {
8418
8422
  const t = `${e.scene}/${e.propId}`, o = new ve({ id: `${e.propId}-ride-3d`, tracks: e.propTracks.filter((b) => b.target === t) }), n = e.placement ?? {}, [a, r, s] = n.position ?? [0, 0, 0], i = e.prop.rig, h = sn({ ...e.character, height: 1 }), c = { ...ye, ...e.pose ?? Qr.seated }, l = nn(h.plan, c, { height: e.height ?? 1.7, contact: h.contact }).hip, d = e.facing ?? 0, f = e.every ?? 33, u = { x: [], y: [], z: [], rotateY: [] };
8419
8423
  for (let b = e.start; ; b = Math.min(e.end, b + f)) {
8420
8424
  const T = o.getStateAtTime(b).values.get(t) ?? /* @__PURE__ */ new Map(), H = (x, W) => {
@@ -8423,20 +8427,20 @@ function wf(e) {
8423
8427
  }, M = { ...n.values };
8424
8428
  for (const x of Object.keys(i.controls)) M[x] = H(x, n.values?.[x] ?? be(i, {}, x));
8425
8429
  for (const x of ["pitch", "roll", "squash", "lift", "lean", "size"]) M[x] = H(x, n.values?.[x] ?? be(i, {}, x));
8426
- const m = uc(i, M)[e.anchor];
8430
+ const m = pc(i, M)[e.anchor];
8427
8431
  if (!m) throw new Error(`propRide3D: ${e.prop.kind} has no anchor "${e.anchor}" (it has ${Object.keys(i.anchors ?? {}).join(", ") || "none"})`);
8428
8432
  const P = H("rotateY", n.heading ?? 0), A = Bs(m, P), k = [H("x", a) + A[0], H("y", r) + A[1], H("z", s) + A[2]], y = P + d, v = Bs(l, y);
8429
8433
  let w = [k[0] - v[0], k[1] - v[1], k[2] - v[2]];
8430
8434
  const E = (x, W) => {
8431
8435
  const G = W * W * (3 - 2 * W);
8432
- return [x[0] + (w[0] - x[0]) * G, w[1] * G + ed * Math.sin(Math.PI * W), x[1] + (w[2] - x[1]) * G];
8436
+ return [x[0] + (w[0] - x[0]) * G, w[1] * G + od * Math.sin(Math.PI * W), x[1] + (w[2] - x[1]) * G];
8433
8437
  }, O = e.mount ? Math.max(1, e.mount.for ?? 450) : 0, j = e.dismount ? Math.max(1, e.dismount.for ?? 450) : 0;
8434
8438
  if (e.mount && b < e.start + O ? w = E(e.mount.from, (b - e.start) / O) : e.dismount && b > e.end - j && (w = E(e.dismount.to, (e.end - b) / j)), u.x.push({ time: b, value: w[0] }), u.y.push({ time: b, value: w[1] }), u.z.push({ time: b, value: w[2] }), u.rotateY.push({ time: b, value: y }), b >= e.end) break;
8435
8439
  }
8436
8440
  const p = e.riderId, g = `${e.scene}/${p}`;
8437
8441
  return Object.keys(u).map((b) => ({ id: `${p}-${b}`, target: g, property: b, keyframes: u[b] }));
8438
8442
  }
8439
- const od = {
8443
+ const sd = {
8440
8444
  ground: "#7fb56a",
8441
8445
  hills: "#5f9a58",
8442
8446
  city: "#4b5468",
@@ -8462,11 +8466,11 @@ const od = {
8462
8466
  ], Tt = (e, t, o) => {
8463
8467
  const n = (s) => [1, 3, 5].map((i) => parseInt(s.slice(i, i + 2), 16)), [a, r] = [n(e), n(t)];
8464
8468
  return `#${a.map((s, i) => Math.round(s + (r[i] - s) * o).toString(16).padStart(2, "0")).join("")}`;
8465
- }, nd = (e) => {
8469
+ }, rd = (e) => {
8466
8470
  const t = (e % 24 + 24) % 24;
8467
8471
  return t < 5 || t > 20 ? 0 : t < 7 ? (t - 5) / 2 : t > 18 ? (20 - t) / 2 : 1;
8468
8472
  };
8469
- function sd(e) {
8473
+ function ad(e) {
8470
8474
  const t = (e % 24 + 24) % 24;
8471
8475
  for (let o = 1; o < St.length; o++) {
8472
8476
  const [n, a, r] = St[o - 1], [s, i, h] = St[o];
@@ -8477,34 +8481,34 @@ function sd(e) {
8477
8481
  }
8478
8482
  return { top: St[0][1], bottom: St[0][2] };
8479
8483
  }
8480
- const rd = (e, t) => {
8484
+ const id = (e, t) => {
8481
8485
  const o = ((e - t) % 24 + 24) % 24;
8482
8486
  return o <= 12 ? o / 12 : -1;
8483
- }, ad = 9, id = 55, ld = 28;
8484
- function hd(e) {
8485
- const { x: t, y: o, width: n, height: a } = e, r = e.kind ?? "sky", s = e.ground ?? o + a * 0.85, i = { ...od, ...e.colors }, h = e.horizon ?? "hills", c = e.window !== !1, l = rn(e.seed ?? 1), d = n * a / 1e5, f = Array.from({ length: Math.ceil(ad * d) + 2 }, () => ({ u: l.next(), v: l.next(), size: 0.6 + l.next() * 0.8, puffs: 2 + Math.floor(l.next() * 3) })), u = Array.from({ length: Math.ceil(id * d) + 4 }, () => ({ u: l.next(), v: l.next(), speed: 0.8 + l.next() * 0.5 })), p = Array.from({ length: Math.ceil(ld * d) + 4 }, () => ({ u: l.next(), v: l.next(), speed: 0.7 + l.next() * 0.6, sway: l.next() * Math.PI * 2, size: 1.5 + l.next() * 2 })), g = Array.from({ length: Math.ceil(30 * d) + 10 }, () => ({ u: l.next(), v: l.next() * 0.6, size: 0.6 + l.next() * 1.2 })), b = Array.from({ length: 6 }, () => ({ phase: l.next() * Math.PI * 2, amp: 0.5 + l.next() })), T = Array.from({ length: 24 }, () => ({ h: 0.35 + l.next() * 0.65, w: 0.6 + l.next() * 0.8, windows: l.next() > 0.3 })), H = {
8487
+ }, ld = 9, hd = 55, cd = 28;
8488
+ function dd(e) {
8489
+ const { x: t, y: o, width: n, height: a } = e, r = e.kind ?? "sky", s = e.ground ?? o + a * 0.85, i = { ...sd, ...e.colors }, h = e.horizon ?? "hills", c = e.window !== !1, l = rn(e.seed ?? 1), d = n * a / 1e5, f = Array.from({ length: Math.ceil(ld * d) + 2 }, () => ({ u: l.next(), v: l.next(), size: 0.6 + l.next() * 0.8, puffs: 2 + Math.floor(l.next() * 3) })), u = Array.from({ length: Math.ceil(hd * d) + 4 }, () => ({ u: l.next(), v: l.next(), speed: 0.8 + l.next() * 0.5 })), p = Array.from({ length: Math.ceil(cd * d) + 4 }, () => ({ u: l.next(), v: l.next(), speed: 0.7 + l.next() * 0.6, sway: l.next() * Math.PI * 2, size: 1.5 + l.next() * 2 })), g = Array.from({ length: Math.ceil(30 * d) + 10 }, () => ({ u: l.next(), v: l.next() * 0.6, size: 0.6 + l.next() * 1.2 })), b = Array.from({ length: 6 }, () => ({ phase: l.next() * Math.PI * 2, amp: 0.5 + l.next() })), T = Array.from({ length: 24 }, () => ({ h: 0.35 + l.next() * 0.65, w: 0.6 + l.next() * 0.8, windows: l.next() > 0.3 })), H = {
8486
8490
  hour: e.hour ?? 12,
8487
8491
  clouds: e.clouds ?? 0.3,
8488
8492
  wind: e.wind ?? 0,
8489
8493
  rain: e.rain ?? 0,
8490
8494
  snow: e.snow ?? 0
8491
8495
  }, M = It(), m = (w, E) => M.keys(w)?.length ? M.valueAt(w, E) : H[w], P = (w, E) => {
8492
- const O = rd(w, E), j = O < 0 ? 0.5 : O, x = s - o;
8496
+ const O = id(w, E), j = O < 0 ? 0.5 : O, x = s - o;
8493
8497
  return { x: 0.1 * n + 0.8 * n * j, y: O < 0 ? x + a * 0.2 : x - Math.sin(j * Math.PI) * x * 0.8, up: O >= 0 };
8494
8498
  }, A = (w, E, O, j, x) => {
8495
- const W = E("hour"), { top: G, bottom: Y } = sd(W), oe = w.createLinearGradient(0, j.y, 0, j.ground);
8499
+ const W = E("hour"), { top: G, bottom: Y } = ad(W), oe = w.createLinearGradient(0, j.y, 0, j.ground);
8496
8500
  oe.addColorStop(0, G), oe.addColorStop(1, Y), w.fillStyle = oe, w.fillRect(j.x, j.y, j.w, j.ground - j.y);
8497
- const q = nd(W);
8501
+ const q = rd(W);
8498
8502
  if (q < 0.6) {
8499
8503
  w.fillStyle = "#ffffff", w.globalAlpha = (0.6 - q) / 0.6 * 0.9;
8500
8504
  for (const L of g)
8501
8505
  w.beginPath(), w.arc(j.x + L.u * j.w, j.y + L.v * (j.ground - j.y), L.size, 0, Math.PI * 2), w.fill();
8502
8506
  w.globalAlpha = 1;
8503
8507
  }
8504
- const I = P(W, 6), N = P(W, 18), C = Math.min(j.w, j.h) * 0.06;
8505
- if (I.up && (w.fillStyle = i.sun, w.beginPath(), w.arc(j.x + I.x / n * j.w, j.y + I.y / a * j.h, C, 0, Math.PI * 2), w.fill()), N.up) {
8506
- const L = j.x + N.x / n * j.w, Q = j.y + N.y / a * j.h;
8507
- w.fillStyle = i.moon, w.beginPath(), w.arc(L, Q, C * 0.8, 0, Math.PI * 2), w.fill(), w.fillStyle = G, w.beginPath(), w.arc(L - C * 0.35, Q - C * 0.15, C * 0.7, 0, Math.PI * 2), w.fill();
8508
+ const I = P(W, 6), C = P(W, 18), N = Math.min(j.w, j.h) * 0.06;
8509
+ if (I.up && (w.fillStyle = i.sun, w.beginPath(), w.arc(j.x + I.x / n * j.w, j.y + I.y / a * j.h, N, 0, Math.PI * 2), w.fill()), C.up) {
8510
+ const L = j.x + C.x / n * j.w, Q = j.y + C.y / a * j.h;
8511
+ w.fillStyle = i.moon, w.beginPath(), w.arc(L, Q, N * 0.8, 0, Math.PI * 2), w.fill(), w.fillStyle = G, w.beginPath(), w.arc(L - N * 0.35, Q - N * 0.15, N * 0.7, 0, Math.PI * 2), w.fill();
8508
8512
  }
8509
8513
  const S = Math.max(0, Math.min(1, E("clouds"))), _ = Math.max(-1, Math.min(1, E("wind"))), V = Math.round(S * f.length);
8510
8514
  w.fillStyle = Tt("#ffffff", i.cloud === "#ffffff" ? "#ffffff" : i.cloud, 1), w.globalAlpha = 0.55 + 0.4 * q;
@@ -8547,8 +8551,8 @@ function hd(e) {
8547
8551
  const Y = j.h * 0.05, oe = x * 0.45, q = Math.round(W * u.length);
8548
8552
  w.beginPath();
8549
8553
  for (let I = 0; I < q; I++) {
8550
- const N = u[I], C = ((N.v * j.h + O * N.speed * 0.9) % j.h + j.h) % j.h, S = ((N.u * j.w + C * oe) % j.w + j.w) % j.w;
8551
- w.moveTo(j.x + S, j.y + C), w.lineTo(j.x + S + oe * Y, j.y + C + Y);
8554
+ const C = u[I], N = ((C.v * j.h + O * C.speed * 0.9) % j.h + j.h) % j.h, S = ((C.u * j.w + N * oe) % j.w + j.w) % j.w;
8555
+ w.moveTo(j.x + S, j.y + N), w.lineTo(j.x + S + oe * Y, j.y + N + Y);
8552
8556
  }
8553
8557
  w.stroke(), w.globalAlpha = 1;
8554
8558
  }
@@ -8556,8 +8560,8 @@ function hd(e) {
8556
8560
  w.fillStyle = i.snow, w.globalAlpha = 0.85;
8557
8561
  const Y = Math.round(G * p.length);
8558
8562
  for (let oe = 0; oe < Y; oe++) {
8559
- const q = p[oe], I = ((q.v * j.h + O * q.speed * 0.08) % j.h + j.h) % j.h, N = Math.sin(O * 2e-3 + q.sway) * j.w * 0.02, C = ((q.u * j.w + N + x * I * 0.3) % j.w + j.w) % j.w;
8560
- w.beginPath(), w.arc(j.x + C, j.y + I, q.size, 0, Math.PI * 2), w.fill();
8563
+ const q = p[oe], I = ((q.v * j.h + O * q.speed * 0.08) % j.h + j.h) % j.h, C = Math.sin(O * 2e-3 + q.sway) * j.w * 0.02, N = ((q.u * j.w + C + x * I * 0.3) % j.w + j.w) % j.w;
8564
+ w.beginPath(), w.arc(j.x + N, j.y + I, q.size, 0, Math.PI * 2), w.fill();
8561
8565
  }
8562
8566
  w.globalAlpha = 1;
8563
8567
  }
@@ -8573,7 +8577,7 @@ function hd(e) {
8573
8577
  about: {
8574
8578
  kind: r === "room" ? "room" : "sky",
8575
8579
  summary: r === "room" ? "A room: a wall, a floor and a window on the sky. Its values are tracks: hour, clouds, wind, rain, snow (seen through the window)." : `A sky over ${h === "flat" ? "the ground" : h}: the sun and moon on their arcs, stars, clouds on the wind, rain and snow. Its values are tracks: hour (0–24), clouds, wind (−1..1), rain, snow (0..1).`,
8576
- props: Object.fromEntries(Object.keys(H).map((w) => [w, cd(w)]))
8580
+ props: Object.fromEntries(Object.keys(H).map((w) => [w, fd(w)]))
8577
8581
  },
8578
8582
  draw(w, E, O) {
8579
8583
  const j = E.props ?? {}, x = (G) => Number(j[G] ?? H[G] ?? 0);
@@ -8608,7 +8612,7 @@ function hd(e) {
8608
8612
  };
8609
8613
  return v;
8610
8614
  }
8611
- function cd(e) {
8615
+ function fd(e) {
8612
8616
  switch (e) {
8613
8617
  case "hour":
8614
8618
  return { description: "The time of day, 0–24: the sky’s colours, the sun and the moon on their arcs, stars at night", unit: "hours", min: 0, max: 24 };
@@ -8622,7 +8626,7 @@ function cd(e) {
8622
8626
  return { description: "How hard it snows", unit: "0..1", min: 0, max: 1 };
8623
8627
  }
8624
8628
  }
8625
- function dd(e, t) {
8629
+ function ud(e, t) {
8626
8630
  const { width: o, height: n } = t, a = t.ground ?? n * 0.85, r = t.scale ?? n / 4.5, s = { x: 0, y: 0, width: o, height: n, ground: a }, i = (h, c, l = {}) => ({ preset: h, x: o * c, scale: r, ...l });
8627
8631
  switch (e) {
8628
8632
  case "park":
@@ -8649,70 +8653,71 @@ function dd(e, t) {
8649
8653
  throw new Error(fe("scene preset", e, ["park", "street", "office", "home"]));
8650
8654
  }
8651
8655
  }
8652
- function kf(e, t) {
8653
- const o = dd(e, t), n = hd(o.scenery), a = o.props.map((r) => yc({ x: r.x, y: n.ground, prop: Jr(r.preset), scale: r.scale, values: { turn: r.turn ?? 0, ...r.values } }));
8656
+ function Sf(e, t) {
8657
+ const o = ud(e, t), n = dd(o.scenery), a = o.props.map((r) => wc({ x: r.x, y: n.ground, prop: Jr(r.preset), scale: r.scale, values: { turn: r.turn ?? 0, ...r.values } }));
8654
8658
  return { scenery: n, props: a, ground: n.ground };
8655
8659
  }
8656
8660
  export {
8657
8661
  ht as ACTING_STYLES,
8658
8662
  Yr as AIRCRAFT_ACTING,
8659
8663
  _t as ANIMAL_GAITS,
8660
- Il as ANIME_CAST,
8664
+ jl as ANIME_CAST,
8661
8665
  Jo as BEAT_FIELDS,
8662
8666
  At as BEAT_MOMENTS,
8663
- Dc as BED_ACTING,
8664
- g0 as BIRD_ACTING,
8667
+ Bc as BED_ACTING,
8668
+ m0 as BIRD_ACTING,
8665
8669
  Jn as BOARD_MARKS,
8666
8670
  Rt as BOARD_THEMES,
8667
- Ra as CANVAS_PROPERTIES,
8668
- Rc as CHAIR_ACTING,
8671
+ Na as BODY_SHAPES,
8672
+ za as CANVAS_PROPERTIES,
8673
+ zc as CHAIR_ACTING,
8669
8674
  Bn as CHARACTER_BEAT_3D_FIELDS,
8670
8675
  Or as CHARACTER_CAST,
8671
- Xi as CHARACTER_GAIT_SPEEDS,
8676
+ Ji as CHARACTER_GAIT_SPEEDS,
8672
8677
  ns as CHART_KINDS,
8673
8678
  st as CHART_SURFACE,
8674
8679
  Wt as CHART_THEMES,
8675
8680
  Uo as CODE_LANGUAGES,
8676
8681
  Pr as CODE_PANEL_EDITS,
8677
8682
  Gt as CODE_SURFACE,
8678
- ll as CODE_THEME,
8683
+ cl as CODE_THEME,
8679
8684
  Je as DANCE_STYLES,
8680
- Lc as DESK_ACTING,
8681
- Bc as DOOR_ACTING,
8685
+ Dc as DESK_ACTING,
8686
+ Yc as DOOR_ACTING,
8682
8687
  Xo as EMBRACE,
8683
8688
  $e as EXPRESSIONS,
8684
- xa as FACIAL_HAIR_STYLES,
8685
- Mf as FINGERS,
8689
+ ja as FACIAL_HAIR_STYLES,
8690
+ Ef as FINGERS,
8686
8691
  ho as FLIPS,
8687
8692
  ya as FOOT_SHAPES,
8688
8693
  Ve as GAGS,
8689
8694
  Ke as GAITS,
8690
8695
  fs as GAIT_CYCLE_MS,
8691
- Ia as GLASSES_STYLES,
8696
+ xa as GLASSES_STYLES,
8692
8697
  xe as HAIR_COLORS,
8693
- $f as HAIR_STILL,
8694
- ja as HAIR_STYLES,
8698
+ Af as HAIR_STILL,
8699
+ _a as HAIR_STYLES,
8695
8700
  no as HAND_MEETINGS,
8696
8701
  Pe as HAND_REST,
8697
8702
  we as HAND_SHAPES,
8698
- Ha as HAT_STYLES,
8699
- Oa as HELD_ITEMS,
8703
+ Ia as HAT_STYLES,
8704
+ Ha as HELD_ITEMS,
8700
8705
  rt as HELP_UP,
8701
- hf as HORSE_ACTING,
8702
- lf as HORSE_GAITS,
8703
- Kc as HOUSE_ACTING,
8704
- Ql as HUMAN_ACTING_RIG,
8705
- _a as HUMAN_BUILDS,
8706
- Ef as HUMAN_CYCLES,
8706
+ df as HORSE_ACTING,
8707
+ cf as HORSE_GAITS,
8708
+ Nc as HOUSE_ACTING,
8709
+ th as HUMAN_ACTING_RIG,
8710
+ Ka as HUMAN_BUILDS,
8711
+ Tf as HUMAN_CYCLES,
8707
8712
  ft as HUMAN_DANCES,
8708
- Ka as HUMAN_EXPRESSIONS,
8713
+ Ca as HUMAN_EXPRESSIONS,
8709
8714
  Xs as HUMAN_GAGS,
8710
8715
  _e as HUMAN_POSES,
8711
8716
  ye as HUMAN_REST,
8712
- xu as IDENTITY_CAMERA,
8713
- xl as MANGA_CAST,
8717
+ Nu as IDENTITY_CAMERA,
8718
+ _l as MANGA_CAST,
8714
8719
  Do as MUDRAS,
8715
- Af as OUTFIT_PRESETS,
8720
+ Pf as OUTFIT_PRESETS,
8716
8721
  Ae as POSES,
8717
8722
  Fs as PROP_BEAT_3D_FIELDS,
8718
8723
  en as PROP_BEAT_FIELDS,
@@ -8725,294 +8730,297 @@ export {
8725
8730
  ce as REST_POSE,
8726
8731
  Qr as RIDING_POSES,
8727
8732
  Ye as SAMPLE_STEP,
8728
- od as SCENERY_COLORS,
8733
+ sd as SCENERY_COLORS,
8729
8734
  go as SCRIPT_ACTIONS,
8730
- Tf as SOFT_CARTOON_CAST,
8731
- Vl as STICK_ACTING_RIG,
8732
- xc as TREE_ACTING,
8733
- vc as VEHICLE_ACTING,
8735
+ Of as SOFT_CARTOON_CAST,
8736
+ Zl as STICK_ACTING_RIG,
8737
+ _c as TREE_ACTING,
8738
+ Mc as VEHICLE_ACTING,
8734
8739
  Be as VISEMES,
8735
- Uc as WHEELCHAIR_ACTING,
8736
- Ce as WHITEBOARD_SURFACE,
8737
- th as actCharacterTracks,
8740
+ Vc as WHEELCHAIR_ACTING,
8741
+ Ne as WHITEBOARD_SURFACE,
8742
+ nh as actCharacterTracks,
8738
8743
  kn as actKeyframes,
8739
- eh as actTracks,
8744
+ oh as actTracks,
8740
8745
  jr as actionNames,
8741
- Zc as airplane,
8746
+ e0 as airplane,
8742
8747
  Ue as anchorError,
8743
8748
  An as animalStrideLength,
8744
- ju as animatableProperties,
8745
- _u as applyCamera,
8746
- Ba as applyGroove,
8749
+ Ru as animatableProperties,
8750
+ Wu as applyCamera,
8751
+ Ya as applyGroove,
8747
8752
  cs as assertBeats,
8748
- Md as bakeDanceTracks,
8749
- Pf as basicOutfit,
8750
- kd as beatAt,
8751
- Fc as bed,
8752
- Oc as bike,
8753
+ Ed as bakeDanceTracks,
8754
+ Hf as basicOutfit,
8755
+ Sd as beatAt,
8756
+ qc as bed,
8757
+ Ic as bike,
8753
8758
  Qe as bird,
8754
8759
  on as blendPose,
8755
- Of as bodyProfileWidth,
8756
- Ou as boilFrame,
8757
- zi as boxMesh,
8758
- Hf as brushingPose,
8759
- kf as buildScene,
8760
- Ec as bus,
8761
- Ku as cameraFromValues,
8762
- Nu as cameraPoint,
8763
- x0 as capabilities,
8764
- df as capabilitiesMarkdown,
8765
- Mc as car,
8766
- Tc as cart,
8767
- Dd as castMember,
8768
- l0 as cat,
8769
- Cc as chair,
8760
+ If as bodyProfileWidth,
8761
+ xf as bodyShapeProfiles,
8762
+ _u as boilFrame,
8763
+ Fi as boxMesh,
8764
+ jf as brushingPose,
8765
+ Sf as buildScene,
8766
+ Tc as bus,
8767
+ zu as cameraFromValues,
8768
+ Lu as cameraPoint,
8769
+ _0 as capabilities,
8770
+ uf as capabilitiesMarkdown,
8771
+ Ec as car,
8772
+ Oc as cart,
8773
+ Bd as castMember,
8774
+ c0 as cat,
8775
+ Wc as chair,
8770
8776
  Pt as changingWindows,
8771
8777
  sn as character,
8772
- If as characterAt,
8773
- xf as characterHandPose,
8778
+ _f as characterAt,
8779
+ Kf as characterHandPose,
8774
8780
  Oe as characterJoints,
8775
- jf as characterJointsInView,
8776
- xd as characterLookAtTracks,
8777
- Od as characterObjects,
8781
+ Cf as characterJointsInView,
8782
+ _d as characterLookAtTracks,
8783
+ Id as characterObjects,
8778
8784
  ia as characterPartsInView,
8779
8785
  da as characterPoseOf,
8780
- _f as characterPoseTracks,
8781
- sf as characterScript,
8782
- Id as characterScript3D,
8783
- Fh as characterStrideLength,
8784
- Kf as characterTarget,
8785
- Fd as chart,
8786
+ Nf as characterPoseTracks,
8787
+ af as characterScript,
8788
+ jd as characterScript3D,
8789
+ qh as characterStrideLength,
8790
+ Rf as characterTarget,
8791
+ qd as chart,
8786
8792
  ro as checkBeats,
8787
8793
  _r as checkCast,
8788
- el as checkCharacterBeats3D,
8789
- $0 as checkPropBeats,
8790
- Z0 as checkPropBeats3D,
8791
- Wh as checkSurfaceBeats,
8792
- Cu as checkTracks,
8793
- b0 as chicken,
8794
- Kd as circlePath,
8794
+ ol as checkCharacterBeats3D,
8795
+ A0 as checkPropBeats,
8796
+ ed as checkPropBeats3D,
8797
+ Lh as checkSurfaceBeats,
8798
+ Fu as checkTracks,
8799
+ k0 as chicken,
8800
+ Nd as circlePath,
8795
8801
  Tr as clipErased,
8796
- zd as codePanel,
8797
- gl as codeTokens,
8802
+ Fd as codePanel,
8803
+ ml as codeTokens,
8798
8804
  be as controlValue,
8799
- h0 as cow,
8805
+ d0 as cow,
8800
8806
  ra as createPen,
8801
- y0 as crow,
8802
- Li as cylinderMesh,
8803
- ci as danceCircleAt,
8804
- Ad as danceCircleTracks,
8807
+ w0 as crow,
8808
+ Di as cylinderMesh,
8809
+ fi as danceCircleAt,
8810
+ Pd as danceCircleTracks,
8805
8811
  hn as danceFrame,
8806
8812
  ut as danceJoint,
8807
- bd as dancePose,
8813
+ kd as dancePose,
8808
8814
  qo as danceStance,
8809
- wd as danceTaps,
8810
- Sd as danceTracks,
8815
+ vd as danceTaps,
8816
+ $d as danceTracks,
8811
8817
  ko as danceTravel,
8812
- Xa as danceTravelTrack,
8813
- vd as dancer,
8814
- ef as defineAction,
8815
- tf as defineGait,
8816
- Ru as describeTarget,
8817
- zc as desk,
8818
- i0 as dog,
8819
- qc as door,
8818
+ Ja as danceTravelTrack,
8819
+ Md as dancer,
8820
+ of as defineAction,
8821
+ nf as defineGait,
8822
+ Du as describeTarget,
8823
+ Fc as desk,
8824
+ h0 as dog,
8825
+ Gc as door,
8820
8826
  ha as drawCartoonHand,
8821
- Nf as drawCharacter,
8822
- Cf as drawCharacterHead,
8823
- Rf as drawCharacterInView,
8824
- rh as drawDustPuff,
8827
+ Wf as drawCharacter,
8828
+ zf as drawCharacterHead,
8829
+ Lf as drawCharacterInView,
8830
+ ih as drawDustPuff,
8825
8831
  Mr as drawEraser,
8826
8832
  Er as drawHand,
8827
- Wf as drawHeldItem,
8828
- Qd as drawImpactStars,
8829
- tl as drawPencil,
8830
- rf as drawProp,
8831
- ff as drawPropEffects,
8833
+ Ff as drawHeldItem,
8834
+ tf as drawImpactStars,
8835
+ nl as drawPencil,
8836
+ lf as drawProp,
8837
+ gf as drawPropEffects,
8832
8838
  fr as drawPropShadow,
8833
- Ei as drawSolvedFaces,
8834
- Pd as drawSolvedPart,
8839
+ Ti as drawSolvedFaces,
8840
+ Hd as drawSolvedPart,
8835
8841
  cr as drawSolvedProp,
8836
- nh as drawSpeedLines,
8837
- zf as drawStickFigure,
8838
- Zd as drawStickSmear,
8839
- Nd as drawnPathTarget,
8840
- k0 as duck,
8842
+ rh as drawSpeedLines,
8843
+ Df as drawStickFigure,
8844
+ ef as drawStickSmear,
8845
+ Rd as drawnPathTarget,
8846
+ S0 as duck,
8841
8847
  uo as editError,
8842
8848
  It as editLog,
8843
- Lf as ellipsePoints,
8844
- Fi as ellipsoidMesh,
8845
- Yd as embrace,
8846
- Gd as embraceSpacing,
8847
- Wd as erasable,
8849
+ qf as ellipsePoints,
8850
+ qi as ellipsoidMesh,
8851
+ Xd as embrace,
8852
+ Ud as embraceSpacing,
8853
+ Ld as erasable,
8848
8854
  vn as expandBeats,
8849
- qi as extrudeMesh,
8850
- pi as flipPose,
8851
- Td as flipTracks,
8852
- mi as flipTravel,
8855
+ Gi as extrudeMesh,
8856
+ yi as flipPose,
8857
+ Od as flipTracks,
8858
+ bi as flipTravel,
8853
8859
  hs as gag,
8854
8860
  so as gagDuration,
8855
- Ff as gaitPose,
8861
+ Bf as gaitPose,
8856
8862
  Lo as gaitStrideLength,
8857
- c0 as goat,
8858
- Fl as hairFollow,
8859
- Jd as hairFollowTracks,
8863
+ f0 as goat,
8864
+ ql as hairFollow,
8865
+ Qd as hairFollowTracks,
8860
8866
  ca as hairHangs,
8861
- Vd as hairMotionAt,
8862
- Df as hairMotionOf,
8863
- qf as hairlineAt,
8864
- _d as handAt,
8865
- Bf as handGrip,
8867
+ Zd as hairMotionAt,
8868
+ Gf as hairMotionOf,
8869
+ Yf as hairlineAt,
8870
+ Cd as handAt,
8871
+ Uf as handGrip,
8866
8872
  Pn as handJoints,
8867
- Gf as handJointsAt,
8868
- Nr as handPath,
8873
+ Xf as handJointsAt,
8874
+ Cr as handPath,
8869
8875
  bt as handPose,
8870
8876
  ta as handProp,
8871
- Yf as headPoint,
8872
- Vc as helicopter,
8873
- Xd as helpUp,
8874
- Ud as helpUpSpacing,
8875
- Uf as holdingLayers,
8876
- a0 as horse,
8877
- cf as horseStrideLength,
8878
- _c as house,
8879
- Xf as humanCyclePose,
8877
+ Vf as headPoint,
8878
+ Zc as helicopter,
8879
+ Jd as helpUp,
8880
+ Vd as helpUpSpacing,
8881
+ Jf as holdingLayers,
8882
+ l0 as horse,
8883
+ ff as horseStrideLength,
8884
+ Cc as house,
8885
+ Zf as humanCyclePose,
8880
8886
  Zt as humanDanceFrame,
8881
- $d as humanDanceTracks,
8882
- Vf as humanFieldLabel,
8887
+ Ad as humanDanceTracks,
8888
+ Qf as humanFieldLabel,
8883
8889
  la as humanGag,
8884
8890
  aa as humanGaitPose,
8885
8891
  Us as humanGaitStrideLength,
8886
8892
  oa as humanPlan,
8887
8893
  Qs as humanPose,
8888
- Jf as isHeld,
8889
- Zf as jointsInScene,
8890
- Qf as jointsToScene,
8891
- eu as leafOutfit,
8892
- tu as leafOutfitContours,
8894
+ eu as isHeld,
8895
+ tu as jointsInScene,
8896
+ ou as jointsToScene,
8897
+ nu as leafOutfit,
8898
+ su as leafOutfitContours,
8893
8899
  mr as lipSyncKeyframes,
8894
8900
  yn as lipSyncOver,
8895
- Hd as lipSyncTracks,
8901
+ xd as lipSyncTracks,
8896
8902
  gr as lit,
8897
8903
  Sr as lookFields,
8898
8904
  Dr as loosePartsOf,
8899
- s0 as lyingPose,
8900
- Ed as meetDandiya,
8901
- Bd as meetHands,
8902
- qd as meetingSpacing,
8905
+ a0 as lyingPose,
8906
+ ru as measuredHipWidth,
8907
+ Td as meetDandiya,
8908
+ Yd as meetHands,
8909
+ Gd as meetingSpacing,
8903
8910
  pa as mirrorHumanPose,
8904
- Da as mirrorPose,
8911
+ Ba as mirrorPose,
8905
8912
  pr as mixColors,
8906
8913
  Xt as mixHandPoses,
8907
8914
  Ys as mixPoses,
8908
- Hc as motorbike,
8909
- Tl as niceCeiling,
8915
+ xc as motorbike,
8916
+ Ol as niceCeiling,
8910
8917
  Un as objectPositionAt,
8911
- ou as organicBodyContours,
8912
- nu as organicCenterLine,
8913
- su as outfitPreset,
8914
- v0 as owl,
8915
- Bi as panelMesh,
8916
- S0 as parrot,
8918
+ au as organicBodyContours,
8919
+ iu as organicCenterLine,
8920
+ lu as outfitPreset,
8921
+ M0 as owl,
8922
+ Yi as panelMesh,
8923
+ $0 as parrot,
8917
8924
  pt as parseAnchor,
8918
8925
  nr as partialPath,
8919
- Hu as pathLength,
8920
- bf as pedallingKeys,
8926
+ Ku as pathLength,
8927
+ kf as pedallingKeys,
8921
8928
  qs as pedallingPose,
8922
- nf as persona,
8929
+ rf as persona,
8923
8930
  fo as pieceMotion,
8924
- w0 as pigeon,
8925
- hi as plantDanceFoot,
8931
+ v0 as pigeon,
8932
+ di as plantDanceFoot,
8926
8933
  an as pointAlong,
8927
- ru as pointOnHead,
8934
+ hu as pointOnHead,
8928
8935
  ga as pose,
8929
- au as poseTracks,
8936
+ cu as poseTracks,
8930
8937
  Tn as propActions,
8931
- uc as propAnchors3D,
8938
+ pc as propAnchors3D,
8932
8939
  En as propAt,
8933
8940
  qr as propControls,
8934
8941
  dr as propLineWidth,
8935
- mf as propObjects,
8936
- fc as propPartsInSpace,
8942
+ bf as propObjects,
8943
+ gc as propPartsInSpace,
8937
8944
  Jr as propPreset,
8938
- uf as propRide,
8939
- wf as propRide3D,
8940
- E0 as propScript,
8941
- yf as propScript3D,
8945
+ pf as propRide,
8946
+ vf as propRide3D,
8947
+ T0 as propScript,
8948
+ wf as propScript3D,
8942
8949
  ao as propShapeMesh,
8943
- af as propSurface,
8944
- yc as propTarget,
8945
- pf as propTow,
8946
- hc as propView,
8950
+ hf as propSurface,
8951
+ wc as propTarget,
8952
+ yf as propTow,
8953
+ dc as propView,
8947
8954
  Ze as quadruped,
8948
- d0 as rabbit,
8955
+ u0 as rabbit,
8949
8956
  Le as reachCharacter,
8950
- Dh as reachOf,
8957
+ Bh as reachOf,
8951
8958
  Hr as resolveActingStyle,
8952
8959
  fa as resolveCharacterPoseKeys,
8953
- iu as resolveFacialHair,
8954
- lu as resolveGait,
8955
- hu as resolveGlasses,
8956
- cu as resolveHair,
8957
- du as resolveHat,
8958
- fu as resolveHeadLook,
8959
- uu as resolveHolding,
8960
- gu as resolveOrganicBody,
8960
+ du as resolveFacialHair,
8961
+ fu as resolveGait,
8962
+ uu as resolveGlasses,
8963
+ gu as resolveHair,
8964
+ pu as resolveHat,
8965
+ mu as resolveHeadLook,
8966
+ yu as resolveHolding,
8967
+ bu as resolveMeasurements,
8968
+ wu as resolveOrganicBody,
8961
8969
  Vs as resolvePoseKeys,
8962
- pu as resolveStickFrame,
8963
- mu as resolveStickPose,
8970
+ ku as resolveStickFrame,
8971
+ vu as resolveStickPose,
8964
8972
  wn as rideFloors,
8965
- yu as rotateAbout,
8973
+ Su as rotateAbout,
8966
8974
  cn as routineBeats,
8967
- bu as rubberLimb,
8968
- dd as scenePreset,
8969
- hd as scenery,
8975
+ Mu as rubberLimb,
8976
+ ud as scenePreset,
8977
+ dd as scenery,
8970
8978
  Kr as scriptActionSummaries,
8971
8979
  Sn as scriptTracks,
8972
- Cd as scrubPath,
8973
- wu as seatHeight,
8980
+ Wd as scrubPath,
8981
+ $u as seatHeight,
8974
8982
  mn as shade,
8975
- Yi as shapeMesh,
8983
+ Xi as shapeMesh,
8976
8984
  Ws as sittingPose,
8977
- ku as skeletonInView,
8978
- Ca as sketchPen,
8979
- sd as skyColors,
8985
+ Eu as skeletonInView,
8986
+ Wa as sketchPen,
8987
+ ad as skyColors,
8980
8988
  yr as smoothPath,
8981
- vu as softCartoonCharacter,
8989
+ Au as softCartoonCharacter,
8982
8990
  jt as solveAt,
8983
8991
  na as solvePlanSpace,
8984
8992
  Fr as solveProp,
8985
- m0 as songbird,
8986
- Wi as soundsOf,
8987
- Ih as speechDuration,
8988
- Ui as speechLength,
8989
- gf as spliceTracks,
8990
- f0 as squirrel,
8993
+ b0 as songbird,
8994
+ Li as soundsOf,
8995
+ jh as speechDuration,
8996
+ Vi as speechLength,
8997
+ mf as spliceTracks,
8998
+ g0 as squirrel,
8991
8999
  nn as stagePlanSpace,
8992
- jd as stageSpots,
8993
- lh as stepsDuration,
9000
+ Kd as stageSpots,
9001
+ ch as stepsDuration,
8994
9002
  xr as stepsToKeys,
8995
9003
  Js as stickFigureAt,
8996
9004
  je as stickFigureJoints,
8997
9005
  Zs as stickFigureTarget,
8998
- vi as stickToHuman,
8999
- Su as strideLength,
9006
+ Mi as stickToHuman,
9007
+ Tu as strideLength,
9000
9008
  me as surfaceBox,
9001
- of as surfaceScript,
9002
- Mu as sweepingPose,
9003
- $u as talkingMouth,
9004
- Eu as taperedLine,
9005
- Au as taperedOutline,
9006
- Ac as tractor,
9007
- Pc as trainCar,
9008
- Ic as tree,
9009
- $c as truck,
9010
- Gi as tubeMesh,
9009
+ sf as surfaceScript,
9010
+ Pu as sweepingPose,
9011
+ Ou as talkingMouth,
9012
+ Hu as taperedLine,
9013
+ Iu as taperedOutline,
9014
+ Pc as tractor,
9015
+ Hc as trainCar,
9016
+ jc as tree,
9017
+ Ac as truck,
9018
+ Ui as tubeMesh,
9011
9019
  bn as valueAt,
9012
9020
  De as vehicle,
9013
- Tu as walkPose,
9014
- Yc as wheelchair,
9015
- Ld as whiteboard,
9016
- Rd as withErased,
9021
+ xu as walkPose,
9022
+ Xc as wheelchair,
9023
+ Dd as whiteboard,
9024
+ zd as withErased,
9017
9025
  at as withExpression
9018
9026
  };