@floegence/floe-webapp-core 0.81.0 → 0.81.2

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