@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.
@@ -7379,7 +7379,7 @@ var H$1 = [
7379
7379
  "style",
7380
7380
  "foreignobject"
7381
7381
  ];
7382
- var U = [
7382
+ var U$1 = [
7383
7383
  "onerror",
7384
7384
  "onload",
7385
7385
  "onclick",
@@ -7398,7 +7398,7 @@ var U = [
7398
7398
  "formaction",
7399
7399
  "xlink:href"
7400
7400
  ];
7401
- var W = /* @__PURE__ */ new Set([
7401
+ var W$1 = /* @__PURE__ */ new Set([
7402
7402
  "iframe",
7403
7403
  "object",
7404
7404
  "mstack",
@@ -7412,8 +7412,8 @@ var W = /* @__PURE__ */ new Set([
7412
7412
  "annotation",
7413
7413
  "none"
7414
7414
  ]);
7415
- var G = /^[a-z_][\w.-]*:[a-z][\w.-]*$/;
7416
- var K = [
7415
+ var G$1 = /^[a-z_][\w.-]*:[a-z][\w.-]*$/;
7416
+ var K$1 = [
7417
7417
  "alignment",
7418
7418
  "target",
7419
7419
  "allow",
@@ -7434,13 +7434,13 @@ var K = [
7434
7434
  "mslinethickness",
7435
7435
  "linebreak"
7436
7436
  ];
7437
- var q = /^\s*document\.getElementById\((['"])([^'"]+)\1\)\.play\(\)\s*;?\s*(?:return\s+false\s*;?\s*)?$/;
7438
- var J = "data-pie-play-audio";
7439
- var Y = {
7440
- ADD_TAGS: (e) => W.has(e) || G.test(e),
7441
- ADD_ATTR: K,
7437
+ var q$1 = /^\s*document\.getElementById\((['"])([^'"]+)\1\)\.play\(\)\s*;?\s*(?:return\s+false\s*;?\s*)?$/;
7438
+ var J$1 = "data-pie-play-audio";
7439
+ var Y$1 = {
7440
+ ADD_TAGS: (e) => W$1.has(e) || G$1.test(e),
7441
+ ADD_ATTR: K$1,
7442
7442
  FORBID_TAGS: H$1,
7443
- FORBID_ATTR: U,
7443
+ FORBID_ATTR: U$1,
7444
7444
  ALLOW_UNKNOWN_PROTOCOLS: !1,
7445
7445
  RETURN_TRUSTED_TYPE: !1
7446
7446
  };
@@ -7448,7 +7448,7 @@ var te$1 = !1;
7448
7448
  function ne$1(e) {
7449
7449
  for (let t of e.composedPath()) {
7450
7450
  if (!(t instanceof Element)) continue;
7451
- let n = t.getAttribute(J);
7451
+ let n = t.getAttribute(J$1);
7452
7452
  if (n === null) continue;
7453
7453
  e.preventDefault();
7454
7454
  let r = t.getRootNode().getElementById?.(n) ?? document.getElementById(n);
@@ -7456,25 +7456,25 @@ function ne$1(e) {
7456
7456
  return;
7457
7457
  }
7458
7458
  }
7459
- var X = null;
7459
+ var X$1 = null;
7460
7460
  function re$1() {
7461
- return X || (X = purify_default(window), X.addHook("beforeSanitizeAttributes", (e) => {
7461
+ return X$1 || (X$1 = purify_default(window), X$1.addHook("beforeSanitizeAttributes", (e) => {
7462
7462
  if (e.nodeName !== "A") return;
7463
- let t = q.exec(e.getAttribute("onclick") ?? "")?.[2];
7463
+ let t = q$1.exec(e.getAttribute("onclick") ?? "")?.[2];
7464
7464
  t !== void 0 && (e.removeAttribute("onclick"), e.setAttribute("data-pie-play-audio", t), te$1 || (te$1 = (document.addEventListener("click", ne$1), !0)));
7465
- }), X.addHook("afterSanitizeAttributes", v$1), X);
7465
+ }), X$1.addHook("afterSanitizeAttributes", v$1), X$1);
7466
7466
  }
7467
- var Z = 1e6;
7467
+ var Z$1 = 1e6;
7468
7468
  var Q$1 = /* @__PURE__ */ new Map();
7469
7469
  var $$1 = 0;
7470
7470
  function ie$1(t) {
7471
7471
  if (t == null || t === "" || !purify_default.isSupported) return "";
7472
7472
  let n = typeof t == "string" ? t : String(t), r = Q$1.get(n);
7473
7473
  if (r !== void 0) return r;
7474
- let i = String(re$1().sanitize(n, Y)), a = n.length + i.length;
7475
- if (a > Z) return i;
7474
+ let i = String(re$1().sanitize(n, Y$1)), a = n.length + i.length;
7475
+ if (a > Z$1) return i;
7476
7476
  for (let [e, t] of Q$1) {
7477
- if ($$1 + a <= Z) break;
7477
+ if ($$1 + a <= Z$1) break;
7478
7478
  Q$1.delete(e), $$1 -= e.length + t.length;
7479
7479
  }
7480
7480
  return Q$1.set(n, i), $$1 += a, i;
@@ -7623,82 +7623,82 @@ var oe = globalThis;
7623
7623
  var b = "PIE-MJX-CHTML-styles";
7624
7624
  var se = ["MJX-CHTML-styles", "MJX-SVG-styles"];
7625
7625
  var ce = re;
7626
- var x = "http://www.w3.org/1998/Math/MathML";
7627
- var le = /^([a-z_][\w.-]*):math$/;
7628
- var ue = /^[a-z][a-z0-9-]*$/;
7629
- function de(e) {
7626
+ var le = "http://www.w3.org/1998/Math/MathML";
7627
+ var ue = /^([a-z_][\w.-]*):math$/;
7628
+ var de = /^[a-z][a-z0-9-]*$/;
7629
+ function fe(e) {
7630
7630
  for (let t of e.querySelectorAll("*")) {
7631
- let n = le.exec(t.tagName.toLowerCase())?.[1];
7632
- !n || !e.contains(t) || t.closest("mjx-container") || t.replaceWith(S(t, `${n}:`));
7631
+ let n = ue.exec(t.tagName.toLowerCase())?.[1];
7632
+ !n || !e.contains(t) || t.closest("mjx-container") || t.replaceWith(pe(t, `${n}:`));
7633
7633
  }
7634
7634
  }
7635
- function S(e, t) {
7635
+ function pe(e, t) {
7636
7636
  let n = e.tagName.toLowerCase().slice(t.length);
7637
- if (!ue.test(n)) return e;
7638
- let r = e.ownerDocument.createElementNS(x, n);
7637
+ if (!de.test(n)) return e;
7638
+ let r = e.ownerDocument.createElementNS(le, n);
7639
7639
  for (let t of e.attributes) r.setAttribute(t.name, t.value);
7640
7640
  for (let n of [...e.childNodes]) {
7641
7641
  let e = n instanceof Element && n.tagName.toLowerCase().startsWith(t);
7642
- r.appendChild(e ? S(n, t) : n);
7642
+ r.appendChild(e ? pe(n, t) : n);
7643
7643
  }
7644
7644
  return r;
7645
7645
  }
7646
- var fe = /* @__PURE__ */ new Set([
7646
+ var me = /* @__PURE__ */ new Set([
7647
7647
  "updiagonalstrike",
7648
7648
  "downdiagonalstrike",
7649
7649
  "verticalstrike",
7650
7650
  "horizontalstrike"
7651
7651
  ]);
7652
- var pe = {
7652
+ var he = {
7653
7653
  thin: "0.035em",
7654
7654
  medium: "0.07em",
7655
7655
  thick: "0.14em"
7656
7656
  };
7657
- var me = {
7657
+ var ge = {
7658
7658
  tight: "0em",
7659
7659
  medium: "0.1em",
7660
7660
  loose: "0.2em"
7661
7661
  };
7662
- var he = /^(\d+(\.\d*)?|\.\d+)(em|ex|px|pt|pc|in|cm|mm)$/;
7663
- var ge = /^(#[0-9a-f]{3,8}|[a-z]+)$/i;
7664
- var _e$1 = /^(\d+(\.\d*)?|\.\d+)$/;
7665
- var ve = /* @__PURE__ */ new Set([
7662
+ var _e$1 = /^(\d+(\.\d*)?|\.\d+)(em|ex|px|pt|pc|in|cm|mm)$/;
7663
+ var ve = /^(#[0-9a-f]{3,8}|[a-z]+)$/i;
7664
+ var ye = /^(\d+(\.\d*)?|\.\d+)$/;
7665
+ var be = /* @__PURE__ */ new Set([
7666
7666
  "mn",
7667
7667
  "mo",
7668
7668
  "mi",
7669
7669
  "mtext"
7670
7670
  ]);
7671
- var ye = /* @__PURE__ */ new Set([
7671
+ var xe = /* @__PURE__ */ new Set([
7672
7672
  "stackalign",
7673
7673
  "charalign",
7674
7674
  "charspacing",
7675
7675
  "longdivstyle"
7676
7676
  ]);
7677
- function C(e, t, n = [], r = {}) {
7678
- let i = e.createElementNS(x, t);
7677
+ function x(e, t, n = [], r = {}) {
7678
+ let i = e.createElementNS(le, t);
7679
7679
  for (let [e, t] of Object.entries(r)) i.setAttribute(e, t);
7680
7680
  for (let e of n) e && i.appendChild(e);
7681
7681
  return i;
7682
7682
  }
7683
- function w(e, t) {
7684
- let n = C(e.document, "mo");
7683
+ function S(e, t) {
7684
+ let n = x(e.document, "mo");
7685
7685
  return n.textContent = t, n;
7686
7686
  }
7687
- function be(e) {
7688
- let t = C(e.document, "mn");
7689
- return t.textContent = "0", C(e.document, "mphantom", [t]);
7687
+ function Se(e) {
7688
+ let t = x(e.document, "mn");
7689
+ return t.textContent = "0", x(e.document, "mphantom", [t]);
7690
7690
  }
7691
- function T(e, t) {
7691
+ function C(e, t) {
7692
7692
  return e.getAttribute(t)?.trim().toLowerCase() || void 0;
7693
7693
  }
7694
- function E(e, t) {
7694
+ function w(e, t) {
7695
7695
  let n = Number.parseInt(e.getAttribute(t) ?? "", 10);
7696
7696
  return Number.isFinite(n) ? n : 0;
7697
7697
  }
7698
- function D(e) {
7698
+ function T(e) {
7699
7699
  return e.localName === "none" || e.localName === "mrow" && e.children.length === 0 && !e.textContent?.trim();
7700
7700
  }
7701
- function O(e, t, n = e) {
7701
+ function E(e, t, n = e) {
7702
7702
  switch (t) {
7703
7703
  case "left": return 0;
7704
7704
  case "center": return Math.floor(e / 2);
@@ -7706,14 +7706,14 @@ function O(e, t, n = e) {
7706
7706
  default: return n;
7707
7707
  }
7708
7708
  }
7709
- function k(e, t, n) {
7709
+ function D(e, t, n) {
7710
7710
  let r = [], i, a, o = (e, t) => {
7711
7711
  let s = (e) => t.reduceRight((e, t) => {
7712
7712
  let n = t.cloneNode(!1);
7713
7713
  return n.appendChild(e), n;
7714
7714
  }, e);
7715
7715
  if (e.localName === "mstyle") for (let n of [...e.children]) o(n, [...t, e]);
7716
- else if (D(e)) r.push(null);
7716
+ else if (T(e)) r.push(null);
7717
7717
  else if (e.localName === "mn" && e.children.length === 0) {
7718
7718
  let t = [...(e.textContent ?? "").trim()];
7719
7719
  for (let a of t) {
@@ -7722,28 +7722,28 @@ function k(e, t, n) {
7722
7722
  t.textContent = a, r.push(s(t));
7723
7723
  }
7724
7724
  t.length && (a ?? (a = r.length));
7725
- } else ve.has(e.localName) && e.textContent?.trim() === n.decimalPoint && (i ?? (i = r.length)), r.push(s(e));
7725
+ } else be.has(e.localName) && e.textContent?.trim() === n.decimalPoint && (i ?? (i = r.length)), r.push(s(e));
7726
7726
  };
7727
7727
  for (let t of e) o(t, []);
7728
7728
  return {
7729
7729
  kind: "digits",
7730
7730
  cells: r,
7731
- anchor: O(r.length, n.stackAlign, i ?? a),
7731
+ anchor: E(r.length, n.stackAlign, i ?? a),
7732
7732
  position: t
7733
7733
  };
7734
7734
  }
7735
- function xe(e) {
7736
- return (e ?? "").toLowerCase().split(/\s+/).filter((e) => fe.has(e));
7735
+ function O(e) {
7736
+ return (e ?? "").toLowerCase().split(/\s+/).filter((e) => me.has(e));
7737
7737
  }
7738
- function Se(e, t) {
7739
- let n = [...e.children].filter((e) => !D(e));
7740
- return n.length <= 1 ? n[0] ?? null : C(t.document, "mrow", n);
7738
+ function Ce(e, t) {
7739
+ let n = [...e.children].filter((e) => !T(e));
7740
+ return n.length <= 1 ? n[0] ?? null : x(t.document, "mrow", n);
7741
7741
  }
7742
- function Ce(e, t, n) {
7743
- let r = T(e, "location") ?? "n", i = xe(e.getAttribute("crossout")), a = [...e.children].map((e) => D(e) ? null : e.localName === "mscarry" ? {
7744
- content: Se(e, n),
7745
- location: T(e, "location") ?? r,
7746
- crossout: e.hasAttribute("crossout") ? xe(e.getAttribute("crossout")) : i
7742
+ function we(e, t, n) {
7743
+ let r = C(e, "location") ?? "n", i = O(e.getAttribute("crossout")), a = [...e.children].map((e) => T(e) ? null : e.localName === "mscarry" ? {
7744
+ content: Ce(e, n),
7745
+ location: C(e, "location") ?? r,
7746
+ crossout: e.hasAttribute("crossout") ? O(e.getAttribute("crossout")) : i
7747
7747
  } : {
7748
7748
  content: e,
7749
7749
  location: r,
@@ -7752,60 +7752,60 @@ function Ce(e, t, n) {
7752
7752
  return {
7753
7753
  kind: "carries",
7754
7754
  carries: a,
7755
- anchor: O(a.length, n.stackAlign),
7755
+ anchor: E(a.length, n.stackAlign),
7756
7756
  position: t,
7757
- scale: _e$1.test(o) ? o : "0.6"
7757
+ scale: ye.test(o) ? o : "0.6"
7758
7758
  };
7759
7759
  }
7760
- function we(e) {
7761
- let t = T(e, "mslinethickness") ?? "medium", n = pe[t] ?? (he.test(t) ? t : "0.07em"), r = e.getAttribute("mathcolor")?.trim() ?? "";
7762
- return `${n} solid ${ge.test(r) ? r : "currentColor"}`;
7760
+ function k(e) {
7761
+ let t = C(e, "mslinethickness") ?? "medium", n = he[t] ?? (_e$1.test(t) ? t : "0.07em"), r = e.getAttribute("mathcolor")?.trim() ?? "";
7762
+ return `${n} solid ${ve.test(r) ? r : "currentColor"}`;
7763
7763
  }
7764
7764
  function Te(e, t, n) {
7765
- let r = Math.max(0, E(e, "length"));
7765
+ let r = Math.max(0, w(e, "length"));
7766
7766
  return {
7767
7767
  kind: "line",
7768
7768
  length: r,
7769
- anchor: O(r, n.stackAlign),
7769
+ anchor: E(r, n.stackAlign),
7770
7770
  position: t,
7771
- border: we(e)
7771
+ border: k(e)
7772
7772
  };
7773
7773
  }
7774
7774
  function A(e, t, n, r, i) {
7775
7775
  e.forEach((e, a) => {
7776
- let o = t + a * n + E(e, "position");
7776
+ let o = t + a * n + w(e, "position");
7777
7777
  switch (e.localName) {
7778
7778
  case "msgroup":
7779
- A([...e.children], o, E(e, "shift"), r, i);
7779
+ A([...e.children], o, w(e, "shift"), r, i);
7780
7780
  break;
7781
7781
  case "msline":
7782
7782
  i.push(Te(e, o, r));
7783
7783
  break;
7784
7784
  case "mscarries":
7785
- i.push(Ce(e, o, r));
7785
+ i.push(we(e, o, r));
7786
7786
  break;
7787
7787
  case "msrow":
7788
7788
  case "mrow":
7789
- i.push(k([...e.children], o, r));
7789
+ i.push(D([...e.children], o, r));
7790
7790
  break;
7791
- default: i.push(k([e], o, r));
7791
+ default: i.push(D([e], o, r));
7792
7792
  }
7793
7793
  });
7794
7794
  }
7795
7795
  function j(e) {
7796
7796
  return -e.anchor - e.position;
7797
7797
  }
7798
- function Ee(e) {
7798
+ function M(e) {
7799
7799
  return e.kind === "digits" ? e.cells.length : e.kind === "carries" ? e.carries.length : e.length;
7800
7800
  }
7801
- function De(e) {
7802
- return j(e) + Ee(e) - 1;
7801
+ function N(e) {
7802
+ return j(e) + M(e) - 1;
7803
7803
  }
7804
- function Oe(e, t, n, r) {
7805
- let i = (e) => C(r.document, "mpadded", [t], {
7804
+ function Ee(e, t, n, r) {
7805
+ let i = (e) => x(r.document, "mpadded", [t], {
7806
7806
  width: "0",
7807
7807
  ...e ? { lspace: e } : {}
7808
- }), a = (e, t) => C(r.document, e, t);
7808
+ }), a = (e, t) => x(r.document, e, t);
7809
7809
  switch (n) {
7810
7810
  case "s": return a("munder", [e, i("-0.5width")]);
7811
7811
  case "ne": return a("msup", [e, i()]);
@@ -7827,41 +7827,41 @@ function Oe(e, t, n, r) {
7827
7827
  default: return a("mover", [e, i("-0.5width")]);
7828
7828
  }
7829
7829
  }
7830
- function ke(e, t, n) {
7831
- let r = C(n.document, "menclose", [e], {
7830
+ function De(e, t, n) {
7831
+ let r = x(n.document, "menclose", [e], {
7832
7832
  notation: t.join(" "),
7833
7833
  "data-padding": "0.1em",
7834
7834
  "data-thickness": "0.067em"
7835
7835
  }), i = t.some((e) => e.endsWith("diagonalstrike")) ? .167 : t.includes("horizontalstrike") ? .1 : 0;
7836
- return i ? C(n.document, "mpadded", [r], {
7836
+ return i ? x(n.document, "mpadded", [r], {
7837
7837
  lspace: `-${i}em`,
7838
7838
  width: `-${2 * i}em`
7839
7839
  }) : r;
7840
7840
  }
7841
- function Ae(e, t, n, r, i) {
7842
- let a = e && t.crossout.length ? ke(e, t.crossout, i) : e;
7841
+ function Oe(e, t, n, r, i) {
7842
+ let a = e && t.crossout.length ? De(e, t.crossout, i) : e;
7843
7843
  if (!t.content) return a;
7844
- let o = C(i.document, "mstyle", [t.content], { scriptsizemultiplier: r });
7845
- return Oe(a ?? be(i), o, n, i);
7844
+ let o = x(i.document, "mstyle", [t.content], { scriptsizemultiplier: r });
7845
+ return Ee(a ?? Se(i), o, n, i);
7846
7846
  }
7847
- function je(e, t) {
7847
+ function P(e, t) {
7848
7848
  return e.carries[t - j(e)] ?? null;
7849
7849
  }
7850
- function Me(e, t, n, r) {
7850
+ function ke(e, t, n, r) {
7851
7851
  let i = e.content;
7852
7852
  n.forEach((e, a) => {
7853
- let o = n.length - 1 - a, s = n[o], c = je(s, t), l = n.slice(0, o).some((e) => je(e, t));
7853
+ let o = n.length - 1 - a, s = n[o], c = P(s, t), l = n.slice(0, o).some((e) => P(e, t));
7854
7854
  if (!c && !l) return;
7855
7855
  let u = c ?? {
7856
- content: be(r),
7856
+ content: Se(r),
7857
7857
  location: "n",
7858
7858
  crossout: []
7859
7859
  }, d = a === 0 ? u.location : "n";
7860
- i = Ae(i, u, d, s.scale, r);
7860
+ i = Oe(i, u, d, s.scale, r);
7861
7861
  }), e.content = i;
7862
7862
  }
7863
- function Ne(e, t) {
7864
- 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 }, () => ({
7863
+ function F(e, t) {
7864
+ 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 }, () => ({
7865
7865
  content: null,
7866
7866
  borders: {}
7867
7867
  })), 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) => {
@@ -7869,7 +7869,7 @@ function Ne(e, t) {
7869
7869
  e.cells.forEach((t, r) => {
7870
7870
  n[a + j(e) + r].content = t;
7871
7871
  }), u.length && n.forEach((e, n) => {
7872
- Me(e, n - a, u, t);
7872
+ ke(e, n - a, u, t);
7873
7873
  });
7874
7874
  for (let e of d) for (let t of l(e)) n[t].borders.top = e.border;
7875
7875
  u = [], d = [], s.set(e, o.length), o.push(n);
@@ -7889,43 +7889,43 @@ function Ne(e, t) {
7889
7889
  origin: a
7890
7890
  };
7891
7891
  }
7892
- function Pe(e, { rows: t }, n) {
7893
- let r = C(n.document, "mtable", t.map((e) => C(n.document, "mtr", e.map((e) => {
7892
+ function Ae(e, { rows: t }, n) {
7893
+ let r = x(n.document, "mtable", t.map((e) => x(n.document, "mtr", e.map((e) => {
7894
7894
  let t = Object.entries(e.borders).map(([e, t]) => `border-${e}:${t}`).join(";");
7895
- return C(n.document, "mtd", [e.content], {
7895
+ return x(n.document, "mtd", [e.content], {
7896
7896
  ...t ? { style: t } : {},
7897
7897
  ...e.align ? { columnalign: e.align } : {}
7898
7898
  });
7899
7899
  }))));
7900
- for (let { name: t, value: n } of [...e.attributes]) ye.has(t) || r.setAttribute(t, n);
7901
- let i = T(e, "charspacing") ?? "medium", a = T(e, "charalign");
7902
- 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;
7900
+ for (let { name: t, value: n } of [...e.attributes]) xe.has(t) || r.setAttribute(t, n);
7901
+ let i = C(e, "charspacing") ?? "medium", a = C(e, "charalign");
7902
+ return r.setAttribute("columnspacing", ge[i] ?? (_e$1.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;
7903
7903
  }
7904
- function Fe(e) {
7904
+ function je(e) {
7905
7905
  return {
7906
7906
  document: e.ownerDocument,
7907
- stackAlign: T(e, "stackalign") ?? "decimalpoint",
7907
+ stackAlign: C(e, "stackalign") ?? "decimalpoint",
7908
7908
  decimalPoint: e.closest("[decimalpoint]")?.getAttribute("decimalpoint")?.trim().charAt(0) || "."
7909
7909
  };
7910
7910
  }
7911
- function Ie(e) {
7912
- let t = Fe(e), n = [];
7913
- return A([...e.children], 0, 0, t, n), Pe(e, Ne(n, t), t);
7911
+ function Me(e) {
7912
+ let t = je(e), n = [];
7913
+ return A([...e.children], 0, 0, t, n), Ae(e, F(n, t), t);
7914
7914
  }
7915
- function M(e, t, n, r, i, a) {
7915
+ function I(e, t, n, r, i, a) {
7916
7916
  for (let o = n; o <= r; o++) e[t][o].borders[i] = a;
7917
7917
  }
7918
- function Le(e, t) {
7919
- let n = w(t, ")");
7920
- return n.setAttribute("minsize", "1.2em"), [C(t.document, "mrow", [e, C(t.document, "mspace", [], { width: "0.2em" })]), C(t.document, "mpadded", [n], {
7918
+ function Ne(e, t) {
7919
+ let n = S(t, ")");
7920
+ return n.setAttribute("minsize", "1.2em"), [x(t.document, "mrow", [e, x(t.document, "mspace", [], { width: "0.2em" })]), x(t.document, "mpadded", [n], {
7921
7921
  voffset: "0.1em",
7922
7922
  lspace: "-0.15em",
7923
7923
  depth: "-0.2em",
7924
7924
  height: "-0.2em"
7925
7925
  })];
7926
7926
  }
7927
- function Re(e) {
7928
- 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 = [];
7927
+ function Pe(e) {
7928
+ 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 = [];
7929
7929
  A(i, 0, 0, t, l);
7930
7930
  let u = l.find((e) => e.kind === "digits");
7931
7931
  u || (u = {
@@ -7938,51 +7938,51 @@ function Re(e) {
7938
7938
  u.cells.unshift(...e), u.anchor += e.length;
7939
7939
  }, p = (...e) => {
7940
7940
  let n = e.flatMap((e) => e ? e.localName === "mrow" ? [...e.children] : [e] : []);
7941
- u.cells.push(...k(n, 0, t).cells);
7941
+ u.cells.push(...D(n, 0, t).cells);
7942
7942
  };
7943
7943
  switch (s) {
7944
7944
  case "left/\\right":
7945
- f(a, w(t, "/")), p(w(t, "\\"), o);
7945
+ f(a, S(t, "/")), p(S(t, "\\"), o);
7946
7946
  break;
7947
7947
  case "left)(right":
7948
- f(a, w(t, ")")), p(w(t, "("), o);
7948
+ f(a, S(t, ")")), p(S(t, "("), o);
7949
7949
  break;
7950
7950
  case ":right=right":
7951
- p(w(t, ":"), a, w(t, "="), o);
7951
+ p(S(t, ":"), a, S(t, "="), o);
7952
7952
  break;
7953
7953
  case "righttop":
7954
7954
  case "stackedleftlinetop":
7955
7955
  case "lefttop":
7956
- 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));
7956
+ 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));
7957
7957
  break;
7958
7958
  }
7959
- 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)));
7959
+ 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)));
7960
7960
  switch (s) {
7961
7961
  case "left/\\right":
7962
7962
  case "left)(right":
7963
7963
  case ":right=right": break;
7964
7964
  case "righttop": {
7965
7965
  let e = h[g][_(u.cells.length - 1)];
7966
- e.borders.left = c, e.borders.bottom = c, M(h, g, _(0), _(u.cells.length - 1), "top", c);
7966
+ e.borders.left = c, e.borders.bottom = c, I(h, g, _(0), _(u.cells.length - 1), "top", c);
7967
7967
  break;
7968
7968
  }
7969
7969
  case "stackedleftlinetop": {
7970
7970
  let e = h[g][_(0)];
7971
- e.borders.right = c, e.borders.bottom = c, M(h, g, _(1), v, "top", c);
7971
+ e.borders.right = c, e.borders.bottom = c, I(h, g, _(1), v, "top", c);
7972
7972
  break;
7973
7973
  }
7974
7974
  case "stackedrightright":
7975
7975
  case "mediumstackedrightright":
7976
7976
  case "shortstackedrightright":
7977
7977
  case "stackedleftleft":
7978
- ze(h, g, s, a, o, c, t);
7978
+ Fe(h, g, s, a, o, c, t);
7979
7979
  break;
7980
- default: M(h, g, _(1), v, "top", c);
7980
+ default: I(h, g, _(1), v, "top", c);
7981
7981
  }
7982
- return Pe(e, m, t);
7982
+ return Ae(e, m, t);
7983
7983
  }
7984
- function ze(e, t, n, r, i, a, o) {
7985
- let s = n === "stackedleftleft", c = s ? "right" : "left", l = (e) => e && C(o.document, "mpadded", [e], {
7984
+ function Fe(e, t, n, r, i, a, o) {
7985
+ let s = n === "stackedleftleft", c = s ? "right" : "left", l = (e) => e && x(o.document, "mpadded", [e], {
7986
7986
  lspace: "0.2em",
7987
7987
  width: "+0.4em"
7988
7988
  });
@@ -8001,135 +8001,423 @@ function ze(e, t, n, r, i, a, o) {
8001
8001
  }) : 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);
8002
8002
  });
8003
8003
  }
8004
- function Be(e) {
8005
- for (let t of [...e.querySelectorAll("mstack, mlongdiv")]) !t.closest("math") || t.closest("mjx-container") || t.replaceWith(t.localName === "mstack" ? Ie(t) : Re(t));
8006
- }
8007
- var Ve = "PIE-MJX-explorer-styles";
8008
- var N = "var(--pie-text, black)";
8009
- var He = "var(--pie-background, #ffffff)";
8010
- var Ue = "var(--pie-border-dark, #66686A)";
8011
- var P = "var(--pie-focus-outline, var(--pie-button-focus-outline, var(--pie-focus-checked-border, #1565C0)))";
8012
- var F = `color-mix(in srgb, ${P} 15%, transparent)`;
8013
- var We = `
8004
+ function Ie(e) {
8005
+ for (let t of [...e.querySelectorAll("mstack, mlongdiv")]) !t.closest("math") || t.closest("mjx-container") || t.replaceWith(t.localName === "mstack" ? Me(t) : Pe(t));
8006
+ }
8007
+ var Le = "PIE-MJX-explorer-styles";
8008
+ var L = "var(--pie-text, black)";
8009
+ var Re = "var(--pie-background, #ffffff)";
8010
+ var ze = "var(--pie-border-dark, #66686A)";
8011
+ var R = "var(--pie-focus-outline, var(--pie-button-focus-outline, var(--pie-focus-checked-border, #1565C0)))";
8012
+ var z = `color-mix(in srgb, ${R} 15%, transparent)`;
8013
+ var Be = `
8014
8014
  :root mjx-container [data-sre-highlight-1]:not([data-mjx-collapsed], rect) {
8015
- color: ${N} !important;
8016
- fill: ${N} !important;
8015
+ color: ${L} !important;
8016
+ fill: ${L} !important;
8017
8017
  }
8018
8018
  :root mjx-container:not([data-mjx-clone-container]) [data-sre-highlight-1]:not([data-sre-enclosed], rect) {
8019
- background-color: ${F} !important;
8019
+ background-color: ${z} !important;
8020
8020
  }
8021
8021
  :root mjx-container rect[data-sre-highlight-1]:not([data-sre-enclosed]) {
8022
- fill: ${F} !important;
8022
+ fill: ${z} !important;
8023
8023
  }
8024
8024
  :root mjx-container .mjx-selected {
8025
- outline: 2px solid ${P} !important;
8025
+ outline: 2px solid ${R} !important;
8026
8026
  }
8027
8027
  :root mjx-container [data-sre-highlight-2] {
8028
- color: ${N} !important;
8028
+ color: ${L} !important;
8029
8029
  background-color: transparent !important;
8030
- fill: ${N} !important;
8031
- outline: 2px dashed ${P} !important;
8030
+ fill: ${L} !important;
8031
+ outline: 2px dashed ${R} !important;
8032
8032
  }
8033
8033
  :root mjx-container rect[data-sre-highlight-2] {
8034
8034
  fill: transparent !important;
8035
- stroke: ${P} !important;
8035
+ stroke: ${R} !important;
8036
8036
  stroke-width: 2px !important;
8037
8037
  vector-effect: non-scaling-stroke;
8038
8038
  }
8039
8039
  :root .MJX_LiveRegion, :root .MJX_HoverRegion, :root .MJX_ToolTip {
8040
- color: ${N} !important;
8041
- background-color: ${He} !important;
8042
- border-color: ${Ue} !important;
8040
+ color: ${L} !important;
8041
+ background-color: ${Re} !important;
8042
+ border-color: ${ze} !important;
8043
8043
  }
8044
8044
  :root .MJX_LiveRegion > div, :root .MJX_HoverRegion > div {
8045
- color: ${N} !important;
8046
- background-color: ${F} !important;
8045
+ color: ${L} !important;
8046
+ background-color: ${z} !important;
8047
8047
  }
8048
8048
  `;
8049
- function Ge(e = document) {
8049
+ function Ve(e = document) {
8050
8050
  if (e.getElementById("PIE-MJX-explorer-styles")) return;
8051
8051
  let t = e.createElement("style");
8052
- t.id = Ve, t.textContent = We, e.head.appendChild(t);
8052
+ t.id = Le, t.textContent = Be, e.head.appendChild(t);
8053
+ }
8054
+ var He = /[⁡-⁤]/g;
8055
+ var Ue = {
8056
+ "+": "positive",
8057
+ "-": "negative",
8058
+ "−": "negative",
8059
+ "±": "plus or minus",
8060
+ "∓": "minus or plus"
8061
+ };
8062
+ var We = {
8063
+ "(": "open parenthesis",
8064
+ "[": "open bracket",
8065
+ "{": "open brace",
8066
+ "⟨": "open angle bracket",
8067
+ "⌊": "open floor",
8068
+ "⌈": "open ceiling"
8069
+ };
8070
+ var Ge = {
8071
+ ")": "close parenthesis",
8072
+ "]": "close bracket",
8073
+ "}": "close brace",
8074
+ "⟩": "close angle bracket",
8075
+ "⌋": "close floor",
8076
+ "⌉": "close ceiling"
8077
+ };
8078
+ var B = {
8079
+ "!": "factorial",
8080
+ "%": "percent",
8081
+ "°": "degrees",
8082
+ "′": "prime",
8083
+ "″": "double prime"
8084
+ };
8085
+ var Ke = {
8086
+ "+": "plus",
8087
+ "-": "minus",
8088
+ "−": "minus",
8089
+ "±": "plus or minus",
8090
+ "∓": "minus or plus",
8091
+ "×": "times",
8092
+ "⋅": "times",
8093
+ "·": "times",
8094
+ "*": "times",
8095
+ "÷": "divided by",
8096
+ "/": "divided by",
8097
+ "=": "equals",
8098
+ "≠": "does not equal",
8099
+ "<": "is less than",
8100
+ ">": "is greater than",
8101
+ "≤": "is less than or equal to",
8102
+ "≥": "is greater than or equal to",
8103
+ "≈": "is approximately equal to",
8104
+ "≡": "is equivalent to",
8105
+ "∝": "is proportional to",
8106
+ "∈": "is an element of",
8107
+ "∉": "is not an element of",
8108
+ "⊂": "is a subset of",
8109
+ "⊆": "is a subset of or equal to",
8110
+ "∪": "union",
8111
+ "∩": "intersection",
8112
+ "→": "right arrow",
8113
+ "←": "left arrow",
8114
+ "⇒": "implies",
8115
+ "⇔": "if and only if",
8116
+ "∑": "sum",
8117
+ "∏": "product",
8118
+ "∫": "integral",
8119
+ "∞": "infinity",
8120
+ "∠": "angle",
8121
+ "⊥": "is perpendicular to",
8122
+ "∥": "is parallel to",
8123
+ "∴": "therefore",
8124
+ ",": "comma",
8125
+ ";": "semicolon",
8126
+ ":": "colon",
8127
+ "|": "vertical bar",
8128
+ "‖": "double vertical bar",
8129
+ ...We,
8130
+ ...Ge,
8131
+ ...B
8132
+ };
8133
+ var qe = /* @__PURE__ */ new Set(["|", "‖"]);
8134
+ var Je = /* @__PURE__ */ new Set([
8135
+ "∑",
8136
+ "∏",
8137
+ "∫",
8138
+ "∪",
8139
+ "∩"
8140
+ ]);
8141
+ var Ye = {
8142
+ α: "alpha",
8143
+ β: "beta",
8144
+ γ: "gamma",
8145
+ δ: "delta",
8146
+ ε: "epsilon",
8147
+ θ: "theta",
8148
+ λ: "lambda",
8149
+ μ: "mu",
8150
+ π: "pi",
8151
+ ρ: "rho",
8152
+ σ: "sigma",
8153
+ τ: "tau",
8154
+ φ: "phi",
8155
+ ω: "omega",
8156
+ Δ: "capital delta",
8157
+ Σ: "capital sigma",
8158
+ Ω: "capital omega",
8159
+ "∞": "infinity",
8160
+ sin: "sine",
8161
+ cos: "cosine",
8162
+ tan: "tangent",
8163
+ sec: "secant",
8164
+ csc: "cosecant",
8165
+ cot: "cotangent",
8166
+ ln: "natural log",
8167
+ lim: "limit"
8168
+ };
8169
+ var Xe = {
8170
+ "¯": "bar",
8171
+ "‾": "bar",
8172
+ "―": "bar",
8173
+ "^": "hat",
8174
+ ˆ: "hat",
8175
+ "~": "tilde",
8176
+ "˜": "tilde",
8177
+ "→": "vector",
8178
+ "⃗": "vector",
8179
+ "˙": "dot"
8180
+ };
8181
+ var V = (e) => (e.textContent ?? "").replace(He, "").replace(/\s+/g, " ").trim();
8182
+ var H = (e) => e.replace(/\s+/g, " ").trim();
8183
+ var U = (e) => [...e.children];
8184
+ function W(e) {
8185
+ return !e || [
8186
+ "mn",
8187
+ "mi",
8188
+ "mtext",
8189
+ "mo"
8190
+ ].includes(e.localName) ? !0 : ["mrow", "mstyle"].includes(e.localName) && e.children.length === 1 ? W(e.children[0]) : !1;
8191
+ }
8192
+ function Ze(e) {
8193
+ let t = e ? V(e) : "";
8194
+ return /^\d{1,3}$/.test(t) ? Number(t) : void 0;
8195
+ }
8196
+ function Qe(e) {
8197
+ return `${e}${e % 100 >= 11 && e % 100 <= 13 ? "th" : {
8198
+ 1: "st",
8199
+ 2: "nd",
8200
+ 3: "rd"
8201
+ }[e % 10] ?? "th"}`;
8202
+ }
8203
+ function $e(e) {
8204
+ return Ye[e] ?? e;
8205
+ }
8206
+ function G(e) {
8207
+ return Ke[e] ?? e;
8208
+ }
8209
+ function K(e) {
8210
+ let t = [], n = !1;
8211
+ for (let r of e) {
8212
+ if (r.localName !== "mo") {
8213
+ t.push(q(r)), n = !0;
8214
+ continue;
8215
+ }
8216
+ let e = V(r);
8217
+ 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));
8218
+ }
8219
+ return t.filter(Boolean).join(" ");
8220
+ }
8221
+ function et(e) {
8222
+ let [t, ...n] = e, r = n[n.length - 1], i = (e) => e?.localName === "mo" && ["|", "‖"].includes(V(e)), a = n.slice(0, -1);
8223
+ if (a.length && i(t) && i(r) && V(t) === V(r) && !a.some(i)) {
8224
+ let e = H(K(a));
8225
+ return V(t) === "|" ? `absolute value of ${e} end absolute value` : `norm of ${e} end norm`;
8226
+ }
8227
+ return K(e);
8228
+ }
8229
+ function tt(e, t) {
8230
+ let n = e ? q(e) : "", r = t ? q(t) : "";
8231
+ return W(e) && W(t) ? `${n} over ${r}` : `the fraction with numerator ${n} and denominator ${r}`;
8232
+ }
8233
+ function nt(e, t, n) {
8234
+ return n ? `${t} of ${e}` : `${t} of ${e} end root`;
8235
+ }
8236
+ function rt(e, t) {
8237
+ let n = t ? V(t) : "";
8238
+ if (t && W(t)) {
8239
+ if (n === "2") return `${e} squared`;
8240
+ if (n === "3") return `${e} cubed`;
8241
+ if (n in B) return `${e} ${B[n]}`;
8242
+ }
8243
+ let r = t ? q(t) : "";
8244
+ return W(t) ? `${e} to the power of ${r}` : `${e} to the power of ${r} end power`;
8245
+ }
8246
+ function it(e, t) {
8247
+ let n = t ? q(t) : "";
8248
+ return W(t) ? `${e} sub ${n}` : `${e} sub ${n} end sub`;
8249
+ }
8250
+ function at(e, t, n) {
8251
+ let r = V(e);
8252
+ if (r === "lim") return `limit as ${t ? q(t) : ""} of`;
8253
+ if (!Je.has(r)) return;
8254
+ let i = t ? `from ${q(t)}` : "", a = n ? `to ${q(n)}` : "";
8255
+ return `${G(r)} ${i} ${a} of`;
8256
+ }
8257
+ function ot(e) {
8258
+ 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(", ")}`);
8259
+ return `table with ${t.length} ${t.length === 1 ? "row" : "rows"} and ${r} ${r === 1 ? "column" : "columns"}. ${i.join(". ")}`;
8053
8260
  }
8054
- var I = Symbol.for("@pie-element/shared-math-rendering-mathjax/speech-worker-failed");
8055
- function Ke() {
8261
+ function st(e) {
8262
+ 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));
8263
+ return [
8264
+ G(t),
8265
+ ...i,
8266
+ G(n)
8267
+ ].filter(Boolean).join(" ");
8268
+ }
8269
+ function q(e) {
8270
+ let t = U(e);
8271
+ switch (e.localName) {
8272
+ case "mi": return $e(V(e));
8273
+ case "mn":
8274
+ case "mtext":
8275
+ case "ms": return V(e);
8276
+ case "mo": return G(V(e));
8277
+ case "mspace":
8278
+ case "mphantom":
8279
+ case "annotation":
8280
+ case "annotation-xml": return "";
8281
+ case "semantics": return t[0] ? q(t[0]) : "";
8282
+ case "mfrac": return tt(t[0], t[1]);
8283
+ case "msqrt": return nt(H(K(t)), "square root", t.length === 1 && W(t[0]));
8284
+ case "mroot": {
8285
+ 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]) : ""}`;
8286
+ return nt(t[0] ? q(t[0]) : "", n, W(t[0]));
8287
+ }
8288
+ case "msup": return rt(t[0] ? q(t[0]) : "", t[1]);
8289
+ case "msub": return it(t[0] ? q(t[0]) : "", t[1]);
8290
+ 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]);
8291
+ case "munder":
8292
+ case "mover":
8293
+ case "munderover": {
8294
+ 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;
8295
+ if (s) return s;
8296
+ let c = n ? q(n) : "", l = e.localName === "mover" && r ? Xe[V(r)] : void 0;
8297
+ return l ? l === "vector" ? `vector ${c}` : `${c} ${l}` : [
8298
+ c,
8299
+ a ? `with ${q(a)} below` : "",
8300
+ o ? `with ${q(o)} above` : ""
8301
+ ].filter(Boolean).join(" ");
8302
+ }
8303
+ case "mfenced": return st(e);
8304
+ case "mtable": return ot(e);
8305
+ case "mrow":
8306
+ case "math": return et(t);
8307
+ default: return t.length ? K(t) : V(e);
8308
+ }
8309
+ }
8310
+ function ct(e) {
8311
+ return H(q(e));
8312
+ }
8313
+ var lt = [
8314
+ "a[href]",
8315
+ "button",
8316
+ "label",
8317
+ "summary",
8318
+ ...[
8319
+ "button",
8320
+ "checkbox",
8321
+ "combobox",
8322
+ "link",
8323
+ "menuitem",
8324
+ "menuitemcheckbox",
8325
+ "menuitemradio",
8326
+ "option",
8327
+ "radio",
8328
+ "switch",
8329
+ "tab",
8330
+ "treeitem"
8331
+ ].map((e) => `[role="${e}"]`)
8332
+ ].join(", ");
8333
+ function ut(e) {
8334
+ if (e.hasAttribute("aria-label") || !e.closest(lt)) return;
8335
+ let t = e.querySelector("math"), n = t ? ct(t) : "";
8336
+ n && e.setAttribute("aria-label", n);
8337
+ }
8338
+ function J(e) {
8339
+ for (let t of e.querySelectorAll("mjx-container")) ut(t);
8340
+ }
8341
+ var dt = Symbol.for("@pie-element/shared-math-rendering-mathjax/speech-worker-failed");
8342
+ function ft() {
8056
8343
  let e = globalThis;
8057
- 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$3}`));
8344
+ 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$3}`));
8058
8345
  }
8059
- function qe(e) {
8346
+ function pt(e) {
8060
8347
  let t = e.webworker;
8061
8348
  if (!t || t.ready) return;
8062
8349
  e.options ?? (e.options = {});
8063
8350
  let n = e.options;
8064
- n.enableSpeech = !1, n.enableBraille = !1, n.speechError = () => {}, t.Post = () => Promise.reject(/* @__PURE__ */ Error("The speech worker did not start")), t.Terminate(), Ke();
8351
+ n.enableSpeech = !1, n.enableBraille = !1, n.speechError = () => {}, t.Post = () => Promise.reject(/* @__PURE__ */ Error("The speech worker did not start")), t.Terminate(), ft();
8065
8352
  }
8066
- function Je(e) {
8353
+ function mt(e) {
8067
8354
  let t = e?.adaptor, n = t?.createWorker;
8068
8355
  !e || !t || !n || (t.createWorker = async (r, i) => {
8069
8356
  let a = await n.call(t, r, i);
8070
- return a.addEventListener("error", () => qe(e), { once: !0 }), a;
8357
+ return a.addEventListener("error", () => pt(e), { once: !0 }), a;
8071
8358
  });
8072
8359
  }
8073
8360
  `${i}`;
8074
- var Ye = {
8361
+ var ht = {
8075
8362
  parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
8076
8363
  overarc: "\\overparen",
8077
8364
  napprox: "\\not\\approx",
8078
8365
  longdiv: "\\enclose{longdiv}",
8079
8366
  abs: ["\\left|#1\\right|", 1]
8080
8367
  };
8081
- var Xe = "[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)";
8082
- var Ze = /\\\(|\\\[|\$\$|\\\$|\\begin\{|\\(?:eq)?ref\{/;
8083
- var Qe = /\\\(|\\\[|\$|\\begin\{|\\(?:eq)?ref\{/;
8084
- var $e = /\\embed\{newLine\}\[\]/g;
8085
- var et = [
8368
+ var gt = "[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)";
8369
+ var _t = /\\\(|\\\[|\$\$|\\\$|\\begin\{|\\(?:eq)?ref\{/;
8370
+ var vt = /\\\(|\\\[|\$|\\begin\{|\\(?:eq)?ref\{/;
8371
+ var yt = /\\embed\{newLine\}\[\]/g;
8372
+ var bt = [
8086
8373
  ["$$", "$$"],
8087
8374
  ["$", "$"],
8088
8375
  ["\\[", "\\]"],
8089
8376
  ["\\(", "\\)"]
8090
8377
  ];
8091
- var L = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading");
8092
- var tt = "MJX-CHTML-styles";
8093
- var nt = "PIE-MJX-SVG-styles";
8094
- var R = "PIE-MathJax-Menu-Settings";
8095
- var rt = { "mjx-container[overflow=\"linebreak\"][display]": {
8378
+ var xt = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading");
8379
+ var St = "MJX-CHTML-styles";
8380
+ var Ct = "PIE-MJX-SVG-styles";
8381
+ var Y = "PIE-MathJax-Menu-Settings";
8382
+ var wt = { "mjx-container[overflow=\"linebreak\"][display]": {
8096
8383
  overflow: "auto clip",
8097
8384
  "min-width": "initial !important"
8098
8385
  } };
8099
- var it = 200;
8100
- var at = 201;
8101
- function z(e) {
8386
+ var Tt = 200;
8387
+ var Et = 201;
8388
+ var Dt = 202;
8389
+ function X(e) {
8102
8390
  let t = [...e.matches("mjx-container") ? [e] : [], ...e.querySelectorAll("mjx-container")];
8103
8391
  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");
8104
8392
  }
8105
- function B(e) {
8106
- for (let [t, n] of et) if (e.startsWith(t) && e.endsWith(n)) return e.substring(t.length, e.length - n.length);
8393
+ function Ot(e) {
8394
+ for (let [t, n] of bt) if (e.startsWith(t) && e.endsWith(n)) return e.substring(t.length, e.length - n.length);
8107
8395
  return e;
8108
8396
  }
8109
- function ot(e) {
8110
- return B(e.includes("\\displaystyle") ? e.replace("\\displaystyle", "").trim() : e);
8397
+ function kt(e) {
8398
+ return Ot(e.includes("\\displaystyle") ? e.replace("\\displaystyle", "").trim() : e);
8111
8399
  }
8112
- var st = "mathjax_ignore";
8113
- var V = "mathjax_process";
8114
- function ct(e, t) {
8115
- let n = e.closest(`.${st}, .${V}`);
8116
- return n !== null && t.contains(n) && !n.classList.contains(V);
8400
+ var At = "mathjax_ignore";
8401
+ var jt = "mathjax_process";
8402
+ function Mt(e, t) {
8403
+ let n = e.closest(`.${At}, .${jt}`);
8404
+ return n !== null && t.contains(n) && !n.classList.contains(jt);
8117
8405
  }
8118
- function lt(e) {
8406
+ function Nt(e) {
8119
8407
  for (let t of e.querySelectorAll("[data-latex]")) {
8120
- if (t.dataset.mathHandled || t.closest("mjx-container") || ct(t, e)) continue;
8408
+ if (t.dataset.mathHandled || t.closest("mjx-container") || Mt(t, e)) continue;
8121
8409
  let n = t.textContent;
8122
- n && (t.textContent = `\\(${ot(n)}\\)`.replace($e, "\\newline "), t.dataset.mathHandled = "true");
8410
+ n && (t.textContent = `\\(${kt(n)}\\)`.replace(yt, "\\newline "), t.dataset.mathHandled = "true");
8123
8411
  }
8124
8412
  }
8125
- function ut(e) {
8413
+ function Pt(e) {
8126
8414
  for (let t of e.querySelectorAll("math")) t.closest("mjx-container") || t.setAttribute("displaystyle", "true");
8127
8415
  }
8128
- function dt(e, t) {
8416
+ function Ft(e, t) {
8129
8417
  for (let t of e.querySelectorAll("math")) if (!t.closest("mjx-assistive-mml")) return !0;
8130
- return (t ? Qe : Ze).test(e.textContent ?? "");
8418
+ return (t ? vt : _t).test(e.textContent ?? "");
8131
8419
  }
8132
- function ft(e) {
8420
+ function It(e) {
8133
8421
  return new Promise((t, n) => {
8134
8422
  let { useSingleDollar: r = !1, accessibility: i = !0, loadFonts: a = !0, srcUrl: o } = e, s = d(e, import.meta.url), c = {
8135
8423
  loader: {
@@ -8137,17 +8425,17 @@ function ft(e) {
8137
8425
  failed: (e) => n(e),
8138
8426
  "output/svg": { ready: (e) => {
8139
8427
  let t = y();
8140
- return pt(t) && mt(t), e;
8428
+ return Lt(t) && Rt(t), e;
8141
8429
  } }
8142
8430
  },
8143
8431
  startup: {
8144
8432
  typeset: !1,
8145
8433
  ready: () => {
8146
- let e = y(), r = e?.startup, i = pt(e);
8147
- 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);
8434
+ let e = y(), r = e?.startup, i = Lt(e);
8435
+ 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);
8148
8436
  }
8149
8437
  },
8150
- tex: { macros: { ...Ye } },
8438
+ tex: { macros: { ...ht } },
8151
8439
  output: { displayOverflow: "linebreak" },
8152
8440
  options: {
8153
8441
  enableMenu: i,
@@ -8159,7 +8447,7 @@ function ft(e) {
8159
8447
  a11y: { inTabOrder: !1 }
8160
8448
  }
8161
8449
  };
8162
- r && c.tex && (console.warn(Xe), c.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], c.tex.processEscapes = !0), a || (c.chtml = { fontURL: "" });
8450
+ r && c.tex && (console.warn(gt), c.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], c.tex.processEscapes = !0), a || (c.chtml = { fontURL: "" });
8163
8451
  let l = p(s.speechLocales);
8164
8452
  l && c.options && (c.options.sre = { locale: l }), ae(c, {
8165
8453
  ...s,
@@ -8169,77 +8457,86 @@ function ft(e) {
8169
8457
  }, n);
8170
8458
  });
8171
8459
  }
8172
- function pt(e) {
8460
+ function Lt(e) {
8173
8461
  return !!e?.version?.startsWith("4.");
8174
8462
  }
8175
- function mt(e) {
8463
+ function Rt(e) {
8176
8464
  let t = e?._?.output, n = t?.chtml_ts?.CHTML;
8177
8465
  n && (n.STYLESHEETID = b);
8178
8466
  let r = t?.svg_ts?.SVG;
8179
- r && (r.STYLESHEETID = nt);
8467
+ r && (r.STYLESHEETID = Ct);
8180
8468
  }
8181
- function ht(e, t) {
8469
+ function zt(e, t) {
8182
8470
  let n = e?._?.ui?.menu?.Menu?.Menu;
8183
8471
  if (n) {
8184
- n.MENU_STORAGE = R;
8472
+ n.MENU_STORAGE = Y;
8185
8473
  try {
8186
- let e = localStorage.getItem(R);
8474
+ let e = localStorage.getItem(Y);
8187
8475
  if (!e) return;
8188
8476
  let { assistiveMml: n, locale: r, ...i } = JSON.parse(e), a = r === void 0 || !t || t.has(r);
8189
8477
  if (n === void 0 && a) return;
8190
- a && r !== void 0 && (i.locale = r), Object.keys(i).length ? localStorage.setItem(R, JSON.stringify(i)) : localStorage.removeItem(R);
8478
+ a && r !== void 0 && (i.locale = r), Object.keys(i).length ? localStorage.setItem(Y, JSON.stringify(i)) : localStorage.removeItem(Y);
8191
8479
  } catch {}
8192
8480
  }
8193
8481
  }
8194
- function gt(e) {
8482
+ function Bt(e) {
8195
8483
  if (!e) return;
8196
8484
  let t = /* @__PURE__ */ new WeakSet(), n = (e) => {
8197
8485
  let n = e.typesetRoot;
8198
- !n || t.has(n) || (z(n), t.add(n));
8486
+ !n || t.has(n) || (X(n), t.add(n));
8199
8487
  };
8200
- e.addRenderAction?.("pie-strip-latex", at, (e) => {
8488
+ e.addRenderAction?.("pie-strip-latex", Et, (e) => {
8201
8489
  for (let t of e.math ?? []) n(t);
8202
8490
  return !1;
8203
8491
  }, (e) => {
8204
8492
  let t = e.typesetRoot;
8205
- return t && z(t), !1;
8493
+ return t && X(t), !1;
8206
8494
  });
8207
8495
  let r = e.outputJax?.chtmlStyles;
8208
- r?.id === tt && (r.id = b), yt();
8496
+ r?.id === St && (r.id = b), Ut();
8497
+ }
8498
+ function Vt(e) {
8499
+ let t = (e) => {
8500
+ e.typesetRoot && ut(e.typesetRoot);
8501
+ };
8502
+ e?.addRenderAction?.("pie-name-math", Dt, (e) => {
8503
+ for (let n of e.math ?? []) t(n);
8504
+ return !1;
8505
+ }, (e) => (t(e), !1));
8209
8506
  }
8210
- function _t(e) {
8507
+ function Z(e) {
8211
8508
  return e instanceof HTMLStyleElement && se.includes(e.id);
8212
8509
  }
8213
- function vt(e) {
8510
+ function Ht(e) {
8214
8511
  ne("foreign-output-stylesheet", `another MathJax added <style id="${e.id}"> to <head>`);
8215
8512
  }
8216
- function yt() {
8217
- let e = document.head, t = [...e.children].find(_t);
8513
+ function Ut() {
8514
+ let e = document.head, t = [...e.children].find(Z);
8218
8515
  if (t) {
8219
- vt(t);
8516
+ Ht(t);
8220
8517
  return;
8221
8518
  }
8222
8519
  let n = new MutationObserver((e) => {
8223
8520
  for (let t of e) {
8224
- let e = [...t.addedNodes].find(_t);
8521
+ let e = [...t.addedNodes].find(Z);
8225
8522
  if (e) {
8226
- vt(e), n.disconnect();
8523
+ Ht(e), n.disconnect();
8227
8524
  return;
8228
8525
  }
8229
8526
  }
8230
8527
  });
8231
8528
  n.observe(e, { childList: !0 });
8232
8529
  }
8233
- function bt(e) {
8530
+ function Wt(e) {
8234
8531
  let t = e?.math;
8235
8532
  if (!t?.remove) return;
8236
- let n = [...t].filter((e) => (e.state?.() ?? 0) >= it && e.typesetRoot?.isConnected === !1);
8533
+ let n = [...t].filter((e) => (e.state?.() ?? 0) >= Tt && e.typesetRoot?.isConnected === !1);
8237
8534
  if (n.length !== 0) {
8238
8535
  for (let e of [...n].reverse()) e.clear?.();
8239
8536
  t.remove(...n);
8240
8537
  }
8241
8538
  }
8242
- function xt(e) {
8539
+ function Gt(e) {
8243
8540
  return new Promise((t, n) => {
8244
8541
  let r = e.startup ?? {};
8245
8542
  e.startup = r;
@@ -8250,110 +8547,82 @@ function xt(e) {
8250
8547
  };
8251
8548
  });
8252
8549
  }
8253
- function St(e) {
8550
+ function Kt(e) {
8254
8551
  let t = y();
8255
- return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : xt(t) : ft(e);
8552
+ return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : Gt(t) : It(e);
8256
8553
  }
8257
- function Ct(e) {
8258
- return St(e).then(() => {
8554
+ function qt(e) {
8555
+ return Kt(e).then(() => {
8259
8556
  let e = y();
8260
8557
  e && typeof e.typesetPromise != "function" && console.warn("[mathjax-renderer] MathJax on this page has no typesetPromise; math stays untypeset.");
8261
8558
  });
8262
8559
  }
8263
- function wt(e) {
8264
- let t = oe, n = t[L];
8265
- return n || (n = Ct(e), t[L] = n), n;
8560
+ function Jt(e) {
8561
+ let t = oe, n = t[xt];
8562
+ return n || (n = qt(e), t[xt] = n), n;
8266
8563
  }
8267
- function Tt(e = {}) {
8564
+ function Yt(e = {}) {
8268
8565
  let t = e.useSingleDollar ?? !1;
8269
8566
  return async (n) => {
8270
8567
  if (typeof window > "u") return;
8271
8568
  let r = ce();
8272
- r && ne("mathjax-3-global", `window.MathJax is MathJax ${r}`), lt(n), de(n), ut(n), Be(n);
8273
- let i = wt(e);
8274
- if (!dt(n, t)) {
8569
+ r && ne("mathjax-3-global", `window.MathJax is MathJax ${r}`), Nt(n), fe(n), Pt(n), Ie(n);
8570
+ let i = Jt(e);
8571
+ if (!Ft(n, t)) {
8275
8572
  i.catch(() => {});
8276
8573
  return;
8277
8574
  }
8278
8575
  await i;
8279
8576
  let a = y();
8280
8577
  if (await a?.startup?.promise, typeof a?.typesetPromise == "function") {
8281
- Ge(), bt(a.startup?.document);
8578
+ Ve(), Wt(a.startup?.document);
8282
8579
  try {
8283
8580
  await a.typesetPromise([n]);
8284
8581
  } catch (e) {
8285
8582
  throw a.typesetClear?.([n]), e;
8286
8583
  }
8287
- z(n);
8584
+ X(n), J(n);
8288
8585
  }
8289
8586
  };
8290
8587
  }
8291
- var kt = {
8292
- "(": "open parenthesis",
8293
- "[": "open bracket",
8294
- "{": "open brace",
8295
- "⟨": "open angle bracket",
8296
- "⌊": "open floor",
8297
- "⌈": "open ceiling"
8298
- };
8299
- var At = {
8300
- ")": "close parenthesis",
8301
- "]": "close bracket",
8302
- "}": "close brace",
8303
- "⟩": "close angle bracket",
8304
- "⌋": "close floor",
8305
- "⌉": "close ceiling"
8306
- };
8307
- var H = {
8308
- "!": "factorial",
8309
- "%": "percent",
8310
- "°": "degrees",
8311
- "′": "prime",
8312
- "″": "double prime"
8313
- };
8314
- ({
8315
- ...kt,
8316
- ...At,
8317
- ...H
8318
- });
8319
- var $t = "@pie-lib/math-rendering";
8320
- var en = "@pie-lib/math-rendering@2";
8321
- var tn = "pie-print";
8322
- var nn = 50;
8323
- var rn = 1e4;
8324
- var an = null;
8325
- function on() {
8326
- return !!window[en]?.opts?.useSingleDollar;
8588
+ var Zt = "@pie-lib/math-rendering";
8589
+ var Qt = "@pie-lib/math-rendering@2";
8590
+ var $t = "pie-print";
8591
+ var en = 50;
8592
+ var tn = 1e4;
8593
+ var nn = null;
8594
+ function rn() {
8595
+ return !!window[Qt]?.opts?.useSingleDollar;
8327
8596
  }
8328
- function sn() {
8329
- return an || (an = Tt({ useSingleDollar: on() })), an;
8597
+ function an() {
8598
+ return nn || (nn = Yt({ useSingleDollar: rn() })), nn;
8330
8599
  }
8331
8600
  function Q() {
8332
8601
  if (typeof window > "u") return null;
8333
- let e = window[$t];
8602
+ let e = window[Zt];
8334
8603
  return typeof e?.renderMath == "function" && e.renderMath !== $ ? e : null;
8335
8604
  }
8336
- function cn(e) {
8605
+ function on(e) {
8337
8606
  let t = e;
8338
8607
  for (; t;) {
8339
- if (t instanceof Element && t.localName === tn) return t;
8608
+ if (t instanceof Element && t.localName === $t) return t;
8340
8609
  t = t instanceof ShadowRoot ? t.host : t.parentNode;
8341
8610
  }
8342
8611
  return null;
8343
8612
  }
8344
- function ln() {
8613
+ function sn() {
8345
8614
  let e = window.renderMath;
8346
8615
  return typeof e == "function" ? e : null;
8347
8616
  }
8348
- async function un(e) {
8349
- let t = cn(e);
8617
+ async function cn(e) {
8618
+ let t = on(e);
8350
8619
  if (!t) return null;
8351
- let n = ln();
8620
+ let n = sn();
8352
8621
  if (n || t.mathRenderingModuleUrlImported !== !0) return n;
8353
- let r = Date.now() + rn;
8622
+ let r = Date.now() + tn;
8354
8623
  for (; Date.now() < r;) {
8355
- await new Promise((e) => setTimeout(e, nn));
8356
- let e = ln();
8624
+ await new Promise((e) => setTimeout(e, en));
8625
+ let e = sn();
8357
8626
  if (e) return e;
8358
8627
  }
8359
8628
  return null;
@@ -8362,8 +8631,8 @@ var $ = async (e) => {
8362
8631
  if (typeof window > "u") return;
8363
8632
  let t = typeof e == "string", n;
8364
8633
  t ? (n = document.createElement("div"), n.innerHTML = e) : n = e || document.body;
8365
- let r = Q(), i = r || t ? null : await un(n);
8366
- return r ? await r.renderMath?.(n) : i && i !== $ ? await i(n) : await sn()(n), t ? n.innerHTML : void 0;
8634
+ let r = Q(), i = r || t ? null : await cn(n);
8635
+ return r ? (await r.renderMath?.(n), J(n)) : i && i !== $ ? (await i(n), J(n)) : await an()(n), t ? n.innerHTML : void 0;
8367
8636
  };
8368
8637
  //#endregion
8369
8638
  //#region ../../shared/translator/dist/en.js