@pie-element/element-player 0.1.3-next.20261003161149 → 0.1.3-next.20261006032932
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.
|
@@ -67,37 +67,37 @@ var h = /* @__PURE__ */ new Set([
|
|
|
67
67
|
"mo",
|
|
68
68
|
"mi",
|
|
69
69
|
"mtext"
|
|
70
|
-
]),
|
|
70
|
+
]), re = /* @__PURE__ */ new Set([
|
|
71
71
|
"stackalign",
|
|
72
72
|
"charalign",
|
|
73
73
|
"charspacing",
|
|
74
74
|
"longdivstyle"
|
|
75
75
|
]);
|
|
76
|
-
function
|
|
76
|
+
function y(e, t, n = [], r = {}) {
|
|
77
77
|
let i = e.createElementNS(u, t);
|
|
78
78
|
for (let [e, t] of Object.entries(r)) i.setAttribute(e, t);
|
|
79
79
|
for (let e of n) e && i.appendChild(e);
|
|
80
80
|
return i;
|
|
81
81
|
}
|
|
82
|
-
function
|
|
83
|
-
let n =
|
|
82
|
+
function b(e, t) {
|
|
83
|
+
let n = y(e.document, "mo");
|
|
84
84
|
return n.textContent = t, n;
|
|
85
85
|
}
|
|
86
|
-
function
|
|
87
|
-
let t =
|
|
88
|
-
return t.textContent = "0",
|
|
86
|
+
function x(e) {
|
|
87
|
+
let t = y(e.document, "mn");
|
|
88
|
+
return t.textContent = "0", y(e.document, "mphantom", [t]);
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function S(e, t) {
|
|
91
91
|
return e.getAttribute(t)?.trim().toLowerCase() || void 0;
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function C(e, t) {
|
|
94
94
|
let n = Number.parseInt(e.getAttribute(t) ?? "", 10);
|
|
95
95
|
return Number.isFinite(n) ? n : 0;
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function w(e) {
|
|
98
98
|
return e.localName === "none" || e.localName === "mrow" && e.children.length === 0 && !e.textContent?.trim();
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function T(e, t, n = e) {
|
|
101
101
|
switch (t) {
|
|
102
102
|
case "left": return 0;
|
|
103
103
|
case "center": return Math.floor(e / 2);
|
|
@@ -105,14 +105,14 @@ function E(e, t, n = e) {
|
|
|
105
105
|
default: return n;
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function E(e, t, n) {
|
|
109
109
|
let r = [], i, a, o = (e, t) => {
|
|
110
110
|
let s = (e) => t.reduceRight((e, t) => {
|
|
111
111
|
let n = t.cloneNode(!1);
|
|
112
112
|
return n.appendChild(e), n;
|
|
113
113
|
}, e);
|
|
114
114
|
if (e.localName === "mstyle") for (let n of [...e.children]) o(n, [...t, e]);
|
|
115
|
-
else if (
|
|
115
|
+
else if (w(e)) r.push(null);
|
|
116
116
|
else if (e.localName === "mn" && e.children.length === 0) {
|
|
117
117
|
let t = [...(e.textContent ?? "").trim()];
|
|
118
118
|
for (let a of t) {
|
|
@@ -127,22 +127,22 @@ function D(e, t, n) {
|
|
|
127
127
|
return {
|
|
128
128
|
kind: "digits",
|
|
129
129
|
cells: r,
|
|
130
|
-
anchor:
|
|
130
|
+
anchor: T(r.length, n.stackAlign, i ?? a),
|
|
131
131
|
position: t
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function D(e) {
|
|
135
135
|
return (e ?? "").toLowerCase().split(/\s+/).filter((e) => h.has(e));
|
|
136
136
|
}
|
|
137
|
-
function
|
|
138
|
-
let n = [...e.children].filter((e) => !
|
|
139
|
-
return n.length <= 1 ? n[0] ?? null :
|
|
137
|
+
function ie(e, t) {
|
|
138
|
+
let n = [...e.children].filter((e) => !w(e));
|
|
139
|
+
return n.length <= 1 ? n[0] ?? null : y(t.document, "mrow", n);
|
|
140
140
|
}
|
|
141
|
-
function
|
|
142
|
-
let r =
|
|
143
|
-
content:
|
|
144
|
-
location:
|
|
145
|
-
crossout: e.hasAttribute("crossout") ?
|
|
141
|
+
function ae(e, t, n) {
|
|
142
|
+
let r = S(e, "location") ?? "n", i = D(e.getAttribute("crossout")), a = [...e.children].map((e) => w(e) ? null : e.localName === "mscarry" ? {
|
|
143
|
+
content: ie(e, n),
|
|
144
|
+
location: S(e, "location") ?? r,
|
|
145
|
+
crossout: e.hasAttribute("crossout") ? D(e.getAttribute("crossout")) : i
|
|
146
146
|
} : {
|
|
147
147
|
content: e,
|
|
148
148
|
location: r,
|
|
@@ -151,60 +151,60 @@ function ie(e, t, n) {
|
|
|
151
151
|
return {
|
|
152
152
|
kind: "carries",
|
|
153
153
|
carries: a,
|
|
154
|
-
anchor:
|
|
154
|
+
anchor: T(a.length, n.stackAlign),
|
|
155
155
|
position: t,
|
|
156
156
|
scale: te.test(o) ? o : "0.6"
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
|
-
function
|
|
160
|
-
let t =
|
|
159
|
+
function O(e) {
|
|
160
|
+
let t = S(e, "mslinethickness") ?? "medium", n = g[t] ?? (v.test(t) ? t : "0.07em"), r = e.getAttribute("mathcolor")?.trim() ?? "";
|
|
161
161
|
return `${n} solid ${ee.test(r) ? r : "currentColor"}`;
|
|
162
162
|
}
|
|
163
|
-
function
|
|
164
|
-
let r = Math.max(0,
|
|
163
|
+
function oe(e, t, n) {
|
|
164
|
+
let r = Math.max(0, C(e, "length"));
|
|
165
165
|
return {
|
|
166
166
|
kind: "line",
|
|
167
167
|
length: r,
|
|
168
|
-
anchor:
|
|
168
|
+
anchor: T(r, n.stackAlign),
|
|
169
169
|
position: t,
|
|
170
|
-
border:
|
|
170
|
+
border: O(e)
|
|
171
171
|
};
|
|
172
172
|
}
|
|
173
|
-
function
|
|
173
|
+
function k(e, t, n, r, i) {
|
|
174
174
|
e.forEach((e, a) => {
|
|
175
|
-
let o = t + a * n +
|
|
175
|
+
let o = t + a * n + C(e, "position");
|
|
176
176
|
switch (e.localName) {
|
|
177
177
|
case "msgroup":
|
|
178
|
-
|
|
178
|
+
k([...e.children], o, C(e, "shift"), r, i);
|
|
179
179
|
break;
|
|
180
180
|
case "msline":
|
|
181
|
-
i.push(
|
|
181
|
+
i.push(oe(e, o, r));
|
|
182
182
|
break;
|
|
183
183
|
case "mscarries":
|
|
184
|
-
i.push(
|
|
184
|
+
i.push(ae(e, o, r));
|
|
185
185
|
break;
|
|
186
186
|
case "msrow":
|
|
187
187
|
case "mrow":
|
|
188
|
-
i.push(
|
|
188
|
+
i.push(E([...e.children], o, r));
|
|
189
189
|
break;
|
|
190
|
-
default: i.push(
|
|
190
|
+
default: i.push(E([e], o, r));
|
|
191
191
|
}
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function A(e) {
|
|
195
195
|
return -e.anchor - e.position;
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function j(e) {
|
|
198
198
|
return e.kind === "digits" ? e.cells.length : e.kind === "carries" ? e.carries.length : e.length;
|
|
199
199
|
}
|
|
200
|
-
function
|
|
201
|
-
return
|
|
200
|
+
function M(e) {
|
|
201
|
+
return A(e) + j(e) - 1;
|
|
202
202
|
}
|
|
203
|
-
function
|
|
204
|
-
let i = (e) =>
|
|
203
|
+
function se(e, t, n, r) {
|
|
204
|
+
let i = (e) => y(r.document, "mpadded", [t], {
|
|
205
205
|
width: "0",
|
|
206
206
|
...e ? { lspace: e } : {}
|
|
207
|
-
}), a = (e, t) =>
|
|
207
|
+
}), a = (e, t) => y(r.document, e, t);
|
|
208
208
|
switch (n) {
|
|
209
209
|
case "s": return a("munder", [e, i("-0.5width")]);
|
|
210
210
|
case "ne": return a("msup", [e, i()]);
|
|
@@ -226,49 +226,49 @@ function oe(e, t, n, r) {
|
|
|
226
226
|
default: return a("mover", [e, i("-0.5width")]);
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
|
-
function
|
|
230
|
-
let r =
|
|
229
|
+
function ce(e, t, n) {
|
|
230
|
+
let r = y(n.document, "menclose", [e], {
|
|
231
231
|
notation: t.join(" "),
|
|
232
232
|
"data-padding": "0.1em",
|
|
233
233
|
"data-thickness": "0.067em"
|
|
234
234
|
}), i = t.some((e) => e.endsWith("diagonalstrike")) ? .167 : t.includes("horizontalstrike") ? .1 : 0;
|
|
235
|
-
return i ?
|
|
235
|
+
return i ? y(n.document, "mpadded", [r], {
|
|
236
236
|
lspace: `-${i}em`,
|
|
237
237
|
width: `-${2 * i}em`
|
|
238
238
|
}) : r;
|
|
239
239
|
}
|
|
240
|
-
function
|
|
241
|
-
let a = e && t.crossout.length ?
|
|
240
|
+
function le(e, t, n, r, i) {
|
|
241
|
+
let a = e && t.crossout.length ? ce(e, t.crossout, i) : e;
|
|
242
242
|
if (!t.content) return a;
|
|
243
|
-
let o =
|
|
244
|
-
return
|
|
243
|
+
let o = y(i.document, "mstyle", [t.content], { scriptsizemultiplier: r });
|
|
244
|
+
return se(a ?? x(i), o, n, i);
|
|
245
245
|
}
|
|
246
|
-
function
|
|
247
|
-
return e.carries[t -
|
|
246
|
+
function N(e, t) {
|
|
247
|
+
return e.carries[t - A(e)] ?? null;
|
|
248
248
|
}
|
|
249
|
-
function
|
|
249
|
+
function ue(e, t, n, r) {
|
|
250
250
|
let i = e.content;
|
|
251
251
|
n.forEach((e, a) => {
|
|
252
|
-
let o = n.length - 1 - a, s = n[o], c =
|
|
252
|
+
let o = n.length - 1 - a, s = n[o], c = N(s, t), l = n.slice(0, o).some((e) => N(e, t));
|
|
253
253
|
if (!c && !l) return;
|
|
254
254
|
let u = c ?? {
|
|
255
|
-
content:
|
|
255
|
+
content: x(r),
|
|
256
256
|
location: "n",
|
|
257
257
|
crossout: []
|
|
258
258
|
}, d = a === 0 ? u.location : "n";
|
|
259
|
-
i =
|
|
259
|
+
i = le(i, u, d, s.scale, r);
|
|
260
260
|
}), e.content = i;
|
|
261
261
|
}
|
|
262
|
-
function
|
|
263
|
-
let n = e.filter((e) =>
|
|
262
|
+
function P(e, t) {
|
|
263
|
+
let n = e.filter((e) => j(e) > 0), r = Math.min(0, ...n.map(A)), i = Math.max(r, ...n.map(M)) - r + 1, a = -r, o = [], s = /* @__PURE__ */ new Map(), c = () => Array.from({ length: i }, () => ({
|
|
264
264
|
content: null,
|
|
265
265
|
borders: {}
|
|
266
|
-
})), l = (e) => e.length === 0 ? Array.from({ length: i }, (e, t) => t) : Array.from({ length: e.length }, (t, n) => a +
|
|
266
|
+
})), l = (e) => e.length === 0 ? Array.from({ length: i }, (e, t) => t) : Array.from({ length: e.length }, (t, n) => a + A(e) + n), u = [], d = [], f = (e) => {
|
|
267
267
|
let n = c();
|
|
268
268
|
e.cells.forEach((t, r) => {
|
|
269
|
-
n[a +
|
|
269
|
+
n[a + A(e) + r].content = t;
|
|
270
270
|
}), u.length && n.forEach((e, n) => {
|
|
271
|
-
|
|
271
|
+
ue(e, n - a, u, t);
|
|
272
272
|
});
|
|
273
273
|
for (let e of d) for (let t of l(e)) n[t].borders.top = e.border;
|
|
274
274
|
u = [], d = [], s.set(e, o.length), o.push(n);
|
|
@@ -288,44 +288,44 @@ function F(e, t) {
|
|
|
288
288
|
origin: a
|
|
289
289
|
};
|
|
290
290
|
}
|
|
291
|
-
function
|
|
292
|
-
let r =
|
|
291
|
+
function F(e, { rows: t }, n) {
|
|
292
|
+
let r = y(n.document, "mtable", t.map((e) => y(n.document, "mtr", e.map((e) => {
|
|
293
293
|
let t = Object.entries(e.borders).map(([e, t]) => `border-${e}:${t}`).join(";");
|
|
294
|
-
return
|
|
294
|
+
return y(n.document, "mtd", [e.content], {
|
|
295
295
|
...t ? { style: t } : {},
|
|
296
296
|
...e.align ? { columnalign: e.align } : {}
|
|
297
297
|
});
|
|
298
298
|
}))));
|
|
299
|
-
for (let { name: t, value: n } of [...e.attributes])
|
|
300
|
-
let i =
|
|
299
|
+
for (let { name: t, value: n } of [...e.attributes]) re.has(t) || r.setAttribute(t, n);
|
|
300
|
+
let i = S(e, "charspacing") ?? "medium", a = S(e, "charalign");
|
|
301
301
|
return r.setAttribute("columnspacing", _[i] ?? (v.test(i) ? i : _.medium)), r.setAttribute("columnalign", a === "left" || a === "center" ? a : "right"), r.setAttribute("rowspacing", "0"), r.setAttribute("align", e.getAttribute("align") ?? "baseline"), r;
|
|
302
302
|
}
|
|
303
|
-
function
|
|
303
|
+
function I(e) {
|
|
304
304
|
return {
|
|
305
305
|
document: e.ownerDocument,
|
|
306
|
-
stackAlign:
|
|
306
|
+
stackAlign: S(e, "stackalign") ?? "decimalpoint",
|
|
307
307
|
decimalPoint: e.closest("[decimalpoint]")?.getAttribute("decimalpoint")?.trim().charAt(0) || "."
|
|
308
308
|
};
|
|
309
309
|
}
|
|
310
|
-
function
|
|
311
|
-
let t =
|
|
312
|
-
return
|
|
310
|
+
function de(e) {
|
|
311
|
+
let t = I(e), n = [];
|
|
312
|
+
return k([...e.children], 0, 0, t, n), F(e, P(n, t), t);
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function L(e, t, n, r, i, a) {
|
|
315
315
|
for (let o = n; o <= r; o++) e[t][o].borders[i] = a;
|
|
316
316
|
}
|
|
317
|
-
function
|
|
318
|
-
let n =
|
|
319
|
-
return n.setAttribute("minsize", "1.2em"), [
|
|
317
|
+
function fe(e, t) {
|
|
318
|
+
let n = b(t, ")");
|
|
319
|
+
return n.setAttribute("minsize", "1.2em"), [y(t.document, "mrow", [e, y(t.document, "mspace", [], { width: "0.2em" })]), y(t.document, "mpadded", [n], {
|
|
320
320
|
voffset: "0.1em",
|
|
321
321
|
lspace: "-0.15em",
|
|
322
322
|
depth: "-0.2em",
|
|
323
323
|
height: "-0.2em"
|
|
324
324
|
})];
|
|
325
325
|
}
|
|
326
|
-
function
|
|
327
|
-
let t =
|
|
328
|
-
|
|
326
|
+
function R(e) {
|
|
327
|
+
let t = I(e), [n, r, ...i] = [...e.children], a = n && !w(n) ? n : null, o = r && !w(r) ? r : null, s = S(e, "longdivstyle") ?? "lefttop", c = O(e), l = [];
|
|
328
|
+
k(i, 0, 0, t, l);
|
|
329
329
|
let u = l.find((e) => e.kind === "digits");
|
|
330
330
|
u || (u = {
|
|
331
331
|
kind: "digits",
|
|
@@ -337,51 +337,51 @@ function V(e) {
|
|
|
337
337
|
u.cells.unshift(...e), u.anchor += e.length;
|
|
338
338
|
}, p = (...e) => {
|
|
339
339
|
let n = e.flatMap((e) => e ? e.localName === "mrow" ? [...e.children] : [e] : []);
|
|
340
|
-
u.cells.push(...
|
|
340
|
+
u.cells.push(...E(n, 0, t).cells);
|
|
341
341
|
};
|
|
342
342
|
switch (s) {
|
|
343
343
|
case "left/\\right":
|
|
344
|
-
f(a,
|
|
344
|
+
f(a, b(t, "/")), p(b(t, "\\"), o);
|
|
345
345
|
break;
|
|
346
346
|
case "left)(right":
|
|
347
|
-
f(a,
|
|
347
|
+
f(a, b(t, ")")), p(b(t, "("), o);
|
|
348
348
|
break;
|
|
349
349
|
case ":right=right":
|
|
350
|
-
p(
|
|
350
|
+
p(b(t, ":"), a, b(t, "="), o);
|
|
351
351
|
break;
|
|
352
352
|
case "righttop":
|
|
353
353
|
case "stackedleftlinetop":
|
|
354
354
|
case "lefttop":
|
|
355
|
-
o &&
|
|
355
|
+
o && k([o], 0, 0, t, d), l.splice(l.indexOf(u), 0, ...d), s === "righttop" ? p(a) : s === "stackedleftlinetop" ? f(a) : f(...fe(a, t));
|
|
356
356
|
break;
|
|
357
357
|
}
|
|
358
|
-
let m =
|
|
358
|
+
let m = P(l, t), h = m.rows, g = m.rowOf.get(u) ?? 0, _ = (e) => m.origin + A(u) + e, v = Math.max(_(u.cells.length - 1), ...d.map((e) => m.origin + M(e)));
|
|
359
359
|
switch (s) {
|
|
360
360
|
case "left/\\right":
|
|
361
361
|
case "left)(right":
|
|
362
362
|
case ":right=right": break;
|
|
363
363
|
case "righttop": {
|
|
364
364
|
let e = h[g][_(u.cells.length - 1)];
|
|
365
|
-
e.borders.left = c, e.borders.bottom = c,
|
|
365
|
+
e.borders.left = c, e.borders.bottom = c, L(h, g, _(0), _(u.cells.length - 1), "top", c);
|
|
366
366
|
break;
|
|
367
367
|
}
|
|
368
368
|
case "stackedleftlinetop": {
|
|
369
369
|
let e = h[g][_(0)];
|
|
370
|
-
e.borders.right = c, e.borders.bottom = c,
|
|
370
|
+
e.borders.right = c, e.borders.bottom = c, L(h, g, _(1), v, "top", c);
|
|
371
371
|
break;
|
|
372
372
|
}
|
|
373
373
|
case "stackedrightright":
|
|
374
374
|
case "mediumstackedrightright":
|
|
375
375
|
case "shortstackedrightright":
|
|
376
376
|
case "stackedleftleft":
|
|
377
|
-
|
|
377
|
+
z(h, g, s, a, o, c, t);
|
|
378
378
|
break;
|
|
379
|
-
default:
|
|
379
|
+
default: L(h, g, _(1), v, "top", c);
|
|
380
380
|
}
|
|
381
|
-
return
|
|
381
|
+
return F(e, m, t);
|
|
382
382
|
}
|
|
383
|
-
function
|
|
384
|
-
let s = n === "stackedleftleft", c = s ? "right" : "left", l = (e) => e &&
|
|
383
|
+
function z(e, t, n, r, i, a, o) {
|
|
384
|
+
let s = n === "stackedleftleft", c = s ? "right" : "left", l = (e) => e && y(o.document, "mpadded", [e], {
|
|
385
385
|
lspace: "0.2em",
|
|
386
386
|
width: "+0.4em"
|
|
387
387
|
});
|
|
@@ -400,55 +400,96 @@ function H(e, t, n, r, i, a, o) {
|
|
|
400
400
|
}) : 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);
|
|
401
401
|
});
|
|
402
402
|
}
|
|
403
|
-
function
|
|
404
|
-
for (let t of [...e.querySelectorAll("mstack, mlongdiv")]) !t.closest("math") || t.closest("mjx-container") || t.replaceWith(t.localName === "mstack" ?
|
|
403
|
+
function B(e) {
|
|
404
|
+
for (let t of [...e.querySelectorAll("mstack, mlongdiv")]) !t.closest("math") || t.closest("mjx-container") || t.replaceWith(t.localName === "mstack" ? de(t) : R(t));
|
|
405
|
+
}
|
|
406
|
+
var V = "PIE-MJX-explorer-styles", H = "var(--pie-text, black)", pe = "var(--pie-background, #ffffff)", me = "var(--pie-border-dark, #66686A)", U = "var(--pie-focus-outline, var(--pie-button-focus-outline, var(--pie-focus-checked-border, #1565C0)))", W = `color-mix(in srgb, ${U} 15%, transparent)`, he = `
|
|
407
|
+
:root mjx-container [data-sre-highlight-1]:not([data-mjx-collapsed], rect) {
|
|
408
|
+
color: ${H} !important;
|
|
409
|
+
fill: ${H} !important;
|
|
405
410
|
}
|
|
406
|
-
|
|
411
|
+
:root mjx-container:not([data-mjx-clone-container]) [data-sre-highlight-1]:not([data-sre-enclosed], rect) {
|
|
412
|
+
background-color: ${W} !important;
|
|
413
|
+
}
|
|
414
|
+
:root mjx-container rect[data-sre-highlight-1]:not([data-sre-enclosed]) {
|
|
415
|
+
fill: ${W} !important;
|
|
416
|
+
}
|
|
417
|
+
:root mjx-container .mjx-selected {
|
|
418
|
+
outline: 2px solid ${U} !important;
|
|
419
|
+
}
|
|
420
|
+
:root mjx-container [data-sre-highlight-2] {
|
|
421
|
+
color: ${H} !important;
|
|
422
|
+
background-color: transparent !important;
|
|
423
|
+
fill: ${H} !important;
|
|
424
|
+
outline: 2px dashed ${U} !important;
|
|
425
|
+
}
|
|
426
|
+
:root mjx-container rect[data-sre-highlight-2] {
|
|
427
|
+
fill: transparent !important;
|
|
428
|
+
stroke: ${U} !important;
|
|
429
|
+
stroke-width: 2px !important;
|
|
430
|
+
vector-effect: non-scaling-stroke;
|
|
431
|
+
}
|
|
432
|
+
:root .MJX_LiveRegion, :root .MJX_HoverRegion, :root .MJX_ToolTip {
|
|
433
|
+
color: ${H} !important;
|
|
434
|
+
background-color: ${pe} !important;
|
|
435
|
+
border-color: ${me} !important;
|
|
436
|
+
}
|
|
437
|
+
:root .MJX_LiveRegion > div, :root .MJX_HoverRegion > div {
|
|
438
|
+
color: ${H} !important;
|
|
439
|
+
background-color: ${W} !important;
|
|
440
|
+
}
|
|
441
|
+
`;
|
|
442
|
+
function ge(e = document) {
|
|
443
|
+
if (e.getElementById("PIE-MJX-explorer-styles")) return;
|
|
444
|
+
let t = e.createElement("style");
|
|
445
|
+
t.id = V, t.textContent = he, e.head.appendChild(t);
|
|
446
|
+
}
|
|
447
|
+
var _e = "https://cdn.jsdelivr.net/npm/mathjax@4.1.3/tex-mml-chtml.js", ve = {
|
|
407
448
|
parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
|
|
408
449
|
overarc: "\\overparen",
|
|
409
450
|
napprox: "\\not\\approx",
|
|
410
451
|
longdiv: "\\enclose{longdiv}",
|
|
411
452
|
abs: ["\\left|#1\\right|", 1]
|
|
412
|
-
},
|
|
453
|
+
}, ye = "[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)", be = /\\\(|\\\[|\$\$|\\\$|\\begin\{|\\(?:eq)?ref\{/, xe = /\\\(|\\\[|\$|\\begin\{|\\(?:eq)?ref\{/, Se = /\\embed\{newLine\}\[\]/g, Ce = [
|
|
413
454
|
["$$", "$$"],
|
|
414
455
|
["$", "$"],
|
|
415
456
|
["\\[", "\\]"],
|
|
416
457
|
["\\(", "\\)"]
|
|
417
|
-
], G = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading"),
|
|
458
|
+
], G = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading"), we = "MJX-CHTML-styles", Te = "PIE-MJX-SVG-styles", K = "PIE-MathJax-Menu-Settings", Ee = { "mjx-container[overflow=\"linebreak\"][display]": {
|
|
418
459
|
overflow: "auto clip",
|
|
419
460
|
"min-width": "initial !important"
|
|
420
|
-
} },
|
|
461
|
+
} }, De = 200, Oe = 201;
|
|
421
462
|
function q(e) {
|
|
422
463
|
let t = [...e.matches("mjx-container") ? [e] : [], ...e.querySelectorAll("mjx-container")];
|
|
423
464
|
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");
|
|
424
465
|
}
|
|
425
|
-
function
|
|
426
|
-
for (let [t, n] of
|
|
466
|
+
function ke(e) {
|
|
467
|
+
for (let [t, n] of Ce) if (e.startsWith(t) && e.endsWith(n)) return e.substring(t.length, e.length - n.length);
|
|
427
468
|
return e;
|
|
428
469
|
}
|
|
429
|
-
function
|
|
430
|
-
return
|
|
470
|
+
function Ae(e) {
|
|
471
|
+
return ke(e.includes("\\displaystyle") ? e.replace("\\displaystyle", "").trim() : e);
|
|
431
472
|
}
|
|
432
|
-
var
|
|
433
|
-
function
|
|
434
|
-
let n = e.closest(`.${
|
|
473
|
+
var je = "mathjax_ignore", J = "mathjax_process";
|
|
474
|
+
function Me(e, t) {
|
|
475
|
+
let n = e.closest(`.${je}, .${J}`);
|
|
435
476
|
return n !== null && t.contains(n) && !n.classList.contains(J);
|
|
436
477
|
}
|
|
437
|
-
function
|
|
478
|
+
function Ne(e) {
|
|
438
479
|
for (let t of e.querySelectorAll("[data-latex]")) {
|
|
439
|
-
if (t.dataset.mathHandled || t.closest("mjx-container") ||
|
|
480
|
+
if (t.dataset.mathHandled || t.closest("mjx-container") || Me(t, e)) continue;
|
|
440
481
|
let n = t.textContent;
|
|
441
|
-
n && (t.textContent = `\\(${
|
|
482
|
+
n && (t.textContent = `\\(${Ae(n)}\\)`.replace(Se, "\\newline "), t.dataset.mathHandled = "true");
|
|
442
483
|
}
|
|
443
484
|
}
|
|
444
|
-
function
|
|
485
|
+
function Pe(e) {
|
|
445
486
|
for (let t of e.querySelectorAll("math")) t.closest("mjx-container") || t.setAttribute("displaystyle", "true");
|
|
446
487
|
}
|
|
447
|
-
function
|
|
488
|
+
function Fe(e, t) {
|
|
448
489
|
for (let t of e.querySelectorAll("math")) if (!t.closest("mjx-assistive-mml")) return !0;
|
|
449
|
-
return (t ?
|
|
490
|
+
return (t ? xe : be).test(e.textContent ?? "");
|
|
450
491
|
}
|
|
451
|
-
function
|
|
492
|
+
function Ie(e) {
|
|
452
493
|
return new Promise((t, n) => {
|
|
453
494
|
let { useSingleDollar: r = !1, accessibility: o = !0, loadFonts: s = !0, srcUrl: c } = e, l = {
|
|
454
495
|
loader: {
|
|
@@ -463,10 +504,10 @@ function Oe(e) {
|
|
|
463
504
|
typeset: !1,
|
|
464
505
|
ready: () => {
|
|
465
506
|
let e = i(), r = e?.startup, a = Y(e);
|
|
466
|
-
a && (X(e),
|
|
507
|
+
a && (X(e), Z(e)), r?.defaultReady?.(), a && (Le(r?.document), r?.document?.addStyles?.(Ee)), Promise.resolve(r?.promise).then(() => t(), n);
|
|
467
508
|
}
|
|
468
509
|
},
|
|
469
|
-
tex: { macros: { ...
|
|
510
|
+
tex: { macros: { ...ve } },
|
|
470
511
|
output: { displayOverflow: "linebreak" },
|
|
471
512
|
options: {
|
|
472
513
|
enableMenu: o,
|
|
@@ -478,7 +519,7 @@ function Oe(e) {
|
|
|
478
519
|
a11y: { inTabOrder: !1 }
|
|
479
520
|
}
|
|
480
521
|
};
|
|
481
|
-
r && l.tex && (console.warn(
|
|
522
|
+
r && l.tex && (console.warn(ye), l.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], l.tex.processEscapes = !0), s || (l.chtml = { fontURL: "" }), a(l, c || _e).catch(n);
|
|
482
523
|
});
|
|
483
524
|
}
|
|
484
525
|
function Y(e) {
|
|
@@ -488,9 +529,9 @@ function X(e) {
|
|
|
488
529
|
let t = e?._?.output, n = t?.chtml_ts?.CHTML;
|
|
489
530
|
n && (n.STYLESHEETID = s);
|
|
490
531
|
let r = t?.svg_ts?.SVG;
|
|
491
|
-
r && (r.STYLESHEETID =
|
|
532
|
+
r && (r.STYLESHEETID = Te);
|
|
492
533
|
}
|
|
493
|
-
function
|
|
534
|
+
function Z(e) {
|
|
494
535
|
let t = e?._?.ui?.menu?.Menu?.Menu;
|
|
495
536
|
if (t) {
|
|
496
537
|
t.MENU_STORAGE = K;
|
|
@@ -503,13 +544,13 @@ function ke(e) {
|
|
|
503
544
|
} catch {}
|
|
504
545
|
}
|
|
505
546
|
}
|
|
506
|
-
function
|
|
547
|
+
function Le(e) {
|
|
507
548
|
if (!e) return;
|
|
508
549
|
let t = /* @__PURE__ */ new WeakSet(), n = (e) => {
|
|
509
550
|
let n = e.typesetRoot;
|
|
510
551
|
!n || t.has(n) || (q(n), t.add(n));
|
|
511
552
|
};
|
|
512
|
-
e.addRenderAction?.("pie-strip-latex",
|
|
553
|
+
e.addRenderAction?.("pie-strip-latex", Oe, (e) => {
|
|
513
554
|
for (let t of e.math ?? []) n(t);
|
|
514
555
|
return !1;
|
|
515
556
|
}, (e) => {
|
|
@@ -517,7 +558,7 @@ function Z(e) {
|
|
|
517
558
|
return t && q(t), !1;
|
|
518
559
|
});
|
|
519
560
|
let r = e.outputJax?.chtmlStyles;
|
|
520
|
-
r?.id ===
|
|
561
|
+
r?.id === we && (r.id = s), Re();
|
|
521
562
|
}
|
|
522
563
|
function Q(e) {
|
|
523
564
|
return e instanceof HTMLStyleElement && c.includes(e.id);
|
|
@@ -525,7 +566,7 @@ function Q(e) {
|
|
|
525
566
|
function $(e) {
|
|
526
567
|
n("foreign-output-stylesheet", `another MathJax added <style id="${e.id}"> to <head>`);
|
|
527
568
|
}
|
|
528
|
-
function
|
|
569
|
+
function Re() {
|
|
529
570
|
let e = document.head, t = [...e.children].find(Q);
|
|
530
571
|
if (t) {
|
|
531
572
|
$(t);
|
|
@@ -542,16 +583,16 @@ function Ae() {
|
|
|
542
583
|
});
|
|
543
584
|
n.observe(e, { childList: !0 });
|
|
544
585
|
}
|
|
545
|
-
function
|
|
586
|
+
function ze(e) {
|
|
546
587
|
let t = e?.math;
|
|
547
588
|
if (!t?.remove) return;
|
|
548
|
-
let n = [...t].filter((e) => (e.state?.() ?? 0) >=
|
|
589
|
+
let n = [...t].filter((e) => (e.state?.() ?? 0) >= De && e.typesetRoot?.isConnected === !1);
|
|
549
590
|
if (n.length !== 0) {
|
|
550
591
|
for (let e of [...n].reverse()) e.clear?.();
|
|
551
592
|
t.remove(...n);
|
|
552
593
|
}
|
|
553
594
|
}
|
|
554
|
-
function
|
|
595
|
+
function Be(e) {
|
|
555
596
|
return new Promise((t, n) => {
|
|
556
597
|
let r = e.startup ?? {};
|
|
557
598
|
e.startup = r;
|
|
@@ -562,34 +603,34 @@ function Me(e) {
|
|
|
562
603
|
};
|
|
563
604
|
});
|
|
564
605
|
}
|
|
565
|
-
function
|
|
606
|
+
function Ve(e) {
|
|
566
607
|
let t = i();
|
|
567
|
-
return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() :
|
|
608
|
+
return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : Be(t) : Ie(e);
|
|
568
609
|
}
|
|
569
|
-
function
|
|
570
|
-
return
|
|
610
|
+
function He(e) {
|
|
611
|
+
return Ve(e).then(() => {
|
|
571
612
|
typeof i()?.typesetPromise != "function" && console.warn("[mathjax-renderer] MathJax on this page has no typesetPromise; math stays untypeset.");
|
|
572
613
|
});
|
|
573
614
|
}
|
|
574
|
-
function
|
|
615
|
+
function Ue(e) {
|
|
575
616
|
let t = o, n = t[G];
|
|
576
|
-
return n || (n =
|
|
617
|
+
return n || (n = He(e), t[G] = n), n;
|
|
577
618
|
}
|
|
578
|
-
function
|
|
619
|
+
function We(e = {}) {
|
|
579
620
|
let t = e.useSingleDollar ?? !1;
|
|
580
621
|
return async (r) => {
|
|
581
622
|
if (typeof window > "u") return;
|
|
582
623
|
let a = l();
|
|
583
|
-
a && n("mathjax-3-global", `window.MathJax is MathJax ${a}`),
|
|
584
|
-
let o =
|
|
585
|
-
if (!
|
|
624
|
+
a && n("mathjax-3-global", `window.MathJax is MathJax ${a}`), Ne(r), p(r), Pe(r), B(r);
|
|
625
|
+
let o = Ue(e);
|
|
626
|
+
if (!Fe(r, t)) {
|
|
586
627
|
o.catch(() => {});
|
|
587
628
|
return;
|
|
588
629
|
}
|
|
589
630
|
await o;
|
|
590
631
|
let s = i();
|
|
591
632
|
if (await s?.startup?.promise, typeof s?.typesetPromise == "function") {
|
|
592
|
-
|
|
633
|
+
ge(), ze(s.startup?.document);
|
|
593
634
|
try {
|
|
594
635
|
await s.typesetPromise([r]);
|
|
595
636
|
} catch (e) {
|
|
@@ -600,4 +641,4 @@ function Ie(e = {}) {
|
|
|
600
641
|
};
|
|
601
642
|
}
|
|
602
643
|
//#endregion
|
|
603
|
-
export {
|
|
644
|
+
export { We as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./math-mathjax-
|
|
1
|
+
import { t as e } from "./math-mathjax-tjbGDhzA.js";
|
|
2
2
|
//#region ../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/disclose-version.js
|
|
3
3
|
typeof window < "u" && ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add("5");
|
|
4
4
|
//#endregion
|
|
@@ -3035,10 +3035,7 @@ customElements.define("pie-element-player", Or(ki, {
|
|
|
3035
3035
|
reflect: !0,
|
|
3036
3036
|
type: "String"
|
|
3037
3037
|
},
|
|
3038
|
-
role: {
|
|
3039
|
-
reflect: !0,
|
|
3040
|
-
type: "String"
|
|
3041
|
-
},
|
|
3038
|
+
role: { type: "String" },
|
|
3042
3039
|
cdnUrl: {
|
|
3043
3040
|
attribute: "cdn-url",
|
|
3044
3041
|
reflect: !0,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/element-player",
|
|
3
|
-
"version": "0.1.3-next.
|
|
3
|
+
"version": "0.1.3-next.20261006032932",
|
|
4
4
|
"description": "Shared PIE element player web component",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"unpkg": "./dist/pie-element-player.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dev": "vite"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@pie-element/shared-math-rendering-mathjax": "0.1.2-next.
|
|
29
|
+
"@pie-element/shared-math-rendering-mathjax": "0.1.2-next.20261006032932"
|
|
30
30
|
},
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"publishConfig": {
|