@algorisys/tinyfly 0.90.0 → 0.92.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,27 +1,28 @@
1
- import { c as to, s as ut, p as mn, b as Ht } from "./sketch-CYPUbk3Q.js";
2
- import { a as Zi } from "./sketch-CYPUbk3Q.js";
3
- import { createRandom as no, hashSeed as Ze, getEasingFunction as Qe, mat4 as D, vec3 as J, quat as Ft, Timeline as oo } from "@algorisys/tinyfly";
4
- import { f as Rt, h as so, a as ro } from "./load-scene-CQvcFWGJ.js";
5
- function Ye(e, t, n) {
1
+ import { c as ho, s as mt, p as vn, b as xt } from "./sketch-CYPUbk3Q.js";
2
+ import { a as gl } from "./sketch-CYPUbk3Q.js";
3
+ import { createRandom as co, hashSeed as tt, getEasingFunction as nt, mat4 as U, vec3 as Q, quat as Yt, Timeline as fo } from "@algorisys/tinyfly";
4
+ import { f as Ct, h as uo, a as go } from "./load-scene-CQvcFWGJ.js";
5
+ import { I as ml, a as bl, c as wl, b as yl } from "./camera-C7bZOWMB.js";
6
+ function qe(e, t, n) {
6
7
  const s = e.length;
7
8
  if (s < 2) return [];
8
9
  const o = [], r = [], l = (i) => t + (n - t) * i / (s - 1);
9
10
  return e.forEach((i, a) => {
10
- const h = e[Math.max(0, a - 1)], c = e[Math.min(s - 1, a + 1)], u = Math.hypot(c.x - h.x, c.y - h.y) || 1, g = l(a) / 2, f = -(c.y - h.y) / u * g, p = (c.x - h.x) / u * g;
11
+ const h = e[Math.max(0, a - 1)], c = e[Math.min(s - 1, a + 1)], u = Math.hypot(c.x - h.x, c.y - h.y) || 1, d = l(a) / 2, f = -(c.y - h.y) / u * d, p = (c.x - h.x) / u * d;
11
12
  o.push({ x: i.x + f, y: i.y + p }), r.push({ x: i.x - f, y: i.y - p });
12
13
  }), [...o, ...r.reverse()];
13
14
  }
14
- function vt(e, t, n, s) {
15
+ function Pt(e, t, n, s) {
15
16
  const o = t.length;
16
17
  if (o < 2) return;
17
- const r = Ye(t, n, s), l = (i) => n + (s - n) * i / (o - 1);
18
+ const r = qe(t, n, s), l = (i) => n + (s - n) * i / (o - 1);
18
19
  e.beginPath(), e.moveTo(r[0].x, r[0].y);
19
20
  for (const i of r.slice(1)) e.lineTo(i.x, i.y);
20
21
  e.closePath(), e.fill(), t.forEach((i, a) => {
21
22
  a !== 0 && a !== o - 1 && o > 3 || (e.beginPath(), e.arc(i.x, i.y, l(a) / 2, 0, Math.PI * 2), e.fill());
22
23
  });
23
24
  }
24
- function ke(e, t, n, s, o = 16) {
25
+ function He(e, t, n, s, o = 16) {
25
26
  const r = { x: 2 * t.x - (e.x + n.x) / 2, y: 2 * t.y - (e.y + n.y) / 2 }, l = [];
26
27
  for (let i = 0; i <= o; i++) {
27
28
  const a = i / o, h = a < 0.5 ? { x: e.x + (t.x - e.x) * 2 * a, y: e.y + (t.y - e.y) * 2 * a } : { x: t.x + (n.x - t.x) * (2 * a - 1), y: t.y + (n.y - t.y) * (2 * a - 1) }, c = 1 - a, u = {
@@ -32,34 +33,34 @@ function ke(e, t, n, s, o = 16) {
32
33
  }
33
34
  return l;
34
35
  }
35
- function Lt(e, t, n, s, o, r = 0, l = 1, i = 40) {
36
+ function Dt(e, t, n, s, o, r = 0, l = 1, i = 40) {
36
37
  const a = Math.cos(o), h = Math.sin(o);
37
38
  return Array.from({ length: i + 1 }, (c, u) => {
38
- const g = r + Math.PI * 2 * l * u / i, f = Math.cos(g) * n, p = Math.sin(g) * s;
39
+ const d = r + Math.PI * 2 * l * u / i, f = Math.cos(d) * n, p = Math.sin(d) * s;
39
40
  return { x: e + f * a - p * h, y: t + f * h + p * a };
40
41
  });
41
42
  }
42
- function bn(e, t) {
43
- return t.look === "pencil" ? ho(e, t) : io(e, t.ink, t.look);
43
+ function Tn(e, t) {
44
+ return t.look === "pencil" ? wo(e, t) : po(e, t.ink, t.look);
44
45
  }
45
- function Xe(e, t, n = !1) {
46
+ function ze(e, t, n = !1) {
46
47
  e.beginPath(), e.moveTo(t[0].x, t[0].y);
47
48
  for (const s of t.slice(1)) e.lineTo(s.x, s.y);
48
49
  n && e.closePath();
49
50
  }
50
- function io(e, t, n) {
51
+ function po(e, t, n) {
51
52
  const s = n === "silhouette", o = s ? 1.25 : 1;
52
53
  return {
53
54
  look: n,
54
55
  ink: t,
55
56
  limb(r, l, i) {
56
- e.fillStyle = t, vt(e, r, l * o, i * o);
57
+ e.fillStyle = t, Pt(e, r, l * o, i * o);
57
58
  },
58
59
  line(r, l) {
59
- r.length < 2 || (e.strokeStyle = t, e.lineWidth = l * o, e.lineCap = "round", e.lineJoin = "round", Xe(e, r), e.stroke());
60
+ r.length < 2 || (e.strokeStyle = t, e.lineWidth = l * o, e.lineCap = "round", e.lineJoin = "round", ze(e, r), e.stroke());
60
61
  },
61
62
  shape(r, l, i) {
62
- Xe(e, r, !0), (l !== null || s) && (e.fillStyle = s ? t : l, e.fill()), !(i <= 0) && (e.strokeStyle = t, e.lineWidth = i * o, e.lineJoin = "round", e.stroke());
63
+ ze(e, r, !0), (l !== null || s) && (e.fillStyle = s ? t : l, e.fill()), !(i <= 0) && (e.strokeStyle = t, e.lineWidth = i * o, e.lineJoin = "round", e.stroke());
63
64
  },
64
65
  ellipse(r, l, i, a, h, c, u) {
65
66
  e.beginPath(), e.ellipse(r, l, i, a, h, 0, Math.PI * 2), (c !== null || s) && (e.fillStyle = s ? t : c, e.fill()), !(u <= 0) && (e.strokeStyle = t, e.lineWidth = u * o, e.stroke());
@@ -73,7 +74,7 @@ function io(e, t, n) {
73
74
  }
74
75
  };
75
76
  }
76
- function lo(e, t) {
77
+ function mo(e, t) {
77
78
  const n = [e[0]];
78
79
  let s = 0;
79
80
  for (let l = 1; l < e.length; l++) {
@@ -88,14 +89,14 @@ function lo(e, t) {
88
89
  const o = e[e.length - 1], r = n[n.length - 1];
89
90
  return Math.hypot(o.x - r.x, o.y - r.y) > t * 0.25 ? n.push(o) : n[n.length - 1] = o, n;
90
91
  }
91
- function ao(e, t) {
92
+ function bo(e, t) {
92
93
  const n = e.length;
93
94
  return e.map((s, o) => {
94
95
  const r = e[Math.max(0, o - 1)], l = e[Math.min(n - 1, o + 1)], i = Math.hypot(l.x - r.x, l.y - r.y) || 1, a = t(n === 1 ? 0 : o / (n - 1));
95
96
  return { x: s.x - (l.y - r.y) / i * a, y: s.y + (l.x - r.x) / i * a };
96
97
  });
97
98
  }
98
- function Nt(e) {
99
+ function Xt(e) {
99
100
  const t = [0.6, 1.4, 2.9].map((s) => ({
100
101
  frequency: s * (0.8 + e.next() * 0.4),
101
102
  phase: e.next() * Math.PI * 2,
@@ -103,71 +104,71 @@ function Nt(e) {
103
104
  })), n = t.reduce((s, o) => s + o.amount, 0);
104
105
  return (s) => t.reduce((o, r) => o + r.amount * Math.sin(Math.PI * 2 * r.frequency * s + r.phase), 0) / n;
105
106
  }
106
- function ho(e, t) {
107
- const n = t.pencil ?? {}, s = t.ink, o = n.roughness ?? Math.max(1, t.lineWidth * 0.12), r = Math.max(1, Math.round(n.passes ?? 2)), l = Math.min(1, Math.max(0, n.pressure ?? 0.25)), i = Math.min(1, Math.max(0, n.rubbedOut ?? 0.15)), a = to(t.time, n.boil ?? 8);
107
+ function wo(e, t) {
108
+ const n = t.pencil ?? {}, s = t.ink, o = n.roughness ?? Math.max(1, t.lineWidth * 0.12), r = Math.max(1, Math.round(n.passes ?? 2)), l = Math.min(1, Math.max(0, n.pressure ?? 0.25)), i = Math.min(1, Math.max(0, n.rubbedOut ?? 0.15)), a = ho(t.time, n.boil ?? 8);
108
109
  let h = 0;
109
- const c = (p, d, m = !1) => no(Ze(`${t.seed}:${m ? "paper" : a}:${p}:${d}`)), u = (p, d, m, b, y, E = 0) => {
110
+ const c = (p, g, m = !1) => co(tt(`${t.seed}:${m ? "paper" : a}:${p}:${g}`)), u = (p, g, m, b, S, k = 0) => {
110
111
  if (p.length < 2) return;
111
- const H = p.slice(1).reduce((v, T, K) => v + Math.hypot(T.x - p[K].x, T.y - p[K].y), 0);
112
- let M = lo(p, Math.max(1.5, Math.min(t.lineWidth * 0.8, H / 24)));
113
- if (E > 0 && M.length >= 2) {
114
- const [v, T] = [M[M.length - 2], M[M.length - 1]], K = Math.hypot(T.x - v.x, T.y - v.y) || 1;
115
- M = [...M, { x: T.x + (T.x - v.x) / K * E, y: T.y + (T.y - v.y) / K * E }];
112
+ const v = p.slice(1).reduce((x, E, P) => x + Math.hypot(E.x - p[P].x, E.y - p[P].y), 0);
113
+ let H = mo(p, Math.max(1.5, Math.min(t.lineWidth * 0.8, v / 24)));
114
+ if (k > 0 && H.length >= 2) {
115
+ const [x, E] = [H[H.length - 2], H[H.length - 1]], P = Math.hypot(E.x - x.x, E.y - x.y) || 1;
116
+ H = [...H, { x: E.x + (E.x - x.x) / P * k, y: E.y + (E.y - x.y) / P * k }];
116
117
  }
117
- const A = Nt(m), w = Nt(m), S = M.length, k = [], x = [];
118
- M.forEach((v, T) => {
119
- const K = S === 1 ? 0 : T / (S - 1), P = M[Math.max(0, T - 1)], I = M[Math.min(S - 1, T + 1)], q = Math.hypot(I.x - P.x, I.y - P.y) || 1, G = -(I.y - P.y) / q, W = (I.x - P.x) / q, O = A(K) * y, F = Math.min(1, K / 0.08, (1 - K) / 0.08), $ = (0.55 + 0.45 * Math.sqrt(Math.max(0, F))) * (1 + l * w(K)), B = Math.max(0.3, d(K) * $ / 2), U = v.x + G * O, ne = v.y + W * O;
120
- k.push({ x: U + G * B, y: ne + W * B }), x.push({ x: U - G * B, y: ne - W * B });
121
- }), e.save(), e.globalAlpha *= b, e.fillStyle = s, Xe(e, [...k, ...x.reverse()], !0), e.fill(), e.restore();
122
- }, g = (p, d) => {
118
+ const T = Xt(m), M = Xt(m), w = H.length, y = [], A = [];
119
+ H.forEach((x, E) => {
120
+ const P = w === 1 ? 0 : E / (w - 1), K = H[Math.max(0, E - 1)], _ = H[Math.min(w - 1, E + 1)], $ = Math.hypot(_.x - K.x, _.y - K.y) || 1, G = -(_.y - K.y) / $, W = (_.x - K.x) / $, I = T(P) * S, N = Math.min(1, P / 0.08, (1 - P) / 0.08), F = (0.55 + 0.45 * Math.sqrt(Math.max(0, N))) * (1 + l * M(P)), R = Math.max(0.3, g(P) * F / 2), z = x.x + G * I, se = x.y + W * I;
121
+ y.push({ x: z + G * R, y: se + W * R }), A.push({ x: z - G * R, y: se - W * R });
122
+ }), e.save(), e.globalAlpha *= b, e.fillStyle = s, ze(e, [...y, ...A.reverse()], !0), e.fill(), e.restore();
123
+ }, d = (p, g) => {
123
124
  const m = h++, b = c(m, 99, !0);
124
125
  if (b.next() < i) {
125
- const M = (b.next() * 2 - 1) * t.lineWidth * 1.4, A = (b.next() * 2 - 1) * t.lineWidth * 1.4, w = p.map((S) => ({ x: S.x + M, y: S.y + A }));
126
- u(w, (S) => d(S) * 1.8, c(m, 98, !0), 0.035, o), u(w, (S) => d(S) * 0.45, c(m, 97, !0), 0.12, o * 1.5);
126
+ const H = (b.next() * 2 - 1) * t.lineWidth * 1.4, T = (b.next() * 2 - 1) * t.lineWidth * 1.4, M = p.map((w) => ({ x: w.x + H, y: w.y + T }));
127
+ u(M, (w) => g(w) * 1.8, c(m, 98, !0), 0.035, o), u(M, (w) => g(w) * 0.45, c(m, 97, !0), 0.12, o * 1.5);
127
128
  }
128
- const y = p.slice(1).reduce((M, A, w) => M + Math.hypot(A.x - p[w].x, A.y - p[w].y), 0), E = d(0.5) > 4 && y > d(0.5) * 6, H = E ? [-0.3, 0.3, 0] : [0];
129
- for (let M = 0; M < r; M++) {
130
- const A = M === 0;
131
- H.forEach((w, S) => {
132
- const k = c(m, M * 10 + S), x = w === 0 ? p : ao(p, (T) => d(T) * w * Math.sqrt(Math.sin(Math.PI * T))), v = !A && w === 0 ? t.lineWidth * (0.3 + k.next() * 0.8) : 0;
133
- u(x, (T) => d(T) * (E ? 0.5 : 1) * (A ? 1 : 0.6), k, A ? 0.85 : 0.45, o * (A ? 0.6 : 1), v);
129
+ const S = p.slice(1).reduce((H, T, M) => H + Math.hypot(T.x - p[M].x, T.y - p[M].y), 0), k = g(0.5) > 4 && S > g(0.5) * 6, v = k ? [-0.3, 0.3, 0] : [0];
130
+ for (let H = 0; H < r; H++) {
131
+ const T = H === 0;
132
+ v.forEach((M, w) => {
133
+ const y = c(m, H * 10 + w), A = M === 0 ? p : bo(p, (E) => g(E) * M * Math.sqrt(Math.sin(Math.PI * E))), x = !T && M === 0 ? t.lineWidth * (0.3 + y.next() * 0.8) : 0;
134
+ u(A, (E) => g(E) * (k ? 0.5 : 1) * (T ? 1 : 0.6), y, T ? 0.85 : 0.45, o * (T ? 0.6 : 1), x);
134
135
  });
135
136
  }
136
- }, f = (p, d, m, b, y, E) => {
137
- const M = c(h, 50).next() * Math.PI * 2;
138
- g(Lt(p, d, m, b, y, M, 1.08, 48), () => E);
137
+ }, f = (p, g, m, b, S, k) => {
138
+ const H = c(h, 50).next() * Math.PI * 2;
139
+ d(Dt(p, g, m, b, S, H, 1.08, 48), () => k);
139
140
  };
140
141
  return {
141
142
  look: "pencil",
142
143
  ink: s,
143
- limb(p, d, m) {
144
- g(p, (b) => d + (m - d) * b);
144
+ limb(p, g, m) {
145
+ d(p, (b) => g + (m - g) * b);
145
146
  },
146
- line(p, d) {
147
- g(p, () => d);
147
+ line(p, g) {
148
+ d(p, () => g);
148
149
  },
149
- shape(p, d, m) {
150
- d !== null && (e.save(), e.globalAlpha *= 0.88, e.fillStyle = d, Xe(e, p, !0), e.fill(), e.restore()), m > 0 && g([...p, p[0]], () => m);
150
+ shape(p, g, m) {
151
+ g !== null && (e.save(), e.globalAlpha *= 0.88, e.fillStyle = g, ze(e, p, !0), e.fill(), e.restore()), m > 0 && d([...p, p[0]], () => m);
151
152
  },
152
- ellipse(p, d, m, b, y, E, H) {
153
- E !== null && (e.save(), e.globalAlpha *= 0.9, e.fillStyle = E, e.beginPath(), e.ellipse(p, d, m, b, y, 0, Math.PI * 2), e.fill(), e.restore()), f(p, d, m, b, y, H);
153
+ ellipse(p, g, m, b, S, k, v) {
154
+ k !== null && (e.save(), e.globalAlpha *= 0.9, e.fillStyle = k, e.beginPath(), e.ellipse(p, g, m, b, S, 0, Math.PI * 2), e.fill(), e.restore()), f(p, g, m, b, S, v);
154
155
  },
155
- dot(p, d, m) {
156
- e.save(), e.globalAlpha *= 0.9, e.fillStyle = s, e.beginPath(), e.arc(p, d, m, 0, Math.PI * 2), e.fill(), e.restore();
156
+ dot(p, g, m) {
157
+ e.save(), e.globalAlpha *= 0.9, e.fillStyle = s, e.beginPath(), e.arc(p, g, m, 0, Math.PI * 2), e.fill(), e.restore();
157
158
  },
158
159
  guide(p) {
159
160
  if (n.construction === !1 || p.length < 2) return;
160
- const d = h++;
161
- u(p, () => Math.max(0.6, t.lineWidth * 0.18), c(d, 0), 0.28, o * 1.2, t.lineWidth);
161
+ const g = h++;
162
+ u(p, () => Math.max(0.6, t.lineWidth * 0.18), c(g, 0), 0.28, o * 1.2, t.lineWidth);
162
163
  },
163
- guideEllipse(p, d, m, b, y) {
164
+ guideEllipse(p, g, m, b, S) {
164
165
  if (n.construction === !1) return;
165
- const E = h++, H = c(E, 0), M = Lt(p, d, m, b, y, H.next() * Math.PI * 2, 1.12, 48);
166
- u(M, () => Math.max(0.6, t.lineWidth * 0.18), H, 0.28, o * 1.5);
166
+ const k = h++, v = c(k, 0), H = Dt(p, g, m, b, S, v.next() * Math.PI * 2, 1.12, 48);
167
+ u(H, () => Math.max(0.6, t.lineWidth * 0.18), v, 0.28, o * 1.5);
167
168
  }
168
169
  };
169
170
  }
170
- const co = ["thumb", "index", "middle", "ring", "pinky"], L = {
171
+ const yo = ["thumb", "index", "middle", "ring", "pinky"], Y = {
171
172
  "thumb.curl": 0.15,
172
173
  "thumb.across": 0.15,
173
174
  "index.curl": 0.12,
@@ -180,35 +181,35 @@ const co = ["thumb", "index", "middle", "ring", "pinky"], L = {
180
181
  tilt: 0,
181
182
  roll: 0
182
183
  };
183
- function R(e = {}) {
184
- return { ...L, ...e };
184
+ function L(e = {}) {
185
+ return { ...Y, ...e };
185
186
  }
186
- const j = (e, t, n, s, o) => ({
187
+ const J = (e, t, n, s, o) => ({
187
188
  "thumb.curl": e,
188
189
  "index.curl": t,
189
190
  "middle.curl": n,
190
191
  "ring.curl": s,
191
192
  "pinky.curl": o
192
- }), C = {
193
- relaxed: L,
194
- open: R({ ...j(0, 0, 0, 0, 0), "thumb.across": 0, spread: 0.55 }),
195
- spread: R({ ...j(0, 0, 0, 0, 0), "thumb.across": 0, spread: 1 }),
196
- flat: R({ ...j(0, 0, 0, 0, 0), "thumb.across": 0.35, spread: 0 }),
197
- fist: R({ ...j(0.7, 1, 1, 1, 1), "thumb.across": 0.9, spread: 0 }),
198
- point: R({ ...j(0.75, 0, 1, 1, 1), "thumb.across": 0.9, spread: 0 }),
193
+ }), q = {
194
+ relaxed: Y,
195
+ open: L({ ...J(0, 0, 0, 0, 0), "thumb.across": 0, spread: 0.55 }),
196
+ spread: L({ ...J(0, 0, 0, 0, 0), "thumb.across": 0, spread: 1 }),
197
+ flat: L({ ...J(0, 0, 0, 0, 0), "thumb.across": 0.35, spread: 0 }),
198
+ fist: L({ ...J(0.7, 1, 1, 1, 1), "thumb.across": 0.9, spread: 0 }),
199
+ point: L({ ...J(0.75, 0, 1, 1, 1), "thumb.across": 0.9, spread: 0 }),
199
200
  /** The fist on its side, knuckles toward the viewer, the thumb up */
200
- thumbsUp: R({ ...j(0, 1, 1, 1, 1), "thumb.across": 0, spread: 0, roll: 70 }),
201
- peace: R({ ...j(0.75, 0, 0, 1, 1), "thumb.across": 0.9, spread: 1 }),
202
- ok: R({ ...j(0.12, 0.6, 0.1, 0.15, 0.2), "thumb.across": 0.55, spread: 0.6 }),
203
- pinch: R({ ...j(0.1, 0.65, 0.75, 0.85, 0.9), "thumb.across": 0.55, spread: 0 }),
204
- cupped: R({ ...j(0.25, 0.4, 0.4, 0.4, 0.4), "thumb.across": 0.4, spread: 0.05, turn: 2 }),
205
- wave: R({ ...j(0, 0.05, 0.05, 0.1, 0.12), "thumb.across": 0, spread: 0.7, turn: 2 }),
201
+ thumbsUp: L({ ...J(0, 1, 1, 1, 1), "thumb.across": 0, spread: 0, roll: 70 }),
202
+ peace: L({ ...J(0.75, 0, 0, 1, 1), "thumb.across": 0.9, spread: 1 }),
203
+ ok: L({ ...J(0.12, 0.6, 0.1, 0.15, 0.2), "thumb.across": 0.55, spread: 0.6 }),
204
+ pinch: L({ ...J(0.1, 0.65, 0.75, 0.85, 0.9), "thumb.across": 0.55, spread: 0 }),
205
+ cupped: L({ ...J(0.25, 0.4, 0.4, 0.4, 0.4), "thumb.across": 0.4, spread: 0.05, turn: 2 }),
206
+ wave: L({ ...J(0, 0.05, 0.05, 0.1, 0.12), "thumb.across": 0, spread: 0.7, turn: 2 }),
206
207
  /** Holding a pencil to write: thumb and middle finger pinch it, the index finger rests on top */
207
- pencilGrip: R({ ...j(0.1, 0.6, 0.72, 0.88, 0.95), "thumb.across": 0.5, spread: 0, turn: 0.8, bend: 10 }),
208
+ pencilGrip: L({ ...J(0.1, 0.6, 0.72, 0.88, 0.95), "thumb.across": 0.5, spread: 0, turn: 0.8, bend: 10 }),
208
209
  /** Holding a handle, a cup or a bar: every finger wrapped round it */
209
- hold: R({ ...j(0.5, 0.7, 0.72, 0.74, 0.76), "thumb.across": 0.75, spread: 0, turn: 1 })
210
+ hold: L({ ...J(0.5, 0.7, 0.72, 0.74, 0.76), "thumb.across": 0.75, spread: 0, turn: 1 })
210
211
  };
211
- function Ke(e, t, n) {
212
+ function Ie(e, t, n) {
212
213
  const s = { ...e };
213
214
  for (const [o, r] of Object.entries(t)) {
214
215
  const l = e[o] ?? r;
@@ -216,23 +217,23 @@ function Ke(e, t, n) {
216
217
  }
217
218
  return s;
218
219
  }
219
- const fo = {
220
+ const ko = {
220
221
  index: { knuckle: [-0.16, 0.47, -0.02], bones: [0.2, 0.125, 0.1], width: 0.125, fan: -1 },
221
222
  middle: { knuckle: [-0.055, 0.49, -0.02], bones: [0.22, 0.135, 0.1], width: 0.13, fan: -0.2 },
222
223
  ring: { knuckle: [0.05, 0.475, -0.02], bones: [0.2, 0.125, 0.1], width: 0.122, fan: 0.55 },
223
224
  pinky: { knuckle: [0.15, 0.43, -0.02], bones: [0.16, 0.1, 0.085], width: 0.108, fan: 1.25 }
224
- }, uo = {
225
+ }, So = {
225
226
  index: { knuckle: [-0.14, 0.47, -0.02], bones: [0.2, 0.125, 0.1], width: 0.15, fan: -1 },
226
227
  middle: { knuckle: [0, 0.49, -0.02], bones: [0.22, 0.135, 0.1], width: 0.155, fan: 0 },
227
228
  pinky: { knuckle: [0.14, 0.45, -0.02], bones: [0.19, 0.115, 0.095], width: 0.145, fan: 1 }
228
- }, se = {
229
+ }, ie = {
229
230
  base: [-0.11, 0.1, -0.05],
230
231
  bones: [0.2, 0.15, 0.12],
231
232
  widths: [0.2, 0.145, 0.135],
232
233
  /** Where the thumb points with `across` 0 and 1 */
233
234
  out: [-0.7, 0.68, -0.22],
234
235
  across: [0.35, 0.5, -0.8]
235
- }, go = [82, 100, 62], po = [48, 72], mo = 3, bo = 13, wo = 0.035, yo = -0.075, ko = [
236
+ }, Eo = [82, 100, 62], Mo = [48, 72], Ho = 3, vo = 13, To = 0.035, Ao = -0.075, xo = [
236
237
  [-0.17, 0],
237
238
  [-0.215, 0.12],
238
239
  [-0.235, 0.26],
@@ -245,86 +246,86 @@ const fo = {
245
246
  [0.225, 0.26],
246
247
  [0.2, 0.1],
247
248
  [0.16, 0]
248
- ], ae = (e) => e * Math.PI / 180, dt = (e, t) => [e[0] + t[0], e[1] + t[1], e[2] + t[2]], Ce = (e, t) => [e[0] * t, e[1] * t, e[2] * t], gt = (e, t) => [e[1] * t[2] - e[2] * t[1], e[2] * t[0] - e[0] * t[2], e[0] * t[1] - e[1] * t[0]], Ee = (e) => {
249
+ ], ce = (e) => e * Math.PI / 180, bt = (e, t) => [e[0] + t[0], e[1] + t[1], e[2] + t[2]], Ge = (e, t) => [e[0] * t, e[1] * t, e[2] * t], wt = (e, t) => [e[1] * t[2] - e[2] * t[1], e[2] * t[0] - e[0] * t[2], e[0] * t[1] - e[1] * t[0]], Te = (e) => {
249
250
  const t = Math.hypot(e[0], e[1], e[2]) || 1;
250
251
  return [e[0] / t, e[1] / t, e[2] / t];
251
252
  };
252
- function de(e, t, n) {
253
- const s = Math.cos(n), o = Math.sin(n), r = gt(t, e), l = t[0] * e[0] + t[1] * e[1] + t[2] * e[2];
253
+ function pe(e, t, n) {
254
+ const s = Math.cos(n), o = Math.sin(n), r = wt(t, e), l = t[0] * e[0] + t[1] * e[1] + t[2] * e[2];
254
255
  return [
255
256
  e[0] * s + r[0] * o + t[0] * l * (1 - s),
256
257
  e[1] * s + r[1] * o + t[1] * l * (1 - s),
257
258
  e[2] * s + r[2] * o + t[2] * l * (1 - s)
258
259
  ];
259
260
  }
260
- const Yt = [1, 0, 0], Ct = [0, 1, 0], Ae = [0, 0, 1];
261
- function So(e, t, n) {
262
- const s = ae(e.fan * (mo + bo * n)), o = [Math.sin(s), Math.cos(s), 0], r = [Math.cos(s), -Math.sin(s), 0], l = [e.knuckle];
261
+ const qt = [1, 0, 0], Gt = [0, 1, 0], Ke = [0, 0, 1];
262
+ function Po(e, t, n) {
263
+ const s = ce(e.fan * (Ho + vo * n)), o = [Math.sin(s), Math.cos(s), 0], r = [Math.cos(s), -Math.sin(s), 0], l = [e.knuckle];
263
264
  let i = 0;
264
265
  e.bones.forEach((c, u) => {
265
- i += ae(go[u] * t), l.push(dt(l[u], Ce(de(o, r, -i), c)));
266
+ i += ce(Eo[u] * t), l.push(bt(l[u], Ge(pe(o, r, -i), c)));
266
267
  });
267
- const a = de(Ae, r, -i), h = l.map((c, u) => e.width * (1 - 0.14 * (u / (l.length - 1))));
268
+ const a = pe(Ke, r, -i), h = l.map((c, u) => e.width * (1 - 0.14 * (u / (l.length - 1))));
268
269
  return { joints: l, back: a, widths: h };
269
270
  }
270
- function Eo(e, t, n = 1, s = 1) {
271
- const o = Math.min(1, Math.max(0, t)), r = Ee(dt(Ce(Ee(se.out), 1 - o), Ce(Ee(se.across), o))), l = Ee(gt(Ae, r)), i = Ee(gt(r, l)), a = [[se.base[0] * s, se.base[1], se.base[2]]];
271
+ function Ko(e, t, n = 1, s = 1) {
272
+ const o = Math.min(1, Math.max(0, t)), r = Te(bt(Ge(Te(ie.out), 1 - o), Ge(Te(ie.across), o))), l = Te(wt(Ke, r)), i = Te(wt(r, l)), a = [[ie.base[0] * s, ie.base[1], ie.base[2]]];
272
273
  let h = 0;
273
- se.bones.forEach((g, f) => {
274
- f > 0 && (h += ae(po[f - 1] * e)), a.push(dt(a[f], Ce(de(r, l, h), g)));
274
+ ie.bones.forEach((d, f) => {
275
+ f > 0 && (h += ce(Mo[f - 1] * e)), a.push(bt(a[f], Ge(pe(r, l, h), d)));
275
276
  });
276
- const c = de(i, l, h), u = [...se.widths, se.widths[se.widths.length - 1] * 0.92].map((g) => g * n);
277
+ const c = pe(i, l, h), u = [...ie.widths, ie.widths[ie.widths.length - 1] * 0.92].map((d) => d * n);
277
278
  return { joints: a, back: c, widths: u };
278
279
  }
279
- function pt(e, t = {}) {
280
- const n = { ...L, ...e }, s = t.size ?? 100, o = t.side ?? "right", r = o === "left" ? -1 : 1, l = ae(t.angle ?? 0), i = t.fingers === 4, a = Math.max(0.5, t.plump ?? 1), h = 1 + (a - 1) * 0.7, c = (T) => ({
281
- ...T,
282
- knuckle: [T.knuckle[0] * h, T.knuckle[1], T.knuckle[2]],
283
- width: T.width * a
284
- }), u = ae(n.bend ?? 0), g = ae(n.tilt ?? 0), f = ae(90 * (n.turn ?? 0)), p = (T) => de(de(de(T, Yt, -u), Ae, -g), Ct, f), d = Math.cos(l), m = Math.sin(l), b = ae(n.roll ?? 0), y = Math.cos(b), E = Math.sin(b), H = (T) => {
285
- const K = T[0] * s, P = -T[1] * s, I = (K * y - P * E) * r, q = K * E + P * y;
286
- return { x: I * d - q * m, y: I * m + q * d };
287
- }, M = (T) => {
288
- const K = H(T), P = Math.hypot(K.x, K.y);
289
- return P > 1e-6 * s ? { x: K.x / P, y: K.y / P } : { x: 0, y: 0 };
290
- }, A = {
291
- thumb: Eo(n["thumb.curl"] ?? 0, n["thumb.across"] ?? 0, a, h)
292
- }, w = i ? uo : fo;
293
- for (const T of co) {
294
- const K = w[T];
295
- K && (A[T] = So(c(K), n[`${T}.curl`] ?? 0, n.spread ?? 0));
296
- }
297
- const S = {};
298
- for (const [T, K] of Object.entries(A)) {
299
- const P = K.joints.map(p), I = p(K.back);
300
- S[T] = {
301
- points: P.map(H),
302
- depths: P.map((q) => q[2] * s),
303
- widths: K.widths.map((q) => q * s),
304
- nail: I[2],
305
- back: M(I)
280
+ function yt(e, t = {}) {
281
+ const n = { ...Y, ...e }, s = t.size ?? 100, o = t.side ?? "right", r = o === "left" ? -1 : 1, l = ce(t.angle ?? 0), i = t.fingers === 4, a = Math.max(0.5, t.plump ?? 1), h = 1 + (a - 1) * 0.7, c = (E) => ({
282
+ ...E,
283
+ knuckle: [E.knuckle[0] * h, E.knuckle[1], E.knuckle[2]],
284
+ width: E.width * a
285
+ }), u = ce(n.bend ?? 0), d = ce(n.tilt ?? 0), f = ce(90 * (n.turn ?? 0)), p = (E) => pe(pe(pe(E, qt, -u), Ke, -d), Gt, f), g = Math.cos(l), m = Math.sin(l), b = ce(n.roll ?? 0), S = Math.cos(b), k = Math.sin(b), v = (E) => {
286
+ const P = E[0] * s, K = -E[1] * s, _ = (P * S - K * k) * r, $ = P * k + K * S;
287
+ return { x: _ * g - $ * m, y: _ * m + $ * g };
288
+ }, H = (E) => {
289
+ const P = v(E), K = Math.hypot(P.x, P.y);
290
+ return K > 1e-6 * s ? { x: P.x / K, y: P.y / K } : { x: 0, y: 0 };
291
+ }, T = {
292
+ thumb: Ko(n["thumb.curl"] ?? 0, n["thumb.across"] ?? 0, a, h)
293
+ }, M = i ? So : ko;
294
+ for (const E of yo) {
295
+ const P = M[E];
296
+ P && (T[E] = Po(c(P), n[`${E}.curl`] ?? 0, n.spread ?? 0));
297
+ }
298
+ const w = {};
299
+ for (const [E, P] of Object.entries(T)) {
300
+ const K = P.joints.map(p), _ = p(P.back);
301
+ w[E] = {
302
+ points: K.map(v),
303
+ depths: K.map(($) => $[2] * s),
304
+ widths: P.widths.map(($) => $ * s),
305
+ nail: _[2],
306
+ back: H(_)
306
307
  };
307
308
  }
308
- const k = ko.flatMap(([T, K]) => [p([T * h, K, wo]), p([T * h, K, yo])]), x = Ho(k.map(H)), v = k.reduce((T, K) => T + K[2], 0) / k.length * s;
309
+ const y = xo.flatMap(([E, P]) => [p([E * h, P, To]), p([E * h, P, Ao])]), A = Oo(y.map(v)), x = y.reduce((E, P) => E + P[2], 0) / y.length * s;
309
310
  return {
310
311
  size: s,
311
312
  side: o,
312
313
  wrist: { x: 0, y: 0 },
313
- palm: x,
314
- palmDepth: v,
315
- palmFacing: -p(Ae)[2],
316
- fingers: S,
317
- axes: { up: M(p(Ct)), across: M(p(Yt)), out: M(p(Ae)) },
318
- curls: Object.fromEntries(Object.keys(S).map((T) => [T, n[`${T}.curl`] ?? 0]))
314
+ palm: A,
315
+ palmDepth: x,
316
+ palmFacing: -p(Ke)[2],
317
+ fingers: w,
318
+ axes: { up: H(p(Gt)), across: H(p(qt)), out: H(p(Ke)) },
319
+ curls: Object.fromEntries(Object.keys(w).map((E) => [E, n[`${E}.curl`] ?? 0]))
319
320
  };
320
321
  }
321
- function Mo(e, t) {
322
+ function Wo(e, t) {
322
323
  const n = (o) => ({ x: o.x + t.x - e.wrist.x, y: o.y + t.y - e.wrist.y }), s = {};
323
324
  for (const [o, r] of Object.entries(e.fingers))
324
325
  s[o] = { ...r, points: r.points.map(n) };
325
326
  return { ...e, wrist: n(e.wrist), palm: e.palm.map(n), fingers: s };
326
327
  }
327
- function Ho(e) {
328
+ function Oo(e) {
328
329
  const t = [...e].sort((r, l) => r.x - l.x || r.y - l.y);
329
330
  if (t.length < 3) return t;
330
331
  const n = (r, l, i) => (l.x - r.x) * (i.y - r.y) - (l.y - r.y) * (i.x - r.x), s = [];
@@ -339,47 +340,47 @@ function Ho(e) {
339
340
  }
340
341
  return [...s.slice(0, -1), ...o.slice(0, -1)];
341
342
  }
342
- const vo = "#f1c9a5", To = "#2f2f33";
343
- function Tt(e, t, n, s = {}, o = 0) {
344
- const r = Mo(pt(n, s), t), l = s.ink ?? To, i = s.lineWidth ?? r.size * 0.035, a = s.pen ?? bn(e, {
343
+ const Io = "#f1c9a5", _o = "#2f2f33";
344
+ function Kt(e, t, n, s = {}, o = 0) {
345
+ const r = Wo(yt(n, s), t), l = s.ink ?? _o, i = s.lineWidth ?? r.size * 0.035, a = s.pen ?? Tn(e, {
345
346
  look: s.look ?? "clean",
346
347
  ink: l,
347
348
  lineWidth: i,
348
349
  seed: s.seed ?? 1,
349
350
  time: o,
350
351
  pencil: { construction: !1, ...s.pencil }
351
- }), h = s.skin ?? vo, c = s.nails ?? !0, u = [
352
+ }), h = s.skin ?? Io, c = s.nails ?? !0, u = [
352
353
  {
353
354
  depth: r.palmDepth,
354
- draw: () => Ao(a, r, h, i)
355
+ draw: () => $o(a, r, h, i)
355
356
  }
356
357
  ];
357
- for (const g of Object.values(r.fingers)) {
358
- const f = g.depths.reduce((p, d) => p + d, 0) / g.depths.length;
358
+ for (const d of Object.values(r.fingers)) {
359
+ const f = d.depths.reduce((p, g) => p + g, 0) / d.depths.length;
359
360
  u.push({
360
361
  depth: f,
361
- draw: () => xo(e, a, g, h, i, c)
362
+ draw: () => Bo(e, a, d, h, i, c)
362
363
  });
363
364
  }
364
365
  if (s.prop) {
365
- const g = s.prop;
366
- u.push({ depth: g.depth, draw: () => g.draw(a) });
366
+ const d = s.prop;
367
+ u.push({ depth: d.depth, draw: () => d.draw(a) });
367
368
  }
368
369
  e.save(), e.lineCap = "round", e.lineJoin = "round";
369
- for (const g of [...u].sort((f, p) => f.depth - p.depth)) g.draw();
370
+ for (const d of [...u].sort((f, p) => f.depth - p.depth)) d.draw();
370
371
  return e.restore(), r;
371
372
  }
372
- function Ao(e, t, n, s) {
373
+ function $o(e, t, n, s) {
373
374
  if (e.shape(t.palm, n, s), t.palmFacing < -0.3 && e.look !== "silhouette") {
374
375
  const { up: o } = t.axes;
375
376
  for (const [r, l] of Object.entries(t.fingers)) {
376
377
  const i = t.curls[r] ?? 0;
377
378
  if (r === "thumb" || i < 0.5) continue;
378
- const a = l.points[0], h = l.widths[0] * 0.42, c = { x: a.x - o.x * h * 0.2, y: a.y - o.y * h * 0.2 }, u = Math.atan2(o.y, o.x), g = Array.from({ length: 7 }, (f, p) => {
379
- const d = u - Math.PI / 2 + Math.PI * p / 6;
380
- return { x: c.x + Math.cos(d) * h, y: c.y + Math.sin(d) * h };
379
+ const a = l.points[0], h = l.widths[0] * 0.42, c = { x: a.x - o.x * h * 0.2, y: a.y - o.y * h * 0.2 }, u = Math.atan2(o.y, o.x), d = Array.from({ length: 7 }, (f, p) => {
380
+ const g = u - Math.PI / 2 + Math.PI * p / 6;
381
+ return { x: c.x + Math.cos(g) * h, y: c.y + Math.sin(g) * h };
381
382
  });
382
- e.line(g, s * 0.6);
383
+ e.line(d, s * 0.6);
383
384
  }
384
385
  }
385
386
  if (t.palmFacing > 0.45 && e.look !== "silhouette") {
@@ -390,15 +391,15 @@ function Ao(e, t, n, s) {
390
391
  e.line([a(-0.15 * h, 0.36), a(-0.04 * h, 0.3), a(0.1 * h, 0.33)], s * 0.5);
391
392
  }
392
393
  }
393
- function xo(e, t, n, s, o, r) {
394
- const { widths: l } = n, i = Ko(n.points, 2), a = n.points[0], h = i[i.length - 1], c = l[0], u = l[l.length - 1];
394
+ function Bo(e, t, n, s, o, r) {
395
+ const { widths: l } = n, i = Fo(n.points, 2), a = n.points[0], h = i[i.length - 1], c = l[0], u = l[l.length - 1];
395
396
  if (e.save(), t.look !== "silhouette") {
396
397
  e.beginPath(), e.rect(a.x - 1e5, a.y - 1e5, 2e5, 2e5);
397
- const d = c / 2 + o * 1.6;
398
- e.moveTo(a.x + d, a.y), e.arc(a.x, a.y, d, 0, Math.PI * 2), e.clip("evenodd");
398
+ const g = c / 2 + o * 1.6;
399
+ e.moveTo(a.x + g, a.y), e.arc(a.x, a.y, g, 0, Math.PI * 2), e.clip("evenodd");
399
400
  }
400
- if (t.limb(i, c + 2 * o, u + 2 * o), e.restore(), t.look !== "silhouette" && (e.fillStyle = s, vt(e, i, c, u)), t.look === "silhouette" || !r || n.nail < 0.25) return;
401
- const g = i[i.length - 2], f = Po({ x: h.x - g.x, y: h.y - g.y }) ?? {
401
+ if (t.limb(i, c + 2 * o, u + 2 * o), e.restore(), t.look !== "silhouette" && (e.fillStyle = s, Pt(e, i, c, u)), t.look === "silhouette" || !r || n.nail < 0.25) return;
402
+ const d = i[i.length - 2], f = Ro({ x: h.x - d.x, y: h.y - d.y }) ?? {
402
403
  x: 0,
403
404
  y: -1
404
405
  }, p = {
@@ -407,7 +408,7 @@ function xo(e, t, n, s, o, r) {
407
408
  };
408
409
  t.ellipse(p.x, p.y, u * 0.24 * Math.max(0.35, n.nail), u * 0.19, Math.atan2(f.y, f.x), "#f8e3d3", o * 0.45);
409
410
  }
410
- function Ko(e, t) {
411
+ function Fo(e, t) {
411
412
  let n = e;
412
413
  for (let s = 0; s < t; s++) {
413
414
  if (n.length < 3) return n;
@@ -420,10 +421,10 @@ function Ko(e, t) {
420
421
  }
421
422
  return n;
422
423
  }
423
- const Po = (e) => {
424
+ const Ro = (e) => {
424
425
  const t = Math.hypot(e.x, e.y);
425
426
  return t > 1e-6 ? { x: e.x / t, y: e.y / t } : null;
426
- }, we = {
427
+ }, Ee = {
427
428
  walk: { swing: 24, knee: 30, arm: 22, elbow: 28, lean: 4 },
428
429
  bouncy: { swing: 26, knee: 45, arm: 34, elbow: 30, lean: 2, bend: -4, bounce: 0.035, squash: 0.06 },
429
430
  doubleBounce: { swing: 22, knee: 40, arm: 26, elbow: 24, lean: 3, bounce: 0.02, bounces: 2, squash: 0.04 },
@@ -431,20 +432,20 @@ const Po = (e) => {
431
432
  strut: { swing: 26, knee: 30, arm: 30, elbow: 20, lean: -4, bend: -10, headTilt: -6, sway: 4, bounce: 0.01 },
432
433
  tired: { swing: 14, knee: 14, arm: 6, elbow: 6, lean: 10, bend: 16, headTilt: 12 },
433
434
  run: { swing: 40, knee: 95, arm: 45, elbow: 0, forearm: 90, lean: 16, bend: 6, bounce: 0.05, squash: 0.06 }
434
- }, Wo = 40;
435
- function wn(e) {
436
- return e === void 0 ? we.walk : typeof e == "string" ? we[e] ?? we.walk : e;
437
- }
438
- function Oo(e, t, n = _, s = 1) {
439
- const o = wn(e);
440
- if (o === we.walk) return $o(t, n, s);
441
- const r = t * Math.PI * 2, l = Math.sin(r) * s, i = Math.cos(r) * s, a = (b) => b <= Wo, h = o.shoulder ?? 0, c = (b, y) => a(b) ? y * h + o.arm * l : b, u = o.forearm ?? 0, g = a(n.leftShoulder) ? n.leftElbow - u - o.elbow * Math.max(0, -l) : n.leftElbow, f = a(n.rightShoulder) ? n.rightElbow + u + o.elbow * Math.max(0, l) : n.rightElbow, p = o.bounces ?? 1, d = (1 + Math.cos(r * 2 * p)) / 2, m = o.crouch ?? 0;
435
+ }, No = 40;
436
+ function ot(e) {
437
+ return e === void 0 ? Ee.walk : typeof e == "string" ? Ee[e] ?? Ee.walk : e;
438
+ }
439
+ function Lo(e, t, n = B, s = 1) {
440
+ const o = ot(e);
441
+ if (o === Ee.walk) return Do(t, n, s);
442
+ const r = t * Math.PI * 2, l = Math.sin(r) * s, i = Math.cos(r) * s, a = (b) => b <= No, h = o.shoulder ?? 0, c = (b, S) => a(b) ? S * h + o.arm * l : b, u = o.forearm ?? 0, d = a(n.leftShoulder) ? n.leftElbow - u - o.elbow * Math.max(0, -l) : n.leftElbow, f = a(n.rightShoulder) ? n.rightElbow + u + o.elbow * Math.max(0, l) : n.rightElbow, p = o.bounces ?? 1, g = (1 + Math.cos(r * 2 * p)) / 2, m = o.crouch ?? 0;
442
443
  return {
443
444
  ...n,
444
445
  lean: n.lean + o.lean * s + (o.sway ?? 0) * Math.sin(r) * (1 - (n.turn ?? 0)),
445
446
  bend: (n.bend ?? 0) + (o.bend ?? 0),
446
447
  headTilt: n.headTilt - o.lean * 0.5 * s + (o.headTilt ?? 0),
447
- leftElbow: g,
448
+ leftElbow: d,
448
449
  rightElbow: f,
449
450
  // A crouch brings both thighs forward and folds both shins back.
450
451
  leftHip: -o.swing * l - m * 0.5,
@@ -457,15 +458,15 @@ function Oo(e, t, n = _, s = 1) {
457
458
  rightAnkle: (n.rightAnkle ?? 0) + (o.tiptoe ?? 0),
458
459
  leftShoulder: c(n.leftShoulder, -1),
459
460
  rightShoulder: c(n.rightShoulder, 1),
460
- rise: (n.rise ?? 0) + (o.bounce ?? 0) * s * d,
461
- stretch: n.stretch * (1 + (o.squash ?? 0) * (d - 0.5))
461
+ rise: (n.rise ?? 0) + (o.bounce ?? 0) * s * g,
462
+ stretch: n.stretch * (1 + (o.squash ?? 0) * (g - 0.5))
462
463
  };
463
464
  }
464
- function Io(e, t, n = 1) {
465
- const s = wn(e), o = we.walk.swing, r = (l) => Math.sin(l * Math.PI / 180);
466
- return Bo(t, n) * r(s.swing * n) / r(o * n);
465
+ function Yo(e, t, n = 1) {
466
+ const s = ot(e), o = Ee.walk.swing, r = (l) => Math.sin(l * Math.PI / 180);
467
+ return Xo(t, n) * r(s.swing * n) / r(o * n);
467
468
  }
468
- const _ = {
469
+ const B = {
469
470
  lean: 0,
470
471
  bend: 0,
471
472
  headTilt: 0,
@@ -500,10 +501,10 @@ const _ = {
500
501
  spin: 0,
501
502
  rise: 0
502
503
  };
503
- function z(e) {
504
- return { ..._, ...e };
504
+ function V(e) {
505
+ return { ...B, ...e };
505
506
  }
506
- const yn = {
507
+ const An = {
507
508
  mouth: 0,
508
509
  smile: 0,
509
510
  mouthWidth: 1,
@@ -514,70 +515,70 @@ const yn = {
514
515
  browTilt: 0,
515
516
  lookX: 0,
516
517
  lookY: 0
517
- }, N = (e) => ({ ...yn, ...e }), Y = {
518
- neutral: yn,
519
- happy: N({ smile: 0.9, leftBrow: 0.2, rightBrow: 0.2 }),
520
- joyful: N({ mouth: 0.6, smile: 1, mouthWidth: 1.2, leftEye: 0, rightEye: 0, leftBrow: 0.4, rightBrow: 0.4 }),
521
- sad: N({ smile: -0.8, leftEye: 0.8, rightEye: 0.8, browTilt: 0.9, leftBrow: -0.1, rightBrow: -0.1, lookY: 0.6 }),
522
- crying: N({ mouth: 0.45, smile: -1, leftEye: 0, rightEye: 0, browTilt: 1, lookY: 0.4 }),
523
- surprised: N({ mouth: 0.7, mouthWidth: 0.7, leftEye: 1.5, rightEye: 1.5, leftBrow: 1, rightBrow: 1 }),
524
- shocked: N({ mouth: 1, mouthWidth: 0.8, leftEye: 1.6, rightEye: 1.6, leftBrow: 1, rightBrow: 1, browTilt: 0.4 }),
525
- angry: N({ smile: -0.6, mouthWidth: 0.9, leftEye: 0.8, rightEye: 0.8, leftBrow: -0.6, rightBrow: -0.6, browTilt: -1 }),
526
- furious: N({ mouth: 0.5, smile: -1, mouthWidth: 1.3, leftEye: 0.9, rightEye: 0.9, leftBrow: -0.9, rightBrow: -0.9, browTilt: -1 }),
527
- worried: N({ smile: -0.3, mouthWidth: 0.8, leftEye: 1.1, rightEye: 1.1, leftBrow: 0.3, rightBrow: 0.3, browTilt: 0.8, lookX: -0.5 }),
528
- scared: N({ mouth: 0.35, smile: -0.5, mouthWidth: 0.8, leftEye: 1.45, rightEye: 1.45, leftBrow: 0.8, rightBrow: 0.8, browTilt: 0.9 }),
529
- confused: N({ smile: -0.2, mouthWidth: 0.8, leftEye: 0.9, rightEye: 1.15, leftBrow: -0.3, rightBrow: 0.8, lookX: 0.5, lookY: -0.4 }),
530
- skeptical: N({ smile: -0.1, leftEye: 0.6, rightEye: 1, leftBrow: -0.4, rightBrow: 0.7, lookX: 0.4 }),
531
- thinking: N({ smile: 0, mouthWidth: 0.7, leftBrow: 0.3, rightBrow: 0.5, lookX: 0.6, lookY: -0.8 }),
532
- sleepy: N({ smile: 0.1, leftEye: 0.25, rightEye: 0.25, leftBrow: -0.3, rightBrow: -0.3, lookY: 0.5 }),
533
- disgusted: N({ smile: -0.7, mouthWidth: 0.9, leftEye: 0.6, rightEye: 0.75, leftBrow: -0.5, rightBrow: -0.2, browTilt: -0.4, lookX: -0.6 }),
534
- smug: N({ smile: 0.6, mouthWidth: 0.9, leftEye: 0.6, rightEye: 0.6, leftBrow: 0.1, rightBrow: 0.5, lookX: 0.5 }),
535
- wink: N({ smile: 0.9, leftEye: 0, rightEye: 1, leftBrow: -0.2, rightBrow: 0.3 })
518
+ }, D = (e) => ({ ...An, ...e }), X = {
519
+ neutral: An,
520
+ happy: D({ smile: 0.9, leftBrow: 0.2, rightBrow: 0.2 }),
521
+ joyful: D({ mouth: 0.6, smile: 1, mouthWidth: 1.2, leftEye: 0, rightEye: 0, leftBrow: 0.4, rightBrow: 0.4 }),
522
+ sad: D({ smile: -0.8, leftEye: 0.8, rightEye: 0.8, browTilt: 0.9, leftBrow: -0.1, rightBrow: -0.1, lookY: 0.6 }),
523
+ crying: D({ mouth: 0.45, smile: -1, leftEye: 0, rightEye: 0, browTilt: 1, lookY: 0.4 }),
524
+ surprised: D({ mouth: 0.7, mouthWidth: 0.7, leftEye: 1.5, rightEye: 1.5, leftBrow: 1, rightBrow: 1 }),
525
+ shocked: D({ mouth: 1, mouthWidth: 0.8, leftEye: 1.6, rightEye: 1.6, leftBrow: 1, rightBrow: 1, browTilt: 0.4 }),
526
+ angry: D({ smile: -0.6, mouthWidth: 0.9, leftEye: 0.8, rightEye: 0.8, leftBrow: -0.6, rightBrow: -0.6, browTilt: -1 }),
527
+ furious: D({ mouth: 0.5, smile: -1, mouthWidth: 1.3, leftEye: 0.9, rightEye: 0.9, leftBrow: -0.9, rightBrow: -0.9, browTilt: -1 }),
528
+ worried: D({ smile: -0.3, mouthWidth: 0.8, leftEye: 1.1, rightEye: 1.1, leftBrow: 0.3, rightBrow: 0.3, browTilt: 0.8, lookX: -0.5 }),
529
+ scared: D({ mouth: 0.35, smile: -0.5, mouthWidth: 0.8, leftEye: 1.45, rightEye: 1.45, leftBrow: 0.8, rightBrow: 0.8, browTilt: 0.9 }),
530
+ confused: D({ smile: -0.2, mouthWidth: 0.8, leftEye: 0.9, rightEye: 1.15, leftBrow: -0.3, rightBrow: 0.8, lookX: 0.5, lookY: -0.4 }),
531
+ skeptical: D({ smile: -0.1, leftEye: 0.6, rightEye: 1, leftBrow: -0.4, rightBrow: 0.7, lookX: 0.4 }),
532
+ thinking: D({ smile: 0, mouthWidth: 0.7, leftBrow: 0.3, rightBrow: 0.5, lookX: 0.6, lookY: -0.8 }),
533
+ sleepy: D({ smile: 0.1, leftEye: 0.25, rightEye: 0.25, leftBrow: -0.3, rightBrow: -0.3, lookY: 0.5 }),
534
+ disgusted: D({ smile: -0.7, mouthWidth: 0.9, leftEye: 0.6, rightEye: 0.75, leftBrow: -0.5, rightBrow: -0.2, browTilt: -0.4, lookX: -0.6 }),
535
+ smug: D({ smile: 0.6, mouthWidth: 0.9, leftEye: 0.6, rightEye: 0.6, leftBrow: 0.1, rightBrow: 0.5, lookX: 0.5 }),
536
+ wink: D({ smile: 0.9, leftEye: 0, rightEye: 1, leftBrow: -0.2, rightBrow: 0.3 })
536
537
  };
537
- function qe(e, t) {
538
- return { ...e, ...typeof t == "string" ? Y[t] : t };
539
- }
540
- const Oe = {
541
- rest: _,
542
- wave: z({ rightShoulder: 135, rightElbow: 30, headTilt: 6, ...Y.happy }),
543
- cheer: z({ leftShoulder: 125, leftElbow: 20, rightShoulder: 125, rightElbow: 20, ...Y.joyful }),
544
- shrug: z({ leftShoulder: 30, leftElbow: 85, rightShoulder: 30, rightElbow: 85, headTilt: -10, ...Y.confused, lookX: 0, lookY: 0 }),
545
- point: z({ rightShoulder: 90, rightElbow: 0, lean: 4, smile: 0.4 }),
538
+ function We(e, t) {
539
+ return { ...e, ...typeof t == "string" ? X[t] : t };
540
+ }
541
+ const Be = {
542
+ rest: B,
543
+ wave: V({ rightShoulder: 135, rightElbow: 30, headTilt: 6, ...X.happy }),
544
+ cheer: V({ leftShoulder: 125, leftElbow: 20, rightShoulder: 125, rightElbow: 20, ...X.joyful }),
545
+ shrug: V({ leftShoulder: 30, leftElbow: 85, rightShoulder: 30, rightElbow: 85, headTilt: -10, ...X.confused, lookX: 0, lookY: 0 }),
546
+ point: V({ rightShoulder: 90, rightElbow: 0, lean: 4, smile: 0.4 }),
546
547
  // The forearm passes 180° to fold back in, so the hand reaches the chin.
547
- think: z({ rightShoulder: 60, rightElbow: 150, headTilt: 10, ...Y.thinking }),
548
- handsOnHips: z({ leftShoulder: 45, leftElbow: -100, rightShoulder: 45, rightElbow: -100, leftHip: 14, rightHip: 14, smile: 0.8 }),
549
- sad: z({ leftShoulder: 14, rightShoulder: 14, leftElbow: -4, rightElbow: -4, headTilt: -14, lean: -3, ...Y.sad }),
550
- surprised: z({ leftShoulder: 70, leftElbow: 60, rightShoulder: 70, rightElbow: 60, ...Y.surprised }),
548
+ think: V({ rightShoulder: 60, rightElbow: 150, headTilt: 10, ...X.thinking }),
549
+ handsOnHips: V({ leftShoulder: 45, leftElbow: -100, rightShoulder: 45, rightElbow: -100, leftHip: 14, rightHip: 14, smile: 0.8 }),
550
+ sad: V({ leftShoulder: 14, rightShoulder: 14, leftElbow: -4, rightElbow: -4, headTilt: -14, lean: -3, ...X.sad }),
551
+ surprised: V({ leftShoulder: 70, leftElbow: 60, rightShoulder: 70, rightElbow: 60, ...X.surprised }),
551
552
  // Squash and stretch: the wind-up before a jump (or the landing), and the jump itself.
552
- crouch: z({ stretch: 0.72, leftShoulder: 35, rightShoulder: 35, leftElbow: -50, rightElbow: -50, leftHip: 22, rightHip: 22, headTilt: -4 }),
553
+ crouch: V({ stretch: 0.72, leftShoulder: 35, rightShoulder: 35, leftElbow: -50, rightElbow: -50, leftHip: 22, rightHip: 22, headTilt: -4 }),
553
554
  // Seated, hands resting on the knees. Arm angles spread outward per side, so
554
555
  // reaching forward (+x, the way the figure faces) is negative for the left arm.
555
- sit: z({ sit: 1, turn: 0.5, leftShoulder: -25, rightShoulder: 25, leftElbow: -55, rightElbow: 55 }),
556
- jump: z({ stretch: 1.22, leftShoulder: 140, rightShoulder: 140, leftElbow: 20, rightElbow: 20, leftHip: 4, rightHip: 4, ...Y.joyful }),
556
+ sit: V({ sit: 1, turn: 0.5, leftShoulder: -25, rightShoulder: 25, leftElbow: -55, rightElbow: 55 }),
557
+ jump: V({ stretch: 1.22, leftShoulder: 140, rightShoulder: 140, leftElbow: 20, rightElbow: 20, leftHip: 4, rightHip: 4, ...X.joyful }),
557
558
  // Full splits: legs flat along the floor, so the planted feet bring the hips right down to it.
558
559
  // Side (straddle) split, seen front-on: each leg straight out to its side, toes pointed.
559
- sideSplit: z({ leftHip: 90, rightHip: 90, leftAnkle: -45, rightAnkle: -45, leftShoulder: 120, rightShoulder: 120, leftElbow: 10, rightElbow: 10, ...Y.happy }),
560
+ sideSplit: V({ leftHip: 90, rightHip: 90, leftAnkle: -45, rightAnkle: -45, leftShoulder: 120, rightShoulder: 120, leftElbow: 10, rightElbow: 10, ...X.happy }),
560
561
  // Front split, in profile: the left leg forward (+x), the right leg back.
561
- frontSplit: z({ turn: 1, leftHip: -90, rightHip: -90, leftAnkle: -45, rightAnkle: -45, leftShoulder: -150, rightShoulder: 150, leftElbow: 10, rightElbow: -10, ...Y.happy })
562
- }, kn = Object.keys(_);
563
- function Pe(e, t, n) {
562
+ frontSplit: V({ turn: 1, leftHip: -90, rightHip: -90, leftAnkle: -45, rightAnkle: -45, leftShoulder: -150, rightShoulder: 150, leftElbow: 10, rightElbow: -10, ...X.happy })
563
+ }, xn = Object.keys(B);
564
+ function _e(e, t, n) {
564
565
  const s = { ...e };
565
- for (const o of kn) s[o] = e[o] + (t[o] - e[o]) * n;
566
+ for (const o of xn) s[o] = e[o] + (t[o] - e[o]) * n;
566
567
  return s;
567
568
  }
568
- const mt = 24, Dt = 4, Xt = 28, _o = 40;
569
- function $o(e, t = _, n = 1) {
570
- const s = Math.sin(e * Math.PI * 2) * n, o = Math.cos(e * Math.PI * 2) * n, r = (h) => h <= _o, l = (h) => r(h) ? 22 * s : h, i = r(t.leftShoulder) ? t.leftElbow - Xt * Math.max(0, -s) : t.leftElbow, a = r(t.rightShoulder) ? t.rightElbow + Xt * Math.max(0, s) : t.rightElbow;
569
+ const kt = 24, Ut = 4, zt = 28, Co = 40;
570
+ function Do(e, t = B, n = 1) {
571
+ const s = Math.sin(e * Math.PI * 2) * n, o = Math.cos(e * Math.PI * 2) * n, r = (h) => h <= Co, l = (h) => r(h) ? 22 * s : h, i = r(t.leftShoulder) ? t.leftElbow - zt * Math.max(0, -s) : t.leftElbow, a = r(t.rightShoulder) ? t.rightElbow + zt * Math.max(0, s) : t.rightElbow;
571
572
  return {
572
573
  ...t,
573
574
  // Lean into the walk, and keep the head a little more level than the body.
574
- lean: t.lean + Dt * n,
575
- headTilt: t.headTilt - Dt * 0.5 * n,
575
+ lean: t.lean + Ut * n,
576
+ headTilt: t.headTilt - Ut * 0.5 * n,
576
577
  leftElbow: i,
577
578
  rightElbow: a,
578
579
  // Left foot forward while swing > 0, right foot back; then the other way.
579
- leftHip: -mt * s,
580
- rightHip: -mt * s,
580
+ leftHip: -kt * s,
581
+ rightHip: -kt * s,
581
582
  // The leg swinging forward lifts, its shin trailing backward (-x). A positive
582
583
  // knee folds toward the centre, which is backward only for the right leg.
583
584
  leftKnee: -30 * Math.max(0, o),
@@ -587,146 +588,146 @@ function $o(e, t = _, n = 1) {
587
588
  rightShoulder: l(t.rightShoulder)
588
589
  };
589
590
  }
590
- function Bo(e, t = 1) {
591
- return 4 * ((bt + Ge) * e) * Math.sin(mt * t * Math.PI / 180);
591
+ function Xo(e, t = 1) {
592
+ return 4 * ((St + Ve) * e) * Math.sin(kt * t * Math.PI / 180);
592
593
  }
593
- function Fo(e) {
594
+ function qo(e) {
594
595
  const t = Math.abs(Math.sin(e / 65)), n = 0.55 + 0.45 * Math.sin(e / 310);
595
596
  return t * n;
596
597
  }
597
- const Sn = 0.12, qt = 0.46, Ro = 1 - 2 * Sn, Lo = 0.1, No = 0.21, Yo = 0.19, bt = 0.24, Ge = 0.22, En = 0.12, Co = 0.14, Mn = 0.33, Gt = 0.7, Ut = 0.3, Do = 0.35, Xo = [1.7, 1.05], qo = [1.3, 0.75], zt = [1.45, 0.85], Go = [1.15, 0.75], Vt = 0.06, Uo = 0.7, zo = 0.65, Hn = 0.075, Vo = 0.3, jo = 0.02, Jo = 0.012, Zo = 12, Qo = 0.25, Ie = 90, es = 0.25, ts = 0.04, vn = 0.01, fe = (e) => Math.min(1, Math.max(0, e ?? 0));
598
- function gi(e, t = 1) {
599
- return Ge * e * t;
598
+ const Pn = 0.12, Vt = 0.46, Go = 1 - 2 * Pn, Uo = 0.1, zo = 0.21, Vo = 0.19, St = 0.24, Ve = 0.22, Kn = 0.12, jo = 0.14, Wn = 0.33, jt = 0.7, Jt = 0.3, Jo = 0.35, Zo = [1.7, 1.05], Qo = [1.3, 0.75], Zt = [1.45, 0.85], es = [1.15, 0.75], Qt = 0.06, ts = 0.7, ns = 0.65, On = 0.075, os = 0.3, ss = 0.02, rs = 0.012, is = 12, ls = 0.25, Fe = 90, as = 0.25, hs = 0.04, In = 0.01, de = (e) => Math.min(1, Math.max(0, e ?? 0));
599
+ function xi(e, t = 1) {
600
+ return Ve * e * t;
600
601
  }
601
- const wt = -0.12, Tn = 0.4, Q = (e) => e * Math.PI / 180, ns = (e, t) => ({ x: t * Math.sin(Q(e)), y: Math.cos(Q(e)) }), An = (e, t) => Math.max(0, e) * (1 - Math.min(1, Math.max(0, t))), xn = (e, t, n, s) => e - 0.3 * t - n * 0.14 * t - Math.max(0, s - 1) * 0.12 * t;
602
- function os(e, t, n, s, o, r) {
603
- const l = Math.max(1, Math.min(r * 0.6, Co * n)), i = fe(t.turn), a = (En + Mn * i) * n, h = s + wt * n, c = a + t.lookX * 0.08 * n, u = t.lookY * 0.07 * n, g = [
602
+ const Et = -0.12, _n = 0.4, ne = (e) => e * Math.PI / 180, cs = (e, t) => ({ x: t * Math.sin(ne(e)), y: Math.cos(ne(e)) }), $n = (e, t) => Math.max(0, e) * (1 - Math.min(1, Math.max(0, t))), Bn = (e, t, n, s) => e - 0.3 * t - n * 0.14 * t - Math.max(0, s - 1) * 0.12 * t;
603
+ function fs(e, t, n, s, o, r) {
604
+ const l = Math.max(1, Math.min(r * 0.6, jo * n)), i = de(t.turn), a = (Kn + Wn * i) * n, h = s + Et * n, c = a + t.lookX * 0.08 * n, u = t.lookY * 0.07 * n, d = [
604
605
  // The left eye is on the far side; turning closes it up more than the near one.
605
- { x: -0.34 * n * (1 - Gt * i), squeeze: 1 - Gt * i, open: t.leftEye, brow: t.leftBrow, side: -1 },
606
- { x: 0.34 * n * (1 - Ut * i), squeeze: 1 - Ut * i, open: t.rightEye, brow: t.rightBrow, side: 1 }
606
+ { x: -0.34 * n * (1 - jt * i), squeeze: 1 - jt * i, open: t.leftEye, brow: t.leftBrow, side: -1 },
607
+ { x: 0.34 * n * (1 - Jt * i), squeeze: 1 - Jt * i, open: t.rightEye, brow: t.rightBrow, side: 1 }
607
608
  ];
608
609
  e.fillStyle = o, e.strokeStyle = o, e.lineWidth = l;
609
- for (const b of g) {
610
- const y = An(b.open, t.blink);
611
- if (y < 0.2) {
612
- const A = t.smile > 0.5 ? -0.12 * n : 0.06 * n;
613
- e.beginPath(), e.moveTo(b.x + a - 0.12 * n, h), e.quadraticCurveTo(b.x + a, h + A, b.x + a + 0.12 * n, h), e.stroke();
610
+ for (const b of d) {
611
+ const S = $n(b.open, t.blink);
612
+ if (S < 0.2) {
613
+ const T = t.smile > 0.5 ? -0.12 * n : 0.06 * n;
614
+ e.beginPath(), e.moveTo(b.x + a - 0.12 * n, h), e.quadraticCurveTo(b.x + a, h + T, b.x + a + 0.12 * n, h), e.stroke();
614
615
  } else {
615
- if (y > 1.2) {
616
- const w = 0.13 * n * y;
617
- e.beginPath(), e.ellipse(b.x + a, h, w * 0.85, w, 0, 0, Math.PI * 2), e.fillStyle = "#ffffff", e.fill(), e.stroke(), e.fillStyle = o;
616
+ if (S > 1.2) {
617
+ const M = 0.13 * n * S;
618
+ e.beginPath(), e.ellipse(b.x + a, h, M * 0.85, M, 0, 0, Math.PI * 2), e.fillStyle = "#ffffff", e.fill(), e.stroke(), e.fillStyle = o;
618
619
  }
619
- const A = y > 1.2 ? 0.075 * n : 0.1 * n;
620
- e.beginPath(), e.ellipse(b.x + c, h + u, A, A * 1.1 * Math.min(y, 1), 0, 0, Math.PI * 2), e.fill();
620
+ const T = S > 1.2 ? 0.075 * n : 0.1 * n;
621
+ e.beginPath(), e.ellipse(b.x + c, h + u, T, T * 1.1 * Math.min(S, 1), 0, 0, Math.PI * 2), e.fill();
621
622
  }
622
- const E = xn(h, n, b.brow, y), H = b.x + a - b.side * 0.13 * n * b.squeeze, M = b.x + a + b.side * 0.13 * n * b.squeeze;
623
- e.beginPath(), e.moveTo(M, E), e.lineTo(H, E - t.browTilt * 0.1 * n), e.stroke();
623
+ const k = Bn(h, n, b.brow, S), v = b.x + a - b.side * 0.13 * n * b.squeeze, H = b.x + a + b.side * 0.13 * n * b.squeeze;
624
+ e.beginPath(), e.moveTo(H, k), e.lineTo(v, k - t.browTilt * 0.1 * n), e.stroke();
624
625
  }
625
- const f = s + Tn * n, p = 0.25 * n * Math.max(0.3, t.mouthWidth) * (1 - Do * i), d = Math.min(1, Math.max(0, t.mouth));
626
- if (e.beginPath(), d <= 0.05) {
626
+ const f = s + _n * n, p = 0.25 * n * Math.max(0.3, t.mouthWidth) * (1 - Jo * i), g = Math.min(1, Math.max(0, t.mouth));
627
+ if (e.beginPath(), g <= 0.05) {
627
628
  e.moveTo(a - p, f), e.quadraticCurveTo(a, f + t.smile * 0.25 * n, a + p, f), e.stroke();
628
629
  return;
629
630
  }
630
- const m = 0.3 * n * d;
631
+ const m = 0.3 * n * g;
631
632
  t.smile > 0.3 ? (e.moveTo(a - p, f - 0.05 * n), e.lineTo(a + p, f - 0.05 * n), e.quadraticCurveTo(a, f + m * 2, a - p, f - 0.05 * n)) : t.smile < -0.3 ? (e.moveTo(a - p, f + m * 0.6), e.lineTo(a + p, f + m * 0.6), e.quadraticCurveTo(a, f - m * 1.4, a - p, f + m * 0.6)) : e.ellipse(a, f, p * 0.8, m, 0, 0, Math.PI * 2), e.fill();
632
633
  }
633
- function Kn(e, t) {
634
- const n = t.height ?? 300, s = Math.min(3, Math.max(0.3, e.stretch ?? 1)), o = Math.sqrt(s), r = (t.headSize ?? 2 * Sn) / 2, l = t.headSize === void 0 ? Ro : 1 - 2 * r, i = r * n, a = fe(e.sit), h = e.leftHip + (-Ie - e.leftHip) * a, c = e.leftKnee + (-Ie - e.leftKnee) * a, u = e.rightHip + (Ie - e.rightHip) * a, g = e.rightKnee + (Ie - e.rightKnee) * a, f = t.classic === !0, p = fe(e.turn), d = (W, O, F, $, B) => {
635
- const U = Math.max(-Math.PI / 2, Math.min(Math.PI / 2, Math.abs(Q(O - F) / 2) + Q($))), ne = Math.max(-1, Math.min(1, Uo + B)), et = p + (1 - p) * W * ne;
636
- return f ? { x: 0, y: 0 } : { x: Math.cos(U) * Vt * et, y: Math.sin(U) * Vt };
634
+ function Fn(e, t) {
635
+ const n = t.height ?? 300, s = Math.min(3, Math.max(0.3, e.stretch ?? 1)), o = Math.sqrt(s), r = (t.headSize ?? 2 * Pn) / 2, l = t.headSize === void 0 ? Go : 1 - 2 * r, i = r * n, a = de(e.sit), h = e.leftHip + (-Fe - e.leftHip) * a, c = e.leftKnee + (-Fe - e.leftKnee) * a, u = e.rightHip + (Fe - e.rightHip) * a, d = e.rightKnee + (Fe - e.rightKnee) * a, f = t.classic === !0, p = de(e.turn), g = (W, I, N, F, R) => {
636
+ const z = Math.max(-Math.PI / 2, Math.min(Math.PI / 2, Math.abs(ne(I - N) / 2) + ne(F))), se = Math.max(-1, Math.min(1, ts + R)), st = p + (1 - p) * W * se;
637
+ return f ? { x: 0, y: 0 } : { x: Math.cos(z) * Qt * st, y: Math.sin(z) * Qt };
637
638
  }, m = { left: e.leftAnkle ?? 0, right: e.rightAnkle ?? 0 }, b = { left: e.leftFootOut ?? 0, right: e.rightFootOut ?? 0 };
638
- let y = 0;
639
+ let S = 0;
639
640
  if (a > 0 || !f) {
640
- const W = (B, U, ne, et, eo) => bt * Math.cos(Q(U)) + Ge * Math.cos(Q(U - ne)) + Math.max(0, d(B, U, ne, et, eo).y), O = Math.max(
641
+ const W = (R, z, se, st, ao) => St * Math.cos(ne(z)) + Ve * Math.cos(ne(z - se)) + Math.max(0, g(R, z, se, st, ao).y), I = Math.max(
641
642
  W(-1, h, c, m.left, b.left),
642
- W(1, u, g, m.right, b.right)
643
- ), F = 1 - fe((e.rise ?? 0) / ts), $ = (f ? Math.min(1, a / es) : 1) * F;
644
- y = (qt - O) * $ * n * s;
645
- }
646
- const E = -qt * n * s + y, H = -l * n * s + y, M = f ? 0 : (jo * fe(e.turn) + Jo * a) * n * s, A = Q(e.bend ?? 0), w = { end: Jt(E, H, A, 1), bend: A };
647
- let S;
648
- if (A !== 0) {
649
- S = [];
650
- for (let W = 0; W <= jt; W++) {
651
- const O = W / jt, F = Jt(E, H, A, O);
652
- S.push({ x: F.x - M * Math.sin(Math.PI * O), y: F.y });
643
+ W(1, u, d, m.right, b.right)
644
+ ), N = 1 - de((e.rise ?? 0) / hs), F = (f ? Math.min(1, a / as) : 1) * N;
645
+ S = (Vt - I) * F * n * s;
646
+ }
647
+ const k = -Vt * n * s + S, v = -l * n * s + S, H = f ? 0 : (ss * de(e.turn) + rs * a) * n * s, T = ne(e.bend ?? 0), M = { end: tn(k, v, T, 1), bend: T };
648
+ let w;
649
+ if (T !== 0) {
650
+ w = [];
651
+ for (let W = 0; W <= en; W++) {
652
+ const I = W / en, N = tn(k, v, T, I);
653
+ w.push({ x: N.x - H * Math.sin(Math.PI * I), y: N.y });
653
654
  }
654
655
  } else
655
- S = M === 0 ? [{ x: 0, y: E }, { x: 0, y: H }] : ke({ x: 0, y: E }, { x: -M, y: (E + H) / 2 }, { x: 0, y: H }, 1, 8);
656
- const k = H + Lo * n * s, x = (t.shoulderWidth ?? 0) * n * Math.cos(p * Math.PI / 2), v = (W, O, F, $, B) => {
657
- const U = ns(F, $);
658
- return { x: W + U.x * B * n, y: O + U.y * B * n };
659
- }, T = (W, O, F) => {
660
- const $ = v(0, E, O, W, bt * s);
661
- return { root: { x: 0, y: E }, joint: $, end: v($.x, $.y, O - F, W, Ge * s) };
662
- }, K = (W, O, F) => {
663
- const $ = { x: W * x, y: k }, B = v($.x, $.y, O, W, No * o);
664
- return { root: $, joint: B, end: v(B.x, B.y, O + F, W, Yo * o) };
665
- }, P = { left: T(-1, h, c), right: T(1, u, g) }, I = (W, O, F, $, B, U) => {
666
- const ne = d(W, F, $, B, U);
667
- return { x: O.end.x + ne.x * n * s, y: O.end.y + ne.y * n * s };
668
- }, q = (W, O, F, $, B) => v(O.end.x, O.end.y, F + $ + B, W, Hn * o), G = {
669
- left: K(-1, e.leftShoulder, e.leftElbow),
670
- right: K(1, e.rightShoulder, e.rightElbow)
656
+ w = H === 0 ? [{ x: 0, y: k }, { x: 0, y: v }] : He({ x: 0, y: k }, { x: -H, y: (k + v) / 2 }, { x: 0, y: v }, 1, 8);
657
+ const y = v + Uo * n * s, A = (t.shoulderWidth ?? 0) * n * Math.cos(p * Math.PI / 2), x = (W, I, N, F, R) => {
658
+ const z = cs(N, F);
659
+ return { x: W + z.x * R * n, y: I + z.y * R * n };
660
+ }, E = (W, I, N) => {
661
+ const F = x(0, k, I, W, St * s);
662
+ return { root: { x: 0, y: k }, joint: F, end: x(F.x, F.y, I - N, W, Ve * s) };
663
+ }, P = (W, I, N) => {
664
+ const F = { x: W * A, y }, R = x(F.x, F.y, I, W, zo * o);
665
+ return { root: F, joint: R, end: x(R.x, R.y, I + N, W, Vo * o) };
666
+ }, K = { left: E(-1, h, c), right: E(1, u, d) }, _ = (W, I, N, F, R, z) => {
667
+ const se = g(W, N, F, R, z);
668
+ return { x: I.end.x + se.x * n * s, y: I.end.y + se.y * n * s };
669
+ }, $ = (W, I, N, F, R) => x(I.end.x, I.end.y, N + F + R, W, On * o), G = {
670
+ left: P(-1, e.leftShoulder, e.leftElbow),
671
+ right: P(1, e.rightShoulder, e.rightElbow)
671
672
  };
672
673
  return {
673
674
  height: n,
674
675
  facing: (t.facing ?? 1) < 0 ? -1 : 1,
675
676
  stretch: s,
676
677
  lineWidth: t.lineWidth ?? n * 0.025,
677
- rubber: Math.min(1, Math.max(f ? 0 : Vo, t.rubber ?? 0)),
678
+ rubber: Math.min(1, Math.max(f ? 0 : os, t.rubber ?? 0)),
678
679
  r: i,
679
680
  // The head keeps its area: taller and narrower when stretched.
680
681
  headRx: i / Math.sqrt(s),
681
682
  headRy: i * Math.sqrt(s),
682
- hipY: E,
683
- neckY: H,
684
- drop: y,
685
- lean: f ? e.lean : e.lean + Zo * Math.sin(Math.PI * a),
683
+ hipY: k,
684
+ neckY: v,
685
+ drop: S,
686
+ lean: f ? e.lean : e.lean + is * Math.sin(Math.PI * a),
686
687
  classic: f,
687
- legs: P,
688
+ legs: K,
688
689
  toes: {
689
- left: I(-1, P.left, h, c, m.left, b.left),
690
- right: I(1, P.right, u, g, m.right, b.right)
690
+ left: _(-1, K.left, h, c, m.left, b.left),
691
+ right: _(1, K.right, u, d, m.right, b.right)
691
692
  },
692
- spine: S,
693
- chest: w,
693
+ spine: w,
694
+ chest: M,
694
695
  arms: G,
695
696
  handTips: {
696
- left: q(-1, G.left, e.leftShoulder, e.leftElbow, e.leftWrist ?? 0),
697
- right: q(1, G.right, e.rightShoulder, e.rightElbow, e.rightWrist ?? 0)
697
+ left: $(-1, G.left, e.leftShoulder, e.leftElbow, e.leftWrist ?? 0),
698
+ right: $(1, G.right, e.rightShoulder, e.rightElbow, e.rightWrist ?? 0)
698
699
  }
699
700
  };
700
701
  }
701
- const jt = 10;
702
- function Jt(e, t, n, s) {
702
+ const en = 10;
703
+ function tn(e, t, n, s) {
703
704
  const o = e - t, r = n * s;
704
705
  if (Math.abs(n) < 1e-9) return { x: 0, y: e - o * s };
705
706
  const l = o / n;
706
707
  return { x: l * (1 - Math.cos(r)), y: e - l * Math.sin(r) };
707
708
  }
708
- function ss(e, t) {
709
+ function us(e, t) {
709
710
  if (e.chest.bend === 0) return t;
710
- const n = We(t, { x: 0, y: e.neckY }, e.chest.bend);
711
+ const n = $e(t, { x: 0, y: e.neckY }, e.chest.bend);
711
712
  return { x: n.x + e.chest.end.x, y: n.y + e.chest.end.y - e.neckY };
712
713
  }
713
- const ve = (e, t) => t === 0 ? [e.root, e.joint, e.end] : ke(e.root, e.joint, e.end, t);
714
- function We(e, t, n) {
714
+ const xe = (e, t) => t === 0 ? [e.root, e.joint, e.end] : He(e.root, e.joint, e.end, t);
715
+ function $e(e, t, n) {
715
716
  const s = Math.cos(n), o = Math.sin(n), r = e.x - t.x, l = e.y - t.y;
716
717
  return { x: t.x + r * s - l * o, y: t.y + r * o + l * s };
717
718
  }
718
- function Pn(e, t, n = !0) {
719
- const s = is(e, t), o = t.spin ?? 0, r = t.rise ?? 0;
720
- return n && (o !== 0 || r !== 0) ? rs(s, e, o, r) : s;
719
+ function Rn(e, t, n = !0) {
720
+ const s = gs(e, t), o = t.spin ?? 0, r = t.rise ?? 0;
721
+ return n && (o !== 0 || r !== 0) ? ds(s, e, o, r) : s;
721
722
  }
722
- function Wn(e, t, n) {
723
- return { pivot: { x: 0, y: e.hipY }, angle: e.facing * Q(t), lift: n * e.height };
723
+ function Nn(e, t, n) {
724
+ return { pivot: { x: 0, y: e.hipY }, angle: e.facing * ne(t), lift: n * e.height };
724
725
  }
725
- function rs(e, t, n, s) {
726
- const { pivot: o, angle: r, lift: l } = Wn(t, n, s), i = (g) => {
727
- const f = We(g, o, r);
726
+ function ds(e, t, n, s) {
727
+ const { pivot: o, angle: r, lift: l } = Nn(t, n, s), i = (d) => {
728
+ const f = $e(d, o, r);
728
729
  return { x: f.x, y: f.y - l };
729
- }, a = (g) => ({ left: i(g.left), right: i(g.right) }), h = { left: Math.max(i(e.feet.left).y, i(e.toes.left).y), right: Math.max(i(e.feet.right).y, i(e.toes.right).y) }, c = Math.max(h.left, h.right), u = vn * t.height;
730
+ }, a = (d) => ({ left: i(d.left), right: i(d.right) }), h = { left: Math.max(i(e.feet.left).y, i(e.toes.left).y), right: Math.max(i(e.feet.right).y, i(e.toes.right).y) }, c = Math.max(h.left, h.right), u = In * t.height;
730
731
  return {
731
732
  ...e,
732
733
  hip: i(e.hip),
@@ -751,20 +752,20 @@ function rs(e, t, n, s) {
751
752
  head: { ...e.head, center: i(e.head.center), angle: e.head.angle + r }
752
753
  };
753
754
  }
754
- function is(e, t) {
755
- const n = Q(e.lean), s = Q(t.headTilt), o = { x: 0, y: e.hipY }, r = (H) => ({ x: e.facing * H.x, y: H.y }), l = (H) => r(We(H, o, n)), i = (H) => l(ss(e, H)), a = (H) => i(We({ x: H.x, y: H.y + e.neckY }, { x: 0, y: e.neckY }, s)), h = ve(e.arms.left, e.rubber).map(i), c = ve(e.arms.right, e.rubber).map(i), u = (H, M) => Math.atan2(M.y - H.y, M.x - H.x), g = { left: i(e.handTips.left), right: i(e.handTips.right) }, f = (H, M) => {
756
- const [A, w] = H.slice(-2), S = e.arms[M], k = u(i(S.end), g[M]) - u(i(S.joint), i(S.end));
757
- return u(A, w) + k;
755
+ function gs(e, t) {
756
+ const n = ne(e.lean), s = ne(t.headTilt), o = { x: 0, y: e.hipY }, r = (v) => ({ x: e.facing * v.x, y: v.y }), l = (v) => r($e(v, o, n)), i = (v) => l(us(e, v)), a = (v) => i($e({ x: v.x, y: v.y + e.neckY }, { x: 0, y: e.neckY }, s)), h = xe(e.arms.left, e.rubber).map(i), c = xe(e.arms.right, e.rubber).map(i), u = (v, H) => Math.atan2(H.y - v.y, H.x - v.x), d = { left: i(e.handTips.left), right: i(e.handTips.right) }, f = (v, H) => {
757
+ const [T, M] = v.slice(-2), w = e.arms[H], y = u(i(w.end), d[H]) - u(i(w.joint), i(w.end));
758
+ return u(T, M) + y;
758
759
  };
759
760
  let p = 1 / 0;
760
- for (const [H, M] of [
761
+ for (const [v, H] of [
761
762
  [t.leftBrow, t.leftEye],
762
763
  [t.rightBrow, t.rightEye]
763
764
  ]) {
764
- const A = xn(wt, 1, H, An(M, t.blink));
765
- p = Math.min(p, A, A - t.browTilt * 0.1);
765
+ const T = Bn(Et, 1, v, $n(H, t.blink));
766
+ p = Math.min(p, T, T - t.browTilt * 0.1);
766
767
  }
767
- const d = { left: r(e.legs.left.end), right: r(e.legs.right.end) }, m = { left: r(e.toes.left), right: r(e.toes.right) }, b = { left: Math.max(d.left.y, m.left.y), right: Math.max(d.right.y, m.right.y) }, y = Math.max(b.left, b.right), E = vn * e.height;
768
+ const g = { left: r(e.legs.left.end), right: r(e.legs.right.end) }, m = { left: r(e.toes.left), right: r(e.toes.right) }, b = { left: Math.max(g.left.y, m.left.y), right: Math.max(g.right.y, m.right.y) }, S = Math.max(b.left, b.right), k = In * e.height;
768
769
  return {
769
770
  facing: e.facing,
770
771
  height: e.height,
@@ -776,17 +777,17 @@ function is(e, t) {
776
777
  elbows: { left: i(e.arms.left.joint), right: i(e.arms.right.joint) },
777
778
  hands: { left: i(e.arms.left.end), right: i(e.arms.right.end) },
778
779
  knees: { left: r(e.legs.left.joint), right: r(e.legs.right.joint) },
779
- feet: d,
780
+ feet: g,
780
781
  toes: m,
781
- feetY: y,
782
- grounded: { left: b.left >= y - E, right: b.right >= y - E },
783
- fingertips: g,
782
+ feetY: S,
783
+ grounded: { left: b.left >= S - k, right: b.right >= S - k },
784
+ fingertips: d,
784
785
  handAngle: { left: f(h, "left"), right: f(c, "right") },
785
786
  limbs: {
786
787
  leftArm: h,
787
788
  rightArm: c,
788
- leftLeg: ve(e.legs.left, e.rubber).map(r),
789
- rightLeg: ve(e.legs.right, e.rubber).map(r),
789
+ leftLeg: xe(e.legs.left, e.rubber).map(r),
790
+ rightLeg: xe(e.legs.right, e.rubber).map(r),
790
791
  spine: e.spine.map(l)
791
792
  },
792
793
  head: {
@@ -795,20 +796,20 @@ function is(e, t) {
795
796
  ry: e.headRy,
796
797
  // Mirroring a turn reverses it.
797
798
  angle: e.facing * (n + e.chest.bend + s),
798
- eyeY: wt,
799
+ eyeY: Et,
799
800
  browTopY: p,
800
- mouthY: Tn,
801
- faceX: e.facing * (En + Mn * fe(t.turn))
801
+ mouthY: _n,
802
+ faceX: e.facing * (Kn + Wn * de(t.turn))
802
803
  }
803
804
  };
804
805
  }
805
- function ls(e, t = {}) {
806
- return Pn(Kn(e, t), e);
806
+ function ps(e, t = {}) {
807
+ return Rn(Fn(e, t), e);
807
808
  }
808
- function pi(e, t, n) {
809
- return We({ x: e.center.x + t * e.rx, y: e.center.y + n * e.ry }, e.center, e.angle);
809
+ function Pi(e, t, n) {
810
+ return $e({ x: e.center.x + t * e.rx, y: e.center.y + n * e.ry }, e.center, e.angle);
810
811
  }
811
- function as(e, t, n) {
812
+ function ms(e, t, n) {
812
813
  const s = (r) => ({ x: r.x + t, y: r.y + n }), o = (r) => ({ left: s(r.left), right: s(r.right) });
813
814
  return {
814
815
  ...e,
@@ -833,118 +834,118 @@ function as(e, t, n) {
833
834
  head: { ...e.head, center: s(e.head.center) }
834
835
  };
835
836
  }
836
- function hs(e, t, n = {}, s = 0) {
837
- const o = Kn(t, n), r = n.color ?? "#1e293b", l = n.layers ?? {}, i = n.layers ? Pn(o, t, !1) : void 0, a = n.sketch ? ut(e, n.sketch, s) : void 0, h = n.sketch && n.layers ? ut(e, n.sketch, s) : void 0, c = (w) => {
838
- e.save(), w(), e.restore();
839
- }, u = (w) => {
840
- w && i && c(() => w(e, i, s, h));
841
- }, g = () => e.scale(o.facing, 1), f = () => {
842
- g(), e.translate(0, o.hipY), e.rotate(Q(o.lean)), e.translate(0, -o.hipY);
837
+ function bs(e, t, n = {}, s = 0) {
838
+ const o = Fn(t, n), r = n.color ?? "#1e293b", l = n.layers ?? {}, i = n.layers ? Rn(o, t, !1) : void 0, a = n.sketch ? mt(e, n.sketch, s) : void 0, h = n.sketch && n.layers ? mt(e, n.sketch, s) : void 0, c = (M) => {
839
+ e.save(), M(), e.restore();
840
+ }, u = (M) => {
841
+ M && i && c(() => M(e, i, s, h));
842
+ }, d = () => e.scale(o.facing, 1), f = () => {
843
+ d(), e.translate(0, o.hipY), e.rotate(ne(o.lean)), e.translate(0, -o.hipY);
843
844
  }, p = () => {
844
845
  f(), o.chest.bend !== 0 && (e.translate(o.chest.end.x, o.chest.end.y), e.rotate(o.chest.bend), e.translate(0, -o.neckY));
845
- }, d = (w, S, k) => {
846
- if (a) return S ? a.curve(w) : a.line(w);
846
+ }, g = (M, w, y) => {
847
+ if (a) return w ? a.curve(M) : a.line(M);
847
848
  if (o.classic) {
848
- e.beginPath(), e.moveTo(w[0].x, w[0].y);
849
- for (const x of w.slice(1)) e.lineTo(x.x, x.y);
849
+ e.beginPath(), e.moveTo(M[0].x, M[0].y);
850
+ for (const A of M.slice(1)) e.lineTo(A.x, A.y);
850
851
  e.stroke();
851
852
  return;
852
853
  }
853
- vt(e, w, k[0] * o.lineWidth, k[1] * o.lineWidth);
854
- }, m = (w, S) => d(ve(w, o.rubber), o.rubber > 0, S), b = (w) => {
855
- o.classic || d([o.legs[w].end, o.toes[w]], !1, Go);
856
- }, y = (w) => {
857
- if (n.hands && !o.classic) return H(w);
854
+ Pt(e, M, y[0] * o.lineWidth, y[1] * o.lineWidth);
855
+ }, m = (M, w) => g(xe(M, o.rubber), o.rubber > 0, w), b = (M) => {
856
+ o.classic || g([o.legs[M].end, o.toes[M]], !1, es);
857
+ }, S = (M) => {
858
+ if (n.hands && !o.classic) return v(M);
858
859
  if (o.classic || a) return;
859
- const S = o.arms[w].end;
860
- e.beginPath(), e.arc(S.x, S.y, zo * o.lineWidth, 0, Math.PI * 2), e.fill();
860
+ const w = o.arms[M].end;
861
+ e.beginPath(), e.arc(w.x, w.y, ns * o.lineWidth, 0, Math.PI * 2), e.fill();
861
862
  };
862
863
  e.save(), e.strokeStyle = r, e.fillStyle = r, e.lineWidth = o.lineWidth, e.lineCap = "round", e.lineJoin = "round";
863
- const E = Wn(o, t.spin ?? 0, t.rise ?? 0);
864
- (E.angle !== 0 || E.lift !== 0) && (e.translate(0, -E.lift), e.translate(E.pivot.x, E.pivot.y), e.rotate(E.angle), e.translate(-E.pivot.x, -E.pivot.y));
865
- function H(w) {
866
- const S = n.hands ?? {}, k = o.arms[w].end, x = o.handTips[w], v = n.headFill ?? "#ffffff";
867
- Tt(e, k, S[w] ?? L, {
868
- side: w,
864
+ const k = Nn(o, t.spin ?? 0, t.rise ?? 0);
865
+ (k.angle !== 0 || k.lift !== 0) && (e.translate(0, -k.lift), e.translate(k.pivot.x, k.pivot.y), e.rotate(k.angle), e.translate(-k.pivot.x, -k.pivot.y));
866
+ function v(M) {
867
+ const w = n.hands ?? {}, y = o.arms[M].end, A = o.handTips[M], x = n.headFill ?? "#ffffff";
868
+ Kt(e, y, w[M] ?? Y, {
869
+ side: M,
869
870
  // Degrees clockwise from straight up, in the frame the hand is drawn in.
870
- angle: Math.atan2(x.x - k.x, k.y - x.y) * 180 / Math.PI,
871
- size: (S.size ?? Hn) * o.height * Math.sqrt(o.stretch),
872
- skin: S.skin ?? (v === "none" ? void 0 : v),
871
+ angle: Math.atan2(A.x - y.x, y.y - A.y) * 180 / Math.PI,
872
+ size: (w.size ?? On) * o.height * Math.sqrt(o.stretch),
873
+ skin: w.skin ?? (x === "none" ? void 0 : x),
873
874
  ink: r,
874
875
  lineWidth: o.lineWidth * 0.45,
875
- fingers: S.fingers,
876
- plump: S.plump,
876
+ fingers: w.fingers,
877
+ plump: w.plump,
877
878
  look: n.sketch ? "pencil" : "clean",
878
879
  seed: n.sketch?.seed
879
880
  }, s);
880
881
  }
881
- const M = (w) => {
882
+ const H = (M) => {
882
883
  c(() => {
883
- p(), m(o.arms[w], qo), y(w);
884
+ p(), m(o.arms[M], Qo), S(M);
884
885
  });
885
- const S = l.sleeve;
886
- S && i && c(() => S(e, i, w, s, h));
887
- }, A = fe(t.turn) > Qo;
886
+ const w = l.sleeve;
887
+ w && i && c(() => w(e, i, M, s, h));
888
+ }, T = de(t.turn) > ls;
888
889
  u(l.behind), c(() => {
889
- g(), m(o.legs.left, zt), b("left"), m(o.legs.right, zt), b("right");
890
- }), A && M("left"), c(() => {
891
- f(), d(o.spine, o.spine.length > 2, Xo);
890
+ d(), m(o.legs.left, Zt), b("left"), m(o.legs.right, Zt), b("right");
891
+ }), T && H("left"), c(() => {
892
+ f(), g(o.spine, o.spine.length > 2, Zo);
892
893
  }), c(() => {
893
894
  p();
894
- const { left: w, right: S } = { left: o.arms.left.root, right: o.arms.right.root };
895
- if (w.x !== S.x)
896
- if (o.classic) d([w, S], !1, [1, 1]);
895
+ const { left: M, right: w } = { left: o.arms.left.root, right: o.arms.right.root };
896
+ if (M.x !== w.x)
897
+ if (o.classic) g([M, w], !1, [1, 1]);
897
898
  else {
898
- const k = { x: (w.x + S.x) / 2, y: w.y - 0.3 * Math.abs(S.x - w.x) };
899
- d(ke(w, k, S, 1, 8), !0, [1.1, 1.1]);
899
+ const y = { x: (M.x + w.x) / 2, y: M.y - 0.3 * Math.abs(w.x - M.x) };
900
+ g(He(M, y, w, 1, 8), !0, [1.1, 1.1]);
900
901
  }
901
- }), u(l.body), A || M("left"), M("right"), u(l.behindHead), c(() => {
902
- p(), e.translate(0, o.neckY), e.rotate(Q(t.headTilt));
903
- const w = -o.headRy;
904
- e.beginPath(), e.ellipse(0, w, o.headRx, o.headRy, 0, 0, Math.PI * 2);
905
- const S = n.headFill ?? "#ffffff";
906
- if (S !== "none" && (e.fillStyle = S, e.fill()), a) {
907
- a.ellipse(0, w, o.headRx, o.headRy);
908
- const k = a.nudge();
909
- e.translate(k.x, k.y);
902
+ }), u(l.body), T || H("left"), H("right"), u(l.behindHead), c(() => {
903
+ p(), e.translate(0, o.neckY), e.rotate(ne(t.headTilt));
904
+ const M = -o.headRy;
905
+ e.beginPath(), e.ellipse(0, M, o.headRx, o.headRy, 0, 0, Math.PI * 2);
906
+ const w = n.headFill ?? "#ffffff";
907
+ if (w !== "none" && (e.fillStyle = w, e.fill()), a) {
908
+ a.ellipse(0, M, o.headRx, o.headRy);
909
+ const y = a.nudge();
910
+ e.translate(y.x, y.y);
910
911
  } else
911
912
  e.stroke();
912
- e.translate(0, w), e.scale(o.headRx / o.r, o.headRy / o.r), os(e, t, o.r, 0, r, o.lineWidth);
913
+ e.translate(0, M), e.scale(o.headRx / o.r, o.headRy / o.r), fs(e, t, o.r, 0, r, o.lineWidth);
913
914
  }), u(l.overHead), u(l.front), e.restore(), n.label && (e.save(), e.fillStyle = r, e.font = n.labelFont ?? `700 ${Math.round(o.height * 0.11)}px sans-serif`, e.textAlign = "center", e.textBaseline = "bottom", e.fillText(n.label, 0, -o.height * o.stretch - 0.04 * o.height + o.drop), e.restore());
914
915
  }
915
- function On(e, t, n) {
916
+ function Ln(e, t, n) {
916
917
  const s = { ...e };
917
- let o = e.walking > 0 ? Pe(s, Oo(e.gait, e.walk, s), e.walking) : s, r = fs(e);
918
+ let o = e.walking > 0 ? _e(s, Lo(e.gait, e.walk, s), e.walking) : s, r = ys(e);
918
919
  const l = e.dancing ?? 0;
919
920
  if (n && l > 0) {
920
921
  const i = n(e.beat ?? 0);
921
- if (o = Pe(o, i.pose, l), i.hands) {
922
- const a = (h, c) => c ? Ke(h ?? L, c, l) : h;
922
+ if (o = _e(o, i.pose, l), i.hands) {
923
+ const a = (h, c) => c ? Ie(h ?? Y, c, l) : h;
923
924
  r = { left: a(r?.left, i.hands.left), right: a(r?.right, i.hands.right) };
924
925
  }
925
926
  }
926
- return e.talk > 0 && (o = { ...o, mouth: Math.max(o.mouth, e.talk * Fo(t)) }), { pose: o, hands: r };
927
+ return e.talk > 0 && (o = { ...o, mouth: Math.max(o.mouth, e.talk * qo(t)) }), { pose: o, hands: r };
927
928
  }
928
- function cs(e, t, n) {
929
- return On(e, t, n).pose;
929
+ function ws(e, t, n) {
930
+ return Ln(e, t, n).pose;
930
931
  }
931
- const In = (e, t) => (e.facing ?? t.facing ?? 1) < 0 ? -1 : 1, Ue = (e, t) => `hand.${e}.${t}`;
932
- function fs(e) {
932
+ const Yn = (e, t) => (e.facing ?? t.facing ?? 1) < 0 ? -1 : 1, je = (e, t) => `hand.${e}.${t}`;
933
+ function ys(e) {
933
934
  const t = (o) => {
934
- if (typeof e[Ue(o, "spread")] == "number")
935
- return Object.fromEntries(Object.keys(L).map((r) => [r, e[Ue(o, r)]]));
935
+ if (typeof e[je(o, "spread")] == "number")
936
+ return Object.fromEntries(Object.keys(Y).map((r) => [r, e[je(o, r)]]));
936
937
  }, n = t("left"), s = t("right");
937
938
  return n || s ? { left: n, right: s } : void 0;
938
939
  }
939
- function us(e, t) {
940
+ function ks(e, t) {
940
941
  return !t || !e.hands ? e : { ...e, hands: { ...e.hands, left: t.left ?? e.hands.left, right: t.right ?? e.hands.right } };
941
942
  }
942
- function mi(e) {
943
- const t = e.style ?? {}, n = t.height ?? 300, s = n * 0.8, o = { ...z(e.pose ?? {}), walk: 0, walking: 0, gait: "walk", facing: (t.facing ?? 1) < 0 ? -1 : 1, talk: 0, rubber: t.rubber ?? 0, beat: 0, dancing: 0 }, r = {};
943
+ function Ki(e) {
944
+ const t = e.style ?? {}, n = t.height ?? 300, s = n * 0.8, o = { ...V(e.pose ?? {}), walk: 0, walking: 0, gait: "walk", facing: (t.facing ?? 1) < 0 ? -1 : 1, talk: 0, rubber: t.rubber ?? 0, beat: 0, dancing: 0 }, r = {};
944
945
  if (t.hands)
945
946
  for (const l of ["left", "right"]) {
946
- const i = t.hands[l] ?? L;
947
- for (const a of Object.keys(L)) r[Ue(l, a)] = i[a] ?? L[a];
947
+ const i = t.hands[l] ?? Y;
948
+ for (const a of Object.keys(Y)) r[je(l, a)] = i[a] ?? Y[a];
948
949
  }
949
950
  return {
950
951
  type: "custom",
@@ -956,31 +957,31 @@ function mi(e) {
956
957
  figureStyle: t,
957
958
  figureDance: e.dance,
958
959
  draw(l, i, a) {
959
- const h = i.props, c = On(h, a, e.dance);
960
- l.translate(s / 2, n), hs(l, c.pose, us({ ...t, rubber: h.rubber, facing: In(h, t) }, c.hands), a);
960
+ const h = i.props, c = Ln(h, a, e.dance);
961
+ l.translate(s / 2, n), bs(l, c.pose, ks({ ...t, rubber: h.rubber, facing: Yn(h, t) }, c.hands), a);
961
962
  }
962
963
  };
963
964
  }
964
- function ds(e, t, n) {
965
+ function Ss(e, t, n) {
965
966
  const s = e.figureStyle;
966
967
  if (!s) throw new Error("stickFigureAt: the target was not made by stickFigureTarget");
967
968
  const o = { ...e.props };
968
969
  let r = 0, l = 0;
969
970
  for (const [h, c] of t.state?.values.get(n) ?? [])
970
971
  h === "gait" && typeof c == "string" && (o.gait = c), typeof c == "number" && (h === "x" || h === "motionPathX" ? r = c : h === "y" || h === "motionPathY" ? l = c : h in o && (o[h] = c));
971
- const i = cs(o, t.time, e.figureDance), a = ls(i, { ...s, rubber: o.rubber, facing: In(o, s) });
972
- return { pose: i, joints: as(a, e.x + r + e.width / 2, e.y + l + e.height) };
972
+ const i = ws(o, t.time, e.figureDance), a = ps(i, { ...s, rubber: o.rubber, facing: Yn(o, s) });
973
+ return { pose: i, joints: ms(a, e.x + r + e.width / 2, e.y + l + e.height) };
973
974
  }
974
- function _n(e) {
975
+ function Cn(e) {
975
976
  const t = [];
976
977
  return e.forEach((n, s) => {
977
- const o = s === 0 ? _ : t[s - 1], r = typeof n.pose == "string" ? Oe[n.pose] : { ...o, ...n.pose };
978
- t.push(n.expression ? qe(r, n.expression) : r);
978
+ const o = s === 0 ? B : t[s - 1], r = typeof n.pose == "string" ? Be[n.pose] : { ...o, ...n.pose };
979
+ t.push(n.expression ? We(r, n.expression) : r);
979
980
  }), t;
980
981
  }
981
- function bi(e, t) {
982
- const n = _n(t);
983
- return kn.filter((s) => n.some((o) => o[s] !== _[s])).map((s) => ({
982
+ function Wi(e, t) {
983
+ const n = Cn(t);
984
+ return xn.filter((s) => n.some((o) => o[s] !== B[s])).map((s) => ({
984
985
  id: `${e}-${s}`,
985
986
  target: e,
986
987
  property: s,
@@ -991,53 +992,53 @@ function bi(e, t) {
991
992
  }))
992
993
  }));
993
994
  }
994
- const tt = 0.5, Zt = {
995
+ const rt = 0.5, nn = {
995
996
  /** Flag: fingers together and straight, thumb bent in */
996
- pataka: R({ "thumb.curl": 0.3, "thumb.across": 0.6, "index.curl": 0, "middle.curl": 0, "ring.curl": 0, "pinky.curl": 0, spread: 0, turn: 2 }),
997
+ pataka: L({ "thumb.curl": 0.3, "thumb.across": 0.6, "index.curl": 0, "middle.curl": 0, "ring.curl": 0, "pinky.curl": 0, spread: 0, turn: 2 }),
997
998
  /** Pataka with the ring finger bent */
998
- tripataka: R({ "thumb.curl": 0.3, "thumb.across": 0.6, "index.curl": 0, "middle.curl": 0, "ring.curl": 1, "pinky.curl": 0, spread: 0, turn: 2 }),
999
+ tripataka: L({ "thumb.curl": 0.3, "thumb.across": 0.6, "index.curl": 0, "middle.curl": 0, "ring.curl": 1, "pinky.curl": 0, spread: 0, turn: 2 }),
999
1000
  /** Lotus in bloom: fingers fanned, each a little more curled than the last */
1000
- alapadma: R({ "thumb.curl": 0.1, "thumb.across": 0, "index.curl": 0.05, "middle.curl": 0.15, "ring.curl": 0.25, "pinky.curl": 0.35, spread: 1, turn: 2 }),
1001
+ alapadma: L({ "thumb.curl": 0.1, "thumb.across": 0, "index.curl": 0.05, "middle.curl": 0.15, "ring.curl": 0.25, "pinky.curl": 0.35, spread: 1, turn: 2 }),
1001
1002
  /** Fist */
1002
- mushti: C.fist,
1003
+ mushti: q.fist,
1003
1004
  /** Fist, thumb up */
1004
- shikhara: C.thumbsUp,
1005
+ shikhara: q.thumbsUp,
1005
1006
  /** Swan's beak: thumb and index touch, the others fanned */
1006
- hamsasya: R({ "thumb.curl": 0.15, "thumb.across": 0.6, "index.curl": 0.6, "middle.curl": 0, "ring.curl": 0, "pinky.curl": 0, spread: 0.7, turn: 2 }),
1007
+ hamsasya: L({ "thumb.curl": 0.15, "thumb.across": 0.6, "index.curl": 0.6, "middle.curl": 0, "ring.curl": 0, "pinky.curl": 0, spread: 0.7, turn: 2 }),
1007
1008
  /** Bracelet: thumb, index and middle meet, ring and little finger out */
1008
- katakamukha: R({ "thumb.curl": 0.2, "thumb.across": 0.6, "index.curl": 0.65, "middle.curl": 0.7, "ring.curl": 0, "pinky.curl": 0, spread: 0.4, turn: 2 })
1009
+ katakamukha: L({ "thumb.curl": 0.2, "thumb.across": 0.6, "index.curl": 0.65, "middle.curl": 0.7, "ring.curl": 0, "pinky.curl": 0, spread: 0.4, turn: 2 })
1009
1010
  };
1010
- function ze(e) {
1011
- return typeof e != "string" ? e : e in Zt ? Zt[e] : C[e];
1011
+ function Je(e) {
1012
+ return typeof e != "string" ? e : e in nn ? nn[e] : q[e];
1012
1013
  }
1013
- function $n(e, t, n) {
1014
+ function Dn(e, t, n) {
1014
1015
  const s = [];
1015
1016
  for (const o of e.keys) {
1016
1017
  const r = s[s.length - 1], l = !r || o.reset ? { pose: t, ...n } : r;
1017
1018
  s.push({
1018
1019
  beat: o.beat,
1019
1020
  pose: { ...l.pose, ...o.pose },
1020
- left: o.hands?.left ? ze(o.hands.left) : l.left,
1021
- right: o.hands?.right ? ze(o.hands.right) : l.right,
1021
+ left: o.hands?.left ? Je(o.hands.left) : l.left,
1022
+ right: o.hands?.right ? Je(o.hands.right) : l.right,
1022
1023
  easing: o.easing ?? e.easing
1023
1024
  });
1024
1025
  }
1025
1026
  return s;
1026
1027
  }
1027
- const At = (e, t) => (e % t + t) % t;
1028
- function gs(e, t, n, s) {
1029
- const o = $n(e, n, s);
1028
+ const Wt = (e, t) => (e % t + t) % t;
1029
+ function Es(e, t, n, s) {
1030
+ const o = Dn(e, n, s);
1030
1031
  if (o.length === 0) return { pose: n, hands: s };
1031
- const r = At(t, e.beats);
1032
+ const r = Wt(t, e.beats);
1032
1033
  let l = o.length - 1;
1033
1034
  for (let f = 0; f < o.length; f++) o[f].beat <= r && (l = f);
1034
- const i = o[l], a = o[(l + 1) % o.length], h = i.beat <= r ? i.beat : i.beat - e.beats, c = a.beat > h ? a.beat : a.beat + e.beats, u = c > h ? (r - h) / (c - h) : 0, g = Qe(a.easing ?? "ease-in-out")(Math.min(1, Math.max(0, u)));
1035
+ const i = o[l], a = o[(l + 1) % o.length], h = i.beat <= r ? i.beat : i.beat - e.beats, c = a.beat > h ? a.beat : a.beat + e.beats, u = c > h ? (r - h) / (c - h) : 0, d = nt(a.easing ?? "ease-in-out")(Math.min(1, Math.max(0, u)));
1035
1036
  return {
1036
- pose: Pe(i.pose, a.pose, g),
1037
- hands: { left: Ke(i.left, a.left, g), right: Ke(i.right, a.right, g) }
1037
+ pose: _e(i.pose, a.pose, d),
1038
+ hands: { left: Ie(i.left, a.left, d), right: Ie(i.right, a.right, d) }
1038
1039
  };
1039
1040
  }
1040
- const ps = [
1041
+ const Ms = [
1041
1042
  ["leftShoulder", "rightShoulder"],
1042
1043
  ["leftElbow", "rightElbow"],
1043
1044
  ["leftWrist", "rightWrist"],
@@ -1047,19 +1048,19 @@ const ps = [
1047
1048
  ["leftFootOut", "rightFootOut"],
1048
1049
  ["leftEye", "rightEye"],
1049
1050
  ["leftBrow", "rightBrow"]
1050
- ], ms = ["lean", "headTilt", "lookX", "spin"], bs = /* @__PURE__ */ new Set(["leftShoulder", "rightShoulder", "leftElbow", "rightElbow", "leftWrist", "rightWrist", "leftHip", "rightHip", "leftKnee", "rightKnee"]);
1051
- function ws(e) {
1051
+ ], Hs = ["lean", "headTilt", "lookX", "spin"], vs = /* @__PURE__ */ new Set(["leftShoulder", "rightShoulder", "leftElbow", "rightElbow", "leftWrist", "rightWrist", "leftHip", "rightHip", "leftKnee", "rightKnee"]);
1052
+ function Ts(e) {
1052
1053
  const t = { ...e }, n = (e.turn ?? 0) >= 0.5;
1053
- for (const [s, o] of ps) {
1054
- const r = n && bs.has(s) ? -1 : 1;
1054
+ for (const [s, o] of Ms) {
1055
+ const r = n && vs.has(s) ? -1 : 1;
1055
1056
  t[s] = r * e[o], t[o] = r * e[s];
1056
1057
  }
1057
- if (!n) for (const s of ms) t[s] = -e[s];
1058
+ if (!n) for (const s of Hs) t[s] = -e[s];
1058
1059
  return t;
1059
1060
  }
1060
- const ys = (e) => Math.min(1, Math.max(-1, (0.5 - e) * 4));
1061
- function ks(e, t, n) {
1062
- const s = At(n, 1), o = (1 + Math.cos(2 * Math.PI * s)) / 2, r = t.bounce * (t.accent === "up" ? 1 - o : o), l = Math.min(1, Math.max(0, e.turn ?? 0)), i = ys(l);
1061
+ const As = (e) => Math.min(1, Math.max(-1, (0.5 - e) * 4));
1062
+ function xs(e, t, n) {
1063
+ const s = Wt(n, 1), o = (1 + Math.cos(2 * Math.PI * s)) / 2, r = t.bounce * (t.accent === "up" ? 1 - o : o), l = Math.min(1, Math.max(0, e.turn ?? 0)), i = As(l);
1063
1064
  return {
1064
1065
  ...e,
1065
1066
  leftHip: e.leftHip + i * r / 2,
@@ -1069,128 +1070,128 @@ function ks(e, t, n) {
1069
1070
  lean: e.lean + (t.sway ?? 0) * (1 - l) * Math.sin(Math.PI * n)
1070
1071
  };
1071
1072
  }
1072
- function yt(e) {
1073
- const t = { ..._, ...e.stance };
1074
- return e.expression ? qe(t, e.expression) : t;
1073
+ function Mt(e) {
1074
+ const t = { ...B, ...e.stance };
1075
+ return e.expression ? We(t, e.expression) : t;
1075
1076
  }
1076
- function Bn(e) {
1077
+ function Xn(e) {
1077
1078
  return {
1078
- left: e.hands?.left ? ze(e.hands.left) : L,
1079
- right: e.hands?.right ? ze(e.hands.right) : L
1079
+ left: e.hands?.left ? Je(e.hands.left) : Y,
1080
+ right: e.hands?.right ? Je(e.hands.right) : Y
1080
1081
  };
1081
1082
  }
1082
- function nt(e, t, n) {
1083
+ function it(e, t, n) {
1083
1084
  const s = e.moves[t.move];
1084
1085
  if (!s) throw new Error(`dance: "${e.label}" has no move "${t.move}"`);
1085
- const o = gs(s, n, yt(e), Bn(e));
1086
- return t.mirror ? { pose: ws(o.pose), hands: { left: o.hands?.right, right: o.hands?.left } } : o;
1086
+ const o = Es(s, n, Mt(e), Xn(e));
1087
+ return t.mirror ? { pose: Ts(o.pose), hands: { left: o.hands?.right, right: o.hands?.left } } : o;
1087
1088
  }
1088
- function xt(e, t, n = {}) {
1089
- const s = typeof e == "string" ? Se[e] : e;
1089
+ function Ot(e, t, n = {}) {
1090
+ const s = typeof e == "string" ? ve[e] : e;
1090
1091
  let o;
1091
1092
  if (n.move)
1092
- o = nt(s, { move: n.move, mirror: n.mirror }, t);
1093
+ o = it(s, { move: n.move, mirror: n.mirror }, t);
1093
1094
  else {
1094
- const r = s.routine, l = r.reduce((u, g) => u + g.beats, 0), i = At(t, l);
1095
+ const r = s.routine, l = r.reduce((u, d) => u + d.beats, 0), i = Wt(t, l);
1095
1096
  let a = 0, h = 0;
1096
1097
  for (; h < r.length - 1 && i >= a + r[h].beats; ) a += r[h++].beats;
1097
1098
  const c = i - a;
1098
- if (o = nt(s, r[h], c), c < tt && r.length > 1 && t >= tt) {
1099
- const u = r[(h - 1 + r.length) % r.length], g = nt(s, u, u.beats + c), f = Qe("ease-in-out")(c / tt);
1099
+ if (o = it(s, r[h], c), c < rt && r.length > 1 && t >= rt) {
1100
+ const u = r[(h - 1 + r.length) % r.length], d = it(s, u, u.beats + c), f = nt("ease-in-out")(c / rt);
1100
1101
  o = {
1101
- pose: Pe(g.pose, o.pose, f),
1102
- hands: { left: Ke(g.hands.left, o.hands.left, f), right: Ke(g.hands.right, o.hands.right, f) }
1102
+ pose: _e(d.pose, o.pose, f),
1103
+ hands: { left: Ie(d.hands.left, o.hands.left, f), right: Ie(d.hands.right, o.hands.right, f) }
1103
1104
  };
1104
1105
  }
1105
1106
  }
1106
- return { ...o, pose: ks(o.pose, s.groove, t) };
1107
+ return { ...o, pose: xs(o.pose, s.groove, t) };
1107
1108
  }
1108
- function wi(e, t, n = {}) {
1109
- return xt(e, t, n).pose;
1109
+ function Oi(e, t, n = {}) {
1110
+ return Ot(e, t, n).pose;
1110
1111
  }
1111
- function Kt(e) {
1112
- return (typeof e == "string" ? Se[e] : e).routine.reduce((n, s) => n + s.beats, 0);
1112
+ function It(e) {
1113
+ return (typeof e == "string" ? ve[e] : e).routine.reduce((n, s) => n + s.beats, 0);
1113
1114
  }
1114
- const Ss = { leftToe: "rightToe", rightToe: "leftToe", leftHeel: "rightHeel", rightHeel: "leftHeel" };
1115
- function Qt(e, t, n, s, o, r, l) {
1115
+ const Ps = { leftToe: "rightToe", rightToe: "leftToe", leftHeel: "rightHeel", rightHeel: "leftHeel" };
1116
+ function on(e, t, n, s, o, r, l) {
1116
1117
  for (let i = 0; i * e.beats < n; i++)
1117
1118
  for (const a of e.keys) {
1118
1119
  const h = i * e.beats + a.beat, c = t + h;
1119
1120
  if (!(h >= n || c < r || c >= l))
1120
- for (const u of a.taps ?? []) o.push({ beat: c, tap: s ? Ss[u] : u });
1121
+ for (const u of a.taps ?? []) o.push({ beat: c, tap: s ? Ps[u] : u });
1121
1122
  }
1122
1123
  }
1123
- function yi(e, t, n, s = {}) {
1124
- const o = typeof e == "string" ? Se[e] : e, r = [];
1124
+ function Ii(e, t, n, s = {}) {
1125
+ const o = typeof e == "string" ? ve[e] : e, r = [];
1125
1126
  if (n <= t) return r;
1126
1127
  if (s.move) {
1127
1128
  const l = o.moves[s.move], i = Math.floor(t / l.beats) * l.beats;
1128
- Qt(l, i, Math.ceil((n - i) / l.beats) * l.beats, s.mirror, r, t, n);
1129
+ on(l, i, Math.ceil((n - i) / l.beats) * l.beats, s.mirror, r, t, n);
1129
1130
  } else {
1130
- const l = Kt(o);
1131
+ const l = It(o);
1131
1132
  for (let i = Math.floor(t / l) * l; i < n; i += l) {
1132
1133
  let a = i;
1133
1134
  for (const h of o.routine)
1134
- Qt(o.moves[h.move], a, h.beats, h.mirror, r, t, n), a += h.beats;
1135
+ on(o.moves[h.move], a, h.beats, h.mirror, r, t, n), a += h.beats;
1135
1136
  }
1136
1137
  }
1137
1138
  return r.sort((l, i) => l.beat - i.beat);
1138
1139
  }
1139
- function en(e, t) {
1140
+ function sn(e, t) {
1140
1141
  const n = e.moves[t.move];
1141
1142
  if (!n?.travel) return 0;
1142
1143
  const s = n.travel / n.beats;
1143
- return t.mirror ? ($n(n, yt(e), Bn(e))[0]?.pose.turn ?? yt(e).turn ?? 0) >= 0.5 ? s : -s : s;
1144
+ return t.mirror ? (Dn(n, Mt(e), Xn(e))[0]?.pose.turn ?? Mt(e).turn ?? 0) >= 0.5 ? s : -s : s;
1144
1145
  }
1145
- function Fn(e, t) {
1146
+ function qn(e, t) {
1146
1147
  return t.move ? [{ move: t.move, beats: e.moves[t.move].beats, mirror: t.mirror }] : e.routine;
1147
1148
  }
1148
- function ot(e, t, n = {}) {
1149
- const s = typeof e == "string" ? Se[e] : e, o = Fn(s, n), r = o.reduce((c, u) => c + u.beats, 0), l = o.reduce((c, u) => c + en(s, u) * u.beats, 0), i = Math.floor(t / r);
1149
+ function lt(e, t, n = {}) {
1150
+ const s = typeof e == "string" ? ve[e] : e, o = qn(s, n), r = o.reduce((c, u) => c + u.beats, 0), l = o.reduce((c, u) => c + sn(s, u) * u.beats, 0), i = Math.floor(t / r);
1150
1151
  let a = i * l, h = t - i * r;
1151
1152
  for (const c of o) {
1152
1153
  const u = Math.min(c.beats, h);
1153
- if (a += en(s, c) * u, h -= u, h <= 0) break;
1154
+ if (a += sn(s, c) * u, h -= u, h <= 0) break;
1154
1155
  }
1155
1156
  return a;
1156
1157
  }
1157
- function Es(e, t, n) {
1158
- const s = Fn(e, n), o = [0];
1158
+ function Ks(e, t, n) {
1159
+ const s = qn(e, n), o = [0];
1159
1160
  let r = 0;
1160
1161
  for (let l = 0; r < t; l = (l + 1) % s.length)
1161
1162
  r += s[l].beats, o.push(Math.min(r, t));
1162
1163
  return o;
1163
1164
  }
1164
- const Ms = 8;
1165
- function Hs(e, t, n) {
1166
- const s = typeof t == "string" ? Se[t] : t, o = n.bpm ?? s.bpm, r = n.beats ?? (n.move ? s.moves[n.move].beats : Kt(s)), l = Es(s, r, n);
1167
- if (l.every((b) => ot(s, b, n) === 0)) return;
1168
- const i = Math.min(n.fade ?? 1, r / 2), a = Qe("ease-in-out"), h = (b) => i <= 0 ? 1 : Math.min(a(Math.min(1, b / i)), a(Math.min(1, (r - b) / i))), c = Math.ceil(i * Ms), u = i <= 0 ? [] : Array.from({ length: c + 1 }, (b, y) => [y / c * i, r - y / c * i]).flat(), g = [.../* @__PURE__ */ new Set([...l, ...u])].sort((b, y) => b - y);
1165
+ const Ws = 8;
1166
+ function Os(e, t, n) {
1167
+ const s = typeof t == "string" ? ve[t] : t, o = n.bpm ?? s.bpm, r = n.beats ?? (n.move ? s.moves[n.move].beats : It(s)), l = Ks(s, r, n);
1168
+ if (l.every((b) => lt(s, b, n) === 0)) return;
1169
+ const i = Math.min(n.fade ?? 1, r / 2), a = nt("ease-in-out"), h = (b) => i <= 0 ? 1 : Math.min(a(Math.min(1, b / i)), a(Math.min(1, (r - b) / i))), c = Math.ceil(i * Ws), u = i <= 0 ? [] : Array.from({ length: c + 1 }, (b, S) => [S / c * i, r - S / c * i]).flat(), d = [.../* @__PURE__ */ new Set([...l, ...u])].sort((b, S) => b - S);
1169
1170
  let f = 0;
1170
- const p = g.map((b, y) => {
1171
- if (y > 0) {
1172
- const E = g[y - 1], H = Math.max(1, Math.ceil((b - E) * 16));
1173
- for (let M = 0; M < H; M++) {
1174
- const A = E + (b - E) * M / H, w = E + (b - E) * (M + 1) / H;
1175
- f += (ot(s, w, n) - ot(s, A, n)) * h((A + w) / 2);
1171
+ const p = d.map((b, S) => {
1172
+ if (S > 0) {
1173
+ const k = d[S - 1], v = Math.max(1, Math.ceil((b - k) * 16));
1174
+ for (let H = 0; H < v; H++) {
1175
+ const T = k + (b - k) * H / v, M = k + (b - k) * (H + 1) / v;
1176
+ f += (lt(s, M, n) - lt(s, T, n)) * h((T + M) / 2);
1176
1177
  }
1177
1178
  }
1178
1179
  return { beat: b, travel: f };
1179
- }), d = n.start ?? 0, m = n.x ?? 0;
1180
+ }), g = n.start ?? 0, m = n.x ?? 0;
1180
1181
  return {
1181
1182
  id: `${e}-x`,
1182
1183
  target: e,
1183
1184
  property: "x",
1184
- keyframes: p.map((b) => ({ time: d + b.beat * 6e4 / o, value: m + n.height * b.travel, easing: "linear" }))
1185
+ keyframes: p.map((b) => ({ time: g + b.beat * 6e4 / o, value: m + n.height * b.travel, easing: "linear" }))
1185
1186
  };
1186
1187
  }
1187
- function ki(e, t, n = 0) {
1188
+ function _i(e, t, n = 0) {
1188
1189
  return (e - n) * t / 6e4;
1189
1190
  }
1190
- function Si(e, t = {}) {
1191
- return (n) => xt(e, n, t);
1191
+ function $i(e, t = {}) {
1192
+ return (n) => Ot(e, n, t);
1192
1193
  }
1193
- function Ei(e, t) {
1194
+ function Bi(e, t) {
1194
1195
  const n = t.start ?? 0, s = 6e4 / t.bpm, o = n + t.beats * s, r = Math.min((t.fade ?? 1) * s, (o - n) / 2);
1195
1196
  return [
1196
1197
  {
@@ -1215,26 +1216,26 @@ function Ei(e, t) {
1215
1216
  }
1216
1217
  ];
1217
1218
  }
1218
- function Mi(e, t, n = {}) {
1219
- const s = typeof t == "string" ? Se[t] : t, o = n.bpm ?? s.bpm, r = n.beats ?? (n.move ? s.moves[n.move].beats : Kt(s)), l = n.samplesPerBeat ?? 4, i = n.start ?? 0, a = Math.round(r * l), h = Array.from({ length: a + 1 }, (d, m) => {
1219
+ function Fi(e, t, n = {}) {
1220
+ const s = typeof t == "string" ? ve[t] : t, o = n.bpm ?? s.bpm, r = n.beats ?? (n.move ? s.moves[n.move].beats : It(s)), l = n.samplesPerBeat ?? 4, i = n.start ?? 0, a = Math.round(r * l), h = Array.from({ length: a + 1 }, (g, m) => {
1220
1221
  const b = m / l;
1221
- return { time: i + b * 6e4 / o, frame: xt(s, b, n) };
1222
- }), c = (d, m) => ({
1223
- id: `${e}-${d}`,
1222
+ return { time: i + b * 6e4 / o, frame: Ot(s, b, n) };
1223
+ }), c = (g, m) => ({
1224
+ id: `${e}-${g}`,
1224
1225
  target: e,
1225
- property: d,
1226
+ property: g,
1226
1227
  keyframes: h.map((b) => ({ time: b.time, value: m(b.frame) }))
1227
- }), g = Object.keys(_).filter((d) => h.some((m) => m.frame.pose[d] !== h[0].frame.pose[d]) || h[0].frame.pose[d] !== _[d]).map((d) => c(d, (m) => m.pose[d])), f = n.height === void 0 ? void 0 : Hs(e, s, { ...n, bpm: o, beats: r, start: i, height: n.height, fade: 0 });
1228
- if (f && g.push(f), n.hands === !1) return g;
1228
+ }), d = Object.keys(B).filter((g) => h.some((m) => m.frame.pose[g] !== h[0].frame.pose[g]) || h[0].frame.pose[g] !== B[g]).map((g) => c(g, (m) => m.pose[g])), f = n.height === void 0 ? void 0 : Os(e, s, { ...n, bpm: o, beats: r, start: i, height: n.height, fade: 0 });
1229
+ if (f && d.push(f), n.hands === !1) return d;
1229
1230
  const p = [];
1230
- for (const d of ["left", "right"])
1231
- for (const m of Object.keys(L)) {
1232
- const b = (y) => y.hands?.[d]?.[m] ?? L[m];
1233
- h.some((y) => b(y.frame) !== L[m]) && p.push(c(Ue(d, m), b));
1231
+ for (const g of ["left", "right"])
1232
+ for (const m of Object.keys(Y)) {
1233
+ const b = (S) => S.hands?.[g]?.[m] ?? Y[m];
1234
+ h.some((S) => b(S.frame) !== Y[m]) && p.push(c(je(g, m), b));
1234
1235
  }
1235
- return [...g, ...p];
1236
+ return [...d, ...p];
1236
1237
  }
1237
- const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic", vs = {
1238
+ const Oe = { type: "back", mode: "out", overshoot: 1.1 }, j = "ease-out-cubic", Is = {
1238
1239
  label: "Disco",
1239
1240
  bpm: 120,
1240
1241
  stance: { leftHip: 10, rightHip: 10, leftKnee: 6, rightKnee: 6 },
@@ -1244,7 +1245,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
1244
1245
  point: {
1245
1246
  label: "The point",
1246
1247
  beats: 2,
1247
- easing: V,
1248
+ easing: j,
1248
1249
  keys: [
1249
1250
  {
1250
1251
  beat: 0,
@@ -1269,9 +1270,9 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
1269
1270
  label: "Bump and clap",
1270
1271
  beats: 4,
1271
1272
  keys: [
1272
- { beat: 0, pose: { lean: -10, rightHip: 22, leftHip: 4, leftShoulder: 140, rightShoulder: 140, leftElbow: 0, rightElbow: 0, leftWrist: 20, rightWrist: 20 }, hands: { left: "spread", right: "spread" }, easing: V },
1273
+ { beat: 0, pose: { lean: -10, rightHip: 22, leftHip: 4, leftShoulder: 140, rightShoulder: 140, leftElbow: 0, rightElbow: 0, leftWrist: 20, rightWrist: 20 }, hands: { left: "spread", right: "spread" }, easing: j },
1273
1274
  { beat: 1, pose: { lean: 0, rightHip: 10, leftHip: 10, leftShoulder: 168, rightShoulder: 168, leftElbow: 22, rightElbow: 22, leftWrist: 0, rightWrist: 0 }, hands: { left: "flat", right: "flat" } },
1274
- { beat: 2, pose: { lean: 10, rightHip: 4, leftHip: 22, leftShoulder: 140, rightShoulder: 140, leftElbow: 0, rightElbow: 0, leftWrist: 20, rightWrist: 20 }, hands: { left: "spread", right: "spread" }, easing: V },
1275
+ { beat: 2, pose: { lean: 10, rightHip: 4, leftHip: 22, leftShoulder: 140, rightShoulder: 140, leftElbow: 0, rightElbow: 0, leftWrist: 20, rightWrist: 20 }, hands: { left: "spread", right: "spread" }, easing: j },
1275
1276
  { beat: 3, pose: { lean: 0, rightHip: 10, leftHip: 10, leftShoulder: 168, rightShoulder: 168, leftElbow: 22, rightElbow: 22, leftWrist: 0, rightWrist: 0 }, hands: { left: "flat", right: "flat" } }
1276
1277
  ]
1277
1278
  }
@@ -1282,7 +1283,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
1282
1283
  { move: "point", beats: 8, mirror: !0 },
1283
1284
  { move: "bump", beats: 8 }
1284
1285
  ]
1285
- }, Ts = {
1286
+ }, _s = {
1286
1287
  label: "Hip hop",
1287
1288
  bpm: 95,
1288
1289
  stance: { leftHip: 14, rightHip: 14, leftKnee: 20, rightKnee: 20, leftShoulder: 22, rightShoulder: 22, leftElbow: -30, rightElbow: -30, leftFootOut: 0.15, rightFootOut: 0.15 },
@@ -1334,7 +1335,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
1334
1335
  { move: "armWave", beats: 8 },
1335
1336
  { move: "bounce", beats: 4 }
1336
1337
  ]
1337
- }, As = {
1338
+ }, $s = {
1338
1339
  label: "Breaking (toprock)",
1339
1340
  bpm: 110,
1340
1341
  stance: { leftHip: 14, rightHip: 14, leftKnee: 14, rightKnee: 14, leftShoulder: 35, rightShoulder: 35, leftElbow: -90, rightElbow: -90 },
@@ -1346,9 +1347,9 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
1346
1347
  label: "Toprock (Indian step)",
1347
1348
  beats: 4,
1348
1349
  keys: [
1349
- { beat: 0, pose: { rightHip: -24, rightKnee: 10, leftHip: 10, leftShoulder: 80, leftElbow: 40, rightShoulder: 55, rightElbow: -50, lean: 6, headTilt: -6 }, easing: V },
1350
+ { beat: 0, pose: { rightHip: -24, rightKnee: 10, leftHip: 10, leftShoulder: 80, leftElbow: 40, rightShoulder: 55, rightElbow: -50, lean: 6, headTilt: -6 }, easing: j },
1350
1351
  { beat: 1, reset: !0, pose: { leftHip: 18, rightHip: 18 } },
1351
- { beat: 2, pose: { leftHip: -24, leftKnee: 10, rightHip: 10, rightShoulder: 80, rightElbow: 40, leftShoulder: 55, leftElbow: -50, lean: -6, headTilt: 6 }, easing: V },
1352
+ { beat: 2, pose: { leftHip: -24, leftKnee: 10, rightHip: 10, rightShoulder: 80, rightElbow: 40, leftShoulder: 55, leftElbow: -50, lean: -6, headTilt: 6 }, easing: j },
1352
1353
  { beat: 3, reset: !0, pose: { leftHip: 18, rightHip: 18 } }
1353
1354
  ]
1354
1355
  },
@@ -1356,7 +1357,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
1356
1357
  label: "Kick out",
1357
1358
  beats: 2,
1358
1359
  keys: [
1359
- { beat: 0, pose: { rightHip: 72, rightKnee: 4, rightAnkle: -20, leftHip: 4, lean: -12, leftShoulder: 100, leftElbow: 20 }, easing: V },
1360
+ { beat: 0, pose: { rightHip: 72, rightKnee: 4, rightAnkle: -20, leftHip: 4, lean: -12, leftShoulder: 100, leftElbow: 20 }, easing: j },
1360
1361
  { beat: 1, reset: !0 }
1361
1362
  ]
1362
1363
  },
@@ -1364,7 +1365,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
1364
1365
  label: "B-boy stance",
1365
1366
  beats: 4,
1366
1367
  keys: [
1367
- { beat: 0, reset: !0, pose: { leftShoulder: 26, leftElbow: -122, rightShoulder: 22, rightElbow: -118, leftHip: 18, rightHip: 18, leftKnee: 6, rightKnee: 6, lean: -4, headTilt: 10, smile: 0.6, leftEye: 0.6, rightEye: 0.6 }, easing: xe },
1368
+ { beat: 0, reset: !0, pose: { leftShoulder: 26, leftElbow: -122, rightShoulder: 22, rightElbow: -118, leftHip: 18, rightHip: 18, leftKnee: 6, rightKnee: 6, lean: -4, headTilt: 10, smile: 0.6, leftEye: 0.6, rightEye: 0.6 }, easing: Oe },
1368
1369
  { beat: 2, pose: { headTilt: 14, lean: -6 } }
1369
1370
  ]
1370
1371
  }
@@ -1376,7 +1377,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
1376
1377
  { move: "kick", beats: 4, mirror: !0 },
1377
1378
  { move: "freeze", beats: 4 }
1378
1379
  ]
1379
- }, xs = {
1380
+ }, Bs = {
1380
1381
  label: "Jazz",
1381
1382
  bpm: 130,
1382
1383
  stance: { leftHip: 10, rightHip: 10 },
@@ -1392,14 +1393,14 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
1392
1393
  beat: e,
1393
1394
  // The hands shimmer: the wrists flick a little each quarter beat.
1394
1395
  pose: { leftShoulder: 128, rightShoulder: 128, leftElbow: 8, rightElbow: 8, leftWrist: t % 2 ? 4 : 26, rightWrist: t % 2 ? 26 : 4, leftHip: 16, rightHip: 16, leftKnee: e < 1 ? 26 : 8, rightKnee: e < 1 ? 26 : 8 },
1395
- hands: t === 0 ? { left: { ...C.spread, turn: 2 }, right: { ...C.spread, turn: 2 } } : void 0
1396
+ hands: t === 0 ? { left: { ...q.spread, turn: 2 }, right: { ...q.spread, turn: 2 } } : void 0
1396
1397
  }))
1397
1398
  },
1398
1399
  kickBallChange: {
1399
1400
  label: "Kick ball change",
1400
1401
  beats: 2,
1401
1402
  keys: [
1402
- { beat: 0, reset: !0, pose: { rightHip: 88, rightKnee: 0, rightAnkle: 55, leftHip: 4, lean: -12, leftShoulder: 112, rightShoulder: 112, leftWrist: 15, rightWrist: 15 }, hands: { left: "flat", right: "flat" }, easing: V },
1403
+ { beat: 0, reset: !0, pose: { rightHip: 88, rightKnee: 0, rightAnkle: 55, leftHip: 4, lean: -12, leftShoulder: 112, rightShoulder: 112, leftWrist: 15, rightWrist: 15 }, hands: { left: "flat", right: "flat" }, easing: j },
1403
1404
  { beat: 1, reset: !0, pose: { rightHip: 10, rightKnee: 24, rightAnkle: 45, leftShoulder: 60, rightShoulder: 60, leftElbow: -20, rightElbow: -20 } },
1404
1405
  { beat: 1.5, pose: { rightAnkle: 0, rightKnee: 6, leftAnkle: 45, leftKnee: 20 } }
1405
1406
  ]
@@ -1437,7 +1438,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
1437
1438
  { move: "jazzHands", beats: 4 },
1438
1439
  { move: "splitDrop", beats: 8 }
1439
1440
  ]
1440
- }, Ks = {
1441
+ }, Fs = {
1441
1442
  label: "K-pop",
1442
1443
  bpm: 125,
1443
1444
  stance: { leftHip: 9, rightHip: 9, leftKnee: 4, rightKnee: 4 },
@@ -1447,7 +1448,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
1447
1448
  pointCombo: {
1448
1449
  label: "Point combo",
1449
1450
  beats: 4,
1450
- easing: xe,
1451
+ easing: Oe,
1451
1452
  keys: [
1452
1453
  { beat: 0, reset: !0, pose: { rightShoulder: 142, rightElbow: 0, leftShoulder: 25, leftElbow: -125, headTilt: 6, lean: -3, lookX: 0.6, lookY: -0.6 }, hands: { right: "point", left: "flat" } },
1453
1454
  { beat: 1, pose: { rightShoulder: -38, headTilt: -6, lean: 3, lookX: -0.3, lookY: 0.5, rightHip: 18 } },
@@ -1459,16 +1460,16 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
1459
1460
  label: "Big heart, finger heart",
1460
1461
  beats: 4,
1461
1462
  keys: [
1462
- { beat: 0, reset: !0, pose: { leftShoulder: 165, rightShoulder: 165, leftElbow: 46, rightElbow: 46, headTilt: -8, lean: -4 }, hands: { left: "cupped", right: "cupped" }, easing: xe },
1463
+ { beat: 0, reset: !0, pose: { leftShoulder: 165, rightShoulder: 165, leftElbow: 46, rightElbow: 46, headTilt: -8, lean: -4 }, hands: { left: "cupped", right: "cupped" }, easing: Oe },
1463
1464
  { beat: 1, pose: { headTilt: 8, lean: 4 } },
1464
- { beat: 2, reset: !0, pose: { rightShoulder: 32, rightElbow: 112, rightWrist: 10, leftShoulder: 20, leftElbow: -30, headTilt: 10, leftEye: 0, smile: 1 }, hands: { right: "pinch", left: "relaxed" }, easing: xe },
1465
+ { beat: 2, reset: !0, pose: { rightShoulder: 32, rightElbow: 112, rightWrist: 10, leftShoulder: 20, leftElbow: -30, headTilt: 10, leftEye: 0, smile: 1 }, hands: { right: "pinch", left: "relaxed" }, easing: Oe },
1465
1466
  { beat: 3, pose: { headTilt: 4 } }
1466
1467
  ]
1467
1468
  },
1468
1469
  isolations: {
1469
1470
  label: "Isolations",
1470
1471
  beats: 2,
1471
- easing: V,
1472
+ easing: j,
1472
1473
  keys: [
1473
1474
  { beat: 0, reset: !0, pose: { lean: -9, headTilt: 11, leftShoulder: 55, leftElbow: -112, rightShoulder: 55, rightElbow: -112, rightHip: 18 }, hands: { left: "fist", right: "fist" } },
1474
1475
  { beat: 0.5, pose: { lean: 0, headTilt: 0, rightHip: 9 } },
@@ -1484,7 +1485,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
1484
1485
  { move: "pointCombo", beats: 8, mirror: !0 },
1485
1486
  { move: "isolations", beats: 4 }
1486
1487
  ]
1487
- }, Ps = {
1488
+ }, Rs = {
1488
1489
  label: "Bollywood",
1489
1490
  bpm: 120,
1490
1491
  stance: { leftHip: 10, rightHip: 10 },
@@ -1495,19 +1496,19 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
1495
1496
  label: "Screw the bulb, pat the dog",
1496
1497
  beats: 2,
1497
1498
  keys: [
1498
- { beat: 0, reset: !0, pose: { rightShoulder: 160, rightElbow: 12, rightWrist: -15, leftShoulder: 40, leftElbow: -12, leftWrist: -45, lean: -4, rightHip: 16, lookX: 0.5, lookY: -0.6 }, hands: { right: { ...C.cupped, roll: -30 }, left: { ...C.flat, turn: 0 } } },
1499
- { beat: 0.5, pose: { rightWrist: 25, rightElbow: 22, leftWrist: 10, lean: 4, rightHip: 6, leftHip: 16 }, hands: { right: { ...C.cupped, roll: 30 } } },
1500
- { beat: 1, pose: { rightWrist: -15, rightElbow: 12, leftWrist: -45, lean: -4, rightHip: 16, leftHip: 6 }, hands: { right: { ...C.cupped, roll: -30 } } },
1501
- { beat: 1.5, pose: { rightWrist: 25, rightElbow: 22, leftWrist: 10, lean: 4, rightHip: 6, leftHip: 16 }, hands: { right: { ...C.cupped, roll: 30 } } }
1499
+ { beat: 0, reset: !0, pose: { rightShoulder: 160, rightElbow: 12, rightWrist: -15, leftShoulder: 40, leftElbow: -12, leftWrist: -45, lean: -4, rightHip: 16, lookX: 0.5, lookY: -0.6 }, hands: { right: { ...q.cupped, roll: -30 }, left: { ...q.flat, turn: 0 } } },
1500
+ { beat: 0.5, pose: { rightWrist: 25, rightElbow: 22, leftWrist: 10, lean: 4, rightHip: 6, leftHip: 16 }, hands: { right: { ...q.cupped, roll: 30 } } },
1501
+ { beat: 1, pose: { rightWrist: -15, rightElbow: 12, leftWrist: -45, lean: -4, rightHip: 16, leftHip: 6 }, hands: { right: { ...q.cupped, roll: -30 } } },
1502
+ { beat: 1.5, pose: { rightWrist: 25, rightElbow: 22, leftWrist: 10, lean: 4, rightHip: 6, leftHip: 16 }, hands: { right: { ...q.cupped, roll: 30 } } }
1502
1503
  ]
1503
1504
  },
1504
1505
  thumka: {
1505
1506
  label: "Thumka",
1506
1507
  beats: 2,
1507
1508
  keys: [
1508
- { beat: 0, reset: !0, pose: { lean: -11, rightHip: 22, leftHip: 2, leftKnee: 14, rightShoulder: 45, rightElbow: -105, leftShoulder: 128, leftElbow: 18, leftWrist: 35, headTilt: 10, lookX: -0.5 }, hands: { right: "fist", left: { ...C.open, turn: 2 } }, easing: V },
1509
+ { beat: 0, reset: !0, pose: { lean: -11, rightHip: 22, leftHip: 2, leftKnee: 14, rightShoulder: 45, rightElbow: -105, leftShoulder: 128, leftElbow: 18, leftWrist: 35, headTilt: 10, lookX: -0.5 }, hands: { right: "fist", left: { ...q.open, turn: 2 } }, easing: j },
1509
1510
  { beat: 0.5, pose: { lean: -4, rightHip: 12, headTilt: 6 } },
1510
- { beat: 1, pose: { lean: -11, rightHip: 22, headTilt: 10 }, easing: V },
1511
+ { beat: 1, pose: { lean: -11, rightHip: 22, headTilt: 10 }, easing: j },
1511
1512
  { beat: 1.5, pose: { lean: -4, rightHip: 12, headTilt: 6 } }
1512
1513
  ]
1513
1514
  },
@@ -1516,9 +1517,9 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
1516
1517
  beats: 4,
1517
1518
  keys: [
1518
1519
  { beat: 0, reset: !0, pose: { leftShoulder: 22, rightShoulder: 22, leftElbow: -62, rightElbow: -62, leftHip: 16, rightHip: 16, leftKnee: 26, rightKnee: 26 }, hands: { left: "fist", right: "fist" } },
1519
- { beat: 1, pose: { leftShoulder: 132, rightShoulder: 132, leftElbow: 0, rightElbow: 0, leftWrist: 30, rightWrist: 30, leftKnee: 0, rightKnee: 0, leftHip: 10, rightHip: 10, stretch: 1.03 }, hands: { left: "spread", right: "spread" }, easing: V },
1520
+ { beat: 1, pose: { leftShoulder: 132, rightShoulder: 132, leftElbow: 0, rightElbow: 0, leftWrist: 30, rightWrist: 30, leftKnee: 0, rightKnee: 0, leftHip: 10, rightHip: 10, stretch: 1.03 }, hands: { left: "spread", right: "spread" }, easing: j },
1520
1521
  { beat: 2, pose: { leftShoulder: 22, rightShoulder: 22, leftElbow: -62, rightElbow: -62, leftWrist: 0, rightWrist: 0, leftHip: 16, rightHip: 16, leftKnee: 26, rightKnee: 26, stretch: 1 }, hands: { left: "fist", right: "fist" } },
1521
- { beat: 3, pose: { leftShoulder: 62, rightShoulder: 62, leftElbow: 0, rightElbow: 0, leftWrist: 35, rightWrist: 35, leftKnee: 0, rightKnee: 0, leftHip: 10, rightHip: 10 }, hands: { left: "spread", right: "spread" }, easing: V }
1522
+ { beat: 3, pose: { leftShoulder: 62, rightShoulder: 62, leftElbow: 0, rightElbow: 0, leftWrist: 35, rightWrist: 35, leftKnee: 0, rightKnee: 0, leftHip: 10, rightHip: 10 }, hands: { left: "spread", right: "spread" }, easing: j }
1522
1523
  ]
1523
1524
  }
1524
1525
  },
@@ -1529,7 +1530,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
1529
1530
  { move: "thumka", beats: 4, mirror: !0 },
1530
1531
  { move: "lightBulb", beats: 8, mirror: !0 }
1531
1532
  ]
1532
- }, Ws = {
1533
+ }, Ns = {
1533
1534
  label: "Bhangra",
1534
1535
  bpm: 100,
1535
1536
  stance: { leftShoulder: 150, rightShoulder: 150, leftElbow: 18, rightElbow: 18, leftHip: 10, rightHip: 10 },
@@ -1564,11 +1565,11 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
1564
1565
  { move: "basic", beats: 8 },
1565
1566
  { move: "dhamaal", beats: 4 }
1566
1567
  ]
1567
- }, Os = { leftHip: 42, rightHip: 42, leftKnee: 82, rightKnee: 82, leftFootOut: 0.3, rightFootOut: 0.3 }, Is = {
1568
+ }, Ls = { leftHip: 42, rightHip: 42, leftKnee: 82, rightKnee: 82, leftFootOut: 0.3, rightFootOut: 0.3 }, Ys = {
1568
1569
  label: "Bharatanatyam",
1569
1570
  bpm: 80,
1570
1571
  // Natyarambhe: arms out at shoulder height, hands raised in pataka.
1571
- stance: { ...Os, leftShoulder: 90, rightShoulder: 90, leftElbow: 0, rightElbow: 0, leftWrist: 75, rightWrist: 75 },
1572
+ stance: { ...Ls, leftShoulder: 90, rightShoulder: 90, leftElbow: 0, rightElbow: 0, leftWrist: 75, rightWrist: 75 },
1572
1573
  expression: { smile: 0.5, leftEye: 1.2, rightEye: 1.2, leftBrow: 0.3, rightBrow: 0.3 },
1573
1574
  hands: { left: "pataka", right: "pataka" },
1574
1575
  groove: { bounce: 0 },
@@ -1610,21 +1611,21 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
1610
1611
  { move: "alapadma", beats: 8 },
1611
1612
  { move: "tatta", beats: 4 }
1612
1613
  ]
1613
- }, _s = {
1614
+ }, Cs = {
1614
1615
  label: "Charleston",
1615
1616
  bpm: 150,
1616
1617
  stance: { leftHip: 10, rightHip: 10, leftKnee: 10, rightKnee: 10, leftShoulder: 30, rightShoulder: 30, leftElbow: 20, rightElbow: 20 },
1617
1618
  expression: { mouth: 0.4, smile: 1, leftBrow: 0.5, rightBrow: 0.5 },
1618
- hands: { left: { ...C.spread, turn: 2 }, right: { ...C.spread, turn: 2 } },
1619
+ hands: { left: { ...q.spread, turn: 2 }, right: { ...q.spread, turn: 2 } },
1619
1620
  groove: { bounce: 8, accent: "down" },
1620
1621
  moves: {
1621
1622
  basic: {
1622
1623
  label: "Kick forward, kick back",
1623
1624
  beats: 4,
1624
1625
  keys: [
1625
- { beat: 0, reset: !0, pose: { rightHip: 48, rightKnee: 8, rightAnkle: 45, leftShoulder: 75, rightShoulder: 15, leftElbow: 30, rightElbow: -10, lean: -7, headTilt: -5 }, easing: V },
1626
+ { beat: 0, reset: !0, pose: { rightHip: 48, rightKnee: 8, rightAnkle: 45, leftShoulder: 75, rightShoulder: 15, leftElbow: 30, rightElbow: -10, lean: -7, headTilt: -5 }, easing: j },
1626
1627
  { beat: 1, reset: !0 },
1627
- { beat: 2, reset: !0, pose: { leftHip: 18, leftKnee: 85, leftAnkle: 35, rightShoulder: 75, leftShoulder: 15, rightElbow: 30, leftElbow: -10, lean: 7, headTilt: 5 }, easing: V },
1628
+ { beat: 2, reset: !0, pose: { leftHip: 18, leftKnee: 85, leftAnkle: 35, rightShoulder: 75, leftShoulder: 15, rightElbow: 30, leftElbow: -10, lean: 7, headTilt: 5 }, easing: j },
1628
1629
  { beat: 3, reset: !0 }
1629
1630
  ]
1630
1631
  },
@@ -1660,7 +1661,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
1660
1661
  { move: "basic", beats: 8, mirror: !0 },
1661
1662
  { move: "twist", beats: 4 }
1662
1663
  ]
1663
- }, $s = {
1664
+ }, Ds = {
1664
1665
  label: "Tap",
1665
1666
  bpm: 120,
1666
1667
  // Three-quarters to side-on, so shuffles read as brushes forward and back. Side-on,
@@ -1746,7 +1747,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
1746
1747
  { beat: 0.75, pose: { rightAnkle: 0, rise: 0 }, taps: ["rightHeel"] },
1747
1748
  { beat: 0.875, pose: { leftAnkle: 0 }, taps: ["leftHeel"] },
1748
1749
  // Arms flare on the finish: one up in front, one up behind.
1749
- { beat: 1, pose: { rightShoulder: 135, leftShoulder: 125, leftElbow: 0, rightElbow: 0, leftWrist: 0, rightWrist: 30, rightKnee: 8, leftKnee: -8, rightHip: 4, leftHip: -4 }, hands: { left: { ...C.spread, turn: 2 }, right: { ...C.spread, turn: 2 } } },
1750
+ { beat: 1, pose: { rightShoulder: 135, leftShoulder: 125, leftElbow: 0, rightElbow: 0, leftWrist: 0, rightWrist: 30, rightKnee: 8, leftKnee: -8, rightHip: 4, leftHip: -4 }, hands: { left: { ...q.spread, turn: 2 }, right: { ...q.spread, turn: 2 } } },
1750
1751
  { beat: 1.75, reset: !0 }
1751
1752
  ]
1752
1753
  }
@@ -1758,7 +1759,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
1758
1759
  { move: "heelToe", beats: 8 },
1759
1760
  { move: "crampRoll", beats: 4 }
1760
1761
  ]
1761
- }, Bs = {
1762
+ }, Xs = {
1762
1763
  label: "Popping (glides, moonwalk)",
1763
1764
  bpm: 100,
1764
1765
  stance: { leftHip: 9, rightHip: 9, leftShoulder: 16, rightShoulder: 16, leftElbow: -24, rightElbow: -24 },
@@ -1818,7 +1819,7 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
1818
1819
  reset: !0,
1819
1820
  pose: { leftHip: 6, rightHip: 6, leftKnee: 0, rightKnee: 0, leftAnkle: 65, rightAnkle: 65, rightShoulder: 150, rightElbow: 75, leftShoulder: 30, leftElbow: 20, headTilt: -10, lookY: 0.4 },
1820
1821
  hands: { right: "fist", left: "fist" },
1821
- easing: xe
1822
+ easing: Oe
1822
1823
  },
1823
1824
  { beat: 2, pose: { headTilt: -14, lean: -2 } }
1824
1825
  ]
@@ -1831,55 +1832,55 @@ const xe = { type: "back", mode: "out", overshoot: 1.1 }, V = "ease-out-cubic",
1831
1832
  { move: "forwardGlide", beats: 8 },
1832
1833
  { move: "toeStand", beats: 4 }
1833
1834
  ]
1834
- }, Se = {
1835
- disco: vs,
1836
- hipHop: Ts,
1837
- breaking: As,
1838
- jazz: xs,
1839
- kpop: Ks,
1840
- bollywood: Ps,
1841
- bhangra: Ws,
1842
- bharatanatyam: Is,
1843
- charleston: _s,
1844
- tap: $s,
1845
- popping: Bs
1846
- }, Ve = (e) => Math.min(1, Math.max(0, e));
1847
- function Fs(e) {
1848
- const t = { ..._, turn: e.view }, n = [];
1835
+ }, ve = {
1836
+ disco: Is,
1837
+ hipHop: _s,
1838
+ breaking: $s,
1839
+ jazz: Bs,
1840
+ kpop: Fs,
1841
+ bollywood: Rs,
1842
+ bhangra: Ns,
1843
+ bharatanatyam: Ys,
1844
+ charleston: Cs,
1845
+ tap: Ds,
1846
+ popping: Xs
1847
+ }, Ze = (e) => Math.min(1, Math.max(0, e));
1848
+ function qs(e) {
1849
+ const t = { ...B, turn: e.view }, n = [];
1849
1850
  for (const s of e.keys) {
1850
1851
  const o = n[n.length - 1], r = !o || s.reset ? t : o.pose;
1851
1852
  n.push({ at: s.at, pose: { ...r, ...s.pose }, easing: s.easing });
1852
1853
  }
1853
1854
  return n;
1854
1855
  }
1855
- function Rs(e) {
1856
- return e - Ls * Math.sin(2 * Math.PI * e) / (2 * Math.PI);
1856
+ function Gs(e) {
1857
+ return e - Us * Math.sin(2 * Math.PI * e) / (2 * Math.PI);
1857
1858
  }
1858
- const Ls = 0.5;
1859
- function Ns(e, t) {
1859
+ const Us = 0.5;
1860
+ function zs(e, t) {
1860
1861
  if (!(t <= e.takeoff || t >= e.landing))
1861
1862
  return (t - e.takeoff) / (e.landing - e.takeoff);
1862
1863
  }
1863
- function Ys(e, t) {
1864
- const n = typeof e == "string" ? Pt[e] : e, s = Fs(n), o = Ve(t);
1864
+ function Vs(e, t) {
1865
+ const n = typeof e == "string" ? _t[e] : e, s = qs(n), o = Ze(t);
1865
1866
  let r = 0;
1866
1867
  for (let u = 0; u < s.length; u++) s[u].at <= o && (r = u);
1867
- const l = s[r], i = s[Math.min(r + 1, s.length - 1)], a = i.at > l.at ? (o - l.at) / (i.at - l.at) : 0, h = Pe(l.pose, i.pose, Qe(i.easing ?? "ease-in-out")(Ve(a))), c = Ns(n, o);
1868
+ const l = s[r], i = s[Math.min(r + 1, s.length - 1)], a = i.at > l.at ? (o - l.at) / (i.at - l.at) : 0, h = _e(l.pose, i.pose, nt(i.easing ?? "ease-in-out")(Ze(a))), c = zs(n, o);
1868
1869
  return c === void 0 ? { ...h, spin: 0, rise: 0 } : {
1869
1870
  ...h,
1870
- spin: n.spin * Rs(c),
1871
+ spin: n.spin * Gs(c),
1871
1872
  rise: 4 * n.height * c * (1 - c)
1872
1873
  };
1873
1874
  }
1874
- function Cs(e, t, n) {
1875
- const s = typeof e == "string" ? Pt[e] : e, o = Ve(t), r = Ve((o - s.takeoff) / (s.landing - s.takeoff));
1875
+ function js(e, t, n) {
1876
+ const s = typeof e == "string" ? _t[e] : e, o = Ze(t), r = Ze((o - s.takeoff) / (s.landing - s.takeoff));
1876
1877
  return s.travel * n * r;
1877
1878
  }
1878
- function Hi(e, t, n = {}) {
1879
- const s = typeof t == "string" ? Pt[t] : t, o = n.start ?? 0, r = n.duration ?? s.duration, l = n.samples ?? 48, i = Array.from({ length: l + 1 }, (c, u) => {
1880
- const g = u / l;
1881
- return { time: o + g * r, progress: g, pose: Ys(s, g) };
1882
- }), h = Object.keys(_).filter((c) => i.some((u) => u.pose[c] !== _[c])).map((c) => ({
1879
+ function Ri(e, t, n = {}) {
1880
+ const s = typeof t == "string" ? _t[t] : t, o = n.start ?? 0, r = n.duration ?? s.duration, l = n.samples ?? 48, i = Array.from({ length: l + 1 }, (c, u) => {
1881
+ const d = u / l;
1882
+ return { time: o + d * r, progress: d, pose: Vs(s, d) };
1883
+ }), h = Object.keys(B).filter((c) => i.some((u) => u.pose[c] !== B[c])).map((c) => ({
1883
1884
  id: `${e}-${c}`,
1884
1885
  target: e,
1885
1886
  property: c,
@@ -1891,12 +1892,12 @@ function Hi(e, t, n = {}) {
1891
1892
  id: `${e}-x`,
1892
1893
  target: e,
1893
1894
  property: "x",
1894
- keyframes: i.map((u) => ({ time: u.time, value: (n.x ?? 0) + c * Cs(s, u.progress, n.height) }))
1895
+ keyframes: i.map((u) => ({ time: u.time, value: (n.x ?? 0) + c * js(s, u.progress, n.height) }))
1895
1896
  });
1896
1897
  }
1897
1898
  return h;
1898
1899
  }
1899
- const Ds = {
1900
+ const Js = {
1900
1901
  leftHip: -55,
1901
1902
  leftKnee: -95,
1902
1903
  rightHip: 55,
@@ -1908,7 +1909,7 @@ const Ds = {
1908
1909
  lean: 22,
1909
1910
  stretch: 0.94,
1910
1911
  headTilt: 6
1911
- }, Xs = {
1912
+ }, Zs = {
1912
1913
  leftHip: 0,
1913
1914
  leftKnee: 0,
1914
1915
  rightHip: 0,
@@ -1922,7 +1923,7 @@ const Ds = {
1922
1923
  lean: 0,
1923
1924
  stretch: 1.08,
1924
1925
  headTilt: 0
1925
- }, _e = {
1926
+ }, Re = {
1926
1927
  leftHip: -128,
1927
1928
  leftKnee: -152,
1928
1929
  rightHip: 128,
@@ -1936,7 +1937,7 @@ const Ds = {
1936
1937
  lean: 26,
1937
1938
  stretch: 1,
1938
1939
  headTilt: 14
1939
- }, qs = {
1940
+ }, Qs = {
1940
1941
  leftHip: -22,
1941
1942
  leftKnee: -30,
1942
1943
  rightHip: 22,
@@ -1949,7 +1950,7 @@ const Ds = {
1949
1950
  rightElbow: 0,
1950
1951
  lean: 8,
1951
1952
  headTilt: 0
1952
- }, Gs = {
1953
+ }, er = {
1953
1954
  leftHip: -58,
1954
1955
  leftKnee: -100,
1955
1956
  rightHip: 58,
@@ -1963,7 +1964,7 @@ const Ds = {
1963
1964
  lean: 20,
1964
1965
  stretch: 0.93
1965
1966
  };
1966
- function pe(e, t, n, s, o, r = 1300) {
1967
+ function be(e, t, n, s, o, r = 1300) {
1967
1968
  return {
1968
1969
  label: e,
1969
1970
  view: 1,
@@ -1975,30 +1976,30 @@ function pe(e, t, n, s, o, r = 1300) {
1975
1976
  duration: r,
1976
1977
  keys: [
1977
1978
  { at: 0, reset: !0 },
1978
- { at: 0.16, pose: Ds },
1979
- { at: 0.27, pose: Xs, easing: "ease-out-quad" },
1979
+ { at: 0.16, pose: Js },
1980
+ { at: 0.27, pose: Zs, easing: "ease-out-quad" },
1980
1981
  ...o,
1981
- { at: 0.76, pose: qs },
1982
- { at: 0.86, pose: Gs, easing: "ease-out-quad" },
1982
+ { at: 0.76, pose: Qs },
1983
+ { at: 0.86, pose: er, easing: "ease-out-quad" },
1983
1984
  { at: 1, reset: !0 }
1984
1985
  ]
1985
1986
  };
1986
1987
  }
1987
- const Pt = {
1988
- frontFlip: pe("Front flip (tuck)", 360, 0.56, 0.35, [
1989
- { at: 0.38, pose: _e, easing: "ease-out-cubic" },
1990
- { at: 0.64, pose: _e }
1988
+ const _t = {
1989
+ frontFlip: be("Front flip (tuck)", 360, 0.56, 0.35, [
1990
+ { at: 0.38, pose: Re, easing: "ease-out-cubic" },
1991
+ { at: 0.64, pose: Re }
1991
1992
  ]),
1992
- backFlip: pe("Back flip (tuck)", -360, 0.58, -0.15, [
1993
- { at: 0.36, pose: { ..._e, lean: 18 }, easing: "ease-out-cubic" },
1994
- { at: 0.64, pose: { ..._e, lean: 18 } }
1993
+ backFlip: be("Back flip (tuck)", -360, 0.58, -0.15, [
1994
+ { at: 0.36, pose: { ...Re, lean: 18 }, easing: "ease-out-cubic" },
1995
+ { at: 0.64, pose: { ...Re, lean: 18 } }
1995
1996
  ]),
1996
- layout: pe("Back layout (straight body)", -360, 0.66, -0.2, [
1997
+ layout: be("Back layout (straight body)", -360, 0.66, -0.2, [
1997
1998
  // Arched, arms overhead, legs together and long.
1998
1999
  { at: 0.4, pose: { leftHip: 8, rightHip: -8, leftKnee: 0, rightKnee: 0, leftAnkle: 60, rightAnkle: 60, leftShoulder: -178, rightShoulder: 178, lean: -18, headTilt: -14 } },
1999
2000
  { at: 0.64, pose: { leftHip: -4, rightHip: 4, lean: -6, headTilt: -4, leftShoulder: -150, rightShoulder: 150 } }
2000
2001
  ], 1400),
2001
- scissorFlip: pe("Scissor flip", 360, 0.6, 0.45, [
2002
+ scissorFlip: be("Scissor flip", 360, 0.6, 0.45, [
2002
2003
  // The legs scissor through the turn: left kicks high, then they switch.
2003
2004
  { at: 0.36, pose: { leftHip: -105, leftKnee: 0, rightHip: -40, rightKnee: -20, leftAnkle: 50, rightAnkle: 50, leftShoulder: -150, rightShoulder: 150, leftElbow: 0, rightElbow: 0, lean: 12 }, easing: "ease-out-cubic" },
2004
2005
  { at: 0.52, pose: { leftHip: 40, leftKnee: 20, rightHip: 105, rightKnee: 0, leftShoulder: -140, rightShoulder: 140 } },
@@ -2044,7 +2045,7 @@ const Pt = {
2044
2045
  ]
2045
2046
  },
2046
2047
  // Leaps: no turn, the shape is the trick.
2047
- splitLeap: pe("Split leap (grand jeté)", 0, 0.36, 0.9, [
2048
+ splitLeap: be("Split leap (grand jeté)", 0, 0.36, 0.9, [
2048
2049
  // A front split in the air: front leg reaching, back leg long, arms open.
2049
2050
  { at: 0.4, pose: { leftHip: -96, rightHip: -84, leftKnee: 0, rightKnee: 0, leftAnkle: 55, rightAnkle: 55, leftShoulder: -130, rightShoulder: -105, leftElbow: 0, rightElbow: 0, lean: 4, headTilt: -6 }, easing: "ease-out-cubic" },
2050
2051
  { at: 0.64, pose: { lean: 2 } }
@@ -2070,14 +2071,15 @@ const Pt = {
2070
2071
  { at: 1, reset: !0 }
2071
2072
  ]
2072
2073
  },
2073
- backHandspring: pe("Back handspring", -360, 0.16, -0.7, [
2074
+ backHandspring: be("Back handspring", -360, 0.16, -0.7, [
2074
2075
  // Arms reach back overhead to the ground, legs snap over.
2075
2076
  { at: 0.38, pose: { leftHip: 10, rightHip: -10, leftKnee: 0, rightKnee: 0, leftShoulder: -178, rightShoulder: 178, lean: -26, headTilt: -20 } },
2076
2077
  { at: 0.6, pose: { leftHip: -40, rightHip: 40, leftKnee: -20, rightKnee: 20, lean: 6, headTilt: 0 } }
2077
2078
  ], 1200)
2078
- }, st = 0.215, rt = 0.205, Us = 0.065, tn = 0.035, zs = 0.165, Vs = 0.155, js = 12, Js = (e) => e * Math.PI / 180, X = {
2079
+ }, at = 0.215, ht = 0.205, tr = 0.065, rn = 0.035, nr = 0.165, or = 0.155, sr = 12, rr = 0.3, ir = 0.7, lr = 0.35, ar = (e) => e * Math.PI / 180, C = {
2079
2080
  turn: 0,
2080
2081
  lean: 0,
2082
+ bend: 0,
2081
2083
  side: 0,
2082
2084
  "head.turn": 0,
2083
2085
  "head.nod": 0,
@@ -2117,33 +2119,33 @@ const Pt = {
2117
2119
  lookX: 0,
2118
2120
  lookY: 0
2119
2121
  };
2120
- function ee(e = {}) {
2121
- return { ...X, ...e };
2122
+ function te(e = {}) {
2123
+ return { ...C, ...e };
2122
2124
  }
2123
- const Zs = /* @__PURE__ */ new Set(["turn", "side", "head.turn", "head.tilt", "roll", "lookX"]);
2124
- function vi(e) {
2125
+ const hr = /* @__PURE__ */ new Set(["turn", "side", "head.turn", "head.tilt", "roll", "lookX"]);
2126
+ function Ni(e) {
2125
2127
  const t = {};
2126
2128
  for (const [n, s] of Object.entries(e)) {
2127
2129
  const o = n.replace(/(^|\.)(left|right)(\.|$)/, (r, l, i, a) => `${l}${i === "left" ? "right" : "left"}${a}`);
2128
- t[o] = Zs.has(n) ? -s : s;
2130
+ t[o] = hr.has(n) ? -s : s;
2129
2131
  }
2130
2132
  return t;
2131
2133
  }
2132
- function Z(e, t) {
2134
+ function ee(e, t) {
2133
2135
  const n = {};
2134
2136
  for (const s of ["left", "right"]) for (const [o, r] of Object.entries(t)) n[`${e}.${s}.${o}`] = r;
2135
2137
  return n;
2136
2138
  }
2137
- const Qs = {
2138
- rest: X,
2139
- wave: ee({ "arm.right.spread": 115, "arm.right.bend": 55, "arm.right.elbow": 0, "head.tilt": -6, smile: 0.9 }),
2140
- cheer: ee({ ...Z("arm", { spread: 140, bend: 20, elbow: 0 }), mouth: 0.6, smile: 1, "eye.left": 0, "eye.right": 0 }),
2141
- point: ee({ "arm.right.spread": 88, "arm.right.elbow": 0, "arm.right.bend": 0, "head.turn": -20, smile: 0.4 }),
2142
- handsOnHips: ee({ ...Z("arm", { spread: 50, bend: -105, elbow: 0 }), ...Z("leg", { spread: 9 }), smile: 0.8 }),
2143
- think: ee({ "arm.right.spread": 22, "arm.right.bend": -150, "arm.right.elbow": 0, "head.tilt": 10, lookX: -0.5, lookY: -0.8, smile: 0 }),
2144
- shrug: ee({ ...Z("arm", { spread: 35, bend: 75, elbow: 0 }), "head.tilt": -10, smile: -0.2 }),
2145
- sit: ee({ ...Z("leg", { swing: 90, knee: 90, spread: 4 }), ...Z("arm", { swing: 25, elbow: 45, spread: 8 }) }),
2146
- kneel: ee({
2139
+ const cr = {
2140
+ rest: C,
2141
+ wave: te({ "arm.right.spread": 115, "arm.right.bend": 55, "arm.right.elbow": 0, "head.tilt": -6, smile: 0.9 }),
2142
+ cheer: te({ ...ee("arm", { spread: 140, bend: 20, elbow: 0 }), mouth: 0.6, smile: 1, "eye.left": 0, "eye.right": 0 }),
2143
+ point: te({ "arm.right.spread": 88, "arm.right.elbow": 0, "arm.right.bend": 0, "head.turn": -20, smile: 0.4 }),
2144
+ handsOnHips: te({ ...ee("arm", { spread: 50, bend: -105, elbow: 0 }), ...ee("leg", { spread: 9 }), smile: 0.8 }),
2145
+ think: te({ "arm.right.spread": 22, "arm.right.bend": -150, "arm.right.elbow": 0, "head.tilt": 10, lookX: -0.5, lookY: -0.8, smile: 0 }),
2146
+ shrug: te({ ...ee("arm", { spread: 35, bend: 75, elbow: 0 }), "head.tilt": -10, smile: -0.2 }),
2147
+ sit: te({ ...ee("leg", { swing: 90, knee: 90, spread: 4 }), ...ee("arm", { swing: 25, elbow: 45, spread: 8 }) }),
2148
+ kneel: te({
2147
2149
  "leg.left.swing": 90,
2148
2150
  "leg.left.knee": 90,
2149
2151
  // The back thigh leans back a little so its knee meets the ground beside the
@@ -2151,24 +2153,24 @@ const Qs = {
2151
2153
  "leg.right.swing": -18,
2152
2154
  "leg.right.knee": 108,
2153
2155
  "leg.right.ankle": 16,
2154
- ...Z("arm", { swing: 20, elbow: 30 })
2156
+ ...ee("arm", { swing: 20, elbow: 30 })
2155
2157
  }),
2156
- crouch: ee({ ...Z("leg", { swing: 75, knee: 140, spread: 6 }), lean: 25, ...Z("arm", { swing: 50, elbow: 40 }), "head.nod": -15 }),
2158
+ crouch: te({ ...ee("leg", { swing: 75, knee: 140, spread: 6 }), lean: 25, ...ee("arm", { swing: 50, elbow: 40 }), "head.nod": -15 }),
2157
2159
  // On hands and knees: the back nearly level, arms straight down, the toes
2158
2160
  // pointed back along the ground.
2159
- crawl: ee({ lean: 82, "head.nod": -35, ...Z("arm", { swing: 80, elbow: 0, spread: 4 }), ...Z("leg", { knee: 92, ankle: -88 }) }),
2160
- lieDown: ee({ roll: 90, ...Z("arm", { spread: 8 }), "head.nod": 0 })
2161
+ crawl: te({ lean: 82, "head.nod": -35, ...ee("arm", { swing: 80, elbow: 0, spread: 4 }), ...ee("leg", { knee: 92, ankle: -88 }) }),
2162
+ lieDown: te({ roll: 90, ...ee("arm", { spread: 8 }), "head.nod": 0 })
2161
2163
  };
2162
- function er(e = {}) {
2163
- const t = e.headSize ?? 0.3, n = e.shoulderWidth ?? 0.06, s = e.hipWidth ?? 0.022, o = Math.max(0.12, 1 - t - tn - (st + rt)), r = (a) => ({
2164
+ function fr(e = {}) {
2165
+ const t = e.headSize ?? 0.3, n = e.shoulderWidth ?? 0.06, s = e.hipWidth ?? 0.022, o = Math.max(0.12, 1 - t - rn - (at + ht)), r = (a) => ({
2164
2166
  id: `arm.${a}`,
2165
2167
  parent: "spine",
2166
2168
  offset: [(a === "left" ? 1 : -1) * n, -0.035, 0],
2167
2169
  rest: [0, -1, 0],
2168
2170
  side: a === "left" ? 1 : -1,
2169
2171
  bones: [
2170
- { length: zs, width: [1.25, 0.9] },
2171
- { length: Vs, width: [0.9, 0.75] }
2172
+ { length: nr, width: [1.25, 0.9] },
2173
+ { length: or, width: [0.9, 0.75] }
2172
2174
  ]
2173
2175
  }), l = (a) => ({
2174
2176
  id: `leg.${a}`,
@@ -2177,14 +2179,14 @@ function er(e = {}) {
2177
2179
  rest: [0, -1, 0],
2178
2180
  side: a === "left" ? 1 : -1,
2179
2181
  bones: [
2180
- { length: st, width: [1.45, 1.05] },
2181
- { length: rt, width: [1.05, 0.85] },
2182
- { length: Us, width: [0.95, 0.7] }
2182
+ { length: at, width: [1.45, 1.05] },
2183
+ { length: ht, width: [1.05, 0.85] },
2184
+ { length: tr, width: [0.95, 0.7] }
2183
2185
  ]
2184
- }), i = (a, h) => a[h] ?? X[h] ?? 0;
2186
+ }), i = (a, h) => a[h] ?? C[h] ?? 0;
2185
2187
  return {
2186
2188
  id: "human",
2187
- hipHeight: st + rt,
2189
+ hipHeight: at + ht,
2188
2190
  // Tie order: legs, then the body, then the arms (in front of the chest unless turned away), then the head.
2189
2191
  chains: [
2190
2192
  l("left"),
@@ -2198,7 +2200,7 @@ function er(e = {}) {
2198
2200
  { length: o / 2, width: [1.4, 1.1] }
2199
2201
  ]
2200
2202
  },
2201
- { id: "neck", parent: "spine", rest: [0, 1, 0], bones: [{ length: tn, width: [1, 0.9] }] },
2203
+ { id: "neck", parent: "spine", rest: [0, 1, 0], bones: [{ length: rn, width: [1, 0.9] }] },
2202
2204
  r("left"),
2203
2205
  r("right")
2204
2206
  ],
@@ -2218,29 +2220,29 @@ function er(e = {}) {
2218
2220
  ],
2219
2221
  angles(a, h) {
2220
2222
  if (h.id === "spine") {
2221
- const d = -i(a, "lean") / 2, m = i(a, "side") / 2;
2223
+ const g = -i(a, "lean") / 2, m = i(a, "side") / 2, b = -i(a, "bend");
2222
2224
  return [
2223
- { swing: d, spread: m },
2224
- { swing: d, spread: m }
2225
+ { swing: g + b * rr, spread: m },
2226
+ { swing: g + b * ir, spread: m }
2225
2227
  ];
2226
2228
  }
2227
- if (h.id === "neck") return [{ swing: 0, spread: 0 }];
2228
- const [c, u] = h.id.split("."), g = (d) => i(a, `${c}.${u}.${d}`);
2229
+ if (h.id === "neck") return [{ swing: -i(a, "bend") * lr, spread: 0 }];
2230
+ const [c, u] = h.id.split("."), d = (g) => i(a, `${c}.${u}.${g}`);
2229
2231
  if (c === "arm")
2230
2232
  return [
2231
- { swing: g("swing"), spread: g("spread") },
2232
- { swing: g("elbow"), spread: g("bend") }
2233
+ { swing: d("swing"), spread: d("spread") },
2234
+ { swing: d("elbow"), spread: d("bend") }
2233
2235
  ];
2234
- const f = (h.side ?? 1) * g("rotate"), p = 1 - Math.cos(Js(g("rotate")));
2236
+ const f = (h.side ?? 1) * d("rotate"), p = 1 - Math.cos(ar(d("rotate")));
2235
2237
  return [
2236
- { swing: g("swing"), spread: g("spread"), yaw: f },
2237
- { swing: -g("knee"), spread: 0, yaw: f },
2238
+ { swing: d("swing"), spread: d("spread"), yaw: f },
2239
+ { swing: -d("knee"), spread: 0, yaw: f },
2238
2240
  // The foot points forward, square to the shin, turned out a little (more with `toeOut`).
2239
- { swing: 90 + g("ankle") - p * (g("swing") - g("knee")), spread: 0, yaw: (js + g("toeOut")) * (h.side ?? 1) }
2241
+ { swing: 90 + d("ankle") - p * (d("swing") - d("knee")), spread: 0, yaw: (sr + d("toeOut")) * (h.side ?? 1) }
2240
2242
  ];
2241
2243
  },
2242
2244
  withAngles(a, h, c) {
2243
- const [u, g] = h.id.split("."), f = (p) => `${u}.${g}.${p}`;
2245
+ const [u, d] = h.id.split("."), f = (p) => `${u}.${d}.${p}`;
2244
2246
  return u === "arm" ? {
2245
2247
  ...a,
2246
2248
  [f("swing")]: c[0].swing,
@@ -2283,7 +2285,7 @@ function er(e = {}) {
2283
2285
  }
2284
2286
  };
2285
2287
  }
2286
- function Ti(e) {
2288
+ function Li(e) {
2287
2289
  const t = e.split(".");
2288
2290
  if (t[0] === "hand" && t.length >= 3) {
2289
2291
  const s = `${t[1] === "left" ? "Left" : "Right"} hand`, o = { spread: "finger spread", turn: "wrist turn", bend: "wrist bend", tilt: "wrist tilt", roll: "roll" }, r = t.slice(2).join(".");
@@ -2305,6 +2307,7 @@ function Ti(e) {
2305
2307
  return {
2306
2308
  turn: "View (front → side → back)",
2307
2309
  lean: "Lean forward / back",
2310
+ bend: "Back curve (line of action)",
2308
2311
  side: "Lean sideways",
2309
2312
  "head.turn": "Head · turn",
2310
2313
  "head.nod": "Head · nod",
@@ -2325,181 +2328,181 @@ function Ti(e) {
2325
2328
  lookY: "Look up / down"
2326
2329
  }[e] ?? e;
2327
2330
  }
2328
- const tr = {
2331
+ const ur = {
2329
2332
  leftEye: "eye.left",
2330
2333
  rightEye: "eye.right",
2331
2334
  leftBrow: "brow.left",
2332
2335
  rightBrow: "brow.right"
2333
- }, Ai = Object.fromEntries(
2334
- Object.entries(Y).map(([e, t]) => [
2336
+ }, dr = Object.fromEntries(
2337
+ Object.entries(X).map(([e, t]) => [
2335
2338
  e,
2336
- Object.fromEntries(Object.entries(t).map(([n, s]) => [tr[n] ?? n, s]))
2339
+ Object.fromEntries(Object.entries(t).map(([n, s]) => [ur[n] ?? n, s]))
2337
2340
  ])
2338
2341
  );
2339
- function xi(e, t) {
2340
- const n = Math.min(1, Math.max(0, e.turn ?? 0)), s = 1 - n, o = { ...X, turn: n }, r = [
2342
+ function Yi(e, t) {
2343
+ const n = Math.min(1, Math.max(0, e.turn ?? 0)), s = 1 - n, o = { ...C, turn: n }, r = [
2341
2344
  { stick: "right", human: "left", s: 1 },
2342
2345
  { stick: "left", human: "right", s: -1 }
2343
2346
  ];
2344
2347
  for (const { stick: i, human: a, s: h } of r) {
2345
2348
  const c = e[`${i}Shoulder`], u = e[`${i}Elbow`];
2346
2349
  o[`arm.${a}.spread`] = c * s, o[`arm.${a}.swing`] = h * c * n, o[`arm.${a}.bend`] = u * s, o[`arm.${a}.elbow`] = h * u * n;
2347
- const g = e[`${i}Hip`], f = e[`${i}Knee`], p = s + h * n;
2348
- o[`leg.${a}.rotate`] = 90 * s, o[`leg.${a}.spread`] = 0, o[`leg.${a}.swing`] = g * p, o[`leg.${a}.knee`] = f * p, o[`leg.${a}.ankle`] = -(e[`${i}Ankle`] ?? 0), o[`leg.${a}.toeOut`] = (e[`${i}FootOut`] ?? 0) * nr, o[`eye.${a}`] = e[`${i}Eye`], o[`brow.${a}`] = e[`${i}Brow`], t && Object.assign(o, or(a, t[i] ?? L, e[`${i}Wrist`] ?? 0, n));
2350
+ const d = e[`${i}Hip`], f = e[`${i}Knee`], p = s + h * n;
2351
+ o[`leg.${a}.rotate`] = 90 * s, o[`leg.${a}.spread`] = 0, o[`leg.${a}.swing`] = d * p, o[`leg.${a}.knee`] = f * p, o[`leg.${a}.ankle`] = -(e[`${i}Ankle`] ?? 0), o[`leg.${a}.toeOut`] = (e[`${i}FootOut`] ?? 0) * gr, o[`eye.${a}`] = e[`${i}Eye`], o[`brow.${a}`] = e[`${i}Brow`], t && Object.assign(o, pr(a, t[i] ?? Y, e[`${i}Wrist`] ?? 0, n));
2349
2352
  }
2350
2353
  const l = e.bend ?? 0;
2351
- o.lean = (e.lean + l * 0.5) * n, o.side = (e.lean + l * 0.5) * s, o["head.tilt"] = (e.headTilt + l * 0.5) * s, o["head.nod"] = (e.headTilt + l * 0.5) * n;
2354
+ o.lean = e.lean * n, o.bend = l * n, o.side = (e.lean + l * 0.5) * s, o["head.tilt"] = (e.headTilt + l * 0.5) * s, o["head.nod"] = e.headTilt * n;
2352
2355
  for (const i of ["mouth", "smile", "mouthWidth", "blink", "browTilt", "lookX", "lookY", "stretch"]) o[i] = e[i];
2353
2356
  return o.lift = e.rise ?? 0, o.roll = e.spin ?? 0, o;
2354
2357
  }
2355
- const nr = 70;
2356
- function or(e, t, n, s) {
2358
+ const gr = 70;
2359
+ function pr(e, t, n, s) {
2357
2360
  const o = e === "right" ? 1 - s : 1 + s, r = {};
2358
- for (const l of Object.keys(L)) r[`hand.${e}.${l}`] = t[l] ?? L[l];
2361
+ for (const l of Object.keys(Y)) r[`hand.${e}.${l}`] = t[l] ?? Y[l];
2359
2362
  return r[`hand.${e}.turn`] = (t.turn ?? 0) - o, r[`hand.${e}.roll`] = (t.roll ?? 0) + n, r;
2360
2363
  }
2361
- const te = (e) => e * Math.PI / 180;
2362
- function Rn([e, t, n], s) {
2364
+ const oe = (e) => e * Math.PI / 180;
2365
+ function Gn([e, t, n], s) {
2363
2366
  const o = Math.cos(s), r = Math.sin(s);
2364
2367
  return [e, t * o + n * r, -t * r + n * o];
2365
2368
  }
2366
- function Wt([e, t, n], s) {
2369
+ function $t([e, t, n], s) {
2367
2370
  const o = Math.cos(s), r = Math.sin(s);
2368
2371
  return [e * o - t * r, e * r + t * o, n];
2369
2372
  }
2370
- function ge([e, t, n], s) {
2373
+ function me([e, t, n], s) {
2371
2374
  const o = Math.cos(s), r = Math.sin(s);
2372
2375
  return [e * o + n * r, t, -e * r + n * o];
2373
2376
  }
2374
- const he = (e, t) => [e[0] + t[0], e[1] + t[1], e[2] + t[2]], je = (e, t) => [e[0] * t, e[1] * t, e[2] * t], De = (e, t) => Wt(Rn(e, t.swing), t.spread);
2375
- function it(e, t) {
2376
- const n = ge(e, t);
2377
+ const fe = (e, t) => [e[0] + t[0], e[1] + t[1], e[2] + t[2]], Qe = (e, t) => [e[0] * t, e[1] * t, e[2] * t], Ue = (e, t) => $t(Gn(e, t.swing), t.spread);
2378
+ function ct(e, t) {
2379
+ const n = me(e, t);
2377
2380
  return { point: { x: n[0], y: -n[1] }, depth: n[2] };
2378
2381
  }
2379
- function Ot(e, t, n) {
2382
+ function Bt(e, t, n) {
2380
2383
  const s = n, r = [0, e.hipHeight * s * (e.boneScale?.(t, null) ?? 1), 0], l = {};
2381
- for (const d of e.chains) {
2382
- const m = d.parent ? l[d.parent] : void 0;
2383
- if (d.parent && !m) throw new Error(`body plan ${e.id}: chain ${d.id} comes before its parent ${d.parent}`);
2384
- const b = d.at ?? (m ? m.joints3.length - 1 : 0), y = m ? m.joints3[b] : r, E = m ? m.frames[Math.max(0, b - 1)] : { swing: 0, spread: 0 }, H = d.offset ? he(y, De(je(d.offset, s), E)) : y, M = d.side ?? 1, A = e.boneScale?.(t, d) ?? 1, w = e.angles(t, d), S = [H], k = [];
2385
- let x = E.swing, v = E.spread;
2386
- d.bones.forEach((T, K) => {
2387
- const P = w[K] ?? { swing: 0, spread: 0 };
2388
- x += te(P.swing), v += te(P.spread) * M, k.push({ swing: x, spread: v });
2389
- const I = ge(De(d.rest, { swing: x, spread: v }), te(P.yaw ?? 0));
2390
- S.push(he(S[K], je(I, T.length * s * A)));
2391
- }), l[d.id] = { joints3: S, frames: k };
2392
- }
2393
- const i = l[e.head.on], a = e.headPose?.(t) ?? { yaw: 0, nod: 0, tilt: 0, sx: 1, sy: 1 }, h = i.frames[i.frames.length - 1], c = e.head.size / 2 * s, u = c * a.sx, g = c * a.sy, f = (d) => De(ge(Rn(Wt(d, -te(a.tilt)), -te(a.nod)), te(a.yaw)), h), p = he(i.joints3[i.joints3.length - 1], f([0, g, 0]));
2394
- return { height: s, root: r, chains: l, head: { center: p, rx: u, ry: g, toBody: f } };
2395
- }
2396
- function It(e, t, n) {
2397
- const s = n.height, o = te(90 * (t.turn ?? 0)), r = Ot(e, t, s), { root: l } = r, i = r.chains, { rx: a, ry: h } = r.head, c = r.head.toBody, u = r.head.center, g = {};
2398
- for (const k of e.chains) {
2399
- const { joints3: x, frames: v } = i[k.id], T = x.map((K) => it(K, o));
2400
- g[k.id] = {
2401
- id: k.id,
2402
- joints3: x,
2403
- frames: v,
2404
- points: T.map((K) => K.point),
2405
- depths: T.map((K) => K.depth)
2384
+ for (const g of e.chains) {
2385
+ const m = g.parent ? l[g.parent] : void 0;
2386
+ if (g.parent && !m) throw new Error(`body plan ${e.id}: chain ${g.id} comes before its parent ${g.parent}`);
2387
+ const b = g.at ?? (m ? m.joints3.length - 1 : 0), S = m ? m.joints3[b] : r, k = m ? m.frames[Math.max(0, b - 1)] : { swing: 0, spread: 0 }, v = g.offset ? fe(S, Ue(Qe(g.offset, s), k)) : S, H = g.side ?? 1, T = e.boneScale?.(t, g) ?? 1, M = e.angles(t, g), w = [v], y = [];
2388
+ let A = k.swing, x = k.spread;
2389
+ g.bones.forEach((E, P) => {
2390
+ const K = M[P] ?? { swing: 0, spread: 0 };
2391
+ A += oe(K.swing), x += oe(K.spread) * H, y.push({ swing: A, spread: x });
2392
+ const _ = me(Ue(g.rest, { swing: A, spread: x }), oe(K.yaw ?? 0));
2393
+ w.push(fe(w[P], Qe(_, E.length * s * T)));
2394
+ }), l[g.id] = { joints3: w, frames: y };
2395
+ }
2396
+ const i = l[e.head.on], a = e.headPose?.(t) ?? { yaw: 0, nod: 0, tilt: 0, sx: 1, sy: 1 }, h = i.frames[i.frames.length - 1], c = e.head.size / 2 * s, u = c * a.sx, d = c * a.sy, f = (g) => Ue(me(Gn($t(g, -oe(a.tilt)), -oe(a.nod)), oe(a.yaw)), h), p = fe(i.joints3[i.joints3.length - 1], f([0, d, 0]));
2397
+ return { height: s, root: r, chains: l, head: { center: p, rx: u, ry: d, toBody: f } };
2398
+ }
2399
+ function Ft(e, t, n) {
2400
+ const s = n.height, o = oe(90 * (t.turn ?? 0)), r = Bt(e, t, s), { root: l } = r, i = r.chains, { rx: a, ry: h } = r.head, c = r.head.toBody, u = r.head.center, d = {};
2401
+ for (const y of e.chains) {
2402
+ const { joints3: A, frames: x } = i[y.id], E = A.map((P) => ct(P, o));
2403
+ d[y.id] = {
2404
+ id: y.id,
2405
+ joints3: A,
2406
+ frames: x,
2407
+ points: E.map((P) => P.point),
2408
+ depths: E.map((P) => P.depth)
2406
2409
  };
2407
2410
  }
2408
- const f = it(u, o), p = [[1, 0, 0], [0, 1, 0], [0, 0, 1]].map((k) => ge(c(k), o)), d = it(l, o).point, m = te(t.roll ?? 0), b = (k) => {
2409
- const x = k.x - d.x, v = k.y - d.y;
2410
- return { x: d.x + x * Math.cos(m) - v * Math.sin(m), y: d.y + x * Math.sin(m) + v * Math.cos(m) };
2411
- }, y = ([k, x, v]) => [k * Math.cos(m) + x * Math.sin(m), -k * Math.sin(m) + x * Math.cos(m), v];
2412
- for (const k of Object.values(g)) k.points = k.points.map(b);
2413
- const E = {
2411
+ const f = ct(u, o), p = [[1, 0, 0], [0, 1, 0], [0, 0, 1]].map((y) => me(c(y), o)), g = ct(l, o).point, m = oe(t.roll ?? 0), b = (y) => {
2412
+ const A = y.x - g.x, x = y.y - g.y;
2413
+ return { x: g.x + A * Math.cos(m) - x * Math.sin(m), y: g.y + A * Math.sin(m) + x * Math.cos(m) };
2414
+ }, S = ([y, A, x]) => [y * Math.cos(m) + A * Math.sin(m), -y * Math.sin(m) + A * Math.cos(m), x];
2415
+ for (const y of Object.values(d)) y.points = y.points.map(b);
2416
+ const k = {
2414
2417
  center: b(f.point),
2415
2418
  depth: f.depth,
2416
2419
  rx: a,
2417
2420
  ry: h,
2418
2421
  angle: 0,
2419
- axes: p.map(y)
2420
- }, H = E.axes[1];
2421
- E.angle = Math.atan2(H[0], H[1]);
2422
- const M = (k) => {
2423
- if ("head" in k) return { x: E.center.x + H[0] * h, y: E.center.y - H[1] * h };
2424
- const x = g[k.chain];
2425
- return x.points[Math.min(k.joint, x.points.length - 1)];
2422
+ axes: p.map(S)
2423
+ }, v = k.axes[1];
2424
+ k.angle = Math.atan2(v[0], v[1]);
2425
+ const H = (y) => {
2426
+ if ("head" in y) return { x: k.center.x + v[0] * h, y: k.center.y - v[1] * h };
2427
+ const A = d[y.chain];
2428
+ return A.points[Math.min(y.joint, A.points.length - 1)];
2426
2429
  };
2427
- let A = 0;
2428
- (n.contact ?? "ground") === "ground" && (A = -Math.max(...e.contacts.map((k) => M(k).y))), A -= (t.lift ?? 0) * s;
2429
- const w = (k) => ({ x: k.x, y: k.y + A });
2430
- for (const k of Object.values(g)) k.points = k.points.map(w);
2431
- E.center = w(E.center);
2432
- const S = e.contacts.map((k) => ({ spec: k, point: M(k) }));
2430
+ let T = 0;
2431
+ (n.contact ?? "ground") === "ground" && (T = -Math.max(...e.contacts.map((y) => H(y).y))), T -= (t.lift ?? 0) * s;
2432
+ const M = (y) => ({ x: y.x, y: y.y + T });
2433
+ for (const y of Object.values(d)) y.points = y.points.map(M);
2434
+ k.center = M(k.center);
2435
+ const w = e.contacts.map((y) => ({ spec: y, point: H(y) }));
2433
2436
  return {
2434
2437
  height: s,
2435
2438
  view: o,
2436
- chains: g,
2437
- head: E,
2438
- hip: w(b(d)),
2439
- contacts: S,
2440
- groundY: Math.max(...S.map((k) => k.point.y))
2439
+ chains: d,
2440
+ head: k,
2441
+ hip: M(b(g)),
2442
+ contacts: w,
2443
+ groundY: Math.max(...w.map((y) => y.point.y))
2441
2444
  };
2442
2445
  }
2443
- const kt = (e, t) => [e[0] - t[0], e[1] - t[1], e[2] - t[2]], Ln = (e) => {
2446
+ const Ht = (e, t) => [e[0] - t[0], e[1] - t[1], e[2] - t[2]], Un = (e) => {
2444
2447
  const t = Math.hypot(e[0], e[1], e[2]) || 1;
2445
2448
  return [e[0] / t, e[1] / t, e[2] / t];
2446
2449
  };
2447
- function Nn(e, t, n) {
2448
- const s = n.height, o = te(90 * (t.turn ?? 0)), r = te(t.roll ?? 0), l = Ot(e, t, s), i = ge(l.root, o), a = (m) => he(Wt(kt(ge(m, o), i), -r), i), h = {};
2450
+ function zn(e, t, n) {
2451
+ const s = n.height, o = oe(90 * (t.turn ?? 0)), r = oe(t.roll ?? 0), l = Bt(e, t, s), i = me(l.root, o), a = (m) => fe($t(Ht(me(m, o), i), -r), i), h = {};
2449
2452
  for (const m of e.chains) h[m.id] = l.chains[m.id].joints3.map(a);
2450
- const c = a(l.head.center), u = (m) => Ln(kt(a(he(l.head.center, l.head.toBody(m))), c)), g = [u([1, 0, 0]), u([0, 1, 0]), u([0, 0, 1])], f = (m) => {
2451
- if ("head" in m) return he(c, je(g[1], l.head.ry));
2453
+ const c = a(l.head.center), u = (m) => Un(Ht(a(fe(l.head.center, l.head.toBody(m))), c)), d = [u([1, 0, 0]), u([0, 1, 0]), u([0, 0, 1])], f = (m) => {
2454
+ if ("head" in m) return fe(c, Qe(d[1], l.head.ry));
2452
2455
  const b = h[m.chain];
2453
2456
  return b[Math.min(m.joint, b.length - 1)];
2454
2457
  };
2455
2458
  let p = 0;
2456
2459
  (n.contact ?? "ground") === "ground" && (p = -Math.min(...e.contacts.map((m) => f(m)[1]))), p += (t.lift ?? 0) * s;
2457
- const d = (m) => [m[0], m[1] + p, m[2]];
2460
+ const g = (m) => [m[0], m[1] + p, m[2]];
2458
2461
  return {
2459
2462
  height: s,
2460
- hip: d(i),
2461
- chains: Object.fromEntries(Object.entries(h).map(([m, b]) => [m, b.map(d)])),
2462
- head: { center: d(c), rx: l.head.rx, ry: l.head.ry, axes: g }
2463
+ hip: g(i),
2464
+ chains: Object.fromEntries(Object.entries(h).map(([m, b]) => [m, b.map(g)])),
2465
+ head: { center: g(c), rx: l.head.rx, ry: l.head.ry, axes: d }
2463
2466
  };
2464
2467
  }
2465
- function Yn(e, t, n, s) {
2466
- const o = n.height, r = te(90 * (t.turn ?? 0)), l = Ot(e, t, o), i = Nn(e, t, n), a = i.hip, h = i.chains, c = i.head.center, u = (k) => {
2467
- if ("head" in k) return he(c, je(i.head.axes[1], i.head.ry));
2468
- const x = h[k.chain];
2469
- return x[Math.min(k.joint, x.length - 1)];
2470
- }, g = s.toView(a), f = s.toScreen(g), p = s.toScreen([g[0] + 1, g[1], g[2]]), d = Math.hypot(p.x - f.x, p.y - f.y), m = (k) => {
2471
- const x = s.toView(k);
2472
- return { point: s.toScreen(x), depth: x[2] * d };
2468
+ function Vn(e, t, n, s) {
2469
+ const o = n.height, r = oe(90 * (t.turn ?? 0)), l = Bt(e, t, o), i = zn(e, t, n), a = i.hip, h = i.chains, c = i.head.center, u = (y) => {
2470
+ if ("head" in y) return fe(c, Qe(i.head.axes[1], i.head.ry));
2471
+ const A = h[y.chain];
2472
+ return A[Math.min(y.joint, A.length - 1)];
2473
+ }, d = s.toView(a), f = s.toScreen(d), p = s.toScreen([d[0] + 1, d[1], d[2]]), g = Math.hypot(p.x - f.x, p.y - f.y), m = (y) => {
2474
+ const A = s.toView(y);
2475
+ return { point: s.toScreen(A), depth: A[2] * g };
2473
2476
  }, b = {};
2474
- for (const k of e.chains) {
2475
- const x = h[k.id].map(m);
2476
- b[k.id] = {
2477
- id: k.id,
2478
- joints3: l.chains[k.id].joints3,
2479
- frames: l.chains[k.id].frames,
2480
- points: x.map((v) => v.point),
2481
- depths: x.map((v) => v.depth)
2477
+ for (const y of e.chains) {
2478
+ const A = h[y.id].map(m);
2479
+ b[y.id] = {
2480
+ id: y.id,
2481
+ joints3: l.chains[y.id].joints3,
2482
+ frames: l.chains[y.id].frames,
2483
+ points: A.map((x) => x.point),
2484
+ depths: A.map((x) => x.depth)
2482
2485
  };
2483
2486
  }
2484
- const y = s.toView(c), E = s.toScreen(y), H = s.toScreen([y[0] + 1, y[1], y[2]]), M = Math.hypot(H.x - E.x, H.y - E.y), A = i.head.axes.map((k) => Ln(kt(s.toView(he(c, k)), y))), w = {
2485
- center: E,
2486
- depth: y[2] * d,
2487
- rx: l.head.rx * M,
2488
- ry: l.head.ry * M,
2489
- angle: Math.atan2(A[1][0], A[1][1]),
2490
- axes: A
2491
- }, S = e.contacts.map((k) => ({ spec: k, point: m(u(k)).point }));
2487
+ const S = s.toView(c), k = s.toScreen(S), v = s.toScreen([S[0] + 1, S[1], S[2]]), H = Math.hypot(v.x - k.x, v.y - k.y), T = i.head.axes.map((y) => Un(Ht(s.toView(fe(c, y)), S))), M = {
2488
+ center: k,
2489
+ depth: S[2] * g,
2490
+ rx: l.head.rx * H,
2491
+ ry: l.head.ry * H,
2492
+ angle: Math.atan2(T[1][0], T[1][1]),
2493
+ axes: T
2494
+ }, w = e.contacts.map((y) => ({ spec: y, point: m(u(y)).point }));
2492
2495
  return {
2493
- height: o * d,
2496
+ height: o * g,
2494
2497
  view: r,
2495
2498
  chains: b,
2496
- head: w,
2499
+ head: M,
2497
2500
  hip: f,
2498
- contacts: S,
2499
- groundY: Math.max(...S.map((k) => k.point.y))
2501
+ contacts: w,
2502
+ groundY: Math.max(...w.map((y) => y.point.y))
2500
2503
  };
2501
2504
  }
2502
- function Cn(e, [t, n, s]) {
2505
+ function jn(e, [t, n, s]) {
2503
2506
  const [o, r, l] = e.axes, i = [
2504
2507
  o[0] * t * e.rx + r[0] * n * e.ry + l[0] * s * e.rx,
2505
2508
  o[1] * t * e.rx + r[1] * n * e.ry + l[1] * s * e.rx,
@@ -2507,93 +2510,93 @@ function Cn(e, [t, n, s]) {
2507
2510
  ], a = Math.hypot(t, n, s) || 1, h = (o[2] * t + r[2] * n + l[2] * s) / a;
2508
2511
  return { point: { x: e.center.x + i[0], y: e.center.y - i[1] }, depth: e.depth + i[2], facing: h };
2509
2512
  }
2510
- const $e = (e) => e * 180 / Math.PI, me = (e, t) => [e[0] - t[0], e[1] - t[1], e[2] - t[2]], lt = (e, t) => e[0] * t[0] + e[1] * t[1] + e[2] * t[2], Te = (e) => Math.hypot(e[0], e[1], e[2]), St = (e) => {
2511
- const t = Te(e) || 1;
2513
+ const Ne = (e) => e * 180 / Math.PI, we = (e, t) => [e[0] - t[0], e[1] - t[1], e[2] - t[2]], ft = (e, t) => e[0] * t[0] + e[1] * t[1] + e[2] * t[2], Pe = (e) => Math.hypot(e[0], e[1], e[2]), vt = (e) => {
2514
+ const t = Pe(e) || 1;
2512
2515
  return [e[0] / t, e[1] / t, e[2] / t];
2513
- }, Be = (e) => Math.atan2(Math.sin(e), Math.cos(e));
2514
- function nn(e) {
2515
- const [t, n, s] = St(e);
2516
+ }, Le = (e) => Math.atan2(Math.sin(e), Math.cos(e));
2517
+ function ln(e) {
2518
+ const [t, n, s] = vt(e);
2516
2519
  return { swing: Math.asin(Math.max(-1, Math.min(1, s))), spread: Math.atan2(t, -n) };
2517
2520
  }
2518
- function sr(e, t, n, s, o) {
2519
- const r = e.chains.find((x) => x.id === n);
2521
+ function mr(e, t, n, s, o) {
2522
+ const r = e.chains.find((A) => A.id === n);
2520
2523
  if (!r) throw new Error(`reach: no chain ${n} in ${e.id}`);
2521
2524
  if (r.bones.length < 2 || r.rest[1] > -0.99) throw new Error(`reach: ${n} is not a hanging limb of two bones or more`);
2522
2525
  if (!e.withAngles) throw new Error(`reach: the ${e.id} plan cannot set angles`);
2523
- const l = It(e, { ...t, turn: 0, roll: 0, lift: 0 }, { height: o.height, contact: "none" }), i = l.chains[n], a = i.joints3[0], h = Te(me(i.joints3[1], i.joints3[0])), c = Te(me(i.joints3[2], i.joints3[1])), u = r.parent ? l.chains[r.parent].frames[Math.max(0, (r.at ?? l.chains[r.parent].joints3.length - 1) - 1)] : { swing: 0, spread: 0 }, g = me(s, a), f = Math.min(h + c - 1e-6, Math.max(Math.abs(h - c) + 1e-6, Te(g))), p = St(g), d = r.parent !== null, m = De(r.pole ?? (d ? [0, -0.35, -1] : [0, 0, 1]), u);
2524
- let b = me(m, [p[0] * lt(m, p), p[1] * lt(m, p), p[2] * lt(m, p)]);
2525
- Te(b) < 1e-6 && (b = ge([1, 0, 0], 0)), b = St(b);
2526
- const y = (h * h + f * f - c * c) / (2 * h * f), E = Math.sqrt(Math.max(0, 1 - y * y)), H = [
2527
- a[0] + h * (y * p[0] + E * b[0]),
2528
- a[1] + h * (y * p[1] + E * b[1]),
2529
- a[2] + h * (y * p[2] + E * b[2])
2530
- ], M = [a[0] + p[0] * f, a[1] + p[1] * f, a[2] + p[2] * f], A = r.side ?? 1, w = nn(me(H, a)), S = nn(me(M, H)), k = [
2531
- { swing: $e(Be(w.swing - u.swing)), spread: $e(Be(w.spread - u.spread)) * A },
2532
- { swing: $e(Be(S.swing - w.swing)), spread: $e(Be(S.spread - w.spread)) * A }
2526
+ const l = Ft(e, { ...t, turn: 0, roll: 0, lift: 0 }, { height: o.height, contact: "none" }), i = l.chains[n], a = i.joints3[0], h = Pe(we(i.joints3[1], i.joints3[0])), c = Pe(we(i.joints3[2], i.joints3[1])), u = r.parent ? l.chains[r.parent].frames[Math.max(0, (r.at ?? l.chains[r.parent].joints3.length - 1) - 1)] : { swing: 0, spread: 0 }, d = we(s, a), f = Math.min(h + c - 1e-6, Math.max(Math.abs(h - c) + 1e-6, Pe(d))), p = vt(d), g = r.parent !== null, m = Ue(r.pole ?? (g ? [0, -0.35, -1] : [0, 0, 1]), u);
2527
+ let b = we(m, [p[0] * ft(m, p), p[1] * ft(m, p), p[2] * ft(m, p)]);
2528
+ Pe(b) < 1e-6 && (b = me([1, 0, 0], 0)), b = vt(b);
2529
+ const S = (h * h + f * f - c * c) / (2 * h * f), k = Math.sqrt(Math.max(0, 1 - S * S)), v = [
2530
+ a[0] + h * (S * p[0] + k * b[0]),
2531
+ a[1] + h * (S * p[1] + k * b[1]),
2532
+ a[2] + h * (S * p[2] + k * b[2])
2533
+ ], H = [a[0] + p[0] * f, a[1] + p[1] * f, a[2] + p[2] * f], T = r.side ?? 1, M = ln(we(v, a)), w = ln(we(H, v)), y = [
2534
+ { swing: Ne(Le(M.swing - u.swing)), spread: Ne(Le(M.spread - u.spread)) * T },
2535
+ { swing: Ne(Le(w.swing - M.swing)), spread: Ne(Le(w.spread - M.spread)) * T }
2533
2536
  ];
2534
- return e.withAngles(t, r, k);
2537
+ return e.withAngles(t, r, y);
2535
2538
  }
2536
- const rr = 0.34, ie = 0.12, oe = -0.4, re = (e, t, n) => e[t] ?? n, ir = (e, t) => Math.max(0, e) * (1 - Math.min(1, Math.max(0, t))), lr = 0.45, ar = 0.35, hr = 0.7;
2537
- function Je(e, t, n) {
2538
- const s = (f) => Math.sqrt(Math.max(0, 1 - f.x * f.x - f.y * f.y)), o = Cn(e, [n.x, n.y, s(n)]).facing, r = e.axes[2], l = Math.atan2(r[0], r[2]), i = Math.cos(l), a = i >= 0 ? 1 : -1, h = a * Math.max(ar, Math.abs(i)), c = a * Math.max(hr, Math.abs(i)), u = Math.cos(e.angle), g = Math.sin(e.angle);
2539
+ const br = 0.34, ae = 0.12, re = -0.4, le = (e, t, n) => e[t] ?? n, wr = (e, t) => Math.max(0, e) * (1 - Math.min(1, Math.max(0, t))), yr = 0.45, kr = 0.35, Sr = 0.7;
2540
+ function et(e, t, n) {
2541
+ const s = (f) => Math.sqrt(Math.max(0, 1 - f.x * f.x - f.y * f.y)), o = jn(e, [n.x, n.y, s(n)]).facing, r = e.axes[2], l = Math.atan2(r[0], r[2]), i = Math.cos(l), a = i >= 0 ? 1 : -1, h = a * Math.max(kr, Math.abs(i)), c = a * Math.max(Sr, Math.abs(i)), u = Math.cos(e.angle), d = Math.sin(e.angle);
2539
2542
  return {
2540
2543
  facing: o,
2541
2544
  points: t.map((f) => {
2542
- const p = lr * Math.sin(l) + n.x * h + (f.x - n.x) * c, d = f.y + r[1] * s(f), m = p * e.rx, b = d * e.ry;
2543
- return { x: e.center.x + m * u + b * g, y: e.center.y + m * g - b * u };
2545
+ const p = yr * Math.sin(l) + n.x * h + (f.x - n.x) * c, g = f.y + r[1] * s(f), m = p * e.rx, b = g * e.ry;
2546
+ return { x: e.center.x + m * u + b * d, y: e.center.y + m * d - b * u };
2544
2547
  })
2545
2548
  };
2546
2549
  }
2547
- const Fe = (e, t, n, s = 12) => Array.from({ length: s + 1 }, (o, r) => {
2550
+ const Ye = (e, t, n, s = 12) => Array.from({ length: s + 1 }, (o, r) => {
2548
2551
  const l = r / s, i = 1 - l;
2549
2552
  return { x: i * i * e.x + 2 * i * l * t.x + l * l * n.x, y: i * i * e.y + 2 * i * l * t.y + l * l * n.y };
2550
- }), at = (e, t, n, s, o = 16) => Array.from({ length: o }, (r, l) => {
2553
+ }), ut = (e, t, n, s, o = 16) => Array.from({ length: o }, (r, l) => {
2551
2554
  const i = Math.PI * 2 * l / o;
2552
2555
  return { x: e + Math.cos(i) * n, y: t + Math.sin(i) * s };
2553
- }), on = 0.05;
2554
- function cr(e, t, n, s) {
2555
- const o = Math.max(1, Math.min(s * 0.6, 0.14 * t.rx)), r = (b, y) => Je(t, b, y).points, l = (b, y) => Je(t, [], { x: b, y }).facing, i = re(n, "smile", 0), a = re(n, "blink", 0), h = re(n, "lookX", 0), c = re(n, "lookY", 0), u = re(n, "browTilt", 0);
2556
+ }), an = 0.05;
2557
+ function Er(e, t, n, s) {
2558
+ const o = Math.max(1, Math.min(s * 0.6, 0.14 * t.rx)), r = (b, S) => et(t, b, S).points, l = (b, S) => et(t, [], { x: b, y: S }).facing, i = le(n, "smile", 0), a = le(n, "blink", 0), h = le(n, "lookX", 0), c = le(n, "lookY", 0), u = le(n, "browTilt", 0);
2556
2559
  for (const b of [1, -1]) {
2557
- const y = b === 1 ? "left" : "right", E = rr * b;
2558
- if (l(E, ie) < on) continue;
2559
- const H = { x: E, y: ie }, M = ir(re(n, `eye.${y}`, 1), a);
2560
- if (M < 0.2) {
2561
- const k = i > 0.5 ? 0.12 : -0.06;
2562
- e.line(r(Fe({ x: E - 0.12, y: ie }, { x: E, y: ie + k }, { x: E + 0.12, y: ie }), H), o);
2560
+ const S = b === 1 ? "left" : "right", k = br * b;
2561
+ if (l(k, ae) < an) continue;
2562
+ const v = { x: k, y: ae }, H = wr(le(n, `eye.${S}`, 1), a);
2563
+ if (H < 0.2) {
2564
+ const y = i > 0.5 ? 0.12 : -0.06;
2565
+ e.line(r(Ye({ x: k - 0.12, y: ae }, { x: k, y: ae + y }, { x: k + 0.12, y: ae }), v), o);
2563
2566
  } else {
2564
- if (M > 1.2) {
2565
- const T = 0.13 * M;
2566
- e.shape(r(at(E, ie, T * 0.85, T), H), "#ffffff", o);
2567
+ if (H > 1.2) {
2568
+ const E = 0.13 * H;
2569
+ e.shape(r(ut(k, ae, E * 0.85, E), v), "#ffffff", o);
2567
2570
  }
2568
- const k = M > 1.2 ? 0.075 : 0.1, x = E + h * 0.08, v = ie - c * 0.07;
2569
- e.shape(r(at(x, v, k, k * 1.1 * Math.min(M, 1)), H), e.ink, 0);
2571
+ const y = H > 1.2 ? 0.075 : 0.1, A = k + h * 0.08, x = ae - c * 0.07;
2572
+ e.shape(r(ut(A, x, y, y * 1.1 * Math.min(H, 1)), v), e.ink, 0);
2570
2573
  }
2571
- const A = ie + 0.3 + re(n, `brow.${y}`, 0) * 0.14 + Math.max(0, M - 1) * 0.12, w = { x: E + b * 0.13, y: A }, S = { x: E - b * 0.13, y: A + u * 0.1 };
2572
- e.line(r([w, { x: (w.x + S.x) / 2, y: (w.y + S.y) / 2 }, S], { x: E, y: A }), o);
2574
+ const T = ae + 0.3 + le(n, `brow.${S}`, 0) * 0.14 + Math.max(0, H - 1) * 0.12, M = { x: k + b * 0.13, y: T }, w = { x: k - b * 0.13, y: T + u * 0.1 };
2575
+ e.line(r([M, { x: (M.x + w.x) / 2, y: (M.y + w.y) / 2 }, w], { x: k, y: T }), o);
2573
2576
  }
2574
- const g = { x: 0, y: oe };
2575
- if (l(0, oe) < -on) return;
2576
- const f = 0.25 * Math.max(0.3, re(n, "mouthWidth", 1)), p = Math.min(1, Math.max(0, re(n, "mouth", 0)));
2577
+ const d = { x: 0, y: re };
2578
+ if (l(0, re) < -an) return;
2579
+ const f = 0.25 * Math.max(0.3, le(n, "mouthWidth", 1)), p = Math.min(1, Math.max(0, le(n, "mouth", 0)));
2577
2580
  if (p <= 0.05) {
2578
- e.line(r(Fe({ x: -f, y: oe }, { x: 0, y: oe - i * 0.25 }, { x: f, y: oe }), g), o);
2581
+ e.line(r(Ye({ x: -f, y: re }, { x: 0, y: re - i * 0.25 }, { x: f, y: re }), d), o);
2579
2582
  return;
2580
2583
  }
2581
- const d = 0.3 * p;
2584
+ const g = 0.3 * p;
2582
2585
  let m;
2583
2586
  if (i > 0.3) {
2584
- const b = oe + 0.05;
2585
- m = [...Fe({ x: f, y: b }, { x: 0, y: oe - d * 2 }, { x: -f, y: b })];
2587
+ const b = re + 0.05;
2588
+ m = [...Ye({ x: f, y: b }, { x: 0, y: re - g * 2 }, { x: -f, y: b })];
2586
2589
  } else if (i < -0.3) {
2587
- const b = oe - d * 0.6;
2588
- m = [...Fe({ x: f, y: b }, { x: 0, y: oe + d * 1.4 }, { x: -f, y: b })];
2590
+ const b = re - g * 0.6;
2591
+ m = [...Ye({ x: f, y: b }, { x: 0, y: re + g * 1.4 }, { x: -f, y: b })];
2589
2592
  } else
2590
- m = at(0, oe, f * 0.8, d);
2591
- e.shape(r(m, g), e.ink, 0);
2593
+ m = ut(0, re, f * 0.8, g);
2594
+ e.shape(r(m, d), e.ink, 0);
2592
2595
  }
2593
- function fr(e = {}) {
2596
+ function Mr(e = {}) {
2594
2597
  const t = (e.proportions ?? "bold") === "bold", n = e.figure ?? "fluid", s = e.look ?? "clean", o = e.height ?? 300, r = n === "stick";
2595
2598
  return {
2596
- plan: e.plan ?? er({
2599
+ plan: e.plan ?? fr({
2597
2600
  headSize: e.headSize ?? (t ? 0.3 : 0.24),
2598
2601
  shoulderWidth: r ? 0 : e.shoulderWidth ?? 0.06,
2599
2602
  hipWidth: r ? 0 : e.hipWidth ?? 0.022
@@ -2613,33 +2616,33 @@ function fr(e = {}) {
2613
2616
  handSize: e.handSize ?? (e.handStyle === "natural" ? 0.14 : 0.17)
2614
2617
  };
2615
2618
  }
2616
- function Ki(e, t, n, s) {
2617
- const { point: o, facing: r } = Cn(e, [t, n, s]);
2619
+ function Ci(e, t, n, s) {
2620
+ const { point: o, facing: r } = jn(e, [t, n, s]);
2618
2621
  return { point: o, facing: r };
2619
2622
  }
2620
- const Et = (e) => e.rest[1] < -0.5, ur = 0.3;
2621
- function dr(e, t, n) {
2622
- return e.figure === "stick" ? Et(t) ? n.slice(0, 3) : n : Et(t) && n.length >= 3 ? ke(n[0], n[1], n[2], ur) : n.length === 3 ? ke(n[0], n[1], n[2], 1) : n;
2623
+ const Tt = (e) => e.rest[1] < -0.5, Hr = 0.3;
2624
+ function vr(e, t, n) {
2625
+ return e.figure === "stick" ? Tt(t) ? n.slice(0, 3) : n : Tt(t) && n.length >= 3 ? He(n[0], n[1], n[2], Hr) : n.length === 3 ? He(n[0], n[1], n[2], 1) : n;
2623
2626
  }
2624
- function _t(e, t) {
2625
- const n = e.plan.id === "human" ? { ...X, ...t } : t;
2626
- return $t(e, n, It(e.plan, n, { height: e.height, contact: e.contact }));
2627
+ function Rt(e, t) {
2628
+ const n = e.plan.id === "human" ? { ...C, ...t } : t;
2629
+ return Nt(e, n, Ft(e.plan, n, { height: e.height, contact: e.contact }));
2627
2630
  }
2628
- function $t(e, t, n) {
2631
+ function Nt(e, t, n) {
2629
2632
  const s = {}, o = {}, r = {}, l = 0.01 * e.height;
2630
- e.plan.chains.forEach((g) => {
2631
- const f = n.chains[g.id];
2632
- s[g.id] = f.points;
2633
- const p = f.depths.reduce((y, E) => y + E, 0) / f.depths.length, d = g.parent ? n.chains[g.parent] : void 0, m = d ? d.depths[g.at ?? d.depths.length - 1] : 0, b = p - m;
2634
- r[g.id] = Math.abs(b) < l ? 0 : b, o[g.id] = { points: dr(e, g, f.points), depth: p };
2633
+ e.plan.chains.forEach((d) => {
2634
+ const f = n.chains[d.id];
2635
+ s[d.id] = f.points;
2636
+ const p = f.depths.reduce((S, k) => S + k, 0) / f.depths.length, g = d.parent ? n.chains[d.parent] : void 0, m = g ? g.depths[d.at ?? g.depths.length - 1] : 0, b = p - m;
2637
+ r[d.id] = Math.abs(b) < l ? 0 : b, o[d.id] = { points: vr(e, d, f.points), depth: p };
2635
2638
  }), o.head = { points: [n.head.center], depth: n.head.depth }, r.head = 0;
2636
- const i = [...e.plan.chains.map((g) => g.id), "head"], a = [...i].sort((g, f) => r[g] - r[f] || i.indexOf(g) - i.indexOf(f)), h = { hip: n.hip };
2637
- for (const [g, [f, p]] of Object.entries(e.plan.landmarks ?? {})) {
2638
- const d = n.chains[f]?.points;
2639
- d && (h[g] = d[Math.min(p, d.length - 1)]);
2639
+ const i = [...e.plan.chains.map((d) => d.id), "head"], a = [...i].sort((d, f) => r[d] - r[f] || i.indexOf(d) - i.indexOf(f)), h = { hip: n.hip };
2640
+ for (const [d, [f, p]] of Object.entries(e.plan.landmarks ?? {})) {
2641
+ const g = n.chains[f]?.points;
2642
+ g && (h[d] = g[Math.min(p, g.length - 1)]);
2640
2643
  }
2641
2644
  const c = {};
2642
- for (const [g, f] of Object.entries(h)) c[g] = f.y >= n.groundY - 0.01 * e.height;
2645
+ for (const [d, f] of Object.entries(h)) c[d] = f.y >= n.groundY - 0.01 * e.height;
2643
2646
  const u = {
2644
2647
  height: e.height,
2645
2648
  lineWidth: e.lineWidth,
@@ -2653,25 +2656,25 @@ function $t(e, t, n) {
2653
2656
  };
2654
2657
  return { skeleton: n, joints: u, order: a };
2655
2658
  }
2656
- function gr(e, t) {
2657
- return _t(e, t).joints;
2659
+ function Tr(e, t) {
2660
+ return Rt(e, t).joints;
2658
2661
  }
2659
- function pr(e, t, n) {
2662
+ function Ar(e, t, n) {
2660
2663
  const { head: s } = n;
2661
2664
  e.guideEllipse(s.center.x, s.center.y, s.rx * 1.03, s.ry * 1.03, s.angle);
2662
- const o = Array.from({ length: 13 }, (a, h) => ({ x: 0, y: -0.95 + 1.9 * h / 12 })), r = Array.from({ length: 13 }, (a, h) => ({ x: -0.95 + 1.9 * h / 12, y: 0.12 })), l = Je(s, o, { x: 0, y: 0 });
2663
- l.facing > 0 && e.guide(l.points), e.guide(Je(s, r, { x: 0, y: 0.12 }).points), e.guide(n.chains.spine ?? []);
2665
+ const o = Array.from({ length: 13 }, (a, h) => ({ x: 0, y: -0.95 + 1.9 * h / 12 })), r = Array.from({ length: 13 }, (a, h) => ({ x: -0.95 + 1.9 * h / 12, y: 0.12 })), l = et(s, o, { x: 0, y: 0 });
2666
+ l.facing > 0 && e.guide(l.points), e.guide(et(s, r, { x: 0, y: 0.12 }).points), e.guide(n.chains.spine ?? []);
2664
2667
  const i = t.lineWidth * 0.9;
2665
2668
  for (const a of ["shoulder.left", "shoulder.right", "elbow.left", "elbow.right", "hip.left", "hip.right", "knee.left", "knee.right"]) {
2666
2669
  const h = n.points[a];
2667
2670
  h && e.guideEllipse(h.x, h.y, i, i, 0);
2668
2671
  }
2669
2672
  }
2670
- function mr(e, t, n, s, o, r) {
2673
+ function xr(e, t, n, s, o, r) {
2671
2674
  const l = n.lineWidth;
2672
2675
  if (o === "head") {
2673
2676
  const { head: f } = s, p = n.skin === "none" ? null : n.skin;
2674
- t.ellipse(f.center.x, f.center.y, f.rx, f.ry, f.angle, p, l), t.look !== "silhouette" && cr(t, f, r, l);
2677
+ t.ellipse(f.center.x, f.center.y, f.rx, f.ry, f.angle, p, l), t.look !== "silhouette" && Er(t, f, r, l);
2675
2678
  return;
2676
2679
  }
2677
2680
  const i = n.plan.chains.find((f) => f.id === o), a = s.chains[o], h = s.parts[o].points;
@@ -2682,39 +2685,39 @@ function mr(e, t, n, s, o, r) {
2682
2685
  return;
2683
2686
  }
2684
2687
  const c = (f, p) => [i.bones[f].width[0] * l, i.bones[p].width[1] * l];
2685
- if (Et(i)) {
2688
+ if (Tt(i)) {
2686
2689
  const [f, p] = c(0, 1);
2687
2690
  if (t.limb(h, f, p), i.bones.length >= 3)
2688
2691
  t.limb([a[2], a[3]], i.bones[2].width[0] * l, i.bones[2].width[1] * l);
2689
2692
  else if (n.hands === "cartoon" && o.startsWith("arm."))
2690
- wr(e, t, n, a, o.endsWith(".left") ? "left" : "right", r);
2693
+ Kr(e, t, n, a, o.endsWith(".left") ? "left" : "right", r);
2691
2694
  else {
2692
- const d = a[a.length - 1];
2693
- t.dot(d.x, d.y, l * 0.62);
2695
+ const g = a[a.length - 1];
2696
+ t.dot(g.x, g.y, l * 0.62);
2694
2697
  }
2695
2698
  return;
2696
2699
  }
2697
2700
  if (o === "spine") {
2698
2701
  const f = s.points["hip.left"], p = s.points["hip.right"];
2699
2702
  f && p && Math.hypot(f.x - p.x, f.y - p.y) > 0.5 && t.limb([f, p], l * 1.3, l * 1.3);
2700
- const [d, m] = c(0, i.bones.length - 1);
2701
- t.limb(h, d, m);
2702
- const b = s.points["shoulder.left"], y = s.points["shoulder.right"];
2703
- b && y && Math.hypot(b.x - y.x, b.y - y.y) > 0.5 && t.limb(ke(b, a[a.length - 1], y, 1, 10), l * 1.15, l * 1.15);
2703
+ const [g, m] = c(0, i.bones.length - 1);
2704
+ t.limb(h, g, m);
2705
+ const b = s.points["shoulder.left"], S = s.points["shoulder.right"];
2706
+ b && S && Math.hypot(b.x - S.x, b.y - S.y) > 0.5 && t.limb(He(b, a[a.length - 1], S, 1, 10), l * 1.15, l * 1.15);
2704
2707
  return;
2705
2708
  }
2706
- const [u, g] = c(0, i.bones.length - 1);
2707
- t.limb(h, u, g);
2709
+ const [u, d] = c(0, i.bones.length - 1);
2710
+ t.limb(h, u, d);
2708
2711
  }
2709
- function br(e, t) {
2712
+ function Pr(e, t) {
2710
2713
  const n = `hand.${t}.`, s = {};
2711
2714
  for (const [l, i] of Object.entries(e)) l.startsWith(n) && (s[l.slice(n.length)] = i);
2712
2715
  const o = e.turn ?? 0, r = t === "right" ? 1 - o : 1 + o;
2713
- return { ...L, ...s, turn: r + (s.turn ?? 0) };
2716
+ return { ...Y, ...s, turn: r + (s.turn ?? 0) };
2714
2717
  }
2715
- function wr(e, t, n, s, o, r) {
2718
+ function Kr(e, t, n, s, o, r) {
2716
2719
  const l = s[s.length - 1], i = s[s.length - 2], a = Math.atan2(l.x - i.x, -(l.y - i.y)) * 180 / Math.PI;
2717
- Tt(e, l, br(r, o), {
2720
+ Kt(e, l, Pr(r, o), {
2718
2721
  size: n.handSize * n.height,
2719
2722
  side: o,
2720
2723
  angle: a,
@@ -2727,24 +2730,24 @@ function wr(e, t, n, s, o, r) {
2727
2730
  lineWidth: n.lineWidth * 0.3
2728
2731
  });
2729
2732
  }
2730
- function yr(e, t, n, s = 0) {
2731
- const o = t.plan.id === "human" ? { ...X, ...n } : n;
2732
- Xn(e, t, o, _t(t, o), s);
2733
+ function Wr(e, t, n, s = 0) {
2734
+ const o = t.plan.id === "human" ? { ...C, ...n } : n;
2735
+ Zn(e, t, o, Rt(t, o), s);
2733
2736
  }
2734
- function Dn(e, t) {
2737
+ function Jn(e, t) {
2735
2738
  const n = t / e.height;
2736
2739
  return { ...e, height: t, lineWidth: e.lineWidth * n };
2737
2740
  }
2738
- function Pi(e, t, n, s) {
2739
- const o = e.plan.id === "human" ? { ...X, ...t } : t, r = Yn(e.plan, o, { height: s.height, contact: e.contact }, n);
2740
- return $t(Dn(e, r.height), o, r).joints;
2741
+ function Di(e, t, n, s) {
2742
+ const o = e.plan.id === "human" ? { ...C, ...t } : t, r = Vn(e.plan, o, { height: s.height, contact: e.contact }, n);
2743
+ return Nt(Jn(e, r.height), o, r).joints;
2741
2744
  }
2742
- function kr(e, t, n, s, o) {
2743
- const r = t.plan.id === "human" ? { ...X, ...n } : n, l = Yn(t.plan, r, { height: o.height, contact: t.contact }, s), i = Dn(t, l.height);
2744
- Xn(e, i, r, $t(i, r, l), o.time ?? 0);
2745
+ function Or(e, t, n, s, o) {
2746
+ const r = t.plan.id === "human" ? { ...C, ...n } : n, l = Vn(t.plan, r, { height: o.height, contact: t.contact }, s), i = Jn(t, l.height);
2747
+ Zn(e, i, r, Nt(i, r, l), o.time ?? 0);
2745
2748
  }
2746
- function Xn(e, t, n, s, o) {
2747
- const { joints: r, order: l } = s, i = bn(e, {
2749
+ function Zn(e, t, n, s, o) {
2750
+ const { joints: r, order: l } = s, i = Tn(e, {
2748
2751
  look: t.look,
2749
2752
  ink: t.ink,
2750
2753
  lineWidth: t.lineWidth,
@@ -2754,14 +2757,14 @@ function Xn(e, t, n, s, o) {
2754
2757
  }), a = (h) => {
2755
2758
  h && (e.save(), h(e, r, i, o), e.restore());
2756
2759
  };
2757
- e.save(), e.lineCap = "round", e.lineJoin = "round", t.look === "pencil" && t.pencil.construction !== !1 && pr(i, t, r), a(t.layers.behind);
2760
+ e.save(), e.lineCap = "round", e.lineJoin = "round", t.look === "pencil" && t.pencil.construction !== !1 && Ar(i, t, r), a(t.layers.behind);
2758
2761
  for (const h of l) {
2759
2762
  const c = t.layers.parts?.[h];
2760
- a(c?.under), mr(e, i, t, r, h, n), a(c?.over);
2763
+ a(c?.under), xr(e, i, t, r, h, n), a(c?.over);
2761
2764
  }
2762
2765
  a(t.layers.front), e.restore();
2763
2766
  }
2764
- function Wi(e, t, n) {
2767
+ function Xi(e, t, n) {
2765
2768
  const s = { ...e };
2766
2769
  for (const [o, r] of Object.entries(t)) {
2767
2770
  const l = e[o] ?? r;
@@ -2769,19 +2772,19 @@ function Wi(e, t, n) {
2769
2772
  }
2770
2773
  return s;
2771
2774
  }
2772
- function Oi(e, t, n, s) {
2773
- const o = e.plan.id === "human" ? { ...X, ...t } : t;
2775
+ function qi(e, t, n, s) {
2776
+ const o = e.plan.id === "human" ? { ...C, ...t } : t;
2774
2777
  let r;
2775
2778
  if (Array.isArray(s))
2776
2779
  r = s;
2777
2780
  else {
2778
- const { skeleton: l } = _t(e, o), i = It(e.plan, { ...o, roll: 0 }, { height: e.height, contact: "none" }), a = (o.roll ?? 0) * Math.PI / 180, h = s.x - l.hip.x, c = s.y - l.hip.y, u = i.hip.x + h * Math.cos(-a) - c * Math.sin(-a), g = i.hip.y + h * Math.sin(-a) + c * Math.cos(-a), f = Math.PI / 2 * (o.turn ?? 0), p = s.depth ?? l.chains[n].depths[l.chains[n].depths.length - 1], d = Math.cos(f), m = Math.sin(f);
2779
- r = [u * d - p * m, -g, u * m + p * d];
2781
+ const { skeleton: l } = Rt(e, o), i = Ft(e.plan, { ...o, roll: 0 }, { height: e.height, contact: "none" }), a = (o.roll ?? 0) * Math.PI / 180, h = s.x - l.hip.x, c = s.y - l.hip.y, u = i.hip.x + h * Math.cos(-a) - c * Math.sin(-a), d = i.hip.y + h * Math.sin(-a) + c * Math.cos(-a), f = Math.PI / 2 * (o.turn ?? 0), p = s.depth ?? l.chains[n].depths[l.chains[n].depths.length - 1], g = Math.cos(f), m = Math.sin(f);
2782
+ r = [u * g - p * m, -d, u * m + p * g];
2780
2783
  }
2781
- return sr(e.plan, o, n, r, { height: e.height });
2784
+ return mr(e.plan, o, n, r, { height: e.height });
2782
2785
  }
2783
- function Ii(e) {
2784
- const { character: t } = e, n = t.height * 0.8, s = t.height, o = t.plan.id === "human" ? X : {};
2786
+ function Gi(e) {
2787
+ const { character: t } = e, n = t.height * 0.8, s = t.height, o = t.plan.id === "human" ? C : {};
2785
2788
  return {
2786
2789
  type: "custom",
2787
2790
  x: e.x - n / 2,
@@ -2791,11 +2794,11 @@ function Ii(e) {
2791
2794
  props: { ...o, ...e.pose },
2792
2795
  character: t,
2793
2796
  draw(r, l, i) {
2794
- r.translate(n / 2, s), yr(r, t, l.props, i);
2797
+ r.translate(n / 2, s), Wr(r, t, l.props, i);
2795
2798
  }
2796
2799
  };
2797
2800
  }
2798
- function Sr(e, t, n) {
2801
+ function Ir(e, t, n) {
2799
2802
  const s = (r) => ({ x: r.x + t, y: r.y + n }), o = (r) => Object.fromEntries(Object.entries(r).map(([l, i]) => [l, i.map(s)]));
2800
2803
  return {
2801
2804
  ...e,
@@ -2806,25 +2809,25 @@ function Sr(e, t, n) {
2806
2809
  groundY: e.groundY + n
2807
2810
  };
2808
2811
  }
2809
- function _i(e, t, n) {
2812
+ function Ui(e, t, n) {
2810
2813
  const s = e.character;
2811
2814
  if (!s) throw new Error("characterAt: the target was not made by characterTarget");
2812
2815
  const o = { ...e.props };
2813
2816
  let r = 0, l = 0;
2814
2817
  for (const [a, h] of t.state?.values.get(n) ?? [])
2815
2818
  typeof h == "number" && (a === "x" || a === "motionPathX" ? r = h : a === "y" || a === "motionPathY" ? l = h : a in o && (o[a] = h));
2816
- const i = gr(s, o);
2817
- return { pose: o, joints: Sr(i, e.x + r + e.width / 2, e.y + l + e.height) };
2819
+ const i = Tr(s, o);
2820
+ return { pose: o, joints: Ir(i, e.x + r + e.width / 2, e.y + l + e.height) };
2818
2821
  }
2819
- function qn(e, t = X) {
2822
+ function Qn(e, t = C) {
2820
2823
  const n = [];
2821
2824
  return e.forEach((s, o) => {
2822
- const r = o === 0 ? t : n[o - 1], l = typeof s.pose == "string" ? Qs[s.pose] : void 0;
2825
+ const r = o === 0 ? t : n[o - 1], l = typeof s.pose == "string" ? cr[s.pose] : void 0;
2823
2826
  n.push(l ? { ...l, turn: r.turn ?? 0 } : { ...r, ...s.pose });
2824
2827
  }), n;
2825
2828
  }
2826
- function $i(e, t, n = X) {
2827
- const s = qn(t, n);
2829
+ function zi(e, t, n = C) {
2830
+ const s = Qn(t, n);
2828
2831
  return Object.keys(n).filter((r) => s.some((l) => (l[r] ?? n[r]) !== n[r])).map((r) => ({
2829
2832
  id: `${e}-${r}`,
2830
2833
  target: e,
@@ -2836,7 +2839,7 @@ function $i(e, t, n = X) {
2836
2839
  }))
2837
2840
  }));
2838
2841
  }
2839
- const Er = /* @__PURE__ */ new Set([
2842
+ const _r = /* @__PURE__ */ new Set([
2840
2843
  "x",
2841
2844
  "y",
2842
2845
  "z",
@@ -2852,43 +2855,43 @@ const Er = /* @__PURE__ */ new Set([
2852
2855
  "visible",
2853
2856
  "opacity",
2854
2857
  "color"
2855
- ]), Mr = 1.7;
2856
- function Hr(e, t, n) {
2858
+ ]), $r = 1.7;
2859
+ function Br(e, t, n) {
2857
2860
  const s = Array.from({ length: 24 }, (o, r) => {
2858
2861
  const l = r / 24 * Math.PI * 2, i = t.toView([Math.cos(l) * n, 0, Math.sin(l) * n * 0.8]);
2859
2862
  return i[2] < -1e-3 ? t.toScreen(i) : null;
2860
2863
  });
2861
2864
  s.some((o) => o === null) || (e.beginPath(), s.forEach((o, r) => r === 0 ? e.moveTo(o.x, o.y) : e.lineTo(o.x, o.y)), e.closePath(), e.fillStyle = "rgba(0, 0, 0, 0.22)", e.fill());
2862
2865
  }
2863
- function vr(e) {
2864
- const t = J.dot([0, 1, 0], e);
2865
- if (t > 0.999999) return D.identity();
2866
- if (t < -0.999999) return D.fromQuat(Ft.fromAxisAngle([1, 0, 0], 180));
2867
- const n = J.cross([0, 1, 0], e);
2868
- return D.fromQuat(Ft.fromAxisAngle(n, Math.acos(t) * 180 / Math.PI));
2869
- }
2870
- function Tr(e, t, n, s, o) {
2871
- const r = e.solid ?? {}, l = r.outline === !1 ? void 0 : r.outline ?? { width: 2, color: "#0f172a" }, i = { color: r.color ?? "#475569", shading: r.shading ?? "toon", outline: l }, a = { color: r.skin ?? "#f2c49b", shading: r.shading ?? "toon", outline: l }, h = { color: "#0f172a", shading: "unlit" }, c = s.height * 0.034, u = [], g = (E, H, M) => u.push({ mesh: E, world: D.multiply(o, H), material: M }), f = (E, H, M) => g(t.sphere, D.compose(E, [0, 0, 0, 1], [H, H, H]), M);
2872
- for (const E of n.chains) {
2873
- const H = s.chains[E.id], M = E.id === "spine" ? 1.9 : 1;
2874
- E.bones.forEach((A, w) => {
2875
- const S = H[w], k = H[w + 1], x = J.distance(S, k), [v, T] = A.width ?? [1, 1], K = c * M * (v + T) / 2;
2876
- if (x > 1e-6) {
2877
- const P = J.lerp(S, k, 0.5), I = vr(J.normalize(J.subtract(k, S)));
2878
- g(t.cylinder, D.multiply(D.translation(P), D.multiply(I, D.scaling([K, x, K]))), i);
2866
+ function Fr(e) {
2867
+ const t = Q.dot([0, 1, 0], e);
2868
+ if (t > 0.999999) return U.identity();
2869
+ if (t < -0.999999) return U.fromQuat(Yt.fromAxisAngle([1, 0, 0], 180));
2870
+ const n = Q.cross([0, 1, 0], e);
2871
+ return U.fromQuat(Yt.fromAxisAngle(n, Math.acos(t) * 180 / Math.PI));
2872
+ }
2873
+ function Rr(e, t, n, s, o) {
2874
+ const r = e.solid ?? {}, l = r.outline === !1 ? void 0 : r.outline ?? { width: 2, color: "#0f172a" }, i = { color: r.color ?? "#475569", shading: r.shading ?? "toon", outline: l }, a = { color: r.skin ?? "#f2c49b", shading: r.shading ?? "toon", outline: l }, h = { color: "#0f172a", shading: "unlit" }, c = s.height * 0.034, u = [], d = (k, v, H) => u.push({ mesh: k, world: U.multiply(o, v), material: H }), f = (k, v, H) => d(t.sphere, U.compose(k, [0, 0, 0, 1], [v, v, v]), H);
2875
+ for (const k of n.chains) {
2876
+ const v = s.chains[k.id], H = k.id === "spine" ? 1.9 : 1;
2877
+ k.bones.forEach((T, M) => {
2878
+ const w = v[M], y = v[M + 1], A = Q.distance(w, y), [x, E] = T.width ?? [1, 1], P = c * H * (x + E) / 2;
2879
+ if (A > 1e-6) {
2880
+ const K = Q.lerp(w, y, 0.5), _ = Fr(Q.normalize(Q.subtract(y, w)));
2881
+ d(t.cylinder, U.multiply(U.translation(K), U.multiply(_, U.scaling([P, A, P]))), i);
2879
2882
  }
2880
- f(S, c * M * v, i), f(k, c * M * T, i);
2881
- }), E.id.startsWith("arm.") && f(H[H.length - 1], c * 1.5, a);
2883
+ f(w, c * H * x, i), f(y, c * H * E, i);
2884
+ }), k.id.startsWith("arm.") && f(v[v.length - 1], c * 1.5, a);
2882
2885
  }
2883
- const { center: p, rx: d, ry: m, axes: b } = s.head, y = [...b[0], 0, ...b[1], 0, ...b[2], 0, ...p, 1];
2884
- g(t.sphere, D.multiply(y, D.scaling([d, m, d])), a);
2885
- for (const E of [-1, 1]) {
2886
- const H = J.normalize([E * 0.36, 0.15, 0.92]), M = J.add(p, J.add(J.add(J.scale(b[0], H[0] * d * 1.04), J.scale(b[1], H[1] * m * 1.04)), J.scale(b[2], H[2] * d * 1.04))), A = [...b[0], 0, ...b[1], 0, ...b[2], 0, ...M, 1];
2887
- g(t.sphere, D.multiply(A, D.scaling([d * 0.11, m * 0.14, d * 0.03])), h);
2886
+ const { center: p, rx: g, ry: m, axes: b } = s.head, S = [...b[0], 0, ...b[1], 0, ...b[2], 0, ...p, 1];
2887
+ d(t.sphere, U.multiply(S, U.scaling([g, m, g])), a);
2888
+ for (const k of [-1, 1]) {
2889
+ const v = Q.normalize([k * 0.36, 0.15, 0.92]), H = Q.add(p, Q.add(Q.add(Q.scale(b[0], v[0] * g * 1.04), Q.scale(b[1], v[1] * m * 1.04)), Q.scale(b[2], v[2] * g * 1.04))), T = [...b[0], 0, ...b[1], 0, ...b[2], 0, ...H, 1];
2890
+ d(t.sphere, U.multiply(T, U.scaling([g * 0.11, m * 0.14, g * 0.03])), h);
2888
2891
  }
2889
2892
  return u;
2890
2893
  }
2891
- const Bi = {
2894
+ const Vi = {
2892
2895
  kind: "character",
2893
2896
  validate(e) {
2894
2897
  const t = e;
@@ -2896,39 +2899,39 @@ const Bi = {
2896
2899
  },
2897
2900
  prepare(e) {
2898
2901
  return {
2899
- who: fr({ ...e.character, height: 1 }),
2900
- cylinder: Rt(ro(1, 1, 16)),
2901
- sphere: Rt(so(1, 20))
2902
+ who: Mr({ ...e.character, height: 1 }),
2903
+ cylinder: Ct(go(1, 1, 16)),
2904
+ sphere: Ct(uo(1, 20))
2902
2905
  };
2903
2906
  },
2904
2907
  resolve({ object: e, prepared: t, values: n, world: s, camera: o, toScreen: r }) {
2905
- const l = e, i = t, a = i.who, h = { ...X, ...l.pose };
2908
+ const l = e, i = t, a = i.who, h = { ...C, ...l.pose };
2906
2909
  for (const [m, b] of n)
2907
- typeof b == "number" && !Er.has(m) && (h[m] = b);
2908
- const c = l.height ?? Mr, u = D.multiply(o.view, s), g = {
2909
- toView: (m) => D.transformPoint(u, m),
2910
+ typeof b == "number" && !_r.has(m) && (h[m] = b);
2911
+ const c = l.height ?? $r, u = U.multiply(o.view, s), d = {
2912
+ toView: (m) => U.transformPoint(u, m),
2910
2913
  toScreen: (m) => r(m)
2911
- }, p = -g.toView([0, c / 2, 0])[2];
2914
+ }, p = -d.toView([0, c / 2, 0])[2];
2912
2915
  if (p <= o.near) return null;
2913
- const d = l.shadow === !1 ? [] : [{ depth: p + c, draw: (m) => Hr(m, g, c * 0.18) }];
2916
+ const g = l.shadow === !1 ? [] : [{ depth: p + c, draw: (m) => Br(m, d, c * 0.18) }];
2914
2917
  if (l.look === "solid") {
2915
- const m = Nn(a.plan, h, { height: c, contact: a.contact });
2916
- return { meshes: Tr(l, i, a.plan, m, s), drawables: d };
2918
+ const m = zn(a.plan, h, { height: c, contact: a.contact });
2919
+ return { meshes: Rr(l, i, a.plan, m, s), drawables: g };
2917
2920
  }
2918
2921
  return {
2919
2922
  drawables: [
2920
- ...d,
2923
+ ...g,
2921
2924
  {
2922
2925
  depth: p,
2923
2926
  draw(m, b) {
2924
- m.lineCap = "round", m.lineJoin = "round", kr(m, a, h, g, { height: c, time: b.time });
2927
+ m.lineCap = "round", m.lineJoin = "round", Or(m, a, h, d, { height: c, time: b.time });
2925
2928
  }
2926
2929
  }
2927
2930
  ]
2928
2931
  };
2929
2932
  }
2930
2933
  };
2931
- function Ar(e, t, n = {}, s) {
2934
+ function Nr(e, t, n = {}, s) {
2932
2935
  const o = n.length ?? 240, r = 9, l = 28, i = o - 22;
2933
2936
  e.save(), e.translate(t.x, t.y), e.rotate((n.angle ?? -30) * Math.PI / 180), e.fillStyle = n.color ?? "#f4c542", e.fillRect(l, -r, i - l, 2 * r), e.fillStyle = "#e8b4a0", e.fillRect(i, -r, o - i, 2 * r), e.fillStyle = "#f1dcbf", e.beginPath(), e.moveTo(0, 0), e.lineTo(l, -r), e.lineTo(l, r), e.closePath(), e.fill(), e.fillStyle = n.outline ?? "#2f2f33", e.beginPath(), e.moveTo(0, 0), e.lineTo(l * 0.35, -r * 0.35), e.lineTo(l * 0.35, r * 0.35), e.closePath(), e.fill(), e.strokeStyle = n.outline ?? "#2f2f33", e.lineWidth = 3, e.lineJoin = "round", e.lineCap = "round";
2934
2937
  const a = [
@@ -2936,10 +2939,10 @@ function Ar(e, t, n = {}, s) {
2936
2939
  [{ x: l, y: -r }, { x: l, y: r }],
2937
2940
  [{ x: i, y: -r }, { x: i, y: r }]
2938
2941
  ];
2939
- for (const h of a) Vn(e, h, s);
2942
+ for (const h of a) oo(e, h, s);
2940
2943
  e.restore();
2941
2944
  }
2942
- function Gn(e, t, n = {}, s) {
2945
+ function eo(e, t, n = {}, s) {
2943
2946
  const o = n.length ?? 90, r = n.thickness ?? 34;
2944
2947
  e.save(), e.translate(t.x, t.y), e.rotate((n.angle ?? -35) * Math.PI / 180);
2945
2948
  const l = -r / 2;
@@ -2961,69 +2964,69 @@ function Gn(e, t, n = {}, s) {
2961
2964
  }
2962
2965
  e.restore();
2963
2966
  }
2964
- const Un = 150, xr = { pencil: 44, eraser: 30 };
2965
- function zn(e, t, n = {}, s) {
2966
- const o = n.tool ?? "pencil", r = n.skin ?? "#f1c9a5", l = n.outline ?? "#2f2f33", i = n.scale ?? 1, a = Math.min(1, Math.max(0, n.lift ?? 0)), h = (n.angle ?? -30) * Math.PI / 180, c = s ? s.nudge(0.6) : { x: 0, y: 0 }, u = Un * i * (1 + 0.05 * a);
2967
+ const to = 150, Lr = { pencil: 44, eraser: 30 };
2968
+ function no(e, t, n = {}, s) {
2969
+ const o = n.tool ?? "pencil", r = n.skin ?? "#f1c9a5", l = n.outline ?? "#2f2f33", i = n.scale ?? 1, a = Math.min(1, Math.max(0, n.lift ?? 0)), h = (n.angle ?? -30) * Math.PI / 180, c = s ? s.nudge(0.6) : { x: 0, y: 0 }, u = to * i * (1 + 0.05 * a);
2967
2970
  a > 0 && (e.save(), e.fillStyle = l, e.globalAlpha = 0.15 * a, e.beginPath(), e.ellipse(t.x, t.y, 9 * i, 4 * i, 0, 0, Math.PI * 2), e.fill(), e.restore());
2968
- const g = { x: t.x + c.x + 6 * a * i, y: t.y + c.y - 18 * a * i }, f = C.pencilGrip, p = (w) => {
2969
- const S = w.fingers.thumb, k = w.fingers.index, x = w.fingers.middle, v = sn([S.points[3], k.points[3], x.points[3]]), T = sn([S.points[1], k.points[0]]), K = (S.depths[3] + k.depths[3] + x.depths[3]) / 3;
2970
- return { pinch: v, direction: Math.atan2(T.y - v.y, T.x - v.x), depth: K };
2971
- }, d = pt(f, { size: u }), m = h - p(d).direction, b = pt(f, { size: u, angle: m * 180 / Math.PI }), y = p(b), E = xr[o] * i, H = { x: y.pinch.x - Math.cos(h) * E, y: y.pinch.y - Math.sin(h) * E }, M = { x: g.x - H.x, y: g.y - H.y }, A = b.axes.up;
2972
- Kr(e, M, { x: -A.x, y: -A.y }, u, n.arm ?? 300 * i, r, n.sleeve ?? "#5b7db1", l), Tt(e, M, f, {
2971
+ const d = { x: t.x + c.x + 6 * a * i, y: t.y + c.y - 18 * a * i }, f = q.pencilGrip, p = (M) => {
2972
+ const w = M.fingers.thumb, y = M.fingers.index, A = M.fingers.middle, x = hn([w.points[3], y.points[3], A.points[3]]), E = hn([w.points[1], y.points[0]]), P = (w.depths[3] + y.depths[3] + A.depths[3]) / 3;
2973
+ return { pinch: x, direction: Math.atan2(E.y - x.y, E.x - x.x), depth: P };
2974
+ }, g = yt(f, { size: u }), m = h - p(g).direction, b = yt(f, { size: u, angle: m * 180 / Math.PI }), S = p(b), k = Lr[o] * i, v = { x: S.pinch.x - Math.cos(h) * k, y: S.pinch.y - Math.sin(h) * k }, H = { x: d.x - v.x, y: d.y - v.y }, T = b.axes.up;
2975
+ Yr(e, H, { x: -T.x, y: -T.y }, u, n.arm ?? 300 * i, r, n.sleeve ?? "#5b7db1", l), Kt(e, H, f, {
2973
2976
  size: u,
2974
2977
  angle: m * 180 / Math.PI,
2975
2978
  skin: r,
2976
2979
  ink: l,
2977
2980
  lineWidth: 3 * i,
2978
2981
  prop: {
2979
- depth: y.depth,
2982
+ depth: S.depth,
2980
2983
  draw: () => {
2981
- e.save(), e.translate(g.x, g.y), e.scale(i, i), o === "eraser" ? Gn(e, { x: 0, y: 0 }, { angle: h * 180 / Math.PI, outline: l }, s) : Ar(e, { x: 0, y: 0 }, { angle: h * 180 / Math.PI, length: 190, outline: l }, s), e.restore();
2984
+ e.save(), e.translate(d.x, d.y), e.scale(i, i), o === "eraser" ? eo(e, { x: 0, y: 0 }, { angle: h * 180 / Math.PI, outline: l }, s) : Nr(e, { x: 0, y: 0 }, { angle: h * 180 / Math.PI, length: 190, outline: l }, s), e.restore();
2982
2985
  }
2983
2986
  }
2984
2987
  });
2985
2988
  }
2986
- const sn = (e) => ({
2989
+ const hn = (e) => ({
2987
2990
  x: e.reduce((t, n) => t + n.x, 0) / e.length,
2988
2991
  y: e.reduce((t, n) => t + n.y, 0) / e.length
2989
2992
  });
2990
- function Kr(e, t, n, s, o, r, l, i) {
2991
- const a = { x: -n.y, y: n.x }, h = s * 0.15, c = (d, m, b) => ({
2992
- x: t.x + n.x * d + a.x * m * b,
2993
- y: t.y + n.y * d + a.y * m * b
2994
- }), u = c(o, 0, 0), g = (d) => {
2993
+ function Yr(e, t, n, s, o, r, l, i) {
2994
+ const a = { x: -n.y, y: n.x }, h = s * 0.15, c = (g, m, b) => ({
2995
+ x: t.x + n.x * g + a.x * m * b,
2996
+ y: t.y + n.y * g + a.y * m * b
2997
+ }), u = c(o, 0, 0), d = (g) => {
2995
2998
  const m = e.createLinearGradient(t.x, t.y, u.x, u.y);
2996
- return m.addColorStop(0, d), m.addColorStop(0.6, d), m.addColorStop(1, Pr(d)), m;
2999
+ return m.addColorStop(0, g), m.addColorStop(0.6, g), m.addColorStop(1, Cr(g)), m;
2997
3000
  }, f = Math.min(s * 0.55, o * 0.35);
2998
- e.save(), e.lineJoin = "round", e.lineCap = "round", e.lineWidth = 3 * (s / Un), e.beginPath(), e.moveTo(c(-s * 0.1, -1, h).x, c(-s * 0.1, -1, h).y), e.lineTo(c(f + 4, -1, h * 1.1).x, c(f + 4, -1, h * 1.1).y), e.lineTo(c(f + 4, 1, h * 1.1).x, c(f + 4, 1, h * 1.1).y), e.lineTo(c(-s * 0.1, 1, h).x, c(-s * 0.1, 1, h).y), e.closePath(), e.fillStyle = r, e.fill(), e.strokeStyle = i, e.beginPath(), e.moveTo(c(0, -1, h).x, c(0, -1, h).y), e.lineTo(c(f, -1, h * 1.1).x, c(f, -1, h * 1.1).y), e.moveTo(c(0, 1, h).x, c(0, 1, h).y), e.lineTo(c(f, 1, h * 1.1).x, c(f, 1, h * 1.1).y), e.stroke();
3001
+ e.save(), e.lineJoin = "round", e.lineCap = "round", e.lineWidth = 3 * (s / to), e.beginPath(), e.moveTo(c(-s * 0.1, -1, h).x, c(-s * 0.1, -1, h).y), e.lineTo(c(f + 4, -1, h * 1.1).x, c(f + 4, -1, h * 1.1).y), e.lineTo(c(f + 4, 1, h * 1.1).x, c(f + 4, 1, h * 1.1).y), e.lineTo(c(-s * 0.1, 1, h).x, c(-s * 0.1, 1, h).y), e.closePath(), e.fillStyle = r, e.fill(), e.strokeStyle = i, e.beginPath(), e.moveTo(c(0, -1, h).x, c(0, -1, h).y), e.lineTo(c(f, -1, h * 1.1).x, c(f, -1, h * 1.1).y), e.moveTo(c(0, 1, h).x, c(0, 1, h).y), e.lineTo(c(f, 1, h * 1.1).x, c(f, 1, h * 1.1).y), e.stroke();
2999
3002
  const p = [c(f, -1, h * 1.3), c(o, -1, h * 1.5), c(o, 1, h * 1.5), c(f, 1, h * 1.3)];
3000
- e.beginPath(), p.forEach((d, m) => m ? e.lineTo(d.x, d.y) : e.moveTo(d.x, d.y)), e.closePath(), e.fillStyle = g(l), e.fill(), e.strokeStyle = g(i), e.beginPath(), e.moveTo(p[1].x, p[1].y), e.lineTo(p[0].x, p[0].y), e.lineTo(p[3].x, p[3].y), e.lineTo(p[2].x, p[2].y), e.stroke(), e.restore();
3003
+ e.beginPath(), p.forEach((g, m) => m ? e.lineTo(g.x, g.y) : e.moveTo(g.x, g.y)), e.closePath(), e.fillStyle = d(l), e.fill(), e.strokeStyle = d(i), e.beginPath(), e.moveTo(p[1].x, p[1].y), e.lineTo(p[0].x, p[0].y), e.lineTo(p[3].x, p[3].y), e.lineTo(p[2].x, p[2].y), e.stroke(), e.restore();
3001
3004
  }
3002
- function Fi(e, t, n = {}) {
3003
- const s = n.offstage ?? { x: 2e3, y: 1400 }, o = n.enter ?? 450, r = n.exit ?? 450, l = n.linger ?? 1500, i = [...e].filter((d) => d.path.length > 0).sort((d, m) => d.start - m.start), a = (d) => d.tool ?? "pencil", h = (d) => {
3004
- const m = Math.min(1, Math.max(0, d));
3005
+ function ji(e, t, n = {}) {
3006
+ const s = n.offstage ?? { x: 2e3, y: 1400 }, o = n.enter ?? 450, r = n.exit ?? 450, l = n.linger ?? 1500, i = [...e].filter((g) => g.path.length > 0).sort((g, m) => g.start - m.start), a = (g) => g.tool ?? "pencil", h = (g) => {
3007
+ const m = Math.min(1, Math.max(0, g));
3005
3008
  return m * m * (3 - 2 * m);
3006
- }, c = (d, m, b) => ({ x: d.x + (m.x - d.x) * b, y: d.y + (m.y - d.y) * b }), u = i.find((d) => t >= d.start && t <= d.end);
3009
+ }, c = (g, m, b) => ({ x: g.x + (m.x - g.x) * b, y: g.y + (m.y - g.y) * b }), u = i.find((g) => t >= g.start && t <= g.end);
3007
3010
  if (u) {
3008
- const d = u.end - u.start, m = d > 0 ? (t - u.start) / d : 1;
3009
- return { at: Ht(u.path, m), tool: a(u), lift: 0, drawing: !0 };
3011
+ const g = u.end - u.start, m = g > 0 ? (t - u.start) / g : 1;
3012
+ return { at: xt(u.path, m), tool: a(u), lift: 0, drawing: !0 };
3010
3013
  }
3011
- const g = [...i].reverse().find((d) => d.end < t), f = i.find((d) => d.start > t), p = (d) => d.path[d.path.length - 1];
3012
- if (g && f && f.start - g.end <= l) {
3013
- const d = (t - g.end) / (f.start - g.end), m = d < 0.5 ? a(g) : a(f);
3014
- return { at: c(p(g), f.path[0], h(d)), tool: m, lift: Math.sin(Math.PI * d), drawing: !1 };
3014
+ const d = [...i].reverse().find((g) => g.end < t), f = i.find((g) => g.start > t), p = (g) => g.path[g.path.length - 1];
3015
+ if (d && f && f.start - d.end <= l) {
3016
+ const g = (t - d.end) / (f.start - d.end), m = g < 0.5 ? a(d) : a(f);
3017
+ return { at: c(p(d), f.path[0], h(g)), tool: m, lift: Math.sin(Math.PI * g), drawing: !1 };
3015
3018
  }
3016
3019
  if (f && f.start - t <= o) {
3017
- const d = 1 - (f.start - t) / o;
3018
- return { at: c(s, f.path[0], h(d)), tool: a(f), lift: 1 - h(d), drawing: !1 };
3020
+ const g = 1 - (f.start - t) / o;
3021
+ return { at: c(s, f.path[0], h(g)), tool: a(f), lift: 1 - h(g), drawing: !1 };
3019
3022
  }
3020
- if (g && t - g.end <= r) {
3021
- const d = (t - g.end) / r;
3022
- return { at: c(p(g), s, h(d)), tool: a(g), lift: h(d), drawing: !1 };
3023
+ if (d && t - d.end <= r) {
3024
+ const g = (t - d.end) / r;
3025
+ return { at: c(p(d), s, h(g)), tool: a(d), lift: h(g), drawing: !1 };
3023
3026
  }
3024
3027
  return null;
3025
3028
  }
3026
- function Ri(e, t, n, s = 0.08, o = 32) {
3029
+ function Ji(e, t, n, s = 0.08, o = 32) {
3027
3030
  const r = Math.PI * 2 * (1 + s), l = [];
3028
3031
  for (let i = 0; i <= o; i++) {
3029
3032
  const a = -Math.PI / 2 + r * i / o;
@@ -3031,7 +3034,7 @@ function Ri(e, t, n, s = 0.08, o = 32) {
3031
3034
  }
3032
3035
  return l;
3033
3036
  }
3034
- function Li(e) {
3037
+ function Zi(e) {
3035
3038
  const { path: t } = e, n = t.map((i) => i.x), s = t.map((i) => i.y), o = Math.min(...n), r = Math.min(...s), l = e.hand === !1 ? void 0 : e.hand === !0 || e.hand === void 0 ? {} : e.hand;
3036
3039
  return {
3037
3040
  type: "custom",
@@ -3043,18 +3046,18 @@ function Li(e) {
3043
3046
  draw(i, a, h) {
3044
3047
  const c = Math.min(1, Math.max(0, Number(a.props?.draw ?? 0)));
3045
3048
  i.translate(-o, -r), i.strokeStyle = e.color ?? "#2f2f33", i.lineWidth = e.lineWidth ?? 5, i.lineCap = "round", i.lineJoin = "round";
3046
- const u = e.sketch ? ut(i, e.sketch, h) : void 0;
3047
- c > 0 && (u ? e.smooth ? u.curve(t, c) : u.line(t, c) : Vn(i, mn(t, c))), l && c > 0 && c < 1 && zn(i, Ht(t, c), l, u);
3049
+ const u = e.sketch ? mt(i, e.sketch, h) : void 0;
3050
+ c > 0 && (u ? e.smooth ? u.curve(t, c) : u.line(t, c) : oo(i, vn(t, c))), l && c > 0 && c < 1 && no(i, xt(t, c), l, u);
3048
3051
  }
3049
3052
  };
3050
3053
  }
3051
- function Pr(e) {
3054
+ function Cr(e) {
3052
3055
  const t = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
3053
3056
  if (!t) return "rgba(0, 0, 0, 0)";
3054
3057
  const n = t[1].length === 3 ? [...t[1]].map((l) => l + l).join("") : t[1], [s, o, r] = [0, 2, 4].map((l) => parseInt(n.slice(l, l + 2), 16));
3055
3058
  return `rgba(${s}, ${o}, ${r}, 0)`;
3056
3059
  }
3057
- function Vn(e, t, n) {
3060
+ function oo(e, t, n) {
3058
3061
  if (!(t.length < 2)) {
3059
3062
  if (n) return n.line(t);
3060
3063
  e.beginPath(), e.moveTo(t[0].x, t[0].y);
@@ -3062,17 +3065,17 @@ function Vn(e, t, n) {
3062
3065
  e.stroke();
3063
3066
  }
3064
3067
  }
3065
- const Re = 1e5;
3066
- function Ni(e, t, n, s, o = 6) {
3068
+ const Ce = 1e5;
3069
+ function Qi(e, t, n, s, o = 6) {
3067
3070
  const r = [], l = Math.max(1, Math.round(o));
3068
3071
  for (let i = 0; i <= l; i++)
3069
3072
  r.push({ x: i % 2 === 0 ? e : e + n, y: t + s * i / l });
3070
3073
  return r;
3071
3074
  }
3072
- function jn(e, t, n, s) {
3075
+ function so(e, t, n, s) {
3073
3076
  if (s <= 0 || t.length === 0) return;
3074
- const o = mn(t, s), r = n / 2, l = (i) => {
3075
- e.beginPath(), e.rect(-Re, -Re, 2 * Re, 2 * Re), i(), e.clip("evenodd");
3077
+ const o = vn(t, s), r = n / 2, l = (i) => {
3078
+ e.beginPath(), e.rect(-Ce, -Ce, 2 * Ce, 2 * Ce), i(), e.clip("evenodd");
3076
3079
  };
3077
3080
  for (const i of o)
3078
3081
  l(() => {
@@ -3081,41 +3084,141 @@ function jn(e, t, n, s) {
3081
3084
  for (let i = 1; i < o.length; i++) {
3082
3085
  const a = o[i - 1], h = o[i], c = Math.hypot(h.x - a.x, h.y - a.y);
3083
3086
  if (c === 0) continue;
3084
- const u = -(h.y - a.y) / c * r, g = (h.x - a.x) / c * r;
3087
+ const u = -(h.y - a.y) / c * r, d = (h.x - a.x) / c * r;
3085
3088
  l(() => {
3086
- e.moveTo(a.x + u, a.y + g), e.lineTo(h.x + u, h.y + g), e.lineTo(h.x - u, h.y - g), e.lineTo(a.x - u, a.y - g), e.closePath();
3089
+ e.moveTo(a.x + u, a.y + d), e.lineTo(h.x + u, h.y + d), e.lineTo(h.x - u, h.y - d), e.lineTo(a.x - u, a.y - d), e.closePath();
3087
3090
  });
3088
3091
  }
3089
3092
  }
3090
- function Yi(e, t, n, s, o) {
3091
- e.save(), jn(e, t, n, s), o(), e.restore();
3093
+ function el(e, t, n, s, o) {
3094
+ e.save(), so(e, t, n, s), o(), e.restore();
3092
3095
  }
3093
- function Ci(e, t) {
3096
+ function tl(e, t) {
3094
3097
  const n = t.width ?? 40, s = t.hand === !0 ? {} : t.hand || void 0, o = t.eraser === !1 ? void 0 : t.eraser === !0 || t.eraser === void 0 ? {} : t.eraser;
3095
3098
  return {
3096
3099
  ...e,
3097
3100
  props: { ...e.props, erase: 0 },
3098
3101
  draw(r, l, i) {
3099
3102
  const a = Number(l.props?.erase ?? 0);
3100
- if (r.save(), jn(r, t.path, n, a), e.draw(r, l, i), r.restore(), !o || a <= 0 || a >= 1) return;
3101
- const h = Ht(t.path, a);
3102
- s ? zn(r, h, { ...s, tool: "eraser" }) : Gn(r, h, o);
3103
+ if (r.save(), so(r, t.path, n, a), e.draw(r, l, i), r.restore(), !o || a <= 0 || a >= 1) return;
3104
+ const h = xt(t.path, a);
3105
+ s ? no(r, h, { ...s, tool: "eraser" }) : eo(r, h, o);
3103
3106
  }
3104
3107
  };
3105
3108
  }
3106
- const Wr = (e, t, n) => e.slice(Math.floor((e.length - 1) * t), Math.ceil((e.length - 1) * n) + 1);
3107
- function Di(e = {}) {
3109
+ const cn = 40, Dr = 0.215 + 0.205, Z = (e, t) => {
3110
+ const n = {};
3111
+ for (const s of ["left", "right"]) for (const [o, r] of Object.entries(t)) n[`${e}.${s}.${o}`] = r;
3112
+ return n;
3113
+ }, O = (e, t) => e[t] ?? C[t] ?? 0;
3114
+ function nl(e, t, n = C, s = 1) {
3115
+ const o = ot(e), r = t * Math.PI * 2, l = Math.sin(r) * s, i = Math.cos(r) * s, a = (1 + Math.cos(r * 2 * (o.bounces ?? 1))) / 2, h = o.crouch ?? 0, c = o.shoulder ?? 0, u = o.forearm ?? 0, d = { ...C, ...n };
3116
+ d["leg.left.swing"] = o.swing * l + h * 0.6, d["leg.right.swing"] = -o.swing * l + h * 0.6, d["leg.left.knee"] = o.knee * Math.max(0, i) + h * 1.2, d["leg.right.knee"] = o.knee * Math.max(0, -i) + h * 1.2, d["leg.left.ankle"] = O(n, "leg.left.ankle") - (o.tiptoe ?? 0), d["leg.right.ankle"] = O(n, "leg.right.ankle") - (o.tiptoe ?? 0);
3117
+ for (const [f, p] of [["left", -1], ["right", 1]])
3118
+ O(n, `arm.${f}.spread`) > cn || O(n, `arm.${f}.swing`) > cn || (d[`arm.${f}.swing`] = c + p * o.arm * l, d[`arm.${f}.elbow`] = O(n, `arm.${f}.elbow`) + u + o.elbow * Math.max(0, p * l));
3119
+ return d.lean = O(n, "lean") + o.lean * s, d.bend = O(n, "bend") + (o.bend ?? 0), d["head.nod"] = O(n, "head.nod") - o.lean * 0.5 * s + (o.headTilt ?? 0), d.side = O(n, "side") + (o.sway ?? 0) * Math.sin(r), d.lift = O(n, "lift") + (o.bounce ?? 0) * s * a, d.stretch = O(n, "stretch") * (1 + (o.squash ?? 0) * (a - 0.5)), d;
3120
+ }
3121
+ function ol(e, t, n = 1) {
3122
+ const s = ot(e);
3123
+ return 4 * Dr * t * Math.sin(s.swing * n * Math.PI / 180);
3124
+ }
3125
+ const ye = (e) => dr[e], Xr = {
3126
+ /** Squash down in a squint, shoot up stretched with arms flung up, hang, land squashed, end surprised. */
3127
+ take: (e) => [
3128
+ { after: 140, pose: { stretch: 0.8, bend: 10, lean: O(e, "lean") - 4, ...Z("arm", { spread: 6, swing: 0, elbow: 10 }), "eye.left": 0.35, "eye.right": 0.35, "brow.left": -0.6, "brow.right": -0.6, mouth: 0 }, easing: "ease-in-out" },
3129
+ { after: 260, pose: { stretch: 0.78 } },
3130
+ { after: 360, pose: { lift: 0.22, stretch: 1.35, bend: -14, ...Z("arm", { spread: 150, bend: 35, swing: 0, elbow: 0 }), ...Z("leg", { swing: 25, knee: 60 }), ...ye("shocked") }, easing: "ease-out-cubic" },
3131
+ { after: 720, pose: { lift: 0.25, stretch: 1.25, bend: -10, ...Z("arm", { spread: 140 }) }, easing: "ease-in-out" },
3132
+ { after: 900, pose: { lift: 0, stretch: 0.74, bend: 12, ...Z("arm", { spread: 70, bend: 0 }), ...Z("leg", { swing: 30, knee: 60 }) }, easing: "ease-in-quad" },
3133
+ {
3134
+ after: 1060,
3135
+ pose: {
3136
+ stretch: 1.06,
3137
+ bend: -3,
3138
+ ...Z("arm", { spread: 60 }),
3139
+ "leg.left.swing": O(e, "leg.left.swing"),
3140
+ "leg.right.swing": O(e, "leg.right.swing"),
3141
+ "leg.left.knee": O(e, "leg.left.knee"),
3142
+ "leg.right.knee": O(e, "leg.right.knee")
3143
+ },
3144
+ easing: "ease-out"
3145
+ },
3146
+ { after: 1260, pose: { stretch: O(e, "stretch"), bend: O(e, "bend"), ...ye("surprised"), ...Z("arm", { spread: 55, bend: 60 }) }, easing: "ease-in-out" }
3147
+ ],
3148
+ /** Glance ahead, look away unbothered, then snap back in shock with a little hop. */
3149
+ doubleTake: (e) => [
3150
+ { after: 160, pose: { lookX: 1, lookY: 0, "head.turn": 0 }, easing: "ease-out" },
3151
+ { after: 520, pose: { lookX: -0.6, "head.turn": 30, "head.nod": O(e, "head.nod") - 4, smile: 0.6, mouth: 0 }, easing: "ease-in-out" },
3152
+ { after: 1100, pose: { lookX: -0.6 } },
3153
+ { after: 1180, pose: { "head.turn": 0, "head.nod": O(e, "head.nod") - 10, bend: O(e, "bend") - 10, lift: 0.05, stretch: 1.18, ...ye("shocked"), lookX: 1, lookY: 0 }, easing: "ease-out-cubic" },
3154
+ { after: 1360, pose: { lift: 0, stretch: 0.88, "head.nod": O(e, "head.nod") - 4, bend: O(e, "bend") + 4 }, easing: "ease-in-quad" },
3155
+ { after: 1560, pose: { stretch: O(e, "stretch"), "head.nod": O(e, "head.nod"), bend: O(e, "bend") }, easing: { type: "elastic", mode: "out", amplitude: 1, period: 0.35 } }
3156
+ ],
3157
+ /** Rear back for a zip-off: lean back, a knee up, arms cocked; hold; pitch forward ready to run. */
3158
+ windUp: () => [
3159
+ {
3160
+ after: 220,
3161
+ pose: {
3162
+ lean: -18,
3163
+ bend: -16,
3164
+ "head.nod": -6,
3165
+ "arm.left.swing": 60,
3166
+ "arm.left.elbow": 100,
3167
+ "arm.right.swing": -40,
3168
+ "arm.right.elbow": 90,
3169
+ "leg.left.swing": 55,
3170
+ "leg.left.knee": 95,
3171
+ stretch: 0.92,
3172
+ ...ye("angry"),
3173
+ lookX: 1
3174
+ },
3175
+ easing: "ease-out"
3176
+ },
3177
+ { after: 620, pose: { lean: -20, bend: -18, stretch: 0.9 } },
3178
+ { after: 700, pose: { lean: 28, bend: 14, "head.nod": 6, "arm.left.swing": -30, "arm.right.swing": 60, "leg.left.swing": -20, "leg.left.knee": 30, "leg.right.swing": 20, stretch: 1.12 }, easing: "ease-out-cubic" }
3179
+ ],
3180
+ /** Coming down: stretched in the fall, squashed on contact, a spring back up. */
3181
+ land: (e) => [
3182
+ { after: 120, pose: { lift: 0, stretch: 0.7, bend: 14, ...Z("arm", { spread: 75 }), ...Z("leg", { swing: 25, knee: 50 }) }, easing: "ease-in-quad" },
3183
+ { after: 300, pose: { stretch: 1.05, bend: -4, "arm.left.spread": O(e, "arm.left.spread"), "arm.right.spread": O(e, "arm.right.spread") }, easing: "ease-out" },
3184
+ { after: 460, pose: { lift: 0, stretch: O(e, "stretch"), bend: O(e, "bend"), ...Z("leg", { swing: 0, knee: 0 }) }, easing: "ease-in-out" }
3185
+ ],
3186
+ /** A frightened shiver: paws up, fast small shakes side to side, then still. */
3187
+ tremble: (e) => {
3188
+ const t = [{ after: 80, pose: { ...ye("scared"), ...Z("arm", { swing: 40, elbow: 110, spread: 14 }), stretch: 0.94, bend: O(e, "bend") + 8 }, easing: "ease-out" }];
3189
+ for (let n = 1; n <= 14; n++) {
3190
+ const s = n % 2 === 0 ? 1 : -1;
3191
+ t.push({ after: 80 + n * 45, pose: { side: O(e, "side") + 2.5 * s, "head.tilt": O(e, "head.tilt") - 2 * s } });
3192
+ }
3193
+ return t.push({ after: 755, pose: { side: O(e, "side"), "head.tilt": O(e, "head.tilt"), bend: O(e, "bend") } }), t;
3194
+ },
3195
+ /** A sigh: the body sags, the back curls, the head and arms drop. */
3196
+ deflate: (e) => [
3197
+ { after: 260, pose: { stretch: 1.04, "head.nod": O(e, "head.nod") - 4, "brow.left": 0.3, "brow.right": 0.3 }, easing: "ease-in-out" },
3198
+ { after: 900, pose: { ...ye("sad"), bend: 18, stretch: 0.92, lean: O(e, "lean") + 5, "head.nod": 14, ...Z("arm", { spread: 6, swing: 0, elbow: 4, bend: 0 }) }, easing: "ease-in-out" }
3199
+ ]
3200
+ };
3201
+ function sl(e, t) {
3202
+ const n = te(t.from ?? {}), s = t.speed ?? 1;
3203
+ let o = n;
3204
+ return [
3205
+ { time: t.at, pose: n },
3206
+ ...Xr[e](n).map((r) => (o = { ...o, ...r.pose }, { time: t.at + r.after * s, pose: o, act: !1, ...r.easing ? { easing: r.easing } : {} }))
3207
+ ];
3208
+ }
3209
+ const qr = (e, t, n) => e.slice(Math.floor((e.length - 1) * t), Math.ceil((e.length - 1) * n) + 1);
3210
+ function rl(e = {}) {
3108
3211
  const t = e.shirt ?? "#e2493b", n = e.trousers ?? "#24476b", s = (i) => i.lineWidth * 0.45, o = (i, a, h) => {
3109
3212
  const c = i.parts[`leg.${h}`].points;
3110
- a.shape(Ye(c, i.height * 0.08, i.height * 0.05), n, s(i));
3213
+ a.shape(qe(c, i.height * 0.08, i.height * 0.05), n, s(i));
3111
3214
  }, r = (i, a) => {
3112
- const h = i.chains.spine, c = h[0], u = h[h.length - 1], g = { x: c.x - (u.x - c.x) * 0.25, y: c.y - (u.y - c.y) * 0.25 };
3113
- a.shape(Ye([g, ...i.parts.spine.points], i.height * 0.15, i.height * 0.14), t, s(i));
3215
+ const h = i.chains.spine, c = h[0], u = h[h.length - 1], d = { x: c.x - (u.x - c.x) * 0.25, y: c.y - (u.y - c.y) * 0.25 };
3216
+ a.shape(qe([d, ...i.parts.spine.points], i.height * 0.15, i.height * 0.14), t, s(i));
3114
3217
  }, l = (i, a, h) => {
3115
- const c = i.parts[`arm.${h}`].points, u = c[0], g = i.chains.spine[i.chains.spine.length - 1], p = [{ x: u.x + (g.x - u.x) * 0.45, y: u.y + (g.y - u.y) * 0.45 }, ...Wr(c, 0, 0.45)], d = Ye(p, i.height * 0.085, i.height * 0.06), m = p.length, b = d.slice(0, m), y = d.slice(m).reverse();
3116
- a.shape(d, t, 0);
3117
- const E = (A) => Math.hypot(A[1].x - g.x, A[1].y - g.y), [H, M] = E(b) > E(y) ? [b, y] : [y, b];
3118
- a.line(H.slice(1), s(i)), a.line(M.slice(Math.ceil(m * 0.45)), s(i)), a.line([b[m - 1], y[m - 1]], s(i));
3218
+ const c = i.parts[`arm.${h}`].points, u = c[0], d = i.chains.spine[i.chains.spine.length - 1], p = [{ x: u.x + (d.x - u.x) * 0.45, y: u.y + (d.y - u.y) * 0.45 }, ...qr(c, 0, 0.45)], g = qe(p, i.height * 0.085, i.height * 0.06), m = p.length, b = g.slice(0, m), S = g.slice(m).reverse();
3219
+ a.shape(g, t, 0);
3220
+ const k = (T) => Math.hypot(T[1].x - d.x, T[1].y - d.y), [v, H] = k(b) > k(S) ? [b, S] : [S, b];
3221
+ a.line(v.slice(1), s(i)), a.line(H.slice(Math.ceil(m * 0.45)), s(i)), a.line([b[m - 1], S[m - 1]], s(i));
3119
3222
  };
3120
3223
  return {
3121
3224
  parts: {
@@ -3127,7 +3230,7 @@ function Di(e = {}) {
3127
3230
  }
3128
3231
  };
3129
3232
  }
3130
- const ht = {
3233
+ const dt = {
3131
3234
  full: {
3132
3235
  anticipation: 0.12,
3133
3236
  anticipationTime: 0.3,
@@ -3189,123 +3292,123 @@ const ht = {
3189
3292
  jumpSquash: 0
3190
3293
  }
3191
3294
  };
3192
- function Or(e) {
3193
- if (e === void 0) return ht.full;
3194
- if (typeof e == "string") return ht[e];
3295
+ function Gr(e) {
3296
+ if (e === void 0) return dt.full;
3297
+ if (typeof e == "string") return dt[e];
3195
3298
  const { base: t, ...n } = e;
3196
- return { ...ht[t ?? "full"], ...n };
3299
+ return { ...dt[t ?? "full"], ...n };
3197
3300
  }
3198
- const Mt = 160, Ir = 120, _r = 700, ct = 60, $r = 90, Le = 3200, ye = 1, ue = 1e-6;
3199
- function Jn(e, t, n = {}) {
3200
- const s = Or(n.style), o = n.seed ?? 1, r = {};
3301
+ const At = 160, Ur = 120, zr = 700, gt = 60, Vr = 90, De = 3200, Me = 1, ge = 1e-6;
3302
+ function ro(e, t, n = {}) {
3303
+ const s = Gr(n.style), o = n.seed ?? 1, r = {};
3201
3304
  if (e.length === 0) return r;
3202
- const l = Object.keys(e[0].pose).filter((u) => e.some((g) => Math.abs(g.pose[u] - e[0].pose[u]) > ue));
3203
- for (const u of l) r[u] = Br(u, e, t, s, o);
3305
+ const l = Object.keys(e[0].pose).filter((u) => e.some((d) => Math.abs(d.pose[u] - e[0].pose[u]) > ge));
3306
+ for (const u of l) r[u] = jr(u, e, t, s, o);
3204
3307
  const i = t.blink, a = i !== void 0 && l.includes(i);
3205
3308
  if (s.blinks && i !== void 0 && !a && i in e[0].pose) {
3206
- const u = Fr(e, t, s, o, e[0].pose[i]);
3309
+ const u = Jr(e, t, s, o, e[0].pose[i]);
3207
3310
  u.length > 0 && (r[i] = u);
3208
3311
  }
3209
3312
  const { lift: h, stretch: c } = t;
3210
3313
  if (s.jumpSquash > 0 && h && c && l.includes(h) && !l.includes(c) && c in e[0].pose) {
3211
- const u = Rr(e, h, e[0].pose[c], s.jumpSquash);
3314
+ const u = Zr(e, h, e[0].pose[c], s.jumpSquash);
3212
3315
  u.length > 0 && (r[c] = u);
3213
3316
  }
3214
3317
  return r;
3215
3318
  }
3216
- function Br(e, t, n, s, o) {
3319
+ function jr(e, t, n, s, o) {
3217
3320
  const r = n.eyes.includes(e), l = n.limits[e], i = l !== void 0, a = r ? -s.eyeLead : (n.depth[e] ?? 1) * s.overlap, h = (f) => {
3218
3321
  const p = (t[f].time - t[f - 1].time) / 2;
3219
3322
  return Math.max(-p, Math.min(p, a));
3220
- }, c = [{ time: t[0].time, value: t[0].pose[e] }], u = (f, p, d) => {
3323
+ }, c = [{ time: t[0].time, value: t[0].pose[e] }], u = (f, p, g) => {
3221
3324
  const m = c[c.length - 1];
3222
- if (f <= m.time + ye) {
3223
- c[c.length - 1] = { ...m, value: p, ...d ? { easing: d } : {} };
3325
+ if (f <= m.time + Me) {
3326
+ c[c.length - 1] = { ...m, value: p, ...g ? { easing: g } : {} };
3224
3327
  return;
3225
3328
  }
3226
- c.push({ time: f, value: p, ...d ? { easing: d } : {} });
3329
+ c.push({ time: f, value: p, ...g ? { easing: g } : {} });
3227
3330
  };
3228
- let g = t[0].pose[e];
3331
+ let d = t[0].pose[e];
3229
3332
  for (let f = 1; f < t.length; f++) {
3230
- const p = t[f], d = t[f - 1].pose[e], m = p.pose[e], b = m - d, y = c[c.length - 1].time, E = p.act !== !1;
3231
- if (Math.abs(b) <= ue) {
3232
- const v = p.time + (E ? h(f) : 0);
3333
+ const p = t[f], g = t[f - 1].pose[e], m = p.pose[e], b = m - g, S = c[c.length - 1].time, k = p.act !== !1;
3334
+ if (Math.abs(b) <= ge) {
3335
+ const x = p.time + (k ? h(f) : 0);
3233
3336
  if (f === t.length - 1)
3234
- Math.abs(g - m) > ue && u(Math.max(v, y + Mt), m, "ease-in-out"), g = m;
3235
- else if (E && i && s.drift > 0 && n.drift.includes(e) && v - y >= _r) {
3236
- const T = Ze(`${o}:${e}:${f}`) % 2 === 0 ? 1 : -1;
3237
- g = m + T * s.drift * l, u(v, g, "ease-in-out");
3337
+ Math.abs(d - m) > ge && u(Math.max(x, S + At), m, "ease-in-out"), d = m;
3338
+ else if (k && i && s.drift > 0 && n.drift.includes(e) && x - S >= zr) {
3339
+ const E = tt(`${o}:${e}:${f}`) % 2 === 0 ? 1 : -1;
3340
+ d = m + E * s.drift * l, u(x, d, "ease-in-out");
3238
3341
  }
3239
3342
  continue;
3240
3343
  }
3241
- if (!E) {
3242
- u(t[f - 1].time, g), u(p.time, m, p.easing), g = m;
3344
+ if (!k) {
3345
+ u(t[f - 1].time, d), u(p.time, m, p.easing), d = m;
3243
3346
  continue;
3244
3347
  }
3245
- const H = h(f), M = Math.max(t[f - 1].time + H, y);
3246
- let A = p.time + H;
3247
- r && s.eyeDart > 0 && (A = Math.min(A, M + s.eyeDart));
3248
- const w = A - M;
3249
- if (w <= ye) {
3250
- u(p.time, m, p.easing), g = m;
3348
+ const v = h(f), H = Math.max(t[f - 1].time + v, S);
3349
+ let T = p.time + v;
3350
+ r && s.eyeDart > 0 && (T = Math.min(T, H + s.eyeDart));
3351
+ const M = T - H;
3352
+ if (M <= Me) {
3353
+ u(p.time, m, p.easing), d = m;
3251
3354
  continue;
3252
3355
  }
3253
- u(M, g);
3254
- const S = Math.sign(b);
3255
- if (i && s.anticipation > 0 && l > 0 && w >= Mt) {
3256
- const v = g - S * Math.min(Math.abs(b) * s.anticipation, l), T = M + w * s.anticipationTime;
3257
- u(T, v, "ease-in-out"), s.hold > 0 && u(T + w * s.hold, v);
3356
+ u(H, d);
3357
+ const w = Math.sign(b);
3358
+ if (i && s.anticipation > 0 && l > 0 && M >= At) {
3359
+ const x = d - w * Math.min(Math.abs(b) * s.anticipation, l), E = H + M * s.anticipationTime;
3360
+ u(E, x, "ease-in-out"), s.hold > 0 && u(E + M * s.hold, x);
3258
3361
  }
3259
- const k = f + 1 < t.length ? t[f + 1].time - p.time : 1 / 0, x = Math.min(s.settle, k / 2);
3260
- if (i && s.overshoot > 0 && l > 0 && w >= Ir && x > ye) {
3261
- const v = Math.min(Math.abs(b) * s.overshoot, l);
3262
- u(A, m + S * v, p.easing ?? s.actionEase), u(A + x, m, s.settleEase);
3362
+ const y = f + 1 < t.length ? t[f + 1].time - p.time : 1 / 0, A = Math.min(s.settle, y / 2);
3363
+ if (i && s.overshoot > 0 && l > 0 && M >= Ur && A > Me) {
3364
+ const x = Math.min(Math.abs(b) * s.overshoot, l);
3365
+ u(T, m + w * x, p.easing ?? s.actionEase), u(T + A, m, s.settleEase);
3263
3366
  } else
3264
- u(A, m, p.easing ?? s.actionEase);
3265
- g = m;
3367
+ u(T, m, p.easing ?? s.actionEase);
3368
+ d = m;
3266
3369
  }
3267
3370
  return c;
3268
3371
  }
3269
- function Fr(e, t, n, s, o) {
3270
- const r = [], l = ct + $r;
3372
+ function Jr(e, t, n, s, o) {
3373
+ const r = [], l = gt + Vr;
3271
3374
  for (let f = 1; f < e.length; f++) {
3272
- const p = e[f - 1].pose, d = e[f].pose;
3273
- Object.entries(t.headTurns).some(([b, y]) => Math.abs((d[b] ?? 0) - (p[b] ?? 0)) > y) && e[f].act !== !1 && r.push(Math.max(e[0].time, e[f - 1].time - n.eyeLead));
3375
+ const p = e[f - 1].pose, g = e[f].pose;
3376
+ Object.entries(t.headTurns).some(([b, S]) => Math.abs((g[b] ?? 0) - (p[b] ?? 0)) > S) && e[f].act !== !1 && r.push(Math.max(e[0].time, e[f - 1].time - n.eyeLead));
3274
3377
  }
3275
3378
  const i = e[0].time, a = e[e.length - 1].time, h = [...r];
3276
- let c = i + Le * 0.6, u = 0;
3379
+ let c = i + De * 0.6, u = 0;
3277
3380
  for (; c < a; ) {
3278
- h.some((d) => Math.abs(d - c) < Le / 2) || r.push(c);
3279
- const p = (Ze(`${s}:blink:${u++}`) % 1e3 / 1e3 - 0.5) * (Le * 0.66);
3280
- c += Le + p;
3381
+ h.some((g) => Math.abs(g - c) < De / 2) || r.push(c);
3382
+ const p = (tt(`${s}:blink:${u++}`) % 1e3 / 1e3 - 0.5) * (De * 0.66);
3383
+ c += De + p;
3281
3384
  }
3282
3385
  r.sort((f, p) => f - p);
3283
- const g = [{ time: i, value: o }];
3386
+ const d = [{ time: i, value: o }];
3284
3387
  for (const f of r) {
3285
- const p = g[g.length - 1].time;
3286
- f + ct <= p + ye || (f > p + ye && g.push({ time: f, value: o }), g.push({ time: f + ct, value: 1, easing: "ease-in" }), g.push({ time: f + l, value: o, easing: "ease-out" }));
3388
+ const p = d[d.length - 1].time;
3389
+ f + gt <= p + Me || (f > p + Me && d.push({ time: f, value: o }), d.push({ time: f + gt, value: 1, easing: "ease-in" }), d.push({ time: f + l, value: o, easing: "ease-out" }));
3287
3390
  }
3288
- return g.length > 1 ? g : [];
3391
+ return d.length > 1 ? d : [];
3289
3392
  }
3290
- function Rr(e, t, n, s) {
3393
+ function Zr(e, t, n, s) {
3291
3394
  const o = n * (1 - 0.18 * s), r = n * (1 + 0.14 * s), l = [{ time: e[0].time, value: n }], i = (a, h, c) => {
3292
3395
  const u = l[l.length - 1];
3293
- a <= u.time + ye || l.push({ time: a, value: h, ...c ? { easing: c } : {} });
3396
+ a <= u.time + Me || l.push({ time: a, value: h, ...c ? { easing: c } : {} });
3294
3397
  };
3295
3398
  for (let a = 1; a < e.length; a++) {
3296
- const h = e[a - 1].pose[t], c = e[a].pose[t], u = e[a - 1].time, g = e[a].time, f = g - u;
3297
- if (!(f < Mt || e[a].act === !1)) {
3298
- if (h <= ue && c > ue)
3299
- i(u, n), i(u + f * 0.2, o, "ease-out"), i(u + f * 0.45, r, "ease-out"), i(g, n, "ease-in-out");
3300
- else if (h > ue && c <= ue) {
3301
- const p = a + 1 < e.length ? e[a + 1].time - g : 400;
3302
- i(u + f * 0.5, n), i(g - Math.min(60, f * 0.15), r, "ease-in"), i(g, o, "ease-out"), i(g + Math.min(260, p / 2), n, { type: "back", mode: "out", overshoot: 1.4 });
3399
+ const h = e[a - 1].pose[t], c = e[a].pose[t], u = e[a - 1].time, d = e[a].time, f = d - u;
3400
+ if (!(f < At || e[a].act === !1)) {
3401
+ if (h <= ge && c > ge)
3402
+ i(u, n), i(u + f * 0.2, o, "ease-out"), i(u + f * 0.45, r, "ease-out"), i(d, n, "ease-in-out");
3403
+ else if (h > ge && c <= ge) {
3404
+ const p = a + 1 < e.length ? e[a + 1].time - d : 400;
3405
+ i(u + f * 0.5, n), i(d - Math.min(60, f * 0.15), r, "ease-in"), i(d, o, "ease-out"), i(d + Math.min(260, p / 2), n, { type: "back", mode: "out", overshoot: 1.4 });
3303
3406
  }
3304
3407
  }
3305
3408
  }
3306
3409
  return l.length > 1 ? l : [];
3307
3410
  }
3308
- const Lr = {
3411
+ const Qr = {
3309
3412
  depth: {
3310
3413
  lean: 0,
3311
3414
  bend: 0,
@@ -3371,13 +3474,13 @@ const Lr = {
3371
3474
  lift: "rise",
3372
3475
  stretch: "stretch"
3373
3476
  };
3374
- function Nr(e) {
3375
- return /^(turn|lean|side|lift|roll|stretch)$/.test(e) ? { depth: 0, limit: { turn: 0.06, lean: 10, side: 8, lift: 0, roll: 25, stretch: 0.08 }[e] } : /^leg\.\w+\.(swing|spread|rotate)$/.test(e) ? { depth: 0, limit: 12 } : /^head\./.test(e) ? { depth: 1, limit: 12 } : /^arm\.\w+\.(swing|spread)$/.test(e) ? { depth: 1, limit: 20 } : /^leg\.\w+\.knee$/.test(e) ? { depth: 1, limit: 15 } : /^(brow\.|browTilt$)/.test(e) ? { depth: 1, limit: e === "browTilt" ? void 0 : 0.25 } : /^eye\./.test(e) ? { depth: 1, limit: 0.15 } : /^arm\.\w+\.(elbow|bend)$/.test(e) ? { depth: 2, limit: 18 } : /^leg\.\w+\.(ankle|toeOut)$/.test(e) ? { depth: 2, limit: 10 } : /^(mouth|smile|mouthWidth)$/.test(e) ? { depth: 2 } : /^hand\./.test(e) ? { depth: 3 } : { depth: 1 };
3477
+ function ei(e) {
3478
+ return /^(turn|lean|bend|side|lift|roll|stretch)$/.test(e) ? { depth: 0, limit: { turn: 0.06, lean: 10, bend: 10, side: 8, lift: 0, roll: 25, stretch: 0.08 }[e] } : /^leg\.\w+\.(swing|spread|rotate)$/.test(e) ? { depth: 0, limit: 12 } : /^head\./.test(e) ? { depth: 1, limit: 12 } : /^arm\.\w+\.(swing|spread)$/.test(e) ? { depth: 1, limit: 20 } : /^leg\.\w+\.knee$/.test(e) ? { depth: 1, limit: 15 } : /^(brow\.|browTilt$)/.test(e) ? { depth: 1, limit: e === "browTilt" ? void 0 : 0.25 } : /^eye\./.test(e) ? { depth: 1, limit: 0.15 } : /^arm\.\w+\.(elbow|bend)$/.test(e) ? { depth: 2, limit: 18 } : /^leg\.\w+\.(ankle|toeOut)$/.test(e) ? { depth: 2, limit: 10 } : /^(mouth|smile|mouthWidth)$/.test(e) ? { depth: 2 } : /^hand\./.test(e) ? { depth: 3 } : { depth: 1 };
3376
3479
  }
3377
- function Yr() {
3480
+ function ti() {
3378
3481
  const e = {}, t = {};
3379
- for (const n of Object.keys(X)) {
3380
- const s = Nr(n);
3482
+ for (const n of Object.keys(C)) {
3483
+ const s = ei(n);
3381
3484
  e[n] = s.depth, s.limit !== void 0 && (t[n] = s.limit);
3382
3485
  }
3383
3486
  return {
@@ -3386,46 +3489,46 @@ function Yr() {
3386
3489
  eyes: ["lookX", "lookY"],
3387
3490
  blink: "blink",
3388
3491
  headTurns: { turn: 0.15, "head.turn": 15, "head.nod": 12, lookX: 0.5, roll: 45 },
3389
- drift: ["lean", "head.tilt", "head.nod", "arm.left.spread", "arm.right.spread", "arm.left.elbow", "arm.right.elbow"],
3492
+ drift: ["lean", "bend", "head.tilt", "head.nod", "arm.left.spread", "arm.right.spread", "arm.left.elbow", "arm.right.elbow"],
3390
3493
  lift: "lift",
3391
3494
  stretch: "stretch"
3392
3495
  };
3393
3496
  }
3394
- const Cr = Yr();
3395
- function Zn(e, t) {
3497
+ const ni = ti();
3498
+ function io(e, t) {
3396
3499
  return Object.entries(t).map(([n, s]) => ({ id: `${e}-${n}`, target: e, property: n, keyframes: s }));
3397
3500
  }
3398
- function Dr(e, t, n = {}) {
3399
- const s = _n(t), o = t.map((r, l) => ({ time: r.time, pose: { ...s[l] }, easing: r.easing, act: r.act }));
3400
- return Zn(e, Jn(o, n.rig ?? Lr, n));
3501
+ function oi(e, t, n = {}) {
3502
+ const s = Cn(t), o = t.map((r, l) => ({ time: r.time, pose: { ...s[l] }, easing: r.easing, act: r.act }));
3503
+ return io(e, ro(o, n.rig ?? Qr, n));
3401
3504
  }
3402
- function Xi(e, t, n = {}) {
3403
- const s = n.rest ?? X, o = qn(t, s), r = t.map((l, i) => ({ time: l.time, pose: { ...s, ...o[i] }, easing: l.easing, act: l.act }));
3404
- return Zn(e, Jn(r, n.rig ?? Cr, n));
3505
+ function il(e, t, n = {}) {
3506
+ const s = n.rest ?? C, o = Qn(t, s), r = t.map((l, i) => ({ time: l.time, pose: { ...s, ...o[i] }, easing: l.easing, act: l.act }));
3507
+ return io(e, ro(r, n.rig ?? ni, n));
3405
3508
  }
3406
- const rn = Y.shocked, Xr = Y.scared, Bt = {
3509
+ const fn = X.shocked, si = X.scared, Lt = {
3407
3510
  /** The classic take: squash down in a squint, then shoot up stretched with eyes popping, hang, and land squashed. */
3408
3511
  take: (e) => [
3409
3512
  { after: 140, pose: { stretch: 0.8, bend: 10, lean: e.lean - 4, leftShoulder: 8, rightShoulder: 8, leftEye: 0.35, rightEye: 0.35, leftBrow: -0.6, rightBrow: -0.6, mouth: 0 }, easing: "ease-in-out" },
3410
3513
  { after: 260, pose: { stretch: 0.78 } },
3411
- { after: 360, pose: { rise: 0.22, stretch: 1.35, bend: -14, leftShoulder: 150, rightShoulder: 150, leftElbow: 35, rightElbow: 35, leftHip: 22, rightHip: 22, leftKnee: 45, rightKnee: 45, ...rn, headTilt: 0 }, easing: "ease-out-cubic" },
3514
+ { after: 360, pose: { rise: 0.22, stretch: 1.35, bend: -14, leftShoulder: 150, rightShoulder: 150, leftElbow: 35, rightElbow: 35, leftHip: 22, rightHip: 22, leftKnee: 45, rightKnee: 45, ...fn, headTilt: 0 }, easing: "ease-out-cubic" },
3412
3515
  { after: 720, pose: { rise: 0.25, stretch: 1.25, bend: -10, leftShoulder: 140, rightShoulder: 140 }, easing: "ease-in-out" },
3413
3516
  { after: 900, pose: { rise: 0, stretch: 0.74, bend: 12, leftShoulder: 70, rightShoulder: 70, leftHip: 18, rightHip: 18, leftKnee: 30, rightKnee: 30 }, easing: "ease-in-quad" },
3414
3517
  { after: 1060, pose: { stretch: 1.06, bend: -3, leftShoulder: 60, rightShoulder: 60, leftHip: e.leftHip, rightHip: e.rightHip, leftKnee: e.leftKnee, rightKnee: e.rightKnee }, easing: "ease-out" },
3415
- { after: 1260, pose: { stretch: e.stretch, bend: e.bend, ...Y.surprised, leftShoulder: 70, rightShoulder: 70, leftElbow: 60, rightElbow: 60 }, easing: "ease-in-out" }
3518
+ { after: 1260, pose: { stretch: e.stretch, bend: e.bend, ...X.surprised, leftShoulder: 70, rightShoulder: 70, leftElbow: 60, rightElbow: 60 }, easing: "ease-in-out" }
3416
3519
  ],
3417
3520
  /** Glance at something, look away unbothered, then snap back to it in shock. */
3418
3521
  doubleTake: (e) => [
3419
3522
  { after: 160, pose: { lookX: 1, lookY: 0 }, easing: "ease-out" },
3420
3523
  { after: 520, pose: { lookX: -0.6, headTilt: e.headTilt - 4, smile: 0.6, mouth: 0 }, easing: "ease-in-out" },
3421
3524
  { after: 1100, pose: { lookX: -0.6 } },
3422
- { after: 1180, pose: { bend: e.bend - 10, headTilt: e.headTilt + 10, rise: 0.05, stretch: 1.18, ...rn, lookX: 1, lookY: 0 }, easing: "ease-out-cubic" },
3525
+ { after: 1180, pose: { bend: e.bend - 10, headTilt: e.headTilt + 10, rise: 0.05, stretch: 1.18, ...fn, lookX: 1, lookY: 0 }, easing: "ease-out-cubic" },
3423
3526
  { after: 1360, pose: { rise: 0, stretch: 0.88, bend: e.bend + 4, headTilt: e.headTilt + 4 }, easing: "ease-in-quad" },
3424
3527
  { after: 1560, pose: { stretch: e.stretch, bend: e.bend, headTilt: e.headTilt }, easing: { type: "elastic", mode: "out", amplitude: 1, period: 0.35 } }
3425
3528
  ],
3426
3529
  /** Rear back for a zip-off: lean back, one knee up, arms cocked, hold, then pitch forward ready to run. */
3427
3530
  windUp: () => [
3428
- { after: 220, pose: { lean: -18, bend: -16, headTilt: -6, leftShoulder: 70, leftElbow: -100, rightShoulder: 40, rightElbow: 100, leftHip: -45, leftKnee: -80, stretch: 0.92, ...Y.angry, lookX: 1 }, easing: "ease-out" },
3531
+ { after: 220, pose: { lean: -18, bend: -16, headTilt: -6, leftShoulder: 70, leftElbow: -100, rightShoulder: 40, rightElbow: 100, leftHip: -45, leftKnee: -80, stretch: 0.92, ...X.angry, lookX: 1 }, easing: "ease-out" },
3429
3532
  { after: 620, pose: { lean: -20, bend: -18, stretch: 0.9 } },
3430
3533
  { after: 700, pose: { lean: 28, bend: 14, headTilt: 6, leftShoulder: 30, rightShoulder: 60, leftHip: 30, leftKnee: -30, rightHip: -20, stretch: 1.12 }, easing: "ease-out-cubic" }
3431
3534
  ],
@@ -3433,47 +3536,47 @@ const rn = Y.shocked, Xr = Y.scared, Bt = {
3433
3536
  land: (e) => [
3434
3537
  { after: 120, pose: { rise: 0, stretch: 0.7, bend: 14, leftShoulder: 75, rightShoulder: 75, leftHip: 20, rightHip: 20, leftKnee: 35, rightKnee: 35 }, easing: "ease-in-quad" },
3435
3538
  { after: 300, pose: { stretch: 1.05, bend: -4, leftShoulder: e.leftShoulder, rightShoulder: e.rightShoulder }, easing: "ease-out" },
3436
- { after: 460, pose: { rise: 0, stretch: e.stretch, bend: e.bend, leftHip: _.leftHip, rightHip: _.rightHip, leftKnee: 0, rightKnee: 0 }, easing: "ease-in-out" }
3539
+ { after: 460, pose: { rise: 0, stretch: e.stretch, bend: e.bend, leftHip: B.leftHip, rightHip: B.rightHip, leftKnee: 0, rightKnee: 0 }, easing: "ease-in-out" }
3437
3540
  ],
3438
3541
  /** A frightened shiver: small, fast shakes with wide eyes, then still. */
3439
3542
  tremble: (e) => {
3440
- const t = [{ after: 80, pose: { ...Xr, bend: e.bend + 8, leftShoulder: 40, rightShoulder: 40, leftElbow: 110, rightElbow: 110, stretch: 0.94 }, easing: "ease-out" }];
3543
+ const t = [{ after: 80, pose: { ...si, bend: e.bend + 8, leftShoulder: 40, rightShoulder: 40, leftElbow: 110, rightElbow: 110, stretch: 0.94 }, easing: "ease-out" }];
3441
3544
  for (let n = 1; n <= 14; n++) t.push({ after: 80 + n * 45, pose: { lean: e.lean + (n % 2 === 0 ? 2.5 : -2.5), headTilt: e.headTilt + (n % 2 === 0 ? -2 : 2) } });
3442
3545
  return t.push({ after: 755, pose: { lean: e.lean, headTilt: e.headTilt, bend: e.bend } }), t;
3443
3546
  },
3444
3547
  /** A sigh: the body sags, shoulders drop, head and eyes go down. */
3445
3548
  deflate: (e) => [
3446
3549
  { after: 260, pose: { stretch: 1.04, headTilt: e.headTilt + 4, leftBrow: 0.3, rightBrow: 0.3 }, easing: "ease-in-out" },
3447
- { after: 900, pose: { ...Oe.sad, bend: 18, stretch: 0.92, lean: e.lean + 5, turn: e.turn, sit: e.sit }, easing: "ease-in-out" }
3550
+ { after: 900, pose: { ...Be.sad, bend: 18, stretch: 0.92, lean: e.lean + 5, turn: e.turn, sit: e.sit }, easing: "ease-in-out" }
3448
3551
  ]
3449
3552
  };
3450
- function qr(e, t) {
3451
- const n = typeof t.from == "string" ? Oe[t.from] : t.from ?? _, s = t.speed ?? 1;
3553
+ function un(e, t) {
3554
+ const n = typeof t.from == "string" ? Be[t.from] : t.from ?? B, s = t.speed ?? 1;
3452
3555
  let o = n;
3453
3556
  return [
3454
3557
  // The move onto the starting pose is acted like any other; the gag itself is not.
3455
3558
  { time: t.at, pose: n },
3456
- ...Bt[e](n).map((r) => (o = { ...o, ...r.pose }, { time: t.at + r.after * s, pose: o, act: !1, ...r.easing ? { easing: r.easing } : {} }))
3559
+ ...Lt[e](n).map((r) => (o = { ...o, ...r.pose }, { time: t.at + r.after * s, pose: o, act: !1, ...r.easing ? { easing: r.easing } : {} }))
3457
3560
  ];
3458
3561
  }
3459
- function Gr(e, t = 1) {
3460
- const n = Bt[e](_);
3562
+ function dn(e, t = 1) {
3563
+ const n = Lt[e](B);
3461
3564
  return n[n.length - 1].after * t;
3462
3565
  }
3463
- function Ur(e, t, n = {}) {
3566
+ function ri(e, t, n = {}) {
3464
3567
  if (t.length < 2) return;
3465
3568
  const s = Math.max(1, Math.round(n.lines ?? 3)), o = n.spacing ?? 5, r = n.lineWidth ?? 2, l = n.opacity ?? 0.7;
3466
3569
  e.save(), e.strokeStyle = n.color ?? "#222", e.lineCap = "round";
3467
3570
  for (let i = 0; i < s; i++) {
3468
3571
  const a = (i - (s - 1) / 2) * o, h = Math.floor(Math.abs(a) / Math.max(o, 1) * (t.length / 6));
3469
3572
  for (let c = h + 1; c < t.length; c++) {
3470
- const u = t[c - 1], g = t[c], f = g.x - u.x, p = g.y - u.y, d = Math.hypot(f, p) || 1, m = -p / d, b = f / d, y = 1 - c / (t.length - 1);
3471
- e.globalAlpha = l * (1 - y), e.lineWidth = r * (1 - y * 0.7), e.beginPath(), e.moveTo(u.x + m * a, u.y + b * a), e.lineTo(g.x + m * a, g.y + b * a), e.stroke();
3573
+ const u = t[c - 1], d = t[c], f = d.x - u.x, p = d.y - u.y, g = Math.hypot(f, p) || 1, m = -p / g, b = f / g, S = 1 - c / (t.length - 1);
3574
+ e.globalAlpha = l * (1 - S), e.lineWidth = r * (1 - S * 0.7), e.beginPath(), e.moveTo(u.x + m * a, u.y + b * a), e.lineTo(d.x + m * a, d.y + b * a), e.stroke();
3472
3575
  }
3473
3576
  }
3474
3577
  e.restore();
3475
3578
  }
3476
- const zr = {
3579
+ const ii = {
3477
3580
  hands: [
3478
3581
  { name: "left hand", at: (e) => e.hands.left },
3479
3582
  { name: "right hand", at: (e) => e.hands.right }
@@ -3488,7 +3591,7 @@ const zr = {
3488
3591
  { name: "neck", at: (e) => e.neck }
3489
3592
  ]
3490
3593
  };
3491
- function qi(e, t, n, s, o = {}) {
3594
+ function ll(e, t, n, s, o = {}) {
3492
3595
  const r = n.stateAt;
3493
3596
  if (!r) return;
3494
3597
  const l = o.length ?? 120, i = Math.max(2, Math.round(o.samples ?? 8)), a = Math.max(0, n.time - l);
@@ -3496,40 +3599,40 @@ function qi(e, t, n, s, o = {}) {
3496
3599
  const h = [];
3497
3600
  for (let f = 0; f < i; f++) {
3498
3601
  const p = a + (n.time - a) * f / (i - 1);
3499
- h.push(ds(t, { time: p, state: r(p) }, s).joints);
3602
+ h.push(Ss(t, { time: p, state: r(p) }, s).joints);
3500
3603
  }
3501
- const c = h[h.length - 1].height, u = (o.threshold ?? 1.2) * c, g = (o.parts ?? ["hands", "toes", "head"]).flatMap((f) => zr[f]);
3502
- for (const f of g) {
3604
+ const c = h[h.length - 1].height, u = (o.threshold ?? 1.2) * c, d = (o.parts ?? ["hands", "toes", "head"]).flatMap((f) => ii[f]);
3605
+ for (const f of d) {
3503
3606
  const p = h.map(f.at);
3504
- let d = 0;
3505
- for (let y = 1; y < p.length; y++) d += Math.hypot(p[y].x - p[y - 1].x, p[y].y - p[y - 1].y);
3506
- const m = d / ((n.time - a) / 1e3);
3607
+ let g = 0;
3608
+ for (let S = 1; S < p.length; S++) g += Math.hypot(p[S].x - p[S - 1].x, p[S].y - p[S - 1].y);
3609
+ const m = g / ((n.time - a) / 1e3);
3507
3610
  if (m <= u) continue;
3508
3611
  const b = Math.min(1, (m - u) / (u * 0.5));
3509
- Ur(e, p, { ...o, opacity: (o.opacity ?? 0.7) * b, spacing: o.spacing ?? c * 0.02 });
3612
+ ri(e, p, { ...o, opacity: (o.opacity ?? 0.7) * b, spacing: o.spacing ?? c * 0.02 });
3510
3613
  }
3511
3614
  }
3512
- function Gi(e, t, n, s = {}) {
3615
+ function al(e, t, n, s = {}) {
3513
3616
  if (n <= 0 || n >= 1) return;
3514
3617
  const o = s.size ?? 40, r = s.seed ?? 1, l = 0.45 + 0.55 * (1 - (1 - n) ** 3);
3515
3618
  e.save(), e.strokeStyle = s.color ?? "#555", e.lineWidth = Math.max(1, o * 0.03), e.globalAlpha = Math.min(1, n / 0.08) * (1 - n);
3516
3619
  for (let i = 0; i < 5; i++) {
3517
- const a = Ze(`${r}:puff:${i}`) % 1e3 / 1e3, h = i - 2, c = t.x + h * o * 0.3 * l, u = t.y - o * (0.06 + 0.12 * a) * l + Math.abs(h) * o * 0.03, g = o * (0.11 + 0.07 * a) * l;
3518
- e.beginPath(), e.arc(c, u, g, Math.PI * 0.95, Math.PI * 2.05), e.stroke();
3620
+ const a = tt(`${r}:puff:${i}`) % 1e3 / 1e3, h = i - 2, c = t.x + h * o * 0.3 * l, u = t.y - o * (0.06 + 0.12 * a) * l + Math.abs(h) * o * 0.03, d = o * (0.11 + 0.07 * a) * l;
3621
+ e.beginPath(), e.arc(c, u, d, Math.PI * 0.95, Math.PI * 2.05), e.stroke();
3519
3622
  }
3520
3623
  e.restore();
3521
3624
  }
3522
- function Ui(e, t, n, s = {}) {
3625
+ function hl(e, t, n, s = {}) {
3523
3626
  if (n <= 0 || n >= 1) return;
3524
3627
  const o = s.size ?? 40, r = 5, l = 1 - (1 - n) ** 2;
3525
3628
  e.save(), e.strokeStyle = s.color ?? "#222", e.lineWidth = Math.max(1, o * 0.035), e.lineJoin = "round", e.globalAlpha = n < 0.7 ? 1 : (1 - n) / 0.3;
3526
3629
  for (let i = 0; i < r; i++) {
3527
3630
  const a = -Math.PI / 2 + (i - (r - 1) / 2) * Math.PI / (r + 1), h = o * (0.3 + 0.7 * l), c = t.x + Math.cos(a) * h, u = t.y + Math.sin(a) * h;
3528
- Vr(e, c, u, o * 0.14, n * Math.PI + i), e.stroke();
3631
+ li(e, c, u, o * 0.14, n * Math.PI + i), e.stroke();
3529
3632
  }
3530
3633
  e.restore();
3531
3634
  }
3532
- function Vr(e, t, n, s, o) {
3635
+ function li(e, t, n, s, o) {
3533
3636
  e.beginPath();
3534
3637
  for (let r = 0; r < 10; r++) {
3535
3638
  const l = r % 2 === 0 ? s : s * 0.45, i = o + r * Math.PI / 5 - Math.PI / 2, a = t + Math.cos(i) * l, h = n + Math.sin(i) * l;
@@ -3537,7 +3640,7 @@ function Vr(e, t, n, s, o) {
3537
3640
  }
3538
3641
  e.closePath();
3539
3642
  }
3540
- const ce = {
3643
+ const ue = {
3541
3644
  /** Closed and relaxed */
3542
3645
  rest: { mouth: 0, mouthWidth: 1 },
3543
3646
  /** "ah": open wide */
@@ -3558,7 +3661,7 @@ const ce = {
3558
3661
  l: { mouth: 0.3, mouthWidth: 1 },
3559
3662
  /** Other consonants: slightly open */
3560
3663
  c: { mouth: 0.2, mouthWidth: 1 }
3561
- }, Me = 1, Ne = 0.55, ln = 0.35, jr = 1.6, an = { a: "a", e: "e", i: "i", y: "i", o: "o", u: "u" }, hn = { m: "m", b: "m", p: "m", f: "f", v: "f", w: "u", q: "u", l: "l", n: "l", d: "l", t: "l" }, cn = {
3664
+ }, Ae = 1, Xe = 0.55, gn = 0.35, ai = 1.6, pn = { a: "a", e: "e", i: "i", y: "i", o: "o", u: "u" }, mn = { m: "m", b: "m", p: "m", f: "f", v: "f", w: "u", q: "u", l: "l", n: "l", d: "l", t: "l" }, bn = {
3562
3665
  अ: "a",
3563
3666
  आ: "a",
3564
3667
  इ: "i",
@@ -3572,7 +3675,7 @@ const ce = {
3572
3675
  औ: "o",
3573
3676
  ऍ: "e",
3574
3677
  ऑ: "o"
3575
- }, fn = {
3678
+ }, wn = {
3576
3679
  "ा": "a",
3577
3680
  "ि": "i",
3578
3681
  "ी": "i",
@@ -3585,78 +3688,78 @@ const ce = {
3585
3688
  "ौ": "o",
3586
3689
  "ॅ": "e",
3587
3690
  "ॉ": "o"
3588
- }, Jr = { प: "m", फ: "m", ब: "m", भ: "m", म: "m", व: "u" }, Zr = "्", un = "़", Qr = (e) => e >= "क" && e <= "ह", dn = /* @__PURE__ */ new Set([".", ",", "!", "?", ";", ":", "…", "।", "॥", "—", "-"]);
3589
- function ei(e) {
3691
+ }, hi = { प: "m", फ: "m", ब: "m", भ: "m", म: "m", व: "u" }, ci = "्", yn = "़", fi = (e) => e >= "क" && e <= "ह", kn = /* @__PURE__ */ new Set([".", ",", "!", "?", ";", ":", "…", "।", "॥", "—", "-"]);
3692
+ function ui(e) {
3590
3693
  const t = [], n = Array.from(e.toLowerCase()), s = (o, r) => {
3591
3694
  const l = t[t.length - 1];
3592
3695
  l && l.viseme === o ? l.weight += r * 0.5 : t.push({ viseme: o, weight: r });
3593
3696
  };
3594
3697
  for (let o = 0; o < n.length; o++) {
3595
3698
  const r = n[o], l = n[o + 1];
3596
- if (dn.has(r)) s("rest", jr);
3699
+ if (kn.has(r)) s("rest", ai);
3597
3700
  else if (/\s/.test(r)) {
3598
3701
  const i = t[t.length - 1];
3599
- i && i.viseme !== "rest" && t.push({ viseme: "c", weight: ln });
3702
+ i && i.viseme !== "rest" && t.push({ viseme: "c", weight: gn });
3600
3703
  } else if ((r === "o" || r === "e") && l === r)
3601
- s(r === "o" ? "u" : "i", Me), o++;
3602
- else if (r in an) s(an[r], Me);
3603
- else if (r in hn) s(hn[r], Ne);
3704
+ s(r === "o" ? "u" : "i", Ae), o++;
3705
+ else if (r in pn) s(pn[r], Ae);
3706
+ else if (r in mn) s(mn[r], Xe);
3604
3707
  else {
3605
3708
  if (r === "h") continue;
3606
- if (/[a-z]/.test(r)) s("c", Ne);
3607
- else if (r in cn) s(cn[r], Me);
3608
- else if (Qr(r)) {
3609
- const i = l === un ? r === "फ" ? "f" : void 0 : Jr[r];
3610
- s(i ?? "c", Ne);
3709
+ if (/[a-z]/.test(r)) s("c", Xe);
3710
+ else if (r in bn) s(bn[r], Ae);
3711
+ else if (fi(r)) {
3712
+ const i = l === yn ? r === "फ" ? "f" : void 0 : hi[r];
3713
+ s(i ?? "c", Xe);
3611
3714
  let a = o + 1;
3612
- n[a] === un && a++;
3715
+ n[a] === yn && a++;
3613
3716
  const h = n[a];
3614
- h === Zr ? o = a : h && h in fn ? (s(fn[h], Me), o = a) : (!h || /\s/.test(h) || dn.has(h) || s("a", Me * 0.6), o = a - 1);
3615
- } else (r === "ं" || r === "ँ") && s("l", Ne * 0.6);
3717
+ h === ci ? o = a : h && h in wn ? (s(wn[h], Ae), o = a) : (!h || /\s/.test(h) || kn.has(h) || s("a", Ae * 0.6), o = a - 1);
3718
+ } else (r === "ं" || r === "ँ") && s("l", Xe * 0.6);
3616
3719
  }
3617
3720
  }
3618
- for (; t.length > 0 && (t[t.length - 1].viseme === "rest" || t[t.length - 1].weight === ln); ) t.pop();
3721
+ for (; t.length > 0 && (t[t.length - 1].viseme === "rest" || t[t.length - 1].weight === gn); ) t.pop();
3619
3722
  return t;
3620
3723
  }
3621
- function Qn(e, t = {}) {
3622
- const n = t.fields?.mouth ?? "mouth", s = t.fields?.mouthWidth ?? "mouthWidth", o = t.energy ?? 1, r = ei(e.text), l = [{ time: e.start, value: ce.rest.mouth }], i = [{ time: e.start, value: ce.rest.mouthWidth }], a = r.reduce((c, u) => c + u.weight, 0), h = e.end - e.start;
3724
+ function lo(e, t = {}) {
3725
+ const n = t.fields?.mouth ?? "mouth", s = t.fields?.mouthWidth ?? "mouthWidth", o = t.energy ?? 1, r = ui(e.text), l = [{ time: e.start, value: ue.rest.mouth }], i = [{ time: e.start, value: ue.rest.mouthWidth }], a = r.reduce((c, u) => c + u.weight, 0), h = e.end - e.start;
3623
3726
  if (a > 0 && h > 0) {
3624
3727
  let c = e.start;
3625
3728
  for (const u of r) {
3626
- const g = h * u.weight / a, f = c + Math.min(g * 0.4, 60);
3729
+ const d = h * u.weight / a, f = c + Math.min(d * 0.4, 60);
3627
3730
  if (f > l[l.length - 1].time) {
3628
- const p = ce[u.viseme];
3731
+ const p = ue[u.viseme];
3629
3732
  l.push({ time: f, value: p.mouth * o, easing: "ease-out" }), i.push({ time: f, value: 1 + (p.mouthWidth - 1) * Math.min(1.3, o), easing: "ease-out" });
3630
3733
  }
3631
- c += g;
3734
+ c += d;
3632
3735
  }
3633
3736
  }
3634
- return e.end > l[l.length - 1].time && (l.push({ time: e.end, value: ce.rest.mouth, easing: "ease-in-out" }), i.push({ time: e.end, value: ce.rest.mouthWidth, easing: "ease-in-out" })), { [n]: l, [s]: i };
3737
+ return e.end > l[l.length - 1].time && (l.push({ time: e.end, value: ue.rest.mouth, easing: "ease-in-out" }), i.push({ time: e.end, value: ue.rest.mouthWidth, easing: "ease-in-out" })), { [n]: l, [s]: i };
3635
3738
  }
3636
- function zi(e, t, n = {}) {
3739
+ function cl(e, t, n = {}) {
3637
3740
  const s = {};
3638
3741
  for (const o of [...t].sort((r, l) => r.start - l.start))
3639
- for (const [r, l] of Object.entries(Qn(o, n))) {
3742
+ for (const [r, l] of Object.entries(lo(o, n))) {
3640
3743
  const i = s[r] ??= [], a = i.length > 0 ? i[i.length - 1].time : -1 / 0;
3641
3744
  i.push(...l.filter((h) => h.time > a));
3642
3745
  }
3643
3746
  return Object.entries(s).map(([o, r]) => ({ id: `${e}-${o}`, target: e, property: o, keyframes: r }));
3644
3747
  }
3645
- function ti(e, t, n, s = {}) {
3748
+ function di(e, t, n, s = {}) {
3646
3749
  if (n.length === 0) return t;
3647
- const o = s.fields?.mouth ?? "mouth", r = s.fields?.mouthWidth ?? "mouthWidth", l = { [o]: ce.rest.mouth, [r]: ce.rest.mouthWidth, ...s.rest }, i = new oo({ id: "before-speech", tracks: t }), a = (u, g) => i.getStateAtTime(g).values.get(e)?.get(u) ?? l[u], h = [o, r], c = t.filter((u) => u.target !== e || !h.includes(u.property));
3750
+ const o = s.fields?.mouth ?? "mouth", r = s.fields?.mouthWidth ?? "mouthWidth", l = { [o]: ue.rest.mouth, [r]: ue.rest.mouthWidth, ...s.rest }, i = new fo({ id: "before-speech", tracks: t }), a = (u, d) => i.getStateAtTime(d).values.get(e)?.get(u) ?? l[u], h = [o, r], c = t.filter((u) => u.target !== e || !h.includes(u.property));
3648
3751
  for (const u of h) {
3649
- const g = t.find((p) => p.target === e && p.property === u);
3650
- let f = g ? [...g.keyframes] : [{ time: 0, value: a(u, 0) }];
3752
+ const d = t.find((p) => p.target === e && p.property === u);
3753
+ let f = d ? [...d.keyframes] : [{ time: 0, value: a(u, 0) }];
3651
3754
  for (const p of n) {
3652
- const d = Qn(p, s)[u];
3653
- d[0] = { ...d[0], value: a(u, p.start) }, d[d.length - 1] = { ...d[d.length - 1], value: a(u, p.end) }, f = [...f.filter((m) => m.time < p.start || m.time > p.end), ...d], f.sort((m, b) => m.time - b.time);
3755
+ const g = lo(p, s)[u];
3756
+ g[0] = { ...g[0], value: a(u, p.start) }, g[g.length - 1] = { ...g[g.length - 1], value: a(u, p.end) }, f = [...f.filter((m) => m.time < p.start || m.time > p.end), ...g], f.sort((m, b) => m.time - b.time);
3654
3757
  }
3655
- c.push({ id: g?.id ?? `${e}-${u}`, target: e, property: u, keyframes: f });
3758
+ c.push({ id: d?.id ?? `${e}-${u}`, target: e, property: u, keyframes: f });
3656
3759
  }
3657
3760
  return c;
3658
3761
  }
3659
- const ni = {
3762
+ const Sn = {
3660
3763
  walk: 1e3,
3661
3764
  bouncy: 900,
3662
3765
  doubleBounce: 1100,
@@ -3664,77 +3767,86 @@ const ni = {
3664
3767
  strut: 1100,
3665
3768
  tired: 1500,
3666
3769
  run: 560
3667
- }, le = 450, gn = 1200, oi = 700, be = 320, He = 220, si = 65, ri = 700, ft = (e) => e in we, pn = (e) => e in Bt, ii = (e) => e in Oe;
3668
- function li(e) {
3669
- return Math.max(ri, Array.from(e).length * si);
3770
+ }, gi = 450, pi = 2.4, mi = 160, En = 2.5, he = 450, Mn = 1200, bi = 700, ke = 320, Se = 220, wi = 65, yi = 700, pt = (e) => e in Ee, Hn = (e) => e in Lt, ki = (e) => e in Be;
3771
+ function Si(e) {
3772
+ return Math.max(yi, Array.from(e).length * wi);
3670
3773
  }
3671
- function Vi(e, t, n = {}) {
3774
+ function fl(e, t, n = {}) {
3672
3775
  const s = n.from ?? 0, o = n.height ?? 300;
3673
- let r = s, l = n.facing ?? 1, i = n.start ?? _, a = 0, h = 0;
3674
- const c = [{ time: 0, pose: i }], u = [{ time: 0, value: 0 }], g = [{ time: 0, value: 0 }], f = [{ time: 0, value: 0 }], p = [{ time: 0, value: "walk" }], d = [{ time: 0, value: l }], m = [], b = [], y = (w, S, k, x) => {
3675
- i = { ...i, ...S }, k && (i = qe(i, k)), c.push({ time: w, pose: i });
3676
- }, E = (w, S, k) => (y(w + be / 2, { turn: 0 }, k), d.push({ time: w + be / 2, value: l }, { time: w + be / 2 + 1, value: S }), l = S, y(w + be, { turn: 1 }), w + be), H = (w) => w < r ? -1 : 1;
3776
+ let r = s, l = n.facing ?? 1, i = n.start ?? B, a = 0, h = 0;
3777
+ const c = [{ time: 0, pose: i }], u = [{ time: 0, value: 0 }], d = [{ time: 0, value: 0 }], f = [{ time: 0, value: 0 }], p = [{ time: 0, value: "walk" }], g = [{ time: 0, value: l }], m = [], b = [], S = [], k = (w, y, A, x) => {
3778
+ i = { ...i, ...y }, A && (i = We(i, A)), c.push({ time: w, pose: i });
3779
+ }, v = (w, y, A) => (k(w + ke / 2, { turn: 0 }, A), g.push({ time: w + ke / 2, value: l }, { time: w + ke / 2 + 1, value: y }), l = y, k(w + ke, { turn: 1 }), w + ke), H = (w) => w < r ? -1 : 1;
3677
3780
  for (const w of t) {
3678
- const S = Math.max(w.at ?? h, h === 0 ? 0 : c[c.length - 1].time);
3679
- let k = S;
3781
+ const y = Math.max(w.at ?? h, h === 0 ? 0 : c[c.length - 1].time);
3782
+ let A = y;
3680
3783
  const x = w.pose ?? {};
3681
- if (ft(w.do)) {
3682
- const v = w.to ?? r, T = v === r ? l : H(v);
3683
- let K = S;
3684
- T !== l ? K = E(S, T, w.mood) : i.turn < 1 ? (K = S + He, y(K, { turn: 1, ...x }, w.mood)) : (w.mood || w.pose) && y(S + He, x, w.mood);
3685
- const I = Math.abs(v - r) / Io(w.do, o), q = w.for ?? Math.max(He * 2, I * ni[w.do]), G = K + q;
3686
- p.push({ time: K, value: w.do }), f.push({ time: K, value: 0 }, { time: K + He, value: 1, easing: "ease-out" }), f.push({ time: G - He, value: 1 }, { time: G, value: 0, easing: "ease-in" }), g.push({ time: K, value: a }, { time: G, value: a + I }), u.push({ time: K, value: r - s }, { time: G, value: v - s }), a += I, r = v, y(G, {}), k = G;
3687
- } else if (pn(w.do)) {
3688
- const v = qr(w.do, { at: S, from: w.mood ? qe(i, w.mood) : i });
3689
- c.push(...v), i = v[v.length - 1].pose, k = S + Gr(w.do);
3784
+ if (pt(w.do)) {
3785
+ const E = w.to ?? r, P = E === r ? l : H(E);
3786
+ let K = y;
3787
+ P !== l ? K = v(y, P, w.mood) : i.turn < 1 ? (K = y + Se, k(K, { turn: 1, ...x }, w.mood)) : (w.mood || w.pose) && k(y + Se, x, w.mood);
3788
+ const $ = Math.abs(E - r) / Yo(w.do, o), G = w.for ?? Math.max(Se * 2, $ * Sn[w.do]), W = K + G;
3789
+ p.push({ time: K, value: w.do }), f.push({ time: K, value: 0 }, { time: K + Se, value: 1, easing: "ease-out" }), f.push({ time: W - Se, value: 1 }, { time: W, value: 0, easing: "ease-in" }), d.push({ time: K, value: a }, { time: W, value: a + $ }), u.push({ time: K, value: r - s }, { time: W, value: E - s }), a += $, r = E, k(W, {}), A = W;
3790
+ } else if (w.do === "zip") {
3791
+ const E = w.to ?? r, P = E === r ? l : H(E);
3792
+ let K = y;
3793
+ P !== l ? K = v(y, P, w.mood) : i.turn < 1 && (K = y + Se, k(K, { turn: 1 }, w.mood));
3794
+ const _ = un("windUp", { at: K, from: w.mood ? We(i, w.mood) : i });
3795
+ c.push(..._), i = _[_.length - 1].pose;
3796
+ const $ = K + dn("windUp"), G = $ + gi, W = G + Math.max(mi, Math.abs(E - r) / pi);
3797
+ p.push({ time: $, value: "run" }), f.push({ time: $, value: 0 }, { time: $ + 80, value: 1, easing: "ease-out" }, { time: W, value: 1 }, { time: W + 120, value: 0 }), d.push({ time: $, value: a }, { time: G, value: a + En, easing: "ease-in" }), a += En + (W - G) / Sn.run * 1.5, d.push({ time: W, value: a }), u.push({ time: G, value: r - s }, { time: W, value: E - s, easing: "ease-in" }), S.push({ kind: "dust", time: G, x: r, length: 900 }), r = E, k(W, {}), A = W;
3798
+ } else if (Hn(w.do)) {
3799
+ const E = un(w.do, { at: y, from: w.mood ? We(i, w.mood) : i });
3800
+ c.push(...E), i = E[E.length - 1].pose, A = y + dn(w.do), w.do === "take" && S.push({ kind: "dust", time: y + 900, x: r, length: 500 }), w.do === "land" && S.push({ kind: "dust", time: y + 120, x: r, length: 500 });
3690
3801
  } else if (w.do === "look" || w.do === "face") {
3691
- const v = w.toward ?? "viewer", T = w.for ?? oi;
3692
- if (v === "viewer") y(S + le, { turn: 0, lookX: 0, lookY: 0, ...x }, w.mood);
3693
- else if (v === "ahead") y(S + le, { turn: w.do === "face" ? 1 : 0.6, lookX: 1, ...x }, w.mood);
3694
- else if (v === "back") y(S + le, { turn: 0.2, lookX: -1, ...x }, w.mood);
3802
+ const E = w.toward ?? "viewer", P = w.for ?? bi;
3803
+ if (E === "viewer") k(y + he, { turn: 0, lookX: 0, lookY: 0, ...x }, w.mood);
3804
+ else if (E === "ahead") k(y + he, { turn: w.do === "face" ? 1 : 0.6, lookX: 1, ...x }, w.mood);
3805
+ else if (E === "back") k(y + he, { turn: 0.2, lookX: -1, ...x }, w.mood);
3695
3806
  else {
3696
- const K = H(v);
3697
- K !== l && w.do === "face" ? (E(S, K, w.mood), y(S + be + 1, { lookX: 1, ...x })) : K !== l ? y(S + le, { turn: 0.25, lookX: -1, ...x }, w.mood) : y(S + le, { turn: w.do === "face" ? 1 : 0.6, lookX: 1, ...x }, w.mood);
3807
+ const K = H(E);
3808
+ K !== l && w.do === "face" ? (v(y, K, w.mood), k(y + ke + 1, { lookX: 1, ...x })) : K !== l ? k(y + he, { turn: 0.25, lookX: -1, ...x }, w.mood) : k(y + he, { turn: w.do === "face" ? 1 : 0.6, lookX: 1, ...x }, w.mood);
3698
3809
  }
3699
- k = S + Math.max(T, le);
3700
- } else if (ii(w.do) || w.do === "stand") {
3701
- const v = w.do === "stand" ? _ : Oe[w.do], T = v.turn !== _.turn ? v.turn : i.turn, K = w.mood ? Y[w.mood] : { lookX: i.lookX, lookY: i.lookY };
3702
- y(S + le, { ...v, turn: T, ...K, ...x }), k = S + (w.for ?? gn);
3810
+ A = y + Math.max(P, he);
3811
+ } else if (ki(w.do) || w.do === "stand") {
3812
+ const E = w.do === "stand" ? B : Be[w.do], P = E.turn !== B.turn ? E.turn : i.turn, K = w.mood ? X[w.mood] : { lookX: i.lookX, lookY: i.lookY };
3813
+ k(y + he, { ...E, turn: P, ...K, ...x }), A = y + (w.for ?? Mn);
3703
3814
  } else {
3704
- const v = w.for ?? (w.say ? li(w.say) : gn);
3705
- (w.mood || w.pose) && y(S + Math.min(le, v / 2), x, w.mood), k = S + v;
3815
+ const E = w.for ?? (w.say ? Si(w.say) : Mn);
3816
+ (w.mood || w.pose) && k(y + Math.min(he, E / 2), x, w.mood), A = y + E;
3706
3817
  }
3707
3818
  if (w.say) {
3708
- const v = ft(w.do) || pn(w.do) ? S : S + Math.min(150, (k - S) / 4), T = ft(w.do) ? k : Math.max(v + 200, k - 100);
3709
- m.push({ text: w.say, start: v, end: T }), w.do === "say" && ci(c, i, v, T);
3819
+ const E = pt(w.do) || Hn(w.do) ? y : y + Math.min(150, (A - y) / 4), P = pt(w.do) ? A : Math.max(E + 200, A - 100);
3820
+ m.push({ text: w.say, start: E, end: P }), w.do === "say" && Hi(c, i, E, P);
3710
3821
  }
3711
- k > c[c.length - 1].time && c.push({ time: k, pose: i }), b.push({ start: S, end: k }), h = k;
3822
+ A > c[c.length - 1].time && c.push({ time: A, pose: i }), b.push({ start: y, end: A }), h = A;
3712
3823
  }
3713
- const M = Dr(e, hi(c), n), A = [
3824
+ const T = oi(e, Mi(c), n), M = [
3714
3825
  { id: `${e}-x`, target: e, property: "x", keyframes: u },
3715
- { id: `${e}-walk`, target: e, property: "walk", keyframes: g },
3826
+ { id: `${e}-walk`, target: e, property: "walk", keyframes: d },
3716
3827
  { id: `${e}-walking`, target: e, property: "walking", keyframes: f },
3717
3828
  { id: `${e}-gait`, target: e, property: "gait", keyframes: p },
3718
- { id: `${e}-facing`, target: e, property: "facing", keyframes: d }
3829
+ { id: `${e}-facing`, target: e, property: "facing", keyframes: g }
3719
3830
  ].filter((w) => w.keyframes.length > 1 || w.property === "x");
3720
3831
  return {
3721
- tracks: [...ti(e, M, m, { energy: n.energy }), ...A],
3832
+ tracks: [...di(e, T, m, { energy: n.energy }), ...M],
3722
3833
  duration: h,
3723
3834
  lines: m,
3724
3835
  keys: c,
3725
- beats: b
3836
+ beats: b,
3837
+ effects: S
3726
3838
  };
3727
3839
  }
3728
- const ai = 30;
3729
- function hi(e) {
3840
+ const Ei = 30;
3841
+ function Mi(e) {
3730
3842
  const t = [];
3731
3843
  for (const n of e) {
3732
3844
  const s = t[t.length - 1];
3733
- s && n.time - s.time < ai ? t[t.length - 1] = { ...n, time: s.time } : t.push(n);
3845
+ s && n.time - s.time < Ei ? t[t.length - 1] = { ...n, time: s.time } : t.push(n);
3734
3846
  }
3735
3847
  return t;
3736
3848
  }
3737
- function ci(e, t, n, s) {
3849
+ function Hi(e, t, n, s) {
3738
3850
  const r = e.filter((a) => a.time > n), l = e.filter((a) => a.time <= n), i = [];
3739
3851
  for (let a = n + 520, h = 0; a < s - 520 / 2; a += 520, h++) {
3740
3852
  const c = h % 2 === 0 ? 3 : -2;
@@ -3743,126 +3855,134 @@ function ci(e, t, n, s) {
3743
3855
  i.length > 0 && i.push({ time: s, pose: t }), e.length = 0, e.push(...l, ...i.filter((a) => !r.some((h) => Math.abs(h.time - a.time) < 60)), ...r), e.sort((a, h) => a.time - h.time);
3744
3856
  }
3745
3857
  export {
3746
- ht as ACTING_STYLES,
3747
- Se as DANCE_STYLES,
3748
- Y as EXPRESSIONS,
3749
- co as FINGERS,
3750
- Pt as FLIPS,
3751
- Bt as GAGS,
3752
- we as GAITS,
3753
- ni as GAIT_CYCLE_MS,
3754
- L as HAND_REST,
3755
- C as HAND_SHAPES,
3756
- Cr as HUMAN_ACTING_RIG,
3757
- Ai as HUMAN_EXPRESSIONS,
3758
- Qs as HUMAN_POSES,
3759
- X as HUMAN_REST,
3760
- Zt as MUDRAS,
3761
- Oe as POSES,
3762
- _ as REST_POSE,
3763
- Lr as STICK_ACTING_RIG,
3764
- ce as VISEMES,
3765
- Xi as actCharacterTracks,
3766
- Jn as actKeyframes,
3767
- Dr as actTracks,
3768
- ks as applyGroove,
3769
- Mi as bakeDanceTracks,
3770
- Di as basicOutfit,
3771
- ki as beatAt,
3772
- Pe as blendPose,
3773
- to as boilFrame,
3774
- fr as character,
3775
- _i as characterAt,
3776
- br as characterHandPose,
3777
- gr as characterJoints,
3778
- Pi as characterJointsInView,
3779
- Bi as characterObjects,
3780
- $i as characterPoseTracks,
3781
- Ii as characterTarget,
3782
- Ri as circlePath,
3783
- jn as clipErased,
3784
- bn as createPen,
3785
- xt as danceFrame,
3786
- wi as dancePose,
3787
- yt as danceStance,
3788
- yi as danceTaps,
3789
- Ei as danceTracks,
3790
- ot as danceTravel,
3791
- Hs as danceTravelTrack,
3792
- Si as dancer,
3793
- Tt as drawCartoonHand,
3794
- yr as drawCharacter,
3795
- kr as drawCharacterInView,
3796
- Gi as drawDustPuff,
3797
- Gn as drawEraser,
3798
- zn as drawHand,
3799
- Ui as drawImpactStars,
3800
- Ar as drawPencil,
3801
- Ur as drawSpeedLines,
3802
- hs as drawStickFigure,
3803
- qi as drawStickSmear,
3804
- Li as drawnPathTarget,
3805
- Lt as ellipsePoints,
3806
- Ci as erasable,
3807
- Ys as flipPose,
3808
- Hi as flipTracks,
3809
- Cs as flipTravel,
3810
- qr as gag,
3811
- Gr as gagDuration,
3812
- Oo as gaitPose,
3813
- Io as gaitStrideLength,
3814
- Fi as handAt,
3815
- pt as handJoints,
3816
- Mo as handJointsAt,
3817
- R as handPose,
3818
- Ue as handProp,
3819
- pi as headPoint,
3820
- Ti as humanFieldLabel,
3821
- er as humanPlan,
3822
- ee as humanPose,
3823
- Sr as jointsInScene,
3824
- as as jointsToScene,
3825
- Qn as lipSyncKeyframes,
3826
- ti as lipSyncOver,
3827
- zi as lipSyncTracks,
3828
- vi as mirrorHumanPose,
3829
- ws as mirrorPose,
3830
- Ke as mixHandPoses,
3831
- Wi as mixPoses,
3832
- mn as partialPath,
3833
- Zi as pathLength,
3834
- Ht as pointAlong,
3835
- Ki as pointOnHead,
3836
- z as pose,
3837
- bi as poseTracks,
3838
- Oi as reachCharacter,
3839
- Or as resolveActingStyle,
3840
- qn as resolveCharacterPoseKeys,
3841
- wn as resolveGait,
3842
- _n as resolvePoseKeys,
3843
- On as resolveStickFrame,
3844
- cs as resolveStickPose,
3845
- de as rotateAbout,
3846
- Kt as routineBeats,
3847
- ke as rubberLimb,
3848
- Vi as scriptTracks,
3849
- Ni as scrubPath,
3850
- gi as seatHeight,
3851
- Yn as skeletonInView,
3852
- ut as sketchPen,
3853
- Ot as solvePlanSpace,
3854
- ei as soundsOf,
3855
- li as speechDuration,
3856
- Nn as stagePlanSpace,
3857
- ds as stickFigureAt,
3858
- ls as stickFigureJoints,
3859
- mi as stickFigureTarget,
3860
- xi as stickToHuman,
3861
- Bo as strideLength,
3862
- Fo as talkingMouth,
3863
- vt as taperedLine,
3864
- Ye as taperedOutline,
3865
- $o as walkPose,
3866
- Yi as withErased,
3867
- qe as withExpression
3858
+ dt as ACTING_STYLES,
3859
+ ve as DANCE_STYLES,
3860
+ X as EXPRESSIONS,
3861
+ yo as FINGERS,
3862
+ _t as FLIPS,
3863
+ Lt as GAGS,
3864
+ Ee as GAITS,
3865
+ Sn as GAIT_CYCLE_MS,
3866
+ Y as HAND_REST,
3867
+ q as HAND_SHAPES,
3868
+ ni as HUMAN_ACTING_RIG,
3869
+ dr as HUMAN_EXPRESSIONS,
3870
+ Xr as HUMAN_GAGS,
3871
+ cr as HUMAN_POSES,
3872
+ C as HUMAN_REST,
3873
+ ml as IDENTITY_CAMERA,
3874
+ nn as MUDRAS,
3875
+ Be as POSES,
3876
+ B as REST_POSE,
3877
+ Qr as STICK_ACTING_RIG,
3878
+ ue as VISEMES,
3879
+ il as actCharacterTracks,
3880
+ ro as actKeyframes,
3881
+ oi as actTracks,
3882
+ bl as applyCamera,
3883
+ xs as applyGroove,
3884
+ Fi as bakeDanceTracks,
3885
+ rl as basicOutfit,
3886
+ _i as beatAt,
3887
+ _e as blendPose,
3888
+ ho as boilFrame,
3889
+ wl as cameraFromValues,
3890
+ yl as cameraPoint,
3891
+ Mr as character,
3892
+ Ui as characterAt,
3893
+ Pr as characterHandPose,
3894
+ Tr as characterJoints,
3895
+ Di as characterJointsInView,
3896
+ Vi as characterObjects,
3897
+ zi as characterPoseTracks,
3898
+ Gi as characterTarget,
3899
+ Ji as circlePath,
3900
+ so as clipErased,
3901
+ Tn as createPen,
3902
+ Ot as danceFrame,
3903
+ Oi as dancePose,
3904
+ Mt as danceStance,
3905
+ Ii as danceTaps,
3906
+ Bi as danceTracks,
3907
+ lt as danceTravel,
3908
+ Os as danceTravelTrack,
3909
+ $i as dancer,
3910
+ Kt as drawCartoonHand,
3911
+ Wr as drawCharacter,
3912
+ Or as drawCharacterInView,
3913
+ al as drawDustPuff,
3914
+ eo as drawEraser,
3915
+ no as drawHand,
3916
+ hl as drawImpactStars,
3917
+ Nr as drawPencil,
3918
+ ri as drawSpeedLines,
3919
+ bs as drawStickFigure,
3920
+ ll as drawStickSmear,
3921
+ Zi as drawnPathTarget,
3922
+ Dt as ellipsePoints,
3923
+ tl as erasable,
3924
+ Vs as flipPose,
3925
+ Ri as flipTracks,
3926
+ js as flipTravel,
3927
+ un as gag,
3928
+ dn as gagDuration,
3929
+ Lo as gaitPose,
3930
+ Yo as gaitStrideLength,
3931
+ ji as handAt,
3932
+ yt as handJoints,
3933
+ Wo as handJointsAt,
3934
+ L as handPose,
3935
+ je as handProp,
3936
+ Pi as headPoint,
3937
+ Li as humanFieldLabel,
3938
+ sl as humanGag,
3939
+ nl as humanGaitPose,
3940
+ ol as humanGaitStrideLength,
3941
+ fr as humanPlan,
3942
+ te as humanPose,
3943
+ Ir as jointsInScene,
3944
+ ms as jointsToScene,
3945
+ lo as lipSyncKeyframes,
3946
+ di as lipSyncOver,
3947
+ cl as lipSyncTracks,
3948
+ Ni as mirrorHumanPose,
3949
+ Ts as mirrorPose,
3950
+ Ie as mixHandPoses,
3951
+ Xi as mixPoses,
3952
+ vn as partialPath,
3953
+ gl as pathLength,
3954
+ xt as pointAlong,
3955
+ Ci as pointOnHead,
3956
+ V as pose,
3957
+ Wi as poseTracks,
3958
+ qi as reachCharacter,
3959
+ Gr as resolveActingStyle,
3960
+ Qn as resolveCharacterPoseKeys,
3961
+ ot as resolveGait,
3962
+ Cn as resolvePoseKeys,
3963
+ Ln as resolveStickFrame,
3964
+ ws as resolveStickPose,
3965
+ pe as rotateAbout,
3966
+ It as routineBeats,
3967
+ He as rubberLimb,
3968
+ fl as scriptTracks,
3969
+ Qi as scrubPath,
3970
+ xi as seatHeight,
3971
+ Vn as skeletonInView,
3972
+ mt as sketchPen,
3973
+ Bt as solvePlanSpace,
3974
+ ui as soundsOf,
3975
+ Si as speechDuration,
3976
+ zn as stagePlanSpace,
3977
+ Ss as stickFigureAt,
3978
+ ps as stickFigureJoints,
3979
+ Ki as stickFigureTarget,
3980
+ Yi as stickToHuman,
3981
+ Xo as strideLength,
3982
+ qo as talkingMouth,
3983
+ Pt as taperedLine,
3984
+ qe as taperedOutline,
3985
+ Do as walkPose,
3986
+ el as withErased,
3987
+ We as withExpression
3868
3988
  };