pantograph2d 0.11.0 → 0.11.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.
Files changed (52) hide show
  1. package/dist/{QuadraticBezier-B2g_Iyyl.js → QuadraticBezier-BeY2TXKH.js} +464 -433
  2. package/dist/QuadraticBezier-BeY2TXKH.js.map +1 -0
  3. package/dist/{QuadraticBezier-CuRsIP_D.cjs → QuadraticBezier-eSR75IzC.cjs} +9 -9
  4. package/dist/QuadraticBezier-eSR75IzC.cjs.map +1 -0
  5. package/dist/draw-BmJ8wIc9.cjs +2 -0
  6. package/dist/draw-BmJ8wIc9.cjs.map +1 -0
  7. package/dist/{draw-BJW5kfm9.js → draw-DzKVhurb.js} +94 -89
  8. package/dist/draw-DzKVhurb.js.map +1 -0
  9. package/dist/{models-DdZq-waE.js → models-BHeLX0dj.js} +544 -527
  10. package/dist/models-BHeLX0dj.js.map +1 -0
  11. package/dist/models-Fv9xfQBT.cjs +4 -0
  12. package/dist/models-Fv9xfQBT.cjs.map +1 -0
  13. package/dist/pantograph/drawShape.cjs +1 -1
  14. package/dist/pantograph/drawShape.js +2 -2
  15. package/dist/pantograph/models.cjs +1 -1
  16. package/dist/pantograph/models.js +2 -2
  17. package/dist/pantograph/svg.cjs +1 -1
  18. package/dist/pantograph/svg.js +1 -1
  19. package/dist/pantograph.cjs +2 -2
  20. package/dist/pantograph.cjs.map +1 -1
  21. package/dist/pantograph.js +83 -83
  22. package/dist/pantograph.js.map +1 -1
  23. package/dist/svg-BTO7h1ix.js +62 -0
  24. package/dist/svg-BTO7h1ix.js.map +1 -0
  25. package/dist/svg-b6SOnbda.cjs +8 -0
  26. package/dist/svg-b6SOnbda.cjs.map +1 -0
  27. package/dist/types/src/algorithms/offsets/offsetSegment.d.ts +1 -0
  28. package/dist/types/src/models/BoundingBox.d.ts +1 -0
  29. package/dist/types/src/models/Diagram.d.ts +1 -0
  30. package/dist/types/src/models/Figure.d.ts +1 -0
  31. package/dist/types/src/models/Loop.d.ts +1 -0
  32. package/dist/types/src/models/Strand.d.ts +5 -0
  33. package/dist/types/src/models/TransformationMatrix.d.ts +1 -0
  34. package/dist/types/src/models/segments/Arc.d.ts +1 -0
  35. package/dist/types/src/models/segments/CubicBezier.d.ts +1 -0
  36. package/dist/types/src/models/segments/EllipseArc.d.ts +1 -0
  37. package/dist/types/src/models/segments/Line.d.ts +2 -0
  38. package/dist/types/src/models/segments/QuadraticBezier.d.ts +1 -0
  39. package/dist/types/src/tesselationOperations.d.ts +4 -4
  40. package/package.json +2 -2
  41. package/dist/QuadraticBezier-B2g_Iyyl.js.map +0 -1
  42. package/dist/QuadraticBezier-CuRsIP_D.cjs.map +0 -1
  43. package/dist/draw-9Elv4xz6.cjs +0 -2
  44. package/dist/draw-9Elv4xz6.cjs.map +0 -1
  45. package/dist/draw-BJW5kfm9.js.map +0 -1
  46. package/dist/models-DdZq-waE.js.map +0 -1
  47. package/dist/models-LHGiMarC.cjs +0 -4
  48. package/dist/models-LHGiMarC.cjs.map +0 -1
  49. package/dist/svg-BzloQ9l1.cjs +0 -8
  50. package/dist/svg-BzloQ9l1.cjs.map +0 -1
  51. package/dist/svg-D8vwkQf7.js +0 -62
  52. package/dist/svg-D8vwkQf7.js.map +0 -1
