dielines 0.9.0 → 0.9.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.
package/dist/dielines.js CHANGED
@@ -1,9 +1,9 @@
1
1
  var zi = Object.defineProperty;
2
2
  var Di = (i, t, e) => t in i ? zi(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
3
  var St = (i, t, e) => Di(i, typeof t != "symbol" ? t + "" : t, e);
4
- var Ui = Object.defineProperty, ii = (i) => {
4
+ var Ui = Object.defineProperty, ni = (i) => {
5
5
  throw TypeError(i);
6
- }, Yi = (i, t, e) => t in i ? Ui(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, F = (i, t, e) => Yi(i, typeof t != "symbol" ? t + "" : t, e), tn = (i, t, e) => t.has(i) || ii("Cannot " + e), Mt = (i, t, e) => (tn(i, t, "read from private field"), e ? e.call(i) : t.get(i)), si = (i, t, e) => t.has(i) ? ii("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, e), Ne = (i, t, e, n) => (tn(i, t, "write to private field"), t.set(i, e), e), Pn = (i, t, e) => (tn(i, t, "access private method"), e);
6
+ }, Yi = (i, t, e) => t in i ? Ui(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, F = (i, t, e) => Yi(i, typeof t != "symbol" ? t + "" : t, e), tn = (i, t, e) => t.has(i) || ni("Cannot " + e), Mt = (i, t, e) => (tn(i, t, "read from private field"), e ? e.call(i) : t.get(i)), ii = (i, t, e) => t.has(i) ? ni("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, e), Ne = (i, t, e, n) => (tn(i, t, "write to private field"), t.set(i, e), e), dn = (i, t, e) => (tn(i, t, "access private method"), e);
7
7
  function me(i, t, e, n) {
8
8
  return i <= n && t >= e;
9
9
  }
@@ -64,7 +64,7 @@ let re = class Qt {
64
64
  function en(i) {
65
65
  return i.reduce((t, e) => t.addPoint(e), new re());
66
66
  }
67
- const Mn = (i, t = 1e-9) => {
67
+ const Pn = (i, t = 1e-9) => {
68
68
  let e = i;
69
69
  return Math.abs(i) < t && (e = 0), e.toFixed(-Math.log10(t));
70
70
  };
@@ -72,7 +72,7 @@ function At(i, t = 1e-9) {
72
72
  return Array.from(
73
73
  new Map(
74
74
  i.map(([e, n]) => [
75
- `[${Mn(e, t)},${Mn(n, t)}]`,
75
+ `[${Pn(e, t)},${Pn(n, t)}]`,
76
76
  [e, n]
77
77
  ])
78
78
  ).values()
@@ -93,11 +93,11 @@ function vt(i, t) {
93
93
  const e = Math.cos(t) * i, n = Math.sin(t) * i;
94
94
  return [e, n];
95
95
  }
96
- function Hi([i, t]) {
96
+ function Wi([i, t]) {
97
97
  return Math.atan2(t, i);
98
98
  }
99
- function ri(i) {
100
- const t = J(i), e = Hi(i);
99
+ function si(i) {
100
+ const t = J(i), e = Wi(i);
101
101
  return [t, e];
102
102
  }
103
103
  function sn(i, t, e = 1e-9) {
@@ -110,7 +110,7 @@ function nt(i) {
110
110
  function Zt(i) {
111
111
  return [i[1], -i[0]];
112
112
  }
113
- function Wi(i, t, e) {
113
+ function Hi(i, t, e) {
114
114
  return k(e, i) || sn(q(e, i), t);
115
115
  }
116
116
  const Bt = (i, t) => {
@@ -143,12 +143,12 @@ const Bt = (i, t) => {
143
143
  const [t, e, n, s, r, o, a, h, l] = i;
144
144
  return [t, s, a, e, r, h, n, o, l];
145
145
  };
146
- let ct = class oi {
146
+ let ct = class ri {
147
147
  constructor(t) {
148
148
  F(this, "_matrix", [1, 0, 0, 0, 1, 0, 0, 0, 1]), t && (this._matrix = [...t]);
149
149
  }
150
150
  clone() {
151
- return new oi(this._matrix);
151
+ return new ri(this._matrix);
152
152
  }
153
153
  transpose() {
154
154
  return this._matrix = Gi(this._matrix), this;
@@ -377,7 +377,7 @@ const Ie = (i, t, e) => {
377
377
  intersectionParam2: l
378
378
  };
379
379
  };
380
- function ai(i, t, e = !1, n) {
380
+ function oi(i, t, e = !1, n) {
381
381
  const s = Ie(i, t, n);
382
382
  if (s === "parallel") {
383
383
  if (!e) return null;
@@ -401,7 +401,7 @@ function ai(i, t, e = !1, n) {
401
401
  }
402
402
  const ge = (i, t) => {
403
403
  const e = q(i, t);
404
- return ri(e);
404
+ return si(e);
405
405
  };
406
406
  let z = class qt extends oe {
407
407
  constructor(t, e, n, s = !1, { ignoreChecks: r = !1 } = {}) {
@@ -618,7 +618,7 @@ function Zi(i, t, e) {
618
618
  { ignoreChecks: !0 }
619
619
  );
620
620
  }
621
- function hi(i, t, e) {
621
+ function ai(i, t, e) {
622
622
  const n = new D(i, t), s = nt(n.tangentAtFirstPoint), r = Ie(
623
623
  { firstPoint: n.midPoint, V: s, precision: 1e-9 },
624
624
  {
@@ -640,11 +640,11 @@ function hi(i, t, e) {
640
640
  ignoreChecks: !0
641
641
  });
642
642
  }
643
- const yn = 1e-21, pe = 1.618034;
644
- function bn(i, t = 0, e = 1, n = 110, s = 1e3) {
643
+ const Mn = 1e-21, pe = 1.618034;
644
+ function yn(i, t = 0, e = 1, n = 110, s = 1e3) {
645
645
  let r, o, a, h, l, c, u, m, w, g, p, M, f;
646
646
  for (o = i(t), a = i(e), o < a && ([t, e] = [e, t], [o, a] = [a, o]), f = e + pe * (e - t), h = i(f), l = 3, u = 0; h < a; ) {
647
- if (m = (e - t) * (a - h), w = (e - f) * (a - o), g = w - m, Math.abs(g) < yn ? r = 2 * yn : r = 2 * g, p = e - ((e - f) * w - (e - t) * m) / r, M = e + n * (f - e), u > s)
647
+ if (m = (e - t) * (a - h), w = (e - f) * (a - o), g = w - m, Math.abs(g) < Mn ? r = 2 * Mn : r = 2 * g, p = e - ((e - f) * w - (e - t) * m) / r, M = e + n * (f - e), u > s)
648
648
  throw new Error("Too many iterations.");
649
649
  if (u += 1, (p - f) * (e - p) > 0) {
650
650
  if (c = i(p), l += 1, c < h)
@@ -658,7 +658,7 @@ function bn(i, t = 0, e = 1, n = 110, s = 1e3) {
658
658
  }
659
659
  return [t, e, f, o, a, h, l];
660
660
  }
661
- const xn = 0.381966, Ki = 1e-11;
661
+ const bn = 0.381966, Ki = 1e-11;
662
662
  class ts {
663
663
  constructor(t, e = 148e-10, n = 500) {
664
664
  F(this, "xmin"), F(this, "fval"), F(this, "iter"), F(this, "funcalls"), F(this, "brack"), this.func = t, this.tol = e, this.maxiter = n, this.func = t, this.tol = e, this.maxiter = n, this.xmin = 1 / 0, this.fval = 1 / 0, this.iter = 0, this.funcalls = 0, this.brack = null;
@@ -670,9 +670,9 @@ class ts {
670
670
  let t, e, n, s, r, o, a;
671
671
  const h = this.func, l = this.brack;
672
672
  if (l === null)
673
- [r, o, a, t, e, n, s] = bn(h);
673
+ [r, o, a, t, e, n, s] = yn(h);
674
674
  else if (l.length === 2)
675
- [r, o, a, t, e, n, s] = bn(h, l[0], l[1]);
675
+ [r, o, a, t, e, n, s] = yn(h, l[0], l[1]);
676
676
  else if (l.length === 3) {
677
677
  if ([r, o, a] = l, r > a && ([a, r] = [r, a]), !(r < o && o < a))
678
678
  throw new Error("Not a bracketing interval.");
@@ -697,13 +697,13 @@ class ts {
697
697
  if (Math.abs(o - R) < b - 0.5 * (w - m))
698
698
  break;
699
699
  if (Math.abs(g) <= P)
700
- o >= R ? g = m - o : g = w - o, M = xn * g;
700
+ o >= R ? g = m - o : g = w - o, M = bn * g;
701
701
  else {
702
702
  const V = (o - a) * (u - c);
703
703
  let v = (o - h) * (u - l), S = (o - h) * v - (o - a) * V;
704
704
  v = 2 * (v - V), v > 0 && (S = -S), v = Math.abs(v);
705
705
  const j = g;
706
- g = M, S > v * (m - o) && S < v * (w - o) && Math.abs(S) < Math.abs(0.5 * v * j) ? (M = S * 1 / v, f = o + M, (f - m < b || w - f < b) && (R - o >= 0 ? M = P : M = -P)) : (o >= R ? g = m - o : g = w - o, M = xn * g);
706
+ g = M, S > v * (m - o) && S < v * (w - o) && Math.abs(S) < Math.abs(0.5 * v * j) ? (M = S * 1 / v, f = o + M, (f - m < b || w - f < b) && (R - o >= 0 ? M = P : M = -P)) : (o >= R ? g = m - o : g = w - o, M = bn * g);
707
707
  }
708
708
  Math.abs(M) < P ? M >= 0 ? f = o + P : f = o - P : f = o + M;
709
709
  const C = t(f);
@@ -723,11 +723,11 @@ class ts {
723
723
  return this.optimize(), this.results();
724
724
  }
725
725
  }
726
- function li(i, t = 1e-8, e = 1e3) {
726
+ function hi(i, t = 1e-8, e = 1e3) {
727
727
  const n = new ts(i, t, e);
728
728
  return n.setBracket([0, 1]), n.run();
729
729
  }
730
- function ui(i) {
730
+ function li(i) {
731
731
  if (i.__esModule) return i;
732
732
  var t = i.default;
733
733
  if (typeof t == "function") {
@@ -755,7 +755,7 @@ function ee(i) {
755
755
  const ns = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
756
756
  __proto__: null,
757
757
  isAnyArray: ee
758
- }, Symbol.toStringTag, { value: "Module" })), is = /* @__PURE__ */ ui(ns);
758
+ }, Symbol.toStringTag, { value: "Module" })), is = /* @__PURE__ */ li(ns);
759
759
  function ss(i) {
760
760
  var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
761
761
  if (!ee(i))
@@ -812,14 +812,14 @@ function os(i) {
812
812
  const as = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
813
813
  __proto__: null,
814
814
  default: os
815
- }, Symbol.toStringTag, { value: "Module" })), hs = /* @__PURE__ */ ui(as);
815
+ }, Symbol.toStringTag, { value: "Module" })), hs = /* @__PURE__ */ li(as);
816
816
  Object.defineProperty(O, "__esModule", { value: !0 });
817
- var ft = is, vn = hs;
818
- const we = " ".repeat(2), ci = " ".repeat(4);
817
+ var ft = is, xn = hs;
818
+ const we = " ".repeat(2), ui = " ".repeat(4);
819
819
  function ls() {
820
- return fi(this);
820
+ return ci(this);
821
821
  }
822
- function fi(i, t = {}) {
822
+ function ci(i, t = {}) {
823
823
  const {
824
824
  maxRows: e = 15,
825
825
  maxColumns: n = 10,
@@ -828,7 +828,7 @@ function fi(i, t = {}) {
828
828
  } = t;
829
829
  return `${i.constructor.name} {
830
830
  ${we}[
831
- ${ci}${us(i, e, n, s, r)}
831
+ ${ui}${us(i, e, n, s, r)}
832
832
  ${we}]
833
833
  ${we}rows: ${i.rows}
834
834
  ${we}columns: ${i.columns}
@@ -852,12 +852,12 @@ function us(i, t, e, n, s) {
852
852
  l.push(`${u.join(" ")}`);
853
853
  }
854
854
  return h !== o && (l[l.length - 1] += ` ... ${o - e} more columns`), a !== r && l.push(`... ${r - t} more rows`), l.join(`
855
- ${ci}`);
855
+ ${ui}`);
856
856
  }
857
857
  function cs(i, t, e) {
858
- return (i >= 0 && e ? ` ${An(i, t - 1)}` : An(i, t)).padEnd(t);
858
+ return (i >= 0 && e ? ` ${vn(i, t - 1)}` : vn(i, t)).padEnd(t);
859
859
  }
860
- function An(i, t) {
860
+ function vn(i, t) {
861
861
  let e = i.toString();
862
862
  if (e.length <= t) return e;
863
863
  let n = i.toFixed(t);
@@ -2009,7 +2009,7 @@ let Z = class st {
2009
2009
  strassen3x3(t) {
2010
2010
  t = E.checkMatrix(t);
2011
2011
  let e = new E(3, 3);
2012
- const n = this.get(0, 0), s = this.get(0, 1), r = this.get(0, 2), o = this.get(1, 0), a = this.get(1, 1), h = this.get(1, 2), l = this.get(2, 0), c = this.get(2, 1), u = this.get(2, 2), m = t.get(0, 0), w = t.get(0, 1), g = t.get(0, 2), p = t.get(1, 0), M = t.get(1, 1), f = t.get(1, 2), P = t.get(2, 0), b = t.get(2, 1), R = t.get(2, 2), C = (n + s + r - o - a - c - u) * M, V = (n - o) * (-w + M), v = a * (-m + w + p - M - f - P + R), S = (-n + o + a) * (m - w + M), j = (o + a) * (-m + w), d = n * m, x = (-n + l + c) * (m - g + f), A = (-n + l) * (g - f), y = (l + c) * (-m + g), $ = (n + s + r - a - h - l - c) * f, I = c * (-m + g + p - M - f - P + b), _ = (-r + c + u) * (M + P - b), H = (r - u) * (M - b), L = r * P, N = (c + u) * (-P + b), B = (-r + a + h) * (f + P - R), Y = (r - h) * (f - R), W = (a + h) * (-P + R), T = s * p, U = h * b, tt = o * g, K = l * w, G = u * R, Be = d + L + T, Ve = C + S + j + d + _ + L + N, je = d + x + y + $ + L + B + W, qe = V + v + S + d + L + B + Y, he = V + S + j + d + U, le = L + B + Y + W + tt, ue = d + x + A + I + _ + H + L, ce = _ + H + L + N + K, fe = d + x + A + y + G;
2012
+ const n = this.get(0, 0), s = this.get(0, 1), r = this.get(0, 2), o = this.get(1, 0), a = this.get(1, 1), h = this.get(1, 2), l = this.get(2, 0), c = this.get(2, 1), u = this.get(2, 2), m = t.get(0, 0), w = t.get(0, 1), g = t.get(0, 2), p = t.get(1, 0), M = t.get(1, 1), f = t.get(1, 2), P = t.get(2, 0), b = t.get(2, 1), R = t.get(2, 2), C = (n + s + r - o - a - c - u) * M, V = (n - o) * (-w + M), v = a * (-m + w + p - M - f - P + R), S = (-n + o + a) * (m - w + M), j = (o + a) * (-m + w), d = n * m, x = (-n + l + c) * (m - g + f), A = (-n + l) * (g - f), y = (l + c) * (-m + g), $ = (n + s + r - a - h - l - c) * f, I = c * (-m + g + p - M - f - P + b), _ = (-r + c + u) * (M + P - b), W = (r - u) * (M - b), L = r * P, N = (c + u) * (-P + b), B = (-r + a + h) * (f + P - R), Y = (r - h) * (f - R), H = (a + h) * (-P + R), T = s * p, U = h * b, tt = o * g, K = l * w, G = u * R, Be = d + L + T, Ve = C + S + j + d + _ + L + N, je = d + x + y + $ + L + B + H, qe = V + v + S + d + L + B + Y, he = V + S + j + d + U, le = L + B + Y + H + tt, ue = d + x + A + I + _ + W + L, ce = _ + W + L + N + K, fe = d + x + A + y + G;
2013
2013
  return e.set(0, 0, Be), e.set(0, 1, Ve), e.set(0, 2, je), e.set(1, 0, qe), e.set(1, 1, he), e.set(1, 2, le), e.set(2, 0, ue), e.set(2, 1, ce), e.set(2, 2, fe), e;
2014
2014
  }
2015
2015
  mmulStrassen(t) {
@@ -2050,10 +2050,10 @@ let Z = class st {
2050
2050
  M
2051
2051
  ), _ = st.add(j, A);
2052
2052
  _.sub(y), _.add(I);
2053
- let H = st.add(x, y), L = st.add(d, A), N = st.sub(j, d);
2053
+ let W = st.add(x, y), L = st.add(d, A), N = st.sub(j, d);
2054
2054
  N.add(x), N.add($);
2055
2055
  let B = st.zeros(2 * _.rows, 2 * _.columns);
2056
- return B = B.setSubMatrix(_, 0, 0), B = B.setSubMatrix(H, _.rows, 0), B = B.setSubMatrix(L, 0, _.columns), B = B.setSubMatrix(N, _.rows, _.columns), B.subMatrix(0, w - 1, 0, g - 1);
2056
+ return B = B.setSubMatrix(_, 0, 0), B = B.setSubMatrix(W, _.rows, 0), B = B.setSubMatrix(L, 0, _.columns), B = B.setSubMatrix(N, _.rows, _.columns), B.subMatrix(0, w - 1, 0, g - 1);
2057
2057
  }
2058
2058
  return c(e, t, h, l);
2059
2059
  }
@@ -2067,7 +2067,7 @@ let Z = class st {
2067
2067
  let s = new E(this.rows, this.columns);
2068
2068
  for (let r = 0; r < this.rows; r++) {
2069
2069
  const o = this.getRow(r);
2070
- o.length > 0 && vn(o, { min: e, max: n, output: o }), s.setRow(r, o);
2070
+ o.length > 0 && xn(o, { min: e, max: n, output: o }), s.setRow(r, o);
2071
2071
  }
2072
2072
  return s;
2073
2073
  }
@@ -2081,7 +2081,7 @@ let Z = class st {
2081
2081
  let s = new E(this.rows, this.columns);
2082
2082
  for (let r = 0; r < this.columns; r++) {
2083
2083
  const o = this.getColumn(r);
2084
- o.length && vn(o, {
2084
+ o.length && xn(o, {
2085
2085
  min: e,
2086
2086
  max: n,
2087
2087
  output: o
@@ -2130,12 +2130,12 @@ let Z = class st {
2130
2130
  t.set(n, e, this.get(e, n));
2131
2131
  return t;
2132
2132
  }
2133
- sortRows(t = En) {
2133
+ sortRows(t = An) {
2134
2134
  for (let e = 0; e < this.rows; e++)
2135
2135
  this.setRow(e, this.getRow(e).sort(t));
2136
2136
  return this;
2137
2137
  }
2138
- sortColumns(t = En) {
2138
+ sortColumns(t = An) {
2139
2139
  for (let e = 0; e < this.columns; e++)
2140
2140
  this.setColumn(e, this.getColumn(e).sort(t));
2141
2141
  return this;
@@ -2350,7 +2350,7 @@ let Z = class st {
2350
2350
  }
2351
2351
  }
2352
2352
  toString(t) {
2353
- return fi(this, t);
2353
+ return ci(this, t);
2354
2354
  }
2355
2355
  [Symbol.iterator]() {
2356
2356
  return this.entries();
@@ -2378,7 +2378,7 @@ let Z = class st {
2378
2378
  };
2379
2379
  Z.prototype.klass = "Matrix";
2380
2380
  typeof Symbol < "u" && (Z.prototype[Symbol.for("nodejs.util.inspect.custom")] = ls);
2381
- function En(i, t) {
2381
+ function An(i, t) {
2382
2382
  return i - t;
2383
2383
  }
2384
2384
  function $s(i) {
@@ -2394,10 +2394,10 @@ Z.prototype.tensorProduct = Z.prototype.kroneckerProduct;
2394
2394
  var Pe, Oe, Me;
2395
2395
  let E = (Me = class extends Z {
2396
2396
  constructor(i, t) {
2397
- if (super(), si(this, Pe), F(this, "data"), Me.isMatrix(i))
2398
- Pn(this, Pe, Oe).call(this, i.rows, i.columns), Me.copy(i, this);
2397
+ if (super(), ii(this, Pe), F(this, "data"), Me.isMatrix(i))
2398
+ dn(this, Pe, Oe).call(this, i.rows, i.columns), Me.copy(i, this);
2399
2399
  else if (Number.isInteger(i) && i >= 0)
2400
- Pn(this, Pe, Oe).call(this, i, t);
2400
+ dn(this, Pe, Oe).call(this, i, t);
2401
2401
  else if (ft.isAnyArray(i)) {
2402
2402
  const e = i;
2403
2403
  if (i = e.length, t = i ? e[0].length : 0, typeof t != "number")
@@ -2476,7 +2476,7 @@ const Is = class Xe extends Z {
2476
2476
  * @return {this}
2477
2477
  */
2478
2478
  constructor(t) {
2479
- if (super(), si(this, ht), E.isMatrix(t)) {
2479
+ if (super(), ii(this, ht), E.isMatrix(t)) {
2480
2480
  if (!t.isSymmetric())
2481
2481
  throw new TypeError("not symmetric data");
2482
2482
  Ne(this, ht, E.copy(
@@ -2628,7 +2628,7 @@ const Is = class Xe extends Z {
2628
2628
  ht = /* @__PURE__ */ new WeakMap();
2629
2629
  let Kt = Is;
2630
2630
  Kt.prototype.klassType = "SymmetricMatrix";
2631
- let mi = class gi extends Kt {
2631
+ let fi = class mi extends Kt {
2632
2632
  /**
2633
2633
  * not the same as matrix.isSymmetric()
2634
2634
  * Here is to check if it's instanceof SymmetricMatrix without bundling issues
@@ -2653,7 +2653,7 @@ let mi = class gi extends Kt {
2653
2653
  return new Kt(this);
2654
2654
  }
2655
2655
  clone() {
2656
- const t = new gi(this.diagonalSize);
2656
+ const t = new mi(this.diagonalSize);
2657
2657
  for (const [e, n, s] of this.upperRightEntries())
2658
2658
  e !== n && t.set(e, n, s);
2659
2659
  return t;
@@ -2703,7 +2703,7 @@ let mi = class gi extends Kt {
2703
2703
  return s;
2704
2704
  }
2705
2705
  };
2706
- mi.prototype.klassSubType = "DistanceMatrix";
2706
+ fi.prototype.klassSubType = "DistanceMatrix";
2707
2707
  let Et = class extends Z {
2708
2708
  constructor(t, e, n) {
2709
2709
  super(), this.matrix = t, this.rows = e, this.columns = n;
@@ -2822,7 +2822,7 @@ class Ns extends Et {
2822
2822
  return this.matrix.get(e, t);
2823
2823
  }
2824
2824
  }
2825
- class pi extends Z {
2825
+ class gi extends Z {
2826
2826
  constructor(t, e = {}) {
2827
2827
  const { rows: n = 1 } = e;
2828
2828
  if (t.length % n !== 0)
@@ -2854,7 +2854,7 @@ let gt = class extends Z {
2854
2854
  };
2855
2855
  function Os(i, t) {
2856
2856
  if (ft.isAnyArray(i))
2857
- return i[0] && ft.isAnyArray(i[0]) ? new gt(i) : new pi(i, t);
2857
+ return i[0] && ft.isAnyArray(i[0]) ? new gt(i) : new gi(i, t);
2858
2858
  throw new Error("the argument is not an array");
2859
2859
  }
2860
2860
  let Fe = class {
@@ -3019,7 +3019,7 @@ class an {
3019
3019
  return s;
3020
3020
  }
3021
3021
  }
3022
- let Ht = class {
3022
+ let Wt = class {
3023
3023
  constructor(t, e = {}) {
3024
3024
  if (t = gt.checkMatrix(t), t.isEmpty())
3025
3025
  throw new Error("Matrix must be non-empty");
@@ -3172,8 +3172,8 @@ let Ht = class {
3172
3172
  for (let y = v - 2; y >= d; y--) {
3173
3173
  let $ = xt(g[y], A), I = g[y] / $, _ = A / $;
3174
3174
  if (g[y] = $, y !== d && (A = -_ * f[y - 1], f[y - 1] = I * f[y - 1]), l)
3175
- for (let H = 0; H < s; H++)
3176
- $ = I * M.get(H, y) + _ * M.get(H, v - 1), M.set(H, v - 1, -_ * M.get(H, y) + I * M.get(H, v - 1)), M.set(H, y, $);
3175
+ for (let W = 0; W < s; W++)
3176
+ $ = I * M.get(W, y) + _ * M.get(W, v - 1), M.set(W, v - 1, -_ * M.get(W, y) + I * M.get(W, v - 1)), M.set(W, y, $);
3177
3177
  }
3178
3178
  break;
3179
3179
  }
@@ -3183,8 +3183,8 @@ let Ht = class {
3183
3183
  for (let y = d; y < v; y++) {
3184
3184
  let $ = xt(g[y], A), I = g[y] / $, _ = A / $;
3185
3185
  if (g[y] = $, A = -_ * f[y], f[y] = I * f[y], h)
3186
- for (let H = 0; H < n; H++)
3187
- $ = I * p.get(H, y) + _ * p.get(H, d - 1), p.set(H, d - 1, -_ * p.get(H, y) + I * p.get(H, d - 1)), p.set(H, y, $);
3186
+ for (let W = 0; W < n; W++)
3187
+ $ = I * p.get(W, y) + _ * p.get(W, d - 1), p.set(W, d - 1, -_ * p.get(W, y) + I * p.get(W, d - 1)), p.set(W, y, $);
3188
3188
  }
3189
3189
  break;
3190
3190
  }
@@ -3195,18 +3195,18 @@ let Ht = class {
3195
3195
  Math.abs(f[v - 2]),
3196
3196
  Math.abs(g[d]),
3197
3197
  Math.abs(f[d])
3198
- ), y = g[v - 1] / A, $ = g[v - 2] / A, I = f[v - 2] / A, _ = g[d] / A, H = f[d] / A, L = (($ + y) * ($ - y) + I * I) / 2, N = y * I * (y * I);
3198
+ ), y = g[v - 1] / A, $ = g[v - 2] / A, I = f[v - 2] / A, _ = g[d] / A, W = f[d] / A, L = (($ + y) * ($ - y) + I * I) / 2, N = y * I * (y * I);
3199
3199
  let B = 0;
3200
3200
  (L !== 0 || N !== 0) && (L < 0 ? B = 0 - Math.sqrt(L * L + N) : B = Math.sqrt(L * L + N), B = N / (L + B));
3201
- let Y = (_ + y) * (_ - y) + B, W = _ * H;
3201
+ let Y = (_ + y) * (_ - y) + B, H = _ * W;
3202
3202
  for (let T = d; T < v - 1; T++) {
3203
- let U = xt(Y, W);
3203
+ let U = xt(Y, H);
3204
3204
  U === 0 && (U = Number.MIN_VALUE);
3205
- let tt = Y / U, K = W / U;
3206
- if (T !== d && (f[T - 1] = U), Y = tt * g[T] + K * f[T], f[T] = tt * f[T] - K * g[T], W = K * g[T + 1], g[T + 1] = tt * g[T + 1], l)
3205
+ let tt = Y / U, K = H / U;
3206
+ if (T !== d && (f[T - 1] = U), Y = tt * g[T] + K * f[T], f[T] = tt * f[T] - K * g[T], H = K * g[T + 1], g[T + 1] = tt * g[T + 1], l)
3207
3207
  for (let G = 0; G < s; G++)
3208
3208
  U = tt * M.get(G, T) + K * M.get(G, T + 1), M.set(G, T + 1, -K * M.get(G, T) + tt * M.get(G, T + 1)), M.set(G, T, U);
3209
- if (U = xt(Y, W), U === 0 && (U = Number.MIN_VALUE), tt = Y / U, K = W / U, g[T] = U, Y = tt * f[T] + K * g[T + 1], g[T + 1] = -K * f[T] + tt * g[T + 1], W = K * f[T + 1], f[T + 1] = tt * f[T + 1], h && T < n - 1)
3209
+ if (U = xt(Y, H), U === 0 && (U = Number.MIN_VALUE), tt = Y / U, K = H / U, g[T] = U, Y = tt * f[T] + K * g[T + 1], g[T + 1] = -K * f[T] + tt * g[T + 1], H = K * f[T + 1], f[T + 1] = tt * f[T + 1], h && T < n - 1)
3210
3210
  for (let G = 0; G < n; G++)
3211
3211
  U = tt * p.get(G, T) + K * p.get(G, T + 1), p.set(G, T + 1, -K * p.get(G, T) + tt * p.get(G, T + 1)), p.set(G, T, U);
3212
3212
  }
@@ -3299,10 +3299,10 @@ let Ht = class {
3299
3299
  }
3300
3300
  };
3301
3301
  function zs(i, t = !1) {
3302
- return i = gt.checkMatrix(i), t ? new Ht(i).inverse() : wi(i, E.eye(i.rows));
3302
+ return i = gt.checkMatrix(i), t ? new Wt(i).inverse() : pi(i, E.eye(i.rows));
3303
3303
  }
3304
- function wi(i, t, e = !1) {
3305
- return i = gt.checkMatrix(i), t = gt.checkMatrix(t), e ? new Ht(i).solve(t) : i.isSquare() ? new Fe(i).solve(t) : new an(i).solve(t);
3304
+ function pi(i, t, e = !1) {
3305
+ return i = gt.checkMatrix(i), t = gt.checkMatrix(t), e ? new Wt(i).solve(t) : i.isSquare() ? new Fe(i).solve(t) : new an(i).solve(t);
3306
3306
  }
3307
3307
  function Ae(i) {
3308
3308
  if (i = E.checkMatrix(i), i.isSquare()) {
@@ -3340,7 +3340,7 @@ function Ys(i, t = {}) {
3340
3340
  i = E.checkMatrix(i);
3341
3341
  let s = i.rows, r = new E(s, s);
3342
3342
  for (let o = 0; o < s; o++) {
3343
- let a = E.columnVector(i.getRow(o)), h = i.subMatrixRow(Ds(s, o)).transpose(), l = new Ht(h).solve(a), c = E.sub(a, h.mmul(l)).abs().max();
3343
+ let a = E.columnVector(i.getRow(o)), h = i.subMatrixRow(Ds(s, o)).transpose(), l = new Wt(h).solve(a), c = E.sub(a, h.mmul(l)).abs().max();
3344
3344
  r.setRow(
3345
3345
  o,
3346
3346
  Us(c, l, o, e, n)
@@ -3351,12 +3351,12 @@ function Ys(i, t = {}) {
3351
3351
  function Xs(i, t = Number.EPSILON) {
3352
3352
  if (i = E.checkMatrix(i), i.isEmpty())
3353
3353
  return i.transpose();
3354
- let e = new Ht(i, { autoTranspose: !0 }), n = e.leftSingularVectors, s = e.rightSingularVectors, r = e.diagonal;
3354
+ let e = new Wt(i, { autoTranspose: !0 }), n = e.leftSingularVectors, s = e.rightSingularVectors, r = e.diagonal;
3355
3355
  for (let o = 0; o < r.length; o++)
3356
3356
  Math.abs(r[o]) > t ? r[o] = 1 / r[o] : r[o] = 0;
3357
3357
  return s.mmul(E.diag(r).mmul(n.transpose()));
3358
3358
  }
3359
- function Hs(i, t = i, e = {}) {
3359
+ function Ws(i, t = i, e = {}) {
3360
3360
  i = new E(i);
3361
3361
  let n = !1;
3362
3362
  if (typeof t == "object" && !E.isMatrix(t) && !ft.isAnyArray(t) ? (e = t, t = i, n = !0) : t = new E(t), i.rows !== t.rows)
@@ -3369,7 +3369,7 @@ function Hs(i, t = i, e = {}) {
3369
3369
  r.set(o, a, r.get(o, a) * (1 / (i.rows - 1)));
3370
3370
  return r;
3371
3371
  }
3372
- function Ws(i, t = i, e = {}) {
3372
+ function Hs(i, t = i, e = {}) {
3373
3373
  i = new E(i);
3374
3374
  let n = !1;
3375
3375
  if (typeof t == "object" && !E.isMatrix(t) && !ft.isAnyArray(t) ? (e = t, t = i, n = !0) : t = new E(t), i.rows !== t.rows)
@@ -3386,7 +3386,7 @@ function Ws(i, t = i, e = {}) {
3386
3386
  );
3387
3387
  return h;
3388
3388
  }
3389
- let di = class {
3389
+ let wi = class {
3390
3390
  constructor(i, t = {}) {
3391
3391
  const { assumeSymmetric: e = !1 } = t;
3392
3392
  if (i = gt.checkMatrix(i), !i.isSquare())
@@ -3650,7 +3650,7 @@ function ye(i, t, e, n) {
3650
3650
  let s, r;
3651
3651
  return Math.abs(e) > Math.abs(n) ? (s = n / e, r = e + s * n, [(i + s * t) / r, (t - s * i) / r]) : (s = e / n, r = n + s * e, [(s * i + t) / r, (s * t - i) / r]);
3652
3652
  }
3653
- class Pi {
3653
+ class di {
3654
3654
  constructor(t) {
3655
3655
  if (t = gt.checkMatrix(t), !t.isSymmetric())
3656
3656
  throw new Error("Matrix is not symmetric");
@@ -3697,7 +3697,7 @@ class Pi {
3697
3697
  return this.L;
3698
3698
  }
3699
3699
  }
3700
- class Mi {
3700
+ class Pi {
3701
3701
  constructor(t, e = {}) {
3702
3702
  t = gt.checkMatrix(t);
3703
3703
  let { Y: n } = e;
@@ -3728,11 +3728,11 @@ class Mi {
3728
3728
  }
3729
3729
  }
3730
3730
  O.AbstractMatrix = Z;
3731
- O.CHO = Pi;
3732
- O.CholeskyDecomposition = Pi;
3733
- O.DistanceMatrix = mi;
3734
- O.EVD = di;
3735
- var Ks = O.EigenvalueDecomposition = di;
3731
+ O.CHO = di;
3732
+ O.CholeskyDecomposition = di;
3733
+ O.DistanceMatrix = fi;
3734
+ O.EVD = wi;
3735
+ var Ks = O.EigenvalueDecomposition = wi;
3736
3736
  O.LU = Fe;
3737
3737
  O.LuDecomposition = Fe;
3738
3738
  var tr = O.Matrix = E;
@@ -3745,26 +3745,26 @@ O.MatrixRowView = Vs;
3745
3745
  O.MatrixSelectionView = ve;
3746
3746
  O.MatrixSubView = qs;
3747
3747
  O.MatrixTransposeView = Ns;
3748
- O.NIPALS = Mi;
3749
- O.Nipals = Mi;
3748
+ O.NIPALS = Pi;
3749
+ O.Nipals = Pi;
3750
3750
  O.QR = an;
3751
3751
  O.QrDecomposition = an;
3752
- O.SVD = Ht;
3753
- O.SingularValueDecomposition = Ht;
3752
+ O.SVD = Wt;
3753
+ O.SingularValueDecomposition = Wt;
3754
3754
  O.SymmetricMatrix = Kt;
3755
- O.WrapperMatrix1D = pi;
3755
+ O.WrapperMatrix1D = gi;
3756
3756
  O.WrapperMatrix2D = gt;
3757
- O.correlation = Ws;
3758
- O.covariance = Hs;
3759
- var Sn = O.default = E;
3757
+ O.correlation = Hs;
3758
+ O.covariance = Ws;
3759
+ var En = O.default = E;
3760
3760
  O.determinant = Ae;
3761
3761
  O.inverse = zs;
3762
3762
  O.linearDependencies = Ys;
3763
3763
  O.pseudoInverse = Xs;
3764
- O.solve = wi;
3764
+ O.solve = pi;
3765
3765
  O.wrap = Os;
3766
3766
  const er = Ks, nr = tr;
3767
- Sn.Matrix && Sn.Matrix;
3767
+ En.Matrix && En.Matrix;
3768
3768
  function ne(i, t, e) {
3769
3769
  const n = i / e, s = t / e;
3770
3770
  if (!(isFinite(n) && isFinite(s))) {
@@ -3784,7 +3784,7 @@ function ne(i, t, e) {
3784
3784
  const a = n / o;
3785
3785
  return isFinite(a) ? a > o ? [o, a] : [a, o] : [o];
3786
3786
  }
3787
- function yi(i, t, e, n) {
3787
+ function Mi(i, t, e, n) {
3788
3788
  const s = e / (3 * n), r = t / (3 * n), o = i / n;
3789
3789
  if (!(isFinite(o) && isFinite(r) && isFinite(s)))
3790
3790
  return ne(i, t, e);
@@ -3802,14 +3802,14 @@ function yi(i, t, e, n) {
3802
3802
  }
3803
3803
  function ir(i, t, e, n, s) {
3804
3804
  if (s == 0)
3805
- return yi(i, t, e, n);
3805
+ return Mi(i, t, e, n);
3806
3806
  const r = n / s, o = e / s, a = t / s, h = i / s;
3807
- let l = kn(r, o, a, h, !1);
3807
+ let l = Sn(r, o, a, h, !1);
3808
3808
  if (l !== null)
3809
3809
  return l;
3810
3810
  const c = 716e74;
3811
3811
  for (let u = 0; u < 2; u++)
3812
- if (l = kn(
3812
+ if (l = Sn(
3813
3813
  r / c,
3814
3814
  o / (c * c),
3815
3815
  a / (c * c * c),
@@ -3825,7 +3825,7 @@ function ir(i, t, e, n, s) {
3825
3825
  function Ct(i, t) {
3826
3826
  return t == 0 ? Math.abs(i) : Math.abs((i - t) / t);
3827
3827
  }
3828
- function kn(i, t, e, n, s) {
3828
+ function Sn(i, t, e, n, s) {
3829
3829
  const r = sr(i, t, e, n, s);
3830
3830
  if (r !== null && r.length == 4) {
3831
3831
  let o = [];
@@ -3839,8 +3839,8 @@ function kn(i, t, e, n, s) {
3839
3839
  }
3840
3840
  function sr(i, t, e, n, s) {
3841
3841
  function r(L, N, B, Y) {
3842
- const W = Ct(L + B, i), T = Ct(N + L * B + Y, t), U = Ct(N * B + L * Y, e);
3843
- return W + T + U;
3842
+ const H = Ct(L + B, i), T = Ct(N + L * B + Y, t), U = Ct(N * B + L * Y, e);
3843
+ return H + T + U;
3844
3844
  }
3845
3845
  function o(L, N, B, Y) {
3846
3846
  return r(L, N, B, Y) + Ct(N * Y, n);
@@ -3860,7 +3860,7 @@ function sr(i, t, e, n, s) {
3860
3860
  const f = i * 0.5, P = 1 / 6 * t + 0.5 * M, b = e - i * P, R = 2 / 3 * t - M - f * f, C = 0.5 * b / R, V = 2 * (n - P * P) / b, v = 0.5 * b / V;
3861
3861
  let S = 0, j = 0, d = 0;
3862
3862
  for (let L = 0; L < 3; L++) {
3863
- const N = L == 1 ? v : R, B = L == 0 ? C : V, Y = Ct(N + f * f + 2 * P, t), W = Ct(2 * (N * B + f * P), e), T = Ct(N * B * B + P * P, n), U = Y + W + T;
3863
+ const N = L == 1 ? v : R, B = L == 0 ? C : V, Y = Ct(N + f * f + 2 * P, t), H = Ct(2 * (N * B + f * P), e), T = Ct(N * B * B + P * P, n), U = Y + H + T;
3864
3864
  (L == 0 || U < d) && (S = N, j = B, d = U);
3865
3865
  }
3866
3866
  const x = S, A = j;
@@ -3870,18 +3870,18 @@ function sr(i, t, e, n, s) {
3870
3870
  if (y = f + L, $ = P + L * A, I = f - L, _ = P - L * A, Math.abs(_) < Math.abs($) ? _ = n / $ : Math.abs(_) > Math.abs($) && ($ = n / _), Math.abs(y) != Math.abs(I)) {
3871
3871
  let N = null, B = null;
3872
3872
  if (Math.abs(y) < Math.abs(I)) {
3873
- const W = (e - $ * I) / _, T = (t - _ - $) / I;
3874
- N = [i - I, W, T], B = [I, I, I];
3873
+ const H = (e - $ * I) / _, T = (t - _ - $) / I;
3874
+ N = [i - I, H, T], B = [I, I, I];
3875
3875
  } else {
3876
- const W = (e - y * _) / $, T = (t - _ - $) / y, U = i - y;
3877
- N = [y, y, y], B = [U, W, T];
3876
+ const H = (e - y * _) / $, T = (t - _ - $) / y, U = i - y;
3877
+ N = [y, y, y], B = [U, H, T];
3878
3878
  }
3879
3879
  let Y = 0;
3880
- for (let W = 0; W < 3; W++) {
3881
- const T = N[W], U = B[W];
3880
+ for (let H = 0; H < 3; H++) {
3881
+ const T = N[H], U = B[H];
3882
3882
  if (isFinite(T) && isFinite(U)) {
3883
3883
  const tt = r(T, $, U, _);
3884
- (W == 0 || tt < Y) && (y = T, I = U, Y = tt);
3884
+ (H == 0 || tt < Y) && (y = T, I = U, Y = tt);
3885
3885
  }
3886
3886
  }
3887
3887
  }
@@ -3890,14 +3890,14 @@ function sr(i, t, e, n, s) {
3890
3890
  y = f, $ = P + Math.sqrt(-L), I = f, _ = P - Math.sqrt(-L), Math.abs($) > Math.abs(_) ? _ = n / $ : Math.abs(_) > Math.abs($) && ($ = n / _);
3891
3891
  } else
3892
3892
  return [];
3893
- let H = o(y, $, I, _);
3894
- for (let L = 0; L < 8 && H != 0; L++) {
3895
- const N = $ * _ - n, B = $ * I + y * _ - e, Y = $ + y * I + _ - t, W = y + I - i, T = y - I, U = $ * $ - $ * (I * T + 2 * _) + _ * (y * T + _);
3893
+ let W = o(y, $, I, _);
3894
+ for (let L = 0; L < 8 && W != 0; L++) {
3895
+ const N = $ * _ - n, B = $ * I + y * _ - e, Y = $ + y * I + _ - t, H = y + I - i, T = y - I, U = $ * $ - $ * (I * T + 2 * _) + _ * (y * T + _);
3896
3896
  if (U == 0)
3897
3897
  break;
3898
- const tt = 1 / U, K = _ - $, G = $ * I - y * _, Be = T * N + K * B + G * Y - ($ * K + y * G) * W, Ve = (y * T + K) * N - $ * (T * B + K * Y + G * W), je = -T * N - K * B - G * Y + (I * G + _ * K) * W, qe = -(I * T + K) * N + _ * (T * B + K * Y + G * W), he = y - tt * Be, le = $ - tt * Ve, ue = I - tt * je, ce = _ - tt * qe, fe = o(he, le, ue, ce);
3899
- if (fe < H)
3900
- y = he, $ = le, I = ue, _ = ce, H = fe;
3898
+ const tt = 1 / U, K = _ - $, G = $ * I - y * _, Be = T * N + K * B + G * Y - ($ * K + y * G) * H, Ve = (y * T + K) * N - $ * (T * B + K * Y + G * H), je = -T * N - K * B - G * Y + (I * G + _ * K) * H, qe = -(I * T + K) * N + _ * (T * B + K * Y + G * H), he = y - tt * Be, le = $ - tt * Ve, ue = I - tt * je, ce = _ - tt * qe, fe = o(he, le, ue, ce);
3899
+ if (fe < W)
3900
+ y = he, $ = le, I = ue, _ = ce, W = fe;
3901
3901
  else
3902
3902
  break;
3903
3903
  }
@@ -4020,7 +4020,7 @@ let rt = class zt extends oe {
4020
4020
  return t.segmentType !== "CUBIC_BEZIER" ? !1 : k(this.firstPoint, t.firstPoint) && k(this.lastPoint, t.lastPoint) && k(this.firstControlPoint, t.firstControlPoint) && k(this.lastControlPoint, t.lastControlPoint);
4021
4021
  }
4022
4022
  distanceFrom(t) {
4023
- const e = li((n) => Ft(this.paramPoint(n), t), this.precision);
4023
+ const e = hi((n) => Ft(this.paramPoint(n), t), this.precision);
4024
4024
  return e.argMin < -this.precision || e.argMin > 1 + this.precision ? Math.min(
4025
4025
  J(this.firstPoint, t),
4026
4026
  J(this.lastPoint, t)
@@ -4150,7 +4150,7 @@ let rt = class zt extends oe {
4150
4150
  }
4151
4151
  paramsAtY(t) {
4152
4152
  const [e, n, s, r] = this.polynomialCoefficients[1];
4153
- return yi(e - t, n, s, r).filter((o) => o >= -this.precision && o <= 1 + this.precision);
4153
+ return Mi(e - t, n, s, r).filter((o) => o >= -this.precision && o <= 1 + this.precision);
4154
4154
  }
4155
4155
  pointToParam(t) {
4156
4156
  if (k(t, this.firstPoint, this.precision)) return 0;
@@ -4330,7 +4330,7 @@ let rt = class zt extends oe {
4330
4330
  )
4331
4331
  ), this.isValidParameter(this.thetaToParam(this.pointTheta(t))))
4332
4332
  return J(t, e);
4333
- if (Wi(t, this.majorAxis, this.center)) {
4333
+ if (Hi(t, this.majorAxis, this.center)) {
4334
4334
  const n = $t(
4335
4335
  2 * Math.PI - this.pointTheta(t)
4336
4336
  ), s = this.thetaToParam(n);
@@ -4518,7 +4518,7 @@ let et = class Dt extends oe {
4518
4518
  return t.segmentType !== "QUADRATIC_BEZIER" ? !1 : k(this.firstPoint, t.firstPoint) && k(this.lastPoint, t.lastPoint) && k(this.controlPoint, t.controlPoint);
4519
4519
  }
4520
4520
  distanceFrom(t) {
4521
- const e = li((n) => Ft(this.paramPoint(n), t), this.precision);
4521
+ const e = hi((n) => Ft(this.paramPoint(n), t), this.precision);
4522
4522
  return e.argMin < -this.precision || e.argMin > 1 + this.precision ? Math.min(
4523
4523
  J(this.firstPoint, t),
4524
4524
  J(this.lastPoint, t)
@@ -4715,7 +4715,7 @@ const gr = (i) => {
4715
4715
  ];
4716
4716
  throw new Error("Bug in the arc arc overlap algorithm");
4717
4717
  };
4718
- function bi(i, t, e = !1, n) {
4718
+ function yi(i, t, e = !1, n) {
4719
4719
  const s = n || i.precision, r = J(i.center, t.center), o = i.radius + t.radius;
4720
4720
  if (r > o + s)
4721
4721
  return [];
@@ -4744,7 +4744,7 @@ function bi(i, t, e = !1, n) {
4744
4744
  ), w = nt(h), g = X(u, Q(w, m)), p = X(u, Q(w, -m)), M = [];
4745
4745
  return i.isOnSegment(g) && t.isOnSegment(g) && M.push(g), i.isOnSegment(p) && t.isOnSegment(p) && M.push(p), M;
4746
4746
  }
4747
- function He(i, t, e = 1e-9) {
4747
+ function We(i, t, e = 1e-9) {
4748
4748
  const n = i.transform(t.ellipseReferenceFrameTransform), s = n.slope, r = n.yIntercept, o = t.majorRadius * t.majorRadius, a = t.minorRadius * t.minorRadius, h = t.majorRadius * t.minorRadius, l = n.slope * n.slope, c = n.yIntercept * n.yIntercept, u = (f) => f.map(
4749
4749
  (P) => t.reverseEllipseReferenceFrameTransform.transform(P)
4750
4750
  ).filter((P) => i.isOnSegment(P) && t.isOnSegment(P));
@@ -4773,7 +4773,7 @@ function He(i, t, e = 1e-9) {
4773
4773
  ];
4774
4774
  return u([p, M]);
4775
4775
  }
4776
- function xi(i, t) {
4776
+ function bi(i, t) {
4777
4777
  const e = Math.max(i.precision, t.precision), n = i.coefficients, s = n.x2, r = n.xy, o = n.y2, a = n.x, h = n.y, l = n.c, c = t.coefficients, u = c.x2, m = c.xy, w = c.y2, g = c.x, p = c.y, M = c.c, f = {
4778
4778
  z0: l * s * g * g + s * s * M * M - a * s * g * M + u * u * l * l - 2 * s * M * u * l - a * g * u * l + u * a * a * M,
4779
4779
  z1: p * a * a * u - M * g * s * r - 2 * s * M * u * h - l * u * m * a + 2 * g * m * s * l + 2 * p * M * s * s + g * g * s * h - p * g * s * a - 2 * s * p * u * l - l * u * g * r + 2 * l * h * u * u - M * m * s * a - h * u * g * a + 2 * M * r * u * a,
@@ -4798,8 +4798,8 @@ function xi(i, t) {
4798
4798
  });
4799
4799
  return At(P, e);
4800
4800
  }
4801
- function Rn(i, t) {
4802
- return xi(i, t).filter((e) => i.isOnSegment(e) && t.isOnSegment(e));
4801
+ function kn(i, t) {
4802
+ return bi(i, t).filter((e) => i.isOnSegment(e) && t.isOnSegment(e));
4803
4803
  }
4804
4804
  const wr = (i) => {
4805
4805
  const {
@@ -4859,9 +4859,9 @@ const wr = (i) => {
4859
4859
  };
4860
4860
  function Pr(i, t, e = !1) {
4861
4861
  const n = Math.max(i.precision, t.precision);
4862
- return k(i.center, t.center) && Math.abs(i.majorRadius - t.majorRadius) < n && Math.abs(i.minorRadius - t.minorRadius) < n && (Math.abs(i.tiltAngle - t.tiltAngle) < n || Math.abs(Math.abs(i.tiltAngle - t.tiltAngle) - Math.PI) < n) ? e ? dr(i, t) : [] : xi(i, t).filter((s) => i.isOnSegment(s) && t.isOnSegment(s));
4862
+ return k(i.center, t.center) && Math.abs(i.majorRadius - t.majorRadius) < n && Math.abs(i.minorRadius - t.minorRadius) < n && (Math.abs(i.tiltAngle - t.tiltAngle) < n || Math.abs(Math.abs(i.tiltAngle - t.tiltAngle) - Math.PI) < n) ? e ? dr(i, t) : [] : bi(i, t).filter((s) => i.isOnSegment(s) && t.isOnSegment(s));
4863
4863
  }
4864
- function Cn(i, t) {
4864
+ function Rn(i, t) {
4865
4865
  const [e, n] = i.firstPoint, [s, r] = i.lastPoint, o = new ct().translate(-e, -n).rotate(-Math.atan2(r - n, s - e)), a = o.clone().inverse(), h = t.transform(o);
4866
4866
  return h.paramsAtY(0).map((l) => h.paramPoint(l)).map((l) => a.transform(l)).filter((l) => i.isOnSegment(l));
4867
4867
  }
@@ -4869,7 +4869,7 @@ const Mr = (i, t = 1e-9) => {
4869
4869
  let e = i;
4870
4870
  return Math.abs(i) < t && (e = 0), e.toFixed(-Math.log10(t));
4871
4871
  };
4872
- function vi(i, t = 1e-9) {
4872
+ function xi(i, t = 1e-9) {
4873
4873
  return Array.from(
4874
4874
  new Map(i.map((e) => [Mr(e, t), e])).values()
4875
4875
  );
@@ -4878,30 +4878,30 @@ const yr = (i, t) => {
4878
4878
  const [[e, n, s, r], [o, a, h, l]] = t.polynomialCoefficients, c = i.coefficients, u = c.x2, m = c.xy, w = c.y2, g = c.x, p = c.y, M = c.c, f = e * e, P = n * n, b = s * s, R = r * r, C = o * o, V = a * a, v = h * h, S = l * l, j = M + g * e + u * f + p * o + m * e * o + w * C, d = g * n + 2 * u * e * n + m * n * o + p * a + m * e * a + 2 * w * o * a, x = u * P + g * s + 2 * u * e * s + m * s * o + m * n * a + w * V + p * h + m * e * h + 2 * w * o * h, A = 2 * u * n * s + g * r + 2 * u * e * r + m * r * o + m * s * a + m * n * h + 2 * w * a * h + p * l + m * e * l + 2 * w * o * l, y = u * b + 2 * u * n * r + m * r * a + m * s * h + w * v + m * n * l + 2 * w * a * l, $ = 2 * u * s * r + m * r * h + m * s * l + 2 * w * h * l, I = u * R + m * r * l + w * S;
4879
4879
  return [j, d, x, A, y, $, I];
4880
4880
  };
4881
- function Tn(i, t) {
4881
+ function Cn(i, t) {
4882
4882
  const e = Math.max(i.precision, t.precision), n = yr(i, t), s = hn(n, e).filter((r) => r >= -t.precision && r <= 1 + t.precision);
4883
- return vi(s, e).map((r) => t.paramPoint(r)).filter((r) => i.isOnSegment(r));
4883
+ return xi(s, e).map((r) => t.paramPoint(r)).filter((r) => i.isOnSegment(r));
4884
4884
  }
4885
4885
  const br = (i, t) => {
4886
4886
  const [[e, n, s], [r, o, a]] = t.polynomialCoefficients, h = i.coefficients, l = h.x2, c = h.xy, u = h.y2, m = h.x, w = h.y, g = h.c, p = e * e, M = n * n, f = s * s, P = r * r, b = o * o, R = a * a, C = l * p + c * e * r + u * P + m * e + w * r + g, V = 2 * l * e * n + c * e * o + c * n * r + 2 * u * r * o + m * n + w * o, v = 2 * l * e * s + l * M + c * e * a + c * n * o + c * s * r + 2 * u * r * a + u * b + m * s + w * a, S = 2 * l * n * s + c * n * a + c * s * o + 2 * u * o * a, j = l * f + c * s * a + u * R;
4887
4887
  return [C, V, v, S, j];
4888
4888
  };
4889
- function $n(i, t) {
4889
+ function Tn(i, t) {
4890
4890
  const e = Math.max(i.precision, t.precision), n = br(i, t), s = ir(...n).filter((r) => r >= -t.precision && r <= 1 + t.precision);
4891
- return vi(s, e).map((r) => t.paramPoint(r)).filter((r) => i.isOnSegment(r));
4891
+ return xi(s, e).map((r) => t.paramPoint(r)).filter((r) => i.isOnSegment(r));
4892
4892
  }
4893
4893
  function lt(i, { firstPoint: t, lastPoint: e }, n = 1e-9) {
4894
4894
  const s = q(e, t);
4895
4895
  return Math.abs(s[0]) < n ? s[1] > 0 ? t[0] - i[0] : i[0] - t[0] : Math.abs(s[1]) < n ? s[0] > 0 ? i[1] - t[1] : t[1] - i[1] : bt(s, q(i, t)) / Xi(s);
4896
4896
  }
4897
- class un {
4897
+ let un = class {
4898
4898
  constructor(t, e, n, s) {
4899
4899
  this.firstPoint = t, this.lastPoint = e, this.negativeThickness = n, this.positiveThickness = s;
4900
4900
  }
4901
4901
  get width() {
4902
4902
  return this.positiveThickness - this.negativeThickness;
4903
4903
  }
4904
- }
4904
+ };
4905
4905
  const xr = 3 / 4, vr = 4 / 9;
4906
4906
  function Ar(i) {
4907
4907
  const t = lt(i.firstControlPoint, i), e = lt(i.lastControlPoint, i), n = t * e > 0 ? xr : vr;
@@ -4946,7 +4946,7 @@ function kr(i) {
4946
4946
  Math.max(...r)
4947
4947
  );
4948
4948
  }
4949
- function In(i, t) {
4949
+ function $n(i, t) {
4950
4950
  const e = [];
4951
4951
  for (let n = 1; n < i.length; n++) {
4952
4952
  const s = i[n];
@@ -4964,7 +4964,7 @@ function In(i, t) {
4964
4964
  }
4965
4965
  return e;
4966
4966
  }
4967
- class Wt {
4967
+ class Ht {
4968
4968
  constructor(t, e) {
4969
4969
  this.from = t, this.to = e;
4970
4970
  }
@@ -5024,30 +5024,30 @@ class Tr {
5024
5024
  return this.distances[3];
5025
5025
  }
5026
5026
  }
5027
- function _n(i, t) {
5028
- const e = Rr(t, i), n = In(
5027
+ function In(i, t) {
5028
+ const e = Rr(t, i), n = $n(
5029
5029
  e.topHull,
5030
5030
  i.negativeThickness
5031
- ), s = In(
5031
+ ), s = $n(
5032
5032
  e.bottomHull,
5033
5033
  i.positiveThickness
5034
5034
  ), r = e.endDistance >= i.negativeThickness && e.endDistance <= i.positiveThickness;
5035
5035
  if (!n.length && !s.length)
5036
- return r ? new Wt("start", "end") : null;
5036
+ return r ? new Ht("start", "end") : null;
5037
5037
  if (n.length === 1 && s.length === 1)
5038
- return new Wt(n[0], s[0]);
5038
+ return new Ht(n[0], s[0]);
5039
5039
  if (n.length === 2 && s.length === 2)
5040
5040
  throw new Error(
5041
5041
  "Bug in the clipping algorithm, unexpected number of crossing points"
5042
5042
  );
5043
5043
  const o = n.length ? n : s;
5044
- return o.length === 2 ? new Wt(o[0], o[1]) : r ? new Wt(o[0], "end") : new Wt("start", o[0]);
5044
+ return o.length === 2 ? new Ht(o[0], o[1]) : r ? new Ht(o[0], "end") : new Ht("start", o[0]);
5045
5045
  }
5046
- function Fn(i, t) {
5047
- const e = Sr(i), n = _n(e, t);
5046
+ function _n(i, t) {
5047
+ const e = Sr(i), n = In(e, t);
5048
5048
  if (!n)
5049
5049
  return null;
5050
- const s = kr(i), r = _n(
5050
+ const s = kr(i), r = In(
5051
5051
  s,
5052
5052
  t
5053
5053
  );
@@ -5058,9 +5058,9 @@ function It(i, t, e = 1e-9, { maxIterations: n = 100 } = {}) {
5058
5058
  const s = Math.max(e * e, Number.EPSILON * 10);
5059
5059
  let r = i, o = t, a = be(r), h = be(o);
5060
5060
  for (let l = 0; l < n; l++) {
5061
- const c = a > s ? Fn(o, r) : r;
5061
+ const c = a > s ? _n(o, r) : r;
5062
5062
  if (!c) return [];
5063
- const u = be(c), m = h > s ? Fn(c, o) : o;
5063
+ const u = be(c), m = h > s ? _n(c, o) : o;
5064
5064
  if (!m) return [];
5065
5065
  const w = be(m);
5066
5066
  if (u <= s && w <= s)
@@ -5163,7 +5163,7 @@ function Fr(i, t, e = !1) {
5163
5163
  }
5164
5164
  function Lr(i, t, e) {
5165
5165
  if (i instanceof D && t instanceof D) {
5166
- const n = ai(
5166
+ const n = oi(
5167
5167
  i,
5168
5168
  t,
5169
5169
  !1,
@@ -5176,12 +5176,12 @@ function Lr(i, t, e) {
5176
5176
  if (i instanceof z && t instanceof D)
5177
5177
  return Re(t, i, e);
5178
5178
  if (i instanceof z && t instanceof z)
5179
- return bi(i, t, !1, e);
5179
+ return yi(i, t, !1, e);
5180
5180
  throw new Error("Not implemented");
5181
5181
  }
5182
5182
  function ie(i, t, e) {
5183
5183
  if (i instanceof D && t instanceof D) {
5184
- const n = ai(
5184
+ const n = oi(
5185
5185
  i,
5186
5186
  t,
5187
5187
  !0,
@@ -5200,7 +5200,7 @@ function ie(i, t, e) {
5200
5200
  return { intersections: n, overlaps: [], count: n.length };
5201
5201
  }
5202
5202
  if (i instanceof z && t instanceof z) {
5203
- const n = bi(
5203
+ const n = yi(
5204
5204
  i,
5205
5205
  t,
5206
5206
  !0,
@@ -5217,7 +5217,7 @@ function ie(i, t, e) {
5217
5217
  } : { intersections: [], overlaps: [], count: 0 };
5218
5218
  }
5219
5219
  if (i instanceof D && t instanceof at) {
5220
- const n = He(
5220
+ const n = We(
5221
5221
  i,
5222
5222
  t,
5223
5223
  e
@@ -5225,7 +5225,7 @@ function ie(i, t, e) {
5225
5225
  return { intersections: n, overlaps: [], count: n.length };
5226
5226
  }
5227
5227
  if (t instanceof D && i instanceof at) {
5228
- const n = He(
5228
+ const n = We(
5229
5229
  t,
5230
5230
  i,
5231
5231
  e
@@ -5233,11 +5233,11 @@ function ie(i, t, e) {
5233
5233
  return { intersections: n, overlaps: [], count: n.length };
5234
5234
  }
5235
5235
  if (i instanceof z && t instanceof at) {
5236
- const n = Rn(i, t);
5236
+ const n = kn(i, t);
5237
5237
  return { intersections: n, overlaps: [], count: n.length };
5238
5238
  }
5239
5239
  if (t instanceof z && i instanceof at) {
5240
- const n = Rn(t, i);
5240
+ const n = kn(t, i);
5241
5241
  return { intersections: n, overlaps: [], count: n.length };
5242
5242
  }
5243
5243
  if (i instanceof at && t instanceof at) {
@@ -5257,27 +5257,27 @@ function ie(i, t, e) {
5257
5257
  } : { intersections: [], overlaps: [], count: 0 };
5258
5258
  }
5259
5259
  if (i instanceof D && (t instanceof rt || t instanceof et)) {
5260
- const n = Cn(i, t);
5260
+ const n = Rn(i, t);
5261
5261
  return { intersections: n, overlaps: [], count: n.length };
5262
5262
  }
5263
5263
  if (t instanceof D && (i instanceof rt || i instanceof et)) {
5264
- const n = Cn(t, i);
5264
+ const n = Rn(t, i);
5265
5265
  return { intersections: n, overlaps: [], count: n.length };
5266
5266
  }
5267
5267
  if ((i instanceof z || i instanceof at) && t instanceof et) {
5268
- const n = $n(i, t);
5268
+ const n = Tn(i, t);
5269
5269
  return { intersections: n, overlaps: [], count: n.length };
5270
5270
  }
5271
5271
  if ((t instanceof z || t instanceof at) && i instanceof et) {
5272
- const n = $n(t, i);
5272
+ const n = Tn(t, i);
5273
5273
  return { intersections: n, overlaps: [], count: n.length };
5274
5274
  }
5275
5275
  if ((i instanceof z || i instanceof at) && t instanceof rt) {
5276
- const n = Tn(i, t);
5276
+ const n = Cn(i, t);
5277
5277
  return { intersections: n, overlaps: [], count: n.length };
5278
5278
  }
5279
5279
  if ((t instanceof z || t instanceof at) && i instanceof rt) {
5280
- const n = Tn(t, i);
5280
+ const n = Cn(t, i);
5281
5281
  return { intersections: n, overlaps: [], count: n.length };
5282
5282
  }
5283
5283
  if (i instanceof et && t instanceof et) {
@@ -5316,20 +5316,20 @@ function ie(i, t, e) {
5316
5316
  }
5317
5317
  throw new Error("Not implemented");
5318
5318
  }
5319
- function Ai(i) {
5319
+ function vi(i) {
5320
5320
  const t = [];
5321
5321
  for (let e = 0; e < i; e++)
5322
5322
  for (let n = 0; n <= e; n++)
5323
5323
  t.push([e, n]);
5324
5324
  return t;
5325
5325
  }
5326
- function* We(i) {
5327
- for (const [t, e] of Ai(i.length))
5326
+ function* He(i) {
5327
+ for (const [t, e] of vi(i.length))
5328
5328
  t !== e && (yield [i[t], i[e]]);
5329
5329
  }
5330
- class Ei extends Lt {
5330
+ class Ai extends Lt {
5331
5331
  constructor(t, { ignoreChecks: e = !1 } = {}) {
5332
- super(), ut(this, "segments"), ut(this, "_boundingBox", null), e || Si(t), this.segments = t;
5332
+ super(), ut(this, "segments"), ut(this, "_boundingBox", null), e || Ei(t), this.segments = t;
5333
5333
  }
5334
5334
  get repr() {
5335
5335
  return this.segments.map((t) => t.repr).join(`
@@ -5375,7 +5375,7 @@ class Ei extends Lt {
5375
5375
  }
5376
5376
  }
5377
5377
  function Br(i, t = "Stroke") {
5378
- Ai(i.length).forEach(
5378
+ vi(i.length).forEach(
5379
5379
  ([e, n]) => {
5380
5380
  if (e === n) return;
5381
5381
  const s = i[e], r = i[n], o = ie(s, r), a = Math.max(s.precision, r.precision);
@@ -5411,7 +5411,7 @@ function Br(i, t = "Stroke") {
5411
5411
  }
5412
5412
  );
5413
5413
  }
5414
- function Si(i, t = "Stroke") {
5414
+ function Ei(i, t = "Stroke") {
5415
5415
  if (i.length === 0)
5416
5416
  throw new Error(`${t} must have at least one segment`);
5417
5417
  Pt([i.slice(0, -1), i.slice(1)]).forEach(
@@ -5423,10 +5423,10 @@ function Si(i, t = "Stroke") {
5423
5423
  }
5424
5424
  ), Br(i, t);
5425
5425
  }
5426
- function Ln(i, t) {
5426
+ function Fn(i, t) {
5427
5427
  return !!(i instanceof D && t instanceof D && sn(i.V, t.V) || i instanceof z && t instanceof z && k(i.center, t.center) && i.radius - t.radius < i.precision);
5428
5428
  }
5429
- function Bn(i, t) {
5429
+ function Ln(i, t) {
5430
5430
  if (i instanceof D && t instanceof D)
5431
5431
  return new D(i.firstPoint, t.lastPoint);
5432
5432
  if (i instanceof z && t instanceof z)
@@ -5438,7 +5438,7 @@ function Bn(i, t) {
5438
5438
  );
5439
5439
  throw new Error("Not implemented");
5440
5440
  }
5441
- function ki(i) {
5441
+ function Si(i) {
5442
5442
  let t = !1;
5443
5443
  const e = [];
5444
5444
  for (const n of i.segments) {
@@ -5447,19 +5447,19 @@ function ki(i) {
5447
5447
  continue;
5448
5448
  }
5449
5449
  const s = e[e.length - 1];
5450
- Ln(s, n) ? (t = !0, e.pop(), e.push(Bn(s, n))) : e.push(n);
5450
+ Fn(s, n) ? (t = !0, e.pop(), e.push(Ln(s, n))) : e.push(n);
5451
5451
  }
5452
- if (k(i.firstPoint, i.lastPoint) && Ln(
5452
+ if (k(i.firstPoint, i.lastPoint) && Fn(
5453
5453
  e[0],
5454
5454
  e[e.length - 1]
5455
5455
  )) {
5456
5456
  t = !0;
5457
5457
  const n = e.pop();
5458
- e[0] = Bn(n, e[0]);
5458
+ e[0] = Ln(n, e[0]);
5459
5459
  }
5460
5460
  return t ? e : null;
5461
5461
  }
5462
- let Rt = class Ut extends Ei {
5462
+ let Rt = class Ut extends Ai {
5463
5463
  constructor() {
5464
5464
  super(...arguments), ut(this, "strokeType", "STRAND");
5465
5465
  }
@@ -5479,7 +5479,7 @@ let Rt = class Ut extends Ei {
5479
5479
  return new Ut([...this.segments, ...t.segments]);
5480
5480
  }
5481
5481
  simplify() {
5482
- const t = ki(this);
5482
+ const t = Si(this);
5483
5483
  return t ? new Ut(t, { ignoreChecks: !0 }) : this;
5484
5484
  }
5485
5485
  transform(t) {
@@ -5505,7 +5505,7 @@ const Vr = (i, t) => {
5505
5505
  }
5506
5506
  return 1;
5507
5507
  };
5508
- let cn = class {
5508
+ class cn {
5509
5509
  constructor(t) {
5510
5510
  ut(this, "_count", 0), ut(this, "segment"), this.segment = t;
5511
5511
  }
@@ -5515,7 +5515,7 @@ let cn = class {
5515
5515
  get count() {
5516
5516
  return this._count;
5517
5517
  }
5518
- };
5518
+ }
5519
5519
  const jr = (i, t) => {
5520
5520
  const e = t.precision, n = Math.abs(i[1] - t.center[1]);
5521
5521
  if (n > t.radius + e) return 0;
@@ -5530,7 +5530,7 @@ const jr = (i, t) => {
5530
5530
  return l.update([t.center[0] + h, i[1]]), a && l.update([t.center[0] - h, i[1]]), l.count;
5531
5531
  }, qr = (i, t) => {
5532
5532
  const e = t.boundingBox.xMax + t.boundingBox.width / 2, n = new D(i, [e, i[1]]), s = new cn(t);
5533
- return He(n, t).forEach((r) => {
5533
+ return We(n, t).forEach((r) => {
5534
5534
  s.update(r, !0);
5535
5535
  }), s.count;
5536
5536
  }, Nr = (i, t) => {
@@ -5559,7 +5559,7 @@ function Or(i, t) {
5559
5559
  return Nr(i, t);
5560
5560
  throw new Error("Not implemented");
5561
5561
  }
5562
- class dt extends Ei {
5562
+ class dt extends Ai {
5563
5563
  constructor(t, { ignoreChecks: e = !1 } = {}) {
5564
5564
  super(t, { ignoreChecks: !0 }), ut(this, "strokeType", "LOOP"), ut(this, "_clockwise", null), e || zr(t);
5565
5565
  }
@@ -5593,12 +5593,12 @@ class dt extends Ei {
5593
5593
  return this.onStroke(t) || !this.boundingBox.contains(t) ? !1 : this.segments.reduce((e, n) => e + Or(t, n), 0) % 2 === 1;
5594
5594
  }
5595
5595
  simplify() {
5596
- const t = ki(this);
5596
+ const t = Si(this);
5597
5597
  return t ? new dt(t, { ignoreChecks: !0 }) : this;
5598
5598
  }
5599
5599
  }
5600
5600
  function zr(i) {
5601
- if (Si(i, "Loop"), !k(i[0].firstPoint, i[i.length - 1].lastPoint))
5601
+ if (Ei(i, "Loop"), !k(i[0].firstPoint, i[i.length - 1].lastPoint))
5602
5602
  throw new Error("Loop segment must be closed");
5603
5603
  }
5604
5604
  const Dr = [
@@ -5608,10 +5608,10 @@ const Dr = [
5608
5608
  et,
5609
5609
  rt
5610
5610
  ];
5611
- function Ri(i) {
5611
+ function ki(i) {
5612
5612
  return Dr.some((t) => i instanceof t);
5613
5613
  }
5614
- function Ci(i) {
5614
+ function Ri(i) {
5615
5615
  if (i instanceof D)
5616
5616
  return {
5617
5617
  type: i.segmentType,
@@ -5657,10 +5657,10 @@ function Ci(i) {
5657
5657
  function Qe(i) {
5658
5658
  return {
5659
5659
  type: "LOOP",
5660
- segments: i.segments.map(Ci)
5660
+ segments: i.segments.map(Ri)
5661
5661
  };
5662
5662
  }
5663
- function Ti(i) {
5663
+ function Ci(i) {
5664
5664
  return {
5665
5665
  type: "FIGURE",
5666
5666
  contour: Qe(i.contour),
@@ -5670,18 +5670,18 @@ function Ti(i) {
5670
5670
  function Ur(i) {
5671
5671
  return {
5672
5672
  type: "DIAGRAM",
5673
- figures: i.figures.map(Ti)
5673
+ figures: i.figures.map(Ci)
5674
5674
  };
5675
5675
  }
5676
- function Vn(i) {
5676
+ function Bn(i) {
5677
5677
  if (i instanceof ae)
5678
5678
  return Ur(i);
5679
5679
  if (i instanceof mt)
5680
- return Ti(i);
5680
+ return Ci(i);
5681
5681
  if (i instanceof dt)
5682
5682
  return Qe(i);
5683
- if (Ri(i))
5684
- return Ci(i);
5683
+ if (ki(i))
5684
+ return Ri(i);
5685
5685
  throw new Error("Unknown shape type");
5686
5686
  }
5687
5687
  class Yr {
@@ -5730,8 +5730,8 @@ class Yr {
5730
5730
  this.ids.length = this.values.length = this.length;
5731
5731
  }
5732
5732
  }
5733
- const jn = [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array], ze = 3;
5734
- class fn {
5733
+ const Vn = [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array], ze = 3;
5734
+ let Xr = class Ti {
5735
5735
  /**
5736
5736
  * Recreate a Flatbush index from raw `ArrayBuffer` or `SharedArrayBuffer` data.
5737
5737
  * @param {ArrayBuffer | SharedArrayBuffer} data
@@ -5749,11 +5749,11 @@ class fn {
5749
5749
  const r = s >> 4;
5750
5750
  if (r !== ze)
5751
5751
  throw new Error(`Got v${r} data when expected v${ze}.`);
5752
- const o = jn[s & 15];
5752
+ const o = Vn[s & 15];
5753
5753
  if (!o)
5754
5754
  throw new Error("Unrecognized array type.");
5755
5755
  const [a] = new Uint16Array(t, e + 2, 1), [h] = new Uint32Array(t, e + 4, 1);
5756
- return new fn(h, a, o, void 0, t, e);
5756
+ return new Ti(h, a, o, void 0, t, e);
5757
5757
  }
5758
5758
  /**
5759
5759
  * Create a Flatbush index that will hold a given number of items.
@@ -5774,7 +5774,7 @@ class fn {
5774
5774
  a = Math.ceil(a / this.nodeSize), h += a, this._levelBounds.push(h * 4);
5775
5775
  while (a !== 1);
5776
5776
  this.ArrayType = n, this.IndexArrayType = h < 16384 ? Uint16Array : Uint32Array;
5777
- const l = jn.indexOf(this.ArrayType), c = h * 4 * this.ArrayType.BYTES_PER_ELEMENT;
5777
+ const l = Vn.indexOf(this.ArrayType), c = h * 4 * this.ArrayType.BYTES_PER_ELEMENT;
5778
5778
  if (l < 0)
5779
5779
  throw new Error(`Unexpected typed array class: ${n}.`);
5780
5780
  r && r.byteLength !== void 0 && !r.buffer ? (this.data = r, this._boxes = new this.ArrayType(this.data, o + 8, h * 4), this._indices = new this.IndexArrayType(this.data, o + 8 + c, h), this._pos = h * 4, this.minX = this._boxes[this._pos - 4], this.minY = this._boxes[this._pos - 3], this.maxX = this._boxes[this._pos - 2], this.maxY = this._boxes[this._pos - 1]) : (this.data = new s(8 + c + h * this.IndexArrayType.BYTES_PER_ELEMENT), this._boxes = new this.ArrayType(this.data, 8, h * 4), this._indices = new this.IndexArrayType(this.data, 8 + c, h), this._pos = 0, this.minX = 1 / 0, this.minY = 1 / 0, this.maxX = -1 / 0, this.maxY = -1 / 0, new Uint8Array(this.data, 0, 2).set([251, (ze << 4) + l]), new Uint16Array(this.data, 2, 1)[0] = e, new Uint32Array(this.data, 4, 1)[0] = t), this._queue = new Yr();
@@ -5832,7 +5832,7 @@ class fn {
5832
5832
  let o = this._boxes.length - 4;
5833
5833
  const a = [], h = [];
5834
5834
  for (; o !== void 0; ) {
5835
- const l = Math.min(o + this.nodeSize * 4, Nn(o, this._levelBounds));
5835
+ const l = Math.min(o + this.nodeSize * 4, qn(o, this._levelBounds));
5836
5836
  for (let c = o; c < l; c += 4) {
5837
5837
  if (n < this._boxes[c] || s < this._boxes[c + 1] || t > this._boxes[c + 2] || e > this._boxes[c + 3]) continue;
5838
5838
  const u = this._indices[c >> 2] | 0;
@@ -5857,9 +5857,9 @@ class fn {
5857
5857
  let o = this._boxes.length - 4;
5858
5858
  const a = this._queue, h = [], l = s * s;
5859
5859
  t: for (; o !== void 0; ) {
5860
- const c = Math.min(o + this.nodeSize * 4, Nn(o, this._levelBounds));
5860
+ const c = Math.min(o + this.nodeSize * 4, qn(o, this._levelBounds));
5861
5861
  for (let u = o; u < c; u += 4) {
5862
- const m = this._indices[u >> 2] | 0, w = qn(t, this._boxes[u], this._boxes[u + 2]), g = qn(e, this._boxes[u + 1], this._boxes[u + 3]), p = w * w + g * g;
5862
+ const m = this._indices[u >> 2] | 0, w = jn(t, this._boxes[u], this._boxes[u + 2]), g = jn(e, this._boxes[u + 1], this._boxes[u + 3]), p = w * w + g * g;
5863
5863
  p > l || (o >= this.numItems * 4 ? a.push(m << 1, p) : (r === void 0 || r(m)) && a.push((m << 1) + 1, p));
5864
5864
  }
5865
5865
  for (; a.length && a.peek() & 1; )
@@ -5868,11 +5868,11 @@ class fn {
5868
5868
  }
5869
5869
  return a.clear(), h;
5870
5870
  }
5871
- }
5872
- function qn(i, t, e) {
5871
+ };
5872
+ function jn(i, t, e) {
5873
5873
  return i < t ? t - i : i <= e ? 0 : i - e;
5874
5874
  }
5875
- function Nn(i, t) {
5875
+ function qn(i, t) {
5876
5876
  let e = 0, n = t.length - 1;
5877
5877
  for (; e < n; ) {
5878
5878
  const s = e + n >> 1;
@@ -5892,11 +5892,11 @@ function Ge(i, t, e, n, s, r) {
5892
5892
  h--;
5893
5893
  while (i[h] > o);
5894
5894
  if (a >= h) break;
5895
- Xr(i, t, e, a, h);
5895
+ Wr(i, t, e, a, h);
5896
5896
  }
5897
5897
  Ge(i, t, e, n, h, r), Ge(i, t, e, h + 1, s, r);
5898
5898
  }
5899
- function Xr(i, t, e, n, s) {
5899
+ function Wr(i, t, e, n, s) {
5900
5900
  const r = i[n];
5901
5901
  i[n] = i[s], i[s] = r;
5902
5902
  const o = 4 * n, a = 4 * s, h = t[o], l = t[o + 1], c = t[o + 2], u = t[o + 3];
@@ -5913,7 +5913,7 @@ function Hr(i, t) {
5913
5913
  function $i(i, t = 1e-7) {
5914
5914
  if (i.length === 0) return [];
5915
5915
  if (i.length === 1) return [i];
5916
- const e = new fn(i.length);
5916
+ const e = new Xr(i.length);
5917
5917
  i.forEach((r) => {
5918
5918
  const [o, a] = r.firstPoint;
5919
5919
  e.add(o - t, a - t, o + t, a + t);
@@ -5949,7 +5949,7 @@ function $i(i, t = 1e-7) {
5949
5949
  }
5950
5950
  let mt = class Ee extends Lt {
5951
5951
  constructor(t, e = [], { ignoreChecks: n = !1 } = {}) {
5952
- super(), ut(this, "contour"), ut(this, "holes"), n || Wr(t, e), this.contour = t, this.holes = e;
5952
+ super(), ut(this, "contour"), ut(this, "holes"), n || Qr(t, e), this.contour = t, this.holes = e;
5953
5953
  }
5954
5954
  get boundingBox() {
5955
5955
  return this.contour.boundingBox;
@@ -5985,20 +5985,20 @@ let mt = class Ee extends Lt {
5985
5985
  return $i(n).map((s) => new Rt(s));
5986
5986
  }
5987
5987
  };
5988
- function Wr(i, t = []) {
5988
+ function Qr(i, t = []) {
5989
5989
  if (!i) throw new Error("Figure must have a contour");
5990
- for (const [e, n] of We([i, ...t]))
5990
+ for (const [e, n] of He([i, ...t]))
5991
5991
  if (e.intersects(n))
5992
5992
  throw new Error("Loops in a figure must not intersect");
5993
5993
  if (t.some(
5994
5994
  (e) => !i.contains(e.firstPoint) && !i.onStroke(e.firstPoint)
5995
5995
  ))
5996
5996
  throw new Error("Holes must be inside the contour");
5997
- for (const [e, n] of We(t))
5997
+ for (const [e, n] of He(t))
5998
5998
  if (e.contains(n.firstPoint))
5999
- throw console.error(Vn(e), Vn(n)), new Error("Holes must not be inside other holes");
5999
+ throw console.error(Bn(e), Bn(n)), new Error("Holes must not be inside other holes");
6000
6000
  }
6001
- const Qr = (i) => {
6001
+ const Gr = (i) => {
6002
6002
  const t = i.map((s, r) => i.slice(r + 1).map((o, a) => [a + r + 1, o]).filter(([, o]) => s.boundingBox.overlaps(o.boundingBox)).map(([o]) => o)), e = [], n = Array(t.length);
6003
6003
  return t.forEach((s, r) => {
6004
6004
  let o = n[r];
@@ -6012,29 +6012,29 @@ const Qr = (i) => {
6012
6012
  loop: t,
6013
6013
  isIn: s
6014
6014
  };
6015
- }), Gr = (i, t) => i.flatMap(({ loop: e }) => mn(
6015
+ }), Jr = (i, t) => i.flatMap(({ loop: e }) => fn(
6016
6016
  t.filter(
6017
6017
  ({ loop: n, isIn: s }) => n === e || s.indexOf(e) !== -1
6018
6018
  )
6019
- )), Jr = (i, t) => {
6020
- const e = t.filter(({ isIn: s }) => s.length <= 1), n = mn(
6019
+ )), Zr = (i, t) => {
6020
+ const e = t.filter(({ isIn: s }) => s.length <= 1), n = fn(
6021
6021
  Ii(i.map(({ loop: s }) => s))
6022
6022
  );
6023
6023
  return [e, ...n];
6024
- }, mn = (i) => {
6024
+ }, fn = (i) => {
6025
6025
  if (!i.length) return [];
6026
6026
  const t = i.filter(({ isIn: n }) => !n.length), e = i.filter(({ isIn: n }) => n.length > 1);
6027
- return t.length === 1 && e.length === 0 ? [i] : t.length > 1 ? Gr(t, i) : Jr(e, i);
6027
+ return t.length === 1 && e.length === 0 ? [i] : t.length > 1 ? Jr(t, i) : Zr(e, i);
6028
6028
  };
6029
6029
  function te(i) {
6030
- return Qr(i).map(Ii).flatMap(mn).map((t) => {
6030
+ return Gr(i).map(Ii).flatMap(fn).map((t) => {
6031
6031
  if (t.length === 1) return new mt(t[0].loop);
6032
6032
  t.sort((s, r) => s.isIn.length - r.isIn.length);
6033
6033
  const [e, ...n] = t.map(({ loop: s }) => s);
6034
6034
  return new mt(e, n);
6035
6035
  });
6036
6036
  }
6037
- function Zr(i, t) {
6037
+ function Kr(i, t) {
6038
6038
  const e = [];
6039
6039
  for (const n of i)
6040
6040
  for (const s of t)
@@ -6048,10 +6048,10 @@ function* Je(i, t, e) {
6048
6048
  n(o) ? (r.push(o), yield new Rt(r, { ignoreChecks: !0 }), r = []) : s(o) ? (r.length && (yield new Rt(r, { ignoreChecks: !0 }), r = []), yield new Rt([o], { ignoreChecks: !0 })) : r.push(o);
6049
6049
  r.length && (yield new Rt(r, { ignoreChecks: !0 }));
6050
6050
  }
6051
- const On = (i, t) => {
6051
+ const Nn = (i, t) => {
6052
6052
  const e = i.findIndex((s) => k(t, s.firstPoint)), n = i.slice(0, e);
6053
6053
  return i.slice(e).concat(n);
6054
- }, zn = (i, t) => {
6054
+ }, On = (i, t) => {
6055
6055
  let e = i;
6056
6056
  const n = (o) => k(o.firstPoint, t.firstPoint) && k(o.lastPoint, t.lastPoint);
6057
6057
  let s = i.findIndex(n);
@@ -6067,7 +6067,7 @@ const On = (i, t) => {
6067
6067
  const r = e.slice(0, s);
6068
6068
  return e.slice(s).concat(r);
6069
6069
  };
6070
- function Kr(i, t, e) {
6070
+ function to(i, t, e) {
6071
6071
  return i.filter((n) => {
6072
6072
  const s = t.filter((o) => k(o.firstPoint, n) || k(o.lastPoint, n));
6073
6073
  if (s.length % 2)
@@ -6076,7 +6076,7 @@ function Kr(i, t, e) {
6076
6076
  return !(r.every((o) => o) || !r.some((o) => o));
6077
6077
  });
6078
6078
  }
6079
- function to(i, t, e) {
6079
+ function eo(i, t, e) {
6080
6080
  let n = [];
6081
6081
  const s = [], r = new Array(i.segments.length).fill(0).map(() => []), o = new Array(t.segments.length).fill(0).map(() => []);
6082
6082
  if (i.segments.forEach((m, w) => {
@@ -6096,23 +6096,23 @@ function to(i, t, e) {
6096
6096
  }), n = At(n, e), !n.length || n.length === 1) return null;
6097
6097
  const a = ([m, w]) => w.length ? m.splitAt(w) : [m];
6098
6098
  let h = Pt([i.segments, r]).flatMap(a), l = Pt([t.segments, o]).flatMap(a);
6099
- if (n = Kr(
6099
+ if (n = to(
6100
6100
  n,
6101
6101
  h,
6102
6102
  t
6103
6103
  ), !n.length && !s.length) return null;
6104
6104
  if (s.length) {
6105
6105
  const m = s[0];
6106
- h = zn(
6106
+ h = On(
6107
6107
  h,
6108
6108
  m
6109
- ), l = zn(
6109
+ ), l = On(
6110
6110
  l,
6111
6111
  m
6112
6112
  );
6113
6113
  } else {
6114
6114
  const m = n[0];
6115
- h = On(h, m), l = On(l, m);
6115
+ h = Nn(h, m), l = Nn(l, m);
6116
6116
  }
6117
6117
  let c = Array.from(
6118
6118
  Je(
@@ -6132,7 +6132,7 @@ function to(i, t, e) {
6132
6132
  c[0].lastPoint
6133
6133
  ) || s.length > 0 && u[0].segmentsCount !== 1) && (u = u.map((m) => m.reverse()).reverse(), k(u[0].lastPoint, c[0].lastPoint) || (c = c.map((m) => m.reverse()).reverse())), Pt([c, u]).map(([m, w]) => m.segmentsCount === 1 && s.some((g) => m.segments[0].isSame(g)) ? [m, "same"] : [m, w]);
6134
6134
  }
6135
- function Dn(i) {
6135
+ function zn(i) {
6136
6136
  let t = i[0];
6137
6137
  for (const e of i.slice(1))
6138
6138
  t = t.extend(e);
@@ -6143,17 +6143,17 @@ function Dn(i) {
6143
6143
  ), new Error("Bug in the intersection algo on non closing strand");
6144
6144
  return new dt(t.segments);
6145
6145
  }
6146
- function eo(i, t) {
6146
+ function no(i, t) {
6147
6147
  const e = Pt([
6148
6148
  t.slice(0, -1),
6149
6149
  t.slice(1)
6150
- ]).map(([s, r]) => Dn(i.slice(s, r)));
6150
+ ]).map(([s, r]) => zn(i.slice(s, r)));
6151
6151
  let n = i.slice(
6152
6152
  t[t.length - 1]
6153
6153
  );
6154
- return t[0] !== 0 && (n = n.concat(i.slice(0, t[0]))), e.push(Dn(n)), e;
6154
+ return t[0] !== 0 && (n = n.concat(i.slice(0, t[0]))), e.push(zn(n)), e;
6155
6155
  }
6156
- function no(i) {
6156
+ function io(i) {
6157
6157
  if (!i.length) return [];
6158
6158
  const t = i.map((s) => s.firstPoint);
6159
6159
  let e = i.map((s) => s.lastPoint);
@@ -6162,21 +6162,21 @@ function no(i) {
6162
6162
  ([s, r], o) => k(s, r) ? [] : o
6163
6163
  );
6164
6164
  try {
6165
- return eo(i, n);
6165
+ return no(i, n);
6166
6166
  } catch {
6167
6167
  return $i(i.flatMap((s) => s.segments)).filter((s) => s.length > 1).filter((s) => k(s[0].firstPoint, s.at(-1).lastPoint)).map((s) => new dt(s));
6168
6168
  }
6169
6169
  }
6170
- const Un = (i, t) => {
6170
+ const Dn = (i, t) => {
6171
6171
  if (i.length === 0) return [t];
6172
6172
  const e = i.at(-1);
6173
6173
  return k(e.lastPoint, t.firstPoint) ? i.slice(0, -1).concat([e.extend(t)]) : k(e.lastPoint, t.lastPoint) ? i.slice(0, -1).concat([e.extend(t.reverse())]) : i.concat([t]);
6174
- }, io = (i, t) => i.length === 0 ? [t] : k(i[0].firstPoint, t.lastPoint) ? [t.extend(i[0])].concat(i.slice(1)) : [t].concat(i);
6175
- function gn(i, t, {
6174
+ }, so = (i, t) => i.length === 0 ? [t] : k(i[0].firstPoint, t.lastPoint) ? [t.extend(i[0])].concat(i.slice(1)) : [t].concat(i);
6175
+ function mn(i, t, {
6176
6176
  firstInside: e,
6177
6177
  secondInside: n
6178
6178
  }) {
6179
- const s = to(i, t);
6179
+ const s = eo(i, t);
6180
6180
  if (!s) {
6181
6181
  const h = i.segments[0].midPoint, l = t.contains(h), c = t.segments[0].midPoint, u = i.contains(c);
6182
6182
  return {
@@ -6193,36 +6193,36 @@ function gn(i, t, {
6193
6193
  if (l === "same")
6194
6194
  return o === 1 ? (o = 1, h) : o === 2 || o === 0 ? (o = null, []) : o === null ? (r ? r = r.extend(h) : r = h, []) : (console.error("weird situation"), []);
6195
6195
  const m = h.segments[0].midPoint, w = t.contains(m);
6196
- (e === "keep" && w || e === "remove" && !w) && (u += 1, c = Un(c, h));
6196
+ (e === "keep" && w || e === "remove" && !w) && (u += 1, c = Dn(c, h));
6197
6197
  const g = l.segments[0].midPoint, p = i.contains(g);
6198
6198
  if (n === "keep" && p || n === "remove" && !p) {
6199
6199
  const M = l;
6200
- u += 1, u === 2 && c.length ? (c = Un(c, M), r = null) : c = [M];
6200
+ u += 1, u === 2 && c.length ? (c = Dn(c, M), r = null) : c = [M];
6201
6201
  }
6202
- return o === null && u === 1 && r && (c = io(c, r)), u === 1 && (o = u, r = null), c.length ? c : (r = null, []);
6202
+ return o === null && u === 1 && r && (c = so(c, r)), u === 1 && (o = u, r = null), c.length ? c : (r = null, []);
6203
6203
  });
6204
- return no(a);
6204
+ return io(a);
6205
6205
  }
6206
- const so = (i, t) => {
6207
- const e = gn(i, t, {
6206
+ const ro = (i, t) => {
6207
+ const e = mn(i, t, {
6208
6208
  firstInside: "remove",
6209
6209
  secondInside: "remove"
6210
6210
  });
6211
6211
  return Array.isArray(e) ? e : e.identical ? [i] : e.firstCurveInSecond ? [t] : e.secondCurveInFirst ? [i] : [i, t];
6212
6212
  }, Ce = (i, t) => {
6213
- const e = gn(i, t, {
6213
+ const e = mn(i, t, {
6214
6214
  firstInside: "remove",
6215
6215
  secondInside: "keep"
6216
6216
  });
6217
6217
  return Array.isArray(e) ? e : e.identical ? [] : e.firstCurveInSecond ? [] : e.secondCurveInFirst ? [i, t] : [i];
6218
- }, pn = (i, t) => {
6219
- const e = gn(i, t, {
6218
+ }, gn = (i, t) => {
6219
+ const e = mn(i, t, {
6220
6220
  firstInside: "keep",
6221
6221
  secondInside: "keep"
6222
6222
  });
6223
6223
  return Array.isArray(e) ? e : e.identical ? [i] : e.firstCurveInSecond ? [i] : e.secondCurveInFirst ? [t] : [];
6224
6224
  };
6225
- function ro(i) {
6225
+ function oo(i) {
6226
6226
  const t = /* @__PURE__ */ new Map(), e = [];
6227
6227
  return i.forEach((n, s) => {
6228
6228
  let r;
@@ -6239,8 +6239,8 @@ function ro(i) {
6239
6239
  }), e.flatMap(({ current: n }) => n);
6240
6240
  }
6241
6241
  function _i(i, t) {
6242
- const e = so(i.contour, t.contour), n = t.holes.flatMap((o) => Ce(o, i.contour)), s = i.holes.flatMap((o) => Ce(o, t.contour)), r = Zr(i.holes, t.holes).flatMap(
6243
- ([o, a]) => pn(o, a)
6242
+ const e = ro(i.contour, t.contour), n = t.holes.flatMap((o) => Ce(o, i.contour)), s = i.holes.flatMap((o) => Ce(o, t.contour)), r = Kr(i.holes, t.holes).flatMap(
6243
+ ([o, a]) => gn(o, a)
6244
6244
  );
6245
6245
  return te([
6246
6246
  ...e,
@@ -6254,7 +6254,7 @@ function Te(i, t) {
6254
6254
  return te(Ce(i.contour, t.contour));
6255
6255
  if (i.isFull) {
6256
6256
  const n = Ce(i.contour, t.contour), s = t.holes.flatMap(
6257
- (r) => pn(r, i.contour)
6257
+ (r) => gn(r, i.contour)
6258
6258
  );
6259
6259
  return te([...n, ...s]);
6260
6260
  } else if (t.isFull && !i.contour.intersects(t.contour))
@@ -6274,8 +6274,8 @@ function Te(i, t) {
6274
6274
  e = e.flatMap((s) => Te(s, new mt(n)));
6275
6275
  }), e;
6276
6276
  }
6277
- function oo(i, t) {
6278
- const e = pn(i.contour, t.contour);
6277
+ function ao(i, t) {
6278
+ const e = gn(i.contour, t.contour);
6279
6279
  if (!e.length) return [];
6280
6280
  let n = te(e);
6281
6281
  return n = Xt(
@@ -6290,7 +6290,7 @@ function se(i, t) {
6290
6290
  if (!i.length) return t;
6291
6291
  if (!t.length) return i;
6292
6292
  if (i.length === 1 && t.length > 1 || t.length === 1 && i.length > 1)
6293
- return ro([...i, ...t]);
6293
+ return oo([...i, ...t]);
6294
6294
  if (i.length > 1 && t.length > 1) {
6295
6295
  let e = se([i[0]], t);
6296
6296
  return i.slice(1).forEach((n) => {
@@ -6312,11 +6312,11 @@ function Xt(i, t) {
6312
6312
  }), e;
6313
6313
  }
6314
6314
  function Ze(i, t) {
6315
- return !i.length || !t.length ? [] : i.length === 1 && t.length === 1 ? oo(i[0], t[0]) : i.length > 1 ? i.flatMap((e) => Ze([e], t)) : t.flatMap((e) => Ze(i, [e]));
6315
+ return !i.length || !t.length ? [] : i.length === 1 && t.length === 1 ? ao(i[0], t[0]) : i.length > 1 ? i.flatMap((e) => Ze([e], t)) : t.flatMap((e) => Ze(i, [e]));
6316
6316
  }
6317
6317
  let ae = class Tt extends Lt {
6318
6318
  constructor(t = [], { ignoreChecks: e = !1 } = {}) {
6319
- super(), ut(this, "figures"), ut(this, "_boundingBox", null), e || ao(t), this.figures = t;
6319
+ super(), ut(this, "figures"), ut(this, "_boundingBox", null), e || ho(t), this.figures = t;
6320
6320
  }
6321
6321
  get isEmpty() {
6322
6322
  return this.figures.length === 0;
@@ -6360,12 +6360,12 @@ let ae = class Tt extends Lt {
6360
6360
  return new Tt(Ze(this.figures, t.figures));
6361
6361
  }
6362
6362
  };
6363
- function ao(i) {
6364
- for (const [t, e] of We(i))
6363
+ function ho(i) {
6364
+ for (const [t, e] of He(i))
6365
6365
  if (t.intersects(e))
6366
6366
  throw new Error("Diagram figures must not intersect");
6367
6367
  }
6368
- var ho = Object.defineProperty, lo = (i, t, e) => t in i ? ho(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, xe = (i, t, e) => lo(i, typeof t != "symbol" ? t + "" : t, e);
6368
+ var lo = Object.defineProperty, uo = (i, t, e) => t in i ? lo(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, xe = (i, t, e) => uo(i, typeof t != "symbol" ? t + "" : t, e);
6369
6369
  const Fi = (i, t, e) => {
6370
6370
  const n = bt(i.V, t.V), s = i.precision * t.precision;
6371
6371
  if (n * n < s)
@@ -6378,23 +6378,23 @@ class $e {
6378
6378
  this.firstPoint = t, this.lastPoint = e;
6379
6379
  }
6380
6380
  }
6381
- function Yn(i, t) {
6381
+ function Un(i, t) {
6382
6382
  if (i instanceof D)
6383
- return uo(i, t);
6384
- if (i instanceof z)
6385
6383
  return co(i, t);
6386
- if (i instanceof et || i instanceof rt)
6384
+ if (i instanceof z)
6387
6385
  return fo(i, t);
6386
+ if (i instanceof et || i instanceof rt)
6387
+ return mo(i, t);
6388
6388
  throw new Error("Not implemented");
6389
6389
  }
6390
- function uo(i, t) {
6390
+ function co(i, t) {
6391
6391
  const { firstPoint: e, lastPoint: n } = i, s = i.normalVector;
6392
6392
  return new D(
6393
6393
  X(e, Q(s, t)),
6394
6394
  X(n, Q(s, t))
6395
6395
  );
6396
6396
  }
6397
- function co(i, t) {
6397
+ function fo(i, t) {
6398
6398
  const e = X(
6399
6399
  i.firstPoint,
6400
6400
  Q(nt(i.tangentAtFirstPoint), t)
@@ -6423,7 +6423,7 @@ function De(i, t, e, n, s) {
6423
6423
  );
6424
6424
  return r;
6425
6425
  }
6426
- function fo(i, t) {
6426
+ function mo(i, t) {
6427
6427
  const { firstPoint: e, lastPoint: n, normalAtFirstPoint: s, normalAtLastPoint: r } = i, o = Fi(
6428
6428
  { V: s, firstPoint: e, precision: i.precision },
6429
6429
  { V: r, firstPoint: n, precision: i.precision }
@@ -6481,7 +6481,7 @@ function Li(i, t, e) {
6481
6481
  t.tangentAtFirstPoint
6482
6482
  );
6483
6483
  if (Math.abs(n) < 1e-10) return null;
6484
- const s = n > 0 ? 1 : -1, r = Math.abs(e) * s, o = Yn(i, r), a = Yn(t, r);
6484
+ const s = n > 0 ? 1 : -1, r = Math.abs(e) * s, o = Un(i, r), a = Un(t, r);
6485
6485
  if (o instanceof $e || a instanceof $e)
6486
6486
  return null;
6487
6487
  let h;
@@ -6498,7 +6498,7 @@ function Li(i, t, e) {
6498
6498
  }, [u] = c(i, o), [, m] = c(t, a);
6499
6499
  return { first: u, second: m, center: l };
6500
6500
  }
6501
- function Xn(i, t, e) {
6501
+ function Yn(i, t, e) {
6502
6502
  const n = Li(i, t, e);
6503
6503
  if (!n)
6504
6504
  return console.warn(
@@ -6509,11 +6509,11 @@ function Xn(i, t, e) {
6509
6509
  const { first: s, second: r } = n;
6510
6510
  return [
6511
6511
  s,
6512
- hi(s.lastPoint, r.firstPoint, s.tangentAtLastPoint),
6512
+ ai(s.lastPoint, r.firstPoint, s.tangentAtLastPoint),
6513
6513
  r
6514
6514
  ];
6515
6515
  }
6516
- function Hn(i, t, e) {
6516
+ function Xn(i, t, e) {
6517
6517
  const n = Li(i, t, e);
6518
6518
  if (!n)
6519
6519
  return console.warn(
@@ -6524,7 +6524,7 @@ function Hn(i, t, e) {
6524
6524
  const { first: s, second: r } = n;
6525
6525
  return [s, new D(s.lastPoint, r.firstPoint), r];
6526
6526
  }
6527
- const mo = (i) => {
6527
+ const go = (i) => {
6528
6528
  let t;
6529
6529
  i ? typeof i == "number" || Array.isArray(i) && i.length === 2 ? t = { endTangent: i } : t = { endTangent: 0, ...i } : t = { endTangent: [1, 0] };
6530
6530
  const {
@@ -6541,7 +6541,7 @@ const mo = (i) => {
6541
6541
  function Wn(i, { ignoreChecks: t = !1 } = {}) {
6542
6542
  return new ae([new mt(new dt([...i], { ignoreChecks: t }))]);
6543
6543
  }
6544
- class go {
6544
+ let po = class {
6545
6545
  constructor(t = [0, 0]) {
6546
6546
  xe(this, "pointer"), xe(this, "firstPoint"), xe(this, "pendingSegments"), xe(this, "_nextCorner"), this.pointer = t, this.firstPoint = t, this.pendingSegments = [], this._nextCorner = null;
6547
6547
  }
@@ -6559,7 +6559,7 @@ class go {
6559
6559
  return this.pendingSegments.push(t), this;
6560
6560
  const e = this.pendingSegments.pop();
6561
6561
  if (!e) throw new Error("bug in the custom corner algorithm");
6562
- const n = this._nextCorner.mode === "chamfer" ? Hn : Xn;
6562
+ const n = this._nextCorner.mode === "chamfer" ? Xn : Yn;
6563
6563
  return this.pendingSegments.push(
6564
6564
  ...n(e, t, this._nextCorner.radius)
6565
6565
  ), this._nextCorner = null, this;
@@ -6647,7 +6647,7 @@ class go {
6647
6647
  if (!n)
6648
6648
  throw new Error("You need a previous curve to sketch a tangent arc");
6649
6649
  return this.saveSegment(
6650
- hi(
6650
+ ai(
6651
6651
  this.pointer,
6652
6652
  t,
6653
6653
  e ?? n.tangentAtLastPoint
@@ -6674,7 +6674,7 @@ class go {
6674
6674
  );
6675
6675
  }
6676
6676
  halfEllipseTo(t, e) {
6677
- const [n, s] = ri(q(t, this.pointer));
6677
+ const [n, s] = si(q(t, this.pointer));
6678
6678
  return this.ellipseTo(
6679
6679
  t,
6680
6680
  n / 2,
@@ -6699,7 +6699,7 @@ class go {
6699
6699
  return this.saveSegment(new et(this.pointer, t, e)), this.pointer = t, this;
6700
6700
  }
6701
6701
  smoothCurveTo(t, e) {
6702
- const { endTangent: n, startTangent: s, startFactor: r, endFactor: o } = mo(e), a = this.pendingSegments.length ? this.pendingSegments[this.pendingSegments.length - 1] : null, h = J(this.pointer, t) / 3;
6702
+ const { endTangent: n, startTangent: s, startFactor: r, endFactor: o } = go(e), a = this.pendingSegments.length ? this.pendingSegments[this.pendingSegments.length - 1] : null, h = J(this.pointer, t) / 3;
6703
6703
  let l;
6704
6704
  s ? l = s : a ? l = a.tangentAtLastPoint : l = [1, 0], l = ot(l);
6705
6705
  const c = [
@@ -6730,7 +6730,7 @@ class go {
6730
6730
  const n = this.pendingSegments.pop(), s = this.pendingSegments.shift();
6731
6731
  if (!n || !s)
6732
6732
  throw new Error("Not enough curves to close and fillet");
6733
- const r = e === "chamfer" ? Hn : Xn;
6733
+ const r = e === "chamfer" ? Xn : Yn;
6734
6734
  this.pendingSegments.push(...r(n, s, t));
6735
6735
  }
6736
6736
  close(t = !1) {
@@ -6764,14 +6764,14 @@ class go {
6764
6764
  var t;
6765
6765
  return k(this.pointer, (t = this.pendingSegments[0]) == null ? void 0 : t.firstPoint);
6766
6766
  }
6767
- }
6767
+ };
6768
6768
  function Bi(i = [0, 0]) {
6769
- return new go(i);
6769
+ return new po(i);
6770
6770
  }
6771
6771
  function kt([i, t]) {
6772
6772
  return `${i} ${t}`;
6773
6773
  }
6774
- function wn(i) {
6774
+ function pn(i) {
6775
6775
  if (i instanceof D)
6776
6776
  return `L ${kt(i.lastPoint)}`;
6777
6777
  if (i instanceof z)
@@ -6792,34 +6792,34 @@ function wn(i) {
6792
6792
  throw new Error("Unknown segment type");
6793
6793
  }
6794
6794
  function Vi(i) {
6795
- const t = `M ${i.firstPoint.join(" ")}`, e = i.segments.map(wn).join(" ");
6795
+ const t = `M ${i.firstPoint.join(" ")}`, e = i.segments.map(pn).join(" ");
6796
6796
  return `${t} ${e} Z`;
6797
6797
  }
6798
6798
  function ji(i) {
6799
6799
  return `<path d="${i.allLoops.map(Vi).join(" ")}" />`;
6800
6800
  }
6801
- function po(i) {
6801
+ function wo(i) {
6802
6802
  return `<g>
6803
6803
  ${i.figures.map(ji).join(`
6804
6804
  `)}
6805
6805
  </g>`;
6806
6806
  }
6807
- function wo(i) {
6808
- const t = `M ${i.firstPoint.join(" ")}`, e = i.segments.map(wn).join(" ");
6807
+ function Po(i) {
6808
+ const t = `M ${i.firstPoint.join(" ")}`, e = i.segments.map(pn).join(" ");
6809
6809
  return `${t} ${e}`;
6810
6810
  }
6811
- function Po(i, t = 1) {
6811
+ function Mo(i, t = 1) {
6812
6812
  const e = i.xMin - t, n = i.yMin - t;
6813
6813
  return `${e} ${n} ${i.width + 2 * t} ${i.height + 2 * t}`;
6814
6814
  }
6815
- function Qn(i, t, e = 1, n) {
6816
- const s = Po(t, e), r = n ? `width="${t.width + 2 * e}${n}" height="${t.height + 2 * e}${n}"` : "";
6815
+ function Hn(i, t, e = 1, n) {
6816
+ const s = Mo(t, e), r = n ? `width="${t.width + 2 * e}${n}" height="${t.height + 2 * e}${n}"` : "";
6817
6817
  return `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
6818
- <svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="${s}" fill="none" stroke="black" stroke-width="0.2%" vector-effect="non-scaling-stroke" ${r}>
6818
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="${s}" fill="none" stroke="grey" stroke-width="0.2%" vector-effect="non-scaling-stroke" ${r}>
6819
6819
  ${i}
6820
6820
  </svg>`;
6821
6821
  }
6822
- function Gn(i) {
6822
+ function Qn(i) {
6823
6823
  if (i instanceof mt)
6824
6824
  return [i];
6825
6825
  if (i instanceof dt)
@@ -6861,71 +6861,71 @@ function Ni(i, t, e = !1) {
6861
6861
  return t.onStroke(s) ? !e : !t.contains(s);
6862
6862
  });
6863
6863
  }
6864
- function Mo(i, t, e = !1) {
6864
+ function yo(i, t, e = !1) {
6865
6865
  return qi(t, i).filter((n) => {
6866
6866
  const s = n.segments[0].midPoint;
6867
6867
  return t.onStroke(s) ? !e : t.contains(s);
6868
6868
  });
6869
6869
  }
6870
- function Jn(i, t, e = !1) {
6870
+ function Gn(i, t, e = !1) {
6871
6871
  const n = Ni(
6872
6872
  i,
6873
6873
  t.contour,
6874
6874
  e
6875
6875
  ), s = t.holes.flatMap(
6876
- (r) => Mo(i, r, e)
6876
+ (r) => yo(i, r, e)
6877
6877
  );
6878
6878
  return [...n, ...s];
6879
6879
  }
6880
- function yo(i, t) {
6880
+ function bo(i, t) {
6881
6881
  return new ae(
6882
- Xt(Gn(i), Gn(t))
6882
+ Xt(Qn(i), Qn(t))
6883
6883
  );
6884
6884
  }
6885
6885
  function Ue(i, t, e = !0) {
6886
6886
  if (t instanceof dt)
6887
6887
  return Ni(i, t, e);
6888
6888
  if (t instanceof mt)
6889
- return Jn(i, t, e);
6889
+ return Gn(i, t, e);
6890
6890
  let n = [new Rt([...i.segments])];
6891
6891
  return t.figures.forEach((s) => {
6892
- n = n.flatMap((r) => Jn(r, s, e));
6892
+ n = n.flatMap((r) => Gn(r, s, e));
6893
6893
  }), n;
6894
6894
  }
6895
- function Zn(i) {
6895
+ function Jn(i) {
6896
6896
  if (i instanceof ae)
6897
- return po(i);
6897
+ return wo(i);
6898
6898
  if (i instanceof mt)
6899
6899
  return ji(i);
6900
6900
  if (i instanceof dt)
6901
6901
  return `<path d="${Vi(i)}" />`;
6902
6902
  if (i instanceof Rt)
6903
- return `<path d="${wo(i)}" />`;
6904
- if (Ri(i))
6905
- return `<path d="${`M ${i.firstPoint.join(" ")}`} ${wn(
6903
+ return `<path d="${Po(i)}" />`;
6904
+ if (ki(i))
6905
+ return `<path d="${`M ${i.firstPoint.join(" ")}`} ${pn(
6906
6906
  i
6907
6907
  )}" />`;
6908
6908
  throw new Error("Unknown shape type");
6909
6909
  }
6910
- const Kn = (i) => "shape" in i ? i.shape : i, ti = (i, t) => {
6910
+ const Zn = (i) => "shape" in i ? i.shape : i, Kn = (i, t) => {
6911
6911
  if (!("shape" in i)) return t;
6912
6912
  const { color: e } = i;
6913
6913
  return e ? `<g stroke="${e}">${t}</g>` : t;
6914
- }, ei = (i) => new re(i.xMin, -i.yMax, i.xMax, -i.yMin);
6915
- function bo(i, {
6914
+ }, ti = (i) => new re(i.xMin, -i.yMax, i.xMax, -i.yMin);
6915
+ function xo(i, {
6916
6916
  margin: t = 1,
6917
6917
  unit: e = null,
6918
6918
  viewBox: n
6919
6919
  } = {}) {
6920
6920
  if (Array.isArray(i)) {
6921
- const r = i.map((h) => Kn(h).mirror()), o = r.map((h, l) => ti(i[l], Zn(h))).join(`
6921
+ const r = i.map((h) => Zn(h).mirror()), o = r.map((h, l) => Kn(i[l], Jn(h))).join(`
6922
6922
  `), a = r.slice(1).reduce((h, l) => h.merge(l.boundingBox), r[0].boundingBox);
6923
- return Qn(o, n ? ei(n) : a, t, e);
6923
+ return Hn(o, n ? ti(n) : a, t, e);
6924
6924
  }
6925
- const s = Kn(i).mirror();
6926
- return Qn(
6927
- ti(i, Zn(s)),
6928
- n ? ei(n) : s.boundingBox,
6925
+ const s = Zn(i).mirror();
6926
+ return Hn(
6927
+ Kn(i, Jn(s)),
6928
+ n ? ti(n) : s.boundingBox,
6929
6929
  t,
6930
6930
  e
6931
6931
  );
@@ -6969,7 +6969,7 @@ class Jt extends Lt {
6969
6969
  return e instanceof Jt ? (n = e.body, this.cutLines.push(...e.cutLines), this.foldLinesForwards.push(...e.foldLinesForwards), this.foldLinesBackwards.push(...e.foldLinesBackwards)) : n = e, this.body = this.body.fuse(n), this;
6970
6970
  }
6971
6971
  cutShape(e) {
6972
- return this.body = yo(this.body, e), this.cutLines = this.cutLines.flatMap(
6972
+ return this.body = bo(this.body, e), this.cutLines = this.cutLines.flatMap(
6973
6973
  (n) => Ue(n, e, !0)
6974
6974
  ), this.eraseFolds(e), this;
6975
6975
  }
@@ -6997,10 +6997,10 @@ class Jt extends Lt {
6997
6997
  (n) => e.push({ shape: n, color: "green" })
6998
6998
  ), this.foldLinesForwards.length && this.foldLinesForwards.map(
6999
6999
  (n) => e.push({ shape: n, color: "blue" })
7000
- ), bo(e, { unit: "mm" });
7000
+ ), xo(e, { unit: "mm" });
7001
7001
  }
7002
7002
  }
7003
- function dn(i, t, {
7003
+ function wn(i, t, {
7004
7004
  fillet: e = 1,
7005
7005
  contraction: n = 1,
7006
7006
  contractionMode: s = "rounded",
@@ -7012,11 +7012,11 @@ function dn(i, t, {
7012
7012
  const l = r ?? n, c = o ?? n, u = Bi([-i / 2, 0]).hLine(i);
7013
7013
  return c ? (h ?? s) === "rounded" ? (u.tangentArc(-c, c, [-1, 0]), u.vLine(t - c)) : u.line(-c, t) : u.vLine(t), u.customCorner(e), u.hLine(-i + l + c), u.customCorner(e), l ? (a ?? s) === "rounded" ? (u.vLine(-t + l), u.tangentArcTo([-i / 2, 0])) : u.lineTo([-i / 2, 0]) : u.vLine(-t), u.close();
7014
7014
  }
7015
- function xo(i, t, e = {}) {
7016
- return dn(i, t, e);
7017
- }
7018
7015
  function vo(i, t, e = {}) {
7019
- return dn(i, t, e).mirror("x");
7016
+ return wn(i, t, e);
7017
+ }
7018
+ function Ao(i, t, e = {}) {
7019
+ return wn(i, t, e).mirror("x");
7020
7020
  }
7021
7021
  function Oi(i, t, {
7022
7022
  contractionTop: e,
@@ -7025,7 +7025,7 @@ function Oi(i, t, {
7025
7025
  bottomContractionMode: r,
7026
7026
  ...o
7027
7027
  } = {}) {
7028
- return dn(i, t, {
7028
+ return wn(i, t, {
7029
7029
  contractionLeft: e,
7030
7030
  contractionRight: n,
7031
7031
  leftContractionMode: s,
@@ -7033,15 +7033,15 @@ function Oi(i, t, {
7033
7033
  ...o
7034
7034
  }).rotate(90);
7035
7035
  }
7036
- function Ao(i, t, e = {}) {
7036
+ function Eo(i, t, e = {}) {
7037
7037
  return Oi(i, t, e).mirror("y");
7038
7038
  }
7039
- const _o = {
7040
- right: Ao,
7039
+ const Lo = {
7040
+ right: Eo,
7041
7041
  left: Oi,
7042
- top: xo,
7043
- bottom: vo
7044
- }, ni = (i, t) => Bi([-i / 2, 0]).line(t, -t).hLine(i - 2 * t).line(t, t);
7042
+ top: vo,
7043
+ bottom: Ao
7044
+ }, ei = (i, t) => Bi([-i / 2, 0]).line(t, -t).hLine(i - 2 * t).line(t, t);
7045
7045
  class Ke extends Lt {
7046
7046
  constructor(e, n = 0.2) {
7047
7047
  super();
@@ -7052,8 +7052,8 @@ class Ke extends Lt {
7052
7052
  this.cut = e.cut, this.unfold = e.unfold, this.bump = e.bump;
7053
7053
  return;
7054
7054
  }
7055
- const s = ni(e, n * 2.5);
7056
- this.cut = s.asStrand(), this.unfold = s.close(), this.bump = ni(e - 5 * n, 5 * n).close().mirror("x");
7055
+ const s = ei(e, n * 2.5);
7056
+ this.cut = s.asStrand(), this.unfold = s.close(), this.bump = ei(e - 5 * n, 5 * n).close().mirror("x");
7057
7057
  }
7058
7058
  clone() {
7059
7059
  return new Ke(this);
@@ -7086,7 +7086,7 @@ class Le extends Lt {
7086
7086
  return this.points.map((e) => t.clone().translateTo(e));
7087
7087
  }
7088
7088
  }
7089
- function Fo(i, t, e = 3, n = 0) {
7089
+ function Bo(i, t, e = 3, n = 0) {
7090
7090
  if (i <= t * 2)
7091
7091
  throw new Error("totalWidth must be greater than twice the objectWidth");
7092
7092
  const s = Math.max(
@@ -7099,7 +7099,7 @@ function Fo(i, t, e = 3, n = 0) {
7099
7099
  );
7100
7100
  return new Le(a.map((h) => [h, 0]));
7101
7101
  }
7102
- function Lo(i, t, e = "x") {
7102
+ function Vo(i, t, e = "x") {
7103
7103
  const n = i * (t - 1), s = [];
7104
7104
  for (let r = 0; r < t; r++)
7105
7105
  s.push(r * i - n / 2);
@@ -7110,12 +7110,12 @@ function Lo(i, t, e = "x") {
7110
7110
  export {
7111
7111
  Jt as Dieline,
7112
7112
  Ke as FoldLockBump,
7113
- vo as bottomFlap,
7114
- _o as drawFlaps,
7113
+ Ao as bottomFlap,
7114
+ Lo as drawFlaps,
7115
7115
  Oi as leftFlap,
7116
- Fo as linearDistribution,
7117
- Lo as linearSpread,
7118
- Ao as rightFlap,
7119
- xo as topFlap
7116
+ Bo as linearDistribution,
7117
+ Vo as linearSpread,
7118
+ Eo as rightFlap,
7119
+ vo as topFlap
7120
7120
  };
7121
7121
  //# sourceMappingURL=dielines.js.map