@pie-element/element-player 0.1.3 → 0.1.4-next.20261007003844

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.
@@ -0,0 +1,770 @@
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 b(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 ee() {
102
+ let e = window.MathJax?.version;
103
+ return typeof e == "string" && e.startsWith("3.") ? e : void 0;
104
+ }
105
+ function x() {
106
+ return window.MathJax;
107
+ }
108
+ function te(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 ne(e, t) {
125
+ let n = t.srcUrl || (t.root ? `${t.root}/mathjax@4.1.3/tex-mml-chtml.js` : void 0);
126
+ return n ? (te(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 re = globalThis, S = "PIE-MJX-CHTML-styles", ie = ["MJX-CHTML-styles", "MJX-SVG-styles"], ae = ee, C = "http://www.w3.org/1998/Math/MathML", oe = /^([a-z_][\w.-]*):math$/, se = /^[a-z][a-z0-9-]*$/;
133
+ function ce(e) {
134
+ for (let t of e.querySelectorAll("*")) {
135
+ let n = oe.exec(t.tagName.toLowerCase())?.[1];
136
+ !n || !e.contains(t) || t.closest("mjx-container") || t.replaceWith(w(t, `${n}:`));
137
+ }
138
+ }
139
+ function w(e, t) {
140
+ let n = e.tagName.toLowerCase().slice(t.length);
141
+ if (!se.test(n)) return e;
142
+ let r = e.ownerDocument.createElementNS(C, 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 ? w(n, t) : n);
147
+ }
148
+ return r;
149
+ }
150
+ var le = /* @__PURE__ */ new Set([
151
+ "updiagonalstrike",
152
+ "downdiagonalstrike",
153
+ "verticalstrike",
154
+ "horizontalstrike"
155
+ ]), ue = {
156
+ thin: "0.035em",
157
+ medium: "0.07em",
158
+ thick: "0.14em"
159
+ }, T = {
160
+ tight: "0em",
161
+ medium: "0.1em",
162
+ loose: "0.2em"
163
+ }, E = /^(\d+(\.\d*)?|\.\d+)(em|ex|px|pt|pc|in|cm|mm)$/, de = /^(#[0-9a-f]{3,8}|[a-z]+)$/i, fe = /^(\d+(\.\d*)?|\.\d+)$/, pe = /* @__PURE__ */ new Set([
164
+ "mn",
165
+ "mo",
166
+ "mi",
167
+ "mtext"
168
+ ]), me = /* @__PURE__ */ new Set([
169
+ "stackalign",
170
+ "charalign",
171
+ "charspacing",
172
+ "longdivstyle"
173
+ ]);
174
+ function D(e, t, n = [], r = {}) {
175
+ let i = e.createElementNS(C, 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 O(e, t) {
181
+ let n = D(e.document, "mo");
182
+ return n.textContent = t, n;
183
+ }
184
+ function k(e) {
185
+ let t = D(e.document, "mn");
186
+ return t.textContent = "0", D(e.document, "mphantom", [t]);
187
+ }
188
+ function A(e, t) {
189
+ return e.getAttribute(t)?.trim().toLowerCase() || void 0;
190
+ }
191
+ function j(e, t) {
192
+ let n = Number.parseInt(e.getAttribute(t) ?? "", 10);
193
+ return Number.isFinite(n) ? n : 0;
194
+ }
195
+ function M(e) {
196
+ return e.localName === "none" || e.localName === "mrow" && e.children.length === 0 && !e.textContent?.trim();
197
+ }
198
+ function N(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 P(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 (M(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 pe.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: N(r.length, n.stackAlign, i ?? a),
229
+ position: t
230
+ };
231
+ }
232
+ function F(e) {
233
+ return (e ?? "").toLowerCase().split(/\s+/).filter((e) => le.has(e));
234
+ }
235
+ function he(e, t) {
236
+ let n = [...e.children].filter((e) => !M(e));
237
+ return n.length <= 1 ? n[0] ?? null : D(t.document, "mrow", n);
238
+ }
239
+ function ge(e, t, n) {
240
+ let r = A(e, "location") ?? "n", i = F(e.getAttribute("crossout")), a = [...e.children].map((e) => M(e) ? null : e.localName === "mscarry" ? {
241
+ content: he(e, n),
242
+ location: A(e, "location") ?? r,
243
+ crossout: e.hasAttribute("crossout") ? F(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: N(a.length, n.stackAlign),
253
+ position: t,
254
+ scale: fe.test(o) ? o : "0.6"
255
+ };
256
+ }
257
+ function I(e) {
258
+ let t = A(e, "mslinethickness") ?? "medium", n = ue[t] ?? (E.test(t) ? t : "0.07em"), r = e.getAttribute("mathcolor")?.trim() ?? "";
259
+ return `${n} solid ${de.test(r) ? r : "currentColor"}`;
260
+ }
261
+ function _e(e, t, n) {
262
+ let r = Math.max(0, j(e, "length"));
263
+ return {
264
+ kind: "line",
265
+ length: r,
266
+ anchor: N(r, n.stackAlign),
267
+ position: t,
268
+ border: I(e)
269
+ };
270
+ }
271
+ function L(e, t, n, r, i) {
272
+ e.forEach((e, a) => {
273
+ let o = t + a * n + j(e, "position");
274
+ switch (e.localName) {
275
+ case "msgroup":
276
+ L([...e.children], o, j(e, "shift"), r, i);
277
+ break;
278
+ case "msline":
279
+ i.push(_e(e, o, r));
280
+ break;
281
+ case "mscarries":
282
+ i.push(ge(e, o, r));
283
+ break;
284
+ case "msrow":
285
+ case "mrow":
286
+ i.push(P([...e.children], o, r));
287
+ break;
288
+ default: i.push(P([e], o, r));
289
+ }
290
+ });
291
+ }
292
+ function R(e) {
293
+ return -e.anchor - e.position;
294
+ }
295
+ function z(e) {
296
+ return e.kind === "digits" ? e.cells.length : e.kind === "carries" ? e.carries.length : e.length;
297
+ }
298
+ function B(e) {
299
+ return R(e) + z(e) - 1;
300
+ }
301
+ function ve(e, t, n, r) {
302
+ let i = (e) => D(r.document, "mpadded", [t], {
303
+ width: "0",
304
+ ...e ? { lspace: e } : {}
305
+ }), a = (e, t) => D(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 ye(e, t, n) {
328
+ let r = D(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 ? D(n.document, "mpadded", [r], {
334
+ lspace: `-${i}em`,
335
+ width: `-${2 * i}em`
336
+ }) : r;
337
+ }
338
+ function be(e, t, n, r, i) {
339
+ let a = e && t.crossout.length ? ye(e, t.crossout, i) : e;
340
+ if (!t.content) return a;
341
+ let o = D(i.document, "mstyle", [t.content], { scriptsizemultiplier: r });
342
+ return ve(a ?? k(i), o, n, i);
343
+ }
344
+ function V(e, t) {
345
+ return e.carries[t - R(e)] ?? null;
346
+ }
347
+ function xe(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 = V(s, t), l = n.slice(0, o).some((e) => V(e, t));
351
+ if (!c && !l) return;
352
+ let u = c ?? {
353
+ content: k(r),
354
+ location: "n",
355
+ crossout: []
356
+ }, d = a === 0 ? u.location : "n";
357
+ i = be(i, u, d, s.scale, r);
358
+ }), e.content = i;
359
+ }
360
+ function H(e, t) {
361
+ let n = e.filter((e) => z(e) > 0), r = Math.min(0, ...n.map(R)), i = Math.max(r, ...n.map(B)) - 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 + R(e) + n), u = [], d = [], f = (e) => {
365
+ let n = c();
366
+ e.cells.forEach((t, r) => {
367
+ n[a + R(e) + r].content = t;
368
+ }), u.length && n.forEach((e, n) => {
369
+ xe(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 U(e, { rows: t }, n) {
390
+ let r = D(n.document, "mtable", t.map((e) => D(n.document, "mtr", e.map((e) => {
391
+ let t = Object.entries(e.borders).map(([e, t]) => `border-${e}:${t}`).join(";");
392
+ return D(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]) me.has(t) || r.setAttribute(t, n);
398
+ let i = A(e, "charspacing") ?? "medium", a = A(e, "charalign");
399
+ return r.setAttribute("columnspacing", T[i] ?? (E.test(i) ? i : T.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 W(e) {
402
+ return {
403
+ document: e.ownerDocument,
404
+ stackAlign: A(e, "stackalign") ?? "decimalpoint",
405
+ decimalPoint: e.closest("[decimalpoint]")?.getAttribute("decimalpoint")?.trim().charAt(0) || "."
406
+ };
407
+ }
408
+ function Se(e) {
409
+ let t = W(e), n = [];
410
+ return L([...e.children], 0, 0, t, n), U(e, H(n, t), t);
411
+ }
412
+ function G(e, t, n, r, i, a) {
413
+ for (let o = n; o <= r; o++) e[t][o].borders[i] = a;
414
+ }
415
+ function Ce(e, t) {
416
+ let n = O(t, ")");
417
+ return n.setAttribute("minsize", "1.2em"), [D(t.document, "mrow", [e, D(t.document, "mspace", [], { width: "0.2em" })]), D(t.document, "mpadded", [n], {
418
+ voffset: "0.1em",
419
+ lspace: "-0.15em",
420
+ depth: "-0.2em",
421
+ height: "-0.2em"
422
+ })];
423
+ }
424
+ function we(e) {
425
+ let t = W(e), [n, r, ...i] = [...e.children], a = n && !M(n) ? n : null, o = r && !M(r) ? r : null, s = A(e, "longdivstyle") ?? "lefttop", c = I(e), l = [];
426
+ L(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(...P(n, 0, t).cells);
439
+ };
440
+ switch (s) {
441
+ case "left/\\right":
442
+ f(a, O(t, "/")), p(O(t, "\\"), o);
443
+ break;
444
+ case "left)(right":
445
+ f(a, O(t, ")")), p(O(t, "("), o);
446
+ break;
447
+ case ":right=right":
448
+ p(O(t, ":"), a, O(t, "="), o);
449
+ break;
450
+ case "righttop":
451
+ case "stackedleftlinetop":
452
+ case "lefttop":
453
+ o && L([o], 0, 0, t, d), l.splice(l.indexOf(u), 0, ...d), s === "righttop" ? p(a) : s === "stackedleftlinetop" ? f(a) : f(...Ce(a, t));
454
+ break;
455
+ }
456
+ let m = H(l, t), h = m.rows, g = m.rowOf.get(u) ?? 0, _ = (e) => m.origin + R(u) + e, v = Math.max(_(u.cells.length - 1), ...d.map((e) => m.origin + B(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, G(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, G(h, g, _(1), v, "top", c);
469
+ break;
470
+ }
471
+ case "stackedrightright":
472
+ case "mediumstackedrightright":
473
+ case "shortstackedrightright":
474
+ case "stackedleftleft":
475
+ Te(h, g, s, a, o, c, t);
476
+ break;
477
+ default: G(h, g, _(1), v, "top", c);
478
+ }
479
+ return U(e, m, t);
480
+ }
481
+ function Te(e, t, n, r, i, a, o) {
482
+ let s = n === "stackedleftleft", c = s ? "right" : "left", l = (e) => e && D(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 Ee(e) {
502
+ for (let t of [...e.querySelectorAll("mstack, mlongdiv")]) !t.closest("math") || t.closest("mjx-container") || t.replaceWith(t.localName === "mstack" ? Se(t) : we(t));
503
+ }
504
+ var De = "PIE-MJX-explorer-styles", K = "var(--pie-text, black)", Oe = "var(--pie-background, #ffffff)", ke = "var(--pie-border-dark, #66686A)", q = "var(--pie-focus-outline, var(--pie-button-focus-outline, var(--pie-focus-checked-border, #1565C0)))", J = `color-mix(in srgb, ${q} 15%, transparent)`, Ae = `
505
+ :root mjx-container [data-sre-highlight-1]:not([data-mjx-collapsed], rect) {
506
+ color: ${K} !important;
507
+ fill: ${K} !important;
508
+ }
509
+ :root mjx-container:not([data-mjx-clone-container]) [data-sre-highlight-1]:not([data-sre-enclosed], rect) {
510
+ background-color: ${J} !important;
511
+ }
512
+ :root mjx-container rect[data-sre-highlight-1]:not([data-sre-enclosed]) {
513
+ fill: ${J} !important;
514
+ }
515
+ :root mjx-container .mjx-selected {
516
+ outline: 2px solid ${q} !important;
517
+ }
518
+ :root mjx-container [data-sre-highlight-2] {
519
+ color: ${K} !important;
520
+ background-color: transparent !important;
521
+ fill: ${K} !important;
522
+ outline: 2px dashed ${q} !important;
523
+ }
524
+ :root mjx-container rect[data-sre-highlight-2] {
525
+ fill: transparent !important;
526
+ stroke: ${q} !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: ${K} !important;
532
+ background-color: ${Oe} !important;
533
+ border-color: ${ke} !important;
534
+ }
535
+ :root .MJX_LiveRegion > div, :root .MJX_HoverRegion > div {
536
+ color: ${K} !important;
537
+ background-color: ${J} !important;
538
+ }
539
+ `;
540
+ function je(e = document) {
541
+ if (e.getElementById("PIE-MJX-explorer-styles")) return;
542
+ let t = e.createElement("style");
543
+ t.id = De, t.textContent = Ae, e.head.appendChild(t);
544
+ }
545
+ var Y = Symbol.for("@pie-element/shared-math-rendering-mathjax/speech-worker-failed");
546
+ function Me() {
547
+ let e = globalThis;
548
+ e[Y] || (e[Y] = !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}`));
549
+ }
550
+ function Ne(e) {
551
+ let t = e.webworker;
552
+ if (!t || t.ready) return;
553
+ e.options ??= {};
554
+ let n = e.options;
555
+ n.enableSpeech = !1, n.enableBraille = !1, n.speechError = () => {}, t.Post = () => Promise.reject(/* @__PURE__ */ Error("The speech worker did not start")), t.Terminate(), Me();
556
+ }
557
+ function Pe(e) {
558
+ let t = e?.adaptor, n = t?.createWorker;
559
+ !e || !t || !n || (t.createWorker = async (r, i) => {
560
+ let a = await n.call(t, r, i);
561
+ return a.addEventListener("error", () => Ne(e), { once: !0 }), a;
562
+ });
563
+ }
564
+ `${i}`;
565
+ var Fe = {
566
+ parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
567
+ overarc: "\\overparen",
568
+ napprox: "\\not\\approx",
569
+ longdiv: "\\enclose{longdiv}",
570
+ abs: ["\\left|#1\\right|", 1]
571
+ }, Ie = "[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)", Le = /\\\(|\\\[|\$\$|\\\$|\\begin\{|\\(?:eq)?ref\{/, Re = /\\\(|\\\[|\$|\\begin\{|\\(?:eq)?ref\{/, ze = /\\embed\{newLine\}\[\]/g, Be = [
572
+ ["$$", "$$"],
573
+ ["$", "$"],
574
+ ["\\[", "\\]"],
575
+ ["\\(", "\\)"]
576
+ ], X = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading"), Ve = "MJX-CHTML-styles", He = "PIE-MJX-SVG-styles", Z = "PIE-MathJax-Menu-Settings", Ue = { "mjx-container[overflow=\"linebreak\"][display]": {
577
+ overflow: "auto clip",
578
+ "min-width": "initial !important"
579
+ } }, We = 200, Ge = 201;
580
+ function Q(e) {
581
+ let t = [...e.matches("mjx-container") ? [e] : [], ...e.querySelectorAll("mjx-container")];
582
+ 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");
583
+ }
584
+ function Ke(e) {
585
+ for (let [t, n] of Be) if (e.startsWith(t) && e.endsWith(n)) return e.substring(t.length, e.length - n.length);
586
+ return e;
587
+ }
588
+ function qe(e) {
589
+ return Ke(e.includes("\\displaystyle") ? e.replace("\\displaystyle", "").trim() : e);
590
+ }
591
+ var Je = "mathjax_ignore", Ye = "mathjax_process";
592
+ function Xe(e, t) {
593
+ let n = e.closest(`.${Je}, .${Ye}`);
594
+ return n !== null && t.contains(n) && !n.classList.contains(Ye);
595
+ }
596
+ function Ze(e) {
597
+ for (let t of e.querySelectorAll("[data-latex]")) {
598
+ if (t.dataset.mathHandled || t.closest("mjx-container") || Xe(t, e)) continue;
599
+ let n = t.textContent;
600
+ n && (t.textContent = `\\(${qe(n)}\\)`.replace(ze, "\\newline "), t.dataset.mathHandled = "true");
601
+ }
602
+ }
603
+ function Qe(e) {
604
+ for (let t of e.querySelectorAll("math")) t.closest("mjx-container") || t.setAttribute("displaystyle", "true");
605
+ }
606
+ function $e(e, t) {
607
+ for (let t of e.querySelectorAll("math")) if (!t.closest("mjx-assistive-mml")) return !0;
608
+ return (t ? Re : Le).test(e.textContent ?? "");
609
+ }
610
+ function et(e) {
611
+ return new Promise((t, n) => {
612
+ let { useSingleDollar: r = !1, accessibility: i = !0, loadFonts: a = !0, srcUrl: o } = e, s = d(e, import.meta.url), c = {
613
+ loader: {
614
+ load: i ? ["a11y/assistive-mml"] : [],
615
+ failed: (e) => n(e),
616
+ "output/svg": { ready: (e) => {
617
+ let t = x();
618
+ return tt(t) && $(t), e;
619
+ } }
620
+ },
621
+ startup: {
622
+ typeset: !1,
623
+ ready: () => {
624
+ let e = x(), r = e?.startup, i = tt(e);
625
+ i && ($(e), nt(e, s.speechLocales), f(e?._?.a11y?.sre_ts?.locales, s.speechLocales)), r?.defaultReady?.(), i && (rt(r?.document), r?.document?.addStyles?.(Ue), Pe(r?.document)), Promise.resolve(r?.promise).then(() => t(), n);
626
+ }
627
+ },
628
+ tex: { macros: { ...Fe } },
629
+ output: { displayOverflow: "linebreak" },
630
+ options: {
631
+ enableMenu: i,
632
+ menuOptions: { settings: {
633
+ assistiveMml: i,
634
+ enrich: !1,
635
+ inTabOrder: !1
636
+ } },
637
+ a11y: { inTabOrder: !1 }
638
+ }
639
+ };
640
+ r && c.tex && (console.warn(Ie), c.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], c.tex.processEscapes = !0), a || (c.chtml = { fontURL: "" });
641
+ let l = p(s.speechLocales);
642
+ l && c.options && (c.options.sre = { locale: l }), ne(c, {
643
+ ...s,
644
+ srcUrl: o
645
+ }).then((e) => {
646
+ e || t();
647
+ }, n);
648
+ });
649
+ }
650
+ function tt(e) {
651
+ return !!e?.version?.startsWith("4.");
652
+ }
653
+ function $(e) {
654
+ let t = e?._?.output, n = t?.chtml_ts?.CHTML;
655
+ n && (n.STYLESHEETID = S);
656
+ let r = t?.svg_ts?.SVG;
657
+ r && (r.STYLESHEETID = He);
658
+ }
659
+ function nt(e, t) {
660
+ let n = e?._?.ui?.menu?.Menu?.Menu;
661
+ if (n) {
662
+ n.MENU_STORAGE = Z;
663
+ try {
664
+ let e = localStorage.getItem(Z);
665
+ if (!e) return;
666
+ let { assistiveMml: n, locale: r, ...i } = JSON.parse(e), a = r === void 0 || !t || t.has(r);
667
+ if (n === void 0 && a) return;
668
+ a && r !== void 0 && (i.locale = r), Object.keys(i).length ? localStorage.setItem(Z, JSON.stringify(i)) : localStorage.removeItem(Z);
669
+ } catch {}
670
+ }
671
+ }
672
+ function rt(e) {
673
+ if (!e) return;
674
+ let t = /* @__PURE__ */ new WeakSet(), n = (e) => {
675
+ let n = e.typesetRoot;
676
+ !n || t.has(n) || (Q(n), t.add(n));
677
+ };
678
+ e.addRenderAction?.("pie-strip-latex", Ge, (e) => {
679
+ for (let t of e.math ?? []) n(t);
680
+ return !1;
681
+ }, (e) => {
682
+ let t = e.typesetRoot;
683
+ return t && Q(t), !1;
684
+ });
685
+ let r = e.outputJax?.chtmlStyles;
686
+ r?.id === Ve && (r.id = S), ot();
687
+ }
688
+ function it(e) {
689
+ return e instanceof HTMLStyleElement && ie.includes(e.id);
690
+ }
691
+ function at(e) {
692
+ b("foreign-output-stylesheet", `another MathJax added <style id="${e.id}"> to <head>`);
693
+ }
694
+ function ot() {
695
+ let e = document.head, t = [...e.children].find(it);
696
+ if (t) {
697
+ at(t);
698
+ return;
699
+ }
700
+ let n = new MutationObserver((e) => {
701
+ for (let t of e) {
702
+ let e = [...t.addedNodes].find(it);
703
+ if (e) {
704
+ at(e), n.disconnect();
705
+ return;
706
+ }
707
+ }
708
+ });
709
+ n.observe(e, { childList: !0 });
710
+ }
711
+ function st(e) {
712
+ let t = e?.math;
713
+ if (!t?.remove) return;
714
+ let n = [...t].filter((e) => (e.state?.() ?? 0) >= We && e.typesetRoot?.isConnected === !1);
715
+ if (n.length !== 0) {
716
+ for (let e of [...n].reverse()) e.clear?.();
717
+ t.remove(...n);
718
+ }
719
+ }
720
+ function ct(e) {
721
+ return new Promise((t, n) => {
722
+ let r = e.startup ?? {};
723
+ e.startup = r;
724
+ let i = r.ready;
725
+ r.ready = () => {
726
+ let e = x()?.startup;
727
+ i ? i.call(r) : e?.defaultReady?.(), Promise.resolve(e?.promise).then(() => t(), n);
728
+ };
729
+ });
730
+ }
731
+ function lt(e) {
732
+ let t = x();
733
+ return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : ct(t) : et(e);
734
+ }
735
+ function ut(e) {
736
+ return lt(e).then(() => {
737
+ let e = x();
738
+ e && typeof e.typesetPromise != "function" && console.warn("[mathjax-renderer] MathJax on this page has no typesetPromise; math stays untypeset.");
739
+ });
740
+ }
741
+ function dt(e) {
742
+ let t = re, n = t[X];
743
+ return n || (n = ut(e), t[X] = n), n;
744
+ }
745
+ function ft(e = {}) {
746
+ let t = e.useSingleDollar ?? !1;
747
+ return async (n) => {
748
+ if (typeof window > "u") return;
749
+ let r = ae();
750
+ r && b("mathjax-3-global", `window.MathJax is MathJax ${r}`), Ze(n), ce(n), Qe(n), Ee(n);
751
+ let i = dt(e);
752
+ if (!$e(n, t)) {
753
+ i.catch(() => {});
754
+ return;
755
+ }
756
+ await i;
757
+ let a = x();
758
+ if (await a?.startup?.promise, typeof a?.typesetPromise == "function") {
759
+ je(), st(a.startup?.document);
760
+ try {
761
+ await a.typesetPromise([n]);
762
+ } catch (e) {
763
+ throw a.typesetClear?.([n]), e;
764
+ }
765
+ Q(n);
766
+ }
767
+ };
768
+ }
769
+ //#endregion
770
+ export { ft as t };