reactive-md 0.5.2 → 0.6.0
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 +47 -15
- package/CHANGELOG.md +47 -15
- package/CONTRIBUTING-ch.md +10 -5
- package/CONTRIBUTING.md +10 -5
- package/README-ch.md +38 -36
- package/README-en.md +45 -42
- package/README.md +45 -42
- package/SECURITY-ch.md +1 -1
- package/SECURITY.md +1 -1
- package/THIRD_PARTY_NOTICES.md +481 -1
- package/cli/build.mjs +1 -1
- package/cli/package.mjs +1 -0
- package/dist-library/authoring-DSC0VsNK.js +842 -0
- package/dist-library/{runtime-UiQPz5ZV.js → compiler-CRD88BMt.js} +8944 -5847
- package/dist-library/react-Dk94rcOp.js +59658 -0
- package/dist-library/reactive-md-authoring.js +1514 -0
- package/dist-library/reactive-md-editor.js +589 -570
- package/dist-library/reactive-md-print.css +284 -0
- package/dist-library/reactive-md-react-unstyled.js +1 -0
- package/dist-library/reactive-md-react.js +1 -13208
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +308 -1126
- package/dist-library/runtime-D8KbnCd0.js +498 -0
- package/dist-library/types/authoring/index.d.ts +24 -0
- package/dist-library/types/editor/command-types.d.ts +10 -0
- package/dist-library/types/editor/editor-commands.d.ts +2 -2
- package/dist-library/types/editor/editor-i18n.d.ts +1 -1
- package/dist-library/types/editor/native-components.d.ts +1 -1
- package/dist-library/types/editor/source-authoring.d.ts +5 -3
- package/dist-library/types/editor/types.d.ts +7 -10
- package/dist-library/types/local/LocalDocumentView.d.ts +4 -2
- package/dist-library/types/local/authoring.d.ts +9 -5
- package/dist-library/types/local/code-block.d.ts +3 -1
- package/dist-library/types/local/code-languages.d.ts +7 -0
- package/dist-library/types/local/compiled-data.d.ts +6 -0
- package/dist-library/types/local/compiler.d.ts +1 -0
- package/dist-library/types/local/diagnostics.d.ts +71 -0
- package/dist-library/types/local/diagram-layout.d.ts +69 -0
- package/dist-library/types/local/html-names.d.ts +6 -0
- package/dist-library/types/local/html-table.d.ts +25 -0
- package/dist-library/types/local/index.d.ts +1 -0
- package/dist-library/types/local/math-display.d.ts +73 -0
- package/dist-library/types/local/math-view.d.ts +2 -0
- package/dist-library/types/local/options.d.ts +3 -1
- package/dist-library/types/local/table-surface.d.ts +10 -0
- package/dist-library/types/local/types.d.ts +12 -0
- package/dist-library/types/local/visuals.d.ts +9 -0
- package/dist-library/types/local/worker.d.ts +3 -2
- package/dist-library/types/react/index.d.ts +1 -1
- package/dist-standalone/reactive-md-standalone.css +1 -1
- package/dist-standalone/reactive-md-standalone.js +79 -51
- package/docs/README.md +84 -0
- package/docs/{compatibility-ch.md → compatibility/compatibility-ch.md} +28 -18
- package/docs/{compatibility-en.md → compatibility/compatibility-en.md} +28 -18
- package/docs/{source-versioning-ch.md → compatibility/source-versioning-ch.md} +2 -2
- package/docs/{source-versioning-en.md → compatibility/source-versioning-en.md} +2 -2
- package/docs/{component-development-ch.md → development/component-development-ch.md} +7 -7
- package/docs/{component-development-en.md → development/component-development-en.md} +7 -7
- package/docs/{component-protocol-ch.md → development/component-protocol-ch.md} +17 -17
- package/docs/{component-protocol-en.md → development/component-protocol-en.md} +17 -17
- package/docs/{performance-ch.md → development/performance-ch.md} +2 -2
- package/docs/{performance-en.md → development/performance-en.md} +2 -2
- package/docs/{releasing-ch.md → development/releasing-ch.md} +12 -12
- package/docs/{releasing-en.md → development/releasing-en.md} +12 -12
- package/docs/guides/local-guide-ch.md +513 -0
- package/docs/guides/local-guide-en.md +513 -0
- package/docs/{author-tools-ch.md → integration/author-tools-ch.md} +13 -7
- package/docs/{author-tools-en.md → integration/author-tools-en.md} +13 -7
- package/docs/{editor-ch.md → integration/editor-ch.md} +238 -235
- package/docs/{editor-en.md → integration/editor-en.md} +238 -235
- package/docs/{local-integration-ch.md → integration/local-integration-ch.md} +410 -390
- package/docs/{local-integration-en.md → integration/local-integration-en.md} +410 -390
- package/docs/{shareable-export-ch.md → integration/shareable-export-ch.md} +16 -4
- package/docs/{shareable-export-en.md → integration/shareable-export-en.md} +16 -4
- package/docs/{computations-formatting-ch.md → reference/computations-formatting-ch.md} +2 -2
- package/docs/{computations-formatting-en.md → reference/computations-formatting-en.md} +2 -2
- package/docs/{constraints-collections-ch.md → reference/constraints-collections-ch.md} +2 -2
- package/docs/{constraints-collections-en.md → reference/constraints-collections-en.md} +2 -2
- package/docs/{diagnostics-counting-ch.md → reference/diagnostics-counting-ch.md} +22 -2
- package/docs/{diagnostics-counting-en.md → reference/diagnostics-counting-en.md} +22 -2
- package/docs/{html-compatibility-ch.md → reference/html-compatibility-ch.md} +42 -4
- package/docs/{html-compatibility-en.md → reference/html-compatibility-en.md} +42 -4
- package/docs/{local-components-v2-ch.md → reference/local-components-v2-ch.md} +2 -2
- package/docs/{local-components-v2-en.md → reference/local-components-v2-en.md} +2 -2
- package/docs/{local-interaction-syntax-ch.md → reference/local-interaction-syntax-ch.md} +26 -7
- package/docs/{local-interaction-syntax-en.md → reference/local-interaction-syntax-en.md} +26 -7
- package/docs/{theme-protocol-ch.md → reference/theme-protocol-ch.md} +1 -1
- package/docs/{theme-protocol-en.md → reference/theme-protocol-en.md} +1 -1
- package/docs/{release-0.4.0-ch.md → releases/release-0.4.0-ch.md} +6 -6
- package/docs/{release-0.4.0-en.md → releases/release-0.4.0-en.md} +6 -6
- package/docs/{release-0.4.1-ch.md → releases/release-0.4.1-ch.md} +2 -2
- package/docs/{release-0.4.1-en.md → releases/release-0.4.1-en.md} +2 -2
- package/docs/{release-0.5.0-ch.md → releases/release-0.5.0-ch.md} +4 -4
- package/docs/{release-0.5.0-en.md → releases/release-0.5.0-en.md} +4 -4
- package/docs/{release-0.5.1-ch.md → releases/release-0.5.1-ch.md} +4 -4
- package/docs/{release-0.5.1-en.md → releases/release-0.5.1-en.md} +4 -4
- package/docs/{release-0.5.2-ch.md → releases/release-0.5.2-ch.md} +3 -3
- package/docs/{release-0.5.2-en.md → releases/release-0.5.2-en.md} +3 -3
- package/docs/releases/release-0.5.3-ch.md +25 -0
- package/docs/releases/release-0.5.3-en.md +25 -0
- package/docs/releases/release-0.6.0-ch.md +57 -0
- package/docs/releases/release-0.6.0-en.md +57 -0
- package/examples/conformance/README.md +4 -4
- package/examples/integration/README.md +10 -8
- package/examples/integration/worker/package.json +1 -1
- package/examples/local/README.md +5 -5
- package/examples/local/html-compat.reactive.md +19 -0
- package/package.json +20 -3
- package/docs/local-guide-ch.md +0 -967
- package/docs/local-guide-en.md +0 -967
|
@@ -1,827 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
"code",
|
|
5
|
-
"inlineCode",
|
|
6
|
-
"math",
|
|
7
|
-
"inlineMath",
|
|
8
|
-
"fallback",
|
|
9
|
-
"comment",
|
|
10
|
-
"footnoteDefinition"
|
|
11
|
-
]), ge = /* @__PURE__ */ new Set([
|
|
12
|
-
"local.version.unsupported",
|
|
13
|
-
"local.version.malformed",
|
|
14
|
-
"local.version.duplicate",
|
|
15
|
-
"local.version.placement",
|
|
16
|
-
"local.parse",
|
|
17
|
-
"local.interpolation",
|
|
18
|
-
"local.tag.unclosed",
|
|
19
|
-
"local.tag.mismatch",
|
|
20
|
-
"local.tag.closing",
|
|
21
|
-
"local.tag.shape",
|
|
22
|
-
"local.attribute",
|
|
23
|
-
"local.budget"
|
|
24
|
-
]);
|
|
25
|
-
function b(e) {
|
|
26
|
-
return e !== void 0 && /[A-Za-z_]/.test(e);
|
|
27
|
-
}
|
|
28
|
-
function _e(e) {
|
|
29
|
-
return e !== void 0 && /[A-Za-z0-9_]/.test(e);
|
|
30
|
-
}
|
|
31
|
-
function x(e) {
|
|
32
|
-
return e !== void 0 && /\s/.test(e);
|
|
33
|
-
}
|
|
34
|
-
function S(e) {
|
|
35
|
-
return e.length > 0 && e.length <= me && pe.test(e) && !ne.has(e);
|
|
36
|
-
}
|
|
37
|
-
function C(e) {
|
|
38
|
-
return {
|
|
39
|
-
start: e.start,
|
|
40
|
-
end: e.end
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
function ve(e) {
|
|
44
|
-
try {
|
|
45
|
-
return y(e).diagnostics;
|
|
46
|
-
} catch {
|
|
47
|
-
return [];
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
var ye = /^<(\/?)([A-Za-z][A-Za-z0-9_-]*)(?=[\s/>])/;
|
|
51
|
-
function w(e, t) {
|
|
52
|
-
if (e[t] !== "<") return null;
|
|
53
|
-
let n = ye.exec(e.slice(t));
|
|
54
|
-
if (!n) return null;
|
|
55
|
-
let r = !!n[1], i = n[2], a = t + (r ? 2 : 1), o = "", s = t + n[0].length;
|
|
56
|
-
for (; s < e.length; s += 1) {
|
|
57
|
-
let t = e[s];
|
|
58
|
-
if (o) t === o && (o = "");
|
|
59
|
-
else if (t === "\"" || t === "'") o = t;
|
|
60
|
-
else if (t === ">") break;
|
|
61
|
-
}
|
|
62
|
-
if (s >= e.length) return null;
|
|
63
|
-
let c = s, l = s + 1;
|
|
64
|
-
if (r) return {
|
|
65
|
-
start: t,
|
|
66
|
-
end: l,
|
|
67
|
-
contentEnd: c,
|
|
68
|
-
name: i,
|
|
69
|
-
nameRange: {
|
|
70
|
-
start: a,
|
|
71
|
-
end: a + i.length
|
|
72
|
-
},
|
|
73
|
-
closing: !0,
|
|
74
|
-
selfClosing: !1,
|
|
75
|
-
attrs: []
|
|
76
|
-
};
|
|
77
|
-
let u = [], d = a + i.length;
|
|
78
|
-
for (; d < c;) {
|
|
79
|
-
for (; d < c && x(e[d]);) d += 1;
|
|
80
|
-
if (d >= c) break;
|
|
81
|
-
if (e[d] === "/") {
|
|
82
|
-
d += 1;
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
let t = /^[A-Za-z][A-Za-z0-9_-]*/.exec(e.slice(d, c));
|
|
86
|
-
if (!t) {
|
|
87
|
-
d += 1;
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
let n = d, r = t[0];
|
|
91
|
-
d += r.length;
|
|
92
|
-
let i = d, a = d;
|
|
93
|
-
for (; a < c && x(e[a]);) a += 1;
|
|
94
|
-
if (e[a] !== "=") {
|
|
95
|
-
u.push({
|
|
96
|
-
name: r,
|
|
97
|
-
nameRange: {
|
|
98
|
-
start: n,
|
|
99
|
-
end: n + r.length
|
|
100
|
-
}
|
|
101
|
-
}), d = i;
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
for (d = a + 1; d < c && x(e[d]);) d += 1;
|
|
105
|
-
let o = e[d];
|
|
106
|
-
if (o === "\"" || o === "'") {
|
|
107
|
-
let t = d, i = d + 1, a = e.indexOf(o, i);
|
|
108
|
-
if (a < 0 || a > c) {
|
|
109
|
-
u.push({
|
|
110
|
-
name: r,
|
|
111
|
-
nameRange: {
|
|
112
|
-
start: n,
|
|
113
|
-
end: n + r.length
|
|
114
|
-
},
|
|
115
|
-
valueRange: {
|
|
116
|
-
start: i,
|
|
117
|
-
end: c
|
|
118
|
-
},
|
|
119
|
-
quoteStart: t,
|
|
120
|
-
quoteEnd: c
|
|
121
|
-
}), d = c;
|
|
122
|
-
continue;
|
|
123
|
-
}
|
|
124
|
-
u.push({
|
|
125
|
-
name: r,
|
|
126
|
-
nameRange: {
|
|
127
|
-
start: n,
|
|
128
|
-
end: n + r.length
|
|
129
|
-
},
|
|
130
|
-
valueRange: {
|
|
131
|
-
start: i,
|
|
132
|
-
end: a
|
|
133
|
-
},
|
|
134
|
-
quoteStart: t,
|
|
135
|
-
quoteEnd: a
|
|
136
|
-
}), d = a + 1;
|
|
137
|
-
continue;
|
|
138
|
-
}
|
|
139
|
-
let s = d;
|
|
140
|
-
for (; d < c && !x(e[d]);) d += 1;
|
|
141
|
-
u.push({
|
|
142
|
-
name: r,
|
|
143
|
-
nameRange: {
|
|
144
|
-
start: n,
|
|
145
|
-
end: n + r.length
|
|
146
|
-
},
|
|
147
|
-
valueRange: {
|
|
148
|
-
start: s,
|
|
149
|
-
end: d
|
|
150
|
-
},
|
|
151
|
-
unquoted: !0
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
return {
|
|
155
|
-
start: t,
|
|
156
|
-
end: l,
|
|
157
|
-
contentEnd: c,
|
|
158
|
-
name: i,
|
|
159
|
-
nameRange: {
|
|
160
|
-
start: a,
|
|
161
|
-
end: a + i.length
|
|
162
|
-
},
|
|
163
|
-
closing: !1,
|
|
164
|
-
selfClosing: /\/\s*$/.test(e.slice(a + i.length, c)),
|
|
165
|
-
attrs: u
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
function be(e, t, n) {
|
|
169
|
-
if (t.range.end <= n) return null;
|
|
170
|
-
let r = e.lastIndexOf("</", t.range.end - 1);
|
|
171
|
-
if (r < n) return null;
|
|
172
|
-
let i = w(e, r);
|
|
173
|
-
return !i || !i.closing || i.name !== t.name || i.end > t.range.end ? null : i;
|
|
174
|
-
}
|
|
175
|
-
function xe(e, t, n) {
|
|
176
|
-
let r = [];
|
|
177
|
-
for (let i = t; i < n;) {
|
|
178
|
-
if (e[i] === "\\" && e.startsWith("{{", i + 1)) {
|
|
179
|
-
i += 3;
|
|
180
|
-
continue;
|
|
181
|
-
}
|
|
182
|
-
if (!e.startsWith("{{", i)) {
|
|
183
|
-
i += 1;
|
|
184
|
-
continue;
|
|
185
|
-
}
|
|
186
|
-
let t = "", a = i + 2;
|
|
187
|
-
for (; a < n - 1; a += 1) {
|
|
188
|
-
let n = e[a];
|
|
189
|
-
if (t) n === "\\" ? a += 1 : n === t && (t = "");
|
|
190
|
-
else if (n === "\"" || n === "'") t = n;
|
|
191
|
-
else if (n === "}" && e[a + 1] === "}") break;
|
|
192
|
-
}
|
|
193
|
-
if (a >= n - 1) break;
|
|
194
|
-
r.push({
|
|
195
|
-
start: i,
|
|
196
|
-
end: a + 2,
|
|
197
|
-
innerStart: i + 2,
|
|
198
|
-
innerEnd: a
|
|
199
|
-
}), i = a + 2;
|
|
200
|
-
}
|
|
201
|
-
return r;
|
|
202
|
-
}
|
|
203
|
-
function Se(e, t) {
|
|
204
|
-
let n = {
|
|
205
|
-
quot: "\"",
|
|
206
|
-
apos: "'",
|
|
207
|
-
amp: "&",
|
|
208
|
-
lt: "<",
|
|
209
|
-
gt: ">"
|
|
210
|
-
}, r = [t.start], i = "";
|
|
211
|
-
for (let a = t.start; a < t.end;) {
|
|
212
|
-
let o = e[a] === "&" ? /^&(quot|apos|amp|lt|gt);/.exec(e.slice(a, t.end)) : null;
|
|
213
|
-
i += o ? n[o[1]] : e[a], a += o ? o[0].length : 1, r.push(a);
|
|
214
|
-
}
|
|
215
|
-
return {
|
|
216
|
-
text: i,
|
|
217
|
-
offsets: r
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
function Ce(e, t, n) {
|
|
221
|
-
let r = [];
|
|
222
|
-
for (let i = t; i < n;) {
|
|
223
|
-
let t = e[i];
|
|
224
|
-
if (t === "\"" || t === "'") {
|
|
225
|
-
let r = t;
|
|
226
|
-
for (i += 1; i < n;) if (e[i] === "\\") i += 2;
|
|
227
|
-
else {
|
|
228
|
-
if (e[i] === r) {
|
|
229
|
-
i += 1;
|
|
230
|
-
break;
|
|
231
|
-
}
|
|
232
|
-
i += 1;
|
|
233
|
-
}
|
|
234
|
-
} else {
|
|
235
|
-
if (/[0-9]/.test(t) || t === "." && e[i + 1] !== void 0 && /[0-9]/.test(e[i + 1])) {
|
|
236
|
-
let t = /^(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?/.exec(e.slice(i, n));
|
|
237
|
-
if (t) {
|
|
238
|
-
i += t[0].length;
|
|
239
|
-
continue;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
if (b(t)) {
|
|
243
|
-
let t = i;
|
|
244
|
-
for (i += 1; i < n && _e(e[i]);) i += 1;
|
|
245
|
-
let a = e.slice(t, i), o = i;
|
|
246
|
-
for (; o < n && x(e[o]);) o += 1;
|
|
247
|
-
if (e[o] === "(" || a === "true" || a === "false" || a === "null" || a === "pi" || a === "e" || ne.has(a)) continue;
|
|
248
|
-
r.push({
|
|
249
|
-
name: a,
|
|
250
|
-
range: {
|
|
251
|
-
start: t,
|
|
252
|
-
end: i
|
|
253
|
-
}
|
|
254
|
-
});
|
|
255
|
-
} else i += 1;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
return r;
|
|
259
|
-
}
|
|
260
|
-
function we(e, t) {
|
|
261
|
-
return Object.hasOwn(e.props, t) ? t === "bind" || !!e.slots?.some((e) => e.bind === t) : !1;
|
|
262
|
-
}
|
|
263
|
-
function T(e, t = []) {
|
|
264
|
-
for (let n of e) he.has(n.type) && t.push(C(n.range)), n.type !== "fallback" && n.children && T(n.children, t);
|
|
265
|
-
return t;
|
|
266
|
-
}
|
|
267
|
-
function E(e, t) {
|
|
268
|
-
let n = T(t), r = (t) => {
|
|
269
|
-
for (let i of t) {
|
|
270
|
-
if (i.type === "component") {
|
|
271
|
-
let t = w(e, i.range.start);
|
|
272
|
-
t && n.push({
|
|
273
|
-
start: t.start,
|
|
274
|
-
end: t.end
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
i.type !== "fallback" && i.children && r(i.children);
|
|
278
|
-
}
|
|
279
|
-
};
|
|
280
|
-
r(t), n.sort((e, t) => e.start - t.start || t.end - e.end);
|
|
281
|
-
let i = [], a = 0, o = 0;
|
|
282
|
-
for (; a < e.length;) {
|
|
283
|
-
let t = e.indexOf("<!--", a);
|
|
284
|
-
if (t < 0) break;
|
|
285
|
-
for (; o < n.length && n[o].end <= t;) o++;
|
|
286
|
-
let r = n[o];
|
|
287
|
-
if (r && r.start <= t) {
|
|
288
|
-
a = r.end;
|
|
289
|
-
continue;
|
|
290
|
-
}
|
|
291
|
-
let s = e.indexOf("-->", t + 4), c = s < 0 ? e.length : s + 3;
|
|
292
|
-
i.push({
|
|
293
|
-
start: t,
|
|
294
|
-
end: c
|
|
295
|
-
}), a = c;
|
|
296
|
-
}
|
|
297
|
-
return i;
|
|
298
|
-
}
|
|
299
|
-
function D(e, t) {
|
|
300
|
-
let n = [], r = /* @__PURE__ */ new Map(), i = [], a = [], o = (t, n) => {
|
|
301
|
-
for (let r of Ce(e, t, n)) i.push(r);
|
|
302
|
-
}, s = (e, t) => {
|
|
303
|
-
let n = r.get(e);
|
|
304
|
-
n ? n.push(C(t)) : r.set(e, [C(t)]);
|
|
305
|
-
}, l = (t, r) => {
|
|
306
|
-
let a = w(e, t.range.start);
|
|
307
|
-
if (!a || a.closing) return;
|
|
308
|
-
n.push({
|
|
309
|
-
kind: "tag",
|
|
310
|
-
range: C(a.nameRange)
|
|
311
|
-
});
|
|
312
|
-
let o = v(t.name ?? ""), c = a.attrs.some((e) => e.name === "key");
|
|
313
|
-
for (let l of a.attrs) {
|
|
314
|
-
if (n.push({
|
|
315
|
-
kind: "attribute",
|
|
316
|
-
range: C(l.nameRange)
|
|
317
|
-
}), !l.valueRange) continue;
|
|
318
|
-
let a = o?.props[l.name], u = o !== void 0 && we(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 = Se(e, l.valueRange);
|
|
319
|
-
if (t.name === "validation" && l.name === "fields") {
|
|
320
|
-
for (let e of p.text.matchAll(/\S+/g)) {
|
|
321
|
-
if (!S(e[0])) continue;
|
|
322
|
-
let t = {
|
|
323
|
-
start: p.offsets[e.index],
|
|
324
|
-
end: p.offsets[e.index + e[0].length]
|
|
325
|
-
};
|
|
326
|
-
i.push({
|
|
327
|
-
name: e[0],
|
|
328
|
-
range: t
|
|
329
|
-
}), n.push({
|
|
330
|
-
kind: "binding",
|
|
331
|
-
range: t
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
continue;
|
|
335
|
-
}
|
|
336
|
-
let m = a && !a.static ? xe(p.text, 0, p.text.length) : [];
|
|
337
|
-
if (m.length > 0) {
|
|
338
|
-
let e = 0;
|
|
339
|
-
for (let a of m) {
|
|
340
|
-
a.start > e && n.push({
|
|
341
|
-
kind: "string",
|
|
342
|
-
range: {
|
|
343
|
-
start: p.offsets[e],
|
|
344
|
-
end: p.offsets[a.start]
|
|
345
|
-
}
|
|
346
|
-
}), n.push({
|
|
347
|
-
kind: "expression",
|
|
348
|
-
range: {
|
|
349
|
-
start: p.offsets[a.start],
|
|
350
|
-
end: p.offsets[a.end]
|
|
351
|
-
}
|
|
352
|
-
});
|
|
353
|
-
for (let e of Ce(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({
|
|
354
|
-
name: e.name,
|
|
355
|
-
range: {
|
|
356
|
-
start: p.offsets[e.range.start],
|
|
357
|
-
end: p.offsets[e.range.end]
|
|
358
|
-
}
|
|
359
|
-
});
|
|
360
|
-
e = a.end;
|
|
361
|
-
}
|
|
362
|
-
e < p.text.length && n.push({
|
|
363
|
-
kind: "string",
|
|
364
|
-
range: {
|
|
365
|
-
start: p.offsets[e],
|
|
366
|
-
end: l.valueRange.end
|
|
367
|
-
}
|
|
368
|
-
});
|
|
369
|
-
} else (u || d) && S(f) ? (n.push({
|
|
370
|
-
kind: "binding",
|
|
371
|
-
range: C(l.valueRange)
|
|
372
|
-
}), s(f, l.valueRange)) : l.valueRange.end > l.valueRange.start && n.push({
|
|
373
|
-
kind: "string",
|
|
374
|
-
range: C(l.valueRange)
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
let l = be(e, t, a.end);
|
|
378
|
-
l && n.push({
|
|
379
|
-
kind: "tag",
|
|
380
|
-
range: C(l.nameRange)
|
|
381
|
-
});
|
|
382
|
-
}, u = (t, r) => {
|
|
383
|
-
for (let s of t) {
|
|
384
|
-
if (s.type === "component" && s.name) l(s, r);
|
|
385
|
-
else if (s.type === "interpolation") n.push({
|
|
386
|
-
kind: "expression",
|
|
387
|
-
range: C(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") {
|
|
390
|
-
if (n.push({
|
|
391
|
-
kind: "math",
|
|
392
|
-
range: C(s.range)
|
|
393
|
-
}), r === "plot" && s.type === "math") {
|
|
394
|
-
let t = s.range.start + 2;
|
|
395
|
-
try {
|
|
396
|
-
for (let n of c(e.slice(t, s.range.end - 2))) {
|
|
397
|
-
let e = {
|
|
398
|
-
name: n.name,
|
|
399
|
-
range: {
|
|
400
|
-
start: t + n.range.start,
|
|
401
|
-
end: t + n.range.end
|
|
402
|
-
}
|
|
403
|
-
};
|
|
404
|
-
i.push(e), a.push(e);
|
|
405
|
-
}
|
|
406
|
-
} catch {}
|
|
407
|
-
}
|
|
408
|
-
} else s.type === "code" || s.type === "inlineCode" ? n.push({
|
|
409
|
-
kind: "code",
|
|
410
|
-
range: C(s.range)
|
|
411
|
-
}) : s.type === "comment" && n.push({
|
|
412
|
-
kind: "comment",
|
|
413
|
-
range: C(s.range)
|
|
414
|
-
});
|
|
415
|
-
s.type !== "fallback" && s.children && u(s.children, s.name);
|
|
416
|
-
}
|
|
417
|
-
};
|
|
418
|
-
u(t);
|
|
419
|
-
for (let r of E(e, t)) n.push({
|
|
420
|
-
kind: "comment",
|
|
421
|
-
range: r
|
|
422
|
-
});
|
|
423
|
-
n.sort((e, t) => e.range.start - t.range.start || e.range.end - t.range.end);
|
|
424
|
-
let d = [];
|
|
425
|
-
for (let e of n) {
|
|
426
|
-
if (e.range.end <= e.range.start) continue;
|
|
427
|
-
let t = d[d.length - 1];
|
|
428
|
-
t && e.range.start < t.range.end || d.push(e);
|
|
429
|
-
}
|
|
430
|
-
let f = [];
|
|
431
|
-
for (let [e, t] of r) {
|
|
432
|
-
let n = [];
|
|
433
|
-
for (let t of i) t.name === e && (n.some((e) => e.start === t.range.start && e.end === t.range.end) || n.push(C(t.range)));
|
|
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({
|
|
435
|
-
name: e,
|
|
436
|
-
declarations: t,
|
|
437
|
-
references: n
|
|
438
|
-
});
|
|
439
|
-
}
|
|
440
|
-
return f.sort((e, t) => e.declarations[0].start - t.declarations[0].start || e.name.localeCompare(t.name)), {
|
|
441
|
-
tokens: d,
|
|
442
|
-
bindings: f,
|
|
443
|
-
mathReferences: a
|
|
444
|
-
};
|
|
445
|
-
}
|
|
446
|
-
function Te(e) {
|
|
447
|
-
if (typeof e != "string") return {
|
|
448
|
-
tokens: [],
|
|
449
|
-
bindings: [],
|
|
450
|
-
diagnostics: []
|
|
451
|
-
};
|
|
452
|
-
let t = D(e, p(e).nodes);
|
|
453
|
-
return {
|
|
454
|
-
tokens: t.tokens,
|
|
455
|
-
bindings: t.bindings,
|
|
456
|
-
diagnostics: ve(e)
|
|
457
|
-
};
|
|
458
|
-
}
|
|
459
|
-
function O(e, t, n) {
|
|
460
|
-
let r = /^<(\/?)([A-Za-z][A-Za-z0-9_-]*)/.exec(e.slice(t, Math.min(e.length, n + 1)));
|
|
461
|
-
if (!r) return null;
|
|
462
|
-
let i = !!r[1], a = r[2], o = t + r[0].length, s = [], c = !1, l, u = !1;
|
|
463
|
-
if (!i) {
|
|
464
|
-
let t = o;
|
|
465
|
-
for (; t < n;) {
|
|
466
|
-
for (; t < n && x(e[t]);) t += 1;
|
|
467
|
-
if (t >= n) break;
|
|
468
|
-
if (e[t] === "/") {
|
|
469
|
-
u = !0, t += 1;
|
|
470
|
-
continue;
|
|
471
|
-
}
|
|
472
|
-
let r = /^[A-Za-z][A-Za-z0-9_-]*/.exec(e.slice(t, n));
|
|
473
|
-
if (!r) {
|
|
474
|
-
t += 1;
|
|
475
|
-
continue;
|
|
476
|
-
}
|
|
477
|
-
let i = r[0], a = t;
|
|
478
|
-
t += i.length;
|
|
479
|
-
let o = t, d = t;
|
|
480
|
-
for (; d < n && x(e[d]);) d += 1;
|
|
481
|
-
if (e[d] !== "=") {
|
|
482
|
-
s.push({
|
|
483
|
-
name: i,
|
|
484
|
-
nameStart: a,
|
|
485
|
-
nameEnd: o,
|
|
486
|
-
nameRange: {
|
|
487
|
-
start: a,
|
|
488
|
-
end: o
|
|
489
|
-
}
|
|
490
|
-
}), t = o;
|
|
491
|
-
continue;
|
|
492
|
-
}
|
|
493
|
-
for (t = d + 1; t < n && x(e[t]);) t += 1;
|
|
494
|
-
let f = e[t];
|
|
495
|
-
if (f === "\"" || f === "'") {
|
|
496
|
-
let r = t, u = t + 1, d = e.indexOf(f, u);
|
|
497
|
-
if (d < 0 || d >= n) {
|
|
498
|
-
let e = {
|
|
499
|
-
name: i,
|
|
500
|
-
nameStart: a,
|
|
501
|
-
nameEnd: o,
|
|
502
|
-
nameRange: {
|
|
503
|
-
start: a,
|
|
504
|
-
end: o
|
|
505
|
-
},
|
|
506
|
-
valueRange: {
|
|
507
|
-
start: u,
|
|
508
|
-
end: n
|
|
509
|
-
},
|
|
510
|
-
quoteStart: r,
|
|
511
|
-
quoteEnd: d < 0 ? n : d
|
|
512
|
-
};
|
|
513
|
-
s.push(e), l = e, c = !0, t = n;
|
|
514
|
-
break;
|
|
515
|
-
}
|
|
516
|
-
s.push({
|
|
517
|
-
name: i,
|
|
518
|
-
nameStart: a,
|
|
519
|
-
nameEnd: o,
|
|
520
|
-
nameRange: {
|
|
521
|
-
start: a,
|
|
522
|
-
end: o
|
|
523
|
-
},
|
|
524
|
-
valueRange: {
|
|
525
|
-
start: u,
|
|
526
|
-
end: d
|
|
527
|
-
},
|
|
528
|
-
quoteStart: r,
|
|
529
|
-
quoteEnd: d
|
|
530
|
-
}), t = d + 1;
|
|
531
|
-
continue;
|
|
532
|
-
}
|
|
533
|
-
let p = t;
|
|
534
|
-
for (; t < n && !x(e[t]);) t += 1;
|
|
535
|
-
s.push({
|
|
536
|
-
name: i,
|
|
537
|
-
nameStart: a,
|
|
538
|
-
nameEnd: o,
|
|
539
|
-
nameRange: {
|
|
540
|
-
start: a,
|
|
541
|
-
end: o
|
|
542
|
-
},
|
|
543
|
-
valueRange: {
|
|
544
|
-
start: p,
|
|
545
|
-
end: t
|
|
546
|
-
},
|
|
547
|
-
unquoted: !0
|
|
548
|
-
});
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
let d = -1;
|
|
552
|
-
if (!c) {
|
|
553
|
-
let t = n;
|
|
554
|
-
for (; t > o && /[A-Za-z0-9_-]/.test(e[t - 1]);) --t;
|
|
555
|
-
t > o && x(e[t - 1]) && (d = t);
|
|
556
|
-
}
|
|
557
|
-
return {
|
|
558
|
-
name: a,
|
|
559
|
-
closing: i,
|
|
560
|
-
selfClosing: u,
|
|
561
|
-
inValue: c,
|
|
562
|
-
currentAttribute: l,
|
|
563
|
-
attrs: s,
|
|
564
|
-
partialStart: d
|
|
565
|
-
};
|
|
566
|
-
}
|
|
567
|
-
function k(e, t, n) {
|
|
568
|
-
let r = [], i = (e) => {
|
|
569
|
-
for (let t of e) t.type === "component" && r.push(t.range.start), t.type !== "fallback" && t.children && i(t.children);
|
|
570
|
-
};
|
|
571
|
-
i(n), r.sort((e, t) => e - t);
|
|
572
|
-
for (let n = r.length - 1; n >= 0; --n) {
|
|
573
|
-
let i = r[n];
|
|
574
|
-
if (i >= t) continue;
|
|
575
|
-
let a = w(e, i);
|
|
576
|
-
if (a && t <= a.end) return i;
|
|
577
|
-
if (a && a.end < t) break;
|
|
578
|
-
}
|
|
579
|
-
let a = t;
|
|
580
|
-
for (; a > 0;) {
|
|
581
|
-
let n = e.lastIndexOf("<", a - 1);
|
|
582
|
-
if (n < 0) return -1;
|
|
583
|
-
if (e[n - 1] === "\\") {
|
|
584
|
-
a = n;
|
|
585
|
-
continue;
|
|
586
|
-
}
|
|
587
|
-
let r = e[n + 1];
|
|
588
|
-
if (r !== "/" && !b(r)) a = n;
|
|
589
|
-
else if (Ee(e, n, t)) a = n;
|
|
590
|
-
else return n;
|
|
591
|
-
}
|
|
592
|
-
return -1;
|
|
593
|
-
}
|
|
594
|
-
function Ee(e, t, n) {
|
|
595
|
-
let r = "";
|
|
596
|
-
for (let i = t; i < n; i += 1) {
|
|
597
|
-
let t = e[i];
|
|
598
|
-
if (r) t === r && (r = "");
|
|
599
|
-
else if (t === "\"" || t === "'") r = t;
|
|
600
|
-
else if (t === ">") return !0;
|
|
601
|
-
}
|
|
602
|
-
return !1;
|
|
603
|
-
}
|
|
604
|
-
function De(e, t) {
|
|
605
|
-
let n = t;
|
|
606
|
-
for (; n > 0;) {
|
|
607
|
-
let r = e.lastIndexOf("{{", n - 1);
|
|
608
|
-
if (r < 0) return null;
|
|
609
|
-
if (e[r - 1] === "\\") {
|
|
610
|
-
n = r;
|
|
611
|
-
continue;
|
|
612
|
-
}
|
|
613
|
-
let i = "", a = r + 2, o = -1;
|
|
614
|
-
for (; a < e.length - 1; a += 1) {
|
|
615
|
-
let t = e[a];
|
|
616
|
-
if (i) t === "\\" ? a += 1 : t === i && (i = "");
|
|
617
|
-
else if (t === "\"" || t === "'") i = t;
|
|
618
|
-
else if (t === "}" && e[a + 1] === "}") {
|
|
619
|
-
o = a;
|
|
620
|
-
break;
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
if (o >= 0 && o + 2 <= t) n = r;
|
|
624
|
-
else return {
|
|
625
|
-
start: r,
|
|
626
|
-
end: o < 0 ? e.length : o + 2,
|
|
627
|
-
innerStart: r + 2,
|
|
628
|
-
innerEnd: o < 0 ? e.length : o
|
|
629
|
-
};
|
|
630
|
-
}
|
|
631
|
-
return null;
|
|
632
|
-
}
|
|
633
|
-
function Oe(e, t, n) {
|
|
634
|
-
let r = "";
|
|
635
|
-
for (let i = t; i < n; i += 1) {
|
|
636
|
-
let t = e[i];
|
|
637
|
-
r ? t === "\\" ? i += 1 : t === r && (r = "") : (t === "\"" || t === "'") && (r = t);
|
|
638
|
-
}
|
|
639
|
-
return r !== "";
|
|
640
|
-
}
|
|
641
|
-
function ke(e, t) {
|
|
642
|
-
let n = 0, r = e.length - 1;
|
|
643
|
-
for (; n <= r;) {
|
|
644
|
-
let i = n + r >> 1, a = e[i];
|
|
645
|
-
if (t < a.start) r = i - 1;
|
|
646
|
-
else if (t >= a.end) n = i + 1;
|
|
647
|
-
else return !0;
|
|
648
|
-
}
|
|
649
|
-
return !1;
|
|
650
|
-
}
|
|
651
|
-
function A(e, t, n, r) {
|
|
652
|
-
let i = e.slice(t, n), a = i && r.startsWith(i) ? r.slice(i.length) : "";
|
|
653
|
-
return {
|
|
654
|
-
start: t,
|
|
655
|
-
end: a && e.startsWith(a, n) ? n + a.length : n
|
|
656
|
-
};
|
|
657
|
-
}
|
|
658
|
-
function Ae(e, t, n, r) {
|
|
659
|
-
if (Oe(e, n.innerStart, t)) return [];
|
|
660
|
-
let i = t;
|
|
661
|
-
for (; i > n.innerStart && _e(e[i - 1]);) --i;
|
|
662
|
-
if (e[i - 1] === ".") return [];
|
|
663
|
-
let a = e.slice(i, t);
|
|
664
|
-
return a && !b(a[0]) ? [] : r.filter((e) => e.name.startsWith(a)).map((n) => ({
|
|
665
|
-
label: n.name,
|
|
666
|
-
insertText: n.name,
|
|
667
|
-
range: A(e, i, t, n.name),
|
|
668
|
-
kind: "binding",
|
|
669
|
-
detail: `${n.declarations.length} declaration${n.declarations.length === 1 ? "" : "s"}, ${n.references.length} reference${n.references.length === 1 ? "" : "s"}`
|
|
670
|
-
}));
|
|
671
|
-
}
|
|
672
|
-
function je(e, t, n) {
|
|
673
|
-
let r = n.currentAttribute;
|
|
674
|
-
if (!r) return [];
|
|
675
|
-
let i = v(n.name)?.props[r.name];
|
|
676
|
-
if (!i || i.kind !== "enum" || !i.values) return [];
|
|
677
|
-
let a = r.valueRange?.start ?? t, o = e.slice(a, t);
|
|
678
|
-
return i.values.filter((e) => e.startsWith(o)).map((n) => ({
|
|
679
|
-
label: n,
|
|
680
|
-
insertText: n,
|
|
681
|
-
range: A(e, a, t, n),
|
|
682
|
-
kind: "value",
|
|
683
|
-
detail: `${r.name} value`
|
|
684
|
-
}));
|
|
685
|
-
}
|
|
686
|
-
function Me(e, t, n) {
|
|
687
|
-
if (n.closing || n.inValue || n.partialStart < 0) return [];
|
|
688
|
-
let r = v(n.name);
|
|
689
|
-
if (!r) return [];
|
|
690
|
-
let i = e.slice(n.partialStart, t);
|
|
691
|
-
if (i && !/^[A-Za-z0-9_-]*$/.test(i)) return [];
|
|
692
|
-
let a = new Set(n.attrs.filter((e) => e.nameEnd < n.partialStart).map((e) => e.name));
|
|
693
|
-
return Object.entries(r.props).filter(([e]) => !a.has(e) && e.startsWith(i)).map(([r, i]) => ({
|
|
694
|
-
label: r,
|
|
695
|
-
insertText: r,
|
|
696
|
-
range: A(e, n.partialStart, t, r),
|
|
697
|
-
kind: "attribute",
|
|
698
|
-
detail: i.required ? `${i.kind}, required` : i.kind
|
|
699
|
-
}));
|
|
700
|
-
}
|
|
701
|
-
function Ne(e, t) {
|
|
702
|
-
let n = Math.max(0, t - 256), r = e.slice(n, t), i = /<\/?([A-Za-z][A-Za-z0-9-]*)?$/.exec(r);
|
|
703
|
-
if (!i) return [];
|
|
704
|
-
let a = n + i.index;
|
|
705
|
-
if (e[a] !== "<" || e[a - 1] === "\\") return [];
|
|
706
|
-
let o = e[a + 1] === "/", s = a + (o ? 2 : 1);
|
|
707
|
-
if (s > t) return [];
|
|
708
|
-
let c = i[1] ?? "";
|
|
709
|
-
return ee.filter((e) => e.startsWith(c)).map((n) => ({
|
|
710
|
-
label: n,
|
|
711
|
-
insertText: n,
|
|
712
|
-
range: A(e, s, t, n),
|
|
713
|
-
kind: "tag",
|
|
714
|
-
detail: o ? "closing tag" : "component"
|
|
715
|
-
}));
|
|
716
|
-
}
|
|
717
|
-
function Pe(e, t) {
|
|
718
|
-
if (typeof e != "string" || !Number.isFinite(t)) return [];
|
|
719
|
-
let n = Math.max(0, Math.min(e.length, Math.floor(t))), r = p(e), i = [...T(r.nodes), ...E(e, r.nodes)].sort((e, t) => e.start - t.start);
|
|
720
|
-
if (ke(i, n) || n === e.length && i.some((e) => e.end === n && e.start < n)) return [];
|
|
721
|
-
let a = D(e, r.nodes), o = De(e, n);
|
|
722
|
-
if (o) {
|
|
723
|
-
let t = k(e, n, r.nodes);
|
|
724
|
-
if (t >= 0) {
|
|
725
|
-
let r = O(e, t, n);
|
|
726
|
-
if (r?.inValue && r.currentAttribute && v(r.name)?.props[r.currentAttribute.name]?.static) return [];
|
|
727
|
-
}
|
|
728
|
-
return Ae(e, n, o, a.bindings);
|
|
729
|
-
}
|
|
730
|
-
let s = k(e, n, r.nodes);
|
|
731
|
-
if (s >= 0) {
|
|
732
|
-
let t = O(e, s, n);
|
|
733
|
-
if (t?.inValue) return je(e, n, t);
|
|
734
|
-
}
|
|
735
|
-
let c = Ne(e, n);
|
|
736
|
-
if (c.length > 0) return c;
|
|
737
|
-
if (s >= 0) {
|
|
738
|
-
let t = O(e, s, n);
|
|
739
|
-
if (t) return Me(e, n, t);
|
|
740
|
-
}
|
|
741
|
-
return [];
|
|
742
|
-
}
|
|
743
|
-
function Fe(e, t) {
|
|
744
|
-
let n = "", r = 0;
|
|
745
|
-
for (let i of t) n += e.slice(r, i.range.start) + i.text, r = i.range.end;
|
|
746
|
-
return n + e.slice(r);
|
|
747
|
-
}
|
|
748
|
-
function Ie(e, t, n) {
|
|
749
|
-
if (typeof e != "string" || typeof t != "string" || typeof n != "string") throw Error("Rename requires string arguments.");
|
|
750
|
-
if (!S(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 = D(e, p(e).nodes), i = r.bindings.find((e) => e.name === t);
|
|
752
|
-
if (!i || i.declarations.length === 0) throw Error(`Binding "${t}" is not declared in this document.`);
|
|
753
|
-
if (t === n) return {
|
|
754
|
-
source: e,
|
|
755
|
-
edits: []
|
|
756
|
-
};
|
|
757
|
-
if (r.bindings.some((e) => e.name === n)) throw Error(`Binding "${n}" already exists.`);
|
|
758
|
-
if (ve(e).some((e) => e.severity === "error" && ge.has(e.code))) throw Error("The document cannot be renamed safely while parse errors remain.");
|
|
759
|
-
let a = /* @__PURE__ */ new Set(), o = [];
|
|
760
|
-
for (let e of [...i.declarations, ...i.references]) {
|
|
761
|
-
let t = `${e.start}:${e.end}`;
|
|
762
|
-
a.has(t) || (a.add(t), o.push(C(e)));
|
|
763
|
-
}
|
|
764
|
-
o.sort((e, t) => e.start - t.start || e.end - t.end);
|
|
765
|
-
let s = new Set(r.mathReferences.filter((e) => e.name === t).map((e) => `${e.range.start}:${e.range.end}`)), c = o.map((e) => ({
|
|
766
|
-
range: C(e),
|
|
767
|
-
text: s.has(`${e.start}:${e.end}`) ? `\\mathrm{${n}}` : n
|
|
768
|
-
})), l = Fe(e, c);
|
|
769
|
-
if (y(e).ok && !y(l).ok) throw Error("Rename could not preserve all binding references; the source was left unchanged.");
|
|
770
|
-
return {
|
|
771
|
-
source: l,
|
|
772
|
-
edits: c
|
|
773
|
-
};
|
|
774
|
-
}
|
|
775
|
-
function Le(e, t) {
|
|
776
|
-
let n = e.slice(t.nameRange.start, t.nameRange.end), r = t.attrs.map((t) => {
|
|
777
|
-
let n = e.slice(t.nameRange.start, t.nameRange.end);
|
|
778
|
-
return t.valueRange === void 0 ? n : t.quoteStart !== void 0 && t.quoteEnd !== void 0 ? `${n}=${e.slice(t.quoteStart, t.quoteEnd + 1)}` : n;
|
|
779
|
-
}), i = r.length > 0 ? `<${n} ${r.join(" ")}` : `<${n}`;
|
|
780
|
-
return t.selfClosing ? `${i} />` : `${i}>`;
|
|
781
|
-
}
|
|
782
|
-
function Re(e) {
|
|
783
|
-
if (typeof e != "string") return e;
|
|
784
|
-
let t;
|
|
785
|
-
try {
|
|
786
|
-
t = y(e);
|
|
787
|
-
} catch {
|
|
788
|
-
return e;
|
|
789
|
-
}
|
|
790
|
-
if (t.diagnostics.some((e) => e.severity === "error")) return e;
|
|
791
|
-
let n = p(e), r = [], i = (t) => {
|
|
792
|
-
for (let n of t) {
|
|
793
|
-
if (n.type === "component" && n.name) {
|
|
794
|
-
let t = w(e, n.range.start);
|
|
795
|
-
if (t && !t.closing && !/[\r\n]/.test(e.slice(t.start, t.end))) {
|
|
796
|
-
let n = Le(e, t);
|
|
797
|
-
n !== e.slice(t.start, t.end) && r.push({
|
|
798
|
-
start: t.start,
|
|
799
|
-
end: t.end,
|
|
800
|
-
text: n
|
|
801
|
-
});
|
|
802
|
-
}
|
|
803
|
-
if (t) {
|
|
804
|
-
let i = be(e, n, t.end);
|
|
805
|
-
if (i && !/[\r\n]/.test(e.slice(i.start, i.end))) {
|
|
806
|
-
let t = `</${e.slice(i.nameRange.start, i.nameRange.end)}>`;
|
|
807
|
-
t !== e.slice(i.start, i.end) && r.push({
|
|
808
|
-
start: i.start,
|
|
809
|
-
end: i.end,
|
|
810
|
-
text: t
|
|
811
|
-
});
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
n.type !== "fallback" && n.children && i(n.children);
|
|
816
|
-
}
|
|
817
|
-
};
|
|
818
|
-
i(n.nodes), r.sort((e, t) => e.start - t.start || e.end - t.end);
|
|
819
|
-
let a = "", o = 0;
|
|
820
|
-
for (let t of r) t.start < o || (a += e.slice(o, t.start) + t.text, o = t.end);
|
|
821
|
-
return a + e.slice(o);
|
|
822
|
-
}
|
|
1
|
+
import { F as e, J as t, K as n, M as r, N as i, P as a, Y as o, Z as s, _ as c, at as l, b as u, ct as d, d as f, f as p, ft as m, it as h, lt as g, m as _, n as ee, nt as v, ot as y, p as b, r as te, rt as ne, st as re, t as x, v as ie, y as ae } from "./compiler-CRD88BMt.js";
|
|
2
|
+
import { i as oe, n as se, r as ce, t as le } from "./authoring-DSC0VsNK.js";
|
|
3
|
+
import { t as ue } from "./runtime-D8KbnCd0.js";
|
|
823
4
|
// src/local/source-migration.ts
|
|
824
|
-
var
|
|
5
|
+
var de = /* @__PURE__ */ new Set([
|
|
825
6
|
"sum",
|
|
826
7
|
"average",
|
|
827
8
|
"minOf",
|
|
@@ -839,7 +20,7 @@ var j = /* @__PURE__ */ new Set([
|
|
|
839
20
|
"slice",
|
|
840
21
|
"dateCompare",
|
|
841
22
|
"dateDiff"
|
|
842
|
-
]),
|
|
23
|
+
]), fe = /* @__PURE__ */ new Set([
|
|
843
24
|
"jump",
|
|
844
25
|
"anchor",
|
|
845
26
|
"text",
|
|
@@ -855,8 +36,8 @@ var j = /* @__PURE__ */ new Set([
|
|
|
855
36
|
"validation",
|
|
856
37
|
"data-table",
|
|
857
38
|
"column"
|
|
858
|
-
]),
|
|
859
|
-
function
|
|
39
|
+
]), pe = `<!-- reactive-md: ${r} -->`;
|
|
40
|
+
function me(e) {
|
|
860
41
|
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;
|
|
861
42
|
return {
|
|
862
43
|
declaredVersion: n,
|
|
@@ -866,59 +47,59 @@ function N(e) {
|
|
|
866
47
|
diagnostics: t
|
|
867
48
|
};
|
|
868
49
|
}
|
|
869
|
-
function
|
|
870
|
-
return
|
|
50
|
+
function he(e) {
|
|
51
|
+
return me(f(e));
|
|
871
52
|
}
|
|
872
|
-
function
|
|
873
|
-
let
|
|
53
|
+
function ge(e, t, n, r, i = "error") {
|
|
54
|
+
let a = re(t, r), o = e.slice(0, n.start), s = o.lastIndexOf("\n");
|
|
874
55
|
return {
|
|
875
56
|
code: t,
|
|
876
|
-
severity:
|
|
57
|
+
severity: i,
|
|
877
58
|
range: { ...n },
|
|
878
|
-
message:
|
|
879
|
-
line:
|
|
880
|
-
column: n.start -
|
|
881
|
-
messageKey:
|
|
882
|
-
...
|
|
59
|
+
message: h(a),
|
|
60
|
+
line: o.split("\n").length,
|
|
61
|
+
column: n.start - s,
|
|
62
|
+
messageKey: a.key,
|
|
63
|
+
...a.params ? { params: a.params } : {}
|
|
883
64
|
};
|
|
884
65
|
}
|
|
885
|
-
function
|
|
886
|
-
let n =
|
|
66
|
+
function S(e, t = {}) {
|
|
67
|
+
let n = f(e), i = me(n), a = typeof t == "object" && !!t && !Array.isArray(t), o = a ? t.fromVersion ?? i.effectiveVersion : i.effectiveVersion, s = typeof o == "string" ? o : "", c = {
|
|
887
68
|
ok: !1,
|
|
888
|
-
fromVersion:
|
|
889
|
-
toVersion:
|
|
890
|
-
needsMigration: !n.versionDeclaration ||
|
|
891
|
-
diagnostics:
|
|
892
|
-
},
|
|
893
|
-
report:
|
|
69
|
+
fromVersion: s,
|
|
70
|
+
toVersion: r,
|
|
71
|
+
needsMigration: !n.versionDeclaration || s !== "local-draft-2",
|
|
72
|
+
diagnostics: i.diagnostics.filter((e) => e.code !== "local.version.unsupported")
|
|
73
|
+
}, l = {
|
|
74
|
+
report: c,
|
|
894
75
|
declaration: n.versionDeclaration
|
|
895
76
|
};
|
|
896
|
-
if (typeof e != "string" ||
|
|
897
|
-
let
|
|
77
|
+
if (typeof e != "string" || c.diagnostics.some((e) => e.severity === "error")) return l;
|
|
78
|
+
let u = i.range ?? {
|
|
898
79
|
start: 0,
|
|
899
80
|
end: 0
|
|
900
|
-
},
|
|
901
|
-
if (
|
|
81
|
+
}, d = (e) => {
|
|
82
|
+
if (c.diagnostics.length >= 100) {
|
|
902
83
|
if (e.severity === "warning") return;
|
|
903
|
-
let t =
|
|
904
|
-
for (; t >= 0 &&
|
|
84
|
+
let t = c.diagnostics.length - 1;
|
|
85
|
+
for (; t >= 0 && c.diagnostics[t].severity !== "warning";) --t;
|
|
905
86
|
if (t < 0) return;
|
|
906
|
-
|
|
87
|
+
c.diagnostics.splice(t, 1);
|
|
907
88
|
}
|
|
908
|
-
|
|
909
|
-
},
|
|
910
|
-
|
|
89
|
+
c.diagnostics.push(e);
|
|
90
|
+
}, p = (t, n, r, i) => {
|
|
91
|
+
d(ge(e, t, n, r, i));
|
|
911
92
|
};
|
|
912
|
-
if (!
|
|
913
|
-
from:
|
|
93
|
+
if (!a || typeof o != "string" || !["local-draft-1", "local-draft-2"].includes(s) || t.allowSemanticChanges !== void 0 && typeof t.allowSemanticChanges != "boolean" || t.fromVersion !== void 0 && i.declaredVersion !== null && s !== i.declaredVersion) return p("local.upgrade.from-version", u, {
|
|
94
|
+
from: s,
|
|
914
95
|
detail: "use local-draft-1 or local-draft-2 and match the source declaration"
|
|
915
|
-
}),
|
|
916
|
-
let m = n.versionDeclaration ? e.slice(0,
|
|
917
|
-
if (
|
|
96
|
+
}), l;
|
|
97
|
+
let m = n.versionDeclaration ? e.slice(0, u.start) + e.slice(u.start, u.end).replace(/[^\r\n]/g, " ") + e.slice(u.end) : e, h = n.versionDeclaration ? f(m) : n;
|
|
98
|
+
if (s === "local-draft-1") {
|
|
918
99
|
let e = (n) => {
|
|
919
100
|
for (let r of n) {
|
|
920
|
-
if (r.name &&
|
|
921
|
-
|
|
101
|
+
if (r.name && fe.has(r.name)) {
|
|
102
|
+
p("local.upgrade.tag", r.range, { name: r.name });
|
|
922
103
|
continue;
|
|
923
104
|
}
|
|
924
105
|
for (let e of [
|
|
@@ -929,32 +110,32 @@ function P(e, t = {}) {
|
|
|
929
110
|
"bind-y"
|
|
930
111
|
]) {
|
|
931
112
|
let t = r.attrs?.[e];
|
|
932
|
-
t &&
|
|
113
|
+
t && de.has(t) && p("local.upgrade.reserved-binding", r.range, { name: t });
|
|
933
114
|
}
|
|
934
|
-
(r.name === "input" || r.name === "textarea") && (r.attrs?.["max-length"] !== void 0 || Number(r.attrs?.["min-length"] ?? 0) > 0) &&
|
|
115
|
+
(r.name === "input" || r.name === "textarea") && (r.attrs?.["max-length"] !== void 0 || Number(r.attrs?.["min-length"] ?? 0) > 0) && p("local.upgrade.text-length", r.range, void 0, t.allowSemanticChanges ? "warning" : "error");
|
|
935
116
|
let n = [...r.type === "interpolation" ? [r.value ?? ""] : [], ...Object.values(r.attrs ?? {}).flatMap((e) => [...e.matchAll(/\{\{([\s\S]*?)\}\}/g)].map((e) => e[1]))];
|
|
936
117
|
for (let e of n) {
|
|
937
118
|
let t = e.replace(/'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"/g, "");
|
|
938
|
-
(t.includes("[") || [...
|
|
119
|
+
(t.includes("[") || [...de].some((e) => RegExp(`\\b${e}\\s*\\(`).test(t))) && p("local.upgrade.expression", r.range);
|
|
939
120
|
}
|
|
940
121
|
r.type !== "fallback" && r.children && e(r.children);
|
|
941
122
|
}
|
|
942
123
|
};
|
|
943
124
|
e(h.nodes);
|
|
944
125
|
}
|
|
945
|
-
if (
|
|
946
|
-
let g =
|
|
947
|
-
for (let e of g.diagnostics)
|
|
948
|
-
return g.ok && (!n.versionDeclaration &&
|
|
126
|
+
if (c.diagnostics.some((e) => e.severity === "error")) return l;
|
|
127
|
+
let g = x(m);
|
|
128
|
+
for (let e of g.diagnostics) d(e);
|
|
129
|
+
return g.ok && (!n.versionDeclaration && c.diagnostics.length < 100 && p("local.upgrade.version-missing", {
|
|
949
130
|
start: +(e.charCodeAt(0) === 65279),
|
|
950
131
|
end: +(e.charCodeAt(0) === 65279)
|
|
951
|
-
}, { version:
|
|
132
|
+
}, { version: r }, "warning"), c.ok = !0), l;
|
|
952
133
|
}
|
|
953
|
-
function
|
|
954
|
-
return
|
|
134
|
+
function _e(e, t) {
|
|
135
|
+
return S(e, t).report;
|
|
955
136
|
}
|
|
956
|
-
function
|
|
957
|
-
let { report: n, declaration: r } =
|
|
137
|
+
function ve(e, t) {
|
|
138
|
+
let { report: n, declaration: r } = S(e, t), i = {
|
|
958
139
|
...n,
|
|
959
140
|
source: e,
|
|
960
141
|
changed: !1,
|
|
@@ -964,7 +145,7 @@ function Ue(e, t) {
|
|
|
964
145
|
let a = +(e.charCodeAt(0) === 65279), o = r?.range ?? {
|
|
965
146
|
start: a,
|
|
966
147
|
end: a
|
|
967
|
-
}, s = e.includes("\r\n") ? "\r\n" : "\n", c = r ?
|
|
148
|
+
}, s = e.includes("\r\n") ? "\r\n" : "\n", c = r ? pe : `${pe}${s}${s}`, l = e.slice(0, o.start) + c + e.slice(o.end);
|
|
968
149
|
return {
|
|
969
150
|
...n,
|
|
970
151
|
source: l,
|
|
@@ -976,17 +157,17 @@ function Ue(e, t) {
|
|
|
976
157
|
};
|
|
977
158
|
}
|
|
978
159
|
// src/local/state.ts
|
|
979
|
-
var
|
|
160
|
+
var C = "reactive-md-state/v1", w = 1048576, ye = /^fnv1a32:[0-9a-f]{8}$/, be = 2166136261, xe = 16777619, Se = /* @__PURE__ */ new Set([
|
|
980
161
|
"format",
|
|
981
162
|
"syntax",
|
|
982
163
|
"sourceDigest",
|
|
983
164
|
"parameters",
|
|
984
165
|
"generator"
|
|
985
|
-
]),
|
|
986
|
-
function
|
|
166
|
+
]), Ce = /* @__PURE__ */ new Set(["name", "version"]), T = new TextEncoder();
|
|
167
|
+
function E(e, t) {
|
|
987
168
|
return {
|
|
988
169
|
code: e,
|
|
989
|
-
message: t.length > 2e3 ? `${t.slice(0,
|
|
170
|
+
message: t.length > 2e3 ? `${t.slice(0, m - 1)}…` : t,
|
|
990
171
|
severity: "error",
|
|
991
172
|
range: {
|
|
992
173
|
start: 0,
|
|
@@ -996,13 +177,13 @@ function I(e, t) {
|
|
|
996
177
|
column: 1
|
|
997
178
|
};
|
|
998
179
|
}
|
|
999
|
-
function
|
|
1000
|
-
e.length < 100 && e.push(
|
|
180
|
+
function D(e, t, n) {
|
|
181
|
+
e.length < 100 && e.push(E(t, n));
|
|
1001
182
|
}
|
|
1002
|
-
function
|
|
183
|
+
function O(e) {
|
|
1003
184
|
return e instanceof Error ? e.message : String(e);
|
|
1004
185
|
}
|
|
1005
|
-
function
|
|
186
|
+
function k(e) {
|
|
1006
187
|
for (let t = 0; t < e.length; t += 1) {
|
|
1007
188
|
let n = e.charCodeAt(t);
|
|
1008
189
|
if (n >= 55296 && n <= 56319) {
|
|
@@ -1017,14 +198,14 @@ function z(e) {
|
|
|
1017
198
|
}
|
|
1018
199
|
return !0;
|
|
1019
200
|
}
|
|
1020
|
-
function
|
|
201
|
+
function A(e) {
|
|
1021
202
|
if (typeof e != "string") throw TypeError("localSourceDigest requires a source string.");
|
|
1022
|
-
let t =
|
|
1023
|
-
for (let e = 0; e < t.length; e += 1) n ^= t[e], n = Math.imul(n,
|
|
203
|
+
let t = T.encode(e), n = be;
|
|
204
|
+
for (let e = 0; e < t.length; e += 1) n ^= t[e], n = Math.imul(n, xe) >>> 0;
|
|
1024
205
|
return `fnv1a32:${n.toString(16).padStart(8, "0")}`;
|
|
1025
206
|
}
|
|
1026
|
-
function
|
|
1027
|
-
if (typeof e == "string") return
|
|
207
|
+
function j(e) {
|
|
208
|
+
if (typeof e == "string") return k(e) ? {
|
|
1028
209
|
ok: !0,
|
|
1029
210
|
value: e
|
|
1030
211
|
} : {
|
|
@@ -1050,7 +231,7 @@ function V(e) {
|
|
|
1050
231
|
ok: !1,
|
|
1051
232
|
message: "must be an array of strings."
|
|
1052
233
|
};
|
|
1053
|
-
if (!
|
|
234
|
+
if (!k(r)) return {
|
|
1054
235
|
ok: !1,
|
|
1055
236
|
message: "contains malformed Unicode."
|
|
1056
237
|
};
|
|
@@ -1066,30 +247,30 @@ function V(e) {
|
|
|
1066
247
|
message: "must be a string, finite number, boolean, null or string array."
|
|
1067
248
|
};
|
|
1068
249
|
}
|
|
1069
|
-
function
|
|
250
|
+
function M(e) {
|
|
1070
251
|
if (typeof e != "object" || !e || Array.isArray(e)) return !1;
|
|
1071
252
|
let t = Object.getPrototypeOf(e);
|
|
1072
253
|
return t === Object.prototype || t === null;
|
|
1073
254
|
}
|
|
1074
|
-
function
|
|
255
|
+
function N(e) {
|
|
1075
256
|
return Object.freeze(e.parameters), e.generator && Object.freeze(e.generator), Object.freeze(e);
|
|
1076
257
|
}
|
|
1077
|
-
function
|
|
258
|
+
function P(e) {
|
|
1078
259
|
if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("generator must be an object with string name and version.");
|
|
1079
260
|
if (typeof e.name != "string" || typeof e.version != "string") throw TypeError("generator must have string name and version.");
|
|
1080
|
-
if (!
|
|
261
|
+
if (!k(e.name) || !k(e.version)) throw TypeError("generator name and version must be well-formed Unicode strings.");
|
|
1081
262
|
return Object.freeze({
|
|
1082
263
|
name: e.name,
|
|
1083
264
|
version: e.version
|
|
1084
265
|
});
|
|
1085
266
|
}
|
|
1086
|
-
function
|
|
267
|
+
function F(e) {
|
|
1087
268
|
return typeof e == "string" ? `"${e.length > 48 ? `${e.slice(0, 48)}…` : e}"` : e === null ? "null" : Array.isArray(e) ? "an array" : typeof e;
|
|
1088
269
|
}
|
|
1089
|
-
function
|
|
1090
|
-
return e.length > t ? e.length :
|
|
270
|
+
function I(e, t) {
|
|
271
|
+
return e.length > t ? e.length : T.encode(e).byteLength;
|
|
1091
272
|
}
|
|
1092
|
-
function
|
|
273
|
+
function we(e, t) {
|
|
1093
274
|
let n;
|
|
1094
275
|
try {
|
|
1095
276
|
let t = JSON.stringify(e);
|
|
@@ -1098,107 +279,107 @@ function tt(e, t) {
|
|
|
1098
279
|
} catch {
|
|
1099
280
|
return null;
|
|
1100
281
|
}
|
|
1101
|
-
return
|
|
282
|
+
return I(n, t);
|
|
1102
283
|
}
|
|
1103
|
-
function
|
|
1104
|
-
if (e === void 0) return
|
|
284
|
+
function Te(e) {
|
|
285
|
+
if (e === void 0) return w;
|
|
1105
286
|
if (typeof e != "object" || !e) throw TypeError("parseLocalState options must be an object.");
|
|
1106
287
|
let { maxLength: t } = e;
|
|
1107
|
-
if (t === void 0) return
|
|
288
|
+
if (t === void 0) return w;
|
|
1108
289
|
if (typeof t != "number" || !Number.isSafeInteger(t) || t <= 0) throw RangeError("maxLength must be a finite positive integer.");
|
|
1109
290
|
return t;
|
|
1110
291
|
}
|
|
1111
|
-
function
|
|
292
|
+
function L(e, t, n) {
|
|
1112
293
|
if (!e || e.syntax !== "local" || typeof e.source != "string") throw TypeError("createLocalStateFile requires a compiled local document.");
|
|
1113
294
|
if (!t || typeof t != "object" || Array.isArray(t)) throw TypeError("createLocalStateFile requires a state object.");
|
|
1114
|
-
let
|
|
295
|
+
let i = Object.keys(e.bindings).filter((e) => !e.startsWith("@")).sort(), a = new Set(i), o = /* @__PURE__ */ new Map();
|
|
1115
296
|
for (let n of Object.keys(t)) {
|
|
1116
297
|
if (Object.hasOwn(e.computations ?? {}, n)) continue;
|
|
1117
298
|
if (n.startsWith("@")) {
|
|
1118
299
|
if (!Object.hasOwn(e.bindings, n)) throw Error(`Cannot persist parameter "${n}": it is not a binding of this document.`);
|
|
1119
300
|
continue;
|
|
1120
301
|
}
|
|
1121
|
-
if (!
|
|
1122
|
-
let r =
|
|
302
|
+
if (!a.has(n)) throw Error(`Cannot persist parameter "${n}": it is not a public binding of this document.`);
|
|
303
|
+
let r = j(t[n]);
|
|
1123
304
|
if (!r.ok) throw TypeError(`Cannot persist parameter "${n}": the value ${r.message}`);
|
|
1124
|
-
|
|
1125
|
-
}
|
|
1126
|
-
let
|
|
1127
|
-
for (let e of
|
|
1128
|
-
if (!
|
|
1129
|
-
|
|
1130
|
-
}
|
|
1131
|
-
let
|
|
1132
|
-
format:
|
|
1133
|
-
syntax:
|
|
1134
|
-
sourceDigest:
|
|
1135
|
-
parameters:
|
|
305
|
+
o.set(n, r.value);
|
|
306
|
+
}
|
|
307
|
+
let s = {};
|
|
308
|
+
for (let e of i) {
|
|
309
|
+
if (!o.has(e)) throw Error(`Cannot persist the document: parameter "${e}" is missing from the supplied state.`);
|
|
310
|
+
s[e] = o.get(e);
|
|
311
|
+
}
|
|
312
|
+
let c = {
|
|
313
|
+
format: C,
|
|
314
|
+
syntax: r,
|
|
315
|
+
sourceDigest: A(e.source),
|
|
316
|
+
parameters: s
|
|
1136
317
|
};
|
|
1137
|
-
return n !== void 0 && (
|
|
318
|
+
return n !== void 0 && (c.generator = P(n)), N(c);
|
|
1138
319
|
}
|
|
1139
|
-
function
|
|
1140
|
-
let n = [],
|
|
320
|
+
function Ee(e, t) {
|
|
321
|
+
let n = [], i = (e, t) => D(n, e, t), a = e;
|
|
1141
322
|
if (typeof e == "string") {
|
|
1142
|
-
if (
|
|
323
|
+
if (I(e, t) > t) return {
|
|
1143
324
|
ok: !1,
|
|
1144
|
-
diagnostics: [
|
|
325
|
+
diagnostics: [E("local.state.size", `The state payload exceeds the ${t}-byte limit.`)]
|
|
1145
326
|
};
|
|
1146
|
-
if (!
|
|
327
|
+
if (!k(e)) return {
|
|
1147
328
|
ok: !1,
|
|
1148
|
-
diagnostics: [
|
|
329
|
+
diagnostics: [E("local.state.utf", "The state payload contains malformed Unicode.")]
|
|
1149
330
|
};
|
|
1150
331
|
try {
|
|
1151
|
-
|
|
332
|
+
a = JSON.parse(e);
|
|
1152
333
|
} catch (e) {
|
|
1153
334
|
return {
|
|
1154
335
|
ok: !1,
|
|
1155
|
-
diagnostics: [
|
|
336
|
+
diagnostics: [E("local.state.json", `The state payload is not valid JSON: ${O(e)}`)]
|
|
1156
337
|
};
|
|
1157
338
|
}
|
|
1158
339
|
} else {
|
|
1159
|
-
let n =
|
|
340
|
+
let n = we(e, t);
|
|
1160
341
|
if (n === null) return {
|
|
1161
342
|
ok: !1,
|
|
1162
|
-
diagnostics: [
|
|
343
|
+
diagnostics: [E("local.state.shape", "The state payload must be a JSON object.")]
|
|
1163
344
|
};
|
|
1164
345
|
if (n > t) return {
|
|
1165
346
|
ok: !1,
|
|
1166
|
-
diagnostics: [
|
|
347
|
+
diagnostics: [E("local.state.size", `The state payload exceeds the ${t}-byte limit.`)]
|
|
1167
348
|
};
|
|
1168
349
|
}
|
|
1169
|
-
if (!
|
|
350
|
+
if (!M(a)) return {
|
|
1170
351
|
ok: !1,
|
|
1171
|
-
diagnostics: [
|
|
352
|
+
diagnostics: [E("local.state.shape", "The state payload must be a JSON object.")]
|
|
1172
353
|
};
|
|
1173
|
-
Object.getOwnPropertySymbols(
|
|
1174
|
-
for (let e of Object.keys(
|
|
1175
|
-
let
|
|
1176
|
-
|
|
1177
|
-
let
|
|
1178
|
-
|
|
1179
|
-
let
|
|
1180
|
-
typeof
|
|
1181
|
-
let
|
|
1182
|
-
if (!
|
|
1183
|
-
else for (let e of Object.keys(
|
|
354
|
+
Object.getOwnPropertySymbols(a).length > 0 && i("local.state.shape", "The state payload cannot use symbol keys.");
|
|
355
|
+
for (let e of Object.keys(a)) Se.has(e) || i("local.state.key", `Unknown top-level state key "${e}".`);
|
|
356
|
+
let o = a.format;
|
|
357
|
+
o !== "reactive-md-state/v1" && i("local.state.format", `Unsupported state format ${F(o)}; expected "${C}".`);
|
|
358
|
+
let s = a.syntax;
|
|
359
|
+
s !== "local-draft-2" && i("local.state.syntax", `Unsupported state syntax ${F(s)}; expected "${r}".`);
|
|
360
|
+
let c = a.sourceDigest;
|
|
361
|
+
typeof c == "string" && ye.test(c) || i("local.state.digest", "sourceDigest must match \"fnv1a32:\" followed by 8 lowercase hexadecimal digits.");
|
|
362
|
+
let l = {}, u = a.parameters;
|
|
363
|
+
if (!M(u)) i("local.state.parameters", "parameters must be a JSON object of public binding values.");
|
|
364
|
+
else for (let e of Object.keys(u).sort()) {
|
|
1184
365
|
if (e === "__proto__") {
|
|
1185
|
-
|
|
366
|
+
i("local.state.parameter.prototype", "Parameter names cannot be \"__proto__\".");
|
|
1186
367
|
continue;
|
|
1187
368
|
}
|
|
1188
369
|
if (e.startsWith("@")) {
|
|
1189
|
-
|
|
370
|
+
i("local.state.parameter.internal", `Internal parameter "${e}" cannot be persisted.`);
|
|
1190
371
|
continue;
|
|
1191
372
|
}
|
|
1192
|
-
let t =
|
|
1193
|
-
t.ok ?
|
|
373
|
+
let t = j(u[e]);
|
|
374
|
+
t.ok ? l[e] = t.value : i("local.state.parameter.value", `Parameter "${e}" ${t.message}`);
|
|
1194
375
|
}
|
|
1195
|
-
let
|
|
1196
|
-
if (Object.hasOwn(
|
|
1197
|
-
let e =
|
|
1198
|
-
if (!
|
|
376
|
+
let d;
|
|
377
|
+
if (Object.hasOwn(a, "generator")) {
|
|
378
|
+
let e = a.generator;
|
|
379
|
+
if (!M(e)) i("local.state.generator", "generator must be an object with string name and version.");
|
|
1199
380
|
else {
|
|
1200
|
-
for (let t of Object.keys(e))
|
|
1201
|
-
typeof e.name != "string" || typeof e.version != "string" ?
|
|
381
|
+
for (let t of Object.keys(e)) Ce.has(t) || i("local.state.generator", `generator has unknown key "${t}".`);
|
|
382
|
+
typeof e.name != "string" || typeof e.version != "string" ? i("local.state.generator", "generator must have string name and version.") : !k(e.name) || !k(e.version) ? i("local.state.utf", "generator contains malformed Unicode.") : d = Object.freeze({
|
|
1202
383
|
name: e.name,
|
|
1203
384
|
version: e.version
|
|
1204
385
|
});
|
|
@@ -1208,36 +389,36 @@ function it(e, t) {
|
|
|
1208
389
|
ok: !1,
|
|
1209
390
|
diagnostics: n
|
|
1210
391
|
};
|
|
1211
|
-
let
|
|
1212
|
-
format:
|
|
1213
|
-
syntax:
|
|
1214
|
-
sourceDigest:
|
|
1215
|
-
parameters:
|
|
392
|
+
let f = {
|
|
393
|
+
format: C,
|
|
394
|
+
syntax: r,
|
|
395
|
+
sourceDigest: c,
|
|
396
|
+
parameters: l
|
|
1216
397
|
};
|
|
1217
|
-
return
|
|
398
|
+
return d && (f.generator = d), {
|
|
1218
399
|
ok: !0,
|
|
1219
|
-
file:
|
|
400
|
+
file: N(f)
|
|
1220
401
|
};
|
|
1221
402
|
}
|
|
1222
|
-
function
|
|
1223
|
-
let n =
|
|
403
|
+
function R(e, t) {
|
|
404
|
+
let n = Te(t);
|
|
1224
405
|
try {
|
|
1225
|
-
return
|
|
406
|
+
return Ee(e, n);
|
|
1226
407
|
} catch (e) {
|
|
1227
408
|
return {
|
|
1228
409
|
ok: !1,
|
|
1229
|
-
diagnostics: [
|
|
410
|
+
diagnostics: [E("local.state.invalid", `Cannot read the local state: ${O(e)}`)]
|
|
1230
411
|
};
|
|
1231
412
|
}
|
|
1232
413
|
}
|
|
1233
|
-
function
|
|
414
|
+
function De(e) {
|
|
1234
415
|
let t = /* @__PURE__ */ new Map(), n = (e) => {
|
|
1235
416
|
for (let r of e) t.set(r.id, r), r.children && n(r.children);
|
|
1236
417
|
};
|
|
1237
418
|
return n(e.nodes), t;
|
|
1238
419
|
}
|
|
1239
|
-
function
|
|
1240
|
-
let t =
|
|
420
|
+
function z(e) {
|
|
421
|
+
let t = De(e), n = /* @__PURE__ */ new Map(), r = [];
|
|
1241
422
|
for (let [i, a] of Object.entries(e.bindingSlots ?? {})) {
|
|
1242
423
|
let e = t.get(i);
|
|
1243
424
|
if (!e) continue;
|
|
@@ -1279,9 +460,9 @@ function ot(e) {
|
|
|
1279
460
|
groups: r
|
|
1280
461
|
};
|
|
1281
462
|
}
|
|
1282
|
-
function
|
|
463
|
+
function B(e, t, n) {
|
|
1283
464
|
let r = [];
|
|
1284
|
-
for (let i of t.plans) i.slot === void 0 && Object.hasOwn(n, i.key) && (i.node ? Object.is(e.get(i.node), n[i.key]) || r.push(...e.set(i.node, n[i.key])) : r.push(
|
|
465
|
+
for (let i of t.plans) i.slot === void 0 && Object.hasOwn(n, i.key) && (i.node ? Object.is(e.get(i.node), n[i.key]) || r.push(...e.set(i.node, n[i.key])) : r.push(E("local.state.document", `The document has no component for parameter "${i.key}".`)));
|
|
1285
466
|
for (let i of t.groups) {
|
|
1286
467
|
let t = {}, a = !1;
|
|
1287
468
|
for (let { slot: e, key: r } of i.slots) Object.hasOwn(n, r) && (t[e] = n[r], a = !0);
|
|
@@ -1289,7 +470,7 @@ function W(e, t, n) {
|
|
|
1289
470
|
}
|
|
1290
471
|
return r;
|
|
1291
472
|
}
|
|
1292
|
-
function
|
|
473
|
+
function Oe(e, t) {
|
|
1293
474
|
let n = e.snapshot(), r = {};
|
|
1294
475
|
for (let e of t) {
|
|
1295
476
|
let t = n.state[e];
|
|
@@ -1297,99 +478,99 @@ function st(e, t) {
|
|
|
1297
478
|
}
|
|
1298
479
|
return Object.freeze(r);
|
|
1299
480
|
}
|
|
1300
|
-
function
|
|
1301
|
-
let
|
|
1302
|
-
if (!
|
|
481
|
+
function V(e, t, n, i) {
|
|
482
|
+
let a = R(t, i);
|
|
483
|
+
if (!a.ok) return a;
|
|
1303
484
|
if (!e || e.syntax !== "local" || typeof e.source != "string" || !Array.isArray(e.nodes) || !e.bindings) return {
|
|
1304
485
|
ok: !1,
|
|
1305
|
-
diagnostics: [
|
|
486
|
+
diagnostics: [E("local.state.document", "resolveLocalState requires a compiled local document.")]
|
|
1306
487
|
};
|
|
1307
|
-
if (
|
|
488
|
+
if (a.file.syntax !== "local-draft-2") return {
|
|
1308
489
|
ok: !1,
|
|
1309
|
-
diagnostics: [
|
|
490
|
+
diagnostics: [E("local.state.syntax", `This state file uses syntax "${a.file.syntax}", but this build accepts "${r}".`)]
|
|
1310
491
|
};
|
|
1311
|
-
if (
|
|
492
|
+
if (a.file.sourceDigest !== A(e.source)) return {
|
|
1312
493
|
ok: !1,
|
|
1313
|
-
diagnostics: [
|
|
494
|
+
diagnostics: [E("local.state.source", "This state file was created for a different document (source digest mismatch).")]
|
|
1314
495
|
};
|
|
1315
|
-
let
|
|
1316
|
-
for (let e of Object.keys(
|
|
1317
|
-
for (let e of
|
|
1318
|
-
if (
|
|
496
|
+
let o = z(e), s = new Set(o.plans.map((e) => e.key)), c = [];
|
|
497
|
+
for (let e of Object.keys(a.file.parameters)) s.has(e) || D(c, "local.state.parameter.unknown", `The state contains unknown parameter "${e}" for this document.`);
|
|
498
|
+
for (let e of s) Object.hasOwn(a.file.parameters, e) || D(c, "local.state.parameter.missing", `The state is missing parameter "${e}".`);
|
|
499
|
+
if (c.length) return {
|
|
1319
500
|
ok: !1,
|
|
1320
|
-
diagnostics:
|
|
501
|
+
diagnostics: c
|
|
1321
502
|
};
|
|
1322
|
-
let
|
|
503
|
+
let l;
|
|
1323
504
|
try {
|
|
1324
|
-
|
|
505
|
+
l = ue(e);
|
|
1325
506
|
} catch (e) {
|
|
1326
507
|
return {
|
|
1327
508
|
ok: !1,
|
|
1328
|
-
diagnostics: [
|
|
509
|
+
diagnostics: [E("local.state.document", `Cannot validate this document: ${O(e)}`)]
|
|
1329
510
|
};
|
|
1330
511
|
}
|
|
1331
512
|
try {
|
|
1332
513
|
if (n) {
|
|
1333
|
-
let e =
|
|
514
|
+
let e = B(l, o, n);
|
|
1334
515
|
if (e.length) return {
|
|
1335
516
|
ok: !1,
|
|
1336
517
|
diagnostics: e
|
|
1337
518
|
};
|
|
1338
519
|
}
|
|
1339
|
-
let e =
|
|
520
|
+
let e = B(l, o, a.file.parameters);
|
|
1340
521
|
if (e.length) return {
|
|
1341
522
|
ok: !1,
|
|
1342
523
|
diagnostics: e
|
|
1343
524
|
};
|
|
1344
|
-
let t = [...
|
|
525
|
+
let t = [...s].sort();
|
|
1345
526
|
return {
|
|
1346
527
|
ok: !0,
|
|
1347
|
-
file:
|
|
1348
|
-
state:
|
|
528
|
+
file: a.file,
|
|
529
|
+
state: Oe(l, t)
|
|
1349
530
|
};
|
|
1350
531
|
} finally {
|
|
1351
|
-
|
|
532
|
+
l.dispose();
|
|
1352
533
|
}
|
|
1353
534
|
}
|
|
1354
|
-
function
|
|
535
|
+
function H(e, t, n) {
|
|
1355
536
|
try {
|
|
1356
|
-
return
|
|
537
|
+
return V(e, t, void 0, n);
|
|
1357
538
|
} catch (e) {
|
|
1358
539
|
return {
|
|
1359
540
|
ok: !1,
|
|
1360
|
-
diagnostics: [
|
|
541
|
+
diagnostics: [E("local.state.invalid", `Cannot resolve the local state: ${O(e)}`)]
|
|
1361
542
|
};
|
|
1362
543
|
}
|
|
1363
544
|
}
|
|
1364
|
-
function
|
|
545
|
+
function U(e, t, n) {
|
|
1365
546
|
let r;
|
|
1366
547
|
try {
|
|
1367
|
-
r =
|
|
548
|
+
r = V(e.document, t, e.snapshot().state, n);
|
|
1368
549
|
} catch (e) {
|
|
1369
|
-
return [
|
|
550
|
+
return [E("local.state.invalid", `Cannot apply the local state: ${O(e)}`)];
|
|
1370
551
|
}
|
|
1371
552
|
if (!r.ok) return r.diagnostics;
|
|
1372
|
-
let i =
|
|
553
|
+
let i = z(e.document);
|
|
1373
554
|
try {
|
|
1374
|
-
return
|
|
555
|
+
return B(e, i, r.state);
|
|
1375
556
|
} catch (e) {
|
|
1376
|
-
return [
|
|
557
|
+
return [E("local.state.invalid", `Cannot apply the local state: ${O(e)}`)];
|
|
1377
558
|
}
|
|
1378
559
|
}
|
|
1379
|
-
function
|
|
1380
|
-
return
|
|
560
|
+
function ke(e, t) {
|
|
561
|
+
return L(e.document, e.getParameters(), t);
|
|
1381
562
|
}
|
|
1382
|
-
function
|
|
1383
|
-
let r =
|
|
1384
|
-
return r.ok ?
|
|
563
|
+
function Ae(e, t, n) {
|
|
564
|
+
let r = R(t, n);
|
|
565
|
+
return r.ok ? U(e, r.file, n) : r.diagnostics;
|
|
1385
566
|
}
|
|
1386
|
-
function
|
|
567
|
+
function je(e) {
|
|
1387
568
|
if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("serializeLocalState requires a state file.");
|
|
1388
569
|
if (!e.parameters || typeof e.parameters != "object" || Array.isArray(e.parameters)) throw TypeError("serializeLocalState requires an object of parameters.");
|
|
1389
570
|
let t = Object.create(null);
|
|
1390
571
|
for (let n of Object.keys(e.parameters).sort()) {
|
|
1391
572
|
if (n === "__proto__" || n.startsWith("@")) throw TypeError(`Cannot serialize parameter "${n}".`);
|
|
1392
|
-
let r =
|
|
573
|
+
let r = j(e.parameters[n]);
|
|
1393
574
|
if (!r.ok) throw TypeError(`Cannot serialize parameter "${n}": the value ${r.message}`);
|
|
1394
575
|
t[n] = r.value;
|
|
1395
576
|
}
|
|
@@ -1400,7 +581,7 @@ function pt(e) {
|
|
|
1400
581
|
parameters: t
|
|
1401
582
|
};
|
|
1402
583
|
if (e.generator !== void 0) {
|
|
1403
|
-
let t =
|
|
584
|
+
let t = P(e.generator);
|
|
1404
585
|
n.generator = {
|
|
1405
586
|
name: t.name,
|
|
1406
587
|
version: t.version
|
|
@@ -1409,24 +590,24 @@ function pt(e) {
|
|
|
1409
590
|
return JSON.stringify(n);
|
|
1410
591
|
}
|
|
1411
592
|
// src/local/retention.ts
|
|
1412
|
-
function
|
|
593
|
+
function Me(e) {
|
|
1413
594
|
let t = /* @__PURE__ */ new Map(), n = (e) => {
|
|
1414
595
|
for (let r of e) t.set(r.id, r), r.children && n(r.children);
|
|
1415
596
|
};
|
|
1416
597
|
return n(e.nodes), t;
|
|
1417
598
|
}
|
|
1418
|
-
function
|
|
599
|
+
function Ne(e, t, n) {
|
|
1419
600
|
let r = e.bindingSlots?.[t.id];
|
|
1420
601
|
return r !== void 0 && Object.values(r).includes(n);
|
|
1421
602
|
}
|
|
1422
|
-
function
|
|
1423
|
-
let t =
|
|
603
|
+
function Pe(e) {
|
|
604
|
+
let t = Me(e), n = /* @__PURE__ */ new Map();
|
|
1424
605
|
for (let [r, i] of Object.entries(e.bindings)) {
|
|
1425
606
|
let a = i.nodeIds.flatMap((e) => {
|
|
1426
607
|
let n = t.get(e);
|
|
1427
608
|
return n ? [n] : [];
|
|
1428
609
|
});
|
|
1429
|
-
if (!a.length || r.startsWith("@") || a.some((t) => t.attrs?.bind !== r && !
|
|
610
|
+
if (!a.length || r.startsWith("@") || a.some((t) => t.attrs?.bind !== r && !Ne(e, t, r) || t.name === "timer" || t.name === "checklist")) continue;
|
|
1430
611
|
let o = a.flatMap((e) => Object.hasOwn(e.attrs ?? {}, "initial") ? [e.attrs.initial] : []).sort();
|
|
1431
612
|
n.set(r, {
|
|
1432
613
|
type: i.type,
|
|
@@ -1435,34 +616,34 @@ function gt(e) {
|
|
|
1435
616
|
}
|
|
1436
617
|
return n;
|
|
1437
618
|
}
|
|
1438
|
-
function
|
|
619
|
+
function W(e, t) {
|
|
1439
620
|
return Object.freeze({
|
|
1440
621
|
name: e,
|
|
1441
622
|
reason: t
|
|
1442
623
|
});
|
|
1443
624
|
}
|
|
1444
|
-
function
|
|
1445
|
-
let t =
|
|
625
|
+
function Fe(e) {
|
|
626
|
+
let t = Pe(e.previous), n = Pe(e.next), r = {}, i = [], a = [];
|
|
1446
627
|
for (let o of Object.keys(e.state).sort()) {
|
|
1447
628
|
if (o.startsWith("@")) {
|
|
1448
|
-
a.push(
|
|
629
|
+
a.push(W(o, "internal"));
|
|
1449
630
|
continue;
|
|
1450
631
|
}
|
|
1451
632
|
if (!Object.hasOwn(e.previous.bindings, o) || !Object.hasOwn(e.next.bindings, o)) {
|
|
1452
|
-
a.push(
|
|
633
|
+
a.push(W(o, "unknown"));
|
|
1453
634
|
continue;
|
|
1454
635
|
}
|
|
1455
636
|
let s = t.get(o), c = n.get(o);
|
|
1456
637
|
if (!s || !c) {
|
|
1457
|
-
a.push(
|
|
638
|
+
a.push(W(o, "unretainable"));
|
|
1458
639
|
continue;
|
|
1459
640
|
}
|
|
1460
641
|
if (s.type !== c.type) {
|
|
1461
|
-
a.push(
|
|
642
|
+
a.push(W(o, "type"));
|
|
1462
643
|
continue;
|
|
1463
644
|
}
|
|
1464
645
|
if (s.initialDefinition !== c.initialDefinition) {
|
|
1465
|
-
a.push(
|
|
646
|
+
a.push(W(o, "initial"));
|
|
1466
647
|
continue;
|
|
1467
648
|
}
|
|
1468
649
|
let l = e.state[o];
|
|
@@ -1474,26 +655,26 @@ function _t(e) {
|
|
|
1474
655
|
dropped: Object.freeze(a)
|
|
1475
656
|
});
|
|
1476
657
|
}
|
|
1477
|
-
function
|
|
658
|
+
function Ie(e, t, n) {
|
|
1478
659
|
return Object.freeze({
|
|
1479
660
|
retained: Object.freeze([...e]),
|
|
1480
661
|
dropped: Object.freeze(t.map((e) => Object.freeze({ ...e }))),
|
|
1481
662
|
diagnostics: Object.freeze([...n])
|
|
1482
663
|
});
|
|
1483
664
|
}
|
|
1484
|
-
function
|
|
665
|
+
function Le(e, t) {
|
|
1485
666
|
let n = Object.keys(t.values).sort();
|
|
1486
|
-
if (!e.setParameters(t.values).length) return
|
|
667
|
+
if (!e.setParameters(t.values).length) return Ie(n, t.dropped, []);
|
|
1487
668
|
let r = [], i = [...t.dropped], a = [];
|
|
1488
669
|
for (let o of n) {
|
|
1489
670
|
let n = e.setParameter(o, t.values[o]);
|
|
1490
|
-
n.length ? (i.push(
|
|
671
|
+
n.length ? (i.push(W(o, "invalid")), a.push(...n)) : r.push(o);
|
|
1491
672
|
}
|
|
1492
|
-
return i.sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name)),
|
|
673
|
+
return i.sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name)), Ie(r, i, a);
|
|
1493
674
|
}
|
|
1494
675
|
// src/local/worker.ts
|
|
1495
|
-
var
|
|
1496
|
-
function
|
|
676
|
+
var Re = 150;
|
|
677
|
+
function ze(e) {
|
|
1497
678
|
return Array.isArray(e) ? e.length > 32 ? Array(33) : e.map((e) => {
|
|
1498
679
|
if (!e || typeof e != "object" || Array.isArray(e)) return e;
|
|
1499
680
|
let t = e, n = { ...t }, r = t.props;
|
|
@@ -1510,22 +691,22 @@ function xt(e) {
|
|
|
1510
691
|
return n.props = i, n;
|
|
1511
692
|
}) : e;
|
|
1512
693
|
}
|
|
1513
|
-
function
|
|
694
|
+
function Be(e) {
|
|
1514
695
|
if (e !== void 0) try {
|
|
1515
696
|
if (typeof e != "object" || !e || Array.isArray(e)) return e;
|
|
1516
697
|
let t = e, n = {};
|
|
1517
|
-
for (let e of
|
|
1518
|
-
if (Object.hasOwn(t, "limits")) {
|
|
698
|
+
for (let e of p) Object.hasOwn(t, e) && (n[e] = t[e]);
|
|
699
|
+
if (Object.hasOwn(t, "markdownBreaks") && (n.markdownBreaks = t.markdownBreaks), Object.hasOwn(t, "limits")) {
|
|
1519
700
|
let e = t.limits;
|
|
1520
701
|
n.limits = e && typeof e == "object" && !Array.isArray(e) && Object.hasOwn(e, "maxSyntaxNodes") ? { maxSyntaxNodes: e.maxSyntaxNodes } : e;
|
|
1521
702
|
}
|
|
1522
|
-
return Object.hasOwn(t, "hostComponents") && (n.hostComponents =
|
|
703
|
+
return Object.hasOwn(t, "hostComponents") && (n.hostComponents = ze(t.hostComponents)), n;
|
|
1523
704
|
} catch {
|
|
1524
705
|
return e;
|
|
1525
706
|
}
|
|
1526
707
|
}
|
|
1527
|
-
function
|
|
1528
|
-
let t =
|
|
708
|
+
function Ve(e) {
|
|
709
|
+
let t = b(e);
|
|
1529
710
|
if (t !== "invalid") return t;
|
|
1530
711
|
try {
|
|
1531
712
|
return `invalid:${JSON.stringify(e)}`;
|
|
@@ -1533,29 +714,29 @@ function Ct(e) {
|
|
|
1533
714
|
return "invalid";
|
|
1534
715
|
}
|
|
1535
716
|
}
|
|
1536
|
-
function
|
|
717
|
+
function He(e, t) {
|
|
1537
718
|
return {
|
|
1538
719
|
source: e,
|
|
1539
|
-
options:
|
|
1540
|
-
optionsKey:
|
|
720
|
+
options: Be(t),
|
|
721
|
+
optionsKey: Ve(t)
|
|
1541
722
|
};
|
|
1542
723
|
}
|
|
1543
|
-
function
|
|
724
|
+
function G(e, t) {
|
|
1544
725
|
return e.source === t.source && e.optionsKey === t.optionsKey;
|
|
1545
726
|
}
|
|
1546
|
-
function
|
|
727
|
+
function K(e) {
|
|
1547
728
|
return e instanceof Error ? e.message : String(e);
|
|
1548
729
|
}
|
|
1549
|
-
function
|
|
730
|
+
function q() {
|
|
1550
731
|
return typeof performance < "u" ? performance.now() : Date.now();
|
|
1551
732
|
}
|
|
1552
|
-
function
|
|
733
|
+
function J(e) {
|
|
1553
734
|
return Number.isFinite(e) ? Math.max(0, Math.round(e)) : 0;
|
|
1554
735
|
}
|
|
1555
|
-
function
|
|
736
|
+
function Y(e) {
|
|
1556
737
|
return {
|
|
1557
738
|
code: "local.worker.compile",
|
|
1558
|
-
message: `Compilation failed: ${
|
|
739
|
+
message: `Compilation failed: ${K(e)}`,
|
|
1559
740
|
severity: "error",
|
|
1560
741
|
range: {
|
|
1561
742
|
start: 0,
|
|
@@ -1565,7 +746,7 @@ function X(e) {
|
|
|
1565
746
|
column: 1
|
|
1566
747
|
};
|
|
1567
748
|
}
|
|
1568
|
-
var
|
|
749
|
+
var Ue = class {
|
|
1569
750
|
options;
|
|
1570
751
|
delay;
|
|
1571
752
|
worker = null;
|
|
@@ -1586,11 +767,11 @@ var Tt = class {
|
|
|
1586
767
|
this.handleWorkerFailure(t || "The compile worker encountered an error");
|
|
1587
768
|
}, t.onmessageerror = () => this.handleWorkerFailure("The compile worker could not deliver the compile result"), this.worker = t;
|
|
1588
769
|
} catch (t) {
|
|
1589
|
-
this.worker = null, e.onModeChange?.("fallback", `Could not start the compile worker: ${
|
|
770
|
+
this.worker = null, e.onModeChange?.("fallback", `Could not start the compile worker: ${K(t)}`);
|
|
1590
771
|
}
|
|
1591
772
|
}
|
|
1592
773
|
schedule(e, t) {
|
|
1593
|
-
this.disposed || (this.queued =
|
|
774
|
+
this.disposed || (this.queued = He(e, t), this.clearTimer(), this.timer = setTimeout(() => {
|
|
1594
775
|
this.timer = null, this.drain();
|
|
1595
776
|
}, this.delay), this.setPending(!0));
|
|
1596
777
|
}
|
|
@@ -1630,8 +811,8 @@ var Tt = class {
|
|
|
1630
811
|
});
|
|
1631
812
|
} catch (t) {
|
|
1632
813
|
this.inFlight = null;
|
|
1633
|
-
let n = `Could not send the source to the compile worker: ${
|
|
1634
|
-
if (r !== null && !
|
|
814
|
+
let n = `Could not send the source to the compile worker: ${K(t)}`, r = this.queued;
|
|
815
|
+
if (r !== null && !G(r, e)) {
|
|
1635
816
|
this.degrade(n), this.finishRun();
|
|
1636
817
|
return;
|
|
1637
818
|
}
|
|
@@ -1640,20 +821,20 @@ var Tt = class {
|
|
|
1640
821
|
}
|
|
1641
822
|
compileFallback(e) {
|
|
1642
823
|
if (this.disposed) return;
|
|
1643
|
-
let t =
|
|
824
|
+
let t = q(), n;
|
|
1644
825
|
try {
|
|
1645
|
-
let t = this.options.fallbackCompile ??
|
|
826
|
+
let t = this.options.fallbackCompile ?? x;
|
|
1646
827
|
n = e.options === void 0 ? t(e.source) : t(e.source, e.options);
|
|
1647
828
|
} catch (e) {
|
|
1648
829
|
n = {
|
|
1649
830
|
ok: !1,
|
|
1650
|
-
diagnostics: [
|
|
831
|
+
diagnostics: [Y(e)]
|
|
1651
832
|
};
|
|
1652
833
|
}
|
|
1653
834
|
this.deliver({
|
|
1654
835
|
source: e.source,
|
|
1655
836
|
result: n,
|
|
1656
|
-
duration:
|
|
837
|
+
duration: J(q() - t),
|
|
1657
838
|
mode: "fallback",
|
|
1658
839
|
...e.options === void 0 ? {} : { options: e.options }
|
|
1659
840
|
}), this.finishRun();
|
|
@@ -1664,17 +845,17 @@ var Tt = class {
|
|
|
1664
845
|
if (!t || !e || e.id !== t.id) return;
|
|
1665
846
|
this.inFlight = null;
|
|
1666
847
|
let n = t.job, r = this.queued;
|
|
1667
|
-
r !== null && !
|
|
848
|
+
r !== null && !G(r, n) || (r !== null && (this.queued = null, this.clearTimer()), e.ok ? this.deliver({
|
|
1668
849
|
source: n.source,
|
|
1669
850
|
result: e.result,
|
|
1670
|
-
duration:
|
|
851
|
+
duration: J(e.duration),
|
|
1671
852
|
mode: "worker",
|
|
1672
853
|
...n.options === void 0 ? {} : { options: n.options }
|
|
1673
854
|
}) : this.deliver({
|
|
1674
855
|
source: n.source,
|
|
1675
856
|
result: {
|
|
1676
857
|
ok: !1,
|
|
1677
|
-
diagnostics: [
|
|
858
|
+
diagnostics: [Y(e.message)]
|
|
1678
859
|
},
|
|
1679
860
|
duration: 0,
|
|
1680
861
|
mode: "worker",
|
|
@@ -1685,7 +866,7 @@ var Tt = class {
|
|
|
1685
866
|
if (this.disposed) return;
|
|
1686
867
|
this.degrade(e);
|
|
1687
868
|
let t = this.inFlight;
|
|
1688
|
-
this.inFlight = null, t && (this.queued === null ||
|
|
869
|
+
this.inFlight = null, t && (this.queued === null || G(this.queued, t.job)) && (this.queued !== null && (this.queued = null, this.clearTimer()), this.compileFallback(t.job)), this.finishRun();
|
|
1689
870
|
}
|
|
1690
871
|
degrade(e) {
|
|
1691
872
|
let t = this.worker;
|
|
@@ -1710,7 +891,7 @@ var Tt = class {
|
|
|
1710
891
|
this.timer !== null && (clearTimeout(this.timer), this.timer = null);
|
|
1711
892
|
}
|
|
1712
893
|
};
|
|
1713
|
-
function
|
|
894
|
+
function We(e, t, n) {
|
|
1714
895
|
try {
|
|
1715
896
|
e.postMessage({
|
|
1716
897
|
id: t,
|
|
@@ -1719,15 +900,15 @@ function Et(e, t, n) {
|
|
|
1719
900
|
});
|
|
1720
901
|
} catch {}
|
|
1721
902
|
}
|
|
1722
|
-
function
|
|
903
|
+
function Ge(e) {
|
|
1723
904
|
let t = e === void 0 ? globalThis : e;
|
|
1724
905
|
if (!t || typeof t.postMessage != "function") throw TypeError("startLocalCompileWorker requires a worker scope with postMessage");
|
|
1725
906
|
t.onmessage = (e) => {
|
|
1726
907
|
let n = e?.data;
|
|
1727
908
|
if (!n || typeof n.id != "number" || typeof n.source != "string") return;
|
|
1728
|
-
let r =
|
|
909
|
+
let r = q();
|
|
1729
910
|
try {
|
|
1730
|
-
let e = n.options === void 0 ?
|
|
911
|
+
let e = n.options === void 0 ? x(n.source) : x(n.source, n.options), i = J(q() - r);
|
|
1731
912
|
try {
|
|
1732
913
|
t.postMessage({
|
|
1733
914
|
id: n.id,
|
|
@@ -1736,29 +917,29 @@ function Dt(e) {
|
|
|
1736
917
|
duration: i
|
|
1737
918
|
});
|
|
1738
919
|
} catch (e) {
|
|
1739
|
-
|
|
920
|
+
We(t, n.id, `Could not return the compile result: ${K(e)}`);
|
|
1740
921
|
}
|
|
1741
922
|
} catch (e) {
|
|
1742
|
-
|
|
923
|
+
We(t, n.id, K(e));
|
|
1743
924
|
}
|
|
1744
925
|
};
|
|
1745
926
|
}
|
|
1746
927
|
// src/shareable.ts
|
|
1747
|
-
var
|
|
1748
|
-
function
|
|
928
|
+
var Ke = "reactive-md-html/v1", qe = /^[A-Za-z][A-Za-z0-9_-]*$/, Je = /^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/, Ye = /^data:image\/(?:png|jpeg|gif|webp);base64,[A-Za-z0-9+/]+={0,2}$/, Xe = /[\u0000-\u001f\u007f-\u009f]/, Ze = 64, Qe = 41943040, $e = 4096;
|
|
929
|
+
function X(e, t = !1) {
|
|
1749
930
|
let n = e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
1750
931
|
return t && (n = n.replace(/"/g, """).replace(/'/g, "'")), n;
|
|
1751
932
|
}
|
|
1752
|
-
function
|
|
933
|
+
function et(e) {
|
|
1753
934
|
return e.replace(/<\/style/gi, "<\\/style");
|
|
1754
935
|
}
|
|
1755
|
-
function
|
|
936
|
+
function tt(e) {
|
|
1756
937
|
return e.replace(/<\/script/gi, "<\\/script").replace(/<!--/g, "<\\!--");
|
|
1757
938
|
}
|
|
1758
|
-
function
|
|
1759
|
-
return
|
|
939
|
+
function Z(e) {
|
|
940
|
+
return X(e, !0);
|
|
1760
941
|
}
|
|
1761
|
-
function
|
|
942
|
+
function nt(e) {
|
|
1762
943
|
let t = JSON.stringify(e);
|
|
1763
944
|
if (typeof t != "string") throw TypeError("Cannot serialize a non-JSON value for an inline script.");
|
|
1764
945
|
return t.replace(/[<>&\u2028\u2029]/g, (e) => {
|
|
@@ -1771,94 +952,95 @@ function Lt(e) {
|
|
|
1771
952
|
}
|
|
1772
953
|
});
|
|
1773
954
|
}
|
|
1774
|
-
function
|
|
955
|
+
function Q(e) {
|
|
1775
956
|
return Array.isArray(e) ? e.slice() : e;
|
|
1776
957
|
}
|
|
1777
|
-
function
|
|
958
|
+
function rt(e) {
|
|
1778
959
|
if (e === void 0) return;
|
|
1779
|
-
let t =
|
|
960
|
+
let t = _(e);
|
|
1780
961
|
if (!t.ok) throw TypeError(`createShareableHtml received invalid compileOptions: ${t.message}`);
|
|
1781
962
|
let n = {
|
|
1782
963
|
enableCss: t.html.enableCss,
|
|
1783
964
|
enableJavaScript: t.html.enableJavaScript,
|
|
1784
|
-
enableExtendedHtml: t.html.enableExtendedHtml
|
|
965
|
+
enableExtendedHtml: t.html.enableExtendedHtml,
|
|
966
|
+
...Object.hasOwn(e, "markdownBreaks") && e.markdownBreaks !== void 0 ? { markdownBreaks: t.markdownBreaks } : {}
|
|
1785
967
|
};
|
|
1786
968
|
return e.limits !== void 0 && e.limits.maxSyntaxNodes !== void 0 ? {
|
|
1787
969
|
...n,
|
|
1788
970
|
limits: { maxSyntaxNodes: t.maxSyntaxNodes }
|
|
1789
971
|
} : n;
|
|
1790
972
|
}
|
|
1791
|
-
function
|
|
1792
|
-
let
|
|
1793
|
-
for (let
|
|
1794
|
-
if (
|
|
1795
|
-
let
|
|
1796
|
-
if (
|
|
1797
|
-
|
|
973
|
+
function it(t) {
|
|
974
|
+
let n = [];
|
|
975
|
+
for (let r of t.childNodes) {
|
|
976
|
+
if (e.isElementNode(r)) {
|
|
977
|
+
let t = r.tagName.toLowerCase();
|
|
978
|
+
if (t === "script") continue;
|
|
979
|
+
it(t === "template" ? e.getTemplateContent(r) : r);
|
|
1798
980
|
}
|
|
1799
|
-
|
|
981
|
+
n.push(r);
|
|
1800
982
|
}
|
|
1801
|
-
|
|
983
|
+
t.childNodes = n;
|
|
1802
984
|
}
|
|
1803
|
-
function
|
|
1804
|
-
let
|
|
1805
|
-
for (let
|
|
1806
|
-
if (
|
|
1807
|
-
let e =
|
|
985
|
+
function $(t, n, r) {
|
|
986
|
+
let i = !1;
|
|
987
|
+
for (let a of t.childNodes) if (e.isElementNode(a)) {
|
|
988
|
+
if (a.tagName.toLowerCase() === "iframe") {
|
|
989
|
+
let e = a.attrs.filter((e) => {
|
|
1808
990
|
let t = e.name.toLowerCase();
|
|
1809
991
|
return t !== "srcdoc" && t !== "sandbox";
|
|
1810
992
|
});
|
|
1811
993
|
e.push({
|
|
1812
994
|
name: "srcdoc",
|
|
1813
|
-
value:
|
|
995
|
+
value: n
|
|
1814
996
|
}), e.push({
|
|
1815
997
|
name: "sandbox",
|
|
1816
|
-
value:
|
|
1817
|
-
}),
|
|
998
|
+
value: r
|
|
999
|
+
}), a.attrs = e, i = !0;
|
|
1818
1000
|
}
|
|
1819
|
-
|
|
1001
|
+
$(a, n, r) && (i = !0);
|
|
1820
1002
|
}
|
|
1821
|
-
return
|
|
1003
|
+
return i;
|
|
1822
1004
|
}
|
|
1823
|
-
function
|
|
1005
|
+
function at(e) {
|
|
1824
1006
|
let t = "";
|
|
1825
|
-
for (let n of e.childNodes) t +=
|
|
1007
|
+
for (let n of e.childNodes) t += a(n, { scriptingEnabled: !1 });
|
|
1826
1008
|
return t;
|
|
1827
1009
|
}
|
|
1828
|
-
function
|
|
1010
|
+
function ot(e, t, n) {
|
|
1829
1011
|
try {
|
|
1830
|
-
let r =
|
|
1831
|
-
if (
|
|
1012
|
+
let r = i(e, { scriptingEnabled: !1 });
|
|
1013
|
+
if (it(r), $(r, t, n)) return at(r);
|
|
1832
1014
|
} catch {}
|
|
1833
|
-
return `<div class="reactive-md-native-document"><iframe class="reactive-md-native-frame" title="Reactive MD document" sandbox="${
|
|
1015
|
+
return `<div class="reactive-md-native-document"><iframe class="reactive-md-native-frame" title="Reactive MD document" sandbox="${X(n, !0)}" style="display:block;width:100%;min-height:60vh;border:0;background:#fff" srcdoc="${X(t, !0)}"></iframe></div>`;
|
|
1834
1016
|
}
|
|
1835
|
-
function
|
|
1017
|
+
function st(e, t) {
|
|
1836
1018
|
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'";
|
|
1837
1019
|
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}`;
|
|
1838
1020
|
}
|
|
1839
|
-
function
|
|
1021
|
+
function ct(e) {
|
|
1840
1022
|
if (e === void 0) return;
|
|
1841
1023
|
if (!e || typeof e != "object" || Array.isArray(e)) throw TypeError("images must be an object mapping relative URLs to data: image URLs.");
|
|
1842
1024
|
let t = Object.entries(e);
|
|
1843
|
-
if (t.length >
|
|
1025
|
+
if (t.length > Ze) throw RangeError(`images cannot contain more than ${Ze} entries.`);
|
|
1844
1026
|
let n = 0;
|
|
1845
1027
|
for (let [e, r] of t) {
|
|
1846
|
-
if (!e || e.length >
|
|
1847
|
-
if (typeof r != "string" || !
|
|
1848
|
-
if (n += r.length, n >
|
|
1028
|
+
if (!e || e.length > $e || Xe.test(e) || e === "__proto__") throw TypeError("Every image key must be a bounded, control-free URL.");
|
|
1029
|
+
if (typeof r != "string" || !Ye.test(r)) throw TypeError(`The image map for "${e}" must contain a base64 PNG, JPEG, GIF or WebP data URL.`);
|
|
1030
|
+
if (n += r.length, n > Qe) throw RangeError("The embedded image map exceeds the 40 MiB budget.");
|
|
1849
1031
|
}
|
|
1850
1032
|
return Object.fromEntries(t);
|
|
1851
1033
|
}
|
|
1852
|
-
function
|
|
1853
|
-
let n =
|
|
1034
|
+
function lt(e, t) {
|
|
1035
|
+
let n = H(e, t);
|
|
1854
1036
|
if (!n.ok) return n;
|
|
1855
1037
|
let r = {};
|
|
1856
1038
|
for (let [t, i] of Object.entries(e.bindings)) r[t] = Object.hasOwn(n.state, t) ? {
|
|
1857
1039
|
...i,
|
|
1858
|
-
initial:
|
|
1040
|
+
initial: Q(n.state[t])
|
|
1859
1041
|
} : i;
|
|
1860
1042
|
let i = { ...e.initialState };
|
|
1861
|
-
for (let [e, t] of Object.entries(n.state)) i[e] =
|
|
1043
|
+
for (let [e, t] of Object.entries(n.state)) i[e] = Q(t);
|
|
1862
1044
|
return {
|
|
1863
1045
|
ok: !0,
|
|
1864
1046
|
baseline: {
|
|
@@ -1871,16 +1053,16 @@ function Kt(e, t) {
|
|
|
1871
1053
|
}
|
|
1872
1054
|
};
|
|
1873
1055
|
}
|
|
1874
|
-
var
|
|
1875
|
-
function
|
|
1056
|
+
var ut = "\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";
|
|
1057
|
+
function dt(e) {
|
|
1876
1058
|
let t = e.targetId ?? "reactive-md-document";
|
|
1877
|
-
if (!
|
|
1059
|
+
if (!qe.test(t)) throw TypeError("targetId must start with a letter and contain only letters, digits, underscores or hyphens.");
|
|
1878
1060
|
let n = e.mode === "static" ? "static" : "interactive";
|
|
1879
1061
|
if (!e.staticMarkup.trim()) throw TypeError("createShareableHtml requires rendered document markup.");
|
|
1880
1062
|
if (!e.css.trim()) throw TypeError("createShareableHtml requires the document stylesheet.");
|
|
1881
|
-
if (e.state.sourceDigest !==
|
|
1063
|
+
if (e.state.sourceDigest !== A(e.source)) throw Error("The state file does not belong to the exported source.");
|
|
1882
1064
|
if (n === "interactive" && !e.runtimeScript?.trim()) throw TypeError("Interactive HTML requires the standalone runtime script.");
|
|
1883
|
-
let r =
|
|
1065
|
+
let r = rt(e.compileOptions), i = _(r);
|
|
1884
1066
|
if (!i.ok) throw TypeError(`createShareableHtml received invalid compileOptions: ${i.message}`);
|
|
1885
1067
|
let a = i.htmlActive, o = e.staticMarkup;
|
|
1886
1068
|
if (a && (n === "static" || !i.html.enableJavaScript)) {
|
|
@@ -1890,12 +1072,12 @@ function Jt(e) {
|
|
|
1890
1072
|
enableExtendedHtml: i.html.enableExtendedHtml
|
|
1891
1073
|
}, n = te(e.source, t, i.maxSyntaxNodes);
|
|
1892
1074
|
if (!n.markup) throw Error("The native HTML document could not be regenerated without author JavaScript.");
|
|
1893
|
-
o =
|
|
1075
|
+
o = ot(e.staticMarkup, n.markup, ee(t));
|
|
1894
1076
|
}
|
|
1895
1077
|
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 ?? {
|
|
1896
1078
|
name: "reactive-md",
|
|
1897
1079
|
version: "unknown"
|
|
1898
|
-
}, f =
|
|
1080
|
+
}, f = ct(e.images), p = Number.isSafeInteger(e.imageCount) && (e.imageCount ?? 0) > 0 ? String(e.imageCount) : String(Object.keys(f ?? {}).length), m = n === "interactive", h = {
|
|
1899
1081
|
version: 1,
|
|
1900
1082
|
target: t,
|
|
1901
1083
|
source: e.source,
|
|
@@ -1905,31 +1087,31 @@ function Jt(e) {
|
|
|
1905
1087
|
hydrate: !0,
|
|
1906
1088
|
...r === void 0 ? {} : { compileOptions: r },
|
|
1907
1089
|
...f ? { images: f } : {}
|
|
1908
|
-
},
|
|
1909
|
-
<script>${
|
|
1090
|
+
}, g = st(m, a ? i.html : void 0), v = m ? `<script type="application/reactive-md+json" data-reactive-md-auto>${nt(h)}<\/script>
|
|
1091
|
+
<script>${tt(e.runtimeScript)}<\/script>` : "", y = e.notices?.trim() ? `<template id="reactive-md-notices"><pre>${X(e.notices)}</pre></template>` : "";
|
|
1910
1092
|
return `<!doctype html>
|
|
1911
|
-
<html lang="${
|
|
1093
|
+
<html lang="${X(Je.test(c) ? c : "en", !0)}">
|
|
1912
1094
|
<head>
|
|
1913
1095
|
<meta charset="utf-8">
|
|
1914
1096
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
1915
1097
|
<meta name="referrer" content="no-referrer">
|
|
1916
|
-
<meta http-equiv="Content-Security-Policy" content="${
|
|
1917
|
-
<meta name="generator" content="${
|
|
1918
|
-
<meta name="reactive-md-html-format" content="${
|
|
1919
|
-
<meta name="reactive-md-syntax" content="${
|
|
1098
|
+
<meta http-equiv="Content-Security-Policy" content="${Z(g)}">
|
|
1099
|
+
<meta name="generator" content="${Z(`${d.name} ${d.version}`)}">
|
|
1100
|
+
<meta name="reactive-md-html-format" content="${Ke}">
|
|
1101
|
+
<meta name="reactive-md-syntax" content="${Z(e.state.syntax)}">
|
|
1920
1102
|
<meta name="reactive-md-output" content="${n}">
|
|
1921
|
-
<meta name="reactive-md-state" content="${
|
|
1103
|
+
<meta name="reactive-md-state" content="${Z(e.state.sourceDigest)}">
|
|
1922
1104
|
<meta name="reactive-md-images" content="${u}">
|
|
1923
1105
|
<meta name="reactive-md-image-count" content="${p}">
|
|
1924
|
-
<title>${
|
|
1925
|
-
<style>${
|
|
1106
|
+
<title>${X(e.title || "Reactive MD document")}</title>
|
|
1107
|
+
<style>${et(e.css)}${ut}</style>
|
|
1926
1108
|
</head>
|
|
1927
1109
|
<body class="reactive-md-export">
|
|
1928
1110
|
<div id="${t}" class="reactive-md-export-root">${o}</div>
|
|
1929
1111
|
${v}
|
|
1930
|
-
${
|
|
1112
|
+
${y}
|
|
1931
1113
|
</body>
|
|
1932
1114
|
</html>
|
|
1933
1115
|
`;
|
|
1934
1116
|
}
|
|
1935
|
-
export {
|
|
1117
|
+
export { c as DEFAULT_LOCAL_THEME, Re as LOCAL_COMPILE_DELAY_MS, ne as LOCAL_DIAGNOSTIC_CODES, C as LOCAL_STATE_FORMAT, r as LOCAL_SYNTAX_VERSION, ie as LOCAL_THEME_PROTOCOL, Ue as LocalCompileScheduler, o as LocalExpressionError, Ke as SHAREABLE_HTML_FORMAT, le as analyzeLocalSource, U as applyLocalState, Le as applyLocalStateRetention, _e as checkLocalUpgrade, s as compileExpression, Y as compileFailureDiagnostic, n as compileLatex, x as compileLocal, se as completeLocalSource, v as countLocalCodePoints, ue as createLocalRuntime, L as createLocalStateFile, dt as createShareableHtml, ke as exportLocalState, l as formatLocalDiagnostic, ce as formatLocalSource, Ae as importLocalState, he as inspectLocalSourceVersion, y as isLocalDiagnosticCode, ae as isLocalThemeName, b as localCompileOptionsKey, d as localDiagnosticTemplate, g as localDiagnosticTemplateKeys, A as localSourceDigest, ve as migrateLocalSource, R as parseLocalState, Fe as planLocalStateRetention, oe as renameLocalBinding, H as resolveLocalState, lt as resolveLocalStateBaseline, u as resolveLocalTheme, t as samplePlot, nt as serializeForScript, je as serializeLocalState, Ge as startLocalCompileWorker };
|