@mdsvex/parse 1.0.0-next.2 → 1.0.0-next.3
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/PLUGINS.md +41 -1
- package/dist/main.d.ts +1 -1
- package/dist/main.js +2354 -2113
- package/dist/plugin_dispatch.d.ts +18 -0
- package/dist/plugin_tasks.d.ts +4 -0
- package/dist/plugin_types.d.ts +7 -1
- package/dist/utils.d.ts +64 -0
- package/dist/utils.js +272 -187
- package/package.json +1 -1
package/dist/utils.js
CHANGED
|
@@ -1,43 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
var j;
|
|
2
|
+
const $ = new Uint32Array(0), W = Object.freeze([]), L = 48, H = [], R = globalThis.Buffer, tt = R !== void 0 && typeof R.allocUnsafeSlow == "function";
|
|
3
|
+
function K(n) {
|
|
4
|
+
return tt ? R.allocUnsafeSlow(n).buffer : new ArrayBuffer(n);
|
|
4
5
|
}
|
|
5
|
-
const
|
|
6
|
-
function
|
|
6
|
+
const N = 512;
|
|
7
|
+
function S(n, t, f) {
|
|
7
8
|
const s = f - t <= 64 ? f : t + 64;
|
|
8
9
|
for (let i = t * 12; i < s * 12; )
|
|
9
|
-
|
|
10
|
+
n[
|
|
10
11
|
i + 2
|
|
11
12
|
/* NodeField.end */
|
|
12
|
-
] = 4294967295,
|
|
13
|
+
] = 4294967295, n[
|
|
13
14
|
i + 3
|
|
14
15
|
/* NodeField.value_start */
|
|
15
|
-
] = 0,
|
|
16
|
+
] = 0, n[
|
|
16
17
|
i + 4
|
|
17
18
|
/* NodeField.value_end */
|
|
18
|
-
] = 0,
|
|
19
|
+
] = 0, n[
|
|
19
20
|
i + 6
|
|
20
21
|
/* NodeField.next */
|
|
21
|
-
] = 4294967295,
|
|
22
|
+
] = 4294967295, n[
|
|
22
23
|
i + 7
|
|
23
24
|
/* NodeField.prev */
|
|
24
|
-
] = 4294967295,
|
|
25
|
+
] = 4294967295, n[
|
|
25
26
|
i + 8
|
|
26
27
|
/* NodeField.first_child */
|
|
27
|
-
] = 4294967295,
|
|
28
|
+
] = 4294967295, n[
|
|
28
29
|
i + 9
|
|
29
30
|
/* NodeField.last_child */
|
|
30
|
-
] = 4294967295,
|
|
31
|
+
] = 4294967295, n[
|
|
31
32
|
i + 10
|
|
32
33
|
/* NodeField.pending */
|
|
33
|
-
] = 0,
|
|
34
|
+
] = 0, n[
|
|
34
35
|
i + 11
|
|
35
36
|
/* NodeField.meta */
|
|
36
37
|
] = 0, i += 12;
|
|
37
38
|
let e = s;
|
|
38
39
|
for (; e < f; ) {
|
|
39
40
|
let i = e - t;
|
|
40
|
-
i >
|
|
41
|
+
i > N && (i = N), i > f - e && (i = f - e), n.copyWithin(
|
|
41
42
|
e * 12,
|
|
42
43
|
t * 12,
|
|
43
44
|
(t + i) * 12
|
|
@@ -45,17 +46,17 @@ function E(h, t, f) {
|
|
|
45
46
|
), e += i;
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
|
-
const
|
|
49
|
-
let
|
|
50
|
-
const
|
|
51
|
-
function
|
|
49
|
+
const ft = 1048576 / L | 0, V = 4096;
|
|
50
|
+
let y = new ArrayBuffer(0), w = 1048576, m = null;
|
|
51
|
+
const st = 32;
|
|
52
|
+
function q(n) {
|
|
52
53
|
let t = 1;
|
|
53
|
-
for (; t <
|
|
54
|
+
for (; t < n; )
|
|
54
55
|
t <<= 1;
|
|
55
56
|
return t;
|
|
56
57
|
}
|
|
57
|
-
const
|
|
58
|
-
switch (
|
|
58
|
+
const G = (n) => {
|
|
59
|
+
switch (n) {
|
|
59
60
|
case 0:
|
|
60
61
|
return "root";
|
|
61
62
|
case 1:
|
|
@@ -135,67 +136,140 @@ const K = (h) => {
|
|
|
135
136
|
case 38:
|
|
136
137
|
return "definition";
|
|
137
138
|
}
|
|
138
|
-
},
|
|
139
|
-
for (let
|
|
140
|
-
|
|
141
|
-
const
|
|
142
|
-
switch (
|
|
139
|
+
}, J = /* @__PURE__ */ new Map();
|
|
140
|
+
for (let n = 0; n <= 38; n++)
|
|
141
|
+
J.set(G(n), n);
|
|
142
|
+
const at = (n) => J.get(n), et = (n) => {
|
|
143
|
+
switch (n) {
|
|
143
144
|
case 3:
|
|
144
145
|
return "depth";
|
|
145
146
|
}
|
|
146
147
|
};
|
|
147
|
-
let
|
|
148
|
-
function
|
|
149
|
-
return
|
|
148
|
+
let O = !1;
|
|
149
|
+
function ct() {
|
|
150
|
+
return O ? (O = !1, !0) : !1;
|
|
150
151
|
}
|
|
151
|
-
let
|
|
152
|
-
function
|
|
153
|
-
|
|
152
|
+
let M = !1;
|
|
153
|
+
function lt() {
|
|
154
|
+
M = !0;
|
|
154
155
|
}
|
|
155
|
-
function
|
|
156
|
-
return
|
|
156
|
+
function ot() {
|
|
157
|
+
return M ? (M = !1, !0) : !1;
|
|
157
158
|
}
|
|
158
|
-
let
|
|
159
|
-
function
|
|
160
|
-
|
|
159
|
+
let D = !1;
|
|
160
|
+
function ut() {
|
|
161
|
+
D = !0;
|
|
161
162
|
}
|
|
162
|
-
function
|
|
163
|
-
return
|
|
163
|
+
function pt() {
|
|
164
|
+
return D ? (D = !1, !0) : !1;
|
|
164
165
|
}
|
|
165
|
-
const
|
|
166
|
-
let
|
|
167
|
-
function
|
|
168
|
-
|
|
166
|
+
const P = 128, z = [];
|
|
167
|
+
let x = 0;
|
|
168
|
+
function Q(n, t) {
|
|
169
|
+
x < P ? (z[x] = n, z[x + 1] = t, x += 2) : x = P + 2;
|
|
169
170
|
}
|
|
170
|
-
function
|
|
171
|
-
return
|
|
171
|
+
function dt(n, t, f) {
|
|
172
|
+
return x !== 0 && it(n, t, f);
|
|
172
173
|
}
|
|
173
|
-
function
|
|
174
|
-
const s =
|
|
175
|
-
if (
|
|
174
|
+
function it(n, t, f) {
|
|
175
|
+
const s = x;
|
|
176
|
+
if (x = 0, s > P)
|
|
176
177
|
return !0;
|
|
177
178
|
for (let e = 0; e < s; e += 2) {
|
|
178
|
-
const i =
|
|
179
|
-
for (let
|
|
180
|
-
if (
|
|
179
|
+
const i = z[e + 1], r = i - t.length;
|
|
180
|
+
for (let h = z[e]; h <= r; h++)
|
|
181
|
+
if (n.startsWith(t, h))
|
|
181
182
|
return !0;
|
|
182
183
|
if (f === void 0)
|
|
183
184
|
continue;
|
|
184
185
|
const _ = i - f.length;
|
|
185
|
-
for (let
|
|
186
|
-
if (
|
|
186
|
+
for (let h = z[e]; h <= _; h++)
|
|
187
|
+
if (n.startsWith(f, h))
|
|
187
188
|
return !0;
|
|
188
189
|
}
|
|
189
190
|
return !1;
|
|
190
191
|
}
|
|
191
|
-
|
|
192
|
-
|
|
192
|
+
const rt = 0, nt = 1, _t = 2;
|
|
193
|
+
class I {
|
|
194
|
+
constructor(t, f, s, e, i, r, _, h, a, c) {
|
|
195
|
+
this.source = t, this.base = f, this.rec = s, this.at = e, this.n = i, this.name_start = r, this.attrs_end = _, this.open_end = h, this.attrs_start = a, this.canonical = c, this.text = void 0;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
function gt(n) {
|
|
199
|
+
return n.text ?? (n.text = n.source.slice(n.attrs_start - n.base, n.attrs_end - n.base));
|
|
200
|
+
}
|
|
201
|
+
let Y = new Int32Array(8192), B = 0, Z = 0;
|
|
202
|
+
function bt(n, t) {
|
|
203
|
+
B + t > Y.length && (Y = new Int32Array(t > 8192 ? t : 8192), B = 0);
|
|
204
|
+
const f = Y, s = Z = B;
|
|
205
|
+
for (let e = 0; e < t; e++)
|
|
206
|
+
f[s + e] = n[e];
|
|
207
|
+
return B = s + t, f;
|
|
208
|
+
}
|
|
209
|
+
function xt() {
|
|
210
|
+
return Z;
|
|
211
|
+
}
|
|
212
|
+
function F(n) {
|
|
213
|
+
const t = n.source, f = n.base, s = n.rec, e = n.at + n.n, i = {};
|
|
214
|
+
for (let r = n.at; r < e; r += 5) {
|
|
215
|
+
const _ = s[r], h = t.slice(s[r + 1] - f, s[r + 2] - f);
|
|
216
|
+
if (_ === rt)
|
|
217
|
+
i[h] = !0;
|
|
218
|
+
else if (_ === _t)
|
|
219
|
+
i[h] = { type: "expression", value: h };
|
|
220
|
+
else {
|
|
221
|
+
const a = t.slice(s[r + 3] - f, s[r + 4] - f);
|
|
222
|
+
i[h] = _ === nt ? a : { type: "expression", value: a };
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return i;
|
|
226
|
+
}
|
|
227
|
+
function wt(n, t) {
|
|
228
|
+
const f = n.source, s = n.base, e = n.rec, i = n.at + n.n;
|
|
229
|
+
for (let r = n.at; r < i; r += 5) {
|
|
230
|
+
const _ = e[r + 1] - s;
|
|
231
|
+
if (e[r + 2] - s - _ === t.length && f.startsWith(t, _))
|
|
232
|
+
return !0;
|
|
233
|
+
}
|
|
234
|
+
return !1;
|
|
235
|
+
}
|
|
236
|
+
const T = Symbol("attributes");
|
|
237
|
+
class U {
|
|
238
|
+
constructor(t) {
|
|
239
|
+
this[j] = void 0, this.tag = t;
|
|
240
|
+
}
|
|
241
|
+
get attributes() {
|
|
242
|
+
const t = this[T];
|
|
243
|
+
return t instanceof I ? this[T] = F(t) : t;
|
|
244
|
+
}
|
|
245
|
+
set attributes(t) {
|
|
246
|
+
this[T] = t;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
j = T;
|
|
250
|
+
function ht(n) {
|
|
251
|
+
if (!(n instanceof U))
|
|
252
|
+
return n;
|
|
253
|
+
const t = { tag: n.tag }, f = n.attributes;
|
|
254
|
+
f !== void 0 && (t.attributes = f);
|
|
255
|
+
for (const s in n)
|
|
256
|
+
t[s] = n[s];
|
|
257
|
+
return t;
|
|
258
|
+
}
|
|
259
|
+
function At(n) {
|
|
260
|
+
if (!(n instanceof U))
|
|
261
|
+
return;
|
|
262
|
+
const t = n[T];
|
|
263
|
+
return t instanceof I ? t : void 0;
|
|
264
|
+
}
|
|
265
|
+
function kt(n, t) {
|
|
266
|
+
switch (n) {
|
|
193
267
|
case "tag":
|
|
194
|
-
return
|
|
268
|
+
return new U(t);
|
|
195
269
|
case "href":
|
|
196
270
|
return { href: t };
|
|
197
271
|
case "src":
|
|
198
|
-
return
|
|
272
|
+
return O = !0, { src: t };
|
|
199
273
|
case "ordered":
|
|
200
274
|
return { ordered: t };
|
|
201
275
|
case "info_start":
|
|
@@ -205,7 +279,9 @@ function it(h, t) {
|
|
|
205
279
|
case "alignments":
|
|
206
280
|
return { alignments: t };
|
|
207
281
|
case "attributes":
|
|
208
|
-
return {
|
|
282
|
+
return {
|
|
283
|
+
attributes: t instanceof I ? F(t) : t
|
|
284
|
+
};
|
|
209
285
|
case "self_closing":
|
|
210
286
|
return { self_closing: t };
|
|
211
287
|
case "title":
|
|
@@ -215,7 +291,7 @@ function it(h, t) {
|
|
|
215
291
|
case "tight":
|
|
216
292
|
return { tight: t };
|
|
217
293
|
case "info_end":
|
|
218
|
-
return
|
|
294
|
+
return Q(0, t), { info_end: t };
|
|
219
295
|
case "args":
|
|
220
296
|
return { name: void 0, args: t };
|
|
221
297
|
case "col_count":
|
|
@@ -223,69 +299,69 @@ function it(h, t) {
|
|
|
223
299
|
case "checked":
|
|
224
300
|
return { checked: t };
|
|
225
301
|
default: {
|
|
226
|
-
if (
|
|
227
|
-
return { [
|
|
302
|
+
if (n === "__proto__")
|
|
303
|
+
return { [n]: t };
|
|
228
304
|
const f = {};
|
|
229
|
-
return f[
|
|
305
|
+
return f[n] = t, f;
|
|
230
306
|
}
|
|
231
307
|
}
|
|
232
308
|
}
|
|
233
|
-
function
|
|
309
|
+
function vt(n, t, f) {
|
|
234
310
|
switch (t) {
|
|
235
311
|
case "attributes":
|
|
236
|
-
|
|
312
|
+
n.attributes = f instanceof I && !(n instanceof U) ? F(f) : f;
|
|
237
313
|
return;
|
|
238
314
|
case "start":
|
|
239
|
-
|
|
315
|
+
n.start = f;
|
|
240
316
|
return;
|
|
241
317
|
case "tight":
|
|
242
|
-
|
|
318
|
+
n.tight = f;
|
|
243
319
|
return;
|
|
244
320
|
case "title":
|
|
245
|
-
|
|
321
|
+
n.title = f;
|
|
246
322
|
return;
|
|
247
323
|
case "self_closing":
|
|
248
|
-
|
|
324
|
+
n.self_closing = f;
|
|
249
325
|
return;
|
|
250
326
|
case "info_end":
|
|
251
|
-
f !==
|
|
327
|
+
f !== n.info_start && Q(n.info_start, f), n.info_end = f;
|
|
252
328
|
return;
|
|
253
329
|
case "col_count":
|
|
254
|
-
|
|
330
|
+
n.col_count = f;
|
|
255
331
|
return;
|
|
256
332
|
case "args":
|
|
257
|
-
|
|
333
|
+
n.args = f;
|
|
258
334
|
return;
|
|
259
335
|
case "tag":
|
|
260
|
-
|
|
336
|
+
n.tag = f;
|
|
261
337
|
return;
|
|
262
338
|
case "href":
|
|
263
|
-
|
|
339
|
+
n.href = f;
|
|
264
340
|
return;
|
|
265
341
|
case "src":
|
|
266
|
-
|
|
342
|
+
O = !0, n.src = f;
|
|
267
343
|
return;
|
|
268
344
|
case "ordered":
|
|
269
|
-
|
|
345
|
+
n.ordered = f;
|
|
270
346
|
return;
|
|
271
347
|
case "info_start":
|
|
272
|
-
|
|
348
|
+
n.info_start = f;
|
|
273
349
|
return;
|
|
274
350
|
case "name":
|
|
275
|
-
|
|
351
|
+
n.name = f;
|
|
276
352
|
return;
|
|
277
353
|
case "alignments":
|
|
278
|
-
|
|
354
|
+
n.alignments = f;
|
|
279
355
|
return;
|
|
280
356
|
case "checked":
|
|
281
|
-
|
|
357
|
+
n.checked = f;
|
|
282
358
|
return;
|
|
283
359
|
default:
|
|
284
|
-
|
|
360
|
+
n[t] = f;
|
|
285
361
|
}
|
|
286
362
|
}
|
|
287
|
-
function
|
|
288
|
-
switch (
|
|
363
|
+
function C(n) {
|
|
364
|
+
switch (n) {
|
|
289
365
|
case 7:
|
|
290
366
|
return 1;
|
|
291
367
|
case 1:
|
|
@@ -311,17 +387,17 @@ function B(h) {
|
|
|
311
387
|
return 0;
|
|
312
388
|
}
|
|
313
389
|
}
|
|
314
|
-
function
|
|
390
|
+
function X(n, t) {
|
|
315
391
|
for (let f = 0; f < t.length; f++)
|
|
316
|
-
|
|
392
|
+
n.push(t[f]);
|
|
317
393
|
}
|
|
318
|
-
function
|
|
319
|
-
return
|
|
394
|
+
function yt(n) {
|
|
395
|
+
return n === "script" || n === "style" || n === "pre" || n === "textarea";
|
|
320
396
|
}
|
|
321
|
-
class
|
|
397
|
+
class zt {
|
|
322
398
|
constructor(t = 128) {
|
|
323
|
-
this._capacity = 0, this._n =
|
|
324
|
-
let f = this.alloc(
|
|
399
|
+
this._capacity = 0, this._n = $, this._meta = W, this._strings = H, this._size = 0, this._filled = 0;
|
|
400
|
+
let f = this.alloc(q(t > 32 ? t : 32));
|
|
325
401
|
this._filled === 0 && (f = this.fill(0)), f[0] = 0, f[
|
|
326
402
|
1
|
|
327
403
|
/* NodeField.start */
|
|
@@ -331,25 +407,25 @@ class nt {
|
|
|
331
407
|
] = 4294967295, this._size = 1;
|
|
332
408
|
}
|
|
333
409
|
alloc(t) {
|
|
334
|
-
const f = t *
|
|
410
|
+
const f = t * L;
|
|
335
411
|
let s, e = 0;
|
|
336
|
-
f <= 262144 ? (w + f > 1048576 && (
|
|
412
|
+
f <= 262144 ? (w + f > 1048576 && (y = K(1048576), w = 0, S(new Uint32Array(y), 0, ft)), s = y, e = w, w = e + f) : s = K(f);
|
|
337
413
|
const i = new Uint32Array(
|
|
338
414
|
s,
|
|
339
415
|
e,
|
|
340
416
|
t * 12
|
|
341
417
|
/* NodeField.stride */
|
|
342
418
|
);
|
|
343
|
-
return s ===
|
|
419
|
+
return s === y ? (m = i, this._filled = t) : this._filled = 0, this._capacity = t, this._n = i, i;
|
|
344
420
|
}
|
|
345
421
|
/** @internal */
|
|
346
422
|
own_strings() {
|
|
347
423
|
const t = this._strings;
|
|
348
|
-
return t ===
|
|
424
|
+
return t === H ? this._strings = [] : t;
|
|
349
425
|
}
|
|
350
426
|
/** gives the unused tail of the last slab carve back, a later push resizes */
|
|
351
427
|
trim() {
|
|
352
|
-
this._n ===
|
|
428
|
+
this._n === m && (w -= (this._capacity - this._size) * L, this._capacity = this._size, this._filled = this._size);
|
|
353
429
|
}
|
|
354
430
|
/** clear nodes without reallocating storage */
|
|
355
431
|
reset() {
|
|
@@ -360,7 +436,7 @@ class nt {
|
|
|
360
436
|
const f = this._n;
|
|
361
437
|
for (let s = 0; s < t; ) {
|
|
362
438
|
let e = t - s;
|
|
363
|
-
e >
|
|
439
|
+
e > N && (e = N), f.copyWithin(
|
|
364
440
|
s * 12,
|
|
365
441
|
t * 12,
|
|
366
442
|
(t + e) * 12
|
|
@@ -368,7 +444,7 @@ class nt {
|
|
|
368
444
|
), s += e;
|
|
369
445
|
}
|
|
370
446
|
} else
|
|
371
|
-
|
|
447
|
+
S(this._n, 0, t);
|
|
372
448
|
this._size = 0;
|
|
373
449
|
}
|
|
374
450
|
}
|
|
@@ -396,15 +472,15 @@ class nt {
|
|
|
396
472
|
const r = this._size;
|
|
397
473
|
let _ = this._n;
|
|
398
474
|
r >= this._filled && (_ = this.fill(r));
|
|
399
|
-
const
|
|
400
|
-
if (_[
|
|
401
|
-
|
|
475
|
+
const h = r * 12;
|
|
476
|
+
if (_[h] = t & 255 | (e & 65535) << 8, _[
|
|
477
|
+
h + 1
|
|
402
478
|
/* NodeField.start */
|
|
403
479
|
] = f, _[
|
|
404
|
-
|
|
480
|
+
h + 5
|
|
405
481
|
/* NodeField.parent */
|
|
406
482
|
] = s, i && (_[
|
|
407
|
-
|
|
483
|
+
h + 10
|
|
408
484
|
/* NodeField.pending */
|
|
409
485
|
] = 1), this._size = r + 1, s !== 4294967295) {
|
|
410
486
|
const a = s * 12, c = _[
|
|
@@ -418,7 +494,7 @@ class nt {
|
|
|
418
494
|
c * 12 + 6
|
|
419
495
|
/* NodeField.next */
|
|
420
496
|
] = r, _[
|
|
421
|
-
|
|
497
|
+
h + 7
|
|
422
498
|
/* NodeField.prev */
|
|
423
499
|
] = c), _[
|
|
424
500
|
a + 9
|
|
@@ -449,20 +525,20 @@ class nt {
|
|
|
449
525
|
r + 5
|
|
450
526
|
/* NodeField.parent */
|
|
451
527
|
] = s, this._size = e + 1;
|
|
452
|
-
const _ = s * 12,
|
|
528
|
+
const _ = s * 12, h = i[
|
|
453
529
|
_ + 9
|
|
454
530
|
/* NodeField.last_child */
|
|
455
531
|
];
|
|
456
|
-
return
|
|
532
|
+
return h === 4294967295 ? i[
|
|
457
533
|
_ + 8
|
|
458
534
|
/* NodeField.first_child */
|
|
459
535
|
] = e : (i[
|
|
460
|
-
|
|
536
|
+
h * 12 + 6
|
|
461
537
|
/* NodeField.next */
|
|
462
538
|
] = e, i[
|
|
463
539
|
r + 7
|
|
464
540
|
/* NodeField.prev */
|
|
465
|
-
] =
|
|
541
|
+
] = h), i[
|
|
466
542
|
_ + 9
|
|
467
543
|
/* NodeField.last_child */
|
|
468
544
|
] = e, e;
|
|
@@ -470,39 +546,39 @@ class nt {
|
|
|
470
546
|
/** a closed node with no extra and a value range, as open, value and close would leave it */
|
|
471
547
|
push_leaf(t, f, s, e, i, r) {
|
|
472
548
|
const _ = this._size;
|
|
473
|
-
let
|
|
474
|
-
_ >= this._filled && (
|
|
549
|
+
let h = this._n;
|
|
550
|
+
_ >= this._filled && (h = this.fill(_));
|
|
475
551
|
const a = _ * 12;
|
|
476
|
-
|
|
552
|
+
h[a] = t, h[
|
|
477
553
|
a + 1
|
|
478
554
|
/* NodeField.start */
|
|
479
|
-
] = f,
|
|
555
|
+
] = f, h[
|
|
480
556
|
a + 2
|
|
481
557
|
/* NodeField.end */
|
|
482
|
-
] = i,
|
|
558
|
+
] = i, h[
|
|
483
559
|
a + 3
|
|
484
560
|
/* NodeField.value_start */
|
|
485
|
-
] = s,
|
|
561
|
+
] = s, h[
|
|
486
562
|
a + 4
|
|
487
563
|
/* NodeField.value_end */
|
|
488
|
-
] = e,
|
|
564
|
+
] = e, h[
|
|
489
565
|
a + 5
|
|
490
566
|
/* NodeField.parent */
|
|
491
567
|
] = r, this._size = _ + 1;
|
|
492
|
-
const c = r * 12, o =
|
|
568
|
+
const c = r * 12, o = h[
|
|
493
569
|
c + 9
|
|
494
570
|
/* NodeField.last_child */
|
|
495
571
|
];
|
|
496
|
-
return o === 4294967295 ?
|
|
572
|
+
return o === 4294967295 ? h[
|
|
497
573
|
c + 8
|
|
498
574
|
/* NodeField.first_child */
|
|
499
|
-
] = _ : (
|
|
575
|
+
] = _ : (h[
|
|
500
576
|
o * 12 + 6
|
|
501
577
|
/* NodeField.next */
|
|
502
|
-
] = _,
|
|
578
|
+
] = _, h[
|
|
503
579
|
a + 7
|
|
504
580
|
/* NodeField.prev */
|
|
505
|
-
] = o),
|
|
581
|
+
] = o), h[
|
|
506
582
|
c + 9
|
|
507
583
|
/* NodeField.last_child */
|
|
508
584
|
] = _, _;
|
|
@@ -512,8 +588,8 @@ class nt {
|
|
|
512
588
|
t >= this._capacity && (f = this.grow());
|
|
513
589
|
let s = this._filled;
|
|
514
590
|
if (t >= s) {
|
|
515
|
-
let e = s + (s >
|
|
516
|
-
e > this._capacity && (e = this._capacity),
|
|
591
|
+
let e = s + (s > V ? s : V);
|
|
592
|
+
e > this._capacity && (e = this._capacity), S(f, s, e), this._filled = s = e;
|
|
517
593
|
}
|
|
518
594
|
return f;
|
|
519
595
|
}
|
|
@@ -561,9 +637,9 @@ class nt {
|
|
|
561
637
|
const _ = this.push_synthetic(f, 0, t, s, e);
|
|
562
638
|
if (i !== 4294967295) {
|
|
563
639
|
this.set_first_child(_, i), this.set_last_child(_, r);
|
|
564
|
-
let
|
|
565
|
-
for (;
|
|
566
|
-
this.set_parent(
|
|
640
|
+
let h = i;
|
|
641
|
+
for (; h !== 4294967295 && this.parent_at(h) === t; )
|
|
642
|
+
this.set_parent(h, _), h = this.next_at(h);
|
|
567
643
|
}
|
|
568
644
|
return _;
|
|
569
645
|
}
|
|
@@ -572,11 +648,11 @@ class nt {
|
|
|
572
648
|
* @returns buffer index of the wrapper
|
|
573
649
|
*/
|
|
574
650
|
wrap_node(t, f, s = 0, e = 0, i) {
|
|
575
|
-
const r = this.parent_at(t), _ = r !== 4294967295 && this.first_child_at(r) === t,
|
|
651
|
+
const r = this.parent_at(t), _ = r !== 4294967295 && this.first_child_at(r) === t, h = _ ? 4294967295 : this.prev_at(t);
|
|
576
652
|
let a = this.next_at(t);
|
|
577
653
|
a !== 4294967295 && this.parent_at(a) !== r && (a = 4294967295);
|
|
578
654
|
const c = this.push_synthetic(f, s, 4294967295, e, i);
|
|
579
|
-
return this.set_parent(c, r), this.set_prev(c,
|
|
655
|
+
return this.set_parent(c, r), this.set_prev(c, h), this.set_next(c, a), _ ? this.set_first_child(r, c) : h !== 4294967295 && this.set_next(h, c), a !== 4294967295 && this.set_prev(a, c), r !== 4294967295 && this.last_child_at(r) === t && this.set_last_child(r, c), this.set_parent(t, c), this.set_prev(t, 4294967295), this.set_next(t, 4294967295), this.set_first_child(c, t), this.set_last_child(c, t), c;
|
|
580
656
|
}
|
|
581
657
|
/** unlink a node, subtree and all, and make it the last child of another parent */
|
|
582
658
|
move_to_end(t, f) {
|
|
@@ -656,12 +732,12 @@ class nt {
|
|
|
656
732
|
this.unwrap_node(t);
|
|
657
733
|
return;
|
|
658
734
|
}
|
|
659
|
-
const
|
|
660
|
-
if (i === 33 &&
|
|
735
|
+
const h = _ === 0 || _ === 14 || _ === 16 || _ === 29 || _ === 32 || _ === 37;
|
|
736
|
+
if (i === 33 && h) {
|
|
661
737
|
this.unwrap_node(t);
|
|
662
738
|
return;
|
|
663
739
|
}
|
|
664
|
-
if (i === 2 &&
|
|
740
|
+
if (i === 2 && h) {
|
|
665
741
|
this.repair_block_html(t, f, s);
|
|
666
742
|
return;
|
|
667
743
|
}
|
|
@@ -678,11 +754,11 @@ class nt {
|
|
|
678
754
|
this.set_first_child(t, 4294967295), this.set_last_child(t, 4294967295);
|
|
679
755
|
return;
|
|
680
756
|
}
|
|
681
|
-
let A = a,
|
|
757
|
+
let A = a, v = a;
|
|
682
758
|
for (; A !== 4294967295 && this.parent_at(A) === t; )
|
|
683
|
-
this.set_parent(A, e),
|
|
684
|
-
const
|
|
685
|
-
this.set_next(t, a), this.set_prev(a, t),
|
|
759
|
+
this.set_parent(A, e), v = A, A = this.next_at(A);
|
|
760
|
+
const E = this.next_at(t);
|
|
761
|
+
this.set_next(t, a), this.set_prev(a, t), E !== 4294967295 && this.parent_at(E) === e ? (this.set_next(v, E), this.set_prev(E, v)) : this.set_next(v, 4294967295), this.last_child_at(e) === t && this.set_last_child(e, v), this.set_first_child(t, 4294967295), this.set_last_child(t, 4294967295);
|
|
686
762
|
return;
|
|
687
763
|
}
|
|
688
764
|
const c = this.delimiter_end_at(t, i);
|
|
@@ -696,17 +772,17 @@ class nt {
|
|
|
696
772
|
this.set_value_start(t, l), this.set_value_end(t, c === 4294967295 ? this.end_at(t) : c);
|
|
697
773
|
return;
|
|
698
774
|
}
|
|
699
|
-
let o = a,
|
|
775
|
+
let o = a, b = a;
|
|
700
776
|
for (; o !== 4294967295 && this.parent_at(o) === t; )
|
|
701
|
-
this.set_parent(o, e),
|
|
702
|
-
if (
|
|
777
|
+
this.set_parent(o, e), b = o, o = this.next_at(o);
|
|
778
|
+
if (b === a && this.kind_at(a) === 1 && (c === 4294967295 || this.value_start_at(a) === c)) {
|
|
703
779
|
this.set_value(t, this.start_at(t), this.value_end_at(a)), this.set_end(t, this.end_at(a)), this.set_first_child(t, 4294967295), this.set_last_child(t, 4294967295);
|
|
704
780
|
return;
|
|
705
781
|
}
|
|
706
782
|
const u = this.prev_at(a), p = this.sibling(t, e, !0);
|
|
707
|
-
this.set_next(t, a), this.set_prev(a, t), u !== 4294967295 && (this.set_next(u, t), this.set_prev(t, u)), this.set_next(
|
|
708
|
-
const g = this.start_at(t),
|
|
709
|
-
this.set_value(t, g,
|
|
783
|
+
this.set_next(t, a), this.set_prev(a, t), u !== 4294967295 && (this.set_next(u, t), this.set_prev(t, u)), this.set_next(b, p), p !== 4294967295 ? this.set_prev(p, b) : this.last_child_at(e) === t && this.set_last_child(e, b), this.set_first_child(t, 4294967295), this.set_last_child(t, 4294967295);
|
|
784
|
+
const g = this.start_at(t), k = c === 4294967295 ? this.start_at(a) : c;
|
|
785
|
+
this.set_value(t, g, k), this.set_end(t, k);
|
|
710
786
|
}
|
|
711
787
|
/** where the delimiter of a revoked inline node ends, none when only the parser knows its length */
|
|
712
788
|
delimiter_end_at(t, f) {
|
|
@@ -729,30 +805,30 @@ class nt {
|
|
|
729
805
|
this.unwrap_node(t);
|
|
730
806
|
return;
|
|
731
807
|
}
|
|
732
|
-
let
|
|
733
|
-
for (; a !== 4294967295 &&
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
const c =
|
|
737
|
-
|
|
738
|
-
let o = !0,
|
|
808
|
+
let h = [], a = this.sibling(t, e, !1);
|
|
809
|
+
for (; a !== 4294967295 && C(this.kind_at(a)) >= 2; )
|
|
810
|
+
h.push(a), a = this.sibling(a, e, !1);
|
|
811
|
+
h.reverse();
|
|
812
|
+
const c = h.length;
|
|
813
|
+
h.push(t);
|
|
814
|
+
let o = !0, b = !0;
|
|
739
815
|
const u = [];
|
|
740
816
|
let p = this.sibling(t, e, !0);
|
|
741
817
|
this.set_first_child(t, 4294967295), this.set_last_child(t, 4294967295), this.delete_metadata(t);
|
|
742
818
|
let g = r;
|
|
743
819
|
for (; g !== 4294967295 && this.parent_at(g) === t; ) {
|
|
744
|
-
const l = this.next_at(g), d =
|
|
745
|
-
d >= 2 ? (
|
|
820
|
+
const l = this.next_at(g), d = C(this.kind_at(g));
|
|
821
|
+
d >= 2 ? (h.push(g), d === 3 && (o = !0)) : (d === 1 && h.length !== 0 ? (b && this.tag_text(t, i, _, f, s), this.set_start(g, this.start_at(h[0])), this.adopt(g, h, !0)) : (b ? this.tag_paragraph(h, c, _, f, s) : this.run_paragraph(h, o), X(u, h)), u.push(g), h = [], o = !1, b = !1), g = l;
|
|
746
822
|
}
|
|
747
|
-
for (; p !== 4294967295 &&
|
|
748
|
-
|
|
749
|
-
|
|
823
|
+
for (; p !== 4294967295 && C(this.kind_at(p)) >= 2; )
|
|
824
|
+
C(this.kind_at(p)) === 3 && (o = !0), h.push(p), p = this.sibling(p, e, !0);
|
|
825
|
+
b ? this.tag_paragraph(h, c, _, f, s) : this.run_paragraph(h, o), X(u, h);
|
|
750
826
|
for (let l = 0; l < u.length; l++) {
|
|
751
827
|
const d = u[l];
|
|
752
828
|
this.set_parent(d, e), this.set_prev(d, l === 0 ? a : u[l - 1]), this.set_next(d, l + 1 < u.length ? u[l + 1] : p);
|
|
753
829
|
}
|
|
754
|
-
const
|
|
755
|
-
a === 4294967295 ? this.set_first_child(e, u[0]) : this.set_next(a, u[0]), p === 4294967295 ? this.set_last_child(e,
|
|
830
|
+
const k = u[u.length - 1];
|
|
831
|
+
a === 4294967295 ? this.set_first_child(e, u[0]) : this.set_next(a, u[0]), p === 4294967295 ? this.set_last_child(e, k) : this.set_prev(p, k);
|
|
756
832
|
}
|
|
757
833
|
/** the next or previous sibling under parent, a stale link is none */
|
|
758
834
|
sibling(t, f, s) {
|
|
@@ -776,8 +852,8 @@ class nt {
|
|
|
776
852
|
7
|
|
777
853
|
/* NodeKind.paragraph */
|
|
778
854
|
), this.set_start(r, this.start_at(t[0]));
|
|
779
|
-
const
|
|
780
|
-
this.tag_text(
|
|
855
|
+
const h = this.push(1, _);
|
|
856
|
+
this.tag_text(h, _, s, e, i), t[f] = h, this.wrap_run(r, t);
|
|
781
857
|
}
|
|
782
858
|
/** a run with text gets a paragraph, on return it is what goes under the parent */
|
|
783
859
|
run_paragraph(t, f) {
|
|
@@ -807,8 +883,8 @@ class nt {
|
|
|
807
883
|
return;
|
|
808
884
|
const i = s ? 4294967295 : this.last_child_at(t), r = s ? this.first_child_at(t) : 4294967295;
|
|
809
885
|
for (let _ = 0; _ < e; _++) {
|
|
810
|
-
const
|
|
811
|
-
this.set_parent(
|
|
886
|
+
const h = f[_];
|
|
887
|
+
this.set_parent(h, t), this.set_prev(h, _ === 0 ? i : f[_ - 1]), this.set_next(h, _ + 1 < e ? f[_ + 1] : r);
|
|
812
888
|
}
|
|
813
889
|
i === 4294967295 ? this.set_first_child(t, f[0]) : this.set_next(i, f[0]), r === 4294967295 ? this.set_last_child(t, f[e - 1]) : this.set_prev(r, f[e - 1]);
|
|
814
890
|
}
|
|
@@ -822,7 +898,7 @@ class nt {
|
|
|
822
898
|
}
|
|
823
899
|
pop() {
|
|
824
900
|
const t = --this._size;
|
|
825
|
-
|
|
901
|
+
S(this._n, t, t + 1);
|
|
826
902
|
}
|
|
827
903
|
/**
|
|
828
904
|
* remove a node from the tree and reparent its children to its parent.
|
|
@@ -832,8 +908,8 @@ class nt {
|
|
|
832
908
|
unwrap_node(t) {
|
|
833
909
|
const f = this.parent_at(t), s = this.first_child_at(t);
|
|
834
910
|
if (s === 4294967295) {
|
|
835
|
-
const
|
|
836
|
-
|
|
911
|
+
const h = this.prev_at(t), a = this.next_at(t);
|
|
912
|
+
h !== 4294967295 ? this.set_next(h, a) : f !== 4294967295 && this.set_first_child(f, a), a !== 4294967295 && this.set_prev(a, h), f !== 4294967295 && this.last_child_at(f) === t && this.set_last_child(f, h);
|
|
837
913
|
return;
|
|
838
914
|
}
|
|
839
915
|
let e = s, i = s;
|
|
@@ -1039,16 +1115,16 @@ class nt {
|
|
|
1039
1115
|
}
|
|
1040
1116
|
resize(t) {
|
|
1041
1117
|
const f = this._n, s = this._capacity * 12;
|
|
1042
|
-
if (f ===
|
|
1043
|
-
const r = w - s * 4, _ = t *
|
|
1118
|
+
if (f === m) {
|
|
1119
|
+
const r = w - s * 4, _ = t * L;
|
|
1044
1120
|
if (_ <= 262144 && r + _ <= 1048576) {
|
|
1045
|
-
const
|
|
1046
|
-
|
|
1121
|
+
const h = new Uint32Array(
|
|
1122
|
+
y,
|
|
1047
1123
|
r,
|
|
1048
1124
|
t * 12
|
|
1049
1125
|
/* NodeField.stride */
|
|
1050
1126
|
);
|
|
1051
|
-
return w = r + _,
|
|
1127
|
+
return w = r + _, m = h, this._capacity = t, this._filled = t, this._n = h, h;
|
|
1052
1128
|
}
|
|
1053
1129
|
}
|
|
1054
1130
|
const e = this.alloc(t), i = this._size;
|
|
@@ -1064,7 +1140,7 @@ class nt {
|
|
|
1064
1140
|
this._meta[i - 1] = f;
|
|
1065
1141
|
else {
|
|
1066
1142
|
const r = this._meta;
|
|
1067
|
-
r ===
|
|
1143
|
+
r === W ? (this._meta = [f], s[e] = 1) : s[e] = r.push(f);
|
|
1068
1144
|
}
|
|
1069
1145
|
}
|
|
1070
1146
|
metadata_at(t) {
|
|
@@ -1086,21 +1162,21 @@ class nt {
|
|
|
1086
1162
|
* @returns node
|
|
1087
1163
|
*/
|
|
1088
1164
|
get_node(t = 0) {
|
|
1089
|
-
const f = this.kind_at(t), s =
|
|
1165
|
+
const f = this.kind_at(t), s = et(f), e = s ? { [s]: this.extra_at(t) } : f === 8 && this.extra_at(t) === 1 ? { math: !0 } : {}, i = [];
|
|
1090
1166
|
let r = this.first_child_at(t);
|
|
1091
1167
|
for (; r !== 4294967295 && this.parent_at(r) === t; )
|
|
1092
1168
|
i.push(r), r = this.next_at(r);
|
|
1093
|
-
const _ = this.parent_at(t),
|
|
1169
|
+
const _ = this.parent_at(t), h = this.next_at(t), a = this.prev_at(t);
|
|
1094
1170
|
return {
|
|
1095
|
-
kind:
|
|
1171
|
+
kind: G(f),
|
|
1096
1172
|
start: this.start_at(t),
|
|
1097
1173
|
end: this.end_at(t),
|
|
1098
1174
|
metadata: {
|
|
1099
|
-
...this.metadata_at(t),
|
|
1175
|
+
...ht(this.metadata_at(t)),
|
|
1100
1176
|
...e
|
|
1101
1177
|
},
|
|
1102
1178
|
parent: _ === 4294967295 ? null : _,
|
|
1103
|
-
next:
|
|
1179
|
+
next: h === 4294967295 ? null : h,
|
|
1104
1180
|
prev: a === 4294967295 ? null : a,
|
|
1105
1181
|
value: [this.value_start_at(t), this.value_end_at(t)],
|
|
1106
1182
|
children: i,
|
|
@@ -1108,13 +1184,13 @@ class nt {
|
|
|
1108
1184
|
};
|
|
1109
1185
|
}
|
|
1110
1186
|
}
|
|
1111
|
-
class
|
|
1187
|
+
class Tt {
|
|
1112
1188
|
/**
|
|
1113
1189
|
* create a collector that records error indices encountered while parsing.
|
|
1114
1190
|
* @param initial_capacity requested starting capacity for error indices.
|
|
1115
1191
|
*/
|
|
1116
|
-
constructor(t =
|
|
1117
|
-
const f =
|
|
1192
|
+
constructor(t = st) {
|
|
1193
|
+
const f = q(t);
|
|
1118
1194
|
this.capacity = f, this.indices = new Uint32Array(f), this._size = 0;
|
|
1119
1195
|
}
|
|
1120
1196
|
/** clear previously stored errors. */
|
|
@@ -1151,17 +1227,26 @@ class ht {
|
|
|
1151
1227
|
}
|
|
1152
1228
|
}
|
|
1153
1229
|
export {
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1230
|
+
I as AttrSpans,
|
|
1231
|
+
Tt as ErrorCollector,
|
|
1232
|
+
U as HtmlMeta,
|
|
1233
|
+
zt as NodeBuffer,
|
|
1234
|
+
F as build_attrs,
|
|
1235
|
+
yt as is_raw_text_tag,
|
|
1236
|
+
G as kind_to_string,
|
|
1237
|
+
kt as make_meta,
|
|
1238
|
+
vt as merge_meta,
|
|
1239
|
+
lt as note_footnote,
|
|
1240
|
+
ut as note_math,
|
|
1241
|
+
ht as plain_meta,
|
|
1242
|
+
wt as spans_have,
|
|
1243
|
+
gt as spans_text,
|
|
1244
|
+
bt as store_attr_rec,
|
|
1245
|
+
xt as stored_attr_at,
|
|
1246
|
+
at as string_to_kind,
|
|
1247
|
+
ot as take_footnote,
|
|
1248
|
+
dt as take_info,
|
|
1249
|
+
pt as take_math,
|
|
1250
|
+
ct as take_src,
|
|
1251
|
+
At as unread_spans
|
|
1167
1252
|
};
|