replicad-pantograph 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.
@@ -6,7 +6,7 @@ var Me = (r) => {
6
6
  };
7
7
  var Be = (r, s, t) => s in r ? Oe(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
8
8
  var q$2 = (r, s, t) => Be(r, typeof s != "symbol" ? s + "" : s, t), oe$1 = (r, s, t) => s.has(r) || Me("Cannot " + t);
9
- var ht$2 = (r, s, t) => (oe$1(r, s, "read from private field"), t ? t.call(r) : s.get(r)), le$1 = (r, s, t) => s.has(r) ? Me("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(r) : s.set(r, t), Dt$1 = (r, s, t, e) => (oe$1(r, s, "write to private field"), s.set(r, t), t), he = (r, s, t) => (oe$1(r, s, "access private method"), t);
9
+ var ht$1 = (r, s, t) => (oe$1(r, s, "read from private field"), t ? t.call(r) : s.get(r)), le$1 = (r, s, t) => s.has(r) ? Me("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(r) : s.set(r, t), Dt$1 = (r, s, t, e) => (oe$1(r, s, "write to private field"), s.set(r, t), t), he = (r, s, t) => (oe$1(r, s, "access private method"), t);
10
10
  function zt(r, s, t, e) {
11
11
  return r <= e && s >= t;
12
12
  }
@@ -85,16 +85,18 @@ function Te(r, s = 1e-9) {
85
85
  ).values()
86
86
  );
87
87
  }
88
- const fe = Math.PI / 180, Ue = 180 / Math.PI, Z$1 = (r) => `[${r[0]}, ${r[1]}]`, Y$2 = ([r, s], [t, e], n = 1e-9) => Math.abs(r - t) <= n && Math.abs(s - e) <= n, it$3 = ([r, s], [t, e]) => [r + t, s + e], Q$1 = ([r, s], [t, e]) => [r - t, s - e], It$1 = ([r, s]) => r * r + s * s, an$1 = ([r, s]) => Math.sqrt(It$1([r, s])), nt$2 = ([r, s], t) => [r * t, s * t], Rt$1 = ([r, s], [t, e] = [0, 0]) => (r - t) ** 2 + (s - e) ** 2, J$1 = (r, s = [0, 0]) => Math.sqrt(Rt$1(r, s));
89
- function St$1([r, s], [t, e]) {
88
+ const fe = Math.PI / 180, Ue = 180 / Math.PI, Z$1 = (r) => `[${r[0]}, ${r[1]}]`, Y$1 = ([r, s], [t, e], n = 1e-9) => Math.abs(r - t) <= n && Math.abs(s - e) <= n, it$3 = ([r, s], [t, e]) => [r + t, s + e], Q$2 = ([r, s], [t, e]) => [r - t, s - e], It$2 = ([r, s]) => r * r + s * s, an$1 = ([r, s]) => Math.sqrt(It$2([r, s])), nt$2 = ([r, s], t) => [r * t, s * t], Rt$1 = ([r, s], [t, e] = [0, 0]) => (r - t) ** 2 + (s - e) ** 2, J$2 = (r, s = [0, 0]) => Math.sqrt(Rt$1(r, s));
89
+ function St$2([r, s], [t, e]) {
90
90
  return r * e - s * t;
91
91
  }
92
92
  function Pe([r, s], [t, e]) {
93
93
  return r * t + s * e;
94
94
  }
95
- const un$1 = ([r, s], [t, e] = [0, 0]) => Math.atan2(e * r - s * t, r * t + s * e);
95
+ function un$1([r, s], [t, e] = [0, 0]) {
96
+ return Math.atan2(e * r - s * t, r * t + s * e);
97
+ }
96
98
  function H$1([r, s]) {
97
- const t = J$1([r, s]);
99
+ const t = J$2([r, s]);
98
100
  return [r / t, s / t];
99
101
  }
100
102
  function Tt(r, s) {
@@ -105,11 +107,11 @@ function Ye([r, s]) {
105
107
  return Math.atan2(s, r);
106
108
  }
107
109
  function We(r) {
108
- const s = J$1(r), t = Ye(r);
110
+ const s = J$2(r), t = Ye(r);
109
111
  return [s, t];
110
112
  }
111
113
  function Ie(r, s, t = 1e-9) {
112
- const e = St$1(r, s), n = It$1(r), i = It$1(s);
114
+ const e = St$2(r, s), n = It$2(r), i = It$2(s);
113
115
  return e * e < n * i * t * t;
114
116
  }
115
117
  function tt$2(r) {
@@ -119,9 +121,9 @@ function Qt(r) {
119
121
  return [r[1], -r[0]];
120
122
  }
121
123
  function Qe(r, s, t) {
122
- return Y$2(t, r) || Ie(Q$1(t, r), s);
124
+ return Y$1(t, r) || Ie(Q$2(t, r), s);
123
125
  }
124
- const Mt$1 = (r, s) => {
126
+ const Mt$2 = (r, s) => {
125
127
  const [t, e, n, i, o, l, h, a, u] = r, [c, g, d, w, p, P, f, M, E] = s;
126
128
  return [
127
129
  t * c + e * w + n * f,
@@ -166,27 +168,27 @@ let et$3 = class et {
166
168
  return this._matrix = Ge(this._matrix), this;
167
169
  }
168
170
  translate(s, t) {
169
- return this._matrix = Mt$1([1, 0, s, 0, 1, t, 0, 0, 1], this._matrix), this;
171
+ return this._matrix = Mt$2([1, 0, s, 0, 1, t, 0, 0, 1], this._matrix), this;
170
172
  }
171
173
  rotate(s, t) {
172
174
  const e = Math.cos(s), n = Math.sin(s), i = [e, -n, 0, n, e, 0, 0, 0, 1];
173
- return t && this.translate(-t[0], -t[1]), this._matrix = Mt$1(i, this._matrix), t && this.translate(t[0], t[1]), this;
175
+ return t && this.translate(-t[0], -t[1]), this._matrix = Mt$2(i, this._matrix), t && this.translate(t[0], t[1]), this;
174
176
  }
175
177
  mirrorX() {
176
- return this._matrix = Mt$1([1, 0, 0, 0, -1, 0, 0, 0, 1], this._matrix), this;
178
+ return this._matrix = Mt$2([1, 0, 0, 0, -1, 0, 0, 0, 1], this._matrix), this;
177
179
  }
178
180
  mirrorY() {
179
- return this._matrix = Mt$1([-1, 0, 0, 0, 1, 0, 0, 0, 1], this._matrix), this;
181
+ return this._matrix = Mt$2([-1, 0, 0, 0, 1, 0, 0, 0, 1], this._matrix), this;
180
182
  }
181
183
  mirrorLine(s, t) {
182
184
  const [e, n] = s, i = Math.atan2(n, e);
183
185
  return t && this.translate(-t[0], -t[1]), this.rotate(-i), this.mirrorX(), this.rotate(i), t && this.translate(t[0], t[1]), this;
184
186
  }
185
187
  mirrorCenter(s) {
186
- return s && this.translate(-s[0], -s[1]), this._matrix = Mt$1([-1, 0, 0, 0, -1, 0, 0, 0, 1], this._matrix), s && this.translate(s[0], s[1]), this;
188
+ return s && this.translate(-s[0], -s[1]), this._matrix = Mt$2([-1, 0, 0, 0, -1, 0, 0, 0, 1], this._matrix), s && this.translate(s[0], s[1]), this;
187
189
  }
188
190
  scale(s, t) {
189
- return t && this.translate(-t[0], -t[1]), this._matrix = Mt$1([s, 0, 0, 0, s, 0, 0, 0, 1], this._matrix), t && this.translate(t[0], t[1]), this;
191
+ return t && this.translate(-t[0], -t[1]), this._matrix = Mt$2([s, 0, 0, 0, s, 0, 0, 0, 1], this._matrix), t && this.translate(t[0], t[1]), this;
190
192
  }
191
193
  transform(s) {
192
194
  const [t, e] = s, [n, i, o, l, h, a] = this._matrix;
@@ -260,7 +262,7 @@ let xt$1 = class xt extends Ze {
260
262
  return this.repr;
261
263
  }
262
264
  };
263
- let at$1 = class at extends xt$1 {
265
+ let at$2 = class at extends xt$1 {
264
266
  constructor() {
265
267
  super(...arguments);
266
268
  q$2(this, "segmentType", "LINE");
@@ -277,13 +279,13 @@ let at$1 = class at extends xt$1 {
277
279
  return it$3(this.firstPoint, nt$2(this.V, t));
278
280
  }
279
281
  get length() {
280
- return J$1(this.firstPoint, this.lastPoint);
282
+ return J$2(this.firstPoint, this.lastPoint);
281
283
  }
282
284
  get squareLength() {
283
285
  return Rt$1(this.firstPoint, this.lastPoint);
284
286
  }
285
287
  get V() {
286
- return this._V === null && (this._V = Q$1(this.lastPoint, this.firstPoint)), this._V;
288
+ return this._V === null && (this._V = Q$2(this.lastPoint, this.firstPoint)), this._V;
287
289
  }
288
290
  get slope() {
289
291
  if (this._slope === null) {
@@ -299,7 +301,7 @@ let at$1 = class at extends xt$1 {
299
301
  return it$3(this.firstPoint, nt$2(this.V, 0.5));
300
302
  }
301
303
  isSame(t) {
302
- return t instanceof at ? Y$2(this.firstPoint, t.firstPoint) && Y$2(this.lastPoint, t.lastPoint) || Y$2(this.lastPoint, t.firstPoint) && Y$2(this.firstPoint, t.lastPoint) : !1;
304
+ return t instanceof at ? Y$1(this.firstPoint, t.firstPoint) && Y$1(this.lastPoint, t.lastPoint) || Y$1(this.lastPoint, t.firstPoint) && Y$1(this.firstPoint, t.lastPoint) : !1;
303
305
  }
304
306
  clone() {
305
307
  return new at(this.firstPoint, this.lastPoint);
@@ -316,17 +318,17 @@ let at$1 = class at extends xt$1 {
316
318
  )), this._boundingBox;
317
319
  }
318
320
  distanceFrom(t) {
319
- const e = Q$1(t, this.firstPoint), n = Pe(e, this.V) / this.squareLength;
321
+ const e = Q$2(t, this.firstPoint), n = Pe(e, this.V) / this.squareLength;
320
322
  if (n < 0)
321
- return J$1(t, this.firstPoint);
323
+ return J$2(t, this.firstPoint);
322
324
  if (n > 1)
323
- return J$1(t, this.lastPoint);
325
+ return J$2(t, this.lastPoint);
324
326
  const i = this.paramPoint(n);
325
- return J$1(t, i);
327
+ return J$2(t, i);
326
328
  }
327
329
  isOnSegment(t) {
328
- if (Y$2(t, this.firstPoint, this.precision)) return !0;
329
- const e = Q$1(t, this.firstPoint);
330
+ if (Y$1(t, this.firstPoint, this.precision)) return !0;
331
+ const e = Q$2(t, this.firstPoint);
330
332
  if (!Ie(this.V, e)) return !1;
331
333
  const n = Pe(e, this.V) / this.squareLength;
332
334
  return this.isValidParameter(n);
@@ -373,7 +375,7 @@ let at$1 = class at extends xt$1 {
373
375
  function Je(r) {
374
376
  return Array.from(Array(r).keys());
375
377
  }
376
- function Kt$1(r) {
378
+ function Kt(r) {
377
379
  const s = Math.min(...r.map((t) => t.length));
378
380
  return Je(s).map((t) => r.map((e) => e[t]));
379
381
  }
@@ -385,10 +387,10 @@ function Zt(r, s, t, e = 1e-9) {
385
387
  return t && (n = -n), n < 0 && (n += 2 * Math.PI), n > 2 * Math.PI - e ? 0 : n;
386
388
  }
387
389
  const me = (r, s, t) => {
388
- const e = St$1(r.V, s.V), n = It$1(r.V), i = It$1(s.V), o = t ? t * t : r.precision * s.precision;
390
+ const e = St$2(r.V, s.V), n = It$2(r.V), i = It$2(s.V), o = t ? t * t : r.precision * s.precision;
389
391
  if (e * e < n * i * o)
390
392
  return "parallel";
391
- const l = Q$1(s.firstPoint, r.firstPoint), h = St$1(l, s.V) / e, a = St$1(l, r.V) / e;
393
+ const l = Q$2(s.firstPoint, r.firstPoint), h = St$2(l, s.V) / e, a = St$2(l, r.V) / e;
392
394
  return {
393
395
  intersectionParam1: h,
394
396
  intersectionParam2: a
@@ -409,7 +411,7 @@ function cn$1(r, s, t = !1, e) {
409
411
  ).sort((h, a) => h[0] - a[0]);
410
412
  if (l.length === 0) return null;
411
413
  if (l.length === 1) return null;
412
- if (l.length === 2) return new at$1(l[0], l[1]);
414
+ if (l.length === 2) return new at$2(l[0], l[1]);
413
415
  throw console.error(l), new Error(
414
416
  "Unexpected number of points while intersecting parallel lines"
415
417
  );
@@ -418,10 +420,10 @@ function cn$1(r, s, t = !1, e) {
418
420
  return !r.isValidParameter(i) || !s.isValidParameter(o) ? null : r.paramPoint(i);
419
421
  }
420
422
  const Ot = (r, s) => {
421
- const t = Q$1(r, s);
423
+ const t = Q$2(r, s);
422
424
  return We(t);
423
425
  };
424
- let ct$1 = class ct extends xt$1 {
426
+ let ct$2 = class ct extends xt$1 {
425
427
  constructor(t, e, n, i = !1, { ignoreChecks: o = !1 } = {}) {
426
428
  super(t, e);
427
429
  q$2(this, "segmentType", "ARC");
@@ -434,9 +436,9 @@ let ct$1 = class ct extends xt$1 {
434
436
  q$2(this, "_lastAngle", null);
435
437
  q$2(this, "_boundingBox", null);
436
438
  if (this.center = n, this.clockwise = i, !o) {
437
- if (Y$2(t, e))
439
+ if (Y$1(t, e))
438
440
  throw new Error("Invalid arc, cannot be a full circle");
439
- if (Math.abs(this.radius - J$1(this.lastPoint, this.center)) > this.precision)
441
+ if (Math.abs(this.radius - J$2(this.lastPoint, this.center)) > this.precision)
440
442
  throw new Error(
441
443
  `Invalid arc, radius does not match between ${Z$1(
442
444
  t
@@ -499,18 +501,18 @@ let ct$1 = class ct extends xt$1 {
499
501
  return i;
500
502
  }
501
503
  get radius() {
502
- return this._radius === null && (this._radius = J$1(this.firstPoint, this.center)), this._radius;
504
+ return this._radius === null && (this._radius = J$2(this.firstPoint, this.center)), this._radius;
503
505
  }
504
506
  get firstAngle() {
505
507
  if (this._firstAngle === null) {
506
- const [t, e] = Q$1(this.firstPoint, this.center);
508
+ const [t, e] = Q$2(this.firstPoint, this.center);
507
509
  this._firstAngle = wt$2(Math.atan2(e, t));
508
510
  }
509
511
  return this._firstAngle;
510
512
  }
511
513
  get lastAngle() {
512
514
  if (this._lastAngle === null) {
513
- const [t, e] = Q$1(this.lastPoint, this.center);
515
+ const [t, e] = Q$2(this.lastPoint, this.center);
514
516
  this._lastAngle = wt$2(Math.atan2(e, t));
515
517
  }
516
518
  return this._lastAngle;
@@ -525,7 +527,7 @@ let ct$1 = class ct extends xt$1 {
525
527
  return this.paramPoint(0.5);
526
528
  }
527
529
  isSame(t) {
528
- return !(t instanceof ct) || !Y$2(this.center, t.center) ? !1 : Y$2(this.firstPoint, t.firstPoint) && Y$2(this.lastPoint, t.lastPoint) && this.clockwise === t.clockwise || Y$2(this.lastPoint, t.firstPoint) && Y$2(this.firstPoint, t.lastPoint) && this.clockwise === !t.clockwise;
530
+ return !(t instanceof ct) || !Y$1(this.center, t.center) ? !1 : Y$1(this.firstPoint, t.firstPoint) && Y$1(this.lastPoint, t.lastPoint) && this.clockwise === t.clockwise || Y$1(this.lastPoint, t.firstPoint) && Y$1(this.firstPoint, t.lastPoint) && this.clockwise === !t.clockwise;
529
531
  }
530
532
  clone() {
531
533
  return new ct(
@@ -565,7 +567,7 @@ let ct$1 = class ct extends xt$1 {
565
567
  );
566
568
  }
567
569
  isOnSegment(t) {
568
- if (Y$2(t, this.firstPoint) || Y$2(t, this.lastPoint))
570
+ if (Y$1(t, this.firstPoint) || Y$1(t, this.lastPoint))
569
571
  return !0;
570
572
  const [e, n] = Ot(t, this.center);
571
573
  if (Math.abs(e - this.radius) > this.precision) return !1;
@@ -600,7 +602,7 @@ let ct$1 = class ct extends xt$1 {
600
602
  return [this];
601
603
  Array.isArray(t[0]) ? e = t : e = [t];
602
604
  const i = [0, 1, ...e.map((h) => this.pointToParam(h))], o = new Map(
603
- Kt$1([i, [this.firstPoint, this.lastPoint, ...e]])
605
+ Kt([i, [this.firstPoint, this.lastPoint, ...e]])
604
606
  );
605
607
  i.sort((h, a) => h - a);
606
608
  let l = null;
@@ -628,17 +630,17 @@ let ct$1 = class ct extends xt$1 {
628
630
  }
629
631
  };
630
632
  function fn$1(r, s, t) {
631
- const e = new at$1(s, r), n = new at$1(s, t), i = tt$2(e.tangentAtFirstPoint), o = tt$2(n.tangentAtLastPoint), l = me(
633
+ const e = new at$2(s, r), n = new at$2(s, t), i = tt$2(e.tangentAtFirstPoint), o = tt$2(n.tangentAtLastPoint), l = me(
632
634
  { firstPoint: e.midPoint, V: i, precision: 1e-9 },
633
635
  { firstPoint: n.midPoint, V: o, precision: 1e-9 }
634
636
  );
635
637
  if (l === "parallel")
636
638
  throw new Error("Cannot create an arc from three colinear points");
637
- const h = St$1(
638
- Q$1(r, s),
639
- Q$1(t, s)
639
+ const h = St$2(
640
+ Q$2(r, s),
641
+ Q$2(t, s)
640
642
  ) > 0;
641
- return new ct$1(
643
+ return new ct$2(
642
644
  r,
643
645
  t,
644
646
  it$3(e.midPoint, nt$2(i, l.intersectionParam1)),
@@ -646,8 +648,8 @@ function fn$1(r, s, t) {
646
648
  { ignoreChecks: !0 }
647
649
  );
648
650
  }
649
- function mn$1(r, s, t) {
650
- const e = new at$1(r, s), n = tt$2(e.tangentAtFirstPoint), i = me(
651
+ function mn$2(r, s, t) {
652
+ const e = new at$2(r, s), n = tt$2(e.tangentAtFirstPoint), i = me(
651
653
  { firstPoint: e.midPoint, V: n, precision: 1e-9 },
652
654
  {
653
655
  firstPoint: r,
@@ -660,11 +662,11 @@ function mn$1(r, s, t) {
660
662
  const o = it$3(
661
663
  e.midPoint,
662
664
  nt$2(n, i.intersectionParam1)
663
- ), l = St$1(
664
- Q$1(o, r),
665
- Q$1(o, it$3(r, t))
665
+ ), l = St$2(
666
+ Q$2(o, r),
667
+ Q$2(o, it$3(r, t))
666
668
  ) < 0;
667
- return new ct$1(r, s, o, l, {
669
+ return new ct$2(r, s, o, l, {
668
670
  ignoreChecks: !0
669
671
  });
670
672
  }
@@ -779,19 +781,19 @@ function qe(r) {
779
781
  });
780
782
  }), t;
781
783
  }
782
- var $$1 = {};
784
+ var $ = {};
783
785
  const ts = Object.prototype.toString;
784
- function Ct$1(r) {
786
+ function Ct$2(r) {
785
787
  const s = ts.call(r);
786
788
  return s.endsWith("Array]") && !s.includes("Big");
787
789
  }
788
790
  const es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
789
791
  __proto__: null,
790
- isAnyArray: Ct$1
792
+ isAnyArray: Ct$2
791
793
  }, Symbol.toStringTag, { value: "Module" })), ss = /* @__PURE__ */ qe(es);
792
794
  function ns(r) {
793
795
  var s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
794
- if (!Ct$1(r))
796
+ if (!Ct$2(r))
795
797
  throw new TypeError("input must be an array");
796
798
  if (r.length === 0)
797
799
  throw new TypeError("input must not be empty");
@@ -806,7 +808,7 @@ function ns(r) {
806
808
  }
807
809
  function is(r) {
808
810
  var s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
809
- if (!Ct$1(r))
811
+ if (!Ct$2(r))
810
812
  throw new TypeError("input must be an array");
811
813
  if (r.length === 0)
812
814
  throw new TypeError("input must not be empty");
@@ -821,13 +823,13 @@ function is(r) {
821
823
  }
822
824
  function rs(r) {
823
825
  var s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
824
- if (Ct$1(r)) {
826
+ if (Ct$2(r)) {
825
827
  if (r.length === 0)
826
828
  throw new TypeError("input must not be empty");
827
829
  } else throw new TypeError("input must be an array");
828
830
  var t;
829
831
  if (s.output !== void 0) {
830
- if (!Ct$1(s.output))
832
+ if (!Ct$2(s.output))
831
833
  throw new TypeError("output option must be an array if specified");
832
834
  t = s.output;
833
835
  } else
@@ -846,7 +848,7 @@ const os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
846
848
  __proto__: null,
847
849
  default: rs
848
850
  }, Symbol.toStringTag, { value: "Module" })), ls = /* @__PURE__ */ qe(os);
849
- Object.defineProperty($$1, "__esModule", { value: !0 });
851
+ Object.defineProperty($, "__esModule", { value: !0 });
850
852
  var st$3 = ss, je = ls;
851
853
  const Ut$1 = " ".repeat(2), Fe = " ".repeat(4);
852
854
  function hs() {
@@ -1297,12 +1299,12 @@ function cs(r, s) {
1297
1299
  return this;
1298
1300
  };
1299
1301
  }
1300
- function ot$2(r, s, t) {
1302
+ function ot$3(r, s, t) {
1301
1303
  let e = t ? r.rows : r.rows - 1;
1302
1304
  if (s < 0 || s > e)
1303
1305
  throw new RangeError("Row index out of range");
1304
1306
  }
1305
- function lt$2(r, s, t) {
1307
+ function lt$1(r, s, t) {
1306
1308
  let e = t ? r.columns : r.columns - 1;
1307
1309
  if (s < 0 || s > e)
1308
1310
  throw new RangeError("Column index out of range");
@@ -1336,7 +1338,7 @@ function we(r, s) {
1336
1338
  function ae$1(r, s, t, e, n) {
1337
1339
  if (arguments.length !== 5)
1338
1340
  throw new RangeError("expected 4 arguments");
1339
- if (Yt$2("startRow", s), Yt$2("endRow", t), Yt$2("startColumn", e), Yt$2("endColumn", n), s > t || e > n || s < 0 || s >= r.rows || t < 0 || t >= r.rows || e < 0 || e >= r.columns || n < 0 || n >= r.columns)
1341
+ if (Yt$1("startRow", s), Yt$1("endRow", t), Yt$1("startColumn", e), Yt$1("endColumn", n), s > t || e > n || s < 0 || s >= r.rows || t < 0 || t >= r.rows || e < 0 || e >= r.columns || n < 0 || n >= r.columns)
1340
1342
  throw new RangeError("Submatrix indices are out of range");
1341
1343
  }
1342
1344
  function Ht$1(r, s = 0) {
@@ -1345,11 +1347,11 @@ function Ht$1(r, s = 0) {
1345
1347
  t.push(s);
1346
1348
  return t;
1347
1349
  }
1348
- function Yt$2(r, s) {
1350
+ function Yt$1(r, s) {
1349
1351
  if (typeof s != "number")
1350
1352
  throw new TypeError(`${r} must be a number`);
1351
1353
  }
1352
- function yt$1(r) {
1354
+ function yt$2(r) {
1353
1355
  if (r.isEmpty())
1354
1356
  throw new Error("Empty matrix has no elements to index");
1355
1357
  }
@@ -1481,39 +1483,39 @@ function Ts(r, s) {
1481
1483
  for (let e = 0; e < r.columns; e++)
1482
1484
  r.set(t, e, r.get(t, e) / s);
1483
1485
  }
1484
- let V$2 = class V {
1486
+ let V$1 = class V {
1485
1487
  static from1DArray(s, t, e) {
1486
1488
  if (s * t !== e.length)
1487
1489
  throw new RangeError("data length does not match given dimensions");
1488
- let i = new _$2(s, t);
1490
+ let i = new _$3(s, t);
1489
1491
  for (let o = 0; o < s; o++)
1490
1492
  for (let l = 0; l < t; l++)
1491
1493
  i.set(o, l, e[o * t + l]);
1492
1494
  return i;
1493
1495
  }
1494
1496
  static rowVector(s) {
1495
- let t = new _$2(1, s.length);
1497
+ let t = new _$3(1, s.length);
1496
1498
  for (let e = 0; e < s.length; e++)
1497
1499
  t.set(0, e, s[e]);
1498
1500
  return t;
1499
1501
  }
1500
1502
  static columnVector(s) {
1501
- let t = new _$2(s.length, 1);
1503
+ let t = new _$3(s.length, 1);
1502
1504
  for (let e = 0; e < s.length; e++)
1503
1505
  t.set(e, 0, s[e]);
1504
1506
  return t;
1505
1507
  }
1506
1508
  static zeros(s, t) {
1507
- return new _$2(s, t);
1509
+ return new _$3(s, t);
1508
1510
  }
1509
1511
  static ones(s, t) {
1510
- return new _$2(s, t).fill(1);
1512
+ return new _$3(s, t).fill(1);
1511
1513
  }
1512
1514
  static rand(s, t, e = {}) {
1513
1515
  if (typeof e != "object")
1514
1516
  throw new TypeError("options must be an object");
1515
1517
  const { random: n = Math.random } = e;
1516
- let i = new _$2(s, t);
1518
+ let i = new _$3(s, t);
1517
1519
  for (let o = 0; o < s; o++)
1518
1520
  for (let l = 0; l < t; l++)
1519
1521
  i.set(o, l, n());
@@ -1526,7 +1528,7 @@ let V$2 = class V {
1526
1528
  if (!Number.isInteger(n)) throw new TypeError("min must be an integer");
1527
1529
  if (!Number.isInteger(i)) throw new TypeError("max must be an integer");
1528
1530
  if (n >= i) throw new RangeError("min must be smaller than max");
1529
- let l = i - n, h = new _$2(s, t);
1531
+ let l = i - n, h = new _$3(s, t);
1530
1532
  for (let a = 0; a < s; a++)
1531
1533
  for (let u = 0; u < t; u++) {
1532
1534
  let c = n + Math.round(o() * l);
@@ -1551,7 +1553,7 @@ let V$2 = class V {
1551
1553
  }
1552
1554
  static min(s, t) {
1553
1555
  s = this.checkMatrix(s), t = this.checkMatrix(t);
1554
- let e = s.rows, n = s.columns, i = new _$2(e, n);
1556
+ let e = s.rows, n = s.columns, i = new _$3(e, n);
1555
1557
  for (let o = 0; o < e; o++)
1556
1558
  for (let l = 0; l < n; l++)
1557
1559
  i.set(o, l, Math.min(s.get(o, l), t.get(o, l)));
@@ -1566,7 +1568,7 @@ let V$2 = class V {
1566
1568
  return i;
1567
1569
  }
1568
1570
  static checkMatrix(s) {
1569
- return V.isMatrix(s) ? s : new _$2(s);
1571
+ return V.isMatrix(s) ? s : new _$3(s);
1570
1572
  }
1571
1573
  static isMatrix(s) {
1572
1574
  return s != null && s.klass === "Matrix";
@@ -1710,7 +1712,7 @@ let V$2 = class V {
1710
1712
  throw new TypeError("rows must be a positive integer");
1711
1713
  if (!Number.isInteger(e) || e <= 0)
1712
1714
  throw new TypeError("columns must be a positive integer");
1713
- let n = new _$2(this.rows * t, this.columns * e);
1715
+ let n = new _$3(this.rows * t, this.columns * e);
1714
1716
  for (let i = 0; i < t; i++)
1715
1717
  for (let o = 0; o < e; o++)
1716
1718
  n.setSubMatrix(this, this.rows * i, this.columns * o);
@@ -1726,23 +1728,23 @@ let V$2 = class V {
1726
1728
  return this.mulS(-1);
1727
1729
  }
1728
1730
  getRow(s) {
1729
- ot$2(this, s);
1731
+ ot$3(this, s);
1730
1732
  let t = [];
1731
1733
  for (let e = 0; e < this.columns; e++)
1732
1734
  t.push(this.get(s, e));
1733
1735
  return t;
1734
1736
  }
1735
1737
  getRowVector(s) {
1736
- return _$2.rowVector(this.getRow(s));
1738
+ return _$3.rowVector(this.getRow(s));
1737
1739
  }
1738
1740
  setRow(s, t) {
1739
- ot$2(this, s), t = Pt$2(this, t);
1741
+ ot$3(this, s), t = Pt$2(this, t);
1740
1742
  for (let e = 0; e < this.columns; e++)
1741
1743
  this.set(s, e, t[e]);
1742
1744
  return this;
1743
1745
  }
1744
1746
  swapRows(s, t) {
1745
- ot$2(this, s), ot$2(this, t);
1747
+ ot$3(this, s), ot$3(this, t);
1746
1748
  for (let e = 0; e < this.columns; e++) {
1747
1749
  let n = this.get(s, e);
1748
1750
  this.set(s, e, this.get(t, e)), this.set(t, e, n);
@@ -1750,23 +1752,23 @@ let V$2 = class V {
1750
1752
  return this;
1751
1753
  }
1752
1754
  getColumn(s) {
1753
- lt$2(this, s);
1755
+ lt$1(this, s);
1754
1756
  let t = [];
1755
1757
  for (let e = 0; e < this.rows; e++)
1756
1758
  t.push(this.get(e, s));
1757
1759
  return t;
1758
1760
  }
1759
1761
  getColumnVector(s) {
1760
- return _$2.columnVector(this.getColumn(s));
1762
+ return _$3.columnVector(this.getColumn(s));
1761
1763
  }
1762
1764
  setColumn(s, t) {
1763
- lt$2(this, s), t = bt$2(this, t);
1765
+ lt$1(this, s), t = bt$2(this, t);
1764
1766
  for (let e = 0; e < this.rows; e++)
1765
1767
  this.set(e, s, t[e]);
1766
1768
  return this;
1767
1769
  }
1768
1770
  swapColumns(s, t) {
1769
- lt$2(this, s), lt$2(this, t);
1771
+ lt$1(this, s), lt$1(this, t);
1770
1772
  for (let e = 0; e < this.rows; e++) {
1771
1773
  let n = this.get(e, s);
1772
1774
  this.set(e, s, this.get(e, t)), this.set(e, t, n);
@@ -1830,13 +1832,13 @@ let V$2 = class V {
1830
1832
  return this;
1831
1833
  }
1832
1834
  mulRow(s, t) {
1833
- ot$2(this, s);
1835
+ ot$3(this, s);
1834
1836
  for (let e = 0; e < this.columns; e++)
1835
1837
  this.set(s, e, this.get(s, e) * t);
1836
1838
  return this;
1837
1839
  }
1838
1840
  mulColumn(s, t) {
1839
- lt$2(this, s);
1841
+ lt$1(this, s);
1840
1842
  for (let e = 0; e < this.rows; e++)
1841
1843
  this.set(e, s, this.get(e, s) * t);
1842
1844
  return this;
@@ -1871,7 +1873,7 @@ let V$2 = class V {
1871
1873
  }
1872
1874
  }
1873
1875
  maxIndex() {
1874
- yt$1(this);
1876
+ yt$2(this);
1875
1877
  let s = this.get(0, 0), t = [0, 0];
1876
1878
  for (let e = 0; e < this.rows; e++)
1877
1879
  for (let n = 0; n < this.columns; n++)
@@ -1908,7 +1910,7 @@ let V$2 = class V {
1908
1910
  }
1909
1911
  }
1910
1912
  minIndex() {
1911
- yt$1(this);
1913
+ yt$2(this);
1912
1914
  let s = this.get(0, 0), t = [0, 0];
1913
1915
  for (let e = 0; e < this.rows; e++)
1914
1916
  for (let n = 0; n < this.columns; n++)
@@ -1916,7 +1918,7 @@ let V$2 = class V {
1916
1918
  return t;
1917
1919
  }
1918
1920
  maxRow(s) {
1919
- if (ot$2(this, s), this.isEmpty())
1921
+ if (ot$3(this, s), this.isEmpty())
1920
1922
  return NaN;
1921
1923
  let t = this.get(s, 0);
1922
1924
  for (let e = 1; e < this.columns; e++)
@@ -1924,14 +1926,14 @@ let V$2 = class V {
1924
1926
  return t;
1925
1927
  }
1926
1928
  maxRowIndex(s) {
1927
- ot$2(this, s), yt$1(this);
1929
+ ot$3(this, s), yt$2(this);
1928
1930
  let t = this.get(s, 0), e = [s, 0];
1929
1931
  for (let n = 1; n < this.columns; n++)
1930
1932
  this.get(s, n) > t && (t = this.get(s, n), e[1] = n);
1931
1933
  return e;
1932
1934
  }
1933
1935
  minRow(s) {
1934
- if (ot$2(this, s), this.isEmpty())
1936
+ if (ot$3(this, s), this.isEmpty())
1935
1937
  return NaN;
1936
1938
  let t = this.get(s, 0);
1937
1939
  for (let e = 1; e < this.columns; e++)
@@ -1939,14 +1941,14 @@ let V$2 = class V {
1939
1941
  return t;
1940
1942
  }
1941
1943
  minRowIndex(s) {
1942
- ot$2(this, s), yt$1(this);
1944
+ ot$3(this, s), yt$2(this);
1943
1945
  let t = this.get(s, 0), e = [s, 0];
1944
1946
  for (let n = 1; n < this.columns; n++)
1945
1947
  this.get(s, n) < t && (t = this.get(s, n), e[1] = n);
1946
1948
  return e;
1947
1949
  }
1948
1950
  maxColumn(s) {
1949
- if (lt$2(this, s), this.isEmpty())
1951
+ if (lt$1(this, s), this.isEmpty())
1950
1952
  return NaN;
1951
1953
  let t = this.get(0, s);
1952
1954
  for (let e = 1; e < this.rows; e++)
@@ -1954,14 +1956,14 @@ let V$2 = class V {
1954
1956
  return t;
1955
1957
  }
1956
1958
  maxColumnIndex(s) {
1957
- lt$2(this, s), yt$1(this);
1959
+ lt$1(this, s), yt$2(this);
1958
1960
  let t = this.get(0, s), e = [0, s];
1959
1961
  for (let n = 1; n < this.rows; n++)
1960
1962
  this.get(n, s) > t && (t = this.get(n, s), e[0] = n);
1961
1963
  return e;
1962
1964
  }
1963
1965
  minColumn(s) {
1964
- if (lt$2(this, s), this.isEmpty())
1966
+ if (lt$1(this, s), this.isEmpty())
1965
1967
  return NaN;
1966
1968
  let t = this.get(0, s);
1967
1969
  for (let e = 1; e < this.rows; e++)
@@ -1969,7 +1971,7 @@ let V$2 = class V {
1969
1971
  return t;
1970
1972
  }
1971
1973
  minColumnIndex(s) {
1972
- lt$2(this, s), yt$1(this);
1974
+ lt$1(this, s), yt$2(this);
1973
1975
  let t = this.get(0, s), e = [0, s];
1974
1976
  for (let n = 1; n < this.rows; n++)
1975
1977
  this.get(n, s) < t && (t = this.get(n, s), e[0] = n);
@@ -2009,8 +2011,8 @@ let V$2 = class V {
2009
2011
  return e;
2010
2012
  }
2011
2013
  mmul(s) {
2012
- s = _$2.checkMatrix(s);
2013
- let t = this.rows, e = this.columns, n = s.columns, i = new _$2(t, n), o = new Float64Array(e);
2014
+ s = _$3.checkMatrix(s);
2015
+ let t = this.rows, e = this.columns, n = s.columns, i = new _$3(t, n), o = new Float64Array(e);
2014
2016
  for (let l = 0; l < n; l++) {
2015
2017
  for (let h = 0; h < e; h++)
2016
2018
  o[h] = s.get(h, l);
@@ -2028,25 +2030,25 @@ let V$2 = class V {
2028
2030
  throw new RangeError("Matrix must be square");
2029
2031
  if (!Number.isInteger(s) || s < 0)
2030
2032
  throw new RangeError("Exponent must be a non-negative integer");
2031
- let t = _$2.eye(this.rows), e = this;
2033
+ let t = _$3.eye(this.rows), e = this;
2032
2034
  for (let n = s; n > 1; n /= 2)
2033
2035
  n & 1 && (t = t.mmul(e)), e = e.mmul(e);
2034
2036
  return t;
2035
2037
  }
2036
2038
  strassen2x2(s) {
2037
- s = _$2.checkMatrix(s);
2038
- let t = new _$2(2, 2);
2039
+ s = _$3.checkMatrix(s);
2040
+ let t = new _$3(2, 2);
2039
2041
  const e = this.get(0, 0), n = s.get(0, 0), i = this.get(0, 1), o = s.get(0, 1), l = this.get(1, 0), h = s.get(1, 0), a = this.get(1, 1), u = s.get(1, 1), c = (e + a) * (n + u), g = (l + a) * n, d = e * (o - u), w = a * (h - n), p = (e + i) * u, P = (l - e) * (n + o), f = (i - a) * (h + u), M = c + w - p + f, E = d + p, R = g + w, v = c - g + d + P;
2040
2042
  return t.set(0, 0, M), t.set(0, 1, E), t.set(1, 0, R), t.set(1, 1, v), t;
2041
2043
  }
2042
2044
  strassen3x3(s) {
2043
- s = _$2.checkMatrix(s);
2044
- let t = new _$2(3, 3);
2045
+ s = _$3.checkMatrix(s);
2046
+ let t = new _$3(3, 3);
2045
2047
  const e = this.get(0, 0), n = this.get(0, 1), i = this.get(0, 2), o = this.get(1, 0), l = this.get(1, 1), h = this.get(1, 2), a = this.get(2, 0), u = this.get(2, 1), c = this.get(2, 2), g = s.get(0, 0), d = s.get(0, 1), w = s.get(0, 2), p = s.get(1, 0), P = s.get(1, 1), f = s.get(1, 2), M = s.get(2, 0), E = s.get(2, 1), R = s.get(2, 2), v = (e + n + i - o - l - u - c) * P, L = (e - o) * (-d + P), S = l * (-g + d + p - P - f - M + R), k = (-e + o + l) * (g - d + P), D = (o + l) * (-g + d), m = e * g, b = (-e + a + u) * (g - w + f), j = (-e + a) * (w - f), y = (a + u) * (-g + w), C = (e + n + i - l - h - a - u) * f, F = u * (-g + w + p - P - f - M + E), I = (-i + u + c) * (P + M - E), B = (i - c) * (P - E), x = i * M, N = (u + c) * (-M + E), A = (-i + l + h) * (f + M - R), O = (i - h) * (f - R), U = (l + h) * (-M + R), T = n * p, z = h * E, X = o * w, G = a * d, W = c * R, se = m + x + T, ne = v + k + D + m + I + x + N, ie = m + b + y + C + x + A + U, re = L + S + k + m + x + A + O, At = L + k + D + m + z, Vt = x + A + O + U + X, Nt = m + b + j + F + I + B + x, $t = I + B + x + N + G, Lt = m + b + j + y + W;
2046
2048
  return t.set(0, 0, se), t.set(0, 1, ne), t.set(0, 2, ie), t.set(1, 0, re), t.set(1, 1, At), t.set(1, 2, Vt), t.set(2, 0, Nt), t.set(2, 1, $t), t.set(2, 2, Lt), t;
2047
2049
  }
2048
2050
  mmulStrassen(s) {
2049
- s = _$2.checkMatrix(s);
2051
+ s = _$3.checkMatrix(s);
2050
2052
  let t = this.clone(), e = t.rows, n = t.columns, i = s.rows, o = s.columns;
2051
2053
  n !== i && console.warn(
2052
2054
  `Multiplying ${e} x ${n} and ${i} x ${o} matrix: dimensions do not match.`
@@ -2097,7 +2099,7 @@ let V$2 = class V {
2097
2099
  if (!Number.isFinite(t)) throw new TypeError("min must be a number");
2098
2100
  if (!Number.isFinite(e)) throw new TypeError("max must be a number");
2099
2101
  if (t >= e) throw new RangeError("min must be smaller than max");
2100
- let n = new _$2(this.rows, this.columns);
2102
+ let n = new _$3(this.rows, this.columns);
2101
2103
  for (let i = 0; i < this.rows; i++) {
2102
2104
  const o = this.getRow(i);
2103
2105
  o.length > 0 && je(o, { min: t, max: e, output: o }), n.setRow(i, o);
@@ -2111,7 +2113,7 @@ let V$2 = class V {
2111
2113
  if (!Number.isFinite(t)) throw new TypeError("min must be a number");
2112
2114
  if (!Number.isFinite(e)) throw new TypeError("max must be a number");
2113
2115
  if (t >= e) throw new RangeError("min must be smaller than max");
2114
- let n = new _$2(this.rows, this.columns);
2116
+ let n = new _$3(this.rows, this.columns);
2115
2117
  for (let i = 0; i < this.columns; i++) {
2116
2118
  const o = this.getColumn(i);
2117
2119
  o.length && je(o, {
@@ -2141,8 +2143,8 @@ let V$2 = class V {
2141
2143
  return this;
2142
2144
  }
2143
2145
  kroneckerProduct(s) {
2144
- s = _$2.checkMatrix(s);
2145
- let t = this.rows, e = this.columns, n = s.rows, i = s.columns, o = new _$2(t * n, e * i);
2146
+ s = _$3.checkMatrix(s);
2147
+ let t = this.rows, e = this.columns, n = s.rows, i = s.columns, o = new _$3(t * n, e * i);
2146
2148
  for (let l = 0; l < t; l++)
2147
2149
  for (let h = 0; h < e; h++)
2148
2150
  for (let a = 0; a < n; a++)
@@ -2151,13 +2153,13 @@ let V$2 = class V {
2151
2153
  return o;
2152
2154
  }
2153
2155
  kroneckerSum(s) {
2154
- if (s = _$2.checkMatrix(s), !this.isSquare() || !s.isSquare())
2156
+ if (s = _$3.checkMatrix(s), !this.isSquare() || !s.isSquare())
2155
2157
  throw new Error("Kronecker Sum needs two Square Matrices");
2156
- let t = this.rows, e = s.rows, n = this.kroneckerProduct(_$2.eye(e, e)), i = _$2.eye(t, t).kroneckerProduct(s);
2158
+ let t = this.rows, e = s.rows, n = this.kroneckerProduct(_$3.eye(e, e)), i = _$3.eye(t, t).kroneckerProduct(s);
2157
2159
  return n.add(i);
2158
2160
  }
2159
2161
  transpose() {
2160
- let s = new _$2(this.columns, this.rows);
2162
+ let s = new _$3(this.columns, this.rows);
2161
2163
  for (let t = 0; t < this.rows; t++)
2162
2164
  for (let e = 0; e < this.columns; e++)
2163
2165
  s.set(e, t, this.get(t, e));
@@ -2175,7 +2177,7 @@ let V$2 = class V {
2175
2177
  }
2176
2178
  subMatrix(s, t, e, n) {
2177
2179
  ae$1(this, s, t, e, n);
2178
- let i = new _$2(
2180
+ let i = new _$3(
2179
2181
  t - s + 1,
2180
2182
  n - e + 1
2181
2183
  );
@@ -2187,7 +2189,7 @@ let V$2 = class V {
2187
2189
  subMatrixRow(s, t, e) {
2188
2190
  if (t === void 0 && (t = 0), e === void 0 && (e = this.columns - 1), t > e || t < 0 || t >= this.columns || e < 0 || e >= this.columns)
2189
2191
  throw new RangeError("Argument out of range");
2190
- let n = new _$2(s.length, e - t + 1);
2192
+ let n = new _$3(s.length, e - t + 1);
2191
2193
  for (let i = 0; i < s.length; i++)
2192
2194
  for (let o = t; o <= e; o++) {
2193
2195
  if (s[i] < 0 || s[i] >= this.rows)
@@ -2199,7 +2201,7 @@ let V$2 = class V {
2199
2201
  subMatrixColumn(s, t, e) {
2200
2202
  if (t === void 0 && (t = 0), e === void 0 && (e = this.rows - 1), t > e || t < 0 || t >= this.rows || e < 0 || e >= this.rows)
2201
2203
  throw new RangeError("Argument out of range");
2202
- let n = new _$2(e - t + 1, s.length);
2204
+ let n = new _$3(e - t + 1, s.length);
2203
2205
  for (let i = 0; i < s.length; i++)
2204
2206
  for (let o = t; o <= e; o++) {
2205
2207
  if (s[i] < 0 || s[i] >= this.columns)
@@ -2209,7 +2211,7 @@ let V$2 = class V {
2209
2211
  return n;
2210
2212
  }
2211
2213
  setSubMatrix(s, t, e) {
2212
- if (s = _$2.checkMatrix(s), s.isEmpty())
2214
+ if (s = _$3.checkMatrix(s), s.isEmpty())
2213
2215
  return this;
2214
2216
  let n = t + s.rows - 1, i = e + s.columns - 1;
2215
2217
  ae$1(this, t, n, e, i);
@@ -2220,7 +2222,7 @@ let V$2 = class V {
2220
2222
  }
2221
2223
  selection(s, t) {
2222
2224
  ge(this, s), we(this, t);
2223
- let e = new _$2(s.length, t.length);
2225
+ let e = new _$3(s.length, t.length);
2224
2226
  for (let n = 0; n < s.length; n++) {
2225
2227
  let i = s[n];
2226
2228
  for (let o = 0; o < t.length; o++) {
@@ -2237,7 +2239,7 @@ let V$2 = class V {
2237
2239
  return t;
2238
2240
  }
2239
2241
  clone() {
2240
- return this.constructor.copy(this, new _$2(this.rows, this.columns));
2242
+ return this.constructor.copy(this, new _$3(this.rows, this.columns));
2241
2243
  }
2242
2244
  /**
2243
2245
  * @template {AbstractMatrix} M
@@ -2409,23 +2411,23 @@ let V$2 = class V {
2409
2411
  yield this.get(s, t);
2410
2412
  }
2411
2413
  };
2412
- V$2.prototype.klass = "Matrix";
2413
- typeof Symbol < "u" && (V$2.prototype[Symbol.for("nodejs.util.inspect.custom")] = hs);
2414
+ V$1.prototype.klass = "Matrix";
2415
+ typeof Symbol < "u" && (V$1.prototype[Symbol.for("nodejs.util.inspect.custom")] = hs);
2414
2416
  function ke(r, s) {
2415
2417
  return r - s;
2416
2418
  }
2417
2419
  function Is(r) {
2418
2420
  return r.every((s) => typeof s == "number");
2419
2421
  }
2420
- V$2.random = V$2.rand;
2421
- V$2.randomInt = V$2.randInt;
2422
- V$2.diagonal = V$2.diag;
2423
- V$2.prototype.diagonal = V$2.prototype.diag;
2424
- V$2.identity = V$2.eye;
2425
- V$2.prototype.negate = V$2.prototype.neg;
2426
- V$2.prototype.tensorProduct = V$2.prototype.kroneckerProduct;
2427
- var Ft$1, ue, dt$1;
2428
- let _$2 = (dt$1 = class extends V$2 {
2422
+ V$1.random = V$1.rand;
2423
+ V$1.randomInt = V$1.randInt;
2424
+ V$1.diagonal = V$1.diag;
2425
+ V$1.prototype.diagonal = V$1.prototype.diag;
2426
+ V$1.identity = V$1.eye;
2427
+ V$1.prototype.negate = V$1.prototype.neg;
2428
+ V$1.prototype.tensorProduct = V$1.prototype.kroneckerProduct;
2429
+ var Ft$1, ue, dt;
2430
+ let _$3 = (dt = class extends V$1 {
2429
2431
  constructor(t, e) {
2430
2432
  super();
2431
2433
  le$1(this, Ft$1);
@@ -2433,8 +2435,8 @@ let _$2 = (dt$1 = class extends V$2 {
2433
2435
  * @type {Float64Array[]}
2434
2436
  */
2435
2437
  q$2(this, "data");
2436
- if (dt$1.isMatrix(t))
2437
- he(this, Ft$1, ue).call(this, t.rows, t.columns), dt$1.copy(t, this);
2438
+ if (dt.isMatrix(t))
2439
+ he(this, Ft$1, ue).call(this, t.rows, t.columns), dt.copy(t, this);
2438
2440
  else if (Number.isInteger(t) && t >= 0)
2439
2441
  he(this, Ft$1, ue).call(this, t, e);
2440
2442
  else if (st$3.isAnyArray(t)) {
@@ -2464,13 +2466,13 @@ let _$2 = (dt$1 = class extends V$2 {
2464
2466
  return this.data[t][e];
2465
2467
  }
2466
2468
  removeRow(t) {
2467
- return ot$2(this, t), this.data.splice(t, 1), this.rows -= 1, this;
2469
+ return ot$3(this, t), this.data.splice(t, 1), this.rows -= 1, this;
2468
2470
  }
2469
2471
  addRow(t, e) {
2470
- return e === void 0 && (e = t, t = this.rows), ot$2(this, t, !0), e = Float64Array.from(Pt$2(this, e)), this.data.splice(t, 0, e), this.rows += 1, this;
2472
+ return e === void 0 && (e = t, t = this.rows), ot$3(this, t, !0), e = Float64Array.from(Pt$2(this, e)), this.data.splice(t, 0, e), this.rows += 1, this;
2471
2473
  }
2472
2474
  removeColumn(t) {
2473
- lt$2(this, t);
2475
+ lt$1(this, t);
2474
2476
  for (let e = 0; e < this.rows; e++) {
2475
2477
  const n = new Float64Array(this.columns - 1);
2476
2478
  for (let i = 0; i < t; i++)
@@ -2482,7 +2484,7 @@ let _$2 = (dt$1 = class extends V$2 {
2482
2484
  return this.columns -= 1, this;
2483
2485
  }
2484
2486
  addColumn(t, e) {
2485
- typeof e > "u" && (e = t, t = this.columns), lt$2(this, t, !0), e = bt$2(this, e);
2487
+ typeof e > "u" && (e = t, t = this.columns), lt$1(this, t, !0), e = bt$2(this, e);
2486
2488
  for (let n = 0; n < this.rows; n++) {
2487
2489
  const i = new Float64Array(this.columns + 1);
2488
2490
  let o = 0;
@@ -2506,10 +2508,10 @@ ue = function(t, e) {
2506
2508
  else
2507
2509
  throw new TypeError("nColumns must be a positive integer");
2508
2510
  this.rows = t, this.columns = e;
2509
- }, dt$1);
2510
- cs(V$2, _$2);
2511
+ }, dt);
2512
+ cs(V$1, _$3);
2511
2513
  var K$2;
2512
- const Jt = class Jt extends V$2 {
2514
+ const Jt = class Jt extends V$1 {
2513
2515
  /**
2514
2516
  * @param {number | AbstractMatrix | ArrayLike<ArrayLike<number>>} diagonalSize
2515
2517
  * @return {this}
@@ -2518,26 +2520,26 @@ const Jt = class Jt extends V$2 {
2518
2520
  super();
2519
2521
  /** @type {Matrix} */
2520
2522
  le$1(this, K$2);
2521
- if (_$2.isMatrix(t)) {
2523
+ if (_$3.isMatrix(t)) {
2522
2524
  if (!t.isSymmetric())
2523
2525
  throw new TypeError("not symmetric data");
2524
- Dt$1(this, K$2, _$2.copy(
2526
+ Dt$1(this, K$2, _$3.copy(
2525
2527
  t,
2526
- new _$2(t.rows, t.rows)
2528
+ new _$3(t.rows, t.rows)
2527
2529
  ));
2528
2530
  } else if (Number.isInteger(t) && t >= 0)
2529
- Dt$1(this, K$2, new _$2(t, t));
2530
- else if (Dt$1(this, K$2, new _$2(t)), !this.isSymmetric())
2531
+ Dt$1(this, K$2, new _$3(t, t));
2532
+ else if (Dt$1(this, K$2, new _$3(t)), !this.isSymmetric())
2531
2533
  throw new TypeError("not symmetric data");
2532
2534
  }
2533
2535
  get size() {
2534
- return ht$2(this, K$2).size;
2536
+ return ht$1(this, K$2).size;
2535
2537
  }
2536
2538
  get rows() {
2537
- return ht$2(this, K$2).rows;
2539
+ return ht$1(this, K$2).rows;
2538
2540
  }
2539
2541
  get columns() {
2540
- return ht$2(this, K$2).columns;
2542
+ return ht$1(this, K$2).columns;
2541
2543
  }
2542
2544
  get diagonalSize() {
2543
2545
  return this.rows;
@@ -2550,7 +2552,7 @@ const Jt = class Jt extends V$2 {
2550
2552
  * @returns {boolean}
2551
2553
  */
2552
2554
  static isSymmetricMatrix(t) {
2553
- return _$2.isMatrix(t) && t.klassType === "SymmetricMatrix";
2555
+ return _$3.isMatrix(t) && t.klassType === "SymmetricMatrix";
2554
2556
  }
2555
2557
  /**
2556
2558
  * @param diagonalSize
@@ -2573,21 +2575,21 @@ const Jt = class Jt extends V$2 {
2573
2575
  return t;
2574
2576
  }
2575
2577
  toMatrix() {
2576
- return new _$2(this);
2578
+ return new _$3(this);
2577
2579
  }
2578
2580
  get(t, e) {
2579
- return ht$2(this, K$2).get(t, e);
2581
+ return ht$1(this, K$2).get(t, e);
2580
2582
  }
2581
2583
  set(t, e, n) {
2582
- return ht$2(this, K$2).set(t, e, n), ht$2(this, K$2).set(e, t, n), this;
2584
+ return ht$1(this, K$2).set(t, e, n), ht$1(this, K$2).set(e, t, n), this;
2583
2585
  }
2584
2586
  removeCross(t) {
2585
- return ht$2(this, K$2).removeRow(t), ht$2(this, K$2).removeColumn(t), this;
2587
+ return ht$1(this, K$2).removeRow(t), ht$1(this, K$2).removeColumn(t), this;
2586
2588
  }
2587
2589
  addCross(t, e) {
2588
2590
  e === void 0 && (e = t, t = this.diagonalSize);
2589
2591
  const n = e.slice();
2590
- return n.splice(t, 1), ht$2(this, K$2).addRow(t, n), ht$2(this, K$2).addColumn(t, e), this;
2592
+ return n.splice(t, 1), ht$1(this, K$2).addRow(t, n), ht$1(this, K$2).addColumn(t, e), this;
2591
2593
  }
2592
2594
  /**
2593
2595
  * @param {Mask[]} mask
@@ -2668,9 +2670,9 @@ const Jt = class Jt extends V$2 {
2668
2670
  }
2669
2671
  };
2670
2672
  K$2 = new WeakMap();
2671
- let pt$2 = Jt;
2672
- pt$2.prototype.klassType = "SymmetricMatrix";
2673
- let te$1 = class te extends pt$2 {
2673
+ let pt$1 = Jt;
2674
+ pt$1.prototype.klassType = "SymmetricMatrix";
2675
+ let te$1 = class te extends pt$1 {
2674
2676
  /**
2675
2677
  * not the same as matrix.isSymmetric()
2676
2678
  * Here is to check if it's instanceof SymmetricMatrix without bundling issues
@@ -2679,7 +2681,7 @@ let te$1 = class te extends pt$2 {
2679
2681
  * @returns {boolean}
2680
2682
  */
2681
2683
  static isDistanceMatrix(s) {
2682
- return pt$2.isSymmetricMatrix(s) && s.klassSubType === "DistanceMatrix";
2684
+ return pt$1.isSymmetricMatrix(s) && s.klassSubType === "DistanceMatrix";
2683
2685
  }
2684
2686
  constructor(s) {
2685
2687
  if (super(s), !this.isDistance())
@@ -2692,7 +2694,7 @@ let te$1 = class te extends pt$2 {
2692
2694
  return t === void 0 && (t = s, s = this.diagonalSize), t = t.slice(), t[s] = 0, super.addCross(s, t);
2693
2695
  }
2694
2696
  toSymmetricMatrix() {
2695
- return new pt$2(this);
2697
+ return new pt$1(this);
2696
2698
  }
2697
2699
  clone() {
2698
2700
  const s = new te(this.diagonalSize);
@@ -2746,14 +2748,14 @@ let te$1 = class te extends pt$2 {
2746
2748
  }
2747
2749
  };
2748
2750
  te$1.prototype.klassSubType = "DistanceMatrix";
2749
- let ft$1 = class ft extends V$2 {
2751
+ let ft$2 = class ft extends V$1 {
2750
2752
  constructor(s, t, e) {
2751
2753
  super(), this.matrix = s, this.rows = t, this.columns = e;
2752
2754
  }
2753
2755
  };
2754
- class Cs extends ft$1 {
2756
+ class Cs extends ft$2 {
2755
2757
  constructor(s, t) {
2756
- lt$2(s, t), super(s, s.rows, 1), this.column = t;
2758
+ lt$1(s, t), super(s, s.rows, 1), this.column = t;
2757
2759
  }
2758
2760
  set(s, t, e) {
2759
2761
  return this.matrix.set(s, this.column, e), this;
@@ -2762,7 +2764,7 @@ class Cs extends ft$1 {
2762
2764
  return this.matrix.get(s, this.column);
2763
2765
  }
2764
2766
  }
2765
- class qs extends ft$1 {
2767
+ class qs extends ft$2 {
2766
2768
  constructor(s, t) {
2767
2769
  we(s, t), super(s, s.rows, t.length), this.columnIndices = t;
2768
2770
  }
@@ -2773,7 +2775,7 @@ class qs extends ft$1 {
2773
2775
  return this.matrix.get(s, this.columnIndices[t]);
2774
2776
  }
2775
2777
  }
2776
- class Fs extends ft$1 {
2778
+ class Fs extends ft$2 {
2777
2779
  constructor(s) {
2778
2780
  super(s, s.rows, s.columns);
2779
2781
  }
@@ -2784,7 +2786,7 @@ class Fs extends ft$1 {
2784
2786
  return this.matrix.get(s, this.columns - t - 1);
2785
2787
  }
2786
2788
  }
2787
- class xs extends ft$1 {
2789
+ class xs extends ft$2 {
2788
2790
  constructor(s) {
2789
2791
  super(s, s.rows, s.columns);
2790
2792
  }
@@ -2795,9 +2797,9 @@ class xs extends ft$1 {
2795
2797
  return this.matrix.get(this.rows - s - 1, t);
2796
2798
  }
2797
2799
  }
2798
- class As extends ft$1 {
2800
+ class As extends ft$2 {
2799
2801
  constructor(s, t) {
2800
- ot$2(s, t), super(s, 1, s.columns), this.row = t;
2802
+ ot$3(s, t), super(s, 1, s.columns), this.row = t;
2801
2803
  }
2802
2804
  set(s, t, e) {
2803
2805
  return this.matrix.set(this.row, t, e), this;
@@ -2806,7 +2808,7 @@ class As extends ft$1 {
2806
2808
  return this.matrix.get(this.row, t);
2807
2809
  }
2808
2810
  }
2809
- class Vs extends ft$1 {
2811
+ class Vs extends ft$2 {
2810
2812
  constructor(s, t) {
2811
2813
  ge(s, t), super(s, t.length, s.columns), this.rowIndices = t;
2812
2814
  }
@@ -2817,7 +2819,7 @@ class Vs extends ft$1 {
2817
2819
  return this.matrix.get(this.rowIndices[s], t);
2818
2820
  }
2819
2821
  }
2820
- let Gt$1 = class Gt extends ft$1 {
2822
+ let Gt$1 = class Gt extends ft$2 {
2821
2823
  constructor(s, t, e) {
2822
2824
  ge(s, t), we(s, e), super(s, t.length, e.length), this.rowIndices = t, this.columnIndices = e;
2823
2825
  }
@@ -2835,7 +2837,7 @@ let Gt$1 = class Gt extends ft$1 {
2835
2837
  );
2836
2838
  }
2837
2839
  };
2838
- class Ns extends ft$1 {
2840
+ class Ns extends ft$2 {
2839
2841
  constructor(s, t, e, n, i) {
2840
2842
  ae$1(s, t, e, n, i), super(s, e - t + 1, i - n + 1), this.startRow = t, this.startColumn = n;
2841
2843
  }
@@ -2853,7 +2855,7 @@ class Ns extends ft$1 {
2853
2855
  );
2854
2856
  }
2855
2857
  }
2856
- class $s extends ft$1 {
2858
+ class $s extends ft$2 {
2857
2859
  constructor(s) {
2858
2860
  super(s, s.columns, s.rows);
2859
2861
  }
@@ -2864,7 +2866,7 @@ class $s extends ft$1 {
2864
2866
  return this.matrix.get(t, s);
2865
2867
  }
2866
2868
  }
2867
- class Ae extends V$2 {
2869
+ class Ae extends V$1 {
2868
2870
  constructor(s, t = {}) {
2869
2871
  const { rows: e = 1 } = t;
2870
2872
  if (s.length % e !== 0)
@@ -2883,7 +2885,7 @@ class Ae extends V$2 {
2883
2885
  return s * this.columns + t;
2884
2886
  }
2885
2887
  }
2886
- let rt$2 = class rt extends V$2 {
2888
+ let rt$3 = class rt extends V$1 {
2887
2889
  constructor(s) {
2888
2890
  super(), this.data = s, this.rows = s.length, this.columns = s[0].length;
2889
2891
  }
@@ -2896,12 +2898,12 @@ let rt$2 = class rt extends V$2 {
2896
2898
  };
2897
2899
  function Ls(r, s) {
2898
2900
  if (st$3.isAnyArray(r))
2899
- return r[0] && st$3.isAnyArray(r[0]) ? new rt$2(r) : new Ae(r, s);
2901
+ return r[0] && st$3.isAnyArray(r[0]) ? new rt$3(r) : new Ae(r, s);
2900
2902
  throw new Error("the argument is not an array");
2901
2903
  }
2902
2904
  let ee$1 = class ee {
2903
2905
  constructor(s) {
2904
- s = rt$2.checkMatrix(s);
2906
+ s = rt$3.checkMatrix(s);
2905
2907
  let t = s.clone(), e = t.rows, n = t.columns, i = new Float64Array(e), o = 1, l, h, a, u, c, g, d, w, p;
2906
2908
  for (l = 0; l < e; l++)
2907
2909
  i[l] = l;
@@ -2934,7 +2936,7 @@ let ee$1 = class ee {
2934
2936
  return !1;
2935
2937
  }
2936
2938
  solve(s) {
2937
- s = _$2.checkMatrix(s);
2939
+ s = _$3.checkMatrix(s);
2938
2940
  let t = this.LU;
2939
2941
  if (t.rows !== s.rows)
2940
2942
  throw new Error("Invalid matrix dimensions");
@@ -2964,14 +2966,14 @@ let ee$1 = class ee {
2964
2966
  return t;
2965
2967
  }
2966
2968
  get lowerTriangularMatrix() {
2967
- let s = this.LU, t = s.rows, e = s.columns, n = new _$2(t, e);
2969
+ let s = this.LU, t = s.rows, e = s.columns, n = new _$3(t, e);
2968
2970
  for (let i = 0; i < t; i++)
2969
2971
  for (let o = 0; o < e; o++)
2970
2972
  i > o ? n.set(i, o, s.get(i, o)) : i === o ? n.set(i, o, 1) : n.set(i, o, 0);
2971
2973
  return n;
2972
2974
  }
2973
2975
  get upperTriangularMatrix() {
2974
- let s = this.LU, t = s.rows, e = s.columns, n = new _$2(t, e);
2976
+ let s = this.LU, t = s.rows, e = s.columns, n = new _$3(t, e);
2975
2977
  for (let i = 0; i < t; i++)
2976
2978
  for (let o = 0; o < e; o++)
2977
2979
  i <= o ? n.set(i, o, s.get(i, o)) : n.set(i, o, 0);
@@ -2981,18 +2983,18 @@ let ee$1 = class ee {
2981
2983
  return Array.from(this.pivotVector);
2982
2984
  }
2983
2985
  };
2984
- function ut$2(r, s) {
2986
+ function ut$1(r, s) {
2985
2987
  let t = 0;
2986
2988
  return Math.abs(r) > Math.abs(s) ? (t = s / r, Math.abs(r) * Math.sqrt(1 + t * t)) : s !== 0 ? (t = r / s, Math.abs(s) * Math.sqrt(1 + t * t)) : 0;
2987
2989
  }
2988
2990
  class pe {
2989
2991
  constructor(s) {
2990
- s = rt$2.checkMatrix(s);
2992
+ s = rt$3.checkMatrix(s);
2991
2993
  let t = s.clone(), e = s.rows, n = s.columns, i = new Float64Array(n), o, l, h, a;
2992
2994
  for (h = 0; h < n; h++) {
2993
2995
  let u = 0;
2994
2996
  for (o = h; o < e; o++)
2995
- u = ut$2(u, t.get(o, h));
2997
+ u = ut$1(u, t.get(o, h));
2996
2998
  if (u !== 0) {
2997
2999
  for (t.get(h, h) < 0 && (u = -u), o = h; o < e; o++)
2998
3000
  t.set(o, h, t.get(o, h) / u);
@@ -3008,7 +3010,7 @@ class pe {
3008
3010
  this.QR = t, this.Rdiag = i;
3009
3011
  }
3010
3012
  solve(s) {
3011
- s = _$2.checkMatrix(s);
3013
+ s = _$3.checkMatrix(s);
3012
3014
  let t = this.QR, e = t.rows;
3013
3015
  if (s.rows !== e)
3014
3016
  throw new Error("Matrix row dimensions must agree");
@@ -3039,14 +3041,14 @@ class pe {
3039
3041
  return !0;
3040
3042
  }
3041
3043
  get upperTriangularMatrix() {
3042
- let s = this.QR, t = s.columns, e = new _$2(t, t), n, i;
3044
+ let s = this.QR, t = s.columns, e = new _$3(t, t), n, i;
3043
3045
  for (n = 0; n < t; n++)
3044
3046
  for (i = 0; i < t; i++)
3045
3047
  n < i ? e.set(n, i, s.get(n, i)) : n === i ? e.set(n, i, this.Rdiag[n]) : e.set(n, i, 0);
3046
3048
  return e;
3047
3049
  }
3048
3050
  get orthogonalMatrix() {
3049
- let s = this.QR, t = s.rows, e = s.columns, n = new _$2(t, e), i, o, l, h;
3051
+ let s = this.QR, t = s.rows, e = s.columns, n = new _$3(t, e), i, o, l, h;
3050
3052
  for (l = e - 1; l >= 0; l--) {
3051
3053
  for (i = 0; i < t; i++)
3052
3054
  n.set(i, l, 0);
@@ -3061,9 +3063,9 @@ class pe {
3061
3063
  return n;
3062
3064
  }
3063
3065
  }
3064
- let vt$1 = class vt {
3066
+ let vt$2 = class vt {
3065
3067
  constructor(s, t = {}) {
3066
- if (s = rt$2.checkMatrix(s), s.isEmpty())
3068
+ if (s = rt$3.checkMatrix(s), s.isEmpty())
3067
3069
  throw new Error("Matrix must be non-empty");
3068
3070
  let e = s.rows, n = s.columns;
3069
3071
  const {
@@ -3084,14 +3086,14 @@ let vt$1 = class vt {
3084
3086
  }
3085
3087
  else
3086
3088
  c = s.clone();
3087
- let g = Math.min(e, n), d = Math.min(e + 1, n), w = new Float64Array(d), p = new _$2(e, g), P = new _$2(n, n), f = new Float64Array(n), M = new Float64Array(e), E = new Float64Array(d);
3089
+ let g = Math.min(e, n), d = Math.min(e + 1, n), w = new Float64Array(d), p = new _$3(e, g), P = new _$3(n, n), f = new Float64Array(n), M = new Float64Array(e), E = new Float64Array(d);
3088
3090
  for (let m = 0; m < d; m++) E[m] = m;
3089
3091
  let R = Math.min(e - 1, n), v = Math.max(0, Math.min(n - 2, e)), L = Math.max(R, v);
3090
3092
  for (let m = 0; m < L; m++) {
3091
3093
  if (m < R) {
3092
3094
  w[m] = 0;
3093
3095
  for (let b = m; b < e; b++)
3094
- w[m] = ut$2(w[m], c.get(b, m));
3096
+ w[m] = ut$1(w[m], c.get(b, m));
3095
3097
  if (w[m] !== 0) {
3096
3098
  c.get(m, m) < 0 && (w[m] = -w[m]);
3097
3099
  for (let b = m; b < e; b++)
@@ -3117,7 +3119,7 @@ let vt$1 = class vt {
3117
3119
  if (m < v) {
3118
3120
  f[m] = 0;
3119
3121
  for (let b = m + 1; b < n; b++)
3120
- f[m] = ut$2(f[m], f[b]);
3122
+ f[m] = ut$1(f[m], f[b]);
3121
3123
  if (f[m] !== 0) {
3122
3124
  f[m + 1] < 0 && (f[m] = 0 - f[m]);
3123
3125
  for (let b = m + 1; b < n; b++)
@@ -3212,7 +3214,7 @@ let vt$1 = class vt {
3212
3214
  let j = f[S - 2];
3213
3215
  f[S - 2] = 0;
3214
3216
  for (let y = S - 2; y >= m; y--) {
3215
- let C = ut$2(w[y], j), F = w[y] / C, I = j / C;
3217
+ let C = ut$1(w[y], j), F = w[y] / C, I = j / C;
3216
3218
  if (w[y] = C, y !== m && (j = -I * f[y - 1], f[y - 1] = F * f[y - 1]), a)
3217
3219
  for (let B = 0; B < n; B++)
3218
3220
  C = F * P.get(B, y) + I * P.get(B, S - 1), P.set(B, S - 1, -I * P.get(B, y) + F * P.get(B, S - 1)), P.set(B, y, C);
@@ -3223,7 +3225,7 @@ let vt$1 = class vt {
3223
3225
  let j = f[m - 1];
3224
3226
  f[m - 1] = 0;
3225
3227
  for (let y = m; y < S; y++) {
3226
- let C = ut$2(w[y], j), F = w[y] / C, I = j / C;
3228
+ let C = ut$1(w[y], j), F = w[y] / C, I = j / C;
3227
3229
  if (w[y] = C, j = -I * f[y], f[y] = F * f[y], h)
3228
3230
  for (let B = 0; B < e; B++)
3229
3231
  C = F * p.get(B, y) + I * p.get(B, m - 1), p.set(B, m - 1, -I * p.get(B, y) + F * p.get(B, m - 1)), p.set(B, y, C);
@@ -3242,13 +3244,13 @@ let vt$1 = class vt {
3242
3244
  (x !== 0 || N !== 0) && (x < 0 ? A = 0 - Math.sqrt(x * x + N) : A = Math.sqrt(x * x + N), A = N / (x + A));
3243
3245
  let O = (I + y) * (I - y) + A, U = I * B;
3244
3246
  for (let T = m; T < S - 1; T++) {
3245
- let z = ut$2(O, U);
3247
+ let z = ut$1(O, U);
3246
3248
  z === 0 && (z = Number.MIN_VALUE);
3247
3249
  let X = O / z, G = U / z;
3248
3250
  if (T !== m && (f[T - 1] = z), O = X * w[T] + G * f[T], f[T] = X * f[T] - G * w[T], U = G * w[T + 1], w[T + 1] = X * w[T + 1], a)
3249
3251
  for (let W = 0; W < n; W++)
3250
3252
  z = X * P.get(W, T) + G * P.get(W, T + 1), P.set(W, T + 1, -G * P.get(W, T) + X * P.get(W, T + 1)), P.set(W, T, z);
3251
- if (z = ut$2(O, U), z === 0 && (z = Number.MIN_VALUE), X = O / z, G = U / z, w[T] = z, O = X * f[T] + G * w[T + 1], w[T + 1] = -G * f[T] + X * w[T + 1], U = G * f[T + 1], f[T + 1] = X * f[T + 1], h && T < e - 1)
3253
+ if (z = ut$1(O, U), z === 0 && (z = Number.MIN_VALUE), X = O / z, G = U / z, w[T] = z, O = X * f[T] + G * w[T + 1], w[T + 1] = -G * f[T] + X * w[T + 1], U = G * f[T + 1], f[T + 1] = X * f[T + 1], h && T < e - 1)
3252
3254
  for (let W = 0; W < e; W++)
3253
3255
  z = X * p.get(W, T) + G * p.get(W, T + 1), p.set(W, T + 1, -G * p.get(W, T) + X * p.get(W, T + 1)), p.set(W, T, z);
3254
3256
  }
@@ -3281,10 +3283,10 @@ let vt$1 = class vt {
3281
3283
  this.m = e, this.n = n, this.s = w, this.U = p, this.V = P;
3282
3284
  }
3283
3285
  solve(s) {
3284
- let t = s, e = this.threshold, n = this.s.length, i = _$2.zeros(n, n);
3286
+ let t = s, e = this.threshold, n = this.s.length, i = _$3.zeros(n, n);
3285
3287
  for (let g = 0; g < n; g++)
3286
3288
  Math.abs(this.s[g]) <= e ? i.set(g, g, 0) : i.set(g, g, 1 / this.s[g]);
3287
- let o = this.U, l = this.rightSingularVectors, h = l.mmul(i), a = l.rows, u = o.rows, c = _$2.zeros(a, u);
3289
+ let o = this.U, l = this.rightSingularVectors, h = l.mmul(i), a = l.rows, u = o.rows, c = _$3.zeros(a, u);
3288
3290
  for (let g = 0; g < a; g++)
3289
3291
  for (let d = 0; d < u; d++) {
3290
3292
  let w = 0;
@@ -3295,14 +3297,14 @@ let vt$1 = class vt {
3295
3297
  return c.mmul(t);
3296
3298
  }
3297
3299
  solveForDiagonal(s) {
3298
- return this.solve(_$2.diag(s));
3300
+ return this.solve(_$3.diag(s));
3299
3301
  }
3300
3302
  inverse() {
3301
- let s = this.V, t = this.threshold, e = s.rows, n = s.columns, i = new _$2(e, this.s.length);
3303
+ let s = this.V, t = this.threshold, e = s.rows, n = s.columns, i = new _$3(e, this.s.length);
3302
3304
  for (let u = 0; u < e; u++)
3303
3305
  for (let c = 0; c < n; c++)
3304
3306
  Math.abs(this.s[c]) > t && i.set(u, c, s.get(u, c) / this.s[c]);
3305
- let o = this.U, l = o.rows, h = o.columns, a = new _$2(e, l);
3307
+ let o = this.U, l = o.rows, h = o.columns, a = new _$3(e, l);
3306
3308
  for (let u = 0; u < e; u++)
3307
3309
  for (let c = 0; c < l; c++) {
3308
3310
  let g = 0;
@@ -3337,17 +3339,17 @@ let vt$1 = class vt {
3337
3339
  return this.V;
3338
3340
  }
3339
3341
  get diagonalMatrix() {
3340
- return _$2.diag(this.s);
3342
+ return _$3.diag(this.s);
3341
3343
  }
3342
3344
  };
3343
3345
  function Ds(r, s = !1) {
3344
- return r = rt$2.checkMatrix(r), s ? new vt$1(r).inverse() : Ve(r, _$2.eye(r.rows));
3346
+ return r = rt$3.checkMatrix(r), s ? new vt$2(r).inverse() : Ve(r, _$3.eye(r.rows));
3345
3347
  }
3346
3348
  function Ve(r, s, t = !1) {
3347
- return r = rt$2.checkMatrix(r), s = rt$2.checkMatrix(s), t ? new vt$1(r).solve(s) : r.isSquare() ? new ee$1(r).solve(s) : new pe(r).solve(s);
3349
+ return r = rt$3.checkMatrix(r), s = rt$3.checkMatrix(s), t ? new vt$2(r).solve(s) : r.isSquare() ? new ee$1(r).solve(s) : new pe(r).solve(s);
3348
3350
  }
3349
- function Xt$2(r) {
3350
- if (r = _$2.checkMatrix(r), r.isSquare()) {
3351
+ function Xt$1(r) {
3352
+ if (r = _$3.checkMatrix(r), r.isSquare()) {
3351
3353
  if (r.columns === 0)
3352
3354
  return 1;
3353
3355
  let s, t, e, n;
@@ -3355,7 +3357,7 @@ function Xt$2(r) {
3355
3357
  return s = r.get(0, 0), t = r.get(0, 1), e = r.get(1, 0), n = r.get(1, 1), s * n - t * e;
3356
3358
  if (r.columns === 3) {
3357
3359
  let i, o, l;
3358
- return i = new Gt$1(r, [1, 2], [1, 2]), o = new Gt$1(r, [1, 2], [0, 2]), l = new Gt$1(r, [1, 2], [0, 1]), s = r.get(0, 0), t = r.get(0, 1), e = r.get(0, 2), s * Xt$2(i) - t * Xt$2(o) + e * Xt$2(l);
3360
+ return i = new Gt$1(r, [1, 2], [1, 2]), o = new Gt$1(r, [1, 2], [0, 2]), l = new Gt$1(r, [1, 2], [0, 1]), s = r.get(0, 0), t = r.get(0, 1), e = r.get(0, 2), s * Xt$1(i) - t * Xt$1(o) + e * Xt$1(l);
3359
3361
  } else
3360
3362
  return new ee$1(r).determinant;
3361
3363
  } else
@@ -3379,10 +3381,10 @@ function Os(r, s, t, e = 1e-9, n = 1e-9) {
3379
3381
  }
3380
3382
  function Bs(r, s = {}) {
3381
3383
  const { thresholdValue: t = 1e-9, thresholdError: e = 1e-9 } = s;
3382
- r = _$2.checkMatrix(r);
3383
- let n = r.rows, i = new _$2(n, n);
3384
+ r = _$3.checkMatrix(r);
3385
+ let n = r.rows, i = new _$3(n, n);
3384
3386
  for (let o = 0; o < n; o++) {
3385
- let l = _$2.columnVector(r.getRow(o)), h = r.subMatrixRow(zs(n, o)).transpose(), u = new vt$1(h).solve(l), c = _$2.sub(l, h.mmul(u)).abs().max();
3387
+ let l = _$3.columnVector(r.getRow(o)), h = r.subMatrixRow(zs(n, o)).transpose(), u = new vt$2(h).solve(l), c = _$3.sub(l, h.mmul(u)).abs().max();
3386
3388
  i.setRow(
3387
3389
  o,
3388
3390
  Os(c, u, o, t, e)
@@ -3391,17 +3393,17 @@ function Bs(r, s = {}) {
3391
3393
  return i;
3392
3394
  }
3393
3395
  function Us(r, s = Number.EPSILON) {
3394
- if (r = _$2.checkMatrix(r), r.isEmpty())
3396
+ if (r = _$3.checkMatrix(r), r.isEmpty())
3395
3397
  return r.transpose();
3396
- let t = new vt$1(r, { autoTranspose: !0 }), e = t.leftSingularVectors, n = t.rightSingularVectors, i = t.diagonal;
3398
+ let t = new vt$2(r, { autoTranspose: !0 }), e = t.leftSingularVectors, n = t.rightSingularVectors, i = t.diagonal;
3397
3399
  for (let o = 0; o < i.length; o++)
3398
3400
  Math.abs(i[o]) > s ? i[o] = 1 / i[o] : i[o] = 0;
3399
- return n.mmul(_$2.diag(i).mmul(e.transpose()));
3401
+ return n.mmul(_$3.diag(i).mmul(e.transpose()));
3400
3402
  }
3401
3403
  function Ys(r, s = r, t = {}) {
3402
- r = new _$2(r);
3404
+ r = new _$3(r);
3403
3405
  let e = !1;
3404
- if (typeof s == "object" && !_$2.isMatrix(s) && !st$3.isAnyArray(s) ? (t = s, s = r, e = !0) : s = new _$2(s), r.rows !== s.rows)
3406
+ if (typeof s == "object" && !_$3.isMatrix(s) && !st$3.isAnyArray(s) ? (t = s, s = r, e = !0) : s = new _$3(s), r.rows !== s.rows)
3405
3407
  throw new TypeError("Both matrices must have the same number of rows");
3406
3408
  const { center: n = !0 } = t;
3407
3409
  n && (r = r.center("column"), e || (s = s.center("column")));
@@ -3412,9 +3414,9 @@ function Ys(r, s = r, t = {}) {
3412
3414
  return i;
3413
3415
  }
3414
3416
  function Ws(r, s = r, t = {}) {
3415
- r = new _$2(r);
3417
+ r = new _$3(r);
3416
3418
  let e = !1;
3417
- if (typeof s == "object" && !_$2.isMatrix(s) && !st$3.isAnyArray(s) ? (t = s, s = r, e = !0) : s = new _$2(s), r.rows !== s.rows)
3419
+ if (typeof s == "object" && !_$3.isMatrix(s) && !st$3.isAnyArray(s) ? (t = s, s = r, e = !0) : s = new _$3(s), r.rows !== s.rows)
3418
3420
  throw new TypeError("Both matrices must have the same number of rows");
3419
3421
  const { center: n = !0, scale: i = !0 } = t;
3420
3422
  n && (r.center("column"), e || s.center("column")), i && (r.scale("column"), e || s.scale("column"));
@@ -3431,18 +3433,18 @@ function Ws(r, s = r, t = {}) {
3431
3433
  let Ne = class {
3432
3434
  constructor(s, t = {}) {
3433
3435
  const { assumeSymmetric: e = !1 } = t;
3434
- if (s = rt$2.checkMatrix(s), !s.isSquare())
3436
+ if (s = rt$3.checkMatrix(s), !s.isSquare())
3435
3437
  throw new Error("Matrix is not a square matrix");
3436
3438
  if (s.isEmpty())
3437
3439
  throw new Error("Matrix must be non-empty");
3438
- let n = s.columns, i = new _$2(n, n), o = new Float64Array(n), l = new Float64Array(n), h = s, a, u, c = !1;
3440
+ let n = s.columns, i = new _$3(n, n), o = new Float64Array(n), l = new Float64Array(n), h = s, a, u, c = !1;
3439
3441
  if (e ? c = !0 : c = s.isSymmetric(), c) {
3440
3442
  for (a = 0; a < n; a++)
3441
3443
  for (u = 0; u < n; u++)
3442
3444
  i.set(a, u, h.get(a, u));
3443
3445
  Qs(n, l, o, i), Gs(n, l, o, i);
3444
3446
  } else {
3445
- let g = new _$2(n, n), d = new Float64Array(n);
3447
+ let g = new _$3(n, n), d = new Float64Array(n);
3446
3448
  for (u = 0; u < n; u++)
3447
3449
  for (a = 0; a < n; a++)
3448
3450
  g.set(a, u, h.get(a, u));
@@ -3460,7 +3462,7 @@ let Ne = class {
3460
3462
  return this.V;
3461
3463
  }
3462
3464
  get diagonalMatrix() {
3463
- let s = this.n, t = this.e, e = this.d, n = new _$2(s, s), i, o;
3465
+ let s = this.n, t = this.e, e = this.d, n = new _$3(s, s), i, o;
3464
3466
  for (i = 0; i < s; i++) {
3465
3467
  for (o = 0; o < s; o++)
3466
3468
  n.set(i, o, 0);
@@ -3530,10 +3532,10 @@ function Gs(r, s, t, e) {
3530
3532
  u++;
3531
3533
  if (u > a)
3532
3534
  do {
3533
- for (n = t[a], c = (t[a + 1] - n) / (2 * s[a]), g = ut$2(c, 1), c < 0 && (g = -g), t[a] = s[a] / (c + g), t[a + 1] = s[a] * (c + g), d = t[a + 1], i = n - t[a], o = a + 2; o < r; o++)
3535
+ for (n = t[a], c = (t[a + 1] - n) / (2 * s[a]), g = ut$1(c, 1), c < 0 && (g = -g), t[a] = s[a] / (c + g), t[a + 1] = s[a] * (c + g), d = t[a + 1], i = n - t[a], o = a + 2; o < r; o++)
3534
3536
  t[o] -= i;
3535
3537
  for (R = R + i, c = t[u], w = 1, p = w, P = w, f = s[a + 1], M = 0, E = 0, o = u - 1; o >= a; o--)
3536
- for (P = p, p = w, E = M, n = w * s[o], i = w * c, g = ut$2(c, s[o]), s[o + 1] = M * g, M = s[o] / g, w = c / g, c = w * t[o] - M * n, t[o + 1] = i + M * (w * n + M * t[o]), h = 0; h < r; h++)
3538
+ for (P = p, p = w, E = M, n = w * s[o], i = w * c, g = ut$1(c, s[o]), s[o + 1] = M * g, M = s[o] / g, w = c / g, c = w * t[o] - M * n, t[o + 1] = i + M * (w * n + M * t[o]), h = 0; h < r; h++)
3537
3539
  i = e.get(h, o + 1), e.set(h, o + 1, M * e.get(h, o) + w * i), e.set(h, o, w * e.get(h, o) - M * i);
3538
3540
  c = -M * E * P * f * s[a] / d, s[a] = M * c, t[a] = w * c;
3539
3541
  } while (Math.abs(s[a]) > L * v);
@@ -3649,12 +3651,12 @@ function Zs(r, s, t, e, n) {
3649
3651
  n.set(M, i, n.get(M, i) / L);
3650
3652
  }
3651
3653
  else if (g < 0)
3652
- for (R = i - 1, Math.abs(n.get(i, i - 1)) > Math.abs(n.get(i - 1, i)) ? (n.set(i - 1, i - 1, g / n.get(i, i - 1)), n.set(i - 1, i, -(n.get(i, i) - c) / n.get(i, i - 1))) : (F = Wt$1(0, -n.get(i - 1, i), n.get(i - 1, i - 1) - c, g), n.set(i - 1, i - 1, F[0]), n.set(i - 1, i, F[1])), n.set(i, i - 1, 0), n.set(i, i, 1), f = i - 2; f >= 0; f--) {
3654
+ for (R = i - 1, Math.abs(n.get(i, i - 1)) > Math.abs(n.get(i - 1, i)) ? (n.set(i - 1, i - 1, g / n.get(i, i - 1)), n.set(i - 1, i, -(n.get(i, i) - c) / n.get(i, i - 1))) : (F = Wt(0, -n.get(i - 1, i), n.get(i - 1, i - 1) - c, g), n.set(i - 1, i - 1, F[0]), n.set(i - 1, i, F[1])), n.set(i, i - 1, 0), n.set(i, i, 1), f = i - 2; f >= 0; f--) {
3653
3655
  for (m = 0, b = 0, M = R; M <= i; M++)
3654
3656
  m = m + n.get(f, M) * n.get(M, i - 1), b = b + n.get(f, M) * n.get(M, i);
3655
3657
  if (S = n.get(f, f) - c, s[f] < 0)
3656
3658
  p = S, d = m, w = b;
3657
- else if (R = f, s[f] === 0 ? (F = Wt$1(-m, -b, S, g), n.set(f, i - 1, F[0]), n.set(f, i, F[1])) : (k = n.get(f, f + 1), D = n.get(f + 1, f), j = (t[f] - c) * (t[f] - c) + s[f] * s[f] - g * g, y = (t[f] - c) * 2 * g, j === 0 && y === 0 && (j = h * u * (Math.abs(S) + Math.abs(g) + Math.abs(k) + Math.abs(D) + Math.abs(p))), F = Wt$1(
3659
+ else if (R = f, s[f] === 0 ? (F = Wt(-m, -b, S, g), n.set(f, i - 1, F[0]), n.set(f, i, F[1])) : (k = n.get(f, f + 1), D = n.get(f + 1, f), j = (t[f] - c) * (t[f] - c) + s[f] * s[f] - g * g, y = (t[f] - c) * 2 * g, j === 0 && y === 0 && (j = h * u * (Math.abs(S) + Math.abs(g) + Math.abs(k) + Math.abs(D) + Math.abs(p))), F = Wt(
3658
3660
  k * d - p * m + g * b,
3659
3661
  k * w - p * b - g * m,
3660
3662
  j,
@@ -3667,7 +3669,7 @@ function Zs(r, s, t, e, n) {
3667
3669
  f + 1,
3668
3670
  i,
3669
3671
  (-b - S * n.get(f, i) - g * n.get(f, i - 1)) / k
3670
- )) : (F = Wt$1(
3672
+ )) : (F = Wt(
3671
3673
  -d - D * n.get(f, i - 1),
3672
3674
  -w - D * n.get(f, i),
3673
3675
  p,
@@ -3688,15 +3690,15 @@ function Zs(r, s, t, e, n) {
3688
3690
  }
3689
3691
  }
3690
3692
  }
3691
- function Wt$1(r, s, t, e) {
3693
+ function Wt(r, s, t, e) {
3692
3694
  let n, i;
3693
3695
  return Math.abs(t) > Math.abs(e) ? (n = e / t, i = t + n * e, [(r + n * s) / i, (s - n * r) / i]) : (n = t / e, i = e + n * t, [(n * r + s) / i, (n * s - r) / i]);
3694
3696
  }
3695
3697
  class $e {
3696
3698
  constructor(s) {
3697
- if (s = rt$2.checkMatrix(s), !s.isSymmetric())
3699
+ if (s = rt$3.checkMatrix(s), !s.isSymmetric())
3698
3700
  throw new Error("Matrix is not symmetric");
3699
- let t = s, e = t.rows, n = new _$2(e, e), i = !0, o, l, h;
3701
+ let t = s, e = t.rows, n = new _$3(e, e), i = !0, o, l, h;
3700
3702
  for (l = 0; l < e; l++) {
3701
3703
  let a = 0;
3702
3704
  for (h = 0; h < l; h++) {
@@ -3714,7 +3716,7 @@ class $e {
3714
3716
  return this.positiveDefinite;
3715
3717
  }
3716
3718
  solve(s) {
3717
- s = rt$2.checkMatrix(s);
3719
+ s = rt$3.checkMatrix(s);
3718
3720
  let t = this.L, e = t.rows;
3719
3721
  if (s.rows !== e)
3720
3722
  throw new Error("Matrix dimensions do not match");
@@ -3741,7 +3743,7 @@ class $e {
3741
3743
  }
3742
3744
  class Le {
3743
3745
  constructor(s, t = {}) {
3744
- s = rt$2.checkMatrix(s);
3746
+ s = rt$3.checkMatrix(s);
3745
3747
  let { Y: e } = t;
3746
3748
  const {
3747
3749
  scaleScores: n = !1,
@@ -3750,7 +3752,7 @@ class Le {
3750
3752
  } = t;
3751
3753
  let l;
3752
3754
  if (e) {
3753
- if (st$3.isAnyArray(e) && typeof e[0] == "number" ? e = _$2.columnVector(e) : e = rt$2.checkMatrix(e), e.rows !== s.rows)
3755
+ if (st$3.isAnyArray(e) && typeof e[0] == "number" ? e = _$3.columnVector(e) : e = rt$3.checkMatrix(e), e.rows !== s.rows)
3754
3756
  throw new Error("Y should have the same number of rows as X");
3755
3757
  l = e.getColumnVector(0);
3756
3758
  } else
@@ -3769,42 +3771,42 @@ class Le {
3769
3771
  this.w = c.transpose(), this.s = a.transpose().mmul(a).sqrt(), n ? this.t = a.clone().div(this.s.get(0, 0)) : this.t = a, this.xResidual = s.sub(a.mmul(c.transpose()));
3770
3772
  }
3771
3773
  }
3772
- $$1.AbstractMatrix = V$2;
3773
- $$1.CHO = $e;
3774
- $$1.CholeskyDecomposition = $e;
3775
- $$1.DistanceMatrix = te$1;
3776
- $$1.EVD = Ne;
3777
- var Js = $$1.EigenvalueDecomposition = Ne;
3778
- $$1.LU = ee$1;
3779
- $$1.LuDecomposition = ee$1;
3780
- var De = $$1.Matrix = _$2;
3781
- $$1.MatrixColumnSelectionView = qs;
3782
- $$1.MatrixColumnView = Cs;
3783
- $$1.MatrixFlipColumnView = Fs;
3784
- $$1.MatrixFlipRowView = xs;
3785
- $$1.MatrixRowSelectionView = Vs;
3786
- $$1.MatrixRowView = As;
3787
- $$1.MatrixSelectionView = Gt$1;
3788
- $$1.MatrixSubView = Ns;
3789
- $$1.MatrixTransposeView = $s;
3790
- $$1.NIPALS = Le;
3791
- $$1.Nipals = Le;
3792
- $$1.QR = pe;
3793
- $$1.QrDecomposition = pe;
3794
- $$1.SVD = vt$1;
3795
- $$1.SingularValueDecomposition = vt$1;
3796
- $$1.SymmetricMatrix = pt$2;
3797
- $$1.WrapperMatrix1D = Ae;
3798
- $$1.WrapperMatrix2D = rt$2;
3799
- $$1.correlation = Ws;
3800
- $$1.covariance = Ys;
3801
- var Re = $$1.default = _$2;
3802
- $$1.determinant = Xt$2;
3803
- $$1.inverse = Ds;
3804
- $$1.linearDependencies = Bs;
3805
- $$1.pseudoInverse = Us;
3806
- $$1.solve = Ve;
3807
- $$1.wrap = Ls;
3774
+ $.AbstractMatrix = V$1;
3775
+ $.CHO = $e;
3776
+ $.CholeskyDecomposition = $e;
3777
+ $.DistanceMatrix = te$1;
3778
+ $.EVD = Ne;
3779
+ var Js = $.EigenvalueDecomposition = Ne;
3780
+ $.LU = ee$1;
3781
+ $.LuDecomposition = ee$1;
3782
+ var De = $.Matrix = _$3;
3783
+ $.MatrixColumnSelectionView = qs;
3784
+ $.MatrixColumnView = Cs;
3785
+ $.MatrixFlipColumnView = Fs;
3786
+ $.MatrixFlipRowView = xs;
3787
+ $.MatrixRowSelectionView = Vs;
3788
+ $.MatrixRowView = As;
3789
+ $.MatrixSelectionView = Gt$1;
3790
+ $.MatrixSubView = Ns;
3791
+ $.MatrixTransposeView = $s;
3792
+ $.NIPALS = Le;
3793
+ $.Nipals = Le;
3794
+ $.QR = pe;
3795
+ $.QrDecomposition = pe;
3796
+ $.SVD = vt$2;
3797
+ $.SingularValueDecomposition = vt$2;
3798
+ $.SymmetricMatrix = pt$1;
3799
+ $.WrapperMatrix1D = Ae;
3800
+ $.WrapperMatrix2D = rt$3;
3801
+ $.correlation = Ws;
3802
+ $.covariance = Ys;
3803
+ var Re = $.default = _$3;
3804
+ $.determinant = Xt$1;
3805
+ $.inverse = Ds;
3806
+ $.linearDependencies = Bs;
3807
+ $.pseudoInverse = Us;
3808
+ $.solve = Ve;
3809
+ $.wrap = Ls;
3808
3810
  const Ks = Js, Hs = De;
3809
3811
  Re.Matrix && Re.Matrix;
3810
3812
  function qt$1(r, s, t) {
@@ -3842,7 +3844,7 @@ function ze(r, s, t, e) {
3842
3844
  return [f * d - n, f * p - n, f * P - n];
3843
3845
  }
3844
3846
  }
3845
- function wn$1(r, s, t, e, n) {
3847
+ function wn$2(r, s, t, e, n) {
3846
3848
  if (n == 0)
3847
3849
  return ze(r, s, t, e);
3848
3850
  const i = e / n, o = t / n, l = s / n, h = r / n;
@@ -3864,11 +3866,11 @@ function wn$1(r, s, t, e, n) {
3864
3866
  }
3865
3867
  return [];
3866
3868
  }
3867
- function gt$2(r, s) {
3869
+ function gt$1(r, s) {
3868
3870
  return s == 0 ? Math.abs(r) : Math.abs((r - s) / s);
3869
3871
  }
3870
3872
  function ve(r, s, t, e, n) {
3871
- const i = tn$2(r, s, t, e, n);
3873
+ const i = tn$1(r, s, t, e, n);
3872
3874
  if (i !== null && i.length == 4) {
3873
3875
  let o = [];
3874
3876
  for (let l = 0; l < 2; l++) {
@@ -3879,13 +3881,13 @@ function ve(r, s, t, e, n) {
3879
3881
  }
3880
3882
  return null;
3881
3883
  }
3882
- function tn$2(r, s, t, e, n) {
3884
+ function tn$1(r, s, t, e, n) {
3883
3885
  function i(x, N, A, O) {
3884
- const U = gt$2(x + A, r), T = gt$2(N + x * A + O, s), z = gt$2(N * A + x * O, t);
3886
+ const U = gt$1(x + A, r), T = gt$1(N + x * A + O, s), z = gt$1(N * A + x * O, t);
3885
3887
  return U + T + z;
3886
3888
  }
3887
3889
  function o(x, N, A, O) {
3888
- return i(x, N, A, O) + gt$2(N * O, e);
3890
+ return i(x, N, A, O) + gt$1(N * O, e);
3889
3891
  }
3890
3892
  const l = 9 * r * r - 24 * s, h = l >= 0 ? -2 * s / (3 * r + kt$1(Math.sqrt(l), r)) : -0.25 * r, a = r + 4 * h, u = s + 3 * h * (r + 2 * h), c = t + h * (2 * s + h * (3 * r + 4 * h)), g = e + h * (t + h * (s + h * (r + h)));
3891
3893
  let d = 0, w = 0;
@@ -3897,12 +3899,12 @@ function tn$2(r, s, t, e, n) {
3897
3899
  d = a * c - 4 * g - 1 / 3 * u * u, w = (a * c + 8 * g - 2 / 9 * u * u) * (1 / 3) * u - c * c - a * a * g;
3898
3900
  if (!isFinite(d) && isFinite(w))
3899
3901
  return null;
3900
- let P = en$1(d, w);
3902
+ let P = en(d, w);
3901
3903
  n && (P *= p);
3902
3904
  const f = r * 0.5, M = 1 / 6 * s + 0.5 * P, E = t - r * M, R = 2 / 3 * s - P - f * f, v = 0.5 * E / R, L = 2 * (e - M * M) / E, S = 0.5 * E / L;
3903
3905
  let k = 0, D = 0, m = 0;
3904
3906
  for (let x = 0; x < 3; x++) {
3905
- const N = x == 1 ? S : R, A = x == 0 ? v : L, O = gt$2(N + f * f + 2 * M, s), U = gt$2(2 * (N * A + f * M), t), T = gt$2(N * A * A + M * M, e), z = O + U + T;
3907
+ const N = x == 1 ? S : R, A = x == 0 ? v : L, O = gt$1(N + f * f + 2 * M, s), U = gt$1(2 * (N * A + f * M), t), T = gt$1(N * A * A + M * M, e), z = O + U + T;
3906
3908
  (x == 0 || z < m) && (k = N, D = A, m = z);
3907
3909
  }
3908
3910
  const b = k, j = D;
@@ -3945,7 +3947,7 @@ function tn$2(r, s, t, e, n) {
3945
3947
  }
3946
3948
  return [y, C, F, I];
3947
3949
  }
3948
- function en$1(r, s) {
3950
+ function en(r, s) {
3949
3951
  const t = -0.3333333333333333 * r, e = 0.5 * s;
3950
3952
  let n, i = null;
3951
3953
  if ((Math.abs(t) >= 1e102 || Math.abs(e) >= 1e164) && (Math.abs(t) < Math.abs(e) ? i = 1 - t * (t / e) * (t / e) : i = Math.sign(t) * (e / t * (e / t) / t - 1)), i !== null && e == 0)
@@ -3993,7 +3995,7 @@ function sn$1(r, s = 1e-9) {
3993
3995
  (n, i) => Math.abs(e.imaginaryEigenvalues[i]) < s
3994
3996
  );
3995
3997
  }
3996
- const nn$2 = (r, s, t) => [r[0] * (1 - t) + s[0] * t, r[1] * (1 - t) + s[1] * t];
3998
+ const nn$1 = (r, s, t) => [r[0] * (1 - t) + s[0] * t, r[1] * (1 - t) + s[1] * t];
3997
3999
  function rn$1(r) {
3998
4000
  const s = [];
3999
4001
  for (let t = 0; t < r.length - 1; t++)
@@ -4001,7 +4003,7 @@ function rn$1(r) {
4001
4003
  return s;
4002
4004
  }
4003
4005
  function de(r, s) {
4004
- const t = rn$1(r).map(([e, n]) => nn$2(e, n, s));
4006
+ const t = rn$1(r).map(([e, n]) => nn$1(e, n, s));
4005
4007
  return r.length === 2 ? [t] : [...de(t, s), t];
4006
4008
  }
4007
4009
  let Et$1 = class Et extends xt$1 {
@@ -4034,7 +4036,7 @@ let Et$1 = class Et extends xt$1 {
4034
4036
  );
4035
4037
  }
4036
4038
  get alignedCurve() {
4037
- const t = [-this.firstPoint[0], -this.firstPoint[1]], e = Q$1(this.lastPoint, this.firstPoint), n = Math.atan2(e[1], e[0]), i = new et$3();
4039
+ const t = [-this.firstPoint[0], -this.firstPoint[1]], e = Q$2(this.lastPoint, this.firstPoint), n = Math.atan2(e[1], e[0]), i = new et$3();
4038
4040
  return i.translate(t[0], t[1]), i.rotate(-n), this.transform(i);
4039
4041
  }
4040
4042
  getInflexionParameters() {
@@ -4065,13 +4067,13 @@ let Et$1 = class Et extends xt$1 {
4065
4067
  );
4066
4068
  }
4067
4069
  isSame(t) {
4068
- return t.segmentType !== "CUBIC_BEZIER" ? !1 : Y$2(this.firstPoint, t.firstPoint) && Y$2(this.lastPoint, t.lastPoint) && Y$2(this.firstControlPoint, t.firstControlPoint) && Y$2(this.lastControlPoint, t.lastControlPoint);
4070
+ return t.segmentType !== "CUBIC_BEZIER" ? !1 : Y$1(this.firstPoint, t.firstPoint) && Y$1(this.lastPoint, t.lastPoint) && Y$1(this.firstControlPoint, t.firstControlPoint) && Y$1(this.lastControlPoint, t.lastControlPoint);
4069
4071
  }
4070
4072
  distanceFrom(t) {
4071
4073
  const n = Ce((i) => Rt$1(this.paramPoint(i), t), this.precision);
4072
4074
  return n.argMin < -this.precision || n.argMin > 1 + this.precision ? Math.min(
4073
- J$1(this.firstPoint, t),
4074
- J$1(this.lastPoint, t)
4075
+ J$2(this.firstPoint, t),
4076
+ J$2(this.lastPoint, t)
4075
4077
  ) : Math.sqrt(n.fMin);
4076
4078
  }
4077
4079
  isOnSegment(t) {
@@ -4085,14 +4087,14 @@ let Et$1 = class Et extends xt$1 {
4085
4087
  }
4086
4088
  }
4087
4089
  gradientAt(t) {
4088
- const e = 1 - t, n = e * e, i = t * t, o = 3 * n, l = 6 * e * t, h = 3 * i, a = Q$1(this.firstControlPoint, this.firstPoint), u = Q$1(this.lastControlPoint, this.firstControlPoint), c = Q$1(this.lastPoint, this.lastControlPoint);
4090
+ const e = 1 - t, n = e * e, i = t * t, o = 3 * n, l = 6 * e * t, h = 3 * i, a = Q$2(this.firstControlPoint, this.firstPoint), u = Q$2(this.lastControlPoint, this.firstControlPoint), c = Q$2(this.lastPoint, this.lastControlPoint);
4089
4091
  return [
4090
4092
  o * a[0] + l * u[0] + h * c[0],
4091
4093
  o * a[1] + l * u[1] + h * c[1]
4092
4094
  ];
4093
4095
  }
4094
4096
  secondDerivativeAt(t) {
4095
- const e = it$3(this.firstPoint, this.lastControlPoint), n = nt$2(this.firstControlPoint, 2), i = it$3(this.firstControlPoint, this.lastPoint), o = nt$2(this.lastControlPoint, 2), l = nt$2(Q$1(e, n), 6 * (1 - t)), h = nt$2(Q$1(i, o), 6 * t);
4097
+ const e = it$3(this.firstPoint, this.lastControlPoint), n = nt$2(this.firstControlPoint, 2), i = it$3(this.firstControlPoint, this.lastPoint), o = nt$2(this.lastControlPoint, 2), l = nt$2(Q$2(e, n), 6 * (1 - t)), h = nt$2(Q$2(i, o), 6 * t);
4096
4098
  return it$3(l, h);
4097
4099
  }
4098
4100
  tangentAt(t) {
@@ -4100,10 +4102,10 @@ let Et$1 = class Et extends xt$1 {
4100
4102
  return H$1(this.gradientAt(e));
4101
4103
  }
4102
4104
  get tangentAtFirstPoint() {
4103
- return H$1(Q$1(this.firstControlPoint, this.firstPoint));
4105
+ return H$1(Q$2(this.firstControlPoint, this.firstPoint));
4104
4106
  }
4105
4107
  get tangentAtLastPoint() {
4106
- return H$1(Q$1(this.lastPoint, this.lastControlPoint));
4108
+ return H$1(Q$2(this.lastPoint, this.lastControlPoint));
4107
4109
  }
4108
4110
  normalAt(t) {
4109
4111
  const e = this.tangentAt(t);
@@ -4167,7 +4169,7 @@ let Et$1 = class Et extends xt$1 {
4167
4169
  return [this];
4168
4170
  Array.isArray(t[0]) ? e = t : e = [t];
4169
4171
  const n = e.map((o) => this.pointToParam(o)), i = new Map(
4170
- Kt$1([n, e])
4172
+ Kt([n, e])
4171
4173
  );
4172
4174
  return this.splitAtParameters(n, i);
4173
4175
  }
@@ -4201,8 +4203,8 @@ let Et$1 = class Et extends xt$1 {
4201
4203
  return ze(e - t, n, i, o).filter((l) => l >= -this.precision && l <= 1 + this.precision);
4202
4204
  }
4203
4205
  pointToParam(t) {
4204
- if (Y$2(t, this.firstPoint, this.precision)) return 0;
4205
- if (Y$2(t, this.lastPoint, this.precision)) return 1;
4206
+ if (Y$1(t, this.firstPoint, this.precision)) return 0;
4207
+ if (Y$1(t, this.lastPoint, this.precision)) return 1;
4206
4208
  const e = this.paramsAtY(t[1]);
4207
4209
  if (e.length === 0)
4208
4210
  throw new Error("Point is not on the curve");
@@ -4212,7 +4214,7 @@ let Et$1 = class Et extends xt$1 {
4212
4214
  return i;
4213
4215
  }
4214
4216
  };
4215
- let jt$2 = class jt extends xt$1 {
4217
+ let jt$1 = class jt extends xt$1 {
4216
4218
  constructor(t, e, n, i, o, l, h = !1, {
4217
4219
  ignoreChecks: a = !1,
4218
4220
  angleUnits: u = "deg"
@@ -4245,7 +4247,7 @@ let jt$2 = class jt extends xt$1 {
4245
4247
  if (this.tiltAngle = wt$2(
4246
4248
  c ? g : g + Math.PI / 2
4247
4249
  ), this.clockwise = h, !a) {
4248
- if (Y$2(t, e))
4250
+ if (Y$1(t, e))
4249
4251
  throw new Error("Invalid arc, cannot be a full circle");
4250
4252
  if (!this.isPointOnEllipse(t))
4251
4253
  throw new Error(
@@ -4368,7 +4370,7 @@ let jt$2 = class jt extends xt$1 {
4368
4370
  return 1 - t >= -this.precision && t >= -this.precision;
4369
4371
  }
4370
4372
  isSame(t) {
4371
- return Y$2(this.center, t.center) && Math.abs(this.majorRadius - t.majorRadius) < this.precision && Math.abs(this.minorRadius - t.minorRadius) < this.precision && (Math.abs(this.tiltAngle - t.tiltAngle) < this.precision || Math.abs(Math.abs(this.tiltAngle - t.tiltAngle) - Math.PI) < this.precision) && (Y$2(this.firstPoint, t.firstPoint) && this.clockwise === t.clockwise || Y$2(this.firstPoint, t.lastPoint) && this.clockwise !== t.clockwise);
4373
+ return Y$1(this.center, t.center) && Math.abs(this.majorRadius - t.majorRadius) < this.precision && Math.abs(this.minorRadius - t.minorRadius) < this.precision && (Math.abs(this.tiltAngle - t.tiltAngle) < this.precision || Math.abs(Math.abs(this.tiltAngle - t.tiltAngle) - Math.PI) < this.precision) && (Y$1(this.firstPoint, t.firstPoint) && this.clockwise === t.clockwise || Y$1(this.firstPoint, t.lastPoint) && this.clockwise !== t.clockwise);
4372
4374
  }
4373
4375
  pointTheta(t) {
4374
4376
  const e = this.ellipseReferenceFrameTransform.transform(t), n = Math.atan2(
@@ -4381,7 +4383,7 @@ let jt$2 = class jt extends xt$1 {
4381
4383
  return Zt(this.firstAngle, wt$2(t), this.clockwise) / this.deltaAngle;
4382
4384
  }
4383
4385
  isPointOnEllipse(t) {
4384
- const [e, n] = this.focals, i = J$1(t, e), o = J$1(t, n);
4386
+ const [e, n] = this.focals, i = J$2(t, e), o = J$2(t, n);
4385
4387
  return Math.abs(2 * this.majorRadius - i - o) < this.precision;
4386
4388
  }
4387
4389
  isOnSegment(t) {
@@ -4389,7 +4391,7 @@ let jt$2 = class jt extends xt$1 {
4389
4391
  }
4390
4392
  distanceFrom(t) {
4391
4393
  let e;
4392
- if (Y$2(t, this.center) ? e = it$3(
4394
+ if (Y$1(t, this.center) ? e = it$3(
4393
4395
  this.center,
4394
4396
  nt$2(tt$2(this.majorAxis), this.minorRadius)
4395
4397
  ) : e = this.reverseEllipseReferenceFrameTransform.transform(
@@ -4399,17 +4401,17 @@ let jt$2 = class jt extends xt$1 {
4399
4401
  this.ellipseReferenceFrameTransform.transform(t)
4400
4402
  )
4401
4403
  ), this.isValidParameter(this.thetaToParam(this.pointTheta(t))))
4402
- return J$1(t, e);
4404
+ return J$2(t, e);
4403
4405
  if (Qe(t, this.majorAxis, this.center)) {
4404
4406
  const n = wt$2(
4405
4407
  2 * Math.PI - this.pointTheta(t)
4406
4408
  ), i = this.thetaToParam(n);
4407
4409
  if (this.isValidParameter(i))
4408
- return J$1(t, this.paramPoint(i));
4410
+ return J$2(t, this.paramPoint(i));
4409
4411
  }
4410
4412
  return Math.min(
4411
- J$1(t, this.firstPoint),
4412
- J$1(t, this.lastPoint)
4413
+ J$2(t, this.firstPoint),
4414
+ J$2(t, this.lastPoint)
4413
4415
  );
4414
4416
  }
4415
4417
  get ellipseReferenceFrameTransform() {
@@ -4475,7 +4477,7 @@ let jt$2 = class jt extends xt$1 {
4475
4477
  return [this];
4476
4478
  Array.isArray(t[0]) ? e = t : e = [t];
4477
4479
  const i = [0, 1, ...e.map((h) => this.pointToParam(h))], o = new Map(
4478
- Kt$1([i, [this.firstPoint, this.lastPoint, ...e]])
4480
+ Kt([i, [this.firstPoint, this.lastPoint, ...e]])
4479
4481
  );
4480
4482
  i.sort((h, a) => h - a);
4481
4483
  let l = null;
@@ -4498,7 +4500,7 @@ let jt$2 = class jt extends xt$1 {
4498
4500
  });
4499
4501
  }
4500
4502
  };
4501
- function pn$1(r, s, t, e, n, i, o) {
4503
+ function pn$2(r, s, t, e, n, i, o) {
4502
4504
  const { center: l, rx: h, ry: a } = on$1(
4503
4505
  r,
4504
4506
  s,
@@ -4508,7 +4510,7 @@ function pn$1(r, s, t, e, n, i, o) {
4508
4510
  !i,
4509
4511
  o
4510
4512
  );
4511
- return Math.abs(h - a) < 1e-9 ? new ct$1(r, s, l, o) : new jt$2(r, s, l, h, a, n, o);
4513
+ return Math.abs(h - a) < 1e-9 ? new ct$2(r, s, l, o) : new jt$1(r, s, l, h, a, n, o);
4512
4514
  }
4513
4515
  function on$1([r, s], [t, e], n, i, o, l, h) {
4514
4516
  if (n < 0 && (n = -n), i < 0 && (i = -i), n == 0 || i == 0)
@@ -4590,13 +4592,13 @@ let _t$1 = class _t extends xt$1 {
4590
4592
  );
4591
4593
  }
4592
4594
  isSame(t) {
4593
- return t.segmentType !== "QUADRATIC_BEZIER" ? !1 : Y$2(this.firstPoint, t.firstPoint) && Y$2(this.lastPoint, t.lastPoint) && Y$2(this.controlPoint, t.controlPoint);
4595
+ return t.segmentType !== "QUADRATIC_BEZIER" ? !1 : Y$1(this.firstPoint, t.firstPoint) && Y$1(this.lastPoint, t.lastPoint) && Y$1(this.controlPoint, t.controlPoint);
4594
4596
  }
4595
4597
  distanceFrom(t) {
4596
4598
  const n = Ce((i) => Rt$1(this.paramPoint(i), t), this.precision);
4597
4599
  return n.argMin < -this.precision || n.argMin > 1 + this.precision ? Math.min(
4598
- J$1(this.firstPoint, t),
4599
- J$1(this.lastPoint, t)
4600
+ J$2(this.firstPoint, t),
4601
+ J$2(this.lastPoint, t)
4600
4602
  ) : Math.sqrt(n.fMin);
4601
4603
  }
4602
4604
  isOnSegment(t) {
@@ -4618,7 +4620,7 @@ let _t$1 = class _t extends xt$1 {
4618
4620
  }
4619
4621
  secondDerivativeAt(t) {
4620
4622
  return nt$2(
4621
- Q$1(
4623
+ Q$2(
4622
4624
  it$3(this.firstPoint, this.lastPoint),
4623
4625
  nt$2(this.controlPoint, 2)
4624
4626
  ),
@@ -4630,10 +4632,10 @@ let _t$1 = class _t extends xt$1 {
4630
4632
  return H$1(this.gradientAt(e));
4631
4633
  }
4632
4634
  get tangentAtFirstPoint() {
4633
- return H$1(Q$1(this.controlPoint, this.firstPoint));
4635
+ return H$1(Q$2(this.controlPoint, this.firstPoint));
4634
4636
  }
4635
4637
  get tangentAtLastPoint() {
4636
- return H$1(Q$1(this.lastPoint, this.controlPoint));
4638
+ return H$1(Q$2(this.lastPoint, this.controlPoint));
4637
4639
  }
4638
4640
  normalAt(t) {
4639
4641
  const e = this.tangentAt(t);
@@ -4688,7 +4690,7 @@ let _t$1 = class _t extends xt$1 {
4688
4690
  return [this];
4689
4691
  Array.isArray(t[0]) ? e = t : e = [t];
4690
4692
  const n = e.map((o) => this.pointToParam(o)), i = new Map(
4691
- Kt$1([n, e])
4693
+ Kt([n, e])
4692
4694
  );
4693
4695
  return this.splitAtParameters(n, i);
4694
4696
  }
@@ -4733,15 +4735,15 @@ let _t$1 = class _t extends xt$1 {
4733
4735
  }
4734
4736
  };
4735
4737
 
4736
- var tn$1 = Object.defineProperty;
4737
- var nn$1 = (t, n, e) => n in t ? tn$1(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
4738
- var C = (t, n, e) => nn$1(t, typeof n != "symbol" ? n + "" : n, e);
4739
- function pn(t, n) {
4740
- const e = Q$1(n, t.firstPoint), s = Pe(e, t.V) / t.squareLength;
4738
+ var tn = Object.defineProperty;
4739
+ var nn = (t, n, e) => n in t ? tn(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
4740
+ var C = (t, n, e) => nn(t, typeof n != "symbol" ? n + "" : n, e);
4741
+ function pn$1(t, n) {
4742
+ const e = Q$2(n, t.firstPoint), s = Pe(e, t.V) / t.squareLength;
4741
4743
  return t.paramPoint(s);
4742
4744
  }
4743
- function J(t, n, e) {
4744
- const s = e || t.precision, i = pn(t, n.center), o = J$1(i, n.center);
4745
+ function J$1(t, n, e) {
4746
+ const s = e || t.precision, i = pn$1(t, n.center), o = J$2(i, n.center);
4745
4747
  if (o > n.radius + s) return [];
4746
4748
  if (Math.abs(o - n.radius) < s) {
4747
4749
  const u = i;
@@ -4754,12 +4756,12 @@ function J(t, n, e) {
4754
4756
  const f = it$3(i, nt$2(c, -l));
4755
4757
  return t.isOnSegment(f) && n.isOnSegment(f) && r.push(f), r;
4756
4758
  }
4757
- const dn = (t) => {
4759
+ const dn$1 = (t) => {
4758
4760
  const { firstPoint: n, lastPoint: e, center: s, clockwise: i } = t;
4759
- return new ct$1(e, n, s, i, {
4761
+ return new ct$2(e, n, s, i, {
4760
4762
  ignoreChecks: !0
4761
4763
  });
4762
- }, mn = (t, n) => {
4764
+ }, mn$1 = (t, n) => {
4763
4765
  if (t.isSame(n))
4764
4766
  return [t];
4765
4767
  const e = Te(
@@ -4775,11 +4777,11 @@ const dn = (t) => {
4775
4777
  if (e.length === 0) return [];
4776
4778
  if (e.length === 1) return [];
4777
4779
  if (e.length === 2)
4778
- return t.isSame(dn(n)) ? [] : [new ct$1(e[0], e[1], t.center, t.clockwise)];
4780
+ return t.isSame(dn$1(n)) ? [] : [new ct$2(e[0], e[1], t.center, t.clockwise)];
4779
4781
  if (e.length === 3) {
4780
- const s = Y$2(e[0], n.lastPoint) || Y$2(e[0], n.firstPoint) ? 1 : 0;
4782
+ const s = Y$1(e[0], n.lastPoint) || Y$1(e[0], n.firstPoint) ? 1 : 0;
4781
4783
  return [
4782
- new ct$1(
4784
+ new ct$2(
4783
4785
  e[0 + s],
4784
4786
  e[1 + s],
4785
4787
  t.center,
@@ -4788,21 +4790,21 @@ const dn = (t) => {
4788
4790
  ];
4789
4791
  } else if (e.length === 4)
4790
4792
  return [
4791
- new ct$1(e[0], e[1], t.center, t.clockwise),
4792
- new ct$1(e[2], e[3], t.center, t.clockwise)
4793
+ new ct$2(e[0], e[1], t.center, t.clockwise),
4794
+ new ct$2(e[2], e[3], t.center, t.clockwise)
4793
4795
  ];
4794
4796
  throw new Error("Bug in the arc arc overlap algorithm");
4795
4797
  };
4796
4798
  function qt(t, n, e = !1, s) {
4797
- const i = s || t.precision, o = J$1(t.center, n.center), r = t.radius + n.radius;
4799
+ const i = s || t.precision, o = J$2(t.center, n.center), r = t.radius + n.radius;
4798
4800
  if (o > r + i)
4799
4801
  return [];
4800
4802
  const l = Math.abs(t.radius - n.radius);
4801
4803
  if (o < l - i)
4802
4804
  return [];
4803
4805
  if (o < i)
4804
- return l > i ? [] : e ? mn(t, n) : [];
4805
- const c = H$1(Q$1(n.center, t.center)), a = o > r - i;
4806
+ return l > i ? [] : e ? mn$1(t, n) : [];
4807
+ const c = H$1(Q$2(n.center, t.center)), a = o > r - i;
4806
4808
  if (
4807
4809
  // circles are outside each other
4808
4810
  a || // circles are inside each other
@@ -4889,7 +4891,7 @@ const gn$1 = (t) => {
4889
4891
  tiltAngle: r,
4890
4892
  clockwise: l
4891
4893
  } = t;
4892
- return new jt$2(
4894
+ return new jt$1(
4893
4895
  e,
4894
4896
  n,
4895
4897
  s,
@@ -4902,10 +4904,10 @@ const gn$1 = (t) => {
4902
4904
  angleUnits: "rad"
4903
4905
  }
4904
4906
  );
4905
- }, Pn = (t, n) => {
4907
+ }, Pn$1 = (t, n) => {
4906
4908
  if (t.isSame(n))
4907
4909
  return [t];
4908
- const e = (i, o) => new jt$2(
4910
+ const e = (i, o) => new jt$1(
4909
4911
  i,
4910
4912
  o,
4911
4913
  t.center,
@@ -4929,27 +4931,27 @@ const gn$1 = (t) => {
4929
4931
  if (s.length === 2)
4930
4932
  return t.isSame(gn$1(n)) ? [] : [e(s[0], s[1])];
4931
4933
  if (s.length === 3) {
4932
- const i = Y$2(s[0], n.lastPoint) || Y$2(s[0], n.firstPoint) ? 1 : 0;
4934
+ const i = Y$1(s[0], n.lastPoint) || Y$1(s[0], n.firstPoint) ? 1 : 0;
4933
4935
  return [e(s[0 + i], s[1 + i])];
4934
4936
  } else if (s.length === 4)
4935
4937
  return [e(s[0], s[1]), e(s[2], s[3])];
4936
4938
  throw new Error("Bug in the ellipse arc ellipse arc overlap algorithm");
4937
4939
  };
4938
- function wn(t, n, e = !1) {
4940
+ function wn$1(t, n, e = !1) {
4939
4941
  const s = Math.max(t.precision, n.precision);
4940
- return Y$2(t.center, n.center) && Math.abs(t.majorRadius - n.majorRadius) < s && Math.abs(t.minorRadius - n.minorRadius) < s && (Math.abs(t.tiltAngle - n.tiltAngle) < s || Math.abs(Math.abs(t.tiltAngle - n.tiltAngle) - Math.PI) < s) ? e ? Pn(t, n) : [] : Dt(t, n).filter((r) => t.isOnSegment(r) && n.isOnSegment(r));
4942
+ return Y$1(t.center, n.center) && Math.abs(t.majorRadius - n.majorRadius) < s && Math.abs(t.minorRadius - n.minorRadius) < s && (Math.abs(t.tiltAngle - n.tiltAngle) < s || Math.abs(Math.abs(t.tiltAngle - n.tiltAngle) - Math.PI) < s) ? e ? Pn$1(t, n) : [] : Dt(t, n).filter((r) => t.isOnSegment(r) && n.isOnSegment(r));
4941
4943
  }
4942
- function gt$1(t, n) {
4944
+ function gt(t, n) {
4943
4945
  const [e, s] = t.firstPoint, [i, o] = t.lastPoint, r = new et$3().translate(-e, -s).rotate(-Math.atan2(o - s, i - e)), l = r.clone().inverse(), c = n.transform(r);
4944
4946
  return c.paramsAtY(0).map((a) => c.paramPoint(a)).map((a) => l.transform(a)).filter((a) => t.isOnSegment(a));
4945
4947
  }
4946
- const xn = (t, n = 1e-9) => {
4948
+ const xn$1 = (t, n = 1e-9) => {
4947
4949
  let e = t;
4948
4950
  return Math.abs(t) < n && (e = 0), e.toFixed(-Math.log10(n));
4949
4951
  };
4950
4952
  function Rt(t, n = 1e-9) {
4951
4953
  return Array.from(
4952
- new Map(t.map((e) => [xn(e, n), e])).values()
4954
+ new Map(t.map((e) => [xn$1(e, n), e])).values()
4953
4955
  );
4954
4956
  }
4955
4957
  const Sn$1 = (t, n) => {
@@ -4960,30 +4962,30 @@ function Pt$1(t, n) {
4960
4962
  const e = Math.max(t.precision, n.precision), s = Sn$1(t, n), i = sn$1(s, e).filter((o) => o >= -n.precision && o <= 1 + n.precision);
4961
4963
  return Rt(i, e).map((o) => n.paramPoint(o)).filter((o) => t.isOnSegment(o));
4962
4964
  }
4963
- const yn = (t, n) => {
4965
+ const yn$1 = (t, n) => {
4964
4966
  const [[e, s, i], [o, r, l]] = n.polynomialCoefficients, c = t.coefficients, a = c.x2, f = c.xy, u = c.y2, h = c.x, p = c.y, d = c.c, m = e * e, P = s * s, w = i * i, x = o * o, F = r * r, b = l * l, R = a * m + f * e * o + u * x + h * e + p * o + d, T = 2 * a * e * s + f * e * r + f * s * o + 2 * u * o * r + h * s + p * r, L = 2 * a * e * i + a * P + f * e * l + f * s * r + f * i * o + 2 * u * o * l + u * F + h * i + p * l, j = 2 * a * s * i + f * s * l + f * i * r + 2 * u * r * l, z = a * w + f * i * l + u * b;
4965
4967
  return [R, T, L, j, z];
4966
4968
  };
4967
4969
  function wt$1(t, n) {
4968
- const e = Math.max(t.precision, n.precision), s = yn(t, n), i = wn$1(...s).filter((o) => o >= -n.precision && o <= 1 + n.precision);
4970
+ const e = Math.max(t.precision, n.precision), s = yn$1(t, n), i = wn$2(...s).filter((o) => o >= -n.precision && o <= 1 + n.precision);
4969
4971
  return Rt(i, e).map((o) => n.paramPoint(o)).filter((o) => t.isOnSegment(o));
4970
4972
  }
4971
4973
  function E(t, { firstPoint: n, lastPoint: e }, s = 1e-9) {
4972
- const i = Q$1(e, n);
4973
- return Math.abs(i[0]) < s ? i[1] > 0 ? n[0] - t[0] : t[0] - n[0] : Math.abs(i[1]) < s ? i[0] > 0 ? t[1] - n[1] : n[1] - t[1] : St$1(i, Q$1(t, n)) / an$1(i);
4974
+ const i = Q$2(e, n);
4975
+ return Math.abs(i[0]) < s ? i[1] > 0 ? n[0] - t[0] : t[0] - n[0] : Math.abs(i[1]) < s ? i[0] > 0 ? t[1] - n[1] : n[1] - t[1] : St$2(i, Q$2(t, n)) / an$1(i);
4974
4976
  }
4975
- class ct {
4977
+ let ct$1 = class ct {
4976
4978
  constructor(n, e, s, i) {
4977
4979
  this.firstPoint = n, this.lastPoint = e, this.negativeThickness = s, this.positiveThickness = i;
4978
4980
  }
4979
4981
  get width() {
4980
4982
  return this.positiveThickness - this.negativeThickness;
4981
4983
  }
4982
- }
4983
- const bn$1 = 3 / 4, Cn = 4 / 9;
4984
+ };
4985
+ const bn$1 = 3 / 4, Cn$1 = 4 / 9;
4984
4986
  function Mn$1(t) {
4985
- const n = E(t.firstControlPoint, t), e = E(t.lastControlPoint, t), s = n * e > 0 ? bn$1 : Cn;
4986
- return new ct(
4987
+ const n = E(t.firstControlPoint, t), e = E(t.lastControlPoint, t), s = n * e > 0 ? bn$1 : Cn$1;
4988
+ return new ct$1(
4987
4989
  t.firstPoint,
4988
4990
  t.lastPoint,
4989
4991
  s * Math.min(0, n, e),
@@ -4992,7 +4994,7 @@ function Mn$1(t) {
4992
4994
  }
4993
4995
  function An$1(t) {
4994
4996
  const n = E(t.controlPoint, t);
4995
- return new ct(
4997
+ return new ct$1(
4996
4998
  t.firstPoint,
4997
4999
  t.lastPoint,
4998
5000
  Math.min(0, n / 2),
@@ -5006,8 +5008,8 @@ function In$1(t) {
5006
5008
  return An$1(t);
5007
5009
  throw new Error("Not implemented");
5008
5010
  }
5009
- function En$1(t) {
5010
- const n = t.paramPoint(0.5), e = tt$2(Q$1(n, t.firstPoint)), s = it$3(n, e), i = {
5011
+ function En(t) {
5012
+ const n = t.paramPoint(0.5), e = tt$2(Q$2(n, t.firstPoint)), s = it$3(n, e), i = {
5011
5013
  firstPoint: n,
5012
5014
  lastPoint: s
5013
5015
  }, o = [
@@ -5017,7 +5019,7 @@ function En$1(t) {
5017
5019
  return t instanceof Et$1 ? o.push(
5018
5020
  E(t.firstControlPoint, i),
5019
5021
  E(t.lastControlPoint, i)
5020
- ) : t instanceof _t$1 && o.push(E(t.controlPoint, i)), new ct(
5022
+ ) : t instanceof _t$1 && o.push(E(t.controlPoint, i)), new ct$1(
5021
5023
  n,
5022
5024
  s,
5023
5025
  Math.min(...o),
@@ -5042,7 +5044,7 @@ function xt(t, n) {
5042
5044
  }
5043
5045
  return e;
5044
5046
  }
5045
- let Y$1 = class Y {
5047
+ class Y {
5046
5048
  constructor(n, e) {
5047
5049
  this.from = n, this.to = e;
5048
5050
  }
@@ -5052,24 +5054,24 @@ let Y$1 = class Y {
5052
5054
  clipCurve(n) {
5053
5055
  return this.from === "start" ? this.to === "end" ? n : n.splitAtParameters([this.to])[0] : this.to === "end" ? n.splitAtParameters([this.from])[1] : n.splitAtParameters([this.from, this.to])[1];
5054
5056
  }
5055
- };
5057
+ }
5056
5058
  function Fn(t, n) {
5057
5059
  if (t instanceof Et$1)
5058
- return new Bn([
5060
+ return new Bn$1([
5059
5061
  E(t.firstPoint, n),
5060
5062
  E(t.firstControlPoint, n),
5061
5063
  E(t.lastControlPoint, n),
5062
5064
  E(t.lastPoint, n)
5063
5065
  ]);
5064
5066
  if (t instanceof _t$1)
5065
- return new vn$1([
5067
+ return new vn([
5066
5068
  E(t.firstPoint, n),
5067
5069
  E(t.controlPoint, n),
5068
5070
  E(t.lastPoint, n)
5069
5071
  ]);
5070
5072
  throw new Error("Not implemented");
5071
5073
  }
5072
- let vn$1 = class vn {
5074
+ class vn {
5073
5075
  constructor(n) {
5074
5076
  C(this, "topHull", []);
5075
5077
  C(this, "bottomHull", []);
@@ -5083,8 +5085,8 @@ let vn$1 = class vn {
5083
5085
  get endDistance() {
5084
5086
  return this.distances[2];
5085
5087
  }
5086
- };
5087
- class Bn {
5088
+ }
5089
+ let Bn$1 = class Bn {
5088
5090
  constructor(n) {
5089
5091
  C(this, "topHull", []);
5090
5092
  C(this, "bottomHull", []);
@@ -5105,8 +5107,8 @@ class Bn {
5105
5107
  get endDistance() {
5106
5108
  return this.distances[3];
5107
5109
  }
5108
- }
5109
- function St(t, n) {
5110
+ };
5111
+ function St$1(t, n) {
5110
5112
  const e = Fn(n, t), s = xt(
5111
5113
  e.topHull,
5112
5114
  t.negativeThickness
@@ -5115,43 +5117,43 @@ function St(t, n) {
5115
5117
  t.positiveThickness
5116
5118
  ), o = e.endDistance >= t.negativeThickness && e.endDistance <= t.positiveThickness;
5117
5119
  if (!s.length && !i.length)
5118
- return o ? new Y$1("start", "end") : null;
5120
+ return o ? new Y("start", "end") : null;
5119
5121
  if (s.length === 1 && i.length === 1)
5120
- return new Y$1(s[0], i[0]);
5122
+ return new Y(s[0], i[0]);
5121
5123
  if (s.length === 2 && i.length === 2)
5122
5124
  throw new Error(
5123
5125
  "Bug in the clipping algorithm, unexpected number of crossing points"
5124
5126
  );
5125
5127
  const r = s.length ? s : i;
5126
- return r.length === 2 ? new Y$1(r[0], r[1]) : o ? new Y$1(r[0], "end") : new Y$1("start", r[0]);
5128
+ return r.length === 2 ? new Y(r[0], r[1]) : o ? new Y(r[0], "end") : new Y("start", r[0]);
5127
5129
  }
5128
- function yt(t, n) {
5129
- const e = In$1(t), s = St(e, n);
5130
+ function yt$1(t, n) {
5131
+ const e = In$1(t), s = St$1(e, n);
5130
5132
  if (!s)
5131
5133
  return null;
5132
- const i = En$1(t), o = St(
5134
+ const i = En(t), o = St$1(
5133
5135
  i,
5134
5136
  n
5135
5137
  );
5136
5138
  return o ? s.size > o.size ? o.clipCurve(n) : s.clipCurve(n) : null;
5137
5139
  }
5138
- const W$2 = (t) => t instanceof _t$1 ? It$1(Q$1(t.controlPoint, t.firstPoint)) + It$1(Q$1(t.controlPoint, t.lastPoint)) : It$1(Q$1(t.firstControlPoint, t.firstPoint)) + It$1(Q$1(t.lastControlPoint, t.firstControlPoint)) + It$1(Q$1(t.lastControlPoint, t.lastPoint));
5140
+ const W$2 = (t) => t instanceof _t$1 ? It$2(Q$2(t.controlPoint, t.firstPoint)) + It$2(Q$2(t.controlPoint, t.lastPoint)) : It$2(Q$2(t.firstControlPoint, t.firstPoint)) + It$2(Q$2(t.lastControlPoint, t.firstControlPoint)) + It$2(Q$2(t.lastControlPoint, t.lastPoint));
5139
5141
  function D$1(t, n, e = 1e-9, { maxIterations: s = 100 } = {}) {
5140
5142
  const i = Math.max(e * e, Number.EPSILON * 10);
5141
5143
  let o = t, r = n, l = W$2(o), c = W$2(r);
5142
5144
  for (let a = 0; a < s; a++) {
5143
- const f = l > i ? yt(r, o) : o;
5145
+ const f = l > i ? yt$1(r, o) : o;
5144
5146
  if (!f) return [];
5145
- const u = W$2(f), h = c > i ? yt(f, r) : r;
5147
+ const u = W$2(f), h = c > i ? yt$1(f, r) : r;
5146
5148
  if (!h) return [];
5147
5149
  const p = W$2(h);
5148
5150
  if (u <= i && p <= i)
5149
5151
  return [
5150
5152
  f.boundingBox.intersection(h.boundingBox).center
5151
5153
  ];
5152
- if (Y$2(f.firstPoint, f.lastPoint) && h.isOnSegment(f.firstPoint))
5154
+ if (Y$1(f.firstPoint, f.lastPoint) && h.isOnSegment(f.firstPoint))
5153
5155
  return [f.firstPoint];
5154
- if (Y$2(h.firstPoint, h.lastPoint) && f.isOnSegment(h.firstPoint))
5156
+ if (Y$1(h.firstPoint, h.lastPoint) && f.isOnSegment(h.firstPoint))
5155
5157
  return [h.firstPoint];
5156
5158
  if (u > 0.8 * l && p > 0.8 * c)
5157
5159
  if (u / l > p / c) {
@@ -5189,7 +5191,7 @@ function D$1(t, n, e = 1e-9, { maxIterations: s = 100 } = {}) {
5189
5191
  }
5190
5192
  throw new Error("Bézier clip: Maximum number of iterations reached");
5191
5193
  }
5192
- function kn$1(t, n) {
5194
+ function kn(t, n) {
5193
5195
  const e = [];
5194
5196
  if ([
5195
5197
  [t.firstPoint, n],
@@ -5203,20 +5205,20 @@ function kn$1(t, n) {
5203
5205
  if (e.length === 2)
5204
5206
  return [t.splitAt(e)[1]];
5205
5207
  if (e.length === 3)
5206
- return Y$2(e[0], t.firstPoint) && Y$2(e[1], t.lastPoint) ? [t] : [n];
5208
+ return Y$1(e[0], t.firstPoint) && Y$1(e[1], t.lastPoint) ? [t] : [n];
5207
5209
  if (e.length === 4)
5208
5210
  return [t];
5209
5211
  }
5210
5212
  function _n(t, n, e = !1) {
5211
5213
  const s = Math.max(t.precision, n.precision);
5212
5214
  if (e) {
5213
- const i = kn$1(t, n);
5215
+ const i = kn(t, n);
5214
5216
  if (i)
5215
5217
  return i;
5216
5218
  }
5217
5219
  return D$1(t, n, s);
5218
5220
  }
5219
- function On(t, n) {
5221
+ function On$1(t, n) {
5220
5222
  const e = [];
5221
5223
  if ([
5222
5224
  [t.firstPoint, n],
@@ -5230,21 +5232,21 @@ function On(t, n) {
5230
5232
  if (e.length === 2)
5231
5233
  return [t.splitAt(e)[1]];
5232
5234
  if (e.length === 3)
5233
- return Y$2(e[0], t.firstPoint) && Y$2(e[1], t.lastPoint) ? [t] : [n];
5235
+ return Y$1(e[0], t.firstPoint) && Y$1(e[1], t.lastPoint) ? [t] : [n];
5234
5236
  if (e.length === 4)
5235
5237
  return [t];
5236
5238
  }
5237
- function Tn(t, n, e = !1) {
5239
+ function Tn$1(t, n, e = !1) {
5238
5240
  const s = Math.max(t.precision, n.precision);
5239
5241
  if (e) {
5240
- const i = On(t, n);
5242
+ const i = On$1(t, n);
5241
5243
  if (i)
5242
5244
  return i;
5243
5245
  }
5244
5246
  return D$1(t, n, s);
5245
5247
  }
5246
5248
  function ae(t, n, e) {
5247
- if (t instanceof at$1 && n instanceof at$1) {
5249
+ if (t instanceof at$2 && n instanceof at$2) {
5248
5250
  const s = cn$1(
5249
5251
  t,
5250
5252
  n,
@@ -5253,42 +5255,42 @@ function ae(t, n, e) {
5253
5255
  );
5254
5256
  return s === null ? [] : [s];
5255
5257
  }
5256
- if (t instanceof at$1 && n instanceof ct$1)
5257
- return J(t, n, e);
5258
- if (t instanceof ct$1 && n instanceof at$1)
5259
- return J(n, t, e);
5260
- if (t instanceof ct$1 && n instanceof ct$1)
5258
+ if (t instanceof at$2 && n instanceof ct$2)
5259
+ return J$1(t, n, e);
5260
+ if (t instanceof ct$2 && n instanceof at$2)
5261
+ return J$1(n, t, e);
5262
+ if (t instanceof ct$2 && n instanceof ct$2)
5261
5263
  return qt(t, n, !1, e);
5262
5264
  throw new Error("Not implemented");
5263
5265
  }
5264
5266
  function K$1(t, n, e) {
5265
- if (t instanceof at$1 && n instanceof at$1) {
5267
+ if (t instanceof at$2 && n instanceof at$2) {
5266
5268
  const s = cn$1(
5267
5269
  t,
5268
5270
  n,
5269
5271
  !0,
5270
5272
  e
5271
5273
  );
5272
- return s === null ? { intersections: [], overlaps: [], count: 0 } : s instanceof at$1 ? { intersections: [], overlaps: [s], count: 1 } : { intersections: [s], overlaps: [], count: 1 };
5274
+ return s === null ? { intersections: [], overlaps: [], count: 0 } : s instanceof at$2 ? { intersections: [], overlaps: [s], count: 1 } : { intersections: [s], overlaps: [], count: 1 };
5273
5275
  }
5274
5276
  if (!t.boundingBox.overlaps(n.boundingBox))
5275
5277
  return { intersections: [], overlaps: [], count: 0 };
5276
- if (t instanceof at$1 && n instanceof ct$1) {
5277
- const s = J(t, n, e);
5278
+ if (t instanceof at$2 && n instanceof ct$2) {
5279
+ const s = J$1(t, n, e);
5278
5280
  return { intersections: s, overlaps: [], count: s.length };
5279
5281
  }
5280
- if (t instanceof ct$1 && n instanceof at$1) {
5281
- const s = J(n, t, e);
5282
+ if (t instanceof ct$2 && n instanceof at$2) {
5283
+ const s = J$1(n, t, e);
5282
5284
  return { intersections: s, overlaps: [], count: s.length };
5283
5285
  }
5284
- if (t instanceof ct$1 && n instanceof ct$1) {
5286
+ if (t instanceof ct$2 && n instanceof ct$2) {
5285
5287
  const s = qt(
5286
5288
  t,
5287
5289
  n,
5288
5290
  !0,
5289
5291
  e
5290
5292
  );
5291
- return s.length ? s[0] instanceof ct$1 ? {
5293
+ return s.length ? s[0] instanceof ct$2 ? {
5292
5294
  intersections: [],
5293
5295
  overlaps: s,
5294
5296
  count: s.length
@@ -5298,7 +5300,7 @@ function K$1(t, n, e) {
5298
5300
  count: s.length
5299
5301
  } : { intersections: [], overlaps: [], count: 0 };
5300
5302
  }
5301
- if (t instanceof at$1 && n instanceof jt$2) {
5303
+ if (t instanceof at$2 && n instanceof jt$1) {
5302
5304
  const s = et$2(
5303
5305
  t,
5304
5306
  n,
@@ -5306,7 +5308,7 @@ function K$1(t, n, e) {
5306
5308
  );
5307
5309
  return { intersections: s, overlaps: [], count: s.length };
5308
5310
  }
5309
- if (n instanceof at$1 && t instanceof jt$2) {
5311
+ if (n instanceof at$2 && t instanceof jt$1) {
5310
5312
  const s = et$2(
5311
5313
  n,
5312
5314
  t,
@@ -5314,21 +5316,21 @@ function K$1(t, n, e) {
5314
5316
  );
5315
5317
  return { intersections: s, overlaps: [], count: s.length };
5316
5318
  }
5317
- if (t instanceof ct$1 && n instanceof jt$2) {
5319
+ if (t instanceof ct$2 && n instanceof jt$1) {
5318
5320
  const s = mt$1(t, n);
5319
5321
  return { intersections: s, overlaps: [], count: s.length };
5320
5322
  }
5321
- if (n instanceof ct$1 && t instanceof jt$2) {
5323
+ if (n instanceof ct$2 && t instanceof jt$1) {
5322
5324
  const s = mt$1(n, t);
5323
5325
  return { intersections: s, overlaps: [], count: s.length };
5324
5326
  }
5325
- if (t instanceof jt$2 && n instanceof jt$2) {
5326
- const s = wn(
5327
+ if (t instanceof jt$1 && n instanceof jt$1) {
5328
+ const s = wn$1(
5327
5329
  t,
5328
5330
  n,
5329
5331
  !0
5330
5332
  );
5331
- return s.length ? s[0] instanceof jt$2 ? {
5333
+ return s.length ? s[0] instanceof jt$1 ? {
5332
5334
  intersections: [],
5333
5335
  overlaps: s,
5334
5336
  count: s.length
@@ -5338,32 +5340,32 @@ function K$1(t, n, e) {
5338
5340
  count: s.length
5339
5341
  } : { intersections: [], overlaps: [], count: 0 };
5340
5342
  }
5341
- if (t instanceof at$1 && (n instanceof Et$1 || n instanceof _t$1)) {
5342
- const s = gt$1(t, n);
5343
+ if (t instanceof at$2 && (n instanceof Et$1 || n instanceof _t$1)) {
5344
+ const s = gt(t, n);
5343
5345
  return { intersections: s, overlaps: [], count: s.length };
5344
5346
  }
5345
- if (n instanceof at$1 && (t instanceof Et$1 || t instanceof _t$1)) {
5346
- const s = gt$1(n, t);
5347
+ if (n instanceof at$2 && (t instanceof Et$1 || t instanceof _t$1)) {
5348
+ const s = gt(n, t);
5347
5349
  return { intersections: s, overlaps: [], count: s.length };
5348
5350
  }
5349
- if ((t instanceof ct$1 || t instanceof jt$2) && n instanceof _t$1) {
5351
+ if ((t instanceof ct$2 || t instanceof jt$1) && n instanceof _t$1) {
5350
5352
  const s = wt$1(t, n);
5351
5353
  return { intersections: s, overlaps: [], count: s.length };
5352
5354
  }
5353
- if ((n instanceof ct$1 || n instanceof jt$2) && t instanceof _t$1) {
5355
+ if ((n instanceof ct$2 || n instanceof jt$1) && t instanceof _t$1) {
5354
5356
  const s = wt$1(n, t);
5355
5357
  return { intersections: s, overlaps: [], count: s.length };
5356
5358
  }
5357
- if ((t instanceof ct$1 || t instanceof jt$2) && n instanceof Et$1) {
5359
+ if ((t instanceof ct$2 || t instanceof jt$1) && n instanceof Et$1) {
5358
5360
  const s = Pt$1(t, n);
5359
5361
  return { intersections: s, overlaps: [], count: s.length };
5360
5362
  }
5361
- if ((n instanceof ct$1 || n instanceof jt$2) && t instanceof Et$1) {
5363
+ if ((n instanceof ct$2 || n instanceof jt$1) && t instanceof Et$1) {
5362
5364
  const s = Pt$1(n, t);
5363
5365
  return { intersections: s, overlaps: [], count: s.length };
5364
5366
  }
5365
5367
  if (t instanceof _t$1 && n instanceof _t$1) {
5366
- const s = Tn(
5368
+ const s = Tn$1(
5367
5369
  t,
5368
5370
  n
5369
5371
  );
@@ -5459,7 +5461,7 @@ class Nt extends Ze {
5459
5461
  return this.repr;
5460
5462
  }
5461
5463
  }
5462
- function Ln$1(t, n = "Stroke") {
5464
+ function Ln(t, n = "Stroke") {
5463
5465
  Vt(t.length).forEach(
5464
5466
  ([e, s]) => {
5465
5467
  if (e === s) return;
@@ -5467,22 +5469,22 @@ function Ln$1(t, n = "Stroke") {
5467
5469
  if (r.count !== 0) {
5468
5470
  if (r.count === 1 && !r.overlaps.length) {
5469
5471
  const c = e - s, a = r.intersections[0];
5470
- if (c === 1 && Y$2(i.firstPoint, a, l) || c === -1 && Y$2(i.lastPoint, a, l) || c === t.length - 1 && Y$2(i.lastPoint, a, l) && Y$2(o.firstPoint, a, l) || -c === t.length - 1 && Y$2(i.firstPoint, a, l) && Y$2(o.lastPoint, a, l))
5472
+ if (c === 1 && Y$1(i.firstPoint, a, l) || c === -1 && Y$1(i.lastPoint, a, l) || c === t.length - 1 && Y$1(i.lastPoint, a, l) && Y$1(o.firstPoint, a, l) || -c === t.length - 1 && Y$1(i.firstPoint, a, l) && Y$1(o.lastPoint, a, l))
5471
5473
  return;
5472
5474
  }
5473
- if (!(r.count === 2 && t.length === 2 && (Y$2(
5475
+ if (!(r.count === 2 && t.length === 2 && (Y$1(
5474
5476
  i.firstPoint,
5475
5477
  r.intersections[0],
5476
5478
  l
5477
- ) && Y$2(
5479
+ ) && Y$1(
5478
5480
  i.lastPoint,
5479
5481
  r.intersections[1],
5480
5482
  l
5481
- ) || Y$2(
5483
+ ) || Y$1(
5482
5484
  i.firstPoint,
5483
5485
  r.intersections[1],
5484
5486
  l
5485
- ) && Y$2(
5487
+ ) && Y$1(
5486
5488
  i.lastPoint,
5487
5489
  r.intersections[0],
5488
5490
  l
@@ -5499,23 +5501,23 @@ function Ln$1(t, n = "Stroke") {
5499
5501
  function Ut(t, n = "Stroke") {
5500
5502
  if (t.length === 0)
5501
5503
  throw new Error(`${n} must have at least one segment`);
5502
- Kt$1([t.slice(0, -1), t.slice(1)]).forEach(
5504
+ Kt([t.slice(0, -1), t.slice(1)]).forEach(
5503
5505
  ([e, s]) => {
5504
- if (!Y$2(e.lastPoint, s.firstPoint))
5506
+ if (!Y$1(e.lastPoint, s.firstPoint))
5505
5507
  throw new Error(
5506
5508
  `${n} segments must be connected, but ${e.info} and ${s.info} are not`
5507
5509
  );
5508
5510
  }
5509
- ), Ln$1(t, n);
5511
+ ), Ln(t, n);
5510
5512
  }
5511
5513
  function bt$1(t, n) {
5512
- return !!(t instanceof at$1 && n instanceof at$1 && Ie(t.V, n.V) || t instanceof ct$1 && n instanceof ct$1 && Y$2(t.center, n.center) && t.radius - n.radius < t.precision);
5514
+ return !!(t instanceof at$2 && n instanceof at$2 && Ie(t.V, n.V) || t instanceof ct$2 && n instanceof ct$2 && Y$1(t.center, n.center) && t.radius - n.radius < t.precision);
5513
5515
  }
5514
- function Ct(t, n) {
5515
- if (t instanceof at$1 && n instanceof at$1)
5516
- return new at$1(t.firstPoint, n.lastPoint);
5517
- if (t instanceof ct$1 && n instanceof ct$1)
5518
- return new ct$1(
5516
+ function Ct$1(t, n) {
5517
+ if (t instanceof at$2 && n instanceof at$2)
5518
+ return new at$2(t.firstPoint, n.lastPoint);
5519
+ if (t instanceof ct$2 && n instanceof ct$2)
5520
+ return new ct$2(
5519
5521
  t.firstPoint,
5520
5522
  n.lastPoint,
5521
5523
  t.center,
@@ -5523,7 +5525,7 @@ function Ct(t, n) {
5523
5525
  );
5524
5526
  throw new Error("Not implemented");
5525
5527
  }
5526
- function jt$1(t) {
5528
+ function jt(t) {
5527
5529
  let n = !1;
5528
5530
  const e = [];
5529
5531
  for (const s of t.segments) {
@@ -5532,19 +5534,19 @@ function jt$1(t) {
5532
5534
  continue;
5533
5535
  }
5534
5536
  const i = e[e.length - 1];
5535
- bt$1(i, s) ? (n = !0, e.pop(), e.push(Ct(i, s))) : e.push(s);
5537
+ bt$1(i, s) ? (n = !0, e.pop(), e.push(Ct$1(i, s))) : e.push(s);
5536
5538
  }
5537
- if (Y$2(t.firstPoint, t.lastPoint) && bt$1(
5539
+ if (Y$1(t.firstPoint, t.lastPoint) && bt$1(
5538
5540
  e[0],
5539
5541
  e[e.length - 1]
5540
5542
  )) {
5541
5543
  n = !0;
5542
5544
  const s = e.pop();
5543
- e[0] = Ct(s, e[0]);
5545
+ e[0] = Ct$1(s, e[0]);
5544
5546
  }
5545
5547
  return n ? e : null;
5546
5548
  }
5547
- let B$1 = class B extends Nt {
5549
+ let B$2 = class B extends Nt {
5548
5550
  constructor() {
5549
5551
  super(...arguments);
5550
5552
  C(this, "strokeType", "STRAND");
@@ -5560,12 +5562,12 @@ let B$1 = class B extends Nt {
5560
5562
  );
5561
5563
  }
5562
5564
  extend(e) {
5563
- if (!Y$2(this.lastPoint, e.firstPoint))
5565
+ if (!Y$1(this.lastPoint, e.firstPoint))
5564
5566
  throw console.error(this.repr, e.repr), new Error("Cannot extend strand: connection point is not the same");
5565
5567
  return new B([...this.segments, ...e.segments]);
5566
5568
  }
5567
5569
  simplify() {
5568
- const e = jt$1(this);
5570
+ const e = jt(this);
5569
5571
  return e ? new B(e, { ignoreChecks: !0 }) : this;
5570
5572
  }
5571
5573
  transform(e) {
@@ -5575,7 +5577,7 @@ let B$1 = class B extends Nt {
5575
5577
  );
5576
5578
  }
5577
5579
  };
5578
- const zn = (t, n) => {
5580
+ const zn$1 = (t, n) => {
5579
5581
  const e = me(n, {
5580
5582
  V: [1, 0],
5581
5583
  firstPoint: t,
@@ -5591,19 +5593,19 @@ const zn = (t, n) => {
5591
5593
  }
5592
5594
  return 1;
5593
5595
  };
5594
- let ut$1 = class ut {
5596
+ class ut {
5595
5597
  constructor(n) {
5596
5598
  C(this, "_count", 0);
5597
5599
  C(this, "segment");
5598
5600
  this.segment = n;
5599
5601
  }
5600
5602
  update(n, e = !1) {
5601
- !e && !this.segment.isOnSegment(n) || (Y$2(n, this.segment.firstPoint) ? this._count += this.segment.tangentAtFirstPoint[1] > 0 ? 1 : 0 : Y$2(n, this.segment.lastPoint) ? this._count += this.segment.tangentAtLastPoint[1] > 0 ? 0 : 1 : this._count += 1);
5603
+ !e && !this.segment.isOnSegment(n) || (Y$1(n, this.segment.firstPoint) ? this._count += this.segment.tangentAtFirstPoint[1] > 0 ? 1 : 0 : Y$1(n, this.segment.lastPoint) ? this._count += this.segment.tangentAtLastPoint[1] > 0 ? 0 : 1 : this._count += 1);
5602
5604
  }
5603
5605
  get count() {
5604
5606
  return this._count;
5605
5607
  }
5606
- };
5608
+ }
5607
5609
  const qn = (t, n) => {
5608
5610
  const e = n.precision, s = Math.abs(t[1] - n.center[1]);
5609
5611
  if (s > n.radius + e) return 0;
@@ -5614,15 +5616,15 @@ const qn = (t, n) => {
5614
5616
  if (l && n.center[0] < t[0]) return 0;
5615
5617
  const c = Math.sqrt(
5616
5618
  n.radius * n.radius - s * s
5617
- ), a = new ut$1(n);
5619
+ ), a = new ut(n);
5618
5620
  return a.update([n.center[0] + c, t[1]]), l && a.update([n.center[0] - c, t[1]]), a.count;
5619
- }, Dn = (t, n) => {
5620
- const e = n.boundingBox.xMax + n.boundingBox.width / 2, s = new at$1(t, [e, t[1]]), i = new ut$1(n);
5621
+ }, Dn$1 = (t, n) => {
5622
+ const e = n.boundingBox.xMax + n.boundingBox.width / 2, s = new at$2(t, [e, t[1]]), i = new ut(n);
5621
5623
  return et$2(s, n).forEach((o) => {
5622
5624
  i.update(o, !0);
5623
5625
  }), i.count;
5624
- }, Rn = (t, n) => {
5625
- const e = new ut$1(n);
5626
+ }, Rn$1 = (t, n) => {
5627
+ const e = new ut(n);
5626
5628
  return n.paramsAtY(t[1]).map((s) => {
5627
5629
  try {
5628
5630
  return n.paramPoint(s);
@@ -5637,17 +5639,17 @@ const qn = (t, n) => {
5637
5639
  }), e.count;
5638
5640
  };
5639
5641
  function Vn(t, n) {
5640
- if (n instanceof at$1)
5641
- return zn(t, n);
5642
- if (n instanceof ct$1)
5642
+ if (n instanceof at$2)
5643
+ return zn$1(t, n);
5644
+ if (n instanceof ct$2)
5643
5645
  return qn(t, n);
5644
- if (n instanceof jt$2)
5645
- return Dn(t, n);
5646
+ if (n instanceof jt$1)
5647
+ return Dn$1(t, n);
5646
5648
  if (n instanceof Et$1 || n instanceof _t$1)
5647
- return Rn(t, n);
5649
+ return Rn$1(t, n);
5648
5650
  throw new Error("Not implemented");
5649
5651
  }
5650
- let O$1 = class O extends Nt {
5652
+ class O extends Nt {
5651
5653
  constructor(e, { ignoreChecks: s = !1 } = {}) {
5652
5654
  super(e, { ignoreChecks: !0 });
5653
5655
  C(this, "strokeType", "LOOP");
@@ -5656,7 +5658,7 @@ let O$1 = class O extends Nt {
5656
5658
  }
5657
5659
  get clockwise() {
5658
5660
  if (this._clockwise === null) {
5659
- const e = this.segments.flatMap((i) => i instanceof at$1 ? [i.firstPoint] : [i.firstPoint, i.paramPoint(0.5)]), s = e.map((i, o) => {
5661
+ const e = this.segments.flatMap((i) => i instanceof at$2 ? [i.firstPoint] : [i.firstPoint, i.paramPoint(0.5)]), s = e.map((i, o) => {
5660
5662
  const r = e[(o + 1) % e.length];
5661
5663
  return (r[0] - i[0]) * (r[1] + i[1]);
5662
5664
  }).reduce((i, o) => i + o, 0);
@@ -5684,18 +5686,18 @@ let O$1 = class O extends Nt {
5684
5686
  return this.onStroke(e) || !this.boundingBox.contains(e) ? !1 : this.segments.reduce((i, o) => i + Vn(e, o), 0) % 2 === 1;
5685
5687
  }
5686
5688
  simplify() {
5687
- const e = jt$1(this);
5689
+ const e = jt(this);
5688
5690
  return e ? new O(e, { ignoreChecks: !0 }) : this;
5689
5691
  }
5690
- };
5692
+ }
5691
5693
  function Nn(t) {
5692
- if (Ut(t, "Loop"), !Y$2(t[0].firstPoint, t[t.length - 1].lastPoint))
5694
+ if (Ut(t, "Loop"), !Y$1(t[0].firstPoint, t[t.length - 1].lastPoint))
5693
5695
  throw new Error("Loop segment must be closed");
5694
5696
  }
5695
5697
  const Un = [
5696
- at$1,
5697
- ct$1,
5698
- jt$2,
5698
+ at$2,
5699
+ ct$2,
5700
+ jt$1,
5699
5701
  _t$1,
5700
5702
  Et$1
5701
5703
  ];
@@ -5703,13 +5705,13 @@ function jn(t) {
5703
5705
  return Un.some((n) => t instanceof n);
5704
5706
  }
5705
5707
  function Ht(t) {
5706
- if (t instanceof at$1)
5708
+ if (t instanceof at$2)
5707
5709
  return {
5708
5710
  type: t.segmentType,
5709
5711
  firstPoint: t.firstPoint,
5710
5712
  lastPoint: t.lastPoint
5711
5713
  };
5712
- if (t instanceof ct$1)
5714
+ if (t instanceof ct$2)
5713
5715
  return {
5714
5716
  type: t.segmentType,
5715
5717
  firstPoint: t.firstPoint,
@@ -5717,7 +5719,7 @@ function Ht(t) {
5717
5719
  center: t.center,
5718
5720
  clockwise: t.clockwise
5719
5721
  };
5720
- if (t instanceof jt$2)
5722
+ if (t instanceof jt$1)
5721
5723
  return {
5722
5724
  type: t.segmentType,
5723
5725
  firstPoint: t.firstPoint,
@@ -5764,18 +5766,18 @@ function Hn(t) {
5764
5766
  figures: t.figures.map($t)
5765
5767
  };
5766
5768
  }
5767
- function Mt(t) {
5768
- if (t instanceof _$1)
5769
+ function Mt$1(t) {
5770
+ if (t instanceof _$2)
5769
5771
  return Hn(t);
5770
- if (t instanceof v$2)
5772
+ if (t instanceof v$1)
5771
5773
  return $t(t);
5772
- if (t instanceof O$1)
5774
+ if (t instanceof O)
5773
5775
  return it$2(t);
5774
5776
  if (jn(t))
5775
5777
  return Ht(t);
5776
5778
  throw new Error("Unknown shape type");
5777
5779
  }
5778
- class $n {
5780
+ let $n$1 = class $n {
5779
5781
  constructor() {
5780
5782
  this.ids = [], this.values = [], this.length = 0;
5781
5783
  }
@@ -5820,9 +5822,9 @@ class $n {
5820
5822
  shrink() {
5821
5823
  this.ids.length = this.values.length = this.length;
5822
5824
  }
5823
- }
5824
- const At = [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array], nt$1 = 3;
5825
- class at {
5825
+ };
5826
+ const At$1 = [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array], nt$1 = 3;
5827
+ let at$1 = class at {
5826
5828
  /**
5827
5829
  * Recreate a Flatbush index from raw `ArrayBuffer` or `SharedArrayBuffer` data.
5828
5830
  * @param {ArrayBuffer | SharedArrayBuffer} data
@@ -5840,7 +5842,7 @@ class at {
5840
5842
  const o = i >> 4;
5841
5843
  if (o !== nt$1)
5842
5844
  throw new Error(`Got v${o} data when expected v${nt$1}.`);
5843
- const r = At[i & 15];
5845
+ const r = At$1[i & 15];
5844
5846
  if (!r)
5845
5847
  throw new Error("Unrecognized array type.");
5846
5848
  const [l] = new Uint16Array(n, e + 2, 1), [c] = new Uint32Array(n, e + 4, 1);
@@ -5865,10 +5867,10 @@ class at {
5865
5867
  l = Math.ceil(l / this.nodeSize), c += l, this._levelBounds.push(c * 4);
5866
5868
  while (l !== 1);
5867
5869
  this.ArrayType = s, this.IndexArrayType = c < 16384 ? Uint16Array : Uint32Array;
5868
- const a = At.indexOf(this.ArrayType), f = c * 4 * this.ArrayType.BYTES_PER_ELEMENT;
5870
+ const a = At$1.indexOf(this.ArrayType), f = c * 4 * this.ArrayType.BYTES_PER_ELEMENT;
5869
5871
  if (a < 0)
5870
5872
  throw new Error(`Unexpected typed array class: ${s}.`);
5871
- o && o.byteLength !== void 0 && !o.buffer ? (this.data = o, this._boxes = new this.ArrayType(this.data, r + 8, c * 4), this._indices = new this.IndexArrayType(this.data, r + 8 + f, c), this._pos = c * 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 i(8 + f + c * this.IndexArrayType.BYTES_PER_ELEMENT), this._boxes = new this.ArrayType(this.data, 8, c * 4), this._indices = new this.IndexArrayType(this.data, 8 + f, c), 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, (nt$1 << 4) + a]), new Uint16Array(this.data, 2, 1)[0] = e, new Uint32Array(this.data, 4, 1)[0] = n), this._queue = new $n();
5873
+ o && o.byteLength !== void 0 && !o.buffer ? (this.data = o, this._boxes = new this.ArrayType(this.data, r + 8, c * 4), this._indices = new this.IndexArrayType(this.data, r + 8 + f, c), this._pos = c * 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 i(8 + f + c * this.IndexArrayType.BYTES_PER_ELEMENT), this._boxes = new this.ArrayType(this.data, 8, c * 4), this._indices = new this.IndexArrayType(this.data, 8 + f, c), 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, (nt$1 << 4) + a]), new Uint16Array(this.data, 2, 1)[0] = e, new Uint32Array(this.data, 4, 1)[0] = n), this._queue = new $n$1();
5872
5874
  }
5873
5875
  /**
5874
5876
  * Add a given rectangle to the index.
@@ -5896,7 +5898,7 @@ class at {
5896
5898
  const c = n[l++], a = n[l++], f = n[l++], u = n[l++], h = Math.floor(o * ((c + f) / 2 - this.minX) / e), p = Math.floor(o * ((a + u) / 2 - this.minY) / s);
5897
5899
  i[r] = Xn(h, p);
5898
5900
  }
5899
- ot$1(i, n, this._indices, 0, this.numItems - 1, this.nodeSize);
5901
+ ot$2(i, n, this._indices, 0, this.numItems - 1, this.nodeSize);
5900
5902
  for (let r = 0, l = 0; r < this._levelBounds.length - 1; r++) {
5901
5903
  const c = this._levelBounds[r];
5902
5904
  for (; l < c; ) {
@@ -5950,7 +5952,7 @@ class at {
5950
5952
  t: for (; r !== void 0; ) {
5951
5953
  const f = Math.min(r + this.nodeSize * 4, Et(r, this._levelBounds));
5952
5954
  for (let u = r; u < f; u += 4) {
5953
- const h = this._indices[u >> 2] | 0, p = It(n, this._boxes[u], this._boxes[u + 2]), d = It(e, this._boxes[u + 1], this._boxes[u + 3]), m = p * p + d * d;
5955
+ const h = this._indices[u >> 2] | 0, p = It$1(n, this._boxes[u], this._boxes[u + 2]), d = It$1(e, this._boxes[u + 1], this._boxes[u + 3]), m = p * p + d * d;
5954
5956
  m > a || (r >= this.numItems * 4 ? l.push(h << 1, m) : (o === void 0 || o(h)) && l.push((h << 1) + 1, m));
5955
5957
  }
5956
5958
  for (; l.length && l.peek() & 1; )
@@ -5959,8 +5961,8 @@ class at {
5959
5961
  }
5960
5962
  return l.clear(), c;
5961
5963
  }
5962
- }
5963
- function It(t, n, e) {
5964
+ };
5965
+ function It$1(t, n, e) {
5964
5966
  return t < n ? n - t : t <= e ? 0 : t - e;
5965
5967
  }
5966
5968
  function Et(t, n) {
@@ -5971,7 +5973,7 @@ function Et(t, n) {
5971
5973
  }
5972
5974
  return n[e];
5973
5975
  }
5974
- function ot$1(t, n, e, s, i, o) {
5976
+ function ot$2(t, n, e, s, i, o) {
5975
5977
  if (Math.floor(s / o) >= Math.floor(i / o)) return;
5976
5978
  const r = t[s + i >> 1];
5977
5979
  let l = s - 1, c = i + 1;
@@ -5985,7 +5987,7 @@ function ot$1(t, n, e, s, i, o) {
5985
5987
  if (l >= c) break;
5986
5988
  Yn(t, n, e, l, c);
5987
5989
  }
5988
- ot$1(t, n, e, s, c, o), ot$1(t, n, e, c + 1, i, o);
5990
+ ot$2(t, n, e, s, c, o), ot$2(t, n, e, c + 1, i, o);
5989
5991
  }
5990
5992
  function Yn(t, n, e, s, i) {
5991
5993
  const o = t[s];
@@ -6001,10 +6003,10 @@ function Xn(t, n) {
6001
6003
  let f = t ^ n, u = s | 65535 ^ (f | e);
6002
6004
  return f = (f | f << 8) & 16711935, f = (f | f << 4) & 252645135, f = (f | f << 2) & 858993459, f = (f | f << 1) & 1431655765, u = (u | u << 8) & 16711935, u = (u | u << 4) & 252645135, u = (u | u << 2) & 858993459, u = (u | u << 1) & 1431655765, (u << 1 | f) >>> 0;
6003
6005
  }
6004
- function Yt$1(t, n = 1e-7) {
6006
+ function Yt(t, n = 1e-7) {
6005
6007
  if (t.length === 0) return [];
6006
6008
  if (t.length === 1) return [t];
6007
- const e = new at(t.length);
6009
+ const e = new at$1(t.length);
6008
6010
  t.forEach((o) => {
6009
6011
  const [r, l] = o.firstPoint;
6010
6012
  e.add(r - n, l - n, r + n, l + n);
@@ -6038,7 +6040,7 @@ function Yt$1(t, n = 1e-7) {
6038
6040
  }
6039
6041
  }), s;
6040
6042
  }
6041
- let v$2 = class v extends Ze {
6043
+ let v$1 = class v extends Ze {
6042
6044
  constructor(e, s = [], { ignoreChecks: i = !1 } = {}) {
6043
6045
  super();
6044
6046
  C(this, "contour");
@@ -6076,7 +6078,7 @@ let v$2 = class v extends Ze {
6076
6078
  }
6077
6079
  overlappingStrands(e) {
6078
6080
  const s = e instanceof v ? e.allLoops : [e], i = this.allLoops.flatMap((o) => s.flatMap((r) => o.overlappingSegments(r)));
6079
- return Yt$1(i).map((o) => new B$1(o));
6081
+ return Yt(i).map((o) => new B$2(o));
6080
6082
  }
6081
6083
  };
6082
6084
  function Gn(t, n = []) {
@@ -6090,7 +6092,7 @@ function Gn(t, n = []) {
6090
6092
  throw new Error("Holes must be inside the contour");
6091
6093
  for (const [e, s] of st$2(n))
6092
6094
  if (e.contains(s.firstPoint))
6093
- throw console.error(Mt(e), Mt(s)), new Error("Holes must not be inside other holes");
6095
+ throw console.error(Mt$1(e), Mt$1(s)), new Error("Holes must not be inside other holes");
6094
6096
  }
6095
6097
  const Qn = (t) => {
6096
6098
  const n = t.map((i, o) => t.slice(o + 1).map((r, l) => [l + o + 1, r]).filter(([, r]) => i.boundingBox.overlaps(r.boundingBox)).map(([r]) => r)), e = [], s = Array(n.length);
@@ -6100,32 +6102,32 @@ const Qn = (t) => {
6100
6102
  s[l] = r;
6101
6103
  });
6102
6104
  }), e;
6103
- }, Xt$1 = (t) => t.map((n, e) => {
6105
+ }, Xt = (t) => t.map((n, e) => {
6104
6106
  const i = n.segments[0].midPoint, o = t.filter((r, l) => e === l ? !1 : r.contains(i));
6105
6107
  return {
6106
6108
  loop: n,
6107
6109
  isIn: o
6108
6110
  };
6109
- }), Wn = (t, n) => t.flatMap(({ loop: e }) => ft(
6111
+ }), Wn = (t, n) => t.flatMap(({ loop: e }) => ft$1(
6110
6112
  n.filter(
6111
6113
  ({ loop: s, isIn: i }) => s === e || i.indexOf(e) !== -1
6112
6114
  )
6113
6115
  )), Jn = (t, n) => {
6114
- const e = n.filter(({ isIn: i }) => i.length <= 1), s = ft(
6115
- Xt$1(t.map(({ loop: i }) => i))
6116
+ const e = n.filter(({ isIn: i }) => i.length <= 1), s = ft$1(
6117
+ Xt(t.map(({ loop: i }) => i))
6116
6118
  );
6117
6119
  return [e, ...s];
6118
- }, ft = (t) => {
6120
+ }, ft$1 = (t) => {
6119
6121
  if (!t.length) return [];
6120
6122
  const n = t.filter(({ isIn: s }) => !s.length), e = t.filter(({ isIn: s }) => s.length > 1);
6121
6123
  return n.length === 1 && e.length === 0 ? [t] : n.length > 1 ? Wn(n, t) : Jn(e, t);
6122
6124
  };
6123
6125
  function X$1(t) {
6124
- return Qn(t).map(Xt$1).flatMap(ft).map((e) => {
6125
- if (e.length === 1) return new v$2(e[0].loop);
6126
+ return Qn(t).map(Xt).flatMap(ft$1).map((e) => {
6127
+ if (e.length === 1) return new v$1(e[0].loop);
6126
6128
  e.sort((o, r) => o.isIn.length - r.isIn.length);
6127
6129
  const [s, ...i] = e.map(({ loop: o }) => o);
6128
- return new v$2(s, i);
6130
+ return new v$1(s, i);
6129
6131
  });
6130
6132
  }
6131
6133
  function Kn(t, n) {
@@ -6136,18 +6138,18 @@ function Kn(t, n) {
6136
6138
  return e;
6137
6139
  }
6138
6140
  function* Ft(t, n, e) {
6139
- const s = (r) => n.some((l) => Y$2(l, r.lastPoint)), i = (r) => e.some((l) => r.isSame(l));
6141
+ const s = (r) => n.some((l) => Y$1(l, r.lastPoint)), i = (r) => e.some((l) => r.isSame(l));
6140
6142
  let o = [];
6141
6143
  for (const r of t)
6142
- s(r) ? (o.push(r), yield new B$1(o, { ignoreChecks: !0 }), o = []) : i(r) ? (o.length && (yield new B$1(o, { ignoreChecks: !0 }), o = []), yield new B$1([r], { ignoreChecks: !0 })) : o.push(r);
6143
- o.length && (yield new B$1(o, { ignoreChecks: !0 }));
6144
+ s(r) ? (o.push(r), yield new B$2(o, { ignoreChecks: !0 }), o = []) : i(r) ? (o.length && (yield new B$2(o, { ignoreChecks: !0 }), o = []), yield new B$2([r], { ignoreChecks: !0 })) : o.push(r);
6145
+ o.length && (yield new B$2(o, { ignoreChecks: !0 }));
6144
6146
  }
6145
- const vt = (t, n) => {
6146
- const e = t.findIndex((o) => Y$2(n, o.firstPoint)), s = t.slice(0, e);
6147
+ const vt$1 = (t, n) => {
6148
+ const e = t.findIndex((o) => Y$1(n, o.firstPoint)), s = t.slice(0, e);
6147
6149
  return t.slice(e).concat(s);
6148
6150
  }, Bt = (t, n) => {
6149
6151
  let e = t;
6150
- const s = (l) => Y$2(l.firstPoint, n.firstPoint) && Y$2(l.lastPoint, n.lastPoint);
6152
+ const s = (l) => Y$1(l.firstPoint, n.firstPoint) && Y$1(l.lastPoint, n.lastPoint);
6151
6153
  let i = t.findIndex(s);
6152
6154
  if (i === -1) {
6153
6155
  const l = t.map((c) => c.reverse());
@@ -6163,7 +6165,7 @@ const vt = (t, n) => {
6163
6165
  };
6164
6166
  function Zn(t, n, e) {
6165
6167
  return t.filter((s) => {
6166
- const i = n.filter((l) => Y$2(l.firstPoint, s) || Y$2(l.lastPoint, s));
6168
+ const i = n.filter((l) => Y$1(l.firstPoint, s) || Y$1(l.lastPoint, s));
6167
6169
  if (i.length % 2)
6168
6170
  throw new Error("Bug in the intersection algo on non crossing point");
6169
6171
  const o = i.map((l) => e.contains(l.midPoint));
@@ -6189,7 +6191,7 @@ function te(t, n, e) {
6189
6191
  });
6190
6192
  }), s = Te(s, e), !s.length || s.length === 1) return null;
6191
6193
  const l = ([h, p]) => p.length ? h.splitAt(p) : [h];
6192
- let c = Kt$1([t.segments, o]).flatMap(l), a = Kt$1([n.segments, r]).flatMap(l);
6194
+ let c = Kt([t.segments, o]).flatMap(l), a = Kt([n.segments, r]).flatMap(l);
6193
6195
  if (s = Zn(
6194
6196
  s,
6195
6197
  c,
@@ -6206,7 +6208,7 @@ function te(t, n, e) {
6206
6208
  );
6207
6209
  } else {
6208
6210
  const h = s[0];
6209
- c = vt(c, h), a = vt(a, h);
6211
+ c = vt$1(c, h), a = vt$1(a, h);
6210
6212
  }
6211
6213
  let f = Array.from(
6212
6214
  Ft(
@@ -6221,24 +6223,24 @@ function te(t, n, e) {
6221
6223
  i
6222
6224
  )
6223
6225
  );
6224
- return (!Y$2(
6226
+ return (!Y$1(
6225
6227
  u[0].lastPoint,
6226
6228
  f[0].lastPoint
6227
- ) || i.length > 0 && u[0].segmentsCount !== 1) && (u = u.map((h) => h.reverse()).reverse(), Y$2(u[0].lastPoint, f[0].lastPoint) || (f = f.map((h) => h.reverse()).reverse())), Kt$1([f, u]).map(([h, p]) => h.segmentsCount === 1 && i.some((d) => h.segments[0].isSame(d)) ? [h, "same"] : [h, p]);
6229
+ ) || i.length > 0 && u[0].segmentsCount !== 1) && (u = u.map((h) => h.reverse()).reverse(), Y$1(u[0].lastPoint, f[0].lastPoint) || (f = f.map((h) => h.reverse()).reverse())), Kt([f, u]).map(([h, p]) => h.segmentsCount === 1 && i.some((d) => h.segments[0].isSame(d)) ? [h, "same"] : [h, p]);
6228
6230
  }
6229
6231
  function kt(t) {
6230
6232
  let n = t[0];
6231
6233
  for (const e of t.slice(1))
6232
6234
  n = n.extend(e);
6233
- if (!Y$2(n.firstPoint, n.lastPoint))
6235
+ if (!Y$1(n.firstPoint, n.lastPoint))
6234
6236
  throw console.error(
6235
6237
  Z$1(n.firstPoint),
6236
6238
  Z$1(n.lastPoint)
6237
6239
  ), new Error("Bug in the intersection algo on non closing strand");
6238
- return new O$1(n.segments);
6240
+ return new O(n.segments);
6239
6241
  }
6240
6242
  function ne(t, n) {
6241
- const e = Kt$1([
6243
+ const e = Kt([
6242
6244
  n.slice(0, -1),
6243
6245
  n.slice(1)
6244
6246
  ]).map(([i, o]) => kt(t.slice(i, o)));
@@ -6252,21 +6254,21 @@ function ee(t) {
6252
6254
  const n = t.map((i) => i.firstPoint);
6253
6255
  let e = t.map((i) => i.lastPoint);
6254
6256
  e = e.slice(-1).concat(e.slice(0, -1));
6255
- const s = Kt$1([n, e]).flatMap(
6256
- ([i, o], r) => Y$2(i, o) ? [] : r
6257
+ const s = Kt([n, e]).flatMap(
6258
+ ([i, o], r) => Y$1(i, o) ? [] : r
6257
6259
  );
6258
6260
  try {
6259
6261
  return ne(t, s);
6260
6262
  } catch {
6261
- return Yt$1(t.flatMap((o) => o.segments)).filter((o) => o.length > 1).filter((o) => Y$2(o[0].firstPoint, o.at(-1).lastPoint)).map((o) => new O$1(o));
6263
+ return Yt(t.flatMap((o) => o.segments)).filter((o) => o.length > 1).filter((o) => Y$1(o[0].firstPoint, o.at(-1).lastPoint)).map((o) => new O(o));
6262
6264
  }
6263
6265
  }
6264
6266
  const _t = (t, n) => {
6265
6267
  if (t.length === 0) return [n];
6266
6268
  const e = t.at(-1);
6267
- return Y$2(e.lastPoint, n.firstPoint) ? t.slice(0, -1).concat([e.extend(n)]) : Y$2(e.lastPoint, n.lastPoint) ? t.slice(0, -1).concat([e.extend(n.reverse())]) : t.concat([n]);
6268
- }, se = (t, n) => t.length === 0 ? [n] : Y$2(t[0].firstPoint, n.lastPoint) ? [n.extend(t[0])].concat(t.slice(1)) : [n].concat(t);
6269
- function ht$1(t, n, {
6269
+ return Y$1(e.lastPoint, n.firstPoint) ? t.slice(0, -1).concat([e.extend(n)]) : Y$1(e.lastPoint, n.lastPoint) ? t.slice(0, -1).concat([e.extend(n.reverse())]) : t.concat([n]);
6270
+ }, se = (t, n) => t.length === 0 ? [n] : Y$1(t[0].firstPoint, n.lastPoint) ? [n.extend(t[0])].concat(t.slice(1)) : [n].concat(t);
6271
+ function ht(t, n, {
6270
6272
  firstInside: e,
6271
6273
  secondInside: s
6272
6274
  }) {
@@ -6298,19 +6300,19 @@ function ht$1(t, n, {
6298
6300
  return ee(l);
6299
6301
  }
6300
6302
  const ie = (t, n) => {
6301
- const e = ht$1(t, n, {
6303
+ const e = ht(t, n, {
6302
6304
  firstInside: "remove",
6303
6305
  secondInside: "remove"
6304
6306
  });
6305
6307
  return Array.isArray(e) ? e : e.identical ? [t] : e.firstCurveInSecond ? [n] : e.secondCurveInFirst ? [t] : [t, n];
6306
6308
  }, Z = (t, n) => {
6307
- const e = ht$1(t, n, {
6309
+ const e = ht(t, n, {
6308
6310
  firstInside: "remove",
6309
6311
  secondInside: "keep"
6310
6312
  });
6311
6313
  return Array.isArray(e) ? e : e.identical ? [] : e.firstCurveInSecond ? [] : e.secondCurveInFirst ? [t, n] : [t];
6312
- }, pt$1 = (t, n) => {
6313
- const e = ht$1(t, n, {
6314
+ }, pt = (t, n) => {
6315
+ const e = ht(t, n, {
6314
6316
  firstInside: "keep",
6315
6317
  secondInside: "keep"
6316
6318
  });
@@ -6328,13 +6330,13 @@ function oe(t) {
6328
6330
  (d) => f.some((m) => d.intersects(m))
6329
6331
  )) return;
6330
6332
  let p;
6331
- c.length > 1 || f.length > 1 ? p = G$1(c, f) : p = Gt(c[0], f[0]), o.fusedWith.add(a), o.current = p, u || n.set(a, o);
6333
+ c.length > 1 || f.length > 1 ? p = G(c, f) : p = Gt(c[0], f[0]), o.fusedWith.add(a), o.current = p, u || n.set(a, o);
6332
6334
  });
6333
6335
  }), e.flatMap(({ current: s }) => s);
6334
6336
  }
6335
6337
  function Gt(t, n) {
6336
6338
  const e = ie(t.contour, n.contour), s = n.holes.flatMap((r) => Z(r, t.contour)), i = t.holes.flatMap((r) => Z(r, n.contour)), o = Kn(t.holes, n.holes).flatMap(
6337
- ([r, l]) => pt$1(r, l)
6339
+ ([r, l]) => pt(r, l)
6338
6340
  );
6339
6341
  return X$1([
6340
6342
  ...e,
@@ -6348,13 +6350,13 @@ function tt$1(t, n) {
6348
6350
  return X$1(Z(t.contour, n.contour));
6349
6351
  if (t.isFull) {
6350
6352
  const s = Z(t.contour, n.contour), i = n.holes.flatMap(
6351
- (o) => pt$1(o, t.contour)
6353
+ (o) => pt(o, t.contour)
6352
6354
  );
6353
6355
  return X$1([...s, ...i]);
6354
6356
  } else if (n.isFull && !t.contour.intersects(n.contour))
6355
6357
  if (t.contour.contains(n.contour.firstPoint)) {
6356
- const s = G$1(
6357
- t.holes.map((i) => new v$2(i)),
6358
+ const s = G(
6359
+ t.holes.map((i) => new v$1(i)),
6358
6360
  [n]
6359
6361
  );
6360
6362
  return X$1([
@@ -6363,52 +6365,52 @@ function tt$1(t, n) {
6363
6365
  ]);
6364
6366
  } else
6365
6367
  return [t];
6366
- let e = tt$1(new v$2(t.contour), n);
6368
+ let e = tt$1(new v$1(t.contour), n);
6367
6369
  return t.holes.forEach((s) => {
6368
- e = e.flatMap((i) => tt$1(i, new v$2(s)));
6370
+ e = e.flatMap((i) => tt$1(i, new v$1(s)));
6369
6371
  }), e;
6370
6372
  }
6371
6373
  function re(t, n) {
6372
- const e = pt$1(t.contour, n.contour);
6374
+ const e = pt(t.contour, n.contour);
6373
6375
  if (!e.length) return [];
6374
6376
  let s = X$1(e);
6375
- return s = Q(
6377
+ return s = Q$1(
6376
6378
  s,
6377
- t.holes.map((i) => new v$2(i))
6378
- ), Q(
6379
+ t.holes.map((i) => new v$1(i))
6380
+ ), Q$1(
6379
6381
  s,
6380
- n.holes.map((i) => new v$2(i))
6382
+ n.holes.map((i) => new v$1(i))
6381
6383
  );
6382
6384
  }
6383
- function G$1(t, n) {
6385
+ function G(t, n) {
6384
6386
  if (!t.length) return n;
6385
6387
  if (!n.length) return t;
6386
6388
  if (t.length === 1 && n.length > 1 || n.length === 1 && t.length > 1)
6387
6389
  return oe([...t, ...n]);
6388
6390
  if (t.length > 1 && n.length > 1) {
6389
- let e = G$1([t[0]], n);
6391
+ let e = G([t[0]], n);
6390
6392
  return t.slice(1).forEach((s) => {
6391
- e = G$1([s], e);
6393
+ e = G([s], e);
6392
6394
  }), e;
6393
6395
  }
6394
6396
  return t.length === 1 && n.length === 1 ? Gt(t[0], n[0]) : [];
6395
6397
  }
6396
- function Q(t, n) {
6398
+ function Q$1(t, n) {
6397
6399
  if (!t.length) return [];
6398
6400
  if (!n.length) return t;
6399
6401
  if (t.length === 1 && n.length === 1)
6400
6402
  return tt$1(t[0], n[0]);
6401
6403
  if (t.length > 1)
6402
- return t.flatMap((s) => Q([s], n));
6404
+ return t.flatMap((s) => Q$1([s], n));
6403
6405
  let e = tt$1(t[0], n[0]);
6404
6406
  return n.slice(1).forEach((s) => {
6405
- e = Q(e, [s]);
6407
+ e = Q$1(e, [s]);
6406
6408
  }), e;
6407
6409
  }
6408
- function rt$1(t, n) {
6409
- return !t.length || !n.length ? [] : t.length === 1 && n.length === 1 ? re(t[0], n[0]) : t.length > 1 ? t.flatMap((e) => rt$1([e], n)) : n.flatMap((e) => rt$1(t, [e]));
6410
+ function rt$2(t, n) {
6411
+ return !t.length || !n.length ? [] : t.length === 1 && n.length === 1 ? re(t[0], n[0]) : t.length > 1 ? t.flatMap((e) => rt$2([e], n)) : n.flatMap((e) => rt$2(t, [e]));
6410
6412
  }
6411
- let _$1 = class _ extends Ze {
6413
+ let _$2 = class _ extends Ze {
6412
6414
  constructor(e = [], { ignoreChecks: s = !1 } = {}) {
6413
6415
  super();
6414
6416
  C(this, "figures");
@@ -6448,13 +6450,13 @@ let _$1 = class _ extends Ze {
6448
6450
  ) : s.overlappingStrands(e));
6449
6451
  }
6450
6452
  fuse(e) {
6451
- return new _(G$1(this.figures, e.figures));
6453
+ return new _(G(this.figures, e.figures));
6452
6454
  }
6453
6455
  cut(e) {
6454
- return new _(Q(this.figures, e.figures));
6456
+ return new _(Q$1(this.figures, e.figures));
6455
6457
  }
6456
6458
  intersect(e) {
6457
- return new _(rt$1(this.figures, e.figures));
6459
+ return new _(rt$2(this.figures, e.figures));
6458
6460
  }
6459
6461
  };
6460
6462
  function le(t) {
@@ -6466,11 +6468,11 @@ function le(t) {
6466
6468
  var W$1 = Object.defineProperty;
6467
6469
  var q$1 = (e, t, n) => t in e ? W$1(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
6468
6470
  var m = (e, t, n) => q$1(e, typeof t != "symbol" ? t + "" : t, n);
6469
- const B = (e, t, n) => {
6470
- const r = St$1(e.V, t.V), i = e.precision * t.precision;
6471
+ const B$1 = (e, t, n) => {
6472
+ const r = St$2(e.V, t.V), i = e.precision * t.precision;
6471
6473
  if (r * r < i)
6472
6474
  return "parallel";
6473
- const s = Q$1(t.firstPoint, e.firstPoint), o = St$1(s, t.V) / r;
6475
+ const s = Q$2(t.firstPoint, e.firstPoint), o = St$2(s, t.V) / r;
6474
6476
  return it$3(e.firstPoint, nt$2(e.V, o));
6475
6477
  };
6476
6478
  class S {
@@ -6479,22 +6481,22 @@ class S {
6479
6481
  }
6480
6482
  }
6481
6483
  function y(e, t) {
6482
- if (e instanceof at$1)
6484
+ if (e instanceof at$2)
6483
6485
  return et$1(e, t);
6484
- if (e instanceof ct$1)
6485
- return rt(e, t);
6486
+ if (e instanceof ct$2)
6487
+ return rt$1(e, t);
6486
6488
  if (e instanceof _t$1 || e instanceof Et$1)
6487
6489
  return it$1(e, t);
6488
6490
  throw new Error("Not implemented");
6489
6491
  }
6490
6492
  function et$1(e, t) {
6491
6493
  const { firstPoint: n, lastPoint: r } = e, i = e.normalVector;
6492
- return new at$1(
6494
+ return new at$2(
6493
6495
  it$3(n, nt$2(i, t)),
6494
6496
  it$3(r, nt$2(i, t))
6495
6497
  );
6496
6498
  }
6497
- function rt(e, t) {
6499
+ function rt$1(e, t) {
6498
6500
  const n = it$3(
6499
6501
  e.firstPoint,
6500
6502
  nt$2(tt$2(e.tangentAtFirstPoint), t)
@@ -6502,17 +6504,17 @@ function rt(e, t) {
6502
6504
  e.lastPoint,
6503
6505
  nt$2(tt$2(e.tangentAtLastPoint), t)
6504
6506
  ), i = t * (e.clockwise ? 1 : -1);
6505
- return e.radius + i < e.precision ? new S(n, r) : new ct$1(n, r, e.center, e.clockwise);
6507
+ return e.radius + i < e.precision ? new S(n, r) : new ct$2(n, r, e.center, e.clockwise);
6506
6508
  }
6507
6509
  function b(e, t, n, r, i) {
6508
- const s = B(
6510
+ const s = B$1(
6509
6511
  {
6510
6512
  V: n,
6511
6513
  firstPoint: r,
6512
6514
  precision: i
6513
6515
  },
6514
6516
  {
6515
- V: Q$1(t, e),
6517
+ V: Q$2(t, e),
6516
6518
  firstPoint: e,
6517
6519
  precision: i
6518
6520
  }
@@ -6524,7 +6526,7 @@ function b(e, t, n, r, i) {
6524
6526
  return s;
6525
6527
  }
6526
6528
  function it$1(e, t) {
6527
- const { firstPoint: n, lastPoint: r, normalAtFirstPoint: i, normalAtLastPoint: s } = e, o = B(
6529
+ const { firstPoint: n, lastPoint: r, normalAtFirstPoint: i, normalAtLastPoint: s } = e, o = B$1(
6528
6530
  { V: i, firstPoint: n, precision: e.precision },
6529
6531
  { V: s, firstPoint: r, precision: e.precision }
6530
6532
  ), a = it$3(
@@ -6536,9 +6538,9 @@ function it$1(e, t) {
6536
6538
  );
6537
6539
  if (o === "parallel")
6538
6540
  throw new Error("Parallel lines not expected in safe bezier offset");
6539
- if (Pe(Q$1(o, n), i) * t > 0 && Math.min(
6540
- J$1(n, o),
6541
- J$1(r, o)
6541
+ if (Pe(Q$2(o, n), i) * t > 0 && Math.min(
6542
+ J$2(n, o),
6543
+ J$2(r, o)
6542
6544
  ) < t)
6543
6545
  return new S(a, h);
6544
6546
  if (e instanceof _t$1) {
@@ -6576,7 +6578,7 @@ function it$1(e, t) {
6576
6578
  );
6577
6579
  }
6578
6580
  function M(e, t, n) {
6579
- const r = St$1(
6581
+ const r = St$2(
6580
6582
  e.tangentAtLastPoint,
6581
6583
  t.tangentAtFirstPoint
6582
6584
  );
@@ -6598,7 +6600,7 @@ function M(e, t, n) {
6598
6600
  }, [f] = p(e, o), [, g] = p(t, a);
6599
6601
  return { first: f, second: g, center: c };
6600
6602
  }
6601
- function V$1(e, t, n) {
6603
+ function V(e, t, n) {
6602
6604
  const r = M(e, t, n);
6603
6605
  if (!r)
6604
6606
  return console.warn(
@@ -6609,11 +6611,11 @@ function V$1(e, t, n) {
6609
6611
  const { first: i, second: s } = r;
6610
6612
  return [
6611
6613
  i,
6612
- mn$1(i.lastPoint, s.firstPoint, i.tangentAtLastPoint),
6614
+ mn$2(i.lastPoint, s.firstPoint, i.tangentAtLastPoint),
6613
6615
  s
6614
6616
  ];
6615
6617
  }
6616
- function _(e, t, n) {
6618
+ function _$1(e, t, n) {
6617
6619
  const r = M(e, t, n);
6618
6620
  if (!r)
6619
6621
  return console.warn(
@@ -6622,7 +6624,7 @@ function _(e, t, n) {
6622
6624
  t.repr
6623
6625
  ), [e, t];
6624
6626
  const { first: i, second: s } = r;
6625
- return [i, new at$1(i.lastPoint, s.firstPoint), s];
6627
+ return [i, new at$2(i.lastPoint, s.firstPoint), s];
6626
6628
  }
6627
6629
  const st$1 = (e) => {
6628
6630
  let t;
@@ -6638,10 +6640,10 @@ const st$1 = (e) => {
6638
6640
  let a;
6639
6641
  return typeof s == "number" ? a = Tt(1, s * fe) : a = s, { endTangent: o, startFactor: r, endFactor: i, startTangent: a };
6640
6642
  };
6641
- function z(e, { ignoreChecks: t = !1 } = {}) {
6642
- return new _$1([new v$2(new O$1([...e], { ignoreChecks: t }))]);
6643
+ function z$1(e, { ignoreChecks: t = !1 } = {}) {
6644
+ return new _$2([new v$1(new O([...e], { ignoreChecks: t }))]);
6643
6645
  }
6644
- class ot {
6646
+ let ot$1 = class ot {
6645
6647
  constructor(t = [0, 0]) {
6646
6648
  m(this, "pointer");
6647
6649
  m(this, "firstPoint");
@@ -6657,19 +6659,19 @@ class ot {
6657
6659
  return this.pointer = t, this.firstPoint = t, this;
6658
6660
  }
6659
6661
  saveSegment(t) {
6660
- if (Y$2(t.firstPoint, t.lastPoint))
6662
+ if (Y$1(t.firstPoint, t.lastPoint))
6661
6663
  throw new Error(`Segment has no length, ${t.repr}`);
6662
6664
  if (!this._nextCorner)
6663
6665
  return this.pendingSegments.push(t), this;
6664
6666
  const n = this.pendingSegments.pop();
6665
6667
  if (!n) throw new Error("bug in the custom corner algorithm");
6666
- const r = this._nextCorner.mode === "chamfer" ? _ : V$1;
6668
+ const r = this._nextCorner.mode === "chamfer" ? _$1 : V;
6667
6669
  return this.pendingSegments.push(
6668
6670
  ...r(n, t, this._nextCorner.radius)
6669
6671
  ), this._nextCorner = null, this;
6670
6672
  }
6671
6673
  lineTo(t) {
6672
- const n = new at$1(this.pointer, t);
6674
+ const n = new at$2(this.pointer, t);
6673
6675
  return this.pointer = t, this.saveSegment(n);
6674
6676
  }
6675
6677
  line(t, n) {
@@ -6714,7 +6716,7 @@ class ot {
6714
6716
  }
6715
6717
  sagittaArcTo(t, n) {
6716
6718
  if (!n) return this.lineTo(t);
6717
- const r = new at$1(this.pointer, t), i = tt$2(r.tangentAtFirstPoint), s = it$3(r.midPoint, nt$2(i, n));
6719
+ const r = new at$2(this.pointer, t), i = tt$2(r.tangentAtFirstPoint), s = it$3(r.midPoint, nt$2(i, n));
6718
6720
  return this.threePointsArcTo(t, s);
6719
6721
  }
6720
6722
  sagittaArc(t, n, r) {
@@ -6731,7 +6733,7 @@ class ot {
6731
6733
  }
6732
6734
  bulgeArcTo(t, n) {
6733
6735
  if (!n) return this.lineTo(t);
6734
- const r = J$1(this.pointer, t) / 2, i = -n * r;
6736
+ const r = J$2(this.pointer, t) / 2, i = -n * r;
6735
6737
  return this.sagittaArcTo(t, i);
6736
6738
  }
6737
6739
  bulgeArc(t, n, r) {
@@ -6751,7 +6753,7 @@ class ot {
6751
6753
  if (!r)
6752
6754
  throw new Error("You need a previous curve to sketch a tangent arc");
6753
6755
  return this.saveSegment(
6754
- mn$1(
6756
+ mn$2(
6755
6757
  this.pointer,
6756
6758
  t,
6757
6759
  n ?? r.tangentAtLastPoint
@@ -6764,7 +6766,7 @@ class ot {
6764
6766
  }
6765
6767
  ellipseTo(t, n, r, i, s, o) {
6766
6768
  return this.saveSegment(
6767
- pn$1(this.pointer, t, n, r, i, s, o)
6769
+ pn$2(this.pointer, t, n, r, i, s, o)
6768
6770
  ), this.pointer = t, this;
6769
6771
  }
6770
6772
  ellipse(t, n, r, i, s, o, a) {
@@ -6778,7 +6780,7 @@ class ot {
6778
6780
  );
6779
6781
  }
6780
6782
  halfEllipseTo(t, n) {
6781
- const [r, i] = We(Q$1(t, this.pointer));
6783
+ const [r, i] = We(Q$2(t, this.pointer));
6782
6784
  return this.ellipseTo(
6783
6785
  t,
6784
6786
  r / 2,
@@ -6803,7 +6805,7 @@ class ot {
6803
6805
  return this.saveSegment(new _t$1(this.pointer, t, n)), this.pointer = t, this;
6804
6806
  }
6805
6807
  smoothCurveTo(t, n) {
6806
- const { endTangent: r, startTangent: i, startFactor: s, endFactor: o } = st$1(n), a = this.pendingSegments.length ? this.pendingSegments[this.pendingSegments.length - 1] : null, h = J$1(this.pointer, t) / 3;
6808
+ const { endTangent: r, startTangent: i, startFactor: s, endFactor: o } = st$1(n), a = this.pendingSegments.length ? this.pendingSegments[this.pendingSegments.length - 1] : null, h = J$2(this.pointer, t) / 3;
6807
6809
  let c;
6808
6810
  i ? c = i : a ? c = a.tangentAtLastPoint : c = [1, 0], c = H$1(c);
6809
6811
  const p = [
@@ -6834,20 +6836,20 @@ class ot {
6834
6836
  const r = this.pendingSegments.pop(), i = this.pendingSegments.shift();
6835
6837
  if (!r || !i)
6836
6838
  throw new Error("Not enough curves to close and fillet");
6837
- const s = n === "chamfer" ? _ : V$1;
6839
+ const s = n === "chamfer" ? _$1 : V;
6838
6840
  this.pendingSegments.push(...s(r, i, t));
6839
6841
  }
6840
6842
  close(t = !1) {
6841
6843
  if (!this.pendingSegments.length) throw new Error("No segments to close");
6842
6844
  const n = this.pendingSegments[0], r = this.pendingSegments.at(-1);
6843
- return Y$2(n.firstPoint, r.lastPoint) || this.lineTo(n.firstPoint), this._nextCorner !== null && (this._customCornerLastWithFirst(
6845
+ return Y$1(n.firstPoint, r.lastPoint) || this.lineTo(n.firstPoint), this._nextCorner !== null && (this._customCornerLastWithFirst(
6844
6846
  this._nextCorner.radius,
6845
6847
  this._nextCorner.mode
6846
- ), this._nextCorner = null), z(this.pendingSegments, { ignoreChecks: t });
6848
+ ), this._nextCorner = null), z$1(this.pendingSegments, { ignoreChecks: t });
6847
6849
  }
6848
6850
  closeWithMirror(t = !1) {
6849
6851
  if (!this.pendingSegments.length) throw new Error("No segments to close");
6850
- const n = this.pendingSegments[0], r = this.pendingSegments.at(-1), i = Q$1(
6852
+ const n = this.pendingSegments[0], r = this.pendingSegments.at(-1), i = Q$2(
6851
6853
  r.lastPoint,
6852
6854
  n.firstPoint
6853
6855
  ), s = new et$3().mirrorLine(
@@ -6856,32 +6858,32 @@ class ot {
6856
6858
  ), o = this.pendingSegments.map(
6857
6859
  (a) => a.transform(s).reverse()
6858
6860
  );
6859
- return o.reverse(), z(
6861
+ return o.reverse(), z$1(
6860
6862
  [...this.pendingSegments, ...o],
6861
6863
  { ignoreChecks: t }
6862
6864
  );
6863
6865
  }
6864
6866
  asStrand() {
6865
- return new B$1([...this.pendingSegments]);
6867
+ return new B$2([...this.pendingSegments]);
6866
6868
  }
6867
6869
  get isClosed() {
6868
6870
  var t;
6869
- return Y$2(this.pointer, (t = this.pendingSegments[0]) == null ? void 0 : t.firstPoint);
6871
+ return Y$1(this.pointer, (t = this.pendingSegments[0]) == null ? void 0 : t.firstPoint);
6870
6872
  }
6871
- }
6872
- function lt$1(e = [0, 0]) {
6873
- return new ot(e);
6873
+ };
6874
+ function lt(e = [0, 0]) {
6875
+ return new ot$1(e);
6874
6876
  }
6875
6877
 
6876
- function R(e) {
6877
- return lt$1([-e, 0]).sagittaArc(2 * e, 0, e).sagittaArc(-2 * e, 0, e).close();
6878
+ function R$1(e) {
6879
+ return lt([-e, 0]).sagittaArc(2 * e, 0, e).sagittaArc(-2 * e, 0, e).close();
6878
6880
  }
6879
6881
  function x$1(e, a, f = 0) {
6880
6882
  const { rx: m = 0, ry: p = 0 } = typeof f == "number" ? { ry: f, rx: f } : f;
6881
6883
  let n = Math.min(m ?? f ?? 0, e / 2), t = Math.min(p ?? f ?? 0, a / 2);
6882
6884
  const r = n && t;
6883
6885
  r || (n = 0, t = 0);
6884
- const u = n === t, c = lt$1([Math.min(0, -(e / 2 - n)), -a / 2]), o = (i, l) => {
6886
+ const u = n === t, c = lt([Math.min(0, -(e / 2 - n)), -a / 2]), o = (i, l) => {
6885
6887
  r && (u ? c.tangentArc(i, l) : c.ellipse(i, l, n, t, 0, !1, !1));
6886
6888
  };
6887
6889
  return n < e / 2 && c.hLine(e - 2 * n), o(n, t), t < a / 2 && c.vLine(a - 2 * t), o(-n, t), n < e / 2 && c.hLine(-(e - 2 * n)), o(-n, -t), t < a / 2 && c.vLine(-(a - 2 * t)), o(n, -t), c.close();
@@ -6889,7 +6891,7 @@ function x$1(e, a, f = 0) {
6889
6891
 
6890
6892
  var drawShape = /*#__PURE__*/Object.freeze({
6891
6893
  __proto__: null,
6892
- drawCircle: R,
6894
+ drawCircle: R$1,
6893
6895
  drawRect: x$1
6894
6896
  });
6895
6897
 
@@ -6897,11 +6899,11 @@ function i([t, n]) {
6897
6899
  return `${t} ${n}`;
6898
6900
  }
6899
6901
  function s(t) {
6900
- if (t instanceof at$1)
6902
+ if (t instanceof at$2)
6901
6903
  return `L ${i(t.lastPoint)}`;
6902
- if (t instanceof ct$1)
6904
+ if (t instanceof ct$2)
6903
6905
  return `A ${t.radius} ${t.radius} 0 ${t.angularLength > Math.PI ? "1" : "0"} ${t.clockwise ? "0" : "1"} ${i(t.lastPoint)}`;
6904
- if (t instanceof jt$2)
6906
+ if (t instanceof jt$1)
6905
6907
  return `A ${t.majorRadius} ${t.minorRadius} ${t.tiltAngle * Ue} ${t.deltaAngle > Math.PI ? "1" : "0"} ${t.clockwise ? "0" : "1"} ${i(t.lastPoint)}`;
6906
6908
  if (t instanceof _t$1)
6907
6909
  return `Q ${[
@@ -6933,49 +6935,49 @@ function j$1(t) {
6933
6935
  const n = `M ${t.firstPoint.join(" ")}`, o = t.segments.map(s).join(" ");
6934
6936
  return `${n} ${o}`;
6935
6937
  }
6936
- function v$1(t, n = 1) {
6938
+ function v(t, n = 1) {
6937
6939
  const o = t.xMin - n, r = t.yMin - n;
6938
6940
  return `${o} ${r} ${t.width + 2 * n} ${t.height + 2 * n}`;
6939
6941
  }
6940
6942
  function A(t, n, o = 1, r) {
6941
- const a = v$1(n, o), c = r ? `width="${n.width + 2 * o}${r}" height="${n.height + 2 * o}${r}"` : "";
6943
+ const a = v(n, o), c = r ? `width="${n.width + 2 * o}${r}" height="${n.height + 2 * o}${r}"` : "";
6942
6944
  return `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
6943
- <svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="${a}" fill="none" stroke="black" stroke-width="0.2%" vector-effect="non-scaling-stroke" ${c}>
6945
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="${a}" fill="none" stroke="grey" stroke-width="0.2%" vector-effect="non-scaling-stroke" ${c}>
6944
6946
  ${t}
6945
6947
  </svg>`;
6946
6948
  }
6947
6949
 
6948
- var bt = Object.defineProperty;
6949
- var Lt = (t, n, e) => n in t ? bt(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
6950
- var P = (t, n, e) => Lt(t, typeof n != "symbol" ? n + "" : n, e);
6951
- function v(t) {
6952
- if (t instanceof v$2)
6953
- return [t];
6954
- if (t instanceof O$1)
6955
- return [new v$2(t)];
6956
- if (t instanceof _$1)
6957
- return t.figures;
6950
+ var yt = Object.defineProperty;
6951
+ var Ct = (n, t, e) => t in n ? yt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
6952
+ var P = (n, t, e) => Ct(n, typeof t != "symbol" ? t + "" : t, e);
6953
+ function L(n) {
6954
+ if (n instanceof v$1)
6955
+ return [n];
6956
+ if (n instanceof O)
6957
+ return [new v$1(n)];
6958
+ if (n instanceof _$2)
6959
+ return n.figures;
6958
6960
  throw new Error("Unknown shape");
6959
6961
  }
6960
- function lt(t, n, e = 1e-9) {
6962
+ function mt(n, t, e = 1e-9) {
6961
6963
  let s = [];
6962
- const r = [], i = new Array(n.segments.length).fill(0).map(() => []);
6963
- n.segments.forEach((f, c) => {
6964
- t.segments.forEach((a) => {
6964
+ const r = [], i = new Array(t.segments.length).fill(0).map(() => []);
6965
+ t.segments.forEach((a, f) => {
6966
+ n.segments.forEach((c) => {
6965
6967
  const { intersections: l, overlaps: p } = K$1(
6966
- f,
6967
6968
  a,
6969
+ c,
6968
6970
  e
6969
6971
  );
6970
- s.push(...l), i[c].push(...l), r.push(...p);
6971
- const h = p.flatMap((d) => [
6972
+ s.push(...l), i[f].push(...l), r.push(...p);
6973
+ const g = p.flatMap((d) => [
6972
6974
  d.firstPoint,
6973
6975
  d.lastPoint
6974
6976
  ]);
6975
- s.push(...h), i[c].push(...h);
6977
+ s.push(...g), i[f].push(...g);
6976
6978
  });
6977
6979
  }), s = Te(s, e);
6978
- const o = Kt$1([n.segments, i]).flatMap(([f, c]) => c.length ? f.splitAt(c) : [f]);
6980
+ const o = Kt([t.segments, i]).flatMap(([a, f]) => f.length ? a.splitAt(f) : [a]);
6979
6981
  return Array.from(
6980
6982
  Ft(
6981
6983
  o,
@@ -6984,167 +6986,167 @@ function lt(t, n, e = 1e-9) {
6984
6986
  )
6985
6987
  );
6986
6988
  }
6987
- function V(t, n, e = !1) {
6988
- return lt(n, t).filter((r) => {
6989
+ function J(n, t, e = !1) {
6990
+ return mt(t, n).filter((r) => {
6989
6991
  const i = r.segments[0].midPoint;
6990
- return n.onStroke(i) ? !e : !n.contains(i);
6992
+ return t.onStroke(i) ? !e : !t.contains(i);
6991
6993
  });
6992
6994
  }
6993
- function q(t, n, e = !1) {
6994
- return lt(n, t).filter((r) => {
6995
+ function Q(n, t, e = !1) {
6996
+ return mt(t, n).filter((r) => {
6995
6997
  const i = r.segments[0].midPoint;
6996
- return n.onStroke(i) ? !e : n.contains(i);
6998
+ return t.onStroke(i) ? !e : t.contains(i);
6997
6999
  });
6998
7000
  }
6999
- function H(t, n, e = !1) {
7000
- const s = V(
7001
- t,
7002
- n.contour,
7001
+ function W(n, t, e = !1) {
7002
+ const s = J(
7003
+ n,
7004
+ t.contour,
7003
7005
  e
7004
- ), r = n.holes.flatMap(
7005
- (i) => q(t, i, e)
7006
+ ), r = t.holes.flatMap(
7007
+ (i) => Q(n, i, e)
7006
7008
  );
7007
7009
  return [...s, ...r];
7008
7010
  }
7009
- function W(t, n, e = !1) {
7010
- let s = q(
7011
- t,
7012
- n.contour,
7011
+ function j(n, t, e = !1) {
7012
+ let s = Q(
7013
+ n,
7014
+ t.contour,
7013
7015
  e
7014
7016
  );
7015
- return n.holes.forEach((r) => {
7017
+ return t.holes.forEach((r) => {
7016
7018
  s = s.flatMap(
7017
- (i) => V(i, r, e)
7019
+ (i) => J(i, r, e)
7018
7020
  );
7019
7021
  }), s;
7020
7022
  }
7021
- function Wt(t, n) {
7022
- return new _$1(
7023
- G$1(v(t), v(n))
7023
+ function sn(n, t) {
7024
+ return new _$2(
7025
+ G(L(n), L(t))
7024
7026
  );
7025
7027
  }
7026
- function D(t) {
7027
- return t.reduce(
7028
- (n, e) => Wt(n, e),
7029
- new _$1()
7028
+ function z(n) {
7029
+ return n.reduce(
7030
+ (t, e) => sn(t, e),
7031
+ new _$2()
7030
7032
  );
7031
7033
  }
7032
- function ut(t, n) {
7033
- return new _$1(
7034
- Q(v(t), v(n))
7034
+ function Pt(n, t) {
7035
+ return new _$2(
7036
+ Q$1(L(n), L(t))
7035
7037
  );
7036
7038
  }
7037
- function Mn(t, n) {
7038
- return new _$1(
7039
- rt$1(v(t), v(n))
7039
+ function yn(n, t) {
7040
+ return new _$2(
7041
+ rt$2(L(n), L(t))
7040
7042
  );
7041
7043
  }
7042
- function In(t, n, e = !0) {
7043
- if (n instanceof O$1)
7044
- return V(t, n, e);
7045
- if (n instanceof v$2)
7046
- return H(t, n, e);
7047
- let s = [new B$1([...t.segments])];
7048
- return n.figures.forEach((r) => {
7049
- s = s.flatMap((i) => H(i, r, e));
7044
+ function Cn(n, t, e = !0) {
7045
+ if (t instanceof O)
7046
+ return J(n, t, e);
7047
+ if (t instanceof v$1)
7048
+ return W(n, t, e);
7049
+ let s = [new B$2([...n.segments])];
7050
+ return t.figures.forEach((r) => {
7051
+ s = s.flatMap((i) => W(i, r, e));
7050
7052
  }), s;
7051
7053
  }
7052
- function Sn(t, n, e = !1) {
7053
- if (n instanceof O$1)
7054
- return q(t, n, e);
7055
- if (n instanceof v$2)
7056
- return W(t, n, e);
7057
- let s = [new B$1([...t.segments])];
7058
- return n.figures.forEach((r) => {
7059
- s = s.flatMap((i) => W(i, r, e));
7054
+ function xn(n, t, e = !1) {
7055
+ if (t instanceof O)
7056
+ return Q(n, t, e);
7057
+ if (t instanceof v$1)
7058
+ return j(n, t, e);
7059
+ let s = [new B$2([...n.segments])];
7060
+ return t.figures.forEach((r) => {
7061
+ s = s.flatMap((i) => j(i, r, e));
7060
7062
  }), s;
7061
7063
  }
7062
- function X(t) {
7063
- return t < 0 ? "before" : t > 1 ? "after" : "between";
7064
+ function tt(n) {
7065
+ return n < 0 ? "before" : n > 1 ? "after" : "between";
7064
7066
  }
7065
- const Y = (t, n, e) => {
7067
+ const nt = (n, t, e) => {
7066
7068
  if (e === "before")
7067
- return t.distanceFrom(n.firstPoint);
7069
+ return n.distanceFrom(t.firstPoint);
7068
7070
  if (e === "after")
7069
- return t.distanceFrom(n.lastPoint);
7071
+ return n.distanceFrom(t.lastPoint);
7070
7072
  throw new Error("Invalid position");
7071
7073
  };
7072
- function Xt(t, n) {
7073
- const e = me(t, n);
7074
+ function rn(n, t) {
7075
+ const e = me(n, t);
7074
7076
  if (e === "parallel")
7075
7077
  return Math.min(
7076
- t.distanceFrom(n.firstPoint),
7077
- t.distanceFrom(n.lastPoint)
7078
+ n.distanceFrom(t.firstPoint),
7079
+ n.distanceFrom(t.lastPoint)
7078
7080
  );
7079
- const { intersectionParam1: s, intersectionParam2: r } = e, i = X(s), o = X(r);
7081
+ const { intersectionParam1: s, intersectionParam2: r } = e, i = tt(s), o = tt(r);
7080
7082
  if (i === "between" && o === "between")
7081
7083
  return 0;
7082
7084
  if (i === "between" && o !== "between")
7083
- return Y(t, n, o);
7085
+ return nt(n, t, o);
7084
7086
  if (o === "between" && i !== "between")
7085
- return Y(n, t, i);
7087
+ return nt(t, n, i);
7086
7088
  if (i === "before" && o === "before")
7087
- return J$1(t.firstPoint, n.firstPoint);
7089
+ return J$2(n.firstPoint, t.firstPoint);
7088
7090
  if (i === "after" && o === "after")
7089
- return J$1(t.lastPoint, n.lastPoint);
7091
+ return J$2(n.lastPoint, t.lastPoint);
7090
7092
  if (i === "before" && o === "after")
7091
- return J$1(t.firstPoint, n.lastPoint);
7093
+ return J$2(n.firstPoint, t.lastPoint);
7092
7094
  if (i === "after" && o === "before")
7093
- return J$1(t.lastPoint, n.firstPoint);
7095
+ return J$2(n.lastPoint, t.firstPoint);
7094
7096
  throw new Error("Invalid position");
7095
7097
  }
7096
- function K(t, n) {
7097
- if (J(t, n).length > 0)
7098
+ function et(n, t) {
7099
+ if (J$1(n, t).length > 0)
7098
7100
  return 0;
7099
- const e = pn(t, n.center);
7100
- if (t.isOnSegment(e)) {
7101
- const s = J$1(e, n.center);
7102
- if (Math.abs(s - n.radius) < t.precision && n.isOnSegment(e))
7101
+ const e = pn$1(n, t.center);
7102
+ if (n.isOnSegment(e)) {
7103
+ const s = J$2(e, t.center);
7104
+ if (Math.abs(s - t.radius) < n.precision && t.isOnSegment(e))
7103
7105
  return 0;
7104
- if (s - n.radius > t.precision) {
7106
+ if (s - t.radius > n.precision) {
7105
7107
  const r = H$1(
7106
- Q$1(e, n.center)
7108
+ Q$2(e, t.center)
7107
7109
  ), i = it$3(
7108
- n.center,
7109
- nt$2(r, n.radius)
7110
+ t.center,
7111
+ nt$2(r, t.radius)
7110
7112
  );
7111
- if (n.isOnSegment(i))
7112
- return J$1(i, e);
7113
+ if (t.isOnSegment(i))
7114
+ return J$2(i, e);
7113
7115
  }
7114
7116
  }
7115
7117
  return Math.min(
7116
- n.distanceFrom(t.firstPoint),
7117
- n.distanceFrom(t.lastPoint),
7118
7118
  t.distanceFrom(n.firstPoint),
7119
- t.distanceFrom(n.lastPoint)
7119
+ t.distanceFrom(n.lastPoint),
7120
+ n.distanceFrom(t.firstPoint),
7121
+ n.distanceFrom(t.lastPoint)
7120
7122
  );
7121
7123
  }
7122
- const Yt = (t, n) => {
7123
- const e = t.angleToParam(n.firstAngle);
7124
- if (t.isValidParameter(e)) return !0;
7125
- const s = t.angleToParam(n.lastAngle);
7126
- return !!t.isValidParameter(s);
7124
+ const on = (n, t) => {
7125
+ const e = n.angleToParam(t.firstAngle);
7126
+ if (n.isValidParameter(e)) return !0;
7127
+ const s = n.angleToParam(t.lastAngle);
7128
+ return !!n.isValidParameter(s);
7127
7129
  };
7128
- function Kt(t, n) {
7129
- if (qt(t, n, !0).length > 0) return 0;
7130
- const e = J$1(t.center, n.center);
7131
- if (e < t.precision && Yt(t, n))
7132
- return Math.abs(t.radius - n.radius);
7133
- const s = H$1(Q$1(n.center, t.center)), r = e - Math.abs(t.radius - n.radius) < t.precision;
7130
+ function an(n, t) {
7131
+ if (qt(n, t, !0).length > 0) return 0;
7132
+ const e = J$2(n.center, t.center);
7133
+ if (e < n.precision && on(n, t))
7134
+ return Math.abs(n.radius - t.radius);
7135
+ const s = H$1(Q$2(t.center, n.center)), r = e - Math.abs(n.radius - t.radius) < n.precision;
7134
7136
  let i = Ye(s);
7135
- r && n.radius > t.radius && (i += Math.PI);
7136
- const o = r ? i : i + Math.PI, f = t.angleToParam(i), c = n.angleToParam(o);
7137
- return t.isValidParameter(f) && n.isValidParameter(c) ? J$1(t.paramPoint(f), n.paramPoint(c)) : Math.min(
7138
- t.distanceFrom(n.firstPoint),
7139
- t.distanceFrom(n.lastPoint),
7137
+ r && t.radius > n.radius && (i += Math.PI);
7138
+ const o = r ? i : i + Math.PI, a = n.angleToParam(i), f = t.angleToParam(o);
7139
+ return n.isValidParameter(a) && t.isValidParameter(f) ? J$2(n.paramPoint(a), t.paramPoint(f)) : Math.min(
7140
7140
  n.distanceFrom(t.firstPoint),
7141
- n.distanceFrom(t.lastPoint)
7141
+ n.distanceFrom(t.lastPoint),
7142
+ t.distanceFrom(n.firstPoint),
7143
+ t.distanceFrom(n.lastPoint)
7142
7144
  );
7143
7145
  }
7144
- function jt(t, n, e) {
7145
- let s = 0, r = t.length - 1;
7146
+ function cn(n, t, e) {
7147
+ let s = 0, r = n.length - 1;
7146
7148
  for (; s <= r; ) {
7147
- const i = Math.floor((s + r) / 2), o = e(t[i], n);
7149
+ const i = Math.floor((s + r) / 2), o = e(n[i], t);
7148
7150
  if (o < 0)
7149
7151
  s = i + 1;
7150
7152
  else if (o > 0)
@@ -7154,486 +7156,681 @@ function jt(t, n, e) {
7154
7156
  }
7155
7157
  return -(s + 1);
7156
7158
  }
7157
- function tn(t, n, e) {
7158
- const s = jt(t, n, e);
7159
- s < 0 ? t.splice(-(s + 1), 0, n) : t.splice(s, 0, n);
7159
+ function fn(n, t, e) {
7160
+ const s = cn(n, t, e);
7161
+ s < 0 ? n.splice(-(s + 1), 0, t) : n.splice(s, 0, t);
7160
7162
  }
7161
- class nn {
7163
+ class ln {
7162
7164
  constructor() {
7163
7165
  P(this, "buckets");
7164
7166
  this.buckets = [];
7165
7167
  }
7166
- addInterval(n) {
7167
- const e = this.buckets[n.rectangle.diagonalBucketIndex];
7168
- e === void 0 ? this.buckets[n.rectangle.diagonalBucketIndex] = [n] : tn(e, n, (s, r) => s.value - r.value);
7168
+ addInterval(t) {
7169
+ const e = this.buckets[t.rectangle.diagonalBucketIndex];
7170
+ e === void 0 ? this.buckets[t.rectangle.diagonalBucketIndex] = [t] : fn(e, t, (s, r) => s.value - r.value);
7169
7171
  }
7170
- removeInterval(n) {
7171
- const e = this.buckets[n.rectangle.diagonalBucketIndex];
7172
+ removeInterval(t) {
7173
+ const e = this.buckets[t.rectangle.diagonalBucketIndex];
7172
7174
  if (e === void 0)
7173
7175
  throw new Error("Interval not found");
7174
7176
  e.shift();
7175
7177
  }
7176
7178
  getBottomRightHullIntervals() {
7177
- const n = [];
7179
+ const t = [];
7178
7180
  for (let e = this.buckets.length - 1; e >= 0; e--) {
7179
7181
  const s = this.buckets[e];
7180
7182
  if (!s === void 0) continue;
7181
7183
  const r = s[0];
7182
7184
  if (r !== void 0) {
7183
- if (!n.length) {
7184
- n.push(r);
7185
+ if (!t.length) {
7186
+ t.push(r);
7185
7187
  continue;
7186
7188
  }
7187
- for (; n.length && n[n.length - 1].value >= r.value; )
7188
- n.pop();
7189
- for (; n.length >= 2; ) {
7190
- const i = n[n.length - 1], o = n[n.length - 2], f = (r.value - o.value) / ((r.rectangle.diagonal - o.rectangle.diagonal) * 2);
7191
- if (o.value + (i.rectangle.diagonal - o.rectangle.diagonal) / 2 * f < i.value)
7192
- n.pop();
7189
+ for (; t.length && t[t.length - 1].value >= r.value; )
7190
+ t.pop();
7191
+ for (; t.length >= 2; ) {
7192
+ const i = t[t.length - 1], o = t[t.length - 2], a = (r.value - o.value) / ((r.rectangle.diagonal - o.rectangle.diagonal) * 2);
7193
+ if (o.value + (i.rectangle.diagonal - o.rectangle.diagonal) / 2 * a < i.value)
7194
+ t.pop();
7193
7195
  else
7194
7196
  break;
7195
7197
  }
7196
- n.push(r);
7198
+ t.push(r);
7197
7199
  }
7198
7200
  }
7199
- return n;
7201
+ return t;
7200
7202
  }
7201
7203
  }
7202
- class en {
7203
- constructor(n, e) {
7204
+ class un {
7205
+ constructor(t, e) {
7204
7206
  P(this, "diagonal");
7205
7207
  P(this, "diagonalBucketIndex");
7206
7208
  P(this, "xLength");
7207
7209
  P(this, "yLength");
7208
7210
  P(this, "index");
7209
- this.x = n, this.y = e, this.xLength = Math.pow(3, -n), this.yLength = Math.pow(3, -e), this.diagonal = Math.sqrt(
7211
+ this.x = t, this.y = e, this.xLength = Math.pow(3, -t), this.yLength = Math.pow(3, -e), this.diagonal = Math.sqrt(
7210
7212
  this.xLength * this.xLength + this.yLength * this.yLength
7211
- ), this.diagonalBucketIndex = n + e, this.index = `${n},${e}`;
7213
+ ), this.diagonalBucketIndex = t + e, this.index = `${t},${e}`;
7212
7214
  }
7213
7215
  }
7214
- class sn {
7215
- constructor(n, e = 1e-8, s = 1e3, r = 1e-6) {
7216
+ class hn {
7217
+ constructor(t, e = 1e-8, s = 1e3, r = 1e-6) {
7216
7218
  P(this, "rectangles");
7217
7219
  P(this, "buckets");
7218
7220
  P(this, "fMin");
7219
7221
  P(this, "argMin");
7220
7222
  P(this, "tol");
7221
- this.fcn = n, this.endTolerance = e, this.maxIterations = s, this.epsilon = r, this.fcn = n, this.epsilon = r, this.endTolerance = e, this.maxIterations = s, this.rectangles = /* @__PURE__ */ new Map(), this.buckets = new nn();
7222
- const i = [0.5, 0.5], o = this.rect(0, 0), f = this.fcn(i);
7223
- this.buckets.addInterval(new x(i, f, o)), this.fMin = f, this.argMin = i, this.tol = o.diagonal;
7223
+ this.fcn = t, this.endTolerance = e, this.maxIterations = s, this.epsilon = r, this.fcn = t, this.epsilon = r, this.endTolerance = e, this.maxIterations = s, this.rectangles = /* @__PURE__ */ new Map(), this.buckets = new ln();
7224
+ const i = [0.5, 0.5], o = this.rect(0, 0), a = this.fcn(i);
7225
+ this.buckets.addInterval(new D(i, a, o)), this.fMin = a, this.argMin = i, this.tol = o.diagonal;
7224
7226
  }
7225
- registerInterval(n) {
7226
- this.buckets.addInterval(n), n.value <= this.fMin && (this.fMin = n.value, this.argMin = n.center, this.tol = n.rectangle.diagonal);
7227
+ registerInterval(t) {
7228
+ this.buckets.addInterval(t), t.value <= this.fMin && (this.fMin = t.value, this.argMin = t.center, this.tol = t.rectangle.diagonal);
7227
7229
  }
7228
- rect(n, e) {
7229
- const s = `${n},${e}`;
7230
- return this.rectangles.has(s) || this.rectangles.set(s, new en(n, e)), this.rectangles.get(s);
7230
+ rect(t, e) {
7231
+ const s = `${t},${e}`;
7232
+ return this.rectangles.has(s) || this.rectangles.set(s, new un(t, e)), this.rectangles.get(s);
7231
7233
  }
7232
- splitInterval(n) {
7234
+ splitInterval(t) {
7233
7235
  let e, s, r;
7234
- const [i, o] = n.center;
7235
- return n.rectangle.x <= n.rectangle.y ? (e = this.rect(n.rectangle.x + 1, n.rectangle.y), s = [i - e.xLength, o], r = [i + e.xLength, o]) : (e = this.rect(n.rectangle.x, n.rectangle.y + 1), s = [i, o - e.yLength], r = [i, o + e.yLength]), [
7236
- new x(s, this.fcn(s), e),
7237
- new x(n.center, n.value, e),
7238
- new x(r, this.fcn(r), e)
7236
+ const [i, o] = t.center;
7237
+ return t.rectangle.x <= t.rectangle.y ? (e = this.rect(t.rectangle.x + 1, t.rectangle.y), s = [i - e.xLength, o], r = [i + e.xLength, o]) : (e = this.rect(t.rectangle.x, t.rectangle.y + 1), s = [i, o - e.yLength], r = [i, o + e.yLength]), [
7238
+ new D(s, this.fcn(s), e),
7239
+ new D(t.center, t.value, e),
7240
+ new D(r, this.fcn(r), e)
7239
7241
  ];
7240
7242
  }
7241
7243
  single_iteration() {
7242
- const n = this.buckets.getBottomRightHullIntervals();
7243
- for (; n.length >= 2; ) {
7244
- const e = n[0], s = n[1], r = (s.value - e.value) / ((s.rectangle.diagonal - e.rectangle.diagonal) / 2), i = e.value - r * s.value / 2;
7244
+ const t = this.buckets.getBottomRightHullIntervals();
7245
+ for (; t.length >= 2; ) {
7246
+ const e = t[0], s = t[1], r = (s.value - e.value) / ((s.rectangle.diagonal - e.rectangle.diagonal) / 2), i = e.value - r * s.value / 2;
7245
7247
  if ((this.fMin - i) / Math.abs(this.fMin) < this.epsilon)
7246
- n.shift();
7248
+ t.shift();
7247
7249
  else
7248
7250
  break;
7249
7251
  }
7250
- n.forEach((e) => {
7252
+ t.forEach((e) => {
7251
7253
  this.buckets.removeInterval(e);
7252
7254
  });
7253
- for (const e of n) {
7255
+ for (const e of t) {
7254
7256
  const [s, r, i] = this.splitInterval(e);
7255
7257
  this.registerInterval(s), this.registerInterval(r), this.registerInterval(i);
7256
7258
  }
7257
7259
  }
7258
7260
  run() {
7259
- let n = 0;
7260
- for (; this.tol > this.endTolerance / 2 && (this.single_iteration(), n++, !(n > this.maxIterations)); )
7261
+ let t = 0;
7262
+ for (; this.tol > this.endTolerance / 2 && (this.single_iteration(), t++, !(t > this.maxIterations)); )
7261
7263
  ;
7262
7264
  return {
7263
7265
  fMin: this.fMin,
7264
7266
  argMin: this.argMin,
7265
7267
  tol: this.tol,
7266
- iterations: n
7268
+ iterations: t
7267
7269
  };
7268
7270
  }
7269
7271
  }
7270
- class x {
7271
- constructor(n, e, s) {
7272
- this.center = n, this.value = e, this.rectangle = s;
7272
+ class D {
7273
+ constructor(t, e, s) {
7274
+ this.center = t, this.value = e, this.rectangle = s;
7273
7275
  }
7274
7276
  }
7275
- function rn(t, n = 1e-8, e = 1e3, s = 1e-6) {
7276
- return new sn(
7277
- t,
7277
+ function gn(n, t = 1e-8, e = 1e3, s = 1e-6) {
7278
+ return new hn(
7278
7279
  n,
7280
+ t,
7279
7281
  e,
7280
7282
  s
7281
7283
  ).run();
7282
7284
  }
7283
- function on(t, n, e = 1e-9) {
7284
- const s = rn((r) => {
7285
- const i = t.paramPoint(r[0]), o = n.paramPoint(r[1]);
7285
+ function pn(n, t, e = 1e-9) {
7286
+ const s = gn((r) => {
7287
+ const i = n.paramPoint(r[0]), o = t.paramPoint(r[1]);
7286
7288
  return Rt$1(i, o);
7287
7289
  }, e);
7288
7290
  return Math.sqrt(s.fMin);
7289
7291
  }
7290
- function an(t, n) {
7291
- return t instanceof at$1 && n instanceof at$1 ? Xt(t, n) : t instanceof at$1 && n instanceof ct$1 ? K(t, n) : t instanceof ct$1 && n instanceof at$1 ? K(n, t) : t instanceof ct$1 && n instanceof ct$1 ? Kt(t, n) : on(t, n);
7292
+ function dn(n, t) {
7293
+ return n instanceof at$2 && t instanceof at$2 ? rn(n, t) : n instanceof at$2 && t instanceof ct$2 ? et(n, t) : n instanceof ct$2 && t instanceof at$2 ? et(t, n) : n instanceof ct$2 && t instanceof ct$2 ? an(n, t) : pn(n, t);
7292
7294
  }
7293
- function ht(t) {
7294
- if (t instanceof Et$1) {
7295
- const r = Q$1(t.lastPoint, t.firstPoint), i = Q$1(t.firstControlPoint, t.firstPoint), o = Q$1(t.lastControlPoint, t.firstPoint), f = un$1(r, i), c = un$1(r, o);
7296
- if (f > 0 && c < 0 || f < 0 && c > 0) return !1;
7295
+ function wt(n) {
7296
+ if (n instanceof Et$1) {
7297
+ const r = Q$2(n.lastPoint, n.firstPoint), i = Q$2(n.firstControlPoint, n.firstPoint), o = Q$2(n.lastControlPoint, n.firstPoint), a = un$1(r, i), f = un$1(r, o);
7298
+ if (a > 0 && f < 0 || a < 0 && f > 0) return !1;
7297
7299
  }
7298
- const n = tt$2(t.tangentAtFirstPoint), e = tt$2(t.tangentAtLastPoint);
7299
- let s = Pe(n, e);
7300
+ const t = tt$2(n.tangentAtFirstPoint), e = tt$2(n.tangentAtLastPoint);
7301
+ let s = Pe(t, e);
7300
7302
  return Math.abs(Math.acos(s)) < Math.PI / 3;
7301
7303
  }
7302
- function $(t) {
7303
- if (ht(t)) return [t];
7304
- const [n, e] = t.splitAtParameters([0.5]);
7304
+ function K(n) {
7305
+ if (wt(n)) return [n];
7306
+ const [t, e] = n.splitAtParameters([0.5]);
7305
7307
  return [
7306
- ...$(n),
7307
- ...$(e)
7308
+ ...K(t),
7309
+ ...K(e)
7308
7310
  ];
7309
7311
  }
7310
- function j(t) {
7311
- return ht(t) ? [t] : t.splitAtParameters(t.getParametersOfExtrema()).flatMap($);
7312
+ function st(n) {
7313
+ return wt(n) ? [n] : n.splitAtParameters(n.getParametersOfExtrema()).flatMap(K);
7312
7314
  }
7313
- function cn(t) {
7314
- const n = t.deltaAngle, e = Math.ceil(Math.abs(n) / (Math.PI / 2)), s = n / e, r = 4 * Math.tan(s / 4) / 3, i = t.clockwise ? -1 : 1, o = Array.from(
7315
+ function mn(n) {
7316
+ const t = n.deltaAngle, e = Math.ceil(Math.abs(t) / (Math.PI / 2)), s = t / e, r = 4 * Math.tan(s / 4) / 3, i = n.clockwise ? -1 : 1, o = Array.from(
7315
7317
  { length: e + 1 },
7316
- (c, a) => t.firstAngle + a * s * i
7318
+ (f, c) => n.firstAngle + c * s * i
7317
7319
  );
7318
- return o.slice(0, -1).map((c, a) => [c, o[a + 1]]).map(([c, a]) => {
7319
- const l = Math.cos(c), p = Math.sin(c), h = Math.cos(a), d = Math.sin(a), [u, M] = t.center, m = t.minorRadius, b = t.majorRadius, k = new et$3().rotate(
7320
- t.tiltAngle,
7321
- t.center
7322
- ), F = (St) => k.transform(St), C = F([u + b * l, M + m * p]), z = F([
7323
- u + b * (l - r * p * i),
7324
- M + m * (p + r * l * i)
7325
- ]), Mt = F([
7326
- u + b * (h + r * d * i),
7327
- M + m * (d - r * h * i)
7328
- ]), It = F([u + b * h, M + m * d]);
7329
- return new Et$1(C, It, z, Mt);
7320
+ return o.slice(0, -1).map((f, c) => [f, o[c + 1]]).map(([f, c]) => {
7321
+ const l = Math.cos(f), p = Math.sin(f), g = Math.cos(c), d = Math.sin(c), [u, S] = n.center, M = n.minorRadius, v = n.majorRadius, k = new et$3().rotate(
7322
+ n.tiltAngle,
7323
+ n.center
7324
+ ), C = (Ft) => k.transform(Ft), O = C([u + v * l, S + M * p]), G = C([
7325
+ u + v * (l - r * p * i),
7326
+ S + M * (p + r * l * i)
7327
+ ]), kt = C([
7328
+ u + v * (g + r * d * i),
7329
+ S + M * (d - r * g * i)
7330
+ ]), Et = C([u + v * g, S + M * d]);
7331
+ return new Et$1(O, Et, G, kt);
7330
7332
  });
7331
7333
  }
7332
- const N = 1e-8, gt = (t) => t.flatMap((n) => n instanceof at$1 ? [n] : n instanceof ct$1 ? [n] : n instanceof jt$2 ? cn(n).flatMap(
7333
- (e) => j(e)
7334
- ) : n instanceof _t$1 || n instanceof Et$1 ? j(n) : [new at$1(n.firstPoint, n.lastPoint)]);
7335
- function G(t, n, e = !0) {
7336
- const s = t.map((a) => ({
7337
- offset: y(a, n),
7338
- original: a
7334
+ const X = 1e-8, Mt = (n) => n.flatMap((t) => t instanceof at$2 ? [t] : t instanceof ct$2 ? [t] : t instanceof jt$1 ? mn(t).flatMap(
7335
+ (e) => st(e)
7336
+ ) : t instanceof _t$1 || t instanceof Et$1 ? st(t) : [new at$2(t.firstPoint, t.lastPoint)]);
7337
+ function q(n, t, e = !0) {
7338
+ const s = n.map((c) => ({
7339
+ offset: y(c, t),
7340
+ original: c
7339
7341
  })), r = [];
7340
7342
  let i = e ? null : s.at(-1), o = e ? s.at(-1) : null;
7341
7343
  if (r.length === 1) return r;
7342
- const f = (a) => {
7343
- i ? a.offset instanceof S ? Y$2(a.offset.firstPoint, a.offset.lastPoint) || r.push(
7344
- new at$1(a.offset.firstPoint, a.offset.lastPoint)
7345
- ) : r.push(a.offset) : i = a;
7346
- }, c = function* () {
7347
- for (const a of s.slice(0, -1))
7348
- yield a;
7344
+ const a = (c) => {
7345
+ i ? c.offset instanceof S ? Y$1(c.offset.firstPoint, c.offset.lastPoint) || r.push(
7346
+ new at$2(c.offset.firstPoint, c.offset.lastPoint)
7347
+ ) : r.push(c.offset) : i = c;
7348
+ }, f = function* () {
7349
+ for (const c of s.slice(0, -1))
7350
+ yield c;
7349
7351
  if (!i) throw new Error("Bug in the offset algorithm");
7350
7352
  yield i;
7351
7353
  };
7352
- for (const a of c()) {
7354
+ for (const c of f()) {
7353
7355
  if (!o) {
7354
- o = a;
7356
+ o = c;
7355
7357
  continue;
7356
7358
  }
7357
- const l = o.offset.lastPoint, p = a.offset.firstPoint;
7358
- if (Y$2(l, p)) {
7359
- f(o), o = a;
7359
+ const l = o.offset.lastPoint, p = c.offset.firstPoint;
7360
+ if (Y$1(l, p)) {
7361
+ a(o), o = c;
7360
7362
  continue;
7361
7363
  }
7362
- let h = [];
7363
- if (!(o.offset instanceof S) && !(a.offset instanceof S)) {
7364
- const { intersections: m, overlaps: b } = K$1(
7364
+ let g = [];
7365
+ if (!(o.offset instanceof S) && !(c.offset instanceof S)) {
7366
+ const { intersections: M, overlaps: v } = K$1(
7365
7367
  o.offset,
7366
- a.offset,
7367
- N / 100
7368
+ c.offset,
7369
+ X / 100
7368
7370
  );
7369
- h = [
7370
- ...m,
7371
- ...b.flatMap((k) => [k.firstPoint, k.lastPoint])
7371
+ g = [
7372
+ ...M,
7373
+ ...v.flatMap((k) => [k.firstPoint, k.lastPoint])
7372
7374
  ];
7373
7375
  }
7374
- if (h.length > 0) {
7375
- let m = h[0];
7376
- if (h.length > 1) {
7377
- const F = o == null ? void 0 : o.original.lastPoint, C = h.map(
7378
- (z) => Rt$1(z, F)
7376
+ if (g.length > 0) {
7377
+ let M = g[0];
7378
+ if (g.length > 1) {
7379
+ const C = o == null ? void 0 : o.original.lastPoint, O = g.map(
7380
+ (G) => Rt$1(G, C)
7379
7381
  );
7380
- m = h[C.indexOf(Math.min(...C))];
7382
+ M = g[O.indexOf(Math.min(...O))];
7381
7383
  }
7382
- const b = o.offset.splitAt([
7383
- m
7384
- ])[0], k = a.offset.splitAt([m]).at(-1);
7384
+ const v = o.offset.splitAt([
7385
+ M
7386
+ ])[0], k = c.offset.splitAt([M]).at(-1);
7385
7387
  if (!k) throw new Error("Bug in the splitting algo in offset");
7386
- f({
7387
- offset: b,
7388
+ a({
7389
+ offset: v,
7388
7390
  original: o.original
7389
- }), o = { offset: k, original: a.original };
7391
+ }), o = { offset: k, original: c.original };
7390
7392
  continue;
7391
7393
  }
7392
- const d = o.original.lastPoint, u = St$1(
7393
- Q$1(p, d),
7394
- Q$1(l, d)
7395
- ) > 0, M = new ct$1(l, p, d, u);
7396
- f(o), r.push(M), o = a;
7397
- }
7398
- return o && f(o), r;
7399
- }
7400
- function pt(t) {
7401
- const n = /* @__PURE__ */ new Map(), e = (s, r) => {
7402
- const i = n.get(s) || [];
7403
- n.set(s, [...i, ...r]);
7394
+ const d = o.original.lastPoint, u = St$2(
7395
+ Q$2(p, d),
7396
+ Q$2(l, d)
7397
+ ) > 0, S$1 = new ct$2(l, p, d, u);
7398
+ a(o), r.push(S$1), o = c;
7399
+ }
7400
+ return o && a(o), r;
7401
+ }
7402
+ function It(n) {
7403
+ const t = /* @__PURE__ */ new Map(), e = (s, r) => {
7404
+ const i = t.get(s) || [];
7405
+ t.set(s, [...i, ...r]);
7404
7406
  };
7405
- return t.forEach((s, r) => {
7406
- t.slice(r + 1).forEach((i, o) => {
7407
- const { intersections: f, overlaps: c } = K$1(s, i, N), a = [
7408
- ...f,
7409
- ...c.flatMap((l) => [l.firstPoint, l.lastPoint])
7407
+ return n.forEach((s, r) => {
7408
+ n.slice(r + 1).forEach((i, o) => {
7409
+ const { intersections: a, overlaps: f } = K$1(s, i, X), c = [
7410
+ ...a,
7411
+ ...f.flatMap((l) => [l.firstPoint, l.lastPoint])
7410
7412
  ].filter((l) => {
7411
- const p = Y$2(l, s.firstPoint) || Y$2(l, s.lastPoint), h = Y$2(l, i.firstPoint) || Y$2(l, i.lastPoint);
7412
- return !(p && h);
7413
+ const p = Y$1(l, s.firstPoint) || Y$1(l, s.lastPoint), g = Y$1(l, i.firstPoint) || Y$1(l, i.lastPoint);
7414
+ return !(p && g);
7413
7415
  });
7414
- a.length && (e(r, a), e(o + r + 1, a));
7416
+ c.length && (e(r, c), e(o + r + 1, c));
7415
7417
  });
7416
- }), n;
7418
+ }), t;
7417
7419
  }
7418
- function dt(t, n) {
7419
- return n.flatMap((e, s) => {
7420
- if (!t.has(s)) return e;
7421
- const r = t.get(s);
7420
+ function St(n, t) {
7421
+ return t.flatMap((e, s) => {
7422
+ if (!n.has(s)) return e;
7423
+ const r = n.get(s);
7422
7424
  return r ? e.splitAt(r) : e;
7423
7425
  });
7424
7426
  }
7425
- function Pt(t, n, e) {
7426
- return t.filter((s) => !n.segments.some((i) => an(i, s) < Math.abs(e) - N));
7427
+ function bt(n, t, e) {
7428
+ return n.filter((s) => !t.segments.some((i) => dn(i, s) < Math.abs(e) - X));
7427
7429
  }
7428
- function O(t, n) {
7429
- const e = t.clockwise ? n : -n, s = gt(t.segments), r = G(s, e);
7430
- if (r.length < 2) return new _$1();
7431
- const i = pt(r);
7430
+ function T(n, t) {
7431
+ const e = n.clockwise ? t : -t, s = Mt(n.segments), r = q(s, e);
7432
+ if (r.length < 2) return new _$2();
7433
+ const i = It(r);
7432
7434
  if (!i.size) {
7433
- const l = new O$1(r);
7434
- return new _$1([new v$2(l)]);
7435
+ const l = new O(r);
7436
+ return new _$2([new v$1(l)]);
7435
7437
  }
7436
- const o = dt(
7438
+ const o = St(
7437
7439
  i,
7438
7440
  r
7439
- ), f = Pt(o, t, n);
7440
- if (!f.length) return new _$1();
7441
- const a = Yt$1(f).filter((l) => l.length > 1).filter((l) => Y$2(l[0].firstPoint, l.at(-1).lastPoint)).map((l) => new O$1(l));
7442
- return a.length ? new _$1(a.map((l) => new v$2(l))) : new _$1();
7441
+ ), a = bt(o, n, t);
7442
+ if (!a.length) return new _$2();
7443
+ const c = Yt(a).filter((l) => l.length > 1).filter((l) => Y$1(l[0].firstPoint, l.at(-1).lastPoint)).map((l) => new O(l));
7444
+ return c.length ? new _$2(c.map((l) => new v$1(l))) : new _$2();
7443
7445
  }
7444
- function fn(t, n, e = "round") {
7445
- const s = n / 2, r = gt(t.segments), i = G(r, s, !1), o = G(
7446
+ function Pn(n, t, e = "round") {
7447
+ const s = t / 2, r = Mt(n.segments), i = q(r, s, !1), o = q(
7446
7448
  r,
7447
7449
  -s,
7448
7450
  !1
7449
7451
  ).map((u) => u.reverse());
7450
7452
  o.reverse();
7451
- const f = (u, M) => e === "round" ? mn$1(
7453
+ const a = (u, S) => e === "round" ? mn$2(
7452
7454
  u.lastPoint,
7453
- M.firstPoint,
7455
+ S.firstPoint,
7454
7456
  u.tangentAtLastPoint
7455
- ) : new at$1(u.lastPoint, M.firstPoint), c = [
7457
+ ) : new at$2(u.lastPoint, S.firstPoint), f = [
7456
7458
  ...i,
7457
- f(
7459
+ a(
7458
7460
  i[i.length - 1],
7459
7461
  o[0]
7460
7462
  ),
7461
7463
  ...o,
7462
- f(
7464
+ a(
7463
7465
  o[o.length - 1],
7464
7466
  i[0]
7465
7467
  )
7466
- ], a = pt(c);
7467
- if (!a.size) {
7468
- const u = new O$1(c);
7469
- return new _$1([new v$2(u)]);
7468
+ ], c = It(f);
7469
+ if (!c.size) {
7470
+ const u = new O(f);
7471
+ return new _$2([new v$1(u)]);
7470
7472
  }
7471
- const l = dt(
7472
- a,
7473
- c
7474
- ), p = Pt(l, t, s);
7475
- if (!p.length) return new _$1();
7476
- const d = Yt$1(p).filter((u) => u.length > 1).filter((u) => Y$2(u[0].firstPoint, u.at(-1).lastPoint)).map((u) => new O$1(u));
7477
- return d.length ? new _$1(d.map((u) => new v$2(u))) : new _$1();
7478
- }
7479
- function ln(t, n) {
7480
- const e = t.map((s) => {
7481
- const r = D(
7482
- s.holes.map((i) => O(i, n))
7473
+ const l = St(
7474
+ c,
7475
+ f
7476
+ ), p = bt(l, n, s);
7477
+ if (!p.length) return new _$2();
7478
+ const d = Yt(p).filter((u) => u.length > 1).filter((u) => Y$1(u[0].firstPoint, u.at(-1).lastPoint)).map((u) => new O(u));
7479
+ return d.length ? new _$2(d.map((u) => new v$1(u))) : new _$2();
7480
+ }
7481
+ function wn(n, t) {
7482
+ const e = n.map((s) => {
7483
+ const r = z(
7484
+ s.holes.map((i) => T(i, t))
7483
7485
  );
7484
- return ut(O(s.contour, n), r);
7486
+ return Pt(T(s.contour, t), r);
7485
7487
  });
7486
- return D(e);
7488
+ return z(e);
7487
7489
  }
7488
- function un(t, n) {
7489
- const e = Math.abs(n / 2), s = t.map(
7490
- (r) => D(
7491
- r.allLoops.map((i) => ut(O(i, e), O(i, -e)))
7490
+ function Mn(n, t) {
7491
+ const e = Math.abs(t / 2), s = n.map(
7492
+ (r) => z(
7493
+ r.allLoops.map((i) => Pt(T(i, e), T(i, -e)))
7492
7494
  )
7493
7495
  );
7494
- return D(s);
7495
- }
7496
- function bn(t, n) {
7497
- return ln(v(t), n);
7498
- }
7499
- function Ln(t, n, { endCap: e = "round" } = {}) {
7500
- return t instanceof B$1 ? fn(t, n, e) : un(v(t), n);
7501
- }
7502
- function tt(t) {
7503
- if (t instanceof _$1)
7504
- return d(t);
7505
- if (t instanceof v$2)
7506
- return p(t);
7507
- if (t instanceof O$1)
7508
- return `<path d="${w(t)}" />`;
7509
- if (t instanceof B$1)
7510
- return `<path d="${j$1(t)}" />`;
7511
- if (jn(t))
7512
- return `<path d="${`M ${t.firstPoint.join(" ")}`} ${s(
7513
- t
7496
+ return z(s);
7497
+ }
7498
+ function On(n, t) {
7499
+ return wn(L(n), t);
7500
+ }
7501
+ function Dn(n, t, { endCap: e = "round" } = {}) {
7502
+ return n instanceof B$2 ? Pn(n, t, e) : Mn(L(n), t);
7503
+ }
7504
+ class In {
7505
+ constructor() {
7506
+ P(this, "filters");
7507
+ this.filters = [];
7508
+ }
7509
+ delete() {
7510
+ this.filters = [];
7511
+ }
7512
+ /**
7513
+ * Combine logically a set of filter with an AND operation.
7514
+ *
7515
+ */
7516
+ and(t) {
7517
+ return t.forEach((e) => e(this)), this;
7518
+ }
7519
+ /**
7520
+ * Invert the result of a particular filter
7521
+ *
7522
+ */
7523
+ not(t) {
7524
+ const e = new this.constructor();
7525
+ t(e);
7526
+ const s = ({ element: r }) => !e.shouldKeep(r);
7527
+ return this.filters.push(s), this;
7528
+ }
7529
+ /**
7530
+ * Combine logically a set of filter with an OR operation.
7531
+ *
7532
+ */
7533
+ either(t) {
7534
+ const e = t.map((r) => {
7535
+ const i = new this.constructor();
7536
+ return r(i), i;
7537
+ }), s = ({ element: r }) => e.some((i) => i.shouldKeep(r));
7538
+ return this.filters.push(s), this;
7539
+ }
7540
+ }
7541
+ const _ = 2 * Math.PI, rt = (n) => {
7542
+ const t = n % _, e = t < 0 ? t + _ : t;
7543
+ return e < Math.PI ? e : e === Math.PI ? 0 : Math.abs(e - _);
7544
+ };
7545
+ class x extends In {
7546
+ clone() {
7547
+ const t = new x();
7548
+ return t.filters = [...this.filters], t;
7549
+ }
7550
+ /**
7551
+ * Filter to find corner that have their point are in the list.
7552
+ *
7553
+ */
7554
+ inList(t) {
7555
+ const e = ({ element: s }) => !!t.find((r) => Y$1(r, s.point));
7556
+ return this.filters.push(e), this;
7557
+ }
7558
+ /**
7559
+ * Filter to find elements that are at a specified distance from a point.
7560
+ *
7561
+ */
7562
+ atDistance(t, e = [0, 0]) {
7563
+ function s({ element: r }) {
7564
+ return Math.abs(J$2(e, r.point) - t) < 1e-9;
7565
+ }
7566
+ return this.filters.push(s), this;
7567
+ }
7568
+ /**
7569
+ * Filter to find elements that contain a certain point
7570
+ *
7571
+ * @category Filter
7572
+ */
7573
+ atPoint(t) {
7574
+ function e({ element: s }) {
7575
+ return Y$1(t, s.point);
7576
+ }
7577
+ return this.filters.push(e), this;
7578
+ }
7579
+ /**
7580
+ * Filter to find elements that are within a box
7581
+ *
7582
+ * @category Filter
7583
+ */
7584
+ inBox(t, e) {
7585
+ const [s, r] = t, [i, o] = e, a = Math.min(s, i), f = Math.max(s, i), c = Math.min(r, o), l = Math.max(r, o);
7586
+ function p({ element: g }) {
7587
+ const [d, u] = g.point;
7588
+ return d >= a && d <= f && u >= c && u <= l;
7589
+ }
7590
+ return this.filters.push(p), this;
7591
+ }
7592
+ /**
7593
+ * Filter to find corner that a certain angle between them - only between
7594
+ * 0 and 180.
7595
+ *
7596
+ */
7597
+ ofAngle(t) {
7598
+ function e({ element: s }) {
7599
+ const r = s.firstCurve.tangentAtLastPoint, i = s.secondCurve.tangentAtFirstPoint;
7600
+ return Math.abs(
7601
+ rt(un$1(r, i)) - rt(fe * t)
7602
+ ) < 1e-9;
7603
+ }
7604
+ return this.filters.push(e), this;
7605
+ }
7606
+ above(t = 0) {
7607
+ function e({ element: s }) {
7608
+ return s.point[1] > t;
7609
+ }
7610
+ return this.filters.push(e), this;
7611
+ }
7612
+ below(t = 0) {
7613
+ function e({ element: s }) {
7614
+ return s.point[1] < t;
7615
+ }
7616
+ return this.filters.push(e), this;
7617
+ }
7618
+ leftOf(t = 0) {
7619
+ function e({ element: s }) {
7620
+ return s.point[0] < t;
7621
+ }
7622
+ return this.filters.push(e), this;
7623
+ }
7624
+ rightOf(t = 0) {
7625
+ function e({ element: s }) {
7626
+ return s.point[0] > t;
7627
+ }
7628
+ return this.filters.push(e), this;
7629
+ }
7630
+ shouldKeep(t) {
7631
+ return this.filters.every((s) => s({ element: t }));
7632
+ }
7633
+ asFilterFun() {
7634
+ return this.shouldKeep.bind(this);
7635
+ }
7636
+ }
7637
+ function At(n, t, e, s = () => !0) {
7638
+ const r = [t.segments[0]], i = (a, f) => {
7639
+ s({ firstCurve: a, secondCurve: f, point: a.lastPoint }) ? r.push(...n(a, f, e)) : r.push(a, f);
7640
+ };
7641
+ if (t.segments.slice(1).forEach((a) => {
7642
+ const f = r.pop();
7643
+ if (!f) throw new Error("Bug in the stroke filletting algo");
7644
+ i(f, a);
7645
+ }), !r.at(-1)) throw new Error("Bug in the stroke corner algo");
7646
+ if (t instanceof O) {
7647
+ const a = r.pop(), f = r.shift();
7648
+ if (!a || !f)
7649
+ throw new Error("Bug in the filletting algo");
7650
+ return i(a, f), new O(r, { ignoreChecks: !0 });
7651
+ } else
7652
+ return new B$2(r, { ignoreChecks: !0 });
7653
+ }
7654
+ function B(n, t, e) {
7655
+ const s = typeof e == "function" ? e(new x()) : e, r = s && s.asFilterFun();
7656
+ if (n instanceof O || n instanceof B$2)
7657
+ return At(V, n, t, r);
7658
+ if (n instanceof v$1) {
7659
+ const i = B(n.contour, t, s), o = n.holes.map((a) => B(a, t, s));
7660
+ return new v$1(i, o, { ignoreChecks: !0 });
7661
+ }
7662
+ if (n instanceof _$2) {
7663
+ const i = n.figures.map((o) => B(o, t, s));
7664
+ return new _$2(i, { ignoreChecks: !0 });
7665
+ }
7666
+ throw new Error("invalid shape to fillet");
7667
+ }
7668
+ function R(n, t, e) {
7669
+ const s = typeof e == "function" ? e(new x()) : e, r = s && s.asFilterFun();
7670
+ if (n instanceof O || n instanceof B$2)
7671
+ return At(V, n, t, r);
7672
+ if (n instanceof v$1) {
7673
+ const i = R(n.contour, t, s), o = n.holes.map((a) => R(a, t, s));
7674
+ return new v$1(i, o, { ignoreChecks: !0 });
7675
+ }
7676
+ if (n instanceof _$2) {
7677
+ const i = n.figures.map((o) => R(o, t, s));
7678
+ return new _$2(i, { ignoreChecks: !0 });
7679
+ }
7680
+ throw new Error("invalid shape to chamfer");
7681
+ }
7682
+ class Sn extends x {
7683
+ constructor(t) {
7684
+ super(), this.shape = t;
7685
+ }
7686
+ fillet(t) {
7687
+ return B(this.shape, t, this.clone());
7688
+ }
7689
+ chamfer(t) {
7690
+ return R(this.shape, t, this.clone());
7691
+ }
7692
+ }
7693
+ function Bn(n) {
7694
+ return new Sn(n);
7695
+ }
7696
+ function it(n) {
7697
+ if (n instanceof _$2)
7698
+ return d(n);
7699
+ if (n instanceof v$1)
7700
+ return p(n);
7701
+ if (n instanceof O)
7702
+ return `<path d="${w(n)}" />`;
7703
+ if (n instanceof B$2)
7704
+ return `<path d="${j$1(n)}" />`;
7705
+ if (jn(n))
7706
+ return `<path d="${`M ${n.firstPoint.join(" ")}`} ${s(
7707
+ n
7514
7708
  )}" />`;
7515
7709
  throw new Error("Unknown shape type");
7516
7710
  }
7517
- const nt = (t) => "shape" in t ? t.shape : t, et = (t, n) => {
7518
- if (!("shape" in t)) return n;
7519
- const { color: e } = t;
7520
- return e ? `<g stroke="${e}">${n}</g>` : n;
7521
- }, st = (t) => new mt$2(t.xMin, -t.yMax, t.xMax, -t.yMin);
7522
- function An(t, {
7523
- margin: n = 1,
7711
+ const ot = (n) => "shape" in n ? n.shape : n, at = (n, t) => {
7712
+ if (!("shape" in n)) return t;
7713
+ const { color: e } = n;
7714
+ return e ? `<g stroke="${e}">${t}</g>` : t;
7715
+ }, ct = (n) => new mt$2(n.xMin, -n.yMax, n.xMax, -n.yMin);
7716
+ function Rn(n, {
7717
+ margin: t = 1,
7524
7718
  unit: e = null,
7525
7719
  viewBox: s
7526
7720
  } = {}) {
7527
- if (Array.isArray(t)) {
7528
- const i = t.map((c) => nt(c).mirror()), o = i.map((c, a) => et(t[a], tt(c))).join(`
7529
- `), f = i.slice(1).reduce((c, a) => c.merge(a.boundingBox), i[0].boundingBox);
7530
- return A(o, s ? st(s) : f, n, e);
7721
+ if (Array.isArray(n)) {
7722
+ const i = n.map((f) => ot(f).mirror()), o = i.map((f, c) => at(n[c], it(f))).join(`
7723
+ `), a = i.slice(1).reduce((f, c) => f.merge(c.boundingBox), i[0].boundingBox);
7724
+ return A(o, s ? ct(s) : a, t, e);
7531
7725
  }
7532
- const r = nt(t).mirror();
7726
+ const r = ot(n).mirror();
7533
7727
  return A(
7534
- et(t, tt(r)),
7535
- s ? st(s) : r.boundingBox,
7536
- n,
7728
+ at(n, it(r)),
7729
+ s ? ct(s) : r.boundingBox,
7730
+ t,
7537
7731
  e
7538
7732
  );
7539
7733
  }
7540
- const mt = (t) => {
7541
- if (t.type === "LINE")
7542
- return new at$1(t.firstPoint, t.lastPoint);
7543
- if (t.type === "ARC")
7544
- return new ct$1(
7545
- t.firstPoint,
7546
- t.lastPoint,
7547
- t.center,
7548
- t.clockwise
7734
+ const vt = (n) => {
7735
+ if (n.type === "LINE")
7736
+ return new at$2(n.firstPoint, n.lastPoint);
7737
+ if (n.type === "ARC")
7738
+ return new ct$2(
7739
+ n.firstPoint,
7740
+ n.lastPoint,
7741
+ n.center,
7742
+ n.clockwise
7549
7743
  );
7550
- if (t.type === "ELLIPSE_ARC")
7551
- return new jt$2(
7552
- t.firstPoint,
7553
- t.lastPoint,
7554
- t.center,
7555
- t.majorRadius,
7556
- t.minorRadius,
7557
- t.tiltAngle,
7558
- t.clockwise,
7744
+ if (n.type === "ELLIPSE_ARC")
7745
+ return new jt$1(
7746
+ n.firstPoint,
7747
+ n.lastPoint,
7748
+ n.center,
7749
+ n.majorRadius,
7750
+ n.minorRadius,
7751
+ n.tiltAngle,
7752
+ n.clockwise,
7559
7753
  { angleUnits: "rad" }
7560
7754
  );
7561
- if (t.type === "QUADRATIC_BEZIER")
7755
+ if (n.type === "QUADRATIC_BEZIER")
7562
7756
  return new _t$1(
7563
- t.firstPoint,
7564
- t.lastPoint,
7565
- t.controlPoint
7757
+ n.firstPoint,
7758
+ n.lastPoint,
7759
+ n.controlPoint
7566
7760
  );
7567
- if (t.type === "CUBIC_BEZIER")
7761
+ if (n.type === "CUBIC_BEZIER")
7568
7762
  return new Et$1(
7569
- t.firstPoint,
7570
- t.lastPoint,
7571
- t.firstControlPoint,
7572
- t.lastControlPoint
7763
+ n.firstPoint,
7764
+ n.lastPoint,
7765
+ n.firstControlPoint,
7766
+ n.lastControlPoint
7573
7767
  );
7574
7768
  throw new Error("Unknown segment type");
7575
- }, U = (t) => {
7576
- const n = t.segments.map(mt);
7577
- return new O$1(n);
7578
- }, wt = (t) => {
7579
- const n = U(t.contour), e = t.holes.map(U);
7580
- return new v$2(n, e);
7581
- }, hn = (t) => {
7582
- const n = t.figures.map(wt);
7583
- return new _$1(n);
7769
+ }, H = (n) => {
7770
+ const t = n.segments.map(vt);
7771
+ return new O(t);
7772
+ }, Lt = (n) => {
7773
+ const t = H(n.contour), e = n.holes.map(H);
7774
+ return new v$1(t, e);
7775
+ }, bn = (n) => {
7776
+ const t = n.figures.map(Lt);
7777
+ return new _$2(t);
7584
7778
  };
7585
- function vn(t) {
7586
- if (t.type === "DIAGRAM")
7587
- return hn(t);
7588
- if (t.type === "FIGURE")
7589
- return wt(t);
7590
- if (t.type === "LOOP")
7591
- return U(t);
7592
- if (t.type === "LINE" || t.type === "ARC" || t.type === "ELLIPSE_ARC" || t.type === "CUBIC_BEZIER")
7593
- return mt(t);
7779
+ function zn(n) {
7780
+ if (n.type === "DIAGRAM")
7781
+ return bn(n);
7782
+ if (n.type === "FIGURE")
7783
+ return Lt(n);
7784
+ if (n.type === "LOOP")
7785
+ return H(n);
7786
+ if (n.type === "LINE" || n.type === "ARC" || n.type === "ELLIPSE_ARC" || n.type === "CUBIC_BEZIER")
7787
+ return vt(n);
7594
7788
  throw new Error("Unknown shape type");
7595
7789
  }
7596
- const it = Math.PI / 180, gn = 180 / Math.PI;
7597
- function kn(t, n) {
7598
- const e = Math.cos(n * it) * t, s = Math.sin(n * it) * t;
7790
+ const ft = Math.PI / 180, An = 180 / Math.PI;
7791
+ function Tn(n, t) {
7792
+ const e = Math.cos(t * ft) * n, s = Math.sin(t * ft) * n;
7599
7793
  return [e, s];
7600
7794
  }
7601
- function En([t, n]) {
7602
- const e = Math.sqrt(t * t + n * n), s = Math.atan2(n, t) * gn;
7795
+ function $n([n, t]) {
7796
+ const e = Math.sqrt(n * n + t * t), s = Math.atan2(t, n) * An;
7603
7797
  return [e, s];
7604
7798
  }
7605
7799
 
7606
7800
  var pantograph = /*#__PURE__*/Object.freeze({
7607
7801
  __proto__: null,
7608
- DEG2RAD: it,
7609
- RAD2DEG: gn,
7610
- cartesianToPolar: En,
7611
- confineStrand: Sn,
7612
- cut: ut,
7613
- draw: lt$1,
7614
- eraseStrand: In,
7615
- exportJSON: Mt,
7616
- exportSVG: An,
7617
- fuse: Wt,
7618
- fuseAll: D,
7619
- importJSON: vn,
7620
- intersect: Mn,
7621
- offset: bn,
7622
- outlineStroke: Ln,
7623
- polarToCartesian: kn,
7624
- svgBody: tt
7802
+ DEG2RAD: ft,
7803
+ RAD2DEG: An,
7804
+ cartesianToPolar: $n,
7805
+ chamfer: R,
7806
+ confineStrand: xn,
7807
+ cut: Pt,
7808
+ draw: lt,
7809
+ eraseStrand: Cn,
7810
+ exportJSON: Mt$1,
7811
+ exportSVG: Rn,
7812
+ fillet: B,
7813
+ fuse: sn,
7814
+ fuseAll: z,
7815
+ importJSON: zn,
7816
+ intersect: yn,
7817
+ offset: On,
7818
+ outlineStroke: Dn,
7819
+ polarToCartesian: Tn,
7820
+ selectCorners: Bn,
7821
+ svgBody: it
7625
7822
  });
7626
7823
 
7627
7824
  function sketchSegment(segment, plane) {
7628
- if (segment instanceof at$1) {
7825
+ if (segment instanceof at$2) {
7629
7826
  const firstPoint = plane.toWorldCoords(segment.firstPoint);
7630
7827
  const lastPoint = plane.toWorldCoords(segment.lastPoint);
7631
7828
  return makeLine(firstPoint, lastPoint);
7632
7829
  }
7633
- if (segment instanceof ct$1) {
7830
+ if (segment instanceof ct$2) {
7634
7831
  return makeThreePointArc(plane.toWorldCoords(segment.firstPoint), plane.toWorldCoords(segment.midPoint), plane.toWorldCoords(segment.lastPoint));
7635
7832
  }
7636
- if (segment instanceof jt$2) {
7833
+ if (segment instanceof jt$1) {
7637
7834
  const xDir = new Vector(plane.xDir).rotate(segment.tiltAngle, plane.origin, plane.zDir);
7638
7835
  return makeEllipseArc(segment.majorRadius, segment.minorRadius, segment.clockwise ? segment.firstAngle : segment.lastAngle, segment.clockwise ? segment.lastAngle : segment.firstAngle, plane.toWorldCoords(segment.center), plane.zDir, xDir);
7639
7836
  }
@@ -7685,18 +7882,18 @@ function sketchOnPlane(pantographObject, planeInput = "XY", origin = [0, 0, 0])
7685
7882
  const plane = planeInput instanceof Plane
7686
7883
  ? makePlane(planeInput)
7687
7884
  : makePlane(planeInput, origin);
7688
- if (pantographObject instanceof _$1) {
7885
+ if (pantographObject instanceof _$2) {
7689
7886
  return sketchDiagram(pantographObject, plane);
7690
7887
  }
7691
- if (pantographObject instanceof v$2) {
7888
+ if (pantographObject instanceof v$1) {
7692
7889
  return sketchFigure(pantographObject, plane);
7693
7890
  }
7694
- if (pantographObject instanceof O$1) {
7891
+ if (pantographObject instanceof O) {
7695
7892
  return sketchStroke(pantographObject, plane);
7696
7893
  }
7697
- if (pantographObject instanceof at$1 ||
7698
- pantographObject instanceof ct$1 ||
7699
- pantographObject instanceof jt$2 ||
7894
+ if (pantographObject instanceof at$2 ||
7895
+ pantographObject instanceof ct$2 ||
7896
+ pantographObject instanceof jt$1 ||
7700
7897
  pantographObject instanceof _t$1 ||
7701
7898
  pantographObject instanceof Et$1) {
7702
7899
  return sketchFromSegments([sketchSegment(pantographObject, plane)], plane);
@@ -7704,16 +7901,16 @@ function sketchOnPlane(pantographObject, planeInput = "XY", origin = [0, 0, 0])
7704
7901
  throw new Error(`Unsupported object type "${pantographObject.constructor.name}"`);
7705
7902
  }
7706
7903
  function toSVGPaths(shape) {
7707
- if (shape instanceof _$1) {
7904
+ if (shape instanceof _$2) {
7708
7905
  return shape.figures.flatMap(toSVGPaths);
7709
7906
  }
7710
- else if (shape instanceof v$2) {
7907
+ else if (shape instanceof v$1) {
7711
7908
  return shape.allLoops.map((loop) => w(loop));
7712
7909
  }
7713
- else if (shape instanceof O$1) {
7910
+ else if (shape instanceof O) {
7714
7911
  return [w(shape)];
7715
7912
  }
7716
- else if (shape instanceof B$1) {
7913
+ else if (shape instanceof B$2) {
7717
7914
  return [j$1(shape)];
7718
7915
  }
7719
7916
  else if (jn(shape)) {
@@ -7723,13 +7920,13 @@ function toSVGPaths(shape) {
7723
7920
  }
7724
7921
  function toSVGViewBox(shape) {
7725
7922
  const boundingBox = shape.boundingBox;
7726
- return v$1(boundingBox);
7923
+ return v(boundingBox);
7727
7924
  }
7728
7925
  function wrapPantograph(pantographObject) {
7729
7926
  const isPantograph = jn(pantographObject) ||
7730
- pantographObject instanceof O$1 ||
7731
- pantographObject instanceof v$2 ||
7732
- pantographObject instanceof _$1;
7927
+ pantographObject instanceof O ||
7928
+ pantographObject instanceof v$1 ||
7929
+ pantographObject instanceof _$2;
7733
7930
  if (!isPantograph)
7734
7931
  return pantographObject;
7735
7932
  const shape = pantographObject.mirror();