@pie-element/passage 8.0.3 → 8.0.4-next.20261009061152
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.
- package/dist/browser/author/index.js +14 -14
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/delivery/index.js +2 -2
- package/dist/browser/{dist-BvZFs1P1.js → dist-O_u0vsAS.js} +2990 -2990
- package/dist/browser/dist-O_u0vsAS.js.map +1 -0
- package/dist/browser/editor-runtime/author/index.js +10 -10
- package/dist/browser/editor-runtime/author/index.js.map +1 -1
- package/dist/browser/editor-runtime/delivery/index.js +2 -2
- package/dist/browser/editor-runtime/{dist-D0UrdkpW.js → dist-Cb_ds8E8.js} +2990 -2990
- package/dist/browser/editor-runtime/dist-Cb_ds8E8.js.map +1 -0
- package/dist/browser/{mathjax-BKrHE4xs-DMJdB93L.js → editor-runtime/mathjax-CptWnMbQ-BymmkoDr.js} +21 -21
- package/dist/browser/editor-runtime/{mathjax-BKrHE4xs-olIoaCQN.js.map → mathjax-CptWnMbQ-BymmkoDr.js.map} +1 -1
- package/dist/browser/editor-runtime/print/index.js +3 -3
- package/dist/browser/{speech-worker-CP5P4gRS-G4rtBs8u.js → editor-runtime/speech-worker-CTpOB9m5-pwCKeQ9c.js} +46 -43
- package/dist/browser/editor-runtime/speech-worker-CTpOB9m5-pwCKeQ9c.js.map +1 -0
- package/dist/browser/editor-runtime/{stimulus-tabs--mrs1TAH.js → stimulus-tabs-BYem4WIl.js} +3 -3
- package/dist/browser/editor-runtime/{stimulus-tabs--mrs1TAH.js.map → stimulus-tabs-BYem4WIl.js.map} +1 -1
- package/dist/browser/{editor-runtime/mathjax-BKrHE4xs-olIoaCQN.js → mathjax-CptWnMbQ-ncPHVakS.js} +25 -25
- package/dist/browser/{mathjax-BKrHE4xs-DMJdB93L.js.map → mathjax-CptWnMbQ-ncPHVakS.js.map} +1 -1
- package/dist/browser/print/index.js +3 -3
- package/dist/browser/{editor-runtime/speech-worker-CP5P4gRS-OkQyXQak.js → speech-worker-CTpOB9m5-BIgcSm3A.js} +20 -17
- package/dist/browser/speech-worker-CTpOB9m5-BIgcSm3A.js.map +1 -0
- package/dist/browser/{stimulus-tabs-DrhnNs9b.js → stimulus-tabs-CeALgQ3e.js} +3 -3
- package/dist/browser/{stimulus-tabs-DrhnNs9b.js.map → stimulus-tabs-CeALgQ3e.js.map} +1 -1
- package/dist/index.iife.js +36 -36
- package/module/print.js +747 -744
- package/module/print.js.map +1 -1
- package/package.json +11 -11
- package/dist/browser/dist-BvZFs1P1.js.map +0 -1
- package/dist/browser/editor-runtime/dist-D0UrdkpW.js.map +0 -1
- package/dist/browser/editor-runtime/speech-worker-CP5P4gRS-OkQyXQak.js.map +0 -1
- package/dist/browser/speech-worker-CP5P4gRS-G4rtBs8u.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { w as t } from "../dist-
|
|
3
|
-
import { t as n } from "../stimulus-tabs
|
|
1
|
+
import { h as e } from "../speech-worker-CTpOB9m5-pwCKeQ9c.js";
|
|
2
|
+
import { w as t } from "../dist-Cb_ds8E8.js";
|
|
3
|
+
import { t as n } from "../stimulus-tabs-BYem4WIl.js";
|
|
4
4
|
import { i as r } from "../dist-CdepepQM.js";
|
|
5
5
|
import i from "react";
|
|
6
6
|
import { createRoot as a } from "react-dom/client";
|
|
@@ -24,11 +24,11 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
24
24
|
enumerable: !(s = n(i, d)) || s.enumerable
|
|
25
25
|
});
|
|
26
26
|
return e;
|
|
27
|
-
}, l = (n, r, a) => (a = n == null ? {} : e(i(n)), c(r || !n || !n.__esModule ? t(a, "default", {
|
|
27
|
+
}, l = (e, t, n) => (c(e, t, "default"), n && c(n, t, "default")), u = (n, r, a) => (a = n == null ? {} : e(i(n)), c(r || !n || !n.__esModule ? t(a, "default", {
|
|
28
28
|
value: n,
|
|
29
29
|
enumerable: !0
|
|
30
|
-
}) : a, n)),
|
|
31
|
-
function
|
|
30
|
+
}) : a, n)), d = __pieBrowserCjsRequire, f = "4.1.3", p = "https://github.com/pie-framework/pie-elements-ng/blob/develop/docs/MATH-RENDERING.md#assets", m = "@pie-lib/math-rendering@2", h = ["nemeth", "euro"], g = `mathjax@${f}/sre`, _ = /^[^@]+@[^@]+$/;
|
|
31
|
+
function v(e) {
|
|
32
32
|
if (!e) return;
|
|
33
33
|
let t;
|
|
34
34
|
try {
|
|
@@ -41,16 +41,19 @@ function _(e) {
|
|
|
41
41
|
for (let e = n.length - 1; e > 0; e--) {
|
|
42
42
|
let r = n[e];
|
|
43
43
|
if (r === "node_modules") return;
|
|
44
|
-
if (!
|
|
44
|
+
if (!_.test(r)) continue;
|
|
45
45
|
let i = n[e - 1]?.startsWith("@") ? e - 1 : e;
|
|
46
46
|
return t.origin + n.slice(0, i).join("/");
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
let e = globalThis[
|
|
49
|
+
function y() {
|
|
50
|
+
let e = globalThis[m]?.opts;
|
|
51
51
|
return e && typeof e == "object" ? e : {};
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function b() {
|
|
54
|
+
return y().inTabOrder === !0;
|
|
55
|
+
}
|
|
56
|
+
function x(e) {
|
|
54
57
|
if (typeof e != "string" || !e) return;
|
|
55
58
|
let t = typeof document > "u" ? void 0 : document.baseURI;
|
|
56
59
|
try {
|
|
@@ -59,90 +62,90 @@ function y(e) {
|
|
|
59
62
|
return;
|
|
60
63
|
}
|
|
61
64
|
}
|
|
62
|
-
function
|
|
65
|
+
function S(e) {
|
|
63
66
|
if (!e || typeof e != "object") return;
|
|
64
67
|
let t = /* @__PURE__ */ new Map();
|
|
65
68
|
for (let [n, r] of Object.entries(e)) {
|
|
66
|
-
let e =
|
|
69
|
+
let e = x(r);
|
|
67
70
|
e && t.set(n, e);
|
|
68
71
|
}
|
|
69
72
|
return t.size ? t : void 0;
|
|
70
73
|
}
|
|
71
|
-
function
|
|
74
|
+
function C(e) {
|
|
72
75
|
if (Array.isArray(e)) return new Map(e.filter((e) => typeof e == "string").map((e) => [e, void 0]));
|
|
73
76
|
if (e && typeof e == "object") return new Map(Object.entries(e).map(([e, t]) => [e, typeof t == "string" ? t : void 0]));
|
|
74
77
|
}
|
|
75
|
-
function
|
|
76
|
-
let n =
|
|
78
|
+
function w(e, t) {
|
|
79
|
+
let n = y(), r = x(e.assetRoot ?? n.assetRoot) ?? v(t);
|
|
77
80
|
return {
|
|
78
81
|
root: r,
|
|
79
|
-
speechPath:
|
|
80
|
-
speechLocales:
|
|
81
|
-
urls:
|
|
82
|
+
speechPath: x(e.speechPath ?? n.speechPath) ?? (r ? `${r}/${g}` : void 0),
|
|
83
|
+
speechLocales: C(e.speechLocales ?? n.speechLocales),
|
|
84
|
+
urls: S(e.assetUrls ?? n.assetUrls)
|
|
82
85
|
};
|
|
83
86
|
}
|
|
84
|
-
function
|
|
87
|
+
function T({ root: e, urls: t }, n) {
|
|
85
88
|
return t?.get(n) ?? (e ? `${e}/${n}` : void 0);
|
|
86
89
|
}
|
|
87
|
-
function
|
|
88
|
-
return t?.get(`${
|
|
90
|
+
function E({ speechPath: e, urls: t }, n) {
|
|
91
|
+
return t?.get(`${g}/${n}`) ?? (e ? `${e}/${n}` : void 0);
|
|
89
92
|
}
|
|
90
|
-
function
|
|
93
|
+
function D(e, t) {
|
|
91
94
|
if (!(!e || !t)) {
|
|
92
|
-
for (let n of [...e.keys()]) !t.has(n) && !
|
|
95
|
+
for (let n of [...e.keys()]) !t.has(n) && !h.includes(n) && e.delete(n);
|
|
93
96
|
for (let [n, r] of t) (r || !e.has(n)) && e.set(n, r ?? n);
|
|
94
97
|
}
|
|
95
98
|
}
|
|
96
|
-
function
|
|
97
|
-
if (!(!e || e.has("en"))) return [...e.keys()].find((e) => !
|
|
99
|
+
function O(e) {
|
|
100
|
+
if (!(!e || e.has("en"))) return [...e.keys()].find((e) => !h.includes(e));
|
|
98
101
|
}
|
|
99
|
-
var
|
|
102
|
+
var k = {
|
|
100
103
|
untypeset: "no MathJax loads, so math stays untypeset",
|
|
101
104
|
"no-web-fonts": "math renders without web fonts",
|
|
102
105
|
"no-web-fonts-or-speech": "math renders without web fonts and speech"
|
|
103
|
-
},
|
|
104
|
-
function
|
|
106
|
+
}, A = Symbol.for("@pie-element/shared-math-rendering-mathjax/no-assets");
|
|
107
|
+
function j(e) {
|
|
105
108
|
let t = globalThis;
|
|
106
|
-
t[
|
|
107
|
-
let n = t[
|
|
109
|
+
t[A] ??= [];
|
|
110
|
+
let n = t[A];
|
|
108
111
|
if (n.includes(e)) return;
|
|
109
112
|
n.push(e);
|
|
110
|
-
let r = `[math-rendering] No asset root for MathJax: ${
|
|
113
|
+
let r = `[math-rendering] No asset root for MathJax: ${k[e]}. Set window['${m}'].opts.assetRoot to an npm root. See ${p}`;
|
|
111
114
|
e === "untypeset" ? console.error(r) : console.warn(r), !(typeof window > "u") && window.dispatchEvent(new CustomEvent("pie-mathjax-no-asset-root", { detail: {
|
|
112
115
|
effect: e,
|
|
113
116
|
message: r,
|
|
114
|
-
docsUrl:
|
|
117
|
+
docsUrl: p
|
|
115
118
|
} }));
|
|
116
119
|
}
|
|
117
|
-
var
|
|
118
|
-
function
|
|
120
|
+
var M = Symbol.for("@pie-element/shared-math-rendering-mathjax/speech-worker-failed");
|
|
121
|
+
function N() {
|
|
119
122
|
let e = globalThis;
|
|
120
|
-
e[
|
|
123
|
+
e[M] || (e[M] = !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 ${p}`));
|
|
121
124
|
}
|
|
122
|
-
function
|
|
125
|
+
function P(e) {
|
|
123
126
|
let t = e.webworker;
|
|
124
127
|
if (!t || t.ready) return;
|
|
125
128
|
e.options ??= {};
|
|
126
129
|
let n = e.options;
|
|
127
|
-
n.enableSpeech = !1, n.enableBraille = !1, n.speechError = () => {}, t.Post = () => Promise.reject(/* @__PURE__ */ Error("The speech worker did not start")), t.Terminate(),
|
|
130
|
+
n.enableSpeech = !1, n.enableBraille = !1, n.speechError = () => {}, t.Post = () => Promise.reject(/* @__PURE__ */ Error("The speech worker did not start")), t.Terminate(), N();
|
|
128
131
|
}
|
|
129
|
-
function
|
|
132
|
+
function F(e) {
|
|
130
133
|
let t = e?.adaptor, n = t?.createWorker;
|
|
131
134
|
!e || !t || !n || (t.createWorker = async (r, i) => {
|
|
132
135
|
let a = await n.call(t, r, i);
|
|
133
|
-
return a.addEventListener("error", () =>
|
|
136
|
+
return a.addEventListener("error", () => P(e), { once: !0 }), a;
|
|
134
137
|
});
|
|
135
138
|
}
|
|
136
|
-
var
|
|
137
|
-
function
|
|
138
|
-
let t =
|
|
139
|
+
var I = `${g}/mathmaps/`;
|
|
140
|
+
function L(e) {
|
|
141
|
+
let t = E(e, "speech-worker.js");
|
|
139
142
|
if (!t) return;
|
|
140
143
|
let n = e.speechPath ? `${e.speechPath}/mathmaps` : "mathmaps", r = {};
|
|
141
|
-
for (let [t, i] of e.urls ?? []) t.startsWith(
|
|
144
|
+
for (let [t, i] of e.urls ?? []) t.startsWith(I) && (r[`${n}/${t.slice(I.length)}`] = i);
|
|
142
145
|
let i = [`self.maps = ${JSON.stringify(n)};`];
|
|
143
146
|
return Object.keys(r).length && i.push("{", ` const urls = new Map(Object.entries(${JSON.stringify(r)}));`, " const fetchFile = self.fetch.bind(self);", " self.fetch = (input, init) => fetchFile(urls.get(input) ?? input, init);", "}"), i.push(`importScripts(${JSON.stringify(t)});`), i.join("\n");
|
|
144
147
|
}
|
|
145
|
-
function
|
|
148
|
+
function R(e, t) {
|
|
146
149
|
let n = URL.createObjectURL(new Blob([e], { type: "text/javascript" }));
|
|
147
150
|
try {
|
|
148
151
|
let e = new Worker(n);
|
|
@@ -152,6 +155,6 @@ function I(e, t) {
|
|
|
152
155
|
}
|
|
153
156
|
}
|
|
154
157
|
//#endregion
|
|
155
|
-
export {
|
|
158
|
+
export { f as a, D as c, o as d, s as f, u as h, b as i, T as l, d as m, L as n, w as o, l as p, j as r, O as s, R as t, F as u };
|
|
156
159
|
|
|
157
|
-
//# sourceMappingURL=speech-worker-
|
|
160
|
+
//# sourceMappingURL=speech-worker-CTpOB9m5-pwCKeQ9c.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"speech-worker-CTpOB9m5-pwCKeQ9c.js","names":[],"sources":["../../../../../shared/math-rendering-mathjax/dist/browser/speech-worker-CTpOB9m5.js"],"sourcesContent":["//#region src/assets.ts\nvar e = \"4.1.3\", t = \"https://github.com/pie-framework/pie-elements-ng/blob/develop/docs/MATH-RENDERING.md#assets\", n = \"@pie-lib/math-rendering@2\", r = [\"nemeth\", \"euro\"], i = `mathjax@${e}/sre`, a = /^[^@]+@[^@]+$/;\nfunction o(e) {\n\tif (!e) return;\n\tlet t;\n\ttry {\n\t\tt = new URL(e);\n\t} catch {\n\t\treturn;\n\t}\n\tif (t.origin === \"null\") return;\n\tlet n = t.pathname.split(\"/\");\n\tfor (let e = n.length - 1; e > 0; e--) {\n\t\tlet r = n[e];\n\t\tif (r === \"node_modules\") return;\n\t\tif (!a.test(r)) continue;\n\t\tlet i = n[e - 1]?.startsWith(\"@\") ? e - 1 : e;\n\t\treturn t.origin + n.slice(0, i).join(\"/\");\n\t}\n}\nfunction s() {\n\tlet e = globalThis[n]?.opts;\n\treturn e && typeof e == \"object\" ? e : {};\n}\nfunction c() {\n\treturn s().inTabOrder === !0;\n}\nfunction l(e) {\n\tif (typeof e != \"string\" || !e) return;\n\tlet t = typeof document > \"u\" ? void 0 : document.baseURI;\n\ttry {\n\t\treturn new URL(e, t).href.replace(/\\/+$/, \"\");\n\t} catch {\n\t\treturn;\n\t}\n}\nfunction u(e) {\n\tif (!e || typeof e != \"object\") return;\n\tlet t = /* @__PURE__ */ new Map();\n\tfor (let [n, r] of Object.entries(e)) {\n\t\tlet e = l(r);\n\t\te && t.set(n, e);\n\t}\n\treturn t.size ? t : void 0;\n}\nfunction d(e) {\n\tif (Array.isArray(e)) return new Map(e.filter((e) => typeof e == \"string\").map((e) => [e, void 0]));\n\tif (e && typeof e == \"object\") return new Map(Object.entries(e).map(([e, t]) => [e, typeof t == \"string\" ? t : void 0]));\n}\nfunction f(e, t) {\n\tlet n = s(), r = l(e.assetRoot ?? n.assetRoot) ?? o(t);\n\treturn {\n\t\troot: r,\n\t\tspeechPath: l(e.speechPath ?? n.speechPath) ?? (r ? `${r}/${i}` : void 0),\n\t\tspeechLocales: d(e.speechLocales ?? n.speechLocales),\n\t\turls: u(e.assetUrls ?? n.assetUrls)\n\t};\n}\nfunction p({ root: e, urls: t }, n) {\n\treturn t?.get(n) ?? (e ? `${e}/${n}` : void 0);\n}\nfunction m({ speechPath: e, urls: t }, n) {\n\treturn t?.get(`${i}/${n}`) ?? (e ? `${e}/${n}` : void 0);\n}\nfunction h(e, t) {\n\tif (!(!e || !t)) {\n\t\tfor (let n of [...e.keys()]) !t.has(n) && !r.includes(n) && e.delete(n);\n\t\tfor (let [n, r] of t) (r || !e.has(n)) && e.set(n, r ?? n);\n\t}\n}\nfunction g(e) {\n\tif (!(!e || e.has(\"en\"))) return [...e.keys()].find((e) => !r.includes(e));\n}\nvar _ = \"pie-mathjax-no-asset-root\", v = {\n\tuntypeset: \"no MathJax loads, so math stays untypeset\",\n\t\"no-web-fonts\": \"math renders without web fonts\",\n\t\"no-web-fonts-or-speech\": \"math renders without web fonts and speech\"\n}, y = Symbol.for(\"@pie-element/shared-math-rendering-mathjax/no-assets\");\nfunction b(e) {\n\tlet r = globalThis;\n\tr[y] ??= [];\n\tlet i = r[y];\n\tif (i.includes(e)) return;\n\ti.push(e);\n\tlet a = `[math-rendering] No asset root for MathJax: ${v[e]}. Set window['${n}'].opts.assetRoot to an npm root. See ${t}`;\n\te === \"untypeset\" ? console.error(a) : console.warn(a), !(typeof window > \"u\") && window.dispatchEvent(new CustomEvent(_, { detail: {\n\t\teffect: e,\n\t\tmessage: a,\n\t\tdocsUrl: t\n\t} }));\n}\n//#endregion\n//#region src/speech-worker.ts\nvar x = Symbol.for(\"@pie-element/shared-math-rendering-mathjax/speech-worker-failed\");\nfunction S() {\n\tlet e = globalThis;\n\te[x] || (e[x] = !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}`));\n}\nfunction C(e) {\n\tlet t = e.webworker;\n\tif (!t || t.ready) return;\n\te.options ??= {};\n\tlet n = e.options;\n\tn.enableSpeech = !1, n.enableBraille = !1, n.speechError = () => {}, t.Post = () => Promise.reject(/* @__PURE__ */ Error(\"The speech worker did not start\")), t.Terminate(), S();\n}\nfunction w(e) {\n\tlet t = e?.adaptor, n = t?.createWorker;\n\t!e || !t || !n || (t.createWorker = async (r, i) => {\n\t\tlet a = await n.call(t, r, i);\n\t\treturn a.addEventListener(\"error\", () => C(e), { once: !0 }), a;\n\t});\n}\nvar T = `${i}/mathmaps/`;\nfunction E(e) {\n\tlet t = m(e, \"speech-worker.js\");\n\tif (!t) return;\n\tlet n = e.speechPath ? `${e.speechPath}/mathmaps` : \"mathmaps\", r = {};\n\tfor (let [t, i] of e.urls ?? []) t.startsWith(T) && (r[`${n}/${t.slice(T.length)}`] = i);\n\tlet i = [`self.maps = ${JSON.stringify(n)};`];\n\treturn Object.keys(r).length && i.push(\"{\", ` const urls = new Map(Object.entries(${JSON.stringify(r)}));`, \" const fetchFile = self.fetch.bind(self);\", \" self.fetch = (input, init) => fetchFile(urls.get(input) ?? input, init);\", \"}\"), i.push(`importScripts(${JSON.stringify(t)});`), i.join(\"\\n\");\n}\nfunction D(e, t) {\n\tlet n = URL.createObjectURL(new Blob([e], { type: \"text/javascript\" }));\n\ttry {\n\t\tlet e = new Worker(n);\n\t\treturn e.onmessage = t, e;\n\t} finally {\n\t\tURL.revokeObjectURL(n);\n\t}\n}\n//#endregion\nexport { _ as a, h as c, f as d, e as i, c as l, E as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import {
|
|
2
|
-
import { C as t, Dt as n, F as r, I as i, M as a, N as o, a as s, b as c, h as l, o as u, s as d, t as f, tt as p, x as m } from "./dist-
|
|
1
|
+
import { h as e } from "./speech-worker-CTpOB9m5-pwCKeQ9c.js";
|
|
2
|
+
import { C as t, Dt as n, F as r, I as i, M as a, N as o, a as s, b as c, h as l, o as u, s as d, t as f, tt as p, x as m } from "./dist-Cb_ds8E8.js";
|
|
3
3
|
import h from "react";
|
|
4
4
|
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
5
5
|
//#region src/delivery/stimulus-tabs.tsx
|
|
@@ -260,4 +260,4 @@ V.propTypes = {
|
|
|
260
260
|
//#endregion
|
|
261
261
|
export { V as t };
|
|
262
262
|
|
|
263
|
-
//# sourceMappingURL=stimulus-tabs
|
|
263
|
+
//# sourceMappingURL=stimulus-tabs-BYem4WIl.js.map
|
package/dist/browser/editor-runtime/{stimulus-tabs--mrs1TAH.js.map → stimulus-tabs-BYem4WIl.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stimulus-tabs--mrs1TAH.js","names":[],"sources":["../../../src/delivery/stimulus-tabs.tsx"],"sourcesContent":["// @ts-nocheck\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport Tabs from '@mui/material/Tabs';\nimport Tab from '@mui/material/Tab';\nimport { styled } from '@mui/material/styles';\nimport { Collapsible as CollapsibleImport, color, createUniqueId, PreviewPrompt as PreviewPromptImport, Purpose as PurposeImport, UiLayout as UiLayoutImport, transformDataHeadings } from '@pie-lib/render-ui';\nimport Translator from '@pie-lib/translator';\n\nconst { translator } = Translator;\n\nfunction isRenderableReactInteropType(value: any) {\n return (\n typeof value === 'function' ||\n (typeof value === 'object' && value !== null && typeof value.$$typeof === 'symbol')\n );\n}\n\nfunction unwrapReactInteropSymbol(maybeSymbol: any, namedExport?: string) {\n if (!maybeSymbol) return maybeSymbol;\n if (isRenderableReactInteropType(maybeSymbol)) return maybeSymbol;\n if (isRenderableReactInteropType(maybeSymbol.default)) return maybeSymbol.default;\n if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport])) {\n return maybeSymbol[namedExport];\n }\n if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport]?.default)) {\n return maybeSymbol[namedExport].default;\n }\n return maybeSymbol;\n}\nconst UiLayout = unwrapReactInteropSymbol(UiLayoutImport, 'UiLayout') || unwrapReactInteropSymbol(renderUi.UiLayout, 'UiLayout');\nconst Purpose = unwrapReactInteropSymbol(PurposeImport, 'Purpose') || unwrapReactInteropSymbol(renderUi.Purpose, 'Purpose');\nconst PreviewPrompt = unwrapReactInteropSymbol(PreviewPromptImport, 'PreviewPrompt') || unwrapReactInteropSymbol(renderUi.PreviewPrompt, 'PreviewPrompt');\nconst Collapsible = unwrapReactInteropSymbol(CollapsibleImport, 'Collapsible') || unwrapReactInteropSymbol(renderUi.Collapsible, 'Collapsible');\nimport * as RenderUiNamespace from '@pie-lib/render-ui';\nimport { sanitizeModelHtml } from '@pie-element/shared-utils';\nconst renderUiNamespaceAny = RenderUiNamespace as any;\nconst renderUiDefaultMaybe = renderUiNamespaceAny['default'];\nconst renderUi =\n renderUiDefaultMaybe && typeof renderUiDefaultMaybe === 'object'\n ? renderUiDefaultMaybe\n : renderUiNamespaceAny;\n// Must match the breakpoint Quiz Engine passes to the PIE section player for\n// switching from the side-by-side passage/question layout to the tabbed layout.\n// Below (and at) this width the passage tabs scroll with the passage content\n// instead of being locked to the top of the panel, so that they do not lock up\n// space needed for the passage text (WCAG 1.4.10 Reflow, 400% zoom / 320px).\nconst STICKY_TABS_BREAKPOINT = 840;\n\n/**\n * Zoom compensation for the passage selection tabs.\n *\n * The tabs scale naturally with browser zoom up to 200%. Beyond 200%,\n * we shrink their CSS size proportionally so their physical on-screen size\n * freezes at the 200% appearance, leaving more room for passage content\n * in high-zoom / small-window situations.\n * The factor is min(1, 2 / zoom): exactly 1 at zoom <= 200% (component\n * behavior unchanged), shrinking proportionally above that. A lower clamp\n * of 0.4 guards against inflated ratios (docked devtools, browser side\n * panels, window chrome) ever making the tabs unusably small.\n */\nconst MAX_TABS_ZOOM = 2;\nconst MIN_ZOOM_COMPENSATION = 0.4;\n\n// Per-tab horizontal-space floor in CSS pixels. When the passage container is\n// narrow enough that each tab would have at most this much room\n// (containerWidth <= tabs.length * NUMERIC_LABEL_MIN_WIDTH_PER_TAB), tab labels\n// fall back to \"Passage 1\", \"Passage 2\", ... so navigation stays usable instead\n// of being dominated by aggressively truncated titles.\nconst NUMERIC_LABEL_MIN_WIDTH_PER_TAB = 170;\n\nconst computeZoomCompensation = () => {\n if (typeof window === 'undefined') return 1;\n const ratio = window.outerWidth / window.innerWidth;\n const zoom = Number.isFinite(ratio) && ratio > 0 ? ratio : 1;\n return Math.max(MIN_ZOOM_COMPENSATION, Math.min(1, MAX_TABS_ZOOM / zoom));\n};\n\nconst PassagesContainer: any = styled('div')({\n flexGrow: 1,\n backgroundColor: color.background(),\n color: color.text(),\n '&:not(.MathJax) table': {\n borderCollapse: 'collapse',\n },\n '&:not(.MathJax) table td, &:not(.MathJax) table th': {\n padding: '.6em 1em',\n textAlign: 'left',\n },\n});\n\nconst Passage: any = styled('div')(({ theme }) => ({\n backgroundColor: color.background(),\n color: color.text(),\n padding: theme.spacing(2),\n '& blockquote': {\n background: '#f9f9f9',\n borderLeft: '5px solid #ccc',\n margin: '1.5em 10px',\n padding: '.5em 10px',\n },\n}));\n\nconst PassageTitle: any = styled('div')({\n fontSize: '1.75rem',\n});\n\nconst PassageSubtitle: any = styled('div')({\n fontSize: '1.5rem',\n});\n\nconst PassageAuthor: any = styled('div')({\n fontSize: '1.25rem',\n});\n\nconst TabStyled: any = styled(Tab)(({ theme }) => ({\n /*\n * The tab carries the colour of the panel it opens, which is what makes it read as a\n * tab rather than a button, and it has to be the themed panel colour: MUI's palette\n * does not follow `--pie-*`, so `common.white` here left the tab white on every color\n * scheme while the passage body beneath it went dark. The comment this replaces gated\n * the change on PD-2801, which is about OT's `color-contrast` class -- the mechanism\n * pie-theme superseded, and blocked since 2023.\n */\n background: color.background(),\n fontSize: 'inherit',\n fontFamily: 'Roboto, sans-serif',\n color: color.text(),\n borderRadius: `${theme.spacing(2)} ${theme.spacing(2)} 0 0`,\n /*\n * `--pie-border-gray` is stepped to the 3:1 non-text minimum in every scheme. The\n * literal it replaces measured about 1.2:1 against the dark schemes' surfaces, so the\n * tab outline -- the only thing separating an unselected tab from the strip -- was\n * invisible there.\n */\n border: `1px solid ${color.borderGray()}`,\n borderBottomWidth: 0,\n minHeight: '56px',\n padding: '8px 10px',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n margin: `0 ${theme.spacing(1)}`,\n textTransform: 'none',\n\n '.passage-label': {\n display: '-webkit-box',\n WebkitLineClamp: 2,\n WebkitBoxOrient: 'vertical',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'normal',\n margin: 'auto 0',\n opacity: 0.7,\n },\n\n '&.Mui-selected': {\n color: color.text(),\n '.passage-label': {\n opacity: 1,\n },\n '.passage-label-underline': {\n backgroundColor: color.tertiary(),\n },\n },\n\n '&:hover': {\n '.passage-label-underline': {\n backgroundColor: color.tertiaryLight(),\n },\n },\n\n '& .MuiTouchRipple-root': {\n opacity: 0.7,\n },\n}));\n\n/*\n * The selection indicator, one per tab. Unselected it has to disappear into the tab, so it\n * paints the tab's own background rather than a fixed white; selected it becomes\n * `--pie-tertiary`, which every scheme sets.\n */\nconst Underline: any = styled('div')(() => ({\n height: '2px',\n width: '100%',\n marginTop: '6px',\n background: color.background(),\n}));\n\nclass StimulusTabs extends React.Component {\n state = {\n activeTab: 0,\n zoomCompensation: computeZoomCompensation(),\n containerWidth: 0,\n };\n\n containerRef = React.createRef();\n\n // Tab ids are model indexes, so DOM ids take a per-instance prefix and each passage's\n // aria-controls / aria-labelledby pairs resolve inside that passage. `button-N` and\n // `tabpanel-N` stay as class hooks.\n idPrefix = createUniqueId('passage');\n\n tabButtonId: any = (tabId) => `${this.idPrefix}-button-${tabId}`;\n\n tabPanelId: any = (tabId) => `${this.idPrefix}-tabpanel-${tabId}`;\n\n componentDidMount() {\n if (typeof window === 'undefined') return;\n window.addEventListener('resize', this.updateZoomCompensation);\n\n if (this.containerRef.current && typeof ResizeObserver !== 'undefined') {\n this.resizeObserver = new ResizeObserver(this.updateContainerWidth);\n this.resizeObserver.observe(this.containerRef.current);\n }\n\n this.updateContainerWidth();\n }\n\n componentWillUnmount() {\n if (typeof window === 'undefined') return;\n window.removeEventListener('resize', this.updateZoomCompensation);\n\n if (this.resizeObserver) {\n this.resizeObserver.disconnect();\n this.resizeObserver = null;\n }\n }\n\n updateZoomCompensation: any = () => {\n this.setState({ zoomCompensation: computeZoomCompensation() });\n };\n\n updateContainerWidth: any = () => {\n const node = this.containerRef.current;\n if (!node) return;\n const width = node.clientWidth;\n if (width !== this.state.containerWidth) {\n this.setState({ containerWidth: width });\n }\n };\n\n handleChange: any = (event, activeTab) => {\n this.setState(() => ({ activeTab }));\n\n setTimeout(() => {\n const tabChangeEvent = new CustomEvent('pie-ui-passage-tabChanged', {\n detail: { tab: activeTab },\n });\n\n window.dispatchEvent(tabChangeEvent);\n });\n };\n\n handleKeyDown: any = (event, currentTabId) => {\n const { key } = event;\n const { tabs } = this.props;\n\n let newTabIndex = -1;\n const currentIndex = tabs.findIndex((tab) => tab.id === currentTabId);\n\n switch (key) {\n case 'ArrowRight':\n // Move to the next tab\n newTabIndex = (currentIndex + 1) % tabs.length;\n break;\n case 'ArrowLeft':\n // Move to the previous tab\n newTabIndex = (currentIndex - 1 + tabs.length) % tabs.length;\n break;\n // Commented out ArrowDown and ArrowUp for future vertical tab navigation\n // case 'ArrowDown':\n // // Move to the next tab (for vertical alignment)\n // newTabIndex = (currentIndex + 1) % tabs.length;\n // break;\n // case 'ArrowUp':\n // // Move to the previous tab (for vertical alignment)\n // newTabIndex = (currentIndex - 1 + tabs.length) % tabs.length;\n // break;\n case 'Home':\n // Move to the first tab\n newTabIndex = 0;\n break;\n case 'End':\n // Move to the last tab\n newTabIndex = tabs.length - 1;\n break;\n case 'Enter':\n case ' ':\n // Activate the current tab\n newTabIndex = currentIndex;\n break;\n default:\n break;\n }\n\n if (newTabIndex !== -1) {\n event.preventDefault();\n event.stopPropagation();\n this.handleChange(event, tabs[newTabIndex].id);\n this.containerRef.current?.querySelector(`[id=\"${this.tabButtonId(tabs[newTabIndex].id)}\"]`)?.focus();\n }\n };\n\n parsedText: any = (text = '') => {\n // fix imported audio content for Safari PD-1391\n const div = document.createElement('div');\n div.innerHTML = sanitizeModelHtml(text.replace(/(<br\\/>\\n)/g, '<br/>'));\n\n const audio = div.querySelector('audio');\n\n if (audio) {\n const source = document.createElement('source');\n\n source.setAttribute('type', 'audio/mp3');\n source.setAttribute('src', audio.getAttribute('src'));\n\n audio.removeAttribute('src');\n audio.appendChild(source);\n }\n\n return div.innerHTML;\n };\n\n renderInstructions(teacherInstructions, disabledTabs = false) {\n if (!teacherInstructions) {\n return;\n }\n\n const teacherInstructionsDiv = (\n <PreviewPrompt\n tagName=\"div\"\n className=\"prompt\"\n defaultClassName=\"teacher-instructions\"\n prompt={teacherInstructions}\n />\n );\n\n if (disabledTabs) {\n return teacherInstructionsDiv;\n }\n\n return (\n <Collapsible\n labels={{\n hidden: translator.t('common:showTeacherInstructions', { lng: this.props.model?.language }),\n visible: translator.t('common:hideTeacherInstructions', { lng: this.props.model?.language }),\n }}\n >\n {teacherInstructionsDiv}\n </Collapsible>\n );\n }\n\n // Outside a tab list (one passage, or print) no tab names the panel, so it renders without the\n // tabpanel role and its title heading carries the structure.\n renderTab(tab, disabledTabs, tabbed = true) {\n const { baseHeadingLevel } = this.props;\n const clampedLevel = baseHeadingLevel ? Math.min(6, Math.max(1, baseHeadingLevel)) : undefined;\n const TitleTag = baseHeadingLevel ? `h${clampedLevel}` : 'h2'; // default to h2 if no base level is provided - this was the previous behavior\n const textLevel = baseHeadingLevel ? Math.min(6, Math.max(1, clampedLevel + 1)) : undefined; // promote text headings one level above title\n\n return (\n <Passage\n key={tab.id}\n id={this.tabPanelId(tab.id)}\n className={`tabpanel-${tab.id}`}\n {...(tabbed && { role: 'tabpanel', 'aria-labelledby': this.tabButtonId(tab.id) })}\n >\n {this.renderInstructions(tab.teacherInstructions, disabledTabs)}\n\n {tab.title && (\n <Purpose purpose=\"passage-title\">\n <TitleTag>\n <PassageTitle dangerouslySetInnerHTML={{ __html: this.parsedText(tab.title) }} />\n </TitleTag>\n </Purpose>\n )}\n\n {tab.subtitle && (\n <Purpose purpose=\"passage-subtitle\">\n <PassageSubtitle dangerouslySetInnerHTML={{ __html: this.parsedText(tab.subtitle) }} />\n </Purpose>\n )}\n\n {tab.author && (\n <Purpose purpose=\"passage-author\">\n <PassageAuthor className=\"author\" dangerouslySetInnerHTML={{ __html: this.parsedText(tab.author) }} />\n </Purpose>\n )}\n\n {tab.text && (\n <Purpose purpose=\"passage-text\">\n <div key={tab.id} className=\"text\" dangerouslySetInnerHTML={{ __html: sanitizeModelHtml(baseHeadingLevel ? transformDataHeadings(tab.text, textLevel) : tab.text) }} />\n </Purpose>\n )}\n </Passage>\n );\n }\n\n render() {\n const { model, tabs, disabledTabs } = this.props;\n const { activeTab, zoomCompensation, containerWidth } = this.state;\n\n if (!tabs?.length) {\n return;\n }\n\n const { extraCSSRules } = model || {};\n const selectedTab = (tabs || []).find((tab) => tab.id === activeTab);\n\n // cap each tab at 1/n of the passage container width so a single long\n // title can't push other tabs off-screen. Existing two-line wrap + ellipsis\n // on .passage-label still trims anything that doesn't fit.\n const tabMaxWidth = containerWidth > 0 ? containerWidth / tabs.length : null;\n // When per-tab horizontal space drops to NUMERIC_LABEL_MIN_WIDTH_PER_TAB or\n // less, titles become unreadably truncated; swap to \"Passage N\" so users\n // can still navigate. Container width is read once layout has settled\n // (>0), so initial render uses real labels.\n const useNumericLabels =\n containerWidth > 0 && containerWidth <= tabs.length * NUMERIC_LABEL_MIN_WIDTH_PER_TAB;\n\n return (\n <UiLayout extraCSSRules={extraCSSRules}>\n <PassagesContainer className=\"passages\" ref={this.containerRef}>\n {disabledTabs || tabs.length === 1 ? (\n tabs.map((tab) => this.renderTab(tab, disabledTabs, false))\n ) : (\n <>\n <Tabs\n sx={{\n // Below the breakpoint (e.g. WCAG 400% zoom, ~320px viewport)\n // the tabs are in normal flow and scroll with the passage text,\n // so they don't lock up space needed to display the passage.\n position: 'static',\n // Above the breakpoint there is adequate screen space, so the\n // tabs stay locked to the top of the panel while the passage\n // text scrolls beneath them.\n [`@media (min-width: ${STICKY_TABS_BREAKPOINT + 1}px)`]: {\n position: 'sticky',\n top: 0,\n zIndex: 1,\n },\n background: 'var(--pie-passage-header-background, rgba(255,255,255,0))',\n color: color.text(),\n fontFamily: 'Roboto, sans-serif',\n // Freeze the tabs' physical size at their 200%-zoom appearance\n // when browser zoom exceeds 200%. The factor is 1 at zoom <= 200%,\n // so behavior below that threshold is unchanged. Using `zoom`\n // (rather than transform: scale) shrinks the layout box itself,\n // so the reclaimed space flows to the passage content below.\n zoom: zoomCompensation,\n '& .MuiTabs-list': {\n /*\n * The strip behind the tabs. A host that has opted into\n * `--pie-passage-header-background` keeps its own colour on every\n * scheme -- Knowledge Checks' pale green-blue is deliberate and is not\n * a scheme's business to override. With no host colour the fallback has\n * to be a theme token rather than a white literal, or the strip stays\n * white over a dark passage body.\n */\n backgroundColor: `var(--pie-passage-header-background, ${color.backgroundDark()})`,\n borderBottom: `1px solid ${color.borderGray()}`,\n },\n '& .MuiTabs-indicator': {\n backgroundColor: color.white(),\n marginBottom: '-1px',\n },\n }}\n value={activeTab}\n onChange={this.handleChange}\n >\n {tabs.map((tab, index) => (\n <TabStyled\n key={tab.id}\n id={this.tabButtonId(tab.id)}\n className={`button-${tab.id}`}\n sx={tabMaxWidth ? { maxWidth: `${tabMaxWidth}px` } : undefined}\n label={\n <>\n <Purpose purpose=\"passage-label\">\n {useNumericLabels ? (\n <span className=\"passage-label\">{`Passage ${index + 1}`}</span>\n ) : (\n <span\n className=\"passage-label\"\n dangerouslySetInnerHTML={{ __html: this.parsedText(tab.label) }}\n />\n )}\n </Purpose>\n <Underline className=\"passage-label-underline\" />\n </>\n }\n value={tab.id}\n tabIndex={activeTab === tab.id ? 0 : -1}\n aria-controls={this.tabPanelId(tab.id)}\n aria-selected={activeTab === tab.id}\n onKeyDown={(event) => this.handleKeyDown(event, tab.id)}\n />\n ))}\n </Tabs>\n {selectedTab ? this.renderTab(selectedTab, disabledTabs) : null}\n </>\n )}\n </PassagesContainer>\n </UiLayout>\n );\n }\n}\n\nStimulusTabs.propTypes = {\n tabs: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.number.isRequired,\n label: PropTypes.string.isRequired,\n title: PropTypes.string.isRequired,\n subtitle: PropTypes.string,\n author: PropTypes.string,\n text: PropTypes.string.isRequired,\n teacherInstructions: PropTypes.string,\n }).isRequired,\n ).isRequired,\n disabledTabs: PropTypes.bool,\n model: PropTypes.object,\n baseHeadingLevel: PropTypes.number,\n};\n\nexport default StimulusTabs;\n"],"mappings":";;;;;mCAUM,EAAE,kBAAe;AAEvB,SAAS,EAA6B,GAAY;CAChD,OACE,OAAO,KAAU,cAChB,OAAO,KAAU,cAAY,KAAkB,OAAO,EAAM,YAAa;AAE9E;AAEA,SAAS,EAAyB,GAAkB,GAAsB;CAUxE,OATI,CAAC,KACD,EAA6B,CAAW,IAAU,IAClD,EAA6B,EAAY,OAAO,IAAU,EAAY,UACtE,KAAe,EAA6B,EAAY,EAAY,IAC/D,EAAY,KAEjB,KAAe,EAA6B,EAAY,EAAY,EAAE,OAAO,IACxE,EAAY,EAAY,CAAC,UAE3B;AACT;AACA,IAAM,IAAW,EAAyB,GAAgB,UAAU,KAAK,EAAyB,EAAS,UAAU,UAAU,GACzH,IAAU,EAAyB,GAAe,SAAS,KAAK,EAAyB,EAAS,SAAS,SAAS,GACpH,IAAgB,EAAyB,GAAqB,eAAe,KAAK,EAAyB,EAAS,eAAe,eAAe,GAClJ,IAAc,EAAyB,G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kB,EAAA,QAAU;AAC9B"}
|
|
1
|
+
{"version":3,"file":"stimulus-tabs-BYem4WIl.js","names":[],"sources":["../../../src/delivery/stimulus-tabs.tsx"],"sourcesContent":["// @ts-nocheck\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport Tabs from '@mui/material/Tabs';\nimport Tab from '@mui/material/Tab';\nimport { styled } from '@mui/material/styles';\nimport { Collapsible as CollapsibleImport, color, createUniqueId, PreviewPrompt as PreviewPromptImport, Purpose as PurposeImport, UiLayout as UiLayoutImport, transformDataHeadings } from '@pie-lib/render-ui';\nimport Translator from '@pie-lib/translator';\n\nconst { translator } = Translator;\n\nfunction isRenderableReactInteropType(value: any) {\n return (\n typeof value === 'function' ||\n (typeof value === 'object' && value !== null && typeof value.$$typeof === 'symbol')\n );\n}\n\nfunction unwrapReactInteropSymbol(maybeSymbol: any, namedExport?: string) {\n if (!maybeSymbol) return maybeSymbol;\n if (isRenderableReactInteropType(maybeSymbol)) return maybeSymbol;\n if (isRenderableReactInteropType(maybeSymbol.default)) return maybeSymbol.default;\n if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport])) {\n return maybeSymbol[namedExport];\n }\n if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport]?.default)) {\n return maybeSymbol[namedExport].default;\n }\n return maybeSymbol;\n}\nconst UiLayout = unwrapReactInteropSymbol(UiLayoutImport, 'UiLayout') || unwrapReactInteropSymbol(renderUi.UiLayout, 'UiLayout');\nconst Purpose = unwrapReactInteropSymbol(PurposeImport, 'Purpose') || unwrapReactInteropSymbol(renderUi.Purpose, 'Purpose');\nconst PreviewPrompt = unwrapReactInteropSymbol(PreviewPromptImport, 'PreviewPrompt') || unwrapReactInteropSymbol(renderUi.PreviewPrompt, 'PreviewPrompt');\nconst Collapsible = unwrapReactInteropSymbol(CollapsibleImport, 'Collapsible') || unwrapReactInteropSymbol(renderUi.Collapsible, 'Collapsible');\nimport * as RenderUiNamespace from '@pie-lib/render-ui';\nimport { sanitizeModelHtml } from '@pie-element/shared-utils';\nconst renderUiNamespaceAny = RenderUiNamespace as any;\nconst renderUiDefaultMaybe = renderUiNamespaceAny['default'];\nconst renderUi =\n renderUiDefaultMaybe && typeof renderUiDefaultMaybe === 'object'\n ? renderUiDefaultMaybe\n : renderUiNamespaceAny;\n// Must match the breakpoint Quiz Engine passes to the PIE section player for\n// switching from the side-by-side passage/question layout to the tabbed layout.\n// Below (and at) this width the passage tabs scroll with the passage content\n// instead of being locked to the top of the panel, so that they do not lock up\n// space needed for the passage text (WCAG 1.4.10 Reflow, 400% zoom / 320px).\nconst STICKY_TABS_BREAKPOINT = 840;\n\n/**\n * Zoom compensation for the passage selection tabs.\n *\n * The tabs scale naturally with browser zoom up to 200%. Beyond 200%,\n * we shrink their CSS size proportionally so their physical on-screen size\n * freezes at the 200% appearance, leaving more room for passage content\n * in high-zoom / small-window situations.\n * The factor is min(1, 2 / zoom): exactly 1 at zoom <= 200% (component\n * behavior unchanged), shrinking proportionally above that. A lower clamp\n * of 0.4 guards against inflated ratios (docked devtools, browser side\n * panels, window chrome) ever making the tabs unusably small.\n */\nconst MAX_TABS_ZOOM = 2;\nconst MIN_ZOOM_COMPENSATION = 0.4;\n\n// Per-tab horizontal-space floor in CSS pixels. When the passage container is\n// narrow enough that each tab would have at most this much room\n// (containerWidth <= tabs.length * NUMERIC_LABEL_MIN_WIDTH_PER_TAB), tab labels\n// fall back to \"Passage 1\", \"Passage 2\", ... so navigation stays usable instead\n// of being dominated by aggressively truncated titles.\nconst NUMERIC_LABEL_MIN_WIDTH_PER_TAB = 170;\n\nconst computeZoomCompensation = () => {\n if (typeof window === 'undefined') return 1;\n const ratio = window.outerWidth / window.innerWidth;\n const zoom = Number.isFinite(ratio) && ratio > 0 ? ratio : 1;\n return Math.max(MIN_ZOOM_COMPENSATION, Math.min(1, MAX_TABS_ZOOM / zoom));\n};\n\nconst PassagesContainer: any = styled('div')({\n flexGrow: 1,\n backgroundColor: color.background(),\n color: color.text(),\n '&:not(.MathJax) table': {\n borderCollapse: 'collapse',\n },\n '&:not(.MathJax) table td, &:not(.MathJax) table th': {\n padding: '.6em 1em',\n textAlign: 'left',\n },\n});\n\nconst Passage: any = styled('div')(({ theme }) => ({\n backgroundColor: color.background(),\n color: color.text(),\n padding: theme.spacing(2),\n '& blockquote': {\n background: '#f9f9f9',\n borderLeft: '5px solid #ccc',\n margin: '1.5em 10px',\n padding: '.5em 10px',\n },\n}));\n\nconst PassageTitle: any = styled('div')({\n fontSize: '1.75rem',\n});\n\nconst PassageSubtitle: any = styled('div')({\n fontSize: '1.5rem',\n});\n\nconst PassageAuthor: any = styled('div')({\n fontSize: '1.25rem',\n});\n\nconst TabStyled: any = styled(Tab)(({ theme }) => ({\n /*\n * The tab carries the colour of the panel it opens, which is what makes it read as a\n * tab rather than a button, and it has to be the themed panel colour: MUI's palette\n * does not follow `--pie-*`, so `common.white` here left the tab white on every color\n * scheme while the passage body beneath it went dark. The comment this replaces gated\n * the change on PD-2801, which is about OT's `color-contrast` class -- the mechanism\n * pie-theme superseded, and blocked since 2023.\n */\n background: color.background(),\n fontSize: 'inherit',\n fontFamily: 'Roboto, sans-serif',\n color: color.text(),\n borderRadius: `${theme.spacing(2)} ${theme.spacing(2)} 0 0`,\n /*\n * `--pie-border-gray` is stepped to the 3:1 non-text minimum in every scheme. The\n * literal it replaces measured about 1.2:1 against the dark schemes' surfaces, so the\n * tab outline -- the only thing separating an unselected tab from the strip -- was\n * invisible there.\n */\n border: `1px solid ${color.borderGray()}`,\n borderBottomWidth: 0,\n minHeight: '56px',\n padding: '8px 10px',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n margin: `0 ${theme.spacing(1)}`,\n textTransform: 'none',\n\n '.passage-label': {\n display: '-webkit-box',\n WebkitLineClamp: 2,\n WebkitBoxOrient: 'vertical',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'normal',\n margin: 'auto 0',\n opacity: 0.7,\n },\n\n '&.Mui-selected': {\n color: color.text(),\n '.passage-label': {\n opacity: 1,\n },\n '.passage-label-underline': {\n backgroundColor: color.tertiary(),\n },\n },\n\n '&:hover': {\n '.passage-label-underline': {\n backgroundColor: color.tertiaryLight(),\n },\n },\n\n '& .MuiTouchRipple-root': {\n opacity: 0.7,\n },\n}));\n\n/*\n * The selection indicator, one per tab. Unselected it has to disappear into the tab, so it\n * paints the tab's own background rather than a fixed white; selected it becomes\n * `--pie-tertiary`, which every scheme sets.\n */\nconst Underline: any = styled('div')(() => ({\n height: '2px',\n width: '100%',\n marginTop: '6px',\n background: color.background(),\n}));\n\nclass StimulusTabs extends React.Component {\n state = {\n activeTab: 0,\n zoomCompensation: computeZoomCompensation(),\n containerWidth: 0,\n };\n\n containerRef = React.createRef();\n\n // Tab ids are model indexes, so DOM ids take a per-instance prefix and each passage's\n // aria-controls / aria-labelledby pairs resolve inside that passage. `button-N` and\n // `tabpanel-N` stay as class hooks.\n idPrefix = createUniqueId('passage');\n\n tabButtonId: any = (tabId) => `${this.idPrefix}-button-${tabId}`;\n\n tabPanelId: any = (tabId) => `${this.idPrefix}-tabpanel-${tabId}`;\n\n componentDidMount() {\n if (typeof window === 'undefined') return;\n window.addEventListener('resize', this.updateZoomCompensation);\n\n if (this.containerRef.current && typeof ResizeObserver !== 'undefined') {\n this.resizeObserver = new ResizeObserver(this.updateContainerWidth);\n this.resizeObserver.observe(this.containerRef.current);\n }\n\n this.updateContainerWidth();\n }\n\n componentWillUnmount() {\n if (typeof window === 'undefined') return;\n window.removeEventListener('resize', this.updateZoomCompensation);\n\n if (this.resizeObserver) {\n this.resizeObserver.disconnect();\n this.resizeObserver = null;\n }\n }\n\n updateZoomCompensation: any = () => {\n this.setState({ zoomCompensation: computeZoomCompensation() });\n };\n\n updateContainerWidth: any = () => {\n const node = this.containerRef.current;\n if (!node) return;\n const width = node.clientWidth;\n if (width !== this.state.containerWidth) {\n this.setState({ containerWidth: width });\n }\n };\n\n handleChange: any = (event, activeTab) => {\n this.setState(() => ({ activeTab }));\n\n setTimeout(() => {\n const tabChangeEvent = new CustomEvent('pie-ui-passage-tabChanged', {\n detail: { tab: activeTab },\n });\n\n window.dispatchEvent(tabChangeEvent);\n });\n };\n\n handleKeyDown: any = (event, currentTabId) => {\n const { key } = event;\n const { tabs } = this.props;\n\n let newTabIndex = -1;\n const currentIndex = tabs.findIndex((tab) => tab.id === currentTabId);\n\n switch (key) {\n case 'ArrowRight':\n // Move to the next tab\n newTabIndex = (currentIndex + 1) % tabs.length;\n break;\n case 'ArrowLeft':\n // Move to the previous tab\n newTabIndex = (currentIndex - 1 + tabs.length) % tabs.length;\n break;\n // Commented out ArrowDown and ArrowUp for future vertical tab navigation\n // case 'ArrowDown':\n // // Move to the next tab (for vertical alignment)\n // newTabIndex = (currentIndex + 1) % tabs.length;\n // break;\n // case 'ArrowUp':\n // // Move to the previous tab (for vertical alignment)\n // newTabIndex = (currentIndex - 1 + tabs.length) % tabs.length;\n // break;\n case 'Home':\n // Move to the first tab\n newTabIndex = 0;\n break;\n case 'End':\n // Move to the last tab\n newTabIndex = tabs.length - 1;\n break;\n case 'Enter':\n case ' ':\n // Activate the current tab\n newTabIndex = currentIndex;\n break;\n default:\n break;\n }\n\n if (newTabIndex !== -1) {\n event.preventDefault();\n event.stopPropagation();\n this.handleChange(event, tabs[newTabIndex].id);\n this.containerRef.current?.querySelector(`[id=\"${this.tabButtonId(tabs[newTabIndex].id)}\"]`)?.focus();\n }\n };\n\n parsedText: any = (text = '') => {\n // fix imported audio content for Safari PD-1391\n const div = document.createElement('div');\n div.innerHTML = sanitizeModelHtml(text.replace(/(<br\\/>\\n)/g, '<br/>'));\n\n const audio = div.querySelector('audio');\n\n if (audio) {\n const source = document.createElement('source');\n\n source.setAttribute('type', 'audio/mp3');\n source.setAttribute('src', audio.getAttribute('src'));\n\n audio.removeAttribute('src');\n audio.appendChild(source);\n }\n\n return div.innerHTML;\n };\n\n renderInstructions(teacherInstructions, disabledTabs = false) {\n if (!teacherInstructions) {\n return;\n }\n\n const teacherInstructionsDiv = (\n <PreviewPrompt\n tagName=\"div\"\n className=\"prompt\"\n defaultClassName=\"teacher-instructions\"\n prompt={teacherInstructions}\n />\n );\n\n if (disabledTabs) {\n return teacherInstructionsDiv;\n }\n\n return (\n <Collapsible\n labels={{\n hidden: translator.t('common:showTeacherInstructions', { lng: this.props.model?.language }),\n visible: translator.t('common:hideTeacherInstructions', { lng: this.props.model?.language }),\n }}\n >\n {teacherInstructionsDiv}\n </Collapsible>\n );\n }\n\n // Outside a tab list (one passage, or print) no tab names the panel, so it renders without the\n // tabpanel role and its title heading carries the structure.\n renderTab(tab, disabledTabs, tabbed = true) {\n const { baseHeadingLevel } = this.props;\n const clampedLevel = baseHeadingLevel ? Math.min(6, Math.max(1, baseHeadingLevel)) : undefined;\n const TitleTag = baseHeadingLevel ? `h${clampedLevel}` : 'h2'; // default to h2 if no base level is provided - this was the previous behavior\n const textLevel = baseHeadingLevel ? Math.min(6, Math.max(1, clampedLevel + 1)) : undefined; // promote text headings one level above title\n\n return (\n <Passage\n key={tab.id}\n id={this.tabPanelId(tab.id)}\n className={`tabpanel-${tab.id}`}\n {...(tabbed && { role: 'tabpanel', 'aria-labelledby': this.tabButtonId(tab.id) })}\n >\n {this.renderInstructions(tab.teacherInstructions, disabledTabs)}\n\n {tab.title && (\n <Purpose purpose=\"passage-title\">\n <TitleTag>\n <PassageTitle dangerouslySetInnerHTML={{ __html: this.parsedText(tab.title) }} />\n </TitleTag>\n </Purpose>\n )}\n\n {tab.subtitle && (\n <Purpose purpose=\"passage-subtitle\">\n <PassageSubtitle dangerouslySetInnerHTML={{ __html: this.parsedText(tab.subtitle) }} />\n </Purpose>\n )}\n\n {tab.author && (\n <Purpose purpose=\"passage-author\">\n <PassageAuthor className=\"author\" dangerouslySetInnerHTML={{ __html: this.parsedText(tab.author) }} />\n </Purpose>\n )}\n\n {tab.text && (\n <Purpose purpose=\"passage-text\">\n <div key={tab.id} className=\"text\" dangerouslySetInnerHTML={{ __html: sanitizeModelHtml(baseHeadingLevel ? transformDataHeadings(tab.text, textLevel) : tab.text) }} />\n </Purpose>\n )}\n </Passage>\n );\n }\n\n render() {\n const { model, tabs, disabledTabs } = this.props;\n const { activeTab, zoomCompensation, containerWidth } = this.state;\n\n if (!tabs?.length) {\n return;\n }\n\n const { extraCSSRules } = model || {};\n const selectedTab = (tabs || []).find((tab) => tab.id === activeTab);\n\n // cap each tab at 1/n of the passage container width so a single long\n // title can't push other tabs off-screen. Existing two-line wrap + ellipsis\n // on .passage-label still trims anything that doesn't fit.\n const tabMaxWidth = containerWidth > 0 ? containerWidth / tabs.length : null;\n // When per-tab horizontal space drops to NUMERIC_LABEL_MIN_WIDTH_PER_TAB or\n // less, titles become unreadably truncated; swap to \"Passage N\" so users\n // can still navigate. Container width is read once layout has settled\n // (>0), so initial render uses real labels.\n const useNumericLabels =\n containerWidth > 0 && containerWidth <= tabs.length * NUMERIC_LABEL_MIN_WIDTH_PER_TAB;\n\n return (\n <UiLayout extraCSSRules={extraCSSRules}>\n <PassagesContainer className=\"passages\" ref={this.containerRef}>\n {disabledTabs || tabs.length === 1 ? (\n tabs.map((tab) => this.renderTab(tab, disabledTabs, false))\n ) : (\n <>\n <Tabs\n sx={{\n // Below the breakpoint (e.g. WCAG 400% zoom, ~320px viewport)\n // the tabs are in normal flow and scroll with the passage text,\n // so they don't lock up space needed to display the passage.\n position: 'static',\n // Above the breakpoint there is adequate screen space, so the\n // tabs stay locked to the top of the panel while the passage\n // text scrolls beneath them.\n [`@media (min-width: ${STICKY_TABS_BREAKPOINT + 1}px)`]: {\n position: 'sticky',\n top: 0,\n zIndex: 1,\n },\n background: 'var(--pie-passage-header-background, rgba(255,255,255,0))',\n color: color.text(),\n fontFamily: 'Roboto, sans-serif',\n // Freeze the tabs' physical size at their 200%-zoom appearance\n // when browser zoom exceeds 200%. The factor is 1 at zoom <= 200%,\n // so behavior below that threshold is unchanged. Using `zoom`\n // (rather than transform: scale) shrinks the layout box itself,\n // so the reclaimed space flows to the passage content below.\n zoom: zoomCompensation,\n '& .MuiTabs-list': {\n /*\n * The strip behind the tabs. A host that has opted into\n * `--pie-passage-header-background` keeps its own colour on every\n * scheme -- Knowledge Checks' pale green-blue is deliberate and is not\n * a scheme's business to override. With no host colour the fallback has\n * to be a theme token rather than a white literal, or the strip stays\n * white over a dark passage body.\n */\n backgroundColor: `var(--pie-passage-header-background, ${color.backgroundDark()})`,\n borderBottom: `1px solid ${color.borderGray()}`,\n },\n '& .MuiTabs-indicator': {\n backgroundColor: color.white(),\n marginBottom: '-1px',\n },\n }}\n value={activeTab}\n onChange={this.handleChange}\n >\n {tabs.map((tab, index) => (\n <TabStyled\n key={tab.id}\n id={this.tabButtonId(tab.id)}\n className={`button-${tab.id}`}\n sx={tabMaxWidth ? { maxWidth: `${tabMaxWidth}px` } : undefined}\n label={\n <>\n <Purpose purpose=\"passage-label\">\n {useNumericLabels ? (\n <span className=\"passage-label\">{`Passage ${index + 1}`}</span>\n ) : (\n <span\n className=\"passage-label\"\n dangerouslySetInnerHTML={{ __html: this.parsedText(tab.label) }}\n />\n )}\n </Purpose>\n <Underline className=\"passage-label-underline\" />\n </>\n }\n value={tab.id}\n tabIndex={activeTab === tab.id ? 0 : -1}\n aria-controls={this.tabPanelId(tab.id)}\n aria-selected={activeTab === tab.id}\n onKeyDown={(event) => this.handleKeyDown(event, tab.id)}\n />\n ))}\n </Tabs>\n {selectedTab ? this.renderTab(selectedTab, disabledTabs) : null}\n </>\n )}\n </PassagesContainer>\n </UiLayout>\n );\n }\n}\n\nStimulusTabs.propTypes = {\n tabs: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.number.isRequired,\n label: PropTypes.string.isRequired,\n title: PropTypes.string.isRequired,\n subtitle: PropTypes.string,\n author: PropTypes.string,\n text: PropTypes.string.isRequired,\n teacherInstructions: PropTypes.string,\n }).isRequired,\n ).isRequired,\n disabledTabs: PropTypes.bool,\n model: PropTypes.object,\n baseHeadingLevel: PropTypes.number,\n};\n\nexport default Stim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;MACrC,iBAAe,KAAK,WAAW,EAAI,EAAE;MACrC,iBAAe,MAAc,EAAI;MACjC,YAAY,MAAU,KAAK,cAAc,GAAO,EAAI,EAAE;KACvD,GAxBM,EAAI,EAwBV,CACF;IACG,CAAA,GACL,IAAc,KAAK,UAAU,GAAa,CAAY,IAAI,IAC3D,EAAA,CAAA;GAEa,CAAA;EACX,CAAA;CAEd;AACF;AAEA,EAAa,YAAY;CACvB,MAAM,EAAA,QAAU,QACd,EAAA,QAAU,MAAM;EACd,IAAI,EAAA,QAAU,OAAO;EACrB,OAAO,EAAA,QAAU,OAAO;EACxB,OAAO,EAAA,QAAU,OAAO;EACxB,UAAU,EAAA,QAAU;EACpB,QAAQ,EAAA,QAAU;EAClB,MAAM,EAAA,QAAU,OAAO;EACvB,qBAAqB,EAAA,QAAU;CACjC,CAAC,CAAC,CAAC,UACL,CAAC,CAAC;CACF,cAAc,EAAA,QAAU;CACxB,OAAO,EAAA,QAAU;CACjB,kBAAkB,EAAA,QAAU;AAC9B"}
|
package/dist/browser/{editor-runtime/mathjax-BKrHE4xs-olIoaCQN.js → mathjax-CptWnMbQ-ncPHVakS.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as e, l as t, n,
|
|
1
|
+
import { a as e, l as t, n, p as r, r as i, t as a } from "./speech-worker-CTpOB9m5-BIgcSm3A.js";
|
|
2
2
|
import { A as o, C as s, D as c, E as l, O as u, S as d, T as f, _ as p, a as m, b as h, c as g, d as _, f as ee, g as v, h as y, i as b, j as te, k as ne, l as x, m as re, n as ie, o as S, p as ae, s as oe, t as se, u as ce, v as le, w as ue, x as de, y as fe } from "./chtml-CbqemTOM-x0_YISTK.js";
|
|
3
|
-
//#region ../../shared/math-rendering-mathjax/dist/browser/mathjax-
|
|
3
|
+
//#region ../../shared/math-rendering-mathjax/dist/browser/mathjax-CptWnMbQ.js
|
|
4
4
|
var pe = Object.create, me = Object.defineProperty, he = Object.getOwnPropertyDescriptor, ge = Object.getOwnPropertyNames, _e = Object.getPrototypeOf, C = Object.prototype.hasOwnProperty, ve = (e, t, n) => () => {
|
|
5
5
|
if (n) throw n[0];
|
|
6
6
|
try {
|
|
@@ -24,8 +24,8 @@ var pe = Object.create, me = Object.defineProperty, he = Object.getOwnPropertyDe
|
|
|
24
24
|
}, Se = (e, t, n) => (n = e == null ? {} : pe(_e(e)), xe(t || !e || !e.__esModule ? me(n, "default", {
|
|
25
25
|
value: e,
|
|
26
26
|
enumerable: !0
|
|
27
|
-
}) : n, e)), Ce = /* @__PURE__ */ ((e) => typeof
|
|
28
|
-
if (typeof
|
|
27
|
+
}) : n, e)), Ce = /* @__PURE__ */ ((e) => typeof r < "u" ? r : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof r < "u" ? r : e)[t] }) : e)(function(e) {
|
|
28
|
+
if (typeof r < "u") return r.apply(this, arguments);
|
|
29
29
|
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
30
30
|
});
|
|
31
31
|
function we(e, t, n, r, i, a, o = null) {
|
|
@@ -36599,24 +36599,24 @@ function W_(t) {
|
|
|
36599
36599
|
}
|
|
36600
36600
|
var G_ = ["mathjax-newcm-font", "mathjax-mhchem-font-extension"].map(W_), K_ = /%%URL%%\/([^"')]+)/g;
|
|
36601
36601
|
function q_(e) {
|
|
36602
|
-
let
|
|
36603
|
-
H_ = !!
|
|
36604
|
-
let
|
|
36605
|
-
se.addFontURLs = (
|
|
36606
|
-
if (!G_.includes(
|
|
36607
|
-
for (let [
|
|
36608
|
-
let
|
|
36609
|
-
let o =
|
|
36610
|
-
return o || (
|
|
36602
|
+
let r = n(e);
|
|
36603
|
+
H_ = !!r;
|
|
36604
|
+
let a = se.addFontURLs.bind(se);
|
|
36605
|
+
se.addFontURLs = (n, r, i) => {
|
|
36606
|
+
if (!G_.includes(i)) return a(n, r, i);
|
|
36607
|
+
for (let [a, o] of Object.entries(r)) {
|
|
36608
|
+
let r = !0, s = String(o.src).replace(K_, (n, a) => {
|
|
36609
|
+
let o = t(e, `${i}/${a}`);
|
|
36610
|
+
return o || (r = !1), o ?? "";
|
|
36611
36611
|
});
|
|
36612
|
-
|
|
36612
|
+
r && (n[a] = {
|
|
36613
36613
|
...o,
|
|
36614
36614
|
src: s
|
|
36615
36615
|
});
|
|
36616
36616
|
}
|
|
36617
36617
|
};
|
|
36618
36618
|
let o = [...e.urls?.keys() ?? []];
|
|
36619
|
-
return e.root || o.some((e) => G_.some((t) => e.startsWith(`${t}/`))) ||
|
|
36619
|
+
return e.root || o.some((e) => G_.some((t) => e.startsWith(`${t}/`))) || i(H_ ? "no-web-fonts" : "no-web-fonts-or-speech"), r;
|
|
36620
36620
|
}
|
|
36621
36621
|
function J_() {
|
|
36622
36622
|
return new Promise((e) => {
|
|
@@ -36630,16 +36630,16 @@ function J_() {
|
|
|
36630
36630
|
function Y_(e) {
|
|
36631
36631
|
for (let [t, n] of Object.entries(Oc)) (n === kc || n.prototype instanceof kc) && Object.defineProperty(n, "sheetId", { value: `PIE-MJX-${t}-styles-${e}` });
|
|
36632
36632
|
}
|
|
36633
|
-
function X_(e, t,
|
|
36633
|
+
function X_(e, t, n) {
|
|
36634
36634
|
if (Cm.startup) throw Error("[math-rendering] The bundled MathJax starts once");
|
|
36635
|
-
z_(e), de.asyncLoad = V_, Y_(
|
|
36636
|
-
let
|
|
36635
|
+
z_(e), de.asyncLoad = V_, Y_(n);
|
|
36636
|
+
let r = q_(t), i = e.loader?.load?.includes("a11y/assistive-mml") ?? !1;
|
|
36637
36637
|
Cm.config = e, Cm._ = {
|
|
36638
36638
|
a11y: {
|
|
36639
36639
|
explorer: { Region: Oc },
|
|
36640
36640
|
explorer_ts: gl,
|
|
36641
36641
|
sre_ts: Js,
|
|
36642
|
-
...
|
|
36642
|
+
...i ? { "assistive-mml": qt } : {}
|
|
36643
36643
|
},
|
|
36644
36644
|
output: { chtml_ts: { CHTML: ym } },
|
|
36645
36645
|
ui: { menu: { Menu: { Menu: Ah } } }
|
|
@@ -36657,20 +36657,20 @@ function X_(e, t, r) {
|
|
|
36657
36657
|
let t = new of({
|
|
36658
36658
|
packages: I_,
|
|
36659
36659
|
...e.tex
|
|
36660
|
-
}),
|
|
36660
|
+
}), n = new lu(), l = new ym(Sm({ chtml: { ...e.chtml } }, "chtml", {
|
|
36661
36661
|
...e.output,
|
|
36662
36662
|
fontData: se,
|
|
36663
36663
|
fontURL: W_("mathjax-newcm-font")
|
|
36664
36664
|
})), u = Dl();
|
|
36665
|
-
|
|
36665
|
+
r && (u.createWorker = async (e) => a(r, e));
|
|
36666
36666
|
let d = new Ql(u, 5);
|
|
36667
|
-
d = oc(d, new lu({ allowHtmlInTokenNodes: !0 })), d = Dc(d, null), d = bl(d),
|
|
36667
|
+
d = oc(d, new lu({ allowHtmlInTokenNodes: !0 })), d = Dc(d, null), d = bl(d), i && (d = Zt(d)), d = Yh(d), de.handlers.register(d);
|
|
36668
36668
|
let f = { ...e.options };
|
|
36669
|
-
|
|
36669
|
+
r || (f.enableEnrichment = !1);
|
|
36670
36670
|
let p = de.document(document, {
|
|
36671
36671
|
...f,
|
|
36672
36672
|
MenuClass: U_,
|
|
36673
|
-
InputJax: [t,
|
|
36673
|
+
InputJax: [t, n],
|
|
36674
36674
|
OutputJax: l
|
|
36675
36675
|
});
|
|
36676
36676
|
c.document = p, J_().then(() => p.menu?.loadingPromise).then(o, s);
|
|
@@ -36689,4 +36689,4 @@ function X_(e, t, r) {
|
|
|
36689
36689
|
//#endregion
|
|
36690
36690
|
export { I_ as TEX_PACKAGES, X_ as createMathJax };
|
|
36691
36691
|
|
|
36692
|
-
//# sourceMappingURL=mathjax-
|
|
36692
|
+
//# sourceMappingURL=mathjax-CptWnMbQ-ncPHVakS.js.map
|