UNPKG

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