@algorisys/tinyfly 0.127.1 → 0.129.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,5 +1,5 @@
1
- import { H as we, A as Ot, R as de, B as _e, D as hn, E as Eo, F as pt, G as Or, I as be, J as Ir, K as so, L as To, M as Hr, N as jr, O as ba, P as Ao, Q as ya, S as Cr, T as _r, U as xr, V as Fe, W as Nr, X as De, Y as wa, Z as ka, _ as Zo, $ as Rr, a0 as Ke, a1 as Ue, a2 as Ne, a3 as zr, a4 as Kr, a5 as Wr, a6 as va, a7 as He, a8 as Ae, a9 as Sa, aa as Fr, ab as ao, ac as We, ad as Ma, ae as Dr, af as Lr, ag as $a, ah as Br, ai as qr, aj as Gr, ak as Yr, al as Ur, i as Xr, h as Vr, c as Jr, j as Zr, f as Qr, d as ei, b as ti, e as ni, C as oi, am as si, an as ai, ao as ri, ap as ii, aq as li, ar as hi, as as ci, at as di } from "./cricket-play-a5jHHZVh.js";
2
- import { au as Uu, av as Xu, aw as Vu, ax as Ju, ay as Zu, az as Qu, aA as eg, aB as tg, aC as ng, aD as og, aE as sg, aF as ag, aG as rg, aH as ig, aI as lg, aJ as hg, aK as cg, aL as dg, aM as fg, aN as ug, aO as gg, aP as pg, aQ as mg, aR as bg, aS as yg, aT as wg, aU as kg, aV as vg, aW as Sg, aX as Mg, aY as $g, aZ as Eg, a_ as Tg, a$ as Ag, b0 as Pg, b1 as Og, b2 as Ig, b3 as Hg, b4 as jg, b5 as Cg, b6 as _g, b7 as xg, b8 as Ng, b9 as Rg, ba as zg, bb as Kg, bc as Wg, bd as Fg, be as Dg, bf as Lg, bg as Bg, bh as qg, bi as Gg, bj as Yg, bk as Ug, bl as Xg, bm as Vg, bn as Jg, bo as Zg, bp as Qg, bq as ep, br as tp, bs as np, bt as op, bu as sp, bv as ap, bw as rp, bx as ip, by as lp, bz as hp, bA as cp, bB as dp, bC as fp, bD as up, bE as gp, bF as pp, bG as mp, bH as bp, bI as yp, bJ as wp, bK as kp, bL as vp } from "./cricket-play-a5jHHZVh.js";
1
+ import { H as we, A as Ot, R as de, B as _e, D as hn, E as Eo, F as pt, G as Or, I as ye, J as Ir, K as so, L as To, M as Hr, N as jr, O as ya, P as Ao, Q as ba, S as Cr, T as _r, U as xr, V as Fe, W as Nr, X as De, Y as wa, Z as ka, _ as Zo, $ as Rr, a0 as We, a1 as Ue, a2 as Ne, a3 as zr, a4 as Wr, a5 as Kr, a6 as va, a7 as He, a8 as Ae, a9 as Sa, aa as Fr, ab as ao, ac as Ke, ad as Ma, ae as Dr, af as Lr, ag as $a, ah as Br, ai as qr, aj as Gr, ak as Yr, al as Ur, i as Xr, h as Vr, c as Jr, j as Zr, f as Qr, d as ei, b as ti, e as ni, C as oi, am as si, an as ai, ao as ri, ap as ii, aq as li, ar as hi, as as ci, at as di } from "./cricket-play-qqm3aXd-.js";
2
+ import { au as Uu, av as Xu, aw as Vu, ax as Ju, ay as Zu, az as Qu, aA as eg, aB as tg, aC as ng, aD as og, aE as sg, aF as ag, aG as rg, aH as ig, aI as lg, aJ as hg, aK as cg, aL as dg, aM as fg, aN as ug, aO as gg, aP as pg, aQ as mg, aR as yg, aS as bg, aT as wg, aU as kg, aV as vg, aW as Sg, aX as Mg, aY as $g, aZ as Eg, a_ as Tg, a$ as Ag, b0 as Pg, b1 as Og, b2 as Ig, b3 as Hg, b4 as jg, b5 as Cg, b6 as _g, b7 as xg, b8 as Ng, b9 as Rg, ba as zg, bb as Wg, bc as Kg, bd as Fg, be as Dg, bf as Lg, bg as Bg, bh as qg, bi as Gg, bj as Yg, bk as Ug, bl as Xg, bm as Vg, bn as Jg, bo as Zg, bp as Qg, bq as ep, br as tp, bs as np, bt as op, bu as sp, bv as ap, bw as rp, bx as ip, by as lp, bz as hp, bA as cp, bB as dp, bC as fp, bD as up, bE as gp, bF as pp, bG as mp, bH as yp, bI as bp, bJ as wp, bK as kp, bL as vp } from "./cricket-play-qqm3aXd-.js";
3
3
  import { getEasingFunction as Et, hashSeed as Xe, mat4 as oe, vec3 as ke, quat as Ge, Timeline as ve, unknownName as ce, createRandom as Tt, springFollow as on, closestName as ro } from "@algorisys/tinyfly";
4
4
  import { f as cn, h as fi, a as Ea } from "./load-scene-oWNsYYC1.js";
5
5
  import { l as Ta, f as Aa } from "./shading-0lPgnXmD.js";
@@ -53,7 +53,7 @@ function mi(e, n, t, o) {
53
53
  hands: { left: hn(i.left, l.left, f), right: hn(i.right, l.right, f) }
54
54
  };
55
55
  }
56
- const bi = [
56
+ const yi = [
57
57
  ["leftShoulder", "rightShoulder"],
58
58
  ["leftElbow", "rightElbow"],
59
59
  ["leftWrist", "rightWrist"],
@@ -63,14 +63,14 @@ const bi = [
63
63
  ["leftFootOut", "rightFootOut"],
64
64
  ["leftEye", "rightEye"],
65
65
  ["leftBrow", "rightBrow"]
66
- ], yi = ["lean", "headTilt", "lookX", "spin"], wi = /* @__PURE__ */ new Set(["leftShoulder", "rightShoulder", "leftElbow", "rightElbow", "leftWrist", "rightWrist", "leftHip", "rightHip", "leftKnee", "rightKnee"]);
66
+ ], bi = ["lean", "headTilt", "lookX", "spin"], wi = /* @__PURE__ */ new Set(["leftShoulder", "rightShoulder", "leftElbow", "rightElbow", "leftWrist", "rightWrist", "leftHip", "rightHip", "leftKnee", "rightKnee"]);
67
67
  function ki(e) {
68
68
  const n = { ...e }, t = (e.turn ?? 0) >= 0.5;
69
- for (const [o, r] of bi) {
69
+ for (const [o, r] of yi) {
70
70
  const a = t && wi.has(o) ? -1 : 1;
71
71
  n[o] = a * e[r], n[r] = a * e[o];
72
72
  }
73
- if (!t) for (const o of yi) n[o] = -e[o];
73
+ if (!t) for (const o of bi) n[o] = -e[o];
74
74
  return n;
75
75
  }
76
76
  const vi = (e) => Math.min(1, Math.max(-1, (0.5 - e) * 4));
@@ -192,18 +192,18 @@ function Ti(e, n, t) {
192
192
  }
193
193
  }
194
194
  return { beat: $, travel: u };
195
- }), g = t.start ?? 0, b = t.x ?? 0;
195
+ }), g = t.start ?? 0, y = t.x ?? 0;
196
196
  return {
197
197
  id: `${e}-x`,
198
198
  target: e,
199
199
  property: "x",
200
- keyframes: p.map(($) => ({ time: g + $.beat * 6e4 / r, value: b + t.height * $.travel, easing: "linear" }))
200
+ keyframes: p.map(($) => ({ time: g + $.beat * 6e4 / r, value: y + t.height * $.travel, easing: "linear" }))
201
201
  };
202
202
  }
203
- function bf(e, n, t = 0) {
203
+ function yf(e, n, t = 0) {
204
204
  return (e - t) * n / 6e4;
205
205
  }
206
- function yf(e, n = {}) {
206
+ function bf(e, n = {}) {
207
207
  return (t) => Io(e, t, n);
208
208
  }
209
209
  function wf(e, n) {
@@ -232,21 +232,21 @@ function wf(e, n) {
232
232
  ];
233
233
  }
234
234
  function kf(e, n, t = {}) {
235
- const o = typeof n == "string" ? at[n] : n, r = t.bpm ?? o.bpm, a = t.beats ?? (t.move ? o.moves[t.move].beats : Ho(o)), s = t.samplesPerBeat ?? 4, i = t.start ?? 0, l = Math.round(a * s), c = Array.from({ length: l + 1 }, (g, b) => {
236
- const $ = b / s;
235
+ const o = typeof n == "string" ? at[n] : n, r = t.bpm ?? o.bpm, a = t.beats ?? (t.move ? o.moves[t.move].beats : Ho(o)), s = t.samplesPerBeat ?? 4, i = t.start ?? 0, l = Math.round(a * s), c = Array.from({ length: l + 1 }, (g, y) => {
236
+ const $ = y / s;
237
237
  return { time: i + $ * 6e4 / r, frame: Io(o, $, t) };
238
- }), h = (g, b) => ({
238
+ }), h = (g, y) => ({
239
239
  id: `${e}-${g}`,
240
240
  target: e,
241
241
  property: g,
242
- keyframes: c.map(($) => ({ time: $.time, value: b($.frame) }))
243
- }), f = Object.keys(de).filter((g) => c.some((b) => b.frame.pose[g] !== c[0].frame.pose[g]) || c[0].frame.pose[g] !== de[g]).map((g) => h(g, (b) => b.pose[g])), u = t.height === void 0 ? void 0 : Ti(e, o, { ...t, bpm: r, beats: a, start: i, height: t.height, fade: 0 });
242
+ keyframes: c.map(($) => ({ time: $.time, value: y($.frame) }))
243
+ }), f = Object.keys(de).filter((g) => c.some((y) => y.frame.pose[g] !== c[0].frame.pose[g]) || c[0].frame.pose[g] !== de[g]).map((g) => h(g, (y) => y.pose[g])), u = t.height === void 0 ? void 0 : Ti(e, o, { ...t, bpm: r, beats: a, start: i, height: t.height, fade: 0 });
244
244
  if (u && f.push(u), t.hands === !1) return f;
245
245
  const p = [];
246
246
  for (const g of ["left", "right"])
247
- for (const b of Object.keys(_e)) {
248
- const $ = (A) => A.hands?.[g]?.[b] ?? _e[b];
249
- c.some((A) => $(A.frame) !== _e[b]) && p.push(h(Or(g, b), $));
247
+ for (const y of Object.keys(_e)) {
248
+ const $ = (A) => A.hands?.[g]?.[y] ?? _e[y];
249
+ c.some((A) => $(A.frame) !== _e[y]) && p.push(h(Or(g, y), $));
250
250
  }
251
251
  return [...f, ...p];
252
252
  }
@@ -859,11 +859,11 @@ const Nt = { type: "back", mode: "out", overshoot: 1.1 }, $e = "ease-out-cubic",
859
859
  charleston: Ni,
860
860
  tap: Ri,
861
861
  popping: zi
862
- }, mt = (e, n) => (e % n + n) % n, ts = (e) => e * e * (3 - 2 * e), Ki = (e) => Object.fromEntries(
862
+ }, mt = (e, n) => (e % n + n) % n, ts = (e) => e * e * (3 - 2 * e), Wi = (e) => Object.fromEntries(
863
863
  ["left", "right"].flatMap((n) => Object.entries(we[e]).map(([t, o]) => [`hand.${n}.${t}`, o]))
864
864
  );
865
865
  function zn(e, n = !1) {
866
- const t = Ir(), o = so(t, be, "arm.left", [0.015, 0.68, 0.2], { height: 1 }), r = so(t, o, "arm.right", [-0.015, 0.68, 0.2], { height: 1 });
866
+ const t = Ir(), o = so(t, ye, "arm.left", [0.015, 0.68, 0.2], { height: 1 }), r = so(t, o, "arm.right", [-0.015, 0.68, 0.2], { height: 1 });
867
867
  return Array.from({ length: 32 }, (a, s) => {
868
868
  const i = s / 4, l = Math.floor(i), c = i - l, h = l % 2 === 0, d = Math.sin(Math.PI * c), f = Math.max(0, ...e.map((p) => 1 - Math.min(mt(i - p, 8), mt(p - i, 8)) / 0.5)), u = {
869
869
  side: (h ? 1 : -1) * 5 * Math.sin(Math.PI * c),
@@ -885,7 +885,7 @@ function zn(e, n = !1) {
885
885
  "arm.left.bend": -35 * f,
886
886
  "arm.right.bend": -35 * f,
887
887
  smile: 0.9,
888
- ...Ki(n ? "hold" : "spread")
888
+ ...Wi(n ? "hold" : "spread")
889
889
  };
890
890
  if (!n)
891
891
  for (const p of Object.keys(r)) p.startsWith("arm.") && (u[p] += (r[p] - u[p]) * f);
@@ -902,19 +902,19 @@ function Ha(e) {
902
902
  if (!n || !Number.isFinite(n.beats) || n.beats <= 0 || !Array.isArray(n.keys) || !n.keys.length || !Array.isArray(n.strikes) || !n.keys.every((t, o) => Number.isFinite(t.beat) && t.beat >= 0 && t.beat < n.beats && (o === 0 || t.beat > n.keys[o - 1].beat) && t.pose && Object.values(t.pose).every(Number.isFinite)) || !n.strikes.every((t) => Number.isFinite(t) && t >= 0 && t < n.beats)) throw new Error("humanDanceFrame: a dance with positive finite beats, ordered pose keys and strike beats within its loop is required");
903
903
  return n;
904
904
  }
905
- function fn(e, n, t = be) {
905
+ function fn(e, n, t = ye) {
906
906
  const o = Ha(e);
907
907
  if (!Number.isFinite(n)) throw new Error("humanDanceFrame: beat must be finite");
908
908
  const r = mt(n, o.beats);
909
909
  let a = o.keys.length - 1;
910
- for (let b = 0; b < o.keys.length; b++) o.keys[b].beat <= r && (a = b);
911
- const s = o.keys[a], i = o.keys[(a + 1) % o.keys.length], l = s.beat > r ? s.beat - o.beats : s.beat, c = i.beat <= s.beat ? i.beat + o.beats : i.beat, h = ts((r - l) / (c - s.beat)), d = { ...be, ...t };
912
- for (const b of new Set(o.keys.flatMap(($) => Object.keys($.pose)))) {
913
- if (b === "turn" || b === "roll") continue;
914
- const $ = b.match(/^hand\.(?:left|right)\.(.+)$/)?.[1], A = t[b] ?? be[b] ?? ($ ? _e[$] : void 0) ?? 0, k = s.pose[b] ?? A;
915
- d[b] = k + ((i.pose[b] ?? A) - k) * h;
916
- }
917
- const f = Math.floor(n), u = n - f, p = u <= 0.6 ? 1 : 1 - ts((u - 0.6) / 0.4), g = Math.max(0, ...o.strikes.map((b) => 1 - Math.min(mt(r - b, o.beats), mt(b - r, o.beats)) / 0.25));
910
+ for (let y = 0; y < o.keys.length; y++) o.keys[y].beat <= r && (a = y);
911
+ const s = o.keys[a], i = o.keys[(a + 1) % o.keys.length], l = s.beat > r ? s.beat - o.beats : s.beat, c = i.beat <= s.beat ? i.beat + o.beats : i.beat, h = ts((r - l) / (c - s.beat)), d = { ...ye, ...t };
912
+ for (const y of new Set(o.keys.flatMap(($) => Object.keys($.pose)))) {
913
+ if (y === "turn" || y === "roll") continue;
914
+ const $ = y.match(/^hand\.(?:left|right)\.(.+)$/)?.[1], A = t[y] ?? ye[y] ?? ($ ? _e[$] : void 0) ?? 0, k = s.pose[y] ?? A;
915
+ d[y] = k + ((i.pose[y] ?? A) - k) * h;
916
+ }
917
+ const f = Math.floor(n), u = n - f, p = u <= 0.6 ? 1 : 1 - ts((u - 0.6) / 0.4), g = Math.max(0, ...o.strikes.map((y) => 1 - Math.min(mt(r - y, o.beats), mt(y - r, o.beats)) / 0.25));
918
918
  return { pose: d, contact: { side: mt(f, 2) === 0 ? "left" : "right", start: f, weight: p }, strike: g };
919
919
  }
920
920
  function vf(e, n) {
@@ -922,22 +922,22 @@ function vf(e, n) {
922
922
  if (![o, r, a].every((l) => Number.isFinite(l) && l > 0)) throw new Error("humanDanceTracks: bpm, beats and samplesPerBeat must be positive and finite");
923
923
  if (!Number.isFinite(n.start ?? 0)) throw new Error("humanDanceTracks: start must be finite");
924
924
  const s = Math.max(1, Math.ceil(r * a)), i = Array.from({ length: s + 1 }, (l, c) => ({ time: (n.start ?? 0) + r * c / s * 6e4 / o, pose: fn(t, r * c / s, n.pose).pose }));
925
- return Object.keys(i[0].pose).filter((l) => l !== "turn" && l !== "roll" && i.some((c) => c.pose[l] !== (n.pose?.[l] ?? be[l]))).map((l) => ({
925
+ return Object.keys(i[0].pose).filter((l) => l !== "turn" && l !== "roll" && i.some((c) => c.pose[l] !== (n.pose?.[l] ?? ye[l]))).map((l) => ({
926
926
  id: `${e}-dance-${l}`,
927
927
  target: e,
928
928
  property: l,
929
929
  keyframes: i.map((c) => ({ time: c.time, value: c.pose[l], easing: "linear" }))
930
930
  }));
931
931
  }
932
- const Sn = (e, n) => [e[0] + n[0], e[1] + n[1], e[2] + n[2]], Ce = (e, n) => [e[0] - n[0], e[1] - n[1], e[2] - n[2]], un = (e, n) => [e[0] * n, e[1] * n, e[2] * n], jo = (e) => Math.hypot(...e), ja = (e) => un(e, 1 / (jo(e) || 1)), Mn = (e) => ({ ...be, ...e }), Co = (e) => To(e.character.plan, Mn(e.pose), { height: e.character.height, contact: e.character.contact });
932
+ const Sn = (e, n) => [e[0] + n[0], e[1] + n[1], e[2] + n[2]], Ce = (e, n) => [e[0] - n[0], e[1] - n[1], e[2] - n[2]], un = (e, n) => [e[0] * n, e[1] * n, e[2] * n], jo = (e) => Math.hypot(...e), ja = (e) => un(e, 1 / (jo(e) || 1)), Mn = (e) => ({ ...ye, ...e }), Co = (e) => To(e.character.plan, Mn(e.pose), { height: e.character.height, contact: e.character.contact });
933
933
  function St(e, n, t) {
934
934
  return Sn(e.position, Co(e).chains[n][t]);
935
935
  }
936
936
  function Ca(e, n, t) {
937
- const o = Mn(e.pose), r = Co(e).hip, a = Hr(e.character.plan, o, e.character.height), s = Ce(Ce(t, e.position), r), i = jr(s, (o.roll ?? 0) * Math.PI / 180), l = Sn(a.root, ba(i, -(o.turn ?? 0) * Math.PI / 2));
937
+ const o = Mn(e.pose), r = Co(e).hip, a = Hr(e.character.plan, o, e.character.height), s = Ce(Ce(t, e.position), r), i = jr(s, (o.roll ?? 0) * Math.PI / 180), l = Sn(a.root, ya(i, -(o.turn ?? 0) * Math.PI / 2));
938
938
  return so(e.character.plan, o, n, l, { height: e.character.height });
939
939
  }
940
- function Wi(e, n, t, o = "toe") {
940
+ function Ki(e, n, t, o = "toe") {
941
941
  const r = `leg.${n}`, a = o === "toe" ? 3 : 2;
942
942
  let s = { ...e, pose: Mn(e.pose), position: [...e.position] };
943
943
  for (let l = 0; l < 6; l++) {
@@ -960,10 +960,10 @@ function Sf(e, n, t = {}) {
960
960
  const d = ja([a[0] - c.position[0], o * 0.2, a[2] - c.position[2]]), f = Ce(a, un(d, r));
961
961
  let u = Mn(c.pose);
962
962
  for (let g = 0; g < 6; g++) {
963
- const b = { ...c, pose: u }, $ = St(b, `arm.${h}`, 2);
964
- u = Ca(b, `arm.${h}`, Ce(f, Ce(ns(b, h), $)));
963
+ const y = { ...c, pose: u }, $ = St(y, `arm.${h}`, 2);
964
+ u = Ca(y, `arm.${h}`, Ce(f, Ce(ns(y, h), $)));
965
965
  }
966
- for (const [g, b] of Object.entries(we.hold)) u[`hand.${h}.${g}`] = b;
966
+ for (const [g, y] of Object.entries(we.hold)) u[`hand.${h}.${g}`] = y;
967
967
  const p = ns({ ...c, pose: u }, h);
968
968
  return { pose: u, stick: { grip: p, tip: Sn(p, un(d, r)) } };
969
969
  }, i = s(e, t.sideA ?? "right"), l = s(n, t.sideB ?? "right");
@@ -981,16 +981,16 @@ function Fi(e, n) {
981
981
  const r = n.center ?? [0, 0], a = n.direction ?? 1;
982
982
  if (r.length !== 2 || !r.every(Number.isFinite) || !Number.isFinite(n.angle ?? 0) || !Number.isFinite(n.spins ?? 0) || ![1, -1].includes(a) || n.facing !== void 0 && !(typeof n.facing == "number" ? Number.isFinite(n.facing) : ["inward", "outward", "tangent"].includes(n.facing))) throw new Error("danceCircleAt: center, angle, spins and facing must be finite; direction is 1 or -1");
983
983
  const s = n.character ?? Ao({ height: 1.7 }), i = n.style ?? "garba", l = (h, d) => {
984
- const f = (n.angle ?? 0) + 360 * d / t + a * 360 * h / o, u = f * Math.PI / 180, p = n.facing ?? "inward", g = (typeof p == "number" ? p : f + (p === "inward" ? 180 : p === "tangent" ? a * 90 : 0)) + (n.spins ?? 0) * 360 * h / o, b = fn(i, h, { ...n.pose, turn: g / 90 });
985
- return { character: s, position: [r[0] + n.radius * Math.sin(u), 0, r[1] + n.radius * Math.cos(u)], pose: b.pose, heading: g, strike: b.strike };
984
+ const f = (n.angle ?? 0) + 360 * d / t + a * 360 * h / o, u = f * Math.PI / 180, p = n.facing ?? "inward", g = (typeof p == "number" ? p : f + (p === "inward" ? 180 : p === "tangent" ? a * 90 : 0)) + (n.spins ?? 0) * 360 * h / o, y = fn(i, h, { ...n.pose, turn: g / 90 });
985
+ return { character: s, position: [r[0] + n.radius * Math.sin(u), 0, r[1] + n.radius * Math.cos(u)], pose: y.pose, heading: g, strike: y.strike };
986
986
  }, c = fn(i, e).contact;
987
987
  return Array.from({ length: t }, (h, d) => {
988
988
  const f = l(e, d);
989
989
  if (n.plantFeet === !1) return { ...f, planted: !1 };
990
- const u = l(c.start, d), p = St(u, `leg.${c.side}`, 3), g = Wi(f, c.side, p);
990
+ const u = l(c.start, d), p = St(u, `leg.${c.side}`, 3), g = Ki(f, c.side, p);
991
991
  return {
992
992
  ...f,
993
- pose: ya(f.pose, g.pose, c.weight),
993
+ pose: ba(f.pose, g.pose, c.weight),
994
994
  position: [f.position[0], g.position[1] * c.weight, f.position[2]],
995
995
  planted: g.reached && c.weight === 1
996
996
  };
@@ -1007,7 +1007,7 @@ function Mf(e, n) {
1007
1007
  const f = d.members[c], { turn: u, ...p } = f.pose;
1008
1008
  return { time: d.time, pose: { ...s ? f.pose : p, x: f.position[0], y: f.position[1], z: f.position[2], rotateY: s ? 0 : f.heading } };
1009
1009
  });
1010
- return Object.keys(h[0].pose).filter((d) => i.has(d) || h.some((f) => f.pose[d] !== (n.pose?.[d] ?? be[d]))).map((d) => ({
1010
+ return Object.keys(h[0].pose).filter((d) => i.has(d) || h.some((f) => f.pose[d] !== (n.pose?.[d] ?? ye[d]))).map((d) => ({
1011
1011
  id: `${l}-circle-${d}`,
1012
1012
  target: l,
1013
1013
  property: d,
@@ -1249,7 +1249,7 @@ const $n = {
1249
1249
  ], 1200)
1250
1250
  };
1251
1251
  function Zi(e, n) {
1252
- const t = Math.min(1, Math.max(0, e.turn ?? 0)), o = 1 - t, r = { ...be, turn: t }, a = [
1252
+ const t = Math.min(1, Math.max(0, e.turn ?? 0)), o = 1 - t, r = { ...ye, turn: t }, a = [
1253
1253
  { stick: "right", human: "left", s: 1 },
1254
1254
  { stick: "left", human: "right", s: -1 }
1255
1255
  ];
@@ -1370,13 +1370,13 @@ function _o(e, n, t, o) {
1370
1370
  }
1371
1371
  function xo(e) {
1372
1372
  const { part: n } = e;
1373
- return n.glow && e.glow > 0 && n.fill ? Ka(n.fill, n.glow.color, e.glow) : n.fill;
1373
+ return n.glow && e.glow > 0 && n.fill ? Wa(n.fill, n.glow.color, e.glow) : n.fill;
1374
1374
  }
1375
1375
  function ol(e, n, t) {
1376
1376
  const { part: o } = e;
1377
1377
  if (!o.fill) return;
1378
1378
  const r = za(o.fill, n.light, n.fog ?? 0, t.fog);
1379
- return o.glow && e.glow > 0 ? Ka(r, o.glow.color, e.glow) : r;
1379
+ return o.glow && e.glow > 0 ? Wa(r, o.glow.color, e.glow) : r;
1380
1380
  }
1381
1381
  function Ra(e, n) {
1382
1382
  const t = xo(e);
@@ -1437,7 +1437,7 @@ function za(e, n, t, o) {
1437
1437
  const s = o ? Mt(o) : void 0;
1438
1438
  return s && t > 0 && (a = a.map((i, l) => i + (s[l] - i) * t)), No(a);
1439
1439
  }
1440
- function Ka(e, n, t) {
1440
+ function Wa(e, n, t) {
1441
1441
  const o = Mt(e), r = Mt(n);
1442
1442
  return !o || !r ? t < 0.5 ? e : n : No(o.map((a, s) => a + (r[s] - a) * t));
1443
1443
  }
@@ -1477,19 +1477,19 @@ function dl(e, n, t, o, r) {
1477
1477
  for (const k of t.chains) {
1478
1478
  const m = o.chains[k.id], P = k.id === "spine" ? 1.9 : 1;
1479
1479
  k.bones.forEach((O, v) => {
1480
- const y = m[v], S = m[v + 1], w = ke.distance(y, S), [T, I] = O.width ?? [1, 1], C = h * P * (T + I) / 2;
1480
+ const b = m[v], S = m[v + 1], w = ke.distance(b, S), [T, I] = O.width ?? [1, 1], C = h * P * (T + I) / 2;
1481
1481
  if (w > 1e-6) {
1482
- const j = ke.lerp(y, S, 0.5), K = cl(ke.normalize(ke.subtract(S, y)));
1483
- f(n.cylinder, oe.multiply(oe.translation(j), oe.multiply(K, oe.scaling([C, w, C]))), i);
1482
+ const j = ke.lerp(b, S, 0.5), W = cl(ke.normalize(ke.subtract(S, b)));
1483
+ f(n.cylinder, oe.multiply(oe.translation(j), oe.multiply(W, oe.scaling([C, w, C]))), i);
1484
1484
  }
1485
- u(y, h * P * T, i), u(S, h * P * I, i);
1485
+ u(b, h * P * T, i), u(S, h * P * I, i);
1486
1486
  }), k.id.startsWith("arm.") && u(m[m.length - 1], h * 1.5, l);
1487
1487
  }
1488
- const { center: p, rx: g, ry: b, axes: $ } = o.head, A = [...$[0], 0, ...$[1], 0, ...$[2], 0, ...p, 1];
1489
- f(n.sphere, oe.multiply(A, oe.scaling([g, b, g])), l);
1488
+ const { center: p, rx: g, ry: y, axes: $ } = o.head, A = [...$[0], 0, ...$[1], 0, ...$[2], 0, ...p, 1];
1489
+ f(n.sphere, oe.multiply(A, oe.scaling([g, y, g])), l);
1490
1490
  for (const k of [-1, 1]) {
1491
- const m = ke.normalize([k * 0.36, 0.15, 0.92]), P = ke.add(p, ke.add(ke.add(ke.scale($[0], m[0] * g * 1.04), ke.scale($[1], m[1] * b * 1.04)), ke.scale($[2], m[2] * g * 1.04))), O = [...$[0], 0, ...$[1], 0, ...$[2], 0, ...P, 1];
1492
- f(n.sphere, oe.multiply(O, oe.scaling([g * 0.11, b * 0.14, g * 0.03])), c);
1491
+ const m = ke.normalize([k * 0.36, 0.15, 0.92]), P = ke.add(p, ke.add(ke.add(ke.scale($[0], m[0] * g * 1.04), ke.scale($[1], m[1] * y * 1.04)), ke.scale($[2], m[2] * g * 1.04))), O = [...$[0], 0, ...$[1], 0, ...$[2], 0, ...P, 1];
1492
+ f(n.sphere, oe.multiply(O, oe.scaling([g * 0.11, y * 0.14, g * 0.03])), c);
1493
1493
  }
1494
1494
  return d;
1495
1495
  }
@@ -1509,36 +1509,36 @@ const Tf = {
1509
1509
  // `lights` may be missing from a scene entry older than this add-on: treated as none.
1510
1510
  resolve({ object: e, prepared: n, values: t, world: o, camera: r, lights: a = [], fog: s, toScreen: i }) {
1511
1511
  const l = e, c = n, h = c.who;
1512
- let d = { ...be, ...l.pose };
1513
- for (const [y, S] of t)
1514
- typeof S == "number" && !rl.has(y) && !il.has(y) && (d[y] = S);
1512
+ let d = { ...ye, ...l.pose };
1513
+ for (const [b, S] of t)
1514
+ typeof S == "number" && !rl.has(b) && !il.has(b) && (d[b] = S);
1515
1515
  const f = Math.max(0, Math.min(1, rs(t.get("walking")) ?? l.walking ?? 0));
1516
1516
  if (f > 0) {
1517
- const y = typeof t.get("gait") == "string" ? t.get("gait") : l.gait, S = _r(y, rs(t.get("walk")) ?? 0, d);
1517
+ const b = typeof t.get("gait") == "string" ? t.get("gait") : l.gait, S = _r(b, rs(t.get("walk")) ?? 0, d);
1518
1518
  d = Object.fromEntries(Object.keys({ ...d, ...S }).map((w) => [w, (d[w] ?? 0) + ((S[w] ?? 0) - (d[w] ?? 0)) * f]));
1519
1519
  }
1520
1520
  const u = l.height ?? ll, p = oe.multiply(r.view, o), g = {
1521
- toView: (y) => oe.transformPoint(p, y),
1522
- toScreen: (y) => i(y)
1521
+ toView: (b) => oe.transformPoint(p, b),
1522
+ toScreen: (b) => i(b)
1523
1523
  }, $ = -g.toView([0, u / 2, 0])[2];
1524
1524
  if ($ <= r.near) return null;
1525
- const A = l.shadow === !1 ? [] : [{ depth: $ + u, draw: (y) => hl(y, g, u * 0.18) }];
1525
+ const A = l.shadow === !1 ? [] : [{ depth: $ + u, draw: (b) => hl(b, g, u * 0.18) }];
1526
1526
  if (l.look === "solid") {
1527
- const y = To(h.plan, d, { height: u, contact: h.contact });
1528
- return { meshes: dl(l, c, h.plan, y, o), drawables: A };
1527
+ const b = To(h.plan, d, { height: u, contact: h.contact });
1528
+ return { meshes: dl(l, c, h.plan, b, o), drawables: A };
1529
1529
  }
1530
- const k = oe.transformPoint(o, [0, u * 0.6, 0]), m = ke.normalize(ke.subtract(r.position, k)), P = Ta(k, m, a).map((y) => Math.min(1, y));
1530
+ const k = oe.transformPoint(o, [0, u * 0.6, 0]), m = ke.normalize(ke.subtract(r.position, k)), P = Ta(k, m, a).map((b) => Math.min(1, b));
1531
1531
  let O = h;
1532
1532
  if (a.length > 0 && h.skin !== "none") {
1533
- const y = za(h.skin, P, Aa(s, ke.distance(k, r.position)), s?.color);
1534
- O = { ...h, skin: y, ...h.body ? { body: { ...h.body, fill: y } } : {} };
1533
+ const b = za(h.skin, P, Aa(s, ke.distance(k, r.position)), s?.color);
1534
+ O = { ...h, skin: b, ...h.body ? { body: { ...h.body, fill: b } } : {} };
1535
1535
  }
1536
1536
  const v = xr(O, d, g, { height: u });
1537
1537
  return {
1538
1538
  drawables: [
1539
1539
  ...A,
1540
1540
  // Ties keep the character's own order.
1541
- ...v.map((y, S) => ({ depth: -(y.sortDepth ?? y.depth) - S * 1e-6, draw: (w, T) => y.draw(w, T.time) }))
1541
+ ...v.map((b, S) => ({ depth: -(b.sortDepth ?? b.depth) - S * 1e-6, draw: (w, T) => b.draw(w, T.time) }))
1542
1542
  ]
1543
1543
  };
1544
1544
  }
@@ -1623,7 +1623,7 @@ function ml(e) {
1623
1623
  for (; n.length > 0 && (n[n.length - 1].viseme === "rest" || n[n.length - 1].weight === is); ) n.pop();
1624
1624
  return n;
1625
1625
  }
1626
- function Wa(e, n = {}) {
1626
+ function Ka(e, n = {}) {
1627
1627
  const t = n.fields?.mouth ?? "mouth", o = n.fields?.mouthWidth ?? "mouthWidth", r = n.energy ?? 1, a = ml(e.text), s = [{ time: e.start, value: Ze.rest.mouth }], i = [{ time: e.start, value: Ze.rest.mouthWidth }], l = a.reduce((h, d) => h + d.weight, 0), c = e.end - e.start;
1628
1628
  if (l > 0 && c > 0) {
1629
1629
  let h = e.start;
@@ -1641,7 +1641,7 @@ function Wa(e, n = {}) {
1641
1641
  function Af(e, n, t = {}) {
1642
1642
  const o = {};
1643
1643
  for (const r of [...n].sort((a, s) => a.start - s.start))
1644
- for (const [a, s] of Object.entries(Wa(r, t))) {
1644
+ for (const [a, s] of Object.entries(Ka(r, t))) {
1645
1645
  const i = o[a] ??= [], l = i.length > 0 ? i[i.length - 1].time : -1 / 0;
1646
1646
  i.push(...s.filter((c) => c.time > l));
1647
1647
  }
@@ -1654,8 +1654,8 @@ function zo(e, n, t, o = {}) {
1654
1654
  const f = n.find((p) => p.target === e && p.property === d);
1655
1655
  let u = f ? [...f.keyframes] : [{ time: 0, value: l(d, 0) }];
1656
1656
  for (const p of t) {
1657
- const g = Wa(p, o)[d];
1658
- g[0] = { ...g[0], value: l(d, p.start) }, g[g.length - 1] = { ...g[g.length - 1], value: l(d, p.end) }, u = [...u.filter((b) => b.time < p.start || b.time > p.end), ...g], u.sort((b, $) => b.time - $.time);
1657
+ const g = Ka(p, o)[d];
1658
+ g[0] = { ...g[0], value: l(d, p.start) }, g[g.length - 1] = { ...g[g.length - 1], value: l(d, p.end) }, u = [...u.filter((y) => y.time < p.start || y.time > p.end), ...g], u.sort((y, $) => y.time - $.time);
1659
1659
  }
1660
1660
  h.push({ id: f?.id ?? `${e}-${d}`, target: e, property: d, keyframes: u });
1661
1661
  }
@@ -1665,7 +1665,7 @@ const Rt = ([e, n, t]) => {
1665
1665
  const o = Math.hypot(e, n, t) || 1;
1666
1666
  return [e / o, n / o, t / o];
1667
1667
  };
1668
- function bl([e, n, t]) {
1668
+ function yl([e, n, t]) {
1669
1669
  const [o, r, a] = [e / 2, n / 2, t / 2];
1670
1670
  return {
1671
1671
  vertices: [
@@ -1689,7 +1689,7 @@ function bl([e, n, t]) {
1689
1689
  };
1690
1690
  }
1691
1691
  const ct = (e, [n, t, o]) => e === "z" ? [n, t, o] : e === "x" ? [o, t, n] : [n, o, t];
1692
- function yl(e, n, t = "x", o = 20, r = 0) {
1692
+ function bl(e, n, t = "x", o = 20, r = 0) {
1693
1693
  const a = [], s = n / 2;
1694
1694
  for (const c of [-s, s])
1695
1695
  for (let h = 0; h < o; h++) {
@@ -1771,8 +1771,8 @@ function Ml(e, n, t = 8) {
1771
1771
  e.forEach((s, i) => {
1772
1772
  const l = e[Math.min(i + 1, e.length - 1)], c = e[Math.max(i - 1, 0)], h = Rt([l[0] - c[0], l[1] - c[1], l[2] - c[2]]), d = Math.abs(h[1]) < 0.9 ? [0, 1, 0] : [1, 0, 0], f = Rt(gs(h, d)), u = gs(f, h);
1773
1773
  for (let p = 0; p < t; p++) {
1774
- const g = Math.PI * 2 * p / t, b = Math.cos(g) * o(i), $ = Math.sin(g) * o(i);
1775
- r.push([s[0] + f[0] * b + u[0] * $, s[1] + f[1] * b + u[1] * $, s[2] + f[2] * b + u[2] * $]);
1774
+ const g = Math.PI * 2 * p / t, y = Math.cos(g) * o(i), $ = Math.sin(g) * o(i);
1775
+ r.push([s[0] + f[0] * y + u[0] * $, s[1] + f[1] * y + u[1] * $, s[2] + f[2] * y + u[2] * $]);
1776
1776
  }
1777
1777
  });
1778
1778
  for (let s = 0; s < e.length - 1; s++)
@@ -1788,9 +1788,9 @@ function gs(e, n) {
1788
1788
  function $l(e) {
1789
1789
  switch (e.type) {
1790
1790
  case "box":
1791
- return bl(e.size);
1791
+ return yl(e.size);
1792
1792
  case "cylinder":
1793
- return yl(e.radius, e.length, e.axis, e.segments, e.spokes);
1793
+ return bl(e.radius, e.length, e.axis, e.segments, e.spokes);
1794
1794
  case "ellipsoid":
1795
1795
  return wl(e.radii, e.segments);
1796
1796
  case "extrude":
@@ -1806,8 +1806,8 @@ function Fa(e, n) {
1806
1806
  const t = (r) => e[Math.max(0, Math.min(e.length - 1, r))], o = (r) => {
1807
1807
  const a = r * (e.length - 1), s = Math.min(e.length - 2, Math.floor(a)), i = a - s, [l, c, h, d] = [t(s - 1), t(s), t(s + 1), t(s + 2)];
1808
1808
  return [0, 1, 2].map((f) => {
1809
- const u = l[f], p = c[f], g = h[f], b = d[f];
1810
- return 0.5 * (2 * p + (-u + g) * i + (2 * u - 5 * p + 4 * g - b) * i * i + (-u + 3 * p - 3 * g + b) * i * i * i);
1809
+ const u = l[f], p = c[f], g = h[f], y = d[f];
1810
+ return 0.5 * (2 * p + (-u + g) * i + (2 * u - 5 * p + 4 * g - y) * i * i + (-u + 3 * p - 3 * g + y) * i * i * i);
1811
1811
  });
1812
1812
  };
1813
1813
  return Array.from({ length: n }, (r, a) => o(a / (n - 1)));
@@ -1820,7 +1820,7 @@ function Da(e) {
1820
1820
  const n = e.map((t, o) => ({ frame: t, i: o })).sort((t, o) => t.frame.time - o.frame.time || t.i - o.i).map(({ frame: t }) => t);
1821
1821
  return n.filter((t, o) => o + 1 >= n.length || n[o + 1].time !== t.time);
1822
1822
  }
1823
- function bt(e, n) {
1823
+ function yt(e, n) {
1824
1824
  return Math.atan2(n[0] - e[0], n[1] - e[1]) * 180 / Math.PI;
1825
1825
  }
1826
1826
  function La(e) {
@@ -1849,9 +1849,9 @@ function qa(e, n) {
1849
1849
  }
1850
1850
  return (t + o) / 2;
1851
1851
  }
1852
- const Ht = 520, ps = ["do", "at", "for", "to", "through", "toward", "speed", "pose", "gag", "say", "look", "turns", "dance", "bpm", "beats"], El = (e) => Math.max(700, Array.from(e).length * 65), ms = 70, bs = 35;
1852
+ const Ht = 520, ps = ["do", "at", "for", "to", "through", "toward", "speed", "pose", "gag", "say", "look", "turns", "dance", "bpm", "beats"], El = (e) => Math.max(700, Array.from(e).length * 65), ms = 70, ys = 35;
1853
1853
  function Ga(e, n) {
1854
- const t = n[0] - e.x, o = n[1] - e.eyeHeight, r = n[2] - e.z, a = e.heading * Math.PI / 180, s = t * Math.cos(a) - r * Math.sin(a), i = t * Math.sin(a) + r * Math.cos(a), l = Math.atan2(s, i) * 180 / Math.PI, c = Math.hypot(s, i), h = -Math.atan2(o, c) * 180 / Math.PI, d = Math.max(-ms, Math.min(ms, l * 0.75)), f = Math.max(-bs, Math.min(bs, h * 0.7));
1854
+ const t = n[0] - e.x, o = n[1] - e.eyeHeight, r = n[2] - e.z, a = e.heading * Math.PI / 180, s = t * Math.cos(a) - r * Math.sin(a), i = t * Math.sin(a) + r * Math.cos(a), l = Math.atan2(s, i) * 180 / Math.PI, c = Math.hypot(s, i), h = -Math.atan2(o, c) * 180 / Math.PI, d = Math.max(-ms, Math.min(ms, l * 0.75)), f = Math.max(-ys, Math.min(ys, h * 0.7));
1855
1855
  return {
1856
1856
  "head.turn": d,
1857
1857
  "head.nod": f,
@@ -1868,7 +1868,7 @@ const Tl = {
1868
1868
  tired: 0.8,
1869
1869
  run: 3.6,
1870
1870
  shove: 0.7
1871
- }, co = Object.keys(De), Kn = Object.keys(Fe), Wn = Object.keys(ka), Al = 0.25, Pl = 700 / 180, Ol = 200, Il = 300;
1871
+ }, co = Object.keys(De), Wn = Object.keys(Fe), Kn = Object.keys(ka), Al = 0.25, Pl = 700 / 180, Ol = 200, Il = 300;
1872
1872
  function Hl(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 n = [...co, "face", "spin", "dance", "hold", "pose", "gag", "place", "say", "look"], t = [];
@@ -1877,7 +1877,7 @@ function Hl(e) {
1877
1877
  if (!o || typeof o != "object" || Array.isArray(o)) return a("Each beat must be an object like { do: 'walk', to: [x, z] }.");
1878
1878
  const s = o, i = { duration: "for", path: "through", position: "to", heading: "toward", direction: "toward" };
1879
1879
  for (const c of Object.keys(s)) ps.includes(c) || a(ce("beat field", c, ps, i[c]));
1880
- const l = typeof s.do == "string" ? Kn.includes(s.do) ? "pose" : Wn.includes(s.do) ? "gag" : s.do === "turn" ? "face" : void 0 : void 0;
1880
+ const l = typeof s.do == "string" ? Wn.includes(s.do) ? "pose" : Kn.includes(s.do) ? "gag" : s.do === "turn" ? "face" : void 0 : void 0;
1881
1881
  if (typeof s.do != "string" || !n.includes(s.do)) return a(ce("character 3D beat", s.do, n, l));
1882
1882
  for (const c of ["at", "for", "turns", "bpm", "beats"]) {
1883
1883
  const h = s[c];
@@ -1887,7 +1887,7 @@ function Hl(e) {
1887
1887
  const c = s.look ?? s.toward;
1888
1888
  Array.isArray(c) && (c.length === 2 || c.length === 3) && c.every((d) => typeof d == "number" && Number.isFinite(d)) || c === "camera" || a("`look` needs `look`: a point [x, z] or [x, y, z] to look at, or `camera`.");
1889
1889
  }
1890
- s.do === "pose" && !(typeof s.pose == "object" && s.pose !== null) && !Kn.includes(s.pose) && a(ce("pose", s.pose, Kn)), s.do === "gag" && !Wn.includes(s.gag) && a(ce("gag", s.gag, Wn));
1890
+ s.do === "pose" && !(typeof s.pose == "object" && s.pose !== null) && !Wn.includes(s.pose) && a(ce("pose", s.pose, Wn)), s.do === "gag" && !Kn.includes(s.gag) && a(ce("gag", s.gag, Kn));
1891
1891
  }), t;
1892
1892
  }
1893
1893
  function Pf(e, n, t) {
@@ -1895,100 +1895,100 @@ function Pf(e, n, t) {
1895
1895
  if (o.length > 0) throw new Error(`characterScript3D: ${o.length} problem(s) in the beats:
1896
1896
  ${o.map((v) => ` beat ${v.beat}: ${v.message}`).join(`
1897
1897
  `)}`);
1898
- const r = t.height ?? 1.7, a = { ...be, ...t.pose }, s = (v, y = a) => {
1898
+ const r = t.height ?? 1.7, a = { ...ye, ...t.pose }, s = (v, b = a) => {
1899
1899
  const S = v.match(/^hand\.(?:left|right)\.(.+)$/)?.[1];
1900
- return y[v] ?? be[v] ?? (S ? _e[S] : void 0) ?? 0;
1900
+ return b[v] ?? ye[v] ?? (S ? _e[S] : void 0) ?? 0;
1901
1901
  };
1902
1902
  let [i, l] = t.position ?? [0, 0], c = t.heading ?? 0, h = 0;
1903
- const d = /* @__PURE__ */ new Map(), f = [], u = (v, y, S, w = "linear") => {
1903
+ const d = /* @__PURE__ */ new Map(), f = [], u = (v, b, S, w = "linear") => {
1904
1904
  const T = d.get(v) ?? [];
1905
- T.push({ time: y, value: S, easing: w }), d.set(v, T);
1906
- }, p = (v, y, S) => {
1905
+ T.push({ time: b, value: S, easing: w }), d.set(v, T);
1906
+ }, p = (v, b, S) => {
1907
1907
  const w = d.get(v) ?? [];
1908
1908
  for (let T = w.length - 1; T >= 0; T--)
1909
- if (w[T].time === y) {
1909
+ if (w[T].time === b) {
1910
1910
  if (w[T].value === S) return;
1911
1911
  break;
1912
1912
  }
1913
- u(v, y, S);
1913
+ u(v, b, S);
1914
1914
  };
1915
1915
  u("x", 0, i), u("z", 0, l), u("rotateY", 0, c);
1916
- const g = (v, y, S) => {
1917
- const w = pn(c, y);
1916
+ const g = (v, b, S) => {
1917
+ const w = pn(c, b);
1918
1918
  if (Math.abs(w) < 1)
1919
1919
  return S !== void 0 && (p("rotateY", v, c), u("rotateY", v + S, c)), v + (S ?? 0);
1920
1920
  const T = S ?? Math.max(Ol, Math.abs(w) * Pl);
1921
1921
  return p("rotateY", v, c), c += w, u("rotateY", v + T, c, "ease-in-out"), v + T;
1922
- }, b = (v, y, S, w = "ease-in-out") => {
1922
+ }, y = (v, b, S, w = "ease-in-out") => {
1923
1923
  for (const [T, I] of Object.entries(S))
1924
- s(T) !== I && (p(T, v, s(T)), u(T, y, I, w), a[T] = I);
1925
- }, $ = (v, y, S) => {
1926
- const w = La([[i, l], ...y.through ?? [y.to]]);
1924
+ s(T) !== I && (p(T, v, s(T)), u(T, b, I, w), a[T] = I);
1925
+ }, $ = (v, b, S) => {
1926
+ const w = La([[i, l], ...b.through ?? [b.to]]);
1927
1927
  if (w.length < 2) return S;
1928
- const T = g(S, bt(w[0].point, w[1].point)), I = w[w.length - 1].at, C = y.speed ?? Tl[v] * Math.sqrt(r / 1.7), j = y.for ?? I / C * 1e3, K = wa(v, r), G = Et("ease-in-out"), Y = Math.min(Il, j / 4);
1928
+ const T = g(S, yt(w[0].point, w[1].point)), I = w[w.length - 1].at, C = b.speed ?? Tl[v] * Math.sqrt(r / 1.7), j = b.for ?? I / C * 1e3, W = wa(v, r), G = Et("ease-in-out"), Y = Math.min(Il, j / 4);
1929
1929
  f.push({ time: T, value: v }), p("walking", T, 0), u("walking", T + Y, 1, "ease-out"), u("walking", T + j - Y, 1), u("walking", T + j, 0, "ease-in");
1930
1930
  const ne = h;
1931
1931
  let B = c;
1932
1932
  for (let H = 0; ; H = Math.min(I, H + Al)) {
1933
1933
  const N = T + qa(G, H / I) * j, { point: R, direction: M } = Ba(w, H);
1934
- B += pn(B, bt([0, 0], M));
1934
+ B += pn(B, yt([0, 0], M));
1935
1935
  const _ = H === 0 ? p : u;
1936
- if (_("x", N, R[0]), _("z", N, R[1]), _("rotateY", N, B), _("walk", N, ne + H / K), H >= I) break;
1936
+ if (_("x", N, R[0]), _("z", N, R[1]), _("rotateY", N, B), _("walk", N, ne + H / W), H >= I) break;
1937
1937
  }
1938
- return h = ne + I / K, [i, l] = w[w.length - 1].point, c = B, T + j;
1938
+ return h = ne + I / W, [i, l] = w[w.length - 1].point, c = B, T + j;
1939
1939
  }, A = [], k = [];
1940
1940
  let m = 0;
1941
1941
  for (const v of n) {
1942
- const y = v.at ?? m;
1943
- let S = y;
1944
- if (co.includes(v.do)) S = $(v.do, v, y);
1945
- else if (v.do === "face") S = g(y, typeof v.toward == "number" ? v.toward : bt([i, l], v.toward), v.for);
1942
+ const b = v.at ?? m;
1943
+ let S = b;
1944
+ if (co.includes(v.do)) S = $(v.do, v, b);
1945
+ else if (v.do === "face") S = g(b, typeof v.toward == "number" ? v.toward : yt([i, l], v.toward), v.for);
1946
1946
  else if (v.do === "spin")
1947
- S = y + (v.for ?? 1e3), p("rotateY", y, c), c += (v.turns ?? 1) * 360, u("rotateY", S, c, "linear");
1947
+ S = b + (v.for ?? 1e3), p("rotateY", b, c), c += (v.turns ?? 1) * 360, u("rotateY", S, c, "linear");
1948
1948
  else if (v.do === "dance") {
1949
1949
  const w = vt[v.dance], T = v.bpm ?? w.bpm, I = v.beats ?? (v.for !== void 0 ? v.for * T / 6e4 : w.beats);
1950
- S = y + (v.for ?? I * 6e4 / T);
1951
- const C = { ...a }, j = Math.max(1, Math.ceil(I * 16)), K = Array.from({ length: j + 1 }, (Y, ne) => fn(v.dance, I * ne / j, C).pose), G = Math.min(150, (S - y) / 4);
1952
- for (const Y of Object.keys(K[0])) {
1950
+ S = b + (v.for ?? I * 6e4 / T);
1951
+ const C = { ...a }, j = Math.max(1, Math.ceil(I * 16)), W = Array.from({ length: j + 1 }, (Y, ne) => fn(v.dance, I * ne / j, C).pose), G = Math.min(150, (S - b) / 4);
1952
+ for (const Y of Object.keys(W[0])) {
1953
1953
  const ne = s(Y, C);
1954
- Y === "turn" || Y === "roll" || K.every((B) => B[Y] === ne) || (p(Y, y, ne), K.slice(1).forEach((B, H) => {
1955
- const N = y + (S - y) * (H + 1) / j, R = Math.min(1, (N - y) / G), M = R * R * (3 - 2 * R);
1954
+ Y === "turn" || Y === "roll" || W.every((B) => B[Y] === ne) || (p(Y, b, ne), W.slice(1).forEach((B, H) => {
1955
+ const N = b + (S - b) * (H + 1) / j, R = Math.min(1, (N - b) / G), M = R * R * (3 - 2 * R);
1956
1956
  u(Y, N, ne + (B[Y] - ne) * M);
1957
- }), a[Y] = K[j][Y]);
1957
+ }), a[Y] = W[j][Y]);
1958
1958
  }
1959
- } else if (v.do === "hold") S = y + (v.for ?? 1e3);
1959
+ } else if (v.do === "hold") S = b + (v.for ?? 1e3);
1960
1960
  else if (v.do === "place")
1961
- p("x", y, i), p("z", y, l), [i, l] = v.to, u("x", y + 1, i), u("z", y + 1, l), typeof v.toward == "number" && (p("rotateY", y, c), c = v.toward, u("rotateY", y + 1, c)), S = y + 1;
1961
+ p("x", b, i), p("z", b, l), [i, l] = v.to, u("x", b + 1, i), u("z", b + 1, l), typeof v.toward == "number" && (p("rotateY", b, c), c = v.toward, u("rotateY", b + 1, c)), S = b + 1;
1962
1962
  else if (v.do === "pose") {
1963
- S = y + (v.for ?? 500);
1963
+ S = b + (v.for ?? 500);
1964
1964
  const w = typeof v.pose == "string" ? Fe[v.pose] : v.pose;
1965
- b(y, S, w);
1965
+ y(b, S, w);
1966
1966
  } else if (v.do === "gag") {
1967
- const w = Nr(v.gag, { at: y, from: { ...a } });
1967
+ const w = Nr(v.gag, { at: b, from: { ...a } });
1968
1968
  let T = w[0];
1969
1969
  for (const I of w.slice(1))
1970
- b(T.time, I.time, Object.fromEntries(Object.entries(I.pose).filter(([C, j]) => a[C] !== j)), I.easing ?? "ease-in-out"), T = I;
1970
+ y(T.time, I.time, Object.fromEntries(Object.entries(I.pose).filter(([C, j]) => a[C] !== j)), I.easing ?? "ease-in-out"), T = I;
1971
1971
  S = T.time;
1972
1972
  } else if (v.do === "say") {
1973
- S = y + (v.for ?? El(v.say)), k.push({ text: v.say, start: y, end: S });
1973
+ S = b + (v.for ?? El(v.say)), k.push({ text: v.say, start: b, end: S });
1974
1974
  const w = { tilt: a["head.tilt"] ?? 0, left: a["brow.left"] ?? 0, right: a["brow.right"] ?? 0 };
1975
1975
  let T = 0;
1976
- for (let I = y + Ht; I < S - Ht / 2; I += Ht, T++) {
1976
+ for (let I = b + Ht; I < S - Ht / 2; I += Ht, T++) {
1977
1977
  const C = T % 2 === 0;
1978
- b(I - Ht / 2, I, { "head.tilt": w.tilt + (C ? 3 : -2), "brow.left": w.left + (C ? 0.25 : 0), "brow.right": w.right + (C ? 0.25 : 0) });
1978
+ y(I - Ht / 2, I, { "head.tilt": w.tilt + (C ? 3 : -2), "brow.left": w.left + (C ? 0.25 : 0), "brow.right": w.right + (C ? 0.25 : 0) });
1979
1979
  }
1980
- T > 0 && b(S - Ht / 2, S, { "head.tilt": w.tilt, "brow.left": w.left, "brow.right": w.right });
1980
+ T > 0 && y(S - Ht / 2, S, { "head.tilt": w.tilt, "brow.left": w.left, "brow.right": w.right });
1981
1981
  } else if (v.do === "look") {
1982
1982
  const w = v.look ?? v.toward, T = r * 0.9, I = w === "camera" ? t.camera ?? [0, 1.6, 8] : w.length === 3 ? w : [w[0], T, w[1]];
1983
- S = y + (v.for ?? 500), b(y, S, Ga({ x: i, z: l, heading: c, eyeHeight: T }, I), "ease-out");
1983
+ S = b + (v.for ?? 500), y(b, S, Ga({ x: i, z: l, heading: c, eyeHeight: T }, I), "ease-out");
1984
1984
  }
1985
- A.push({ do: v.do, start: y, end: S }), m = S;
1985
+ A.push({ do: v.do, start: b, end: S }), m = S;
1986
1986
  }
1987
1987
  const P = `${t.scene}/${e}`;
1988
- let O = [...d].map(([v, y]) => ({ id: `${e}-${v}`, target: P, property: v, keyframes: Da(y) }));
1989
- return f.length > 0 && O.push({ id: `${e}-gait`, target: P, property: "gait", keyframes: f }), k.length > 0 && (O = zo(P, O, k, { rest: { mouth: t.pose?.mouth ?? be.mouth ?? 0, mouthWidth: t.pose?.mouthWidth ?? be.mouthWidth ?? 1 } })), { tracks: O, duration: m, beats: A, end: { position: [i, l], heading: c, pose: { ...a } } };
1988
+ let O = [...d].map(([v, b]) => ({ id: `${e}-${v}`, target: P, property: v, keyframes: Da(b) }));
1989
+ return f.length > 0 && O.push({ id: `${e}-gait`, target: P, property: "gait", keyframes: f }), k.length > 0 && (O = zo(P, O, k, { rest: { mouth: t.pose?.mouth ?? ye.mouth ?? 0, mouthWidth: t.pose?.mouthWidth ?? ye.mouthWidth ?? 1 } })), { tracks: O, duration: m, beats: A, end: { position: [i, l], heading: c, pose: { ...a } } };
1990
1990
  }
1991
- function ys(e, n, t = [0, 0, 0]) {
1991
+ function bs(e, n, t = [0, 0, 0]) {
1992
1992
  const o = e.filter((a) => a.target === n), r = new ve({ id: `${n}-position`, tracks: o });
1993
1993
  return (a) => {
1994
1994
  const s = r.getStateAtTime(a).values.get(n), i = s?.get("position");
@@ -2001,17 +2001,17 @@ function ys(e, n, t = [0, 0, 0]) {
2001
2001
  };
2002
2002
  }
2003
2003
  function Of(e, n) {
2004
- const t = `${n.scene}/${n.character}`, o = n.height ?? 1.7, r = Math.max(1, n.every ?? 66), a = n.objects?.[n.character] ?? [0, 0, 0], s = new ve({ id: `${t}-own`, tracks: e.filter((d) => d.target === t) }), i = n.at, l = typeof i == "function" ? i : Array.isArray(i) ? () => i : "camera" in i ? ys(e, `${n.scene}/${i.camera}`, n.objects?.[i.camera] ?? [0, 1.6, 8]) : (() => {
2005
- const d = ys(e, `${n.scene}/${i.object}`, n.objects?.[i.object] ?? [0, 0, 0]), f = i.eyeHeight ?? o * 0.9;
2004
+ const t = `${n.scene}/${n.character}`, o = n.height ?? 1.7, r = Math.max(1, n.every ?? 66), a = n.objects?.[n.character] ?? [0, 0, 0], s = new ve({ id: `${t}-own`, tracks: e.filter((d) => d.target === t) }), i = n.at, l = typeof i == "function" ? i : Array.isArray(i) ? () => i : "camera" in i ? bs(e, `${n.scene}/${i.camera}`, n.objects?.[i.camera] ?? [0, 1.6, 8]) : (() => {
2005
+ const d = bs(e, `${n.scene}/${i.object}`, n.objects?.[i.object] ?? [0, 0, 0]), f = i.eyeHeight ?? o * 0.9;
2006
2006
  return (u) => {
2007
2007
  const p = d(u);
2008
2008
  return [p[0], p[1] + f, p[2]];
2009
2009
  };
2010
2010
  })(), c = ["head.turn", "head.nod", "lookX", "lookY"], h = { "head.turn": [], "head.nod": [], lookX: [], lookY: [] };
2011
2011
  for (let d = n.start; ; d = Math.min(n.end, d + r)) {
2012
- const f = s.getStateAtTime(d).values.get(t), u = (g, b) => {
2012
+ const f = s.getStateAtTime(d).values.get(t), u = (g, y) => {
2013
2013
  const $ = f?.get(g);
2014
- return typeof $ == "number" ? $ : b;
2014
+ return typeof $ == "number" ? $ : y;
2015
2015
  }, p = Ga({ x: u("x", a[0]), z: u("z", a[2]), heading: u("rotateY", 0), eyeHeight: u("y", a[1]) + o * 0.9 }, l(d));
2016
2016
  for (const g of c) h[g].push({ time: d, value: p[g] ?? 0 });
2017
2017
  if (d >= n.end) break;
@@ -2033,7 +2033,7 @@ function If(e) {
2033
2033
  const d = () => (h ^= h << 13, h >>>= 0, h ^= h >> 17, h ^= h << 5, h >>>= 0, h / 4294967296), f = [];
2034
2034
  for (let u = 0; u < n; u++) {
2035
2035
  let p = [t, o], g = -1 / 0;
2036
- for (let b = 0; b < 24; b++) {
2036
+ for (let y = 0; y < 24; y++) {
2037
2037
  const $ = Math.sqrt(d()) * r * Math.max(1, Math.sqrt(n) * 0.9), A = d() * Math.PI * 2, k = [t + Math.cos(A) * $, o + Math.sin(A) * $], m = f.length === 0 ? 1 / 0 : Math.min(...f.map((P) => Math.hypot(P[0] - k[0], P[1] - k[1])));
2038
2038
  if (m > g && (g = m, p = k), m >= r) break;
2039
2039
  }
@@ -2046,8 +2046,8 @@ function If(e) {
2046
2046
  const d = n === 1 ? 0 : h / (n - 1) - 0.5, f = d * l;
2047
2047
  let u = t + Math.sin(i) * f, p = o + Math.cos(i) * f, g = ((e.heading ?? 90) - 90 + 360) % 360;
2048
2048
  if (a === "arc") {
2049
- const b = (1 - Math.cos(d * c)) * l * 0.5;
2050
- u -= Math.cos(i) * b, p += Math.sin(i) * b, g = (g - d * (e.bend ?? 60) + 360) % 360;
2049
+ const y = (1 - Math.cos(d * c)) * l * 0.5;
2050
+ u -= Math.cos(i) * y, p += Math.sin(i) * y, g = (g - d * (e.bend ?? 60) + 360) % 360;
2051
2051
  }
2052
2052
  s.push({ position: [u, p], heading: g });
2053
2053
  }
@@ -2091,12 +2091,12 @@ function Xa(e, n, t = {}, o) {
2091
2091
  const r = t.tool ?? "pencil", a = t.skin ?? "#f1c9a5", s = t.outline ?? "#2f2f33", i = t.scale ?? 1, l = Math.min(1, Math.max(0, t.lift ?? 0)), c = (t.angle ?? -30) * Math.PI / 180, h = o ? o.nudge(0.6) : { x: 0, y: 0 }, d = Ua * i * (1 + 0.05 * l);
2092
2092
  l > 0 && (e.save(), e.fillStyle = s, e.globalAlpha = 0.15 * l, e.beginPath(), e.ellipse(n.x, n.y, 9 * i, 4 * i, 0, 0, Math.PI * 2), e.fill(), e.restore());
2093
2093
  const f = { x: n.x + h.x + 6 * l * i, y: n.y + h.y - 18 * l * i }, u = we.pencilGrip, p = (v) => {
2094
- const y = v.fingers.thumb, S = v.fingers.index, w = v.fingers.middle, T = ws([y.points[3], S.points[3], w.points[3]]), I = ws([y.points[1], S.points[0]]), C = (y.depths[3] + S.depths[3] + w.depths[3]) / 3;
2094
+ const b = v.fingers.thumb, S = v.fingers.index, w = v.fingers.middle, T = ws([b.points[3], S.points[3], w.points[3]]), I = ws([b.points[1], S.points[0]]), C = (b.depths[3] + S.depths[3] + w.depths[3]) / 3;
2095
2095
  return { pinch: T, direction: Math.atan2(I.y - T.y, I.x - T.x), depth: C };
2096
- }, g = Zo(u, { size: d }), b = c - p(g).direction, $ = Zo(u, { size: d, angle: b * 180 / Math.PI }), A = p($), k = Cl[r] * i, m = { x: A.pinch.x - Math.cos(c) * k, y: A.pinch.y - Math.sin(c) * k }, P = { x: f.x - m.x, y: f.y - m.y }, O = $.axes.up;
2096
+ }, g = Zo(u, { size: d }), y = c - p(g).direction, $ = Zo(u, { size: d, angle: y * 180 / Math.PI }), A = p($), k = Cl[r] * i, m = { x: A.pinch.x - Math.cos(c) * k, y: A.pinch.y - Math.sin(c) * k }, P = { x: f.x - m.x, y: f.y - m.y }, O = $.axes.up;
2097
2097
  _l(e, P, { x: -O.x, y: -O.y }, d, t.arm ?? 300 * i, a, t.sleeve ?? "#5b7db1", s), Rr(e, P, u, {
2098
2098
  size: d,
2099
- angle: b * 180 / Math.PI,
2099
+ angle: y * 180 / Math.PI,
2100
2100
  skin: a,
2101
2101
  ink: s,
2102
2102
  lineWidth: 3 * i,
@@ -2113,30 +2113,30 @@ const ws = (e) => ({
2113
2113
  y: e.reduce((n, t) => n + t.y, 0) / e.length
2114
2114
  });
2115
2115
  function _l(e, n, t, o, r, a, s, i) {
2116
- const l = { x: -t.y, y: t.x }, c = o * 0.15, h = (g, b, $) => ({
2117
- x: n.x + t.x * g + l.x * b * $,
2118
- y: n.y + t.y * g + l.y * b * $
2116
+ const l = { x: -t.y, y: t.x }, c = o * 0.15, h = (g, y, $) => ({
2117
+ x: n.x + t.x * g + l.x * y * $,
2118
+ y: n.y + t.y * g + l.y * y * $
2119
2119
  }), d = h(r, 0, 0), f = (g) => {
2120
- const b = e.createLinearGradient(n.x, n.y, d.x, d.y);
2121
- return b.addColorStop(0, g), b.addColorStop(0.6, g), b.addColorStop(1, xl(g)), b;
2120
+ const y = e.createLinearGradient(n.x, n.y, d.x, d.y);
2121
+ return y.addColorStop(0, g), y.addColorStop(0.6, g), y.addColorStop(1, xl(g)), y;
2122
2122
  }, u = Math.min(o * 0.55, r * 0.35);
2123
2123
  e.save(), e.lineJoin = "round", e.lineCap = "round", e.lineWidth = 3 * (o / Ua), e.beginPath(), e.moveTo(h(-o * 0.1, -1, c).x, h(-o * 0.1, -1, c).y), e.lineTo(h(u + 4, -1, c * 1.1).x, h(u + 4, -1, c * 1.1).y), e.lineTo(h(u + 4, 1, c * 1.1).x, h(u + 4, 1, c * 1.1).y), e.lineTo(h(-o * 0.1, 1, c).x, h(-o * 0.1, 1, c).y), e.closePath(), e.fillStyle = a, e.fill(), e.strokeStyle = i, e.beginPath(), e.moveTo(h(0, -1, c).x, h(0, -1, c).y), e.lineTo(h(u, -1, c * 1.1).x, h(u, -1, c * 1.1).y), e.moveTo(h(0, 1, c).x, h(0, 1, c).y), e.lineTo(h(u, 1, c * 1.1).x, h(u, 1, c * 1.1).y), e.stroke();
2124
2124
  const p = [h(u, -1, c * 1.3), h(r, -1, c * 1.5), h(r, 1, c * 1.5), h(u, 1, c * 1.3)];
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();
2125
+ e.beginPath(), p.forEach((g, y) => y ? 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
2127
  function Hf(e, n, t = {}) {
2128
- const o = t.offstage ?? { x: 2e3, y: 1400 }, r = t.enter ?? 450, a = t.exit ?? 450, s = t.linger ?? 1500, i = [...e].filter((g) => g.path.length > 0).sort((g, b) => g.start - b.start), l = (g) => g.tool ?? "pencil", c = (g) => {
2129
- const b = Math.min(1, Math.max(0, g));
2130
- return b * b * (3 - 2 * b);
2131
- }, h = (g, b, $) => ({ x: g.x + (b.x - g.x) * $, y: g.y + (b.y - g.y) * $ }), d = i.find((g) => n >= g.start && n <= g.end);
2128
+ const o = t.offstage ?? { x: 2e3, y: 1400 }, r = t.enter ?? 450, a = t.exit ?? 450, s = t.linger ?? 1500, i = [...e].filter((g) => g.path.length > 0).sort((g, y) => g.start - y.start), l = (g) => g.tool ?? "pencil", c = (g) => {
2129
+ const y = Math.min(1, Math.max(0, g));
2130
+ return y * y * (3 - 2 * y);
2131
+ }, h = (g, y, $) => ({ x: g.x + (y.x - g.x) * $, y: g.y + (y.y - g.y) * $ }), d = i.find((g) => n >= g.start && n <= g.end);
2132
2132
  if (d) {
2133
- const g = d.end - d.start, b = g > 0 ? (n - d.start) / g : 1;
2134
- return { at: Po(d.path, b), tool: l(d), lift: 0, drawing: !0 };
2133
+ const g = d.end - d.start, y = g > 0 ? (n - d.start) / g : 1;
2134
+ return { at: Po(d.path, y), tool: l(d), lift: 0, drawing: !0 };
2135
2135
  }
2136
2136
  const f = [...i].reverse().find((g) => g.end < n), u = i.find((g) => g.start > n), p = (g) => g.path[g.path.length - 1];
2137
2137
  if (f && u && u.start - f.end <= s) {
2138
- const g = (n - f.end) / (u.start - f.end), b = g < 0.5 ? l(f) : l(u);
2139
- return { at: h(p(f), u.path[0], c(g)), tool: b, lift: Math.sin(Math.PI * g), drawing: !1 };
2138
+ const g = (n - f.end) / (u.start - f.end), y = g < 0.5 ? l(f) : l(u);
2139
+ return { at: h(p(f), u.path[0], c(g)), tool: y, lift: Math.sin(Math.PI * g), drawing: !1 };
2140
2140
  }
2141
2141
  if (u && u.start - n <= r) {
2142
2142
  const g = 1 - (u.start - n) / r;
@@ -2240,7 +2240,7 @@ function Lt() {
2240
2240
  const r = e.get(t);
2241
2241
  return r ? [...r].sort((a, s) => a.time - s.time)[r.length - 1].value : o;
2242
2242
  },
2243
- valueAt: (t, o) => Ko(e.get(t), o),
2243
+ valueAt: (t, o) => Wo(e.get(t), o),
2244
2244
  cutAfter(t, o) {
2245
2245
  for (const r of t) e.set(r, (e.get(r) ?? []).filter((a) => a.time <= o));
2246
2246
  },
@@ -2254,7 +2254,7 @@ function Lt() {
2254
2254
  }
2255
2255
  };
2256
2256
  }
2257
- function Ko(e, n) {
2257
+ function Wo(e, n) {
2258
2258
  if (!e || e.length === 0) return 0;
2259
2259
  const t = [...e].sort((o, r) => o.time - r.time);
2260
2260
  if (n <= t[0].time) return t[0].value;
@@ -2265,7 +2265,7 @@ function Ko(e, n) {
2265
2265
  }
2266
2266
  return t[t.length - 1].value;
2267
2267
  }
2268
- function Wt(e) {
2268
+ function Kt(e) {
2269
2269
  const n = [...e ?? []].sort((t, o) => t.time - o.time);
2270
2270
  return n.slice(1).flatMap((t, o) => t.value !== n[o].value ? [{ start: n[o].time, end: t.time }] : []);
2271
2271
  }
@@ -2305,7 +2305,7 @@ function Tn(e) {
2305
2305
  }
2306
2306
  };
2307
2307
  }
2308
- function Wo(e, n, { ground: t, every: o, floors: r }) {
2308
+ function Ko(e, n, { ground: t, every: o, floors: r }) {
2309
2309
  if (r.every((k) => k.windows.length === 0)) return e;
2310
2310
  const a = e.find((k) => k.target === n && k.property === "y"), s = new ve({ id: `${n}-ride`, tracks: a ? [a] : [] }), i = (k) => a ? Number(s.getStateAtTime(k).values.get(n)?.get("y") ?? 0) : 0, l = (k) => {
2311
2311
  const m = t + i(k);
@@ -2314,20 +2314,20 @@ function Wo(e, n, { ground: t, every: o, floors: r }) {
2314
2314
  const m = (S) => S < 0 ? 0 : r[S].offset(k), P = l(k);
2315
2315
  if (P >= 0) return m(P);
2316
2316
  if (Math.abs(i(k)) < 0.5) return 0;
2317
- const O = (S) => l(S) >= 0 || Math.abs(i(S)) < 0.5, v = [...c].reverse().find((S) => S <= k && O(S)), y = c.find((S) => S >= k && O(S));
2318
- return v === void 0 && y === void 0 ? 0 : v === void 0 ? m(l(y)) : y === void 0 || y === v ? m(l(v)) : m(l(v)) + (m(l(y)) - m(l(v))) * (k - v) / (y - v);
2317
+ const O = (S) => l(S) >= 0 || Math.abs(i(S)) < 0.5, v = [...c].reverse().find((S) => S <= k && O(S)), b = c.find((S) => S >= k && O(S));
2318
+ return v === void 0 && b === void 0 ? 0 : v === void 0 ? m(l(b)) : b === void 0 || b === v ? m(l(v)) : m(l(v)) + (m(l(b)) - m(l(v))) * (k - v) / (b - v);
2319
2319
  }, d = r.flatMap((k) => k.windows), f = (k, m) => d.some((P) => P.start < m && P.end > k) || h(k) !== h(m), u = a ? [...a.keyframes] : [{ time: 0, value: 0 }], p = [{ ...u[0], value: u[0].value + h(u[0].time) }], g = (k, m) => {
2320
2320
  const P = /* @__PURE__ */ new Set([m]);
2321
2321
  for (let O = k + o; O < m; O += o) P.add(O);
2322
2322
  for (const O of d) for (const v of [O.start, O.end]) v > k && v < m && P.add(v);
2323
- for (const O of [...P].sort((v, y) => v - y)) p.push({ time: O, value: i(O) + h(O) });
2323
+ for (const O of [...P].sort((v, b) => v - b)) p.push({ time: O, value: i(O) + h(O) });
2324
2324
  };
2325
2325
  for (let k = 1; k < u.length; k++) {
2326
2326
  const m = u[k - 1].time, P = u[k].time;
2327
2327
  f(m, P) ? g(m, P) : p.push({ ...u[k], value: u[k].value + h(P) });
2328
2328
  }
2329
- const b = u[u.length - 1].time, $ = Math.max(b, ...d.map((k) => k.end));
2330
- $ > b && g(b, $);
2329
+ const y = u[u.length - 1].time, $ = Math.max(y, ...d.map((k) => k.end));
2330
+ $ > y && g(y, $);
2331
2331
  const A = { id: a?.id ?? `${n}-y`, target: n, property: "y", keyframes: p };
2332
2332
  return a ? e.map((k) => k === a ? A : k) : [...e, A];
2333
2333
  }
@@ -2354,7 +2354,7 @@ function me(e, n, t, o) {
2354
2354
  height: o
2355
2355
  };
2356
2356
  }
2357
- const Kl = {
2357
+ const Wl = {
2358
2358
  background: "#1e1e2e",
2359
2359
  gutter: "#6c7086",
2360
2360
  text: "#cdd6f4",
@@ -2385,14 +2385,14 @@ const Kl = {
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
- }, Wl = 0.9, Fl = 8;
2388
+ }, Kl = 0.9, Fl = 8;
2389
2389
  function Rf(e) {
2390
- const n = { ...Kl, ...e.theme }, t = e.code.replace(/\t/g, " ").replace(/\n$/, "").split(`
2390
+ const n = { ...Wl, ...e.theme }, t = e.code.replace(/\t/g, " ").replace(/\n$/, "").split(`
2391
2391
  `), o = e.fontSize ?? 16, r = (e.lineHeight ?? 1.6) * o, a = (e.charWidth ?? 0.6) * o, s = e.padding ?? 12, i = e.lineNumbers === !1 ? 0 : (String(t.length).length + 2) * a, l = Math.max(1, ...t.map((H) => H.length)), c = e.width ?? s * 2 + i + l * a, h = s * 2 + t.length * r, d = e.x + s + i, f = new Set(e.hidden ?? []), u = e.language ?? "plain";
2392
2392
  if (!uo.includes(u)) throw new Error(`codePanel: ${ce("language", u, uo)}`);
2393
- const p = t.map((H) => ql(H, u).flatMap((N) => Array.from(N.text, () => n[N.kind]))), g = Lt(), b = Tn(g), $ = [], A = /* @__PURE__ */ new Map(), k = [], m = [], P = (H) => {
2393
+ const p = t.map((H) => ql(H, u).flatMap((N) => Array.from(N.text, () => n[N.kind]))), g = Lt(), y = Tn(g), $ = [], A = /* @__PURE__ */ new Map(), k = [], m = [], P = (H) => {
2394
2394
  if (!Number.isInteger(H) || H < 1 || H > t.length) throw new Error(`codePanel: no line ${H} (it has ${t.length})`);
2395
- }, O = g.tween, v = g.last, y = (H, N, R, M, _, V = 300) => {
2395
+ }, O = g.tween, v = g.last, b = (H, N, R, M, _, V = 300) => {
2396
2396
  P(H), O(`line.${H}.${N}`, R, M, _, V);
2397
2397
  }, S = (H, N) => $.filter((R) => R.line < H && R.closed <= N).length, w = me, T = (H) => e.y + s + (H - 1) * r, I = (H) => Array.isArray(H) ? H : [H], C = (H, N, R) => {
2398
2398
  let M = -1;
@@ -2404,7 +2404,7 @@ function Rf(e) {
2404
2404
  const R = N + 1;
2405
2405
  j[`line.${R}.highlight`] = 0, j[`line.${R}.strike`] = 0, j[`line.${R}.wipe`] = 0, j[`line.${R}.reveal`] = f.has(R) ? 0 : 1, j[`line.${R}.shift`] = 0;
2406
2406
  });
2407
- const K = {
2407
+ const W = {
2408
2408
  type: "custom",
2409
2409
  x: e.x,
2410
2410
  y: e.y,
@@ -2439,9 +2439,9 @@ function Rf(e) {
2439
2439
  ...k.filter((q) => q.line === ae).map((q) => ({ column: q.column, length: q.text.length, piece: q, insert: void 0 })),
2440
2440
  ...m.filter((q) => q.line === ae).map((q) => ({ column: q.column, length: 0, piece: void 0, insert: q }))
2441
2441
  ].sort((q, le) => q.column - le.column || q.length - le.length);
2442
- let W = 0, U = _;
2442
+ let K = 0, U = _;
2443
2443
  for (const q of E) {
2444
- ee(ae, W, Math.min(q.column, se), U, D), U += (q.column - W) * a;
2444
+ ee(ae, K, Math.min(q.column, se), U, D), U += (q.column - K) * a;
2445
2445
  let le = q.length, L = "";
2446
2446
  if (q.piece) {
2447
2447
  const z = q.piece.written ?? "", J = M(`piece.${q.piece.id}.write`);
@@ -2449,9 +2449,9 @@ function Rf(e) {
2449
2449
  } else q.insert && (le = q.insert.chars * M(`insert.${q.insert.id}.open`), q.insert.text && (L = q.insert.text.slice(0, Math.round(M(`insert.${q.insert.id}.type`) * q.insert.text.length))));
2450
2450
  H.fillStyle = n.text;
2451
2451
  for (let z = 0; z < L.length; z++) L[z] !== " " && H.fillText(L[z], U + z * a, D);
2452
- U += le * a, W = q.column + q.length;
2452
+ U += le * a, K = q.column + q.length;
2453
2453
  }
2454
- ee(ae, W, Math.max(W, se), U, D);
2454
+ ee(ae, K, Math.max(K, se), U, D);
2455
2455
  const te = M(`line.${ae}.strike`);
2456
2456
  te > 0 && (H.strokeStyle = n.strike, H.lineWidth = Math.max(1.5, o / 10), H.beginPath(), H.moveTo(_, D), H.lineTo(_ + Z * Math.min(1, te), D), H.stroke()), H.restore();
2457
2457
  });
@@ -2498,7 +2498,7 @@ function Rf(e) {
2498
2498
  }, B = {
2499
2499
  kind: "code",
2500
2500
  about: sn,
2501
- target: K,
2501
+ target: W,
2502
2502
  lines: t,
2503
2503
  box: w(e.x, e.y, c, h),
2504
2504
  line(H, N = 1 / 0) {
@@ -2512,12 +2512,12 @@ function Rf(e) {
2512
2512
  highlight(H, N) {
2513
2513
  for (const R of I(H)) {
2514
2514
  const M = v(`line.${R}.highlight`, 0);
2515
- y(R, "highlight", M, N.on === !1 ? 0 : 1, N, 200);
2515
+ b(R, "highlight", M, N.on === !1 ? 0 : 1, N, 200);
2516
2516
  }
2517
2517
  return B;
2518
2518
  },
2519
2519
  strike(H, N) {
2520
- for (const R of I(H)) y(R, "strike", v(`line.${R}.strike`, 0), 1, N);
2520
+ for (const R of I(H)) b(R, "strike", v(`line.${R}.strike`, 0), 1, N);
2521
2521
  return B;
2522
2522
  },
2523
2523
  remove(H, N) {
@@ -2525,18 +2525,18 @@ function Rf(e) {
2525
2525
  if (!fo.includes(M)) throw new Error(`codePanel.remove: ${ce("style", M, fo)}`);
2526
2526
  const _ = M === "wipe" ? 300 : 450, V = N.at + (N.duration ?? _), ee = N.close ?? 250;
2527
2527
  for (const F of R)
2528
- y(F, "wipe", 0, 1, { ...N, easing: N.easing ?? (M === "fly" ? "ease-in" : void 0) }, _), A.set(F, { style: M, from: N.from ?? "left" }), $.push({ line: F, closed: V + ee });
2528
+ b(F, "wipe", 0, 1, { ...N, easing: N.easing ?? (M === "fly" ? "ease-in" : void 0) }, _), A.set(F, { style: M, from: N.from ?? "left" }), $.push({ line: F, closed: V + ee });
2529
2529
  for (let F = 1; F <= t.length; F++) {
2530
2530
  if (R.includes(F)) continue;
2531
2531
  const Q = R.filter((x) => x < F).length;
2532
2532
  if (Q === 0) continue;
2533
2533
  const ae = v(`line.${F}.shift`, 0);
2534
- y(F, "shift", ae, ae + Q, { at: V, duration: ee, easing: "ease-in-out" });
2534
+ b(F, "shift", ae, ae + Q, { at: V, duration: ee, easing: "ease-in-out" });
2535
2535
  }
2536
2536
  return B;
2537
2537
  },
2538
2538
  type(H, N) {
2539
- return y(H, "reveal", 0, 1, { duration: t[H - 1].length * 45, ...N }), B;
2539
+ return b(H, "reveal", 0, 1, { duration: t[H - 1].length * 45, ...N }), B;
2540
2540
  },
2541
2541
  piece(H, N, R = 1) {
2542
2542
  if (typeof H == "string") {
@@ -2557,13 +2557,13 @@ function Rf(e) {
2557
2557
  return j[`piece.${ee.id}.opacity`] = 1, ee;
2558
2558
  },
2559
2559
  follow(H, N) {
2560
- return b.follow(H, N), B;
2560
+ return y.follow(H, N), B;
2561
2561
  },
2562
2562
  fling(H, N) {
2563
- return b.fling(H, N), B;
2563
+ return y.fling(H, N), B;
2564
2564
  },
2565
2565
  move(H, N) {
2566
- return b.move(H, N), B;
2566
+ return y.move(H, N), B;
2567
2567
  },
2568
2568
  write(H, N, R) {
2569
2569
  return H.written = N, O(`piece.${H.id}.write`, 0, 1, { duration: Math.max(1, N.length) * 70, ...R }), B;
@@ -2583,7 +2583,7 @@ function Rf(e) {
2583
2583
  drop(H, N, R, M) {
2584
2584
  P(N);
2585
2585
  const _ = M.duration ?? 250, V = N === H.line, ee = M.easing ?? (V ? "linear" : "ease-out"), F = B.landing(H, N, R, M.at), Q = { id: m.length + 1, line: N, column: R, chars: H.text.length, at: M.at };
2586
- return m.push(Q), j[`insert.${Q.id}.open`] = 0, O(`insert.${Q.id}.open`, 0, 1, { at: M.at, duration: _, easing: V ? ee : "ease-out" }), O(`piece.${H.id}.away`, v(`piece.${H.id}.away`, 0), 1, { at: M.at, duration: _, easing: V ? ee : "ease-in-out" }), b.cutAfter(H, M.at), B.move(H, { at: M.at, duration: _, easing: ee, to: { x: F.x, y: F.y } }), O(`piece.${H.id}.rotate`, g.valueAt(`piece.${H.id}.rotate`, M.at), 0, { at: M.at, duration: _ }), B;
2586
+ return m.push(Q), j[`insert.${Q.id}.open`] = 0, O(`insert.${Q.id}.open`, 0, 1, { at: M.at, duration: _, easing: V ? ee : "ease-out" }), O(`piece.${H.id}.away`, v(`piece.${H.id}.away`, 0), 1, { at: M.at, duration: _, easing: V ? ee : "ease-in-out" }), y.cutAfter(H, M.at), B.move(H, { at: M.at, duration: _, easing: ee, to: { x: F.x, y: F.y } }), O(`piece.${H.id}.rotate`, g.valueAt(`piece.${H.id}.rotate`, M.at), 0, { at: M.at, duration: _ }), B;
2587
2587
  },
2588
2588
  landing(H, N, R, M = 1 / 0) {
2589
2589
  const _ = B.spot(N, R, H.text.length, M), V = N === H.line && R > H.column ? H.text.length * a : 0;
@@ -2592,9 +2592,9 @@ function Rf(e) {
2592
2592
  ride(H, N, R) {
2593
2593
  const M = t.map((_, V) => {
2594
2594
  const ee = g.keys(`line.${V + 1}.shift`) ?? [];
2595
- return { top: T(V + 1), offset: (F) => -Ko(ee, F) * r, windows: Wt(ee) };
2595
+ return { top: T(V + 1), offset: (F) => -Wo(ee, F) * r, windows: Kt(ee) };
2596
2596
  });
2597
- return Wo(H, N, { ground: R.ground, every: R.every ?? et, floors: M });
2597
+ return Ko(H, N, { ground: R.ground, every: R.every ?? et, floors: M });
2598
2598
  },
2599
2599
  tracks: g.tracks,
2600
2600
  anchor(H, N = 1 / 0) {
@@ -2640,7 +2640,7 @@ function Dl(e, n, t, o, r) {
2640
2640
  const a = Fl * t;
2641
2641
  if (a > 0.2 && "filter" in e && (e.filter = `blur(${a.toFixed(1)}px)`), e.globalAlpha *= 1 - t, n.style === "fly") {
2642
2642
  const s = n.from === "right" ? -1 : 1;
2643
- e.translate(s * t * Wl * r, 0), e.rotate(s * t * 0.08);
2643
+ e.translate(s * t * Kl * r, 0), e.rotate(s * t * 0.08);
2644
2644
  } else {
2645
2645
  const s = 1 + 0.08 * t, i = o.left + o.width / 2, l = o.top + o.height / 2;
2646
2646
  e.translate(i, l), e.scale(s, s), e.translate(-i, -l);
@@ -2786,15 +2786,15 @@ function zf(e) {
2786
2786
  const n = typeof e.theme == "string" ? e.theme : "whiteboard";
2787
2787
  if (!(n in Vt)) throw new Error(`whiteboard: ${ce("theme", n, Object.keys(Vt))}`);
2788
2788
  const t = typeof e.theme == "object" ? { ...Vt.whiteboard, ...e.theme } : Vt[n], o = e.fontSize ?? 28, r = e.charWidth ?? 0.55, a = (m) => m === void 0 ? t.ink : t.colors[m] ?? m, s = (m) => me(e.x + m.left, e.y + m.top, m.width, m.height), i = Lt(), l = Tn(i), c = {}, h = /* @__PURE__ */ new Map(), d = [], f = [], u = (m, P, O, v) => {
2789
- const y = h.get(m);
2790
- if (!y || y.kind !== "text") throw tt("whiteboard", v, Be, `there is no text "${m}" (texts: ${p().join(", ") || "none"})`);
2789
+ const b = h.get(m);
2790
+ if (!b || b.kind !== "text") throw tt("whiteboard", v, Be, `there is no text "${m}" (texts: ${p().join(", ") || "none"})`);
2791
2791
  let S = -1;
2792
2792
  for (let T = 0; T < O; T++)
2793
- if (S = y.item.text.indexOf(P, S + 1), S < 0) throw tt("whiteboard", v, Be, `text "${m}" has no ${O > 1 ? `${O}th ` : ""}"${P}"`);
2794
- const w = y.size * r;
2795
- return { column: S, box: me(y.box.left + S * w, y.box.top, P.length * w, y.box.height) };
2793
+ if (S = b.item.text.indexOf(P, S + 1), S < 0) throw tt("whiteboard", v, Be, `text "${m}" has no ${O > 1 ? `${O}th ` : ""}"${P}"`);
2794
+ const w = b.size * r;
2795
+ return { column: S, box: me(b.box.left + S * w, b.box.top, P.length * w, b.box.height) };
2796
2796
  }, p = () => [...h.values()].filter((m) => m.kind === "text").map((m) => m.item.id), g = (m) => {
2797
- const { kind: P, rest: O } = $t(m), v = (y) => tt("whiteboard", m, Be, y);
2797
+ const { kind: P, rest: O } = $t(m), v = (b) => tt("whiteboard", m, Be, b);
2798
2798
  if (P === "box") {
2799
2799
  if (O) throw v("box takes no arguments");
2800
2800
  return { kind: P };
@@ -2804,18 +2804,18 @@ function zf(e) {
2804
2804
  return { kind: P, id: O };
2805
2805
  }
2806
2806
  if (P === "term") {
2807
- const y = /^([^:#]+)(?:#(\d+))?:(.+)$/.exec(O);
2808
- if (!y) throw v("write it term:ID:TEXT, or term:ID#K:TEXT for the Kth");
2809
- return { kind: P, id: y[1], occurrence: y[2] ? Number(y[2]) : 1, text: y[3] };
2807
+ const b = /^([^:#]+)(?:#(\d+))?:(.+)$/.exec(O);
2808
+ if (!b) throw v("write it term:ID:TEXT, or term:ID#K:TEXT for the Kth");
2809
+ return { kind: P, id: b[1], occurrence: b[2] ? Number(b[2]) : 1, text: b[3] };
2810
2810
  }
2811
2811
  throw v();
2812
- }, b = (m) => {
2812
+ }, y = (m) => {
2813
2813
  const P = g(m);
2814
2814
  if (P.kind === "box") return me(0, 0, e.width, e.height);
2815
2815
  if (P.kind === "term") return u(P.id, P.text, P.occurrence, m).box;
2816
2816
  const O = h.get(P.id);
2817
2817
  if (!O || O.kind !== P.kind) {
2818
- const v = [...h.values()].filter((y) => y.kind === P.kind).map((y) => y.item.id);
2818
+ const v = [...h.values()].filter((b) => b.kind === P.kind).map((b) => b.item.id);
2819
2819
  throw tt("whiteboard", m, Be, `there is no ${P.kind} "${P.id}" (${P.kind}s: ${v.join(", ") || "none"})`);
2820
2820
  }
2821
2821
  return O.box;
@@ -2832,8 +2832,8 @@ function zf(e) {
2832
2832
  if (!vs.includes(m.mark)) throw new Error(`whiteboard: mark "${m.id}": ${ce("mark", m.mark, vs)}`);
2833
2833
  const P = m.mark === "arrow" ? ["from", "to"] : ["around"];
2834
2834
  for (const S of P) if (typeof m[S] != "string") throw new Error(`whiteboard: ${m.mark} "${m.id}" needs \`${S}\`, a place on the board (an item before it)`);
2835
- const O = new Set([m.from, m.to].filter((S) => typeof S == "string").map((S) => S.split(":")[1])), v = m.mark === "arrow" ? [...h.values()].filter((S) => S.kind === "text" && !O.has(S.item.id)).map((S) => S.box) : [], y = Yl(m, b, o, v);
2836
- h.set(m.id, { kind: "mark", item: m, color: a(m.color), points: y, box: Vl(y) }), c[`mark.${m.id}.draw`] = m.hidden ? 0 : 1, c[`mark.${m.id}.erase`] = 0;
2835
+ const O = new Set([m.from, m.to].filter((S) => typeof S == "string").map((S) => S.split(":")[1])), v = m.mark === "arrow" ? [...h.values()].filter((S) => S.kind === "text" && !O.has(S.item.id)).map((S) => S.box) : [], b = Yl(m, y, o, v);
2836
+ h.set(m.id, { kind: "mark", item: m, color: a(m.color), points: b, box: Vl(b) }), c[`mark.${m.id}.draw`] = m.hidden ? 0 : 1, c[`mark.${m.id}.erase`] = 0;
2837
2837
  }
2838
2838
  const $ = (m) => d.filter((P) => P.item === m), A = {
2839
2839
  type: "custom",
@@ -2851,46 +2851,46 @@ function zf(e) {
2851
2851
  actions: Be.edits
2852
2852
  },
2853
2853
  draw(m, P) {
2854
- const O = P.props ?? {}, v = (y) => Number(O[y] ?? c[y] ?? 0);
2854
+ const O = P.props ?? {}, v = (b) => Number(O[b] ?? c[b] ?? 0);
2855
2855
  if (m.save(), m.fillStyle = t.background, Ts(m, 0, 0, e.width, e.height, 10), m.fill(), m.lineWidth = Math.max(4, e.width * 0.012), m.strokeStyle = t.frame, m.stroke(), t.rule) {
2856
2856
  m.save(), m.beginPath(), Ts(m, 0, 0, e.width, e.height, 10), m.clip(), m.lineWidth = 1, m.strokeStyle = t.rule.color;
2857
- const y = o * (t.rule.spacing ?? 1.55);
2858
- for (let S = y; S < e.height; S += y)
2857
+ const b = o * (t.rule.spacing ?? 1.55);
2858
+ for (let S = b; S < e.height; S += b)
2859
2859
  m.beginPath(), m.moveTo(0, S), m.lineTo(e.width, S), m.stroke();
2860
2860
  t.rule.margin && (m.strokeStyle = t.rule.margin, m.beginPath(), m.moveTo(o * 2.2, 0), m.lineTo(o * 2.2, e.height), m.stroke()), m.restore();
2861
2861
  }
2862
2862
  m.textAlign = "center", m.textBaseline = "middle", m.lineCap = "round", m.lineJoin = "round", m.globalAlpha = t.opacity;
2863
- for (const y of h.values()) {
2864
- if (m.save(), Dn(m, y.box, v(`${y.kind}.${y.item.id}.erase`)), y.kind === "text") {
2865
- const S = $(y.item.id), w = v(`text.${y.item.id}.write`) * y.item.text.length;
2866
- m.font = `${y.size}px ${t.font}`, m.fillStyle = y.color;
2863
+ for (const b of h.values()) {
2864
+ if (m.save(), Dn(m, b.box, v(`${b.kind}.${b.item.id}.erase`)), b.kind === "text") {
2865
+ const S = $(b.item.id), w = v(`text.${b.item.id}.write`) * b.item.text.length;
2866
+ m.font = `${b.size}px ${t.font}`, m.fillStyle = b.color;
2867
2867
  for (let T = 0; T < Math.ceil(w); T++)
2868
- y.item.text[T] === " " || S.some((I) => T >= I.column && T < I.column + I.text.length) || (m.globalAlpha = t.opacity * Math.min(1, w - T), m.fillText(y.item.text[T], y.box.left + (T + 0.5) * y.size * r, y.box.y));
2868
+ b.item.text[T] === " " || S.some((I) => T >= I.column && T < I.column + I.text.length) || (m.globalAlpha = t.opacity * Math.min(1, w - T), m.fillText(b.item.text[T], b.box.left + (T + 0.5) * b.size * r, b.box.y));
2869
2869
  } else
2870
- Es(m, y.points, v(`mark.${y.item.id}.draw`), y.color, o * t.stroke, y.item.mark === "arrow");
2870
+ Es(m, b.points, v(`mark.${b.item.id}.draw`), b.color, o * t.stroke, b.item.mark === "arrow");
2871
2871
  m.restore();
2872
2872
  }
2873
- for (const y of f) {
2874
- const S = v(`strike.${y.id}.draw`);
2873
+ for (const b of f) {
2874
+ const S = v(`strike.${b.id}.draw`);
2875
2875
  if (S <= 0) continue;
2876
- const { box: w } = y, T = w.height * 0.15;
2876
+ const { box: w } = b, T = w.height * 0.15;
2877
2877
  Es(m, [{ x: w.left - 3, y: w.y + T }, { x: w.right + 3, y: w.y - T }], S, t.colors.red ?? t.ink, o * t.stroke * 0.8, !1);
2878
2878
  }
2879
- for (const y of d) {
2880
- const S = h.get(y.item), w = S.size * r;
2879
+ for (const b of d) {
2880
+ const S = h.get(b.item), w = S.size * r;
2881
2881
  m.font = `${S.size}px ${t.font}`, m.fillStyle = S.color;
2882
- const T = y.written;
2882
+ const T = b.written;
2883
2883
  if (T) {
2884
- const K = v(`piece.${y.id}.write`) * T.length, G = y.home.x - e.x - T.length * w / 2;
2885
- for (let Y = 0; Y < Math.ceil(K); Y++)
2886
- T[Y] !== " " && (m.globalAlpha = t.opacity * Math.min(1, K - Y), m.fillText(T[Y], G + (Y + 0.5) * w, y.home.y - e.y));
2884
+ const W = v(`piece.${b.id}.write`) * T.length, G = b.home.x - e.x - T.length * w / 2;
2885
+ for (let Y = 0; Y < Math.ceil(W); Y++)
2886
+ T[Y] !== " " && (m.globalAlpha = t.opacity * Math.min(1, W - Y), m.fillText(T[Y], G + (Y + 0.5) * w, b.home.y - e.y));
2887
2887
  }
2888
- const I = v(`piece.${y.id}.opacity`) * Math.min(1, v(`text.${y.item}.write`) * S.item.text.length - y.column);
2888
+ const I = v(`piece.${b.id}.opacity`) * Math.min(1, v(`text.${b.item}.write`) * S.item.text.length - b.column);
2889
2889
  if (I <= 0) continue;
2890
2890
  m.save();
2891
- const C = { x: y.home.x - e.x, y: y.home.y - e.y }, j = { x: v(`piece.${y.id}.x`), y: v(`piece.${y.id}.y`) };
2892
- Dn(m, me(C.x + j.x - y.home.width / 2, C.y + j.y - y.home.height / 2, y.home.width, y.home.height), v(`piece.${y.id}.erase`)), Math.hypot(j.x, j.y) < 1 && Dn(m, S.box, v(`text.${y.item}.erase`)), m.globalAlpha = t.opacity * Math.min(1, I), m.translate(C.x + j.x, C.y + j.y), m.rotate(v(`piece.${y.id}.rotate`) * Math.PI / 180);
2893
- for (let K = 0; K < y.text.length; K++) y.text[K] !== " " && m.fillText(y.text[K], (K + 0.5 - y.text.length / 2) * w, 0);
2891
+ const C = { x: b.home.x - e.x, y: b.home.y - e.y }, j = { x: v(`piece.${b.id}.x`), y: v(`piece.${b.id}.y`) };
2892
+ Dn(m, me(C.x + j.x - b.home.width / 2, C.y + j.y - b.home.height / 2, b.home.width, b.home.height), v(`piece.${b.id}.erase`)), Math.hypot(j.x, j.y) < 1 && Dn(m, S.box, v(`text.${b.item}.erase`)), m.globalAlpha = t.opacity * Math.min(1, I), m.translate(C.x + j.x, C.y + j.y), m.rotate(v(`piece.${b.id}.rotate`) * Math.PI / 180);
2893
+ for (let W = 0; W < b.text.length; W++) b.text[W] !== " " && m.fillText(b.text[W], (W + 0.5 - b.text.length / 2) * w, 0);
2894
2894
  m.restore();
2895
2895
  }
2896
2896
  m.restore();
@@ -2901,13 +2901,13 @@ function zf(e) {
2901
2901
  target: A,
2902
2902
  box: me(e.x, e.y, e.width, e.height),
2903
2903
  anchor(m) {
2904
- return s(b(m));
2904
+ return s(y(m));
2905
2905
  },
2906
2906
  piece(m) {
2907
2907
  const P = g(m);
2908
2908
  if (P.kind !== "term") throw new Error(`whiteboard.piece: a piece is a term, term:ID:TEXT, not "${m}"`);
2909
- const { column: O, box: v } = u(P.id, P.text, P.occurrence, m), y = d.find((w) => w.item === P.id && w.column === O && w.text === P.text);
2910
- if (y) return y;
2909
+ const { column: O, box: v } = u(P.id, P.text, P.occurrence, m), b = d.find((w) => w.item === P.id && w.column === O && w.text === P.text);
2910
+ if (b) return b;
2911
2911
  if (d.some((w) => w.item === P.id && O < w.column + w.text.length && w.column < O + P.text.length))
2912
2912
  throw new Error(`whiteboard: "${P.text}" in "${P.id}" overlaps another piece`);
2913
2913
  const S = { id: d.length + 1, item: P.id, column: O, text: P.text, home: s(v) };
@@ -2918,21 +2918,21 @@ function zf(e) {
2918
2918
  edit(m, P, O) {
2919
2919
  const v = Array.isArray(P) ? P : [P];
2920
2920
  if (v.length === 0) throw new Error(`whiteboard.edit: ${m} takes at least one anchor`);
2921
- const y = v.map((T) => ({ name: T, anchor: g(T) }));
2922
- for (const { name: T } of y) b(T);
2921
+ const b = v.map((T) => ({ name: T, anchor: g(T) }));
2922
+ for (const { name: T } of b) y(T);
2923
2923
  const S = (T, I = !1) => {
2924
- const C = y.find((j) => !T.includes(j.anchor.kind));
2924
+ const C = b.find((j) => !T.includes(j.anchor.kind));
2925
2925
  if (C) throw new Error(`whiteboard.edit: ${m} takes ${T.join(" or ")} anchors, not "${C.name}"`);
2926
- if (I && y.length > 1) throw new Error(`whiteboard.edit: ${m} takes one ${T.join(" or ")} anchor`);
2927
- }, w = () => k.piece(y[0].name);
2926
+ if (I && b.length > 1) throw new Error(`whiteboard.edit: ${m} takes one ${T.join(" or ")} anchor`);
2927
+ }, w = () => k.piece(b[0].name);
2928
2928
  if (m === "write") {
2929
- if (y.some((T) => T.anchor.kind === "term")) {
2929
+ if (b.some((T) => T.anchor.kind === "term")) {
2930
2930
  if (S(["term"], !0), typeof O.text != "string") throw new Error("whiteboard.edit: write into a term needs `text` (the new text)");
2931
2931
  const T = w();
2932
2932
  return T.written = O.text, i.tween(`piece.${T.id}.write`, 0, 1, { duration: Math.max(Ms, O.text.length * Ss), ...O }), k;
2933
2933
  }
2934
2934
  S(["text"]);
2935
- for (const { anchor: T } of y) {
2935
+ for (const { anchor: T } of b) {
2936
2936
  const I = T.id, C = h.get(I).item.text;
2937
2937
  i.tween(`text.${I}.write`, 0, 1, { duration: Math.max(Ms, C.length * Ss), ...O });
2938
2938
  }
@@ -2940,12 +2940,12 @@ function zf(e) {
2940
2940
  }
2941
2941
  if (m === "draw") {
2942
2942
  S(["mark"]);
2943
- for (const { anchor: T } of y) i.tween(`mark.${T.id}.draw`, 0, 1, { duration: 500, ...O });
2943
+ for (const { anchor: T } of b) i.tween(`mark.${T.id}.draw`, 0, 1, { duration: 500, ...O });
2944
2944
  return k;
2945
2945
  }
2946
2946
  if (m === "erase") {
2947
2947
  S(["text", "term", "mark"]);
2948
- for (const T of y) {
2948
+ for (const T of b) {
2949
2949
  const I = T.anchor.kind === "term" ? `piece.${k.piece(T.name).id}.erase` : `${T.anchor.kind}.${T.anchor.id}.erase`;
2950
2950
  i.tween(I, 0, 1, { duration: 400, ...O });
2951
2951
  }
@@ -2953,8 +2953,8 @@ function zf(e) {
2953
2953
  }
2954
2954
  if (m === "strike") {
2955
2955
  S(["text", "term"]);
2956
- for (const T of y) {
2957
- const I = { id: f.length + 1, box: b(T.name) };
2956
+ for (const T of b) {
2957
+ const I = { id: f.length + 1, box: y(T.name) };
2958
2958
  f.push(I), c[`strike.${I.id}.draw`] = 0, i.tween(`strike.${I.id}.draw`, 0, 1, { duration: 250, ...O });
2959
2959
  }
2960
2960
  return k;
@@ -2988,16 +2988,16 @@ function zf(e) {
2988
2988
  function Yl(e, n, t, o = []) {
2989
2989
  const r = Tt(Xe(e.id)), a = (g) => (r.next() * 2 - 1) * g, s = t * Gl;
2990
2990
  if (e.mark === "arrow") {
2991
- const g = n(e.from), b = n(e.to), $ = $s(g, b, s * 0.6), A = $s(b, g, s * 0.6), k = Math.hypot(A.x - $.x, A.y - $.y), m = Xl($, A);
2991
+ const g = n(e.from), y = n(e.to), $ = $s(g, y, s * 0.6), A = $s(y, g, s * 0.6), k = Math.hypot(A.x - $.x, A.y - $.y), m = Xl($, A);
2992
2992
  let P = k * (0.06 + a(0.04));
2993
2993
  if (e.bend !== void 0) P = k * e.bend;
2994
2994
  else {
2995
- const y = Ul($, A, m, o, s);
2996
- y !== 0 && (P = y);
2995
+ const b = Ul($, A, m, o, s);
2996
+ b !== 0 && (P = b);
2997
2997
  }
2998
2998
  const O = { x: ($.x + A.x) / 2 + m.x * P, y: ($.y + A.y) / 2 + m.y * P }, v = [];
2999
- for (let y = 0; y <= 24; y++) {
3000
- const S = y / 24;
2999
+ for (let b = 0; b <= 24; b++) {
3000
+ const S = b / 24;
3001
3001
  v.push({ x: (1 - S) ** 2 * $.x + 2 * (1 - S) * S * O.x + S * S * A.x, y: (1 - S) ** 2 * $.y + 2 * (1 - S) * S * O.y + S * S * A.y });
3002
3002
  }
3003
3003
  return v;
@@ -3012,12 +3012,12 @@ function Yl(e, n, t, o = []) {
3012
3012
  ];
3013
3013
  }
3014
3014
  if (e.mark === "box") {
3015
- const g = i.left - s, b = i.right + s, $ = i.top - s * 0.6, A = i.bottom + s * 0.6, k = (P, O) => ({ x: P + a(s * 0.2), y: O + a(s * 0.2) }), m = k(g, $);
3016
- return [m, k(b, $), k(b, A), k(g, A), m, { x: m.x + s * 0.8, y: m.y + a(2) }];
3015
+ const g = i.left - s, y = i.right + s, $ = i.top - s * 0.6, A = i.bottom + s * 0.6, k = (P, O) => ({ x: P + a(s * 0.2), y: O + a(s * 0.2) }), m = k(g, $);
3016
+ return [m, k(y, $), k(y, A), k(g, A), m, { x: m.x + s * 0.8, y: m.y + a(2) }];
3017
3017
  }
3018
3018
  const l = i.width / 2 + s, c = i.height / 2 + s * 0.6, h = -2.2 + a(0.3), d = r.next() * Math.PI * 2, f = 1.12, u = 64, p = [];
3019
3019
  for (let g = 0; g <= u * f; g++) {
3020
- const b = g / u, $ = h + b * Math.PI * 2, A = 1 + 0.035 * Math.sin(b * Math.PI * 4 + d) + 0.06 * b;
3020
+ const y = g / u, $ = h + y * Math.PI * 2, A = 1 + 0.035 * Math.sin(y * Math.PI * 4 + d) + 0.06 * y;
3021
3021
  p.push({ x: i.x + Math.cos($) * l * A, y: i.y + Math.sin($) * c * A });
3022
3022
  }
3023
3023
  return p;
@@ -3138,7 +3138,7 @@ const As = ["bar", "line", "pie", "donut"], Ps = 'system-ui, -apple-system, "Seg
3138
3138
  pull: "slice anchors; { at, duration?, on? }: pull the slice out from the centre (on: false puts it back)"
3139
3139
  }
3140
3140
  }, Zl = 600, Ql = 500, eh = 200, th = 400, nh = 0.14, oh = Math.PI * 2;
3141
- function Kf(e) {
3141
+ function Wf(e) {
3142
3142
  if (!As.includes(e.kind)) throw new Error(`chart: ${ce("kind", e.kind, As)}`);
3143
3143
  const n = typeof e.theme == "string" ? e.theme : "light";
3144
3144
  if (!(n in Jt)) throw new Error(`chart: ${ce("theme", n, Object.keys(Jt))}`);
@@ -3152,46 +3152,46 @@ function Kf(e) {
3152
3152
  if (i.has(E.id)) throw new Error(`chart: two series are called "${E.id}"`);
3153
3153
  i.add(E.id);
3154
3154
  }
3155
- const l = new Map(s.map((E, W) => [E.id, W])), c = (E) => s[l.get(E)].color ?? (l.get(E) === 0 ? t.color : t.palette[l.get(E) % t.palette.length]), h = /* @__PURE__ */ new Set(), d = (E, W) => {
3156
- const U = E.values?.[W.id] ?? (e.series ? void 0 : E.value) ?? E.value;
3155
+ const l = new Map(s.map((E, K) => [E.id, K])), c = (E) => s[l.get(E)].color ?? (l.get(E) === 0 ? t.color : t.palette[l.get(E) % t.palette.length]), h = /* @__PURE__ */ new Set(), d = (E, K) => {
3156
+ const U = E.values?.[K.id] ?? (e.series ? void 0 : E.value) ?? E.value;
3157
3157
  if (typeof U != "number" || !Number.isFinite(U))
3158
- throw new Error(a ? `chart: "${E.id}" needs a value for series "${W.id}" (\`values: { ${W.id}: … }\`)` : `chart: "${E.id}" needs a \`value\`, a number`);
3158
+ throw new Error(a ? `chart: "${E.id}" needs a value for series "${K.id}" (\`values: { ${K.id}: … }\`)` : `chart: "${E.id}" needs a \`value\`, a number`);
3159
3159
  return U;
3160
3160
  };
3161
3161
  for (const E of e.data) {
3162
3162
  if (typeof E?.id != "string" || !E.id || /[:.]/.test(E.id)) throw new Error(`chart: every datum needs an \`id\` without ":" or "." (got ${JSON.stringify(E?.id)})`);
3163
3163
  if (h.has(E.id)) throw new Error(`chart: two data are called "${E.id}"`);
3164
- for (const W of s) d(E, W);
3164
+ for (const K of s) d(E, K);
3165
3165
  h.add(E.id);
3166
3166
  }
3167
- const f = o === "bar" ? "bar" : o === "line" ? "point" : "slice", u = Math.max(...e.data.flatMap((E) => s.map((W) => d(E, W)))), p = r ? e.data.reduce((E, W) => E + d(W, s[0]), 0) : e.max ?? sh(u * 1.1);
3167
+ const f = o === "bar" ? "bar" : o === "line" ? "point" : "slice", u = Math.max(...e.data.flatMap((E) => s.map((K) => d(E, K)))), p = r ? e.data.reduce((E, K) => E + d(K, s[0]), 0) : e.max ?? sh(u * 1.1);
3168
3168
  if (!r && !(p > 0)) throw new Error(`chart: \`max\` must be above 0 (got ${p})`);
3169
- const g = Math.max(10, Math.min(16, e.height / 20)), b = a && e.legend !== !1, $ = r ? void 0 : e.axis?.x, A = r ? void 0 : e.axis?.y, k = e.title ? g * 2.3 : g * 0.5, m = {
3169
+ const g = Math.max(10, Math.min(16, e.height / 20)), y = a && e.legend !== !1, $ = r ? void 0 : e.axis?.x, A = r ? void 0 : e.axis?.y, k = e.title ? g * 2.3 : g * 0.5, m = {
3170
3170
  left: g * 3.6 + (A ? g * 1.5 : 0),
3171
3171
  right: e.width - g,
3172
- top: (e.title ? g * 3 : g * 1.6) + (b ? g * 1.6 : 0),
3172
+ top: (e.title ? g * 3 : g * 1.6) + (y ? g * 1.6 : 0),
3173
3173
  bottom: e.height - g * 2.4 - ($ ? g * 1.4 : 0)
3174
- }, P = m.bottom - m.top, O = (m.right - m.left) / e.data.length, v = a ? O * 0.72 / s.length : O * 0.6, y = a ? v * 0.86 : v, S = Math.max(4, g * 0.35), w = P / p, T = new Map(e.data.map((E, W) => [E.id, W])), I = (E) => m.left + O * (T.get(E) + 0.5), C = (E, W) => a ? I(E) - O * 0.36 + v * l.get(W) + (v - y) / 2 : I(E) - y / 2, j = (E, W) => C(E, W) + y / 2, K = e.height - g * 1.2, G = {
3174
+ }, P = m.bottom - m.top, O = (m.right - m.left) / e.data.length, v = a ? O * 0.72 / s.length : O * 0.6, b = a ? v * 0.86 : v, S = Math.max(4, g * 0.35), w = P / p, T = new Map(e.data.map((E, K) => [E.id, K])), I = (E) => m.left + O * (T.get(E) + 0.5), C = (E, K) => a ? I(E) - O * 0.36 + v * l.get(K) + (v - b) / 2 : I(E) - b / 2, j = (E, K) => C(E, K) + b / 2, W = e.height - g * 1.2, G = {
3175
3175
  cx: e.width / 2,
3176
- cy: (m.top + K) / 2,
3177
- r: Math.max(10, Math.min(e.width / 2, (K - m.top) / 2) - g * 2.6)
3176
+ cy: (m.top + W) / 2,
3177
+ r: Math.max(10, Math.min(e.width / 2, (W - m.top) / 2) - g * 2.6)
3178
3178
  }, Y = o === "donut" ? G.r * 0.55 : 0, ne = o === "donut" ? (Y + G.r) / 2 : G.r * 0.62, B = /* @__PURE__ */ new Map();
3179
- if (b) {
3179
+ if (y) {
3180
3180
  let E = m.right;
3181
- for (const W of [...s].reverse()) {
3182
- const U = W.label ?? W.id, te = g * 0.62 * U.length + g * 1.9;
3183
- B.set(W.id, me(E - te, k, te, g * 1.4)), E -= te + g * 0.6;
3181
+ for (const K of [...s].reverse()) {
3182
+ const U = K.label ?? K.id, te = g * 0.62 * U.length + g * 1.9;
3183
+ B.set(K.id, me(E - te, k, te, g * 1.4)), E -= te + g * 0.6;
3184
3184
  }
3185
3185
  }
3186
- const H = Lt(), N = Tn(H), R = {}, M = (E, W, U) => a ? `${f}.${E}.${W}.${U}` : `${f}.${E}.${U}`;
3186
+ const H = Lt(), N = Tn(H), R = {}, M = (E, K, U) => a ? `${f}.${E}.${K}.${U}` : `${f}.${E}.${U}`;
3187
3187
  for (const E of e.data)
3188
- for (const W of s)
3189
- R[M(E.id, W.id, "value")] = d(E, W), R[M(E.id, W.id, "show")] = E.hidden ? 0 : 1, R[M(E.id, W.id, "highlight")] = 0, r && (R[M(E.id, W.id, "pull")] = 0);
3190
- const _ = (E, W) => H.keys(E)?.length ? Ko(H.keys(E), W) : R[E], V = (E, W, U) => _(M(E, W, "value"), U) * (o === "bar" ? _(M(E, W, "show"), U) : 1) * w, ee = (E) => {
3191
- const W = s[0].id, U = e.data.map((L) => Math.max(0, E(M(L.id, W, "value"))) * Math.max(0, Math.min(1, E(M(L.id, W, "show"))))), te = U.reduce((L, z) => L + z, 0), q = /* @__PURE__ */ new Map();
3188
+ for (const K of s)
3189
+ R[M(E.id, K.id, "value")] = d(E, K), R[M(E.id, K.id, "show")] = E.hidden ? 0 : 1, R[M(E.id, K.id, "highlight")] = 0, r && (R[M(E.id, K.id, "pull")] = 0);
3190
+ const _ = (E, K) => H.keys(E)?.length ? Wo(H.keys(E), K) : R[E], V = (E, K, U) => _(M(E, K, "value"), U) * (o === "bar" ? _(M(E, K, "show"), U) : 1) * w, ee = (E) => {
3191
+ const K = s[0].id, U = e.data.map((L) => Math.max(0, E(M(L.id, K, "value"))) * Math.max(0, Math.min(1, E(M(L.id, K, "show"))))), te = U.reduce((L, z) => L + z, 0), q = /* @__PURE__ */ new Map();
3192
3192
  let le = -Math.PI / 2;
3193
3193
  return e.data.forEach((L, z) => {
3194
- const J = te > 0 ? oh * U[z] / te : 0, he = le + J / 2, fe = Math.max(0, Math.min(1, E(M(L.id, W, "pull")))) * G.r * nh;
3194
+ const J = te > 0 ? oh * U[z] / te : 0, he = le + J / 2, fe = Math.max(0, Math.min(1, E(M(L.id, K, "pull")))) * G.r * nh;
3195
3195
  q.set(L.id, {
3196
3196
  start: le,
3197
3197
  sweep: J,
@@ -3200,43 +3200,43 @@ function Kf(e) {
3200
3200
  centre: { x: G.cx + Math.cos(he) * (ne + fe), y: G.cy + Math.sin(he) * (ne + fe) }
3201
3201
  }), le += J;
3202
3202
  }), q;
3203
- }, F = (E) => ee((W) => _(W, E)), Q = (E) => {
3204
- const { kind: W, rest: U } = $t(E), te = (q) => tt("chart", E, ut, q);
3205
- if (W === "box") {
3203
+ }, F = (E) => ee((K) => _(K, E)), Q = (E) => {
3204
+ const { kind: K, rest: U } = $t(E), te = (q) => tt("chart", E, ut, q);
3205
+ if (K === "box") {
3206
3206
  if (U) throw te("box takes no arguments");
3207
3207
  return { kind: "box" };
3208
3208
  }
3209
- if (W === "legend") {
3210
- if (!B.has(U)) throw te(b ? `there is no series "${U}" (series: ${s.map((q) => q.id).join(", ")})` : "only a chart with several series has a legend");
3209
+ if (K === "legend") {
3210
+ if (!B.has(U)) throw te(y ? `there is no series "${U}" (series: ${s.map((q) => q.id).join(", ")})` : "only a chart with several series has a legend");
3211
3211
  return { kind: "legend", series: U };
3212
3212
  }
3213
- if (W === "bar" || W === "point" || W === "slice" || W === "label" || W === "value") {
3214
- if (!U) throw te(`write it ${W}:ID`);
3213
+ if (K === "bar" || K === "point" || K === "slice" || K === "label" || K === "value") {
3214
+ if (!U) throw te(`write it ${K}:ID`);
3215
3215
  const q = U.indexOf(":"), le = q < 0 ? U : U.slice(0, q), L = q < 0 ? s[0].id : U.slice(q + 1);
3216
3216
  if (!T.has(le)) throw te(`there is no "${le}" (data: ${[...T.keys()].join(", ")})`);
3217
3217
  if (!i.has(L)) throw te(`there is no series "${L}" (series: ${s.map((z) => z.id).join(", ")})`);
3218
- if (W === "label" && q >= 0) throw te("a label is one per datum: label:ID");
3219
- if ((W === "bar" || W === "point" || W === "slice") && W !== f) throw te(`a ${o} chart has ${f}s, not ${W}s: ${f}:${le}`);
3220
- return { kind: W, id: le, series: L };
3218
+ if (K === "label" && q >= 0) throw te("a label is one per datum: label:ID");
3219
+ if ((K === "bar" || K === "point" || K === "slice") && K !== f) throw te(`a ${o} chart has ${f}s, not ${K}s: ${f}:${le}`);
3220
+ return { kind: K, id: le, series: L };
3221
3221
  }
3222
3222
  throw te();
3223
- }, ae = (E, W) => {
3223
+ }, ae = (E, K) => {
3224
3224
  if (E.kind === "box") return me(0, 0, e.width, e.height);
3225
3225
  if (E.kind === "legend") return B.get(E.series);
3226
3226
  if (r) {
3227
- const L = F(W).get(E.id), z = Math.max(g * 1.5, G.r * 0.42);
3227
+ const L = F(K).get(E.id), z = Math.max(g * 1.5, G.r * 0.42);
3228
3228
  if (E.kind === "slice") return me(L.centre.x - z / 2, L.centre.y - z / 2, z, z);
3229
3229
  const J = x(L);
3230
3230
  return E.kind === "label" ? J : L.sweep >= 0.3 ? me(L.centre.x - g * 1.6, L.centre.y - g * 0.65, g * 3.2, g * 1.3) : me(J.left, J.bottom, J.width, g * 1.3);
3231
3231
  }
3232
- const U = E.kind === "label" ? I(E.id) : j(E.id, E.series), te = m.bottom - V(E.id, E.series, W);
3233
- if (E.kind === "bar") return me(U - y / 2, te, y, m.bottom - te);
3232
+ const U = E.kind === "label" ? I(E.id) : j(E.id, E.series), te = m.bottom - V(E.id, E.series, K);
3233
+ if (E.kind === "bar") return me(U - b / 2, te, b, m.bottom - te);
3234
3234
  if (E.kind === "point") return me(I(E.id) - S, te - S, S * 2, S * 2);
3235
3235
  if (E.kind === "label") return me(U - O / 2, m.bottom + g * 0.4, O, g * 1.4);
3236
3236
  const q = te - (o === "line" ? S : 0) - g * 0.3, le = a && o === "bar" ? v : O;
3237
3237
  return me((o === "line" ? I(E.id) : U) - le / 2, q - g * 1.3, le, g * 1.3);
3238
3238
  }, x = (E) => {
3239
- const W = G.r + E.out + g * 0.9, U = { x: G.cx + Math.cos(E.mid) * W, y: G.cy + Math.sin(E.mid) * W }, te = g * 4.2, q = Math.cos(E.mid), le = q > 0.2 ? U.x : q < -0.2 ? U.x - te : U.x - te / 2;
3239
+ const K = G.r + E.out + g * 0.9, U = { x: G.cx + Math.cos(E.mid) * K, y: G.cy + Math.sin(E.mid) * K }, te = g * 4.2, q = Math.cos(E.mid), le = q > 0.2 ? U.x : q < -0.2 ? U.x - te : U.x - te / 2;
3240
3240
  return me(le, U.y - g * 0.7, te, g * 1.4);
3241
3241
  }, X = (E) => me(e.x + E.left, e.y + E.top, E.width, E.height), D = (E) => `${e.prefix ?? ""}${E.toFixed(e.decimals ?? 0)}${e.suffix ?? ""}`, Z = /* @__PURE__ */ new Map(), se = {
3242
3242
  type: "custom",
@@ -3251,9 +3251,9 @@ function Kf(e) {
3251
3251
  props: Object.fromEntries(Object.keys(R).map((E) => [E, ih(E)])),
3252
3252
  actions: ut.edits
3253
3253
  },
3254
- draw(E, W) {
3255
- const U = W.props ?? {}, te = (L) => Number(U[L] ?? R[L] ?? 0);
3256
- if (E.save(), E.fillStyle = t.background, Os(E, 0, 0, e.width, e.height, 8), E.fill(), E.font = `${g}px ${t.font}`, E.textBaseline = "middle", e.title && (E.fillStyle = t.text, E.textAlign = "left", E.font = `600 ${g * 1.2}px ${t.font}`, E.fillText(e.title, r ? g : m.left, g * 1.5), E.font = `${g}px ${t.font}`), b) {
3254
+ draw(E, K) {
3255
+ const U = K.props ?? {}, te = (L) => Number(U[L] ?? R[L] ?? 0);
3256
+ if (E.save(), E.fillStyle = t.background, Os(E, 0, 0, e.width, e.height, 8), E.fill(), E.font = `${g}px ${t.font}`, E.textBaseline = "middle", e.title && (E.fillStyle = t.text, E.textAlign = "left", E.font = `600 ${g * 1.2}px ${t.font}`, E.fillText(e.title, r ? g : m.left, g * 1.5), E.font = `${g}px ${t.font}`), y) {
3257
3257
  E.textAlign = "left";
3258
3258
  for (const L of s) {
3259
3259
  const z = B.get(L.id);
@@ -3290,7 +3290,7 @@ function Kf(e) {
3290
3290
  for (const L of e.data) {
3291
3291
  for (const z of s) {
3292
3292
  const J = o === "bar" ? j(L.id, z.id) : I(L.id), he = q(L.id, z.id), fe = te(M(L.id, z.id, "show"));
3293
- if (E.fillStyle = le(L.id, z.id), o === "bar" ? he > 0.5 && (rh(E, J - y / 2, m.bottom - he, y, he, Math.min(6, y / 4)), E.fill()) : fe > 0 && (E.beginPath(), E.arc(J, m.bottom - he, S * Math.min(1, fe * 1.5) * (1 + 0.3 * te(M(L.id, z.id, "highlight"))), 0, Math.PI * 2), E.fill()), e.values !== !1 && fe > 0) {
3293
+ if (E.fillStyle = le(L.id, z.id), o === "bar" ? he > 0.5 && (rh(E, J - b / 2, m.bottom - he, b, he, Math.min(6, b / 4)), E.fill()) : fe > 0 && (E.beginPath(), E.arc(J, m.bottom - he, S * Math.min(1, fe * 1.5) * (1 + 0.3 * te(M(L.id, z.id, "highlight"))), 0, Math.PI * 2), E.fill()), e.values !== !1 && fe > 0) {
3294
3294
  E.globalAlpha = Math.min(1, fe * 2), E.font = `600 ${a ? g * 0.85 : g}px ${t.font}`, E.fillStyle = Ln(t.text, t.highlight, te(M(L.id, z.id, "highlight")));
3295
3295
  const pe = m.bottom - he - (o === "line" ? S : 0) - g * 0.95;
3296
3296
  E.fillText(D(te(M(L.id, z.id, "value"))), J, pe), E.font = `${g}px ${t.font}`, E.globalAlpha = 1;
@@ -3301,20 +3301,20 @@ function Kf(e) {
3301
3301
  E.strokeStyle = t.text, E.lineWidth = 1.5, E.beginPath(), E.moveTo(m.left, m.bottom), E.lineTo(m.right, m.bottom), E.stroke(), E.restore();
3302
3302
  }
3303
3303
  };
3304
- function re(E, W) {
3305
- const U = s[0].id, te = ee(W);
3304
+ function re(E, K) {
3305
+ const U = s[0].id, te = ee(K);
3306
3306
  e.data.forEach((q, le) => {
3307
3307
  const L = te.get(q.id);
3308
3308
  if (L.sweep <= 1e-4) return;
3309
- const z = Z.get(q.id), J = z ? { x: W(`piece.${z.id}.x`), y: W(`piece.${z.id}.y`) } : { x: 0, y: 0 }, he = z ? W(`piece.${z.id}.rotate`) * Math.PI / 180 : 0, fe = z ? W(`piece.${z.id}.opacity`) : 1;
3309
+ const z = Z.get(q.id), J = z ? { x: K(`piece.${z.id}.x`), y: K(`piece.${z.id}.y`) } : { x: 0, y: 0 }, he = z ? K(`piece.${z.id}.rotate`) * Math.PI / 180 : 0, fe = z ? K(`piece.${z.id}.opacity`) : 1;
3310
3310
  if (fe <= 0) return;
3311
3311
  E.save(), E.globalAlpha = fe;
3312
3312
  const pe = { x: G.cx + Math.cos(L.mid) * L.out, y: G.cy + Math.sin(L.mid) * L.out };
3313
- E.translate(L.centre.x + J.x, L.centre.y + J.y), E.rotate(he), E.translate(-L.centre.x, -L.centre.y), E.beginPath(), E.arc(pe.x, pe.y, G.r, L.start, L.start + L.sweep), Y > 0 ? E.arc(pe.x, pe.y, Y, L.start + L.sweep, L.start, !0) : E.lineTo(pe.x, pe.y), E.closePath(), E.fillStyle = Ln(t.palette[le % t.palette.length], t.highlight, W(M(q.id, U, "highlight"))), E.fill(), E.strokeStyle = t.background, E.lineWidth = Math.max(1.5, g * 0.15), E.stroke(), e.values !== !1 && L.sweep >= 0.3 && (E.fillStyle = t.background, E.font = `600 ${g}px ${t.font}`, E.textAlign = "center", E.fillText(D(W(M(q.id, U, "value"))), L.centre.x, L.centre.y), E.font = `${g}px ${t.font}`), E.restore();
3313
+ E.translate(L.centre.x + J.x, L.centre.y + J.y), E.rotate(he), E.translate(-L.centre.x, -L.centre.y), E.beginPath(), E.arc(pe.x, pe.y, G.r, L.start, L.start + L.sweep), Y > 0 ? E.arc(pe.x, pe.y, Y, L.start + L.sweep, L.start, !0) : E.lineTo(pe.x, pe.y), E.closePath(), E.fillStyle = Ln(t.palette[le % t.palette.length], t.highlight, K(M(q.id, U, "highlight"))), E.fill(), E.strokeStyle = t.background, E.lineWidth = Math.max(1.5, g * 0.15), E.stroke(), e.values !== !1 && L.sweep >= 0.3 && (E.fillStyle = t.background, E.font = `600 ${g}px ${t.font}`, E.textAlign = "center", E.fillText(D(K(M(q.id, U, "value"))), L.centre.x, L.centre.y), E.font = `${g}px ${t.font}`), E.restore();
3314
3314
  const ge = x(L), Te = Math.cos(L.mid);
3315
3315
  E.globalAlpha = fe, E.fillStyle = t.text, E.textAlign = Te > 0.2 ? "left" : Te < -0.2 ? "right" : "center";
3316
3316
  const Pt = Te > 0.2 ? ge.left : Te < -0.2 ? ge.right : ge.left + ge.width / 2;
3317
- E.fillText(q.label ?? q.id, Pt, ge.top + ge.height / 2), e.values !== !1 && L.sweep < 0.3 && (E.globalAlpha = fe * 0.8, E.fillText(D(W(M(q.id, U, "value"))), Pt, ge.bottom + g * 0.65)), E.globalAlpha = 1;
3317
+ E.fillText(q.label ?? q.id, Pt, ge.top + ge.height / 2), e.values !== !1 && L.sweep < 0.3 && (E.globalAlpha = fe * 0.8, E.fillText(D(K(M(q.id, U, "value"))), Pt, ge.bottom + g * 0.65)), E.globalAlpha = 1;
3318
3318
  });
3319
3319
  }
3320
3320
  const ie = {
@@ -3324,22 +3324,22 @@ function Kf(e) {
3324
3324
  target: se,
3325
3325
  max: p,
3326
3326
  box: me(e.x, e.y, e.width, e.height),
3327
- anchor(E, W = 1 / 0) {
3328
- return X(ae(Q(E), W));
3327
+ anchor(E, K = 1 / 0) {
3328
+ return X(ae(Q(E), K));
3329
3329
  },
3330
3330
  piece(E) {
3331
- const W = Q(E);
3332
- if (W.kind !== "slice")
3331
+ const K = Q(E);
3332
+ if (K.kind !== "slice")
3333
3333
  throw new Error(r ? `chart: a piece is a slice, slice:ID, not "${E}"` : `chart: a ${f} is not a piece; slices of a pie or donut are (slice:ID). Change a ${f} with edit('set' | 'show' | 'highlight', …)`);
3334
- const U = Z.get(W.id);
3334
+ const U = Z.get(K.id);
3335
3335
  if (U) return U;
3336
- const te = { id: Z.size + 1, datum: W.id, home: X(ae(W, 0)) };
3337
- Z.set(W.id, te);
3336
+ const te = { id: Z.size + 1, datum: K.id, home: X(ae(K, 0)) };
3337
+ Z.set(K.id, te);
3338
3338
  for (const q of ["x", "y", "rotate"]) R[`piece.${te.id}.${q}`] = 0;
3339
3339
  return R[`piece.${te.id}.opacity`] = 1, te;
3340
3340
  },
3341
- edit(E, W, U) {
3342
- const te = Array.isArray(W) ? W : [W];
3341
+ edit(E, K, U) {
3342
+ const te = Array.isArray(K) ? K : [K];
3343
3343
  if (te.length === 0) throw new Error(`chart.edit: ${E} takes at least one anchor`);
3344
3344
  if (!(E in ut.edits)) throw An("chart", E, ut);
3345
3345
  if (E === "pull" && !r) throw new Error(`chart.edit: pull takes slice anchors of a pie or donut; a ${o} chart has ${f}s`);
@@ -3357,24 +3357,24 @@ function Kf(e) {
3357
3357
  }
3358
3358
  return ie;
3359
3359
  },
3360
- follow(E, W) {
3361
- return N.follow(E, W), ie;
3360
+ follow(E, K) {
3361
+ return N.follow(E, K), ie;
3362
3362
  },
3363
- fling(E, W) {
3364
- return N.fling(E, W), ie;
3363
+ fling(E, K) {
3364
+ return N.fling(E, K), ie;
3365
3365
  },
3366
- move(E, W) {
3367
- return N.move(E, W), ie;
3366
+ move(E, K) {
3367
+ return N.move(E, K), ie;
3368
3368
  },
3369
- ride(E, W, U) {
3369
+ ride(E, K, U) {
3370
3370
  if (o !== "bar") return E;
3371
3371
  const te = e.data.flatMap(
3372
3372
  (q) => s.map((le) => {
3373
- const L = V(q.id, le.id, 0), z = [...Wt(H.keys(M(q.id, le.id, "value"))), ...Wt(H.keys(M(q.id, le.id, "show")))];
3373
+ const L = V(q.id, le.id, 0), z = [...Kt(H.keys(M(q.id, le.id, "value"))), ...Kt(H.keys(M(q.id, le.id, "show")))];
3374
3374
  return { top: e.y + m.bottom - L, offset: (J) => L - V(q.id, le.id, J), windows: z };
3375
3375
  })
3376
3376
  );
3377
- return Wo(E, W, { ground: U.ground, every: U.every ?? et, floors: te });
3377
+ return Ko(E, K, { ground: U.ground, every: U.every ?? et, floors: te });
3378
3378
  },
3379
3379
  tracks: H.tracks
3380
3380
  };
@@ -3708,7 +3708,7 @@ const lh = {
3708
3708
  label: "Girl",
3709
3709
  group: "family",
3710
3710
  scale: 0.66,
3711
- options: { build: "child", hair: { style: "bob", color: Ke.chestnut }, ears: !0, outfit: { shirt: "#e86a92", trousers: "#4a5b8c", bottom: "skirt" } }
3711
+ options: { build: "child", hair: { style: "bob", color: We.chestnut }, ears: !0, outfit: { shirt: "#e86a92", trousers: "#4a5b8c", bottom: "skirt" } }
3712
3712
  },
3713
3713
  youngMan: {
3714
3714
  label: "Young man",
@@ -3720,7 +3720,7 @@ const lh = {
3720
3720
  label: "Young woman",
3721
3721
  group: "family",
3722
3722
  scale: 0.96,
3723
- options: { build: "slim", hair: { style: "highPonytail", color: Ke.auburn }, ears: !0, outfit: { shirt: "#f0b43c", trousers: "#36507a" } }
3723
+ options: { build: "slim", hair: { style: "highPonytail", color: We.auburn }, ears: !0, outfit: { shirt: "#f0b43c", trousers: "#36507a" } }
3724
3724
  },
3725
3725
  man: {
3726
3726
  label: "Man",
@@ -3732,7 +3732,7 @@ const lh = {
3732
3732
  label: "Woman",
3733
3733
  group: "family",
3734
3734
  scale: 0.95,
3735
- options: { build: "curvy", hair: { style: "shoulderWaves", color: Ke.black }, ears: !0, outfit: { shirt: "#9b5fc0", trousers: "#2f2f3a", sleeves: "long" } }
3735
+ options: { build: "curvy", hair: { style: "shoulderWaves", color: We.black }, ears: !0, outfit: { shirt: "#9b5fc0", trousers: "#2f2f3a", sleeves: "long" } }
3736
3736
  },
3737
3737
  grandpa: {
3738
3738
  label: "Grandpa",
@@ -3740,8 +3740,8 @@ const lh = {
3740
3740
  scale: 0.96,
3741
3741
  options: {
3742
3742
  build: "stocky",
3743
- hair: { style: "receding", color: Ke.gray },
3744
- facialHair: { style: "shortBoxed", color: Ke.white },
3743
+ hair: { style: "receding", color: We.gray },
3744
+ facialHair: { style: "shortBoxed", color: We.white },
3745
3745
  glasses: "square",
3746
3746
  ears: !0,
3747
3747
  outfit: { shirt: "#b98a5a", trousers: "#4b4440", sleeves: "long", collar: !0 }
@@ -3751,13 +3751,13 @@ const lh = {
3751
3751
  label: "Grandma",
3752
3752
  group: "family",
3753
3753
  scale: 0.9,
3754
- options: { build: "short", hair: { style: "topBun", color: Ke.white }, glasses: "round", ears: !0, outfit: { shirt: "#5d9fa8", trousers: "#5a4a5e", sleeves: "long", bottom: "skirt" } }
3754
+ options: { build: "short", hair: { style: "topBun", color: We.white }, glasses: "round", ears: !0, outfit: { shirt: "#5d9fa8", trousers: "#5a4a5e", sleeves: "long", bottom: "skirt" } }
3755
3755
  },
3756
3756
  doctor: {
3757
3757
  label: "Doctor",
3758
3758
  group: "work",
3759
3759
  scale: 0.97,
3760
- options: { build: "slim", hair: { style: "lowPonytail", color: Ke.black }, ears: !0, outfit: { shirt: "#8fb8d8", trousers: "#36507a", over: "labCoat", collar: !0 } }
3760
+ options: { build: "slim", hair: { style: "lowPonytail", color: We.black }, ears: !0, outfit: { shirt: "#8fb8d8", trousers: "#36507a", over: "labCoat", collar: !0 } }
3761
3761
  },
3762
3762
  cook: {
3763
3763
  label: "Cook",
@@ -3787,35 +3787,35 @@ const lh = {
3787
3787
  label: "Farmer",
3788
3788
  group: "work",
3789
3789
  scale: 0.97,
3790
- options: { build: "stocky", hair: { style: "shoulderStraight", color: Ke.blond }, hat: "sunHat", ears: !0, outfit: { shirt: "#d64535", trousers: "#4f6b3a", sleeves: "long" } }
3790
+ options: { build: "stocky", hair: { style: "shoulderStraight", color: We.blond }, hat: "sunHat", ears: !0, outfit: { shirt: "#d64535", trousers: "#4f6b3a", sleeves: "long" } }
3791
3791
  },
3792
3792
  ...lh,
3793
3793
  ...hh,
3794
3794
  ...ch
3795
3795
  };
3796
- function Wf(e, n = 300, t = {}) {
3796
+ function Kf(e, n = 300, t = {}) {
3797
3797
  const o = Qa[e];
3798
3798
  if (!o) throw new Error(`castMember: unknown cast member '${e}'`);
3799
3799
  return { ...o.options, height: Math.round(n * o.scale), ...t };
3800
3800
  }
3801
- const bn = {
3801
+ const yn = {
3802
3802
  handshake: { height: 0.47, spacing: 0.42, lean: 6 },
3803
3803
  highFive: { height: 0.9, spacing: 0.4, lean: 4 },
3804
3804
  fistBump: { height: 0.55, spacing: 0.44, lean: 6 },
3805
3805
  handOver: { height: 0.52, spacing: 0.46, lean: 8 }
3806
3806
  };
3807
3807
  function Ff(e, n, t) {
3808
- return bn[e].spacing * Math.min(n.height, t.height);
3808
+ return yn[e].spacing * Math.min(n.height, t.height);
3809
3809
  }
3810
3810
  const Is = 0.075;
3811
3811
  function Df(e, n, t, o = {}) {
3812
- const r = bn[e];
3813
- if (!r) throw new Error(`meetHands: unknown meeting '${e}' (one of ${Object.keys(bn).join(", ")})`);
3814
- const [a, s] = n.x <= t.x ? [n, t] : [t, n], i = o.view === "side", l = Math.min(a.character.height, s.character.height), c = { x: (a.x + s.x) / 2, y: -(o.height ?? r.height) * l }, h = (b, $) => {
3812
+ const r = yn[e];
3813
+ if (!r) throw new Error(`meetHands: unknown meeting '${e}' (one of ${Object.keys(yn).join(", ")})`);
3814
+ const [a, s] = n.x <= t.x ? [n, t] : [t, n], i = o.view === "side", l = Math.min(a.character.height, s.character.height), c = { x: (a.x + s.x) / 2, y: -(o.height ?? r.height) * l }, h = (y, $) => {
3815
3815
  const A = $ ? i ? 1 : 0.62 : i ? 3 : 3.38;
3816
- let k = { ...be, ...b.pose, turn: A, lean: (b.pose?.lean ?? 0) + r.lean };
3817
- const m = $ ? 1 : -1, P = (O, v, y) => {
3818
- k = Ue(b.character, k, O, { x: c.x + v - b.x, y: c.y, depth: y });
3816
+ let k = { ...ye, ...y.pose, turn: A, lean: (y.pose?.lean ?? 0) + r.lean };
3817
+ const m = $ ? 1 : -1, P = (O, v, b) => {
3818
+ k = Ue(y.character, k, O, { x: c.x + v - y.x, y: c.y, depth: b });
3819
3819
  };
3820
3820
  if (e === "handOver") {
3821
3821
  const O = Is * l;
@@ -3823,9 +3823,9 @@ function Df(e, n, t, o = {}) {
3823
3823
  } else
3824
3824
  P("arm.right", 0, 0);
3825
3825
  return e === "fistBump" && (k = { ...k, "hand.right.index.curl": 1, "hand.right.middle.curl": 1, "hand.right.ring.curl": 1, "hand.right.pinky.curl": 1 }), k;
3826
- }, d = h(a, !0), f = h(s, !1), u = 0.03 * l, p = (b, $) => {
3827
- const A = Ne(b.character, $), k = e === "handOver" ? ["hand.left", "hand.right"] : ["hand.right"], m = e === "handOver" ? Is * l + u : u;
3828
- return k.every((P) => Math.abs(A.points[P].y - c.y) < u && Math.abs(A.points[P].x + b.x - c.x) < m);
3826
+ }, d = h(a, !0), f = h(s, !1), u = 0.03 * l, p = (y, $) => {
3827
+ const A = Ne(y.character, $), k = e === "handOver" ? ["hand.left", "hand.right"] : ["hand.right"], m = e === "handOver" ? Is * l + u : u;
3828
+ return k.every((P) => Math.abs(A.points[P].y - c.y) < u && Math.abs(A.points[P].x + y.x - c.x) < m);
3829
3829
  }, g = p(a, d) && p(s, f);
3830
3830
  return n.x <= t.x ? { a: d, b: f, point: c, reached: g } : { a: f, b: d, point: c, reached: g };
3831
3831
  }
@@ -3834,16 +3834,16 @@ function Lf(e, n) {
3834
3834
  return go.spacing * Math.min(e.height, n.height);
3835
3835
  }
3836
3836
  function Bf(e, n, t = {}) {
3837
- const [o, r] = e.x <= n.x ? [e, n] : [n, e], a = t.view === "side", s = Math.min(o.character.height, r.character.height), i = (p, g, b) => ({
3838
- over: { x: g.x - b * 0.02 * s - p.x, y: -0.72 * s, depth: -0.08 * s },
3839
- round: { x: g.x - b * 0.04 * s - p.x, y: -0.5 * s, depth: 0.06 * s }
3840
- }), l = (p, g, b) => {
3841
- const $ = b ? a ? 1 : 0.62 : a ? 3 : 3.38, A = b ? 1 : -1;
3842
- let k = { ...be, ...p.pose, turn: $, lean: (p.pose?.lean ?? 0) + go.lean, "head.tilt": (p.pose?.["head.tilt"] ?? 0) + A * go.tilt };
3837
+ const [o, r] = e.x <= n.x ? [e, n] : [n, e], a = t.view === "side", s = Math.min(o.character.height, r.character.height), i = (p, g, y) => ({
3838
+ over: { x: g.x - y * 0.02 * s - p.x, y: -0.72 * s, depth: -0.08 * s },
3839
+ round: { x: g.x - y * 0.04 * s - p.x, y: -0.5 * s, depth: 0.06 * s }
3840
+ }), l = (p, g, y) => {
3841
+ const $ = y ? a ? 1 : 0.62 : a ? 3 : 3.38, A = y ? 1 : -1;
3842
+ let k = { ...ye, ...p.pose, turn: $, lean: (p.pose?.lean ?? 0) + go.lean, "head.tilt": (p.pose?.["head.tilt"] ?? 0) + A * go.tilt };
3843
3843
  const { over: m, round: P } = i(p, g, A);
3844
3844
  return k = Ue(p.character, k, "arm.right", m), k = Ue(p.character, k, "arm.left", P), k;
3845
- }, c = l(o, r, !0), h = l(r, o, !1), d = 0.05 * s, f = (p, g, b, $) => {
3846
- const A = Ne(p.character, $).points, { over: k, round: m } = i(p, g, b);
3845
+ }, c = l(o, r, !0), h = l(r, o, !1), d = 0.05 * s, f = (p, g, y, $) => {
3846
+ const A = Ne(p.character, $).points, { over: k, round: m } = i(p, g, y);
3847
3847
  return Math.hypot(A["hand.right"].x - k.x, A["hand.right"].y - k.y) < d && Math.hypot(A["hand.left"].x - m.x, A["hand.left"].y - m.y) < d;
3848
3848
  }, u = f(o, r, 1, c) && f(r, o, -1, h);
3849
3849
  return e.x <= n.x ? { a: c, b: h, reached: u } : { a: h, b: c, reached: u };
@@ -3853,19 +3853,19 @@ function qf(e, n) {
3853
3853
  return gt.spacing * Math.min(e.height, n.height);
3854
3854
  }
3855
3855
  function Gf(e, n, t, o = {}) {
3856
- const r = Math.max(0, Math.min(1, t)), a = o.view === "side", s = e.x <= n.x, i = Math.min(e.character.height, n.character.height), l = { x: (e.x + n.x) / 2, y: -(gt.low + (gt.high - gt.low) * r) * i }, c = (b) => b ? a ? 1 : 0.62 : a ? 3 : 3.38;
3857
- let h = { ...be, ...e.pose, turn: c(s), lean: (e.pose?.lean ?? 0) + gt.helperLean * (1 - r) + 4, bend: (e.pose?.bend ?? 0) + gt.helperBend * (1 - r), "head.nod": 18 * (1 - r) };
3856
+ const r = Math.max(0, Math.min(1, t)), a = o.view === "side", s = e.x <= n.x, i = Math.min(e.character.height, n.character.height), l = { x: (e.x + n.x) / 2, y: -(gt.low + (gt.high - gt.low) * r) * i }, c = (y) => y ? a ? 1 : 0.62 : a ? 3 : 3.38;
3857
+ let h = { ...ye, ...e.pose, turn: c(s), lean: (e.pose?.lean ?? 0) + gt.helperLean * (1 - r) + 4, bend: (e.pose?.bend ?? 0) + gt.helperBend * (1 - r), "head.nod": 18 * (1 - r) };
3858
3858
  h = Ue(e.character, h, "arm.right", { x: l.x - e.x, y: l.y });
3859
- const d = { ...Fe.sitFloor, ...n.pose, turn: c(!s) }, f = { ...be, ...n.pose, turn: c(!s) };
3860
- let u = ya(d, f, r);
3859
+ const d = { ...Fe.sitFloor, ...n.pose, turn: c(!s) }, f = { ...ye, ...n.pose, turn: c(!s) };
3860
+ let u = ba(d, f, r);
3861
3861
  u = Ue(n.character, u, "arm.right", { x: l.x - n.x, y: l.y });
3862
- const p = 0.04 * i, g = (b, $) => {
3863
- const A = Ne(b.character, $).points["hand.right"];
3864
- return Math.hypot(A.x + b.x - l.x, A.y - l.y) < p;
3862
+ const p = 0.04 * i, g = (y, $) => {
3863
+ const A = Ne(y.character, $).points["hand.right"];
3864
+ return Math.hypot(A.x + y.x - l.x, A.y - l.y) < p;
3865
3865
  };
3866
3866
  return { helper: h, sitter: u, point: l, reached: g(e, h) && g(n, u) };
3867
3867
  }
3868
- const dh = 0.7, fh = 50, uh = 1.2, gh = 0.8, ph = 3, mh = 30, bh = 0.8, yh = 0.6, Bn = (e, n) => Math.max(-n, Math.min(n, e)), wh = ["hair.swing", "hair.trail", "hair.lift"];
3868
+ const dh = 0.7, fh = 50, uh = 1.2, gh = 0.8, ph = 3, mh = 30, yh = 0.8, bh = 0.6, Bn = (e, n) => Math.max(-n, Math.min(n, e)), wh = ["hair.swing", "hair.trail", "hair.lift"];
3869
3869
  function kh(e, n) {
3870
3870
  const t = n.start ?? 0, o = n.amount ?? 1, r = Math.max(1e-6, n.headRadius);
3871
3871
  let a = NaN, s = { x: 0, y: 0, turn: 0 };
@@ -3874,7 +3874,7 @@ function kh(e, n) {
3874
3874
  return p.turn * 90 + (p.headTurn ?? 0);
3875
3875
  }, c = { start: t, end: n.end, step: n.step, stiffness: n.stiffness ?? 70, damping: n.damping ?? 6 }, h = on(l, c), d = on((u) => i(u).x, c), f = on((u) => i(u).y, c);
3876
3876
  return h.map((u, p) => {
3877
- const g = i(u.time), b = u.value - l(u.time), $ = d[p].value - g.x - (n.wind ?? 0) * dh * r, A = f[p].value - g.y, k = Math.sin(g.turn * Math.PI / 2), m = Math.cos(g.turn * Math.PI / 2), P = b * ph + $ * m / r * mh, O = -$ * k / r * bh, v = -A / r * yh;
3877
+ const g = i(u.time), y = u.value - l(u.time), $ = d[p].value - g.x - (n.wind ?? 0) * dh * r, A = f[p].value - g.y, k = Math.sin(g.turn * Math.PI / 2), m = Math.cos(g.turn * Math.PI / 2), P = y * ph + $ * m / r * mh, O = -$ * k / r * yh, v = -A / r * bh;
3878
3878
  return {
3879
3879
  time: u.time,
3880
3880
  swing: Bn(P * o, fh),
@@ -3903,7 +3903,7 @@ const Hs = (e) => ({ "hair.swing": e.swing, "hair.trail": e.trail, "hair.lift":
3903
3903
  function Uf(e, n, t, o = {}) {
3904
3904
  const r = t.head.hair;
3905
3905
  if (!r || !zr(r)) return [];
3906
- const a = n.filter((A) => A.target === e), s = a.reduce((A, k) => k.keyframes.reduce((m, P) => Math.max(m, P.time), A), 0), i = be, l = /* @__PURE__ */ new Set(["x", "y", "turn", "head.turn"]), c = new ve({ id: `${e}-hair-follow`, tracks: a.filter((A) => l.has(A.property)) }), h = (A, k, m) => {
3906
+ const a = n.filter((A) => A.target === e), s = a.reduce((A, k) => k.keyframes.reduce((m, P) => Math.max(m, P.time), A), 0), i = ye, l = /* @__PURE__ */ new Set(["x", "y", "turn", "head.turn"]), c = new ve({ id: `${e}-hair-follow`, tracks: a.filter((A) => l.has(A.property)) }), h = (A, k, m) => {
3907
3907
  const P = c.getStateAtTime(A).values.get(e)?.get(k);
3908
3908
  return typeof P == "number" ? P : m;
3909
3909
  }, d = new ve({ id: `${e}-hair-pose`, tracks: a }), f = (A) => d.getStateAtTime(A).values.get(e), u = /* @__PURE__ */ new Map(), p = (A) => {
@@ -3911,15 +3911,15 @@ function Uf(e, n, t, o = {}) {
3911
3911
  let m = u.get(k);
3912
3912
  if (!m) {
3913
3913
  const P = {};
3914
- for (const [v, y] of f(k * dt) ?? []) P[v] = y;
3915
- const O = Ne(t, Kr(P, i, o.gaits)).head.center;
3914
+ for (const [v, b] of f(k * dt) ?? []) P[v] = b;
3915
+ const O = Ne(t, Wr(P, i, o.gaits)).head.center;
3916
3916
  u.set(k, m = { x: O.x, y: O.y });
3917
3917
  }
3918
3918
  return m;
3919
3919
  }, g = (A) => {
3920
3920
  const k = Math.floor(A / dt), m = A / dt - k, P = p(k * dt), O = p((k + 1) * dt);
3921
3921
  return { x: P.x + (O.x - P.x) * m, y: P.y + (O.y - P.y) * m };
3922
- }, b = kh(
3922
+ }, y = kh(
3923
3923
  (A) => {
3924
3924
  const k = g(A);
3925
3925
  return {
@@ -3932,7 +3932,7 @@ function Uf(e, n, t, o = {}) {
3932
3932
  {
3933
3933
  start: 0,
3934
3934
  end: s + (o.settle ?? vh),
3935
- headRadius: Ne(t, be).head.rx,
3935
+ headRadius: Ne(t, ye).head.rx,
3936
3936
  step: o.step,
3937
3937
  stiffness: o.stiffness,
3938
3938
  damping: o.damping,
@@ -3942,18 +3942,18 @@ function Uf(e, n, t, o = {}) {
3942
3942
  ), $ = [];
3943
3943
  for (const A of wh) {
3944
3944
  const k = A.slice(5);
3945
- let m = b.map((O) => ({ time: O.time, value: O[k] }));
3945
+ let m = y.map((O) => ({ time: O.time, value: O[k] }));
3946
3946
  if (m.every((O) => Math.abs(O.value) < 1e-3)) continue;
3947
3947
  const P = a.find((O) => O.property === A);
3948
3948
  if (P) {
3949
- const O = new ve({ id: `${e}-${A}-own`, tracks: [P] }), v = (y) => Number(O.getStateAtTime(y).values.get(e)?.get(A) ?? 0);
3950
- m = m.map((y) => ({ time: y.time, value: y.value + v(y.time) }));
3949
+ const O = new ve({ id: `${e}-${A}-own`, tracks: [P] }), v = (b) => Number(O.getStateAtTime(b).values.get(e)?.get(A) ?? 0);
3950
+ m = m.map((b) => ({ time: b.time, value: b.value + v(b.time) }));
3951
3951
  }
3952
3952
  $.push({ id: `${e}-${A}`, target: e, property: A, keyframes: m });
3953
3953
  }
3954
3954
  return $;
3955
3955
  }
3956
- const yt = {
3956
+ const bt = {
3957
3957
  full: {
3958
3958
  anticipation: 0.12,
3959
3959
  anticipationTime: 0.3,
@@ -4016,10 +4016,10 @@ const yt = {
4016
4016
  }
4017
4017
  };
4018
4018
  function er(e) {
4019
- if (e === void 0) return yt.full;
4020
- if (typeof e == "string") return yt[e];
4019
+ if (e === void 0) return bt.full;
4020
+ if (typeof e == "string") return bt[e];
4021
4021
  const { base: n, ...t } = e;
4022
- return { ...yt[n ?? "full"], ...t };
4022
+ return { ...bt[n ?? "full"], ...t };
4023
4023
  }
4024
4024
  const po = 160, Sh = 120, Mh = 700, qn = 60, $h = 90, Zt = 3200, wt = 1, nt = 1e-6;
4025
4025
  function Fo(e, n, t = {}) {
@@ -4044,28 +4044,28 @@ function Eh(e, n, t, o, r) {
4044
4044
  const p = (n[u].time - n[u - 1].time) / 2;
4045
4045
  return Math.max(-p, Math.min(p, l));
4046
4046
  }, h = [{ time: n[0].time, value: n[0].pose[e] }], d = (u, p, g) => {
4047
- const b = h[h.length - 1];
4048
- if (u <= b.time + wt) {
4049
- h[h.length - 1] = { ...b, value: p, ...g ? { easing: g } : {} };
4047
+ const y = h[h.length - 1];
4048
+ if (u <= y.time + wt) {
4049
+ h[h.length - 1] = { ...y, value: p, ...g ? { easing: g } : {} };
4050
4050
  return;
4051
4051
  }
4052
4052
  h.push({ time: u, value: p, ...g ? { easing: g } : {} });
4053
4053
  };
4054
4054
  let f = n[0].pose[e];
4055
4055
  for (let u = 1; u < n.length; u++) {
4056
- const p = n[u], g = n[u - 1].pose[e], b = p.pose[e], $ = b - g, A = h[h.length - 1].time, k = p.act !== !1;
4056
+ const p = n[u], g = n[u - 1].pose[e], y = p.pose[e], $ = y - g, A = h[h.length - 1].time, k = p.act !== !1;
4057
4057
  if (Math.abs($) <= nt) {
4058
4058
  const T = p.time + (k ? c(u) : 0);
4059
4059
  if (u === n.length - 1)
4060
- Math.abs(f - b) > nt && d(Math.max(T, A + po), b, "ease-in-out"), f = b;
4060
+ Math.abs(f - y) > nt && d(Math.max(T, A + po), y, "ease-in-out"), f = y;
4061
4061
  else if (k && i && o.drift > 0 && t.drift.includes(e) && T - A >= Mh) {
4062
4062
  const I = Xe(`${r}:${e}:${u}`) % 2 === 0 ? 1 : -1;
4063
- f = b + I * o.drift * s, d(T, f, "ease-in-out");
4063
+ f = y + I * o.drift * s, d(T, f, "ease-in-out");
4064
4064
  }
4065
4065
  continue;
4066
4066
  }
4067
4067
  if (!k) {
4068
- d(n[u - 1].time, f), d(p.time, b, p.easing), f = b;
4068
+ d(n[u - 1].time, f), d(p.time, y, p.easing), f = y;
4069
4069
  continue;
4070
4070
  }
4071
4071
  const m = c(u), P = Math.max(n[u - 1].time + m, A);
@@ -4073,22 +4073,22 @@ function Eh(e, n, t, o, r) {
4073
4073
  a && o.eyeDart > 0 && (O = Math.min(O, P + o.eyeDart));
4074
4074
  const v = O - P;
4075
4075
  if (v <= wt) {
4076
- d(p.time, b, p.easing), f = b;
4076
+ d(p.time, y, p.easing), f = y;
4077
4077
  continue;
4078
4078
  }
4079
4079
  d(P, f);
4080
- const y = Math.sign($);
4080
+ const b = Math.sign($);
4081
4081
  if (i && o.anticipation > 0 && s > 0 && v >= po) {
4082
- const T = f - y * Math.min(Math.abs($) * o.anticipation, s), I = P + v * o.anticipationTime;
4082
+ const T = f - b * Math.min(Math.abs($) * o.anticipation, s), I = P + v * o.anticipationTime;
4083
4083
  d(I, T, "ease-in-out"), o.hold > 0 && d(I + v * o.hold, T);
4084
4084
  }
4085
4085
  const S = u + 1 < n.length ? n[u + 1].time - p.time : 1 / 0, w = Math.min(o.settle, S / 2);
4086
4086
  if (i && o.overshoot > 0 && s > 0 && v >= Sh && w > wt) {
4087
4087
  const T = Math.min(Math.abs($) * o.overshoot, s);
4088
- d(O, b + y * T, p.easing ?? o.actionEase), d(O + w, b, o.settleEase);
4088
+ d(O, y + b * T, p.easing ?? o.actionEase), d(O + w, y, o.settleEase);
4089
4089
  } else
4090
- d(O, b, p.easing ?? o.actionEase);
4091
- f = b;
4090
+ d(O, y, p.easing ?? o.actionEase);
4091
+ f = y;
4092
4092
  }
4093
4093
  return h;
4094
4094
  }
@@ -4202,7 +4202,7 @@ function Oh(e) {
4202
4202
  }
4203
4203
  function Ih() {
4204
4204
  const e = {}, n = {};
4205
- for (const t of Object.keys(be)) {
4205
+ for (const t of Object.keys(ye)) {
4206
4206
  const o = Oh(t);
4207
4207
  e[t] = o.depth, o.limit !== void 0 && (n[t] = o.limit);
4208
4208
  }
@@ -4226,7 +4226,7 @@ function jh(e, n, t = {}) {
4226
4226
  return tr(e, Fo(r, t.rig ?? Ph, t));
4227
4227
  }
4228
4228
  function Ch(e, n, t = {}) {
4229
- const o = t.rest ?? be, r = Wr(n, o), a = n.map((s, i) => ({ time: s.time, pose: { ...o, ...r[i] }, easing: s.easing, act: s.act }));
4229
+ const o = t.rest ?? ye, r = Kr(n, o), a = n.map((s, i) => ({ time: s.time, pose: { ...o, ...r[i] }, easing: s.easing, act: s.act }));
4230
4230
  return tr(e, Fo(a, t.rig ?? Hh, t));
4231
4231
  }
4232
4232
  const js = Ae.shocked, _h = Ae.scared, ot = {
@@ -4285,7 +4285,7 @@ function nr(e, n) {
4285
4285
  ...e.map((r) => (o = { ...o, ...r.pose }, { time: n.at + r.after * t, pose: o, act: !1, ...r.easing ? { easing: r.easing } : {} }))
4286
4286
  ];
4287
4287
  }
4288
- function yn(e, n = 1) {
4288
+ function bn(e, n = 1) {
4289
4289
  const t = ot[e](de);
4290
4290
  return t[t.length - 1].after * n;
4291
4291
  }
@@ -4296,8 +4296,8 @@ function xh(e, n, t = {}) {
4296
4296
  for (let i = 0; i < o; i++) {
4297
4297
  const l = (i - (o - 1) / 2) * r, c = Math.floor(Math.abs(l) / Math.max(r, 1) * (n.length / 6));
4298
4298
  for (let h = c + 1; h < n.length; h++) {
4299
- const d = n[h - 1], f = n[h], u = f.x - d.x, p = f.y - d.y, g = Math.hypot(u, p) || 1, b = -p / g, $ = u / g, A = 1 - h / (n.length - 1);
4300
- e.globalAlpha = s * (1 - A), e.lineWidth = a * (1 - A * 0.7), e.beginPath(), e.moveTo(d.x + b * l, d.y + $ * l), e.lineTo(f.x + b * l, f.y + $ * l), e.stroke();
4299
+ const d = n[h - 1], f = n[h], u = f.x - d.x, p = f.y - d.y, g = Math.hypot(u, p) || 1, y = -p / g, $ = u / g, A = 1 - h / (n.length - 1);
4300
+ e.globalAlpha = s * (1 - A), e.lineWidth = a * (1 - A * 0.7), e.beginPath(), e.moveTo(d.x + y * l, d.y + $ * l), e.lineTo(f.x + y * l, f.y + $ * l), e.stroke();
4301
4301
  }
4302
4302
  }
4303
4303
  e.restore();
@@ -4332,9 +4332,9 @@ function Xf(e, n, t, o, r = {}) {
4332
4332
  const p = c.map(u.at);
4333
4333
  let g = 0;
4334
4334
  for (let A = 1; A < p.length; A++) g += Math.hypot(p[A].x - p[A - 1].x, p[A].y - p[A - 1].y);
4335
- const b = g / ((t.time - l) / 1e3);
4336
- if (b <= d) continue;
4337
- const $ = Math.min(1, (b - d) / (d * 0.5));
4335
+ const y = g / ((t.time - l) / 1e3);
4336
+ if (y <= d) continue;
4337
+ const $ = Math.min(1, (y - d) / (d * 0.5));
4338
4338
  xh(e, p, { ...r, opacity: (r.opacity ?? 0.7) * $, spacing: r.spacing ?? h * 0.02 });
4339
4339
  }
4340
4340
  }
@@ -4411,7 +4411,7 @@ function ar(e = {}) {
4411
4411
  for (const [t, o] of Object.entries(e.actions ?? {})) n[t] = o.summary;
4412
4412
  return n;
4413
4413
  }
4414
- const mo = ["do", "at", "for", "to", "toward", "mood", "say", "pose", "target", "onto"], Kh = {
4414
+ const mo = ["do", "at", "for", "to", "toward", "mood", "say", "pose", "target", "onto"], Wh = {
4415
4415
  action: "do",
4416
4416
  type: "do",
4417
4417
  verb: "do",
@@ -4452,7 +4452,7 @@ function wn(e, n = {}) {
4452
4452
  }
4453
4453
  const f = l;
4454
4454
  for (const g of Object.keys(f))
4455
- mo.includes(g) || h(ce("beat field", g, mo, Kh[g.toLowerCase()]));
4455
+ mo.includes(g) || h(ce("beat field", g, mo, Wh[g.toLowerCase()]));
4456
4456
  const u = f.do;
4457
4457
  if (u === void 0) {
4458
4458
  h(`A beat needs \`do\` (what happens). Actions: ${o.join(", ")}`);
@@ -4469,16 +4469,16 @@ function wn(e, n = {}) {
4469
4469
  if (!f.pose || typeof f.pose != "object" || Array.isArray(f.pose))
4470
4470
  h("`pose` is joints to change, an object like { rightShoulder: 90 } (for a named pose, use it as the action).");
4471
4471
  else
4472
- for (const [g, b] of Object.entries(f.pose))
4473
- s.includes(g) ? Je(b) || h(`Pose joint \`${g}\` must be a number (got ${JSON.stringify(b)}).`) : h(ce("pose joint", g, s));
4472
+ for (const [g, y] of Object.entries(f.pose))
4473
+ s.includes(g) ? Je(y) || h(`Pose joint \`${g}\` must be a number (got ${JSON.stringify(y)}).`) : h(ce("pose joint", g, s));
4474
4474
  for (const g of ["at", "for"]) {
4475
- const b = f[g];
4476
- b !== void 0 && !(Je(b) && b >= 0) && h(`\`${g}\` is milliseconds, a number ≥ 0 (got ${JSON.stringify(b)}).`);
4475
+ const y = f[g];
4476
+ y !== void 0 && !(Je(y) && y >= 0) && h(`\`${g}\` is milliseconds, a number ≥ 0 (got ${JSON.stringify(y)}).`);
4477
4477
  }
4478
4478
  Je(f.at) && (f.at < i && d(`\`at\` ${f.at} is before an earlier beat's \`at\` (${i}); beats run in order, so it starts when the one before ends.`), i = f.at);
4479
4479
  for (const g of ["to", "onto"]) {
4480
- const b = f[g];
4481
- b !== void 0 && !Je(b) && h(`\`${g}\` is a scene ${g === "to" ? "x" : "y"} in px, a number (got ${JSON.stringify(b)}).`);
4480
+ const y = f[g];
4481
+ y !== void 0 && !Je(y) && h(`\`${g}\` is a scene ${g === "to" ? "x" : "y"} in px, a number (got ${JSON.stringify(y)}).`);
4482
4482
  }
4483
4483
  if (f.toward !== void 0 && !Je(f.toward) && !Qt.includes(f.toward) && h(`\`toward\` is a scene x or one of ${Qt.join(", ")}${typeof f.toward == "string" && ro(f.toward, Qt) ? ` (did you mean "${ro(f.toward, Qt)}"?)` : ""} (got ${JSON.stringify(f.toward)}).`), f.say !== void 0 && typeof f.say != "string" && h(`\`say\` is the line spoken, a string (got ${JSON.stringify(f.say)}).`), f.target !== void 0) {
4484
4484
  const g = f.target;
@@ -4518,7 +4518,7 @@ function Do(e, n = {}, t = 0) {
4518
4518
  return Do(a, n, t + 1);
4519
4519
  });
4520
4520
  }
4521
- function Wh(e) {
4521
+ function Kh(e) {
4522
4522
  return e.length === 0 ? 0 : Math.max(...e.map((n) => n.after));
4523
4523
  }
4524
4524
  const Ns = {
@@ -4530,7 +4530,7 @@ const Ns = {
4530
4530
  tired: 1500,
4531
4531
  shove: 1300,
4532
4532
  run: 560
4533
- }, Fh = 450, Dh = 2.4, Lh = 160, Rs = 2.5, Bh = 200, qh = 340, Gh = 1.1, zs = [380, 900], Yh = 0.35, en = 300, Gn = 150, Uh = 260, Xh = 1.2, Yn = 160, Ks = 400, jt = 300, Vh = 450, Ws = 500, Un = 350, Fs = 150, Jh = 120, Xn = 180, Ds = 420, Zh = 300, Ls = 300, Qh = 140, Vn = 150, Bs = 450, ec = 450, Jn = 150, qs = 350, Gs = 400, tc = 12, nc = 600, Ys = 90, Us = 400, oc = 200, sc = 0.09, Xs = 350, Re = 450, Zn = 1200, ac = 700, ft = 320, ze = 220, rc = 65, ic = 700, Vs = (e) => e in ot, lc = (e) => e in He;
4533
+ }, Fh = 450, Dh = 2.4, Lh = 160, Rs = 2.5, Bh = 200, qh = 340, Gh = 1.1, zs = [380, 900], Yh = 0.35, en = 300, Gn = 150, Uh = 260, Xh = 1.2, Yn = 160, Ws = 400, jt = 300, Vh = 450, Ks = 500, Un = 350, Fs = 150, Jh = 120, Xn = 180, Ds = 420, Zh = 300, Ls = 300, Qh = 140, Vn = 150, Bs = 450, ec = 450, Jn = 150, qs = 350, Gs = 400, tc = 12, nc = 600, Ys = 90, Us = 400, oc = 200, sc = 0.09, Xs = 350, Re = 450, Zn = 1200, ac = 700, ft = 320, ze = 220, rc = 65, ic = 700, Vs = (e) => e in ot, lc = (e) => e in He;
4534
4534
  function hc(e) {
4535
4535
  return Math.max(ic, Array.from(e).length * rc);
4536
4536
  }
@@ -4543,25 +4543,25 @@ function Lo(e, n, t = {}) {
4543
4543
  const _ = t.actions?.[M];
4544
4544
  return _ && "steps" in _ ? _ : void 0;
4545
4545
  }, c = t.from ?? 0, h = t.ground ?? 0, d = t.height ?? 300;
4546
- let f = c, u = h, p = t.facing ?? 1, g = t.start ?? de, b = 0, $ = 0;
4547
- const A = [{ time: 0, pose: g }], k = [{ time: 0, value: 0 }], m = [{ time: 0, value: 0 }], P = [{ time: 0, value: 0 }], O = [{ time: 0, value: 0 }], v = [{ time: 0, value: "walk" }], y = [{ time: 0, value: p }], S = [], w = [], T = [], I = (M, _, V, ee) => {
4546
+ let f = c, u = h, p = t.facing ?? 1, g = t.start ?? de, y = 0, $ = 0;
4547
+ const A = [{ time: 0, pose: g }], k = [{ time: 0, value: 0 }], m = [{ time: 0, value: 0 }], P = [{ time: 0, value: 0 }], O = [{ time: 0, value: 0 }], v = [{ time: 0, value: "walk" }], b = [{ time: 0, value: p }], S = [], w = [], T = [], I = (M, _, V, ee) => {
4548
4548
  g = { ...g, ..._ }, V && (g = pt(g, V)), A.push({ time: M, pose: g, ...ee === !1 ? { act: ee } : {} });
4549
- }, C = (M, _, V) => (I(M + ft / 2, { turn: 0 }, V), y.push({ time: M + ft / 2, value: p }, { time: M + ft / 2 + 1, value: _ }), p = _, I(M + ft, { turn: 1 }), M + ft), j = (M) => M < f ? -1 : 1, K = (M, _, V) => j(_) !== p ? C(M, j(_), V) : M, G = (M, _, V, ee = "arm") => {
4550
- const F = ee === "arm", Q = We({ ...M, ...F ? { rightShoulder: 0, rightElbow: 0 } : { rightHip: 0, rightKnee: 0 } }, { height: d, facing: p }), ae = F ? Q.shoulders.right : Q.hip, x = F ? Q.elbows.right : Q.knees.right, X = (se, re) => Math.atan2(p * se, re) * 180 / Math.PI, Z = ((X(_ - (f + ae.x), V - (u + ae.y)) - X(x.x - ae.x, x.y - ae.y)) % 360 + 360) % 360;
4549
+ }, C = (M, _, V) => (I(M + ft / 2, { turn: 0 }, V), b.push({ time: M + ft / 2, value: p }, { time: M + ft / 2 + 1, value: _ }), p = _, I(M + ft, { turn: 1 }), M + ft), j = (M) => M < f ? -1 : 1, W = (M, _, V) => j(_) !== p ? C(M, j(_), V) : M, G = (M, _, V, ee = "arm") => {
4550
+ const F = ee === "arm", Q = Ke({ ...M, ...F ? { rightShoulder: 0, rightElbow: 0 } : { rightHip: 0, rightKnee: 0 } }, { height: d, facing: p }), ae = F ? Q.shoulders.right : Q.hip, x = F ? Q.elbows.right : Q.knees.right, X = (se, re) => Math.atan2(p * se, re) * 180 / Math.PI, Z = ((X(_ - (f + ae.x), V - (u + ae.y)) - X(x.x - ae.x, x.y - ae.y)) % 360 + 360) % 360;
4551
4551
  return Z > 270 ? Z - 360 : Z;
4552
4552
  }, Y = (M, _, V, ee) => {
4553
- const F = ee === "arm", Q = We({ ...M, ...F ? { rightShoulder: 90, rightElbow: 0, rightWrist: 0 } : { rightHip: 90, rightKnee: 0 } }, { height: d, facing: p }), ae = F ? Q.shoulders.right : Q.hip, x = F ? { x: (Q.hands.right.x + Q.fingertips.right.x) / 2, y: (Q.hands.right.y + Q.fingertips.right.y) / 2 } : Q.feet.right, X = Math.hypot(x.x - ae.x, x.y - ae.y) * ((F ? t.reach?.arm : t.reach?.leg) ?? 1), D = V - (u + ae.y), Z = Math.abs(D) < X ? Math.sqrt(X * X - D * D) : X * 0.1;
4553
+ const F = ee === "arm", Q = Ke({ ...M, ...F ? { rightShoulder: 90, rightElbow: 0, rightWrist: 0 } : { rightHip: 90, rightKnee: 0 } }, { height: d, facing: p }), ae = F ? Q.shoulders.right : Q.hip, x = F ? { x: (Q.hands.right.x + Q.fingertips.right.x) / 2, y: (Q.hands.right.y + Q.fingertips.right.y) / 2 } : Q.feet.right, X = Math.hypot(x.x - ae.x, x.y - ae.y) * ((F ? t.reach?.arm : t.reach?.leg) ?? 1), D = V - (u + ae.y), Z = Math.abs(D) < X ? Math.sqrt(X * X - D * D) : X * 0.1;
4554
4554
  return _ - ae.x - p * Z;
4555
4555
  }, ne = (M) => {
4556
- const _ = We(M, { height: d, facing: p });
4556
+ const _ = Ke(M, { height: d, facing: p });
4557
4557
  return { x: f + (_.hands.right.x + _.fingertips.right.x) / 2, y: u + (_.hands.right.y + _.fingertips.right.y) / 2 };
4558
4558
  }, B = (M, _, V) => {
4559
- const ee = { ...M, rightWrist: 0, rightElbow: 0, rightShoulder: G(M, _, V) }, F = We(ee, { height: d, facing: p }), Q = { x: f + F.shoulders.right.x, y: u + F.shoulders.right.y }, ae = { x: f + F.elbows.right.x, y: u + F.elbows.right.y }, x = ne(ee), X = Math.hypot(ae.x - Q.x, ae.y - Q.y), D = Math.hypot(x.x - ae.x, x.y - ae.y), Z = Math.min(X + D - 0.01, Math.max(Math.abs(X - D) + 0.01, Math.hypot(_ - Q.x, V - Q.y))), se = (U) => U * 180 / Math.PI, re = se(Math.acos((X * X + Z * Z - D * D) / (2 * X * Z))), ie = 180 - se(Math.acos((X * X + D * D - Z * Z) / (2 * X * D)));
4560
- let E = { rightShoulder: ee.rightShoulder, rightElbow: 0 }, W = 1 / 0;
4559
+ const ee = { ...M, rightWrist: 0, rightElbow: 0, rightShoulder: G(M, _, V) }, F = Ke(ee, { height: d, facing: p }), Q = { x: f + F.shoulders.right.x, y: u + F.shoulders.right.y }, ae = { x: f + F.elbows.right.x, y: u + F.elbows.right.y }, x = ne(ee), X = Math.hypot(ae.x - Q.x, ae.y - Q.y), D = Math.hypot(x.x - ae.x, x.y - ae.y), Z = Math.min(X + D - 0.01, Math.max(Math.abs(X - D) + 0.01, Math.hypot(_ - Q.x, V - Q.y))), se = (U) => U * 180 / Math.PI, re = se(Math.acos((X * X + Z * Z - D * D) / (2 * X * Z))), ie = 180 - se(Math.acos((X * X + D * D - Z * Z) / (2 * X * D)));
4560
+ let E = { rightShoulder: ee.rightShoulder, rightElbow: 0 }, K = 1 / 0;
4561
4561
  for (const U of [1, -1])
4562
4562
  for (const te of [1, -1]) {
4563
- const q = { rightShoulder: ee.rightShoulder + U * re, rightElbow: te * ie }, le = { ...M, rightWrist: 0, ...q }, L = ne(le), J = Math.hypot(L.x - _, L.y - V) - We(le, { height: d, facing: p }).elbows.right.y * 1e-3;
4564
- J < W && (W = J, E = q);
4563
+ const q = { rightShoulder: ee.rightShoulder + U * re, rightElbow: te * ie }, le = { ...M, rightWrist: 0, ...q }, L = ne(le), J = Math.hypot(L.x - _, L.y - V) - Ke(le, { height: d, facing: p }).elbows.right.y * 1e-3;
4564
+ J < K && (K = J, E = q);
4565
4565
  }
4566
4566
  return E;
4567
4567
  }, H = (M, _, V) => Math.abs(_ - f) < 2 ? M : (k.push({ time: M, value: f - c }, { time: M + V, value: _ - c, easing: "ease-in-out" }), f = _, M + V);
@@ -4574,43 +4574,43 @@ function Lo(e, n, t = {}) {
4574
4574
  let D = _;
4575
4575
  X !== p ? D = C(_, X, M.mood) : g.turn < 1 ? (D = _ + ze, I(D, { turn: 1, ...Q }, M.mood)) : (M.mood || M.pose) && I(_ + ze, Q, M.mood);
4576
4576
  const se = Math.abs(x - f) / ao(s(M.do), d), re = M.for ?? Math.max(ze * 2, se * i(M.do)), ie = D + re;
4577
- v.push({ time: D, value: M.do }), O.push({ time: D, value: 0 }, { time: D + ze, value: 1, easing: "ease-out" }), O.push({ time: ie - ze, value: 1 }, { time: ie, value: 0, easing: "ease-in" }), P.push({ time: D, value: b }, { time: ie, value: b + se }), k.push({ time: D, value: f - c }, { time: ie, value: x - c }), b += se, f = x, I(ie, {}), V = ie;
4577
+ v.push({ time: D, value: M.do }), O.push({ time: D, value: 0 }, { time: D + ze, value: 1, easing: "ease-out" }), O.push({ time: ie - ze, value: 1 }, { time: ie, value: 0, easing: "ease-in" }), P.push({ time: D, value: y }, { time: ie, value: y + se }), k.push({ time: D, value: f - c }, { time: ie, value: x - c }), y += se, f = x, I(ie, {}), V = ie;
4578
4578
  } else if (M.do === "zip") {
4579
4579
  const x = M.to ?? f, X = x === f ? p : j(x);
4580
4580
  let D = _;
4581
4581
  X !== p ? D = C(_, X, M.mood) : g.turn < 1 && (D = _ + ze, I(D, { turn: 1 }, M.mood));
4582
4582
  const Z = Cs("windUp", { at: D, from: M.mood ? pt(g, M.mood) : g });
4583
4583
  A.push(...Z), g = Z[Z.length - 1].pose;
4584
- const se = D + yn("windUp"), re = se + Fh, ie = re + Math.max(Lh, Math.abs(x - f) / Dh);
4585
- v.push({ time: se, value: "run" }), O.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: re, value: b + Rs, easing: "ease-in" }), b += Rs + (ie - re) / Ns.run * 1.5, P.push({ time: ie, value: b }), k.push({ time: re, value: f - c }, { time: ie, value: x - c, easing: "ease-in" }), T.push({ kind: "dust", time: re, x: f, y: u, length: 900 }), f = x, I(ie, {}), V = ie;
4584
+ const se = D + bn("windUp"), re = se + Fh, ie = re + Math.max(Lh, Math.abs(x - f) / Dh);
4585
+ v.push({ time: se, value: "run" }), O.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: y }, { time: re, value: y + Rs, easing: "ease-in" }), y += Rs + (ie - re) / Ns.run * 1.5, P.push({ time: ie, value: y }), k.push({ time: re, value: f - c }, { time: ie, value: x - c, easing: "ease-in" }), T.push({ kind: "dust", time: re, x: f, y: u, length: 900 }), f = x, I(ie, {}), V = ie;
4586
4586
  } else if (M.do === "leap") {
4587
4587
  const x = M.to ?? f, X = M.onto ?? u;
4588
- let D = x === f ? _ : K(_, x, M.mood);
4588
+ let D = x === f ? _ : W(_, x, M.mood);
4589
4589
  g.turn < 1 && (D += ze, I(D, { turn: 1 }, M.mood));
4590
4590
  const Z = { leftShoulder: 35, rightShoulder: 35, leftElbow: -50, rightElbow: -50 };
4591
4591
  I(D + Bh, { stretch: 0.75, bend: 12, leftHip: 22, rightHip: 22, ...Z }, M.mood, !1);
4592
4592
  const se = D + qh;
4593
4593
  I(se - 40, { stretch: 0.72 }, void 0, !1), I(se, { stretch: 1.2, bend: -6, leftShoulder: 140, rightShoulder: 140, leftElbow: 20, rightElbow: 20, leftHip: 4, rightHip: 4 }, void 0, !1);
4594
- const re = Math.hypot(x - f, X - u), ie = M.for ?? Math.min(zs[1], Math.max(zs[0], 300 + re * Gh)), E = Math.min(u, X) - Yh * d, W = Math.sqrt(u - E), U = Math.sqrt(X - E), te = se + ie * W / (W + U), q = se + ie;
4594
+ const re = Math.hypot(x - f, X - u), ie = M.for ?? Math.min(zs[1], Math.max(zs[0], 300 + re * Gh)), E = Math.min(u, X) - Yh * d, K = Math.sqrt(u - E), U = Math.sqrt(X - E), te = se + ie * K / (K + U), q = se + ie;
4595
4595
  I(te, { stretch: 1, bend: 4, leftHip: -55, leftKnee: -80, rightHip: 55, rightKnee: 80, leftShoulder: 110, rightShoulder: 110 }, void 0, !1), I(q, { stretch: 0.72, bend: 12, leftShoulder: 75, rightShoulder: 75, leftElbow: 0, rightElbow: 0, leftHip: 18, rightHip: 18, leftKnee: 0, rightKnee: 0 }, void 0, !1), I(q + 180, { stretch: 1.05, bend: -3 }, void 0, !1), I(q + 340, { stretch: 1, bend: 0, leftHip: de.leftHip, rightHip: de.rightHip, leftShoulder: de.leftShoulder, rightShoulder: de.rightShoulder, leftElbow: de.leftElbow, rightElbow: de.rightElbow }, void 0, !1), k.push({ time: se, value: f - c }, { time: q, value: x - c }), m.push(
4596
4596
  { time: se, value: u - h },
4597
4597
  { time: te, value: E - h, easing: "ease-out-quad" },
4598
4598
  { time: q, value: X - h, easing: "ease-in-quad" }
4599
4599
  ), f = x, u = X, T.push({ kind: "dust", time: q, x: f, y: u, length: 500 }), V = q + 340, ee = q;
4600
4600
  } else if (M.do === "point" && M.target) {
4601
- const x = M.target, X = K(_, x.x, M.mood), D = { ...g, ...M.mood ? Ae[M.mood] : {}, turn: Math.max(g.turn, 0.6), rightElbow: 0, rightWrist: 0, ...Q }, Z = We(D, { height: d, facing: p }).head.center, se = Math.abs(x.x - (f + Z.x)), re = x.y - (u + Z.y), ie = X + Re;
4601
+ const x = M.target, X = W(_, x.x, M.mood), D = { ...g, ...M.mood ? Ae[M.mood] : {}, turn: Math.max(g.turn, 0.6), rightElbow: 0, rightWrist: 0, ...Q }, Z = Ke(D, { height: d, facing: p }).head.center, se = Math.abs(x.x - (f + Z.x)), re = x.y - (u + Z.y), ie = X + Re;
4602
4602
  I(ie, { ...D, rightShoulder: G(D, x.x, x.y), lookX: 1, lookY: cc(re / Math.max(1, Math.hypot(se, re))) * 0.8 }), V = ie + (M.for ?? Zn), ee = ie, F = V;
4603
4603
  } else if (M.do === "swipe") {
4604
- const x = M.target ?? { x: f + p * d * 0.5, y: u - d * 0.6 }, X = j(x.x), D = K(_, x.x, M.mood), Z = X === 1 ? x.left ?? x.x : x.right ?? x.x, se = X === 1 ? x.right ?? x.x : x.left ?? x.x, re = { ...g, turn: 1, lean: -10, bend: -8, rightElbow: 40, lookX: 1, ...Q };
4604
+ const x = M.target ?? { x: f + p * d * 0.5, y: u - d * 0.6 }, X = j(x.x), D = W(_, x.x, M.mood), Z = X === 1 ? x.left ?? x.x : x.right ?? x.x, se = X === 1 ? x.right ?? x.x : x.left ?? x.x, re = { ...g, turn: 1, lean: -10, bend: -8, rightElbow: 40, lookX: 1, ...Q };
4605
4605
  I(D + en, { ...re, rightShoulder: G(re, f - p * d * 0.3, u - d * 1.1) }, M.mood, !1);
4606
4606
  const ie = { ...g, lean: 6, bend: 4, rightElbow: 0, rightWrist: 0 }, E = { ...g, lean: 14, bend: 12, rightElbow: 0, rightWrist: 0 };
4607
4607
  H(D, Y(ie, Z, x.y, "arm"), en + Gn), I(D + en + Gn, { lean: -12 }, void 0, !1);
4608
- const W = D + en + Gn + 80;
4609
- I(W, { ...ie, rightShoulder: G(ie, Z, x.y) }, void 0, !1);
4610
- const U = W + (M.for ?? Math.max(Uh, Math.abs(se - Z) / Xh));
4611
- k.push({ time: W, value: f - c }), f = Y(E, se, x.y, "arm"), k.push({ time: U, value: f - c }), I(U, { ...E, rightShoulder: G(E, se, x.y) }, void 0, !1), I(U + Yn, { lean: 16, bend: 14, rightShoulder: G(g, se + X * d * 0.4, x.y + d * 0.25) }, void 0, !1), I(U + Yn + Ks, { lean: 0, bend: 0, rightShoulder: de.rightShoulder, rightElbow: de.rightElbow }), V = U + Yn + Ks, ee = W, F = U;
4608
+ const K = D + en + Gn + 80;
4609
+ I(K, { ...ie, rightShoulder: G(ie, Z, x.y) }, void 0, !1);
4610
+ const U = K + (M.for ?? Math.max(Uh, Math.abs(se - Z) / Xh));
4611
+ k.push({ time: K, value: f - c }), f = Y(E, se, x.y, "arm"), k.push({ time: U, value: f - c }), I(U, { ...E, rightShoulder: G(E, se, x.y) }, void 0, !1), I(U + Yn, { lean: 16, bend: 14, rightShoulder: G(g, se + X * d * 0.4, x.y + d * 0.25) }, void 0, !1), I(U + Yn + Ws, { lean: 0, bend: 0, rightShoulder: de.rightShoulder, rightElbow: de.rightElbow }), V = U + Yn + Ws, ee = K, F = U;
4612
4612
  } else if (M.do === "grab" && M.target) {
4613
- const x = M.target, X = K(_, x.x, M.mood), D = x.y > u - d * 0.5, Z = {
4613
+ const x = M.target, X = W(_, x.x, M.mood), D = x.y > u - d * 0.5, Z = {
4614
4614
  ...g,
4615
4615
  turn: 1,
4616
4616
  rightElbow: 0,
@@ -4621,14 +4621,14 @@ function Lo(e, n, t = {}) {
4621
4621
  lookY: D ? 0.8 : 0,
4622
4622
  ...Q
4623
4623
  }, re = H(X, Y(Z, x.x, x.y, "arm"), jt) + Vh;
4624
- I(re, { ...Z, rightShoulder: G(Z, x.x, x.y) }, M.mood, !1), I(re + 120, {}, void 0, !1), I(re + Ws, { bend: 0, lean: -3, stretch: 1, rightShoulder: 165, rightElbow: 20, lookY: -0.6 }), V = re + Ws + 150, ee = re;
4624
+ I(re, { ...Z, rightShoulder: G(Z, x.x, x.y) }, M.mood, !1), I(re + 120, {}, void 0, !1), I(re + Ks, { bend: 0, lean: -3, stretch: 1, rightShoulder: 165, rightElbow: 20, lookY: -0.6 }), V = re + Ks + 150, ee = re;
4625
4625
  } else if (M.do === "throw") {
4626
- const x = M.target?.x ?? M.to ?? f + p * d, X = K(_, x, M.mood), D = { ...g, turn: 1, lean: -12, bend: -10, rightElbow: 60, stretch: 0.95, lookX: 1, lookY: -0.3, ...Q };
4626
+ const x = M.target?.x ?? M.to ?? f + p * d, X = W(_, x, M.mood), D = { ...g, turn: 1, lean: -12, bend: -10, rightElbow: 60, stretch: 0.95, lookX: 1, lookY: -0.3, ...Q };
4627
4627
  I(X + Un, { ...D, rightShoulder: G(D, f - p * d * 0.4, u - d * 1.05) }, M.mood, !1), I(X + Un + Fs, { lean: -14 }, void 0, !1);
4628
4628
  const Z = X + Un + Fs + Jh, se = { ...g, lean: 14, bend: 12, rightElbow: 0, stretch: 1.04 };
4629
4629
  A.push({ time: Z, pose: g = { ...se, rightShoulder: G(se, f + p * d, u - d * 1.1) }, easing: "ease-in", act: !1 }), I(Z + Xn, { lean: 18, bend: 14, rightShoulder: 55, stretch: 1 }, void 0, !1), I(Z + Xn + Ds, { lean: 0, bend: 0, rightShoulder: de.rightShoulder, rightElbow: de.rightElbow, lookY: 0 }), V = Z + Xn + Ds, ee = Z, F = Z;
4630
4630
  } else if (M.do === "kick" && M.target) {
4631
- const x = M.target, X = K(_, x.x, M.mood), D = { ...g, turn: 1, lean: -12, bend: -6, rightKnee: 0, leftShoulder: 100, rightShoulder: 70 }, Z = H(X, Y(D, x.x, x.y, "leg"), Zh), se = { leftShoulder: 70, rightShoulder: 50, leftElbow: -20, rightElbow: 20 };
4631
+ const x = M.target, X = W(_, x.x, M.mood), D = { ...g, turn: 1, lean: -12, bend: -6, rightKnee: 0, leftShoulder: 100, rightShoulder: 70 }, Z = H(X, Y(D, x.x, x.y, "leg"), Zh), se = { leftShoulder: 70, rightShoulder: 50, leftElbow: -20, rightElbow: 20 };
4632
4632
  I(Z + Ls, { turn: 1, lean: 8, bend: 6, rightHip: -40, rightKnee: 80, lookX: 1, lookY: 0.7, ...se, ...Q }, M.mood, !1);
4633
4633
  const re = Z + Ls + Qh, ie = G(D, x.x, x.y, "leg");
4634
4634
  A.push({ time: re, pose: g = { ...g, ...D, rightHip: ie }, easing: "ease-in", act: !1 }), I(re + Vn, { lean: -15, rightHip: ie + 20 }, void 0, !1), I(re + Vn + Bs, {
@@ -4643,13 +4643,13 @@ function Lo(e, n, t = {}) {
4643
4643
  lookY: 0
4644
4644
  }), V = re + Vn + Bs, ee = re;
4645
4645
  } else if (M.do === "put" && M.target) {
4646
- const x = M.target, X = K(_, x.x, M.mood), D = x.y > u - d * 0.5, Z = { ...g, turn: 1, rightElbow: 0, rightWrist: 0, bend: D ? 35 : 0, lean: D ? 12 : 0, stretch: D ? 0.75 : 1, lookX: 1, lookY: D ? 0.8 : 0, ...Q }, re = H(X, Y(Z, x.x, x.y, "arm"), jt) + ec;
4646
+ const x = M.target, X = W(_, x.x, M.mood), D = x.y > u - d * 0.5, Z = { ...g, turn: 1, rightElbow: 0, rightWrist: 0, bend: D ? 35 : 0, lean: D ? 12 : 0, stretch: D ? 0.75 : 1, lookX: 1, lookY: D ? 0.8 : 0, ...Q }, re = H(X, Y(Z, x.x, x.y, "arm"), jt) + ec;
4647
4647
  I(re, { ...Z, rightShoulder: G(Z, x.x, x.y) }, M.mood, !1), I(re + Jn, {}, void 0, !1), I(re + Jn + qs, { bend: 0, lean: 0, stretch: 1, rightShoulder: de.rightShoulder, rightElbow: de.rightElbow, lookY: 0 }), V = re + Jn + qs, ee = re;
4648
4648
  } else if (M.do === "write" && M.target) {
4649
- const x = M.target, X = x.left ?? x.x, D = x.right ?? x.x, Z = K(_, (X + D) / 2, M.mood), se = { ...g, turn: 1, rightElbow: 0, rightWrist: 0, ...Ae.thinking, lookX: 1, lookY: 0, ...Q }, re = (L) => Y(se, L, x.y, "arm") + p * d * 0.08, ie = (L) => {
4649
+ const x = M.target, X = x.left ?? x.x, D = x.right ?? x.x, Z = W(_, (X + D) / 2, M.mood), se = { ...g, turn: 1, rightElbow: 0, rightWrist: 0, ...Ae.thinking, lookX: 1, lookY: 0, ...Q }, re = (L) => Y(se, L, x.y, "arm") + p * d * 0.08, ie = (L) => {
4650
4650
  const z = ne({ ...se, ...B(se, L, x.y), rightWrist: 0 });
4651
4651
  return Math.hypot(z.x - L, z.y - x.y) < 2;
4652
- }, E = p === 1 ? X : D, W = H(Z, re((X + D) / 2), jt), U = !ie(X) || !ie(D), te = U ? H(W, re(X), jt) + Gs : W + Gs;
4652
+ }, E = p === 1 ? X : D, K = H(Z, re((X + D) / 2), jt), U = !ie(X) || !ie(D), te = U ? H(K, re(X), jt) + Gs : K + Gs;
4653
4653
  I(te, { ...se, ...B(se, U ? X : E, x.y) }, M.mood, !1);
4654
4654
  const q = M.for ?? Math.max(nc, Math.abs(D - X) * tc);
4655
4655
  U && k.push({ time: te, value: f - c });
@@ -4662,16 +4662,16 @@ function Lo(e, n, t = {}) {
4662
4662
  const le = te + q;
4663
4663
  I(le, B(se, D, x.y), void 0, !1), I(le + Us, { rightShoulder: de.rightShoulder, rightElbow: de.rightElbow, ...Ae.happy }), V = le + Us, ee = te, F = le;
4664
4664
  } else if (M.do === "push" && M.target) {
4665
- const x = M.target, X = M.to ?? x.x, D = K(_, f + (X >= x.x ? 1 : -1), M.mood), Z = p === 1 ? x.left ?? x.x : x.right ?? x.x, se = { ...g, turn: 1, lean: 16, bend: 8, rightWrist: 0, leftWrist: 0, lookX: 1, ...Q }, re = Y(se, Z, x.y, "arm"), ie = H(D, re + p * d * 0.06, jt), E = B(se, Z, x.y), W = { ...se, ...E, leftShoulder: -E.rightShoulder, leftElbow: -E.rightElbow }, U = ie + oc;
4666
- I(U, W, M.mood, !1);
4665
+ const x = M.target, X = M.to ?? x.x, D = W(_, f + (X >= x.x ? 1 : -1), M.mood), Z = p === 1 ? x.left ?? x.x : x.right ?? x.x, se = { ...g, turn: 1, lean: 16, bend: 8, rightWrist: 0, leftWrist: 0, lookX: 1, ...Q }, re = Y(se, Z, x.y, "arm"), ie = H(D, re + p * d * 0.06, jt), E = B(se, Z, x.y), K = { ...se, ...E, leftShoulder: -E.rightShoulder, leftElbow: -E.rightElbow }, U = ie + oc;
4666
+ I(U, K, M.mood, !1);
4667
4667
  const te = Math.abs(X - x.x), q = U + (M.for ?? Math.max(600, te / sc)), le = te / ao("shove", d);
4668
- v.push({ time: U, value: "shove" }), O.push({ time: U, value: 0 }, { time: U + ze, value: 1, easing: "ease-out" }, { time: q - ze, value: 1 }, { time: q, value: 0, easing: "ease-in" }), P.push({ time: U, value: b }, { time: q, value: b + le }), b += le, k.push({ time: U, value: f - c }, { time: q, value: f + (X - x.x) - c }), f += X - x.x, I(q, {}, void 0, !1), I(q + Xs, { lean: 0, bend: 0, rightShoulder: de.rightShoulder, leftShoulder: de.leftShoulder, rightElbow: de.rightElbow, leftElbow: de.leftElbow }), V = q + Xs, ee = U, F = q;
4668
+ v.push({ time: U, value: "shove" }), O.push({ time: U, value: 0 }, { time: U + ze, value: 1, easing: "ease-out" }, { time: q - ze, value: 1 }, { time: q, value: 0, easing: "ease-in" }), P.push({ time: U, value: y }, { time: q, value: y + le }), y += le, k.push({ time: U, value: f - c }, { time: q, value: f + (X - x.x) - c }), f += X - x.x, I(q, {}, void 0, !1), I(q + Xs, { lean: 0, bend: 0, rightShoulder: de.rightShoulder, leftShoulder: de.leftShoulder, rightElbow: de.rightElbow, leftElbow: de.leftElbow }), V = q + Xs, ee = U, F = q;
4669
4669
  } else if (ae) {
4670
4670
  const x = M.mood ? pt(g, M.mood) : g, X = ae.steps(x, M), D = nr(X, { at: _, from: x });
4671
- A.push(...D), g = D[D.length - 1].pose, V = _ + Math.max(Wh(X), M.for ?? 0);
4671
+ A.push(...D), g = D[D.length - 1].pose, V = _ + Math.max(Kh(X), M.for ?? 0);
4672
4672
  } else if (Vs(M.do)) {
4673
4673
  const x = Cs(M.do, { at: _, from: M.mood ? pt(g, M.mood) : g });
4674
- A.push(...x), g = x[x.length - 1].pose, V = _ + yn(M.do), M.do === "take" && T.push({ kind: "dust", time: _ + 900, x: f, y: u, length: 500 }), M.do === "land" && T.push({ kind: "dust", time: _ + 120, x: f, y: u, length: 500 });
4674
+ A.push(...x), g = x[x.length - 1].pose, V = _ + bn(M.do), M.do === "take" && T.push({ kind: "dust", time: _ + 900, x: f, y: u, length: 500 }), M.do === "land" && T.push({ kind: "dust", time: _ + 120, x: f, y: u, length: 500 });
4675
4675
  } else if (M.do === "look" || M.do === "face") {
4676
4676
  const x = M.toward ?? "viewer", X = M.for ?? ac;
4677
4677
  if (x === "viewer") I(_ + Re, { turn: 0, lookX: 0, lookY: 0, ...Q }, M.mood);
@@ -4701,7 +4701,7 @@ function Lo(e, n, t = {}) {
4701
4701
  { id: `${e}-walk`, target: e, property: "walk", keyframes: P },
4702
4702
  { id: `${e}-walking`, target: e, property: "walking", keyframes: O },
4703
4703
  { id: `${e}-gait`, target: e, property: "gait", keyframes: v },
4704
- { id: `${e}-facing`, target: e, property: "facing", keyframes: y }
4704
+ { id: `${e}-facing`, target: e, property: "facing", keyframes: b }
4705
4705
  ].filter(
4706
4706
  (M) => M.keyframes.length > 1 || M.property === "x" || // Starting left is kept even if it never turns: a figure target faces right unless told.
4707
4707
  M.property === "facing" && M.keyframes[0].value === -1
@@ -4742,22 +4742,22 @@ function rr(e, n, t) {
4742
4742
  }
4743
4743
  const zt = ["start", "contact", "release", "end"], gc = ["surface", "edit", "anchor", "at", "until"], pc = ["carry"], an = (e) => !!e && typeof e == "object" && !Array.isArray(e) && "surface" in e && "anchor" in e, mc = (e) => e.then === void 0 ? [] : Array.isArray(e.then) ? e.then : [e.then];
4744
4744
  function Qf(e, n, t, o = {}) {
4745
- const r = bc(t, n, o).filter((f) => f.level === "error");
4745
+ const r = yc(t, n, o).filter((f) => f.level === "error");
4746
4746
  if (r.length > 0)
4747
4747
  throw new Error(`surfaceScript: ${r.length} problem(s) in the beats:
4748
4748
  ${r.map((f) => ` ${f.beat >= 0 ? `beat ${f.beat}: ` : ""}${f.message}`).join(`
4749
4749
  `)}`);
4750
- const a = t.map((f) => ir(f, n)), s = Lo(e, a, o), i = yc(a, s.beats, o), l = o.ground ?? 0, c = (f) => o.ride === !1 ? f : Object.values(n).reduce((u, p) => p.ride(u, e, { ground: l }), f);
4750
+ const a = t.map((f) => ir(f, n)), s = Lo(e, a, o), i = bc(a, s.beats, o), l = o.ground ?? 0, c = (f) => o.ride === !1 ? f : Object.values(n).reduce((u, p) => p.ride(u, e, { ground: l }), f);
4751
4751
  t.forEach((f, u) => {
4752
4752
  for (const p of mc(f)) {
4753
- const g = (m) => new Error(`surfaceScript: beat ${u} (${f.do}), ${p.edit} on ${p.surface}: ${m}`), b = (m, P) => {
4754
- const O = typeof m == "object" ? m.beat : u, v = (typeof m == "object" ? m.at : m) ?? P ?? "start", y = i[O][v];
4755
- if (y === void 0) {
4753
+ const g = (m) => new Error(`surfaceScript: beat ${u} (${f.do}), ${p.edit} on ${p.surface}: ${m}`), y = (m, P) => {
4754
+ const O = typeof m == "object" ? m.beat : u, v = (typeof m == "object" ? m.at : m) ?? P ?? "start", b = i[O][v];
4755
+ if (b === void 0) {
4756
4756
  const S = zt.filter((w) => i[O][w] !== void 0).join(", ");
4757
4757
  throw g(`beat ${O} (${t[O].do}) has no ${v} (it has ${S})`);
4758
4758
  }
4759
- return y;
4760
- }, $ = n[p.surface], A = b(p.at ?? (i[u].contact !== void 0 ? "contact" : "start")), k = p.until === void 0 ? void 0 : b(p.until, "end");
4759
+ return b;
4760
+ }, $ = n[p.surface], A = y(p.at ?? (i[u].contact !== void 0 ? "contact" : "start")), k = p.until === void 0 ? void 0 : y(p.until, "end");
4761
4761
  if (k !== void 0 && k < A) throw g(`it ends (${k} ms) before it starts (${A} ms)`);
4762
4762
  try {
4763
4763
  if (p.edit === "carry") {
@@ -4782,7 +4782,7 @@ ${r.map((f) => ` ${f.beat >= 0 ? `beat ${f.beat}: ` : ""}${f.message}`).join(`
4782
4782
  const h = c(s.tracks), d = Object.entries(n).flatMap(([f, u]) => u.tracks(f));
4783
4783
  return { ...s, tracks: [...h, ...d], figureTracks: h };
4784
4784
  }
4785
- function bc(e, n, t = {}) {
4785
+ function yc(e, n, t = {}) {
4786
4786
  if (!Array.isArray(e)) return wn(e, t);
4787
4787
  const o = [], r = Object.keys(n), a = (c, h, d) => {
4788
4788
  const f = typeof h == "string" ? n[h] : void 0;
@@ -4821,13 +4821,13 @@ function bc(e, n, t = {}) {
4821
4821
  }
4822
4822
  const p = u, g = a(h, p.surface, "`then`");
4823
4823
  if (!g) return;
4824
- const b = `\`then\` (${String(p.edit)} on ${String(p.surface)})`, $ = [...Object.keys(g.about.edits), ...pc];
4824
+ const y = `\`then\` (${String(p.edit)} on ${String(p.surface)})`, $ = [...Object.keys(g.about.edits), ...pc];
4825
4825
  if (typeof p.edit != "string" || !$.includes(p.edit)) {
4826
4826
  o.push({ level: "error", beat: h, message: `\`then\`: ${ce("edit", p.edit, $)}` });
4827
4827
  return;
4828
4828
  }
4829
- for (const A of Array.isArray(p.anchor) ? p.anchor : [p.anchor]) s(h, g, A, b);
4830
- p.edit === "carry" && typeof p.anchor != "string" && o.push({ level: "error", beat: h, message: `${b}: \`carry\` takes one anchor, the piece it carries.` }), p.edit === "carry" && p.until === void 0 && o.push({ level: "error", beat: h, message: `${b}: \`carry\` needs \`until\` (when it lets go, such as { beat: ${h + 1}, at: 'release' }).` }), p.at !== void 0 && i(h, p.at, `${b} \`at\``), p.until !== void 0 && i(h, p.until, `${b} \`until\``), p.until !== void 0 && p.duration !== void 0 && o.push({ level: "error", beat: h, message: `${b}: give \`until\` or \`duration\`, not both.` });
4829
+ for (const A of Array.isArray(p.anchor) ? p.anchor : [p.anchor]) s(h, g, A, y);
4830
+ p.edit === "carry" && typeof p.anchor != "string" && o.push({ level: "error", beat: h, message: `${y}: \`carry\` takes one anchor, the piece it carries.` }), p.edit === "carry" && p.until === void 0 && o.push({ level: "error", beat: h, message: `${y}: \`carry\` needs \`until\` (when it lets go, such as { beat: ${h + 1}, at: 'release' }).` }), p.at !== void 0 && i(h, p.at, `${y} \`at\``), p.until !== void 0 && i(h, p.until, `${y} \`until\``), p.until !== void 0 && p.duration !== void 0 && o.push({ level: "error", beat: h, message: `${y}: give \`until\` or \`duration\`, not both.` });
4831
4831
  });
4832
4832
  });
4833
4833
  const l = e.map((c) => c && typeof c == "object" && !Array.isArray(c) ? ir(c, n, !0) : c);
@@ -4844,7 +4844,7 @@ function ir(e, n, t = !1) {
4844
4844
  }, s = { ...r };
4845
4845
  return an(e.target) && (s.target = a(e.target)), an(e.to) && (s.to = a(e.to).x), an(e.onto) && (s.onto = a(e.onto).top), s;
4846
4846
  }
4847
- function yc(e, n, t) {
4847
+ function bc(e, n, t) {
4848
4848
  let o = 0;
4849
4849
  return e.map((r) => {
4850
4850
  const a = Do([r], t.actions).length, s = n.slice(o, o + a);
@@ -4865,7 +4865,7 @@ function eu(e) {
4865
4865
  if (!o.includes(r)) throw new Error(`persona "${e.name}": ${ce("gait", r, o)}`);
4866
4866
  if (e.mood && !(e.mood in Ae)) throw new Error(`persona "${e.name}": ${ce("mood", e.mood, Object.keys(Ae))}`);
4867
4867
  const a = e.acting ?? "snappy";
4868
- if (typeof a == "string" && !(a in yt)) throw new Error(`persona "${e.name}": ${ce("acting style", a, Object.keys(yt))}`);
4868
+ if (typeof a == "string" && !(a in bt)) throw new Error(`persona "${e.name}": ${ce("acting style", a, Object.keys(bt))}`);
4869
4869
  if (typeof e.stance == "string" && !(e.stance in He)) throw new Error(`persona "${e.name}": ${ce("stance", e.stance, Object.keys(He))}`);
4870
4870
  const s = e.height ?? 120, i = typeof e.stance == "string" ? He[e.stance] : Dr(e.stance ?? {}), l = e.mood ? pt(i, e.mood) : i, c = { ...e.look, height: s }, h = e.summary ?? `${e.name}, a stick figure`;
4871
4871
  return {
@@ -4906,7 +4906,7 @@ function eu(e) {
4906
4906
  }
4907
4907
  const wc = /* @__PURE__ */ new Set(["x", "y", "walking", "gait"]), Js = 0.215 + 0.205;
4908
4908
  function kc(e, n, t = 1) {
4909
- const { points: o } = Ne(e, be), r = o["hip.left"], a = o["knee.left"], s = o["ankle.left"], i = r && a && s ? Math.hypot(a.x - r.x, a.y - r.y) + Math.hypot(s.x - a.x, s.y - a.y) : Js * e.height;
4909
+ const { points: o } = Ne(e, ye), r = o["hip.left"], a = o["knee.left"], s = o["ankle.left"], i = r && a && s ? Math.hypot(a.x - r.x, a.y - r.y) + Math.hypot(s.x - a.x, s.y - a.y) : Js * e.height;
4910
4910
  return wa(n, i / Js, t);
4911
4911
  }
4912
4912
  function tu(e, n, t, o = {}) {
@@ -4928,7 +4928,7 @@ function tu(e, n, t, o = {}) {
4928
4928
  return { tracks: g ? [...u, ...p, Ic(e, g, r.tracks, n, o)] : [...u, ...p], duration: r.duration, lines: r.lines, keys: l, beats: r.beats, effects: r.effects };
4929
4929
  }
4930
4930
  function vc(e) {
4931
- const n = $a({ "arm.left.spread": 90, "arm.left.elbow": 0, "arm.left.bend": 0, "leg.left.knee": 0 }), t = Ne(e, n).points, o = Math.hypot(t["hand.left"].x - t["shoulder.left"].x, t["hand.left"].y - t["shoulder.left"].y), r = Math.hypot(t["toe.left"].x - t["hip.left"].x, t["toe.left"].y - t["hip.left"].y), a = We({ ...de, rightShoulder: 90, rightElbow: 0, rightWrist: 0 }, { height: e.height, facing: 1 }), s = We({ ...de, rightHip: 90, rightKnee: 0 }, { height: e.height, facing: 1 }), i = { x: (a.hands.right.x + a.fingertips.right.x) / 2, y: (a.hands.right.y + a.fingertips.right.y) / 2 }, l = Math.hypot(i.x - a.shoulders.right.x, i.y - a.shoulders.right.y), c = Math.hypot(s.feet.right.x - s.hip.x, s.feet.right.y - s.hip.y);
4931
+ const n = $a({ "arm.left.spread": 90, "arm.left.elbow": 0, "arm.left.bend": 0, "leg.left.knee": 0 }), t = Ne(e, n).points, o = Math.hypot(t["hand.left"].x - t["shoulder.left"].x, t["hand.left"].y - t["shoulder.left"].y), r = Math.hypot(t["toe.left"].x - t["hip.left"].x, t["toe.left"].y - t["hip.left"].y), a = Ke({ ...de, rightShoulder: 90, rightElbow: 0, rightWrist: 0 }, { height: e.height, facing: 1 }), s = Ke({ ...de, rightHip: 90, rightKnee: 0 }, { height: e.height, facing: 1 }), i = { x: (a.hands.right.x + a.fingertips.right.x) / 2, y: (a.hands.right.y + a.fingertips.right.y) / 2 }, l = Math.hypot(i.x - a.shoulders.right.x, i.y - a.shoulders.right.y), c = Math.hypot(s.feet.right.x - s.hip.x, s.feet.right.y - s.hip.y);
4932
4932
  return { arm: l > 0 ? o / l : 1, leg: c > 0 ? r / c : 1 };
4933
4933
  }
4934
4934
  const Sc = { point: "arm", grab: "arm", put: "arm", write: "arm", swipe: "arm", push: "arm", kick: "leg" }, Mc = /* @__PURE__ */ new Set(["point", "grab", "put", "kick"]);
@@ -4943,20 +4943,20 @@ function $c(e, n, t, o, r, a, s) {
4943
4943
  const f = Sc[h.do], u = i[d];
4944
4944
  if (!f || u.contact === void 0 || h.do !== "swipe" && !h.target) return;
4945
4945
  const p = u.contact, g = u.release ?? u.contact;
4946
- e.forEach((b, $) => {
4947
- if (b.time < p - 1 || b.time > g + 1) return;
4948
- const A = a(b.time), k = We(n[$], { height: r.height, facing: A < 0 ? -1 : 1 }), m = c(b.time), P = Mc.has(h.do) && h.target ? { x: h.target.x - m.x, y: h.target.y - m.y } : void 0, O = { x: (k.hands.right.x + k.fingertips.right.x) / 2, y: (k.hands.right.y + k.fingertips.right.y) / 2 }, v = P ?? (f === "arm" ? O : k.toes.right), y = A < 0 ? "right" : "left", S = `${f}.${y}`;
4949
- let w = b.pose;
4946
+ e.forEach((y, $) => {
4947
+ if (y.time < p - 1 || y.time > g + 1) return;
4948
+ const A = a(y.time), k = Ke(n[$], { height: r.height, facing: A < 0 ? -1 : 1 }), m = c(y.time), P = Mc.has(h.do) && h.target ? { x: h.target.x - m.x, y: h.target.y - m.y } : void 0, O = { x: (k.hands.right.x + k.fingertips.right.x) / 2, y: (k.hands.right.y + k.fingertips.right.y) / 2 }, v = P ?? (f === "arm" ? O : k.toes.right), b = A < 0 ? "right" : "left", S = `${f}.${b}`;
4949
+ let w = y.pose;
4950
4950
  if (h.do === "point")
4951
4951
  w = Ue(r, w, S, v);
4952
4952
  else if (f === "arm")
4953
- w = Ue(r, Oc(r, w, y, v), S, v);
4953
+ w = Ue(r, Oc(r, w, b, v), S, v);
4954
4954
  else
4955
4955
  for (let T = 0; T < 3; T++) {
4956
- const I = Ne(r, w).points, C = I[`ankle.${y}`], j = I[`toe.${y}`];
4956
+ const I = Ne(r, w).points, C = I[`ankle.${b}`], j = I[`toe.${b}`];
4957
4957
  w = Ue(r, w, S, { x: v.x - (j.x - C.x), y: v.y - (j.y - C.y) });
4958
4958
  }
4959
- e[$] = { ...b, pose: w };
4959
+ e[$] = { ...y, pose: w };
4960
4960
  });
4961
4961
  });
4962
4962
  }
@@ -4985,8 +4985,8 @@ function Ic(e, n, t, o, r) {
4985
4985
  let h = l[0]?.value ?? 0;
4986
4986
  return l.forEach((d, f) => {
4987
4987
  if (f > 0) {
4988
- const u = l[f - 1], p = i((u.time + d.time) / 2), g = ao(p, o.height), b = kc(o, p);
4989
- h += (d.value - u.value) * (b > 0 ? g / b : 1);
4988
+ const u = l[f - 1], p = i((u.time + d.time) / 2), g = ao(p, o.height), y = kc(o, p);
4989
+ h += (d.value - u.value) * (y > 0 ? g / y : 1);
4990
4990
  } else
4991
4991
  h = d.value;
4992
4992
  c.push({ ...d, value: h });
@@ -5039,7 +5039,7 @@ function nu(e, n, t) {
5039
5039
  const l = t.speed ?? 900, c = t.length ?? 34, h = t.slant ?? -8, d = Tt(t.seed ?? 1), f = s + c * 2;
5040
5040
  e.save(), e.beginPath(), e.rect(o, r, a, s), e.clip(), e.strokeStyle = xe(t.color ?? "rgb(190,210,235)", t.opacity ?? 0.35), e.lineWidth = t.lineWidth ?? 2, e.lineCap = "round", e.beginPath();
5041
5041
  for (let u = 0; u < i; u++) {
5042
- const p = o + d.next() * a, g = l * (1 + d.next() * 0.6), b = d.next() * f, $ = n / 1e3 * g + b, A = r - c + ($ % f + f) % f;
5042
+ const p = o + d.next() * a, g = l * (1 + d.next() * 0.6), y = d.next() * f, $ = n / 1e3 * g + y, A = r - c + ($ % f + f) % f;
5043
5043
  e.moveTo(p, A), e.lineTo(p + h, A + c);
5044
5044
  }
5045
5045
  e.stroke(), e.restore();
@@ -5146,9 +5146,9 @@ function uu(e, n, t) {
5146
5146
  e.translate(t.anchor.x + (l === "right" ? h : -h), t.anchor.y + a * 0.6), e.rotate((t.tilt ?? -3.4) * Math.PI / 180), e.globalAlpha *= o, e.font = Me(a, 800, i);
5147
5147
  const d = e.measureText(t.name).width;
5148
5148
  e.font = Me(s, 700, i);
5149
- const f = t.role ? e.measureText(t.role).width : 0, u = a * 0.47, p = Math.max(d, f) + u * 2 + 10, g = -a * 1.1, b = t.role ? a + s + a * 0.95 : a * 1.6, $ = l === "right" ? 0 : -p;
5150
- Pe(e, $, g, p, b, 4), e.fillStyle = t.color ?? At, e.fill(), e.strokeStyle = t.ink ?? rt, e.lineWidth = 5, e.stroke(), e.textAlign = "left", e.textBaseline = "alphabetic", e.fillStyle = "#ffffff", e.font = Me(a, 800, i);
5151
- const A = t.role ? g + a * 1.1 + a * 0.22 : g + b / 2 + a * 0.35;
5149
+ const f = t.role ? e.measureText(t.role).width : 0, u = a * 0.47, p = Math.max(d, f) + u * 2 + 10, g = -a * 1.1, y = t.role ? a + s + a * 0.95 : a * 1.6, $ = l === "right" ? 0 : -p;
5150
+ Pe(e, $, g, p, y, 4), e.fillStyle = t.color ?? At, e.fill(), e.strokeStyle = t.ink ?? rt, e.lineWidth = 5, e.stroke(), e.textAlign = "left", e.textBaseline = "alphabetic", e.fillStyle = "#ffffff", e.font = Me(a, 800, i);
5151
+ const A = t.role ? g + a * 1.1 + a * 0.22 : g + y / 2 + a * 0.35;
5152
5152
  return e.fillText(t.name, $ + u, A), t.role && (e.font = Me(s, 700, i), e.fillStyle = qo, e.fillText(t.role, $ + u, A + s * 1.45)), e.restore(), o;
5153
5153
  }
5154
5154
  function xc(e, n, t, o) {
@@ -5176,9 +5176,9 @@ function gu(e, n, t) {
5176
5176
  }
5177
5177
  e.font = Me(l, 700, c), e.fillStyle = h, e.textBaseline = "alphabetic";
5178
5178
  const p = Nc(f, r);
5179
- return f.forEach((g, b) => {
5179
+ return f.forEach((g, y) => {
5180
5180
  const $ = e.measureText(g).width;
5181
- e.textAlign = "left", e.fillText(p[b], a + s / 2 - $ / 2, u + l * 1.38 + b * d);
5181
+ e.textAlign = "left", e.fillText(p[y], a + s / 2 - $ / 2, u + l * 1.38 + y * d);
5182
5182
  }), e.restore(), o;
5183
5183
  }
5184
5184
  function pu(e, n, t) {
@@ -5186,9 +5186,9 @@ function pu(e, n, t) {
5186
5186
  if (!(n >= o && n <= r + 220) || a <= 0.01) return 0;
5187
5187
  const s = t.size ?? 40, i = t.font ?? st, l = t.ink ?? rt, c = t.fill ?? "#ffffff", h = t.bounds ?? { x: 40, y: 40, width: 1840 }, d = t.tail;
5188
5188
  e.save(), e.font = Me(s, 700, i);
5189
- const f = Bo(e, t.text, t.maxWidth ?? 640), u = s * 1.3, p = Math.max(...f.map((P) => e.measureText(P).width)) + s * 1.75, g = f.length * u + s * 1.25, b = t.speaker ? s * 0.5 : 0, $ = Math.min(h.x + h.width - p / 2, Math.max(h.x + p / 2, d.x));
5189
+ const f = Bo(e, t.text, t.maxWidth ?? 640), u = s * 1.3, p = Math.max(...f.map((P) => e.measureText(P).width)) + s * 1.75, g = f.length * u + s * 1.25, y = t.speaker ? s * 0.5 : 0, $ = Math.min(h.x + h.width - p / 2, Math.max(h.x + p / 2, d.x));
5190
5190
  let A = Math.min(d.y - (t.gap ?? 70) - g / 2, t.maxCenterY ?? 1 / 0);
5191
- A = Math.max(h.y + b + g / 2, A);
5191
+ A = Math.max(h.y + y + g / 2, A);
5192
5192
  const k = { x: d.x + ($ - d.x) * 0.2, y: Math.max(A + g / 2 + 16, d.y - 14) };
5193
5193
  e.translate(k.x, k.y), e.scale(a, a), e.translate(-k.x, -k.y), e.fillStyle = c, e.strokeStyle = l, e.lineWidth = 5, e.lineJoin = "round";
5194
5194
  const m = Math.min(Math.max(k.x, $ - p / 2 + 50), $ + p / 2 - 50);
@@ -5200,7 +5200,7 @@ function pu(e, n, t) {
5200
5200
  }
5201
5201
  return e.font = Me(s, 700, i), e.fillStyle = l, e.textAlign = "center", e.textBaseline = "alphabetic", f.forEach((P, O) => e.fillText(P, $, A - g / 2 + s * 1.65 + O * u)), e.restore(), a;
5202
5202
  }
5203
- const bo = ["photo", "note"], yo = {
5203
+ const yo = ["photo", "note"], bo = {
5204
5204
  cross: "two diagonals across the card, one after the other (ruled out)",
5205
5205
  strike: "one diagonal, bottom-left to top-right (half ruled out)",
5206
5206
  scribble: "a zigzag back and forth across the card (scribbled out)",
@@ -5212,7 +5212,7 @@ function mu(e) {
5212
5212
  if (o.has(c.id)) throw new Error(`caseBoard: two cards have the id "${c.id}"`);
5213
5213
  o.add(c.id);
5214
5214
  const h = c.kind ?? "photo";
5215
- if (!bo.includes(h)) throw new Error(`caseBoard: ${ce("card kind", h, bo)}`);
5215
+ if (!yo.includes(h)) throw new Error(`caseBoard: ${ce("card kind", h, yo)}`);
5216
5216
  const d = (t.next() - 0.5) * 6;
5217
5217
  return {
5218
5218
  id: c.id,
@@ -5231,7 +5231,7 @@ function mu(e) {
5231
5231
  }), a = [...o], s = (c, h) => {
5232
5232
  if (!o.has(c)) throw new Error(`caseBoard: ${h}: ${ce("card", c, a)}`);
5233
5233
  }, i = (e.strings ?? []).map((c, h) => (s(c.from, `strings[${h}].from`), s(c.to, `strings[${h}].to`), { from: c.from, to: c.to, at: c.at ?? 0, duration: c.duration ?? 600, color: c.color ?? "#b91c1c" })), l = (e.marks ?? []).map((c, h) => {
5234
- if (s(c.on, `marks[${h}].on`), !(c.kind in yo)) throw new Error(`caseBoard: marks[${h}]: ${ce("mark", c.kind, Object.keys(yo))}`);
5234
+ if (s(c.on, `marks[${h}].on`), !(c.kind in bo)) throw new Error(`caseBoard: marks[${h}]: ${ce("mark", c.kind, Object.keys(bo))}`);
5235
5235
  return { on: c.on, kind: c.kind, at: c.at, duration: c.duration ?? 1400, color: c.color ?? At, width: c.width ?? (c.kind === "scribble" ? 18 : 16) };
5236
5236
  });
5237
5237
  return {
@@ -5303,14 +5303,14 @@ function zc(e, n, t, o = {}) {
5303
5303
  const r = o.radius ?? 11;
5304
5304
  e.save(), e.beginPath(), e.arc(n, t, r, 0, Math.PI * 2), e.fillStyle = o.color ?? At, e.fill(), e.lineWidth = 3, e.strokeStyle = o.ink ?? rt, e.stroke(), e.beginPath(), e.arc(n - r * 0.27, t - r * 0.27, r * 0.27, 0, Math.PI * 2), e.fillStyle = "#fca5a5", e.fill(), e.restore();
5305
5305
  }
5306
- function Kc(e, n, t, o = {}) {
5306
+ function Wc(e, n, t, o = {}) {
5307
5307
  if (t <= 0 || n.length < 2) return null;
5308
5308
  const r = vn(n, t);
5309
5309
  e.save(), e.strokeStyle = o.color ?? At, e.lineWidth = o.width ?? 16, e.lineCap = "round", e.lineJoin = "round", e.beginPath(), e.moveTo(r[0].x, r[0].y);
5310
5310
  for (const a of r.slice(1)) e.lineTo(a.x, a.y);
5311
5311
  return e.stroke(), e.restore(), r[r.length - 1];
5312
5312
  }
5313
- function bu(e, n, t, o = {}) {
5313
+ function yu(e, n, t, o = {}) {
5314
5314
  const { x: r, y: a, width: s, height: i, ink: l } = n;
5315
5315
  e.save(), Pe(e, r, a, s, i, 10), e.fillStyle = n.cork, e.fill(), e.save(), e.clip();
5316
5316
  const c = Tt(n.seed + 7);
@@ -5331,17 +5331,17 @@ function bu(e, n, t, o = {}) {
5331
5331
  if (u <= 0) continue;
5332
5332
  const p = f.width, g = f.height;
5333
5333
  e.save(), e.translate(r + f.x, a + f.y - 40 * (1 - Math.min(1, u))), e.rotate(f.angle * Math.PI / 180), e.scale(u, u), Pe(e, -p / 2, 0, p, g, 3), e.fillStyle = f.color, e.fill(), e.lineWidth = 3, e.strokeStyle = l, e.stroke();
5334
- const b = f.kind === "photo", $ = b ? { x: -p / 2 + 18, y: 18, width: p - 36, height: g * 0.62 } : { x: -p / 2 + 12, y: 14, width: p - 24, height: g * 0.45 };
5335
- b && (e.fillStyle = "#1e2530", e.fillRect($.x, $.y, $.width, $.height)), o.drawCard && (e.save(), e.beginPath(), e.rect($.x, $.y, $.width, $.height), e.clip(), o.drawCard(e, f, $, t), e.restore()), e.textAlign = "center", e.textBaseline = "alphabetic";
5334
+ const y = f.kind === "photo", $ = y ? { x: -p / 2 + 18, y: 18, width: p - 36, height: g * 0.62 } : { x: -p / 2 + 12, y: 14, width: p - 24, height: g * 0.45 };
5335
+ y && (e.fillStyle = "#1e2530", e.fillRect($.x, $.y, $.width, $.height)), o.drawCard && (e.save(), e.beginPath(), e.rect($.x, $.y, $.width, $.height), e.clip(), o.drawCard(e, f, $, t), e.restore()), e.textAlign = "center", e.textBaseline = "alphabetic";
5336
5336
  const A = $.y + $.height;
5337
- if (b)
5337
+ if (y)
5338
5338
  f.title && (e.font = Me(28, 800, n.font), e.fillStyle = l, e.fillText(f.title, 0, A + (g - A) * 0.45, p - 16)), f.note && (e.font = Me(19, 600, n.font), e.fillStyle = "#7f1d1d", e.fillText(f.note, 0, A + (g - A) * 0.8, p - 16));
5339
5339
  else {
5340
5340
  const m = [f.title, f.note].filter(Boolean).join(`
5341
5341
  `);
5342
5342
  e.font = Me(26, 700, n.handFont), e.fillStyle = l;
5343
5343
  const P = Bo(e, m, p - 20), O = o.drawCard ? A + 8 : (g - P.length * 30) / 2;
5344
- P.forEach((v, y) => e.fillText(v, 0, O + 24 + y * 30, p - 12));
5344
+ P.forEach((v, b) => e.fillText(v, 0, O + 24 + b * 30, p - 12));
5345
5345
  }
5346
5346
  f.highlight && t >= f.highlight.at && t <= f.highlight.at + f.highlight.duration && (e.strokeStyle = lr, e.lineWidth = 8, e.globalAlpha *= 0.6 + 0.4 * Math.sin((t - f.highlight.at) / 1e3 * 6), e.strokeRect(-p / 2 - 8, -8, p + 16, g + 16)), e.restore();
5347
5347
  const k = Qn(n, f.id).pin;
@@ -5350,11 +5350,11 @@ function bu(e, n, t, o = {}) {
5350
5350
  for (const f of n.marks) {
5351
5351
  if (t <= f.at) continue;
5352
5352
  const u = hr(n, f), p = cr(u, je(Ee(t, f.at, f.duration)));
5353
- u.forEach((g, b) => Kc(e, g, p[b], { color: f.color, width: f.width }));
5353
+ u.forEach((g, y) => Wc(e, g, p[y], { color: f.color, width: f.width }));
5354
5354
  }
5355
5355
  return e.restore(), Rc(n, t);
5356
5356
  }
5357
- const Wc = {
5357
+ const Kc = {
5358
5358
  atmosphere: {
5359
5359
  "drawRain(ctx, time, { x, y, width, height, drops?, opacity?, color?, speed?, length?, slant?, lineWidth?, seed? })": "rain streaks falling in a box (a window, the frame), clipped to it; seeded, a pure function of time",
5360
5360
  "drawBlinds(ctx, { x, y, width, height, opacity?, slope?, spacing?, band?, color? })": "key light through venetian blinds: slanted bright bands",
@@ -5382,8 +5382,8 @@ const Wc = {
5382
5382
  "drawPushPin(ctx, x, y, { color?, radius? })": "a red push pin",
5383
5383
  "drawMarkerStroke(ctx, points, progress, { color?, width? })": "the first part of a marker stroke; returns the nib"
5384
5384
  },
5385
- cardKinds: bo,
5386
- markKinds: yo,
5385
+ cardKinds: yo,
5386
+ markKinds: bo,
5387
5387
  card: "{ id, x, y (its pin, relative to the board), kind?, title?, note?, width?, height?, angle?, color?, at?, highlight?: { at, duration } }",
5388
5388
  string: "{ from, to, at?, duration?, color? }",
5389
5389
  mark: "{ on, kind, at, duration?, color?, width? }"
@@ -5420,7 +5420,7 @@ const _t = {
5420
5420
  sunset: ["#fb7185", "#f59e0b"],
5421
5421
  ocean: ["#0ea5e9", "#0b2e6b"]
5422
5422
  };
5423
- function yu(e, n) {
5423
+ function bu(e, n) {
5424
5424
  const t = n.sky ? _t[n.sky] : void 0;
5425
5425
  if (n.sky && !t)
5426
5426
  throw new Error(`drawSkyGradient: unknown sky "${n.sky}" (one of ${Object.keys(_t).join(", ")})`);
@@ -5433,8 +5433,8 @@ function wu(e, n, t) {
5433
5433
  const [s, i, l] = In(t.color ?? "#ffffff"), c = t.opacity ?? 0.7, h = t.size ?? 3, d = t.drift ?? { x: 0, y: -14 }, f = t.offset ?? { x: 0, y: 0 }, u = t.seed ?? 1, p = n / 1e3;
5434
5434
  e.save();
5435
5435
  for (let g = 0; g < a; g++) {
5436
- const b = [0.35, 0.65, 1][g % 3], $ = ko(Ie(g, u) * o + (d.x * p + f.x) * b, o), A = ko(Ie(g, u + 1) * r + (d.y * p + f.y) * b, r), k = 0.5 + 0.5 * Math.sin(p * (1.1 + 2.3 * Ie(g, u + 2)) + g);
5437
- e.fillStyle = Hn([s, i, l], c * (0.25 + 0.75 * k) * b), e.beginPath(), e.arc($, A, h * (0.5 + b), 0, Math.PI * 2), e.fill();
5436
+ const y = [0.35, 0.65, 1][g % 3], $ = ko(Ie(g, u) * o + (d.x * p + f.x) * y, o), A = ko(Ie(g, u + 1) * r + (d.y * p + f.y) * y, r), k = 0.5 + 0.5 * Math.sin(p * (1.1 + 2.3 * Ie(g, u + 2)) + g);
5437
+ e.fillStyle = Hn([s, i, l], c * (0.25 + 0.75 * k) * y), e.beginPath(), e.arc($, A, h * (0.5 + y), 0, Math.PI * 2), e.fill();
5438
5438
  }
5439
5439
  e.restore();
5440
5440
  }
@@ -5443,9 +5443,9 @@ function ku(e, n, t) {
5443
5443
  if (a === 0 || o <= 0 || r <= 0) return;
5444
5444
  const [s, i, l] = In(t.color ?? "#ffffff"), c = t.opacity ?? 0.1, h = t.minRadius ?? 60, d = Math.max(h, t.maxRadius ?? 190), f = t.drift ?? 8, u = t.offset ?? { x: 0, y: 0 }, p = t.seed ?? 3, g = n / 1e3;
5445
5445
  e.save();
5446
- for (let b = 0; b < a; b++) {
5447
- const $ = h + (d - h) * Ie(b, p + 5), A = o + $ * 2, k = ko(Ie(b, p) * A + f * g * (0.5 + Ie(b, p + 7)) + u.x * 1.6, A) - $, m = Ie(b, p + 1) * r + 20 * Math.sin(g * 0.4 + b) + u.y * 1.6;
5448
- e.fillStyle = Hn([s, i, l], c * (0.6 + 0.4 * Ie(b, p + 9))), e.beginPath(), e.arc(k, m, $, 0, Math.PI * 2), e.fill();
5446
+ for (let y = 0; y < a; y++) {
5447
+ const $ = h + (d - h) * Ie(y, p + 5), A = o + $ * 2, k = ko(Ie(y, p) * A + f * g * (0.5 + Ie(y, p + 7)) + u.x * 1.6, A) - $, m = Ie(y, p + 1) * r + 20 * Math.sin(g * 0.4 + y) + u.y * 1.6;
5448
+ e.fillStyle = Hn([s, i, l], c * (0.6 + 0.4 * Ie(y, p + 9))), e.beginPath(), e.arc(k, m, $, 0, Math.PI * 2), e.fill();
5449
5449
  }
5450
5450
  e.restore();
5451
5451
  }
@@ -5484,8 +5484,8 @@ function $u(e, n, t) {
5484
5484
  for (let f = 0; f < o; f++) {
5485
5485
  const u = Ie(f, h) * Math.PI * 2 + d * (t.spin ?? 0.15), p = Math.tan((Ie(f, h + 3) - 0.5) * 2.2) * 0.35, g = t.radius * (0.75 + 0.32 * p);
5486
5486
  if (g <= 0) continue;
5487
- const b = 0.5 + 0.5 * Math.sin(d * 7 + f * 1.7);
5488
- e.fillStyle = Hn([r, a, s], i * (0.3 + 0.7 * b)), e.beginPath(), e.arc(t.x + g * Math.cos(u), t.y + g * Math.sin(u) * c, l, 0, Math.PI * 2), e.fill();
5487
+ const y = 0.5 + 0.5 * Math.sin(d * 7 + f * 1.7);
5488
+ e.fillStyle = Hn([r, a, s], i * (0.3 + 0.7 * y)), e.beginPath(), e.arc(t.x + g * Math.cos(u), t.y + g * Math.sin(u) * c, l, 0, Math.PI * 2), e.fill();
5489
5489
  }
5490
5490
  e.restore();
5491
5491
  }
@@ -5667,8 +5667,8 @@ function Zc(e, n, t) {
5667
5667
  for (let i = 0; i + 1 < t.length; i++) {
5668
5668
  const l = [], c = /* @__PURE__ */ new Map(), h = (p) => {
5669
5669
  const g = p.map(($) => Math.round($ * 1e6)).join(",");
5670
- let b = c.get(g);
5671
- return b === void 0 && (b = l.length, l.push(p), c.set(g, b)), b;
5670
+ let y = c.get(g);
5671
+ return y === void 0 && (y = l.length, l.push(p), c.set(g, y)), y;
5672
5672
  }, d = [], f = (p) => p === 0, u = (p, g) => p + 2 === g.length;
5673
5673
  for (const p of o) {
5674
5674
  let g = p.points;
@@ -5766,7 +5766,7 @@ const Bt = {
5766
5766
  }, So = Math.PI / 180;
5767
5767
  function a0(e, n, t) {
5768
5768
  return {
5769
- toView: (o) => Br(ba(o, e * 90 * So), -n * So),
5769
+ toView: (o) => Br(ya(o, e * 90 * So), -n * So),
5770
5770
  toScreen: (o) => ({ x: o[0] * t, y: -o[1] * t })
5771
5771
  };
5772
5772
  }
@@ -5774,22 +5774,22 @@ const aa = /* @__PURE__ */ new WeakMap(), kn = (e) => ln(e), ln = (e) => {
5774
5774
  let n = aa.get(e);
5775
5775
  return n || aa.set(e, n = $l(e)), n;
5776
5776
  };
5777
- function ye(e, n, t) {
5777
+ function be(e, n, t) {
5778
5778
  return n[t] ?? e.controls[t]?.default ?? Bt[t]?.default ?? 0;
5779
5779
  }
5780
5780
  function Ft(e, n) {
5781
- const t = Math.max(0.05, ye(e, n, "squash")), o = 1 / Math.sqrt(t), a = [1, 0, 0, 0, 0, 1, ye(e, n, "lean"), 0, 0, 0, 1, 0, 0, 0, 0, 1];
5781
+ const t = Math.max(0.05, be(e, n, "squash")), o = 1 / Math.sqrt(t), a = [1, 0, 0, 0, 0, 1, be(e, n, "lean"), 0, 0, 0, 1, 0, 0, 0, 0, 1];
5782
5782
  return [
5783
- oe.translation([0, ye(e, n, "lift"), 0]),
5784
- oe.fromQuat(Ge.fromAxisAngle([1, 0, 0], -ye(e, n, "pitch"))),
5785
- oe.fromQuat(Ge.fromAxisAngle([0, 0, 1], ye(e, n, "roll"))),
5783
+ oe.translation([0, be(e, n, "lift"), 0]),
5784
+ oe.fromQuat(Ge.fromAxisAngle([1, 0, 0], -be(e, n, "pitch"))),
5785
+ oe.fromQuat(Ge.fromAxisAngle([0, 0, 1], be(e, n, "roll"))),
5786
5786
  a,
5787
5787
  oe.scaling([o, t, o]),
5788
- oe.scaling(Array(3).fill(Math.max(0, ye(e, n, "size"))))
5788
+ oe.scaling(Array(3).fill(Math.max(0, be(e, n, "size"))))
5789
5789
  ].reduce((s, i) => oe.multiply(s, i));
5790
5790
  }
5791
5791
  function Uo(e, n) {
5792
- const t = Ft(e, n), o = /* @__PURE__ */ new Map(), r = Object.entries(e.controls).flatMap(([s, i]) => (i.bind ?? []).map((l) => ({ value: ye(e, n, s), bind: l }))), a = (s) => {
5792
+ const t = Ft(e, n), o = /* @__PURE__ */ new Map(), r = Object.entries(e.controls).flatMap(([s, i]) => (i.bind ?? []).map((l) => ({ value: be(e, n, s), bind: l }))), a = (s) => {
5793
5793
  const i = o.get(s.id);
5794
5794
  if (i) return i;
5795
5795
  const l = s.parent ? e.parts.find((h) => h.id === s.parent) : void 0;
@@ -5817,16 +5817,16 @@ const to = (() => {
5817
5817
  return [e[0] / n, e[1] / n, e[2] / n];
5818
5818
  })(), r0 = Math.cos(35 * So);
5819
5819
  function mr(e, n, t, o, r = {}) {
5820
- const a = e.derive ? { ...n, ...e.derive(n) } : n, s = Uo(e, a), i = t.toView([0, 0, 0]), l = (j) => (K) => [j[0] * K[0] + j[4] * K[1] + j[8] * K[2], j[1] * K[0] + j[5] * K[1] + j[9] * K[2], j[2] * K[0] + j[6] * K[1] + j[10] * K[2]], c = Ft(e, a), h = r.slice === void 0 ? null : oe.invert(c), d = h ? e.parts.map((j) => ({ part: j, mesh: ln(j.shape), local: oe.multiply(h, s.get(j.id)), whole: j.shape.type === "tube" })) : void 0, f = d ? n0(d, r.slice) : void 0, u = d ? gr(d.map((j) => ({ part: j.part.id, mesh: j.mesh, ...Yo(j.mesh, j.local) }))) : void 0, p = (j, K, G, Y) => {
5821
- const ne = (z) => t.toView(oe.transformPoint(G, z)), B = K.vertices.map(ne), H = B.map((z) => t.toScreen(z)), N = r.perspective ? r.near : void 0, R = (z) => z.map((J) => t.toScreen(J)), M = (z) => N === void 0 ? z : Qs(z, N), _ = (z) => N === void 0 ? [z] : Xc(z, N), V = l(G), ee = K.faces.map((z) => {
5820
+ const a = e.derive ? { ...n, ...e.derive(n) } : n, s = Uo(e, a), i = t.toView([0, 0, 0]), l = (j) => (W) => [j[0] * W[0] + j[4] * W[1] + j[8] * W[2], j[1] * W[0] + j[5] * W[1] + j[9] * W[2], j[2] * W[0] + j[6] * W[1] + j[10] * W[2]], c = Ft(e, a), h = r.slice === void 0 ? null : oe.invert(c), d = h ? e.parts.map((j) => ({ part: j, mesh: ln(j.shape), local: oe.multiply(h, s.get(j.id)), whole: j.shape.type === "tube" })) : void 0, f = d ? n0(d, r.slice) : void 0, u = d ? gr(d.map((j) => ({ part: j.part.id, mesh: j.mesh, ...Yo(j.mesh, j.local) }))) : void 0, p = (j, W, G, Y) => {
5821
+ const ne = (z) => t.toView(oe.transformPoint(G, z)), B = W.vertices.map(ne), H = B.map((z) => t.toScreen(z)), N = r.perspective ? r.near : void 0, R = (z) => z.map((J) => t.toScreen(J)), M = (z) => N === void 0 ? z : Qs(z, N), _ = (z) => N === void 0 ? [z] : Xc(z, N), V = l(G), ee = W.faces.map((z) => {
5822
5822
  const J = t.toView(V(z.normal)), he = [J[0] - i[0], J[1] - i[1], J[2] - i[2]], fe = Math.hypot(...he) || 1;
5823
5823
  return [he[0] / fe, he[1] / fe, he[2] / fe];
5824
- }), F = u && Y ? pr(j.id, K, Y, fr(Y), u) : void 0, Q = (z) => F?.[z] ?? !1, ae = ee.map((z, J) => {
5824
+ }), F = u && Y ? pr(j.id, W, Y, fr(Y), u) : void 0, Q = (z) => F?.[z] ?? !1, ae = ee.map((z, J) => {
5825
5825
  if (Q(J)) return !1;
5826
5826
  if (!r.perspective) return z[2] > 1e-6;
5827
- const fe = K.faces[J].corners.reduce((pe, ge) => [pe[0] + B[ge][0], pe[1] + B[ge][1], pe[2] + B[ge][2]], [0, 0, 0]);
5827
+ const fe = W.faces[J].corners.reduce((pe, ge) => [pe[0] + B[ge][0], pe[1] + B[ge][1], pe[2] + B[ge][2]], [0, 0, 0]);
5828
5828
  return -(z[0] * fe[0] + z[1] * fe[1] + z[2] * fe[2]) > 1e-9;
5829
- }), x = (z) => K.faces[z].corners.reduce((J, he) => J + B[he][2], 0) / K.faces[z].corners.length, X = K.faces.map((z, J) => ({ face: z, i: J })).filter(({ i: z }) => ae[z]).map(({ face: z, i: J }) => ({
5829
+ }), x = (z) => W.faces[z].corners.reduce((J, he) => J + B[he][2], 0) / W.faces[z].corners.length, X = W.faces.map((z, J) => ({ face: z, i: J })).filter(({ i: z }) => ae[z]).map(({ face: z, i: J }) => ({
5830
5830
  i: J,
5831
5831
  solved: {
5832
5832
  points: N === void 0 ? z.corners.map((he) => H[he]) : R(M(z.corners.map((he) => B[he]))),
@@ -5837,33 +5837,33 @@ function mr(e, n, t, o, r = {}) {
5837
5837
  if (r.light) {
5838
5838
  const z = l(G);
5839
5839
  for (const { i: J, solved: he } of X) {
5840
- const fe = K.faces[J].corners, pe = fe.reduce((Cn, Pr) => {
5841
- const _n = oe.transformPoint(G, K.vertices[Pr]);
5840
+ const fe = W.faces[J].corners, pe = fe.reduce((Cn, Pr) => {
5841
+ const _n = oe.transformPoint(G, W.vertices[Pr]);
5842
5842
  return [Cn[0] + _n[0] / fe.length, Cn[1] + _n[1] / fe.length, Cn[2] + _n[2] / fe.length];
5843
- }, [0, 0, 0]), ge = z(K.faces[J].normal), Te = Math.hypot(...ge) || 1, Pt = r.light(pe, [ge[0] / Te, ge[1] / Te, ge[2] / Te]);
5843
+ }, [0, 0, 0]), ge = z(W.faces[J].normal), Te = Math.hypot(...ge) || 1, Pt = r.light(pe, [ge[0] / Te, ge[1] / Te, ge[2] / Te]);
5844
5844
  he.light = Pt.light, he.fog = Pt.fog;
5845
5845
  }
5846
5846
  }
5847
- const D = X.map((z) => z.solved), Z = i0(K), se = [], re = [];
5847
+ const D = X.map((z) => z.solved), Z = i0(W), se = [], re = [];
5848
5848
  for (const [z, J] of Z) {
5849
5849
  const he = J.filter((pe) => ae[pe]).length;
5850
5850
  if (he === 0) continue;
5851
- const fe = J.length === 2 && he === 2 && K.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] < r0;
5852
- J.length === 1 && (K.joined || c0(K, z)) || (J.length === 1 || he === 1 || fe) && (se.push(z.split("-").map(Number)), re.push(J.filter((pe) => ae[pe]).reduce((pe, ge) => x(ge) > x(pe) ? ge : pe)));
5851
+ const fe = 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] < r0;
5852
+ J.length === 1 && (W.joined || c0(W, z)) || (J.length === 1 || he === 1 || fe) && (se.push(z.split("-").map(Number)), re.push(J.filter((pe) => ae[pe]).reduce((pe, ge) => x(ge) > x(pe) ? ge : pe)));
5853
5853
  }
5854
- const ie = (z) => K.faces.findIndex((J) => J.corners.length > 4 && Math.sign(f0(K.vertices[z], J.normal)) > 0), E = (K.marks ?? []).filter(([z]) => ie(z) < 0 || ae[ie(z)]), W = ([z, J]) => N === void 0 ? [[H[z], H[J]]] : _([B[z], B[J]]).map(R), U = E.flatMap(W), te = (z) => N === void 0 ? [z.map((J) => H[J])] : _(z.map((J) => B[J])).map(R);
5854
+ const ie = (z) => W.faces.findIndex((J) => J.corners.length > 4 && Math.sign(f0(W.vertices[z], J.normal)) > 0), E = (W.marks ?? []).filter(([z]) => ie(z) < 0 || ae[ie(z)]), K = ([z, J]) => N === void 0 ? [[H[z], H[J]]] : _([B[z], B[J]]).map(R), U = E.flatMap(K), te = (z) => N === void 0 ? [z.map((J) => H[J])] : _(z.map((J) => B[J])).map(R);
5855
5855
  if (r.slice !== void 0) {
5856
5856
  const z = /* @__PURE__ */ new Map();
5857
5857
  se.forEach((J, he) => z.set(re[he], [...z.get(re[he]) ?? [], J]));
5858
5858
  for (const { i: J, solved: he } of X) {
5859
5859
  he.edges = ia(z.get(J) ?? []).flatMap(te);
5860
- const fe = K.faces[J].corners;
5860
+ const fe = W.faces[J].corners;
5861
5861
  he.center = fe.reduce((ge, Te) => [ge[0] + B[Te][0] / fe.length, ge[1] + B[Te][1] / fe.length, ge[2] + B[Te][2] / fe.length], [0, 0, 0]), he.normal = ee[J];
5862
5862
  const pe = X[X.length - 1].i;
5863
- he.marks = E.filter(([ge]) => (ie(ge) >= 0 ? ie(ge) : pe) === J).flatMap(W);
5863
+ he.marks = E.filter(([ge]) => (ie(ge) >= 0 ? ie(ge) : pe) === J).flatMap(K);
5864
5864
  }
5865
5865
  }
5866
- const q = j.glow ? Math.max(0, Math.min(1, ye(e, a, j.glow.control))) : 0, le = j.fade ? Math.max(0, Math.min(1, ye(e, a, j.fade.control))) : 0, L = j.fade ? Math.max(0, Math.min(1, j.fade.from + (j.fade.to - j.fade.from) * le)) : 1;
5866
+ const q = j.glow ? Math.max(0, Math.min(1, be(e, a, j.glow.control))) : 0, le = j.fade ? Math.max(0, Math.min(1, be(e, a, j.fade.control))) : 0, L = j.fade ? Math.max(0, Math.min(1, j.fade.from + (j.fade.to - j.fade.from) * le)) : 1;
5867
5867
  return {
5868
5868
  part: j,
5869
5869
  depth: B.reduce((z, J) => z + J[2], 0) / Math.max(1, B.length),
@@ -5873,7 +5873,7 @@ function mr(e, n, t, o, r = {}) {
5873
5873
  glow: q,
5874
5874
  opacity: L,
5875
5875
  ...j.shape.type === "tube" ? { spine: d0(_(j.shape.points.map(ne)).map(R)) } : {},
5876
- ...K.walls ? { cut: !0 } : {}
5876
+ ...W.walls ? { cut: !0 } : {}
5877
5877
  };
5878
5878
  }, g = new Map(d?.map((j) => [j.part.id, j.local])), $ = (f ? f.pieces.map((j) => ({
5879
5879
  part: j.part,
@@ -5882,33 +5882,33 @@ function mr(e, n, t, o, r = {}) {
5882
5882
  m: j.cut ? c : s.get(j.part.id),
5883
5883
  local: j.cut ? oe.identity() : g.get(j.part.id),
5884
5884
  cell: j.cell
5885
- })) : e.parts.map((j) => ({ part: j, mesh: ln(j.shape), m: s.get(j.id), local: void 0, cell: void 0 }))).map((j) => ({ cell: j.cell, solved: p(j.part, j.mesh, j.m, j.local) })), A = $.map((j) => j.solved), k = (j) => j.filter((K) => K.faces.length > 0 && K.opacity > 0.01).sort((K, G) => K.depth - G.depth);
5885
+ })) : e.parts.map((j) => ({ part: j, mesh: ln(j.shape), m: s.get(j.id), local: void 0, cell: void 0 }))).map((j) => ({ cell: j.cell, solved: p(j.part, j.mesh, j.m, j.local) })), A = $.map((j) => j.solved), k = (j) => j.filter((W) => W.faces.length > 0 && W.opacity > 0.01).sort((W, G) => W.depth - G.depth);
5886
5886
  let m;
5887
5887
  if (f) {
5888
5888
  const j = new Map(e.parts.map((G) => {
5889
5889
  const Y = s.get(G.id), ne = ln(G.shape).vertices;
5890
5890
  return [G.id, ne.reduce((B, H) => B + t.toView(oe.transformPoint(Y, H))[2], 0) / Math.max(1, ne.length)];
5891
- })), K = /* @__PURE__ */ new Map();
5891
+ })), W = /* @__PURE__ */ new Map();
5892
5892
  for (const G of $) {
5893
5893
  const Y = G.cell.join(",");
5894
- K.has(Y) || K.set(Y, { cell: G.cell, parts: [] }), K.get(Y).parts.push(G.solved), G.solved.depth = j.get(G.solved.part.id);
5894
+ W.has(Y) || W.set(Y, { cell: G.cell, parts: [] }), W.get(Y).parts.push(G.solved), G.solved.depth = j.get(G.solved.part.id);
5895
5895
  }
5896
- m = [...K.values()].map(({ cell: G, parts: Y }) => ({ depth: t.toView(oe.transformPoint(c, f.middle(G)))[2], parts: k(Y) })).filter((G) => G.parts.length > 0);
5896
+ m = [...W.values()].map(({ cell: G, parts: Y }) => ({ depth: t.toView(oe.transformPoint(c, f.middle(G)))[2], parts: k(Y) })).filter((G) => G.parts.length > 0);
5897
5897
  }
5898
5898
  const P = {};
5899
- for (const [j, K] of Object.entries(e.anchors ?? {})) {
5900
- const G = K.part ? s.get(K.part) : Ft(e, a);
5901
- if (!G) throw new Error(`prop rig: anchor "${j}" is on "${K.part}", which is not a part`);
5902
- const Y = t.toView(oe.transformPoint(G, K.at));
5899
+ for (const [j, W] of Object.entries(e.anchors ?? {})) {
5900
+ const G = W.part ? s.get(W.part) : Ft(e, a);
5901
+ if (!G) throw new Error(`prop rig: anchor "${j}" is on "${W.part}", which is not a part`);
5902
+ const Y = t.toView(oe.transformPoint(G, W.at));
5903
5903
  P[j] = { point: t.toScreen(Y), depth: Y[2] };
5904
5904
  }
5905
- const [O, v] = e.footprint ?? [e.length * 0.45, e.length], y = Math.max(0, ye(e, a, "lift")), S = Math.max(0, ye(e, a, "size")) / (1 + y * 0.8), w = Array.from({ length: 24 }, (j, K) => {
5906
- const G = Math.PI * 2 * K / 24;
5905
+ const [O, v] = e.footprint ?? [e.length * 0.45, e.length], b = Math.max(0, be(e, a, "lift")), S = Math.max(0, be(e, a, "size")) / (1 + b * 0.8), w = Array.from({ length: 24 }, (j, W) => {
5906
+ const G = Math.PI * 2 * W / 24;
5907
5907
  return t.toView([Math.cos(G) * O * 0.55 * S, 0, Math.sin(G) * v * 0.55 * S]);
5908
5908
  }), T = r.perspective ? r.near : void 0, I = {
5909
5909
  points: (T === void 0 ? w : Qs(w, T)).map((j) => t.toScreen(j)),
5910
5910
  opacity: 0.16 * S
5911
- }, C = A.filter((j) => j.part.seeThrough && j.opacity > 0.01).flatMap((j) => j.faces.map((K) => K.points));
5911
+ }, C = A.filter((j) => j.part.seeThrough && j.opacity > 0.01).flatMap((j) => j.faces.map((W) => W.points));
5912
5912
  return { under: k(A.filter((j) => !j.part.overRider)), over: k(A.filter((j) => j.part.overRider)), ...m ? { cells: m } : {}, anchors: P, openings: C, shadow: I, pxPerUnit: o, sizePx: e.height * o };
5913
5913
  }
5914
5914
  const ra = /* @__PURE__ */ new WeakMap();
@@ -5930,12 +5930,12 @@ function i0(e) {
5930
5930
  function l0(e, n) {
5931
5931
  const t = e.derive ? { ...n, ...e.derive(n) } : n, o = Uo(e, t), r = oe.invert(Ft(e, t)) ?? oe.identity(), a = (s) => Math.max(0, Math.min(1, s));
5932
5932
  return e.parts.map((s) => {
5933
- const i = s.fade ? a(ye(e, t, s.fade.control)) : 0;
5933
+ const i = s.fade ? a(be(e, t, s.fade.control)) : 0;
5934
5934
  return {
5935
5935
  part: s,
5936
5936
  matrix: o.get(s.id),
5937
5937
  local: oe.multiply(r, o.get(s.id)),
5938
- glow: s.glow ? a(ye(e, t, s.glow.control)) : 0,
5938
+ glow: s.glow ? a(be(e, t, s.glow.control)) : 0,
5939
5939
  opacity: s.fade ? a(s.fade.from + (s.fade.to - s.fade.from) * i) : 1
5940
5940
  };
5941
5941
  });
@@ -5980,14 +5980,14 @@ function ia(e) {
5980
5980
  }
5981
5981
  return t;
5982
5982
  }
5983
- function br(e, n) {
5983
+ function yr(e, n) {
5984
5984
  if (!e.loose?.size) return;
5985
5985
  const t = {};
5986
5986
  for (const [o, r] of e.loose)
5987
5987
  t[o] = { x: n[`piece.${r}.x`] ?? 0, y: n[`piece.${r}.y`] ?? 0, rotate: n[`piece.${r}.rotate`] ?? 0, opacity: n[`piece.${r}.opacity`] ?? 1 };
5988
5988
  return t;
5989
5989
  }
5990
- function yr(e) {
5990
+ function br(e) {
5991
5991
  const n = {};
5992
5992
  for (const [t, o] of Object.entries({ ...Bt, ...e.rig.controls })) {
5993
5993
  const { bind: r, ...a } = o;
@@ -5996,7 +5996,7 @@ function yr(e) {
5996
5996
  return n;
5997
5997
  }
5998
5998
  function u0(e) {
5999
- const { prop: n } = e, t = e.scale ?? 60, o = n.rig.length * t * 1.4, r = n.rig.height * t * 1.6, a = yr(n), s = {};
5999
+ const { prop: n } = e, t = e.scale ?? 60, o = n.rig.length * t * 1.4, r = n.rig.height * t * 1.6, a = br(n), s = {};
6000
6000
  for (const [l, c] of Object.entries(a)) s[l] = e.values?.[l] ?? c.default ?? 0;
6001
6001
  const i = { look: e.look, ink: e.ink, lineWidth: e.lineWidth, pencil: e.pencil, seed: e.seed, style: e.style, paper: e.paper };
6002
6002
  return {
@@ -6017,12 +6017,12 @@ function u0(e) {
6017
6017
  },
6018
6018
  draw(l, c, h) {
6019
6019
  const d = c.props ?? {};
6020
- l.translate(o / 2, r), _a(l, qt(n, d, t), { ...i, time: h, loose: br(c, d) });
6020
+ l.translate(o / 2, r), _a(l, qt(n, d, t), { ...i, time: h, loose: yr(c, d) });
6021
6021
  }
6022
6022
  };
6023
6023
  }
6024
6024
  function qt(e, n, t) {
6025
- const o = a0(ye(e.rig, n, "turn"), ye(e.rig, n, "tilt"), t);
6025
+ const o = a0(be(e.rig, n, "turn"), be(e.rig, n, "tilt"), t);
6026
6026
  return mr(e.rig, n, o, t);
6027
6027
  }
6028
6028
  function Xo(e, n, t) {
@@ -6047,7 +6047,7 @@ function Hu(e, n, t, o, r = {}) {
6047
6047
  return e.save(), e.translate(a.origin.x, a.origin.y), _a(e, a.solved, {
6048
6048
  ...n.propDraw,
6049
6049
  time: t.time,
6050
- loose: br(n, a.values),
6050
+ loose: yr(n, a.values),
6051
6051
  // The rider is drawn in scene px.
6052
6052
  rider: r.rider ? (s) => {
6053
6053
  s.save(), s.translate(-a.origin.x, -a.origin.y), r.rider(s), s.restore();
@@ -6071,64 +6071,64 @@ const xt = {
6071
6071
  }
6072
6072
  }, g0 = 400, p0 = 0.2;
6073
6073
  function ju(e, n = {}) {
6074
- const { prop: t } = e, o = yr(t), r = Object.keys(o), a = Object.keys(t.rig.anchors ?? {}), s = t.rig.parts.map((O) => O.id), i = Lt(), l = Tn(i), c = n.tracks?.length ? new ve({ id: `${t.kind}-surface`, tracks: n.tracks }) : void 0, h = Math.max(0, ...(n.tracks ?? []).flatMap((O) => O.keyframes.map((v) => v.time))), d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
6074
+ const { prop: t } = e, o = br(t), r = Object.keys(o), a = Object.keys(t.rig.anchors ?? {}), s = t.rig.parts.map((O) => O.id), i = Lt(), l = Tn(i), c = n.tracks?.length ? new ve({ id: `${t.kind}-surface`, tracks: n.tracks }) : void 0, h = Math.max(0, ...(n.tracks ?? []).flatMap((O) => O.keyframes.map((v) => v.time))), d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
6075
6075
  e.loose = f;
6076
6076
  const u = e.props, p = (O) => {
6077
6077
  const v = { ...e.props };
6078
- let y = 0, S = 0;
6078
+ let b = 0, S = 0;
6079
6079
  if (c) {
6080
6080
  const w = c.getStateAtTime(Math.min(O, h));
6081
6081
  for (const T of w.values.values())
6082
6082
  for (const [I, C] of T)
6083
- typeof C == "number" && (I === "x" ? y = C : I === "y" ? S = C : I in v && (v[I] = C));
6083
+ typeof C == "number" && (I === "x" ? b = C : I === "y" ? S = C : I in v && (v[I] = C));
6084
6084
  }
6085
6085
  for (const w of r) i.keys(w)?.length && (v[w] = i.valueAt(w, O));
6086
- return { values: v, origin: { x: e.x + e.width / 2 + y, y: e.y + e.height + S } };
6086
+ return { values: v, origin: { x: e.x + e.width / 2 + b, y: e.y + e.height + S } };
6087
6087
  }, g = (O) => {
6088
- const { kind: v, rest: y } = $t(O), S = (w) => tt(t.kind, O, xt, w);
6088
+ const { kind: v, rest: b } = $t(O), S = (w) => tt(t.kind, O, xt, w);
6089
6089
  if (v === "box") {
6090
- if (y) throw S("box takes no arguments");
6090
+ if (b) throw S("box takes no arguments");
6091
6091
  return { kind: v };
6092
6092
  }
6093
6093
  if (v === "anchor") {
6094
- if (!a.includes(y)) throw S(ce(`${t.kind} anchor`, y, a));
6095
- return { kind: v, name: y };
6094
+ if (!a.includes(b)) throw S(ce(`${t.kind} anchor`, b, a));
6095
+ return { kind: v, name: b };
6096
6096
  }
6097
6097
  if (v === "part") {
6098
- if (!s.includes(y)) throw S(ce(`${t.kind} part`, y, s));
6099
- return { kind: v, name: y };
6098
+ if (!s.includes(b)) throw S(ce(`${t.kind} part`, b, s));
6099
+ return { kind: v, name: b };
6100
6100
  }
6101
6101
  if (v === "control") {
6102
- if (!r.includes(y)) throw S(ce(`${t.kind} control`, y, r));
6103
- return { kind: v, name: y };
6102
+ if (!r.includes(b)) throw S(ce(`${t.kind} control`, b, r));
6103
+ return { kind: v, name: b };
6104
6104
  }
6105
6105
  throw S();
6106
- }, b = (O) => {
6107
- const v = (t.rig.controls[O]?.bind ?? []).flatMap((S) => S.parts), y = t.rig.parts.filter((S) => S.glow?.control === O).map((S) => S.id);
6108
- return /* @__PURE__ */ new Set([...v, ...y]);
6106
+ }, y = (O) => {
6107
+ const v = (t.rig.controls[O]?.bind ?? []).flatMap((S) => S.parts), b = t.rig.parts.filter((S) => S.glow?.control === O).map((S) => S.id);
6108
+ return /* @__PURE__ */ new Set([...v, ...b]);
6109
6109
  }, $ = /* @__PURE__ */ new Map(), A = (O) => {
6110
6110
  let v = $.get(O);
6111
6111
  if (!v) {
6112
- const y = p(O);
6113
- $.set(O, v = { ...y, solved: qt(t, y.values, e.propScale) });
6112
+ const b = p(O);
6113
+ $.set(O, v = { ...b, solved: qt(t, b.values, e.propScale) });
6114
6114
  }
6115
6115
  return v;
6116
6116
  }, k = (O, v) => {
6117
- const y = g(O), { values: S, origin: w, solved: T } = A(v);
6118
- if (y.kind === "box") return me(w.x - e.width / 2, w.y - e.height, e.width, e.height);
6119
- if (y.kind === "anchor") {
6120
- const j = T.anchors[y.name].point, K = p0 * e.propScale;
6121
- return me(w.x + j.x - K / 2, w.y + j.y - K / 2, K, K);
6122
- }
6123
- if (y.kind === "part") return C(/* @__PURE__ */ new Set([y.name]), `part "${y.name}" is`);
6124
- const I = b(y.name);
6117
+ const b = g(O), { values: S, origin: w, solved: T } = A(v);
6118
+ if (b.kind === "box") return me(w.x - e.width / 2, w.y - e.height, e.width, e.height);
6119
+ if (b.kind === "anchor") {
6120
+ const j = T.anchors[b.name].point, W = p0 * e.propScale;
6121
+ return me(w.x + j.x - W / 2, w.y + j.y - W / 2, W, W);
6122
+ }
6123
+ if (b.kind === "part") return C(/* @__PURE__ */ new Set([b.name]), `part "${b.name}" is`);
6124
+ const I = y(b.name);
6125
6125
  if (I.size === 0) return me(w.x - e.width / 2, w.y - e.height, e.width, e.height);
6126
- return C(I, `the parts control "${y.name}" moves are`);
6127
- function C(j, K) {
6126
+ return C(I, `the parts control "${b.name}" moves are`);
6127
+ function C(j, W) {
6128
6128
  const G = [...T.under, ...T.over].filter((N) => j.has(N.part.id)).flatMap((N) => N.faces.flatMap((R) => R.points));
6129
6129
  if (G.length === 0) {
6130
6130
  const N = Number.isFinite(v) ? `at ${v} ms` : "after its edits";
6131
- throw new Error(`${t.kind}: ${K} turned away from the viewer ${N}; aim at an anchor (${a.map((R) => `anchor:${R}`).join(", ") || "none"}) or box`);
6131
+ throw new Error(`${t.kind}: ${W} turned away from the viewer ${N}; aim at an anchor (${a.map((R) => `anchor:${R}`).join(", ") || "none"}) or box`);
6132
6132
  }
6133
6133
  const Y = G.map((N) => N.x), ne = G.map((N) => N.y), B = Math.min(...Y), H = Math.min(...ne);
6134
6134
  return me(w.x + B, w.y + H, Math.max(...Y) - B, Math.max(...ne) - H);
@@ -6151,8 +6151,8 @@ function ju(e, n = {}) {
6151
6151
  piece(O) {
6152
6152
  const v = g(O);
6153
6153
  if (v.kind !== "part") throw new Error(`${t.kind}: a piece is a part, part:ID (${s.slice(0, 6).map((T) => `part:${T}`).join(", ")}…), not "${O}"`);
6154
- const y = d.get(v.name);
6155
- if (y) return y;
6154
+ const b = d.get(v.name);
6155
+ if (b) return b;
6156
6156
  const S = [v.name];
6157
6157
  for (let T = 0; T < S.length; T++) for (const I of t.rig.parts) I.parent === S[T] && !S.includes(I.id) && S.push(I.id);
6158
6158
  const w = { id: d.size + 1, part: v.name, home: k(O, 0) };
@@ -6161,18 +6161,18 @@ function ju(e, n = {}) {
6161
6161
  for (const T of ["x", "y", "rotate"]) u[`piece.${w.id}.${T}`] = 0;
6162
6162
  return u[`piece.${w.id}.opacity`] = 1, w;
6163
6163
  },
6164
- edit(O, v, y) {
6164
+ edit(O, v, b) {
6165
6165
  if (!(O in xt.edits)) throw An(t.kind, O, xt);
6166
6166
  const S = Array.isArray(v) ? v : [v];
6167
6167
  if (S.length === 0) throw new Error(`${t.kind}.edit: ${O} takes at least one anchor`);
6168
6168
  if ($.clear(), O === "move" || O === "fling") {
6169
6169
  if (S.length > 1) throw new Error(`${t.kind}.edit: ${O} takes one part anchor`);
6170
6170
  const w = P.piece(S[0]);
6171
- if (O === "fling") return P.fling(w, y);
6172
- const T = y.to;
6171
+ if (O === "fling") return P.fling(w, b);
6172
+ const T = b.to;
6173
6173
  if (!T) throw new Error(`${t.kind}.edit: move needs \`to\`, an anchor name or { x, y }`);
6174
- const I = typeof T == "string" ? k(T, y.at) : void 0;
6175
- return P.move(w, { ...y, to: I ? { x: I.left + I.width / 2, y: I.top + I.height / 2 } : T });
6174
+ const I = typeof T == "string" ? k(T, b.at) : void 0;
6175
+ return P.move(w, { ...b, to: I ? { x: I.left + I.width / 2, y: I.top + I.height / 2 } : T });
6176
6176
  }
6177
6177
  for (const w of S) {
6178
6178
  const T = g(w);
@@ -6180,11 +6180,11 @@ function ju(e, n = {}) {
6180
6180
  const I = o[T.name];
6181
6181
  let C;
6182
6182
  if (O === "set") {
6183
- if (typeof y.value != "number" || !Number.isFinite(y.value)) throw new Error(`${t.kind}.edit: set needs \`value\`, a number (${T.name}: ${I.description})`);
6184
- C = y.value;
6183
+ if (typeof b.value != "number" || !Number.isFinite(b.value)) throw new Error(`${t.kind}.edit: set needs \`value\`, a number (${T.name}: ${I.description})`);
6184
+ C = b.value;
6185
6185
  } else
6186
- C = y.on === !1 ? I.default ?? I.min ?? 0 : I.max ?? 1;
6187
- i.tween(T.name, p(y.at).values[T.name], C, y, g0);
6186
+ C = b.on === !1 ? I.default ?? I.min ?? 0 : I.max ?? 1;
6187
+ i.tween(T.name, p(b.at).values[T.name], C, b, g0);
6188
6188
  }
6189
6189
  return P;
6190
6190
  },
@@ -6197,17 +6197,17 @@ function ju(e, n = {}) {
6197
6197
  move(O, v) {
6198
6198
  return $.clear(), l.move(O, v), P;
6199
6199
  },
6200
- ride(O, v, y) {
6200
+ ride(O, v, b) {
6201
6201
  const S = [
6202
- ...r.flatMap((T) => Wt(i.keys(T))),
6203
- ...(n.tracks ?? []).flatMap((T) => Wt(T.keyframes.filter((I) => typeof I.value == "number")))
6202
+ ...r.flatMap((T) => Kt(i.keys(T))),
6203
+ ...(n.tracks ?? []).flatMap((T) => Kt(T.keyframes.filter((I) => typeof I.value == "number")))
6204
6204
  ];
6205
6205
  if (S.length === 0) return O;
6206
6206
  const w = [...a.map((T) => `anchor:${T}`), ...s.map((T) => `part:${T}`)].flatMap((T) => {
6207
6207
  const I = m(T, 0);
6208
6208
  return I ? [{ top: I.top, offset: (C) => (m(T, C)?.top ?? I.top) - I.top, windows: S }] : [];
6209
6209
  });
6210
- return Wo(O, v, { ground: y.ground, every: y.every ?? et, floors: w });
6210
+ return Ko(O, v, { ground: b.ground, every: b.every ?? et, floors: w });
6211
6211
  },
6212
6212
  tracks: i.tracks
6213
6213
  };
@@ -6251,12 +6251,12 @@ function Ve(e) {
6251
6251
  ink: h.style === "spoked" ? n.tyre : void 0,
6252
6252
  outline: h.style === "spoked" ? 1.3 : 1
6253
6253
  }), h.style !== "spoked")
6254
- for (const b of p === 0 ? [1, -1] : [p])
6254
+ for (const y of p === 0 ? [1, -1] : [p])
6255
6255
  t.push({
6256
- id: `${g}-hub${p === 0 ? b > 0 ? "-left" : "-right" : ""}`,
6256
+ id: `${g}-hub${p === 0 ? y > 0 ? "-left" : "-right" : ""}`,
6257
6257
  parent: g,
6258
6258
  shape: { type: "cylinder", radius: h.radius * 0.55, length: 0.02, axis: "x", segments: 14, spokes: 5 },
6259
- at: [b * (u / 2 + 0.012), 0, 0],
6259
+ at: [y * (u / 2 + 0.012), 0, 0],
6260
6260
  fill: n.hub,
6261
6261
  outline: 0.6
6262
6262
  });
@@ -6272,9 +6272,9 @@ function Ve(e) {
6272
6272
  if (e.door) {
6273
6273
  const { from: h, to: d, low: f, high: u } = e.door, p = [[h, f], [d, f], [d, u], [h, u]];
6274
6274
  for (const g of [1, -1]) {
6275
- const b = g > 0 ? "left" : "right";
6275
+ const y = g > 0 ? "left" : "right";
6276
6276
  t.push({
6277
- id: `doorway-${b}`,
6277
+ id: `doorway-${y}`,
6278
6278
  shape: { type: "panel", points: p, facing: g > 0 ? "left" : "right" },
6279
6279
  at: [g * (e.width / 2 + 4e-3), 0, 0],
6280
6280
  fill: n.inside,
@@ -6283,13 +6283,13 @@ function Ve(e) {
6283
6283
  });
6284
6284
  const $ = h + (d - h) * 0.15, A = h + (d - h) * 0.55;
6285
6285
  t.push({
6286
- id: `seat-back-${b}`,
6286
+ id: `seat-back-${y}`,
6287
6287
  shape: { type: "panel", points: [[$, f + 0.05], [A, f + 0.05], [A - 0.08, u - 0.06], [$ + 0.06, u - 0.04]], facing: g > 0 ? "left" : "right" },
6288
6288
  at: [g * (e.width / 2 + 6e-3), 0, 0],
6289
6289
  fill: n.seat,
6290
6290
  outline: 0.4
6291
6291
  }), t.push({
6292
- id: `door-${b}`,
6292
+ id: `door-${y}`,
6293
6293
  shape: { type: "panel", points: p.map(([k, m]) => [k - d, m]), facing: g > 0 ? "left" : "right" },
6294
6294
  // The panel's origin is at its hinge (its front edge), just outside the body.
6295
6295
  at: [g * (e.width / 2 + 0.01), 0, d],
@@ -6311,9 +6311,9 @@ function Ve(e) {
6311
6311
  };
6312
6312
  }
6313
6313
  if (e.lights) {
6314
- const { across: h, low: d, high: f, front: u, back: p } = e.lights, g = (e.lights.size ?? 0.32) / 2, b = [[-g, d], [g, d], [g, f], [-g, f]];
6314
+ const { across: h, low: d, high: f, front: u, back: p } = e.lights, g = (e.lights.size ?? 0.32) / 2, y = [[-g, d], [g, d], [g, f], [-g, f]];
6315
6315
  for (const $ of [1, -1])
6316
- t.push({ id: `headlight-${$}`, shape: { type: "panel", points: b, facing: "front" }, at: [$ * h, 0, u], fill: n.light, outline: 0.6, glow: { control: "lights", color: "#ffffff" } }), t.push({ id: `taillight-${$}`, shape: { type: "panel", points: b, facing: "back" }, at: [$ * h, 0, p], fill: Ro(n.tail, 0.62), outline: 0.6, glow: { control: "lights", color: n.tail } });
6316
+ t.push({ id: `headlight-${$}`, shape: { type: "panel", points: y, facing: "front" }, at: [$ * h, 0, u], fill: n.light, outline: 0.6, glow: { control: "lights", color: "#ffffff" } }), t.push({ id: `taillight-${$}`, shape: { type: "panel", points: y, facing: "back" }, at: [$ * h, 0, p], fill: Ro(n.tail, 0.62), outline: 0.6, glow: { control: "lights", color: n.tail } });
6317
6317
  l.lights = { description: "Lights on: 0 off, 1 on", unit: "0..1", min: 0, max: 1 };
6318
6318
  }
6319
6319
  e.antenna && (t.push({ id: "antenna", shape: { type: "tube", points: [[0, 0, 0], [0, 0.75, 0]], radius: 0.018, segments: 5 }, at: e.antenna, fill: n.trim, outline: 0.6 }), t.push({ id: "antenna-tip", parent: "antenna", shape: { type: "ellipsoid", radii: [0.05, 0.05, 0.05], segments: 8 }, at: [0, 0.77, 0], fill: n.tail, outline: 0.6 }), l.antenna = {
@@ -6342,8 +6342,8 @@ function Ve(e) {
6342
6342
  family: "vehicle",
6343
6343
  summary: e.summary ?? "A wheeled vehicle",
6344
6344
  rig: c,
6345
- actions: y0(e),
6346
- acting: b0,
6345
+ actions: b0(e),
6346
+ acting: y0,
6347
6347
  colors: { body: n.body, ink: "#26262b" },
6348
6348
  follow: e.antenna ? [{ control: "antenna", of: "x", per: 0.9, stiffness: 140, damping: 7, limit: 35 }] : void 0,
6349
6349
  wheelRadius: s,
@@ -6364,7 +6364,7 @@ function wr(e) {
6364
6364
  ];
6365
6365
  return { forwardMost: Math.max(...n), backMost: Math.min(...n), top: Math.max(...t) };
6366
6366
  }
6367
- const b0 = {
6367
+ const y0 = {
6368
6368
  depth: { turn: 0, lift: 0, lights: 0, pitch: 1, roll: 1, squash: 1, lean: 1, door: 2 },
6369
6369
  limits: { turn: 0.08, pitch: 5, roll: 4, lean: 0.1, squash: 0.06, door: 0.12, lift: 0 },
6370
6370
  eyes: [],
@@ -6376,7 +6376,7 @@ function nn(e, n, t, o, r, a, s = !1) {
6376
6376
  e.set("wheelSpin", n, l), e.move(n, t, o, { easing: r }), e.set("wheelSpin", t, s ? l : l + c / a * (180 / Math.PI), r);
6377
6377
  }
6378
6378
  const la = 0.4;
6379
- function y0(e) {
6379
+ function b0(e) {
6380
6380
  const n = e.wheels[0]?.radius ?? 0.4, { forwardMost: t, backMost: o } = wr(e), r = (t - o) / 2, a = (i, l, c) => {
6381
6381
  const h = i.exaggeration;
6382
6382
  let d = l;
@@ -6404,8 +6404,8 @@ function y0(e) {
6404
6404
  run(i, l, c) {
6405
6405
  const h = Math.sign(l.to - i.x);
6406
6406
  if (h === 0) return { end: c };
6407
- const d = a(i, c, h), f = i.exaggeration, u = i.x, p = Math.abs(l.to - u), g = l.for ?? Math.max(600, p / (l.speed ?? la * 1.2)), b = d + g * 0.55, $ = u + (l.to - u) * 0.65;
6408
- return i.key(d + 140, { pitch: -1.5 * f, squash: 1 + 0.06 * f, lean: 0.14 * f }, { act: !1, easing: "ease-out" }), nn(i, d, b, $, "ease-in", n), i.key(b + 80, { pitch: -7 * f, lean: -0.12 * f, squash: 0.94 }, { act: !1, easing: "ease-out" }), nn(i, b, d + g, l.to, "ease-out", n, !0), i.effect({ kind: "skid", time: b, x: $, toX: l.to, y: i.floor, length: g * 0.45 + 1500 }), i.effect({ kind: "dust", time: d + g, x: l.to + h * r * i.scale, y: i.floor, length: 600, direction: h }), s(i, d + g, !0), { end: d + g + 380, contact: b, release: d + g };
6407
+ const d = a(i, c, h), f = i.exaggeration, u = i.x, p = Math.abs(l.to - u), g = l.for ?? Math.max(600, p / (l.speed ?? la * 1.2)), y = d + g * 0.55, $ = u + (l.to - u) * 0.65;
6408
+ return i.key(d + 140, { pitch: -1.5 * f, squash: 1 + 0.06 * f, lean: 0.14 * f }, { act: !1, easing: "ease-out" }), nn(i, d, y, $, "ease-in", n), i.key(y + 80, { pitch: -7 * f, lean: -0.12 * f, squash: 0.94 }, { act: !1, easing: "ease-out" }), nn(i, y, d + g, l.to, "ease-out", n, !0), i.effect({ kind: "skid", time: y, x: $, toX: l.to, y: i.floor, length: g * 0.45 + 1500 }), i.effect({ kind: "dust", time: d + g, x: l.to + h * r * i.scale, y: i.floor, length: 600, direction: h }), s(i, d + g, !0), { end: d + g + 380, contact: y, release: d + g };
6409
6409
  }
6410
6410
  },
6411
6411
  bump: {
@@ -6691,7 +6691,7 @@ function I0(e = {}) {
6691
6691
  const n = e.width ?? 4, t = e.depth ?? 3.2, o = e.wallHeight ?? 2.5, r = e.roofHeight ?? 1.5, a = e.overhang ?? 0.25, s = { walls: "#f1d9a8", roof: "#b8433a", door: "#7a4b2a", doorway: "#3a2a22", glass: "#bfe3f2", lit: "#ffd66b", chimney: "#9b5a45", ...e.colors }, i = t / 2 + 0.01, l = e.door?.width ?? 0.9, c = e.door?.height ?? 1.9, h = e.door?.at ?? 0, f = (e.door?.hinge ?? "left") === "left" ? 1 : -1, u = h - f * l / 2, p = -80 * f * ((e.door?.opens ?? "out") === "out" ? 1 : -1), g = e.windows ?? [
6692
6692
  { at: -1.25, low: 1, width: 0.8, height: 0.8 },
6693
6693
  { at: 1.25, low: 1, width: 0.8, height: 0.8 }
6694
- ], b = [
6694
+ ], y = [
6695
6695
  { id: "walls", shape: { type: "box", size: [n, o, t] }, at: [0, o / 2, 0], fill: s.walls },
6696
6696
  {
6697
6697
  id: "roof",
@@ -6706,7 +6706,7 @@ function I0(e = {}) {
6706
6706
  { id: "door", shape: { type: "panel", points: [[0, 0], [f * l, 0], [f * l, c], [0, c]], facing: "front" }, at: [u, 0, i + 5e-3], fill: s.door, outline: 0.8, overRider: !0 }
6707
6707
  ];
6708
6708
  g.forEach((k, m) => {
6709
- b.push({
6709
+ y.push({
6710
6710
  id: `window-${m}`,
6711
6711
  shape: { type: "panel", points: [[-k.width / 2, k.low], [k.width / 2, k.low], [k.width / 2, k.low + k.height], [-k.width / 2, k.low + k.height]], facing: "front" },
6712
6712
  // A centimetre out from the wall, as the side windows are: never in its very plane (a depth buffer can't
@@ -6718,7 +6718,7 @@ function I0(e = {}) {
6718
6718
  });
6719
6719
  });
6720
6720
  for (const k of [1, -1])
6721
- b.push({
6721
+ y.push({
6722
6722
  id: `side-window-${k > 0 ? "left" : "right"}`,
6723
6723
  shape: { type: "panel", points: [[-0.4, 1], [0.4, 1], [0.4, 1.8], [-0.4, 1.8]], facing: k > 0 ? "left" : "right" },
6724
6724
  at: [k * (n / 2 + 0.01), 0, 0],
@@ -6729,10 +6729,10 @@ function I0(e = {}) {
6729
6729
  const $ = e.chimney === !1 ? void 0 : { at: e.chimney?.at ?? n * 0.28, back: e.chimney?.back ?? -t * 0.18 };
6730
6730
  if ($) {
6731
6731
  const k = o + r * (1 - Math.abs($.back) / (t / 2 + a)), m = o + r + 0.45;
6732
- b.push({ id: "chimney", shape: { type: "box", size: [0.42, m - k + 0.3, 0.42] }, at: [$.at, (m + k - 0.3) / 2, $.back], fill: s.chimney, layer: 1 });
6732
+ y.push({ id: "chimney", shape: { type: "box", size: [0.42, m - k + 0.3, 0.42] }, at: [$.at, (m + k - 0.3) / 2, $.back], fill: s.chimney, layer: 1 });
6733
6733
  }
6734
6734
  const A = {
6735
- parts: b,
6735
+ parts: y,
6736
6736
  controls: {
6737
6737
  door: { description: "The front door open: 0 shut, 1 open", unit: "0..1", min: 0, max: 1, bind: [{ parts: ["door"], rotate: { axis: "y", degrees: p } }] },
6738
6738
  lights: { description: "The windows lit: 0 dark, 1 lit", unit: "0..1", min: 0, max: 1 }
@@ -6951,18 +6951,18 @@ function z0(e = {}) {
6951
6951
  }
6952
6952
  }
6953
6953
  },
6954
- acting: K0,
6954
+ acting: W0,
6955
6955
  colors: { body: a.blanket }
6956
6956
  };
6957
6957
  }
6958
- const K0 = {
6958
+ const W0 = {
6959
6959
  depth: { give: 1, roll: 1, squash: 1, size: 0 },
6960
6960
  limits: { give: 0.03, roll: 0.5, squash: 0.03 },
6961
6961
  eyes: [],
6962
6962
  headTurns: {},
6963
6963
  drift: []
6964
6964
  };
6965
- function W0(e = {}) {
6965
+ function K0(e = {}) {
6966
6966
  const n = e.width ?? 0.9, t = e.height ?? 2.05, o = e.hinge ?? "left", r = { frame: "#d9d2c3", door: "#7a4b2a", handle: "#c9a227", beyond: "#2a2f3a", ...e.colors }, a = 0.1, s = o === "left" ? 1 : -1, i = s > 0 ? [[0, 0], [-n, 0], [-n, t], [0, t]] : [[0, 0], [n, 0], [n, t], [0, t]], c = {
6967
6967
  parts: [
6968
6968
  { id: "post-left", shape: { type: "box", size: [a, t + a, a] }, at: [n / 2 + a / 2, (t + a) / 2, 0], fill: r.frame },
@@ -7043,18 +7043,18 @@ function L0(e = {}) {
7043
7043
  // Footrests: a bar in front, low, with two plates.
7044
7044
  { id: "footrest", shape: { type: "box", size: [n * 0.8, 0.02, 0.14] }, at: [0, 0.12, l / 2 + 0.22], fill: a.frame }
7045
7045
  ];
7046
- for (const [g, b] of [[-1, "left"], [1, "right"]]) {
7046
+ for (const [g, y] of [[-1, "left"], [1, "right"]]) {
7047
7047
  const $ = g * d, A = (k, m, P = i) => {
7048
7048
  f.push({ id: k, shape: { type: "tube", points: m, radius: P, segments: 6 }, fill: a.frame, outline: 0.7 });
7049
7049
  };
7050
- A(`post-${b}`, [[$, t - 0.1, -l / 2], [$, c + 0.04, -l / 2], [$, c + 0.04, -l / 2 - 0.14]]), A(`rail-${b}`, [[$, t - 0.03, -l / 2], [$, t - 0.03, l / 2]]), A(`leg-${b}`, [[$, t - 0.03, l / 2], [$ * 0.85, r, l / 2 + 0.06]]), A(`strut-${b}`, [[$ * 0.85, r + 0.08, l / 2 + 0.04], [$ * 0.8, 0.13, l / 2 + 0.22]]), A(`armrest-${b}`, [[$, t + 0.22, -l / 2 + 0.02], [$, t + 0.22, l / 2 - 0.08]], i * 1.3), f.push({
7051
- id: `wheel-${b}`,
7050
+ A(`post-${y}`, [[$, t - 0.1, -l / 2], [$, c + 0.04, -l / 2], [$, c + 0.04, -l / 2 - 0.14]]), A(`rail-${y}`, [[$, t - 0.03, -l / 2], [$, t - 0.03, l / 2]]), A(`leg-${y}`, [[$, t - 0.03, l / 2], [$ * 0.85, r, l / 2 + 0.06]]), A(`strut-${y}`, [[$ * 0.85, r + 0.08, l / 2 + 0.04], [$ * 0.8, 0.13, l / 2 + 0.22]]), A(`armrest-${y}`, [[$, t + 0.22, -l / 2 + 0.02], [$, t + 0.22, l / 2 - 0.08]], i * 1.3), f.push({
7051
+ id: `wheel-${y}`,
7052
7052
  shape: { type: "cylinder", radius: o, length: 0.04, axis: "x", segments: 20, spokes: 8 },
7053
7053
  at: [$ + g * 0.03, o, h],
7054
7054
  ink: a.tyre,
7055
7055
  outline: 1.3
7056
- }), f.push({ id: `rim-${b}`, shape: { type: "cylinder", radius: o * 0.9, length: 0.012, axis: "x", segments: 20 }, at: [g * 0.045, 0, 0], parent: `wheel-${b}`, ink: a.frame, outline: 0.8 }), f.push({
7057
- id: `castor-${b}`,
7056
+ }), f.push({ id: `rim-${y}`, shape: { type: "cylinder", radius: o * 0.9, length: 0.012, axis: "x", segments: 20 }, at: [g * 0.045, 0, 0], parent: `wheel-${y}`, ink: a.frame, outline: 0.8 }), f.push({
7057
+ id: `castor-${y}`,
7058
7058
  shape: { type: "cylinder", radius: r, length: 0.03, axis: "x", segments: 12, spokes: 3 },
7059
7059
  at: [$ * 0.85, r, l / 2 + 0.06],
7060
7060
  fill: a.tyre
@@ -7469,7 +7469,7 @@ function J0(e, n) {
7469
7469
  const Oe = Array.from({ length: 7 }, (e, n) => n === 0 ? "tail" : `tail-${n}`);
7470
7470
  function Z0(e, n, t) {
7471
7471
  const o = Fa(e.tail.points, Oe.length + 1), [, r, a] = e.body.radii, s = (e.tail.at[1] - t) / r, i = Math.abs(s) < 1 ? -a * Math.sqrt(1 - s * s) : e.tail.at[2], l = [e.tail.at[0], e.tail.at[1], i + Math.min(0.04, a * 0.08)], c = (u) => e.tail.radius * (1 - 0.5 * u / Oe.length), h = Oe.map((u, p) => {
7472
- const g = o[p], b = o[p + 1], $ = [b[0] - g[0], b[1] - g[1], b[2] - g[2]], A = p === 0 ? void 0 : o[p - 1];
7472
+ const g = o[p], y = o[p + 1], $ = [y[0] - g[0], y[1] - g[1], y[2] - g[2]], A = p === 0 ? void 0 : o[p - 1];
7473
7473
  return {
7474
7474
  id: u,
7475
7475
  ...p > 0 ? { parent: Oe[p - 1] } : {},
@@ -7558,8 +7558,8 @@ function td(e, n) {
7558
7558
  i.facing() !== h && (d = i.turnTo(d, h > 0 ? "right" : "left"));
7559
7559
  const f = i.exaggeration;
7560
7560
  i.key(d + 180, { neck: -12 * f }, { act: !1, easing: "ease-out" });
7561
- const p = Math.abs(l.to - i.x) / i.scale / Vo(n.legLength, s), g = l.for ?? Math.max(500, p * jn[s].cycle * t), b = i.values.walk ?? 0;
7562
- return i.set("gait", d, i.values.gait ?? 0), i.set("gait", d + 1, Gt.indexOf(s)), i.set("walking", d, 0), i.set("walking", d + 240, 1, "ease-out"), i.set("walking", d + g - 240, 1), i.set("walking", d + g, 0, "ease-in"), i.set("walk", d, b), i.move(d, d + g, l.to, { easing: "ease-in-out" }), i.set("walk", d + g, b + p, "ease-in-out"), i.key(d + g + 300, { neck: 0 }), (s === "gallop" || s === "canter") && (i.effect({ kind: "dust", time: d + 200, x: i.x - h * n.legLength * i.scale, y: i.floor, length: 700, direction: -h }), i.effect({ kind: "dust", time: d + g, x: l.to + h * n.legLength * 0.6 * i.scale, y: i.floor, length: 600, direction: h })), { end: d + g + 300, contact: d, release: d + g };
7561
+ const p = Math.abs(l.to - i.x) / i.scale / Vo(n.legLength, s), g = l.for ?? Math.max(500, p * jn[s].cycle * t), y = i.values.walk ?? 0;
7562
+ return i.set("gait", d, i.values.gait ?? 0), i.set("gait", d + 1, Gt.indexOf(s)), i.set("walking", d, 0), i.set("walking", d + 240, 1, "ease-out"), i.set("walking", d + g - 240, 1), i.set("walking", d + g, 0, "ease-in"), i.set("walk", d, y), i.move(d, d + g, l.to, { easing: "ease-in-out" }), i.set("walk", d + g, y + p, "ease-in-out"), i.key(d + g + 300, { neck: 0 }), (s === "gallop" || s === "canter") && (i.effect({ kind: "dust", time: d + 200, x: i.x - h * n.legLength * i.scale, y: i.floor, length: 700, direction: -h }), i.effect({ kind: "dust", time: d + g, x: l.to + h * n.legLength * 0.6 * i.scale, y: i.floor, length: 600, direction: h })), { end: d + g + 300, contact: d, release: d + g };
7563
7563
  }
7564
7564
  }), r = Object.fromEntries(e.gaits.map((s) => [s === "gallop" && !e.gaits.includes("canter") ? "run" : s, o(s)]));
7565
7565
  e.gaits.includes("gallop") && !r.gallop && (r.gallop = o("gallop"));
@@ -8171,7 +8171,7 @@ function md(e = {}) {
8171
8171
  neckReach: 0.04
8172
8172
  });
8173
8173
  }
8174
- function bd(e = {}) {
8174
+ function yd(e = {}) {
8175
8175
  return lt({
8176
8176
  kind: "owl",
8177
8177
  summary: "An owl: a big round head, slow silent wingbeats; hoots, turns its head, flies and lands on a branch.",
@@ -8187,7 +8187,7 @@ function bd(e = {}) {
8187
8187
  stoop: 6
8188
8188
  });
8189
8189
  }
8190
- function yd(e = {}) {
8190
+ function bd(e = {}) {
8191
8191
  return lt({
8192
8192
  kind: "parrot",
8193
8193
  summary: "A parrot: bright, with a big hooked beak and a long tail; squawks, bobs, flies and lands on a perch, gripping it.",
@@ -8203,7 +8203,7 @@ function yd(e = {}) {
8203
8203
  stoop: 10
8204
8204
  });
8205
8205
  }
8206
- const Dt = { car: w0, truck: k0, bus: v0, tractor: S0, cart: M0, trainCar: $0, bike: E0, motorbike: T0, tree: A0, house: I0, chair: C0, desk: N0, bed: z0, door: W0, wheelchair: L0, helicopter: G0, airplane: U0, horse: nd, dog: od, cat: sd, cow: ad, goat: rd, rabbit: id, squirrel: ld, songbird: fd, crow: ud, chicken: gd, pigeon: pd, duck: md, owl: bd, parrot: yd };
8206
+ const Dt = { car: w0, truck: k0, bus: v0, tractor: S0, cart: M0, trainCar: $0, bike: E0, motorbike: T0, tree: A0, house: I0, chair: C0, desk: N0, bed: z0, door: K0, wheelchair: L0, helicopter: G0, airplane: U0, horse: nd, dog: od, cat: sd, cow: ad, goat: rd, rabbit: id, squirrel: ld, songbird: fd, crow: ud, chicken: gd, pigeon: pd, duck: md, owl: yd, parrot: bd };
8207
8207
  function Er(e, n = {}) {
8208
8208
  const t = Dt[e];
8209
8209
  if (!t) throw new Error(ce("prop preset", e, Object.keys(Dt)));
@@ -8267,15 +8267,15 @@ function vd(e, n, t, o = {}) {
8267
8267
  ${r.map((S) => ` beat ${S.beat}: ${S.message}`).join(`
8268
8268
  `)}`);
8269
8269
  const a = o.from ?? 0, s = o.ground ?? 0, i = o.scale ?? 60, l = o.exaggeration ?? 1, c = Jo(n), h = {};
8270
- for (const S of [...Object.keys(Bt), ...Object.keys(n.rig.controls)]) h[S] = o.start?.[S] ?? ye(n.rig, {}, S);
8270
+ for (const S of [...Object.keys(Bt), ...Object.keys(n.rig.controls)]) h[S] = o.start?.[S] ?? be(n.rig, {}, S);
8271
8271
  const d = [{ time: 0, pose: { ...h } }], f = /* @__PURE__ */ new Map(), u = [];
8272
8272
  let p = a, g = s;
8273
- const b = (S, w, T, I) => {
8273
+ const y = (S, w, T, I) => {
8274
8274
  const C = f.get(S) ?? [{ time: 0, value: S === "x" || S === "y" ? 0 : h[S] }];
8275
8275
  C.push({ time: w, value: T, ...I ? { easing: I } : {} }), f.set(S, C), S !== "x" && S !== "y" && (h[S] = T);
8276
8276
  }, $ = (S, w) => {
8277
8277
  const T = S === "x" ? p - a : S === "y" ? g - s : h[S], I = f.get(S);
8278
- (!I || I[I.length - 1].time < w) && b(S, w, T);
8278
+ (!I || I[I.length - 1].time < w) && y(S, w, T);
8279
8279
  }, A = {
8280
8280
  prop: n,
8281
8281
  scale: i,
@@ -8295,16 +8295,16 @@ ${r.map((S) => ` beat ${S.beat}: ${S.message}`).join(`
8295
8295
  Object.assign(h, w), d.push({ time: S, pose: { ...h }, ...T.act === !1 ? { act: !1 } : {}, ...T.easing ? { easing: T.easing } : {} });
8296
8296
  },
8297
8297
  move(S, w, T, I = {}) {
8298
- $("x", S), b("x", w, T - a, I.easing), p = T, I.floor !== void 0 && ($("y", S), b("y", w, I.floor - s, I.easing), g = I.floor);
8298
+ $("x", S), y("x", w, T - a, I.easing), p = T, I.floor !== void 0 && ($("y", S), y("y", w, I.floor - s, I.easing), g = I.floor);
8299
8299
  },
8300
8300
  set(S, w, T, I) {
8301
- b(S, w, T, I);
8301
+ y(S, w, T, I);
8302
8302
  },
8303
8303
  turnTo(S, w) {
8304
8304
  const T = typeof w == "number" ? w : $o[w], I = h.turn, j = [T - 4, T, T + 4].map((G) => ({ t: G, d: Math.abs(G - I) })).sort((G, Y) => G.d - Y.d || Math.abs(G.t) - Math.abs(Y.t))[0];
8305
8305
  if (j.d < 1e-3) return S;
8306
- const K = S + wd * Math.max(1, j.d);
8307
- return A.key(K, { turn: j.t }), K;
8306
+ const W = S + wd * Math.max(1, j.d);
8307
+ return A.key(W, { turn: j.t }), W;
8308
8308
  },
8309
8309
  effect(S) {
8310
8310
  u.push(S);
@@ -8320,21 +8320,21 @@ ${r.map((S) => ` beat ${S.beat}: ${S.message}`).join(`
8320
8320
  const w = Math.max(S.at ?? m, d[d.length - 1].time), T = c[S.do].run(A, S, w);
8321
8321
  T.end > d[d.length - 1].time && d.push({ time: T.end, pose: { ...h } }), k.push({ start: w, end: T.end, ...T.contact !== void 0 ? { contact: T.contact } : {}, ...T.release !== void 0 ? { release: T.release } : {} }), m = T.end;
8322
8322
  }
8323
- const P = er(o.style ?? "snappy"), O = { ...P, anticipation: P.anticipation * l, overshoot: P.overshoot * l }, v = Fo(Ed(d), n.acting, { style: O }), y = [
8323
+ const P = er(o.style ?? "snappy"), O = { ...P, anticipation: P.anticipation * l, overshoot: P.overshoot * l }, v = Fo(Ed(d), n.acting, { style: O }), b = [
8324
8324
  // Controls keyed exactly (wheels, rotors) are not acted.
8325
8325
  ...Object.entries(v).filter(([S]) => !f.has(S)).map(([S, w]) => ({ id: `${e}-${S}`, target: e, property: S, keyframes: w })),
8326
8326
  ...[...f].map(([S, w]) => ({ id: `${e}-${S}`, target: e, property: S, keyframes: Td(w) }))
8327
8327
  ];
8328
- for (const S of Md(e, n, y, m, d[0].pose)) {
8329
- const w = y.findIndex((C) => C.property === S.property);
8328
+ for (const S of Md(e, n, b, m, d[0].pose)) {
8329
+ const w = b.findIndex((C) => C.property === S.property);
8330
8330
  if (w < 0) {
8331
- y.push(S);
8331
+ b.push(S);
8332
8332
  continue;
8333
8333
  }
8334
- const T = new ve({ id: `${e}-own`, tracks: [y[w]] }), I = (C) => Number(T.getStateAtTime(C).values.get(e)?.get(S.property) ?? 0);
8335
- y[w] = { ...S, keyframes: S.keyframes.map((C) => ({ time: C.time, value: Number(C.value) + I(C.time) })) };
8334
+ const T = new ve({ id: `${e}-own`, tracks: [b[w]] }), I = (C) => Number(T.getStateAtTime(C).values.get(e)?.get(S.property) ?? 0);
8335
+ b[w] = { ...S, keyframes: S.keyframes.map((C) => ({ time: C.time, value: Number(C.value) + I(C.time) })) };
8336
8336
  }
8337
- return { tracks: y, duration: m, beats: k, effects: u };
8337
+ return { tracks: b, duration: m, beats: k, effects: u };
8338
8338
  }
8339
8339
  const Sd = 1500;
8340
8340
  function Md(e, n, t, o, r) {
@@ -8382,7 +8382,7 @@ function Pd(e, n = {}) {
8382
8382
  const t = {};
8383
8383
  for (const o of Object.keys(De)) t[o] = { summary: `Walks to \`to\` in the ${o} gait.`, needs: ["to"] };
8384
8384
  for (const o of Object.keys(He)) t[o] = { summary: `Moves into the ${o} pose and holds it (\`for\` ms).` };
8385
- for (const o of Object.keys(ot)) t[o] = { summary: `The ${o} gag (${yn(o)} ms).` };
8385
+ for (const o of Object.keys(ot)) t[o] = { summary: `The ${o} gag (${bn(o)} ms).` };
8386
8386
  for (const [o, r] of Object.entries(Pn)) t[o] = { ...r };
8387
8387
  return {
8388
8388
  sports: { cricket: { actions: { ...oi }, formats: { ...ni }, casts: { ...ti }, fieldingPositions: { ...ei }, markingProfiles: { ...Qr }, cameras: { ...Zr }, decisionCameras: Jr, playComponents: Vr, playExamples: Xr } },
@@ -8412,9 +8412,9 @@ function Pd(e, n = {}) {
8412
8412
  handFields: Gr,
8413
8413
  poses: Object.keys(He),
8414
8414
  expressions: Object.keys(Ae),
8415
- gags: Object.fromEntries(Object.keys(ot).map((o) => [o, yn(o)])),
8415
+ gags: Object.fromEntries(Object.keys(ot).map((o) => [o, bn(o)])),
8416
8416
  gaits: Object.keys(De),
8417
- actingStyles: Object.keys(yt),
8417
+ actingStyles: Object.keys(bt),
8418
8418
  beatFields: mo,
8419
8419
  actions: t,
8420
8420
  dances: Object.fromEntries(Object.entries(at).map(([o, r]) => [o, Object.keys(r.moves)])),
@@ -8484,7 +8484,7 @@ function Pd(e, n = {}) {
8484
8484
  "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.",
8485
8485
  "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.",
8486
8486
  "outfitPreset(category, overrides?)": "Fresh JSON Everyday / Formal / Casual wardrobe defaults for every actor; top: tshirt | shirt | blouse | dress, trouserStyle: plain | jeans | cargo, colours, sleeves, bottoms, collar and tie are editable.",
8487
- "figure: 'bean'": "The white outlined stick figure: one smooth stroked outline per limb (no seams at elbows, knees or the front arm's shoulder), a shaped body (rounded shoulders, slight waist, fuller hips), big oval eyes, mittens and cartoon shoes; every pose, gait, dance and turn works. Always drawn clean; the near arm is in front of the body in both limb modes. `bean: { limbs: tube | line, halo (a pale edge on line limbs), torso, limbWidth, lineWidth, outlineWidth, fill, shirt, sleeves: short | long | none, trousers, shoes (a dark shoe gets a shine), coat (a trench coat: lapels, belt and buckle, buttons, knee hem, sleeves to the wrist), fedora, shades (aviators in place of the eyes; brows still show) }`; an `outfit`'s shirt, trousers and sleeves colour it. `castMember('beanMan' | 'beanWoman' | 'beanKid' | 'beanBoss' | 'beanDetective' | 'beanStick', h)`.",
8487
+ "figure: 'bean'": "The white outlined stick figure: one smooth stroked outline per limb (no seams at elbows, knees or the front arm's shoulder), a shaped body (rounded shoulders, slight waist, fuller hips), big oval eyes, mittens and cartoon shoes; every pose, gait, dance and turn works. Always drawn clean; the near arm is in front of the body in both limb modes. `bean: { limbs: tube | line, halo (a pale edge on line limbs), torso, limbWidth, lineWidth, outlineWidth, fill, shirt, sleeves: short | long | none, trousers, shoes (a dark shoe gets a shine), tie (a necktie down the chest), coat (a trench coat: lapels, belt and buckle, buttons, knee hem, sleeves to the wrist), fedora, shades (aviators in place of the eyes; brows still show) }`; an `outfit`'s shirt, trousers, sleeves and tie colour it. `castMember('beanMan' | 'beanWoman' | 'beanKid' | 'beanBoss' | 'beanDetective' | 'beanStick', h)`.",
8488
8488
  hands: "`dot` | `cartoon` (with `handStyle: glove | natural`) | `mitten` (a plain oval mitten; the bean figure's default)",
8489
8489
  leafOutfit: "Organic-only JSON garment { top?, color?, accent?, length? }; curved leaves follow torso/thighs at native part depths. Everyday basicOutfit also follows organic contours."
8490
8490
  },
@@ -8496,16 +8496,16 @@ function Pd(e, n = {}) {
8496
8496
  gags: Object.keys(ka),
8497
8497
  builds: Object.keys(hi),
8498
8498
  hair: Object.keys(li),
8499
- hairColors: { ...Ke },
8499
+ hairColors: { ...We },
8500
8500
  facialHair: Object.keys(ii),
8501
8501
  glasses: Object.keys(ri),
8502
8502
  hats: Object.keys(ai),
8503
8503
  feet: [...qr],
8504
8504
  cast: Object.keys(Qa),
8505
8505
  heldItems: Object.fromEntries(Object.entries(si).map(([o, r]) => [o, r.hands])),
8506
- handMeetings: Object.keys(bn)
8506
+ handMeetings: Object.keys(yn)
8507
8507
  },
8508
- noir: Wc,
8508
+ noir: Kc,
8509
8509
  cosmic: Uc,
8510
8510
  codePanel: {
8511
8511
  languages: uo,
@@ -8605,7 +8605,8 @@ function Pd(e, n = {}) {
8605
8605
  "tinyfly check <beats.json>": "check a beat script (names, fields) with suggestions",
8606
8606
  "tinyfly validate <timeline.json> [--markup file]": "check a timeline against its markup",
8607
8607
  "tinyfly render <timeline.json> <markup> [--at …]": "a frame as static markup",
8608
- "tinyfly video <scene.mjs> [--stills dir --times …]": "MP4, or PNG stills to look at"
8608
+ "tinyfly video <scene.mjs> [--stills dir --times …]": "MP4, or PNG stills to look at",
8609
+ "tinyfly present <deck.html> [-o out.html]": "a presentation as one offline HTML file"
8609
8610
  }
8610
8611
  };
8611
8612
  }
@@ -8707,7 +8708,7 @@ function Nu(e, n = {}) {
8707
8708
  "",
8708
8709
  `Prop beat fields: ${ue(t.props.beatFields)}. Every prop has the controls ${Object.keys(t.props.commonControls).map((a) => `\`${a}\``).join(", ")} and the actions ${Object.keys(t.props.commonActions).map((a) => `\`${a}\``).join(", ")}.`,
8709
8710
  "",
8710
- "Scenery: `scenery({ x, y, width, height, kind: sky | room, hour, clouds, wind, rain, snow, horizon: hills | city | flat })` is a canvas target whose values `hour` (0–24), `clouds`, `rain`, `snow` (0–1) and `wind` (−1..1) are tracks (`set(prop, { at, value, duration })`, `tracks(id)`; `anchor('sun' | 'moon' | 'horizon' | 'ground', time)`); the same `wind` streams hair (`hairFollowTracks(…, { wind })`). `scenePreset('park' | 'street' | 'office' | 'home', { width, height })` lays out scenery and props as data; `buildScene` builds them into targets.",
8711
+ "Scenery: `scenery({ x, y, width, height, kind: sky | room, hour, clouds, wind, rain, snow, horizon: hills | city | flat })` is a canvas target whose values `hour` (0–24), `clouds`, `rain`, `snow` (0–1) and `wind` (−1..1) are tracks (`set(prop, { at, value, duration })`, `tracks(id)`; `anchor('sun' | 'moon' | 'horizon' | 'ground', time)`); the same `wind` streams hair (`hairFollowTracks(…, { wind })`). `scenePreset('park' | 'street' | 'office' | 'home', { width, height })` lays out scenery and props as data; `buildScene` builds them into targets (`ink` and `lineWidth` outline its props to match the characters).",
8711
8712
  "",
8712
8713
  "| Preset | Family | Actions (needs) | Controls | Anchors |",
8713
8714
  "|---|---|---|---|---|",
@@ -8733,7 +8734,7 @@ function Nu(e, n = {}) {
8733
8734
  "- `outfit`: `{ top: tshirt | shirt | blouse | dress, trouserStyle: plain | jeans | cargo, shirt: top colour, trousers: bottom colour, sleeves: short | long | none, bottom: trousers | shorts | skirt, collar, tie: colour, over: apron | labCoat | hoodie | cardigan | overalls | sari, overColor, shoes: boots, shoeColor }`",
8734
8735
  `- \`castMember(name, height)\`: ${ue(t.character.cast)}`,
8735
8736
  "- Face marks (pose fields, 0–1): `blush`, `tears`, `sweat`; close-up fields `pupil` (size, 1 usual), `lid` (upper lids lowered, 0–1), `bulge` (eyes out of the head, 0–1); `face: { nose: true, inPupil(ctx, pupil) }`; `drawCharacterHead(ctx, who, pose, { x, y, radius })` draws just the head big",
8736
- `- Face styles: ${ue(t.character.faceStyles)}; \`face: { style: 'anime', iris: '#4b7fce', lashes: true, ageLines: 0.8 }\` uses coloured eyes and the same expressions, blinks and gaze. \`ANIME_CAST\` contains eight age presets, also available through \`castMember\`. \`face: { style: 'oval' }\` (the bean figure's default) draws big white oval eyes with small pupils that follow \`lookX\`/\`lookY\`, lids for \`lid\`, \`blink\` and half-open eyes, and heavy brows for \`brow.*\`/\`browTilt\`; glasses grow to fit round them.`,
8737
+ `- Face styles: ${ue(t.character.faceStyles)}; \`face: { style: 'anime', iris: '#4b7fce', lashes: true, ageLines: 0.8 }\` uses coloured eyes and the same expressions, blinks and gaze. \`ANIME_CAST\` contains eight age presets, also available through \`castMember\`. \`face: { style: 'oval' }\` (the bean figure's default) draws big white oval eyes with small pupils that follow \`lookX\`/\`lookY\`, lids for \`lid\`, \`blink\` and half-open eyes, and heavy brows for \`brow.*\`/\`browTilt\`; glasses grow to fit round them. \`eyeScale\` (0.5–1.2) and \`eyeAspect\` (0.45–1.2, below 1 rounder) size oval eyes too, for big googly comedy eyes.`,
8737
8738
  `- Face shapes: ${ue(t.character.faceShapes)}; \`face: { shape: 'angular', jawWidth: 0.74, chinWidth: 0.14, eyeScale: 0.8, eyeAspect: 0.65 }\` sets a tapered 3D jaw and narrower anime eyes; \`jawRoundness: 1\` softens the cheek/chin corners (default 0 keeps sharp jaws). \`MANGA_CAST\` contains four original young adult presets; hair styles \`mangaSpikes\` and \`mangaSweep\` remain editable.`,
8738
8739
  "- Hair in motion (pose fields): `hair.swing` (degrees round the head, + toward its left), `hair.trail` (head radii back), `hair.lift` (head radii up); key them with `hairFollowTracks(target, tracks, who)` after the character's tracks, or `hairFollow` + `hairMotionAt` when posing per frame",
8739
8740
  `- \`holding\`: ${Object.entries(t.character.heldItems).map(([a, s]) => `\`${a}\` (${s === "both" ? "both" : s === "either" ? "one hand or both" : "left or right"})`).join(", ")}; pose fields \`held.left\`, \`held.right\`, \`held.both\` (below 0.5 lets go); \`handGrip(joints, side)\``,
@@ -8859,8 +8860,8 @@ function Id(e, n, t, o, r, a, s) {
8859
8860
  const i = n.direction ?? 1, l = n.toY ?? n.y + o * 3;
8860
8861
  e.save(), e.lineWidth = Math.max(1, o * 0.02), e.strokeStyle = a, e.fillStyle = r;
8861
8862
  for (let c = 0; c < 4; c++) {
8862
- const h = Xe(`${s}:${c}`) % 1e3 / 1e3, d = Math.min(1, t * (1.1 + h * 0.4)), f = n.x + (h - 0.5) * o * 1.2, u = n.y + (h - 0.3) * o * 0.4, p = d * d * 0.4 + d * 0.6, g = f + i * d * o * (0.6 + h) + Math.sin(d * 9 + h * 6) * o * 0.18, b = Math.min(l - 2, u + (l - u) * p);
8863
- e.globalAlpha = t > 0.85 ? (1 - t) / 0.15 : 1, e.save(), e.translate(g, b), e.rotate(Math.sin(d * 7 + h * 5) * 1.2), e.beginPath(), e.ellipse(0, 0, o * 0.07, o * 0.035, 0, 0, Math.PI * 2), e.fill(), e.stroke(), e.restore();
8863
+ const h = Xe(`${s}:${c}`) % 1e3 / 1e3, d = Math.min(1, t * (1.1 + h * 0.4)), f = n.x + (h - 0.5) * o * 1.2, u = n.y + (h - 0.3) * o * 0.4, p = d * d * 0.4 + d * 0.6, g = f + i * d * o * (0.6 + h) + Math.sin(d * 9 + h * 6) * o * 0.18, y = Math.min(l - 2, u + (l - u) * p);
8864
+ e.globalAlpha = t > 0.85 ? (1 - t) / 0.15 : 1, e.save(), e.translate(g, y), e.rotate(Math.sin(d * 7 + h * 5) * 1.2), e.beginPath(), e.ellipse(0, 0, o * 0.07, o * 0.035, 0, 0, Math.PI * 2), e.fill(), e.stroke(), e.restore();
8864
8865
  }
8865
8866
  e.restore();
8866
8867
  }
@@ -8915,7 +8916,7 @@ function _d(e) {
8915
8916
  }
8916
8917
  return n;
8917
8918
  }
8918
- function Ku(e, n, t) {
8919
+ function Wu(e, n, t) {
8919
8920
  const o = (s) => `${s.target}\0${s.property}`, r = new Map(n.map((s) => [o(s), s]));
8920
8921
  return [...e.map((s) => {
8921
8922
  const i = r.get(o(s));
@@ -8925,18 +8926,18 @@ function Ku(e, n, t) {
8925
8926
  return { ...s, keyframes: c };
8926
8927
  }), ...r.values()];
8927
8928
  }
8928
- function Wu(e) {
8929
+ function Ku(e) {
8929
8930
  const n = new ve({ id: `${e.leaderId}-tow`, tracks: e.leaderTracks.filter((u) => u.target === e.leaderId) }), t = e.every ?? 33, o = e.towed, r = o.x + o.width / 2, a = o.props, s = o.prop.wheelRadius, i = [], l = [], c = [];
8930
8931
  let h = a.wheelSpin ?? 0, d;
8931
8932
  for (let u = e.start; ; u = Math.min(e.end, u + t)) {
8932
- const p = Xo(e.leader, { state: n.getStateAtTime(u) }, e.leaderId), g = p.anchor(e.hitch), b = p.values.turn, $ = qt(o.prop, { ...a, turn: b }, o.propScale).anchors[e.anchor];
8933
+ const p = Xo(e.leader, { state: n.getStateAtTime(u) }, e.leaderId), g = p.anchor(e.hitch), y = p.values.turn, $ = qt(o.prop, { ...a, turn: y }, o.propScale).anchors[e.anchor];
8933
8934
  if (!$) throw new Error(`propTow: ${o.prop.kind} has no anchor "${e.anchor}"`);
8934
8935
  const A = g.x - $.point.x;
8935
8936
  if (d !== void 0 && s) {
8936
- const k = Math.sin(b * Math.PI / 2);
8937
+ const k = Math.sin(y * Math.PI / 2);
8937
8938
  h += (A - d) * (k || 1) / o.propScale / s * (180 / Math.PI);
8938
8939
  }
8939
- if (d = A, i.push({ time: u, value: A - r }), l.push({ time: u, value: b }), c.push({ time: u, value: h }), u >= e.end) break;
8940
+ if (d = A, i.push({ time: u, value: A - r }), l.push({ time: u, value: y }), c.push({ time: u, value: h }), u >= e.end) break;
8940
8941
  }
8941
8942
  const f = e.towedId;
8942
8943
  return [
@@ -8954,11 +8955,11 @@ function xd(e, n) {
8954
8955
  if (r) return r;
8955
8956
  const a = kn(e), s = { vertices: a.vertices, faces: a.faces.filter((f, u) => !n?.[u]) }, i = s.vertices.flatMap((f) => [f[0], f[1], f[2]]), l = s.vertices.map(() => [0, 0, 0]), c = [];
8956
8957
  s.faces.forEach((f) => {
8957
- for (const g of f.corners) for (const b of [0, 1, 2]) l[g][b] += f.normal[b];
8958
+ for (const g of f.corners) for (const y of [0, 1, 2]) l[g][y] += f.normal[y];
8958
8959
  const [u, ...p] = f.corners;
8959
8960
  for (let g = 0; g + 1 < p.length; g++) {
8960
- const [b, $, A] = [u, p[g], p[g + 1]], [k, m, P] = [s.vertices[b], s.vertices[$], s.vertices[A]], O = [m[0] - k[0], m[1] - k[1], m[2] - k[2]], v = [P[0] - k[0], P[1] - k[1], P[2] - k[2]], y = [O[1] * v[2] - O[2] * v[1], O[2] * v[0] - O[0] * v[2], O[0] * v[1] - O[1] * v[0]], S = y[0] * f.normal[0] + y[1] * f.normal[1] + y[2] * f.normal[2];
8961
- c.push(...S >= 0 ? [b, $, A] : [b, A, $]);
8961
+ const [y, $, A] = [u, p[g], p[g + 1]], [k, m, P] = [s.vertices[y], s.vertices[$], s.vertices[A]], O = [m[0] - k[0], m[1] - k[1], m[2] - k[2]], v = [P[0] - k[0], P[1] - k[1], P[2] - k[2]], b = [O[1] * v[2] - O[2] * v[1], O[2] * v[0] - O[0] * v[2], O[0] * v[1] - O[1] * v[0]], S = b[0] * f.normal[0] + b[1] * f.normal[1] + b[2] * f.normal[2];
8962
+ c.push(...S >= 0 ? [y, $, A] : [y, A, $]);
8962
8963
  }
8963
8964
  });
8964
8965
  const h = l.flatMap((f) => {
@@ -8985,15 +8986,15 @@ function Rd(e, n) {
8985
8986
  return t ? `#${[0, 2, 4].map((r) => Math.round(parseInt(t[1].slice(r, r + 2), 16) * Math.max(0, Math.min(1, n)))).map((r) => r.toString(16).padStart(2, "0")).join("")}` : e;
8986
8987
  }
8987
8988
  const zd = cn(Ea(1, 2e-3, 28));
8988
- function Kd(e, n, t) {
8989
- const o = e.rig, [r, a] = o.footprint ?? [o.length * 0.45, o.length], s = Math.max(0, ye(o, n, "lift")), i = Math.max(0, ye(o, n, "size")) / (1 + s * 0.8);
8989
+ function Wd(e, n, t) {
8990
+ const o = e.rig, [r, a] = o.footprint ?? [o.length * 0.45, o.length], s = Math.max(0, be(o, n, "lift")), i = Math.max(0, be(o, n, "size")) / (1 + s * 0.8);
8990
8991
  return {
8991
8992
  mesh: zd,
8992
8993
  world: oe.multiply(t, oe.compose([0, 4e-3, 0], [0, 0, 0, 1], [r * 0.55 * i || 1e-4, 1, a * 0.55 * i || 1e-4])),
8993
8994
  material: { color: "#000000", shading: "unlit", opacity: 0.16 * i }
8994
8995
  };
8995
8996
  }
8996
- const Wd = /* @__PURE__ */ new Set([
8997
+ const Kd = /* @__PURE__ */ new Set([
8997
8998
  "x",
8998
8999
  "y",
8999
9000
  "z",
@@ -9024,8 +9025,8 @@ const Wd = /* @__PURE__ */ new Set([
9024
9025
  // `lights` may be missing from a scene entry older than this add-on: treated as none.
9025
9026
  resolve({ object: e, prepared: n, values: t, world: o, camera: r, lights: a = [], fog: s, toScreen: i }) {
9026
9027
  const l = e, c = n, h = { ...l.values };
9027
- for (const [v, y] of t)
9028
- typeof y == "number" && !Wd.has(v) && (h[v] = y);
9028
+ for (const [v, b] of t)
9029
+ typeof b == "number" && !Kd.has(v) && (h[v] = b);
9029
9030
  h.turn = 0, h.tilt = 0;
9030
9031
  const d = oe.multiply(r.view, o), f = {
9031
9032
  toView: (v) => oe.transformPoint(d, v),
@@ -9033,24 +9034,24 @@ const Wd = /* @__PURE__ */ new Set([
9033
9034
  }, u = f.toView([0, c.rig.height / 2, 0]);
9034
9035
  if (-u[2] <= r.near) return null;
9035
9036
  if (l.look === "mesh") {
9036
- const v = l0(c.rig, h), y = v.map(({ part: T, local: I }) => ({ part: T.id, mesh: kn(T.shape), ...Yo(kn(T.shape), I) })), S = gr(y), w = v.map((T, I) => ({ ...T, hidden: pr(T.part.id, y[I].mesh, T.local, y[I].key, S) })).filter(({ opacity: T }) => T > 0.01).map(({ part: T, matrix: I, glow: C, opacity: j, hidden: K }) => ({
9037
- mesh: xd(T.shape, K),
9037
+ const v = l0(c.rig, h), b = v.map(({ part: T, local: I }) => ({ part: T.id, mesh: kn(T.shape), ...Yo(kn(T.shape), I) })), S = gr(b), w = v.map((T, I) => ({ ...T, hidden: pr(T.part.id, b[I].mesh, T.local, b[I].key, S) })).filter(({ opacity: T }) => T > 0.01).map(({ part: T, matrix: I, glow: C, opacity: j, hidden: W }) => ({
9038
+ mesh: xd(T.shape, W),
9038
9039
  world: oe.multiply(o, I),
9039
9040
  material: Nd(T, { glow: C, opacity: j }, { shading: l.shading, ink: l.ink, outline: l.outline })
9040
9041
  }));
9041
- return { meshes: l.shadow === !1 ? w : [Kd(c, h, o), ...w] };
9042
+ return { meshes: l.shadow === !1 ? w : [Wd(c, h, o), ...w] };
9042
9043
  }
9043
- 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), $ = a.length === 0 ? void 0 : (v, y) => {
9044
- const S = oe.transformPoint(o, v), w = [o[0] * y[0] + o[4] * y[1] + o[8] * y[2], o[1] * y[0] + o[5] * y[1] + o[9] * y[2], o[2] * y[0] + o[6] * y[1] + o[10] * y[2]], T = Math.hypot(...w) || 1;
9044
+ const p = i(u), g = i(f.toView([0, c.rig.height / 2 + 1, 0])), y = Math.hypot(g.x - p.x, g.y - p.y), $ = a.length === 0 ? void 0 : (v, b) => {
9045
+ const S = oe.transformPoint(o, v), w = [o[0] * b[0] + o[4] * b[1] + o[8] * b[2], o[1] * b[0] + o[5] * b[1] + o[9] * b[2], o[2] * b[0] + o[6] * b[1] + o[10] * b[2]], T = Math.hypot(...w) || 1;
9045
9046
  return { light: Ta(S, [w[0] / T, w[1] / T, w[2] / T], a), fog: Aa(s, Math.hypot(S[0] - r.position[0], S[1] - r.position[1], S[2] - r.position[2])) };
9046
- }, A = mr(c.rig, h, f, b, { perspective: !0, near: r.near, slice: Fd, light: $ }), k = { look: l.look, style: l.style, ink: l.ink, paper: l.paper, fog: s?.color }, m = xa(A), P = A.cells ?? [], O = Math.max(...P.map((v) => -v.depth), -u[2]);
9047
+ }, A = mr(c.rig, h, f, y, { perspective: !0, near: r.near, slice: Fd, light: $ }), k = { look: l.look, style: l.style, ink: l.ink, paper: l.paper, fog: s?.color }, m = xa(A), P = A.cells ?? [], O = Math.max(...P.map((v) => -v.depth), -u[2]);
9047
9048
  return {
9048
9049
  drawables: [
9049
9050
  ...l.shadow === !1 ? [] : [{ depth: O + c.rig.length, draw: (v) => Na(v, A, k) }],
9050
9051
  ...P.map((v) => ({
9051
9052
  depth: -v.depth,
9052
- draw(y, S) {
9053
- y.lineCap = "round", y.lineJoin = "round", nl(y, v.parts, m, { ...k, time: S.time });
9053
+ draw(b, S) {
9054
+ b.lineCap = "round", b.lineJoin = "round", nl(b, v.parts, m, { ...k, time: S.time });
9054
9055
  }
9055
9056
  }))
9056
9057
  ]
@@ -9082,7 +9083,7 @@ function Du(e, n, t, o) {
9082
9083
  ${r.map((k) => ` beat ${k.beat}: ${k.message}`).join(`
9083
9084
  `)}`);
9084
9085
  const a = {};
9085
- for (const k of [...Object.keys(Bt), ...Object.keys(n.rig.controls)]) a[k] = o.values?.[k] ?? ye(n.rig, {}, k);
9086
+ for (const k of [...Object.keys(Bt), ...Object.keys(n.rig.controls)]) a[k] = o.values?.[k] ?? be(n.rig, {}, k);
9086
9087
  let [s, i] = o.position ?? [0, 0], l = o.heading ?? 0;
9087
9088
  const c = /* @__PURE__ */ new Map(), h = (k, m, P, O = "linear") => {
9088
9089
  const v = c.get(k) ?? [];
@@ -9097,7 +9098,7 @@ ${r.map((k) => ` beat ${k.beat}: ${k.message}`).join(`
9097
9098
  }, u = (k, m, P) => {
9098
9099
  const O = La([[s, i], ...m.through ?? [m.to]]);
9099
9100
  if (O.length < 2) return P;
9100
- const v = f(P, bt(O[0].point, O[1].point)), y = O[O.length - 1].at, S = m.for ?? y / (m.speed ?? k.speed) * 1e3, w = Et("ease-in-out"), T = Math.min(qd, S / 4);
9101
+ const v = f(P, yt(O[0].point, O[1].point)), b = O[O.length - 1].at, S = m.for ?? b / (m.speed ?? k.speed) * 1e3, w = Et("ease-in-out"), T = Math.min(qd, S / 4);
9101
9102
  for (const [Y, ne] of Object.entries(k.set ?? {}))
9102
9103
  d(Y, v, a[Y]), h(Y, v + 1, ne), a[Y] = ne;
9103
9104
  const I = k.flies ? m.height ?? (a.lift > 0.05 ? a.lift : 2) : void 0, C = I !== void 0 && I > 0.05;
@@ -9105,36 +9106,36 @@ ${r.map((k) => ` beat ${k.beat}: ${k.message}`).join(`
9105
9106
  d(Y, v, a[Y]), h(Y, v + T, ne, "ease-out"), C || (h(Y, v + S - T, ne), h(Y, v + S, 0, "ease-in")), a[Y] = C ? ne : 0;
9106
9107
  I !== void 0 && (d("lift", v, a.lift), h("lift", v + Math.min(S * 0.35, 1400), I, "ease-out"), h("lift", v + S, I), a.lift = I);
9107
9108
  const j = { ...a };
9108
- let K = l;
9109
- for (let Y = 0; ; Y = Math.min(y, Y + Dd)) {
9110
- const ne = v + qa(w, Y / y) * S, { point: B, direction: H } = Ba(O, Y);
9111
- K += pn(K, bt([0, 0], H)), h("x", ne, B[0]), h("z", ne, B[1]), h("rotateY", ne, K);
9109
+ let W = l;
9110
+ for (let Y = 0; ; Y = Math.min(b, Y + Dd)) {
9111
+ const ne = v + qa(w, Y / b) * S, { point: B, direction: H } = Ba(O, Y);
9112
+ W += pn(W, yt([0, 0], H)), h("x", ne, B[0]), h("z", ne, B[1]), h("rotateY", ne, W);
9112
9113
  for (const [N, R] of Object.entries(k.perMetre ?? {})) h(N, ne, j[N] + Y * R);
9113
9114
  for (const [N, R] of Object.entries(k.perSecond ?? {})) h(N, ne, j[N] + (ne - v) / 1e3 * R);
9114
- if (Y >= y) break;
9115
+ if (Y >= b) break;
9115
9116
  }
9116
- for (const [Y, ne] of Object.entries(k.perMetre ?? {})) a[Y] = j[Y] + y * ne;
9117
+ for (const [Y, ne] of Object.entries(k.perMetre ?? {})) a[Y] = j[Y] + b * ne;
9117
9118
  for (const [Y, ne] of Object.entries(k.perSecond ?? {})) a[Y] = j[Y] + S / 1e3 * ne;
9118
- return [s, i] = O[O.length - 1].point, l = K, v + S;
9119
+ return [s, i] = O[O.length - 1].point, l = W, v + S;
9119
9120
  }, p = (k, m) => {
9120
9121
  const P = Object.fromEntries(Object.entries(k).filter(([v]) => !["at", "to", "through", "toward"].includes(v))), O = vd(e, n, [P], { start: { ...a, turn: 1 }, scale: 100, style: o.style, exaggeration: o.exaggeration });
9121
9122
  for (const v of O.tracks) {
9122
9123
  if (Xd.includes(v.property)) continue;
9123
- const y = v.keyframes ?? [], S = a[v.property];
9124
- if (!y.every((w) => w.value === S)) {
9124
+ const b = v.keyframes ?? [], S = a[v.property];
9125
+ if (!b.every((w) => w.value === S)) {
9125
9126
  d(v.property, m, S);
9126
- for (const w of y) w.time > 0 && c.get(v.property).push({ ...w, time: m + w.time });
9127
- a[v.property] = y[y.length - 1].value;
9127
+ for (const w of b) w.time > 0 && c.get(v.property).push({ ...w, time: m + w.time });
9128
+ a[v.property] = b[b.length - 1].value;
9128
9129
  }
9129
9130
  }
9130
9131
  return m + O.duration;
9131
9132
  }, g = [];
9132
- let b = 0;
9133
+ let y = 0;
9133
9134
  for (const k of t) {
9134
- const m = k.at ?? b;
9135
+ const m = k.at ?? y;
9135
9136
  let P = m;
9136
9137
  const O = n.moves?.[k.do];
9137
- O ? P = u(O, k, m) : k.do === "face" ? P = f(m, typeof k.toward == "number" ? k.toward : bt([s, i], k.toward)) : k.do === "hold" ? P = m + (k.for ?? 1e3) : P = p(k, m), g.push({ do: k.do, start: m, end: P }), b = P;
9138
+ O ? P = u(O, k, m) : k.do === "face" ? P = f(m, typeof k.toward == "number" ? k.toward : yt([s, i], k.toward)) : k.do === "hold" ? P = m + (k.for ?? 1e3) : P = p(k, m), g.push({ do: k.do, start: m, end: P }), y = P;
9138
9139
  }
9139
9140
  const $ = `${o.scene}/${e}`;
9140
9141
  return { tracks: [...c].map(([k, m]) => ({
@@ -9142,7 +9143,7 @@ ${r.map((k) => ` beat ${k.beat}: ${k.message}`).join(`
9142
9143
  target: $,
9143
9144
  property: k,
9144
9145
  keyframes: Da(m)
9145
- })), duration: b, beats: g, end: { position: [s, i], heading: l, values: { ...a } } };
9146
+ })), duration: y, beats: g, end: { position: [s, i], heading: l, values: { ...a } } };
9146
9147
  }
9147
9148
  const Xd = ["x", "y", "turn", "facing", "tilt"], Vd = 0.35, Ar = {
9148
9149
  seated: Fe.sit,
@@ -9179,26 +9180,26 @@ const ma = (e, n) => {
9179
9180
  return [e[0] * Math.cos(t) + e[2] * Math.sin(t), e[1], -e[0] * Math.sin(t) + e[2] * Math.cos(t)];
9180
9181
  };
9181
9182
  function Bu(e) {
9182
- const n = `${e.scene}/${e.propId}`, t = new ve({ id: `${e.propId}-ride-3d`, tracks: e.propTracks.filter((b) => b.target === n) }), o = e.placement ?? {}, [r, a, s] = o.position ?? [0, 0, 0], i = e.prop.rig, l = Ao({ ...e.character, height: 1 }), c = { ...be, ...e.pose ?? Ar.seated }, h = To(l.plan, c, { height: e.height ?? 1.7, contact: l.contact }).hip, d = e.facing ?? 0, f = e.every ?? 33, u = { x: [], y: [], z: [], rotateY: [] };
9183
- for (let b = e.start; ; b = Math.min(e.end, b + f)) {
9184
- const $ = t.getStateAtTime(b).values.get(n) ?? /* @__PURE__ */ new Map(), A = (j, K) => {
9183
+ const n = `${e.scene}/${e.propId}`, t = new ve({ id: `${e.propId}-ride-3d`, tracks: e.propTracks.filter((y) => y.target === n) }), o = e.placement ?? {}, [r, a, s] = o.position ?? [0, 0, 0], i = e.prop.rig, l = Ao({ ...e.character, height: 1 }), c = { ...ye, ...e.pose ?? Ar.seated }, h = To(l.plan, c, { height: e.height ?? 1.7, contact: l.contact }).hip, d = e.facing ?? 0, f = e.every ?? 33, u = { x: [], y: [], z: [], rotateY: [] };
9184
+ for (let y = e.start; ; y = Math.min(e.end, y + f)) {
9185
+ const $ = t.getStateAtTime(y).values.get(n) ?? /* @__PURE__ */ new Map(), A = (j, W) => {
9185
9186
  const G = $.get(j);
9186
- return typeof G == "number" ? G : K;
9187
+ return typeof G == "number" ? G : W;
9187
9188
  }, k = { ...o.values };
9188
- for (const j of Object.keys(i.controls)) k[j] = A(j, o.values?.[j] ?? ye(i, {}, j));
9189
- for (const j of ["pitch", "roll", "squash", "lift", "lean", "size"]) k[j] = A(j, o.values?.[j] ?? ye(i, {}, j));
9189
+ for (const j of Object.keys(i.controls)) k[j] = A(j, o.values?.[j] ?? be(i, {}, j));
9190
+ for (const j of ["pitch", "roll", "squash", "lift", "lean", "size"]) k[j] = A(j, o.values?.[j] ?? be(i, {}, j));
9190
9191
  const m = h0(i, k)[e.anchor];
9191
9192
  if (!m) throw new Error(`propRide3D: ${e.prop.kind} has no anchor "${e.anchor}" (it has ${Object.keys(i.anchors ?? {}).join(", ") || "none"})`);
9192
- const P = A("rotateY", o.heading ?? 0), O = ma(m, P), v = [A("x", r) + O[0], A("y", a) + O[1], A("z", s) + O[2]], y = P + d, S = ma(h, y);
9193
+ const P = A("rotateY", o.heading ?? 0), O = ma(m, P), v = [A("x", r) + O[0], A("y", a) + O[1], A("z", s) + O[2]], b = P + d, S = ma(h, b);
9193
9194
  let w = [v[0] - S[0], v[1] - S[1], v[2] - S[2]];
9194
- const T = (j, K) => {
9195
- const G = K * K * (3 - 2 * K);
9196
- return [j[0] + (w[0] - j[0]) * G, w[1] * G + Vd * Math.sin(Math.PI * K), j[1] + (w[2] - j[1]) * G];
9195
+ const T = (j, W) => {
9196
+ const G = W * W * (3 - 2 * W);
9197
+ return [j[0] + (w[0] - j[0]) * G, w[1] * G + Vd * Math.sin(Math.PI * W), j[1] + (w[2] - j[1]) * G];
9197
9198
  }, I = e.mount ? Math.max(1, e.mount.for ?? 450) : 0, C = e.dismount ? Math.max(1, e.dismount.for ?? 450) : 0;
9198
- if (e.mount && b < e.start + I ? w = T(e.mount.from, (b - e.start) / I) : e.dismount && b > e.end - C && (w = T(e.dismount.to, (e.end - b) / C)), 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;
9199
+ if (e.mount && y < e.start + I ? w = T(e.mount.from, (y - e.start) / I) : e.dismount && y > e.end - C && (w = T(e.dismount.to, (e.end - y) / C)), u.x.push({ time: y, value: w[0] }), u.y.push({ time: y, value: w[1] }), u.z.push({ time: y, value: w[2] }), u.rotateY.push({ time: y, value: b }), y >= e.end) break;
9199
9200
  }
9200
9201
  const p = e.riderId, g = `${e.scene}/${p}`;
9201
- return Object.keys(u).map((b) => ({ id: `${p}-${b}`, target: g, property: b, keyframes: u[b] }));
9202
+ return Object.keys(u).map((y) => ({ id: `${p}-${y}`, target: g, property: y, keyframes: u[y] }));
9202
9203
  }
9203
9204
  const Zd = {
9204
9205
  ground: "#7fb56a",
@@ -9223,7 +9224,7 @@ const Zd = {
9223
9224
  [18.5, "#4c3f78", "#f08a5a"],
9224
9225
  [20.5, "#17203f", "#2d3660"],
9225
9226
  [24, "#0b1530", "#1b2a4a"]
9226
- ], Kt = (e, n, t) => {
9227
+ ], Wt = (e, n, t) => {
9227
9228
  const o = (s) => [1, 3, 5].map((i) => parseInt(s.slice(i, i + 2), 16)), [r, a] = [o(e), o(n)];
9228
9229
  return `#${r.map((s, i) => Math.round(s + (a[i] - s) * t).toString(16).padStart(2, "0")).join("")}`;
9229
9230
  }, Qd = (e) => {
@@ -9236,7 +9237,7 @@ function ef(e) {
9236
9237
  const [o, r, a] = Ct[t - 1], [s, i, l] = Ct[t];
9237
9238
  if (n <= s) {
9238
9239
  const c = (n - o) / (s - o);
9239
- return { top: Kt(r, i, c), bottom: Kt(a, l, c) };
9240
+ return { top: Wt(r, i, c), bottom: Wt(a, l, c) };
9240
9241
  }
9241
9242
  }
9242
9243
  return { top: Ct[0][1], bottom: Ct[0][2] };
@@ -9246,7 +9247,7 @@ const tf = (e, n) => {
9246
9247
  return t <= 12 ? t / 12 : -1;
9247
9248
  }, nf = 9, of = 55, sf = 28;
9248
9249
  function af(e) {
9249
- const { x: n, y: t, width: o, height: r } = e, a = e.kind ?? "sky", s = e.ground ?? t + r * 0.85, i = { ...Zd, ...e.colors }, l = e.horizon ?? "hills", c = e.window !== !1, h = Tt(e.seed ?? 1), d = o * r / 1e5, f = Array.from({ length: Math.ceil(nf * d) + 2 }, () => ({ u: h.next(), v: h.next(), size: 0.6 + h.next() * 0.8, puffs: 2 + Math.floor(h.next() * 3) })), u = Array.from({ length: Math.ceil(of * d) + 4 }, () => ({ u: h.next(), v: h.next(), speed: 0.8 + h.next() * 0.5 })), p = Array.from({ length: Math.ceil(sf * d) + 4 }, () => ({ u: h.next(), v: h.next(), speed: 0.7 + h.next() * 0.6, sway: h.next() * Math.PI * 2, size: 1.5 + h.next() * 2 })), g = Array.from({ length: Math.ceil(30 * d) + 10 }, () => ({ u: h.next(), v: h.next() * 0.6, size: 0.6 + h.next() * 1.2 })), b = Array.from({ length: 6 }, () => ({ phase: h.next() * Math.PI * 2, amp: 0.5 + h.next() })), $ = Array.from({ length: 24 }, () => ({ h: 0.35 + h.next() * 0.65, w: 0.6 + h.next() * 0.8, windows: h.next() > 0.3 })), A = {
9250
+ const { x: n, y: t, width: o, height: r } = e, a = e.kind ?? "sky", s = e.ground ?? t + r * 0.85, i = { ...Zd, ...e.colors }, l = e.horizon ?? "hills", c = e.window !== !1, h = Tt(e.seed ?? 1), d = o * r / 1e5, f = Array.from({ length: Math.ceil(nf * d) + 2 }, () => ({ u: h.next(), v: h.next(), size: 0.6 + h.next() * 0.8, puffs: 2 + Math.floor(h.next() * 3) })), u = Array.from({ length: Math.ceil(of * d) + 4 }, () => ({ u: h.next(), v: h.next(), speed: 0.8 + h.next() * 0.5 })), p = Array.from({ length: Math.ceil(sf * d) + 4 }, () => ({ u: h.next(), v: h.next(), speed: 0.7 + h.next() * 0.6, sway: h.next() * Math.PI * 2, size: 1.5 + h.next() * 2 })), g = Array.from({ length: Math.ceil(30 * d) + 10 }, () => ({ u: h.next(), v: h.next() * 0.6, size: 0.6 + h.next() * 1.2 })), y = Array.from({ length: 6 }, () => ({ phase: h.next() * Math.PI * 2, amp: 0.5 + h.next() })), $ = Array.from({ length: 24 }, () => ({ h: 0.35 + h.next() * 0.65, w: 0.6 + h.next() * 0.8, windows: h.next() > 0.3 })), A = {
9250
9251
  hour: e.hour ?? 12,
9251
9252
  clouds: e.clouds ?? 0.3,
9252
9253
  wind: e.wind ?? 0,
@@ -9256,36 +9257,36 @@ function af(e) {
9256
9257
  const I = tf(w, T), C = I < 0 ? 0.5 : I, j = s - t;
9257
9258
  return { x: 0.1 * o + 0.8 * o * C, y: I < 0 ? j + r * 0.2 : j - Math.sin(C * Math.PI) * j * 0.8, up: I >= 0 };
9258
9259
  }, O = (w, T, I, C, j) => {
9259
- const K = T("hour"), { top: G, bottom: Y } = ef(K), ne = w.createLinearGradient(0, C.y, 0, C.ground);
9260
+ const W = T("hour"), { top: G, bottom: Y } = ef(W), ne = w.createLinearGradient(0, C.y, 0, C.ground);
9260
9261
  ne.addColorStop(0, G), ne.addColorStop(1, Y), w.fillStyle = ne, w.fillRect(C.x, C.y, C.w, C.ground - C.y);
9261
- const B = Qd(K);
9262
+ const B = Qd(W);
9262
9263
  if (B < 0.6) {
9263
9264
  w.fillStyle = "#ffffff", w.globalAlpha = (0.6 - B) / 0.6 * 0.9;
9264
9265
  for (const F of g)
9265
9266
  w.beginPath(), w.arc(C.x + F.u * C.w, C.y + F.v * (C.ground - C.y), F.size, 0, Math.PI * 2), w.fill();
9266
9267
  w.globalAlpha = 1;
9267
9268
  }
9268
- const H = P(K, 6), N = P(K, 18), R = Math.min(C.w, C.h) * 0.06;
9269
+ const H = P(W, 6), N = P(W, 18), R = Math.min(C.w, C.h) * 0.06;
9269
9270
  if (H.up && (w.fillStyle = i.sun, w.beginPath(), w.arc(C.x + H.x / o * C.w, C.y + H.y / r * C.h, R, 0, Math.PI * 2), w.fill()), N.up) {
9270
9271
  const F = C.x + N.x / o * C.w, Q = C.y + N.y / r * C.h;
9271
9272
  w.fillStyle = i.moon, w.beginPath(), w.arc(F, Q, R * 0.8, 0, Math.PI * 2), w.fill(), w.fillStyle = G, w.beginPath(), w.arc(F - R * 0.35, Q - R * 0.15, R * 0.7, 0, Math.PI * 2), w.fill();
9272
9273
  }
9273
9274
  const M = Math.max(0, Math.min(1, T("clouds"))), _ = Math.max(-1, Math.min(1, T("wind"))), V = Math.round(M * f.length);
9274
- w.fillStyle = Kt("#ffffff", i.cloud === "#ffffff" ? "#ffffff" : i.cloud, 1), w.globalAlpha = 0.55 + 0.4 * B;
9275
+ w.fillStyle = Wt("#ffffff", i.cloud === "#ffffff" ? "#ffffff" : i.cloud, 1), w.globalAlpha = 0.55 + 0.4 * B;
9275
9276
  for (let F = 0; F < V; F++) {
9276
9277
  const Q = f[F], ae = ((Q.u * C.w + _ * I * 0.012 * (0.6 + Q.size * 0.5)) % (C.w * 1.4) + C.w * 1.4) % (C.w * 1.4) - C.w * 0.2, x = C.x + ae, X = C.y + (0.08 + Q.v * 0.42) * (C.ground - C.y), D = Math.min(C.w, C.h) * 0.07 * Q.size;
9277
9278
  for (let Z = 0; Z < Q.puffs; Z++)
9278
9279
  w.beginPath(), w.ellipse(x + (Z - (Q.puffs - 1) / 2) * D * 0.9, X + Z % 2 * D * 0.25, D * (Z % 2 ? 0.8 : 1), D * 0.62, 0, 0, Math.PI * 2), w.fill();
9279
9280
  }
9280
9281
  w.globalAlpha = 1;
9281
- const ee = (F) => Kt(Kt(F, "#0b1530", 0.65), F, B);
9282
+ const ee = (F) => Wt(Wt(F, "#0b1530", 0.65), F, B);
9282
9283
  if (l === "hills") {
9283
9284
  w.fillStyle = ee(i.hills), w.beginPath(), w.moveTo(C.x, C.ground);
9284
9285
  const F = 40;
9285
9286
  for (let Q = 0; Q <= F; Q++) {
9286
9287
  const ae = Q / F;
9287
9288
  let x = 0;
9288
- b.forEach((X, D) => x += Math.sin(ae * Math.PI * (1.5 + D * 0.7) + X.phase) * X.amp), w.lineTo(C.x + ae * C.w, C.ground - Math.max(0, x) * C.h * 0.045 - C.h * 0.03);
9289
+ y.forEach((X, D) => x += Math.sin(ae * Math.PI * (1.5 + D * 0.7) + X.phase) * X.amp), w.lineTo(C.x + ae * C.w, C.ground - Math.max(0, x) * C.h * 0.045 - C.h * 0.03);
9289
9290
  }
9290
9291
  w.lineTo(C.x + C.w, C.ground), w.closePath(), w.fill();
9291
9292
  } else if (l === "city") {
@@ -9305,10 +9306,10 @@ function af(e) {
9305
9306
  }
9306
9307
  w.fillStyle = ee(i.ground), w.fillRect(C.x, C.ground, C.w, C.y + C.h - C.ground);
9307
9308
  }, v = (w, T, I, C) => {
9308
- const j = Math.max(-1, Math.min(1, T("wind"))), K = Math.max(0, Math.min(1, T("rain"))), G = Math.max(0, Math.min(1, T("snow")));
9309
- if (K > 0) {
9310
- w.strokeStyle = i.rain, w.globalAlpha = 0.35 + 0.45 * K, w.lineWidth = 1.2, w.lineCap = "round";
9311
- const Y = C.h * 0.05, ne = j * 0.45, B = Math.round(K * u.length);
9309
+ const j = Math.max(-1, Math.min(1, T("wind"))), W = Math.max(0, Math.min(1, T("rain"))), G = Math.max(0, Math.min(1, T("snow")));
9310
+ if (W > 0) {
9311
+ w.strokeStyle = i.rain, w.globalAlpha = 0.35 + 0.45 * W, w.lineWidth = 1.2, w.lineCap = "round";
9312
+ const Y = C.h * 0.05, ne = j * 0.45, B = Math.round(W * u.length);
9312
9313
  w.beginPath();
9313
9314
  for (let H = 0; H < B; H++) {
9314
9315
  const N = u[H], R = ((N.v * C.h + I * N.speed * 0.9) % C.h + C.h) % C.h, M = ((N.u * C.w + R * ne) % C.w + C.w) % C.w;
@@ -9342,11 +9343,11 @@ function af(e) {
9342
9343
  draw(w, T, I) {
9343
9344
  const C = T.props ?? {}, j = (G) => Number(C[G] ?? A[G] ?? 0);
9344
9345
  w.save();
9345
- const K = { x: 0, y: 0, w: o, h: r, ground: s - t };
9346
+ const W = { x: 0, y: 0, w: o, h: r, ground: s - t };
9346
9347
  if (a === "sky")
9347
- O(w, j, I, K), v(w, j, I, K);
9348
- else if (w.fillStyle = i.wall, w.fillRect(0, 0, o, K.ground), w.fillStyle = i.floor, w.fillRect(0, K.ground, o, r - K.ground), w.fillStyle = i.skirting, w.fillRect(0, K.ground - r * 0.012, o, r * 0.012), c) {
9349
- const G = o * 0.26, Y = K.ground * 0.5, ne = o * 0.62, B = K.ground * 0.14;
9348
+ O(w, j, I, W), v(w, j, I, W);
9349
+ else if (w.fillStyle = i.wall, w.fillRect(0, 0, o, W.ground), w.fillStyle = i.floor, w.fillRect(0, W.ground, o, r - W.ground), w.fillStyle = i.skirting, w.fillRect(0, W.ground - r * 0.012, o, r * 0.012), c) {
9350
+ const G = o * 0.26, Y = W.ground * 0.5, ne = o * 0.62, B = W.ground * 0.14;
9350
9351
  w.fillStyle = i.frame, w.fillRect(ne - 6, B - 6, G + 12, Y + 12), w.save(), w.beginPath(), w.rect(ne, B, G, Y), w.clip(), O(w, j, I, { x: ne, y: B, w: G, h: Y, ground: B + Y * 0.8 }), v(w, j, I, { x: ne, y: B, w: G, h: Y }), w.restore(), w.strokeStyle = i.frame, w.lineWidth = 4, w.beginPath(), w.moveTo(ne + G / 2, B), w.lineTo(ne + G / 2, B + Y), w.moveTo(ne, B + Y / 2), w.lineTo(ne + G, B + Y / 2), w.stroke();
9351
9352
  }
9352
9353
  w.restore();
@@ -9414,11 +9415,11 @@ function lf(e, n) {
9414
9415
  }
9415
9416
  }
9416
9417
  function qu(e, n) {
9417
- const t = lf(e, n), o = af(t.scenery), r = t.props.map((a) => u0({ x: a.x, y: o.ground, prop: Er(a.preset), scale: a.scale, values: { turn: a.turn ?? 0, ...a.values } }));
9418
- return { scenery: o, props: r, ground: o.ground };
9418
+ const t = lf(e, n), o = af(t.scenery), r = { ...n.ink !== void 0 ? { ink: n.ink } : {}, ...n.lineWidth !== void 0 ? { lineWidth: n.lineWidth } : {} }, a = t.props.map((s) => u0({ x: s.x, y: o.ground, prop: Er(s.preset), scale: s.scale, values: { turn: s.turn ?? 0, ...s.values }, ...r }));
9419
+ return { scenery: o, props: a, ground: o.ground };
9419
9420
  }
9420
9421
  export {
9421
- yt as ACTING_STYLES,
9422
+ bt as ACTING_STYLES,
9422
9423
  vr as AIRCRAFT_ACTING,
9423
9424
  Gt as ANIMAL_GAITS,
9424
9425
  lh as ANIME_CAST,
@@ -9430,14 +9431,14 @@ export {
9430
9431
  Zu as BEAN_SOLE,
9431
9432
  mo as BEAT_FIELDS,
9432
9433
  zt as BEAT_MOMENTS,
9433
- K0 as BED_ACTING,
9434
+ W0 as BED_ACTING,
9434
9435
  cd as BIRD_ACTING,
9435
9436
  vs as BOARD_MARKS,
9436
9437
  Vt as BOARD_THEMES,
9437
9438
  di as BODY_SHAPES,
9438
9439
  pi as CANVAS_PROPERTIES,
9439
- bo as CASE_CARD_KINDS,
9440
- yo as CASE_MARK_KINDS,
9440
+ yo as CASE_CARD_KINDS,
9441
+ bo as CASE_MARK_KINDS,
9441
9442
  _0 as CHAIR_ACTING,
9442
9443
  ps as CHARACTER_BEAT_3D_FIELDS,
9443
9444
  Qa as CHARACTER_CAST,
@@ -9448,7 +9449,7 @@ export {
9448
9449
  uo as CODE_LANGUAGES,
9449
9450
  Za as CODE_PANEL_EDITS,
9450
9451
  sn as CODE_SURFACE,
9451
- Kl as CODE_THEME,
9452
+ Wl as CODE_THEME,
9452
9453
  Uc as COSMIC_KIT,
9453
9454
  _t as COSMIC_SKIES,
9454
9455
  at as DANCE_STYLES,
@@ -9464,10 +9465,10 @@ export {
9464
9465
  De as GAITS,
9465
9466
  Ns as GAIT_CYCLE_MS,
9466
9467
  ri as GLASSES_STYLES,
9467
- Ke as HAIR_COLORS,
9468
+ We as HAIR_COLORS,
9468
9469
  eg as HAIR_STILL,
9469
9470
  li as HAIR_STYLES,
9470
- bn as HAND_MEETINGS,
9471
+ yn as HAND_MEETINGS,
9471
9472
  _e as HAND_REST,
9472
9473
  we as HAND_SHAPES,
9473
9474
  ai as HAT_STYLES,
@@ -9483,14 +9484,14 @@ export {
9483
9484
  ci as HUMAN_EXPRESSIONS,
9484
9485
  ka as HUMAN_GAGS,
9485
9486
  Fe as HUMAN_POSES,
9486
- be as HUMAN_REST,
9487
+ ye as HUMAN_REST,
9487
9488
  Ep as IDENTITY_CAMERA,
9488
9489
  hh as MANGA_CAST,
9489
9490
  io as MUDRAS,
9490
9491
  lr as NOIR_AMBER,
9491
9492
  qo as NOIR_CREAM,
9492
9493
  rt as NOIR_INK,
9493
- Wc as NOIR_KIT,
9494
+ Kc as NOIR_KIT,
9494
9495
  At as NOIR_RED,
9495
9496
  ng as OUTFIT_PRESETS,
9496
9497
  He as POSES,
@@ -9510,7 +9511,7 @@ export {
9510
9511
  og as SOFT_CARTOON_CAST,
9511
9512
  Ph as STICK_ACTING_RIG,
9512
9513
  P0 as TREE_ACTING,
9513
- b0 as VEHICLE_ACTING,
9514
+ y0 as VEHICLE_ACTING,
9514
9515
  Ze as VISEMES,
9515
9516
  B0 as WHEELCHAIR_ACTING,
9516
9517
  Be as WHITEBOARD_SURFACE,
@@ -9535,7 +9536,7 @@ export {
9535
9536
  cg as beanStanding,
9536
9537
  dg as beanTorso,
9537
9538
  fg as beanTorsoOutline,
9538
- bf as beatAt,
9539
+ yf as beatAt,
9539
9540
  z0 as bed,
9540
9541
  E0 as bike,
9541
9542
  lt as bird,
@@ -9543,7 +9544,7 @@ export {
9543
9544
  ug as bodyProfileWidth,
9544
9545
  gg as bodyShapeProfiles,
9545
9546
  Mp as boilFrame,
9546
- bl as boxMesh,
9547
+ yl as boxMesh,
9547
9548
  pg as brushingPose,
9548
9549
  qu as buildScene,
9549
9550
  v0 as bus,
@@ -9559,31 +9560,31 @@ export {
9559
9560
  Rc as caseBoardMarkerTip,
9560
9561
  Qn as caseCardBox,
9561
9562
  hr as caseMarkPath,
9562
- Wf as castMember,
9563
+ Kf as castMember,
9563
9564
  sd as cat,
9564
9565
  C0 as chair,
9565
- Wt as changingWindows,
9566
+ Kt as changingWindows,
9566
9567
  Ao as character,
9567
9568
  mg as characterAt,
9568
- bg as characterHandPose,
9569
+ yg as characterHandPose,
9569
9570
  Ne as characterJoints,
9570
- yg as characterJointsInView,
9571
+ bg as characterJointsInView,
9571
9572
  Of as characterLookAtTracks,
9572
9573
  Tf as characterObjects,
9573
9574
  xr as characterPartsInView,
9574
- Kr as characterPoseOf,
9575
+ Wr as characterPoseOf,
9575
9576
  wg as characterPoseTracks,
9576
9577
  tu as characterScript,
9577
9578
  Pf as characterScript3D,
9578
9579
  kc as characterStrideLength,
9579
9580
  kg as characterTarget,
9580
- Kf as chart,
9581
+ Wf as chart,
9581
9582
  wn as checkBeats,
9582
9583
  sr as checkCast,
9583
9584
  Hl as checkCharacterBeats3D,
9584
9585
  kd as checkPropBeats,
9585
9586
  Ud as checkPropBeats3D,
9586
- bc as checkSurfaceBeats,
9587
+ yc as checkSurfaceBeats,
9587
9588
  Ip as checkTracks,
9588
9589
  gd as chicken,
9589
9590
  jf as circlePath,
@@ -9593,12 +9594,12 @@ export {
9593
9594
  Rf as codePanel,
9594
9595
  ql as codeTokens,
9595
9596
  jc as coneCorners,
9596
- ye as controlValue,
9597
+ be as controlValue,
9597
9598
  wo as cosmicShade,
9598
9599
  ad as cow,
9599
9600
  Cr as createPen,
9600
9601
  ud as crow,
9601
- yl as cylinderMesh,
9602
+ bl as cylinderMesh,
9602
9603
  Fi as danceCircleAt,
9603
9604
  Mf as danceCircleTracks,
9604
9605
  Io as danceFrame,
@@ -9609,19 +9610,19 @@ export {
9609
9610
  wf as danceTracks,
9610
9611
  Rn as danceTravel,
9611
9612
  Ti as danceTravelTrack,
9612
- yf as dancer,
9613
+ bf as dancer,
9613
9614
  Jf as defineAction,
9614
9615
  Zf as defineGait,
9615
9616
  Lc as depthAt,
9616
9617
  Hp as describeTarget,
9617
9618
  N0 as desk,
9618
9619
  od as dog,
9619
- W0 as door,
9620
+ K0 as door,
9620
9621
  vg as drawBeanFedora,
9621
9622
  ou as drawBlinds,
9622
9623
  ku as drawBokeh,
9623
9624
  Rr as drawCartoonHand,
9624
- bu as drawCaseBoard,
9625
+ yu as drawCaseBoard,
9625
9626
  Sg as drawCharacter,
9626
9627
  Mg as drawCharacterHead,
9627
9628
  $g as drawCharacterInView,
@@ -9640,7 +9641,7 @@ export {
9640
9641
  Vf as drawImpactStars,
9641
9642
  Mu as drawIsoCube,
9642
9643
  Ou as drawLabelChip,
9643
- Kc as drawMarkerStroke,
9644
+ Wc as drawMarkerStroke,
9644
9645
  uu as drawNameCard,
9645
9646
  gu as drawNarrationBox,
9646
9647
  jl as drawPencil,
@@ -9652,7 +9653,7 @@ export {
9652
9653
  nu as drawRain,
9653
9654
  Su as drawShadedBall,
9654
9655
  Pu as drawShortCaption,
9655
- yu as drawSkyGradient,
9656
+ bu as drawSkyGradient,
9656
9657
  nl as drawSolvedFaces,
9657
9658
  Ef as drawSolvedPart,
9658
9659
  _a as drawSolvedProp,
@@ -9680,7 +9681,7 @@ export {
9680
9681
  $f as flipTracks,
9681
9682
  Yi as flipTravel,
9682
9683
  Cs as gag,
9683
- yn as gagDuration,
9684
+ bn as gagDuration,
9684
9685
  Pg as gaitBob,
9685
9686
  Og as gaitGive,
9686
9687
  Ig as gaitPose,
@@ -9716,8 +9717,8 @@ export {
9716
9717
  wa as humanGaitStrideLength,
9717
9718
  Ir as humanPlan,
9718
9719
  $a as humanPose,
9719
- Kg as illustrationTones,
9720
- Wg as isHeld,
9720
+ Wg as illustrationTones,
9721
+ Kg as isHeld,
9721
9722
  Dc as isoCubeFaces,
9722
9723
  Fg as jointsInScene,
9723
9724
  Dg as jointsToScene,
@@ -9727,12 +9728,12 @@ export {
9727
9728
  lu as lightFlicker,
9728
9729
  iu as lightningFlash,
9729
9730
  xc as lineReveal,
9730
- Wa as lipSyncKeyframes,
9731
+ Ka as lipSyncKeyframes,
9731
9732
  zo as lipSyncOver,
9732
9733
  Af as lipSyncTracks,
9733
9734
  za as lit,
9734
9735
  Ga as lookFields,
9735
- br as loosePartsOf,
9736
+ yr as loosePartsOf,
9736
9737
  ed as lyingPose,
9737
9738
  qg as measuredHipWidth,
9738
9739
  Sf as meetDandiya,
@@ -9741,18 +9742,18 @@ export {
9741
9742
  Lr as mirrorHumanPose,
9742
9743
  ki as mirrorPose,
9743
9744
  Gg as mittenAt,
9744
- Ka as mixColors,
9745
+ Wa as mixColors,
9745
9746
  hn as mixHandPoses,
9746
- ya as mixPoses,
9747
+ ba as mixPoses,
9747
9748
  T0 as motorbike,
9748
9749
  sh as niceCeiling,
9749
- ys as objectPositionAt,
9750
+ bs as objectPositionAt,
9750
9751
  Yg as organicBodyContours,
9751
9752
  Ug as organicCenterLine,
9752
9753
  Xg as outfitPreset,
9753
- bd as owl,
9754
+ yd as owl,
9754
9755
  Sl as panelMesh,
9755
- yd as parrot,
9756
+ bd as parrot,
9756
9757
  $t as parseAnchor,
9757
9758
  In as parseRgb,
9758
9759
  vn as partialPath,
@@ -9762,7 +9763,7 @@ export {
9762
9763
  eu as persona,
9763
9764
  Tn as pieceMotion,
9764
9765
  pd as pigeon,
9765
- Wi as plantDanceFoot,
9766
+ Ki as plantDanceFoot,
9766
9767
  Po as pointAlong,
9767
9768
  Vg as pointOnHead,
9768
9769
  On as popIn,
@@ -9771,7 +9772,7 @@ export {
9771
9772
  Jo as propActions,
9772
9773
  h0 as propAnchors3D,
9773
9774
  Xo as propAt,
9774
- yr as propControls,
9775
+ br as propControls,
9775
9776
  xa as propLineWidth,
9776
9777
  Fu as propObjects,
9777
9778
  l0 as propPartsInSpace,
@@ -9783,7 +9784,7 @@ export {
9783
9784
  kn as propShapeMesh,
9784
9785
  ju as propSurface,
9785
9786
  u0 as propTarget,
9786
- Wu as propTow,
9787
+ Ku as propTow,
9787
9788
  a0 as propView,
9788
9789
  it as quadruped,
9789
9790
  id as rabbit,
@@ -9791,7 +9792,7 @@ export {
9791
9792
  vc as reachOf,
9792
9793
  er as resolveActingStyle,
9793
9794
  Zg as resolveBean,
9794
- Wr as resolveCharacterPoseKeys,
9795
+ Kr as resolveCharacterPoseKeys,
9795
9796
  Qg as resolveFacialHair,
9796
9797
  ep as resolveGait,
9797
9798
  tp as resolveGlasses,
@@ -9805,7 +9806,7 @@ export {
9805
9806
  va as resolvePoseKeys,
9806
9807
  hp as resolveStickFrame,
9807
9808
  cp as resolveStickPose,
9808
- Wo as rideFloors,
9809
+ Ko as rideFloors,
9809
9810
  dp as rotateAbout,
9810
9811
  Ho as routineBeats,
9811
9812
  fp as rubberLimb,
@@ -9830,21 +9831,21 @@ export {
9830
9831
  ml as soundsOf,
9831
9832
  hc as speechDuration,
9832
9833
  El as speechLength,
9833
- Ku as spliceTracks,
9834
+ Wu as spliceTracks,
9834
9835
  ld as squirrel,
9835
9836
  To as stagePlanSpace,
9836
9837
  If as stageSpots,
9837
- Wh as stepsDuration,
9838
+ Kh as stepsDuration,
9838
9839
  nr as stepsToKeys,
9839
9840
  Sa as stickFigureAt,
9840
- We as stickFigureJoints,
9841
+ Ke as stickFigureJoints,
9841
9842
  Ma as stickFigureTarget,
9842
9843
  Zi as stickToHuman,
9843
9844
  mp as strideLength,
9844
9845
  me as surfaceBox,
9845
9846
  Qf as surfaceScript,
9846
- bp as sweepingPose,
9847
- yp as talkingMouth,
9847
+ yp as sweepingPose,
9848
+ bp as talkingMouth,
9848
9849
  wp as taperedLine,
9849
9850
  kp as taperedOutline,
9850
9851
  S0 as tractor,
@@ -9852,7 +9853,7 @@ export {
9852
9853
  A0 as tree,
9853
9854
  k0 as truck,
9854
9855
  Ml as tubeMesh,
9855
- Ko as valueAt,
9856
+ Wo as valueAt,
9856
9857
  Ve as vehicle,
9857
9858
  vp as walkPose,
9858
9859
  L0 as wheelchair,