@algorisys/tinyfly 0.76.0 → 0.78.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,6 +1,37 @@
1
- import { s as X, p as oe, a as ne } from "./sketch-CB6VNfnR.js";
2
- import { b as ht, c as at } from "./sketch-CB6VNfnR.js";
3
- const Y = {
1
+ import { s as xt, p as Dt, c as jt, b as ye } from "./sketch-CA8ZXhxI.js";
2
+ import { a as jn } from "./sketch-CA8ZXhxI.js";
3
+ import { createRandom as me, hashSeed as pe } from "@algorisys/tinyfly";
4
+ function ht(t, e, n) {
5
+ const o = t.length;
6
+ if (o < 2) return [];
7
+ const r = [], s = [], h = (i) => e + (n - e) * i / (o - 1);
8
+ return t.forEach((i, l) => {
9
+ const a = t[Math.max(0, l - 1)], c = t[Math.min(o - 1, l + 1)], g = Math.hypot(c.x - a.x, c.y - a.y) || 1, y = h(l) / 2, f = -(c.y - a.y) / g * y, d = (c.x - a.x) / g * y;
10
+ r.push({ x: i.x + f, y: i.y + d }), s.push({ x: i.x - f, y: i.y - d });
11
+ }), [...r, ...s.reverse()];
12
+ }
13
+ function Jt(t, e, n, o) {
14
+ const r = e.length;
15
+ if (r < 2) return;
16
+ const s = ht(e, n, o), h = (i) => n + (o - n) * i / (r - 1);
17
+ t.beginPath(), t.moveTo(s[0].x, s[0].y);
18
+ for (const i of s.slice(1)) t.lineTo(i.x, i.y);
19
+ t.closePath(), t.fill(), e.forEach((i, l) => {
20
+ l !== 0 && l !== r - 1 && r > 3 || (t.beginPath(), t.arc(i.x, i.y, h(l) / 2, 0, Math.PI * 2), t.fill());
21
+ });
22
+ }
23
+ function z(t, e, n, o, r = 16) {
24
+ const s = { x: 2 * e.x - (t.x + n.x) / 2, y: 2 * e.y - (t.y + n.y) / 2 }, h = [];
25
+ for (let i = 0; i <= r; i++) {
26
+ const l = i / r, a = l < 0.5 ? { x: t.x + (e.x - t.x) * 2 * l, y: t.y + (e.y - t.y) * 2 * l } : { x: e.x + (n.x - e.x) * (2 * l - 1), y: e.y + (n.y - e.y) * (2 * l - 1) }, c = 1 - l, g = {
27
+ x: c * c * t.x + 2 * c * l * s.x + l * l * n.x,
28
+ y: c * c * t.y + 2 * c * l * s.y + l * l * n.y
29
+ };
30
+ h.push({ x: a.x + (g.x - a.x) * o, y: a.y + (g.y - a.y) * o });
31
+ }
32
+ return h;
33
+ }
34
+ const G = {
4
35
  lean: 0,
5
36
  headTilt: 0,
6
37
  leftShoulder: 18,
@@ -26,10 +57,10 @@ const Y = {
26
57
  turn: 0,
27
58
  sit: 0
28
59
  };
29
- function P(e) {
30
- return { ...Y, ...e };
60
+ function B(t) {
61
+ return { ...G, ...t };
31
62
  }
32
- const le = {
63
+ const zt = {
33
64
  mouth: 0,
34
65
  smile: 0,
35
66
  mouthWidth: 1,
@@ -40,532 +71,1290 @@ const le = {
40
71
  browTilt: 0,
41
72
  lookX: 0,
42
73
  lookY: 0
43
- }, p = (e) => ({ ...le, ...e }), H = {
44
- neutral: le,
45
- happy: p({ smile: 0.9, leftBrow: 0.2, rightBrow: 0.2 }),
46
- joyful: p({ mouth: 0.6, smile: 1, mouthWidth: 1.2, leftEye: 0, rightEye: 0, leftBrow: 0.4, rightBrow: 0.4 }),
47
- sad: p({ smile: -0.8, leftEye: 0.8, rightEye: 0.8, browTilt: 0.9, leftBrow: -0.1, rightBrow: -0.1, lookY: 0.6 }),
48
- crying: p({ mouth: 0.45, smile: -1, leftEye: 0, rightEye: 0, browTilt: 1, lookY: 0.4 }),
49
- surprised: p({ mouth: 0.7, mouthWidth: 0.7, leftEye: 1.5, rightEye: 1.5, leftBrow: 1, rightBrow: 1 }),
50
- shocked: p({ mouth: 1, mouthWidth: 0.8, leftEye: 1.6, rightEye: 1.6, leftBrow: 1, rightBrow: 1, browTilt: 0.4 }),
51
- angry: p({ smile: -0.6, mouthWidth: 0.9, leftEye: 0.8, rightEye: 0.8, leftBrow: -0.6, rightBrow: -0.6, browTilt: -1 }),
52
- furious: p({ mouth: 0.5, smile: -1, mouthWidth: 1.3, leftEye: 0.9, rightEye: 0.9, leftBrow: -0.9, rightBrow: -0.9, browTilt: -1 }),
53
- worried: p({ smile: -0.3, mouthWidth: 0.8, leftEye: 1.1, rightEye: 1.1, leftBrow: 0.3, rightBrow: 0.3, browTilt: 0.8, lookX: -0.5 }),
54
- scared: p({ mouth: 0.35, smile: -0.5, mouthWidth: 0.8, leftEye: 1.45, rightEye: 1.45, leftBrow: 0.8, rightBrow: 0.8, browTilt: 0.9 }),
55
- confused: p({ smile: -0.2, mouthWidth: 0.8, leftEye: 0.9, rightEye: 1.15, leftBrow: -0.3, rightBrow: 0.8, lookX: 0.5, lookY: -0.4 }),
56
- skeptical: p({ smile: -0.1, leftEye: 0.6, rightEye: 1, leftBrow: -0.4, rightBrow: 0.7, lookX: 0.4 }),
57
- thinking: p({ smile: 0, mouthWidth: 0.7, leftBrow: 0.3, rightBrow: 0.5, lookX: 0.6, lookY: -0.8 }),
58
- sleepy: p({ smile: 0.1, leftEye: 0.25, rightEye: 0.25, leftBrow: -0.3, rightBrow: -0.3, lookY: 0.5 }),
59
- disgusted: p({ smile: -0.7, mouthWidth: 0.9, leftEye: 0.6, rightEye: 0.75, leftBrow: -0.5, rightBrow: -0.2, browTilt: -0.4, lookX: -0.6 }),
60
- smug: p({ smile: 0.6, mouthWidth: 0.9, leftEye: 0.6, rightEye: 0.6, leftBrow: 0.1, rightBrow: 0.5, lookX: 0.5 }),
61
- wink: p({ smile: 0.9, leftEye: 0, rightEye: 1, leftBrow: -0.2, rightBrow: 0.3 })
74
+ }, _ = (t) => ({ ...zt, ...t }), N = {
75
+ neutral: zt,
76
+ happy: _({ smile: 0.9, leftBrow: 0.2, rightBrow: 0.2 }),
77
+ joyful: _({ mouth: 0.6, smile: 1, mouthWidth: 1.2, leftEye: 0, rightEye: 0, leftBrow: 0.4, rightBrow: 0.4 }),
78
+ sad: _({ smile: -0.8, leftEye: 0.8, rightEye: 0.8, browTilt: 0.9, leftBrow: -0.1, rightBrow: -0.1, lookY: 0.6 }),
79
+ crying: _({ mouth: 0.45, smile: -1, leftEye: 0, rightEye: 0, browTilt: 1, lookY: 0.4 }),
80
+ surprised: _({ mouth: 0.7, mouthWidth: 0.7, leftEye: 1.5, rightEye: 1.5, leftBrow: 1, rightBrow: 1 }),
81
+ shocked: _({ mouth: 1, mouthWidth: 0.8, leftEye: 1.6, rightEye: 1.6, leftBrow: 1, rightBrow: 1, browTilt: 0.4 }),
82
+ angry: _({ smile: -0.6, mouthWidth: 0.9, leftEye: 0.8, rightEye: 0.8, leftBrow: -0.6, rightBrow: -0.6, browTilt: -1 }),
83
+ furious: _({ mouth: 0.5, smile: -1, mouthWidth: 1.3, leftEye: 0.9, rightEye: 0.9, leftBrow: -0.9, rightBrow: -0.9, browTilt: -1 }),
84
+ worried: _({ smile: -0.3, mouthWidth: 0.8, leftEye: 1.1, rightEye: 1.1, leftBrow: 0.3, rightBrow: 0.3, browTilt: 0.8, lookX: -0.5 }),
85
+ scared: _({ mouth: 0.35, smile: -0.5, mouthWidth: 0.8, leftEye: 1.45, rightEye: 1.45, leftBrow: 0.8, rightBrow: 0.8, browTilt: 0.9 }),
86
+ confused: _({ smile: -0.2, mouthWidth: 0.8, leftEye: 0.9, rightEye: 1.15, leftBrow: -0.3, rightBrow: 0.8, lookX: 0.5, lookY: -0.4 }),
87
+ skeptical: _({ smile: -0.1, leftEye: 0.6, rightEye: 1, leftBrow: -0.4, rightBrow: 0.7, lookX: 0.4 }),
88
+ thinking: _({ smile: 0, mouthWidth: 0.7, leftBrow: 0.3, rightBrow: 0.5, lookX: 0.6, lookY: -0.8 }),
89
+ sleepy: _({ smile: 0.1, leftEye: 0.25, rightEye: 0.25, leftBrow: -0.3, rightBrow: -0.3, lookY: 0.5 }),
90
+ disgusted: _({ smile: -0.7, mouthWidth: 0.9, leftEye: 0.6, rightEye: 0.75, leftBrow: -0.5, rightBrow: -0.2, browTilt: -0.4, lookX: -0.6 }),
91
+ smug: _({ smile: 0.6, mouthWidth: 0.9, leftEye: 0.6, rightEye: 0.6, leftBrow: 0.1, rightBrow: 0.5, lookX: 0.5 }),
92
+ wink: _({ smile: 0.9, leftEye: 0, rightEye: 1, leftBrow: -0.2, rightBrow: 0.3 })
62
93
  };
63
- function Ee(e, t) {
64
- return { ...e, ...typeof t == "string" ? H[t] : t };
65
- }
66
- const pe = {
67
- rest: Y,
68
- wave: P({ rightShoulder: 135, rightElbow: 30, headTilt: 6, ...H.happy }),
69
- cheer: P({ leftShoulder: 125, leftElbow: 20, rightShoulder: 125, rightElbow: 20, ...H.joyful }),
70
- shrug: P({ leftShoulder: 30, leftElbow: 85, rightShoulder: 30, rightElbow: 85, headTilt: -10, ...H.confused, lookX: 0, lookY: 0 }),
71
- point: P({ rightShoulder: 90, rightElbow: 0, lean: 4, smile: 0.4 }),
94
+ function we(t, e) {
95
+ return { ...t, ...typeof e == "string" ? N[e] : e };
96
+ }
97
+ const be = {
98
+ rest: G,
99
+ wave: B({ rightShoulder: 135, rightElbow: 30, headTilt: 6, ...N.happy }),
100
+ cheer: B({ leftShoulder: 125, leftElbow: 20, rightShoulder: 125, rightElbow: 20, ...N.joyful }),
101
+ shrug: B({ leftShoulder: 30, leftElbow: 85, rightShoulder: 30, rightElbow: 85, headTilt: -10, ...N.confused, lookX: 0, lookY: 0 }),
102
+ point: B({ rightShoulder: 90, rightElbow: 0, lean: 4, smile: 0.4 }),
72
103
  // The forearm passes 180° to fold back in, so the hand reaches the chin.
73
- think: P({ rightShoulder: 60, rightElbow: 150, headTilt: 10, ...H.thinking }),
74
- handsOnHips: P({ leftShoulder: 45, leftElbow: -100, rightShoulder: 45, rightElbow: -100, leftHip: 14, rightHip: 14, smile: 0.8 }),
75
- sad: P({ leftShoulder: 14, rightShoulder: 14, leftElbow: -4, rightElbow: -4, headTilt: -14, lean: -3, ...H.sad }),
76
- surprised: P({ leftShoulder: 70, leftElbow: 60, rightShoulder: 70, rightElbow: 60, ...H.surprised }),
104
+ think: B({ rightShoulder: 60, rightElbow: 150, headTilt: 10, ...N.thinking }),
105
+ handsOnHips: B({ leftShoulder: 45, leftElbow: -100, rightShoulder: 45, rightElbow: -100, leftHip: 14, rightHip: 14, smile: 0.8 }),
106
+ sad: B({ leftShoulder: 14, rightShoulder: 14, leftElbow: -4, rightElbow: -4, headTilt: -14, lean: -3, ...N.sad }),
107
+ surprised: B({ leftShoulder: 70, leftElbow: 60, rightShoulder: 70, rightElbow: 60, ...N.surprised }),
77
108
  // Squash and stretch: the wind-up before a jump (or the landing), and the jump itself.
78
- crouch: P({ stretch: 0.72, leftShoulder: 35, rightShoulder: 35, leftElbow: -50, rightElbow: -50, leftHip: 22, rightHip: 22, headTilt: -4 }),
109
+ crouch: B({ stretch: 0.72, leftShoulder: 35, rightShoulder: 35, leftElbow: -50, rightElbow: -50, leftHip: 22, rightHip: 22, headTilt: -4 }),
79
110
  // Seated, hands resting on the knees. Arm angles spread outward per side, so
80
111
  // reaching forward (+x, the way the figure faces) is negative for the left arm.
81
- sit: P({ sit: 1, turn: 0.5, leftShoulder: -25, rightShoulder: 25, leftElbow: -55, rightElbow: 55 }),
82
- jump: P({ stretch: 1.22, leftShoulder: 140, rightShoulder: 140, leftElbow: 20, rightElbow: 20, leftHip: 4, rightHip: 4, ...H.joyful })
83
- }, re = Object.keys(Y);
84
- function Me(e, t, o) {
85
- const l = { ...e };
86
- for (const n of re) l[n] = e[n] + (t[n] - e[n]) * o;
87
- return l;
88
- }
89
- const K = 24, Q = 4, Z = 28, Se = 40;
90
- function Te(e, t = Y, o = 1) {
91
- const l = Math.sin(e * Math.PI * 2) * o, n = Math.cos(e * Math.PI * 2) * o, s = (a) => a <= Se, h = (a) => s(a) ? 22 * l : a, i = s(t.leftShoulder) ? t.leftElbow - Z * Math.max(0, -l) : t.leftElbow, r = s(t.rightShoulder) ? t.rightElbow + Z * Math.max(0, l) : t.rightElbow;
112
+ sit: B({ sit: 1, turn: 0.5, leftShoulder: -25, rightShoulder: 25, leftElbow: -55, rightElbow: 55 }),
113
+ jump: B({ stretch: 1.22, leftShoulder: 140, rightShoulder: 140, leftElbow: 20, rightElbow: 20, leftHip: 4, rightHip: 4, ...N.joyful })
114
+ }, Gt = Object.keys(G);
115
+ function Me(t, e, n) {
116
+ const o = { ...t };
117
+ for (const r of Gt) o[r] = t[r] + (e[r] - t[r]) * n;
118
+ return o;
119
+ }
120
+ const St = 24, _t = 4, Yt = 28, ke = 40;
121
+ function Ee(t, e = G, n = 1) {
122
+ const o = Math.sin(t * Math.PI * 2) * n, r = Math.cos(t * Math.PI * 2) * n, s = (a) => a <= ke, h = (a) => s(a) ? 22 * o : a, i = s(e.leftShoulder) ? e.leftElbow - Yt * Math.max(0, -o) : e.leftElbow, l = s(e.rightShoulder) ? e.rightElbow + Yt * Math.max(0, o) : e.rightElbow;
92
123
  return {
93
- ...t,
124
+ ...e,
94
125
  // Lean into the walk, and keep the head a little more level than the body.
95
- lean: t.lean + Q * o,
96
- headTilt: t.headTilt - Q * 0.5 * o,
126
+ lean: e.lean + _t * n,
127
+ headTilt: e.headTilt - _t * 0.5 * n,
97
128
  leftElbow: i,
98
- rightElbow: r,
129
+ rightElbow: l,
99
130
  // Left foot forward while swing > 0, right foot back; then the other way.
100
- leftHip: -K * l,
101
- rightHip: -K * l,
131
+ leftHip: -St * o,
132
+ rightHip: -St * o,
102
133
  // The leg swinging forward lifts, its shin trailing backward (-x). A positive
103
134
  // knee folds toward the centre, which is backward only for the right leg.
104
- leftKnee: -30 * Math.max(0, n),
105
- rightKnee: 30 * Math.max(0, -n),
135
+ leftKnee: -30 * Math.max(0, r),
136
+ rightKnee: 30 * Math.max(0, -r),
106
137
  // Arms swing against the legs: left arm back while the left foot is forward.
107
- leftShoulder: h(t.leftShoulder),
108
- rightShoulder: h(t.rightShoulder)
138
+ leftShoulder: h(e.leftShoulder),
139
+ rightShoulder: h(e.rightShoulder)
109
140
  };
110
141
  }
111
- function Qe(e, t = 1) {
112
- return 4 * ((C + N) * e) * Math.sin(K * t * Math.PI / 180);
142
+ function Sn(t, e = 1) {
143
+ return 4 * ((Pt + ct) * t) * Math.sin(St * e * Math.PI / 180);
113
144
  }
114
- function ke(e) {
115
- const t = Math.abs(Math.sin(e / 65)), o = 0.55 + 0.45 * Math.sin(e / 310);
116
- return t * o;
145
+ function xe(t) {
146
+ const e = Math.abs(Math.sin(t / 65)), n = 0.55 + 0.45 * Math.sin(t / 310);
147
+ return e * n;
117
148
  }
118
- const se = 0.12, $ = 0.46, Pe = 1 - 2 * se, ve = 0.1, Be = 0.21, Ie = 0.19, C = 0.24, N = 0.22, ie = 0.12, We = 0.14, he = 0.33, V = 0.7, j = 0.3, He = 0.35, Re = [1.7, 1.05], Ye = [1.3, 0.75], ee = [1.45, 0.85], _e = [1.15, 0.75], te = 0.06, Ae = 0.65, Oe = 0.3, Le = 0.02, Fe = 0.012, Ne = 12, L = 90, xe = 0.25, Xe = 0.01, O = (e) => Math.min(1, Math.max(0, e ?? 0));
119
- function Ze(e, t = 1) {
120
- return N * e * t;
149
+ const Zt = 0.12, $t = 0.46, Se = 1 - 2 * Zt, Pe = 0.1, Te = 0.21, ve = 0.19, Pt = 0.24, ct = 0.22, Qt = 0.12, We = 0.14, Vt = 0.33, Bt = 0.7, Rt = 0.3, Oe = 0.35, Ie = [1.7, 1.05], Ae = [1.3, 0.75], Lt = [1.45, 0.85], He = [1.15, 0.75], Ft = 0.06, _e = 0.7, Ye = 0.65, $e = 0.3, Be = 0.02, Re = 0.012, Le = 12, Fe = 0.25, ot = 90, Ne = 0.25, Ce = 0.01, J = (t) => Math.min(1, Math.max(0, t ?? 0));
150
+ function Pn(t, e = 1) {
151
+ return ct * t * e;
121
152
  }
122
- const D = -0.12, ae = 0.4, W = (e) => e * Math.PI / 180, Ke = (e, t) => ({ x: t * Math.sin(W(e)), y: Math.cos(W(e)) }), fe = (e, t) => Math.max(0, e) * (1 - Math.min(1, Math.max(0, t))), ce = (e, t, o, l) => e - 0.3 * t - o * 0.14 * t - Math.max(0, l - 1) * 0.12 * t;
123
- function Ce(e, t, o, l, n, s) {
124
- const h = Math.max(1, Math.min(s * 0.6, We * o)), i = O(t.turn), r = (ie + he * i) * o, a = l + D * o, f = r + t.lookX * 0.08 * o, y = t.lookY * 0.07 * o, w = [
153
+ const Tt = -0.12, te = 0.4, C = (t) => t * Math.PI / 180, Xe = (t, e) => ({ x: e * Math.sin(C(t)), y: Math.cos(C(t)) }), ee = (t, e) => Math.max(0, t) * (1 - Math.min(1, Math.max(0, e))), ne = (t, e, n, o) => t - 0.3 * e - n * 0.14 * e - Math.max(0, o - 1) * 0.12 * e;
154
+ function qe(t, e, n, o, r, s) {
155
+ const h = Math.max(1, Math.min(s * 0.6, We * n)), i = J(e.turn), l = (Qt + Vt * i) * n, a = o + Tt * n, c = l + e.lookX * 0.08 * n, g = e.lookY * 0.07 * n, y = [
125
156
  // The left eye is on the far side; turning closes it up more than the near one.
126
- { x: -0.34 * o * (1 - V * i), squeeze: 1 - V * i, open: t.leftEye, brow: t.leftBrow, side: -1 },
127
- { x: 0.34 * o * (1 - j * i), squeeze: 1 - j * i, open: t.rightEye, brow: t.rightBrow, side: 1 }
157
+ { x: -0.34 * n * (1 - Bt * i), squeeze: 1 - Bt * i, open: e.leftEye, brow: e.leftBrow, side: -1 },
158
+ { x: 0.34 * n * (1 - Rt * i), squeeze: 1 - Rt * i, open: e.rightEye, brow: e.rightBrow, side: 1 }
128
159
  ];
129
- e.fillStyle = n, e.strokeStyle = n, e.lineWidth = h;
130
- for (const u of w) {
131
- const c = fe(u.open, t.blink);
132
- if (c < 0.2) {
133
- const B = t.smile > 0.5 ? -0.12 * o : 0.06 * o;
134
- e.beginPath(), e.moveTo(u.x + r - 0.12 * o, a), e.quadraticCurveTo(u.x + r, a + B, u.x + r + 0.12 * o, a), e.stroke();
160
+ t.fillStyle = r, t.strokeStyle = r, t.lineWidth = h;
161
+ for (const u of y) {
162
+ const k = ee(u.open, e.blink);
163
+ if (k < 0.2) {
164
+ const P = e.smile > 0.5 ? -0.12 * n : 0.06 * n;
165
+ t.beginPath(), t.moveTo(u.x + l - 0.12 * n, a), t.quadraticCurveTo(u.x + l, a + P, u.x + l + 0.12 * n, a), t.stroke();
135
166
  } else {
136
- if (c > 1.2) {
137
- const _ = 0.13 * o * c;
138
- e.beginPath(), e.ellipse(u.x + r, a, _ * 0.85, _, 0, 0, Math.PI * 2), e.fillStyle = "#ffffff", e.fill(), e.stroke(), e.fillStyle = n;
167
+ if (k > 1.2) {
168
+ const S = 0.13 * n * k;
169
+ t.beginPath(), t.ellipse(u.x + l, a, S * 0.85, S, 0, 0, Math.PI * 2), t.fillStyle = "#ffffff", t.fill(), t.stroke(), t.fillStyle = r;
139
170
  }
140
- const B = c > 1.2 ? 0.075 * o : 0.1 * o;
141
- e.beginPath(), e.ellipse(u.x + f, a + y, B, B * 1.1 * Math.min(c, 1), 0, 0, Math.PI * 2), e.fill();
171
+ const P = k > 1.2 ? 0.075 * n : 0.1 * n;
172
+ t.beginPath(), t.ellipse(u.x + c, a + g, P, P * 1.1 * Math.min(k, 1), 0, 0, Math.PI * 2), t.fill();
142
173
  }
143
- const g = ce(a, o, u.brow, c), v = u.x + r - u.side * 0.13 * o * u.squeeze, R = u.x + r + u.side * 0.13 * o * u.squeeze;
144
- e.beginPath(), e.moveTo(R, g), e.lineTo(v, g - t.browTilt * 0.1 * o), e.stroke();
174
+ const E = ne(a, n, u.brow, k), b = u.x + l - u.side * 0.13 * n * u.squeeze, M = u.x + l + u.side * 0.13 * n * u.squeeze;
175
+ t.beginPath(), t.moveTo(M, E), t.lineTo(b, E - e.browTilt * 0.1 * n), t.stroke();
145
176
  }
146
- const d = l + ae * o, m = 0.25 * o * Math.max(0.3, t.mouthWidth) * (1 - He * i), b = Math.min(1, Math.max(0, t.mouth));
147
- if (e.beginPath(), b <= 0.05) {
148
- e.moveTo(r - m, d), e.quadraticCurveTo(r, d + t.smile * 0.25 * o, r + m, d), e.stroke();
177
+ const f = o + te * n, d = 0.25 * n * Math.max(0.3, e.mouthWidth) * (1 - Oe * i), w = Math.min(1, Math.max(0, e.mouth));
178
+ if (t.beginPath(), w <= 0.05) {
179
+ t.moveTo(l - d, f), t.quadraticCurveTo(l, f + e.smile * 0.25 * n, l + d, f), t.stroke();
149
180
  return;
150
181
  }
151
- const E = 0.3 * o * b;
152
- t.smile > 0.3 ? (e.moveTo(r - m, d - 0.05 * o), e.lineTo(r + m, d - 0.05 * o), e.quadraticCurveTo(r, d + E * 2, r - m, d - 0.05 * o)) : t.smile < -0.3 ? (e.moveTo(r - m, d + E * 0.6), e.lineTo(r + m, d + E * 0.6), e.quadraticCurveTo(r, d - E * 1.4, r - m, d + E * 0.6)) : e.ellipse(r, d, m * 0.8, E, 0, 0, Math.PI * 2), e.fill();
153
- }
154
- function U(e, t, o, l, n = 16) {
155
- const s = { x: 2 * t.x - (e.x + o.x) / 2, y: 2 * t.y - (e.y + o.y) / 2 }, h = [];
156
- for (let i = 0; i <= n; i++) {
157
- const r = i / n, a = r < 0.5 ? { x: e.x + (t.x - e.x) * 2 * r, y: e.y + (t.y - e.y) * 2 * r } : { x: t.x + (o.x - t.x) * (2 * r - 1), y: t.y + (o.y - t.y) * (2 * r - 1) }, f = 1 - r, y = {
158
- x: f * f * e.x + 2 * f * r * s.x + r * r * o.x,
159
- y: f * f * e.y + 2 * f * r * s.y + r * r * o.y
160
- };
161
- h.push({ x: a.x + (y.x - a.x) * l, y: a.y + (y.y - a.y) * l });
162
- }
163
- return h;
182
+ const m = 0.3 * n * w;
183
+ e.smile > 0.3 ? (t.moveTo(l - d, f - 0.05 * n), t.lineTo(l + d, f - 0.05 * n), t.quadraticCurveTo(l, f + m * 2, l - d, f - 0.05 * n)) : e.smile < -0.3 ? (t.moveTo(l - d, f + m * 0.6), t.lineTo(l + d, f + m * 0.6), t.quadraticCurveTo(l, f - m * 1.4, l - d, f + m * 0.6)) : t.ellipse(l, f, d * 0.8, m, 0, 0, Math.PI * 2), t.fill();
164
184
  }
165
- function ye(e, t) {
166
- const o = t.height ?? 300, l = Math.min(3, Math.max(0.3, e.stretch ?? 1)), n = Math.sqrt(l), s = (t.headSize ?? 2 * se) / 2, h = t.headSize === void 0 ? Pe : 1 - 2 * s, i = s * o, r = O(e.sit), a = e.leftHip + (-L - e.leftHip) * r, f = e.leftKnee + (-L - e.leftKnee) * r, y = e.rightHip + (L - e.rightHip) * r, w = e.rightKnee + (L - e.rightKnee) * r, d = t.classic === !0, m = (M, T) => {
167
- const k = W(M - T) / 2;
168
- return d ? { x: 0, y: 0 } : { x: Math.cos(k) * te, y: Math.abs(Math.sin(k)) * te };
185
+ function oe(t, e) {
186
+ const n = e.height ?? 300, o = Math.min(3, Math.max(0.3, t.stretch ?? 1)), r = Math.sqrt(o), s = (e.headSize ?? 2 * Zt) / 2, h = e.headSize === void 0 ? Se : 1 - 2 * s, i = s * n, l = J(t.sit), a = t.leftHip + (-ot - t.leftHip) * l, c = t.leftKnee + (-ot - t.leftKnee) * l, g = t.rightHip + (ot - t.rightHip) * l, y = t.rightKnee + (ot - t.rightKnee) * l, f = e.classic === !0, d = J(t.turn), w = (x, p, T) => {
187
+ const v = C(p - T) / 2, O = d + (1 - d) * x * _e;
188
+ return f ? { x: 0, y: 0 } : { x: Math.cos(v) * Ft * O, y: Math.abs(Math.sin(v)) * Ft };
169
189
  };
170
- let b = 0;
171
- if (r > 0 || !d) {
172
- const M = (S, I) => C * Math.cos(W(S)) + N * Math.cos(W(S - I)) + m(S, I).y, T = Math.max(M(a, f), M(y, w)), k = d ? Math.min(1, r / xe) : 1;
173
- b = ($ - T) * k * o * l;
190
+ let m = 0;
191
+ if (l > 0 || !f) {
192
+ const x = (v, O, A) => Pt * Math.cos(C(O)) + ct * Math.cos(C(O - A)) + w(v, O, A).y, p = Math.max(x(-1, a, c), x(1, g, y)), T = f ? Math.min(1, l / Ne) : 1;
193
+ m = ($t - p) * T * n * o;
174
194
  }
175
- const E = -$ * o * l + b, u = -h * o * l + b, c = d ? 0 : (Le * O(e.turn) + Fe * r) * o * l, g = c === 0 ? [{ x: 0, y: E }, { x: 0, y: u }] : U({ x: 0, y: E }, { x: -c, y: (E + u) / 2 }, { x: 0, y: u }, 1, 8), v = u + ve * o * l, R = (t.shoulderWidth ?? 0) * o * Math.cos(O(e.turn) * Math.PI / 2), B = (M, T, k, S, I) => {
176
- const z = Ke(k, S);
177
- return { x: M + z.x * I * o, y: T + z.y * I * o };
178
- }, _ = (M, T, k) => {
179
- const S = B(0, E, T, M, C * l);
180
- return { root: { x: 0, y: E }, joint: S, end: B(S.x, S.y, T - k, M, N * l) };
181
- }, G = (M, T, k) => {
182
- const S = { x: M * R, y: v }, I = B(S.x, S.y, T, M, Be * n);
183
- return { root: S, joint: I, end: B(I.x, I.y, T + k, M, Ie * n) };
184
- }, x = { left: _(-1, a, f), right: _(1, y, w) }, J = (M, T, k) => {
185
- const S = m(T, k);
186
- return { x: M.end.x + S.x * o * l, y: M.end.y + S.y * o * l };
195
+ const u = -$t * n * o + m, k = -h * n * o + m, E = f ? 0 : (Be * J(t.turn) + Re * l) * n * o, b = E === 0 ? [{ x: 0, y: u }, { x: 0, y: k }] : z({ x: 0, y: u }, { x: -E, y: (u + k) / 2 }, { x: 0, y: k }, 1, 8), M = k + Pe * n * o, P = (e.shoulderWidth ?? 0) * n * Math.cos(d * Math.PI / 2), S = (x, p, T, v, O) => {
196
+ const A = Xe(T, v);
197
+ return { x: x + A.x * O * n, y: p + A.y * O * n };
198
+ }, W = (x, p, T) => {
199
+ const v = S(0, u, p, x, Pt * o);
200
+ return { root: { x: 0, y: u }, joint: v, end: S(v.x, v.y, p - T, x, ct * o) };
201
+ }, H = (x, p, T) => {
202
+ const v = { x: x * P, y: M }, O = S(v.x, v.y, p, x, Te * r);
203
+ return { root: v, joint: O, end: S(O.x, O.y, p + T, x, ve * r) };
204
+ }, Y = { left: W(-1, a, c), right: W(1, g, y) }, I = (x, p, T, v) => {
205
+ const O = w(x, T, v);
206
+ return { x: p.end.x + O.x * n * o, y: p.end.y + O.y * n * o };
187
207
  };
188
208
  return {
189
- height: o,
190
- facing: (t.facing ?? 1) < 0 ? -1 : 1,
191
- stretch: l,
192
- lineWidth: t.lineWidth ?? o * 0.025,
193
- rubber: Math.min(1, Math.max(d ? 0 : Oe, t.rubber ?? 0)),
209
+ height: n,
210
+ facing: (e.facing ?? 1) < 0 ? -1 : 1,
211
+ stretch: o,
212
+ lineWidth: e.lineWidth ?? n * 0.025,
213
+ rubber: Math.min(1, Math.max(f ? 0 : $e, e.rubber ?? 0)),
194
214
  r: i,
195
215
  // The head keeps its area: taller and narrower when stretched.
196
- headRx: i / Math.sqrt(l),
197
- headRy: i * Math.sqrt(l),
198
- hipY: E,
199
- neckY: u,
200
- drop: b,
201
- lean: d ? e.lean : e.lean + Ne * Math.sin(Math.PI * r),
202
- classic: d,
203
- legs: x,
204
- toes: { left: J(x.left, a, f), right: J(x.right, y, w) },
205
- spine: g,
216
+ headRx: i / Math.sqrt(o),
217
+ headRy: i * Math.sqrt(o),
218
+ hipY: u,
219
+ neckY: k,
220
+ drop: m,
221
+ lean: f ? t.lean : t.lean + Le * Math.sin(Math.PI * l),
222
+ classic: f,
223
+ legs: Y,
224
+ toes: { left: I(-1, Y.left, a, c), right: I(1, Y.right, g, y) },
225
+ spine: b,
206
226
  arms: {
207
- left: G(-1, e.leftShoulder, e.leftElbow),
208
- right: G(1, e.rightShoulder, e.rightElbow)
227
+ left: H(-1, t.leftShoulder, t.leftElbow),
228
+ right: H(1, t.rightShoulder, t.rightElbow)
209
229
  }
210
230
  };
211
231
  }
212
- const A = (e, t) => t === 0 ? [e.root, e.joint, e.end] : U(e.root, e.joint, e.end, t);
213
- function q(e, t, o) {
214
- const l = Math.cos(o), n = Math.sin(o), s = e.x - t.x, h = e.y - t.y;
215
- return { x: t.x + s * l - h * n, y: t.y + s * n + h * l };
232
+ const V = (t, e) => e === 0 ? [t.root, t.joint, t.end] : z(t.root, t.joint, t.end, e);
233
+ function vt(t, e, n) {
234
+ const o = Math.cos(n), r = Math.sin(n), s = t.x - e.x, h = t.y - e.y;
235
+ return { x: e.x + s * o - h * r, y: e.y + s * r + h * o };
216
236
  }
217
- function de(e, t) {
218
- const o = W(e.lean), l = W(t.headTilt), n = { x: 0, y: e.hipY }, s = (u) => ({ x: e.facing * u.x, y: u.y }), h = (u) => s(q(u, n, o)), i = (u) => h(q({ x: u.x, y: u.y + e.neckY }, { x: 0, y: e.neckY }, l)), r = A(e.arms.left, e.rubber).map(h), a = A(e.arms.right, e.rubber).map(h), f = (u) => {
219
- const [c, g] = u.slice(-2);
220
- return Math.atan2(g.y - c.y, g.x - c.x);
237
+ function se(t, e) {
238
+ const n = C(t.lean), o = C(e.headTilt), r = { x: 0, y: t.hipY }, s = (u) => ({ x: t.facing * u.x, y: u.y }), h = (u) => s(vt(u, r, n)), i = (u) => h(vt({ x: u.x, y: u.y + t.neckY }, { x: 0, y: t.neckY }, o)), l = V(t.arms.left, t.rubber).map(h), a = V(t.arms.right, t.rubber).map(h), c = (u) => {
239
+ const [k, E] = u.slice(-2);
240
+ return Math.atan2(E.y - k.y, E.x - k.x);
221
241
  };
222
- let y = 1 / 0;
223
- for (const [u, c] of [
224
- [t.leftBrow, t.leftEye],
225
- [t.rightBrow, t.rightEye]
242
+ let g = 1 / 0;
243
+ for (const [u, k] of [
244
+ [e.leftBrow, e.leftEye],
245
+ [e.rightBrow, e.rightEye]
226
246
  ]) {
227
- const g = ce(D, 1, u, fe(c, t.blink));
228
- y = Math.min(y, g, g - t.browTilt * 0.1);
247
+ const E = ne(Tt, 1, u, ee(k, e.blink));
248
+ g = Math.min(g, E, E - e.browTilt * 0.1);
229
249
  }
230
- const w = { left: s(e.legs.left.end), right: s(e.legs.right.end) }, d = { left: s(e.toes.left), right: s(e.toes.right) }, m = { left: Math.max(w.left.y, d.left.y), right: Math.max(w.right.y, d.right.y) }, b = Math.max(m.left, m.right), E = Xe * e.height;
250
+ const y = { left: s(t.legs.left.end), right: s(t.legs.right.end) }, f = { left: s(t.toes.left), right: s(t.toes.right) }, d = { left: Math.max(y.left.y, f.left.y), right: Math.max(y.right.y, f.right.y) }, w = Math.max(d.left, d.right), m = Ce * t.height;
231
251
  return {
232
- facing: e.facing,
233
- height: e.height,
234
- stretch: e.stretch,
235
- lineWidth: e.lineWidth,
236
- hip: n,
237
- neck: h({ x: 0, y: e.neckY }),
238
- shoulders: { left: h(e.arms.left.root), right: h(e.arms.right.root) },
239
- elbows: { left: h(e.arms.left.joint), right: h(e.arms.right.joint) },
240
- hands: { left: h(e.arms.left.end), right: h(e.arms.right.end) },
241
- knees: { left: s(e.legs.left.joint), right: s(e.legs.right.joint) },
242
- feet: w,
243
- toes: d,
244
- feetY: b,
245
- grounded: { left: m.left >= b - E, right: m.right >= b - E },
246
- handAngle: { left: f(r), right: f(a) },
252
+ facing: t.facing,
253
+ height: t.height,
254
+ stretch: t.stretch,
255
+ lineWidth: t.lineWidth,
256
+ hip: r,
257
+ neck: h({ x: 0, y: t.neckY }),
258
+ shoulders: { left: h(t.arms.left.root), right: h(t.arms.right.root) },
259
+ elbows: { left: h(t.arms.left.joint), right: h(t.arms.right.joint) },
260
+ hands: { left: h(t.arms.left.end), right: h(t.arms.right.end) },
261
+ knees: { left: s(t.legs.left.joint), right: s(t.legs.right.joint) },
262
+ feet: y,
263
+ toes: f,
264
+ feetY: w,
265
+ grounded: { left: d.left >= w - m, right: d.right >= w - m },
266
+ handAngle: { left: c(l), right: c(a) },
247
267
  limbs: {
248
- leftArm: r,
268
+ leftArm: l,
249
269
  rightArm: a,
250
- leftLeg: A(e.legs.left, e.rubber).map(s),
251
- rightLeg: A(e.legs.right, e.rubber).map(s),
252
- spine: e.spine.map(h)
270
+ leftLeg: V(t.legs.left, t.rubber).map(s),
271
+ rightLeg: V(t.legs.right, t.rubber).map(s),
272
+ spine: t.spine.map(h)
253
273
  },
254
274
  head: {
255
- center: i({ x: 0, y: -e.headRy }),
256
- rx: e.headRx,
257
- ry: e.headRy,
275
+ center: i({ x: 0, y: -t.headRy }),
276
+ rx: t.headRx,
277
+ ry: t.headRy,
258
278
  // Mirroring a turn reverses it.
259
- angle: e.facing * (o + l),
260
- eyeY: D,
261
- browTopY: y,
262
- mouthY: ae,
263
- faceX: e.facing * (ie + he * O(t.turn))
279
+ angle: t.facing * (n + o),
280
+ eyeY: Tt,
281
+ browTopY: g,
282
+ mouthY: te,
283
+ faceX: t.facing * (Qt + Vt * J(e.turn))
264
284
  }
265
285
  };
266
286
  }
267
- function De(e, t = {}) {
268
- return de(ye(e, t), e);
287
+ function Ue(t, e = {}) {
288
+ return se(oe(t, e), t);
269
289
  }
270
- function $e(e, t, o) {
271
- return q({ x: e.center.x + t * e.rx, y: e.center.y + o * e.ry }, e.center, e.angle);
290
+ function Tn(t, e, n) {
291
+ return vt({ x: t.center.x + e * t.rx, y: t.center.y + n * t.ry }, t.center, t.angle);
272
292
  }
273
- function qe(e, t, o) {
274
- const l = (s) => ({ x: s.x + t, y: s.y + o }), n = (s) => ({ left: l(s.left), right: l(s.right) });
293
+ function Ke(t, e, n) {
294
+ const o = (s) => ({ x: s.x + e, y: s.y + n }), r = (s) => ({ left: o(s.left), right: o(s.right) });
275
295
  return {
276
- ...e,
277
- hip: l(e.hip),
278
- neck: l(e.neck),
279
- shoulders: n(e.shoulders),
280
- elbows: n(e.elbows),
281
- hands: n(e.hands),
282
- knees: n(e.knees),
283
- feet: n(e.feet),
284
- toes: n(e.toes),
285
- feetY: e.feetY + o,
286
- grounded: { ...e.grounded },
287
- handAngle: { ...e.handAngle },
296
+ ...t,
297
+ hip: o(t.hip),
298
+ neck: o(t.neck),
299
+ shoulders: r(t.shoulders),
300
+ elbows: r(t.elbows),
301
+ hands: r(t.hands),
302
+ knees: r(t.knees),
303
+ feet: r(t.feet),
304
+ toes: r(t.toes),
305
+ feetY: t.feetY + n,
306
+ grounded: { ...t.grounded },
307
+ handAngle: { ...t.handAngle },
288
308
  limbs: {
289
- leftArm: e.limbs.leftArm.map(l),
290
- rightArm: e.limbs.rightArm.map(l),
291
- leftLeg: e.limbs.leftLeg.map(l),
292
- rightLeg: e.limbs.rightLeg.map(l),
293
- spine: e.limbs.spine.map(l)
309
+ leftArm: t.limbs.leftArm.map(o),
310
+ rightArm: t.limbs.rightArm.map(o),
311
+ leftLeg: t.limbs.leftLeg.map(o),
312
+ rightLeg: t.limbs.rightLeg.map(o),
313
+ spine: t.limbs.spine.map(o)
294
314
  },
295
- head: { ...e.head, center: l(e.head.center) }
315
+ head: { ...t.head, center: o(t.head.center) }
296
316
  };
297
317
  }
298
- function Ue(e, t, o, l) {
299
- const n = t.length;
300
- if (n < 2) return;
301
- const s = [], h = [], i = (r) => o + (l - o) * r / (n - 1);
302
- t.forEach((r, a) => {
303
- const f = t[Math.max(0, a - 1)], y = t[Math.min(n - 1, a + 1)], w = Math.hypot(y.x - f.x, y.y - f.y) || 1, d = i(a) / 2, m = -(y.y - f.y) / w * d, b = (y.x - f.x) / w * d;
304
- s.push({ x: r.x + m, y: r.y + b }), h.push({ x: r.x - m, y: r.y - b });
305
- }), e.beginPath(), e.moveTo(s[0].x, s[0].y);
306
- for (const r of s.slice(1)) e.lineTo(r.x, r.y);
307
- for (const r of h.reverse()) e.lineTo(r.x, r.y);
308
- e.closePath(), e.fill(), t.forEach((r, a) => {
309
- a !== 0 && a !== n - 1 && n > 3 || (e.beginPath(), e.arc(r.x, r.y, i(a) / 2, 0, Math.PI * 2), e.fill());
310
- });
311
- }
312
- function Ge(e, t, o = {}, l = 0) {
313
- const n = ye(t, o), s = o.color ?? "#1e293b", h = o.layers ?? {}, i = o.layers ? de(n, t) : void 0, r = o.sketch ? X(e, o.sketch, l) : void 0, a = o.sketch && o.layers ? X(e, o.sketch, l) : void 0, f = (c) => {
314
- e.save(), c(), e.restore();
315
- }, y = (c) => {
316
- c && i && f(() => c(e, i, l, a));
317
- }, w = () => e.scale(n.facing, 1), d = () => {
318
- w(), e.translate(0, n.hipY), e.rotate(W(n.lean)), e.translate(0, -n.hipY);
319
- }, m = (c, g, v) => {
320
- if (r) return g ? r.curve(c) : r.line(c);
321
- if (n.classic) {
322
- e.beginPath(), e.moveTo(c[0].x, c[0].y);
323
- for (const R of c.slice(1)) e.lineTo(R.x, R.y);
324
- e.stroke();
318
+ function De(t, e, n = {}, o = 0) {
319
+ const r = oe(e, n), s = n.color ?? "#1e293b", h = n.layers ?? {}, i = n.layers ? se(r, e) : void 0, l = n.sketch ? xt(t, n.sketch, o) : void 0, a = n.sketch && n.layers ? xt(t, n.sketch, o) : void 0, c = (b) => {
320
+ t.save(), b(), t.restore();
321
+ }, g = (b) => {
322
+ b && i && c(() => b(t, i, o, a));
323
+ }, y = () => t.scale(r.facing, 1), f = () => {
324
+ y(), t.translate(0, r.hipY), t.rotate(C(r.lean)), t.translate(0, -r.hipY);
325
+ }, d = (b, M, P) => {
326
+ if (l) return M ? l.curve(b) : l.line(b);
327
+ if (r.classic) {
328
+ t.beginPath(), t.moveTo(b[0].x, b[0].y);
329
+ for (const S of b.slice(1)) t.lineTo(S.x, S.y);
330
+ t.stroke();
325
331
  return;
326
332
  }
327
- Ue(e, c, v[0] * n.lineWidth, v[1] * n.lineWidth);
328
- }, b = (c, g) => m(A(c, n.rubber), n.rubber > 0, g), E = (c) => {
329
- n.classic || m([n.legs[c].end, n.toes[c]], !1, _e);
330
- }, u = (c) => {
331
- if (n.classic || r) return;
332
- const g = n.arms[c].end;
333
- e.beginPath(), e.arc(g.x, g.y, Ae * n.lineWidth, 0, Math.PI * 2), e.fill();
333
+ Jt(t, b, P[0] * r.lineWidth, P[1] * r.lineWidth);
334
+ }, w = (b, M) => d(V(b, r.rubber), r.rubber > 0, M), m = (b) => {
335
+ r.classic || d([r.legs[b].end, r.toes[b]], !1, He);
336
+ }, u = (b) => {
337
+ if (r.classic || l) return;
338
+ const M = r.arms[b].end;
339
+ t.beginPath(), t.arc(M.x, M.y, Ye * r.lineWidth, 0, Math.PI * 2), t.fill();
334
340
  };
335
- e.save(), e.strokeStyle = s, e.fillStyle = s, e.lineWidth = n.lineWidth, e.lineCap = "round", e.lineJoin = "round", y(h.behind), f(() => {
336
- w(), b(n.legs.left, ee), E("left"), b(n.legs.right, ee), E("right");
337
- }), f(() => {
338
- d(), m(n.spine, n.spine.length > 2, Re);
339
- const { left: c, right: g } = { left: n.arms.left.root, right: n.arms.right.root };
340
- if (c.x !== g.x)
341
- if (n.classic) m([c, g], !1, [1, 1]);
341
+ t.save(), t.strokeStyle = s, t.fillStyle = s, t.lineWidth = r.lineWidth, t.lineCap = "round", t.lineJoin = "round";
342
+ const k = (b) => {
343
+ c(() => {
344
+ f(), w(r.arms[b], Ae), u(b);
345
+ });
346
+ const M = h.sleeve;
347
+ M && i && c(() => M(t, i, b, o, a));
348
+ }, E = J(e.turn) > Fe;
349
+ g(h.behind), c(() => {
350
+ y(), w(r.legs.left, Lt), m("left"), w(r.legs.right, Lt), m("right");
351
+ }), E && k("left"), c(() => {
352
+ f(), d(r.spine, r.spine.length > 2, Ie);
353
+ const { left: b, right: M } = { left: r.arms.left.root, right: r.arms.right.root };
354
+ if (b.x !== M.x)
355
+ if (r.classic) d([b, M], !1, [1, 1]);
342
356
  else {
343
- const v = { x: (c.x + g.x) / 2, y: c.y - 0.3 * Math.abs(g.x - c.x) };
344
- m(U(c, v, g, 1, 8), !0, [1.1, 1.1]);
357
+ const P = { x: (b.x + M.x) / 2, y: b.y - 0.3 * Math.abs(M.x - b.x) };
358
+ d(z(b, P, M, 1, 8), !0, [1.1, 1.1]);
345
359
  }
346
- }), y(h.body);
347
- for (const c of ["left", "right"]) {
348
- f(() => {
349
- d(), b(n.arms[c], Ye), u(c);
350
- });
351
- const g = h.sleeve;
352
- g && i && f(() => g(e, i, c, l, a));
353
- }
354
- y(h.behindHead), f(() => {
355
- d(), e.translate(0, n.neckY), e.rotate(W(t.headTilt));
356
- const c = -n.headRy;
357
- e.beginPath(), e.ellipse(0, c, n.headRx, n.headRy, 0, 0, Math.PI * 2);
358
- const g = o.headFill ?? "#ffffff";
359
- if (g !== "none" && (e.fillStyle = g, e.fill()), r) {
360
- r.ellipse(0, c, n.headRx, n.headRy);
361
- const v = r.nudge();
362
- e.translate(v.x, v.y);
360
+ }), g(h.body), E || k("left"), k("right"), g(h.behindHead), c(() => {
361
+ f(), t.translate(0, r.neckY), t.rotate(C(e.headTilt));
362
+ const b = -r.headRy;
363
+ t.beginPath(), t.ellipse(0, b, r.headRx, r.headRy, 0, 0, Math.PI * 2);
364
+ const M = n.headFill ?? "#ffffff";
365
+ if (M !== "none" && (t.fillStyle = M, t.fill()), l) {
366
+ l.ellipse(0, b, r.headRx, r.headRy);
367
+ const P = l.nudge();
368
+ t.translate(P.x, P.y);
363
369
  } else
364
- e.stroke();
365
- e.translate(0, c), e.scale(n.headRx / n.r, n.headRy / n.r), Ce(e, t, n.r, 0, s, n.lineWidth);
366
- }), y(h.overHead), y(h.front), e.restore(), o.label && (e.save(), e.fillStyle = s, e.font = o.labelFont ?? `700 ${Math.round(n.height * 0.11)}px sans-serif`, e.textAlign = "center", e.textBaseline = "bottom", e.fillText(o.label, 0, -n.height * n.stretch - 0.04 * n.height + n.drop), e.restore());
370
+ t.stroke();
371
+ t.translate(0, b), t.scale(r.headRx / r.r, r.headRy / r.r), qe(t, e, r.r, 0, s, r.lineWidth);
372
+ }), g(h.overHead), g(h.front), t.restore(), n.label && (t.save(), t.fillStyle = s, t.font = n.labelFont ?? `700 ${Math.round(r.height * 0.11)}px sans-serif`, t.textAlign = "center", t.textBaseline = "bottom", t.fillText(n.label, 0, -r.height * r.stretch - 0.04 * r.height + r.drop), t.restore());
367
373
  }
368
- function ue(e, t) {
369
- const o = { ...e };
370
- let l = e.walking > 0 ? Me(o, Te(e.walk, o), e.walking) : o;
371
- return e.talk > 0 && (l = { ...l, mouth: Math.max(l.mouth, e.talk * ke(t)) }), l;
374
+ function re(t, e) {
375
+ const n = { ...t };
376
+ let o = t.walking > 0 ? Me(n, Ee(t.walk, n), t.walking) : n;
377
+ return t.talk > 0 && (o = { ...o, mouth: Math.max(o.mouth, t.talk * xe(e)) }), o;
372
378
  }
373
- function Ve(e) {
374
- const t = e.style ?? {}, o = t.height ?? 300, l = o * 0.8, n = { ...P(e.pose ?? {}), walk: 0, walking: 0, talk: 0, rubber: t.rubber ?? 0 };
379
+ function vn(t) {
380
+ const e = t.style ?? {}, n = e.height ?? 300, o = n * 0.8, r = { ...B(t.pose ?? {}), walk: 0, walking: 0, talk: 0, rubber: e.rubber ?? 0 };
375
381
  return {
376
382
  type: "custom",
377
- x: e.x - l / 2,
378
- y: e.y - o,
379
- width: l,
380
- height: o,
381
- props: { ...n },
382
- figureStyle: t,
383
+ x: t.x - o / 2,
384
+ y: t.y - n,
385
+ width: o,
386
+ height: n,
387
+ props: { ...r },
388
+ figureStyle: e,
383
389
  draw(s, h, i) {
384
- const r = h.props;
385
- s.translate(l / 2, o), Ge(s, ue(r, i), { ...t, rubber: r.rubber }, i);
390
+ const l = h.props;
391
+ s.translate(o / 2, n), De(s, re(l, i), { ...e, rubber: l.rubber }, i);
386
392
  }
387
393
  };
388
394
  }
389
- function je(e, t, o) {
390
- const l = e.figureStyle;
391
- if (!l) throw new Error("stickFigureAt: the target was not made by stickFigureTarget");
392
- const n = { ...e.props };
395
+ function Wn(t, e, n) {
396
+ const o = t.figureStyle;
397
+ if (!o) throw new Error("stickFigureAt: the target was not made by stickFigureTarget");
398
+ const r = { ...t.props };
393
399
  let s = 0, h = 0;
394
- for (const [a, f] of t.state?.values.get(o) ?? [])
395
- typeof f == "number" && (a === "x" || a === "motionPathX" ? s = f : a === "y" || a === "motionPathY" ? h = f : a in n && (n[a] = f));
396
- const i = ue(n, t.time), r = De(i, { ...l, rubber: n.rubber });
397
- return { pose: i, joints: qe(r, e.x + s + e.width / 2, e.y + h + e.height) };
400
+ for (const [a, c] of e.state?.values.get(n) ?? [])
401
+ typeof c == "number" && (a === "x" || a === "motionPathX" ? s = c : a === "y" || a === "motionPathY" ? h = c : a in r && (r[a] = c));
402
+ const i = re(r, e.time), l = Ue(i, { ...o, rubber: r.rubber });
403
+ return { pose: i, joints: Ke(l, t.x + s + t.width / 2, t.y + h + t.height) };
398
404
  }
399
- function et(e, t) {
400
- const o = [];
401
- return t.forEach((l, n) => {
402
- const s = n === 0 ? Y : o[n - 1], h = typeof l.pose == "string" ? pe[l.pose] : { ...s, ...l.pose };
403
- o.push(l.expression ? Ee(h, l.expression) : h);
404
- }), re.filter((l) => o.some((n) => n[l] !== Y[l])).map((l) => ({
405
- id: `${e}-${l}`,
406
- target: e,
407
- property: l,
408
- keyframes: t.map((n, s) => ({
409
- time: n.time,
410
- value: o[s][l],
411
- ...n.easing ? { easing: n.easing } : {}
405
+ function On(t, e) {
406
+ const n = [];
407
+ return e.forEach((o, r) => {
408
+ const s = r === 0 ? G : n[r - 1], h = typeof o.pose == "string" ? be[o.pose] : { ...s, ...o.pose };
409
+ n.push(o.expression ? we(h, o.expression) : h);
410
+ }), Gt.filter((o) => n.some((r) => r[o] !== G[o])).map((o) => ({
411
+ id: `${t}-${o}`,
412
+ target: t,
413
+ property: o,
414
+ keyframes: e.map((r, s) => ({
415
+ time: r.time,
416
+ value: n[s][o],
417
+ ...r.easing ? { easing: r.easing } : {}
412
418
  }))
413
419
  }));
414
420
  }
415
- function Je(e, t, o = {}, l) {
416
- const n = o.length ?? 240, s = 9, h = 28, i = n - 22;
417
- e.save(), e.translate(t.x, t.y), e.rotate((o.angle ?? -30) * Math.PI / 180), e.fillStyle = o.color ?? "#f4c542", e.fillRect(h, -s, i - h, 2 * s), e.fillStyle = "#e8b4a0", e.fillRect(i, -s, n - i, 2 * s), e.fillStyle = "#f1dcbf", e.beginPath(), e.moveTo(0, 0), e.lineTo(h, -s), e.lineTo(h, s), e.closePath(), e.fill(), e.fillStyle = o.outline ?? "#2f2f33", e.beginPath(), e.moveTo(0, 0), e.lineTo(h * 0.35, -s * 0.35), e.lineTo(h * 0.35, s * 0.35), e.closePath(), e.fill(), e.strokeStyle = o.outline ?? "#2f2f33", e.lineWidth = 3, e.lineJoin = "round", e.lineCap = "round";
418
- const r = [
419
- [{ x: 0, y: 0 }, { x: h, y: -s }, { x: n, y: -s }, { x: n, y: s }, { x: h, y: s }, { x: 0, y: 0 }],
421
+ function je(t, e, n = {}, o) {
422
+ const r = n.length ?? 240, s = 9, h = 28, i = r - 22;
423
+ t.save(), t.translate(e.x, e.y), t.rotate((n.angle ?? -30) * Math.PI / 180), t.fillStyle = n.color ?? "#f4c542", t.fillRect(h, -s, i - h, 2 * s), t.fillStyle = "#e8b4a0", t.fillRect(i, -s, r - i, 2 * s), t.fillStyle = "#f1dcbf", t.beginPath(), t.moveTo(0, 0), t.lineTo(h, -s), t.lineTo(h, s), t.closePath(), t.fill(), t.fillStyle = n.outline ?? "#2f2f33", t.beginPath(), t.moveTo(0, 0), t.lineTo(h * 0.35, -s * 0.35), t.lineTo(h * 0.35, s * 0.35), t.closePath(), t.fill(), t.strokeStyle = n.outline ?? "#2f2f33", t.lineWidth = 3, t.lineJoin = "round", t.lineCap = "round";
424
+ const l = [
425
+ [{ x: 0, y: 0 }, { x: h, y: -s }, { x: r, y: -s }, { x: r, y: s }, { x: h, y: s }, { x: 0, y: 0 }],
420
426
  [{ x: h, y: -s }, { x: h, y: s }],
421
427
  [{ x: i, y: -s }, { x: i, y: s }]
422
428
  ];
423
- for (const a of r) we(e, a, l);
424
- e.restore();
429
+ for (const a of l) he(t, a, o);
430
+ t.restore();
425
431
  }
426
- function me(e, t, o = {}, l) {
427
- const n = o.length ?? 90, s = o.thickness ?? 34;
428
- e.save(), e.translate(t.x, t.y), e.rotate((o.angle ?? -35) * Math.PI / 180);
432
+ function ie(t, e, n = {}, o) {
433
+ const r = n.length ?? 90, s = n.thickness ?? 34;
434
+ t.save(), t.translate(e.x, e.y), t.rotate((n.angle ?? -35) * Math.PI / 180);
429
435
  const h = -s / 2;
430
- e.fillStyle = o.color ?? "#f4a7b9", e.fillRect(0, h, n, s), e.fillStyle = "#e9edf2", e.fillRect(n * 0.45, h, n * 0.55, s), e.strokeStyle = o.outline ?? "#2f2f33", e.lineWidth = 3, e.lineJoin = "round";
436
+ t.fillStyle = n.color ?? "#f4a7b9", t.fillRect(0, h, r, s), t.fillStyle = "#e9edf2", t.fillRect(r * 0.45, h, r * 0.55, s), t.strokeStyle = n.outline ?? "#2f2f33", t.lineWidth = 3, t.lineJoin = "round";
431
437
  const i = [
432
438
  { x: 0, y: h },
433
- { x: n, y: h },
434
- { x: n, y: -h },
439
+ { x: r, y: h },
440
+ { x: r, y: -h },
435
441
  { x: 0, y: -h },
436
442
  { x: 0, y: h }
437
- ], r = [{ x: n * 0.45, y: h }, { x: n * 0.45, y: -h }];
438
- if (l)
439
- l.line(i), l.line(r);
443
+ ], l = [{ x: r * 0.45, y: h }, { x: r * 0.45, y: -h }];
444
+ if (o)
445
+ o.line(i), o.line(l);
440
446
  else
441
- for (const a of [i, r]) {
442
- e.beginPath(), e.moveTo(a[0].x, a[0].y);
443
- for (const f of a.slice(1)) e.lineTo(f.x, f.y);
444
- e.stroke();
447
+ for (const a of [i, l]) {
448
+ t.beginPath(), t.moveTo(a[0].x, a[0].y);
449
+ for (const c of a.slice(1)) t.lineTo(c.x, c.y);
450
+ t.stroke();
445
451
  }
446
- e.restore();
447
- }
448
- function ge(e, t, o = {}, l) {
449
- const n = o.tool ?? "pencil", s = o.skin ?? "#f1c9a5", h = o.outline ?? "#2f2f33", i = n === "eraser" ? 17 : 9, r = n === "eraser" ? -40 : 0, a = l ? l.nudge(0.6) : { x: 0, y: 0 };
450
- e.save(), e.translate(t.x + a.x, t.y + a.y), e.rotate((o.angle ?? -30) * Math.PI / 180), e.scale(o.scale ?? 1, o.scale ?? 1), e.lineCap = "round", e.lineJoin = "round";
451
- const f = (d, m, b, E) => {
452
- for (const [u, c] of [
453
- [h, b + 6],
454
- [E, b]
452
+ t.restore();
453
+ }
454
+ function le(t, e, n = {}, o) {
455
+ const r = n.tool ?? "pencil", s = n.skin ?? "#f1c9a5", h = n.outline ?? "#2f2f33", i = r === "eraser" ? 17 : 9, l = r === "eraser" ? -40 : 0, a = o ? o.nudge(0.6) : { x: 0, y: 0 };
456
+ t.save(), t.translate(e.x + a.x, e.y + a.y), t.rotate((n.angle ?? -30) * Math.PI / 180), t.scale(n.scale ?? 1, n.scale ?? 1), t.lineCap = "round", t.lineJoin = "round";
457
+ const c = (f, d, w, m) => {
458
+ for (const [u, k] of [
459
+ [h, w + 6],
460
+ [m, w]
455
461
  ])
456
- e.strokeStyle = u, e.lineWidth = c, e.beginPath(), e.moveTo(d.x, d.y), e.lineTo(m.x, m.y), e.stroke();
462
+ t.strokeStyle = u, t.lineWidth = k, t.beginPath(), t.moveTo(f.x, f.y), t.lineTo(d.x, d.y), t.stroke();
457
463
  };
458
- e.save(), e.translate(r, 0);
459
- const y = { x: 165, y: -i - 26 }, w = (d) => ({ x: y.x + d * 0.8, y: y.y + d * 0.6 });
460
- f(y, w(2e3), 64, s), f(w(110), w(2e3), 92, o.sleeve ?? "#5b7db1"), e.fillStyle = s, e.strokeStyle = h, e.lineWidth = 3, e.beginPath(), e.ellipse(y.x, y.y, 54, 40, 0.25, 0, Math.PI * 2), e.fill(), e.stroke(), e.restore(), n === "eraser" ? me(e, { x: 0, y: 0 }, { angle: 0, outline: h }, l) : Je(e, { x: 0, y: 0 }, { angle: 0, outline: h }, l), e.translate(r, 0), f({ x: 150, y: i + 8 }, { x: 92, y: i + 12 }, 22, s), f({ x: 140, y: -i - 18 }, { x: 58, y: -i - 6 }, 20, s), f({ x: 150, y: -i - 30 }, { x: 112, y: -i + 2 }, 20, s), f({ x: 172, y: -i - 30 }, { x: 140, y: -i + 4 }, 20, s), e.restore();
461
- }
462
- function tt(e, t, o, l = 0.08, n = 32) {
463
- const s = Math.PI * 2 * (1 + l), h = [];
464
- for (let i = 0; i <= n; i++) {
465
- const r = -Math.PI / 2 + s * i / n;
466
- h.push({ x: e + Math.cos(r) * o, y: t + Math.sin(r) * o });
464
+ t.save(), t.translate(l, 0);
465
+ const g = { x: 165, y: -i - 26 }, y = (f) => ({ x: g.x + f * 0.8, y: g.y + f * 0.6 });
466
+ c(g, y(2e3), 64, s), c(y(110), y(2e3), 92, n.sleeve ?? "#5b7db1"), t.fillStyle = s, t.strokeStyle = h, t.lineWidth = 3, t.beginPath(), t.ellipse(g.x, g.y, 54, 40, 0.25, 0, Math.PI * 2), t.fill(), t.stroke(), t.restore(), r === "eraser" ? ie(t, { x: 0, y: 0 }, { angle: 0, outline: h }, o) : je(t, { x: 0, y: 0 }, { angle: 0, outline: h }, o), t.translate(l, 0), c({ x: 150, y: i + 8 }, { x: 92, y: i + 12 }, 22, s), c({ x: 140, y: -i - 18 }, { x: 58, y: -i - 6 }, 20, s), c({ x: 150, y: -i - 30 }, { x: 112, y: -i + 2 }, 20, s), c({ x: 172, y: -i - 30 }, { x: 140, y: -i + 4 }, 20, s), t.restore();
467
+ }
468
+ function In(t, e, n, o = 0.08, r = 32) {
469
+ const s = Math.PI * 2 * (1 + o), h = [];
470
+ for (let i = 0; i <= r; i++) {
471
+ const l = -Math.PI / 2 + s * i / r;
472
+ h.push({ x: t + Math.cos(l) * n, y: e + Math.sin(l) * n });
467
473
  }
468
474
  return h;
469
475
  }
470
- function ot(e) {
471
- const { path: t } = e, o = t.map((i) => i.x), l = t.map((i) => i.y), n = Math.min(...o), s = Math.min(...l), h = e.hand === !1 ? void 0 : e.hand === !0 || e.hand === void 0 ? {} : e.hand;
476
+ function An(t) {
477
+ const { path: e } = t, n = e.map((i) => i.x), o = e.map((i) => i.y), r = Math.min(...n), s = Math.min(...o), h = t.hand === !1 ? void 0 : t.hand === !0 || t.hand === void 0 ? {} : t.hand;
472
478
  return {
473
479
  type: "custom",
474
- x: n,
480
+ x: r,
475
481
  y: s,
476
- width: Math.max(1, Math.max(...o) - n),
477
- height: Math.max(1, Math.max(...l) - s),
482
+ width: Math.max(1, Math.max(...n) - r),
483
+ height: Math.max(1, Math.max(...o) - s),
478
484
  props: { draw: 0 },
479
- draw(i, r, a) {
480
- const f = Math.min(1, Math.max(0, Number(r.props?.draw ?? 0)));
481
- i.translate(-n, -s), i.strokeStyle = e.color ?? "#2f2f33", i.lineWidth = e.lineWidth ?? 5, i.lineCap = "round", i.lineJoin = "round";
482
- const y = e.sketch ? X(i, e.sketch, a) : void 0;
483
- f > 0 && (y ? e.smooth ? y.curve(t, f) : y.line(t, f) : we(i, oe(t, f))), h && f > 0 && f < 1 && ge(i, ne(t, f), h, y);
485
+ draw(i, l, a) {
486
+ const c = Math.min(1, Math.max(0, Number(l.props?.draw ?? 0)));
487
+ i.translate(-r, -s), i.strokeStyle = t.color ?? "#2f2f33", i.lineWidth = t.lineWidth ?? 5, i.lineCap = "round", i.lineJoin = "round";
488
+ const g = t.sketch ? xt(i, t.sketch, a) : void 0;
489
+ c > 0 && (g ? t.smooth ? g.curve(e, c) : g.line(e, c) : he(i, Dt(e, c))), h && c > 0 && c < 1 && le(i, jt(e, c), h, g);
484
490
  }
485
491
  };
486
492
  }
487
- function we(e, t, o) {
488
- if (!(t.length < 2)) {
489
- if (o) return o.line(t);
490
- e.beginPath(), e.moveTo(t[0].x, t[0].y);
491
- for (const l of t.slice(1)) e.lineTo(l.x, l.y);
492
- e.stroke();
493
+ function he(t, e, n) {
494
+ if (!(e.length < 2)) {
495
+ if (n) return n.line(e);
496
+ t.beginPath(), t.moveTo(e[0].x, e[0].y);
497
+ for (const o of e.slice(1)) t.lineTo(o.x, o.y);
498
+ t.stroke();
493
499
  }
494
500
  }
495
- const F = 1e5;
496
- function nt(e, t, o, l, n = 6) {
497
- const s = [], h = Math.max(1, Math.round(n));
501
+ const st = 1e5;
502
+ function Hn(t, e, n, o, r = 6) {
503
+ const s = [], h = Math.max(1, Math.round(r));
498
504
  for (let i = 0; i <= h; i++)
499
- s.push({ x: i % 2 === 0 ? e : e + o, y: t + l * i / h });
505
+ s.push({ x: i % 2 === 0 ? t : t + n, y: e + o * i / h });
500
506
  return s;
501
507
  }
502
- function be(e, t, o, l) {
503
- if (l <= 0 || t.length === 0) return;
504
- const n = oe(t, l), s = o / 2, h = (i) => {
505
- e.beginPath(), e.rect(-F, -F, 2 * F, 2 * F), i(), e.clip("evenodd");
508
+ function ae(t, e, n, o) {
509
+ if (o <= 0 || e.length === 0) return;
510
+ const r = Dt(e, o), s = n / 2, h = (i) => {
511
+ t.beginPath(), t.rect(-st, -st, 2 * st, 2 * st), i(), t.clip("evenodd");
506
512
  };
507
- for (const i of n)
513
+ for (const i of r)
508
514
  h(() => {
509
- e.moveTo(i.x + s, i.y), e.arc(i.x, i.y, s, 0, Math.PI * 2);
515
+ t.moveTo(i.x + s, i.y), t.arc(i.x, i.y, s, 0, Math.PI * 2);
510
516
  });
511
- for (let i = 1; i < n.length; i++) {
512
- const r = n[i - 1], a = n[i], f = Math.hypot(a.x - r.x, a.y - r.y);
513
- if (f === 0) continue;
514
- const y = -(a.y - r.y) / f * s, w = (a.x - r.x) / f * s;
517
+ for (let i = 1; i < r.length; i++) {
518
+ const l = r[i - 1], a = r[i], c = Math.hypot(a.x - l.x, a.y - l.y);
519
+ if (c === 0) continue;
520
+ const g = -(a.y - l.y) / c * s, y = (a.x - l.x) / c * s;
515
521
  h(() => {
516
- e.moveTo(r.x + y, r.y + w), e.lineTo(a.x + y, a.y + w), e.lineTo(a.x - y, a.y - w), e.lineTo(r.x - y, r.y - w), e.closePath();
522
+ t.moveTo(l.x + g, l.y + y), t.lineTo(a.x + g, a.y + y), t.lineTo(a.x - g, a.y - y), t.lineTo(l.x - g, l.y - y), t.closePath();
517
523
  });
518
524
  }
519
525
  }
520
- function lt(e, t, o, l, n) {
521
- e.save(), be(e, t, o, l), n(), e.restore();
526
+ function _n(t, e, n, o, r) {
527
+ t.save(), ae(t, e, n, o), r(), t.restore();
522
528
  }
523
- function rt(e, t) {
524
- const o = t.width ?? 40, l = t.hand === !0 ? {} : t.hand || void 0, n = t.eraser === !1 ? void 0 : t.eraser === !0 || t.eraser === void 0 ? {} : t.eraser;
529
+ function Yn(t, e) {
530
+ const n = e.width ?? 40, o = e.hand === !0 ? {} : e.hand || void 0, r = e.eraser === !1 ? void 0 : e.eraser === !0 || e.eraser === void 0 ? {} : e.eraser;
525
531
  return {
526
- ...e,
527
- props: { ...e.props, erase: 0 },
532
+ ...t,
533
+ props: { ...t.props, erase: 0 },
528
534
  draw(s, h, i) {
529
- const r = Number(h.props?.erase ?? 0);
530
- if (s.save(), be(s, t.path, o, r), e.draw(s, h, i), s.restore(), !n || r <= 0 || r >= 1) return;
531
- const a = ne(t.path, r);
532
- l ? ge(s, a, { ...l, tool: "eraser" }) : me(s, a, n);
535
+ const l = Number(h.props?.erase ?? 0);
536
+ if (s.save(), ae(s, e.path, n, l), t.draw(s, h, i), s.restore(), !r || l <= 0 || l >= 1) return;
537
+ const a = jt(e.path, l);
538
+ o ? le(s, a, { ...o, tool: "eraser" }) : ie(s, a, r);
539
+ }
540
+ };
541
+ }
542
+ const q = (t) => t * Math.PI / 180;
543
+ function ce([t, e, n], o) {
544
+ const r = Math.cos(o), s = Math.sin(o);
545
+ return [t, e * r + n * s, -e * s + n * r];
546
+ }
547
+ function fe([t, e, n], o) {
548
+ const r = Math.cos(o), s = Math.sin(o);
549
+ return [t * r - e * s, t * s + e * r, n];
550
+ }
551
+ function et([t, e, n], o) {
552
+ const r = Math.cos(o), s = Math.sin(o);
553
+ return [t * r + n * s, e, -t * s + n * r];
554
+ }
555
+ const pt = (t, e) => [t[0] + e[0], t[1] + e[1], t[2] + e[2]], Nt = (t, e) => [t[0] * e, t[1] * e, t[2] * e], at = (t, e) => fe(ce(t, e.swing), e.spread);
556
+ function wt(t, e) {
557
+ const n = et(t, e);
558
+ return { point: { x: n[0], y: -n[1] }, depth: n[2] };
559
+ }
560
+ function It(t, e, n) {
561
+ const o = n.height, r = q(90 * (e.turn ?? 0)), h = [0, t.hipHeight * o * (t.boneScale?.(e, null) ?? 1), 0], i = {};
562
+ for (const p of t.chains) {
563
+ const T = p.parent ? i[p.parent] : void 0;
564
+ if (p.parent && !T) throw new Error(`body plan ${t.id}: chain ${p.id} comes before its parent ${p.parent}`);
565
+ const v = p.at ?? (T ? T.joints3.length - 1 : 0), O = T ? T.joints3[v] : h, A = T ? T.frames[Math.max(0, v - 1)] : { swing: 0, spread: 0 }, Z = p.offset ? pt(O, at(Nt(p.offset, o), A)) : O, nt = p.side ?? 1, ut = t.boneScale?.(e, p) ?? 1, gt = t.angles(e, p), X = [Z], Q = [];
566
+ let D = A.swing, yt = A.spread;
567
+ p.bones.forEach((ue, Ht) => {
568
+ const mt = gt[Ht] ?? { swing: 0, spread: 0 };
569
+ D += q(mt.swing), yt += q(mt.spread) * nt, Q.push({ swing: D, spread: yt });
570
+ const ge = et(at(p.rest, { swing: D, spread: yt }), q(mt.yaw ?? 0));
571
+ X.push(pt(X[Ht], Nt(ge, ue.length * o * ut)));
572
+ }), i[p.id] = { joints3: X, frames: Q };
573
+ }
574
+ const l = i[t.head.on], a = t.headPose?.(e) ?? { yaw: 0, nod: 0, tilt: 0, sx: 1, sy: 1 }, c = l.frames[l.frames.length - 1], g = t.head.size / 2 * o, y = g * a.sx, f = g * a.sy, d = (p) => at(et(ce(fe(p, -q(a.tilt)), -q(a.nod)), q(a.yaw)), c), w = pt(l.joints3[l.joints3.length - 1], d([0, f, 0])), m = {};
575
+ for (const p of t.chains) {
576
+ const { joints3: T, frames: v } = i[p.id], O = T.map((A) => wt(A, r));
577
+ m[p.id] = {
578
+ id: p.id,
579
+ joints3: T,
580
+ frames: v,
581
+ points: O.map((A) => A.point),
582
+ depths: O.map((A) => A.depth)
583
+ };
584
+ }
585
+ const u = wt(w, r), k = [[1, 0, 0], [0, 1, 0], [0, 0, 1]].map((p) => et(d(p), r)), E = wt(h, r).point, b = q(e.roll ?? 0), M = (p) => {
586
+ const T = p.x - E.x, v = p.y - E.y;
587
+ return { x: E.x + T * Math.cos(b) - v * Math.sin(b), y: E.y + T * Math.sin(b) + v * Math.cos(b) };
588
+ }, P = ([p, T, v]) => [p * Math.cos(b) + T * Math.sin(b), -p * Math.sin(b) + T * Math.cos(b), v];
589
+ for (const p of Object.values(m)) p.points = p.points.map(M);
590
+ const S = {
591
+ center: M(u.point),
592
+ depth: u.depth,
593
+ rx: y,
594
+ ry: f,
595
+ angle: 0,
596
+ axes: k.map(P)
597
+ }, W = S.axes[1];
598
+ S.angle = Math.atan2(W[0], W[1]);
599
+ const H = (p) => {
600
+ if ("head" in p) return { x: S.center.x + W[0] * f, y: S.center.y - W[1] * f };
601
+ const T = m[p.chain];
602
+ return T.points[Math.min(p.joint, T.points.length - 1)];
603
+ };
604
+ let Y = 0;
605
+ (n.contact ?? "ground") === "ground" && (Y = -Math.max(...t.contacts.map((p) => H(p).y))), Y -= (e.lift ?? 0) * o;
606
+ const I = (p) => ({ x: p.x, y: p.y + Y });
607
+ for (const p of Object.values(m)) p.points = p.points.map(I);
608
+ S.center = I(S.center);
609
+ const x = t.contacts.map((p) => ({ spec: p, point: H(p) }));
610
+ return {
611
+ height: o,
612
+ view: r,
613
+ chains: m,
614
+ head: S,
615
+ hip: I(M(E)),
616
+ contacts: x,
617
+ groundY: Math.max(...x.map((p) => p.point.y))
618
+ };
619
+ }
620
+ function de(t, [e, n, o]) {
621
+ const [r, s, h] = t.axes, i = [
622
+ r[0] * e * t.rx + s[0] * n * t.ry + h[0] * o * t.rx,
623
+ r[1] * e * t.rx + s[1] * n * t.ry + h[1] * o * t.rx,
624
+ r[2] * e * t.rx + s[2] * n * t.ry + h[2] * o * t.rx
625
+ ], l = Math.hypot(e, n, o) || 1, a = (r[2] * e + s[2] * n + h[2] * o) / l;
626
+ return { point: { x: t.center.x + i[0], y: t.center.y - i[1] }, depth: t.depth + i[2], facing: a };
627
+ }
628
+ const rt = (t) => t * 180 / Math.PI, j = (t, e) => [t[0] - e[0], t[1] - e[1], t[2] - e[2]], bt = (t, e) => t[0] * e[0] + t[1] * e[1] + t[2] * e[2], tt = (t) => Math.hypot(t[0], t[1], t[2]), Wt = (t) => {
629
+ const e = tt(t) || 1;
630
+ return [t[0] / e, t[1] / e, t[2] / e];
631
+ }, it = (t) => Math.atan2(Math.sin(t), Math.cos(t));
632
+ function Ct(t) {
633
+ const [e, n, o] = Wt(t);
634
+ return { swing: Math.asin(Math.max(-1, Math.min(1, o))), spread: Math.atan2(e, -n) };
635
+ }
636
+ function Je(t, e, n, o, r) {
637
+ const s = t.chains.find((Y) => Y.id === n);
638
+ if (!s) throw new Error(`reach: no chain ${n} in ${t.id}`);
639
+ if (s.bones.length < 2 || s.rest[1] > -0.99) throw new Error(`reach: ${n} is not a hanging limb of two bones or more`);
640
+ if (!t.withAngles) throw new Error(`reach: the ${t.id} plan cannot set angles`);
641
+ const h = It(t, { ...e, turn: 0, roll: 0, lift: 0 }, { height: r.height, contact: "none" }), i = h.chains[n], l = i.joints3[0], a = tt(j(i.joints3[1], i.joints3[0])), c = tt(j(i.joints3[2], i.joints3[1])), g = s.parent ? h.chains[s.parent].frames[Math.max(0, (s.at ?? h.chains[s.parent].joints3.length - 1) - 1)] : { swing: 0, spread: 0 }, y = j(o, l), f = Math.min(a + c - 1e-6, Math.max(Math.abs(a - c) + 1e-6, tt(y))), d = Wt(y), w = s.parent !== null, m = at(s.pole ?? (w ? [0, -0.35, -1] : [0, 0, 1]), g);
642
+ let u = j(m, [d[0] * bt(m, d), d[1] * bt(m, d), d[2] * bt(m, d)]);
643
+ tt(u) < 1e-6 && (u = et([1, 0, 0], 0)), u = Wt(u);
644
+ const k = (a * a + f * f - c * c) / (2 * a * f), E = Math.sqrt(Math.max(0, 1 - k * k)), b = [
645
+ l[0] + a * (k * d[0] + E * u[0]),
646
+ l[1] + a * (k * d[1] + E * u[1]),
647
+ l[2] + a * (k * d[2] + E * u[2])
648
+ ], M = [l[0] + d[0] * f, l[1] + d[1] * f, l[2] + d[2] * f], P = s.side ?? 1, S = Ct(j(b, l)), W = Ct(j(M, b)), H = [
649
+ { swing: rt(it(S.swing - g.swing)), spread: rt(it(S.spread - g.spread)) * P },
650
+ { swing: rt(it(W.swing - S.swing)), spread: rt(it(W.spread - S.spread)) * P }
651
+ ];
652
+ return t.withAngles(e, s, H);
653
+ }
654
+ function Xt(t, e, n, o, r, s = 0, h = 1, i = 40) {
655
+ const l = Math.cos(r), a = Math.sin(r);
656
+ return Array.from({ length: i + 1 }, (c, g) => {
657
+ const y = s + Math.PI * 2 * h * g / i, f = Math.cos(y) * n, d = Math.sin(y) * o;
658
+ return { x: t + f * l - d * a, y: e + f * a + d * l };
659
+ });
660
+ }
661
+ function ze(t, e) {
662
+ return e.look === "pencil" ? Ve(t, e) : Ge(t, e.ink, e.look);
663
+ }
664
+ function ft(t, e, n = !1) {
665
+ t.beginPath(), t.moveTo(e[0].x, e[0].y);
666
+ for (const o of e.slice(1)) t.lineTo(o.x, o.y);
667
+ n && t.closePath();
668
+ }
669
+ function Ge(t, e, n) {
670
+ const o = n === "silhouette", r = o ? 1.25 : 1;
671
+ return {
672
+ look: n,
673
+ ink: e,
674
+ limb(s, h, i) {
675
+ t.fillStyle = e, Jt(t, s, h * r, i * r);
676
+ },
677
+ line(s, h) {
678
+ s.length < 2 || (t.strokeStyle = e, t.lineWidth = h * r, t.lineCap = "round", t.lineJoin = "round", ft(t, s), t.stroke());
679
+ },
680
+ shape(s, h, i) {
681
+ ft(t, s, !0), (h !== null || o) && (t.fillStyle = o ? e : h, t.fill()), !(i <= 0) && (t.strokeStyle = e, t.lineWidth = i * r, t.lineJoin = "round", t.stroke());
682
+ },
683
+ ellipse(s, h, i, l, a, c, g) {
684
+ t.beginPath(), t.ellipse(s, h, i, l, a, 0, Math.PI * 2), (c !== null || o) && (t.fillStyle = o ? e : c, t.fill()), !(g <= 0) && (t.strokeStyle = e, t.lineWidth = g * r, t.stroke());
685
+ },
686
+ dot(s, h, i) {
687
+ t.fillStyle = e, t.beginPath(), t.arc(s, h, i * r, 0, Math.PI * 2), t.fill();
688
+ },
689
+ guide() {
690
+ },
691
+ guideEllipse() {
692
+ }
693
+ };
694
+ }
695
+ function Ze(t, e) {
696
+ const n = [t[0]];
697
+ let o = 0;
698
+ for (let h = 1; h < t.length; h++) {
699
+ const i = t[h - 1], l = t[h], a = Math.hypot(l.x - i.x, l.y - i.y);
700
+ let c = e - o;
701
+ for (; c < a; ) {
702
+ const g = c / a;
703
+ n.push({ x: i.x + (l.x - i.x) * g, y: i.y + (l.y - i.y) * g }), c += e;
704
+ }
705
+ o = a - (c - e);
706
+ }
707
+ const r = t[t.length - 1], s = n[n.length - 1];
708
+ return Math.hypot(r.x - s.x, r.y - s.y) > e * 0.25 ? n.push(r) : n[n.length - 1] = r, n;
709
+ }
710
+ function Qe(t, e) {
711
+ const n = t.length;
712
+ return t.map((o, r) => {
713
+ const s = t[Math.max(0, r - 1)], h = t[Math.min(n - 1, r + 1)], i = Math.hypot(h.x - s.x, h.y - s.y) || 1, l = e(n === 1 ? 0 : r / (n - 1));
714
+ return { x: o.x - (h.y - s.y) / i * l, y: o.y + (h.x - s.x) / i * l };
715
+ });
716
+ }
717
+ function qt(t) {
718
+ const e = [0.6, 1.4, 2.9].map((o) => ({
719
+ frequency: o * (0.8 + t.next() * 0.4),
720
+ phase: t.next() * Math.PI * 2,
721
+ amount: 0.5 + t.next() * 0.5
722
+ })), n = e.reduce((o, r) => o + r.amount, 0);
723
+ return (o) => e.reduce((r, s) => r + s.amount * Math.sin(Math.PI * 2 * s.frequency * o + s.phase), 0) / n;
724
+ }
725
+ function Ve(t, e) {
726
+ const n = e.pencil ?? {}, o = e.ink, r = n.roughness ?? Math.max(1, e.lineWidth * 0.12), s = Math.max(1, Math.round(n.passes ?? 2)), h = Math.min(1, Math.max(0, n.pressure ?? 0.25)), i = Math.min(1, Math.max(0, n.rubbedOut ?? 0.15)), l = ye(e.time, n.boil ?? 8);
727
+ let a = 0;
728
+ const c = (d, w, m = !1) => me(pe(`${e.seed}:${m ? "paper" : l}:${d}:${w}`)), g = (d, w, m, u, k, E = 0) => {
729
+ if (d.length < 2) return;
730
+ const b = d.slice(1).reduce((I, x, p) => I + Math.hypot(x.x - d[p].x, x.y - d[p].y), 0);
731
+ let M = Ze(d, Math.max(1.5, Math.min(e.lineWidth * 0.8, b / 24)));
732
+ if (E > 0 && M.length >= 2) {
733
+ const [I, x] = [M[M.length - 2], M[M.length - 1]], p = Math.hypot(x.x - I.x, x.y - I.y) || 1;
734
+ M = [...M, { x: x.x + (x.x - I.x) / p * E, y: x.y + (x.y - I.y) / p * E }];
735
+ }
736
+ const P = qt(m), S = qt(m), W = M.length, H = [], Y = [];
737
+ M.forEach((I, x) => {
738
+ const p = W === 1 ? 0 : x / (W - 1), T = M[Math.max(0, x - 1)], v = M[Math.min(W - 1, x + 1)], O = Math.hypot(v.x - T.x, v.y - T.y) || 1, A = -(v.y - T.y) / O, Z = (v.x - T.x) / O, nt = P(p) * k, ut = Math.min(1, p / 0.08, (1 - p) / 0.08), gt = (0.55 + 0.45 * Math.sqrt(Math.max(0, ut))) * (1 + h * S(p)), X = Math.max(0.3, w(p) * gt / 2), Q = I.x + A * nt, D = I.y + Z * nt;
739
+ H.push({ x: Q + A * X, y: D + Z * X }), Y.push({ x: Q - A * X, y: D - Z * X });
740
+ }), t.save(), t.globalAlpha *= u, t.fillStyle = o, ft(t, [...H, ...Y.reverse()], !0), t.fill(), t.restore();
741
+ }, y = (d, w) => {
742
+ const m = a++, u = c(m, 99, !0);
743
+ if (u.next() < i) {
744
+ const M = (u.next() * 2 - 1) * e.lineWidth * 1.4, P = (u.next() * 2 - 1) * e.lineWidth * 1.4, S = d.map((W) => ({ x: W.x + M, y: W.y + P }));
745
+ g(S, (W) => w(W) * 1.8, c(m, 98, !0), 0.035, r), g(S, (W) => w(W) * 0.45, c(m, 97, !0), 0.12, r * 1.5);
746
+ }
747
+ const k = d.slice(1).reduce((M, P, S) => M + Math.hypot(P.x - d[S].x, P.y - d[S].y), 0), E = w(0.5) > 4 && k > w(0.5) * 6, b = E ? [-0.3, 0.3, 0] : [0];
748
+ for (let M = 0; M < s; M++) {
749
+ const P = M === 0;
750
+ b.forEach((S, W) => {
751
+ const H = c(m, M * 10 + W), Y = S === 0 ? d : Qe(d, (x) => w(x) * S * Math.sqrt(Math.sin(Math.PI * x))), I = !P && S === 0 ? e.lineWidth * (0.3 + H.next() * 0.8) : 0;
752
+ g(Y, (x) => w(x) * (E ? 0.5 : 1) * (P ? 1 : 0.6), H, P ? 0.85 : 0.45, r * (P ? 0.6 : 1), I);
753
+ });
754
+ }
755
+ }, f = (d, w, m, u, k, E) => {
756
+ const M = c(a, 50).next() * Math.PI * 2;
757
+ y(Xt(d, w, m, u, k, M, 1.08, 48), () => E);
758
+ };
759
+ return {
760
+ look: "pencil",
761
+ ink: o,
762
+ limb(d, w, m) {
763
+ y(d, (u) => w + (m - w) * u);
764
+ },
765
+ line(d, w) {
766
+ y(d, () => w);
767
+ },
768
+ shape(d, w, m) {
769
+ w !== null && (t.save(), t.globalAlpha *= 0.88, t.fillStyle = w, ft(t, d, !0), t.fill(), t.restore()), m > 0 && y([...d, d[0]], () => m);
770
+ },
771
+ ellipse(d, w, m, u, k, E, b) {
772
+ E !== null && (t.save(), t.globalAlpha *= 0.9, t.fillStyle = E, t.beginPath(), t.ellipse(d, w, m, u, k, 0, Math.PI * 2), t.fill(), t.restore()), f(d, w, m, u, k, b);
773
+ },
774
+ dot(d, w, m) {
775
+ t.save(), t.globalAlpha *= 0.9, t.fillStyle = o, t.beginPath(), t.arc(d, w, m, 0, Math.PI * 2), t.fill(), t.restore();
776
+ },
777
+ guide(d) {
778
+ if (n.construction === !1 || d.length < 2) return;
779
+ const w = a++;
780
+ g(d, () => Math.max(0.6, e.lineWidth * 0.18), c(w, 0), 0.28, r * 1.2, e.lineWidth);
781
+ },
782
+ guideEllipse(d, w, m, u, k) {
783
+ if (n.construction === !1) return;
784
+ const E = a++, b = c(E, 0), M = Xt(d, w, m, u, k, b.next() * Math.PI * 2, 1.12, 48);
785
+ g(M, () => Math.max(0.6, e.lineWidth * 0.18), b, 0.28, r * 1.5);
786
+ }
787
+ };
788
+ }
789
+ const tn = 0.34, U = 0.12, L = -0.4, F = (t, e, n) => t[e] ?? n, en = (t, e) => Math.max(0, t) * (1 - Math.min(1, Math.max(0, e))), nn = 0.45, on = 0.35, sn = 0.7;
790
+ function dt(t, e, n) {
791
+ const o = (f) => Math.sqrt(Math.max(0, 1 - f.x * f.x - f.y * f.y)), r = de(t, [n.x, n.y, o(n)]).facing, s = t.axes[2], h = Math.atan2(s[0], s[2]), i = Math.cos(h), l = i >= 0 ? 1 : -1, a = l * Math.max(on, Math.abs(i)), c = l * Math.max(sn, Math.abs(i)), g = Math.cos(t.angle), y = Math.sin(t.angle);
792
+ return {
793
+ facing: r,
794
+ points: e.map((f) => {
795
+ const d = nn * Math.sin(h) + n.x * a + (f.x - n.x) * c, w = f.y + s[1] * o(f), m = d * t.rx, u = w * t.ry;
796
+ return { x: t.center.x + m * g + u * y, y: t.center.y + m * y - u * g };
797
+ })
798
+ };
799
+ }
800
+ const lt = (t, e, n, o = 12) => Array.from({ length: o + 1 }, (r, s) => {
801
+ const h = s / o, i = 1 - h;
802
+ return { x: i * i * t.x + 2 * i * h * e.x + h * h * n.x, y: i * i * t.y + 2 * i * h * e.y + h * h * n.y };
803
+ }), Mt = (t, e, n, o, r = 16) => Array.from({ length: r }, (s, h) => {
804
+ const i = Math.PI * 2 * h / r;
805
+ return { x: t + Math.cos(i) * n, y: e + Math.sin(i) * o };
806
+ }), Ut = 0.05;
807
+ function rn(t, e, n, o) {
808
+ const r = Math.max(1, Math.min(o * 0.6, 0.14 * e.rx)), s = (u, k) => dt(e, u, k).points, h = (u, k) => dt(e, [], { x: u, y: k }).facing, i = F(n, "smile", 0), l = F(n, "blink", 0), a = F(n, "lookX", 0), c = F(n, "lookY", 0), g = F(n, "browTilt", 0);
809
+ for (const u of [1, -1]) {
810
+ const k = u === 1 ? "left" : "right", E = tn * u;
811
+ if (h(E, U) < Ut) continue;
812
+ const b = { x: E, y: U }, M = en(F(n, `eye.${k}`, 1), l);
813
+ if (M < 0.2) {
814
+ const H = i > 0.5 ? 0.12 : -0.06;
815
+ t.line(s(lt({ x: E - 0.12, y: U }, { x: E, y: U + H }, { x: E + 0.12, y: U }), b), r);
816
+ } else {
817
+ if (M > 1.2) {
818
+ const x = 0.13 * M;
819
+ t.shape(s(Mt(E, U, x * 0.85, x), b), "#ffffff", r);
820
+ }
821
+ const H = M > 1.2 ? 0.075 : 0.1, Y = E + a * 0.08, I = U - c * 0.07;
822
+ t.shape(s(Mt(Y, I, H, H * 1.1 * Math.min(M, 1)), b), t.ink, 0);
823
+ }
824
+ const P = U + 0.3 + F(n, `brow.${k}`, 0) * 0.14 + Math.max(0, M - 1) * 0.12, S = { x: E + u * 0.13, y: P }, W = { x: E - u * 0.13, y: P + g * 0.1 };
825
+ t.line(s([S, { x: (S.x + W.x) / 2, y: (S.y + W.y) / 2 }, W], { x: E, y: P }), r);
826
+ }
827
+ const y = { x: 0, y: L };
828
+ if (h(0, L) < -Ut) return;
829
+ const f = 0.25 * Math.max(0.3, F(n, "mouthWidth", 1)), d = Math.min(1, Math.max(0, F(n, "mouth", 0)));
830
+ if (d <= 0.05) {
831
+ t.line(s(lt({ x: -f, y: L }, { x: 0, y: L - i * 0.25 }, { x: f, y: L }), y), r);
832
+ return;
833
+ }
834
+ const w = 0.3 * d;
835
+ let m;
836
+ if (i > 0.3) {
837
+ const u = L + 0.05;
838
+ m = [...lt({ x: f, y: u }, { x: 0, y: L - w * 2 }, { x: -f, y: u })];
839
+ } else if (i < -0.3) {
840
+ const u = L - w * 0.6;
841
+ m = [...lt({ x: f, y: u }, { x: 0, y: L + w * 1.4 }, { x: -f, y: u })];
842
+ } else
843
+ m = Mt(0, L, f * 0.8, w);
844
+ t.shape(s(m, y), t.ink, 0);
845
+ }
846
+ const kt = 0.215, Et = 0.205, ln = 0.065, Kt = 0.035, hn = 0.165, an = 0.155, cn = 12, K = {
847
+ turn: 0,
848
+ lean: 0,
849
+ side: 0,
850
+ "head.turn": 0,
851
+ "head.nod": 0,
852
+ "head.tilt": 0,
853
+ "arm.left.swing": 0,
854
+ "arm.left.spread": 12,
855
+ "arm.left.elbow": 8,
856
+ "arm.left.bend": 0,
857
+ "arm.right.swing": 0,
858
+ "arm.right.spread": 12,
859
+ "arm.right.elbow": 8,
860
+ "arm.right.bend": 0,
861
+ "leg.left.swing": 0,
862
+ "leg.left.spread": 3,
863
+ "leg.left.knee": 0,
864
+ "leg.left.ankle": 0,
865
+ "leg.right.swing": 0,
866
+ "leg.right.spread": 3,
867
+ "leg.right.knee": 0,
868
+ "leg.right.ankle": 0,
869
+ stretch: 1,
870
+ lift: 0,
871
+ roll: 0,
872
+ mouth: 0,
873
+ smile: 0.5,
874
+ mouthWidth: 1,
875
+ blink: 0,
876
+ "eye.left": 1,
877
+ "eye.right": 1,
878
+ "brow.left": 0,
879
+ "brow.right": 0,
880
+ browTilt: 0,
881
+ lookX: 0,
882
+ lookY: 0
883
+ };
884
+ function R(t = {}) {
885
+ return { ...K, ...t };
886
+ }
887
+ function $(t, e) {
888
+ const n = {};
889
+ for (const o of ["left", "right"]) for (const [r, s] of Object.entries(e)) n[`${t}.${o}.${r}`] = s;
890
+ return n;
891
+ }
892
+ const fn = {
893
+ rest: K,
894
+ wave: R({ "arm.right.spread": 115, "arm.right.bend": 55, "arm.right.elbow": 0, "head.tilt": -6, smile: 0.9 }),
895
+ cheer: R({ ...$("arm", { spread: 140, bend: 20, elbow: 0 }), mouth: 0.6, smile: 1, "eye.left": 0, "eye.right": 0 }),
896
+ point: R({ "arm.right.spread": 88, "arm.right.elbow": 0, "arm.right.bend": 0, "head.turn": -20, smile: 0.4 }),
897
+ handsOnHips: R({ ...$("arm", { spread: 50, bend: -105, elbow: 0 }), ...$("leg", { spread: 9 }), smile: 0.8 }),
898
+ think: R({ "arm.right.spread": 22, "arm.right.bend": -150, "arm.right.elbow": 0, "head.tilt": 10, lookX: -0.5, lookY: -0.8, smile: 0 }),
899
+ shrug: R({ ...$("arm", { spread: 35, bend: 75, elbow: 0 }), "head.tilt": -10, smile: -0.2 }),
900
+ sit: R({ ...$("leg", { swing: 90, knee: 90, spread: 4 }), ...$("arm", { swing: 25, elbow: 45, spread: 8 }) }),
901
+ kneel: R({
902
+ "leg.left.swing": 90,
903
+ "leg.left.knee": 90,
904
+ // The back thigh leans back a little so its knee meets the ground beside the
905
+ // front foot; the shin slopes up from it and the foot points down to tucked toes.
906
+ "leg.right.swing": -18,
907
+ "leg.right.knee": 108,
908
+ "leg.right.ankle": 16,
909
+ ...$("arm", { swing: 20, elbow: 30 })
910
+ }),
911
+ crouch: R({ ...$("leg", { swing: 75, knee: 140, spread: 6 }), lean: 25, ...$("arm", { swing: 50, elbow: 40 }), "head.nod": -15 }),
912
+ // On hands and knees: the back nearly level, arms straight down, the toes
913
+ // pointed back along the ground.
914
+ crawl: R({ lean: 82, "head.nod": -35, ...$("arm", { swing: 80, elbow: 0, spread: 4 }), ...$("leg", { knee: 92, ankle: -88 }) }),
915
+ lieDown: R({ roll: 90, ...$("arm", { spread: 8 }), "head.nod": 0 })
916
+ };
917
+ function dn(t = {}) {
918
+ const e = t.headSize ?? 0.3, n = t.shoulderWidth ?? 0.06, o = t.hipWidth ?? 0.022, r = Math.max(0.12, 1 - e - Kt - (kt + Et)), s = (l) => ({
919
+ id: `arm.${l}`,
920
+ parent: "spine",
921
+ offset: [(l === "left" ? 1 : -1) * n, -0.035, 0],
922
+ rest: [0, -1, 0],
923
+ side: l === "left" ? 1 : -1,
924
+ bones: [
925
+ { length: hn, width: [1.25, 0.9] },
926
+ { length: an, width: [0.9, 0.75] }
927
+ ]
928
+ }), h = (l) => ({
929
+ id: `leg.${l}`,
930
+ parent: null,
931
+ offset: [(l === "left" ? 1 : -1) * o, 0, 0],
932
+ rest: [0, -1, 0],
933
+ side: l === "left" ? 1 : -1,
934
+ bones: [
935
+ { length: kt, width: [1.45, 1.05] },
936
+ { length: Et, width: [1.05, 0.85] },
937
+ { length: ln, width: [0.95, 0.7] }
938
+ ]
939
+ }), i = (l, a) => l[a] ?? K[a] ?? 0;
940
+ return {
941
+ id: "human",
942
+ hipHeight: kt + Et,
943
+ // Tie order: legs, then the body, then the arms (in front of the chest unless turned away), then the head.
944
+ chains: [
945
+ h("left"),
946
+ h("right"),
947
+ {
948
+ id: "spine",
949
+ parent: null,
950
+ rest: [0, 1, 0],
951
+ bones: [
952
+ { length: r / 2, width: [1.7, 1.4] },
953
+ { length: r / 2, width: [1.4, 1.1] }
954
+ ]
955
+ },
956
+ { id: "neck", parent: "spine", rest: [0, 1, 0], bones: [{ length: Kt, width: [1, 0.9] }] },
957
+ s("left"),
958
+ s("right")
959
+ ],
960
+ head: { on: "neck", size: e },
961
+ contacts: [
962
+ ...["left", "right"].flatMap((l) => [
963
+ { chain: `leg.${l}`, joint: 1 },
964
+ { chain: `leg.${l}`, joint: 2 },
965
+ { chain: `leg.${l}`, joint: 3 },
966
+ { chain: `arm.${l}`, joint: 1 },
967
+ { chain: `arm.${l}`, joint: 2 }
968
+ ]),
969
+ { chain: "spine", joint: 0 },
970
+ { chain: "spine", joint: 1 },
971
+ { chain: "spine", joint: 2 },
972
+ { head: "top" }
973
+ ],
974
+ angles(l, a) {
975
+ if (a.id === "spine") {
976
+ const f = -i(l, "lean") / 2, d = i(l, "side") / 2;
977
+ return [
978
+ { swing: f, spread: d },
979
+ { swing: f, spread: d }
980
+ ];
981
+ }
982
+ if (a.id === "neck") return [{ swing: 0, spread: 0 }];
983
+ const [c, g] = a.id.split("."), y = (f) => i(l, `${c}.${g}.${f}`);
984
+ return c === "arm" ? [
985
+ { swing: y("swing"), spread: y("spread") },
986
+ { swing: y("elbow"), spread: y("bend") }
987
+ ] : [
988
+ { swing: y("swing"), spread: y("spread") },
989
+ { swing: -y("knee"), spread: 0 },
990
+ // The foot points forward, square to the shin, turned out a little.
991
+ { swing: 90 + y("ankle"), spread: 0, yaw: cn * (a.side ?? 1) }
992
+ ];
993
+ },
994
+ withAngles(l, a, c) {
995
+ const [g, y] = a.id.split("."), f = (d) => `${g}.${y}.${d}`;
996
+ return g === "arm" ? {
997
+ ...l,
998
+ [f("swing")]: c[0].swing,
999
+ [f("spread")]: c[0].spread,
1000
+ [f("elbow")]: c[1].swing,
1001
+ [f("bend")]: c[1].spread
1002
+ } : g === "leg" ? { ...l, [f("swing")]: c[0].swing, [f("spread")]: c[0].spread, [f("knee")]: -c[1].swing } : l;
1003
+ },
1004
+ boneScale(l, a) {
1005
+ const c = Math.min(3, Math.max(0.3, i(l, "stretch")));
1006
+ return a?.id.startsWith("arm.") ? Math.sqrt(c) : c;
1007
+ },
1008
+ headPose(l) {
1009
+ const a = Math.min(3, Math.max(0.3, i(l, "stretch")));
1010
+ return {
1011
+ yaw: i(l, "head.turn"),
1012
+ nod: i(l, "head.nod"),
1013
+ tilt: i(l, "head.tilt"),
1014
+ // The head keeps its area: taller and narrower when stretched.
1015
+ sx: 1 / Math.sqrt(a),
1016
+ sy: Math.sqrt(a)
1017
+ };
1018
+ },
1019
+ landmarks: {
1020
+ neck: ["neck", 0],
1021
+ "shoulder.left": ["arm.left", 0],
1022
+ "elbow.left": ["arm.left", 1],
1023
+ "hand.left": ["arm.left", 2],
1024
+ "shoulder.right": ["arm.right", 0],
1025
+ "elbow.right": ["arm.right", 1],
1026
+ "hand.right": ["arm.right", 2],
1027
+ "hip.left": ["leg.left", 0],
1028
+ "knee.left": ["leg.left", 1],
1029
+ "ankle.left": ["leg.left", 2],
1030
+ "toe.left": ["leg.left", 3],
1031
+ "hip.right": ["leg.right", 0],
1032
+ "knee.right": ["leg.right", 1],
1033
+ "ankle.right": ["leg.right", 2],
1034
+ "toe.right": ["leg.right", 3]
1035
+ }
1036
+ };
1037
+ }
1038
+ function $n(t) {
1039
+ const e = t.split(".");
1040
+ if (e.length === 3) {
1041
+ const [o, r, s] = e;
1042
+ return `${`${r === "left" ? "Left" : "Right"} ${o}`} · ${{
1043
+ swing: "forward / back",
1044
+ spread: "out / in",
1045
+ elbow: "elbow bend",
1046
+ bend: "forearm out / in",
1047
+ knee: "knee bend",
1048
+ ankle: "foot tilt"
1049
+ }[s] ?? s}`;
1050
+ }
1051
+ return {
1052
+ turn: "View (front → side → back)",
1053
+ lean: "Lean forward / back",
1054
+ side: "Lean sideways",
1055
+ "head.turn": "Head · turn",
1056
+ "head.nod": "Head · nod",
1057
+ "head.tilt": "Head · tilt",
1058
+ stretch: "Squash / stretch",
1059
+ lift: "Lift off the ground",
1060
+ roll: "Roll (whole figure)",
1061
+ mouth: "Mouth open",
1062
+ smile: "Smile",
1063
+ mouthWidth: "Mouth width",
1064
+ blink: "Blink",
1065
+ "eye.left": "Left eye open",
1066
+ "eye.right": "Right eye open",
1067
+ "brow.left": "Left brow",
1068
+ "brow.right": "Right brow",
1069
+ browTilt: "Brow slant",
1070
+ lookX: "Look left / right",
1071
+ lookY: "Look up / down"
1072
+ }[t] ?? t;
1073
+ }
1074
+ const un = {
1075
+ leftEye: "eye.left",
1076
+ rightEye: "eye.right",
1077
+ leftBrow: "brow.left",
1078
+ rightBrow: "brow.right"
1079
+ }, Bn = Object.fromEntries(
1080
+ Object.entries(N).map(([t, e]) => [
1081
+ t,
1082
+ Object.fromEntries(Object.entries(e).map(([n, o]) => [un[n] ?? n, o]))
1083
+ ])
1084
+ );
1085
+ function Rn(t = {}) {
1086
+ const e = (t.proportions ?? "bold") === "bold", n = t.figure ?? "fluid", o = t.look ?? "clean", r = t.height ?? 300, s = n === "stick";
1087
+ return {
1088
+ plan: t.plan ?? dn({
1089
+ headSize: t.headSize ?? (e ? 0.3 : 0.24),
1090
+ shoulderWidth: s ? 0 : t.shoulderWidth ?? 0.06,
1091
+ hipWidth: s ? 0 : t.hipWidth ?? 0.022
1092
+ }),
1093
+ figure: n,
1094
+ look: o,
1095
+ height: r,
1096
+ lineWidth: t.lineWidth ?? r * (e ? 0.045 : 0.022),
1097
+ ink: t.ink ?? (o === "pencil" ? "#2f2f33" : "#1e293b"),
1098
+ skin: t.skin ?? (o === "pencil" ? "none" : "#ffffff"),
1099
+ seed: t.seed ?? 1,
1100
+ pencil: t.pencil ?? {},
1101
+ layers: t.layers ?? {},
1102
+ contact: t.contact ?? "ground"
1103
+ };
1104
+ }
1105
+ function Ln(t, e, n, o) {
1106
+ const { point: r, facing: s } = de(t, [e, n, o]);
1107
+ return { point: r, facing: s };
1108
+ }
1109
+ const Ot = (t) => t.rest[1] < -0.5, gn = 0.3;
1110
+ function yn(t, e, n) {
1111
+ return t.figure === "stick" ? Ot(e) ? n.slice(0, 3) : n : Ot(e) && n.length >= 3 ? z(n[0], n[1], n[2], gn) : n.length === 3 ? z(n[0], n[1], n[2], 1) : n;
1112
+ }
1113
+ function At(t, e) {
1114
+ const n = t.plan.id === "human" ? { ...K, ...e } : e, o = It(t.plan, n, { height: t.height, contact: t.contact }), r = {}, s = {}, h = {}, i = 0.01 * t.height;
1115
+ t.plan.chains.forEach((f) => {
1116
+ const d = o.chains[f.id];
1117
+ r[f.id] = d.points;
1118
+ const w = d.depths.reduce((E, b) => E + b, 0) / d.depths.length, m = f.parent ? o.chains[f.parent] : void 0, u = m ? m.depths[f.at ?? m.depths.length - 1] : 0, k = w - u;
1119
+ h[f.id] = Math.abs(k) < i ? 0 : k, s[f.id] = { points: yn(t, f, d.points), depth: w };
1120
+ }), s.head = { points: [o.head.center], depth: o.head.depth }, h.head = 0;
1121
+ const l = [...t.plan.chains.map((f) => f.id), "head"], a = [...l].sort((f, d) => h[f] - h[d] || l.indexOf(f) - l.indexOf(d)), c = { hip: o.hip };
1122
+ for (const [f, [d, w]] of Object.entries(t.plan.landmarks ?? {})) {
1123
+ const m = o.chains[d]?.points;
1124
+ m && (c[f] = m[Math.min(w, m.length - 1)]);
1125
+ }
1126
+ const g = {};
1127
+ for (const [f, d] of Object.entries(c)) g[f] = d.y >= o.groundY - 0.01 * t.height;
1128
+ const y = {
1129
+ height: t.height,
1130
+ lineWidth: t.lineWidth,
1131
+ turn: n.turn ?? 0,
1132
+ points: c,
1133
+ chains: r,
1134
+ parts: s,
1135
+ head: o.head,
1136
+ groundY: o.groundY,
1137
+ grounded: g
1138
+ };
1139
+ return { skeleton: o, joints: y, order: a };
1140
+ }
1141
+ function mn(t, e) {
1142
+ return At(t, e).joints;
1143
+ }
1144
+ function pn(t, e, n) {
1145
+ const { head: o } = n;
1146
+ t.guideEllipse(o.center.x, o.center.y, o.rx * 1.03, o.ry * 1.03, o.angle);
1147
+ const r = Array.from({ length: 13 }, (l, a) => ({ x: 0, y: -0.95 + 1.9 * a / 12 })), s = Array.from({ length: 13 }, (l, a) => ({ x: -0.95 + 1.9 * a / 12, y: 0.12 })), h = dt(o, r, { x: 0, y: 0 });
1148
+ h.facing > 0 && t.guide(h.points), t.guide(dt(o, s, { x: 0, y: 0.12 }).points), t.guide(n.chains.spine ?? []);
1149
+ const i = e.lineWidth * 0.9;
1150
+ for (const l of ["shoulder.left", "shoulder.right", "elbow.left", "elbow.right", "hip.left", "hip.right", "knee.left", "knee.right"]) {
1151
+ const a = n.points[l];
1152
+ a && t.guideEllipse(a.x, a.y, i, i, 0);
1153
+ }
1154
+ }
1155
+ function wn(t, e, n, o, r) {
1156
+ const s = e.lineWidth;
1157
+ if (o === "head") {
1158
+ const { head: y } = n, f = e.skin === "none" ? null : e.skin;
1159
+ t.ellipse(y.center.x, y.center.y, y.rx, y.ry, y.angle, f, s), t.look !== "silhouette" && rn(t, y, r, s);
1160
+ return;
1161
+ }
1162
+ const h = e.plan.chains.find((y) => y.id === o), i = n.chains[o], l = n.parts[o].points;
1163
+ if (e.figure === "stick") {
1164
+ if (o === "neck") return;
1165
+ const y = o === "spine" ? [...i, ...n.chains.neck?.slice(1) ?? []] : l;
1166
+ t.line(y, s);
1167
+ return;
1168
+ }
1169
+ const a = (y, f) => [h.bones[y].width[0] * s, h.bones[f].width[1] * s];
1170
+ if (Ot(h)) {
1171
+ const [y, f] = a(0, 1);
1172
+ if (t.limb(l, y, f), h.bones.length >= 3)
1173
+ t.limb([i[2], i[3]], h.bones[2].width[0] * s, h.bones[2].width[1] * s);
1174
+ else {
1175
+ const d = i[i.length - 1];
1176
+ t.dot(d.x, d.y, s * 0.62);
1177
+ }
1178
+ return;
1179
+ }
1180
+ if (o === "spine") {
1181
+ const y = n.points["hip.left"], f = n.points["hip.right"];
1182
+ y && f && Math.hypot(y.x - f.x, y.y - f.y) > 0.5 && t.limb([y, f], s * 1.3, s * 1.3);
1183
+ const [d, w] = a(0, h.bones.length - 1);
1184
+ t.limb(l, d, w);
1185
+ const m = n.points["shoulder.left"], u = n.points["shoulder.right"];
1186
+ m && u && Math.hypot(m.x - u.x, m.y - u.y) > 0.5 && t.limb(z(m, i[i.length - 1], u, 1, 10), s * 1.15, s * 1.15);
1187
+ return;
1188
+ }
1189
+ const [c, g] = a(0, h.bones.length - 1);
1190
+ t.limb(l, c, g);
1191
+ }
1192
+ function bn(t, e, n, o = 0) {
1193
+ const r = e.plan.id === "human" ? { ...K, ...n } : n, { joints: s, order: h } = At(e, r), i = ze(t, {
1194
+ look: e.look,
1195
+ ink: e.ink,
1196
+ lineWidth: e.lineWidth,
1197
+ seed: e.seed,
1198
+ time: o,
1199
+ pencil: e.pencil
1200
+ }), l = (a) => {
1201
+ a && (t.save(), a(t, s, i, o), t.restore());
1202
+ };
1203
+ t.save(), t.lineCap = "round", t.lineJoin = "round", e.look === "pencil" && e.pencil.construction !== !1 && pn(i, e, s), l(e.layers.behind);
1204
+ for (const a of h) {
1205
+ const c = e.layers.parts?.[a];
1206
+ l(c?.under), wn(i, e, s, a, r), l(c?.over);
1207
+ }
1208
+ l(e.layers.front), t.restore();
1209
+ }
1210
+ function Fn(t, e, n) {
1211
+ const o = { ...t };
1212
+ for (const [r, s] of Object.entries(e)) {
1213
+ const h = t[r] ?? s;
1214
+ o[r] = h + (s - h) * n;
1215
+ }
1216
+ return o;
1217
+ }
1218
+ function Nn(t, e, n, o) {
1219
+ const r = t.plan.id === "human" ? { ...K, ...e } : e;
1220
+ let s;
1221
+ if (Array.isArray(o))
1222
+ s = o;
1223
+ else {
1224
+ const { skeleton: h } = At(t, r), i = It(t.plan, { ...r, roll: 0 }, { height: t.height, contact: "none" }), l = (r.roll ?? 0) * Math.PI / 180, a = o.x - h.hip.x, c = o.y - h.hip.y, g = i.hip.x + a * Math.cos(-l) - c * Math.sin(-l), y = i.hip.y + a * Math.sin(-l) + c * Math.cos(-l), f = Math.PI / 2 * (r.turn ?? 0), d = o.depth ?? h.chains[n].depths[h.chains[n].depths.length - 1], w = Math.cos(f), m = Math.sin(f);
1225
+ s = [g * w - d * m, -y, g * m + d * w];
1226
+ }
1227
+ return Je(t.plan, r, n, s, { height: t.height });
1228
+ }
1229
+ function Cn(t) {
1230
+ const { character: e } = t, n = e.height * 0.8, o = e.height, r = e.plan.id === "human" ? K : {};
1231
+ return {
1232
+ type: "custom",
1233
+ x: t.x - n / 2,
1234
+ y: t.y - o,
1235
+ width: n,
1236
+ height: o,
1237
+ props: { ...r, ...t.pose },
1238
+ character: e,
1239
+ draw(s, h, i) {
1240
+ s.translate(n / 2, o), bn(s, e, h.props, i);
1241
+ }
1242
+ };
1243
+ }
1244
+ function Mn(t, e, n) {
1245
+ const o = (s) => ({ x: s.x + e, y: s.y + n }), r = (s) => Object.fromEntries(Object.entries(s).map(([h, i]) => [h, i.map(o)]));
1246
+ return {
1247
+ ...t,
1248
+ points: Object.fromEntries(Object.entries(t.points).map(([s, h]) => [s, o(h)])),
1249
+ chains: r(t.chains),
1250
+ parts: Object.fromEntries(Object.entries(t.parts).map(([s, h]) => [s, { ...h, points: h.points.map(o) }])),
1251
+ head: { ...t.head, center: o(t.head.center) },
1252
+ groundY: t.groundY + n
1253
+ };
1254
+ }
1255
+ function Xn(t, e, n) {
1256
+ const o = t.character;
1257
+ if (!o) throw new Error("characterAt: the target was not made by characterTarget");
1258
+ const r = { ...t.props };
1259
+ let s = 0, h = 0;
1260
+ for (const [l, a] of e.state?.values.get(n) ?? [])
1261
+ typeof a == "number" && (l === "x" || l === "motionPathX" ? s = a : l === "y" || l === "motionPathY" ? h = a : l in r && (r[l] = a));
1262
+ const i = mn(o, r);
1263
+ return { pose: r, joints: Mn(i, t.x + s + t.width / 2, t.y + h + t.height) };
1264
+ }
1265
+ function qn(t, e, n = K) {
1266
+ const o = [];
1267
+ return e.forEach((s, h) => {
1268
+ const i = h === 0 ? n : o[h - 1], l = typeof s.pose == "string" ? fn[s.pose] : void 0;
1269
+ o.push(l ? { ...l, turn: i.turn ?? 0 } : { ...i, ...s.pose });
1270
+ }), Object.keys(n).filter((s) => o.some((h) => (h[s] ?? n[s]) !== n[s])).map((s) => ({
1271
+ id: `${t}-${s}`,
1272
+ target: t,
1273
+ property: s,
1274
+ keyframes: e.map((h, i) => ({
1275
+ time: h.time,
1276
+ value: o[i][s] ?? n[s],
1277
+ ...h.easing ? { easing: h.easing } : {}
1278
+ }))
1279
+ }));
1280
+ }
1281
+ const kn = (t, e, n) => t.slice(Math.floor((t.length - 1) * e), Math.ceil((t.length - 1) * n) + 1);
1282
+ function Un(t = {}) {
1283
+ const e = t.shirt ?? "#e2493b", n = t.trousers ?? "#24476b", o = (i) => i.lineWidth * 0.45, r = (i, l, a) => {
1284
+ const c = i.parts[`leg.${a}`].points;
1285
+ l.shape(ht(c, i.height * 0.08, i.height * 0.05), n, o(i));
1286
+ }, s = (i, l) => {
1287
+ const a = i.chains.spine, c = a[0], g = a[a.length - 1], y = { x: c.x - (g.x - c.x) * 0.25, y: c.y - (g.y - c.y) * 0.25 };
1288
+ l.shape(ht([y, ...i.parts.spine.points], i.height * 0.15, i.height * 0.14), e, o(i));
1289
+ }, h = (i, l, a) => {
1290
+ const c = i.parts[`arm.${a}`].points, g = c[0], y = i.chains.spine[i.chains.spine.length - 1], d = [{ x: g.x + (y.x - g.x) * 0.45, y: g.y + (y.y - g.y) * 0.45 }, ...kn(c, 0, 0.45)], w = ht(d, i.height * 0.085, i.height * 0.06), m = d.length, u = w.slice(0, m), k = w.slice(m).reverse();
1291
+ l.shape(w, e, 0);
1292
+ const E = (P) => Math.hypot(P[1].x - y.x, P[1].y - y.y), [b, M] = E(u) > E(k) ? [u, k] : [k, u];
1293
+ l.line(b.slice(1), o(i)), l.line(M.slice(Math.ceil(m * 0.45)), o(i)), l.line([u[m - 1], k[m - 1]], o(i));
1294
+ };
1295
+ return {
1296
+ parts: {
1297
+ "leg.left": { over: (i, l, a) => r(l, a, "left") },
1298
+ "leg.right": { over: (i, l, a) => r(l, a, "right") },
1299
+ spine: { over: (i, l, a) => s(l, a) },
1300
+ "arm.left": { over: (i, l, a) => h(l, a, "left") },
1301
+ "arm.right": { over: (i, l, a) => h(l, a, "right") }
533
1302
  }
534
1303
  };
535
1304
  }
536
1305
  export {
537
- H as EXPRESSIONS,
538
- pe as POSES,
539
- Y as REST_POSE,
1306
+ N as EXPRESSIONS,
1307
+ Bn as HUMAN_EXPRESSIONS,
1308
+ fn as HUMAN_POSES,
1309
+ K as HUMAN_REST,
1310
+ be as POSES,
1311
+ G as REST_POSE,
1312
+ Un as basicOutfit,
540
1313
  Me as blendPose,
541
- ht as boilFrame,
542
- tt as circlePath,
543
- be as clipErased,
544
- me as drawEraser,
545
- ge as drawHand,
546
- Je as drawPencil,
547
- Ge as drawStickFigure,
548
- ot as drawnPathTarget,
549
- rt as erasable,
550
- $e as headPoint,
551
- qe as jointsToScene,
552
- oe as partialPath,
553
- at as pathLength,
554
- ne as pointAlong,
555
- P as pose,
556
- et as poseTracks,
557
- ue as resolveStickPose,
558
- U as rubberLimb,
559
- nt as scrubPath,
560
- Ze as seatHeight,
561
- X as sketchPen,
562
- je as stickFigureAt,
563
- De as stickFigureJoints,
564
- Ve as stickFigureTarget,
565
- Qe as strideLength,
566
- ke as talkingMouth,
567
- Ue as taperedLine,
568
- Te as walkPose,
569
- lt as withErased,
570
- Ee as withExpression
1314
+ ye as boilFrame,
1315
+ Rn as character,
1316
+ Xn as characterAt,
1317
+ mn as characterJoints,
1318
+ qn as characterPoseTracks,
1319
+ Cn as characterTarget,
1320
+ In as circlePath,
1321
+ ae as clipErased,
1322
+ ze as createPen,
1323
+ bn as drawCharacter,
1324
+ ie as drawEraser,
1325
+ le as drawHand,
1326
+ je as drawPencil,
1327
+ De as drawStickFigure,
1328
+ An as drawnPathTarget,
1329
+ Xt as ellipsePoints,
1330
+ Yn as erasable,
1331
+ Tn as headPoint,
1332
+ $n as humanFieldLabel,
1333
+ dn as humanPlan,
1334
+ R as humanPose,
1335
+ Mn as jointsInScene,
1336
+ Ke as jointsToScene,
1337
+ Fn as mixPoses,
1338
+ Dt as partialPath,
1339
+ jn as pathLength,
1340
+ jt as pointAlong,
1341
+ Ln as pointOnHead,
1342
+ B as pose,
1343
+ On as poseTracks,
1344
+ Nn as reachCharacter,
1345
+ re as resolveStickPose,
1346
+ z as rubberLimb,
1347
+ Hn as scrubPath,
1348
+ Pn as seatHeight,
1349
+ xt as sketchPen,
1350
+ Wn as stickFigureAt,
1351
+ Ue as stickFigureJoints,
1352
+ vn as stickFigureTarget,
1353
+ Sn as strideLength,
1354
+ xe as talkingMouth,
1355
+ Jt as taperedLine,
1356
+ ht as taperedOutline,
1357
+ Ee as walkPose,
1358
+ _n as withErased,
1359
+ we as withExpression
571
1360
  };