var me = Object.defineProperty;
var ye = (t, e, r) => e in t ? me(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
var d = (t, e, r) => ye(t, typeof e != "symbol" ? e + "" : e, r);
function G() {
  return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
}
var T = G();
function oe(t) {
  T = t;
}
var I = { exec: () => null };
function f(t, e = "") {
  let r = typeof t == "string" ? t : t.source, s = { replace: (n, i) => {
    let o = typeof i == "string" ? i : i.source;
    return o = o.replace(w.caret, "$1"), r = r.replace(n, o), s;
  }, getRegex: () => new RegExp(r, e) };
  return s;
}
var $e = (() => {
  try {
    return !!new RegExp("(?<=1)(?<!1)");
  } catch {
    return !1;
  }
})(), w = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceTabs: /^\t+/, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] /, listReplaceTask: /^\[[ xX]\] +/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (t) => new RegExp(`^( {0,3}${t})((?:[	 ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ 	][^\\n]*)?(?:\\n|$))`), hrRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}#`), htmlBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}<(?:[a-z].*>|!--)`, "i") }, Re = /^(?:[ \t]*(?:\n|$))+/, Se = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Te = /^ {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+|$)/, ze = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, F = /(?:[*+-]|\d{1,9}[.)])/, ce = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, he = f(ce).replace(/bull/g, F).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(), Ae = f(ce).replace(/bull/g, F).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(), W = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, _e = /^[^\n]+/, X = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Pe = f(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", X).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Ie = f(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, F).getRegex(), M = "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", U = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Le = f("^ {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", U).replace("tag", M).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), pe = f(W).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[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", M).getRegex(), ve = f(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", pe).getRegex(), J = { blockquote: ve, code: Se, def: Pe, fences: Te, heading: ze, hr: L, html: Le, lheading: he, list: Ie, newline: Re, paragraph: pe, table: I, text: _e }, re = f("^ *([^\\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[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", M).getRegex(), Be = { ...J, lheading: Ae, table: re, paragraph: f(W).replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", re).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", M).getRegex() }, Ce = { ...J, html: f(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", U).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: I, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: f(W).replace("hr", L).replace("heading", ` *#{1,6} *[^
]`).replace("lheading", he).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Ee = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, qe = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ue = /^( {2,}|\\)\n(?!\s*$)/, Ze = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, O = /[\p{P}\p{S}]/u, K = /[\s\p{P}\p{S}]/u, ge = /[^\s\p{P}\p{S}]/u, De = f(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, K).getRegex(), ke = /(?!~)[\p{P}\p{S}]/u, Me = /(?!~)[\s\p{P}\p{S}]/u, Oe = /(?:[^\s\p{P}\p{S}]|~)/u, He = f(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", $e ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), fe = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, Qe = f(fe, "u").replace(/punct/g, O).getRegex(), Ne = f(fe, "u").replace(/punct/g, ke).getRegex(), de = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", je = f(de, "gu").replace(/notPunctSpace/g, ge).replace(/punctSpace/g, K).replace(/punct/g, O).getRegex(), Ge = f(de, "gu").replace(/notPunctSpace/g, Oe).replace(/punctSpace/g, Me).replace(/punct/g, ke).getRegex(), Fe = f("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, ge).replace(/punctSpace/g, K).replace(/punct/g, O).getRegex(), We = f(/\\(punct)/, "gu").replace(/punct/g, O).getRegex(), Xe = f(/^<(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(), Ue = f(U).replace("(?:-->|$)", "-->").getRegex(), Je = f("^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", Ue).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), q = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, Ke = f(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), xe = f(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", X).getRegex(), be = f(/^!?\[(ref)\](?:\[\])?/).replace("ref", X).getRegex(), Ve = f("reflink|nolink(?!\\()", "g").replace("reflink", xe).replace("nolink", be).getRegex(), ne = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, V = { _backpedal: I, anyPunctuation: We, autolink: Xe, blockSkip: He, br: ue, code: qe, del: I, emStrongLDelim: Qe, emStrongRDelimAst: je, emStrongRDelimUnd: Fe, escape: Ee, link: Ke, nolink: be, punctuation: De, reflink: xe, reflinkSearch: Ve, tag: Je, text: Ze, url: I }, Ye = { ...V, link: f(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(), reflink: f(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex() }, Q = { ...V, emStrongRDelimAst: Ge, emStrongLDelim: Ne, url: f(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ne).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: f(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ne).getRegex() }, et = { ...Q, br: f(ue).replace("{2,}", "*").getRegex(), text: f(Q.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, C = { normal: J, gfm: Be, pedantic: Ce }, A = { normal: V, gfm: Q, breaks: et, pedantic: Ye }, tt = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }, se = (t) => tt[t];
function $(t, e) {
  if (e) {
    if (w.escapeTest.test(t)) return t.replace(w.escapeReplace, se);
  } else if (w.escapeTestNoEncode.test(t)) return t.replace(w.escapeReplaceNoEncode, se);
  return t;
}
function le(t) {
  try {
    t = encodeURI(t).replace(w.percentDecode, "%");
  } catch {
    return null;
  }
  return t;
}
function ie(t, e) {
  var i;
  let r = t.replace(w.findPipe, (o, l, c) => {
    let a = !1, p = l;
    for (; --p >= 0 && c[p] === "\\"; ) a = !a;
    return a ? "|" : " |";
  }), s = r.split(w.splitPipe), n = 0;
  if (s[0].trim() || s.shift(), s.length > 0 && !((i = s.at(-1)) != null && i.trim()) && s.pop(), e) if (s.length > e) s.splice(e);
  else for (; s.length < e; ) s.push("");
  for (; n < s.length; n++) s[n] = s[n].trim().replace(w.slashPipe, "|");
  return s;
}
function _(t, e, r) {
  let s = t.length;
  if (s === 0) return "";
  let n = 0;
  for (; n < s && t.charAt(s - n - 1) === e; )
    n++;
  return t.slice(0, s - n);
}
function rt(t, e) {
  if (t.indexOf(e[1]) === -1) return -1;
  let r = 0;
  for (let s = 0; s < t.length; s++) if (t[s] === "\\") s++;
  else if (t[s] === e[0]) r++;
  else if (t[s] === e[1] && (r--, r < 0)) return s;
  return r > 0 ? -2 : -1;
}
function ae(t, e, r, s, n) {
  let i = e.href, o = e.title || null, l = t[1].replace(n.other.outputLinkReplace, "$1");
  s.state.inLink = !0;
  let c = { type: t[0].charAt(0) === "!" ? "image" : "link", raw: r, href: i, title: o, text: l, tokens: s.inlineTokens(l) };
  return s.state.inLink = !1, c;
}
function nt(t, e, r) {
  let s = t.match(r.other.indentCodeCompensation);
  if (s === null) return e;
  let n = s[1];
  return e.split(`
