pimath 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pimath.js CHANGED
@@ -1,32 +1,32 @@
1
- var qi = Object.defineProperty;
2
- var si = (o) => {
1
+ var ki = Object.defineProperty;
2
+ var li = (o) => {
3
3
  throw TypeError(o);
4
4
  };
5
- var Ti = (o, e, t) => e in o ? qi(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
6
- var a = (o, e, t) => Ti(o, typeof e != "symbol" ? e + "" : e, t), Ut = (o, e, t) => e.has(o) || si("Cannot " + t);
7
- var i = (o, e, t) => (Ut(o, e, "read from private field"), t ? t.call(o) : e.get(o)), d = (o, e, t) => e.has(o) ? si("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(o) : e.set(o, t), h = (o, e, t, s) => (Ut(o, e, "write to private field"), s ? s.call(o, t) : e.set(o, t), t), M = (o, e, t) => (Ut(o, e, "access private method"), t);
8
- function Ai(o) {
9
- const e = ni(o), t = [];
10
- let s, r;
5
+ var Ci = (o, e, t) => e in o ? ki(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
6
+ var a = (o, e, t) => Ci(o, typeof e != "symbol" ? e + "" : e, t), Ht = (o, e, t) => e.has(o) || li("Cannot " + t);
7
+ var i = (o, e, t) => (Ht(o, e, "read from private field"), t ? t.call(o) : e.get(o)), d = (o, e, t) => e.has(o) ? li("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(o) : e.set(o, t), h = (o, e, t, s) => (Ht(o, e, "write to private field"), s ? s.call(o, t) : e.set(o, t), t), q = (o, e, t) => (Ht(o, e, "access private method"), t);
8
+ function $i(o) {
9
+ const e = ui(o), t = [];
10
+ let s, n;
11
11
  for (; e.length > 0; )
12
- s = e.shift() ?? 1, r = (e.length > 0 ? e.pop() : +s) ?? 1, t.push([s, r]);
12
+ s = e.shift() ?? 1, n = (e.length > 0 ? e.pop() : +s) ?? 1, t.push([s, n]);
13
13
  return t;
14
14
  }
15
- function Mi(...o) {
16
- const e = _t(...o);
15
+ function Ii(...o) {
16
+ const e = ni(...o);
17
17
  return o.map((t) => t / e);
18
18
  }
19
- function ni(o) {
19
+ function ui(o) {
20
20
  const e = Math.abs(o), t = Math.sqrt(e), s = [];
21
- for (let r = 1; r <= t; r++)
22
- o % r === 0 && (s.push(r), s.push(e / r));
23
- return s.sort(function(r, n) {
24
- return r - n;
21
+ for (let n = 1; n <= t; n++)
22
+ o % n === 0 && (s.push(n), s.push(e / n));
23
+ return s.sort(function(n, r) {
24
+ return n - r;
25
25
  }), [...new Set(s)];
26
26
  }
27
- function _t(...o) {
28
- const e = function(r, n) {
29
- return n === 0 ? r : e(n, r % n);
27
+ function ni(...o) {
28
+ const e = function(n, r) {
29
+ return r === 0 ? n : e(r, n % r);
30
30
  };
31
31
  let t = 1, s = 2;
32
32
  if (o.length === 0)
@@ -39,53 +39,53 @@ function _t(...o) {
39
39
  ;
40
40
  return Math.abs(t);
41
41
  }
42
- function Ii(...o) {
42
+ function Pi(...o) {
43
43
  return o.reduce(function(e, t) {
44
- return Math.abs(e * t / _t(e, t));
44
+ return Math.abs(e * t / ni(e, t));
45
45
  });
46
46
  }
47
- function Ci(o, e = 3) {
47
+ function Bi(o, e = 3) {
48
48
  return +o.toFixed(e);
49
49
  }
50
- function $i(o) {
50
+ function Si(o) {
51
51
  if (Number.isSafeInteger(o) || o.toString().split(".")[0].length < 10)
52
52
  return 0;
53
53
  throw new Error("Periodic value: Not implemented yet");
54
54
  }
55
- function Pi(o) {
55
+ function Ri(o) {
56
56
  const e = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, 3821, 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087, 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 5227, 5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443, 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, 5639, 5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857, 5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007, 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133, 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221, 6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301, 6311, 6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379, 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473, 6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563, 6569, 6571, 6577, 6581, 6599, 6607, 6619, 6637, 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733, 6737, 6761, 6763, 6779, 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833, 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6911, 6917, 6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207, 7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, 7283, 7297, 7307, 7309, 7321, 7331, 7333, 7349, 7351, 7369, 7393, 7411, 7417, 7433, 7451, 7457, 7459, 7477, 7481, 7487, 7489, 7499, 7507, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561, 7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621, 7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717, 7723, 7727, 7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919, 7927, 7933, 7937, 7949, 7951, 7963, 7993, 8009, 8011, 8017, 8039, 8053, 8059, 8069, 8081, 8087, 8089, 8093, 8101, 8111, 8117, 8123, 8147, 8161, 8167, 8171, 8179, 8191, 8209, 8219, 8221, 8231, 8233, 8237, 8243, 8263, 8269, 8273, 8287, 8291, 8293, 8297, 8311, 8317, 8329, 8353, 8363, 8369, 8377, 8387, 8389, 8419, 8423, 8429, 8431, 8443, 8447, 8461, 8467, 8501, 8513, 8521, 8527, 8537, 8539, 8543, 8563, 8573, 8581, 8597, 8599, 8609, 8623, 8627, 8629, 8641, 8647, 8663, 8669, 8677, 8681, 8689, 8693, 8699, 8707, 8713, 8719, 8731, 8737, 8741, 8747, 8753, 8761, 8779, 8783, 8803, 8807, 8819, 8821, 8831, 8837, 8839, 8849, 8861, 8863, 8867, 8887, 8893, 8923, 8929, 8933, 8941, 8951, 8963, 8969, 8971, 8999, 9001, 9007, 9011, 9013, 9029, 9041, 9043, 9049, 9059, 9067, 9091, 9103, 9109, 9127, 9133, 9137, 9151, 9157, 9161, 9173, 9181, 9187, 9199, 9203, 9209, 9221, 9227, 9239, 9241, 9257, 9277, 9281, 9283, 9293, 9311, 9319, 9323, 9337, 9341, 9343, 9349, 9371, 9377, 9391, 9397, 9403, 9413, 9419, 9421, 9431, 9433, 9437, 9439, 9461, 9463, 9467, 9473, 9479, 9491, 9497, 9511, 9521, 9533, 9539, 9547, 9551, 9587, 9601, 9613, 9619, 9623, 9629, 9631, 9643, 9649, 9661, 9677, 9679, 9689, 9697, 9719, 9721, 9733, 9739, 9743, 9749, 9767, 9769, 9781, 9787, 9791, 9803, 9811, 9817, 9829, 9833, 9839, 9851, 9857, 9859, 9871, 9883, 9887, 9901, 9907, 9923, 9929, 9931, 9941, 9949, 9967, 9973];
57
57
  return o === void 0 ? e : e.slice(0, Math.min(e.length, o));
58
58
  }
59
- function Si(o, e) {
59
+ function zi(o, e) {
60
60
  const t = [], s = e === !0 ? +o : o ** 2;
61
- for (let r = 0; r <= o; r++)
62
- for (let n = 0; n <= o; n++)
63
- r ** 2 + n ** 2 === s && t.push([r, n, o]);
61
+ for (let n = 0; n <= o; n++)
62
+ for (let r = 0; r <= o; r++)
63
+ n ** 2 + r ** 2 === s && t.push([n, r, o]);
64
64
  return t;
65
65
  }
66
- function Bi(o, e = 2) {
66
+ function Li(o, e = 2) {
67
67
  return +`${Math.round(+`${o}e${e}`)}e-${e}`;
68
68
  }
69
69
  const G = {
70
- decompose: Ai,
71
- dividers: ni,
72
- divideNumbersByGCD: Mi,
73
- gcd: _t,
74
- lcm: Ii,
75
- numberCorrection: Ci,
76
- periodic: $i,
77
- primes: Pi,
78
- pythagoreanTripletsWithTarget: Si,
79
- round: Bi
70
+ decompose: $i,
71
+ dividers: ui,
72
+ divideNumbersByGCD: Ii,
73
+ gcd: ni,
74
+ lcm: Pi,
75
+ numberCorrection: Bi,
76
+ periodic: Si,
77
+ primes: Ri,
78
+ pythagoreanTripletsWithTarget: zi,
79
+ round: Li
80
80
  };
81
- var w, b, ot, Be;
81
+ var w, b, ht, Se;
82
82
  const $ = class $ {
83
83
  constructor(e, t) {
84
84
  // #region Class fields (2)
85
85
  d(this, w, 1);
86
86
  d(this, b, 1);
87
- d(this, ot, !1);
88
- d(this, Be, "frac");
87
+ d(this, ht, !1);
88
+ d(this, Se, "frac");
89
89
  // ------------------------------------------
90
90
  /**
91
91
  * Parse the value to get the numerator and denominator
@@ -100,7 +100,7 @@ const $ = class $ {
100
100
  case "string":
101
101
  if (s = e.split("/"), s.length > 2)
102
102
  throw new Error(`The given value is not a valid fraction (${e})`);
103
- if (s.map((r) => r === "" || isNaN(Number(r))).includes(!0))
103
+ if (s.map((n) => n === "" || isNaN(Number(n))).includes(!0))
104
104
  throw new Error(`The given value is not a valid fraction (${e})`);
105
105
  if (s.length === 1)
106
106
  return this.parse(+s[0]);
@@ -110,8 +110,8 @@ const $ = class $ {
110
110
  if (Number.isSafeInteger(e))
111
111
  h(this, w, +e), t === void 0 || !Number.isSafeInteger(t) ? h(this, b, 1) : h(this, b, +t);
112
112
  else {
113
- const [, r] = e.toString().split("."), n = r ? r.length : 0;
114
- t === void 0 ? (h(this, w, e * Math.pow(10, n)), h(this, b, Math.pow(10, n))) : Number.isSafeInteger(t) && (h(this, w, e * Math.pow(10, n) - Math.floor(e * Math.pow(10, n - t))), this.denominator = Math.pow(10, n) - Math.pow(10, n - t)), this.reduce();
113
+ const [, n] = e.toString().split("."), r = n ? n.length : 0;
114
+ t === void 0 ? (h(this, w, e * Math.pow(10, r)), h(this, b, Math.pow(10, r))) : Number.isSafeInteger(t) && (h(this, w, e * Math.pow(10, r) - Math.floor(e * Math.pow(10, r - t))), this.denominator = Math.pow(10, r) - Math.pow(10, r - t)), this.reduce();
115
115
  }
116
116
  break;
117
117
  case "object":
@@ -175,8 +175,8 @@ const $ = class $ {
175
175
  const t = new $(e);
176
176
  if (t.numerator === 0)
177
177
  return new $().infinite();
178
- const s = +i(this, w), r = +i(this, b);
179
- return h(this, w, s * t.denominator), h(this, b, r * t.numerator), this.reduce();
178
+ const s = +i(this, w), n = +i(this, b);
179
+ return h(this, w, s * t.denominator), h(this, b, n * t.numerator), this.reduce();
180
180
  });
181
181
  a(this, "infinite", () => (h(this, w, 1 / 0), h(this, b, 1), this));
182
182
  a(this, "invalid", () => (h(this, w, NaN), h(this, b, 1), this));
@@ -184,7 +184,7 @@ const $ = class $ {
184
184
  const e = +i(this, w);
185
185
  return h(this, w, +i(this, b)), h(this, b, e), this;
186
186
  });
187
- a(this, "isApproximative", () => i(this, ot) || i(this, w).toString().length >= 15 && i(this, b).toString().length >= 15);
187
+ a(this, "isApproximative", () => i(this, ht) || i(this, w).toString().length >= 15 && i(this, b).toString().length >= 15);
188
188
  a(this, "isEqual", (e) => this.compare(e, "="));
189
189
  a(this, "isEven", () => this.isRelative() && this.value % 2 === 0);
190
190
  a(this, "isExact", () => !this.isApproximative());
@@ -242,8 +242,8 @@ const $ = class $ {
242
242
  throw new Error("The root of a negative number must be odd.");
243
243
  const t = this.sign();
244
244
  this.abs(), this.reduce();
245
- const s = Math.floor(Math.pow(i(this, w), Math.abs(1 / e))), r = Math.floor(Math.pow(i(this, b), Math.abs(1 / e)));
246
- return h(this, w, Math.pow(i(this, w), Math.abs(1 / e))), h(this, b, Math.pow(i(this, b), Math.abs(1 / e))), (s !== i(this, w) || r !== i(this, b)) && (h(this, w, i(this, w) / i(this, b)), h(this, b, 1), h(this, ot, !0)), this.multiply(t), this;
245
+ const s = Math.floor(Math.pow(i(this, w), Math.abs(1 / e))), n = Math.floor(Math.pow(i(this, b), Math.abs(1 / e)));
246
+ return h(this, w, Math.pow(i(this, w), Math.abs(1 / e))), h(this, b, Math.pow(i(this, b), Math.abs(1 / e))), (s !== i(this, w) || n !== i(this, b)) && (h(this, w, i(this, w) / i(this, b)), h(this, b, 1), h(this, ht, !0)), this.multiply(t), this;
247
247
  });
248
248
  a(this, "sign", () => i(this, w) * i(this, b) >= 0 ? 1 : -1);
249
249
  a(this, "sqrt", () => this.root(2));
@@ -272,17 +272,17 @@ const $ = class $ {
272
272
  h(this, w, e);
273
273
  }
274
274
  get tfrac() {
275
- return h(this, Be, "tfrac"), this;
275
+ return h(this, Se, "tfrac"), this;
276
276
  }
277
277
  get dfrac() {
278
- return h(this, Be, "dfrac"), this;
278
+ return h(this, Se, "dfrac"), this;
279
279
  }
280
280
  get frac() {
281
- return h(this, Be, "frac"), this;
281
+ return h(this, Se, "frac"), this;
282
282
  }
283
283
  // Display getter
284
284
  get tex() {
285
- return this.isInfinity() ? `${this.sign() === 1 ? "+" : "-"}\\infty` : this.isExact() ? i(this, b) === 1 ? `${i(this, w)}` : i(this, w) < 0 ? `-\\${i(this, Be)}{ ${-i(this, w)} }{ ${i(this, b)} }` : `\\${i(this, Be)}{ ${i(this, w)} }{ ${i(this, b)} }` : this.value.toFixed(3);
285
+ return this.isInfinity() ? `${this.sign() === 1 ? "+" : "-"}\\infty` : this.isExact() ? i(this, b) === 1 ? `${i(this, w)}` : i(this, w) < 0 ? `-\\${i(this, Se)}{ ${-i(this, w)} }{ ${i(this, b)} }` : `\\${i(this, Se)}{ ${i(this, w)} }{ ${i(this, b)} }` : this.value.toFixed(3);
286
286
  }
287
287
  get texWithSign() {
288
288
  return this.isPositive() ? `+${this.tex}` : this.tex;
@@ -292,7 +292,7 @@ const $ = class $ {
292
292
  }
293
293
  // #endregion Getters And Setters (11)
294
294
  };
295
- w = new WeakMap(), b = new WeakMap(), ot = new WeakMap(), Be = new WeakMap(), a($, "average", (...e) => {
295
+ w = new WeakMap(), b = new WeakMap(), ht = new WeakMap(), Se = new WeakMap(), a($, "average", (...e) => {
296
296
  const t = new $().zero();
297
297
  for (const s of e)
298
298
  t.add(s);
@@ -300,74 +300,74 @@ w = new WeakMap(), b = new WeakMap(), ot = new WeakMap(), Be = new WeakMap(), a(
300
300
  }), a($, "max", (...e) => {
301
301
  let t = new $(e[0]);
302
302
  for (const s of e) {
303
- const r = new $(s);
304
- r.isGreater(t) && (t = r.clone());
303
+ const n = new $(s);
304
+ n.isGreater(t) && (t = n.clone());
305
305
  }
306
306
  return t;
307
307
  }), a($, "min", (...e) => {
308
308
  let t = new $(e[0]);
309
309
  for (const s of e) {
310
- const r = new $(s);
311
- r.isLesser(t) && (t = r.clone());
310
+ const n = new $(s);
311
+ n.isLesser(t) && (t = n.clone());
312
312
  }
313
313
  return t;
314
314
  }), a($, "sort", (e, t) => {
315
- const r = e.map((n) => n instanceof $ ? n : new $(n)).sort((n, l) => n.value - l.value);
316
- return t && r.reverse(), r;
315
+ const n = e.map((r) => r instanceof $ ? r : new $(r)).sort((r, l) => r.value - l.value);
316
+ return t && n.reverse(), n;
317
317
  }), a($, "unique", (e) => {
318
318
  const t = {}, s = [];
319
- return e.forEach((r) => {
320
- r instanceof $ || (r = new $(r)), t[r.clone().reduce().tex] || (s.push(r.clone()), t[r.tex] = !0);
319
+ return e.forEach((n) => {
320
+ n instanceof $ || (n = new $(n)), t[n.clone().reduce().tex] || (s.push(n.clone()), t[n.tex] = !0);
321
321
  }), s;
322
322
  }), a($, "xMultiply", (...e) => {
323
323
  const t = new $();
324
324
  for (const s of e) {
325
- const r = new $(s);
326
- t.numerator = t.numerator * r.numerator, t.denominator = t.denominator * r.denominator;
325
+ const n = new $(s);
326
+ t.numerator = t.numerator * n.numerator, t.denominator = t.denominator * n.denominator;
327
327
  }
328
328
  return t;
329
329
  });
330
330
  let c = $;
331
- var Z, J, se, We;
332
- class ft {
331
+ var V, J, se, Xe;
332
+ class pt {
333
333
  constructor(...e) {
334
- d(this, Z);
334
+ d(this, V);
335
335
  d(this, J);
336
336
  d(this, se);
337
- d(this, We);
337
+ d(this, Xe);
338
338
  // ------------------------------------------
339
339
  // Creation / parsing functions
340
340
  // ------------------------------------------
341
- a(this, "parse", (e, t, s) => (h(this, se, s ?? 1), h(this, J, t ?? 2), h(this, Z, e), i(this, J) % 2 === 0 && i(this, Z) < 0 && h(this, We, !1), this));
341
+ a(this, "parse", (e, t, s) => (h(this, se, s ?? 1), h(this, J, t ?? 2), h(this, V, e), i(this, J) % 2 === 0 && i(this, V) < 0 && h(this, Xe, !1), this));
342
342
  // ------------------------------------------
343
343
  // Mathematical operations
344
344
  // ------------------------------------------
345
345
  a(this, "reduce", () => {
346
- let e = Math.floor(Math.pow(i(this, Z), 1 / i(this, J)));
346
+ let e = Math.floor(Math.pow(i(this, V), 1 / i(this, J)));
347
347
  for (; e > 1; ) {
348
- if (i(this, Z) % Math.pow(e, i(this, J)) === 0) {
349
- h(this, se, i(this, se) * e), h(this, Z, i(this, Z) / Math.pow(e, i(this, J))), e = Math.floor(Math.pow(i(this, Z), 1 / i(this, J)));
348
+ if (i(this, V) % Math.pow(e, i(this, J)) === 0) {
349
+ h(this, se, i(this, se) * e), h(this, V, i(this, V) / Math.pow(e, i(this, J))), e = Math.floor(Math.pow(i(this, V), 1 / i(this, J)));
350
350
  continue;
351
351
  }
352
352
  e--;
353
353
  }
354
354
  return this;
355
355
  });
356
- a(this, "multiply", (e) => (h(this, Z, i(this, Z) * e.radical), this.reduce()));
356
+ a(this, "multiply", (e) => (h(this, V, i(this, V) * e.radical), this.reduce()));
357
357
  // ------------------------------------------
358
358
  // Help functions
359
359
  // ------------------------------------------
360
- a(this, "hasRadical", () => !(i(this, Z) === 1 || i(this, Z) === 0 || !i(this, We)));
361
- h(this, Z, 1), h(this, se, 1), h(this, J, 2), h(this, We, !0), e.length > 0 && this.parse(e[0], e[1], e[2]);
360
+ a(this, "hasRadical", () => !(i(this, V) === 1 || i(this, V) === 0 || !i(this, Xe)));
361
+ h(this, V, 1), h(this, se, 1), h(this, J, 2), h(this, Xe, !0), e.length > 0 && this.parse(e[0], e[1], e[2]);
362
362
  }
363
363
  // ------------------------------------------
364
364
  // Getter and setter
365
365
  // ------------------------------------------
366
366
  get radical() {
367
- return i(this, Z);
367
+ return i(this, V);
368
368
  }
369
369
  set radical(e) {
370
- h(this, Z, e);
370
+ h(this, V, e);
371
371
  }
372
372
  get nth() {
373
373
  return i(this, J);
@@ -383,127 +383,127 @@ class ft {
383
383
  }
384
384
  get tex() {
385
385
  let e;
386
- return i(this, se) === 1 ? e = "" : i(this, se) === -1 ? e = "-" : e = i(this, se).toString(), i(this, Z) === 1 ? `${i(this, se)}` : i(this, J) === 2 ? `${e}\\sqrt{${i(this, Z)}}` : `${e}\\sqrt[${i(this, J)}]{${i(this, Z)}}`;
386
+ return i(this, se) === 1 ? e = "" : i(this, se) === -1 ? e = "-" : e = i(this, se).toString(), i(this, V) === 1 ? `${i(this, se)}` : i(this, J) === 2 ? `${e}\\sqrt{${i(this, V)}}` : `${e}\\sqrt[${i(this, J)}]{${i(this, V)}}`;
387
387
  }
388
388
  get display() {
389
389
  let e;
390
- return i(this, se) === 1 ? e = "" : i(this, se) === -1 ? e = "-" : e = i(this, se).toString(), i(this, Z) === 1 ? `${i(this, se)}` : i(this, J) === 2 ? `${e}sqrt{${i(this, Z)}}` : `${e}root(${i(this, J)}){${i(this, Z)}}`;
390
+ return i(this, se) === 1 ? e = "" : i(this, se) === -1 ? e = "-" : e = i(this, se).toString(), i(this, V) === 1 ? `${i(this, se)}` : i(this, J) === 2 ? `${e}sqrt{${i(this, V)}}` : `${e}root(${i(this, J)}){${i(this, V)}}`;
391
391
  }
392
392
  get value() {
393
- return i(this, se) * Math.pow(i(this, Z), 1 / i(this, J));
393
+ return i(this, se) * Math.pow(i(this, V), 1 / i(this, J));
394
394
  }
395
395
  }
396
- Z = new WeakMap(), J = new WeakMap(), se = new WeakMap(), We = new WeakMap();
397
- var oi = (o) => {
396
+ V = new WeakMap(), J = new WeakMap(), se = new WeakMap(), Xe = new WeakMap();
397
+ var Di = Object.defineProperty, fi = (o) => {
398
398
  throw TypeError(o);
399
- }, hi = (o, e, t) => e.has(o) || oi("Cannot " + t), K = (o, e, t) => (hi(o, e, "read from private field"), t ? t.call(o) : e.get(o)), tt = (o, e, t) => e.has(o) ? oi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(o) : e.set(o, t), be = (o, e, t, s) => (hi(o, e, "write to private field"), e.set(o, t), t);
400
- const ai = {
399
+ }, Vi = (o, e, t) => e in o ? Di(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t, Xt = (o, e, t) => Vi(o, typeof e != "symbol" ? e + "" : e, t), di = (o, e, t) => e.has(o) || fi("Cannot " + t), K = (o, e, t) => (di(o, e, "read from private field"), t ? t.call(o) : e.get(o)), st = (o, e, t) => e.has(o) ? fi("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(o) : e.set(o, t), be = (o, e, t, s) => (di(o, e, "write to private field"), e.set(o, t), t);
400
+ const ri = {
401
401
  pi: Math.PI,
402
402
  e: Math.exp(1)
403
403
  };
404
- var m = /* @__PURE__ */ ((o) => (o.VARIABLE = "variable", o.COEFFICIENT = "coefficient", o.OPERATION = "operation", o.CONSTANT = "constant", o.FUNCTION = "function", o.FUNCTION_ARGUMENT = "function-argument", o.MONOM = "monom", o.LEFT_PARENTHESIS = "(", o.RIGHT_PARENTHESIS = ")", o))(m || {}), it = /* @__PURE__ */ ((o) => (o.EXPRESSION = "expression", o.POLYNOM = "polynom", o.SET = "set", o.NUMERIC = "numeric", o))(it || {});
405
- function Ri(o, e) {
404
+ var p = /* @__PURE__ */ ((o) => (o.VARIABLE = "variable", o.COEFFICIENT = "coefficient", o.OPERATION = "operation", o.CONSTANT = "constant", o.FUNCTION = "function", o.FUNCTION_ARGUMENT = "function-argument", o.MONOM = "monom", o.LEFT_PARENTHESIS = "(", o.RIGHT_PARENTHESIS = ")", o))(p || {}), Ve = /* @__PURE__ */ ((o) => (o.EXPRESSION = "expression", o.POLYNOM = "polynom", o.SET = "set", o.NUMERIC = "numeric", o))(Ve || {});
405
+ function Zi(o, e) {
406
406
  if (o.length <= 1)
407
407
  return o;
408
- const t = Object.keys(e).filter((E) => e[E].type === m.FUNCTION).map((E) => E);
408
+ const t = Object.keys(e).filter((E) => e[E].type === p.FUNCTION).map((E) => E);
409
409
  t.sort((E, L) => L.length - E.length);
410
- const s = new RegExp(`^(${t.join("|")})\\(`), r = Object.keys(ai);
411
- r.sort((E, L) => L.length - E.length);
412
- const n = new RegExp(`^(${r.join("|")})`), l = /^(\d+(\.\d+)?)/;
413
- let u = "", f, p, g;
410
+ const s = new RegExp(`^(${t.join("|")})\\(`), n = Object.keys(ri);
411
+ n.sort((E, L) => L.length - E.length);
412
+ const r = new RegExp(`^(${n.join("|")})`), l = /^(\d+(\.\d+)?)/;
413
+ let u = "", f, m, g;
414
414
  for (; o.length > 0; ) {
415
- if (f = p, g = void 0, t.length > 0 && s.exec(o)) {
415
+ if (f = m, g = void 0, t.length > 0 && s.exec(o)) {
416
416
  const E = t.find((L) => o.startsWith(L));
417
- E && (g = E + "(", o = o.slice(E.length + 1), p = m.FUNCTION);
418
- } else if (r.length > 0 && n.exec(o)) {
419
- const E = r.find((L) => o.startsWith(L));
420
- E && (g = E, o = o.slice(E.length), p = m.CONSTANT);
417
+ E && (g = E + "(", o = o.slice(E.length + 1), m = p.FUNCTION);
418
+ } else if (n.length > 0 && r.exec(o)) {
419
+ const E = n.find((L) => o.startsWith(L));
420
+ E && (g = E, o = o.slice(E.length), m = p.CONSTANT);
421
421
  } else if (l.exec(o)) {
422
422
  const E = l.exec(o);
423
- E && (g = E[0], o = o.slice(E[0].length), p = m.COEFFICIENT);
423
+ E && (g = E[0], o = o.slice(E[0].length), m = p.COEFFICIENT);
424
424
  } else
425
425
  switch (g = o[0], o = o.slice(1), g) {
426
426
  case "(":
427
- p = m.LEFT_PARENTHESIS;
427
+ m = p.LEFT_PARENTHESIS;
428
428
  break;
429
429
  case ")":
430
- p = m.RIGHT_PARENTHESIS;
430
+ m = p.RIGHT_PARENTHESIS;
431
431
  break;
432
432
  case ",":
433
- p = m.FUNCTION_ARGUMENT;
433
+ m = p.FUNCTION_ARGUMENT;
434
434
  break;
435
435
  case "+":
436
436
  case "-":
437
437
  case "*":
438
438
  case "/":
439
439
  case "^":
440
- p = m.OPERATION;
440
+ m = p.OPERATION;
441
441
  break;
442
442
  default:
443
- p = m.VARIABLE;
443
+ m = p.VARIABLE;
444
444
  }
445
- if (g === void 0 || p === void 0)
445
+ if (g === void 0 || m === void 0)
446
446
  throw new Error("The token is undefined");
447
- u += zi(f, p), u += g;
447
+ u += Fi(f, m), u += g;
448
448
  }
449
449
  return u;
450
450
  }
451
- function zi(o, e) {
452
- return o === void 0 || o === m.OPERATION || e === m.OPERATION || o === m.LEFT_PARENTHESIS || o === m.FUNCTION || o === m.FUNCTION_ARGUMENT || e === m.RIGHT_PARENTHESIS || e === m.FUNCTION_ARGUMENT ? "" : "*";
451
+ function Fi(o, e) {
452
+ return o === void 0 || o === p.OPERATION || e === p.OPERATION || o === p.LEFT_PARENTHESIS || o === p.FUNCTION || o === p.FUNCTION_ARGUMENT || e === p.RIGHT_PARENTHESIS || e === p.FUNCTION_ARGUMENT ? "" : "*";
453
453
  }
454
- const ki = {
455
- "^": { precedence: 4, associative: "right", type: m.OPERATION },
456
- "*": { precedence: 3, associative: "left", type: m.OPERATION },
457
- "/": { precedence: 3, associative: "left", type: m.OPERATION },
458
- "+": { precedence: 2, associative: "left", type: m.OPERATION },
459
- "-": { precedence: 2, associative: "left", type: m.OPERATION }
460
- }, Li = {
461
- "^": { precedence: 4, associative: "right", type: m.OPERATION },
462
- "*": { precedence: 3, associative: "left", type: m.OPERATION },
463
- "/": { precedence: 3, associative: "left", type: m.OPERATION },
464
- "+": { precedence: 2, associative: "left", type: m.OPERATION },
465
- "-": { precedence: 2, associative: "left", type: m.OPERATION },
466
- "%": { precedence: 3, associative: "right", type: m.OPERATION },
467
- sin: { precedence: 4, associative: "right", type: m.FUNCTION },
468
- cos: { precedence: 4, associative: "right", type: m.FUNCTION },
469
- tan: { precedence: 4, associative: "right", type: m.FUNCTION },
470
- sqrt: { precedence: 4, associative: "right", type: m.FUNCTION },
471
- nthrt: { precedence: 4, associative: "right", type: m.FUNCTION },
472
- ",": { precedence: 2, associative: "left", type: m.FUNCTION_ARGUMENT }
473
- }, Di = {
474
- "^": { precedence: 4, associative: "right", type: m.OPERATION },
475
- "*": { precedence: 3, associative: "left", type: m.OPERATION },
476
- "/": { precedence: 3, associative: "left", type: m.OPERATION },
477
- "+": { precedence: 2, associative: "left", type: m.OPERATION },
478
- "-": { precedence: 2, associative: "left", type: m.OPERATION },
479
- "%": { precedence: 3, associative: "right", type: m.OPERATION },
480
- sin: { precedence: 4, associative: "right", type: m.FUNCTION },
481
- cos: { precedence: 4, associative: "right", type: m.FUNCTION },
482
- tan: { precedence: 4, associative: "right", type: m.FUNCTION },
483
- sqrt: { precedence: 4, associative: "right", type: m.FUNCTION },
484
- nthrt: { precedence: 4, associative: "right", type: m.FUNCTION },
485
- ln: { precedence: 4, associative: "right", type: m.FUNCTION },
486
- log: { precedence: 4, associative: "right", type: m.FUNCTION }
487
- }, Zi = {
488
- "&": { precedence: 3, associative: "left", type: m.OPERATION },
489
- "|": { precedence: 3, associative: "left", type: m.OPERATION },
490
- "!": { precedence: 4, associative: "right", type: m.OPERATION },
491
- "-": { precedence: 2, associative: "left", type: m.OPERATION }
454
+ const ji = {
455
+ "^": { precedence: 4, associative: "right", type: p.OPERATION },
456
+ "*": { precedence: 3, associative: "left", type: p.OPERATION },
457
+ "/": { precedence: 3, associative: "left", type: p.OPERATION },
458
+ "+": { precedence: 2, associative: "left", type: p.OPERATION },
459
+ "-": { precedence: 2, associative: "left", type: p.OPERATION }
460
+ }, Ui = {
461
+ "^": { precedence: 4, associative: "right", type: p.OPERATION },
462
+ "*": { precedence: 3, associative: "left", type: p.OPERATION },
463
+ "/": { precedence: 3, associative: "left", type: p.OPERATION },
464
+ "+": { precedence: 2, associative: "left", type: p.OPERATION },
465
+ "-": { precedence: 2, associative: "left", type: p.OPERATION },
466
+ "%": { precedence: 3, associative: "right", type: p.OPERATION },
467
+ sin: { precedence: 4, associative: "right", type: p.FUNCTION },
468
+ cos: { precedence: 4, associative: "right", type: p.FUNCTION },
469
+ tan: { precedence: 4, associative: "right", type: p.FUNCTION },
470
+ sqrt: { precedence: 4, associative: "right", type: p.FUNCTION },
471
+ nthrt: { precedence: 4, associative: "right", type: p.FUNCTION },
472
+ ",": { precedence: 2, associative: "left", type: p.FUNCTION_ARGUMENT }
473
+ }, Gi = {
474
+ "^": { precedence: 4, associative: "right", type: p.OPERATION },
475
+ "*": { precedence: 3, associative: "left", type: p.OPERATION },
476
+ "/": { precedence: 3, associative: "left", type: p.OPERATION },
477
+ "+": { precedence: 2, associative: "left", type: p.OPERATION },
478
+ "-": { precedence: 2, associative: "left", type: p.OPERATION },
479
+ "%": { precedence: 3, associative: "right", type: p.OPERATION },
480
+ sin: { precedence: 4, associative: "right", type: p.FUNCTION },
481
+ cos: { precedence: 4, associative: "right", type: p.FUNCTION },
482
+ tan: { precedence: 4, associative: "right", type: p.FUNCTION },
483
+ sqrt: { precedence: 4, associative: "right", type: p.FUNCTION },
484
+ nthrt: { precedence: 4, associative: "right", type: p.FUNCTION },
485
+ ln: { precedence: 4, associative: "right", type: p.FUNCTION },
486
+ log: { precedence: 4, associative: "right", type: p.FUNCTION }
487
+ }, Wi = {
488
+ "&": { precedence: 3, associative: "left", type: p.OPERATION },
489
+ "|": { precedence: 3, associative: "left", type: p.OPERATION },
490
+ "!": { precedence: 4, associative: "right", type: p.OPERATION },
491
+ "-": { precedence: 2, associative: "left", type: p.OPERATION }
492
492
  };
493
- var je, st, ie, dt, ke;
494
- class li {
493
+ var Ge, nt, ie, mt, Le;
494
+ class Gt {
495
495
  constructor(e) {
496
- tt(this, je), tt(this, st, []), tt(this, ie, {}), tt(this, dt, []), tt(this, ke), be(this, je, typeof e > "u" ? it.POLYNOM : e), this.tokenConfigInitialization();
496
+ st(this, Ge), st(this, nt, []), st(this, ie, {}), st(this, mt, []), st(this, Le), be(this, Ge, typeof e > "u" ? Ve.POLYNOM : e), this.tokenConfigInitialization();
497
497
  }
498
498
  // Getter
499
499
  get rpn() {
500
- return K(this, st);
500
+ return K(this, nt);
501
501
  }
502
502
  get rpnToken() {
503
- return K(this, st).map((e) => e.token);
503
+ return K(this, nt).map((e) => e.token);
504
504
  }
505
505
  tokenConfigInitialization() {
506
- return K(this, je) === it.SET ? (be(this, ie, Zi), be(this, ke, !1)) : K(this, je) === it.NUMERIC ? (be(this, ie, Di), be(this, ke, !0)) : K(this, je) === it.EXPRESSION ? (be(this, ie, Li), be(this, ke, !0)) : (be(this, ie, ki), be(this, ke, !0)), be(this, dt, Object.keys(K(this, ie)).sort((e, t) => t.length - e.length)), K(this, ie);
506
+ return K(this, Ge) === Ve.SET ? (be(this, ie, Wi), be(this, Le, !1)) : K(this, Ge) === Ve.NUMERIC ? (be(this, ie, Gi), be(this, Le, !0)) : K(this, Ge) === Ve.EXPRESSION ? (be(this, ie, Ui), be(this, Le, !0)) : (be(this, ie, ji), be(this, Le, !0)), be(this, mt, Object.keys(K(this, ie)).sort((e, t) => t.length - e.length)), K(this, ie);
507
507
  }
508
508
  /**
509
509
  * Get the next token to analyse.
@@ -511,37 +511,37 @@ class li {
511
511
  * @param start (number) CUrrent position in the expr string.
512
512
  */
513
513
  NextToken(e, t) {
514
- let s, r;
515
- if (s = "", r = void 0, e[t] === "(")
516
- s = "(", r = m.LEFT_PARENTHESIS;
514
+ let s, n;
515
+ if (s = "", n = void 0, e[t] === "(")
516
+ s = "(", n = p.LEFT_PARENTHESIS;
517
517
  else if (e[t] === ")")
518
- s = ")", r = m.RIGHT_PARENTHESIS;
518
+ s = ")", n = p.RIGHT_PARENTHESIS;
519
519
  else if (e[t] === ",")
520
- s = ",", r = m.FUNCTION_ARGUMENT;
520
+ s = ",", n = p.FUNCTION_ARGUMENT;
521
521
  else {
522
- for (const n of K(this, dt))
523
- if (e.substring(t, t + n.length) === n) {
524
- s += n, r = K(this, ie)[n].type;
522
+ for (const r of K(this, mt))
523
+ if (e.substring(t, t + r.length) === r) {
524
+ s += r, n = K(this, ie)[r].type;
525
525
  break;
526
526
  }
527
- for (const n in ai)
528
- if (e.substring(t, t + n.length) === n) {
529
- s += n, r = m.CONSTANT;
527
+ for (const r in ri)
528
+ if (e.substring(t, t + r.length) === r) {
529
+ s += r, n = p.CONSTANT;
530
530
  break;
531
531
  }
532
532
  if (s === "")
533
533
  if (/[0-9.]/.exec(e[t])) {
534
- const n = /^([0-9.]+)/.exec(e.substring(t));
535
- s = n ? n[0] : "", r = m.COEFFICIENT;
534
+ const r = /^([0-9.]+)/.exec(e.substring(t));
535
+ s = r ? r[0] : "", n = p.COEFFICIENT;
536
536
  } else if (/[a-zA-Z]/.exec(e[t])) {
537
- const n = /^([a-zA-Z])/.exec(e.substring(t));
538
- s = n ? n[0] : "", r = m.VARIABLE;
537
+ const r = /^([a-zA-Z])/.exec(e.substring(t));
538
+ s = r ? r[0] : "", n = p.VARIABLE;
539
539
  } else
540
- console.log("Unidentified token", e[t], e, t), s = e[t], r = m.MONOM;
540
+ console.log("Unidentified token", e[t], e, t), s = e[t], n = p.MONOM;
541
541
  }
542
- if (r === void 0)
542
+ if (n === void 0)
543
543
  throw new Error(`Token type is undefined for token ${s}`);
544
- return [s, t + s.length, r];
544
+ return [s, t + s.length, n];
545
545
  }
546
546
  /**
547
547
  * Parse an expression using the shutting yard tree algorithms
@@ -550,88 +550,188 @@ class li {
550
550
  * @param uniformize
551
551
  */
552
552
  parse(e, t) {
553
- const s = [], r = [];
554
- let n = "", l = 0, u;
555
- (t ?? K(this, ke)) && (e = Ri(e, K(this, ie)));
553
+ const s = [], n = [];
554
+ let r = "", l = 0, u;
555
+ (t ?? K(this, Le)) && (e = Zi(e, K(this, ie)));
556
556
  const f = 50;
557
- let p = 50, g;
557
+ let m = 50, g;
558
558
  for (; l < e.length; ) {
559
- if (p--, p === 0) {
559
+ if (m--, m === 0) {
560
560
  console.log("SECURITY LEVEL 1 EXIT");
561
561
  break;
562
562
  }
563
- switch ([n, l, u] = this.NextToken(e, l), u) {
564
- case m.MONOM:
565
- case m.COEFFICIENT:
566
- case m.VARIABLE:
567
- case m.CONSTANT:
563
+ switch ([r, l, u] = this.NextToken(e, l), u) {
564
+ case p.MONOM:
565
+ case p.COEFFICIENT:
566
+ case p.VARIABLE:
567
+ case p.CONSTANT:
568
568
  s.push({
569
- token: n,
569
+ token: r,
570
570
  tokenType: u
571
571
  });
572
572
  break;
573
- case m.OPERATION:
574
- if (r.length > 0) {
575
- let E = r[r.length - 1];
573
+ case p.OPERATION:
574
+ if (n.length > 0) {
575
+ let E = n[n.length - 1];
576
576
  for (g = +f; E.token in K(this, ie) && //either o1 is left-associative and its precedence is less than or equal to that of o2,
577
- (K(this, ie)[n].associative === "left" && K(this, ie)[n].precedence <= K(this, ie)[E.token].precedence || //or o1 is right associative, and has precedence less than that of o2,
578
- K(this, ie)[n].associative === "right" && K(this, ie)[n].precedence < K(this, ie)[E.token].precedence); ) {
577
+ (K(this, ie)[r].associative === "left" && K(this, ie)[r].precedence <= K(this, ie)[E.token].precedence || //or o1 is right associative, and has precedence less than that of o2,
578
+ K(this, ie)[r].associative === "right" && K(this, ie)[r].precedence < K(this, ie)[E.token].precedence); ) {
579
579
  if (g--, g === 0) {
580
580
  console.log("SECURITY LEVEL 2 OPERATION EXIT");
581
581
  break;
582
582
  }
583
- if (s.push(r.pop() ?? { token: "", tokenType: m.OPERATION }), r.length === 0)
583
+ if (s.push(n.pop() ?? { token: "", tokenType: p.OPERATION }), n.length === 0)
584
584
  break;
585
- E = r[r.length - 1];
585
+ E = n[n.length - 1];
586
586
  }
587
587
  }
588
- r.push({ token: n, tokenType: u });
588
+ n.push({ token: r, tokenType: u });
589
589
  break;
590
- case m.FUNCTION_ARGUMENT:
591
- for (g = +f; r[r.length - 1].token !== "(" && r.length > 0; ) {
590
+ case p.FUNCTION_ARGUMENT:
591
+ for (g = +f; n[n.length - 1].token !== "(" && n.length > 0; ) {
592
592
  if (g--, g === 0) {
593
593
  console.log("SECURITY LEVEL 2 FUNCTION ARGUMENT EXIT");
594
594
  break;
595
595
  }
596
- s.push(r.pop() ?? { token: n, tokenType: u });
596
+ s.push(n.pop() ?? { token: r, tokenType: u });
597
597
  }
598
598
  break;
599
- case m.LEFT_PARENTHESIS:
600
- r.push({ token: n, tokenType: u }), e[l] === "-" && s.push({ token: "0", tokenType: m.COEFFICIENT });
599
+ case p.LEFT_PARENTHESIS:
600
+ n.push({ token: r, tokenType: u }), e[l] === "-" && s.push({ token: "0", tokenType: p.COEFFICIENT });
601
601
  break;
602
- case m.RIGHT_PARENTHESIS:
603
- for (g = +f; r[r.length - 1].token !== "(" && r.length > 1; ) {
602
+ case p.RIGHT_PARENTHESIS:
603
+ for (g = +f; n[n.length - 1].token !== "(" && n.length > 1; ) {
604
604
  if (g--, g === 0) {
605
605
  console.log("SECURITY LEVEL 2 CLOSING PARENTHESIS EXIT");
606
606
  break;
607
607
  }
608
- s.push(r.pop() ?? { token: n, tokenType: u });
608
+ s.push(n.pop() ?? { token: r, tokenType: u });
609
609
  }
610
- r.pop();
610
+ n.pop();
611
611
  break;
612
- case m.FUNCTION:
613
- r.push({ token: n, tokenType: u });
612
+ case p.FUNCTION:
613
+ n.push({ token: r, tokenType: u });
614
614
  break;
615
615
  default:
616
- throw new Error(`Token type ${n} is not handled`);
616
+ throw new Error(`Token type ${r} is not handled`);
617
617
  }
618
618
  }
619
- return be(this, st, s.concat(r.reverse())), this;
619
+ return be(this, nt, s.concat(n.reverse())), this;
620
620
  }
621
621
  }
622
- je = /* @__PURE__ */ new WeakMap(), st = /* @__PURE__ */ new WeakMap(), ie = /* @__PURE__ */ new WeakMap(), dt = /* @__PURE__ */ new WeakMap(), ke = /* @__PURE__ */ new WeakMap();
623
- var O, v, He, pt, Re, bt, xt;
624
- const P = class P {
622
+ Ge = /* @__PURE__ */ new WeakMap(), nt = /* @__PURE__ */ new WeakMap(), ie = /* @__PURE__ */ new WeakMap(), mt = /* @__PURE__ */ new WeakMap(), Le = /* @__PURE__ */ new WeakMap();
623
+ class Hi {
624
+ constructor(e, t) {
625
+ Xt(this, "_rpn"), Xt(this, "_expression"), Xt(this, "_isValid"), this._expression = e;
626
+ try {
627
+ this._rpn = new Gt(Ve.NUMERIC).parse(e, t).rpn;
628
+ } catch {
629
+ throw this._rpn = null, this._isValid = !1, new Error(`There was a problem parsing: ${e}`);
630
+ }
631
+ }
632
+ get rpn() {
633
+ return this._rpn ?? [];
634
+ }
635
+ get isValid() {
636
+ if (this._isValid === void 0)
637
+ try {
638
+ this.evaluate({ x: 2 });
639
+ } catch {
640
+ this._isValid = !1;
641
+ }
642
+ return this._isValid ?? !1;
643
+ }
644
+ set isValid(e) {
645
+ this._isValid = e;
646
+ }
647
+ get expression() {
648
+ return this._expression;
649
+ }
650
+ evaluate(e) {
651
+ const t = [];
652
+ if (this._rpn === null)
653
+ return this._isValid = !1, 0;
654
+ this._isValid = !0;
655
+ for (const s of this._rpn)
656
+ if (s.tokenType === p.COEFFICIENT)
657
+ if (!isNaN(+s.token))
658
+ t.push(+s.token);
659
+ else {
660
+ const n = s.token.split("/");
661
+ if (n.length !== 2)
662
+ throw this._isValid = !1, new Error("This coefficient is not a fraction");
663
+ t.push(+n[0] / +n[1]);
664
+ }
665
+ else if (s.tokenType === p.VARIABLE && e !== void 0)
666
+ Object.hasOwn(e, s.token) && t.push(+e[s.token]);
667
+ else if (s.tokenType === p.CONSTANT)
668
+ t.push(ri[s.token]);
669
+ else if (s.tokenType === p.OPERATION) {
670
+ if (s.token === "*") {
671
+ const n = t.pop(), r = t.pop();
672
+ if (r === void 0 || n === void 0)
673
+ throw this._isValid = !1, new Error(`The multiplication factors ${r ?? "a"} or ${n ?? "b"} are not defined`);
674
+ t.push(r * n);
675
+ } else if (s.token === "/") {
676
+ const n = t.pop(), r = t.pop();
677
+ if (r === void 0 || n === void 0)
678
+ throw this._isValid = !1, new Error(`The division values ${r ?? "a"} or ${n ?? "b"} are not defined`);
679
+ t.push(r / n);
680
+ } else if (s.token === "+") {
681
+ const n = t.pop(), r = t.pop();
682
+ if (r === void 0 || n === void 0)
683
+ throw this._isValid = !1, new Error(`The addition values ${r ?? "a"} or ${n ?? "b"} are not defined`);
684
+ t.push(+r + +n);
685
+ } else if (s.token === "-") {
686
+ const n = t.pop(), r = t.pop() ?? 0;
687
+ if (n === void 0)
688
+ throw this._isValid = !1, new Error("The subtraction value b is not defined");
689
+ t.push(r - n);
690
+ } else if (s.token === "^") {
691
+ const n = t.pop(), r = t.pop();
692
+ if (r === void 0 || n === void 0)
693
+ throw this._isValid = !1, new Error(`The base value ${r ?? "a"} or exponent ${n ?? "b"} are not defined`);
694
+ t.push(Math.pow(r, n));
695
+ }
696
+ } else if (s.tokenType === p.FUNCTION) {
697
+ const n = t.pop();
698
+ if (n === void 0)
699
+ throw this._isValid = !1, new Error(`The parameters for ${s.token} is not defined`);
700
+ if (s.token === "sin")
701
+ t.push(Math.sin(n));
702
+ else if (s.token === "cos")
703
+ t.push(Math.cos(n));
704
+ else if (s.token === "tan")
705
+ t.push(Math.tan(n));
706
+ else if (s.token === "sqrt")
707
+ t.push(Math.sqrt(n));
708
+ else if (s.token === "nthrt") {
709
+ const r = t.pop();
710
+ if (r === void 0)
711
+ throw this._isValid = !1, new Error("The nthrt function requires two parameters");
712
+ n % 2 === 0 && r < 0 ? t.push(NaN) : t.push((r < 0 ? -1 : 1) * Math.pow(Math.abs(r), 1 / n));
713
+ } else s.token === "ln" ? t.push(Math.log(n)) : s.token === "log" && t.push(Math.log10(n));
714
+ }
715
+ if (t.length === 1)
716
+ return this._numberCorrection(t[0]);
717
+ throw new Error(`There was a problem parsing: ${this._expression}`);
718
+ }
719
+ _numberCorrection(e, t = 8) {
720
+ return +e.toFixed(t);
721
+ }
722
+ }
723
+ var T, v, Ye, gt, Re, Et, Nt;
724
+ const I = class I {
625
725
  constructor(e) {
626
- d(this, He);
627
- d(this, O);
726
+ d(this, Ye);
727
+ d(this, T);
628
728
  d(this, v);
629
729
  /**
630
730
  * Clone the current Monom.
631
731
  */
632
732
  a(this, "clone", () => {
633
- const e = new P();
634
- e.coefficient = i(this, O).clone();
733
+ const e = new I();
734
+ e.coefficient = i(this, T).clone();
635
735
  for (const t in i(this, v))
636
736
  e.setLetter(t, i(this, v)[t].clone());
637
737
  return e;
@@ -642,8 +742,8 @@ const P = class P {
642
742
  */
643
743
  a(this, "add", (...e) => {
644
744
  for (const t of e) {
645
- const s = t instanceof P ? t : new P(t);
646
- this.isSameAs(s) ? (this.isZero() && M(this, He, pt).call(this, s), i(this, O).add(s.coefficient)) : console.log("Add monom: " + this.display + " is not similar with ", s.display);
745
+ const s = t instanceof I ? t : new I(t);
746
+ this.isSameAs(s) ? (this.isZero() && q(this, Ye, gt).call(this, s), i(this, T).add(s.coefficient)) : console.log("Add monom: " + this.display + " is not similar with ", s.display);
647
747
  }
648
748
  return this;
649
749
  });
@@ -660,9 +760,9 @@ const P = class P {
660
760
  a(this, "derivative", (e) => {
661
761
  if (e === void 0 && (e = "x"), this.hasVariable(e)) {
662
762
  const t = i(this, v)[e].clone(), s = this.clone();
663
- return i(s, v)[e].subtract(1), i(s, O).multiply(new c(t.clone())), s;
763
+ return i(s, v)[e].subtract(1), i(s, T).multiply(new c(t.clone())), s;
664
764
  } else
665
- return new P().zero();
765
+ return new I().zero();
666
766
  });
667
767
  /**
668
768
  * Divide the current monoms by multiple monoms
@@ -670,10 +770,10 @@ const P = class P {
670
770
  */
671
771
  a(this, "divide", (...e) => {
672
772
  for (const t of e) {
673
- const s = t instanceof P ? t : new P(t);
674
- i(this, O).divide(s.coefficient);
675
- for (const r in s.literal)
676
- i(this, v)[r] = this.hasVariable(r) ? i(this, v)[r].subtract(s.literal[r]) : s.literal[r].clone().opposite(), i(this, v)[r].isZero() && this.removeVariable(r);
773
+ const s = t instanceof I ? t : new I(t);
774
+ i(this, T).divide(s.coefficient);
775
+ for (const n in s.literal)
776
+ i(this, v)[n] = this.hasVariable(n) ? i(this, v)[n].subtract(s.literal[n]) : s.literal[n].clone().opposite(), i(this, v)[n].isZero() && this.removeVariable(n);
677
777
  }
678
778
  return this;
679
779
  });
@@ -686,30 +786,30 @@ const P = class P {
686
786
  if (t === !0) {
687
787
  if (e instanceof c)
688
788
  return i(this, Re).call(this, e.value);
689
- if (e instanceof ft)
789
+ if (e instanceof pt)
690
790
  return new c().invalid();
691
791
  if (typeof e == "number")
692
792
  return i(this, Re).call(this, e);
693
793
  if (typeof e == "object") {
694
- const r = {};
695
- for (const n in e)
696
- r[n] = new c(e[n]).value;
697
- return i(this, Re).call(this, r);
794
+ const n = {};
795
+ for (const r in e)
796
+ n[r] = new c(e[r]).value;
797
+ return i(this, Re).call(this, n);
698
798
  }
699
799
  }
700
800
  const s = this.coefficient.clone();
701
801
  if (typeof e == "number" || e instanceof c) {
702
- const r = {};
703
- return r[this.variables[0]] = new c(e), this.evaluate(r);
802
+ const n = {};
803
+ return n[this.variables[0]] = new c(e), this.evaluate(n);
704
804
  }
705
- if (e instanceof ft)
805
+ if (e instanceof pt)
706
806
  return new c().invalid();
707
807
  if (typeof e == "object") {
708
808
  if (this.variables.length === 0)
709
809
  return this.coefficient;
710
- for (const r in i(this, v)) {
711
- const n = new c(e[r]);
712
- s.multiply(n.pow(i(this, v)[r]));
810
+ for (const n in i(this, v)) {
811
+ const r = new c(e[n]);
812
+ s.multiply(r.pow(i(this, v)[n]));
713
813
  }
714
814
  }
715
815
  return s;
@@ -721,7 +821,7 @@ const P = class P {
721
821
  */
722
822
  a(this, "hasVariable", (e) => Object.hasOwn(i(this, v), e ?? "x"));
723
823
  a(this, "inverse", () => {
724
- i(this, O).opposite();
824
+ i(this, T).opposite();
725
825
  for (const e in i(this, v))
726
826
  i(this, v)[e].opposite();
727
827
  return this;
@@ -738,7 +838,7 @@ const P = class P {
738
838
  * Determine if two monoms are equals
739
839
  * @param M
740
840
  */
741
- a(this, "isEqual", (e) => this.isSameAs(e) && i(this, O).isEqual(e.coefficient));
841
+ a(this, "isEqual", (e) => this.isSameAs(e) && i(this, T).isEqual(e.coefficient));
742
842
  a(this, "isLiteralSquare", () => {
743
843
  for (const e in this.literal)
744
844
  if (this.literal[e].isRational() || this.literal[e].isEven())
@@ -748,20 +848,20 @@ const P = class P {
748
848
  /**
749
849
  * Determine if the monom is one
750
850
  */
751
- a(this, "isOne", () => i(this, O).value === 1 && this.variables.length === 0);
851
+ a(this, "isOne", () => i(this, T).value === 1 && this.variables.length === 0);
752
852
  /**
753
853
  * Determine if two monoms are similar
754
854
  * @param M
755
855
  */
756
856
  a(this, "isSameAs", (e) => {
757
- const t = this.variables, s = e.variables, r = t.concat(s.filter((n) => !t.includes(n)));
857
+ const t = this.variables, s = e.variables, n = t.concat(s.filter((r) => !t.includes(r)));
758
858
  if (this.isZero() || e.isZero() || t.length === 0 && s.length === 0)
759
859
  return !0;
760
860
  if (t.length !== s.length)
761
861
  return !1;
762
862
  if (!this.isZero() && !e.isZero()) {
763
- for (const n of r)
764
- if (!this.hasVariable(n) || !e.hasVariable(n) || !i(this, v)[n].isEqual(e.literal[n]))
863
+ for (const r of n)
864
+ if (!this.hasVariable(r) || !e.hasVariable(r) || !i(this, v)[r].isEqual(e.literal[r]))
765
865
  return !1;
766
866
  }
767
867
  return !0;
@@ -770,35 +870,35 @@ const P = class P {
770
870
  /**
771
871
  * Determine if the monom is null
772
872
  */
773
- a(this, "isZero", () => i(this, O).value === 0);
873
+ a(this, "isZero", () => i(this, T).value === 0);
774
874
  /**
775
875
  * Multiple multiple monoms to the current monom
776
876
  * @param M (Monom[]) The monoms to multiply to.
777
877
  */
778
878
  a(this, "multiply", (...e) => {
779
879
  for (const t of e) {
780
- const s = t instanceof P ? t : new P(t);
781
- i(this, O).multiply(s.coefficient);
782
- for (const r in s.literal)
783
- this.hasVariable(r) ? i(this, v)[r].add(s.literal[r]) : i(this, v)[r] = s.literal[r].clone();
880
+ const s = t instanceof I ? t : new I(t);
881
+ i(this, T).multiply(s.coefficient);
882
+ for (const n in s.literal)
883
+ this.hasVariable(n) ? i(this, v)[n].add(s.literal[n]) : i(this, v)[n] = s.literal[n].clone();
784
884
  }
785
885
  return this;
786
886
  });
787
887
  /**
788
888
  * Create a one value monom
789
889
  */
790
- a(this, "one", () => (h(this, O, new c().one()), h(this, v, {}), this));
890
+ a(this, "one", () => (h(this, T, new c().one()), h(this, v, {}), this));
791
891
  /**
792
892
  * Get the opposite
793
893
  * Returns a monom.
794
894
  */
795
- a(this, "opposite", () => (i(this, O).opposite(), this));
895
+ a(this, "opposite", () => (i(this, T).opposite(), this));
796
896
  /**
797
897
  * Get the pow of a monom.
798
898
  * @param nb (number) : Mathematical pow
799
899
  */
800
900
  a(this, "pow", (e) => {
801
- i(this, O).pow(e);
901
+ i(this, T).pow(e);
802
902
  for (const t in i(this, v))
803
903
  i(this, v)[t].multiply(e);
804
904
  return this;
@@ -834,7 +934,7 @@ const P = class P {
834
934
  */
835
935
  a(this, "sqrt", () => {
836
936
  if (this.isSquare()) {
837
- i(this, O).sqrt();
937
+ i(this, T).sqrt();
838
938
  for (const e in i(this, v))
839
939
  i(this, v)[e].clone().divide(2);
840
940
  }
@@ -846,75 +946,75 @@ const P = class P {
846
946
  */
847
947
  a(this, "subtract", (...e) => {
848
948
  for (const t of e) {
849
- const s = t instanceof P ? t : new P(t);
850
- this.isSameAs(s) ? (this.isZero() && M(this, He, pt).call(this, s), i(this, O).add(s.clone().coefficient.opposite())) : console.log("Subtract: Is not similar: ", s.display);
949
+ const s = t instanceof I ? t : new I(t);
950
+ this.isSameAs(s) ? (this.isZero() && q(this, Ye, gt).call(this, s), i(this, T).add(s.clone().coefficient.opposite())) : console.log("Subtract: Is not similar: ", s.display);
851
951
  }
852
952
  return this;
853
953
  });
854
954
  /**
855
955
  * Create a zero value monom
856
956
  */
857
- a(this, "zero", () => (h(this, O, new c().zero()), h(this, v, {}), this));
957
+ a(this, "zero", () => (h(this, T, new c().zero()), h(this, v, {}), this));
858
958
  d(this, Re, (e) => {
859
959
  let t = this.coefficient.value;
860
960
  if (typeof e == "number") {
861
- const s = {}, r = this.variables[0];
862
- return s[r] = e, i(this, Re).call(this, s);
961
+ const s = {}, n = this.variables[0];
962
+ return s[n] = e, i(this, Re).call(this, s);
863
963
  }
864
964
  if (e instanceof c) {
865
965
  const s = {};
866
966
  return s[this.variables[0]] = new c(e).value, i(this, Re).call(this, s);
867
967
  }
868
- if (e instanceof ft)
968
+ if (e instanceof pt)
869
969
  return NaN;
870
970
  if (typeof e == "object") {
871
971
  if (this.variables.length === 0)
872
972
  return this.coefficient.value;
873
973
  for (const s in i(this, v)) {
874
- const r = e[s];
875
- r instanceof c ? t *= r.value ** i(this, v)[s].value : t *= r ** i(this, v)[s].value;
974
+ const n = e[s];
975
+ n instanceof c ? t *= n.value ** i(this, v)[s].value : t *= n ** i(this, v)[s].value;
876
976
  }
877
977
  }
878
978
  return t;
879
979
  });
880
- d(this, bt, (e) => {
881
- const s = new li().parse(e).rpn, r = [];
980
+ d(this, Et, (e) => {
981
+ const s = new Gt().parse(e).rpn, n = [];
882
982
  if (s.length === 0)
883
983
  return this.zero(), this;
884
984
  if (s.length === 1) {
885
- const n = s[0];
886
- return this.one(), n.tokenType === m.COEFFICIENT ? this.coefficient = new c(n.token) : n.tokenType === m.VARIABLE && this.setLetter(n.token, 1), this;
985
+ const r = s[0];
986
+ return this.one(), r.tokenType === p.COEFFICIENT ? this.coefficient = new c(r.token) : r.tokenType === p.VARIABLE && this.setLetter(r.token, 1), this;
887
987
  } else
888
- for (const n of s)
889
- i(this, xt).call(this, r, n);
890
- return this.one(), this.multiply(r[0]), this;
988
+ for (const r of s)
989
+ i(this, Nt).call(this, n, r);
990
+ return this.one(), this.multiply(n[0]), this;
891
991
  });
892
- d(this, xt, (e, t) => {
992
+ d(this, Nt, (e, t) => {
893
993
  var f;
894
- let s, r, n, l, u;
895
- if (t.tokenType === m.COEFFICIENT)
896
- e.push(new P(new c(t.token)));
897
- else if (t.tokenType === m.VARIABLE) {
898
- const p = new P().one();
899
- p.setLetter(t.token, 1), e.push(p.clone());
900
- } else if (t.tokenType === m.OPERATION)
994
+ let s, n, r, l, u;
995
+ if (t.tokenType === p.COEFFICIENT)
996
+ e.push(new I(new c(t.token)));
997
+ else if (t.tokenType === p.VARIABLE) {
998
+ const m = new I().one();
999
+ m.setLetter(t.token, 1), e.push(m.clone());
1000
+ } else if (t.tokenType === p.OPERATION)
901
1001
  switch (t.token) {
902
1002
  case "-":
903
- r = e.pop() ?? new P().zero(), s = e.pop() ?? new P().zero(), e.push(s.subtract(r));
1003
+ n = e.pop() ?? new I().zero(), s = e.pop() ?? new I().zero(), e.push(s.subtract(n));
904
1004
  break;
905
1005
  case "*":
906
- r = e.pop() ?? new P().one(), s = e.pop() ?? new P().one(), e.push(s.multiply(r));
1006
+ n = e.pop() ?? new I().one(), s = e.pop() ?? new I().one(), e.push(s.multiply(n));
907
1007
  break;
908
1008
  case "/":
909
- r = e.pop() ?? new P().one(), s = e.pop() ?? new P().one(), e.push(s.divide(r));
1009
+ n = e.pop() ?? new I().one(), s = e.pop() ?? new I().one(), e.push(s.divide(n));
910
1010
  break;
911
1011
  case "^": {
912
- u = ((f = e.pop()) == null ? void 0 : f.coefficient) ?? new c().one(), n = e.pop() ?? new P().one(), l = n.variables[0], l && n.setLetter(l, u), e.push(n);
1012
+ u = ((f = e.pop()) == null ? void 0 : f.coefficient) ?? new c().one(), r = e.pop() ?? new I().one(), l = r.variables[0], l && r.setLetter(l, u), e.push(r);
913
1013
  break;
914
1014
  }
915
1015
  }
916
1016
  });
917
- return h(this, O, new c().zero()), h(this, v, {}), e !== void 0 && this.parse(e), this;
1017
+ return h(this, T, new c().zero()), h(this, v, {}), e !== void 0 && this.parse(e), this;
918
1018
  }
919
1019
  // -----------------------------------------
920
1020
  /**
@@ -922,21 +1022,21 @@ const P = class P {
922
1022
  * @param inputStr
923
1023
  */
924
1024
  parse(e) {
925
- return h(this, O, new c()), h(this, v, {}), typeof e == "string" ? i(this, bt).call(this, e) : typeof e == "number" ? h(this, O, new c(e)) : e instanceof c ? h(this, O, e.clone()) : e instanceof P && (h(this, O, i(e, O).clone()), M(this, He, pt).call(this, e)), this;
1025
+ return h(this, T, new c()), h(this, v, {}), typeof e == "string" ? i(this, Et).call(this, e) : typeof e == "number" ? h(this, T, new c(e)) : e instanceof c ? h(this, T, e.clone()) : e instanceof I && (h(this, T, i(e, T).clone()), q(this, Ye, gt).call(this, e)), this;
926
1026
  }
927
1027
  /**
928
1028
  * Get the coefficient \\(k\\) of the Monom \\(k\\cdot x^{n}\\)
929
1029
  * @returns {Fraction}
930
1030
  */
931
1031
  get coefficient() {
932
- return i(this, O);
1032
+ return i(this, T);
933
1033
  }
934
1034
  /**
935
1035
  * Set the coefficient \\(k\\) value of the monom
936
1036
  * @param {Fraction | number | string} F
937
1037
  */
938
1038
  set coefficient(e) {
939
- h(this, O, new c(e));
1039
+ h(this, T, new c(e));
940
1040
  }
941
1041
  // Display getter
942
1042
  /**
@@ -947,7 +1047,7 @@ const P = class P {
947
1047
  const t = Object.keys(i(this, v)).sort();
948
1048
  for (const s of t)
949
1049
  i(this, v)[s].isNotZero() && (e += s, i(this, v)[s].isNotEqual(1) && (e += `^(${i(this, v)[s].display})`));
950
- return e === "" ? i(this, O).value != 0 ? i(this, O).display : "" : i(this, O).value === 1 ? e : i(this, O).value === -1 ? `-${e}` : i(this, O).value === 0 ? "0" : `${i(this, O).display}${e}`;
1050
+ return e === "" ? i(this, T).value != 0 ? i(this, T).display : "" : i(this, T).value === 1 ? e : i(this, T).value === -1 ? `-${e}` : i(this, T).value === 0 ? "0" : `${i(this, T).display}${e}`;
951
1051
  }
952
1052
  get dividers() {
953
1053
  if (!this.coefficient.isRelative())
@@ -958,30 +1058,30 @@ const P = class P {
958
1058
  return [this.clone()];
959
1059
  const e = G.dividers(Math.abs(this.coefficient.numerator));
960
1060
  let t = [];
961
- for (const r in this.literal)
962
- t = this._getLiteralDividers(t, r);
1061
+ for (const n in this.literal)
1062
+ t = this._getLiteralDividers(t, n);
963
1063
  const s = [];
964
1064
  if (t.length > 0 && e.length > 0)
965
- for (const r of e)
966
- for (const n of t) {
967
- const l = new P();
968
- l.coefficient = new c(r), l.literal = n, s.push(l);
1065
+ for (const n of e)
1066
+ for (const r of t) {
1067
+ const l = new I();
1068
+ l.coefficient = new c(n), l.literal = r, s.push(l);
969
1069
  }
970
1070
  else if (e.length === 0)
971
- for (const r of t) {
972
- const n = new P();
973
- n.coefficient = new c().one(), n.literal = r, s.push(n);
1071
+ for (const n of t) {
1072
+ const r = new I();
1073
+ r.coefficient = new c().one(), r.literal = n, s.push(r);
974
1074
  }
975
1075
  else
976
- for (const r of e) {
977
- const n = new P();
978
- n.coefficient = new c(r), s.push(n);
1076
+ for (const n of e) {
1077
+ const r = new I();
1078
+ r.coefficient = new c(n), s.push(r);
979
1079
  }
980
- return s.length === 0 ? [new P().one()] : s;
1080
+ return s.length === 0 ? [new I().one()] : s;
981
1081
  }
982
1082
  integrate(e, t, s) {
983
- const r = this.primitive(s);
984
- return r.evaluate(t).subtract(r.evaluate(e));
1083
+ const n = this.primitive(s);
1084
+ return n.evaluate(t).subtract(n.evaluate(e));
985
1085
  }
986
1086
  /**
987
1087
  * Get the literal part of \\(x^{n_1}y^{n_2}\\) as dictionary \\[\\begin{array}{ll}x&=n_1\\\\y&=n_2\\end{array}\\]
@@ -1026,7 +1126,7 @@ const P = class P {
1026
1126
  const t = Object.keys(i(this, v)).sort();
1027
1127
  for (const s of t)
1028
1128
  i(this, v)[s].isNotZero() && (e += (e === "" ? "" : "*") + s, i(this, v)[s].isNotEqual(1) && (e += `^(${i(this, v)[s].display})`));
1029
- return e === "" ? i(this, O).value != 0 ? i(this, O).display : "" : i(this, O).value === 1 ? e : i(this, O).value === -1 ? `-${e}` : i(this, O).value === 0 ? "0" : `${i(this, O).display}*${e}`;
1129
+ return e === "" ? i(this, T).value != 0 ? i(this, T).display : "" : i(this, T).value === 1 ? e : i(this, T).value === -1 ? `-${e}` : i(this, T).value === 0 ? "0" : `${i(this, T).display}*${e}`;
1030
1130
  }
1031
1131
  removeVariable(e) {
1032
1132
  delete i(this, v)[e];
@@ -1039,7 +1139,7 @@ const P = class P {
1039
1139
  const t = Object.keys(i(this, v)).sort();
1040
1140
  for (const s of t)
1041
1141
  i(this, v)[s].isNotZero() && (e += s, i(this, v)[s].isNotEqual(1) && (e += `^{ ${i(this, v)[s].tfrac.tex} }`));
1042
- return e === "" ? i(this, O).value != 0 ? i(this, O).frac.tex : "0" : i(this, O).value === 1 ? e : i(this, O).value === -1 ? `-${e}` : i(this, O).value === 0 ? "0" : `${i(this, O).frac.tex}${e}`;
1142
+ return e === "" ? i(this, T).value != 0 ? i(this, T).frac.tex : "0" : i(this, T).value === 1 ? e : i(this, T).value === -1 ? `-${e}` : i(this, T).value === 0 ? "0" : `${i(this, T).frac.tex}${e}`;
1043
1143
  }
1044
1144
  // Getter helpers.
1045
1145
  /**
@@ -1055,84 +1155,84 @@ const P = class P {
1055
1155
  }
1056
1156
  _getLiteralDividers(e, t) {
1057
1157
  const s = [];
1058
- for (let r = 0; r <= this.literal[t].value; r++)
1158
+ for (let n = 0; n <= this.literal[t].value; n++)
1059
1159
  if (e.length === 0) {
1060
- const n = {};
1061
- n[t] = new c(r), s.push(n);
1160
+ const r = {};
1161
+ r[t] = new c(n), s.push(r);
1062
1162
  } else
1063
- for (const n of e) {
1163
+ for (const r of e) {
1064
1164
  const l = {};
1065
- for (const u in n)
1066
- l[u] = n[u];
1067
- l[t] = new c(r), s.push(l);
1165
+ for (const u in r)
1166
+ l[u] = r[u];
1167
+ l[t] = new c(n), s.push(l);
1068
1168
  }
1069
1169
  return s;
1070
1170
  }
1071
1171
  // #endregion Private methods (5)
1072
1172
  };
1073
- O = new WeakMap(), v = new WeakMap(), He = new WeakSet(), pt = function(e) {
1173
+ T = new WeakMap(), v = new WeakMap(), Ye = new WeakSet(), gt = function(e) {
1074
1174
  for (const t in e.literal)
1075
1175
  i(this, v)[t] = e.literal[t].clone();
1076
- }, Re = new WeakMap(), bt = new WeakMap(), xt = new WeakMap(), a(P, "gcd", (...e) => {
1077
- for (const n of e)
1078
- if (n.containsRationalPower())
1079
- return new P().zero();
1080
- const t = new P(), s = G.gcd(...e.map((n) => n.coefficient.numerator)), r = G.lcm(...e.map((n) => n.coefficient.denominator));
1081
- t.coefficient = new c(s, r).reduce();
1082
- for (const n of e) {
1176
+ }, Re = new WeakMap(), Et = new WeakMap(), Nt = new WeakMap(), a(I, "gcd", (...e) => {
1177
+ for (const r of e)
1178
+ if (r.containsRationalPower())
1179
+ return new I().zero();
1180
+ const t = new I(), s = G.gcd(...e.map((r) => r.coefficient.numerator)), n = G.lcm(...e.map((r) => r.coefficient.denominator));
1181
+ t.coefficient = new c(s, n).reduce();
1182
+ for (const r of e) {
1083
1183
  for (const l in t.literal)
1084
- l in n.literal || t.literal[l].zero();
1085
- for (const l in n.literal)
1086
- !t.hasVariable(l) && n.literal[l].isStrictlyPositive() ? t.literal[l] = n.literal[l].clone() : t.literal[l] = new c(Math.min(n.literal[l].value, t.literal[l].value));
1184
+ l in r.literal || t.literal[l].zero();
1185
+ for (const l in r.literal)
1186
+ !t.hasVariable(l) && r.literal[l].isStrictlyPositive() ? t.literal[l] = r.literal[l].clone() : t.literal[l] = new c(Math.min(r.literal[l].value, t.literal[l].value));
1087
1187
  }
1088
1188
  return t;
1089
1189
  }), /**
1090
1190
  * Multiply two monoms and return a NEW monom.
1091
1191
  * @param monoms
1092
1192
  */
1093
- a(P, "xMultiply", (...e) => {
1094
- const t = new P().one();
1193
+ a(I, "xMultiply", (...e) => {
1194
+ const t = new I().one();
1095
1195
  for (const s of e)
1096
1196
  t.multiply(s);
1097
1197
  return t;
1098
1198
  });
1099
- let I = P;
1100
- var ue, De, S, ye, rt, ci, ui, fi, Wt, di;
1101
- const ti = class ti {
1199
+ let k = I;
1200
+ var ue, Ze, P, ye, rt, pi, mi, gi, Qt, yi;
1201
+ const hi = class hi {
1102
1202
  constructor(e, t, s = "x") {
1103
- d(this, S);
1203
+ d(this, P);
1104
1204
  d(this, ue);
1105
- d(this, De);
1106
- if (h(this, De, s), Object.hasOwn(e, "moveLeft")) {
1107
- const r = e;
1108
- h(this, ue, r.left.clone().subtract(r.right));
1205
+ d(this, Ze);
1206
+ if (h(this, Ze, s), Object.hasOwn(e, "moveLeft")) {
1207
+ const n = e;
1208
+ h(this, ue, n.left.clone().subtract(n.right));
1109
1209
  } else
1110
1210
  h(this, ue, e.clone().subtract(t ?? 0));
1111
1211
  }
1112
1212
  solve() {
1113
1213
  if (i(this, ue).degree().isOne())
1114
- return M(this, S, ci).call(this);
1214
+ return q(this, P, pi).call(this);
1115
1215
  if (i(this, ue).degree().value === 2)
1116
- return M(this, S, ui).call(this);
1117
- const e = M(this, S, di).call(this);
1216
+ return q(this, P, mi).call(this);
1217
+ const e = q(this, P, yi).call(this);
1118
1218
  if (e.length > 0)
1119
1219
  return e;
1120
1220
  if (i(this, ue).degree().value === 3)
1121
- return M(this, S, Wt).call(this);
1221
+ return q(this, P, Qt).call(this);
1122
1222
  throw new Error("The equation degree is too high.");
1123
1223
  }
1124
1224
  solveAsCardan() {
1125
1225
  if (i(this, ue).degree().value !== 3)
1126
1226
  throw new Error("The equation is not cubic.");
1127
- return M(this, S, Wt).call(this);
1227
+ return q(this, P, Qt).call(this);
1128
1228
  }
1129
1229
  };
1130
- ue = new WeakMap(), De = new WeakMap(), S = new WeakSet(), ye = function(e) {
1230
+ ue = new WeakMap(), Ze = new WeakMap(), P = new WeakSet(), ye = function(e) {
1131
1231
  if (e instanceof c && e.isApproximative())
1132
- return M(this, S, rt).call(this, e.value);
1232
+ return q(this, P, rt).call(this, e.value);
1133
1233
  const t = new c(e);
1134
1234
  return {
1135
- variable: i(this, De),
1235
+ variable: i(this, Ze),
1136
1236
  exact: t,
1137
1237
  value: t.value,
1138
1238
  tex: t.tex,
@@ -1140,81 +1240,81 @@ ue = new WeakMap(), De = new WeakMap(), S = new WeakSet(), ye = function(e) {
1140
1240
  };
1141
1241
  }, rt = function(e, t) {
1142
1242
  return {
1143
- variable: i(this, De),
1243
+ variable: i(this, Ze),
1144
1244
  exact: !1,
1145
1245
  value: +e.toFixed(10),
1146
1246
  tex: (t == null ? void 0 : t.tex) ?? "",
1147
1247
  display: (t == null ? void 0 : t.display) ?? ""
1148
1248
  };
1149
- }, ci = function() {
1249
+ }, pi = function() {
1150
1250
  const e = i(this, ue).monomByDegree(0).coefficient.clone().opposite().divide(i(this, ue).monomByDegree(1).coefficient);
1151
1251
  return [
1152
- M(this, S, ye).call(this, e)
1252
+ q(this, P, ye).call(this, e)
1153
1253
  ];
1154
- }, ui = function() {
1155
- const e = i(this, ue), t = e.monomByDegree(2).coefficient, s = e.monomByDegree(1).coefficient, r = e.monomByDegree(0).coefficient, n = s.clone().pow(2).subtract(t.clone().multiply(r).multiply(4));
1156
- if (n.isNegative())
1254
+ }, mi = function() {
1255
+ const e = i(this, ue), t = e.monomByDegree(2).coefficient, s = e.monomByDegree(1).coefficient, n = e.monomByDegree(0).coefficient, r = s.clone().pow(2).subtract(t.clone().multiply(n).multiply(4));
1256
+ if (r.isNegative())
1157
1257
  return [];
1158
- if (n.isSquare()) {
1159
- const l = n.sqrt(), u = s.clone().opposite().add(l).divide(t.clone().multiply(2)), f = s.clone().opposite().subtract(l).divide(t.clone().multiply(2));
1160
- return l.isZero() ? [M(this, S, ye).call(this, u)] : [
1161
- M(this, S, ye).call(this, u),
1162
- M(this, S, ye).call(this, f)
1163
- ].sort((p, g) => p.value - g.value);
1164
- }
1165
- return M(this, S, fi).call(this, t, s, n);
1166
- }, fi = function(e, t, s) {
1167
- const r = G.dividers(s.value).filter((pe) => Math.sqrt(pe) % 1 === 0).map((pe) => Math.sqrt(pe)).pop() ?? 1, n = G.gcd(2 * e.value, t.value, r) * (e.isNegative() ? -1 : 1), l = t.clone().divide(n).opposite(), u = e.clone().divide(n).multiply(2), f = s.clone().divide(r ** 2), p = Math.abs(r / n), g = r === 1 ? "-" : `-${p} `, E = r === 1 ? "+" : `+${p} `;
1168
- function L(pe, ce, et, jt) {
1169
- return `\\frac{ ${ce} ${et}\\sqrt{ ${jt} } }{ ${pe} }`;
1170
- }
1171
- function te(pe, ce, et, jt) {
1172
- return `(${ce}${et}sqrt(${jt}))/${pe}`;
1258
+ if (r.isSquare()) {
1259
+ const l = r.sqrt(), u = s.clone().opposite().add(l).divide(t.clone().multiply(2)), f = s.clone().opposite().subtract(l).divide(t.clone().multiply(2));
1260
+ return l.isZero() ? [q(this, P, ye).call(this, u)] : [
1261
+ q(this, P, ye).call(this, u),
1262
+ q(this, P, ye).call(this, f)
1263
+ ].sort((m, g) => m.value - g.value);
1264
+ }
1265
+ return q(this, P, gi).call(this, t, s, r);
1266
+ }, gi = function(e, t, s) {
1267
+ const n = G.dividers(s.value).filter((pe) => Math.sqrt(pe) % 1 === 0).map((pe) => Math.sqrt(pe)).pop() ?? 1, r = G.gcd(2 * e.value, t.value, n) * (e.isNegative() ? -1 : 1), l = t.clone().divide(r).opposite(), u = e.clone().divide(r).multiply(2), f = s.clone().divide(n ** 2), m = Math.abs(n / r), g = n === 1 ? "-" : `-${m} `, E = n === 1 ? "+" : `+${m} `;
1268
+ function L(pe, ce, it, Wt) {
1269
+ return `\\frac{ ${ce} ${it}\\sqrt{ ${Wt} } }{ ${pe} }`;
1270
+ }
1271
+ function te(pe, ce, it, Wt) {
1272
+ return `(${ce}${it}sqrt(${Wt}))/${pe}`;
1173
1273
  }
1174
1274
  const ae = s.value ** 0.5, le = (-t.value - ae) / (2 * e.value), ge = (-t.value + ae) / (2 * e.value);
1175
1275
  return [
1176
- M(this, S, rt).call(this, le, {
1276
+ q(this, P, rt).call(this, le, {
1177
1277
  tex: L(u.tex, l.tex, g.toString(), f.tex),
1178
1278
  display: te(u.display, l.display, g.toString(), f.display)
1179
1279
  }),
1180
- M(this, S, rt).call(this, ge, {
1280
+ q(this, P, rt).call(this, ge, {
1181
1281
  tex: L(u.tex, l.tex, E.toString(), f.tex),
1182
1282
  display: te(u.display, l.display, E.toString(), f.display)
1183
1283
  })
1184
1284
  ].sort((pe, ce) => pe.value - ce.value);
1185
- }, Wt = function() {
1186
- const e = i(this, ue), t = e.monomByDegree(3).coefficient, s = e.monomByDegree(2).coefficient, r = e.monomByDegree(1).coefficient, n = e.monomByDegree(0).coefficient, l = s.clone().divide(t), u = r.clone().divide(t), f = n.clone().divide(t), p = u.clone().subtract(l.clone().pow(2).divide(3)), g = f.clone().subtract(l.clone().multiply(u).divide(3)).add(l.clone().pow(3).multiply(2).divide(27)), E = g.clone().opposite(), L = p.clone().opposite().pow(3).divide(27), te = E.clone().pow(2).subtract(L.clone().multiply(4)).opposite();
1285
+ }, Qt = function() {
1286
+ const e = i(this, ue), t = e.monomByDegree(3).coefficient, s = e.monomByDegree(2).coefficient, n = e.monomByDegree(1).coefficient, r = e.monomByDegree(0).coefficient, l = s.clone().divide(t), u = n.clone().divide(t), f = r.clone().divide(t), m = u.clone().subtract(l.clone().pow(2).divide(3)), g = f.clone().subtract(l.clone().multiply(u).divide(3)).add(l.clone().pow(3).multiply(2).divide(27)), E = g.clone().opposite(), L = m.clone().opposite().pow(3).divide(27), te = E.clone().pow(2).subtract(L.clone().multiply(4)).opposite();
1187
1287
  if (te.isNegative()) {
1188
1288
  const ae = g.clone().opposite().add(te.clone().opposite().sqrt()).divide(2).root(3), le = g.clone().opposite().subtract(te.clone().opposite().sqrt()).divide(2).root(3), ge = ae.clone().add(le).subtract(l.clone().divide(3));
1189
- return [M(this, S, ye).call(this, ge)];
1289
+ return [q(this, P, ye).call(this, ge)];
1190
1290
  }
1191
1291
  if (te.isZero()) {
1192
1292
  const ae = g.clone().opposite().divide(2).root(3), le = ae.clone().opposite().subtract(l.clone().divide(3)), ge = ae.clone().multiply(2).subtract(l.clone().divide(3));
1193
- return le.isEqual(ge) ? [M(this, S, ye).call(this, le)] : [
1194
- M(this, S, ye).call(this, ge),
1195
- M(this, S, ye).call(this, le)
1293
+ return le.isEqual(ge) ? [q(this, P, ye).call(this, le)] : [
1294
+ q(this, P, ye).call(this, ge),
1295
+ q(this, P, ye).call(this, le)
1196
1296
  ].sort((pe, ce) => pe.value - ce.value);
1197
1297
  }
1198
1298
  if (te.isPositive()) {
1199
- const ae = [], le = p.value, ge = g.value, pe = l.value;
1299
+ const ae = [], le = m.value, ge = g.value, pe = l.value;
1200
1300
  for (let ce = 0; ce < 3; ce++)
1201
1301
  ae.push(2 * Math.sqrt(-le / 3) * Math.cos(Math.acos(3 * ge / (2 * le) * Math.sqrt(-3 / le)) / 3 + 2 * Math.PI * ce / 3) - pe / 3);
1202
- return ae.map((ce) => M(this, S, rt).call(this, ce)).sort((ce, et) => ce.value - et.value);
1302
+ return ae.map((ce) => q(this, P, rt).call(this, ce)).sort((ce, it) => ce.value - it.value);
1203
1303
  }
1204
1304
  return [];
1205
- }, di = function() {
1305
+ }, yi = function() {
1206
1306
  let e = i(this, ue).clone(), t = [];
1207
1307
  const s = e.lcmDenominator();
1208
1308
  s !== 1 && e.multiply(s);
1209
- const r = e.monomByDegree().coefficient;
1210
- let n = e.monomByDegree(0).coefficient;
1211
- for (; n.isZero(); )
1212
- t.length === 0 && t.push(M(this, S, ye).call(this, 0)), e = e.divide("x"), n = e.monomByDegree(0).coefficient;
1213
- const l = G.dividers(r.value), u = G.dividers(n.value);
1309
+ const n = e.monomByDegree().coefficient;
1310
+ let r = e.monomByDegree(0).coefficient;
1311
+ for (; r.isZero(); )
1312
+ t.length === 0 && t.push(q(this, P, ye).call(this, 0)), e = e.divide("x"), r = e.monomByDegree(0).coefficient;
1313
+ const l = G.dividers(n.value), u = G.dividers(r.value);
1214
1314
  for (const g of l)
1215
1315
  for (const E of u) {
1216
1316
  const L = new c(E, g);
1217
- e.evaluate(L).isZero() && !t.find((te) => te.value === L.value) && t.push(M(this, S, ye).call(this, L)), L.opposite(), e.evaluate(L).isZero() && !t.find((te) => te.value === L.value) && t.push(M(this, S, ye).call(this, L));
1317
+ e.evaluate(L).isZero() && !t.find((te) => te.value === L.value) && t.push(q(this, P, ye).call(this, L)), L.opposite(), e.evaluate(L).isZero() && !t.find((te) => te.value === L.value) && t.push(q(this, P, ye).call(this, L));
1218
1318
  }
1219
1319
  for (const g of t) {
1220
1320
  if (g.exact !== !1 && g.exact.isZero())
@@ -1229,16 +1329,16 @@ ue = new WeakMap(), De = new WeakMap(), S = new WeakSet(), ye = function(e) {
1229
1329
  return [];
1230
1330
  const f = e.clone().parse("0");
1231
1331
  console.log(e.display), console.log(f.display);
1232
- const p = new ti(e, e.clone().parse("0"), i(this, De));
1233
- return t = t.concat(p.solve()), t.sort((g, E) => g.value - E.value);
1332
+ const m = new hi(e, e.clone().parse("0"), i(this, Ze));
1333
+ return t = t.concat(m.solve()), t.sort((g, E) => g.value - E.value);
1234
1334
  };
1235
- let gt = ti;
1236
- var Ze, y, Xe, ht, Et, Nt, Ot, qt, at, Tt, At, Mt, It, pi, Ct, Ye, $t;
1335
+ let wt = hi;
1336
+ var Fe, y, Qe, at, Tt, At, Ot, qt, lt, Mt, kt, Ct, $t, wi, It, Ke, Pt;
1237
1337
  const C = class C {
1238
1338
  constructor(e, ...t) {
1239
- d(this, It);
1339
+ d(this, $t);
1240
1340
  // #region Class fields (8)
1241
- d(this, Ze);
1341
+ d(this, Fe);
1242
1342
  d(this, y);
1243
1343
  // #endregion Constructors (7)
1244
1344
  // #region Properties and methods (49)
@@ -1248,13 +1348,13 @@ const C = class C {
1248
1348
  * @param values
1249
1349
  */
1250
1350
  a(this, "parse", (e, ...t) => {
1251
- if (h(this, y, []), h(this, Ze, []), typeof e == "string")
1252
- return M(this, It, pi).call(this, e, ...t);
1253
- if ((typeof e == "number" || e instanceof c || e instanceof I) && t.length === 0)
1254
- i(this, y).push(new I(e));
1255
- else if (e instanceof I && t.length > 0)
1256
- i(this, y).push(new I(e)), t.forEach((s) => {
1257
- i(this, y).push(new I(s));
1351
+ if (h(this, y, []), h(this, Fe, []), typeof e == "string")
1352
+ return q(this, $t, wi).call(this, e, ...t);
1353
+ if ((typeof e == "number" || e instanceof c || e instanceof k) && t.length === 0)
1354
+ i(this, y).push(new k(e));
1355
+ else if (e instanceof k && t.length > 0)
1356
+ i(this, y).push(new k(e)), t.forEach((s) => {
1357
+ i(this, y).push(new k(s));
1258
1358
  });
1259
1359
  else if (e instanceof C)
1260
1360
  for (const s of e.monoms)
@@ -1272,16 +1372,16 @@ const C = class C {
1272
1372
  });
1273
1373
  a(this, "add", (...e) => {
1274
1374
  for (const t of e)
1275
- t instanceof C ? h(this, y, i(this, y).concat(t.monoms)) : t instanceof I ? i(this, y).push(t.clone()) : typeof t == "number" && Number.isSafeInteger(t) ? i(this, y).push(new I(t.toString())) : i(this, y).push(new I(t));
1375
+ t instanceof C ? h(this, y, i(this, y).concat(t.monoms)) : t instanceof k ? i(this, y).push(t.clone()) : typeof t == "number" && Number.isSafeInteger(t) ? i(this, y).push(new k(t.toString())) : i(this, y).push(new k(t));
1276
1376
  return this.reduce();
1277
1377
  });
1278
1378
  a(this, "commonMonom", () => {
1279
- const e = new I().one(), t = this.gcdNumerator(), s = this.gcdDenominator(), r = this.degree();
1379
+ const e = new k().one(), t = this.gcdNumerator(), s = this.gcdDenominator(), n = this.degree();
1280
1380
  e.coefficient = new c(t, s);
1281
- for (const n of this.variables) {
1282
- e.setLetter(n, r);
1381
+ for (const r of this.variables) {
1382
+ e.setLetter(r, n);
1283
1383
  for (const l of i(this, y))
1284
- if (e.setLetter(n, c.min(l.degree(n), e.degree(n))), e.degree(n).isZero())
1384
+ if (e.setLetter(r, c.min(l.degree(r), e.degree(r))), e.degree(r).isZero())
1285
1385
  break;
1286
1386
  }
1287
1387
  return e;
@@ -1300,14 +1400,14 @@ const C = class C {
1300
1400
  });
1301
1401
  a(this, "divide", (e) => {
1302
1402
  if (e instanceof c)
1303
- return i(this, ht).call(this, e);
1403
+ return i(this, at).call(this, e);
1304
1404
  if (typeof e == "number" && Number.isSafeInteger(e))
1305
- return i(this, Et).call(this, e);
1306
- if (e instanceof I)
1405
+ return i(this, Tt).call(this, e);
1406
+ if (e instanceof k)
1307
1407
  return this.divide(new C(e));
1308
1408
  if (e instanceof C) {
1309
1409
  if (e.monoms.length === 1 && e.variables.length === 0)
1310
- return i(this, ht).call(this, e.monoms[0].coefficient);
1410
+ return i(this, at).call(this, e.monoms[0].coefficient);
1311
1411
  {
1312
1412
  const { quotient: t, reminder: s } = this.euclidean(e);
1313
1413
  if (s.isZero())
@@ -1324,24 +1424,24 @@ const C = class C {
1324
1424
  * returns {quotient: Polynom, reminder: Polynom}
1325
1425
  */
1326
1426
  a(this, "euclidean", (e) => {
1327
- const t = e.variables[0], s = new C().zero(), r = this.clone().reorder(t);
1427
+ const t = e.variables[0], s = new C().zero(), n = this.clone().reorder(t);
1328
1428
  if (e.variables.length === 0)
1329
1429
  return {
1330
1430
  quotient: this.clone().divide(e).reduce(),
1331
1431
  reminder: new C().zero()
1332
1432
  };
1333
- const n = e.monomByDegree(void 0, t), l = e.degree(t);
1433
+ const r = e.monomByDegree(void 0, t), l = e.degree(t);
1334
1434
  let u, f = this.degree(t).value * 2;
1335
- for (; r.degree(t).isGeq(l) && f > 0 && (f--, u = r.monomByDegree(void 0, t).clone().divide(n), !(!u.isZero() && (s.add(u), r.subtract(e.clone().multiply(u)).reduce(), u.degree(t).isZero()))); )
1435
+ for (; n.degree(t).isGeq(l) && f > 0 && (f--, u = n.monomByDegree(void 0, t).clone().divide(r), !(!u.isZero() && (s.add(u), n.subtract(e.clone().multiply(u)).reduce(), u.degree(t).isZero()))); )
1336
1436
  ;
1337
- return s.reduce(), r.reduce(), { quotient: s, reminder: r };
1437
+ return s.reduce(), n.reduce(), { quotient: s, reminder: n };
1338
1438
  });
1339
1439
  a(this, "evaluate", (e, t) => {
1340
1440
  if (t)
1341
- return i(this, Nt).call(this, e);
1441
+ return i(this, At).call(this, e);
1342
1442
  const s = new c().zero();
1343
- return i(this, y).forEach((r) => {
1344
- s.add(r.evaluate(e, t));
1443
+ return i(this, y).forEach((n) => {
1444
+ s.add(n.evaluate(e, t));
1345
1445
  }), s;
1346
1446
  });
1347
1447
  // -------------------------------------
@@ -1351,14 +1451,14 @@ const C = class C {
1351
1451
  */
1352
1452
  a(this, "factorize", (e) => {
1353
1453
  let t = [], s = this.clone().reorder();
1354
- const r = s.commonMonom();
1355
- if (s.monomByDegree().coefficient.isStrictlyNegative() && r.coefficient.isStrictlyPositive() && !r.isOne() && r.opposite(), !r.isOne()) {
1356
- const u = new C(r);
1454
+ const n = s.commonMonom();
1455
+ if (s.monomByDegree().coefficient.isStrictlyNegative() && n.coefficient.isStrictlyPositive() && !n.isOne() && n.opposite(), !n.isOne()) {
1456
+ const u = new C(n);
1357
1457
  t = [u.clone()], s = s.euclidean(u).quotient;
1358
1458
  }
1359
- let n = s.degree().clone().multiply(2).value, l = 1;
1360
- for (; n >= 0; )
1361
- if (n--, s.monoms.length < 2) {
1459
+ let r = s.degree().clone().multiply(2).value, l = 1;
1460
+ for (; r >= 0; )
1461
+ if (r--, s.monoms.length < 2) {
1362
1462
  s.isOne() || (t.push(s.clone()), s.one());
1363
1463
  break;
1364
1464
  } else if (s.degree(e).isOne()) {
@@ -1371,15 +1471,15 @@ const C = class C {
1371
1471
  if (!s.isDividableBy(f))
1372
1472
  u.shift();
1373
1473
  else {
1374
- const p = s.euclidean(f);
1375
- t.push(f), s = p.quotient.clone(), u = u.filter((g) => {
1474
+ const m = s.euclidean(f);
1475
+ t.push(f), s = m.quotient.clone(), u = u.filter((g) => {
1376
1476
  const E = s.monoms[0], L = s.monoms[s.monoms.length - 1], te = g.monoms[0], ae = g.monoms[g.monoms.length - 1];
1377
1477
  return L.isDivisible(ae) ? E.isDivisible(te) : !1;
1378
1478
  });
1379
1479
  }
1380
1480
  }
1381
1481
  }
1382
- return s.isOne() || t.push(s.clone()), h(this, Ze, t), i(this, Ze);
1482
+ return s.isOne() || t.push(s.clone()), h(this, Fe, t), i(this, Fe);
1383
1483
  });
1384
1484
  a(this, "gcdDenominator", () => G.gcd(...this.getDenominators()));
1385
1485
  a(this, "gcdNumerator", () => G.gcd(...this.getNumerators()));
@@ -1396,10 +1496,10 @@ const C = class C {
1396
1496
  e.push(t.coefficient.numerator);
1397
1497
  return e;
1398
1498
  });
1399
- a(this, "getZeroes", () => new gt(this.clone()).solve());
1499
+ a(this, "getZeroes", () => new wt(this.clone()).solve());
1400
1500
  a(this, "integrate", (e, t, s = "x") => {
1401
- const r = this.primitive(s), n = {}, l = {};
1402
- return n[s] = new c(e), l[s] = new c(t), r.evaluate(l).subtract(r.evaluate(n));
1501
+ const n = this.primitive(s), r = {}, l = {};
1502
+ return r[s] = new c(e), l[s] = new c(t), n.evaluate(l).subtract(n.evaluate(r));
1403
1503
  });
1404
1504
  a(this, "isDeveloped", (e) => {
1405
1505
  let t;
@@ -1422,8 +1522,8 @@ const C = class C {
1422
1522
  return t.isZero();
1423
1523
  }
1424
1524
  });
1425
- a(this, "isEqual", (e) => i(this, Xe).call(this, e, "="));
1426
- a(this, "isOppositeAt", (e) => i(this, Xe).call(this, e.clone().opposite(), "="));
1525
+ a(this, "isEqual", (e) => i(this, Qe).call(this, e, "="));
1526
+ a(this, "isOppositeAt", (e) => i(this, Qe).call(this, e.clone().opposite(), "="));
1427
1527
  a(this, "isReduced", (e) => {
1428
1528
  if (!this.isDeveloped(e))
1429
1529
  return !1;
@@ -1435,7 +1535,7 @@ const C = class C {
1435
1535
  return !1;
1436
1536
  return !1;
1437
1537
  });
1438
- a(this, "isSameAs", (e) => i(this, Xe).call(this, e, "same"));
1538
+ a(this, "isSameAs", (e) => i(this, Qe).call(this, e, "same"));
1439
1539
  a(this, "lcmDenominator", () => G.lcm(...this.getDenominators()));
1440
1540
  a(this, "lcmNumerator", () => G.lcm(...this.getNumerators()));
1441
1541
  a(this, "letters", () => {
@@ -1445,21 +1545,21 @@ const C = class C {
1445
1545
  return [...e];
1446
1546
  });
1447
1547
  a(this, "limitToInfinity", (e) => {
1448
- const t = this.monomByDegree(void 0, e), s = t.coefficient.sign(), r = t.degree(e);
1449
- return r.isStrictlyPositive() ? s === 1 ? new c().infinite() : new c().infinite().opposite() : r.isZero() ? t.coefficient : new c().zero();
1548
+ const t = this.monomByDegree(void 0, e), s = t.coefficient.sign(), n = t.degree(e);
1549
+ return n.isStrictlyPositive() ? s === 1 ? new c().infinite() : new c().infinite().opposite() : n.isZero() ? t.coefficient : new c().zero();
1450
1550
  });
1451
1551
  a(this, "limitToNegativeInfinity", (e) => {
1452
- const t = this.monomByDegree(void 0, e), s = t.coefficient.sign(), r = t.degree(e);
1453
- return r.isStrictlyPositive() ? s === -1 ? new c().infinite() : new c().infinite().opposite() : r.isZero() ? t.coefficient : new c().zero();
1552
+ const t = this.monomByDegree(void 0, e), s = t.coefficient.sign(), n = t.degree(e);
1553
+ return n.isStrictlyPositive() ? s === -1 ? new c().infinite() : new c().infinite().opposite() : n.isZero() ? t.coefficient : new c().zero();
1454
1554
  });
1455
1555
  a(this, "monomByDegree", (e, t) => {
1456
1556
  if (e === void 0)
1457
1557
  return this.monomByDegree(this.degree(t), t);
1458
1558
  const s = this.clone().reduce();
1459
- for (const r of i(s, y))
1460
- if (r.degree(t).isEqual(e))
1461
- return r.clone();
1462
- return new I().zero();
1559
+ for (const n of i(s, y))
1560
+ if (n.degree(t).isEqual(e))
1561
+ return n.clone();
1562
+ return new k().zero();
1463
1563
  });
1464
1564
  // Used in LinearSystem.tex
1465
1565
  a(this, "monomByLetter", (e) => {
@@ -1467,18 +1567,18 @@ const C = class C {
1467
1567
  for (const s of i(t, y))
1468
1568
  if (s.hasVariable(e))
1469
1569
  return s.clone();
1470
- return new I().zero();
1570
+ return new k().zero();
1471
1571
  });
1472
1572
  a(this, "monomsByDegree", (e, t) => {
1473
1573
  if (e === void 0)
1474
1574
  return this.monomsByDegree(this.degree(t));
1475
- const s = [], r = this.clone().reduce();
1476
- for (const n of i(r, y))
1477
- n.degree(t) === e && s.push(n.clone());
1575
+ const s = [], n = this.clone().reduce();
1576
+ for (const r of i(n, y))
1577
+ r.degree(t) === e && s.push(r.clone());
1478
1578
  return s;
1479
1579
  });
1480
- a(this, "multiply", (e) => e instanceof C ? i(this, Mt).call(this, e) : e instanceof c ? i(this, at).call(this, e) : e instanceof I ? i(this, At).call(this, e) : Number.isSafeInteger(e) && typeof e == "number" ? i(this, Tt).call(this, e) : this);
1481
- a(this, "one", () => (h(this, y, []), i(this, y).push(new I().one()), this));
1580
+ a(this, "multiply", (e) => e instanceof C ? i(this, Ct).call(this, e) : e instanceof c ? i(this, lt).call(this, e) : e instanceof k ? i(this, kt).call(this, e) : Number.isSafeInteger(e) && typeof e == "number" ? i(this, Mt).call(this, e) : this);
1581
+ a(this, "one", () => (h(this, y, []), i(this, y).push(new k().one()), this));
1482
1582
  // ------------------------------------------
1483
1583
  a(this, "opposite", () => (h(this, y, i(this, y).map((e) => e.opposite())), this));
1484
1584
  a(this, "pow", (e) => {
@@ -1503,7 +1603,7 @@ const C = class C {
1503
1603
  let e = 0;
1504
1604
  for (; e < i(this, y).length; ) {
1505
1605
  for (let t = e + 1; t < i(this, y).length; t++)
1506
- i(this, y)[e].isSameAs(i(this, y)[t]) && (i(this, y)[e].add(i(this, y)[t]), i(this, y).splice(t, 1), i(this, y)[e].isZero() && (i(this, y)[e] = new I().zero()), t--);
1606
+ i(this, y)[e].isSameAs(i(this, y)[t]) && (i(this, y)[e].add(i(this, y)[t]), i(this, y).splice(t, 1), i(this, y)[e].isZero() && (i(this, y)[e] = new k().zero()), t--);
1507
1607
  e++;
1508
1608
  }
1509
1609
  h(this, y, i(this, y).filter((t) => !t.coefficient.isZero()));
@@ -1513,16 +1613,16 @@ const C = class C {
1513
1613
  });
1514
1614
  a(this, "reorder", (e = "x", t) => {
1515
1615
  t === void 0 && (t = !1);
1516
- const s = this.variables.filter((r) => r !== e);
1517
- return i(this, y).sort(function(r, n) {
1518
- const l = r.degree(e).value, u = n.degree(e).value;
1616
+ const s = this.variables.filter((n) => n !== e);
1617
+ return i(this, y).sort(function(n, r) {
1618
+ const l = n.degree(e).value, u = r.degree(e).value;
1519
1619
  if (l !== u)
1520
1620
  return t ? l - u : u - l;
1521
1621
  if (s.length > 0)
1522
1622
  for (const f of s) {
1523
- const p = r.degree(f).value, g = n.degree(f).value;
1524
- if (p !== g)
1525
- return t ? p - g : g - p;
1623
+ const m = n.degree(f).value, g = r.degree(f).value;
1624
+ if (m !== g)
1625
+ return t ? m - g : g - m;
1526
1626
  }
1527
1627
  return 0;
1528
1628
  }), this;
@@ -1534,47 +1634,47 @@ const C = class C {
1534
1634
  */
1535
1635
  a(this, "replaceBy", (e, t) => {
1536
1636
  let s;
1537
- const r = new C().zero();
1538
- for (const n of this.monoms)
1539
- !n.hasVariable(e) || n.literal[e].isZero() ? r.add(n.clone()) : (s = n.literal[e].clone(), n.removeVariable(e), r.add(t.clone().pow(Math.abs(s.numerator)).multiply(n)));
1540
- return h(this, y, r.reduce().monoms), this;
1637
+ const n = new C().zero();
1638
+ for (const r of this.monoms)
1639
+ !r.hasVariable(e) || r.literal[e].isZero() ? n.add(r.clone()) : (s = r.literal[e].clone(), r.removeVariable(e), n.add(t.clone().pow(Math.abs(s.numerator)).multiply(r)));
1640
+ return h(this, y, n.reduce().monoms), this;
1541
1641
  });
1542
1642
  a(this, "subtract", (...e) => {
1543
1643
  for (const t of e)
1544
- t instanceof C ? this.add(t.clone().opposite()) : t instanceof I ? i(this, y).push(t.clone().opposite()) : i(this, y).push(new I(t).opposite());
1644
+ t instanceof C ? this.add(t.clone().opposite()) : t instanceof k ? i(this, y).push(t.clone().opposite()) : i(this, y).push(new k(t).opposite());
1545
1645
  return this.reduce();
1546
1646
  });
1547
1647
  /**
1548
1648
  * Set the polynom to zero.
1549
1649
  * @returns {this}
1550
1650
  */
1551
- a(this, "zero", () => (h(this, y, []), i(this, y).push(new I().zero()), this));
1651
+ a(this, "zero", () => (h(this, y, []), i(this, y).push(new k().zero()), this));
1552
1652
  // #endregion Getters And Setters (22)
1553
1653
  // #region Private methods (15)
1554
- d(this, Xe, (e, t) => {
1654
+ d(this, Qe, (e, t) => {
1555
1655
  t === void 0 && (t = "=");
1556
- const s = this.clone().reduce().reorder(), r = e.clone().reduce().reorder();
1656
+ const s = this.clone().reduce().reorder(), n = e.clone().reduce().reorder();
1557
1657
  switch (t) {
1558
1658
  case "=":
1559
- return s.length !== r.length || !s.degree().isEqual(r.degree()) ? !1 : s.monoms.every((n, l) => n.isEqual(r.monoms[l]));
1659
+ return s.length !== n.length || !s.degree().isEqual(n.degree()) ? !1 : s.monoms.every((r, l) => r.isEqual(n.monoms[l]));
1560
1660
  case "same":
1561
- return s.length !== r.length || !s.degree().isEqual(r.degree()) ? !1 : s.monoms.every((n, l) => n.isSameAs(r.monoms[l]));
1661
+ return s.length !== n.length || !s.degree().isEqual(n.degree()) ? !1 : s.monoms.every((r, l) => r.isSameAs(n.monoms[l]));
1562
1662
  default:
1563
1663
  return !1;
1564
1664
  }
1565
1665
  });
1566
- d(this, ht, (e) => {
1666
+ d(this, at, (e) => {
1567
1667
  for (const t of i(this, y))
1568
1668
  t.coefficient.divide(e);
1569
1669
  return this;
1570
1670
  });
1571
- d(this, Et, (e) => {
1671
+ d(this, Tt, (e) => {
1572
1672
  const t = new c(e);
1573
1673
  for (const s of i(this, y))
1574
1674
  s.coefficient.divide(t);
1575
1675
  return this;
1576
1676
  });
1577
- d(this, Nt, (e) => {
1677
+ d(this, At, (e) => {
1578
1678
  let t = 0;
1579
1679
  return i(this, y).forEach((s) => {
1580
1680
  t += s.evaluate(e, !0);
@@ -1582,125 +1682,126 @@ const C = class C {
1582
1682
  });
1583
1683
  d(this, Ot, (e) => {
1584
1684
  var E;
1585
- let t, s, r, n, l, u, f, p, g;
1685
+ let t, s, n, r, l, u, f, m, g;
1586
1686
  if (this.numberOfVars === 1)
1587
- return r = this.monomByDegree(2, e).coefficient, n = this.monomByDegree(1, e).coefficient, l = this.monomByDegree(0, e).coefficient, u = n.clone().pow(2).subtract(r.clone().multiply(l).multiply(4)), u.isZero() ? (f = n.clone().opposite().divide(r.clone().multiply(2)), t = new C(e).subtract(f.display).multiply(f.denominator), s = new C(e).subtract(f.display).multiply(f.denominator), g = r.divide(f.denominator).divide(f.denominator), g.isOne() ? [t, s] : [new C(g.display), t, s]) : u.isPositive() && u.isSquare() ? (f = n.clone().opposite().add(u.clone().sqrt()).divide(r.clone().multiply(2)), p = n.clone().opposite().subtract(u.clone().sqrt()).divide(r.clone().multiply(2)), g = r.divide(f.denominator).divide(p.denominator), g.isOne() ? [
1687
+ return n = this.monomByDegree(2, e).coefficient, r = this.monomByDegree(1, e).coefficient, l = this.monomByDegree(0, e).coefficient, u = r.clone().pow(2).subtract(n.clone().multiply(l).multiply(4)), u.isZero() ? (f = r.clone().opposite().divide(n.clone().multiply(2)), t = new C(e).subtract(f.display).multiply(f.denominator), s = new C(e).subtract(f.display).multiply(f.denominator), g = n.divide(f.denominator).divide(f.denominator), g.isOne() ? [t, s] : [new C(g.display), t, s]) : u.isPositive() && u.isSquare() ? (f = r.clone().opposite().add(u.clone().sqrt()).divide(n.clone().multiply(2)), m = r.clone().opposite().subtract(u.clone().sqrt()).divide(n.clone().multiply(2)), g = n.divide(f.denominator).divide(m.denominator), g.isOne() ? [
1588
1688
  new C(e).subtract(f.display).multiply(f.denominator),
1589
- new C(e).subtract(p.display).multiply(p.denominator)
1689
+ new C(e).subtract(m.display).multiply(m.denominator)
1590
1690
  ] : [
1591
1691
  new C(g.display),
1592
1692
  new C(e).subtract(f.display).multiply(f.denominator),
1593
- new C(e).subtract(p.display).multiply(p.denominator)
1693
+ new C(e).subtract(m.display).multiply(m.denominator)
1594
1694
  ]) : [this.clone()];
1595
- if (r = this.monomByDegree(2, e), n = this.monomByDegree(1, e), l = this.monomByDegree(0, e), r.isLiteralSquare() && l.isLiteralSquare() && n.clone().pow(2).isSameAs(r.clone().multiply(l))) {
1596
- const L = new C("x", r.coefficient, n.coefficient, l.coefficient), te = i(E = L, Ot).call(E, "x"), ae = [];
1695
+ if (n = this.monomByDegree(2, e), r = this.monomByDegree(1, e), l = this.monomByDegree(0, e), n.isLiteralSquare() && l.isLiteralSquare() && r.clone().pow(2).isSameAs(n.clone().multiply(l))) {
1696
+ const L = new C("x", n.coefficient, r.coefficient, l.coefficient), te = i(E = L, Ot).call(E, "x"), ae = [];
1597
1697
  let le;
1598
1698
  if (te.length >= 2) {
1599
1699
  for (const ge of te)
1600
- ge.degree().isZero() ? ae.push(ge.clone()) : (le = ge.clone(), le.monoms[0].literal = r.literalSqrt, le.monoms[1].literal = l.literalSqrt, ae.push(le.clone()));
1700
+ ge.degree().isZero() ? ae.push(ge.clone()) : (le = ge.clone(), le.monoms[0].literal = n.literalSqrt, le.monoms[1].literal = l.literalSqrt, ae.push(le.clone()));
1601
1701
  return ae;
1602
1702
  }
1603
1703
  }
1604
1704
  return [this.clone()];
1605
1705
  });
1606
1706
  d(this, qt, (e, t, s) => {
1607
- const r = e.monoms[0].dividers, n = e.monoms[e.monoms.length - 1].dividers, l = [];
1608
- return r.forEach((u) => {
1609
- u.degree(s).isLeq(t) && n.forEach((f) => {
1707
+ const n = e.monoms[0].dividers, r = e.monoms[e.monoms.length - 1].dividers, l = [];
1708
+ return n.forEach((u) => {
1709
+ u.degree(s).isLeq(t) && r.forEach((f) => {
1610
1710
  u.degree(s).isNotEqual(f.degree(s)) && (l.push(new C(u, f)), l.push(new C(u, f.clone().opposite())));
1611
1711
  });
1612
1712
  }), l;
1613
1713
  });
1614
- d(this, at, (e) => {
1714
+ d(this, lt, (e) => {
1615
1715
  for (const t of i(this, y))
1616
1716
  t.coefficient.multiply(e);
1617
1717
  return this.reduce();
1618
1718
  });
1619
- d(this, Tt, (e) => i(this, at).call(this, new c(e)));
1620
- d(this, At, (e) => {
1719
+ d(this, Mt, (e) => i(this, lt).call(this, new c(e)));
1720
+ d(this, kt, (e) => {
1621
1721
  for (const t of i(this, y))
1622
1722
  t.multiply(e);
1623
1723
  return this.reduce();
1624
1724
  });
1625
- d(this, Mt, (e) => {
1725
+ d(this, Ct, (e) => {
1626
1726
  const t = [];
1627
1727
  for (const s of i(this, y))
1628
- for (const r of e.monoms)
1629
- t.push(I.xMultiply(s, r));
1728
+ for (const n of e.monoms)
1729
+ t.push(k.xMultiply(s, n));
1630
1730
  return h(this, y, t), this.reduce();
1631
1731
  });
1632
- d(this, Ct, (e, t) => {
1732
+ d(this, It, (e, t) => {
1633
1733
  switch (t.tokenType) {
1634
- case m.COEFFICIENT:
1734
+ case p.COEFFICIENT:
1635
1735
  e.push(new C(t.token));
1636
1736
  break;
1637
- case m.VARIABLE:
1638
- e.push(new C().add(new I(t.token)));
1737
+ case p.VARIABLE:
1738
+ e.push(new C().add(new k(t.token)));
1639
1739
  break;
1640
- case m.CONSTANT:
1740
+ case p.CONSTANT:
1641
1741
  console.log("Actually, not supported - will be added later !");
1642
1742
  break;
1643
- case m.OPERATION:
1743
+ case p.OPERATION:
1644
1744
  if (e.length >= 2) {
1645
- const s = e.pop(), r = e.pop();
1646
- if (r === void 0 || s === void 0)
1745
+ const s = e.pop(), n = e.pop();
1746
+ if (n === void 0 || s === void 0)
1647
1747
  break;
1648
1748
  if (t.token === "+")
1649
- e.push(r.add(s));
1749
+ e.push(n.add(s));
1650
1750
  else if (t.token === "-")
1651
- e.push(r.subtract(s));
1751
+ e.push(n.subtract(s));
1652
1752
  else if (t.token === "*")
1653
- e.push(r.multiply(s));
1753
+ e.push(n.multiply(s));
1654
1754
  else if (t.token === "/")
1655
- s.degree().isStrictlyPositive() ? console.log("divide by a polynom -> should create a rational polynom !") : e.push(r.divide(s.monoms[0].coefficient));
1656
- else if (t.token === "^")
1755
+ s.degree().isStrictlyPositive() ? console.log("divide by a polynom -> should create a rational polynom !") : e.push(n.divide(s.monoms[0].coefficient));
1756
+ else if (t.token === "^") {
1657
1757
  if (s.degree().isStrictlyPositive())
1658
- console.error("Cannot elevate a polynom with another polynom !", r.tex, s.tex);
1659
- else if (s.monoms[0].coefficient.isRelative())
1660
- e.push(r.pow(s.monoms[0].coefficient.value));
1661
- else if (r.monoms.length === 1 && r.monoms[0].coefficient.isOne()) {
1662
- for (const n in r.monoms[0].literal)
1663
- r.monoms[0].literal[n].multiply(s.monoms[0].coefficient);
1664
- e.push(r);
1758
+ throw new Error("Cannot elevate a polynom with another polynom !");
1759
+ if (s.monoms[0].coefficient.isRelative())
1760
+ e.push(n.pow(s.monoms[0].coefficient.value));
1761
+ else if (n.monoms.length === 1 && n.monoms[0].coefficient.isOne()) {
1762
+ for (const r in n.monoms[0].literal)
1763
+ n.monoms[0].literal[r].multiply(s.monoms[0].coefficient);
1764
+ e.push(n);
1665
1765
  } else
1666
1766
  console.error("Cannot have power with fraction");
1767
+ }
1667
1768
  } else if (t.token === "-") {
1668
1769
  const s = e.pop();
1669
1770
  s && e.push(s.opposite());
1670
1771
  } else
1671
1772
  throw new Error("Error parsing the polynom");
1672
1773
  break;
1673
- case m.MONOM:
1774
+ case p.MONOM:
1674
1775
  console.error("The monom token should not appear here");
1675
1776
  break;
1676
- case m.FUNCTION:
1777
+ case p.FUNCTION:
1677
1778
  console.error("The function token should not appear here - might be introduced later.");
1678
1779
  break;
1679
1780
  }
1680
1781
  });
1681
- d(this, Ye, (e, t, s, r) => {
1682
- let n = "";
1782
+ d(this, Ke, (e, t, s, n) => {
1783
+ let r = "";
1683
1784
  for (const l of i(this, y)) {
1684
1785
  if (l.coefficient.value === 0)
1685
1786
  continue;
1686
1787
  let u;
1687
- r ? u = l.plotFunction : u = e === "tex" ? l.tex : l.display, n += `${l.coefficient.sign() === 1 && (n !== "" || t === !0) ? "+" : ""}${u}`;
1788
+ n ? u = l.plotFunction : u = e === "tex" ? l.tex : l.display, r += `${l.coefficient.sign() === 1 && (r !== "" || t === !0) ? "+" : ""}${u}`;
1688
1789
  }
1689
- return s === !0 && this.length > 1 && (e === "tex" ? n = `\\left( ${n} \\right)` : n = `(${n})`), n === "" && (n = "0"), n;
1790
+ return s === !0 && this.length > 1 && (e === "tex" ? r = `\\left( ${r} \\right)` : r = `(${r})`), r === "" && (r = "0"), r;
1690
1791
  });
1691
1792
  /**
1692
1793
  * Main parse using a shutting yard class
1693
1794
  * @param inputStr
1694
1795
  */
1695
- d(this, $t, (e) => {
1696
- const s = new li().parse(e).rpn;
1796
+ d(this, Pt, (e) => {
1797
+ const s = new Gt().parse(e).rpn;
1697
1798
  this.zero();
1698
- const r = [];
1699
- for (const n of s)
1700
- i(this, Ct).call(this, r, n);
1701
- return r.length === 1 && this.add(r[0]), this.reorder();
1799
+ const n = [];
1800
+ for (const r of s)
1801
+ i(this, It).call(this, n, r);
1802
+ return n.length === 1 && this.add(n[0]), this.reorder();
1702
1803
  });
1703
- return h(this, y, []), h(this, Ze, []), e !== void 0 && this.parse(e, ...t), this;
1804
+ return h(this, y, []), h(this, Fe, []), e !== void 0 && this.parse(e, ...t), this;
1704
1805
  }
1705
1806
  hasVariable(e) {
1706
1807
  return this.variables.includes(e);
@@ -1723,7 +1824,7 @@ const C = class C {
1723
1824
  // #region Getters And Setters (22)
1724
1825
  // ------------------------------------------
1725
1826
  get display() {
1726
- return i(this, Ye).call(this);
1827
+ return i(this, Ke).call(this);
1727
1828
  }
1728
1829
  get isMultiVariable() {
1729
1830
  return i(this, y).some((e) => e.variables.length > 1);
@@ -1742,10 +1843,10 @@ const C = class C {
1742
1843
  return this.variables.length;
1743
1844
  }
1744
1845
  get plotFunction() {
1745
- return i(this, Ye).call(this, "tex", !1, !1, !0);
1846
+ return i(this, Ke).call(this, "tex", !1, !1, !0);
1746
1847
  }
1747
1848
  get tex() {
1748
- return i(this, Ye).call(this, "tex");
1849
+ return i(this, Ke).call(this, "tex");
1749
1850
  }
1750
1851
  get variables() {
1751
1852
  let e = [];
@@ -1758,53 +1859,53 @@ const C = class C {
1758
1859
  }
1759
1860
  // #endregion Private methods (15)
1760
1861
  };
1761
- Ze = new WeakMap(), y = new WeakMap(), Xe = new WeakMap(), ht = new WeakMap(), Et = new WeakMap(), Nt = new WeakMap(), Ot = new WeakMap(), qt = new WeakMap(), at = new WeakMap(), Tt = new WeakMap(), At = new WeakMap(), Mt = new WeakMap(), It = new WeakSet(), pi = function(e, ...t) {
1862
+ Fe = new WeakMap(), y = new WeakMap(), Qe = new WeakMap(), at = new WeakMap(), Tt = new WeakMap(), At = new WeakMap(), Ot = new WeakMap(), qt = new WeakMap(), lt = new WeakMap(), Mt = new WeakMap(), kt = new WeakMap(), Ct = new WeakMap(), $t = new WeakSet(), wi = function(e, ...t) {
1762
1863
  if (t.length === 0) {
1763
1864
  if (e = "" + e, e !== "" && !isNaN(Number(e))) {
1764
1865
  this.empty();
1765
- const s = new I(e);
1866
+ const s = new k(e);
1766
1867
  return this.add(s), this;
1767
1868
  }
1768
- return i(this, $t).call(this, e);
1869
+ return i(this, Pt).call(this, e);
1769
1870
  } else if (/^[a-z]+/.test(e)) {
1770
1871
  this.empty();
1771
- const s = t.map((r) => new c(r));
1872
+ const s = t.map((n) => new c(n));
1772
1873
  if (e.length > 1) {
1773
- const r = e.split("");
1774
- let n = 0;
1874
+ const n = e.split("");
1875
+ let r = 0;
1775
1876
  for (const l of s) {
1776
- const u = new I();
1777
- u.coefficient = l.clone(), u.literalStr = r[n] || "", this.add(u), n++;
1877
+ const u = new k();
1878
+ u.coefficient = l.clone(), u.literalStr = n[r] || "", this.add(u), r++;
1778
1879
  }
1779
1880
  } else {
1780
- let r = s.length - 1;
1781
- for (const n of s) {
1782
- const l = new I();
1783
- l.coefficient = n.clone(), l.literalStr = `${e}^${r}`, this.add(l), r--;
1881
+ let n = s.length - 1;
1882
+ for (const r of s) {
1883
+ const l = new k();
1884
+ l.coefficient = r.clone(), l.literalStr = `${e}^${n}`, this.add(l), n--;
1784
1885
  }
1785
1886
  }
1786
1887
  return this;
1787
1888
  } else
1788
1889
  return this.zero();
1789
- }, Ct = new WeakMap(), Ye = new WeakMap(), $t = new WeakMap();
1790
- let T = C;
1791
- function ri(o, e = !0) {
1890
+ }, It = new WeakMap(), Ke = new WeakMap(), Pt = new WeakMap();
1891
+ let O = C;
1892
+ function ci(o, e = !0) {
1792
1893
  return e ? `\\left( ${o} \\right)` : `(${o})`;
1793
1894
  }
1794
- var Ee, Qe, Ne, Oe;
1895
+ var Ee, Je, Ne, Te;
1795
1896
  const we = class we {
1796
1897
  constructor(e, t) {
1797
1898
  d(this, Ee);
1798
- d(this, Qe, !1);
1899
+ d(this, Je, !1);
1799
1900
  d(this, Ne);
1800
- d(this, Oe);
1901
+ d(this, Te);
1801
1902
  if (e instanceof we)
1802
- h(this, Ne, e.polynom.clone()), h(this, Oe, e.power.clone());
1903
+ h(this, Ne, e.polynom.clone()), h(this, Te, e.power.clone());
1803
1904
  else if (typeof e == "string" && t === void 0) {
1804
- const [s, r = "1"] = e.split("^");
1805
- h(this, Ne, new T(s)), h(this, Oe, new c(r.replace("(", "").replace(")", "")));
1905
+ const [s, n = "1"] = e.split("^");
1906
+ h(this, Ne, new O(s)), h(this, Te, new c(n.replace("(", "").replace(")", "")));
1806
1907
  } else
1807
- h(this, Ne, new T(e)), h(this, Oe, new c(t ?? 1));
1908
+ h(this, Ne, new O(e)), h(this, Te, new c(t ?? 1));
1808
1909
  return h(this, Ee, 1), this;
1809
1910
  }
1810
1911
  parse() {
@@ -1823,7 +1924,7 @@ const we = class we {
1823
1924
  return h(this, Ee, 0), this;
1824
1925
  }
1825
1926
  get asSingle() {
1826
- return h(this, Qe, !0), this;
1927
+ return h(this, Je, !0), this;
1827
1928
  }
1828
1929
  degree(e) {
1829
1930
  return this.polynom.degree(e).multiply(this.power);
@@ -1842,13 +1943,13 @@ const we = class we {
1842
1943
  }
1843
1944
  get display() {
1844
1945
  const e = this.power.numerator, t = this.power.denominator;
1845
- let s, r;
1846
- return i(this, Ee) === 0 && t > 1 ? (s = `${t === 2 ? "sqrt" : `root(${t})`}(${this.polynom.display})`, r = Math.abs(e) === 1 ? "" : `^(${Math.abs(e)})`) : (s = i(this, Qe) && this.power.isOne() ? this.polynom.display : ri(this.polynom.display, !1), r = t === 1 && Math.abs(e) === 1 ? "" : `^(${this.power.display})`), s = `${s}${r}`, i(this, Ee) === 0 && e < 0 && (s = `1/(${s})`), s;
1946
+ let s, n;
1947
+ return i(this, Ee) === 0 && t > 1 ? (s = `${t === 2 ? "sqrt" : `root(${t})`}(${this.polynom.display})`, n = Math.abs(e) === 1 ? "" : `^(${Math.abs(e)})`) : (s = i(this, Je) && this.power.isOne() ? this.polynom.display : ci(this.polynom.display, !1), n = t === 1 && Math.abs(e) === 1 ? "" : `^(${this.power.display})`), s = `${s}${n}`, i(this, Ee) === 0 && e < 0 && (s = `1/(${s})`), s;
1847
1948
  }
1848
1949
  divide(e) {
1849
1950
  if (e instanceof we && this.isSameAs(e))
1850
1951
  return this.power.subtract(e.power), this;
1851
- const t = new T(e);
1952
+ const t = new O(e);
1852
1953
  if (this.isSameAs(t))
1853
1954
  return this.power.subtract(1), this;
1854
1955
  throw new Error("The two factors must be the same");
@@ -1870,7 +1971,7 @@ const we = class we {
1870
1971
  }
1871
1972
  isSameAs(e) {
1872
1973
  let t;
1873
- return e instanceof we ? t = e.polynom : e instanceof T ? t = e : t = new T(e), this.polynom.isEqual(t);
1974
+ return e instanceof we ? t = e.polynom : e instanceof O ? t = e : t = new O(e), this.polynom.isEqual(t);
1874
1975
  }
1875
1976
  isZero() {
1876
1977
  return this.polynom.isZero();
@@ -1878,13 +1979,13 @@ const we = class we {
1878
1979
  multiply(e) {
1879
1980
  if (e instanceof we && this.isSameAs(e))
1880
1981
  return this.power.add(e.power), this;
1881
- const t = new T(e);
1982
+ const t = new O(e);
1882
1983
  if (this.isSameAs(t))
1883
1984
  return this.power.add(1), this;
1884
1985
  throw new Error("The two factors must be the same");
1885
1986
  }
1886
1987
  one() {
1887
- return i(this, Ne).one(), i(this, Oe).one(), this;
1988
+ return i(this, Ne).one(), i(this, Te).one(), this;
1888
1989
  }
1889
1990
  opposite() {
1890
1991
  throw new Error("Method not implemented.");
@@ -1899,10 +2000,10 @@ const we = class we {
1899
2000
  return this.power.multiply(e), this;
1900
2001
  }
1901
2002
  get power() {
1902
- return i(this, Oe);
2003
+ return i(this, Te);
1903
2004
  }
1904
2005
  set power(e) {
1905
- h(this, Oe, new c(e));
2006
+ h(this, Te, new c(e));
1906
2007
  }
1907
2008
  primitive() {
1908
2009
  throw new Error("Method not implemented.");
@@ -1921,44 +2022,44 @@ const we = class we {
1921
2022
  }
1922
2023
  get tex() {
1923
2024
  const e = this.power.numerator, t = this.power.denominator;
1924
- let s, r;
1925
- return i(this, Ee) === 0 && t > 1 ? (s = `\\sqrt${t === 2 ? "" : `[ ${t} ]`}{ ${this.polynom.tex} }`, r = Math.abs(e) === 1 ? "" : `^{ ${Math.abs(e)} }`) : (s = i(this, Qe) && this.power.isOne() ? this.polynom.tex : ri(this.polynom.tex), r = t === 1 && Math.abs(e) === 1 ? "" : `^{ ${this.power.tex} }`), s = `${s}${r}`, i(this, Ee) === 0 && e < 0 && (s = `\\frac{ 1 }{ ${s} }`), s;
2025
+ let s, n;
2026
+ return i(this, Ee) === 0 && t > 1 ? (s = `\\sqrt${t === 2 ? "" : `[ ${t} ]`}{ ${this.polynom.tex} }`, n = Math.abs(e) === 1 ? "" : `^{ ${Math.abs(e)} }`) : (s = i(this, Je) && this.power.isOne() ? this.polynom.tex : ci(this.polynom.tex), n = t === 1 && Math.abs(e) === 1 ? "" : `^{ ${this.power.tex} }`), s = `${s}${n}`, i(this, Ee) === 0 && e < 0 && (s = `\\frac{ 1 }{ ${s} }`), s;
1926
2027
  }
1927
2028
  get variables() {
1928
2029
  return this.polynom.variables;
1929
2030
  }
1930
2031
  zero() {
1931
- return i(this, Ne).zero(), i(this, Oe).one(), this;
2032
+ return i(this, Ne).zero(), i(this, Te).one(), this;
1932
2033
  }
1933
2034
  };
1934
- Ee = new WeakMap(), Qe = new WeakMap(), Ne = new WeakMap(), Oe = new WeakMap();
2035
+ Ee = new WeakMap(), Je = new WeakMap(), Ne = new WeakMap(), Te = new WeakMap();
1935
2036
  let fe = we;
1936
- var Ue = /* @__PURE__ */ ((o) => (o[o.ROOT = 0] = "ROOT", o[o.POWER = 1] = "POWER", o))(Ue || {}), q, A, re, Pt, Ke, St;
2037
+ var We = /* @__PURE__ */ ((o) => (o[o.ROOT = 0] = "ROOT", o[o.POWER = 1] = "POWER", o))(We || {}), A, M, ne, Bt, _e, St;
1937
2038
  const xe = class xe {
1938
2039
  constructor(e, t, s) {
1939
2040
  // Left part of the equation
1940
- d(this, q);
1941
- // Right part of the equation
1942
2041
  d(this, A);
2042
+ // Right part of the equation
2043
+ d(this, M);
1943
2044
  // Signe of the equation
1944
- d(this, re);
2045
+ d(this, ne);
1945
2046
  // #endregion Constructors (3)
1946
2047
  // #region Properties and methods (26)
1947
2048
  // ------------------------------------------
1948
2049
  a(this, "parse", (e) => {
1949
- const t = i(this, Pt).call(this, e);
2050
+ const t = i(this, Bt).call(this, e);
1950
2051
  if (t === !1)
1951
2052
  throw new Error("The equation is not valid (no sign found)");
1952
2053
  const s = e.split(t);
1953
- return this.create(new T(s[0]), new T(s[1]), i(this, Ke).call(this, t));
2054
+ return this.create(new O(s[0]), new O(s[1]), i(this, _e).call(this, t));
1954
2055
  });
1955
- a(this, "create", (e, t, s) => (h(this, q, e), h(this, A, t), h(this, re, i(this, Ke).call(this, s ?? "=")), this));
1956
- a(this, "clone", () => new xe(i(this, q).clone(), i(this, A).clone(), i(this, re)));
2056
+ a(this, "create", (e, t, s) => (h(this, A, e), h(this, M, t), h(this, ne, i(this, _e).call(this, s ?? "=")), this));
2057
+ a(this, "clone", () => new xe(i(this, A).clone(), i(this, M).clone(), i(this, ne)));
1957
2058
  /**
1958
2059
  * Get the degree of the equation
1959
2060
  * @param letter
1960
2061
  */
1961
- a(this, "degree", (e) => c.max(i(this, q).degree(e), i(this, A).degree(e)));
2062
+ a(this, "degree", (e) => c.max(i(this, A).degree(e), i(this, M).degree(e)));
1962
2063
  /**
1963
2064
  * divide an equation by a given value (transformed as a fraction)
1964
2065
  *
@@ -1989,7 +2090,7 @@ const xe = class xe {
1989
2090
  /**
1990
2091
  * Determine if the equation contains more than one letter/variable.
1991
2092
  */
1992
- a(this, "isMultiVariable", () => i(this, q).isMultiVariable || i(this, A).isMultiVariable);
2093
+ a(this, "isMultiVariable", () => i(this, A).isMultiVariable || i(this, M).isMultiVariable);
1993
2094
  // -----------------------------------------------
1994
2095
  // Equations helpers
1995
2096
  a(this, "isEqualTo", (e) => {
@@ -2004,49 +2105,49 @@ const xe = class xe {
2004
2105
  if (!this.degree(e).isOne() || this.isMultiVariable())
2005
2106
  return !1;
2006
2107
  let t;
2007
- i(this, q).subtract(i(this, A)), i(this, A).zero();
2008
- const s = [...i(this, q).monoms];
2009
- for (const n of s)
2010
- n.hasVariable(e) || (t = n.clone(), i(this, q).subtract(t), i(this, A).subtract(t));
2011
- if (i(this, q).length !== 1)
2108
+ i(this, A).subtract(i(this, M)), i(this, M).zero();
2109
+ const s = [...i(this, A).monoms];
2110
+ for (const r of s)
2111
+ r.hasVariable(e) || (t = r.clone(), i(this, A).subtract(t), i(this, M).subtract(t));
2112
+ if (i(this, A).length !== 1)
2012
2113
  return !1;
2013
- const r = i(this, q).monoms[0].coefficient.clone();
2014
- return i(this, q).divide(r), i(this, A).divide(r), this;
2114
+ const n = i(this, A).monoms[0].coefficient.clone();
2115
+ return i(this, A).divide(n), i(this, M).divide(n), this;
2015
2116
  });
2016
2117
  // -----------------------------------------------
2017
2118
  // Equations operations
2018
2119
  // -----------------------------------------------
2019
- a(this, "letters", () => [.../* @__PURE__ */ new Set([...i(this, q).letters(), ...i(this, A).letters()])]);
2120
+ a(this, "letters", () => [.../* @__PURE__ */ new Set([...i(this, A).letters(), ...i(this, M).letters()])]);
2020
2121
  // -----------------------------------------------
2021
2122
  /**
2022
2123
  * Reorder will move all monoms containing a letter on the left, all the other on the right.
2023
2124
  */
2024
- a(this, "moveLeft", () => (i(this, q).subtract(i(this, A)), i(this, A).zero(), this));
2125
+ a(this, "moveLeft", () => (i(this, A).subtract(i(this, M)), i(this, M).zero(), this));
2025
2126
  /**
2026
2127
  * Multiple an equation by a fraction value.
2027
2128
  * @param value
2028
2129
  */
2029
2130
  a(this, "multiply", (e) => {
2030
2131
  const t = new c(e);
2031
- return i(this, q).multiply(t), i(this, A).multiply(t), i(this, re) !== "=" && t.sign() === -1 && i(this, St).call(this), this;
2132
+ return i(this, A).multiply(t), i(this, M).multiply(t), i(this, ne) !== "=" && t.sign() === -1 && i(this, St).call(this), this;
2032
2133
  });
2033
- a(this, "opposite", () => (h(this, q, i(this, q).opposite()), h(this, A, i(this, A).opposite()), this));
2034
- a(this, "reorder", (e) => (i(this, q).subtract(i(this, A)), i(this, A).zero(), i(this, q).reorder(), e ? this : (i(this, q).monoms.filter((t) => t.degree().isZero()).forEach((t) => {
2134
+ a(this, "opposite", () => (h(this, A, i(this, A).opposite()), h(this, M, i(this, M).opposite()), this));
2135
+ a(this, "reorder", (e) => (i(this, A).subtract(i(this, M)), i(this, M).zero(), i(this, A).reorder(), e ? this : (i(this, A).monoms.filter((t) => t.degree().isZero()).forEach((t) => {
2035
2136
  const s = t.clone();
2036
- i(this, q).subtract(s), i(this, A).subtract(s);
2037
- }), i(this, q).reorder(), i(this, A).reorder(), this)));
2137
+ i(this, A).subtract(s), i(this, M).subtract(s);
2138
+ }), i(this, A).reorder(), i(this, M).reorder(), this)));
2038
2139
  // ------------------------------------------
2039
- a(this, "replaceBy", (e, t) => (i(this, q).replaceBy(e, t), i(this, A).replaceBy(e, t), this));
2140
+ a(this, "replaceBy", (e, t) => (i(this, A).replaceBy(e, t), i(this, M).replaceBy(e, t), this));
2040
2141
  /**
2041
2142
  * Multiply by the lcm denominator and divide by the gcm numerators.
2042
2143
  */
2043
- a(this, "simplify", () => (this.multiply(G.lcm(...i(this, q).getDenominators(), ...i(this, A).getDenominators())), this.divide(G.gcd(...i(this, q).getNumerators(), ...i(this, A).getNumerators())), this));
2144
+ a(this, "simplify", () => (this.multiply(G.lcm(...i(this, A).getDenominators(), ...i(this, M).getDenominators())), this.divide(G.gcd(...i(this, A).getNumerators(), ...i(this, M).getNumerators())), this));
2044
2145
  // -----------------------------------------------
2045
- a(this, "solve", () => new gt(this.clone()).solve());
2146
+ a(this, "solve", () => new wt(this.clone()).solve());
2046
2147
  a(this, "test", (e) => this.left.evaluate(e).isEqual(this.right.evaluate(e)));
2047
2148
  // #endregion Getters And Setters (13)
2048
2149
  // #region Private methods (6)
2049
- d(this, Pt, (e) => {
2150
+ d(this, Bt, (e) => {
2050
2151
  if (e.includes("geq"))
2051
2152
  return e.includes("\\geq") ? "\\geq" : "geq";
2052
2153
  if (e.includes("leq"))
@@ -2069,13 +2170,13 @@ const xe = class xe {
2069
2170
  });
2070
2171
  // -----------------------------------------------
2071
2172
  // Equations solving algorithms
2072
- d(this, Ke, (e) => e === void 0 ? "=" : e.includes("geq") || e.includes(">=") || e.includes("=>") ? ">=" : e.includes(">") ? ">" : e.includes("leq") || e.includes("<=") || e.includes("=<") ? "<=" : e.includes("<") ? "<" : "=");
2073
- d(this, St, () => i(this, re) === "=" ? this : i(this, re).includes("<") ? (i(this, re).replace("<", ">"), this) : i(this, re).includes(">") ? (i(this, re).replace(">", "<"), this) : this);
2074
- if (h(this, q, new T().zero()), h(this, A, new T().zero()), h(this, re, "="), e !== void 0 && t === void 0) {
2173
+ d(this, _e, (e) => e === void 0 ? "=" : e.includes("geq") || e.includes(">=") || e.includes("=>") ? ">=" : e.includes(">") ? ">" : e.includes("leq") || e.includes("<=") || e.includes("=<") ? "<=" : e.includes("<") ? "<" : "=");
2174
+ d(this, St, () => i(this, ne) === "=" ? this : i(this, ne).includes("<") ? (i(this, ne).replace("<", ">"), this) : i(this, ne).includes(">") ? (i(this, ne).replace(">", "<"), this) : this);
2175
+ if (h(this, A, new O().zero()), h(this, M, new O().zero()), h(this, ne, "="), e !== void 0 && t === void 0) {
2075
2176
  if (e instanceof xe)
2076
2177
  return e.clone();
2077
2178
  typeof e == "string" && this.parse(e);
2078
- } else e !== void 0 && t !== void 0 && (this.left = new T(e), this.right = new T(t));
2179
+ } else e !== void 0 && t !== void 0 && (this.left = new O(e), this.right = new O(t));
2079
2180
  return s !== void 0 && (this.sign = s), this;
2080
2181
  }
2081
2182
  /**
@@ -2088,11 +2189,11 @@ const xe = class xe {
2088
2189
  */
2089
2190
  add(e) {
2090
2191
  if (e instanceof xe)
2091
- return i(this, q).add(e.left), i(this, A).add(e.right), this;
2192
+ return i(this, A).add(e.left), i(this, M).add(e.right), this;
2092
2193
  if (typeof e == "string" && !xe.isEquationString(e))
2093
2194
  return this.add(new xe(e));
2094
- const t = new T(e);
2095
- return i(this, q).add(t), i(this, A).add(t), this;
2195
+ const t = new O(e);
2196
+ return i(this, A).add(t), i(this, M).add(t), this;
2096
2197
  }
2097
2198
  /**
2098
2199
  * Create an Equation using two polynoms.
@@ -2101,86 +2202,86 @@ const xe = class xe {
2101
2202
  * @param asNumeric
2102
2203
  */
2103
2204
  evaluate(e, t) {
2104
- const s = i(this, q).evaluate(e, t), r = i(this, A).evaluate(e, t);
2105
- return t ? s === r : s.isEqual(r);
2205
+ const s = i(this, A).evaluate(e, t), n = i(this, M).evaluate(e, t);
2206
+ return t ? s === n : s.isEqual(n);
2106
2207
  }
2107
2208
  isEqual(e) {
2108
2209
  const t = new xe(e);
2109
- return t.left.isEqual(i(this, q)) && t.right.isEqual(i(this, A));
2210
+ return t.left.isEqual(i(this, A)) && t.right.isEqual(i(this, M));
2110
2211
  }
2111
2212
  pow(e) {
2112
- return i(this, q).pow(e), i(this, A).pow(e), this;
2213
+ return i(this, A).pow(e), i(this, M).pow(e), this;
2113
2214
  }
2114
2215
  reduce() {
2115
- return this.moveLeft(), i(this, q).reduce(), this.simplify(), i(this, q).monoms[0].coefficient.isNegative() && this.multiply(-1), this;
2216
+ return this.moveLeft(), i(this, A).reduce(), this.simplify(), i(this, A).monoms[0].coefficient.isNegative() && this.multiply(-1), this;
2116
2217
  }
2117
2218
  split() {
2118
- return [i(this, q).clone(), i(this, A).clone()];
2219
+ return [i(this, A).clone(), i(this, M).clone()];
2119
2220
  }
2120
2221
  subtract(e) {
2121
2222
  if (e instanceof xe)
2122
- return i(this, q).subtract(e.left), i(this, A).subtract(e.right), this;
2223
+ return i(this, A).subtract(e.left), i(this, M).subtract(e.right), this;
2123
2224
  if (typeof e == "string" && !xe.isEquationString(e))
2124
2225
  return this.subtract(new xe(e));
2125
- const t = new T(e);
2126
- return i(this, q).subtract(t), i(this, A).subtract(t), this;
2226
+ const t = new O(e);
2227
+ return i(this, A).subtract(t), i(this, M).subtract(t), this;
2127
2228
  }
2128
2229
  static isEquationString(e) {
2129
2230
  return e.includes("=") || e.includes("<") || e.includes(">") || e.includes("<=") || e.includes(">=");
2130
2231
  }
2131
2232
  static makeSolutionsUnique(e, t) {
2132
- const s = [], r = e.filter((n) => s.includes(n.tex) ? !1 : (s.push(n.tex), !0));
2133
- return t === !0 && r.sort((n, l) => n.value - l.value), r;
2233
+ const s = [], n = e.filter((r) => s.includes(r.tex) ? !1 : (s.push(r.tex), !0));
2234
+ return t === !0 && n.sort((r, l) => r.value - l.value), n;
2134
2235
  }
2135
2236
  // #endregion Properties and methods (26)
2136
2237
  // #region Getters And Setters (13)
2137
2238
  get display() {
2138
- return `${i(this, q).display}${this.signAsTex}${i(this, A).display}`;
2239
+ return `${i(this, A).display}${this.signAsTex}${i(this, M).display}`;
2139
2240
  }
2140
2241
  // Getter and setter
2141
2242
  get left() {
2142
- return i(this, q);
2243
+ return i(this, A);
2143
2244
  }
2144
2245
  set left(e) {
2145
- h(this, q, e);
2246
+ h(this, A, e);
2146
2247
  }
2147
2248
  get numberOfVars() {
2148
2249
  return this.variables.length;
2149
2250
  }
2150
2251
  get right() {
2151
- return i(this, A);
2252
+ return i(this, M);
2152
2253
  }
2153
2254
  set right(e) {
2154
- h(this, A, e);
2255
+ h(this, M, e);
2155
2256
  }
2156
2257
  // ------------------------------------------
2157
2258
  get sign() {
2158
- return i(this, re);
2259
+ return i(this, ne);
2159
2260
  }
2160
2261
  set sign(e) {
2161
- h(this, re, i(this, Ke).call(this, e));
2262
+ h(this, ne, i(this, _e).call(this, e));
2162
2263
  }
2163
2264
  get signAsTex() {
2164
- return i(this, re) === ">=" ? "\\geq" : i(this, re) === "<=" ? "\\leq" : i(this, re);
2265
+ return i(this, ne) === ">=" ? "\\geq" : i(this, ne) === "<=" ? "\\leq" : i(this, ne);
2165
2266
  }
2166
2267
  get tex() {
2167
- return `${i(this, q).tex}${this.signAsTex}${i(this, A).tex}`;
2268
+ return `${i(this, A).tex}${this.signAsTex}${i(this, M).tex}`;
2168
2269
  }
2169
2270
  get variables() {
2170
- return [...new Set(i(this, A).variables.concat(i(this, q).variables))];
2271
+ return [...new Set(i(this, M).variables.concat(i(this, A).variables))];
2171
2272
  }
2172
2273
  // #endregion Private methods (6)
2173
2274
  };
2174
- q = new WeakMap(), A = new WeakMap(), re = new WeakMap(), Pt = new WeakMap(), Ke = new WeakMap(), St = new WeakMap();
2275
+ A = new WeakMap(), M = new WeakMap(), ne = new WeakMap(), Bt = new WeakMap(), _e = new WeakMap(), St = new WeakMap();
2175
2276
  let H = xe;
2176
- var N, Ve, lt, Xt;
2277
+ var N, je, ct, Jt;
2177
2278
  const me = class me {
2178
2279
  // #endregion Class fields (1)
2179
2280
  // #region Constructors (1)
2180
2281
  constructor(...e) {
2181
2282
  // #region Class fields (1)
2182
2283
  d(this, N, []);
2183
- d(this, Ve, Ue.POWER);
2284
+ d(this, je, We.POWER);
2184
2285
  return this.parse(...e), this;
2185
2286
  }
2186
2287
  // #endregion Constructors (1)
@@ -2189,12 +2290,12 @@ const me = class me {
2189
2290
  return e.length === 0 ? this : (h(this, N, []), e.forEach((t) => {
2190
2291
  if (typeof t == "string") {
2191
2292
  const s = t.split(")(").join(")*(").split("*");
2192
- i(this, N).push(...s.map((r) => new fe(r)));
2293
+ i(this, N).push(...s.map((n) => new fe(n)));
2193
2294
  } else t instanceof me ? i(this, N).push(...t.factors.map((s) => s.clone())) : i(this, N).push(new fe(t));
2194
2295
  }), this);
2195
2296
  }
2196
2297
  fromPolynom(e, t) {
2197
- return h(this, N, new T(e).factorize(t).map((s) => new fe(s))), this;
2298
+ return h(this, N, new O(e).factorize(t).map((s) => new fe(s))), this;
2198
2299
  }
2199
2300
  clone() {
2200
2301
  return new me(...i(this, N).map((e) => e.clone()));
@@ -2202,11 +2303,11 @@ const me = class me {
2202
2303
  add(...e) {
2203
2304
  let t = [this, ...e];
2204
2305
  const s = me.gcd(...t);
2205
- t = t.map((n) => n.divide(s).reduce());
2206
- const r = new T("0");
2207
- return t.forEach((n) => r.add(n.develop())), h(this, N, [
2306
+ t = t.map((r) => r.divide(s).reduce());
2307
+ const n = new O("0");
2308
+ return t.forEach((r) => n.add(r.develop())), h(this, N, [
2208
2309
  ...s.factors,
2209
- new fe(r)
2310
+ new fe(n)
2210
2311
  ]), this;
2211
2312
  }
2212
2313
  degree(e) {
@@ -2214,16 +2315,16 @@ const me = class me {
2214
2315
  }
2215
2316
  derivative() {
2216
2317
  const e = [], t = i(this, N).length;
2217
- for (let r = 0; r < t; r++) {
2218
- const n = i(this, N).slice(), l = n.splice(r, 1)[0];
2219
- e.push(new me(...n).multiply(new me(...l.derivative())));
2318
+ for (let n = 0; n < t; n++) {
2319
+ const r = i(this, N).slice(), l = r.splice(n, 1)[0];
2320
+ e.push(new me(...r).multiply(new me(...l.derivative())));
2220
2321
  }
2221
- e.forEach((r) => r.reduce());
2322
+ e.forEach((n) => n.reduce());
2222
2323
  const s = e.shift();
2223
2324
  return s !== void 0 && h(this, N, s.factors), this.add(...e);
2224
2325
  }
2225
2326
  develop() {
2226
- const e = new T("1");
2327
+ const e = new O("1");
2227
2328
  return i(this, N).forEach((t) => {
2228
2329
  e.multiply(t.develop());
2229
2330
  }), e;
@@ -2232,7 +2333,7 @@ const me = class me {
2232
2333
  return h(this, N, i(this, N).concat(e.clone().factors.map((t) => t.inverse()))), this;
2233
2334
  }
2234
2335
  evaluate(e, t) {
2235
- return t ? i(this, N).reduce((s, r) => s * r.evaluate(e, t), 1) : i(this, N).reduce((s, r) => s.multiply(r.evaluate(e)), new c("1"));
2336
+ return t ? i(this, N).reduce((s, n) => s * n.evaluate(e, t), 1) : i(this, N).reduce((s, n) => s.multiply(n.evaluate(e)), new c("1"));
2236
2337
  }
2237
2338
  hasVariable(e) {
2238
2339
  return i(this, N).some((t) => t.hasVariable(e));
@@ -2241,8 +2342,8 @@ const me = class me {
2241
2342
  return h(this, N, i(this, N).map((e) => e.inverse())), this;
2242
2343
  }
2243
2344
  isEqual(e) {
2244
- const t = me.gcd(this, e), s = this.clone().divide(t).reduce(), r = e.clone().divide(t).reduce();
2245
- return s.isOne() && r.isOne();
2345
+ const t = me.gcd(this, e), s = this.clone().divide(t).reduce(), n = e.clone().divide(t).reduce();
2346
+ return s.isOne() && n.isOne();
2246
2347
  }
2247
2348
  isOne() {
2248
2349
  return i(this, N).every((e) => e.isOne());
@@ -2269,10 +2370,10 @@ const me = class me {
2269
2370
  throw new Error("Method not implemented.");
2270
2371
  }
2271
2372
  reduce() {
2272
- const e = Gt(this);
2373
+ const e = Yt(this);
2273
2374
  return h(this, N, Object.values(e).map((t) => {
2274
- const s = t[0].polynom, r = t.reduce((n, l) => n.add(l.power), new c("0"));
2275
- return new fe(s, r.reduce());
2375
+ const s = t[0].polynom, n = t.reduce((r, l) => r.add(l.power), new c("0"));
2376
+ return new fe(s, n.reduce());
2276
2377
  }).filter((t) => !t.power.isZero())), this;
2277
2378
  }
2278
2379
  root(e) {
@@ -2297,11 +2398,11 @@ const me = class me {
2297
2398
  if (e.length === 1)
2298
2399
  return e[0];
2299
2400
  if (e.length === 2)
2300
- return M(s = me, lt, Xt).call(s, e[0], e[1]);
2401
+ return q(s = me, ct, Jt).call(s, e[0], e[1]);
2301
2402
  let t = e[0];
2302
- return e.shift(), e.forEach((r) => {
2303
- var n;
2304
- return t = M(n = me, lt, Xt).call(n, t, r);
2403
+ return e.shift(), e.forEach((n) => {
2404
+ var r;
2405
+ return t = q(r = me, ct, Jt).call(r, t, n);
2305
2406
  }), t;
2306
2407
  }
2307
2408
  // #endregion Properties and methods (25)
@@ -2316,10 +2417,10 @@ const me = class me {
2316
2417
  return i(this, N).reduce((e, t) => e.concat(t.variables), []);
2317
2418
  }
2318
2419
  get asRoot() {
2319
- return h(this, Ve, Ue.ROOT), this;
2420
+ return h(this, je, We.ROOT), this;
2320
2421
  }
2321
2422
  get asPower() {
2322
- return h(this, Ve, Ue.POWER), this;
2423
+ return h(this, je, We.POWER), this;
2323
2424
  }
2324
2425
  get numerator() {
2325
2426
  return i(this, N).filter((e) => e.power.isPositive());
@@ -2329,57 +2430,57 @@ const me = class me {
2329
2430
  }
2330
2431
  get display() {
2331
2432
  let e = [], t = [];
2332
- if (i(this, Ve) === Ue.ROOT ? (e = this.numerator, t = this.denominator.map((n) => n.clone().inverse())) : e = i(this, N), e.length === 0 && (e = [new fe("1")]), t.length === 0)
2333
- return e.length === 1 ? e[0].asSingle.display : e.map((n) => n.display).join("");
2334
- const s = e.length === 1 ? e[0].asSingle.display : e.map((n) => n.display).join(""), r = t.length === 1 ? t[0].asSingle.display : t.map((n) => n.display).join("");
2335
- return `(${s})/(${r})`;
2433
+ if (i(this, je) === We.ROOT ? (e = this.numerator, t = this.denominator.map((r) => r.clone().inverse())) : e = i(this, N), e.length === 0 && (e = [new fe("1")]), t.length === 0)
2434
+ return e.length === 1 ? e[0].asSingle.display : e.map((r) => r.display).join("");
2435
+ const s = e.length === 1 ? e[0].asSingle.display : e.map((r) => r.display).join(""), n = t.length === 1 ? t[0].asSingle.display : t.map((r) => r.display).join("");
2436
+ return `(${s})/(${n})`;
2336
2437
  }
2337
2438
  get tex() {
2338
2439
  let e = [], t = [];
2339
- if (i(this, Ve) === Ue.ROOT ? (e = this.numerator, t = this.denominator.map((n) => n.clone().inverse())) : e = i(this, N), e.length === 0 && (e = [new fe("1")]), t.length === 0)
2340
- return e.length === 1 ? e[0].asSingle.tex : e.map((n) => n.tex).join("");
2341
- const s = e.length === 1 ? e[0].asSingle.tex : e.map((n) => n.tex).join(""), r = t.length === 1 ? t[0].asSingle.tex : t.map((n) => n.tex).join("");
2342
- return `\\frac{ ${s} }{ ${r} }`;
2440
+ if (i(this, je) === We.ROOT ? (e = this.numerator, t = this.denominator.map((r) => r.clone().inverse())) : e = i(this, N), e.length === 0 && (e = [new fe("1")]), t.length === 0)
2441
+ return e.length === 1 ? e[0].asSingle.tex : e.map((r) => r.tex).join("");
2442
+ const s = e.length === 1 ? e[0].asSingle.tex : e.map((r) => r.tex).join(""), n = t.length === 1 ? t[0].asSingle.tex : t.map((r) => r.tex).join("");
2443
+ return `\\frac{ ${s} }{ ${n} }`;
2343
2444
  }
2344
2445
  // #endregion Private methods (1)
2345
2446
  };
2346
- N = new WeakMap(), Ve = new WeakMap(), lt = new WeakSet(), Xt = function(e, t) {
2347
- const s = Gt(e), r = Gt(t), l = Object.keys(s).filter((u) => Object.hasOwn(r, u)).map((u) => {
2348
- const f = s[u].reduce((g, E) => g.add(E.power), new c("0")), p = r[u].reduce((g, E) => g.add(E.power), new c("0"));
2349
- return new fe(u, c.min(f, p));
2447
+ N = new WeakMap(), je = new WeakMap(), ct = new WeakSet(), Jt = function(e, t) {
2448
+ const s = Yt(e), n = Yt(t), l = Object.keys(s).filter((u) => Object.hasOwn(n, u)).map((u) => {
2449
+ const f = s[u].reduce((g, E) => g.add(E.power), new c("0")), m = n[u].reduce((g, E) => g.add(E.power), new c("0"));
2450
+ return new fe(u, c.min(f, m));
2350
2451
  });
2351
2452
  return new me(...l);
2352
- }, d(me, lt);
2353
- let Ht = me;
2354
- function Gt(o) {
2355
- const e = new c().one(), t = o.factors.reduce((s, r) => {
2356
- if (r.polynom.degree().isZero())
2357
- return r.polynom.monoms.length > 0 && e.multiply(r.polynom.monoms[0].coefficient), s;
2358
- const n = r.polynom.display;
2359
- return Object.hasOwn(s, n) ? s[n].push(r) : s[n] = [r], s;
2453
+ }, d(me, ct);
2454
+ let Kt = me;
2455
+ function Yt(o) {
2456
+ const e = new c().one(), t = o.factors.reduce((s, n) => {
2457
+ if (n.polynom.degree().isZero())
2458
+ return n.polynom.monoms.length > 0 && e.multiply(n.polynom.monoms[0].coefficient), s;
2459
+ const r = n.polynom.display;
2460
+ return Object.hasOwn(s, r) ? s[r].push(n) : s[r] = [n], s;
2360
2461
  }, {});
2361
2462
  return e.isOne() || (t[e.display] = [new fe(e.display, 1)]), t;
2362
2463
  }
2363
- var k, Ie, Bt, Rt;
2364
- const Ge = class Ge {
2464
+ var z, Ce, Rt, zt;
2465
+ const He = class He {
2365
2466
  constructor(...e) {
2366
- d(this, k);
2467
+ d(this, z);
2367
2468
  // Determine the letters in the linear system, usually ['x', 'y']
2368
- d(this, Ie);
2369
- a(this, "parse", (...e) => (h(this, k, e.map((t) => new H(t))), i(this, Bt).call(this), this));
2370
- a(this, "clone", () => new Ge().parse(...i(this, k).map((e) => e.clone())));
2469
+ d(this, Ce);
2470
+ a(this, "parse", (...e) => (h(this, z, e.map((t) => new H(t))), i(this, Rt).call(this), this));
2471
+ a(this, "clone", () => new He().parse(...i(this, z).map((e) => e.clone())));
2371
2472
  a(this, "buildTex", (e, t) => {
2372
- let s, r, n = [];
2473
+ let s, n, r = [];
2373
2474
  const l = [];
2374
2475
  for (const f of e)
2375
- n = n.concat(f.letters());
2376
- n = [...new Set(n)], n.sort();
2476
+ r = r.concat(f.letters());
2477
+ r = [...new Set(r)], r.sort();
2377
2478
  for (let f = 0; f < e.length; f++) {
2378
- const p = e[f];
2479
+ const m = e[f];
2379
2480
  s = [];
2380
- for (const g of n)
2381
- r = p.left.monomByLetter(g), s.length === 0 ? s.push(r.isZero() ? "" : r.tex) : s.push(r.isZero() ? "" : (r.coefficient.sign() === 1 ? "+" : "") + r.tex);
2382
- if (s.push("="), s.push(p.right.tex), (t == null ? void 0 : t[f]) !== void 0) {
2481
+ for (const g of r)
2482
+ n = m.left.monomByLetter(g), s.length === 0 ? s.push(n.isZero() ? "" : n.tex) : s.push(n.isZero() ? "" : (n.coefficient.sign() === 1 ? "+" : "") + n.tex);
2483
+ if (s.push("="), s.push(m.right.tex), (t == null ? void 0 : t[f]) !== void 0) {
2383
2484
  s[s.length - 1] = s[s.length - 1] + " \\phantom{\\quad}";
2384
2485
  for (const g of t[f])
2385
2486
  s.push(`\\ \\cdot\\ ${g.startsWith("-") ? "\\left(" + g + "\\right)" : g}`);
@@ -2387,116 +2488,116 @@ const Ge = class Ge {
2387
2488
  l.push(s.join("&"));
2388
2489
  }
2389
2490
  let u = 0;
2390
- return t !== void 0 && t.length > 0 && (u = t[0].length), `\\left\\{\\begin{array}{${"r".repeat(n.length)}cl ${"|l".repeat(u)}}${l.join("\\\\ ")}\\end{array}\\right.`;
2491
+ return t !== void 0 && t.length > 0 && (u = t[0].length), `\\left\\{\\begin{array}{${"r".repeat(r.length)}cl ${"|l".repeat(u)}}${l.join("\\\\ ")}\\end{array}\\right.`;
2391
2492
  });
2392
- a(this, "mergeEquations", (e, t, s, r) => {
2393
- const n = e.clone().multiply(new c(s)), l = t.clone().multiply(new c(r));
2394
- return n.left.add(l.left), n.right.add(l.right), n;
2493
+ a(this, "mergeEquations", (e, t, s, n) => {
2494
+ const r = e.clone().multiply(new c(s)), l = t.clone().multiply(new c(n));
2495
+ return r.left.add(l.left), r.right.add(l.right), r;
2395
2496
  });
2396
2497
  // ------------------------------------------
2397
2498
  a(this, "reorder", () => {
2398
- for (const e of i(this, k))
2499
+ for (const e of i(this, z))
2399
2500
  e.reorder();
2400
2501
  return this;
2401
2502
  });
2402
2503
  a(this, "solveMatrix", () => {
2403
- const [e, t] = this.matrix, s = e.map((r, n) => [...r, t[n]]);
2404
- for (let r = 0; r < e.length; r++) {
2405
- const n = s[r][r].clone();
2406
- s[r] = s[r].map((l) => l.divide(n));
2504
+ const [e, t] = this.matrix, s = e.map((n, r) => [...n, t[r]]);
2505
+ for (let n = 0; n < e.length; n++) {
2506
+ const r = s[n][n].clone();
2507
+ s[n] = s[n].map((l) => l.divide(r));
2407
2508
  for (let l = 0; l < e.length; l++) {
2408
- if (l === r)
2509
+ if (l === n)
2409
2510
  continue;
2410
- const u = s[l][r].clone().opposite();
2511
+ const u = s[l][n].clone().opposite();
2411
2512
  for (let f = 0; f < s[l].length; f++)
2412
- s[l][f].add(s[r][f].clone().multiply(u));
2513
+ s[l][f].add(s[n][f].clone().multiply(u));
2413
2514
  if (s[l].slice(0, s[l].length - 1).every((f) => f.isZero()))
2414
2515
  return s[l][s[l].length - 1].isZero() ? [new c().infinite()] : [];
2415
2516
  }
2416
2517
  }
2417
- return s.map((r) => r[r.length - 1]);
2518
+ return s.map((n) => n[n.length - 1]);
2418
2519
  });
2419
- d(this, Bt, () => (h(this, Ie, i(this, k).reduce((e, t) => [.../* @__PURE__ */ new Set([...e, ...t.variables])], [])), i(this, Ie).sort(), this));
2420
- d(this, Rt, () => {
2520
+ d(this, Rt, () => (h(this, Ce, i(this, z).reduce((e, t) => [.../* @__PURE__ */ new Set([...e, ...t.variables])], [])), i(this, Ce).sort(), this));
2521
+ d(this, zt, () => {
2421
2522
  const e = [], t = [];
2422
- for (const s of i(this, k)) {
2423
- const r = [], n = s.clone().reorder();
2523
+ for (const s of i(this, z)) {
2524
+ const n = [], r = s.clone().reorder();
2424
2525
  for (const l of this.variables) {
2425
- const u = n.left.monomByLetter(l);
2426
- r.push(u.coefficient);
2526
+ const u = r.left.monomByLetter(l);
2527
+ n.push(u.coefficient);
2427
2528
  }
2428
- t.push(n.right.monoms[0].coefficient), e.push(r);
2529
+ t.push(r.right.monoms[0].coefficient), e.push(n);
2429
2530
  }
2430
2531
  return [e, t];
2431
2532
  });
2432
- return h(this, k, []), h(this, Ie, []), e.length > 0 && this.parse(...e), this;
2533
+ return h(this, z, []), h(this, Ce, []), e.length > 0 && this.parse(...e), this;
2433
2534
  }
2434
2535
  static fromMatrix(e, t = "xyz") {
2435
2536
  const s = e[0].length;
2436
- if (e.some((n) => n.length !== s))
2537
+ if (e.some((r) => r.length !== s))
2437
2538
  throw new Error("All rows must have the same number of columns");
2438
- const r = t.split("").splice(0, s - 1);
2439
- return new Ge(
2440
- ...e.map((n) => {
2441
- const l = new T(r.join(""), ...n);
2539
+ const n = t.split("").splice(0, s - 1);
2540
+ return new He(
2541
+ ...e.map((r) => {
2542
+ const l = new O(n.join(""), ...r);
2442
2543
  return new H(l, 0);
2443
2544
  })
2444
2545
  );
2445
2546
  }
2446
2547
  add(e, t) {
2447
- if (e instanceof Ge) {
2548
+ if (e instanceof He) {
2448
2549
  const s = e.equations.length;
2449
- if (s !== i(this, k).length)
2550
+ if (s !== i(this, z).length)
2450
2551
  throw new Error("The number of equations must be the same");
2451
- for (let r = 0; r < s; r++)
2452
- i(this, k)[r].add(e.equations[r]);
2552
+ for (let n = 0; n < s; n++)
2553
+ i(this, z)[n].add(e.equations[n]);
2453
2554
  } else {
2454
- if (t === void 0 || t < 0 || t >= i(this, k).length)
2555
+ if (t === void 0 || t < 0 || t >= i(this, z).length)
2455
2556
  throw new Error("Index out of range");
2456
2557
  const s = new H(e);
2457
- i(this, k)[t].add(s);
2558
+ i(this, z)[t].add(s);
2458
2559
  }
2459
2560
  return this;
2460
2561
  }
2461
2562
  degree(e) {
2462
- return c.max(...i(this, k).map((t) => t.degree(e)));
2563
+ return c.max(...i(this, z).map((t) => t.degree(e)));
2463
2564
  }
2464
2565
  get display() {
2465
2566
  return this.tex + "as display";
2466
2567
  }
2467
2568
  // ------------------------------------------
2468
2569
  get equations() {
2469
- return i(this, k);
2570
+ return i(this, z);
2470
2571
  }
2471
2572
  set equations(e) {
2472
- h(this, k, e);
2573
+ h(this, z, e);
2473
2574
  }
2474
2575
  evaluate(e, t) {
2475
2576
  throw new Error("Method not implemented.");
2476
2577
  }
2477
2578
  hasVariable(e) {
2478
- return i(this, Ie).includes(e);
2579
+ return i(this, Ce).includes(e);
2479
2580
  }
2480
2581
  isEqual(e) {
2481
2582
  return this.equations.every((t, s) => t.isEqual(e.equations[s]));
2482
2583
  }
2483
2584
  get isSolvable() {
2484
- return this.variables.length === i(this, k).length;
2585
+ return this.variables.length === i(this, z).length;
2485
2586
  }
2486
2587
  get matrix() {
2487
- return i(this, Rt).call(this);
2588
+ return i(this, zt).call(this);
2488
2589
  }
2489
2590
  multiply(e, t) {
2490
2591
  if (Array.isArray(e)) {
2491
- if (e.length !== i(this, k).length)
2592
+ if (e.length !== i(this, z).length)
2492
2593
  throw new Error("The number of values must be the same as the number of equations");
2493
2594
  for (let s = 0; s < e.length; s++)
2494
- i(this, k)[s].multiply(e[s]);
2595
+ i(this, z)[s].multiply(e[s]);
2495
2596
  return this;
2496
2597
  }
2497
- if (t === void 0 || t < 0 || t >= i(this, k).length)
2598
+ if (t === void 0 || t < 0 || t >= i(this, z).length)
2498
2599
  throw new Error("Index out of range");
2499
- return i(this, k)[t].multiply(e), this;
2600
+ return i(this, z)[t].multiply(e), this;
2500
2601
  }
2501
2602
  reduce() {
2502
2603
  throw new Error("Method not implemented.");
@@ -2505,17 +2606,17 @@ const Ge = class Ge {
2505
2606
  return [];
2506
2607
  }
2507
2608
  subtract(e, t) {
2508
- if (e instanceof Ge) {
2609
+ if (e instanceof He) {
2509
2610
  const s = e.equations.length;
2510
- if (s !== i(this, k).length)
2611
+ if (s !== i(this, z).length)
2511
2612
  throw new Error("The number of equations must be the same");
2512
- for (let r = 0; r < s; r++)
2513
- i(this, k)[r].subtract(e.equations[r]);
2613
+ for (let n = 0; n < s; n++)
2614
+ i(this, z)[n].subtract(e.equations[n]);
2514
2615
  } else {
2515
- if (t === void 0 || t < 0 || t >= i(this, k).length)
2616
+ if (t === void 0 || t < 0 || t >= i(this, z).length)
2516
2617
  throw new Error("Index out of range");
2517
2618
  const s = new H(e);
2518
- i(this, k)[t].subtract(s);
2619
+ i(this, z)[t].subtract(s);
2519
2620
  }
2520
2621
  return this;
2521
2622
  }
@@ -2524,35 +2625,35 @@ const Ge = class Ge {
2524
2625
  return this.buildTex(e.equations);
2525
2626
  }
2526
2627
  get variables() {
2527
- return i(this, Ie);
2628
+ return i(this, Ce);
2528
2629
  }
2529
2630
  set variables(e) {
2530
2631
  const t = typeof e == "string" ? e.split("") : [...e];
2531
- t.sort(), h(this, Ie, t);
2632
+ t.sort(), h(this, Ce, t);
2532
2633
  }
2533
2634
  };
2534
- k = new WeakMap(), Ie = new WeakMap(), Bt = new WeakMap(), Rt = new WeakMap();
2535
- let Yt = Ge;
2536
- function Vi(o, e) {
2635
+ z = new WeakMap(), Ce = new WeakMap(), Rt = new WeakMap(), zt = new WeakMap();
2636
+ let _t = He;
2637
+ function Xi(o, e) {
2537
2638
  return o.dimension === e.dimension && o.array.every(
2538
2639
  (t, s) => e.array[s].isEqual(t)
2539
2640
  );
2540
2641
  }
2541
- function Fi(o, e) {
2642
+ function Yi(o, e) {
2542
2643
  if (o.dimension !== e.dimension)
2543
2644
  return !1;
2544
2645
  const t = e.array[0].value / o.array[0].value;
2545
2646
  return o.array.every(
2546
- (s, r) => e.array[r].value === s.value * t
2647
+ (s, n) => e.array[n].value === s.value * t
2547
2648
  );
2548
2649
  }
2549
- function ji(o, e) {
2650
+ function Qi(o, e) {
2550
2651
  return o.dimension !== e.dimension ? new c().invalid() : o.array.reduce(
2551
- (t, s, r) => t.add(s.clone().multiply(e.array[r])),
2652
+ (t, s, n) => t.add(s.clone().multiply(e.array[n])),
2552
2653
  new c(0)
2553
2654
  );
2554
2655
  }
2555
- function Ui(...o) {
2656
+ function Ki(...o) {
2556
2657
  return o.some((e) => e.dimension !== o[0].dimension) ? new c().invalid() : o[0].dimension === 2 && o.length !== 2 ? new c().invalid() : o[0].dimension === 3 && o.length !== 3 ? new c().invalid() : o[0].dimension === 2 ? o[0].array[0].clone().multiply(o[1].array[1]).subtract(o[0].array[1].clone().multiply(o[1].array[0])) : o[0].array[0].clone().multiply(
2557
2658
  o[1].array[1].clone().multiply(o[2].array[2]).subtract(o[1].array[2].clone().multiply(o[2].array[1]))
2558
2659
  ).subtract(
@@ -2561,29 +2662,29 @@ function Ui(...o) {
2561
2662
  )
2562
2663
  ).add(o[0].array[2].clone().multiply(o[1].array[0].clone().multiply(o[2].array[1]).subtract(o[1].array[1].clone().multiply(o[2].array[0]))));
2563
2664
  }
2564
- var V, ze;
2565
- const Se = class Se {
2665
+ var Z, ze;
2666
+ const Be = class Be {
2566
2667
  constructor(...e) {
2567
- d(this, V, []);
2668
+ d(this, Z, []);
2568
2669
  d(this, ze, !1);
2569
- a(this, "zero", () => (i(this, V).forEach((e) => e.zero()), this));
2670
+ a(this, "zero", () => (i(this, Z).forEach((e) => e.zero()), this));
2570
2671
  a(this, "one", () => (this.zero(), this.x.one(), this));
2571
- a(this, "opposite", () => (i(this, V).forEach((e) => e.opposite()), this));
2572
- a(this, "add", (e) => (i(this, V).forEach((t, s) => t.add(e.array[s])), this));
2672
+ a(this, "opposite", () => (i(this, Z).forEach((e) => e.opposite()), this));
2673
+ a(this, "add", (e) => (i(this, Z).forEach((t, s) => t.add(e.array[s])), this));
2573
2674
  a(this, "subtract", (e) => this.add(e.clone().opposite()));
2574
2675
  a(this, "unit", () => {
2575
2676
  const e = this.norm;
2576
2677
  return e === 0 ? this : this.divideByScalar(e);
2577
2678
  });
2578
- a(this, "dot", (e) => ji(this, e));
2679
+ a(this, "dot", (e) => Qi(this, e));
2579
2680
  a(this, "normal", () => {
2580
2681
  if (this.dimension >= 3)
2581
2682
  throw new Error("Normal vector can only be determined in 2D");
2582
2683
  const e = this.x.clone().opposite(), t = this.y.clone();
2583
- return i(this, V)[0] = t, i(this, V)[1] = e, this;
2684
+ return i(this, Z)[0] = t, i(this, Z)[1] = e, this;
2584
2685
  });
2585
- a(this, "isEqual", (e) => Vi(this, e));
2586
- a(this, "isColinearTo", (e) => Fi(this, e));
2686
+ a(this, "isEqual", (e) => Xi(this, e));
2687
+ a(this, "isColinearTo", (e) => Yi(this, e));
2587
2688
  a(this, "isNormalTo", (e) => this.dot(e).isZero());
2588
2689
  a(this, "multiplyByScalar", (e) => {
2589
2690
  const t = new c(e);
@@ -2598,13 +2699,13 @@ const Se = class Se {
2598
2699
  this.x.isNegative() ? -1 : 1
2599
2700
  ));
2600
2701
  a(this, "angle", (e, t, s) => {
2601
- let r = this.dot(e).value;
2602
- return t && (r = Math.abs(r)), (s ? 1 : 180 / Math.PI) * Math.acos(r / (this.norm * e.norm));
2702
+ let n = this.dot(e).value;
2703
+ return t && (n = Math.abs(n)), (s ? 1 : 180 / Math.PI) * Math.acos(n / (this.norm * e.norm));
2603
2704
  });
2604
2705
  a(this, "fromString", (e) => {
2605
2706
  e.startsWith("(") && (e = e.substring(1)), e.endsWith(")") && (e = e.substring(0, e.length - 1));
2606
2707
  const t = e.split(/[,;\s]/g).filter((s) => s.trim() !== "");
2607
- return t.length < 2 ? this : (h(this, V, t.map((s) => new c(s))), this);
2708
+ return t.length < 2 ? this : (h(this, Z, t.map((s) => new c(s))), this);
2608
2709
  });
2609
2710
  e.length > 0 && this.parse(...e);
2610
2711
  }
@@ -2612,32 +2713,32 @@ const Se = class Se {
2612
2713
  // Getter and setter
2613
2714
  // ------------------------------------------
2614
2715
  get array() {
2615
- return i(this, V);
2716
+ return i(this, Z);
2616
2717
  }
2617
2718
  set array(e) {
2618
- h(this, V, e);
2719
+ h(this, Z, e);
2619
2720
  }
2620
2721
  get x() {
2621
- return i(this, V)[0];
2722
+ return i(this, Z)[0];
2622
2723
  }
2623
2724
  set x(e) {
2624
- i(this, V)[0] = new c(e);
2725
+ i(this, Z)[0] = new c(e);
2625
2726
  }
2626
2727
  get y() {
2627
- return i(this, V)[1];
2728
+ return i(this, Z)[1];
2628
2729
  }
2629
2730
  set y(e) {
2630
- i(this, V)[1] = new c(e);
2731
+ i(this, Z)[1] = new c(e);
2631
2732
  }
2632
2733
  get z() {
2633
2734
  if (this.dimension < 3)
2634
2735
  throw new Error("Vector is not 3D");
2635
- return i(this, V)[2];
2736
+ return i(this, Z)[2];
2636
2737
  }
2637
2738
  set z(e) {
2638
2739
  if (this.dimension < 3)
2639
2740
  throw new Error("Vector is not 3D");
2640
- i(this, V)[2] = new c(e);
2741
+ i(this, Z)[2] = new c(e);
2641
2742
  }
2642
2743
  get asPoint() {
2643
2744
  return i(this, ze);
@@ -2661,10 +2762,10 @@ const Se = class Se {
2661
2762
  if (e < 2)
2662
2763
  throw new Error("Dimension must be at least 2");
2663
2764
  if (e < this.dimension)
2664
- h(this, V, i(this, V).slice(0, e));
2765
+ h(this, Z, i(this, Z).slice(0, e));
2665
2766
  else if (e > this.dimension)
2666
2767
  for (let t = this.dimension; t < e; t++)
2667
- i(this, V).push(new c(0));
2768
+ i(this, Z).push(new c(0));
2668
2769
  return this;
2669
2770
  }
2670
2771
  get dimension() {
@@ -2689,7 +2790,7 @@ const Se = class Se {
2689
2790
  if (e.length === 0)
2690
2791
  throw new Error("Invalid value");
2691
2792
  if (e.length === 1) {
2692
- if (e[0] instanceof Se)
2793
+ if (e[0] instanceof Be)
2693
2794
  return e[0].clone();
2694
2795
  if (typeof e[0] == "string")
2695
2796
  return this.fromString(e[0]);
@@ -2697,26 +2798,26 @@ const Se = class Se {
2697
2798
  }
2698
2799
  if (e.length === 2) {
2699
2800
  const [t, s] = e;
2700
- if (t instanceof Se && s instanceof Se) {
2801
+ if (t instanceof Be && s instanceof Be) {
2701
2802
  if (t.dimension !== s.dimension)
2702
2803
  throw new Error("Vectors must have the same dimension");
2703
- return h(this, V, s.array.map((r, n) => r.clone().subtract(t.array[n]))), this;
2804
+ return h(this, Z, s.array.map((n, r) => n.clone().subtract(t.array[r]))), this;
2704
2805
  }
2705
2806
  }
2706
- return h(this, V, e.map((t) => new c(t))), this;
2807
+ return h(this, Z, e.map((t) => new c(t))), this;
2707
2808
  }
2708
2809
  clone() {
2709
- const e = new Se();
2810
+ const e = new Be();
2710
2811
  return e.array = this.copy(), e.asPoint = this.asPoint, e;
2711
2812
  }
2712
2813
  copy() {
2713
- return i(this, V).map((e) => e.clone());
2814
+ return i(this, Z).map((e) => e.clone());
2714
2815
  }
2715
2816
  middleOf(e, t) {
2716
2817
  if (e.dimension !== t.dimension)
2717
2818
  throw new Error("Vectors must be the same dimension");
2718
- return this.array = [], e.array.forEach((s, r) => {
2719
- this.array.push(s.clone().add(t.array[r]).divide(2));
2819
+ return this.array = [], e.array.forEach((s, n) => {
2820
+ this.array.push(s.clone().add(t.array[n]).divide(2));
2720
2821
  }), this;
2721
2822
  }
2722
2823
  translate(...e) {
@@ -2725,7 +2826,7 @@ const Se = class Se {
2725
2826
  cross(e) {
2726
2827
  if (this.dimension !== 3 || e.dimension !== 3)
2727
2828
  throw new Error("Cross product can only be determined in 3D");
2728
- return new Se(
2829
+ return new Be(
2729
2830
  this.y.clone().multiply(e.z).subtract(this.z.clone().multiply(e.y)),
2730
2831
  this.z.clone().multiply(e.x).subtract(this.x.clone().multiply(e.z)),
2731
2832
  this.x.clone().multiply(e.y).subtract(this.y.clone().multiply(e.x))
@@ -2738,7 +2839,7 @@ const Se = class Se {
2738
2839
  return this.array.every((e, t) => t === 0 ? e.isOne() : e.isZero());
2739
2840
  }
2740
2841
  distanceTo(e) {
2741
- const t = new Se(this, e);
2842
+ const t = new Be(this, e);
2742
2843
  return {
2743
2844
  value: t.norm,
2744
2845
  fraction: t.normSquare,
@@ -2746,9 +2847,9 @@ const Se = class Se {
2746
2847
  };
2747
2848
  }
2748
2849
  };
2749
- V = new WeakMap(), ze = new WeakMap();
2750
- let x = Se;
2751
- function mi(o = 0.5) {
2850
+ Z = new WeakMap(), ze = new WeakMap();
2851
+ let x = Be;
2852
+ function vi(o = 0.5) {
2752
2853
  return Math.random() < o;
2753
2854
  }
2754
2855
  function de(o, e, t) {
@@ -2766,23 +2867,23 @@ function de(o, e, t) {
2766
2867
  return s;
2767
2868
  }
2768
2869
  function X(o, e) {
2769
- return e === !1 ? mi() ? de(1, o) : -de(1, o) : de(-o, o);
2870
+ return e === !1 ? vi() ? de(1, o) : -de(1, o) : de(-o, o);
2770
2871
  }
2771
- function Gi(o) {
2872
+ function Ji(o) {
2772
2873
  let e = G.primes();
2773
- return o !== void 0 && (e = e.filter((t) => t < o)), ei(e);
2874
+ return o !== void 0 && (e = e.filter((t) => t < o)), oi(e);
2774
2875
  }
2775
- function Wi(o, e) {
2776
- return e === void 0 && (e = 1), o.length <= 0 ? Object.values(o) : gi(o).slice(0, e);
2876
+ function _i(o, e) {
2877
+ return e === void 0 && (e = 1), o.length <= 0 ? Object.values(o) : bi(o).slice(0, e);
2777
2878
  }
2778
- function ei(o) {
2879
+ function oi(o) {
2779
2880
  return o.length === 0 ? null : o[de(0, o.length - 1)];
2780
2881
  }
2781
- function gi(o) {
2882
+ function bi(o) {
2782
2883
  const e = Object.values(o);
2783
2884
  for (let t = e.length - 1; t > 0; t--) {
2784
- const s = Math.floor(Math.random() * (t + 1)), r = e[t];
2785
- e[t] = e[s], e[s] = r;
2885
+ const s = Math.floor(Math.random() * (t + 1)), n = e[t];
2886
+ e[t] = e[s], e[s] = n;
2786
2887
  }
2787
2888
  return e;
2788
2889
  }
@@ -2812,24 +2913,24 @@ class j extends x {
2812
2913
  return e.array = this.copy(), e.asPoint = !0, e;
2813
2914
  }
2814
2915
  }
2815
- var yi = /* @__PURE__ */ ((o) => (o.None = "none", o.Parallel = "parallel", o.Perpendicular = "perpendicular", o.Tangent = "tangent", o))(yi || {}), Ce, B, R, U, ne, Y, $e, ve;
2816
- const Le = class Le {
2916
+ var xi = /* @__PURE__ */ ((o) => (o.None = "none", o.Parallel = "parallel", o.Perpendicular = "perpendicular", o.Tangent = "tangent", o))(xi || {}), $e, B, S, U, re, Y, Ie, ve;
2917
+ const De = class De {
2817
2918
  /**
2818
2919
  * Value can be a mix of:
2819
2920
  *
2820
2921
  * @param values
2821
2922
  */
2822
2923
  constructor(...e) {
2823
- d(this, Ce);
2924
+ d(this, $e);
2824
2925
  // ax + by + c = 0
2825
2926
  d(this, B);
2826
- d(this, R);
2927
+ d(this, S);
2827
2928
  d(this, U);
2828
- d(this, ne);
2929
+ d(this, re);
2829
2930
  d(this, Y);
2830
- d(this, $e);
2931
+ d(this, Ie);
2831
2932
  d(this, ve, "canonical");
2832
- a(this, "randomPoint", (e) => i(this, Y).clone().multiplyByScalar(X(e === void 0 || e <= 1 ? 3 : e, !1)).add(i(this, ne)));
2933
+ a(this, "randomPoint", (e) => i(this, Y).clone().multiplyByScalar(X(e === void 0 || e <= 1 ? 3 : e, !1)).add(i(this, re)));
2833
2934
  a(this, "randomNearPoint", (e) => {
2834
2935
  const t = this.randomPoint(e);
2835
2936
  let s = 10;
@@ -2849,8 +2950,8 @@ const Le = class Le {
2849
2950
  if (e.length === 0)
2850
2951
  return this;
2851
2952
  if (e.length === 1) {
2852
- if (e[0] instanceof Le)
2853
- return e[0].clone();
2953
+ if (e[0] instanceof De)
2954
+ return this.fromCoefficient(e[0].a, e[0].b, e[0].c);
2854
2955
  if (e[0] instanceof H)
2855
2956
  return this.fromEquation(e[0]);
2856
2957
  if (typeof e[0] == "string")
@@ -2875,7 +2976,7 @@ const Le = class Le {
2875
2976
  if (e[2] === "parallel")
2876
2977
  return this.fromPointAndDirection(e[0], e[1]);
2877
2978
  }
2878
- return e[0] instanceof x && e[1] instanceof Le ? e[2] === "parallel" || e[2] === null ? this.fromPointAndLine(
2979
+ return e[0] instanceof x && e[1] instanceof De ? e[2] === "parallel" || e[2] === null ? this.fromPointAndLine(
2879
2980
  e[0],
2880
2981
  e[1],
2881
2982
  "parallel"
@@ -2891,7 +2992,7 @@ const Le = class Le {
2891
2992
  e[2]
2892
2993
  );
2893
2994
  }
2894
- return console.log("Something wrong happened while creating the line"), this;
2995
+ return console.log("Something wrong happened while creating the line"), console.log(e), this;
2895
2996
  });
2896
2997
  a(this, "fromEquation", (e) => {
2897
2998
  e.reorder(!0);
@@ -2900,48 +3001,52 @@ const Le = class Le {
2900
3001
  return this;
2901
3002
  for (const s of ["x", "y"])
2902
3003
  t.has(s) && t.delete(s);
2903
- return t.size > 0 ? this : this.fromCoefficient(e.left.monomByLetter("x").coefficient, e.left.monomByLetter("y").coefficient, e.left.monomByDegree(0).coefficient);
3004
+ return t.size > 0 ? this : this.fromCoefficient(
3005
+ e.left.monomByLetter("x").coefficient,
3006
+ e.left.monomByLetter("y").coefficient,
3007
+ e.left.monomByDegree(0).coefficient
3008
+ );
2904
3009
  });
2905
- a(this, "fromCoefficient", (e, t, s) => (h(this, B, new c(e)), h(this, R, new c(t)), h(this, U, new c(s)), h(this, Y, new x(i(this, R).clone(), i(this, B).clone().opposite())), h(this, ne, new x(new c().zero(), i(this, U).clone())), h(this, $e, i(this, Y).clone().normal()), this));
3010
+ a(this, "fromCoefficient", (e, t, s) => (h(this, B, new c(e)), h(this, S, new c(t)), h(this, U, new c(s)), h(this, Y, new x(i(this, S).clone(), i(this, B).clone().opposite())), h(this, re, new x(new c().zero(), i(this, U).clone())), h(this, Ie, i(this, Y).clone().normal()), this));
2906
3011
  a(this, "fromPointAndDirection", (e, t) => (this.fromCoefficient(
2907
3012
  t.y,
2908
3013
  t.x.clone().opposite(),
2909
3014
  e.x.clone().multiply(t.y).subtract(e.y.clone().multiply(t.x)).opposite()
2910
- ), h(this, ne, e.clone()), h(this, Y, t.clone()), h(this, $e, i(this, Y).clone().normal()), this));
3015
+ ), h(this, re, e.clone()), h(this, Y, t.clone()), h(this, Ie, i(this, Y).clone().normal()), this));
2911
3016
  a(this, "fromPointAndNormal", (e, t) => this.fromCoefficient(
2912
3017
  t.x,
2913
3018
  t.y,
2914
3019
  e.x.clone().multiply(t.x).add(e.y.clone().multiply(t.y)).opposite()
2915
3020
  ));
2916
3021
  a(this, "fromPointAndLine", (e, t, s) => (s === void 0 && (s = "parallel"), s === "parallel" ? this.fromPointAndNormal(e, t.normal) : s === "perpendicular" ? this.fromPointAndNormal(e, t.director) : this));
2917
- a(this, "clone", () => (h(this, B, i(this, B).clone()), h(this, R, i(this, R).clone()), h(this, U, i(this, U).clone()), h(this, Y, i(this, Y).clone()), h(this, ne, i(this, ne).clone()), h(this, $e, i(this, $e).clone()), this));
3022
+ a(this, "clone", () => (h(this, B, i(this, B).clone()), h(this, S, i(this, S).clone()), h(this, U, i(this, U).clone()), h(this, Y, i(this, Y).clone()), h(this, re, i(this, re).clone()), h(this, Ie, i(this, Ie).clone()), this));
2918
3023
  // ------------------------------------------
2919
3024
  // Mathematical operations
2920
3025
  // ------------------------------------------
2921
3026
  a(this, "isOnLine", (e) => i(this, B).clone().multiply(e.x).add(
2922
- i(this, R).clone().multiply(e.y)
3027
+ i(this, S).clone().multiply(e.y)
2923
3028
  ).add(i(this, U)).isZero());
2924
3029
  a(this, "isParallelTo", (e) => this.slope.isEqual(e.slope) && this.height.isNotEqual(e.height));
2925
3030
  a(this, "isSameAs", (e) => this.slope.isEqual(e.slope) && this.height.isEqual(e.height));
2926
3031
  a(this, "isPerpendicularTo", (e) => this.d.isNormalTo(e.d));
2927
3032
  a(this, "isVertical", () => this.slope.isInfinity());
2928
3033
  a(this, "simplify", () => {
2929
- const e = G.lcm(i(this, B).denominator, i(this, R).denominator, i(this, U).denominator), t = G.gcd(i(this, B).numerator, i(this, R).numerator, i(this, U).numerator);
3034
+ const e = G.lcm(i(this, B).denominator, i(this, S).denominator, i(this, U).denominator), t = G.gcd(i(this, B).numerator, i(this, S).numerator, i(this, U).numerator);
2930
3035
  return this.fromCoefficient(
2931
3036
  i(this, B).clone().multiply(e).divide(t),
2932
- i(this, R).clone().multiply(e).divide(t),
3037
+ i(this, S).clone().multiply(e).divide(t),
2933
3038
  i(this, U).clone().multiply(e).divide(t)
2934
3039
  ), this;
2935
3040
  });
2936
3041
  a(this, "simplifyDirection", () => (i(this, Y).simplify(), this));
2937
3042
  a(this, "intersection", (e) => {
2938
3043
  const t = new x();
2939
- let s = !1, r = !1;
2940
- return i(this, R).isZero() || e.b.isZero(), this.isParallelTo(e) ? (t.x = new c().invalid(), t.y = new c().invalid(), s = !0) : this.isSameAs(e) ? (t.x = new c().invalid(), t.y = new c().invalid(), r = !0) : (t.x = i(this, R).clone().multiply(e.c).subtract(i(this, U).clone().multiply(e.b)).divide(i(this, B).clone().multiply(e.b).subtract(i(this, R).clone().multiply(e.a))), t.y = i(this, B).clone().multiply(e.c).subtract(i(this, U).clone().multiply(e.a)).divide(i(this, R).clone().multiply(e.a).subtract(i(this, B).clone().multiply(e.b)))), {
3044
+ let s = !1, n = !1;
3045
+ return i(this, S).isZero() || e.b.isZero(), this.isParallelTo(e) ? (t.x = new c().invalid(), t.y = new c().invalid(), s = !0) : this.isSameAs(e) ? (t.x = new c().invalid(), t.y = new c().invalid(), n = !0) : (t.x = i(this, S).clone().multiply(e.c).subtract(i(this, U).clone().multiply(e.b)).divide(i(this, B).clone().multiply(e.b).subtract(i(this, S).clone().multiply(e.a))), t.y = i(this, B).clone().multiply(e.c).subtract(i(this, U).clone().multiply(e.a)).divide(i(this, S).clone().multiply(e.a).subtract(i(this, B).clone().multiply(e.b)))), {
2941
3046
  point: t,
2942
- hasIntersection: !(s || r),
3047
+ hasIntersection: !(s || n),
2943
3048
  isParallel: s,
2944
- isSame: r
3049
+ isSame: n
2945
3050
  };
2946
3051
  });
2947
3052
  a(this, "getValueAtX", (e) => {
@@ -2952,7 +3057,7 @@ const Le = class Le {
2952
3057
  const t = this.getEquation().isolate("x"), s = new c(e);
2953
3058
  return t instanceof H ? t.right.evaluate({ y: s }) : new c().invalid();
2954
3059
  });
2955
- return h(this, B, new c().zero()), h(this, R, new c().zero()), h(this, U, new c().zero()), h(this, ne, new x()), h(this, Y, new x()), h(this, $e, new x()), h(this, Ce, !0), e.length > 0 && this.parse(...e), this;
3060
+ return h(this, B, new c().zero()), h(this, S, new c().zero()), h(this, U, new c().zero()), h(this, re, new x()), h(this, Y, new x()), h(this, Ie, new x()), h(this, $e, !0), e.length > 0 && this.parse(...e), this;
2956
3061
  }
2957
3062
  get a() {
2958
3063
  return i(this, B);
@@ -2963,10 +3068,10 @@ const Le = class Le {
2963
3068
  h(this, B, e);
2964
3069
  }
2965
3070
  get b() {
2966
- return i(this, R);
3071
+ return i(this, S);
2967
3072
  }
2968
3073
  set b(e) {
2969
- h(this, R, e);
3074
+ h(this, S, e);
2970
3075
  }
2971
3076
  get c() {
2972
3077
  return i(this, U);
@@ -2975,10 +3080,10 @@ const Le = class Le {
2975
3080
  h(this, U, e);
2976
3081
  }
2977
3082
  get OA() {
2978
- return i(this, ne);
3083
+ return i(this, re);
2979
3084
  }
2980
3085
  set OA(e) {
2981
- h(this, ne, e);
3086
+ h(this, re, e);
2982
3087
  }
2983
3088
  get d() {
2984
3089
  return i(this, Y);
@@ -2987,12 +3092,12 @@ const Le = class Le {
2987
3092
  h(this, Y, e);
2988
3093
  }
2989
3094
  get n() {
2990
- return i(this, $e);
3095
+ return i(this, Ie);
2991
3096
  }
2992
3097
  // ------------------------------------------
2993
3098
  getEquation() {
2994
- const e = new H(new T().parse("xy", i(this, B), i(this, R), i(this, U)), new T("0"));
2995
- return i(this, Ce) ? e.simplify() : e;
3099
+ const e = new H(new O().parse("xy", i(this, B), i(this, S), i(this, U)), new O("0"));
3100
+ return i(this, $e) ? e.simplify() : e;
2996
3101
  }
2997
3102
  // get system(): { x: Equation, y: Equation } {
2998
3103
  // const e1 = new Equation(
@@ -3028,13 +3133,13 @@ const Le = class Le {
3028
3133
  case "equation":
3029
3134
  return this.getEquation().reorder().tex;
3030
3135
  case "mxh":
3031
- return this.slope.isInfinity() ? "x=" + this.OA.x.tex : "y=" + new T().parse("x", this.slope, this.height).tex;
3136
+ return this.slope.isInfinity() ? "x=" + this.OA.x.tex : "y=" + new O().parse("x", this.slope, this.height).tex;
3032
3137
  case "parametric":
3033
3138
  case "system": {
3034
3139
  const t = i(this, Y).clone();
3035
- return i(this, Ce) && t.simplify(), e === "parametric" ? `${x.asTex("x", "y")} = ${x.asTex(i(this, ne).x.tex, i(this, ne).y.tex)} + k\\cdot ${x.asTex(t.x.tex, t.y.tex)}` : `\\left\\{\\begin{aligned}
3036
- x &= ${new T(i(this, ne).x).add(new I(i(this, Y).x).multiply(new I("k"))).reorder("k", !0).tex}\\\\
3037
- y &= ${new T(i(this, ne).y).add(new I(i(this, Y).y).multiply(new I("k"))).reorder("k", !0).tex}
3140
+ return i(this, $e) && t.simplify(), e === "parametric" ? `${x.asTex("x", "y")} = ${x.asTex(i(this, re).x.tex, i(this, re).y.tex)} + k\\cdot ${x.asTex(t.x.tex, t.y.tex)}` : `\\left\\{\\begin{aligned}
3141
+ x &= ${new O(i(this, re).x).add(new k(i(this, Y).x).multiply(new k("k"))).reorder("k", !0).tex}\\\\
3142
+ y &= ${new O(i(this, re).y).add(new k(i(this, Y).y).multiply(new k("k"))).reorder("k", !0).tex}
3038
3143
  \\end{aligned}\\right.`;
3039
3144
  }
3040
3145
  default: {
@@ -3044,10 +3149,10 @@ const Le = class Le {
3044
3149
  }
3045
3150
  }
3046
3151
  get reduceBeforeDisplay() {
3047
- return i(this, Ce);
3152
+ return i(this, $e);
3048
3153
  }
3049
3154
  set reduceBeforeDisplay(e) {
3050
- h(this, Ce, e);
3155
+ h(this, $e, e);
3051
3156
  }
3052
3157
  get display() {
3053
3158
  const e = i(this, ve);
@@ -3055,10 +3160,10 @@ const Le = class Le {
3055
3160
  case "equation":
3056
3161
  return this.getEquation().reorder().display;
3057
3162
  case "mxh":
3058
- return this.slope.isInfinity() ? "x=" + this.OA.x.display : "y=" + new T().parse("x", this.slope, this.height).display;
3163
+ return this.slope.isInfinity() ? "x=" + this.OA.x.display : "y=" + new O().parse("x", this.slope, this.height).display;
3059
3164
  case "parametric": {
3060
3165
  const t = i(this, Y).clone();
3061
- return i(this, Ce) && t.simplify(), `((x,y))=((${i(this, ne).x.display},${i(this, ne).y.display}))+k((${t.x.display},${t.y.display}))`;
3166
+ return i(this, $e) && t.simplify(), `((x,y))=((${i(this, re).x.display},${i(this, re).y.display}))+k((${t.x.display},${t.y.display}))`;
3062
3167
  }
3063
3168
  default: {
3064
3169
  const t = this.getEquation();
@@ -3067,42 +3172,42 @@ const Le = class Le {
3067
3172
  }
3068
3173
  }
3069
3174
  get normal() {
3070
- return new x(i(this, B), i(this, R));
3175
+ return new x(i(this, B), i(this, S));
3071
3176
  }
3072
3177
  get director() {
3073
3178
  return i(this, Y).clone();
3074
3179
  }
3075
3180
  get slope() {
3076
- return i(this, B).clone().opposite().divide(i(this, R));
3181
+ return i(this, B).clone().opposite().divide(i(this, S));
3077
3182
  }
3078
3183
  get height() {
3079
- return i(this, U).clone().opposite().divide(i(this, R));
3184
+ return i(this, U).clone().opposite().divide(i(this, S));
3080
3185
  }
3081
3186
  fromPoints(e, t) {
3082
3187
  return this.fromPointAndDirection(e, new x(e, t));
3083
3188
  }
3084
3189
  distanceTo(e) {
3085
- const t = e.x.clone().multiply(i(this, B)).add(e.y.clone().multiply(i(this, R))).add(i(this, U)).abs(), s = this.normal.normSquare;
3190
+ const t = e.x.clone().multiply(i(this, B)).add(e.y.clone().multiply(i(this, S))).add(i(this, U)).abs(), s = this.normal.normSquare;
3086
3191
  if (s.isZero())
3087
3192
  return {
3088
3193
  value: NaN,
3089
3194
  tex: "Not a line",
3090
3195
  fraction: new c().infinite()
3091
3196
  };
3092
- const r = t.value / Math.sqrt(s.value), n = t.clone().divide(s.clone().sqrt());
3197
+ const n = t.value / Math.sqrt(s.value), r = t.clone().divide(s.clone().sqrt());
3093
3198
  return s.isSquare() ? {
3094
- value: r,
3095
- tex: n.tex,
3096
- fraction: n
3199
+ value: n,
3200
+ tex: r.tex,
3201
+ fraction: r
3097
3202
  } : {
3098
- value: r,
3203
+ value: n,
3099
3204
  tex: `\\frac{${t.tex}}{\\sqrt{${s.tex}}}`,
3100
- fraction: n
3205
+ fraction: r
3101
3206
  };
3102
3207
  }
3103
3208
  hitSegment(e, t) {
3104
3209
  const s = this.intersection(
3105
- new Le(e, t)
3210
+ new De().fromPoints(e, t)
3106
3211
  );
3107
3212
  return s.hasIntersection ? s.point.x.value >= Math.min(e.x.value, t.x.value) && s.point.x.value <= Math.max(e.x.value, t.x.value) && s.point.y.value >= Math.min(e.y.value, t.y.value) && s.point.y.value <= Math.max(e.y.value, t.y.value) : !1;
3108
3213
  }
@@ -3112,19 +3217,19 @@ const Le = class Le {
3112
3217
  canonicalAsFloatCoefficient(e) {
3113
3218
  e === void 0 && (e = 2);
3114
3219
  let t = "";
3115
- return i(this, B).isZero() || (i(this, B).isOne() ? t = "x" : i(this, B).clone().opposite().isOne() ? t = "-x" : t = i(this, B).value.toFixed(e) + "x"), i(this, R).isZero() || (i(this, R).isPositive() && (t += "+"), t += i(this, R).value.toFixed(e) + "y"), i(this, U).isZero() || (i(this, U).isPositive() && (t += "+"), t += i(this, U).value.toFixed(e)), t + "=0";
3220
+ return i(this, B).isZero() || (i(this, B).isOne() ? t = "x" : i(this, B).clone().opposite().isOne() ? t = "-x" : t = i(this, B).value.toFixed(e) + "x"), i(this, S).isZero() || (i(this, S).isPositive() && (t += "+"), t += i(this, S).value.toFixed(e) + "y"), i(this, U).isZero() || (i(this, U).isPositive() && (t += "+"), t += i(this, U).value.toFixed(e)), t + "=0";
3116
3221
  }
3117
3222
  };
3118
- Ce = new WeakMap(), B = new WeakMap(), R = new WeakMap(), U = new WeakMap(), ne = new WeakMap(), Y = new WeakMap(), $e = new WeakMap(), ve = new WeakMap(), // A line is defined as the canonical form
3119
- a(Le, "PERPENDICULAR", "perpendicular"), a(Le, "PARALLEL", "parallel");
3120
- let D = Le;
3121
- var oe, F, qe, zt, kt, Lt, he, wi, mt, vi, bi, xi, Qt;
3122
- const Dt = class Dt {
3223
+ $e = new WeakMap(), B = new WeakMap(), S = new WeakMap(), U = new WeakMap(), re = new WeakMap(), Y = new WeakMap(), Ie = new WeakMap(), ve = new WeakMap(), // A line is defined as the canonical form
3224
+ a(De, "PERPENDICULAR", "perpendicular"), a(De, "PARALLEL", "parallel");
3225
+ let D = De;
3226
+ var oe, F, Ae, Lt, Dt, Vt, he, Ei, yt, Ni, Ti, Ai, ei;
3227
+ const Zt = class Zt {
3123
3228
  constructor(...e) {
3124
3229
  d(this, he);
3125
3230
  d(this, oe);
3126
3231
  d(this, F);
3127
- d(this, qe);
3232
+ d(this, Ae);
3128
3233
  /**
3129
3234
  * Get the relative position between circle and line. It corresponds to the number of intersection.
3130
3235
  * @param {Line} L
@@ -3138,42 +3243,42 @@ const Dt = class Dt {
3138
3243
  });
3139
3244
  a(this, "lineIntersection", (e) => {
3140
3245
  const t = [];
3141
- if (i(this, qe) === void 0)
3246
+ if (i(this, Ae) === void 0)
3142
3247
  return [];
3143
- const s = i(this, qe).clone(), r = e.getEquation().clone().isolate("x"), n = e.getEquation().clone().isolate("y");
3144
- return r instanceof H && n instanceof H && (s.replaceBy("y", n.right).simplify(), s.solve()), t;
3248
+ const s = i(this, Ae).clone(), n = e.getEquation().clone().isolate("x"), r = e.getEquation().clone().isolate("y");
3249
+ return n instanceof H && r instanceof H && (s.replaceBy("y", r.right).simplify(), s.solve()), t;
3145
3250
  });
3146
- a(this, "tangents", (e) => e instanceof c ? i(this, Lt).call(this, e) : this.isPointOnCircle(e) ? i(this, zt).call(this, e) : i(this, oe) !== void 0 && i(this, oe).distanceTo(e).value > this.radius.value ? i(this, kt).call(this, e) : (console.log("No tangents as the point is inside !"), []));
3251
+ a(this, "tangents", (e) => e instanceof c ? i(this, Vt).call(this, e) : this.isPointOnCircle(e) ? i(this, Lt).call(this, e) : i(this, oe) !== void 0 && i(this, oe).distanceTo(e).value > this.radius.value ? i(this, Dt).call(this, e) : (console.log("No tangents as the point is inside !"), []));
3147
3252
  a(this, "isPointOnCircle", (e) => {
3148
3253
  var t;
3149
- return ((t = i(this, qe)) == null ? void 0 : t.test({ x: e.x, y: e.y })) ?? !1;
3254
+ return ((t = i(this, Ae)) == null ? void 0 : t.test({ x: e.x, y: e.y })) ?? !1;
3150
3255
  });
3151
3256
  a(this, "getPointsOnCircle", (e) => {
3152
3257
  const t = G.pythagoreanTripletsWithTarget(this.squareRadius.value, !0), s = [];
3153
- return t.forEach((r) => {
3154
- for (const n of [[1, 1], [-1, 1], [-1, -1], [1, -1]])
3258
+ return t.forEach((n) => {
3259
+ for (const r of [[1, 1], [-1, 1], [-1, -1], [1, -1]])
3155
3260
  s.push(
3156
3261
  new j(
3157
- this.center.x.clone().add(n[0] * r[0]),
3158
- this.center.y.clone().add(n[1] * r[1])
3262
+ this.center.x.clone().add(r[0] * n[0]),
3263
+ this.center.y.clone().add(r[1] * n[1])
3159
3264
  )
3160
3265
  );
3161
3266
  }), s;
3162
3267
  });
3163
- d(this, zt, (e) => {
3268
+ d(this, Lt, (e) => {
3164
3269
  const t = new x(this.center, e);
3165
- return [new D(e, t, yi.Perpendicular)];
3270
+ return [new D(e, t, xi.Perpendicular)];
3166
3271
  });
3167
- d(this, kt, (e) => {
3168
- const t = this.center.x.clone().subtract(e.x), s = this.center.y.clone().subtract(e.y), r = new T("x"), n = new T("x^2+1");
3169
- return r.multiply(t).subtract(s).pow(2), n.multiply(this.squareRadius), new H(r, n).solve().map((f) => {
3170
- let p;
3272
+ d(this, Dt, (e) => {
3273
+ const t = this.center.x.clone().subtract(e.x), s = this.center.y.clone().subtract(e.y), n = new O("x"), r = new O("x^2+1");
3274
+ return n.multiply(t).subtract(s).pow(2), r.multiply(this.squareRadius), new H(n, r).solve().map((f) => {
3275
+ let m;
3171
3276
  const g = new H("y", "x");
3172
- return f.exact instanceof c ? (p = e.x.clone().opposite().multiply(f.exact).add(e.y), g.right.multiply(f.exact).add(p)) : (p = e.x.clone().opposite().multiply(f.value).add(e.y), g.right.multiply(f.value).add(p)), new D(g);
3277
+ return f.exact instanceof c ? (m = e.x.clone().opposite().multiply(f.exact).add(e.y), g.right.multiply(f.exact).add(m)) : (m = e.x.clone().opposite().multiply(f.value).add(e.y), g.right.multiply(f.value).add(m)), new D(g);
3173
3278
  });
3174
3279
  });
3175
- d(this, Lt, (e) => {
3176
- const t = e.numerator, s = -e.denominator, r = this.center.x.clone(), n = this.center.y.clone(), l = this.squareRadius.clone().multiply(e.numerator ** 2 + e.denominator ** 2), u = r.clone().multiply(t).opposite().subtract(n.clone().multiply(s)).add(l.clone().sqrt()), f = r.clone().multiply(t).opposite().subtract(n.clone().multiply(s)).subtract(l.clone().sqrt());
3280
+ d(this, Vt, (e) => {
3281
+ const t = e.numerator, s = -e.denominator, n = this.center.x.clone(), r = this.center.y.clone(), l = this.squareRadius.clone().multiply(e.numerator ** 2 + e.denominator ** 2), u = n.clone().multiply(t).opposite().subtract(r.clone().multiply(s)).add(l.clone().sqrt()), f = n.clone().multiply(t).opposite().subtract(r.clone().multiply(s)).subtract(l.clone().sqrt());
3177
3282
  return [new D(t, s, u), new D(t, s, f)];
3178
3283
  });
3179
3284
  e.length > 0 && this.parse(...e);
@@ -3185,9 +3290,9 @@ const Dt = class Dt {
3185
3290
  return i(this, F) ?? new c(0);
3186
3291
  }
3187
3292
  get cartesian() {
3188
- if (i(this, qe) === void 0)
3293
+ if (i(this, Ae) === void 0)
3189
3294
  throw new Error("Cartesian equation not defined");
3190
- return i(this, qe);
3295
+ return i(this, Ae);
3191
3296
  }
3192
3297
  get radius() {
3193
3298
  return i(this, F) === void 0 ? { tex: "", display: "", value: 0 } : i(this, F).isSquare() ? {
@@ -3212,17 +3317,17 @@ const Dt = class Dt {
3212
3317
  return this.center.x.isZero() ? e = "x^2" : e = `(x${this.center.x.isNegative() ? "+" : "-"}${this.center.x.clone().abs().tex})^2`, this.center.y.isZero() ? t = "y^2" : t = `(y${this.center.y.isNegative() ? "+" : "-"}${this.center.y.clone().abs().tex})^2`, `${e}+${t}=${this.squareRadius.display}`;
3213
3318
  }
3214
3319
  clone() {
3215
- return new Dt(
3320
+ return new Zt(
3216
3321
  this.center.clone(),
3217
3322
  this.squareRadius.clone(),
3218
3323
  !0
3219
3324
  );
3220
3325
  }
3221
3326
  setRadius(e, t) {
3222
- return t ? h(this, F, new c(e)) : h(this, F, new c(e).pow(2)), M(this, he, mt).call(this), this;
3327
+ return t ? h(this, F, new c(e)) : h(this, F, new c(e).pow(2)), q(this, he, yt).call(this), this;
3223
3328
  }
3224
3329
  parse(...e) {
3225
- return M(this, he, wi).call(this), typeof e[0] == "string" ? M(this, he, Qt).call(this, new H(e[0])) : e[0] instanceof H ? M(this, he, Qt).call(this, e[0]) : e[0] instanceof Dt ? M(this, he, vi).call(this, e[0]) : e[0] instanceof j && e.length > 1 && (e[1] instanceof j ? e[2] instanceof j || M(this, he, xi).call(this, e[0], e[1]) : (e[1] instanceof c || typeof e[1] == "number") && M(this, he, bi).call(this, e[0], e[1], typeof e[2] == "boolean" ? e[2] : !1)), M(this, he, mt).call(this), this;
3330
+ return q(this, he, Ei).call(this), typeof e[0] == "string" ? q(this, he, ei).call(this, new H(e[0])) : e[0] instanceof H ? q(this, he, ei).call(this, e[0]) : e[0] instanceof Zt ? q(this, he, Ni).call(this, e[0]) : e[0] instanceof j && e.length > 1 && (e[1] instanceof j ? e[2] instanceof j || q(this, he, Ai).call(this, e[0], e[1]) : (e[1] instanceof c || typeof e[1] == "number") && q(this, he, Ti).call(this, e[0], e[1], typeof e[2] == "boolean" ? e[2] : !1)), q(this, he, yt).call(this), this;
3226
3331
  }
3227
3332
  // private _parseThroughtThreePoints(A: Point, B: Point, C: Point): this {
3228
3333
  // const T = new Triangle(A, B, C), mAB = T.remarquables.mediators.AB.clone(),
@@ -3231,37 +3336,37 @@ const Dt = class Dt {
3231
3336
  // return this
3232
3337
  // }
3233
3338
  };
3234
- oe = new WeakMap(), F = new WeakMap(), qe = new WeakMap(), zt = new WeakMap(), kt = new WeakMap(), Lt = new WeakMap(), he = new WeakSet(), wi = function() {
3235
- return h(this, oe, void 0), h(this, F, void 0), h(this, qe, void 0), this;
3236
- }, mt = function() {
3237
- h(this, qe, new H(
3238
- new T(`(x-(${this.center.x.display}))^2+(y-(${this.center.y.display}))^2`),
3239
- new T(this.squareRadius.display)
3339
+ oe = new WeakMap(), F = new WeakMap(), Ae = new WeakMap(), Lt = new WeakMap(), Dt = new WeakMap(), Vt = new WeakMap(), he = new WeakSet(), Ei = function() {
3340
+ return h(this, oe, void 0), h(this, F, void 0), h(this, Ae, void 0), this;
3341
+ }, yt = function() {
3342
+ h(this, Ae, new H(
3343
+ new O(`(x-(${this.center.x.display}))^2+(y-(${this.center.y.display}))^2`),
3344
+ new O(this.squareRadius.display)
3240
3345
  ).moveLeft());
3241
- }, vi = function(e) {
3242
- return h(this, oe, e.center.clone()), h(this, F, e.squareRadius.clone()), M(this, he, mt).call(this), this;
3243
- }, bi = function(e, t, s) {
3346
+ }, Ni = function(e) {
3347
+ return h(this, oe, e.center.clone()), h(this, F, e.squareRadius.clone()), q(this, he, yt).call(this), this;
3348
+ }, Ti = function(e, t, s) {
3244
3349
  return h(this, oe, e.clone()), s ? h(this, F, new c(t)) : h(this, F, new c(t).pow(2)), this;
3245
- }, xi = function(e, t) {
3350
+ }, Ai = function(e, t) {
3246
3351
  return h(this, oe, e.clone()), h(this, F, new x(i(this, oe), t).normSquare), this;
3247
- }, Qt = function(e) {
3352
+ }, ei = function(e) {
3248
3353
  if (e.moveLeft(), e.degree("x").value === 2 && e.degree("y").value === 2) {
3249
3354
  const t = e.left.monomByDegree(2, "x"), s = e.left.monomByDegree(2, "y");
3250
- let r, n, l;
3251
- t.coefficient.isEqual(s.coefficient) ? (e.divide(t.coefficient), r = e.left.monomByDegree(1, "x"), n = e.left.monomByDegree(1, "y"), l = e.left.monomByDegree(0), h(this, oe, new j(r.coefficient.clone().divide(2).opposite(), n.coefficient.clone().divide(2).opposite())), h(this, F, l.coefficient.clone().opposite().add(i(this, oe).x.clone().pow(2)).add(i(this, oe).y.clone().pow(2)))) : (h(this, oe, void 0), h(this, F, void 0));
3355
+ let n, r, l;
3356
+ t.coefficient.isEqual(s.coefficient) ? (e.divide(t.coefficient), n = e.left.monomByDegree(1, "x"), r = e.left.monomByDegree(1, "y"), l = e.left.monomByDegree(0), h(this, oe, new j(n.coefficient.clone().divide(2).opposite(), r.coefficient.clone().divide(2).opposite())), h(this, F, l.coefficient.clone().opposite().add(i(this, oe).x.clone().pow(2)).add(i(this, oe).y.clone().pow(2)))) : (h(this, oe, void 0), h(this, F, void 0));
3252
3357
  }
3253
3358
  return this;
3254
3359
  };
3255
- let yt = Dt;
3256
- var Q, _, ee, Je, Te, ct, Zt, ut, Pe, Vt, _e;
3257
- const Ft = class Ft {
3360
+ let vt = Zt;
3361
+ var Q, _, ee, et, Oe, ut, Ft, ft, Pe, jt, tt;
3362
+ const Ut = class Ut {
3258
3363
  constructor(...e) {
3259
3364
  d(this, Q);
3260
3365
  d(this, _);
3261
3366
  d(this, ee);
3262
- d(this, Je);
3263
- d(this, Te);
3264
- d(this, ct);
3367
+ d(this, et);
3368
+ d(this, Oe);
3369
+ d(this, ut);
3265
3370
  // ------------------------------------------
3266
3371
  // Creation / parsing functions
3267
3372
  // ------------------------------------------
@@ -3284,36 +3389,38 @@ const Ft = class Ft {
3284
3389
  );
3285
3390
  } else if (e.length === 3) {
3286
3391
  if (e.every((t) => typeof t == "string"))
3287
- return this.parse(...e.map((t) => new D(t)));
3392
+ return this.parse(
3393
+ ...e.map((t) => new D(t))
3394
+ );
3288
3395
  if (e.every((t) => t instanceof D)) {
3289
- const t = e[0].clone(), s = e[1].clone(), r = e[2].clone();
3290
- h(this, Je, { AB: t, BC: s, AC: r });
3291
- let n = t.intersection(s);
3292
- if (n.hasIntersection)
3293
- h(this, _, n.point.clone());
3396
+ const t = e[0].clone(), s = e[1].clone(), n = e[2].clone();
3397
+ h(this, et, { AB: t, BC: s, AC: n });
3398
+ let r = t.intersection(s);
3399
+ if (r.hasIntersection)
3400
+ h(this, _, r.point.clone());
3294
3401
  else
3295
3402
  throw new Error("Lines do not intersect !");
3296
- if (n = s.intersection(r), n.hasIntersection)
3297
- h(this, ee, n.point.clone());
3403
+ if (r = s.intersection(n), r.hasIntersection)
3404
+ h(this, ee, r.point.clone());
3298
3405
  else
3299
3406
  throw new Error("Lines do not intersect !");
3300
- if (n = r.intersection(t), n.hasIntersection)
3301
- h(this, Q, n.point.clone());
3407
+ if (r = n.intersection(t), r.hasIntersection)
3408
+ h(this, Q, r.point.clone());
3302
3409
  else
3303
3410
  throw new Error("Lines do not intersect !");
3304
- } else e.every((t) => t instanceof j) && (h(this, Q, e[0].clone()), h(this, _, e[1].clone()), h(this, ee, e[2].clone()), h(this, Je, {
3411
+ } else e.every((t) => t instanceof j) && (h(this, Q, e[0].clone()), h(this, _, e[1].clone()), h(this, ee, e[2].clone()), h(this, et, {
3305
3412
  AB: new D(i(this, Q), i(this, _)),
3306
3413
  BC: new D(i(this, _), i(this, ee)),
3307
3414
  AC: new D(i(this, Q), i(this, ee))
3308
3415
  }));
3309
- } else if (e.length === 1 && e[0] instanceof Ft)
3416
+ } else if (e.length === 1 && e[0] instanceof Ut)
3310
3417
  return e[0].clone();
3311
- return i(this, Zt).call(this), this;
3418
+ return i(this, Ft).call(this), this;
3312
3419
  });
3313
3420
  /**
3314
3421
  * Clone the Triangle class
3315
3422
  */
3316
- a(this, "clone", () => new Ft(
3423
+ a(this, "clone", () => new Ut(
3317
3424
  i(this, Q).clone(),
3318
3425
  i(this, _).clone(),
3319
3426
  i(this, ee).clone()
@@ -3324,18 +3431,18 @@ const Ft = class Ft {
3324
3431
  /**
3325
3432
  * Generate the Line object for the three segments of the triangle
3326
3433
  */
3327
- d(this, Zt, () => {
3328
- h(this, Te, {
3434
+ d(this, Ft, () => {
3435
+ h(this, Oe, {
3329
3436
  AB: new j().middleOf(i(this, Q), i(this, _)),
3330
3437
  AC: new j().middleOf(i(this, Q), i(this, ee)),
3331
3438
  BC: new j().middleOf(i(this, _), i(this, ee))
3332
- }), h(this, ct, i(this, Vt).call(this));
3439
+ }), h(this, ut, i(this, jt).call(this));
3333
3440
  });
3334
3441
  /**
3335
3442
  * Get the Vector2D class for the given name
3336
3443
  * @param ptName
3337
3444
  */
3338
- d(this, ut, (e) => {
3445
+ d(this, ft, (e) => {
3339
3446
  switch (e.toUpperCase()) {
3340
3447
  case "A":
3341
3448
  return i(this, Q);
@@ -3352,51 +3459,51 @@ const Ft = class Ft {
3352
3459
  * @param ptName2
3353
3460
  */
3354
3461
  d(this, Pe, (e, t) => new x(
3355
- i(this, ut).call(this, e),
3356
- i(this, ut).call(this, t)
3462
+ i(this, ft).call(this, e),
3463
+ i(this, ft).call(this, t)
3357
3464
  ));
3358
- d(this, Vt, () => {
3465
+ d(this, jt, () => {
3359
3466
  const e = {
3360
- A: new D(i(this, Q), i(this, Te).BC),
3361
- B: new D(i(this, _), i(this, Te).AC),
3362
- C: new D(i(this, ee), i(this, Te).AB),
3467
+ A: new D().fromPoints(i(this, Q), i(this, Oe).BC),
3468
+ B: new D().fromPoints(i(this, _), i(this, Oe).AC),
3469
+ C: new D().fromPoints(i(this, ee), i(this, Oe).AB),
3363
3470
  intersection: null
3364
3471
  }, t = {
3365
- AB: new D(i(this, Te).AB, new x(i(this, Q), i(this, _)).normal()),
3366
- AC: new D(i(this, Te).AC, new x(i(this, Q), i(this, ee)).normal()),
3367
- BC: new D(i(this, Te).BC, new x(i(this, _), i(this, ee)).normal()),
3472
+ AB: new D().fromPointAndNormal(i(this, Oe).AB, new x(i(this, Q), i(this, _)).normal()),
3473
+ AC: new D().fromPointAndNormal(i(this, Oe).AC, new x(i(this, Q), i(this, ee)).normal()),
3474
+ BC: new D().fromPointAndNormal(i(this, Oe).BC, new x(i(this, _), i(this, ee)).normal()),
3368
3475
  intersection: null
3369
3476
  }, s = {
3370
- A: new D(i(this, Q), new x(i(this, _), i(this, ee)).normal()),
3371
- B: new D(i(this, _), new x(i(this, Q), i(this, ee)).normal()),
3372
- C: new D(i(this, ee), new x(i(this, Q), i(this, _)).normal()),
3477
+ A: new D().fromPointAndNormal(i(this, Q), new x(i(this, _), i(this, ee)).normal()),
3478
+ B: new D().fromPointAndNormal(i(this, _), new x(i(this, Q), i(this, ee)).normal()),
3479
+ C: new D().fromPointAndNormal(i(this, ee), new x(i(this, Q), i(this, _)).normal()),
3373
3480
  intersection: null
3374
- }, r = i(this, _e).call(this, "A"), n = i(this, _e).call(this, "B"), l = i(this, _e).call(this, "C"), u = {
3375
- A: r.internal,
3376
- B: n.internal,
3377
- C: n.internal,
3481
+ }, n = i(this, tt).call(this, "A"), r = i(this, tt).call(this, "B"), l = i(this, tt).call(this, "C"), u = {
3482
+ A: n.internal,
3483
+ B: r.internal,
3484
+ C: r.internal,
3378
3485
  intersection: null
3379
3486
  }, f = {
3380
- A: r.external,
3381
- B: n.external,
3487
+ A: n.external,
3488
+ B: r.external,
3382
3489
  C: l.external,
3383
3490
  intersection: null
3384
- }, p = {
3491
+ }, m = {
3385
3492
  medians: e,
3386
3493
  mediators: t,
3387
3494
  heights: s,
3388
3495
  bisectors: u,
3389
3496
  externalBisectors: f
3390
3497
  };
3391
- return p.medians.intersection = p.medians.A.intersection(p.medians.B).point, p.mediators.intersection = p.mediators.AB.intersection(p.mediators.BC).point, p.heights.intersection = p.heights.A.intersection(p.heights.B).point, p.bisectors.intersection = p.bisectors.A.intersection(p.bisectors.B).point, p;
3498
+ return m.medians.intersection = m.medians.A.intersection(m.medians.B).point, m.mediators.intersection = m.mediators.AB.intersection(m.mediators.BC).point, m.heights.intersection = m.heights.A.intersection(m.heights.B).point, m.bisectors.intersection = m.bisectors.A.intersection(m.bisectors.B).point, m;
3392
3499
  });
3393
- d(this, _e, (e) => {
3500
+ d(this, tt, (e) => {
3394
3501
  const t = this.lines;
3395
- let s, r;
3396
- if (e === "A" ? (s = t.AB, r = t.AC) : e === "B" ? (s = t.AB, r = t.BC) : e === "C" && (s = t.BC, r = t.AC), s === void 0 || r === void 0)
3502
+ let s, n;
3503
+ if (e === "A" ? (s = t.AB, n = t.AC) : e === "B" ? (s = t.AB, n = t.BC) : e === "C" && (s = t.BC, n = t.AC), s === void 0 || n === void 0)
3397
3504
  throw new Error(`The point ${e} does not exist`);
3398
- const n = s.n.simplify().norm, l = r.n.simplify().norm, u = s.getEquation().multiply(l), f = r.getEquation().multiply(n), p = new D(u.clone().subtract(f).simplify()), g = new D(f.clone().subtract(u).simplify());
3399
- return e === "A" ? p.hitSegment(this.B, this.C) ? { internal: p, external: g } : { internal: g, external: p } : e === "B" ? p.hitSegment(this.A, this.C) ? { internal: p, external: g } : { internal: g, external: p } : e === "C" ? p.hitSegment(this.B, this.A) ? { internal: p, external: g } : { internal: g, external: p } : { internal: p, external: g };
3505
+ const r = s.n.simplify().norm, l = n.n.simplify().norm, u = s.getEquation().multiply(l), f = n.getEquation().multiply(r), m = new D(u.clone().subtract(f).simplify()), g = new D(f.clone().subtract(u).simplify());
3506
+ return e === "A" ? m.hitSegment(this.B, this.C) ? { internal: m, external: g } : { internal: g, external: m } : e === "B" ? m.hitSegment(this.A, this.C) ? { internal: m, external: g } : { internal: g, external: m } : e === "C" ? m.hitSegment(this.B, this.A) ? { internal: m, external: g } : { internal: g, external: m } : { internal: m, external: g };
3400
3507
  });
3401
3508
  return e.length > 0 && this.parse(...e), this;
3402
3509
  }
@@ -3440,21 +3547,21 @@ const Ft = class Ft {
3440
3547
  return this.AB.normSquare.isEqual(this.BC.normSquare) || this.AB.normSquare.isEqual(this.AC.normSquare) || this.BC.normSquare.isEqual(this.AC.normSquare);
3441
3548
  }
3442
3549
  get lines() {
3443
- return i(this, Je);
3550
+ return i(this, et);
3444
3551
  }
3445
3552
  get remarquables() {
3446
- return i(this, ct);
3553
+ return i(this, ut);
3447
3554
  }
3448
3555
  };
3449
- Q = new WeakMap(), _ = new WeakMap(), ee = new WeakMap(), Je = new WeakMap(), Te = new WeakMap(), ct = new WeakMap(), Zt = new WeakMap(), ut = new WeakMap(), Pe = new WeakMap(), Vt = new WeakMap(), _e = new WeakMap();
3450
- let Kt = Ft;
3451
- var z, W;
3452
- const nt = class nt {
3556
+ Q = new WeakMap(), _ = new WeakMap(), ee = new WeakMap(), et = new WeakMap(), Oe = new WeakMap(), ut = new WeakMap(), Ft = new WeakMap(), ft = new WeakMap(), Pe = new WeakMap(), jt = new WeakMap(), tt = new WeakMap();
3557
+ let ti = Ut;
3558
+ var R, W;
3559
+ const ot = class ot {
3453
3560
  constructor(e, t) {
3454
3561
  // ax + by + c = 0
3455
- d(this, z, new j());
3562
+ d(this, R, new j());
3456
3563
  d(this, W, new x());
3457
- a(this, "clone", () => (h(this, W, i(this, W).clone()), h(this, z, i(this, z).clone()), this));
3564
+ a(this, "clone", () => (h(this, W, i(this, W).clone()), h(this, R, i(this, R).clone()), this));
3458
3565
  // ------------------------------------------
3459
3566
  // Mathematical operations
3460
3567
  // ------------------------------------------
@@ -3494,23 +3601,23 @@ const nt = class nt {
3494
3601
  // return new Fraction().invalid()
3495
3602
  // }
3496
3603
  a(this, "randomPoint", (e = 5) => {
3497
- const t = i(this, z).clone(), s = new c(X(e, !1));
3604
+ const t = i(this, R).clone(), s = new c(X(e, !1));
3498
3605
  return new j(
3499
3606
  t.x.clone().add(i(this, W).x.clone().multiply(s)),
3500
3607
  t.y.clone().add(i(this, W).y.clone().multiply(s)),
3501
3608
  t.z.clone().add(i(this, W).z.clone().multiply(s))
3502
3609
  );
3503
3610
  });
3504
- return h(this, z, e.clone()), h(this, W, t.asPoint ? new x(e, t) : t.clone()), this;
3611
+ return h(this, R, e.clone()), h(this, W, t.asPoint ? new x(e, t) : t.clone()), this;
3505
3612
  }
3506
3613
  get OA() {
3507
- return i(this, z);
3614
+ return i(this, R);
3508
3615
  }
3509
3616
  set OA(e) {
3510
- h(this, z, e);
3617
+ h(this, R, e);
3511
3618
  }
3512
3619
  get point() {
3513
- return i(this, z).clone();
3620
+ return i(this, R).clone();
3514
3621
  }
3515
3622
  get d() {
3516
3623
  return i(this, W);
@@ -3520,28 +3627,28 @@ const nt = class nt {
3520
3627
  }
3521
3628
  get tex() {
3522
3629
  return {
3523
- parametric: `${x.asTex("x", "y", "z")} = ${x.asTex(i(this, z).x.tex, i(this, z).y.tex, i(this, z).z.tex)} + k\\cdot ${x.asTex(i(this, W).x.tex, i(this, W).y.tex, i(this, W).z.tex)}`,
3630
+ parametric: `${x.asTex("x", "y", "z")} = ${x.asTex(i(this, R).x.tex, i(this, R).y.tex, i(this, R).z.tex)} + k\\cdot ${x.asTex(i(this, W).x.tex, i(this, W).y.tex, i(this, W).z.tex)}`,
3524
3631
  system: `\\left\\{\\begin{aligned}
3525
- x &= ${new T(i(this, z).x).add(new I(i(this, W).x).multiply(new I("k"))).reorder("k", !0).tex}\\\\
3526
- y &= ${new T(i(this, z).y).add(new I(i(this, W).y).multiply(new I("k"))).reorder("k", !0).tex}\\\\
3527
- z &= ${new T(i(this, z).z).add(new I(i(this, W).z).multiply(new I("k"))).reorder("k", !0).tex}
3632
+ x &= ${new O(i(this, R).x).add(new k(i(this, W).x).multiply(new k("k"))).reorder("k", !0).tex}\\\\
3633
+ y &= ${new O(i(this, R).y).add(new k(i(this, W).y).multiply(new k("k"))).reorder("k", !0).tex}\\\\
3634
+ z &= ${new O(i(this, R).z).add(new k(i(this, W).z).multiply(new k("k"))).reorder("k", !0).tex}
3528
3635
  \\end{aligned}\\right.`,
3529
- cartesian: `\\frac{ ${new T("x", 1, i(this, z).x.clone().opposite()).tex} }{ ${this.direction.x.tex} } = \\frac{ ${new T("y", 1, i(this, z).y.clone().opposite()).tex} }{ ${this.direction.y.tex} } = \\frac{ ${new T("z", 1, i(this, z).z.clone().opposite()).tex} }{ ${this.direction.z.tex} }`
3636
+ cartesian: `\\frac{ ${new O("x", 1, i(this, R).x.clone().opposite()).tex} }{ ${this.direction.x.tex} } = \\frac{ ${new O("y", 1, i(this, R).y.clone().opposite()).tex} }{ ${this.direction.y.tex} } = \\frac{ ${new O("z", 1, i(this, R).z.clone().opposite()).tex} }{ ${this.direction.z.tex} }`
3530
3637
  };
3531
3638
  }
3532
3639
  get display() {
3533
- const e = i(this, z).x.display, t = i(this, z).y.display, s = i(this, z).z.display, r = this.direction.simplify(), n = r.x.display, l = r.y.display, u = r.z.display;
3640
+ const e = i(this, R).x.display, t = i(this, R).y.display, s = i(this, R).z.display, n = this.direction.simplify(), r = n.x.display, l = n.y.display, u = n.z.display;
3534
3641
  return {
3535
- parametric: `${x.asDisplay("x", "y", "z")} = ${x.asDisplay(i(this, z).x.display, i(this, z).y.display, i(this, z).z.display)} + k\\cdot ${x.asDisplay(i(this, W).x.display, i(this, W).y.display, i(this, W).z.display)}`,
3642
+ parametric: `${x.asDisplay("x", "y", "z")} = ${x.asDisplay(i(this, R).x.display, i(this, R).y.display, i(this, R).z.display)} + k\\cdot ${x.asDisplay(i(this, W).x.display, i(this, W).y.display, i(this, W).z.display)}`,
3536
3643
  system: "",
3537
- cartesian: `(x-${e})/${n} = (y-${t})/${l} = (z-${s})/${u}`
3644
+ cartesian: `(x-${e})/${r} = (y-${t})/${l} = (z-${s})/${u}`
3538
3645
  };
3539
3646
  }
3540
3647
  get direction() {
3541
3648
  return i(this, W).clone();
3542
3649
  }
3543
3650
  distanceTo(e) {
3544
- const t = new x(i(this, z), e), s = this.direction, r = this.direction.normSquare, n = t.cross(s).normSquare, l = n.clone().divide(r), u = l.clone().sqrt();
3651
+ const t = new x(i(this, R), e), s = this.direction, n = this.direction.normSquare, r = t.cross(s).normSquare, l = r.clone().divide(n), u = l.clone().sqrt();
3545
3652
  return console.log("CROSS", t.cross(s).display), {
3546
3653
  value: Math.sqrt(l.value),
3547
3654
  fraction: l.clone().sqrt(),
@@ -3550,97 +3657,97 @@ const nt = class nt {
3550
3657
  }
3551
3658
  hitSegment(e, t) {
3552
3659
  const s = this.intersection(
3553
- new nt(e, t)
3660
+ new ot(e, t)
3554
3661
  );
3555
3662
  return s.hasIntersection ? s.point.x.value >= Math.min(e.x.value, t.x.value) && s.point.x.value <= Math.max(e.x.value, t.x.value) && s.point.y.value >= Math.min(e.y.value, t.y.value) && s.point.y.value <= Math.max(e.y.value, t.y.value) && s.point.z.value >= Math.min(e.z.value, t.z.value) && s.point.z.value <= Math.max(e.z.value, t.z.value) : !1;
3556
3663
  }
3557
3664
  };
3558
- z = new WeakMap(), W = new WeakMap(), // A line is defined as the canonical form
3559
- a(nt, "PERPENDICULAR", "perpendicular"), a(nt, "PARALLEL", "parallel");
3560
- let wt = nt;
3561
- var Ae, Fe;
3562
- const ii = class ii {
3665
+ R = new WeakMap(), W = new WeakMap(), // A line is defined as the canonical form
3666
+ a(ot, "PERPENDICULAR", "perpendicular"), a(ot, "PARALLEL", "parallel");
3667
+ let bt = ot;
3668
+ var qe, Ue;
3669
+ const ai = class ai {
3563
3670
  constructor(e) {
3564
- d(this, Ae, new x(0, 0, 1));
3565
- d(this, Fe, new j(0, 0, 0));
3671
+ d(this, qe, new x(0, 0, 1));
3672
+ d(this, Ue, new j(0, 0, 0));
3566
3673
  return e && this.parse(e), this;
3567
3674
  }
3568
3675
  get normal() {
3569
- return i(this, Ae);
3676
+ return i(this, qe);
3570
3677
  }
3571
3678
  set normal(e) {
3572
- h(this, Ae, e), i(this, Ae).asPoint = !1;
3679
+ h(this, qe, e), i(this, qe).asPoint = !1;
3573
3680
  }
3574
3681
  get point() {
3575
- return i(this, Fe);
3682
+ return i(this, Ue);
3576
3683
  }
3577
3684
  set point(e) {
3578
- h(this, Fe, e), i(this, Fe).asPoint = !0;
3685
+ h(this, Ue, e), i(this, Ue).asPoint = !0;
3579
3686
  }
3580
3687
  get a() {
3581
- return i(this, Ae).x;
3688
+ return i(this, qe).x;
3582
3689
  }
3583
3690
  get b() {
3584
- return i(this, Ae).y;
3691
+ return i(this, qe).y;
3585
3692
  }
3586
3693
  get c() {
3587
- return i(this, Ae).z;
3694
+ return i(this, qe).z;
3588
3695
  }
3589
3696
  get d() {
3590
- return i(this, Ae).dot(i(this, Fe)).opposite();
3697
+ return i(this, qe).dot(i(this, Ue)).opposite();
3591
3698
  }
3592
3699
  get tex() {
3593
3700
  return new H(
3594
- new T("xyz", this.a, this.b, this.c, this.d),
3595
- new T(0)
3701
+ new O("xyz", this.a, this.b, this.c, this.d),
3702
+ new O(0)
3596
3703
  ).reduce().tex;
3597
3704
  }
3598
3705
  parse(e) {
3599
- var t, s, r;
3706
+ var t, s, n;
3600
3707
  if (e.point && e.normal) {
3601
3708
  this.point = e.point, this.normal = e.normal;
3602
3709
  return;
3603
3710
  }
3604
3711
  if (e.point && ((t = e.directions) == null ? void 0 : t.length) === 2) {
3605
3712
  this.point = e.point;
3606
- const [n, l] = e.directions;
3607
- this.normal = n.cross(l);
3713
+ const [r, l] = e.directions;
3714
+ this.normal = r.cross(l);
3608
3715
  return;
3609
3716
  }
3610
3717
  if (e.equation) {
3611
- const n = e.equation.moveLeft().reduce().left, l = n.monomByLetter("x").coefficient, u = n.monomByLetter("y").coefficient, f = n.monomByLetter("z").coefficient, p = n.monomByDegree(0).coefficient;
3612
- this.normal = new x(l, u, f), l.isNotZero() ? this.point = new j(p.clone().divide(l).opposite(), 0, 0) : u.isNotZero() ? this.point = new j(0, p.clone().divide(u).opposite(), 0) : this.point = new j(0, 0, p.clone().divide(f).opposite());
3718
+ const r = e.equation.moveLeft().reduce().left, l = r.monomByLetter("x").coefficient, u = r.monomByLetter("y").coefficient, f = r.monomByLetter("z").coefficient, m = r.monomByDegree(0).coefficient;
3719
+ this.normal = new x(l, u, f), l.isNotZero() ? this.point = new j(m.clone().divide(l).opposite(), 0, 0) : u.isNotZero() ? this.point = new j(0, m.clone().divide(u).opposite(), 0) : this.point = new j(0, 0, m.clone().divide(f).opposite());
3613
3720
  return;
3614
3721
  }
3615
- if (((s = e.points) == null ? void 0 : s.length) === 3 && e.points.every((n) => n instanceof x)) {
3616
- const n = e.points[0], l = e.points[1], u = e.points[2], f = new x(n, l), p = new x(n, u);
3617
- this.normal = f.cross(p), this.point = n;
3722
+ if (((s = e.points) == null ? void 0 : s.length) === 3 && e.points.every((r) => r instanceof x)) {
3723
+ const r = e.points[0], l = e.points[1], u = e.points[2], f = new x(r, l), m = new x(r, u);
3724
+ this.normal = f.cross(m), this.point = r;
3618
3725
  return;
3619
3726
  }
3620
- if (((r = e.coefficients) == null ? void 0 : r.length) === 4) {
3621
- const [n, l, u, f] = e.coefficients;
3622
- this.normal = new x(n, l, u), this.point = new j(0, 0, -f);
3727
+ if (((n = e.coefficients) == null ? void 0 : n.length) === 4) {
3728
+ const [r, l, u, f] = e.coefficients;
3729
+ this.normal = new x(r, l, u), this.point = new j(0, 0, -f);
3623
3730
  return;
3624
3731
  }
3625
3732
  }
3626
3733
  angle(e, t, s) {
3627
- if (e instanceof ii)
3734
+ if (e instanceof ai)
3628
3735
  return this.normal.angle(e.normal, t, s);
3629
- let r;
3736
+ let n;
3630
3737
  if (e instanceof x) {
3631
3738
  if (e.dimension !== 3)
3632
3739
  throw new Error("Vector is not 3D");
3633
- r = e;
3740
+ n = e;
3634
3741
  } else
3635
- r = e.direction;
3636
- return (s ? Math.PI / 2 : 90) - this.normal.angle(r, !0, s);
3742
+ n = e.direction;
3743
+ return (s ? Math.PI / 2 : 90) - this.normal.angle(n, !0, s);
3637
3744
  }
3638
3745
  distanceTo(e) {
3639
3746
  return this.normal.dot(e).add(this.d).abs().value / this.normal.norm;
3640
3747
  }
3641
3748
  intersectWithLine(e) {
3642
- const { point: t, direction: s } = e, r = this.normal.dot(t).add(this.d).divide(this.normal.dot(s).opposite());
3643
- return t.clone().add(s.clone().multiplyByScalar(r));
3749
+ const { point: t, direction: s } = e, n = this.normal.dot(t).add(this.d).divide(this.normal.dot(s).opposite());
3750
+ return t.clone().add(s.clone().multiplyByScalar(n));
3644
3751
  }
3645
3752
  intersectWithPlane(e) {
3646
3753
  throw this.normal.cross(e.normal), new j(0, 0, 0), new Error("Intersection with plane not yet implemented !");
@@ -3649,10 +3756,10 @@ const ii = class ii {
3649
3756
  return this.normal.dot(e).add(this.d).isZero();
3650
3757
  }
3651
3758
  };
3652
- Ae = new WeakMap(), Fe = new WeakMap();
3653
- let Jt = ii;
3759
+ qe = new WeakMap(), Ue = new WeakMap();
3760
+ let ii = ai;
3654
3761
  var Me;
3655
- class Hi {
3762
+ class es {
3656
3763
  constructor(...e) {
3657
3764
  d(this, Me, []);
3658
3765
  return h(this, Me, e), this;
@@ -3672,11 +3779,11 @@ class Hi {
3672
3779
  determinant() {
3673
3780
  if (!this.isSquare())
3674
3781
  throw new Error("Matrix is not square");
3675
- return Ui(...this.values);
3782
+ return Ki(...this.values);
3676
3783
  }
3677
3784
  }
3678
3785
  Me = new WeakMap();
3679
- function vt(o) {
3786
+ function xt(o) {
3680
3787
  const e = Object.assign(
3681
3788
  {
3682
3789
  negative: !0,
@@ -3696,7 +3803,7 @@ function vt(o) {
3696
3803
  }
3697
3804
  return e.reduced ? t.reduce() : t;
3698
3805
  }
3699
- function Ei(o) {
3806
+ function Oi(o) {
3700
3807
  const e = Object.assign(
3701
3808
  {
3702
3809
  letters: "x",
@@ -3705,8 +3812,8 @@ function Ei(o) {
3705
3812
  zero: !1
3706
3813
  },
3707
3814
  o
3708
- ), t = new I();
3709
- if (t.coefficient = vt({
3815
+ ), t = new k();
3816
+ if (t.coefficient = xt({
3710
3817
  zero: e.zero,
3711
3818
  reduced: !0,
3712
3819
  natural: !e.fraction
@@ -3714,14 +3821,14 @@ function Ei(o) {
3714
3821
  for (const s of e.letters.split(""))
3715
3822
  t.setLetter(s, 0);
3716
3823
  for (let s = 0; s < e.degree; s++) {
3717
- const r = ei(e.letters.split(""));
3718
- t.setLetter(r, t.degree(r).clone().add(1));
3824
+ const n = oi(e.letters.split(""));
3825
+ t.setLetter(n, t.degree(n).clone().add(1));
3719
3826
  }
3720
3827
  } else
3721
3828
  t.setLetter(e.letters, e.degree);
3722
3829
  return t;
3723
3830
  }
3724
- const Xi = {
3831
+ const ts = {
3725
3832
  letters: "x",
3726
3833
  degree: 2,
3727
3834
  fraction: !1,
@@ -3732,27 +3839,27 @@ const Xi = {
3732
3839
  numberOfMonoms: 0,
3733
3840
  positive: !0
3734
3841
  };
3735
- function Ni(o) {
3842
+ function qi(o) {
3736
3843
  const e = Object.assign(
3737
- Xi,
3844
+ ts,
3738
3845
  o
3739
- ), t = new T().empty();
3846
+ ), t = new O().empty();
3740
3847
  let s;
3741
- for (let r = e.degree; r >= 0; r--)
3742
- s = Ei({
3848
+ for (let n = e.degree; n >= 0; n--)
3849
+ s = Oi({
3743
3850
  letters: e.letters,
3744
- degree: r,
3851
+ degree: n,
3745
3852
  fraction: e.fraction,
3746
- zero: r === e.degree ? !1 : e.allowNullMonom
3747
- }), e.unit && e.degree === r && s.coefficient.one(), t.add(s);
3853
+ zero: n === e.degree ? !1 : e.allowNullMonom
3854
+ }), e.unit && e.degree === n && s.coefficient.one(), t.add(s);
3748
3855
  if (e.positive && t.monomByDegree().coefficient.isNegative() && t.monomByDegree().coefficient.opposite(), e.numberOfMonoms && e.numberOfMonoms > 0 && e.numberOfMonoms < t.length)
3749
3856
  for (; t.length > e.numberOfMonoms; ) {
3750
- const r = de(1, t.length - 1);
3751
- t.monoms.splice(r, 1);
3857
+ const n = de(1, t.length - 1);
3858
+ t.monoms.splice(n, 1);
3752
3859
  }
3753
3860
  return t;
3754
3861
  }
3755
- function Yi(o) {
3862
+ function is(o) {
3756
3863
  const e = Object.assign(
3757
3864
  {
3758
3865
  letters: "x",
@@ -3772,20 +3879,20 @@ function Yi(o) {
3772
3879
  }
3773
3880
  },
3774
3881
  o
3775
- ), t = new T().one();
3882
+ ), t = new O().one();
3776
3883
  for (let s = 0; s < e.degree; s++) {
3777
- const r = Ni({
3884
+ const n = qi({
3778
3885
  degree: 1,
3779
3886
  unit: e.unit,
3780
3887
  fraction: e.fraction,
3781
3888
  letters: e.letters,
3782
3889
  zero: e.zero
3783
3890
  });
3784
- t.multiply(r);
3891
+ t.multiply(n);
3785
3892
  }
3786
3893
  return new H(t, 0);
3787
3894
  }
3788
- function Oi(o) {
3895
+ function Mi(o) {
3789
3896
  const e = Object.assign(
3790
3897
  {
3791
3898
  axis: !0,
@@ -3794,10 +3901,10 @@ function Oi(o) {
3794
3901
  quadrant: null
3795
3902
  },
3796
3903
  o
3797
- ), t = e.axis === "x", s = e.axis === "y", r = e.fraction ? vt({ max: e.max, zero: t }) : new c(X(e.max, t)), n = e.fraction ? vt({ max: e.max, zero: s }) : new c(X(e.max, s));
3798
- return Number(e.quadrant) === 1 && (r.abs(), n.abs()), Number(e.quadrant) === 2 && (r.isPositive() && r.opposite(), n.isNegative() && n.opposite()), Number(e.quadrant) === 3 && (r.isPositive() && r.opposite(), n.isPositive() && n.opposite()), Number(e.quadrant) === 4 && (r.isNegative() && r.opposite(), n.isPositive() && n.opposite()), new j(r, n);
3904
+ ), t = e.axis === "x", s = e.axis === "y", n = e.fraction ? xt({ max: e.max, zero: t }) : new c(X(e.max, t)), r = e.fraction ? xt({ max: e.max, zero: s }) : new c(X(e.max, s));
3905
+ return Number(e.quadrant) === 1 && (n.abs(), r.abs()), Number(e.quadrant) === 2 && (n.isPositive() && n.opposite(), r.isNegative() && r.opposite()), Number(e.quadrant) === 3 && (n.isPositive() && n.opposite(), r.isPositive() && r.opposite()), Number(e.quadrant) === 4 && (n.isNegative() && n.opposite(), r.isPositive() && r.opposite()), new j(n, r);
3799
3906
  }
3800
- function Qi(o) {
3907
+ function ss(o) {
3801
3908
  const e = Object.assign(
3802
3909
  {
3803
3910
  center: {
@@ -3807,11 +3914,11 @@ function Qi(o) {
3807
3914
  pointsOnCircle: 8
3808
3915
  },
3809
3916
  o
3810
- ), t = Oi(e.center);
3811
- let s, r;
3812
- return e.pointsOnCircle === 8 ? (s = de(1, 3), r = s ** 2 + (s + 1) ** 2) : r = de(1, 20), new yt(t, r, !0);
3917
+ ), t = Mi(e.center);
3918
+ let s, n;
3919
+ return e.pointsOnCircle === 8 ? (s = de(1, 3), n = s ** 2 + (s + 1) ** 2) : n = de(1, 20), new vt(t, n, !0);
3813
3920
  }
3814
- function Ki(o) {
3921
+ function ns(o) {
3815
3922
  const e = Object.assign(
3816
3923
  {
3817
3924
  A: {
@@ -3828,7 +3935,7 @@ function Ki(o) {
3828
3935
  t.x = X(10), t.y = X(10);
3829
3936
  return e.slope === 1 ? t.x.sign() !== t.y.sign() && t.y.opposite() : e.slope === -1 && t.x.sign() !== t.y.sign() && t.y.opposite(), new D(new x(e.A.x, e.A.y), t);
3830
3937
  }
3831
- function Ji(o) {
3938
+ function rs(o) {
3832
3939
  const e = Object.assign(
3833
3940
  {
3834
3941
  A: {
@@ -3844,47 +3951,210 @@ function Ji(o) {
3844
3951
  },
3845
3952
  o
3846
3953
  ), t = new j(e.A.x, e.A.y, e.A.z), s = new x(e.direction.x, e.direction.y, e.direction.z);
3847
- return new wt(t, s);
3954
+ return new bt(t, s);
3848
3955
  }
3849
- const _i = {
3850
- equation: (o) => Yi(o),
3851
- polynom: (o) => Ni(o),
3852
- monom: (o) => Ei(o),
3853
- fraction: (o) => vt(o),
3956
+ const os = {
3957
+ equation: (o) => is(o),
3958
+ polynom: (o) => qi(o),
3959
+ monom: (o) => Oi(o),
3960
+ fraction: (o) => xt(o),
3854
3961
  number: (o, e, t) => de(o, e, t),
3855
3962
  numberSym: (o, e) => X(o, e),
3856
- prime: (o) => Gi(o),
3857
- bool: (o) => mi(o),
3858
- array: (o, e) => Wi(o, e),
3859
- item: (o) => ei(o),
3860
- shuffle: (o) => gi(o),
3861
- line: (o) => Ki(o),
3862
- line3: (o) => Ji(o),
3863
- point: (o) => Oi(o),
3864
- circle: (o) => Qi(o)
3865
- }, es = {
3963
+ prime: (o) => Ji(o),
3964
+ bool: (o) => vi(o),
3965
+ array: (o, e) => _i(o, e),
3966
+ item: (o) => oi(o),
3967
+ shuffle: (o) => bi(o),
3968
+ line: (o) => ns(o),
3969
+ line3: (o) => rs(o),
3970
+ point: (o) => Mi(o),
3971
+ circle: (o) => ss(o)
3972
+ };
3973
+ var ke, dt, si;
3974
+ class hs {
3975
+ /**
3976
+ *
3977
+ * @param {string} value (optional) Default polynom to parse on class creation
3978
+ */
3979
+ constructor(e) {
3980
+ d(this, dt);
3981
+ d(this, ke);
3982
+ a(this, "parse", (e) => (h(this, ke, new Gt(Ve.SET).parse(e).rpn), this));
3983
+ return h(this, ke, []), e !== void 0 && this.parse(e), this;
3984
+ }
3985
+ evaluate(e) {
3986
+ this.variables.forEach((s) => {
3987
+ Object.hasOwn(e, s) || (e[s] = !1);
3988
+ });
3989
+ const t = [];
3990
+ for (const s of i(this, ke))
3991
+ if (console.log(s), s.tokenType === "variable")
3992
+ t.push(e[s.token]);
3993
+ else if (s.tokenType === "operation")
3994
+ if (s.token === "!")
3995
+ if (t.length >= 1) {
3996
+ const n = t.pop();
3997
+ t.push(!n);
3998
+ } else
3999
+ return !1;
4000
+ else {
4001
+ const n = t.pop(), r = t.pop();
4002
+ if (n !== void 0 && r !== void 0)
4003
+ switch (s.token) {
4004
+ case "&":
4005
+ t.push(n && r);
4006
+ break;
4007
+ case "|":
4008
+ t.push(n || r);
4009
+ break;
4010
+ case "-":
4011
+ return !1;
4012
+ }
4013
+ else
4014
+ return !1;
4015
+ }
4016
+ return t.length === 1 && t[0];
4017
+ }
4018
+ get rpn() {
4019
+ return i(this, ke);
4020
+ }
4021
+ get tex() {
4022
+ const e = [];
4023
+ for (const t of i(this, ke))
4024
+ if (t.tokenType === "variable")
4025
+ e.push(t);
4026
+ else
4027
+ switch (t.token) {
4028
+ case "&":
4029
+ if (e.length >= 2) {
4030
+ const s = e.pop(), n = e.pop();
4031
+ s && n && (n.tokenType === "mix" && (n.token = `( ${n.token} )`), s.tokenType === "mix" && (s.token = `( ${s.token} )`), e.push({ token: `${n.token} \\cap ${s.token}`, tokenType: "mix" }));
4032
+ }
4033
+ break;
4034
+ case "|":
4035
+ if (e.length >= 2) {
4036
+ const s = e.pop(), n = e.pop();
4037
+ s && n && (n.tokenType === "mix" && (n.token = `( ${n.token} )`), s.tokenType === "mix" && (s.token = `( ${s.token} )`), e.push({ token: `${n.token} \\cup ${s.token}`, tokenType: "mix" }));
4038
+ }
4039
+ break;
4040
+ case "-":
4041
+ if (e.length >= 2) {
4042
+ const s = e.pop(), n = e.pop();
4043
+ s && n && (n.tokenType === "mix" && (n.token = `( ${n.token} )`), s.tokenType === "mix" && (s.token = `( ${s.token} )`), e.push({ token: `${n.token} \\setminus ${s.token}`, tokenType: "mix" }));
4044
+ }
4045
+ break;
4046
+ case "!":
4047
+ if (e.length >= 1) {
4048
+ const s = e.pop();
4049
+ s && e.push({ token: `\\overline{ ${s.token} }`, tokenType: "variable" });
4050
+ }
4051
+ break;
4052
+ }
4053
+ return e[0].token;
4054
+ }
4055
+ get variables() {
4056
+ return i(this, ke).filter((e) => e.tokenType === "variable").map((e) => e.token);
4057
+ }
4058
+ vennAB() {
4059
+ return q(this, dt, si).call(this, {
4060
+ A: ["A", "AB"],
4061
+ B: ["B", "AB"]
4062
+ }, ["A", "B", "AB", "E"]);
4063
+ }
4064
+ vennABC() {
4065
+ return q(this, dt, si).call(this, {
4066
+ A: ["A", "AB", "AC", "ABC"],
4067
+ B: ["B", "AB", "BC", "ABC"],
4068
+ C: ["C", "AC", "BC", "ABC"]
4069
+ }, ["A", "B", "C", "AB", "AC", "BC", "ABC", "E"]);
4070
+ }
4071
+ }
4072
+ ke = new WeakMap(), dt = new WeakSet(), si = function(e, t) {
4073
+ const s = [];
4074
+ let n;
4075
+ if (t === void 0) {
4076
+ n = /* @__PURE__ */ new Set();
4077
+ for (const r in e)
4078
+ n = /* @__PURE__ */ new Set([
4079
+ ...n,
4080
+ ...e[r] ?? []
4081
+ ]);
4082
+ } else
4083
+ n = new Set(t);
4084
+ for (const r of i(this, ke))
4085
+ if (r.tokenType === "variable")
4086
+ e[r.token] === void 0 ? s.push(/* @__PURE__ */ new Set()) : s.push(new Set(e[r.token]));
4087
+ else
4088
+ switch (r.token) {
4089
+ case "&":
4090
+ if (s.length >= 2) {
4091
+ const l = s.pop(), u = s.pop();
4092
+ u && l && s.push(new Set([...u].filter((f) => l.has(f))));
4093
+ }
4094
+ break;
4095
+ case "|":
4096
+ if (s.length >= 2) {
4097
+ const l = s.pop(), u = s.pop();
4098
+ u && l && s.push(/* @__PURE__ */ new Set([...u, ...l]));
4099
+ }
4100
+ break;
4101
+ case "-":
4102
+ if (s.length >= 2) {
4103
+ const l = s.pop(), u = s.pop();
4104
+ u && l && s.push(new Set([...u].filter((f) => !l.has(f))));
4105
+ }
4106
+ break;
4107
+ case "!":
4108
+ if (s.length >= 1) {
4109
+ const l = s.pop();
4110
+ l && s.push(new Set([...n].filter((u) => !l.has(u))));
4111
+ }
4112
+ break;
4113
+ }
4114
+ return [...s[0]].sort();
4115
+ };
4116
+ const as = {
3866
4117
  Vector: x,
3867
4118
  Point: j,
3868
4119
  Line: D,
3869
- Triangle: Kt,
3870
- Circle: yt,
3871
- Line3: wt,
3872
- Plane3: Jt
3873
- }, is = {
4120
+ Triangle: ti,
4121
+ Circle: vt,
4122
+ Line3: bt,
4123
+ Plane3: ii
4124
+ }, cs = {
3874
4125
  Numeric: G,
3875
4126
  Fraction: c,
3876
- Root: ft,
3877
- Monom: I,
3878
- Polynom: T,
4127
+ Root: pt,
4128
+ Monom: k,
4129
+ Polynom: O,
3879
4130
  Equation: H,
3880
- Matrix: Hi,
3881
- LinearSystem: Yt,
4131
+ Matrix: es,
4132
+ LinearSystem: _t,
3882
4133
  Factor: fe,
3883
- PolyFactor: Ht,
3884
- // LogicalSet,
3885
- Random: _i,
3886
- Geometry: es
4134
+ PolyFactor: Kt,
4135
+ LogicalSet: hs,
4136
+ Random: os,
4137
+ Geometry: as,
4138
+ NumExp: Hi
3887
4139
  };
3888
4140
  export {
3889
- is as default
4141
+ vt as Circle,
4142
+ H as Equation,
4143
+ fe as Factor,
4144
+ c as Fraction,
4145
+ D as Line,
4146
+ bt as Line3,
4147
+ _t as LinearSystem,
4148
+ hs as LogicalSet,
4149
+ es as Matrix,
4150
+ k as Monom,
4151
+ pt as NthRoot,
4152
+ Hi as NumExp,
4153
+ ii as Plane3,
4154
+ j as Point,
4155
+ Kt as PolyFactor,
4156
+ O as Polynom,
4157
+ ti as Triangle,
4158
+ x as Vector,
4159
+ cs as default
3890
4160
  };