msdfgen-ts 0.3.0 → 0.3.1

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,10 +1,10 @@
1
- function wi(e, t, n, s) {
1
+ function Ai(e, t, n, s) {
2
2
  return e * n + t * s;
3
3
  }
4
4
  function Q(e, t, n, s) {
5
5
  return e * s - t * n;
6
6
  }
7
- function Wo(e, t, n) {
7
+ function zo(e, t, n) {
8
8
  return (1 - n) * e + n * t;
9
9
  }
10
10
  function _t(e) {
@@ -13,7 +13,7 @@ function _t(e) {
13
13
  function Kt(e) {
14
14
  return 2 * +(e > 0) - 1;
15
15
  }
16
- function zo(e, t, n, s) {
16
+ function Zo(e, t, n, s) {
17
17
  if (t === 0 || Math.abs(n) > 1e12 * Math.abs(t))
18
18
  return n === 0 ? s === 0 ? -1 : 0 : (e[0] = -s / n, 1);
19
19
  const o = n * n - 4 * t * s;
@@ -24,7 +24,7 @@ function zo(e, t, n, s) {
24
24
  return e[0] = -n / (2 * t), 1;
25
25
  return 0;
26
26
  }
27
- function bi(e, t, n, s) {
27
+ function ki(e, t, n, s) {
28
28
  const o = t * t, i = 1 / 9 * (o - 3 * n), r = 1 / 54 * (t * (2 * o - 9 * n) + 27 * s), c = r * r, a = i * i * i, l = t * (1 / 3);
29
29
  if (c < a) {
30
30
  let h = r / Math.sqrt(a);
@@ -36,23 +36,23 @@ function bi(e, t, n, s) {
36
36
  return e[0] = h + f - l, h === f || Math.abs(h - f) < 1e-12 * Math.abs(h + f) ? (e[1] = -0.5 * (h + f) - l, 2) : 1;
37
37
  }
38
38
  }
39
- function Ai(e, t, n, s, o) {
39
+ function Ui(e, t, n, s, o) {
40
40
  if (t !== 0) {
41
41
  const i = n / t;
42
42
  if (Math.abs(i) < 1e6)
43
- return bi(e, i, s / t, o / t);
43
+ return ki(e, i, s / t, o / t);
44
44
  }
45
- return zo(e, n, s, o);
45
+ return Zo(e, n, s, o);
46
46
  }
47
- const ki = 24;
47
+ const Ti = 24;
48
48
  function dn(e, t, n, s) {
49
49
  return ((s + e) * s + t) * s + n;
50
50
  }
51
- function Ui(e, t, n, s, o, i, r) {
51
+ function Si(e, t, n, s, o, i, r) {
52
52
  const c = i < 0;
53
53
  let a = s - i * (o - s) / (r - i);
54
54
  a > s && a < o || (a = 0.5 * (s + o));
55
- for (let l = 0; l < ki; l++) {
55
+ for (let l = 0; l < Ti; l++) {
56
56
  const h = dn(e, t, n, a);
57
57
  if (h === 0) return a;
58
58
  h < 0 === c ? s = a : o = a;
@@ -65,9 +65,9 @@ function Ui(e, t, n, s, o, i, r) {
65
65
  return a;
66
66
  }
67
67
  function qn(e, t, n, s, o, i, r, c, a) {
68
- return i === 0 ? c[a++] = s : i < 0 != r < 0 && (c[a++] = Ui(e, t, n, s, o, i, r)), a;
68
+ return i === 0 ? c[a++] = s : i < 0 != r < 0 && (c[a++] = Si(e, t, n, s, o, i, r)), a;
69
69
  }
70
- function Ti(e, t, n, s, o, i) {
70
+ function Ci(e, t, n, s, o, i) {
71
71
  let r = 0;
72
72
  if (e === 0) {
73
73
  if (t === 0) return 0;
@@ -86,8 +86,8 @@ function Ti(e, t, n, s, o, i) {
86
86
  }
87
87
  return h >= s && h <= o && (i[r++] = h), f !== h && f >= s && f <= o && (i[r++] = f), r;
88
88
  }
89
- function Si(e, t, n, s, o, i, r) {
90
- if (e === 0) return Ti(t, n, s, o, i, r);
89
+ function vi(e, t, n, s, o, i, r) {
90
+ if (e === 0) return Ci(t, n, s, o, i, r);
91
91
  const c = 1 / e;
92
92
  t *= c, n *= c, s *= c;
93
93
  const a = dn(t, n, s, o), l = dn(t, n, s, i), h = t * t - 3 * n;
@@ -98,18 +98,18 @@ function Si(e, t, n, s, o, i, r) {
98
98
  const p = Math.sqrt(h) / 3, u = -t / 3, _ = u - p, y = u + p;
99
99
  let g = o, x = a;
100
100
  if (_ > o && _ < i) {
101
- const w = dn(t, n, s, _);
102
- f = qn(t, n, s, g, _, x, w, r, f), g = _, x = w;
101
+ const b = dn(t, n, s, _);
102
+ f = qn(t, n, s, g, _, x, b, r, f), g = _, x = b;
103
103
  }
104
104
  if (y > o && y < i) {
105
- const w = dn(t, n, s, y);
106
- f = qn(t, n, s, g, y, x, w, r, f), g = y, x = w;
105
+ const b = dn(t, n, s, y);
106
+ f = qn(t, n, s, g, y, x, b, r, f), g = y, x = b;
107
107
  }
108
108
  f = qn(t, n, s, g, i, x, l, r, f);
109
109
  }
110
110
  return l === 0 && (r[f++] = i), f;
111
111
  }
112
- const st = 0, ct = 1, Gt = 2, so = 4, Ci = 4, j = [0, 0, 0];
112
+ const tt = 0, ct = 1, Gt = 2, eo = 4, Ei = 4, j = [0, 0, 0];
113
113
  class et {
114
114
  /**
115
115
  * @param type Segment type (LINEAR=0, QUADRATIC=1, CUBIC=2).
@@ -128,7 +128,7 @@ class et {
128
128
  /** Endpoint x (the on-curve destination of this segment). */
129
129
  endX() {
130
130
  switch (this.type) {
131
- case st:
131
+ case tt:
132
132
  return this.p1x;
133
133
  case ct:
134
134
  return this.p2x;
@@ -139,7 +139,7 @@ class et {
139
139
  /** Endpoint y. */
140
140
  endY() {
141
141
  switch (this.type) {
142
- case st:
142
+ case tt:
143
143
  return this.p1y;
144
144
  case ct:
145
145
  return this.p2y;
@@ -157,7 +157,7 @@ class et {
157
157
  point(t, n) {
158
158
  const s = t;
159
159
  switch (this.type) {
160
- case st: {
160
+ case tt: {
161
161
  n[0] = this.p0x + s * (this.p1x - this.p0x), n[1] = this.p0y + s * (this.p1y - this.p0y);
162
162
  return;
163
163
  }
@@ -183,7 +183,7 @@ class et {
183
183
  direction(t, n) {
184
184
  const s = t;
185
185
  switch (this.type) {
186
- case st: {
186
+ case tt: {
187
187
  n[0] = this.p1x - this.p0x, n[1] = this.p1y - this.p0y;
188
188
  return;
189
189
  }
@@ -209,9 +209,9 @@ class et {
209
209
  splitInThirds() {
210
210
  const t = [0, 0], n = [0, 0];
211
211
  switch (this.type) {
212
- case st: {
212
+ case tt: {
213
213
  this.point(1 / 3, t), this.point(2 / 3, n);
214
- const s = new et(st, this.p0x, this.p0y, t[0], t[1], 0, 0, 0, 0), o = new et(st, t[0], t[1], n[0], n[1], 0, 0, 0, 0), i = new et(st, n[0], n[1], this.p1x, this.p1y, 0, 0, 0, 0);
214
+ const s = new et(tt, this.p0x, this.p0y, t[0], t[1], 0, 0, 0, 0), o = new et(tt, t[0], t[1], n[0], n[1], 0, 0, 0, 0), i = new et(tt, n[0], n[1], this.p1x, this.p1y, 0, 0, 0, 0);
215
215
  return s.color = o.color = i.color = this.color, [s, o, i];
216
216
  }
217
217
  case ct: {
@@ -251,7 +251,7 @@ class et {
251
251
  }
252
252
  default: {
253
253
  this.point(1 / 3, t), this.point(2 / 3, n);
254
- const s = this.p0x === this.p1x && this.p0y === this.p1y ? this.p0x : this.p0x + 1 / 3 * (this.p1x - this.p0x), o = this.p0x === this.p1x && this.p0y === this.p1y ? this.p0y : this.p0y + 1 / 3 * (this.p1y - this.p0y), i = this.p0x + 1 / 3 * (this.p1x - this.p0x), r = this.p0y + 1 / 3 * (this.p1y - this.p0y), c = this.p1x + 1 / 3 * (this.p2x - this.p1x), a = this.p1y + 1 / 3 * (this.p2y - this.p1y), l = this.p2x + 1 / 3 * (this.p3x - this.p2x), h = this.p2y + 1 / 3 * (this.p3y - this.p2y), f = i + 1 / 3 * (c - i), p = r + 1 / 3 * (a - r), u = c + 1 / 3 * (l - c), _ = a + 1 / 3 * (h - a), y = f + 2 / 3 * (u - f), g = p + 2 / 3 * (_ - p), x = this.p0x + 2 / 3 * (this.p1x - this.p0x), w = this.p0y + 2 / 3 * (this.p1y - this.p0y), M = this.p1x + 2 / 3 * (this.p2x - this.p1x), A = this.p1y + 2 / 3 * (this.p2y - this.p1y), k = this.p2x + 2 / 3 * (this.p3x - this.p2x), T = this.p2y + 2 / 3 * (this.p3y - this.p2y), S = x + 2 / 3 * (M - x), b = w + 2 / 3 * (A - w), m = M + 2 / 3 * (k - M), d = A + 2 / 3 * (T - A), U = S + 1 / 3 * (m - S), v = b + 1 / 3 * (d - b), C = this.p2x === this.p3x && this.p2y === this.p3y ? this.p3x : this.p2x + 2 / 3 * (this.p3x - this.p2x), I = this.p2x === this.p3x && this.p2y === this.p3y ? this.p3y : this.p2y + 2 / 3 * (this.p3y - this.p2y), R = new et(
254
+ const s = this.p0x === this.p1x && this.p0y === this.p1y ? this.p0x : this.p0x + 1 / 3 * (this.p1x - this.p0x), o = this.p0x === this.p1x && this.p0y === this.p1y ? this.p0y : this.p0y + 1 / 3 * (this.p1y - this.p0y), i = this.p0x + 1 / 3 * (this.p1x - this.p0x), r = this.p0y + 1 / 3 * (this.p1y - this.p0y), c = this.p1x + 1 / 3 * (this.p2x - this.p1x), a = this.p1y + 1 / 3 * (this.p2y - this.p1y), l = this.p2x + 1 / 3 * (this.p3x - this.p2x), h = this.p2y + 1 / 3 * (this.p3y - this.p2y), f = i + 1 / 3 * (c - i), p = r + 1 / 3 * (a - r), u = c + 1 / 3 * (l - c), _ = a + 1 / 3 * (h - a), y = f + 2 / 3 * (u - f), g = p + 2 / 3 * (_ - p), x = this.p0x + 2 / 3 * (this.p1x - this.p0x), b = this.p0y + 2 / 3 * (this.p1y - this.p0y), M = this.p1x + 2 / 3 * (this.p2x - this.p1x), A = this.p1y + 2 / 3 * (this.p2y - this.p1y), k = this.p2x + 2 / 3 * (this.p3x - this.p2x), T = this.p2y + 2 / 3 * (this.p3y - this.p2y), S = x + 2 / 3 * (M - x), w = b + 2 / 3 * (A - b), m = M + 2 / 3 * (k - M), d = A + 2 / 3 * (T - A), U = S + 1 / 3 * (m - S), v = w + 1 / 3 * (d - w), C = this.p2x === this.p3x && this.p2y === this.p3y ? this.p3x : this.p2x + 2 / 3 * (this.p3x - this.p2x), I = this.p2x === this.p3x && this.p2y === this.p3y ? this.p3y : this.p2y + 2 / 3 * (this.p3y - this.p2y), R = new et(
255
255
  Gt,
256
256
  this.p0x,
257
257
  this.p0y,
@@ -301,7 +301,7 @@ class et {
301
301
  */
302
302
  signedDistance(t, n, s) {
303
303
  switch (this.type) {
304
- case st: {
304
+ case tt: {
305
305
  const o = this.p0x, i = this.p0y, r = this.p1x, c = this.p1y, a = t - o, l = n - i, h = r - o, f = c - i, p = h * h + f * f, u = (a * h + l * f) / p, _ = u > 0.5, y = (_ ? r : o) - t, g = (_ ? c : i) - n, x = Math.sqrt(y * y + g * g);
306
306
  if (u > 0 && u < 1) {
307
307
  const A = Math.sqrt(h * h + f * f), k = h / A, S = f / A * a - k * l;
@@ -310,20 +310,20 @@ class et {
310
310
  return;
311
311
  }
312
312
  }
313
- const w = a * f - l * h;
314
- s.distance = Kt(w) * x;
313
+ const b = a * f - l * h;
314
+ s.distance = Kt(b) * x;
315
315
  const M = Math.sqrt(h * h + f * f);
316
316
  s.dot = x === 0 || M === 0 ? 0 : Math.abs((h * y + f * g) / (M * x)), s.param = u;
317
317
  return;
318
318
  }
319
319
  case ct: {
320
- const o = this.p0x, i = this.p0y, r = this.p1x, c = this.p1y, a = this.p2x, l = this.p2y, h = o - t, f = i - n, p = r - o, u = c - i, _ = a - r - p, y = l - c - u, g = _ * _ + y * y, x = 3 * (p * _ + u * y), w = 2 * (p * p + u * u) + (h * _ + f * y), M = h * p + f * u, A = Si(g, x, w, M, 0, 1, j);
320
+ const o = this.p0x, i = this.p0y, r = this.p1x, c = this.p1y, a = this.p2x, l = this.p2y, h = o - t, f = i - n, p = r - o, u = c - i, _ = a - r - p, y = l - c - u, g = _ * _ + y * y, x = 3 * (p * _ + u * y), b = 2 * (p * p + u * u) + (h * _ + f * y), M = h * p + f * u, A = vi(g, x, b, M, 0, 1, j);
321
321
  let k = p, T = u;
322
322
  const S = h * h + f * f;
323
- let b = Kt(k * f - T * h), m = S, d = -(h * k + f * T) / (k * k + T * T);
323
+ let w = Kt(k * f - T * h), m = S, d = -(h * k + f * T) / (k * k + T * T);
324
324
  {
325
325
  const v = a - t, C = l - n, I = v * v + C * C;
326
- I < m && (k = a - r, T = l - c, b = Kt(k * C - T * v), m = I, d = ((t - r) * k + (n - c) * T) / (k * k + T * T));
326
+ I < m && (k = a - r, T = l - c, w = Kt(k * C - T * v), m = I, d = ((t - r) * k + (n - c) * T) / (k * k + T * T));
327
327
  }
328
328
  for (let v = 0; v < A; ++v) {
329
329
  const C = j[v];
@@ -331,11 +331,11 @@ class et {
331
331
  const I = h + 2 * C * p + C * C * _, R = f + 2 * C * u + C * C * y, G = I * I + R * R;
332
332
  if (G <= m) {
333
333
  const F = p + C * _, X = u + C * y;
334
- b = Kt(F * R - X * I), m = G, d = C;
334
+ w = Kt(F * R - X * I), m = G, d = C;
335
335
  }
336
336
  }
337
337
  }
338
- const U = b * Math.sqrt(m);
338
+ const U = w * Math.sqrt(m);
339
339
  if (d >= 0 && d <= 1) {
340
340
  s.distance = U, s.dot = 0, s.param = d;
341
341
  return;
@@ -350,35 +350,35 @@ class et {
350
350
  return;
351
351
  }
352
352
  default: {
353
- const o = this.p0x, i = this.p0y, r = this.p1x, c = this.p1y, a = this.p2x, l = this.p2y, h = this.p3x, f = this.p3y, p = o - t, u = i - n, _ = r - o, y = c - i, g = a - r - _, x = l - c - y, w = h - a - (a - r) - g, M = f - l - (l - c) - x;
353
+ const o = this.p0x, i = this.p0y, r = this.p1x, c = this.p1y, a = this.p2x, l = this.p2y, h = this.p3x, f = this.p3y, p = o - t, u = i - n, _ = r - o, y = c - i, g = a - r - _, x = l - c - y, b = h - a - (a - r) - g, M = f - l - (l - c) - x;
354
354
  let A = _, k = y;
355
355
  A === 0 && k === 0 && (A = a - o, k = l - i);
356
356
  const T = Math.sqrt(p * p + u * u);
357
- let S = Kt(A * u - k * p) * T, b = -(p * A + u * k) / (A * A + k * k);
357
+ let S = Kt(A * u - k * p) * T, w = -(p * A + u * k) / (A * A + k * k);
358
358
  {
359
359
  const m = h - t, d = f - n, U = Math.sqrt(m * m + d * d);
360
360
  if (U < Math.abs(S)) {
361
361
  let v = h - a, C = f - l;
362
- v === 0 && C === 0 && (v = h - r, C = f - c), A = v, k = C, S = Kt(A * d - k * m) * U, b = ((A - m) * A + (k - d) * k) / (A * A + k * k);
362
+ v === 0 && C === 0 && (v = h - r, C = f - c), A = v, k = C, S = Kt(A * d - k * m) * U, w = ((A - m) * A + (k - d) * k) / (A * A + k * k);
363
363
  }
364
364
  }
365
- for (let m = 0; m <= so; ++m) {
366
- let d = 1 / so * m, U = p + 3 * d * _ + 3 * d * d * g + d * d * d * w, v = u + 3 * d * y + 3 * d * d * x + d * d * d * M, C = 3 * _ + 6 * d * g + 3 * d * d * w, I = 3 * y + 6 * d * x + 3 * d * d * M, R = 6 * g + 6 * d * w, G = 6 * x + 6 * d * M, F = d - (U * C + v * I) / (C * C + I * I + (U * R + v * G));
365
+ for (let m = 0; m <= eo; ++m) {
366
+ let d = 1 / eo * m, U = p + 3 * d * _ + 3 * d * d * g + d * d * d * b, v = u + 3 * d * y + 3 * d * d * x + d * d * d * M, C = 3 * _ + 6 * d * g + 3 * d * d * b, I = 3 * y + 6 * d * x + 3 * d * d * M, R = 6 * g + 6 * d * b, G = 6 * x + 6 * d * M, F = d - (U * C + v * I) / (C * C + I * I + (U * R + v * G));
367
367
  if (F > 0 && F < 1) {
368
- let X = Ci;
368
+ let X = Ei;
369
369
  do {
370
- if (d = F, U = p + 3 * d * _ + 3 * d * d * g + d * d * d * w, v = u + 3 * d * y + 3 * d * d * x + d * d * d * M, C = 3 * _ + 6 * d * g + 3 * d * d * w, I = 3 * y + 6 * d * x + 3 * d * d * M, !--X) break;
371
- R = 6 * g + 6 * d * w, G = 6 * x + 6 * d * M, F = d - (U * C + v * I) / (C * C + I * I + (U * R + v * G));
370
+ if (d = F, U = p + 3 * d * _ + 3 * d * d * g + d * d * d * b, v = u + 3 * d * y + 3 * d * d * x + d * d * d * M, C = 3 * _ + 6 * d * g + 3 * d * d * b, I = 3 * y + 6 * d * x + 3 * d * d * M, !--X) break;
371
+ R = 6 * g + 6 * d * b, G = 6 * x + 6 * d * M, F = d - (U * C + v * I) / (C * C + I * I + (U * R + v * G));
372
372
  } while (F > 0 && F < 1);
373
373
  const H = Math.sqrt(U * U + v * v);
374
- H < Math.abs(S) && (S = Kt(C * v - I * U) * H, b = d);
374
+ H < Math.abs(S) && (S = Kt(C * v - I * U) * H, w = d);
375
375
  }
376
376
  }
377
- if (b >= 0 && b <= 1) {
378
- s.distance = S, s.dot = 0, s.param = b;
377
+ if (w >= 0 && w <= 1) {
378
+ s.distance = S, s.dot = 0, s.param = w;
379
379
  return;
380
380
  }
381
- if (s.distance = S, s.param = b, b < 0.5) {
381
+ if (s.distance = S, s.param = w, w < 0.5) {
382
382
  let m = _, d = y;
383
383
  m === 0 && d === 0 && (m = a - o, d = l - i);
384
384
  const U = Math.sqrt(m * m + d * d);
@@ -406,11 +406,11 @@ class et {
406
406
  */
407
407
  scanlineIntersections(t, n, s) {
408
408
  switch (this.type) {
409
- case st: {
409
+ case tt: {
410
410
  const o = this.p0y, i = this.p1y;
411
411
  if (t >= o && t < i || t >= i && t < o) {
412
412
  const r = (t - o) / (i - o);
413
- return n[0] = Wo(this.p0x, this.p1x, r), s[0] = _t(i - o), 1;
413
+ return n[0] = zo(this.p0x, this.p1x, r), s[0] = _t(i - o), 1;
414
414
  }
415
415
  return 0;
416
416
  }
@@ -419,14 +419,14 @@ class et {
419
419
  let h = 0, f = t > i ? 1 : -1;
420
420
  n[h] = o, i === t && (i < c || i === c && i < l ? s[h++] = 1 : f = 1);
421
421
  {
422
- const p = r - o, u = c - i, _ = a - r - p, y = l - c - u, g = zo(j, y, 2 * u, i - t);
422
+ const p = r - o, u = c - i, _ = a - r - p, y = l - c - u, g = Zo(j, y, 2 * u, i - t);
423
423
  if (g >= 2 && j[0] > j[1]) {
424
424
  const x = j[0];
425
425
  j[0] = j[1], j[1] = x;
426
426
  }
427
427
  for (let x = 0; x < g && h < 2; ++x) {
428
- const w = j[x];
429
- w >= 0 && w <= 1 && (n[h] = o + 2 * w * p + w * w * _, f * (u + w * y) >= 0 && (s[h++] = f, f = -f));
428
+ const b = j[x];
429
+ b >= 0 && b <= 1 && (n[h] = o + 2 * b * p + b * b * _, f * (u + b * y) >= 0 && (s[h++] = f, f = -f));
430
430
  }
431
431
  }
432
432
  return l === t && (f > 0 && h > 0 && (--h, f = -1), (l < c || l === c && l < i) && h < 2 && (n[h] = a, f < 0 && (s[h++] = -1, f = 1))), f !== (t >= l ? 1 : -1) && (h > 0 ? --h : (Math.abs(l - t) < Math.abs(i - t) && (n[h] = a), s[h++] = f)), h;
@@ -436,7 +436,7 @@ class et {
436
436
  let p = 0, u = t > i ? 1 : -1;
437
437
  n[p] = o, i === t && (i < c || i === c && (i < l || i === l && i < f) ? s[p++] = 1 : u = 1);
438
438
  {
439
- const _ = h - 3 * a + 3 * r - o, y = f - 3 * l + 3 * c - i, g = 3 * a - 6 * r + 3 * o, x = 3 * l - 6 * c + 3 * i, w = 3 * r - 3 * o, M = 3 * c - 3 * i, A = Ai(j, y, x, M, i - t);
439
+ const _ = h - 3 * a + 3 * r - o, y = f - 3 * l + 3 * c - i, g = 3 * a - 6 * r + 3 * o, x = 3 * l - 6 * c + 3 * i, b = 3 * r - 3 * o, M = 3 * c - 3 * i, A = Ui(j, y, x, M, i - t);
440
440
  if (A >= 2) {
441
441
  if (j[0] > j[1]) {
442
442
  const k = j[0];
@@ -452,7 +452,7 @@ class et {
452
452
  }
453
453
  for (let k = 0; k < A && p < 3; ++k) {
454
454
  const T = j[k];
455
- T >= 0 && T <= 1 && (n[p] = ((_ * T + g) * T + w) * T + o, u * ((3 * y * T + 2 * x) * T + M) >= 0 && (s[p++] = u, u = -u));
455
+ T >= 0 && T <= 1 && (n[p] = ((_ * T + g) * T + b) * T + o, u * ((3 * y * T + 2 * x) * T + M) >= 0 && (s[p++] = u, u = -u));
456
456
  }
457
457
  }
458
458
  return f === t && (u > 0 && p > 0 && (--p, u = -1), (f < l || f === l && (f < c || f === c && f < i)) && p < 3 && (n[p] = h, u < 0 && (s[p++] = -1, u = 1))), u !== (t >= f ? 1 : -1) && (p > 0 ? --p : (Math.abs(f - t) < Math.abs(i - t) && (n[p] = h), s[p++] = u)), p;
@@ -561,7 +561,7 @@ class Rt {
561
561
  return this._view.getInt16(t, !1);
562
562
  }
563
563
  }
564
- function vi(e, t) {
564
+ function Ii(e, t) {
565
565
  const n = new Rt(e, t);
566
566
  n.skip(2);
567
567
  const s = n.u16();
@@ -573,9 +573,9 @@ function vi(e, t) {
573
573
  }
574
574
  if (!o) return () => 0;
575
575
  const i = n.peekU16(o.subtableAbsOffset);
576
- return i === 12 ? Ei(e, o.subtableAbsOffset) : i === 4 ? Ii(e, o.subtableAbsOffset) : () => 0;
576
+ return i === 12 ? Di(e, o.subtableAbsOffset) : i === 4 ? Ri(e, o.subtableAbsOffset) : () => 0;
577
577
  }
578
- function Ei(e, t) {
578
+ function Di(e, t) {
579
579
  const n = new Rt(e, t);
580
580
  n.skip(2), n.skip(2), n.skip(4), n.skip(4);
581
581
  const s = n.u32(), o = new Uint32Array(s), i = new Uint32Array(s), r = new Uint32Array(s);
@@ -592,7 +592,7 @@ function Ei(e, t) {
592
592
  return 0;
593
593
  };
594
594
  }
595
- function Ii(e, t) {
595
+ function Ri(e, t) {
596
596
  const n = new Rt(e, t);
597
597
  n.skip(2), n.skip(2), n.skip(2);
598
598
  const o = n.u16() >>> 1;
@@ -619,17 +619,17 @@ function Ii(e, t) {
619
619
  u = _ - 1;
620
620
  else {
621
621
  if ((i[_] ?? 0) === 65535) return 0;
622
- const x = l[_] ?? 0, w = c[_] ?? 0, M = r[_] ?? 0;
622
+ const x = l[_] ?? 0, b = c[_] ?? 0, M = r[_] ?? 0;
623
623
  if (x === 0)
624
- return f + w & 65535;
624
+ return f + b & 65535;
625
625
  const A = (a[_] ?? 0) + x + (f - M) * 2, k = h.getUint16(A, !1);
626
- return k === 0 ? 0 : k + w & 65535;
626
+ return k === 0 ? 0 : k + b & 65535;
627
627
  }
628
628
  }
629
629
  return 0;
630
630
  };
631
631
  }
632
- function Di(e, t) {
632
+ function Li(e, t) {
633
633
  const n = new Rt(e, t);
634
634
  n.skip(4), n.skip(4), n.skip(4), n.skip(4), n.skip(2);
635
635
  const s = n.u16();
@@ -637,7 +637,7 @@ function Di(e, t) {
637
637
  const o = n.i16();
638
638
  return { unitsPerEm: s, indexToLocFormat: o };
639
639
  }
640
- function Ri(e, t) {
640
+ function Pi(e, t) {
641
641
  const n = new Rt(e, t);
642
642
  n.skip(4);
643
643
  const s = n.i16(), o = n.i16(), i = n.i16();
@@ -645,7 +645,7 @@ function Ri(e, t) {
645
645
  const r = n.u16();
646
646
  return { ascender: s, descender: o, lineGap: i, numberOfHMetrics: r };
647
647
  }
648
- function Li(e, t, n, s) {
648
+ function Fi(e, t, n, s) {
649
649
  const o = new Rt(e, t), i = [];
650
650
  let r = 0;
651
651
  for (let c = 0; c < s; c++) {
@@ -658,7 +658,7 @@ function Li(e, t, n, s) {
658
658
  }
659
659
  return i;
660
660
  }
661
- function Pi(e, t, n, s) {
661
+ function qi(e, t, n, s) {
662
662
  const o = new Rt(e, t), i = n + 1, r = [];
663
663
  if (s === 0)
664
664
  for (let c = 0; c < i; c++) r[c] = o.u16() * 2;
@@ -666,25 +666,25 @@ function Pi(e, t, n, s) {
666
666
  for (let c = 0; c < i; c++) r[c] = o.u32();
667
667
  return r;
668
668
  }
669
- function Fi(e, t) {
669
+ function Oi(e, t) {
670
670
  const n = new Rt(e, t);
671
671
  return n.skip(4), { numGlyphs: n.u16() };
672
672
  }
673
- const qi = 1, Oi = 2, Gi = 4, Ni = 8, eo = 16, oo = 32, $i = 1, io = 2, Bi = 8, Yi = 32, Hi = 64, Xi = 128;
674
- function Ki(e, t, n, s, o) {
675
- const i = Zo(e, t, n, s, o), r = [];
673
+ const Gi = 1, Ni = 2, $i = 4, Bi = 8, oo = 16, io = 32, Yi = 1, ro = 2, Hi = 8, Xi = 32, Ki = 64, ji = 128;
674
+ function Vi(e, t, n, s, o) {
675
+ const i = Qo(e, t, n, s, o), r = [];
676
676
  for (const c of i) {
677
- const a = Wi(c);
677
+ const a = Zi(c);
678
678
  a.length > 0 && r.push(a);
679
679
  }
680
680
  return { contours: r, inverseYAxis: !1 };
681
681
  }
682
- function Zo(e, t, n, s, o) {
682
+ function Qo(e, t, n, s, o) {
683
683
  if (s === 0) return [];
684
684
  const i = t + n, r = new Rt(e, i), c = r.i16();
685
- return r.skip(8), c >= 0 ? ji(r, c) : zi(e, r, t, o);
685
+ return r.skip(8), c >= 0 ? Wi(r, c) : Qi(e, r, t, o);
686
686
  }
687
- function ji(e, t) {
687
+ function Wi(e, t) {
688
688
  if (t === 0) return [];
689
689
  const n = [];
690
690
  for (let f = 0; f < t; f++) n[f] = e.u16();
@@ -693,7 +693,7 @@ function ji(e, t) {
693
693
  const i = new Uint8Array(s);
694
694
  for (let f = 0; f < s; ) {
695
695
  const p = e.u8();
696
- if (i[f++] = p, p & Ni) {
696
+ if (i[f++] = p, p & Bi) {
697
697
  let u = e.u8();
698
698
  for (; u-- > 0; ) i[f++] = p;
699
699
  }
@@ -702,41 +702,41 @@ function ji(e, t) {
702
702
  let c = 0;
703
703
  for (let f = 0; f < s; f++) {
704
704
  const p = i[f] ?? 0;
705
- if (p & Oi) {
705
+ if (p & Ni) {
706
706
  const u = e.u8();
707
- c += p & eo ? u : -u;
708
- } else p & eo || (c += e.i16());
707
+ c += p & oo ? u : -u;
708
+ } else p & oo || (c += e.i16());
709
709
  r[f] = c;
710
710
  }
711
711
  const a = new Float64Array(s);
712
712
  c = 0;
713
713
  for (let f = 0; f < s; f++) {
714
714
  const p = i[f] ?? 0;
715
- if (p & Gi) {
715
+ if (p & $i) {
716
716
  const u = e.u8();
717
- c += p & oo ? u : -u;
718
- } else p & oo || (c += e.i16());
717
+ c += p & io ? u : -u;
718
+ } else p & io || (c += e.i16());
719
719
  a[f] = c;
720
720
  }
721
721
  const l = [];
722
722
  let h = 0;
723
723
  for (let f = 0; f < t; f++) {
724
- const p = n[f] ?? 0, u = Vi(i, r, a, h, p);
724
+ const p = n[f] ?? 0, u = zi(i, r, a, h, p);
725
725
  u.length > 0 && l.push(u), h = p + 1;
726
726
  }
727
727
  return l;
728
728
  }
729
- function Vi(e, t, n, s, o) {
729
+ function zi(e, t, n, s, o) {
730
730
  const i = o - s + 1;
731
731
  if (i <= 0) return [];
732
732
  const r = [];
733
733
  for (let c = 0; c < i; c++) {
734
734
  const a = e[s + c] ?? 0, l = t[s + c] ?? 0, h = n[s + c] ?? 0;
735
- r.push({ x: l, y: h, onCurve: (a & qi) !== 0 });
735
+ r.push({ x: l, y: h, onCurve: (a & Gi) !== 0 });
736
736
  }
737
737
  return r;
738
738
  }
739
- function Wi(e) {
739
+ function Zi(e) {
740
740
  const t = e.length;
741
741
  if (t <= 0) return [];
742
742
  const n = [];
@@ -762,7 +762,7 @@ function Wi(e) {
762
762
  for (; r < s; ) {
763
763
  const c = n[(o + r) % s], a = n[(o + r + 1) % s];
764
764
  if (a.onCurve)
765
- i.push(new et(st, c.x, c.y, a.x, a.y, 0, 0, 0, 0)), r += 1;
765
+ i.push(new et(tt, c.x, c.y, a.x, a.y, 0, 0, 0, 0)), r += 1;
766
766
  else {
767
767
  const l = n[(o + r + 2) % s];
768
768
  i.push(new et(ct, c.x, c.y, a.x, a.y, l.x, l.y, 0, 0)), r += 2;
@@ -770,38 +770,38 @@ function Wi(e) {
770
770
  }
771
771
  return i;
772
772
  }
773
- function zi(e, t, n, s) {
773
+ function Qi(e, t, n, s) {
774
774
  const o = [];
775
775
  let i = 0;
776
776
  do {
777
777
  i = t.u16();
778
778
  const r = t.u16();
779
779
  let c, a;
780
- i & $i ? (c = t.i16(), a = t.i16()) : (c = t.u8(), a = t.u8(), i & io && (c > 127 && (c -= 256), a > 127 && (a -= 256)));
780
+ i & Yi ? (c = t.i16(), a = t.i16()) : (c = t.u8(), a = t.u8(), i & ro && (c > 127 && (c -= 256), a > 127 && (a -= 256)));
781
781
  let l = 0, h = 0;
782
- i & io && (l = c, h = a);
782
+ i & ro && (l = c, h = a);
783
783
  let f = 1, p = 0, u = 0, _ = 1;
784
- i & Bi ? f = _ = t.f2dot14() : i & Hi ? (f = t.f2dot14(), _ = t.f2dot14()) : i & Xi && (f = t.f2dot14(), p = t.f2dot14(), u = t.f2dot14(), _ = t.f2dot14());
785
- const y = s(r), g = Zi(y, f, p, u, _, l, h);
784
+ i & Hi ? f = _ = t.f2dot14() : i & Ki ? (f = t.f2dot14(), _ = t.f2dot14()) : i & ji && (f = t.f2dot14(), p = t.f2dot14(), u = t.f2dot14(), _ = t.f2dot14());
785
+ const y = s(r), g = Ji(y, f, p, u, _, l, h);
786
786
  for (const x of g) o.push(x);
787
- } while (i & Yi);
787
+ } while (i & Xi);
788
788
  return o;
789
789
  }
790
- function ro(e) {
790
+ function co(e) {
791
791
  return e >= 0 ? Math.floor(e + 0.5) : Math.ceil(e - 0.5);
792
792
  }
793
- function Zi(e, t, n, s, o, i, r) {
793
+ function Ji(e, t, n, s, o, i, r) {
794
794
  if (t === 1 && n === 0 && s === 0 && o === 1 && i === 0 && r === 0) return e;
795
795
  const a = t === 1 && n === 0 && s === 0 && o === 1;
796
796
  return e.map(
797
797
  (l) => l.map((h) => a ? { x: h.x + i, y: h.y + r, onCurve: h.onCurve } : {
798
- x: ro(t * h.x + n * h.y + i),
799
- y: ro(s * h.x + o * h.y + r),
798
+ x: co(t * h.x + n * h.y + i),
799
+ y: co(s * h.x + o * h.y + r),
800
800
  onCurve: h.onCurve
801
801
  })
802
802
  );
803
803
  }
804
- const ln = 1, Qn = 2, Qi = 4, Dt = 8, wn = 16, L = {
804
+ const ln = 1, Qn = 2, tr = 4, Dt = 8, bn = 16, L = {
805
805
  /** Unicode codepoint per glyph. */
806
806
  _cp: new Int32Array(64),
807
807
  /** Glyph index per glyph. */
@@ -818,7 +818,7 @@ const ln = 1, Qn = 2, Qi = 4, Dt = 8, wn = 16, L = {
818
818
  _runEnd: new Int32Array(64),
819
819
  _runScript: new Int32Array(64)
820
820
  };
821
- function bn(e, t, n, s) {
821
+ function wn(e, t, n, s) {
822
822
  if (e & n & 14) return !1;
823
823
  if (e & Dt) {
824
824
  if (n & 16) return s !== null && t < s.length && s[t] !== 65535;
@@ -826,22 +826,22 @@ function bn(e, t, n, s) {
826
826
  }
827
827
  return !0;
828
828
  }
829
- function xe(e, t, n, s) {
829
+ function de(e, t, n, s) {
830
830
  const o = L._gp, i = L._gid;
831
831
  for (let r = e + 1; r < t; r++) {
832
832
  const c = o[r];
833
- if (!(c & ln) && bn(c, i[r], n, s)) return r;
833
+ if (!(c & ln) && wn(c, i[r], n, s)) return r;
834
834
  }
835
835
  return -1;
836
836
  }
837
- function Qo(e) {
837
+ function Jo(e) {
838
838
  if (L._gid.length >= e) return;
839
839
  let t = L._gid.length;
840
840
  for (; t < e; ) t *= 2;
841
841
  L._cp = new Int32Array(t), L._gid = new Uint16Array(t), L._gp = new Uint16Array(t), L._xa = new Float64Array(t), L._xo = new Float64Array(t), L._yo = new Float64Array(t), L._runEnd = new Int32Array(t), L._runScript = new Int32Array(t);
842
842
  }
843
843
  let hn = new Uint8Array(64);
844
- class Ji {
844
+ class nr {
845
845
  /**
846
846
  * @param buffer Full font buffer.
847
847
  * @param offset Byte offset of the kern table.
@@ -888,7 +888,7 @@ class Ji {
888
888
  const h = this._cross[l];
889
889
  h && !c && (c = !0, hn.length < n && (hn = new Uint8Array(n * 2)), hn.fill(0, t, n));
890
890
  for (let f = t; f < n; ) {
891
- const p = xe(f, n, Dt, null);
891
+ const p = de(f, n, Dt, null);
892
892
  if (p < 0) {
893
893
  f++;
894
894
  continue;
@@ -908,15 +908,15 @@ class Ji {
908
908
  for (let l = t + 1; l < n; l++) hn[l] || (r[l] = r[l] + r[l - 1]);
909
909
  }
910
910
  }
911
- const Xt = 65535, Jo = new Uint16Array(0);
912
- function tr(e, t) {
911
+ const Xt = 65535, ti = new Uint16Array(0);
912
+ function sr(e, t) {
913
913
  const n = e.getUint16(t + 4);
914
914
  if (!n) return new Uint32Array(0);
915
915
  const s = t + n, o = new Uint32Array(e.getUint16(s));
916
916
  for (let i = 0; i < o.length; i++) o[i] = e.getUint32(s + 2 + 6 * i);
917
917
  return o;
918
918
  }
919
- function ti(e, t) {
919
+ function ni(e, t) {
920
920
  const n = e.getUint16(t), s = e.getUint16(t + 2);
921
921
  let o = -1;
922
922
  if (n === 1) {
@@ -934,9 +934,9 @@ function ti(e, t) {
934
934
  }
935
935
  return i;
936
936
  }
937
- return Jo;
937
+ return ti;
938
938
  }
939
- function fe(e, t) {
939
+ function pe(e, t) {
940
940
  const n = e.getUint16(t);
941
941
  if (n === 1) {
942
942
  const s = e.getUint16(t + 2), o = e.getUint16(t + 4), i = new Uint16Array(s + o);
@@ -954,9 +954,9 @@ function fe(e, t) {
954
954
  }
955
955
  return i;
956
956
  }
957
- return Jo;
957
+ return ti;
958
958
  }
959
- class nr {
959
+ class er {
960
960
  /**
961
961
  * @param buffer Full font buffer.
962
962
  * @param offset Byte offset of the GDEF table.
@@ -971,14 +971,14 @@ class nr {
971
971
  this._props = null;
972
972
  return;
973
973
  }
974
- const l = fe(o, n + r), h = c ? fe(o, n + c) : new Uint16Array(0), f = new Uint16Array(s);
974
+ const l = pe(o, n + r), h = c ? pe(o, n + c) : new Uint16Array(0), f = new Uint16Array(s);
975
975
  for (let p = 0; p < s && p < l.length; p++)
976
976
  switch (l[p]) {
977
977
  case 1:
978
978
  f[p] = Qn;
979
979
  break;
980
980
  case 2:
981
- f[p] = Qi;
981
+ f[p] = tr;
982
982
  break;
983
983
  case 3:
984
984
  f[p] = Dt | (h[p] ?? 0) << 8;
@@ -991,18 +991,18 @@ class nr {
991
991
  let n = this._setCache[t];
992
992
  if (!n) {
993
993
  const s = this._dv, o = this._sets;
994
- n = o && t < s.getUint16(o + 2) ? ti(s, o + s.getUint32(o + 4 + 4 * t)) : new Uint16Array(0), this._setCache[t] = n;
994
+ n = o && t < s.getUint16(o + 2) ? ni(s, o + s.getUint32(o + 4 + 4 * t)) : new Uint16Array(0), this._setCache[t] = n;
995
995
  }
996
996
  return n;
997
997
  }
998
998
  }
999
- const ni = "ZyyyZinhArabArmnBengBopoCherCoptCyrlDsrtDevaEthiGeorGothGrekGujrGuruHaniHangHebrHiraKndaKanaKhmrLaooLatnMlymMongMymrOgamItalOryaRunrSinhSyrcTamlTeluThaaThaiTibtCansYiiiTglgHanoBuhdTagbBraiCprtLimbLinbOsmaShawTaleUgarHrktBugiGlagKharSyloTaluTfngXpeoBaliBatkBlisBrahChamCirtCyrsEgydEgyhEgypGeokHansHantHmngHungIndsJavaKaliLatfLatgLepcLinaMandMayaMeroNkooOrkhPermPhagPhnxPlrdRoroSaraSyreSyrjSyrnTengVaiiVispXsuxZxxxZzzzCariJpanLanaLyciLydiOlckRjngSaurSgnwSundMoonMteiArmiAvstCakmKoreKthiManiPhliPhlpPhlvPrtiSamrTavtZmthZsymBamuLisuNkgbSarbBassDuplElbaGranKpelLomaMendMercNarbNbatPalmSindWaraAfakJurcMrooNshuShrdSoraTakrTangWoleHluwKhojTirhAghbMahjAhomHatrModiMultPaucSiddAdlmBhksMarcNewaOsgeHanbJamoZsyeGonmSoyoZanbDogrGongMakaMedfRohgSogdSogoElymHmnpNandWchoChrsDiakKitsYeziCpmnOugrTnsaTotoVithKawiNagmAranGaraGukhKraiOnaoSunuTodrTutgBerfSidtTayoTols", zn = ni.length / 4, lt = 0, It = 1, Jn = 25, sr = 8, er = 14;
999
+ const si = "ZyyyZinhArabArmnBengBopoCherCoptCyrlDsrtDevaEthiGeorGothGrekGujrGuruHaniHangHebrHiraKndaKanaKhmrLaooLatnMlymMongMymrOgamItalOryaRunrSinhSyrcTamlTeluThaaThaiTibtCansYiiiTglgHanoBuhdTagbBraiCprtLimbLinbOsmaShawTaleUgarHrktBugiGlagKharSyloTaluTfngXpeoBaliBatkBlisBrahChamCirtCyrsEgydEgyhEgypGeokHansHantHmngHungIndsJavaKaliLatfLatgLepcLinaMandMayaMeroNkooOrkhPermPhagPhnxPlrdRoroSaraSyreSyrjSyrnTengVaiiVispXsuxZxxxZzzzCariJpanLanaLyciLydiOlckRjngSaurSgnwSundMoonMteiArmiAvstCakmKoreKthiManiPhliPhlpPhlvPrtiSamrTavtZmthZsymBamuLisuNkgbSarbBassDuplElbaGranKpelLomaMendMercNarbNbatPalmSindWaraAfakJurcMrooNshuShrdSoraTakrTangWoleHluwKhojTirhAghbMahjAhomHatrModiMultPaucSiddAdlmBhksMarcNewaOsgeHanbJamoZsyeGonmSoyoZanbDogrGongMakaMedfRohgSogdSogoElymHmnpNandWchoChrsDiakKitsYeziCpmnOugrTnsaTotoVithKawiNagmAranGaraGukhKraiOnaoSunuTodrTutgBerfSidtTayoTols", zn = si.length / 4, lt = 0, It = 1, Jn = 25, or = 8, ir = 14;
1000
1000
  function Cn(e) {
1001
- return ni.substring(e * 4, e * 4 + 4);
1001
+ return si.substring(e * 4, e * 4 + 4);
1002
1002
  }
1003
- const or = [], ir = [];
1003
+ const rr = [], cr = [];
1004
1004
  function On(e, t) {
1005
- const n = t ? ir : or;
1005
+ const n = t ? cr : rr;
1006
1006
  let s = n[e];
1007
1007
  if (s === void 0) {
1008
1008
  try {
@@ -1015,9 +1015,9 @@ function On(e, t) {
1015
1015
  return s;
1016
1016
  }
1017
1017
  let Os = null;
1018
- const Gn = [Jn, lt, It, sr, er], An = [[lt], [Jn]], co = /* @__PURE__ */ new Map();
1018
+ const Gn = [Jn, lt, It, or, ir], An = [[lt], [Jn]], ao = /* @__PURE__ */ new Map();
1019
1019
  let Nn = null;
1020
- const ao = /* @__PURE__ */ new Map();
1020
+ const lo = /* @__PURE__ */ new Map();
1021
1021
  function Gs(e) {
1022
1022
  if (e < 128)
1023
1023
  return An[e >= 65 && e <= 90 || e >= 97 && e <= 122 ? 1 : 0];
@@ -1026,12 +1026,12 @@ function Gs(e) {
1026
1026
  Nn || (Nn = new Uint16Array(65536));
1027
1027
  const n = Nn[e];
1028
1028
  if (n) return An[n - 1];
1029
- t = lo(e), Nn[e] = t + 1;
1029
+ t = ho(e), Nn[e] = t + 1;
1030
1030
  } else
1031
- t = ao.get(e), t === void 0 && (t = lo(e), ao.set(e, t));
1031
+ t = lo.get(e), t === void 0 && (t = ho(e), lo.set(e, t));
1032
1032
  return An[t];
1033
1033
  }
1034
- function lo(e) {
1034
+ function ho(e) {
1035
1035
  const t = String.fromCodePoint(e);
1036
1036
  let n = 103;
1037
1037
  for (let r = 0; r < Gn.length + zn; r++) {
@@ -1054,13 +1054,13 @@ function lo(e) {
1054
1054
  const a = On(c, !0);
1055
1055
  a && a.test(t) && r.push(c);
1056
1056
  }
1057
- r.length && (s = rr(n, r));
1057
+ r.length && (s = ar(n, r));
1058
1058
  }
1059
1059
  const o = s.join(",");
1060
- let i = co.get(o);
1061
- return i === void 0 && (i = An.length, An.push(s), co.set(o, i)), i;
1060
+ let i = ao.get(o);
1061
+ return i === void 0 && (i = An.length, An.push(s), ao.set(o, i)), i;
1062
1062
  }
1063
- function rr(e, t) {
1063
+ function ar(e, t) {
1064
1064
  if (e === t[0]) return t;
1065
1065
  if (e !== It && e !== lt) {
1066
1066
  const n = t.indexOf(e, 1);
@@ -1220,7 +1220,7 @@ const fn = [
1220
1220
  65379
1221
1221
  ];
1222
1222
  let pn = null;
1223
- function cr(e) {
1223
+ function lr(e) {
1224
1224
  if (e < 40 || e > 125 && e < 3898) return 0;
1225
1225
  if (!pn) {
1226
1226
  pn = /* @__PURE__ */ new Map();
@@ -1229,27 +1229,27 @@ function cr(e) {
1229
1229
  }
1230
1230
  return pn.get(e) ?? 0;
1231
1231
  }
1232
- const ho = 32, St = [], on = [];
1232
+ const fo = 32, St = [], on = [];
1233
1233
  let qt = 0, ts = lt;
1234
1234
  const Ht = [];
1235
1235
  let rn = [], jt = [];
1236
- const fo = [];
1237
- function po(e) {
1238
- let t = fo[e];
1239
- return t || (fo[e] = t = [e]), t;
1236
+ const po = [];
1237
+ function uo(e) {
1238
+ let t = po[e];
1239
+ return t || (po[e] = t = [e]), t;
1240
1240
  }
1241
1241
  function Ns() {
1242
1242
  const e = Ht[0];
1243
1243
  return e === lt ? ts : e;
1244
1244
  }
1245
- function uo(e, t) {
1245
+ function _o(e, t) {
1246
1246
  let n = qt;
1247
1247
  if (n <= 0) return;
1248
1248
  n > St.length && (n = St.length);
1249
1249
  let s = St.length - 1;
1250
1250
  for (t ? (s--, n--, qt = 1) : qt = 0; n > 0; s--, n--) on[s] = e;
1251
1251
  }
1252
- function ar() {
1252
+ function hr() {
1253
1253
  const e = rn, t = Ht;
1254
1254
  if (e.length === 0 || t.length === 0) return !1;
1255
1255
  if (e.length === 1 && t.length === 1) {
@@ -1260,7 +1260,7 @@ function ar() {
1260
1260
  if (e[0] <= It)
1261
1261
  return e.length === 2 && s <= It && ts === lt && (ts = e[1]), !0;
1262
1262
  if (s <= It)
1263
- return si(Ht, e), !0;
1263
+ return ei(Ht, e), !0;
1264
1264
  let o = e.indexOf(s) >= 0;
1265
1265
  if (n === t.length) return o;
1266
1266
  let i = 0;
@@ -1270,11 +1270,11 @@ function ar() {
1270
1270
  for (; n < t.length; n++) e.indexOf(t[n], i) >= 0 && (t[r++] = t[n]);
1271
1271
  return r > 0 ? (t.length = r, !0) : !1;
1272
1272
  }
1273
- function si(e, t) {
1273
+ function ei(e, t) {
1274
1274
  e.length = t.length;
1275
1275
  for (let n = 0; n < t.length; n++) e[n] = t[n];
1276
1276
  }
1277
- function lr(e, t, n, s) {
1277
+ function fr(e, t, n, s) {
1278
1278
  if (t === 0) return 0;
1279
1279
  let o = lt, i = 0;
1280
1280
  for (; i < t; i++) {
@@ -1294,23 +1294,23 @@ function lr(e, t, n, s) {
1294
1294
  let l = !1;
1295
1295
  for (; r <= t; ) {
1296
1296
  const h = r - 1, f = c;
1297
- rn = jt, r === t ? r++ : (c = e[r++], jt = Gs(c), jt[0] === It && jt.length > 1 && (rn[0] === lt && (rn = jt.slice(1)), jt = po(It)));
1298
- const p = cr(f);
1297
+ rn = jt, r === t ? r++ : (c = e[r++], jt = Gs(c), jt[0] === It && jt.length > 1 && (rn[0] === lt && (rn = jt.slice(1)), jt = uo(It)));
1298
+ const p = lr(f);
1299
1299
  if (p > 0)
1300
- St.length === ho && (St.shift(), on.shift(), qt === ho && qt--), uo(Ns(), !1), St.push(f), on.push(lt), qt++;
1300
+ St.length === fo && (St.shift(), on.shift(), qt === fo && qt--), _o(Ns(), !1), St.push(f), on.push(lt), qt++;
1301
1301
  else if (p < 0) {
1302
1302
  for (let u = St.length - 1; u >= 0; u--)
1303
1303
  if (St[u] === -p) {
1304
1304
  const _ = on[u];
1305
- _ !== lt && (rn = po(_));
1305
+ _ !== lt && (rn = uo(_));
1306
1306
  const y = St.length - 1 - u;
1307
1307
  St.length -= y, on.length -= y, qt = Math.max(0, qt - y);
1308
1308
  break;
1309
1309
  }
1310
1310
  }
1311
- if (!ar()) {
1311
+ if (!hr()) {
1312
1312
  const u = Ns();
1313
- uo(u, p > 0), n[a] = h, s[a++] = u, si(Ht, rn), l = !0;
1313
+ _o(u, p > 0), n[a] = h, s[a++] = u, ei(Ht, rn), l = !0;
1314
1314
  break;
1315
1315
  }
1316
1316
  }
@@ -1318,32 +1318,32 @@ function lr(e, t, n, s) {
1318
1318
  }
1319
1319
  return a;
1320
1320
  }
1321
- const _o = [];
1322
- function bt(e) {
1321
+ const yo = [];
1322
+ function wt(e) {
1323
1323
  return (e.charCodeAt(0) << 24 | e.charCodeAt(1) << 16 | e.charCodeAt(2) << 8 | e.charCodeAt(3)) >>> 0;
1324
1324
  }
1325
- const hr = "Bengbng2Devadev2Gujrgjr2Gurugur2Kndaknd2Mlymmlm2Oryaory2Tamltml2Telutel2Mymrmym2", fr = "HirakanaLaoolao Yiiiyi Nkoonko Vaiivai Zmthmath";
1326
- function yo(e, t) {
1325
+ const pr = "Bengbng2Devadev2Gujrgjr2Gurugur2Kndaknd2Mlymmlm2Oryaory2Tamltml2Telutel2Mymrmym2", ur = "HirakanaLaoolao Yiiiyi Nkoonko Vaiivai Zmthmath";
1326
+ function go(e, t) {
1327
1327
  for (let n = 0; n < e.length; n += 8)
1328
1328
  if (e.substring(n, n + 4) === t) return e.substring(n + 4, n + 8);
1329
1329
  return "";
1330
1330
  }
1331
- function ei(e) {
1332
- let t = _o[e];
1331
+ function oi(e) {
1332
+ let t = yo[e];
1333
1333
  if (!t) {
1334
1334
  t = [];
1335
- const n = Cn(e), s = yo(hr, n);
1336
- s && (s !== "mym2" && t.push(bt(s.substring(0, 3) + "3")), t.push(bt(s))), t.push(bt(yo(fr, n) || n.toLowerCase())), _o[e] = t;
1335
+ const n = Cn(e), s = go(pr, n);
1336
+ s && (s !== "mym2" && t.push(wt(s.substring(0, 3) + "3")), t.push(wt(s))), t.push(wt(go(ur, n) || n.toLowerCase())), yo[e] = t;
1337
1337
  }
1338
1338
  return t;
1339
1339
  }
1340
- const oi = 64, Zn = 64, pr = ["abvm", "blwm", "mark", "mkmk", "curs", "dist", "kern"].map(bt), ur = bt("kern"), go = [bt("DFLT"), bt("dflt"), bt("latn")], $s = 0, Bs = 1, $n = 2, Ct = new Uint16Array(0), _r = new Int16Array(0), yr = new Uint32Array(0);
1340
+ const ii = 64, Zn = 64, _r = ["abvm", "blwm", "mark", "mkmk", "curs", "dist", "kern"].map(wt), yr = wt("kern"), xo = [wt("DFLT"), wt("dflt"), wt("latn")], $s = 0, Bs = 1, $n = 2, Ct = new Uint16Array(0), gr = new Int16Array(0), xr = new Uint32Array(0);
1341
1341
  class un {
1342
1342
  constructor(t, n, s, o) {
1343
- this._type = t, this._fmt = n, this._off = s, this._cov = o, this._cd1 = Ct, this._cd2 = Ct, this._cd3 = Ct, this._vf1 = 0, this._vf2 = 0, this._len1 = 0, this._len2 = 0, this._n1 = 0, this._n2 = 0, this._simple = !1, this._kx = _r, this._ps = yr, this._sg = Ct;
1343
+ this._type = t, this._fmt = n, this._off = s, this._cov = o, this._cd1 = Ct, this._cd2 = Ct, this._cd3 = Ct, this._vf1 = 0, this._vf2 = 0, this._len1 = 0, this._len2 = 0, this._n1 = 0, this._n2 = 0, this._simple = !1, this._kx = gr, this._ps = xr, this._sg = Ct;
1344
1344
  }
1345
1345
  }
1346
- class gr {
1346
+ class dr {
1347
1347
  constructor(t, n, s) {
1348
1348
  this._props = t, this._set = n, this._subs = s;
1349
1349
  let o = 0;
@@ -1356,32 +1356,32 @@ class gr {
1356
1356
  this._any = i, this._pairs = s.length > 0 && s.every((r) => r._simple);
1357
1357
  }
1358
1358
  }
1359
- class xr {
1359
+ class Mr {
1360
1360
  constructor(t, n) {
1361
1361
  this._lookups = t, this._kern = n;
1362
1362
  }
1363
1363
  }
1364
- let dt = new DataView(new ArrayBuffer(0)), xo = 0, Bn = 0, Mo = 0, Ft = 0, Bt = null;
1365
- const Ys = new Int32Array(oi * Zn);
1364
+ let dt = new DataView(new ArrayBuffer(0)), Mo = 0, Bn = 0, mo = 0, Ft = 0, Bt = null;
1365
+ const Ys = new Int32Array(ii * Zn);
1366
1366
  function Yn(e, t, n) {
1367
1367
  let s = e;
1368
1368
  t & 1 && (L._xo[n] = L._xo[n] + dt.getInt16(s), s += 2), t & 2 && (L._yo[n] = L._yo[n] + dt.getInt16(s), s += 2), t & 4 && (L._xa[n] = L._xa[n] + dt.getInt16(s));
1369
1369
  }
1370
- function dr(e, t, n) {
1370
+ function mr(e, t, n) {
1371
1371
  const s = L._gid, o = L._gp, i = L._xa, r = e._any, c = e._subs, a = e._props, l = e._set;
1372
1372
  for (let h = t; h < n; h++) {
1373
1373
  const f = s[h];
1374
1374
  if (f >= r.length || !r[f]) continue;
1375
1375
  const p = o[h];
1376
- if (p & a & 14 || p & Dt && !bn(p, f, a, l)) continue;
1376
+ if (p & a & 14 || p & Dt && !wn(p, f, a, l)) continue;
1377
1377
  let u = h + 1;
1378
1378
  if (u >= n) break;
1379
1379
  const _ = o[u];
1380
- if ((_ & (ln | Dt) || _ & a & 14) && (u = xe(h, n, a, l), u < 0))
1380
+ if ((_ & (ln | Dt) || _ & a & 14) && (u = de(h, n, a, l), u < 0))
1381
1381
  continue;
1382
1382
  const y = s[u];
1383
1383
  for (let g = 0; g < c.length; g++) {
1384
- const x = c[g], w = x._cov, M = f < w.length ? w[f] : Xt;
1384
+ const x = c[g], b = x._cov, M = f < b.length ? b[f] : Xt;
1385
1385
  if (M === Xt) continue;
1386
1386
  let A = -1;
1387
1387
  if (x._fmt === 1) {
@@ -1389,11 +1389,11 @@ function dr(e, t, n) {
1389
1389
  const k = x._sg;
1390
1390
  let T = x._ps[M], S = x._ps[M + 1] - 1;
1391
1391
  for (; T <= S; ) {
1392
- const b = T + S >> 1, m = k[b];
1393
- if (m < y) T = b + 1;
1394
- else if (m > y) S = b - 1;
1392
+ const w = T + S >> 1, m = k[w];
1393
+ if (m < y) T = w + 1;
1394
+ else if (m > y) S = w - 1;
1395
1395
  else {
1396
- A = b;
1396
+ A = w;
1397
1397
  break;
1398
1398
  }
1399
1399
  }
@@ -1408,12 +1408,12 @@ function dr(e, t, n) {
1408
1408
  }
1409
1409
  }
1410
1410
  }
1411
- function mo(e) {
1411
+ function bo(e) {
1412
1412
  let t = 0;
1413
1413
  for (let n = e & 255; n; n &= n - 1) t++;
1414
1414
  return t * 2;
1415
1415
  }
1416
- class Mr {
1416
+ class br {
1417
1417
  /**
1418
1418
  * @param buffer Full font buffer.
1419
1419
  * @param offset Byte offset of the GPOS table.
@@ -1428,13 +1428,13 @@ class Mr {
1428
1428
  _cov(t, n) {
1429
1429
  if (!n) return Ct;
1430
1430
  let s = this._covCache.get(t + n);
1431
- return s || (s = ti(this._view, t + n), this._covCache.set(t + n, s)), s;
1431
+ return s || (s = ni(this._view, t + n), this._covCache.set(t + n, s)), s;
1432
1432
  }
1433
1433
  /** ClassDef at `base + rel` (offset 0 = every glyph class 0). */
1434
1434
  _cd(t, n) {
1435
1435
  if (!n) return Ct;
1436
1436
  let s = this._cdCache.get(t + n);
1437
- return s || (s = fe(this._view, t + n), this._cdCache.set(t + n, s)), s;
1437
+ return s || (s = pe(this._view, t + n), this._cdCache.set(t + n, s)), s;
1438
1438
  }
1439
1439
  /** Absolute offset of the Script table tagged `t`, or 0. */
1440
1440
  _script(t) {
@@ -1455,7 +1455,7 @@ class Mr {
1455
1455
  const o = this._view;
1456
1456
  let i = 0;
1457
1457
  for (let l = 0; l < n.length && !i; l++) i = this._script(n[l]);
1458
- for (let l = 0; l < go.length && !i; l++) i = this._script(go[l]);
1458
+ for (let l = 0; l < xo.length && !i; l++) i = this._script(xo[l]);
1459
1459
  const r = [];
1460
1460
  let c = !1;
1461
1461
  const a = i ? o.getUint16(i) : 0;
@@ -1465,16 +1465,16 @@ class Mr {
1465
1465
  const y = _ < 0 ? h : o.getUint16(l + 6 + 2 * _);
1466
1466
  if (y >= p) continue;
1467
1467
  const g = o.getUint32(f + 2 + 6 * y);
1468
- if (_ >= 0 && pr.indexOf(g) < 0) continue;
1469
- g === ur && (c = !0);
1468
+ if (_ >= 0 && _r.indexOf(g) < 0) continue;
1469
+ g === yr && (c = !0);
1470
1470
  const x = f + o.getUint16(f + 6 + 6 * y);
1471
- for (let w = 0, M = o.getUint16(x + 2); w < M; w++) {
1472
- const A = o.getUint16(x + 4 + 2 * w);
1471
+ for (let b = 0, M = o.getUint16(x + 2); b < M; b++) {
1472
+ const A = o.getUint16(x + 4 + 2 * b);
1473
1473
  r.indexOf(A) < 0 && r.push(A);
1474
1474
  }
1475
1475
  }
1476
1476
  }
1477
- return r.sort((l, h) => l - h), s = new xr(r, c), this._planCache[t] = s, s;
1477
+ return r.sort((l, h) => l - h), s = new Mr(r, c), this._planCache[t] = s, s;
1478
1478
  }
1479
1479
  /** Lookup `li`, decoded on first use; null if out of range. */
1480
1480
  _lookup(t) {
@@ -1492,7 +1492,7 @@ class Mr {
1492
1492
  const y = this._sub(_, u);
1493
1493
  y && h.push(y);
1494
1494
  }
1495
- const f = new gr(c, l, h);
1495
+ const f = new dr(c, l, h);
1496
1496
  return this._lookupCache[t] = f, f;
1497
1497
  }
1498
1498
  /** Decodes one subtable; null for unsupported types/formats. */
@@ -1501,7 +1501,7 @@ class Mr {
1501
1501
  if (t === 1 || t === 2) {
1502
1502
  if (o !== 1 && o !== 2) return null;
1503
1503
  const i = new un(t, o, n, this._cov(n, s.getUint16(n + 2)));
1504
- return i._vf1 = s.getUint16(n + 4), i._len1 = mo(i._vf1), t === 2 && (i._vf2 = s.getUint16(n + 6), i._len2 = mo(i._vf2), o === 2 && (i._cd1 = this._cd(n, s.getUint16(n + 8)), i._cd2 = this._cd(n, s.getUint16(n + 10)), i._n1 = s.getUint16(n + 12), i._n2 = s.getUint16(n + 14)), (i._vf1 & 15) === 4 && i._vf2 === 0 && this._decodePairs(i)), i;
1504
+ return i._vf1 = s.getUint16(n + 4), i._len1 = bo(i._vf1), t === 2 && (i._vf2 = s.getUint16(n + 6), i._len2 = bo(i._vf2), o === 2 && (i._cd1 = this._cd(n, s.getUint16(n + 8)), i._cd2 = this._cd(n, s.getUint16(n + 10)), i._n1 = s.getUint16(n + 12), i._n2 = s.getUint16(n + 14)), (i._vf1 & 15) === 4 && i._vf2 === 0 && this._decodePairs(i)), i;
1505
1505
  }
1506
1506
  if (t === 7) {
1507
1507
  if (o === 3) return new un(t, o, n, this._cov(n, s.getUint16(n + 6)));
@@ -1549,19 +1549,19 @@ class Mr {
1549
1549
  * port of hb-ot-layout.cc: apply_forward, for each lookup in turn.
1550
1550
  */
1551
1551
  _position(t, n, s) {
1552
- dt = this._view, xo = n, Bn = s, Mo = Math.max((s - n) * 64, 16384);
1552
+ dt = this._view, Mo = n, Bn = s, mo = Math.max((s - n) * 64, 16384);
1553
1553
  const o = t._lookups;
1554
1554
  for (let i = 0; i < o.length; i++) {
1555
1555
  const r = this._lookup(o[i]);
1556
1556
  if (!r || !r._subs.length) continue;
1557
1557
  if (Ft = r._props, Bt = r._set, r._pairs) {
1558
- dr(r, n, s);
1558
+ mr(r, n, s);
1559
1559
  continue;
1560
1560
  }
1561
1561
  const c = L._gp, a = L._gid, l = r._any;
1562
1562
  for (let h = n; h < s; ) {
1563
1563
  const f = a[h];
1564
- if (f < l.length && l[f] && bn(c[h], f, Ft, Bt)) {
1564
+ if (f < l.length && l[f] && wn(c[h], f, Ft, Bt)) {
1565
1565
  const p = this._applyAt(r, h, 0);
1566
1566
  if (p >= 0) {
1567
1567
  h = p;
@@ -1600,7 +1600,7 @@ class Mr {
1600
1600
  let l = n + 1;
1601
1601
  if (l >= Bn) return -1;
1602
1602
  const h = L._gp[l];
1603
- if ((h & (ln | Dt) || h & Ft & 14) && (l = xe(n, Bn, Ft, Bt), l < 0))
1603
+ if ((h & (ln | Dt) || h & Ft & 14) && (l = de(n, Bn, Ft, Bt), l < 0))
1604
1604
  return -1;
1605
1605
  const f = L._gid[l];
1606
1606
  if (t._simple) {
@@ -1608,11 +1608,11 @@ class Mr {
1608
1608
  if (t._fmt === 1) {
1609
1609
  if (r >= t._ps.length - 1) return -1;
1610
1610
  const g = t._sg;
1611
- let x = t._ps[r], w = t._ps[r + 1] - 1;
1612
- for (; x <= w; ) {
1613
- const M = x + w >> 1, A = g[M];
1611
+ let x = t._ps[r], b = t._ps[r + 1] - 1;
1612
+ for (; x <= b; ) {
1613
+ const M = x + b >> 1, A = g[M];
1614
1614
  if (A < f) x = M + 1;
1615
- else if (A > f) w = M - 1;
1615
+ else if (A > f) b = M - 1;
1616
1616
  else
1617
1617
  return L._xa[n] = L._xa[n] + u[M], l;
1618
1618
  }
@@ -1627,11 +1627,11 @@ class Mr {
1627
1627
  const u = a + c.getUint16(a + 10 + 2 * r), _ = 2 + t._len1 + t._len2;
1628
1628
  let y = 0, g = c.getUint16(u) - 1;
1629
1629
  for (p = -1; y <= g; ) {
1630
- const x = y + g >> 1, w = u + 2 + x * _, M = c.getUint16(w);
1630
+ const x = y + g >> 1, b = u + 2 + x * _, M = c.getUint16(b);
1631
1631
  if (M < f) y = x + 1;
1632
1632
  else if (M > f) g = x - 1;
1633
1633
  else {
1634
- p = w + 2;
1634
+ p = b + 2;
1635
1635
  break;
1636
1636
  }
1637
1637
  }
@@ -1678,10 +1678,10 @@ class Mr {
1678
1678
  u += 2 + 2 * _;
1679
1679
  const g = r.getUint16(u), x = u + 2;
1680
1680
  u += 2 + 2 * g;
1681
- const w = r.getUint16(u), M = u + 2;
1682
- u += 2 + 2 * w;
1681
+ const b = r.getUint16(u), M = u + 2;
1682
+ u += 2 + 2 * b;
1683
1683
  const A = this._input(n, g, $n, Ct, x + 2, c, i);
1684
- return A < 0 || !this._lookahead(A, w, $n, Ct, M, c) || !this._backtrack(n, _, $n, Ct, y, c) ? -1 : (this._apply(u + 2, r.getUint16(u), g, i), A);
1684
+ return A < 0 || !this._lookahead(A, b, $n, Ct, M, c) || !this._backtrack(n, _, $n, Ct, y, c) ? -1 : (this._apply(u + 2, r.getUint16(u), g, i), A);
1685
1685
  }
1686
1686
  let a = o, l = c + 4, h = $s;
1687
1687
  if (t._fmt === 2 && (a = s < t._cd2.length ? t._cd2[s] : 0, l = c + 10, h = Bs), a >= r.getUint16(l)) return -1;
@@ -1692,13 +1692,13 @@ class Mr {
1692
1692
  let y = p + r.getUint16(p + 2 + 2 * u);
1693
1693
  const g = r.getUint16(y), x = y + 2;
1694
1694
  y += 2 + 2 * g;
1695
- const w = r.getUint16(y), M = y + 2;
1696
- y += 2 + 2 * Math.max(w - 1, 0);
1695
+ const b = r.getUint16(y), M = y + 2;
1696
+ y += 2 + 2 * Math.max(b - 1, 0);
1697
1697
  const A = r.getUint16(y), k = y + 2;
1698
1698
  y += 2 + 2 * A;
1699
- const T = this._input(n, w, h, t._cd2, M, 0, i);
1699
+ const T = this._input(n, b, h, t._cd2, M, 0, i);
1700
1700
  if (!(T < 0) && this._lookahead(T, A, h, t._cd3, k, 0) && this._backtrack(n, g, h, t._cd1, x, 0))
1701
- return this._apply(y + 2, r.getUint16(y), w, i), T;
1701
+ return this._apply(y + 2, r.getUint16(y), b, i), T;
1702
1702
  }
1703
1703
  return -1;
1704
1704
  }
@@ -1718,7 +1718,7 @@ class Mr {
1718
1718
  const r = L._gp, c = L._gid;
1719
1719
  for (let a = t + 1; a < Bn; a++) {
1720
1720
  const l = r[a], h = c[a];
1721
- if (bn(l, h, Ft, Bt)) {
1721
+ if (wn(l, h, Ft, Bt)) {
1722
1722
  if (this._matches(n, s, o, i, h)) return a;
1723
1723
  if (!(l & ln))
1724
1724
  return -1;
@@ -1729,9 +1729,9 @@ class Mr {
1729
1729
  /** skipping_iterator_t::prev counterpart of {@link Gpos._next}. */
1730
1730
  _prev(t, n, s, o, i) {
1731
1731
  const r = L._gp, c = L._gid;
1732
- for (let a = t - 1; a >= xo; a--) {
1732
+ for (let a = t - 1; a >= Mo; a--) {
1733
1733
  const l = r[a], h = c[a];
1734
- if (bn(l, h, Ft, Bt)) {
1734
+ if (wn(l, h, Ft, Bt)) {
1735
1735
  if (this._matches(n, s, o, i, h)) return a;
1736
1736
  if (!(l & ln))
1737
1737
  return -1;
@@ -1777,7 +1777,7 @@ class Mr {
1777
1777
  const i = o * Zn;
1778
1778
  for (let r = 0; r < n; r++) {
1779
1779
  const c = dt.getUint16(t + 4 * r);
1780
- if (c >= s || o + 1 >= oi || Mo-- <= 0) continue;
1780
+ if (c >= s || o + 1 >= ii || mo-- <= 0) continue;
1781
1781
  const a = this._lookup(dt.getUint16(t + 4 * r + 2));
1782
1782
  if (!a) continue;
1783
1783
  const l = Ft, h = Bt;
@@ -1785,7 +1785,7 @@ class Mr {
1785
1785
  }
1786
1786
  }
1787
1787
  }
1788
- function mr(e) {
1788
+ function wr(e) {
1789
1789
  if (e < 173) return !1;
1790
1790
  if (e < 65536) {
1791
1791
  switch (e >> 8) {
@@ -1810,7 +1810,7 @@ function mr(e) {
1810
1810
  }
1811
1811
  return e >= 119155 && e <= 119162 || e >= 917504 && e <= 921599;
1812
1812
  }
1813
- function wr(e, t, n) {
1813
+ function Ar(e, t, n) {
1814
1814
  const s = e.metrics.unitsPerEm;
1815
1815
  switch (t) {
1816
1816
  case 160:
@@ -1852,14 +1852,14 @@ function wr(e, t, n) {
1852
1852
  }
1853
1853
  let Hs = null;
1854
1854
  const wo = /* @__PURE__ */ new Map();
1855
- function br(e) {
1855
+ function kr(e) {
1856
1856
  if (e < 768) return !1;
1857
1857
  let t = wo.get(e);
1858
1858
  return t === void 0 && (Hs || (Hs = new RegExp("^\\p{Mn}$", "u")), t = Hs.test(String.fromCodePoint(e)), wo.set(e, t)), t;
1859
1859
  }
1860
- function Ar(e, t) {
1860
+ function Ur(e, t) {
1861
1861
  const n = t.length;
1862
- Qo(n);
1862
+ Jo(n);
1863
1863
  const s = L._cp, o = L._gid, i = L._gp, r = L._xa, c = L._xo, a = L._yo, l = e._glyphProps(), h = e._advances(), f = h.length ? h[h.length - 1] : 0, p = e.glyphId(32);
1864
1864
  let u = !1, _ = 0, y = 0;
1865
1865
  for (let M = 0; M < n; M++) {
@@ -1869,53 +1869,53 @@ function Ar(e, t) {
1869
1869
  m >= 56320 && m < 57344 && (A = (A - 55296 << 10) + (m - 56320) + 65536, M++);
1870
1870
  }
1871
1871
  let k = e.glyphId(A), T = -1;
1872
- !k && A >= 160 && p && ((A === 8192 || A === 8193) && (k = e.glyphId(A + 2)), k || (T = wr(e, A, p), T >= 0 && (k = p)));
1873
- const S = A >= 173 && mr(A);
1874
- let b;
1875
- l ? b = k < l.length ? l[k] : 0 : b = !S && br(A) ? Dt : Qn, S && (b |= A === 8204 ? wn : wn | ln, u = !0), _ |= b, s[y] = A, o[y] = k, i[y] = b, r[y] = T >= 0 ? T : k < h.length ? h[k] : f, c[y] = 0, a[y] = 0, y++;
1872
+ !k && A >= 160 && p && ((A === 8192 || A === 8193) && (k = e.glyphId(A + 2)), k || (T = Ar(e, A, p), T >= 0 && (k = p)));
1873
+ const S = A >= 173 && wr(A);
1874
+ let w;
1875
+ l ? w = k < l.length ? l[k] : 0 : w = !S && kr(A) ? Dt : Qn, S && (w |= A === 8204 ? bn : bn | ln, u = !0), _ |= w, s[y] = A, o[y] = k, i[y] = w, r[y] = T >= 0 ? T : k < h.length ? h[k] : f, c[y] = 0, a[y] = 0, y++;
1876
1876
  }
1877
- const g = lr(s, y, L._runEnd, L._runScript), x = (_ & Dt) !== 0;
1878
- let w = 0;
1877
+ const g = fr(s, y, L._runEnd, L._runScript), x = (_ & Dt) !== 0;
1878
+ let b = 0;
1879
1879
  for (let M = 0; M < g; M++) {
1880
1880
  const A = L._runEnd[M];
1881
- ai(e, w, A, L._runScript[M], x), w = A;
1881
+ li(e, b, A, L._runScript[M], x), b = A;
1882
1882
  }
1883
1883
  if (u)
1884
- for (let M = 0; M < y; M++) i[M] & wn && (r[M] = c[M] = a[M] = 0);
1884
+ for (let M = 0; M < y; M++) i[M] & bn && (r[M] = c[M] = a[M] = 0);
1885
1885
  return y;
1886
1886
  }
1887
- const de = 0, ii = 1, Me = 2, kr = 3, me = 4, Hn = Me | me, Ur = de | me, Tr = Me, bo = de, Xs = ii, Sr = "BengDevaGujrGuruKndaMlymOryaTamlTelu", Cr = "TibtMongSinhBuhdHanoTglgTagbLimbTaleBugiKharSyloTfngBaliNkooPhagChamKaliLepcRjngSaurSundEgypJavaKthiMteiLanaTavtBatkBrahMandCakmPlrdShrdTakrDuplGranKhojSindMahjManiModiHmngPhlpSiddTirhAhomMultAdlmBhksMarcNewaGonmSoyoZanbDogrGongRohgMakaMedfSogoSogdElymNandHmnpWchoChrsDiakKitsYeziCpmnOugrTnsaTotoVithKawiNagmGaraGukhKraiOnaoSunuTodrTutgBerfSidtTayoTolsJurcPcunSeal", ri = bt("DFLT"), ci = bt("latn"), vr = bt("mymr"), Ao = [ri, bt("dflt"), ci];
1888
- function Er(e, t) {
1887
+ const Me = 0, ri = 1, me = 2, Tr = 3, be = 4, Hn = me | be, Sr = Me | be, Cr = me, Ao = Me, Xs = ri, vr = "BengDevaGujrGuruKndaMlymOryaTamlTelu", Er = "TibtMongSinhBuhdHanoTglgTagbLimbTaleBugiKharSyloTfngBaliNkooPhagChamKaliLepcRjngSaurSundEgypJavaKthiMteiLanaTavtBatkBrahMandCakmPlrdShrdTakrDuplGranKhojSindMahjManiModiHmngPhlpSiddTirhAhomMultAdlmBhksMarcNewaGonmSoyoZanbDogrGongRohgMakaMedfSogoSogdElymNandHmnpWchoChrsDiakKitsYeziCpmnOugrTnsaTotoVithKawiNagmGaraGukhKraiOnaoSunuTodrTutgBerfSidtTayoTolsJurcPcunSeal", ci = wt("DFLT"), ai = wt("latn"), Ir = wt("mymr"), ko = [ci, wt("dflt"), ai];
1888
+ function Dr(e, t) {
1889
1889
  if (!e) return 0;
1890
1890
  for (let n = 0; n < t.length; n++) if (e.indexOf(t[n]) >= 0) return t[n];
1891
1891
  for (let n = 0; n < 3; n++)
1892
- if (e.indexOf(Ao[n]) >= 0) return Ao[n];
1892
+ if (e.indexOf(ko[n]) >= 0) return ko[n];
1893
1893
  return 0;
1894
1894
  }
1895
- function Ir(e, t) {
1896
- const n = t === ri || t === ci;
1897
- return e === "Thai" || e === "Laoo" ? Tr : e === "Hang" ? Ur : e === "Khmr" ? bo : e === "Mymr" ? n || t === vr ? Hn : Xs : Sr.indexOf(e) >= 0 ? n ? Hn : (t & 255) === 51 ? Xs : bo : Cr.indexOf(e) >= 0 ? n ? Hn : Xs : Hn;
1895
+ function Rr(e, t) {
1896
+ const n = t === ci || t === ai;
1897
+ return e === "Thai" || e === "Laoo" ? Cr : e === "Hang" ? Sr : e === "Khmr" ? Ao : e === "Mymr" ? n || t === Ir ? Hn : Xs : vr.indexOf(e) >= 0 ? n ? Hn : (t & 255) === 51 ? Xs : Ao : Er.indexOf(e) >= 0 ? n ? Hn : Xs : Hn;
1898
1898
  }
1899
- function Dr(e, t) {
1899
+ function Lr(e, t) {
1900
1900
  const n = e._shaperCache();
1901
1901
  let s = n[t];
1902
- return s < 0 && (s = Ir(Cn(t), Er(e._gsubScriptTags(), ei(t))), n[t] = s), s;
1902
+ return s < 0 && (s = Rr(Cn(t), Dr(e._gsubScriptTags(), oi(t))), n[t] = s), s;
1903
1903
  }
1904
- function ko(e, t, n) {
1904
+ function Uo(e, t, n) {
1905
1905
  const s = L._gp, o = L._xa, i = L._xo;
1906
1906
  for (let r = e; r < t; r++)
1907
1907
  s[r] & Dt && (n && (i[r] = i[r] - o[r]), o[r] = 0);
1908
1908
  }
1909
- function ai(e, t, n, s, o) {
1910
- const i = Dr(e, s), r = e._gposTable(), c = e._kernTable(), a = r ? r._plan(s, ei(s)) : null, l = c !== null && c._hasData && !(a && a._kern) && (i & me) !== 0, h = !o || l && c._hasMachine ? de : i & kr, f = !r && (!l || !c._hasCross);
1911
- h === ii && ko(t, n, f), a && r._position(a, t, n), l && c._apply(t, n), h === Me && ko(t, n, f);
1909
+ function li(e, t, n, s, o) {
1910
+ const i = Lr(e, s), r = e._gposTable(), c = e._kernTable(), a = r ? r._plan(s, oi(s)) : null, l = c !== null && c._hasData && !(a && a._kern) && (i & be) !== 0, h = !o || l && c._hasMachine ? Me : i & Tr, f = !r && (!l || !c._hasCross);
1911
+ h === ri && Uo(t, n, f), a && r._position(a, t, n), l && c._apply(t, n), h === me && Uo(t, n, f);
1912
1912
  }
1913
- function Rr(e, t, n) {
1914
- Qo(2);
1913
+ function Pr(e, t, n) {
1914
+ Jo(2);
1915
1915
  const s = e._glyphProps(), o = e.advance(t), i = e.advance(n);
1916
- return L._gid[0] = t, L._gid[1] = n, L._gp[0] = s ? t < s.length ? s[t] : 0 : Qn, L._gp[1] = s ? n < s.length ? s[n] : 0 : Qn, L._xa[0] = o, L._xa[1] = i, L._xo[0] = L._xo[1] = L._yo[0] = L._yo[1] = 0, ai(e, 0, 2, lt, ((L._gp[0] | L._gp[1]) & Dt) !== 0), L._xa[0] + L._xa[1] - o - i;
1916
+ return L._gid[0] = t, L._gid[1] = n, L._gp[0] = s ? t < s.length ? s[t] : 0 : Qn, L._gp[1] = s ? n < s.length ? s[n] : 0 : Qn, L._xa[0] = o, L._xa[1] = i, L._xo[0] = L._xo[1] = L._yo[0] = L._yo[1] = 0, li(e, 0, 2, lt, ((L._gp[0] | L._gp[1]) & Dt) !== 0), L._xa[0] + L._xa[1] - o - i;
1917
1917
  }
1918
- function Lr(e) {
1918
+ function Fr(e) {
1919
1919
  const t = new Rt(e);
1920
1920
  if (t.u32() === 1953784678) {
1921
1921
  if (t.skip(4), t.u32() === 0) throw new Error("TTC contains no fonts");
@@ -1923,9 +1923,9 @@ function Lr(e) {
1923
1923
  t.seek(o);
1924
1924
  } else
1925
1925
  t.seek(0);
1926
- return Pr(e, t);
1926
+ return qr(e, t);
1927
1927
  }
1928
- function Pr(e, t) {
1928
+ function qr(e, t) {
1929
1929
  t.skip(4);
1930
1930
  const n = t.u16();
1931
1931
  t.skip(6);
@@ -1938,8 +1938,8 @@ function Pr(e, t) {
1938
1938
  }
1939
1939
  return s;
1940
1940
  }
1941
- const Uo = 2048, Fr = 65536;
1942
- class Oc {
1941
+ const To = 2048, Or = 65536;
1942
+ class Hc {
1943
1943
  /**
1944
1944
  * Parses a TrueType font from an ArrayBuffer.
1945
1945
  *
@@ -1950,7 +1950,7 @@ class Oc {
1950
1950
  * @param buffer Raw font file bytes.
1951
1951
  */
1952
1952
  constructor(t) {
1953
- this._buffer = t, this._tables = Lr(t);
1953
+ this._buffer = t, this._tables = Fr(t);
1954
1954
  const n = this._tables.get("head"), s = this._tables.get("maxp"), o = this._tables.get("hhea"), i = this._tables.get("hmtx"), r = this._tables.get("loca"), c = this._tables.get("cmap");
1955
1955
  if (!n) throw new Error("Font missing required `head` table");
1956
1956
  if (!s) throw new Error("Font missing required `maxp` table");
@@ -1958,9 +1958,9 @@ class Oc {
1958
1958
  if (!i) throw new Error("Font missing required `hmtx` table");
1959
1959
  if (!r) throw new Error("Font missing required `loca` table");
1960
1960
  if (!c) throw new Error("Font missing required `cmap` table");
1961
- this._head = Di(t, n.offset);
1962
- const a = Fi(t, s.offset);
1963
- this._hhea = Ri(t, o.offset), this._hmtx = Li(t, i.offset, a.numGlyphs, this._hhea.numberOfHMetrics), this._loca = Pi(t, r.offset, a.numGlyphs, this._head.indexToLocFormat), this._cmap = vi(t, c.offset), this._cmapCache = null, this._layoutLoaded = !1, this._gdef = null, this._gpos = null, this._kern = null, this._gsubScripts = null, this._shapers = null, this._advanceTable = null, this._pairCache = /* @__PURE__ */ new Map(), this.metrics = {
1961
+ this._head = Li(t, n.offset);
1962
+ const a = Oi(t, s.offset);
1963
+ this._hhea = Pi(t, o.offset), this._hmtx = Fi(t, i.offset, a.numGlyphs, this._hhea.numberOfHMetrics), this._loca = qi(t, r.offset, a.numGlyphs, this._head.indexToLocFormat), this._cmap = Ii(t, c.offset), this._cmapCache = null, this._layoutLoaded = !1, this._gdef = null, this._gpos = null, this._kern = null, this._gsubScripts = null, this._shapers = null, this._advanceTable = null, this._pairCache = /* @__PURE__ */ new Map(), this.metrics = {
1964
1964
  unitsPerEm: this._head.unitsPerEm,
1965
1965
  ascender: this._hhea.ascender,
1966
1966
  descender: this._hhea.descender,
@@ -1974,9 +1974,9 @@ class Oc {
1974
1974
  * @param codepoint Unicode scalar value.
1975
1975
  */
1976
1976
  glyphId(t) {
1977
- if (t >= Uo || t < 0) return this._cmap(t);
1977
+ if (t >= To || t < 0) return this._cmap(t);
1978
1978
  let n = this._cmapCache;
1979
- n || (n = this._cmapCache = new Uint16Array(Uo));
1979
+ n || (n = this._cmapCache = new Uint16Array(To));
1980
1980
  let s = n[t];
1981
1981
  return s || (n[t] = s = this._cmap(t) + 1), s - 1;
1982
1982
  }
@@ -2024,15 +2024,15 @@ class Oc {
2024
2024
  }
2025
2025
  /** {@link Font.kerning}'s cache miss, kept out of line so the hit path stays small. */
2026
2026
  _kerningMiss(t, n, s) {
2027
- const o = Rr(this, n, s);
2028
- return this._pairCache.size >= Fr && this._pairCache.clear(), this._pairCache.set(t, o), o;
2027
+ const o = Pr(this, n, s);
2028
+ return this._pairCache.size >= Or && this._pairCache.clear(), this._pairCache.set(t, o), o;
2029
2029
  }
2030
2030
  /** Parses GDEF, GPOS, kern and GSUB's script list on first use (keeps `new Font` cheap). */
2031
2031
  _loadLayout() {
2032
2032
  if (this._layoutLoaded) return;
2033
2033
  this._layoutLoaded = !0;
2034
2034
  const t = this._buffer, n = this._tables.get("GDEF"), s = this._tables.get("GPOS"), o = this._tables.get("kern"), i = this._tables.get("GSUB");
2035
- n && (this._gdef = new nr(t, n.offset, this.numGlyphs)), s && (this._gpos = new Mr(t, s.offset, this._gdef)), o && (this._kern = new Ji(t, o.offset)), i && (this._gsubScripts = tr(new DataView(t), i.offset));
2035
+ n && (this._gdef = new er(t, n.offset, this.numGlyphs)), s && (this._gpos = new br(t, s.offset, this._gdef)), o && (this._kern = new nr(t, o.offset)), i && (this._gsubScripts = sr(new DataView(t), i.offset));
2036
2036
  }
2037
2037
  /** @internal GSUB's script tags, or null when the font has no GSUB. */
2038
2038
  _gsubScriptTags() {
@@ -2082,7 +2082,7 @@ class Oc {
2082
2082
  const n = this._tables.get("glyf");
2083
2083
  if (!n) return { contours: [], inverseYAxis: !1 };
2084
2084
  const s = this._loca, o = s[t] ?? 0, r = (s[t + 1] ?? o) - o;
2085
- return Ki(
2085
+ return Vi(
2086
2086
  this._buffer,
2087
2087
  n.offset,
2088
2088
  o,
@@ -2100,7 +2100,7 @@ class Oc {
2100
2100
  const n = this._tables.get("glyf");
2101
2101
  if (!n) return [];
2102
2102
  const s = this._loca, o = s[t] ?? 0, r = (s[t + 1] ?? o) - o;
2103
- return Zo(
2103
+ return Qo(
2104
2104
  this._buffer,
2105
2105
  n.offset,
2106
2106
  o,
@@ -2116,17 +2116,17 @@ function ns(e, t) {
2116
2116
  const i = s[o];
2117
2117
  if (i.p0x *= n, i.p0y *= n, i.p1x *= n, i.p1y *= n, i.p2x *= n, i.p2y *= n, i.p3x *= n, i.p3y *= n, i.type === ct) {
2118
2118
  const r = i.p1x - i.p0x, c = i.p1y - i.p0y, a = i.p2x - i.p1x, l = i.p2y - i.p1y;
2119
- Q(r, c, a, l) === 0 && (s[o] = new et(st, i.p0x, i.p0y, i.p2x, i.p2y, 0, 0, 0, 0));
2119
+ Q(r, c, a, l) === 0 && (s[o] = new et(tt, i.p0x, i.p0y, i.p2x, i.p2y, 0, 0, 0, 0));
2120
2120
  } else if (i.type === Gt) {
2121
2121
  const r = i.p2x - i.p1x, c = i.p2y - i.p1y, a = 1.5 * i.p1x - 0.5 * i.p0x, l = 1.5 * i.p1y - 0.5 * i.p0y;
2122
- Q(i.p1x - i.p0x, i.p1y - i.p0y, r, c) === 0 && Q(r, c, i.p3x - i.p2x, i.p3y - i.p2y) === 0 ? s[o] = new et(st, i.p0x, i.p0y, i.p3x, i.p3y, 0, 0, 0, 0) : a === 1.5 * i.p2x - 0.5 * i.p3x && l === 1.5 * i.p2y - 0.5 * i.p3y && (s[o] = new et(ct, i.p0x, i.p0y, a, l, i.p3x, i.p3y, 0, 0));
2122
+ Q(i.p1x - i.p0x, i.p1y - i.p0y, r, c) === 0 && Q(r, c, i.p3x - i.p2x, i.p3y - i.p2y) === 0 ? s[o] = new et(tt, i.p0x, i.p0y, i.p3x, i.p3y, 0, 0, 0, 0) : a === 1.5 * i.p2x - 0.5 * i.p3x && l === 1.5 * i.p2y - 0.5 * i.p3y && (s[o] = new et(ct, i.p0x, i.p0y, a, l, i.p3x, i.p3y, 0, 0));
2123
2123
  }
2124
2124
  }
2125
2125
  }
2126
- const To = 1e-6, qr = 1.1111111111111112, Or = new Float64Array(16);
2127
- function So(e, t, n) {
2126
+ const So = 1e-6, Gr = 1.1111111111111112, Nr = new Float64Array(16);
2127
+ function Co(e, t, n) {
2128
2128
  switch (t[n] = e.p0x, t[n + 1] = e.p0y, t[n + 2] = e.p1x, t[n + 3] = e.p1y, e.type) {
2129
- case st:
2129
+ case tt:
2130
2130
  return 1;
2131
2131
  case ct:
2132
2132
  return t[n + 4] = e.p2x, t[n + 5] = e.p2y, 2;
@@ -2134,7 +2134,7 @@ function So(e, t, n) {
2134
2134
  return t[n + 4] = e.p2x, t[n + 5] = e.p2y, t[n + 6] = e.p3x, t[n + 7] = e.p3y, 3;
2135
2135
  }
2136
2136
  }
2137
- function Co(e, t, n) {
2137
+ function vo(e, t, n) {
2138
2138
  if (n === 3) {
2139
2139
  const s = e[t], o = e[t + 1], i = e[t + 2], r = e[t + 3], c = e[t + 4], a = e[t + 5], l = e[t + 6], h = e[t + 7];
2140
2140
  (i === s && r === o || i === l && r === h) && (c === s && a === o || c === l && a === h) && (e[t + 2] = l, e[t + 3] = h, n = 1);
@@ -2145,54 +2145,54 @@ function Co(e, t, n) {
2145
2145
  }
2146
2146
  return n === 1 && e[t] === e[t + 2] && e[t + 1] === e[t + 3] && (n = 0), n;
2147
2147
  }
2148
- function Gr(e, t) {
2149
- const n = Or;
2150
- let s = So(e, n, 0), o = So(t, n, 8);
2148
+ function $r(e, t) {
2149
+ const n = Nr;
2150
+ let s = Co(e, n, 0), o = Co(t, n, 8);
2151
2151
  if (!(s >= 1 && s <= 3 && o >= 1 && o <= 3) || n[s * 2] !== n[8] || n[s * 2 + 1] !== n[9]) return 0;
2152
- s = Co(n, 0, s), o = Co(n, 8, o);
2152
+ s = vo(n, 0, s), o = vo(n, 8, o);
2153
2153
  const i = n[s * 2], r = n[s * 2 + 1];
2154
- let c = 0, a = 0, l = 0, h = 0, f = 0, p = 0, u = 0, _ = 0, y = 0, g = 0, x = 0, w = 0;
2154
+ let c = 0, a = 0, l = 0, h = 0, f = 0, p = 0, u = 0, _ = 0, y = 0, g = 0, x = 0, b = 0;
2155
2155
  if (s >= 1 && (c = n[(s - 1) * 2] - i, a = n[(s - 1) * 2 + 1] - r), s >= 2) {
2156
2156
  const H = n[(s - 2) * 2] - n[(s - 1) * 2], K = n[(s - 2) * 2 + 1] - n[(s - 1) * 2 + 1];
2157
2157
  l = H - c, h = K - a;
2158
2158
  }
2159
2159
  if (s >= 3) {
2160
- const H = n[(s - 3) * 2] - n[(s - 2) * 2], K = n[(s - 3) * 2 + 1] - n[(s - 2) * 2 + 1], tt = n[(s - 2) * 2] - n[(s - 1) * 2], z = n[(s - 2) * 2 + 1] - n[(s - 1) * 2 + 1];
2161
- f = H - tt - l, p = K - z - h, l *= 3, h *= 3;
2160
+ const H = n[(s - 3) * 2] - n[(s - 2) * 2], K = n[(s - 3) * 2 + 1] - n[(s - 2) * 2 + 1], nt = n[(s - 2) * 2] - n[(s - 1) * 2], z = n[(s - 2) * 2 + 1] - n[(s - 1) * 2 + 1];
2161
+ f = H - nt - l, p = K - z - h, l *= 3, h *= 3;
2162
2162
  }
2163
2163
  if (o >= 1 && (u = n[10] - i, _ = n[11] - r), o >= 2) {
2164
2164
  const H = n[12] - n[10], K = n[13] - n[11];
2165
2165
  y = H - u, g = K - _;
2166
2166
  }
2167
2167
  if (o >= 3) {
2168
- const H = n[14] - n[12], K = n[15] - n[13], tt = n[12] - n[10], z = n[13] - n[11];
2169
- x = H - tt - y, w = K - z - g, y *= 3, g *= 3;
2168
+ const H = n[14] - n[12], K = n[15] - n[13], nt = n[12] - n[10], z = n[13] - n[11];
2169
+ x = H - nt - y, b = K - z - g, y *= 3, g *= 3;
2170
2170
  }
2171
2171
  c *= s, a *= s, u *= o, _ *= o;
2172
2172
  const M = c !== 0 || a !== 0;
2173
2173
  if (M && (u !== 0 || _ !== 0)) {
2174
- const H = Math.sqrt(c * c + a * a), K = Math.sqrt(u * u + _ * _), tt = H * Q(c, a, y, g) + K * Q(l, h, u, _);
2175
- if (tt) return _t(tt);
2176
- const z = H * H * Q(c, a, x, w) + H * K * Q(l, h, y, g) + K * K * Q(f, p, u, _);
2174
+ const H = Math.sqrt(c * c + a * a), K = Math.sqrt(u * u + _ * _), nt = H * Q(c, a, y, g) + K * Q(l, h, u, _);
2175
+ if (nt) return _t(nt);
2176
+ const z = H * H * Q(c, a, x, b) + H * K * Q(l, h, y, g) + K * K * Q(f, p, u, _);
2177
2177
  if (z) return _t(z);
2178
- const Lt = H * Q(l, h, x, w) + K * Q(f, p, y, g);
2179
- return _t(Lt || Q(f, p, x, w));
2178
+ const Lt = H * Q(l, h, x, b) + K * Q(f, p, y, g);
2179
+ return _t(Lt || Q(f, p, x, b));
2180
2180
  }
2181
- let k = 1, T = l, S = h, b = f, m = p, d = u, U = _, v = y, C = g, I = x, R = w;
2182
- if (M && (T = y, S = g, b = x, m = w, d = c, U = a, v = l, C = h, I = f, R = p, k = -1), d !== 0 || U !== 0) {
2183
- const H = Q(b, m, d, U);
2181
+ let k = 1, T = l, S = h, w = f, m = p, d = u, U = _, v = y, C = g, I = x, R = b;
2182
+ if (M && (T = y, S = g, w = x, m = b, d = c, U = a, v = l, C = h, I = f, R = p, k = -1), d !== 0 || U !== 0) {
2183
+ const H = Q(w, m, d, U);
2184
2184
  if (H) return k * _t(H);
2185
2185
  const K = Q(T, S, v, C);
2186
2186
  if (K) return k * _t(K);
2187
- const tt = Q(b, m, v, C);
2188
- if (tt) return k * _t(tt);
2187
+ const nt = Q(w, m, v, C);
2188
+ if (nt) return k * _t(nt);
2189
2189
  const z = Q(T, S, I, R);
2190
- return z ? k * _t(z) : k * _t(Q(b, m, I, R));
2190
+ return z ? k * _t(z) : k * _t(Q(w, m, I, R));
2191
2191
  }
2192
- const G = Math.sqrt(T * T + S * S), F = Math.sqrt(v * v + C * C), X = Math.sqrt(G) * Q(T, S, I, R) + Math.sqrt(F) * Q(b, m, v, C);
2193
- return _t(X || Q(b, m, I, R));
2192
+ const G = Math.sqrt(T * T + S * S), F = Math.sqrt(v * v + C * C), X = Math.sqrt(G) * Q(T, S, I, R) + Math.sqrt(F) * Q(w, m, v, C);
2193
+ return _t(X || Q(w, m, I, R));
2194
2194
  }
2195
- function vo(e, t, n, s, o) {
2195
+ function Eo(e, t, n, s, o) {
2196
2196
  let i = e[t];
2197
2197
  if (i.type === ct) {
2198
2198
  const r = i.convertToCubic();
@@ -2208,7 +2208,7 @@ function vo(e, t, n, s, o) {
2208
2208
  }
2209
2209
  }
2210
2210
  const _n = [0, 0], yn = [0, 0];
2211
- function Nr(e) {
2211
+ function Br(e) {
2212
2212
  for (let t = 0; t < e.contours.length; t++) {
2213
2213
  const n = e.contours[t];
2214
2214
  let s = 0;
@@ -2230,18 +2230,18 @@ function Nr(e) {
2230
2230
  const c = Math.sqrt(_n[0] ** 2 + _n[1] ** 2), a = Math.sqrt(yn[0] ** 2 + yn[1] ** 2);
2231
2231
  if (c === 0 || a === 0) continue;
2232
2232
  const l = _n[0] / c, h = _n[1] / c, f = yn[0] / a, p = yn[1] / a;
2233
- if (wi(l, h, f, p) < To - 1) {
2234
- const u = To - 1, _ = qr * Math.sqrt(1 - u * u) / u;
2233
+ if (Ai(l, h, f, p) < So - 1) {
2234
+ const u = So - 1, _ = Gr * Math.sqrt(1 - u * u) / u;
2235
2235
  let y = f - l, g = p - h;
2236
2236
  const x = Math.sqrt(y * y + g * g);
2237
2237
  if (x === 0) continue;
2238
- y = _ * y / x, g = _ * g / x, Gr(i, r) < 0 && (y = -y, g = -g), vo(t, o, 1, -g, y), vo(t, s, 0, g, -y);
2238
+ y = _ * y / x, g = _ * g / x, $r(i, r) < 0 && (y = -y, g = -g), Eo(t, o, 1, -g, y), Eo(t, s, 0, g, -y);
2239
2239
  }
2240
2240
  }
2241
2241
  }
2242
2242
  }
2243
- const Eo = [0, 0, 0], Io = [0, 0, 0], Do = [0, 0];
2244
- function li(e) {
2243
+ const Io = [0, 0, 0], Do = [0, 0, 0], Ro = [0, 0];
2244
+ function hi(e) {
2245
2245
  const t = 0.5 * (Math.sqrt(5) - 1), n = e.map(() => 0), s = [];
2246
2246
  for (let o = 0; o < e.length; o++) {
2247
2247
  const i = e[o];
@@ -2250,12 +2250,12 @@ function li(e) {
2250
2250
  let c = r;
2251
2251
  for (let l = 0; l < i.length && r === c; l++) c = i[l].endY();
2252
2252
  for (let l = 0; l < i.length && r === c; l++)
2253
- i[l].point(t, Do), c = Do[1];
2254
- const a = Wo(r, c, t);
2253
+ i[l].point(t, Ro), c = Ro[1];
2254
+ const a = zo(r, c, t);
2255
2255
  for (let l = 0; l < e.length; l++)
2256
2256
  for (const h of e[l]) {
2257
- const f = h.scanlineIntersections(a, Eo, Io);
2258
- for (let p = 0; p < f; p++) s.push({ x: Eo[p], dy: Io[p], c: l });
2257
+ const f = h.scanlineIntersections(a, Io, Do);
2258
+ for (let p = 0; p < f; p++) s.push({ x: Io[p], dy: Do[p], c: l });
2259
2259
  }
2260
2260
  s.sort((l, h) => _t(l.x - h.x));
2261
2261
  for (let l = 1; l < s.length; l++)
@@ -2266,20 +2266,47 @@ function li(e) {
2266
2266
  }
2267
2267
  s.length = 0;
2268
2268
  }
2269
- for (let o = 0; o < e.length; o++) {
2270
- if (n[o] >= 0) continue;
2271
- const i = e[o].reverse();
2272
- for (let r = 0; r < i.length; r++) {
2273
- const c = i[r];
2274
- i[r] = c.type === st ? new et(st, c.p1x, c.p1y, c.p0x, c.p0y, 0, 0, 0, 0) : c.type === ct ? new et(ct, c.p2x, c.p2y, c.p1x, c.p1y, c.p0x, c.p0y, 0, 0) : new et(Gt, c.p3x, c.p3y, c.p2x, c.p2y, c.p1x, c.p1y, c.p0x, c.p0y);
2269
+ for (let o = 0; o < e.length; o++)
2270
+ n[o] < 0 && fi(e[o]);
2271
+ }
2272
+ function fi(e) {
2273
+ e.reverse();
2274
+ for (let t = 0; t < e.length; t++) {
2275
+ const n = e[t];
2276
+ e[t] = n.type === tt ? new et(tt, n.p1x, n.p1y, n.p0x, n.p0y, 0, 0, 0, 0) : n.type === ct ? new et(ct, n.p2x, n.p2y, n.p1x, n.p1y, n.p0x, n.p0y, 0, 0) : new et(Gt, n.p3x, n.p3y, n.p2x, n.p2y, n.p1x, n.p1y, n.p0x, n.p0y);
2277
+ }
2278
+ }
2279
+ const Ks = [0, 0], Yr = [0.5 - Math.sqrt(0.6) / 2, 0.5, 0.5 + Math.sqrt(0.6) / 2], Hr = [5 / 18, 8 / 18, 5 / 18];
2280
+ function Xr(e) {
2281
+ let t = 0;
2282
+ for (const n of e) {
2283
+ if (n.type === tt) {
2284
+ t += (n.p0x * n.p1y - n.p1x * n.p0y) / 2;
2285
+ continue;
2275
2286
  }
2287
+ for (let s = 0; s < 3; s++) {
2288
+ const o = Yr[s], i = 1 - o;
2289
+ n.point(o, Ks);
2290
+ let r, c;
2291
+ n.type === ct ? (r = 2 * (i * (n.p1x - n.p0x) + o * (n.p2x - n.p1x)), c = 2 * (i * (n.p1y - n.p0y) + o * (n.p2y - n.p1y))) : (r = 3 * (i * i * (n.p1x - n.p0x) + 2 * i * o * (n.p2x - n.p1x) + o * o * (n.p3x - n.p2x)), c = 3 * (i * i * (n.p1y - n.p0y) + 2 * i * o * (n.p2y - n.p1y) + o * o * (n.p3y - n.p2y))), t += Hr[s] * (Ks[0] * c - Ks[1] * r) / 2;
2292
+ }
2293
+ }
2294
+ return t;
2295
+ }
2296
+ function Kr(e) {
2297
+ let t = 0;
2298
+ for (const n of e) {
2299
+ if (n.length === 0) continue;
2300
+ const s = Xr(n);
2301
+ Math.abs(s) > Math.abs(t) && (t = s);
2276
2302
  }
2303
+ t > 0 && e.forEach(fi);
2277
2304
  }
2278
- const Ro = 1e-5, pe = 1e-6, $r = 2e4, Br = 1e5;
2279
- function Yr(e) {
2305
+ const Lo = 1e-5, ue = 1e-6, jr = 2e4, Vr = 1e5;
2306
+ function Wr(e) {
2280
2307
  return [e.p0x, e.p0y, e.p1x, e.p1y, e.p2x, e.p2y, e.p3x, e.p3y].slice(0, 2 * e.type + 4);
2281
2308
  }
2282
- function Lo(e) {
2309
+ function Po(e) {
2283
2310
  const t = e.length / 2 - 2;
2284
2311
  return new et(
2285
2312
  t,
@@ -2294,7 +2321,7 @@ function Lo(e) {
2294
2321
  );
2295
2322
  }
2296
2323
  const at = new Float64Array(8), ht = new Float64Array(8), Vt = new Float64Array(8);
2297
- function ue(e, t, n, s) {
2324
+ function _e(e, t, n, s) {
2298
2325
  const o = e.length, i = o / 2 - 1;
2299
2326
  for (let r = 0; r <= i; r++) {
2300
2327
  for (let c = 0; c < o; c++) Vt[c] = e[c];
@@ -2305,11 +2332,11 @@ function ue(e, t, n, s) {
2305
2332
  s[2 * r] = Vt[0], s[2 * r + 1] = Vt[1];
2306
2333
  }
2307
2334
  }
2308
- function Hr(e, t, n) {
2309
- return ue(e, t, n, at), Array.from(at.subarray(0, e.length));
2335
+ function zr(e, t, n) {
2336
+ return _e(e, t, n, at), Array.from(at.subarray(0, e.length));
2310
2337
  }
2311
- let _e = 0, ye = 0, Ot = -1, kn = -1, Un = 0, Tn = 0, ss = 0, es = 0;
2312
- function Xr(e, t) {
2338
+ let ye = 0, ge = 0, Ot = -1, kn = -1, Un = 0, Tn = 0, ss = 0, es = 0;
2339
+ function Zr(e, t) {
2313
2340
  Ot = -1, kn = -1;
2314
2341
  let n = 0;
2315
2342
  for (let h = 0; h < 2; h++) {
@@ -2338,7 +2365,7 @@ function Xr(e, t) {
2338
2365
  const a = Math.hypot(o, i), l = Math.hypot(r, c);
2339
2366
  ss = o / a - r / l, es = i / a - c / l, Math.hypot(ss, es) > 1e-9 || (Ot = -1);
2340
2367
  }
2341
- function Kr(e, t) {
2368
+ function Qr(e, t) {
2342
2369
  const n = Ot ? e - 2 : 0;
2343
2370
  for (let o = 0; o < e; o += 2)
2344
2371
  if (o !== n && (at[o] - Un) * ss + (at[o + 1] - Tn) * es <= 0) return !1;
@@ -2348,46 +2375,46 @@ function Kr(e, t) {
2348
2375
  return !0;
2349
2376
  }
2350
2377
  function Mn(e, t, n, s, o, i, r) {
2351
- if (--_e < 0 || --ye < 0) return;
2378
+ if (--ye < 0 || --ge < 0) return;
2352
2379
  const c = e.length, a = s.length;
2353
- ue(e, t, n, at), ue(s, o, i, ht);
2380
+ _e(e, t, n, at), _e(s, o, i, ht);
2354
2381
  let l = 1 / 0, h = 1 / 0, f = -1 / 0, p = -1 / 0;
2355
2382
  for (let M = 0; M < c; M += 2)
2356
2383
  l = Math.min(l, at[M]), h = Math.min(h, at[M + 1]), f = Math.max(f, at[M]), p = Math.max(p, at[M + 1]);
2357
2384
  let u = 1 / 0, _ = 1 / 0, y = -1 / 0, g = -1 / 0;
2358
2385
  for (let M = 0; M < a; M += 2)
2359
2386
  u = Math.min(u, ht[M]), _ = Math.min(_, ht[M + 1]), y = Math.max(y, ht[M]), g = Math.max(g, ht[M + 1]);
2360
- if (l > y || u > f || h > g || _ > p || Ot >= 0 && (Ot ? n === 1 : t === 0) && (kn ? i === 1 : o === 0) && Kr(c, a))
2387
+ if (l > y || u > f || h > g || _ > p || Ot >= 0 && (Ot ? n === 1 : t === 0) && (kn ? i === 1 : o === 0) && Qr(c, a))
2361
2388
  return;
2362
- const x = Math.max(f - l, p - h), w = Math.max(y - u, g - _);
2363
- if (c === 4 && a === 4 || x < Ro && w < Ro) {
2364
- const M = at[c - 2] - at[0], A = at[c - 1] - at[1], k = ht[a - 2] - ht[0], T = ht[a - 1] - ht[1], S = Q(M, A, k, T), b = Q(ht[0] - at[0], ht[1] - at[1], k, T) / S, m = Q(ht[0] - at[0], ht[1] - at[1], M, A) / S;
2365
- b >= 0 && b <= 1 && m >= 0 && m <= 1 && r.push(t + b * (n - t), o + m * (i - o));
2366
- } else x > w ? (Mn(e, t, (t + n) / 2, s, o, i, r), Mn(e, (t + n) / 2, n, s, o, i, r)) : (Mn(e, t, n, s, o, (o + i) / 2, r), Mn(e, t, n, s, (o + i) / 2, i, r));
2389
+ const x = Math.max(f - l, p - h), b = Math.max(y - u, g - _);
2390
+ if (c === 4 && a === 4 || x < Lo && b < Lo) {
2391
+ const M = at[c - 2] - at[0], A = at[c - 1] - at[1], k = ht[a - 2] - ht[0], T = ht[a - 1] - ht[1], S = Q(M, A, k, T), w = Q(ht[0] - at[0], ht[1] - at[1], k, T) / S, m = Q(ht[0] - at[0], ht[1] - at[1], M, A) / S;
2392
+ w >= 0 && w <= 1 && m >= 0 && m <= 1 && r.push(t + w * (n - t), o + m * (i - o));
2393
+ } else x > b ? (Mn(e, t, (t + n) / 2, s, o, i, r), Mn(e, (t + n) / 2, n, s, o, i, r)) : (Mn(e, t, n, s, o, (o + i) / 2, r), Mn(e, t, n, s, (o + i) / 2, i, r));
2367
2394
  }
2368
2395
  function Xn(e, t, n) {
2369
2396
  const s = e[2] - e[0], o = e[3] - e[1];
2370
2397
  return ((t - e[0]) * s + (n - e[1]) * o) / (s * s + o * o);
2371
2398
  }
2372
- function jr(e, t, n) {
2399
+ function Jr(e, t, n) {
2373
2400
  if (e.length !== 4 || t.length !== 4) return !1;
2374
2401
  const s = e[2] - e[0], o = e[3] - e[1], i = 1e-9 * Math.hypot(s, o);
2375
2402
  return Math.abs(Q(s, o, t[0] - e[0], t[1] - e[1])) > i || Math.abs(Q(s, o, t[2] - e[0], t[3] - e[1])) > i ? !1 : (n.push(Xn(e, t[0], t[1]), 0, Xn(e, t[2], t[3]), 1), n.push(0, Xn(t, e[0], e[1]), 1, Xn(t, e[2], e[3])), !0);
2376
2403
  }
2377
- function Vr(e) {
2404
+ function tc(e) {
2378
2405
  const t = [];
2379
2406
  for (let n = e.length - 2; n >= 0; n -= 2) t.push(e[n], e[n + 1]);
2380
2407
  return t;
2381
2408
  }
2382
- function Wr(e, t) {
2409
+ function nc(e, t) {
2383
2410
  if (e.length !== t.length) return !1;
2384
- for (let n = 0; n < e.length; n++) if (!(Math.abs(e[n] - t[n]) < pe)) return !1;
2411
+ for (let n = 0; n < e.length; n++) if (!(Math.abs(e[n] - t[n]) < ue)) return !1;
2385
2412
  return !0;
2386
2413
  }
2387
2414
  const gn = [0, 0], Wt = [0, 0], os = [0, 0, 0], is = [0, 0, 0];
2388
2415
  let cn = new Int32Array(8);
2389
- const zr = 0, hi = 1, Zr = 2;
2390
- function Po(e, t, n, s) {
2416
+ const sc = 0, pi = 1, ec = 2;
2417
+ function Fo(e, t, n, s) {
2391
2418
  let o = 0;
2392
2419
  for (let i = 0; i < e.length; i++) {
2393
2420
  if (s < t[4 * i + 1] - 1e-9 || s > t[4 * i + 3] + 1e-9) continue;
@@ -2396,7 +2423,7 @@ function Po(e, t, n, s) {
2396
2423
  }
2397
2424
  return o !== 0;
2398
2425
  }
2399
- function Fo(e, t, n, s, o, i, r) {
2426
+ function qo(e, t, n, s, o, i, r) {
2400
2427
  cn.fill(0, 0, n);
2401
2428
  for (let a = 0; a < e.length; a++) {
2402
2429
  if (r < o[4 * a + 1] - 1e-9 || r > o[4 * a + 3] + 1e-9) continue;
@@ -2405,107 +2432,107 @@ function Fo(e, t, n, s, o, i, r) {
2405
2432
  }
2406
2433
  let c = !1;
2407
2434
  for (let a = 1; a < n && !c; a++) c = cn[a] !== 0;
2408
- return cn[0] !== 0 && (s === hi ? c : !c);
2435
+ return cn[0] !== 0 && (s === pi ? c : !c);
2409
2436
  }
2410
- function Qr(e) {
2437
+ function oc(e) {
2411
2438
  const t = we([e.contours]);
2412
2439
  t && (e.contours = t);
2413
2440
  }
2414
- function qo(e, t) {
2415
- const n = we([e.contours, ...t.length > 0 ? t : [[]]], hi);
2441
+ function Oo(e, t) {
2442
+ const n = we([e.contours, ...t.length > 0 ? t : [[]]], pi);
2416
2443
  n && (e.contours = n);
2417
2444
  }
2418
- function Jr(e, t) {
2445
+ function ic(e, t) {
2419
2446
  if (t.length === 0) return;
2420
- const n = we([e.contours, ...t], Zr);
2447
+ const n = we([e.contours, ...t], ec);
2421
2448
  n && (e.contours = n);
2422
2449
  }
2423
- function we(e, t = zr) {
2424
- const n = e.flat(), s = n.flat(), o = s.map(Yr), i = o.length, r = e.length, c = r > 1;
2450
+ function we(e, t = sc) {
2451
+ const n = e.flat(), s = n.flat(), o = s.map(Wr), i = o.length, r = e.length, c = r > 1;
2425
2452
  cn.length < r && (cn = new Int32Array(r));
2426
2453
  const a = new Float64Array(4 * i), l = new Int32Array(i), h = new Int32Array(i);
2427
2454
  let f = 0;
2428
- for (let b = 0; b < r; b++)
2429
- for (const m of e[b]) {
2455
+ for (let w = 0; w < r; w++)
2456
+ for (const m of e[w]) {
2430
2457
  for (let d = 0; d < m.length; d++)
2431
- l[f + d] = f + (d + 1) % m.length, h[f + d] = b;
2458
+ l[f + d] = f + (d + 1) % m.length, h[f + d] = w;
2432
2459
  f += m.length;
2433
2460
  }
2434
- for (let b = 0; b < i; b++) {
2435
- const m = o[b];
2461
+ for (let w = 0; w < i; w++) {
2462
+ const m = o[w];
2436
2463
  let d = 1 / 0, U = 1 / 0, v = -1 / 0, C = -1 / 0;
2437
2464
  for (let I = 0; I < m.length; I += 2)
2438
2465
  d = Math.min(d, m[I]), U = Math.min(U, m[I + 1]), v = Math.max(v, m[I]), C = Math.max(C, m[I + 1]);
2439
- a[4 * b] = d, a[4 * b + 1] = U, a[4 * b + 2] = v, a[4 * b + 3] = C;
2466
+ a[4 * w] = d, a[4 * w + 1] = U, a[4 * w + 2] = v, a[4 * w + 3] = C;
2440
2467
  }
2441
- const p = Array.from({ length: i }, (b, m) => m).sort((b, m) => a[4 * b] - a[4 * m]), u = o.map(() => []), _ = new Uint8Array(i);
2442
- ye = Br;
2443
- for (let b = 0; b < i; b++) {
2444
- const m = p[b];
2445
- for (let d = b + 1; d < i; d++) {
2468
+ const p = Array.from({ length: i }, (w, m) => m).sort((w, m) => a[4 * w] - a[4 * m]), u = o.map(() => []), _ = new Uint8Array(i);
2469
+ ge = Vr;
2470
+ for (let w = 0; w < i; w++) {
2471
+ const m = p[w];
2472
+ for (let d = w + 1; d < i; d++) {
2446
2473
  const U = p[d];
2447
2474
  if (a[4 * U] > a[4 * m + 2]) break;
2448
2475
  if (a[4 * m + 1] > a[4 * U + 3] || a[4 * U + 1] > a[4 * m + 3]) continue;
2449
2476
  const v = Math.min(m, U), C = Math.max(m, U);
2450
2477
  l[v] !== C && l[C] !== v && (_[v] = _[C] = 1);
2451
2478
  const I = [];
2452
- if (_e = $r, jr(o[v], o[C], I) || (Xr(o[v], o[C]), Mn(o[v], 0, 1, o[C], 0, 1, I)), _e < 0 || ye < 0) return null;
2479
+ if (ye = jr, Jr(o[v], o[C], I) || (Zr(o[v], o[C]), Mn(o[v], 0, 1, o[C], 0, 1, I)), ye < 0 || ge < 0) return null;
2453
2480
  for (let R = 0; R < I.length; R += 2)
2454
2481
  u[v].push(I[R]), u[C].push(I[R + 1]);
2455
2482
  }
2456
2483
  }
2457
- const y = u.map((b) => {
2484
+ const y = u.map((w) => {
2458
2485
  const m = [0];
2459
- for (const d of b.sort((U, v) => U - v))
2486
+ for (const d of w.sort((U, v) => U - v))
2460
2487
  d - m[m.length - 1] > 1e-7 && d < 1 - 1e-7 && m.push(d);
2461
2488
  return m.push(1), m;
2462
2489
  });
2463
2490
  let g = !1;
2464
- const x = [], w = [];
2491
+ const x = [], b = [];
2465
2492
  let M = 0;
2466
- for (const b of n) {
2467
- const m = M + b.length;
2493
+ for (const w of n) {
2494
+ const m = M + w.length;
2468
2495
  let d = !0;
2469
2496
  for (let I = M; I < m; I++) (_[I] || y[I].length > 2) && (d = !1);
2470
2497
  let U = !1, v = !1, C = !1;
2471
2498
  for (let I = M; I < m; I++) {
2472
2499
  const R = y[I];
2473
2500
  for (let G = 1; G < R.length; G++) {
2474
- const F = Hr(o[I], R[G - 1], R[G]), X = Lo(F);
2501
+ const F = zr(o[I], R[G - 1], R[G]), X = Po(F);
2475
2502
  X.point(0.5, gn), X.direction(0.5, Wt);
2476
2503
  const H = Math.hypot(Wt[0], Wt[1]), K = Math.hypot(F[F.length - 2] - F[0], F[F.length - 1] - F[1]);
2477
2504
  if (!(H === 0 || K === 0)) {
2478
2505
  if (!d || !U) {
2479
- const tt = Math.min(1e-6, K * K / 64) / H, z = gn[0] + Wt[1] * tt, Lt = gn[1] - Wt[0] * tt, pt = gn[0] - Wt[1] * tt, Nt = gn[1] + Wt[0] * tt;
2480
- v = c ? Fo(s, h, r, t, a, z, Lt) : Po(s, a, z, Lt), C = c ? Fo(s, h, r, t, a, pt, Nt) : Po(s, a, pt, Nt), U = !0;
2506
+ const nt = Math.min(1e-6, K * K / 64) / H, z = gn[0] + Wt[1] * nt, Lt = gn[1] - Wt[0] * nt, pt = gn[0] - Wt[1] * nt, Nt = gn[1] + Wt[0] * nt;
2507
+ v = c ? qo(s, h, r, t, a, z, Lt) : Fo(s, a, z, Lt), C = c ? qo(s, h, r, t, a, pt, Nt) : Fo(s, a, pt, Nt), U = !0;
2481
2508
  }
2482
- v === C ? h[I] === 0 && (g = !0) : (x.push(F), w.push(v), h[I] !== 0 && (g = !0));
2509
+ v === C ? h[I] === 0 && (g = !0) : (x.push(F), b.push(v), h[I] !== 0 && (g = !0));
2483
2510
  }
2484
2511
  }
2485
2512
  }
2486
2513
  M = m;
2487
2514
  }
2488
- const A = 2 * w.filter(Boolean).length >= w.length, k = [];
2489
- for (let b = 0; b < x.length; b++) {
2490
- let m = x[b];
2491
- w[b] !== A && (m = Vr(m), g = !0);
2515
+ const A = 2 * b.filter(Boolean).length >= b.length, k = [];
2516
+ for (let w = 0; w < x.length; w++) {
2517
+ let m = x[w];
2518
+ b[w] !== A && (m = tc(m), g = !0);
2492
2519
  let d = !1;
2493
- for (let U = 0; U < k.length && !d; U++) d = Wr(k[U], m);
2520
+ for (let U = 0; U < k.length && !d; U++) d = nc(k[U], m);
2494
2521
  d ? g = !0 : k.push(m);
2495
2522
  }
2496
2523
  if (!g) return null;
2497
2524
  const T = new Uint8Array(k.length), S = [];
2498
- for (let b = 0; b < k.length; b++) {
2499
- if (T[b]) continue;
2500
- T[b] = 1;
2501
- const m = [k[b]];
2525
+ for (let w = 0; w < k.length; w++) {
2526
+ if (T[w]) continue;
2527
+ T[w] = 1;
2528
+ const m = [k[w]];
2502
2529
  for (; ; ) {
2503
2530
  const d = m[m.length - 1], U = d[d.length - 2], v = d[d.length - 1];
2504
- if (m.length > 1 && Math.hypot(U - m[0][0], v - m[0][1]) < pe) {
2531
+ if (m.length > 1 && Math.hypot(U - m[0][0], v - m[0][1]) < ue) {
2505
2532
  m[0][0] = U, m[0][1] = v;
2506
2533
  break;
2507
2534
  }
2508
- let C = -1, I = pe;
2535
+ let C = -1, I = ue;
2509
2536
  for (let R = 0; R < k.length; R++) {
2510
2537
  if (T[R]) continue;
2511
2538
  const G = Math.hypot(k[R][0] - U, k[R][1] - v);
@@ -2514,39 +2541,39 @@ function we(e, t = zr) {
2514
2541
  if (C < 0) return null;
2515
2542
  T[C] = 1, k[C][0] = U, k[C][1] = v, m.push(k[C]);
2516
2543
  }
2517
- S.push(m.map(Lo));
2544
+ S.push(m.map(Po));
2518
2545
  }
2519
2546
  return S;
2520
2547
  }
2521
- const fs = 1, ps = 2, tc = 3, us = 4, nc = 5, sc = 6, be = 7, ut = [0, 0], zt = [0, 0];
2522
- function ec(e, t) {
2548
+ const fs = 1, ps = 2, rc = 3, us = 4, cc = 5, ac = 6, Ae = 7, ut = [0, 0], zt = [0, 0];
2549
+ function lc(e, t) {
2523
2550
  return Math.trunc(3 + 2.875 * e / (t - 1) - 1.4375 + 0.5) - 3;
2524
2551
  }
2525
- function oc(e, t, n, s, o) {
2552
+ function hc(e, t, n, s, o) {
2526
2553
  return e * n + t * s <= 0 || Math.abs(e * s - t * n) > o;
2527
2554
  }
2528
- function ic(e) {
2555
+ function fc(e) {
2529
2556
  const t = Number(e.v & 1n);
2530
2557
  return e.v >>= 1n, t;
2531
2558
  }
2532
- function rc(e) {
2559
+ function pc(e) {
2533
2560
  const t = Number(e.v % 3n);
2534
2561
  return e.v /= 3n, t;
2535
2562
  }
2536
- function Oo(e) {
2537
- return [sc, nc, tc][rc(e)];
2563
+ function Go(e) {
2564
+ return [ac, cc, rc][pc(e)];
2538
2565
  }
2539
2566
  function mn(e, t) {
2540
- const n = e.v << 1 + ic(t);
2541
- e.v = (n | n >> 3) & be;
2567
+ const n = e.v << 1 + fc(t);
2568
+ e.v = (n | n >> 3) & Ae;
2542
2569
  }
2543
- function cc(e, t, n) {
2570
+ function uc(e, t, n) {
2544
2571
  const s = e.v & n;
2545
- s === fs || s === ps || s === us ? e.v = s ^ be : mn(e, t);
2572
+ s === fs || s === ps || s === us ? e.v = s ^ Ae : mn(e, t);
2546
2573
  }
2547
- function ac(e, t, n = 0n) {
2548
- const s = Math.sin(t), o = { v: Oo({ v: n }) }, i = { v: n };
2549
- i.v = n, o.v = Oo(i);
2574
+ function _c(e, t, n = 0n) {
2575
+ const s = Math.sin(t), o = { v: Go({ v: n }) }, i = { v: n };
2576
+ i.v = n, o.v = Go(i);
2550
2577
  const r = [];
2551
2578
  for (const c of e.contours) {
2552
2579
  if (c.length === 0) continue;
@@ -2557,7 +2584,7 @@ function ac(e, t, n = 0n) {
2557
2584
  const u = c[p];
2558
2585
  u.direction(0, zt);
2559
2586
  const _ = Math.sqrt(zt[0] * zt[0] + zt[1] * zt[1]), y = _ > 0 ? zt[0] / _ : 0, g = _ > 0 ? zt[1] / _ : 0;
2560
- oc(h, f, y, g, s) && r.push(p), u.direction(1, ut);
2587
+ hc(h, f, y, g, s) && r.push(p), u.direction(1, ut);
2561
2588
  const x = Math.sqrt(ut[0] * ut[0] + ut[1] * ut[1]);
2562
2589
  h = x > 0 ? ut[0] / x : 0, f = x > 0 ? ut[1] / x : 0;
2563
2590
  }
@@ -2565,12 +2592,12 @@ function ac(e, t, n = 0n) {
2565
2592
  mn(o, i);
2566
2593
  for (const p of c) p.color = o.v;
2567
2594
  } else if (r.length === 1) {
2568
- const p = [0, be, 0];
2595
+ const p = [0, Ae, 0];
2569
2596
  mn(o, i), p[0] = o.v, mn(o, i), p[2] = o.v;
2570
2597
  const u = r[0], _ = c.length;
2571
2598
  if (_ >= 3)
2572
2599
  for (let y = 0; y < _; y++) {
2573
- const g = ec(y, _);
2600
+ const g = lc(y, _);
2574
2601
  c[(u + y) % _].color = p[1 + g];
2575
2602
  }
2576
2603
  else if (_ >= 1) {
@@ -2590,37 +2617,37 @@ function ac(e, t, n = 0n) {
2590
2617
  mn(o, i);
2591
2618
  const g = o.v;
2592
2619
  for (let x = 0; x < y; x++) {
2593
- const w = (_ + x) % y;
2594
- u + 1 < p && r[u + 1] === w && (++u, cc(o, i, u === p - 1 ? g : 0)), c[w].color = o.v;
2620
+ const b = (_ + x) % y;
2621
+ u + 1 < p && r[u + 1] === b && (++u, uc(o, i, u === p - 1 ? g : 0)), c[b].color = o.v;
2595
2622
  }
2596
2623
  }
2597
2624
  }
2598
2625
  }
2599
2626
  const V = Number.MAX_VALUE, q = [0, 0], mt = [0, 0];
2600
- let Go = 0, J = new Float64Array(0), ot = new Float64Array(0), B = new Float64Array(0), Y = new Float64Array(0), it = new Int32Array(0), rt = new Float64Array(0), nn = new Float64Array(0), sn = new Float64Array(0), en = new Float64Array(0), Zt = new Int32Array(0);
2601
- const nt = [0, 0];
2602
- let No = 0, Ks = new Float64Array(0), js = new Float64Array(0), Vs = new Float64Array(0), Ws = new Float64Array(0), zs = new Float64Array(0), Zs = new Float64Array(0), Qs = new Float64Array(0), Js = new Float64Array(0), te = new Float64Array(0), ne = new Float64Array(0), se = new Float64Array(0), ee = new Float64Array(0), $o = 0, xn = new Int32Array(0);
2603
- function lc(e) {
2627
+ let No = 0, J = new Float64Array(0), ot = new Float64Array(0), B = new Float64Array(0), Y = new Float64Array(0), it = new Int32Array(0), rt = new Float64Array(0), nn = new Float64Array(0), sn = new Float64Array(0), en = new Float64Array(0), Zt = new Int32Array(0);
2628
+ const st = [0, 0];
2629
+ let $o = 0, js = new Float64Array(0), Vs = new Float64Array(0), Ws = new Float64Array(0), zs = new Float64Array(0), Zs = new Float64Array(0), Qs = new Float64Array(0), Js = new Float64Array(0), te = new Float64Array(0), ne = new Float64Array(0), se = new Float64Array(0), ee = new Float64Array(0), oe = new Float64Array(0), Bo = 0, xn = new Int32Array(0);
2630
+ function yc(e) {
2604
2631
  const t = e.length;
2605
2632
  if (t === 0) return 0;
2606
2633
  let n = 0;
2607
2634
  if (t === 1) {
2608
- e[0].point(0, nt);
2609
- const s = nt[0], o = nt[1];
2610
- e[0].point(1 / 3, nt);
2611
- const i = nt[0], r = nt[1];
2612
- e[0].point(2 / 3, nt);
2613
- const c = nt[0], a = nt[1];
2635
+ e[0].point(0, st);
2636
+ const s = st[0], o = st[1];
2637
+ e[0].point(1 / 3, st);
2638
+ const i = st[0], r = st[1];
2639
+ e[0].point(2 / 3, st);
2640
+ const c = st[0], a = st[1];
2614
2641
  n += s * r - o * i, n += i * a - r * c, n += c * o - a * s;
2615
2642
  } else if (t === 2) {
2616
- e[0].point(0, nt);
2617
- const s = nt[0], o = nt[1];
2618
- e[0].point(0.5, nt);
2619
- const i = nt[0], r = nt[1];
2620
- e[1].point(0, nt);
2621
- const c = nt[0], a = nt[1];
2622
- e[1].point(0.5, nt);
2623
- const l = nt[0], h = nt[1];
2643
+ e[0].point(0, st);
2644
+ const s = st[0], o = st[1];
2645
+ e[0].point(0.5, st);
2646
+ const i = st[0], r = st[1];
2647
+ e[1].point(0, st);
2648
+ const c = st[0], a = st[1];
2649
+ e[1].point(0.5, st);
2650
+ const l = st[0], h = st[1];
2624
2651
  n += s * r - o * i, n += i * a - r * c, n += c * h - a * l, n += l * o - h * s;
2625
2652
  } else {
2626
2653
  const s = e[t - 1];
@@ -2632,7 +2659,7 @@ function lc(e) {
2632
2659
  }
2633
2660
  return n > 0 ? -1 : n < 0 ? 1 : 0;
2634
2661
  }
2635
- function hc(e, t, n, s, o, i, r) {
2662
+ function gc(e, t, n, s, o, i, r) {
2636
2663
  const c = r[e][t];
2637
2664
  let a = n;
2638
2665
  if (i < 0) {
@@ -2666,7 +2693,7 @@ function hc(e, t, n, s, o, i, r) {
2666
2693
  function xt(e, t, n, s, o, i, r, c, a) {
2667
2694
  let l = e < 0 ? t : n;
2668
2695
  if (o >= 0) {
2669
- const h = hc(s, o, e, r, c, i, a);
2696
+ const h = gc(s, o, e, r, c, i, a);
2670
2697
  Math.abs(h) < Math.abs(l) && (l = h);
2671
2698
  }
2672
2699
  return l;
@@ -2674,7 +2701,7 @@ function xt(e, t, n, s, o, i, r, c, a) {
2674
2701
  function Tt(e, t, n) {
2675
2702
  return Math.max(Math.min(e, t), Math.min(Math.max(e, t), n));
2676
2703
  }
2677
- function fc(e, t, n, s, o, i, r, c) {
2704
+ function xc(e, t, n, s, o, i, r, c) {
2678
2705
  if (c.length !== t * n * 3)
2679
2706
  throw new Error(`generateMSDF: out.length ${c.length} !== ${t * n * 3}`);
2680
2707
  const a = e.contours, l = a.length;
@@ -2684,33 +2711,33 @@ function fc(e, t, n, s, o, i, r, c) {
2684
2711
  }
2685
2712
  const h = s / r;
2686
2713
  Zt.length < l && (Zt = new Int32Array(l));
2687
- for (let u = 0; u < l; u++) Zt[u] = lc(a[u]);
2688
- $o < l + 1 && (xn = new Int32Array(l + 1), $o = l + 1);
2714
+ for (let u = 0; u < l; u++) Zt[u] = yc(a[u]);
2715
+ Bo < l + 1 && (xn = new Int32Array(l + 1), Bo = l + 1);
2689
2716
  let f = 0;
2690
2717
  for (let u = 0; u < l; u++)
2691
2718
  xn[u] = f, f += a[u].length;
2692
- xn[l] = f, No < f && (Ks = new Float64Array(f), js = new Float64Array(f), Vs = new Float64Array(f), Ws = new Float64Array(f), zs = new Float64Array(f), Zs = new Float64Array(f), Qs = new Float64Array(f), Js = new Float64Array(f), te = new Float64Array(f), ne = new Float64Array(f), se = new Float64Array(f), ee = new Float64Array(f), No = f);
2719
+ xn[l] = f, $o < f && (js = new Float64Array(f), Vs = new Float64Array(f), Ws = new Float64Array(f), zs = new Float64Array(f), Zs = new Float64Array(f), Qs = new Float64Array(f), Js = new Float64Array(f), te = new Float64Array(f), ne = new Float64Array(f), se = new Float64Array(f), ee = new Float64Array(f), oe = new Float64Array(f), $o = f);
2693
2720
  for (let u = 0; u < l; u++) {
2694
2721
  const _ = a[u], y = _.length, g = xn[u];
2695
2722
  for (let x = 0; x < y; x++) {
2696
- const w = _[x], M = _[(x + y - 1) % y], A = _[(x + 1) % y], k = g + x;
2697
- w.point(0, mt), Ks[k] = mt[0], js[k] = mt[1], w.point(1, mt), Vs[k] = mt[0], Ws[k] = mt[1], w.direction(0, q);
2723
+ const b = _[x], M = _[(x + y - 1) % y], A = _[(x + 1) % y], k = g + x;
2724
+ b.point(0, mt), js[k] = mt[0], Vs[k] = mt[1], b.point(1, mt), Ws[k] = mt[0], zs[k] = mt[1], b.direction(0, q);
2698
2725
  let T = Math.sqrt(q[0] * q[0] + q[1] * q[1]);
2699
- const S = T > 0 ? q[0] / T : 0, b = T > 0 ? q[1] / T : 0;
2700
- zs[k] = S, Zs[k] = b, w.direction(1, q), T = Math.sqrt(q[0] * q[0] + q[1] * q[1]);
2726
+ const S = T > 0 ? q[0] / T : 0, w = T > 0 ? q[1] / T : 0;
2727
+ Zs[k] = S, Qs[k] = w, b.direction(1, q), T = Math.sqrt(q[0] * q[0] + q[1] * q[1]);
2701
2728
  const m = T > 0 ? q[0] / T : 0, d = T > 0 ? q[1] / T : 0;
2702
- Qs[k] = m, Js[k] = d, M.direction(1, q), T = Math.sqrt(q[0] * q[0] + q[1] * q[1]);
2729
+ Js[k] = m, te[k] = d, M.direction(1, q), T = Math.sqrt(q[0] * q[0] + q[1] * q[1]);
2703
2730
  const U = T > 0 ? q[0] / T : 0, v = T > 0 ? q[1] / T : 0;
2704
2731
  A.direction(0, q), T = Math.sqrt(q[0] * q[0] + q[1] * q[1]);
2705
- const C = T > 0 ? q[0] / T : 0, I = T > 0 ? q[1] / T : 0, R = U + S, G = v + b, F = Math.sqrt(R * R + G * G);
2706
- te[k] = F > 0 ? R / F : 0, ne[k] = F > 0 ? G / F : 0;
2732
+ const C = T > 0 ? q[0] / T : 0, I = T > 0 ? q[1] / T : 0, R = U + S, G = v + w, F = Math.sqrt(R * R + G * G);
2733
+ ne[k] = F > 0 ? R / F : 0, se[k] = F > 0 ? G / F : 0;
2707
2734
  const X = m + C, H = d + I, K = Math.sqrt(X * X + H * H);
2708
- se[k] = K > 0 ? -(X / K) : 0, ee[k] = K > 0 ? -(H / K) : 0;
2735
+ ee[k] = K > 0 ? -(X / K) : 0, oe[k] = K > 0 ? -(H / K) : 0;
2709
2736
  }
2710
2737
  }
2711
- if (Go < l) {
2738
+ if (No < l) {
2712
2739
  const u = l * 3;
2713
- J = new Float64Array(u), ot = new Float64Array(u), B = new Float64Array(u), Y = new Float64Array(u), it = new Int32Array(u), rt = new Float64Array(u), nn = new Float64Array(l), sn = new Float64Array(l), en = new Float64Array(l), Go = l;
2740
+ J = new Float64Array(u), ot = new Float64Array(u), B = new Float64Array(u), Y = new Float64Array(u), it = new Int32Array(u), rt = new Float64Array(u), nn = new Float64Array(l), sn = new Float64Array(l), en = new Float64Array(l), No = l;
2714
2741
  }
2715
2742
  const p = { distance: 0, dot: 0, param: 0 };
2716
2743
  for (let u = 0; u < n; u++)
@@ -2735,13 +2762,13 @@ function fc(e, t, n, s, o, i, r, c) {
2735
2762
  const vt = Math.abs(J[E + 2]);
2736
2763
  ($t < vt || $t === vt && tn < ot[E + 2]) && (J[E + 2] = Fn, ot[E + 2] = tn, it[E + 2] = $, rt[E + 2] = Rs);
2737
2764
  }
2738
- const gt = N + $, Ls = y - Ks[gt], Ps = g - js[gt], Fs = y - Vs[gt], qs = g - Ws[gt], Qe = zs[gt], Je = Zs[gt], to = Qs[gt], no = Js[gt], Mi = Ls * te[gt] + Ps * ne[gt], mi = Fs * se[gt] + qs * ee[gt];
2739
- if (Mi > 0 && -(Ls * Qe + Ps * Je) > 0) {
2740
- const O = Ls * Je - Ps * Qe;
2765
+ const gt = N + $, Ls = y - js[gt], Ps = g - Vs[gt], Fs = y - Ws[gt], qs = g - zs[gt], Je = Zs[gt], to = Qs[gt], no = Js[gt], so = te[gt], bi = Ls * ne[gt] + Ps * se[gt], wi = Fs * ee[gt] + qs * oe[gt];
2766
+ if (bi > 0 && -(Ls * Je + Ps * to) > 0) {
2767
+ const O = Ls * to - Ps * Je;
2741
2768
  Math.abs(O) < $t && (Es && (O <= 0 && O > B[E] ? B[E] = O : O > 0 && O < Y[E] && (Y[E] = O)), Is && (O <= 0 && O > B[E + 1] ? B[E + 1] = O : O > 0 && O < Y[E + 1] && (Y[E + 1] = O)), Ds && (O <= 0 && O > B[E + 2] ? B[E + 2] = O : O > 0 && O < Y[E + 2] && (Y[E + 2] = O)));
2742
2769
  }
2743
- if (mi > 0 && Fs * to + qs * no > 0) {
2744
- const O = Fs * no - qs * to;
2770
+ if (wi > 0 && Fs * no + qs * so > 0) {
2771
+ const O = Fs * so - qs * no;
2745
2772
  Math.abs(O) < $t && (Es && (O <= 0 && O > B[E] ? B[E] = O : O > 0 && O < Y[E] && (Y[E] = O)), Is && (O <= 0 && O > B[E + 1] ? B[E + 1] = O : O > 0 && O < Y[E + 1] && (Y[E + 1] = O)), Ds && (O <= 0 && O > B[E + 2] ? B[E + 2] = O : O > 0 && O < Y[E + 2] && (Y[E + 2] = O)));
2746
2773
  }
2747
2774
  }
@@ -2777,47 +2804,47 @@ function fc(e, t, n, s, o, i, r, c) {
2777
2804
  a
2778
2805
  );
2779
2806
  }
2780
- let x = -V, w = 0, M = -V, A = V, k = -1, T = -1, S = 0, b = -V, m = 0, d = -V, U = V, v = -1, C = -1, I = 0, R = -V, G = 0, F = -V, X = V, H = -1, K = -1, tt = 0, z = -V, Lt = 0, pt = -V, Nt = V, Pt = -1, ke = -1, Ue = 0, vn = -V, Te = 0, _s = -V, ys = V, Se = -1, Ce = -1, ve = 0, En = -V, Ee = 0, gs = -V, xs = V, Ie = -1, De = -1, Re = 0, In = -V, Le = 0, ds = -V, Ms = V, Pe = -1, Fe = -1, qe = 0, Dn = -V, Oe = 0, ms = -V, ws = V, Ge = -1, Ne = -1, $e = 0, Rn = -V, Be = 0, bs = -V, As = V, Ye = -1, He = -1, Xe = 0;
2807
+ let x = -V, b = 0, M = -V, A = V, k = -1, T = -1, S = 0, w = -V, m = 0, d = -V, U = V, v = -1, C = -1, I = 0, R = -V, G = 0, F = -V, X = V, H = -1, K = -1, nt = 0, z = -V, Lt = 0, pt = -V, Nt = V, Pt = -1, Ue = -1, Te = 0, vn = -V, Se = 0, _s = -V, ys = V, Ce = -1, ve = -1, Ee = 0, En = -V, Ie = 0, gs = -V, xs = V, De = -1, Re = -1, Le = 0, In = -V, Pe = 0, ds = -V, Ms = V, Fe = -1, qe = -1, Oe = 0, Dn = -V, Ge = 0, ms = -V, bs = V, Ne = -1, $e = -1, Be = 0, Rn = -V, Ye = 0, ws = -V, As = V, He = -1, Xe = -1, Ke = 0;
2781
2808
  for (let P = 0; P < l; P++) {
2782
2809
  const D = P * 3, yt = Zt[P], E = Tt(nn[P], sn[P], en[P]);
2783
2810
  {
2784
2811
  const N = J[D], $ = ot[D], W = Math.abs(N);
2785
- (W < Math.abs(x) || W === Math.abs(x) && $ < w) && (x = N, w = $, k = P, T = it[D], S = rt[D]), B[D] > M && (M = B[D]), Y[D] < A && (A = Y[D]);
2812
+ (W < Math.abs(x) || W === Math.abs(x) && $ < b) && (x = N, b = $, k = P, T = it[D], S = rt[D]), B[D] > M && (M = B[D]), Y[D] < A && (A = Y[D]);
2786
2813
  }
2787
2814
  {
2788
2815
  const N = J[D + 1], $ = ot[D + 1], W = Math.abs(N);
2789
- (W < Math.abs(b) || W === Math.abs(b) && $ < m) && (b = N, m = $, v = P, C = it[D + 1], I = rt[D + 1]), B[D + 1] > d && (d = B[D + 1]), Y[D + 1] < U && (U = Y[D + 1]);
2816
+ (W < Math.abs(w) || W === Math.abs(w) && $ < m) && (w = N, m = $, v = P, C = it[D + 1], I = rt[D + 1]), B[D + 1] > d && (d = B[D + 1]), Y[D + 1] < U && (U = Y[D + 1]);
2790
2817
  }
2791
2818
  {
2792
2819
  const N = J[D + 2], $ = ot[D + 2], W = Math.abs(N);
2793
- (W < Math.abs(R) || W === Math.abs(R) && $ < G) && (R = N, G = $, H = P, K = it[D + 2], tt = rt[D + 2]), B[D + 2] > F && (F = B[D + 2]), Y[D + 2] < X && (X = Y[D + 2]);
2820
+ (W < Math.abs(R) || W === Math.abs(R) && $ < G) && (R = N, G = $, H = P, K = it[D + 2], nt = rt[D + 2]), B[D + 2] > F && (F = B[D + 2]), Y[D + 2] < X && (X = Y[D + 2]);
2794
2821
  }
2795
2822
  if (yt > 0 && E >= 0) {
2796
2823
  {
2797
2824
  const N = J[D], $ = ot[D], W = Math.abs(N);
2798
- (W < Math.abs(z) || W === Math.abs(z) && $ < Lt) && (z = N, Lt = $, Pt = P, ke = it[D], Ue = rt[D]), B[D] > pt && (pt = B[D]), Y[D] < Nt && (Nt = Y[D]);
2825
+ (W < Math.abs(z) || W === Math.abs(z) && $ < Lt) && (z = N, Lt = $, Pt = P, Ue = it[D], Te = rt[D]), B[D] > pt && (pt = B[D]), Y[D] < Nt && (Nt = Y[D]);
2799
2826
  }
2800
2827
  {
2801
2828
  const N = J[D + 1], $ = ot[D + 1], W = Math.abs(N);
2802
- (W < Math.abs(vn) || W === Math.abs(vn) && $ < Te) && (vn = N, Te = $, Se = P, Ce = it[D + 1], ve = rt[D + 1]), B[D + 1] > _s && (_s = B[D + 1]), Y[D + 1] < ys && (ys = Y[D + 1]);
2829
+ (W < Math.abs(vn) || W === Math.abs(vn) && $ < Se) && (vn = N, Se = $, Ce = P, ve = it[D + 1], Ee = rt[D + 1]), B[D + 1] > _s && (_s = B[D + 1]), Y[D + 1] < ys && (ys = Y[D + 1]);
2803
2830
  }
2804
2831
  {
2805
2832
  const N = J[D + 2], $ = ot[D + 2], W = Math.abs(N);
2806
- (W < Math.abs(En) || W === Math.abs(En) && $ < Ee) && (En = N, Ee = $, Ie = P, De = it[D + 2], Re = rt[D + 2]), B[D + 2] > gs && (gs = B[D + 2]), Y[D + 2] < xs && (xs = Y[D + 2]);
2833
+ (W < Math.abs(En) || W === Math.abs(En) && $ < Ie) && (En = N, Ie = $, De = P, Re = it[D + 2], Le = rt[D + 2]), B[D + 2] > gs && (gs = B[D + 2]), Y[D + 2] < xs && (xs = Y[D + 2]);
2807
2834
  }
2808
2835
  }
2809
2836
  if (yt < 0 && E <= 0) {
2810
2837
  {
2811
2838
  const N = J[D], $ = ot[D], W = Math.abs(N);
2812
- (W < Math.abs(In) || W === Math.abs(In) && $ < Le) && (In = N, Le = $, Pe = P, Fe = it[D], qe = rt[D]), B[D] > ds && (ds = B[D]), Y[D] < Ms && (Ms = Y[D]);
2839
+ (W < Math.abs(In) || W === Math.abs(In) && $ < Pe) && (In = N, Pe = $, Fe = P, qe = it[D], Oe = rt[D]), B[D] > ds && (ds = B[D]), Y[D] < Ms && (Ms = Y[D]);
2813
2840
  }
2814
2841
  {
2815
2842
  const N = J[D + 1], $ = ot[D + 1], W = Math.abs(N);
2816
- (W < Math.abs(Dn) || W === Math.abs(Dn) && $ < Oe) && (Dn = N, Oe = $, Ge = P, Ne = it[D + 1], $e = rt[D + 1]), B[D + 1] > ms && (ms = B[D + 1]), Y[D + 1] < ws && (ws = Y[D + 1]);
2843
+ (W < Math.abs(Dn) || W === Math.abs(Dn) && $ < Ge) && (Dn = N, Ge = $, Ne = P, $e = it[D + 1], Be = rt[D + 1]), B[D + 1] > ms && (ms = B[D + 1]), Y[D + 1] < bs && (bs = Y[D + 1]);
2817
2844
  }
2818
2845
  {
2819
2846
  const N = J[D + 2], $ = ot[D + 2], W = Math.abs(N);
2820
- (W < Math.abs(Rn) || W === Math.abs(Rn) && $ < Be) && (Rn = N, Be = $, Ye = P, He = it[D + 2], Xe = rt[D + 2]), B[D + 2] > bs && (bs = B[D + 2]), Y[D + 2] < As && (As = Y[D + 2]);
2847
+ (W < Math.abs(Rn) || W === Math.abs(Rn) && $ < Ye) && (Rn = N, Ye = $, He = P, Xe = it[D + 2], Ke = rt[D + 2]), B[D + 2] > ws && (ws = B[D + 2]), Y[D + 2] < As && (As = Y[D + 2]);
2821
2848
  }
2822
2849
  }
2823
2850
  }
@@ -2832,7 +2859,7 @@ function fc(e, t, n, s, o, i, r, c) {
2832
2859
  g,
2833
2860
  a
2834
2861
  ), Us = xt(
2835
- b,
2862
+ w,
2836
2863
  d,
2837
2864
  U,
2838
2865
  v,
@@ -2847,81 +2874,81 @@ function fc(e, t, n, s, o, i, r, c) {
2847
2874
  X,
2848
2875
  H,
2849
2876
  K,
2850
- tt,
2877
+ nt,
2851
2878
  y,
2852
2879
  g,
2853
2880
  a
2854
- ), di = Tt(ks, Us, Ts), Ke = xt(
2881
+ ), mi = Tt(ks, Us, Ts), je = xt(
2855
2882
  z,
2856
2883
  pt,
2857
2884
  Nt,
2858
2885
  Pt,
2859
- ke,
2860
2886
  Ue,
2887
+ Te,
2861
2888
  y,
2862
2889
  g,
2863
2890
  a
2864
- ), je = xt(
2891
+ ), Ve = xt(
2865
2892
  vn,
2866
2893
  _s,
2867
2894
  ys,
2868
- Se,
2869
2895
  Ce,
2870
2896
  ve,
2897
+ Ee,
2871
2898
  y,
2872
2899
  g,
2873
2900
  a
2874
- ), Ve = xt(
2901
+ ), We = xt(
2875
2902
  En,
2876
2903
  gs,
2877
2904
  xs,
2878
- Ie,
2879
2905
  De,
2880
2906
  Re,
2907
+ Le,
2881
2908
  y,
2882
2909
  g,
2883
2910
  a
2884
- ), Ln = Tt(Ke, je, Ve), We = xt(
2911
+ ), Ln = Tt(je, Ve, We), ze = xt(
2885
2912
  In,
2886
2913
  ds,
2887
2914
  Ms,
2888
- Pe,
2889
2915
  Fe,
2890
2916
  qe,
2917
+ Oe,
2891
2918
  y,
2892
2919
  g,
2893
2920
  a
2894
- ), ze = xt(
2921
+ ), Ze = xt(
2895
2922
  Dn,
2896
2923
  ms,
2897
- ws,
2898
- Ge,
2924
+ bs,
2899
2925
  Ne,
2900
2926
  $e,
2927
+ Be,
2901
2928
  y,
2902
2929
  g,
2903
2930
  a
2904
- ), Ze = xt(
2931
+ ), Qe = xt(
2905
2932
  Rn,
2906
- bs,
2933
+ ws,
2907
2934
  As,
2908
- Ye,
2909
2935
  He,
2910
2936
  Xe,
2937
+ Ke,
2911
2938
  y,
2912
2939
  g,
2913
2940
  a
2914
- ), Pn = Tt(We, ze, Ze);
2941
+ ), Pn = Tt(ze, Ze, Qe);
2915
2942
  let At, kt, Ut, Ss = 0;
2916
2943
  if (Ln >= 0 && Math.abs(Ln) <= Math.abs(Pn)) {
2917
- At = Ke, kt = je, Ut = Ve, Ss = 1;
2944
+ At = je, kt = Ve, Ut = We, Ss = 1;
2918
2945
  for (let P = 0; P < l; P++)
2919
2946
  if (Zt[P] > 0) {
2920
2947
  const D = nn[P], yt = sn[P], E = en[P], N = Tt(D, yt, E);
2921
2948
  Math.abs(N) < Math.abs(Pn) && N > Tt(At, kt, Ut) && (At = D, kt = yt, Ut = E);
2922
2949
  }
2923
2950
  } else if (Pn <= 0 && Math.abs(Pn) < Math.abs(Ln)) {
2924
- At = We, kt = ze, Ut = Ze, Ss = -1;
2951
+ At = ze, kt = Ze, Ut = Qe, Ss = -1;
2925
2952
  for (let P = 0; P < l; P++)
2926
2953
  if (Zt[P] < 0) {
2927
2954
  const D = nn[P], yt = sn[P], E = en[P], N = Tt(D, yt, E);
@@ -2937,26 +2964,26 @@ function fc(e, t, n, s, o, i, r, c) {
2937
2964
  const D = nn[P], yt = sn[P], E = en[P], N = Tt(D, yt, E), $ = Tt(At, kt, Ut);
2938
2965
  N * $ >= 0 && Math.abs(N) < Math.abs($) && (At = D, kt = yt, Ut = E);
2939
2966
  }
2940
- Tt(At, kt, Ut) === di && (At = ks, kt = Us, Ut = Ts);
2967
+ Tt(At, kt, Ut) === mi && (At = ks, kt = Us, Ut = Ts);
2941
2968
  const Cs = (u * t + _) * 3;
2942
2969
  c[Cs + 0] = At * h + 0.5, c[Cs + 1] = kt * h + 0.5, c[Cs + 2] = Ut * h + 0.5;
2943
2970
  }
2944
2971
  }
2945
- const fi = 0, pc = 1, uc = 2, _c = 3;
2946
- function yc(e, t) {
2972
+ const ui = 0, dc = 1, Mc = 2, mc = 3;
2973
+ function bc(e, t) {
2947
2974
  switch (t) {
2948
- case fi:
2975
+ case ui:
2949
2976
  return e !== 0;
2950
- case pc:
2977
+ case dc:
2951
2978
  return (e & 1) !== 0;
2952
- case uc:
2979
+ case Mc:
2953
2980
  return e > 0;
2954
- case _c:
2981
+ case mc:
2955
2982
  return e < 0;
2956
2983
  }
2957
2984
  return !1;
2958
2985
  }
2959
- class gc {
2986
+ class wc {
2960
2987
  constructor() {
2961
2988
  this._intersections = [], this._lastIndex = 0;
2962
2989
  }
@@ -3012,30 +3039,30 @@ class gc {
3012
3039
  * @returns True when filled.
3013
3040
  */
3014
3041
  filled(t, n) {
3015
- return yc(this.sumIntersections(t), n);
3042
+ return bc(this.sumIntersections(t), n);
3016
3043
  }
3017
3044
  }
3018
- const Bo = [0, 0, 0], Yo = [0, 0, 0];
3019
- function xc(e, t, n) {
3045
+ const Yo = [0, 0, 0], Ho = [0, 0, 0];
3046
+ function Ac(e, t, n) {
3020
3047
  const s = [];
3021
3048
  for (const o of e.contours)
3022
3049
  for (const i of o) {
3023
- const r = i.scanlineIntersections(t, Bo, Yo);
3050
+ const r = i.scanlineIntersections(t, Yo, Ho);
3024
3051
  for (let c = 0; c < r; c++)
3025
- s.push({ x: Bo[c], direction: Yo[c] });
3052
+ s.push({ x: Yo[c], direction: Ho[c] });
3026
3053
  }
3027
3054
  n.setIntersections(s);
3028
3055
  }
3029
- const an = 2, pi = 1, oe = 1.001, dc = 1.1111111111111112, rs = 0.01;
3030
- function Mc(e, t, n, s, o, i, r) {
3056
+ const an = 2, _i = 1, ie = 1.001, kc = 1.1111111111111112, rs = 0.01;
3057
+ function Uc(e, t, n, s, o, i, r) {
3031
3058
  if (n === 0 || s === 0) return;
3032
- const c = new gc(), a = new Int8Array(n * s);
3059
+ const c = new wc(), a = new Int8Array(n * s);
3033
3060
  for (let l = 0; l < s; l++) {
3034
3061
  const h = (l + 0.5) / o - r;
3035
- xc(t, h, c);
3062
+ Ac(t, h, c);
3036
3063
  for (let f = 0; f < n; f++) {
3037
- const p = (f + 0.5) / o - i, u = c.filled(p, fi), _ = (l * n + f) * 3, y = e[_], g = e[_ + 1], x = e[_ + 2], w = ft(y, g, x), M = l * n + f;
3038
- w === 0.5 ? a[M] = 0 : w > 0.5 !== u ? (e[_] = 1 - y, e[_ + 1] = 1 - g, e[_ + 2] = 1 - x, a[M] = -1) : a[M] = 1;
3064
+ const p = (f + 0.5) / o - i, u = c.filled(p, ui), _ = (l * n + f) * 3, y = e[_], g = e[_ + 1], x = e[_ + 2], b = ft(y, g, x), M = l * n + f;
3065
+ b === 0.5 ? a[M] = 0 : b > 0.5 !== u ? (e[_] = 1 - y, e[_ + 1] = 1 - g, e[_ + 2] = 1 - x, a[M] = -1) : a[M] = 1;
3039
3066
  }
3040
3067
  }
3041
3068
  for (let l = 0; l < s; l++)
@@ -3049,20 +3076,20 @@ function Mc(e, t, n, s, o, i, r) {
3049
3076
  }
3050
3077
  }
3051
3078
  }
3052
- const ie = [0, 0];
3053
- function mc(e, t, n, s, o, i, r, c) {
3079
+ const re = [0, 0];
3080
+ function Tc(e, t, n, s, o, i, r, c) {
3054
3081
  const a = new Uint8Array(n * s);
3055
- wc(a, t, n, s, o, i, r), bc(a, e, n, s, o, c), Tc(a, e, n, s, c, dc), Sc(a, e, n, s);
3082
+ Sc(a, t, n, s, o, i, r), Cc(a, e, n, s, o, c), Dc(a, e, n, s, c, kc), Rc(a, e, n, s);
3056
3083
  }
3057
- function wc(e, t, n, s, o, i, r) {
3084
+ function Sc(e, t, n, s, o, i, r) {
3058
3085
  for (const c of t.contours) {
3059
3086
  if (c.length === 0) continue;
3060
3087
  let a = c[c.length - 1];
3061
3088
  for (const l of c) {
3062
3089
  const h = a.color & l.color;
3063
3090
  if (!(h & h - 1)) {
3064
- l.point(0, ie);
3065
- const f = o * (ie[0] + i), p = o * (ie[1] + r), u = Math.floor(f - 0.5) | 0, _ = Math.floor(p - 0.5) | 0, y = u + 1, g = _ + 1;
3091
+ l.point(0, re);
3092
+ const f = o * (re[0] + i), p = o * (re[1] + r), u = Math.floor(f - 0.5) | 0, _ = Math.floor(p - 0.5) | 0, y = u + 1, g = _ + 1;
3066
3093
  u < n && _ < s && y >= 0 && g >= 0 && (u >= 0 && _ >= 0 && (e[_ * n + u] |= an), y < n && _ >= 0 && (e[_ * n + y] |= an), u >= 0 && g < s && (e[g * n + u] |= an), y < n && g < s && (e[g * n + y] |= an));
3067
3094
  }
3068
3095
  a = l;
@@ -3085,8 +3112,8 @@ function Kn(e, t, n) {
3085
3112
  function Yt(e, t, n, s, o, i) {
3086
3113
  (i & fs && n[s] !== o || i & ps && n[s + 1] !== o || i & us && n[s + 2] !== o) && (e[t] |= an);
3087
3114
  }
3088
- function bc(e, t, n, s, o, i) {
3089
- const r = oe / i, c = oe / i, a = oe * Math.SQRT2 / i;
3115
+ function Cc(e, t, n, s, o, i) {
3116
+ const r = ie / i, c = ie / i, a = ie * Math.SQRT2 / i;
3090
3117
  for (let l = 0; l < s; l++)
3091
3118
  for (let h = 0; h < n - 1; h++) {
3092
3119
  const f = (l * n + h) * 3, p = f + 3, u = ft(t[f], t[f + 1], t[f + 2]), _ = ft(t[p], t[p + 1], t[p + 2]);
@@ -3105,10 +3132,10 @@ function bc(e, t, n, s, o, i) {
3105
3132
  }
3106
3133
  for (let l = 0; l < s - 1; l++)
3107
3134
  for (let h = 0; h < n - 1; h++) {
3108
- const f = (l * n + h) * 3, p = (l * n + h + 1) * 3, u = ((l + 1) * n + h) * 3, _ = ((l + 1) * n + h + 1) * 3, y = ft(t[f], t[f + 1], t[f + 2]), g = ft(t[p], t[p + 1], t[p + 2]), x = ft(t[u], t[u + 1], t[u + 2]), w = ft(t[_], t[_ + 1], t[_ + 2]);
3109
- if (Math.abs(y - 0.5) + Math.abs(w - 0.5) < a) {
3135
+ const f = (l * n + h) * 3, p = (l * n + h + 1) * 3, u = ((l + 1) * n + h) * 3, _ = ((l + 1) * n + h + 1) * 3, y = ft(t[f], t[f + 1], t[f + 2]), g = ft(t[p], t[p + 1], t[p + 2]), x = ft(t[u], t[u + 1], t[u + 2]), b = ft(t[_], t[_ + 1], t[_ + 2]);
3136
+ if (Math.abs(y - 0.5) + Math.abs(b - 0.5) < a) {
3110
3137
  const M = Kn(t, f, _);
3111
- Yt(e, l * n + h, t, f, y, M), Yt(e, (l + 1) * n + h + 1, t, _, w, M);
3138
+ Yt(e, l * n + h, t, f, y, M), Yt(e, (l + 1) * n + h + 1, t, _, b, M);
3112
3139
  }
3113
3140
  if (Math.abs(g - 0.5) + Math.abs(x - 0.5) < a) {
3114
3141
  const M = Kn(t, p, u);
@@ -3116,36 +3143,36 @@ function bc(e, t, n, s, o, i) {
3116
3143
  }
3117
3144
  }
3118
3145
  }
3119
- function Ac(e, t, n) {
3146
+ function vc(e, t, n) {
3120
3147
  const s = t < e ? t : e, o = e < t ? t : e, i = n < o ? n : o;
3121
3148
  return s < i ? i : s;
3122
3149
  }
3123
- function kc(e, t, n, s) {
3150
+ function Ec(e, t, n, s) {
3124
3151
  return ft(
3125
3152
  e[t] + s * (e[n] - e[t]),
3126
3153
  e[t + 1] + s * (e[n + 1] - e[t + 1]),
3127
3154
  e[t + 2] + s * (e[n + 2] - e[t + 2])
3128
3155
  );
3129
3156
  }
3130
- function ge(e, t, n, s) {
3131
- return Ac(
3157
+ function xe(e, t, n, s) {
3158
+ return vc(
3132
3159
  Math.fround(s * (s * n[0] + t[0]) + e[0]),
3133
3160
  Math.fround(s * (s * n[1] + t[1]) + e[1]),
3134
3161
  Math.fround(s * (s * n[2] + t[2]) + e[2])
3135
3162
  );
3136
3163
  }
3137
- const Jt = [0, 0, 0], Et = [0, 0, 0], re = [0, 0, 0], Mt = [0, 0, 0], Ho = 1, ui = 2;
3138
- function Ae(e, t, n, s, o, i, r, c) {
3139
- if (s > 0.5 && o > 0.5 && i <= 0.5 || s < 0.5 && o < 0.5 && i >= 0.5 || !c && Uc(s, o, i) !== i) {
3164
+ const Jt = [0, 0, 0], Et = [0, 0, 0], ce = [0, 0, 0], Mt = [0, 0, 0], Xo = 1, yi = 2;
3165
+ function ke(e, t, n, s, o, i, r, c) {
3166
+ if (s > 0.5 && o > 0.5 && i <= 0.5 || s < 0.5 && o < 0.5 && i >= 0.5 || !c && Ic(s, o, i) !== i) {
3140
3167
  const a = (n - e) * r, l = (t - n) * r;
3141
- return i >= s - a && i <= s + a && i >= o - l && i <= o + l ? Ho : Ho | ui;
3168
+ return i >= s - a && i <= s + a && i >= o - l && i <= o + l ? Xo : Xo | yi;
3142
3169
  }
3143
3170
  return 0;
3144
3171
  }
3145
- function _i(e) {
3146
- return (e & ui) !== 0;
3172
+ function gi(e) {
3173
+ return (e & yi) !== 0;
3147
3174
  }
3148
- function Uc(e, t, n) {
3175
+ function Ic(e, t, n) {
3149
3176
  return Math.max(Math.min(e, t), Math.min(Math.max(e, t), n));
3150
3177
  }
3151
3178
  function jn(e, t, n, s, o, i) {
@@ -3156,40 +3183,40 @@ function jn(e, t, n, s, o, i) {
3156
3183
  if (h === 0) continue;
3157
3184
  const f = a / h;
3158
3185
  if (f > rs && f < 1 - rs) {
3159
- const p = kc(e, t, n, f), u = Ae(0, 1, f, s, r, p, o, i);
3160
- if (_i(u)) return !0;
3186
+ const p = Ec(e, t, n, f), u = ke(0, 1, f, s, r, p, o, i);
3187
+ if (gi(u)) return !0;
3161
3188
  }
3162
3189
  }
3163
3190
  return !1;
3164
3191
  }
3165
- function Xo(e, t, n, s, o, i, r, c, a) {
3192
+ function Ko(e, t, n, s, o, i, r, c, a) {
3166
3193
  if (!(a > 0 && a < 1)) return 0;
3167
3194
  const l = a > r ? 0 : a, h = a > r ? a : 1;
3168
3195
  Mt[0] = e[t], Mt[1] = e[t + 1], Mt[2] = e[t + 2];
3169
- const f = a > r ? n : ge(Mt, Jt, Et, a);
3196
+ const f = a > r ? n : xe(Mt, Jt, Et, a);
3170
3197
  Mt[0] = e[t], Mt[1] = e[t + 1], Mt[2] = e[t + 2];
3171
- const p = a > r ? ge(Mt, Jt, Et, a) : s;
3172
- return Ae(l, h, r, f, p, c, o, i);
3198
+ const p = a > r ? xe(Mt, Jt, Et, a) : s;
3199
+ return ke(l, h, r, f, p, c, o, i);
3173
3200
  }
3174
3201
  function Vn(e, t, n, s, o, i, r, c, a) {
3175
3202
  if (!(r > rs && r < 1 - rs)) return !1;
3176
3203
  Mt[0] = e[t], Mt[1] = e[t + 1], Mt[2] = e[t + 2];
3177
- const l = ge(Mt, Jt, Et, r);
3178
- let h = Ae(0, 1, r, n, s, l, o, i);
3179
- return h |= Xo(e, t, n, s, o, i, r, l, c), h |= Xo(e, t, n, s, o, i, r, l, a), _i(h);
3204
+ const l = xe(Mt, Jt, Et, r);
3205
+ let h = ke(0, 1, r, n, s, l, o, i);
3206
+ return h |= Ko(e, t, n, s, o, i, r, l, c), h |= Ko(e, t, n, s, o, i, r, l, a), gi(h);
3180
3207
  }
3181
- function ce(e, t, n, s, o, i, r, c, a, l, h, f, p) {
3208
+ function ae(e, t, n, s, o, i, r, c, a, l, h, f, p) {
3182
3209
  const u = Math.fround(e[t + l] - e[t + h]), _ = Math.fround(
3183
3210
  Math.fround(e[n + l] - e[n + h]) + Math.fround(e[s + l] - e[s + h])
3184
- ), y = Math.fround(e[o + l] - e[o + h]), g = Math.fround(Math.fround(y - _) + u), x = Math.fround(Math.fround(_ - u) - u), w = u;
3211
+ ), y = Math.fround(e[o + l] - e[o + h]), g = Math.fround(Math.fround(y - _) + u), x = Math.fround(Math.fround(_ - u) - u), b = u;
3185
3212
  if (g === 0 || Math.abs(x) > 1e12 * Math.abs(g)) {
3186
3213
  if (x !== 0) {
3187
- const A = -w / x;
3214
+ const A = -b / x;
3188
3215
  if (Vn(e, t, i, r, c, a, A, f, p)) return !0;
3189
3216
  }
3190
3217
  return !1;
3191
3218
  }
3192
- const M = x * x - 4 * g * w;
3219
+ const M = x * x - 4 * g * b;
3193
3220
  if (M > 0) {
3194
3221
  const A = Math.sqrt(M), k = (-x + A) / (2 * g);
3195
3222
  if (Vn(e, t, i, r, c, a, k, f, p)) return !0;
@@ -3205,11 +3232,11 @@ function Wn(e, t, n, s, o, i, r, c) {
3205
3232
  const a = ft(e[o], e[o + 1], e[o + 2]);
3206
3233
  if (Math.abs(i - 0.5) < Math.abs(a - 0.5)) return !1;
3207
3234
  for (let p = 0; p < 3; p++)
3208
- re[p] = Math.fround(
3235
+ ce[p] = Math.fround(
3209
3236
  Math.fround(e[t + p] - e[n + p]) - e[s + p]
3210
- ), Jt[p] = Math.fround(-e[t + p] - re[p]), Et[p] = Math.fround(e[o + p] + re[p]);
3237
+ ), Jt[p] = Math.fround(-e[t + p] - ce[p]), Et[p] = Math.fround(e[o + p] + ce[p]);
3211
3238
  const l = Et[0] !== 0 ? -0.5 * Jt[0] / Et[0] : -1, h = Et[1] !== 0 ? -0.5 * Jt[1] / Et[1] : -1, f = Et[2] !== 0 ? -0.5 * Jt[2] / Et[2] : -1;
3212
- return !!(ce(
3239
+ return !!(ae(
3213
3240
  e,
3214
3241
  t,
3215
3242
  n,
@@ -3223,7 +3250,7 @@ function Wn(e, t, n, s, o, i, r, c) {
3223
3250
  1,
3224
3251
  l,
3225
3252
  h
3226
- ) || ce(
3253
+ ) || ae(
3227
3254
  e,
3228
3255
  t,
3229
3256
  n,
@@ -3237,7 +3264,7 @@ function Wn(e, t, n, s, o, i, r, c) {
3237
3264
  2,
3238
3265
  h,
3239
3266
  f
3240
- ) || ce(
3267
+ ) || ae(
3241
3268
  e,
3242
3269
  t,
3243
3270
  n,
@@ -3253,35 +3280,35 @@ function Wn(e, t, n, s, o, i, r, c) {
3253
3280
  l
3254
3281
  ));
3255
3282
  }
3256
- function Tc(e, t, n, s, o, i) {
3283
+ function Dc(e, t, n, s, o, i) {
3257
3284
  const r = i / o, c = i / o, a = i * Math.SQRT2 / o;
3258
3285
  for (let l = 0; l < s; l++)
3259
3286
  for (let h = 0; h < n; h++) {
3260
- const f = l * n + h, p = f * 3, u = ft(t[p], t[p + 1], t[p + 2]), _ = (e[f] & an) !== 0, y = h > 0, g = h < n - 1, x = l > 0, w = l < s - 1, M = y ? (f - 1) * 3 : -1, A = g ? (f + 1) * 3 : -1, k = x ? (f - n) * 3 : -1, T = w ? (f + n) * 3 : -1;
3287
+ const f = l * n + h, p = f * 3, u = ft(t[p], t[p + 1], t[p + 2]), _ = (e[f] & an) !== 0, y = h > 0, g = h < n - 1, x = l > 0, b = l < s - 1, M = y ? (f - 1) * 3 : -1, A = g ? (f + 1) * 3 : -1, k = x ? (f - n) * 3 : -1, T = b ? (f + n) * 3 : -1;
3261
3288
  let S = !1;
3262
- if (y && jn(t, p, M, u, r, _) && (S = !0), !S && x && jn(t, p, k, u, c, _) && (S = !0), !S && g && jn(t, p, A, u, r, _) && (S = !0), !S && w && jn(t, p, T, u, c, _) && (S = !0), !S && y && x) {
3263
- const b = (f - n - 1) * 3;
3264
- Wn(t, p, M, k, b, u, a, _) && (S = !0);
3289
+ if (y && jn(t, p, M, u, r, _) && (S = !0), !S && x && jn(t, p, k, u, c, _) && (S = !0), !S && g && jn(t, p, A, u, r, _) && (S = !0), !S && b && jn(t, p, T, u, c, _) && (S = !0), !S && y && x) {
3290
+ const w = (f - n - 1) * 3;
3291
+ Wn(t, p, M, k, w, u, a, _) && (S = !0);
3265
3292
  }
3266
3293
  if (!S && g && x) {
3267
- const b = (f - n + 1) * 3;
3268
- Wn(t, p, A, k, b, u, a, _) && (S = !0);
3294
+ const w = (f - n + 1) * 3;
3295
+ Wn(t, p, A, k, w, u, a, _) && (S = !0);
3269
3296
  }
3270
- if (!S && y && w) {
3271
- const b = (f + n - 1) * 3;
3272
- Wn(t, p, M, T, b, u, a, _) && (S = !0);
3297
+ if (!S && y && b) {
3298
+ const w = (f + n - 1) * 3;
3299
+ Wn(t, p, M, T, w, u, a, _) && (S = !0);
3273
3300
  }
3274
- if (!S && g && w) {
3275
- const b = (f + n + 1) * 3;
3276
- Wn(t, p, A, T, b, u, a, _) && (S = !0);
3301
+ if (!S && g && b) {
3302
+ const w = (f + n + 1) * 3;
3303
+ Wn(t, p, A, T, w, u, a, _) && (S = !0);
3277
3304
  }
3278
- S && (e[f] |= pi);
3305
+ S && (e[f] |= _i);
3279
3306
  }
3280
3307
  }
3281
- function Sc(e, t, n, s) {
3308
+ function Rc(e, t, n, s) {
3282
3309
  const o = n * s;
3283
3310
  for (let i = 0; i < o; i++)
3284
- if (e[i] & pi) {
3311
+ if (e[i] & _i) {
3285
3312
  const r = i * 3, c = ft(t[r], t[r + 1], t[r + 2]);
3286
3313
  t[r] = c, t[r + 1] = c, t[r + 2] = c;
3287
3314
  }
@@ -3289,13 +3316,13 @@ function Sc(e, t, n, s) {
3289
3316
  function ft(e, t, n) {
3290
3317
  return Math.max(Math.min(e, t), Math.min(Math.max(e, t), n));
3291
3318
  }
3292
- const Cc = 3, vc = 0n, Ko = 16;
3293
- function Ec(e, t, n, s = !0) {
3294
- if (s && Qr(e), e.contours.length === 0) return null;
3319
+ const Lc = 3, Pc = 0n, jo = 16;
3320
+ function Fc(e, t, n, s = !0) {
3321
+ if (s && oc(e), e.contours.length === 0) return null;
3295
3322
  const o = cs(e), i = t, r = n, c = Math.max(1, Math.ceil((o.maxX - o.minX) * i)) + 2 * r, a = Math.max(1, Math.ceil((o.maxY - o.minY) * i)) + 2 * r, l = r / i - o.minX, h = r / i - o.minY;
3296
- Nr(e), ac(e, Cc, vc);
3323
+ Br(e), _c(e, Lc, Pc);
3297
3324
  const f = new Float32Array(c * a * 3);
3298
- return fc(e, c, a, i, l, h, r, f), Mc(f, e, c, a, i, l, h), mc(f, e, c, a, i, l, h, r), {
3325
+ return xc(e, c, a, i, l, h, r, f), Uc(f, e, c, a, i, l, h), Tc(f, e, c, a, i, l, h, r), {
3299
3326
  msdf: f,
3300
3327
  w: c,
3301
3328
  h: a,
@@ -3305,14 +3332,14 @@ function Ec(e, t, n, s = !0) {
3305
3332
  planeTop: a / i - h
3306
3333
  };
3307
3334
  }
3308
- const ae = [0, 0];
3335
+ const le = [0, 0];
3309
3336
  function cs(e) {
3310
3337
  let t = 1 / 0, n = 1 / 0, s = -1 / 0, o = -1 / 0;
3311
3338
  for (const i of e.contours)
3312
3339
  for (const r of i)
3313
- for (let c = 0; c <= Ko; c++) {
3314
- r.point(c / Ko, ae);
3315
- const a = ae[0], l = ae[1];
3340
+ for (let c = 0; c <= jo; c++) {
3341
+ r.point(c / jo, le);
3342
+ const a = le[0], l = le[1];
3316
3343
  a < t && (t = a), l < n && (n = l), a > s && (s = a), l > o && (o = l);
3317
3344
  }
3318
3345
  return { minX: t, minY: n, maxX: s, maxY: o };
@@ -3339,11 +3366,11 @@ function ls(e, t) {
3339
3366
  function Qt(e, t) {
3340
3367
  return e === void 0 ? 0 : parseFloat(e) * (e.trim().endsWith("%") ? t / 100 : 1);
3341
3368
  }
3342
- function Gc(e) {
3343
- const { layers: t, width: n } = Ic(e);
3344
- return { shape: { contours: t.flatMap((o) => o.shape.contours), inverseYAxis: !1 }, width: n };
3369
+ function Xc(e) {
3370
+ const { layers: t, width: n } = qc(e);
3371
+ return { shape: { contours: t.flatMap((o) => (Kr(o.shape.contours), o.shape.contours)), inverseYAxis: !1 }, width: n };
3345
3372
  }
3346
- function Ic(e) {
3373
+ function qc(e) {
3347
3374
  var k, T;
3348
3375
  e = e.replace(/<!--[\s\S]*?-->/g, "");
3349
3376
  const t = ((k = /<svg\b[^>]*>/.exec(e)) == null ? void 0 : k[0]) ?? "", n = (Z(t, "viewBox") ?? `0 0 ${Z(t, "width")} ${Z(t, "height")}`).trim().split(/[\s,]+/).map(parseFloat), [s = 0, o = 0, i = NaN, r = NaN] = n;
@@ -3351,26 +3378,26 @@ function Ic(e) {
3351
3378
  const c = [i, r], a = [r, 0, 0, -r, s, o + r], l = [1, 0, 0, -1, -s, o + r], h = i / r, f = [];
3352
3379
  i > 0 && hs(`M${s} ${o}h${i}v${r}h${-i}z`, l, f), ns({ contours: f }, r);
3353
3380
  const p = /* @__PURE__ */ new Map(), u = /<(linear|radial)Gradient\b([^>]*?)(?:\/>|>([\s\S]*?)<\/\1Gradient>)/g;
3354
- for (const [, S = "", b = "", m = ""] of e.matchAll(u))
3355
- p.set(Z(b, "id") ?? "", [S, b, m]);
3381
+ for (const [, S = "", w = "", m = ""] of e.matchAll(u))
3382
+ p.set(Z(w, "id") ?? "", [S, w, m]);
3356
3383
  const _ = /* @__PURE__ */ new Map();
3357
- for (const [, S = "", b = ""] of e.matchAll(
3384
+ for (const [, S = "", w = ""] of e.matchAll(
3358
3385
  /<clipPath\b([^>]*?)(?:\/>|>([\s\S]*?)<\/clipPath>)/g
3359
3386
  ))
3360
- _.set(Z(S, "id") ?? "", [S, b]);
3387
+ _.set(Z(S, "id") ?? "", [S, w]);
3361
3388
  const y = /* @__PURE__ */ new Map();
3362
- for (const [, S = "", b = ""] of e.matchAll(yi)) {
3363
- const m = Z(b, "id");
3364
- m !== void 0 && y.set(m, [S, b]);
3389
+ for (const [, S = "", w = ""] of e.matchAll(xi)) {
3390
+ const m = Z(w, "id");
3391
+ m !== void 0 && y.set(m, [S, w]);
3365
3392
  }
3366
3393
  const g = [];
3367
3394
  for (const [, S = ""] of e.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/g))
3368
- for (const [, b = "", m = ""] of S.matchAll(/([^{}]+)\{([^}]*)\}/g))
3369
- for (const d of b.split(",")) {
3395
+ for (const [, w = "", m = ""] of S.matchAll(/([^{}]+)\{([^}]*)\}/g))
3396
+ for (const d of w.split(",")) {
3370
3397
  const U = (T = /^\s*\.([\w-]+)\s*$/.exec(d)) == null ? void 0 : T[1];
3371
3398
  U && g.push([U, m]);
3372
3399
  }
3373
- const x = [], w = [], M = [
3400
+ const x = [], b = [], M = [
3374
3401
  {
3375
3402
  m: [1, 0, 0, 1, 0, 0],
3376
3403
  fill: "black",
@@ -3384,10 +3411,10 @@ function Ic(e) {
3384
3411
  }
3385
3412
  ];
3386
3413
  let A = 0;
3387
- for (const [, S, b = "", m = "", d] of e.matchAll(
3414
+ for (const [, S, w = "", m = "", d] of e.matchAll(
3388
3415
  /<(\/?)([\w:-]+)([^>]*?)(\/?)>/g
3389
3416
  )) {
3390
- if (A > 0 || /^(defs|clipPath|mask|symbol|pattern|marker|style)$/.test(b)) {
3417
+ if (A > 0 || /^(defs|clipPath|mask|symbol|pattern|marker|style)$/.test(w)) {
3391
3418
  S ? A-- : d || A++;
3392
3419
  continue;
3393
3420
  }
@@ -3395,8 +3422,8 @@ function Ic(e) {
3395
3422
  M.pop();
3396
3423
  continue;
3397
3424
  }
3398
- const U = M[M.length - 1], v = (pt) => as(m, pt, g), C = ls(v("opacity"), 1), I = gi(b, m, c), R = {
3399
- m: wt(U.m, Sn(Z(m, "transform") ?? "")),
3425
+ const U = M[M.length - 1], v = (pt) => as(m, pt, g), C = ls(v("opacity"), 1), I = di(w, m, c), R = {
3426
+ m: bt(U.m, Sn(Z(m, "transform") ?? "")),
3400
3427
  fill: v("fill") ?? U.fill,
3401
3428
  rule: v("fill-rule") ?? U.rule,
3402
3429
  fillOpacity: ls(v("fill-opacity"), U.fillOpacity),
@@ -3404,69 +3431,69 @@ function Ic(e) {
3404
3431
  clips: U.clips,
3405
3432
  group: U.group
3406
3433
  };
3407
- I === void 0 && C < 1 && !d && (R.group = w.push({ members: [], parent: U.group, translucent: !1 }) - 1);
3408
- const G = _.get(jo(v("clip-path")));
3409
- if (G && Z(G[0], "clipPathUnits") !== "objectBoundingBox" && (R.clips = [...U.clips, Dc(G, y, g, wt(l, R.m), c)]), d || M.push(R), I === void 0 || R.fill === "none") continue;
3434
+ I === void 0 && C < 1 && !d && (R.group = b.push({ members: [], parent: U.group, translucent: !1 }) - 1);
3435
+ const G = _.get(Vo(v("clip-path")));
3436
+ if (G && Z(G[0], "clipPathUnits") !== "objectBoundingBox" && (R.clips = [...U.clips, Oc(G, y, g, bt(l, R.m), c)]), d || M.push(R), I === void 0 || R.fill === "none") continue;
3410
3437
  const F = [];
3411
- hs(I, wt(l, R.m), F), R.rule === "evenodd" && li(F);
3438
+ hs(I, bt(l, R.m), F), R.rule === "evenodd" && hi(F);
3412
3439
  const X = { contours: F, inverseYAxis: !1 };
3413
3440
  ns(X, r);
3414
- const H = p.get(jo(R.fill)), K = wt(xi(R.m), a), tt = H ? Rc(H, p, g, K, I, c) : null;
3415
- for (const pt of R.clips) qo(X, pt);
3441
+ const H = p.get(Vo(R.fill)), K = bt(Mi(R.m), a), nt = H ? Gc(H, p, g, K, I, c) : null;
3442
+ for (const pt of R.clips) Oo(X, pt);
3416
3443
  const z = cs(X);
3417
- if (!(z.maxX <= 0 || z.minX >= h || z.maxY <= 0 || z.minY >= 1 || ((z.minX < 0 || z.minY < 0 || z.maxX > h || z.maxY > 1) && f.length > 0 && qo(X, [f]), X.contours.length === 0))) {
3444
+ if (!(z.maxX <= 0 || z.minX >= h || z.maxY <= 0 || z.minY >= 1 || ((z.minX < 0 || z.minY < 0 || z.maxX > h || z.maxY > 1) && f.length > 0 && Oo(X, [f]), X.contours.length === 0))) {
3418
3445
  if (R.group >= 0) {
3419
- const pt = w[R.group];
3446
+ const pt = b[R.group];
3420
3447
  pt.members.push(x.length);
3421
- const Nt = tt ? tt.stops.some((Pt) => Pt.opacity < 1) : !1;
3448
+ const Nt = nt ? nt.stops.some((Pt) => Pt.opacity < 1) : !1;
3422
3449
  (C < 1 || R.fillOpacity < 1 || Nt) && (pt.translucent = !0);
3423
- for (let Pt = pt.parent; Pt >= 0; Pt = w[Pt].parent) w[Pt].translucent = !0;
3450
+ for (let Pt = pt.parent; Pt >= 0; Pt = b[Pt].parent) b[Pt].translucent = !0;
3424
3451
  }
3425
3452
  x.push({
3426
3453
  shape: X,
3427
3454
  color: R.fill,
3428
3455
  opacity: R.opacity * R.fillOpacity,
3429
- gradient: tt
3456
+ gradient: nt
3430
3457
  });
3431
3458
  }
3432
3459
  }
3433
- for (const S of w) {
3460
+ for (const S of b) {
3434
3461
  if (S.translucent || S.members.length < 2) continue;
3435
- const b = S.members.map((m) => cs(x[m].shape));
3462
+ const w = S.members.map((m) => cs(x[m].shape));
3436
3463
  for (let m = 0; m < S.members.length - 1; m++) {
3437
- const d = b[m], U = [];
3464
+ const d = w[m], U = [];
3438
3465
  for (let v = m + 1; v < S.members.length; v++) {
3439
- const C = b[v];
3466
+ const C = w[v];
3440
3467
  C.minX < d.maxX && d.minX < C.maxX && C.minY < d.maxY && d.minY < C.maxY && U.push(x[S.members[v]].shape.contours);
3441
3468
  }
3442
- Jr(x[S.members[m]].shape, U);
3469
+ ic(x[S.members[m]].shape, U);
3443
3470
  }
3444
3471
  }
3445
3472
  return { layers: x.filter((S) => S.shape.contours.length > 0), width: i / r };
3446
3473
  }
3447
- const yi = /<([\w:-]+)\b([^>]*?)\/?>/g;
3448
- function jo(e) {
3474
+ const xi = /<([\w:-]+)\b([^>]*?)\/?>/g;
3475
+ function Vo(e) {
3449
3476
  var t;
3450
3477
  return ((t = /url\(\s*['"]?#([^)'"\s]+)/.exec(e ?? "")) == null ? void 0 : t[1]) ?? "";
3451
3478
  }
3452
- function Dc([e = "", t = ""], n, s, o, i) {
3479
+ function Oc([e = "", t = ""], n, s, o, i) {
3453
3480
  var h;
3454
- const [r = 0, c = 1] = i, a = [], l = wt(o, Sn(Z(e, "transform") ?? ""));
3455
- for (const [, f = "", p = ""] of t.matchAll(yi)) {
3456
- let u = [f, p], _ = wt(l, Sn(Z(p, "transform") ?? ""));
3481
+ const [r = 0, c = 1] = i, a = [], l = bt(o, Sn(Z(e, "transform") ?? ""));
3482
+ for (const [, f = "", p = ""] of t.matchAll(xi)) {
3483
+ let u = [f, p], _ = bt(l, Sn(Z(p, "transform") ?? ""));
3457
3484
  if (f === "use") {
3458
- const w = n.get(((h = Z(p, "(?:xlink:)?href")) == null ? void 0 : h.slice(1)) ?? "");
3459
- if (!w) continue;
3460
- _ = wt(_, [1, 0, 0, 1, Qt(Z(p, "x"), r), Qt(Z(p, "y"), c)]), _ = wt(_, Sn(Z(w[1], "transform") ?? "")), u = w;
3485
+ const b = n.get(((h = Z(p, "(?:xlink:)?href")) == null ? void 0 : h.slice(1)) ?? "");
3486
+ if (!b) continue;
3487
+ _ = bt(_, [1, 0, 0, 1, Qt(Z(p, "x"), r), Qt(Z(p, "y"), c)]), _ = bt(_, Sn(Z(b[1], "transform") ?? "")), u = b;
3461
3488
  }
3462
- const y = gi(u[0], u[1], i);
3489
+ const y = di(u[0], u[1], i);
3463
3490
  if (y === void 0) continue;
3464
3491
  const g = [];
3465
- hs(y, _, g), [u[1], p, e].map((w) => as(w, "clip-rule", s)).find(Boolean) === "evenodd" && li(g), ns({ contours: g }, c), a.push(g);
3492
+ hs(y, _, g), [u[1], p, e].map((b) => as(b, "clip-rule", s)).find(Boolean) === "evenodd" && hi(g), ns({ contours: g }, c), a.push(g);
3466
3493
  }
3467
3494
  return a;
3468
3495
  }
3469
- function gi(e, t, [n = 0, s = 0]) {
3496
+ function di(e, t, [n = 0, s = 0]) {
3470
3497
  const o = (p, u) => Qt(Z(t, p), u), [i, r, c, a] = [o("x", n), o("y", s), o("width", n), o("height", s)], [l, h, f] = [o("cx", n), o("cy", s), Math.hypot(n, s) / Math.SQRT2];
3471
3498
  switch (e) {
3472
3499
  case "path":
@@ -3487,7 +3514,7 @@ function gi(e, t, [n = 0, s = 0]) {
3487
3514
  return;
3488
3515
  }
3489
3516
  }
3490
- function Rc(e, t, n, s, o, [i = 0, r = 0]) {
3517
+ function Gc(e, t, n, s, o, [i = 0, r = 0]) {
3491
3518
  var m;
3492
3519
  const c = [];
3493
3520
  for (let d = e; d && !c.includes(d); )
@@ -3501,16 +3528,16 @@ function Rc(e, t, n, s, o, [i = 0, r = 0]) {
3501
3528
  const d = [];
3502
3529
  hs(o, [1, 0, 0, 1, 0, 0], d);
3503
3530
  const U = cs({ contours: d });
3504
- f = wt([U.maxX - U.minX, 0, 0, U.maxY - U.minY, U.minX, U.minY], f);
3531
+ f = bt([U.maxX - U.minX, 0, 0, U.maxY - U.minY, U.minX, U.minY], f);
3505
3532
  }
3506
- const p = e[0] === "radial", [u, _] = [h("x1", "0%", i), h("y1", "0%", r)], [y, g] = [h("x2", "100%", i) - u, h("y2", "0%", r) - _], x = Math.hypot(i, r) / Math.SQRT2, [w, M, A] = [h("cx", "50%", i), h("cy", "50%", r), h("r", "50%", x)], k = y * y + g * g || 1, T = p ? [1 / A, 0, 0, 1 / A, -w / A, -M / A] : [y / k, 0, g / k, 0, -(u * y + _ * g) / k, 0], b = [...(c.map((d) => d[2] ?? "").find((d) => /<stop\b/.test(d)) ?? "").matchAll(/<stop\b[^>]*>/g)].map(([d]) => ({
3533
+ const p = e[0] === "radial", [u, _] = [h("x1", "0%", i), h("y1", "0%", r)], [y, g] = [h("x2", "100%", i) - u, h("y2", "0%", r) - _], x = Math.hypot(i, r) / Math.SQRT2, [b, M, A] = [h("cx", "50%", i), h("cy", "50%", r), h("r", "50%", x)], k = y * y + g * g || 1, T = p ? [1 / A, 0, 0, 1 / A, -b / A, -M / A] : [y / k, 0, g / k, 0, -(u * y + _ * g) / k, 0], w = [...(c.map((d) => d[2] ?? "").find((d) => /<stop\b/.test(d)) ?? "").matchAll(/<stop\b[^>]*>/g)].map(([d]) => ({
3507
3534
  offset: ls(Z(d, "offset"), 0),
3508
3535
  color: as(d, "stop-color", n) ?? "black",
3509
3536
  opacity: ls(as(d, "stop-opacity", n), 1)
3510
3537
  }));
3511
- return { radial: p, matrix: wt(T, wt(xi(f), s)), stops: b };
3538
+ return { radial: p, matrix: bt(T, bt(Mi(f), s)), stops: w };
3512
3539
  }
3513
- function wt(e, t) {
3540
+ function bt(e, t) {
3514
3541
  const [n = 0, s = 0, o = 0, i = 0, r = 0, c = 0] = e, [a = 0, l = 0, h = 0, f = 0, p = 0, u = 0] = t;
3515
3542
  return [
3516
3543
  n * a + o * l,
@@ -3521,10 +3548,10 @@ function wt(e, t) {
3521
3548
  s * p + i * u + c
3522
3549
  ];
3523
3550
  }
3524
- function Lc([e = 0, t = 0, n = 0, s = 0, o = 0, i = 0], r, c) {
3551
+ function Nc([e = 0, t = 0, n = 0, s = 0, o = 0, i = 0], r, c) {
3525
3552
  return [e * r + n * c + o, t * r + s * c + i];
3526
3553
  }
3527
- function xi([e = 0, t = 0, n = 0, s = 0, o = 0, i = 0]) {
3554
+ function Mi([e = 0, t = 0, n = 0, s = 0, o = 0, i = 0]) {
3528
3555
  const r = e * s - t * n;
3529
3556
  return [s / r, -t / r, -n / r, e / r, (n * i - s * o) / r, (t * o - e * i) / r];
3530
3557
  }
@@ -3532,7 +3559,7 @@ function Sn(e) {
3532
3559
  let t = [1, 0, 0, 1, 0, 0];
3533
3560
  for (const [, n, s = ""] of e.matchAll(/(\w+)\s*\(([^)]*)\)/g)) {
3534
3561
  const [o = 0, i, r, c = 0, a = 0, l = 0] = s.trim().split(/[\s,]+/).map(parseFloat), h = o * Math.PI / 180, [f, p] = [Math.cos(h), Math.sin(h)], [u, _] = [i ?? 0, r ?? 0];
3535
- t = wt(
3562
+ t = bt(
3536
3563
  t,
3537
3564
  n === "matrix" ? [o, i ?? 0, r ?? 0, c, a, l] : n === "translate" ? [1, 0, 0, 1, o, i ?? 0] : n === "scale" ? [o, 0, 0, i ?? o, 0, 0] : n === "rotate" ? [f, p, -p, f, u - f * u + p * _, _ - p * u - f * _] : n === "skewX" ? [1, 0, Math.tan(h), 1, 0, 0] : [1, Math.tan(h), 0, 1, 0, 0]
3538
3565
  // skewY
@@ -3540,57 +3567,57 @@ function Sn(e) {
3540
3567
  }
3541
3568
  return t;
3542
3569
  }
3543
- const le = /[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/y;
3570
+ const he = /[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/y;
3544
3571
  function hs(e, t, n) {
3545
3572
  let s = 0, o = 0, i = 0, r = 0, c = 0, a = 0, l = 0, h = "", f = "", p = [];
3546
3573
  const u = () => {
3547
3574
  for (; s < e.length && ` \r
3548
3575
  ,`.includes(e[s]); ) s++;
3549
3576
  }, _ = () => {
3550
- u(), le.lastIndex = s;
3551
- const w = le.exec(e);
3552
- if (!w) throw new Error(`parseSvg: expected a number at ${s} in path "${e}"`);
3553
- return s = le.lastIndex, parseFloat(w[0]);
3554
- }, y = () => (u(), e[s++] === "1" ? 1 : 0), g = (w, ...M) => {
3577
+ u(), he.lastIndex = s;
3578
+ const b = he.exec(e);
3579
+ if (!b) throw new Error(`parseSvg: expected a number at ${s} in path "${e}"`);
3580
+ return s = he.lastIndex, parseFloat(b[0]);
3581
+ }, y = () => (u(), e[s++] === "1" ? 1 : 0), g = (b, ...M) => {
3555
3582
  const A = [o, i, ...M], k = [];
3556
- for (let I = 0; I < A.length; I += 2) k.push(...Lc(t, A[I], A[I + 1]));
3557
- const [T = 0, S = 0, b = 0, m = 0, d = 0, U = 0, v = 0, C = 0] = k;
3558
- p.push(new et(w, T, S, b, m, d, U, v, C)), o = M[M.length - 2], i = M[M.length - 1];
3583
+ for (let I = 0; I < A.length; I += 2) k.push(...Nc(t, A[I], A[I + 1]));
3584
+ const [T = 0, S = 0, w = 0, m = 0, d = 0, U = 0, v = 0, C = 0] = k;
3585
+ p.push(new et(b, T, S, w, m, d, U, v, C)), o = M[M.length - 2], i = M[M.length - 1];
3559
3586
  }, x = () => {
3560
- p.length > 0 && ((o !== r || i !== c) && g(st, r, c), n.push(p), p = []), o = r, i = c;
3587
+ p.length > 0 && ((o !== r || i !== c) && g(tt, r, c), n.push(p), p = []), o = r, i = c;
3561
3588
  };
3562
3589
  for (u(); s < e.length; u()) {
3563
3590
  if (/[a-zA-Z]/.test(e[s])) h = e[s++];
3564
3591
  else if (!h) throw new Error(`parseSvg: expected a command at ${s} in path "${e}"`);
3565
- const w = h.toUpperCase(), M = h === w ? 0 : o, A = h === w ? 0 : i, k = w === "S" && "CS".includes(f) || w === "T" && "QT".includes(f), T = k ? 2 * o - a : o, S = k ? 2 * i - l : i;
3566
- switch (w) {
3592
+ const b = h.toUpperCase(), M = h === b ? 0 : o, A = h === b ? 0 : i, k = b === "S" && "CS".includes(f) || b === "T" && "QT".includes(f), T = k ? 2 * o - a : o, S = k ? 2 * i - l : i;
3593
+ switch (b) {
3567
3594
  case "M": {
3568
- const b = M + _(), m = A + _();
3569
- x(), o = r = b, i = c = m, h = h === "M" ? "L" : "l";
3595
+ const w = M + _(), m = A + _();
3596
+ x(), o = r = w, i = c = m, h = h === "M" ? "L" : "l";
3570
3597
  break;
3571
3598
  }
3572
3599
  case "L":
3573
- g(st, M + _(), A + _());
3600
+ g(tt, M + _(), A + _());
3574
3601
  break;
3575
3602
  case "H":
3576
- g(st, M + _(), i);
3603
+ g(tt, M + _(), i);
3577
3604
  break;
3578
3605
  case "V":
3579
- g(st, o, A + _());
3606
+ g(tt, o, A + _());
3580
3607
  break;
3581
3608
  case "C":
3582
3609
  case "S": {
3583
- const b = w === "C" ? M + _() : T, m = w === "C" ? A + _() : S;
3584
- a = M + _(), l = A + _(), g(Gt, b, m, a, l, M + _(), A + _());
3610
+ const w = b === "C" ? M + _() : T, m = b === "C" ? A + _() : S;
3611
+ a = M + _(), l = A + _(), g(Gt, w, m, a, l, M + _(), A + _());
3585
3612
  break;
3586
3613
  }
3587
3614
  case "Q":
3588
3615
  case "T":
3589
- a = w === "Q" ? M + _() : T, l = w === "Q" ? A + _() : S, g(ct, a, l, M + _(), A + _());
3616
+ a = b === "Q" ? M + _() : T, l = b === "Q" ? A + _() : S, g(ct, a, l, M + _(), A + _());
3590
3617
  break;
3591
3618
  case "A": {
3592
- const b = _(), m = _(), d = _(), U = y(), v = y();
3593
- Pc(g, o, i, b, m, d, U, v, M + _(), A + _());
3619
+ const w = _(), m = _(), d = _(), U = y(), v = y();
3620
+ $c(g, o, i, w, m, d, U, v, M + _(), A + _());
3594
3621
  break;
3595
3622
  }
3596
3623
  case "Z":
@@ -3599,19 +3626,19 @@ function hs(e, t, n) {
3599
3626
  default:
3600
3627
  throw new Error(`parseSvg: unknown path command "${h}"`);
3601
3628
  }
3602
- f = w;
3629
+ f = b;
3603
3630
  }
3604
3631
  x();
3605
3632
  }
3606
- function Pc(e, t, n, s, o, i, r, c, a, l) {
3633
+ function $c(e, t, n, s, o, i, r, c, a, l) {
3607
3634
  if (t === a && n === l) return;
3608
- if (s = Math.abs(s), o = Math.abs(o), s === 0 || o === 0) return e(st, a, l);
3635
+ if (s = Math.abs(s), o = Math.abs(o), s === 0 || o === 0) return e(tt, a, l);
3609
3636
  const h = Math.cos(i * Math.PI / 180), f = Math.sin(i * Math.PI / 180), p = (t - a) / 2, u = (n - l) / 2, _ = h * p + f * u, y = -f * p + h * u, g = _ * _ / (s * s) + y * y / (o * o);
3610
3637
  g > 1 && (s *= Math.sqrt(g), o *= Math.sqrt(g));
3611
- const x = s * s * y * y + o * o * _ * _, w = (r === c ? -1 : 1) * Math.sqrt(Math.max(0, (s * s * o * o - x) / x)), M = w * s * y / o, A = -w * o * _ / s, k = h * M - f * A + (t + a) / 2, T = f * M + h * A + (n + l) / 2, S = Math.atan2((y - A) / o, (_ - M) / s);
3612
- let b = Math.atan2((-y - A) / o, (-_ - M) / s) - S;
3613
- c && b < 0 ? b += 2 * Math.PI : !c && b > 0 && (b -= 2 * Math.PI);
3614
- const m = Math.max(1, Math.ceil(Math.abs(b) / (Math.PI / 2) - 1e-9)), d = b / m, U = 4 / 3 * Math.tan(d / 4), v = (I, R) => k + s * I * h - o * R * f, C = (I, R) => T + s * I * f + o * R * h;
3638
+ const x = s * s * y * y + o * o * _ * _, b = (r === c ? -1 : 1) * Math.sqrt(Math.max(0, (s * s * o * o - x) / x)), M = b * s * y / o, A = -b * o * _ / s, k = h * M - f * A + (t + a) / 2, T = f * M + h * A + (n + l) / 2, S = Math.atan2((y - A) / o, (_ - M) / s);
3639
+ let w = Math.atan2((-y - A) / o, (-_ - M) / s) - S;
3640
+ c && w < 0 ? w += 2 * Math.PI : !c && w > 0 && (w -= 2 * Math.PI);
3641
+ const m = Math.max(1, Math.ceil(Math.abs(w) / (Math.PI / 2) - 1e-9)), d = w / m, U = 4 / 3 * Math.tan(d / 4), v = (I, R) => k + s * I * h - o * R * f, C = (I, R) => T + s * I * f + o * R * h;
3615
3642
  for (let I = 0; I < m; I++) {
3616
3643
  const R = Math.cos(S + I * d), G = Math.sin(S + I * d), F = Math.cos(S + (I + 1) * d), X = Math.sin(S + (I + 1) * d), H = I === m - 1;
3617
3644
  e(
@@ -3625,7 +3652,7 @@ function Pc(e, t, n, s, o, i, r, c, a, l) {
3625
3652
  );
3626
3653
  }
3627
3654
  }
3628
- function Fc(e) {
3655
+ function Bc(e) {
3629
3656
  let t = 0, n = 0;
3630
3657
  for (const c of e)
3631
3658
  t += c.w * c.h, n = Math.max(n, c.w);
@@ -3657,7 +3684,7 @@ function Fc(e) {
3657
3684
  // space utilization
3658
3685
  };
3659
3686
  }
3660
- const Vo = 4, qc = {
3687
+ const Wo = 4, Yc = {
3661
3688
  x: 0,
3662
3689
  y: 0,
3663
3690
  w: 0,
@@ -3668,11 +3695,11 @@ const Vo = 4, qc = {
3668
3695
  planeRight: 0,
3669
3696
  planeTop: 0
3670
3697
  };
3671
- function he(e) {
3698
+ function fe(e) {
3672
3699
  const t = e < 0 ? 0 : e > 1 ? 1 : e;
3673
3700
  return ~Math.trunc(255.5 - 255 * t) & 255;
3674
3701
  }
3675
- class Nc {
3702
+ class Kc {
3676
3703
  /**
3677
3704
  * @param font Font for the glyph/layout methods; `null` for a shapes-only atlas.
3678
3705
  * @param opts Generation scale and distance range.
@@ -3771,7 +3798,7 @@ class Nc {
3771
3798
  }
3772
3799
  /** Generates one entry from an em-unit shape. Does not cache or pack. */
3773
3800
  _generate(t, n) {
3774
- const s = Ec(t, this._pxPerEm, this._pxrange);
3801
+ const s = Fc(t, this._pxPerEm, this._pxrange);
3775
3802
  return { glyph: {
3776
3803
  x: 0,
3777
3804
  y: 0,
@@ -3794,12 +3821,12 @@ class Nc {
3794
3821
  * {@link Atlas.layoutMultiline} for multi-line input.
3795
3822
  */
3796
3823
  layout(t) {
3797
- const n = this._requireFont(), s = Ar(n, t), o = L._gid, i = L._gp;
3824
+ const n = this._requireFont(), s = Ur(n, t), o = L._gid, i = L._gp;
3798
3825
  let r = 0;
3799
3826
  const c = this._byGid;
3800
3827
  for (let _ = 0; _ < s; _++) {
3801
3828
  const y = o[_];
3802
- if (i[_] & wn || c[y]) continue;
3829
+ if (i[_] & bn || c[y]) continue;
3803
3830
  const g = this._generateForGlyphId(y);
3804
3831
  this._cache.set(y, g), c[y] = g.glyph, r++;
3805
3832
  }
@@ -3807,7 +3834,7 @@ class Nc {
3807
3834
  const a = L._xa, l = L._xo, h = L._yo, f = n.metrics.unitsPerEm, p = [];
3808
3835
  let u = 0;
3809
3836
  for (let _ = 0; _ < s; _++) {
3810
- const y = i[_] & wn ? qc : c[o[_]];
3837
+ const y = i[_] & bn ? Yc : c[o[_]];
3811
3838
  p.push({ glyph: y, penX: (u + l[_]) / f, penY: h[_] / f }), u += a[_];
3812
3839
  }
3813
3840
  return { glyphs: p, widthEm: u / f };
@@ -3853,8 +3880,8 @@ class Nc {
3853
3880
  for (const o of [this._cache, this._cacheByKey])
3854
3881
  for (const { glyph: i, msdf: r } of o.values())
3855
3882
  r && t.push({ w: i.w + 1, h: i.h + 1, x: 0, y: 0, glyph: i, msdf: r });
3856
- const { w: n, h: s } = Fc(t);
3857
- this._width = n, this._height = s, this._pixels = new Uint8Array(n * s * Vo), this._floats && (this._floats = new Float32Array(n * s * 3));
3883
+ const { w: n, h: s } = Bc(t);
3884
+ this._width = n, this._height = s, this._pixels = new Uint8Array(n * s * Wo), this._floats && (this._floats = new Float32Array(n * s * 3));
3858
3885
  for (const o of t)
3859
3886
  o.glyph.x = o.x, o.glyph.y = o.y, this._blit(o.msdf, o.x, o.y, o.glyph.w, o.glyph.h);
3860
3887
  }
@@ -3869,21 +3896,21 @@ class Nc {
3869
3896
  const h = s + (i - 1 - l);
3870
3897
  (a = this._floats) == null || a.set(t.subarray(l * o * 3, (l + 1) * o * 3), (h * r + n) * 3);
3871
3898
  for (let f = 0; f < o; f++) {
3872
- const p = (l * o + f) * 3, u = (h * r + (n + f)) * Vo;
3873
- c[u] = he(t[p]), c[u + 1] = he(t[p + 1]), c[u + 2] = he(t[p + 2]), c[u + 3] = 255;
3899
+ const p = (l * o + f) * 3, u = (h * r + (n + f)) * Wo;
3900
+ c[u] = fe(t[p]), c[u + 1] = fe(t[p + 1]), c[u + 2] = fe(t[p + 2]), c[u + 3] = 255;
3874
3901
  }
3875
3902
  }
3876
3903
  }
3877
3904
  }
3878
3905
  export {
3879
- Nc as Atlas,
3906
+ Kc as Atlas,
3880
3907
  Gt as CUBIC,
3881
3908
  et as EdgeSegment,
3882
- Oc as Font,
3883
- st as LINEAR,
3909
+ Hc as Font,
3910
+ tt as LINEAR,
3884
3911
  ct as QUADRATIC,
3885
- Ec as generateShapeMSDF,
3886
- Gc as parseSvg,
3887
- Ic as parseSvgLayers,
3888
- he as pixelFloatToByte
3912
+ Fc as generateShapeMSDF,
3913
+ Xc as parseSvg,
3914
+ qc as parseSvgLayers,
3915
+ fe as pixelFloatToByte
3889
3916
  };