@netlify/spark-ui 1.8.2-alpha.0 → 1.8.2

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