`).map((i) => {
    let o = i.match(r.other.beginningSpace);
    if (o === null) return i;
    let [l] = o;
    return l.length >= n.length ? i.slice(n.length) : i;
  }).join(`
`);
}
var Z = class {
  constructor(t) {
    d(this, "options");
    d(this, "rules");
    d(this, "lexer");
    this.options = t || T;
  }
  space(t) {
    let e = this.rules.block.newline.exec(t);
    if (e && e[0].length > 0) return { type: "space", raw: e[0] };
  }
  code(t) {
    let e = this.rules.block.code.exec(t);
    if (e) {
      let r = e[0].replace(this.rules.other.codeRemoveIndent, "");
      return { type: "code", raw: e[0], codeBlockStyle: "indented", text: this.options.pedantic ? r : _(r, `
`) };
    }
  }
  fences(t) {
    let e = this.rules.block.fences.exec(t);
    if (e) {
      let r = e[0], s = nt(r, e[3] || "", this.rules);
      return { type: "code", raw: r, lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2], text: s };
    }
  }
  heading(t) {
    let e = this.rules.block.heading.exec(t);
    if (e) {
      let r = e[2].trim();
      if (this.rules.other.endingHash.test(r)) {
        let s = _(r, "#");
        (this.options.pedantic || !s || this.rules.other.endingSpaceChar.test(s)) && (r = s.trim());
      }
      return { type: "heading", raw: e[0], depth: e[1].length, text: r, tokens: this.lexer.inline(r) };
    }
  }
  hr(t) {
    let e = this.rules.block.hr.exec(t);
    if (e) return { type: "hr", raw: _(e[0], `
`) };
  }
  blockquote(t) {
    let e = this.rules.block.blockquote.exec(t);
    if (e) {
      let r = _(e[0], `
`).split(`
`), s = "", n = "", i = [];
      for (; r.length > 0; ) {
        let o = !1, l = [], c;
        for (c = 0; c < r.length; c++) if (this.rules.other.blockquoteStart.test(r[c])) l.push(r[c]), o = !0;
        else if (!o) l.push(r[c]);
        else break;
        r = r.slice(c);
        let a = l.join(`
