@rtc-agent/component 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1215 @@
1
+ var $e = Object.defineProperty;
2
+ var Se = (r, e, t) => e in r ? $e(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var f = (r, e, t) => Se(r, typeof e != "symbol" ? e + "" : e, t);
4
+ function U() {
5
+ return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
6
+ }
7
+ var A = U();
8
+ function ce(r) {
9
+ A = r;
10
+ }
11
+ var _ = { exec: () => null };
12
+ function P(r) {
13
+ let e = [];
14
+ return (t) => {
15
+ let n = Math.max(0, Math.min(3, t - 1)), s = e[n];
16
+ return s || (s = r(n), e[n] = s), s;
17
+ };
18
+ }
19
+ function k(r, e = "") {
20
+ let t = typeof r == "string" ? r : r.source, n = { replace: (s, i) => {
21
+ let a = typeof i == "string" ? i : i.source;
22
+ return a = a.replace(w.caret, "$1"), t = t.replace(s, a), n;
23
+ }, getRegex: () => new RegExp(t, e) };
24
+ return n;
25
+ }
26
+ var ye = ((r = "") => {
27
+ try {
28
+ return !!new RegExp("(?<=1)(?<!1)" + r);
29
+ } catch {
30
+ return !1;
31
+ }
32
+ })(), w = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (r) => new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: P((r) => new RegExp(`^ {0,${r}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)), hrRegex: P((r) => new RegExp(`^ {0,${r}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)), fencesBeginRegex: P((r) => new RegExp(`^ {0,${r}}(?:\`\`\`|~~~)`)), headingBeginRegex: P((r) => new RegExp(`^ {0,${r}}#`)), htmlBeginRegex: P((r) => new RegExp(`^ {0,${r}}<(?:[a-z].*>|!--)`, "i")), blockquoteBeginRegex: P((r) => new RegExp(`^ {0,${r}}>`)) }, Re = /^(?:[ \t]*(?:\n|$))+/, Te = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, _e = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, C = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, ze = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, W = / {0,3}(?:[*+-]|\d{1,9}[.)])/, he = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, pe = k(he).replace(/bull/g, W).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), Ae = k(he).replace(/bull/g, W).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), F = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/, Pe = /^[^\n]+/, J = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Le = k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", J).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Ee = k(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, W).getRegex(), j = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", K = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Ie = k("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", K).replace("tag", j).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), ue = (r) => k(F).replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", r).replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", j).getRegex(), Be = ue(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/), Ce = ue(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/), qe = k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", Ce).getRegex(), V = { blockquote: qe, code: Te, def: Le, fences: _e, heading: ze, hr: C, html: Ie, lheading: pe, list: Ee, newline: Re, paragraph: Be, table: _, text: Pe }, re = k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", j).getRegex(), ve = { ...V, lheading: Ae, table: re, paragraph: k(F).replace("hr", C).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", re).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", j).getRegex() }, De = { ...V, html: k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", K).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: _, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: k(F).replace("hr", C).replace("heading", ` *#{1,6} *[^
33
+ ]`).replace("lheading", pe).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Ze = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Oe = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ge = /^( {2,}|\\)\n(?!\s*$)/, Qe = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, R = /[\p{P}\p{S}]/u, L = /[\s\p{P}\p{S}]/u, q = /[^\s\p{P}\p{S}]/u, Me = k(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, L).getRegex(), je = /[\p{Pi}\p{Ps}"']/u, ke = /(?!~)[\p{P}\p{S}]/u, He = /(?!~)[\s\p{P}\p{S}]/u, Ne = /(?:[^\s\p{P}\p{S}]|~)/u, Ge = k(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", ye ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), fe = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, Xe = k(fe, "u").replace(/punct/g, R).getRegex(), Ue = k(fe, "u").replace(/punct/g, ke).getRegex(), We = /^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/, Fe = k(We, "u").replace(/openQuote/g, je).replace(/punct/g, R).getRegex(), de = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Je = k(de, "gu").replace(/notPunctSpace/g, q).replace(/punctSpace/g, L).replace(/punct/g, R).getRegex(), Ke = k(de, "gu").replace(/notPunctSpace/g, Ne).replace(/punctSpace/g, He).replace(/punct/g, ke).getRegex(), Ve = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)", Ye = k(Ve, "gu").replace(/notPunctSpace/g, q).replace(/punctSpace/g, L).replace(/punct/g, R).getRegex(), et = k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, q).replace(/punctSpace/g, L).replace(/punct/g, R).getRegex(), tt = "^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)", rt = k(tt, "gu").replace(/notPunctSpace/g, q).replace(/punctSpace/g, L).replace(/punct/g, R).getRegex(), nt = k(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, R).getRegex(), st = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", lt = k(st, "gu").replace(/notPunctSpace/g, q).replace(/punctSpace/g, L).replace(/punct/g, R).getRegex(), it = k(/\\(punct)/, "gu").replace(/punct/g, R).getRegex(), at = k(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), ot = k(K).replace("(?:-->|$)", "-->").getRegex(), ct = k("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", ot).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), O = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, ht = k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", O).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), xe = k(/^!?\[(label)\]\[(ref)\]/).replace("label", O).replace("ref", J).getRegex(), be = k(/^!?\[(ref)\](?:\[\])?/).replace("ref", J).getRegex(), pt = k("reflink|nolink(?!\\()", "g").replace("reflink", xe).replace("nolink", be).getRegex(), ne = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, Y = { _backpedal: _, anyPunctuation: it, autolink: at, blockSkip: Ge, br: ge, code: Oe, del: _, delLDelim: _, delRDelim: _, emStrongLDelim: Xe, emStrongRDelimAst: Je, emStrongRDelimUnd: et, escape: Ze, link: ht, nolink: be, punctuation: Me, reflink: xe, reflinkSearch: pt, tag: ct, text: Qe, url: _ }, ut = { ...Y, emStrongLDelim: Fe, emStrongRDelimAst: Ye, emStrongRDelimUnd: rt, link: k(/^!?\[(label)\]\((.*?)\)/).replace("label", O).getRegex(), reflink: k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", O).getRegex() }, N = { ...Y, emStrongRDelimAst: Ke, emStrongLDelim: Ue, delLDelim: nt, delRDelim: lt, url: k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ne).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: k(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ne).getRegex() }, gt = { ...N, br: k(ge).replace("{2,}", "*").getRegex(), text: k(N.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, D = { normal: V, gfm: ve, pedantic: De }, I = { normal: Y, gfm: N, breaks: gt, pedantic: ut }, kt = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }, se = (r) => kt[r];
34
+ function y(r, e) {
35
+ if (e) {
36
+ if (w.escapeTest.test(r)) return r.replace(w.escapeReplace, se);
37
+ } else if (w.escapeTestNoEncode.test(r)) return r.replace(w.escapeReplaceNoEncode, se);
38
+ return r;
39
+ }
40
+ function le(r) {
41
+ try {
42
+ r = encodeURI(r).replace(w.percentDecode, "%");
43
+ } catch {
44
+ return null;
45
+ }
46
+ return r;
47
+ }
48
+ function ie(r, e) {
49
+ var i;
50
+ let t = r.replace(w.findPipe, (a, o, l) => {
51
+ let p = !1, c = o;
52
+ for (; --c >= 0 && l[c] === "\\"; ) p = !p;
53
+ return p ? "|" : " |";
54
+ }), n = t.split(w.splitPipe), s = 0;
55
+ if (n[0].trim() || n.shift(), n.length > 0 && !((i = n.at(-1)) != null && i.trim()) && n.pop(), e) if (n.length > e) n.splice(e);
56
+ else for (; n.length < e; ) n.push("");
57
+ for (; s < n.length; s++) n[s] = n[s].trim().replace(w.slashPipe, "|");
58
+ return n;
59
+ }
60
+ function T(r, e, t) {
61
+ let n = r.length;
62
+ if (n === 0) return "";
63
+ let s = 0;
64
+ for (; s < n && r.charAt(n - s - 1) === e; )
65
+ s++;
66
+ return r.slice(0, n - s);
67
+ }
68
+ function ae(r) {
69
+ let e = r.split(`
70
+ `), t = e.length - 1;
71
+ for (; t >= 0 && w.blankLine.test(e[t]); ) t--;
72
+ return e.length - t <= 2 ? r : e.slice(0, t + 1).join(`
73
+ `);
74
+ }
75
+ function ft(r, e) {
76
+ if (r.indexOf(e[1]) === -1) return -1;
77
+ let t = 0;
78
+ for (let n = 0; n < r.length; n++) if (r[n] === "\\") n++;
79
+ else if (r[n] === e[0]) t++;
80
+ else if (r[n] === e[1] && (t--, t < 0)) return n;
81
+ return t > 0 ? -2 : -1;
82
+ }
83
+ function dt(r, e = 0) {
84
+ let t = e, n = "";
85
+ for (let s of r) if (s === " ") {
86
+ let i = 4 - t % 4;
87
+ n += " ".repeat(i), t += i;
88
+ } else n += s, t++;
89
+ return n;
90
+ }
91
+ function oe(r, e, t, n, s) {
92
+ let i = e.href, a = e.title || null, o = r[1].replace(s.other.outputLinkReplace, "$1"), l = r[0].charAt(0) === "!";
93
+ n.state.inLink = !0;
94
+ let p = n.state.linkEmitted, c = n.state.inRawBlock;
95
+ n.state.linkEmitted = !1;
96
+ let g = n.inlineTokens(o), h = n.state.linkEmitted;
97
+ if (n.state.linkEmitted = p, n.state.inLink = !1, !l) {
98
+ if (h) {
99
+ n.state.inRawBlock = c;
100
+ return;
101
+ }
102
+ n.state.linkEmitted = !0;
103
+ }
104
+ return { type: l ? "image" : "link", raw: t, href: i, title: a, text: o, tokens: g };
105
+ }
106
+ function xt(r, e, t) {
107
+ let n = r.match(t.other.indentCodeCompensation);
108
+ if (n === null) return e;
109
+ let s = n[1];
110
+ return e.split(`
111
+ `).map((i) => {
112
+ let a = i.match(t.other.beginningSpace);
113
+ if (a === null) return i;
114
+ let [o] = a;
115
+ return o.length >= s.length ? i.slice(s.length) : i;
116
+ }).join(`
117
+ `);
118
+ }
119
+ var Q = class {
120
+ constructor(r) {
121
+ f(this, "options");
122
+ f(this, "rules");
123
+ f(this, "lexer");
124
+ this.options = r || A;
125
+ }
126
+ space(r) {
127
+ let e = this.rules.block.newline.exec(r);
128
+ if (e && e[0].length > 0) return { type: "space", raw: e[0] };
129
+ }
130
+ code(r) {
131
+ let e = this.rules.block.code.exec(r);
132
+ if (e) {
133
+ let t = this.options.pedantic ? e[0] : ae(e[0]), n = t.replace(this.rules.other.codeRemoveIndent, "");
134
+ return { type: "code", raw: t, codeBlockStyle: "indented", text: n };
135
+ }
136
+ }
137
+ fences(r) {
138
+ let e = this.rules.block.fences.exec(r);
139
+ if (e) {
140
+ let t = e[0], n = xt(t, e[3] || "", this.rules);
141
+ return { type: "code", raw: t, lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2], text: n };
142
+ }
143
+ }
144
+ heading(r) {
145
+ let e = this.rules.block.heading.exec(r);
146
+ if (e) {
147
+ let t = e[2].trim();
148
+ if (this.rules.other.endingHash.test(t)) {
149
+ let n = T(t, "#");
150
+ (this.options.pedantic || !n || this.rules.other.endingSpaceChar.test(n)) && (t = n.trim());
151
+ }
152
+ return { type: "heading", raw: T(e[0], `
153
+ `), depth: e[1].length, text: t, tokens: this.lexer.inline(t) };
154
+ }
155
+ }
156
+ hr(r) {
157
+ let e = this.rules.block.hr.exec(r);
158
+ if (e) return { type: "hr", raw: T(e[0], `
159
+ `) };
160
+ }
161
+ blockquote(r) {
162
+ let e = this.rules.block.blockquote.exec(r);
163
+ if (e) {
164
+ let t = T(e[0], `
165
+ `).split(`
166
+ `), n = "", s = "", i = [];
167
+ for (; t.length > 0; ) {
168
+ let a = !1, o = [], l;
169
+ for (l = 0; l < t.length; l++) if (this.rules.other.blockquoteStart.test(t[l])) o.push(t[l]), a = !0;
170
+ else if (!a) o.push(t[l]);
171
+ else break;
172
+ t = t.slice(l);
173
+ let p = o.join(`
174
+ `), c = p.replace(this.rules.other.blockquoteSetextReplace, `
175
+ $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
176
+ n = n ? `${n}
177
+ ${p}` : p, s = s ? `${s}
178
+ ${c}` : c;
179
+ let g = this.lexer.state.top;
180
+ if (this.lexer.state.top = !0, this.lexer.blockTokens(c, i, !0), this.lexer.state.top = g, t.length === 0) break;
181
+ let h = i.at(-1);
182
+ if ((h == null ? void 0 : h.type) === "code") break;
183
+ if ((h == null ? void 0 : h.type) === "blockquote") {
184
+ let x = h, u = t.join(`
185
+ `), b = x.raw + `
186
+ ` + u.replace(this.rules.other.blockquoteSetextReplace2, ""), m = this.blockquote(b);
187
+ i[i.length - 1] = m, n = `${n}
188
+ ${u}`, s = s.substring(0, s.length - x.text.length) + m.text;
189
+ break;
190
+ } else if ((h == null ? void 0 : h.type) === "list") {
191
+ let x = h, u = x.raw + `
192
+ ` + t.join(`
193
+ `), b = this.list(u);
194
+ i[i.length - 1] = b, n = n.substring(0, n.length - h.raw.length) + b.raw, s = s.substring(0, s.length - x.raw.length) + b.raw, t = u.substring(i.at(-1).raw.length).split(`
195
+ `);
196
+ continue;
197
+ }
198
+ }
199
+ return { type: "blockquote", raw: n, tokens: i, text: s };
200
+ }
201
+ }
202
+ list(r) {
203
+ let e = this.rules.block.list.exec(r);
204
+ if (e) {
205
+ let t = e[1].trim(), n = t.length > 1, s = { type: "list", raw: "", ordered: n, start: n ? +t.slice(0, -1) : "", loose: !1, items: [] };
206
+ t = n ? `\\d{1,9}\\${t.slice(-1)}` : `\\${t}`, this.options.pedantic && (t = n ? t : "[*+-]");
207
+ let i = this.rules.other.listItemRegex(t), a = !1;
208
+ for (; r; ) {
209
+ let l = !1, p = "", c = "";
210
+ if (!(e = i.exec(r)) || this.rules.block.hr.test(r)) break;
211
+ p = e[0], r = r.substring(p.length);
212
+ let g = dt(e[2].split(`
213
+ `, 1)[0], e[1].length), h = r.split(`
214
+ `, 1)[0], x = !g.trim(), u = 0;
215
+ if (this.options.pedantic ? (u = 2, c = g.trimStart()) : x ? u = e[1].length + 1 : (u = g.search(this.rules.other.nonSpaceChar), u = u > 4 ? 1 : u, c = g.slice(u), u += e[1].length), x && this.rules.other.blankLine.test(h) && (p += h + `
216
+ `, r = r.substring(h.length + 1), l = !0), !l) {
217
+ let b = this.rules.other.nextBulletRegex(u), m = this.rules.other.hrRegex(u), v = this.rules.other.fencesBeginRegex(u), te = this.rules.other.headingBeginRegex(u), we = this.rules.other.htmlBeginRegex(u), me = this.rules.other.blockquoteBeginRegex(u);
218
+ for (; r; ) {
219
+ let H = r.split(`
220
+ `, 1)[0], E;
221
+ if (h = H, this.options.pedantic ? (h = h.replace(this.rules.other.listReplaceNesting, " "), E = h) : E = h.replace(this.rules.other.tabCharGlobal, " "), v.test(h) || te.test(h) || we.test(h) || me.test(h) || b.test(h) || m.test(h)) break;
222
+ if (E.search(this.rules.other.nonSpaceChar) >= u || !h.trim()) c += `
223
+ ` + E.slice(u);
224
+ else {
225
+ if (x || g.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || v.test(g) || te.test(g) || m.test(g)) break;
226
+ c += `
227
+ ` + h;
228
+ }
229
+ x = !h.trim(), p += H + `
230
+ `, r = r.substring(H.length + 1), g = E.slice(u);
231
+ }
232
+ }
233
+ s.loose || (a ? s.loose = !0 : this.rules.other.doubleBlankLine.test(p) && (a = !0)), s.items.push({ type: "list_item", raw: p, task: !!this.options.gfm && this.rules.other.listIsTask.test(c), loose: !1, text: c, tokens: [] }), s.raw += p;
234
+ }
235
+ let o = s.items.at(-1);
236
+ if (o) o.raw = o.raw.trimEnd(), o.text = o.text.trimEnd();
237
+ else return;
238
+ s.raw = s.raw.trimEnd();
239
+ for (let l of s.items) if (this.lexer.state.top = !1, l.tokens = this.lexer.blockTokens(l.text, []), !s.loose) {
240
+ let p = l.tokens.filter((g) => g.type === "space"), c = p.length > 0 && p.some((g) => this.rules.other.anyLine.test(g.raw));
241
+ s.loose = c;
242
+ }
243
+ for (let l of s.items) {
244
+ let p = l.tokens[0];
245
+ if (l.task && ((p == null ? void 0 : p.type) === "text" || (p == null ? void 0 : p.type) === "paragraph")) {
246
+ l.text = l.text.replace(this.rules.other.listReplaceTask, ""), p.raw = p.raw.replace(this.rules.other.listReplaceTask, ""), p.text = p.text.replace(this.rules.other.listReplaceTask, "");
247
+ for (let g = this.lexer.inlineQueue.length - 1; g >= 0; g--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[g].src)) {
248
+ this.lexer.inlineQueue[g].src = this.lexer.inlineQueue[g].src.replace(this.rules.other.listReplaceTask, "");
249
+ break;
250
+ }
251
+ let c = this.rules.other.listTaskCheckbox.exec(l.raw);
252
+ if (c) {
253
+ let g = { type: "checkbox", raw: c[0] + " ", checked: c[0] !== "[ ]" };
254
+ l.checked = g.checked, s.loose ? l.tokens[0] && ["paragraph", "text"].includes(l.tokens[0].type) && "tokens" in l.tokens[0] && l.tokens[0].tokens ? (l.tokens[0].raw = g.raw + l.tokens[0].raw, l.tokens[0].text = g.raw + l.tokens[0].text, l.tokens[0].tokens.unshift(g)) : l.tokens.unshift({ type: "paragraph", raw: g.raw, text: g.raw, tokens: [g] }) : l.tokens.unshift(g);
255
+ }
256
+ } else l.task && (l.task = !1);
257
+ }
258
+ if (s.loose) for (let l of s.items) {
259
+ l.loose = !0;
260
+ for (let p of l.tokens) p.type === "text" && (p.type = "paragraph");
261
+ }
262
+ return s;
263
+ }
264
+ }
265
+ html(r) {
266
+ let e = this.rules.block.html.exec(r);
267
+ if (e) {
268
+ let t = ae(e[0]);
269
+ return { type: "html", block: !0, raw: t, pre: e[1] === "pre" || e[1] === "script" || e[1] === "style", text: t };
270
+ }
271
+ }
272
+ def(r) {
273
+ let e = this.rules.block.def.exec(r);
274
+ if (e) {
275
+ let t = e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), n = e[2] ? e[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", s = e[3] ? e[3].substring(1, e[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : e[3];
276
+ return { type: "def", tag: t, raw: T(e[0], `
277
+ `), href: n, title: s };
278
+ }
279
+ }
280
+ table(r) {
281
+ var a;
282
+ let e = this.rules.block.table.exec(r);
283
+ if (!e || !this.rules.other.tableDelimiter.test(e[2])) return;
284
+ let t = ie(e[1]), n = e[2].replace(this.rules.other.tableAlignChars, "").split("|"), s = (a = e[3]) != null && a.trim() ? e[3].replace(this.rules.other.tableRowBlankLine, "").split(`
285
+ `) : [], i = { type: "table", raw: T(e[0], `
286
+ `), header: [], align: [], rows: [] };
287
+ if (t.length === n.length) {
288
+ for (let o of n) this.rules.other.tableAlignRight.test(o) ? i.align.push("right") : this.rules.other.tableAlignCenter.test(o) ? i.align.push("center") : this.rules.other.tableAlignLeft.test(o) ? i.align.push("left") : i.align.push(null);
289
+ for (let o = 0; o < t.length; o++) i.header.push({ text: t[o], tokens: this.lexer.inline(t[o]), header: !0, align: i.align[o] });
290
+ for (let o of s) i.rows.push(ie(o, i.header.length).map((l, p) => ({ text: l, tokens: this.lexer.inline(l), header: !1, align: i.align[p] })));
291
+ return i;
292
+ }
293
+ }
294
+ lheading(r) {
295
+ let e = this.rules.block.lheading.exec(r);
296
+ if (e) {
297
+ let t = e[1].trim();
298
+ return { type: "heading", raw: T(e[0], `
299
+ `), depth: e[2].charAt(0) === "=" ? 1 : 2, text: t, tokens: this.lexer.inline(t) };
300
+ }
301
+ }
302
+ paragraph(r) {
303
+ let e = this.rules.block.paragraph.exec(r);
304
+ if (e) {
305
+ let t = e[1].charAt(e[1].length - 1) === `
306
+ ` ? e[1].slice(0, -1) : e[1];
307
+ return { type: "paragraph", raw: e[0], text: t, tokens: this.lexer.inline(t) };
308
+ }
309
+ }
310
+ text(r) {
311
+ let e = this.rules.block.text.exec(r);
312
+ if (e) return { type: "text", raw: e[0], text: e[0], tokens: this.lexer.inline(e[0]) };
313
+ }
314
+ escape(r) {
315
+ let e = this.rules.inline.escape.exec(r);
316
+ if (e) return { type: "escape", raw: e[0], text: e[1] };
317
+ }
318
+ tag(r) {
319
+ let e = this.rules.inline.tag.exec(r);
320
+ if (e) return !this.lexer.state.inLink && this.rules.other.startATag.test(e[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(e[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(e[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(e[0]) && (this.lexer.state.inRawBlock = !1), { type: "html", raw: e[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: !1, text: e[0] };
321
+ }
322
+ link(r) {
323
+ let e = this.rules.inline.link.exec(r);
324
+ if (e) {
325
+ let t = e[2].trim();
326
+ if (!this.options.pedantic && this.rules.other.startAngleBracket.test(t)) {
327
+ if (!this.rules.other.endAngleBracket.test(t)) return;
328
+ let i = T(t.slice(0, -1), "\\");
329
+ if ((t.length - i.length) % 2 === 0) return;
330
+ } else {
331
+ let i = ft(e[2], "()");
332
+ if (i === -2) return;
333
+ if (i > -1) {
334
+ let a = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length + i;
335
+ e[2] = e[2].substring(0, i), e[0] = e[0].substring(0, a).trim(), e[3] = "";
336
+ }
337
+ }
338
+ let n = e[2], s = "";
339
+ if (this.options.pedantic) {
340
+ let i = this.rules.other.pedanticHrefTitle.exec(n);
341
+ i && (n = i[1], s = i[3]);
342
+ } else s = e[3] ? e[3].slice(1, -1) : "";
343
+ return n = n.trim(), this.rules.other.startAngleBracket.test(n) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(t) ? n = n.slice(1) : n = n.slice(1, -1)), oe(e, { href: n && n.replace(this.rules.inline.anyPunctuation, "$1"), title: s && s.replace(this.rules.inline.anyPunctuation, "$1") }, e[0], this.lexer, this.rules);
344
+ }
345
+ }
346
+ reflink(r, e) {
347
+ let t;
348
+ if ((t = this.rules.inline.reflink.exec(r)) || (t = this.rules.inline.nolink.exec(r))) {
349
+ let n = (t[2] || t[1]).replace(this.rules.other.multipleSpaceGlobal, " "), s = e[n.toLowerCase()];
350
+ if (!s) {
351
+ let i = t[0].charAt(0);
352
+ return { type: "text", raw: i, text: i };
353
+ }
354
+ return oe(t, s, t[0], this.lexer, this.rules);
355
+ }
356
+ }
357
+ emStrong(r, e, t = "") {
358
+ let n = this.rules.inline.emStrongLDelim.exec(r);
359
+ if (!(!n || !n[1] && !n[2] && !n[3] && !n[4] || n[4] && t.match(this.rules.other.unicodeAlphaNumeric)) && (!(n[1] || n[3]) || !t || this.rules.inline.punctuation.exec(t))) {
360
+ let s = [...n[0]].length - 1, i, a, o = s, l = 0, p = n[0][0], c = t === p, g = p === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
361
+ for (g.lastIndex = 0, e = e.slice(-1 * r.length + s); (n = g.exec(e)) !== null; ) {
362
+ if (i = n[1] || n[2] || n[3] || n[4] || n[5] || n[6], !i) continue;
363
+ if (a = [...i].length, n[3] || n[4]) {
364
+ o += a;
365
+ continue;
366
+ } else if (n[5] || n[6]) {
367
+ if (s % 3 && !((s + a) % 3)) {
368
+ l += a;
369
+ continue;
370
+ }
371
+ if (c) break;
372
+ }
373
+ if (o -= a, o > 0) continue;
374
+ a = Math.min(a, a + o + l);
375
+ let h = [...n[0]][0].length, x = r.slice(0, s + n.index + h + a);
376
+ if (Math.min(s, a) % 2) {
377
+ let b = x.slice(1, -1);
378
+ return { type: "em", raw: x, text: b, tokens: this.lexer.inlineTokens(b) };
379
+ }
380
+ let u = x.slice(2, -2);
381
+ return { type: "strong", raw: x, text: u, tokens: this.lexer.inlineTokens(u) };
382
+ }
383
+ }
384
+ }
385
+ codespan(r) {
386
+ let e = this.rules.inline.code.exec(r);
387
+ if (e) {
388
+ let t = e[2].replace(this.rules.other.newLineCharGlobal, " "), n = this.rules.other.nonSpaceChar.test(t), s = this.rules.other.startingSpaceChar.test(t) && this.rules.other.endingSpaceChar.test(t);
389
+ return n && s && (t = t.substring(1, t.length - 1)), { type: "codespan", raw: e[0], text: t };
390
+ }
391
+ }
392
+ br(r) {
393
+ let e = this.rules.inline.br.exec(r);
394
+ if (e) return { type: "br", raw: e[0] };
395
+ }
396
+ del(r, e, t = "") {
397
+ let n = this.rules.inline.delLDelim.exec(r);
398
+ if (n && (!n[1] || !t || this.rules.inline.punctuation.exec(t))) {
399
+ let s = [...n[0]].length - 1, i, a, o = s, l = this.rules.inline.delRDelim;
400
+ for (l.lastIndex = 0, e = e.slice(-1 * r.length + s); (n = l.exec(e)) !== null; ) {
401
+ if (i = n[1] || n[2] || n[3] || n[4] || n[5] || n[6], !i || (a = [...i].length, a !== s)) continue;
402
+ if (n[3] || n[4]) {
403
+ o += a;
404
+ continue;
405
+ }
406
+ if (o -= a, o > 0) continue;
407
+ a = Math.min(a, a + o);
408
+ let p = [...n[0]][0].length, c = r.slice(0, s + n.index + p + a), g = c.slice(s, -s);
409
+ return { type: "del", raw: c, text: g, tokens: this.lexer.inlineTokens(g) };
410
+ }
411
+ }
412
+ }
413
+ autolink(r) {
414
+ let e = this.rules.inline.autolink.exec(r);
415
+ if (e) {
416
+ let t, n;
417
+ return e[2] === "@" ? (t = e[1], n = "mailto:" + t) : (t = e[1], n = t), { type: "link", raw: e[0], text: t, href: n, tokens: [{ type: "text", raw: t, text: t }] };
418
+ }
419
+ }
420
+ url(r) {
421
+ var t;
422
+ let e;
423
+ if (e = this.rules.inline.url.exec(r)) {
424
+ let n, s;
425
+ if (e[2] === "@") n = e[0], s = "mailto:" + n;
426
+ else {
427
+ let i;
428
+ do
429
+ i = e[0], e[0] = ((t = this.rules.inline._backpedal.exec(e[0])) == null ? void 0 : t[0]) ?? "";
430
+ while (i !== e[0]);
431
+ n = e[0], e[1] === "www." ? s = "http://" + e[0] : s = e[0];
432
+ }
433
+ return { type: "link", raw: e[0], text: n, href: s, tokens: [{ type: "text", raw: n, text: n }] };
434
+ }
435
+ }
436
+ inlineText(r) {
437
+ let e = this.rules.inline.text.exec(r);
438
+ if (e) {
439
+ let t = this.lexer.state.inRawBlock;
440
+ return { type: "text", raw: e[0], text: e[0], escaped: t };
441
+ }
442
+ }
443
+ }, $ = class G {
444
+ constructor(e) {
445
+ f(this, "tokens");
446
+ f(this, "options");
447
+ f(this, "state");
448
+ f(this, "inlineQueue");
449
+ f(this, "tokenizer");
450
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || A, this.options.tokenizer = this.options.tokenizer || new Q(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, linkEmitted: !1, top: !0 };
451
+ let t = { other: w, block: D.normal, inline: I.normal };
452
+ this.options.pedantic ? (t.block = D.pedantic, t.inline = I.pedantic) : this.options.gfm && (t.block = D.gfm, this.options.breaks ? t.inline = I.breaks : t.inline = I.gfm), this.tokenizer.rules = t;
453
+ }
454
+ static get rules() {
455
+ return { block: D, inline: I };
456
+ }
457
+ static lex(e, t) {
458
+ return new G(t).lex(e);
459
+ }
460
+ static lexInline(e, t) {
461
+ return new G(t).inlineTokens(e);
462
+ }
463
+ lex(e) {
464
+ e = e.replace(w.carriageReturn, `
465
+ `), this.blockTokens(e, this.tokens);
466
+ for (let t = 0; t < this.inlineQueue.length; t++) {
467
+ let n = this.inlineQueue[t];
468
+ this.inlineTokens(n.src, n.tokens);
469
+ }
470
+ return this.inlineQueue = [], this.tokens;
471
+ }
472
+ blockTokens(e, t = [], n = !1) {
473
+ var i, a, o;
474
+ this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(w.tabCharGlobal, " ").replace(w.spaceLine, ""));
475
+ let s = 1 / 0;
476
+ for (; e; ) {
477
+ if (e.length < s) s = e.length;
478
+ else {
479
+ this.infiniteLoopError(e.charCodeAt(0));
480
+ break;
481
+ }
482
+ let l;
483
+ if ((a = (i = this.options.extensions) == null ? void 0 : i.block) != null && a.some((c) => (l = c.call({ lexer: this }, e, t)) ? (e = e.substring(l.raw.length), t.push(l), !0) : !1)) continue;
484
+ if (l = this.tokenizer.space(e)) {
485
+ e = e.substring(l.raw.length);
486
+ let c = t.at(-1);
487
+ l.raw.length === 1 && c !== void 0 ? c.raw += `
488
+ ` : t.push(l);
489
+ continue;
490
+ }
491
+ if (l = this.tokenizer.code(e)) {
492
+ e = e.substring(l.raw.length);
493
+ let c = t.at(-1);
494
+ (c == null ? void 0 : c.type) === "paragraph" || (c == null ? void 0 : c.type) === "text" ? (c.raw += (c.raw.endsWith(`
495
+ `) ? "" : `
496
+ `) + l.raw, c.text += `
497
+ ` + l.text, this.inlineQueue.at(-1).src = c.text) : t.push(l);
498
+ continue;
499
+ }
500
+ if (l = this.tokenizer.fences(e)) {
501
+ e = e.substring(l.raw.length), t.push(l);
502
+ continue;
503
+ }
504
+ if (l = this.tokenizer.heading(e)) {
505
+ e = e.substring(l.raw.length), t.push(l);
506
+ continue;
507
+ }
508
+ if (l = this.tokenizer.hr(e)) {
509
+ e = e.substring(l.raw.length), t.push(l);
510
+ continue;
511
+ }
512
+ if (l = this.tokenizer.blockquote(e)) {
513
+ e = e.substring(l.raw.length), t.push(l);
514
+ continue;
515
+ }
516
+ if (l = this.tokenizer.list(e)) {
517
+ e = e.substring(l.raw.length), t.push(l);
518
+ continue;
519
+ }
520
+ if (l = this.tokenizer.html(e)) {
521
+ e = e.substring(l.raw.length), t.push(l);
522
+ continue;
523
+ }
524
+ if (l = this.tokenizer.def(e)) {
525
+ e = e.substring(l.raw.length);
526
+ let c = t.at(-1);
527
+ (c == null ? void 0 : c.type) === "paragraph" || (c == null ? void 0 : c.type) === "text" ? (c.raw += (c.raw.endsWith(`
528
+ `) ? "" : `
529
+ `) + l.raw, c.text += `
530
+ ` + l.raw, this.inlineQueue.at(-1).src = c.text) : this.tokens.links[l.tag] || (this.tokens.links[l.tag] = { href: l.href, title: l.title }, t.push(l));
531
+ continue;
532
+ }
533
+ if (l = this.tokenizer.table(e)) {
534
+ e = e.substring(l.raw.length), t.push(l);
535
+ continue;
536
+ }
537
+ if (l = this.tokenizer.lheading(e)) {
538
+ e = e.substring(l.raw.length), t.push(l);
539
+ continue;
540
+ }
541
+ let p = e;
542
+ if ((o = this.options.extensions) != null && o.startBlock) {
543
+ let c = 1 / 0, g = e.slice(1), h;
544
+ this.options.extensions.startBlock.forEach((x) => {
545
+ h = x.call({ lexer: this }, g), typeof h == "number" && h >= 0 && (c = Math.min(c, h));
546
+ }), c < 1 / 0 && c >= 0 && (p = e.substring(0, c + 1));
547
+ }
548
+ if (this.state.top && (l = this.tokenizer.paragraph(p))) {
549
+ let c = t.at(-1);
550
+ n && (c == null ? void 0 : c.type) === "paragraph" ? (c.raw += (c.raw.endsWith(`
551
+ `) ? "" : `
552
+ `) + l.raw, c.text += `
553
+ ` + l.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = c.text) : t.push(l), n = p.length !== e.length, e = e.substring(l.raw.length);
554
+ continue;
555
+ }
556
+ if (l = this.tokenizer.text(e)) {
557
+ e = e.substring(l.raw.length);
558
+ let c = t.at(-1);
559
+ (c == null ? void 0 : c.type) === "text" ? (c.raw += (c.raw.endsWith(`
560
+ `) ? "" : `
561
+ `) + l.raw, c.text += `
562
+ ` + l.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = c.text) : t.push(l);
563
+ continue;
564
+ }
565
+ if (e) {
566
+ this.infiniteLoopError(e.charCodeAt(0));
567
+ break;
568
+ }
569
+ }
570
+ return this.state.top = !0, t;
571
+ }
572
+ inline(e, t = []) {
573
+ return this.inlineQueue.push({ src: e, tokens: t }), t;
574
+ }
575
+ linkInText(e) {
576
+ if (!e.includes("[")) return !1;
577
+ let t = this.tokenizer.rules.inline.link;
578
+ for (let n of e.matchAll(this.tokenizer.rules.inline.blockSkip)) if (t.test(n[0]) && e.charAt(n.index - 1) !== "!") return !0;
579
+ for (let n of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)) {
580
+ let s = n[0], i = s.lastIndexOf("[");
581
+ if (!(s.charAt(0) === "!" || !Object.hasOwn(this.tokens.links, s.slice(i + 1, -1))) && !(i > 1 && this.linkInText(s.slice(1, i - 1)))) return !0;
582
+ }
583
+ return !1;
584
+ }
585
+ inlineTokens(e, t = []) {
586
+ var o, l, p, c, g;
587
+ this.tokenizer.lexer = this;
588
+ let n = e;
589
+ if (this.tokens.links && e.includes("[")) {
590
+ let h = this.tokenizer.rules.inline.reflinkSearch, x = (u) => {
591
+ let b = u.lastIndexOf("[");
592
+ if (!Object.hasOwn(this.tokens.links, u.slice(b + 1, -1))) return u;
593
+ if (b > 1 && u.charAt(0) !== "!") {
594
+ let m = u.slice(1, b - 1);
595
+ if (this.linkInText(m)) return "[" + m.replace(h, x) + "][" + "a".repeat(u.length - b - 2) + "]";
596
+ }
597
+ return "[" + "a".repeat(u.length - 2) + "]";
598
+ };
599
+ n = n.replace(h, x);
600
+ }
601
+ n = n.replace(this.tokenizer.rules.inline.anyPunctuation, (h) => "+".repeat(h.length)), n = n.replace(this.tokenizer.rules.inline.blockSkip, (h, x, u) => {
602
+ let b = u ? u.length : 0;
603
+ return h.slice(0, b) + "[" + "a".repeat(h.length - b - 2) + "]";
604
+ }), n = ((l = (o = this.options.hooks) == null ? void 0 : o.emStrongMask) == null ? void 0 : l.call({ lexer: this }, n)) ?? n;
605
+ let s = !1, i = "", a = 1 / 0;
606
+ for (; e; ) {
607
+ if (e.length < a) a = e.length;
608
+ else {
609
+ this.infiniteLoopError(e.charCodeAt(0));
610
+ break;
611
+ }
612
+ s || (i = ""), s = !1;
613
+ let h;
614
+ if ((c = (p = this.options.extensions) == null ? void 0 : p.inline) != null && c.some((u) => (h = u.call({ lexer: this }, e, t)) ? (e = e.substring(h.raw.length), t.push(h), !0) : !1)) continue;
615
+ if (h = this.tokenizer.escape(e)) {
616
+ e = e.substring(h.raw.length), t.push(h);
617
+ continue;
618
+ }
619
+ if (h = this.tokenizer.tag(e)) {
620
+ e = e.substring(h.raw.length), t.push(h);
621
+ continue;
622
+ }
623
+ if (h = this.tokenizer.link(e)) {
624
+ e = e.substring(h.raw.length), t.push(h);
625
+ continue;
626
+ }
627
+ if (h = this.tokenizer.reflink(e, this.tokens.links)) {
628
+ e = e.substring(h.raw.length);
629
+ let u = t.at(-1);
630
+ h.type === "text" && (u == null ? void 0 : u.type) === "text" ? (u.raw += h.raw, u.text += h.text) : t.push(h);
631
+ continue;
632
+ }
633
+ if (h = this.tokenizer.emStrong(e, n, i)) {
634
+ e = e.substring(h.raw.length), t.push(h);
635
+ continue;
636
+ }
637
+ if (h = this.tokenizer.codespan(e)) {
638
+ e = e.substring(h.raw.length), t.push(h);
639
+ continue;
640
+ }
641
+ if (h = this.tokenizer.br(e)) {
642
+ e = e.substring(h.raw.length), t.push(h);
643
+ continue;
644
+ }
645
+ if (h = this.tokenizer.del(e, n, i)) {
646
+ e = e.substring(h.raw.length), t.push(h);
647
+ continue;
648
+ }
649
+ if (h = this.tokenizer.autolink(e)) {
650
+ e = e.substring(h.raw.length), t.push(h);
651
+ continue;
652
+ }
653
+ if (!this.state.inLink && (h = this.tokenizer.url(e))) {
654
+ e = e.substring(h.raw.length), t.push(h);
655
+ continue;
656
+ }
657
+ let x = e;
658
+ if ((g = this.options.extensions) != null && g.startInline) {
659
+ let u = 1 / 0, b = e.slice(1), m;
660
+ this.options.extensions.startInline.forEach((v) => {
661
+ m = v.call({ lexer: this }, b), typeof m == "number" && m >= 0 && (u = Math.min(u, m));
662
+ }), u < 1 / 0 && u >= 0 && (x = e.substring(0, u + 1));
663
+ }
664
+ if (h = this.tokenizer.inlineText(x)) {
665
+ e = e.substring(h.raw.length), h.raw.slice(-1) !== "_" && (i = h.raw.slice(-1)), s = !0;
666
+ let u = t.at(-1);
667
+ (u == null ? void 0 : u.type) === "text" ? (u.raw += h.raw, u.text += h.text) : t.push(h);
668
+ continue;
669
+ }
670
+ if (e) {
671
+ this.infiniteLoopError(e.charCodeAt(0));
672
+ break;
673
+ }
674
+ }
675
+ return t;
676
+ }
677
+ infiniteLoopError(e) {
678
+ let t = "Infinite loop on byte: " + e;
679
+ if (this.options.silent) console.error(t);
680
+ else throw new Error(t);
681
+ }
682
+ }, M = class {
683
+ constructor(r) {
684
+ f(this, "options");
685
+ f(this, "parser");
686
+ this.options = r || A;
687
+ }
688
+ space(r) {
689
+ return "";
690
+ }
691
+ code({ text: r, lang: e, escaped: t }) {
692
+ var i;
693
+ let n = (i = (e || "").match(w.notSpaceStart)) == null ? void 0 : i[0], s = r.replace(w.endingNewline, "") + `
694
+ `;
695
+ return n ? '<pre><code class="language-' + y(n) + '">' + (t ? s : y(s, !0)) + `</code></pre>
696
+ ` : "<pre><code>" + (t ? s : y(s, !0)) + `</code></pre>
697
+ `;
698
+ }
699
+ blockquote({ tokens: r }) {
700
+ return `<blockquote>
701
+ ${this.parser.parse(r)}</blockquote>
702
+ `;
703
+ }
704
+ html({ text: r }) {
705
+ return r;
706
+ }
707
+ def(r) {
708
+ return "";
709
+ }
710
+ heading({ tokens: r, depth: e }) {
711
+ return `<h${e}>${this.parser.parseInline(r)}</h${e}>
712
+ `;
713
+ }
714
+ hr(r) {
715
+ return `<hr>
716
+ `;
717
+ }
718
+ list(r) {
719
+ let e = r.ordered, t = r.start, n = "";
720
+ for (let a = 0; a < r.items.length; a++) {
721
+ let o = r.items[a];
722
+ n += this.listitem(o);
723
+ }
724
+ let s = e ? "ol" : "ul", i = e && t !== 1 ? ' start="' + t + '"' : "";
725
+ return "<" + s + i + `>
726
+ ` + n + "</" + s + `>
727
+ `;
728
+ }
729
+ listitem(r) {
730
+ return `<li>${this.parser.parse(r.tokens)}</li>
731
+ `;
732
+ }
733
+ checkbox({ checked: r }) {
734
+ return "<input " + (r ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
735
+ }
736
+ paragraph({ tokens: r }) {
737
+ return `<p>${this.parser.parseInline(r)}</p>
738
+ `;
739
+ }
740
+ table(r) {
741
+ let e = "", t = "";
742
+ for (let s = 0; s < r.header.length; s++) t += this.tablecell(r.header[s]);
743
+ e += this.tablerow({ text: t });
744
+ let n = "";
745
+ for (let s = 0; s < r.rows.length; s++) {
746
+ let i = r.rows[s];
747
+ t = "";
748
+ for (let a = 0; a < i.length; a++) t += this.tablecell(i[a]);
749
+ n += this.tablerow({ text: t });
750
+ }
751
+ return n && (n = `<tbody>${n}</tbody>`), `<table>
752
+ <thead>
753
+ ` + e + `</thead>
754
+ ` + n + `</table>
755
+ `;
756
+ }
757
+ tablerow({ text: r }) {
758
+ return `<tr>
759
+ ${r}</tr>
760
+ `;
761
+ }
762
+ tablecell(r) {
763
+ let e = this.parser.parseInline(r.tokens), t = r.header ? "th" : "td";
764
+ return (r.align ? `<${t} align="${r.align}">` : `<${t}>`) + e + `</${t}>
765
+ `;
766
+ }
767
+ strong({ tokens: r }) {
768
+ return `<strong>${this.parser.parseInline(r)}</strong>`;
769
+ }
770
+ em({ tokens: r }) {
771
+ return `<em>${this.parser.parseInline(r)}</em>`;
772
+ }
773
+ codespan({ text: r }) {
774
+ return `<code>${y(r, !0)}</code>`;
775
+ }
776
+ br(r) {
777
+ return "<br>";
778
+ }
779
+ del({ tokens: r }) {
780
+ return `<del>${this.parser.parseInline(r)}</del>`;
781
+ }
782
+ link({ href: r, title: e, tokens: t }) {
783
+ let n = this.parser.parseInline(t), s = le(r);
784
+ if (s === null) return n;
785
+ r = s;
786
+ let i = '<a href="' + r + '"';
787
+ return e && (i += ' title="' + y(e) + '"'), i += ">" + n + "</a>", i;
788
+ }
789
+ image({ href: r, title: e, text: t, tokens: n }) {
790
+ n && (t = this.parser.parseInline(n, this.parser.textRenderer));
791
+ let s = le(r);
792
+ if (s === null) return y(t);
793
+ r = s;
794
+ let i = `<img src="${r}" alt="${y(t)}"`;
795
+ return e && (i += ` title="${y(e)}"`), i += ">", i;
796
+ }
797
+ text(r) {
798
+ return "tokens" in r && r.tokens ? this.parser.parseInline(r.tokens) : "escaped" in r && r.escaped ? r.text : y(r.text);
799
+ }
800
+ }, ee = class {
801
+ strong({ text: r }) {
802
+ return r;
803
+ }
804
+ em({ text: r }) {
805
+ return r;
806
+ }
807
+ codespan({ text: r }) {
808
+ return r;
809
+ }
810
+ del({ text: r }) {
811
+ return r;
812
+ }
813
+ html({ text: r }) {
814
+ return r;
815
+ }
816
+ text({ text: r }) {
817
+ return r;
818
+ }
819
+ link({ text: r }) {
820
+ return "" + r;
821
+ }
822
+ image({ text: r }) {
823
+ return "" + r;
824
+ }
825
+ br() {
826
+ return "";
827
+ }
828
+ checkbox({ raw: r }) {
829
+ return r;
830
+ }
831
+ }, S = class X {
832
+ constructor(e) {
833
+ f(this, "options");
834
+ f(this, "renderer");
835
+ f(this, "textRenderer");
836
+ this.options = e || A, this.options.renderer = this.options.renderer || new M(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new ee();
837
+ }
838
+ static parse(e, t) {
839
+ return new X(t).parse(e);
840
+ }
841
+ static parseInline(e, t) {
842
+ return new X(t).parseInline(e);
843
+ }
844
+ parse(e) {
845
+ var n, s;
846
+ this.renderer.parser = this;
847
+ let t = "";
848
+ for (let i = 0; i < e.length; i++) {
849
+ let a = e[i];
850
+ if ((s = (n = this.options.extensions) == null ? void 0 : n.renderers) != null && s[a.type]) {
851
+ let l = a, p = this.options.extensions.renderers[l.type].call({ parser: this }, l);
852
+ if (p !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "checkbox", "html", "def", "paragraph", "text"].includes(l.type)) {
853
+ t += p || "";
854
+ continue;
855
+ }
856
+ }
857
+ let o = a;
858
+ switch (o.type) {
859
+ case "space": {
860
+ t += this.renderer.space(o);
861
+ break;
862
+ }
863
+ case "hr": {
864
+ t += this.renderer.hr(o);
865
+ break;
866
+ }
867
+ case "heading": {
868
+ t += this.renderer.heading(o);
869
+ break;
870
+ }
871
+ case "code": {
872
+ t += this.renderer.code(o);
873
+ break;
874
+ }
875
+ case "table": {
876
+ t += this.renderer.table(o);
877
+ break;
878
+ }
879
+ case "blockquote": {
880
+ t += this.renderer.blockquote(o);
881
+ break;
882
+ }
883
+ case "list": {
884
+ t += this.renderer.list(o);
885
+ break;
886
+ }
887
+ case "checkbox": {
888
+ t += this.renderer.checkbox(o);
889
+ break;
890
+ }
891
+ case "html": {
892
+ t += this.renderer.html(o);
893
+ break;
894
+ }
895
+ case "def": {
896
+ t += this.renderer.def(o);
897
+ break;
898
+ }
899
+ case "paragraph": {
900
+ t += this.renderer.paragraph(o);
901
+ break;
902
+ }
903
+ case "text": {
904
+ t += this.renderer.text(o);
905
+ break;
906
+ }
907
+ default: {
908
+ let l = 'Token with "' + o.type + '" type was not found.';
909
+ if (this.options.silent) return console.error(l), "";
910
+ throw new Error(l);
911
+ }
912
+ }
913
+ }
914
+ return t;
915
+ }
916
+ parseInline(e, t = this.renderer) {
917
+ var s, i;
918
+ this.renderer.parser = this;
919
+ let n = "";
920
+ for (let a = 0; a < e.length; a++) {
921
+ let o = e[a];
922
+ if ((i = (s = this.options.extensions) == null ? void 0 : s.renderers) != null && i[o.type]) {
923
+ let p = this.options.extensions.renderers[o.type].call({ parser: this }, o);
924
+ if (p !== !1 || !["escape", "html", "link", "image", "checkbox", "strong", "em", "codespan", "br", "del", "text"].includes(o.type)) {
925
+ n += p || "";
926
+ continue;
927
+ }
928
+ }
929
+ let l = o;
930
+ switch (l.type) {
931
+ case "escape": {
932
+ n += t.text(l);
933
+ break;
934
+ }
935
+ case "html": {
936
+ n += t.html(l);
937
+ break;
938
+ }
939
+ case "link": {
940
+ n += t.link(l);
941
+ break;
942
+ }
943
+ case "image": {
944
+ n += t.image(l);
945
+ break;
946
+ }
947
+ case "checkbox": {
948
+ n += t.checkbox(l);
949
+ break;
950
+ }
951
+ case "strong": {
952
+ n += t.strong(l);
953
+ break;
954
+ }
955
+ case "em": {
956
+ n += t.em(l);
957
+ break;
958
+ }
959
+ case "codespan": {
960
+ n += t.codespan(l);
961
+ break;
962
+ }
963
+ case "br": {
964
+ n += t.br(l);
965
+ break;
966
+ }
967
+ case "del": {
968
+ n += t.del(l);
969
+ break;
970
+ }
971
+ case "text": {
972
+ n += t.text(l);
973
+ break;
974
+ }
975
+ default: {
976
+ let p = 'Token with "' + l.type + '" type was not found.';
977
+ if (this.options.silent) return console.error(p), "";
978
+ throw new Error(p);
979
+ }
980
+ }
981
+ }
982
+ return n;
983
+ }
984
+ }, Z, B = (Z = class {
985
+ constructor(r) {
986
+ f(this, "options");
987
+ f(this, "block");
988
+ this.options = r || A;
989
+ }
990
+ preprocess(r) {
991
+ return r;
992
+ }
993
+ postprocess(r) {
994
+ return r;
995
+ }
996
+ processAllTokens(r) {
997
+ return r;
998
+ }
999
+ emStrongMask(r) {
1000
+ return r;
1001
+ }
1002
+ provideLexer(r = this.block) {
1003
+ return r ? $.lex : $.lexInline;
1004
+ }
1005
+ provideParser(r = this.block) {
1006
+ return r ? S.parse : S.parseInline;
1007
+ }
1008
+ }, f(Z, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), f(Z, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), Z), bt = class {
1009
+ constructor(...r) {
1010
+ f(this, "defaults", U());
1011
+ f(this, "options", this.setOptions);
1012
+ f(this, "parse", this.parseMarkdown(!0));
1013
+ f(this, "parseInline", this.parseMarkdown(!1));
1014
+ f(this, "Parser", S);
1015
+ f(this, "Renderer", M);
1016
+ f(this, "TextRenderer", ee);
1017
+ f(this, "Lexer", $);
1018
+ f(this, "Tokenizer", Q);
1019
+ f(this, "Hooks", B);
1020
+ this.use(...r);
1021
+ }
1022
+ walkTokens(r, e) {
1023
+ var n, s;
1024
+ let t = [];
1025
+ for (let i of r) switch (t = t.concat(e.call(this, i)), i.type) {
1026
+ case "table": {
1027
+ let a = i;
1028
+ for (let o of a.header) t = t.concat(this.walkTokens(o.tokens, e));
1029
+ for (let o of a.rows) for (let l of o) t = t.concat(this.walkTokens(l.tokens, e));
1030
+ break;
1031
+ }
1032
+ case "list": {
1033
+ let a = i;
1034
+ t = t.concat(this.walkTokens(a.items, e));
1035
+ break;
1036
+ }
1037
+ default: {
1038
+ let a = i;
1039
+ (s = (n = this.defaults.extensions) == null ? void 0 : n.childTokens) != null && s[a.type] ? this.defaults.extensions.childTokens[a.type].forEach((o) => {
1040
+ let l = a[o].flat(1 / 0);
1041
+ t = t.concat(this.walkTokens(l, e));
1042
+ }) : a.tokens && (t = t.concat(this.walkTokens(a.tokens, e)));
1043
+ }
1044
+ }
1045
+ return t;
1046
+ }
1047
+ use(...r) {
1048
+ let e = this.defaults.extensions || { renderers: {}, childTokens: {} };
1049
+ return r.forEach((t) => {
1050
+ let n = { ...t };
1051
+ if (n.async = this.defaults.async || n.async || !1, t.extensions && (t.extensions.forEach((s) => {
1052
+ if (!s.name) throw new Error("extension name required");
1053
+ if ("renderer" in s) {
1054
+ let i = e.renderers[s.name];
1055
+ i ? e.renderers[s.name] = function(...a) {
1056
+ let o = s.renderer.apply(this, a);
1057
+ return o === !1 && (o = i.apply(this, a)), o;
1058
+ } : e.renderers[s.name] = s.renderer;
1059
+ }
1060
+ if ("tokenizer" in s) {
1061
+ if (!s.level || s.level !== "block" && s.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
1062
+ let i = e[s.level];
1063
+ i ? i.unshift(s.tokenizer) : e[s.level] = [s.tokenizer], s.start && (s.level === "block" ? e.startBlock ? e.startBlock.push(s.start) : e.startBlock = [s.start] : s.level === "inline" && (e.startInline ? e.startInline.push(s.start) : e.startInline = [s.start]));
1064
+ }
1065
+ "childTokens" in s && s.childTokens && (e.childTokens[s.name] = s.childTokens);
1066
+ }), n.extensions = e), t.renderer) {
1067
+ let s = this.defaults.renderer || new M(this.defaults);
1068
+ for (let i in t.renderer) {
1069
+ if (!(i in s)) throw new Error(`renderer '${i}' does not exist`);
1070
+ if (["options", "parser"].includes(i)) continue;
1071
+ let a = i, o = t.renderer[a], l = s[a];
1072
+ s[a] = (...p) => {
1073
+ let c = o.apply(s, p);
1074
+ return c === !1 && (c = l.apply(s, p)), c || "";
1075
+ };
1076
+ }
1077
+ n.renderer = s;
1078
+ }
1079
+ if (t.tokenizer) {
1080
+ let s = this.defaults.tokenizer || new Q(this.defaults);
1081
+ for (let i in t.tokenizer) {
1082
+ if (!(i in s)) throw new Error(`tokenizer '${i}' does not exist`);
1083
+ if (["options", "rules", "lexer"].includes(i)) continue;
1084
+ let a = i, o = t.tokenizer[a], l = s[a];
1085
+ s[a] = (...p) => {
1086
+ let c = o.apply(s, p);
1087
+ return c === !1 && (c = l.apply(s, p)), c;
1088
+ };
1089
+ }
1090
+ n.tokenizer = s;
1091
+ }
1092
+ if (t.hooks) {
1093
+ let s = this.defaults.hooks || new B();
1094
+ for (let i in t.hooks) {
1095
+ if (!(i in s)) throw new Error(`hook '${i}' does not exist`);
1096
+ if (["options", "block"].includes(i)) continue;
1097
+ let a = i, o = t.hooks[a], l = s[a];
1098
+ B.passThroughHooks.has(i) ? s[a] = (p) => {
1099
+ if (this.defaults.async && B.passThroughHooksRespectAsync.has(i)) return (async () => {
1100
+ let g = await o.call(s, p);
1101
+ return l.call(s, g);
1102
+ })();
1103
+ let c = o.call(s, p);
1104
+ return l.call(s, c);
1105
+ } : s[a] = (...p) => {
1106
+ if (this.defaults.async) return (async () => {
1107
+ let g = await o.apply(s, p);
1108
+ return g === !1 && (g = await l.apply(s, p)), g;
1109
+ })();
1110
+ let c = o.apply(s, p);
1111
+ return c === !1 && (c = l.apply(s, p)), c;
1112
+ };
1113
+ }
1114
+ n.hooks = s;
1115
+ }
1116
+ if (t.walkTokens) {
1117
+ let s = this.defaults.walkTokens, i = t.walkTokens;
1118
+ n.walkTokens = function(a) {
1119
+ let o = [];
1120
+ return o.push(i.call(this, a)), s && (o = o.concat(s.call(this, a))), o;
1121
+ };
1122
+ }
1123
+ this.defaults = { ...this.defaults, ...n };
1124
+ }), this;
1125
+ }
1126
+ setOptions(r) {
1127
+ return this.defaults = { ...this.defaults, ...r }, this;
1128
+ }
1129
+ lexer(r, e) {
1130
+ return $.lex(r, e ?? this.defaults);
1131
+ }
1132
+ parser(r, e) {
1133
+ return S.parse(r, e ?? this.defaults);
1134
+ }
1135
+ parseMarkdown(r) {
1136
+ return (e, t) => {
1137
+ let n = { ...t }, s = { ...this.defaults, ...n }, i = this.onError(!!s.silent, !!s.async);
1138
+ if (this.defaults.async === !0 && n.async === !1) return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
1139
+ if (typeof e > "u" || e === null) return i(new Error("marked(): input parameter is undefined or null"));
1140
+ if (typeof e != "string") return i(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(e) + ", string expected"));
1141
+ if (s.hooks && (s.hooks.options = s, s.hooks.block = r), s.async) return (async () => {
1142
+ let a = s.hooks ? await s.hooks.preprocess(e) : e, o = await (s.hooks ? await s.hooks.provideLexer(r) : r ? $.lex : $.lexInline)(a, s), l = s.hooks ? await s.hooks.processAllTokens(o) : o;
1143
+ s.walkTokens && await Promise.all(this.walkTokens(l, s.walkTokens));
1144
+ let p = await (s.hooks ? await s.hooks.provideParser(r) : r ? S.parse : S.parseInline)(l, s);
1145
+ return s.hooks ? await s.hooks.postprocess(p) : p;
1146
+ })().catch(i);
1147
+ try {
1148
+ s.hooks && (e = s.hooks.preprocess(e));
1149
+ let a = (s.hooks ? s.hooks.provideLexer(r) : r ? $.lex : $.lexInline)(e, s);
1150
+ s.hooks && (a = s.hooks.processAllTokens(a)), s.walkTokens && this.walkTokens(a, s.walkTokens);
1151
+ let o = (s.hooks ? s.hooks.provideParser(r) : r ? S.parse : S.parseInline)(a, s);
1152
+ return s.hooks && (o = s.hooks.postprocess(o)), o;
1153
+ } catch (a) {
1154
+ return i(a);
1155
+ }
1156
+ };
1157
+ }
1158
+ onError(r, e) {
1159
+ return (t) => {
1160
+ if (t.message += `
1161
+ Please report this to https://github.com/markedjs/marked.`, r) {
1162
+ let n = "<p>An error occurred:</p><pre>" + y(t.message + "", !0) + "</pre>";
1163
+ return e ? Promise.resolve(n) : n;
1164
+ }
1165
+ if (e) return Promise.reject(t);
1166
+ throw t;
1167
+ };
1168
+ }
1169
+ }, z = new bt();
1170
+ function d(r, e) {
1171
+ return z.parse(r, e);
1172
+ }
1173
+ d.options = d.setOptions = function(r) {
1174
+ return z.setOptions(r), d.defaults = z.defaults, ce(d.defaults), d;
1175
+ };
1176
+ d.getDefaults = U;
1177
+ d.defaults = A;
1178
+ function wt(...r) {
1179
+ return z.use(...r), d.defaults = z.defaults, ce(d.defaults), d;
1180
+ }
1181
+ d.use = wt;
1182
+ d.walkTokens = function(r, e) {
1183
+ return z.walkTokens(r, e);
1184
+ };
1185
+ d.parseInline = z.parseInline;
1186
+ d.Parser = S;
1187
+ d.parser = S.parse;
1188
+ d.Renderer = M;
1189
+ d.TextRenderer = ee;
1190
+ d.Lexer = $;
1191
+ d.lexer = $.lex;
1192
+ d.Tokenizer = Q;
1193
+ d.Hooks = B;
1194
+ d.parse = d;
1195
+ var $t = d.options, St = d.setOptions, yt = d.walkTokens, Rt = d.parseInline, Tt = d, _t = S.parse, zt = $.lex;
1196
+ export {
1197
+ B as Hooks,
1198
+ $ as Lexer,
1199
+ bt as Marked,
1200
+ S as Parser,
1201
+ M as Renderer,
1202
+ ee as TextRenderer,
1203
+ Q as Tokenizer,
1204
+ A as defaults,
1205
+ U as getDefaults,
1206
+ zt as lexer,
1207
+ d as marked,
1208
+ $t as options,
1209
+ Tt as parse,
1210
+ Rt as parseInline,
1211
+ _t as parser,
1212
+ St as setOptions,
1213
+ wt as use,
1214
+ yt as walkTokens
1215
+ };