reactive-md 0.4.1 → 0.5.1
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/CHANGELOG-ch.md +144 -113
- package/CHANGELOG.md +144 -113
- package/LICENSE +21 -21
- package/README-ch.md +154 -123
- package/README-en.md +179 -147
- package/README.md +179 -147
- package/SECURITY-ch.md +4 -3
- package/SECURITY.md +4 -3
- package/THIRD_PARTY_NOTICES.md +138 -1
- package/bin/reactive-md.mjs +1 -1
- package/dist-library/reactive-md-editor.css +2 -0
- package/dist-library/reactive-md-editor.js +3834 -0
- package/dist-library/reactive-md-react.js +9324 -1670
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +426 -305
- package/dist-library/{runtime-D3QTVYaz.js → runtime-CXBdLQ3A.js} +8950 -2895
- package/dist-library/types/editor/ReactiveMarkdownEditor.d.ts +7 -0
- package/dist-library/types/editor/editor-commands.d.ts +50 -0
- package/dist-library/types/editor/editor-i18n.d.ts +109 -0
- package/dist-library/types/editor/editor-toolbar.d.ts +24 -0
- package/dist-library/types/editor/editor-view-bar.d.ts +11 -0
- package/dist-library/types/editor/extended-native-components.d.ts +58 -0
- package/dist-library/types/editor/index.d.ts +9 -0
- package/dist-library/types/editor/locale.d.ts +13 -0
- package/dist-library/types/editor/native-components.d.ts +47 -0
- package/dist-library/types/editor/source-authoring.d.ts +57 -0
- package/dist-library/types/editor/types.d.ts +51 -0
- package/dist-library/types/editor/use-gutter-metrics.d.ts +5 -0
- package/dist-library/types/editor/use-source-history.d.ts +16 -0
- package/dist-library/types/local/LocalDocumentView.d.ts +10 -3
- package/dist-library/types/local/code-block.d.ts +26 -0
- package/dist-library/types/local/diagnostics.d.ts +25 -0
- package/dist-library/types/local/footnotes.d.ts +51 -0
- package/dist-library/types/local/heading-anchors.d.ts +2 -0
- package/dist-library/types/local/html.d.ts +16 -0
- package/dist-library/types/local/image-view.d.ts +23 -0
- package/dist-library/types/local/index.d.ts +1 -1
- package/dist-library/types/local/options.d.ts +29 -0
- package/dist-library/types/local/types.d.ts +42 -1
- package/dist-library/types/local/worker.d.ts +18 -6
- package/dist-library/types/shareable.d.ts +9 -1
- package/dist-standalone/reactive-md-standalone.css +1 -1
- package/dist-standalone/reactive-md-standalone.js +49 -38
- package/docs/compatibility-ch.md +12 -8
- package/docs/compatibility-en.md +12 -8
- package/docs/component-protocol-ch.md +2 -2
- package/docs/component-protocol-en.md +2 -2
- package/docs/editor-ch.md +235 -0
- package/docs/editor-en.md +235 -0
- package/docs/html-compatibility-ch.md +98 -0
- package/docs/html-compatibility-en.md +98 -0
- package/docs/local-guide-ch.md +11 -5
- package/docs/local-guide-en.md +11 -5
- package/docs/local-integration-ch.md +4 -1
- package/docs/local-integration-en.md +4 -1
- package/docs/local-interaction-syntax-ch.md +9 -2
- package/docs/local-interaction-syntax-en.md +7 -2
- package/docs/release-0.4.1-ch.md +23 -23
- package/docs/release-0.4.1-en.md +23 -23
- package/docs/release-0.5.0-ch.md +41 -0
- package/docs/release-0.5.0-en.md +41 -0
- package/docs/release-0.5.1-ch.md +39 -0
- package/docs/release-0.5.1-en.md +39 -0
- package/docs/releasing-ch.md +108 -101
- package/docs/releasing-en.md +108 -101
- package/docs/shareable-export-ch.md +6 -2
- package/docs/shareable-export-en.md +6 -2
- package/examples/integration/core/package.json +7 -7
- package/examples/integration/react/index.html +12 -12
- package/examples/integration/react/main.jsx +21 -21
- package/examples/integration/react/package.json +9 -9
- package/examples/integration/react-editor.tsx +74 -0
- package/examples/local/README.md +2 -0
- package/examples/local/catalog.reactive.md +20 -20
- package/examples/local/checklist.reactive.md +32 -32
- package/examples/local/comparison.reactive.md +47 -47
- package/examples/local/components.reactive.md +44 -44
- package/examples/local/counter.reactive.md +7 -7
- package/examples/local/diagnostics.reactive.md +54 -54
- package/examples/local/diagram.reactive.md +44 -44
- package/examples/local/gallery.reactive.md +61 -61
- package/examples/local/html-compat.reactive.md +24 -0
- package/examples/local/parameters.reactive.md +36 -36
- package/examples/local/planning.reactive.md +24 -24
- package/examples/local/pricing.reactive.md +20 -20
- package/examples/local/zh/catalog.reactive.md +20 -20
- package/examples/local/zh/charts.reactive.md +73 -73
- package/examples/local/zh/checklist.reactive.md +32 -32
- package/examples/local/zh/comparison.reactive.md +47 -47
- package/examples/local/zh/components.reactive.md +44 -44
- package/examples/local/zh/counter.reactive.md +7 -7
- package/examples/local/zh/diagnostics.reactive.md +54 -54
- package/examples/local/zh/diagram.reactive.md +44 -44
- package/examples/local/zh/gallery.reactive.md +61 -61
- package/examples/local/zh/parameters.reactive.md +36 -36
- package/examples/local/zh/planning.reactive.md +24 -24
- package/examples/local/zh/pricing.reactive.md +20 -20
- package/package.json +135 -91
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as e, B as t, D as n, F as r, I as i, L as a, M as o, N as s, O as c, P as l, R as u, U as d, _ as f, a as p, b as m, c as h, d as g, f as _, g as v, h as ee, i as te, j as ne, k as re, m as ie, n as y, o as ae, p as oe, r as se, s as ce, t as b, v as le, y as ue, z as de } from "./runtime-CXBdLQ3A.js";
|
|
2
2
|
// src/local/authoring.ts
|
|
3
|
-
var
|
|
3
|
+
var fe = /^[A-Za-z_][A-Za-z0-9_]*$/, pe = 128, me = /* @__PURE__ */ new Set([
|
|
4
4
|
"code",
|
|
5
5
|
"inlineCode",
|
|
6
6
|
"math",
|
|
7
7
|
"inlineMath",
|
|
8
8
|
"fallback",
|
|
9
|
-
"comment"
|
|
10
|
-
|
|
9
|
+
"comment",
|
|
10
|
+
"footnoteDefinition"
|
|
11
|
+
]), he = /* @__PURE__ */ new Set([
|
|
11
12
|
"local.version.unsupported",
|
|
12
13
|
"local.version.malformed",
|
|
13
14
|
"local.version.duplicate",
|
|
@@ -21,35 +22,35 @@ var oe = /^[A-Za-z_][A-Za-z0-9_]*$/, se = 128, ce = /* @__PURE__ */ new Set([
|
|
|
21
22
|
"local.attribute",
|
|
22
23
|
"local.budget"
|
|
23
24
|
]);
|
|
24
|
-
function
|
|
25
|
+
function x(e) {
|
|
25
26
|
return e !== void 0 && /[A-Za-z_]/.test(e);
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
+
function ge(e) {
|
|
28
29
|
return e !== void 0 && /[A-Za-z0-9_]/.test(e);
|
|
29
30
|
}
|
|
30
|
-
function x(e) {
|
|
31
|
-
return e !== void 0 && /\s/.test(e);
|
|
32
|
-
}
|
|
33
31
|
function S(e) {
|
|
34
|
-
return e
|
|
32
|
+
return e !== void 0 && /\s/.test(e);
|
|
35
33
|
}
|
|
36
34
|
function C(e) {
|
|
35
|
+
return e.length > 0 && e.length <= pe && fe.test(e) && !ne.has(e);
|
|
36
|
+
}
|
|
37
|
+
function w(e) {
|
|
37
38
|
return {
|
|
38
39
|
start: e.start,
|
|
39
40
|
end: e.end
|
|
40
41
|
};
|
|
41
42
|
}
|
|
42
|
-
function
|
|
43
|
+
function _e(e) {
|
|
43
44
|
try {
|
|
44
|
-
return
|
|
45
|
+
return y(e).diagnostics;
|
|
45
46
|
} catch {
|
|
46
47
|
return [];
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
|
-
var
|
|
50
|
-
function
|
|
50
|
+
var ve = /^<(\/?)([A-Za-z][A-Za-z0-9_-]*)(?=[\s/>])/;
|
|
51
|
+
function T(e, t) {
|
|
51
52
|
if (e[t] !== "<") return null;
|
|
52
|
-
let n =
|
|
53
|
+
let n = ve.exec(e.slice(t));
|
|
53
54
|
if (!n) return null;
|
|
54
55
|
let r = !!n[1], i = n[2], a = t + (r ? 2 : 1), o = "", s = t + n[0].length;
|
|
55
56
|
for (; s < e.length; s += 1) {
|
|
@@ -75,7 +76,7 @@ function w(e, t) {
|
|
|
75
76
|
};
|
|
76
77
|
let u = [], d = a + i.length;
|
|
77
78
|
for (; d < c;) {
|
|
78
|
-
for (; d < c &&
|
|
79
|
+
for (; d < c && S(e[d]);) d += 1;
|
|
79
80
|
if (d >= c) break;
|
|
80
81
|
if (e[d] === "/") {
|
|
81
82
|
d += 1;
|
|
@@ -89,7 +90,7 @@ function w(e, t) {
|
|
|
89
90
|
let n = d, r = t[0];
|
|
90
91
|
d += r.length;
|
|
91
92
|
let i = d, a = d;
|
|
92
|
-
for (; a < c &&
|
|
93
|
+
for (; a < c && S(e[a]);) a += 1;
|
|
93
94
|
if (e[a] !== "=") {
|
|
94
95
|
u.push({
|
|
95
96
|
name: r,
|
|
@@ -100,7 +101,7 @@ function w(e, t) {
|
|
|
100
101
|
}), d = i;
|
|
101
102
|
continue;
|
|
102
103
|
}
|
|
103
|
-
for (d = a + 1; d < c &&
|
|
104
|
+
for (d = a + 1; d < c && S(e[d]);) d += 1;
|
|
104
105
|
let o = e[d];
|
|
105
106
|
if (o === "\"" || o === "'") {
|
|
106
107
|
let t = d, i = d + 1, a = e.indexOf(o, i);
|
|
@@ -136,7 +137,7 @@ function w(e, t) {
|
|
|
136
137
|
continue;
|
|
137
138
|
}
|
|
138
139
|
let s = d;
|
|
139
|
-
for (; d < c && !
|
|
140
|
+
for (; d < c && !S(e[d]);) d += 1;
|
|
140
141
|
u.push({
|
|
141
142
|
name: r,
|
|
142
143
|
nameRange: {
|
|
@@ -164,14 +165,14 @@ function w(e, t) {
|
|
|
164
165
|
attrs: u
|
|
165
166
|
};
|
|
166
167
|
}
|
|
167
|
-
function
|
|
168
|
+
function ye(e, t, n) {
|
|
168
169
|
if (t.range.end <= n) return null;
|
|
169
170
|
let r = e.lastIndexOf("</", t.range.end - 1);
|
|
170
171
|
if (r < n) return null;
|
|
171
|
-
let i =
|
|
172
|
+
let i = T(e, r);
|
|
172
173
|
return !i || !i.closing || i.name !== t.name || i.end > t.range.end ? null : i;
|
|
173
174
|
}
|
|
174
|
-
function
|
|
175
|
+
function be(e, t, n) {
|
|
175
176
|
let r = [];
|
|
176
177
|
for (let i = t; i < n;) {
|
|
177
178
|
if (e[i] === "\\" && e.startsWith("{{", i + 1)) {
|
|
@@ -199,7 +200,7 @@ function pe(e, t, n) {
|
|
|
199
200
|
}
|
|
200
201
|
return r;
|
|
201
202
|
}
|
|
202
|
-
function
|
|
203
|
+
function xe(e, t) {
|
|
203
204
|
let n = {
|
|
204
205
|
quot: "\"",
|
|
205
206
|
apos: "'",
|
|
@@ -216,7 +217,7 @@ function me(e, t) {
|
|
|
216
217
|
offsets: r
|
|
217
218
|
};
|
|
218
219
|
}
|
|
219
|
-
function
|
|
220
|
+
function Se(e, t, n) {
|
|
220
221
|
let r = [];
|
|
221
222
|
for (let i = t; i < n;) {
|
|
222
223
|
let t = e[i];
|
|
@@ -238,12 +239,12 @@ function he(e, t, n) {
|
|
|
238
239
|
continue;
|
|
239
240
|
}
|
|
240
241
|
}
|
|
241
|
-
if (
|
|
242
|
+
if (x(t)) {
|
|
242
243
|
let t = i;
|
|
243
|
-
for (i += 1; i < n &&
|
|
244
|
+
for (i += 1; i < n && ge(e[i]);) i += 1;
|
|
244
245
|
let a = e.slice(t, i), o = i;
|
|
245
|
-
for (; o < n &&
|
|
246
|
-
if (e[o] === "(" || a === "true" || a === "false" || a === "null" || a === "pi" || a === "e" ||
|
|
246
|
+
for (; o < n && S(e[o]);) o += 1;
|
|
247
|
+
if (e[o] === "(" || a === "true" || a === "false" || a === "null" || a === "pi" || a === "e" || ne.has(a)) continue;
|
|
247
248
|
r.push({
|
|
248
249
|
name: a,
|
|
249
250
|
range: {
|
|
@@ -256,18 +257,18 @@ function he(e, t, n) {
|
|
|
256
257
|
}
|
|
257
258
|
return r;
|
|
258
259
|
}
|
|
259
|
-
function
|
|
260
|
+
function Ce(e, t) {
|
|
260
261
|
return Object.hasOwn(e.props, t) ? t === "bind" || !!e.slots?.some((e) => e.bind === t) : !1;
|
|
261
262
|
}
|
|
262
|
-
function
|
|
263
|
-
for (let n of e)
|
|
263
|
+
function E(e, t = []) {
|
|
264
|
+
for (let n of e) me.has(n.type) && t.push(w(n.range)), n.type !== "fallback" && n.children && E(n.children, t);
|
|
264
265
|
return t;
|
|
265
266
|
}
|
|
266
|
-
function
|
|
267
|
-
let n =
|
|
267
|
+
function D(e, t) {
|
|
268
|
+
let n = E(t), r = (t) => {
|
|
268
269
|
for (let i of t) {
|
|
269
270
|
if (i.type === "component") {
|
|
270
|
-
let t =
|
|
271
|
+
let t = T(e, i.range.start);
|
|
271
272
|
t && n.push({
|
|
272
273
|
start: t.start,
|
|
273
274
|
end: t.end
|
|
@@ -295,29 +296,29 @@ function _e(e, t) {
|
|
|
295
296
|
}
|
|
296
297
|
return i;
|
|
297
298
|
}
|
|
298
|
-
function
|
|
299
|
-
let n = [], r = /* @__PURE__ */ new Map(), i = [], a = [],
|
|
300
|
-
for (let r of
|
|
301
|
-
},
|
|
299
|
+
function O(e, t) {
|
|
300
|
+
let n = [], r = /* @__PURE__ */ new Map(), i = [], a = [], o = (t, n) => {
|
|
301
|
+
for (let r of Se(e, t, n)) i.push(r);
|
|
302
|
+
}, s = (e, t) => {
|
|
302
303
|
let n = r.get(e);
|
|
303
|
-
n ? n.push(
|
|
304
|
+
n ? n.push(w(t)) : r.set(e, [w(t)]);
|
|
304
305
|
}, l = (t, r) => {
|
|
305
|
-
let a =
|
|
306
|
+
let a = T(e, t.range.start);
|
|
306
307
|
if (!a || a.closing) return;
|
|
307
308
|
n.push({
|
|
308
309
|
kind: "tag",
|
|
309
|
-
range:
|
|
310
|
+
range: w(a.nameRange)
|
|
310
311
|
});
|
|
311
|
-
let o =
|
|
312
|
+
let o = v(t.name ?? ""), c = a.attrs.some((e) => e.name === "key");
|
|
312
313
|
for (let l of a.attrs) {
|
|
313
314
|
if (n.push({
|
|
314
315
|
kind: "attribute",
|
|
315
|
-
range:
|
|
316
|
+
range: w(l.nameRange)
|
|
316
317
|
}), !l.valueRange) continue;
|
|
317
|
-
let a = o?.props[l.name], u = o !== void 0 &&
|
|
318
|
+
let a = o?.props[l.name], u = o !== void 0 && Ce(o, l.name) && (t.name !== "table" && t.name !== "chart" || !!c), d = (t.name === "computed" || t.name === "const") && l.name === "name", f = e.slice(l.valueRange.start, l.valueRange.end), p = xe(e, l.valueRange);
|
|
318
319
|
if (t.name === "validation" && l.name === "fields") {
|
|
319
320
|
for (let e of p.text.matchAll(/\S+/g)) {
|
|
320
|
-
if (!
|
|
321
|
+
if (!C(e[0])) continue;
|
|
321
322
|
let t = {
|
|
322
323
|
start: p.offsets[e.index],
|
|
323
324
|
end: p.offsets[e.index + e[0].length]
|
|
@@ -332,7 +333,7 @@ function E(e, t) {
|
|
|
332
333
|
}
|
|
333
334
|
continue;
|
|
334
335
|
}
|
|
335
|
-
let m = a && !a.static ?
|
|
336
|
+
let m = a && !a.static ? be(p.text, 0, p.text.length) : [];
|
|
336
337
|
if (m.length > 0) {
|
|
337
338
|
let e = 0;
|
|
338
339
|
for (let a of m) {
|
|
@@ -349,7 +350,7 @@ function E(e, t) {
|
|
|
349
350
|
end: p.offsets[a.end]
|
|
350
351
|
}
|
|
351
352
|
});
|
|
352
|
-
for (let e of
|
|
353
|
+
for (let e of Se(p.text, a.innerStart, a.innerEnd)) ((r !== "data-table" || t.name !== "column") && (t.name !== "data-table" || l.name !== "key") || e.name !== "item" && e.name !== "index") && i.push({
|
|
353
354
|
name: e.name,
|
|
354
355
|
range: {
|
|
355
356
|
start: p.offsets[e.range.start],
|
|
@@ -365,34 +366,34 @@ function E(e, t) {
|
|
|
365
366
|
end: l.valueRange.end
|
|
366
367
|
}
|
|
367
368
|
});
|
|
368
|
-
} else (u || d) &&
|
|
369
|
+
} else (u || d) && C(f) ? (n.push({
|
|
369
370
|
kind: "binding",
|
|
370
|
-
range:
|
|
371
|
-
}),
|
|
371
|
+
range: w(l.valueRange)
|
|
372
|
+
}), s(f, l.valueRange)) : l.valueRange.end > l.valueRange.start && n.push({
|
|
372
373
|
kind: "string",
|
|
373
|
-
range:
|
|
374
|
+
range: w(l.valueRange)
|
|
374
375
|
});
|
|
375
376
|
}
|
|
376
|
-
let l =
|
|
377
|
+
let l = ye(e, t, a.end);
|
|
377
378
|
l && n.push({
|
|
378
379
|
kind: "tag",
|
|
379
|
-
range:
|
|
380
|
+
range: w(l.nameRange)
|
|
380
381
|
});
|
|
381
382
|
}, u = (t, r) => {
|
|
382
|
-
for (let
|
|
383
|
-
if (
|
|
384
|
-
else if (
|
|
383
|
+
for (let s of t) {
|
|
384
|
+
if (s.type === "component" && s.name) l(s, r);
|
|
385
|
+
else if (s.type === "interpolation") n.push({
|
|
385
386
|
kind: "expression",
|
|
386
|
-
range:
|
|
387
|
-
}), s
|
|
388
|
-
else if (
|
|
387
|
+
range: w(s.range)
|
|
388
|
+
}), o(s.range.start + 2, Math.max(s.range.start + 2, s.range.end - 2));
|
|
389
|
+
else if (s.type === "math" || s.type === "inlineMath") {
|
|
389
390
|
if (n.push({
|
|
390
391
|
kind: "math",
|
|
391
|
-
range:
|
|
392
|
-
}), r === "plot" &&
|
|
393
|
-
let t =
|
|
392
|
+
range: w(s.range)
|
|
393
|
+
}), r === "plot" && s.type === "math") {
|
|
394
|
+
let t = s.range.start + 2;
|
|
394
395
|
try {
|
|
395
|
-
for (let n of
|
|
396
|
+
for (let n of c(e.slice(t, s.range.end - 2))) {
|
|
396
397
|
let e = {
|
|
397
398
|
name: n.name,
|
|
398
399
|
range: {
|
|
@@ -404,18 +405,18 @@ function E(e, t) {
|
|
|
404
405
|
}
|
|
405
406
|
} catch {}
|
|
406
407
|
}
|
|
407
|
-
} else
|
|
408
|
+
} else s.type === "code" || s.type === "inlineCode" ? n.push({
|
|
408
409
|
kind: "code",
|
|
409
|
-
range:
|
|
410
|
-
}) :
|
|
410
|
+
range: w(s.range)
|
|
411
|
+
}) : s.type === "comment" && n.push({
|
|
411
412
|
kind: "comment",
|
|
412
|
-
range:
|
|
413
|
+
range: w(s.range)
|
|
413
414
|
});
|
|
414
|
-
|
|
415
|
+
s.type !== "fallback" && s.children && u(s.children, s.name);
|
|
415
416
|
}
|
|
416
417
|
};
|
|
417
418
|
u(t);
|
|
418
|
-
for (let r of
|
|
419
|
+
for (let r of D(e, t)) n.push({
|
|
419
420
|
kind: "comment",
|
|
420
421
|
range: r
|
|
421
422
|
});
|
|
@@ -429,7 +430,7 @@ function E(e, t) {
|
|
|
429
430
|
let f = [];
|
|
430
431
|
for (let [e, t] of r) {
|
|
431
432
|
let n = [];
|
|
432
|
-
for (let t of i) t.name === e && (n.some((e) => e.start === t.range.start && e.end === t.range.end) || n.push(
|
|
433
|
+
for (let t of i) t.name === e && (n.some((e) => e.start === t.range.start && e.end === t.range.end) || n.push(w(t.range)));
|
|
433
434
|
n.sort((e, t) => e.start - t.start || e.end - t.end), t.sort((e, t) => e.start - t.start || e.end - t.end), f.push({
|
|
434
435
|
name: e,
|
|
435
436
|
declarations: t,
|
|
@@ -442,27 +443,27 @@ function E(e, t) {
|
|
|
442
443
|
mathReferences: a
|
|
443
444
|
};
|
|
444
445
|
}
|
|
445
|
-
function
|
|
446
|
+
function we(e) {
|
|
446
447
|
if (typeof e != "string") return {
|
|
447
448
|
tokens: [],
|
|
448
449
|
bindings: [],
|
|
449
450
|
diagnostics: []
|
|
450
451
|
};
|
|
451
|
-
let t =
|
|
452
|
+
let t = O(e, p(e).nodes);
|
|
452
453
|
return {
|
|
453
454
|
tokens: t.tokens,
|
|
454
455
|
bindings: t.bindings,
|
|
455
|
-
diagnostics:
|
|
456
|
+
diagnostics: _e(e)
|
|
456
457
|
};
|
|
457
458
|
}
|
|
458
|
-
function
|
|
459
|
+
function k(e, t, n) {
|
|
459
460
|
let r = /^<(\/?)([A-Za-z][A-Za-z0-9_-]*)/.exec(e.slice(t, Math.min(e.length, n + 1)));
|
|
460
461
|
if (!r) return null;
|
|
461
462
|
let i = !!r[1], a = r[2], o = t + r[0].length, s = [], c = !1, l, u = !1;
|
|
462
463
|
if (!i) {
|
|
463
464
|
let t = o;
|
|
464
465
|
for (; t < n;) {
|
|
465
|
-
for (; t < n &&
|
|
466
|
+
for (; t < n && S(e[t]);) t += 1;
|
|
466
467
|
if (t >= n) break;
|
|
467
468
|
if (e[t] === "/") {
|
|
468
469
|
u = !0, t += 1;
|
|
@@ -476,7 +477,7 @@ function D(e, t, n) {
|
|
|
476
477
|
let i = r[0], a = t;
|
|
477
478
|
t += i.length;
|
|
478
479
|
let o = t, d = t;
|
|
479
|
-
for (; d < n &&
|
|
480
|
+
for (; d < n && S(e[d]);) d += 1;
|
|
480
481
|
if (e[d] !== "=") {
|
|
481
482
|
s.push({
|
|
482
483
|
name: i,
|
|
@@ -489,7 +490,7 @@ function D(e, t, n) {
|
|
|
489
490
|
}), t = o;
|
|
490
491
|
continue;
|
|
491
492
|
}
|
|
492
|
-
for (t = d + 1; t < n &&
|
|
493
|
+
for (t = d + 1; t < n && S(e[t]);) t += 1;
|
|
493
494
|
let f = e[t];
|
|
494
495
|
if (f === "\"" || f === "'") {
|
|
495
496
|
let r = t, u = t + 1, d = e.indexOf(f, u);
|
|
@@ -530,7 +531,7 @@ function D(e, t, n) {
|
|
|
530
531
|
continue;
|
|
531
532
|
}
|
|
532
533
|
let p = t;
|
|
533
|
-
for (; t < n && !
|
|
534
|
+
for (; t < n && !S(e[t]);) t += 1;
|
|
534
535
|
s.push({
|
|
535
536
|
name: i,
|
|
536
537
|
nameStart: a,
|
|
@@ -551,7 +552,7 @@ function D(e, t, n) {
|
|
|
551
552
|
if (!c) {
|
|
552
553
|
let t = n;
|
|
553
554
|
for (; t > o && /[A-Za-z0-9_-]/.test(e[t - 1]);) --t;
|
|
554
|
-
t > o &&
|
|
555
|
+
t > o && S(e[t - 1]) && (d = t);
|
|
555
556
|
}
|
|
556
557
|
return {
|
|
557
558
|
name: a,
|
|
@@ -563,7 +564,7 @@ function D(e, t, n) {
|
|
|
563
564
|
partialStart: d
|
|
564
565
|
};
|
|
565
566
|
}
|
|
566
|
-
function
|
|
567
|
+
function A(e, t, n) {
|
|
567
568
|
let r = [], i = (e) => {
|
|
568
569
|
for (let t of e) t.type === "component" && r.push(t.range.start), t.type !== "fallback" && t.children && i(t.children);
|
|
569
570
|
};
|
|
@@ -571,7 +572,7 @@ function O(e, t, n) {
|
|
|
571
572
|
for (let n = r.length - 1; n >= 0; --n) {
|
|
572
573
|
let i = r[n];
|
|
573
574
|
if (i >= t) continue;
|
|
574
|
-
let a =
|
|
575
|
+
let a = T(e, i);
|
|
575
576
|
if (a && t <= a.end) return i;
|
|
576
577
|
if (a && a.end < t) break;
|
|
577
578
|
}
|
|
@@ -584,13 +585,13 @@ function O(e, t, n) {
|
|
|
584
585
|
continue;
|
|
585
586
|
}
|
|
586
587
|
let r = e[n + 1];
|
|
587
|
-
if (r !== "/" && !
|
|
588
|
-
else if (
|
|
588
|
+
if (r !== "/" && !x(r)) a = n;
|
|
589
|
+
else if (Te(e, n, t)) a = n;
|
|
589
590
|
else return n;
|
|
590
591
|
}
|
|
591
592
|
return -1;
|
|
592
593
|
}
|
|
593
|
-
function
|
|
594
|
+
function Te(e, t, n) {
|
|
594
595
|
let r = "";
|
|
595
596
|
for (let i = t; i < n; i += 1) {
|
|
596
597
|
let t = e[i];
|
|
@@ -600,7 +601,7 @@ function ye(e, t, n) {
|
|
|
600
601
|
}
|
|
601
602
|
return !1;
|
|
602
603
|
}
|
|
603
|
-
function
|
|
604
|
+
function Ee(e, t) {
|
|
604
605
|
let n = t;
|
|
605
606
|
for (; n > 0;) {
|
|
606
607
|
let r = e.lastIndexOf("{{", n - 1);
|
|
@@ -629,7 +630,7 @@ function be(e, t) {
|
|
|
629
630
|
}
|
|
630
631
|
return null;
|
|
631
632
|
}
|
|
632
|
-
function
|
|
633
|
+
function De(e, t, n) {
|
|
633
634
|
let r = "";
|
|
634
635
|
for (let i = t; i < n; i += 1) {
|
|
635
636
|
let t = e[i];
|
|
@@ -637,7 +638,7 @@ function xe(e, t, n) {
|
|
|
637
638
|
}
|
|
638
639
|
return r !== "";
|
|
639
640
|
}
|
|
640
|
-
function
|
|
641
|
+
function Oe(e, t) {
|
|
641
642
|
let n = 0, r = e.length - 1;
|
|
642
643
|
for (; n <= r;) {
|
|
643
644
|
let i = n + r >> 1, a = e[i];
|
|
@@ -647,44 +648,44 @@ function Se(e, t) {
|
|
|
647
648
|
}
|
|
648
649
|
return !1;
|
|
649
650
|
}
|
|
650
|
-
function
|
|
651
|
+
function j(e, t, n, r) {
|
|
651
652
|
let i = e.slice(t, n), a = i && r.startsWith(i) ? r.slice(i.length) : "";
|
|
652
653
|
return {
|
|
653
654
|
start: t,
|
|
654
655
|
end: a && e.startsWith(a, n) ? n + a.length : n
|
|
655
656
|
};
|
|
656
657
|
}
|
|
657
|
-
function
|
|
658
|
-
if (
|
|
658
|
+
function ke(e, t, n, r) {
|
|
659
|
+
if (De(e, n.innerStart, t)) return [];
|
|
659
660
|
let i = t;
|
|
660
|
-
for (; i > n.innerStart &&
|
|
661
|
+
for (; i > n.innerStart && ge(e[i - 1]);) --i;
|
|
661
662
|
if (e[i - 1] === ".") return [];
|
|
662
663
|
let a = e.slice(i, t);
|
|
663
|
-
return a && !
|
|
664
|
+
return a && !x(a[0]) ? [] : r.filter((e) => e.name.startsWith(a)).map((n) => ({
|
|
664
665
|
label: n.name,
|
|
665
666
|
insertText: n.name,
|
|
666
|
-
range:
|
|
667
|
+
range: j(e, i, t, n.name),
|
|
667
668
|
kind: "binding",
|
|
668
669
|
detail: `${n.declarations.length} declaration${n.declarations.length === 1 ? "" : "s"}, ${n.references.length} reference${n.references.length === 1 ? "" : "s"}`
|
|
669
670
|
}));
|
|
670
671
|
}
|
|
671
|
-
function
|
|
672
|
+
function Ae(e, t, n) {
|
|
672
673
|
let r = n.currentAttribute;
|
|
673
674
|
if (!r) return [];
|
|
674
|
-
let i =
|
|
675
|
+
let i = v(n.name)?.props[r.name];
|
|
675
676
|
if (!i || i.kind !== "enum" || !i.values) return [];
|
|
676
677
|
let a = r.valueRange?.start ?? t, o = e.slice(a, t);
|
|
677
678
|
return i.values.filter((e) => e.startsWith(o)).map((n) => ({
|
|
678
679
|
label: n,
|
|
679
680
|
insertText: n,
|
|
680
|
-
range:
|
|
681
|
+
range: j(e, a, t, n),
|
|
681
682
|
kind: "value",
|
|
682
683
|
detail: `${r.name} value`
|
|
683
684
|
}));
|
|
684
685
|
}
|
|
685
|
-
function
|
|
686
|
+
function je(e, t, n) {
|
|
686
687
|
if (n.closing || n.inValue || n.partialStart < 0) return [];
|
|
687
|
-
let r =
|
|
688
|
+
let r = v(n.name);
|
|
688
689
|
if (!r) return [];
|
|
689
690
|
let i = e.slice(n.partialStart, t);
|
|
690
691
|
if (i && !/^[A-Za-z0-9_-]*$/.test(i)) return [];
|
|
@@ -692,12 +693,12 @@ function Te(e, t, n) {
|
|
|
692
693
|
return Object.entries(r.props).filter(([e]) => !a.has(e) && e.startsWith(i)).map(([r, i]) => ({
|
|
693
694
|
label: r,
|
|
694
695
|
insertText: r,
|
|
695
|
-
range:
|
|
696
|
+
range: j(e, n.partialStart, t, r),
|
|
696
697
|
kind: "attribute",
|
|
697
698
|
detail: i.required ? `${i.kind}, required` : i.kind
|
|
698
699
|
}));
|
|
699
700
|
}
|
|
700
|
-
function
|
|
701
|
+
function Me(e, t) {
|
|
701
702
|
let n = Math.max(0, t - 256), r = e.slice(n, t), i = /<\/?([A-Za-z][A-Za-z0-9-]*)?$/.exec(r);
|
|
702
703
|
if (!i) return [];
|
|
703
704
|
let a = n + i.index;
|
|
@@ -705,94 +706,94 @@ function Ee(e, t) {
|
|
|
705
706
|
let o = e[a + 1] === "/", s = a + (o ? 2 : 1);
|
|
706
707
|
if (s > t) return [];
|
|
707
708
|
let c = i[1] ?? "";
|
|
708
|
-
return
|
|
709
|
+
return ee.filter((e) => e.startsWith(c)).map((n) => ({
|
|
709
710
|
label: n,
|
|
710
711
|
insertText: n,
|
|
711
|
-
range:
|
|
712
|
+
range: j(e, s, t, n),
|
|
712
713
|
kind: "tag",
|
|
713
714
|
detail: o ? "closing tag" : "component"
|
|
714
715
|
}));
|
|
715
716
|
}
|
|
716
|
-
function
|
|
717
|
+
function Ne(e, t) {
|
|
717
718
|
if (typeof e != "string" || !Number.isFinite(t)) return [];
|
|
718
|
-
let n = Math.max(0, Math.min(e.length, Math.floor(t))), r =
|
|
719
|
-
if (
|
|
720
|
-
let a =
|
|
719
|
+
let n = Math.max(0, Math.min(e.length, Math.floor(t))), r = p(e), i = [...E(r.nodes), ...D(e, r.nodes)].sort((e, t) => e.start - t.start);
|
|
720
|
+
if (Oe(i, n) || n === e.length && i.some((e) => e.end === n && e.start < n)) return [];
|
|
721
|
+
let a = O(e, r.nodes), o = Ee(e, n);
|
|
721
722
|
if (o) {
|
|
722
|
-
let t =
|
|
723
|
+
let t = A(e, n, r.nodes);
|
|
723
724
|
if (t >= 0) {
|
|
724
|
-
let r =
|
|
725
|
-
if (r?.inValue && r.currentAttribute &&
|
|
725
|
+
let r = k(e, t, n);
|
|
726
|
+
if (r?.inValue && r.currentAttribute && v(r.name)?.props[r.currentAttribute.name]?.static) return [];
|
|
726
727
|
}
|
|
727
|
-
return
|
|
728
|
+
return ke(e, n, o, a.bindings);
|
|
728
729
|
}
|
|
729
|
-
let s =
|
|
730
|
+
let s = A(e, n, r.nodes);
|
|
730
731
|
if (s >= 0) {
|
|
731
|
-
let t =
|
|
732
|
-
if (t?.inValue) return
|
|
732
|
+
let t = k(e, s, n);
|
|
733
|
+
if (t?.inValue) return Ae(e, n, t);
|
|
733
734
|
}
|
|
734
|
-
let c =
|
|
735
|
+
let c = Me(e, n);
|
|
735
736
|
if (c.length > 0) return c;
|
|
736
737
|
if (s >= 0) {
|
|
737
|
-
let t =
|
|
738
|
-
if (t) return
|
|
738
|
+
let t = k(e, s, n);
|
|
739
|
+
if (t) return je(e, n, t);
|
|
739
740
|
}
|
|
740
741
|
return [];
|
|
741
742
|
}
|
|
742
|
-
function
|
|
743
|
+
function Pe(e, t) {
|
|
743
744
|
let n = "", r = 0;
|
|
744
745
|
for (let i of t) n += e.slice(r, i.range.start) + i.text, r = i.range.end;
|
|
745
746
|
return n + e.slice(r);
|
|
746
747
|
}
|
|
747
|
-
function
|
|
748
|
+
function Fe(e, t, n) {
|
|
748
749
|
if (typeof e != "string" || typeof t != "string" || typeof n != "string") throw Error("Rename requires string arguments.");
|
|
749
|
-
if (!
|
|
750
|
-
let r =
|
|
750
|
+
if (!C(n)) throw Error(`"${n}" is not a valid binding name. Use [A-Za-z_][A-Za-z0-9_]* and avoid reserved names.`);
|
|
751
|
+
let r = O(e, p(e).nodes), i = r.bindings.find((e) => e.name === t);
|
|
751
752
|
if (!i || i.declarations.length === 0) throw Error(`Binding "${t}" is not declared in this document.`);
|
|
752
753
|
if (t === n) return {
|
|
753
754
|
source: e,
|
|
754
755
|
edits: []
|
|
755
756
|
};
|
|
756
757
|
if (r.bindings.some((e) => e.name === n)) throw Error(`Binding "${n}" already exists.`);
|
|
757
|
-
if (
|
|
758
|
+
if (_e(e).some((e) => e.severity === "error" && he.has(e.code))) throw Error("The document cannot be renamed safely while parse errors remain.");
|
|
758
759
|
let a = /* @__PURE__ */ new Set(), o = [];
|
|
759
760
|
for (let e of [...i.declarations, ...i.references]) {
|
|
760
761
|
let t = `${e.start}:${e.end}`;
|
|
761
|
-
a.has(t) || (a.add(t), o.push(
|
|
762
|
+
a.has(t) || (a.add(t), o.push(w(e)));
|
|
762
763
|
}
|
|
763
764
|
o.sort((e, t) => e.start - t.start || e.end - t.end);
|
|
764
765
|
let s = new Set(r.mathReferences.filter((e) => e.name === t).map((e) => `${e.range.start}:${e.range.end}`)), c = o.map((e) => ({
|
|
765
|
-
range:
|
|
766
|
+
range: w(e),
|
|
766
767
|
text: s.has(`${e.start}:${e.end}`) ? `\\mathrm{${n}}` : n
|
|
767
|
-
})), l =
|
|
768
|
-
if (
|
|
768
|
+
})), l = Pe(e, c);
|
|
769
|
+
if (y(e).ok && !y(l).ok) throw Error("Rename could not preserve all binding references; the source was left unchanged.");
|
|
769
770
|
return {
|
|
770
771
|
source: l,
|
|
771
772
|
edits: c
|
|
772
773
|
};
|
|
773
774
|
}
|
|
774
|
-
function
|
|
775
|
+
function Ie(e, t) {
|
|
775
776
|
let n = e.slice(t.nameRange.start, t.nameRange.end), r = t.attrs.map((t) => {
|
|
776
777
|
let n = e.slice(t.nameRange.start, t.nameRange.end);
|
|
777
778
|
return t.valueRange === void 0 ? n : t.quoteStart !== void 0 && t.quoteEnd !== void 0 ? `${n}=${e.slice(t.quoteStart, t.quoteEnd + 1)}` : n;
|
|
778
779
|
}), i = r.length > 0 ? `<${n} ${r.join(" ")}` : `<${n}`;
|
|
779
780
|
return t.selfClosing ? `${i} />` : `${i}>`;
|
|
780
781
|
}
|
|
781
|
-
function
|
|
782
|
+
function Le(e) {
|
|
782
783
|
if (typeof e != "string") return e;
|
|
783
784
|
let t;
|
|
784
785
|
try {
|
|
785
|
-
t =
|
|
786
|
+
t = y(e);
|
|
786
787
|
} catch {
|
|
787
788
|
return e;
|
|
788
789
|
}
|
|
789
790
|
if (t.diagnostics.some((e) => e.severity === "error")) return e;
|
|
790
|
-
let n =
|
|
791
|
+
let n = p(e), r = [], i = (t) => {
|
|
791
792
|
for (let n of t) {
|
|
792
793
|
if (n.type === "component" && n.name) {
|
|
793
|
-
let t =
|
|
794
|
+
let t = T(e, n.range.start);
|
|
794
795
|
if (t && !t.closing && !/[\r\n]/.test(e.slice(t.start, t.end))) {
|
|
795
|
-
let n =
|
|
796
|
+
let n = Ie(e, t);
|
|
796
797
|
n !== e.slice(t.start, t.end) && r.push({
|
|
797
798
|
start: t.start,
|
|
798
799
|
end: t.end,
|
|
@@ -800,7 +801,7 @@ function je(e) {
|
|
|
800
801
|
});
|
|
801
802
|
}
|
|
802
803
|
if (t) {
|
|
803
|
-
let i =
|
|
804
|
+
let i = ye(e, n, t.end);
|
|
804
805
|
if (i && !/[\r\n]/.test(e.slice(i.start, i.end))) {
|
|
805
806
|
let t = `</${e.slice(i.nameRange.start, i.nameRange.end)}>`;
|
|
806
807
|
t !== e.slice(i.start, i.end) && r.push({
|
|
@@ -820,7 +821,7 @@ function je(e) {
|
|
|
820
821
|
return a + e.slice(o);
|
|
821
822
|
}
|
|
822
823
|
// src/local/source-migration.ts
|
|
823
|
-
var
|
|
824
|
+
var M = /* @__PURE__ */ new Set([
|
|
824
825
|
"sum",
|
|
825
826
|
"average",
|
|
826
827
|
"minOf",
|
|
@@ -838,7 +839,7 @@ var A = /* @__PURE__ */ new Set([
|
|
|
838
839
|
"slice",
|
|
839
840
|
"dateCompare",
|
|
840
841
|
"dateDiff"
|
|
841
|
-
]),
|
|
842
|
+
]), Re = /* @__PURE__ */ new Set([
|
|
842
843
|
"jump",
|
|
843
844
|
"anchor",
|
|
844
845
|
"text",
|
|
@@ -854,8 +855,8 @@ var A = /* @__PURE__ */ new Set([
|
|
|
854
855
|
"validation",
|
|
855
856
|
"data-table",
|
|
856
857
|
"column"
|
|
857
|
-
]),
|
|
858
|
-
function
|
|
858
|
+
]), N = `<!-- reactive-md: ${f} -->`;
|
|
859
|
+
function P(e) {
|
|
859
860
|
let t = e.diagnostics.filter((t) => t.code.startsWith("local.version.") || t.code === "local.budget" || t.code === "local.parse" && !e.nodes.length), n = e.versionDeclaration?.version ?? null;
|
|
860
861
|
return {
|
|
861
862
|
declaredVersion: n,
|
|
@@ -865,27 +866,27 @@ function M(e) {
|
|
|
865
866
|
diagnostics: t
|
|
866
867
|
};
|
|
867
868
|
}
|
|
868
|
-
function
|
|
869
|
-
return
|
|
869
|
+
function ze(e) {
|
|
870
|
+
return P(p(e));
|
|
870
871
|
}
|
|
871
|
-
function
|
|
872
|
-
let o = t
|
|
872
|
+
function Be(e, t, n, i, a = "error") {
|
|
873
|
+
let o = u(t, i), s = e.slice(0, n.start), c = s.lastIndexOf("\n");
|
|
873
874
|
return {
|
|
874
|
-
code:
|
|
875
|
+
code: t,
|
|
875
876
|
severity: a,
|
|
876
|
-
range: { ...
|
|
877
|
-
message:
|
|
877
|
+
range: { ...n },
|
|
878
|
+
message: r(o),
|
|
878
879
|
line: s.split("\n").length,
|
|
879
|
-
column:
|
|
880
|
+
column: n.start - c,
|
|
880
881
|
messageKey: o.key,
|
|
881
882
|
...o.params ? { params: o.params } : {}
|
|
882
883
|
};
|
|
883
884
|
}
|
|
884
|
-
function
|
|
885
|
-
let n =
|
|
885
|
+
function F(e, t = {}) {
|
|
886
|
+
let n = p(e), r = P(n), i = typeof t == "object" && !!t && !Array.isArray(t), a = i ? t.fromVersion ?? r.effectiveVersion : r.effectiveVersion, o = typeof a == "string" ? a : "", s = {
|
|
886
887
|
ok: !1,
|
|
887
888
|
fromVersion: o,
|
|
888
|
-
toVersion:
|
|
889
|
+
toVersion: f,
|
|
889
890
|
needsMigration: !n.versionDeclaration || o !== "local-draft-2",
|
|
890
891
|
diagnostics: r.diagnostics.filter((e) => e.code !== "local.version.unsupported")
|
|
891
892
|
}, c = {
|
|
@@ -906,17 +907,17 @@ function N(e, t = {}) {
|
|
|
906
907
|
}
|
|
907
908
|
s.diagnostics.push(e);
|
|
908
909
|
}, d = (t, n, r, i) => {
|
|
909
|
-
u(
|
|
910
|
+
u(Be(e, t, n, r, i));
|
|
910
911
|
};
|
|
911
912
|
if (!i || typeof a != "string" || !["local-draft-1", "local-draft-2"].includes(o) || t.allowSemanticChanges !== void 0 && typeof t.allowSemanticChanges != "boolean" || t.fromVersion !== void 0 && r.declaredVersion !== null && o !== r.declaredVersion) return d("local.upgrade.from-version", l, {
|
|
912
913
|
from: o,
|
|
913
914
|
detail: "use local-draft-1 or local-draft-2 and match the source declaration"
|
|
914
915
|
}), c;
|
|
915
|
-
let
|
|
916
|
+
let m = n.versionDeclaration ? e.slice(0, l.start) + e.slice(l.start, l.end).replace(/[^\r\n]/g, " ") + e.slice(l.end) : e, h = n.versionDeclaration ? p(m) : n;
|
|
916
917
|
if (o === "local-draft-1") {
|
|
917
918
|
let e = (n) => {
|
|
918
919
|
for (let r of n) {
|
|
919
|
-
if (r.name &&
|
|
920
|
+
if (r.name && Re.has(r.name)) {
|
|
920
921
|
d("local.upgrade.tag", r.range, { name: r.name });
|
|
921
922
|
continue;
|
|
922
923
|
}
|
|
@@ -928,32 +929,32 @@ function N(e, t = {}) {
|
|
|
928
929
|
"bind-y"
|
|
929
930
|
]) {
|
|
930
931
|
let t = r.attrs?.[e];
|
|
931
|
-
t &&
|
|
932
|
+
t && M.has(t) && d("local.upgrade.reserved-binding", r.range, { name: t });
|
|
932
933
|
}
|
|
933
934
|
(r.name === "input" || r.name === "textarea") && (r.attrs?.["max-length"] !== void 0 || Number(r.attrs?.["min-length"] ?? 0) > 0) && d("local.upgrade.text-length", r.range, void 0, t.allowSemanticChanges ? "warning" : "error");
|
|
934
935
|
let n = [...r.type === "interpolation" ? [r.value ?? ""] : [], ...Object.values(r.attrs ?? {}).flatMap((e) => [...e.matchAll(/\{\{([\s\S]*?)\}\}/g)].map((e) => e[1]))];
|
|
935
936
|
for (let e of n) {
|
|
936
937
|
let t = e.replace(/'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"/g, "");
|
|
937
|
-
(t.includes("[") || [...
|
|
938
|
+
(t.includes("[") || [...M].some((e) => RegExp(`\\b${e}\\s*\\(`).test(t))) && d("local.upgrade.expression", r.range);
|
|
938
939
|
}
|
|
939
940
|
r.type !== "fallback" && r.children && e(r.children);
|
|
940
941
|
}
|
|
941
942
|
};
|
|
942
|
-
e(
|
|
943
|
+
e(h.nodes);
|
|
943
944
|
}
|
|
944
945
|
if (s.diagnostics.some((e) => e.severity === "error")) return c;
|
|
945
|
-
let
|
|
946
|
-
for (let e of
|
|
947
|
-
return
|
|
946
|
+
let g = y(m);
|
|
947
|
+
for (let e of g.diagnostics) u(e);
|
|
948
|
+
return g.ok && (!n.versionDeclaration && s.diagnostics.length < 100 && d("local.upgrade.version-missing", {
|
|
948
949
|
start: +(e.charCodeAt(0) === 65279),
|
|
949
950
|
end: +(e.charCodeAt(0) === 65279)
|
|
950
|
-
}, { version:
|
|
951
|
+
}, { version: f }, "warning"), s.ok = !0), c;
|
|
951
952
|
}
|
|
952
|
-
function
|
|
953
|
-
return
|
|
953
|
+
function Ve(e, t) {
|
|
954
|
+
return F(e, t).report;
|
|
954
955
|
}
|
|
955
|
-
function
|
|
956
|
-
let { report: n, declaration: r } =
|
|
956
|
+
function He(e, t) {
|
|
957
|
+
let { report: n, declaration: r } = F(e, t), i = {
|
|
957
958
|
...n,
|
|
958
959
|
source: e,
|
|
959
960
|
changed: !1,
|
|
@@ -963,7 +964,7 @@ function Ie(e, t) {
|
|
|
963
964
|
let a = +(e.charCodeAt(0) === 65279), o = r?.range ?? {
|
|
964
965
|
start: a,
|
|
965
966
|
end: a
|
|
966
|
-
}, s = e.includes("\r\n") ? "\r\n" : "\n", c = r ?
|
|
967
|
+
}, s = e.includes("\r\n") ? "\r\n" : "\n", c = r ? N : `${N}${s}${s}`, l = e.slice(0, o.start) + c + e.slice(o.end);
|
|
967
968
|
return {
|
|
968
969
|
...n,
|
|
969
970
|
source: l,
|
|
@@ -975,17 +976,17 @@ function Ie(e, t) {
|
|
|
975
976
|
};
|
|
976
977
|
}
|
|
977
978
|
// src/local/state.ts
|
|
978
|
-
var
|
|
979
|
+
var I = "reactive-md-state/v1", Ue = 1048576, We = /^fnv1a32:[0-9a-f]{8}$/, Ge = 2166136261, Ke = 16777619, qe = /* @__PURE__ */ new Set([
|
|
979
980
|
"format",
|
|
980
981
|
"syntax",
|
|
981
982
|
"sourceDigest",
|
|
982
983
|
"parameters",
|
|
983
984
|
"generator"
|
|
984
|
-
]),
|
|
985
|
+
]), Je = /* @__PURE__ */ new Set(["name", "version"]), Ye = new TextEncoder();
|
|
985
986
|
function L(e, t) {
|
|
986
987
|
return {
|
|
987
988
|
code: e,
|
|
988
|
-
message: t.length > 2e3 ? `${t.slice(0,
|
|
989
|
+
message: t.length > 2e3 ? `${t.slice(0, d - 1)}…` : t,
|
|
989
990
|
severity: "error",
|
|
990
991
|
range: {
|
|
991
992
|
start: 0,
|
|
@@ -1018,8 +1019,8 @@ function B(e) {
|
|
|
1018
1019
|
}
|
|
1019
1020
|
function V(e) {
|
|
1020
1021
|
if (typeof e != "string") throw TypeError("localSourceDigest requires a source string.");
|
|
1021
|
-
let t =
|
|
1022
|
-
for (let e = 0; e < t.length; e += 1) n ^= t[e], n = Math.imul(n,
|
|
1022
|
+
let t = Ye.encode(e), n = Ge;
|
|
1023
|
+
for (let e = 0; e < t.length; e += 1) n ^= t[e], n = Math.imul(n, Ke) >>> 0;
|
|
1023
1024
|
return `fnv1a32:${n.toString(16).padStart(8, "0")}`;
|
|
1024
1025
|
}
|
|
1025
1026
|
function H(e) {
|
|
@@ -1070,10 +1071,10 @@ function U(e) {
|
|
|
1070
1071
|
let t = Object.getPrototypeOf(e);
|
|
1071
1072
|
return t === Object.prototype || t === null;
|
|
1072
1073
|
}
|
|
1073
|
-
function
|
|
1074
|
+
function Xe(e) {
|
|
1074
1075
|
return Object.freeze(e.parameters), e.generator && Object.freeze(e.generator), Object.freeze(e);
|
|
1075
1076
|
}
|
|
1076
|
-
function
|
|
1077
|
+
function Ze(e) {
|
|
1077
1078
|
if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("generator must be an object with string name and version.");
|
|
1078
1079
|
if (typeof e.name != "string" || typeof e.version != "string") throw TypeError("generator must have string name and version.");
|
|
1079
1080
|
if (!B(e.name) || !B(e.version)) throw TypeError("generator name and version must be well-formed Unicode strings.");
|
|
@@ -1082,13 +1083,13 @@ function Ue(e) {
|
|
|
1082
1083
|
version: e.version
|
|
1083
1084
|
});
|
|
1084
1085
|
}
|
|
1085
|
-
function
|
|
1086
|
+
function Qe(e) {
|
|
1086
1087
|
return typeof e == "string" ? `"${e.length > 48 ? `${e.slice(0, 48)}…` : e}"` : e === null ? "null" : Array.isArray(e) ? "an array" : typeof e;
|
|
1087
1088
|
}
|
|
1088
|
-
function
|
|
1089
|
-
return e.length > t ? e.length :
|
|
1089
|
+
function $e(e, t) {
|
|
1090
|
+
return e.length > t ? e.length : Ye.encode(e).byteLength;
|
|
1090
1091
|
}
|
|
1091
|
-
function
|
|
1092
|
+
function et(e, t) {
|
|
1092
1093
|
let n;
|
|
1093
1094
|
try {
|
|
1094
1095
|
let t = JSON.stringify(e);
|
|
@@ -1097,17 +1098,17 @@ function Ke(e, t) {
|
|
|
1097
1098
|
} catch {
|
|
1098
1099
|
return null;
|
|
1099
1100
|
}
|
|
1100
|
-
return
|
|
1101
|
+
return $e(n, t);
|
|
1101
1102
|
}
|
|
1102
|
-
function
|
|
1103
|
-
if (e === void 0) return
|
|
1103
|
+
function tt(e) {
|
|
1104
|
+
if (e === void 0) return Ue;
|
|
1104
1105
|
if (typeof e != "object" || !e) throw TypeError("parseLocalState options must be an object.");
|
|
1105
1106
|
let { maxLength: t } = e;
|
|
1106
|
-
if (t === void 0) return
|
|
1107
|
+
if (t === void 0) return Ue;
|
|
1107
1108
|
if (typeof t != "number" || !Number.isSafeInteger(t) || t <= 0) throw RangeError("maxLength must be a finite positive integer.");
|
|
1108
1109
|
return t;
|
|
1109
1110
|
}
|
|
1110
|
-
function
|
|
1111
|
+
function nt(e, t, n) {
|
|
1111
1112
|
if (!e || e.syntax !== "local" || typeof e.source != "string") throw TypeError("createLocalStateFile requires a compiled local document.");
|
|
1112
1113
|
if (!t || typeof t != "object" || Array.isArray(t)) throw TypeError("createLocalStateFile requires a state object.");
|
|
1113
1114
|
let r = Object.keys(e.bindings).filter((e) => !e.startsWith("@")).sort(), i = new Set(r), a = /* @__PURE__ */ new Map();
|
|
@@ -1128,17 +1129,17 @@ function Je(e, t, n) {
|
|
|
1128
1129
|
o[e] = a.get(e);
|
|
1129
1130
|
}
|
|
1130
1131
|
let s = {
|
|
1131
|
-
format:
|
|
1132
|
-
syntax:
|
|
1132
|
+
format: I,
|
|
1133
|
+
syntax: f,
|
|
1133
1134
|
sourceDigest: V(e.source),
|
|
1134
1135
|
parameters: o
|
|
1135
1136
|
};
|
|
1136
|
-
return n !== void 0 && (s.generator =
|
|
1137
|
+
return n !== void 0 && (s.generator = Ze(n)), Xe(s);
|
|
1137
1138
|
}
|
|
1138
|
-
function
|
|
1139
|
+
function rt(e, t) {
|
|
1139
1140
|
let n = [], r = (e, t) => R(n, e, t), i = e;
|
|
1140
1141
|
if (typeof e == "string") {
|
|
1141
|
-
if (
|
|
1142
|
+
if ($e(e, t) > t) return {
|
|
1142
1143
|
ok: !1,
|
|
1143
1144
|
diagnostics: [L("local.state.size", `The state payload exceeds the ${t}-byte limit.`)]
|
|
1144
1145
|
};
|
|
@@ -1155,7 +1156,7 @@ function Ye(e, t) {
|
|
|
1155
1156
|
};
|
|
1156
1157
|
}
|
|
1157
1158
|
} else {
|
|
1158
|
-
let n =
|
|
1159
|
+
let n = et(e, t);
|
|
1159
1160
|
if (n === null) return {
|
|
1160
1161
|
ok: !1,
|
|
1161
1162
|
diagnostics: [L("local.state.shape", "The state payload must be a JSON object.")]
|
|
@@ -1170,13 +1171,13 @@ function Ye(e, t) {
|
|
|
1170
1171
|
diagnostics: [L("local.state.shape", "The state payload must be a JSON object.")]
|
|
1171
1172
|
};
|
|
1172
1173
|
Object.getOwnPropertySymbols(i).length > 0 && r("local.state.shape", "The state payload cannot use symbol keys.");
|
|
1173
|
-
for (let e of Object.keys(i))
|
|
1174
|
+
for (let e of Object.keys(i)) qe.has(e) || r("local.state.key", `Unknown top-level state key "${e}".`);
|
|
1174
1175
|
let a = i.format;
|
|
1175
|
-
a !== "reactive-md-state/v1" && r("local.state.format", `Unsupported state format ${
|
|
1176
|
+
a !== "reactive-md-state/v1" && r("local.state.format", `Unsupported state format ${Qe(a)}; expected "${I}".`);
|
|
1176
1177
|
let o = i.syntax;
|
|
1177
|
-
o !== "local-draft-2" && r("local.state.syntax", `Unsupported state syntax ${
|
|
1178
|
+
o !== "local-draft-2" && r("local.state.syntax", `Unsupported state syntax ${Qe(o)}; expected "${f}".`);
|
|
1178
1179
|
let s = i.sourceDigest;
|
|
1179
|
-
typeof s == "string" &&
|
|
1180
|
+
typeof s == "string" && We.test(s) || r("local.state.digest", "sourceDigest must match \"fnv1a32:\" followed by 8 lowercase hexadecimal digits.");
|
|
1180
1181
|
let c = {}, l = i.parameters;
|
|
1181
1182
|
if (!U(l)) r("local.state.parameters", "parameters must be a JSON object of public binding values.");
|
|
1182
1183
|
else for (let e of Object.keys(l).sort()) {
|
|
@@ -1196,7 +1197,7 @@ function Ye(e, t) {
|
|
|
1196
1197
|
let e = i.generator;
|
|
1197
1198
|
if (!U(e)) r("local.state.generator", "generator must be an object with string name and version.");
|
|
1198
1199
|
else {
|
|
1199
|
-
for (let t of Object.keys(e))
|
|
1200
|
+
for (let t of Object.keys(e)) Je.has(t) || r("local.state.generator", `generator has unknown key "${t}".`);
|
|
1200
1201
|
typeof e.name != "string" || typeof e.version != "string" ? r("local.state.generator", "generator must have string name and version.") : !B(e.name) || !B(e.version) ? r("local.state.utf", "generator contains malformed Unicode.") : u = Object.freeze({
|
|
1201
1202
|
name: e.name,
|
|
1202
1203
|
version: e.version
|
|
@@ -1208,20 +1209,20 @@ function Ye(e, t) {
|
|
|
1208
1209
|
diagnostics: n
|
|
1209
1210
|
};
|
|
1210
1211
|
let d = {
|
|
1211
|
-
format:
|
|
1212
|
-
syntax:
|
|
1212
|
+
format: I,
|
|
1213
|
+
syntax: f,
|
|
1213
1214
|
sourceDigest: s,
|
|
1214
1215
|
parameters: c
|
|
1215
1216
|
};
|
|
1216
1217
|
return u && (d.generator = u), {
|
|
1217
1218
|
ok: !0,
|
|
1218
|
-
file:
|
|
1219
|
+
file: Xe(d)
|
|
1219
1220
|
};
|
|
1220
1221
|
}
|
|
1221
1222
|
function W(e, t) {
|
|
1222
|
-
let n =
|
|
1223
|
+
let n = tt(t);
|
|
1223
1224
|
try {
|
|
1224
|
-
return
|
|
1225
|
+
return rt(e, n);
|
|
1225
1226
|
} catch (e) {
|
|
1226
1227
|
return {
|
|
1227
1228
|
ok: !1,
|
|
@@ -1229,14 +1230,14 @@ function W(e, t) {
|
|
|
1229
1230
|
};
|
|
1230
1231
|
}
|
|
1231
1232
|
}
|
|
1232
|
-
function
|
|
1233
|
+
function it(e) {
|
|
1233
1234
|
let t = /* @__PURE__ */ new Map(), n = (e) => {
|
|
1234
1235
|
for (let r of e) t.set(r.id, r), r.children && n(r.children);
|
|
1235
1236
|
};
|
|
1236
1237
|
return n(e.nodes), t;
|
|
1237
1238
|
}
|
|
1238
|
-
function
|
|
1239
|
-
let t =
|
|
1239
|
+
function at(e) {
|
|
1240
|
+
let t = it(e), n = /* @__PURE__ */ new Map(), r = [];
|
|
1240
1241
|
for (let [i, a] of Object.entries(e.bindingSlots ?? {})) {
|
|
1241
1242
|
let e = t.get(i);
|
|
1242
1243
|
if (!e) continue;
|
|
@@ -1288,7 +1289,7 @@ function G(e, t, n) {
|
|
|
1288
1289
|
}
|
|
1289
1290
|
return r;
|
|
1290
1291
|
}
|
|
1291
|
-
function
|
|
1292
|
+
function ot(e, t) {
|
|
1292
1293
|
let n = e.snapshot(), r = {};
|
|
1293
1294
|
for (let e of t) {
|
|
1294
1295
|
let t = n.state[e];
|
|
@@ -1296,7 +1297,7 @@ function Qe(e, t) {
|
|
|
1296
1297
|
}
|
|
1297
1298
|
return Object.freeze(r);
|
|
1298
1299
|
}
|
|
1299
|
-
function
|
|
1300
|
+
function st(e, t, n, r) {
|
|
1300
1301
|
let i = W(t, r);
|
|
1301
1302
|
if (!i.ok) return i;
|
|
1302
1303
|
if (!e || e.syntax !== "local" || typeof e.source != "string" || !Array.isArray(e.nodes) || !e.bindings) return {
|
|
@@ -1305,13 +1306,13 @@ function $e(e, t, n, r) {
|
|
|
1305
1306
|
};
|
|
1306
1307
|
if (i.file.syntax !== "local-draft-2") return {
|
|
1307
1308
|
ok: !1,
|
|
1308
|
-
diagnostics: [L("local.state.syntax", `This state file uses syntax "${i.file.syntax}", but this build accepts "${
|
|
1309
|
+
diagnostics: [L("local.state.syntax", `This state file uses syntax "${i.file.syntax}", but this build accepts "${f}".`)]
|
|
1309
1310
|
};
|
|
1310
1311
|
if (i.file.sourceDigest !== V(e.source)) return {
|
|
1311
1312
|
ok: !1,
|
|
1312
1313
|
diagnostics: [L("local.state.source", "This state file was created for a different document (source digest mismatch).")]
|
|
1313
1314
|
};
|
|
1314
|
-
let a =
|
|
1315
|
+
let a = at(e), o = new Set(a.plans.map((e) => e.key)), s = [];
|
|
1315
1316
|
for (let e of Object.keys(i.file.parameters)) o.has(e) || R(s, "local.state.parameter.unknown", `The state contains unknown parameter "${e}" for this document.`);
|
|
1316
1317
|
for (let e of o) Object.hasOwn(i.file.parameters, e) || R(s, "local.state.parameter.missing", `The state is missing parameter "${e}".`);
|
|
1317
1318
|
if (s.length) return {
|
|
@@ -1320,7 +1321,7 @@ function $e(e, t, n, r) {
|
|
|
1320
1321
|
};
|
|
1321
1322
|
let c;
|
|
1322
1323
|
try {
|
|
1323
|
-
c =
|
|
1324
|
+
c = b(e);
|
|
1324
1325
|
} catch (e) {
|
|
1325
1326
|
return {
|
|
1326
1327
|
ok: !1,
|
|
@@ -1344,15 +1345,15 @@ function $e(e, t, n, r) {
|
|
|
1344
1345
|
return {
|
|
1345
1346
|
ok: !0,
|
|
1346
1347
|
file: i.file,
|
|
1347
|
-
state:
|
|
1348
|
+
state: ot(c, t)
|
|
1348
1349
|
};
|
|
1349
1350
|
} finally {
|
|
1350
1351
|
c.dispose();
|
|
1351
1352
|
}
|
|
1352
1353
|
}
|
|
1353
|
-
function
|
|
1354
|
+
function ct(e, t, n) {
|
|
1354
1355
|
try {
|
|
1355
|
-
return
|
|
1356
|
+
return st(e, t, void 0, n);
|
|
1356
1357
|
} catch (e) {
|
|
1357
1358
|
return {
|
|
1358
1359
|
ok: !1,
|
|
@@ -1360,29 +1361,29 @@ function et(e, t, n) {
|
|
|
1360
1361
|
};
|
|
1361
1362
|
}
|
|
1362
1363
|
}
|
|
1363
|
-
function
|
|
1364
|
+
function lt(e, t, n) {
|
|
1364
1365
|
let r;
|
|
1365
1366
|
try {
|
|
1366
|
-
r =
|
|
1367
|
+
r = st(e.document, t, e.snapshot().state, n);
|
|
1367
1368
|
} catch (e) {
|
|
1368
1369
|
return [L("local.state.invalid", `Cannot apply the local state: ${z(e)}`)];
|
|
1369
1370
|
}
|
|
1370
1371
|
if (!r.ok) return r.diagnostics;
|
|
1371
|
-
let i =
|
|
1372
|
+
let i = at(e.document);
|
|
1372
1373
|
try {
|
|
1373
1374
|
return G(e, i, r.state);
|
|
1374
1375
|
} catch (e) {
|
|
1375
1376
|
return [L("local.state.invalid", `Cannot apply the local state: ${z(e)}`)];
|
|
1376
1377
|
}
|
|
1377
1378
|
}
|
|
1378
|
-
function
|
|
1379
|
-
return
|
|
1379
|
+
function ut(e, t) {
|
|
1380
|
+
return nt(e.document, e.getParameters(), t);
|
|
1380
1381
|
}
|
|
1381
|
-
function
|
|
1382
|
+
function dt(e, t, n) {
|
|
1382
1383
|
let r = W(t, n);
|
|
1383
|
-
return r.ok ?
|
|
1384
|
+
return r.ok ? lt(e, r.file, n) : r.diagnostics;
|
|
1384
1385
|
}
|
|
1385
|
-
function
|
|
1386
|
+
function ft(e) {
|
|
1386
1387
|
if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("serializeLocalState requires a state file.");
|
|
1387
1388
|
if (!e.parameters || typeof e.parameters != "object" || Array.isArray(e.parameters)) throw TypeError("serializeLocalState requires an object of parameters.");
|
|
1388
1389
|
let t = Object.create(null);
|
|
@@ -1399,7 +1400,7 @@ function it(e) {
|
|
|
1399
1400
|
parameters: t
|
|
1400
1401
|
};
|
|
1401
1402
|
if (e.generator !== void 0) {
|
|
1402
|
-
let t =
|
|
1403
|
+
let t = Ze(e.generator);
|
|
1403
1404
|
n.generator = {
|
|
1404
1405
|
name: t.name,
|
|
1405
1406
|
version: t.version
|
|
@@ -1408,24 +1409,24 @@ function it(e) {
|
|
|
1408
1409
|
return JSON.stringify(n);
|
|
1409
1410
|
}
|
|
1410
1411
|
// src/local/retention.ts
|
|
1411
|
-
function
|
|
1412
|
+
function pt(e) {
|
|
1412
1413
|
let t = /* @__PURE__ */ new Map(), n = (e) => {
|
|
1413
1414
|
for (let r of e) t.set(r.id, r), r.children && n(r.children);
|
|
1414
1415
|
};
|
|
1415
1416
|
return n(e.nodes), t;
|
|
1416
1417
|
}
|
|
1417
|
-
function
|
|
1418
|
+
function mt(e, t, n) {
|
|
1418
1419
|
let r = e.bindingSlots?.[t.id];
|
|
1419
1420
|
return r !== void 0 && Object.values(r).includes(n);
|
|
1420
1421
|
}
|
|
1421
|
-
function
|
|
1422
|
-
let t =
|
|
1422
|
+
function ht(e) {
|
|
1423
|
+
let t = pt(e), n = /* @__PURE__ */ new Map();
|
|
1423
1424
|
for (let [r, i] of Object.entries(e.bindings)) {
|
|
1424
1425
|
let a = i.nodeIds.flatMap((e) => {
|
|
1425
1426
|
let n = t.get(e);
|
|
1426
1427
|
return n ? [n] : [];
|
|
1427
1428
|
});
|
|
1428
|
-
if (!a.length || r.startsWith("@") || a.some((t) => t.attrs?.bind !== r && !
|
|
1429
|
+
if (!a.length || r.startsWith("@") || a.some((t) => t.attrs?.bind !== r && !mt(e, t, r) || t.name === "timer" || t.name === "checklist")) continue;
|
|
1429
1430
|
let o = a.flatMap((e) => Object.hasOwn(e.attrs ?? {}, "initial") ? [e.attrs.initial] : []).sort();
|
|
1430
1431
|
n.set(r, {
|
|
1431
1432
|
type: i.type,
|
|
@@ -1440,8 +1441,8 @@ function K(e, t) {
|
|
|
1440
1441
|
reason: t
|
|
1441
1442
|
});
|
|
1442
1443
|
}
|
|
1443
|
-
function
|
|
1444
|
-
let t =
|
|
1444
|
+
function gt(e) {
|
|
1445
|
+
let t = ht(e.previous), n = ht(e.next), r = {}, i = [], a = [];
|
|
1445
1446
|
for (let o of Object.keys(e.state).sort()) {
|
|
1446
1447
|
if (o.startsWith("@")) {
|
|
1447
1448
|
a.push(K(o, "internal"));
|
|
@@ -1473,38 +1474,72 @@ function ct(e) {
|
|
|
1473
1474
|
dropped: Object.freeze(a)
|
|
1474
1475
|
});
|
|
1475
1476
|
}
|
|
1476
|
-
function
|
|
1477
|
+
function _t(e, t, n) {
|
|
1477
1478
|
return Object.freeze({
|
|
1478
1479
|
retained: Object.freeze([...e]),
|
|
1479
1480
|
dropped: Object.freeze(t.map((e) => Object.freeze({ ...e }))),
|
|
1480
1481
|
diagnostics: Object.freeze([...n])
|
|
1481
1482
|
});
|
|
1482
1483
|
}
|
|
1483
|
-
function
|
|
1484
|
+
function vt(e, t) {
|
|
1484
1485
|
let n = Object.keys(t.values).sort();
|
|
1485
|
-
if (!e.setParameters(t.values).length) return
|
|
1486
|
+
if (!e.setParameters(t.values).length) return _t(n, t.dropped, []);
|
|
1486
1487
|
let r = [], i = [...t.dropped], a = [];
|
|
1487
1488
|
for (let o of n) {
|
|
1488
1489
|
let n = e.setParameter(o, t.values[o]);
|
|
1489
1490
|
n.length ? (i.push(K(o, "invalid")), a.push(...n)) : r.push(o);
|
|
1490
1491
|
}
|
|
1491
|
-
return i.sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name)),
|
|
1492
|
+
return i.sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name)), _t(r, i, a);
|
|
1492
1493
|
}
|
|
1493
1494
|
// src/local/worker.ts
|
|
1494
|
-
var
|
|
1495
|
-
function
|
|
1495
|
+
var yt = 150;
|
|
1496
|
+
function bt(e) {
|
|
1497
|
+
if (e !== void 0) try {
|
|
1498
|
+
if (typeof e != "object" || !e || Array.isArray(e)) return e;
|
|
1499
|
+
let t = e, n = {};
|
|
1500
|
+
for (let e of ae) Object.hasOwn(t, e) && (n[e] = t[e]);
|
|
1501
|
+
if (Object.hasOwn(t, "limits")) {
|
|
1502
|
+
let e = t.limits;
|
|
1503
|
+
n.limits = e && typeof e == "object" && !Array.isArray(e) && Object.hasOwn(e, "maxSyntaxNodes") ? { maxSyntaxNodes: e.maxSyntaxNodes } : e;
|
|
1504
|
+
}
|
|
1505
|
+
return n;
|
|
1506
|
+
} catch {
|
|
1507
|
+
return e;
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
function xt(e) {
|
|
1511
|
+
let t = ce(e);
|
|
1512
|
+
if (t !== "invalid") return t;
|
|
1513
|
+
try {
|
|
1514
|
+
return `invalid:${JSON.stringify(e)}`;
|
|
1515
|
+
} catch {
|
|
1516
|
+
return "invalid";
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
function St(e, t) {
|
|
1520
|
+
let n = bt(t);
|
|
1521
|
+
return {
|
|
1522
|
+
source: e,
|
|
1523
|
+
options: n,
|
|
1524
|
+
optionsKey: xt(n)
|
|
1525
|
+
};
|
|
1526
|
+
}
|
|
1527
|
+
function q(e, t) {
|
|
1528
|
+
return e.source === t.source && e.optionsKey === t.optionsKey;
|
|
1529
|
+
}
|
|
1530
|
+
function J(e) {
|
|
1496
1531
|
return e instanceof Error ? e.message : String(e);
|
|
1497
1532
|
}
|
|
1498
|
-
function
|
|
1533
|
+
function Y() {
|
|
1499
1534
|
return typeof performance < "u" ? performance.now() : Date.now();
|
|
1500
1535
|
}
|
|
1501
|
-
function
|
|
1536
|
+
function X(e) {
|
|
1502
1537
|
return Number.isFinite(e) ? Math.max(0, Math.round(e)) : 0;
|
|
1503
1538
|
}
|
|
1504
|
-
function
|
|
1539
|
+
function Z(e) {
|
|
1505
1540
|
return {
|
|
1506
1541
|
code: "local.worker.compile",
|
|
1507
|
-
message: `Compilation failed: ${
|
|
1542
|
+
message: `Compilation failed: ${J(e)}`,
|
|
1508
1543
|
severity: "error",
|
|
1509
1544
|
range: {
|
|
1510
1545
|
start: 0,
|
|
@@ -1514,12 +1549,12 @@ function X(e) {
|
|
|
1514
1549
|
column: 1
|
|
1515
1550
|
};
|
|
1516
1551
|
}
|
|
1517
|
-
var
|
|
1552
|
+
var Ct = class {
|
|
1518
1553
|
options;
|
|
1519
1554
|
delay;
|
|
1520
1555
|
worker = null;
|
|
1521
1556
|
timer = null;
|
|
1522
|
-
|
|
1557
|
+
queued = null;
|
|
1523
1558
|
inFlight = null;
|
|
1524
1559
|
nextId = 1;
|
|
1525
1560
|
pending = !1;
|
|
@@ -1535,17 +1570,17 @@ var ft = class {
|
|
|
1535
1570
|
this.handleWorkerFailure(t || "The compile worker encountered an error");
|
|
1536
1571
|
}, t.onmessageerror = () => this.handleWorkerFailure("The compile worker could not deliver the compile result"), this.worker = t;
|
|
1537
1572
|
} catch (t) {
|
|
1538
|
-
this.worker = null, e.onModeChange?.("fallback", `Could not start the compile worker: ${
|
|
1573
|
+
this.worker = null, e.onModeChange?.("fallback", `Could not start the compile worker: ${J(t)}`);
|
|
1539
1574
|
}
|
|
1540
1575
|
}
|
|
1541
|
-
schedule(e) {
|
|
1542
|
-
this.disposed || (this.
|
|
1576
|
+
schedule(e, t) {
|
|
1577
|
+
this.disposed || (this.queued = St(e, t), this.clearTimer(), this.timer = setTimeout(() => {
|
|
1543
1578
|
this.timer = null, this.drain();
|
|
1544
1579
|
}, this.delay), this.setPending(!0));
|
|
1545
1580
|
}
|
|
1546
1581
|
dispose() {
|
|
1547
1582
|
if (this.disposed) return;
|
|
1548
|
-
this.disposed = !0, this.clearTimer(), this.
|
|
1583
|
+
this.disposed = !0, this.clearTimer(), this.queued = null, this.inFlight = null;
|
|
1549
1584
|
let e = this.worker;
|
|
1550
1585
|
if (this.worker = null, e) {
|
|
1551
1586
|
e.onmessage = null, e.onerror = null, e.onmessageerror = null;
|
|
@@ -1557,8 +1592,8 @@ var ft = class {
|
|
|
1557
1592
|
}
|
|
1558
1593
|
drain() {
|
|
1559
1594
|
if (this.disposed || this.timer !== null || this.inFlight !== null) return;
|
|
1560
|
-
let e = this.
|
|
1561
|
-
e === null ? this.setPending(!1) : (this.
|
|
1595
|
+
let e = this.queued;
|
|
1596
|
+
e === null ? this.setPending(!1) : (this.queued = null, this.compile(e));
|
|
1562
1597
|
}
|
|
1563
1598
|
compile(e) {
|
|
1564
1599
|
let t = this.worker;
|
|
@@ -1569,33 +1604,42 @@ var ft = class {
|
|
|
1569
1604
|
let n = this.nextId++;
|
|
1570
1605
|
this.inFlight = {
|
|
1571
1606
|
id: n,
|
|
1572
|
-
|
|
1607
|
+
job: e
|
|
1573
1608
|
};
|
|
1574
1609
|
try {
|
|
1575
1610
|
t.postMessage({
|
|
1576
1611
|
id: n,
|
|
1577
|
-
source: e
|
|
1612
|
+
source: e.source,
|
|
1613
|
+
...e.options === void 0 ? {} : { options: e.options }
|
|
1578
1614
|
});
|
|
1579
1615
|
} catch (t) {
|
|
1580
|
-
this.inFlight = null
|
|
1616
|
+
this.inFlight = null;
|
|
1617
|
+
let n = `Could not send the source to the compile worker: ${J(t)}`, r = this.queued;
|
|
1618
|
+
if (r !== null && !q(r, e)) {
|
|
1619
|
+
this.degrade(n), this.finishRun();
|
|
1620
|
+
return;
|
|
1621
|
+
}
|
|
1622
|
+
r !== null && (this.queued = null, this.clearTimer()), this.degrade(n), this.compileFallback(e);
|
|
1581
1623
|
}
|
|
1582
1624
|
}
|
|
1583
1625
|
compileFallback(e) {
|
|
1584
1626
|
if (this.disposed) return;
|
|
1585
|
-
let t =
|
|
1627
|
+
let t = Y(), n;
|
|
1586
1628
|
try {
|
|
1587
|
-
|
|
1629
|
+
let t = this.options.fallbackCompile ?? y;
|
|
1630
|
+
n = e.options === void 0 ? t(e.source) : t(e.source, e.options);
|
|
1588
1631
|
} catch (e) {
|
|
1589
1632
|
n = {
|
|
1590
1633
|
ok: !1,
|
|
1591
|
-
diagnostics: [
|
|
1634
|
+
diagnostics: [Z(e)]
|
|
1592
1635
|
};
|
|
1593
1636
|
}
|
|
1594
1637
|
this.deliver({
|
|
1595
|
-
source: e,
|
|
1638
|
+
source: e.source,
|
|
1596
1639
|
result: n,
|
|
1597
|
-
duration: Y(
|
|
1598
|
-
mode: "fallback"
|
|
1640
|
+
duration: X(Y() - t),
|
|
1641
|
+
mode: "fallback",
|
|
1642
|
+
...e.options === void 0 ? {} : { options: e.options }
|
|
1599
1643
|
}), this.finishRun();
|
|
1600
1644
|
}
|
|
1601
1645
|
receive(e) {
|
|
@@ -1603,27 +1647,29 @@ var ft = class {
|
|
|
1603
1647
|
let t = this.inFlight;
|
|
1604
1648
|
if (!t || !e || e.id !== t.id) return;
|
|
1605
1649
|
this.inFlight = null;
|
|
1606
|
-
let n = this.
|
|
1607
|
-
|
|
1608
|
-
source:
|
|
1650
|
+
let n = t.job, r = this.queued;
|
|
1651
|
+
r !== null && !q(r, n) || (r !== null && (this.queued = null, this.clearTimer()), e.ok ? this.deliver({
|
|
1652
|
+
source: n.source,
|
|
1609
1653
|
result: e.result,
|
|
1610
|
-
duration:
|
|
1611
|
-
mode: "worker"
|
|
1654
|
+
duration: X(e.duration),
|
|
1655
|
+
mode: "worker",
|
|
1656
|
+
...n.options === void 0 ? {} : { options: n.options }
|
|
1612
1657
|
}) : this.deliver({
|
|
1613
|
-
source:
|
|
1658
|
+
source: n.source,
|
|
1614
1659
|
result: {
|
|
1615
1660
|
ok: !1,
|
|
1616
|
-
diagnostics: [
|
|
1661
|
+
diagnostics: [Z(e.message)]
|
|
1617
1662
|
},
|
|
1618
1663
|
duration: 0,
|
|
1619
|
-
mode: "worker"
|
|
1664
|
+
mode: "worker",
|
|
1665
|
+
...n.options === void 0 ? {} : { options: n.options }
|
|
1620
1666
|
})), this.finishRun();
|
|
1621
1667
|
}
|
|
1622
1668
|
handleWorkerFailure(e) {
|
|
1623
1669
|
if (this.disposed) return;
|
|
1624
1670
|
this.degrade(e);
|
|
1625
1671
|
let t = this.inFlight;
|
|
1626
|
-
this.inFlight = null, t && (this.
|
|
1672
|
+
this.inFlight = null, t && (this.queued === null || q(this.queued, t.job)) && (this.queued !== null && (this.queued = null, this.clearTimer()), this.compileFallback(t.job)), this.finishRun();
|
|
1627
1673
|
}
|
|
1628
1674
|
degrade(e) {
|
|
1629
1675
|
let t = this.worker;
|
|
@@ -1636,7 +1682,7 @@ var ft = class {
|
|
|
1636
1682
|
}
|
|
1637
1683
|
}
|
|
1638
1684
|
finishRun() {
|
|
1639
|
-
this.disposed || (this.drain(), !this.disposed && this.setPending(this.timer !== null || this.inFlight !== null || this.
|
|
1685
|
+
this.disposed || (this.drain(), !this.disposed && this.setPending(this.timer !== null || this.inFlight !== null || this.queued !== null));
|
|
1640
1686
|
}
|
|
1641
1687
|
deliver(e) {
|
|
1642
1688
|
this.disposed || this.options.onResult(e);
|
|
@@ -1648,7 +1694,7 @@ var ft = class {
|
|
|
1648
1694
|
this.timer !== null && (clearTimeout(this.timer), this.timer = null);
|
|
1649
1695
|
}
|
|
1650
1696
|
};
|
|
1651
|
-
function
|
|
1697
|
+
function wt(e, t, n) {
|
|
1652
1698
|
try {
|
|
1653
1699
|
e.postMessage({
|
|
1654
1700
|
id: t,
|
|
@@ -1657,15 +1703,15 @@ function pt(e, t, n) {
|
|
|
1657
1703
|
});
|
|
1658
1704
|
} catch {}
|
|
1659
1705
|
}
|
|
1660
|
-
function
|
|
1706
|
+
function Tt(e) {
|
|
1661
1707
|
let t = e === void 0 ? globalThis : e;
|
|
1662
1708
|
if (!t || typeof t.postMessage != "function") throw TypeError("startLocalCompileWorker requires a worker scope with postMessage");
|
|
1663
1709
|
t.onmessage = (e) => {
|
|
1664
1710
|
let n = e?.data;
|
|
1665
1711
|
if (!n || typeof n.id != "number" || typeof n.source != "string") return;
|
|
1666
|
-
let r =
|
|
1712
|
+
let r = Y();
|
|
1667
1713
|
try {
|
|
1668
|
-
let e =
|
|
1714
|
+
let e = n.options === void 0 ? y(n.source) : y(n.source, n.options), i = X(Y() - r);
|
|
1669
1715
|
try {
|
|
1670
1716
|
t.postMessage({
|
|
1671
1717
|
id: n.id,
|
|
@@ -1674,29 +1720,29 @@ function mt(e) {
|
|
|
1674
1720
|
duration: i
|
|
1675
1721
|
});
|
|
1676
1722
|
} catch (e) {
|
|
1677
|
-
|
|
1723
|
+
wt(t, n.id, `Could not return the compile result: ${J(e)}`);
|
|
1678
1724
|
}
|
|
1679
1725
|
} catch (e) {
|
|
1680
|
-
|
|
1726
|
+
wt(t, n.id, J(e));
|
|
1681
1727
|
}
|
|
1682
1728
|
};
|
|
1683
1729
|
}
|
|
1684
1730
|
// src/shareable.ts
|
|
1685
|
-
var
|
|
1686
|
-
function
|
|
1731
|
+
var Et = "reactive-md-html/v1", Dt = /^[A-Za-z][A-Za-z0-9_-]*$/, Ot = /^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/, kt = /^data:image\/(?:png|jpeg|gif|webp);base64,[A-Za-z0-9+/]+={0,2}$/, At = /[\u0000-\u001f\u007f-\u009f]/, jt = 64, Mt = 41943040, Nt = 4096;
|
|
1732
|
+
function Q(e, t = !1) {
|
|
1687
1733
|
let n = e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
1688
1734
|
return t && (n = n.replace(/"/g, """).replace(/'/g, "'")), n;
|
|
1689
1735
|
}
|
|
1690
|
-
function
|
|
1736
|
+
function Pt(e) {
|
|
1691
1737
|
return e.replace(/<\/style/gi, "<\\/style");
|
|
1692
1738
|
}
|
|
1693
|
-
function
|
|
1739
|
+
function Ft(e) {
|
|
1694
1740
|
return e.replace(/<\/script/gi, "<\\/script").replace(/<!--/g, "<\\!--");
|
|
1695
1741
|
}
|
|
1696
|
-
function
|
|
1697
|
-
return
|
|
1742
|
+
function $(e) {
|
|
1743
|
+
return Q(e, !0);
|
|
1698
1744
|
}
|
|
1699
|
-
function
|
|
1745
|
+
function It(e) {
|
|
1700
1746
|
let t = JSON.stringify(e);
|
|
1701
1747
|
if (typeof t != "string") throw TypeError("Cannot serialize a non-JSON value for an inline script.");
|
|
1702
1748
|
return t.replace(/[<>&\u2028\u2029]/g, (e) => {
|
|
@@ -1709,32 +1755,94 @@ function Tt(e) {
|
|
|
1709
1755
|
}
|
|
1710
1756
|
});
|
|
1711
1757
|
}
|
|
1712
|
-
function
|
|
1758
|
+
function Lt(e) {
|
|
1713
1759
|
return Array.isArray(e) ? e.slice() : e;
|
|
1714
1760
|
}
|
|
1715
|
-
function
|
|
1761
|
+
function Rt(e) {
|
|
1762
|
+
if (e === void 0) return;
|
|
1763
|
+
let t = h(e);
|
|
1764
|
+
if (!t.ok) throw TypeError(`createShareableHtml received invalid compileOptions: ${t.message}`);
|
|
1765
|
+
let n = {
|
|
1766
|
+
enableCss: t.html.enableCss,
|
|
1767
|
+
enableJavaScript: t.html.enableJavaScript,
|
|
1768
|
+
enableExtendedHtml: t.html.enableExtendedHtml
|
|
1769
|
+
};
|
|
1770
|
+
return e.limits !== void 0 && e.limits.maxSyntaxNodes !== void 0 ? {
|
|
1771
|
+
...n,
|
|
1772
|
+
limits: { maxSyntaxNodes: t.maxSyntaxNodes }
|
|
1773
|
+
} : n;
|
|
1774
|
+
}
|
|
1775
|
+
function zt(e) {
|
|
1776
|
+
let t = [];
|
|
1777
|
+
for (let n of e.childNodes) {
|
|
1778
|
+
if (m.isElementNode(n)) {
|
|
1779
|
+
let e = n.tagName.toLowerCase();
|
|
1780
|
+
if (e === "script") continue;
|
|
1781
|
+
zt(e === "template" ? m.getTemplateContent(n) : n);
|
|
1782
|
+
}
|
|
1783
|
+
t.push(n);
|
|
1784
|
+
}
|
|
1785
|
+
e.childNodes = t;
|
|
1786
|
+
}
|
|
1787
|
+
function Bt(e, t, n) {
|
|
1788
|
+
let r = !1;
|
|
1789
|
+
for (let i of e.childNodes) if (m.isElementNode(i)) {
|
|
1790
|
+
if (i.tagName.toLowerCase() === "iframe") {
|
|
1791
|
+
let e = i.attrs.filter((e) => {
|
|
1792
|
+
let t = e.name.toLowerCase();
|
|
1793
|
+
return t !== "srcdoc" && t !== "sandbox";
|
|
1794
|
+
});
|
|
1795
|
+
e.push({
|
|
1796
|
+
name: "srcdoc",
|
|
1797
|
+
value: t
|
|
1798
|
+
}), e.push({
|
|
1799
|
+
name: "sandbox",
|
|
1800
|
+
value: n
|
|
1801
|
+
}), i.attrs = e, r = !0;
|
|
1802
|
+
}
|
|
1803
|
+
Bt(i, t, n) && (r = !0);
|
|
1804
|
+
}
|
|
1805
|
+
return r;
|
|
1806
|
+
}
|
|
1807
|
+
function Vt(e) {
|
|
1808
|
+
let t = "";
|
|
1809
|
+
for (let n of e.childNodes) t += ue(n, { scriptingEnabled: !1 });
|
|
1810
|
+
return t;
|
|
1811
|
+
}
|
|
1812
|
+
function Ht(e, t, n) {
|
|
1813
|
+
try {
|
|
1814
|
+
let r = le(e, { scriptingEnabled: !1 });
|
|
1815
|
+
if (zt(r), Bt(r, t, n)) return Vt(r);
|
|
1816
|
+
} catch {}
|
|
1817
|
+
return `<div class="reactive-md-native-document"><iframe class="reactive-md-native-frame" title="Reactive MD document" sandbox="${Q(n, !0)}" style="display:block;width:100%;min-height:60vh;border:0;background:#fff" srcdoc="${Q(t, !0)}"></iframe></div>`;
|
|
1818
|
+
}
|
|
1819
|
+
function Ut(e, t) {
|
|
1820
|
+
let n = t?.enableExtendedHtml === !0, r = t ? `frame-src about:${n ? " data: blob: http: https:" : ""}` : "frame-src 'none'", i = n ? "base-uri 'self' http: https:" : "base-uri 'none'", a = n ? "form-action http: https:" : "form-action 'none'";
|
|
1821
|
+
return e ? `default-src 'none'; img-src data:; style-src 'unsafe-inline'; script-src 'unsafe-inline'; font-src data:; connect-src 'none'; media-src 'none'; object-src 'none'; ${r}; ${i}; ${a}` : `default-src 'none'; img-src data:; style-src 'unsafe-inline'; font-src data:; object-src 'none'; ${r}; ${i}; ${a}`;
|
|
1822
|
+
}
|
|
1823
|
+
function Wt(e) {
|
|
1716
1824
|
if (e === void 0) return;
|
|
1717
1825
|
if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("images must be an object mapping relative URLs to data: image URLs.");
|
|
1718
1826
|
let t = Object.entries(e);
|
|
1719
|
-
if (t.length >
|
|
1827
|
+
if (t.length > jt) throw RangeError(`images cannot contain more than ${jt} entries.`);
|
|
1720
1828
|
let n = 0;
|
|
1721
1829
|
for (let [e, r] of t) {
|
|
1722
|
-
if (!e || e.length >
|
|
1723
|
-
if (typeof r != "string" || !
|
|
1724
|
-
if (n += r.length, n >
|
|
1830
|
+
if (!e || e.length > Nt || At.test(e) || e === "__proto__") throw TypeError("Every image key must be a bounded, control-free URL.");
|
|
1831
|
+
if (typeof r != "string" || !kt.test(r)) throw TypeError(`The image map for "${e}" must contain a base64 PNG, JPEG, GIF or WebP data URL.`);
|
|
1832
|
+
if (n += r.length, n > Mt) throw RangeError("The embedded image map exceeds the 40 MiB budget.");
|
|
1725
1833
|
}
|
|
1726
1834
|
return Object.fromEntries(t);
|
|
1727
1835
|
}
|
|
1728
|
-
function
|
|
1729
|
-
let n =
|
|
1836
|
+
function Gt(e, t) {
|
|
1837
|
+
let n = ct(e, t);
|
|
1730
1838
|
if (!n.ok) return n;
|
|
1731
1839
|
let r = {};
|
|
1732
1840
|
for (let [t, i] of Object.entries(e.bindings)) r[t] = Object.hasOwn(n.state, t) ? {
|
|
1733
1841
|
...i,
|
|
1734
|
-
initial:
|
|
1842
|
+
initial: Lt(n.state[t])
|
|
1735
1843
|
} : i;
|
|
1736
1844
|
let i = { ...e.initialState };
|
|
1737
|
-
for (let [e, t] of Object.entries(n.state)) i[e] =
|
|
1845
|
+
for (let [e, t] of Object.entries(n.state)) i[e] = Lt(t);
|
|
1738
1846
|
return {
|
|
1739
1847
|
ok: !0,
|
|
1740
1848
|
baseline: {
|
|
@@ -1747,52 +1855,65 @@ function Dt(e, t) {
|
|
|
1747
1855
|
}
|
|
1748
1856
|
};
|
|
1749
1857
|
}
|
|
1750
|
-
var
|
|
1751
|
-
function
|
|
1858
|
+
var Kt = "\n:root { color-scheme: light; background: #f5f7fb; }\nhtml, body { margin: 0; }\nbody.reactive-md-export {\n min-height: 100vh;\n padding: clamp(16px, 4vw, 48px);\n background: #f5f7fb;\n color: #17233d;\n font-family: system-ui, -apple-system, \"Segoe UI\", sans-serif;\n}\n.reactive-md-export-root { max-width: 840px; margin: 0 auto; }\n@media print {\n :root, html, body.reactive-md-export { background: #fff !important; }\n body.reactive-md-export { min-height: 0; padding: 0 !important; }\n .reactive-md-export-root { max-width: none !important; margin: 0 !important; }\n}\n";
|
|
1859
|
+
function qt(e) {
|
|
1752
1860
|
let t = e.targetId ?? "reactive-md-document";
|
|
1753
|
-
if (!
|
|
1861
|
+
if (!Dt.test(t)) throw TypeError("targetId must start with a letter and contain only letters, digits, underscores or hyphens.");
|
|
1754
1862
|
let n = e.mode === "static" ? "static" : "interactive";
|
|
1755
1863
|
if (!e.staticMarkup.trim()) throw TypeError("createShareableHtml requires rendered document markup.");
|
|
1756
1864
|
if (!e.css.trim()) throw TypeError("createShareableHtml requires the document stylesheet.");
|
|
1757
1865
|
if (e.state.sourceDigest !== V(e.source)) throw Error("The state file does not belong to the exported source.");
|
|
1758
1866
|
if (n === "interactive" && !e.runtimeScript?.trim()) throw TypeError("Interactive HTML requires the standalone runtime script.");
|
|
1759
|
-
let r = e.
|
|
1867
|
+
let r = Rt(e.compileOptions), i = h(r);
|
|
1868
|
+
if (!i.ok) throw TypeError(`createShareableHtml received invalid compileOptions: ${i.message}`);
|
|
1869
|
+
let a = i.htmlActive, o = e.staticMarkup;
|
|
1870
|
+
if (a && (n === "static" || !i.html.enableJavaScript)) {
|
|
1871
|
+
let t = {
|
|
1872
|
+
enableCss: i.html.enableCss,
|
|
1873
|
+
enableJavaScript: !1,
|
|
1874
|
+
enableExtendedHtml: i.html.enableExtendedHtml
|
|
1875
|
+
}, n = te(e.source, t, i.maxSyntaxNodes);
|
|
1876
|
+
if (!n.markup) throw Error("The native HTML document could not be regenerated without author JavaScript.");
|
|
1877
|
+
o = Ht(e.staticMarkup, n.markup, se(t));
|
|
1878
|
+
}
|
|
1879
|
+
let s = e.locale === "zh" ? "zh" : "en", c = s === "zh" ? "zh-CN" : "en", l = e.colorScheme === "light" || e.colorScheme === "dark" ? e.colorScheme : "auto", u = e.assets === "omit" ? "omit" : "inline", d = e.generator ?? {
|
|
1760
1880
|
name: "reactive-md",
|
|
1761
1881
|
version: "unknown"
|
|
1762
|
-
},
|
|
1882
|
+
}, f = Wt(e.images), p = Number.isSafeInteger(e.imageCount) && (e.imageCount ?? 0) > 0 ? String(e.imageCount) : String(Object.keys(f ?? {}).length), m = n === "interactive", g = {
|
|
1763
1883
|
version: 1,
|
|
1764
1884
|
target: t,
|
|
1765
1885
|
source: e.source,
|
|
1766
1886
|
state: e.state,
|
|
1767
|
-
locale:
|
|
1768
|
-
colorScheme:
|
|
1887
|
+
locale: s,
|
|
1888
|
+
colorScheme: l,
|
|
1769
1889
|
hydrate: !0,
|
|
1770
|
-
...
|
|
1771
|
-
|
|
1772
|
-
|
|
1890
|
+
...r === void 0 ? {} : { compileOptions: r },
|
|
1891
|
+
...f ? { images: f } : {}
|
|
1892
|
+
}, _ = Ut(m, a ? i.html : void 0), v = m ? `<script type="application/reactive-md+json" data-reactive-md-auto>${It(g)}<\/script>
|
|
1893
|
+
<script>${Ft(e.runtimeScript)}<\/script>` : "", ee = e.notices?.trim() ? `<template id="reactive-md-notices"><pre>${Q(e.notices)}</pre></template>` : "";
|
|
1773
1894
|
return `<!doctype html>
|
|
1774
|
-
<html lang="${
|
|
1895
|
+
<html lang="${Q(Ot.test(c) ? c : "en", !0)}">
|
|
1775
1896
|
<head>
|
|
1776
1897
|
<meta charset="utf-8">
|
|
1777
1898
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
1778
1899
|
<meta name="referrer" content="no-referrer">
|
|
1779
|
-
<meta http-equiv="Content-Security-Policy" content="${
|
|
1780
|
-
<meta name="generator" content="${
|
|
1781
|
-
<meta name="reactive-md-html-format" content="${
|
|
1782
|
-
<meta name="reactive-md-syntax" content="${
|
|
1900
|
+
<meta http-equiv="Content-Security-Policy" content="${$(_)}">
|
|
1901
|
+
<meta name="generator" content="${$(`${d.name} ${d.version}`)}">
|
|
1902
|
+
<meta name="reactive-md-html-format" content="${Et}">
|
|
1903
|
+
<meta name="reactive-md-syntax" content="${$(e.state.syntax)}">
|
|
1783
1904
|
<meta name="reactive-md-output" content="${n}">
|
|
1784
|
-
<meta name="reactive-md-state" content="${
|
|
1785
|
-
<meta name="reactive-md-images" content="${
|
|
1786
|
-
<meta name="reactive-md-image-count" content="${
|
|
1787
|
-
<title>${
|
|
1788
|
-
<style>${
|
|
1905
|
+
<meta name="reactive-md-state" content="${$(e.state.sourceDigest)}">
|
|
1906
|
+
<meta name="reactive-md-images" content="${u}">
|
|
1907
|
+
<meta name="reactive-md-image-count" content="${p}">
|
|
1908
|
+
<title>${Q(e.title || "Reactive MD document")}</title>
|
|
1909
|
+
<style>${Pt(e.css)}${Kt}</style>
|
|
1789
1910
|
</head>
|
|
1790
1911
|
<body class="reactive-md-export">
|
|
1791
|
-
<div id="${t}" class="reactive-md-export-root">${
|
|
1792
|
-
${
|
|
1793
|
-
${
|
|
1912
|
+
<div id="${t}" class="reactive-md-export-root">${o}</div>
|
|
1913
|
+
${v}
|
|
1914
|
+
${ee}
|
|
1794
1915
|
</body>
|
|
1795
1916
|
</html>
|
|
1796
1917
|
`;
|
|
1797
1918
|
}
|
|
1798
|
-
export {
|
|
1919
|
+
export { g as DEFAULT_LOCAL_THEME, yt as LOCAL_COMPILE_DELAY_MS, l as LOCAL_DIAGNOSTIC_CODES, I as LOCAL_STATE_FORMAT, f as LOCAL_SYNTAX_VERSION, _ as LOCAL_THEME_PROTOCOL, Ct as LocalCompileScheduler, e as LocalExpressionError, Et as SHAREABLE_HTML_FORMAT, we as analyzeLocalSource, lt as applyLocalState, vt as applyLocalStateRetention, Ve as checkLocalUpgrade, o as compileExpression, Z as compileFailureDiagnostic, n as compileLatex, y as compileLocal, Ne as completeLocalSource, s as countLocalCodePoints, b as createLocalRuntime, nt as createLocalStateFile, qt as createShareableHtml, ut as exportLocalState, i as formatLocalDiagnostic, Le as formatLocalSource, dt as importLocalState, ze as inspectLocalSourceVersion, a as isLocalDiagnosticCode, oe as isLocalThemeName, de as localDiagnosticTemplate, t as localDiagnosticTemplateKeys, V as localSourceDigest, He as migrateLocalSource, W as parseLocalState, gt as planLocalStateRetention, Fe as renameLocalBinding, ct as resolveLocalState, Gt as resolveLocalStateBaseline, ie as resolveLocalTheme, re as samplePlot, It as serializeForScript, ft as serializeLocalState, Tt as startLocalCompileWorker };
|