@algorisys/tinyfly 0.123.0 → 0.125.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,12 @@
1
- import { H as we, A as Pt, R as de, B as Ie, D as rn, E as yo, F as gt, G as Sr, I as be, J as Mr, K as Qn, L as wo, M as $r, N as Er, O as da, P as ko, Q as fa, S as Tr, T as Ar, U as Pr, V as Re, W as Or, X as ze, Y as ua, Z as ga, _ as Go, $ as Hr, a0 as We, a1 as Ge, a2 as xe, a3 as Ir, a4 as jr, a5 as xr, a6 as pa, a7 as Pe, a8 as Te, a9 as ma, aa as _r, ab as eo, ac as Ke, ad as ba, ae as Cr, af as Nr, ag as ya, ah as Wr, ai as Kr, aj as Rr, ak as zr, al as Fr, i as Dr, h as Lr, c as Br, j as qr, f as Gr, d as Yr, b as Ur, e as Xr, C as Vr, am as Jr, an as Zr, ao as Qr, ap as ei, aq as ti, ar as ni, as as oi, at as si } from "./cricket-play-BVKhsPUD.js";
2
- import { au as ku, av as vu, aw as Su, ax as Mu, ay as $u, az as Eu, aA as Tu, aB as Au, aC as Pu, aD as Ou, aE as Hu, aF as Iu, aG as ju, aH as xu, aI as _u, aJ as Cu, aK as Nu, aL as Wu, aM as Ku, aN as Ru, aO as zu, aP as Fu, aQ as Du, aR as Lu, aS as Bu, aT as qu, aU as Gu, aV as Yu, aW as Uu, aX as Xu, aY as Vu, aZ as Ju, a_ as Zu, a$ as Qu, b0 as eg, b1 as tg, b2 as ng, b3 as og, b4 as sg, b5 as ag, b6 as rg, b7 as ig, b8 as lg, b9 as hg, ba as cg, bb as dg, bc as fg, bd as ug, be as gg, bf as pg, bg as mg, bh as bg, bi as yg, bj as wg, bk as kg, bl as vg, bm as Sg, bn as Mg, bo as $g, bp as Eg, bq as Tg, br as Ag, bs as Pg, bt as Og, bu as Hg, bv as Ig, bw as jg, bx as xg, by as _g, bz as Cg, bA as Ng, bB as Wg, bC as Kg, bD as Rg, bE as zg, bF as Fg, bG as Dg, bH as Lg, bI as Bg, bJ as qg } from "./cricket-play-BVKhsPUD.js";
1
+ import { H as we, A as Pt, R as de, B as Ie, D as rn, E as yo, F as gt, G as Sr, I as be, J as Mr, K as Qn, L as wo, M as $r, N as Er, O as da, P as ko, Q as fa, S as Tr, T as Ar, U as Pr, V as Re, W as Or, X as ze, Y as ua, Z as ga, _ as Go, $ as Hr, a0 as Ke, a1 as Ge, a2 as xe, a3 as Ir, a4 as jr, a5 as xr, a6 as pa, a7 as Pe, a8 as Te, a9 as ma, aa as _r, ab as eo, ac as We, ad as ba, ae as Cr, af as Nr, ag as ya, ah as Kr, ai as Wr, aj as Rr, ak as zr, al as Fr, i as Dr, h as Lr, c as Br, j as qr, f as Gr, d as Yr, b as Ur, e as Xr, C as Vr, am as Jr, an as Zr, ao as Qr, ap as ei, aq as ti, ar as ni, as as oi, at as si } from "./cricket-play-a5jHHZVh.js";
2
+ import { au as ku, av as vu, aw as Su, ax as Mu, ay as $u, az as Eu, aA as Tu, aB as Au, aC as Pu, aD as Ou, aE as Hu, aF as Iu, aG as ju, aH as xu, aI as _u, aJ as Cu, aK as Nu, aL as Ku, aM as Wu, aN as Ru, aO as zu, aP as Fu, aQ as Du, aR as Lu, aS as Bu, aT as qu, aU as Gu, aV as Yu, aW as Uu, aX as Xu, aY as Vu, aZ as Ju, a_ as Zu, a$ as Qu, b0 as eg, b1 as tg, b2 as ng, b3 as og, b4 as sg, b5 as ag, b6 as rg, b7 as ig, b8 as lg, b9 as hg, ba as cg, bb as dg, bc as fg, bd as ug, be as gg, bf as pg, bg as mg, bh as bg, bi as yg, bj as wg, bk as kg, bl as vg, bm as Sg, bn as Mg, bo as $g, bp as Eg, bq as Tg, br as Ag, bs as Pg, bt as Og, bu as Hg, bv as Ig, bw as jg, bx as xg, by as _g, bz as Cg, bA as Ng, bB as Kg, bC as Wg, bD as Rg, bE as zg, bF as Fg, bG as Dg, bH as Lg, bI as Bg, bJ as qg, bK as Gg, bL as Yg } from "./cricket-play-a5jHHZVh.js";
3
3
  import { getEasingFunction as $t, hashSeed as Ye, mat4 as oe, vec3 as ke, quat as Be, Timeline as ve, unknownName as ce, createRandom as Et, springFollow as tn, closestName as to } from "@algorisys/tinyfly";
4
4
  import { f as ln, h as ai, a as wa } from "./load-scene-oWNsYYC1.js";
5
5
  import { l as ka, f as va } from "./shading-0lPgnXmD.js";
6
6
  import { s as ri, p as wn, b as vo, a as ii } from "./sketch-CYPUbk3Q.js";
7
- import { c as Yg } from "./sketch-CYPUbk3Q.js";
7
+ import { c as Xg } from "./sketch-CYPUbk3Q.js";
8
8
  import { C as li } from "./target-properties-BtN9skb-.js";
