@floegence/floe-webapp-core 0.81.5 → 0.82.0

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.
@@ -0,0 +1,1171 @@
1
+ function O() {
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 = O();
5
+ function ie(r) {
6
+ S = r;
7
+ }
8
+ var $ = { exec: () => null };
9
+ function p(r, e = "") {
10
+ let n = typeof r == "string" ? r : r.source, s = { replace: (t, i) => {
11
+ let l = typeof i == "string" ? i : i.source;
12
+ return l = l.replace(x.caret, "$1"), n = n.replace(t, l), s;
13
+ }, getRegex: () => new RegExp(n, e) };
14
+ return s;
15
+ }
16
+ var be = (() => {
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: (r) => new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}#`), htmlBeginRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}<(?:[a-z].*>|!--)`, "i"), blockquoteBeginRegex: (r) => new RegExp(`^ {0,${Math.min(3, r - 1)}}>`) }, we = /^(?:[ \t]*(?:\n|$))+/, me = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, ye = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, L = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, $e = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, N = / {0,3}(?:[*+-]|\d{1,9}[.)])/, ae = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, oe = p(ae).replace(/bull/g, 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(ae).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(), j = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Se = /^[^\n]+/, G = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Te = p(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", G).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), ze = p(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, N).getRegex(), v = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", X = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Ae = p("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", X).replace("tag", v).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), ce = p(j).replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), _e = p(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ce).getRegex(), F = { blockquote: _e, code: me, def: Te, fences: ye, heading: $e, hr: L, html: Ae, lheading: oe, list: ze, newline: we, paragraph: ce, table: $, text: Se }, ee = p("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), Pe = { ...F, lheading: Re, table: ee, paragraph: p(j).replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", ee).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex() }, Ie = { ...F, html: p(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", X).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: $, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: p(j).replace("hr", L).replace("heading", ` *#{1,6} *[^
23
+ ]`).replace("lheading", oe).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Le = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, qe = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, he = /^( {2,}|\\)\n(?!\s*$)/, Ee = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, T = /[\p{P}\p{S}]/u, Z = /[\s\p{P}\p{S}]/u, W = /[^\s\p{P}\p{S}]/u, Be = p(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, Z).getRegex(), pe = /(?!~)[\p{P}\p{S}]/u, Ce = /(?!~)[\s\p{P}\p{S}]/u, ve = /(?:[^\s\p{P}\p{S}]|~)/u, Ze = p(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", be ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), ue = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, De = p(ue, "u").replace(/punct/g, T).getRegex(), Me = p(ue, "u").replace(/punct/g, pe).getRegex(), ge = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Qe = p(ge, "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, Z).replace(/punct/g, T).getRegex(), He = p(ge, "gu").replace(/notPunctSpace/g, ve).replace(/punctSpace/g, Ce).replace(/punct/g, pe).getRegex(), Oe = p("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, Z).replace(/punct/g, T).getRegex(), Ne = p(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, T).getRegex(), je = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", Ge = p(je, "gu").replace(/notPunctSpace/g, W).replace(/punctSpace/g, Z).replace(/punct/g, T).getRegex(), Xe = p(/\\(punct)/, "gu").replace(/punct/g, T).getRegex(), Fe = 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(X).replace("(?:-->|$)", "-->").getRegex(), Ue = p("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", We).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), E = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, Je = p(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", E).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), ke = p(/^!?\[(label)\]\[(ref)\]/).replace("label", E).replace("ref", G).getRegex(), fe = p(/^!?\[(ref)\](?:\[\])?/).replace("ref", G).getRegex(), Ke = p("reflink|nolink(?!\\()", "g").replace("reflink", ke).replace("nolink", fe).getRegex(), te = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, U = { _backpedal: $, anyPunctuation: Xe, autolink: Fe, blockSkip: Ze, br: he, code: qe, del: $, delLDelim: $, delRDelim: $, emStrongLDelim: De, emStrongRDelimAst: Qe, emStrongRDelimUnd: Oe, escape: Le, link: Je, nolink: fe, punctuation: Be, reflink: ke, reflinkSearch: Ke, tag: Ue, text: Ee, url: $ }, Ve = { ...U, link: p(/^!?\[(label)\]\((.*?)\)/).replace("label", E).getRegex(), reflink: p(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", E).getRegex() }, M = { ...U, emStrongRDelimAst: He, emStrongLDelim: Me, delLDelim: Ne, delRDelim: Ge, url: p(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", te).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", te).getRegex() }, Ye = { ...M, br: p(he).replace("{2,}", "*").getRegex(), text: p(M.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, q = { normal: F, gfm: Pe, pedantic: Ie }, _ = { normal: U, gfm: M, breaks: Ye, pedantic: Ve }, et = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }, re = (r) => et[r];
24
+ function m(r, e) {
25
+ if (e) {
26
+ if (x.escapeTest.test(r)) return r.replace(x.escapeReplace, re);
27
+ } else if (x.escapeTestNoEncode.test(r)) return r.replace(x.escapeReplaceNoEncode, re);
28
+ return r;
29
+ }
30
+ function ne(r) {
31
+ try {
32
+ r = encodeURI(r).replace(x.percentDecode, "%");
33
+ } catch {
34
+ return null;
35
+ }
36
+ return r;
37
+ }
38
+ function se(r, e) {
39
+ let n = r.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 = n.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(r, e, n) {
50
+ let s = r.length;
51
+ if (s === 0) return "";
52
+ let t = 0;
53
+ for (; t < s && r.charAt(s - t - 1) === e; )
54
+ t++;
55
+ return r.slice(0, s - t);
56
+ }
57
+ function tt(r, e) {
58
+ if (r.indexOf(e[1]) === -1) return -1;
59
+ let n = 0;
60
+ for (let s = 0; s < r.length; s++) if (r[s] === "\\") s++;
61
+ else if (r[s] === e[0]) n++;
62
+ else if (r[s] === e[1] && (n--, n < 0)) return s;
63
+ return n > 0 ? -2 : -1;
64
+ }
65
+ function rt(r, e = 0) {
66
+ let n = e, s = "";
67
+ for (let t of r) if (t === " ") {
68
+ let i = 4 - n % 4;
69
+ s += " ".repeat(i), n += i;
70
+ } else s += t, n++;
71
+ return s;
72
+ }
73
+ function le(r, e, n, s, t) {
74
+ let i = e.href, l = e.title || null, o = r[1].replace(t.other.outputLinkReplace, "$1");
75
+ s.state.inLink = !0;
76
+ let a = { type: r[0].charAt(0) === "!" ? "image" : "link", raw: n, href: i, title: l, text: o, tokens: s.inlineTokens(o) };
77
+ return s.state.inLink = !1, a;
78
+ }
79
+ function nt(r, e, n) {
80
+ let s = r.match(n.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(n.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 B = class {
93
+ options;
94
+ rules;
95
+ lexer;
96
+ constructor(r) {
97
+ this.options = r || S;
98
+ }
99
+ space(r) {
100
+ let e = this.rules.block.newline.exec(r);
101
+ if (e && e[0].length > 0) return { type: "space", raw: e[0] };
102
+ }
103
+ code(r) {
104
+ let e = this.rules.block.code.exec(r);
105
+ if (e) {
106
+ let n = e[0].replace(this.rules.other.codeRemoveIndent, "");
107
+ return { type: "code", raw: e[0], codeBlockStyle: "indented", text: this.options.pedantic ? n : P(n, `
108
+ `) };
109
+ }
110
+ }
111
+ fences(r) {
112
+ let e = this.rules.block.fences.exec(r);
113
+ if (e) {
114
+ let n = e[0], s = nt(n, e[3] || "", this.rules);
115
+ return { type: "code", raw: n, lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2], text: s };
116
+ }
117
+ }
118
+ heading(r) {
119
+ let e = this.rules.block.heading.exec(r);
120
+ if (e) {
121
+ let n = e[2].trim();
122
+ if (this.rules.other.endingHash.test(n)) {
123
+ let s = P(n, "#");
124
+ (this.options.pedantic || !s || this.rules.other.endingSpaceChar.test(s)) && (n = s.trim());
125
+ }
126
+ return { type: "heading", raw: e[0], depth: e[1].length, text: n, tokens: this.lexer.inline(n) };
127
+ }
128
+ }
129
+ hr(r) {
130
+ let e = this.rules.block.hr.exec(r);
131
+ if (e) return { type: "hr", raw: P(e[0], `
132
+ `) };
133
+ }
134
+ blockquote(r) {
135
+ let e = this.rules.block.blockquote.exec(r);
136
+ if (e) {
137
+ let n = P(e[0], `
138
+ `).split(`
139
+ `), s = "", t = "", i = [];
140
+ for (; n.length > 0; ) {
141
+ let l = !1, o = [], a;
142
+ for (a = 0; a < n.length; a++) if (this.rules.other.blockquoteStart.test(n[a])) o.push(n[a]), l = !0;
143
+ else if (!l) o.push(n[a]);
144
+ else break;
145
+ n = n.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 k = this.lexer.state.top;
153
+ if (this.lexer.state.top = !0, this.lexer.blockTokens(c, i, !0), this.lexer.state.top = k, n.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
+ ` + n.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
+ ` + n.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, n = 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(r) {
175
+ let e = this.rules.block.list.exec(r);
176
+ if (e) {
177
+ let n = e[1].trim(), s = n.length > 1, t = { type: "list", raw: "", ordered: s, start: s ? +n.slice(0, -1) : "", loose: !1, items: [] };
178
+ n = s ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = s ? n : "[*+-]");
179
+ let i = this.rules.other.listItemRegex(n), l = !1;
180
+ for (; r; ) {
181
+ let a = !1, h = "", c = "";
182
+ if (!(e = i.exec(r)) || this.rules.block.hr.test(r)) break;
183
+ h = e[0], r = r.substring(h.length);
184
+ let k = rt(e[2].split(`
185
+ `, 1)[0], e[1].length), u = r.split(`
186
+ `, 1)[0], d = !k.trim(), f = 0;
187
+ if (this.options.pedantic ? (f = 2, c = k.trimStart()) : d ? f = e[1].length + 1 : (f = k.search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, c = k.slice(f), f += e[1].length), d && this.rules.other.blankLine.test(u) && (h += u + `
188
+ `, r = r.substring(u.length + 1), a = !0), !a) {
189
+ let y = this.rules.other.nextBulletRegex(f), K = this.rules.other.hrRegex(f), V = this.rules.other.fencesBeginRegex(f), Y = this.rules.other.headingBeginRegex(f), de = this.rules.other.htmlBeginRegex(f), xe = this.rules.other.blockquoteBeginRegex(f);
190
+ for (; r; ) {
191
+ let D = r.split(`
192
+ `, 1)[0], A;
193
+ if (u = D, this.options.pedantic ? (u = u.replace(this.rules.other.listReplaceNesting, " "), A = u) : A = u.replace(this.rules.other.tabCharGlobal, " "), V.test(u) || Y.test(u) || de.test(u) || xe.test(u) || y.test(u) || K.test(u)) break;
194
+ if (A.search(this.rules.other.nonSpaceChar) >= f || !u.trim()) c += `
195
+ ` + A.slice(f);
196
+ else {
197
+ if (d || k.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || V.test(k) || Y.test(k) || K.test(k)) break;
198
+ c += `
199
+ ` + u;
200
+ }
201
+ d = !u.trim(), h += D + `
202
+ `, r = r.substring(D.length + 1), k = A.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((k) => k.type === "space"), c = h.length > 0 && h.some((k) => this.rules.other.anyLine.test(k.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(r) {
239
+ let e = this.rules.block.html.exec(r);
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(r) {
243
+ let e = this.rules.block.def.exec(r);
244
+ if (e) {
245
+ let n = 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: n, raw: e[0], href: s, title: t };
247
+ }
248
+ }
249
+ table(r) {
250
+ let e = this.rules.block.table.exec(r);
251
+ if (!e || !this.rules.other.tableDelimiter.test(e[2])) return;
252
+ let n = se(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 (n.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 < n.length; l++) i.header.push({ text: n[l], tokens: this.lexer.inline(n[l]), header: !0, align: i.align[l] });
257
+ for (let l of t) i.rows.push(se(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(r) {
262
+ let e = this.rules.block.lheading.exec(r);
263
+ if (e) {
264
+ let n = e[1].trim();
265
+ return { type: "heading", raw: e[0], depth: e[2].charAt(0) === "=" ? 1 : 2, text: n, tokens: this.lexer.inline(n) };
266
+ }
267
+ }
268
+ paragraph(r) {
269
+ let e = this.rules.block.paragraph.exec(r);
270
+ if (e) {
271
+ let n = e[1].charAt(e[1].length - 1) === `
272
+ ` ? e[1].slice(0, -1) : e[1];
273
+ return { type: "paragraph", raw: e[0], text: n, tokens: this.lexer.inline(n) };
274
+ }
275
+ }
276
+ text(r) {
277
+ let e = this.rules.block.text.exec(r);
278
+ if (e) return { type: "text", raw: e[0], text: e[0], tokens: this.lexer.inline(e[0]) };
279
+ }
280
+ escape(r) {
281
+ let e = this.rules.inline.escape.exec(r);
282
+ if (e) return { type: "escape", raw: e[0], text: e[1] };
283
+ }
284
+ tag(r) {
285
+ let e = this.rules.inline.tag.exec(r);
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(r) {
289
+ let e = this.rules.inline.link.exec(r);
290
+ if (e) {
291
+ let n = e[2].trim();
292
+ if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
293
+ if (!this.rules.other.endAngleBracket.test(n)) return;
294
+ let i = P(n.slice(0, -1), "\\");
295
+ if ((n.length - i.length) % 2 === 0) return;
296
+ } else {
297
+ let i = tt(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(n) ? s = s.slice(1) : s = s.slice(1, -1)), le(e, { href: s && s.replace(this.rules.inline.anyPunctuation, "$1"), title: t && t.replace(this.rules.inline.anyPunctuation, "$1") }, e[0], this.lexer, this.rules);
310
+ }
311
+ }
312
+ reflink(r, e) {
313
+ let n;
314
+ if ((n = this.rules.inline.reflink.exec(r)) || (n = this.rules.inline.nolink.exec(r))) {
315
+ let s = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), t = e[s.toLowerCase()];
316
+ if (!t) {
317
+ let i = n[0].charAt(0);
318
+ return { type: "text", raw: i, text: i };
319
+ }
320
+ return le(n, t, n[0], this.lexer, this.rules);
321
+ }
322
+ }
323
+ emStrong(r, e, n = "") {
324
+ let s = this.rules.inline.emStrongLDelim.exec(r);
325
+ if (!(!s || !s[1] && !s[2] && !s[3] && !s[4] || s[4] && n.match(this.rules.other.unicodeAlphaNumeric)) && (!(s[1] || s[3]) || !n || this.rules.inline.punctuation.exec(n))) {
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 * r.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, k = r.slice(0, t + s.index + c + l);
339
+ if (Math.min(t, l) % 2) {
340
+ let d = k.slice(1, -1);
341
+ return { type: "em", raw: k, text: d, tokens: this.lexer.inlineTokens(d) };
342
+ }
343
+ let u = k.slice(2, -2);
344
+ return { type: "strong", raw: k, text: u, tokens: this.lexer.inlineTokens(u) };
345
+ }
346
+ }
347
+ }
348
+ codespan(r) {
349
+ let e = this.rules.inline.code.exec(r);
350
+ if (e) {
351
+ let n = e[2].replace(this.rules.other.newLineCharGlobal, " "), s = this.rules.other.nonSpaceChar.test(n), t = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
352
+ return s && t && (n = n.substring(1, n.length - 1)), { type: "codespan", raw: e[0], text: n };
353
+ }
354
+ }
355
+ br(r) {
356
+ let e = this.rules.inline.br.exec(r);
357
+ if (e) return { type: "br", raw: e[0] };
358
+ }
359
+ del(r, e, n = "") {
360
+ let s = this.rules.inline.delLDelim.exec(r);
361
+ if (s && (!s[1] || !n || this.rules.inline.punctuation.exec(n))) {
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 * r.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 = r.slice(0, t + s.index + h + l), k = c.slice(t, -t);
372
+ return { type: "del", raw: c, text: k, tokens: this.lexer.inlineTokens(k) };
373
+ }
374
+ }
375
+ }
376
+ autolink(r) {
377
+ let e = this.rules.inline.autolink.exec(r);
378
+ if (e) {
379
+ let n, s;
380
+ return e[2] === "@" ? (n = e[1], s = "mailto:" + n) : (n = e[1], s = n), { type: "link", raw: e[0], text: n, href: s, tokens: [{ type: "text", raw: n, text: n }] };
381
+ }
382
+ }
383
+ url(r) {
384
+ let e;
385
+ if (e = this.rules.inline.url.exec(r)) {
386
+ let n, s;
387
+ if (e[2] === "@") n = e[0], s = "mailto:" + n;
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
+ n = e[0], e[1] === "www." ? s = "http://" + e[0] : s = e[0];
394
+ }
395
+ return { type: "link", raw: e[0], text: n, href: s, tokens: [{ type: "text", raw: n, text: n }] };
396
+ }
397
+ }
398
+ inlineText(r) {
399
+ let e = this.rules.inline.text.exec(r);
400
+ if (e) {
401
+ let n = this.lexer.state.inRawBlock;
402
+ return { type: "text", raw: e[0], text: e[0], escaped: n };
403
+ }
404
+ }
405
+ }, b = class Q {
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 B(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
413
+ let n = { other: x, block: q.normal, inline: _.normal };
414
+ this.options.pedantic ? (n.block = q.pedantic, n.inline = _.pedantic) : this.options.gfm && (n.block = q.gfm, this.options.breaks ? n.inline = _.breaks : n.inline = _.gfm), this.tokenizer.rules = n;
415
+ }
416
+ static get rules() {
417
+ return { block: q, inline: _ };
418
+ }
419
+ static lex(e, n) {
420
+ return new Q(n).lex(e);
421
+ }
422
+ static lexInline(e, n) {
423
+ return new Q(n).inlineTokens(e);
424
+ }
425
+ lex(e) {
426
+ e = e.replace(x.carriageReturn, `
427
+ `), this.blockTokens(e, this.tokens);
428
+ for (let n = 0; n < this.inlineQueue.length; n++) {
429
+ let s = this.inlineQueue[n];
430
+ this.inlineTokens(s.src, s.tokens);
431
+ }
432
+ return this.inlineQueue = [], this.tokens;
433
+ }
434
+ blockTokens(e, n = [], 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, n)) ? (e = e.substring(t.raw.length), n.push(t), !0) : !1)) continue;
438
+ if (t = this.tokenizer.space(e)) {
439
+ e = e.substring(t.raw.length);
440
+ let l = n.at(-1);
441
+ t.raw.length === 1 && l !== void 0 ? l.raw += `
442
+ ` : n.push(t);
443
+ continue;
444
+ }
445
+ if (t = this.tokenizer.code(e)) {
446
+ e = e.substring(t.raw.length);
447
+ let l = n.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) : n.push(t);
452
+ continue;
453
+ }
454
+ if (t = this.tokenizer.fences(e)) {
455
+ e = e.substring(t.raw.length), n.push(t);
456
+ continue;
457
+ }
458
+ if (t = this.tokenizer.heading(e)) {
459
+ e = e.substring(t.raw.length), n.push(t);
460
+ continue;
461
+ }
462
+ if (t = this.tokenizer.hr(e)) {
463
+ e = e.substring(t.raw.length), n.push(t);
464
+ continue;
465
+ }
466
+ if (t = this.tokenizer.blockquote(e)) {
467
+ e = e.substring(t.raw.length), n.push(t);
468
+ continue;
469
+ }
470
+ if (t = this.tokenizer.list(e)) {
471
+ e = e.substring(t.raw.length), n.push(t);
472
+ continue;
473
+ }
474
+ if (t = this.tokenizer.html(e)) {
475
+ e = e.substring(t.raw.length), n.push(t);
476
+ continue;
477
+ }
478
+ if (t = this.tokenizer.def(e)) {
479
+ e = e.substring(t.raw.length);
480
+ let l = n.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 }, n.push(t));
485
+ continue;
486
+ }
487
+ if (t = this.tokenizer.table(e)) {
488
+ e = e.substring(t.raw.length), n.push(t);
489
+ continue;
490
+ }
491
+ if (t = this.tokenizer.lheading(e)) {
492
+ e = e.substring(t.raw.length), n.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 = n.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) : n.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 = n.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) : n.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, n;
528
+ }
529
+ inline(e, n = []) {
530
+ return this.inlineQueue.push({ src: e, tokens: n }), n;
531
+ }
532
+ inlineTokens(e, n = []) {
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, n)) ? (e = e.substring(a.raw.length), n.push(a), !0) : !1)) continue;
548
+ if (a = this.tokenizer.escape(e)) {
549
+ e = e.substring(a.raw.length), n.push(a);
550
+ continue;
551
+ }
552
+ if (a = this.tokenizer.tag(e)) {
553
+ e = e.substring(a.raw.length), n.push(a);
554
+ continue;
555
+ }
556
+ if (a = this.tokenizer.link(e)) {
557
+ e = e.substring(a.raw.length), n.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 = n.at(-1);
563
+ a.type === "text" && c?.type === "text" ? (c.raw += a.raw, c.text += a.text) : n.push(a);
564
+ continue;
565
+ }
566
+ if (a = this.tokenizer.emStrong(e, s, o)) {
567
+ e = e.substring(a.raw.length), n.push(a);
568
+ continue;
569
+ }
570
+ if (a = this.tokenizer.codespan(e)) {
571
+ e = e.substring(a.raw.length), n.push(a);
572
+ continue;
573
+ }
574
+ if (a = this.tokenizer.br(e)) {
575
+ e = e.substring(a.raw.length), n.push(a);
576
+ continue;
577
+ }
578
+ if (a = this.tokenizer.del(e, s, o)) {
579
+ e = e.substring(a.raw.length), n.push(a);
580
+ continue;
581
+ }
582
+ if (a = this.tokenizer.autolink(e)) {
583
+ e = e.substring(a.raw.length), n.push(a);
584
+ continue;
585
+ }
586
+ if (!this.state.inLink && (a = this.tokenizer.url(e))) {
587
+ e = e.substring(a.raw.length), n.push(a);
588
+ continue;
589
+ }
590
+ let h = e;
591
+ if (this.options.extensions?.startInline) {
592
+ let c = 1 / 0, k = e.slice(1), u;
593
+ this.options.extensions.startInline.forEach((d) => {
594
+ u = d.call({ lexer: this }, k), 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 = n.at(-1);
600
+ c?.type === "text" ? (c.raw += a.raw, c.text += a.text) : n.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 n;
612
+ }
613
+ }, C = class {
614
+ options;
615
+ parser;
616
+ constructor(r) {
617
+ this.options = r || S;
618
+ }
619
+ space(r) {
620
+ return "";
621
+ }
622
+ code({ text: r, lang: e, escaped: n }) {
623
+ let s = (e || "").match(x.notSpaceStart)?.[0], t = r.replace(x.endingNewline, "") + `
624
+ `;
625
+ return s ? '<pre><code class="language-' + m(s) + '">' + (n ? t : m(t, !0)) + `</code></pre>
626
+ ` : "<pre><code>" + (n ? t : m(t, !0)) + `</code></pre>
627
+ `;
628
+ }
629
+ blockquote({ tokens: r }) {
630
+ return `<blockquote>
631
+ ${this.parser.parse(r)}</blockquote>
632
+ `;
633
+ }
634
+ html({ text: r }) {
635
+ return r;
636
+ }
637
+ def(r) {
638
+ return "";
639
+ }
640
+ heading({ tokens: r, depth: e }) {
641
+ return `<h${e}>${this.parser.parseInline(r)}</h${e}>
642
+ `;
643
+ }
644
+ hr(r) {
645
+ return `<hr>
646
+ `;
647
+ }
648
+ list(r) {
649
+ let e = r.ordered, n = r.start, s = "";
650
+ for (let l = 0; l < r.items.length; l++) {
651
+ let o = r.items[l];
652
+ s += this.listitem(o);
653
+ }
654
+ let t = e ? "ol" : "ul", i = e && n !== 1 ? ' start="' + n + '"' : "";
655
+ return "<" + t + i + `>
656
+ ` + s + "</" + t + `>
657
+ `;
658
+ }
659
+ listitem(r) {
660
+ return `<li>${this.parser.parse(r.tokens)}</li>
661
+ `;
662
+ }
663
+ checkbox({ checked: r }) {
664
+ return "<input " + (r ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
665
+ }
666
+ paragraph({ tokens: r }) {
667
+ return `<p>${this.parser.parseInline(r)}</p>
668
+ `;
669
+ }
670
+ table(r) {
671
+ let e = "", n = "";
672
+ for (let t = 0; t < r.header.length; t++) n += this.tablecell(r.header[t]);
673
+ e += this.tablerow({ text: n });
674
+ let s = "";
675
+ for (let t = 0; t < r.rows.length; t++) {
676
+ let i = r.rows[t];
677
+ n = "";
678
+ for (let l = 0; l < i.length; l++) n += this.tablecell(i[l]);
679
+ s += this.tablerow({ text: n });
680
+ }
681
+ return s && (s = `<tbody>${s}</tbody>`), `<table>
682
+ <thead>
683
+ ` + e + `</thead>
684
+ ` + s + `</table>
685
+ `;
686
+ }
687
+ tablerow({ text: r }) {
688
+ return `<tr>
689
+ ${r}</tr>
690
+ `;
691
+ }
692
+ tablecell(r) {
693
+ let e = this.parser.parseInline(r.tokens), n = r.header ? "th" : "td";
694
+ return (r.align ? `<${n} align="${r.align}">` : `<${n}>`) + e + `</${n}>
695
+ `;
696
+ }
697
+ strong({ tokens: r }) {
698
+ return `<strong>${this.parser.parseInline(r)}</strong>`;
699
+ }
700
+ em({ tokens: r }) {
701
+ return `<em>${this.parser.parseInline(r)}</em>`;
702
+ }
703
+ codespan({ text: r }) {
704
+ return `<code>${m(r, !0)}</code>`;
705
+ }
706
+ br(r) {
707
+ return "<br>";
708
+ }
709
+ del({ tokens: r }) {
710
+ return `<del>${this.parser.parseInline(r)}</del>`;
711
+ }
712
+ link({ href: r, title: e, tokens: n }) {
713
+ let s = this.parser.parseInline(n), t = ne(r);
714
+ if (t === null) return s;
715
+ r = t;
716
+ let i = '<a href="' + r + '"';
717
+ return e && (i += ' title="' + m(e) + '"'), i += ">" + s + "</a>", i;
718
+ }
719
+ image({ href: r, title: e, text: n, tokens: s }) {
720
+ s && (n = this.parser.parseInline(s, this.parser.textRenderer));
721
+ let t = ne(r);
722
+ if (t === null) return m(n);
723
+ r = t;
724
+ let i = `<img src="${r}" alt="${m(n)}"`;
725
+ return e && (i += ` title="${m(e)}"`), i += ">", i;
726
+ }
727
+ text(r) {
728
+ return "tokens" in r && r.tokens ? this.parser.parseInline(r.tokens) : "escaped" in r && r.escaped ? r.text : m(r.text);
729
+ }
730
+ }, J = class {
731
+ strong({ text: r }) {
732
+ return r;
733
+ }
734
+ em({ text: r }) {
735
+ return r;
736
+ }
737
+ codespan({ text: r }) {
738
+ return r;
739
+ }
740
+ del({ text: r }) {
741
+ return r;
742
+ }
743
+ html({ text: r }) {
744
+ return r;
745
+ }
746
+ text({ text: r }) {
747
+ return r;
748
+ }
749
+ link({ text: r }) {
750
+ return "" + r;
751
+ }
752
+ image({ text: r }) {
753
+ return "" + r;
754
+ }
755
+ br() {
756
+ return "";
757
+ }
758
+ checkbox({ raw: r }) {
759
+ return r;
760
+ }
761
+ }, w = class H {
762
+ options;
763
+ renderer;
764
+ textRenderer;
765
+ constructor(e) {
766
+ this.options = e || S, this.options.renderer = this.options.renderer || new C(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new J();
767
+ }
768
+ static parse(e, n) {
769
+ return new H(n).parse(e);
770
+ }
771
+ static parseInline(e, n) {
772
+ return new H(n).parseInline(e);
773
+ }
774
+ parse(e) {
775
+ this.renderer.parser = this;
776
+ let n = "";
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
+ n += o || "";
783
+ continue;
784
+ }
785
+ }
786
+ let i = t;
787
+ switch (i.type) {
788
+ case "space": {
789
+ n += this.renderer.space(i);
790
+ break;
791
+ }
792
+ case "hr": {
793
+ n += this.renderer.hr(i);
794
+ break;
795
+ }
796
+ case "heading": {
797
+ n += this.renderer.heading(i);
798
+ break;
799
+ }
800
+ case "code": {
801
+ n += this.renderer.code(i);
802
+ break;
803
+ }
804
+ case "table": {
805
+ n += this.renderer.table(i);
806
+ break;
807
+ }
808
+ case "blockquote": {
809
+ n += this.renderer.blockquote(i);
810
+ break;
811
+ }
812
+ case "list": {
813
+ n += this.renderer.list(i);
814
+ break;
815
+ }
816
+ case "checkbox": {
817
+ n += this.renderer.checkbox(i);
818
+ break;
819
+ }
820
+ case "html": {
821
+ n += this.renderer.html(i);
822
+ break;
823
+ }
824
+ case "def": {
825
+ n += this.renderer.def(i);
826
+ break;
827
+ }
828
+ case "paragraph": {
829
+ n += this.renderer.paragraph(i);
830
+ break;
831
+ }
832
+ case "text": {
833
+ n += 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 n;
844
+ }
845
+ parseInline(e, n = 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 += n.text(l);
861
+ break;
862
+ }
863
+ case "html": {
864
+ s += n.html(l);
865
+ break;
866
+ }
867
+ case "link": {
868
+ s += n.link(l);
869
+ break;
870
+ }
871
+ case "image": {
872
+ s += n.image(l);
873
+ break;
874
+ }
875
+ case "checkbox": {
876
+ s += n.checkbox(l);
877
+ break;
878
+ }
879
+ case "strong": {
880
+ s += n.strong(l);
881
+ break;
882
+ }
883
+ case "em": {
884
+ s += n.em(l);
885
+ break;
886
+ }
887
+ case "codespan": {
888
+ s += n.codespan(l);
889
+ break;
890
+ }
891
+ case "br": {
892
+ s += n.br(l);
893
+ break;
894
+ }
895
+ case "del": {
896
+ s += n.del(l);
897
+ break;
898
+ }
899
+ case "text": {
900
+ s += n.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
+ }, I = class {
913
+ options;
914
+ block;
915
+ constructor(r) {
916
+ this.options = r || S;
917
+ }
918
+ static passThroughHooks = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"]);
919
+ static passThroughHooksRespectAsync = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"]);
920
+ preprocess(r) {
921
+ return r;
922
+ }
923
+ postprocess(r) {
924
+ return r;
925
+ }
926
+ processAllTokens(r) {
927
+ return r;
928
+ }
929
+ emStrongMask(r) {
930
+ return r;
931
+ }
932
+ provideLexer(r = this.block) {
933
+ return r ? b.lex : b.lexInline;
934
+ }
935
+ provideParser(r = this.block) {
936
+ return r ? w.parse : w.parseInline;
937
+ }
938
+ }, st = class {
939
+ defaults = O();
940
+ options = this.setOptions;
941
+ parse = this.parseMarkdown(!0);
942
+ parseInline = this.parseMarkdown(!1);
943
+ Parser = w;
944
+ Renderer = C;
945
+ TextRenderer = J;
946
+ Lexer = b;
947
+ Tokenizer = B;
948
+ Hooks = I;
949
+ constructor(...r) {
950
+ this.use(...r);
951
+ }
952
+ walkTokens(r, e) {
953
+ let n = [];
954
+ for (let s of r) switch (n = n.concat(e.call(this, s)), s.type) {
955
+ case "table": {
956
+ let t = s;
957
+ for (let i of t.header) n = n.concat(this.walkTokens(i.tokens, e));
958
+ for (let i of t.rows) for (let l of i) n = n.concat(this.walkTokens(l.tokens, e));
959
+ break;
960
+ }
961
+ case "list": {
962
+ let t = s;
963
+ n = n.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
+ n = n.concat(this.walkTokens(l, e));
971
+ }) : t.tokens && (n = n.concat(this.walkTokens(t.tokens, e)));
972
+ }
973
+ }
974
+ return n;
975
+ }
976
+ use(...r) {
977
+ let e = this.defaults.extensions || { renderers: {}, childTokens: {} };
978
+ return r.forEach((n) => {
979
+ let s = { ...n };
980
+ if (s.async = this.defaults.async || s.async || !1, n.extensions && (n.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), n.renderer) {
996
+ let t = this.defaults.renderer || new C(this.defaults);
997
+ for (let i in n.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 = n.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 (n.tokenizer) {
1009
+ let t = this.defaults.tokenizer || new B(this.defaults);
1010
+ for (let i in n.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 = n.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 (n.hooks) {
1022
+ let t = this.defaults.hooks || new I();
1023
+ for (let i in n.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 = n.hooks[l], a = t[l];
1027
+ I.passThroughHooks.has(i) ? t[l] = (h) => {
1028
+ if (this.defaults.async && I.passThroughHooksRespectAsync.has(i)) return (async () => {
1029
+ let k = await o.call(t, h);
1030
+ return a.call(t, k);
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 k = await o.apply(t, h);
1037
+ return k === !1 && (k = await a.apply(t, h)), k;
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 (n.walkTokens) {
1046
+ let t = this.defaults.walkTokens, i = n.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(r) {
1056
+ return this.defaults = { ...this.defaults, ...r }, this;
1057
+ }
1058
+ lexer(r, e) {
1059
+ return b.lex(r, e ?? this.defaults);
1060
+ }
1061
+ parser(r, e) {
1062
+ return w.parse(r, e ?? this.defaults);
1063
+ }
1064
+ parseMarkdown(r) {
1065
+ return (e, n) => {
1066
+ let s = { ...n }, 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 = r), t.async) return (async () => {
1071
+ let l = t.hooks ? await t.hooks.preprocess(e) : e, o = await (t.hooks ? await t.hooks.provideLexer(r) : r ? 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(r) : r ? 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(r) : r ? 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(r) : r ? 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(r, e) {
1088
+ return (n) => {
1089
+ if (n.message += `
1090
+ Please report this to https://github.com/markedjs/marked.`, r) {
1091
+ let s = "<p>An error occurred:</p><pre>" + m(n.message + "", !0) + "</pre>";
1092
+ return e ? Promise.resolve(s) : s;
1093
+ }
1094
+ if (e) return Promise.reject(n);
1095
+ throw n;
1096
+ };
1097
+ }
1098
+ }, R = new st();
1099
+ function g(r, e) {
1100
+ return R.parse(r, e);
1101
+ }
1102
+ g.options = g.setOptions = function(r) {
1103
+ return R.setOptions(r), g.defaults = R.defaults, ie(g.defaults), g;
1104
+ };
1105
+ g.getDefaults = O;
1106
+ g.defaults = S;
1107
+ g.use = function(...r) {
1108
+ return R.use(...r), g.defaults = R.defaults, ie(g.defaults), g;
1109
+ };
1110
+ g.walkTokens = function(r, e) {
1111
+ return R.walkTokens(r, e);
1112
+ };
1113
+ g.parseInline = R.parseInline;
1114
+ g.Parser = w;
1115
+ g.parser = w.parse;
1116
+ g.Renderer = C;
1117
+ g.TextRenderer = J;
1118
+ g.Lexer = b;
1119
+ g.lexer = b.lex;
1120
+ g.Tokenizer = B;
1121
+ g.Hooks = I;
1122
+ g.parse = g;
1123
+ g.options;
1124
+ g.setOptions;
1125
+ g.use;
1126
+ g.walkTokens;
1127
+ g.parseInline;
1128
+ w.parse;
1129
+ b.lex;
1130
+ g.setOptions({
1131
+ gfm: !0,
1132
+ breaks: !0
1133
+ });
1134
+ const z = new g.Renderer();
1135
+ z.code = function(r) {
1136
+ const e = r.lang || "text", n = r.text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1137
+ return `<pre class="chat-md-code-block" data-language="${e}"><code>${n}</code></pre>`;
1138
+ };
1139
+ z.codespan = function(r) {
1140
+ return `<code class="chat-md-inline-code">${r.text}</code>`;
1141
+ };
1142
+ z.link = function(r) {
1143
+ const e = r.title ? ` title="${r.title}"` : "";
1144
+ return `<a href="${r.href}"${e} target="_blank" rel="noopener noreferrer" class="chat-md-link">${r.text}</a>`;
1145
+ };
1146
+ z.image = function(r) {
1147
+ const e = r.title ? ` title="${r.title}"` : "";
1148
+ return `<img src="${r.href}" alt="${r.text}"${e} class="chat-md-image" loading="lazy" />`;
1149
+ };
1150
+ z.blockquote = function(r) {
1151
+ return `<blockquote class="chat-md-blockquote">${r.text}</blockquote>`;
1152
+ };
1153
+ g.use({ renderer: z });
1154
+ function lt(r) {
1155
+ return g.parse(r, { async: !1 });
1156
+ }
1157
+ postMessage({ type: "ready" });
1158
+ addEventListener("message", (r) => {
1159
+ const { id: e, content: n } = r.data;
1160
+ try {
1161
+ const s = lt(n);
1162
+ postMessage({ id: e, html: s });
1163
+ } catch (s) {
1164
+ const t = {
1165
+ id: e,
1166
+ html: "",
1167
+ error: s instanceof Error ? s.message : "Failed to render markdown"
1168
+ };
1169
+ postMessage(t);
1170
+ }
1171
+ });