`), p = a.replace(this.rules.other.blockquoteSetextReplace, `
    $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
        s = s ? `${s}
${a}` : a, n = n ? `${n}
${p}` : p;
        let k = this.lexer.state.top;
        if (this.lexer.state.top = !0, this.lexer.blockTokens(p, i, !0), this.lexer.state.top = k, r.length === 0) break;
        let u = i.at(-1);
        if ((u == null ? void 0 : u.type) === "code") break;
        if ((u == null ? void 0 : u.type) === "blockquote") {
          let h = u, b = h.raw + `
` + r.join(`
`), g = this.blockquote(b);
          i[i.length - 1] = g, s = s.substring(0, s.length - h.raw.length) + g.raw, n = n.substring(0, n.length - h.text.length) + g.text;
          break;
        } else if ((u == null ? void 0 : u.type) === "list") {
          let h = u, b = h.raw + `
` + r.join(`
`), g = this.list(b);
          i[i.length - 1] = g, s = s.substring(0, s.length - u.raw.length) + g.raw, n = n.substring(0, n.length - h.raw.length) + g.raw, r = b.substring(i.at(-1).raw.length).split(`
`);
          continue;
        }
      }
      return { type: "blockquote", raw: s, tokens: i, text: n };
    }
  }
  list(t) {
    let e = this.rules.block.list.exec(t);
    if (e) {
      let r = e[1].trim(), s = r.length > 1, n = { type: "list", raw: "", ordered: s, start: s ? +r.slice(0, -1) : "", loose: !1, items: [] };
      r = s ? `\\d{1,9}\\${r.slice(-1)}` : `\\${r}`, this.options.pedantic && (r = s ? r : "[*+-]");
      let i = this.rules.other.listItemRegex(r), o = !1;
      for (; t; ) {
        let c = !1, a = "", p = "";
        if (!(e = i.exec(t)) || this.rules.block.hr.test(t)) break;
        a = e[0], t = t.substring(a.length);
        let k = e[2].split(`
`, 1)[0].replace(this.rules.other.listReplaceTabs, (R) => " ".repeat(3 * R.length)), u = t.split(`
`, 1)[0], h = !k.trim(), b = 0;
        if (this.options.pedantic ? (b = 2, p = k.trimStart()) : h ? b = e[1].length + 1 : (b = e[2].search(this.rules.other.nonSpaceChar), b = b > 4 ? 1 : b, p = k.slice(b), b += e[1].length), h && this.rules.other.blankLine.test(u) && (a += u + `
`, t = t.substring(u.length + 1), c = !0), !c) {
          let R = this.rules.other.nextBulletRegex(b), B = this.rules.other.hrRegex(b), ee = this.rules.other.fencesBeginRegex(b), te = this.rules.other.headingBeginRegex(b), we = this.rules.other.htmlBeginRegex(b);
          for (; t; ) {
            let H = t.split(`
`, 1)[0], z;
            if (u = H, this.options.pedantic ? (u = u.replace(this.rules.other.listReplaceNesting, "  "), z = u) : z = u.replace(this.rules.other.tabCharGlobal, "    "), ee.test(u) || te.test(u) || we.test(u) || R.test(u) || B.test(u)) break;
            if (z.search(this.rules.other.nonSpaceChar) >= b || !u.trim()) p += `
` + z.slice(b);
            else {
              if (h || k.replace(this.rules.other.tabCharGlobal, "    ").search(this.rules.other.nonSpaceChar) >= 4 || ee.test(k) || te.test(k) || B.test(k)) break;
              p += `
` + u;
            }
            !h && !u.trim() && (h = !0), a += H + `
`, t = t.substring(H.length + 1), k = z.slice(b);
          }
        }
        n.loose || (o ? n.loose = !0 : this.rules.other.doubleBlankLine.test(a) && (o = !0));
        let g = null, v;
        this.options.gfm && (g = this.rules.other.listIsTask.exec(p), g && (v = g[0] !== "[ ] ", p = p.replace(this.rules.other.listReplaceTask, ""))), n.items.push({ type: "list_item", raw: a, task: !!g, checked: v, loose: !1, text: p, tokens: [] }), n.raw += a;
      }
      let l = n.items.at(-1);
      if (l) l.raw = l.raw.trimEnd(), l.text = l.text.trimEnd();
      else return;
      n.raw = n.raw.trimEnd();
      for (let c = 0; c < n.items.length; c++) if (this.lexer.state.top = !1, n.items[c].tokens = this.lexer.blockTokens(n.items[c].text, []), !n.loose) {
        let a = n.items[c].tokens.filter((k) => k.type === "space"), p = a.length > 0 && a.some((k) => this.rules.other.anyLine.test(k.raw));
        n.loose = p;
      }
      if (n.loose) for (let c = 0; c < n.items.length; c++) n.items[c].loose = !0;
      return n;
    }
  }
  html(t) {
    let e = this.rules.block.html.exec(t);
    if (e) return { type: "html", block: !0, raw: e[0], pre: e[1] === "pre" || e[1] === "script" || e[1] === "style", text: e[0] };
  }
  def(t) {
    let e = this.rules.block.def.exec(t);
    if (e) {
      let r = e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), s = e[2] ? e[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", n = e[3] ? e[3].substring(1, e[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : e[3];
      return { type: "def", tag: r, raw: e[0], href: s, title: n };
    }
  }
  table(t) {
    var o;
    let e = this.rules.block.table.exec(t);
    if (!e || !this.rules.other.tableDelimiter.test(e[2])) return;
    let r = ie(e[1]), s = e[2].replace(this.rules.other.tableAlignChars, "").split("|"), n = (o = e[3]) != null && o.trim() ? e[3].replace(this.rules.other.tableRowBlankLine, "").split(`
`) : [], i = { type: "table", raw: e[0], header: [], align: [], rows: [] };
    if (r.length === s.length) {
      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);
      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] });
      for (let l of n) i.rows.push(ie(l, i.header.length).map((c, a) => ({ text: c, tokens: this.lexer.inline(c), header: !1, align: i.align[a] })));
      return i;
    }
  }
  lheading(t) {
    let e = this.rules.block.lheading.exec(t);
    if (e) return { type: "heading", raw: e[0], depth: e[2].charAt(0) === "=" ? 1 : 2, text: e[1], tokens: this.lexer.inline(e[1]) };
  }
  paragraph(t) {
    let e = this.rules.block.paragraph.exec(t);
    if (e) {
      let r = e[1].charAt(e[1].length - 1) === `
` ? e[1].slice(0, -1) : e[1];
      return { type: "paragraph", raw: e[0], text: r, tokens: this.lexer.inline(r) };
    }
  }
  text(t) {
    let e = this.rules.block.text.exec(t);
    if (e) return { type: "text", raw: e[0], text: e[0], tokens: this.lexer.inline(e[0]) };
  }
  escape(t) {
    let e = this.rules.inline.escape.exec(t);
    if (e) return { type: "escape", raw: e[0], text: e[1] };
  }
  tag(t) {
    let e = this.rules.inline.tag.exec(t);
    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] };
  }
  link(t) {
    let e = this.rules.inline.link.exec(t);
    if (e) {
      let r = e[2].trim();
      if (!this.options.pedantic && this.rules.other.startAngleBracket.test(r)) {
        if (!this.rules.other.endAngleBracket.test(r)) return;
        let i = _(r.slice(0, -1), "\\");
        if ((r.length - i.length) % 2 === 0) return;
      } else {
        let i = rt(e[2], "()");
        if (i === -2) return;
        if (i > -1) {
          let o = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length + i;
          e[2] = e[2].substring(0, i), e[0] = e[0].substring(0, o).trim(), e[3] = "";
        }
      }
      let s = e[2], n = "";
      if (this.options.pedantic) {
        let i = this.rules.other.pedanticHrefTitle.exec(s);
        i && (s = i[1], n = i[3]);
      } else n = e[3] ? e[3].slice(1, -1) : "";
      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)), ae(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);
    }
  }
  reflink(t, e) {
    let r;
    if ((r = this.rules.inline.reflink.exec(t)) || (r = this.rules.inline.nolink.exec(t))) {
      let s = (r[2] || r[1]).replace(this.rules.other.multipleSpaceGlobal, " "), n = e[s.toLowerCase()];
      if (!n) {
        let i = r[0].charAt(0);
        return { type: "text", raw: i, text: i };
      }
      return ae(r, n, r[0], this.lexer, this.rules);
    }
  }
  emStrong(t, e, r = "") {
    let s = this.rules.inline.emStrongLDelim.exec(t);
    if (!(!s || s[3] && r.match(this.rules.other.unicodeAlphaNumeric)) && (!(s[1] || s[2]) || !r || this.rules.inline.punctuation.exec(r))) {
      let n = [...s[0]].length - 1, i, o, l = n, c = 0, a = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
      for (a.lastIndex = 0, e = e.slice(-1 * t.length + n); (s = a.exec(e)) != null; ) {
        if (i = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !i) continue;
        if (o = [...i].length, s[3] || s[4]) {
          l += o;
          continue;
        } else if ((s[5] || s[6]) && n % 3 && !((n + o) % 3)) {
          c += o;
          continue;
        }
        if (l -= o, l > 0) continue;
        o = Math.min(o, o + l + c);
        let p = [...s[0]][0].length, k = t.slice(0, n + s.index + p + o);
        if (Math.min(n, o) % 2) {
          let h = k.slice(1, -1);
          return { type: "em", raw: k, text: h, tokens: this.lexer.inlineTokens(h) };
        }
        let u = k.slice(2, -2);
        return { type: "strong", raw: k, text: u, tokens: this.lexer.inlineTokens(u) };
      }
    }
  }
  codespan(t) {
    let e = this.rules.inline.code.exec(t);
    if (e) {
      let r = e[2].replace(this.rules.other.newLineCharGlobal, " "), s = this.rules.other.nonSpaceChar.test(r), n = this.rules.other.startingSpaceChar.test(r) && this.rules.other.endingSpaceChar.test(r);
      return s && n && (r = r.substring(1, r.length - 1)), { type: "codespan", raw: e[0], text: r };
    }
  }
  br(t) {
    let e = this.rules.inline.br.exec(t);
    if (e) return { type: "br", raw: e[0] };
  }
  del(t) {
    let e = this.rules.inline.del.exec(t);
    if (e) return { type: "del", raw: e[0], text: e[2], tokens: this.lexer.inlineTokens(e[2]) };
  }
  autolink(t) {
    let e = this.rules.inline.autolink.exec(t);
    if (e) {
      let r, s;
      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 }] };
    }
  }
  url(t) {
    var r;
    let e;
    if (e = this.rules.inline.url.exec(t)) {
      let s, n;
      if (e[2] === "@") s = e[0], n = "mailto:" + s;
      else {
        let i;
        do
          i = e[0], e[0] = ((r = this.rules.inline._backpedal.exec(e[0])) == null ? void 0 : r[0]) ?? "";
        while (i !== e[0]);
        s = e[0], e[1] === "www." ? n = "http://" + e[0] : n = e[0];
      }
      return { type: "link", raw: e[0], text: s, href: n, tokens: [{ type: "text", raw: s, text: s }] };
    }
  }
  inlineText(t) {
    let e = this.rules.inline.text.exec(t);
    if (e) {
      let r = this.lexer.state.inRawBlock;
      return { type: "text", raw: e[0], text: e[0], escaped: r };
    }
  }
}, m = class N {
  constructor(e) {
    d(this, "tokens");
    d(this, "options");
    d(this, "state");
    d(this, "tokenizer");
    d(this, "inlineQueue");
    this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || T, this.options.tokenizer = this.options.tokenizer || new Z(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
    let r = { other: w, block: C.normal, inline: A.normal };
    this.options.pedantic ? (r.block = C.pedantic, r.inline = A.pedantic) : this.options.gfm && (r.block = C.gfm, this.options.breaks ? r.inline = A.breaks : r.inline = A.gfm), this.tokenizer.rules = r;
  }
  static get rules() {
    return { block: C, inline: A };
  }
  static lex(e, r) {
    return new N(r).lex(e);
  }
  static lexInline(e, r) {
    return new N(r).inlineTokens(e);
  }
  lex(e) {
    e = e.replace(w.carriageReturn, `
`), this.blockTokens(e, this.tokens);
    for (let r = 0; r < this.inlineQueue.length; r++) {
      let s = this.inlineQueue[r];
      this.inlineTokens(s.src, s.tokens);
    }
    return this.inlineQueue = [], this.tokens;
  }
  blockTokens(e, r = [], s = !1) {
    var n, i, o;
    for (this.options.pedantic && (e = e.replace(w.tabCharGlobal, "    ").replace(w.spaceLine, "")); e; ) {
      let l;
      if ((i = (n = this.options.extensions) == null ? void 0 : n.block) != null && i.some((a) => (l = a.call({ lexer: this }, e, r)) ? (e = e.substring(l.raw.length), r.push(l), !0) : !1)) continue;
      if (l = this.tokenizer.space(e)) {
        e = e.substring(l.raw.length);
        let a = r.at(-1);
        l.raw.length === 1 && a !== void 0 ? a.raw += `
` : r.push(l);
        continue;
      }
      if (l = this.tokenizer.code(e)) {
        e = e.substring(l.raw.length);
        let a = r.at(-1);
        (a == null ? void 0 : a.type) === "paragraph" || (a == null ? void 0 : a.type) === "text" ? (a.raw += (a.raw.endsWith(`
`) ? "" : `
`) + l.raw, a.text += `
` + l.text, this.inlineQueue.at(-1).src = a.text) : r.push(l);
        continue;
      }
      if (l = this.tokenizer.fences(e)) {
        e = e.substring(l.raw.length), r.push(l);
        continue;
      }
      if (l = this.tokenizer.heading(e)) {
        e = e.substring(l.raw.length), r.push(l);
        continue;
      }
      if (l = this.tokenizer.hr(e)) {
        e = e.substring(l.raw.length), r.push(l);
        continue;
      }
      if (l = this.tokenizer.blockquote(e)) {
        e = e.substring(l.raw.length), r.push(l);
        continue;
      }
      if (l = this.tokenizer.list(e)) {
        e = e.substring(l.raw.length), r.push(l);
        continue;
      }
      if (l = this.tokenizer.html(e)) {
        e = e.substring(l.raw.length), r.push(l);
        continue;
      }
      if (l = this.tokenizer.def(e)) {
        e = e.substring(l.raw.length);
        let a = r.at(-1);
        (a == null ? void 0 : a.type) === "paragraph" || (a == null ? void 0 : a.type) === "text" ? (a.raw += (a.raw.endsWith(`
`) ? "" : `
`) + l.raw, a.text += `
` + l.raw, this.inlineQueue.at(-1).src = a.text) : this.tokens.links[l.tag] || (this.tokens.links[l.tag] = { href: l.href, title: l.title }, r.push(l));
        continue;
      }
      if (l = this.tokenizer.table(e)) {
        e = e.substring(l.raw.length), r.push(l);
        continue;
      }
      if (l = this.tokenizer.lheading(e)) {
        e = e.substring(l.raw.length), r.push(l);
        continue;
      }
      let c = e;
      if ((o = this.options.extensions) != null && o.startBlock) {
        let a = 1 / 0, p = e.slice(1), k;
        this.options.extensions.startBlock.forEach((u) => {
          k = u.call({ lexer: this }, p), typeof k == "number" && k >= 0 && (a = Math.min(a, k));
        }), a < 1 / 0 && a >= 0 && (c = e.substring(0, a + 1));
      }
      if (this.state.top && (l = this.tokenizer.paragraph(c))) {
        let a = r.at(-1);
        s && (a == null ? void 0 : a.type) === "paragraph" ? (a.raw += (a.raw.endsWith(`
`) ? "" : `
`) + l.raw, a.text += `
` + l.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = a.text) : r.push(l), s = c.length !== e.length, e = e.substring(l.raw.length);
        continue;
      }
      if (l = this.tokenizer.text(e)) {
        e = e.substring(l.raw.length);
        let a = r.at(-1);
        (a == null ? void 0 : a.type) === "text" ? (a.raw += (a.raw.endsWith(`
`) ? "" : `
`) + l.raw, a.text += `
` + l.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = a.text) : r.push(l);
        continue;
      }
      if (e) {
        let a = "Infinite loop on byte: " + e.charCodeAt(0);
        if (this.options.silent) {
          console.error(a);
          break;
        } else throw new Error(a);
      }
    }
    return this.state.top = !0, r;
  }
  inline(e, r = []) {
    return this.inlineQueue.push({ src: e, tokens: r }), r;
  }
  inlineTokens(e, r = []) {
    var c, a, p, k, u;
    let s = e, n = null;
    if (this.tokens.links) {
      let h = Object.keys(this.tokens.links);
      if (h.length > 0) for (; (n = this.tokenizer.rules.inline.reflinkSearch.exec(s)) != null; ) h.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));
    }
    for (; (n = this.tokenizer.rules.inline.anyPunctuation.exec(s)) != null; ) s = s.slice(0, n.index) + "++" + s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
    let i;
    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);
    s = ((a = (c = this.options.hooks) == null ? void 0 : c.emStrongMask) == null ? void 0 : a.call({ lexer: this }, s)) ?? s;
    let o = !1, l = "";
    for (; e; ) {
      o || (l = ""), o = !1;
      let h;
      if ((k = (p = this.options.extensions) == null ? void 0 : p.inline) != null && k.some((g) => (h = g.call({ lexer: this }, e, r)) ? (e = e.substring(h.raw.length), r.push(h), !0) : !1)) continue;
      if (h = this.tokenizer.escape(e)) {
        e = e.substring(h.raw.length), r.push(h);
        continue;
      }
      if (h = this.tokenizer.tag(e)) {
        e = e.substring(h.raw.length), r.push(h);
        continue;
      }
      if (h = this.tokenizer.link(e)) {
        e = e.substring(h.raw.length), r.push(h);
        continue;
      }
      if (h = this.tokenizer.reflink(e, this.tokens.links)) {
        e = e.substring(h.raw.length);
        let g = r.at(-1);
        h.type === "text" && (g == null ? void 0 : g.type) === "text" ? (g.raw += h.raw, g.text += h.text) : r.push(h);
        continue;
      }
      if (h = this.tokenizer.emStrong(e, s, l)) {
        e = e.substring(h.raw.length), r.push(h);
        continue;
      }
      if (h = this.tokenizer.codespan(e)) {
        e = e.substring(h.raw.length), r.push(h);
        continue;
      }
      if (h = this.tokenizer.br(e)) {
        e = e.substring(h.raw.length), r.push(h);
        continue;
      }
      if (h = this.tokenizer.del(e)) {
        e = e.substring(h.raw.length), r.push(h);
        continue;
      }
      if (h = this.tokenizer.autolink(e)) {
        e = e.substring(h.raw.length), r.push(h);
        continue;
      }
      if (!this.state.inLink && (h = this.tokenizer.url(e))) {
        e = e.substring(h.raw.length), r.push(h);
        continue;
      }
      let b = e;
      if ((u = this.options.extensions) != null && u.startInline) {
        let g = 1 / 0, v = e.slice(1), R;
        this.options.extensions.startInline.forEach((B) => {
          R = B.call({ lexer: this }, v), typeof R == "number" && R >= 0 && (g = Math.min(g, R));
        }), g < 1 / 0 && g >= 0 && (b = e.substring(0, g + 1));
      }
      if (h = this.tokenizer.inlineText(b)) {
        e = e.substring(h.raw.length), h.raw.slice(-1) !== "_" && (l = h.raw.slice(-1)), o = !0;
        let g = r.at(-1);
        (g == null ? void 0 : g.type) === "text" ? (g.raw += h.raw, g.text += h.text) : r.push(h);
        continue;
      }
      if (e) {
        let g = "Infinite loop on byte: " + e.charCodeAt(0);
        if (this.options.silent) {
          console.error(g);
          break;
        } else throw new Error(g);
      }
    }
    return r;
  }
}, D = class {
  constructor(t) {
    d(this, "options");
    d(this, "parser");
    this.options = t || T;
  }
  space(t) {
    return "";
  }
  code({ text: t, lang: e, escaped: r }) {
    var i;
    let s = (i = (e || "").match(w.notSpaceStart)) == null ? void 0 : i[0], n = t.replace(w.endingNewline, "") + `
`;
    return s ? '<pre><code class="language-' + $(s) + '">' + (r ? n : $(n, !0)) + `</code></pre>
` : "<pre><code>" + (r ? n : $(n, !0)) + `</code></pre>
`;
  }
  blockquote({ tokens: t }) {
    return `<blockquote>
${this.parser.parse(t)}</blockquote>
`;
  }
  html({ text: t }) {
    return t;
  }
  def(t) {
    return "";
  }
  heading({ tokens: t, depth: e }) {
    return `<h${e}>${this.parser.parseInline(t)}</h${e}>
`;
  }
  hr(t) {
    return `<hr>
`;
  }
  list(t) {
    let e = t.ordered, r = t.start, s = "";
    for (let o = 0; o < t.items.length; o++) {
      let l = t.items[o];
      s += this.listitem(l);
    }
    let n = e ? "ol" : "ul", i = e && r !== 1 ? ' start="' + r + '"' : "";
    return "<" + n + i + `>
` + s + "</" + n + `>
`;
  }
  listitem(t) {
    var r;
    let e = "";
    if (t.task) {
      let s = this.checkbox({ checked: !!t.checked });
      t.loose ? ((r = t.tokens[0]) == null ? void 0 : r.type) === "paragraph" ? (t.tokens[0].text = s + " " + t.tokens[0].text, t.tokens[0].tokens && t.tokens[0].tokens.length > 0 && t.tokens[0].tokens[0].type === "text" && (t.tokens[0].tokens[0].text = s + " " + $(t.tokens[0].tokens[0].text), t.tokens[0].tokens[0].escaped = !0)) : t.tokens.unshift({ type: "text", raw: s + " ", text: s + " ", escaped: !0 }) : e += s + " ";
    }
    return e += this.parser.parse(t.tokens, !!t.loose), `<li>${e}</li>
`;
  }
  checkbox({ checked: t }) {
    return "<input " + (t ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
  }
  paragraph({ tokens: t }) {
    return `<p>${this.parser.parseInline(t)}</p>
`;
  }
  table(t) {
    let e = "", r = "";
    for (let n = 0; n < t.header.length; n++) r += this.tablecell(t.header[n]);
    e += this.tablerow({ text: r });
    let s = "";
    for (let n = 0; n < t.rows.length; n++) {
      let i = t.rows[n];
      r = "";
      for (let o = 0; o < i.length; o++) r += this.tablecell(i[o]);
      s += this.tablerow({ text: r });
    }
    return s && (s = `<tbody>${s}</tbody>`), `<table>
<thead>
` + e + `</thead>
` + s + `</table>
`;
  }
  tablerow({ text: t }) {
    return `<tr>
${t}</tr>
`;
  }
  tablecell(t) {
    let e = this.parser.parseInline(t.tokens), r = t.header ? "th" : "td";
    return (t.align ? `<${r} align="${t.align}">` : `<${r}>`) + e + `</${r}>
`;
  }
  strong({ tokens: t }) {
    return `<strong>${this.parser.parseInline(t)}</strong>`;
  }
  em({ tokens: t }) {
    return `<em>${this.parser.parseInline(t)}</em>`;
  }
  codespan({ text: t }) {
    return `<code>${$(t, !0)}</code>`;
  }
  br(t) {
    return "<br>";
  }
  del({ tokens: t }) {
    return `<del>${this.parser.parseInline(t)}</del>`;
  }
  link({ href: t, title: e, tokens: r }) {
    let s = this.parser.parseInline(r), n = le(t);
    if (n === null) return s;
    t = n;
    let i = '<a href="' + t + '"';
    return e && (i += ' title="' + $(e) + '"'), i += ">" + s + "</a>", i;
  }
  image({ href: t, title: e, text: r, tokens: s }) {
    s && (r = this.parser.parseInline(s, this.parser.textRenderer));
    let n = le(t);
    if (n === null) return $(r);
    t = n;
    let i = `<img src="${t}" alt="${r}"`;
    return e && (i += ` title="${$(e)}"`), i += ">", i;
  }
  text(t) {
    return "tokens" in t && t.tokens ? this.parser.parseInline(t.tokens) : "escaped" in t && t.escaped ? t.text : $(t.text);
  }
}, Y = class {
  strong({ text: t }) {
    return t;
  }
  em({ text: t }) {
    return t;
  }
  codespan({ text: t }) {
    return t;
  }
  del({ text: t }) {
    return t;
  }
  html({ text: t }) {
    return t;
  }
  text({ text: t }) {
    return t;
  }
  link({ text: t }) {
    return "" + t;
  }
  image({ text: t }) {
    return "" + t;
  }
  br() {
    return "";
  }
}, y = class j {
  constructor(e) {
    d(this, "options");
    d(this, "renderer");
    d(this, "textRenderer");
    this.options = e || T, this.options.renderer = this.options.renderer || new D(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new Y();
  }
  static parse(e, r) {
    return new j(r).parse(e);
  }
  static parseInline(e, r) {
    return new j(r).parseInline(e);
  }
  parse(e, r = !0) {
    var n, i;
    let s = "";
    for (let o = 0; o < e.length; o++) {
      let l = e[o];
      if ((i = (n = this.options.extensions) == null ? void 0 : n.renderers) != null && i[l.type]) {
        let a = l, p = this.options.extensions.renderers[a.type].call({ parser: this }, a);
        if (p !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(a.type)) {
          s += p || "";
          continue;
        }
      }
      let c = l;
      switch (c.type) {
        case "space": {
          s += this.renderer.space(c);
          continue;
        }
        case "hr": {
          s += this.renderer.hr(c);
          continue;
        }
        case "heading": {
          s += this.renderer.heading(c);
          continue;
        }
        case "code": {
          s += this.renderer.code(c);
          continue;
        }
        case "table": {
          s += this.renderer.table(c);
          continue;
        }
        case "blockquote": {
          s += this.renderer.blockquote(c);
          continue;
        }
        case "list": {
          s += this.renderer.list(c);
          continue;
        }
        case "html": {
          s += this.renderer.html(c);
          continue;
        }
        case "def": {
          s += this.renderer.def(c);
          continue;
        }
        case "paragraph": {
          s += this.renderer.paragraph(c);
          continue;
        }
        case "text": {
          let a = c, p = this.renderer.text(a);
          for (; o + 1 < e.length && e[o + 1].type === "text"; ) a = e[++o], p += `
` + this.renderer.text(a);
          r ? s += this.renderer.paragraph({ type: "paragraph", raw: p, text: p, tokens: [{ type: "text", raw: p, text: p, escaped: !0 }] }) : s += p;
          continue;
        }
        default: {
          let a = 'Token with "' + c.type + '" type was not found.';
          if (this.options.silent) return console.error(a), "";
          throw new Error(a);
        }
      }
    }
    return s;
  }
  parseInline(e, r = this.renderer) {
    var n, i;
    let s = "";
    for (let o = 0; o < e.length; o++) {
      let l = e[o];
      if ((i = (n = this.options.extensions) == null ? void 0 : n.renderers) != null && i[l.type]) {
        let a = this.options.extensions.renderers[l.type].call({ parser: this }, l);
        if (a !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(l.type)) {
          s += a || "";
          continue;
        }
      }
      let c = l;
      switch (c.type) {
        case "escape": {
          s += r.text(c);
          break;
        }
        case "html": {
          s += r.html(c);
          break;
        }
        case "link": {
          s += r.link(c);
          break;
        }
        case "image": {
          s += r.image(c);
          break;
        }
        case "strong": {
          s += r.strong(c);
          break;
        }
        case "em": {
          s += r.em(c);
          break;
        }
        case "codespan": {
          s += r.codespan(c);
          break;
        }
        case "br": {
          s += r.br(c);
          break;
        }
        case "del": {
          s += r.del(c);
          break;
        }
        case "text": {
          s += r.text(c);
          break;
        }
        default: {
          let a = 'Token with "' + c.type + '" type was not found.';
          if (this.options.silent) return console.error(a), "";
          throw new Error(a);
        }
      }
    }
    return s;
  }
}, E, P = (E = class {
  constructor(t) {
    d(this, "options");
    d(this, "block");
    this.options = t || T;
  }
  preprocess(t) {
    return t;
  }
  postprocess(t) {
    return t;
  }
  processAllTokens(t) {
    return t;
  }
  emStrongMask(t) {
    return t;
  }
  provideLexer() {
    return this.block ? m.lex : m.lexInline;
  }
  provideParser() {
    return this.block ? y.parse : y.parseInline;
  }
}, d(E, "passThroughHooks", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"])), d(E, "passThroughHooksRespectAsync", /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"])), E), st = class {
  constructor(...t) {
    d(this, "defaults", G());
    d(this, "options", this.setOptions);
    d(this, "parse", this.parseMarkdown(!0));
    d(this, "parseInline", this.parseMarkdown(!1));
    d(this, "Parser", y);
    d(this, "Renderer", D);
    d(this, "TextRenderer", Y);
    d(this, "Lexer", m);
    d(this, "Tokenizer", Z);
    d(this, "Hooks", P);
    this.use(...t);
  }
  walkTokens(t, e) {
    var s, n;
    let r = [];
    for (let i of t) switch (r = r.concat(e.call(this, i)), i.type) {
      case "table": {
        let o = i;
        for (let l of o.header) r = r.concat(this.walkTokens(l.tokens, e));
        for (let l of o.rows) for (let c of l) r = r.concat(this.walkTokens(c.tokens, e));
        break;
      }
      case "list": {
        let o = i;
        r = r.concat(this.walkTokens(o.items, e));
        break;
      }
      default: {
        let o = i;
        (n = (s = this.defaults.extensions) == null ? void 0 : s.childTokens) != null && n[o.type] ? this.defaults.extensions.childTokens[o.type].forEach((l) => {
          let c = o[l].flat(1 / 0);
          r = r.concat(this.walkTokens(c, e));
        }) : o.tokens && (r = r.concat(this.walkTokens(o.tokens, e)));
      }
    }
    return r;
  }
  use(...t) {
    let e = this.defaults.extensions || { renderers: {}, childTokens: {} };
    return t.forEach((r) => {
      let s = { ...r };
      if (s.async = this.defaults.async || s.async || !1, r.extensions && (r.extensions.forEach((n) => {
        if (!n.name) throw new Error("extension name required");
        if ("renderer" in n) {
          let i = e.renderers[n.name];
          i ? e.renderers[n.name] = function(...o) {
            let l = n.renderer.apply(this, o);
            return l === !1 && (l = i.apply(this, o)), l;
          } : e.renderers[n.name] = n.renderer;
        }
        if ("tokenizer" in n) {
          if (!n.level || n.level !== "block" && n.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
          let i = e[n.level];
          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]));
        }
        "childTokens" in n && n.childTokens && (e.childTokens[n.name] = n.childTokens);
      }), s.extensions = e), r.renderer) {
        let n = this.defaults.renderer || new D(this.defaults);
        for (let i in r.renderer) {
          if (!(i in n)) throw new Error(`renderer '${i}' does not exist`);
          if (["options", "parser"].includes(i)) continue;
          let o = i, l = r.renderer[o], c = n[o];
          n[o] = (...a) => {
            let p = l.apply(n, a);
            return p === !1 && (p = c.apply(n, a)), p || "";
          };
        }
        s.renderer = n;
      }
      if (r.tokenizer) {
        let n = this.defaults.tokenizer || new Z(this.defaults);
        for (let i in r.tokenizer) {
          if (!(i in n)) throw new Error(`tokenizer '${i}' does not exist`);
          if (["options", "rules", "lexer"].includes(i)) continue;
          let o = i, l = r.tokenizer[o], c = n[o];
          n[o] = (...a) => {
            let p = l.apply(n, a);
            return p === !1 && (p = c.apply(n, a)), p;
          };
        }
        s.tokenizer = n;
      }
      if (r.hooks) {
        let n = this.defaults.hooks || new P();
        for (let i in r.hooks) {
          if (!(i in n)) throw new Error(`hook '${i}' does not exist`);
          if (["options", "block"].includes(i)) continue;
          let o = i, l = r.hooks[o], c = n[o];
          P.passThroughHooks.has(i) ? n[o] = (a) => {
            if (this.defaults.async && P.passThroughHooksRespectAsync.has(i)) return (async () => {
              let k = await l.call(n, a);
              return c.call(n, k);
            })();
            let p = l.call(n, a);
            return c.call(n, p);
          } : n[o] = (...a) => {
            if (this.defaults.async) return (async () => {
              let k = await l.apply(n, a);
              return k === !1 && (k = await c.apply(n, a)), k;
            })();
            let p = l.apply(n, a);
            return p === !1 && (p = c.apply(n, a)), p;
          };
        }
        s.hooks = n;
      }
      if (r.walkTokens) {
        let n = this.defaults.walkTokens, i = r.walkTokens;
        s.walkTokens = function(o) {
          let l = [];
          return l.push(i.call(this, o)), n && (l = l.concat(n.call(this, o))), l;
        };
      }
      this.defaults = { ...this.defaults, ...s };
    }), this;
  }
  setOptions(t) {
    return this.defaults = { ...this.defaults, ...t }, this;
  }
  lexer(t, e) {
    return m.lex(t, e ?? this.defaults);
  }
  parser(t, e) {
    return y.parse(t, e ?? this.defaults);
  }
  parseMarkdown(t) {
    return (e, r) => {
      let s = { ...r }, n = { ...this.defaults, ...s }, i = this.onError(!!n.silent, !!n.async);
      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."));
      if (typeof e > "u" || e === null) return i(new Error("marked(): input parameter is undefined or null"));
      if (typeof e != "string") return i(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(e) + ", string expected"));
      if (n.hooks && (n.hooks.options = n, n.hooks.block = t), n.async) return (async () => {
        let o = n.hooks ? await n.hooks.preprocess(e) : e, l = await (n.hooks ? await n.hooks.provideLexer() : t ? m.lex : m.lexInline)(o, n), c = n.hooks ? await n.hooks.processAllTokens(l) : l;
        n.walkTokens && await Promise.all(this.walkTokens(c, n.walkTokens));
        let a = await (n.hooks ? await n.hooks.provideParser() : t ? y.parse : y.parseInline)(c, n);
        return n.hooks ? await n.hooks.postprocess(a) : a;
      })().catch(i);
      try {
        n.hooks && (e = n.hooks.preprocess(e));
        let o = (n.hooks ? n.hooks.provideLexer() : t ? m.lex : m.lexInline)(e, n);
        n.hooks && (o = n.hooks.processAllTokens(o)), n.walkTokens && this.walkTokens(o, n.walkTokens);
        let l = (n.hooks ? n.hooks.provideParser() : t ? y.parse : y.parseInline)(o, n);
        return n.hooks && (l = n.hooks.postprocess(l)), l;
      } catch (o) {
        return i(o);
      }
    };
  }
  onError(t, e) {
    return (r) => {
      if (r.message += `
Please report this to https://github.com/markedjs/marked.`, t) {
        let s = "<p>An error occurred:</p><pre>" + $(r.message + "", !0) + "</pre>";
        return e ? Promise.resolve(s) : s;
      }
      if (e) return Promise.reject(r);
      throw r;
    };
  }
}, S = new st();
function x(t, e) {
  return S.parse(t, e);
}
x.options = x.setOptions = function(t) {
  return S.setOptions(t), x.defaults = S.defaults, oe(x.defaults), x;
};
x.getDefaults = G;
x.defaults = T;
x.use = function(...t) {
  return S.use(...t), x.defaults = S.defaults, oe(x.defaults), x;
};
x.walkTokens = function(t, e) {
  return S.walkTokens(t, e);
};
x.parseInline = S.parseInline;
x.Parser = y;
x.parser = y.parse;
x.Renderer = D;
x.TextRenderer = Y;
x.Lexer = m;
x.lexer = m.lex;
x.Tokenizer = Z;
x.Hooks = P;
x.parse = x;
x.options;
x.setOptions;
x.use;
x.walkTokens;
x.parseInline;
y.parse;
m.lex;
export {
  P as Hooks,
  m as Lexer,
  st as Marked,
  y as Parser,
  D as Renderer,
  Y as TextRenderer,
  Z as Tokenizer,
  T as defaults,
  G as getDefaults,
  x as marked
};
