@pie-element/simple-cloze 0.1.7-next.20261007184841 → 0.1.7

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.
@@ -7288,7 +7288,7 @@ var H$1 = [
7288
7288
  "style",
7289
7289
  "foreignobject"
7290
7290
  ];
7291
- var U = [
7291
+ var U$1 = [
7292
7292
  "onerror",
7293
7293
  "onload",
7294
7294
  "onclick",
@@ -7307,7 +7307,7 @@ var U = [
7307
7307
  "formaction",
7308
7308
  "xlink:href"
7309
7309
  ];
7310
- var W = /* @__PURE__ */ new Set([
7310
+ var W$1 = /* @__PURE__ */ new Set([
7311
7311
  "iframe",
7312
7312
  "object",
7313
7313
  "mstack",
@@ -7321,8 +7321,8 @@ var W = /* @__PURE__ */ new Set([
7321
7321
  "annotation",
7322
7322
  "none"
7323
7323
  ]);
7324
- var G = /^[a-z_][\w.-]*:[a-z][\w.-]*$/;
7325
- var K = [
7324
+ var G$1 = /^[a-z_][\w.-]*:[a-z][\w.-]*$/;
7325
+ var K$1 = [
7326
7326
  "alignment",
7327
7327
  "target",
7328
7328
  "allow",
@@ -7343,13 +7343,13 @@ var K = [
7343
7343
  "mslinethickness",
7344
7344
  "linebreak"
7345
7345
  ];
7346
- var q = /^\s*document\.getElementById\((['"])([^'"]+)\1\)\.play\(\)\s*;?\s*(?:return\s+false\s*;?\s*)?$/;
7347
- var J = "data-pie-play-audio";
7348
- var Y = {
7349
- ADD_TAGS: (e) => W.has(e) || G.test(e),
7350
- ADD_ATTR: K,
7346
+ var q$1 = /^\s*document\.getElementById\((['"])([^'"]+)\1\)\.play\(\)\s*;?\s*(?:return\s+false\s*;?\s*)?$/;
7347
+ var J$1 = "data-pie-play-audio";
7348
+ var Y$1 = {
7349
+ ADD_TAGS: (e) => W$1.has(e) || G$1.test(e),
7350
+ ADD_ATTR: K$1,
7351
7351
  FORBID_TAGS: H$1,
7352
- FORBID_ATTR: U,
7352
+ FORBID_ATTR: U$1,
7353
7353
  ALLOW_UNKNOWN_PROTOCOLS: !1,
7354
7354
  RETURN_TRUSTED_TYPE: !1
7355
7355
  };
@@ -7357,7 +7357,7 @@ var te$1 = !1;
7357
7357
  function ne$1(e) {
7358
7358
  for (let t of e.composedPath()) {
7359
7359
  if (!(t instanceof Element)) continue;
7360
- let n = t.getAttribute(J);
7360
+ let n = t.getAttribute(J$1);
7361
7361
  if (n === null) continue;
7362
7362
  e.preventDefault();
7363
7363
  let r = t.getRootNode().getElementById?.(n) ?? document.getElementById(n);
@@ -7365,25 +7365,25 @@ function ne$1(e) {
7365
7365
  return;
7366
7366
  }
7367
7367
  }
7368
- var X = null;
7368
+ var X$1 = null;
7369
7369
  function re$1() {
7370
- return X || (X = purify_default(window), X.addHook("beforeSanitizeAttributes", (e) => {
7370
+ return X$1 || (X$1 = purify_default(window), X$1.addHook("beforeSanitizeAttributes", (e) => {
7371
7371
  if (e.nodeName !== "A") return;
7372
- let t = q.exec(e.getAttribute("onclick") ?? "")?.[2];
7372
+ let t = q$1.exec(e.getAttribute("onclick") ?? "")?.[2];
7373
7373
  t !== void 0 && (e.removeAttribute("onclick"), e.setAttribute("data-pie-play-audio", t), te$1 || (te$1 = (document.addEventListener("click", ne$1), !0)));
7374
- }), X.addHook("afterSanitizeAttributes", v$1), X);
7374
+ }), X$1.addHook("afterSanitizeAttributes", v$1), X$1);
7375
7375
  }
7376
- var Z = 1e6;
7376
+ var Z$1 = 1e6;
7377
7377
  var Q$1 = /* @__PURE__ */ new Map();
7378
7378
  var $$1 = 0;
7379
7379
  function ie$1(t) {
7380
7380
  if (t == null || t === "" || !purify_default.isSupported) return "";
7381
7381
  let n = typeof t == "string" ? t : String(t), r = Q$1.get(n);
7382
7382
  if (r !== void 0) return r;
7383
- let i = String(re$1().sanitize(n, Y)), a = n.length + i.length;
7384
- if (a > Z) return i;
7383
+ let i = String(re$1().sanitize(n, Y$1)), a = n.length + i.length;
7384
+ if (a > Z$1) return i;
7385
7385
  for (let [e, t] of Q$1) {
7386
- if ($$1 + a <= Z) break;
7386
+ if ($$1 + a <= Z$1) break;
7387
7387
  Q$1.delete(e), $$1 -= e.length + t.length;
7388
7388
  }
7389
7389
  return Q$1.set(n, i), $$1 += a, i;
@@ -7532,82 +7532,82 @@ var oe = globalThis;
7532
7532
  var b = "PIE-MJX-CHTML-styles";
7533
7533
  var se = ["MJX-CHTML-styles", "MJX-SVG-styles"];
7534
7534
  var ce = re;
7535
- var x = "http://www.w3.org/1998/Math/MathML";
7536
- var le = /^([a-z_][\w.-]*):math$/;
7537
- var ue = /^[a-z][a-z0-9-]*$/;
7538
- function de(e) {
7535
+ var le = "http://www.w3.org/1998/Math/MathML";
7536
+ var ue = /^([a-z_][\w.-]*):math$/;
7537
+ var de = /^[a-z][a-z0-9-]*$/;
7538
+ function fe(e) {
7539
7539
  for (let t of e.querySelectorAll("*")) {
7540
- let n = le.exec(t.tagName.toLowerCase())?.[1];
7541
- !n || !e.contains(t) || t.closest("mjx-container") || t.replaceWith(S(t, `${n}:`));
7540
+ let n = ue.exec(t.tagName.toLowerCase())?.[1];
7541
+ !n || !e.contains(t) || t.closest("mjx-container") || t.replaceWith(pe(t, `${n}:`));
7542
7542
  }
7543
7543
  }
7544
- function S(e, t) {
7544
+ function pe(e, t) {
7545
7545
  let n = e.tagName.toLowerCase().slice(t.length);
7546
- if (!ue.test(n)) return e;
7547
- let r = e.ownerDocument.createElementNS(x, n);
7546
+ if (!de.test(n)) return e;
7547
+ let r = e.ownerDocument.createElementNS(le, n);
7548
7548
  for (let t of e.attributes) r.setAttribute(t.name, t.value);
7549
7549
  for (let n of [...e.childNodes]) {
7550
7550
  let e = n instanceof Element && n.tagName.toLowerCase().startsWith(t);
7551
- r.appendChild(e ? S(n, t) : n);
7551
+ r.appendChild(e ? pe(n, t) : n);
7552
7552
  }
7553
7553
  return r;
7554
7554
  }
7555
- var fe = /* @__PURE__ */ new Set([
7555
+ var me = /* @__PURE__ */ new Set([
7556
7556
  "updiagonalstrike",
7557
7557
  "downdiagonalstrike",
7558
7558
  "verticalstrike",
7559
7559
  "horizontalstrike"
7560
7560
  ]);
7561
- var pe = {
7561
+ var he = {
7562
7562
  thin: "0.035em",
7563
7563
  medium: "0.07em",
7564
7564
  thick: "0.14em"
7565
7565
  };
7566
- var me = {
7566
+ var ge = {
7567
7567
  tight: "0em",
7568
7568
  medium: "0.1em",
7569
7569
  loose: "0.2em"
7570
7570
  };
7571
- var he = /^(\d+(\.\d*)?|\.\d+)(em|ex|px|pt|pc|in|cm|mm)$/;
7572
- var ge = /^(#[0-9a-f]{3,8}|[a-z]+)$/i;
7573
- var _e = /^(\d+(\.\d*)?|\.\d+)$/;
7574
- var ve = /* @__PURE__ */ new Set([
7571
+ var _e = /^(\d+(\.\d*)?|\.\d+)(em|ex|px|pt|pc|in|cm|mm)$/;
7572
+ var ve = /^(#[0-9a-f]{3,8}|[a-z]+)$/i;
7573
+ var ye = /^(\d+(\.\d*)?|\.\d+)$/;
7574
+ var be = /* @__PURE__ */ new Set([
7575
7575
  "mn",
7576
7576
  "mo",
7577
7577
  "mi",
7578
7578
  "mtext"
7579
7579
  ]);
7580
- var ye = /* @__PURE__ */ new Set([
7580
+ var xe = /* @__PURE__ */ new Set([
7581
7581
  "stackalign",
7582
7582
  "charalign",
7583
7583
  "charspacing",
7584
7584
  "longdivstyle"
7585
7585
  ]);
7586
- function C(e, t, n = [], r = {}) {
7587
- let i = e.createElementNS(x, t);
7586
+ function x(e, t, n = [], r = {}) {
7587
+ let i = e.createElementNS(le, t);
7588
7588
  for (let [e, t] of Object.entries(r)) i.setAttribute(e, t);
7589
7589
  for (let e of n) e && i.appendChild(e);
7590
7590
  return i;
7591
7591
  }
7592
- function w(e, t) {
7593
- let n = C(e.document, "mo");
7592
+ function S(e, t) {
7593
+ let n = x(e.document, "mo");
7594
7594
  return n.textContent = t, n;
7595
7595
  }
7596
- function be(e) {
7597
- let t = C(e.document, "mn");
7598
- return t.textContent = "0", C(e.document, "mphantom", [t]);
7596
+ function Se(e) {
7597
+ let t = x(e.document, "mn");
7598
+ return t.textContent = "0", x(e.document, "mphantom", [t]);
7599
7599
  }
7600
- function T(e, t) {
7600
+ function C(e, t) {
7601
7601
  return e.getAttribute(t)?.trim().toLowerCase() || void 0;
7602
7602
  }
7603
- function E(e, t) {
7603
+ function w(e, t) {
7604
7604
  let n = Number.parseInt(e.getAttribute(t) ?? "", 10);
7605
7605
  return Number.isFinite(n) ? n : 0;
7606
7606
  }
7607
- function D(e) {
7607
+ function T(e) {
7608
7608
  return e.localName === "none" || e.localName === "mrow" && e.children.length === 0 && !e.textContent?.trim();
7609
7609
  }
7610
- function O(e, t, n = e) {
7610
+ function E(e, t, n = e) {
7611
7611
  switch (t) {
7612
7612
  case "left": return 0;
7613
7613
  case "center": return Math.floor(e / 2);
@@ -7615,14 +7615,14 @@ function O(e, t, n = e) {
7615
7615
  default: return n;
7616
7616
  }
7617
7617
  }
7618
- function k(e, t, n) {
7618
+ function D(e, t, n) {
7619
7619
  let r = [], i, a, o = (e, t) => {
7620
7620
  let s = (e) => t.reduceRight((e, t) => {
7621
7621
  let n = t.cloneNode(!1);
7622
7622
  return n.appendChild(e), n;
7623
7623
  }, e);
7624
7624
  if (e.localName === "mstyle") for (let n of [...e.children]) o(n, [...t, e]);
7625
- else if (D(e)) r.push(null);
7625
+ else if (T(e)) r.push(null);
7626
7626
  else if (e.localName === "mn" && e.children.length === 0) {
7627
7627
  let t = [...(e.textContent ?? "").trim()];
7628
7628
  for (let a of t) {
@@ -7631,28 +7631,28 @@ function k(e, t, n) {
7631
7631
  t.textContent = a, r.push(s(t));
7632
7632
  }
7633
7633
  t.length && (a ?? (a = r.length));
7634
- } else ve.has(e.localName) && e.textContent?.trim() === n.decimalPoint && (i ?? (i = r.length)), r.push(s(e));
7634
+ } else be.has(e.localName) && e.textContent?.trim() === n.decimalPoint && (i ?? (i = r.length)), r.push(s(e));
7635
7635
  };
7636
7636
  for (let t of e) o(t, []);
7637
7637
  return {
7638
7638
  kind: "digits",
7639
7639
  cells: r,
7640
- anchor: O(r.length, n.stackAlign, i ?? a),
7640
+ anchor: E(r.length, n.stackAlign, i ?? a),
7641
7641
  position: t
7642
7642
  };
7643
7643
  }
7644
- function xe(e) {
7645
- return (e ?? "").toLowerCase().split(/\s+/).filter((e) => fe.has(e));
7644
+ function O(e) {
7645
+ return (e ?? "").toLowerCase().split(/\s+/).filter((e) => me.has(e));
7646
7646
  }
7647
- function Se(e, t) {
7648
- let n = [...e.children].filter((e) => !D(e));
7649
- return n.length <= 1 ? n[0] ?? null : C(t.document, "mrow", n);
7647
+ function Ce(e, t) {
7648
+ let n = [...e.children].filter((e) => !T(e));
7649
+ return n.length <= 1 ? n[0] ?? null : x(t.document, "mrow", n);
7650
7650
  }
7651
- function Ce(e, t, n) {
7652
- let r = T(e, "location") ?? "n", i = xe(e.getAttribute("crossout")), a = [...e.children].map((e) => D(e) ? null : e.localName === "mscarry" ? {
7653
- content: Se(e, n),
7654
- location: T(e, "location") ?? r,
7655
- crossout: e.hasAttribute("crossout") ? xe(e.getAttribute("crossout")) : i
7651
+ function we(e, t, n) {
7652
+ let r = C(e, "location") ?? "n", i = O(e.getAttribute("crossout")), a = [...e.children].map((e) => T(e) ? null : e.localName === "mscarry" ? {
7653
+ content: Ce(e, n),
7654
+ location: C(e, "location") ?? r,
7655
+ crossout: e.hasAttribute("crossout") ? O(e.getAttribute("crossout")) : i
7656
7656
  } : {
7657
7657
  content: e,
7658
7658
  location: r,
@@ -7661,60 +7661,60 @@ function Ce(e, t, n) {
7661
7661
  return {
7662
7662
  kind: "carries",
7663
7663
  carries: a,
7664
- anchor: O(a.length, n.stackAlign),
7664
+ anchor: E(a.length, n.stackAlign),
7665
7665
  position: t,
7666
- scale: _e.test(o) ? o : "0.6"
7666
+ scale: ye.test(o) ? o : "0.6"
7667
7667
  };
7668
7668
  }
7669
- function we(e) {
7670
- let t = T(e, "mslinethickness") ?? "medium", n = pe[t] ?? (he.test(t) ? t : "0.07em"), r = e.getAttribute("mathcolor")?.trim() ?? "";
7671
- return `${n} solid ${ge.test(r) ? r : "currentColor"}`;
7669
+ function k(e) {
7670
+ let t = C(e, "mslinethickness") ?? "medium", n = he[t] ?? (_e.test(t) ? t : "0.07em"), r = e.getAttribute("mathcolor")?.trim() ?? "";
7671
+ return `${n} solid ${ve.test(r) ? r : "currentColor"}`;
7672
7672
  }
7673
7673
  function Te(e, t, n) {
7674
- let r = Math.max(0, E(e, "length"));
7674
+ let r = Math.max(0, w(e, "length"));
7675
7675
  return {
7676
7676
  kind: "line",
7677
7677
  length: r,
7678
- anchor: O(r, n.stackAlign),
7678
+ anchor: E(r, n.stackAlign),
7679
7679
  position: t,
7680
- border: we(e)
7680
+ border: k(e)
7681
7681
  };
7682
7682
  }
7683
7683
  function A(e, t, n, r, i) {
7684
7684
  e.forEach((e, a) => {
7685
- let o = t + a * n + E(e, "position");
7685
+ let o = t + a * n + w(e, "position");
7686
7686
  switch (e.localName) {
7687
7687
  case "msgroup":
7688
- A([...e.children], o, E(e, "shift"), r, i);
7688
+ A([...e.children], o, w(e, "shift"), r, i);
7689
7689
  break;
7690
7690
  case "msline":
7691
7691
  i.push(Te(e, o, r));
7692
7692
  break;
7693
7693
  case "mscarries":
7694
- i.push(Ce(e, o, r));
7694
+ i.push(we(e, o, r));
7695
7695
  break;
7696
7696
  case "msrow":
7697
7697
  case "mrow":
7698
- i.push(k([...e.children], o, r));
7698
+ i.push(D([...e.children], o, r));
7699
7699
  break;
7700
- default: i.push(k([e], o, r));
7700
+ default: i.push(D([e], o, r));
7701
7701
  }
7702
7702
  });
7703
7703
  }
7704
7704
  function j(e) {
7705
7705
  return -e.anchor - e.position;
7706
7706
  }
7707
- function Ee(e) {
7707
+ function M(e) {
7708
7708
  return e.kind === "digits" ? e.cells.length : e.kind === "carries" ? e.carries.length : e.length;
7709
7709
  }
7710
- function De(e) {
7711
- return j(e) + Ee(e) - 1;
7710
+ function N(e) {
7711
+ return j(e) + M(e) - 1;
7712
7712
  }
7713
- function Oe(e, t, n, r) {
7714
- let i = (e) => C(r.document, "mpadded", [t], {
7713
+ function Ee(e, t, n, r) {
7714
+ let i = (e) => x(r.document, "mpadded", [t], {
7715
7715
  width: "0",
7716
7716
  ...e ? { lspace: e } : {}
7717
- }), a = (e, t) => C(r.document, e, t);
7717
+ }), a = (e, t) => x(r.document, e, t);
7718
7718
  switch (n) {
7719
7719
  case "s": return a("munder", [e, i("-0.5width")]);
7720
7720
  case "ne": return a("msup", [e, i()]);
@@ -7736,41 +7736,41 @@ function Oe(e, t, n, r) {
7736
7736
  default: return a("mover", [e, i("-0.5width")]);
7737
7737
  }
7738
7738
  }
7739
- function ke(e, t, n) {
7740
- let r = C(n.document, "menclose", [e], {
7739
+ function De(e, t, n) {
7740
+ let r = x(n.document, "menclose", [e], {
7741
7741
  notation: t.join(" "),
7742
7742
  "data-padding": "0.1em",
7743
7743
  "data-thickness": "0.067em"
7744
7744
  }), i = t.some((e) => e.endsWith("diagonalstrike")) ? .167 : t.includes("horizontalstrike") ? .1 : 0;
7745
- return i ? C(n.document, "mpadded", [r], {
7745
+ return i ? x(n.document, "mpadded", [r], {
7746
7746
  lspace: `-${i}em`,
7747
7747
  width: `-${2 * i}em`
7748
7748
  }) : r;
7749
7749
  }
7750
- function Ae(e, t, n, r, i) {
7751
- let a = e && t.crossout.length ? ke(e, t.crossout, i) : e;
7750
+ function Oe(e, t, n, r, i) {
7751
+ let a = e && t.crossout.length ? De(e, t.crossout, i) : e;
7752
7752
  if (!t.content) return a;
7753
- let o = C(i.document, "mstyle", [t.content], { scriptsizemultiplier: r });
7754
- return Oe(a ?? be(i), o, n, i);
7753
+ let o = x(i.document, "mstyle", [t.content], { scriptsizemultiplier: r });
7754
+ return Ee(a ?? Se(i), o, n, i);
7755
7755
  }
7756
- function je(e, t) {
7756
+ function P(e, t) {
7757
7757
  return e.carries[t - j(e)] ?? null;
7758
7758
  }
7759
- function Me(e, t, n, r) {
7759
+ function ke(e, t, n, r) {
7760
7760
  let i = e.content;
7761
7761
  n.forEach((e, a) => {
7762
- let o = n.length - 1 - a, s = n[o], c = je(s, t), l = n.slice(0, o).some((e) => je(e, t));
7762
+ let o = n.length - 1 - a, s = n[o], c = P(s, t), l = n.slice(0, o).some((e) => P(e, t));
7763
7763
  if (!c && !l) return;
7764
7764
  let u = c ?? {
7765
- content: be(r),
7765
+ content: Se(r),
7766
7766
  location: "n",
7767
7767
  crossout: []
7768
7768
  }, d = a === 0 ? u.location : "n";
7769
- i = Ae(i, u, d, s.scale, r);
7769
+ i = Oe(i, u, d, s.scale, r);
7770
7770
  }), e.content = i;
7771
7771
  }
7772
- function Ne(e, t) {
7773
- let n = e.filter((e) => Ee(e) > 0), r = Math.min(0, ...n.map(j)), i = Math.max(r, ...n.map(De)) - r + 1, a = -r, o = [], s = /* @__PURE__ */ new Map(), c = () => Array.from({ length: i }, () => ({
7772
+ function F(e, t) {
7773
+ 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 }, () => ({
7774
7774
  content: null,
7775
7775
  borders: {}
7776
7776
  })), 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) => {
@@ -7778,7 +7778,7 @@ function Ne(e, t) {
7778
7778
  e.cells.forEach((t, r) => {
7779
7779
  n[a + j(e) + r].content = t;
7780
7780
  }), u.length && n.forEach((e, n) => {
7781
- Me(e, n - a, u, t);
7781
+ ke(e, n - a, u, t);
7782
7782
  });
7783
7783
  for (let e of d) for (let t of l(e)) n[t].borders.top = e.border;
7784
7784
  u = [], d = [], s.set(e, o.length), o.push(n);
@@ -7798,43 +7798,43 @@ function Ne(e, t) {
7798
7798
  origin: a
7799
7799
  };
7800
7800
  }
7801
- function Pe(e, { rows: t }, n) {
7802
- let r = C(n.document, "mtable", t.map((e) => C(n.document, "mtr", e.map((e) => {
7801
+ function Ae(e, { rows: t }, n) {
7802
+ let r = x(n.document, "mtable", t.map((e) => x(n.document, "mtr", e.map((e) => {
7803
7803
  let t = Object.entries(e.borders).map(([e, t]) => `border-${e}:${t}`).join(";");
7804
- return C(n.document, "mtd", [e.content], {
7804
+ return x(n.document, "mtd", [e.content], {
7805
7805
  ...t ? { style: t } : {},
7806
7806
  ...e.align ? { columnalign: e.align } : {}
7807
7807
  });
7808
7808
  }))));
7809
- for (let { name: t, value: n } of [...e.attributes]) ye.has(t) || r.setAttribute(t, n);
7810
- let i = T(e, "charspacing") ?? "medium", a = T(e, "charalign");
7811
- 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;
7809
+ for (let { name: t, value: n } of [...e.attributes]) xe.has(t) || r.setAttribute(t, n);
7810
+ let i = C(e, "charspacing") ?? "medium", a = C(e, "charalign");
7811
+ return r.setAttribute("columnspacing", ge[i] ?? (_e.test(i) ? i : ge.medium)), r.setAttribute("columnalign", a === "left" || a === "center" ? a : "right"), r.setAttribute("rowspacing", "0"), r.setAttribute("align", e.getAttribute("align") ?? "baseline"), r;
7812
7812
  }
7813
- function Fe(e) {
7813
+ function je(e) {
7814
7814
  return {
7815
7815
  document: e.ownerDocument,
7816
- stackAlign: T(e, "stackalign") ?? "decimalpoint",
7816
+ stackAlign: C(e, "stackalign") ?? "decimalpoint",
7817
7817
  decimalPoint: e.closest("[decimalpoint]")?.getAttribute("decimalpoint")?.trim().charAt(0) || "."
7818
7818
  };
7819
7819
  }
7820
- function Ie(e) {
7821
- let t = Fe(e), n = [];
7822
- return A([...e.children], 0, 0, t, n), Pe(e, Ne(n, t), t);
7820
+ function Me(e) {
7821
+ let t = je(e), n = [];
7822
+ return A([...e.children], 0, 0, t, n), Ae(e, F(n, t), t);
7823
7823
  }
7824
- function M(e, t, n, r, i, a) {
7824
+ function I(e, t, n, r, i, a) {
7825
7825
  for (let o = n; o <= r; o++) e[t][o].borders[i] = a;
7826
7826
  }
7827
- function Le(e, t) {
7828
- let n = w(t, ")");
7829
- return n.setAttribute("minsize", "1.2em"), [C(t.document, "mrow", [e, C(t.document, "mspace", [], { width: "0.2em" })]), C(t.document, "mpadded", [n], {
7827
+ function Ne(e, t) {
7828
+ let n = S(t, ")");
7829
+ return n.setAttribute("minsize", "1.2em"), [x(t.document, "mrow", [e, x(t.document, "mspace", [], { width: "0.2em" })]), x(t.document, "mpadded", [n], {
7830
7830
  voffset: "0.1em",
7831
7831
  lspace: "-0.15em",
7832
7832
  depth: "-0.2em",
7833
7833
  height: "-0.2em"
7834
7834
  })];
7835
7835
  }
7836
- function Re(e) {
7837
- let t = Fe(e), [n, r, ...i] = [...e.children], a = n && !D(n) ? n : null, o = r && !D(r) ? r : null, s = T(e, "longdivstyle") ?? "lefttop", c = we(e), l = [];
7836
+ function Pe(e) {
7837
+ let t = je(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 = [];
7838
7838
  A(i, 0, 0, t, l);
7839
7839
  let u = l.find((e) => e.kind === "digits");
7840
7840
  u || (u = {
@@ -7847,51 +7847,51 @@ function Re(e) {
7847
7847
  u.cells.unshift(...e), u.anchor += e.length;
7848
7848
  }, p = (...e) => {
7849
7849
  let n = e.flatMap((e) => e ? e.localName === "mrow" ? [...e.children] : [e] : []);
7850
- u.cells.push(...k(n, 0, t).cells);
7850
+ u.cells.push(...D(n, 0, t).cells);
7851
7851
  };
7852
7852
  switch (s) {
7853
7853
  case "left/\\right":
7854
- f(a, w(t, "/")), p(w(t, "\\"), o);
7854
+ f(a, S(t, "/")), p(S(t, "\\"), o);
7855
7855
  break;
7856
7856
  case "left)(right":
7857
- f(a, w(t, ")")), p(w(t, "("), o);
7857
+ f(a, S(t, ")")), p(S(t, "("), o);
7858
7858
  break;
7859
7859
  case ":right=right":
7860
- p(w(t, ":"), a, w(t, "="), o);
7860
+ p(S(t, ":"), a, S(t, "="), o);
7861
7861
  break;
7862
7862
  case "righttop":
7863
7863
  case "stackedleftlinetop":
7864
7864
  case "lefttop":
7865
- o && A([o], 0, 0, t, d), l.splice(l.indexOf(u), 0, ...d), s === "righttop" ? p(a) : s === "stackedleftlinetop" ? f(a) : f(...Le(a, t));
7865
+ o && A([o], 0, 0, t, d), l.splice(l.indexOf(u), 0, ...d), s === "righttop" ? p(a) : s === "stackedleftlinetop" ? f(a) : f(...Ne(a, t));
7866
7866
  break;
7867
7867
  }
7868
- let m = Ne(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 + De(e)));
7868
+ 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)));
7869
7869
  switch (s) {
7870
7870
  case "left/\\right":
7871
7871
  case "left)(right":
7872
7872
  case ":right=right": break;
7873
7873
  case "righttop": {
7874
7874
  let e = h[g][_(u.cells.length - 1)];
7875
- e.borders.left = c, e.borders.bottom = c, M(h, g, _(0), _(u.cells.length - 1), "top", c);
7875
+ e.borders.left = c, e.borders.bottom = c, I(h, g, _(0), _(u.cells.length - 1), "top", c);
7876
7876
  break;
7877
7877
  }
7878
7878
  case "stackedleftlinetop": {
7879
7879
  let e = h[g][_(0)];
7880
- e.borders.right = c, e.borders.bottom = c, M(h, g, _(1), v, "top", c);
7880
+ e.borders.right = c, e.borders.bottom = c, I(h, g, _(1), v, "top", c);
7881
7881
  break;
7882
7882
  }
7883
7883
  case "stackedrightright":
7884
7884
  case "mediumstackedrightright":
7885
7885
  case "shortstackedrightright":
7886
7886
  case "stackedleftleft":
7887
- ze(h, g, s, a, o, c, t);
7887
+ Fe(h, g, s, a, o, c, t);
7888
7888
  break;
7889
- default: M(h, g, _(1), v, "top", c);
7889
+ default: I(h, g, _(1), v, "top", c);
7890
7890
  }
7891
- return Pe(e, m, t);
7891
+ return Ae(e, m, t);
7892
7892
  }
7893
- function ze(e, t, n, r, i, a, o) {
7894
- let s = n === "stackedleftleft", c = s ? "right" : "left", l = (e) => e && C(o.document, "mpadded", [e], {
7893
+ function Fe(e, t, n, r, i, a, o) {
7894
+ let s = n === "stackedleftleft", c = s ? "right" : "left", l = (e) => e && x(o.document, "mpadded", [e], {
7895
7895
  lspace: "0.2em",
7896
7896
  width: "+0.4em"
7897
7897
  });
@@ -7910,135 +7910,423 @@ function ze(e, t, n, r, i, a, o) {
7910
7910
  }) : 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);
7911
7911
  });
7912
7912
  }
7913
- function Be(e) {
7914
- for (let t of [...e.querySelectorAll("mstack, mlongdiv")]) !t.closest("math") || t.closest("mjx-container") || t.replaceWith(t.localName === "mstack" ? Ie(t) : Re(t));
7915
- }
7916
- var Ve = "PIE-MJX-explorer-styles";
7917
- var N = "var(--pie-text, black)";
7918
- var He = "var(--pie-background, #ffffff)";
7919
- var Ue = "var(--pie-border-dark, #66686A)";
7920
- var P = "var(--pie-focus-outline, var(--pie-button-focus-outline, var(--pie-focus-checked-border, #1565C0)))";
7921
- var F = `color-mix(in srgb, ${P} 15%, transparent)`;
7922
- var We = `
7913
+ function Ie(e) {
7914
+ for (let t of [...e.querySelectorAll("mstack, mlongdiv")]) !t.closest("math") || t.closest("mjx-container") || t.replaceWith(t.localName === "mstack" ? Me(t) : Pe(t));
7915
+ }
7916
+ var Le = "PIE-MJX-explorer-styles";
7917
+ var L = "var(--pie-text, black)";
7918
+ var Re = "var(--pie-background, #ffffff)";
7919
+ var ze = "var(--pie-border-dark, #66686A)";
7920
+ var R = "var(--pie-focus-outline, var(--pie-button-focus-outline, var(--pie-focus-checked-border, #1565C0)))";
7921
+ var z = `color-mix(in srgb, ${R} 15%, transparent)`;
7922
+ var Be = `
7923
7923
  :root mjx-container [data-sre-highlight-1]:not([data-mjx-collapsed], rect) {
7924
- color: ${N} !important;
7925
- fill: ${N} !important;
7924
+ color: ${L} !important;
7925
+ fill: ${L} !important;
7926
7926
  }
7927
7927
  :root mjx-container:not([data-mjx-clone-container]) [data-sre-highlight-1]:not([data-sre-enclosed], rect) {
7928
- background-color: ${F} !important;
7928
+ background-color: ${z} !important;
7929
7929
  }
7930
7930
  :root mjx-container rect[data-sre-highlight-1]:not([data-sre-enclosed]) {
7931
- fill: ${F} !important;
7931
+ fill: ${z} !important;
7932
7932
  }
7933
7933
  :root mjx-container .mjx-selected {
7934
- outline: 2px solid ${P} !important;
7934
+ outline: 2px solid ${R} !important;
7935
7935
  }
7936
7936
  :root mjx-container [data-sre-highlight-2] {
7937
- color: ${N} !important;
7937
+ color: ${L} !important;
7938
7938
  background-color: transparent !important;
7939
- fill: ${N} !important;
7940
- outline: 2px dashed ${P} !important;
7939
+ fill: ${L} !important;
7940
+ outline: 2px dashed ${R} !important;
7941
7941
  }
7942
7942
  :root mjx-container rect[data-sre-highlight-2] {
7943
7943
  fill: transparent !important;
7944
- stroke: ${P} !important;
7944
+ stroke: ${R} !important;
7945
7945
  stroke-width: 2px !important;
7946
7946
  vector-effect: non-scaling-stroke;
7947
7947
  }
7948
7948
  :root .MJX_LiveRegion, :root .MJX_HoverRegion, :root .MJX_ToolTip {
7949
- color: ${N} !important;
7950
- background-color: ${He} !important;
7951
- border-color: ${Ue} !important;
7949
+ color: ${L} !important;
7950
+ background-color: ${Re} !important;
7951
+ border-color: ${ze} !important;
7952
7952
  }
7953
7953
  :root .MJX_LiveRegion > div, :root .MJX_HoverRegion > div {
7954
- color: ${N} !important;
7955
- background-color: ${F} !important;
7954
+ color: ${L} !important;
7955
+ background-color: ${z} !important;
7956
7956
  }
7957
7957
  `;
7958
- function Ge(e = document) {
7958
+ function Ve(e = document) {
7959
7959
  if (e.getElementById("PIE-MJX-explorer-styles")) return;
7960
7960
  let t = e.createElement("style");
7961
- t.id = Ve, t.textContent = We, e.head.appendChild(t);
7961
+ t.id = Le, t.textContent = Be, e.head.appendChild(t);
7962
+ }
7963
+ var He = /[⁡-⁤]/g;
7964
+ var Ue = {
7965
+ "+": "positive",
7966
+ "-": "negative",
7967
+ "−": "negative",
7968
+ "±": "plus or minus",
7969
+ "∓": "minus or plus"
7970
+ };
7971
+ var We = {
7972
+ "(": "open parenthesis",
7973
+ "[": "open bracket",
7974
+ "{": "open brace",
7975
+ "⟨": "open angle bracket",
7976
+ "⌊": "open floor",
7977
+ "⌈": "open ceiling"
7978
+ };
7979
+ var Ge = {
7980
+ ")": "close parenthesis",
7981
+ "]": "close bracket",
7982
+ "}": "close brace",
7983
+ "⟩": "close angle bracket",
7984
+ "⌋": "close floor",
7985
+ "⌉": "close ceiling"
7986
+ };
7987
+ var B = {
7988
+ "!": "factorial",
7989
+ "%": "percent",
7990
+ "°": "degrees",
7991
+ "′": "prime",
7992
+ "″": "double prime"
7993
+ };
7994
+ var Ke = {
7995
+ "+": "plus",
7996
+ "-": "minus",
7997
+ "−": "minus",
7998
+ "±": "plus or minus",
7999
+ "∓": "minus or plus",
8000
+ "×": "times",
8001
+ "⋅": "times",
8002
+ "·": "times",
8003
+ "*": "times",
8004
+ "÷": "divided by",
8005
+ "/": "divided by",
8006
+ "=": "equals",
8007
+ "≠": "does not equal",
8008
+ "<": "is less than",
8009
+ ">": "is greater than",
8010
+ "≤": "is less than or equal to",
8011
+ "≥": "is greater than or equal to",
8012
+ "≈": "is approximately equal to",
8013
+ "≡": "is equivalent to",
8014
+ "∝": "is proportional to",
8015
+ "∈": "is an element of",
8016
+ "∉": "is not an element of",
8017
+ "⊂": "is a subset of",
8018
+ "⊆": "is a subset of or equal to",
8019
+ "∪": "union",
8020
+ "∩": "intersection",
8021
+ "→": "right arrow",
8022
+ "←": "left arrow",
8023
+ "⇒": "implies",
8024
+ "⇔": "if and only if",
8025
+ "∑": "sum",
8026
+ "∏": "product",
8027
+ "∫": "integral",
8028
+ "∞": "infinity",
8029
+ "∠": "angle",
8030
+ "⊥": "is perpendicular to",
8031
+ "∥": "is parallel to",
8032
+ "∴": "therefore",
8033
+ ",": "comma",
8034
+ ";": "semicolon",
8035
+ ":": "colon",
8036
+ "|": "vertical bar",
8037
+ "‖": "double vertical bar",
8038
+ ...We,
8039
+ ...Ge,
8040
+ ...B
8041
+ };
8042
+ var qe = /* @__PURE__ */ new Set(["|", "‖"]);
8043
+ var Je = /* @__PURE__ */ new Set([
8044
+ "∑",
8045
+ "∏",
8046
+ "∫",
8047
+ "∪",
8048
+ "∩"
8049
+ ]);
8050
+ var Ye = {
8051
+ α: "alpha",
8052
+ β: "beta",
8053
+ γ: "gamma",
8054
+ δ: "delta",
8055
+ ε: "epsilon",
8056
+ θ: "theta",
8057
+ λ: "lambda",
8058
+ μ: "mu",
8059
+ π: "pi",
8060
+ ρ: "rho",
8061
+ σ: "sigma",
8062
+ τ: "tau",
8063
+ φ: "phi",
8064
+ ω: "omega",
8065
+ Δ: "capital delta",
8066
+ Σ: "capital sigma",
8067
+ Ω: "capital omega",
8068
+ "∞": "infinity",
8069
+ sin: "sine",
8070
+ cos: "cosine",
8071
+ tan: "tangent",
8072
+ sec: "secant",
8073
+ csc: "cosecant",
8074
+ cot: "cotangent",
8075
+ ln: "natural log",
8076
+ lim: "limit"
8077
+ };
8078
+ var Xe = {
8079
+ "¯": "bar",
8080
+ "‾": "bar",
8081
+ "―": "bar",
8082
+ "^": "hat",
8083
+ ˆ: "hat",
8084
+ "~": "tilde",
8085
+ "˜": "tilde",
8086
+ "→": "vector",
8087
+ "⃗": "vector",
8088
+ "˙": "dot"
8089
+ };
8090
+ var V = (e) => (e.textContent ?? "").replace(He, "").replace(/\s+/g, " ").trim();
8091
+ var H = (e) => e.replace(/\s+/g, " ").trim();
8092
+ var U = (e) => [...e.children];
8093
+ function W(e) {
8094
+ return !e || [
8095
+ "mn",
8096
+ "mi",
8097
+ "mtext",
8098
+ "mo"
8099
+ ].includes(e.localName) ? !0 : ["mrow", "mstyle"].includes(e.localName) && e.children.length === 1 ? W(e.children[0]) : !1;
8100
+ }
8101
+ function Ze(e) {
8102
+ let t = e ? V(e) : "";
8103
+ return /^\d{1,3}$/.test(t) ? Number(t) : void 0;
8104
+ }
8105
+ function Qe(e) {
8106
+ return `${e}${e % 100 >= 11 && e % 100 <= 13 ? "th" : {
8107
+ 1: "st",
8108
+ 2: "nd",
8109
+ 3: "rd"
8110
+ }[e % 10] ?? "th"}`;
8111
+ }
8112
+ function $e(e) {
8113
+ return Ye[e] ?? e;
8114
+ }
8115
+ function G(e) {
8116
+ return Ke[e] ?? e;
8117
+ }
8118
+ function K(e) {
8119
+ let t = [], n = !1;
8120
+ for (let r of e) {
8121
+ if (r.localName !== "mo") {
8122
+ t.push(q(r)), n = !0;
8123
+ continue;
8124
+ }
8125
+ let e = V(r);
8126
+ e && (!n && Ue[e] ? t.push(Ue[e]) : e in B ? t.push(B[e]) : (t.push(G(e)), n = e in Ge || qe.has(e) && n));
8127
+ }
8128
+ return t.filter(Boolean).join(" ");
8129
+ }
8130
+ function et(e) {
8131
+ let [t, ...n] = e, r = n[n.length - 1], i = (e) => e?.localName === "mo" && ["|", "‖"].includes(V(e)), a = n.slice(0, -1);
8132
+ if (a.length && i(t) && i(r) && V(t) === V(r) && !a.some(i)) {
8133
+ let e = H(K(a));
8134
+ return V(t) === "|" ? `absolute value of ${e} end absolute value` : `norm of ${e} end norm`;
8135
+ }
8136
+ return K(e);
8137
+ }
8138
+ function tt(e, t) {
8139
+ let n = e ? q(e) : "", r = t ? q(t) : "";
8140
+ return W(e) && W(t) ? `${n} over ${r}` : `the fraction with numerator ${n} and denominator ${r}`;
8141
+ }
8142
+ function nt(e, t, n) {
8143
+ return n ? `${t} of ${e}` : `${t} of ${e} end root`;
8144
+ }
8145
+ function rt(e, t) {
8146
+ let n = t ? V(t) : "";
8147
+ if (t && W(t)) {
8148
+ if (n === "2") return `${e} squared`;
8149
+ if (n === "3") return `${e} cubed`;
8150
+ if (n in B) return `${e} ${B[n]}`;
8151
+ }
8152
+ let r = t ? q(t) : "";
8153
+ return W(t) ? `${e} to the power of ${r}` : `${e} to the power of ${r} end power`;
8154
+ }
8155
+ function it(e, t) {
8156
+ let n = t ? q(t) : "";
8157
+ return W(t) ? `${e} sub ${n}` : `${e} sub ${n} end sub`;
8158
+ }
8159
+ function at(e, t, n) {
8160
+ let r = V(e);
8161
+ if (r === "lim") return `limit as ${t ? q(t) : ""} of`;
8162
+ if (!Je.has(r)) return;
8163
+ let i = t ? `from ${q(t)}` : "", a = n ? `to ${q(n)}` : "";
8164
+ return `${G(r)} ${i} ${a} of`;
8165
+ }
8166
+ function ot(e) {
8167
+ 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(", ")}`);
8168
+ return `table with ${t.length} ${t.length === 1 ? "row" : "rows"} and ${r} ${r === 1 ? "column" : "columns"}. ${i.join(". ")}`;
7962
8169
  }
7963
- var I = Symbol.for("@pie-element/shared-math-rendering-mathjax/speech-worker-failed");
7964
- function Ke() {
8170
+ function st(e) {
8171
+ 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));
8172
+ return [
8173
+ G(t),
8174
+ ...i,
8175
+ G(n)
8176
+ ].filter(Boolean).join(" ");
8177
+ }
8178
+ function q(e) {
8179
+ let t = U(e);
8180
+ switch (e.localName) {
8181
+ case "mi": return $e(V(e));
8182
+ case "mn":
8183
+ case "mtext":
8184
+ case "ms": return V(e);
8185
+ case "mo": return G(V(e));
8186
+ case "mspace":
8187
+ case "mphantom":
8188
+ case "annotation":
8189
+ case "annotation-xml": return "";
8190
+ case "semantics": return t[0] ? q(t[0]) : "";
8191
+ case "mfrac": return tt(t[0], t[1]);
8192
+ case "msqrt": return nt(H(K(t)), "square root", t.length === 1 && W(t[0]));
8193
+ case "mroot": {
8194
+ let e = Ze(t[1]), n = e === 2 ? "square root" : e === 3 ? "cube root" : e ? `${Qe(e)} root` : `root with index ${t[1] ? q(t[1]) : ""}`;
8195
+ return nt(t[0] ? q(t[0]) : "", n, W(t[0]));
8196
+ }
8197
+ case "msup": return rt(t[0] ? q(t[0]) : "", t[1]);
8198
+ case "msub": return it(t[0] ? q(t[0]) : "", t[1]);
8199
+ case "msubsup": return (t[0] ? at(t[0], t[1], t[2]) : void 0) || rt(it(t[0] ? q(t[0]) : "", t[1]), t[2]);
8200
+ case "munder":
8201
+ case "mover":
8202
+ case "munderover": {
8203
+ 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 ? at(n, a, o) : void 0;
8204
+ if (s) return s;
8205
+ let c = n ? q(n) : "", l = e.localName === "mover" && r ? Xe[V(r)] : void 0;
8206
+ return l ? l === "vector" ? `vector ${c}` : `${c} ${l}` : [
8207
+ c,
8208
+ a ? `with ${q(a)} below` : "",
8209
+ o ? `with ${q(o)} above` : ""
8210
+ ].filter(Boolean).join(" ");
8211
+ }
8212
+ case "mfenced": return st(e);
8213
+ case "mtable": return ot(e);
8214
+ case "mrow":
8215
+ case "math": return et(t);
8216
+ default: return t.length ? K(t) : V(e);
8217
+ }
8218
+ }
8219
+ function ct(e) {
8220
+ return H(q(e));
8221
+ }
8222
+ var lt = [
8223
+ "a[href]",
8224
+ "button",
8225
+ "label",
8226
+ "summary",
8227
+ ...[
8228
+ "button",
8229
+ "checkbox",
8230
+ "combobox",
8231
+ "link",
8232
+ "menuitem",
8233
+ "menuitemcheckbox",
8234
+ "menuitemradio",
8235
+ "option",
8236
+ "radio",
8237
+ "switch",
8238
+ "tab",
8239
+ "treeitem"
8240
+ ].map((e) => `[role="${e}"]`)
8241
+ ].join(", ");
8242
+ function ut(e) {
8243
+ if (e.hasAttribute("aria-label") || !e.closest(lt)) return;
8244
+ let t = e.querySelector("math"), n = t ? ct(t) : "";
8245
+ n && e.setAttribute("aria-label", n);
8246
+ }
8247
+ function J(e) {
8248
+ for (let t of e.querySelectorAll("mjx-container")) ut(t);
8249
+ }
8250
+ var dt = Symbol.for("@pie-element/shared-math-rendering-mathjax/speech-worker-failed");
8251
+ function ft() {
7965
8252
  let e = globalThis;
7966
- e[I] || (e[I] = !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$2}`));
8253
+ e[dt] || (e[dt] = !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$2}`));
7967
8254
  }
7968
- function qe(e) {
8255
+ function pt(e) {
7969
8256
  let t = e.webworker;
7970
8257
  if (!t || t.ready) return;
7971
8258
  e.options ?? (e.options = {});
7972
8259
  let n = e.options;
7973
- n.enableSpeech = !1, n.enableBraille = !1, n.speechError = () => {}, t.Post = () => Promise.reject(/* @__PURE__ */ Error("The speech worker did not start")), t.Terminate(), Ke();
8260
+ n.enableSpeech = !1, n.enableBraille = !1, n.speechError = () => {}, t.Post = () => Promise.reject(/* @__PURE__ */ Error("The speech worker did not start")), t.Terminate(), ft();
7974
8261
  }
7975
- function Je(e) {
8262
+ function mt(e) {
7976
8263
  let t = e?.adaptor, n = t?.createWorker;
7977
8264
  !e || !t || !n || (t.createWorker = async (r, i) => {
7978
8265
  let a = await n.call(t, r, i);
7979
- return a.addEventListener("error", () => qe(e), { once: !0 }), a;
8266
+ return a.addEventListener("error", () => pt(e), { once: !0 }), a;
7980
8267
  });
7981
8268
  }
7982
8269
  `${i}`;
7983
- var Ye = {
8270
+ var ht = {
7984
8271
  parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
7985
8272
  overarc: "\\overparen",
7986
8273
  napprox: "\\not\\approx",
7987
8274
  longdiv: "\\enclose{longdiv}",
7988
8275
  abs: ["\\left|#1\\right|", 1]
7989
8276
  };
7990
- var Xe = "[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)";
7991
- var Ze = /\\\(|\\\[|\$\$|\\\$|\\begin\{|\\(?:eq)?ref\{/;
7992
- var Qe = /\\\(|\\\[|\$|\\begin\{|\\(?:eq)?ref\{/;
7993
- var $e = /\\embed\{newLine\}\[\]/g;
7994
- var et = [
8277
+ var gt = "[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)";
8278
+ var _t = /\\\(|\\\[|\$\$|\\\$|\\begin\{|\\(?:eq)?ref\{/;
8279
+ var vt = /\\\(|\\\[|\$|\\begin\{|\\(?:eq)?ref\{/;
8280
+ var yt = /\\embed\{newLine\}\[\]/g;
8281
+ var bt = [
7995
8282
  ["$$", "$$"],
7996
8283
  ["$", "$"],
7997
8284
  ["\\[", "\\]"],
7998
8285
  ["\\(", "\\)"]
7999
8286
  ];
8000
- var L = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading");
8001
- var tt = "MJX-CHTML-styles";
8002
- var nt = "PIE-MJX-SVG-styles";
8003
- var R = "PIE-MathJax-Menu-Settings";
8004
- var rt = { "mjx-container[overflow=\"linebreak\"][display]": {
8287
+ var xt = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading");
8288
+ var St = "MJX-CHTML-styles";
8289
+ var Ct = "PIE-MJX-SVG-styles";
8290
+ var Y = "PIE-MathJax-Menu-Settings";
8291
+ var wt = { "mjx-container[overflow=\"linebreak\"][display]": {
8005
8292
  overflow: "auto clip",
8006
8293
  "min-width": "initial !important"
8007
8294
  } };
8008
- var it = 200;
8009
- var at = 201;
8010
- function z(e) {
8295
+ var Tt = 200;
8296
+ var Et = 201;
8297
+ var Dt = 202;
8298
+ function X(e) {
8011
8299
  let t = [...e.matches("mjx-container") ? [e] : [], ...e.querySelectorAll("mjx-container")];
8012
8300
  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");
8013
8301
  }
8014
- function B(e) {
8015
- for (let [t, n] of et) if (e.startsWith(t) && e.endsWith(n)) return e.substring(t.length, e.length - n.length);
8302
+ function Ot(e) {
8303
+ for (let [t, n] of bt) if (e.startsWith(t) && e.endsWith(n)) return e.substring(t.length, e.length - n.length);
8016
8304
  return e;
8017
8305
  }
8018
- function ot(e) {
8019
- return B(e.includes("\\displaystyle") ? e.replace("\\displaystyle", "").trim() : e);
8306
+ function kt(e) {
8307
+ return Ot(e.includes("\\displaystyle") ? e.replace("\\displaystyle", "").trim() : e);
8020
8308
  }
8021
- var st = "mathjax_ignore";
8022
- var V = "mathjax_process";
8023
- function ct(e, t) {
8024
- let n = e.closest(`.${st}, .${V}`);
8025
- return n !== null && t.contains(n) && !n.classList.contains(V);
8309
+ var At = "mathjax_ignore";
8310
+ var jt = "mathjax_process";
8311
+ function Mt(e, t) {
8312
+ let n = e.closest(`.${At}, .${jt}`);
8313
+ return n !== null && t.contains(n) && !n.classList.contains(jt);
8026
8314
  }
8027
- function lt(e) {
8315
+ function Nt(e) {
8028
8316
  for (let t of e.querySelectorAll("[data-latex]")) {
8029
- if (t.dataset.mathHandled || t.closest("mjx-container") || ct(t, e)) continue;
8317
+ if (t.dataset.mathHandled || t.closest("mjx-container") || Mt(t, e)) continue;
8030
8318
  let n = t.textContent;
8031
- n && (t.textContent = `\\(${ot(n)}\\)`.replace($e, "\\newline "), t.dataset.mathHandled = "true");
8319
+ n && (t.textContent = `\\(${kt(n)}\\)`.replace(yt, "\\newline "), t.dataset.mathHandled = "true");
8032
8320
  }
8033
8321
  }
8034
- function ut(e) {
8322
+ function Pt(e) {
8035
8323
  for (let t of e.querySelectorAll("math")) t.closest("mjx-container") || t.setAttribute("displaystyle", "true");
8036
8324
  }
8037
- function dt(e, t) {
8325
+ function Ft(e, t) {
8038
8326
  for (let t of e.querySelectorAll("math")) if (!t.closest("mjx-assistive-mml")) return !0;
8039
- return (t ? Qe : Ze).test(e.textContent ?? "");
8327
+ return (t ? vt : _t).test(e.textContent ?? "");
8040
8328
  }
8041
- function ft(e) {
8329
+ function It(e) {
8042
8330
  return new Promise((t, n) => {
8043
8331
  let { useSingleDollar: r = !1, accessibility: i = !0, loadFonts: a = !0, srcUrl: o } = e, s = d(e, import.meta.url), c = {
8044
8332
  loader: {
@@ -8046,17 +8334,17 @@ function ft(e) {
8046
8334
  failed: (e) => n(e),
8047
8335
  "output/svg": { ready: (e) => {
8048
8336
  let t = y();
8049
- return pt(t) && mt(t), e;
8337
+ return Lt(t) && Rt(t), e;
8050
8338
  } }
8051
8339
  },
8052
8340
  startup: {
8053
8341
  typeset: !1,
8054
8342
  ready: () => {
8055
- let e = y(), r = e?.startup, i = pt(e);
8056
- i && (mt(e), ht(e, s.speechLocales), f(e?._?.a11y?.sre_ts?.locales, s.speechLocales)), r?.defaultReady?.(), i && (gt(r?.document), r?.document?.addStyles?.(rt), Je(r?.document)), Promise.resolve(r?.promise).then(() => t(), n);
8343
+ let e = y(), r = e?.startup, i = Lt(e);
8344
+ i && (Rt(e), zt(e, s.speechLocales), f(e?._?.a11y?.sre_ts?.locales, s.speechLocales)), r?.defaultReady?.(), i && (Bt(r?.document), Vt(r?.document), r?.document?.addStyles?.(wt), mt(r?.document)), Promise.resolve(r?.promise).then(() => t(), n);
8057
8345
  }
8058
8346
  },
8059
- tex: { macros: { ...Ye } },
8347
+ tex: { macros: { ...ht } },
8060
8348
  output: { displayOverflow: "linebreak" },
8061
8349
  options: {
8062
8350
  enableMenu: i,
@@ -8068,7 +8356,7 @@ function ft(e) {
8068
8356
  a11y: { inTabOrder: !1 }
8069
8357
  }
8070
8358
  };
8071
- r && c.tex && (console.warn(Xe), c.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], c.tex.processEscapes = !0), a || (c.chtml = { fontURL: "" });
8359
+ r && c.tex && (console.warn(gt), c.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], c.tex.processEscapes = !0), a || (c.chtml = { fontURL: "" });
8072
8360
  let l = p(s.speechLocales);
8073
8361
  l && c.options && (c.options.sre = { locale: l }), ae(c, {
8074
8362
  ...s,
@@ -8078,77 +8366,86 @@ function ft(e) {
8078
8366
  }, n);
8079
8367
  });
8080
8368
  }
8081
- function pt(e) {
8369
+ function Lt(e) {
8082
8370
  return !!e?.version?.startsWith("4.");
8083
8371
  }
8084
- function mt(e) {
8372
+ function Rt(e) {
8085
8373
  let t = e?._?.output, n = t?.chtml_ts?.CHTML;
8086
8374
  n && (n.STYLESHEETID = b);
8087
8375
  let r = t?.svg_ts?.SVG;
8088
- r && (r.STYLESHEETID = nt);
8376
+ r && (r.STYLESHEETID = Ct);
8089
8377
  }
8090
- function ht(e, t) {
8378
+ function zt(e, t) {
8091
8379
  let n = e?._?.ui?.menu?.Menu?.Menu;
8092
8380
  if (n) {
8093
- n.MENU_STORAGE = R;
8381
+ n.MENU_STORAGE = Y;
8094
8382
  try {
8095
- let e = localStorage.getItem(R);
8383
+ let e = localStorage.getItem(Y);
8096
8384
  if (!e) return;
8097
8385
  let { assistiveMml: n, locale: r, ...i } = JSON.parse(e), a = r === void 0 || !t || t.has(r);
8098
8386
  if (n === void 0 && a) return;
8099
- a && r !== void 0 && (i.locale = r), Object.keys(i).length ? localStorage.setItem(R, JSON.stringify(i)) : localStorage.removeItem(R);
8387
+ a && r !== void 0 && (i.locale = r), Object.keys(i).length ? localStorage.setItem(Y, JSON.stringify(i)) : localStorage.removeItem(Y);
8100
8388
  } catch {}
8101
8389
  }
8102
8390
  }
8103
- function gt(e) {
8391
+ function Bt(e) {
8104
8392
  if (!e) return;
8105
8393
  let t = /* @__PURE__ */ new WeakSet(), n = (e) => {
8106
8394
  let n = e.typesetRoot;
8107
- !n || t.has(n) || (z(n), t.add(n));
8395
+ !n || t.has(n) || (X(n), t.add(n));
8108
8396
  };
8109
- e.addRenderAction?.("pie-strip-latex", at, (e) => {
8397
+ e.addRenderAction?.("pie-strip-latex", Et, (e) => {
8110
8398
  for (let t of e.math ?? []) n(t);
8111
8399
  return !1;
8112
8400
  }, (e) => {
8113
8401
  let t = e.typesetRoot;
8114
- return t && z(t), !1;
8402
+ return t && X(t), !1;
8115
8403
  });
8116
8404
  let r = e.outputJax?.chtmlStyles;
8117
- r?.id === tt && (r.id = b), yt();
8405
+ r?.id === St && (r.id = b), Ut();
8406
+ }
8407
+ function Vt(e) {
8408
+ let t = (e) => {
8409
+ e.typesetRoot && ut(e.typesetRoot);
8410
+ };
8411
+ e?.addRenderAction?.("pie-name-math", Dt, (e) => {
8412
+ for (let n of e.math ?? []) t(n);
8413
+ return !1;
8414
+ }, (e) => (t(e), !1));
8118
8415
  }
8119
- function _t(e) {
8416
+ function Z(e) {
8120
8417
  return e instanceof HTMLStyleElement && se.includes(e.id);
8121
8418
  }
8122
- function vt(e) {
8419
+ function Ht(e) {
8123
8420
  ne("foreign-output-stylesheet", `another MathJax added <style id="${e.id}"> to <head>`);
8124
8421
  }
8125
- function yt() {
8126
- let e = document.head, t = [...e.children].find(_t);
8422
+ function Ut() {
8423
+ let e = document.head, t = [...e.children].find(Z);
8127
8424
  if (t) {
8128
- vt(t);
8425
+ Ht(t);
8129
8426
  return;
8130
8427
  }
8131
8428
  let n = new MutationObserver((e) => {
8132
8429
  for (let t of e) {
8133
- let e = [...t.addedNodes].find(_t);
8430
+ let e = [...t.addedNodes].find(Z);
8134
8431
  if (e) {
8135
- vt(e), n.disconnect();
8432
+ Ht(e), n.disconnect();
8136
8433
  return;
8137
8434
  }
8138
8435
  }
8139
8436
  });
8140
8437
  n.observe(e, { childList: !0 });
8141
8438
  }
8142
- function bt(e) {
8439
+ function Wt(e) {
8143
8440
  let t = e?.math;
8144
8441
  if (!t?.remove) return;
8145
- let n = [...t].filter((e) => (e.state?.() ?? 0) >= it && e.typesetRoot?.isConnected === !1);
8442
+ let n = [...t].filter((e) => (e.state?.() ?? 0) >= Tt && e.typesetRoot?.isConnected === !1);
8146
8443
  if (n.length !== 0) {
8147
8444
  for (let e of [...n].reverse()) e.clear?.();
8148
8445
  t.remove(...n);
8149
8446
  }
8150
8447
  }
8151
- function xt(e) {
8448
+ function Gt(e) {
8152
8449
  return new Promise((t, n) => {
8153
8450
  let r = e.startup ?? {};
8154
8451
  e.startup = r;
@@ -8159,110 +8456,82 @@ function xt(e) {
8159
8456
  };
8160
8457
  });
8161
8458
  }
8162
- function St(e) {
8459
+ function Kt(e) {
8163
8460
  let t = y();
8164
- return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : xt(t) : ft(e);
8461
+ return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : Gt(t) : It(e);
8165
8462
  }
8166
- function Ct(e) {
8167
- return St(e).then(() => {
8463
+ function qt(e) {
8464
+ return Kt(e).then(() => {
8168
8465
  let e = y();
8169
8466
  e && typeof e.typesetPromise != "function" && console.warn("[mathjax-renderer] MathJax on this page has no typesetPromise; math stays untypeset.");
8170
8467
  });
8171
8468
  }
8172
- function wt(e) {
8173
- let t = oe, n = t[L];
8174
- return n || (n = Ct(e), t[L] = n), n;
8469
+ function Jt(e) {
8470
+ let t = oe, n = t[xt];
8471
+ return n || (n = qt(e), t[xt] = n), n;
8175
8472
  }
8176
- function Tt(e = {}) {
8473
+ function Yt(e = {}) {
8177
8474
  let t = e.useSingleDollar ?? !1;
8178
8475
  return async (n) => {
8179
8476
  if (typeof window > "u") return;
8180
8477
  let r = ce();
8181
- r && ne("mathjax-3-global", `window.MathJax is MathJax ${r}`), lt(n), de(n), ut(n), Be(n);
8182
- let i = wt(e);
8183
- if (!dt(n, t)) {
8478
+ r && ne("mathjax-3-global", `window.MathJax is MathJax ${r}`), Nt(n), fe(n), Pt(n), Ie(n);
8479
+ let i = Jt(e);
8480
+ if (!Ft(n, t)) {
8184
8481
  i.catch(() => {});
8185
8482
  return;
8186
8483
  }
8187
8484
  await i;
8188
8485
  let a = y();
8189
8486
  if (await a?.startup?.promise, typeof a?.typesetPromise == "function") {
8190
- Ge(), bt(a.startup?.document);
8487
+ Ve(), Wt(a.startup?.document);
8191
8488
  try {
8192
8489
  await a.typesetPromise([n]);
8193
8490
  } catch (e) {
8194
8491
  throw a.typesetClear?.([n]), e;
8195
8492
  }
8196
- z(n);
8493
+ X(n), J(n);
8197
8494
  }
8198
8495
  };
8199
8496
  }
8200
- var kt = {
8201
- "(": "open parenthesis",
8202
- "[": "open bracket",
8203
- "{": "open brace",
8204
- "⟨": "open angle bracket",
8205
- "⌊": "open floor",
8206
- "⌈": "open ceiling"
8207
- };
8208
- var At = {
8209
- ")": "close parenthesis",
8210
- "]": "close bracket",
8211
- "}": "close brace",
8212
- "⟩": "close angle bracket",
8213
- "⌋": "close floor",
8214
- "⌉": "close ceiling"
8215
- };
8216
- var H = {
8217
- "!": "factorial",
8218
- "%": "percent",
8219
- "°": "degrees",
8220
- "′": "prime",
8221
- "″": "double prime"
8222
- };
8223
- ({
8224
- ...kt,
8225
- ...At,
8226
- ...H
8227
- });
8228
- var $t = "@pie-lib/math-rendering";
8229
- var en = "@pie-lib/math-rendering@2";
8230
- var tn = "pie-print";
8231
- var nn = 50;
8232
- var rn = 1e4;
8233
- var an = null;
8234
- function on() {
8235
- return !!window[en]?.opts?.useSingleDollar;
8497
+ var Zt = "@pie-lib/math-rendering";
8498
+ var Qt = "@pie-lib/math-rendering@2";
8499
+ var $t = "pie-print";
8500
+ var en = 50;
8501
+ var tn = 1e4;
8502
+ var nn = null;
8503
+ function rn() {
8504
+ return !!window[Qt]?.opts?.useSingleDollar;
8236
8505
  }
8237
- function sn() {
8238
- return an || (an = Tt({ useSingleDollar: on() })), an;
8506
+ function an() {
8507
+ return nn || (nn = Yt({ useSingleDollar: rn() })), nn;
8239
8508
  }
8240
8509
  function Q() {
8241
8510
  if (typeof window > "u") return null;
8242
- let e = window[$t];
8511
+ let e = window[Zt];
8243
8512
  return typeof e?.renderMath == "function" && e.renderMath !== $ ? e : null;
8244
8513
  }
8245
- function cn(e) {
8514
+ function on(e) {
8246
8515
  let t = e;
8247
8516
  for (; t;) {
8248
- if (t instanceof Element && t.localName === tn) return t;
8517
+ if (t instanceof Element && t.localName === $t) return t;
8249
8518
  t = t instanceof ShadowRoot ? t.host : t.parentNode;
8250
8519
  }
8251
8520
  return null;
8252
8521
  }
8253
- function ln() {
8522
+ function sn() {
8254
8523
  let e = window.renderMath;
8255
8524
  return typeof e == "function" ? e : null;
8256
8525
  }
8257
- async function un(e) {
8258
- let t = cn(e);
8526
+ async function cn(e) {
8527
+ let t = on(e);
8259
8528
  if (!t) return null;
8260
- let n = ln();
8529
+ let n = sn();
8261
8530
  if (n || t.mathRenderingModuleUrlImported !== !0) return n;
8262
- let r = Date.now() + rn;
8531
+ let r = Date.now() + tn;
8263
8532
  for (; Date.now() < r;) {
8264
- await new Promise((e) => setTimeout(e, nn));
8265
- let e = ln();
8533
+ await new Promise((e) => setTimeout(e, en));
8534
+ let e = sn();
8266
8535
  if (e) return e;
8267
8536
  }
8268
8537
  return null;
@@ -8271,8 +8540,8 @@ var $ = async (e) => {
8271
8540
  if (typeof window > "u") return;
8272
8541
  let t = typeof e == "string", n;
8273
8542
  t ? (n = document.createElement("div"), n.innerHTML = e) : n = e || document.body;
8274
- let r = Q(), i = r || t ? null : await un(n);
8275
- return r ? await r.renderMath?.(n) : i && i !== $ ? await i(n) : await sn()(n), t ? n.innerHTML : void 0;
8543
+ let r = Q(), i = r || t ? null : await cn(n);
8544
+ return r ? (await r.renderMath?.(n), J(n)) : i && i !== $ ? (await i(n), J(n)) : await an()(n), t ? n.innerHTML : void 0;
8276
8545
  };
8277
8546
  //#endregion
8278
8547
  //#region src/controller/plain-text.ts