@pie-element/element-player 0.1.9-next.20261020153832 → 0.1.9-next.20261022133444

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.
@@ -86,7 +86,7 @@ function g(e) {
86
86
  } }));
87
87
  }
88
88
  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", ee = Symbol.for("@pie-element/shared-math-rendering-mathjax/unsupported-page");
89
- function te(e, t) {
89
+ function y(e, t) {
90
90
  if (typeof window > "u") return;
91
91
  let n = globalThis;
92
92
  n[ee] ??= {
@@ -103,14 +103,14 @@ function te(e, t) {
103
103
  docsUrl: _
104
104
  } }));
105
105
  }
106
- function ne() {
106
+ function te() {
107
107
  let e = window.MathJax?.version;
108
108
  return typeof e == "string" && e.startsWith("3.") ? e : void 0;
109
109
  }
110
- function y() {
110
+ function b() {
111
111
  return window.MathJax;
112
112
  }
113
- function re(t, { root: n, speechPath: r }) {
113
+ function ne(t, { root: n, speechPath: r }) {
114
114
  n && (t.loader = {
115
115
  ...t.loader,
116
116
  paths: {
@@ -126,81 +126,81 @@ function re(t, { root: n, speechPath: r }) {
126
126
  }
127
127
  });
128
128
  }
129
- function ie(e, t) {
129
+ function re(e, t) {
130
130
  let n = t.srcUrl || (t.root ? `${t.root}/mathjax@4.1.3/tex-mml-chtml.js` : void 0);
131
- return n ? (re(e, t), new Promise((t, r) => {
131
+ return n ? (ne(e, t), new Promise((t, r) => {
132
132
  window.MathJax = e;
133
133
  let i = document.createElement("script");
134
134
  i.src = n, i.async = !0, i.onload = () => t(!0), i.onerror = () => r(/* @__PURE__ */ Error("Failed to load MathJax")), document.head.appendChild(i);
135
135
  })) : (g("untypeset"), Promise.resolve(!1));
136
136
  }
137
- var ae = globalThis, b = "PIE-MJX-CHTML-styles", oe = ["MJX-CHTML-styles", "MJX-SVG-styles"], se = ne, x = "http://www.w3.org/1998/Math/MathML", ce = /^([a-z_][\w.-]*):math$/, le = /^[a-z][a-z0-9-]*$/;
137
+ 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-]*$/;
138
138
  function ue(e) {
139
139
  for (let t of e.querySelectorAll("*")) {
140
140
  let n = ce.exec(t.tagName.toLowerCase())?.[1];
141
- n && e.contains(t) && !t.closest("mjx-container") && t.replaceWith(S(t, `${n}:`));
141
+ n && e.contains(t) && !t.closest("mjx-container") && t.replaceWith(de(t, `${n}:`));
142
142
  }
143
143
  }
144
- function S(e, t) {
144
+ function de(e, t) {
145
145
  let n = e.tagName.toLowerCase().slice(t.length);
146
146
  if (!le.test(n)) return e;
147
- let r = e.ownerDocument.createElementNS(x, n);
147
+ let r = e.ownerDocument.createElementNS(se, n);
148
148
  for (let t of e.attributes) r.setAttribute(t.name, t.value);
149
149
  for (let n of [...e.childNodes]) {
150
150
  let e = n instanceof Element && n.tagName.toLowerCase().startsWith(t);
151
- r.appendChild(e ? S(n, t) : n);
151
+ r.appendChild(e ? de(n, t) : n);
152
152
  }
153
153
  return r;
154
154
  }
155
- var de = /* @__PURE__ */ new Set([
155
+ var fe = /* @__PURE__ */ new Set([
156
156
  "updiagonalstrike",
157
157
  "downdiagonalstrike",
158
158
  "verticalstrike",
159
159
  "horizontalstrike"
160
- ]), fe = {
160
+ ]), pe = {
161
161
  thin: "0.035em",
162
162
  medium: "0.07em",
163
163
  thick: "0.14em"
164
- }, C = {
164
+ }, me = {
165
165
  tight: "0em",
166
166
  medium: "0.1em",
167
167
  loose: "0.2em"
168
- }, w = /^(\d+(\.\d*)?|\.\d+)(em|ex|px|pt|pc|in|cm|mm)$/, pe = /^(#[0-9a-f]{3,8}|[a-z]+)$/i, me = /^(\d+(\.\d*)?|\.\d+)$/, he = /* @__PURE__ */ new Set([
168
+ }, 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([
169
169
  "mn",
170
170
  "mo",
171
171
  "mi",
172
172
  "mtext"
173
- ]), ge = /* @__PURE__ */ new Set([
173
+ ]), ye = /* @__PURE__ */ new Set([
174
174
  "stackalign",
175
175
  "charalign",
176
176
  "charspacing",
177
177
  "longdivstyle"
178
178
  ]);
179
- function T(e, t, n = [], r = {}) {
180
- let i = e.createElementNS(x, t);
179
+ function S(e, t, n = [], r = {}) {
180
+ let i = e.createElementNS(se, t);
181
181
  for (let [e, t] of Object.entries(r)) i.setAttribute(e, t);
182
182
  for (let e of n) e && i.appendChild(e);
183
183
  return i;
184
184
  }
185
- function E(e, t) {
186
- let n = T(e.document, "mo");
185
+ function C(e, t) {
186
+ let n = S(e.document, "mo");
187
187
  return n.textContent = t, n;
188
188
  }
189
- function _e(e) {
190
- let t = T(e.document, "mn");
191
- return t.textContent = "0", T(e.document, "mphantom", [t]);
189
+ function w(e) {
190
+ let t = S(e.document, "mn");
191
+ return t.textContent = "0", S(e.document, "mphantom", [t]);
192
192
  }
193
- function D(e, t) {
193
+ function T(e, t) {
194
194
  return e.getAttribute(t)?.trim().toLowerCase() || void 0;
195
195
  }
196
- function O(e, t) {
196
+ function E(e, t) {
197
197
  let n = Number.parseInt(e.getAttribute(t) ?? "", 10);
198
198
  return Number.isFinite(n) ? n : 0;
199
199
  }
200
- function k(e) {
200
+ function D(e) {
201
201
  return e.localName === "none" || e.localName === "mrow" && e.children.length === 0 && !e.textContent?.trim();
202
202
  }
203
- function A(e, t, n = e) {
203
+ function O(e, t, n = e) {
204
204
  switch (t) {
205
205
  case "left": return 0;
206
206
  case "center": return Math.floor(e / 2);
@@ -208,14 +208,14 @@ function A(e, t, n = e) {
208
208
  default: return n;
209
209
  }
210
210
  }
211
- function j(e, t, n) {
211
+ function k(e, t, n) {
212
212
  let r = [], i, a, o = (e, t) => {
213
213
  let s = (e) => t.reduceRight((e, t) => {
214
214
  let n = t.cloneNode(!1);
215
215
  return n.appendChild(e), n;
216
216
  }, e);
217
217
  if (e.localName === "mstyle") for (let n of [...e.children]) o(n, [...t, e]);
218
- else if (k(e)) r.push(null);
218
+ else if (D(e)) r.push(null);
219
219
  else if (e.localName === "mn" && e.children.length === 0) {
220
220
  let t = [...(e.textContent ?? "").trim()];
221
221
  for (let a of t) {
@@ -224,28 +224,28 @@ function j(e, t, n) {
224
224
  t.textContent = a, r.push(s(t));
225
225
  }
226
226
  t.length && (a ??= r.length);
227
- } else he.has(e.localName) && e.textContent?.trim() === n.decimalPoint && (i ??= r.length), r.push(s(e));
227
+ } else ve.has(e.localName) && e.textContent?.trim() === n.decimalPoint && (i ??= r.length), r.push(s(e));
228
228
  };
229
229
  for (let t of e) o(t, []);
230
230
  return {
231
231
  kind: "digits",
232
232
  cells: r,
233
- anchor: A(r.length, n.stackAlign, i ?? a),
233
+ anchor: O(r.length, n.stackAlign, i ?? a),
234
234
  position: t
235
235
  };
236
236
  }
237
- function M(e) {
238
- return (e ?? "").toLowerCase().split(/\s+/).filter((e) => de.has(e));
237
+ function be(e) {
238
+ return (e ?? "").toLowerCase().split(/\s+/).filter((e) => fe.has(e));
239
239
  }
240
- function ve(e, t) {
241
- let n = [...e.children].filter((e) => !k(e));
242
- return n.length <= 1 ? n[0] ?? null : T(t.document, "mrow", n);
240
+ function xe(e, t) {
241
+ let n = [...e.children].filter((e) => !D(e));
242
+ return n.length <= 1 ? n[0] ?? null : S(t.document, "mrow", n);
243
243
  }
244
- function ye(e, t, n) {
245
- let r = D(e, "location") ?? "n", i = M(e.getAttribute("crossout")), a = [...e.children].map((e) => k(e) ? null : e.localName === "mscarry" ? {
246
- content: ve(e, n),
247
- location: D(e, "location") ?? r,
248
- crossout: e.hasAttribute("crossout") ? M(e.getAttribute("crossout")) : i
244
+ function Se(e, t, n) {
245
+ let r = T(e, "location") ?? "n", i = be(e.getAttribute("crossout")), a = [...e.children].map((e) => D(e) ? null : e.localName === "mscarry" ? {
246
+ content: xe(e, n),
247
+ location: T(e, "location") ?? r,
248
+ crossout: e.hasAttribute("crossout") ? be(e.getAttribute("crossout")) : i
249
249
  } : {
250
250
  content: e,
251
251
  location: r,
@@ -254,60 +254,60 @@ function ye(e, t, n) {
254
254
  return {
255
255
  kind: "carries",
256
256
  carries: a,
257
- anchor: A(a.length, n.stackAlign),
257
+ anchor: O(a.length, n.stackAlign),
258
258
  position: t,
259
- scale: me.test(o) ? o : "0.6"
259
+ scale: _e.test(o) ? o : "0.6"
260
260
  };
261
261
  }
262
- function N(e) {
263
- let t = D(e, "mslinethickness") ?? "medium", n = fe[t] ?? (w.test(t) ? t : "0.07em"), r = e.getAttribute("mathcolor")?.trim() ?? "";
264
- return `${n} solid ${pe.test(r) ? r : "currentColor"}`;
262
+ function Ce(e) {
263
+ let t = T(e, "mslinethickness") ?? "medium", n = pe[t] ?? (he.test(t) ? t : "0.07em"), r = e.getAttribute("mathcolor")?.trim() ?? "";
264
+ return `${n} solid ${ge.test(r) ? r : "currentColor"}`;
265
265
  }
266
- function be(e, t, n) {
267
- let r = Math.max(0, O(e, "length"));
266
+ function we(e, t, n) {
267
+ let r = Math.max(0, E(e, "length"));
268
268
  return {
269
269
  kind: "line",
270
270
  length: r,
271
- anchor: A(r, n.stackAlign),
271
+ anchor: O(r, n.stackAlign),
272
272
  position: t,
273
- border: N(e)
273
+ border: Ce(e)
274
274
  };
275
275
  }
276
- function P(e, t, n, r, i) {
276
+ function A(e, t, n, r, i) {
277
277
  e.forEach((e, a) => {
278
- let o = t + a * n + O(e, "position");
278
+ let o = t + a * n + E(e, "position");
279
279
  switch (e.localName) {
280
280
  case "msgroup":
281
- P([...e.children], o, O(e, "shift"), r, i);
281
+ A([...e.children], o, E(e, "shift"), r, i);
282
282
  break;
283
283
  case "msline":
284
- i.push(be(e, o, r));
284
+ i.push(we(e, o, r));
285
285
  break;
286
286
  case "mscarries":
287
- i.push(ye(e, o, r));
287
+ i.push(Se(e, o, r));
288
288
  break;
289
289
  case "msrow":
290
290
  case "mrow":
291
- i.push(j([...e.children], o, r));
291
+ i.push(k([...e.children], o, r));
292
292
  break;
293
- default: i.push(j([e], o, r));
293
+ default: i.push(k([e], o, r));
294
294
  }
295
295
  });
296
296
  }
297
- function F(e) {
297
+ function j(e) {
298
298
  return -e.anchor - e.position;
299
299
  }
300
- function xe(e) {
300
+ function Te(e) {
301
301
  return e.kind === "digits" ? e.cells.length : e.kind === "carries" ? e.carries.length : e.length;
302
302
  }
303
- function Se(e) {
304
- return F(e) + xe(e) - 1;
303
+ function Ee(e) {
304
+ return j(e) + Te(e) - 1;
305
305
  }
306
- function Ce(e, t, n, r) {
307
- let i = (e) => T(r.document, "mpadded", [t], {
306
+ function De(e, t, n, r) {
307
+ let i = (e) => S(r.document, "mpadded", [t], {
308
308
  width: "0",
309
309
  ...e ? { lspace: e } : {}
310
- }), a = (e, t) => T(r.document, e, t);
310
+ }), a = (e, t) => S(r.document, e, t);
311
311
  switch (n) {
312
312
  case "s": return a("munder", [e, i("-0.5width")]);
313
313
  case "ne": return a("msup", [e, i()]);
@@ -329,49 +329,49 @@ function Ce(e, t, n, r) {
329
329
  default: return a("mover", [e, i("-0.5width")]);
330
330
  }
331
331
  }
332
- function we(e, t, n) {
333
- let r = T(n.document, "menclose", [e], {
332
+ function Oe(e, t, n) {
333
+ let r = S(n.document, "menclose", [e], {
334
334
  notation: t.join(" "),
335
335
  "data-padding": "0.1em",
336
336
  "data-thickness": "0.067em"
337
337
  }), i = t.some((e) => e.endsWith("diagonalstrike")) ? .167 : t.includes("horizontalstrike") ? .1 : 0;
338
- return i ? T(n.document, "mpadded", [r], {
338
+ return i ? S(n.document, "mpadded", [r], {
339
339
  lspace: `-${i}em`,
340
340
  width: `-${2 * i}em`
341
341
  }) : r;
342
342
  }
343
- function Te(e, t, n, r, i) {
344
- let a = e && t.crossout.length ? we(e, t.crossout, i) : e;
343
+ function ke(e, t, n, r, i) {
344
+ let a = e && t.crossout.length ? Oe(e, t.crossout, i) : e;
345
345
  if (!t.content) return a;
346
- let o = T(i.document, "mstyle", [t.content], { scriptsizemultiplier: r });
347
- return Ce(a ?? _e(i), o, n, i);
346
+ let o = S(i.document, "mstyle", [t.content], { scriptsizemultiplier: r });
347
+ return De(a ?? w(i), o, n, i);
348
348
  }
349
- function Ee(e, t) {
350
- return e.carries[t - F(e)] ?? null;
349
+ function Ae(e, t) {
350
+ return e.carries[t - j(e)] ?? null;
351
351
  }
352
- function De(e, t, n, r) {
352
+ function je(e, t, n, r) {
353
353
  let i = e.content;
354
354
  n.forEach((e, a) => {
355
- let o = n.length - 1 - a, s = n[o], c = Ee(s, t), l = n.slice(0, o).some((e) => Ee(e, t));
355
+ let o = n.length - 1 - a, s = n[o], c = Ae(s, t), l = n.slice(0, o).some((e) => Ae(e, t));
356
356
  if (!c && !l) return;
357
357
  let u = c ?? {
358
- content: _e(r),
358
+ content: w(r),
359
359
  location: "n",
360
360
  crossout: []
361
361
  }, d = a === 0 ? u.location : "n";
362
- i = Te(i, u, d, s.scale, r);
362
+ i = ke(i, u, d, s.scale, r);
363
363
  }), e.content = i;
364
364
  }
365
- function Oe(e, t) {
366
- let n = e.filter((e) => xe(e) > 0), r = Math.min(0, ...n.map(F)), i = Math.max(r, ...n.map(Se)) - r + 1, a = -r, o = [], s = /* @__PURE__ */ new Map(), c = () => Array.from({ length: i }, () => ({
365
+ function Me(e, t) {
366
+ let n = e.filter((e) => Te(e) > 0), r = Math.min(0, ...n.map(j)), i = Math.max(r, ...n.map(Ee)) - r + 1, a = -r, o = [], s = /* @__PURE__ */ new Map(), c = () => Array.from({ length: i }, () => ({
367
367
  content: null,
368
368
  borders: {}
369
- })), l = (e) => e.length === 0 ? Array.from({ length: i }, (e, t) => t) : Array.from({ length: e.length }, (t, n) => a + F(e) + n), u = [], d = [], f = (e) => {
369
+ })), l = (e) => e.length === 0 ? Array.from({ length: i }, (e, t) => t) : Array.from({ length: e.length }, (t, n) => a + j(e) + n), u = [], d = [], f = (e) => {
370
370
  let n = c();
371
371
  e.cells.forEach((t, r) => {
372
- n[a + F(e) + r].content = t;
372
+ n[a + j(e) + r].content = t;
373
373
  }), u.length && n.forEach((e, n) => {
374
- De(e, n - a, u, t);
374
+ je(e, n - a, u, t);
375
375
  });
376
376
  for (let e of d) for (let t of l(e)) n[t].borders.top = e.border;
377
377
  u = [], d = [], s.set(e, o.length), o.push(n);
@@ -391,44 +391,44 @@ function Oe(e, t) {
391
391
  origin: a
392
392
  };
393
393
  }
394
- function ke(e, { rows: t }, n) {
395
- let r = T(n.document, "mtable", t.map((e) => T(n.document, "mtr", e.map((e) => {
394
+ function M(e, { rows: t }, n) {
395
+ let r = S(n.document, "mtable", t.map((e) => S(n.document, "mtr", e.map((e) => {
396
396
  let t = Object.entries(e.borders).map(([e, t]) => `border-${e}:${t}`).join(";");
397
- return T(n.document, "mtd", [e.content], {
397
+ return S(n.document, "mtd", [e.content], {
398
398
  ...t ? { style: t } : {},
399
399
  ...e.align ? { columnalign: e.align } : {}
400
400
  });
401
401
  }))));
402
- for (let { name: t, value: n } of [...e.attributes]) ge.has(t) || r.setAttribute(t, n);
403
- let i = D(e, "charspacing") ?? "medium", a = D(e, "charalign");
404
- return r.setAttribute("columnspacing", C[i] ?? (w.test(i) ? i : C.medium)), r.setAttribute("columnalign", a === "left" || a === "center" ? a : "right"), r.setAttribute("rowspacing", "0"), r.setAttribute("align", e.getAttribute("align") ?? "baseline"), r;
402
+ for (let { name: t, value: n } of [...e.attributes]) ye.has(t) || r.setAttribute(t, n);
403
+ let i = T(e, "charspacing") ?? "medium", a = T(e, "charalign");
404
+ 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;
405
405
  }
406
- function Ae(e) {
406
+ function N(e) {
407
407
  return {
408
408
  document: e.ownerDocument,
409
- stackAlign: D(e, "stackalign") ?? "decimalpoint",
409
+ stackAlign: T(e, "stackalign") ?? "decimalpoint",
410
410
  decimalPoint: e.closest("[decimalpoint]")?.getAttribute("decimalpoint")?.trim().charAt(0) || "."
411
411
  };
412
412
  }
413
- function je(e) {
414
- let t = Ae(e), n = [];
415
- return P([...e.children], 0, 0, t, n), ke(e, Oe(n, t), t);
413
+ function Ne(e) {
414
+ let t = N(e), n = [];
415
+ return A([...e.children], 0, 0, t, n), M(e, Me(n, t), t);
416
416
  }
417
- function I(e, t, n, r, i, a) {
417
+ function P(e, t, n, r, i, a) {
418
418
  for (let o = n; o <= r; o++) e[t][o].borders[i] = a;
419
419
  }
420
- function Me(e, t) {
421
- let n = E(t, ")");
422
- return n.setAttribute("minsize", "1.2em"), [T(t.document, "mrow", [e, T(t.document, "mspace", [], { width: "0.2em" })]), T(t.document, "mpadded", [n], {
420
+ function Pe(e, t) {
421
+ let n = C(t, ")");
422
+ return n.setAttribute("minsize", "1.2em"), [S(t.document, "mrow", [e, S(t.document, "mspace", [], { width: "0.2em" })]), S(t.document, "mpadded", [n], {
423
423
  voffset: "0.1em",
424
424
  lspace: "-0.15em",
425
425
  depth: "-0.2em",
426
426
  height: "-0.2em"
427
427
  })];
428
428
  }
429
- function Ne(e) {
430
- let t = Ae(e), [n, r, ...i] = [...e.children], a = n && !k(n) ? n : null, o = r && !k(r) ? r : null, s = D(e, "longdivstyle") ?? "lefttop", c = N(e), l = [];
431
- P(i, 0, 0, t, l);
429
+ function Fe(e) {
430
+ let t = N(e), [n, r, ...i] = [...e.children], a = n && !D(n) ? n : null, o = r && !D(r) ? r : null, s = T(e, "longdivstyle") ?? "lefttop", c = Ce(e), l = [];
431
+ A(i, 0, 0, t, l);
432
432
  let u = l.find((e) => e.kind === "digits");
433
433
  u || (u = {
434
434
  kind: "digits",
@@ -440,49 +440,49 @@ function Ne(e) {
440
440
  u.cells.unshift(...e), u.anchor += e.length;
441
441
  }, p = (...e) => {
442
442
  let n = e.flatMap((e) => e ? e.localName === "mrow" ? [...e.children] : [e] : []);
443
- u.cells.push(...j(n, 0, t).cells);
443
+ u.cells.push(...k(n, 0, t).cells);
444
444
  };
445
445
  switch (s) {
446
446
  case "left/\\right":
447
- f(a, E(t, "/")), p(E(t, "\\"), o);
447
+ f(a, C(t, "/")), p(C(t, "\\"), o);
448
448
  break;
449
449
  case "left)(right":
450
- f(a, E(t, ")")), p(E(t, "("), o);
450
+ f(a, C(t, ")")), p(C(t, "("), o);
451
451
  break;
452
452
  case ":right=right":
453
- p(E(t, ":"), a, E(t, "="), o);
453
+ p(C(t, ":"), a, C(t, "="), o);
454
454
  break;
455
455
  case "righttop":
456
456
  case "stackedleftlinetop":
457
- case "lefttop": o && P([o], 0, 0, t, d), l.splice(l.indexOf(u), 0, ...d), s === "righttop" ? p(a) : s === "stackedleftlinetop" ? f(a) : f(...Me(a, t));
457
+ case "lefttop": o && A([o], 0, 0, t, d), l.splice(l.indexOf(u), 0, ...d), s === "righttop" ? p(a) : s === "stackedleftlinetop" ? f(a) : f(...Pe(a, t));
458
458
  }
459
- let m = Oe(l, t), h = m.rows, g = m.rowOf.get(u) ?? 0, _ = (e) => m.origin + F(u) + e, v = Math.max(_(u.cells.length - 1), ...d.map((e) => m.origin + Se(e)));
459
+ let m = Me(l, t), h = m.rows, g = m.rowOf.get(u) ?? 0, _ = (e) => m.origin + j(u) + e, v = Math.max(_(u.cells.length - 1), ...d.map((e) => m.origin + Ee(e)));
460
460
  switch (s) {
461
461
  case "left/\\right":
462
462
  case "left)(right":
463
463
  case ":right=right": break;
464
464
  case "righttop": {
465
465
  let e = h[g][_(u.cells.length - 1)];
466
- e.borders.left = c, e.borders.bottom = c, I(h, g, _(0), _(u.cells.length - 1), "top", c);
466
+ e.borders.left = c, e.borders.bottom = c, P(h, g, _(0), _(u.cells.length - 1), "top", c);
467
467
  break;
468
468
  }
469
469
  case "stackedleftlinetop": {
470
470
  let e = h[g][_(0)];
471
- e.borders.right = c, e.borders.bottom = c, I(h, g, _(1), v, "top", c);
471
+ e.borders.right = c, e.borders.bottom = c, P(h, g, _(1), v, "top", c);
472
472
  break;
473
473
  }
474
474
  case "stackedrightright":
475
475
  case "mediumstackedrightright":
476
476
  case "shortstackedrightright":
477
477
  case "stackedleftleft":
478
- Pe(h, g, s, a, o, c, t);
478
+ Ie(h, g, s, a, o, c, t);
479
479
  break;
480
- default: I(h, g, _(1), v, "top", c);
480
+ default: P(h, g, _(1), v, "top", c);
481
481
  }
482
- return ke(e, m, t);
482
+ return M(e, m, t);
483
483
  }
484
- function Pe(e, t, n, r, i, a, o) {
485
- let s = n === "stackedleftleft", c = s ? "right" : "left", l = (e) => e && T(o.document, "mpadded", [e], {
484
+ function Ie(e, t, n, r, i, a, o) {
485
+ let s = n === "stackedleftleft", c = s ? "right" : "left", l = (e) => e && S(o.document, "mpadded", [e], {
486
486
  lspace: "0.2em",
487
487
  width: "+0.4em"
488
488
  });
@@ -501,77 +501,77 @@ function Pe(e, t, n, r, i, a, o) {
501
501
  }) : 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);
502
502
  });
503
503
  }
504
- function Fe(e) {
505
- for (let t of [...e.querySelectorAll("mstack, mlongdiv")]) t.closest("math") && !t.closest("mjx-container") && t.replaceWith(t.localName === "mstack" ? je(t) : Ne(t));
504
+ function Le(e) {
505
+ for (let t of [...e.querySelectorAll("mstack, mlongdiv")]) t.closest("math") && !t.closest("mjx-container") && t.replaceWith(t.localName === "mstack" ? Ne(t) : Fe(t));
506
506
  }
507
- var Ie = "PIE-MJX-explorer-styles", L = "var(--pie-text, black)", Le = "var(--pie-background, #ffffff)", Re = "var(--pie-border-dark, #66686A)", R = "var(--pie-focus-outline, var(--pie-button-focus-outline, var(--pie-focus-checked-border, #1565C0)))", z = `color-mix(in srgb, ${R} 15%, transparent)`, ze = `
507
+ var Re = "PIE-MJX-explorer-styles", F = "var(--pie-text, black)", ze = "var(--pie-background, #ffffff)", Be = "var(--pie-border-dark, #66686A)", I = "var(--pie-focus-outline, var(--pie-button-focus-outline, var(--pie-focus-checked-border, #1565C0)))", L = `color-mix(in srgb, ${I} 15%, transparent)`, Ve = `
508
508
  :root mjx-container [data-sre-highlight-1]:not([data-mjx-collapsed], rect) {
509
- color: ${L} !important;
510
- fill: ${L} !important;
509
+ color: ${F} !important;
510
+ fill: ${F} !important;
511
511
  }
512
512
  :root mjx-container:not([data-mjx-clone-container]) [data-sre-highlight-1]:not([data-sre-enclosed], rect) {
513
- background-color: ${z} !important;
513
+ background-color: ${L} !important;
514
514
  }
515
515
  :root mjx-container rect[data-sre-highlight-1]:not([data-sre-enclosed]) {
516
- fill: ${z} !important;
516
+ fill: ${L} !important;
517
517
  }
518
518
  :root mjx-container .mjx-selected {
519
- outline: 2px solid ${R} !important;
519
+ outline: 2px solid ${I} !important;
520
520
  }
521
521
  :root mjx-container [data-sre-highlight-2] {
522
- color: ${L} !important;
522
+ color: ${F} !important;
523
523
  background-color: transparent !important;
524
- fill: ${L} !important;
525
- outline: 2px dashed ${R} !important;
524
+ fill: ${F} !important;
525
+ outline: 2px dashed ${I} !important;
526
526
  }
527
527
  :root mjx-container rect[data-sre-highlight-2] {
528
528
  fill: transparent !important;
529
- stroke: ${R} !important;
529
+ stroke: ${I} !important;
530
530
  stroke-width: 2px !important;
531
531
  vector-effect: non-scaling-stroke;
532
532
  }
533
533
  :root .MJX_LiveRegion, :root .MJX_HoverRegion, :root .MJX_ToolTip {
534
- color: ${L} !important;
535
- background-color: ${Le} !important;
536
- border-color: ${Re} !important;
534
+ color: ${F} !important;
535
+ background-color: ${ze} !important;
536
+ border-color: ${Be} !important;
537
537
  }
538
538
  :root .MJX_LiveRegion > div, :root .MJX_HoverRegion > div {
539
- color: ${L} !important;
540
- background-color: ${z} !important;
539
+ color: ${F} !important;
540
+ background-color: ${L} !important;
541
541
  }
542
542
  `;
543
- function Be(e = document) {
543
+ function He(e = document) {
544
544
  if (e.getElementById("PIE-MJX-explorer-styles")) return;
545
545
  let t = e.createElement("style");
546
- t.id = Ie, t.textContent = ze, e.head.appendChild(t);
546
+ t.id = Re, t.textContent = Ve, e.head.appendChild(t);
547
547
  }
548
- var Ve = /[⁡-⁤]/g, B = {
548
+ var Ue = /[⁡-⁤]/g, R = {
549
549
  "+": "positive",
550
550
  "-": "negative",
551
551
  "−": "negative",
552
552
  "±": "plus or minus",
553
553
  "∓": "minus or plus"
554
- }, He = {
554
+ }, We = {
555
555
  "(": "open parenthesis",
556
556
  "[": "open bracket",
557
557
  "{": "open brace",
558
558
  "⟨": "open angle bracket",
559
559
  "⌊": "open floor",
560
560
  "⌈": "open ceiling"
561
- }, V = {
561
+ }, z = {
562
562
  ")": "close parenthesis",
563
563
  "]": "close bracket",
564
564
  "}": "close brace",
565
565
  "⟩": "close angle bracket",
566
566
  "⌋": "close floor",
567
567
  "⌉": "close ceiling"
568
- }, H = {
568
+ }, B = {
569
569
  "!": "factorial",
570
570
  "%": "percent",
571
571
  "°": "degrees",
572
572
  "′": "prime",
573
573
  "″": "double prime"
574
- }, Ue = {
574
+ }, Ge = {
575
575
  "+": "plus",
576
576
  "-": "minus",
577
577
  "−": "minus",
@@ -615,16 +615,16 @@ var Ve = /[⁡-⁤]/g, B = {
615
615
  ":": "colon",
616
616
  "|": "vertical bar",
617
617
  "‖": "double vertical bar",
618
- ...He,
619
- ...V,
620
- ...H
621
- }, We = /* @__PURE__ */ new Set(["|", "‖"]), Ge = /* @__PURE__ */ new Set([
618
+ ...We,
619
+ ...z,
620
+ ...B
621
+ }, Ke = /* @__PURE__ */ new Set(["|", "‖"]), qe = /* @__PURE__ */ new Set([
622
622
  "∑",
623
623
  "∏",
624
624
  "∫",
625
625
  "∪",
626
626
  "∩"
627
- ]), Ke = {
627
+ ]), Je = {
628
628
  α: "alpha",
629
629
  β: "beta",
630
630
  γ: "gamma",
@@ -651,7 +651,7 @@ var Ve = /[⁡-⁤]/g, B = {
651
651
  cot: "cotangent",
652
652
  ln: "natural log",
653
653
  lim: "limit"
654
- }, qe = {
654
+ }, Ye = {
655
655
  "¯": "bar",
656
656
  "‾": "bar",
657
657
  "―": "bar",
@@ -662,137 +662,137 @@ var Ve = /[⁡-⁤]/g, B = {
662
662
  "→": "vector",
663
663
  "⃗": "vector",
664
664
  "˙": "dot"
665
- }, U = (e) => (e.textContent ?? "").replace(Ve, "").replace(/\s+/g, " ").trim(), W = (e) => e.replace(/\s+/g, " ").trim(), G = (e) => [...e.children];
666
- function K(e) {
665
+ }, V = (e) => (e.textContent ?? "").replace(Ue, "").replace(/\s+/g, " ").trim(), H = (e) => e.replace(/\s+/g, " ").trim(), U = (e) => [...e.children];
666
+ function W(e) {
667
667
  return !e || [
668
668
  "mn",
669
669
  "mi",
670
670
  "mtext",
671
671
  "mo"
672
- ].includes(e.localName) ? !0 : ["mrow", "mstyle"].includes(e.localName) && e.children.length === 1 ? K(e.children[0]) : !1;
672
+ ].includes(e.localName) ? !0 : ["mrow", "mstyle"].includes(e.localName) && e.children.length === 1 ? W(e.children[0]) : !1;
673
673
  }
674
- function Je(e) {
675
- let t = e ? U(e) : "";
674
+ function Xe(e) {
675
+ let t = e ? V(e) : "";
676
676
  return /^\d{1,3}$/.test(t) ? Number(t) : void 0;
677
677
  }
678
- function Ye(e) {
678
+ function Ze(e) {
679
679
  return `${e}${e % 100 >= 11 && e % 100 <= 13 ? "th" : {
680
680
  1: "st",
681
681
  2: "nd",
682
682
  3: "rd"
683
683
  }[e % 10] ?? "th"}`;
684
684
  }
685
- function Xe(e) {
686
- return Ke[e] ?? e;
685
+ function Qe(e) {
686
+ return Je[e] ?? e;
687
687
  }
688
- function q(e) {
689
- return Ue[e] ?? e;
688
+ function G(e) {
689
+ return Ge[e] ?? e;
690
690
  }
691
- function J(e) {
691
+ function K(e) {
692
692
  let t = [], n = !1;
693
693
  for (let r of e) {
694
694
  if (r.localName !== "mo") {
695
- t.push(Y(r)), n = !0;
695
+ t.push(J(r)), n = !0;
696
696
  continue;
697
697
  }
698
- let e = U(r);
699
- e && (!n && B[e] ? t.push(B[e]) : e in H ? t.push(H[e]) : (t.push(q(e)), n = e in V || We.has(e) && n));
698
+ let e = V(r);
699
+ e && (!n && R[e] ? t.push(R[e]) : e in B ? t.push(B[e]) : (t.push(G(e)), n = e in z || Ke.has(e) && n));
700
700
  }
701
701
  return t.filter(Boolean).join(" ");
702
702
  }
703
- function Ze(e) {
704
- let [t, ...n] = e, r = n[n.length - 1], i = (e) => e?.localName === "mo" && ["|", "‖"].includes(U(e)), a = n.slice(0, -1);
705
- if (a.length && i(t) && i(r) && U(t) === U(r) && !a.some(i)) {
706
- let e = W(J(a));
707
- return U(t) === "|" ? `absolute value of ${e} end absolute value` : `norm of ${e} end norm`;
703
+ function $e(e) {
704
+ let [t, ...n] = e, r = n[n.length - 1], i = (e) => e?.localName === "mo" && ["|", "‖"].includes(V(e)), a = n.slice(0, -1);
705
+ if (a.length && i(t) && i(r) && V(t) === V(r) && !a.some(i)) {
706
+ let e = H(K(a));
707
+ return V(t) === "|" ? `absolute value of ${e} end absolute value` : `norm of ${e} end norm`;
708
708
  }
709
- return J(e);
709
+ return K(e);
710
710
  }
711
- function Qe(e, t) {
712
- let n = e ? Y(e) : "", r = t ? Y(t) : "";
713
- return K(e) && K(t) ? `${n} over ${r}` : `the fraction with numerator ${n} and denominator ${r}`;
711
+ function et(e, t) {
712
+ let n = e ? J(e) : "", r = t ? J(t) : "";
713
+ return W(e) && W(t) ? `${n} over ${r}` : `the fraction with numerator ${n} and denominator ${r}`;
714
714
  }
715
- function $e(e, t, n) {
715
+ function tt(e, t, n) {
716
716
  return n ? `${t} of ${e}` : `${t} of ${e} end root`;
717
717
  }
718
- function et(e, t) {
719
- let n = t ? U(t) : "";
720
- if (t && K(t)) {
718
+ function nt(e, t) {
719
+ let n = t ? V(t) : "";
720
+ if (t && W(t)) {
721
721
  if (n === "2") return `${e} squared`;
722
722
  if (n === "3") return `${e} cubed`;
723
- if (n in H) return `${e} ${H[n]}`;
723
+ if (n in B) return `${e} ${B[n]}`;
724
724
  }
725
- let r = t ? Y(t) : "";
726
- return K(t) ? `${e} to the power of ${r}` : `${e} to the power of ${r} end power`;
727
- }
728
- function tt(e, t) {
729
- let n = t ? Y(t) : "";
730
- return K(t) ? `${e} sub ${n}` : `${e} sub ${n} end sub`;
731
- }
732
- function nt(e, t, n) {
733
- let r = U(e);
734
- if (r === "lim") return `limit as ${t ? Y(t) : ""} of`;
735
- if (!Ge.has(r)) return;
736
- let i = t ? `from ${Y(t)}` : "", a = n ? `to ${Y(n)}` : "";
737
- return `${q(r)} ${i} ${a} of`;
738
- }
739
- function rt(e) {
740
- let t = G(e).filter((e) => ["mtr", "mlabeledtr"].includes(e.localName)), n = t.map((e) => G(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) => W(J(G(e)))).join(", ")}`);
741
- return `table with ${t.length} ${t.length === 1 ? "row" : "rows"} and ${r} ${r === 1 ? "column" : "columns"}. ${i.join(". ")}`;
725
+ let r = t ? J(t) : "";
726
+ return W(t) ? `${e} to the power of ${r}` : `${e} to the power of ${r} end power`;
727
+ }
728
+ function q(e, t) {
729
+ let n = t ? J(t) : "";
730
+ return W(t) ? `${e} sub ${n}` : `${e} sub ${n} end sub`;
731
+ }
732
+ function rt(e, t, n) {
733
+ let r = V(e);
734
+ if (r === "lim") return `limit as ${t ? J(t) : ""} of`;
735
+ if (!qe.has(r)) return;
736
+ let i = t ? `from ${J(t)}` : "", a = n ? `to ${J(n)}` : "";
737
+ return `${G(r)} ${i} ${a} of`;
742
738
  }
743
739
  function it(e) {
744
- let t = e.getAttribute("open") ?? "(", n = e.getAttribute("close") ?? ")", r = (e.getAttribute("separators") ?? ",").replace(/\s+/g, "").split(""), i = G(e).map((e, t, n) => t < n.length - 1 ? `${Y(e)} ${q(r[Math.min(t, r.length - 1)] ?? ",")}` : Y(e));
740
+ let t = U(e).filter((e) => ["mtr", "mlabeledtr"].includes(e.localName)), n = t.map((e) => U(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) => H(K(U(e)))).join(", ")}`);
741
+ return `table with ${t.length} ${t.length === 1 ? "row" : "rows"} and ${r} ${r === 1 ? "column" : "columns"}. ${i.join(". ")}`;
742
+ }
743
+ function at(e) {
744
+ let t = e.getAttribute("open") ?? "(", n = e.getAttribute("close") ?? ")", r = (e.getAttribute("separators") ?? ",").replace(/\s+/g, "").split(""), i = U(e).map((e, t, n) => t < n.length - 1 ? `${J(e)} ${G(r[Math.min(t, r.length - 1)] ?? ",")}` : J(e));
745
745
  return [
746
- q(t),
746
+ G(t),
747
747
  ...i,
748
- q(n)
748
+ G(n)
749
749
  ].filter(Boolean).join(" ");
750
750
  }
751
- function Y(e) {
752
- let t = G(e);
751
+ function J(e) {
752
+ let t = U(e);
753
753
  switch (e.localName) {
754
- case "mi": return Xe(U(e));
754
+ case "mi": return Qe(V(e));
755
755
  case "mn":
756
756
  case "mtext":
757
- case "ms": return U(e);
758
- case "mo": return q(U(e));
757
+ case "ms": return V(e);
758
+ case "mo": return G(V(e));
759
759
  case "mspace":
760
760
  case "mphantom":
761
761
  case "annotation":
762
762
  case "annotation-xml": return "";
763
- case "semantics": return t[0] ? Y(t[0]) : "";
764
- case "mfrac": return Qe(t[0], t[1]);
765
- case "msqrt": return $e(W(J(t)), "square root", t.length === 1 && K(t[0]));
763
+ case "semantics": return t[0] ? J(t[0]) : "";
764
+ case "mfrac": return et(t[0], t[1]);
765
+ case "msqrt": return tt(H(K(t)), "square root", t.length === 1 && W(t[0]));
766
766
  case "mroot": {
767
- let e = Je(t[1]), n = e === 2 ? "square root" : e === 3 ? "cube root" : e ? `${Ye(e)} root` : `root with index ${t[1] ? Y(t[1]) : ""}`;
768
- return $e(t[0] ? Y(t[0]) : "", n, K(t[0]));
767
+ let e = Xe(t[1]), n = e === 2 ? "square root" : e === 3 ? "cube root" : e ? `${Ze(e)} root` : `root with index ${t[1] ? J(t[1]) : ""}`;
768
+ return tt(t[0] ? J(t[0]) : "", n, W(t[0]));
769
769
  }
770
- case "msup": return et(t[0] ? Y(t[0]) : "", t[1]);
771
- case "msub": return tt(t[0] ? Y(t[0]) : "", t[1]);
772
- case "msubsup": return (t[0] ? nt(t[0], t[1], t[2]) : void 0) || et(tt(t[0] ? Y(t[0]) : "", t[1]), t[2]);
770
+ case "msup": return nt(t[0] ? J(t[0]) : "", t[1]);
771
+ case "msub": return q(t[0] ? J(t[0]) : "", t[1]);
772
+ case "msubsup": return (t[0] ? rt(t[0], t[1], t[2]) : void 0) || nt(q(t[0] ? J(t[0]) : "", t[1]), t[2]);
773
773
  case "munder":
774
774
  case "mover":
775
775
  case "munderover": {
776
- 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 ? nt(n, a, o) : void 0;
776
+ 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 ? rt(n, a, o) : void 0;
777
777
  if (s) return s;
778
- let c = n ? Y(n) : "", l = e.localName === "mover" && r ? qe[U(r)] : void 0;
778
+ let c = n ? J(n) : "", l = e.localName === "mover" && r ? Ye[V(r)] : void 0;
779
779
  return l ? l === "vector" ? `vector ${c}` : `${c} ${l}` : [
780
780
  c,
781
- a ? `with ${Y(a)} below` : "",
782
- o ? `with ${Y(o)} above` : ""
781
+ a ? `with ${J(a)} below` : "",
782
+ o ? `with ${J(o)} above` : ""
783
783
  ].filter(Boolean).join(" ");
784
784
  }
785
- case "mfenced": return it(e);
786
- case "mtable": return rt(e);
785
+ case "mfenced": return at(e);
786
+ case "mtable": return it(e);
787
787
  case "mrow":
788
- case "math": return Ze(t);
789
- default: return t.length ? J(t) : U(e);
788
+ case "math": return $e(t);
789
+ default: return t.length ? K(t) : V(e);
790
790
  }
791
791
  }
792
- function at(e) {
793
- return W(Y(e));
792
+ function ot(e) {
793
+ return H(J(e));
794
794
  }
795
- var ot = [
795
+ var st = [
796
796
  "a[href]",
797
797
  "button",
798
798
  "label",
@@ -811,42 +811,42 @@ var ot = [
811
811
  "tab",
812
812
  "treeitem"
813
813
  ].map((e) => `[role="${e}"]`)
814
- ].join(", "), X = "data-pie-math-name";
815
- function st(e) {
814
+ ].join(", "), Y = "data-pie-math-name";
815
+ function ct(e) {
816
816
  if (e.localName !== "label") return e;
817
817
  let t = e;
818
818
  if (t.control) return t.control;
819
819
  let n = t.getAttribute("for"), r = t.getRootNode();
820
820
  return (n ? r.getElementById?.(n) : null) ?? t.querySelector("input, select, textarea, button");
821
821
  }
822
- function ct(e, t) {
822
+ function lt(e, t) {
823
823
  let n = e.getRootNode();
824
824
  return "getElementById" in n && typeof n.getElementById == "function" ? n.getElementById(t) : n instanceof Element ? (n.id === t ? n : null) ?? n.querySelector(`[id="${CSS.escape(t)}"]`) : null;
825
825
  }
826
- function lt(e, t) {
827
- let n = st(e)?.getAttribute("aria-labelledby")?.split(/\s+/).filter(Boolean);
826
+ function ut(e, t) {
827
+ let n = ct(e)?.getAttribute("aria-labelledby")?.split(/\s+/).filter(Boolean);
828
828
  if (!n?.length) return !1;
829
- let r = n.map((e) => ct(t, e)).filter((e) => e !== null);
829
+ let r = n.map((e) => lt(t, e)).filter((e) => e !== null);
830
830
  return r.length > 0 && !r.some((e) => e.contains(t));
831
831
  }
832
- function ut(e) {
833
- let t = e.getAttribute(X);
834
- t !== null && (e.getAttribute("aria-label") === t && e.removeAttribute("aria-label"), e.removeAttribute(X));
835
- }
836
832
  function dt(e) {
837
- if (e.hasAttribute("aria-label") && !e.hasAttribute(X)) return;
838
- let t = e.closest(ot);
833
+ let t = e.getAttribute(Y);
834
+ t !== null && (e.getAttribute("aria-label") === t && e.removeAttribute("aria-label"), e.removeAttribute(Y));
835
+ }
836
+ function ft(e) {
837
+ if (e.hasAttribute("aria-label") && !e.hasAttribute(Y)) return;
838
+ let t = e.closest(st);
839
839
  if (!t) return;
840
- if (lt(t, e)) {
841
- ut(e);
840
+ if (ut(t, e)) {
841
+ dt(e);
842
842
  return;
843
843
  }
844
844
  if (e.hasAttribute("aria-label")) return;
845
- let n = e.querySelector("math"), r = n ? at(n) : "";
846
- r && (e.setAttribute("aria-label", r), e.setAttribute(X, r));
845
+ let n = e.querySelector("math"), r = n ? ot(n) : "";
846
+ r && (e.setAttribute("aria-label", r), e.setAttribute(Y, r));
847
847
  }
848
- function ft(e) {
849
- for (let t of e.querySelectorAll("mjx-container")) dt(t);
848
+ function X(e) {
849
+ for (let t of e.querySelectorAll("mjx-container")) ft(t);
850
850
  }
851
851
  var pt = Symbol.for("@pie-element/shared-math-rendering-mathjax/speech-worker-failed");
852
852
  function mt() {
@@ -902,7 +902,7 @@ function Pt(e, t) {
902
902
  }
903
903
  function Ft(e) {
904
904
  for (let t of e.querySelectorAll("[data-latex]")) {
905
- if (t.dataset.mathHandled || t.closest("mjx-container") || Pt(t, e)) continue;
905
+ if (t.dataset.mathHandled || t.closest("mjx-container") || t.closest("math") || Pt(t, e)) continue;
906
906
  let n = t.textContent;
907
907
  n && (t.textContent = Ct(n), t.dataset.mathHandled = "true");
908
908
  }
@@ -921,15 +921,15 @@ function Rt(e) {
921
921
  load: i ? ["a11y/assistive-mml"] : [],
922
922
  failed: (e) => n(e),
923
923
  "output/svg": { ready: (e) => {
924
- let t = y();
925
- return zt(t) && $(t), e;
924
+ let t = b();
925
+ return zt(t) && Bt(t), e;
926
926
  } }
927
927
  },
928
928
  startup: {
929
929
  typeset: !1,
930
930
  ready: () => {
931
- let e = y(), r = e?.startup, i = zt(e);
932
- i && ($(e), Bt(e, c.speechLocales), f(e?._?.a11y?.sre_ts?.locales, c.speechLocales)), r?.defaultReady?.(), i && (Vt(r?.document), Ht(r?.document), r?.document?.addStyles?.(At), gt(r?.document)), Promise.resolve(r?.promise).then(() => t(), n);
931
+ let e = b(), r = e?.startup, i = zt(e);
932
+ i && (Bt(e), Vt(e, c.speechLocales), f(e?._?.a11y?.sre_ts?.locales, c.speechLocales)), r?.defaultReady?.(), i && (Ht(r?.document), Ut(r?.document), r?.document?.addStyles?.(At), gt(r?.document)), Promise.resolve(r?.promise).then(() => t(), n);
933
933
  }
934
934
  },
935
935
  tex: { macros: { ..._t } },
@@ -946,7 +946,7 @@ function Rt(e) {
946
946
  };
947
947
  r && u.tex && (console.warn(Et), u.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], u.tex.processEscapes = !0), a || (u.chtml = { fontURL: "" });
948
948
  let m = p(c.speechLocales);
949
- m && u.options && (u.options.sre = { locale: m }), ie(u, {
949
+ m && u.options && (u.options.sre = { locale: m }), re(u, {
950
950
  ...c,
951
951
  srcUrl: o
952
952
  }).then((e) => {
@@ -957,13 +957,13 @@ function Rt(e) {
957
957
  function zt(e) {
958
958
  return !!e?.version?.startsWith("4.");
959
959
  }
960
- function $(e) {
960
+ function Bt(e) {
961
961
  let t = e?._?.output, n = t?.chtml_ts?.CHTML;
962
- n && (n.STYLESHEETID = b);
962
+ n && (n.STYLESHEETID = x);
963
963
  let r = t?.svg_ts?.SVG;
964
964
  r && (r.STYLESHEETID = kt);
965
965
  }
966
- function Bt(e, t) {
966
+ function Vt(e, t) {
967
967
  let n = e?._?.ui?.menu?.Menu?.Menu;
968
968
  if (n) {
969
969
  n.MENU_STORAGE = Z;
@@ -976,7 +976,7 @@ function Bt(e, t) {
976
976
  } catch {}
977
977
  }
978
978
  }
979
- function Vt(e) {
979
+ function Ht(e) {
980
980
  if (!e) return;
981
981
  let t = /* @__PURE__ */ new WeakSet(), n = (e) => {
982
982
  let n = e.typesetRoot;
@@ -990,41 +990,41 @@ function Vt(e) {
990
990
  return t && Q(t), !1;
991
991
  });
992
992
  let r = e.outputJax?.chtmlStyles;
993
- r?.id === Ot && (r.id = b), Gt();
993
+ r?.id === Ot && (r.id = x), Kt();
994
994
  }
995
- function Ht(e) {
995
+ function Ut(e) {
996
996
  let t = (e) => {
997
- e.typesetRoot && dt(e.typesetRoot);
997
+ e.typesetRoot && ft(e.typesetRoot);
998
998
  };
999
999
  e?.addRenderAction?.("pie-name-math", Nt, (e) => {
1000
1000
  for (let n of e.math ?? []) t(n);
1001
1001
  return !1;
1002
1002
  }, (e) => (t(e), !1));
1003
1003
  }
1004
- function Ut(e) {
1005
- return e instanceof HTMLStyleElement && oe.includes(e.id);
1006
- }
1007
1004
  function Wt(e) {
1008
- te("foreign-output-stylesheet", `another MathJax added <style id="${e.id}"> to <head>`);
1005
+ return e instanceof HTMLStyleElement && ae.includes(e.id);
1009
1006
  }
1010
- function Gt() {
1011
- let e = document.head, t = [...e.children].find(Ut);
1007
+ function Gt(e) {
1008
+ y("foreign-output-stylesheet", `another MathJax added <style id="${e.id}"> to <head>`);
1009
+ }
1010
+ function Kt() {
1011
+ let e = document.head, t = [...e.children].find(Wt);
1012
1012
  if (t) {
1013
- Wt(t);
1013
+ Gt(t);
1014
1014
  return;
1015
1015
  }
1016
1016
  let n = new MutationObserver((e) => {
1017
1017
  for (let t of e) {
1018
- let e = [...t.addedNodes].find(Ut);
1018
+ let e = [...t.addedNodes].find(Wt);
1019
1019
  if (e) {
1020
- Wt(e), n.disconnect();
1020
+ Gt(e), n.disconnect();
1021
1021
  return;
1022
1022
  }
1023
1023
  }
1024
1024
  });
1025
1025
  n.observe(e, { childList: !0 });
1026
1026
  }
1027
- function Kt(e) {
1027
+ function qt(e) {
1028
1028
  let t = e?.math;
1029
1029
  if (!t?.remove) return;
1030
1030
  let n = [...t].filter((e) => (e.state?.() ?? 0) >= jt && e.typesetRoot?.isConnected === !1);
@@ -1033,54 +1033,128 @@ function Kt(e) {
1033
1033
  t.remove(...n);
1034
1034
  }
1035
1035
  }
1036
- function qt(e) {
1036
+ function Jt(e) {
1037
1037
  return new Promise((t, n) => {
1038
1038
  let r = e.startup ?? {};
1039
1039
  e.startup = r;
1040
1040
  let i = r.ready;
1041
1041
  r.ready = () => {
1042
- let e = y()?.startup;
1042
+ let e = b()?.startup;
1043
1043
  i ? i.call(r) : e?.defaultReady?.(), Promise.resolve(e?.promise).then(() => t(), n);
1044
1044
  };
1045
1045
  });
1046
1046
  }
1047
- function Jt(e) {
1048
- let t = y();
1049
- return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : qt(t) : Rt(e);
1050
- }
1051
1047
  function Yt(e) {
1052
- return Jt(e).then(() => {
1053
- let e = y();
1048
+ let t = b();
1049
+ return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : Jt(t) : Rt(e);
1050
+ }
1051
+ function Xt(e) {
1052
+ return Yt(e).then(() => {
1053
+ let e = b();
1054
1054
  e && typeof e.typesetPromise != "function" && console.warn("[mathjax-renderer] MathJax on this page has no typesetPromise; math stays untypeset.");
1055
1055
  });
1056
1056
  }
1057
- function Xt(e) {
1058
- let t = ae, n = t[Dt];
1059
- return n || (n = Yt(e), t[Dt] = n), n;
1057
+ function Zt(e) {
1058
+ let t = ie, n = t[Dt];
1059
+ return n || (n = Xt(e), t[Dt] = n), n;
1060
1060
  }
1061
- function Zt(e = {}) {
1061
+ function Qt(e = {}) {
1062
1062
  let t = e.useSingleDollar ?? !1;
1063
1063
  return async (n) => {
1064
1064
  if (typeof window > "u") return;
1065
- let r = se();
1066
- r && te("mathjax-3-global", `window.MathJax is MathJax ${r}`), Ft(n), ue(n), It(n), Fe(n);
1067
- let i = Xt(e);
1065
+ let r = oe();
1066
+ r && y("mathjax-3-global", `window.MathJax is MathJax ${r}`), Ft(n), ue(n), It(n), Le(n);
1067
+ let i = Zt(e);
1068
1068
  if (!Lt(n, t)) {
1069
- i.catch(() => {}), ft(n);
1069
+ i.catch(() => {}), X(n);
1070
1070
  return;
1071
1071
  }
1072
1072
  await i;
1073
- let a = y();
1073
+ let a = b();
1074
1074
  if (await a?.startup?.promise, typeof a?.typesetPromise == "function") {
1075
- Be(), Kt(a.startup?.document);
1075
+ He(), qt(a.startup?.document);
1076
1076
  try {
1077
1077
  await a.typesetPromise([n]);
1078
1078
  } catch (e) {
1079
1079
  throw a.typesetClear?.([n]), e;
1080
1080
  }
1081
- Q(n), ft(n);
1081
+ Q(n), X(n);
1082
1082
  }
1083
1083
  };
1084
1084
  }
1085
+ var $t = "@pie-lib/math-rendering", en = "@pie-lib/math-rendering@2", tn = "pie-print", nn = 50, rn = 1e4, an = null;
1086
+ function on() {
1087
+ return !!window[en]?.opts?.useSingleDollar;
1088
+ }
1089
+ function sn() {
1090
+ return an ||= Qt({ useSingleDollar: on() }), an;
1091
+ }
1092
+ function $() {
1093
+ if (typeof window > "u") return null;
1094
+ let e = window[$t];
1095
+ return typeof e?.renderMath == "function" && e.renderMath !== dn ? e : null;
1096
+ }
1097
+ function cn(e) {
1098
+ let t = e;
1099
+ for (; t;) {
1100
+ if (t instanceof Element && t.localName === tn) return t;
1101
+ t = t instanceof ShadowRoot ? t.host : t.parentNode;
1102
+ }
1103
+ return null;
1104
+ }
1105
+ function ln() {
1106
+ let e = window.renderMath;
1107
+ return typeof e == "function" ? e : null;
1108
+ }
1109
+ async function un(e) {
1110
+ let t = cn(e);
1111
+ if (!t) return null;
1112
+ let n = ln();
1113
+ if (n || t.mathRenderingModuleUrlImported !== !0) return n;
1114
+ let r = Date.now() + rn;
1115
+ for (; Date.now() < r;) {
1116
+ await new Promise((e) => setTimeout(e, nn));
1117
+ let e = ln();
1118
+ if (e) return e;
1119
+ }
1120
+ return null;
1121
+ }
1122
+ var dn = async (e) => {
1123
+ if (typeof window > "u") return;
1124
+ let t = typeof e == "string", n;
1125
+ t ? (n = document.createElement("div"), n.innerHTML = e) : n = e || document.body;
1126
+ let r = $(), i = r || t ? null : await un(n);
1127
+ return r ? (await r.renderMath?.(n), X(n)) : i && i !== dn ? (await i(n), X(n)) : await sn()(n), t ? n.innerHTML : void 0;
1128
+ }, fn = /\sdata-latex(?:-item)?="[^"]*"/g, pn = /<merror|<mtext[^>]*mathcolor="red"[^>]*>\\/;
1129
+ function mn(e, t) {
1130
+ let n = $()?.renderMath;
1131
+ if (typeof n != "function") return null;
1132
+ let [r, i] = t.display ? ["\\[", "\\]"] : ["\\(", "\\)"], a = `<span data-latex="" data-raw="${e.replace(/&/g, "&amp;").replace(/"/g, "&quot;")}">${r}${e}${i}</span>`;
1133
+ try {
1134
+ let e = n(a, { skipWaitForMathRenderingLib: !0 });
1135
+ if (typeof e?.then == "function") return e.catch(() => {}), null;
1136
+ let t = typeof e == "string" && e !== a ? e.replace(/\n\s*/g, "").replace(fn, "") : "";
1137
+ return t.startsWith("<math") && !pn.test(t) ? t : null;
1138
+ } catch {
1139
+ return null;
1140
+ }
1141
+ }
1142
+ var hn = (e, t = {}) => {
1143
+ let n = $()?.latexToMml;
1144
+ if (n && n !== hn) try {
1145
+ return n(e, t) ?? null;
1146
+ } catch {
1147
+ return null;
1148
+ }
1149
+ let r = b();
1150
+ if (!r?.tex2mml || !r.startup?.document) return mn(e, t);
1151
+ try {
1152
+ r.texReset?.();
1153
+ let n = r.tex2mml(e, { display: !!t.display })?.replace(/\n\s*/g, "").replace(fn, "");
1154
+ return n && !pn.test(n) ? n : null;
1155
+ } catch {
1156
+ return null;
1157
+ }
1158
+ };
1085
1159
  //#endregion
1086
- export { Zt as t };
1160
+ export { Qt as n, hn as t };