9
- import { I as Xg, a as Vg, b as Jg, c as Zg, d as Qg, e as ep, f as tp } from "./target-properties-BtN9skb-.js";
9
+ import { I as Jg, a as Zg, b as Qg, c as ep, d as tp, e as np, f as op } from "./target-properties-BtN9skb-.js";
10
10
  const Hn = 0.5, no = {
11
11
  /** Flag: fingers together and straight, thumb bent in */
12
12
  pataka: Pt({ "thumb.curl": 0.3, "thumb.across": 0.6, "index.curl": 0, "middle.curl": 0, "ring.curl": 0, "pinky.curl": 0, spread: 0, turn: 2 }),
@@ -1025,10 +1025,10 @@ function Ci(e) {
1025
1025
  return t;
1026
1026
  }
1027
1027
  function Ni(e) {
1028
- return e - Wi * Math.sin(2 * Math.PI * e) / (2 * Math.PI);
1028
+ return e - Ki * Math.sin(2 * Math.PI * e) / (2 * Math.PI);
1029
1029
  }
1030
- const Wi = 0.5;
1031
- function Ki(e, n) {
1030
+ const Ki = 0.5;
1031
+ function Wi(e, n) {
1032
1032
  if (!(n <= e.takeoff || n >= e.landing))
1033
1033
  return (n - e.takeoff) / (e.landing - e.takeoff);
1034
1034
  }
@@ -1036,7 +1036,7 @@ function Ri(e, n) {
1036
1036
  const t = typeof e == "string" ? Sn[e] : e, o = Ci(t), r = fn(n);
1037
1037
  let a = 0;
1038
1038
  for (let d = 0; d < o.length; d++) o[d].at <= r && (a = d);
1039
- const s = o[a], i = o[Math.min(a + 1, o.length - 1)], l = i.at > s.at ? (r - s.at) / (i.at - s.at) : 0, c = yo(s.pose, i.pose, $t(i.easing ?? "ease-in-out")(fn(l))), h = Ki(t, r);
1039
+ const s = o[a], i = o[Math.min(a + 1, o.length - 1)], l = i.at > s.at ? (r - s.at) / (i.at - s.at) : 0, c = yo(s.pose, i.pose, $t(i.easing ?? "ease-in-out")(fn(l))), h = Wi(t, r);
1040
1040
  return h === void 0 ? { ...c, spin: 0, rise: 0 } : {
1041
1041
  ...c,
1042
1042
  spin: t.spin * Ni(h),
@@ -1823,14 +1823,14 @@ function Na(e) {
1823
1823
  function mt(e, n) {
1824
1824
  return Math.atan2(n[0] - e[0], n[1] - e[1]) * 180 / Math.PI;
1825
1825
  }
1826
- function Wa(e) {
1826
+ function Ka(e) {
1827
1827
  const n = e.filter((r, a) => a === 0 || Math.hypot(r[0] - e[a - 1][0], r[1] - e[a - 1][1]) > 1e-6);
1828
1828
  if (n.length < 2) return [];
1829
1829
  const t = n.length === 2 ? n : Ca(n.map(([r, a]) => [r, 0, a]), (n.length - 1) * 12).map(([r, , a]) => [r, a]);
1830
1830
  let o = 0;
1831
1831
  return t.map((r, a) => (a > 0 && (o += Math.hypot(r[0] - t[a - 1][0], r[1] - t[a - 1][1])), { point: r, at: o }));
1832
1832
  }
1833
- function Ka(e, n) {
1833
+ function Wa(e, n) {
1834
1834
  let t = 1;
1835
1835
  for (; t < e.length - 1 && e[t].at < n; ) t++;
1836
1836
  const o = e[t - 1], r = e[t], a = r.at > o.at ? Math.max(0, Math.min(1, (n - o.at) / (r.at - o.at))) : 0;
@@ -1923,17 +1923,17 @@ ${o.map((k) => ` beat ${k.beat}: ${k.message}`).join(`
1923
1923
  for (const [E, H] of Object.entries(v))
1924
1924
  s(E) !== H && (p(E, k, s(E)), u(E, y, H, w), a[E] = H);
1925
1925
  }, T = (k, y, v) => {
1926
- const w = Wa([[i, l], ...y.through ?? [y.to]]);
1926
+ const w = Ka([[i, l], ...y.through ?? [y.to]]);
1927
1927
  if (w.length < 2) return v;
1928
1928
  const E = g(v, mt(w[0].point, w[1].point)), H = w[w.length - 1].at, x = y.speed ?? wl[k] * Math.sqrt(r / 1.7), j = y.for ?? H / x * 1e3, R = ua(k, r), G = $t("ease-in-out"), Y = Math.min(Ml, j / 4);
1929
1929
  f.push({ time: E, value: k }), p("walking", E, 0), u("walking", E + Y, 1, "ease-out"), u("walking", E + j - Y, 1), u("walking", E + j, 0, "ease-in");
1930
1930
  const ne = h;
1931
1931
  let B = c;
1932
1932
  for (let I = 0; ; I = Math.min(H, I + kl)) {
1933
- const N = E + Ra(G, I / H) * j, { point: W, direction: S } = Ka(w, I);
1933
+ const N = E + Ra(G, I / H) * j, { point: K, direction: S } = Wa(w, I);
1934
1934
  B += un(B, mt([0, 0], S));
1935
1935
  const _ = I === 0 ? p : u;
1936
- if (_("x", N, W[0]), _("z", N, W[1]), _("rotateY", N, B), _("walk", N, ne + I / R), I >= H) break;
1936
+ if (_("x", N, K[0]), _("z", N, K[1]), _("rotateY", N, B), _("walk", N, ne + I / R), I >= H) break;
1937
1937
  }
1938
1938
  return h = ne + H / R, [i, l] = w[w.length - 1].point, c = B, E + j;
1939
1939
  }, O = [], M = [];
@@ -1952,7 +1952,7 @@ ${o.map((k) => ` beat ${k.beat}: ${k.message}`).join(`
1952
1952
  for (const Y of Object.keys(R[0])) {
1953
1953
  const ne = s(Y, x);
1954
1954
  Y === "turn" || Y === "roll" || R.every((B) => B[Y] === ne) || (p(Y, y, ne), R.slice(1).forEach((B, I) => {
1955
- const N = y + (v - y) * (I + 1) / j, W = Math.min(1, (N - y) / G), S = W * W * (3 - 2 * W);
1955
+ const N = y + (v - y) * (I + 1) / j, K = Math.min(1, (N - y) / G), S = K * K * (3 - 2 * K);
1956
1956
  u(Y, N, ne + (B[Y] - ne) * S);
1957
1957
  }), a[Y] = R[j][Y]);
1958
1958
  }
@@ -2265,7 +2265,7 @@ function jo(e, n) {
2265
2265
  }
2266
2266
  return t[t.length - 1].value;
2267
2267
  }
2268
- function Kt(e) {
2268
+ function Wt(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
  }
@@ -2390,19 +2390,19 @@ function Sf(e) {
2390
2390
  const n = { ...jl, ...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((I) => I.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 (!io.includes(u)) throw new Error(`codePanel: ${ce("language", u, io)}`);
2393
- const p = t.map((I) => Kl(I, u).flatMap((N) => Array.from(N.text, () => n[N.kind]))), g = Ft(), b = $n(g), T = [], O = /* @__PURE__ */ new Map(), M = [], m = [], A = (I) => {
2393
+ const p = t.map((I) => Wl(I, u).flatMap((N) => Array.from(N.text, () => n[N.kind]))), g = Ft(), b = $n(g), T = [], O = /* @__PURE__ */ new Map(), M = [], m = [], A = (I) => {
2394
2394
  if (!Number.isInteger(I) || I < 1 || I > t.length) throw new Error(`codePanel: no line ${I} (it has ${t.length})`);
2395
- }, P = g.tween, k = g.last, y = (I, N, W, S, _, V = 300) => {
2396
- A(I), P(`line.${I}.${N}`, W, S, _, V);
2397
- }, v = (I, N) => T.filter((W) => W.line < I && W.closed <= N).length, w = me, E = (I) => e.y + s + (I - 1) * r, H = (I) => Array.isArray(I) ? I : [I], x = (I, N, W) => {
2395
+ }, P = g.tween, k = g.last, y = (I, N, K, S, _, V = 300) => {
2396
+ A(I), P(`line.${I}.${N}`, K, S, _, V);
2397
+ }, v = (I, N) => T.filter((K) => K.line < I && K.closed <= N).length, w = me, E = (I) => e.y + s + (I - 1) * r, H = (I) => Array.isArray(I) ? I : [I], x = (I, N, K) => {
2398
2398
  let S = -1;
2399
- for (let _ = 0; _ < W; _++)
2400
- if (S = t[I - 1].indexOf(N, S + 1), S < 0) throw new Error(`codePanel: line ${I} has no ${W > 1 ? `${W}th ` : ""}"${N}"`);
2399
+ for (let _ = 0; _ < K; _++)
2400
+ if (S = t[I - 1].indexOf(N, S + 1), S < 0) throw new Error(`codePanel: line ${I} has no ${K > 1 ? `${K}th ` : ""}"${N}"`);
2401
2401
  return S;
2402
2402
  }, j = {};
2403
2403
  t.forEach((I, N) => {
2404
- const W = N + 1;
2405
- j[`line.${W}.highlight`] = 0, j[`line.${W}.strike`] = 0, j[`line.${W}.wipe`] = 0, j[`line.${W}.reveal`] = f.has(W) ? 0 : 1, j[`line.${W}.shift`] = 0;
2404
+ const K = N + 1;
2405
+ j[`line.${K}.highlight`] = 0, j[`line.${K}.strike`] = 0, j[`line.${K}.wipe`] = 0, j[`line.${K}.reveal`] = f.has(K) ? 0 : 1, j[`line.${K}.shift`] = 0;
2406
2406
  });
2407
2407
  const R = {
2408
2408
  type: "custom",
@@ -2421,7 +2421,7 @@ function Sf(e) {
2421
2421
  actions: Ga
2422
2422
  },
2423
2423
  draw(I, N) {
2424
- const W = N.props ?? {}, S = (F) => Number(W[F] ?? j[F]), _ = s + i, V = (F) => s + (F - 1) * r - S(`line.${F}.shift`) * r;
2424
+ const K = N.props ?? {}, S = (F) => Number(K[F] ?? j[F]), _ = s + i, V = (F) => s + (F - 1) * r - S(`line.${F}.shift`) * r;
2425
2425
  I.fillStyle = n.background, gs(I, 0, 0, c, h, 8), I.fill(), I.font = `${o}px ${n.font}`, I.textBaseline = "middle", I.textAlign = "left";
2426
2426
  const ee = (F, Q, ae, C, X) => {
2427
2427
  const D = t[F - 1];
@@ -2444,11 +2444,11 @@ function Sf(e) {
2444
2444
  ee(ae, z, Math.min(q.column, se), U, D), U += (q.column - z) * a;
2445
2445
  let le = q.length, L = "";
2446
2446
  if (q.piece) {
2447
- const K = q.piece.written ?? "", J = S(`piece.${q.piece.id}.write`);
2448
- K && J > 0 ? (L = K.slice(0, Math.round(J * K.length)), le = q.length + (K.length - q.length) * Math.min(1, J * 2)) : le = q.length * (1 - S(`piece.${q.piece.id}.away`));
2447
+ const W = q.piece.written ?? "", J = S(`piece.${q.piece.id}.write`);
2448
+ W && J > 0 ? (L = W.slice(0, Math.round(J * W.length)), le = q.length + (W.length - q.length) * Math.min(1, J * 2)) : le = q.length * (1 - S(`piece.${q.piece.id}.away`));
2449
2449
  } else q.insert && (le = q.insert.chars * S(`insert.${q.insert.id}.open`), q.insert.text && (L = q.insert.text.slice(0, Math.round(S(`insert.${q.insert.id}.type`) * q.insert.text.length))));
2450
2450
  I.fillStyle = n.text;
2451
- for (let K = 0; K < L.length; K++) L[K] !== " " && I.fillText(L[K], U + K * a, D);
2451
+ for (let W = 0; W < L.length; W++) L[W] !== " " && I.fillText(L[W], U + W * a, D);
2452
2452
  U += le * a, z = q.column + q.length;
2453
2453
  }
2454
2454
  ee(ae, z, Math.max(z, se), U, D);
@@ -2464,32 +2464,32 @@ function Sf(e) {
2464
2464
  I.restore();
2465
2465
  }
2466
2466
  }, G = (I) => {
2467
- const { kind: N, rest: W } = Mt(I), S = (_) => et("codePanel", I, nn, _);
2467
+ const { kind: N, rest: K } = Mt(I), S = (_) => et("codePanel", I, nn, _);
2468
2468
  if (N === "box") {
2469
- if (W) throw S("box takes no arguments");
2469
+ if (K) throw S("box takes no arguments");
2470
2470
  return { kind: N };
2471
2471
  }
2472
2472
  if (N === "line") {
2473
- if (!/^\d+$/.test(W)) throw S("write it line:N");
2474
- return { kind: N, n: Number(W) };
2473
+ if (!/^\d+$/.test(K)) throw S("write it line:N");
2474
+ return { kind: N, n: Number(K) };
2475
2475
  }
2476
2476
  if (N === "token") {
2477
- const _ = /^(\d+)(?:#(\d+))?:(.+)$/.exec(W);
2477
+ const _ = /^(\d+)(?:#(\d+))?:(.+)$/.exec(K);
2478
2478
  if (!_) throw S("write it token:N:TEXT, or token:N#K:TEXT for the Kth");
2479
2479
  return { kind: N, n: Number(_[1]), occurrence: _[2] ? Number(_[2]) : 1, text: _[3] };
2480
2480
  }
2481
2481
  if (N === "spot") {
2482
- const _ = /^(\d+):(\d+)(?::(\d+))?$/.exec(W);
2482
+ const _ = /^(\d+):(\d+)(?::(\d+))?$/.exec(K);
2483
2483
  if (!_) throw S("write it spot:N:C, or spot:N:C:W for W characters");
2484
2484
  return { kind: N, n: Number(_[1]), column: Number(_[2]), width: _[3] ? Number(_[3]) : 1 };
2485
2485
  }
2486
2486
  throw S();
2487
- }, Y = (I, N, W, S = !1) => {
2487
+ }, Y = (I, N, K, S = !1) => {
2488
2488
  const _ = Array.isArray(N) ? N : [N];
2489
- if (_.length === 0 || S && _.length > 1) throw new Error(`codePanel.edit: ${I} takes ${S ? "one" : "at least one"} ${W} anchor`);
2489
+ if (_.length === 0 || S && _.length > 1) throw new Error(`codePanel.edit: ${I} takes ${S ? "one" : "at least one"} ${K} anchor`);
2490
2490
  return _.map((V) => {
2491
2491
  const ee = G(V);
2492
- if (ee.kind !== W) throw new Error(`codePanel.edit: ${I} takes ${W} anchors (${W}:…), not "${V}"`);
2492
+ if (ee.kind !== K) throw new Error(`codePanel.edit: ${I} takes ${K} anchors (${K}:…), not "${V}"`);
2493
2493
  return ee;
2494
2494
  });
2495
2495
  }, ne = (I, N) => {
@@ -2504,31 +2504,31 @@ function Sf(e) {
2504
2504
  line(I, N = 1 / 0) {
2505
2505
  return A(I), w(d, E(I) - v(I, N) * r, Math.max(1, t[I - 1].length) * a, r);
2506
2506
  },
2507
- token(I, N, W = 1, S = 1 / 0) {
2507
+ token(I, N, K = 1, S = 1 / 0) {
2508
2508
  A(I);
2509
- const _ = x(I, N, W);
2509
+ const _ = x(I, N, K);
2510
2510
  return w(d + _ * a, E(I) - v(I, S) * r, N.length * a, r);
2511
2511
  },
2512
2512
  highlight(I, N) {
2513
- for (const W of H(I)) {
2514
- const S = k(`line.${W}.highlight`, 0);
2515
- y(W, "highlight", S, N.on === !1 ? 0 : 1, N, 200);
2513
+ for (const K of H(I)) {
2514
+ const S = k(`line.${K}.highlight`, 0);
2515
+ y(K, "highlight", S, N.on === !1 ? 0 : 1, N, 200);
2516
2516
  }
2517
2517
  return B;
2518
2518
  },
2519
2519
  strike(I, N) {
2520
- for (const W of H(I)) y(W, "strike", k(`line.${W}.strike`, 0), 1, N);
2520
+ for (const K of H(I)) y(K, "strike", k(`line.${K}.strike`, 0), 1, N);
2521
2521
  return B;
2522
2522
  },
2523
2523
  remove(I, N) {
2524
- const W = H(I), S = N.style ?? "wipe";
2524
+ const K = H(I), S = N.style ?? "wipe";
2525
2525
  if (!ro.includes(S)) throw new Error(`codePanel.remove: ${ce("style", S, ro)}`);
2526
2526
  const _ = S === "wipe" ? 300 : 450, V = N.at + (N.duration ?? _), ee = N.close ?? 250;
2527
- for (const F of W)
2527
+ for (const F of K)
2528
2528
  y(F, "wipe", 0, 1, { ...N, easing: N.easing ?? (S === "fly" ? "ease-in" : void 0) }, _), O.set(F, { style: S, from: N.from ?? "left" }), T.push({ line: F, closed: V + ee });
2529
2529
  for (let F = 1; F <= t.length; F++) {
2530
- if (W.includes(F)) continue;
2531
- const Q = W.filter((C) => C < F).length;
2530
+ if (K.includes(F)) continue;
2531
+ const Q = K.filter((C) => C < F).length;
2532
2532
  if (Q === 0) continue;
2533
2533
  const ae = k(`line.${F}.shift`, 0);
2534
2534
  y(F, "shift", ae, ae + Q, { at: V, duration: ee, easing: "ease-in-out" });
@@ -2538,7 +2538,7 @@ function Sf(e) {
2538
2538
  type(I, N) {
2539
2539
  return y(I, "reveal", 0, 1, { duration: t[I - 1].length * 45, ...N }), B;
2540
2540
  },
2541
- piece(I, N, W = 1) {
2541
+ piece(I, N, K = 1) {
2542
2542
  if (typeof I == "string") {
2543
2543
  const F = G(I);
2544
2544
  if (F.kind !== "token") throw new Error(`codePanel.piece: a piece is a word, token:N:TEXT, not "${I}"`);
@@ -2547,11 +2547,11 @@ function Sf(e) {
2547
2547
  const S = I;
2548
2548
  if (N === void 0) throw new Error('codePanel.piece: which word? piece(n, text) or piece("token:N:TEXT")');
2549
2549
  A(S);
2550
- const _ = x(S, N, W), V = M.find((F) => F.line === S && F.column === _ && F.text === N);
2550
+ const _ = x(S, N, K), V = M.find((F) => F.line === S && F.column === _ && F.text === N);
2551
2551
  if (V) return V;
2552
2552
  if (M.some((F) => F.line === S && _ < F.column + F.text.length && F.column < _ + N.length))
2553
2553
  throw new Error(`codePanel: "${N}" on line ${S} overlaps another piece`);
2554
- const ee = { id: M.length + 1, line: S, column: _, text: N, home: B.token(S, N, W, 0) };
2554
+ const ee = { id: M.length + 1, line: S, column: _, text: N, home: B.token(S, N, K, 0) };
2555
2555
  M.push(ee);
2556
2556
  for (const F of ["x", "y", "rotate", "write", "away"]) j[`piece.${ee.id}.${F}`] = 0;
2557
2557
  return j[`piece.${ee.id}.opacity`] = 1, ee;
@@ -2565,67 +2565,67 @@ function Sf(e) {
2565
2565
  move(I, N) {
2566
2566
  return b.move(I, N), B;
2567
2567
  },
2568
- write(I, N, W) {
2569
- return I.written = N, P(`piece.${I.id}.write`, 0, 1, { duration: Math.max(1, N.length) * 70, ...W }), B;
2568
+ write(I, N, K) {
2569
+ return I.written = N, P(`piece.${I.id}.write`, 0, 1, { duration: Math.max(1, N.length) * 70, ...K }), B;
2570
2570
  },
2571
- spot(I, N, W = 1, S = 1 / 0) {
2571
+ spot(I, N, K = 1, S = 1 / 0) {
2572
2572
  A(I);
2573
2573
  const _ = m.filter((V) => V.line === I && V.column <= N && V.at <= S).reduce((V, ee) => V + ee.chars, 0);
2574
- return w(d + (N + _) * a, E(I) - v(I, S) * r, W * a, r);
2574
+ return w(d + (N + _) * a, E(I) - v(I, S) * r, K * a, r);
2575
2575
  },
2576
- insert(I, N, W, S) {
2576
+ insert(I, N, K, S) {
2577
2577
  A(I);
2578
- const _ = { id: m.length + 1, line: I, column: N, chars: W.length, text: W, at: S.at };
2578
+ const _ = { id: m.length + 1, line: I, column: N, chars: K.length, text: K, at: S.at };
2579
2579
  m.push(_), j[`insert.${_.id}.open`] = 0, j[`insert.${_.id}.type`] = 0;
2580
- const V = S.duration ?? W.length * 70;
2580
+ const V = S.duration ?? K.length * 70;
2581
2581
  return P(`insert.${_.id}.open`, 0, 1, { at: S.at, duration: V * 0.6, easing: "ease-out" }), P(`insert.${_.id}.type`, 0, 1, { at: S.at, duration: V }), B;
2582
2582
  },
2583
- drop(I, N, W, S) {
2583
+ drop(I, N, K, S) {
2584
2584
  A(N);
2585
- const _ = S.duration ?? 250, V = N === I.line, ee = S.easing ?? (V ? "linear" : "ease-out"), F = B.landing(I, N, W, S.at), Q = { id: m.length + 1, line: N, column: W, chars: I.text.length, at: S.at };
2585
+ const _ = S.duration ?? 250, V = N === I.line, ee = S.easing ?? (V ? "linear" : "ease-out"), F = B.landing(I, N, K, S.at), Q = { id: m.length + 1, line: N, column: K, chars: I.text.length, at: S.at };
2586
2586
  return m.push(Q), j[`insert.${Q.id}.open`] = 0, P(`insert.${Q.id}.open`, 0, 1, { at: S.at, duration: _, easing: V ? ee : "ease-out" }), P(`piece.${I.id}.away`, k(`piece.${I.id}.away`, 0), 1, { at: S.at, duration: _, easing: V ? ee : "ease-in-out" }), b.cutAfter(I, S.at), B.move(I, { at: S.at, duration: _, easing: ee, to: { x: F.x, y: F.y } }), P(`piece.${I.id}.rotate`, g.valueAt(`piece.${I.id}.rotate`, S.at), 0, { at: S.at, duration: _ }), B;
2587
2587
  },
2588
- landing(I, N, W, S = 1 / 0) {
2589
- const _ = B.spot(N, W, I.text.length, S), V = N === I.line && W > I.column ? I.text.length * a : 0;
2588
+ landing(I, N, K, S = 1 / 0) {
2589
+ const _ = B.spot(N, K, I.text.length, S), V = N === I.line && K > I.column ? I.text.length * a : 0;
2590
2590
  return w(_.left - V, _.top, _.width, _.height);
2591
2591
  },
2592
- ride(I, N, W) {
2592
+ ride(I, N, K) {
2593
2593
  const S = t.map((_, V) => {
2594
2594
  const ee = g.keys(`line.${V + 1}.shift`) ?? [];
2595
- return { top: E(V + 1), offset: (F) => -jo(ee, F) * r, windows: Kt(ee) };
2595
+ return { top: E(V + 1), offset: (F) => -jo(ee, F) * r, windows: Wt(ee) };
2596
2596
  });
2597
- return xo(I, N, { ground: W.ground, every: W.every ?? Qe, floors: S });
2597
+ return xo(I, N, { ground: K.ground, every: K.every ?? Qe, floors: S });
2598
2598
  },
2599
2599
  tracks: g.tracks,
2600
2600
  anchor(I, N = 1 / 0) {
2601
- const W = G(I);
2602
- return W.kind === "box" ? B.box : W.kind === "line" ? B.line(W.n, N) : W.kind === "token" ? B.token(W.n, W.text, W.occurrence, N) : B.spot(W.n, W.column, W.width, N);
2601
+ const K = G(I);
2602
+ return K.kind === "box" ? B.box : K.kind === "line" ? B.line(K.n, N) : K.kind === "token" ? B.token(K.n, K.text, K.occurrence, N) : B.spot(K.n, K.column, K.width, N);
2603
2603
  },
2604
- edit(I, N, W) {
2604
+ edit(I, N, K) {
2605
2605
  const S = () => Y(I, N, "line").map((_) => _.n);
2606
- if (I === "highlight") return B.highlight(S(), W);
2607
- if (I === "strike") return B.strike(S(), W);
2608
- if (I === "remove") return B.remove(S(), W);
2606
+ if (I === "highlight") return B.highlight(S(), K);
2607
+ if (I === "strike") return B.strike(S(), K);
2608
+ if (I === "remove") return B.remove(S(), K);
2609
2609
  if (I === "type") {
2610
- for (const _ of S()) B.type(_, W);
2610
+ for (const _ of S()) B.type(_, K);
2611
2611
  return B;
2612
2612
  }
2613
2613
  if (I === "insert") {
2614
2614
  const [_] = Y(I, N, "spot", !0);
2615
- return B.insert(_.n, _.column, ne(I, W), W);
2615
+ return B.insert(_.n, _.column, ne(I, K), K);
2616
2616
  }
2617
2617
  if (I === "write" || I === "drop" || I === "move" || I === "fling") {
2618
2618
  const [_] = Y(I, N, "token", !0), V = B.piece(_.n, _.text, _.occurrence);
2619
- if (I === "write") return B.write(V, ne(I, W), W);
2620
- if (I === "fling") return B.fling(V, W);
2619
+ if (I === "write") return B.write(V, ne(I, K), K);
2620
+ if (I === "fling") return B.fling(V, K);
2621
2621
  if (I === "drop") {
2622
- const F = typeof W.into == "string" ? G(W.into) : void 0;
2622
+ const F = typeof K.into == "string" ? G(K.into) : void 0;
2623
2623
  if (F?.kind !== "spot") throw new Error("codePanel.edit: drop needs `into`, a spot anchor (spot:N:C)");
2624
- return B.drop(V, F.n, F.column, W);
2624
+ return B.drop(V, F.n, F.column, K);
2625
2625
  }
2626
- const ee = typeof W.to == "string" ? B.anchor(W.to, W.at) : W.to;
2626
+ const ee = typeof K.to == "string" ? B.anchor(K.to, K.at) : K.to;
2627
2627
  if (!ee || typeof ee.x != "number" || typeof ee.y != "number") throw new Error("codePanel.edit: move needs `to`, an anchor name or { x, y }");
2628
- return B.move(V, { ...W, to: ee });
2628
+ return B.move(V, { ...K, to: ee });
2629
2629
  }
2630
2630
  throw En("codePanel", I, nn);
2631
2631
  }
@@ -2694,7 +2694,7 @@ const gn = {
2694
2694
  plain: []
2695
2695
  };
2696
2696
  gn.typescript = [...gn.javascript, "enum", "interface", "type", "implements", "private", "public", "readonly", "keyof", "as", "declare", "namespace"];
2697
- const io = Object.keys(gn), Wl = {
2697
+ const io = Object.keys(gn), Kl = {
2698
2698
  go: "//",
2699
2699
  rust: "//",
2700
2700
  csharp: "//",
@@ -2703,8 +2703,8 @@ const io = Object.keys(gn), Wl = {
2703
2703
  python: "#",
2704
2704
  plain: null
2705
2705
  };
2706
- function Kl(e, n) {
2707
- const t = new Set(gn[n]), o = Wl[n], r = [], a = (i, l) => {
2706
+ function Wl(e, n) {
2707
+ const t = new Set(gn[n]), o = Kl[n], r = [], a = (i, l) => {
2708
2708
  const c = r[r.length - 1];
2709
2709
  c && c.kind === l ? c.text += i : r.push({ text: i, kind: l });
2710
2710
  };
@@ -2861,7 +2861,7 @@ function Mf(e) {
2861
2861
  }
2862
2862
  m.textAlign = "center", m.textBaseline = "middle", m.lineCap = "round", m.lineJoin = "round", m.globalAlpha = t.opacity;
2863
2863
  for (const y of h.values()) {
2864
- if (m.save(), Wn(m, y.box, k(`${y.kind}.${y.item.id}.erase`)), y.kind === "text") {
2864
+ if (m.save(), Kn(m, y.box, k(`${y.kind}.${y.item.id}.erase`)), y.kind === "text") {
2865
2865
  const v = T(y.item.id), w = k(`text.${y.item.id}.write`) * y.item.text.length;
2866
2866
  m.font = `${y.size}px ${t.font}`, m.fillStyle = y.color;
2867
2867
  for (let E = 0; E < Math.ceil(w); E++)
@@ -2889,7 +2889,7 @@ function Mf(e) {
2889
2889
  if (H <= 0) continue;
2890
2890
  m.save();
2891
2891
  const x = { x: y.home.x - e.x, y: y.home.y - e.y }, j = { x: k(`piece.${y.id}.x`), y: k(`piece.${y.id}.y`) };
2892
- Wn(m, me(x.x + j.x - y.home.width / 2, x.y + j.y - y.home.height / 2, y.home.width, y.home.height), k(`piece.${y.id}.erase`)), Math.hypot(j.x, j.y) < 1 && Wn(m, v.box, k(`text.${y.item}.erase`)), m.globalAlpha = t.opacity * Math.min(1, H), m.translate(x.x + j.x, x.y + j.y), m.rotate(k(`piece.${y.id}.rotate`) * Math.PI / 180);
2892
+ Kn(m, me(x.x + j.x - y.home.width / 2, x.y + j.y - y.home.height / 2, y.home.width, y.home.height), k(`piece.${y.id}.erase`)), Math.hypot(j.x, j.y) < 1 && Kn(m, v.box, k(`text.${y.item}.erase`)), m.globalAlpha = t.opacity * Math.min(1, H), m.translate(x.x + j.x, x.y + j.y), m.rotate(k(`piece.${y.id}.rotate`) * Math.PI / 180);
2893
2893
  for (let R = 0; R < y.text.length; R++) y.text[R] !== " " && m.fillText(y.text[R], (R + 0.5 - y.text.length / 2) * w, 0);
2894
2894
  m.restore();
2895
2895
  }
@@ -3074,7 +3074,7 @@ function ws(e, n, t, o, r, a) {
3074
3074
  e.moveTo(h.x, h.y), e.lineTo(h.x - Math.cos(f + p * 0.45) * u, h.y - Math.sin(f + p * 0.45) * u);
3075
3075
  e.stroke();
3076
3076
  }
3077
- function Wn(e, n, t) {
3077
+ function Kn(e, n, t) {
3078
3078
  if (t <= 0) return;
3079
3079
  const o = 8;
3080
3080
  e.beginPath(), e.rect(n.left - o + t * (n.width + o * 2), n.top - o * 4, (1 - t) * (n.width + o * 2), n.height + o * 8), e.clip();
@@ -3183,15 +3183,15 @@ function $f(e) {
3183
3183
  B.set(z.id, me($ - te, M, te, g * 1.4)), $ -= te + g * 0.6;
3184
3184
  }
3185
3185
  }
3186
- const I = Ft(), N = $n(I), W = {}, S = ($, z, U) => a ? `${f}.${$}.${z}.${U}` : `${f}.${$}.${U}`;
3186
+ const I = Ft(), N = $n(I), K = {}, S = ($, z, U) => a ? `${f}.${$}.${z}.${U}` : `${f}.${$}.${U}`;
3187
3187
  for (const $ of e.data)
3188
3188
  for (const z of s)
3189
- W[S($.id, z.id, "value")] = d($, z), W[S($.id, z.id, "show")] = $.hidden ? 0 : 1, W[S($.id, z.id, "highlight")] = 0, r && (W[S($.id, z.id, "pull")] = 0);
3190
- const _ = ($, z) => I.keys($)?.length ? jo(I.keys($), z) : W[$], V = ($, z, U) => _(S($, z, "value"), U) * (o === "bar" ? _(S($, z, "show"), U) : 1) * w, ee = ($) => {
3191
- const z = s[0].id, U = e.data.map((L) => Math.max(0, $(S(L.id, z, "value"))) * Math.max(0, Math.min(1, $(S(L.id, z, "show"))))), te = U.reduce((L, K) => L + K, 0), q = /* @__PURE__ */ new Map();
3189
+ K[S($.id, z.id, "value")] = d($, z), K[S($.id, z.id, "show")] = $.hidden ? 0 : 1, K[S($.id, z.id, "highlight")] = 0, r && (K[S($.id, z.id, "pull")] = 0);
3190
+ const _ = ($, z) => I.keys($)?.length ? jo(I.keys($), z) : K[$], V = ($, z, U) => _(S($, z, "value"), U) * (o === "bar" ? _(S($, z, "show"), U) : 1) * w, ee = ($) => {
3191
+ const z = s[0].id, U = e.data.map((L) => Math.max(0, $(S(L.id, z, "value"))) * Math.max(0, Math.min(1, $(S(L.id, z, "show"))))), te = U.reduce((L, W) => L + W, 0), q = /* @__PURE__ */ new Map();
3192
3192
  let le = -Math.PI / 2;
3193
- return e.data.forEach((L, K) => {
3194
- const J = te > 0 ? Vl * U[K] / te : 0, he = le + J / 2, fe = Math.max(0, Math.min(1, $(S(L.id, z, "pull")))) * G.r * Xl;
3193
+ return e.data.forEach((L, W) => {
3194
+ const J = te > 0 ? Vl * U[W] / te : 0, he = le + J / 2, fe = Math.max(0, Math.min(1, $(S(L.id, z, "pull")))) * G.r * Xl;
3195
3195
  q.set(L.id, {
3196
3196
  start: le,
3197
3197
  sweep: J,
@@ -3214,7 +3214,7 @@ function $f(e) {
3214
3214
  if (!U) throw te(`write it ${z}: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 (!E.has(le)) throw te(`there is no "${le}" (data: ${[...E.keys()].join(", ")})`);
3217
- if (!i.has(L)) throw te(`there is no series "${L}" (series: ${s.map((K) => K.id).join(", ")})`);
3217
+ if (!i.has(L)) throw te(`there is no series "${L}" (series: ${s.map((W) => W.id).join(", ")})`);
3218
3218
  if (z === "label" && q >= 0) throw te("a label is one per datum: label:ID");
3219
3219
  if ((z === "bar" || z === "point" || z === "slice") && z !== f) throw te(`a ${o} chart has ${f}s, not ${z}s: ${f}:${le}`);
3220
3220
  return { kind: z, id: le, series: L };
@@ -3224,8 +3224,8 @@ function $f(e) {
3224
3224
  if ($.kind === "box") return me(0, 0, e.width, e.height);
3225
3225
  if ($.kind === "legend") return B.get($.series);
3226
3226
  if (r) {
3227
- const L = F(z).get($.id), K = Math.max(g * 1.5, G.r * 0.42);
3228
- if ($.kind === "slice") return me(L.centre.x - K / 2, L.centre.y - K / 2, K, K);
3227
+ const L = F(z).get($.id), W = Math.max(g * 1.5, G.r * 0.42);
3228
+ if ($.kind === "slice") return me(L.centre.x - W / 2, L.centre.y - W / 2, W, W);
3229
3229
  const J = C(L);
3230
3230
  return $.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
  }
@@ -3244,20 +3244,20 @@ function $f(e) {
3244
3244
  y: e.y,
3245
3245
  width: e.width,
3246
3246
  height: e.height,
3247
- props: W,
3247
+ props: K,
3248
3248
  about: {
3249
3249
  kind: `${o} chart`,
3250
3250
  summary: `A ${o} chart of ${e.data.length} values (${e.data.map(($) => $.id).join(", ")})${a ? ` in ${s.length} series (${s.map(($) => $.id).join(", ")})` : ""}${r ? "" : `, scaled to ${p}`}. Its ${f}s and labels are places in the scene (anchor()); its edits record tracks (edit(), tracks()).`,
3251
- props: Object.fromEntries(Object.keys(W).map(($) => [$, eh($)])),
3251
+ props: Object.fromEntries(Object.keys(K).map(($) => [$, eh($)])),
3252
3252
  actions: ft.edits
3253
3253
  },
3254
3254
  draw($, z) {
3255
- const U = z.props ?? {}, te = (L) => Number(U[L] ?? W[L] ?? 0);
3255
+ const U = z.props ?? {}, te = (L) => Number(U[L] ?? K[L] ?? 0);
3256
3256
  if ($.save(), $.fillStyle = t.background, Ms($, 0, 0, e.width, e.height, 8), $.fill(), $.font = `${g}px ${t.font}`, $.textBaseline = "middle", e.title && ($.fillStyle = t.text, $.textAlign = "left", $.font = `600 ${g * 1.2}px ${t.font}`, $.fillText(e.title, r ? g : m.left, g * 1.5), $.font = `${g}px ${t.font}`), b) {
3257
3257
  $.textAlign = "left";
3258
3258
  for (const L of s) {
3259
- const K = B.get(L.id);
3260
- $.fillStyle = c(L.id), Ms($, K.left, K.top + g * 0.25, g * 0.9, g * 0.9, 2), $.fill(), $.fillStyle = t.text, $.fillText(L.label ?? L.id, K.left + g * 1.3, K.top + K.height / 2);
3259
+ const W = B.get(L.id);
3260
+ $.fillStyle = c(L.id), Ms($, W.left, W.top + g * 0.25, g * 0.9, g * 0.9, 2), $.fill(), $.fillStyle = t.text, $.fillText(L.label ?? L.id, W.left + g * 1.3, W.top + W.height / 2);
3261
3261
  }
3262
3262
  }
3263
3263
  if (r) {
@@ -3266,16 +3266,16 @@ function $f(e) {
3266
3266
  }
3267
3267
  $.lineWidth = 1, $.textAlign = "right";
3268
3268
  for (let L = 0; L <= 4; L++) {
3269
- const K = m.bottom - A * L / 4;
3270
- $.strokeStyle = t.grid, $.beginPath(), $.moveTo(m.left, K), $.lineTo(m.right, K), $.stroke(), $.fillStyle = t.text, $.globalAlpha = 0.7, $.fillText(Zl(p * L / 4), m.left - g * 0.5, K), $.globalAlpha = 1;
3269
+ const W = m.bottom - A * L / 4;
3270
+ $.strokeStyle = t.grid, $.beginPath(), $.moveTo(m.left, W), $.lineTo(m.right, W), $.stroke(), $.fillStyle = t.text, $.globalAlpha = 0.7, $.fillText(Zl(p * L / 4), m.left - g * 0.5, W), $.globalAlpha = 1;
3271
3271
  }
3272
3272
  (O || T) && ($.fillStyle = t.text, $.textAlign = "center", $.globalAlpha = 0.85, O && ($.save(), $.translate(g * 0.9, (m.top + m.bottom) / 2), $.rotate(-Math.PI / 2), $.fillText(O, 0, 0), $.restore()), T && $.fillText(T, (m.left + m.right) / 2, m.bottom + g * 2.3), $.globalAlpha = 1);
3273
- const q = (L, K) => te(S(L, K, "value")) * (o === "bar" ? te(S(L, K, "show")) : 1) * w, le = (L, K) => Kn(c(K), t.highlight, te(S(L, K, "highlight")));
3273
+ const q = (L, W) => te(S(L, W, "value")) * (o === "bar" ? te(S(L, W, "show")) : 1) * w, le = (L, W) => Wn(c(W), t.highlight, te(S(L, W, "highlight")));
3274
3274
  if (o === "line") {
3275
3275
  $.lineWidth = Math.max(2, g * 0.2), $.lineJoin = "round", $.lineCap = "round";
3276
3276
  for (const L of s)
3277
- $.strokeStyle = c(L.id), $.beginPath(), e.data.forEach((K, J) => {
3278
- const he = { x: H(K.id), y: m.bottom - q(K.id, L.id) }, fe = te(S(K.id, L.id, "show"));
3277
+ $.strokeStyle = c(L.id), $.beginPath(), e.data.forEach((W, J) => {
3278
+ const he = { x: H(W.id), y: m.bottom - q(W.id, L.id) }, fe = te(S(W.id, L.id, "show"));
3279
3279
  if (J === 0) {
3280
3280
  fe > 0 && $.moveTo(he.x, he.y);
3281
3281
  return;
@@ -3288,12 +3288,12 @@ function $f(e) {
3288
3288
  }
3289
3289
  $.textAlign = "center";
3290
3290
  for (const L of e.data) {
3291
- for (const K of s) {
3292
- const J = o === "bar" ? j(L.id, K.id) : H(L.id), he = q(L.id, K.id), fe = te(S(L.id, K.id, "show"));
3293
- if ($.fillStyle = le(L.id, K.id), o === "bar" ? he > 0.5 && (Ql($, J - y / 2, m.bottom - he, y, he, Math.min(6, y / 4)), $.fill()) : fe > 0 && ($.beginPath(), $.arc(J, m.bottom - he, v * Math.min(1, fe * 1.5) * (1 + 0.3 * te(S(L.id, K.id, "highlight"))), 0, Math.PI * 2), $.fill()), e.values !== !1 && fe > 0) {
3294
- $.globalAlpha = Math.min(1, fe * 2), $.font = `600 ${a ? g * 0.85 : g}px ${t.font}`, $.fillStyle = Kn(t.text, t.highlight, te(S(L.id, K.id, "highlight")));
3291
+ for (const W of s) {
3292
+ const J = o === "bar" ? j(L.id, W.id) : H(L.id), he = q(L.id, W.id), fe = te(S(L.id, W.id, "show"));
3293
+ if ($.fillStyle = le(L.id, W.id), o === "bar" ? he > 0.5 && (Ql($, J - y / 2, m.bottom - he, y, he, Math.min(6, y / 4)), $.fill()) : fe > 0 && ($.beginPath(), $.arc(J, m.bottom - he, v * Math.min(1, fe * 1.5) * (1 + 0.3 * te(S(L.id, W.id, "highlight"))), 0, Math.PI * 2), $.fill()), e.values !== !1 && fe > 0) {
3294
+ $.globalAlpha = Math.min(1, fe * 2), $.font = `600 ${a ? g * 0.85 : g}px ${t.font}`, $.fillStyle = Wn(t.text, t.highlight, te(S(L.id, W.id, "highlight")));
3295
3295
  const pe = m.bottom - he - (o === "line" ? v : 0) - g * 0.95;
3296
- $.fillText(D(te(S(L.id, K.id, "value"))), J, pe), $.font = `${g}px ${t.font}`, $.globalAlpha = 1;
3296
+ $.fillText(D(te(S(L.id, W.id, "value"))), J, pe), $.font = `${g}px ${t.font}`, $.globalAlpha = 1;
3297
3297
  }
3298
3298
  }
3299
3299
  $.fillStyle = t.text, $.fillText(L.label ?? L.id, H(L.id), m.bottom + g * 1.1);
@@ -3306,11 +3306,11 @@ function $f(e) {
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 K = Z.get(q.id), J = K ? { x: z(`piece.${K.id}.x`), y: z(`piece.${K.id}.y`) } : { x: 0, y: 0 }, he = K ? z(`piece.${K.id}.rotate`) * Math.PI / 180 : 0, fe = K ? z(`piece.${K.id}.opacity`) : 1;
3309
+ const W = Z.get(q.id), J = W ? { x: z(`piece.${W.id}.x`), y: z(`piece.${W.id}.y`) } : { x: 0, y: 0 }, he = W ? z(`piece.${W.id}.rotate`) * Math.PI / 180 : 0, fe = W ? z(`piece.${W.id}.opacity`) : 1;
3310
3310
  if (fe <= 0) return;
3311
3311
  $.save(), $.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
- $.translate(L.centre.x + J.x, L.centre.y + J.y), $.rotate(he), $.translate(-L.centre.x, -L.centre.y), $.beginPath(), $.arc(pe.x, pe.y, G.r, L.start, L.start + L.sweep), Y > 0 ? $.arc(pe.x, pe.y, Y, L.start + L.sweep, L.start, !0) : $.lineTo(pe.x, pe.y), $.closePath(), $.fillStyle = Kn(t.palette[le % t.palette.length], t.highlight, z(S(q.id, U, "highlight"))), $.fill(), $.strokeStyle = t.background, $.lineWidth = Math.max(1.5, g * 0.15), $.stroke(), e.values !== !1 && L.sweep >= 0.3 && ($.fillStyle = t.background, $.font = `600 ${g}px ${t.font}`, $.textAlign = "center", $.fillText(D(z(S(q.id, U, "value"))), L.centre.x, L.centre.y), $.font = `${g}px ${t.font}`), $.restore();
3313
+ $.translate(L.centre.x + J.x, L.centre.y + J.y), $.rotate(he), $.translate(-L.centre.x, -L.centre.y), $.beginPath(), $.arc(pe.x, pe.y, G.r, L.start, L.start + L.sweep), Y > 0 ? $.arc(pe.x, pe.y, Y, L.start + L.sweep, L.start, !0) : $.lineTo(pe.x, pe.y), $.closePath(), $.fillStyle = Wn(t.palette[le % t.palette.length], t.highlight, z(S(q.id, U, "highlight"))), $.fill(), $.strokeStyle = t.background, $.lineWidth = Math.max(1.5, g * 0.15), $.stroke(), e.values !== !1 && L.sweep >= 0.3 && ($.fillStyle = t.background, $.font = `600 ${g}px ${t.font}`, $.textAlign = "center", $.fillText(D(z(S(q.id, U, "value"))), L.centre.x, L.centre.y), $.font = `${g}px ${t.font}`), $.restore();
3314
3314
  const ge = C(L), Ee = Math.cos(L.mid);
3315
3315
  $.globalAlpha = fe, $.fillStyle = t.text, $.textAlign = Ee > 0.2 ? "left" : Ee < -0.2 ? "right" : "center";
3316
3316
  const At = Ee > 0.2 ? ge.left : Ee < -0.2 ? ge.right : ge.left + ge.width / 2;
@@ -3335,8 +3335,8 @@ function $f(e) {
3335
3335
  if (U) return U;
3336
3336
  const te = { id: Z.size + 1, datum: z.id, home: X(ae(z, 0)) };
3337
3337
  Z.set(z.id, te);
3338
- for (const q of ["x", "y", "rotate"]) W[`piece.${te.id}.${q}`] = 0;
3339
- return W[`piece.${te.id}.opacity`] = 1, te;
3338
+ for (const q of ["x", "y", "rotate"]) K[`piece.${te.id}.${q}`] = 0;
3339
+ return K[`piece.${te.id}.opacity`] = 1, te;
3340
3340
  },
3341
3341
  edit($, z, U) {
3342
3342
  const te = Array.isArray(z) ? z : [z];
@@ -3349,11 +3349,11 @@ function $f(e) {
3349
3349
  return L;
3350
3350
  });
3351
3351
  for (const { id: le, series: L } of q) {
3352
- const K = (J) => S(le, L, J);
3352
+ const W = (J) => S(le, L, J);
3353
3353
  if ($ === "set") {
3354
3354
  if (typeof U.value != "number" || !Number.isFinite(U.value)) throw new Error("chart.edit: set needs `value`, a number");
3355
- I.tween(K("value"), _(K("value"), U.at), U.value, U, ql);
3356
- } else $ === "show" ? I.tween(K("show"), _(K("show"), U.at), U.on === !1 ? 0 : 1, U, Gl) : $ === "pull" ? I.tween(K("pull"), _(K("pull"), U.at), U.on === !1 ? 0 : 1, U, Ul) : I.tween(K("highlight"), _(K("highlight"), U.at), U.on === !1 ? 0 : 1, U, Yl);
3355
+ I.tween(W("value"), _(W("value"), U.at), U.value, U, ql);
3356
+ } else $ === "show" ? I.tween(W("show"), _(W("show"), U.at), U.on === !1 ? 0 : 1, U, Gl) : $ === "pull" ? I.tween(W("pull"), _(W("pull"), U.at), U.on === !1 ? 0 : 1, U, Ul) : I.tween(W("highlight"), _(W("highlight"), U.at), U.on === !1 ? 0 : 1, U, Yl);
3357
3357
  }
3358
3358
  return ie;
3359
3359
  },
@@ -3370,8 +3370,8 @@ function $f(e) {
3370
3370
  if (o !== "bar") return $;
3371
3371
  const te = e.data.flatMap(
3372
3372
  (q) => s.map((le) => {
3373
- const L = V(q.id, le.id, 0), K = [...Kt(I.keys(S(q.id, le.id, "value"))), ...Kt(I.keys(S(q.id, le.id, "show")))];
3374
- return { top: e.y + m.bottom - L, offset: (J) => L - V(q.id, le.id, J), windows: K };
3373
+ const L = V(q.id, le.id, 0), W = [...Wt(I.keys(S(q.id, le.id, "value"))), ...Wt(I.keys(S(q.id, le.id, "show")))];
3374
+ return { top: e.y + m.bottom - L, offset: (J) => L - V(q.id, le.id, J), windows: W };
3375
3375
  })
3376
3376
  );
3377
3377
  return xo($, z, { ground: U.ground, every: U.every ?? Qe, floors: te });
@@ -3389,7 +3389,7 @@ function Jl(e) {
3389
3389
  function Zl(e) {
3390
3390
  return Number.isInteger(e) ? String(e) : String(Number(e.toFixed(2)));
3391
3391
  }
3392
- function Kn(e, n, t) {
3392
+ function Wn(e, n, t) {
3393
3393
  if (t <= 0) return e;
3394
3394
  if (t >= 1) return n;
3395
3395
  const o = (s) => [1, 3, 5].map((i) => parseInt(s.slice(i, i + 2), 16));
@@ -3708,7 +3708,7 @@ const th = {
3708
3708
  label: "Girl",
3709
3709
  group: "family",
3710
3710
  scale: 0.66,
3711
- options: { build: "child", hair: { style: "bob", color: We.chestnut }, ears: !0, outfit: { shirt: "#e86a92", trousers: "#4a5b8c", bottom: "skirt" } }
3711
+ options: { build: "child", hair: { style: "bob", color: Ke.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 th = {
3720
3720
  label: "Young woman",
3721
3721
  group: "family",
3722
3722
  scale: 0.96,
3723
- options: { build: "slim", hair: { style: "highPonytail", color: We.auburn }, ears: !0, outfit: { shirt: "#f0b43c", trousers: "#36507a" } }
3723
+ options: { build: "slim", hair: { style: "highPonytail", color: Ke.auburn }, ears: !0, outfit: { shirt: "#f0b43c", trousers: "#36507a" } }
3724
3724
  },
3725
3725
  man: {
3726
3726
  label: "Man",
@@ -3732,7 +3732,7 @@ const th = {
3732
3732
  label: "Woman",
3733
3733
  group: "family",
3734
3734
  scale: 0.95,
3735
- options: { build: "curvy", hair: { style: "shoulderWaves", color: We.black }, ears: !0, outfit: { shirt: "#9b5fc0", trousers: "#2f2f3a", sleeves: "long" } }
3735
+ options: { build: "curvy", hair: { style: "shoulderWaves", color: Ke.black }, ears: !0, outfit: { shirt: "#9b5fc0", trousers: "#2f2f3a", sleeves: "long" } }
3736
3736
  },
3737
3737
  grandpa: {
3738
3738
  label: "Grandpa",
@@ -3740,8 +3740,8 @@ const th = {
3740
3740
  scale: 0.96,
3741
3741
  options: {
3742
3742
  build: "stocky",
3743
- hair: { style: "receding", color: We.gray },
3744
- facialHair: { style: "shortBoxed", color: We.white },
3743
+ hair: { style: "receding", color: Ke.gray },
3744
+ facialHair: { style: "shortBoxed", color: Ke.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 th = {
3751
3751
  label: "Grandma",
3752
3752
  group: "family",
3753
3753
  scale: 0.9,
3754
- options: { build: "short", hair: { style: "topBun", color: We.white }, glasses: "round", ears: !0, outfit: { shirt: "#5d9fa8", trousers: "#5a4a5e", sleeves: "long", bottom: "skirt" } }
3754
+ options: { build: "short", hair: { style: "topBun", color: Ke.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: We.black }, ears: !0, outfit: { shirt: "#8fb8d8", trousers: "#36507a", over: "labCoat", collar: !0 } }
3760
+ options: { build: "slim", hair: { style: "lowPonytail", color: Ke.black }, ears: !0, outfit: { shirt: "#8fb8d8", trousers: "#36507a", over: "labCoat", collar: !0 } }
3761
3761
  },
3762
3762
  cook: {
3763
3763
  label: "Cook",
@@ -3787,7 +3787,7 @@ const th = {
3787
3787
  label: "Farmer",
3788
3788
  group: "work",
3789
3789
  scale: 0.97,
3790
- options: { build: "stocky", hair: { style: "shoulderStraight", color: We.blond }, hat: "sunHat", ears: !0, outfit: { shirt: "#d64535", trousers: "#4f6b3a", sleeves: "long" } }
3790
+ options: { build: "stocky", hair: { style: "shoulderStraight", color: Ke.blond }, hat: "sunHat", ears: !0, outfit: { shirt: "#d64535", trousers: "#4f6b3a", sleeves: "long" } }
3791
3791
  },
3792
3792
  ...th,
3793
3793
  ...nh,
@@ -4500,7 +4500,7 @@ function Nf(e) {
4500
4500
  if (!e.summary) throw new Error("defineAction: give a `summary`: one line on what the figure does");
4501
4501
  return e;
4502
4502
  }
4503
- function Wf(e) {
4503
+ function Kf(e) {
4504
4504
  for (const n of ["swing", "knee", "arm", "elbow", "lean"])
4505
4505
  if (typeof e[n] != "number") throw new Error(`defineGait: \`${n}\` must be a number (degrees)`);
4506
4506
  if (e.cycle !== void 0 && !(e.cycle > 0)) throw new Error("defineGait: `cycle` is ms per two steps, above 0");
@@ -4530,7 +4530,7 @@ const Hs = {
4530
4530
  tired: 1500,
4531
4531
  shove: 1300,
4532
4532
  run: 560
4533
- }, _h = 450, Ch = 2.4, Nh = 160, Is = 2.5, Wh = 200, Kh = 340, Rh = 1.1, js = [380, 900], zh = 0.35, Zt = 300, Fn = 150, Fh = 260, Dh = 1.2, Dn = 160, xs = 400, It = 300, Lh = 450, _s = 500, Ln = 350, Cs = 150, Bh = 120, Bn = 180, Ns = 420, qh = 300, Ws = 300, Gh = 140, qn = 150, Ks = 450, Yh = 450, Gn = 150, Rs = 350, zs = 400, Uh = 12, Xh = 600, Fs = 90, Ds = 400, Vh = 200, Jh = 0.09, Ls = 350, Ce = 450, Yn = 1200, Zh = 700, dt = 320, Ne = 220, Qh = 65, ec = 700, Bs = (e) => e in nt, tc = (e) => e in Pe;
4533
+ }, _h = 450, Ch = 2.4, Nh = 160, Is = 2.5, Kh = 200, Wh = 340, Rh = 1.1, js = [380, 900], zh = 0.35, Zt = 300, Fn = 150, Fh = 260, Dh = 1.2, Dn = 160, xs = 400, It = 300, Lh = 450, _s = 500, Ln = 350, Cs = 150, Bh = 120, Bn = 180, Ns = 420, qh = 300, Ks = 300, Gh = 140, qn = 150, Ws = 450, Yh = 450, Gn = 150, Rs = 350, zs = 400, Uh = 12, Xh = 600, Fs = 90, Ds = 400, Vh = 200, Jh = 0.09, Ls = 350, Ce = 450, Yn = 1200, Zh = 700, dt = 320, Ne = 220, Qh = 65, ec = 700, Bs = (e) => e in nt, tc = (e) => e in Pe;
4534
4534
  function nc(e) {
4535
4535
  return Math.max(ec, Array.from(e).length * Qh);
4536
4536
  }
@@ -4547,20 +4547,20 @@ function No(e, n, t = {}) {
4547
4547
  const O = [{ time: 0, pose: g }], M = [{ time: 0, value: 0 }], m = [{ time: 0, value: 0 }], A = [{ time: 0, value: 0 }], P = [{ time: 0, value: 0 }], k = [{ time: 0, value: "walk" }], y = [{ time: 0, value: p }], v = [], w = [], E = [], H = (S, _, V, ee) => {
4548
4548
  g = { ...g, ..._ }, V && (g = gt(g, V)), O.push({ time: S, pose: g, ...ee === !1 ? { act: ee } : {} });
4549
4549
  }, x = (S, _, V) => (H(S + dt / 2, { turn: 0 }, V), y.push({ time: S + dt / 2, value: p }, { time: S + dt / 2 + 1, value: _ }), p = _, H(S + dt, { turn: 1 }), S + dt), j = (S) => S < f ? -1 : 1, R = (S, _, V) => j(_) !== p ? x(S, j(_), V) : S, G = (S, _, V, ee = "arm") => {
4550
- const F = ee === "arm", Q = Ke({ ...S, ...F ? { rightShoulder: 0, rightElbow: 0 } : { rightHip: 0, rightKnee: 0 } }, { height: d, facing: p }), ae = F ? Q.shoulders.right : Q.hip, C = 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(C.x - ae.x, C.y - ae.y)) % 360 + 360) % 360;
4550
+ const F = ee === "arm", Q = We({ ...S, ...F ? { rightShoulder: 0, rightElbow: 0 } : { rightHip: 0, rightKnee: 0 } }, { height: d, facing: p }), ae = F ? Q.shoulders.right : Q.hip, C = 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(C.x - ae.x, C.y - ae.y)) % 360 + 360) % 360;
4551
4551
  return Z > 270 ? Z - 360 : Z;
4552
4552
  }, Y = (S, _, V, ee) => {
4553
- const F = ee === "arm", Q = Ke({ ...S, ...F ? { rightShoulder: 90, rightElbow: 0, rightWrist: 0 } : { rightHip: 90, rightKnee: 0 } }, { height: d, facing: p }), ae = F ? Q.shoulders.right : Q.hip, C = 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(C.x - ae.x, C.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 = We({ ...S, ...F ? { rightShoulder: 90, rightElbow: 0, rightWrist: 0 } : { rightHip: 90, rightKnee: 0 } }, { height: d, facing: p }), ae = F ? Q.shoulders.right : Q.hip, C = 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(C.x - ae.x, C.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 = (S) => {
4556
- const _ = Ke(S, { height: d, facing: p });
4556
+ const _ = We(S, { 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 = (S, _, V) => {
4559
- const ee = { ...S, rightWrist: 0, rightElbow: 0, rightShoulder: G(S, _, 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 }, C = ne(ee), X = Math.hypot(ae.x - Q.x, ae.y - Q.y), D = Math.hypot(C.x - ae.x, C.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)));
4559
+ const ee = { ...S, rightWrist: 0, rightElbow: 0, rightShoulder: G(S, _, 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 }, C = ne(ee), X = Math.hypot(ae.x - Q.x, ae.y - Q.y), D = Math.hypot(C.x - ae.x, C.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
4560
  let $ = { rightShoulder: ee.rightShoulder, rightElbow: 0 }, z = 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 = { ...S, 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;
4563
+ const q = { rightShoulder: ee.rightShoulder + U * re, rightElbow: te * ie }, le = { ...S, 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
4564
  J < z && (z = J, $ = q);
4565
4565
  }
4566
4566
  return $;
@@ -4588,8 +4588,8 @@ function No(e, n, t = {}) {
4588
4588
  let D = C === f ? _ : R(_, C, S.mood);
4589
4589
  g.turn < 1 && (D += Ne, H(D, { turn: 1 }, S.mood));
4590
4590
  const Z = { leftShoulder: 35, rightShoulder: 35, leftElbow: -50, rightElbow: -50 };
4591
- H(D + Wh, { stretch: 0.75, bend: 12, leftHip: 22, rightHip: 22, ...Z }, S.mood, !1);
4592
- const se = D + Kh;
4591
+ H(D + Kh, { stretch: 0.75, bend: 12, leftHip: 22, rightHip: 22, ...Z }, S.mood, !1);
4592
+ const se = D + Wh;
4593
4593
  H(se - 40, { stretch: 0.72 }, void 0, !1), H(se, { stretch: 1.2, bend: -6, leftShoulder: 140, rightShoulder: 140, leftElbow: 20, rightElbow: 20, leftHip: 4, rightHip: 4 }, void 0, !1);
4594
4594
  const re = Math.hypot(C - f, X - u), ie = S.for ?? Math.min(js[1], Math.max(js[0], 300 + re * Rh)), $ = Math.min(u, X) - zh * d, z = Math.sqrt(u - $), U = Math.sqrt(X - $), te = se + ie * z / (z + U), q = se + ie;
4595
4595
  H(te, { stretch: 1, bend: 4, leftHip: -55, leftKnee: -80, rightHip: 55, rightKnee: 80, leftShoulder: 110, rightShoulder: 110 }, void 0, !1), H(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), H(q + 180, { stretch: 1.05, bend: -3 }, void 0, !1), H(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), M.push({ time: se, value: f - c }, { time: q, value: C - c }), m.push(
@@ -4598,7 +4598,7 @@ function No(e, n, t = {}) {
4598
4598
  { time: q, value: X - h, easing: "ease-in-quad" }
4599
4599
  ), f = C, u = X, E.push({ kind: "dust", time: q, x: f, y: u, length: 500 }), V = q + 340, ee = q;
4600
4600
  } else if (S.do === "point" && S.target) {
4601
- const C = S.target, X = R(_, C.x, S.mood), D = { ...g, ...S.mood ? Te[S.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(C.x - (f + Z.x)), re = C.y - (u + Z.y), ie = X + Ce;
4601
+ const C = S.target, X = R(_, C.x, S.mood), D = { ...g, ...S.mood ? Te[S.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(C.x - (f + Z.x)), re = C.y - (u + Z.y), ie = X + Ce;
4602
4602
  H(ie, { ...D, rightShoulder: G(D, C.x, C.y), lookX: 1, lookY: oc(re / Math.max(1, Math.hypot(se, re))) * 0.8 }), V = ie + (S.for ?? Yn), ee = ie, F = V;
4603
4603
  } else if (S.do === "swipe") {
4604
4604
  const C = S.target ?? { x: f + p * d * 0.5, y: u - d * 0.6 }, X = j(C.x), D = R(_, C.x, S.mood), Z = X === 1 ? C.left ?? C.x : C.right ?? C.x, se = X === 1 ? C.right ?? C.x : C.left ?? C.x, re = { ...g, turn: 1, lean: -10, bend: -8, rightElbow: 40, lookX: 1, ...Q };
@@ -4629,9 +4629,9 @@ function No(e, n, t = {}) {
4629
4629
  O.push({ time: Z, pose: g = { ...se, rightShoulder: G(se, f + p * d, u - d * 1.1) }, easing: "ease-in", act: !1 }), H(Z + Bn, { lean: 18, bend: 14, rightShoulder: 55, stretch: 1 }, void 0, !1), H(Z + Bn + Ns, { lean: 0, bend: 0, rightShoulder: de.rightShoulder, rightElbow: de.rightElbow, lookY: 0 }), V = Z + Bn + Ns, ee = Z, F = Z;
4630
4630
  } else if (S.do === "kick" && S.target) {
4631
4631
  const C = S.target, X = R(_, C.x, S.mood), D = { ...g, turn: 1, lean: -12, bend: -6, rightKnee: 0, leftShoulder: 100, rightShoulder: 70 }, Z = I(X, Y(D, C.x, C.y, "leg"), qh), se = { leftShoulder: 70, rightShoulder: 50, leftElbow: -20, rightElbow: 20 };
4632
- H(Z + Ws, { turn: 1, lean: 8, bend: 6, rightHip: -40, rightKnee: 80, lookX: 1, lookY: 0.7, ...se, ...Q }, S.mood, !1);
4633
- const re = Z + Ws + Gh, ie = G(D, C.x, C.y, "leg");
4634
- O.push({ time: re, pose: g = { ...g, ...D, rightHip: ie }, easing: "ease-in", act: !1 }), H(re + qn, { lean: -15, rightHip: ie + 20 }, void 0, !1), H(re + qn + Ks, {
4632
+ H(Z + Ks, { turn: 1, lean: 8, bend: 6, rightHip: -40, rightKnee: 80, lookX: 1, lookY: 0.7, ...se, ...Q }, S.mood, !1);
4633
+ const re = Z + Ks + Gh, ie = G(D, C.x, C.y, "leg");
4634
+ O.push({ time: re, pose: g = { ...g, ...D, rightHip: ie }, easing: "ease-in", act: !1 }), H(re + qn, { lean: -15, rightHip: ie + 20 }, void 0, !1), H(re + qn + Ws, {
4635
4635
  lean: 0,
4636
4636
  bend: 0,
4637
4637
  rightHip: de.rightHip,
@@ -4641,22 +4641,22 @@ function No(e, n, t = {}) {
4641
4641
  leftElbow: de.leftElbow,
4642
4642
  rightElbow: de.rightElbow,
4643
4643
  lookY: 0
4644
- }), V = re + qn + Ks, ee = re;
4644
+ }), V = re + qn + Ws, ee = re;
4645
4645
  } else if (S.do === "put" && S.target) {
4646
4646
  const C = S.target, X = R(_, C.x, S.mood), D = C.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 = I(X, Y(Z, C.x, C.y, "arm"), It) + Yh;
4647
4647
  H(re, { ...Z, rightShoulder: G(Z, C.x, C.y) }, S.mood, !1), H(re + Gn, {}, void 0, !1), H(re + Gn + Rs, { bend: 0, lean: 0, stretch: 1, rightShoulder: de.rightShoulder, rightElbow: de.rightElbow, lookY: 0 }), V = re + Gn + Rs, ee = re;
4648
4648
  } else if (S.do === "write" && S.target) {
4649
4649
  const C = S.target, X = C.left ?? C.x, D = C.right ?? C.x, Z = R(_, (X + D) / 2, S.mood), se = { ...g, turn: 1, rightElbow: 0, rightWrist: 0, ...Te.thinking, lookX: 1, lookY: 0, ...Q }, re = (L) => Y(se, L, C.y, "arm") + p * d * 0.08, ie = (L) => {
4650
- const K = ne({ ...se, ...B(se, L, C.y), rightWrist: 0 });
4651
- return Math.hypot(K.x - L, K.y - C.y) < 2;
4650
+ const W = ne({ ...se, ...B(se, L, C.y), rightWrist: 0 });
4651
+ return Math.hypot(W.x - L, W.y - C.y) < 2;
4652
4652
  }, $ = p === 1 ? X : D, z = I(Z, re((X + D) / 2), It), U = !ie(X) || !ie(D), te = U ? I(z, re(X), It) + zs : z + zs;
4653
4653
  H(te, { ...se, ...B(se, U ? X : $, C.y) }, S.mood, !1);
4654
4654
  const q = S.for ?? Math.max(Xh, Math.abs(D - X) * Uh);
4655
4655
  U && M.push({ time: te, value: f - c });
4656
- for (let L = Fs, K = 0; L <= q; L += Fs, K++) {
4656
+ for (let L = Fs, W = 0; L <= q; L += Fs, W++) {
4657
4657
  const J = X + (D - X) * Math.min(L, q) / q;
4658
4658
  U && (f = re(J), M.push({ time: te + L, value: f - c }));
4659
- const he = (K % 2 === 0 ? -1 : 1) * d * 0.02;
4659
+ const he = (W % 2 === 0 ? -1 : 1) * d * 0.02;
4660
4660
  H(te + L, B(se, J, C.y + he), void 0, !1);
4661
4661
  }
4662
4662
  const le = te + q;
@@ -4695,7 +4695,7 @@ function No(e, n, t = {}) {
4695
4695
  }
4696
4696
  S.onto !== void 0 && S.do !== "leap" && S.onto !== u && (m.push({ time: _, value: u - h }, { time: V, value: S.onto - h, easing: "ease-in-out" }), u = S.onto), V > O[O.length - 1].time && O.push({ time: V, pose: g }), w.push({ start: _, end: V, ...ee !== void 0 ? { contact: ee } : {}, ...F !== void 0 ? { release: F } : {} }), T = V;
4697
4697
  }
4698
- const N = Eh(e, ac(O), t), W = [
4698
+ const N = Eh(e, ac(O), t), K = [
4699
4699
  { id: `${e}-x`, target: e, property: "x", keyframes: M },
4700
4700
  { id: `${e}-y`, target: e, property: "y", keyframes: m },
4701
4701
  { id: `${e}-walk`, target: e, property: "walk", keyframes: A },
@@ -4707,7 +4707,7 @@ function No(e, n, t = {}) {
4707
4707
  S.property === "facing" && S.keyframes[0].value === -1
4708
4708
  );
4709
4709
  return {
4710
- tracks: [...Io(e, N, v, { energy: t.energy }), ...W],
4710
+ tracks: [...Io(e, N, v, { energy: t.energy }), ...K],
4711
4711
  duration: T,
4712
4712
  lines: v,
4713
4713
  keys: O,
@@ -4741,7 +4741,7 @@ function er(e, n, t) {
4741
4741
  return i;
4742
4742
  }
4743
4743
  const Nt = ["start", "contact", "release", "end"], ic = ["surface", "edit", "anchor", "at", "until"], lc = ["carry"], on = (e) => !!e && typeof e == "object" && !Array.isArray(e) && "surface" in e && "anchor" in e, hc = (e) => e.then === void 0 ? [] : Array.isArray(e.then) ? e.then : [e.then];
4744
- function Kf(e, n, t, o = {}) {
4744
+ function Wf(e, n, t, o = {}) {
4745
4745
  const r = cc(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:
@@ -4928,7 +4928,7 @@ function zf(e, n, t, o = {}) {
4928
4928
  return { tracks: g ? [...u, ...p, Mc(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 gc(e) {
4931
- const n = ya({ "arm.left.spread": 90, "arm.left.elbow": 0, "arm.left.bend": 0, "leg.left.knee": 0 }), t = xe(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);
4931
+ const n = ya({ "arm.left.spread": 90, "arm.left.elbow": 0, "arm.left.bend": 0, "leg.left.knee": 0 }), t = xe(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);
4932
4932
  return { arm: l > 0 ? o / l : 1, leg: c > 0 ? r / c : 1 };
4933
4933
  }
4934
4934
  const pc = { point: "arm", grab: "arm", put: "arm", write: "arm", swipe: "arm", push: "arm", kick: "leg" }, mc = /* @__PURE__ */ new Set(["point", "grab", "put", "kick"]);
@@ -4945,7 +4945,7 @@ function bc(e, n, t, o, r, a, s) {
4945
4945
  const p = u.contact, g = u.release ?? u.contact;
4946
4946
  e.forEach((b, T) => {
4947
4947
  if (b.time < p - 1 || b.time > g + 1) return;
4948
- const O = a(b.time), M = Ke(n[T], { height: r.height, facing: O < 0 ? -1 : 1 }), m = c(b.time), A = mc.has(h.do) && h.target ? { x: h.target.x - m.x, y: h.target.y - m.y } : void 0, P = { x: (M.hands.right.x + M.fingertips.right.x) / 2, y: (M.hands.right.y + M.fingertips.right.y) / 2 }, k = A ?? (f === "arm" ? P : M.toes.right), y = O < 0 ? "right" : "left", v = `${f}.${y}`;
4948
+ const O = a(b.time), M = We(n[T], { height: r.height, facing: O < 0 ? -1 : 1 }), m = c(b.time), A = mc.has(h.do) && h.target ? { x: h.target.x - m.x, y: h.target.y - m.y } : void 0, P = { x: (M.hands.right.x + M.fingertips.right.x) / 2, y: (M.hands.right.y + M.fingertips.right.y) / 2 }, k = A ?? (f === "arm" ? P : M.toes.right), y = O < 0 ? "right" : "left", v = `${f}.${y}`;
4949
4949
  let w = b.pose;
4950
4950
  if (h.do === "point")
4951
4951
  w = Ge(r, w, v, k);
@@ -4996,7 +4996,7 @@ const Ue = (e) => Math.min(1, Math.max(0, Number.isFinite(e) ? e : 0)), _e = (e)
4996
4996
  const n = Ue(e);
4997
4997
  return n * n * (3 - 2 * n);
4998
4998
  }, $e = (e, n, t) => t <= 0 ? e >= n ? 1 : 0 : Ue((e - n) / t);
4999
- function Wo(e) {
4999
+ function Ko(e) {
5000
5000
  const n = Ue(e);
5001
5001
  if (n === 0 || n === 1) return n;
5002
5002
  const t = 1.70158, o = n - 1;
@@ -5015,7 +5015,7 @@ function je(e, n) {
5015
5015
  return a ? `rgba(${a[1]},${a[2]},${a[3]},${Gs(t * (a[4] === void 0 ? 1 : Number(a[4])))})` : o;
5016
5016
  }
5017
5017
  const Gs = (e) => Math.round(e * 1e3) / 1e3;
5018
- function Ko(e, n, t) {
5018
+ function Wo(e, n, t) {
5019
5019
  const o = [];
5020
5020
  for (const r of n.split(`
5021
5021
  `)) {
@@ -5098,7 +5098,7 @@ function Yf(e, n = 0.18) {
5098
5098
  const Tt = "#d7263d", nr = "#f5b942", Ro = "#efe6d2", at = "#111111";
5099
5099
  function Tc(e, n) {
5100
5100
  const t = n.duration ?? 3e3;
5101
- return e >= n.at && e <= n.at + t ? { opacity: Ue(Wo($e(e, n.at, 300))) * (1 - _e($e(e, n.at + t - 400, 400))), scale: 1 + 0.08 * Math.sin((e - n.at) / 1e3 * 7) } : { opacity: 0, scale: 1 };
5101
+ return e >= n.at && e <= n.at + t ? { opacity: Ue(Ko($e(e, n.at, 300))) * (1 - _e($e(e, n.at + t - 400, 400))), scale: 1 + 0.08 * Math.sin((e - n.at) / 1e3 * 7) } : { opacity: 0, scale: 1 };
5102
5102
  }
5103
5103
  function Uf(e, n, t) {
5104
5104
  const { opacity: o, scale: r } = Tc(n, t);
@@ -5168,7 +5168,7 @@ function Qf(e, n, t) {
5168
5168
  if (o <= 0 || !t.text) return 0;
5169
5169
  const a = t.x ?? 150, s = t.width ?? 1620, i = t.bottom ?? 1040, l = t.size ?? 42, c = t.font ?? ot, h = t.ink ?? at, d = l * 1.29;
5170
5170
  e.save(), e.font = Se(l, 700, c);
5171
- const f = Ko(e, t.text, s - l * 1.4), u = i - f.length * d - l * 0.72;
5171
+ const f = Wo(e, t.text, s - l * 1.4), u = i - f.length * d - l * 0.72;
5172
5172
  if (e.globalAlpha *= o, Oe(e, a, u, s, i - u, 6), e.fillStyle = t.background ?? je("rgb(239,230,210)", 0.96), e.fill(), e.strokeStyle = h, e.lineWidth = 5, e.stroke(), t.speaker) {
5173
5173
  e.font = Se(l * 0.57, 800, c);
5174
5174
  const g = e.measureText(t.speaker).width + l * 1.4;
@@ -5182,11 +5182,11 @@ function Qf(e, n, t) {
5182
5182
  }), e.restore(), o;
5183
5183
  }
5184
5184
  function eu(e, n, t) {
5185
- const o = t.start - 50, r = t.end + 300, a = Wo($e(n, o, 280)) * (1 - _e($e(n, r, 220)));
5185
+ const o = t.start - 50, r = t.end + 300, a = Ko($e(n, o, 280)) * (1 - _e($e(n, r, 220)));
5186
5186
  if (!(n >= o && n <= r + 220) || a <= 0.01) return 0;
5187
5187
  const s = t.size ?? 40, i = t.font ?? ot, l = t.ink ?? at, c = t.fill ?? "#ffffff", h = t.bounds ?? { x: 40, y: 40, width: 1840 }, d = t.tail;
5188
5188
  e.save(), e.font = Se(s, 700, i);
5189
- const f = Ko(e, t.text, t.maxWidth ?? 640), u = s * 1.3, p = Math.max(...f.map((A) => e.measureText(A).width)) + s * 1.75, g = f.length * u + s * 1.25, b = t.speaker ? s * 0.5 : 0, T = Math.min(h.x + h.width - p / 2, Math.max(h.x + p / 2, d.x));
5189
+ const f = Wo(e, t.text, t.maxWidth ?? 640), u = s * 1.3, p = Math.max(...f.map((A) => e.measureText(A).width)) + s * 1.75, g = f.length * u + s * 1.25, b = t.speaker ? s * 0.5 : 0, T = Math.min(h.x + h.width - p / 2, Math.max(h.x + p / 2, d.x));
5190
5190
  let O = Math.min(d.y - (t.gap ?? 70) - g / 2, t.maxCenterY ?? 1 / 0);
5191
5191
  O = Math.max(h.y + b + g / 2, O);
5192
5192
  const M = { x: d.x + (T - d.x) * 0.2, y: Math.max(O + g / 2 + 16, d.y - 14) };
@@ -5319,7 +5319,7 @@ function nu(e, n, t, o = {}) {
5319
5319
  for (let f = 0; f < h; f++)
5320
5320
  e.beginPath(), e.arc(r + c.next() * s, a + c.next() * i, 2 + c.next() * 2, 0, Math.PI * 2), e.fill();
5321
5321
  e.restore(), Oe(e, r, a, s, i, 10), e.lineWidth = 22, e.strokeStyle = n.frame, e.stroke();
5322
- const d = (f) => t >= f.at ? Wo($e(t, f.at, 350)) : 0;
5322
+ const d = (f) => t >= f.at ? Ko($e(t, f.at, 350)) : 0;
5323
5323
  for (const f of n.strings) {
5324
5324
  const u = _e($e(t, f.at, f.duration));
5325
5325
  if (u <= 0 || d(zo(n, f.from)) <= 0) continue;
@@ -5340,7 +5340,7 @@ function nu(e, n, t, o = {}) {
5340
5340
  const m = [f.title, f.note].filter(Boolean).join(`
5341
5341
  `);
5342
5342
  e.font = Se(26, 700, n.handFont), e.fillStyle = l;
5343
- const A = Ko(e, m, p - 20), P = o.drawCard ? O + 8 : (g - A.length * 30) / 2;
5343
+ const A = Wo(e, m, p - 20), P = o.drawCard ? O + 8 : (g - A.length * 30) / 2;
5344
5344
  A.forEach((k, y) => e.fillText(k, 0, P + 24 + y * 30, p - 12));
5345
5345
  }
5346
5346
  f.highlight && t >= f.highlight.at && t <= f.highlight.at + f.highlight.duration && (e.strokeStyle = nr, 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();
@@ -5443,7 +5443,7 @@ function Qt(e, n, t, o) {
5443
5443
  r(s) && a.push(s);
5444
5444
  }), a.length >= 3 ? a : [];
5445
5445
  }
5446
- function Wc(e, n, t) {
5446
+ function Kc(e, n, t) {
5447
5447
  const o = e.faces.map((s) => ({ points: s.corners.map((i) => e.vertices[i]), normal: s.normal })), r = [], a = { x: n.slice(1, -1), z: t.slice(1, -1) };
5448
5448
  for (let s = 0; s + 1 < n.length; s++)
5449
5449
  for (let i = 0; i + 1 < t.length; i++) {
@@ -5460,7 +5460,7 @@ function Wc(e, n, t) {
5460
5460
  }
5461
5461
  return r;
5462
5462
  }
5463
- const Kc = /* @__PURE__ */ new WeakMap(), Rc = /* @__PURE__ */ new WeakMap(), zc = 48, ar = (e) => e.map((n) => Math.round(n * 1e5)).join(",");
5463
+ const Wc = /* @__PURE__ */ new WeakMap(), Rc = /* @__PURE__ */ new WeakMap(), zc = 48, ar = (e) => e.map((n) => Math.round(n * 1e5)).join(",");
5464
5464
  function rr(e, n, t, o) {
5465
5465
  let r = e.get(n);
5466
5466
  r || e.set(n, r = /* @__PURE__ */ new Map());
@@ -5469,7 +5469,7 @@ function rr(e, n, t, o) {
5469
5469
  }
5470
5470
  function Fo(e, n) {
5471
5471
  const t = ar(n);
5472
- return rr(Kc, e, t, () => {
5472
+ return rr(Wc, e, t, () => {
5473
5473
  const o = Nc(e, n), r = [1 / 0, 1 / 0, 1 / 0], a = [-1 / 0, -1 / 0, -1 / 0];
5474
5474
  for (const s of o.vertices) for (const i of [0, 1, 2])
5475
5475
  r[i] = Math.min(r[i], s[i]), a[i] = Math.max(a[i], s[i]);
@@ -5485,7 +5485,7 @@ function Fc(e, n) {
5485
5485
  const f = [(h.low[0] + h.high[0]) / 2, (h.low[1] + h.high[1]) / 2, (h.low[2] + h.high[2]) / 2];
5486
5486
  return [{ part: h.part, mesh: h.mesh, cut: !1, cell: Cc(a, s, f) }];
5487
5487
  }
5488
- return rr(Rc, h.inSpace, i, () => Wc(h.inSpace, a, s)).map((f) => ({ part: h.part, mesh: f.mesh, cut: !0, cell: f.cell }));
5488
+ return rr(Rc, h.inSpace, i, () => Kc(h.inSpace, a, s)).map((f) => ({ part: h.part, mesh: f.mesh, cut: !0, cell: f.cell }));
5489
5489
  }), c = (o[1] + r[1]) / 2;
5490
5490
  return { pieces: l, middle: ([h, d]) => [(a[h] + a[h + 1]) / 2, c, (s[d] + s[d + 1]) / 2] };
5491
5491
  }
@@ -5548,7 +5548,7 @@ const Dt = {
5548
5548
  }, po = Math.PI / 180;
5549
5549
  function Bc(e, n, t) {
5550
5550
  return {
5551
- toView: (o) => Wr(da(o, e * 90 * po), -n * po),
5551
+ toView: (o) => Kr(da(o, e * 90 * po), -n * po),
5552
5552
  toScreen: (o) => ({ x: o[0] * t, y: -o[1] * t })
5553
5553
  };
5554
5554
  }
@@ -5600,45 +5600,45 @@ const Vn = (() => {
5600
5600
  })(), qc = Math.cos(35 * po);
5601
5601
  function hr(e, n, t, o, r = {}) {
5602
5602
  const a = e.derive ? { ...n, ...e.derive(n) } : n, s = Do(e, a), i = t.toView([0, 0, 0]), l = (j) => (R) => [j[0] * R[0] + j[4] * R[1] + j[8] * R[2], j[1] * R[0] + j[5] * R[1] + j[9] * R[2], j[2] * R[0] + j[6] * R[1] + j[10] * R[2]], c = Rt(e, a), h = r.slice === void 0 ? null : oe.invert(c), d = h ? e.parts.map((j) => ({ part: j, mesh: an(j.shape), local: oe.multiply(h, s.get(j.id)), whole: j.shape.type === "tube" })) : void 0, f = d ? Fc(d, r.slice) : void 0, u = d ? ir(d.map((j) => ({ part: j.part.id, mesh: j.mesh, ...Fo(j.mesh, j.local) }))) : void 0, p = (j, R, G, Y) => {
5603
- const ne = (K) => t.toView(oe.transformPoint(G, K)), B = R.vertices.map(ne), I = B.map((K) => t.toScreen(K)), N = r.perspective ? r.near : void 0, W = (K) => K.map((J) => t.toScreen(J)), S = (K) => N === void 0 ? K : Ys(K, N), _ = (K) => N === void 0 ? [K] : _c(K, N), V = l(G), ee = R.faces.map((K) => {
5604
- const J = t.toView(V(K.normal)), he = [J[0] - i[0], J[1] - i[1], J[2] - i[2]], fe = Math.hypot(...he) || 1;
5603
+ const ne = (W) => t.toView(oe.transformPoint(G, W)), B = R.vertices.map(ne), I = B.map((W) => t.toScreen(W)), N = r.perspective ? r.near : void 0, K = (W) => W.map((J) => t.toScreen(J)), S = (W) => N === void 0 ? W : Ys(W, N), _ = (W) => N === void 0 ? [W] : _c(W, N), V = l(G), ee = R.faces.map((W) => {
5604
+ const J = t.toView(V(W.normal)), he = [J[0] - i[0], J[1] - i[1], J[2] - i[2]], fe = Math.hypot(...he) || 1;
5605
5605
  return [he[0] / fe, he[1] / fe, he[2] / fe];
5606
- }), F = u && Y ? lr(j.id, R, Y, ar(Y), u) : void 0, Q = (K) => F?.[K] ?? !1, ae = ee.map((K, J) => {
5606
+ }), F = u && Y ? lr(j.id, R, Y, ar(Y), u) : void 0, Q = (W) => F?.[W] ?? !1, ae = ee.map((W, J) => {
5607
5607
  if (Q(J)) return !1;
5608
- if (!r.perspective) return K[2] > 1e-6;
5608
+ if (!r.perspective) return W[2] > 1e-6;
5609
5609
  const fe = R.faces[J].corners.reduce((pe, ge) => [pe[0] + B[ge][0], pe[1] + B[ge][1], pe[2] + B[ge][2]], [0, 0, 0]);
5610
- return -(K[0] * fe[0] + K[1] * fe[1] + K[2] * fe[2]) > 1e-9;
5611
- }), C = (K) => R.faces[K].corners.reduce((J, he) => J + B[he][2], 0) / R.faces[K].corners.length, X = R.faces.map((K, J) => ({ face: K, i: J })).filter(({ i: K }) => ae[K]).map(({ face: K, i: J }) => ({
5610
+ return -(W[0] * fe[0] + W[1] * fe[1] + W[2] * fe[2]) > 1e-9;
5611
+ }), C = (W) => R.faces[W].corners.reduce((J, he) => J + B[he][2], 0) / R.faces[W].corners.length, X = R.faces.map((W, J) => ({ face: W, i: J })).filter(({ i: W }) => ae[W]).map(({ face: W, i: J }) => ({
5612
5612
  i: J,
5613
5613
  solved: {
5614
- points: N === void 0 ? K.corners.map((he) => I[he]) : W(S(K.corners.map((he) => B[he]))),
5614
+ points: N === void 0 ? W.corners.map((he) => I[he]) : K(S(W.corners.map((he) => B[he]))),
5615
5615
  depth: C(J),
5616
5616
  tone: 0.72 + 0.33 * Math.max(0, ee[J][0] * Vn[0] + ee[J][1] * Vn[1] + ee[J][2] * Vn[2])
5617
5617
  }
5618
- })).filter((K) => K.solved.points.length >= 3).sort((K, J) => K.solved.depth - J.solved.depth);
5618
+ })).filter((W) => W.solved.points.length >= 3).sort((W, J) => W.solved.depth - J.solved.depth);
5619
5619
  if (r.light) {
5620
- const K = l(G);
5620
+ const W = l(G);
5621
5621
  for (const { i: J, solved: he } of X) {
5622
5622
  const fe = R.faces[J].corners, pe = fe.reduce((Pn, vr) => {
5623
5623
  const On = oe.transformPoint(G, R.vertices[vr]);
5624
5624
  return [Pn[0] + On[0] / fe.length, Pn[1] + On[1] / fe.length, Pn[2] + On[2] / fe.length];
5625
- }, [0, 0, 0]), ge = K(R.faces[J].normal), Ee = Math.hypot(...ge) || 1, At = r.light(pe, [ge[0] / Ee, ge[1] / Ee, ge[2] / Ee]);
5625
+ }, [0, 0, 0]), ge = W(R.faces[J].normal), Ee = Math.hypot(...ge) || 1, At = r.light(pe, [ge[0] / Ee, ge[1] / Ee, ge[2] / Ee]);
5626
5626
  he.light = At.light, he.fog = At.fog;
5627
5627
  }
5628
5628
  }
5629
- const D = X.map((K) => K.solved), Z = Gc(R), se = [], re = [];
5630
- for (const [K, J] of Z) {
5629
+ const D = X.map((W) => W.solved), Z = Gc(R), se = [], re = [];
5630
+ for (const [W, J] of Z) {
5631
5631
  const he = J.filter((pe) => ae[pe]).length;
5632
5632
  if (he === 0) continue;
5633
5633
  const fe = J.length === 2 && he === 2 && R.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] < qc;
5634
- J.length === 1 && (R.joined || Xc(R, K)) || (J.length === 1 || he === 1 || fe) && (se.push(K.split("-").map(Number)), re.push(J.filter((pe) => ae[pe]).reduce((pe, ge) => C(ge) > C(pe) ? ge : pe)));
5634
+ J.length === 1 && (R.joined || Xc(R, W)) || (J.length === 1 || he === 1 || fe) && (se.push(W.split("-").map(Number)), re.push(J.filter((pe) => ae[pe]).reduce((pe, ge) => C(ge) > C(pe) ? ge : pe)));
5635
5635
  }
5636
- const ie = (K) => R.faces.findIndex((J) => J.corners.length > 4 && Math.sign(Jc(R.vertices[K], J.normal)) > 0), $ = (R.marks ?? []).filter(([K]) => ie(K) < 0 || ae[ie(K)]), z = ([K, J]) => N === void 0 ? [[I[K], I[J]]] : _([B[K], B[J]]).map(W), U = $.flatMap(z), te = (K) => N === void 0 ? [K.map((J) => I[J])] : _(K.map((J) => B[J])).map(W);
5636
+ const ie = (W) => R.faces.findIndex((J) => J.corners.length > 4 && Math.sign(Jc(R.vertices[W], J.normal)) > 0), $ = (R.marks ?? []).filter(([W]) => ie(W) < 0 || ae[ie(W)]), z = ([W, J]) => N === void 0 ? [[I[W], I[J]]] : _([B[W], B[J]]).map(K), U = $.flatMap(z), te = (W) => N === void 0 ? [W.map((J) => I[J])] : _(W.map((J) => B[J])).map(K);
5637
5637
  if (r.slice !== void 0) {
5638
- const K = /* @__PURE__ */ new Map();
5639
- se.forEach((J, he) => K.set(re[he], [...K.get(re[he]) ?? [], J]));
5638
+ const W = /* @__PURE__ */ new Map();
5639
+ se.forEach((J, he) => W.set(re[he], [...W.get(re[he]) ?? [], J]));
5640
5640
  for (const { i: J, solved: he } of X) {
5641
- he.edges = ta(K.get(J) ?? []).flatMap(te);
5641
+ he.edges = ta(W.get(J) ?? []).flatMap(te);
5642
5642
  const fe = R.faces[J].corners;
5643
5643
  he.center = fe.reduce((ge, Ee) => [ge[0] + B[Ee][0] / fe.length, ge[1] + B[Ee][1] / fe.length, ge[2] + B[Ee][2] / fe.length], [0, 0, 0]), he.normal = ee[J];
5644
5644
  const pe = X[X.length - 1].i;
@@ -5648,13 +5648,13 @@ function hr(e, n, t, o, r = {}) {
5648
5648
  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;
5649
5649
  return {
5650
5650
  part: j,
5651
- depth: B.reduce((K, J) => K + J[2], 0) / Math.max(1, B.length),
5651
+ depth: B.reduce((W, J) => W + J[2], 0) / Math.max(1, B.length),
5652
5652
  faces: D,
5653
5653
  edges: ta(se).flatMap(te),
5654
5654
  marks: U,
5655
5655
  glow: q,
5656
5656
  opacity: L,
5657
- ...j.shape.type === "tube" ? { spine: Vc(_(j.shape.points.map(ne)).map(W)) } : {},
5657
+ ...j.shape.type === "tube" ? { spine: Vc(_(j.shape.points.map(ne)).map(K)) } : {},
5658
5658
  ...R.walls ? { cut: !0 } : {}
5659
5659
  };
5660
5660
  }, g = new Map(d?.map((j) => [j.part.id, j.local])), T = (f ? f.pieces.map((j) => ({
@@ -5907,10 +5907,10 @@ function su(e, n = {}) {
5907
5907
  if (H.size === 0) return me(w.x - e.width / 2, w.y - e.height, e.width, e.height);
5908
5908
  return x(H, `the parts control "${y.name}" moves are`);
5909
5909
  function x(j, R) {
5910
- const G = [...E.under, ...E.over].filter((N) => j.has(N.part.id)).flatMap((N) => N.faces.flatMap((W) => W.points));
5910
+ const G = [...E.under, ...E.over].filter((N) => j.has(N.part.id)).flatMap((N) => N.faces.flatMap((K) => K.points));
5911
5911
  if (G.length === 0) {
5912
5912
  const N = Number.isFinite(k) ? `at ${k} ms` : "after its edits";
5913
- throw new Error(`${t.kind}: ${R} turned away from the viewer ${N}; aim at an anchor (${a.map((W) => `anchor:${W}`).join(", ") || "none"}) or box`);
5913
+ throw new Error(`${t.kind}: ${R} turned away from the viewer ${N}; aim at an anchor (${a.map((K) => `anchor:${K}`).join(", ") || "none"}) or box`);
5914
5914
  }
5915
5915
  const Y = G.map((N) => N.x), ne = G.map((N) => N.y), B = Math.min(...Y), I = Math.min(...ne);
5916
5916
  return me(w.x + B, w.y + I, Math.max(...Y) - B, Math.max(...ne) - I);
@@ -5981,8 +5981,8 @@ function su(e, n = {}) {
5981
5981
  },
5982
5982
  ride(P, k, y) {
5983
5983
  const v = [
5984
- ...r.flatMap((E) => Kt(i.keys(E))),
5985
- ...(n.tracks ?? []).flatMap((E) => Kt(E.keyframes.filter((H) => typeof H.value == "number")))
5984
+ ...r.flatMap((E) => Wt(i.keys(E))),
5985
+ ...(n.tracks ?? []).flatMap((E) => Wt(E.keyframes.filter((H) => typeof H.value == "number")))
5986
5986
  ];
5987
5987
  if (v.length === 0) return P;
5988
5988
  const w = [...a.map((E) => `anchor:${E}`), ...s.map((E) => `part:${E}`)].flatMap((E) => {
@@ -7158,7 +7158,7 @@ function rt(e) {
7158
7158
  // The neck tapers from the shoulders up to the head.
7159
7159
  { id: "neck", shape: { type: "tube", points: e.neck.points, radius: e.neck.points.map((d, f, u) => e.neck.radius * (1.25 - 0.4 * f / Math.max(1, u.length - 1))), segments: 12 }, at: e.neck.at, fill: t.coat },
7160
7160
  { id: "head", parent: "neck", shape: { type: "ellipsoid", radii: e.head.radii, segments: 14 }, at: e.head.at, rotate: e.head.rotate, fill: t.coat },
7161
- ...W0(e, t, r)
7161
+ ...K0(e, t, r)
7162
7162
  ];
7163
7163
  e.mane && s.push({ id: "mane", parent: "neck", shape: { type: "tube", points: e.mane.points, radius: e.mane.radius, segments: 6 }, fill: t.dark, outline: 0.7 }), e.muzzle && s.push({ id: "muzzle", parent: "head", shape: { type: "ellipsoid", radii: e.muzzle.radii, segments: 10 }, at: e.muzzle.at, fill: t.muzzle, outline: 0.8 });
7164
7164
  for (const d of [1, -1]) {
@@ -7205,7 +7205,7 @@ function rt(e) {
7205
7205
  front: { at: [0, r, e.body.radii[2]] },
7206
7206
  ...e.anchors
7207
7207
  },
7208
- derive: (d) => K0(d, e, o)
7208
+ derive: (d) => W0(d, e, o)
7209
7209
  }, h = {
7210
7210
  legLength: o,
7211
7211
  upper: n.upper,
@@ -7247,7 +7247,7 @@ function N0(e, n) {
7247
7247
  return e.gaits.includes("gallop") && !o.gallop && (o.gallop = t("gallop")), o;
7248
7248
  }
7249
7249
  const Ae = Array.from({ length: 7 }, (e, n) => n === 0 ? "tail" : `tail-${n}`);
7250
- function W0(e, n, t) {
7250
+ function K0(e, n, t) {
7251
7251
  const o = Ca(e.tail.points, Ae.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 / Ae.length), h = Ae.map((u, p) => {
7252
7252
  const g = o[p], b = o[p + 1], T = [b[0] - g[0], b[1] - g[1], b[2] - g[2]], O = p === 0 ? void 0 : o[p - 1];
7253
7253
  return {
@@ -7270,7 +7270,7 @@ function W0(e, n, t) {
7270
7270
  solidOnly: !0
7271
7271
  }), h;
7272
7272
  }
7273
- function K0(e, n, t) {
7273
+ function W0(e, n, t) {
7274
7274
  const o = Math.max(0, Math.min(1, e.walking ?? 0));
7275
7275
  if (o === 0) return {};
7276
7276
  const r = Bt[Math.max(0, Math.min(3, Math.round(e.gait ?? 0)))], a = An[n.gaits.includes(r) ? r : n.gaits[0]], s = e.walk ?? 0, i = {};
@@ -8276,11 +8276,11 @@ function ud(e, n = {}) {
8276
8276
  gags: Object.keys(ga),
8277
8277
  builds: Object.keys(ni),
8278
8278
  hair: Object.keys(ti),
8279
- hairColors: { ...We },
8279
+ hairColors: { ...Ke },
8280
8280
  facialHair: Object.keys(ei),
8281
8281
  glasses: Object.keys(Qr),
8282
8282
  hats: Object.keys(Zr),
8283
- feet: [...Kr],
8283
+ feet: [...Wr],
8284
8284
  cast: Object.keys(Ya),
8285
8285
  heldItems: Object.fromEntries(Object.entries(Jr).map(([o, r]) => [o, r.hands])),
8286
8286
  handMeetings: Object.keys(pn)
@@ -8866,7 +8866,7 @@ ${r.map((M) => ` beat ${M.beat}: ${M.message}`).join(`
8866
8866
  const P = Math.max(Od, Math.abs(A) * Pd);
8867
8867
  return d("rotateY", M, l), l += A, h("rotateY", M + P, l, "ease-in-out"), M + P;
8868
8868
  }, u = (M, m, A) => {
8869
- const P = Wa([[s, i], ...m.through ?? [m.to]]);
8869
+ const P = Ka([[s, i], ...m.through ?? [m.to]]);
8870
8870
  if (P.length < 2) return A;
8871
8871
  const k = f(A, mt(P[0].point, P[1].point)), y = P[P.length - 1].at, v = m.for ?? y / (m.speed ?? M.speed) * 1e3, w = $t("ease-in-out"), E = Math.min(Hd, v / 4);
8872
8872
  for (const [Y, ne] of Object.entries(M.set ?? {}))
@@ -8878,10 +8878,10 @@ ${r.map((M) => ` beat ${M.beat}: ${M.message}`).join(`
8878
8878
  const j = { ...a };
8879
8879
  let R = l;
8880
8880
  for (let Y = 0; ; Y = Math.min(y, Y + Ad)) {
8881
- const ne = k + Ra(w, Y / y) * v, { point: B, direction: I } = Ka(P, Y);
8881
+ const ne = k + Ra(w, Y / y) * v, { point: B, direction: I } = Wa(P, Y);
8882
8882
  R += un(R, mt([0, 0], I)), h("x", ne, B[0]), h("z", ne, B[1]), h("rotateY", ne, R);
8883
- for (const [N, W] of Object.entries(M.perMetre ?? {})) h(N, ne, j[N] + Y * W);
8884
- for (const [N, W] of Object.entries(M.perSecond ?? {})) h(N, ne, j[N] + (ne - k) / 1e3 * W);
8883
+ for (const [N, K] of Object.entries(M.perMetre ?? {})) h(N, ne, j[N] + Y * K);
8884
+ for (const [N, K] of Object.entries(M.perSecond ?? {})) h(N, ne, j[N] + (ne - k) / 1e3 * K);
8885
8885
  if (Y >= y) break;
8886
8886
  }
8887
8887
  for (const [Y, ne] of Object.entries(M.perMetre ?? {})) a[Y] = j[Y] + y * ne;
@@ -8971,7 +8971,7 @@ function mu(e) {
8971
8971
  const p = e.riderId, g = `${e.scene}/${p}`;
8972
8972
  return Object.keys(u).map((b) => ({ id: `${p}-${b}`, target: g, property: b, keyframes: u[b] }));
8973
8973
  }
8974
- const Wd = {
8974
+ const Kd = {
8975
8975
  ground: "#7fb56a",
8976
8976
  hills: "#5f9a58",
8977
8977
  city: "#4b5468",
@@ -8994,10 +8994,10 @@ const Wd = {
8994
8994
  [18.5, "#4c3f78", "#f08a5a"],
8995
8995
  [20.5, "#17203f", "#2d3660"],
8996
8996
  [24, "#0b1530", "#1b2a4a"]
8997
- ], Wt = (e, n, t) => {
8997
+ ], Kt = (e, n, t) => {
8998
8998
  const o = (s) => [1, 3, 5].map((i) => parseInt(s.slice(i, i + 2), 16)), [r, a] = [o(e), o(n)];
8999
8999
  return `#${r.map((s, i) => Math.round(s + (a[i] - s) * t).toString(16).padStart(2, "0")).join("")}`;
9000
- }, Kd = (e) => {
9000
+ }, Wd = (e) => {
9001
9001
  const n = (e % 24 + 24) % 24;
9002
9002
  return n < 5 || n > 20 ? 0 : n < 7 ? (n - 5) / 2 : n > 18 ? (20 - n) / 2 : 1;
9003
9003
  };
@@ -9007,7 +9007,7 @@ function Rd(e) {
9007
9007
  const [o, r, a] = jt[t - 1], [s, i, l] = jt[t];
9008
9008
  if (n <= s) {
9009
9009
  const c = (n - o) / (s - o);
9010
- return { top: Wt(r, i, c), bottom: Wt(a, l, c) };
9010
+ return { top: Kt(r, i, c), bottom: Kt(a, l, c) };
9011
9011
  }
9012
9012
  }
9013
9013
  return { top: jt[0][1], bottom: jt[0][2] };
@@ -9017,7 +9017,7 @@ const zd = (e, n) => {
9017
9017
  return t <= 12 ? t / 12 : -1;
9018
9018
  }, Fd = 9, Dd = 55, Ld = 28;
9019
9019
  function Bd(e) {
9020
- const { x: n, y: t, width: o, height: r } = e, a = e.kind ?? "sky", s = e.ground ?? t + r * 0.85, i = { ...Wd, ...e.colors }, l = e.horizon ?? "hills", c = e.window !== !1, h = Et(e.seed ?? 1), d = o * r / 1e5, f = Array.from({ length: Math.ceil(Fd * 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(Dd * d) + 4 }, () => ({ u: h.next(), v: h.next(), speed: 0.8 + h.next() * 0.5 })), p = Array.from({ length: Math.ceil(Ld * 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() })), T = Array.from({ length: 24 }, () => ({ h: 0.35 + h.next() * 0.65, w: 0.6 + h.next() * 0.8, windows: h.next() > 0.3 })), O = {
9020
+ const { x: n, y: t, width: o, height: r } = e, a = e.kind ?? "sky", s = e.ground ?? t + r * 0.85, i = { ...Kd, ...e.colors }, l = e.horizon ?? "hills", c = e.window !== !1, h = Et(e.seed ?? 1), d = o * r / 1e5, f = Array.from({ length: Math.ceil(Fd * 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(Dd * d) + 4 }, () => ({ u: h.next(), v: h.next(), speed: 0.8 + h.next() * 0.5 })), p = Array.from({ length: Math.ceil(Ld * 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() })), T = Array.from({ length: 24 }, () => ({ h: 0.35 + h.next() * 0.65, w: 0.6 + h.next() * 0.8, windows: h.next() > 0.3 })), O = {
9021
9021
  hour: e.hour ?? 12,
9022
9022
  clouds: e.clouds ?? 0.3,
9023
9023
  wind: e.wind ?? 0,
@@ -9029,27 +9029,27 @@ function Bd(e) {
9029
9029
  }, P = (w, E, H, x, j) => {
9030
9030
  const R = E("hour"), { top: G, bottom: Y } = Rd(R), ne = w.createLinearGradient(0, x.y, 0, x.ground);
9031
9031
  ne.addColorStop(0, G), ne.addColorStop(1, Y), w.fillStyle = ne, w.fillRect(x.x, x.y, x.w, x.ground - x.y);
9032
- const B = Kd(R);
9032
+ const B = Wd(R);
9033
9033
  if (B < 0.6) {
9034
9034
  w.fillStyle = "#ffffff", w.globalAlpha = (0.6 - B) / 0.6 * 0.9;
9035
9035
  for (const F of g)
9036
9036
  w.beginPath(), w.arc(x.x + F.u * x.w, x.y + F.v * (x.ground - x.y), F.size, 0, Math.PI * 2), w.fill();
9037
9037
  w.globalAlpha = 1;
9038
9038
  }
9039
- const I = A(R, 6), N = A(R, 18), W = Math.min(x.w, x.h) * 0.06;
9040
- if (I.up && (w.fillStyle = i.sun, w.beginPath(), w.arc(x.x + I.x / o * x.w, x.y + I.y / r * x.h, W, 0, Math.PI * 2), w.fill()), N.up) {
9039
+ const I = A(R, 6), N = A(R, 18), K = Math.min(x.w, x.h) * 0.06;
9040
+ if (I.up && (w.fillStyle = i.sun, w.beginPath(), w.arc(x.x + I.x / o * x.w, x.y + I.y / r * x.h, K, 0, Math.PI * 2), w.fill()), N.up) {
9041
9041
  const F = x.x + N.x / o * x.w, Q = x.y + N.y / r * x.h;
9042
- w.fillStyle = i.moon, w.beginPath(), w.arc(F, Q, W * 0.8, 0, Math.PI * 2), w.fill(), w.fillStyle = G, w.beginPath(), w.arc(F - W * 0.35, Q - W * 0.15, W * 0.7, 0, Math.PI * 2), w.fill();
9042
+ w.fillStyle = i.moon, w.beginPath(), w.arc(F, Q, K * 0.8, 0, Math.PI * 2), w.fill(), w.fillStyle = G, w.beginPath(), w.arc(F - K * 0.35, Q - K * 0.15, K * 0.7, 0, Math.PI * 2), w.fill();
9043
9043
  }
9044
9044
  const S = Math.max(0, Math.min(1, E("clouds"))), _ = Math.max(-1, Math.min(1, E("wind"))), V = Math.round(S * f.length);
9045
- w.fillStyle = Wt("#ffffff", i.cloud === "#ffffff" ? "#ffffff" : i.cloud, 1), w.globalAlpha = 0.55 + 0.4 * B;
9045
+ w.fillStyle = Kt("#ffffff", i.cloud === "#ffffff" ? "#ffffff" : i.cloud, 1), w.globalAlpha = 0.55 + 0.4 * B;
9046
9046
  for (let F = 0; F < V; F++) {
9047
9047
  const Q = f[F], ae = ((Q.u * x.w + _ * H * 0.012 * (0.6 + Q.size * 0.5)) % (x.w * 1.4) + x.w * 1.4) % (x.w * 1.4) - x.w * 0.2, C = x.x + ae, X = x.y + (0.08 + Q.v * 0.42) * (x.ground - x.y), D = Math.min(x.w, x.h) * 0.07 * Q.size;
9048
9048
  for (let Z = 0; Z < Q.puffs; Z++)
9049
9049
  w.beginPath(), w.ellipse(C + (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();
9050
9050
  }
9051
9051
  w.globalAlpha = 1;
9052
- const ee = (F) => Wt(Wt(F, "#0b1530", 0.65), F, B);
9052
+ const ee = (F) => Kt(Kt(F, "#0b1530", 0.65), F, B);
9053
9053
  if (l === "hills") {
9054
9054
  w.fillStyle = ee(i.hills), w.beginPath(), w.moveTo(x.x, x.ground);
9055
9055
  const F = 40;
@@ -9082,8 +9082,8 @@ function Bd(e) {
9082
9082
  const Y = x.h * 0.05, ne = j * 0.45, B = Math.round(R * u.length);
9083
9083
  w.beginPath();
9084
9084
  for (let I = 0; I < B; I++) {
9085
- const N = u[I], W = ((N.v * x.h + H * N.speed * 0.9) % x.h + x.h) % x.h, S = ((N.u * x.w + W * ne) % x.w + x.w) % x.w;
9086
- w.moveTo(x.x + S, x.y + W), w.lineTo(x.x + S + ne * Y, x.y + W + Y);
9085
+ const N = u[I], K = ((N.v * x.h + H * N.speed * 0.9) % x.h + x.h) % x.h, S = ((N.u * x.w + K * ne) % x.w + x.w) % x.w;
9086
+ w.moveTo(x.x + S, x.y + K), w.lineTo(x.x + S + ne * Y, x.y + K + Y);
9087
9087
  }
9088
9088
  w.stroke(), w.globalAlpha = 1;
9089
9089
  }
@@ -9091,8 +9091,8 @@ function Bd(e) {
9091
9091
  w.fillStyle = i.snow, w.globalAlpha = 0.85;
9092
9092
  const Y = Math.round(G * p.length);
9093
9093
  for (let ne = 0; ne < Y; ne++) {
9094
- const B = p[ne], I = ((B.v * x.h + H * B.speed * 0.08) % x.h + x.h) % x.h, N = Math.sin(H * 2e-3 + B.sway) * x.w * 0.02, W = ((B.u * x.w + N + j * I * 0.3) % x.w + x.w) % x.w;
9095
- w.beginPath(), w.arc(x.x + W, x.y + I, B.size, 0, Math.PI * 2), w.fill();
9094
+ const B = p[ne], I = ((B.v * x.h + H * B.speed * 0.08) % x.h + x.h) % x.h, N = Math.sin(H * 2e-3 + B.sway) * x.w * 0.02, K = ((B.u * x.w + N + j * I * 0.3) % x.w + x.w) % x.w;
9095
+ w.beginPath(), w.arc(x.x + K, x.y + I, B.size, 0, Math.PI * 2), w.fill();
9096
9096
  }
9097
9097
  w.globalAlpha = 1;
9098
9098
  }
@@ -9228,12 +9228,12 @@ export {
9228
9228
  ei as FACIAL_HAIR_STYLES,
9229
9229
  Eu as FINGERS,
9230
9230
  Sn as FLIPS,
9231
- Kr as FOOT_SHAPES,
9231
+ Wr as FOOT_SHAPES,
9232
9232
  nt as GAGS,
9233
9233
  ze as GAITS,
9234
9234
  Hs as GAIT_CYCLE_MS,
9235
9235
  Qr as GLASSES_STYLES,
9236
- We as HAIR_COLORS,
9236
+ Ke as HAIR_COLORS,
9237
9237
  Tu as HAIR_STILL,
9238
9238
  ti as HAIR_STYLES,
9239
9239
  pn as HAND_MEETINGS,
@@ -9253,7 +9253,7 @@ export {
9253
9253
  ga as HUMAN_GAGS,
9254
9254
  Re as HUMAN_POSES,
9255
9255
  be as HUMAN_REST,
9256
- Xg as IDENTITY_CAMERA,
9256
+ Jg as IDENTITY_CAMERA,
9257
9257
  nh as MANGA_CAST,
9258
9258
  no as MUDRAS,
9259
9259
  nr as NOIR_AMBER,
@@ -9274,7 +9274,7 @@ export {
9274
9274
  de as REST_POSE,
9275
9275
  kr as RIDING_POSES,
9276
9276
  Qe as SAMPLE_STEP,
9277
- Wd as SCENERY_COLORS,
9277
+ Kd as SCENERY_COLORS,
9278
9278
  Tn as SCRIPT_ACTIONS,
9279
9279
  Ou as SOFT_CARTOON_CAST,
9280
9280
  vh as STICK_ACTING_RIG,
@@ -9290,8 +9290,8 @@ export {
9290
9290
  x0 as airplane,
9291
9291
  et as anchorError,
9292
9292
  Bo as animalStrideLength,
9293
- Vg as animatableProperties,
9294
- Jg as applyCamera,
9293
+ Zg as animatableProperties,
9294
+ Qg as applyCamera,
9295
9295
  pi as applyGroove,
9296
9296
  Ps as assertBeats,
9297
9297
  sf as bakeDanceTracks,
@@ -9302,8 +9302,8 @@ export {
9302
9302
  _u as beanOverBody,
9303
9303
  Cu as beanShoeAt,
9304
9304
  Nu as beanStanding,
9305
- Wu as beanTorso,
9306
- Ku as beanTorsoOutline,
9305
+ Ku as beanTorso,
9306
+ Wu as beanTorsoOutline,
9307
9307
  tf as beatAt,
9308
9308
  M0 as bed,
9309
9309
  c0 as bike,
@@ -9311,13 +9311,13 @@ export {
9311
9311
  yo as blendPose,
9312
9312
  Ru as bodyProfileWidth,
9313
9313
  zu as bodyShapeProfiles,
9314
- Yg as boilFrame,
9314
+ Xg as boilFrame,
9315
9315
  cl as boxMesh,
9316
9316
  Fu as brushingPose,
9317
9317
  bu as buildScene,
9318
9318
  r0 as bus,
9319
- Zg as cameraFromValues,
9320
- Qg as cameraPoint,
9319
+ ep as cameraFromValues,
9320
+ tp as cameraPoint,
9321
9321
  ud as capabilities,
9322
9322
  lu as capabilitiesMarkdown,
9323
9323
  s0 as car,
@@ -9329,7 +9329,7 @@ export {
9329
9329
  Ef as castMember,
9330
9330
  L0 as cat,
9331
9331
  y0 as chair,
9332
- Kt as changingWindows,
9332
+ Wt as changingWindows,
9333
9333
  ko as character,
9334
9334
  Du as characterAt,
9335
9335
  Lu as characterHandPose,
@@ -9351,14 +9351,14 @@ export {
9351
9351
  ad as checkPropBeats,
9352
9352
  xd as checkPropBeats3D,
9353
9353
  cc as checkSurfaceBeats,
9354
- ep as checkTracks,
9354
+ np as checkTracks,
9355
9355
  Q0 as chicken,
9356
9356
  bf as circlePath,
9357
9357
  qa as clipErased,
9358
9358
  Ac as clockHandAngles,
9359
9359
  Tc as clueMarkerAt,
9360
9360
  Sf as codePanel,
9361
- Kl as codeTokens,
9361
+ Wl as codeTokens,
9362
9362
  Ec as coneCorners,
9363
9363
  ye as controlValue,
9364
9364
  B0 as cow,
@@ -9377,8 +9377,8 @@ export {
9377
9377
  wi as danceTravelTrack,
9378
9378
  nf as dancer,
9379
9379
  Nf as defineAction,
9380
- Wf as defineGait,
9381
- tp as describeTarget,
9380
+ Kf as defineGait,
9381
+ op as describeTarget,
9382
9382
  v0 as desk,
9383
9383
  D0 as dog,
9384
9384
  E0 as door,
@@ -9434,45 +9434,47 @@ export {
9434
9434
  zi as flipTravel,
9435
9435
  As as gag,
9436
9436
  mn as gagDuration,
9437
- eg as gaitPose,
9437
+ eg as gaitBob,
9438
+ tg as gaitGive,
9439
+ ng as gaitPose,
9438
9440
  eo as gaitStrideLength,
9439
9441
  q0 as goat,
9440
9442
  uh as hairFollow,
9441
9443
  xf as hairFollowTracks,
9442
9444
  Ir as hairHangs,
9443
9445
  jf as hairMotionAt,
9444
- tg as hairMotionOf,
9445
- ng as hairlineAt,
9446
+ og as hairMotionOf,
9447
+ sg as hairlineAt,
9446
9448
  mf as handAt,
9447
- og as handGrip,
9449
+ ag as handGrip,
9448
9450
  Go as handJoints,
9449
- sg as handJointsAt,
9451
+ rg as handJointsAt,
9450
9452
  er as handPath,
9451
9453
  Pt as handPose,
9452
9454
  Sr as handProp,
9453
- ag as headPoint,
9455
+ ig as headPoint,
9454
9456
  I0 as helicopter,
9455
9457
  If as helpUp,
9456
9458
  Hf as helpUpSpacing,
9457
- rg as holdingLayers,
9459
+ lg as holdingLayers,
9458
9460
  F0 as horse,
9459
9461
  iu as horseStrideLength,
9460
9462
  p0 as house,
9461
- ig as humanCyclePose,
9463
+ hg as humanCyclePose,
9462
9464
  cn as humanDanceFrame,
9463
9465
  af as humanDanceTracks,
9464
- lg as humanFieldLabel,
9466
+ cg as humanFieldLabel,
9465
9467
  Or as humanGag,
9466
9468
  Ar as humanGaitPose,
9467
9469
  ua as humanGaitStrideLength,
9468
9470
  Mr as humanPlan,
9469
9471
  ya as humanPose,
9470
- hg as illustrationTones,
9471
- cg as isHeld,
9472
- dg as jointsInScene,
9473
- fg as jointsToScene,
9474
- ug as leafOutfit,
9475
- gg as leafOutfitContours,
9472
+ dg as illustrationTones,
9473
+ fg as isHeld,
9474
+ ug as jointsInScene,
9475
+ gg as jointsToScene,
9476
+ pg as leafOutfit,
9477
+ mg as leafOutfitContours,
9476
9478
  Yf as lightFlicker,
9477
9479
  Gf as lightningFlash,
9478
9480
  Pc as lineReveal,
@@ -9483,22 +9485,22 @@ export {
9483
9485
  za as lookFields,
9484
9486
  cr as loosePartsOf,
9485
9487
  R0 as lyingPose,
9486
- pg as measuredHipWidth,
9488
+ bg as measuredHipWidth,
9487
9489
  rf as meetDandiya,
9488
9490
  Af as meetHands,
9489
9491
  Tf as meetingSpacing,
9490
9492
  Nr as mirrorHumanPose,
9491
9493
  ui as mirrorPose,
9492
- mg as mittenAt,
9494
+ yg as mittenAt,
9493
9495
  xa as mixColors,
9494
9496
  rn as mixHandPoses,
9495
9497
  fa as mixPoses,
9496
9498
  d0 as motorbike,
9497
9499
  Jl as niceCeiling,
9498
9500
  fs as objectPositionAt,
9499
- bg as organicBodyContours,
9500
- yg as organicCenterLine,
9501
- wg as outfitPreset,
9501
+ wg as organicBodyContours,
9502
+ kg as organicCenterLine,
9503
+ vg as outfitPreset,
9502
9504
  nd as owl,
9503
9505
  pl as panelMesh,
9504
9506
  od as parrot,
@@ -9512,10 +9514,10 @@ export {
9512
9514
  ed as pigeon,
9513
9515
  xi as plantDanceFoot,
9514
9516
  vo as pointAlong,
9515
- kg as pointOnHead,
9516
- Wo as popIn,
9517
+ Sg as pointOnHead,
9518
+ Ko as popIn,
9517
9519
  Cr as pose,
9518
- vg as poseTracks,
9520
+ Mg as poseTracks,
9519
9521
  qo as propActions,
9520
9522
  Uc as propAnchors3D,
9521
9523
  Lo as propAt,
@@ -9538,39 +9540,39 @@ export {
9538
9540
  Ge as reachCharacter,
9539
9541
  gc as reachOf,
9540
9542
  Ua as resolveActingStyle,
9541
- Sg as resolveBean,
9543
+ $g as resolveBean,
9542
9544
  xr as resolveCharacterPoseKeys,
9543
- Mg as resolveFacialHair,
9544
- $g as resolveGait,
9545
- Eg as resolveGlasses,
9546
- Tg as resolveHair,
9547
- Ag as resolveHat,
9548
- Pg as resolveHeadLook,
9549
- Og as resolveHolding,
9550
- Hg as resolveIllustration,
9551
- Ig as resolveMeasurements,
9552
- jg as resolveOrganicBody,
9545
+ Eg as resolveFacialHair,
9546
+ Tg as resolveGait,
9547
+ Ag as resolveGlasses,
9548
+ Pg as resolveHair,
9549
+ Og as resolveHat,
9550
+ Hg as resolveHeadLook,
9551
+ Ig as resolveHolding,
9552
+ jg as resolveIllustration,
9553
+ xg as resolveMeasurements,
9554
+ _g as resolveOrganicBody,
9553
9555
  pa as resolvePoseKeys,
9554
- xg as resolveStickFrame,
9555
- _g as resolveStickPose,
9556
+ Cg as resolveStickFrame,
9557
+ Ng as resolveStickPose,
9556
9558
  xo as rideFloors,
9557
- Cg as rotateAbout,
9559
+ Kg as rotateAbout,
9558
9560
  $o as routineBeats,
9559
- Ng as rubberLimb,
9561
+ Wg as rubberLimb,
9560
9562
  Gd as scenePreset,
9561
9563
  Bd as scenery,
9562
9564
  Qa as scriptActionSummaries,
9563
9565
  No as scriptTracks,
9564
9566
  wf as scrubPath,
9565
- Wg as seatHeight,
9567
+ Rg as seatHeight,
9566
9568
  Ho as shade,
9567
9569
  bl as shapeMesh,
9568
9570
  sa as sittingPose,
9569
- Kg as skeletonInView,
9571
+ zg as skeletonInView,
9570
9572
  ri as sketchPen,
9571
9573
  Rd as skyColors,
9572
9574
  Ca as smoothPath,
9573
- Rg as softCartoonCharacter,
9575
+ Fg as softCartoonCharacter,
9574
9576
  Lt as solveAt,
9575
9577
  $r as solvePlanSpace,
9576
9578
  hr as solveProp,
@@ -9585,16 +9587,16 @@ export {
9585
9587
  xh as stepsDuration,
9586
9588
  Va as stepsToKeys,
9587
9589
  ma as stickFigureAt,
9588
- Ke as stickFigureJoints,
9590
+ We as stickFigureJoints,
9589
9591
  ba as stickFigureTarget,
9590
9592
  qi as stickToHuman,
9591
- zg as strideLength,
9593
+ Dg as strideLength,
9592
9594
  me as surfaceBox,
9593
- Kf as surfaceScript,
9594
- Fg as sweepingPose,
9595
- Dg as talkingMouth,
9596
- Lg as taperedLine,
9597
- Bg as taperedOutline,
9595
+ Wf as surfaceScript,
9596
+ Lg as sweepingPose,
9597
+ Bg as talkingMouth,
9598
+ qg as taperedLine,
9599
+ Gg as taperedOutline,
9598
9600
  i0 as tractor,
9599
9601
  h0 as trainCar,
9600
9602
  f0 as tree,
@@ -9602,11 +9604,11 @@ export {
9602
9604
  ml as tubeMesh,
9603
9605
  jo as valueAt,
9604
9606
  Xe as vehicle,
9605
- qg as walkPose,
9607
+ Yg as walkPose,
9606
9608
  P0 as wheelchair,
9607
9609
  Mf as whiteboard,
9608
9610
  je as withAlpha,
9609
9611
  kf as withErased,
9610
9612
  gt as withExpression,
9611
- Ko as wrapText
9613
+ Wo as wrapText
9612
9614
  };