@pie-element/element-player 0.1.3-next.20261002222413 → 0.1.3-next.20261003064518
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/README.md +1 -1
- package/dist/math-mathjax-BAEg0YgQ.js +598 -0
- package/dist/pie-element-player.js +1 -1
- package/package.json +2 -2
- package/dist/math-mathjax-E8NYPSwi.js +0 -219
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ Use the player as a **Node package dependency** in modern applications.
|
|
|
17
17
|
|
|
18
18
|
Positioning note:
|
|
19
19
|
|
|
20
|
-
- In normal production integrations, use the standard production player stacks from the
|
|
20
|
+
- In normal production integrations, use the standard production player stacks from the `pie-elements` and `pie-players` projects.
|
|
21
21
|
- Treat `@pie-element/element-player` as a flexible element-level host for development, testing, and composable/advanced embedding scenarios.
|
|
22
22
|
|
|
23
23
|
Why this is preferred:
|
|
@@ -0,0 +1,598 @@
|
|
|
1
|
+
//#region ../shared/math-rendering-mathjax/dist/index.js
|
|
2
|
+
var e = "http://www.w3.org/1998/Math/MathML", t = /^([a-z_][\w.-]*):math$/, n = /^[a-z][a-z0-9-]*$/;
|
|
3
|
+
function r(e) {
|
|
4
|
+
for (let n of e.querySelectorAll("*")) {
|
|
5
|
+
let r = t.exec(n.tagName.toLowerCase())?.[1];
|
|
6
|
+
!r || !e.contains(n) || n.closest("mjx-container") || n.replaceWith(i(n, `${r}:`));
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
function i(t, r) {
|
|
10
|
+
let a = t.tagName.toLowerCase().slice(r.length);
|
|
11
|
+
if (!n.test(a)) return t;
|
|
12
|
+
let o = t.ownerDocument.createElementNS(e, a);
|
|
13
|
+
for (let e of t.attributes) o.setAttribute(e.name, e.value);
|
|
14
|
+
for (let e of [...t.childNodes]) {
|
|
15
|
+
let t = e instanceof Element && e.tagName.toLowerCase().startsWith(r);
|
|
16
|
+
o.appendChild(t ? i(e, r) : e);
|
|
17
|
+
}
|
|
18
|
+
return o;
|
|
19
|
+
}
|
|
20
|
+
var a = /* @__PURE__ */ new Set([
|
|
21
|
+
"updiagonalstrike",
|
|
22
|
+
"downdiagonalstrike",
|
|
23
|
+
"verticalstrike",
|
|
24
|
+
"horizontalstrike"
|
|
25
|
+
]), o = {
|
|
26
|
+
thin: "0.035em",
|
|
27
|
+
medium: "0.07em",
|
|
28
|
+
thick: "0.14em"
|
|
29
|
+
}, s = {
|
|
30
|
+
tight: "0em",
|
|
31
|
+
medium: "0.1em",
|
|
32
|
+
loose: "0.2em"
|
|
33
|
+
}, c = /^(\d+(\.\d*)?|\.\d+)(em|ex|px|pt|pc|in|cm|mm)$/, l = /^(#[0-9a-f]{3,8}|[a-z]+)$/i, u = /^(\d+(\.\d*)?|\.\d+)$/, d = /* @__PURE__ */ new Set([
|
|
34
|
+
"mn",
|
|
35
|
+
"mo",
|
|
36
|
+
"mi",
|
|
37
|
+
"mtext"
|
|
38
|
+
]), f = /* @__PURE__ */ new Set([
|
|
39
|
+
"stackalign",
|
|
40
|
+
"charalign",
|
|
41
|
+
"charspacing",
|
|
42
|
+
"longdivstyle"
|
|
43
|
+
]);
|
|
44
|
+
function p(t, n, r = [], i = {}) {
|
|
45
|
+
let a = t.createElementNS(e, n);
|
|
46
|
+
for (let [e, t] of Object.entries(i)) a.setAttribute(e, t);
|
|
47
|
+
for (let e of r) e && a.appendChild(e);
|
|
48
|
+
return a;
|
|
49
|
+
}
|
|
50
|
+
function m(e, t) {
|
|
51
|
+
let n = p(e.document, "mo");
|
|
52
|
+
return n.textContent = t, n;
|
|
53
|
+
}
|
|
54
|
+
function h(e) {
|
|
55
|
+
let t = p(e.document, "mn");
|
|
56
|
+
return t.textContent = "0", p(e.document, "mphantom", [t]);
|
|
57
|
+
}
|
|
58
|
+
function g(e, t) {
|
|
59
|
+
return e.getAttribute(t)?.trim().toLowerCase() || void 0;
|
|
60
|
+
}
|
|
61
|
+
function _(e, t) {
|
|
62
|
+
let n = Number.parseInt(e.getAttribute(t) ?? "", 10);
|
|
63
|
+
return Number.isFinite(n) ? n : 0;
|
|
64
|
+
}
|
|
65
|
+
function v(e) {
|
|
66
|
+
return e.localName === "none" || e.localName === "mrow" && e.children.length === 0 && !e.textContent?.trim();
|
|
67
|
+
}
|
|
68
|
+
function y(e, t, n = e) {
|
|
69
|
+
switch (t) {
|
|
70
|
+
case "left": return 0;
|
|
71
|
+
case "center": return Math.floor(e / 2);
|
|
72
|
+
case "right": return e;
|
|
73
|
+
default: return n;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function b(e, t, n) {
|
|
77
|
+
let r = [], i, a, o = (e, t) => {
|
|
78
|
+
let s = (e) => t.reduceRight((e, t) => {
|
|
79
|
+
let n = t.cloneNode(!1);
|
|
80
|
+
return n.appendChild(e), n;
|
|
81
|
+
}, e);
|
|
82
|
+
if (e.localName === "mstyle") for (let n of [...e.children]) o(n, [...t, e]);
|
|
83
|
+
else if (v(e)) r.push(null);
|
|
84
|
+
else if (e.localName === "mn" && e.children.length === 0) {
|
|
85
|
+
let t = [...(e.textContent ?? "").trim()];
|
|
86
|
+
for (let a of t) {
|
|
87
|
+
a === n.decimalPoint && (i ??= r.length);
|
|
88
|
+
let t = e.cloneNode(!1);
|
|
89
|
+
t.textContent = a, r.push(s(t));
|
|
90
|
+
}
|
|
91
|
+
t.length && (a ??= r.length);
|
|
92
|
+
} else d.has(e.localName) && e.textContent?.trim() === n.decimalPoint && (i ??= r.length), r.push(s(e));
|
|
93
|
+
};
|
|
94
|
+
for (let t of e) o(t, []);
|
|
95
|
+
return {
|
|
96
|
+
kind: "digits",
|
|
97
|
+
cells: r,
|
|
98
|
+
anchor: y(r.length, n.stackAlign, i ?? a),
|
|
99
|
+
position: t
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function x(e) {
|
|
103
|
+
return (e ?? "").toLowerCase().split(/\s+/).filter((e) => a.has(e));
|
|
104
|
+
}
|
|
105
|
+
function S(e, t) {
|
|
106
|
+
let n = [...e.children].filter((e) => !v(e));
|
|
107
|
+
return n.length <= 1 ? n[0] ?? null : p(t.document, "mrow", n);
|
|
108
|
+
}
|
|
109
|
+
function ee(e, t, n) {
|
|
110
|
+
let r = g(e, "location") ?? "n", i = x(e.getAttribute("crossout")), a = [...e.children].map((e) => v(e) ? null : e.localName === "mscarry" ? {
|
|
111
|
+
content: S(e, n),
|
|
112
|
+
location: g(e, "location") ?? r,
|
|
113
|
+
crossout: e.hasAttribute("crossout") ? x(e.getAttribute("crossout")) : i
|
|
114
|
+
} : {
|
|
115
|
+
content: e,
|
|
116
|
+
location: r,
|
|
117
|
+
crossout: i
|
|
118
|
+
}), o = e.getAttribute("scriptsizemultiplier")?.trim() ?? "";
|
|
119
|
+
return {
|
|
120
|
+
kind: "carries",
|
|
121
|
+
carries: a,
|
|
122
|
+
anchor: y(a.length, n.stackAlign),
|
|
123
|
+
position: t,
|
|
124
|
+
scale: u.test(o) ? o : "0.6"
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function C(e) {
|
|
128
|
+
let t = g(e, "mslinethickness") ?? "medium", n = o[t] ?? (c.test(t) ? t : "0.07em"), r = e.getAttribute("mathcolor")?.trim() ?? "";
|
|
129
|
+
return `${n} solid ${l.test(r) ? r : "currentColor"}`;
|
|
130
|
+
}
|
|
131
|
+
function te(e, t, n) {
|
|
132
|
+
let r = Math.max(0, _(e, "length"));
|
|
133
|
+
return {
|
|
134
|
+
kind: "line",
|
|
135
|
+
length: r,
|
|
136
|
+
anchor: y(r, n.stackAlign),
|
|
137
|
+
position: t,
|
|
138
|
+
border: C(e)
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function w(e, t, n, r, i) {
|
|
142
|
+
e.forEach((e, a) => {
|
|
143
|
+
let o = t + a * n + _(e, "position");
|
|
144
|
+
switch (e.localName) {
|
|
145
|
+
case "msgroup":
|
|
146
|
+
w([...e.children], o, _(e, "shift"), r, i);
|
|
147
|
+
break;
|
|
148
|
+
case "msline":
|
|
149
|
+
i.push(te(e, o, r));
|
|
150
|
+
break;
|
|
151
|
+
case "mscarries":
|
|
152
|
+
i.push(ee(e, o, r));
|
|
153
|
+
break;
|
|
154
|
+
case "msrow":
|
|
155
|
+
case "mrow":
|
|
156
|
+
i.push(b([...e.children], o, r));
|
|
157
|
+
break;
|
|
158
|
+
default: i.push(b([e], o, r));
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
function T(e) {
|
|
163
|
+
return -e.anchor - e.position;
|
|
164
|
+
}
|
|
165
|
+
function E(e) {
|
|
166
|
+
return e.kind === "digits" ? e.cells.length : e.kind === "carries" ? e.carries.length : e.length;
|
|
167
|
+
}
|
|
168
|
+
function D(e) {
|
|
169
|
+
return T(e) + E(e) - 1;
|
|
170
|
+
}
|
|
171
|
+
function ne(e, t, n, r) {
|
|
172
|
+
let i = (e) => p(r.document, "mpadded", [t], {
|
|
173
|
+
width: "0",
|
|
174
|
+
...e ? { lspace: e } : {}
|
|
175
|
+
}), a = (e, t) => p(r.document, e, t);
|
|
176
|
+
switch (n) {
|
|
177
|
+
case "s": return a("munder", [e, i("-0.5width")]);
|
|
178
|
+
case "ne": return a("msup", [e, i()]);
|
|
179
|
+
case "se": return a("msub", [e, i()]);
|
|
180
|
+
case "nw": return a("mmultiscripts", [
|
|
181
|
+
e,
|
|
182
|
+
a("mprescripts", []),
|
|
183
|
+
a("none", []),
|
|
184
|
+
i("-1width")
|
|
185
|
+
]);
|
|
186
|
+
case "sw": return a("mmultiscripts", [
|
|
187
|
+
e,
|
|
188
|
+
a("mprescripts", []),
|
|
189
|
+
i("-1width"),
|
|
190
|
+
a("none", [])
|
|
191
|
+
]);
|
|
192
|
+
case "w": return t.setAttribute("scriptlevel", "+1"), a("mrow", [i("-1width"), e]);
|
|
193
|
+
case "e": return t.setAttribute("scriptlevel", "+1"), a("mrow", [e, i()]);
|
|
194
|
+
default: return a("mover", [e, i("-0.5width")]);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function re(e, t, n) {
|
|
198
|
+
let r = p(n.document, "menclose", [e], {
|
|
199
|
+
notation: t.join(" "),
|
|
200
|
+
"data-padding": "0.1em",
|
|
201
|
+
"data-thickness": "0.067em"
|
|
202
|
+
}), i = t.some((e) => e.endsWith("diagonalstrike")) ? .167 : t.includes("horizontalstrike") ? .1 : 0;
|
|
203
|
+
return i ? p(n.document, "mpadded", [r], {
|
|
204
|
+
lspace: `-${i}em`,
|
|
205
|
+
width: `-${2 * i}em`
|
|
206
|
+
}) : r;
|
|
207
|
+
}
|
|
208
|
+
function ie(e, t, n, r, i) {
|
|
209
|
+
let a = e && t.crossout.length ? re(e, t.crossout, i) : e;
|
|
210
|
+
if (!t.content) return a;
|
|
211
|
+
let o = p(i.document, "mstyle", [t.content], { scriptsizemultiplier: r });
|
|
212
|
+
return ne(a ?? h(i), o, n, i);
|
|
213
|
+
}
|
|
214
|
+
function O(e, t) {
|
|
215
|
+
return e.carries[t - T(e)] ?? null;
|
|
216
|
+
}
|
|
217
|
+
function ae(e, t, n, r) {
|
|
218
|
+
let i = e.content;
|
|
219
|
+
n.forEach((e, a) => {
|
|
220
|
+
let o = n.length - 1 - a, s = n[o], c = O(s, t), l = n.slice(0, o).some((e) => O(e, t));
|
|
221
|
+
if (!c && !l) return;
|
|
222
|
+
let u = c ?? {
|
|
223
|
+
content: h(r),
|
|
224
|
+
location: "n",
|
|
225
|
+
crossout: []
|
|
226
|
+
}, d = a === 0 ? u.location : "n";
|
|
227
|
+
i = ie(i, u, d, s.scale, r);
|
|
228
|
+
}), e.content = i;
|
|
229
|
+
}
|
|
230
|
+
function k(e, t) {
|
|
231
|
+
let n = e.filter((e) => E(e) > 0), r = Math.min(0, ...n.map(T)), i = Math.max(r, ...n.map(D)) - r + 1, a = -r, o = [], s = /* @__PURE__ */ new Map(), c = () => Array.from({ length: i }, () => ({
|
|
232
|
+
content: null,
|
|
233
|
+
borders: {}
|
|
234
|
+
})), l = (e) => e.length === 0 ? Array.from({ length: i }, (e, t) => t) : Array.from({ length: e.length }, (t, n) => a + T(e) + n), u = [], d = [], f = (e) => {
|
|
235
|
+
let n = c();
|
|
236
|
+
e.cells.forEach((t, r) => {
|
|
237
|
+
n[a + T(e) + r].content = t;
|
|
238
|
+
}), u.length && n.forEach((e, n) => {
|
|
239
|
+
ae(e, n - a, u, t);
|
|
240
|
+
});
|
|
241
|
+
for (let e of d) for (let t of l(e)) n[t].borders.top = e.border;
|
|
242
|
+
u = [], d = [], s.set(e, o.length), o.push(n);
|
|
243
|
+
};
|
|
244
|
+
for (let t of e) t.kind === "digits" ? f(t) : t.kind === "carries" ? u.push(t) : d.push(t);
|
|
245
|
+
(u.length || !o.length) && f({
|
|
246
|
+
kind: "digits",
|
|
247
|
+
cells: [],
|
|
248
|
+
anchor: 0,
|
|
249
|
+
position: 0
|
|
250
|
+
});
|
|
251
|
+
let p = o[o.length - 1];
|
|
252
|
+
for (let e of d) for (let t of l(e)) p[t].borders.bottom = e.border;
|
|
253
|
+
return {
|
|
254
|
+
rows: o,
|
|
255
|
+
rowOf: s,
|
|
256
|
+
origin: a
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
function A(e, { rows: t }, n) {
|
|
260
|
+
let r = p(n.document, "mtable", t.map((e) => p(n.document, "mtr", e.map((e) => {
|
|
261
|
+
let t = Object.entries(e.borders).map(([e, t]) => `border-${e}:${t}`).join(";");
|
|
262
|
+
return p(n.document, "mtd", [e.content], {
|
|
263
|
+
...t ? { style: t } : {},
|
|
264
|
+
...e.align ? { columnalign: e.align } : {}
|
|
265
|
+
});
|
|
266
|
+
}))));
|
|
267
|
+
for (let { name: t, value: n } of [...e.attributes]) f.has(t) || r.setAttribute(t, n);
|
|
268
|
+
let i = g(e, "charspacing") ?? "medium", a = g(e, "charalign");
|
|
269
|
+
return r.setAttribute("columnspacing", s[i] ?? (c.test(i) ? i : s.medium)), r.setAttribute("columnalign", a === "left" || a === "center" ? a : "right"), r.setAttribute("rowspacing", "0"), r.setAttribute("align", e.getAttribute("align") ?? "baseline"), r;
|
|
270
|
+
}
|
|
271
|
+
function j(e) {
|
|
272
|
+
return {
|
|
273
|
+
document: e.ownerDocument,
|
|
274
|
+
stackAlign: g(e, "stackalign") ?? "decimalpoint",
|
|
275
|
+
decimalPoint: e.closest("[decimalpoint]")?.getAttribute("decimalpoint")?.trim().charAt(0) || "."
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
function oe(e) {
|
|
279
|
+
let t = j(e), n = [];
|
|
280
|
+
return w([...e.children], 0, 0, t, n), A(e, k(n, t), t);
|
|
281
|
+
}
|
|
282
|
+
function M(e, t, n, r, i, a) {
|
|
283
|
+
for (let o = n; o <= r; o++) e[t][o].borders[i] = a;
|
|
284
|
+
}
|
|
285
|
+
function se(e, t) {
|
|
286
|
+
let n = m(t, ")");
|
|
287
|
+
return n.setAttribute("minsize", "1.2em"), [p(t.document, "mrow", [e, p(t.document, "mspace", [], { width: "0.2em" })]), p(t.document, "mpadded", [n], {
|
|
288
|
+
voffset: "0.1em",
|
|
289
|
+
lspace: "-0.15em",
|
|
290
|
+
depth: "-0.2em",
|
|
291
|
+
height: "-0.2em"
|
|
292
|
+
})];
|
|
293
|
+
}
|
|
294
|
+
function ce(e) {
|
|
295
|
+
let t = j(e), [n, r, ...i] = [...e.children], a = n && !v(n) ? n : null, o = r && !v(r) ? r : null, s = g(e, "longdivstyle") ?? "lefttop", c = C(e), l = [];
|
|
296
|
+
w(i, 0, 0, t, l);
|
|
297
|
+
let u = l.find((e) => e.kind === "digits");
|
|
298
|
+
u || (u = {
|
|
299
|
+
kind: "digits",
|
|
300
|
+
cells: [],
|
|
301
|
+
anchor: 0,
|
|
302
|
+
position: 0
|
|
303
|
+
}, l.unshift(u));
|
|
304
|
+
let d = [], f = (...e) => {
|
|
305
|
+
u.cells.unshift(...e), u.anchor += e.length;
|
|
306
|
+
}, p = (...e) => {
|
|
307
|
+
let n = e.flatMap((e) => e ? e.localName === "mrow" ? [...e.children] : [e] : []);
|
|
308
|
+
u.cells.push(...b(n, 0, t).cells);
|
|
309
|
+
};
|
|
310
|
+
switch (s) {
|
|
311
|
+
case "left/\\right":
|
|
312
|
+
f(a, m(t, "/")), p(m(t, "\\"), o);
|
|
313
|
+
break;
|
|
314
|
+
case "left)(right":
|
|
315
|
+
f(a, m(t, ")")), p(m(t, "("), o);
|
|
316
|
+
break;
|
|
317
|
+
case ":right=right":
|
|
318
|
+
p(m(t, ":"), a, m(t, "="), o);
|
|
319
|
+
break;
|
|
320
|
+
case "righttop":
|
|
321
|
+
case "stackedleftlinetop":
|
|
322
|
+
case "lefttop":
|
|
323
|
+
o && w([o], 0, 0, t, d), l.splice(l.indexOf(u), 0, ...d), s === "righttop" ? p(a) : s === "stackedleftlinetop" ? f(a) : f(...se(a, t));
|
|
324
|
+
break;
|
|
325
|
+
}
|
|
326
|
+
let h = k(l, t), _ = h.rows, y = h.rowOf.get(u) ?? 0, x = (e) => h.origin + T(u) + e, S = Math.max(x(u.cells.length - 1), ...d.map((e) => h.origin + D(e)));
|
|
327
|
+
switch (s) {
|
|
328
|
+
case "left/\\right":
|
|
329
|
+
case "left)(right":
|
|
330
|
+
case ":right=right": break;
|
|
331
|
+
case "righttop": {
|
|
332
|
+
let e = _[y][x(u.cells.length - 1)];
|
|
333
|
+
e.borders.left = c, e.borders.bottom = c, M(_, y, x(0), x(u.cells.length - 1), "top", c);
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
case "stackedleftlinetop": {
|
|
337
|
+
let e = _[y][x(0)];
|
|
338
|
+
e.borders.right = c, e.borders.bottom = c, M(_, y, x(1), S, "top", c);
|
|
339
|
+
break;
|
|
340
|
+
}
|
|
341
|
+
case "stackedrightright":
|
|
342
|
+
case "mediumstackedrightright":
|
|
343
|
+
case "shortstackedrightright":
|
|
344
|
+
case "stackedleftleft":
|
|
345
|
+
le(_, y, s, a, o, c, t);
|
|
346
|
+
break;
|
|
347
|
+
default: M(_, y, x(1), S, "top", c);
|
|
348
|
+
}
|
|
349
|
+
return A(e, h, t);
|
|
350
|
+
}
|
|
351
|
+
function le(e, t, n, r, i, a, o) {
|
|
352
|
+
let s = n === "stackedleftleft", c = s ? "right" : "left", l = (e) => e && p(o.document, "mpadded", [e], {
|
|
353
|
+
lspace: "0.2em",
|
|
354
|
+
width: "+0.4em"
|
|
355
|
+
});
|
|
356
|
+
e.length < t + 2 && e.push(e[0].map(() => ({
|
|
357
|
+
content: null,
|
|
358
|
+
borders: {}
|
|
359
|
+
}))), e.forEach((e, o) => {
|
|
360
|
+
let u = {
|
|
361
|
+
content: null,
|
|
362
|
+
borders: {},
|
|
363
|
+
align: s ? "right" : "left"
|
|
364
|
+
};
|
|
365
|
+
o === t ? (u.content = l(r), u.borders = {
|
|
366
|
+
[c]: a,
|
|
367
|
+
bottom: a
|
|
368
|
+
}) : 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);
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
function ue(e) {
|
|
372
|
+
for (let t of [...e.querySelectorAll("mstack, mlongdiv")]) !t.closest("math") || t.closest("mjx-container") || t.replaceWith(t.localName === "mstack" ? oe(t) : ce(t));
|
|
373
|
+
}
|
|
374
|
+
var N = "https://github.com/pie-framework/pie-players/blob/develop/docs/item-player/loading-strategies.md#one-mathjax-version-per-page", de = "pie-mathjax-version-conflict", P = Symbol.for("@pie-element/shared-math-rendering-mathjax/unsupported-page");
|
|
375
|
+
function F(e, t) {
|
|
376
|
+
if (typeof window > "u") return;
|
|
377
|
+
let n = globalThis;
|
|
378
|
+
n[P] ??= {
|
|
379
|
+
logged: !1,
|
|
380
|
+
conditions: []
|
|
381
|
+
};
|
|
382
|
+
let r = n[P];
|
|
383
|
+
if (r.conditions.includes(e)) return;
|
|
384
|
+
r.conditions.push(e);
|
|
385
|
+
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 ${N}`;
|
|
386
|
+
r.logged || (r.logged = !0, console.error(i)), window.dispatchEvent(new CustomEvent(de, { detail: {
|
|
387
|
+
condition: e,
|
|
388
|
+
message: i,
|
|
389
|
+
docsUrl: N
|
|
390
|
+
} }));
|
|
391
|
+
}
|
|
392
|
+
function fe() {
|
|
393
|
+
let e = window.MathJax?.version;
|
|
394
|
+
return typeof e == "string" && e.startsWith("3.") ? e : void 0;
|
|
395
|
+
}
|
|
396
|
+
var I = "https://cdn.jsdelivr.net/npm/mathjax@4.1.3/tex-mml-chtml.js", L = {
|
|
397
|
+
parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
|
|
398
|
+
overarc: "\\overparen",
|
|
399
|
+
napprox: "\\not\\approx",
|
|
400
|
+
longdiv: "\\enclose{longdiv}",
|
|
401
|
+
abs: ["\\left|#1\\right|", 1]
|
|
402
|
+
}, R = "[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)", z = /\\\(|\\\[|\$\$|\\\$|\\begin\{|\\(?:eq)?ref\{/, B = /\\\(|\\\[|\$|\\begin\{|\\(?:eq)?ref\{/, V = /\\embed\{newLine\}\[\]/g, pe = [
|
|
403
|
+
["$$", "$$"],
|
|
404
|
+
["$", "$"],
|
|
405
|
+
["\\[", "\\]"],
|
|
406
|
+
["\\(", "\\)"]
|
|
407
|
+
], H = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading"), U = "PIE-MJX-CHTML-styles", W = "MJX-CHTML-styles", me = "PIE-MJX-SVG-styles", he = "MJX-SVG-styles", G = "PIE-MathJax-Menu-Settings", ge = [W, he], _e = { "mjx-container[overflow=\"linebreak\"][display]": {
|
|
408
|
+
overflow: "auto clip",
|
|
409
|
+
"min-width": "initial !important"
|
|
410
|
+
} }, ve = 200, ye = 201;
|
|
411
|
+
function K(e) {
|
|
412
|
+
let t = [...e.matches("mjx-container") ? [e] : [], ...e.querySelectorAll("mjx-container")];
|
|
413
|
+
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");
|
|
414
|
+
}
|
|
415
|
+
function q() {
|
|
416
|
+
return window.MathJax;
|
|
417
|
+
}
|
|
418
|
+
function be(e) {
|
|
419
|
+
for (let [t, n] of pe) if (e.startsWith(t) && e.endsWith(n)) return e.substring(t.length, e.length - n.length);
|
|
420
|
+
return e;
|
|
421
|
+
}
|
|
422
|
+
function xe(e) {
|
|
423
|
+
return be(e.includes("\\displaystyle") ? e.replace("\\displaystyle", "").trim() : e);
|
|
424
|
+
}
|
|
425
|
+
var Se = "mathjax_ignore", J = "mathjax_process";
|
|
426
|
+
function Ce(e, t) {
|
|
427
|
+
let n = e.closest(`.${Se}, .${J}`);
|
|
428
|
+
return n !== null && t.contains(n) && !n.classList.contains(J);
|
|
429
|
+
}
|
|
430
|
+
function we(e) {
|
|
431
|
+
for (let t of e.querySelectorAll("[data-latex]")) {
|
|
432
|
+
if (t.dataset.mathHandled || t.closest("mjx-container") || Ce(t, e)) continue;
|
|
433
|
+
let n = t.textContent;
|
|
434
|
+
n && (t.textContent = `\\(${xe(n)}\\)`.replace(V, "\\newline "), t.dataset.mathHandled = "true");
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
function Te(e) {
|
|
438
|
+
for (let t of e.querySelectorAll("math")) t.closest("mjx-container") || t.setAttribute("displaystyle", "true");
|
|
439
|
+
}
|
|
440
|
+
function Ee(e, t) {
|
|
441
|
+
for (let t of e.querySelectorAll("math")) if (!t.closest("mjx-assistive-mml")) return !0;
|
|
442
|
+
return (t ? B : z).test(e.textContent ?? "");
|
|
443
|
+
}
|
|
444
|
+
function De(e) {
|
|
445
|
+
return new Promise((t, n) => {
|
|
446
|
+
let { useSingleDollar: r = !1, accessibility: i = !0, loadFonts: a = !0, srcUrl: o } = e, s = {
|
|
447
|
+
loader: {
|
|
448
|
+
load: i ? ["a11y/assistive-mml"] : [],
|
|
449
|
+
failed: (e) => n(e),
|
|
450
|
+
"output/svg": { ready: (e) => {
|
|
451
|
+
let t = q();
|
|
452
|
+
return Y(t) && X(t), e;
|
|
453
|
+
} }
|
|
454
|
+
},
|
|
455
|
+
startup: {
|
|
456
|
+
typeset: !1,
|
|
457
|
+
ready: () => {
|
|
458
|
+
let e = q(), r = e?.startup, i = Y(e);
|
|
459
|
+
i && (X(e), Z(e)), r?.defaultReady?.(), i && (Oe(r?.document), r?.document?.addStyles?.(_e)), Promise.resolve(r?.promise).then(() => t(), n);
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
tex: { macros: { ...L } },
|
|
463
|
+
output: { displayOverflow: "linebreak" },
|
|
464
|
+
options: {
|
|
465
|
+
enableMenu: i,
|
|
466
|
+
menuOptions: { settings: {
|
|
467
|
+
assistiveMml: i,
|
|
468
|
+
enrich: !1,
|
|
469
|
+
inTabOrder: !1
|
|
470
|
+
} },
|
|
471
|
+
a11y: { inTabOrder: !1 }
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
r && s.tex && (console.warn(R), s.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], s.tex.processEscapes = !0), a || (s.chtml = { fontURL: "" }), window.MathJax = s;
|
|
475
|
+
let c = document.createElement("script");
|
|
476
|
+
c.src = o || I, c.async = !0, c.onerror = () => n(/* @__PURE__ */ Error("Failed to load MathJax")), document.head.appendChild(c);
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
function Y(e) {
|
|
480
|
+
return !!e?.version?.startsWith("4.");
|
|
481
|
+
}
|
|
482
|
+
function X(e) {
|
|
483
|
+
let t = e?._?.output, n = t?.chtml_ts?.CHTML;
|
|
484
|
+
n && (n.STYLESHEETID = U);
|
|
485
|
+
let r = t?.svg_ts?.SVG;
|
|
486
|
+
r && (r.STYLESHEETID = me);
|
|
487
|
+
}
|
|
488
|
+
function Z(e) {
|
|
489
|
+
let t = e?._?.ui?.menu?.Menu?.Menu;
|
|
490
|
+
if (t) {
|
|
491
|
+
t.MENU_STORAGE = G;
|
|
492
|
+
try {
|
|
493
|
+
let e = localStorage.getItem(G);
|
|
494
|
+
if (!e) return;
|
|
495
|
+
let { assistiveMml: t, ...n } = JSON.parse(e);
|
|
496
|
+
if (t === void 0) return;
|
|
497
|
+
Object.keys(n).length ? localStorage.setItem(G, JSON.stringify(n)) : localStorage.removeItem(G);
|
|
498
|
+
} catch {}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
function Oe(e) {
|
|
502
|
+
if (!e) return;
|
|
503
|
+
let t = /* @__PURE__ */ new WeakSet(), n = (e) => {
|
|
504
|
+
let n = e.typesetRoot;
|
|
505
|
+
!n || t.has(n) || (K(n), t.add(n));
|
|
506
|
+
};
|
|
507
|
+
e.addRenderAction?.("pie-strip-latex", ye, (e) => {
|
|
508
|
+
for (let t of e.math ?? []) n(t);
|
|
509
|
+
return !1;
|
|
510
|
+
}, (e) => {
|
|
511
|
+
let t = e.typesetRoot;
|
|
512
|
+
return t && K(t), !1;
|
|
513
|
+
});
|
|
514
|
+
let r = e.outputJax?.chtmlStyles;
|
|
515
|
+
r?.id === W && (r.id = U), ke();
|
|
516
|
+
}
|
|
517
|
+
function Q(e) {
|
|
518
|
+
return e instanceof HTMLStyleElement && ge.includes(e.id);
|
|
519
|
+
}
|
|
520
|
+
function $(e) {
|
|
521
|
+
F("foreign-output-stylesheet", `another MathJax added <style id="${e.id}"> to <head>`);
|
|
522
|
+
}
|
|
523
|
+
function ke() {
|
|
524
|
+
let e = document.head, t = [...e.children].find(Q);
|
|
525
|
+
if (t) {
|
|
526
|
+
$(t);
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
let n = new MutationObserver((e) => {
|
|
530
|
+
for (let t of e) {
|
|
531
|
+
let e = [...t.addedNodes].find(Q);
|
|
532
|
+
if (e) {
|
|
533
|
+
$(e), n.disconnect();
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
});
|
|
538
|
+
n.observe(e, { childList: !0 });
|
|
539
|
+
}
|
|
540
|
+
function Ae(e) {
|
|
541
|
+
let t = e?.math;
|
|
542
|
+
if (!t?.remove) return;
|
|
543
|
+
let n = [...t].filter((e) => (e.state?.() ?? 0) >= ve && e.typesetRoot?.isConnected === !1);
|
|
544
|
+
if (n.length !== 0) {
|
|
545
|
+
for (let e of [...n].reverse()) e.clear?.();
|
|
546
|
+
t.remove(...n);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
function je(e) {
|
|
550
|
+
return new Promise((t, n) => {
|
|
551
|
+
let r = e.startup ?? {};
|
|
552
|
+
e.startup = r;
|
|
553
|
+
let i = r.ready;
|
|
554
|
+
r.ready = () => {
|
|
555
|
+
let e = q()?.startup;
|
|
556
|
+
i ? i.call(r) : e?.defaultReady?.(), Promise.resolve(e?.promise).then(() => t(), n);
|
|
557
|
+
};
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
function Me(e) {
|
|
561
|
+
let t = q();
|
|
562
|
+
return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : je(t) : De(e);
|
|
563
|
+
}
|
|
564
|
+
function Ne(e) {
|
|
565
|
+
return Me(e).then(() => {
|
|
566
|
+
typeof q()?.typesetPromise != "function" && console.warn("[mathjax-renderer] MathJax on this page has no typesetPromise; math stays untypeset.");
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
function Pe(e) {
|
|
570
|
+
let t = globalThis, n = t[H];
|
|
571
|
+
return n || (n = Ne(e), t[H] = n), n;
|
|
572
|
+
}
|
|
573
|
+
function Fe(e = {}) {
|
|
574
|
+
let t = e.useSingleDollar ?? !1;
|
|
575
|
+
return async (n) => {
|
|
576
|
+
if (typeof window > "u") return;
|
|
577
|
+
let i = fe();
|
|
578
|
+
i && F("mathjax-3-global", `window.MathJax is MathJax ${i}`), we(n), r(n), Te(n), ue(n);
|
|
579
|
+
let a = Pe(e);
|
|
580
|
+
if (!Ee(n, t)) {
|
|
581
|
+
a.catch(() => {});
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
await a;
|
|
585
|
+
let o = q();
|
|
586
|
+
if (await o?.startup?.promise, typeof o?.typesetPromise == "function") {
|
|
587
|
+
Ae(o.startup?.document);
|
|
588
|
+
try {
|
|
589
|
+
await o.typesetPromise([n]);
|
|
590
|
+
} catch (e) {
|
|
591
|
+
throw o.typesetClear?.([n]), e;
|
|
592
|
+
}
|
|
593
|
+
K(n);
|
|
594
|
+
}
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
//#endregion
|
|
598
|
+
export { Fe as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./math-mathjax-
|
|
1
|
+
import { t as e } from "./math-mathjax-BAEg0YgQ.js";
|
|
2
2
|
//#region ../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/disclose-version.js
|
|
3
3
|
typeof window < "u" && ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add("5");
|
|
4
4
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/element-player",
|
|
3
|
-
"version": "0.1.3-next.
|
|
3
|
+
"version": "0.1.3-next.20261003064518",
|
|
4
4
|
"description": "Shared PIE element player web component",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"unpkg": "./dist/pie-element-player.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dev": "vite"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@pie-element/shared-math-rendering-mathjax": "0.1.2-next.
|
|
29
|
+
"@pie-element/shared-math-rendering-mathjax": "0.1.2-next.20261003064518"
|
|
30
30
|
},
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"publishConfig": {
|
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
//#region ../shared/math-rendering-mathjax/dist/index.js
|
|
2
|
-
var e = "https://github.com/pie-framework/pie-players/blob/develop/docs/item-player/loading-strategies.md#one-mathjax-version-per-page", t = Symbol.for("@pie-element/shared-math-rendering-mathjax/unsupported-page");
|
|
3
|
-
function n(n, r) {
|
|
4
|
-
if (typeof window > "u") return;
|
|
5
|
-
let i = globalThis;
|
|
6
|
-
i[t] ??= {
|
|
7
|
-
logged: !1,
|
|
8
|
-
conditions: []
|
|
9
|
-
};
|
|
10
|
-
let a = i[t];
|
|
11
|
-
if (a.conditions.includes(n)) return;
|
|
12
|
-
a.conditions.push(n);
|
|
13
|
-
let o = `[math-rendering] Unsupported page (${n}): ${r}. 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 ${e}`;
|
|
14
|
-
a.logged || (a.logged = !0, console.error(o)), window.dispatchEvent(new CustomEvent("pie-mathjax-version-conflict", { detail: {
|
|
15
|
-
condition: n,
|
|
16
|
-
message: o,
|
|
17
|
-
docsUrl: e
|
|
18
|
-
} }));
|
|
19
|
-
}
|
|
20
|
-
function r() {
|
|
21
|
-
let e = window.MathJax?.version;
|
|
22
|
-
return typeof e == "string" && e.startsWith("3.") ? e : void 0;
|
|
23
|
-
}
|
|
24
|
-
var i = "https://cdn.jsdelivr.net/npm/mathjax@4.1.3/tex-mml-chtml.js", a = {
|
|
25
|
-
parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
|
|
26
|
-
overarc: "\\overparen",
|
|
27
|
-
napprox: "\\not\\approx",
|
|
28
|
-
longdiv: "\\enclose{longdiv}",
|
|
29
|
-
abs: ["\\left|#1\\right|", 1]
|
|
30
|
-
}, o = "[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)", s = /\\\(|\\\[|\$\$|\\\$|\\begin\{|\\(?:eq)?ref\{/, c = /\\\(|\\\[|\$|\\begin\{|\\(?:eq)?ref\{/, l = /\\embed\{newLine\}\[\]/g, u = [
|
|
31
|
-
["$$", "$$"],
|
|
32
|
-
["$", "$"],
|
|
33
|
-
["\\[", "\\]"],
|
|
34
|
-
["\\(", "\\)"]
|
|
35
|
-
], d = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading"), f = "PIE-MJX-CHTML-styles", p = "MJX-CHTML-styles", m = "PIE-MJX-SVG-styles", h = "MJX-SVG-styles", g = "PIE-MathJax-Menu-Settings", _ = [p, h], v = 200, y = 201;
|
|
36
|
-
function b(e) {
|
|
37
|
-
let t = [...e.matches("mjx-container") ? [e] : [], ...e.querySelectorAll("mjx-container")];
|
|
38
|
-
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");
|
|
39
|
-
}
|
|
40
|
-
function x() {
|
|
41
|
-
return window.MathJax;
|
|
42
|
-
}
|
|
43
|
-
function S(e) {
|
|
44
|
-
for (let [t, n] of u) if (e.startsWith(t) && e.endsWith(n)) return e.substring(t.length, e.length - n.length);
|
|
45
|
-
return e;
|
|
46
|
-
}
|
|
47
|
-
function C(e) {
|
|
48
|
-
return S(e.includes("\\displaystyle") ? e.replace("\\displaystyle", "").trim() : e);
|
|
49
|
-
}
|
|
50
|
-
var w = "mathjax_ignore", T = "mathjax_process";
|
|
51
|
-
function E(e, t) {
|
|
52
|
-
let n = e.closest(`.${w}, .${T}`);
|
|
53
|
-
return n !== null && t.contains(n) && !n.classList.contains(T);
|
|
54
|
-
}
|
|
55
|
-
function D(e) {
|
|
56
|
-
for (let t of e.querySelectorAll("[data-latex]")) {
|
|
57
|
-
if (t.dataset.mathHandled || t.closest("mjx-container") || E(t, e)) continue;
|
|
58
|
-
let n = t.textContent;
|
|
59
|
-
n && (t.textContent = `\\(${C(n)}\\)`.replace(l, "\\newline "), t.dataset.mathHandled = "true");
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
function O(e, t) {
|
|
63
|
-
for (let t of e.querySelectorAll("math")) if (!t.closest("mjx-assistive-mml")) return !0;
|
|
64
|
-
return (t ? c : s).test(e.textContent ?? "");
|
|
65
|
-
}
|
|
66
|
-
function k(e) {
|
|
67
|
-
return new Promise((t, n) => {
|
|
68
|
-
let { useSingleDollar: r = !1, accessibility: s = !0, loadFonts: c = !0, srcUrl: l } = e, u = {
|
|
69
|
-
loader: {
|
|
70
|
-
load: s ? ["a11y/assistive-mml"] : [],
|
|
71
|
-
failed: (e) => n(e),
|
|
72
|
-
"output/svg": { ready: (e) => {
|
|
73
|
-
let t = x();
|
|
74
|
-
return A(t) && j(t), e;
|
|
75
|
-
} }
|
|
76
|
-
},
|
|
77
|
-
startup: {
|
|
78
|
-
typeset: !1,
|
|
79
|
-
ready: () => {
|
|
80
|
-
let e = x(), r = e?.startup, i = A(e);
|
|
81
|
-
i && (j(e), M(e)), r?.defaultReady?.(), i && N(r?.document), Promise.resolve(r?.promise).then(() => t(), n);
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
tex: { macros: { ...a } },
|
|
85
|
-
options: {
|
|
86
|
-
enableMenu: s,
|
|
87
|
-
menuOptions: { settings: {
|
|
88
|
-
assistiveMml: s,
|
|
89
|
-
enrich: !1,
|
|
90
|
-
inTabOrder: !1
|
|
91
|
-
} },
|
|
92
|
-
a11y: { inTabOrder: !1 }
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
r && u.tex && (console.warn(o), u.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], u.tex.processEscapes = !0), c || (u.chtml = { fontURL: "" }), window.MathJax = u;
|
|
96
|
-
let d = document.createElement("script");
|
|
97
|
-
d.src = l || i, d.async = !0, d.onerror = () => n(/* @__PURE__ */ Error("Failed to load MathJax")), document.head.appendChild(d);
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
function A(e) {
|
|
101
|
-
return !!e?.version?.startsWith("4.");
|
|
102
|
-
}
|
|
103
|
-
function j(e) {
|
|
104
|
-
let t = e?._?.output, n = t?.chtml_ts?.CHTML;
|
|
105
|
-
n && (n.STYLESHEETID = f);
|
|
106
|
-
let r = t?.svg_ts?.SVG;
|
|
107
|
-
r && (r.STYLESHEETID = m);
|
|
108
|
-
}
|
|
109
|
-
function M(e) {
|
|
110
|
-
let t = e?._?.ui?.menu?.Menu?.Menu;
|
|
111
|
-
if (t) {
|
|
112
|
-
t.MENU_STORAGE = g;
|
|
113
|
-
try {
|
|
114
|
-
let e = localStorage.getItem(g);
|
|
115
|
-
if (!e) return;
|
|
116
|
-
let { assistiveMml: t, ...n } = JSON.parse(e);
|
|
117
|
-
if (t === void 0) return;
|
|
118
|
-
Object.keys(n).length ? localStorage.setItem(g, JSON.stringify(n)) : localStorage.removeItem(g);
|
|
119
|
-
} catch {}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
function N(e) {
|
|
123
|
-
if (!e) return;
|
|
124
|
-
let t = /* @__PURE__ */ new WeakSet(), n = (e) => {
|
|
125
|
-
let n = e.typesetRoot;
|
|
126
|
-
!n || t.has(n) || (b(n), t.add(n));
|
|
127
|
-
};
|
|
128
|
-
e.addRenderAction?.("pie-strip-latex", y, (e) => {
|
|
129
|
-
for (let t of e.math ?? []) n(t);
|
|
130
|
-
return !1;
|
|
131
|
-
}, (e) => {
|
|
132
|
-
let t = e.typesetRoot;
|
|
133
|
-
return t && b(t), !1;
|
|
134
|
-
});
|
|
135
|
-
let r = e.outputJax?.chtmlStyles;
|
|
136
|
-
r?.id === p && (r.id = f), I();
|
|
137
|
-
}
|
|
138
|
-
function P(e) {
|
|
139
|
-
return e instanceof HTMLStyleElement && _.includes(e.id);
|
|
140
|
-
}
|
|
141
|
-
function F(e) {
|
|
142
|
-
n("foreign-output-stylesheet", `another MathJax added <style id="${e.id}"> to <head>`);
|
|
143
|
-
}
|
|
144
|
-
function I() {
|
|
145
|
-
let e = document.head, t = [...e.children].find(P);
|
|
146
|
-
if (t) {
|
|
147
|
-
F(t);
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
let n = new MutationObserver((e) => {
|
|
151
|
-
for (let t of e) {
|
|
152
|
-
let e = [...t.addedNodes].find(P);
|
|
153
|
-
if (e) {
|
|
154
|
-
F(e), n.disconnect();
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
n.observe(e, { childList: !0 });
|
|
160
|
-
}
|
|
161
|
-
function L(e) {
|
|
162
|
-
let t = e?.math;
|
|
163
|
-
if (!t?.remove) return;
|
|
164
|
-
let n = [...t].filter((e) => (e.state?.() ?? 0) >= v && e.typesetRoot?.isConnected === !1);
|
|
165
|
-
if (n.length !== 0) {
|
|
166
|
-
for (let e of [...n].reverse()) e.clear?.();
|
|
167
|
-
t.remove(...n);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
function R(e) {
|
|
171
|
-
return new Promise((t, n) => {
|
|
172
|
-
let r = e.startup ?? {};
|
|
173
|
-
e.startup = r;
|
|
174
|
-
let i = r.ready;
|
|
175
|
-
r.ready = () => {
|
|
176
|
-
let e = x()?.startup;
|
|
177
|
-
i ? i.call(r) : e?.defaultReady?.(), Promise.resolve(e?.promise).then(() => t(), n);
|
|
178
|
-
};
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
function z(e) {
|
|
182
|
-
let t = x();
|
|
183
|
-
return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : R(t) : k(e);
|
|
184
|
-
}
|
|
185
|
-
function B(e) {
|
|
186
|
-
return z(e).then(() => {
|
|
187
|
-
typeof x()?.typesetPromise != "function" && console.warn("[mathjax-renderer] MathJax on this page has no typesetPromise; math stays untypeset.");
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
function V(e) {
|
|
191
|
-
let t = globalThis, n = t[d];
|
|
192
|
-
return n || (n = B(e), t[d] = n), n;
|
|
193
|
-
}
|
|
194
|
-
function H(e = {}) {
|
|
195
|
-
let t = e.useSingleDollar ?? !1;
|
|
196
|
-
return async (i) => {
|
|
197
|
-
if (typeof window > "u") return;
|
|
198
|
-
let a = r();
|
|
199
|
-
a && n("mathjax-3-global", `window.MathJax is MathJax ${a}`), D(i);
|
|
200
|
-
let o = V(e);
|
|
201
|
-
if (!O(i, t)) {
|
|
202
|
-
o.catch(() => {});
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
await o;
|
|
206
|
-
let s = x();
|
|
207
|
-
if (await s?.startup?.promise, typeof s?.typesetPromise == "function") {
|
|
208
|
-
L(s.startup?.document);
|
|
209
|
-
try {
|
|
210
|
-
await s.typesetPromise([i]);
|
|
211
|
-
} catch (e) {
|
|
212
|
-
throw s.typesetClear?.([i]), e;
|
|
213
|
-
}
|
|
214
|
-
b(i);
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
//#endregion
|
|
219
|
-
export { H as t };
|