@powerlines/plugin-marked 0.1.305 → 0.1.307

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