import { u as P } from "./vendor/recharts.js";
import { i as ge } from "./chunk-5PVQY5BW.js";
import { n as k, r as z } from "./chunk-AGHRB4JF.js";
import { L as ne, P as et, k as Ie, s as tt, y as ve } from "./chunk-ICPOFSXX.js";
var nt = Object.freeze({
  left: 0,
  top: 0,
  width: 16,
  height: 16
}), j = Object.freeze({
  rotate: 0,
  vFlip: !1,
  hFlip: !1
}), ze = Object.freeze({
  ...nt,
  ...j
}), rt = Object.freeze({
  ...ze,
  body: "",
  hidden: !1
}), st = Object.freeze({
  width: null,
  height: null
}), it = Object.freeze({
  ...st,
  ...j
}), lt = (n, e, r, s = "") => {
  const t = n.split(":");
  if (n.slice(0, 1) === "@") {
    if (t.length < 2 || t.length > 3) return null;
    s = t.shift().slice(1);
  }
  if (t.length > 3 || !t.length) return null;
  if (t.length > 1) {
    const a = t.pop(), o = t.pop(), p = {
      provider: t.length > 0 ? t[0] : s,
      prefix: o,
      name: a
    };
    return e && !U(p) ? null : p;
  }
  const l = t[0], i = l.split("-");
  if (i.length > 1) {
    const a = {
      provider: s,
      prefix: i.shift(),
      name: i.join("-")
    };
    return e && !U(a) ? null : a;
  }
  if (r && s === "") {
    const a = {
      provider: s,
      prefix: "",
      name: l
    };
    return e && !U(a, r) ? null : a;
  }
  return null;
}, U = (n, e) => n ? !!((e && n.prefix === "" || n.prefix) && n.name) : !1;
function at(n, e) {
  const r = {};
  !n.hFlip != !e.hFlip && (r.hFlip = !0), !n.vFlip != !e.vFlip && (r.vFlip = !0);
  const s = ((n.rotate || 0) + (e.rotate || 0)) % 4;
  return s && (r.rotate = s), r;
}
function fe(n, e) {
  const r = at(n, e);
  for (const s in rt) s in j ? s in n && !(s in r) && (r[s] = j[s]) : s in e ? r[s] = e[s] : s in n && (r[s] = n[s]);
  return r;
}
function ot(n, e) {
  const r = n.icons, s = n.aliases || /* @__PURE__ */ Object.create(null), t = /* @__PURE__ */ Object.create(null);
  function l(i) {
    if (r[i]) return t[i] = [];
    if (!(i in t)) {
      t[i] = null;
      const a = s[i] && s[i].parent, o = a && l(a);
      o && (t[i] = [a].concat(o));
    }
    return t[i];
  }
  return (e || Object.keys(r).concat(Object.keys(s))).forEach(l), t;
}
function de(n, e, r) {
  const s = n.icons, t = n.aliases || /* @__PURE__ */ Object.create(null);
  let l = {};
  function i(a) {
    l = fe(s[a] || t[a], l);
  }
  return i(e), r.forEach(i), fe(n, l);
}
function ct(n, e) {
  if (n.icons[e]) return de(n, e, []);
  const r = ot(n, [e])[e];
  return r ? de(n, e, r) : null;
}
var pt = /(-?[0-9.]*[0-9]+[0-9.]*)/g, ht = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
function ke(n, e, r) {
  if (e === 1) return n;
  if (r = r || 100, typeof n == "number") return Math.ceil(n * e * r) / r;
  if (typeof n != "string") return n;
  const s = n.split(pt);
  if (s === null || !s.length) return n;
  const t = [];
  let l = s.shift(), i = ht.test(l);
  for (; ; ) {
    if (i) {
      const a = parseFloat(l);
      isNaN(a) ? t.push(l) : t.push(Math.ceil(a * e * r) / r);
    } else t.push(l);
    if (l = s.shift(), l === void 0) return t.join("");
    i = !i;
  }
}
function ut(n, e = "defs") {
  let r = "";
  const s = n.indexOf("<" + e);
  for (; s >= 0; ) {
    const t = n.indexOf(">", s), l = n.indexOf("</" + e);
    if (t === -1 || l === -1) break;
    const i = n.indexOf(">", l);
    if (i === -1) break;
    r += n.slice(t + 1, l).trim(), n = n.slice(0, s).trim() + n.slice(i + 1);
  }
  return {
    defs: r,
    content: n
  };
}
function gt(n, e) {
  return n ? "<defs>" + n + "</defs>" + e : e;
}
function ft(n, e, r) {
  const s = ut(n);
  return gt(s.defs, e + s.content + r);
}
var dt = (n) => n === "unset" || n === "undefined" || n === "none";
function kt(n, e) {
  const r = {
    ...ze,
    ...n
  }, s = {
    ...it,
    ...e
  }, t = {
    left: r.left,
    top: r.top,
    width: r.width,
    height: r.height
  };
  let l = r.body;
  [r, s].forEach((b) => {
    const m = [], A = b.hFlip, E = b.vFlip;
    let S = b.rotate;
    A ? E ? S += 2 : (m.push("translate(" + (t.width + t.left).toString() + " " + (0 - t.top).toString() + ")"), m.push("scale(-1 1)"), t.top = t.left = 0) : E && (m.push("translate(" + (0 - t.left).toString() + " " + (t.height + t.top).toString() + ")"), m.push("scale(1 -1)"), t.top = t.left = 0);
    let y;
    switch (S < 0 && (S -= Math.floor(S / 4) * 4), S = S % 4, S) {
      case 1:
        y = t.height / 2 + t.top, m.unshift("rotate(90 " + y.toString() + " " + y.toString() + ")");
        break;
      case 2:
        m.unshift("rotate(180 " + (t.width / 2 + t.left).toString() + " " + (t.height / 2 + t.top).toString() + ")");
        break;
      case 3:
        y = t.width / 2 + t.left, m.unshift("rotate(-90 " + y.toString() + " " + y.toString() + ")");
        break;
    }
    S % 2 === 1 && (t.left !== t.top && (y = t.left, t.left = t.top, t.top = y), t.width !== t.height && (y = t.width, t.width = t.height, t.height = y)), m.length && (l = ft(l, '<g transform="' + m.join(" ") + '">', "</g>"));
  });
  const i = s.width, a = s.height, o = t.width, p = t.height;
  let c, h;
  i === null ? (h = a === null ? "1em" : a === "auto" ? p : a, c = ke(h, o / p)) : (c = i === "auto" ? o : i, h = a === null ? ke(c, p / o) : a === "auto" ? p : a);
  const u = {}, f = (b, m) => {
    dt(m) || (u[b] = m.toString());
  };
  f("width", c), f("height", h);
  const x = [
    t.left,
    t.top,
    o,
    p
  ];
  return u.viewBox = x.join(" "), {
    attributes: u,
    viewBox: x,
    body: l
  };
}
var xt = /\sid="(\S+)"/g, xe = /* @__PURE__ */ new Map();
function bt(n) {
  n = n.replace(/[0-9]+$/, "") || "a";
  const e = xe.get(n) || 0;
  return xe.set(n, e + 1), e ? `${n}${e}` : n;
}
function mt(n) {
  const e = [];
  let r;
  for (; r = xt.exec(n); ) e.push(r[1]);
  if (!e.length) return n;
  const s = "suffix" + (Math.random() * 16777216 | Date.now()).toString(16);
  return e.forEach((t) => {
    const l = bt(t), i = t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
    n = n.replace(new RegExp('([#;"])(' + i + ')([")]|\\.[a-z])', "g"), "$1" + l + s + "$3");
  }), n = n.replace(new RegExp(s, "g"), ""), n;
}
function wt(n, e) {
  let r = n.indexOf("xlink:") === -1 ? "" : ' xmlns:xlink="http://www.w3.org/1999/xlink"';
  for (const s in e) r += " " + s + '="' + e[s] + '"';
  return '<svg xmlns="http://www.w3.org/2000/svg"' + r + ">" + n + "</svg>";
}
function re() {
  return {
    async: !1,
    breaks: !1,
    extensions: null,
    gfm: !0,
    hooks: null,
    pedantic: !1,
    renderer: null,
    silent: !1,
    tokenizer: null,
    walkTokens: null
  };
}
var v = re();
function Ae(n) {
  v = n;
}
var M = { exec: () => null };
function g(n, e = "") {
  let r = typeof n == "string" ? n : n.source, s = {
    replace: (t, l) => {
      let i = typeof l == "string" ? l : l.source;
      return i = i.replace(w.caret, "$1"), r = r.replace(t, i), s;
    },
    getRegex: () => new RegExp(r, e)
  };
  return s;
}
var yt = (() => {
  try {
    return !0;
  } 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+));?/gi,
  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")
}, St = /^(?:[ \t]*(?:\n|$))+/, $t = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Tt = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, O = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Rt = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, se = /(?:[*+-]|\d{1,9}[.)])/, Ee = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, Le = g(Ee).replace(/bull/g, se).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(), It = g(Ee).replace(/bull/g, se).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(), ie = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, vt = /^[^\n]+/, le = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, zt = g(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", le).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), At = g(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, se).getRegex(), H = "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", ae = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Et = g("^ {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", ae).replace("tag", H).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), be = g(ie).replace("hr", O).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", H).getRegex(), oe = {
  blockquote: g(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", be).getRegex(),
  code: $t,
  def: zt,
  fences: Tt,
  heading: Rt,
  hr: O,
  html: Et,
  lheading: Le,
  list: At,
  newline: St,
  paragraph: be,
  table: M,
  text: vt
}, me = g("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", O).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", H).getRegex(), Lt = {
  ...oe,
  lheading: It,
  table: me,
  paragraph: g(ie).replace("hr", O).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", me).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", H).getRegex()
}, Pt = {
  ...oe,
  html: g(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", ae).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: M,
  lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
  paragraph: g(ie).replace("hr", O).replace("heading", ` *#{1,6} *[^
]`).replace("lheading", Le).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
}, _t = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ct = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, Pe = /^( {2,}|\\)\n(?!\s*$)/, Bt = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, G = /[\p{P}\p{S}]/u, ce = /[\s\p{P}\p{S}]/u, _e = /[^\s\p{P}\p{S}]/u, Mt = g(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, ce).getRegex(), Ce = /(?!~)[\p{P}\p{S}]/u, Ot = /(?!~)[\s\p{P}\p{S}]/u, Dt = /(?:[^\s\p{P}\p{S}]|~)/u, jt = g(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", yt ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), Be = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, qt = g(Be, "u").replace(/punct/g, G).getRegex(), Wt = g(Be, "u").replace(/punct/g, Ce).getRegex(), Me = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ft = g(Me, "gu").replace(/notPunctSpace/g, _e).replace(/punctSpace/g, ce).replace(/punct/g, G).getRegex(), Zt = g(Me, "gu").replace(/notPunctSpace/g, Dt).replace(/punctSpace/g, Ot).replace(/punct/g, Ce).getRegex(), Ht = g("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, _e).replace(/punctSpace/g, ce).replace(/punct/g, G).getRegex(), Gt = g(/\\(punct)/, "gu").replace(/punct/g, G).getRegex(), Nt = g(/^<(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(), Qt = g(ae).replace("(?:-->|$)", "-->").getRegex(), Vt = g("^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", Qt).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), q = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/, Ut = g(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Oe = g(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", le).getRegex(), De = g(/^!?\[(ref)\](?:\[\])?/).replace("ref", le).getRegex(), Kt = g("reflink|nolink(?!\\()", "g").replace("reflink", Oe).replace("nolink", De).getRegex(), we = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, pe = {
  _backpedal: M,
  anyPunctuation: Gt,
  autolink: Nt,
  blockSkip: jt,
  br: Pe,
  code: Ct,
  del: M,
  emStrongLDelim: qt,
  emStrongRDelimAst: Ft,
  emStrongRDelimUnd: Ht,
  escape: _t,
  link: Ut,
  nolink: De,
  punctuation: Mt,
  reflink: Oe,
  reflinkSearch: Kt,
  tag: Vt,
  text: Bt,
  url: M
}, Xt = {
  ...pe,
  link: g(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(),
  reflink: g(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex()
}, K = {
  ...pe,
  emStrongRDelimAst: Zt,
  emStrongLDelim: Wt,
  url: g(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", we).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: g(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", we).getRegex()
}, Yt = {
  ...K,
  br: g(Pe).replace("{2,}", "*").getRegex(),
  text: g(K.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
}, D = {
  normal: oe,
  gfm: Lt,
  pedantic: Pt
}, _ = {
  normal: pe,
  gfm: K,
  breaks: Yt,
  pedantic: Xt
}, Jt = {
  "&": "&amp;",
  "<": "&lt;",
  ">": "&gt;",
  '"': "&quot;",
  "'": "&#39;"
}, ye = (n) => Jt[n];
function R(n, e) {
  if (e) {
    if (w.escapeTest.test(n)) return n.replace(w.escapeReplace, ye);
  } else if (w.escapeTestNoEncode.test(n)) return n.replace(w.escapeReplaceNoEncode, ye);
  return n;
}
function Se(n) {
  try {
    n = encodeURI(n).replace(w.percentDecode, "%");
  } catch {
    return null;
  }
  return n;
}
function $e(n, e) {
  let r = n.replace(w.findPipe, (t, l, i) => {
    let a = !1, o = l;
    for (; --o >= 0 && i[o] === "\\"; ) a = !a;
    return a ? "|" : " |";
  }).split(w.splitPipe), s = 0;
  if (r[0].trim() || r.shift(), r.length > 0 && !r.at(-1)?.trim() && r.pop(), e) if (r.length > e) r.splice(e);
  else for (; r.length < e; ) r.push("");
  for (; s < r.length; s++) r[s] = r[s].trim().replace(w.slashPipe, "|");
  return r;
}
function C(n, e, r) {
  let s = n.length;
  if (s === 0) return "";
  let t = 0;
  for (; t < s; ) {
    let l = n.charAt(s - t - 1);
    if (l === e && !r) t++;
    else if (l !== e && r) t++;
    else break;
  }
  return n.slice(0, s - t);
}
function en(n, e) {
  if (n.indexOf(e[1]) === -1) return -1;
  let r = 0;
  for (let s = 0; s < n.length; s++) if (n[s] === "\\") s++;
  else if (n[s] === e[0]) r++;
  else if (n[s] === e[1] && (r--, r < 0)) return s;
  return r > 0 ? -2 : -1;
}
function Te(n, e, r, s, t) {
  let l = e.href, i = e.title || null, a = n[1].replace(t.other.outputLinkReplace, "$1");
  s.state.inLink = !0;
  let o = {
    type: n[0].charAt(0) === "!" ? "image" : "link",
    raw: r,
    href: l,
    title: i,
    text: a,
    tokens: s.inlineTokens(a)
  };
  return s.state.inLink = !1, o;
}
function tn(n, e, r) {
  let s = n.match(r.other.indentCodeCompensation);
  if (s === null) return e;
  let t = s[1];
  return e.split(`
`).map((l) => {
    let i = l.match(r.other.beginningSpace);
    if (i === null) return l;
    let [a] = i;
    return a.length >= t.length ? l.slice(t.length) : l;
  }).join(`
`);
}
var W = class {
  options;
  rules;
  lexer;
  constructor(n) {
    this.options = n || v;
  }
  space(n) {
    let e = this.rules.block.newline.exec(n);
    if (e && e[0].length > 0) return {
      type: "space",
      raw: e[0]
    };
  }
  code(n) {
    let e = this.rules.block.code.exec(n);
    if (e) {
      let r = e[0].replace(this.rules.other.codeRemoveIndent, "");
      return {
        type: "code",
        raw: e[0],
        codeBlockStyle: "indented",
        text: this.options.pedantic ? r : C(r, `
`)
      };
    }
  }
  fences(n) {
    let e = this.rules.block.fences.exec(n);
    if (e) {
      let r = e[0], s = tn(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(n) {
    let e = this.rules.block.heading.exec(n);
    if (e) {
      let r = e[2].trim();
      if (this.rules.other.endingHash.test(r)) {
        let s = C(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(n) {
    let e = this.rules.block.hr.exec(n);
    if (e) return {
      type: "hr",
      raw: C(e[0], `
`)
    };
  }
  blockquote(n) {
    let e = this.rules.block.blockquote.exec(n);
    if (e) {
      let r = C(e[0], `
`).split(`
`), s = "", t = "", l = [];
      for (; r.length > 0; ) {
        let i = !1, a = [], o;
        for (o = 0; o < r.length; o++) if (this.rules.other.blockquoteStart.test(r[o])) a.push(r[o]), i = !0;
        else if (!i) a.push(r[o]);
        else break;
        r = r.slice(o);
        let p = a.join(`
`), c = p.replace(this.rules.other.blockquoteSetextReplace, `
    $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
        s = s ? `${s}
${p}` : p, t = t ? `${t}
${c}` : c;
        let h = this.lexer.state.top;
        if (this.lexer.state.top = !0, this.lexer.blockTokens(c, l, !0), this.lexer.state.top = h, r.length === 0) break;
        let u = l.at(-1);
        if (u?.type === "code") break;
        if (u?.type === "blockquote") {
          let f = u, x = f.raw + `
` + r.join(`
`), b = this.blockquote(x);
          l[l.length - 1] = b, s = s.substring(0, s.length - f.raw.length) + b.raw, t = t.substring(0, t.length - f.text.length) + b.text;
          break;
        } else if (u?.type === "list") {
          let f = u, x = f.raw + `
` + r.join(`
`), b = this.list(x);
          l[l.length - 1] = b, s = s.substring(0, s.length - u.raw.length) + b.raw, t = t.substring(0, t.length - f.raw.length) + b.raw, r = x.substring(l.at(-1).raw.length).split(`
`);
          continue;
        }
      }
      return {
        type: "blockquote",
        raw: s,
        tokens: l,
        text: t
      };
    }
  }
  list(n) {
    let e = this.rules.block.list.exec(n);
    if (e) {
      let r = e[1].trim(), s = r.length > 1, t = {
        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 l = this.rules.other.listItemRegex(r), i = !1;
      for (; n; ) {
        let o = !1, p = "", c = "";
        if (!(e = l.exec(n)) || this.rules.block.hr.test(n)) break;
        p = e[0], n = n.substring(p.length);
        let h = e[2].split(`
`, 1)[0].replace(this.rules.other.listReplaceTabs, (A) => " ".repeat(3 * A.length)), u = n.split(`
`, 1)[0], f = !h.trim(), x = 0;
        if (this.options.pedantic ? (x = 2, c = h.trimStart()) : f ? x = e[1].length + 1 : (x = e[2].search(this.rules.other.nonSpaceChar), x = x > 4 ? 1 : x, c = h.slice(x), x += e[1].length), f && this.rules.other.blankLine.test(u) && (p += u + `
`, n = n.substring(u.length + 1), o = !0), !o) {
          let A = this.rules.other.nextBulletRegex(x), E = this.rules.other.hrRegex(x), S = this.rules.other.fencesBeginRegex(x), y = this.rules.other.headingBeginRegex(x), Je = this.rules.other.htmlBeginRegex(x);
          for (; n; ) {
            let V = n.split(`
`, 1)[0], L;
            if (u = V, this.options.pedantic ? (u = u.replace(this.rules.other.listReplaceNesting, "  "), L = u) : L = u.replace(this.rules.other.tabCharGlobal, "    "), S.test(u) || y.test(u) || Je.test(u) || A.test(u) || E.test(u)) break;
            if (L.search(this.rules.other.nonSpaceChar) >= x || !u.trim()) c += `
` + L.slice(x);
            else {
              if (f || h.replace(this.rules.other.tabCharGlobal, "    ").search(this.rules.other.nonSpaceChar) >= 4 || S.test(h) || y.test(h) || E.test(h)) break;
              c += `
` + u;
            }
            !f && !u.trim() && (f = !0), p += V + `
`, n = n.substring(V.length + 1), h = L.slice(x);
          }
        }
        t.loose || (i ? t.loose = !0 : this.rules.other.doubleBlankLine.test(p) && (i = !0));
        let b = null, m;
        this.options.gfm && (b = this.rules.other.listIsTask.exec(c), b && (m = b[0] !== "[ ] ", c = c.replace(this.rules.other.listReplaceTask, ""))), t.items.push({
          type: "list_item",
          raw: p,
          task: !!b,
          checked: m,
          loose: !1,
          text: c,
          tokens: []
        }), t.raw += p;
      }
      let a = t.items.at(-1);
      if (a) a.raw = a.raw.trimEnd(), a.text = a.text.trimEnd();
      else return;
      t.raw = t.raw.trimEnd();
      for (let o = 0; o < t.items.length; o++) if (this.lexer.state.top = !1, t.items[o].tokens = this.lexer.blockTokens(t.items[o].text, []), !t.loose) {
        let p = t.items[o].tokens.filter((c) => c.type === "space");
        t.loose = p.length > 0 && p.some((c) => this.rules.other.anyLine.test(c.raw));
      }
      if (t.loose) for (let o = 0; o < t.items.length; o++) t.items[o].loose = !0;
      return t;
    }
  }
  html(n) {
    let e = this.rules.block.html.exec(n);
    if (e) return {
      type: "html",
      block: !0,
      raw: e[0],
      pre: e[1] === "pre" || e[1] === "script" || e[1] === "style",
      text: e[0]
    };
  }
  def(n) {
    let e = this.rules.block.def.exec(n);
    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") : "", t = 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: t
      };
    }
  }
  table(n) {
    let e = this.rules.block.table.exec(n);
    if (!e || !this.rules.other.tableDelimiter.test(e[2])) return;
    let r = $e(e[1]), s = e[2].replace(this.rules.other.tableAlignChars, "").split("|"), t = e[3]?.trim() ? e[3].replace(this.rules.other.tableRowBlankLine, "").split(`
`) : [], l = {
      type: "table",
      raw: e[0],
      header: [],
      align: [],
      rows: []
    };
    if (r.length === s.length) {
      for (let i of s) this.rules.other.tableAlignRight.test(i) ? l.align.push("right") : this.rules.other.tableAlignCenter.test(i) ? l.align.push("center") : this.rules.other.tableAlignLeft.test(i) ? l.align.push("left") : l.align.push(null);
      for (let i = 0; i < r.length; i++) l.header.push({
        text: r[i],
        tokens: this.lexer.inline(r[i]),
        header: !0,
        align: l.align[i]
      });
      for (let i of t) l.rows.push($e(i, l.header.length).map((a, o) => ({
        text: a,
        tokens: this.lexer.inline(a),
        header: !1,
        align: l.align[o]
      })));
      return l;
    }
  }
  lheading(n) {
    let e = this.rules.block.lheading.exec(n);
    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(n) {
    let e = this.rules.block.paragraph.exec(n);
    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(n) {
    let e = this.rules.block.text.exec(n);
    if (e) return {
      type: "text",
      raw: e[0],
      text: e[0],
      tokens: this.lexer.inline(e[0])
    };
  }
  escape(n) {
    let e = this.rules.inline.escape.exec(n);
    if (e) return {
      type: "escape",
      raw: e[0],
      text: e[1]
    };
  }
  tag(n) {
    let e = this.rules.inline.tag.exec(n);
    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(n) {
    let e = this.rules.inline.link.exec(n);
    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 l = C(r.slice(0, -1), "\\");
        if ((r.length - l.length) % 2 === 0) return;
      } else {
        let l = en(e[2], "()");
        if (l === -2) return;
        if (l > -1) {
          let i = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length + l;
          e[2] = e[2].substring(0, l), e[0] = e[0].substring(0, i).trim(), e[3] = "";
        }
      }
      let s = e[2], t = "";
      if (this.options.pedantic) {
        let l = this.rules.other.pedanticHrefTitle.exec(s);
        l && (s = l[1], t = l[3]);
      } else t = 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)), Te(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);
    }
  }
  reflink(n, e) {
    let r;
    if ((r = this.rules.inline.reflink.exec(n)) || (r = this.rules.inline.nolink.exec(n))) {
      let s = e[(r[2] || r[1]).replace(this.rules.other.multipleSpaceGlobal, " ").toLowerCase()];
      if (!s) {
        let t = r[0].charAt(0);
        return {
          type: "text",
          raw: t,
          text: t
        };
      }
      return Te(r, s, r[0], this.lexer, this.rules);
    }
  }
  emStrong(n, e, r = "") {
    let s = this.rules.inline.emStrongLDelim.exec(n);
    if (!(!s || s[3] && r.match(this.rules.other.unicodeAlphaNumeric)) && (!(s[1] || s[2]) || !r || this.rules.inline.punctuation.exec(r))) {
      let t = [...s[0]].length - 1, l, i, a = t, o = 0, p = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
      for (p.lastIndex = 0, e = e.slice(-1 * n.length + t); (s = p.exec(e)) != null; ) {
        if (l = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !l) continue;
        if (i = [...l].length, s[3] || s[4]) {
          a += i;
          continue;
        } else if ((s[5] || s[6]) && t % 3 && !((t + i) % 3)) {
          o += i;
          continue;
        }
        if (a -= i, a > 0) continue;
        i = Math.min(i, i + a + o);
        let c = [...s[0]][0].length, h = n.slice(0, t + s.index + c + i);
        if (Math.min(t, i) % 2) {
          let f = h.slice(1, -1);
          return {
            type: "em",
            raw: h,
            text: f,
            tokens: this.lexer.inlineTokens(f)
          };
        }
        let u = h.slice(2, -2);
        return {
          type: "strong",
          raw: h,
          text: u,
          tokens: this.lexer.inlineTokens(u)
        };
      }
    }
  }
  codespan(n) {
    let e = this.rules.inline.code.exec(n);
    if (e) {
      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);
      return s && t && (r = r.substring(1, r.length - 1)), {
        type: "codespan",
        raw: e[0],
        text: r
      };
    }
  }
  br(n) {
    let e = this.rules.inline.br.exec(n);
    if (e) return {
      type: "br",
      raw: e[0]
    };
  }
  del(n) {
    let e = this.rules.inline.del.exec(n);
    if (e) return {
      type: "del",
      raw: e[0],
      text: e[2],
      tokens: this.lexer.inlineTokens(e[2])
    };
  }
  autolink(n) {
    let e = this.rules.inline.autolink.exec(n);
    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(n) {
    let e;
    if (e = this.rules.inline.url.exec(n)) {
      let r, s;
      if (e[2] === "@") r = e[0], s = "mailto:" + r;
      else {
        let t;
        do
          t = e[0], e[0] = this.rules.inline._backpedal.exec(e[0])?.[0] ?? "";
        while (t !== e[0]);
        r = e[0], e[1] === "www." ? s = "http://" + e[0] : s = e[0];
      }
      return {
        type: "link",
        raw: e[0],
        text: r,
        href: s,
        tokens: [{
          type: "text",
          raw: r,
          text: r
        }]
      };
    }
  }
  inlineText(n) {
    let e = this.rules.inline.text.exec(n);
    if (e) {
      let r = this.lexer.state.inRawBlock;
      return {
        type: "text",
        raw: e[0],
        text: e[0],
        escaped: r
      };
    }
  }
}, $ = class X {
  tokens;
  options;
  state;
  tokenizer;
  inlineQueue;
  constructor(e) {
    this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || v, this.options.tokenizer = this.options.tokenizer || new W(), 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: D.normal,
      inline: _.normal
    };
    this.options.pedantic ? (r.block = D.pedantic, r.inline = _.pedantic) : this.options.gfm && (r.block = D.gfm, this.options.breaks ? r.inline = _.breaks : r.inline = _.gfm), this.tokenizer.rules = r;
  }
  static get rules() {
    return {
      block: D,
      inline: _
    };
  }
  static lex(e, r) {
    return new X(r).lex(e);
  }
  static lexInline(e, r) {
    return new X(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) {
    for (this.options.pedantic && (e = e.replace(w.tabCharGlobal, "    ").replace(w.spaceLine, "")); e; ) {
      let t;
      if (this.options.extensions?.block?.some((i) => (t = i.call({ lexer: this }, e, r)) ? (e = e.substring(t.raw.length), r.push(t), !0) : !1)) continue;
      if (t = this.tokenizer.space(e)) {
        e = e.substring(t.raw.length);
        let i = r.at(-1);
        t.raw.length === 1 && i !== void 0 ? i.raw += `
` : r.push(t);
        continue;
      }
      if (t = this.tokenizer.code(e)) {
        e = e.substring(t.raw.length);
        let i = r.at(-1);
        i?.type === "paragraph" || i?.type === "text" ? (i.raw += (i.raw.endsWith(`
`) ? "" : `
`) + t.raw, i.text += `
` + t.text, this.inlineQueue.at(-1).src = i.text) : r.push(t);
        continue;
      }
      if (t = this.tokenizer.fences(e)) {
        e = e.substring(t.raw.length), r.push(t);
        continue;
      }
      if (t = this.tokenizer.heading(e)) {
        e = e.substring(t.raw.length), r.push(t);
        continue;
      }
      if (t = this.tokenizer.hr(e)) {
        e = e.substring(t.raw.length), r.push(t);
        continue;
      }
      if (t = this.tokenizer.blockquote(e)) {
        e = e.substring(t.raw.length), r.push(t);
        continue;
      }
      if (t = this.tokenizer.list(e)) {
        e = e.substring(t.raw.length), r.push(t);
        continue;
      }
      if (t = this.tokenizer.html(e)) {
        e = e.substring(t.raw.length), r.push(t);
        continue;
      }
      if (t = this.tokenizer.def(e)) {
        e = e.substring(t.raw.length);
        let i = r.at(-1);
        i?.type === "paragraph" || i?.type === "text" ? (i.raw += (i.raw.endsWith(`
`) ? "" : `
`) + t.raw, i.text += `
` + t.raw, this.inlineQueue.at(-1).src = i.text) : this.tokens.links[t.tag] || (this.tokens.links[t.tag] = {
          href: t.href,
          title: t.title
        }, r.push(t));
        continue;
      }
      if (t = this.tokenizer.table(e)) {
        e = e.substring(t.raw.length), r.push(t);
        continue;
      }
      if (t = this.tokenizer.lheading(e)) {
        e = e.substring(t.raw.length), r.push(t);
        continue;
      }
      let l = e;
      if (this.options.extensions?.startBlock) {
        let i = 1 / 0, a = e.slice(1), o;
        this.options.extensions.startBlock.forEach((p) => {
          o = p.call({ lexer: this }, a), typeof o == "number" && o >= 0 && (i = Math.min(i, o));
        }), i < 1 / 0 && i >= 0 && (l = e.substring(0, i + 1));
      }
      if (this.state.top && (t = this.tokenizer.paragraph(l))) {
        let i = r.at(-1);
        s && i?.type === "paragraph" ? (i.raw += (i.raw.endsWith(`
`) ? "" : `
`) + t.raw, i.text += `
` + t.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = i.text) : r.push(t), s = l.length !== e.length, e = e.substring(t.raw.length);
        continue;
      }
      if (t = this.tokenizer.text(e)) {
        e = e.substring(t.raw.length);
        let i = r.at(-1);
        i?.type === "text" ? (i.raw += (i.raw.endsWith(`
`) ? "" : `
`) + t.raw, i.text += `
` + t.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = i.text) : r.push(t);
        continue;
      }
      if (e) {
        let i = "Infinite loop on byte: " + e.charCodeAt(0);
        if (this.options.silent) {
          console.error(i);
          break;
        } else throw new Error(i);
      }
    }
    return this.state.top = !0, r;
  }
  inline(e, r = []) {
    return this.inlineQueue.push({
      src: e,
      tokens: r
    }), r;
  }
  inlineTokens(e, r = []) {
    let s = e, t = null;
    if (this.tokens.links) {
      let o = Object.keys(this.tokens.links);
      if (o.length > 0) for (; (t = this.tokenizer.rules.inline.reflinkSearch.exec(s)) != null; ) o.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));
    }
    for (; (t = this.tokenizer.rules.inline.anyPunctuation.exec(s)) != null; ) s = s.slice(0, t.index) + "++" + s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
    let l;
    for (; (t = this.tokenizer.rules.inline.blockSkip.exec(s)) != null; ) l = t[2] ? t[2].length : 0, s = s.slice(0, t.index + l) + "[" + "a".repeat(t[0].length - l - 2) + "]" + s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
    s = this.options.hooks?.emStrongMask?.call({ lexer: this }, s) ?? s;
    let i = !1, a = "";
    for (; e; ) {
      i || (a = ""), i = !1;
      let o;
      if (this.options.extensions?.inline?.some((c) => (o = c.call({ lexer: this }, e, r)) ? (e = e.substring(o.raw.length), r.push(o), !0) : !1)) continue;
      if (o = this.tokenizer.escape(e)) {
        e = e.substring(o.raw.length), r.push(o);
        continue;
      }
      if (o = this.tokenizer.tag(e)) {
        e = e.substring(o.raw.length), r.push(o);
        continue;
      }
      if (o = this.tokenizer.link(e)) {
        e = e.substring(o.raw.length), r.push(o);
        continue;
      }
      if (o = this.tokenizer.reflink(e, this.tokens.links)) {
        e = e.substring(o.raw.length);
        let c = r.at(-1);
        o.type === "text" && c?.type === "text" ? (c.raw += o.raw, c.text += o.text) : r.push(o);
        continue;
      }
      if (o = this.tokenizer.emStrong(e, s, a)) {
        e = e.substring(o.raw.length), r.push(o);
        continue;
      }
      if (o = this.tokenizer.codespan(e)) {
        e = e.substring(o.raw.length), r.push(o);
        continue;
      }
      if (o = this.tokenizer.br(e)) {
        e = e.substring(o.raw.length), r.push(o);
        continue;
      }
      if (o = this.tokenizer.del(e)) {
        e = e.substring(o.raw.length), r.push(o);
        continue;
      }
      if (o = this.tokenizer.autolink(e)) {
        e = e.substring(o.raw.length), r.push(o);
        continue;
      }
      if (!this.state.inLink && (o = this.tokenizer.url(e))) {
        e = e.substring(o.raw.length), r.push(o);
        continue;
      }
      let p = e;
      if (this.options.extensions?.startInline) {
        let c = 1 / 0, h = e.slice(1), u;
        this.options.extensions.startInline.forEach((f) => {
          u = f.call({ lexer: this }, h), typeof u == "number" && u >= 0 && (c = Math.min(c, u));
        }), c < 1 / 0 && c >= 0 && (p = e.substring(0, c + 1));
      }
      if (o = this.tokenizer.inlineText(p)) {
        e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (a = o.raw.slice(-1)), i = !0;
        let c = r.at(-1);
        c?.type === "text" ? (c.raw += o.raw, c.text += o.text) : r.push(o);
        continue;
      }
      if (e) {
        let c = "Infinite loop on byte: " + e.charCodeAt(0);
        if (this.options.silent) {
          console.error(c);
          break;
        } else throw new Error(c);
      }
    }
    return r;
  }
}, F = class {
  options;
  parser;
  constructor(n) {
    this.options = n || v;
  }
  space(n) {
    return "";
  }
  code({ text: n, lang: e, escaped: r }) {
    let s = (e || "").match(w.notSpaceStart)?.[0], t = n.replace(w.endingNewline, "") + `
`;
    return s ? '<pre><code class="language-' + R(s) + '">' + (r ? t : R(t, !0)) + `</code></pre>
` : "<pre><code>" + (r ? t : R(t, !0)) + `</code></pre>
`;
  }
  blockquote({ tokens: n }) {
    return `<blockquote>
${this.parser.parse(n)}</blockquote>
`;
  }
  html({ text: n }) {
    return n;
  }
  def(n) {
    return "";
  }
  heading({ tokens: n, depth: e }) {
    return `<h${e}>${this.parser.parseInline(n)}</h${e}>
`;
  }
  hr(n) {
    return `<hr>
`;
  }
  list(n) {
    let e = n.ordered, r = n.start, s = "";
    for (let i = 0; i < n.items.length; i++) {
      let a = n.items[i];
      s += this.listitem(a);
    }
    let t = e ? "ol" : "ul", l = e && r !== 1 ? ' start="' + r + '"' : "";
    return "<" + t + l + `>
` + s + "</" + t + `>
`;
  }
  listitem(n) {
    let e = "";
    if (n.task) {
      let r = this.checkbox({ checked: !!n.checked });
      n.loose ? n.tokens[0]?.type === "paragraph" ? (n.tokens[0].text = r + " " + n.tokens[0].text, n.tokens[0].tokens && n.tokens[0].tokens.length > 0 && n.tokens[0].tokens[0].type === "text" && (n.tokens[0].tokens[0].text = r + " " + R(n.tokens[0].tokens[0].text), n.tokens[0].tokens[0].escaped = !0)) : n.tokens.unshift({
        type: "text",
        raw: r + " ",
        text: r + " ",
        escaped: !0
      }) : e += r + " ";
    }
    return e += this.parser.parse(n.tokens, !!n.loose), `<li>${e}</li>
`;
  }
  checkbox({ checked: n }) {
    return "<input " + (n ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
  }
  paragraph({ tokens: n }) {
    return `<p>${this.parser.parseInline(n)}</p>
`;
  }
  table(n) {
    let e = "", r = "";
    for (let t = 0; t < n.header.length; t++) r += this.tablecell(n.header[t]);
    e += this.tablerow({ text: r });
    let s = "";
    for (let t = 0; t < n.rows.length; t++) {
      let l = n.rows[t];
      r = "";
      for (let i = 0; i < l.length; i++) r += this.tablecell(l[i]);
      s += this.tablerow({ text: r });
    }
    return s && (s = `<tbody>${s}</tbody>`), `<table>
<thead>
` + e + `</thead>
` + s + `</table>
`;
  }
  tablerow({ text: n }) {
    return `<tr>
${n}</tr>
`;
  }
  tablecell(n) {
    let e = this.parser.parseInline(n.tokens), r = n.header ? "th" : "td";
    return (n.align ? `<${r} align="${n.align}">` : `<${r}>`) + e + `</${r}>
`;
  }
  strong({ tokens: n }) {
    return `<strong>${this.parser.parseInline(n)}</strong>`;
  }
  em({ tokens: n }) {
    return `<em>${this.parser.parseInline(n)}</em>`;
  }
  codespan({ text: n }) {
    return `<code>${R(n, !0)}</code>`;
  }
  br(n) {
    return "<br>";
  }
  del({ tokens: n }) {
    return `<del>${this.parser.parseInline(n)}</del>`;
  }
  link({ href: n, title: e, tokens: r }) {
    let s = this.parser.parseInline(r), t = Se(n);
    if (t === null) return s;
    n = t;
    let l = '<a href="' + n + '"';
    return e && (l += ' title="' + R(e) + '"'), l += ">" + s + "</a>", l;
  }
  image({ href: n, title: e, text: r, tokens: s }) {
    s && (r = this.parser.parseInline(s, this.parser.textRenderer));
    let t = Se(n);
    if (t === null) return R(r);
    n = t;
    let l = `<img src="${n}" alt="${r}"`;
    return e && (l += ` title="${R(e)}"`), l += ">", l;
  }
  text(n) {
    return "tokens" in n && n.tokens ? this.parser.parseInline(n.tokens) : "escaped" in n && n.escaped ? n.text : R(n.text);
  }
}, he = class {
  strong({ text: n }) {
    return n;
  }
  em({ text: n }) {
    return n;
  }
  codespan({ text: n }) {
    return n;
  }
  del({ text: n }) {
    return n;
  }
  html({ text: n }) {
    return n;
  }
  text({ text: n }) {
    return n;
  }
  link({ text: n }) {
    return "" + n;
  }
  image({ text: n }) {
    return "" + n;
  }
  br() {
    return "";
  }
}, T = class Y {
  options;
  renderer;
  textRenderer;
  constructor(e) {
    this.options = e || v, this.options.renderer = this.options.renderer || new F(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new he();
  }
  static parse(e, r) {
    return new Y(r).parse(e);
  }
  static parseInline(e, r) {
    return new Y(r).parseInline(e);
  }
  parse(e, r = !0) {
    let s = "";
    for (let t = 0; t < e.length; t++) {
      let l = e[t];
      if (this.options.extensions?.renderers?.[l.type]) {
        let a = l, o = this.options.extensions.renderers[a.type].call({ parser: this }, a);
        if (o !== !1 || ![
          "space",
          "hr",
          "heading",
          "code",
          "table",
          "blockquote",
          "list",
          "html",
          "def",
          "paragraph",
          "text"
        ].includes(a.type)) {
          s += o || "";
          continue;
        }
      }
      let i = l;
      switch (i.type) {
        case "space":
          s += this.renderer.space(i);
          continue;
        case "hr":
          s += this.renderer.hr(i);
          continue;
        case "heading":
          s += this.renderer.heading(i);
          continue;
        case "code":
          s += this.renderer.code(i);
          continue;
        case "table":
          s += this.renderer.table(i);
          continue;
        case "blockquote":
          s += this.renderer.blockquote(i);
          continue;
        case "list":
          s += this.renderer.list(i);
          continue;
        case "html":
          s += this.renderer.html(i);
          continue;
        case "def":
          s += this.renderer.def(i);
          continue;
        case "paragraph":
          s += this.renderer.paragraph(i);
          continue;
        case "text": {
          let a = i, o = this.renderer.text(a);
          for (; t + 1 < e.length && e[t + 1].type === "text"; ) a = e[++t], o += `
` + this.renderer.text(a);
          r ? s += this.renderer.paragraph({
            type: "paragraph",
            raw: o,
            text: o,
            tokens: [{
              type: "text",
              raw: o,
              text: o,
              escaped: !0
            }]
          }) : s += o;
          continue;
        }
        default: {
          let a = 'Token with "' + i.type + '" type was not found.';
          if (this.options.silent) return console.error(a), "";
          throw new Error(a);
        }
      }
    }
    return s;
  }
  parseInline(e, r = this.renderer) {
    let s = "";
    for (let t = 0; t < e.length; t++) {
      let l = e[t];
      if (this.options.extensions?.renderers?.[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 i = l;
      switch (i.type) {
        case "escape":
          s += r.text(i);
          break;
        case "html":
          s += r.html(i);
          break;
        case "link":
          s += r.link(i);
          break;
        case "image":
          s += r.image(i);
          break;
        case "strong":
          s += r.strong(i);
          break;
        case "em":
          s += r.em(i);
          break;
        case "codespan":
          s += r.codespan(i);
          break;
        case "br":
          s += r.br(i);
          break;
        case "del":
          s += r.del(i);
          break;
        case "text":
          s += r.text(i);
          break;
        default: {
          let a = 'Token with "' + i.type + '" type was not found.';
          if (this.options.silent) return console.error(a), "";
          throw new Error(a);
        }
      }
    }
    return s;
  }
}, B = class {
  options;
  block;
  constructor(n) {
    this.options = n || v;
  }
  static passThroughHooks = /* @__PURE__ */ new Set([
    "preprocess",
    "postprocess",
    "processAllTokens",
    "emStrongMask"
  ]);
  static passThroughHooksRespectAsync = /* @__PURE__ */ new Set([
    "preprocess",
    "postprocess",
    "processAllTokens"
  ]);
  preprocess(n) {
    return n;
  }
  postprocess(n) {
    return n;
  }
  processAllTokens(n) {
    return n;
  }
  emStrongMask(n) {
    return n;
  }
  provideLexer() {
    return this.block ? $.lex : $.lexInline;
  }
  provideParser() {
    return this.block ? T.parse : T.parseInline;
  }
}, nn = class {
  defaults = re();
  options = this.setOptions;
  parse = this.parseMarkdown(!0);
  parseInline = this.parseMarkdown(!1);
  Parser = T;
  Renderer = F;
  TextRenderer = he;
  Lexer = $;
  Tokenizer = W;
  Hooks = B;
  constructor(...n) {
    this.use(...n);
  }
  walkTokens(n, e) {
    let r = [];
    for (let s of n) switch (r = r.concat(e.call(this, s)), s.type) {
      case "table": {
        let t = s;
        for (let l of t.header) r = r.concat(this.walkTokens(l.tokens, e));
        for (let l of t.rows) for (let i of l) r = r.concat(this.walkTokens(i.tokens, e));
        break;
      }
      case "list": {
        let t = s;
        r = r.concat(this.walkTokens(t.items, e));
        break;
      }
      default: {
        let t = s;
        this.defaults.extensions?.childTokens?.[t.type] ? this.defaults.extensions.childTokens[t.type].forEach((l) => {
          let i = t[l].flat(1 / 0);
          r = r.concat(this.walkTokens(i, e));
        }) : t.tokens && (r = r.concat(this.walkTokens(t.tokens, e)));
      }
    }
    return r;
  }
  use(...n) {
    let e = this.defaults.extensions || {
      renderers: {},
      childTokens: {}
    };
    return n.forEach((r) => {
      let s = { ...r };
      if (s.async = this.defaults.async || s.async || !1, r.extensions && (r.extensions.forEach((t) => {
        if (!t.name) throw new Error("extension name required");
        if ("renderer" in t) {
          let l = e.renderers[t.name];
          l ? e.renderers[t.name] = function(...i) {
            let a = t.renderer.apply(this, i);
            return a === !1 && (a = l.apply(this, i)), a;
          } : e.renderers[t.name] = t.renderer;
        }
        if ("tokenizer" in t) {
          if (!t.level || t.level !== "block" && t.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
          let l = e[t.level];
          l ? l.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]));
        }
        "childTokens" in t && t.childTokens && (e.childTokens[t.name] = t.childTokens);
      }), s.extensions = e), r.renderer) {
        let t = this.defaults.renderer || new F(this.defaults);
        for (let l in r.renderer) {
          if (!(l in t)) throw new Error(`renderer '${l}' does not exist`);
          if (["options", "parser"].includes(l)) continue;
          let i = l, a = r.renderer[i], o = t[i];
          t[i] = (...p) => {
            let c = a.apply(t, p);
            return c === !1 && (c = o.apply(t, p)), c || "";
          };
        }
        s.renderer = t;
      }
      if (r.tokenizer) {
        let t = this.defaults.tokenizer || new W(this.defaults);
        for (let l in r.tokenizer) {
          if (!(l in t)) throw new Error(`tokenizer '${l}' does not exist`);
          if ([
            "options",
            "rules",
            "lexer"
          ].includes(l)) continue;
          let i = l, a = r.tokenizer[i], o = t[i];
          t[i] = (...p) => {
            let c = a.apply(t, p);
            return c === !1 && (c = o.apply(t, p)), c;
          };
        }
        s.tokenizer = t;
      }
      if (r.hooks) {
        let t = this.defaults.hooks || new B();
        for (let l in r.hooks) {
          if (!(l in t)) throw new Error(`hook '${l}' does not exist`);
          if (["options", "block"].includes(l)) continue;
          let i = l, a = r.hooks[i], o = t[i];
          B.passThroughHooks.has(l) ? t[i] = (p) => {
            if (this.defaults.async && B.passThroughHooksRespectAsync.has(l)) return (async () => {
              let h = await a.call(t, p);
              return o.call(t, h);
            })();
            let c = a.call(t, p);
            return o.call(t, c);
          } : t[i] = (...p) => {
            if (this.defaults.async) return (async () => {
              let h = await a.apply(t, p);
              return h === !1 && (h = await o.apply(t, p)), h;
            })();
            let c = a.apply(t, p);
            return c === !1 && (c = o.apply(t, p)), c;
          };
        }
        s.hooks = t;
      }
      if (r.walkTokens) {
        let t = this.defaults.walkTokens, l = r.walkTokens;
        s.walkTokens = function(i) {
          let a = [];
          return a.push(l.call(this, i)), t && (a = a.concat(t.call(this, i))), a;
        };
      }
      this.defaults = {
        ...this.defaults,
        ...s
      };
    }), this;
  }
  setOptions(n) {
    return this.defaults = {
      ...this.defaults,
      ...n
    }, this;
  }
  lexer(n, e) {
    return $.lex(n, e ?? this.defaults);
  }
  parser(n, e) {
    return T.parse(n, e ?? this.defaults);
  }
  parseMarkdown(n) {
    return (e, r) => {
      let s = { ...r }, t = {
        ...this.defaults,
        ...s
      }, l = this.onError(!!t.silent, !!t.async);
      if (this.defaults.async === !0 && s.async === !1) return l(/* @__PURE__ */ 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 l(/* @__PURE__ */ new Error("marked(): input parameter is undefined or null"));
      if (typeof e != "string") return l(/* @__PURE__ */ new Error("marked(): input parameter is of type " + Object.prototype.toString.call(e) + ", string expected"));
      if (t.hooks && (t.hooks.options = t, t.hooks.block = n), t.async) return (async () => {
        let i = t.hooks ? await t.hooks.preprocess(e) : e, a = await (t.hooks ? await t.hooks.provideLexer() : n ? $.lex : $.lexInline)(i, t), o = t.hooks ? await t.hooks.processAllTokens(a) : a;
        t.walkTokens && await Promise.all(this.walkTokens(o, t.walkTokens));
        let p = await (t.hooks ? await t.hooks.provideParser() : n ? T.parse : T.parseInline)(o, t);
        return t.hooks ? await t.hooks.postprocess(p) : p;
      })().catch(l);
      try {
        t.hooks && (e = t.hooks.preprocess(e));
        let i = (t.hooks ? t.hooks.provideLexer() : n ? $.lex : $.lexInline)(e, t);
        t.hooks && (i = t.hooks.processAllTokens(i)), t.walkTokens && this.walkTokens(i, t.walkTokens);
        let a = (t.hooks ? t.hooks.provideParser() : n ? T.parse : T.parseInline)(i, t);
        return t.hooks && (a = t.hooks.postprocess(a)), a;
      } catch (i) {
        return l(i);
      }
    };
  }
  onError(n, e) {
    return (r) => {
      if (r.message += `
Please report this to https://github.com/markedjs/marked.`, n) {
        let s = "<p>An error occurred:</p><pre>" + R(r.message + "", !0) + "</pre>";
        return e ? Promise.resolve(s) : s;
      }
      if (e) return Promise.reject(r);
      throw r;
    };
  }
}, I = new nn();
function d(n, e) {
  return I.parse(n, e);
}
d.options = d.setOptions = function(n) {
  return I.setOptions(n), d.defaults = I.defaults, Ae(d.defaults), d;
};
d.getDefaults = re;
d.defaults = v;
d.use = function(...n) {
  return I.use(...n), d.defaults = I.defaults, Ae(d.defaults), d;
};
d.walkTokens = function(n, e) {
  return I.walkTokens(n, e);
};
d.parseInline = I.parseInline;
d.Parser = T;
d.parser = T.parse;
d.Renderer = F;
d.TextRenderer = he;
d.Lexer = $;
d.lexer = $.lex;
d.Tokenizer = W;
d.Hooks = B;
d.parse = d;
var gn = d.options, fn = d.setOptions, dn = d.use, kn = d.walkTokens, xn = d.parseInline;
var bn = T.parse, mn = $.lex;
function rn(n) {
  for (var e = [], r = 1; r < arguments.length; r++) e[r - 1] = arguments[r];
  var s = Array.from(typeof n == "string" ? [n] : n);
  s[s.length - 1] = s[s.length - 1].replace(/\r?\n([\t ]*)$/, "");
  var t = s.reduce(function(a, o) {
    var p = o.match(/\n([\t ]+|(?!\s).)/g);
    return p ? a.concat(p.map(function(c) {
      var h, u;
      return (u = (h = c.match(/[\t ]/g)) === null || h === void 0 ? void 0 : h.length) !== null && u !== void 0 ? u : 0;
    })) : a;
  }, []);
  if (t.length) {
    var l = new RegExp(`
[	 ]{` + Math.min.apply(Math, t) + "}", "g");
    s = s.map(function(a) {
      return a.replace(l, `
`);
    });
  }
  s[0] = s[0].replace(/^\r?\n/, "");
  var i = s[0];
  return e.forEach(function(a, o) {
    var p = i.match(/(?:^|\n)( *)$/), c = p ? p[1] : "", h = a;
    typeof a == "string" && a.includes(`
`) && (h = String(a).split(`
`).map(function(u, f) {
      return f === 0 ? u : "" + c + u;
    }).join(`
`)), i += h + s[o + 1];
  }), i;
}
var sn = {
  body: '<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/><text transform="translate(21.16 64.67)" style="fill: #fff; font-family: ArialMT, Arial; font-size: 67.75px;"><tspan x="0" y="0">?</tspan></text></g>',
  height: 80,
  width: 80
}, J = /* @__PURE__ */ new Map(), je = /* @__PURE__ */ new Map(), wn = /* @__PURE__ */ k((n) => {
  for (const e of n) {
    if (!e.name) throw new Error('Invalid icon loader. Must have a "name" property with non-empty string value.');
    if (z.debug("Registering icon pack:", e.name), "loader" in e) je.set(e.name, e.loader);
    else if ("icons" in e) J.set(e.name, e.icons);
    else
      throw z.error("Invalid icon loader:", e), new Error('Invalid icon loader. Must have either "icons" or "loader" property.');
  }
}, "registerIconPacks"), qe = /* @__PURE__ */ k(async (n, e) => {
  const r = lt(n, !0, e !== void 0);
  if (!r) throw new Error(`Invalid icon name: ${n}`);
  const s = r.prefix || e;
  if (!s) throw new Error(`Icon name must contain a prefix: ${n}`);
  let t = J.get(s);
  if (!t) {
    const i = je.get(s);
    if (!i) throw new Error(`Icon set not found: ${r.prefix}`);
    try {
      t = {
        ...await i(),
        prefix: s
      }, J.set(s, t);
    } catch (a) {
      throw z.error(a), new Error(`Failed to load icon set: ${r.prefix}`);
    }
  }
  const l = ct(t, r.name);
  if (!l) throw new Error(`Icon not found: ${n}`);
  return l;
}, "getRegisteredIconData"), ln = /* @__PURE__ */ k(async (n) => {
  try {
    return await qe(n), !0;
  } catch {
    return !1;
  }
}, "isIconAvailable"), an = /* @__PURE__ */ k(async (n, e, r) => {
  let s;
  try {
    s = await qe(n, e?.fallbackPrefix);
  } catch (l) {
    z.error(l), s = sn;
  }
  const t = kt(s, e);
  return ne(wt(mt(t.body), {
    ...t.attributes,
    ...r
  }), ve());
}, "getIconSVG");
function We(n, { markdownAutoWrap: e }) {
  return rn(n.replace(/<br\/>/g, `
`).replace(/\n{2,}/g, `
`));
}
k(We, "preprocessMarkdown");
function Fe(n) {
  return n.split(/\\n|\n|<br\s*\/?>/gi).map((e) => e.trim().match(/<[^>]+>|[^\s<>]+/g)?.map((r) => ({
    content: r,
    type: "normal"
  })) ?? []);
}
k(Fe, "nonMarkdownToLines");
function Ze(n, e = {}) {
  const r = We(n, e), s = d.lexer(r), t = [[]];
  let l = 0;
  function i(a, o = "normal") {
    a.type === "text" ? a.text.split(`
`).forEach((p, c) => {
      c !== 0 && (l++, t.push([])), p.split(" ").forEach((h) => {
        h = h.replace(/&#39;/g, "'"), h && t[l].push({
          content: h,
          type: o
        });
      });
    }) : a.type === "strong" || a.type === "em" ? a.tokens.forEach((p) => {
      i(p, a.type);
    }) : a.type === "html" && t[l].push({
      content: a.text,
      type: "normal"
    });
  }
  return k(i, "processNode"), s.forEach((a) => {
    a.type === "paragraph" ? a.tokens?.forEach((o) => {
      i(o);
    }) : a.type === "html" ? t[l].push({
      content: a.text,
      type: "normal"
    }) : t[l].push({
      content: a.raw,
      type: "normal"
    });
  }), t;
}
k(Ze, "markdownToLines");
function He(n) {
  return n ? `<p>${n.replace(/\\n|\n/g, "<br />")}</p>` : "";
}
k(He, "nonMarkdownToHTML");
function Ge(n, { markdownAutoWrap: e } = {}) {
  const r = d.lexer(n);
  function s(t) {
    return t.type === "text" ? e === !1 ? t.text.replace(/\n */g, "<br/>").replace(/ /g, "&nbsp;") : t.text.replace(/\n */g, "<br/>") : t.type === "strong" ? `<strong>${t.tokens?.map(s).join("")}</strong>` : t.type === "em" ? `<em>${t.tokens?.map(s).join("")}</em>` : t.type === "paragraph" ? `<p>${t.tokens?.map(s).join("")}</p>` : t.type === "space" ? "" : t.type === "html" ? `${t.text}` : t.type === "escape" ? t.text : (z.warn(`Unsupported markdown: ${t.type}`), t.raw);
  }
  return k(s, "output"), r.map(s).join("");
}
k(Ge, "markdownToHTML");
function Ne(n) {
  return Intl.Segmenter ? [...new Intl.Segmenter().segment(n)].map((e) => e.segment) : [...n];
}
k(Ne, "splitTextToChars");
function Qe(n, e) {
  return ue(n, [], Ne(e.content), e.type);
}
k(Qe, "splitWordToFitWidth");
function ue(n, e, r, s) {
  if (r.length === 0) return [{
    content: e.join(""),
    type: s
  }, {
    content: "",
    type: s
  }];
  const [t, ...l] = r, i = [...e, t];
  return n([{
    content: i.join(""),
    type: s
  }]) ? ue(n, i, l, s) : (e.length === 0 && t && (e.push(t), r.shift()), [{
    content: e.join(""),
    type: s
  }, {
    content: r.join(""),
    type: s
  }]);
}
k(ue, "splitWordToFitWidthRecursion");
function Ve(n, e) {
  if (n.some(({ content: r }) => r.includes(`
`))) throw new Error("splitLineToFitWidth does not support newlines in the line");
  return Z(n, e);
}
k(Ve, "splitLineToFitWidth");
function Z(n, e, r = [], s = []) {
  if (n.length === 0)
    return s.length > 0 && r.push(s), r.length > 0 ? r : [];
  let t = "";
  n[0].content === " " && (t = " ", n.shift());
  const l = n.shift() ?? {
    content: " ",
    type: "normal"
  }, i = [...s];
  if (t !== "" && i.push({
    content: t,
    type: "normal"
  }), i.push(l), e(i)) return Z(n, e, r, i);
  if (s.length > 0)
    r.push(s), n.unshift(l);
  else if (l.content) {
    const [a, o] = Qe(e, l);
    r.push([a]), o.content && n.unshift(o);
  }
  return Z(n, e, r);
}
k(Z, "splitLineToFitWidthRecursion");
function ee(n, e) {
  e && n.attr("style", e);
}
k(ee, "applyStyle");
var Re = 16384;
async function Ue(n, e, r, s, t = !1, l = ve()) {
  const i = n.append("foreignObject");
  i.attr("width", `${Math.min(10 * r, Re)}px`), i.attr("height", `${Math.min(10 * r, Re)}px`);
  const a = i.append("xhtml:div"), o = Ie(e.label) ? await et(e.label.replace(tt.lineBreakRegex, `
`), l) : ne(e.label, l), p = e.isNode ? "nodeLabel" : "edgeLabel", c = a.append("span");
  c.html(o), ee(c, e.labelStyle), c.attr("class", `${p} ${s}`), ee(a, e.labelStyle), a.style("display", "table-cell"), a.style("white-space", "nowrap"), a.style("line-height", "1.5"), r !== Number.POSITIVE_INFINITY && (a.style("max-width", r + "px"), a.style("text-align", "center")), a.attr("xmlns", "http://www.w3.org/1999/xhtml"), t && a.attr("class", "labelBkg");
  let h = a.node().getBoundingClientRect();
  return h.width === r && (a.style("display", "table"), a.style("white-space", "break-spaces"), a.style("width", r + "px"), h = a.node().getBoundingClientRect()), i.node();
}
k(Ue, "addHtmlSpan");
function N(n, e, r, s = !1) {
  const t = n.append("tspan").attr("class", "text-outer-tspan").attr("x", 0).attr("y", e * r - 0.1 + "em").attr("dy", r + "em");
  return s && t.attr("text-anchor", "middle"), t;
}
k(N, "createTspan");
function Ke(n, e, r) {
  const s = n.append("text"), t = N(s, 1, e);
  Q(t, r);
  const l = t.node().getComputedTextLength();
  return s.remove(), l;
}
k(Ke, "computeWidthOfText");
function on(n, e, r) {
  const s = n.append("text"), t = N(s, 1, e);
  Q(t, [{
    content: r,
    type: "normal"
  }]);
  const l = t.node()?.getBoundingClientRect();
  return l && s.remove(), l;
}
k(on, "computeDimensionOfText");
function Xe(n, e, r, s = !1, t = !1) {
  const i = e.append("g"), a = i.insert("rect").attr("class", "background").attr("style", "stroke: none"), o = i.append("text").attr("y", "-10.1");
  t && o.attr("text-anchor", "middle");
  let p = 0;
  for (const c of r) {
    const h = /* @__PURE__ */ k((f) => Ke(i, 1.1, f) <= n, "checkWidth"), u = h(c) ? [c] : Ve(c, h);
    for (const f of u)
      Q(N(o, p, 1.1, t), f), p++;
  }
  if (s) {
    const c = o.node().getBBox(), h = 2;
    return a.attr("x", c.x - h).attr("y", c.y - h).attr("width", c.width + 2 * h).attr("height", c.height + 2 * h), i.node();
  } else return o.node();
}
k(Xe, "createFormattedText");
function te(n) {
  return n.replace(/&(amp|lt|gt);/g, (e, r) => {
    switch (r) {
      case "amp":
        return "&";
      case "lt":
        return "<";
      case "gt":
        return ">";
      default:
        return e;
    }
  });
}
k(te, "decodeHTMLEntities");
function Q(n, e) {
  n.text(""), e.forEach((r, s) => {
    const t = n.append("tspan").attr("font-style", r.type === "em" ? "italic" : "normal").attr("class", "text-inner-tspan").attr("font-weight", r.type === "strong" ? "bold" : "normal");
    s === 0 ? t.text(te(r.content)) : t.text(" " + te(r.content));
  });
}
k(Q, "updateTextContentAndStyles");
async function Ye(n, e = {}) {
  const r = [];
  n.replace(/(fa[bklrs]?):fa-([\w-]+)/g, (t, l, i) => (r.push((async () => {
    const a = `${l}:${i}`;
    return await ln(a) ? await an(a, void 0, { class: "label-icon" }) : `<i class='${ne(t, e).replace(":", " ")}'></i>`;
  })()), t));
  const s = await Promise.all(r);
  return n.replace(/(fa[bklrs]?):fa-([\w-]+)/g, () => s.shift() ?? "");
}
k(Ye, "replaceIconSubstring");
var yn = /* @__PURE__ */ k(async (n, e = "", { style: r = "", isTitle: s = !1, classes: t = "", useHtmlLabels: l = !0, markdown: i = !0, isNode: a = !0, width: o = 200, addSvgBackground: p = !1 } = {}, c) => {
  if (z.debug("XYZ createText", e, r, s, t, l, a, "addSvgBackground: ", p), l) {
    const h = await Ye(ge(i ? Ge(e, c) : He(e)), c), u = e.replace(/\\\\/g, "\\");
    return await Ue(n, {
      isNode: a,
      label: Ie(e) ? u : h,
      labelStyle: r.replace("fill:", "color:")
    }, o, t, p, c);
  } else {
    const h = ge(e.replace(/<br\s*\/?>/g, "<br/>")), u = Xe(o, n, i ? Ze(h.replace("<br>", "<br/>"), c) : Fe(h), e ? p : !1, !a);
    if (a) {
      /stroke:/.exec(r) && (r = r.replace("stroke:", "lineColor:"));
      const f = r.replace(/stroke:[^;]+;?/g, "").replace(/stroke-width:[^;]+;?/g, "").replace(/fill:[^;]+;?/g, "").replace(/color:/g, "fill:");
      P(u).attr("style", f);
    } else {
      const f = r.replace(/stroke:[^;]+;?/g, "").replace(/stroke-width:[^;]+;?/g, "").replace(/fill:[^;]+;?/g, "").replace(/background:/g, "fill:");
      P(u).select("rect").attr("style", f.replace(/background:/g, "fill:"));
      const x = r.replace(/stroke:[^;]+;?/g, "").replace(/stroke-width:[^;]+;?/g, "").replace(/fill:[^;]+;?/g, "").replace(/color:/g, "fill:");
      P(u).select("text").attr("style", x);
    }
    return s ? P(u).selectAll("tspan.text-outer-tspan").classed("title-row", !0) : P(u).selectAll("tspan.text-outer-tspan").classed("row", !0), u;
  }
}, "createText");
export {
  sn as a,
  wn as i,
  yn as n,
  rn as o,
  an as r,
  on as t
};

//# sourceMappingURL=chunk-U2HBQHQK.js.map