xmmath 1.1.2 → 1.1.3
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 +191 -177
- package/dist/xmmath.es.js.map +1 -1
- package/dist/xmmath.umd.js +4 -4
- package/dist/xmmath.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/main.ts +53 -29
package/dist/xmmath.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var S = (t, n, o) => (
|
|
4
|
-
const
|
|
1
|
+
var xt = Object.defineProperty;
|
|
2
|
+
var _t = (t, n, o) => n in t ? xt(t, n, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[n] = o;
|
|
3
|
+
var S = (t, n, o) => (_t(t, typeof n != "symbol" ? n + "" : n, o), o);
|
|
4
|
+
const jt = Intl.Segmenter, At = new jt("emoji", { granularity: "grapheme" }), J = {
|
|
5
5
|
emoji: null
|
|
6
6
|
};
|
|
7
|
-
function
|
|
7
|
+
function Nt(t) {
|
|
8
8
|
const n = /[a-zA-Z]/, o = /[(){}[\]]/, e = /[({[]/, r = /[)}\]]/, l = /^[ \t\n\r]+$/;
|
|
9
9
|
let u = "", p = !1;
|
|
10
10
|
const c = [], b = [];
|
|
@@ -13,7 +13,7 @@ function _t(t) {
|
|
|
13
13
|
const s = parseInt(a.slice(3, -1), 16);
|
|
14
14
|
return String.fromCodePoint(s);
|
|
15
15
|
});
|
|
16
|
-
let k =
|
|
16
|
+
let k = J.emoji ? J.emoji(t) : Array.from(At.segment(t)).map((a) => a.segment);
|
|
17
17
|
const d = [];
|
|
18
18
|
for (const a of k)
|
|
19
19
|
a.length > 1 && a.includes(",") ? d.push(...a) : d.push(a);
|
|
@@ -62,7 +62,7 @@ function _t(t) {
|
|
|
62
62
|
}
|
|
63
63
|
return c;
|
|
64
64
|
}
|
|
65
|
-
const
|
|
65
|
+
const zt = `{
|
|
66
66
|
"abacus": "🧮",
|
|
67
67
|
"abc": "🔤",
|
|
68
68
|
"abcd": "🔡",
|
|
@@ -2186,7 +2186,7 @@ const jt = `{
|
|
|
2186
2186
|
"zombie": "🧟",
|
|
2187
2187
|
"zzz": "💤"
|
|
2188
2188
|
}
|
|
2189
|
-
`,
|
|
2189
|
+
`, $t = `{
|
|
2190
2190
|
"wj": "",
|
|
2191
2191
|
"zwj": "",
|
|
2192
2192
|
"zwnj": "",
|
|
@@ -3914,8 +3914,8 @@ const jt = `{
|
|
|
3914
3914
|
}
|
|
3915
3915
|
]
|
|
3916
3916
|
}
|
|
3917
|
-
`,
|
|
3918
|
-
function
|
|
3917
|
+
`, Mt = JSON.parse($t);
|
|
3918
|
+
function pt(t) {
|
|
3919
3919
|
const n = {};
|
|
3920
3920
|
for (const o in t)
|
|
3921
3921
|
if (typeof t[o] == "string")
|
|
@@ -3937,7 +3937,7 @@ function ct(t) {
|
|
|
3937
3937
|
}
|
|
3938
3938
|
return n;
|
|
3939
3939
|
}
|
|
3940
|
-
const _ =
|
|
3940
|
+
const _ = pt(Mt), St = pt(JSON.parse(zt)), B = {
|
|
3941
3941
|
"->": "arrow.r",
|
|
3942
3942
|
"|->": "arrow.r.bar",
|
|
3943
3943
|
"=>": "arrow.r.double",
|
|
@@ -3981,10 +3981,10 @@ const _ = ct(Nt), zt = ct(JSON.parse(jt)), V = {
|
|
|
3981
3981
|
"'": "prime",
|
|
3982
3982
|
"~": "space.nobreak"
|
|
3983
3983
|
};
|
|
3984
|
-
let
|
|
3985
|
-
for (const t in
|
|
3986
|
-
t.length >
|
|
3987
|
-
const
|
|
3984
|
+
let Q = 0;
|
|
3985
|
+
for (const t in B)
|
|
3986
|
+
t.length > Q && (Q = t.length);
|
|
3987
|
+
const Ct = ["√", "∛", "∜"], dt = [
|
|
3988
3988
|
{ id: "arccos" },
|
|
3989
3989
|
{ id: "arcsin" },
|
|
3990
3990
|
{ id: "arctan" },
|
|
@@ -4028,7 +4028,7 @@ const $t = ["√", "∛", "∜"], ut = [
|
|
|
4028
4028
|
{ id: "limsup", str: "lim sup", limits: !0 },
|
|
4029
4029
|
{ id: "dif", str: "d" },
|
|
4030
4030
|
{ id: "Dif", str: "D" }
|
|
4031
|
-
],
|
|
4031
|
+
], ht = [], ft = /* @__PURE__ */ new Set([
|
|
4032
4032
|
"angle.azimuth",
|
|
4033
4033
|
"angzarr",
|
|
4034
4034
|
"approx",
|
|
@@ -4354,7 +4354,7 @@ const $t = ["√", "∛", "∜"], ut = [
|
|
|
4354
4354
|
"tilde.rev",
|
|
4355
4355
|
"tilde.rev.equiv",
|
|
4356
4356
|
"tilde.triple"
|
|
4357
|
-
]),
|
|
4357
|
+
]), bt = [
|
|
4358
4358
|
// 大算符:0.11.1 实测 inline 走角标、block(display) 才走上下
|
|
4359
4359
|
"∏",
|
|
4360
4360
|
"∐",
|
|
@@ -4381,15 +4381,15 @@ const $t = ["√", "∛", "∜"], ut = [
|
|
|
4381
4381
|
"⨊"
|
|
4382
4382
|
];
|
|
4383
4383
|
for (const t in _)
|
|
4384
|
-
for (const n of
|
|
4385
|
-
_[t] === n &&
|
|
4384
|
+
for (const n of bt)
|
|
4385
|
+
_[t] === n && ht.push(t);
|
|
4386
4386
|
function j(t) {
|
|
4387
4387
|
return t.type === "group" ? t.kh === "()" ? t.children : [t] : [t];
|
|
4388
4388
|
}
|
|
4389
|
-
function
|
|
4389
|
+
function Lt(t) {
|
|
4390
4390
|
return t.length === 1 && t[0].type === "group" && t[0].kh.length > 1 && (t = [y(t[0].kh[0]), ...t[0].children, y(t[0].kh[1])]), t;
|
|
4391
4391
|
}
|
|
4392
|
-
function
|
|
4392
|
+
function Tt(t) {
|
|
4393
4393
|
return [{ type: "group", value: "", children: t, kh: "()" }];
|
|
4394
4394
|
}
|
|
4395
4395
|
function N(t) {
|
|
@@ -4401,28 +4401,28 @@ function z(t) {
|
|
|
4401
4401
|
function T(t) {
|
|
4402
4402
|
return q(t, { type: "v", value: "/" });
|
|
4403
4403
|
}
|
|
4404
|
-
function
|
|
4404
|
+
function lt(t) {
|
|
4405
4405
|
return t && t.value === "br" && t.esc;
|
|
4406
4406
|
}
|
|
4407
|
-
const
|
|
4407
|
+
const K = /* @__PURE__ */ new Set();
|
|
4408
4408
|
{
|
|
4409
4409
|
const t = /* @__PURE__ */ new Set();
|
|
4410
4410
|
for (const n in _) {
|
|
4411
4411
|
const o = _[n];
|
|
4412
|
-
if (!
|
|
4413
|
-
|
|
4412
|
+
if (!ft.has(n)) {
|
|
4413
|
+
K.has(o) && t.add(o);
|
|
4414
4414
|
continue;
|
|
4415
4415
|
}
|
|
4416
|
-
|
|
4416
|
+
K.add(o);
|
|
4417
4417
|
}
|
|
4418
4418
|
for (const n of t)
|
|
4419
|
-
|
|
4419
|
+
K.delete(n);
|
|
4420
4420
|
}
|
|
4421
4421
|
let E = !0;
|
|
4422
|
-
function
|
|
4422
|
+
function Y(t) {
|
|
4423
4423
|
E = t;
|
|
4424
4424
|
}
|
|
4425
|
-
function
|
|
4425
|
+
function mt() {
|
|
4426
4426
|
return E;
|
|
4427
4427
|
}
|
|
4428
4428
|
function P(t) {
|
|
@@ -4430,13 +4430,13 @@ function P(t) {
|
|
|
4430
4430
|
const n = t[0];
|
|
4431
4431
|
if (n.type === "f") {
|
|
4432
4432
|
if (!n.children || n.children.length === 0) {
|
|
4433
|
-
if (
|
|
4433
|
+
if (ft.has(n.value))
|
|
4434
4434
|
return !0;
|
|
4435
|
-
if (
|
|
4435
|
+
if (ht.includes(n.value))
|
|
4436
4436
|
return E;
|
|
4437
4437
|
if (n.value.split(".").at(0) === "arrow")
|
|
4438
4438
|
return !0;
|
|
4439
|
-
for (const o of
|
|
4439
|
+
for (const o of dt)
|
|
4440
4440
|
if (o.limits && n.value === o.id)
|
|
4441
4441
|
return E;
|
|
4442
4442
|
}
|
|
@@ -4445,33 +4445,33 @@ function P(t) {
|
|
|
4445
4445
|
if (n.value === "limits")
|
|
4446
4446
|
return !0;
|
|
4447
4447
|
if (n.value === "op") {
|
|
4448
|
-
const { dic: o } =
|
|
4449
|
-
return
|
|
4448
|
+
const { dic: o } = kt(n);
|
|
4449
|
+
return R(o.limits) && E;
|
|
4450
4450
|
}
|
|
4451
4451
|
}
|
|
4452
4452
|
if (n.type === "v") {
|
|
4453
|
-
if (
|
|
4453
|
+
if (K.has(n.value))
|
|
4454
4454
|
return !0;
|
|
4455
|
-
if (
|
|
4455
|
+
if (bt.includes(n.value))
|
|
4456
4456
|
return E;
|
|
4457
4457
|
}
|
|
4458
4458
|
} else
|
|
4459
4459
|
return !1;
|
|
4460
4460
|
}
|
|
4461
|
-
function
|
|
4462
|
-
return
|
|
4461
|
+
function W(t) {
|
|
4462
|
+
return ot(t, { type: "v", value: "." });
|
|
4463
4463
|
}
|
|
4464
|
-
function
|
|
4464
|
+
function st(t) {
|
|
4465
4465
|
return t && (t.type === "f" || t.type === "v" && t.value.match(/[a-z]/));
|
|
4466
4466
|
}
|
|
4467
|
-
function
|
|
4467
|
+
function Ot(t) {
|
|
4468
4468
|
return t && t.type === "v" && t.value === "!" && !t.esc;
|
|
4469
4469
|
}
|
|
4470
4470
|
const $ = { type: "v", value: "," };
|
|
4471
4471
|
function y(t) {
|
|
4472
4472
|
return { type: "v", value: t };
|
|
4473
4473
|
}
|
|
4474
|
-
function
|
|
4474
|
+
function ot(t, n) {
|
|
4475
4475
|
return !t || !n ? !1 : t.type === n.type && t.value === n.value;
|
|
4476
4476
|
}
|
|
4477
4477
|
function q(t, n) {
|
|
@@ -4491,23 +4491,23 @@ function H(t) {
|
|
|
4491
4491
|
for (const o in t) {
|
|
4492
4492
|
n.push({ type: "f", value: o }), n.push({ type: "v", value: ":" });
|
|
4493
4493
|
for (const e of t[o])
|
|
4494
|
-
|
|
4494
|
+
ot(e, $) && (e.esc = !0);
|
|
4495
4495
|
n.push(...t[o]), Number(o) + 1 !== Object.keys(t).length && n.push($);
|
|
4496
4496
|
}
|
|
4497
4497
|
return n;
|
|
4498
4498
|
}
|
|
4499
|
-
function
|
|
4499
|
+
function R(t) {
|
|
4500
4500
|
var n;
|
|
4501
4501
|
return q((n = Z(t)) == null ? void 0 : n[0], { type: "sharp", value: "true" });
|
|
4502
4502
|
}
|
|
4503
|
-
function
|
|
4503
|
+
function gt(t) {
|
|
4504
4504
|
var n, o, e;
|
|
4505
4505
|
{
|
|
4506
4506
|
const r = [], l = /[0-9]/;
|
|
4507
4507
|
let u = "";
|
|
4508
4508
|
for (let p = 0; p < t.length; p++) {
|
|
4509
4509
|
const c = t[p];
|
|
4510
|
-
c.value.match(l) || (n = t[p - 1]) != null && n.value.match(l) &&
|
|
4510
|
+
c.value.match(l) || (n = t[p - 1]) != null && n.value.match(l) && W(c) && ((o = t[p + 1]) != null && o.value.match(l)) ? u += c.value : r.push(c), c.value.match(l) && (!t[p + 1] || !t[p + 1].value.match(l)) && !(W(t[p + 1]) && ((e = t[p + 2]) != null && e.value.match(l))) && (r.push({ type: "v", value: u }), u = "");
|
|
4511
4511
|
}
|
|
4512
4512
|
t = r;
|
|
4513
4513
|
}
|
|
@@ -4518,7 +4518,7 @@ function ft(t) {
|
|
|
4518
4518
|
if (q(u, y("\\"))) {
|
|
4519
4519
|
if (t != null && t[l + 1]) {
|
|
4520
4520
|
const p = t[l + 1];
|
|
4521
|
-
if (
|
|
4521
|
+
if (ot(p, y("\\")))
|
|
4522
4522
|
r.push({ type: "v", value: "\\", esc: !0 }), l++;
|
|
4523
4523
|
else if (p.type === "blank")
|
|
4524
4524
|
r.push({ type: "v", value: "br", esc: !0 }), l++;
|
|
@@ -4539,7 +4539,7 @@ function ft(t) {
|
|
|
4539
4539
|
}
|
|
4540
4540
|
return t;
|
|
4541
4541
|
}
|
|
4542
|
-
function
|
|
4542
|
+
function vt(t) {
|
|
4543
4543
|
var n, o, e, r, l, u, p, c, b, v, w, k;
|
|
4544
4544
|
{
|
|
4545
4545
|
const d = [];
|
|
@@ -4550,12 +4550,12 @@ function bt(t) {
|
|
|
4550
4550
|
else if (s.type === "v") {
|
|
4551
4551
|
let i = a, f = s.value;
|
|
4552
4552
|
const m = [];
|
|
4553
|
-
for (
|
|
4554
|
-
f += t[i + 1].value,
|
|
4553
|
+
for (B[f] && m.push(f); ((n = t == null ? void 0 : t[i + 1]) == null ? void 0 : n.type) === "v" && f.length <= Q; )
|
|
4554
|
+
f += t[i + 1].value, B[f] && m.push(f), i++;
|
|
4555
4555
|
if (m.length) {
|
|
4556
4556
|
const A = {
|
|
4557
4557
|
type: "f",
|
|
4558
|
-
value:
|
|
4558
|
+
value: B[m.at(-1)],
|
|
4559
4559
|
src: m.at(-1)
|
|
4560
4560
|
};
|
|
4561
4561
|
d.push(A), a += m.at(-1).length - 1;
|
|
@@ -4579,7 +4579,7 @@ function bt(t) {
|
|
|
4579
4579
|
let a = [];
|
|
4580
4580
|
for (let s = 0; s < t.length; s++) {
|
|
4581
4581
|
const i = t[s];
|
|
4582
|
-
|
|
4582
|
+
Ot(t == null ? void 0 : t[s + 1]) && !N(i) && !z(i) && !T(i) ? a.push(i) : a.length ? (a.push(i), d.push({ type: "group1", value: "", children: a }), a = []) : d.push(i);
|
|
4583
4583
|
}
|
|
4584
4584
|
t = d;
|
|
4585
4585
|
}
|
|
@@ -4588,7 +4588,7 @@ function bt(t) {
|
|
|
4588
4588
|
let a = "";
|
|
4589
4589
|
for (let s = 0; s < t.length; s++) {
|
|
4590
4590
|
const i = t[s];
|
|
4591
|
-
|
|
4591
|
+
st(i) && W(t[s + 1]) ? a || !a && i.type === "f" ? (a += `${i.value}.`, s++) : d.push(i) : a && st(i) ? (a += i.value, W(t[s + 1]) || (d.push({ type: "f", value: a }), a = "")) : d.push(i);
|
|
4592
4592
|
}
|
|
4593
4593
|
t = d;
|
|
4594
4594
|
}
|
|
@@ -4596,7 +4596,7 @@ function bt(t) {
|
|
|
4596
4596
|
const d = [];
|
|
4597
4597
|
for (let a = 0; a < t.length; a++) {
|
|
4598
4598
|
const s = t[a];
|
|
4599
|
-
if (s.type === "v" &&
|
|
4599
|
+
if (s.type === "v" && Ct.includes(s.value) && t[a + 1]) {
|
|
4600
4600
|
s.type = "f";
|
|
4601
4601
|
const i = t[a + 1], f = [];
|
|
4602
4602
|
let m = a + 1, A = a + 2;
|
|
@@ -4833,7 +4833,7 @@ function bt(t) {
|
|
|
4833
4833
|
}
|
|
4834
4834
|
return t;
|
|
4835
4835
|
}
|
|
4836
|
-
function
|
|
4836
|
+
function kt(t) {
|
|
4837
4837
|
const n = [[]];
|
|
4838
4838
|
for (const c of t.children)
|
|
4839
4839
|
q(c, { type: "v", value: "," }) || q(c, { type: "v", value: ";" }) ? (n.push(c.value), n.push([])) : n.at(-1).push(c);
|
|
@@ -4849,7 +4849,7 @@ function mt(t) {
|
|
|
4849
4849
|
}
|
|
4850
4850
|
let l;
|
|
4851
4851
|
if (typeof r.at(-1) == "string" && (r = r.slice(0, -1)), r.includes(";")) {
|
|
4852
|
-
let c =
|
|
4852
|
+
let c = Dt(r, (b) => b === ";");
|
|
4853
4853
|
c.at(-1)[0].length === 0 && (c = c.slice(0, -1)), l = c.map((b) => b.filter((v) => typeof v != "string"));
|
|
4854
4854
|
} else
|
|
4855
4855
|
l = r.filter((c) => typeof c != "string").map(
|
|
@@ -4866,43 +4866,43 @@ function mt(t) {
|
|
|
4866
4866
|
}
|
|
4867
4867
|
b ? w.push(k) : v += k.value;
|
|
4868
4868
|
}
|
|
4869
|
-
p[v] =
|
|
4869
|
+
p[v] = vt(gt(w));
|
|
4870
4870
|
}
|
|
4871
4871
|
return { attr: l, dic: p };
|
|
4872
4872
|
}
|
|
4873
|
-
function
|
|
4873
|
+
function Dt(t, n) {
|
|
4874
4874
|
const o = [[]];
|
|
4875
4875
|
for (const e of t)
|
|
4876
4876
|
n(e) ? o.push([]) : o.at(-1).push(e);
|
|
4877
4877
|
return o;
|
|
4878
4878
|
}
|
|
4879
|
-
class
|
|
4879
|
+
class U {
|
|
4880
4880
|
constructor(n) {
|
|
4881
4881
|
S(this, "type", "text");
|
|
4882
4882
|
this.text = n;
|
|
4883
4883
|
}
|
|
4884
4884
|
}
|
|
4885
|
-
class
|
|
4885
|
+
class Et {
|
|
4886
4886
|
constructor() {
|
|
4887
4887
|
S(this, "type", "frag");
|
|
4888
4888
|
S(this, "childNodes", []);
|
|
4889
4889
|
}
|
|
4890
4890
|
append(...n) {
|
|
4891
|
-
|
|
4891
|
+
rt(this.childNodes, n);
|
|
4892
4892
|
}
|
|
4893
4893
|
}
|
|
4894
|
-
class
|
|
4894
|
+
class Ht {
|
|
4895
4895
|
constructor(n, o, e) {
|
|
4896
4896
|
S(this, "type", "el");
|
|
4897
4897
|
S(this, "attrs", {});
|
|
4898
4898
|
S(this, "style", {});
|
|
4899
4899
|
S(this, "childNodes", []);
|
|
4900
|
-
if (this.tag = n, o && this.childNodes.push(new
|
|
4900
|
+
if (this.tag = n, o && this.childNodes.push(new U(o)), e)
|
|
4901
4901
|
for (const r in e)
|
|
4902
4902
|
this.attrs[r] = e[r];
|
|
4903
4903
|
}
|
|
4904
4904
|
append(...n) {
|
|
4905
|
-
|
|
4905
|
+
rt(this.childNodes, n);
|
|
4906
4906
|
}
|
|
4907
4907
|
setAttribute(n, o) {
|
|
4908
4908
|
this.attrs[n] = o;
|
|
@@ -4917,86 +4917,86 @@ class Et {
|
|
|
4917
4917
|
return this.childNodes.filter((n) => n.type === "text").map((n) => n.text).join("");
|
|
4918
4918
|
}
|
|
4919
4919
|
set textContent(n) {
|
|
4920
|
-
this.childNodes.length = 0, n && this.childNodes.push(new
|
|
4920
|
+
this.childNodes.length = 0, n && this.childNodes.push(new U(n));
|
|
4921
4921
|
}
|
|
4922
4922
|
get innerHTML() {
|
|
4923
|
-
return this.childNodes.map(
|
|
4923
|
+
return this.childNodes.map(G).join("");
|
|
4924
4924
|
}
|
|
4925
4925
|
set innerHTML(n) {
|
|
4926
|
-
this.childNodes.length = 0, this.childNodes.push(new
|
|
4926
|
+
this.childNodes.length = 0, this.childNodes.push(new U(n));
|
|
4927
4927
|
}
|
|
4928
4928
|
querySelectorAll(n) {
|
|
4929
4929
|
const o = [];
|
|
4930
|
-
return
|
|
4930
|
+
return tt(this, n, o), o;
|
|
4931
4931
|
}
|
|
4932
4932
|
}
|
|
4933
|
-
function
|
|
4933
|
+
function rt(t, n) {
|
|
4934
4934
|
for (const o of n)
|
|
4935
4935
|
if (o) {
|
|
4936
4936
|
if (Array.isArray(o)) {
|
|
4937
|
-
|
|
4937
|
+
rt(t, o);
|
|
4938
4938
|
continue;
|
|
4939
4939
|
}
|
|
4940
4940
|
o.type === "frag" ? t.push(...o.childNodes) : t.push(o);
|
|
4941
4941
|
}
|
|
4942
4942
|
}
|
|
4943
|
-
function
|
|
4943
|
+
function tt(t, n, o) {
|
|
4944
4944
|
for (const e of t.childNodes)
|
|
4945
|
-
e.type === "el" ? (e.tag === n && o.push(e),
|
|
4945
|
+
e.type === "el" ? (e.tag === n && o.push(e), tt(e, n, o)) : e.type === "frag" && tt(e, n, o);
|
|
4946
4946
|
}
|
|
4947
4947
|
function h(t, n, o) {
|
|
4948
|
-
return new
|
|
4948
|
+
return new Ht(t, n, o);
|
|
4949
4949
|
}
|
|
4950
|
-
function
|
|
4951
|
-
return new
|
|
4950
|
+
function yt() {
|
|
4951
|
+
return new Et();
|
|
4952
4952
|
}
|
|
4953
|
-
function
|
|
4953
|
+
function Pt(t) {
|
|
4954
4954
|
return t.replace(/[A-Z]/g, (n) => "-" + n.toLowerCase());
|
|
4955
4955
|
}
|
|
4956
|
-
function
|
|
4956
|
+
function Zt(t) {
|
|
4957
4957
|
return t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/\u00A0/g, " ");
|
|
4958
4958
|
}
|
|
4959
|
-
function
|
|
4959
|
+
function at(t) {
|
|
4960
4960
|
return t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/\u00A0/g, " ");
|
|
4961
4961
|
}
|
|
4962
|
-
function
|
|
4962
|
+
function G(t) {
|
|
4963
4963
|
if (t.type === "text")
|
|
4964
|
-
return
|
|
4964
|
+
return Zt(t.text);
|
|
4965
4965
|
if (t.type === "frag")
|
|
4966
|
-
return t.childNodes.map(
|
|
4966
|
+
return t.childNodes.map(G).join("");
|
|
4967
4967
|
let n = `<${t.tag}`;
|
|
4968
4968
|
for (const e in t.attrs)
|
|
4969
|
-
n += ` ${e}="${
|
|
4969
|
+
n += ` ${e}="${at(t.attrs[e])}"`;
|
|
4970
4970
|
const o = Object.keys(t.style);
|
|
4971
4971
|
if (o.length) {
|
|
4972
|
-
const e = o.map((r) => `${
|
|
4973
|
-
n += ` style="${
|
|
4972
|
+
const e = o.map((r) => `${Pt(r)}: ${t.style[r]}`).join("; ");
|
|
4973
|
+
n += ` style="${at(e)}"`;
|
|
4974
4974
|
}
|
|
4975
|
-
return n += ">", n += t.childNodes.map(
|
|
4975
|
+
return n += ">", n += t.childNodes.map(G).join(""), n += `</${t.tag}>`, n;
|
|
4976
4976
|
}
|
|
4977
|
-
function
|
|
4978
|
-
return
|
|
4977
|
+
function It(t) {
|
|
4978
|
+
return G(t);
|
|
4979
4979
|
}
|
|
4980
|
-
const
|
|
4981
|
-
function
|
|
4980
|
+
const Ft = "http://www.w3.org/1998/Math/MathML";
|
|
4981
|
+
function nt(t, n = globalThis.document) {
|
|
4982
4982
|
if (t.type === "text")
|
|
4983
4983
|
return n.createTextNode(t.text);
|
|
4984
4984
|
if (t.type === "frag") {
|
|
4985
4985
|
const e = n.createDocumentFragment();
|
|
4986
4986
|
for (const r of t.childNodes)
|
|
4987
|
-
e.append(
|
|
4987
|
+
e.append(nt(r, n));
|
|
4988
4988
|
return e;
|
|
4989
4989
|
}
|
|
4990
|
-
const o = n.createElementNS(
|
|
4990
|
+
const o = n.createElementNS(Ft, t.tag);
|
|
4991
4991
|
for (const e in t.attrs)
|
|
4992
4992
|
o.setAttribute(e, t.attrs[e]);
|
|
4993
4993
|
for (const e in t.style)
|
|
4994
4994
|
o.style[e] = t.style[e];
|
|
4995
4995
|
for (const e of t.childNodes)
|
|
4996
|
-
o.append(
|
|
4996
|
+
o.append(nt(e, n));
|
|
4997
4997
|
return o;
|
|
4998
4998
|
}
|
|
4999
|
-
const C = "mathvariant",
|
|
4999
|
+
const C = "mathvariant", Vt = {
|
|
5000
5000
|
"(": ["(", ")"],
|
|
5001
5001
|
"[": ["[", "]"],
|
|
5002
5002
|
"{": ["{", "}"],
|
|
@@ -5004,27 +5004,36 @@ const C = "mathvariant", Ft = {
|
|
|
5004
5004
|
"||": ["‖", "‖"],
|
|
5005
5005
|
"": ["", ""]
|
|
5006
5006
|
};
|
|
5007
|
-
function
|
|
5007
|
+
function Bt(t) {
|
|
5008
5008
|
const n = t.length === 2 && t[0].type === "f" && t[0].value !== "prime" && t[1].type === "group" && t[1].kh === "()" ? [{ ...t[0], children: t[1].children }] : t;
|
|
5009
5009
|
return !!P(n);
|
|
5010
5010
|
}
|
|
5011
|
-
function
|
|
5011
|
+
function I(t, n) {
|
|
5012
|
+
const o = mt();
|
|
5013
|
+
Y(t);
|
|
5014
|
+
try {
|
|
5015
|
+
return n();
|
|
5016
|
+
} finally {
|
|
5017
|
+
Y(o);
|
|
5018
|
+
}
|
|
5019
|
+
}
|
|
5020
|
+
function X(t, n) {
|
|
5012
5021
|
const o = L(t, "delim");
|
|
5013
5022
|
let e = "";
|
|
5014
|
-
return o !== null && (o === void 0 ? e = n : e = o),
|
|
5023
|
+
return o !== null && (o === void 0 ? e = n : e = o), Vt[e];
|
|
5015
5024
|
}
|
|
5016
5025
|
const x = {
|
|
5017
5026
|
accent: (t, n, o) => {
|
|
5018
5027
|
const e = h("mrow");
|
|
5019
5028
|
e.append(g(t[0], o));
|
|
5020
5029
|
const r = h("mrow");
|
|
5021
|
-
r.append(g(t[1], o)), r.children[0].innerHTML =
|
|
5030
|
+
r.append(g(t[1], o)), r.children[0].innerHTML = Jt(r.children[0].innerHTML);
|
|
5022
5031
|
const l = h("mover");
|
|
5023
5032
|
return l.setAttribute("accent", "true"), l.append(e, r), l;
|
|
5024
5033
|
},
|
|
5025
5034
|
attach: (t, n, o) => {
|
|
5026
5035
|
const e = { ...n };
|
|
5027
|
-
|
|
5036
|
+
Bt(t[0]) || (e.t && !e.tr && (e.tr = e.t, delete e.t), e.b && !e.br && (e.br = e.b, delete e.b));
|
|
5028
5037
|
const r = h("mrow");
|
|
5029
5038
|
r.append(g(t[0]));
|
|
5030
5039
|
let l;
|
|
@@ -5062,11 +5071,11 @@ const x = {
|
|
|
5062
5071
|
cancel: (t, n, o) => {
|
|
5063
5072
|
const e = h("mrow"), r = (u) => `linear-gradient(to ${u ? "left" : "right"} top, transparent 47.75%, currentColor 49.5%, currentColor 50.5%, transparent 52.25%)`;
|
|
5064
5073
|
let l = "";
|
|
5065
|
-
return
|
|
5074
|
+
return R(n.cross) ? l = `${r(!0)},${r(!1)}` : R(n.inverted) ? l = r(!1) : l = r(!0), e.style.backgroundImage = l, e.append(g(t[0], o)), e;
|
|
5066
5075
|
},
|
|
5067
5076
|
cases: (t, n, o) => {
|
|
5068
|
-
const e = h("mrow"), r =
|
|
5069
|
-
if (l.setAttribute("rowspacing", u),
|
|
5077
|
+
const e = h("mrow"), r = X(n, "{"), l = x.x_table(t, { cases: [] }, o), u = L(n, "gap") || "0.5em";
|
|
5078
|
+
if (l.setAttribute("rowspacing", u), R(n == null ? void 0 : n.reverse)) {
|
|
5070
5079
|
const p = h("mo", r[1]);
|
|
5071
5080
|
e.append(l, p);
|
|
5072
5081
|
} else {
|
|
@@ -5084,7 +5093,7 @@ const x = {
|
|
|
5084
5093
|
return l.append(e, r), l;
|
|
5085
5094
|
},
|
|
5086
5095
|
lr: (t, n, o) => {
|
|
5087
|
-
const e =
|
|
5096
|
+
const e = wt(t.map((c) => Lt(c))), r = Z(e), l = L(n, "size"), u = g(r, o), p = h("mrow");
|
|
5088
5097
|
if (p.append(u), l && l !== "auto") {
|
|
5089
5098
|
const c = p.children[0], b = p.children[p.children.length - 1];
|
|
5090
5099
|
c == null || c.setAttribute("maxsize", l), c == null || c.setAttribute("minsize", l), b == null || b.setAttribute("maxsize", l), b == null || b.setAttribute("minsize", l);
|
|
@@ -5097,7 +5106,7 @@ const x = {
|
|
|
5097
5106
|
},
|
|
5098
5107
|
mat: (t, n, o) => {
|
|
5099
5108
|
var d;
|
|
5100
|
-
const e =
|
|
5109
|
+
const e = X(n, "("), r = h("mrow"), l = h("mo", e[0]), u = h("mo", e[1]), p = h("mtable");
|
|
5101
5110
|
let c;
|
|
5102
5111
|
(d = t[0][0]) != null && d.type ? c = [t] : c = t;
|
|
5103
5112
|
const b = L(n, "augment");
|
|
@@ -5148,31 +5157,36 @@ const x = {
|
|
|
5148
5157
|
const e = h("msqrt");
|
|
5149
5158
|
return e.append(g(t[0], o)), e;
|
|
5150
5159
|
},
|
|
5151
|
-
display
|
|
5152
|
-
|
|
5160
|
+
// display/inline/script/sscript 是局部样式(typst 的样式栈:内层覆盖外层,
|
|
5161
|
+
// `display(script(sum_1^2))` 仍走角标)。limits 的判定在 ast3 的「处理^_」
|
|
5162
|
+
// 里读全局 display 标志,故在渲染子树期间改写它、渲染完恢复;wrapper 用
|
|
5163
|
+
// mstyle 而不是 mrow —— MathML Core 里 displaystyle/scriptlevel 是 mstyle
|
|
5164
|
+
// 的属性,挂在 mrow 上浏览器会忽略(∑ 大小/脚标层级都随之失真)。
|
|
5165
|
+
display: (t, n, o) => I(!0, () => {
|
|
5166
|
+
const e = h("mstyle", null, { displaystyle: "true" });
|
|
5153
5167
|
return e.append(g(t[0], o)), e;
|
|
5154
|
-
},
|
|
5155
|
-
inline: (t, n, o) => {
|
|
5156
|
-
const e = h("
|
|
5168
|
+
}),
|
|
5169
|
+
inline: (t, n, o) => I(!1, () => {
|
|
5170
|
+
const e = h("mstyle", null, {
|
|
5157
5171
|
displaystyle: "false",
|
|
5158
5172
|
scriptlevel: "0"
|
|
5159
5173
|
});
|
|
5160
5174
|
return e.append(g(t[0], o)), e;
|
|
5161
|
-
},
|
|
5162
|
-
script: (t, n, o) => {
|
|
5163
|
-
const e = h("
|
|
5175
|
+
}),
|
|
5176
|
+
script: (t, n, o) => I(!1, () => {
|
|
5177
|
+
const e = h("mstyle", null, {
|
|
5164
5178
|
displaystyle: "false",
|
|
5165
5179
|
scriptlevel: "1"
|
|
5166
5180
|
});
|
|
5167
5181
|
return e.append(g(t[0], o)), e;
|
|
5168
|
-
},
|
|
5169
|
-
sscript: (t, n, o) => {
|
|
5170
|
-
const e = h("
|
|
5182
|
+
}),
|
|
5183
|
+
sscript: (t, n, o) => I(!1, () => {
|
|
5184
|
+
const e = h("mstyle", null, {
|
|
5171
5185
|
displaystyle: "false",
|
|
5172
5186
|
scriptlevel: "2"
|
|
5173
5187
|
});
|
|
5174
5188
|
return e.append(g(t[0], o)), e;
|
|
5175
|
-
},
|
|
5189
|
+
}),
|
|
5176
5190
|
upright: (t, n, o) => {
|
|
5177
5191
|
const e = h("mrow");
|
|
5178
5192
|
return e.append(g(t[0], o)), e.querySelectorAll("mi").forEach((r) => {
|
|
@@ -5197,12 +5211,12 @@ const x = {
|
|
|
5197
5211
|
const e = h("mrow"), r = h("ms");
|
|
5198
5212
|
return r.append(g(t[0], o)), e.append(r), e;
|
|
5199
5213
|
},
|
|
5200
|
-
underline: (t, n, o) =>
|
|
5201
|
-
overline: (t, n, o) =>
|
|
5202
|
-
underbrace: (t, n, o) =>
|
|
5203
|
-
overbrace: (t, n, o) =>
|
|
5204
|
-
underbracket: (t, n, o) =>
|
|
5205
|
-
overbracket: (t, n, o) =>
|
|
5214
|
+
underline: (t, n, o) => ct("under", t[0], o),
|
|
5215
|
+
overline: (t, n, o) => ct("over", t[0], o),
|
|
5216
|
+
underbrace: (t, n, o) => F("under", t[0], "⏟", t == null ? void 0 : t[1], o),
|
|
5217
|
+
overbrace: (t, n, o) => F("over", t[0], "⏞", t == null ? void 0 : t[1], o),
|
|
5218
|
+
underbracket: (t, n, o) => F("under", t[0], "⎵", t == null ? void 0 : t[1], o),
|
|
5219
|
+
overbracket: (t, n, o) => F("over", t[0], "⎴", t == null ? void 0 : t[1], o),
|
|
5206
5220
|
serif: (t) => g(t[0], "serif"),
|
|
5207
5221
|
sans: (t) => g(t[0], "sans"),
|
|
5208
5222
|
frak: (t) => g(t[0], "frak"),
|
|
@@ -5210,18 +5224,18 @@ const x = {
|
|
|
5210
5224
|
bb: (t) => g(t[0], "bb"),
|
|
5211
5225
|
cal: (t) => g(t[0], "cal"),
|
|
5212
5226
|
vec: (t, n, o) => {
|
|
5213
|
-
const e =
|
|
5227
|
+
const e = X(n, "("), r = h("mrow"), l = h("mo", e[0]), u = h("mo", e[1]), p = et(t, o), c = L(n, "gap") || "0.5em";
|
|
5214
5228
|
return p.setAttribute("rowspacing", c), p.setAttribute("columnspacing", "0.5em"), r.append(l, p, u), r;
|
|
5215
5229
|
},
|
|
5216
5230
|
h: (t, n) => h("mspace", "", { width: t[0][0].value }),
|
|
5217
5231
|
// 额外
|
|
5218
5232
|
//
|
|
5219
5233
|
x_table: (t, n) => {
|
|
5220
|
-
const o =
|
|
5234
|
+
const o = et(t);
|
|
5221
5235
|
return n.cases && o.setAttribute("columnalign", "left"), o;
|
|
5222
5236
|
}
|
|
5223
5237
|
};
|
|
5224
|
-
function
|
|
5238
|
+
function et(t, n, o) {
|
|
5225
5239
|
let e = 0;
|
|
5226
5240
|
const r = h("mtable");
|
|
5227
5241
|
for (const l of t) {
|
|
@@ -5243,7 +5257,7 @@ function tt(t, n, o) {
|
|
|
5243
5257
|
}
|
|
5244
5258
|
return r;
|
|
5245
5259
|
}
|
|
5246
|
-
function
|
|
5260
|
+
function Kt(t) {
|
|
5247
5261
|
const n = [
|
|
5248
5262
|
_.prime,
|
|
5249
5263
|
_["prime.double"],
|
|
@@ -5252,28 +5266,28 @@ function Bt(t) {
|
|
|
5252
5266
|
];
|
|
5253
5267
|
return t <= 4 ? n[t - 1] : _.prime.repeat(t);
|
|
5254
5268
|
}
|
|
5255
|
-
function
|
|
5256
|
-
for (const t of
|
|
5269
|
+
function Rt() {
|
|
5270
|
+
for (const t of dt)
|
|
5257
5271
|
x[t.id] = (n, o, e) => {
|
|
5258
5272
|
const r = x.op([[{ type: "str", value: t.str || t.id }]], {}, e);
|
|
5259
5273
|
if (n) {
|
|
5260
|
-
const l =
|
|
5261
|
-
return l.append(r,
|
|
5274
|
+
const l = yt();
|
|
5275
|
+
return l.append(r, Ut(wt(n))), l;
|
|
5262
5276
|
} else
|
|
5263
5277
|
return r;
|
|
5264
5278
|
};
|
|
5265
5279
|
}
|
|
5266
|
-
|
|
5267
|
-
const
|
|
5280
|
+
Rt();
|
|
5281
|
+
const it = {
|
|
5268
5282
|
quad: "1em",
|
|
5269
5283
|
med: "0.222em",
|
|
5270
5284
|
thin: "0.17em",
|
|
5271
5285
|
thick: "0.28em",
|
|
5272
5286
|
wide: "2em"
|
|
5273
5287
|
};
|
|
5274
|
-
for (const t in
|
|
5275
|
-
x[t] = () => x.h([[{ type: "str", value:
|
|
5276
|
-
function
|
|
5288
|
+
for (const t in it)
|
|
5289
|
+
x[t] = () => x.h([[{ type: "str", value: it[t] }]]);
|
|
5290
|
+
function Jt(t) {
|
|
5277
5291
|
switch (t) {
|
|
5278
5292
|
case "̀":
|
|
5279
5293
|
case "`":
|
|
@@ -5344,7 +5358,7 @@ function Rt(t) {
|
|
|
5344
5358
|
return t;
|
|
5345
5359
|
}
|
|
5346
5360
|
}
|
|
5347
|
-
function
|
|
5361
|
+
function Wt() {
|
|
5348
5362
|
const t = [
|
|
5349
5363
|
"grave",
|
|
5350
5364
|
"acute",
|
|
@@ -5371,8 +5385,8 @@ function Jt() {
|
|
|
5371
5385
|
for (const n of t)
|
|
5372
5386
|
x[n] = (o, e, r) => x.accent([o[0], [{ type: "f", value: n }]], {}, r);
|
|
5373
5387
|
}
|
|
5374
|
-
|
|
5375
|
-
function
|
|
5388
|
+
Wt();
|
|
5389
|
+
function Gt() {
|
|
5376
5390
|
const t = [
|
|
5377
5391
|
{ name: "abs", l: y("|"), r: y("|") },
|
|
5378
5392
|
{ name: "norm", l: y("‖"), r: y("‖") },
|
|
@@ -5383,8 +5397,8 @@ function Wt() {
|
|
|
5383
5397
|
for (const n of t)
|
|
5384
5398
|
x[n.name] = (o, e, r) => x.lr([[n.l, ...o[0], n.r]], e, r);
|
|
5385
5399
|
}
|
|
5386
|
-
|
|
5387
|
-
function
|
|
5400
|
+
Gt();
|
|
5401
|
+
function F(t, n, o, e, r) {
|
|
5388
5402
|
const l = t === "under" ? h("munder", null, { accentunder: "true" }) : h("mover", null, { accent: "true" }), u = h("mrow");
|
|
5389
5403
|
if (u.append(g(n, r)), e) {
|
|
5390
5404
|
const p = h("mrow");
|
|
@@ -5397,22 +5411,22 @@ function I(t, n, o, e, r) {
|
|
|
5397
5411
|
}
|
|
5398
5412
|
return l;
|
|
5399
5413
|
}
|
|
5400
|
-
function
|
|
5414
|
+
function ct(t, n, o) {
|
|
5401
5415
|
const e = t === "under" ? h("munder", null, { accentunder: "true" }) : h("mover", null, { accent: "true" }), r = h("mrow");
|
|
5402
5416
|
return r.append(g(n, o)), t === "under" && (r.style.borderBottom = "1px solid black"), t === "over" && (r.style.borderTop = "1px solid black"), e.append(r), e;
|
|
5403
5417
|
}
|
|
5404
|
-
const
|
|
5418
|
+
const V = {
|
|
5405
5419
|
"√": x.sqrt,
|
|
5406
5420
|
"∛": (t, n, o) => x.root([[y("3")], t[0]], null, o),
|
|
5407
5421
|
"∜": (t, n, o) => x.root([[y("4")], t[0]], null, o)
|
|
5408
5422
|
};
|
|
5409
|
-
function
|
|
5423
|
+
function Ut(t) {
|
|
5410
5424
|
const n = h("mrow"), o = h("mo");
|
|
5411
5425
|
o.textContent = "(";
|
|
5412
5426
|
const e = g(t), r = h("mo");
|
|
5413
5427
|
return r.textContent = ")", n.append(o, e, r), n;
|
|
5414
5428
|
}
|
|
5415
|
-
function
|
|
5429
|
+
function Xt(t) {
|
|
5416
5430
|
t = Z(t);
|
|
5417
5431
|
const n = new Object();
|
|
5418
5432
|
let o = "", e = [];
|
|
@@ -5434,17 +5448,17 @@ function L(t, n) {
|
|
|
5434
5448
|
if (o.value === "none")
|
|
5435
5449
|
return null;
|
|
5436
5450
|
if (o.children)
|
|
5437
|
-
return o.children.find((r) => q(r, y(":"))) ?
|
|
5451
|
+
return o.children.find((r) => q(r, y(":"))) ? Xt(o.children) : o.children.map((r) => r.value).join("");
|
|
5438
5452
|
}
|
|
5439
5453
|
return t[n].map((r) => r.value).join("");
|
|
5440
5454
|
}
|
|
5441
|
-
function
|
|
5455
|
+
function wt(t) {
|
|
5442
5456
|
const n = [];
|
|
5443
5457
|
for (const o of t)
|
|
5444
5458
|
n.push(...o, y(","));
|
|
5445
5459
|
return n.slice(0, -1);
|
|
5446
5460
|
}
|
|
5447
|
-
function
|
|
5461
|
+
function ut(t, n = "serif") {
|
|
5448
5462
|
function o(r) {
|
|
5449
5463
|
return "abcdefghijklmnopqrstuvwxyz".indexOf(r.toLowerCase());
|
|
5450
5464
|
}
|
|
@@ -5476,13 +5490,13 @@ function it(t, n = "serif") {
|
|
|
5476
5490
|
return n === "serif" || (t = t.replace(/[0-9]/g, (r) => [...e[n].num][r]), t = t.replace(/[a-z]/g, (r) => [...e[n].low][o(r)]), t = t.replace(/[A-Z]/g, (r) => [...e[n].up][o(r)])), t;
|
|
5477
5491
|
}
|
|
5478
5492
|
function g(t, n) {
|
|
5479
|
-
const o =
|
|
5480
|
-
t =
|
|
5493
|
+
const o = yt();
|
|
5494
|
+
t = gt(t);
|
|
5481
5495
|
{
|
|
5482
5496
|
let e = !1;
|
|
5483
5497
|
for (const r in t) {
|
|
5484
5498
|
const l = t[r];
|
|
5485
|
-
if (
|
|
5499
|
+
if (lt(l)) {
|
|
5486
5500
|
e = !0;
|
|
5487
5501
|
break;
|
|
5488
5502
|
}
|
|
@@ -5491,12 +5505,12 @@ function g(t, n) {
|
|
|
5491
5505
|
const r = [[]];
|
|
5492
5506
|
for (let l = 0; l < t.length; l++) {
|
|
5493
5507
|
const u = t[l];
|
|
5494
|
-
|
|
5508
|
+
lt(u) ? r.push([]) : r.at(-1).push(u);
|
|
5495
5509
|
}
|
|
5496
|
-
return
|
|
5510
|
+
return et(r, void 0, !mt());
|
|
5497
5511
|
}
|
|
5498
5512
|
}
|
|
5499
|
-
t =
|
|
5513
|
+
t = vt(t);
|
|
5500
5514
|
{
|
|
5501
5515
|
const e = [];
|
|
5502
5516
|
for (const r of t)
|
|
@@ -5513,15 +5527,15 @@ function g(t, n) {
|
|
|
5513
5527
|
const r = Number(e), l = t[r];
|
|
5514
5528
|
if (l.type === "f") {
|
|
5515
5529
|
if (l.children && (l.kh === "()" || !l.kh)) {
|
|
5516
|
-
const { attr: u, dic: p } =
|
|
5530
|
+
const { attr: u, dic: p } = kt(l);
|
|
5517
5531
|
if (x[l.value]) {
|
|
5518
5532
|
const c = x[l.value](u, p, n);
|
|
5519
5533
|
o.append(c);
|
|
5520
5534
|
} else if (_[l.value]) {
|
|
5521
5535
|
const c = h("mi", _[l.value]);
|
|
5522
|
-
o.append(c, g(
|
|
5523
|
-
} else if (
|
|
5524
|
-
const c =
|
|
5536
|
+
o.append(c, g(Tt(l.children), n));
|
|
5537
|
+
} else if (V[l.value]) {
|
|
5538
|
+
const c = V[l.value](u, p, n);
|
|
5525
5539
|
o.append(c);
|
|
5526
5540
|
}
|
|
5527
5541
|
} else if (_[l.value]) {
|
|
@@ -5545,54 +5559,54 @@ function g(t, n) {
|
|
|
5545
5559
|
} else if (x[l.value]) {
|
|
5546
5560
|
const u = x[l.value](null, null, n);
|
|
5547
5561
|
o.append(u);
|
|
5548
|
-
} else if (
|
|
5549
|
-
const u =
|
|
5562
|
+
} else if (V[l.value]) {
|
|
5563
|
+
const u = V[l.value]([l.children], null, n);
|
|
5550
5564
|
o.append(u);
|
|
5551
5565
|
}
|
|
5552
5566
|
}
|
|
5553
5567
|
if (l.type === "str") {
|
|
5554
|
-
const u = h("ms",
|
|
5568
|
+
const u = h("ms", ut(l.value, n));
|
|
5555
5569
|
o.append(u);
|
|
5556
5570
|
}
|
|
5557
5571
|
if (l.type === "v" || l.type === "sharp") {
|
|
5558
5572
|
let u, p = l.value;
|
|
5559
|
-
l.value.match(/[0-9.]+/) ? u = "mn" : l.value.match(/[a-zA-Z\u0391-\u03C9]/) ? u = "mi" : (l.value.match(/^'+$/) && (l.esc || (p =
|
|
5560
|
-
const c = h(u,
|
|
5573
|
+
l.value.match(/[0-9.]+/) ? u = "mn" : l.value.match(/[a-zA-Z\u0391-\u03C9]/) ? u = "mi" : (l.value.match(/^'+$/) && (l.esc || (p = Kt(l.value.length))), u = "mo"), l.type === "sharp" && l.value.startsWith("emoji.") && (u = "mi", p = St[l.value.replace("emoji.", "")]);
|
|
5574
|
+
const c = h(u, ut(p, n));
|
|
5561
5575
|
o.append(c);
|
|
5562
5576
|
}
|
|
5563
5577
|
l.type === "group" && (l.kh && l.kh.length === 1 ? (o.append(h("mo", l.kh, { stretchy: "false" })), o.append(g(l.children, n))) : o.append(x.lr([[l]], null, n)));
|
|
5564
5578
|
}
|
|
5565
5579
|
return o;
|
|
5566
5580
|
}
|
|
5567
|
-
function
|
|
5581
|
+
function tn(t) {
|
|
5568
5582
|
for (const n in t)
|
|
5569
|
-
|
|
5583
|
+
J[n] && (J[n] = t[n]);
|
|
5570
5584
|
}
|
|
5571
|
-
function
|
|
5572
|
-
|
|
5573
|
-
const o =
|
|
5585
|
+
function qt(t, n) {
|
|
5586
|
+
Y(!n);
|
|
5587
|
+
const o = Nt(t), e = h("math");
|
|
5574
5588
|
n || e.setAttribute("display", "block");
|
|
5575
5589
|
const r = g(o);
|
|
5576
5590
|
return e.append(r), e;
|
|
5577
5591
|
}
|
|
5578
|
-
function tn(t, n) {
|
|
5579
|
-
return Y(kt(t, n));
|
|
5580
|
-
}
|
|
5581
5592
|
function nn(t, n) {
|
|
5582
|
-
return
|
|
5593
|
+
return nt(qt(t, n));
|
|
5594
|
+
}
|
|
5595
|
+
function en(t, n) {
|
|
5596
|
+
return It(qt(t, n));
|
|
5583
5597
|
}
|
|
5584
|
-
const
|
|
5598
|
+
const on = {
|
|
5585
5599
|
lan: "0.11.1",
|
|
5586
5600
|
symbol: "0.15.1",
|
|
5587
5601
|
emoji: "0.15.1"
|
|
5588
5602
|
};
|
|
5589
5603
|
export {
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5604
|
+
gt as ast2,
|
|
5605
|
+
vt as ast3,
|
|
5606
|
+
tn as init,
|
|
5607
|
+
nn as toMML,
|
|
5608
|
+
en as toMMLHTML,
|
|
5609
|
+
qt as toMMLV,
|
|
5610
|
+
on as version
|
|
5597
5611
|
};
|
|
5598
5612
|
//# sourceMappingURL=xmmath.es.js.map
|