UNPKG

80.9 kBJavaScriptView Raw
1import { aP as Et, l as Ct, ax as At } from "./mermaid-9357f3d0.js";
2function zt(n, r) {
3 var { includeImageAlt: t = !0 } = r || {};
4 return tt(n, t);
5}
6function tt(n, r) {
7 return n && typeof n == "object" && // @ts-ignore looks like a literal.
8 (n.value || // @ts-ignore looks like an image.
9 (r ? n.alt : "") || // @ts-ignore looks like a parent.
10 "children" in n && qn(n.children, r) || Array.isArray(n) && qn(n, r)) || "";
11}
12function qn(n, r) {
13 for (var t = [], e = -1; ++e < n.length; )
14 t[e] = tt(n[e], r);
15 return t.join("");
16}
17function en(n, r, t, e) {
18 const u = n.length;
19 let a = 0, i;
20 if (r < 0 ? r = -r > u ? 0 : u + r : r = r > u ? u : r, t = t > 0 ? t : 0, e.length < 1e4)
21 i = Array.from(e), i.unshift(r, t), [].splice.apply(n, i);
22 else
23 for (t && [].splice.apply(n, [r, t]); a < e.length; )
24 i = e.slice(a, a + 1e4), i.unshift(r, 0), [].splice.apply(n, i), a += 1e4, r += 1e4;
25}
26function Z(n, r) {
27 return n.length > 0 ? (en(n, n.length, 0, r), n) : r;
28}
29const Hn = {}.hasOwnProperty;
30function It(n) {
31 const r = {};
32 let t = -1;
33 for (; ++t < n.length; )
34 Tt(r, n[t]);
35 return r;
36}
37function Tt(n, r) {
38 let t;
39 for (t in r) {
40 const u = (Hn.call(n, t) ? n[t] : void 0) || (n[t] = {}), a = r[t];
41 let i;
42 for (i in a) {
43 Hn.call(u, i) || (u[i] = []);
44 const l = a[i];
45 Bt(
46 // @ts-expect-error Looks like a list.
47 u[i],
48 Array.isArray(l) ? l : l ? [l] : []
49 );
50 }
51 }
52}
53function Bt(n, r) {
54 let t = -1;
55 const e = [];
56 for (; ++t < r.length; )
57 (r[t].add === "after" ? n : e).push(r[t]);
58 en(n, 0, 0, e);
59}
60const Lt = /[!-/:-@[-`{-~\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/, tn = sn(/[A-Za-z]/), An = sn(/\d/), Ot = sn(/[\dA-Fa-f]/), v = sn(/[\dA-Za-z]/), Dt = sn(/[!-/:-@[-`{-~]/), Vn = sn(/[#-'*+\--9=?A-Z^-~]/);
61function zn(n) {
62 return (
63 // Special whitespace codes (which have negative values), C0 and Control
64 // character DEL
65 n !== null && (n < 32 || n === 127)
66 );
67}
68function Y(n) {
69 return n !== null && (n < 0 || n === 32);
70}
71function C(n) {
72 return n !== null && n < -2;
73}
74function q(n) {
75 return n === -2 || n === -1 || n === 32;
76}
77const Pt = sn(/\s/), _t = sn(Lt);
78function sn(n) {
79 return r;
80 function r(t) {
81 return t !== null && n.test(String.fromCharCode(t));
82 }
83}
84function T(n, r, t, e) {
85 const u = e ? e - 1 : Number.POSITIVE_INFINITY;
86 let a = 0;
87 return i;
88 function i(c) {
89 return q(c) ? (n.enter(t), l(c)) : r(c);
90 }
91 function l(c) {
92 return q(c) && a++ < u ? (n.consume(c), l) : (n.exit(t), r(c));
93 }
94}
95const Mt = {
96 tokenize: Rt
97};
98function Rt(n) {
99 const r = n.attempt(
100 this.parser.constructs.contentInitial,
101 e,
102 u
103 );
104 let t;
105 return r;
106 function e(l) {
107 if (l === null) {
108 n.consume(l);
109 return;
110 }
111 return n.enter("lineEnding"), n.consume(l), n.exit("lineEnding"), T(n, r, "linePrefix");
112 }
113 function u(l) {
114 return n.enter("paragraph"), a(l);
115 }
116 function a(l) {
117 const c = n.enter("chunkText", {
118 contentType: "text",
119 previous: t
120 });
121 return t && (t.next = c), t = c, i(l);
122 }
123 function i(l) {
124 if (l === null) {
125 n.exit("chunkText"), n.exit("paragraph"), n.consume(l);
126 return;
127 }
128 return C(l) ? (n.consume(l), n.exit("chunkText"), a) : (n.consume(l), i);
129 }
130}
131const jt = {
132 tokenize: qt
133}, Nn = {
134 tokenize: Ht
135};
136function qt(n) {
137 const r = this, t = [];
138 let e = 0, u, a, i;
139 return l;
140 function l(F) {
141 if (e < t.length) {
142 const L = t[e];
143 return r.containerState = L[1], n.attempt(
144 L[0].continuation,
145 c,
146 p
147 )(F);
148 }
149 return p(F);
150 }
151 function c(F) {
152 if (e++, r.containerState._closeFlow) {
153 r.containerState._closeFlow = void 0, u && _();
154 const L = r.events.length;
155 let O = L, d;
156 for (; O--; )
157 if (r.events[O][0] === "exit" && r.events[O][1].type === "chunkFlow") {
158 d = r.events[O][1].end;
159 break;
160 }
161 y(e);
162 let P = L;
163 for (; P < r.events.length; )
164 r.events[P][1].end = Object.assign({}, d), P++;
165 return en(
166 r.events,
167 O + 1,
168 0,
169 r.events.slice(L)
170 ), r.events.length = P, p(F);
171 }
172 return l(F);
173 }
174 function p(F) {
175 if (e === t.length) {
176 if (!u)
177 return g(F);
178 if (u.currentConstruct && u.currentConstruct.concrete)
179 return k(F);
180 r.interrupt = !!(u.currentConstruct && !u._gfmTableDynamicInterruptHack);
181 }
182 return r.containerState = {}, n.check(
183 Nn,
184 h,
185 x
186 )(F);
187 }
188 function h(F) {
189 return u && _(), y(e), g(F);
190 }
191 function x(F) {
192 return r.parser.lazy[r.now().line] = e !== t.length, i = r.now().offset, k(F);
193 }
194 function g(F) {
195 return r.containerState = {}, n.attempt(
196 Nn,
197 f,
198 k
199 )(F);
200 }
201 function f(F) {
202 return e++, t.push([r.currentConstruct, r.containerState]), g(F);
203 }
204 function k(F) {
205 if (F === null) {
206 u && _(), y(0), n.consume(F);
207 return;
208 }
209 return u = u || r.parser.flow(r.now()), n.enter("chunkFlow", {
210 contentType: "flow",
211 previous: a,
212 _tokenizer: u
213 }), B(F);
214 }
215 function B(F) {
216 if (F === null) {
217 D(n.exit("chunkFlow"), !0), y(0), n.consume(F);
218 return;
219 }
220 return C(F) ? (n.consume(F), D(n.exit("chunkFlow")), e = 0, r.interrupt = void 0, l) : (n.consume(F), B);
221 }
222 function D(F, L) {
223 const O = r.sliceStream(F);
224 if (L && O.push(null), F.previous = a, a && (a.next = F), a = F, u.defineSkip(F.start), u.write(O), r.parser.lazy[F.start.line]) {
225 let d = u.events.length;
226 for (; d--; )
227 if (
228 // The token starts before the line ending…
229 u.events[d][1].start.offset < i && // …and either is not ended yet
230 (!u.events[d][1].end || // …or ends after it.
231 u.events[d][1].end.offset > i)
232 )
233 return;
234 const P = r.events.length;
235 let R = P, j, N;
236 for (; R--; )
237 if (r.events[R][0] === "exit" && r.events[R][1].type === "chunkFlow") {
238 if (j) {
239 N = r.events[R][1].end;
240 break;
241 }
242 j = !0;
243 }
244 for (y(e), d = P; d < r.events.length; )
245 r.events[d][1].end = Object.assign({}, N), d++;
246 en(
247 r.events,
248 R + 1,
249 0,
250 r.events.slice(P)
251 ), r.events.length = d;
252 }
253 }
254 function y(F) {
255 let L = t.length;
256 for (; L-- > F; ) {
257 const O = t[L];
258 r.containerState = O[1], O[0].exit.call(r, n);
259 }
260 t.length = F;
261 }
262 function _() {
263 u.write([null]), a = void 0, u = void 0, r.containerState._closeFlow = void 0;
264 }
265}
266function Ht(n, r, t) {
267 return T(
268 n,
269 n.attempt(this.parser.constructs.document, r, t),
270 "linePrefix",
271 this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4
272 );
273}
274function Qn(n) {
275 if (n === null || Y(n) || Pt(n))
276 return 1;
277 if (_t(n))
278 return 2;
279}
280function Bn(n, r, t) {
281 const e = [];
282 let u = -1;
283 for (; ++u < n.length; ) {
284 const a = n[u].resolveAll;
285 a && !e.includes(a) && (r = a(r, t), e.push(a));
286 }
287 return r;
288}
289const In = {
290 name: "attention",
291 tokenize: Nt,
292 resolveAll: Vt
293};
294function Vt(n, r) {
295 let t = -1, e, u, a, i, l, c, p, h;
296 for (; ++t < n.length; )
297 if (n[t][0] === "enter" && n[t][1].type === "attentionSequence" && n[t][1]._close) {
298 for (e = t; e--; )
299 if (n[e][0] === "exit" && n[e][1].type === "attentionSequence" && n[e][1]._open && // If the markers are the same:
300 r.sliceSerialize(n[e][1]).charCodeAt(0) === r.sliceSerialize(n[t][1]).charCodeAt(0)) {
301 if ((n[e][1]._close || n[t][1]._open) && (n[t][1].end.offset - n[t][1].start.offset) % 3 && !((n[e][1].end.offset - n[e][1].start.offset + n[t][1].end.offset - n[t][1].start.offset) % 3))
302 continue;
303 c = n[e][1].end.offset - n[e][1].start.offset > 1 && n[t][1].end.offset - n[t][1].start.offset > 1 ? 2 : 1;
304 const x = Object.assign({}, n[e][1].end), g = Object.assign({}, n[t][1].start);
305 Un(x, -c), Un(g, c), i = {
306 type: c > 1 ? "strongSequence" : "emphasisSequence",
307 start: x,
308 end: Object.assign({}, n[e][1].end)
309 }, l = {
310 type: c > 1 ? "strongSequence" : "emphasisSequence",
311 start: Object.assign({}, n[t][1].start),
312 end: g
313 }, a = {
314 type: c > 1 ? "strongText" : "emphasisText",
315 start: Object.assign({}, n[e][1].end),
316 end: Object.assign({}, n[t][1].start)
317 }, u = {
318 type: c > 1 ? "strong" : "emphasis",
319 start: Object.assign({}, i.start),
320 end: Object.assign({}, l.end)
321 }, n[e][1].end = Object.assign({}, i.start), n[t][1].start = Object.assign({}, l.end), p = [], n[e][1].end.offset - n[e][1].start.offset && (p = Z(p, [
322 ["enter", n[e][1], r],
323 ["exit", n[e][1], r]
324 ])), p = Z(p, [
325 ["enter", u, r],
326 ["enter", i, r],
327 ["exit", i, r],
328 ["enter", a, r]
329 ]), p = Z(
330 p,
331 Bn(
332 r.parser.constructs.insideSpan.null,
333 n.slice(e + 1, t),
334 r
335 )
336 ), p = Z(p, [
337 ["exit", a, r],
338 ["enter", l, r],
339 ["exit", l, r],
340 ["exit", u, r]
341 ]), n[t][1].end.offset - n[t][1].start.offset ? (h = 2, p = Z(p, [
342 ["enter", n[t][1], r],
343 ["exit", n[t][1], r]
344 ])) : h = 0, en(n, e - 1, t - e + 3, p), t = e + p.length - h - 2;
345 break;
346 }
347 }
348 for (t = -1; ++t < n.length; )
349 n[t][1].type === "attentionSequence" && (n[t][1].type = "data");
350 return n;
351}
352function Nt(n, r) {
353 const t = this.parser.constructs.attentionMarkers.null, e = this.previous, u = Qn(e);
354 let a;
355 return i;
356 function i(c) {
357 return n.enter("attentionSequence"), a = c, l(c);
358 }
359 function l(c) {
360 if (c === a)
361 return n.consume(c), l;
362 const p = n.exit("attentionSequence"), h = Qn(c), x = !h || h === 2 && u || t.includes(c), g = !u || u === 2 && h || t.includes(e);
363 return p._open = !!(a === 42 ? x : x && (u || !g)), p._close = !!(a === 42 ? g : g && (h || !x)), r(c);
364 }
365}
366function Un(n, r) {
367 n.column += r, n.offset += r, n._bufferIndex += r;
368}
369const Qt = {
370 name: "autolink",
371 tokenize: Ut
372};
373function Ut(n, r, t) {
374 let e = 1;
375 return u;
376 function u(k) {
377 return n.enter("autolink"), n.enter("autolinkMarker"), n.consume(k), n.exit("autolinkMarker"), n.enter("autolinkProtocol"), a;
378 }
379 function a(k) {
380 return tn(k) ? (n.consume(k), i) : Vn(k) ? p(k) : t(k);
381 }
382 function i(k) {
383 return k === 43 || k === 45 || k === 46 || v(k) ? l(k) : p(k);
384 }
385 function l(k) {
386 return k === 58 ? (n.consume(k), c) : (k === 43 || k === 45 || k === 46 || v(k)) && e++ < 32 ? (n.consume(k), l) : p(k);
387 }
388 function c(k) {
389 return k === 62 ? (n.exit("autolinkProtocol"), f(k)) : k === null || k === 32 || k === 60 || zn(k) ? t(k) : (n.consume(k), c);
390 }
391 function p(k) {
392 return k === 64 ? (n.consume(k), e = 0, h) : Vn(k) ? (n.consume(k), p) : t(k);
393 }
394 function h(k) {
395 return v(k) ? x(k) : t(k);
396 }
397 function x(k) {
398 return k === 46 ? (n.consume(k), e = 0, h) : k === 62 ? (n.exit("autolinkProtocol").type = "autolinkEmail", f(k)) : g(k);
399 }
400 function g(k) {
401 return (k === 45 || v(k)) && e++ < 63 ? (n.consume(k), k === 45 ? g : x) : t(k);
402 }
403 function f(k) {
404 return n.enter("autolinkMarker"), n.consume(k), n.exit("autolinkMarker"), n.exit("autolink"), r;
405 }
406}
407const Sn = {
408 tokenize: Wt,
409 partial: !0
410};
411function Wt(n, r, t) {
412 return T(n, e, "linePrefix");
413 function e(u) {
414 return u === null || C(u) ? r(u) : t(u);
415 }
416}
417const et = {
418 name: "blockQuote",
419 tokenize: $t,
420 continuation: {
421 tokenize: Zt
422 },
423 exit: Yt
424};
425function $t(n, r, t) {
426 const e = this;
427 return u;
428 function u(i) {
429 if (i === 62) {
430 const l = e.containerState;
431 return l.open || (n.enter("blockQuote", {
432 _container: !0
433 }), l.open = !0), n.enter("blockQuotePrefix"), n.enter("blockQuoteMarker"), n.consume(i), n.exit("blockQuoteMarker"), a;
434 }
435 return t(i);
436 }
437 function a(i) {
438 return q(i) ? (n.enter("blockQuotePrefixWhitespace"), n.consume(i), n.exit("blockQuotePrefixWhitespace"), n.exit("blockQuotePrefix"), r) : (n.exit("blockQuotePrefix"), r(i));
439 }
440}
441function Zt(n, r, t) {
442 return T(
443 n,
444 n.attempt(et, r, t),
445 "linePrefix",
446 this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4
447 );
448}
449function Yt(n) {
450 n.exit("blockQuote");
451}
452const rt = {
453 name: "characterEscape",
454 tokenize: Gt
455};
456function Gt(n, r, t) {
457 return e;
458 function e(a) {
459 return n.enter("characterEscape"), n.enter("escapeMarker"), n.consume(a), n.exit("escapeMarker"), u;
460 }
461 function u(a) {
462 return Dt(a) ? (n.enter("characterEscapeValue"), n.consume(a), n.exit("characterEscapeValue"), n.exit("characterEscape"), r) : t(a);
463 }
464}
465const Wn = document.createElement("i");
466function Ln(n) {
467 const r = "&" + n + ";";
468 Wn.innerHTML = r;
469 const t = Wn.textContent;
470 return t.charCodeAt(t.length - 1) === 59 && n !== "semi" || t === r ? !1 : t;
471}
472const it = {
473 name: "characterReference",
474 tokenize: Jt
475};
476function Jt(n, r, t) {
477 const e = this;
478 let u = 0, a, i;
479 return l;
480 function l(x) {
481 return n.enter("characterReference"), n.enter("characterReferenceMarker"), n.consume(x), n.exit("characterReferenceMarker"), c;
482 }
483 function c(x) {
484 return x === 35 ? (n.enter("characterReferenceMarkerNumeric"), n.consume(x), n.exit("characterReferenceMarkerNumeric"), p) : (n.enter("characterReferenceValue"), a = 31, i = v, h(x));
485 }
486 function p(x) {
487 return x === 88 || x === 120 ? (n.enter("characterReferenceMarkerHexadecimal"), n.consume(x), n.exit("characterReferenceMarkerHexadecimal"), n.enter("characterReferenceValue"), a = 6, i = Ot, h) : (n.enter("characterReferenceValue"), a = 7, i = An, h(x));
488 }
489 function h(x) {
490 let g;
491 return x === 59 && u ? (g = n.exit("characterReferenceValue"), i === v && !Ln(e.sliceSerialize(g)) ? t(x) : (n.enter("characterReferenceMarker"), n.consume(x), n.exit("characterReferenceMarker"), n.exit("characterReference"), r)) : i(x) && u++ < a ? (n.consume(x), h) : t(x);
492 }
493}
494const $n = {
495 name: "codeFenced",
496 tokenize: Kt,
497 concrete: !0
498};
499function Kt(n, r, t) {
500 const e = this, u = {
501 tokenize: O,
502 partial: !0
503 }, a = {
504 tokenize: L,
505 partial: !0
506 }, i = this.events[this.events.length - 1], l = i && i[1].type === "linePrefix" ? i[2].sliceSerialize(i[1], !0).length : 0;
507 let c = 0, p;
508 return h;
509 function h(d) {
510 return n.enter("codeFenced"), n.enter("codeFencedFence"), n.enter("codeFencedFenceSequence"), p = d, x(d);
511 }
512 function x(d) {
513 return d === p ? (n.consume(d), c++, x) : (n.exit("codeFencedFenceSequence"), c < 3 ? t(d) : T(n, g, "whitespace")(d));
514 }
515 function g(d) {
516 return d === null || C(d) ? D(d) : (n.enter("codeFencedFenceInfo"), n.enter("chunkString", {
517 contentType: "string"
518 }), f(d));
519 }
520 function f(d) {
521 return d === null || Y(d) ? (n.exit("chunkString"), n.exit("codeFencedFenceInfo"), T(n, k, "whitespace")(d)) : d === 96 && d === p ? t(d) : (n.consume(d), f);
522 }
523 function k(d) {
524 return d === null || C(d) ? D(d) : (n.enter("codeFencedFenceMeta"), n.enter("chunkString", {
525 contentType: "string"
526 }), B(d));
527 }
528 function B(d) {
529 return d === null || C(d) ? (n.exit("chunkString"), n.exit("codeFencedFenceMeta"), D(d)) : d === 96 && d === p ? t(d) : (n.consume(d), B);
530 }
531 function D(d) {
532 return n.exit("codeFencedFence"), e.interrupt ? r(d) : y(d);
533 }
534 function y(d) {
535 return d === null ? F(d) : C(d) ? n.attempt(
536 a,
537 n.attempt(
538 u,
539 F,
540 l ? T(
541 n,
542 y,
543 "linePrefix",
544 l + 1
545 ) : y
546 ),
547 F
548 )(d) : (n.enter("codeFlowValue"), _(d));
549 }
550 function _(d) {
551 return d === null || C(d) ? (n.exit("codeFlowValue"), y(d)) : (n.consume(d), _);
552 }
553 function F(d) {
554 return n.exit("codeFenced"), r(d);
555 }
556 function L(d, P, R) {
557 const j = this;
558 return N;
559 function N(w) {
560 return d.enter("lineEnding"), d.consume(w), d.exit("lineEnding"), S;
561 }
562 function S(w) {
563 return j.parser.lazy[j.now().line] ? R(w) : P(w);
564 }
565 }
566 function O(d, P, R) {
567 let j = 0;
568 return T(
569 d,
570 N,
571 "linePrefix",
572 this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4
573 );
574 function N(A) {
575 return d.enter("codeFencedFence"), d.enter("codeFencedFenceSequence"), S(A);
576 }
577 function S(A) {
578 return A === p ? (d.consume(A), j++, S) : j < c ? R(A) : (d.exit("codeFencedFenceSequence"), T(d, w, "whitespace")(A));
579 }
580 function w(A) {
581 return A === null || C(A) ? (d.exit("codeFencedFence"), P(A)) : R(A);
582 }
583 }
584}
585const En = {
586 name: "codeIndented",
587 tokenize: vt
588}, Xt = {
589 tokenize: ne,
590 partial: !0
591};
592function vt(n, r, t) {
593 const e = this;
594 return u;
595 function u(p) {
596 return n.enter("codeIndented"), T(n, a, "linePrefix", 4 + 1)(p);
597 }
598 function a(p) {
599 const h = e.events[e.events.length - 1];
600 return h && h[1].type === "linePrefix" && h[2].sliceSerialize(h[1], !0).length >= 4 ? i(p) : t(p);
601 }
602 function i(p) {
603 return p === null ? c(p) : C(p) ? n.attempt(Xt, i, c)(p) : (n.enter("codeFlowValue"), l(p));
604 }
605 function l(p) {
606 return p === null || C(p) ? (n.exit("codeFlowValue"), i(p)) : (n.consume(p), l);
607 }
608 function c(p) {
609 return n.exit("codeIndented"), r(p);
610 }
611}
612function ne(n, r, t) {
613 const e = this;
614 return u;
615 function u(i) {
616 return e.parser.lazy[e.now().line] ? t(i) : C(i) ? (n.enter("lineEnding"), n.consume(i), n.exit("lineEnding"), u) : T(n, a, "linePrefix", 4 + 1)(i);
617 }
618 function a(i) {
619 const l = e.events[e.events.length - 1];
620 return l && l[1].type === "linePrefix" && l[2].sliceSerialize(l[1], !0).length >= 4 ? r(i) : C(i) ? u(i) : t(i);
621 }
622}
623const te = {
624 name: "codeText",
625 tokenize: ie,
626 resolve: ee,
627 previous: re
628};
629function ee(n) {
630 let r = n.length - 4, t = 3, e, u;
631 if ((n[t][1].type === "lineEnding" || n[t][1].type === "space") && (n[r][1].type === "lineEnding" || n[r][1].type === "space")) {
632 for (e = t; ++e < r; )
633 if (n[e][1].type === "codeTextData") {
634 n[t][1].type = "codeTextPadding", n[r][1].type = "codeTextPadding", t += 2, r -= 2;
635 break;
636 }
637 }
638 for (e = t - 1, r++; ++e <= r; )
639 u === void 0 ? e !== r && n[e][1].type !== "lineEnding" && (u = e) : (e === r || n[e][1].type === "lineEnding") && (n[u][1].type = "codeTextData", e !== u + 2 && (n[u][1].end = n[e - 1][1].end, n.splice(u + 2, e - u - 2), r -= e - u - 2, e = u + 2), u = void 0);
640 return n;
641}
642function re(n) {
643 return n !== 96 || this.events[this.events.length - 1][1].type === "characterEscape";
644}
645function ie(n, r, t) {
646 let e = 0, u, a;
647 return i;
648 function i(x) {
649 return n.enter("codeText"), n.enter("codeTextSequence"), l(x);
650 }
651 function l(x) {
652 return x === 96 ? (n.consume(x), e++, l) : (n.exit("codeTextSequence"), c(x));
653 }
654 function c(x) {
655 return x === null ? t(x) : x === 96 ? (a = n.enter("codeTextSequence"), u = 0, h(x)) : x === 32 ? (n.enter("space"), n.consume(x), n.exit("space"), c) : C(x) ? (n.enter("lineEnding"), n.consume(x), n.exit("lineEnding"), c) : (n.enter("codeTextData"), p(x));
656 }
657 function p(x) {
658 return x === null || x === 32 || x === 96 || C(x) ? (n.exit("codeTextData"), c(x)) : (n.consume(x), p);
659 }
660 function h(x) {
661 return x === 96 ? (n.consume(x), u++, h) : u === e ? (n.exit("codeTextSequence"), n.exit("codeText"), r(x)) : (a.type = "codeTextData", p(x));
662 }
663}
664function ut(n) {
665 const r = {};
666 let t = -1, e, u, a, i, l, c, p;
667 for (; ++t < n.length; ) {
668 for (; t in r; )
669 t = r[t];
670 if (e = n[t], t && e[1].type === "chunkFlow" && n[t - 1][1].type === "listItemPrefix" && (c = e[1]._tokenizer.events, a = 0, a < c.length && c[a][1].type === "lineEndingBlank" && (a += 2), a < c.length && c[a][1].type === "content"))
671 for (; ++a < c.length && c[a][1].type !== "content"; )
672 c[a][1].type === "chunkText" && (c[a][1]._isInFirstContentOfListItem = !0, a++);
673 if (e[0] === "enter")
674 e[1].contentType && (Object.assign(r, ue(n, t)), t = r[t], p = !0);
675 else if (e[1]._container) {
676 for (a = t, u = void 0; a-- && (i = n[a], i[1].type === "lineEnding" || i[1].type === "lineEndingBlank"); )
677 i[0] === "enter" && (u && (n[u][1].type = "lineEndingBlank"), i[1].type = "lineEnding", u = a);
678 u && (e[1].end = Object.assign({}, n[u][1].start), l = n.slice(u, t), l.unshift(e), en(n, u, t - u + 1, l));
679 }
680 }
681 return !p;
682}
683function ue(n, r) {
684 const t = n[r][1], e = n[r][2];
685 let u = r - 1;
686 const a = [], i = t._tokenizer || e.parser[t.contentType](t.start), l = i.events, c = [], p = {};
687 let h, x, g = -1, f = t, k = 0, B = 0;
688 const D = [B];
689 for (; f; ) {
690 for (; n[++u][1] !== f; )
691 ;
692 a.push(u), f._tokenizer || (h = e.sliceStream(f), f.next || h.push(null), x && i.defineSkip(f.start), f._isInFirstContentOfListItem && (i._gfmTasklistFirstContentOfListItem = !0), i.write(h), f._isInFirstContentOfListItem && (i._gfmTasklistFirstContentOfListItem = void 0)), x = f, f = f.next;
693 }
694 for (f = t; ++g < l.length; )
695 // Find a void token that includes a break.
696 l[g][0] === "exit" && l[g - 1][0] === "enter" && l[g][1].type === l[g - 1][1].type && l[g][1].start.line !== l[g][1].end.line && (B = g + 1, D.push(B), f._tokenizer = void 0, f.previous = void 0, f = f.next);
697 for (i.events = [], f ? (f._tokenizer = void 0, f.previous = void 0) : D.pop(), g = D.length; g--; ) {
698 const y = l.slice(D[g], D[g + 1]), _ = a.pop();
699 c.unshift([_, _ + y.length - 1]), en(n, _, 2, y);
700 }
701 for (g = -1; ++g < c.length; )
702 p[k + c[g][0]] = k + c[g][1], k += c[g][1] - c[g][0] - 1;
703 return p;
704}
705const ae = {
706 tokenize: se,
707 resolve: oe
708}, le = {
709 tokenize: ce,
710 partial: !0
711};
712function oe(n) {
713 return ut(n), n;
714}
715function se(n, r) {
716 let t;
717 return e;
718 function e(l) {
719 return n.enter("content"), t = n.enter("chunkContent", {
720 contentType: "content"
721 }), u(l);
722 }
723 function u(l) {
724 return l === null ? a(l) : C(l) ? n.check(
725 le,
726 i,
727 a
728 )(l) : (n.consume(l), u);
729 }
730 function a(l) {
731 return n.exit("chunkContent"), n.exit("content"), r(l);
732 }
733 function i(l) {
734 return n.consume(l), n.exit("chunkContent"), t.next = n.enter("chunkContent", {
735 contentType: "content",
736 previous: t
737 }), t = t.next, u;
738 }
739}
740function ce(n, r, t) {
741 const e = this;
742 return u;
743 function u(i) {
744 return n.exit("chunkContent"), n.enter("lineEnding"), n.consume(i), n.exit("lineEnding"), T(n, a, "linePrefix");
745 }
746 function a(i) {
747 if (i === null || C(i))
748 return t(i);
749 const l = e.events[e.events.length - 1];
750 return !e.parser.constructs.disable.null.includes("codeIndented") && l && l[1].type === "linePrefix" && l[2].sliceSerialize(l[1], !0).length >= 4 ? r(i) : n.interrupt(e.parser.constructs.flow, t, r)(i);
751 }
752}
753function at(n, r, t, e, u, a, i, l, c) {
754 const p = c || Number.POSITIVE_INFINITY;
755 let h = 0;
756 return x;
757 function x(y) {
758 return y === 60 ? (n.enter(e), n.enter(u), n.enter(a), n.consume(y), n.exit(a), g) : y === null || y === 41 || zn(y) ? t(y) : (n.enter(e), n.enter(i), n.enter(l), n.enter("chunkString", {
759 contentType: "string"
760 }), B(y));
761 }
762 function g(y) {
763 return y === 62 ? (n.enter(a), n.consume(y), n.exit(a), n.exit(u), n.exit(e), r) : (n.enter(l), n.enter("chunkString", {
764 contentType: "string"
765 }), f(y));
766 }
767 function f(y) {
768 return y === 62 ? (n.exit("chunkString"), n.exit(l), g(y)) : y === null || y === 60 || C(y) ? t(y) : (n.consume(y), y === 92 ? k : f);
769 }
770 function k(y) {
771 return y === 60 || y === 62 || y === 92 ? (n.consume(y), f) : f(y);
772 }
773 function B(y) {
774 return y === 40 ? ++h > p ? t(y) : (n.consume(y), B) : y === 41 ? h-- ? (n.consume(y), B) : (n.exit("chunkString"), n.exit(l), n.exit(i), n.exit(e), r(y)) : y === null || Y(y) ? h ? t(y) : (n.exit("chunkString"), n.exit(l), n.exit(i), n.exit(e), r(y)) : zn(y) ? t(y) : (n.consume(y), y === 92 ? D : B);
775 }
776 function D(y) {
777 return y === 40 || y === 41 || y === 92 ? (n.consume(y), B) : B(y);
778 }
779}
780function lt(n, r, t, e, u, a) {
781 const i = this;
782 let l = 0, c;
783 return p;
784 function p(f) {
785 return n.enter(e), n.enter(u), n.consume(f), n.exit(u), n.enter(a), h;
786 }
787 function h(f) {
788 return f === null || f === 91 || f === 93 && !c || /* To do: remove in the future once we’ve switched from
789 * `micromark-extension-footnote` to `micromark-extension-gfm-footnote`,
790 * which doesn’t need this */
791 /* Hidden footnotes hook */
792 /* c8 ignore next 3 */
793 f === 94 && !l && "_hiddenFootnoteSupport" in i.parser.constructs || l > 999 ? t(f) : f === 93 ? (n.exit(a), n.enter(u), n.consume(f), n.exit(u), n.exit(e), r) : C(f) ? (n.enter("lineEnding"), n.consume(f), n.exit("lineEnding"), h) : (n.enter("chunkString", {
794 contentType: "string"
795 }), x(f));
796 }
797 function x(f) {
798 return f === null || f === 91 || f === 93 || C(f) || l++ > 999 ? (n.exit("chunkString"), h(f)) : (n.consume(f), c = c || !q(f), f === 92 ? g : x);
799 }
800 function g(f) {
801 return f === 91 || f === 92 || f === 93 ? (n.consume(f), l++, x) : x(f);
802 }
803}
804function ot(n, r, t, e, u, a) {
805 let i;
806 return l;
807 function l(g) {
808 return n.enter(e), n.enter(u), n.consume(g), n.exit(u), i = g === 40 ? 41 : g, c;
809 }
810 function c(g) {
811 return g === i ? (n.enter(u), n.consume(g), n.exit(u), n.exit(e), r) : (n.enter(a), p(g));
812 }
813 function p(g) {
814 return g === i ? (n.exit(a), c(i)) : g === null ? t(g) : C(g) ? (n.enter("lineEnding"), n.consume(g), n.exit("lineEnding"), T(n, p, "linePrefix")) : (n.enter("chunkString", {
815 contentType: "string"
816 }), h(g));
817 }
818 function h(g) {
819 return g === i || g === null || C(g) ? (n.exit("chunkString"), p(g)) : (n.consume(g), g === 92 ? x : h);
820 }
821 function x(g) {
822 return g === i || g === 92 ? (n.consume(g), h) : h(g);
823 }
824}
825function dn(n, r) {
826 let t;
827 return e;
828 function e(u) {
829 return C(u) ? (n.enter("lineEnding"), n.consume(u), n.exit("lineEnding"), t = !0, e) : q(u) ? T(
830 n,
831 e,
832 t ? "linePrefix" : "lineSuffix"
833 )(u) : r(u);
834 }
835}
836function fn(n) {
837 return n.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
838}
839const he = {
840 name: "definition",
841 tokenize: me
842}, pe = {
843 tokenize: fe,
844 partial: !0
845};
846function me(n, r, t) {
847 const e = this;
848 let u;
849 return a;
850 function a(c) {
851 return n.enter("definition"), lt.call(
852 e,
853 n,
854 i,
855 t,
856 "definitionLabel",
857 "definitionLabelMarker",
858 "definitionLabelString"
859 )(c);
860 }
861 function i(c) {
862 return u = fn(
863 e.sliceSerialize(e.events[e.events.length - 1][1]).slice(1, -1)
864 ), c === 58 ? (n.enter("definitionMarker"), n.consume(c), n.exit("definitionMarker"), dn(
865 n,
866 at(
867 n,
868 n.attempt(
869 pe,
870 T(n, l, "whitespace"),
871 T(n, l, "whitespace")
872 ),
873 t,
874 "definitionDestination",
875 "definitionDestinationLiteral",
876 "definitionDestinationLiteralMarker",
877 "definitionDestinationRaw",
878 "definitionDestinationString"
879 )
880 )) : t(c);
881 }
882 function l(c) {
883 return c === null || C(c) ? (n.exit("definition"), e.parser.defined.includes(u) || e.parser.defined.push(u), r(c)) : t(c);
884 }
885}
886function fe(n, r, t) {
887 return e;
888 function e(i) {
889 return Y(i) ? dn(n, u)(i) : t(i);
890 }
891 function u(i) {
892 return i === 34 || i === 39 || i === 40 ? ot(
893 n,
894 T(n, a, "whitespace"),
895 t,
896 "definitionTitle",
897 "definitionTitleMarker",
898 "definitionTitleString"
899 )(i) : t(i);
900 }
901 function a(i) {
902 return i === null || C(i) ? r(i) : t(i);
903 }
904}
905const xe = {
906 name: "hardBreakEscape",
907 tokenize: ge
908};
909function ge(n, r, t) {
910 return e;
911 function e(a) {
912 return n.enter("hardBreakEscape"), n.enter("escapeMarker"), n.consume(a), u;
913 }
914 function u(a) {
915 return C(a) ? (n.exit("escapeMarker"), n.exit("hardBreakEscape"), r(a)) : t(a);
916 }
917}
918const ke = {
919 name: "headingAtx",
920 tokenize: be,
921 resolve: de
922};
923function de(n, r) {
924 let t = n.length - 2, e = 3, u, a;
925 return n[e][1].type === "whitespace" && (e += 2), t - 2 > e && n[t][1].type === "whitespace" && (t -= 2), n[t][1].type === "atxHeadingSequence" && (e === t - 1 || t - 4 > e && n[t - 2][1].type === "whitespace") && (t -= e + 1 === t ? 2 : 4), t > e && (u = {
926 type: "atxHeadingText",
927 start: n[e][1].start,
928 end: n[t][1].end
929 }, a = {
930 type: "chunkText",
931 start: n[e][1].start,
932 end: n[t][1].end,
933 // @ts-expect-error Constants are fine to assign.
934 contentType: "text"
935 }, en(n, e, t - e + 1, [
936 ["enter", u, r],
937 ["enter", a, r],
938 ["exit", a, r],
939 ["exit", u, r]
940 ])), n;
941}
942function be(n, r, t) {
943 const e = this;
944 let u = 0;
945 return a;
946 function a(h) {
947 return n.enter("atxHeading"), n.enter("atxHeadingSequence"), i(h);
948 }
949 function i(h) {
950 return h === 35 && u++ < 6 ? (n.consume(h), i) : h === null || Y(h) ? (n.exit("atxHeadingSequence"), e.interrupt ? r(h) : l(h)) : t(h);
951 }
952 function l(h) {
953 return h === 35 ? (n.enter("atxHeadingSequence"), c(h)) : h === null || C(h) ? (n.exit("atxHeading"), r(h)) : q(h) ? T(n, l, "whitespace")(h) : (n.enter("atxHeadingText"), p(h));
954 }
955 function c(h) {
956 return h === 35 ? (n.consume(h), c) : (n.exit("atxHeadingSequence"), l(h));
957 }
958 function p(h) {
959 return h === null || h === 35 || Y(h) ? (n.exit("atxHeadingText"), l(h)) : (n.consume(h), p);
960 }
961}
962const ye = [
963 "address",
964 "article",
965 "aside",
966 "base",
967 "basefont",
968 "blockquote",
969 "body",
970 "caption",
971 "center",
972 "col",
973 "colgroup",
974 "dd",
975 "details",
976 "dialog",
977 "dir",
978 "div",
979 "dl",
980 "dt",
981 "fieldset",
982 "figcaption",
983 "figure",
984 "footer",
985 "form",
986 "frame",
987 "frameset",
988 "h1",
989 "h2",
990 "h3",
991 "h4",
992 "h5",
993 "h6",
994 "head",
995 "header",
996 "hr",
997 "html",
998 "iframe",
999 "legend",
1000 "li",
1001 "link",
1002 "main",
1003 "menu",
1004 "menuitem",
1005 "nav",
1006 "noframes",
1007 "ol",
1008 "optgroup",
1009 "option",
1010 "p",
1011 "param",
1012 "section",
1013 "summary",
1014 "table",
1015 "tbody",
1016 "td",
1017 "tfoot",
1018 "th",
1019 "thead",
1020 "title",
1021 "tr",
1022 "track",
1023 "ul"
1024], Zn = ["pre", "script", "style", "textarea"], Se = {
1025 name: "htmlFlow",
1026 tokenize: Ee,
1027 resolveTo: we,
1028 concrete: !0
1029}, Fe = {
1030 tokenize: Ce,
1031 partial: !0
1032};
1033function we(n) {
1034 let r = n.length;
1035 for (; r-- && !(n[r][0] === "enter" && n[r][1].type === "htmlFlow"); )
1036 ;
1037 return r > 1 && n[r - 2][1].type === "linePrefix" && (n[r][1].start = n[r - 2][1].start, n[r + 1][1].start = n[r - 2][1].start, n.splice(r - 2, 2)), n;
1038}
1039function Ee(n, r, t) {
1040 const e = this;
1041 let u, a, i, l, c;
1042 return p;
1043 function p(o) {
1044 return n.enter("htmlFlow"), n.enter("htmlFlowData"), n.consume(o), h;
1045 }
1046 function h(o) {
1047 return o === 33 ? (n.consume(o), x) : o === 47 ? (n.consume(o), k) : o === 63 ? (n.consume(o), u = 3, e.interrupt ? r : W) : tn(o) ? (n.consume(o), i = String.fromCharCode(o), a = !0, B) : t(o);
1048 }
1049 function x(o) {
1050 return o === 45 ? (n.consume(o), u = 2, g) : o === 91 ? (n.consume(o), u = 5, i = "CDATA[", l = 0, f) : tn(o) ? (n.consume(o), u = 4, e.interrupt ? r : W) : t(o);
1051 }
1052 function g(o) {
1053 return o === 45 ? (n.consume(o), e.interrupt ? r : W) : t(o);
1054 }
1055 function f(o) {
1056 return o === i.charCodeAt(l++) ? (n.consume(o), l === i.length ? e.interrupt ? r : S : f) : t(o);
1057 }
1058 function k(o) {
1059 return tn(o) ? (n.consume(o), i = String.fromCharCode(o), B) : t(o);
1060 }
1061 function B(o) {
1062 return o === null || o === 47 || o === 62 || Y(o) ? o !== 47 && a && Zn.includes(i.toLowerCase()) ? (u = 1, e.interrupt ? r(o) : S(o)) : ye.includes(i.toLowerCase()) ? (u = 6, o === 47 ? (n.consume(o), D) : e.interrupt ? r(o) : S(o)) : (u = 7, e.interrupt && !e.parser.lazy[e.now().line] ? t(o) : a ? _(o) : y(o)) : o === 45 || v(o) ? (n.consume(o), i += String.fromCharCode(o), B) : t(o);
1063 }
1064 function D(o) {
1065 return o === 62 ? (n.consume(o), e.interrupt ? r : S) : t(o);
1066 }
1067 function y(o) {
1068 return q(o) ? (n.consume(o), y) : j(o);
1069 }
1070 function _(o) {
1071 return o === 47 ? (n.consume(o), j) : o === 58 || o === 95 || tn(o) ? (n.consume(o), F) : q(o) ? (n.consume(o), _) : j(o);
1072 }
1073 function F(o) {
1074 return o === 45 || o === 46 || o === 58 || o === 95 || v(o) ? (n.consume(o), F) : L(o);
1075 }
1076 function L(o) {
1077 return o === 61 ? (n.consume(o), O) : q(o) ? (n.consume(o), L) : _(o);
1078 }
1079 function O(o) {
1080 return o === null || o === 60 || o === 61 || o === 62 || o === 96 ? t(o) : o === 34 || o === 39 ? (n.consume(o), c = o, d) : q(o) ? (n.consume(o), O) : (c = null, P(o));
1081 }
1082 function d(o) {
1083 return o === null || C(o) ? t(o) : o === c ? (n.consume(o), R) : (n.consume(o), d);
1084 }
1085 function P(o) {
1086 return o === null || o === 34 || o === 39 || o === 60 || o === 61 || o === 62 || o === 96 || Y(o) ? L(o) : (n.consume(o), P);
1087 }
1088 function R(o) {
1089 return o === 47 || o === 62 || q(o) ? _(o) : t(o);
1090 }
1091 function j(o) {
1092 return o === 62 ? (n.consume(o), N) : t(o);
1093 }
1094 function N(o) {
1095 return q(o) ? (n.consume(o), N) : o === null || C(o) ? S(o) : t(o);
1096 }
1097 function S(o) {
1098 return o === 45 && u === 2 ? (n.consume(o), G) : o === 60 && u === 1 ? (n.consume(o), nn) : o === 62 && u === 4 ? (n.consume(o), H) : o === 63 && u === 3 ? (n.consume(o), W) : o === 93 && u === 5 ? (n.consume(o), Q) : C(o) && (u === 6 || u === 7) ? n.check(
1099 Fe,
1100 H,
1101 w
1102 )(o) : o === null || C(o) ? w(o) : (n.consume(o), S);
1103 }
1104 function w(o) {
1105 return n.exit("htmlFlowData"), A(o);
1106 }
1107 function A(o) {
1108 return o === null ? s(o) : C(o) ? n.attempt(
1109 {
1110 tokenize: U,
1111 partial: !0
1112 },
1113 A,
1114 s
1115 )(o) : (n.enter("htmlFlowData"), S(o));
1116 }
1117 function U(o, cn, xn) {
1118 return hn;
1119 function hn(K) {
1120 return o.enter("lineEnding"), o.consume(K), o.exit("lineEnding"), V;
1121 }
1122 function V(K) {
1123 return e.parser.lazy[e.now().line] ? xn(K) : cn(K);
1124 }
1125 }
1126 function G(o) {
1127 return o === 45 ? (n.consume(o), W) : S(o);
1128 }
1129 function nn(o) {
1130 return o === 47 ? (n.consume(o), i = "", J) : S(o);
1131 }
1132 function J(o) {
1133 return o === 62 && Zn.includes(i.toLowerCase()) ? (n.consume(o), H) : tn(o) && i.length < 8 ? (n.consume(o), i += String.fromCharCode(o), J) : S(o);
1134 }
1135 function Q(o) {
1136 return o === 93 ? (n.consume(o), W) : S(o);
1137 }
1138 function W(o) {
1139 return o === 62 ? (n.consume(o), H) : o === 45 && u === 2 ? (n.consume(o), W) : S(o);
1140 }
1141 function H(o) {
1142 return o === null || C(o) ? (n.exit("htmlFlowData"), s(o)) : (n.consume(o), H);
1143 }
1144 function s(o) {
1145 return n.exit("htmlFlow"), r(o);
1146 }
1147}
1148function Ce(n, r, t) {
1149 return e;
1150 function e(u) {
1151 return n.exit("htmlFlowData"), n.enter("lineEndingBlank"), n.consume(u), n.exit("lineEndingBlank"), n.attempt(Sn, r, t);
1152 }
1153}
1154const Ae = {
1155 name: "htmlText",
1156 tokenize: ze
1157};
1158function ze(n, r, t) {
1159 const e = this;
1160 let u, a, i, l;
1161 return c;
1162 function c(s) {
1163 return n.enter("htmlText"), n.enter("htmlTextData"), n.consume(s), p;
1164 }
1165 function p(s) {
1166 return s === 33 ? (n.consume(s), h) : s === 47 ? (n.consume(s), P) : s === 63 ? (n.consume(s), O) : tn(s) ? (n.consume(s), N) : t(s);
1167 }
1168 function h(s) {
1169 return s === 45 ? (n.consume(s), x) : s === 91 ? (n.consume(s), a = "CDATA[", i = 0, D) : tn(s) ? (n.consume(s), L) : t(s);
1170 }
1171 function x(s) {
1172 return s === 45 ? (n.consume(s), g) : t(s);
1173 }
1174 function g(s) {
1175 return s === null || s === 62 ? t(s) : s === 45 ? (n.consume(s), f) : k(s);
1176 }
1177 function f(s) {
1178 return s === null || s === 62 ? t(s) : k(s);
1179 }
1180 function k(s) {
1181 return s === null ? t(s) : s === 45 ? (n.consume(s), B) : C(s) ? (l = k, Q(s)) : (n.consume(s), k);
1182 }
1183 function B(s) {
1184 return s === 45 ? (n.consume(s), H) : k(s);
1185 }
1186 function D(s) {
1187 return s === a.charCodeAt(i++) ? (n.consume(s), i === a.length ? y : D) : t(s);
1188 }
1189 function y(s) {
1190 return s === null ? t(s) : s === 93 ? (n.consume(s), _) : C(s) ? (l = y, Q(s)) : (n.consume(s), y);
1191 }
1192 function _(s) {
1193 return s === 93 ? (n.consume(s), F) : y(s);
1194 }
1195 function F(s) {
1196 return s === 62 ? H(s) : s === 93 ? (n.consume(s), F) : y(s);
1197 }
1198 function L(s) {
1199 return s === null || s === 62 ? H(s) : C(s) ? (l = L, Q(s)) : (n.consume(s), L);
1200 }
1201 function O(s) {
1202 return s === null ? t(s) : s === 63 ? (n.consume(s), d) : C(s) ? (l = O, Q(s)) : (n.consume(s), O);
1203 }
1204 function d(s) {
1205 return s === 62 ? H(s) : O(s);
1206 }
1207 function P(s) {
1208 return tn(s) ? (n.consume(s), R) : t(s);
1209 }
1210 function R(s) {
1211 return s === 45 || v(s) ? (n.consume(s), R) : j(s);
1212 }
1213 function j(s) {
1214 return C(s) ? (l = j, Q(s)) : q(s) ? (n.consume(s), j) : H(s);
1215 }
1216 function N(s) {
1217 return s === 45 || v(s) ? (n.consume(s), N) : s === 47 || s === 62 || Y(s) ? S(s) : t(s);
1218 }
1219 function S(s) {
1220 return s === 47 ? (n.consume(s), H) : s === 58 || s === 95 || tn(s) ? (n.consume(s), w) : C(s) ? (l = S, Q(s)) : q(s) ? (n.consume(s), S) : H(s);
1221 }
1222 function w(s) {
1223 return s === 45 || s === 46 || s === 58 || s === 95 || v(s) ? (n.consume(s), w) : A(s);
1224 }
1225 function A(s) {
1226 return s === 61 ? (n.consume(s), U) : C(s) ? (l = A, Q(s)) : q(s) ? (n.consume(s), A) : S(s);
1227 }
1228 function U(s) {
1229 return s === null || s === 60 || s === 61 || s === 62 || s === 96 ? t(s) : s === 34 || s === 39 ? (n.consume(s), u = s, G) : C(s) ? (l = U, Q(s)) : q(s) ? (n.consume(s), U) : (n.consume(s), u = void 0, J);
1230 }
1231 function G(s) {
1232 return s === u ? (n.consume(s), nn) : s === null ? t(s) : C(s) ? (l = G, Q(s)) : (n.consume(s), G);
1233 }
1234 function nn(s) {
1235 return s === 62 || s === 47 || Y(s) ? S(s) : t(s);
1236 }
1237 function J(s) {
1238 return s === null || s === 34 || s === 39 || s === 60 || s === 61 || s === 96 ? t(s) : s === 62 || Y(s) ? S(s) : (n.consume(s), J);
1239 }
1240 function Q(s) {
1241 return n.exit("htmlTextData"), n.enter("lineEnding"), n.consume(s), n.exit("lineEnding"), T(
1242 n,
1243 W,
1244 "linePrefix",
1245 e.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4
1246 );
1247 }
1248 function W(s) {
1249 return n.enter("htmlTextData"), l(s);
1250 }
1251 function H(s) {
1252 return s === 62 ? (n.consume(s), n.exit("htmlTextData"), n.exit("htmlText"), r) : t(s);
1253 }
1254}
1255const On = {
1256 name: "labelEnd",
1257 tokenize: De,
1258 resolveTo: Oe,
1259 resolveAll: Le
1260}, Ie = {
1261 tokenize: Pe
1262}, Te = {
1263 tokenize: _e
1264}, Be = {
1265 tokenize: Me
1266};
1267function Le(n) {
1268 let r = -1, t;
1269 for (; ++r < n.length; )
1270 t = n[r][1], (t.type === "labelImage" || t.type === "labelLink" || t.type === "labelEnd") && (n.splice(r + 1, t.type === "labelImage" ? 4 : 2), t.type = "data", r++);
1271 return n;
1272}
1273function Oe(n, r) {
1274 let t = n.length, e = 0, u, a, i, l;
1275 for (; t--; )
1276 if (u = n[t][1], a) {
1277 if (u.type === "link" || u.type === "labelLink" && u._inactive)
1278 break;
1279 n[t][0] === "enter" && u.type === "labelLink" && (u._inactive = !0);
1280 } else if (i) {
1281 if (n[t][0] === "enter" && (u.type === "labelImage" || u.type === "labelLink") && !u._balanced && (a = t, u.type !== "labelLink")) {
1282 e = 2;
1283 break;
1284 }
1285 } else
1286 u.type === "labelEnd" && (i = t);
1287 const c = {
1288 type: n[a][1].type === "labelLink" ? "link" : "image",
1289 start: Object.assign({}, n[a][1].start),
1290 end: Object.assign({}, n[n.length - 1][1].end)
1291 }, p = {
1292 type: "label",
1293 start: Object.assign({}, n[a][1].start),
1294 end: Object.assign({}, n[i][1].end)
1295 }, h = {
1296 type: "labelText",
1297 start: Object.assign({}, n[a + e + 2][1].end),
1298 end: Object.assign({}, n[i - 2][1].start)
1299 };
1300 return l = [
1301 ["enter", c, r],
1302 ["enter", p, r]
1303 ], l = Z(l, n.slice(a + 1, a + e + 3)), l = Z(l, [["enter", h, r]]), l = Z(
1304 l,
1305 Bn(
1306 r.parser.constructs.insideSpan.null,
1307 n.slice(a + e + 4, i - 3),
1308 r
1309 )
1310 ), l = Z(l, [
1311 ["exit", h, r],
1312 n[i - 2],
1313 n[i - 1],
1314 ["exit", p, r]
1315 ]), l = Z(l, n.slice(i + 1)), l = Z(l, [["exit", c, r]]), en(n, a, n.length, l), n;
1316}
1317function De(n, r, t) {
1318 const e = this;
1319 let u = e.events.length, a, i;
1320 for (; u--; )
1321 if ((e.events[u][1].type === "labelImage" || e.events[u][1].type === "labelLink") && !e.events[u][1]._balanced) {
1322 a = e.events[u][1];
1323 break;
1324 }
1325 return l;
1326 function l(h) {
1327 return a ? a._inactive ? p(h) : (i = e.parser.defined.includes(
1328 fn(
1329 e.sliceSerialize({
1330 start: a.end,
1331 end: e.now()
1332 })
1333 )
1334 ), n.enter("labelEnd"), n.enter("labelMarker"), n.consume(h), n.exit("labelMarker"), n.exit("labelEnd"), c) : t(h);
1335 }
1336 function c(h) {
1337 return h === 40 ? n.attempt(
1338 Ie,
1339 r,
1340 i ? r : p
1341 )(h) : h === 91 ? n.attempt(
1342 Te,
1343 r,
1344 i ? n.attempt(Be, r, p) : p
1345 )(h) : i ? r(h) : p(h);
1346 }
1347 function p(h) {
1348 return a._balanced = !0, t(h);
1349 }
1350}
1351function Pe(n, r, t) {
1352 return e;
1353 function e(c) {
1354 return n.enter("resource"), n.enter("resourceMarker"), n.consume(c), n.exit("resourceMarker"), dn(n, u);
1355 }
1356 function u(c) {
1357 return c === 41 ? l(c) : at(
1358 n,
1359 a,
1360 t,
1361 "resourceDestination",
1362 "resourceDestinationLiteral",
1363 "resourceDestinationLiteralMarker",
1364 "resourceDestinationRaw",
1365 "resourceDestinationString",
1366 32
1367 )(c);
1368 }
1369 function a(c) {
1370 return Y(c) ? dn(n, i)(c) : l(c);
1371 }
1372 function i(c) {
1373 return c === 34 || c === 39 || c === 40 ? ot(
1374 n,
1375 dn(n, l),
1376 t,
1377 "resourceTitle",
1378 "resourceTitleMarker",
1379 "resourceTitleString"
1380 )(c) : l(c);
1381 }
1382 function l(c) {
1383 return c === 41 ? (n.enter("resourceMarker"), n.consume(c), n.exit("resourceMarker"), n.exit("resource"), r) : t(c);
1384 }
1385}
1386function _e(n, r, t) {
1387 const e = this;
1388 return u;
1389 function u(i) {
1390 return lt.call(
1391 e,
1392 n,
1393 a,
1394 t,
1395 "reference",
1396 "referenceMarker",
1397 "referenceString"
1398 )(i);
1399 }
1400 function a(i) {
1401 return e.parser.defined.includes(
1402 fn(
1403 e.sliceSerialize(e.events[e.events.length - 1][1]).slice(1, -1)
1404 )
1405 ) ? r(i) : t(i);
1406 }
1407}
1408function Me(n, r, t) {
1409 return e;
1410 function e(a) {
1411 return n.enter("reference"), n.enter("referenceMarker"), n.consume(a), n.exit("referenceMarker"), u;
1412 }
1413 function u(a) {
1414 return a === 93 ? (n.enter("referenceMarker"), n.consume(a), n.exit("referenceMarker"), n.exit("reference"), r) : t(a);
1415 }
1416}
1417const Re = {
1418 name: "labelStartImage",
1419 tokenize: je,
1420 resolveAll: On.resolveAll
1421};
1422function je(n, r, t) {
1423 const e = this;
1424 return u;
1425 function u(l) {
1426 return n.enter("labelImage"), n.enter("labelImageMarker"), n.consume(l), n.exit("labelImageMarker"), a;
1427 }
1428 function a(l) {
1429 return l === 91 ? (n.enter("labelMarker"), n.consume(l), n.exit("labelMarker"), n.exit("labelImage"), i) : t(l);
1430 }
1431 function i(l) {
1432 return l === 94 && "_hiddenFootnoteSupport" in e.parser.constructs ? t(l) : r(l);
1433 }
1434}
1435const qe = {
1436 name: "labelStartLink",
1437 tokenize: He,
1438 resolveAll: On.resolveAll
1439};
1440function He(n, r, t) {
1441 const e = this;
1442 return u;
1443 function u(i) {
1444 return n.enter("labelLink"), n.enter("labelMarker"), n.consume(i), n.exit("labelMarker"), n.exit("labelLink"), a;
1445 }
1446 function a(i) {
1447 return i === 94 && "_hiddenFootnoteSupport" in e.parser.constructs ? t(i) : r(i);
1448 }
1449}
1450const Cn = {
1451 name: "lineEnding",
1452 tokenize: Ve
1453};
1454function Ve(n, r) {
1455 return t;
1456 function t(e) {
1457 return n.enter("lineEnding"), n.consume(e), n.exit("lineEnding"), T(n, r, "linePrefix");
1458 }
1459}
1460const bn = {
1461 name: "thematicBreak",
1462 tokenize: Ne
1463};
1464function Ne(n, r, t) {
1465 let e = 0, u;
1466 return a;
1467 function a(c) {
1468 return n.enter("thematicBreak"), u = c, i(c);
1469 }
1470 function i(c) {
1471 return c === u ? (n.enter("thematicBreakSequence"), l(c)) : q(c) ? T(n, i, "whitespace")(c) : e < 3 || c !== null && !C(c) ? t(c) : (n.exit("thematicBreak"), r(c));
1472 }
1473 function l(c) {
1474 return c === u ? (n.consume(c), e++, l) : (n.exit("thematicBreakSequence"), i(c));
1475 }
1476}
1477const $ = {
1478 name: "list",
1479 tokenize: We,
1480 continuation: {
1481 tokenize: $e
1482 },
1483 exit: Ye
1484}, Qe = {
1485 tokenize: Ge,
1486 partial: !0
1487}, Ue = {
1488 tokenize: Ze,
1489 partial: !0
1490};
1491function We(n, r, t) {
1492 const e = this, u = e.events[e.events.length - 1];
1493 let a = u && u[1].type === "linePrefix" ? u[2].sliceSerialize(u[1], !0).length : 0, i = 0;
1494 return l;
1495 function l(f) {
1496 const k = e.containerState.type || (f === 42 || f === 43 || f === 45 ? "listUnordered" : "listOrdered");
1497 if (k === "listUnordered" ? !e.containerState.marker || f === e.containerState.marker : An(f)) {
1498 if (e.containerState.type || (e.containerState.type = k, n.enter(k, {
1499 _container: !0
1500 })), k === "listUnordered")
1501 return n.enter("listItemPrefix"), f === 42 || f === 45 ? n.check(bn, t, p)(f) : p(f);
1502 if (!e.interrupt || f === 49)
1503 return n.enter("listItemPrefix"), n.enter("listItemValue"), c(f);
1504 }
1505 return t(f);
1506 }
1507 function c(f) {
1508 return An(f) && ++i < 10 ? (n.consume(f), c) : (!e.interrupt || i < 2) && (e.containerState.marker ? f === e.containerState.marker : f === 41 || f === 46) ? (n.exit("listItemValue"), p(f)) : t(f);
1509 }
1510 function p(f) {
1511 return n.enter("listItemMarker"), n.consume(f), n.exit("listItemMarker"), e.containerState.marker = e.containerState.marker || f, n.check(
1512 Sn,
1513 // Can’t be empty when interrupting.
1514 e.interrupt ? t : h,
1515 n.attempt(
1516 Qe,
1517 g,
1518 x
1519 )
1520 );
1521 }
1522 function h(f) {
1523 return e.containerState.initialBlankLine = !0, a++, g(f);
1524 }
1525 function x(f) {
1526 return q(f) ? (n.enter("listItemPrefixWhitespace"), n.consume(f), n.exit("listItemPrefixWhitespace"), g) : t(f);
1527 }
1528 function g(f) {
1529 return e.containerState.size = a + e.sliceSerialize(n.exit("listItemPrefix"), !0).length, r(f);
1530 }
1531}
1532function $e(n, r, t) {
1533 const e = this;
1534 return e.containerState._closeFlow = void 0, n.check(Sn, u, a);
1535 function u(l) {
1536 return e.containerState.furtherBlankLines = e.containerState.furtherBlankLines || e.containerState.initialBlankLine, T(
1537 n,
1538 r,
1539 "listItemIndent",
1540 e.containerState.size + 1
1541 )(l);
1542 }
1543 function a(l) {
1544 return e.containerState.furtherBlankLines || !q(l) ? (e.containerState.furtherBlankLines = void 0, e.containerState.initialBlankLine = void 0, i(l)) : (e.containerState.furtherBlankLines = void 0, e.containerState.initialBlankLine = void 0, n.attempt(Ue, r, i)(l));
1545 }
1546 function i(l) {
1547 return e.containerState._closeFlow = !0, e.interrupt = void 0, T(
1548 n,
1549 n.attempt($, r, t),
1550 "linePrefix",
1551 e.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4
1552 )(l);
1553 }
1554}
1555function Ze(n, r, t) {
1556 const e = this;
1557 return T(
1558 n,
1559 u,
1560 "listItemIndent",
1561 e.containerState.size + 1
1562 );
1563 function u(a) {
1564 const i = e.events[e.events.length - 1];
1565 return i && i[1].type === "listItemIndent" && i[2].sliceSerialize(i[1], !0).length === e.containerState.size ? r(a) : t(a);
1566 }
1567}
1568function Ye(n) {
1569 n.exit(this.containerState.type);
1570}
1571function Ge(n, r, t) {
1572 const e = this;
1573 return T(
1574 n,
1575 u,
1576 "listItemPrefixWhitespace",
1577 e.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 + 1
1578 );
1579 function u(a) {
1580 const i = e.events[e.events.length - 1];
1581 return !q(a) && i && i[1].type === "listItemPrefixWhitespace" ? r(a) : t(a);
1582 }
1583}
1584const Yn = {
1585 name: "setextUnderline",
1586 tokenize: Ke,
1587 resolveTo: Je
1588};
1589function Je(n, r) {
1590 let t = n.length, e, u, a;
1591 for (; t--; )
1592 if (n[t][0] === "enter") {
1593 if (n[t][1].type === "content") {
1594 e = t;
1595 break;
1596 }
1597 n[t][1].type === "paragraph" && (u = t);
1598 } else
1599 n[t][1].type === "content" && n.splice(t, 1), !a && n[t][1].type === "definition" && (a = t);
1600 const i = {
1601 type: "setextHeading",
1602 start: Object.assign({}, n[u][1].start),
1603 end: Object.assign({}, n[n.length - 1][1].end)
1604 };
1605 return n[u][1].type = "setextHeadingText", a ? (n.splice(u, 0, ["enter", i, r]), n.splice(a + 1, 0, ["exit", n[e][1], r]), n[e][1].end = Object.assign({}, n[a][1].end)) : n[e][1] = i, n.push(["exit", i, r]), n;
1606}
1607function Ke(n, r, t) {
1608 const e = this;
1609 let u = e.events.length, a, i;
1610 for (; u--; )
1611 if (e.events[u][1].type !== "lineEnding" && e.events[u][1].type !== "linePrefix" && e.events[u][1].type !== "content") {
1612 i = e.events[u][1].type === "paragraph";
1613 break;
1614 }
1615 return l;
1616 function l(h) {
1617 return !e.parser.lazy[e.now().line] && (e.interrupt || i) ? (n.enter("setextHeadingLine"), n.enter("setextHeadingLineSequence"), a = h, c(h)) : t(h);
1618 }
1619 function c(h) {
1620 return h === a ? (n.consume(h), c) : (n.exit("setextHeadingLineSequence"), T(n, p, "lineSuffix")(h));
1621 }
1622 function p(h) {
1623 return h === null || C(h) ? (n.exit("setextHeadingLine"), r(h)) : t(h);
1624 }
1625}
1626const Xe = {
1627 tokenize: ve
1628};
1629function ve(n) {
1630 const r = this, t = n.attempt(
1631 // Try to parse a blank line.
1632 Sn,
1633 e,
1634 // Try to parse initial flow (essentially, only code).
1635 n.attempt(
1636 this.parser.constructs.flowInitial,
1637 u,
1638 T(
1639 n,
1640 n.attempt(
1641 this.parser.constructs.flow,
1642 u,
1643 n.attempt(ae, u)
1644 ),
1645 "linePrefix"
1646 )
1647 )
1648 );
1649 return t;
1650 function e(a) {
1651 if (a === null) {
1652 n.consume(a);
1653 return;
1654 }
1655 return n.enter("lineEndingBlank"), n.consume(a), n.exit("lineEndingBlank"), r.currentConstruct = void 0, t;
1656 }
1657 function u(a) {
1658 if (a === null) {
1659 n.consume(a);
1660 return;
1661 }
1662 return n.enter("lineEnding"), n.consume(a), n.exit("lineEnding"), r.currentConstruct = void 0, t;
1663 }
1664}
1665const nr = {
1666 resolveAll: ct()
1667}, tr = st("string"), er = st("text");
1668function st(n) {
1669 return {
1670 tokenize: r,
1671 resolveAll: ct(
1672 n === "text" ? rr : void 0
1673 )
1674 };
1675 function r(t) {
1676 const e = this, u = this.parser.constructs[n], a = t.attempt(u, i, l);
1677 return i;
1678 function i(h) {
1679 return p(h) ? a(h) : l(h);
1680 }
1681 function l(h) {
1682 if (h === null) {
1683 t.consume(h);
1684 return;
1685 }
1686 return t.enter("data"), t.consume(h), c;
1687 }
1688 function c(h) {
1689 return p(h) ? (t.exit("data"), a(h)) : (t.consume(h), c);
1690 }
1691 function p(h) {
1692 if (h === null)
1693 return !0;
1694 const x = u[h];
1695 let g = -1;
1696 if (x)
1697 for (; ++g < x.length; ) {
1698 const f = x[g];
1699 if (!f.previous || f.previous.call(e, e.previous))
1700 return !0;
1701 }
1702 return !1;
1703 }
1704 }
1705}
1706function ct(n) {
1707 return r;
1708 function r(t, e) {
1709 let u = -1, a;
1710 for (; ++u <= t.length; )
1711 a === void 0 ? t[u] && t[u][1].type === "data" && (a = u, u++) : (!t[u] || t[u][1].type !== "data") && (u !== a + 2 && (t[a][1].end = t[u - 1][1].end, t.splice(a + 2, u - a - 2), u = a + 2), a = void 0);
1712 return n ? n(t, e) : t;
1713 }
1714}
1715function rr(n, r) {
1716 let t = 0;
1717 for (; ++t <= n.length; )
1718 if ((t === n.length || n[t][1].type === "lineEnding") && n[t - 1][1].type === "data") {
1719 const e = n[t - 1][1], u = r.sliceStream(e);
1720 let a = u.length, i = -1, l = 0, c;
1721 for (; a--; ) {
1722 const p = u[a];
1723 if (typeof p == "string") {
1724 for (i = p.length; p.charCodeAt(i - 1) === 32; )
1725 l++, i--;
1726 if (i)
1727 break;
1728 i = -1;
1729 } else if (p === -2)
1730 c = !0, l++;
1731 else if (p !== -1) {
1732 a++;
1733 break;
1734 }
1735 }
1736 if (l) {
1737 const p = {
1738 type: t === n.length || c || l < 2 ? "lineSuffix" : "hardBreakTrailing",
1739 start: {
1740 line: e.end.line,
1741 column: e.end.column - l,
1742 offset: e.end.offset - l,
1743 _index: e.start._index + a,
1744 _bufferIndex: a ? i : e.start._bufferIndex + i
1745 },
1746 end: Object.assign({}, e.end)
1747 };
1748 e.end = Object.assign({}, p.start), e.start.offset === e.end.offset ? Object.assign(e, p) : (n.splice(
1749 t,
1750 0,
1751 ["enter", p, r],
1752 ["exit", p, r]
1753 ), t += 2);
1754 }
1755 t++;
1756 }
1757 return n;
1758}
1759function ir(n, r, t) {
1760 let e = Object.assign(
1761 t ? Object.assign({}, t) : {
1762 line: 1,
1763 column: 1,
1764 offset: 0
1765 },
1766 {
1767 _index: 0,
1768 _bufferIndex: -1
1769 }
1770 );
1771 const u = {}, a = [];
1772 let i = [], l = [];
1773 const c = {
1774 consume: _,
1775 enter: F,
1776 exit: L,
1777 attempt: P(O),
1778 check: P(d),
1779 interrupt: P(d, {
1780 interrupt: !0
1781 })
1782 }, p = {
1783 previous: null,
1784 code: null,
1785 containerState: {},
1786 events: [],
1787 parser: n,
1788 sliceStream: f,
1789 sliceSerialize: g,
1790 now: k,
1791 defineSkip: B,
1792 write: x
1793 };
1794 let h = r.tokenize.call(p, c);
1795 return r.resolveAll && a.push(r), p;
1796 function x(S) {
1797 return i = Z(i, S), D(), i[i.length - 1] !== null ? [] : (R(r, 0), p.events = Bn(a, p.events, p), p.events);
1798 }
1799 function g(S, w) {
1800 return ar(f(S), w);
1801 }
1802 function f(S) {
1803 return ur(i, S);
1804 }
1805 function k() {
1806 return Object.assign({}, e);
1807 }
1808 function B(S) {
1809 u[S.line] = S.column, N();
1810 }
1811 function D() {
1812 let S;
1813 for (; e._index < i.length; ) {
1814 const w = i[e._index];
1815 if (typeof w == "string")
1816 for (S = e._index, e._bufferIndex < 0 && (e._bufferIndex = 0); e._index === S && e._bufferIndex < w.length; )
1817 y(w.charCodeAt(e._bufferIndex));
1818 else
1819 y(w);
1820 }
1821 }
1822 function y(S) {
1823 h = h(S);
1824 }
1825 function _(S) {
1826 C(S) ? (e.line++, e.column = 1, e.offset += S === -3 ? 2 : 1, N()) : S !== -1 && (e.column++, e.offset++), e._bufferIndex < 0 ? e._index++ : (e._bufferIndex++, e._bufferIndex === i[e._index].length && (e._bufferIndex = -1, e._index++)), p.previous = S;
1827 }
1828 function F(S, w) {
1829 const A = w || {};
1830 return A.type = S, A.start = k(), p.events.push(["enter", A, p]), l.push(A), A;
1831 }
1832 function L(S) {
1833 const w = l.pop();
1834 return w.end = k(), p.events.push(["exit", w, p]), w;
1835 }
1836 function O(S, w) {
1837 R(S, w.from);
1838 }
1839 function d(S, w) {
1840 w.restore();
1841 }
1842 function P(S, w) {
1843 return A;
1844 function A(U, G, nn) {
1845 let J, Q, W, H;
1846 return Array.isArray(U) ? (
1847 /* c8 ignore next 1 */
1848 o(U)
1849 ) : "tokenize" in U ? o([U]) : s(U);
1850 function s(V) {
1851 return K;
1852 function K(an) {
1853 const pn = an !== null && V[an], mn = an !== null && V.null, Fn = [
1854 // To do: add more extension tests.
1855 /* c8 ignore next 2 */
1856 ...Array.isArray(pn) ? pn : pn ? [pn] : [],
1857 ...Array.isArray(mn) ? mn : mn ? [mn] : []
1858 ];
1859 return o(Fn)(an);
1860 }
1861 }
1862 function o(V) {
1863 return J = V, Q = 0, V.length === 0 ? nn : cn(V[Q]);
1864 }
1865 function cn(V) {
1866 return K;
1867 function K(an) {
1868 return H = j(), W = V, V.partial || (p.currentConstruct = V), V.name && p.parser.constructs.disable.null.includes(V.name) ? hn() : V.tokenize.call(
1869 // If we do have fields, create an object w/ `context` as its
1870 // prototype.
1871 // This allows a “live binding”, which is needed for `interrupt`.
1872 w ? Object.assign(Object.create(p), w) : p,
1873 c,
1874 xn,
1875 hn
1876 )(an);
1877 }
1878 }
1879 function xn(V) {
1880 return S(W, H), G;
1881 }
1882 function hn(V) {
1883 return H.restore(), ++Q < J.length ? cn(J[Q]) : nn;
1884 }
1885 }
1886 }
1887 function R(S, w) {
1888 S.resolveAll && !a.includes(S) && a.push(S), S.resolve && en(
1889 p.events,
1890 w,
1891 p.events.length - w,
1892 S.resolve(p.events.slice(w), p)
1893 ), S.resolveTo && (p.events = S.resolveTo(p.events, p));
1894 }
1895 function j() {
1896 const S = k(), w = p.previous, A = p.currentConstruct, U = p.events.length, G = Array.from(l);
1897 return {
1898 restore: nn,
1899 from: U
1900 };
1901 function nn() {
1902 e = S, p.previous = w, p.currentConstruct = A, p.events.length = U, l = G, N();
1903 }
1904 }
1905 function N() {
1906 e.line in u && e.column < 2 && (e.column = u[e.line], e.offset += u[e.line] - 1);
1907 }
1908}
1909function ur(n, r) {
1910 const t = r.start._index, e = r.start._bufferIndex, u = r.end._index, a = r.end._bufferIndex;
1911 let i;
1912 return t === u ? i = [n[t].slice(e, a)] : (i = n.slice(t, u), e > -1 && (i[0] = i[0].slice(e)), a > 0 && i.push(n[u].slice(0, a))), i;
1913}
1914function ar(n, r) {
1915 let t = -1;
1916 const e = [];
1917 let u;
1918 for (; ++t < n.length; ) {
1919 const a = n[t];
1920 let i;
1921 if (typeof a == "string")
1922 i = a;
1923 else
1924 switch (a) {
1925 case -5: {
1926 i = "\r";
1927 break;
1928 }
1929 case -4: {
1930 i = `
1931`;
1932 break;
1933 }
1934 case -3: {
1935 i = `\r
1936`;
1937 break;
1938 }
1939 case -2: {
1940 i = r ? " " : " ";
1941 break;
1942 }
1943 case -1: {
1944 if (!r && u)
1945 continue;
1946 i = " ";
1947 break;
1948 }
1949 default:
1950 i = String.fromCharCode(a);
1951 }
1952 u = a === -2, e.push(i);
1953 }
1954 return e.join("");
1955}
1956const lr = {
1957 [42]: $,
1958 [43]: $,
1959 [45]: $,
1960 [48]: $,
1961 [49]: $,
1962 [50]: $,
1963 [51]: $,
1964 [52]: $,
1965 [53]: $,
1966 [54]: $,
1967 [55]: $,
1968 [56]: $,
1969 [57]: $,
1970 [62]: et
1971}, or = {
1972 [91]: he
1973}, sr = {
1974 [-2]: En,
1975 [-1]: En,
1976 [32]: En
1977}, cr = {
1978 [35]: ke,
1979 [42]: bn,
1980 [45]: [Yn, bn],
1981 [60]: Se,
1982 [61]: Yn,
1983 [95]: bn,
1984 [96]: $n,
1985 [126]: $n
1986}, hr = {
1987 [38]: it,
1988 [92]: rt
1989}, pr = {
1990 [-5]: Cn,
1991 [-4]: Cn,
1992 [-3]: Cn,
1993 [33]: Re,
1994 [38]: it,
1995 [42]: In,
1996 [60]: [Qt, Ae],
1997 [91]: qe,
1998 [92]: [xe, rt],
1999 [93]: On,
2000 [95]: In,
2001 [96]: te
2002}, mr = {
2003 null: [In, nr]
2004}, fr = {
2005 null: [42, 95]
2006}, xr = {
2007 null: []
2008}, gr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2009 __proto__: null,
2010 attentionMarkers: fr,
2011 contentInitial: or,
2012 disable: xr,
2013 document: lr,
2014 flow: cr,
2015 flowInitial: sr,
2016 insideSpan: mr,
2017 string: hr,
2018 text: pr
2019}, Symbol.toStringTag, { value: "Module" }));
2020function kr(n = {}) {
2021 const r = It(
2022 // @ts-expect-error Same as above.
2023 [gr].concat(n.extensions || [])
2024 ), t = {
2025 defined: [],
2026 lazy: {},
2027 constructs: r,
2028 content: e(Mt),
2029 document: e(jt),
2030 flow: e(Xe),
2031 string: e(tr),
2032 text: e(er)
2033 };
2034 return t;
2035 function e(u) {
2036 return a;
2037 function a(i) {
2038 return ir(t, u, i);
2039 }
2040 }
2041}
2042const Gn = /[\0\t\n\r]/g;
2043function dr() {
2044 let n = 1, r = "", t = !0, e;
2045 return u;
2046 function u(a, i, l) {
2047 const c = [];
2048 let p, h, x, g, f;
2049 for (a = r + a.toString(i), x = 0, r = "", t && (a.charCodeAt(0) === 65279 && x++, t = void 0); x < a.length; ) {
2050 if (Gn.lastIndex = x, p = Gn.exec(a), g = p && p.index !== void 0 ? p.index : a.length, f = a.charCodeAt(g), !p) {
2051 r = a.slice(x);
2052 break;
2053 }
2054 if (f === 10 && x === g && e)
2055 c.push(-3), e = void 0;
2056 else
2057 switch (e && (c.push(-5), e = void 0), x < g && (c.push(a.slice(x, g)), n += g - x), f) {
2058 case 0: {
2059 c.push(65533), n++;
2060 break;
2061 }
2062 case 9: {
2063 for (h = Math.ceil(n / 4) * 4, c.push(-2); n++ < h; )
2064 c.push(-1);
2065 break;
2066 }
2067 case 10: {
2068 c.push(-4), n = 1;
2069 break;
2070 }
2071 default:
2072 e = !0, n = 1;
2073 }
2074 x = g + 1;
2075 }
2076 return l && (e && c.push(-5), r && c.push(r), c.push(null)), c;
2077 }
2078}
2079function br(n) {
2080 for (; !ut(n); )
2081 ;
2082 return n;
2083}
2084function ht(n, r) {
2085 const t = Number.parseInt(n, r);
2086 return (
2087 // C0 except for HT, LF, FF, CR, space
2088 t < 9 || t === 11 || t > 13 && t < 32 || // Control character (DEL) of the basic block and C1 controls.
2089 t > 126 && t < 160 || // Lone high surrogates and low surrogates.
2090 t > 55295 && t < 57344 || // Noncharacters.
2091 t > 64975 && t < 65008 || (t & 65535) === 65535 || (t & 65535) === 65534 || // Out of range
2092 t > 1114111 ? "�" : String.fromCharCode(t)
2093 );
2094}
2095const yr = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
2096function Sr(n) {
2097 return n.replace(yr, Fr);
2098}
2099function Fr(n, r, t) {
2100 if (r)
2101 return r;
2102 if (t.charCodeAt(0) === 35) {
2103 const u = t.charCodeAt(1), a = u === 120 || u === 88;
2104 return ht(t.slice(a ? 2 : 1), a ? 16 : 10);
2105 }
2106 return Ln(t) || n;
2107}
2108function yn(n) {
2109 return !n || typeof n != "object" ? "" : "position" in n || "type" in n ? Jn(n.position) : "start" in n || "end" in n ? Jn(n) : "line" in n || "column" in n ? Tn(n) : "";
2110}
2111function Tn(n) {
2112 return Kn(n && n.line) + ":" + Kn(n && n.column);
2113}
2114function Jn(n) {
2115 return Tn(n && n.start) + "-" + Tn(n && n.end);
2116}
2117function Kn(n) {
2118 return n && typeof n == "number" ? n : 1;
2119}
2120const pt = {}.hasOwnProperty, mt = (
2121 /**
2122 * @type {(
2123 * ((value: Value, encoding: Encoding, options?: Options | null | undefined) => Root) &
2124 * ((value: Value, options?: Options | null | undefined) => Root)
2125 * )}
2126 */
2127 /**
2128 * @param {Value} value
2129 * @param {Encoding | Options | null | undefined} [encoding]
2130 * @param {Options | null | undefined} [options]
2131 * @returns {Root}
2132 */
2133 function(n, r, t) {
2134 return typeof r != "string" && (t = r, r = void 0), wr(t)(
2135 br(
2136 // @ts-expect-error: micromark types need to accept `null`.
2137 kr(t).document().write(dr()(n, r, !0))
2138 )
2139 );
2140 }
2141);
2142function wr(n) {
2143 const r = {
2144 transforms: [],
2145 canContainEols: ["emphasis", "fragment", "heading", "paragraph", "strong"],
2146 enter: {
2147 autolink: l(Rn),
2148 autolinkProtocol: S,
2149 autolinkEmail: S,
2150 atxHeading: l(Pn),
2151 blockQuote: l(Fn),
2152 characterEscape: S,
2153 characterReference: S,
2154 codeFenced: l(Dn),
2155 codeFencedFenceInfo: c,
2156 codeFencedFenceMeta: c,
2157 codeIndented: l(Dn, c),
2158 codeText: l(xt, c),
2159 codeTextData: S,
2160 data: S,
2161 codeFlowValue: S,
2162 definition: l(gt),
2163 definitionDestinationString: c,
2164 definitionLabelString: c,
2165 definitionTitleString: c,
2166 emphasis: l(kt),
2167 hardBreakEscape: l(_n),
2168 hardBreakTrailing: l(_n),
2169 htmlFlow: l(Mn, c),
2170 htmlFlowData: S,
2171 htmlText: l(Mn, c),
2172 htmlTextData: S,
2173 image: l(dt),
2174 label: c,
2175 link: l(Rn),
2176 listItem: l(bt),
2177 listItemValue: k,
2178 listOrdered: l(jn, f),
2179 listUnordered: l(jn),
2180 paragraph: l(yt),
2181 reference: hn,
2182 referenceString: c,
2183 resourceDestinationString: c,
2184 resourceTitleString: c,
2185 setextHeading: l(Pn),
2186 strong: l(St),
2187 thematicBreak: l(wt)
2188 },
2189 exit: {
2190 atxHeading: h(),
2191 atxHeadingSequence: P,
2192 autolink: h(),
2193 autolinkEmail: mn,
2194 autolinkProtocol: pn,
2195 blockQuote: h(),
2196 characterEscapeValue: w,
2197 characterReferenceMarkerHexadecimal: K,
2198 characterReferenceMarkerNumeric: K,
2199 characterReferenceValue: an,
2200 codeFenced: h(_),
2201 codeFencedFence: y,
2202 codeFencedFenceInfo: B,
2203 codeFencedFenceMeta: D,
2204 codeFlowValue: w,
2205 codeIndented: h(F),
2206 codeText: h(J),
2207 codeTextData: w,
2208 data: w,
2209 definition: h(),
2210 definitionDestinationString: d,
2211 definitionLabelString: L,
2212 definitionTitleString: O,
2213 emphasis: h(),
2214 hardBreakEscape: h(U),
2215 hardBreakTrailing: h(U),
2216 htmlFlow: h(G),
2217 htmlFlowData: w,
2218 htmlText: h(nn),
2219 htmlTextData: w,
2220 image: h(W),
2221 label: s,
2222 labelText: H,
2223 lineEnding: A,
2224 link: h(Q),
2225 listItem: h(),
2226 listOrdered: h(),
2227 listUnordered: h(),
2228 paragraph: h(),
2229 referenceString: V,
2230 resourceDestinationString: o,
2231 resourceTitleString: cn,
2232 resource: xn,
2233 setextHeading: h(N),
2234 setextHeadingLineSequence: j,
2235 setextHeadingText: R,
2236 strong: h(),
2237 thematicBreak: h()
2238 }
2239 };
2240 ft(r, (n || {}).mdastExtensions || []);
2241 const t = {};
2242 return e;
2243 function e(m) {
2244 let b = {
2245 type: "root",
2246 children: []
2247 };
2248 const E = {
2249 stack: [b],
2250 tokenStack: [],
2251 config: r,
2252 enter: p,
2253 exit: x,
2254 buffer: c,
2255 resume: g,
2256 setData: a,
2257 getData: i
2258 }, z = [];
2259 let I = -1;
2260 for (; ++I < m.length; )
2261 if (m[I][1].type === "listOrdered" || m[I][1].type === "listUnordered")
2262 if (m[I][0] === "enter")
2263 z.push(I);
2264 else {
2265 const X = z.pop();
2266 I = u(m, X, I);
2267 }
2268 for (I = -1; ++I < m.length; ) {
2269 const X = r[m[I][0]];
2270 pt.call(X, m[I][1].type) && X[m[I][1].type].call(
2271 Object.assign(
2272 {
2273 sliceSerialize: m[I][2].sliceSerialize
2274 },
2275 E
2276 ),
2277 m[I][1]
2278 );
2279 }
2280 if (E.tokenStack.length > 0) {
2281 const X = E.tokenStack[E.tokenStack.length - 1];
2282 (X[1] || Xn).call(E, void 0, X[0]);
2283 }
2284 for (b.position = {
2285 start: on(
2286 m.length > 0 ? m[0][1].start : {
2287 line: 1,
2288 column: 1,
2289 offset: 0
2290 }
2291 ),
2292 end: on(
2293 m.length > 0 ? m[m.length - 2][1].end : {
2294 line: 1,
2295 column: 1,
2296 offset: 0
2297 }
2298 )
2299 }, I = -1; ++I < r.transforms.length; )
2300 b = r.transforms[I](b) || b;
2301 return b;
2302 }
2303 function u(m, b, E) {
2304 let z = b - 1, I = -1, X = !1, ln, rn, gn, kn;
2305 for (; ++z <= E; ) {
2306 const M = m[z];
2307 if (M[1].type === "listUnordered" || M[1].type === "listOrdered" || M[1].type === "blockQuote" ? (M[0] === "enter" ? I++ : I--, kn = void 0) : M[1].type === "lineEndingBlank" ? M[0] === "enter" && (ln && !kn && !I && !gn && (gn = z), kn = void 0) : M[1].type === "linePrefix" || M[1].type === "listItemValue" || M[1].type === "listItemMarker" || M[1].type === "listItemPrefix" || M[1].type === "listItemPrefixWhitespace" || (kn = void 0), !I && M[0] === "enter" && M[1].type === "listItemPrefix" || I === -1 && M[0] === "exit" && (M[1].type === "listUnordered" || M[1].type === "listOrdered")) {
2308 if (ln) {
2309 let wn = z;
2310 for (rn = void 0; wn--; ) {
2311 const un = m[wn];
2312 if (un[1].type === "lineEnding" || un[1].type === "lineEndingBlank") {
2313 if (un[0] === "exit")
2314 continue;
2315 rn && (m[rn][1].type = "lineEndingBlank", X = !0), un[1].type = "lineEnding", rn = wn;
2316 } else if (!(un[1].type === "linePrefix" || un[1].type === "blockQuotePrefix" || un[1].type === "blockQuotePrefixWhitespace" || un[1].type === "blockQuoteMarker" || un[1].type === "listItemIndent"))
2317 break;
2318 }
2319 gn && (!rn || gn < rn) && (ln._spread = !0), ln.end = Object.assign(
2320 {},
2321 rn ? m[rn][1].start : M[1].end
2322 ), m.splice(rn || z, 0, ["exit", ln, M[2]]), z++, E++;
2323 }
2324 M[1].type === "listItemPrefix" && (ln = {
2325 type: "listItem",
2326 // @ts-expect-error Patched
2327 _spread: !1,
2328 start: Object.assign({}, M[1].start)
2329 }, m.splice(z, 0, ["enter", ln, M[2]]), z++, E++, gn = void 0, kn = !0);
2330 }
2331 }
2332 return m[b][1]._spread = X, E;
2333 }
2334 function a(m, b) {
2335 t[m] = b;
2336 }
2337 function i(m) {
2338 return t[m];
2339 }
2340 function l(m, b) {
2341 return E;
2342 function E(z) {
2343 p.call(this, m(z), z), b && b.call(this, z);
2344 }
2345 }
2346 function c() {
2347 this.stack.push({
2348 type: "fragment",
2349 children: []
2350 });
2351 }
2352 function p(m, b, E) {
2353 return this.stack[this.stack.length - 1].children.push(m), this.stack.push(m), this.tokenStack.push([b, E]), m.position = {
2354 start: on(b.start)
2355 }, m;
2356 }
2357 function h(m) {
2358 return b;
2359 function b(E) {
2360 m && m.call(this, E), x.call(this, E);
2361 }
2362 }
2363 function x(m, b) {
2364 const E = this.stack.pop(), z = this.tokenStack.pop();
2365 if (z)
2366 z[0].type !== m.type && (b ? b.call(this, m, z[0]) : (z[1] || Xn).call(this, m, z[0]));
2367 else
2368 throw new Error(
2369 "Cannot close `" + m.type + "` (" + yn({
2370 start: m.start,
2371 end: m.end
2372 }) + "): it’s not open"
2373 );
2374 return E.position.end = on(m.end), E;
2375 }
2376 function g() {
2377 return zt(this.stack.pop());
2378 }
2379 function f() {
2380 a("expectingFirstListItemValue", !0);
2381 }
2382 function k(m) {
2383 if (i("expectingFirstListItemValue")) {
2384 const b = this.stack[this.stack.length - 2];
2385 b.start = Number.parseInt(this.sliceSerialize(m), 10), a("expectingFirstListItemValue");
2386 }
2387 }
2388 function B() {
2389 const m = this.resume(), b = this.stack[this.stack.length - 1];
2390 b.lang = m;
2391 }
2392 function D() {
2393 const m = this.resume(), b = this.stack[this.stack.length - 1];
2394 b.meta = m;
2395 }
2396 function y() {
2397 i("flowCodeInside") || (this.buffer(), a("flowCodeInside", !0));
2398 }
2399 function _() {
2400 const m = this.resume(), b = this.stack[this.stack.length - 1];
2401 b.value = m.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, ""), a("flowCodeInside");
2402 }
2403 function F() {
2404 const m = this.resume(), b = this.stack[this.stack.length - 1];
2405 b.value = m.replace(/(\r?\n|\r)$/g, "");
2406 }
2407 function L(m) {
2408 const b = this.resume(), E = this.stack[this.stack.length - 1];
2409 E.label = b, E.identifier = fn(
2410 this.sliceSerialize(m)
2411 ).toLowerCase();
2412 }
2413 function O() {
2414 const m = this.resume(), b = this.stack[this.stack.length - 1];
2415 b.title = m;
2416 }
2417 function d() {
2418 const m = this.resume(), b = this.stack[this.stack.length - 1];
2419 b.url = m;
2420 }
2421 function P(m) {
2422 const b = this.stack[this.stack.length - 1];
2423 if (!b.depth) {
2424 const E = this.sliceSerialize(m).length;
2425 b.depth = E;
2426 }
2427 }
2428 function R() {
2429 a("setextHeadingSlurpLineEnding", !0);
2430 }
2431 function j(m) {
2432 const b = this.stack[this.stack.length - 1];
2433 b.depth = this.sliceSerialize(m).charCodeAt(0) === 61 ? 1 : 2;
2434 }
2435 function N() {
2436 a("setextHeadingSlurpLineEnding");
2437 }
2438 function S(m) {
2439 const b = this.stack[this.stack.length - 1];
2440 let E = b.children[b.children.length - 1];
2441 (!E || E.type !== "text") && (E = Ft(), E.position = {
2442 start: on(m.start)
2443 }, b.children.push(E)), this.stack.push(E);
2444 }
2445 function w(m) {
2446 const b = this.stack.pop();
2447 b.value += this.sliceSerialize(m), b.position.end = on(m.end);
2448 }
2449 function A(m) {
2450 const b = this.stack[this.stack.length - 1];
2451 if (i("atHardBreak")) {
2452 const E = b.children[b.children.length - 1];
2453 E.position.end = on(m.end), a("atHardBreak");
2454 return;
2455 }
2456 !i("setextHeadingSlurpLineEnding") && r.canContainEols.includes(b.type) && (S.call(this, m), w.call(this, m));
2457 }
2458 function U() {
2459 a("atHardBreak", !0);
2460 }
2461 function G() {
2462 const m = this.resume(), b = this.stack[this.stack.length - 1];
2463 b.value = m;
2464 }
2465 function nn() {
2466 const m = this.resume(), b = this.stack[this.stack.length - 1];
2467 b.value = m;
2468 }
2469 function J() {
2470 const m = this.resume(), b = this.stack[this.stack.length - 1];
2471 b.value = m;
2472 }
2473 function Q() {
2474 const m = this.stack[this.stack.length - 1];
2475 if (i("inReference")) {
2476 const b = i("referenceType") || "shortcut";
2477 m.type += "Reference", m.referenceType = b, delete m.url, delete m.title;
2478 } else
2479 delete m.identifier, delete m.label;
2480 a("referenceType");
2481 }
2482 function W() {
2483 const m = this.stack[this.stack.length - 1];
2484 if (i("inReference")) {
2485 const b = i("referenceType") || "shortcut";
2486 m.type += "Reference", m.referenceType = b, delete m.url, delete m.title;
2487 } else
2488 delete m.identifier, delete m.label;
2489 a("referenceType");
2490 }
2491 function H(m) {
2492 const b = this.sliceSerialize(m), E = this.stack[this.stack.length - 2];
2493 E.label = Sr(b), E.identifier = fn(b).toLowerCase();
2494 }
2495 function s() {
2496 const m = this.stack[this.stack.length - 1], b = this.resume(), E = this.stack[this.stack.length - 1];
2497 if (a("inReference", !0), E.type === "link") {
2498 const z = m.children;
2499 E.children = z;
2500 } else
2501 E.alt = b;
2502 }
2503 function o() {
2504 const m = this.resume(), b = this.stack[this.stack.length - 1];
2505 b.url = m;
2506 }
2507 function cn() {
2508 const m = this.resume(), b = this.stack[this.stack.length - 1];
2509 b.title = m;
2510 }
2511 function xn() {
2512 a("inReference");
2513 }
2514 function hn() {
2515 a("referenceType", "collapsed");
2516 }
2517 function V(m) {
2518 const b = this.resume(), E = this.stack[this.stack.length - 1];
2519 E.label = b, E.identifier = fn(
2520 this.sliceSerialize(m)
2521 ).toLowerCase(), a("referenceType", "full");
2522 }
2523 function K(m) {
2524 a("characterReferenceType", m.type);
2525 }
2526 function an(m) {
2527 const b = this.sliceSerialize(m), E = i("characterReferenceType");
2528 let z;
2529 E ? (z = ht(
2530 b,
2531 E === "characterReferenceMarkerNumeric" ? 10 : 16
2532 ), a("characterReferenceType")) : z = Ln(b);
2533 const I = this.stack.pop();
2534 I.value += z, I.position.end = on(m.end);
2535 }
2536 function pn(m) {
2537 w.call(this, m);
2538 const b = this.stack[this.stack.length - 1];
2539 b.url = this.sliceSerialize(m);
2540 }
2541 function mn(m) {
2542 w.call(this, m);
2543 const b = this.stack[this.stack.length - 1];
2544 b.url = "mailto:" + this.sliceSerialize(m);
2545 }
2546 function Fn() {
2547 return {
2548 type: "blockquote",
2549 children: []
2550 };
2551 }
2552 function Dn() {
2553 return {
2554 type: "code",
2555 lang: null,
2556 meta: null,
2557 value: ""
2558 };
2559 }
2560 function xt() {
2561 return {
2562 type: "inlineCode",
2563 value: ""
2564 };
2565 }
2566 function gt() {
2567 return {
2568 type: "definition",
2569 identifier: "",
2570 label: null,
2571 title: null,
2572 url: ""
2573 };
2574 }
2575 function kt() {
2576 return {
2577 type: "emphasis",
2578 children: []
2579 };
2580 }
2581 function Pn() {
2582 return {
2583 type: "heading",
2584 depth: void 0,
2585 children: []
2586 };
2587 }
2588 function _n() {
2589 return {
2590 type: "break"
2591 };
2592 }
2593 function Mn() {
2594 return {
2595 type: "html",
2596 value: ""
2597 };
2598 }
2599 function dt() {
2600 return {
2601 type: "image",
2602 title: null,
2603 url: "",
2604 alt: null
2605 };
2606 }
2607 function Rn() {
2608 return {
2609 type: "link",
2610 title: null,
2611 url: "",
2612 children: []
2613 };
2614 }
2615 function jn(m) {
2616 return {
2617 type: "list",
2618 ordered: m.type === "listOrdered",
2619 start: null,
2620 // @ts-expect-error Patched.
2621 spread: m._spread,
2622 children: []
2623 };
2624 }
2625 function bt(m) {
2626 return {
2627 type: "listItem",
2628 // @ts-expect-error Patched.
2629 spread: m._spread,
2630 checked: null,
2631 children: []
2632 };
2633 }
2634 function yt() {
2635 return {
2636 type: "paragraph",
2637 children: []
2638 };
2639 }
2640 function St() {
2641 return {
2642 type: "strong",
2643 children: []
2644 };
2645 }
2646 function Ft() {
2647 return {
2648 type: "text",
2649 value: ""
2650 };
2651 }
2652 function wt() {
2653 return {
2654 type: "thematicBreak"
2655 };
2656 }
2657}
2658function on(n) {
2659 return {
2660 line: n.line,
2661 column: n.column,
2662 offset: n.offset
2663 };
2664}
2665function ft(n, r) {
2666 let t = -1;
2667 for (; ++t < r.length; ) {
2668 const e = r[t];
2669 Array.isArray(e) ? ft(n, e) : Er(n, e);
2670 }
2671}
2672function Er(n, r) {
2673 let t;
2674 for (t in r)
2675 if (pt.call(r, t)) {
2676 if (t === "canContainEols") {
2677 const e = r[t];
2678 e && n[t].push(...e);
2679 } else if (t === "transforms") {
2680 const e = r[t];
2681 e && n[t].push(...e);
2682 } else if (t === "enter" || t === "exit") {
2683 const e = r[t];
2684 e && Object.assign(n[t], e);
2685 }
2686 }
2687}
2688function Xn(n, r) {
2689 throw n ? new Error(
2690 "Cannot close `" + n.type + "` (" + yn({
2691 start: n.start,
2692 end: n.end
2693 }) + "): a different token (`" + r.type + "`, " + yn({
2694 start: r.start,
2695 end: r.end
2696 }) + ") is open"
2697 ) : new Error(
2698 "Cannot close document, a token (`" + r.type + "`, " + yn({
2699 start: r.start,
2700 end: r.end
2701 }) + ") is still open"
2702 );
2703}
2704function Cr(n) {
2705 const r = n.replace(/\n{2,}/g, `
2706`);
2707 return Et(r);
2708}
2709function Ar(n) {
2710 const r = Cr(n), { children: t } = mt(r), e = [[]];
2711 let u = 0;
2712 function a(i, l = "normal") {
2713 i.type === "text" ? i.value.split(`
2714`).forEach((p, h) => {
2715 h !== 0 && (u++, e.push([])), p.split(" ").forEach((x) => {
2716 x && e[u].push({ content: x, type: l });
2717 });
2718 }) : (i.type === "strong" || i.type === "emphasis") && i.children.forEach((c) => {
2719 a(c, i.type);
2720 });
2721 }
2722 return t.forEach((i) => {
2723 i.type === "paragraph" && i.children.forEach((l) => {
2724 a(l);
2725 });
2726 }), e;
2727}
2728function zr(n) {
2729 const { children: r } = mt(n);
2730 function t(e) {
2731 return e.type === "text" ? e.value.replace(/\n/g, "<br/>") : e.type === "strong" ? `<strong>${e.children.map(t).join("")}</strong>` : e.type === "emphasis" ? `<em>${e.children.map(t).join("")}</em>` : e.type === "paragraph" ? `<p>${e.children.map(t).join("")}</p>` : `Unsupported markdown: ${e.type}`;
2732 }
2733 return r.map(t).join("");
2734}
2735function Ir(n, r) {
2736 r && n.attr("style", r);
2737}
2738function Tr(n, r, t, e, u = !1) {
2739 const a = n.append("foreignObject"), i = a.append("xhtml:div"), l = r.label, c = r.isNode ? "nodeLabel" : "edgeLabel";
2740 i.html(
2741 `
2742 <span class="${c} ${e}" ` + (r.labelStyle ? 'style="' + r.labelStyle + '"' : "") + ">" + l + "</span>"
2743 ), Ir(i, r.labelStyle), i.style("display", "table-cell"), i.style("white-space", "nowrap"), i.style("max-width", t + "px"), i.attr("xmlns", "http://www.w3.org/1999/xhtml"), u && i.attr("class", "labelBkg");
2744 let p = i.node().getBoundingClientRect();
2745 return p.width === t && (i.style("display", "table"), i.style("white-space", "break-spaces"), i.style("width", t + "px"), p = i.node().getBoundingClientRect()), a.style("width", p.width), a.style("height", p.height), a.node();
2746}
2747function vn(n, r, t) {
2748 return n.append("tspan").attr("class", "text-outer-tspan").attr("x", 0).attr("y", r * t - 0.1 + "em").attr("dy", t + "em");
2749}
2750function Br(n, r, t, e = !1) {
2751 const a = r.append("g");
2752 let i = a.insert("rect").attr("class", "background");
2753 const l = a.append("text").attr("y", "-10.1");
2754 let c = -1;
2755 if (t.forEach((p) => {
2756 c++;
2757 let h = vn(l, c, 1.1), x = [...p].reverse(), g, f = [];
2758 for (; x.length; )
2759 g = x.pop(), f.push(g), nt(h, f), h.node().getComputedTextLength() > n && (f.pop(), x.push(g), nt(h, f), f = [], c++, h = vn(l, c, 1.1));
2760 }), e) {
2761 const p = l.node().getBBox(), h = 2;
2762 return i.attr("x", -h).attr("y", -h).attr("width", p.width + 2 * h).attr("height", p.height + 2 * h), a.node();
2763 } else
2764 return l.node();
2765}
2766function nt(n, r) {
2767 n.text(""), r.forEach((t, e) => {
2768 const u = n.append("tspan").attr("font-style", t.type === "em" ? "italic" : "normal").attr("class", "text-inner-tspan").attr("font-weight", t.type === "strong" ? "bold" : "normal");
2769 e === 0 ? u.text(t.content) : u.text(" " + t.content);
2770 });
2771}
2772const Or = (n, r = "", {
2773 style: t = "",
2774 isTitle: e = !1,
2775 classes: u = "",
2776 useHtmlLabels: a = !0,
2777 isNode: i = !0,
2778 width: l,
2779 addSvgBackground: c = !1
2780} = {}) => {
2781 if (Ct.info("createText", r, t, e, u, a, i, c), a) {
2782 const p = zr(r), h = {
2783 isNode: i,
2784 label: At(p).replace(
2785 /fa[blrs]?:fa-[\w-]+/g,
2786 (g) => `<i class='${g.replace(":", " ")}'></i>`
2787 ),
2788 labelStyle: t.replace("fill:", "color:")
2789 };
2790 return Tr(n, h, l, u, c);
2791 } else {
2792 const p = Ar(r);
2793 return Br(l, n, p, c);
2794 }
2795};
2796export {
2797 Or as c
2798};
2799
\No newline at end of file