@pie-element/element-player 0.1.5-next.20261007064237 → 0.1.5-next.20261007201108
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/math-mathjax-BYcKE-jQ.js +1054 -0
- package/dist/pie-element-player.js +1 -1
- package/package.json +2 -2
- package/dist/math-mathjax-CnC94ZnZ.js +0 -770
|
@@ -0,0 +1,1054 @@
|
|
|
1
|
+
//#region ../shared/math-rendering-mathjax/dist/index.js
|
|
2
|
+
var e = "4.1.3", t = "https://github.com/pie-framework/pie-elements-ng/blob/develop/docs/MATH-RENDERING.md#assets", n = "@pie-lib/math-rendering@2", r = ["nemeth", "euro"], i = `mathjax@${e}/sre`, a = /^[^@]+@[^@]+$/;
|
|
3
|
+
function o(e) {
|
|
4
|
+
if (!e) return;
|
|
5
|
+
let t;
|
|
6
|
+
try {
|
|
7
|
+
t = new URL(e);
|
|
8
|
+
} catch {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (t.origin === "null") return;
|
|
12
|
+
let n = t.pathname.split("/");
|
|
13
|
+
for (let e = n.length - 1; e > 0; e--) {
|
|
14
|
+
let r = n[e];
|
|
15
|
+
if (r === "node_modules") return;
|
|
16
|
+
if (!a.test(r)) continue;
|
|
17
|
+
let i = n[e - 1]?.startsWith("@") ? e - 1 : e;
|
|
18
|
+
return t.origin + n.slice(0, i).join("/");
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function s() {
|
|
22
|
+
let e = globalThis[n]?.opts;
|
|
23
|
+
return e && typeof e == "object" ? e : {};
|
|
24
|
+
}
|
|
25
|
+
function c(e) {
|
|
26
|
+
if (typeof e != "string" || !e) return;
|
|
27
|
+
let t = typeof document > "u" ? void 0 : document.baseURI;
|
|
28
|
+
try {
|
|
29
|
+
return new URL(e, t).href.replace(/\/+$/, "");
|
|
30
|
+
} catch {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function l(e) {
|
|
35
|
+
if (!e || typeof e != "object") return;
|
|
36
|
+
let t = /* @__PURE__ */ new Map();
|
|
37
|
+
for (let [n, r] of Object.entries(e)) {
|
|
38
|
+
let e = c(r);
|
|
39
|
+
e && t.set(n, e);
|
|
40
|
+
}
|
|
41
|
+
return t.size ? t : void 0;
|
|
42
|
+
}
|
|
43
|
+
function u(e) {
|
|
44
|
+
if (Array.isArray(e)) return new Map(e.filter((e) => typeof e == "string").map((e) => [e, void 0]));
|
|
45
|
+
if (e && typeof e == "object") return new Map(Object.entries(e).map(([e, t]) => [e, typeof t == "string" ? t : void 0]));
|
|
46
|
+
}
|
|
47
|
+
function d(e, t) {
|
|
48
|
+
let n = s(), r = c(e.assetRoot ?? n.assetRoot) ?? o(t);
|
|
49
|
+
return {
|
|
50
|
+
root: r,
|
|
51
|
+
speechPath: c(e.speechPath ?? n.speechPath) ?? (r ? `${r}/${i}` : void 0),
|
|
52
|
+
speechLocales: u(e.speechLocales ?? n.speechLocales),
|
|
53
|
+
urls: l(e.assetUrls ?? n.assetUrls)
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function f(e, t) {
|
|
57
|
+
if (!(!e || !t)) {
|
|
58
|
+
for (let n of [...e.keys()]) !t.has(n) && !r.includes(n) && e.delete(n);
|
|
59
|
+
for (let [n, r] of t) (r || !e.has(n)) && e.set(n, r ?? n);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function p(e) {
|
|
63
|
+
if (!(!e || e.has("en"))) return [...e.keys()].find((e) => !r.includes(e));
|
|
64
|
+
}
|
|
65
|
+
var m = {
|
|
66
|
+
untypeset: "no MathJax loads, so math stays untypeset",
|
|
67
|
+
"no-web-fonts": "math renders without web fonts",
|
|
68
|
+
"no-web-fonts-or-speech": "math renders without web fonts and speech"
|
|
69
|
+
}, h = Symbol.for("@pie-element/shared-math-rendering-mathjax/no-assets");
|
|
70
|
+
function g(e) {
|
|
71
|
+
let r = globalThis;
|
|
72
|
+
r[h] ??= [];
|
|
73
|
+
let i = r[h];
|
|
74
|
+
if (i.includes(e)) return;
|
|
75
|
+
i.push(e);
|
|
76
|
+
let a = `[math-rendering] No asset root for MathJax: ${m[e]}. Set window['${n}'].opts.assetRoot to an npm root. See ${t}`;
|
|
77
|
+
e === "untypeset" ? console.error(a) : console.warn(a), !(typeof window > "u") && window.dispatchEvent(new CustomEvent("pie-mathjax-no-asset-root", { detail: {
|
|
78
|
+
effect: e,
|
|
79
|
+
message: a,
|
|
80
|
+
docsUrl: t
|
|
81
|
+
} }));
|
|
82
|
+
}
|
|
83
|
+
var _ = "https://github.com/pie-framework/pie-players/blob/develop/docs/item-player/loading-strategies.md#one-mathjax-version-per-page", v = "pie-mathjax-version-conflict", y = Symbol.for("@pie-element/shared-math-rendering-mathjax/unsupported-page");
|
|
84
|
+
function ee(e, t) {
|
|
85
|
+
if (typeof window > "u") return;
|
|
86
|
+
let n = globalThis;
|
|
87
|
+
n[y] ??= {
|
|
88
|
+
logged: !1,
|
|
89
|
+
conditions: []
|
|
90
|
+
};
|
|
91
|
+
let r = n[y];
|
|
92
|
+
if (r.conditions.includes(e)) return;
|
|
93
|
+
r.conditions.push(e);
|
|
94
|
+
let i = `[math-rendering] Unsupported page (${e}): ${t}. PIE supports one MathJax major version per page; with MathJax 3 and 4 on one page, math rendering is best effort and may break. See ${_}`;
|
|
95
|
+
r.logged || (r.logged = !0, console.error(i)), window.dispatchEvent(new CustomEvent(v, { detail: {
|
|
96
|
+
condition: e,
|
|
97
|
+
message: i,
|
|
98
|
+
docsUrl: _
|
|
99
|
+
} }));
|
|
100
|
+
}
|
|
101
|
+
function te() {
|
|
102
|
+
let e = window.MathJax?.version;
|
|
103
|
+
return typeof e == "string" && e.startsWith("3.") ? e : void 0;
|
|
104
|
+
}
|
|
105
|
+
function b() {
|
|
106
|
+
return window.MathJax;
|
|
107
|
+
}
|
|
108
|
+
function ne(t, { root: n, speechPath: r }) {
|
|
109
|
+
n && (t.loader = {
|
|
110
|
+
...t.loader,
|
|
111
|
+
paths: {
|
|
112
|
+
fonts: `${n}/@mathjax`,
|
|
113
|
+
"mathjax-newcm": `${n}/@mathjax/mathjax-newcm-font@${e}`,
|
|
114
|
+
"mathjax-mhchem-extension": `${n}/@mathjax/mathjax-mhchem-font-extension@${e}`
|
|
115
|
+
}
|
|
116
|
+
}), r && (t.options = {
|
|
117
|
+
...t.options,
|
|
118
|
+
worker: {
|
|
119
|
+
path: r,
|
|
120
|
+
maps: `${r}/mathmaps`
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
function re(e, t) {
|
|
125
|
+
let n = t.srcUrl || (t.root ? `${t.root}/mathjax@4.1.3/tex-mml-chtml.js` : void 0);
|
|
126
|
+
return n ? (ne(e, t), new Promise((t, r) => {
|
|
127
|
+
window.MathJax = e;
|
|
128
|
+
let i = document.createElement("script");
|
|
129
|
+
i.src = n, i.async = !0, i.onload = () => t(!0), i.onerror = () => r(/* @__PURE__ */ Error("Failed to load MathJax")), document.head.appendChild(i);
|
|
130
|
+
})) : (g("untypeset"), Promise.resolve(!1));
|
|
131
|
+
}
|
|
132
|
+
var ie = globalThis, x = "PIE-MJX-CHTML-styles", ae = ["MJX-CHTML-styles", "MJX-SVG-styles"], oe = te, se = "http://www.w3.org/1998/Math/MathML", ce = /^([a-z_][\w.-]*):math$/, le = /^[a-z][a-z0-9-]*$/;
|
|
133
|
+
function ue(e) {
|
|
134
|
+
for (let t of e.querySelectorAll("*")) {
|
|
135
|
+
let n = ce.exec(t.tagName.toLowerCase())?.[1];
|
|
136
|
+
!n || !e.contains(t) || t.closest("mjx-container") || t.replaceWith(de(t, `${n}:`));
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function de(e, t) {
|
|
140
|
+
let n = e.tagName.toLowerCase().slice(t.length);
|
|
141
|
+
if (!le.test(n)) return e;
|
|
142
|
+
let r = e.ownerDocument.createElementNS(se, n);
|
|
143
|
+
for (let t of e.attributes) r.setAttribute(t.name, t.value);
|
|
144
|
+
for (let n of [...e.childNodes]) {
|
|
145
|
+
let e = n instanceof Element && n.tagName.toLowerCase().startsWith(t);
|
|
146
|
+
r.appendChild(e ? de(n, t) : n);
|
|
147
|
+
}
|
|
148
|
+
return r;
|
|
149
|
+
}
|
|
150
|
+
var fe = /* @__PURE__ */ new Set([
|
|
151
|
+
"updiagonalstrike",
|
|
152
|
+
"downdiagonalstrike",
|
|
153
|
+
"verticalstrike",
|
|
154
|
+
"horizontalstrike"
|
|
155
|
+
]), pe = {
|
|
156
|
+
thin: "0.035em",
|
|
157
|
+
medium: "0.07em",
|
|
158
|
+
thick: "0.14em"
|
|
159
|
+
}, me = {
|
|
160
|
+
tight: "0em",
|
|
161
|
+
medium: "0.1em",
|
|
162
|
+
loose: "0.2em"
|
|
163
|
+
}, he = /^(\d+(\.\d*)?|\.\d+)(em|ex|px|pt|pc|in|cm|mm)$/, ge = /^(#[0-9a-f]{3,8}|[a-z]+)$/i, _e = /^(\d+(\.\d*)?|\.\d+)$/, ve = /* @__PURE__ */ new Set([
|
|
164
|
+
"mn",
|
|
165
|
+
"mo",
|
|
166
|
+
"mi",
|
|
167
|
+
"mtext"
|
|
168
|
+
]), ye = /* @__PURE__ */ new Set([
|
|
169
|
+
"stackalign",
|
|
170
|
+
"charalign",
|
|
171
|
+
"charspacing",
|
|
172
|
+
"longdivstyle"
|
|
173
|
+
]);
|
|
174
|
+
function S(e, t, n = [], r = {}) {
|
|
175
|
+
let i = e.createElementNS(se, t);
|
|
176
|
+
for (let [e, t] of Object.entries(r)) i.setAttribute(e, t);
|
|
177
|
+
for (let e of n) e && i.appendChild(e);
|
|
178
|
+
return i;
|
|
179
|
+
}
|
|
180
|
+
function C(e, t) {
|
|
181
|
+
let n = S(e.document, "mo");
|
|
182
|
+
return n.textContent = t, n;
|
|
183
|
+
}
|
|
184
|
+
function be(e) {
|
|
185
|
+
let t = S(e.document, "mn");
|
|
186
|
+
return t.textContent = "0", S(e.document, "mphantom", [t]);
|
|
187
|
+
}
|
|
188
|
+
function w(e, t) {
|
|
189
|
+
return e.getAttribute(t)?.trim().toLowerCase() || void 0;
|
|
190
|
+
}
|
|
191
|
+
function T(e, t) {
|
|
192
|
+
let n = Number.parseInt(e.getAttribute(t) ?? "", 10);
|
|
193
|
+
return Number.isFinite(n) ? n : 0;
|
|
194
|
+
}
|
|
195
|
+
function E(e) {
|
|
196
|
+
return e.localName === "none" || e.localName === "mrow" && e.children.length === 0 && !e.textContent?.trim();
|
|
197
|
+
}
|
|
198
|
+
function D(e, t, n = e) {
|
|
199
|
+
switch (t) {
|
|
200
|
+
case "left": return 0;
|
|
201
|
+
case "center": return Math.floor(e / 2);
|
|
202
|
+
case "right": return e;
|
|
203
|
+
default: return n;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function O(e, t, n) {
|
|
207
|
+
let r = [], i, a, o = (e, t) => {
|
|
208
|
+
let s = (e) => t.reduceRight((e, t) => {
|
|
209
|
+
let n = t.cloneNode(!1);
|
|
210
|
+
return n.appendChild(e), n;
|
|
211
|
+
}, e);
|
|
212
|
+
if (e.localName === "mstyle") for (let n of [...e.children]) o(n, [...t, e]);
|
|
213
|
+
else if (E(e)) r.push(null);
|
|
214
|
+
else if (e.localName === "mn" && e.children.length === 0) {
|
|
215
|
+
let t = [...(e.textContent ?? "").trim()];
|
|
216
|
+
for (let a of t) {
|
|
217
|
+
a === n.decimalPoint && (i ??= r.length);
|
|
218
|
+
let t = e.cloneNode(!1);
|
|
219
|
+
t.textContent = a, r.push(s(t));
|
|
220
|
+
}
|
|
221
|
+
t.length && (a ??= r.length);
|
|
222
|
+
} else ve.has(e.localName) && e.textContent?.trim() === n.decimalPoint && (i ??= r.length), r.push(s(e));
|
|
223
|
+
};
|
|
224
|
+
for (let t of e) o(t, []);
|
|
225
|
+
return {
|
|
226
|
+
kind: "digits",
|
|
227
|
+
cells: r,
|
|
228
|
+
anchor: D(r.length, n.stackAlign, i ?? a),
|
|
229
|
+
position: t
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
function k(e) {
|
|
233
|
+
return (e ?? "").toLowerCase().split(/\s+/).filter((e) => fe.has(e));
|
|
234
|
+
}
|
|
235
|
+
function xe(e, t) {
|
|
236
|
+
let n = [...e.children].filter((e) => !E(e));
|
|
237
|
+
return n.length <= 1 ? n[0] ?? null : S(t.document, "mrow", n);
|
|
238
|
+
}
|
|
239
|
+
function Se(e, t, n) {
|
|
240
|
+
let r = w(e, "location") ?? "n", i = k(e.getAttribute("crossout")), a = [...e.children].map((e) => E(e) ? null : e.localName === "mscarry" ? {
|
|
241
|
+
content: xe(e, n),
|
|
242
|
+
location: w(e, "location") ?? r,
|
|
243
|
+
crossout: e.hasAttribute("crossout") ? k(e.getAttribute("crossout")) : i
|
|
244
|
+
} : {
|
|
245
|
+
content: e,
|
|
246
|
+
location: r,
|
|
247
|
+
crossout: i
|
|
248
|
+
}), o = e.getAttribute("scriptsizemultiplier")?.trim() ?? "";
|
|
249
|
+
return {
|
|
250
|
+
kind: "carries",
|
|
251
|
+
carries: a,
|
|
252
|
+
anchor: D(a.length, n.stackAlign),
|
|
253
|
+
position: t,
|
|
254
|
+
scale: _e.test(o) ? o : "0.6"
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
function A(e) {
|
|
258
|
+
let t = w(e, "mslinethickness") ?? "medium", n = pe[t] ?? (he.test(t) ? t : "0.07em"), r = e.getAttribute("mathcolor")?.trim() ?? "";
|
|
259
|
+
return `${n} solid ${ge.test(r) ? r : "currentColor"}`;
|
|
260
|
+
}
|
|
261
|
+
function Ce(e, t, n) {
|
|
262
|
+
let r = Math.max(0, T(e, "length"));
|
|
263
|
+
return {
|
|
264
|
+
kind: "line",
|
|
265
|
+
length: r,
|
|
266
|
+
anchor: D(r, n.stackAlign),
|
|
267
|
+
position: t,
|
|
268
|
+
border: A(e)
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
function j(e, t, n, r, i) {
|
|
272
|
+
e.forEach((e, a) => {
|
|
273
|
+
let o = t + a * n + T(e, "position");
|
|
274
|
+
switch (e.localName) {
|
|
275
|
+
case "msgroup":
|
|
276
|
+
j([...e.children], o, T(e, "shift"), r, i);
|
|
277
|
+
break;
|
|
278
|
+
case "msline":
|
|
279
|
+
i.push(Ce(e, o, r));
|
|
280
|
+
break;
|
|
281
|
+
case "mscarries":
|
|
282
|
+
i.push(Se(e, o, r));
|
|
283
|
+
break;
|
|
284
|
+
case "msrow":
|
|
285
|
+
case "mrow":
|
|
286
|
+
i.push(O([...e.children], o, r));
|
|
287
|
+
break;
|
|
288
|
+
default: i.push(O([e], o, r));
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
function M(e) {
|
|
293
|
+
return -e.anchor - e.position;
|
|
294
|
+
}
|
|
295
|
+
function N(e) {
|
|
296
|
+
return e.kind === "digits" ? e.cells.length : e.kind === "carries" ? e.carries.length : e.length;
|
|
297
|
+
}
|
|
298
|
+
function P(e) {
|
|
299
|
+
return M(e) + N(e) - 1;
|
|
300
|
+
}
|
|
301
|
+
function we(e, t, n, r) {
|
|
302
|
+
let i = (e) => S(r.document, "mpadded", [t], {
|
|
303
|
+
width: "0",
|
|
304
|
+
...e ? { lspace: e } : {}
|
|
305
|
+
}), a = (e, t) => S(r.document, e, t);
|
|
306
|
+
switch (n) {
|
|
307
|
+
case "s": return a("munder", [e, i("-0.5width")]);
|
|
308
|
+
case "ne": return a("msup", [e, i()]);
|
|
309
|
+
case "se": return a("msub", [e, i()]);
|
|
310
|
+
case "nw": return a("mmultiscripts", [
|
|
311
|
+
e,
|
|
312
|
+
a("mprescripts", []),
|
|
313
|
+
a("none", []),
|
|
314
|
+
i("-1width")
|
|
315
|
+
]);
|
|
316
|
+
case "sw": return a("mmultiscripts", [
|
|
317
|
+
e,
|
|
318
|
+
a("mprescripts", []),
|
|
319
|
+
i("-1width"),
|
|
320
|
+
a("none", [])
|
|
321
|
+
]);
|
|
322
|
+
case "w": return t.setAttribute("scriptlevel", "+1"), a("mrow", [i("-1width"), e]);
|
|
323
|
+
case "e": return t.setAttribute("scriptlevel", "+1"), a("mrow", [e, i()]);
|
|
324
|
+
default: return a("mover", [e, i("-0.5width")]);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
function Te(e, t, n) {
|
|
328
|
+
let r = S(n.document, "menclose", [e], {
|
|
329
|
+
notation: t.join(" "),
|
|
330
|
+
"data-padding": "0.1em",
|
|
331
|
+
"data-thickness": "0.067em"
|
|
332
|
+
}), i = t.some((e) => e.endsWith("diagonalstrike")) ? .167 : t.includes("horizontalstrike") ? .1 : 0;
|
|
333
|
+
return i ? S(n.document, "mpadded", [r], {
|
|
334
|
+
lspace: `-${i}em`,
|
|
335
|
+
width: `-${2 * i}em`
|
|
336
|
+
}) : r;
|
|
337
|
+
}
|
|
338
|
+
function Ee(e, t, n, r, i) {
|
|
339
|
+
let a = e && t.crossout.length ? Te(e, t.crossout, i) : e;
|
|
340
|
+
if (!t.content) return a;
|
|
341
|
+
let o = S(i.document, "mstyle", [t.content], { scriptsizemultiplier: r });
|
|
342
|
+
return we(a ?? be(i), o, n, i);
|
|
343
|
+
}
|
|
344
|
+
function F(e, t) {
|
|
345
|
+
return e.carries[t - M(e)] ?? null;
|
|
346
|
+
}
|
|
347
|
+
function De(e, t, n, r) {
|
|
348
|
+
let i = e.content;
|
|
349
|
+
n.forEach((e, a) => {
|
|
350
|
+
let o = n.length - 1 - a, s = n[o], c = F(s, t), l = n.slice(0, o).some((e) => F(e, t));
|
|
351
|
+
if (!c && !l) return;
|
|
352
|
+
let u = c ?? {
|
|
353
|
+
content: be(r),
|
|
354
|
+
location: "n",
|
|
355
|
+
crossout: []
|
|
356
|
+
}, d = a === 0 ? u.location : "n";
|
|
357
|
+
i = Ee(i, u, d, s.scale, r);
|
|
358
|
+
}), e.content = i;
|
|
359
|
+
}
|
|
360
|
+
function I(e, t) {
|
|
361
|
+
let n = e.filter((e) => N(e) > 0), r = Math.min(0, ...n.map(M)), i = Math.max(r, ...n.map(P)) - r + 1, a = -r, o = [], s = /* @__PURE__ */ new Map(), c = () => Array.from({ length: i }, () => ({
|
|
362
|
+
content: null,
|
|
363
|
+
borders: {}
|
|
364
|
+
})), l = (e) => e.length === 0 ? Array.from({ length: i }, (e, t) => t) : Array.from({ length: e.length }, (t, n) => a + M(e) + n), u = [], d = [], f = (e) => {
|
|
365
|
+
let n = c();
|
|
366
|
+
e.cells.forEach((t, r) => {
|
|
367
|
+
n[a + M(e) + r].content = t;
|
|
368
|
+
}), u.length && n.forEach((e, n) => {
|
|
369
|
+
De(e, n - a, u, t);
|
|
370
|
+
});
|
|
371
|
+
for (let e of d) for (let t of l(e)) n[t].borders.top = e.border;
|
|
372
|
+
u = [], d = [], s.set(e, o.length), o.push(n);
|
|
373
|
+
};
|
|
374
|
+
for (let t of e) t.kind === "digits" ? f(t) : t.kind === "carries" ? u.push(t) : d.push(t);
|
|
375
|
+
(u.length || !o.length) && f({
|
|
376
|
+
kind: "digits",
|
|
377
|
+
cells: [],
|
|
378
|
+
anchor: 0,
|
|
379
|
+
position: 0
|
|
380
|
+
});
|
|
381
|
+
let p = o[o.length - 1];
|
|
382
|
+
for (let e of d) for (let t of l(e)) p[t].borders.bottom = e.border;
|
|
383
|
+
return {
|
|
384
|
+
rows: o,
|
|
385
|
+
rowOf: s,
|
|
386
|
+
origin: a
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
function L(e, { rows: t }, n) {
|
|
390
|
+
let r = S(n.document, "mtable", t.map((e) => S(n.document, "mtr", e.map((e) => {
|
|
391
|
+
let t = Object.entries(e.borders).map(([e, t]) => `border-${e}:${t}`).join(";");
|
|
392
|
+
return S(n.document, "mtd", [e.content], {
|
|
393
|
+
...t ? { style: t } : {},
|
|
394
|
+
...e.align ? { columnalign: e.align } : {}
|
|
395
|
+
});
|
|
396
|
+
}))));
|
|
397
|
+
for (let { name: t, value: n } of [...e.attributes]) ye.has(t) || r.setAttribute(t, n);
|
|
398
|
+
let i = w(e, "charspacing") ?? "medium", a = w(e, "charalign");
|
|
399
|
+
return r.setAttribute("columnspacing", me[i] ?? (he.test(i) ? i : me.medium)), r.setAttribute("columnalign", a === "left" || a === "center" ? a : "right"), r.setAttribute("rowspacing", "0"), r.setAttribute("align", e.getAttribute("align") ?? "baseline"), r;
|
|
400
|
+
}
|
|
401
|
+
function R(e) {
|
|
402
|
+
return {
|
|
403
|
+
document: e.ownerDocument,
|
|
404
|
+
stackAlign: w(e, "stackalign") ?? "decimalpoint",
|
|
405
|
+
decimalPoint: e.closest("[decimalpoint]")?.getAttribute("decimalpoint")?.trim().charAt(0) || "."
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
function Oe(e) {
|
|
409
|
+
let t = R(e), n = [];
|
|
410
|
+
return j([...e.children], 0, 0, t, n), L(e, I(n, t), t);
|
|
411
|
+
}
|
|
412
|
+
function z(e, t, n, r, i, a) {
|
|
413
|
+
for (let o = n; o <= r; o++) e[t][o].borders[i] = a;
|
|
414
|
+
}
|
|
415
|
+
function ke(e, t) {
|
|
416
|
+
let n = C(t, ")");
|
|
417
|
+
return n.setAttribute("minsize", "1.2em"), [S(t.document, "mrow", [e, S(t.document, "mspace", [], { width: "0.2em" })]), S(t.document, "mpadded", [n], {
|
|
418
|
+
voffset: "0.1em",
|
|
419
|
+
lspace: "-0.15em",
|
|
420
|
+
depth: "-0.2em",
|
|
421
|
+
height: "-0.2em"
|
|
422
|
+
})];
|
|
423
|
+
}
|
|
424
|
+
function Ae(e) {
|
|
425
|
+
let t = R(e), [n, r, ...i] = [...e.children], a = n && !E(n) ? n : null, o = r && !E(r) ? r : null, s = w(e, "longdivstyle") ?? "lefttop", c = A(e), l = [];
|
|
426
|
+
j(i, 0, 0, t, l);
|
|
427
|
+
let u = l.find((e) => e.kind === "digits");
|
|
428
|
+
u || (u = {
|
|
429
|
+
kind: "digits",
|
|
430
|
+
cells: [],
|
|
431
|
+
anchor: 0,
|
|
432
|
+
position: 0
|
|
433
|
+
}, l.unshift(u));
|
|
434
|
+
let d = [], f = (...e) => {
|
|
435
|
+
u.cells.unshift(...e), u.anchor += e.length;
|
|
436
|
+
}, p = (...e) => {
|
|
437
|
+
let n = e.flatMap((e) => e ? e.localName === "mrow" ? [...e.children] : [e] : []);
|
|
438
|
+
u.cells.push(...O(n, 0, t).cells);
|
|
439
|
+
};
|
|
440
|
+
switch (s) {
|
|
441
|
+
case "left/\\right":
|
|
442
|
+
f(a, C(t, "/")), p(C(t, "\\"), o);
|
|
443
|
+
break;
|
|
444
|
+
case "left)(right":
|
|
445
|
+
f(a, C(t, ")")), p(C(t, "("), o);
|
|
446
|
+
break;
|
|
447
|
+
case ":right=right":
|
|
448
|
+
p(C(t, ":"), a, C(t, "="), o);
|
|
449
|
+
break;
|
|
450
|
+
case "righttop":
|
|
451
|
+
case "stackedleftlinetop":
|
|
452
|
+
case "lefttop":
|
|
453
|
+
o && j([o], 0, 0, t, d), l.splice(l.indexOf(u), 0, ...d), s === "righttop" ? p(a) : s === "stackedleftlinetop" ? f(a) : f(...ke(a, t));
|
|
454
|
+
break;
|
|
455
|
+
}
|
|
456
|
+
let m = I(l, t), h = m.rows, g = m.rowOf.get(u) ?? 0, _ = (e) => m.origin + M(u) + e, v = Math.max(_(u.cells.length - 1), ...d.map((e) => m.origin + P(e)));
|
|
457
|
+
switch (s) {
|
|
458
|
+
case "left/\\right":
|
|
459
|
+
case "left)(right":
|
|
460
|
+
case ":right=right": break;
|
|
461
|
+
case "righttop": {
|
|
462
|
+
let e = h[g][_(u.cells.length - 1)];
|
|
463
|
+
e.borders.left = c, e.borders.bottom = c, z(h, g, _(0), _(u.cells.length - 1), "top", c);
|
|
464
|
+
break;
|
|
465
|
+
}
|
|
466
|
+
case "stackedleftlinetop": {
|
|
467
|
+
let e = h[g][_(0)];
|
|
468
|
+
e.borders.right = c, e.borders.bottom = c, z(h, g, _(1), v, "top", c);
|
|
469
|
+
break;
|
|
470
|
+
}
|
|
471
|
+
case "stackedrightright":
|
|
472
|
+
case "mediumstackedrightright":
|
|
473
|
+
case "shortstackedrightright":
|
|
474
|
+
case "stackedleftleft":
|
|
475
|
+
je(h, g, s, a, o, c, t);
|
|
476
|
+
break;
|
|
477
|
+
default: z(h, g, _(1), v, "top", c);
|
|
478
|
+
}
|
|
479
|
+
return L(e, m, t);
|
|
480
|
+
}
|
|
481
|
+
function je(e, t, n, r, i, a, o) {
|
|
482
|
+
let s = n === "stackedleftleft", c = s ? "right" : "left", l = (e) => e && S(o.document, "mpadded", [e], {
|
|
483
|
+
lspace: "0.2em",
|
|
484
|
+
width: "+0.4em"
|
|
485
|
+
});
|
|
486
|
+
e.length < t + 2 && e.push(e[0].map(() => ({
|
|
487
|
+
content: null,
|
|
488
|
+
borders: {}
|
|
489
|
+
}))), e.forEach((e, o) => {
|
|
490
|
+
let u = {
|
|
491
|
+
content: null,
|
|
492
|
+
borders: {},
|
|
493
|
+
align: s ? "right" : "left"
|
|
494
|
+
};
|
|
495
|
+
o === t ? (u.content = l(r), u.borders = {
|
|
496
|
+
[c]: a,
|
|
497
|
+
bottom: a
|
|
498
|
+
}) : o === t + 1 ? (u.content = l(i), n !== "shortstackedrightright" && (u.borders[c] = a)) : o > t + 1 && (n === "stackedrightright" || s) && (u.borders[c] = a), s ? e.unshift(u) : e.push(u);
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
function Me(e) {
|
|
502
|
+
for (let t of [...e.querySelectorAll("mstack, mlongdiv")]) !t.closest("math") || t.closest("mjx-container") || t.replaceWith(t.localName === "mstack" ? Oe(t) : Ae(t));
|
|
503
|
+
}
|
|
504
|
+
var Ne = "PIE-MJX-explorer-styles", B = "var(--pie-text, black)", Pe = "var(--pie-background, #ffffff)", Fe = "var(--pie-border-dark, #66686A)", V = "var(--pie-focus-outline, var(--pie-button-focus-outline, var(--pie-focus-checked-border, #1565C0)))", H = `color-mix(in srgb, ${V} 15%, transparent)`, Ie = `
|
|
505
|
+
:root mjx-container [data-sre-highlight-1]:not([data-mjx-collapsed], rect) {
|
|
506
|
+
color: ${B} !important;
|
|
507
|
+
fill: ${B} !important;
|
|
508
|
+
}
|
|
509
|
+
:root mjx-container:not([data-mjx-clone-container]) [data-sre-highlight-1]:not([data-sre-enclosed], rect) {
|
|
510
|
+
background-color: ${H} !important;
|
|
511
|
+
}
|
|
512
|
+
:root mjx-container rect[data-sre-highlight-1]:not([data-sre-enclosed]) {
|
|
513
|
+
fill: ${H} !important;
|
|
514
|
+
}
|
|
515
|
+
:root mjx-container .mjx-selected {
|
|
516
|
+
outline: 2px solid ${V} !important;
|
|
517
|
+
}
|
|
518
|
+
:root mjx-container [data-sre-highlight-2] {
|
|
519
|
+
color: ${B} !important;
|
|
520
|
+
background-color: transparent !important;
|
|
521
|
+
fill: ${B} !important;
|
|
522
|
+
outline: 2px dashed ${V} !important;
|
|
523
|
+
}
|
|
524
|
+
:root mjx-container rect[data-sre-highlight-2] {
|
|
525
|
+
fill: transparent !important;
|
|
526
|
+
stroke: ${V} !important;
|
|
527
|
+
stroke-width: 2px !important;
|
|
528
|
+
vector-effect: non-scaling-stroke;
|
|
529
|
+
}
|
|
530
|
+
:root .MJX_LiveRegion, :root .MJX_HoverRegion, :root .MJX_ToolTip {
|
|
531
|
+
color: ${B} !important;
|
|
532
|
+
background-color: ${Pe} !important;
|
|
533
|
+
border-color: ${Fe} !important;
|
|
534
|
+
}
|
|
535
|
+
:root .MJX_LiveRegion > div, :root .MJX_HoverRegion > div {
|
|
536
|
+
color: ${B} !important;
|
|
537
|
+
background-color: ${H} !important;
|
|
538
|
+
}
|
|
539
|
+
`;
|
|
540
|
+
function Le(e = document) {
|
|
541
|
+
if (e.getElementById("PIE-MJX-explorer-styles")) return;
|
|
542
|
+
let t = e.createElement("style");
|
|
543
|
+
t.id = Ne, t.textContent = Ie, e.head.appendChild(t);
|
|
544
|
+
}
|
|
545
|
+
var Re = /[-]/g, ze = {
|
|
546
|
+
"+": "positive",
|
|
547
|
+
"-": "negative",
|
|
548
|
+
"−": "negative",
|
|
549
|
+
"±": "plus or minus",
|
|
550
|
+
"∓": "minus or plus"
|
|
551
|
+
}, Be = {
|
|
552
|
+
"(": "open parenthesis",
|
|
553
|
+
"[": "open bracket",
|
|
554
|
+
"{": "open brace",
|
|
555
|
+
"⟨": "open angle bracket",
|
|
556
|
+
"⌊": "open floor",
|
|
557
|
+
"⌈": "open ceiling"
|
|
558
|
+
}, Ve = {
|
|
559
|
+
")": "close parenthesis",
|
|
560
|
+
"]": "close bracket",
|
|
561
|
+
"}": "close brace",
|
|
562
|
+
"⟩": "close angle bracket",
|
|
563
|
+
"⌋": "close floor",
|
|
564
|
+
"⌉": "close ceiling"
|
|
565
|
+
}, U = {
|
|
566
|
+
"!": "factorial",
|
|
567
|
+
"%": "percent",
|
|
568
|
+
"°": "degrees",
|
|
569
|
+
"′": "prime",
|
|
570
|
+
"″": "double prime"
|
|
571
|
+
}, He = {
|
|
572
|
+
"+": "plus",
|
|
573
|
+
"-": "minus",
|
|
574
|
+
"−": "minus",
|
|
575
|
+
"±": "plus or minus",
|
|
576
|
+
"∓": "minus or plus",
|
|
577
|
+
"×": "times",
|
|
578
|
+
"⋅": "times",
|
|
579
|
+
"·": "times",
|
|
580
|
+
"*": "times",
|
|
581
|
+
"÷": "divided by",
|
|
582
|
+
"/": "divided by",
|
|
583
|
+
"=": "equals",
|
|
584
|
+
"≠": "does not equal",
|
|
585
|
+
"<": "is less than",
|
|
586
|
+
">": "is greater than",
|
|
587
|
+
"≤": "is less than or equal to",
|
|
588
|
+
"≥": "is greater than or equal to",
|
|
589
|
+
"≈": "is approximately equal to",
|
|
590
|
+
"≡": "is equivalent to",
|
|
591
|
+
"∝": "is proportional to",
|
|
592
|
+
"∈": "is an element of",
|
|
593
|
+
"∉": "is not an element of",
|
|
594
|
+
"⊂": "is a subset of",
|
|
595
|
+
"⊆": "is a subset of or equal to",
|
|
596
|
+
"∪": "union",
|
|
597
|
+
"∩": "intersection",
|
|
598
|
+
"→": "right arrow",
|
|
599
|
+
"←": "left arrow",
|
|
600
|
+
"⇒": "implies",
|
|
601
|
+
"⇔": "if and only if",
|
|
602
|
+
"∑": "sum",
|
|
603
|
+
"∏": "product",
|
|
604
|
+
"∫": "integral",
|
|
605
|
+
"∞": "infinity",
|
|
606
|
+
"∠": "angle",
|
|
607
|
+
"⊥": "is perpendicular to",
|
|
608
|
+
"∥": "is parallel to",
|
|
609
|
+
"∴": "therefore",
|
|
610
|
+
",": "comma",
|
|
611
|
+
";": "semicolon",
|
|
612
|
+
":": "colon",
|
|
613
|
+
"|": "vertical bar",
|
|
614
|
+
"‖": "double vertical bar",
|
|
615
|
+
...Be,
|
|
616
|
+
...Ve,
|
|
617
|
+
...U
|
|
618
|
+
}, Ue = /* @__PURE__ */ new Set(["|", "‖"]), We = /* @__PURE__ */ new Set([
|
|
619
|
+
"∑",
|
|
620
|
+
"∏",
|
|
621
|
+
"∫",
|
|
622
|
+
"∪",
|
|
623
|
+
"∩"
|
|
624
|
+
]), Ge = {
|
|
625
|
+
α: "alpha",
|
|
626
|
+
β: "beta",
|
|
627
|
+
γ: "gamma",
|
|
628
|
+
δ: "delta",
|
|
629
|
+
ε: "epsilon",
|
|
630
|
+
θ: "theta",
|
|
631
|
+
λ: "lambda",
|
|
632
|
+
μ: "mu",
|
|
633
|
+
π: "pi",
|
|
634
|
+
ρ: "rho",
|
|
635
|
+
σ: "sigma",
|
|
636
|
+
τ: "tau",
|
|
637
|
+
φ: "phi",
|
|
638
|
+
ω: "omega",
|
|
639
|
+
Δ: "capital delta",
|
|
640
|
+
Σ: "capital sigma",
|
|
641
|
+
Ω: "capital omega",
|
|
642
|
+
"∞": "infinity",
|
|
643
|
+
sin: "sine",
|
|
644
|
+
cos: "cosine",
|
|
645
|
+
tan: "tangent",
|
|
646
|
+
sec: "secant",
|
|
647
|
+
csc: "cosecant",
|
|
648
|
+
cot: "cotangent",
|
|
649
|
+
ln: "natural log",
|
|
650
|
+
lim: "limit"
|
|
651
|
+
}, Ke = {
|
|
652
|
+
"¯": "bar",
|
|
653
|
+
"‾": "bar",
|
|
654
|
+
"―": "bar",
|
|
655
|
+
"^": "hat",
|
|
656
|
+
ˆ: "hat",
|
|
657
|
+
"~": "tilde",
|
|
658
|
+
"˜": "tilde",
|
|
659
|
+
"→": "vector",
|
|
660
|
+
"⃗": "vector",
|
|
661
|
+
"˙": "dot"
|
|
662
|
+
}, W = (e) => (e.textContent ?? "").replace(Re, "").replace(/\s+/g, " ").trim(), G = (e) => e.replace(/\s+/g, " ").trim(), K = (e) => [...e.children];
|
|
663
|
+
function q(e) {
|
|
664
|
+
return !e || [
|
|
665
|
+
"mn",
|
|
666
|
+
"mi",
|
|
667
|
+
"mtext",
|
|
668
|
+
"mo"
|
|
669
|
+
].includes(e.localName) ? !0 : ["mrow", "mstyle"].includes(e.localName) && e.children.length === 1 ? q(e.children[0]) : !1;
|
|
670
|
+
}
|
|
671
|
+
function qe(e) {
|
|
672
|
+
let t = e ? W(e) : "";
|
|
673
|
+
return /^\d{1,3}$/.test(t) ? Number(t) : void 0;
|
|
674
|
+
}
|
|
675
|
+
function Je(e) {
|
|
676
|
+
return `${e}${e % 100 >= 11 && e % 100 <= 13 ? "th" : {
|
|
677
|
+
1: "st",
|
|
678
|
+
2: "nd",
|
|
679
|
+
3: "rd"
|
|
680
|
+
}[e % 10] ?? "th"}`;
|
|
681
|
+
}
|
|
682
|
+
function Ye(e) {
|
|
683
|
+
return Ge[e] ?? e;
|
|
684
|
+
}
|
|
685
|
+
function J(e) {
|
|
686
|
+
return He[e] ?? e;
|
|
687
|
+
}
|
|
688
|
+
function Y(e) {
|
|
689
|
+
let t = [], n = !1;
|
|
690
|
+
for (let r of e) {
|
|
691
|
+
if (r.localName !== "mo") {
|
|
692
|
+
t.push(X(r)), n = !0;
|
|
693
|
+
continue;
|
|
694
|
+
}
|
|
695
|
+
let e = W(r);
|
|
696
|
+
e && (!n && ze[e] ? t.push(ze[e]) : e in U ? t.push(U[e]) : (t.push(J(e)), n = e in Ve || Ue.has(e) && n));
|
|
697
|
+
}
|
|
698
|
+
return t.filter(Boolean).join(" ");
|
|
699
|
+
}
|
|
700
|
+
function Xe(e) {
|
|
701
|
+
let [t, ...n] = e, r = n[n.length - 1], i = (e) => e?.localName === "mo" && ["|", "‖"].includes(W(e)), a = n.slice(0, -1);
|
|
702
|
+
if (a.length && i(t) && i(r) && W(t) === W(r) && !a.some(i)) {
|
|
703
|
+
let e = G(Y(a));
|
|
704
|
+
return W(t) === "|" ? `absolute value of ${e} end absolute value` : `norm of ${e} end norm`;
|
|
705
|
+
}
|
|
706
|
+
return Y(e);
|
|
707
|
+
}
|
|
708
|
+
function Ze(e, t) {
|
|
709
|
+
let n = e ? X(e) : "", r = t ? X(t) : "";
|
|
710
|
+
return q(e) && q(t) ? `${n} over ${r}` : `the fraction with numerator ${n} and denominator ${r}`;
|
|
711
|
+
}
|
|
712
|
+
function Qe(e, t, n) {
|
|
713
|
+
return n ? `${t} of ${e}` : `${t} of ${e} end root`;
|
|
714
|
+
}
|
|
715
|
+
function $e(e, t) {
|
|
716
|
+
let n = t ? W(t) : "";
|
|
717
|
+
if (t && q(t)) {
|
|
718
|
+
if (n === "2") return `${e} squared`;
|
|
719
|
+
if (n === "3") return `${e} cubed`;
|
|
720
|
+
if (n in U) return `${e} ${U[n]}`;
|
|
721
|
+
}
|
|
722
|
+
let r = t ? X(t) : "";
|
|
723
|
+
return q(t) ? `${e} to the power of ${r}` : `${e} to the power of ${r} end power`;
|
|
724
|
+
}
|
|
725
|
+
function et(e, t) {
|
|
726
|
+
let n = t ? X(t) : "";
|
|
727
|
+
return q(t) ? `${e} sub ${n}` : `${e} sub ${n} end sub`;
|
|
728
|
+
}
|
|
729
|
+
function tt(e, t, n) {
|
|
730
|
+
let r = W(e);
|
|
731
|
+
if (r === "lim") return `limit as ${t ? X(t) : ""} of`;
|
|
732
|
+
if (!We.has(r)) return;
|
|
733
|
+
let i = t ? `from ${X(t)}` : "", a = n ? `to ${X(n)}` : "";
|
|
734
|
+
return `${J(r)} ${i} ${a} of`;
|
|
735
|
+
}
|
|
736
|
+
function nt(e) {
|
|
737
|
+
let t = K(e).filter((e) => ["mtr", "mlabeledtr"].includes(e.localName)), n = t.map((e) => K(e).filter((e) => e.localName === "mtd")), r = Math.max(0, ...n.map((e) => e.length)), i = n.map((e, t) => `row ${t + 1}: ${e.map((e) => G(Y(K(e)))).join(", ")}`);
|
|
738
|
+
return `table with ${t.length} ${t.length === 1 ? "row" : "rows"} and ${r} ${r === 1 ? "column" : "columns"}. ${i.join(". ")}`;
|
|
739
|
+
}
|
|
740
|
+
function rt(e) {
|
|
741
|
+
let t = e.getAttribute("open") ?? "(", n = e.getAttribute("close") ?? ")", r = (e.getAttribute("separators") ?? ",").replace(/\s+/g, "").split(""), i = K(e).map((e, t, n) => t < n.length - 1 ? `${X(e)} ${J(r[Math.min(t, r.length - 1)] ?? ",")}` : X(e));
|
|
742
|
+
return [
|
|
743
|
+
J(t),
|
|
744
|
+
...i,
|
|
745
|
+
J(n)
|
|
746
|
+
].filter(Boolean).join(" ");
|
|
747
|
+
}
|
|
748
|
+
function X(e) {
|
|
749
|
+
let t = K(e);
|
|
750
|
+
switch (e.localName) {
|
|
751
|
+
case "mi": return Ye(W(e));
|
|
752
|
+
case "mn":
|
|
753
|
+
case "mtext":
|
|
754
|
+
case "ms": return W(e);
|
|
755
|
+
case "mo": return J(W(e));
|
|
756
|
+
case "mspace":
|
|
757
|
+
case "mphantom":
|
|
758
|
+
case "annotation":
|
|
759
|
+
case "annotation-xml": return "";
|
|
760
|
+
case "semantics": return t[0] ? X(t[0]) : "";
|
|
761
|
+
case "mfrac": return Ze(t[0], t[1]);
|
|
762
|
+
case "msqrt": return Qe(G(Y(t)), "square root", t.length === 1 && q(t[0]));
|
|
763
|
+
case "mroot": {
|
|
764
|
+
let e = qe(t[1]), n = e === 2 ? "square root" : e === 3 ? "cube root" : e ? `${Je(e)} root` : `root with index ${t[1] ? X(t[1]) : ""}`;
|
|
765
|
+
return Qe(t[0] ? X(t[0]) : "", n, q(t[0]));
|
|
766
|
+
}
|
|
767
|
+
case "msup": return $e(t[0] ? X(t[0]) : "", t[1]);
|
|
768
|
+
case "msub": return et(t[0] ? X(t[0]) : "", t[1]);
|
|
769
|
+
case "msubsup": return (t[0] ? tt(t[0], t[1], t[2]) : void 0) || $e(et(t[0] ? X(t[0]) : "", t[1]), t[2]);
|
|
770
|
+
case "munder":
|
|
771
|
+
case "mover":
|
|
772
|
+
case "munderover": {
|
|
773
|
+
let [n, r, i] = t, a = e.localName === "mover" ? void 0 : r, o = e.localName === "munder" ? void 0 : e.localName === "mover" ? r : i, s = n ? tt(n, a, o) : void 0;
|
|
774
|
+
if (s) return s;
|
|
775
|
+
let c = n ? X(n) : "", l = e.localName === "mover" && r ? Ke[W(r)] : void 0;
|
|
776
|
+
return l ? l === "vector" ? `vector ${c}` : `${c} ${l}` : [
|
|
777
|
+
c,
|
|
778
|
+
a ? `with ${X(a)} below` : "",
|
|
779
|
+
o ? `with ${X(o)} above` : ""
|
|
780
|
+
].filter(Boolean).join(" ");
|
|
781
|
+
}
|
|
782
|
+
case "mfenced": return rt(e);
|
|
783
|
+
case "mtable": return nt(e);
|
|
784
|
+
case "mrow":
|
|
785
|
+
case "math": return Xe(t);
|
|
786
|
+
default: return t.length ? Y(t) : W(e);
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
function it(e) {
|
|
790
|
+
return G(X(e));
|
|
791
|
+
}
|
|
792
|
+
var at = [
|
|
793
|
+
"a[href]",
|
|
794
|
+
"button",
|
|
795
|
+
"label",
|
|
796
|
+
"summary",
|
|
797
|
+
...[
|
|
798
|
+
"button",
|
|
799
|
+
"checkbox",
|
|
800
|
+
"combobox",
|
|
801
|
+
"link",
|
|
802
|
+
"menuitem",
|
|
803
|
+
"menuitemcheckbox",
|
|
804
|
+
"menuitemradio",
|
|
805
|
+
"option",
|
|
806
|
+
"radio",
|
|
807
|
+
"switch",
|
|
808
|
+
"tab",
|
|
809
|
+
"treeitem"
|
|
810
|
+
].map((e) => `[role="${e}"]`)
|
|
811
|
+
].join(", ");
|
|
812
|
+
function ot(e) {
|
|
813
|
+
if (e.hasAttribute("aria-label") || !e.closest(at)) return;
|
|
814
|
+
let t = e.querySelector("math"), n = t ? it(t) : "";
|
|
815
|
+
n && e.setAttribute("aria-label", n);
|
|
816
|
+
}
|
|
817
|
+
function st(e) {
|
|
818
|
+
for (let t of e.querySelectorAll("mjx-container")) ot(t);
|
|
819
|
+
}
|
|
820
|
+
var ct = Symbol.for("@pie-element/shared-math-rendering-mathjax/speech-worker-failed");
|
|
821
|
+
function lt() {
|
|
822
|
+
let e = globalThis;
|
|
823
|
+
e[ct] || (e[ct] = !0, console.warn(`[math-rendering] MathJax's speech worker did not start, so speech, braille and the explorer are off. A content security policy must allow blob: workers, and scripts and fetches from the asset root. See ${t}`));
|
|
824
|
+
}
|
|
825
|
+
function ut(e) {
|
|
826
|
+
let t = e.webworker;
|
|
827
|
+
if (!t || t.ready) return;
|
|
828
|
+
e.options ??= {};
|
|
829
|
+
let n = e.options;
|
|
830
|
+
n.enableSpeech = !1, n.enableBraille = !1, n.speechError = () => {}, t.Post = () => Promise.reject(/* @__PURE__ */ Error("The speech worker did not start")), t.Terminate(), lt();
|
|
831
|
+
}
|
|
832
|
+
function dt(e) {
|
|
833
|
+
let t = e?.adaptor, n = t?.createWorker;
|
|
834
|
+
!e || !t || !n || (t.createWorker = async (r, i) => {
|
|
835
|
+
let a = await n.call(t, r, i);
|
|
836
|
+
return a.addEventListener("error", () => ut(e), { once: !0 }), a;
|
|
837
|
+
});
|
|
838
|
+
}
|
|
839
|
+
`${i}`;
|
|
840
|
+
var ft = {
|
|
841
|
+
parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
|
|
842
|
+
overarc: "\\overparen",
|
|
843
|
+
napprox: "\\not\\approx",
|
|
844
|
+
longdiv: "\\enclose{longdiv}",
|
|
845
|
+
abs: ["\\left|#1\\right|", 1]
|
|
846
|
+
}, pt = "[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)", mt = /\\\(|\\\[|\$\$|\\\$|\\begin\{|\\(?:eq)?ref\{/, ht = /\\\(|\\\[|\$|\\begin\{|\\(?:eq)?ref\{/, gt = /\\embed\{newLine\}\[\]/g, _t = [
|
|
847
|
+
["$$", "$$"],
|
|
848
|
+
["$", "$"],
|
|
849
|
+
["\\[", "\\]"],
|
|
850
|
+
["\\(", "\\)"]
|
|
851
|
+
], vt = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading"), yt = "MJX-CHTML-styles", bt = "PIE-MJX-SVG-styles", Z = "PIE-MathJax-Menu-Settings", xt = { "mjx-container[overflow=\"linebreak\"][display]": {
|
|
852
|
+
overflow: "auto clip",
|
|
853
|
+
"min-width": "initial !important"
|
|
854
|
+
} }, St = 200, Ct = 201, wt = 202;
|
|
855
|
+
function Q(e) {
|
|
856
|
+
let t = [...e.matches("mjx-container") ? [e] : [], ...e.querySelectorAll("mjx-container")];
|
|
857
|
+
for (let e of t) for (let t of [e, ...e.querySelectorAll("[data-latex],[data-latex-item]")]) t.removeAttribute("data-latex"), t.removeAttribute("data-latex-item");
|
|
858
|
+
}
|
|
859
|
+
function Tt(e) {
|
|
860
|
+
for (let [t, n] of _t) if (e.startsWith(t) && e.endsWith(n)) return e.substring(t.length, e.length - n.length);
|
|
861
|
+
return e;
|
|
862
|
+
}
|
|
863
|
+
function Et(e) {
|
|
864
|
+
return Tt(e.includes("\\displaystyle") ? e.replace("\\displaystyle", "").trim() : e);
|
|
865
|
+
}
|
|
866
|
+
var Dt = "mathjax_ignore", Ot = "mathjax_process";
|
|
867
|
+
function kt(e, t) {
|
|
868
|
+
let n = e.closest(`.${Dt}, .${Ot}`);
|
|
869
|
+
return n !== null && t.contains(n) && !n.classList.contains(Ot);
|
|
870
|
+
}
|
|
871
|
+
function At(e) {
|
|
872
|
+
for (let t of e.querySelectorAll("[data-latex]")) {
|
|
873
|
+
if (t.dataset.mathHandled || t.closest("mjx-container") || kt(t, e)) continue;
|
|
874
|
+
let n = t.textContent;
|
|
875
|
+
n && (t.textContent = `\\(${Et(n)}\\)`.replace(gt, "\\newline "), t.dataset.mathHandled = "true");
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
function jt(e) {
|
|
879
|
+
for (let t of e.querySelectorAll("math")) t.closest("mjx-container") || t.setAttribute("displaystyle", "true");
|
|
880
|
+
}
|
|
881
|
+
function Mt(e, t) {
|
|
882
|
+
for (let t of e.querySelectorAll("math")) if (!t.closest("mjx-assistive-mml")) return !0;
|
|
883
|
+
return (t ? ht : mt).test(e.textContent ?? "");
|
|
884
|
+
}
|
|
885
|
+
function Nt(e) {
|
|
886
|
+
return new Promise((t, n) => {
|
|
887
|
+
let { useSingleDollar: r = !1, accessibility: i = !0, loadFonts: a = !0, srcUrl: o } = e, s = d(e, import.meta.url), c = {
|
|
888
|
+
loader: {
|
|
889
|
+
load: i ? ["a11y/assistive-mml"] : [],
|
|
890
|
+
failed: (e) => n(e),
|
|
891
|
+
"output/svg": { ready: (e) => {
|
|
892
|
+
let t = b();
|
|
893
|
+
return $(t) && Pt(t), e;
|
|
894
|
+
} }
|
|
895
|
+
},
|
|
896
|
+
startup: {
|
|
897
|
+
typeset: !1,
|
|
898
|
+
ready: () => {
|
|
899
|
+
let e = b(), r = e?.startup, i = $(e);
|
|
900
|
+
i && (Pt(e), Ft(e, s.speechLocales), f(e?._?.a11y?.sre_ts?.locales, s.speechLocales)), r?.defaultReady?.(), i && (It(r?.document), Lt(r?.document), r?.document?.addStyles?.(xt), dt(r?.document)), Promise.resolve(r?.promise).then(() => t(), n);
|
|
901
|
+
}
|
|
902
|
+
},
|
|
903
|
+
tex: { macros: { ...ft } },
|
|
904
|
+
output: { displayOverflow: "linebreak" },
|
|
905
|
+
options: {
|
|
906
|
+
enableMenu: i,
|
|
907
|
+
menuOptions: { settings: {
|
|
908
|
+
assistiveMml: i,
|
|
909
|
+
enrich: !1,
|
|
910
|
+
inTabOrder: !1
|
|
911
|
+
} },
|
|
912
|
+
a11y: { inTabOrder: !1 }
|
|
913
|
+
}
|
|
914
|
+
};
|
|
915
|
+
r && c.tex && (console.warn(pt), c.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], c.tex.processEscapes = !0), a || (c.chtml = { fontURL: "" });
|
|
916
|
+
let l = p(s.speechLocales);
|
|
917
|
+
l && c.options && (c.options.sre = { locale: l }), re(c, {
|
|
918
|
+
...s,
|
|
919
|
+
srcUrl: o
|
|
920
|
+
}).then((e) => {
|
|
921
|
+
e || t();
|
|
922
|
+
}, n);
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
function $(e) {
|
|
926
|
+
return !!e?.version?.startsWith("4.");
|
|
927
|
+
}
|
|
928
|
+
function Pt(e) {
|
|
929
|
+
let t = e?._?.output, n = t?.chtml_ts?.CHTML;
|
|
930
|
+
n && (n.STYLESHEETID = x);
|
|
931
|
+
let r = t?.svg_ts?.SVG;
|
|
932
|
+
r && (r.STYLESHEETID = bt);
|
|
933
|
+
}
|
|
934
|
+
function Ft(e, t) {
|
|
935
|
+
let n = e?._?.ui?.menu?.Menu?.Menu;
|
|
936
|
+
if (n) {
|
|
937
|
+
n.MENU_STORAGE = Z;
|
|
938
|
+
try {
|
|
939
|
+
let e = localStorage.getItem(Z);
|
|
940
|
+
if (!e) return;
|
|
941
|
+
let { assistiveMml: n, locale: r, ...i } = JSON.parse(e), a = r === void 0 || !t || t.has(r);
|
|
942
|
+
if (n === void 0 && a) return;
|
|
943
|
+
a && r !== void 0 && (i.locale = r), Object.keys(i).length ? localStorage.setItem(Z, JSON.stringify(i)) : localStorage.removeItem(Z);
|
|
944
|
+
} catch {}
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
function It(e) {
|
|
948
|
+
if (!e) return;
|
|
949
|
+
let t = /* @__PURE__ */ new WeakSet(), n = (e) => {
|
|
950
|
+
let n = e.typesetRoot;
|
|
951
|
+
!n || t.has(n) || (Q(n), t.add(n));
|
|
952
|
+
};
|
|
953
|
+
e.addRenderAction?.("pie-strip-latex", Ct, (e) => {
|
|
954
|
+
for (let t of e.math ?? []) n(t);
|
|
955
|
+
return !1;
|
|
956
|
+
}, (e) => {
|
|
957
|
+
let t = e.typesetRoot;
|
|
958
|
+
return t && Q(t), !1;
|
|
959
|
+
});
|
|
960
|
+
let r = e.outputJax?.chtmlStyles;
|
|
961
|
+
r?.id === yt && (r.id = x), Bt();
|
|
962
|
+
}
|
|
963
|
+
function Lt(e) {
|
|
964
|
+
let t = (e) => {
|
|
965
|
+
e.typesetRoot && ot(e.typesetRoot);
|
|
966
|
+
};
|
|
967
|
+
e?.addRenderAction?.("pie-name-math", wt, (e) => {
|
|
968
|
+
for (let n of e.math ?? []) t(n);
|
|
969
|
+
return !1;
|
|
970
|
+
}, (e) => (t(e), !1));
|
|
971
|
+
}
|
|
972
|
+
function Rt(e) {
|
|
973
|
+
return e instanceof HTMLStyleElement && ae.includes(e.id);
|
|
974
|
+
}
|
|
975
|
+
function zt(e) {
|
|
976
|
+
ee("foreign-output-stylesheet", `another MathJax added <style id="${e.id}"> to <head>`);
|
|
977
|
+
}
|
|
978
|
+
function Bt() {
|
|
979
|
+
let e = document.head, t = [...e.children].find(Rt);
|
|
980
|
+
if (t) {
|
|
981
|
+
zt(t);
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
984
|
+
let n = new MutationObserver((e) => {
|
|
985
|
+
for (let t of e) {
|
|
986
|
+
let e = [...t.addedNodes].find(Rt);
|
|
987
|
+
if (e) {
|
|
988
|
+
zt(e), n.disconnect();
|
|
989
|
+
return;
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
});
|
|
993
|
+
n.observe(e, { childList: !0 });
|
|
994
|
+
}
|
|
995
|
+
function Vt(e) {
|
|
996
|
+
let t = e?.math;
|
|
997
|
+
if (!t?.remove) return;
|
|
998
|
+
let n = [...t].filter((e) => (e.state?.() ?? 0) >= St && e.typesetRoot?.isConnected === !1);
|
|
999
|
+
if (n.length !== 0) {
|
|
1000
|
+
for (let e of [...n].reverse()) e.clear?.();
|
|
1001
|
+
t.remove(...n);
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
function Ht(e) {
|
|
1005
|
+
return new Promise((t, n) => {
|
|
1006
|
+
let r = e.startup ?? {};
|
|
1007
|
+
e.startup = r;
|
|
1008
|
+
let i = r.ready;
|
|
1009
|
+
r.ready = () => {
|
|
1010
|
+
let e = b()?.startup;
|
|
1011
|
+
i ? i.call(r) : e?.defaultReady?.(), Promise.resolve(e?.promise).then(() => t(), n);
|
|
1012
|
+
};
|
|
1013
|
+
});
|
|
1014
|
+
}
|
|
1015
|
+
function Ut(e) {
|
|
1016
|
+
let t = b();
|
|
1017
|
+
return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : Ht(t) : Nt(e);
|
|
1018
|
+
}
|
|
1019
|
+
function Wt(e) {
|
|
1020
|
+
return Ut(e).then(() => {
|
|
1021
|
+
let e = b();
|
|
1022
|
+
e && typeof e.typesetPromise != "function" && console.warn("[mathjax-renderer] MathJax on this page has no typesetPromise; math stays untypeset.");
|
|
1023
|
+
});
|
|
1024
|
+
}
|
|
1025
|
+
function Gt(e) {
|
|
1026
|
+
let t = ie, n = t[vt];
|
|
1027
|
+
return n || (n = Wt(e), t[vt] = n), n;
|
|
1028
|
+
}
|
|
1029
|
+
function Kt(e = {}) {
|
|
1030
|
+
let t = e.useSingleDollar ?? !1;
|
|
1031
|
+
return async (n) => {
|
|
1032
|
+
if (typeof window > "u") return;
|
|
1033
|
+
let r = oe();
|
|
1034
|
+
r && ee("mathjax-3-global", `window.MathJax is MathJax ${r}`), At(n), ue(n), jt(n), Me(n);
|
|
1035
|
+
let i = Gt(e);
|
|
1036
|
+
if (!Mt(n, t)) {
|
|
1037
|
+
i.catch(() => {});
|
|
1038
|
+
return;
|
|
1039
|
+
}
|
|
1040
|
+
await i;
|
|
1041
|
+
let a = b();
|
|
1042
|
+
if (await a?.startup?.promise, typeof a?.typesetPromise == "function") {
|
|
1043
|
+
Le(), Vt(a.startup?.document);
|
|
1044
|
+
try {
|
|
1045
|
+
await a.typesetPromise([n]);
|
|
1046
|
+
} catch (e) {
|
|
1047
|
+
throw a.typesetClear?.([n]), e;
|
|
1048
|
+
}
|
|
1049
|
+
Q(n), st(n);
|
|
1050
|
+
}
|
|
1051
|
+
};
|
|
1052
|
+
}
|
|
1053
|
+
//#endregion
|
|
1054
|
+
export { Kt as t };
|