@versini/sassysaint 8.3.3 → 8.3.4

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.
@@ -0,0 +1,1914 @@
1
+ import { convert as se, visitParents as Pe, unicodeWhitespace as I, unicodePunctuation as N, normalizeIdentifier as _, classifyCharacter as $, visit as Me, EXIT as _e, toString as ce, asciiAlphanumeric as Z, asciiAlpha as P, markdownLineEndingOrSpace as A, asciiControl as Oe, factorySpace as S, blankLine as je, splice as q, resolveAll as Be, markdownLineEnding as R, markdownSpace as L, combineExtensions as $e } from "./ChatBubbleAssistant.DDolAlrL.js";
2
+ import { longestStreak as We } from "./index.Cyw5OC0t.js";
3
+ function ne(e, n) {
4
+ const t = String(e);
5
+ if (typeof n != "string")
6
+ throw new TypeError("Expected character");
7
+ let i = 0, l = t.indexOf(n);
8
+ for (; l !== -1; )
9
+ i++, l = t.indexOf(n, l + n.length);
10
+ return i;
11
+ }
12
+ function qe(e) {
13
+ if (typeof e != "string")
14
+ throw new TypeError("Expected a string");
15
+ return e.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
16
+ }
17
+ function He(e, n, t) {
18
+ const l = se(t.ignore || []), a = Ue(n);
19
+ let r = -1;
20
+ for (; ++r < a.length; )
21
+ Pe(e, "text", c);
22
+ function c(u, m) {
23
+ let s = -1, p;
24
+ for (; ++s < m.length; ) {
25
+ const g = m[s], h = p ? p.children : void 0;
26
+ if (l(
27
+ g,
28
+ h ? h.indexOf(g) : void 0,
29
+ p
30
+ ))
31
+ return;
32
+ p = g;
33
+ }
34
+ if (p)
35
+ return o(u, m);
36
+ }
37
+ function o(u, m) {
38
+ const s = m[m.length - 1], p = a[r][0], g = a[r][1];
39
+ let h = 0;
40
+ const x = s.children.indexOf(u);
41
+ let k = !1, w = [];
42
+ p.lastIndex = 0;
43
+ let d = p.exec(u.value);
44
+ for (; d; ) {
45
+ const v = d.index, y = {
46
+ index: d.index,
47
+ input: d.input,
48
+ stack: [...m, u]
49
+ };
50
+ let C = g(...d, y);
51
+ if (typeof C == "string" && (C = C.length > 0 ? { type: "text", value: C } : void 0), C === !1 ? p.lastIndex = v + 1 : (h !== v && w.push({
52
+ type: "text",
53
+ value: u.value.slice(h, v)
54
+ }), Array.isArray(C) ? w.push(...C) : C && w.push(C), h = v + d[0].length, k = !0), !p.global)
55
+ break;
56
+ d = p.exec(u.value);
57
+ }
58
+ return k ? (h < u.value.length && w.push({ type: "text", value: u.value.slice(h) }), s.children.splice(x, 1, ...w)) : w = [u], x + w.length;
59
+ }
60
+ }
61
+ function Ue(e) {
62
+ const n = [];
63
+ if (!Array.isArray(e))
64
+ throw new TypeError("Expected find and replace tuple or list of tuples");
65
+ const t = !e[0] || Array.isArray(e[0]) ? e : [e];
66
+ let i = -1;
67
+ for (; ++i < t.length; ) {
68
+ const l = t[i];
69
+ n.push([Ve(l[0]), Ge(l[1])]);
70
+ }
71
+ return n;
72
+ }
73
+ function Ve(e) {
74
+ return typeof e == "string" ? new RegExp(qe(e), "g") : e;
75
+ }
76
+ function Ge(e) {
77
+ return typeof e == "function" ? e : function() {
78
+ return e;
79
+ };
80
+ }
81
+ const H = "phrasing", U = ["autolink", "link", "image", "label"];
82
+ function Qe() {
83
+ return {
84
+ transforms: [et],
85
+ enter: {
86
+ literalAutolink: Ze,
87
+ literalAutolinkEmail: V,
88
+ literalAutolinkHttp: V,
89
+ literalAutolinkWww: V
90
+ },
91
+ exit: {
92
+ literalAutolink: Ye,
93
+ literalAutolinkEmail: Xe,
94
+ literalAutolinkHttp: Je,
95
+ literalAutolinkWww: Ke
96
+ }
97
+ };
98
+ }
99
+ function Ne() {
100
+ return {
101
+ unsafe: [
102
+ {
103
+ character: "@",
104
+ before: "[+\\-.\\w]",
105
+ after: "[\\-.\\w]",
106
+ inConstruct: H,
107
+ notInConstruct: U
108
+ },
109
+ {
110
+ character: ".",
111
+ before: "[Ww]",
112
+ after: "[\\-.\\w]",
113
+ inConstruct: H,
114
+ notInConstruct: U
115
+ },
116
+ {
117
+ character: ":",
118
+ before: "[ps]",
119
+ after: "\\/",
120
+ inConstruct: H,
121
+ notInConstruct: U
122
+ }
123
+ ]
124
+ };
125
+ }
126
+ function Ze(e) {
127
+ this.enter({ type: "link", title: null, url: "", children: [] }, e);
128
+ }
129
+ function V(e) {
130
+ this.config.enter.autolinkProtocol.call(this, e);
131
+ }
132
+ function Je(e) {
133
+ this.config.exit.autolinkProtocol.call(this, e);
134
+ }
135
+ function Ke(e) {
136
+ this.config.exit.data.call(this, e);
137
+ const n = this.stack[this.stack.length - 1];
138
+ n.url = "http://" + this.sliceSerialize(e);
139
+ }
140
+ function Xe(e) {
141
+ this.config.exit.autolinkEmail.call(this, e);
142
+ }
143
+ function Ye(e) {
144
+ this.exit(e);
145
+ }
146
+ function et(e) {
147
+ He(
148
+ e,
149
+ [
150
+ [/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi, tt],
151
+ [new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)", "gu"), nt]
152
+ ],
153
+ { ignore: ["link", "linkReference"] }
154
+ );
155
+ }
156
+ function tt(e, n, t, i, l) {
157
+ let a = "";
158
+ if (!fe(l) || (/^w/i.test(n) && (t = n + t, n = "", a = "http://"), !rt(t)))
159
+ return !1;
160
+ const r = it(t + i);
161
+ if (!r[0]) return !1;
162
+ const c = {
163
+ type: "link",
164
+ title: null,
165
+ url: a + n + r[0],
166
+ children: [{ type: "text", value: n + r[0] }]
167
+ };
168
+ return r[1] ? [c, { type: "text", value: r[1] }] : c;
169
+ }
170
+ function nt(e, n, t, i) {
171
+ return (
172
+ // Not an expected previous character.
173
+ !fe(i, !0) || // Label ends in not allowed character.
174
+ /[-\d_]$/.test(t) ? !1 : {
175
+ type: "link",
176
+ title: null,
177
+ url: "mailto:" + n + "@" + t,
178
+ children: [{ type: "text", value: n + "@" + t }]
179
+ }
180
+ );
181
+ }
182
+ function rt(e) {
183
+ const n = e.split(".");
184
+ return !(n.length < 2 || n[n.length - 1] && (/_/.test(n[n.length - 1]) || !/[a-zA-Z\d]/.test(n[n.length - 1])) || n[n.length - 2] && (/_/.test(n[n.length - 2]) || !/[a-zA-Z\d]/.test(n[n.length - 2])));
185
+ }
186
+ function it(e) {
187
+ const n = /[!"&'),.:;<>?\]}]+$/.exec(e);
188
+ if (!n)
189
+ return [e, void 0];
190
+ e = e.slice(0, n.index);
191
+ let t = n[0], i = t.indexOf(")");
192
+ const l = ne(e, "(");
193
+ let a = ne(e, ")");
194
+ for (; i !== -1 && l > a; )
195
+ e += t.slice(0, i + 1), t = t.slice(i + 1), i = t.indexOf(")"), a++;
196
+ return [e, t];
197
+ }
198
+ function fe(e, n) {
199
+ const t = e.input.charCodeAt(e.index - 1);
200
+ return (e.index === 0 || I(t) || N(t)) && // If it’s an email, the previous character should not be a slash.
201
+ (!n || t !== 47);
202
+ }
203
+ he.peek = gt;
204
+ function lt() {
205
+ return {
206
+ enter: {
207
+ gfmFootnoteDefinition: at,
208
+ gfmFootnoteDefinitionLabelString: ut,
209
+ gfmFootnoteCall: ft,
210
+ gfmFootnoteCallString: ht
211
+ },
212
+ exit: {
213
+ gfmFootnoteDefinition: ct,
214
+ gfmFootnoteDefinitionLabelString: st,
215
+ gfmFootnoteCall: pt,
216
+ gfmFootnoteCallString: mt
217
+ }
218
+ };
219
+ }
220
+ function ot() {
221
+ return {
222
+ // This is on by default already.
223
+ unsafe: [{ character: "[", inConstruct: ["phrasing", "label", "reference"] }],
224
+ handlers: { footnoteDefinition: kt, footnoteReference: he }
225
+ };
226
+ }
227
+ function at(e) {
228
+ this.enter(
229
+ { type: "footnoteDefinition", identifier: "", label: "", children: [] },
230
+ e
231
+ );
232
+ }
233
+ function ut() {
234
+ this.buffer();
235
+ }
236
+ function st(e) {
237
+ const n = this.resume(), t = this.stack[this.stack.length - 1];
238
+ t.label = n, t.identifier = _(
239
+ this.sliceSerialize(e)
240
+ ).toLowerCase();
241
+ }
242
+ function ct(e) {
243
+ this.exit(e);
244
+ }
245
+ function ft(e) {
246
+ this.enter({ type: "footnoteReference", identifier: "", label: "" }, e);
247
+ }
248
+ function ht() {
249
+ this.buffer();
250
+ }
251
+ function mt(e) {
252
+ const n = this.resume(), t = this.stack[this.stack.length - 1];
253
+ t.label = n, t.identifier = _(
254
+ this.sliceSerialize(e)
255
+ ).toLowerCase();
256
+ }
257
+ function pt(e) {
258
+ this.exit(e);
259
+ }
260
+ function he(e, n, t, i) {
261
+ const l = t.createTracker(i);
262
+ let a = l.move("[^");
263
+ const r = t.enter("footnoteReference"), c = t.enter("reference");
264
+ return a += l.move(
265
+ t.safe(t.associationId(e), {
266
+ ...l.current(),
267
+ before: a,
268
+ after: "]"
269
+ })
270
+ ), c(), r(), a += l.move("]"), a;
271
+ }
272
+ function gt() {
273
+ return "[";
274
+ }
275
+ function kt(e, n, t, i) {
276
+ const l = t.createTracker(i);
277
+ let a = l.move("[^");
278
+ const r = t.enter("footnoteDefinition"), c = t.enter("label");
279
+ return a += l.move(
280
+ t.safe(t.associationId(e), {
281
+ ...l.current(),
282
+ before: a,
283
+ after: "]"
284
+ })
285
+ ), c(), a += l.move(
286
+ "]:" + (e.children && e.children.length > 0 ? " " : "")
287
+ ), l.shift(4), a += l.move(
288
+ t.indentLines(t.containerFlow(e, l.current()), bt)
289
+ ), r(), a;
290
+ }
291
+ function bt(e, n, t) {
292
+ return n === 0 ? e : (t ? "" : " ") + e;
293
+ }
294
+ const xt = [
295
+ "autolink",
296
+ "destinationLiteral",
297
+ "destinationRaw",
298
+ "reference",
299
+ "titleQuote",
300
+ "titleApostrophe"
301
+ ];
302
+ me.peek = vt;
303
+ function wt() {
304
+ return {
305
+ canContainEols: ["delete"],
306
+ enter: { strikethrough: Ct },
307
+ exit: { strikethrough: yt }
308
+ };
309
+ }
310
+ function dt() {
311
+ return {
312
+ unsafe: [
313
+ {
314
+ character: "~",
315
+ inConstruct: "phrasing",
316
+ notInConstruct: xt
317
+ }
318
+ ],
319
+ handlers: { delete: me }
320
+ };
321
+ }
322
+ function Ct(e) {
323
+ this.enter({ type: "delete", children: [] }, e);
324
+ }
325
+ function yt(e) {
326
+ this.exit(e);
327
+ }
328
+ function me(e, n, t, i) {
329
+ const l = t.createTracker(i), a = t.enter("strikethrough");
330
+ let r = l.move("~~");
331
+ return r += t.containerPhrasing(e, {
332
+ ...l.current(),
333
+ before: r,
334
+ after: "~"
335
+ }), r += l.move("~~"), a(), r;
336
+ }
337
+ function vt() {
338
+ return "~";
339
+ }
340
+ function At(e) {
341
+ return e.length;
342
+ }
343
+ function Dt(e, n) {
344
+ const t = n, i = (t.align || []).concat(), l = t.stringLength || At, a = [], r = [], c = [], o = [];
345
+ let u = 0, m = -1;
346
+ for (; ++m < e.length; ) {
347
+ const b = [], x = [];
348
+ let k = -1;
349
+ for (e[m].length > u && (u = e[m].length); ++k < e[m].length; ) {
350
+ const w = Ft(e[m][k]);
351
+ if (t.alignDelimiters !== !1) {
352
+ const d = l(w);
353
+ x[k] = d, (o[k] === void 0 || d > o[k]) && (o[k] = d);
354
+ }
355
+ b.push(w);
356
+ }
357
+ r[m] = b, c[m] = x;
358
+ }
359
+ let s = -1;
360
+ if (typeof i == "object" && "length" in i)
361
+ for (; ++s < u; )
362
+ a[s] = re(i[s]);
363
+ else {
364
+ const b = re(i);
365
+ for (; ++s < u; )
366
+ a[s] = b;
367
+ }
368
+ s = -1;
369
+ const p = [], g = [];
370
+ for (; ++s < u; ) {
371
+ const b = a[s];
372
+ let x = "", k = "";
373
+ b === 99 ? (x = ":", k = ":") : b === 108 ? x = ":" : b === 114 && (k = ":");
374
+ let w = t.alignDelimiters === !1 ? 1 : Math.max(
375
+ 1,
376
+ o[s] - x.length - k.length
377
+ );
378
+ const d = x + "-".repeat(w) + k;
379
+ t.alignDelimiters !== !1 && (w = x.length + w + k.length, w > o[s] && (o[s] = w), g[s] = w), p[s] = d;
380
+ }
381
+ r.splice(1, 0, p), c.splice(1, 0, g), m = -1;
382
+ const h = [];
383
+ for (; ++m < r.length; ) {
384
+ const b = r[m], x = c[m];
385
+ s = -1;
386
+ const k = [];
387
+ for (; ++s < u; ) {
388
+ const w = b[s] || "";
389
+ let d = "", v = "";
390
+ if (t.alignDelimiters !== !1) {
391
+ const y = o[s] - (x[s] || 0), C = a[s];
392
+ C === 114 ? d = " ".repeat(y) : C === 99 ? y % 2 ? (d = " ".repeat(y / 2 + 0.5), v = " ".repeat(y / 2 - 0.5)) : (d = " ".repeat(y / 2), v = d) : v = " ".repeat(y);
393
+ }
394
+ t.delimiterStart !== !1 && !s && k.push("|"), t.padding !== !1 && // Don’t add the opening space if we’re not aligning and the cell is
395
+ // empty: there will be a closing space.
396
+ !(t.alignDelimiters === !1 && w === "") && (t.delimiterStart !== !1 || s) && k.push(" "), t.alignDelimiters !== !1 && k.push(d), k.push(w), t.alignDelimiters !== !1 && k.push(v), t.padding !== !1 && k.push(" "), (t.delimiterEnd !== !1 || s !== u - 1) && k.push("|");
397
+ }
398
+ h.push(
399
+ t.delimiterEnd === !1 ? k.join("").replace(/ +$/, "") : k.join("")
400
+ );
401
+ }
402
+ return h.join(`
403
+ `);
404
+ }
405
+ function Ft(e) {
406
+ return e == null ? "" : String(e);
407
+ }
408
+ function re(e) {
409
+ const n = typeof e == "string" ? e.codePointAt(0) : 0;
410
+ return n === 67 || n === 99 ? 99 : n === 76 || n === 108 ? 108 : n === 82 || n === 114 ? 114 : 0;
411
+ }
412
+ function St(e, n, t, i) {
413
+ const l = t.enter("blockquote"), a = t.createTracker(i);
414
+ a.move("> "), a.shift(2);
415
+ const r = t.indentLines(
416
+ t.containerFlow(e, a.current()),
417
+ Tt
418
+ );
419
+ return l(), r;
420
+ }
421
+ function Tt(e, n, t) {
422
+ return ">" + (t ? "" : " ") + e;
423
+ }
424
+ function Lt(e, n) {
425
+ return ie(e, n.inConstruct, !0) && !ie(e, n.notInConstruct, !1);
426
+ }
427
+ function ie(e, n, t) {
428
+ if (typeof n == "string" && (n = [n]), !n || n.length === 0)
429
+ return t;
430
+ let i = -1;
431
+ for (; ++i < n.length; )
432
+ if (e.includes(n[i]))
433
+ return !0;
434
+ return !1;
435
+ }
436
+ function le(e, n, t, i) {
437
+ let l = -1;
438
+ for (; ++l < t.unsafe.length; )
439
+ if (t.unsafe[l].character === `
440
+ ` && Lt(t.stack, t.unsafe[l]))
441
+ return /[ \t]/.test(i.before) ? "" : " ";
442
+ return `\\
443
+ `;
444
+ }
445
+ function zt(e, n) {
446
+ return !!(n.options.fences === !1 && e.value && // If there’s no info…
447
+ !e.lang && // And there’s a non-whitespace character…
448
+ /[^ \r\n]/.test(e.value) && // And the value doesn’t start or end in a blank…
449
+ !/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value));
450
+ }
451
+ function It(e) {
452
+ const n = e.options.fence || "`";
453
+ if (n !== "`" && n !== "~")
454
+ throw new Error(
455
+ "Cannot serialize code with `" + n + "` for `options.fence`, expected `` ` `` or `~`"
456
+ );
457
+ return n;
458
+ }
459
+ function Et(e, n, t, i) {
460
+ const l = It(t), a = e.value || "", r = l === "`" ? "GraveAccent" : "Tilde";
461
+ if (zt(e, t)) {
462
+ const s = t.enter("codeIndented"), p = t.indentLines(a, Rt);
463
+ return s(), p;
464
+ }
465
+ const c = t.createTracker(i), o = l.repeat(Math.max(We(a, l) + 1, 3)), u = t.enter("codeFenced");
466
+ let m = c.move(o);
467
+ if (e.lang) {
468
+ const s = t.enter(`codeFencedLang${r}`);
469
+ m += c.move(
470
+ t.safe(e.lang, {
471
+ before: m,
472
+ after: " ",
473
+ encode: ["`"],
474
+ ...c.current()
475
+ })
476
+ ), s();
477
+ }
478
+ if (e.lang && e.meta) {
479
+ const s = t.enter(`codeFencedMeta${r}`);
480
+ m += c.move(" "), m += c.move(
481
+ t.safe(e.meta, {
482
+ before: m,
483
+ after: `
484
+ `,
485
+ encode: ["`"],
486
+ ...c.current()
487
+ })
488
+ ), s();
489
+ }
490
+ return m += c.move(`
491
+ `), a && (m += c.move(a + `
492
+ `)), m += c.move(o), u(), m;
493
+ }
494
+ function Rt(e, n, t) {
495
+ return (t ? "" : " ") + e;
496
+ }
497
+ function J(e) {
498
+ const n = e.options.quote || '"';
499
+ if (n !== '"' && n !== "'")
500
+ throw new Error(
501
+ "Cannot serialize title with `" + n + "` for `options.quote`, expected `\"`, or `'`"
502
+ );
503
+ return n;
504
+ }
505
+ function Pt(e, n, t, i) {
506
+ const l = J(t), a = l === '"' ? "Quote" : "Apostrophe", r = t.enter("definition");
507
+ let c = t.enter("label");
508
+ const o = t.createTracker(i);
509
+ let u = o.move("[");
510
+ return u += o.move(
511
+ t.safe(t.associationId(e), {
512
+ before: u,
513
+ after: "]",
514
+ ...o.current()
515
+ })
516
+ ), u += o.move("]: "), c(), // If there’s no url, or…
517
+ !e.url || // If there are control characters or whitespace.
518
+ /[\0- \u007F]/.test(e.url) ? (c = t.enter("destinationLiteral"), u += o.move("<"), u += o.move(
519
+ t.safe(e.url, { before: u, after: ">", ...o.current() })
520
+ ), u += o.move(">")) : (c = t.enter("destinationRaw"), u += o.move(
521
+ t.safe(e.url, {
522
+ before: u,
523
+ after: e.title ? " " : `
524
+ `,
525
+ ...o.current()
526
+ })
527
+ )), c(), e.title && (c = t.enter(`title${a}`), u += o.move(" " + l), u += o.move(
528
+ t.safe(e.title, {
529
+ before: u,
530
+ after: l,
531
+ ...o.current()
532
+ })
533
+ ), u += o.move(l), c()), r(), u;
534
+ }
535
+ function Mt(e) {
536
+ const n = e.options.emphasis || "*";
537
+ if (n !== "*" && n !== "_")
538
+ throw new Error(
539
+ "Cannot serialize emphasis with `" + n + "` for `options.emphasis`, expected `*`, or `_`"
540
+ );
541
+ return n;
542
+ }
543
+ function M(e) {
544
+ return "&#x" + e.toString(16).toUpperCase() + ";";
545
+ }
546
+ function W(e, n, t) {
547
+ const i = $(e), l = $(n);
548
+ return i === void 0 ? l === void 0 ? (
549
+ // Letter inside:
550
+ // we have to encode *both* letters for `_` as it is looser.
551
+ // it already forms for `*` (and GFMs `~`).
552
+ t === "_" ? { inside: !0, outside: !0 } : { inside: !1, outside: !1 }
553
+ ) : l === 1 ? (
554
+ // Whitespace inside: encode both (letter, whitespace).
555
+ { inside: !0, outside: !0 }
556
+ ) : (
557
+ // Punctuation inside: encode outer (letter)
558
+ { inside: !1, outside: !0 }
559
+ ) : i === 1 ? l === void 0 ? (
560
+ // Letter inside: already forms.
561
+ { inside: !1, outside: !1 }
562
+ ) : l === 1 ? (
563
+ // Whitespace inside: encode both (whitespace).
564
+ { inside: !0, outside: !0 }
565
+ ) : (
566
+ // Punctuation inside: already forms.
567
+ { inside: !1, outside: !1 }
568
+ ) : l === void 0 ? (
569
+ // Letter inside: already forms.
570
+ { inside: !1, outside: !1 }
571
+ ) : l === 1 ? (
572
+ // Whitespace inside: encode inner (whitespace).
573
+ { inside: !0, outside: !1 }
574
+ ) : (
575
+ // Punctuation inside: already forms.
576
+ { inside: !1, outside: !1 }
577
+ );
578
+ }
579
+ pe.peek = _t;
580
+ function pe(e, n, t, i) {
581
+ const l = Mt(t), a = t.enter("emphasis"), r = t.createTracker(i), c = r.move(l);
582
+ let o = r.move(
583
+ t.containerPhrasing(e, {
584
+ after: l,
585
+ before: c,
586
+ ...r.current()
587
+ })
588
+ );
589
+ const u = o.charCodeAt(0), m = W(
590
+ i.before.charCodeAt(i.before.length - 1),
591
+ u,
592
+ l
593
+ );
594
+ m.inside && (o = M(u) + o.slice(1));
595
+ const s = o.charCodeAt(o.length - 1), p = W(i.after.charCodeAt(0), s, l);
596
+ p.inside && (o = o.slice(0, -1) + M(s));
597
+ const g = r.move(l);
598
+ return a(), t.attentionEncodeSurroundingInfo = {
599
+ after: p.outside,
600
+ before: m.outside
601
+ }, c + o + g;
602
+ }
603
+ function _t(e, n, t) {
604
+ return t.options.emphasis || "*";
605
+ }
606
+ function Ot(e, n) {
607
+ let t = !1;
608
+ return Me(e, function(i) {
609
+ if ("value" in i && /\r?\n|\r/.test(i.value) || i.type === "break")
610
+ return t = !0, _e;
611
+ }), !!((!e.depth || e.depth < 3) && ce(e) && (n.options.setext || t));
612
+ }
613
+ function jt(e, n, t, i) {
614
+ const l = Math.max(Math.min(6, e.depth || 1), 1), a = t.createTracker(i);
615
+ if (Ot(e, t)) {
616
+ const m = t.enter("headingSetext"), s = t.enter("phrasing"), p = t.containerPhrasing(e, {
617
+ ...a.current(),
618
+ before: `
619
+ `,
620
+ after: `
621
+ `
622
+ });
623
+ return s(), m(), p + `
624
+ ` + (l === 1 ? "=" : "-").repeat(
625
+ // The whole size…
626
+ p.length - // Minus the position of the character after the last EOL (or
627
+ // 0 if there is none)…
628
+ (Math.max(p.lastIndexOf("\r"), p.lastIndexOf(`
629
+ `)) + 1)
630
+ );
631
+ }
632
+ const r = "#".repeat(l), c = t.enter("headingAtx"), o = t.enter("phrasing");
633
+ a.move(r + " ");
634
+ let u = t.containerPhrasing(e, {
635
+ before: "# ",
636
+ after: `
637
+ `,
638
+ ...a.current()
639
+ });
640
+ return /^[\t ]/.test(u) && (u = M(u.charCodeAt(0)) + u.slice(1)), u = u ? r + " " + u : r, t.options.closeAtx && (u += " " + r), o(), c(), u;
641
+ }
642
+ ge.peek = Bt;
643
+ function ge(e) {
644
+ return e.value || "";
645
+ }
646
+ function Bt() {
647
+ return "<";
648
+ }
649
+ ke.peek = $t;
650
+ function ke(e, n, t, i) {
651
+ const l = J(t), a = l === '"' ? "Quote" : "Apostrophe", r = t.enter("image");
652
+ let c = t.enter("label");
653
+ const o = t.createTracker(i);
654
+ let u = o.move("![");
655
+ return u += o.move(
656
+ t.safe(e.alt, { before: u, after: "]", ...o.current() })
657
+ ), u += o.move("]("), c(), // If there’s no url but there is a title…
658
+ !e.url && e.title || // If there are control characters or whitespace.
659
+ /[\0- \u007F]/.test(e.url) ? (c = t.enter("destinationLiteral"), u += o.move("<"), u += o.move(
660
+ t.safe(e.url, { before: u, after: ">", ...o.current() })
661
+ ), u += o.move(">")) : (c = t.enter("destinationRaw"), u += o.move(
662
+ t.safe(e.url, {
663
+ before: u,
664
+ after: e.title ? " " : ")",
665
+ ...o.current()
666
+ })
667
+ )), c(), e.title && (c = t.enter(`title${a}`), u += o.move(" " + l), u += o.move(
668
+ t.safe(e.title, {
669
+ before: u,
670
+ after: l,
671
+ ...o.current()
672
+ })
673
+ ), u += o.move(l), c()), u += o.move(")"), r(), u;
674
+ }
675
+ function $t() {
676
+ return "!";
677
+ }
678
+ be.peek = Wt;
679
+ function be(e, n, t, i) {
680
+ const l = e.referenceType, a = t.enter("imageReference");
681
+ let r = t.enter("label");
682
+ const c = t.createTracker(i);
683
+ let o = c.move("![");
684
+ const u = t.safe(e.alt, {
685
+ before: o,
686
+ after: "]",
687
+ ...c.current()
688
+ });
689
+ o += c.move(u + "]["), r();
690
+ const m = t.stack;
691
+ t.stack = [], r = t.enter("reference");
692
+ const s = t.safe(t.associationId(e), {
693
+ before: o,
694
+ after: "]",
695
+ ...c.current()
696
+ });
697
+ return r(), t.stack = m, a(), l === "full" || !u || u !== s ? o += c.move(s + "]") : l === "shortcut" ? o = o.slice(0, -1) : o += c.move("]"), o;
698
+ }
699
+ function Wt() {
700
+ return "!";
701
+ }
702
+ xe.peek = qt;
703
+ function xe(e, n, t) {
704
+ let i = e.value || "", l = "`", a = -1;
705
+ for (; new RegExp("(^|[^`])" + l + "([^`]|$)").test(i); )
706
+ l += "`";
707
+ for (/[^ \r\n]/.test(i) && (/^[ \r\n]/.test(i) && /[ \r\n]$/.test(i) || /^`|`$/.test(i)) && (i = " " + i + " "); ++a < t.unsafe.length; ) {
708
+ const r = t.unsafe[a], c = t.compilePattern(r);
709
+ let o;
710
+ if (r.atBreak)
711
+ for (; o = c.exec(i); ) {
712
+ let u = o.index;
713
+ i.charCodeAt(u) === 10 && i.charCodeAt(u - 1) === 13 && u--, i = i.slice(0, u) + " " + i.slice(o.index + 1);
714
+ }
715
+ }
716
+ return l + i + l;
717
+ }
718
+ function qt() {
719
+ return "`";
720
+ }
721
+ function we(e, n) {
722
+ const t = ce(e);
723
+ return !!(!n.options.resourceLink && // If there’s a url…
724
+ e.url && // And there’s a no title…
725
+ !e.title && // And the content of `node` is a single text node…
726
+ e.children && e.children.length === 1 && e.children[0].type === "text" && // And if the url is the same as the content…
727
+ (t === e.url || "mailto:" + t === e.url) && // And that starts w/ a protocol…
728
+ /^[a-z][a-z+.-]+:/i.test(e.url) && // And that doesn’t contain ASCII control codes (character escapes and
729
+ // references don’t work), space, or angle brackets…
730
+ !/[\0- <>\u007F]/.test(e.url));
731
+ }
732
+ de.peek = Ht;
733
+ function de(e, n, t, i) {
734
+ const l = J(t), a = l === '"' ? "Quote" : "Apostrophe", r = t.createTracker(i);
735
+ let c, o;
736
+ if (we(e, t)) {
737
+ const m = t.stack;
738
+ t.stack = [], c = t.enter("autolink");
739
+ let s = r.move("<");
740
+ return s += r.move(
741
+ t.containerPhrasing(e, {
742
+ before: s,
743
+ after: ">",
744
+ ...r.current()
745
+ })
746
+ ), s += r.move(">"), c(), t.stack = m, s;
747
+ }
748
+ c = t.enter("link"), o = t.enter("label");
749
+ let u = r.move("[");
750
+ return u += r.move(
751
+ t.containerPhrasing(e, {
752
+ before: u,
753
+ after: "](",
754
+ ...r.current()
755
+ })
756
+ ), u += r.move("]("), o(), // If there’s no url but there is a title…
757
+ !e.url && e.title || // If there are control characters or whitespace.
758
+ /[\0- \u007F]/.test(e.url) ? (o = t.enter("destinationLiteral"), u += r.move("<"), u += r.move(
759
+ t.safe(e.url, { before: u, after: ">", ...r.current() })
760
+ ), u += r.move(">")) : (o = t.enter("destinationRaw"), u += r.move(
761
+ t.safe(e.url, {
762
+ before: u,
763
+ after: e.title ? " " : ")",
764
+ ...r.current()
765
+ })
766
+ )), o(), e.title && (o = t.enter(`title${a}`), u += r.move(" " + l), u += r.move(
767
+ t.safe(e.title, {
768
+ before: u,
769
+ after: l,
770
+ ...r.current()
771
+ })
772
+ ), u += r.move(l), o()), u += r.move(")"), c(), u;
773
+ }
774
+ function Ht(e, n, t) {
775
+ return we(e, t) ? "<" : "[";
776
+ }
777
+ Ce.peek = Ut;
778
+ function Ce(e, n, t, i) {
779
+ const l = e.referenceType, a = t.enter("linkReference");
780
+ let r = t.enter("label");
781
+ const c = t.createTracker(i);
782
+ let o = c.move("[");
783
+ const u = t.containerPhrasing(e, {
784
+ before: o,
785
+ after: "]",
786
+ ...c.current()
787
+ });
788
+ o += c.move(u + "]["), r();
789
+ const m = t.stack;
790
+ t.stack = [], r = t.enter("reference");
791
+ const s = t.safe(t.associationId(e), {
792
+ before: o,
793
+ after: "]",
794
+ ...c.current()
795
+ });
796
+ return r(), t.stack = m, a(), l === "full" || !u || u !== s ? o += c.move(s + "]") : l === "shortcut" ? o = o.slice(0, -1) : o += c.move("]"), o;
797
+ }
798
+ function Ut() {
799
+ return "[";
800
+ }
801
+ function K(e) {
802
+ const n = e.options.bullet || "*";
803
+ if (n !== "*" && n !== "+" && n !== "-")
804
+ throw new Error(
805
+ "Cannot serialize items with `" + n + "` for `options.bullet`, expected `*`, `+`, or `-`"
806
+ );
807
+ return n;
808
+ }
809
+ function Vt(e) {
810
+ const n = K(e), t = e.options.bulletOther;
811
+ if (!t)
812
+ return n === "*" ? "-" : "*";
813
+ if (t !== "*" && t !== "+" && t !== "-")
814
+ throw new Error(
815
+ "Cannot serialize items with `" + t + "` for `options.bulletOther`, expected `*`, `+`, or `-`"
816
+ );
817
+ if (t === n)
818
+ throw new Error(
819
+ "Expected `bullet` (`" + n + "`) and `bulletOther` (`" + t + "`) to be different"
820
+ );
821
+ return t;
822
+ }
823
+ function Gt(e) {
824
+ const n = e.options.bulletOrdered || ".";
825
+ if (n !== "." && n !== ")")
826
+ throw new Error(
827
+ "Cannot serialize items with `" + n + "` for `options.bulletOrdered`, expected `.` or `)`"
828
+ );
829
+ return n;
830
+ }
831
+ function ye(e) {
832
+ const n = e.options.rule || "*";
833
+ if (n !== "*" && n !== "-" && n !== "_")
834
+ throw new Error(
835
+ "Cannot serialize rules with `" + n + "` for `options.rule`, expected `*`, `-`, or `_`"
836
+ );
837
+ return n;
838
+ }
839
+ function Qt(e, n, t, i) {
840
+ const l = t.enter("list"), a = t.bulletCurrent;
841
+ let r = e.ordered ? Gt(t) : K(t);
842
+ const c = e.ordered ? r === "." ? ")" : "." : Vt(t);
843
+ let o = n && t.bulletLastUsed ? r === t.bulletLastUsed : !1;
844
+ if (!e.ordered) {
845
+ const m = e.children ? e.children[0] : void 0;
846
+ if (
847
+ // Bullet could be used as a thematic break marker:
848
+ (r === "*" || r === "-") && // Empty first list item:
849
+ m && (!m.children || !m.children[0]) && // Directly in two other list items:
850
+ t.stack[t.stack.length - 1] === "list" && t.stack[t.stack.length - 2] === "listItem" && t.stack[t.stack.length - 3] === "list" && t.stack[t.stack.length - 4] === "listItem" && // That are each the first child.
851
+ t.indexStack[t.indexStack.length - 1] === 0 && t.indexStack[t.indexStack.length - 2] === 0 && t.indexStack[t.indexStack.length - 3] === 0 && (o = !0), ye(t) === r && m
852
+ ) {
853
+ let s = -1;
854
+ for (; ++s < e.children.length; ) {
855
+ const p = e.children[s];
856
+ if (p && p.type === "listItem" && p.children && p.children[0] && p.children[0].type === "thematicBreak") {
857
+ o = !0;
858
+ break;
859
+ }
860
+ }
861
+ }
862
+ }
863
+ o && (r = c), t.bulletCurrent = r;
864
+ const u = t.containerFlow(e, i);
865
+ return t.bulletLastUsed = r, t.bulletCurrent = a, l(), u;
866
+ }
867
+ function Nt(e) {
868
+ const n = e.options.listItemIndent || "one";
869
+ if (n !== "tab" && n !== "one" && n !== "mixed")
870
+ throw new Error(
871
+ "Cannot serialize items with `" + n + "` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`"
872
+ );
873
+ return n;
874
+ }
875
+ function Zt(e, n, t, i) {
876
+ const l = Nt(t);
877
+ let a = t.bulletCurrent || K(t);
878
+ n && n.type === "list" && n.ordered && (a = (typeof n.start == "number" && n.start > -1 ? n.start : 1) + (t.options.incrementListMarker === !1 ? 0 : n.children.indexOf(e)) + a);
879
+ let r = a.length + 1;
880
+ (l === "tab" || l === "mixed" && (n && n.type === "list" && n.spread || e.spread)) && (r = Math.ceil(r / 4) * 4);
881
+ const c = t.createTracker(i);
882
+ c.move(a + " ".repeat(r - a.length)), c.shift(r);
883
+ const o = t.enter("listItem"), u = t.indentLines(
884
+ t.containerFlow(e, c.current()),
885
+ m
886
+ );
887
+ return o(), u;
888
+ function m(s, p, g) {
889
+ return p ? (g ? "" : " ".repeat(r)) + s : (g ? a : a + " ".repeat(r - a.length)) + s;
890
+ }
891
+ }
892
+ function Jt(e, n, t, i) {
893
+ const l = t.enter("paragraph"), a = t.enter("phrasing"), r = t.containerPhrasing(e, i);
894
+ return a(), l(), r;
895
+ }
896
+ const Kt = (
897
+ /** @type {(node?: unknown) => node is Exclude<PhrasingContent, Html>} */
898
+ se([
899
+ "break",
900
+ "delete",
901
+ "emphasis",
902
+ // To do: next major: removed since footnotes were added to GFM.
903
+ "footnote",
904
+ "footnoteReference",
905
+ "image",
906
+ "imageReference",
907
+ "inlineCode",
908
+ // Enabled by `mdast-util-math`:
909
+ "inlineMath",
910
+ "link",
911
+ "linkReference",
912
+ // Enabled by `mdast-util-mdx`:
913
+ "mdxJsxTextElement",
914
+ // Enabled by `mdast-util-mdx`:
915
+ "mdxTextExpression",
916
+ "strong",
917
+ "text",
918
+ // Enabled by `mdast-util-directive`:
919
+ "textDirective"
920
+ ])
921
+ );
922
+ function Xt(e, n, t, i) {
923
+ return (e.children.some(function(r) {
924
+ return Kt(r);
925
+ }) ? t.containerPhrasing : t.containerFlow).call(t, e, i);
926
+ }
927
+ function Yt(e) {
928
+ const n = e.options.strong || "*";
929
+ if (n !== "*" && n !== "_")
930
+ throw new Error(
931
+ "Cannot serialize strong with `" + n + "` for `options.strong`, expected `*`, or `_`"
932
+ );
933
+ return n;
934
+ }
935
+ ve.peek = en;
936
+ function ve(e, n, t, i) {
937
+ const l = Yt(t), a = t.enter("strong"), r = t.createTracker(i), c = r.move(l + l);
938
+ let o = r.move(
939
+ t.containerPhrasing(e, {
940
+ after: l,
941
+ before: c,
942
+ ...r.current()
943
+ })
944
+ );
945
+ const u = o.charCodeAt(0), m = W(
946
+ i.before.charCodeAt(i.before.length - 1),
947
+ u,
948
+ l
949
+ );
950
+ m.inside && (o = M(u) + o.slice(1));
951
+ const s = o.charCodeAt(o.length - 1), p = W(i.after.charCodeAt(0), s, l);
952
+ p.inside && (o = o.slice(0, -1) + M(s));
953
+ const g = r.move(l + l);
954
+ return a(), t.attentionEncodeSurroundingInfo = {
955
+ after: p.outside,
956
+ before: m.outside
957
+ }, c + o + g;
958
+ }
959
+ function en(e, n, t) {
960
+ return t.options.strong || "*";
961
+ }
962
+ function tn(e, n, t, i) {
963
+ return t.safe(e.value, i);
964
+ }
965
+ function nn(e) {
966
+ const n = e.options.ruleRepetition || 3;
967
+ if (n < 3)
968
+ throw new Error(
969
+ "Cannot serialize rules with repetition `" + n + "` for `options.ruleRepetition`, expected `3` or more"
970
+ );
971
+ return n;
972
+ }
973
+ function rn(e, n, t) {
974
+ const i = (ye(t) + (t.options.ruleSpaces ? " " : "")).repeat(nn(t));
975
+ return t.options.ruleSpaces ? i.slice(0, -1) : i;
976
+ }
977
+ const Ae = {
978
+ blockquote: St,
979
+ break: le,
980
+ code: Et,
981
+ definition: Pt,
982
+ emphasis: pe,
983
+ hardBreak: le,
984
+ heading: jt,
985
+ html: ge,
986
+ image: ke,
987
+ imageReference: be,
988
+ inlineCode: xe,
989
+ link: de,
990
+ linkReference: Ce,
991
+ list: Qt,
992
+ listItem: Zt,
993
+ paragraph: Jt,
994
+ root: Xt,
995
+ strong: ve,
996
+ text: tn,
997
+ thematicBreak: rn
998
+ };
999
+ function ln() {
1000
+ return {
1001
+ enter: {
1002
+ table: on,
1003
+ tableData: oe,
1004
+ tableHeader: oe,
1005
+ tableRow: un
1006
+ },
1007
+ exit: {
1008
+ codeText: sn,
1009
+ table: an,
1010
+ tableData: G,
1011
+ tableHeader: G,
1012
+ tableRow: G
1013
+ }
1014
+ };
1015
+ }
1016
+ function on(e) {
1017
+ const n = e._align;
1018
+ this.enter(
1019
+ {
1020
+ type: "table",
1021
+ align: n.map(function(t) {
1022
+ return t === "none" ? null : t;
1023
+ }),
1024
+ children: []
1025
+ },
1026
+ e
1027
+ ), this.data.inTable = !0;
1028
+ }
1029
+ function an(e) {
1030
+ this.exit(e), this.data.inTable = void 0;
1031
+ }
1032
+ function un(e) {
1033
+ this.enter({ type: "tableRow", children: [] }, e);
1034
+ }
1035
+ function G(e) {
1036
+ this.exit(e);
1037
+ }
1038
+ function oe(e) {
1039
+ this.enter({ type: "tableCell", children: [] }, e);
1040
+ }
1041
+ function sn(e) {
1042
+ let n = this.resume();
1043
+ this.data.inTable && (n = n.replace(/\\([\\|])/g, cn));
1044
+ const t = this.stack[this.stack.length - 1];
1045
+ t.value = n, this.exit(e);
1046
+ }
1047
+ function cn(e, n) {
1048
+ return n === "|" ? n : e;
1049
+ }
1050
+ function fn(e) {
1051
+ const n = e, t = n.tableCellPadding, i = n.tablePipeAlign, l = n.stringLength, a = t ? " " : "|";
1052
+ return {
1053
+ unsafe: [
1054
+ { character: "\r", inConstruct: "tableCell" },
1055
+ { character: `
1056
+ `, inConstruct: "tableCell" },
1057
+ // A pipe, when followed by a tab or space (padding), or a dash or colon
1058
+ // (unpadded delimiter row), could result in a table.
1059
+ { atBreak: !0, character: "|", after: "[ :-]" },
1060
+ // A pipe in a cell must be encoded.
1061
+ { character: "|", inConstruct: "tableCell" },
1062
+ // A colon must be followed by a dash, in which case it could start a
1063
+ // delimiter row.
1064
+ { atBreak: !0, character: ":", after: "-" },
1065
+ // A delimiter row can also start with a dash, when followed by more
1066
+ // dashes, a colon, or a pipe.
1067
+ // This is a stricter version than the built in check for lists, thematic
1068
+ // breaks, and setex heading underlines though:
1069
+ // <https://github.com/syntax-tree/mdast-util-to-markdown/blob/51a2038/lib/unsafe.js#L57>
1070
+ { atBreak: !0, character: "-", after: "[:|-]" }
1071
+ ],
1072
+ handlers: {
1073
+ inlineCode: p,
1074
+ table: r,
1075
+ tableCell: o,
1076
+ tableRow: c
1077
+ }
1078
+ };
1079
+ function r(g, h, b, x) {
1080
+ return u(m(g, b, x), g.align);
1081
+ }
1082
+ function c(g, h, b, x) {
1083
+ const k = s(g, b, x), w = u([k]);
1084
+ return w.slice(0, w.indexOf(`
1085
+ `));
1086
+ }
1087
+ function o(g, h, b, x) {
1088
+ const k = b.enter("tableCell"), w = b.enter("phrasing"), d = b.containerPhrasing(g, {
1089
+ ...x,
1090
+ before: a,
1091
+ after: a
1092
+ });
1093
+ return w(), k(), d;
1094
+ }
1095
+ function u(g, h) {
1096
+ return Dt(g, {
1097
+ align: h,
1098
+ // @ts-expect-error: `markdown-table` types should support `null`.
1099
+ alignDelimiters: i,
1100
+ // @ts-expect-error: `markdown-table` types should support `null`.
1101
+ padding: t,
1102
+ // @ts-expect-error: `markdown-table` types should support `null`.
1103
+ stringLength: l
1104
+ });
1105
+ }
1106
+ function m(g, h, b) {
1107
+ const x = g.children;
1108
+ let k = -1;
1109
+ const w = [], d = h.enter("table");
1110
+ for (; ++k < x.length; )
1111
+ w[k] = s(x[k], h, b);
1112
+ return d(), w;
1113
+ }
1114
+ function s(g, h, b) {
1115
+ const x = g.children;
1116
+ let k = -1;
1117
+ const w = [], d = h.enter("tableRow");
1118
+ for (; ++k < x.length; )
1119
+ w[k] = o(x[k], g, h, b);
1120
+ return d(), w;
1121
+ }
1122
+ function p(g, h, b) {
1123
+ let x = Ae.inlineCode(g, h, b);
1124
+ return b.stack.includes("tableCell") && (x = x.replace(/\|/g, "\\$&")), x;
1125
+ }
1126
+ }
1127
+ function hn() {
1128
+ return {
1129
+ exit: {
1130
+ taskListCheckValueChecked: ae,
1131
+ taskListCheckValueUnchecked: ae,
1132
+ paragraph: pn
1133
+ }
1134
+ };
1135
+ }
1136
+ function mn() {
1137
+ return {
1138
+ unsafe: [{ atBreak: !0, character: "-", after: "[:|-]" }],
1139
+ handlers: { listItem: gn }
1140
+ };
1141
+ }
1142
+ function ae(e) {
1143
+ const n = this.stack[this.stack.length - 2];
1144
+ n.checked = e.type === "taskListCheckValueChecked";
1145
+ }
1146
+ function pn(e) {
1147
+ const n = this.stack[this.stack.length - 2];
1148
+ if (n && n.type === "listItem" && typeof n.checked == "boolean") {
1149
+ const t = this.stack[this.stack.length - 1], i = t.children[0];
1150
+ if (i && i.type === "text") {
1151
+ const l = n.children;
1152
+ let a = -1, r;
1153
+ for (; ++a < l.length; ) {
1154
+ const c = l[a];
1155
+ if (c.type === "paragraph") {
1156
+ r = c;
1157
+ break;
1158
+ }
1159
+ }
1160
+ r === t && (i.value = i.value.slice(1), i.value.length === 0 ? t.children.shift() : t.position && i.position && typeof i.position.start.offset == "number" && (i.position.start.column++, i.position.start.offset++, t.position.start = Object.assign({}, i.position.start)));
1161
+ }
1162
+ }
1163
+ this.exit(e);
1164
+ }
1165
+ function gn(e, n, t, i) {
1166
+ const l = e.children[0], a = typeof e.checked == "boolean" && l && l.type === "paragraph", r = "[" + (e.checked ? "x" : " ") + "] ", c = t.createTracker(i);
1167
+ a && c.move(r);
1168
+ let o = Ae.listItem(e, n, t, {
1169
+ ...i,
1170
+ ...c.current()
1171
+ });
1172
+ return a && (o = o.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/, u)), o;
1173
+ function u(m) {
1174
+ return m + r;
1175
+ }
1176
+ }
1177
+ function kn() {
1178
+ return [
1179
+ Qe(),
1180
+ lt(),
1181
+ wt(),
1182
+ ln(),
1183
+ hn()
1184
+ ];
1185
+ }
1186
+ function bn(e) {
1187
+ return {
1188
+ extensions: [
1189
+ Ne(),
1190
+ ot(),
1191
+ dt(),
1192
+ fn(e),
1193
+ mn()
1194
+ ]
1195
+ };
1196
+ }
1197
+ const xn = {
1198
+ tokenize: An,
1199
+ partial: !0
1200
+ }, De = {
1201
+ tokenize: Dn,
1202
+ partial: !0
1203
+ }, Fe = {
1204
+ tokenize: Fn,
1205
+ partial: !0
1206
+ }, Se = {
1207
+ tokenize: Sn,
1208
+ partial: !0
1209
+ }, wn = {
1210
+ tokenize: Tn,
1211
+ partial: !0
1212
+ }, Te = {
1213
+ name: "wwwAutolink",
1214
+ tokenize: yn,
1215
+ previous: ze
1216
+ }, Le = {
1217
+ name: "protocolAutolink",
1218
+ tokenize: vn,
1219
+ previous: Ie
1220
+ }, F = {
1221
+ name: "emailAutolink",
1222
+ tokenize: Cn,
1223
+ previous: Ee
1224
+ }, D = {};
1225
+ function dn() {
1226
+ return {
1227
+ text: D
1228
+ };
1229
+ }
1230
+ let T = 48;
1231
+ for (; T < 123; )
1232
+ D[T] = F, T++, T === 58 ? T = 65 : T === 91 && (T = 97);
1233
+ D[43] = F;
1234
+ D[45] = F;
1235
+ D[46] = F;
1236
+ D[95] = F;
1237
+ D[72] = [F, Le];
1238
+ D[104] = [F, Le];
1239
+ D[87] = [F, Te];
1240
+ D[119] = [F, Te];
1241
+ function Cn(e, n, t) {
1242
+ const i = this;
1243
+ let l, a;
1244
+ return r;
1245
+ function r(s) {
1246
+ return !Q(s) || !Ee.call(i, i.previous) || X(i.events) ? t(s) : (e.enter("literalAutolink"), e.enter("literalAutolinkEmail"), c(s));
1247
+ }
1248
+ function c(s) {
1249
+ return Q(s) ? (e.consume(s), c) : s === 64 ? (e.consume(s), o) : t(s);
1250
+ }
1251
+ function o(s) {
1252
+ return s === 46 ? e.check(wn, m, u)(s) : s === 45 || s === 95 || Z(s) ? (a = !0, e.consume(s), o) : m(s);
1253
+ }
1254
+ function u(s) {
1255
+ return e.consume(s), l = !0, o;
1256
+ }
1257
+ function m(s) {
1258
+ return a && l && P(i.previous) ? (e.exit("literalAutolinkEmail"), e.exit("literalAutolink"), n(s)) : t(s);
1259
+ }
1260
+ }
1261
+ function yn(e, n, t) {
1262
+ const i = this;
1263
+ return l;
1264
+ function l(r) {
1265
+ return r !== 87 && r !== 119 || !ze.call(i, i.previous) || X(i.events) ? t(r) : (e.enter("literalAutolink"), e.enter("literalAutolinkWww"), e.check(xn, e.attempt(De, e.attempt(Fe, a), t), t)(r));
1266
+ }
1267
+ function a(r) {
1268
+ return e.exit("literalAutolinkWww"), e.exit("literalAutolink"), n(r);
1269
+ }
1270
+ }
1271
+ function vn(e, n, t) {
1272
+ const i = this;
1273
+ let l = "", a = !1;
1274
+ return r;
1275
+ function r(s) {
1276
+ return (s === 72 || s === 104) && Ie.call(i, i.previous) && !X(i.events) ? (e.enter("literalAutolink"), e.enter("literalAutolinkHttp"), l += String.fromCodePoint(s), e.consume(s), c) : t(s);
1277
+ }
1278
+ function c(s) {
1279
+ if (P(s) && l.length < 5)
1280
+ return l += String.fromCodePoint(s), e.consume(s), c;
1281
+ if (s === 58) {
1282
+ const p = l.toLowerCase();
1283
+ if (p === "http" || p === "https")
1284
+ return e.consume(s), o;
1285
+ }
1286
+ return t(s);
1287
+ }
1288
+ function o(s) {
1289
+ return s === 47 ? (e.consume(s), a ? u : (a = !0, o)) : t(s);
1290
+ }
1291
+ function u(s) {
1292
+ return s === null || Oe(s) || A(s) || I(s) || N(s) ? t(s) : e.attempt(De, e.attempt(Fe, m), t)(s);
1293
+ }
1294
+ function m(s) {
1295
+ return e.exit("literalAutolinkHttp"), e.exit("literalAutolink"), n(s);
1296
+ }
1297
+ }
1298
+ function An(e, n, t) {
1299
+ let i = 0;
1300
+ return l;
1301
+ function l(r) {
1302
+ return (r === 87 || r === 119) && i < 3 ? (i++, e.consume(r), l) : r === 46 && i === 3 ? (e.consume(r), a) : t(r);
1303
+ }
1304
+ function a(r) {
1305
+ return r === null ? t(r) : n(r);
1306
+ }
1307
+ }
1308
+ function Dn(e, n, t) {
1309
+ let i, l, a;
1310
+ return r;
1311
+ function r(u) {
1312
+ return u === 46 || u === 95 ? e.check(Se, o, c)(u) : u === null || A(u) || I(u) || u !== 45 && N(u) ? o(u) : (a = !0, e.consume(u), r);
1313
+ }
1314
+ function c(u) {
1315
+ return u === 95 ? i = !0 : (l = i, i = void 0), e.consume(u), r;
1316
+ }
1317
+ function o(u) {
1318
+ return l || i || !a ? t(u) : n(u);
1319
+ }
1320
+ }
1321
+ function Fn(e, n) {
1322
+ let t = 0, i = 0;
1323
+ return l;
1324
+ function l(r) {
1325
+ return r === 40 ? (t++, e.consume(r), l) : r === 41 && i < t ? a(r) : r === 33 || r === 34 || r === 38 || r === 39 || r === 41 || r === 42 || r === 44 || r === 46 || r === 58 || r === 59 || r === 60 || r === 63 || r === 93 || r === 95 || r === 126 ? e.check(Se, n, a)(r) : r === null || A(r) || I(r) ? n(r) : (e.consume(r), l);
1326
+ }
1327
+ function a(r) {
1328
+ return r === 41 && i++, e.consume(r), l;
1329
+ }
1330
+ }
1331
+ function Sn(e, n, t) {
1332
+ return i;
1333
+ function i(c) {
1334
+ return c === 33 || c === 34 || c === 39 || c === 41 || c === 42 || c === 44 || c === 46 || c === 58 || c === 59 || c === 63 || c === 95 || c === 126 ? (e.consume(c), i) : c === 38 ? (e.consume(c), a) : c === 93 ? (e.consume(c), l) : (
1335
+ // `<` is an end.
1336
+ c === 60 || // So is whitespace.
1337
+ c === null || A(c) || I(c) ? n(c) : t(c)
1338
+ );
1339
+ }
1340
+ function l(c) {
1341
+ return c === null || c === 40 || c === 91 || A(c) || I(c) ? n(c) : i(c);
1342
+ }
1343
+ function a(c) {
1344
+ return P(c) ? r(c) : t(c);
1345
+ }
1346
+ function r(c) {
1347
+ return c === 59 ? (e.consume(c), i) : P(c) ? (e.consume(c), r) : t(c);
1348
+ }
1349
+ }
1350
+ function Tn(e, n, t) {
1351
+ return i;
1352
+ function i(a) {
1353
+ return e.consume(a), l;
1354
+ }
1355
+ function l(a) {
1356
+ return Z(a) ? t(a) : n(a);
1357
+ }
1358
+ }
1359
+ function ze(e) {
1360
+ return e === null || e === 40 || e === 42 || e === 95 || e === 91 || e === 93 || e === 126 || A(e);
1361
+ }
1362
+ function Ie(e) {
1363
+ return !P(e);
1364
+ }
1365
+ function Ee(e) {
1366
+ return !(e === 47 || Q(e));
1367
+ }
1368
+ function Q(e) {
1369
+ return e === 43 || e === 45 || e === 46 || e === 95 || Z(e);
1370
+ }
1371
+ function X(e) {
1372
+ let n = e.length, t = !1;
1373
+ for (; n--; ) {
1374
+ const i = e[n][1];
1375
+ if ((i.type === "labelLink" || i.type === "labelImage") && !i._balanced) {
1376
+ t = !0;
1377
+ break;
1378
+ }
1379
+ if (i._gfmAutolinkLiteralWalkedInto) {
1380
+ t = !1;
1381
+ break;
1382
+ }
1383
+ }
1384
+ return e.length > 0 && !t && (e[e.length - 1][1]._gfmAutolinkLiteralWalkedInto = !0), t;
1385
+ }
1386
+ const Ln = {
1387
+ tokenize: On,
1388
+ partial: !0
1389
+ };
1390
+ function zn() {
1391
+ return {
1392
+ document: {
1393
+ 91: {
1394
+ name: "gfmFootnoteDefinition",
1395
+ tokenize: Pn,
1396
+ continuation: {
1397
+ tokenize: Mn
1398
+ },
1399
+ exit: _n
1400
+ }
1401
+ },
1402
+ text: {
1403
+ 91: {
1404
+ name: "gfmFootnoteCall",
1405
+ tokenize: Rn
1406
+ },
1407
+ 93: {
1408
+ name: "gfmPotentialFootnoteCall",
1409
+ add: "after",
1410
+ tokenize: In,
1411
+ resolveTo: En
1412
+ }
1413
+ }
1414
+ };
1415
+ }
1416
+ function In(e, n, t) {
1417
+ const i = this;
1418
+ let l = i.events.length;
1419
+ const a = i.parser.gfmFootnotes || (i.parser.gfmFootnotes = []);
1420
+ let r;
1421
+ for (; l--; ) {
1422
+ const o = i.events[l][1];
1423
+ if (o.type === "labelImage") {
1424
+ r = o;
1425
+ break;
1426
+ }
1427
+ if (o.type === "gfmFootnoteCall" || o.type === "labelLink" || o.type === "label" || o.type === "image" || o.type === "link")
1428
+ break;
1429
+ }
1430
+ return c;
1431
+ function c(o) {
1432
+ if (!r || !r._balanced)
1433
+ return t(o);
1434
+ const u = _(i.sliceSerialize({
1435
+ start: r.end,
1436
+ end: i.now()
1437
+ }));
1438
+ return u.codePointAt(0) !== 94 || !a.includes(u.slice(1)) ? t(o) : (e.enter("gfmFootnoteCallLabelMarker"), e.consume(o), e.exit("gfmFootnoteCallLabelMarker"), n(o));
1439
+ }
1440
+ }
1441
+ function En(e, n) {
1442
+ let t = e.length;
1443
+ for (; t-- && !(e[t][1].type === "labelImage" && e[t][0] === "enter"); )
1444
+ ;
1445
+ e[t + 1][1].type = "data", e[t + 3][1].type = "gfmFootnoteCallLabelMarker";
1446
+ const i = {
1447
+ type: "gfmFootnoteCall",
1448
+ start: Object.assign({}, e[t + 3][1].start),
1449
+ end: Object.assign({}, e[e.length - 1][1].end)
1450
+ }, l = {
1451
+ type: "gfmFootnoteCallMarker",
1452
+ start: Object.assign({}, e[t + 3][1].end),
1453
+ end: Object.assign({}, e[t + 3][1].end)
1454
+ };
1455
+ l.end.column++, l.end.offset++, l.end._bufferIndex++;
1456
+ const a = {
1457
+ type: "gfmFootnoteCallString",
1458
+ start: Object.assign({}, l.end),
1459
+ end: Object.assign({}, e[e.length - 1][1].start)
1460
+ }, r = {
1461
+ type: "chunkString",
1462
+ contentType: "string",
1463
+ start: Object.assign({}, a.start),
1464
+ end: Object.assign({}, a.end)
1465
+ }, c = [
1466
+ // Take the `labelImageMarker` (now `data`, the `!`)
1467
+ e[t + 1],
1468
+ e[t + 2],
1469
+ ["enter", i, n],
1470
+ // The `[`
1471
+ e[t + 3],
1472
+ e[t + 4],
1473
+ // The `^`.
1474
+ ["enter", l, n],
1475
+ ["exit", l, n],
1476
+ // Everything in between.
1477
+ ["enter", a, n],
1478
+ ["enter", r, n],
1479
+ ["exit", r, n],
1480
+ ["exit", a, n],
1481
+ // The ending (`]`, properly parsed and labelled).
1482
+ e[e.length - 2],
1483
+ e[e.length - 1],
1484
+ ["exit", i, n]
1485
+ ];
1486
+ return e.splice(t, e.length - t + 1, ...c), e;
1487
+ }
1488
+ function Rn(e, n, t) {
1489
+ const i = this, l = i.parser.gfmFootnotes || (i.parser.gfmFootnotes = []);
1490
+ let a = 0, r;
1491
+ return c;
1492
+ function c(s) {
1493
+ return e.enter("gfmFootnoteCall"), e.enter("gfmFootnoteCallLabelMarker"), e.consume(s), e.exit("gfmFootnoteCallLabelMarker"), o;
1494
+ }
1495
+ function o(s) {
1496
+ return s !== 94 ? t(s) : (e.enter("gfmFootnoteCallMarker"), e.consume(s), e.exit("gfmFootnoteCallMarker"), e.enter("gfmFootnoteCallString"), e.enter("chunkString").contentType = "string", u);
1497
+ }
1498
+ function u(s) {
1499
+ if (
1500
+ // Too long.
1501
+ a > 999 || // Closing brace with nothing.
1502
+ s === 93 && !r || // Space or tab is not supported by GFM for some reason.
1503
+ // `\n` and `[` not being supported makes sense.
1504
+ s === null || s === 91 || A(s)
1505
+ )
1506
+ return t(s);
1507
+ if (s === 93) {
1508
+ e.exit("chunkString");
1509
+ const p = e.exit("gfmFootnoteCallString");
1510
+ return l.includes(_(i.sliceSerialize(p))) ? (e.enter("gfmFootnoteCallLabelMarker"), e.consume(s), e.exit("gfmFootnoteCallLabelMarker"), e.exit("gfmFootnoteCall"), n) : t(s);
1511
+ }
1512
+ return A(s) || (r = !0), a++, e.consume(s), s === 92 ? m : u;
1513
+ }
1514
+ function m(s) {
1515
+ return s === 91 || s === 92 || s === 93 ? (e.consume(s), a++, u) : u(s);
1516
+ }
1517
+ }
1518
+ function Pn(e, n, t) {
1519
+ const i = this, l = i.parser.gfmFootnotes || (i.parser.gfmFootnotes = []);
1520
+ let a, r = 0, c;
1521
+ return o;
1522
+ function o(h) {
1523
+ return e.enter("gfmFootnoteDefinition")._container = !0, e.enter("gfmFootnoteDefinitionLabel"), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(h), e.exit("gfmFootnoteDefinitionLabelMarker"), u;
1524
+ }
1525
+ function u(h) {
1526
+ return h === 94 ? (e.enter("gfmFootnoteDefinitionMarker"), e.consume(h), e.exit("gfmFootnoteDefinitionMarker"), e.enter("gfmFootnoteDefinitionLabelString"), e.enter("chunkString").contentType = "string", m) : t(h);
1527
+ }
1528
+ function m(h) {
1529
+ if (
1530
+ // Too long.
1531
+ r > 999 || // Closing brace with nothing.
1532
+ h === 93 && !c || // Space or tab is not supported by GFM for some reason.
1533
+ // `\n` and `[` not being supported makes sense.
1534
+ h === null || h === 91 || A(h)
1535
+ )
1536
+ return t(h);
1537
+ if (h === 93) {
1538
+ e.exit("chunkString");
1539
+ const b = e.exit("gfmFootnoteDefinitionLabelString");
1540
+ return a = _(i.sliceSerialize(b)), e.enter("gfmFootnoteDefinitionLabelMarker"), e.consume(h), e.exit("gfmFootnoteDefinitionLabelMarker"), e.exit("gfmFootnoteDefinitionLabel"), p;
1541
+ }
1542
+ return A(h) || (c = !0), r++, e.consume(h), h === 92 ? s : m;
1543
+ }
1544
+ function s(h) {
1545
+ return h === 91 || h === 92 || h === 93 ? (e.consume(h), r++, m) : m(h);
1546
+ }
1547
+ function p(h) {
1548
+ return h === 58 ? (e.enter("definitionMarker"), e.consume(h), e.exit("definitionMarker"), l.includes(a) || l.push(a), S(e, g, "gfmFootnoteDefinitionWhitespace")) : t(h);
1549
+ }
1550
+ function g(h) {
1551
+ return n(h);
1552
+ }
1553
+ }
1554
+ function Mn(e, n, t) {
1555
+ return e.check(je, n, e.attempt(Ln, n, t));
1556
+ }
1557
+ function _n(e) {
1558
+ e.exit("gfmFootnoteDefinition");
1559
+ }
1560
+ function On(e, n, t) {
1561
+ const i = this;
1562
+ return S(e, l, "gfmFootnoteDefinitionIndent", 5);
1563
+ function l(a) {
1564
+ const r = i.events[i.events.length - 1];
1565
+ return r && r[1].type === "gfmFootnoteDefinitionIndent" && r[2].sliceSerialize(r[1], !0).length === 4 ? n(a) : t(a);
1566
+ }
1567
+ }
1568
+ function jn(e) {
1569
+ let t = e.singleTilde;
1570
+ const i = {
1571
+ name: "strikethrough",
1572
+ tokenize: a,
1573
+ resolveAll: l
1574
+ };
1575
+ return t == null && (t = !0), {
1576
+ text: {
1577
+ 126: i
1578
+ },
1579
+ insideSpan: {
1580
+ null: [i]
1581
+ },
1582
+ attentionMarkers: {
1583
+ null: [126]
1584
+ }
1585
+ };
1586
+ function l(r, c) {
1587
+ let o = -1;
1588
+ for (; ++o < r.length; )
1589
+ if (r[o][0] === "enter" && r[o][1].type === "strikethroughSequenceTemporary" && r[o][1]._close) {
1590
+ let u = o;
1591
+ for (; u--; )
1592
+ if (r[u][0] === "exit" && r[u][1].type === "strikethroughSequenceTemporary" && r[u][1]._open && // If the sizes are the same:
1593
+ r[o][1].end.offset - r[o][1].start.offset === r[u][1].end.offset - r[u][1].start.offset) {
1594
+ r[o][1].type = "strikethroughSequence", r[u][1].type = "strikethroughSequence";
1595
+ const m = {
1596
+ type: "strikethrough",
1597
+ start: Object.assign({}, r[u][1].start),
1598
+ end: Object.assign({}, r[o][1].end)
1599
+ }, s = {
1600
+ type: "strikethroughText",
1601
+ start: Object.assign({}, r[u][1].end),
1602
+ end: Object.assign({}, r[o][1].start)
1603
+ }, p = [["enter", m, c], ["enter", r[u][1], c], ["exit", r[u][1], c], ["enter", s, c]], g = c.parser.constructs.insideSpan.null;
1604
+ g && q(p, p.length, 0, Be(g, r.slice(u + 1, o), c)), q(p, p.length, 0, [["exit", s, c], ["enter", r[o][1], c], ["exit", r[o][1], c], ["exit", m, c]]), q(r, u - 1, o - u + 3, p), o = u + p.length - 2;
1605
+ break;
1606
+ }
1607
+ }
1608
+ for (o = -1; ++o < r.length; )
1609
+ r[o][1].type === "strikethroughSequenceTemporary" && (r[o][1].type = "data");
1610
+ return r;
1611
+ }
1612
+ function a(r, c, o) {
1613
+ const u = this.previous, m = this.events;
1614
+ let s = 0;
1615
+ return p;
1616
+ function p(h) {
1617
+ return u === 126 && m[m.length - 1][1].type !== "characterEscape" ? o(h) : (r.enter("strikethroughSequenceTemporary"), g(h));
1618
+ }
1619
+ function g(h) {
1620
+ const b = $(u);
1621
+ if (h === 126)
1622
+ return s > 1 ? o(h) : (r.consume(h), s++, g);
1623
+ if (s < 2 && !t) return o(h);
1624
+ const x = r.exit("strikethroughSequenceTemporary"), k = $(h);
1625
+ return x._open = !k || k === 2 && !!b, x._close = !b || b === 2 && !!k, c(h);
1626
+ }
1627
+ }
1628
+ }
1629
+ class Bn {
1630
+ /**
1631
+ * Create a new edit map.
1632
+ */
1633
+ constructor() {
1634
+ this.map = [];
1635
+ }
1636
+ /**
1637
+ * Create an edit: a remove and/or add at a certain place.
1638
+ *
1639
+ * @param {number} index
1640
+ * @param {number} remove
1641
+ * @param {Array<Event>} add
1642
+ * @returns {undefined}
1643
+ */
1644
+ add(n, t, i) {
1645
+ $n(this, n, t, i);
1646
+ }
1647
+ // To do: add this when moving to `micromark`.
1648
+ // /**
1649
+ // * Create an edit: but insert `add` before existing additions.
1650
+ // *
1651
+ // * @param {number} index
1652
+ // * @param {number} remove
1653
+ // * @param {Array<Event>} add
1654
+ // * @returns {undefined}
1655
+ // */
1656
+ // addBefore(index, remove, add) {
1657
+ // addImplementation(this, index, remove, add, true)
1658
+ // }
1659
+ /**
1660
+ * Done, change the events.
1661
+ *
1662
+ * @param {Array<Event>} events
1663
+ * @returns {undefined}
1664
+ */
1665
+ consume(n) {
1666
+ if (this.map.sort(function(a, r) {
1667
+ return a[0] - r[0];
1668
+ }), this.map.length === 0)
1669
+ return;
1670
+ let t = this.map.length;
1671
+ const i = [];
1672
+ for (; t > 0; )
1673
+ t -= 1, i.push(n.slice(this.map[t][0] + this.map[t][1]), this.map[t][2]), n.length = this.map[t][0];
1674
+ i.push(n.slice()), n.length = 0;
1675
+ let l = i.pop();
1676
+ for (; l; ) {
1677
+ for (const a of l)
1678
+ n.push(a);
1679
+ l = i.pop();
1680
+ }
1681
+ this.map.length = 0;
1682
+ }
1683
+ }
1684
+ function $n(e, n, t, i) {
1685
+ let l = 0;
1686
+ if (!(t === 0 && i.length === 0)) {
1687
+ for (; l < e.map.length; ) {
1688
+ if (e.map[l][0] === n) {
1689
+ e.map[l][1] += t, e.map[l][2].push(...i);
1690
+ return;
1691
+ }
1692
+ l += 1;
1693
+ }
1694
+ e.map.push([n, t, i]);
1695
+ }
1696
+ }
1697
+ function Wn(e, n) {
1698
+ let t = !1;
1699
+ const i = [];
1700
+ for (; n < e.length; ) {
1701
+ const l = e[n];
1702
+ if (t) {
1703
+ if (l[0] === "enter")
1704
+ l[1].type === "tableContent" && i.push(e[n + 1][1].type === "tableDelimiterMarker" ? "left" : "none");
1705
+ else if (l[1].type === "tableContent") {
1706
+ if (e[n - 1][1].type === "tableDelimiterMarker") {
1707
+ const a = i.length - 1;
1708
+ i[a] = i[a] === "left" ? "center" : "right";
1709
+ }
1710
+ } else if (l[1].type === "tableDelimiterRow")
1711
+ break;
1712
+ } else l[0] === "enter" && l[1].type === "tableDelimiterRow" && (t = !0);
1713
+ n += 1;
1714
+ }
1715
+ return i;
1716
+ }
1717
+ function qn() {
1718
+ return {
1719
+ flow: {
1720
+ null: {
1721
+ name: "table",
1722
+ tokenize: Hn,
1723
+ resolveAll: Un
1724
+ }
1725
+ }
1726
+ };
1727
+ }
1728
+ function Hn(e, n, t) {
1729
+ const i = this;
1730
+ let l = 0, a = 0, r;
1731
+ return c;
1732
+ function c(f) {
1733
+ let E = i.events.length - 1;
1734
+ for (; E > -1; ) {
1735
+ const te = i.events[E][1].type;
1736
+ if (te === "lineEnding" || // Note: markdown-rs uses `whitespace` instead of `linePrefix`
1737
+ te === "linePrefix") E--;
1738
+ else break;
1739
+ }
1740
+ const Y = E > -1 ? i.events[E][1].type : null, ee = Y === "tableHead" || Y === "tableRow" ? C : o;
1741
+ return ee === C && i.parser.lazy[i.now().line] ? t(f) : ee(f);
1742
+ }
1743
+ function o(f) {
1744
+ return e.enter("tableHead"), e.enter("tableRow"), u(f);
1745
+ }
1746
+ function u(f) {
1747
+ return f === 124 || (r = !0, a += 1), m(f);
1748
+ }
1749
+ function m(f) {
1750
+ return f === null ? t(f) : R(f) ? a > 1 ? (a = 0, i.interrupt = !0, e.exit("tableRow"), e.enter("lineEnding"), e.consume(f), e.exit("lineEnding"), g) : t(f) : L(f) ? S(e, m, "whitespace")(f) : (a += 1, r && (r = !1, l += 1), f === 124 ? (e.enter("tableCellDivider"), e.consume(f), e.exit("tableCellDivider"), r = !0, m) : (e.enter("data"), s(f)));
1751
+ }
1752
+ function s(f) {
1753
+ return f === null || f === 124 || A(f) ? (e.exit("data"), m(f)) : (e.consume(f), f === 92 ? p : s);
1754
+ }
1755
+ function p(f) {
1756
+ return f === 92 || f === 124 ? (e.consume(f), s) : s(f);
1757
+ }
1758
+ function g(f) {
1759
+ return i.interrupt = !1, i.parser.lazy[i.now().line] ? t(f) : (e.enter("tableDelimiterRow"), r = !1, L(f) ? S(e, h, "linePrefix", i.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(f) : h(f));
1760
+ }
1761
+ function h(f) {
1762
+ return f === 45 || f === 58 ? x(f) : f === 124 ? (r = !0, e.enter("tableCellDivider"), e.consume(f), e.exit("tableCellDivider"), b) : y(f);
1763
+ }
1764
+ function b(f) {
1765
+ return L(f) ? S(e, x, "whitespace")(f) : x(f);
1766
+ }
1767
+ function x(f) {
1768
+ return f === 58 ? (a += 1, r = !0, e.enter("tableDelimiterMarker"), e.consume(f), e.exit("tableDelimiterMarker"), k) : f === 45 ? (a += 1, k(f)) : f === null || R(f) ? v(f) : y(f);
1769
+ }
1770
+ function k(f) {
1771
+ return f === 45 ? (e.enter("tableDelimiterFiller"), w(f)) : y(f);
1772
+ }
1773
+ function w(f) {
1774
+ return f === 45 ? (e.consume(f), w) : f === 58 ? (r = !0, e.exit("tableDelimiterFiller"), e.enter("tableDelimiterMarker"), e.consume(f), e.exit("tableDelimiterMarker"), d) : (e.exit("tableDelimiterFiller"), d(f));
1775
+ }
1776
+ function d(f) {
1777
+ return L(f) ? S(e, v, "whitespace")(f) : v(f);
1778
+ }
1779
+ function v(f) {
1780
+ return f === 124 ? h(f) : f === null || R(f) ? !r || l !== a ? y(f) : (e.exit("tableDelimiterRow"), e.exit("tableHead"), n(f)) : y(f);
1781
+ }
1782
+ function y(f) {
1783
+ return t(f);
1784
+ }
1785
+ function C(f) {
1786
+ return e.enter("tableRow"), O(f);
1787
+ }
1788
+ function O(f) {
1789
+ return f === 124 ? (e.enter("tableCellDivider"), e.consume(f), e.exit("tableCellDivider"), O) : f === null || R(f) ? (e.exit("tableRow"), n(f)) : L(f) ? S(e, O, "whitespace")(f) : (e.enter("data"), j(f));
1790
+ }
1791
+ function j(f) {
1792
+ return f === null || f === 124 || A(f) ? (e.exit("data"), O(f)) : (e.consume(f), f === 92 ? Re : j);
1793
+ }
1794
+ function Re(f) {
1795
+ return f === 92 || f === 124 ? (e.consume(f), j) : j(f);
1796
+ }
1797
+ }
1798
+ function Un(e, n) {
1799
+ let t = -1, i = !0, l = 0, a = [0, 0, 0, 0], r = [0, 0, 0, 0], c = !1, o = 0, u, m, s;
1800
+ const p = new Bn();
1801
+ for (; ++t < e.length; ) {
1802
+ const g = e[t], h = g[1];
1803
+ g[0] === "enter" ? h.type === "tableHead" ? (c = !1, o !== 0 && (ue(p, n, o, u, m), m = void 0, o = 0), u = {
1804
+ type: "table",
1805
+ start: Object.assign({}, h.start),
1806
+ // Note: correct end is set later.
1807
+ end: Object.assign({}, h.end)
1808
+ }, p.add(t, 0, [["enter", u, n]])) : h.type === "tableRow" || h.type === "tableDelimiterRow" ? (i = !0, s = void 0, a = [0, 0, 0, 0], r = [0, t + 1, 0, 0], c && (c = !1, m = {
1809
+ type: "tableBody",
1810
+ start: Object.assign({}, h.start),
1811
+ // Note: correct end is set later.
1812
+ end: Object.assign({}, h.end)
1813
+ }, p.add(t, 0, [["enter", m, n]])), l = h.type === "tableDelimiterRow" ? 2 : m ? 3 : 1) : l && (h.type === "data" || h.type === "tableDelimiterMarker" || h.type === "tableDelimiterFiller") ? (i = !1, r[2] === 0 && (a[1] !== 0 && (r[0] = r[1], s = B(p, n, a, l, void 0, s), a = [0, 0, 0, 0]), r[2] = t)) : h.type === "tableCellDivider" && (i ? i = !1 : (a[1] !== 0 && (r[0] = r[1], s = B(p, n, a, l, void 0, s)), a = r, r = [a[1], t, 0, 0])) : h.type === "tableHead" ? (c = !0, o = t) : h.type === "tableRow" || h.type === "tableDelimiterRow" ? (o = t, a[1] !== 0 ? (r[0] = r[1], s = B(p, n, a, l, t, s)) : r[1] !== 0 && (s = B(p, n, r, l, t, s)), l = 0) : l && (h.type === "data" || h.type === "tableDelimiterMarker" || h.type === "tableDelimiterFiller") && (r[3] = t);
1814
+ }
1815
+ for (o !== 0 && ue(p, n, o, u, m), p.consume(n.events), t = -1; ++t < n.events.length; ) {
1816
+ const g = n.events[t];
1817
+ g[0] === "enter" && g[1].type === "table" && (g[1]._align = Wn(n.events, t));
1818
+ }
1819
+ return e;
1820
+ }
1821
+ function B(e, n, t, i, l, a) {
1822
+ const r = i === 1 ? "tableHeader" : i === 2 ? "tableDelimiter" : "tableData", c = "tableContent";
1823
+ t[0] !== 0 && (a.end = Object.assign({}, z(n.events, t[0])), e.add(t[0], 0, [["exit", a, n]]));
1824
+ const o = z(n.events, t[1]);
1825
+ if (a = {
1826
+ type: r,
1827
+ start: Object.assign({}, o),
1828
+ // Note: correct end is set later.
1829
+ end: Object.assign({}, o)
1830
+ }, e.add(t[1], 0, [["enter", a, n]]), t[2] !== 0) {
1831
+ const u = z(n.events, t[2]), m = z(n.events, t[3]), s = {
1832
+ type: c,
1833
+ start: Object.assign({}, u),
1834
+ end: Object.assign({}, m)
1835
+ };
1836
+ if (e.add(t[2], 0, [["enter", s, n]]), i !== 2) {
1837
+ const p = n.events[t[2]], g = n.events[t[3]];
1838
+ if (p[1].end = Object.assign({}, g[1].end), p[1].type = "chunkText", p[1].contentType = "text", t[3] > t[2] + 1) {
1839
+ const h = t[2] + 1, b = t[3] - t[2] - 1;
1840
+ e.add(h, b, []);
1841
+ }
1842
+ }
1843
+ e.add(t[3] + 1, 0, [["exit", s, n]]);
1844
+ }
1845
+ return l !== void 0 && (a.end = Object.assign({}, z(n.events, l)), e.add(l, 0, [["exit", a, n]]), a = void 0), a;
1846
+ }
1847
+ function ue(e, n, t, i, l) {
1848
+ const a = [], r = z(n.events, t);
1849
+ l && (l.end = Object.assign({}, r), a.push(["exit", l, n])), i.end = Object.assign({}, r), a.push(["exit", i, n]), e.add(t + 1, 0, a);
1850
+ }
1851
+ function z(e, n) {
1852
+ const t = e[n], i = t[0] === "enter" ? "start" : "end";
1853
+ return t[1][i];
1854
+ }
1855
+ const Vn = {
1856
+ name: "tasklistCheck",
1857
+ tokenize: Qn
1858
+ };
1859
+ function Gn() {
1860
+ return {
1861
+ text: {
1862
+ 91: Vn
1863
+ }
1864
+ };
1865
+ }
1866
+ function Qn(e, n, t) {
1867
+ const i = this;
1868
+ return l;
1869
+ function l(o) {
1870
+ return (
1871
+ // Exit if there’s stuff before.
1872
+ i.previous !== null || // Exit if not in the first content that is the first child of a list
1873
+ // item.
1874
+ !i._gfmTasklistFirstContentOfListItem ? t(o) : (e.enter("taskListCheck"), e.enter("taskListCheckMarker"), e.consume(o), e.exit("taskListCheckMarker"), a)
1875
+ );
1876
+ }
1877
+ function a(o) {
1878
+ return A(o) ? (e.enter("taskListCheckValueUnchecked"), e.consume(o), e.exit("taskListCheckValueUnchecked"), r) : o === 88 || o === 120 ? (e.enter("taskListCheckValueChecked"), e.consume(o), e.exit("taskListCheckValueChecked"), r) : t(o);
1879
+ }
1880
+ function r(o) {
1881
+ return o === 93 ? (e.enter("taskListCheckMarker"), e.consume(o), e.exit("taskListCheckMarker"), e.exit("taskListCheck"), c) : t(o);
1882
+ }
1883
+ function c(o) {
1884
+ return R(o) ? n(o) : L(o) ? e.check({
1885
+ tokenize: Nn
1886
+ }, n, t)(o) : t(o);
1887
+ }
1888
+ }
1889
+ function Nn(e, n, t) {
1890
+ return S(e, i, "whitespace");
1891
+ function i(l) {
1892
+ return l === null ? t(l) : n(l);
1893
+ }
1894
+ }
1895
+ function Zn(e) {
1896
+ return $e([
1897
+ dn(),
1898
+ zn(),
1899
+ jn(e),
1900
+ qn(),
1901
+ Gn()
1902
+ ]);
1903
+ }
1904
+ const Jn = {};
1905
+ function Yn(e) {
1906
+ const n = (
1907
+ /** @type {Processor<Root>} */
1908
+ this
1909
+ ), t = e || Jn, i = n.data(), l = i.micromarkExtensions || (i.micromarkExtensions = []), a = i.fromMarkdownExtensions || (i.fromMarkdownExtensions = []), r = i.toMarkdownExtensions || (i.toMarkdownExtensions = []);
1910
+ l.push(Zn(t)), a.push(kn()), r.push(bn(t));
1911
+ }
1912
+ export {
1913
+ Yn as default
1914
+ };