@@ -1,11 +1,12 @@
1
- var Oe = Object.defineProperty;
2
- var Me = (r) => {
1
+ var Xe = Object.defineProperty;
2
+ var ye = (r) => {
3
3
  throw TypeError(r);
4
4
  };
5
- var Be = (r, s, t) => s in r ? Oe(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
6
- var q = (r, s, t) => Be(r, typeof s != "symbol" ? s + "" : s, t), oe = (r, s, t) => s.has(r) || Me("Cannot " + t);
7
- var ht = (r, s, t) => (oe(r, s, "read from private field"), t ? t.call(r) : s.get(r)), le = (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 = (r, s, t, e) => (oe(r, s, "write to private field"), e ? e.call(r, t) : s.set(r, t), t), he = (r, s, t) => (oe(r, s, "access private method"), t);
8
- function zt(r, s, t, e) {
5
+ var Ze = (r, s, t) => s in r ? Xe(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
6
+ var q = (r, s, t) => Ze(r, typeof s != "symbol" ? s + "" : s, t), oe = (r, s, t) => s.has(r) || ye("Cannot " + t);
7
+ var ht = (r, s, t) => (oe(r, s, "read from private field"), t ? t.call(r) : s.get(r)), le = (r, s, t) => s.has(r) ? ye("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(r) : s.set(r, t), Dt = (r, s, t, e) => (oe(r, s, "write to private field"), e ? e.call(r, t) : s.set(r, t), t), he = (r, s, t) => (oe(r, s, "access private method"), t);
8
+ const Me = Symbol.for("pantograph:BoundingBox");
9
+ function Ot(r, s, t, e) {
9
10
  return r <= e && s >= t;
10
11
  }
11
12
  class mt {
@@ -14,7 +15,10 @@ class mt {
14
15
  q(this, "yMin");
15
16
  q(this, "xMax");
16
17
  q(this, "yMax");
17
- this.xMin = s, this.yMin = t, this.xMax = e, this.yMax = n;
18
+ Object.defineProperty(this, Me, { value: !0 }), this.xMin = s, this.yMin = t, this.xMax = e, this.yMax = n;
19
+ }
20
+ static isInstance(s) {
21
+ return !!s && s[Me] === !0;
18
22
  }
19
23
  get width() {
20
24
  return this.xMax - this.xMin;
@@ -35,10 +39,10 @@ class mt {
35
39
  }
36
40
  contains(s) {
37
41
  const [t, e] = s;
38
- return zt(this.xMin, this.xMax, t, t) && zt(this.yMin, this.yMax, e, e);
42
+ return Ot(this.xMin, this.xMax, t, t) && Ot(this.yMin, this.yMax, e, e);
39
43
  }
40
44
  overlaps(s) {
41
- return zt(this.xMin, this.xMax, s.xMin, s.xMax) && zt(this.yMin, this.yMax, s.yMin, s.yMax);
45
+ return Ot(this.xMin, this.xMax, s.xMin, s.xMax) && Ot(this.yMin, this.yMax, s.yMin, s.yMax);
42
46
  }
43
47
  addPoint(s) {
44
48
  const [t, e] = s;
@@ -69,47 +73,47 @@ class mt {
69
73
  function ce(r) {
70
74
  return r.reduce((s, t) => s.addPoint(t), new mt());
71
75
  }
72
- const ye = (r, s = 1e-9) => {
76
+ const Pe = (r, s = 1e-9) => {
73
77
  let t = r;
74
78
  return Math.abs(r) < s && (t = 0), t.toFixed(-Math.log10(s));
75
79
  };
76
- function Te(r, s = 1e-9) {
80
+ function Ne(r, s = 1e-9) {
77
81
  return Array.from(
78
82
  new Map(
79
83
  r.map(([t, e]) => [
80
- `[${ye(t, s)},${ye(e, s)}]`,
84
+ `[${Pe(t, s)},${Pe(e, s)}]`,
81
85
  [t, e]
82
86
  ])
83
87
  ).values()
84
88
  );
85
89
  }
86
- const fe = Math.PI / 180, Ue = 180 / Math.PI, Z = (r) => `[${r[0]}, ${r[1]}]`, Y = ([r, s], [t, e], n = 1e-9) => Math.abs(r - t) <= n && Math.abs(s - e) <= n, it = ([r, s], [t, e]) => [r + t, s + e], Q = ([r, s], [t, e]) => [r - t, s - e], It = ([r, s]) => r * r + s * s, an = ([r, s]) => Math.sqrt(It([r, s])), nt = ([r, s], t) => [r * t, s * t], Rt = ([r, s], [t, e] = [0, 0]) => (r - t) ** 2 + (s - e) ** 2, J = (r, s = [0, 0]) => Math.sqrt(Rt(r, s));
90
+ const fe = Math.PI / 180, Je = 180 / Math.PI, Z = (r) => `[${r[0]}, ${r[1]}]`, Y = ([r, s], [t, e], n = 1e-9) => Math.abs(r - t) <= n && Math.abs(s - e) <= n, it = ([r, s], [t, e]) => [r + t, s + e], Q = ([r, s], [t, e]) => [r - t, s - e], Tt = ([r, s]) => r * r + s * s, pn = ([r, s]) => Math.sqrt(Tt([r, s])), nt = ([r, s], t) => [r * t, s * t], Rt = ([r, s], [t, e] = [0, 0]) => (r - t) ** 2 + (s - e) ** 2, J = (r, s = [0, 0]) => Math.sqrt(Rt(r, s));
87
91
  function St([r, s], [t, e]) {
88
92
  return r * e - s * t;
89
93
  }
90
- function Pe([r, s], [t, e]) {
94
+ function be([r, s], [t, e]) {
91
95
  return r * t + s * e;
92
96
  }
93
- function un([r, s], [t, e] = [0, 0]) {
97
+ function dn([r, s], [t, e] = [0, 0]) {
94
98
  return Math.atan2(e * r - s * t, r * t + s * e);
95
99
  }
96
100
  function H([r, s]) {
97
101
  const t = J([r, s]);
98
102
  return [r / t, s / t];
99
103
  }
100
- function Tt(r, s) {
104
+ function It(r, s) {
101
105
  const t = Math.cos(s) * r, e = Math.sin(s) * r;
102
106
  return [t, e];
103
107
  }
104
- function Ye([r, s]) {
108
+ function Ke([r, s]) {
105
109
  return Math.atan2(s, r);
106
110
  }
107
- function We(r) {
108
- const s = J(r), t = Ye(r);
111
+ function He(r) {
112
+ const s = J(r), t = Ke(r);
109
113
  return [s, t];
110
114
  }
111
- function Ie(r, s, t = 1e-9) {
112
- const e = St(r, s), n = It(r), i = It(s);
115
+ function Ve(r, s, t = 1e-9) {
116
+ const e = St(r, s), n = Tt(r), i = Tt(s);
113
117
  return e * e < n * i * t * t;
114
118
  }
115
119
  function tt(r) {
@@ -118,23 +122,25 @@ function tt(r) {
118
122
  function Qt(r) {
119
123
  return [r[1], -r[0]];
120
124
  }
121
- function Qe(r, s, t) {
122
- return Y(t, r) || Ie(Q(t, r), s);
125
+ function ts(r, s, t) {
126
+ return Y(t, r) || Ve(Q(t, r), s);
123
127
  }
124
- const Mt = (r, s) => {
125
- const [t, e, n, i, o, l, h, a, u] = r, [c, g, d, w, p, P, f, M, E] = s;
128
+ const Ee = Symbol.for(
129
+ "pantograph:TransformationMatrix"
130
+ ), yt = (r, s) => {
131
+ const [t, e, n, i, o, l, h, a, u] = r, [c, g, d, w, p, P, f, y, E] = s;
126
132
  return [
127
133
  t * c + e * w + n * f,
128
- t * g + e * p + n * M,
134
+ t * g + e * p + n * y,
129
135
  t * d + e * P + n * E,
130
136
  i * c + o * w + l * f,
131
- i * g + o * p + l * M,
137
+ i * g + o * p + l * y,
132
138
  i * d + o * P + l * E,
133
139
  h * c + a * w + u * f,
134
- h * g + a * p + u * M,
140
+ h * g + a * p + u * y,
135
141
  h * d + a * P + u * E
136
142
  ];
137
- }, Ge = (r) => {
143
+ }, es = (r) => {
138
144
  const [s, t, e, n, i, o, l, h, a] = r, u = s * (i * a - o * h) - t * (n * a - o * l) + e * (n * h - i * l);
139
145
  return [
140
146
  (i * a - o * h) / u,
@@ -147,46 +153,51 @@ const Mt = (r, s) => {
147
153
  (t * l - s * h) / u,
148
154
  (s * i - t * n) / u
149
155
  ];
150
- }, Xe = (r) => {
156
+ }, ss = (r) => {
151
157
  const [s, t, e, n, i, o, l, h, a] = r;
152
158
  return [s, n, l, t, i, h, e, o, a];
153
159
  };
154
160
  class et {
155
161
  constructor(s) {
156
162
  q(this, "_matrix", [1, 0, 0, 0, 1, 0, 0, 0, 1]);
157
- s && (this._matrix = [...s]);
163
+ Object.defineProperty(this, Ee, {
164
+ value: !0
165
+ }), s && (this._matrix = [...s]);
166
+ }
167
+ static isInstance(s) {
168
+ return !!s && s[Ee] === !0;
158
169
  }
159
170
  clone() {
160
171
  return new et(this._matrix);
161
172
  }
162
173
  transpose() {
163
- return this._matrix = Xe(this._matrix), this;
174
+ return this._matrix = ss(this._matrix), this;
164
175
  }
165
176
  inverse() {
166
- return this._matrix = Ge(this._matrix), this;
177
+ return this._matrix = es(this._matrix), this;
167
178
  }
168
179
  translate(s, t) {
169
- return this._matrix = Mt([1, 0, s, 0, 1, t, 0, 0, 1], this._matrix), this;
180
+ return this._matrix = yt([1, 0, s, 0, 1, t, 0, 0, 1], this._matrix), this;
170
181
  }
171
182
  rotate(s, t) {
172
183
  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(i, this._matrix), t && this.translate(t[0], t[1]), this;
184
+ return t && this.translate(-t[0], -t[1]), this._matrix = yt(i, this._matrix), t && this.translate(t[0], t[1]), this;
174
185
  }
175
186
  mirrorX() {
176
- return this._matrix = Mt([1, 0, 0, 0, -1, 0, 0, 0, 1], this._matrix), this;
187
+ return this._matrix = yt([1, 0, 0, 0, -1, 0, 0, 0, 1], this._matrix), this;
177
188
  }
178
189
  mirrorY() {
179
- return this._matrix = Mt([-1, 0, 0, 0, 1, 0, 0, 0, 1], this._matrix), this;
190
+ return this._matrix = yt([-1, 0, 0, 0, 1, 0, 0, 0, 1], this._matrix), this;
180
191
  }
181
192
  mirrorLine(s, t) {
182
193
  const [e, n] = s, i = Math.atan2(n, e);
183
194
  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
195
  }
185
196
  mirrorCenter(s) {
186
- return s && this.translate(-s[0], -s[1]), this._matrix = Mt([-1, 0, 0, 0, -1, 0, 0, 0, 1], this._matrix), s && this.translate(s[0], s[1]), this;
197
+ return s && this.translate(-s[0], -s[1]), this._matrix = yt([-1, 0, 0, 0, -1, 0, 0, 0, 1], this._matrix), s && this.translate(s[0], s[1]), this;
187
198
  }
188
199
  scale(s, t) {
189
- return t && this.translate(-t[0], -t[1]), this._matrix = Mt([s, 0, 0, 0, s, 0, 0, 0, 1], this._matrix), t && this.translate(t[0], t[1]), this;
200
+ return t && this.translate(-t[0], -t[1]), this._matrix = yt([s, 0, 0, 0, s, 0, 0, 0, 1], this._matrix), t && this.translate(t[0], t[1]), this;
190
201
  }
191
202
  transform(s) {
192
203
  const [t, e] = s, [n, i, o, l, h, a] = this._matrix;
@@ -205,7 +216,7 @@ class et {
205
216
  return Math.sqrt(s * s + t * t);
206
217
  }
207
218
  }
208
- class Ze {
219
+ class ns {
209
220
  translateX(s) {
210
221
  const t = new et().translate(s, 0);
211
222
  return this.transform(t);
@@ -242,7 +253,7 @@ class Ze {
242
253
  return s === "x" ? e.mirrorX() : s === "y" ? e.mirrorY() : e.mirrorLine(s, t), this.transform(e);
243
254
  }
244
255
  }
245
- class xt extends Ze {
256
+ class Ft extends ns {
246
257
  constructor(t, e) {
247
258
  super();
248
259
  q(this, "precision", 1e-9);
@@ -260,14 +271,19 @@ class xt extends Ze {
260
271
  return this.repr;
261
272
  }
262
273
  }
263
- class at extends xt {
264
- constructor() {
265
- super(...arguments);
274
+ const _e = Symbol.for("pantograph:Line");
275
+ class at extends Ft {
276
+ constructor(t, e) {
277
+ super(t, e);
266
278
  q(this, "segmentType", "LINE");
267
279
  q(this, "_V", null);
268
280
  q(this, "_slope", null);
269
281
  q(this, "_yIntercept", null);
270
282
  q(this, "_boundingBox", null);
283
+ Object.defineProperty(this, _e, { value: !0 });
284
+ }
285
+ static isInstance(t) {
286
+ return !!t && t[_e] === !0;
271
287
  }
272
288
  isValidParameter(t) {
273
289
  const e = this.length * this.precision;
@@ -299,7 +315,7 @@ class at extends xt {
299
315
  return it(this.firstPoint, nt(this.V, 0.5));
300
316
  }
301
317
  isSame(t) {
302
- return t instanceof at ? Y(this.firstPoint, t.firstPoint) && Y(this.lastPoint, t.lastPoint) || Y(this.lastPoint, t.firstPoint) && Y(this.firstPoint, t.lastPoint) : !1;
318
+ return at.isInstance(t) ? Y(this.firstPoint, t.firstPoint) && Y(this.lastPoint, t.lastPoint) || Y(this.lastPoint, t.firstPoint) && Y(this.firstPoint, t.lastPoint) : !1;
303
319
  }
304
320
  clone() {
305
321
  return new at(this.firstPoint, this.lastPoint);
@@ -316,7 +332,7 @@ class at extends xt {
316
332
  )), this._boundingBox;
317
333
  }
318
334
  distanceFrom(t) {
319
- const e = Q(t, this.firstPoint), n = Pe(e, this.V) / this.squareLength;
335
+ const e = Q(t, this.firstPoint), n = be(e, this.V) / this.squareLength;
320
336
  if (n < 0)
321
337
  return J(t, this.firstPoint);
322
338
  if (n > 1)
@@ -327,8 +343,8 @@ class at extends xt {
327
343
  isOnSegment(t) {
328
344
  if (Y(t, this.firstPoint, this.precision)) return !0;
329
345
  const e = Q(t, this.firstPoint);
330
- if (!Ie(this.V, e)) return !1;
331
- const n = Pe(e, this.V) / this.squareLength;
346
+ if (!Ve(this.V, e)) return !1;
347
+ const n = be(e, this.V) / this.squareLength;
332
348
  return this.isValidParameter(n);
333
349
  }
334
350
  gradientAt(t) {
@@ -357,7 +373,7 @@ class at extends xt {
357
373
  `Point ${Z(a)} is not on segment ${this.repr}`
358
374
  );
359
375
  });
360
- const n = [this.firstPoint, ...e, this.lastPoint], i = Te(n), o = this.lastPoint[0] - this.firstPoint[0];
376
+ const n = [this.firstPoint, ...e, this.lastPoint], i = Ne(n), o = this.lastPoint[0] - this.firstPoint[0];
361
377
  let l = Math.sign(o), h = 0;
362
378
  return Math.abs(o) < this.precision && (l = Math.sign(this.lastPoint[1] - this.firstPoint[1]), h = 1), i.sort(
363
379
  (a, u) => l * (a[h] - u[h])
@@ -370,12 +386,12 @@ class at extends xt {
370
386
  );
371
387
  }
372
388
  }
373
- function Je(r) {
389
+ function is(r) {
374
390
  return Array.from(Array(r).keys());
375
391
  }
376
392
  function Kt(r) {
377
393
  const s = Math.min(...r.map((t) => t.length));
378
- return Je(s).map((t) => r.map((e) => e[t]));
394
+ return is(s).map((t) => r.map((e) => e[t]));
379
395
  }
380
396
  function wt(r, s = 1e-9) {
381
397
  return r < 0 ? r + 2 * Math.PI : r >= 2 * Math.PI ? r % (2 * Math.PI) : r > 2 * Math.PI - s ? 0 : r;
@@ -385,7 +401,7 @@ function Zt(r, s, t, e = 1e-9) {
385
401
  return t && (n = -n), n < 0 && (n += 2 * Math.PI), n > 2 * Math.PI - e ? 0 : n;
386
402
  }
387
403
  const me = (r, s, t) => {
388
- const e = St(r.V, s.V), n = It(r.V), i = It(s.V), o = t ? t * t : r.precision * s.precision;
404
+ const e = St(r.V, s.V), n = Tt(r.V), i = Tt(s.V), o = t ? t * t : r.precision * s.precision;
389
405
  if (e * e < n * i * o)
390
406
  return "parallel";
391
407
  const l = Q(s.firstPoint, r.firstPoint), h = St(l, s.V) / e, a = St(l, r.V) / e;
@@ -394,12 +410,12 @@ const me = (r, s, t) => {
394
410
  intersectionParam2: a
395
411
  };
396
412
  };
397
- function cn(r, s, t = !1, e) {
413
+ function yn(r, s, t = !1, e) {
398
414
  const n = me(r, s, e);
399
415
  if (n === "parallel") {
400
416
  if (!t) return null;
401
417
  if (r.isSame(s)) return r;
402
- const l = Te(
418
+ const l = Ne(
403
419
  [
404
420
  s.isOnSegment(r.firstPoint) ? r.firstPoint : null,
405
421
  s.isOnSegment(r.lastPoint) ? r.lastPoint : null,
@@ -417,11 +433,11 @@ function cn(r, s, t = !1, e) {
417
433
  const { intersectionParam1: i, intersectionParam2: o } = n;
418
434
  return !r.isValidParameter(i) || !s.isValidParameter(o) ? null : r.paramPoint(i);
419
435
  }
420
- const Ot = (r, s) => {
436
+ const Bt = (r, s) => {
421
437
  const t = Q(r, s);
422
- return We(t);
423
- };
424
- class ct extends xt {
438
+ return He(t);
439
+ }, je = Symbol.for("pantograph:Arc");
440
+ class ct extends Ft {
425
441
  constructor(t, e, n, i = !1, { ignoreChecks: o = !1 } = {}) {
426
442
  super(t, e);
427
443
  q(this, "segmentType", "ARC");
@@ -433,7 +449,7 @@ class ct extends xt {
433
449
  q(this, "_firstAngle", null);
434
450
  q(this, "_lastAngle", null);
435
451
  q(this, "_boundingBox", null);
436
- if (this.center = n, this.clockwise = i, !o) {
452
+ if (Object.defineProperty(this, je, { value: !0 }), this.center = n, this.clockwise = i, !o) {
437
453
  if (Y(t, e))
438
454
  throw new Error("Invalid arc, cannot be a full circle");
439
455
  if (Math.abs(this.radius - J(this.lastPoint, this.center)) > this.precision)
@@ -444,6 +460,9 @@ class ct extends xt {
444
460
  );
445
461
  }
446
462
  }
463
+ static isInstance(t) {
464
+ return !!t && t[je] === !0;
465
+ }
447
466
  get info() {
448
467
  return `ARC(${Z(this.firstPoint)}, ${Z(
449
468
  this.lastPoint
@@ -479,14 +498,14 @@ class ct extends xt {
479
498
  paramPoint(t) {
480
499
  return it(
481
500
  this.center,
482
- Tt(
501
+ It(
483
502
  this.radius,
484
503
  this.firstAngle + t * this.angularLength * (this.clockwise ? -1 : 1)
485
504
  )
486
505
  );
487
506
  }
488
507
  pointToParam(t) {
489
- const [e, n] = Ot(t, this.center);
508
+ const [e, n] = Bt(t, this.center);
490
509
  if (Math.abs(e - this.radius) > this.precision)
491
510
  throw new Error(
492
511
  `Point ${Z(t)} is not on segment ${this.repr}`
@@ -525,7 +544,7 @@ class ct extends xt {
525
544
  return this.paramPoint(0.5);
526
545
  }
527
546
  isSame(t) {
528
- return !(t instanceof ct) || !Y(this.center, t.center) ? !1 : Y(this.firstPoint, t.firstPoint) && Y(this.lastPoint, t.lastPoint) && this.clockwise === t.clockwise || Y(this.lastPoint, t.firstPoint) && Y(this.firstPoint, t.lastPoint) && this.clockwise === !t.clockwise;
547
+ return !ct.isInstance(t) || !Y(this.center, t.center) ? !1 : Y(this.firstPoint, t.firstPoint) && Y(this.lastPoint, t.lastPoint) && this.clockwise === t.clockwise || Y(this.lastPoint, t.firstPoint) && Y(this.firstPoint, t.lastPoint) && this.clockwise === !t.clockwise;
529
548
  }
530
549
  clone() {
531
550
  return new ct(
@@ -556,7 +575,7 @@ class ct extends xt {
556
575
  return this._boundingBox;
557
576
  }
558
577
  distanceFrom(t) {
559
- const [e, n] = Ot(t, this.center);
578
+ const [e, n] = Bt(t, this.center);
560
579
  return this.isValidParameter(this.angleToParam(n)) ? Math.abs(e - this.radius) : Math.sqrt(
561
580
  Math.min(
562
581
  Rt(t, this.firstPoint),
@@ -567,7 +586,7 @@ class ct extends xt {
567
586
  isOnSegment(t) {
568
587
  if (Y(t, this.firstPoint) || Y(t, this.lastPoint))
569
588
  return !0;
570
- const [e, n] = Ot(t, this.center);
589
+ const [e, n] = Bt(t, this.center);
571
590
  if (Math.abs(e - this.radius) > this.precision) return !1;
572
591
  const i = this.angleToParam(n);
573
592
  return this.isValidParameter(i);
@@ -577,21 +596,21 @@ class ct extends xt {
577
596
  return this.clockwise ? [-i, -o] : [i, o];
578
597
  }
579
598
  tangentAt(t) {
580
- const [e, n] = Ot(t, this.center);
599
+ const [e, n] = Bt(t, this.center);
581
600
  if (Math.abs(e - this.radius) > this.precision)
582
601
  throw new Error("Point is not on the arc");
583
602
  const i = this.angleToParam(n);
584
603
  if (!this.isValidParameter(i))
585
604
  throw new Error("Point is not on the arc");
586
- const o = Tt(1, n);
605
+ const o = It(1, n);
587
606
  return (this.clockwise ? Qt : tt)(H(o));
588
607
  }
589
608
  get tangentAtFirstPoint() {
590
- const t = Tt(1, this.firstAngle);
609
+ const t = It(1, this.firstAngle);
591
610
  return (this.clockwise ? Qt : tt)(H(t));
592
611
  }
593
612
  get tangentAtLastPoint() {
594
- const t = Tt(1, this.lastAngle);
613
+ const t = It(1, this.lastAngle);
595
614
  return (this.clockwise ? Qt : tt)(H(t));
596
615
  }
597
616
  splitAt(t) {
@@ -627,7 +646,7 @@ class ct extends xt {
627
646
  );
628
647
  }
629
648
  }
630
- function fn(r, s, t) {
649
+ function Mn(r, s, t) {
631
650
  const e = new at(s, r), n = new at(s, t), i = tt(e.tangentAtFirstPoint), o = tt(n.tangentAtLastPoint), l = me(
632
651
  { firstPoint: e.midPoint, V: i, precision: 1e-9 },
633
652
  { firstPoint: n.midPoint, V: o, precision: 1e-9 }
@@ -646,7 +665,7 @@ function fn(r, s, t) {
646
665
  { ignoreChecks: !0 }
647
666
  );
648
667
  }
649
- function mn(r, s, t) {
668
+ function Pn(r, s, t) {
650
669
  const e = new at(r, s), n = tt(e.tangentAtFirstPoint), i = me(
651
670
  { firstPoint: e.midPoint, V: n, precision: 1e-9 },
652
671
  {
@@ -668,26 +687,26 @@ function mn(r, s, t) {
668
687
  ignoreChecks: !0
669
688
  });
670
689
  }
671
- const be = 1e-21, Bt = 1.618034;
672
- function Ee(r, s = 0, t = 1, e = 110, n = 1e3) {
690
+ const Se = 1e-21, zt = 1.618034;
691
+ function ke(r, s = 0, t = 1, e = 110, n = 1e3) {
673
692
  let i, o, l, h, a, u, c, g, d, w, p, P, f;
674
- for (o = r(s), l = r(t), o < l && ([s, t] = [t, s], [o, l] = [l, o]), f = t + Bt * (t - s), h = r(f), a = 3, c = 0; h < l; ) {
675
- if (g = (t - s) * (l - h), d = (t - f) * (l - o), w = d - g, Math.abs(w) < be ? i = 2 * be : i = 2 * w, p = t - ((t - f) * d - (t - s) * g) / i, P = t + e * (f - t), c > n)
693
+ for (o = r(s), l = r(t), o < l && ([s, t] = [t, s], [o, l] = [l, o]), f = t + zt * (t - s), h = r(f), a = 3, c = 0; h < l; ) {
694
+ if (g = (t - s) * (l - h), d = (t - f) * (l - o), w = d - g, Math.abs(w) < Se ? i = 2 * Se : i = 2 * w, p = t - ((t - f) * d - (t - s) * g) / i, P = t + e * (f - t), c > n)
676
695
  throw new Error("Too many iterations.");
677
696
  if (c += 1, (p - f) * (t - p) > 0) {
678
697
  if (u = r(p), a += 1, u < h)
679
698
  return s = t, t = p, o = l, l = u, [s, t, f, o, l, h, a];
680
699
  if (u > l)
681
700
  return f = p, h = u, [s, t, f, o, l, h, a];
682
- p = f + Bt * (f - t), u = r(p), a += 1;
701
+ p = f + zt * (f - t), u = r(p), a += 1;
683
702
  } else
684
- (p - P) * (P - f) >= 0 ? (p = P, u = r(p), a += 1) : (p - P) * (f - p) > 0 ? (u = r(p), a += 1, u < h && (t = f, f = p, p = f + Bt * (f - t), l = h, h = u, u = r(p), a += 1)) : (p = f + Bt * (f - t), u = r(p), a += 1);
703
+ (p - P) * (P - f) >= 0 ? (p = P, u = r(p), a += 1) : (p - P) * (f - p) > 0 ? (u = r(p), a += 1, u < h && (t = f, f = p, p = f + zt * (f - t), l = h, h = u, u = r(p), a += 1)) : (p = f + zt * (f - t), u = r(p), a += 1);
685
704
  s = t, t = f, f = p, o = l, l = h, h = u;
686
705
  }
687
706
  return [s, t, f, o, l, h, a];
688
707
  }
689
- const _e = 0.381966, Ke = 1e-11;
690
- class He {
708
+ const Re = 0.381966, rs = 1e-11;
709
+ class os {
691
710
  constructor(s, t = 148e-10, e = 500) {
692
711
  q(this, "xmin");
693
712
  q(this, "fval");
@@ -703,9 +722,9 @@ class He {
703
722
  let s, t, e, n, i, o, l;
704
723
  const h = this.func, a = this.brack;
705
724
  if (a === null)
706
- [i, o, l, s, t, e, n] = Ee(h);
725
+ [i, o, l, s, t, e, n] = ke(h);
707
726
  else if (a.length === 2)
708
- [i, o, l, s, t, e, n] = Ee(h, a[0], a[1]);
727
+ [i, o, l, s, t, e, n] = ke(h, a[0], a[1]);
709
728
  else if (a.length === 3) {
710
729
  if ([i, o, l] = a, i > l && ([l, i] = [i, l]), !(i < o && o < l))
711
730
  throw new Error("Not a bracketing interval.");
@@ -726,19 +745,19 @@ class He {
726
745
  i = 1;
727
746
  let p = 0, P = 0, f;
728
747
  for (; p < this.maxiter; ) {
729
- const M = this.tol * Math.abs(o) + Ke, E = 2 * M, R = 0.5 * (g + d);
748
+ const y = this.tol * Math.abs(o) + rs, E = 2 * y, R = 0.5 * (g + d);
730
749
  if (Math.abs(o - R) < E - 0.5 * (d - g))
731
750
  break;
732
- if (Math.abs(w) <= M)
733
- o >= R ? w = g - o : w = d - o, P = _e * w;
751
+ if (Math.abs(w) <= y)
752
+ o >= R ? w = g - o : w = d - o, P = Re * w;
734
753
  else {
735
754
  const L = (o - l) * (c - u);
736
755
  let S = (o - h) * (c - a), k = (o - h) * S - (o - l) * L;
737
756
  S = 2 * (S - L), S > 0 && (k = -k), S = Math.abs(S);
738
757
  const D = w;
739
- w = P, k > S * (g - o) && k < S * (d - o) && Math.abs(k) < Math.abs(0.5 * S * D) ? (P = k * 1 / S, f = o + P, (f - g < E || d - f < E) && (R - o >= 0 ? P = M : P = -M)) : (o >= R ? w = g - o : w = d - o, P = _e * w);
758
+ w = P, k > S * (g - o) && k < S * (d - o) && Math.abs(k) < Math.abs(0.5 * S * D) ? (P = k * 1 / S, f = o + P, (f - g < E || d - f < E) && (R - o >= 0 ? P = y : P = -y)) : (o >= R ? w = g - o : w = d - o, P = Re * w);
740
759
  }
741
- Math.abs(P) < M ? P >= 0 ? f = o + M : f = o - M : f = o + P;
760
+ Math.abs(P) < y ? P >= 0 ? f = o + y : f = o - y : f = o + P;
742
761
  const v = s(f);
743
762
  i += 1, v > c ? (f < o ? g = f : d = f, v <= a || l === o ? (h = l, l = f, u = a, a = v) : (v <= u || h === o || h === l) && (h = f, u = v)) : (f >= o ? g = o : d = o, h = l, l = o, o = f, u = a, a = c, c = v), p += 1;
744
763
  }
@@ -756,11 +775,11 @@ class He {
756
775
  return this.optimize(), this.results();
757
776
  }
758
777
  }
759
- function Ce(r, s = 1e-8, t = 1e3) {
760
- const e = new He(r, s, t);
778
+ function $e(r, s = 1e-8, t = 1e3) {
779
+ const e = new os(r, s, t);
761
780
  return e.setBracket([0, 1]), e.run();
762
781
  }
763
- function qe(r) {
782
+ function Le(r) {
764
783
  if (r.__esModule) return r;
765
784
  var s = r.default;
766
785
  if (typeof s == "function") {
@@ -780,16 +799,16 @@ function qe(r) {
780
799
  }), t;
781
800
  }
782
801
  var $ = {};
783
- const ts = Object.prototype.toString;
802
+ const ls = Object.prototype.toString;
784
803
  function Ct(r) {
785
- const s = ts.call(r);
804
+ const s = ls.call(r);
786
805
  return s.endsWith("Array]") && !s.includes("Big");
787
806
  }
788
- const es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
807
+ const hs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
789
808
  __proto__: null,
790
809
  isAnyArray: Ct
791
- }, Symbol.toStringTag, { value: "Module" })), ss = /* @__PURE__ */ qe(es);
792
- function ns(r) {
810
+ }, Symbol.toStringTag, { value: "Module" })), as = /* @__PURE__ */ Le(hs);
811
+ function us(r) {
793
812
  var s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
794
813
  if (!Ct(r))
795
814
  throw new TypeError("input must be an array");
@@ -804,7 +823,7 @@ function ns(r) {
804
823
  r[l] > o && (o = r[l]);
805
824
  return o;
806
825
  }
807
- function is(r) {
826
+ function cs(r) {
808
827
  var s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
809
828
  if (!Ct(r))
810
829
  throw new TypeError("input must be an array");
@@ -819,7 +838,7 @@ function is(r) {
819
838
  r[l] < o && (o = r[l]);
820
839
  return o;
821
840
  }
822
- function rs(r) {
841
+ function fs(r) {
823
842
  var s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
824
843
  if (Ct(r)) {
825
844
  if (r.length === 0)
@@ -832,7 +851,7 @@ function rs(r) {
832
851
  t = s.output;
833
852
  } else
834
853
  t = new Array(r.length);
835
- var e = is(r), n = ns(r);
854
+ var e = cs(r), n = us(r);
836
855
  if (e === n)
837
856
  throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");
838
857
  var i = s.min, o = i === void 0 ? s.autoMinMax ? e : 0 : i, l = s.max, h = l === void 0 ? s.autoMinMax ? n : 1 : l;
@@ -842,17 +861,17 @@ function rs(r) {
842
861
  t[u] = (r[u] - e) * a + o;
843
862
  return t;
844
863
  }
845
- const os = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
864
+ const ms = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
846
865
  __proto__: null,
847
- default: rs
848
- }, Symbol.toStringTag, { value: "Module" })), ls = /* @__PURE__ */ qe(os);
866
+ default: fs
867
+ }, Symbol.toStringTag, { value: "Module" })), gs = /* @__PURE__ */ Le(ms);
849
868
  Object.defineProperty($, "__esModule", { value: !0 });
850
- var st = ss, je = ls;
851
- const Ut = " ".repeat(2), Fe = " ".repeat(4);
852
- function hs() {
853
- return xe(this);
869
+ var st = as, ve = gs;
870
+ const Ut = " ".repeat(2), De = " ".repeat(4);
871
+ function ws() {
872
+ return Oe(this);
854
873
  }
855
- function xe(r, s = {}) {
874
+ function Oe(r, s = {}) {
856
875
  const {
857
876
  maxRows: t = 15,
858
877
  maxColumns: e = 10,
@@ -861,13 +880,13 @@ function xe(r, s = {}) {
861
880
  } = s;
862
881
  return `${r.constructor.name} {
863
882
  ${Ut}[
864
- ${Fe}${as(r, t, e, n, i)}
883
+ ${De}${ps(r, t, e, n, i)}
865
884
  ${Ut}]
866
885
  ${Ut}rows: ${r.rows}
867
886
  ${Ut}columns: ${r.columns}
868
887
  }`;
869
888
  }
870
- function as(r, s, t, e, n) {
889
+ function ps(r, s, t, e, n) {
871
890
  const { rows: i, columns: o } = r, l = Math.min(i, s), h = Math.min(o, t), a = [];
872
891
  if (n === "auto") {
873
892
  n = !1;
@@ -881,16 +900,16 @@ function as(r, s, t, e, n) {
881
900
  for (let u = 0; u < l; u++) {
882
901
  let c = [];
883
902
  for (let g = 0; g < h; g++)
884
- c.push(us(r.get(u, g), e, n));
903
+ c.push(ds(r.get(u, g), e, n));
885
904
  a.push(`${c.join(" ")}`);
886
905
  }
887
906
  return h !== o && (a[a.length - 1] += ` ... ${o - t} more columns`), l !== i && a.push(`... ${i - s} more rows`), a.join(`
888
- ${Fe}`);
907
+ ${De}`);
889
908
  }
890
- function us(r, s, t) {
891
- return (r >= 0 && t ? ` ${Se(r, s - 1)}` : Se(r, s)).padEnd(s);
909
+ function ds(r, s, t) {
910
+ return (r >= 0 && t ? ` ${Ie(r, s - 1)}` : Ie(r, s)).padEnd(s);
892
911
  }
893
- function Se(r, s) {
912
+ function Ie(r, s) {
894
913
  let t = r.toString();
895
914
  if (t.length <= s) return t;
896
915
  let e = r.toFixed(s);
@@ -899,7 +918,7 @@ function Se(r, s) {
899
918
  let n = r.toExponential(s);
900
919
  return n.length > s && (n = r.toExponential(Math.max(0, s - (n.length - s)))), n.slice(0);
901
920
  }
902
- function cs(r, s) {
921
+ function ys(r, s) {
903
922
  r.prototype.add = function(e) {
904
923
  return typeof e == "number" ? this.addS(e) : this.addM(e);
905
924
  }, r.prototype.addS = function(e) {
@@ -1349,53 +1368,53 @@ function Yt(r, s) {
1349
1368
  if (typeof s != "number")
1350
1369
  throw new TypeError(`${r} must be a number`);
1351
1370
  }
1352
- function yt(r) {
1371
+ function Mt(r) {
1353
1372
  if (r.isEmpty())
1354
1373
  throw new Error("Empty matrix has no elements to index");
1355
1374
  }
1356
- function fs(r) {
1375
+ function Ms(r) {
1357
1376
  let s = Ht(r.rows);
1358
1377
  for (let t = 0; t < r.rows; ++t)
1359
1378
  for (let e = 0; e < r.columns; ++e)
1360
1379
  s[t] += r.get(t, e);
1361
1380
  return s;
1362
1381
  }
1363
- function ms(r) {
1382
+ function Ps(r) {
1364
1383
  let s = Ht(r.columns);
1365
1384
  for (let t = 0; t < r.rows; ++t)
1366
1385
  for (let e = 0; e < r.columns; ++e)
1367
1386
  s[e] += r.get(t, e);
1368
1387
  return s;
1369
1388
  }
1370
- function gs(r) {
1389
+ function bs(r) {
1371
1390
  let s = 0;
1372
1391
  for (let t = 0; t < r.rows; t++)
1373
1392
  for (let e = 0; e < r.columns; e++)
1374
1393
  s += r.get(t, e);
1375
1394
  return s;
1376
1395
  }
1377
- function ws(r) {
1396
+ function Es(r) {
1378
1397
  let s = Ht(r.rows, 1);
1379
1398
  for (let t = 0; t < r.rows; ++t)
1380
1399
  for (let e = 0; e < r.columns; ++e)
1381
1400
  s[t] *= r.get(t, e);
1382
1401
  return s;
1383
1402
  }
1384
- function ps(r) {
1403
+ function _s(r) {
1385
1404
  let s = Ht(r.columns, 1);
1386
1405
  for (let t = 0; t < r.rows; ++t)
1387
1406
  for (let e = 0; e < r.columns; ++e)
1388
1407
  s[e] *= r.get(t, e);
1389
1408
  return s;
1390
1409
  }
1391
- function ds(r) {
1410
+ function js(r) {
1392
1411
  let s = 1;
1393
1412
  for (let t = 0; t < r.rows; t++)
1394
1413
  for (let e = 0; e < r.columns; e++)
1395
1414
  s *= r.get(t, e);
1396
1415
  return s;
1397
1416
  }
1398
- function Ms(r, s, t) {
1417
+ function Ss(r, s, t) {
1399
1418
  const e = r.rows, n = r.columns, i = [];
1400
1419
  for (let o = 0; o < e; o++) {
1401
1420
  let l = 0, h = 0, a = 0;
@@ -1405,7 +1424,7 @@ function Ms(r, s, t) {
1405
1424
  }
1406
1425
  return i;
1407
1426
  }
1408
- function ys(r, s, t) {
1427
+ function ks(r, s, t) {
1409
1428
  const e = r.rows, n = r.columns, i = [];
1410
1429
  for (let o = 0; o < n; o++) {
1411
1430
  let l = 0, h = 0, a = 0;
@@ -1415,7 +1434,7 @@ function ys(r, s, t) {
1415
1434
  }
1416
1435
  return i;
1417
1436
  }
1418
- function Ps(r, s, t) {
1437
+ function Rs(r, s, t) {
1419
1438
  const e = r.rows, n = r.columns, i = e * n;
1420
1439
  let o = 0, l = 0, h = 0;
1421
1440
  for (let a = 0; a < e; a++)
@@ -1423,22 +1442,22 @@ function Ps(r, s, t) {
1423
1442
  h = r.get(a, u) - t, o += h, l += h * h;
1424
1443
  return s ? (l - o * o / i) / (i - 1) : (l - o * o / i) / i;
1425
1444
  }
1426
- function bs(r, s) {
1445
+ function vs(r, s) {
1427
1446
  for (let t = 0; t < r.rows; t++)
1428
1447
  for (let e = 0; e < r.columns; e++)
1429
1448
  r.set(t, e, r.get(t, e) - s[t]);
1430
1449
  }
1431
- function Es(r, s) {
1450
+ function Is(r, s) {
1432
1451
  for (let t = 0; t < r.rows; t++)
1433
1452
  for (let e = 0; e < r.columns; e++)
1434
1453
  r.set(t, e, r.get(t, e) - s[e]);
1435
1454
  }
1436
- function _s(r, s) {
1455
+ function Ts(r, s) {
1437
1456
  for (let t = 0; t < r.rows; t++)
1438
1457
  for (let e = 0; e < r.columns; e++)
1439
1458
  r.set(t, e, r.get(t, e) - s);
1440
1459
  }
1441
- function js(r) {
1460
+ function Cs(r) {
1442
1461
  const s = [];
1443
1462
  for (let t = 0; t < r.rows; t++) {
1444
1463
  let e = 0;
@@ -1448,12 +1467,12 @@ function js(r) {
1448
1467
  }
1449
1468
  return s;
1450
1469
  }
1451
- function Ss(r, s) {
1470
+ function qs(r, s) {
1452
1471
  for (let t = 0; t < r.rows; t++)
1453
1472
  for (let e = 0; e < r.columns; e++)
1454
1473
  r.set(t, e, r.get(t, e) / s[t]);
1455
1474
  }
1456
- function ks(r) {
1475
+ function As(r) {
1457
1476
  const s = [];
1458
1477
  for (let t = 0; t < r.columns; t++) {
1459
1478
  let e = 0;
@@ -1463,12 +1482,12 @@ function ks(r) {
1463
1482
  }
1464
1483
  return s;
1465
1484
  }
1466
- function Rs(r, s) {
1485
+ function Fs(r, s) {
1467
1486
  for (let t = 0; t < r.rows; t++)
1468
1487
  for (let e = 0; e < r.columns; e++)
1469
1488
  r.set(t, e, r.get(t, e) / s[e]);
1470
1489
  }
1471
- function vs(r) {
1490
+ function xs(r) {
1472
1491
  const s = r.size - 1;
1473
1492
  let t = 0;
1474
1493
  for (let e = 0; e < r.columns; e++)
@@ -1476,12 +1495,12 @@ function vs(r) {
1476
1495
  t += r.get(n, e) ** 2 / s;
1477
1496
  return Math.sqrt(t);
1478
1497
  }
1479
- function Ts(r, s) {
1498
+ function Ns(r, s) {
1480
1499
  for (let t = 0; t < r.rows; t++)
1481
1500
  for (let e = 0; e < r.columns; e++)
1482
1501
  r.set(t, e, r.get(t, e) / s);
1483
1502
  }
1484
- class V {
1503
+ class N {
1485
1504
  static from1DArray(s, t, e) {
1486
1505
  if (s * t !== e.length)
1487
1506
  throw new RangeError("data length does not match given dimensions");
@@ -1566,7 +1585,7 @@ class V {
1566
1585
  return i;
1567
1586
  }
1568
1587
  static checkMatrix(s) {
1569
- return V.isMatrix(s) ? s : new _(s);
1588
+ return N.isMatrix(s) ? s : new _(s);
1570
1589
  }
1571
1590
  static isMatrix(s) {
1572
1591
  return s != null && s.klass === "Matrix";
@@ -1871,7 +1890,7 @@ class V {
1871
1890
  }
1872
1891
  }
1873
1892
  maxIndex() {
1874
- yt(this);
1893
+ Mt(this);
1875
1894
  let s = this.get(0, 0), t = [0, 0];
1876
1895
  for (let e = 0; e < this.rows; e++)
1877
1896
  for (let n = 0; n < this.columns; n++)
@@ -1908,7 +1927,7 @@ class V {
1908
1927
  }
1909
1928
  }
1910
1929
  minIndex() {
1911
- yt(this);
1930
+ Mt(this);
1912
1931
  let s = this.get(0, 0), t = [0, 0];
1913
1932
  for (let e = 0; e < this.rows; e++)
1914
1933
  for (let n = 0; n < this.columns; n++)
@@ -1924,7 +1943,7 @@ class V {
1924
1943
  return t;
1925
1944
  }
1926
1945
  maxRowIndex(s) {
1927
- ot(this, s), yt(this);
1946
+ ot(this, s), Mt(this);
1928
1947
  let t = this.get(s, 0), e = [s, 0];
1929
1948
  for (let n = 1; n < this.columns; n++)
1930
1949
  this.get(s, n) > t && (t = this.get(s, n), e[1] = n);
@@ -1939,7 +1958,7 @@ class V {
1939
1958
  return t;
1940
1959
  }
1941
1960
  minRowIndex(s) {
1942
- ot(this, s), yt(this);
1961
+ ot(this, s), Mt(this);
1943
1962
  let t = this.get(s, 0), e = [s, 0];
1944
1963
  for (let n = 1; n < this.columns; n++)
1945
1964
  this.get(s, n) < t && (t = this.get(s, n), e[1] = n);
@@ -1954,7 +1973,7 @@ class V {
1954
1973
  return t;
1955
1974
  }
1956
1975
  maxColumnIndex(s) {
1957
- lt(this, s), yt(this);
1976
+ lt(this, s), Mt(this);
1958
1977
  let t = this.get(0, s), e = [0, s];
1959
1978
  for (let n = 1; n < this.rows; n++)
1960
1979
  this.get(n, s) > t && (t = this.get(n, s), e[0] = n);
@@ -1969,7 +1988,7 @@ class V {
1969
1988
  return t;
1970
1989
  }
1971
1990
  minColumnIndex(s) {
1972
- lt(this, s), yt(this);
1991
+ lt(this, s), Mt(this);
1973
1992
  let t = this.get(0, s), e = [0, s];
1974
1993
  for (let n = 1; n < this.rows; n++)
1975
1994
  this.get(n, s) < t && (t = this.get(n, s), e[0] = n);
@@ -1999,7 +2018,7 @@ class V {
1999
2018
  return this;
2000
2019
  }
2001
2020
  dot(s) {
2002
- V.isMatrix(s) && (s = s.to1DArray());
2021
+ N.isMatrix(s) && (s = s.to1DArray());
2003
2022
  let t = this.to1DArray();
2004
2023
  if (t.length !== s.length)
2005
2024
  throw new RangeError("vectors do not have the same size");
@@ -2036,14 +2055,14 @@ class V {
2036
2055
  strassen2x2(s) {
2037
2056
  s = _.checkMatrix(s);
2038
2057
  let t = new _(2, 2);
2039
- 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
- return t.set(0, 0, M), t.set(0, 1, E), t.set(1, 0, R), t.set(1, 1, v), t;
2058
+ 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), y = c + w - p + f, E = d + p, R = g + w, v = c - g + d + P;
2059
+ return t.set(0, 0, y), t.set(0, 1, E), t.set(1, 0, R), t.set(1, 1, v), t;
2041
2060
  }
2042
2061
  strassen3x3(s) {
2043
2062
  s = _.checkMatrix(s);
2044
2063
  let t = new _(3, 3);
2045
- 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
- 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;
2064
+ 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), y = 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 - y + 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), M = (a + u) * (-g + w), C = (e + n + i - l - h - a - u) * f, A = u * (-g + w + p - P - f - y + E), T = (-i + u + c) * (P + y - E), z = (i - c) * (P - E), F = i * y, V = (u + c) * (-y + E), x = (-i + l + h) * (f + y - R), B = (i - h) * (f - R), U = (l + h) * (-y + R), I = n * p, O = h * E, X = o * w, G = a * d, W = c * R, se = m + F + I, ne = v + k + D + m + T + F + V, ie = m + b + M + C + F + x + U, re = L + S + k + m + F + x + B, xt = L + k + D + m + O, Nt = F + x + B + U + X, Vt = m + b + j + A + T + z + F, $t = T + z + F + V + G, Lt = m + b + j + M + W;
2065
+ 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, xt), t.set(1, 2, Nt), t.set(2, 0, Vt), t.set(2, 1, $t), t.set(2, 2, Lt), t;
2047
2066
  }
2048
2067
  mmulStrassen(s) {
2049
2068
  s = _.checkMatrix(s);
@@ -2056,7 +2075,7 @@ class V {
2056
2075
  if (w === g && p === d)
2057
2076
  return c;
2058
2077
  {
2059
- let P = V.zeros(g, d);
2078
+ let P = N.zeros(g, d);
2060
2079
  return P = P.setSubMatrix(c, 0, 0), P;
2061
2080
  }
2062
2081
  }
@@ -2066,27 +2085,27 @@ class V {
2066
2085
  if (d <= 512 || w <= 512)
2067
2086
  return c.mmul(g);
2068
2087
  d % 2 === 1 && w % 2 === 1 ? (c = l(c, d + 1, w + 1), g = l(g, d + 1, w + 1)) : d % 2 === 1 ? (c = l(c, d + 1, w), g = l(g, d + 1, w)) : w % 2 === 1 && (c = l(c, d, w + 1), g = l(g, d, w + 1));
2069
- let p = parseInt(c.rows / 2, 10), P = parseInt(c.columns / 2, 10), f = c.subMatrix(0, p - 1, 0, P - 1), M = g.subMatrix(0, p - 1, 0, P - 1), E = c.subMatrix(0, p - 1, P, c.columns - 1), R = g.subMatrix(0, p - 1, P, g.columns - 1), v = c.subMatrix(p, c.rows - 1, 0, P - 1), L = g.subMatrix(p, g.rows - 1, 0, P - 1), S = c.subMatrix(p, c.rows - 1, P, c.columns - 1), k = g.subMatrix(p, g.rows - 1, P, g.columns - 1), D = u(
2070
- V.add(f, S),
2071
- V.add(M, k),
2088
+ let p = parseInt(c.rows / 2, 10), P = parseInt(c.columns / 2, 10), f = c.subMatrix(0, p - 1, 0, P - 1), y = g.subMatrix(0, p - 1, 0, P - 1), E = c.subMatrix(0, p - 1, P, c.columns - 1), R = g.subMatrix(0, p - 1, P, g.columns - 1), v = c.subMatrix(p, c.rows - 1, 0, P - 1), L = g.subMatrix(p, g.rows - 1, 0, P - 1), S = c.subMatrix(p, c.rows - 1, P, c.columns - 1), k = g.subMatrix(p, g.rows - 1, P, g.columns - 1), D = u(
2089
+ N.add(f, S),
2090
+ N.add(y, k),
2072
2091
  p,
2073
2092
  P
2074
- ), m = u(V.add(v, S), M, p, P), b = u(f, V.sub(R, k), p, P), j = u(S, V.sub(L, M), p, P), y = u(V.add(f, E), k, p, P), C = u(
2075
- V.sub(v, f),
2076
- V.add(M, R),
2093
+ ), m = u(N.add(v, S), y, p, P), b = u(f, N.sub(R, k), p, P), j = u(S, N.sub(L, y), p, P), M = u(N.add(f, E), k, p, P), C = u(
2094
+ N.sub(v, f),
2095
+ N.add(y, R),
2077
2096
  p,
2078
2097
  P
2079
- ), F = u(
2080
- V.sub(E, S),
2081
- V.add(L, k),
2098
+ ), A = u(
2099
+ N.sub(E, S),
2100
+ N.add(L, k),
2082
2101
  p,
2083
2102
  P
2084
- ), I = V.add(D, j);
2085
- I.sub(y), I.add(F);
2086
- let B = V.add(b, y), x = V.add(m, j), N = V.sub(D, m);
2087
- N.add(b), N.add(C);
2088
- let A = V.zeros(2 * I.rows, 2 * I.columns);
2089
- return A = A.setSubMatrix(I, 0, 0), A = A.setSubMatrix(B, I.rows, 0), A = A.setSubMatrix(x, 0, I.columns), A = A.setSubMatrix(N, I.rows, I.columns), A.subMatrix(0, d - 1, 0, w - 1);
2103
+ ), T = N.add(D, j);
2104
+ T.sub(M), T.add(A);
2105
+ let z = N.add(b, M), F = N.add(m, j), V = N.sub(D, m);
2106
+ V.add(b), V.add(C);
2107
+ let x = N.zeros(2 * T.rows, 2 * T.columns);
2108
+ return x = x.setSubMatrix(T, 0, 0), x = x.setSubMatrix(z, T.rows, 0), x = x.setSubMatrix(F, 0, T.columns), x = x.setSubMatrix(V, T.rows, T.columns), x.subMatrix(0, d - 1, 0, w - 1);
2090
2109
  }
2091
2110
  return u(t, s, h, a);
2092
2111
  }
@@ -2100,7 +2119,7 @@ class V {
2100
2119
  let n = new _(this.rows, this.columns);
2101
2120
  for (let i = 0; i < this.rows; i++) {
2102
2121
  const o = this.getRow(i);
2103
- o.length > 0 && je(o, { min: t, max: e, output: o }), n.setRow(i, o);
2122
+ o.length > 0 && ve(o, { min: t, max: e, output: o }), n.setRow(i, o);
2104
2123
  }
2105
2124
  return n;
2106
2125
  }
@@ -2114,7 +2133,7 @@ class V {
2114
2133
  let n = new _(this.rows, this.columns);
2115
2134
  for (let i = 0; i < this.columns; i++) {
2116
2135
  const o = this.getColumn(i);
2117
- o.length && je(o, {
2136
+ o.length && ve(o, {
2118
2137
  min: t,
2119
2138
  max: e,
2120
2139
  output: o
@@ -2163,12 +2182,12 @@ class V {
2163
2182
  s.set(e, t, this.get(t, e));
2164
2183
  return s;
2165
2184
  }
2166
- sortRows(s = ke) {
2185
+ sortRows(s = Te) {
2167
2186
  for (let t = 0; t < this.rows; t++)
2168
2187
  this.setRow(t, this.getRow(t).sort(s));
2169
2188
  return this;
2170
2189
  }
2171
- sortColumns(s = ke) {
2190
+ sortColumns(s = Te) {
2172
2191
  for (let t = 0; t < this.columns; t++)
2173
2192
  this.setColumn(t, this.getColumn(t).sort(s));
2174
2193
  return this;
@@ -2253,11 +2272,11 @@ class V {
2253
2272
  sum(s) {
2254
2273
  switch (s) {
2255
2274
  case "row":
2256
- return fs(this);
2275
+ return Ms(this);
2257
2276
  case "column":
2258
- return ms(this);
2277
+ return Ps(this);
2259
2278
  case void 0:
2260
- return gs(this);
2279
+ return bs(this);
2261
2280
  default:
2262
2281
  throw new Error(`invalid option: ${s}`);
2263
2282
  }
@@ -2265,11 +2284,11 @@ class V {
2265
2284
  product(s) {
2266
2285
  switch (s) {
2267
2286
  case "row":
2268
- return ws(this);
2287
+ return Es(this);
2269
2288
  case "column":
2270
- return ps(this);
2289
+ return _s(this);
2271
2290
  case void 0:
2272
- return ds(this);
2291
+ return js(this);
2273
2292
  default:
2274
2293
  throw new Error(`invalid option: ${s}`);
2275
2294
  }
@@ -2303,17 +2322,17 @@ class V {
2303
2322
  case "row": {
2304
2323
  if (!st.isAnyArray(n))
2305
2324
  throw new TypeError("mean must be an array");
2306
- return Ms(this, e, n);
2325
+ return Ss(this, e, n);
2307
2326
  }
2308
2327
  case "column": {
2309
2328
  if (!st.isAnyArray(n))
2310
2329
  throw new TypeError("mean must be an array");
2311
- return ys(this, e, n);
2330
+ return ks(this, e, n);
2312
2331
  }
2313
2332
  case void 0: {
2314
2333
  if (typeof n != "number")
2315
2334
  throw new TypeError("mean must be a number");
2316
- return Ps(this, e, n);
2335
+ return Rs(this, e, n);
2317
2336
  }
2318
2337
  default:
2319
2338
  throw new Error(`invalid option: ${s}`);
@@ -2336,17 +2355,17 @@ class V {
2336
2355
  case "row": {
2337
2356
  if (!st.isAnyArray(e))
2338
2357
  throw new TypeError("center must be an array");
2339
- return bs(this, e), this;
2358
+ return vs(this, e), this;
2340
2359
  }
2341
2360
  case "column": {
2342
2361
  if (!st.isAnyArray(e))
2343
2362
  throw new TypeError("center must be an array");
2344
- return Es(this, e), this;
2363
+ return Is(this, e), this;
2345
2364
  }
2346
2365
  case void 0: {
2347
2366
  if (typeof e != "number")
2348
2367
  throw new TypeError("center must be a number");
2349
- return _s(this, e), this;
2368
+ return Ts(this, e), this;
2350
2369
  }
2351
2370
  default:
2352
2371
  throw new Error(`invalid option: ${s}`);
@@ -2359,31 +2378,31 @@ class V {
2359
2378
  switch (s) {
2360
2379
  case "row": {
2361
2380
  if (e === void 0)
2362
- e = js(this);
2381
+ e = Cs(this);
2363
2382
  else if (!st.isAnyArray(e))
2364
2383
  throw new TypeError("scale must be an array");
2365
- return Ss(this, e), this;
2384
+ return qs(this, e), this;
2366
2385
  }
2367
2386
  case "column": {
2368
2387
  if (e === void 0)
2369
- e = ks(this);
2388
+ e = As(this);
2370
2389
  else if (!st.isAnyArray(e))
2371
2390
  throw new TypeError("scale must be an array");
2372
- return Rs(this, e), this;
2391
+ return Fs(this, e), this;
2373
2392
  }
2374
2393
  case void 0: {
2375
2394
  if (e === void 0)
2376
- e = vs(this);
2395
+ e = xs(this);
2377
2396
  else if (typeof e != "number")
2378
2397
  throw new TypeError("scale must be a number");
2379
- return Ts(this, e), this;
2398
+ return Ns(this, e), this;
2380
2399
  }
2381
2400
  default:
2382
2401
  throw new Error(`invalid option: ${s}`);
2383
2402
  }
2384
2403
  }
2385
2404
  toString(s) {
2386
- return xe(this, s);
2405
+ return Oe(this, s);
2387
2406
  }
2388
2407
  [Symbol.iterator]() {
2389
2408
  return this.entries();
@@ -2409,34 +2428,34 @@ class V {
2409
2428
  yield this.get(s, t);
2410
2429
  }
2411
2430
  }
2412
- V.prototype.klass = "Matrix";
2413
- typeof Symbol < "u" && (V.prototype[Symbol.for("nodejs.util.inspect.custom")] = hs);
2414
- function ke(r, s) {
2431
+ N.prototype.klass = "Matrix";
2432
+ typeof Symbol < "u" && (N.prototype[Symbol.for("nodejs.util.inspect.custom")] = ws);
2433
+ function Te(r, s) {
2415
2434
  return r - s;
2416
2435
  }
2417
- function Is(r) {
2436
+ function Vs(r) {
2418
2437
  return r.every((s) => typeof s == "number");
2419
2438
  }
2420
- V.random = V.rand;
2421
- V.randomInt = V.randInt;
2422
- V.diagonal = V.diag;
2423
- V.prototype.diagonal = V.prototype.diag;
2424
- V.identity = V.eye;
2425
- V.prototype.negate = V.prototype.neg;
2426
- V.prototype.tensorProduct = V.prototype.kroneckerProduct;
2427
- var Ft, ue, dt;
2428
- let _ = (dt = class extends V {
2439
+ N.random = N.rand;
2440
+ N.randomInt = N.randInt;
2441
+ N.diagonal = N.diag;
2442
+ N.prototype.diagonal = N.prototype.diag;
2443
+ N.identity = N.eye;
2444
+ N.prototype.negate = N.prototype.neg;
2445
+ N.prototype.tensorProduct = N.prototype.kroneckerProduct;
2446
+ var At, ue, dt;
2447
+ let _ = (dt = class extends N {
2429
2448
  constructor(t, e) {
2430
2449
  super();
2431
- le(this, Ft);
2450
+ le(this, At);
2432
2451
  /**
2433
2452
  * @type {Float64Array[]}
2434
2453
  */
2435
2454
  q(this, "data");
2436
2455
  if (dt.isMatrix(t))
2437
- he(this, Ft, ue).call(this, t.rows, t.columns), dt.copy(t, this);
2456
+ he(this, At, ue).call(this, t.rows, t.columns), dt.copy(t, this);
2438
2457
  else if (Number.isInteger(t) && t >= 0)
2439
- he(this, Ft, ue).call(this, t, e);
2458
+ he(this, At, ue).call(this, t, e);
2440
2459
  else if (st.isAnyArray(t)) {
2441
2460
  const n = t;
2442
2461
  if (t = n.length, e = t ? n[0].length : 0, typeof e != "number")
@@ -2447,7 +2466,7 @@ let _ = (dt = class extends V {
2447
2466
  for (let i = 0; i < t; i++) {
2448
2467
  if (n[i].length !== e)
2449
2468
  throw new RangeError("Inconsistent array dimensions");
2450
- if (!Is(n[i]))
2469
+ if (!Vs(n[i]))
2451
2470
  throw new TypeError("Input data contains non-numeric values");
2452
2471
  this.data.push(Float64Array.from(n[i]));
2453
2472
  }
@@ -2494,7 +2513,7 @@ let _ = (dt = class extends V {
2494
2513
  }
2495
2514
  return this.columns += 1, this;
2496
2515
  }
2497
- }, Ft = new WeakSet(), /**
2516
+ }, At = new WeakSet(), /**
2498
2517
  * Init an empty matrix
2499
2518
  * @param {number} nRows
2500
2519
  * @param {number} nColumns
@@ -2507,9 +2526,9 @@ ue = function(t, e) {
2507
2526
  throw new TypeError("nColumns must be a positive integer");
2508
2527
  this.rows = t, this.columns = e;
2509
2528
  }, dt);
2510
- cs(V, _);
2529
+ ys(N, _);
2511
2530
  var K;
2512
- const Jt = class Jt extends V {
2531
+ const Jt = class Jt extends N {
2513
2532
  /**
2514
2533
  * @param {number | AbstractMatrix | ArrayLike<ArrayLike<number>>} diagonalSize
2515
2534
  * @return {this}
@@ -2746,12 +2765,12 @@ class te extends pt {
2746
2765
  }
2747
2766
  }
2748
2767
  te.prototype.klassSubType = "DistanceMatrix";
2749
- class ft extends V {
2768
+ class ft extends N {
2750
2769
  constructor(s, t, e) {
2751
2770
  super(), this.matrix = s, this.rows = t, this.columns = e;
2752
2771
  }
2753
2772
  }
2754
- class Cs extends ft {
2773
+ class $s extends ft {
2755
2774
  constructor(s, t) {
2756
2775
  lt(s, t), super(s, s.rows, 1), this.column = t;
2757
2776
  }
@@ -2762,7 +2781,7 @@ class Cs extends ft {
2762
2781
  return this.matrix.get(s, this.column);
2763
2782
  }
2764
2783
  }
2765
- class qs extends ft {
2784
+ class Ls extends ft {
2766
2785
  constructor(s, t) {
2767
2786
  we(s, t), super(s, s.rows, t.length), this.columnIndices = t;
2768
2787
  }
@@ -2773,7 +2792,7 @@ class qs extends ft {
2773
2792
  return this.matrix.get(s, this.columnIndices[t]);
2774
2793
  }
2775
2794
  }
2776
- class Fs extends ft {
2795
+ class Ds extends ft {
2777
2796
  constructor(s) {
2778
2797
  super(s, s.rows, s.columns);
2779
2798
  }
@@ -2784,7 +2803,7 @@ class Fs extends ft {
2784
2803
  return this.matrix.get(s, this.columns - t - 1);
2785
2804
  }
2786
2805
  }
2787
- class xs extends ft {
2806
+ class Os extends ft {
2788
2807
  constructor(s) {
2789
2808
  super(s, s.rows, s.columns);
2790
2809
  }
@@ -2795,7 +2814,7 @@ class xs extends ft {
2795
2814
  return this.matrix.get(this.rows - s - 1, t);
2796
2815
  }
2797
2816
  }
2798
- class As extends ft {
2817
+ class Bs extends ft {
2799
2818
  constructor(s, t) {
2800
2819
  ot(s, t), super(s, 1, s.columns), this.row = t;
2801
2820
  }
@@ -2806,7 +2825,7 @@ class As extends ft {
2806
2825
  return this.matrix.get(this.row, t);
2807
2826
  }
2808
2827
  }
2809
- class Vs extends ft {
2828
+ class zs extends ft {
2810
2829
  constructor(s, t) {
2811
2830
  ge(s, t), super(s, t.length, s.columns), this.rowIndices = t;
2812
2831
  }
@@ -2835,7 +2854,7 @@ class Gt extends ft {
2835
2854
  );
2836
2855
  }
2837
2856
  }
2838
- class Ns extends ft {
2857
+ class Us extends ft {
2839
2858
  constructor(s, t, e, n, i) {
2840
2859
  ae(s, t, e, n, i), super(s, e - t + 1, i - n + 1), this.startRow = t, this.startColumn = n;
2841
2860
  }
@@ -2853,7 +2872,7 @@ class Ns extends ft {
2853
2872
  );
2854
2873
  }
2855
2874
  }
2856
- class $s extends ft {
2875
+ class Ys extends ft {
2857
2876
  constructor(s) {
2858
2877
  super(s, s.columns, s.rows);
2859
2878
  }
@@ -2864,7 +2883,7 @@ class $s extends ft {
2864
2883
  return this.matrix.get(t, s);
2865
2884
  }
2866
2885
  }
2867
- class Ae extends V {
2886
+ class Be extends N {
2868
2887
  constructor(s, t = {}) {
2869
2888
  const { rows: e = 1 } = t;
2870
2889
  if (s.length % e !== 0)
@@ -2883,7 +2902,7 @@ class Ae extends V {
2883
2902
  return s * this.columns + t;
2884
2903
  }
2885
2904
  }
2886
- class rt extends V {
2905
+ class rt extends N {
2887
2906
  constructor(s) {
2888
2907
  super(), this.data = s, this.rows = s.length, this.columns = s[0].length;
2889
2908
  }
@@ -2894,9 +2913,9 @@ class rt extends V {
2894
2913
  return this.data[s][t];
2895
2914
  }
2896
2915
  }
2897
- function Ls(r, s) {
2916
+ function Ws(r, s) {
2898
2917
  if (st.isAnyArray(r))
2899
- return r[0] && st.isAnyArray(r[0]) ? new rt(r) : new Ae(r, s);
2918
+ return r[0] && st.isAnyArray(r[0]) ? new rt(r) : new Be(r, s);
2900
2919
  throw new Error("the argument is not an array");
2901
2920
  }
2902
2921
  class ee {
@@ -3084,7 +3103,7 @@ class vt {
3084
3103
  }
3085
3104
  else
3086
3105
  c = s.clone();
3087
- let g = Math.min(e, n), d = Math.min(e + 1, n), w = new Float64Array(d), p = new _(e, g), P = new _(n, n), f = new Float64Array(n), M = new Float64Array(e), E = new Float64Array(d);
3106
+ let g = Math.min(e, n), d = Math.min(e + 1, n), w = new Float64Array(d), p = new _(e, g), P = new _(n, n), f = new Float64Array(n), y = new Float64Array(e), E = new Float64Array(d);
3088
3107
  for (let m = 0; m < d; m++) E[m] = m;
3089
3108
  let R = Math.min(e - 1, n), v = Math.max(0, Math.min(n - 2, e)), L = Math.max(R, v);
3090
3109
  for (let m = 0; m < L; m++) {
@@ -3103,11 +3122,11 @@ class vt {
3103
3122
  for (let b = m + 1; b < n; b++) {
3104
3123
  if (m < R && w[m] !== 0) {
3105
3124
  let j = 0;
3106
- for (let y = m; y < e; y++)
3107
- j += c.get(y, m) * c.get(y, b);
3125
+ for (let M = m; M < e; M++)
3126
+ j += c.get(M, m) * c.get(M, b);
3108
3127
  j = -j / c.get(m, m);
3109
- for (let y = m; y < e; y++)
3110
- c.set(y, b, c.get(y, b) + j * c.get(y, m));
3128
+ for (let M = m; M < e; M++)
3129
+ c.set(M, b, c.get(M, b) + j * c.get(M, m));
3111
3130
  }
3112
3131
  f[b] = c.get(m, b);
3113
3132
  }
@@ -3126,14 +3145,14 @@ class vt {
3126
3145
  }
3127
3146
  if (f[m] = -f[m], m + 1 < e && f[m] !== 0) {
3128
3147
  for (let b = m + 1; b < e; b++)
3129
- M[b] = 0;
3148
+ y[b] = 0;
3130
3149
  for (let b = m + 1; b < e; b++)
3131
3150
  for (let j = m + 1; j < n; j++)
3132
- M[b] += f[j] * c.get(b, j);
3151
+ y[b] += f[j] * c.get(b, j);
3133
3152
  for (let b = m + 1; b < n; b++) {
3134
3153
  let j = -f[b] / f[m + 1];
3135
- for (let y = m + 1; y < e; y++)
3136
- c.set(y, b, c.get(y, b) + j * M[y]);
3154
+ for (let M = m + 1; M < e; M++)
3155
+ c.set(M, b, c.get(M, b) + j * y[M]);
3137
3156
  }
3138
3157
  }
3139
3158
  if (a)
@@ -3152,11 +3171,11 @@ class vt {
3152
3171
  if (w[m] !== 0) {
3153
3172
  for (let b = m + 1; b < g; b++) {
3154
3173
  let j = 0;
3155
- for (let y = m; y < e; y++)
3156
- j += p.get(y, m) * p.get(y, b);
3174
+ for (let M = m; M < e; M++)
3175
+ j += p.get(M, m) * p.get(M, b);
3157
3176
  j = -j / p.get(m, m);
3158
- for (let y = m; y < e; y++)
3159
- p.set(y, b, p.get(y, b) + j * p.get(y, m));
3177
+ for (let M = m; M < e; M++)
3178
+ p.set(M, b, p.get(M, b) + j * p.get(M, m));
3160
3179
  }
3161
3180
  for (let b = m; b < e; b++)
3162
3181
  p.set(b, m, -p.get(b, m));
@@ -3174,11 +3193,11 @@ class vt {
3174
3193
  if (m < v && f[m] !== 0)
3175
3194
  for (let b = m + 1; b < n; b++) {
3176
3195
  let j = 0;
3177
- for (let y = m + 1; y < n; y++)
3178
- j += P.get(y, m) * P.get(y, b);
3196
+ for (let M = m + 1; M < n; M++)
3197
+ j += P.get(M, m) * P.get(M, b);
3179
3198
  j = -j / P.get(m + 1, m);
3180
- for (let y = m + 1; y < n; y++)
3181
- P.set(y, b, P.get(y, b) + j * P.get(y, m));
3199
+ for (let M = m + 1; M < n; M++)
3200
+ P.set(M, b, P.get(M, b) + j * P.get(M, m));
3182
3201
  }
3183
3202
  for (let b = 0; b < n; b++)
3184
3203
  P.set(b, m, 0);
@@ -3199,8 +3218,8 @@ class vt {
3199
3218
  else {
3200
3219
  let j;
3201
3220
  for (j = S - 1; j >= m && j !== m; j--) {
3202
- let y = (j !== S ? Math.abs(f[j]) : 0) + (j !== m + 1 ? Math.abs(f[j - 1]) : 0);
3203
- if (Math.abs(w[j]) <= D * y) {
3221
+ let M = (j !== S ? Math.abs(f[j]) : 0) + (j !== m + 1 ? Math.abs(f[j - 1]) : 0);
3222
+ if (Math.abs(w[j]) <= D * M) {
3204
3223
  w[j] = 0;
3205
3224
  break;
3206
3225
  }
@@ -3211,22 +3230,22 @@ class vt {
3211
3230
  case 1: {
3212
3231
  let j = f[S - 2];
3213
3232
  f[S - 2] = 0;
3214
- for (let y = S - 2; y >= m; y--) {
3215
- let C = ut(w[y], j), F = w[y] / C, I = j / C;
3216
- if (w[y] = C, y !== m && (j = -I * f[y - 1], f[y - 1] = F * f[y - 1]), a)
3217
- for (let B = 0; B < n; B++)
3218
- 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);
3233
+ for (let M = S - 2; M >= m; M--) {
3234
+ let C = ut(w[M], j), A = w[M] / C, T = j / C;
3235
+ if (w[M] = C, M !== m && (j = -T * f[M - 1], f[M - 1] = A * f[M - 1]), a)
3236
+ for (let z = 0; z < n; z++)
3237
+ C = A * P.get(z, M) + T * P.get(z, S - 1), P.set(z, S - 1, -T * P.get(z, M) + A * P.get(z, S - 1)), P.set(z, M, C);
3219
3238
  }
3220
3239
  break;
3221
3240
  }
3222
3241
  case 2: {
3223
3242
  let j = f[m - 1];
3224
3243
  f[m - 1] = 0;
3225
- for (let y = m; y < S; y++) {
3226
- let C = ut(w[y], j), F = w[y] / C, I = j / C;
3227
- if (w[y] = C, j = -I * f[y], f[y] = F * f[y], h)
3228
- for (let B = 0; B < e; B++)
3229
- 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);
3244
+ for (let M = m; M < S; M++) {
3245
+ let C = ut(w[M], j), A = w[M] / C, T = j / C;
3246
+ if (w[M] = C, j = -T * f[M], f[M] = A * f[M], h)
3247
+ for (let z = 0; z < e; z++)
3248
+ C = A * p.get(z, M) + T * p.get(z, m - 1), p.set(z, m - 1, -T * p.get(z, M) + A * p.get(z, m - 1)), p.set(z, M, C);
3230
3249
  }
3231
3250
  break;
3232
3251
  }
@@ -3237,22 +3256,22 @@ class vt {
3237
3256
  Math.abs(f[S - 2]),
3238
3257
  Math.abs(w[m]),
3239
3258
  Math.abs(f[m])
3240
- ), y = w[S - 1] / j, C = w[S - 2] / j, F = f[S - 2] / j, I = w[m] / j, B = f[m] / j, x = ((C + y) * (C - y) + F * F) / 2, N = y * F * (y * F);
3241
- let A = 0;
3242
- (x !== 0 || N !== 0) && (x < 0 ? A = 0 - Math.sqrt(x * x + N) : A = Math.sqrt(x * x + N), A = N / (x + A));
3243
- let O = (I + y) * (I - y) + A, U = I * B;
3244
- for (let T = m; T < S - 1; T++) {
3245
- let z = ut(O, U);
3246
- z === 0 && (z = Number.MIN_VALUE);
3247
- let X = O / z, G = U / z;
3248
- 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)
3259
+ ), M = w[S - 1] / j, C = w[S - 2] / j, A = f[S - 2] / j, T = w[m] / j, z = f[m] / j, F = ((C + M) * (C - M) + A * A) / 2, V = M * A * (M * A);
3260
+ let x = 0;
3261
+ (F !== 0 || V !== 0) && (F < 0 ? x = 0 - Math.sqrt(F * F + V) : x = Math.sqrt(F * F + V), x = V / (F + x));
3262
+ let B = (T + M) * (T - M) + x, U = T * z;
3263
+ for (let I = m; I < S - 1; I++) {
3264
+ let O = ut(B, U);
3265
+ O === 0 && (O = Number.MIN_VALUE);
3266
+ let X = B / O, G = U / O;
3267
+ if (I !== m && (f[I - 1] = O), B = X * w[I] + G * f[I], f[I] = X * f[I] - G * w[I], U = G * w[I + 1], w[I + 1] = X * w[I + 1], a)
3249
3268
  for (let W = 0; W < n; W++)
3250
- 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(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)
3269
+ O = X * P.get(W, I) + G * P.get(W, I + 1), P.set(W, I + 1, -G * P.get(W, I) + X * P.get(W, I + 1)), P.set(W, I, O);
3270
+ if (O = ut(B, U), O === 0 && (O = Number.MIN_VALUE), X = B / O, G = U / O, w[I] = O, B = X * f[I] + G * w[I + 1], w[I + 1] = -G * f[I] + X * w[I + 1], U = G * f[I + 1], f[I + 1] = X * f[I + 1], h && I < e - 1)
3252
3271
  for (let W = 0; W < e; W++)
3253
- 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);
3272
+ O = X * p.get(W, I) + G * p.get(W, I + 1), p.set(W, I + 1, -G * p.get(W, I) + X * p.get(W, I + 1)), p.set(W, I, O);
3254
3273
  }
3255
- f[S - 2] = O;
3274
+ f[S - 2] = B;
3256
3275
  break;
3257
3276
  }
3258
3277
  case 4: {
@@ -3262,11 +3281,11 @@ class vt {
3262
3281
  for (; m < k && !(w[m] >= w[m + 1]); ) {
3263
3282
  let j = w[m];
3264
3283
  if (w[m] = w[m + 1], w[m + 1] = j, a && m < n - 1)
3265
- for (let y = 0; y < n; y++)
3266
- j = P.get(y, m + 1), P.set(y, m + 1, P.get(y, m)), P.set(y, m, j);
3284
+ for (let M = 0; M < n; M++)
3285
+ j = P.get(M, m + 1), P.set(M, m + 1, P.get(M, m)), P.set(M, m, j);
3267
3286
  if (h && m < e - 1)
3268
- for (let y = 0; y < e; y++)
3269
- j = p.get(y, m + 1), p.set(y, m + 1, p.get(y, m)), p.set(y, m, j);
3287
+ for (let M = 0; M < e; M++)
3288
+ j = p.get(M, m + 1), p.set(M, m + 1, p.get(M, m)), p.set(M, m, j);
3270
3289
  m++;
3271
3290
  }
3272
3291
  S--;
@@ -3340,10 +3359,10 @@ class vt {
3340
3359
  return _.diag(this.s);
3341
3360
  }
3342
3361
  }
3343
- function Ds(r, s = !1) {
3344
- return r = rt.checkMatrix(r), s ? new vt(r).inverse() : Ve(r, _.eye(r.rows));
3362
+ function Qs(r, s = !1) {
3363
+ return r = rt.checkMatrix(r), s ? new vt(r).inverse() : ze(r, _.eye(r.rows));
3345
3364
  }
3346
- function Ve(r, s, t = !1) {
3365
+ function ze(r, s, t = !1) {
3347
3366
  return r = rt.checkMatrix(r), s = rt.checkMatrix(s), t ? new vt(r).solve(s) : r.isSquare() ? new ee(r).solve(s) : new pe(r).solve(s);
3348
3367
  }
3349
3368
  function Xt(r) {
@@ -3361,13 +3380,13 @@ function Xt(r) {
3361
3380
  } else
3362
3381
  throw Error("determinant can only be calculated for a square matrix");
3363
3382
  }
3364
- function zs(r, s) {
3383
+ function Gs(r, s) {
3365
3384
  let t = [];
3366
3385
  for (let e = 0; e < r; e++)
3367
3386
  e !== s && t.push(e);
3368
3387
  return t;
3369
3388
  }
3370
- function Os(r, s, t, e = 1e-9, n = 1e-9) {
3389
+ function Xs(r, s, t, e = 1e-9, n = 1e-9) {
3371
3390
  if (r > n)
3372
3391
  return new Array(s.rows + 1).fill(0);
3373
3392
  {
@@ -3377,20 +3396,20 @@ function Os(r, s, t, e = 1e-9, n = 1e-9) {
3377
3396
  return i.to1DArray();
3378
3397
  }
3379
3398
  }
3380
- function Bs(r, s = {}) {
3399
+ function Zs(r, s = {}) {
3381
3400
  const { thresholdValue: t = 1e-9, thresholdError: e = 1e-9 } = s;
3382
3401
  r = _.checkMatrix(r);
3383
3402
  let n = r.rows, i = new _(n, n);
3384
3403
  for (let o = 0; o < n; o++) {
3385
- let l = _.columnVector(r.getRow(o)), h = r.subMatrixRow(zs(n, o)).transpose(), u = new vt(h).solve(l), c = _.sub(l, h.mmul(u)).abs().max();
3404
+ let l = _.columnVector(r.getRow(o)), h = r.subMatrixRow(Gs(n, o)).transpose(), u = new vt(h).solve(l), c = _.sub(l, h.mmul(u)).abs().max();
3386
3405
  i.setRow(
3387
3406
  o,
3388
- Os(c, u, o, t, e)
3407
+ Xs(c, u, o, t, e)
3389
3408
  );
3390
3409
  }
3391
3410
  return i;
3392
3411
  }
3393
- function Us(r, s = Number.EPSILON) {
3412
+ function Js(r, s = Number.EPSILON) {
3394
3413
  if (r = _.checkMatrix(r), r.isEmpty())
3395
3414
  return r.transpose();
3396
3415
  let t = new vt(r, { autoTranspose: !0 }), e = t.leftSingularVectors, n = t.rightSingularVectors, i = t.diagonal;
@@ -3398,7 +3417,7 @@ function Us(r, s = Number.EPSILON) {
3398
3417
  Math.abs(i[o]) > s ? i[o] = 1 / i[o] : i[o] = 0;
3399
3418
  return n.mmul(_.diag(i).mmul(e.transpose()));
3400
3419
  }
3401
- function Ys(r, s = r, t = {}) {
3420
+ function Ks(r, s = r, t = {}) {
3402
3421
  r = new _(r);
3403
3422
  let e = !1;
3404
3423
  if (typeof s == "object" && !_.isMatrix(s) && !st.isAnyArray(s) ? (t = s, s = r, e = !0) : s = new _(s), r.rows !== s.rows)
@@ -3411,7 +3430,7 @@ function Ys(r, s = r, t = {}) {
3411
3430
  i.set(o, l, i.get(o, l) * (1 / (r.rows - 1)));
3412
3431
  return i;
3413
3432
  }
3414
- function Ws(r, s = r, t = {}) {
3433
+ function Hs(r, s = r, t = {}) {
3415
3434
  r = new _(r);
3416
3435
  let e = !1;
3417
3436
  if (typeof s == "object" && !_.isMatrix(s) && !st.isAnyArray(s) ? (t = s, s = r, e = !0) : s = new _(s), r.rows !== s.rows)
@@ -3428,7 +3447,7 @@ function Ws(r, s = r, t = {}) {
3428
3447
  );
3429
3448
  return h;
3430
3449
  }
3431
- let Ne = class {
3450
+ let Ue = class {
3432
3451
  constructor(s, t = {}) {
3433
3452
  const { assumeSymmetric: e = !1 } = t;
3434
3453
  if (s = rt.checkMatrix(s), !s.isSquare())
@@ -3440,13 +3459,13 @@ let Ne = class {
3440
3459
  for (a = 0; a < n; a++)
3441
3460
  for (u = 0; u < n; u++)
3442
3461
  i.set(a, u, h.get(a, u));
3443
- Qs(n, l, o, i), Gs(n, l, o, i);
3462
+ tn(n, l, o, i), en(n, l, o, i);
3444
3463
  } else {
3445
3464
  let g = new _(n, n), d = new Float64Array(n);
3446
3465
  for (u = 0; u < n; u++)
3447
3466
  for (a = 0; a < n; a++)
3448
3467
  g.set(a, u, h.get(a, u));
3449
- Xs(n, g, d, i), Zs(n, l, o, i, g);
3468
+ sn(n, g, d, i), nn(n, l, o, i, g);
3450
3469
  }
3451
3470
  this.n = n, this.e = l, this.d = o, this.V = i;
3452
3471
  }
@@ -3469,7 +3488,7 @@ let Ne = class {
3469
3488
  return n;
3470
3489
  }
3471
3490
  };
3472
- function Qs(r, s, t, e) {
3491
+ function tn(r, s, t, e) {
3473
3492
  let n, i, o, l, h, a, u, c;
3474
3493
  for (h = 0; h < r; h++)
3475
3494
  t[h] = e.get(r - 1, h);
@@ -3519,8 +3538,8 @@ function Qs(r, s, t, e) {
3519
3538
  t[h] = e.get(r - 1, h), e.set(r - 1, h, 0);
3520
3539
  e.set(r - 1, r - 1, 1), s[0] = 0;
3521
3540
  }
3522
- function Gs(r, s, t, e) {
3523
- let n, i, o, l, h, a, u, c, g, d, w, p, P, f, M, E;
3541
+ function en(r, s, t, e) {
3542
+ let n, i, o, l, h, a, u, c, g, d, w, p, P, f, y, E;
3524
3543
  for (o = 1; o < r; o++)
3525
3544
  s[o - 1] = s[o];
3526
3545
  s[r - 1] = 0;
@@ -3532,10 +3551,10 @@ function Gs(r, s, t, e) {
3532
3551
  do {
3533
3552
  for (n = t[a], c = (t[a + 1] - n) / (2 * s[a]), g = ut(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
3553
  t[o] -= i;
3535
- 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(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
- 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
- c = -M * E * P * f * s[a] / d, s[a] = M * c, t[a] = w * c;
3554
+ for (R = R + i, c = t[u], w = 1, p = w, P = w, f = s[a + 1], y = 0, E = 0, o = u - 1; o >= a; o--)
3555
+ for (P = p, p = w, E = y, n = w * s[o], i = w * c, g = ut(c, s[o]), s[o + 1] = y * g, y = s[o] / g, w = c / g, c = w * t[o] - y * n, t[o + 1] = i + y * (w * n + y * t[o]), h = 0; h < r; h++)
3556
+ i = e.get(h, o + 1), e.set(h, o + 1, y * e.get(h, o) + w * i), e.set(h, o, w * e.get(h, o) - y * i);
3557
+ c = -y * E * P * f * s[a] / d, s[a] = y * c, t[a] = w * c;
3539
3558
  } while (Math.abs(s[a]) > L * v);
3540
3559
  t[a] = t[a] + R, s[a] = 0;
3541
3560
  }
@@ -3547,7 +3566,7 @@ function Gs(r, s, t, e) {
3547
3566
  c = e.get(l, o), e.set(l, o, e.get(l, h)), e.set(l, h, c);
3548
3567
  }
3549
3568
  }
3550
- function Xs(r, s, t, e) {
3569
+ function sn(r, s, t, e) {
3551
3570
  let n = 0, i = r - 1, o, l, h, a, u, c, g;
3552
3571
  for (c = n + 1; c <= i - 1; c++) {
3553
3572
  for (g = 0, a = c; a <= i; a++)
@@ -3585,11 +3604,11 @@ function Xs(r, s, t, e) {
3585
3604
  }
3586
3605
  }
3587
3606
  }
3588
- function Zs(r, s, t, e, n) {
3589
- let i = r - 1, o = 0, l = r - 1, h = Number.EPSILON, a = 0, u = 0, c = 0, g = 0, d = 0, w = 0, p = 0, P = 0, f, M, E, R, v, L, S, k, D, m, b, j, y, C, F;
3607
+ function nn(r, s, t, e, n) {
3608
+ let i = r - 1, o = 0, l = r - 1, h = Number.EPSILON, a = 0, u = 0, c = 0, g = 0, d = 0, w = 0, p = 0, P = 0, f, y, E, R, v, L, S, k, D, m, b, j, M, C, A;
3590
3609
  for (f = 0; f < r; f++)
3591
- for ((f < o || f > l) && (t[f] = n.get(f, f), s[f] = 0), M = Math.max(f - 1, 0); M < r; M++)
3592
- u = u + Math.abs(n.get(f, M));
3610
+ for ((f < o || f > l) && (t[f] = n.get(f, f), s[f] = 0), y = Math.max(f - 1, 0); y < r; y++)
3611
+ u = u + Math.abs(n.get(f, y));
3593
3612
  for (; i >= o; ) {
3594
3613
  for (R = i; R > o && (w = Math.abs(n.get(R - 1, R - 1)) + Math.abs(n.get(R, R)), w === 0 && (w = u), !(Math.abs(n.get(R, R - 1)) < h * w)); )
3595
3614
  R--;
@@ -3597,8 +3616,8 @@ function Zs(r, s, t, e, n) {
3597
3616
  n.set(i, i, n.get(i, i) + a), t[i] = n.get(i, i), s[i] = 0, i--, P = 0;
3598
3617
  else if (R === i - 1) {
3599
3618
  if (S = n.get(i, i - 1) * n.get(i - 1, i), c = (n.get(i - 1, i - 1) - n.get(i, i)) / 2, g = c * c + S, p = Math.sqrt(Math.abs(g)), n.set(i, i, n.get(i, i) + a), n.set(i - 1, i - 1, n.get(i - 1, i - 1) + a), k = n.get(i, i), g >= 0) {
3600
- for (p = c >= 0 ? c + p : c - p, t[i - 1] = k + p, t[i] = t[i - 1], p !== 0 && (t[i] = k - S / p), s[i - 1] = 0, s[i] = 0, k = n.get(i, i - 1), w = Math.abs(k) + Math.abs(p), c = k / w, g = p / w, d = Math.sqrt(c * c + g * g), c = c / d, g = g / d, M = i - 1; M < r; M++)
3601
- p = n.get(i - 1, M), n.set(i - 1, M, g * p + c * n.get(i, M)), n.set(i, M, g * n.get(i, M) - c * p);
3619
+ for (p = c >= 0 ? c + p : c - p, t[i - 1] = k + p, t[i] = t[i - 1], p !== 0 && (t[i] = k - S / p), s[i - 1] = 0, s[i] = 0, k = n.get(i, i - 1), w = Math.abs(k) + Math.abs(p), c = k / w, g = p / w, d = Math.sqrt(c * c + g * g), c = c / d, g = g / d, y = i - 1; y < r; y++)
3620
+ p = n.get(i - 1, y), n.set(i - 1, y, g * p + c * n.get(i, y)), n.set(i, y, g * n.get(i, y) - c * p);
3602
3621
  for (f = 0; f <= i; f++)
3603
3622
  p = n.get(f, i - 1), n.set(f, i - 1, g * p + c * n.get(f, i)), n.set(f, i, g * n.get(f, i) - c * p);
3604
3623
  for (f = o; f <= l; f++)
@@ -3623,8 +3642,8 @@ function Zs(r, s, t, e, n) {
3623
3642
  n.set(f, f - 2, 0), f > v + 2 && n.set(f, f - 3, 0);
3624
3643
  for (E = v; E <= i - 1 && (C = E !== i - 1, E !== v && (c = n.get(E, E - 1), g = n.get(E + 1, E - 1), d = C ? n.get(E + 2, E - 1) : 0, k = Math.abs(c) + Math.abs(g) + Math.abs(d), k !== 0 && (c = c / k, g = g / k, d = d / k)), k !== 0); E++)
3625
3644
  if (w = Math.sqrt(c * c + g * g + d * d), c < 0 && (w = -w), w !== 0) {
3626
- for (E !== v ? n.set(E, E - 1, -w * k) : R !== v && n.set(E, E - 1, -n.get(E, E - 1)), c = c + w, k = c / w, D = g / w, p = d / w, g = g / c, d = d / c, M = E; M < r; M++)
3627
- c = n.get(E, M) + g * n.get(E + 1, M), C && (c = c + d * n.get(E + 2, M), n.set(E + 2, M, n.get(E + 2, M) - c * p)), n.set(E, M, n.get(E, M) - c * k), n.set(E + 1, M, n.get(E + 1, M) - c * D);
3645
+ for (E !== v ? n.set(E, E - 1, -w * k) : R !== v && n.set(E, E - 1, -n.get(E, E - 1)), c = c + w, k = c / w, D = g / w, p = d / w, g = g / c, d = d / c, y = E; y < r; y++)
3646
+ c = n.get(E, y) + g * n.get(E + 1, y), C && (c = c + d * n.get(E + 2, y), n.set(E + 2, y, n.get(E + 2, y) - c * p)), n.set(E, y, n.get(E, y) - c * k), n.set(E + 1, y, n.get(E + 1, y) - c * D);
3628
3647
  for (f = 0; f <= Math.min(i, E + 3); f++)
3629
3648
  c = k * n.get(f, E) + D * n.get(f, E + 1), C && (c = c + p * n.get(f, E + 2), n.set(f, E + 2, n.get(f, E + 2) - c * d)), n.set(f, E, n.get(f, E) - c), n.set(f, E + 1, n.get(f, E + 1) - c * g);
3630
3649
  for (f = o; f <= l; f++)
@@ -3636,8 +3655,8 @@ function Zs(r, s, t, e, n) {
3636
3655
  for (i = r - 1; i >= 0; i--)
3637
3656
  if (c = t[i], g = s[i], g === 0)
3638
3657
  for (R = i, n.set(i, i, 1), f = i - 1; f >= 0; f--) {
3639
- for (S = n.get(f, f) - c, d = 0, M = R; M <= i; M++)
3640
- d = d + n.get(f, M) * n.get(M, i);
3658
+ for (S = n.get(f, f) - c, d = 0, y = R; y <= i; y++)
3659
+ d = d + n.get(f, y) * n.get(y, i);
3641
3660
  if (s[f] < 0)
3642
3661
  p = S, w = d;
3643
3662
  else if (R = f, s[f] === 0 ? n.set(f, i, S !== 0 ? -d / S : -d / (h * u)) : (k = n.get(f, f + 1), D = n.get(f + 1, f), g = (t[f] - c) * (t[f] - c) + s[f] * s[f], L = (k * w - p * d) / g, n.set(f, i, L), n.set(
@@ -3645,21 +3664,21 @@ function Zs(r, s, t, e, n) {
3645
3664
  i,
3646
3665
  Math.abs(k) > Math.abs(p) ? (-d - S * L) / k : (-w - D * L) / p
3647
3666
  )), L = Math.abs(n.get(f, i)), h * L * L > 1)
3648
- for (M = f; M <= i; M++)
3649
- n.set(M, i, n.get(M, i) / L);
3667
+ for (y = f; y <= i; y++)
3668
+ n.set(y, i, n.get(y, i) / L);
3650
3669
  }
3651
3670
  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(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
- for (m = 0, b = 0, M = R; M <= i; M++)
3654
- m = m + n.get(f, M) * n.get(M, i - 1), b = b + n.get(f, M) * n.get(M, i);
3671
+ 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))) : (A = Wt(0, -n.get(i - 1, i), n.get(i - 1, i - 1) - c, g), n.set(i - 1, i - 1, A[0]), n.set(i - 1, i, A[1])), n.set(i, i - 1, 0), n.set(i, i, 1), f = i - 2; f >= 0; f--) {
3672
+ for (m = 0, b = 0, y = R; y <= i; y++)
3673
+ m = m + n.get(f, y) * n.get(y, i - 1), b = b + n.get(f, y) * n.get(y, i);
3655
3674
  if (S = n.get(f, f) - c, s[f] < 0)
3656
3675
  p = S, d = m, w = b;
3657
- 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(
3676
+ else if (R = f, s[f] === 0 ? (A = Wt(-m, -b, S, g), n.set(f, i - 1, A[0]), n.set(f, i, A[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, M = (t[f] - c) * 2 * g, j === 0 && M === 0 && (j = h * u * (Math.abs(S) + Math.abs(g) + Math.abs(k) + Math.abs(D) + Math.abs(p))), A = Wt(
3658
3677
  k * d - p * m + g * b,
3659
3678
  k * w - p * b - g * m,
3660
3679
  j,
3661
- y
3662
- ), n.set(f, i - 1, F[0]), n.set(f, i, F[1]), Math.abs(k) > Math.abs(p) + Math.abs(g) ? (n.set(
3680
+ M
3681
+ ), n.set(f, i - 1, A[0]), n.set(f, i, A[1]), Math.abs(k) > Math.abs(p) + Math.abs(g) ? (n.set(
3663
3682
  f + 1,
3664
3683
  i - 1,
3665
3684
  (-m - S * n.get(f, i - 1) + g * n.get(f, i)) / k
@@ -3667,24 +3686,24 @@ function Zs(r, s, t, e, n) {
3667
3686
  f + 1,
3668
3687
  i,
3669
3688
  (-b - S * n.get(f, i) - g * n.get(f, i - 1)) / k
3670
- )) : (F = Wt(
3689
+ )) : (A = Wt(
3671
3690
  -d - D * n.get(f, i - 1),
3672
3691
  -w - D * n.get(f, i),
3673
3692
  p,
3674
3693
  g
3675
- ), n.set(f + 1, i - 1, F[0]), n.set(f + 1, i, F[1]))), L = Math.max(Math.abs(n.get(f, i - 1)), Math.abs(n.get(f, i))), h * L * L > 1)
3676
- for (M = f; M <= i; M++)
3677
- n.set(M, i - 1, n.get(M, i - 1) / L), n.set(M, i, n.get(M, i) / L);
3694
+ ), n.set(f + 1, i - 1, A[0]), n.set(f + 1, i, A[1]))), L = Math.max(Math.abs(n.get(f, i - 1)), Math.abs(n.get(f, i))), h * L * L > 1)
3695
+ for (y = f; y <= i; y++)
3696
+ n.set(y, i - 1, n.get(y, i - 1) / L), n.set(y, i, n.get(y, i) / L);
3678
3697
  }
3679
3698
  for (f = 0; f < r; f++)
3680
3699
  if (f < o || f > l)
3681
- for (M = f; M < r; M++)
3682
- e.set(f, M, n.get(f, M));
3683
- for (M = r - 1; M >= o; M--)
3700
+ for (y = f; y < r; y++)
3701
+ e.set(f, y, n.get(f, y));
3702
+ for (y = r - 1; y >= o; y--)
3684
3703
  for (f = o; f <= l; f++) {
3685
- for (p = 0, E = o; E <= Math.min(M, l); E++)
3686
- p = p + e.get(f, E) * n.get(E, M);
3687
- e.set(f, M, p);
3704
+ for (p = 0, E = o; E <= Math.min(y, l); E++)
3705
+ p = p + e.get(f, E) * n.get(E, y);
3706
+ e.set(f, y, p);
3688
3707
  }
3689
3708
  }
3690
3709
  }
@@ -3692,7 +3711,7 @@ function Wt(r, s, t, e) {
3692
3711
  let n, i;
3693
3712
  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
3713
  }
3695
- class $e {
3714
+ class Ye {
3696
3715
  constructor(s) {
3697
3716
  if (s = rt.checkMatrix(s), !s.isSymmetric())
3698
3717
  throw new Error("Matrix is not symmetric");
@@ -3739,7 +3758,7 @@ class $e {
3739
3758
  return this.L;
3740
3759
  }
3741
3760
  }
3742
- class Le {
3761
+ class We {
3743
3762
  constructor(s, t = {}) {
3744
3763
  s = rt.checkMatrix(s);
3745
3764
  let { Y: e } = t;
@@ -3769,44 +3788,44 @@ class Le {
3769
3788
  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
3789
  }
3771
3790
  }
3772
- $.AbstractMatrix = V;
3773
- $.CHO = $e;
3774
- $.CholeskyDecomposition = $e;
3791
+ $.AbstractMatrix = N;
3792
+ $.CHO = Ye;
3793
+ $.CholeskyDecomposition = Ye;
3775
3794
  $.DistanceMatrix = te;
3776
- $.EVD = Ne;
3777
- var Js = $.EigenvalueDecomposition = Ne;
3795
+ $.EVD = Ue;
3796
+ var rn = $.EigenvalueDecomposition = Ue;
3778
3797
  $.LU = ee;
3779
3798
  $.LuDecomposition = ee;
3780
- var De = $.Matrix = _;
3781
- $.MatrixColumnSelectionView = qs;
3782
- $.MatrixColumnView = Cs;
3783
- $.MatrixFlipColumnView = Fs;
3784
- $.MatrixFlipRowView = xs;
3785
- $.MatrixRowSelectionView = Vs;
3786
- $.MatrixRowView = As;
3799
+ var Qe = $.Matrix = _;
3800
+ $.MatrixColumnSelectionView = Ls;
3801
+ $.MatrixColumnView = $s;
3802
+ $.MatrixFlipColumnView = Ds;
3803
+ $.MatrixFlipRowView = Os;
3804
+ $.MatrixRowSelectionView = zs;
3805
+ $.MatrixRowView = Bs;
3787
3806
  $.MatrixSelectionView = Gt;
3788
- $.MatrixSubView = Ns;
3789
- $.MatrixTransposeView = $s;
3790
- $.NIPALS = Le;
3791
- $.Nipals = Le;
3807
+ $.MatrixSubView = Us;
3808
+ $.MatrixTransposeView = Ys;
3809
+ $.NIPALS = We;
3810
+ $.Nipals = We;
3792
3811
  $.QR = pe;
3793
3812
  $.QrDecomposition = pe;
3794
3813
  $.SVD = vt;
3795
3814
  $.SingularValueDecomposition = vt;
3796
3815
  $.SymmetricMatrix = pt;
3797
- $.WrapperMatrix1D = Ae;
3816
+ $.WrapperMatrix1D = Be;
3798
3817
  $.WrapperMatrix2D = rt;
3799
- $.correlation = Ws;
3800
- $.covariance = Ys;
3801
- var Re = $.default = _;
3818
+ $.correlation = Hs;
3819
+ $.covariance = Ks;
3820
+ var Ce = $.default = _;
3802
3821
  $.determinant = Xt;
3803
- $.inverse = Ds;
3804
- $.linearDependencies = Bs;
3805
- $.pseudoInverse = Us;
3806
- $.solve = Ve;
3807
- $.wrap = Ls;
3808
- const Ks = Js, Hs = De;
3809
- Re.Matrix && Re.Matrix;
3822
+ $.inverse = Qs;
3823
+ $.linearDependencies = Zs;
3824
+ $.pseudoInverse = Js;
3825
+ $.solve = ze;
3826
+ $.wrap = Ws;
3827
+ const on = rn, ln = Qe;
3828
+ Ce.Matrix && Ce.Matrix;
3810
3829
  function qt(r, s, t) {
3811
3830
  const e = r / t, n = s / t;
3812
3831
  if (!(isFinite(e) && isFinite(n))) {
@@ -3826,7 +3845,7 @@ function qt(r, s, t) {
3826
3845
  const l = e / o;
3827
3846
  return isFinite(l) ? l > o ? [o, l] : [l, o] : [o];
3828
3847
  }
3829
- function ze(r, s, t, e) {
3848
+ function Ge(r, s, t, e) {
3830
3849
  const n = t / (3 * e), i = s / (3 * e), o = r / e;
3831
3850
  if (!(isFinite(o) && isFinite(i) && isFinite(n)))
3832
3851
  return qt(r, s, t);
@@ -3842,16 +3861,16 @@ function ze(r, s, t, e) {
3842
3861
  return [f * d - n, f * p - n, f * P - n];
3843
3862
  }
3844
3863
  }
3845
- function wn(r, s, t, e, n) {
3864
+ function En(r, s, t, e, n) {
3846
3865
  if (n == 0)
3847
- return ze(r, s, t, e);
3866
+ return Ge(r, s, t, e);
3848
3867
  const i = e / n, o = t / n, l = s / n, h = r / n;
3849
- let a = ve(i, o, l, h, !1);
3868
+ let a = qe(i, o, l, h, !1);
3850
3869
  if (a !== null)
3851
3870
  return a;
3852
3871
  const u = 716e74;
3853
3872
  for (let c = 0; c < 2; c++)
3854
- if (a = ve(
3873
+ if (a = qe(
3855
3874
  i / u,
3856
3875
  o / (u * u),
3857
3876
  l / (u * u * u),
@@ -3867,8 +3886,8 @@ function wn(r, s, t, e, n) {
3867
3886
  function gt(r, s) {
3868
3887
  return s == 0 ? Math.abs(r) : Math.abs((r - s) / s);
3869
3888
  }
3870
- function ve(r, s, t, e, n) {
3871
- const i = tn(r, s, t, e, n);
3889
+ function qe(r, s, t, e, n) {
3890
+ const i = hn(r, s, t, e, n);
3872
3891
  if (i !== null && i.length == 4) {
3873
3892
  let o = [];
3874
3893
  for (let l = 0; l < 2; l++) {
@@ -3879,73 +3898,73 @@ function ve(r, s, t, e, n) {
3879
3898
  }
3880
3899
  return null;
3881
3900
  }
3882
- function tn(r, s, t, e, n) {
3883
- function i(x, N, A, O) {
3884
- const U = gt(x + A, r), T = gt(N + x * A + O, s), z = gt(N * A + x * O, t);
3885
- return U + T + z;
3901
+ function hn(r, s, t, e, n) {
3902
+ function i(F, V, x, B) {
3903
+ const U = gt(F + x, r), I = gt(V + F * x + B, s), O = gt(V * x + F * B, t);
3904
+ return U + I + O;
3886
3905
  }
3887
- function o(x, N, A, O) {
3888
- return i(x, N, A, O) + gt(N * O, e);
3906
+ function o(F, V, x, B) {
3907
+ return i(F, V, x, B) + gt(V * B, e);
3889
3908
  }
3890
3909
  const l = 9 * r * r - 24 * s, h = l >= 0 ? -2 * s / (3 * r + kt(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
3910
  let d = 0, w = 0;
3892
3911
  const p = 349e100;
3893
3912
  if (n) {
3894
- const x = a / p, N = u / p, A = c / p, O = g / p;
3895
- d = x * A - 4 / p * O - 1 / 3 * N * N, w = (x * A - 8 / p * O - 2 / 9 * N * N) * (1 / 3) * N - A * (A / p) - x * x * O;
3913
+ const F = a / p, V = u / p, x = c / p, B = g / p;
3914
+ d = F * x - 4 / p * B - 1 / 3 * V * V, w = (F * x - 8 / p * B - 2 / 9 * V * V) * (1 / 3) * V - x * (x / p) - F * F * B;
3896
3915
  } else
3897
3916
  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
3917
  if (!isFinite(d) && isFinite(w))
3899
3918
  return null;
3900
- let P = en(d, w);
3919
+ let P = an(d, w);
3901
3920
  n && (P *= p);
3902
- 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;
3921
+ const f = r * 0.5, y = 1 / 6 * s + 0.5 * P, E = t - r * y, R = 2 / 3 * s - P - f * f, v = 0.5 * E / R, L = 2 * (e - y * y) / E, S = 0.5 * E / L;
3903
3922
  let k = 0, D = 0, m = 0;
3904
- for (let x = 0; x < 3; x++) {
3905
- const N = x == 1 ? S : R, A = x == 0 ? v : L, O = gt(N + f * f + 2 * M, s), U = gt(2 * (N * A + f * M), t), T = gt(N * A * A + M * M, e), z = O + U + T;
3906
- (x == 0 || z < m) && (k = N, D = A, m = z);
3923
+ for (let F = 0; F < 3; F++) {
3924
+ const V = F == 1 ? S : R, x = F == 0 ? v : L, B = gt(V + f * f + 2 * y, s), U = gt(2 * (V * x + f * y), t), I = gt(V * x * x + y * y, e), O = B + U + I;
3925
+ (F == 0 || O < m) && (k = V, D = x, m = O);
3907
3926
  }
3908
3927
  const b = k, j = D;
3909
- let y = 0, C = 0, F = 0, I = 0;
3928
+ let M = 0, C = 0, A = 0, T = 0;
3910
3929
  if (b < 0) {
3911
- const x = Math.sqrt(-b);
3912
- if (y = f + x, C = M + x * j, F = f - x, I = M - x * j, Math.abs(I) < Math.abs(C) ? I = e / C : Math.abs(I) > Math.abs(C) && (C = e / I), Math.abs(y) != Math.abs(F)) {
3913
- let N = null, A = null;
3914
- if (Math.abs(y) < Math.abs(F)) {
3915
- const U = (t - C * F) / I, T = (s - I - C) / F;
3916
- N = [r - F, U, T], A = [F, F, F];
3930
+ const F = Math.sqrt(-b);
3931
+ if (M = f + F, C = y + F * j, A = f - F, T = y - F * j, Math.abs(T) < Math.abs(C) ? T = e / C : Math.abs(T) > Math.abs(C) && (C = e / T), Math.abs(M) != Math.abs(A)) {
3932
+ let V = null, x = null;
3933
+ if (Math.abs(M) < Math.abs(A)) {
3934
+ const U = (t - C * A) / T, I = (s - T - C) / A;
3935
+ V = [r - A, U, I], x = [A, A, A];
3917
3936
  } else {
3918
- const U = (t - y * I) / C, T = (s - I - C) / y, z = r - y;
3919
- N = [y, y, y], A = [z, U, T];
3937
+ const U = (t - M * T) / C, I = (s - T - C) / M, O = r - M;
3938
+ V = [M, M, M], x = [O, U, I];
3920
3939
  }
3921
- let O = 0;
3940
+ let B = 0;
3922
3941
  for (let U = 0; U < 3; U++) {
3923
- const T = N[U], z = A[U];
3924
- if (isFinite(T) && isFinite(z)) {
3925
- const X = i(T, C, z, I);
3926
- (U == 0 || X < O) && (y = T, F = z, O = X);
3942
+ const I = V[U], O = x[U];
3943
+ if (isFinite(I) && isFinite(O)) {
3944
+ const X = i(I, C, O, T);
3945
+ (U == 0 || X < B) && (M = I, A = O, B = X);
3927
3946
  }
3928
3947
  }
3929
3948
  }
3930
3949
  } else if (b == 0) {
3931
- const x = e - M * M;
3932
- y = f, C = M + Math.sqrt(-x), F = f, I = M - Math.sqrt(-x), Math.abs(C) > Math.abs(I) ? I = e / C : Math.abs(I) > Math.abs(C) && (C = e / I);
3950
+ const F = e - y * y;
3951
+ M = f, C = y + Math.sqrt(-F), A = f, T = y - Math.sqrt(-F), Math.abs(C) > Math.abs(T) ? T = e / C : Math.abs(T) > Math.abs(C) && (C = e / T);
3933
3952
  } else
3934
3953
  return [];
3935
- let B = o(y, C, F, I);
3936
- for (let x = 0; x < 8 && B != 0; x++) {
3937
- const N = C * I - e, A = C * F + y * I - t, O = C + y * F + I - s, U = y + F - r, T = y - F, z = C * C - C * (F * T + 2 * I) + I * (y * T + I);
3938
- if (z == 0)
3954
+ let z = o(M, C, A, T);
3955
+ for (let F = 0; F < 8 && z != 0; F++) {
3956
+ const V = C * T - e, x = C * A + M * T - t, B = C + M * A + T - s, U = M + A - r, I = M - A, O = C * C - C * (A * I + 2 * T) + T * (M * I + T);
3957
+ if (O == 0)
3939
3958
  break;
3940
- const X = 1 / z, G = I - C, W = C * F - y * I, se = T * N + G * A + W * O - (C * G + y * W) * U, ne = (y * T + G) * N - C * (T * A + G * O + W * U), ie = -T * N - G * A - W * O + (F * W + I * G) * U, re = -(F * T + G) * N + I * (T * A + G * O + W * U), At = y - X * se, Vt = C - X * ne, Nt = F - X * ie, $t = I - X * re, Lt = o(At, Vt, Nt, $t);
3941
- if (Lt < B)
3942
- y = At, C = Vt, F = Nt, I = $t, B = Lt;
3959
+ const X = 1 / O, G = T - C, W = C * A - M * T, se = I * V + G * x + W * B - (C * G + M * W) * U, ne = (M * I + G) * V - C * (I * x + G * B + W * U), ie = -I * V - G * x - W * B + (A * W + T * G) * U, re = -(A * I + G) * V + T * (I * x + G * B + W * U), xt = M - X * se, Nt = C - X * ne, Vt = A - X * ie, $t = T - X * re, Lt = o(xt, Nt, Vt, $t);
3960
+ if (Lt < z)
3961
+ M = xt, C = Nt, A = Vt, T = $t, z = Lt;
3943
3962
  else
3944
3963
  break;
3945
3964
  }
3946
- return [y, C, F, I];
3965
+ return [M, C, A, T];
3947
3966
  }
3948
- function en(r, s) {
3967
+ function an(r, s) {
3949
3968
  const t = -0.3333333333333333 * r, e = 0.5 * s;
3950
3969
  let n, i = null;
3951
3970
  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)
@@ -3979,32 +3998,33 @@ function kt(r, s) {
3979
3998
  const t = Math.abs(r);
3980
3999
  return s < 0 ? -t : t;
3981
4000
  }
3982
- function sn(r, s = 1e-9) {
4001
+ function un(r, s = 1e-9) {
3983
4002
  if (r[r.length - 1] == 0)
3984
- return sn(r.slice(0, -1), s);
3985
- const t = new Hs([
4003
+ return un(r.slice(0, -1), s);
4004
+ const t = new ln([
3986
4005
  r.slice(0, -1).reverse().map((n) => -n / r[r.length - 1]),
3987
4006
  ...Array.from({ length: r.length - 2 }, (n, i) => {
3988
4007
  const o = new Array(r.length - 1).fill(0);
3989
4008
  return o[i] = 1, o;
3990
4009
  })
3991
- ]), e = new Ks(t);
4010
+ ]), e = new on(t);
3992
4011
  return e.realEigenvalues.filter(
3993
4012
  (n, i) => Math.abs(e.imaginaryEigenvalues[i]) < s
3994
4013
  );
3995
4014
  }
3996
- const nn = (r, s, t) => [r[0] * (1 - t) + s[0] * t, r[1] * (1 - t) + s[1] * t];
3997
- function rn(r) {
4015
+ const cn = (r, s, t) => [r[0] * (1 - t) + s[0] * t, r[1] * (1 - t) + s[1] * t];
4016
+ function fn(r) {
3998
4017
  const s = [];
3999
4018
  for (let t = 0; t < r.length - 1; t++)
4000
4019
  s.push([r[t], r[t + 1]]);
4001
4020
  return s;
4002
4021
  }
4003
4022
  function de(r, s) {
4004
- const t = rn(r).map(([e, n]) => nn(e, n, s));
4023
+ const t = fn(r).map(([e, n]) => cn(e, n, s));
4005
4024
  return r.length === 2 ? [t] : [...de(t, s), t];
4006
4025
  }
4007
- class Et extends xt {
4026
+ const Ae = Symbol.for("pantograph:CubicBezier");
4027
+ class Et extends Ft {
4008
4028
  constructor(t, e, n, i) {
4009
4029
  super(t, e);
4010
4030
  q(this, "segmentType", "CUBIC_BEZIER");
@@ -4012,7 +4032,10 @@ class Et extends xt {
4012
4032
  q(this, "lastControlPoint");
4013
4033
  q(this, "_boundingBox", null);
4014
4034
  q(this, "_polynomialCoefficients", null);
4015
- this.firstControlPoint = n, this.lastControlPoint = i;
4035
+ Object.defineProperty(this, Ae, { value: !0 }), this.firstControlPoint = n, this.lastControlPoint = i;
4036
+ }
4037
+ static isInstance(t) {
4038
+ return !!t && t[Ae] === !0;
4016
4039
  }
4017
4040
  get midPoint() {
4018
4041
  return this.paramPoint(0.5);
@@ -4068,7 +4091,7 @@ class Et extends xt {
4068
4091
  return t.segmentType !== "CUBIC_BEZIER" ? !1 : Y(this.firstPoint, t.firstPoint) && Y(this.lastPoint, t.lastPoint) && Y(this.firstControlPoint, t.firstControlPoint) && Y(this.lastControlPoint, t.lastControlPoint);
4069
4092
  }
4070
4093
  distanceFrom(t) {
4071
- const n = Ce((i) => Rt(this.paramPoint(i), t), this.precision);
4094
+ const n = $e((i) => Rt(this.paramPoint(i), t), this.precision);
4072
4095
  return n.argMin < -this.precision || n.argMin > 1 + this.precision ? Math.min(
4073
4096
  J(this.firstPoint, t),
4074
4097
  J(this.lastPoint, t)
@@ -4198,7 +4221,7 @@ class Et extends xt {
4198
4221
  }
4199
4222
  paramsAtY(t) {
4200
4223
  const [e, n, i, o] = this.polynomialCoefficients[1];
4201
- return ze(e - t, n, i, o).filter((l) => l >= -this.precision && l <= 1 + this.precision);
4224
+ return Ge(e - t, n, i, o).filter((l) => l >= -this.precision && l <= 1 + this.precision);
4202
4225
  }
4203
4226
  pointToParam(t) {
4204
4227
  if (Y(t, this.firstPoint, this.precision)) return 0;
@@ -4212,7 +4235,8 @@ class Et extends xt {
4212
4235
  return i;
4213
4236
  }
4214
4237
  }
4215
- class jt extends xt {
4238
+ const Fe = Symbol.for("pantograph:EllipseArc");
4239
+ class jt extends Ft {
4216
4240
  constructor(t, e, n, i, o, l, h = !1, {
4217
4241
  ignoreChecks: a = !1,
4218
4242
  angleUnits: u = "deg"
@@ -4238,7 +4262,7 @@ class jt extends xt {
4238
4262
  q(this, "_firstAngle");
4239
4263
  q(this, "_lastAngle");
4240
4264
  q(this, "_deltaAngle");
4241
- this.center = n;
4265
+ Object.defineProperty(this, Fe, { value: !0 }), this.center = n;
4242
4266
  const c = i >= o;
4243
4267
  this.majorRadius = c ? i : o, this.minorRadius = c ? o : i;
4244
4268
  const g = u === "deg" ? l * fe : l;
@@ -4263,6 +4287,9 @@ class jt extends xt {
4263
4287
  );
4264
4288
  }
4265
4289
  }
4290
+ static isInstance(t) {
4291
+ return !!t && t[Fe] === !0;
4292
+ }
4266
4293
  get coefficients() {
4267
4294
  if (this._coefficients === null) {
4268
4295
  const [t, e] = this.center, n = this.majorRadius * this.majorRadius, i = this.minorRadius * this.minorRadius, o = Math.cos(this.tiltAngle), l = Math.sin(this.tiltAngle), h = n * l * l + i * o * o, a = 2 * (i - n) * l * o, u = n * o * o + i * l * l;
@@ -4280,7 +4307,7 @@ class jt extends xt {
4280
4307
  get info() {
4281
4308
  return `ELLIPSE_ARC(${Z(this.firstPoint)}, ${Z(
4282
4309
  this.lastPoint
4283
- )}, ${Z(this.center)}, ${this.majorRadius}, ${this.minorRadius}, ${this.tiltAngle * Ue}, ${this.clockwise ? "CW" : "CCW"})`;
4310
+ )}, ${Z(this.center)}, ${this.majorRadius}, ${this.minorRadius}, ${this.tiltAngle * Je}, ${this.clockwise ? "CW" : "CCW"})`;
4284
4311
  }
4285
4312
  reverse() {
4286
4313
  return new jt(
@@ -4340,7 +4367,7 @@ class jt extends xt {
4340
4367
  return this._focals;
4341
4368
  }
4342
4369
  get majorAxis() {
4343
- return Tt(1, this.tiltAngle);
4370
+ return It(1, this.tiltAngle);
4344
4371
  }
4345
4372
  paramPoint(t) {
4346
4373
  const e = this.firstAngle + t * this.deltaAngle * (this.clockwise ? -1 : 1);
@@ -4393,14 +4420,14 @@ class jt extends xt {
4393
4420
  this.center,
4394
4421
  nt(tt(this.majorAxis), this.minorRadius)
4395
4422
  ) : e = this.reverseEllipseReferenceFrameTransform.transform(
4396
- ln(
4423
+ gn(
4397
4424
  this.majorRadius,
4398
4425
  this.minorRadius,
4399
4426
  this.ellipseReferenceFrameTransform.transform(t)
4400
4427
  )
4401
4428
  ), this.isValidParameter(this.thetaToParam(this.pointTheta(t))))
4402
4429
  return J(t, e);
4403
- if (Qe(t, this.majorAxis, this.center)) {
4430
+ if (ts(t, this.majorAxis, this.center)) {
4404
4431
  const n = wt(
4405
4432
  2 * Math.PI - this.pointTheta(t)
4406
4433
  ), i = this.thetaToParam(n);
@@ -4498,8 +4525,8 @@ class jt extends xt {
4498
4525
  });
4499
4526
  }
4500
4527
  }
4501
- function pn(r, s, t, e, n, i, o) {
4502
- const { center: l, rx: h, ry: a } = on(
4528
+ function _n(r, s, t, e, n, i, o) {
4529
+ const { center: l, rx: h, ry: a } = mn(
4503
4530
  r,
4504
4531
  s,
4505
4532
  t,
@@ -4510,15 +4537,15 @@ function pn(r, s, t, e, n, i, o) {
4510
4537
  );
4511
4538
  return Math.abs(h - a) < 1e-9 ? new ct(r, s, l, o) : new jt(r, s, l, h, a, n, o);
4512
4539
  }
4513
- function on([r, s], [t, e], n, i, o, l, h) {
4540
+ function mn([r, s], [t, e], n, i, o, l, h) {
4514
4541
  if (n < 0 && (n = -n), i < 0 && (i = -i), n == 0 || i == 0)
4515
4542
  throw Error("rx and ry can not be 0");
4516
4543
  const a = Math.sin(o), u = Math.cos(o), c = (r - t) / 2, g = (s - e) / 2, d = (r + t) / 2, w = (s + e) / 2, p = u * c + a * g, P = u * g - a * c, f = p * p / (n * n) + P * P / (i * i);
4517
4544
  f > 1 && (n = n * Math.sqrt(f), i = i * Math.sqrt(f));
4518
- const M = n * i, E = n * P, R = i * p, v = E * E + R * R;
4545
+ const y = n * i, E = n * P, R = i * p, v = E * E + R * R;
4519
4546
  if (!v)
4520
4547
  throw Error("start point can not be same as end point");
4521
- let L = Math.sqrt(Math.abs((M * M - v) / v));
4548
+ let L = Math.sqrt(Math.abs((y * y - v) / v));
4522
4549
  l == h && (L = -L);
4523
4550
  const S = L * E / i, k = -L * R / n, D = u * S - a * k + d, m = a * S + u * k + w;
4524
4551
  return {
@@ -4527,26 +4554,30 @@ function on([r, s], [t, e], n, i, o, l, h) {
4527
4554
  ry: i
4528
4555
  };
4529
4556
  }
4530
- function ln(r, s, t) {
4557
+ function gn(r, s, t) {
4531
4558
  const e = Math.abs(t[0]), n = Math.abs(t[1]);
4532
4559
  let i = 0.707, o = 0.707;
4533
4560
  const l = r, h = s;
4534
4561
  for (let a = 0; a < 3; a++) {
4535
- const u = l * i, c = h * o, g = (l * l - h * h) * i ** 3 / l, d = (h * h - l * l) * o ** 3 / h, w = u - g, p = c - d, P = e - g, f = n - d, M = Math.hypot(w, p), E = Math.hypot(P, f);
4536
- i = Math.min(1, Math.max(0, (P * M / E + g) / l)), o = Math.min(1, Math.max(0, (f * M / E + d) / h));
4562
+ const u = l * i, c = h * o, g = (l * l - h * h) * i ** 3 / l, d = (h * h - l * l) * o ** 3 / h, w = u - g, p = c - d, P = e - g, f = n - d, y = Math.hypot(w, p), E = Math.hypot(P, f);
4563
+ i = Math.min(1, Math.max(0, (P * y / E + g) / l)), o = Math.min(1, Math.max(0, (f * y / E + d) / h));
4537
4564
  const R = Math.hypot(i, o);
4538
4565
  i /= R, o /= R;
4539
4566
  }
4540
4567
  return [l * i * Math.sign(t[0]), h * o * Math.sign(t[1])];
4541
4568
  }
4542
- class _t extends xt {
4569
+ const xe = Symbol.for("pantograph:QuadraticBezier");
4570
+ class _t extends Ft {
4543
4571
  constructor(t, e, n) {
4544
4572
  super(t, e);
4545
4573
  q(this, "segmentType", "QUADRATIC_BEZIER");
4546
4574
  q(this, "controlPoint");
4547
4575
  q(this, "_boundingBox", null);
4548
4576
  q(this, "_polynomialCoefficients", null);
4549
- this.controlPoint = n;
4577
+ Object.defineProperty(this, xe, { value: !0 }), this.controlPoint = n;
4578
+ }
4579
+ static isInstance(t) {
4580
+ return !!t && t[xe] === !0;
4550
4581
  }
4551
4582
  get midPoint() {
4552
4583
  return this.paramPoint(0.5);
@@ -4593,7 +4624,7 @@ class _t extends xt {
4593
4624
  return t.segmentType !== "QUADRATIC_BEZIER" ? !1 : Y(this.firstPoint, t.firstPoint) && Y(this.lastPoint, t.lastPoint) && Y(this.controlPoint, t.controlPoint);
4594
4625
  }
4595
4626
  distanceFrom(t) {
4596
- const n = Ce((i) => Rt(this.paramPoint(i), t), this.precision);
4627
+ const n = $e((i) => Rt(this.paramPoint(i), t), this.precision);
4597
4628
  return n.argMin < -this.precision || n.argMin > 1 + this.precision ? Math.min(
4598
4629
  J(this.firstPoint, t),
4599
4630
  J(this.lastPoint, t)
@@ -4738,39 +4769,39 @@ export {
4738
4769
  Et as C,
4739
4770
  fe as D,
4740
4771
  jt as E,
4741
- cn as F,
4742
- Ze as G,
4743
- Ie as H,
4772
+ yn as F,
4773
+ ns as G,
4774
+ Ve as H,
4744
4775
  Z as I,
4745
4776
  at as L,
4746
4777
  _t as Q,
4747
- Ue as R,
4778
+ Je as R,
4748
4779
  et as T,
4749
4780
  it as a,
4750
4781
  Q as b,
4751
4782
  St as c,
4752
- Pe as d,
4783
+ be as d,
4753
4784
  J as e,
4754
4785
  Qt as f,
4755
4786
  Y as g,
4756
- fn as h,
4757
- pn as i,
4758
- We as j,
4759
- Tt as k,
4760
- Te as l,
4787
+ Mn as h,
4788
+ _n as i,
4789
+ He as j,
4790
+ It as k,
4791
+ Ne as l,
4761
4792
  me as m,
4762
4793
  H as n,
4763
- Ye as o,
4794
+ Ke as o,
4764
4795
  tt as p,
4765
4796
  Rt as q,
4766
- Je as r,
4797
+ is as r,
4767
4798
  nt as s,
4768
- mn as t,
4769
- un as u,
4770
- an as v,
4771
- sn as w,
4772
- wn as x,
4773
- It as y,
4799
+ Pn as t,
4800
+ dn as u,
4801
+ pn as v,
4802
+ un as w,
4803
+ En as x,
4804
+ Tt as y,
4774
4805
  Kt as z
4775
4806
  };
4776
- //# sourceMappingURL=QuadraticBezier-B2g_Iyyl.js.map
4807
+ //# sourceMappingURL=QuadraticBezier-BeY2TXKH.js.map