@powerlines/plugin-marked 0.1.93 → 0.1.95

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