@powerlines/plugin-marked 0.1.92 → 0.1.94

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