xmmath 1.0.4 → 1.0.5

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/xmmath.es.js CHANGED
@@ -1,97 +1,97 @@
1
- function D0(n) {
1
+ function s0(n) {
2
2
  return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
3
3
  }
4
- var t0 = { exports: {} };
4
+ var B0 = { exports: {} };
5
5
  (function(n) {
6
6
  function l() {
7
- var r = 0, C = 1, t = 2, B = 3, D = 4, F = 5, E = 6, f = 7, b = 8, s = 9, p = 10, P = 11, O = 12, K = 13, Z = 14, V = 15, J = 16, R = 17, M = 0, $ = 1, A = 2, h = 3, N = 4;
8
- function y(x, a) {
9
- return 55296 <= x.charCodeAt(a) && x.charCodeAt(a) <= 56319 && 56320 <= x.charCodeAt(a + 1) && x.charCodeAt(a + 1) <= 57343;
7
+ var t = 0, r = 1, i = 2, B = 3, a = 4, F = 5, s = 6, b = 7, E = 8, v = 9, g = 10, M = 11, S = 12, z = 13, k = 14, P = 15, $ = 16, L = 17, _ = 0, G = 1, R = 2, J = 3, W = 4;
8
+ function U(x, C) {
9
+ return 55296 <= x.charCodeAt(C) && x.charCodeAt(C) <= 56319 && 56320 <= x.charCodeAt(C + 1) && x.charCodeAt(C + 1) <= 57343;
10
10
  }
11
- function u(x, a) {
12
- a === void 0 && (a = 0);
13
- var m = x.charCodeAt(a);
14
- if (55296 <= m && m <= 56319 && a < x.length - 1) {
15
- var v = m, q = x.charCodeAt(a + 1);
16
- return 56320 <= q && q <= 57343 ? (v - 55296) * 1024 + (q - 56320) + 65536 : v;
11
+ function K(x, C) {
12
+ C === void 0 && (C = 0);
13
+ var A = x.charCodeAt(C);
14
+ if (55296 <= A && A <= 56319 && C < x.length - 1) {
15
+ var u = A, m = x.charCodeAt(C + 1);
16
+ return 56320 <= m && m <= 57343 ? (u - 55296) * 1024 + (m - 56320) + 65536 : u;
17
17
  }
18
- if (56320 <= m && m <= 57343 && a >= 1) {
19
- var v = x.charCodeAt(a - 1), q = m;
20
- return 55296 <= v && v <= 56319 ? (v - 55296) * 1024 + (q - 56320) + 65536 : q;
18
+ if (56320 <= A && A <= 57343 && C >= 1) {
19
+ var u = x.charCodeAt(C - 1), m = A;
20
+ return 55296 <= u && u <= 56319 ? (u - 55296) * 1024 + (m - 56320) + 65536 : m;
21
21
  }
22
- return m;
22
+ return A;
23
23
  }
24
- function k(x, a, m) {
25
- var v = [x].concat(a).concat([m]), q = v[v.length - 2], _ = m, d = v.lastIndexOf(Z);
26
- if (d > 1 && v.slice(1, d).every(function(G) {
27
- return G == B;
28
- }) && [B, K, R].indexOf(x) == -1)
29
- return A;
30
- var c = v.lastIndexOf(D);
31
- if (c > 0 && v.slice(1, c).every(function(G) {
32
- return G == D;
33
- }) && [O, D].indexOf(q) == -1)
34
- return v.filter(function(G) {
35
- return G == D;
36
- }).length % 2 == 1 ? h : N;
37
- if (q == r && _ == C)
38
- return M;
39
- if (q == t || q == r || q == C)
40
- return _ == Z && a.every(function(G) {
41
- return G == B;
42
- }) ? A : $;
43
- if (_ == t || _ == r || _ == C)
44
- return $;
45
- if (q == E && (_ == E || _ == f || _ == s || _ == p))
46
- return M;
47
- if ((q == s || q == f) && (_ == f || _ == b))
48
- return M;
49
- if ((q == p || q == b) && _ == b)
50
- return M;
51
- if (_ == B || _ == V)
52
- return M;
53
- if (_ == F)
54
- return M;
55
- if (q == O)
56
- return M;
57
- var x0 = v.indexOf(B) != -1 ? v.lastIndexOf(B) - 1 : v.length - 2;
58
- return [K, R].indexOf(v[x0]) != -1 && v.slice(x0 + 1, -1).every(function(G) {
59
- return G == B;
60
- }) && _ == Z || q == V && [J, R].indexOf(_) != -1 ? M : a.indexOf(D) != -1 ? A : q == D && _ == D ? M : $;
24
+ function f(x, C, A) {
25
+ var u = [x].concat(C).concat([A]), m = u[u.length - 2], y = A, x0 = u.lastIndexOf(k);
26
+ if (x0 > 1 && u.slice(1, x0).every(function(j) {
27
+ return j == B;
28
+ }) && [B, z, L].indexOf(x) == -1)
29
+ return R;
30
+ var n0 = u.lastIndexOf(a);
31
+ if (n0 > 0 && u.slice(1, n0).every(function(j) {
32
+ return j == a;
33
+ }) && [S, a].indexOf(m) == -1)
34
+ return u.filter(function(j) {
35
+ return j == a;
36
+ }).length % 2 == 1 ? J : W;
37
+ if (m == t && y == r)
38
+ return _;
39
+ if (m == i || m == t || m == r)
40
+ return y == k && C.every(function(j) {
41
+ return j == B;
42
+ }) ? R : G;
43
+ if (y == i || y == t || y == r)
44
+ return G;
45
+ if (m == s && (y == s || y == b || y == v || y == g))
46
+ return _;
47
+ if ((m == v || m == b) && (y == b || y == E))
48
+ return _;
49
+ if ((m == g || m == E) && y == E)
50
+ return _;
51
+ if (y == B || y == P)
52
+ return _;
53
+ if (y == F)
54
+ return _;
55
+ if (m == S)
56
+ return _;
57
+ var l0 = u.indexOf(B) != -1 ? u.lastIndexOf(B) - 1 : u.length - 2;
58
+ return [z, L].indexOf(u[l0]) != -1 && u.slice(l0 + 1, -1).every(function(j) {
59
+ return j == B;
60
+ }) && y == k || m == P && [$, L].indexOf(y) != -1 ? _ : C.indexOf(a) != -1 ? R : m == a && y == a ? _ : G;
61
61
  }
62
- this.nextBreak = function(x, a) {
63
- if (a === void 0 && (a = 0), a < 0)
62
+ this.nextBreak = function(x, C) {
63
+ if (C === void 0 && (C = 0), C < 0)
64
64
  return 0;
65
- if (a >= x.length - 1)
65
+ if (C >= x.length - 1)
66
66
  return x.length;
67
- for (var m = w(u(x, a)), v = [], q = a + 1; q < x.length; q++)
68
- if (!y(x, q - 1)) {
69
- var _ = w(u(x, q));
70
- if (k(m, v, _))
71
- return q;
72
- v.push(_);
67
+ for (var A = p(K(x, C)), u = [], m = C + 1; m < x.length; m++)
68
+ if (!U(x, m - 1)) {
69
+ var y = p(K(x, m));
70
+ if (f(A, u, y))
71
+ return m;
72
+ u.push(y);
73
73
  }
74
74
  return x.length;
75
75
  }, this.splitGraphemes = function(x) {
76
- for (var a = [], m = 0, v; (v = this.nextBreak(x, m)) < x.length; )
77
- a.push(x.slice(m, v)), m = v;
78
- return m < x.length && a.push(x.slice(m)), a;
76
+ for (var C = [], A = 0, u; (u = this.nextBreak(x, A)) < x.length; )
77
+ C.push(x.slice(A, u)), A = u;
78
+ return A < x.length && C.push(x.slice(A)), C;
79
79
  }, this.iterateGraphemes = function(x) {
80
- var a = 0, m = {
80
+ var C = 0, A = {
81
81
  next: function() {
82
- var v, q;
83
- return (q = this.nextBreak(x, a)) < x.length ? (v = x.slice(a, q), a = q, { value: v, done: !1 }) : a < x.length ? (v = x.slice(a), a = x.length, { value: v, done: !1 }) : { value: void 0, done: !0 };
82
+ var u, m;
83
+ return (m = this.nextBreak(x, C)) < x.length ? (u = x.slice(C, m), C = m, { value: u, done: !1 }) : C < x.length ? (u = x.slice(C), C = x.length, { value: u, done: !1 }) : { value: void 0, done: !0 };
84
84
  }.bind(this)
85
85
  };
86
- return typeof Symbol < "u" && Symbol.iterator && (m[Symbol.iterator] = function() {
87
- return m;
88
- }), m;
86
+ return typeof Symbol < "u" && Symbol.iterator && (A[Symbol.iterator] = function() {
87
+ return A;
88
+ }), A;
89
89
  }, this.countGraphemes = function(x) {
90
- for (var a = 0, m = 0, v; (v = this.nextBreak(x, m)) < x.length; )
91
- m = v, a++;
92
- return m < x.length && a++, a;
90
+ for (var C = 0, A = 0, u; (u = this.nextBreak(x, A)) < x.length; )
91
+ A = u, C++;
92
+ return A < x.length && C++, C;
93
93
  };
94
- function w(x) {
94
+ function p(x) {
95
95
  return 1536 <= x && x <= 1541 || // Cf [6] ARABIC NUMBER SIGN..ARABIC NUMBER MARK ABOVE
96
96
  x == 1757 || // Cf ARABIC END OF AYAH
97
97
  x == 1807 || // Cf SYRIAC ABBREVIATION MARK
@@ -101,7 +101,7 @@ var t0 = { exports: {} };
101
101
  70082 <= x && x <= 70083 || // Lo [2] SHARADA SIGN JIHVAMULIYA..SHARADA SIGN UPADHMANIYA
102
102
  x == 72250 || // Lo ZANABAZAR SQUARE CLUSTER-INITIAL LETTER RA
103
103
  72326 <= x && x <= 72329 || // Lo [4] SOYOMBO CLUSTER-INITIAL LETTER RA..SOYOMBO CLUSTER-INITIAL LETTER SA
104
- x == 73030 ? O : x == 13 ? r : x == 10 ? C : 0 <= x && x <= 9 || // Cc [10] <control-0000>..<control-0009>
104
+ x == 73030 ? S : x == 13 ? t : x == 10 ? r : 0 <= x && x <= 9 || // Cc [10] <control-0000>..<control-0009>
105
105
  11 <= x && x <= 12 || // Cc [2] <control-000B>..<control-000C>
106
106
  14 <= x && x <= 31 || // Cc [18] <control-000E>..<control-001F>
107
107
  127 <= x && x <= 159 || // Cc [33] <control-007F>..<control-009F>
@@ -126,7 +126,7 @@ var t0 = { exports: {} };
126
126
  x == 917505 || // Cf LANGUAGE TAG
127
127
  917506 <= x && x <= 917535 || // Cn [30] <reserved-E0002>..<reserved-E001F>
128
128
  917632 <= x && x <= 917759 || // Cn [128] <reserved-E0080>..<reserved-E00FF>
129
- 918e3 <= x && x <= 921599 ? t : 768 <= x && x <= 879 || // Mn [112] COMBINING GRAVE ACCENT..COMBINING LATIN SMALL LETTER X
129
+ 918e3 <= x && x <= 921599 ? i : 768 <= x && x <= 879 || // Mn [112] COMBINING GRAVE ACCENT..COMBINING LATIN SMALL LETTER X
130
130
  1155 <= x && x <= 1159 || // Mn [5] COMBINING CYRILLIC TITLO..COMBINING CYRILLIC POKRYTIE
131
131
  1160 <= x && x <= 1161 || // Me [2] COMBINING CYRILLIC HUNDRED THOUSANDS SIGN..COMBINING CYRILLIC MILLIONS SIGN
132
132
  1425 <= x && x <= 1469 || // Mn [45] HEBREW ACCENT ETNAHTA..HEBREW POINT METEG
@@ -454,7 +454,7 @@ var t0 = { exports: {} };
454
454
  125136 <= x && x <= 125142 || // Mn [7] MENDE KIKAKUI COMBINING NUMBER TEENS..MENDE KIKAKUI COMBINING NUMBER MILLIONS
455
455
  125252 <= x && x <= 125258 || // Mn [7] ADLAM ALIF LENGTHENER..ADLAM NUKTA
456
456
  917536 <= x && x <= 917631 || // Cf [96] TAG SPACE..CANCEL TAG
457
- 917760 <= x && x <= 917999 ? B : 127462 <= x && x <= 127487 ? D : x == 2307 || // Mc DEVANAGARI SIGN VISARGA
457
+ 917760 <= x && x <= 917999 ? B : 127462 <= x && x <= 127487 ? a : x == 2307 || // Mc DEVANAGARI SIGN VISARGA
458
458
  x == 2363 || // Mc DEVANAGARI VOWEL SIGN OOE
459
459
  2366 <= x && x <= 2368 || // Mc [3] DEVANAGARI VOWEL SIGN AA..DEVANAGARI VOWEL SIGN II
460
460
  2377 <= x && x <= 2380 || // Mc [4] DEVANAGARI VOWEL SIGN CANDRA O..DEVANAGARI VOWEL SIGN AU
@@ -599,9 +599,9 @@ var t0 = { exports: {} };
599
599
  94033 <= x && x <= 94078 || // Mc [46] MIAO SIGN ASPIRATION..MIAO VOWEL SIGN NG
600
600
  x == 119142 || // Mc MUSICAL SYMBOL COMBINING SPRECHGESANG STEM
601
601
  x == 119149 ? F : 4352 <= x && x <= 4447 || // Lo [96] HANGUL CHOSEONG KIYEOK..HANGUL CHOSEONG FILLER
602
- 43360 <= x && x <= 43388 ? E : 4448 <= x && x <= 4519 || // Lo [72] HANGUL JUNGSEONG FILLER..HANGUL JUNGSEONG O-YAE
603
- 55216 <= x && x <= 55238 ? f : 4520 <= x && x <= 4607 || // Lo [88] HANGUL JONGSEONG KIYEOK..HANGUL JONGSEONG SSANGNIEUN
604
- 55243 <= x && x <= 55291 ? b : x == 44032 || // Lo HANGUL SYLLABLE GA
602
+ 43360 <= x && x <= 43388 ? s : 4448 <= x && x <= 4519 || // Lo [72] HANGUL JUNGSEONG FILLER..HANGUL JUNGSEONG O-YAE
603
+ 55216 <= x && x <= 55238 ? b : 4520 <= x && x <= 4607 || // Lo [88] HANGUL JONGSEONG KIYEOK..HANGUL JONGSEONG SSANGNIEUN
604
+ 55243 <= x && x <= 55291 ? E : x == 44032 || // Lo HANGUL SYLLABLE GA
605
605
  x == 44060 || // Lo HANGUL SYLLABLE GAE
606
606
  x == 44088 || // Lo HANGUL SYLLABLE GYA
607
607
  x == 44116 || // Lo HANGUL SYLLABLE GYAE
@@ -999,7 +999,7 @@ var t0 = { exports: {} };
999
999
  x == 55092 || // Lo HANGUL SYLLABLE HYU
1000
1000
  x == 55120 || // Lo HANGUL SYLLABLE HEU
1001
1001
  x == 55148 || // Lo HANGUL SYLLABLE HYI
1002
- x == 55176 ? s : 44033 <= x && x <= 44059 || // Lo [27] HANGUL SYLLABLE GAG..HANGUL SYLLABLE GAH
1002
+ x == 55176 ? v : 44033 <= x && x <= 44059 || // Lo [27] HANGUL SYLLABLE GAG..HANGUL SYLLABLE GAH
1003
1003
  44061 <= x && x <= 44087 || // Lo [27] HANGUL SYLLABLE GAEG..HANGUL SYLLABLE GAEH
1004
1004
  44089 <= x && x <= 44115 || // Lo [27] HANGUL SYLLABLE GYAG..HANGUL SYLLABLE GYAH
1005
1005
  44117 <= x && x <= 44143 || // Lo [27] HANGUL SYLLABLE GYAEG..HANGUL SYLLABLE GYAEH
@@ -1397,7 +1397,7 @@ var t0 = { exports: {} };
1397
1397
  55093 <= x && x <= 55119 || // Lo [27] HANGUL SYLLABLE HYUG..HANGUL SYLLABLE HYUH
1398
1398
  55121 <= x && x <= 55147 || // Lo [27] HANGUL SYLLABLE HEUG..HANGUL SYLLABLE HEUH
1399
1399
  55149 <= x && x <= 55175 || // Lo [27] HANGUL SYLLABLE HYIG..HANGUL SYLLABLE HYIH
1400
- 55177 <= x && x <= 55203 ? p : x == 9757 || // So WHITE UP POINTING INDEX
1400
+ 55177 <= x && x <= 55203 ? g : x == 9757 || // So WHITE UP POINTING INDEX
1401
1401
  x == 9977 || // So PERSON WITH BALL
1402
1402
  9994 <= x && x <= 9997 || // So [4] RAISED FIST..WRITING HAND
1403
1403
  x == 127877 || // So FATHER CHRISTMAS
@@ -1427,7 +1427,7 @@ var t0 = { exports: {} };
1427
1427
  x == 129318 || // So FACE PALM
1428
1428
  129328 <= x && x <= 129337 || // So [10] PREGNANT WOMAN..JUGGLING
1429
1429
  129341 <= x && x <= 129342 || // So [2] WATER POLO..HANDBALL
1430
- 129489 <= x && x <= 129501 ? K : 127995 <= x && x <= 127999 ? Z : x == 8205 ? V : x == 9792 || // So FEMALE SIGN
1430
+ 129489 <= x && x <= 129501 ? z : 127995 <= x && x <= 127999 ? k : x == 8205 ? P : x == 9792 || // So FEMALE SIGN
1431
1431
  x == 9794 || // So MALE SIGN
1432
1432
  9877 <= x && x <= 9878 || // So [2] STAFF OF AESCULAPIUS..SCALES
1433
1433
  x == 9992 || // So AIRPLANE
@@ -1446,14 +1446,14 @@ var t0 = { exports: {} };
1446
1446
  x == 128300 || // So MICROSCOPE
1447
1447
  x == 128488 || // So LEFT SPEECH BUBBLE
1448
1448
  x == 128640 || // So ROCKET
1449
- x == 128658 ? J : 128102 <= x && x <= 128105 ? R : P;
1449
+ x == 128658 ? $ : 128102 <= x && x <= 128105 ? L : M;
1450
1450
  }
1451
1451
  return this;
1452
1452
  }
1453
1453
  n.exports && (n.exports = l);
1454
- })(t0);
1455
- var a0 = t0.exports;
1456
- const u0 = /* @__PURE__ */ D0(a0), A0 = `{
1454
+ })(B0);
1455
+ var F0 = B0.exports;
1456
+ const p0 = /* @__PURE__ */ s0(F0), f0 = `{
1457
1457
  "wj": "⁠",
1458
1458
  "zwj": "‍",
1459
1459
  "zwnj": "‌",
@@ -2226,87 +2226,87 @@ const u0 = /* @__PURE__ */ D0(a0), A0 = `{
2226
2226
  "dotless": [{ "i": "𝚤", "j": "𝚥" }]
2227
2227
  }
2228
2228
  `;
2229
- function i(n, l, r) {
2230
- let C = document.createElementNS("http://www.w3.org/1998/Math/MathML", n);
2231
- if (l && (C.textContent = l), r)
2232
- for (let t in r)
2233
- C.setAttribute(t, r[t]);
2234
- return C;
2229
+ function D(n, l, t) {
2230
+ let r = document.createElementNS("http://www.w3.org/1998/Math/MathML", n);
2231
+ if (l && (r.textContent = l), t)
2232
+ for (let i in t)
2233
+ r.setAttribute(i, t[i]);
2234
+ return r;
2235
2235
  }
2236
- const z = "mathvariant";
2237
- var F0 = new u0();
2238
- function s0(n) {
2239
- let l = /[a-zA-Z.]/, r = /[\(\)]/, C = /[ \t\n\r]+/, t = "", B = [], D = [], F = B, E = "";
2240
- n = n.replace(/(\\u\{[\dA-Fa-f]+\})/g, (s) => {
2241
- const p = parseInt(s.slice(3, -1), 16);
2242
- return String.fromCodePoint(p);
2236
+ const I = "mathvariant";
2237
+ var b0 = new p0();
2238
+ function E0(n) {
2239
+ let l = /[a-zA-Z]/, t = /[\(\)]/, r = /[ \t\n\r]+/, i = "", B = [], a = [], F = B, s = "";
2240
+ n = n.replace(/(\\u\{[\dA-Fa-f]+\})/g, (v) => {
2241
+ const g = parseInt(v.slice(3, -1), 16);
2242
+ return String.fromCodePoint(g);
2243
2243
  });
2244
- let f = [];
2245
- for (let s = 0; s < n.length; s++) {
2246
- const p = n[s];
2247
- if (p == '"' && n[s - 1] != "\\") {
2248
- t != "str" ? t = "str" : t = "";
2244
+ let b = [];
2245
+ for (let v = 0; v < n.length; v++) {
2246
+ const g = n[v];
2247
+ if (g == '"' && n[v - 1] != "\\") {
2248
+ i != "str" ? i = "str" : i = "";
2249
2249
  continue;
2250
2250
  }
2251
- t != "str" && (p == "(" && f.push(s), p == ")" && (f.length == 0 || n[s - 1] != "\\" && f.pop()));
2251
+ i != "str" && (g == "(" && b.push(v), g == ")" && (b.length == 0 || n[v - 1] != "\\" && b.pop()));
2252
2252
  }
2253
- let b = F0.splitGraphemes(n);
2254
- for (let s = 0; s < b.length; s++) {
2255
- const p = b[s];
2256
- if (p == '"' && b[s - 1] != "\\") {
2257
- t != "str" ? t = "str" : (F.push({ type: t, value: E }), t = "", E = "");
2253
+ let E = b0.splitGraphemes(n);
2254
+ for (let v = 0; v < E.length; v++) {
2255
+ const g = E[v];
2256
+ if (g == '"' && E[v - 1] != "\\") {
2257
+ i != "str" ? i = "str" : (F.push({ type: i, value: s }), i = "", s = "");
2258
2258
  continue;
2259
2259
  }
2260
- if (t == "str") {
2261
- E += p;
2260
+ if (i == "str") {
2261
+ s += g;
2262
2262
  continue;
2263
2263
  }
2264
- if (p.match(C) && (t = "blank"), t == "blank" && !p.match(C) && (F.push({ type: t, value: "" }), t = ""), t == "" && (!b[s - 1] || !b[s - 1].match(l)) && (!b[s + 1] || !b[s + 1].match(l)) && !p.match(r)) {
2265
- F.push({ type: "v", value: p });
2264
+ if (g.match(r) && (i = "blank"), i == "blank" && !g.match(r) && (F.push({ type: i, value: "" }), i = ""), i == "" && (!E[v - 1] || !E[v - 1].match(l)) && (!E[v + 1] || !E[v + 1].match(l)) && !g.match(t)) {
2265
+ F.push({ type: "v", value: g });
2266
2266
  continue;
2267
2267
  }
2268
- if (t == "" && !p.match(l) && !p.match(r)) {
2269
- F.push({ type: "v", value: p });
2268
+ if (i == "" && !g.match(l) && !g.match(t)) {
2269
+ F.push({ type: "v", value: g });
2270
2270
  continue;
2271
2271
  }
2272
- if ((b[s - 1] && b[s - 1].match(l) || b[s + 1] && b[s + 1].match(l)) && p.match(l) && (t = "f"), t == "f" && (E += p), t == "f" && (!b[s + 1] || !b[s + 1].match(l)) && (F.push({ type: t, value: E }), t = "", E = ""), p == "(")
2273
- if (f.includes(s) || b[s - 1] == "\\")
2274
- F.push({ type: "v", value: p });
2272
+ if ((E[v - 1] && E[v - 1].match(l) || E[v + 1] && E[v + 1].match(l)) && g.match(l) && (i = "f"), i == "f" && (s += g), i == "f" && (!E[v + 1] || !E[v + 1].match(l)) && (F.push({ type: i, value: s }), i = "", s = ""), g == "(")
2273
+ if (b.includes(v) || E[v - 1] == "\\")
2274
+ F.push({ type: "v", value: g });
2275
2275
  else {
2276
- D.push({ tree: F, close: !1 }), F.push({ type: "group", value: E, children: [] }), F = F.at(-1).children, E = "";
2276
+ a.push({ tree: F, close: !1 }), F.push({ type: "group", value: s, children: [] }), F = F.at(-1).children, s = "";
2277
2277
  continue;
2278
2278
  }
2279
- if (p == ")")
2280
- if (D.at(-1)) {
2281
- if (D.at(-1).close == !1) {
2282
- D.at(-1).close = !0, F = D.at(-1).tree, D.pop();
2279
+ if (g == ")")
2280
+ if (a.at(-1)) {
2281
+ if (a.at(-1).close == !1) {
2282
+ a.at(-1).close = !0, F = a.at(-1).tree, a.pop();
2283
2283
  continue;
2284
2284
  }
2285
2285
  } else
2286
- F.push({ type: "v", value: p });
2286
+ F.push({ type: "v", value: g });
2287
2287
  }
2288
2288
  return B;
2289
2289
  }
2290
- let X = JSON.parse(A0), I = {};
2290
+ let X = JSON.parse(f0), w = {};
2291
2291
  for (let n in X)
2292
2292
  if (typeof X[n] == "string")
2293
- I[n] = X[n];
2293
+ w[n] = X[n];
2294
2294
  else
2295
2295
  for (let l of X[n])
2296
2296
  if (typeof l == "string")
2297
- I[n] = l;
2297
+ w[n] = l;
2298
2298
  else {
2299
- I[n] || (I[n] = l[Object.keys(l)[0]]);
2300
- for (let r in l) {
2301
- I[`${n}.${r}`] = l[r];
2302
- let C = r.split(".");
2303
- for (let t = 1; t < C.length; t++) {
2304
- let B = C.slice(0, t).join(".");
2305
- l[B] || (I[`${n}.${B}`] = l[r]);
2299
+ w[n] || (w[n] = l[Object.keys(l)[0]]);
2300
+ for (let t in l) {
2301
+ w[`${n}.${t}`] = l[t];
2302
+ let r = t.split(".");
2303
+ for (let i = 1; i < r.length; i++) {
2304
+ let B = r.slice(0, i).join(".");
2305
+ l[B] || (w[`${n}.${B}`] = l[t]);
2306
2306
  }
2307
2307
  }
2308
2308
  }
2309
- let e = {
2309
+ let o = {
2310
2310
  "->": "arrow.r",
2311
2311
  "|->": "arrow.r.bar",
2312
2312
  "=>": "arrow.r.double",
@@ -2349,194 +2349,202 @@ let e = {
2349
2349
  "-": "minus",
2350
2350
  "'": "prime",
2351
2351
  "~": "space.nobreak"
2352
- }, o = 0;
2353
- for (let n in e)
2354
- n.length > o && (o = n.length);
2355
- let L = {
2352
+ }, d = 0;
2353
+ for (let n in o)
2354
+ n.length > d && (d = n.length);
2355
+ let O = {
2356
2356
  accent: (n, l) => {
2357
- let r = i("mrow");
2358
- r.append(g(n[0]));
2359
- let C = i("mrow");
2360
- C.append(g(n[1]));
2361
- let t = i("mover");
2362
- return t.setAttribute("accent", "true"), t.append(r, C), t;
2357
+ let t = D("mrow");
2358
+ t.append(h(n[0]));
2359
+ let r = D("mrow");
2360
+ r.append(h(n[1]));
2361
+ let i = D("mover");
2362
+ return i.setAttribute("accent", "true"), i.append(t, r), i;
2363
2363
  },
2364
2364
  attach: (n, l) => {
2365
- let r = i("mrow");
2366
- r.append(g(n[0]));
2367
- let C, t = i("mrow");
2368
- l.tl && t.append(g(l.tl));
2369
- let B = i("mrow");
2370
- l.bl && B.append(g(l.bl));
2371
- let D = i("mrow");
2372
- l.tr && D.append(g(l.tr));
2373
- let F = i("mrow");
2374
- if (l.br && F.append(g(l.br)), (l.tl || l.bl || l.tr || l.br) && (l.tl || l.bl ? (C = i("mmultiscripts"), C.append(r, F, D, i("mprescripts"), B, t)) : l.tr && l.br ? (C = i("msubsup"), C.append(r, F, D)) : l.tr ? (C = i("msup"), C.append(r, D)) : (C = i("msub"), C.append(r, F))), l.t || l.b) {
2375
- let E = i("munderover");
2376
- C ? E.append(C) : E.append(r);
2377
- let f = i("mrow");
2378
- l.t && f.append(g(l.t));
2379
- let b = i("mrow");
2380
- l.b && b.append(g(l.b)), E.append(b, f), C = E;
2365
+ let t = D("mrow");
2366
+ t.append(h(n[0]));
2367
+ let r, i = D("mrow");
2368
+ l.tl && i.append(h(l.tl));
2369
+ let B = D("mrow");
2370
+ l.bl && B.append(h(l.bl));
2371
+ let a = D("mrow");
2372
+ l.tr && a.append(h(l.tr));
2373
+ let F = D("mrow");
2374
+ if (l.br && F.append(h(l.br)), (l.tl || l.bl || l.tr || l.br) && (l.tl || l.bl ? (r = D("mmultiscripts"), r.append(t, F, a, D("mprescripts"), B, i)) : l.tr && l.br ? (r = D("msubsup"), r.append(t, F, a)) : l.tr ? (r = D("msup"), r.append(t, a)) : (r = D("msub"), r.append(t, F))), l.t || l.b) {
2375
+ let s = D("munderover");
2376
+ r ? s.append(r) : s.append(t);
2377
+ let b = D("mrow");
2378
+ l.t && b.append(h(l.t));
2379
+ let E = D("mrow");
2380
+ l.b && E.append(h(l.b)), s.append(E, b), r = s;
2381
2381
  }
2382
- return C;
2382
+ return r;
2383
2383
  },
2384
- scripts: (n, l) => g(n[0]),
2385
- limits: (n, l) => g(n[0]),
2384
+ scripts: (n, l) => h(n[0]),
2385
+ limits: (n, l) => h(n[0]),
2386
2386
  binom: (n, l) => {
2387
- let r = i("mrow"), C = i("mrow");
2388
- C.append(g(n[0]));
2389
- let t = i("mrow");
2390
- t.append(g(n[1]));
2391
- let B = i("mfrac", null, { linethickness: "0" });
2392
- B.append(C, t);
2393
- let D = i("mo", "("), F = i("mo", ")");
2394
- return r.append(D, B, F), r;
2387
+ let t = D("mrow"), r = D("mrow");
2388
+ r.append(h(n[0]));
2389
+ let i = D("mrow");
2390
+ i.append(h(n[1]));
2391
+ let B = D("mfrac", null, { linethickness: "0" });
2392
+ B.append(r, i);
2393
+ let a = D("mo", "("), F = D("mo", ")");
2394
+ return t.append(a, B, F), t;
2395
2395
  },
2396
2396
  cancel: (n, l) => {
2397
+ let t = D("mrow");
2398
+ const r = (B) => `linear-gradient(to ${B ? "left" : "right"} top, transparent 47.75%, currentColor 49.5%, currentColor 50.5%, transparent 52.25%)`;
2399
+ let i = "";
2400
+ return r0(l.cross) ? i = r(!0) + "," + r(!1) : r0(l.inverted) ? i = r(!1) : i = r(!0), t.style.backgroundImage = i, t.append(h(n[0])), t;
2397
2401
  },
2398
2402
  cases: (n, l) => {
2399
- var B, D;
2400
- let r = i("mrow"), C = i("mo", ((D = (B = l == null ? void 0 : l.delim) == null ? void 0 : B[0]) == null ? void 0 : D.value) || "{"), t = i("mtable", null, { columnalign: "left" });
2401
- for (let F of n) {
2402
- let E = i("mtr"), f = i("mtd");
2403
- f.append(g(F)), E.append(f), t.append(E);
2404
- }
2405
- return r.append(C, t), r;
2403
+ var B, a;
2404
+ let t = D("mrow"), r = D("mo", ((a = (B = l == null ? void 0 : l.delim) == null ? void 0 : B[0]) == null ? void 0 : a.value) || "{"), i = O.x_table(n, { cases: [] });
2405
+ return t.append(r, i), t;
2406
2406
  },
2407
2407
  frac: (n, l) => {
2408
2408
  console.log(n);
2409
- let r = i("mrow");
2410
- r.append(g(n[0]));
2411
- let C = i("mrow");
2412
- C.append(g(n[1]));
2413
- let t = i("mfrac");
2414
- return t.append(r, C), t;
2409
+ let t = D("mrow");
2410
+ t.append(h(n[0]));
2411
+ let r = D("mrow");
2412
+ r.append(h(n[1]));
2413
+ let i = D("mfrac");
2414
+ return i.append(t, r), i;
2415
2415
  },
2416
2416
  lr: (n, l) => {
2417
- let r = n[0], C, t;
2418
- for (let f = 0; f < r.length; f++) {
2419
- const b = r[f];
2420
- if (b.type != "blank") {
2421
- C = { c: [b], n: f };
2417
+ let t = n[0], r, i;
2418
+ for (let b = 0; b < t.length; b++) {
2419
+ const E = t[b];
2420
+ if (E.type != "blank") {
2421
+ r = { c: [E], n: b };
2422
2422
  break;
2423
2423
  }
2424
2424
  }
2425
- for (let f = r.length - 1; f >= 0; f--) {
2426
- const b = r[f];
2427
- if (b.type != "blank") {
2428
- t = { c: [b], n: f };
2425
+ for (let b = t.length - 1; b >= 0; b--) {
2426
+ const E = t[b];
2427
+ if (E.type != "blank") {
2428
+ i = { c: [E], n: b };
2429
2429
  break;
2430
2430
  }
2431
2431
  }
2432
2432
  let B = document.createDocumentFragment();
2433
- B.append(g(C.c));
2434
- let D = document.createDocumentFragment();
2435
- D.append(g(t.c));
2433
+ B.append(h(r.c));
2434
+ let a = document.createDocumentFragment();
2435
+ a.append(h(i.c));
2436
2436
  let F = document.createDocumentFragment();
2437
- F.append(g(r.slice(C.n + 1, t.n)));
2438
- let E = i("mrow");
2439
- return E.append(B, F, D), E;
2437
+ F.append(h(t.slice(r.n + 1, i.n)));
2438
+ let s = D("mrow");
2439
+ return s.append(B, F, a), s;
2440
2440
  },
2441
- mat: (n, l, r) => {
2442
- var f, b;
2443
- let C = ((b = (f = l == null ? void 0 : l.delim) == null ? void 0 : f[0]) == null ? void 0 : b.value) || "(", t = { "(": ["(", ")"], "[": ["[", "]"], "{": ["{", "}"], "|": ["|", "|"], "||": ["‖", "‖"] }, B = i("mrow"), D = i("mo", t[C][0]), F = i("mo", t[C][1]), E = i("mtable");
2444
- for (let s of r) {
2445
- let p = i("mtr");
2446
- for (let P of s) {
2447
- let O = i("mtd");
2448
- O.append(g(P)), p.append(O);
2441
+ mat: (n, l, t) => {
2442
+ var b, E;
2443
+ let r = ((E = (b = l == null ? void 0 : l.delim) == null ? void 0 : b[0]) == null ? void 0 : E.value) || "(", i = { "(": ["(", ")"], "[": ["[", "]"], "{": ["{", "}"], "|": ["|", "|"], "||": ["‖", "‖"] }, B = D("mrow"), a = D("mo", i[r][0]), F = D("mo", i[r][1]), s = D("mtable");
2444
+ for (let v of t) {
2445
+ let g = D("mtr");
2446
+ for (let M of v) {
2447
+ let S = D("mtd");
2448
+ S.append(h(M)), g.append(S);
2449
2449
  }
2450
- E.append(p);
2450
+ s.append(g);
2451
2451
  }
2452
- return B.append(D, E, F), B;
2452
+ return B.append(a, s, F), B;
2453
2453
  },
2454
2454
  root: (n, l) => {
2455
- let r = i("mrow");
2456
- r.append(g(n[0]));
2457
- let C = i("mrow");
2458
- C.append(g(n[1]));
2459
- let t = i("mroot");
2460
- return t.append(C, r), t;
2455
+ let t = D("mrow");
2456
+ t.append(h(n[0]));
2457
+ let r = D("mrow");
2458
+ r.append(h(n[1]));
2459
+ let i = D("mroot");
2460
+ return i.append(r, t), i;
2461
2461
  },
2462
- sqrt: (n, l) => L.root([[], n[0]], null),
2462
+ sqrt: (n, l) => O.root([[], n[0]], null),
2463
2463
  display: (n, l) => {
2464
+ let t = D("mrow", null, { displaystyle: "true" });
2465
+ return t.append(h(n[0])), t;
2464
2466
  },
2465
2467
  inline: (n, l) => {
2468
+ let t = D("mrow", null, { displaystyle: "false", scriptlevel: "0" });
2469
+ return t.append(h(n[0])), t;
2466
2470
  },
2467
2471
  script: (n, l) => {
2472
+ let t = D("mrow", null, { displaystyle: "false", scriptlevel: "1" });
2473
+ return t.append(h(n[0])), t;
2468
2474
  },
2469
2475
  sscript: (n, l) => {
2476
+ let t = D("mrow", null, { displaystyle: "false", scriptlevel: "2" });
2477
+ return t.append(h(n[0])), t;
2470
2478
  },
2471
2479
  upright: (n, l) => {
2472
- let r = i("mrow");
2473
- return r.append(g(n[0])), r.querySelectorAll("mi").forEach((C) => {
2474
- C.getAttribute(z) || C.setAttribute(z, "normal");
2475
- }), r.querySelectorAll("ms").forEach((C) => {
2476
- C.getAttribute(z) || C.setAttribute(z, "normal");
2477
- }), r;
2480
+ let t = D("mrow");
2481
+ return t.append(h(n[0])), t.querySelectorAll("mi").forEach((r) => {
2482
+ r.getAttribute(I) || r.setAttribute(I, "normal");
2483
+ }), t.querySelectorAll("ms").forEach((r) => {
2484
+ r.getAttribute(I) || r.setAttribute(I, "normal");
2485
+ }), t;
2478
2486
  },
2479
2487
  italic: (n, l) => {
2480
- let r = i("mrow");
2481
- return r.querySelectorAll("mi").forEach((C) => {
2482
- C.getAttribute(z) || C.setAttribute(z, "italic");
2483
- }), r.querySelectorAll("ms").forEach((C) => {
2484
- C.getAttribute(z) || C.setAttribute(z, "italic");
2485
- }), r.append(g(n[0])), r;
2488
+ let t = D("mrow");
2489
+ return t.querySelectorAll("mi").forEach((r) => {
2490
+ r.getAttribute(I) || r.setAttribute(I, "italic");
2491
+ }), t.querySelectorAll("ms").forEach((r) => {
2492
+ r.getAttribute(I) || r.setAttribute(I, "italic");
2493
+ }), t.append(h(n[0])), t;
2486
2494
  },
2487
2495
  bold: (n, l) => {
2488
- let r = i("mrow");
2489
- return r.style.fontWeight = "bold", r.append(g(n[0])), r;
2490
- },
2491
- op: (n, l) => {
2492
- let r = i("mrow"), C = i("ms", n[0][0].value);
2493
- return r.append(C), r;
2496
+ let t = D("mrow");
2497
+ return t.style.fontWeight = "bold", t.append(h(n[0])), t;
2494
2498
  },
2495
- underline: (n, l) => H("under", n[0], "_", n == null ? void 0 : n[1]),
2496
- overline: (n, l) => H("over", n[0], "‾", n == null ? void 0 : n[1]),
2497
- underbrace: (n, l) => H("under", n[0], "⏟", n == null ? void 0 : n[1]),
2498
- overbrace: (n, l) => H("over", n[0], "⏞", n == null ? void 0 : n[1]),
2499
- underbracket: (n, l) => H("under", n[0], "⎵", n == null ? void 0 : n[1]),
2500
- overbracket: (n, l) => H("over", n[0], "⎴", n == null ? void 0 : n[1]),
2501
- serif: (n, l) => {
2502
- },
2503
- sans: (n, l) => {
2504
- },
2505
- frak: (n, l) => {
2506
- },
2507
- mono: (n, l) => {
2508
- },
2509
- bb: (n, l) => {
2510
- },
2511
- cal: (n, l) => {
2499
+ op: (n, l, t, r) => {
2500
+ let i = D("mrow"), B = D("ms", c(n[0][0].value, r));
2501
+ return i.append(B), i;
2512
2502
  },
2503
+ underline: (n, l) => T("under", n[0], "_", n == null ? void 0 : n[1]),
2504
+ overline: (n, l) => T("over", n[0], "‾", n == null ? void 0 : n[1]),
2505
+ underbrace: (n, l) => T("under", n[0], "⏟", n == null ? void 0 : n[1]),
2506
+ overbrace: (n, l) => T("over", n[0], "⏞", n == null ? void 0 : n[1]),
2507
+ underbracket: (n, l) => T("under", n[0], "⎵", n == null ? void 0 : n[1]),
2508
+ overbracket: (n, l) => T("over", n[0], "⎴", n == null ? void 0 : n[1]),
2509
+ serif: (n, l) => h(n[0], "serif"),
2510
+ sans: (n, l) => h(n[0], "sans"),
2511
+ frak: (n, l) => h(n[0], "frak"),
2512
+ mono: (n, l) => h(n[0], "mono"),
2513
+ bb: (n, l) => h(n[0], "bb"),
2514
+ cal: (n, l) => h(n[0], "cal"),
2513
2515
  vec: (n, l) => {
2514
- var E, f;
2515
- let r = ((f = (E = l == null ? void 0 : l.delim) == null ? void 0 : E[0]) == null ? void 0 : f.value) || "(", C = { "(": ["(", ")"], "[": ["[", "]"], "{": ["{", "}"], "|": ["|", "|"], "||": ["‖", "‖"] }, t = i("mrow"), B = i("mo", C[r][0]), D = i("mo", C[r][1]), F = i("mtable");
2516
- for (let b of n) {
2517
- let s = i("mtr");
2518
- s.append(g(b)), F.append(s);
2516
+ var s, b;
2517
+ let t = ((b = (s = l == null ? void 0 : l.delim) == null ? void 0 : s[0]) == null ? void 0 : b.value) || "(", r = { "(": ["(", ")"], "[": ["[", "]"], "{": ["{", "}"], "|": ["|", "|"], "||": ["‖", "‖"] }, i = D("mrow"), B = D("mo", r[t][0]), a = D("mo", r[t][1]), F = D("mtable");
2518
+ for (let E of n) {
2519
+ let v = D("mtr");
2520
+ v.append(h(E)), F.append(v);
2519
2521
  }
2520
- return t.append(B, F, D), t;
2522
+ return i.append(B, F, a), i;
2521
2523
  },
2522
2524
  // 额外
2523
2525
  //
2524
- x_table: (n) => {
2525
- let l = i("mtable");
2526
- for (let r of n) {
2527
- let C = i("mtr"), t = [], B = [];
2528
- for (let D = 0; D < r.length; D++)
2529
- !r[D].esc && r[D].value == "&" ? B.length > 0 && (t.push(B), B = []) : B.push(r[D]);
2530
- B.length > 0 && t.push(B);
2531
- for (let D of t) {
2532
- let F = i("mtd");
2533
- C.append(F), F.append(g(D));
2526
+ x_table: (n, l) => {
2527
+ let t = 0, r = D("mtable");
2528
+ for (let B of n) {
2529
+ let a = D("mtr"), F = [], s = [];
2530
+ for (let b = 0; b < B.length; b++)
2531
+ !B[b].esc && B[b].value == "&" ? s.length > 0 && (F.push(s), s = []) : s.push(B[b]);
2532
+ s.length > 0 && F.push(s), F.length > t && (t = F.length);
2533
+ for (let b of F) {
2534
+ let E = D("mtd");
2535
+ a.append(E), E.append(h(b));
2534
2536
  }
2535
- l.append(C);
2537
+ r.append(a);
2536
2538
  }
2537
- return l;
2539
+ let i = [];
2540
+ if (l.cases)
2541
+ i.push("left");
2542
+ else
2543
+ for (let B = 0; B < t; B++)
2544
+ B % 2 == 0 ? i.push("right") : i.push("left");
2545
+ return r.setAttribute("columnalign", i.join(" ")), r;
2538
2546
  }
2539
- }, r0 = [
2547
+ }, i0 = [
2540
2548
  { id: "arccos" },
2541
2549
  { id: "arcsin" },
2542
2550
  { id: "arctan" },
@@ -2574,23 +2582,23 @@ let L = {
2574
2582
  { id: "liminf", str: "lim inf", limits: !0 },
2575
2583
  { id: "limsup", str: "lim sup", limits: !0 }
2576
2584
  ];
2577
- function f0() {
2578
- for (let n of r0)
2579
- L[n.id] = (l) => {
2580
- let r = L.op([[{ type: "str", value: n.str || n.id }]], {});
2585
+ function h0() {
2586
+ for (let n of i0)
2587
+ O[n.id] = (l, t, r, i) => {
2588
+ let B = O.op([[{ type: "str", value: n.str || n.id }]], {}, null, i);
2581
2589
  if (l) {
2582
- let C = document.createDocumentFragment();
2583
- return C.append(r, i0(l[0])), C;
2590
+ let a = document.createDocumentFragment();
2591
+ return a.append(B, D0(l[0])), a;
2584
2592
  } else
2585
- return r;
2593
+ return B;
2586
2594
  };
2587
2595
  }
2588
- f0();
2589
- let C0 = [], B0 = ["∏", "∐", "∑", "⋀", "⋁", "⋂", "⋃", "⨀", "⨁", "⨂", "⨃", "⨄", "⨅", "⨆"];
2590
- for (let n in I)
2591
- for (let l of B0)
2592
- I[n] == l && C0.push(n);
2593
- function p0() {
2596
+ h0();
2597
+ let a0 = [], u0 = ["∏", "∐", "∑", "⋀", "⋁", "⋂", "⋃", "⨀", "⨁", "⨂", "⨃", "⨄", "⨅", "⨆"];
2598
+ for (let n in w)
2599
+ for (let l of u0)
2600
+ w[n] == l && a0.push(n);
2601
+ function m0() {
2594
2602
  const n = [
2595
2603
  "grave",
2596
2604
  "acute",
@@ -2609,378 +2617,428 @@ function p0() {
2609
2617
  "arrow.l"
2610
2618
  ];
2611
2619
  for (let l of n)
2612
- L[l] = (r) => L.accent([r[0], [{ type: "f", value: l }]], {});
2620
+ O[l] = (t) => O.accent([t[0], [{ type: "f", value: l }]], {});
2613
2621
  }
2614
- p0();
2615
- function E0() {
2622
+ m0();
2623
+ function v0() {
2616
2624
  let n = [
2617
- { name: "abs", l: j("|"), r: j("|") },
2618
- { name: "norm", l: j("‖"), r: j("‖") },
2619
- { name: "floor", l: j("⌊"), r: j("⌋") },
2620
- { name: "ceil", l: j("⌈"), r: j("⌉") },
2621
- { name: "round", l: j("⌊"), r: j("⌉") }
2625
+ { name: "abs", l: N("|"), r: N("|") },
2626
+ { name: "norm", l: N("‖"), r: N("‖") },
2627
+ { name: "floor", l: N("⌊"), r: N("⌋") },
2628
+ { name: "ceil", l: N("⌈"), r: N("⌉") },
2629
+ { name: "round", l: N("⌊"), r: N("⌉") }
2622
2630
  ];
2623
2631
  for (let l of n)
2624
- L[l.name] = (r) => L.lr([[l.l, ...r[0], l.r]], {});
2632
+ O[l.name] = (t) => O.lr([[l.l, ...t[0], l.r]], {});
2625
2633
  }
2626
- E0();
2627
- function H(n, l, r, C) {
2628
- let t = n == "under" ? i("munder", null, { accentunder: "true" }) : i("mover", null, { accent: "true" }), B = i("mrow");
2629
- if (B.append(g(l)), C) {
2630
- let D = i("mrow");
2631
- D.append(g(C));
2632
- let F = n == "under" ? i("munder") : i("mover"), E = i("mo", r);
2633
- F.append(E, D), t.append(B, F);
2634
+ v0();
2635
+ function T(n, l, t, r) {
2636
+ let i = n == "under" ? D("munder", null, { accentunder: "true" }) : D("mover", null, { accent: "true" }), B = D("mrow");
2637
+ if (B.append(h(l)), r) {
2638
+ let a = D("mrow");
2639
+ a.append(h(r));
2640
+ let F = n == "under" ? D("munder") : D("mover"), s = D("mo", t);
2641
+ F.append(s, a), i.append(B, F);
2634
2642
  } else {
2635
- let D = i("mo", r);
2636
- t.append(B, D);
2643
+ let a = D("mo", t);
2644
+ i.append(B, a);
2637
2645
  }
2638
- return t;
2646
+ return i;
2639
2647
  }
2640
- function i0(n) {
2641
- let l = i("mrow"), r = i("mo");
2642
- r.textContent = "(";
2643
- let C = g(n), t = i("mo");
2644
- return t.textContent = ")", l.append(r, C, t), l;
2648
+ function D0(n) {
2649
+ let l = D("mrow"), t = D("mo");
2650
+ t.textContent = "(";
2651
+ let r = h(n), i = D("mo");
2652
+ return i.textContent = ")", l.append(t, r, i), l;
2645
2653
  }
2646
- function S(n) {
2654
+ function q(n) {
2647
2655
  return n.type == "group" ? n.children : [n];
2648
2656
  }
2649
- function b0(n) {
2657
+ function g0(n) {
2650
2658
  return [{ type: "group", value: "", children: n }];
2651
2659
  }
2652
- function W(n) {
2660
+ function V(n) {
2653
2661
  return n ? n.value == "/" && !n.esc : !1;
2654
2662
  }
2655
- function n0(n) {
2663
+ function t0(n) {
2656
2664
  return n ? n.value == "br" && n.esc : !1;
2657
2665
  }
2658
2666
  function Q(n) {
2659
2667
  if (n.length == 1) {
2660
2668
  let l = n[0];
2661
2669
  if (l.type == "f") {
2662
- if (C0.includes(l.value))
2670
+ if (a0.includes(l.value))
2663
2671
  return !0;
2664
- for (let r of r0)
2665
- if (r.limits && l.value == r.id)
2672
+ for (let t of i0)
2673
+ if (t.limits && l.value == t.id)
2666
2674
  return !0;
2667
2675
  if (l.value == "scripts")
2668
2676
  return !1;
2669
- l.value == "op";
2677
+ if (l.value == "op") {
2678
+ let { dic: t } = A0(l), r = "";
2679
+ if (t.limits)
2680
+ for (let i of t.limits)
2681
+ r += i.value;
2682
+ return r == "#true";
2683
+ }
2670
2684
  }
2671
- if (l.type == "v" && B0.includes(l.value))
2685
+ if (l.type == "v" && u0.includes(l.value))
2672
2686
  return !0;
2673
2687
  } else
2674
2688
  return !1;
2675
2689
  }
2676
- function U(n, l) {
2690
+ function H(n, l) {
2677
2691
  return n.value == l && n.type == "v" && !n.esc;
2678
2692
  }
2679
- let T = { type: "v", value: "," };
2680
- function j(n) {
2693
+ function Y(n) {
2694
+ return n && n.type == "v" && n.value == ".";
2695
+ }
2696
+ let Z = { type: "v", value: "," };
2697
+ function N(n) {
2681
2698
  return { type: "v", value: n };
2682
2699
  }
2683
- function Y(n) {
2700
+ function e(n) {
2684
2701
  let l = [];
2685
- for (let r in n) {
2686
- l.push({ type: "f", value: r }), l.push({ type: "v", value: ":" });
2687
- for (let C of n[r])
2688
- C.type == "v" && C.value == "," && (C.esc = !0);
2689
- l.push(...n[r]), Number(r) + 1 != Object.keys(n).length && l.push(T);
2702
+ for (let t in n) {
2703
+ l.push({ type: "f", value: t }), l.push({ type: "v", value: ":" });
2704
+ for (let r of n[t])
2705
+ r.type == "v" && r.value == "," && (r.esc = !0);
2706
+ l.push(...n[t]), Number(t) + 1 != Object.keys(n).length && l.push(Z);
2690
2707
  }
2691
2708
  return l;
2692
2709
  }
2693
- function l0(n) {
2694
- var l, r, C, t, B, D, F, E, f, b, s, p, P, O, K, Z, V, J, R, M, $;
2710
+ function r0(n) {
2711
+ let l = 0;
2712
+ return !!(n && (n[0].type == "blank" && l++, n[l] && n[l].type == "v" && n[l].value == "#" && n[l + 1] && n[l + 1].type == "f" && n[l + 1].value == "true"));
2713
+ }
2714
+ function C0(n) {
2715
+ var l, t, r, i, B, a, F, s, b, E, v, g, M, S, z, k, P, $, L, _, G, R, J, W, U, K;
2695
2716
  {
2696
- let A = [], h = /[0-9]/, N = "";
2697
- for (let y in n) {
2698
- let u = Number(y), k = n[u];
2699
- k.value.match(h) || n[u - 1] && n[u - 1].value.match(h) && k.value == "." && n[u + 1] && n[u + 1].value.match(h) ? N += k.value : A.push(k), k.value.match(h) && (!n[u + 1] || !n[u + 1].value.match(/[0-9]/)) && !(((l = n[u + 1]) == null ? void 0 : l.value) == "." && ((r = n[u + 2]) != null && r.value.match(h))) && (A.push({ type: "v", value: N }), N = "");
2717
+ let f = [], p = /[0-9]/, x = "";
2718
+ for (let C = 0; C < n.length; C++) {
2719
+ let A = n[C];
2720
+ A.value.match(p) || (l = n[C - 1]) != null && l.value.match(p) && Y(A) && ((t = n[C + 1]) != null && t.value.match(p)) ? x += A.value : f.push(A), A.value.match(p) && (!n[C + 1] || !n[C + 1].value.match(p)) && !(Y(n[C + 1]) && ((r = n[C + 2]) != null && r.value.match(p))) && (f.push({ type: "v", value: x }), x = "");
2700
2721
  }
2701
- n = A;
2722
+ n = f;
2702
2723
  }
2703
2724
  {
2704
- let A = [], h = 0;
2705
- for (let N in n) {
2706
- if (h > 0) {
2707
- h--;
2708
- continue;
2709
- }
2710
- let y = Number(N), u = n[y];
2711
- if (((C = n == null ? void 0 : n[y - 1]) == null ? void 0 : C.value) != "\\")
2712
- if (u.type == "v") {
2713
- let k = y, w = u.value, x = [];
2714
- for (e[w] && x.push(w); ((t = n == null ? void 0 : n[k + 1]) == null ? void 0 : t.type) == "v" && w.length <= o; )
2715
- w += n[k + 1].value, e[w] && x.push(w), k++;
2716
- if (x.length) {
2717
- let a = { type: "f", value: e[x.at(-1)] };
2718
- A.push(a), h = x.at(-1).length - 1;
2725
+ let f = [];
2726
+ for (let p = 0; p < n.length; p++) {
2727
+ let x = n[p];
2728
+ if (((i = n == null ? void 0 : n[p - 1]) == null ? void 0 : i.value) != "\\")
2729
+ if (x.type == "v") {
2730
+ let C = p, A = x.value, u = [];
2731
+ for (o[A] && u.push(A); ((B = n == null ? void 0 : n[C + 1]) == null ? void 0 : B.type) == "v" && A.length <= d; )
2732
+ A += n[C + 1].value, o[A] && u.push(A), C++;
2733
+ if (u.length) {
2734
+ let m = { type: "f", value: o[u.at(-1)] };
2735
+ f.push(m), p += u.at(-1).length - 1;
2719
2736
  } else
2720
- A.push(u);
2737
+ f.push(x);
2721
2738
  } else
2722
- A.push(u);
2739
+ f.push(x);
2723
2740
  else
2724
- A.push(u);
2741
+ f.push(x);
2725
2742
  }
2726
- n = A;
2743
+ n = f;
2727
2744
  }
2728
2745
  {
2729
- let A = [], h = 0;
2730
- for (let N in n) {
2731
- if (h > 0) {
2732
- h--;
2733
- continue;
2734
- }
2735
- let y = Number(N), u = n[y];
2736
- if (u.value == "\\" && u.type == "v") {
2737
- if (n != null && n[y + 1]) {
2738
- let k = n[y + 1];
2739
- if (k.value == "\\" && k.type == "v")
2740
- A.push({ type: "v", value: "\\" }), h = 1;
2741
- else if (k.type == "blank")
2742
- A.push({ type: "v", value: "br", esc: !0 }), h = 1;
2743
- else if (k.type == "f") {
2744
- let w = k.value;
2745
- A.push({ type: "v", value: w[0] }), A.push({ type: w.length == 2 ? "v" : "f", value: w.slice(1) }), h = 1;
2746
+ let f = [];
2747
+ for (let p = 0; p < n.length; p++) {
2748
+ let x = n[p];
2749
+ if (x.value == "\\" && x.type == "v") {
2750
+ if (n != null && n[p + 1]) {
2751
+ let C = n[p + 1];
2752
+ if (C.value == "\\" && C.type == "v")
2753
+ f.push({ type: "v", value: "\\" }), p++;
2754
+ else if (C.type == "blank")
2755
+ f.push({ type: "v", value: "br", esc: !0 }), p++;
2756
+ else if (C.type == "f") {
2757
+ let A = C.value;
2758
+ f.push({ type: "v", value: A[0] }), f.push({ type: A.length == 2 ? "v" : "f", value: A.slice(1) }), p++;
2746
2759
  } else {
2747
- let w = k;
2748
- w.esc = !0, A.push(w), h = 1;
2760
+ let A = C;
2761
+ A.esc = !0, f.push(A), p++;
2749
2762
  }
2750
2763
  }
2751
2764
  } else
2752
- A.push(u);
2765
+ f.push(x);
2766
+ }
2767
+ n = f;
2768
+ }
2769
+ {
2770
+ let f = [];
2771
+ for (let p = 0; p < n.length; p++) {
2772
+ let x = n[p];
2773
+ x.type == "v" && ((a = n == null ? void 0 : n[p + 1]) == null ? void 0 : a.type) == "blank" && ((F = n == null ? void 0 : n[p + 2]) == null ? void 0 : F.type) == "str" ? (f.push(x), f.push({ type: "f", value: "space" })) : x.type == "str" && ((s = n == null ? void 0 : n[p + 1]) == null ? void 0 : s.type) == "blank" && ((b = n == null ? void 0 : n[p + 2]) == null ? void 0 : b.type) == "v" ? (f.push(x), f.push({ type: "f", value: "space" })) : f.push(x);
2753
2774
  }
2754
- n = A;
2775
+ n = f;
2755
2776
  }
2756
2777
  {
2757
- let A = [], h = 0;
2758
- for (let N in n) {
2759
- if (h > 0) {
2760
- h--;
2778
+ let f = [], p = "";
2779
+ for (let x = 0; x < n.length; x++) {
2780
+ let C = n[x];
2781
+ if (C.type == "f" && Y(n[x + 1])) {
2782
+ p += C.value + ".", x++;
2761
2783
  continue;
2762
- }
2763
- let y = Number(N), u = n[y];
2764
- if (u.type == "f" && n[y + 1] && n[y + 1].type == "group") {
2765
- u.children = n[y + 1].children;
2766
- for (let k in u.children)
2767
- u.children[k].value == "\\" && u.children[k].type == "v" && u.children[Number(k) + 1] && (u.children[Number(k) + 1].esc = !0);
2768
- A.push(u), h = 1;
2784
+ } else
2785
+ p && C.type == "f" ? (p += C.value, Y(n[x + 1]) || (f.push({ type: "f", value: p }), p = "")) : f.push(C);
2786
+ }
2787
+ n = f;
2788
+ }
2789
+ {
2790
+ let f = [];
2791
+ for (let p = 0; p < n.length; p++) {
2792
+ let x = n[p];
2793
+ if (x.type == "f" && n[p + 1] && n[p + 1].type == "group") {
2794
+ x.children = n[p + 1].children;
2795
+ for (let C in x.children)
2796
+ x.children[C].value == "\\" && x.children[C].type == "v" && x.children[Number(C) + 1] && (x.children[Number(C) + 1].esc = !0);
2797
+ f.push(x), p++;
2769
2798
  continue;
2770
2799
  } else
2771
- A.push(u);
2800
+ f.push(x);
2772
2801
  }
2773
- n = A;
2802
+ n = f;
2774
2803
  }
2775
2804
  {
2776
- let A = [];
2777
- for (let h of n)
2778
- h.type != "blank" && A.push(h);
2779
- n = A;
2805
+ let f = [];
2806
+ for (let p of n)
2807
+ p.type != "blank" && f.push(p);
2808
+ n = f;
2780
2809
  }
2781
2810
  {
2782
- let A = [], h = NaN;
2783
- for (let u = 0; u < n.length; u++) {
2784
- const k = n[u];
2785
- k.value != "^" && k.value != "_" && ((((B = n[u + 1]) == null ? void 0 : B.value) == "^" || ((D = n[u + 1]) == null ? void 0 : D.value) == "_") && !(((F = n[u - 1]) == null ? void 0 : F.value) == "^" || ((E = n[u - 1]) == null ? void 0 : E.value) == "_") && (h || (h = u)), (((f = n[u - 1]) == null ? void 0 : f.value) == "^" || ((b = n[u - 1]) == null ? void 0 : b.value) == "_") && !(((s = n[u + 1]) == null ? void 0 : s.value) == "^" || ((p = n[u + 1]) == null ? void 0 : p.value) == "_") && (A.push([h, u]), h = NaN));
2811
+ let f = [], p = NaN;
2812
+ for (let C = 0; C < n.length; C++) {
2813
+ const A = n[C];
2814
+ A.value != "^" && A.value != "_" && ((((E = n[C + 1]) == null ? void 0 : E.value) == "^" || ((v = n[C + 1]) == null ? void 0 : v.value) == "_") && !(((g = n[C - 1]) == null ? void 0 : g.value) == "^" || ((M = n[C - 1]) == null ? void 0 : M.value) == "_") && (p || (p = C)), (((S = n[C - 1]) == null ? void 0 : S.value) == "^" || ((z = n[C - 1]) == null ? void 0 : z.value) == "_") && !(((k = n[C + 1]) == null ? void 0 : k.value) == "^" || ((P = n[C + 1]) == null ? void 0 : P.value) == "_") && (f.push([p, C]), p = NaN));
2786
2815
  }
2787
- let N = [], y = 0;
2788
- for (let u in n) {
2789
- if (y > 0) {
2790
- y--;
2791
- continue;
2792
- }
2793
- if (Number(u) == ((P = A == null ? void 0 : A[0]) == null ? void 0 : P[0])) {
2816
+ let x = [];
2817
+ for (let C = 0; C < n.length; C++) {
2818
+ if (C == (($ = f == null ? void 0 : f[0]) == null ? void 0 : $[0])) {
2794
2819
  {
2795
- let w = 0, x = n[A[0][1]];
2796
- for (let a = A[0][1]; a >= A[0][0]; a--) {
2797
- if (w > 0) {
2798
- w--;
2799
- continue;
2800
- }
2801
- if (((O = n[a - 1]) == null ? void 0 : O.value) == "^" && ((K = n[a - 3]) == null ? void 0 : K.value) == "_") {
2802
- let m = Q([n[a - 4]]) ? { t: S(x), b: S(n[a - 2]) } : { tr: S(x), br: S(n[a - 2]) };
2803
- x = {
2820
+ let A = n[f[0][1]];
2821
+ for (let u = f[0][1]; u >= f[0][0]; u--) {
2822
+ if (((L = n[u - 1]) == null ? void 0 : L.value) == "^" && ((_ = n[u - 3]) == null ? void 0 : _.value) == "_") {
2823
+ let m = Q([n[u - 4]]) ? { t: q(A), b: q(n[u - 2]) } : { tr: q(A), br: q(n[u - 2]) };
2824
+ A = {
2804
2825
  type: "f",
2805
2826
  value: "attach",
2806
- children: [n[a - 4], T, ...Y(m)]
2807
- }, w = 4 - 1;
2827
+ children: [n[u - 4], Z, ...e(m)]
2828
+ }, u -= 4 - 1;
2808
2829
  continue;
2809
2830
  }
2810
- if (((Z = n[a - 1]) == null ? void 0 : Z.value) == "_" && ((V = n[a - 3]) == null ? void 0 : V.value) == "^") {
2811
- let m = Q([n[a - 4]]) ? { t: S(n[a - 2]), b: S(x) } : { tr: S(n[a - 2]), br: S(x) };
2812
- x = {
2831
+ if (((G = n[u - 1]) == null ? void 0 : G.value) == "_" && ((R = n[u - 3]) == null ? void 0 : R.value) == "^") {
2832
+ let m = Q([n[u - 4]]) ? { t: q(n[u - 2]), b: q(A) } : { tr: q(n[u - 2]), br: q(A) };
2833
+ A = {
2813
2834
  type: "f",
2814
2835
  value: "attach",
2815
- children: [n[a - 4], T, ...Y(m)]
2816
- }, w = 4 - 1;
2836
+ children: [n[u - 4], Z, ...e(m)]
2837
+ }, u -= 4 - 1;
2817
2838
  continue;
2818
2839
  }
2819
- if (((J = n[a - 1]) == null ? void 0 : J.value) == "^") {
2820
- let m = Q([n[a - 2]]) ? { t: S(x) } : { tr: S(x) };
2821
- x = {
2840
+ if (((J = n[u - 1]) == null ? void 0 : J.value) == "^") {
2841
+ let m = Q([n[u - 2]]) ? { t: q(A) } : { tr: q(A) };
2842
+ A = {
2822
2843
  type: "f",
2823
2844
  value: "attach",
2824
- children: [n[a - 2], T, ...Y(m)]
2825
- }, w = 2 - 1;
2845
+ children: [n[u - 2], Z, ...e(m)]
2846
+ }, u -= 2 - 1;
2826
2847
  continue;
2827
2848
  }
2828
- if (((R = n[a - 1]) == null ? void 0 : R.value) == "_") {
2829
- let m = Q([n[a - 2]]) ? { b: S(x) } : { br: S(x) };
2830
- x = {
2849
+ if (((W = n[u - 1]) == null ? void 0 : W.value) == "_") {
2850
+ let m = Q([n[u - 2]]) ? { b: q(A) } : { br: q(A) };
2851
+ A = {
2831
2852
  type: "f",
2832
2853
  value: "attach",
2833
- children: [n[a - 2], T, ...Y(m)]
2834
- }, w = 2 - 1;
2854
+ children: [n[u - 2], Z, ...e(m)]
2855
+ }, u -= 2 - 1;
2835
2856
  continue;
2836
2857
  }
2837
2858
  }
2838
- N.push(x);
2859
+ x.push(A);
2839
2860
  }
2840
- y = A[0][1] - A[0][0], A = A.slice(1);
2861
+ C += f[0][1] - f[0][0], f = f.slice(1);
2841
2862
  continue;
2842
2863
  }
2843
- N.push(n[u]);
2864
+ x.push(n[C]);
2844
2865
  }
2845
- n = N;
2866
+ n = x;
2846
2867
  }
2847
2868
  {
2848
- let A = [], h = NaN;
2849
- for (let u = 0; u < n.length; u++) {
2850
- const k = n[u];
2851
- W(k) || (W(n[u + 1]) && !W(n[u - 1]) && (h || (h = u)), W(n[u - 1]) && !W(n[u + 1]) && (A.push([h, u]), h = NaN));
2869
+ let f = [], p = NaN;
2870
+ for (let C = 0; C < n.length; C++) {
2871
+ const A = n[C];
2872
+ V(A) || (V(n[C + 1]) && !V(n[C - 1]) && (p || (p = C)), V(n[C - 1]) && !V(n[C + 1]) && (f.push([p, C]), p = NaN));
2852
2873
  }
2853
- let N = [], y = 0;
2854
- for (let u in n) {
2855
- if (y > 0) {
2856
- y--;
2857
- continue;
2858
- }
2859
- if (Number(u) == ((M = A == null ? void 0 : A[0]) == null ? void 0 : M[0])) {
2874
+ let x = [];
2875
+ for (let C = 0; C < n.length; C++) {
2876
+ if (C == ((U = f == null ? void 0 : f[0]) == null ? void 0 : U[0])) {
2860
2877
  {
2861
- let w = 0, x = n[A[0][0]];
2862
- for (let a = A[0][0]; a <= A[0][1]; a++) {
2863
- if (w > 0) {
2864
- w--;
2865
- continue;
2866
- }
2867
- if ((($ = n[a + 1]) == null ? void 0 : $.value) == "/") {
2868
- x = {
2878
+ let A = n[f[0][0]];
2879
+ for (let u = f[0][0]; u <= f[0][1]; u++)
2880
+ if (((K = n[u + 1]) == null ? void 0 : K.value) == "/") {
2881
+ A = {
2869
2882
  type: "f",
2870
2883
  value: "frac",
2871
- children: [...S(x), T, ...S(n[a + 2])]
2872
- }, w = 2 - 1;
2884
+ children: [...q(A), Z, ...q(n[u + 2])]
2885
+ }, u += 2 - 1;
2873
2886
  continue;
2874
2887
  }
2875
- }
2876
- console.log(1, x), N.push(x);
2888
+ console.log(1, A), x.push(A);
2877
2889
  }
2878
- y = A[0][1] - A[0][0], A.splice(0, 1);
2890
+ C += f[0][1] - f[0][0], f.splice(0, 1);
2879
2891
  continue;
2880
2892
  }
2881
- N.push(n[u]);
2893
+ x.push(n[C]);
2882
2894
  }
2883
- n = N;
2895
+ n = x;
2884
2896
  }
2885
2897
  return n;
2886
2898
  }
2887
- function g(n) {
2888
- let l = document.createDocumentFragment();
2889
- n = l0(n);
2899
+ function A0(n) {
2900
+ let l = "array", t = [], r = [], i = [], B = [];
2901
+ for (let F in n.children) {
2902
+ const s = n.children[F];
2903
+ if (Number(F) + 1 == n.children.length) {
2904
+ if (s.type == "blank" && n.children[Number(F) - 1].value.match(/[,;]/))
2905
+ break;
2906
+ !H(s, ",") && !H(s, ";") && B.push(s), l == "dic" ? (r.push(B), B = []) : t.push(B), i.length && (i.push(t), t = []), B = [];
2907
+ } else
2908
+ H(s, ",") ? (l == "dic" ? (r.push(B), l = "array") : t.push(B), B = []) : H(s, ";") ? (t.push(B), B = [], i.push(t), t = []) : (B.push(s), H(s, ":") && (l = "dic"));
2909
+ }
2910
+ let a = {};
2911
+ for (let F of r) {
2912
+ let s = "", b = [];
2913
+ for (let E of F)
2914
+ s ? E.value != ":" && b.push(E) : s = E.value;
2915
+ a[s] = b;
2916
+ }
2917
+ return { attr: t, dic: a, array: i };
2918
+ }
2919
+ function c(n, l = "serif") {
2920
+ function t(r) {
2921
+ return "abcdefghijklmnopqrstuvwxyz".indexOf(r.toLowerCase());
2922
+ }
2923
+ switch (l) {
2924
+ case "serif":
2925
+ return n;
2926
+ case "sans":
2927
+ const r = [..."𝟢𝟣𝟤𝟥𝟦𝟧𝟨𝟩𝟪𝟫"], i = [..."𝖺𝖻𝖼𝖽𝖾𝖿𝗀𝗁𝗂𝗃𝗄𝗅𝗆𝗇𝗈𝗉𝗊𝗋𝗌𝗍𝗎𝗏𝗐𝗑𝗒𝗓"], B = [..."𝖠𝖡𝖢𝖣𝖤𝖥𝖦𝖧𝖨𝖩𝖪𝖫𝖬𝖭𝖮𝖯𝖰𝖱𝖲𝖳𝖴𝖵𝖶𝖷𝖸𝖹"];
2928
+ return n = n.replace(/[0-9]+/g, (k) => r[k]), n = n.replace(/[a-z]/g, (k) => i[t(k)]), n = n.replace(/[A-Z]/g, (k) => B[t(k)]), n;
2929
+ case "frak":
2930
+ const a = [..."𝔞𝔟𝔠𝔡𝔢𝔣𝔤𝔥𝔦𝔧𝔨𝔩𝔪𝔫𝔬𝔭𝔮𝔯𝔰𝔱𝔲𝔳𝔴𝔵𝔶𝔷"], F = [..."𝔄𝔅ℭ𝔇𝔈𝔉𝔊ℌℑ𝔍𝔎𝔏𝔐𝔑𝔒𝔓𝔔ℜ𝔖𝔗𝔘𝔙𝔚𝔛𝔜ℨ"];
2931
+ return n = n.replace(/[a-z]/g, (k) => a[t(k)]), n = n.replace(/[A-Z]/g, (k) => F[t(k)]), n;
2932
+ case "mono":
2933
+ const s = [..."0𝟷𝟸𝟹𝟺𝟻𝟼𝟽𝟾𝟿"], b = [..."𝚊𝚋𝚌𝚍𝚎𝚏𝚐𝚑𝚒𝚓𝚔𝚕𝚖𝚗𝚘𝚙𝚚𝚛𝚜𝚝𝚞𝚟𝚠𝚡𝚢𝚣"], E = [..."𝙰𝙱𝙲𝙳𝙴𝙵𝙶𝙷𝙸𝙹𝙺𝙻𝙼𝙽𝙾𝙿𝚀𝚁𝚂𝚃𝚄𝚅𝚆𝚇𝚈𝚉"];
2934
+ return n = n.replace(/[0-9]+/g, (k) => s[k]), n = n.replace(/[a-z]/g, (k) => b[t(k)]), n = n.replace(/[A-Z]/g, (k) => E[t(k)]), n;
2935
+ case "bb":
2936
+ const v = [..."𝟘𝟙𝟚𝟛𝟜𝟝𝟞𝟟𝟠𝟡"], g = [..."𝕒𝕓𝕔𝕕𝕖𝕗𝕘𝕙𝕚𝕛𝕜𝕝𝕞𝕟𝕠𝕡𝕢𝕣𝕤𝕥𝕦𝕧𝕨𝕩𝕪𝕫"], M = [..."𝔸𝔹ℂ𝔻𝔼𝔽𝔾ℍ𝕀𝕁𝕂𝕃𝕄ℕ𝕆ℙℚℝ𝕊𝕋𝕌𝕍𝕎𝕏𝕐ℤ"];
2937
+ return n = n.replace(/[0-9]+/g, (k) => v[k]), n = n.replace(/[a-z]/g, (k) => g[t(k)]), n = n.replace(/[A-Z]/g, (k) => M[t(k)]), n;
2938
+ case "cal":
2939
+ const S = [..."𝒶𝒷𝒸𝒹ℯ𝒻ℊ𝒽𝒾𝒿𝓀𝓁𝓂𝓃ℴ𝓅𝓆𝓇𝓈𝓉𝓊𝓋𝓌𝓍𝓎𝓏"], z = [..."𝒜ℬ𝒞𝒟ℰℱ𝒢ℋℐ𝒥𝒦ℒℳ𝒩𝒪𝒫𝒬ℛ𝒮𝒯𝒰𝒱𝒲𝒳𝒴𝒵"];
2940
+ return n = n.replace(/[a-z]/g, (k) => S[t(k)]), n = n.replace(/[A-Z]/g, (k) => z[t(k)]), n;
2941
+ }
2942
+ }
2943
+ function h(n, l) {
2944
+ let t = document.createDocumentFragment();
2945
+ n = C0(n);
2890
2946
  {
2891
- let r = !1, C = (t) => {
2892
- for (let B of t) {
2893
- if (n0(B)) {
2947
+ let r = !1, i = (B) => {
2948
+ for (let a of B) {
2949
+ if (t0(a)) {
2894
2950
  r = !0;
2895
2951
  return;
2896
2952
  }
2897
- B.type == "group" && C(B.children);
2953
+ a.type == "group" && i(a.children);
2898
2954
  }
2899
2955
  };
2900
- if (C(n), r) {
2956
+ if (i(n), r) {
2901
2957
  {
2902
- let B = [];
2903
- for (let D in n) {
2904
- let F = n[D];
2905
- F.type == "group" ? (B.push(j("(")), B.push(...l0(F.children)), B.push(j(")"))) : B.push(F);
2958
+ let a = [];
2959
+ for (let F in n) {
2960
+ let s = n[F];
2961
+ s.type == "group" ? (a.push(N("(")), a.push(...C0(s.children)), a.push(N(")"))) : a.push(s);
2906
2962
  }
2907
- n = B;
2963
+ n = a;
2908
2964
  }
2909
- for (let B = 0; B < n.length; B++) {
2910
- const D = n[B];
2911
- n0(D) && (n[B] = T);
2965
+ for (let a = 0; a < n.length; a++) {
2966
+ const F = n[a];
2967
+ t0(F) && (n[a] = Z);
2912
2968
  }
2913
- let t = [];
2914
- t.push({ type: "f", value: "x_table", children: n }), n = t;
2969
+ let B = [];
2970
+ B.push({ type: "f", value: "x_table", children: n }), n = B;
2971
+ } else {
2972
+ let B = [];
2973
+ for (let a of n)
2974
+ a.type == "v" && a.value == "&" && !a.esc || B.push(a);
2975
+ n = B;
2915
2976
  }
2916
2977
  }
2917
2978
  for (let r in n) {
2918
- let C = Number(r), t = n[C];
2919
- if (t.type == "f" && t.children) {
2920
- let B = "array", D = [], F = [], E = [], f = [];
2921
- for (let s in t.children) {
2922
- const p = t.children[s];
2923
- if (Number(s) + 1 == t.children.length) {
2924
- if (p.type == "blank" && t.children[Number(s) - 1].value.match(/[,;]/))
2925
- break;
2926
- !U(p, ",") && !U(p, ";") && f.push(p), B == "dic" ? (F.push(f), f = []) : D.push(f), E.length && (E.push(D), D = []), f = [];
2927
- } else
2928
- U(p, ",") ? (B == "dic" ? (F.push(f), B = "array") : D.push(f), f = []) : U(p, ";") ? (D.push(f), f = [], E.push(D), D = []) : (f.push(p), U(p, ":") && (B = "dic"));
2929
- }
2930
- let b = {};
2931
- for (let s of F) {
2932
- let p = "", P = [];
2933
- for (let O of s)
2934
- p ? O.value != ":" && P.push(O) : p = O.value;
2935
- b[p] = P;
2936
- }
2937
- if (L[t.value]) {
2938
- console.log(D, b, E);
2939
- let s = L[t.value](D, b, E);
2940
- l.append(s);
2941
- } else if (I[t.value]) {
2942
- let s = i("mo", I[t.value]);
2943
- l.append(s, g(b0(t.children)));
2979
+ let i = Number(r), B = n[i];
2980
+ if (B.type == "f" && B.children) {
2981
+ let { attr: a, dic: F, array: s } = A0(B);
2982
+ if (O[B.value]) {
2983
+ console.log(a, F, s);
2984
+ let b = O[B.value](a, F, s, l);
2985
+ t.append(b);
2986
+ } else if (w[B.value]) {
2987
+ let b = D("mo", w[B.value]);
2988
+ t.append(b, h(g0(B.children)));
2944
2989
  }
2945
2990
  }
2946
- if (t.type == "f" && !t.children) {
2947
- if (I[t.value]) {
2948
- let B;
2949
- t.value.match(/[a-zA-Z\u0391-\u03C9]/) ? B = "mi" : B = "mo";
2950
- let D = i(B, I[t.value]);
2951
- l.append(D);
2952
- } else if (L[t.value]) {
2953
- let B = L[t.value]();
2954
- l.append(B);
2991
+ if (B.type == "f" && !B.children) {
2992
+ if (w[B.value]) {
2993
+ let a, F = null;
2994
+ const s = {
2995
+ " ": "0.36em",
2996
+ " ": "0.5em",
2997
+ " ": "3.75em",
2998
+ " ": "0.333em",
2999
+ " ": "0.25em",
3000
+ " ": "0.166em",
3001
+ " ": "0.222em",
3002
+ " ": "1ch",
3003
+ " ": "0.27em",
3004
+ " ": "0.2em",
3005
+ " ": "0.09em"
3006
+ };
3007
+ w[B.value].match(/[a-zA-Z\u0391-\u03C9]/) ? a = "mi" : s[w[B.value]] ? (a = "mspace", F = { width: s[w[B.value]] }) : a = "mo";
3008
+ let b = D(a, w[B.value], F);
3009
+ t.append(b);
3010
+ } else if (O[B.value]) {
3011
+ let a = O[B.value](null, null, null, l);
3012
+ t.append(a);
2955
3013
  }
2956
3014
  }
2957
- if (t.type == "str") {
2958
- let B = i("ms", t.value);
2959
- l.append(B);
3015
+ if (B.type == "str") {
3016
+ let a = D("ms", c(B.value, l));
3017
+ t.append(a);
2960
3018
  }
2961
- if (t.type == "v") {
2962
- let B;
2963
- t.value.match(/[0-9]+/) ? B = "mn" : t.value.match(/[a-zA-Z\u0391-\u03C9]/) ? B = "mi" : B = "mo";
2964
- let D = i(B, t.value);
2965
- l.append(D);
3019
+ if (B.type == "v") {
3020
+ let a;
3021
+ B.value.match(/[0-9.]+/) ? a = "mn" : B.value.match(/[a-zA-Z\u0391-\u03C9]/) ? a = "mi" : a = "mo";
3022
+ let F = D(a, c(B.value, l));
3023
+ t.append(F);
2966
3024
  }
2967
- t.type == "group" && l.append(i0(t.children));
3025
+ B.type == "group" && t.append(D0(B.children));
2968
3026
  }
2969
- return l;
3027
+ return t;
2970
3028
  }
2971
- function h0(n) {
2972
- let l = s0(n);
3029
+ function k0(n) {
3030
+ let l = E0(n);
2973
3031
  console.log(l);
2974
- let r = i("math");
2975
- r.setAttribute("display", "block");
2976
- let C = g(l);
2977
- return r.append(C), r;
3032
+ let t = D("math");
3033
+ t.setAttribute("display", "block");
3034
+ let r = h(l);
3035
+ return t.append(r), t;
2978
3036
  }
2979
- function m0(n) {
2980
- return h0(n).outerHTML;
3037
+ function y0(n) {
3038
+ return k0(n).outerHTML;
2981
3039
  }
2982
3040
  export {
2983
- h0 as toMML,
2984
- m0 as toMMLHTML
3041
+ k0 as toMML,
3042
+ y0 as toMMLHTML
2985
3043
  };
2986
3044
  //# sourceMappingURL=xmmath.es.js.map