@arcgis/coding-components 5.1.0-next.80 → 5.1.0-next.81

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