@pie-element/element-player 0.1.10-next.20261110080000 → 0.1.10

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 y(e, t) {
89
+ function te(e, t) {
90
90
  if (typeof window > "u") return;
91
91
  let n = globalThis;
92
92
  n[ee] ??= {
@@ -103,14 +103,14 @@ function y(e, t) {
103
103
  docsUrl: _
104
104
  } }));
105
105
  }
106
- function te() {
106
+ function ne() {
107
107
  let e = window.MathJax?.version;
108
108
  return typeof e == "string" && e.startsWith("3.") ? e : void 0;
109
109
  }
110
- function b() {
110
+ function y() {
111
111
  return window.MathJax;
112
112
  }
113
- function ne(t, { root: n, speechPath: r }) {
113
+ function re(t, { root: n, speechPath: r }) {
114
114
  n && (t.loader = {
115
115
  ...t.loader,
116
116
  paths: {
@@ -126,81 +126,81 @@ function ne(t, { root: n, speechPath: r }) {
126
126
  }
127
127
  });
128
128
  }
129
- function re(e, t) {
129
+ function ie(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 ? (ne(e, t), new Promise((t, r) => {
131
+ return n ? (re(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 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
- function ue(e) {
137
+ var ae = globalThis, b = "PIE-MJX-CHTML-styles", oe = ["MJX-CHTML-styles", "MJX-SVG-styles"], se = ne, ce = "http://www.w3.org/1998/Math/MathML", le = /^([a-z_][\w.-]*):math$/, ue = /^[a-z][a-z0-9-]*$/;
138
+ function de(e) {
139
139
  for (let t of e.querySelectorAll("*")) {
140
- let n = ce.exec(t.tagName.toLowerCase())?.[1];
141
- n && e.contains(t) && !t.closest("mjx-container") && t.replaceWith(de(t, `${n}:`));
140
+ let n = le.exec(t.tagName.toLowerCase())?.[1];
141
+ n && e.contains(t) && !t.closest("mjx-container") && t.replaceWith(fe(t, `${n}:`));
142
142
  }
143
143
  }
144
- function de(e, t) {
144
+ function fe(e, t) {
145
145
  let n = e.tagName.toLowerCase().slice(t.length);
146
- if (!le.test(n)) return e;
147
- let r = e.ownerDocument.createElementNS(se, n);
146
+ if (!ue.test(n)) return e;
147
+ let r = e.ownerDocument.createElementNS(ce, 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 ? de(n, t) : n);
151
+ r.appendChild(e ? fe(n, t) : n);
152
152
  }
153
153
  return r;
154
154
  }
155
- var fe = /* @__PURE__ */ new Set([
155
+ var pe = /* @__PURE__ */ new Set([
156
156
  "updiagonalstrike",
157
157
  "downdiagonalstrike",
158
158
  "verticalstrike",
159
159
  "horizontalstrike"
160
- ]), pe = {
160
+ ]), me = {
161
161
  thin: "0.035em",
162
162
  medium: "0.07em",
163
163
  thick: "0.14em"
164
- }, me = {
164
+ }, he = {
165
165
  tight: "0em",
166
166
  medium: "0.1em",
167
167
  loose: "0.2em"
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([
168
+ }, ge = /^(\d+(\.\d*)?|\.\d+)(em|ex|px|pt|pc|in|cm|mm)$/, _e = /^(#[0-9a-f]{3,8}|[a-z]+)$/i, ve = /^(\d+(\.\d*)?|\.\d+)$/, ye = /* @__PURE__ */ new Set([
169
169
  "mn",
170
170
  "mo",
171
171
  "mi",
172
172
  "mtext"
173
- ]), ye = /* @__PURE__ */ new Set([
173
+ ]), be = /* @__PURE__ */ new Set([
174
174
  "stackalign",
175
175
  "charalign",
176
176
  "charspacing",
177
177
  "longdivstyle"
178
178
  ]);
179
- function S(e, t, n = [], r = {}) {
180
- let i = e.createElementNS(se, t);
179
+ function x(e, t, n = [], r = {}) {
180
+ let i = e.createElementNS(ce, 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 C(e, t) {
186
- let n = S(e.document, "mo");
185
+ function S(e, t) {
186
+ let n = x(e.document, "mo");
187
187
  return n.textContent = t, n;
188
188
  }
189
- function w(e) {
190
- let t = S(e.document, "mn");
191
- return t.textContent = "0", S(e.document, "mphantom", [t]);
189
+ function xe(e) {
190
+ let t = x(e.document, "mn");
191
+ return t.textContent = "0", x(e.document, "mphantom", [t]);
192
192
  }
193
- function T(e, t) {
193
+ function C(e, t) {
194
194
  return e.getAttribute(t)?.trim().toLowerCase() || void 0;
195
195
  }
196
- function E(e, t) {
196
+ function w(e, t) {
197
197
  let n = Number.parseInt(e.getAttribute(t) ?? "", 10);
198
198
  return Number.isFinite(n) ? n : 0;
199
199
  }
200
- function D(e) {
200
+ function T(e) {
201
201
  return e.localName === "none" || e.localName === "mrow" && e.children.length === 0 && !e.textContent?.trim();
202
202
  }
203
- function O(e, t, n = e) {
203
+ function E(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 O(e, t, n = e) {
208
208
  default: return n;
209
209
  }
210
210
  }
211
- function k(e, t, n) {
211
+ function D(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 (D(e)) r.push(null);
218
+ else if (T(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 k(e, t, n) {
224
224
  t.textContent = a, r.push(s(t));
225
225
  }
226
226
  t.length && (a ??= r.length);
227
- } else ve.has(e.localName) && e.textContent?.trim() === n.decimalPoint && (i ??= r.length), r.push(s(e));
227
+ } else ye.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: O(r.length, n.stackAlign, i ?? a),
233
+ anchor: E(r.length, n.stackAlign, i ?? a),
234
234
  position: t
235
235
  };
236
236
  }
237
- function be(e) {
238
- return (e ?? "").toLowerCase().split(/\s+/).filter((e) => fe.has(e));
237
+ function O(e) {
238
+ return (e ?? "").toLowerCase().split(/\s+/).filter((e) => pe.has(e));
239
239
  }
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);
240
+ function Se(e, t) {
241
+ let n = [...e.children].filter((e) => !T(e));
242
+ return n.length <= 1 ? n[0] ?? null : x(t.document, "mrow", n);
243
243
  }
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
244
+ function Ce(e, t, n) {
245
+ let r = C(e, "location") ?? "n", i = O(e.getAttribute("crossout")), a = [...e.children].map((e) => T(e) ? null : e.localName === "mscarry" ? {
246
+ content: Se(e, n),
247
+ location: C(e, "location") ?? r,
248
+ crossout: e.hasAttribute("crossout") ? O(e.getAttribute("crossout")) : i
249
249
  } : {
250
250
  content: e,
251
251
  location: r,
@@ -254,60 +254,60 @@ function Se(e, t, n) {
254
254
  return {
255
255
  kind: "carries",
256
256
  carries: a,
257
- anchor: O(a.length, n.stackAlign),
257
+ anchor: E(a.length, n.stackAlign),
258
258
  position: t,
259
- scale: _e.test(o) ? o : "0.6"
259
+ scale: ve.test(o) ? o : "0.6"
260
260
  };
261
261
  }
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"}`;
262
+ function k(e) {
263
+ let t = C(e, "mslinethickness") ?? "medium", n = me[t] ?? (ge.test(t) ? t : "0.07em"), r = e.getAttribute("mathcolor")?.trim() ?? "";
264
+ return `${n} solid ${_e.test(r) ? r : "currentColor"}`;
265
265
  }
266
266
  function we(e, t, n) {
267
- let r = Math.max(0, E(e, "length"));
267
+ let r = Math.max(0, w(e, "length"));
268
268
  return {
269
269
  kind: "line",
270
270
  length: r,
271
- anchor: O(r, n.stackAlign),
271
+ anchor: E(r, n.stackAlign),
272
272
  position: t,
273
- border: Ce(e)
273
+ border: k(e)
274
274
  };
275
275
  }
276
276
  function A(e, t, n, r, i) {
277
277
  e.forEach((e, a) => {
278
- let o = t + a * n + E(e, "position");
278
+ let o = t + a * n + w(e, "position");
279
279
  switch (e.localName) {
280
280
  case "msgroup":
281
- A([...e.children], o, E(e, "shift"), r, i);
281
+ A([...e.children], o, w(e, "shift"), r, i);
282
282
  break;
283
283
  case "msline":
284
284
  i.push(we(e, o, r));
285
285
  break;
286
286
  case "mscarries":
287
- i.push(Se(e, o, r));
287
+ i.push(Ce(e, o, r));
288
288
  break;
289
289
  case "msrow":
290
290
  case "mrow":
291
- i.push(k([...e.children], o, r));
291
+ i.push(D([...e.children], o, r));
292
292
  break;
293
- default: i.push(k([e], o, r));
293
+ default: i.push(D([e], o, r));
294
294
  }
295
295
  });
296
296
  }
297
297
  function j(e) {
298
298
  return -e.anchor - e.position;
299
299
  }
300
- function Te(e) {
300
+ function M(e) {
301
301
  return e.kind === "digits" ? e.cells.length : e.kind === "carries" ? e.carries.length : e.length;
302
302
  }
303
- function Ee(e) {
304
- return j(e) + Te(e) - 1;
303
+ function N(e) {
304
+ return j(e) + M(e) - 1;
305
305
  }
306
- function De(e, t, n, r) {
307
- let i = (e) => S(r.document, "mpadded", [t], {
306
+ function Te(e, t, n, r) {
307
+ let i = (e) => x(r.document, "mpadded", [t], {
308
308
  width: "0",
309
309
  ...e ? { lspace: e } : {}
310
- }), a = (e, t) => S(r.document, e, t);
310
+ }), a = (e, t) => x(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,41 +329,41 @@ function De(e, t, n, r) {
329
329
  default: return a("mover", [e, i("-0.5width")]);
330
330
  }
331
331
  }
332
- function Oe(e, t, n) {
333
- let r = S(n.document, "menclose", [e], {
332
+ function Ee(e, t, n) {
333
+ let r = x(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 ? S(n.document, "mpadded", [r], {
338
+ return i ? x(n.document, "mpadded", [r], {
339
339
  lspace: `-${i}em`,
340
340
  width: `-${2 * i}em`
341
341
  }) : r;
342
342
  }
343
- function ke(e, t, n, r, i) {
344
- let a = e && t.crossout.length ? Oe(e, t.crossout, i) : e;
343
+ function De(e, t, n, r, i) {
344
+ let a = e && t.crossout.length ? Ee(e, t.crossout, i) : e;
345
345
  if (!t.content) return a;
346
- let o = S(i.document, "mstyle", [t.content], { scriptsizemultiplier: r });
347
- return De(a ?? w(i), o, n, i);
346
+ let o = x(i.document, "mstyle", [t.content], { scriptsizemultiplier: r });
347
+ return Te(a ?? xe(i), o, n, i);
348
348
  }
349
- function Ae(e, t) {
349
+ function P(e, t) {
350
350
  return e.carries[t - j(e)] ?? null;
351
351
  }
352
- function je(e, t, n, r) {
352
+ function Oe(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 = Ae(s, t), l = n.slice(0, o).some((e) => Ae(e, t));
355
+ let o = n.length - 1 - a, s = n[o], c = P(s, t), l = n.slice(0, o).some((e) => P(e, t));
356
356
  if (!c && !l) return;
357
357
  let u = c ?? {
358
- content: w(r),
358
+ content: xe(r),
359
359
  location: "n",
360
360
  crossout: []
361
361
  }, d = a === 0 ? u.location : "n";
362
- i = ke(i, u, d, s.scale, r);
362
+ i = De(i, u, d, s.scale, r);
363
363
  }), e.content = i;
364
364
  }
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 }, () => ({
365
+ function F(e, t) {
366
+ let n = e.filter((e) => M(e) > 0), r = Math.min(0, ...n.map(j)), i = Math.max(r, ...n.map(N)) - r + 1, a = -r, o = [], s = /* @__PURE__ */ new Map(), c = () => Array.from({ length: i }, () => ({
367
367
  content: null,
368
368
  borders: {}
369
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) => {
@@ -371,7 +371,7 @@ function Me(e, t) {
371
371
  e.cells.forEach((t, r) => {
372
372
  n[a + j(e) + r].content = t;
373
373
  }), u.length && n.forEach((e, n) => {
374
- je(e, n - a, u, t);
374
+ Oe(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,43 +391,43 @@ function Me(e, t) {
391
391
  origin: a
392
392
  };
393
393
  }
394
- function M(e, { rows: t }, n) {
395
- let r = S(n.document, "mtable", t.map((e) => S(n.document, "mtr", e.map((e) => {
394
+ function ke(e, { rows: t }, n) {
395
+ let r = x(n.document, "mtable", t.map((e) => x(n.document, "mtr", e.map((e) => {
396
396
  let t = Object.entries(e.borders).map(([e, t]) => `border-${e}:${t}`).join(";");
397
- return S(n.document, "mtd", [e.content], {
397
+ return x(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]) 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;
402
+ for (let { name: t, value: n } of [...e.attributes]) be.has(t) || r.setAttribute(t, n);
403
+ let i = C(e, "charspacing") ?? "medium", a = C(e, "charalign");
404
+ return r.setAttribute("columnspacing", he[i] ?? (ge.test(i) ? i : he.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 N(e) {
406
+ function Ae(e) {
407
407
  return {
408
408
  document: e.ownerDocument,
409
- stackAlign: T(e, "stackalign") ?? "decimalpoint",
409
+ stackAlign: C(e, "stackalign") ?? "decimalpoint",
410
410
  decimalPoint: e.closest("[decimalpoint]")?.getAttribute("decimalpoint")?.trim().charAt(0) || "."
411
411
  };
412
412
  }
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);
413
+ function je(e) {
414
+ let t = Ae(e), n = [];
415
+ return A([...e.children], 0, 0, t, n), ke(e, F(n, t), t);
416
416
  }
417
- function P(e, t, n, r, i, a) {
417
+ function I(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 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], {
420
+ function Me(e, t) {
421
+ let n = S(t, ")");
422
+ return n.setAttribute("minsize", "1.2em"), [x(t.document, "mrow", [e, x(t.document, "mspace", [], { width: "0.2em" })]), x(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 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 = [];
429
+ function Ne(e) {
430
+ let t = Ae(e), [n, r, ...i] = [...e.children], a = n && !T(n) ? n : null, o = r && !T(r) ? r : null, s = C(e, "longdivstyle") ?? "lefttop", c = k(e), l = [];
431
431
  A(i, 0, 0, t, l);
432
432
  let u = l.find((e) => e.kind === "digits");
433
433
  u || (u = {
@@ -440,49 +440,49 @@ function Fe(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(...k(n, 0, t).cells);
443
+ u.cells.push(...D(n, 0, t).cells);
444
444
  };
445
445
  switch (s) {
446
446
  case "left/\\right":
447
- f(a, C(t, "/")), p(C(t, "\\"), o);
447
+ f(a, S(t, "/")), p(S(t, "\\"), o);
448
448
  break;
449
449
  case "left)(right":
450
- f(a, C(t, ")")), p(C(t, "("), o);
450
+ f(a, S(t, ")")), p(S(t, "("), o);
451
451
  break;
452
452
  case ":right=right":
453
- p(C(t, ":"), a, C(t, "="), o);
453
+ p(S(t, ":"), a, S(t, "="), o);
454
454
  break;
455
455
  case "righttop":
456
456
  case "stackedleftlinetop":
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));
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(...Me(a, t));
458
458
  }
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)));
459
+ let m = F(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 + N(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, P(h, g, _(0), _(u.cells.length - 1), "top", c);
466
+ e.borders.left = c, e.borders.bottom = c, I(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, P(h, g, _(1), v, "top", c);
471
+ e.borders.right = c, e.borders.bottom = c, I(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
- Ie(h, g, s, a, o, c, t);
478
+ Pe(h, g, s, a, o, c, t);
479
479
  break;
480
- default: P(h, g, _(1), v, "top", c);
480
+ default: I(h, g, _(1), v, "top", c);
481
481
  }
482
- return M(e, m, t);
482
+ return ke(e, m, t);
483
483
  }
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], {
484
+ function Pe(e, t, n, r, i, a, o) {
485
+ let s = n === "stackedleftleft", c = s ? "right" : "left", l = (e) => e && x(o.document, "mpadded", [e], {
486
486
  lspace: "0.2em",
487
487
  width: "+0.4em"
488
488
  });
@@ -501,64 +501,64 @@ function Ie(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 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));
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));
506
506
  }
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 = `
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 = `
508
508
  :root mjx-container [data-sre-highlight-1]:not([data-mjx-collapsed], rect) {
509
- color: ${F} !important;
510
- fill: ${F} !important;
509
+ color: ${L} !important;
510
+ fill: ${L} !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: ${L} !important;
513
+ background-color: ${z} !important;
514
514
  }
515
515
  :root mjx-container rect[data-sre-highlight-1]:not([data-sre-enclosed]) {
516
- fill: ${L} !important;
516
+ fill: ${z} !important;
517
517
  }
518
518
  :root mjx-container .mjx-selected {
519
- outline: 2px solid ${I} !important;
519
+ outline: 2px solid ${R} !important;
520
520
  }
521
521
  :root mjx-container [data-sre-highlight-2] {
522
- color: ${F} !important;
522
+ color: ${L} !important;
523
523
  background-color: transparent !important;
524
- fill: ${F} !important;
525
- outline: 2px dashed ${I} !important;
524
+ fill: ${L} !important;
525
+ outline: 2px dashed ${R} !important;
526
526
  }
527
527
  :root mjx-container rect[data-sre-highlight-2] {
528
528
  fill: transparent !important;
529
- stroke: ${I} !important;
529
+ stroke: ${R} !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: ${F} !important;
535
- background-color: ${ze} !important;
536
- border-color: ${Be} !important;
534
+ color: ${L} !important;
535
+ background-color: ${Le} !important;
536
+ border-color: ${Re} !important;
537
537
  }
538
538
  :root .MJX_LiveRegion > div, :root .MJX_HoverRegion > div {
539
- color: ${F} !important;
540
- background-color: ${L} !important;
539
+ color: ${L} !important;
540
+ background-color: ${z} !important;
541
541
  }
542
542
  `;
543
- function He(e = document) {
543
+ function Be(e = document) {
544
544
  if (e.getElementById("PIE-MJX-explorer-styles")) return;
545
545
  let t = e.createElement("style");
546
- t.id = Re, t.textContent = Ve, e.head.appendChild(t);
546
+ t.id = Ie, t.textContent = ze, e.head.appendChild(t);
547
547
  }
548
- var Ue = /[⁡-⁤]/g, R = {
548
+ var Ve = /[⁡-⁤]/g, He = {
549
549
  "+": "positive",
550
550
  "-": "negative",
551
551
  "−": "negative",
552
552
  "±": "plus or minus",
553
553
  "∓": "minus or plus"
554
- }, We = {
554
+ }, Ue = {
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
- }, z = {
561
+ }, We = {
562
562
  ")": "close parenthesis",
563
563
  "]": "close bracket",
564
564
  "}": "close brace",
@@ -615,8 +615,8 @@ var Ue = /[⁡-⁤]/g, R = {
615
615
  ":": "colon",
616
616
  "|": "vertical bar",
617
617
  "‖": "double vertical bar",
618
+ ...Ue,
618
619
  ...We,
619
- ...z,
620
620
  ...B
621
621
  }, Ke = /* @__PURE__ */ new Set(["|", "‖"]), qe = /* @__PURE__ */ new Set([
622
622
  "∑",
@@ -662,7 +662,7 @@ var Ue = /[⁡-⁤]/g, R = {
662
662
  "→": "vector",
663
663
  "⃗": "vector",
664
664
  "˙": "dot"
665
- }, V = (e) => (e.textContent ?? "").replace(Ue, "").replace(/\s+/g, " ").trim(), H = (e) => e.replace(/\s+/g, " ").trim(), U = (e) => [...e.children];
665
+ }, V = (e) => (e.textContent ?? "").replace(Ve, "").replace(/\s+/g, " ").trim(), H = (e) => e.replace(/\s+/g, " ").trim(), U = (e) => [...e.children];
666
666
  function W(e) {
667
667
  return !e || [
668
668
  "mn",
@@ -692,11 +692,11 @@ 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(J(r)), n = !0;
695
+ t.push(q(r)), n = !0;
696
696
  continue;
697
697
  }
698
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));
699
+ e && (!n && He[e] ? t.push(He[e]) : e in B ? t.push(B[e]) : (t.push(G(e)), n = e in We || Ke.has(e) && n));
700
700
  }
701
701
  return t.filter(Boolean).join(" ");
702
702
  }
@@ -709,7 +709,7 @@ function $e(e) {
709
709
  return K(e);
710
710
  }
711
711
  function et(e, t) {
712
- let n = e ? J(e) : "", r = t ? J(t) : "";
712
+ let n = e ? q(e) : "", r = t ? q(t) : "";
713
713
  return W(e) && W(t) ? `${n} over ${r}` : `the fraction with numerator ${n} and denominator ${r}`;
714
714
  }
715
715
  function tt(e, t, n) {
@@ -722,33 +722,33 @@ function nt(e, t) {
722
722
  if (n === "3") return `${e} cubed`;
723
723
  if (n in B) return `${e} ${B[n]}`;
724
724
  }
725
- let r = t ? J(t) : "";
725
+ let r = t ? q(t) : "";
726
726
  return W(t) ? `${e} to the power of ${r}` : `${e} to the power of ${r} end power`;
727
727
  }
728
- function q(e, t) {
729
- let n = t ? J(t) : "";
728
+ function rt(e, t) {
729
+ let n = t ? q(t) : "";
730
730
  return W(t) ? `${e} sub ${n}` : `${e} sub ${n} end sub`;
731
731
  }
732
- function rt(e, t, n) {
732
+ function it(e, t, n) {
733
733
  let r = V(e);
734
- if (r === "lim") return `limit as ${t ? J(t) : ""} of`;
734
+ if (r === "lim") return `limit as ${t ? q(t) : ""} of`;
735
735
  if (!qe.has(r)) return;
736
- let i = t ? `from ${J(t)}` : "", a = n ? `to ${J(n)}` : "";
736
+ let i = t ? `from ${q(t)}` : "", a = n ? `to ${q(n)}` : "";
737
737
  return `${G(r)} ${i} ${a} of`;
738
738
  }
739
- function it(e) {
739
+ function at(e) {
740
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
741
  return `table with ${t.length} ${t.length === 1 ? "row" : "rows"} and ${r} ${r === 1 ? "column" : "columns"}. ${i.join(". ")}`;
742
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));
743
+ function ot(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 ? `${q(e)} ${G(r[Math.min(t, r.length - 1)] ?? ",")}` : q(e));
745
745
  return [
746
746
  G(t),
747
747
  ...i,
748
748
  G(n)
749
749
  ].filter(Boolean).join(" ");
750
750
  }
751
- function J(e) {
751
+ function q(e) {
752
752
  let t = U(e);
753
753
  switch (e.localName) {
754
754
  case "mi": return Qe(V(e));
@@ -760,39 +760,39 @@ function J(e) {
760
760
  case "mphantom":
761
761
  case "annotation":
762
762
  case "annotation-xml": return "";
763
- case "semantics": return t[0] ? J(t[0]) : "";
763
+ case "semantics": return t[0] ? q(t[0]) : "";
764
764
  case "mfrac": return et(t[0], t[1]);
765
765
  case "msqrt": return tt(H(K(t)), "square root", t.length === 1 && W(t[0]));
766
766
  case "mroot": {
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]));
767
+ let e = Xe(t[1]), n = e === 2 ? "square root" : e === 3 ? "cube root" : e ? `${Ze(e)} root` : `root with index ${t[1] ? q(t[1]) : ""}`;
768
+ return tt(t[0] ? q(t[0]) : "", n, W(t[0]));
769
769
  }
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]);
770
+ case "msup": return nt(t[0] ? q(t[0]) : "", t[1]);
771
+ case "msub": return rt(t[0] ? q(t[0]) : "", t[1]);
772
+ case "msubsup": return (t[0] ? it(t[0], t[1], t[2]) : void 0) || nt(rt(t[0] ? q(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 ? rt(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 ? it(n, a, o) : void 0;
777
777
  if (s) return s;
778
- let c = n ? J(n) : "", l = e.localName === "mover" && r ? Ye[V(r)] : void 0;
778
+ let c = n ? q(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 ${J(a)} below` : "",
782
- o ? `with ${J(o)} above` : ""
781
+ a ? `with ${q(a)} below` : "",
782
+ o ? `with ${q(o)} above` : ""
783
783
  ].filter(Boolean).join(" ");
784
784
  }
785
- case "mfenced": return at(e);
786
- case "mtable": return it(e);
785
+ case "mfenced": return ot(e);
786
+ case "mtable": return at(e);
787
787
  case "mrow":
788
788
  case "math": return $e(t);
789
789
  default: return t.length ? K(t) : V(e);
790
790
  }
791
791
  }
792
- function ot(e) {
793
- return H(J(e));
792
+ function st(e) {
793
+ return H(q(e));
794
794
  }
795
- var st = [
795
+ var ct = [
796
796
  "a[href]",
797
797
  "button",
798
798
  "label",
@@ -811,63 +811,85 @@ var st = [
811
811
  "tab",
812
812
  "treeitem"
813
813
  ].map((e) => `[role="${e}"]`)
814
- ].join(", "), Y = "data-pie-math-name";
815
- function ct(e) {
814
+ ].join(", "), J = "data-pie-math-name";
815
+ function lt(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 lt(e, t) {
822
+ function ut(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 ut(e, t) {
827
- let n = ct(e)?.getAttribute("aria-labelledby")?.split(/\s+/).filter(Boolean);
826
+ function dt(e, t) {
827
+ let n = lt(e)?.getAttribute("aria-labelledby")?.split(/\s+/).filter(Boolean);
828
828
  if (!n?.length) return !1;
829
- let r = n.map((e) => lt(t, e)).filter((e) => e !== null);
829
+ let r = n.map((e) => ut(t, e)).filter((e) => e !== null);
830
830
  return r.length > 0 && !r.some((e) => e.contains(t));
831
831
  }
832
- function dt(e) {
833
- let t = e.getAttribute(Y);
834
- t !== null && (e.getAttribute("aria-label") === t && e.removeAttribute("aria-label"), e.removeAttribute(Y));
835
- }
836
832
  function ft(e) {
837
- if (e.hasAttribute("aria-label") && !e.hasAttribute(Y)) return;
838
- let t = e.closest(st);
833
+ let t = e.getAttribute(J);
834
+ t !== null && (e.getAttribute("aria-label") === t && e.removeAttribute("aria-label"), e.removeAttribute(J));
835
+ }
836
+ function pt(e) {
837
+ if (e.hasAttribute("aria-label") && !e.hasAttribute(J)) return;
838
+ let t = e.closest(ct);
839
839
  if (!t) return;
840
- if (ut(t, e)) {
841
- dt(e);
840
+ if (dt(t, e)) {
841
+ ft(e);
842
842
  return;
843
843
  }
844
844
  if (e.hasAttribute("aria-label")) return;
845
- let n = e.querySelector("math"), r = n ? ot(n) : "";
846
- r && (e.setAttribute("aria-label", r), e.setAttribute(Y, r));
845
+ let n = e.querySelector("math"), r = n ? st(n) : "";
846
+ r && (e.setAttribute("aria-label", r), e.setAttribute(J, r));
847
847
  }
848
- function X(e) {
849
- for (let t of e.querySelectorAll("mjx-container")) ft(t);
848
+ function Y(e) {
849
+ for (let t of e.querySelectorAll("mjx-container")) pt(t);
850
850
  }
851
- var pt = Symbol.for("@pie-element/shared-math-rendering-mathjax/speech-worker-failed");
852
- function mt() {
851
+ var mt = Symbol.for("@pie-element/shared-math-rendering-mathjax/speech-worker-failed");
852
+ function ht() {
853
853
  let e = globalThis;
854
- e[pt] || (e[pt] = !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}`));
854
+ e[mt] || (e[mt] = !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}`));
855
855
  }
856
- function ht(e) {
856
+ function gt(e) {
857
857
  let t = e.webworker;
858
858
  if (!t || t.ready) return;
859
859
  e.options ??= {};
860
860
  let n = e.options;
861
- n.enableSpeech = !1, n.enableBraille = !1, n.speechError = () => {}, t.Post = () => Promise.reject(/* @__PURE__ */ Error("The speech worker did not start")), t.Terminate(), mt();
861
+ n.enableSpeech = !1, n.enableBraille = !1, n.speechError = () => {}, t.Post = () => Promise.reject(/* @__PURE__ */ Error("The speech worker did not start")), t.Terminate(), ht();
862
862
  }
863
- function gt(e) {
863
+ function _t(e, t) {
864
+ let n = () => {
865
+ for (let e of t) URL.revokeObjectURL(e);
866
+ };
867
+ e.addEventListener("message", n, { once: !0 }), e.addEventListener("error", n, { once: !0 }), setTimeout(n, 1e4);
868
+ }
869
+ async function vt(e, t, n, r) {
870
+ let i = [], a = URL.revokeObjectURL.bind(URL);
871
+ URL.revokeObjectURL = (e) => {
872
+ i.push(e);
873
+ };
874
+ let o;
875
+ try {
876
+ o = await e.call(t, n, r);
877
+ } catch (e) {
878
+ for (let e of i) a(e);
879
+ throw e;
880
+ } finally {
881
+ URL.revokeObjectURL = a;
882
+ }
883
+ return _t(o, i), o;
884
+ }
885
+ function yt(e) {
864
886
  let t = e?.adaptor, n = t?.createWorker;
865
887
  e && t && n && (t.createWorker = async (r, i) => {
866
- let a = await n.call(t, r, i);
867
- return a.addEventListener("error", () => ht(e), { once: !0 }), a;
888
+ let a = await vt(n, t, r, i);
889
+ return a.addEventListener("error", () => gt(e), { once: !0 }), a;
868
890
  });
869
891
  }
870
- var _t = {
892
+ var bt = {
871
893
  parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
872
894
  overarc: "\\overparen",
873
895
  napprox: "\\not\\approx",
@@ -875,67 +897,67 @@ var _t = {
875
897
  abs: ["\\left|#1\\right|", 1],
876
898
  perpendicular: "\\perp",
877
899
  divide: "\\div"
878
- }, vt = /\\\(|\\\[|\$\$|\\\$|\\begin\{|\\(?:eq)?ref\{/, yt = /\\\(|\\\[|\$|\\begin\{|\\(?:eq)?ref\{/, bt = /\\embed\{newLine\}\[\]/g, xt = [
900
+ }, xt = /\\\(|\\\[|\$\$|\\\$|\\begin\{|\\(?:eq)?ref\{/, St = /\\\(|\\\[|\$|\\begin\{|\\(?:eq)?ref\{/, Ct = /\\embed\{newLine\}\[\]/g, wt = [
879
901
  ["$$", "$$"],
880
902
  ["$", "$"],
881
903
  ["\\[", "\\]"],
882
904
  ["\\(", "\\)"]
883
905
  ];
884
- function St(e) {
885
- for (let [t, n] of xt) if (e.startsWith(t) && e.endsWith(n)) return e.substring(t.length, e.length - n.length);
906
+ function Tt(e) {
907
+ for (let [t, n] of wt) if (e.startsWith(t) && e.endsWith(n)) return e.substring(t.length, e.length - n.length);
886
908
  return e;
887
909
  }
888
- function Ct(e) {
889
- return `\\(${St(e.includes("\\displaystyle") ? e.replace("\\displaystyle", "").trim() : e)}\\)`.replace(bt, "\\newline ");
910
+ function Et(e) {
911
+ return `\\(${Tt(e.includes("\\displaystyle") ? e.replace("\\displaystyle", "").trim() : e)}\\)`.replace(Ct, "\\newline ");
890
912
  }
891
- var wt = "mathjax_ignore", Tt = "mathjax_process", Et = "[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)", Dt = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading"), Ot = "MJX-CHTML-styles", kt = "PIE-MJX-SVG-styles", Z = "PIE-MathJax-Menu-Settings", At = { "mjx-container[overflow=\"linebreak\"][display]": {
913
+ var Dt = "mathjax_ignore", Ot = "mathjax_process", kt = "[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)", At = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading"), jt = "MJX-CHTML-styles", Mt = "PIE-MJX-SVG-styles", X = "PIE-MathJax-Menu-Settings", Nt = { "mjx-container[overflow=\"linebreak\"][display]": {
892
914
  overflow: "auto clip",
893
915
  "min-width": "initial !important"
894
- } }, jt = { "mjx-over > mjx-mo > mjx-stretchy-h.mjx-c2015": {
916
+ } }, Pt = { "mjx-over > mjx-mo > mjx-stretchy-h.mjx-c2015": {
895
917
  position: "relative",
896
918
  top: "-0.13em"
897
- } }, Mt = 200, Nt = 201, Pt = 202;
898
- function Q(e) {
919
+ } }, Ft = 200, It = 201, Lt = 202;
920
+ function Z(e) {
899
921
  let t = [...e.matches("mjx-container") ? [e] : [], ...e.querySelectorAll("mjx-container")];
900
922
  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");
901
923
  }
902
- function Ft(e, t) {
903
- let n = e.closest(`.${wt}, .${Tt}`);
924
+ function Rt(e, t) {
925
+ let n = e.closest(`.${Dt}, .${Ot}`);
904
926
  return n !== null && t.contains(n) && !n.classList.contains("mathjax_process");
905
927
  }
906
- function It(e) {
928
+ function zt(e) {
907
929
  for (let t of e.querySelectorAll("[data-latex]")) {
908
- if (t.dataset.mathHandled || t.closest("mjx-container") || t.closest("math") || Ft(t, e)) continue;
930
+ if (t.dataset.mathHandled || t.closest("mjx-container") || t.closest("math") || Rt(t, e)) continue;
909
931
  let n = t.textContent;
910
- n && (t.textContent = Ct(n), t.dataset.mathHandled = "true");
932
+ n && (t.textContent = Et(n), t.dataset.mathHandled = "true");
911
933
  }
912
934
  }
913
- function Lt(e) {
935
+ function Bt(e) {
914
936
  for (let t of e.querySelectorAll("math")) t.closest("mjx-container") || t.setAttribute("displaystyle", "true");
915
937
  }
916
- function Rt(e, t) {
938
+ function Vt(e, t) {
917
939
  for (let t of e.querySelectorAll("math")) if (!t.closest("mjx-assistive-mml")) return !0;
918
- return (t ? yt : vt).test(e.textContent ?? "");
940
+ return (t ? St : xt).test(e.textContent ?? "");
919
941
  }
920
- function zt(e) {
942
+ function Ht(e) {
921
943
  return new Promise((t, n) => {
922
944
  let { useSingleDollar: r = !1, accessibility: i = !0, loadFonts: a = !0, srcUrl: o } = e, c = d(e, import.meta.url), l = s(), u = {
923
945
  loader: {
924
946
  load: i ? ["a11y/assistive-mml"] : [],
925
947
  failed: (e) => n(e),
926
948
  "output/svg": { ready: (e) => {
927
- let t = b();
928
- return Bt(t) && Vt(t), e;
949
+ let t = y();
950
+ return Ut(t) && Wt(t), e;
929
951
  } }
930
952
  },
931
953
  startup: {
932
954
  typeset: !1,
933
955
  ready: () => {
934
- let e = b(), r = e?.startup, i = Bt(e);
935
- i && (Vt(e), Ht(e, c.speechLocales), f(e?._?.a11y?.sre_ts?.locales, c.speechLocales)), r?.defaultReady?.(), i && (Ut(r?.document), Wt(r?.document), r?.document?.addStyles?.(At), r?.document?.addStyles?.(jt), gt(r?.document)), Promise.resolve(r?.promise).then(() => t(), n);
956
+ let e = y(), r = e?.startup, i = Ut(e);
957
+ i && (Wt(e), Gt(e, c.speechLocales), f(e?._?.a11y?.sre_ts?.locales, c.speechLocales)), r?.defaultReady?.(), i && (Kt(r?.document), qt(r?.document), r?.document?.addStyles?.(Nt), r?.document?.addStyles?.(Pt), yt(r?.document)), Promise.resolve(r?.promise).then(() => t(), n);
936
958
  }
937
959
  },
938
- tex: { macros: { ..._t } },
960
+ tex: { macros: { ...bt } },
939
961
  output: { displayOverflow: "linebreak" },
940
962
  options: {
941
963
  enableMenu: i,
@@ -947,9 +969,9 @@ function zt(e) {
947
969
  a11y: { inTabOrder: l }
948
970
  }
949
971
  };
950
- r && u.tex && (console.warn(Et), u.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], u.tex.processEscapes = !0), a || (u.chtml = { fontURL: "" });
972
+ r && u.tex && (console.warn(kt), u.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], u.tex.processEscapes = !0), a || (u.chtml = { fontURL: "" });
951
973
  let m = p(c.speechLocales);
952
- m && u.options && (u.options.sre = { locale: m }), re(u, {
974
+ m && u.options && (u.options.sre = { locale: m }), ie(u, {
953
975
  ...c,
954
976
  srcUrl: o
955
977
  }).then((e) => {
@@ -957,206 +979,206 @@ function zt(e) {
957
979
  }, n);
958
980
  });
959
981
  }
960
- function Bt(e) {
982
+ function Ut(e) {
961
983
  return !!e?.version?.startsWith("4.");
962
984
  }
963
- function Vt(e) {
985
+ function Wt(e) {
964
986
  let t = e?._?.output, n = t?.chtml_ts?.CHTML;
965
- n && (n.STYLESHEETID = x);
987
+ n && (n.STYLESHEETID = b);
966
988
  let r = t?.svg_ts?.SVG;
967
- r && (r.STYLESHEETID = kt);
989
+ r && (r.STYLESHEETID = Mt);
968
990
  }
969
- function Ht(e, t) {
991
+ function Gt(e, t) {
970
992
  let n = e?._?.ui?.menu?.Menu?.Menu;
971
993
  if (n) {
972
- n.MENU_STORAGE = Z;
994
+ n.MENU_STORAGE = X;
973
995
  try {
974
- let e = localStorage.getItem(Z);
996
+ let e = localStorage.getItem(X);
975
997
  if (!e) return;
976
998
  let { assistiveMml: n, locale: r, ...i } = JSON.parse(e), a = r === void 0 || !t || t.has(r);
977
999
  if (n === void 0 && a) return;
978
- a && r !== void 0 && (i.locale = r), Object.keys(i).length ? localStorage.setItem(Z, JSON.stringify(i)) : localStorage.removeItem(Z);
1000
+ a && r !== void 0 && (i.locale = r), Object.keys(i).length ? localStorage.setItem(X, JSON.stringify(i)) : localStorage.removeItem(X);
979
1001
  } catch {}
980
1002
  }
981
1003
  }
982
- function Ut(e) {
1004
+ function Kt(e) {
983
1005
  if (!e) return;
984
1006
  let t = /* @__PURE__ */ new WeakSet(), n = (e) => {
985
1007
  let n = e.typesetRoot;
986
- n && !t.has(n) && (Q(n), t.add(n));
1008
+ n && !t.has(n) && (Z(n), t.add(n));
987
1009
  };
988
- e.addRenderAction?.("pie-strip-latex", Nt, (e) => {
1010
+ e.addRenderAction?.("pie-strip-latex", It, (e) => {
989
1011
  for (let t of e.math ?? []) n(t);
990
1012
  return !1;
991
1013
  }, (e) => {
992
1014
  let t = e.typesetRoot;
993
- return t && Q(t), !1;
1015
+ return t && Z(t), !1;
994
1016
  });
995
1017
  let r = e.outputJax?.chtmlStyles;
996
- r?.id === Ot && (r.id = x), qt();
1018
+ r?.id === jt && (r.id = b), Xt();
997
1019
  }
998
- function Wt(e) {
1020
+ function qt(e) {
999
1021
  let t = (e) => {
1000
- e.typesetRoot && ft(e.typesetRoot);
1022
+ e.typesetRoot && pt(e.typesetRoot);
1001
1023
  };
1002
- e?.addRenderAction?.("pie-name-math", Pt, (e) => {
1024
+ e?.addRenderAction?.("pie-name-math", Lt, (e) => {
1003
1025
  for (let n of e.math ?? []) t(n);
1004
1026
  return !1;
1005
1027
  }, (e) => (t(e), !1));
1006
1028
  }
1007
- function Gt(e) {
1008
- return e instanceof HTMLStyleElement && ae.includes(e.id);
1029
+ function Jt(e) {
1030
+ return e instanceof HTMLStyleElement && oe.includes(e.id);
1009
1031
  }
1010
- function Kt(e) {
1011
- y("foreign-output-stylesheet", `another MathJax added <style id="${e.id}"> to <head>`);
1032
+ function Yt(e) {
1033
+ te("foreign-output-stylesheet", `another MathJax added <style id="${e.id}"> to <head>`);
1012
1034
  }
1013
- function qt() {
1014
- let e = document.head, t = [...e.children].find(Gt);
1035
+ function Xt() {
1036
+ let e = document.head, t = [...e.children].find(Jt);
1015
1037
  if (t) {
1016
- Kt(t);
1038
+ Yt(t);
1017
1039
  return;
1018
1040
  }
1019
1041
  let n = new MutationObserver((e) => {
1020
1042
  for (let t of e) {
1021
- let e = [...t.addedNodes].find(Gt);
1043
+ let e = [...t.addedNodes].find(Jt);
1022
1044
  if (e) {
1023
- Kt(e), n.disconnect();
1045
+ Yt(e), n.disconnect();
1024
1046
  return;
1025
1047
  }
1026
1048
  }
1027
1049
  });
1028
1050
  n.observe(e, { childList: !0 });
1029
1051
  }
1030
- function Jt(e) {
1052
+ function Zt(e) {
1031
1053
  let t = e?.math;
1032
1054
  if (!t?.remove) return;
1033
- let n = [...t].filter((e) => (e.state?.() ?? 0) >= Mt && e.typesetRoot?.isConnected === !1);
1055
+ let n = [...t].filter((e) => (e.state?.() ?? 0) >= Ft && e.typesetRoot?.isConnected === !1);
1034
1056
  if (n.length !== 0) {
1035
1057
  for (let e of [...n].reverse()) e.clear?.();
1036
1058
  t.remove(...n);
1037
1059
  }
1038
1060
  }
1039
- function Yt(e) {
1061
+ function Qt(e) {
1040
1062
  return new Promise((t, n) => {
1041
1063
  let r = e.startup ?? {};
1042
1064
  e.startup = r;
1043
1065
  let i = r.ready;
1044
1066
  r.ready = () => {
1045
- let e = b()?.startup;
1067
+ let e = y()?.startup;
1046
1068
  i ? i.call(r) : e?.defaultReady?.(), Promise.resolve(e?.promise).then(() => t(), n);
1047
1069
  };
1048
1070
  });
1049
1071
  }
1050
- function Xt(e) {
1051
- let t = b();
1052
- return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : Yt(t) : zt(e);
1072
+ function $t(e) {
1073
+ let t = y();
1074
+ return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : Qt(t) : Ht(e);
1053
1075
  }
1054
- function Zt(e) {
1055
- return Xt(e).then(() => {
1056
- let e = b();
1076
+ function en(e) {
1077
+ return $t(e).then(() => {
1078
+ let e = y();
1057
1079
  e && typeof e.typesetPromise != "function" && console.warn("[mathjax-renderer] MathJax on this page has no typesetPromise; math stays untypeset.");
1058
1080
  });
1059
1081
  }
1060
- function Qt(e) {
1061
- let t = ie, n = t[Dt];
1062
- return n || (n = Zt(e), t[Dt] = n), n;
1082
+ function tn(e) {
1083
+ let t = ae, n = t[At];
1084
+ return n || (n = en(e), t[At] = n), n;
1063
1085
  }
1064
- function $t(e = {}) {
1086
+ function Q(e = {}) {
1065
1087
  let t = e.useSingleDollar ?? !1;
1066
1088
  return async (n) => {
1067
1089
  if (typeof window > "u") return;
1068
- let r = oe();
1069
- r && y("mathjax-3-global", `window.MathJax is MathJax ${r}`), It(n), ue(n), Lt(n), Le(n);
1070
- let i = Qt(e);
1071
- if (!Rt(n, t)) {
1072
- i.catch(() => {}), X(n);
1090
+ let r = se();
1091
+ r && te("mathjax-3-global", `window.MathJax is MathJax ${r}`), zt(n), de(n), Bt(n), Fe(n);
1092
+ let i = tn(e);
1093
+ if (!Vt(n, t)) {
1094
+ i.catch(() => {}), Y(n);
1073
1095
  return;
1074
1096
  }
1075
1097
  await i;
1076
- let a = b();
1098
+ let a = y();
1077
1099
  if (await a?.startup?.promise, typeof a?.typesetPromise == "function") {
1078
- He(), Jt(a.startup?.document);
1100
+ Be(), Zt(a.startup?.document);
1079
1101
  try {
1080
1102
  await a.typesetPromise([n]);
1081
1103
  } catch (e) {
1082
1104
  throw a.typesetClear?.([n]), e;
1083
1105
  }
1084
- Q(n), X(n);
1106
+ Z(n), Y(n);
1085
1107
  }
1086
1108
  };
1087
1109
  }
1088
- var en = "@pie-lib/math-rendering", tn = "@pie-lib/math-rendering@2", nn = "pie-print", rn = 50, an = 1e4, on = null;
1089
- function sn() {
1090
- return !!window[tn]?.opts?.useSingleDollar;
1110
+ var nn = "@pie-lib/math-rendering", rn = "@pie-lib/math-rendering@2", an = "pie-print", on = 50, sn = 1e4, cn = null;
1111
+ function ln() {
1112
+ return !!window[rn]?.opts?.useSingleDollar;
1091
1113
  }
1092
- function cn() {
1093
- return on ||= $t({ useSingleDollar: sn() }), on;
1114
+ function un() {
1115
+ return cn ||= Q({ useSingleDollar: ln() }), cn;
1094
1116
  }
1095
1117
  function $() {
1096
1118
  if (typeof window > "u") return null;
1097
- let e = window[en];
1098
- return typeof e?.renderMath == "function" && e.renderMath !== fn ? e : null;
1119
+ let e = window[nn];
1120
+ return typeof e?.renderMath == "function" && e.renderMath !== mn ? e : null;
1099
1121
  }
1100
- function ln(e) {
1122
+ function dn(e) {
1101
1123
  let t = e;
1102
1124
  for (; t;) {
1103
- if (t instanceof Element && t.localName === nn) return t;
1125
+ if (t instanceof Element && t.localName === an) return t;
1104
1126
  t = t instanceof ShadowRoot ? t.host : t.parentNode;
1105
1127
  }
1106
1128
  return null;
1107
1129
  }
1108
- function un() {
1130
+ function fn() {
1109
1131
  let e = window.renderMath;
1110
1132
  return typeof e == "function" ? e : null;
1111
1133
  }
1112
- async function dn(e) {
1113
- let t = ln(e);
1134
+ async function pn(e) {
1135
+ let t = dn(e);
1114
1136
  if (!t) return null;
1115
- let n = un();
1137
+ let n = fn();
1116
1138
  if (n || t.mathRenderingModuleUrlImported !== !0) return n;
1117
- let r = Date.now() + an;
1139
+ let r = Date.now() + sn;
1118
1140
  for (; Date.now() < r;) {
1119
- await new Promise((e) => setTimeout(e, rn));
1120
- let e = un();
1141
+ await new Promise((e) => setTimeout(e, on));
1142
+ let e = fn();
1121
1143
  if (e) return e;
1122
1144
  }
1123
1145
  return null;
1124
1146
  }
1125
- var fn = async (e) => {
1147
+ var mn = async (e) => {
1126
1148
  if (typeof window > "u") return;
1127
1149
  let t = typeof e == "string", n;
1128
1150
  t ? (n = document.createElement("div"), n.innerHTML = e) : n = e || document.body;
1129
- let r = $(), i = r || t ? null : await dn(n);
1130
- return r ? (await r.renderMath?.(n), X(n)) : i && i !== fn ? (await i(n), X(n)) : await cn()(n), t ? n.innerHTML : void 0;
1131
- }, pn = /\sdata-latex(?:-item)?="[^"]*"/g, mn = /<merror|<mtext[^>]*mathcolor="red"[^>]*>\\/;
1132
- function hn(e, t) {
1151
+ let r = $(), i = r || t ? null : await pn(n);
1152
+ return r ? (await r.renderMath?.(n), Y(n)) : i && i !== mn ? (await i(n), Y(n)) : await un()(n), t ? n.innerHTML : void 0;
1153
+ }, hn = /\sdata-latex(?:-item)?="[^"]*"/g, gn = /<merror|<mtext[^>]*mathcolor="red"[^>]*>\\/;
1154
+ function _n(e, t) {
1133
1155
  let n = $()?.renderMath;
1134
1156
  if (typeof n != "function") return null;
1135
1157
  let [r, i] = t.display ? ["\\[", "\\]"] : ["\\(", "\\)"], a = `<span data-latex="" data-raw="${e.replace(/&/g, "&amp;").replace(/"/g, "&quot;")}">${r}${e}${i}</span>`;
1136
1158
  try {
1137
1159
  let e = n(a, { skipWaitForMathRenderingLib: !0 });
1138
1160
  if (typeof e?.then == "function") return e.catch(() => {}), null;
1139
- let t = typeof e == "string" && e !== a ? e.replace(/\n\s*/g, "").replace(pn, "") : "";
1140
- return t.startsWith("<math") && !mn.test(t) ? t : null;
1161
+ let t = typeof e == "string" && e !== a ? e.replace(/\n\s*/g, "").replace(hn, "") : "";
1162
+ return t.startsWith("<math") && !gn.test(t) ? t : null;
1141
1163
  } catch {
1142
1164
  return null;
1143
1165
  }
1144
1166
  }
1145
- var gn = (e, t = {}) => {
1167
+ var vn = (e, t = {}) => {
1146
1168
  let n = $()?.latexToMml;
1147
- if (n && n !== gn) try {
1169
+ if (n && n !== vn) try {
1148
1170
  return n(e, t) ?? null;
1149
1171
  } catch {
1150
1172
  return null;
1151
1173
  }
1152
- let r = b();
1153
- if (!r?.tex2mml || !r.startup?.document) return hn(e, t);
1174
+ let r = y();
1175
+ if (!r?.tex2mml || !r.startup?.document) return _n(e, t);
1154
1176
  try {
1155
1177
  r.texReset?.();
1156
- let n = r.tex2mml(e, { display: !!t.display })?.replace(/\n\s*/g, "").replace(pn, "");
1157
- return n && !mn.test(n) ? n : null;
1178
+ let n = r.tex2mml(e, { display: !!t.display })?.replace(/\n\s*/g, "").replace(hn, "");
1179
+ return n && !gn.test(n) ? n : null;
1158
1180
  } catch {
1159
1181
  return null;
1160
1182
  }
1161
1183
  };
1162
- export { gn as n, $t as t };
1184
+ export { Q as n, vn as t };
@@ -1,4 +1,4 @@
1
- import { n as e, t } from "./math-mathjax-D3sd5mwr.js";
1
+ import { n as e, t } from "./math-mathjax-D9Dk2W-u.js";
2
2
  // ../../node_modules/.bun/svelte@5.57.3/node_modules/svelte/src/internal/disclose-version.js
3
3
  typeof window < "u" && ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add("5");
4
4
  // ../../node_modules/.bun/svelte@5.57.3/node_modules/svelte/src/constants.js
@@ -2797,10 +2797,10 @@ function Di(n, r) {
2797
2797
  }));
2798
2798
  }), hr(() => {
2799
2799
  if (typeof oe()?.renderMath != "function") {
2800
- let n = t();
2800
+ let n = e();
2801
2801
  window[ae] = {
2802
2802
  renderMath: n,
2803
- latexToMml: e
2803
+ latexToMml: t
2804
2804
  }, n(document.createElement("div"));
2805
2805
  }
2806
2806
  return se = async (e) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/element-player",
3
- "version": "0.1.10-next.20261110080000",
3
+ "version": "0.1.10",
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.9-next.20261110072702"
29
+ "@pie-element/shared-math-rendering-mathjax": "0.1.9"
30
30
  },
31
31
  "license": "MIT",
32
32
  "publishConfig": {