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