@clevertask/scribe 0.0.10 → 0.0.11

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 (30) hide show
  1. package/dist/browser-BJWkU9cc.js +2106 -0
  2. package/dist/clsx-OuTLNxxd.js +16 -0
  3. package/dist/components/Menu/BarMenu.js +119 -4
  4. package/dist/components/Menu/BubbleMenu.js +1 -1
  5. package/dist/components/Scribe/extension/emoji/EmojiList.d.ts +1 -0
  6. package/dist/components/Scribe/extension/emoji/EmojiList.js +35 -0
  7. package/dist/components/Scribe/extension/emoji/suggest.d.ts +16 -0
  8. package/dist/components/Scribe/extension/emoji/suggest.js +40 -0
  9. package/dist/components/Scribe/extension/extension-link.js +208 -200
  10. package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
  11. package/dist/components/Scribe/extension/index.js +30 -24
  12. package/dist/components/Scribe/extension/math-extension.js +1 -1
  13. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +7 -5
  14. package/dist/components/Scribe/extension/slashCommand/index.js +4 -153
  15. package/dist/components/Scribe/extension/slashCommand/renderItems.d.ts +1 -1
  16. package/dist/components/Scribe/extension/slashCommand/renderItems.js +14 -14
  17. package/dist/components/Scribe/index.js +18 -17
  18. package/dist/index-BqFHWqw6.js +156 -0
  19. package/dist/{index-C3_lI_rP.js → index-C_aWB8qt.js} +449 -427
  20. package/dist/index-CasgquAq.js +39381 -0
  21. package/dist/{index-Gm-3o3nq.js → index-DeZ8laak.js} +1124 -1083
  22. package/dist/main.css +60 -2
  23. package/dist/{turndown.browser.es-BSoGafvq.js → turndown.browser.es-C1wFFc_i.js} +342 -334
  24. package/dist/utils/create-scribe-editor.js +2 -2
  25. package/dist/utils/html-to-markdown.js +1 -1
  26. package/dist/utils/markdown-to-html.js +1 -1
  27. package/package.json +33 -31
  28. package/dist/BarMenu-SiPgB2ow.js +0 -134
  29. package/dist/browser-DEobZXxB.js +0 -2099
  30. package/dist/index-NRgJVTH-.js +0 -7576
@@ -1,2099 +0,0 @@
1
- var ai = Object.defineProperty;
2
- var ci = (h, e, t) => e in h ? ai(h, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[e] = t;
3
- var y = (h, e, t) => ci(h, typeof e != "symbol" ? e + "" : e, t);
4
- function gt() {
5
- return {
6
- async: !1,
7
- breaks: !1,
8
- extensions: null,
9
- gfm: !0,
10
- hooks: null,
11
- pedantic: !1,
12
- renderer: null,
13
- silent: !1,
14
- tokenizer: null,
15
- walkTokens: null
16
- };
17
- }
18
- let re = gt();
19
- function fn(h) {
20
- re = h;
21
- }
22
- const Ee = { exec: () => null };
23
- function E(h, e = "") {
24
- let t = typeof h == "string" ? h : h.source;
25
- const n = {
26
- replace: (o, r) => {
27
- let s = typeof r == "string" ? r : r.source;
28
- return s = s.replace(H.caret, "$1"), t = t.replace(o, s), n;
29
- },
30
- getRegex: () => new RegExp(t, e)
31
- };
32
- return n;
33
- }
34
- const H = {
35
- codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
36
- outputLinkReplace: /\\([\[\]])/g,
37
- indentCodeCompensation: /^(\s+)(?:```)/,
38
- beginningSpace: /^\s+/,
39
- endingHash: /#$/,
40
- startingSpaceChar: /^ /,
41
- endingSpaceChar: / $/,
42
- nonSpaceChar: /[^ ]/,
43
- newLineCharGlobal: /\n/g,
44
- tabCharGlobal: /\t/g,
45
- multipleSpaceGlobal: /\s+/g,
46
- blankLine: /^[ \t]*$/,
47
- doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
48
- blockquoteStart: /^ {0,3}>/,
49
- blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
50
- blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
51
- listReplaceTabs: /^\t+/,
52
- listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
53
- listIsTask: /^\[[ xX]\] /,
54
- listReplaceTask: /^\[[ xX]\] +/,
55
- anyLine: /\n.*\n/,
56
- hrefBrackets: /^<(.*)>$/,
57
- tableDelimiter: /[:|]/,
58
- tableAlignChars: /^\||\| *$/g,
59
- tableRowBlankLine: /\n[ \t]*$/,
60
- tableAlignRight: /^ *-+: *$/,
61
- tableAlignCenter: /^ *:-+: *$/,
62
- tableAlignLeft: /^ *:-+ *$/,
63
- startATag: /^<a /i,
64
- endATag: /^<\/a>/i,
65
- startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
66
- endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
67
- startAngleBracket: /^</,
68
- endAngleBracket: />$/,
69
- pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
70
- unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
71
- escapeTest: /[&<>"']/,
72
- escapeReplace: /[&<>"']/g,
73
- escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
74
- escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
75
- unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,
76
- caret: /(^|[^\[])\^/g,
77
- percentDecode: /%25/g,
78
- findPipe: /\|/g,
79
- splitPipe: / \|/,
80
- slashPipe: /\\\|/g,
81
- carriageReturn: /\r\n|\r/g,
82
- spaceLine: /^ +$/gm,
83
- notSpaceStart: /^\S*/,
84
- endingNewline: /\n$/,
85
- listItemRegex: (h) => new RegExp(`^( {0,3}${h})((?:[ ][^\\n]*)?(?:\\n|$))`),
86
- nextBulletRegex: (h) => new RegExp(`^ {0,${Math.min(3, h - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),
87
- hrRegex: (h) => new RegExp(`^ {0,${Math.min(3, h - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),
88
- fencesBeginRegex: (h) => new RegExp(`^ {0,${Math.min(3, h - 1)}}(?:\`\`\`|~~~)`),
89
- headingBeginRegex: (h) => new RegExp(`^ {0,${Math.min(3, h - 1)}}#`),
90
- htmlBeginRegex: (h) => new RegExp(`^ {0,${Math.min(3, h - 1)}}<(?:[a-z].*>|!--)`, "i")
91
- }, ui = /^(?:[ \t]*(?:\n|$))+/, pi = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, hi = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, ye = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, fi = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, dt = /(?:[*+-]|\d{1,9}[.)])/, gn = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, dn = E(gn).replace(/bull/g, dt).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(), gi = E(gn).replace(/bull/g, dt).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(), mt = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, di = /^[^\n]+/, kt = /(?!\s*\])(?:\\.|[^\[\]\\])+/, mi = E(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", kt).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), ki = E(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, dt).getRegex(), Ge = "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", bt = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, bi = E("^ {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", bt).replace("tag", Ge).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), mn = E(mt).replace("hr", ye).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", Ge).getRegex(), xi = E(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", mn).getRegex(), xt = {
92
- blockquote: xi,
93
- code: pi,
94
- def: mi,
95
- fences: hi,
96
- heading: fi,
97
- hr: ye,
98
- html: bi,
99
- lheading: dn,
100
- list: ki,
101
- newline: ui,
102
- paragraph: mn,
103
- table: Ee,
104
- text: di
105
- }, sn = E("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", ye).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", Ge).getRegex(), Ti = {
106
- ...xt,
107
- lheading: gi,
108
- table: sn,
109
- paragraph: E(mt).replace("hr", ye).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", sn).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", Ge).getRegex()
110
- }, wi = {
111
- ...xt,
112
- html: E(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", bt).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(),
113
- def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
114
- heading: /^(#{1,6})(.*)(?:\n+|$)/,
115
- fences: Ee,
116
- // fences not supported
117
- lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
118
- paragraph: E(mt).replace("hr", ye).replace("heading", ` *#{1,6} *[^
119
- ]`).replace("lheading", dn).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
120
- }, _i = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ai = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, kn = /^( {2,}|\\)\n(?!\s*$)/, Ei = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, qe = /[\p{P}\p{S}]/u, Tt = /[\s\p{P}\p{S}]/u, bn = /[^\s\p{P}\p{S}]/u, Si = E(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, Tt).getRegex(), xn = /(?!~)[\p{P}\p{S}]/u, yi = /(?!~)[\s\p{P}\p{S}]/u, Ri = /(?:[^\s\p{P}\p{S}]|~)/u, Li = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g, Tn = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, Ii = E(Tn, "u").replace(/punct/g, qe).getRegex(), Ci = E(Tn, "u").replace(/punct/g, xn).getRegex(), wn = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Oi = E(wn, "gu").replace(/notPunctSpace/g, bn).replace(/punctSpace/g, Tt).replace(/punct/g, qe).getRegex(), Di = E(wn, "gu").replace(/notPunctSpace/g, Ri).replace(/punctSpace/g, yi).replace(/punct/g, xn).getRegex(), Ni = E("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, bn).replace(/punctSpace/g, Tt).replace(/punct/g, qe).getRegex(), Pi = E(/\\(punct)/, "gu").replace(/punct/g, qe).getRegex(), Mi = E(/^<(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(), zi = E(bt).replace("(?:-->|$)", "-->").getRegex(), vi = E("^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", zi).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Be = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, $i = E(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", Be).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), _n = E(/^!?\[(label)\]\[(ref)\]/).replace("label", Be).replace("ref", kt).getRegex(), An = E(/^!?\[(ref)\](?:\[\])?/).replace("ref", kt).getRegex(), Ui = E("reflink|nolink(?!\\()", "g").replace("reflink", _n).replace("nolink", An).getRegex(), wt = {
121
- _backpedal: Ee,
122
- // only used for GFM url
123
- anyPunctuation: Pi,
124
- autolink: Mi,
125
- blockSkip: Li,
126
- br: kn,
127
- code: Ai,
128
- del: Ee,
129
- emStrongLDelim: Ii,
130
- emStrongRDelimAst: Oi,
131
- emStrongRDelimUnd: Ni,
132
- escape: _i,
133
- link: $i,
134
- nolink: An,
135
- punctuation: Si,
136
- reflink: _n,
137
- reflinkSearch: Ui,
138
- tag: vi,
139
- text: Ei,
140
- url: Ee
141
- }, Bi = {
142
- ...wt,
143
- link: E(/^!?\[(label)\]\((.*?)\)/).replace("label", Be).getRegex(),
144
- reflink: E(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Be).getRegex()
145
- }, ft = {
146
- ...wt,
147
- emStrongRDelimAst: Di,
148
- emStrongLDelim: Ci,
149
- url: E(/^((?: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(),
150
- _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
151
- del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
152
- text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
153
- }, Fi = {
154
- ...ft,
155
- br: E(kn).replace("{2,}", "*").getRegex(),
156
- text: E(ft.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
157
- }, Ue = {
158
- normal: xt,
159
- gfm: Ti,
160
- pedantic: wi
161
- }, _e = {
162
- normal: wt,
163
- gfm: ft,
164
- breaks: Fi,
165
- pedantic: Bi
166
- }, Hi = {
167
- "&": "&amp;",
168
- "<": "&lt;",
169
- ">": "&gt;",
170
- '"': "&quot;",
171
- "'": "&#39;"
172
- }, on = (h) => Hi[h];
173
- function X(h, e) {
174
- if (e) {
175
- if (H.escapeTest.test(h))
176
- return h.replace(H.escapeReplace, on);
177
- } else if (H.escapeTestNoEncode.test(h))
178
- return h.replace(H.escapeReplaceNoEncode, on);
179
- return h;
180
- }
181
- function ln(h) {
182
- try {
183
- h = encodeURI(h).replace(H.percentDecode, "%");
184
- } catch {
185
- return null;
186
- }
187
- return h;
188
- }
189
- function an(h, e) {
190
- var r;
191
- const t = h.replace(H.findPipe, (s, l, u) => {
192
- let a = !1, c = l;
193
- for (; --c >= 0 && u[c] === "\\"; )
194
- a = !a;
195
- return a ? "|" : " |";
196
- }), n = t.split(H.splitPipe);
197
- let o = 0;
198
- if (n[0].trim() || n.shift(), n.length > 0 && !((r = n.at(-1)) != null && r.trim()) && n.pop(), e)
199
- if (n.length > e)
200
- n.splice(e);
201
- else
202
- for (; n.length < e; )
203
- n.push("");
204
- for (; o < n.length; o++)
205
- n[o] = n[o].trim().replace(H.slashPipe, "|");
206
- return n;
207
- }
208
- function Ae(h, e, t) {
209
- const n = h.length;
210
- if (n === 0)
211
- return "";
212
- let o = 0;
213
- for (; o < n && h.charAt(n - o - 1) === e; )
214
- o++;
215
- return h.slice(0, n - o);
216
- }
217
- function Gi(h, e) {
218
- if (h.indexOf(e[1]) === -1)
219
- return -1;
220
- let t = 0;
221
- for (let n = 0; n < h.length; n++)
222
- if (h[n] === "\\")
223
- n++;
224
- else if (h[n] === e[0])
225
- t++;
226
- else if (h[n] === e[1] && (t--, t < 0))
227
- return n;
228
- return t > 0 ? -2 : -1;
229
- }
230
- function cn(h, e, t, n, o) {
231
- const r = e.href, s = e.title || null, l = h[1].replace(o.other.outputLinkReplace, "$1");
232
- n.state.inLink = !0;
233
- const u = {
234
- type: h[0].charAt(0) === "!" ? "image" : "link",
235
- raw: t,
236
- href: r,
237
- title: s,
238
- text: l,
239
- tokens: n.inlineTokens(l)
240
- };
241
- return n.state.inLink = !1, u;
242
- }
243
- function qi(h, e, t) {
244
- const n = h.match(t.other.indentCodeCompensation);
245
- if (n === null)
246
- return e;
247
- const o = n[1];
248
- return e.split(`
249
- `).map((r) => {
250
- const s = r.match(t.other.beginningSpace);
251
- if (s === null)
252
- return r;
253
- const [l] = s;
254
- return l.length >= o.length ? r.slice(o.length) : r;
255
- }).join(`
256
- `);
257
- }
258
- class Fe {
259
- // set by the lexer
260
- constructor(e) {
261
- y(this, "options");
262
- y(this, "rules");
263
- // set by the lexer
264
- y(this, "lexer");
265
- this.options = e || re;
266
- }
267
- space(e) {
268
- const t = this.rules.block.newline.exec(e);
269
- if (t && t[0].length > 0)
270
- return {
271
- type: "space",
272
- raw: t[0]
273
- };
274
- }
275
- code(e) {
276
- const t = this.rules.block.code.exec(e);
277
- if (t) {
278
- const n = t[0].replace(this.rules.other.codeRemoveIndent, "");
279
- return {
280
- type: "code",
281
- raw: t[0],
282
- codeBlockStyle: "indented",
283
- text: this.options.pedantic ? n : Ae(n, `
284
- `)
285
- };
286
- }
287
- }
288
- fences(e) {
289
- const t = this.rules.block.fences.exec(e);
290
- if (t) {
291
- const n = t[0], o = qi(n, t[3] || "", this.rules);
292
- return {
293
- type: "code",
294
- raw: n,
295
- lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
296
- text: o
297
- };
298
- }
299
- }
300
- heading(e) {
301
- const t = this.rules.block.heading.exec(e);
302
- if (t) {
303
- let n = t[2].trim();
304
- if (this.rules.other.endingHash.test(n)) {
305
- const o = Ae(n, "#");
306
- (this.options.pedantic || !o || this.rules.other.endingSpaceChar.test(o)) && (n = o.trim());
307
- }
308
- return {
309
- type: "heading",
310
- raw: t[0],
311
- depth: t[1].length,
312
- text: n,
313
- tokens: this.lexer.inline(n)
314
- };
315
- }
316
- }
317
- hr(e) {
318
- const t = this.rules.block.hr.exec(e);
319
- if (t)
320
- return {
321
- type: "hr",
322
- raw: Ae(t[0], `
323
- `)
324
- };
325
- }
326
- blockquote(e) {
327
- const t = this.rules.block.blockquote.exec(e);
328
- if (t) {
329
- let n = Ae(t[0], `
330
- `).split(`
331
- `), o = "", r = "";
332
- const s = [];
333
- for (; n.length > 0; ) {
334
- let l = !1;
335
- const u = [];
336
- let a;
337
- for (a = 0; a < n.length; a++)
338
- if (this.rules.other.blockquoteStart.test(n[a]))
339
- u.push(n[a]), l = !0;
340
- else if (!l)
341
- u.push(n[a]);
342
- else
343
- break;
344
- n = n.slice(a);
345
- const c = u.join(`
346
- `), k = c.replace(this.rules.other.blockquoteSetextReplace, `
347
- $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
348
- o = o ? `${o}
349
- ${c}` : c, r = r ? `${r}
350
- ${k}` : k;
351
- const m = this.lexer.state.top;
352
- if (this.lexer.state.top = !0, this.lexer.blockTokens(k, s, !0), this.lexer.state.top = m, n.length === 0)
353
- break;
354
- const b = s.at(-1);
355
- if ((b == null ? void 0 : b.type) === "code")
356
- break;
357
- if ((b == null ? void 0 : b.type) === "blockquote") {
358
- const L = b, A = L.raw + `
359
- ` + n.join(`
360
- `), z = this.blockquote(A);
361
- s[s.length - 1] = z, o = o.substring(0, o.length - L.raw.length) + z.raw, r = r.substring(0, r.length - L.text.length) + z.text;
362
- break;
363
- } else if ((b == null ? void 0 : b.type) === "list") {
364
- const L = b, A = L.raw + `
365
- ` + n.join(`
366
- `), z = this.list(A);
367
- s[s.length - 1] = z, o = o.substring(0, o.length - b.raw.length) + z.raw, r = r.substring(0, r.length - L.raw.length) + z.raw, n = A.substring(s.at(-1).raw.length).split(`
368
- `);
369
- continue;
370
- }
371
- }
372
- return {
373
- type: "blockquote",
374
- raw: o,
375
- tokens: s,
376
- text: r
377
- };
378
- }
379
- }
380
- list(e) {
381
- let t = this.rules.block.list.exec(e);
382
- if (t) {
383
- let n = t[1].trim();
384
- const o = n.length > 1, r = {
385
- type: "list",
386
- raw: "",
387
- ordered: o,
388
- start: o ? +n.slice(0, -1) : "",
389
- loose: !1,
390
- items: []
391
- };
392
- n = o ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = o ? n : "[*+-]");
393
- const s = this.rules.other.listItemRegex(n);
394
- let l = !1;
395
- for (; e; ) {
396
- let a = !1, c = "", k = "";
397
- if (!(t = s.exec(e)) || this.rules.block.hr.test(e))
398
- break;
399
- c = t[0], e = e.substring(c.length);
400
- let m = t[2].split(`
401
- `, 1)[0].replace(this.rules.other.listReplaceTabs, (Q) => " ".repeat(3 * Q.length)), b = e.split(`
402
- `, 1)[0], L = !m.trim(), A = 0;
403
- if (this.options.pedantic ? (A = 2, k = m.trimStart()) : L ? A = t[1].length + 1 : (A = t[2].search(this.rules.other.nonSpaceChar), A = A > 4 ? 1 : A, k = m.slice(A), A += t[1].length), L && this.rules.other.blankLine.test(b) && (c += b + `
404
- `, e = e.substring(b.length + 1), a = !0), !a) {
405
- const Q = this.rules.other.nextBulletRegex(A), Re = this.rules.other.hrRegex(A), Le = this.rules.other.fencesBeginRegex(A), G = this.rules.other.headingBeginRegex(A), N = this.rules.other.htmlBeginRegex(A);
406
- for (; e; ) {
407
- const V = e.split(`
408
- `, 1)[0];
409
- let I;
410
- if (b = V, this.options.pedantic ? (b = b.replace(this.rules.other.listReplaceNesting, " "), I = b) : I = b.replace(this.rules.other.tabCharGlobal, " "), Le.test(b) || G.test(b) || N.test(b) || Q.test(b) || Re.test(b))
411
- break;
412
- if (I.search(this.rules.other.nonSpaceChar) >= A || !b.trim())
413
- k += `
414
- ` + I.slice(A);
415
- else {
416
- if (L || m.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || Le.test(m) || G.test(m) || Re.test(m))
417
- break;
418
- k += `
419
- ` + b;
420
- }
421
- !L && !b.trim() && (L = !0), c += V + `
422
- `, e = e.substring(V.length + 1), m = I.slice(A);
423
- }
424
- }
425
- r.loose || (l ? r.loose = !0 : this.rules.other.doubleBlankLine.test(c) && (l = !0));
426
- let z = null, he;
427
- this.options.gfm && (z = this.rules.other.listIsTask.exec(k), z && (he = z[0] !== "[ ] ", k = k.replace(this.rules.other.listReplaceTask, ""))), r.items.push({
428
- type: "list_item",
429
- raw: c,
430
- task: !!z,
431
- checked: he,
432
- loose: !1,
433
- text: k,
434
- tokens: []
435
- }), r.raw += c;
436
- }
437
- const u = r.items.at(-1);
438
- if (u)
439
- u.raw = u.raw.trimEnd(), u.text = u.text.trimEnd();
440
- else
441
- return;
442
- r.raw = r.raw.trimEnd();
443
- for (let a = 0; a < r.items.length; a++)
444
- if (this.lexer.state.top = !1, r.items[a].tokens = this.lexer.blockTokens(r.items[a].text, []), !r.loose) {
445
- const c = r.items[a].tokens.filter((m) => m.type === "space"), k = c.length > 0 && c.some((m) => this.rules.other.anyLine.test(m.raw));
446
- r.loose = k;
447
- }
448
- if (r.loose)
449
- for (let a = 0; a < r.items.length; a++)
450
- r.items[a].loose = !0;
451
- return r;
452
- }
453
- }
454
- html(e) {
455
- const t = this.rules.block.html.exec(e);
456
- if (t)
457
- return {
458
- type: "html",
459
- block: !0,
460
- raw: t[0],
461
- pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
462
- text: t[0]
463
- };
464
- }
465
- def(e) {
466
- const t = this.rules.block.def.exec(e);
467
- if (t) {
468
- const n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), o = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
469
- return {
470
- type: "def",
471
- tag: n,
472
- raw: t[0],
473
- href: o,
474
- title: r
475
- };
476
- }
477
- }
478
- table(e) {
479
- var l;
480
- const t = this.rules.block.table.exec(e);
481
- if (!t || !this.rules.other.tableDelimiter.test(t[2]))
482
- return;
483
- const n = an(t[1]), o = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = (l = t[3]) != null && l.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
484
- `) : [], s = {
485
- type: "table",
486
- raw: t[0],
487
- header: [],
488
- align: [],
489
- rows: []
490
- };
491
- if (n.length === o.length) {
492
- for (const u of o)
493
- this.rules.other.tableAlignRight.test(u) ? s.align.push("right") : this.rules.other.tableAlignCenter.test(u) ? s.align.push("center") : this.rules.other.tableAlignLeft.test(u) ? s.align.push("left") : s.align.push(null);
494
- for (let u = 0; u < n.length; u++)
495
- s.header.push({
496
- text: n[u],
497
- tokens: this.lexer.inline(n[u]),
498
- header: !0,
499
- align: s.align[u]
500
- });
501
- for (const u of r)
502
- s.rows.push(an(u, s.header.length).map((a, c) => ({
503
- text: a,
504
- tokens: this.lexer.inline(a),
505
- header: !1,
506
- align: s.align[c]
507
- })));
508
- return s;
509
- }
510
- }
511
- lheading(e) {
512
- const t = this.rules.block.lheading.exec(e);
513
- if (t)
514
- return {
515
- type: "heading",
516
- raw: t[0],
517
- depth: t[2].charAt(0) === "=" ? 1 : 2,
518
- text: t[1],
519
- tokens: this.lexer.inline(t[1])
520
- };
521
- }
522
- paragraph(e) {
523
- const t = this.rules.block.paragraph.exec(e);
524
- if (t) {
525
- const n = t[1].charAt(t[1].length - 1) === `
526
- ` ? t[1].slice(0, -1) : t[1];
527
- return {
528
- type: "paragraph",
529
- raw: t[0],
530
- text: n,
531
- tokens: this.lexer.inline(n)
532
- };
533
- }
534
- }
535
- text(e) {
536
- const t = this.rules.block.text.exec(e);
537
- if (t)
538
- return {
539
- type: "text",
540
- raw: t[0],
541
- text: t[0],
542
- tokens: this.lexer.inline(t[0])
543
- };
544
- }
545
- escape(e) {
546
- const t = this.rules.inline.escape.exec(e);
547
- if (t)
548
- return {
549
- type: "escape",
550
- raw: t[0],
551
- text: t[1]
552
- };
553
- }
554
- tag(e) {
555
- const t = this.rules.inline.tag.exec(e);
556
- if (t)
557
- 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), {
558
- type: "html",
559
- raw: t[0],
560
- inLink: this.lexer.state.inLink,
561
- inRawBlock: this.lexer.state.inRawBlock,
562
- block: !1,
563
- text: t[0]
564
- };
565
- }
566
- link(e) {
567
- const t = this.rules.inline.link.exec(e);
568
- if (t) {
569
- const n = t[2].trim();
570
- if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
571
- if (!this.rules.other.endAngleBracket.test(n))
572
- return;
573
- const s = Ae(n.slice(0, -1), "\\");
574
- if ((n.length - s.length) % 2 === 0)
575
- return;
576
- } else {
577
- const s = Gi(t[2], "()");
578
- if (s === -2)
579
- return;
580
- if (s > -1) {
581
- const u = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + s;
582
- t[2] = t[2].substring(0, s), t[0] = t[0].substring(0, u).trim(), t[3] = "";
583
- }
584
- }
585
- let o = t[2], r = "";
586
- if (this.options.pedantic) {
587
- const s = this.rules.other.pedanticHrefTitle.exec(o);
588
- s && (o = s[1], r = s[3]);
589
- } else
590
- r = t[3] ? t[3].slice(1, -1) : "";
591
- return o = o.trim(), this.rules.other.startAngleBracket.test(o) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? o = o.slice(1) : o = o.slice(1, -1)), cn(t, {
592
- href: o && o.replace(this.rules.inline.anyPunctuation, "$1"),
593
- title: r && r.replace(this.rules.inline.anyPunctuation, "$1")
594
- }, t[0], this.lexer, this.rules);
595
- }
596
- }
597
- reflink(e, t) {
598
- let n;
599
- if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
600
- const o = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), r = t[o.toLowerCase()];
601
- if (!r) {
602
- const s = n[0].charAt(0);
603
- return {
604
- type: "text",
605
- raw: s,
606
- text: s
607
- };
608
- }
609
- return cn(n, r, n[0], this.lexer, this.rules);
610
- }
611
- }
612
- emStrong(e, t, n = "") {
613
- let o = this.rules.inline.emStrongLDelim.exec(e);
614
- if (!o || o[3] && n.match(this.rules.other.unicodeAlphaNumeric))
615
- return;
616
- if (!(o[1] || o[2] || "") || !n || this.rules.inline.punctuation.exec(n)) {
617
- const s = [...o[0]].length - 1;
618
- let l, u, a = s, c = 0;
619
- const k = o[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
620
- for (k.lastIndex = 0, t = t.slice(-1 * e.length + s); (o = k.exec(t)) != null; ) {
621
- if (l = o[1] || o[2] || o[3] || o[4] || o[5] || o[6], !l)
622
- continue;
623
- if (u = [...l].length, o[3] || o[4]) {
624
- a += u;
625
- continue;
626
- } else if ((o[5] || o[6]) && s % 3 && !((s + u) % 3)) {
627
- c += u;
628
- continue;
629
- }
630
- if (a -= u, a > 0)
631
- continue;
632
- u = Math.min(u, u + a + c);
633
- const m = [...o[0]][0].length, b = e.slice(0, s + o.index + m + u);
634
- if (Math.min(s, u) % 2) {
635
- const A = b.slice(1, -1);
636
- return {
637
- type: "em",
638
- raw: b,
639
- text: A,
640
- tokens: this.lexer.inlineTokens(A)
641
- };
642
- }
643
- const L = b.slice(2, -2);
644
- return {
645
- type: "strong",
646
- raw: b,
647
- text: L,
648
- tokens: this.lexer.inlineTokens(L)
649
- };
650
- }
651
- }
652
- }
653
- codespan(e) {
654
- const t = this.rules.inline.code.exec(e);
655
- if (t) {
656
- let n = t[2].replace(this.rules.other.newLineCharGlobal, " ");
657
- const o = this.rules.other.nonSpaceChar.test(n), r = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
658
- return o && r && (n = n.substring(1, n.length - 1)), {
659
- type: "codespan",
660
- raw: t[0],
661
- text: n
662
- };
663
- }
664
- }
665
- br(e) {
666
- const t = this.rules.inline.br.exec(e);
667
- if (t)
668
- return {
669
- type: "br",
670
- raw: t[0]
671
- };
672
- }
673
- del(e) {
674
- const t = this.rules.inline.del.exec(e);
675
- if (t)
676
- return {
677
- type: "del",
678
- raw: t[0],
679
- text: t[2],
680
- tokens: this.lexer.inlineTokens(t[2])
681
- };
682
- }
683
- autolink(e) {
684
- const t = this.rules.inline.autolink.exec(e);
685
- if (t) {
686
- let n, o;
687
- return t[2] === "@" ? (n = t[1], o = "mailto:" + n) : (n = t[1], o = n), {
688
- type: "link",
689
- raw: t[0],
690
- text: n,
691
- href: o,
692
- tokens: [
693
- {
694
- type: "text",
695
- raw: n,
696
- text: n
697
- }
698
- ]
699
- };
700
- }
701
- }
702
- url(e) {
703
- var n;
704
- let t;
705
- if (t = this.rules.inline.url.exec(e)) {
706
- let o, r;
707
- if (t[2] === "@")
708
- o = t[0], r = "mailto:" + o;
709
- else {
710
- let s;
711
- do
712
- s = t[0], t[0] = ((n = this.rules.inline._backpedal.exec(t[0])) == null ? void 0 : n[0]) ?? "";
713
- while (s !== t[0]);
714
- o = t[0], t[1] === "www." ? r = "http://" + t[0] : r = t[0];
715
- }
716
- return {
717
- type: "link",
718
- raw: t[0],
719
- text: o,
720
- href: r,
721
- tokens: [
722
- {
723
- type: "text",
724
- raw: o,
725
- text: o
726
- }
727
- ]
728
- };
729
- }
730
- }
731
- inlineText(e) {
732
- const t = this.rules.inline.text.exec(e);
733
- if (t) {
734
- const n = this.lexer.state.inRawBlock;
735
- return {
736
- type: "text",
737
- raw: t[0],
738
- text: t[0],
739
- escaped: n
740
- };
741
- }
742
- }
743
- }
744
- class W {
745
- constructor(e) {
746
- y(this, "tokens");
747
- y(this, "options");
748
- y(this, "state");
749
- y(this, "tokenizer");
750
- y(this, "inlineQueue");
751
- this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || re, this.options.tokenizer = this.options.tokenizer || new Fe(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
752
- inLink: !1,
753
- inRawBlock: !1,
754
- top: !0
755
- };
756
- const t = {
757
- other: H,
758
- block: Ue.normal,
759
- inline: _e.normal
760
- };
761
- this.options.pedantic ? (t.block = Ue.pedantic, t.inline = _e.pedantic) : this.options.gfm && (t.block = Ue.gfm, this.options.breaks ? t.inline = _e.breaks : t.inline = _e.gfm), this.tokenizer.rules = t;
762
- }
763
- /**
764
- * Expose Rules
765
- */
766
- static get rules() {
767
- return {
768
- block: Ue,
769
- inline: _e
770
- };
771
- }
772
- /**
773
- * Static Lex Method
774
- */
775
- static lex(e, t) {
776
- return new W(t).lex(e);
777
- }
778
- /**
779
- * Static Lex Inline Method
780
- */
781
- static lexInline(e, t) {
782
- return new W(t).inlineTokens(e);
783
- }
784
- /**
785
- * Preprocessing
786
- */
787
- lex(e) {
788
- e = e.replace(H.carriageReturn, `
789
- `), this.blockTokens(e, this.tokens);
790
- for (let t = 0; t < this.inlineQueue.length; t++) {
791
- const n = this.inlineQueue[t];
792
- this.inlineTokens(n.src, n.tokens);
793
- }
794
- return this.inlineQueue = [], this.tokens;
795
- }
796
- blockTokens(e, t = [], n = !1) {
797
- var o, r, s;
798
- for (this.options.pedantic && (e = e.replace(H.tabCharGlobal, " ").replace(H.spaceLine, "")); e; ) {
799
- let l;
800
- if ((r = (o = this.options.extensions) == null ? void 0 : o.block) != null && r.some((a) => (l = a.call({ lexer: this }, e, t)) ? (e = e.substring(l.raw.length), t.push(l), !0) : !1))
801
- continue;
802
- if (l = this.tokenizer.space(e)) {
803
- e = e.substring(l.raw.length);
804
- const a = t.at(-1);
805
- l.raw.length === 1 && a !== void 0 ? a.raw += `
806
- ` : t.push(l);
807
- continue;
808
- }
809
- if (l = this.tokenizer.code(e)) {
810
- e = e.substring(l.raw.length);
811
- const a = t.at(-1);
812
- (a == null ? void 0 : a.type) === "paragraph" || (a == null ? void 0 : a.type) === "text" ? (a.raw += `
813
- ` + l.raw, a.text += `
814
- ` + l.text, this.inlineQueue.at(-1).src = a.text) : t.push(l);
815
- continue;
816
- }
817
- if (l = this.tokenizer.fences(e)) {
818
- e = e.substring(l.raw.length), t.push(l);
819
- continue;
820
- }
821
- if (l = this.tokenizer.heading(e)) {
822
- e = e.substring(l.raw.length), t.push(l);
823
- continue;
824
- }
825
- if (l = this.tokenizer.hr(e)) {
826
- e = e.substring(l.raw.length), t.push(l);
827
- continue;
828
- }
829
- if (l = this.tokenizer.blockquote(e)) {
830
- e = e.substring(l.raw.length), t.push(l);
831
- continue;
832
- }
833
- if (l = this.tokenizer.list(e)) {
834
- e = e.substring(l.raw.length), t.push(l);
835
- continue;
836
- }
837
- if (l = this.tokenizer.html(e)) {
838
- e = e.substring(l.raw.length), t.push(l);
839
- continue;
840
- }
841
- if (l = this.tokenizer.def(e)) {
842
- e = e.substring(l.raw.length);
843
- const a = t.at(-1);
844
- (a == null ? void 0 : a.type) === "paragraph" || (a == null ? void 0 : a.type) === "text" ? (a.raw += `
845
- ` + l.raw, a.text += `
846
- ` + l.raw, this.inlineQueue.at(-1).src = a.text) : this.tokens.links[l.tag] || (this.tokens.links[l.tag] = {
847
- href: l.href,
848
- title: l.title
849
- });
850
- continue;
851
- }
852
- if (l = this.tokenizer.table(e)) {
853
- e = e.substring(l.raw.length), t.push(l);
854
- continue;
855
- }
856
- if (l = this.tokenizer.lheading(e)) {
857
- e = e.substring(l.raw.length), t.push(l);
858
- continue;
859
- }
860
- let u = e;
861
- if ((s = this.options.extensions) != null && s.startBlock) {
862
- let a = 1 / 0;
863
- const c = e.slice(1);
864
- let k;
865
- this.options.extensions.startBlock.forEach((m) => {
866
- k = m.call({ lexer: this }, c), typeof k == "number" && k >= 0 && (a = Math.min(a, k));
867
- }), a < 1 / 0 && a >= 0 && (u = e.substring(0, a + 1));
868
- }
869
- if (this.state.top && (l = this.tokenizer.paragraph(u))) {
870
- const a = t.at(-1);
871
- n && (a == null ? void 0 : a.type) === "paragraph" ? (a.raw += `
872
- ` + l.raw, a.text += `
873
- ` + l.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = a.text) : t.push(l), n = u.length !== e.length, e = e.substring(l.raw.length);
874
- continue;
875
- }
876
- if (l = this.tokenizer.text(e)) {
877
- e = e.substring(l.raw.length);
878
- const a = t.at(-1);
879
- (a == null ? void 0 : a.type) === "text" ? (a.raw += `
880
- ` + l.raw, a.text += `
881
- ` + l.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = a.text) : t.push(l);
882
- continue;
883
- }
884
- if (e) {
885
- const a = "Infinite loop on byte: " + e.charCodeAt(0);
886
- if (this.options.silent) {
887
- console.error(a);
888
- break;
889
- } else
890
- throw new Error(a);
891
- }
892
- }
893
- return this.state.top = !0, t;
894
- }
895
- inline(e, t = []) {
896
- return this.inlineQueue.push({ src: e, tokens: t }), t;
897
- }
898
- /**
899
- * Lexing/Compiling
900
- */
901
- inlineTokens(e, t = []) {
902
- var l, u, a;
903
- let n = e, o = null;
904
- if (this.tokens.links) {
905
- const c = Object.keys(this.tokens.links);
906
- if (c.length > 0)
907
- for (; (o = this.tokenizer.rules.inline.reflinkSearch.exec(n)) != null; )
908
- c.includes(o[0].slice(o[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, o.index) + "[" + "a".repeat(o[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
909
- }
910
- for (; (o = this.tokenizer.rules.inline.anyPunctuation.exec(n)) != null; )
911
- n = n.slice(0, o.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
912
- for (; (o = this.tokenizer.rules.inline.blockSkip.exec(n)) != null; )
913
- n = n.slice(0, o.index) + "[" + "a".repeat(o[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
914
- let r = !1, s = "";
915
- for (; e; ) {
916
- r || (s = ""), r = !1;
917
- let c;
918
- if ((u = (l = this.options.extensions) == null ? void 0 : l.inline) != null && u.some((m) => (c = m.call({ lexer: this }, e, t)) ? (e = e.substring(c.raw.length), t.push(c), !0) : !1))
919
- continue;
920
- if (c = this.tokenizer.escape(e)) {
921
- e = e.substring(c.raw.length), t.push(c);
922
- continue;
923
- }
924
- if (c = this.tokenizer.tag(e)) {
925
- e = e.substring(c.raw.length), t.push(c);
926
- continue;
927
- }
928
- if (c = this.tokenizer.link(e)) {
929
- e = e.substring(c.raw.length), t.push(c);
930
- continue;
931
- }
932
- if (c = this.tokenizer.reflink(e, this.tokens.links)) {
933
- e = e.substring(c.raw.length);
934
- const m = t.at(-1);
935
- c.type === "text" && (m == null ? void 0 : m.type) === "text" ? (m.raw += c.raw, m.text += c.text) : t.push(c);
936
- continue;
937
- }
938
- if (c = this.tokenizer.emStrong(e, n, s)) {
939
- e = e.substring(c.raw.length), t.push(c);
940
- continue;
941
- }
942
- if (c = this.tokenizer.codespan(e)) {
943
- e = e.substring(c.raw.length), t.push(c);
944
- continue;
945
- }
946
- if (c = this.tokenizer.br(e)) {
947
- e = e.substring(c.raw.length), t.push(c);
948
- continue;
949
- }
950
- if (c = this.tokenizer.del(e)) {
951
- e = e.substring(c.raw.length), t.push(c);
952
- continue;
953
- }
954
- if (c = this.tokenizer.autolink(e)) {
955
- e = e.substring(c.raw.length), t.push(c);
956
- continue;
957
- }
958
- if (!this.state.inLink && (c = this.tokenizer.url(e))) {
959
- e = e.substring(c.raw.length), t.push(c);
960
- continue;
961
- }
962
- let k = e;
963
- if ((a = this.options.extensions) != null && a.startInline) {
964
- let m = 1 / 0;
965
- const b = e.slice(1);
966
- let L;
967
- this.options.extensions.startInline.forEach((A) => {
968
- L = A.call({ lexer: this }, b), typeof L == "number" && L >= 0 && (m = Math.min(m, L));
969
- }), m < 1 / 0 && m >= 0 && (k = e.substring(0, m + 1));
970
- }
971
- if (c = this.tokenizer.inlineText(k)) {
972
- e = e.substring(c.raw.length), c.raw.slice(-1) !== "_" && (s = c.raw.slice(-1)), r = !0;
973
- const m = t.at(-1);
974
- (m == null ? void 0 : m.type) === "text" ? (m.raw += c.raw, m.text += c.text) : t.push(c);
975
- continue;
976
- }
977
- if (e) {
978
- const m = "Infinite loop on byte: " + e.charCodeAt(0);
979
- if (this.options.silent) {
980
- console.error(m);
981
- break;
982
- } else
983
- throw new Error(m);
984
- }
985
- }
986
- return t;
987
- }
988
- }
989
- class He {
990
- // set by the parser
991
- constructor(e) {
992
- y(this, "options");
993
- y(this, "parser");
994
- this.options = e || re;
995
- }
996
- space(e) {
997
- return "";
998
- }
999
- code({ text: e, lang: t, escaped: n }) {
1000
- var s;
1001
- const o = (s = (t || "").match(H.notSpaceStart)) == null ? void 0 : s[0], r = e.replace(H.endingNewline, "") + `
1002
- `;
1003
- return o ? '<pre><code class="language-' + X(o) + '">' + (n ? r : X(r, !0)) + `</code></pre>
1004
- ` : "<pre><code>" + (n ? r : X(r, !0)) + `</code></pre>
1005
- `;
1006
- }
1007
- blockquote({ tokens: e }) {
1008
- return `<blockquote>
1009
- ${this.parser.parse(e)}</blockquote>
1010
- `;
1011
- }
1012
- html({ text: e }) {
1013
- return e;
1014
- }
1015
- heading({ tokens: e, depth: t }) {
1016
- return `<h${t}>${this.parser.parseInline(e)}</h${t}>
1017
- `;
1018
- }
1019
- hr(e) {
1020
- return `<hr>
1021
- `;
1022
- }
1023
- list(e) {
1024
- const t = e.ordered, n = e.start;
1025
- let o = "";
1026
- for (let l = 0; l < e.items.length; l++) {
1027
- const u = e.items[l];
1028
- o += this.listitem(u);
1029
- }
1030
- const r = t ? "ol" : "ul", s = t && n !== 1 ? ' start="' + n + '"' : "";
1031
- return "<" + r + s + `>
1032
- ` + o + "</" + r + `>
1033
- `;
1034
- }
1035
- listitem(e) {
1036
- var n;
1037
- let t = "";
1038
- if (e.task) {
1039
- const o = this.checkbox({ checked: !!e.checked });
1040
- e.loose ? ((n = e.tokens[0]) == null ? void 0 : n.type) === "paragraph" ? (e.tokens[0].text = o + " " + e.tokens[0].text, e.tokens[0].tokens && e.tokens[0].tokens.length > 0 && e.tokens[0].tokens[0].type === "text" && (e.tokens[0].tokens[0].text = o + " " + X(e.tokens[0].tokens[0].text), e.tokens[0].tokens[0].escaped = !0)) : e.tokens.unshift({
1041
- type: "text",
1042
- raw: o + " ",
1043
- text: o + " ",
1044
- escaped: !0
1045
- }) : t += o + " ";
1046
- }
1047
- return t += this.parser.parse(e.tokens, !!e.loose), `<li>${t}</li>
1048
- `;
1049
- }
1050
- checkbox({ checked: e }) {
1051
- return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
1052
- }
1053
- paragraph({ tokens: e }) {
1054
- return `<p>${this.parser.parseInline(e)}</p>
1055
- `;
1056
- }
1057
- table(e) {
1058
- let t = "", n = "";
1059
- for (let r = 0; r < e.header.length; r++)
1060
- n += this.tablecell(e.header[r]);
1061
- t += this.tablerow({ text: n });
1062
- let o = "";
1063
- for (let r = 0; r < e.rows.length; r++) {
1064
- const s = e.rows[r];
1065
- n = "";
1066
- for (let l = 0; l < s.length; l++)
1067
- n += this.tablecell(s[l]);
1068
- o += this.tablerow({ text: n });
1069
- }
1070
- return o && (o = `<tbody>${o}</tbody>`), `<table>
1071
- <thead>
1072
- ` + t + `</thead>
1073
- ` + o + `</table>
1074
- `;
1075
- }
1076
- tablerow({ text: e }) {
1077
- return `<tr>
1078
- ${e}</tr>
1079
- `;
1080
- }
1081
- tablecell(e) {
1082
- const t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
1083
- return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
1084
- `;
1085
- }
1086
- /**
1087
- * span level renderer
1088
- */
1089
- strong({ tokens: e }) {
1090
- return `<strong>${this.parser.parseInline(e)}</strong>`;
1091
- }
1092
- em({ tokens: e }) {
1093
- return `<em>${this.parser.parseInline(e)}</em>`;
1094
- }
1095
- codespan({ text: e }) {
1096
- return `<code>${X(e, !0)}</code>`;
1097
- }
1098
- br(e) {
1099
- return "<br>";
1100
- }
1101
- del({ tokens: e }) {
1102
- return `<del>${this.parser.parseInline(e)}</del>`;
1103
- }
1104
- link({ href: e, title: t, tokens: n }) {
1105
- const o = this.parser.parseInline(n), r = ln(e);
1106
- if (r === null)
1107
- return o;
1108
- e = r;
1109
- let s = '<a href="' + e + '"';
1110
- return t && (s += ' title="' + X(t) + '"'), s += ">" + o + "</a>", s;
1111
- }
1112
- image({ href: e, title: t, text: n, tokens: o }) {
1113
- o && (n = this.parser.parseInline(o, this.parser.textRenderer));
1114
- const r = ln(e);
1115
- if (r === null)
1116
- return X(n);
1117
- e = r;
1118
- let s = `<img src="${e}" alt="${n}"`;
1119
- return t && (s += ` title="${X(t)}"`), s += ">", s;
1120
- }
1121
- text(e) {
1122
- return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : X(e.text);
1123
- }
1124
- }
1125
- class _t {
1126
- // no need for block level renderers
1127
- strong({ text: e }) {
1128
- return e;
1129
- }
1130
- em({ text: e }) {
1131
- return e;
1132
- }
1133
- codespan({ text: e }) {
1134
- return e;
1135
- }
1136
- del({ text: e }) {
1137
- return e;
1138
- }
1139
- html({ text: e }) {
1140
- return e;
1141
- }
1142
- text({ text: e }) {
1143
- return e;
1144
- }
1145
- link({ text: e }) {
1146
- return "" + e;
1147
- }
1148
- image({ text: e }) {
1149
- return "" + e;
1150
- }
1151
- br() {
1152
- return "";
1153
- }
1154
- }
1155
- class j {
1156
- constructor(e) {
1157
- y(this, "options");
1158
- y(this, "renderer");
1159
- y(this, "textRenderer");
1160
- this.options = e || re, this.options.renderer = this.options.renderer || new He(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new _t();
1161
- }
1162
- /**
1163
- * Static Parse Method
1164
- */
1165
- static parse(e, t) {
1166
- return new j(t).parse(e);
1167
- }
1168
- /**
1169
- * Static Parse Inline Method
1170
- */
1171
- static parseInline(e, t) {
1172
- return new j(t).parseInline(e);
1173
- }
1174
- /**
1175
- * Parse Loop
1176
- */
1177
- parse(e, t = !0) {
1178
- var o, r;
1179
- let n = "";
1180
- for (let s = 0; s < e.length; s++) {
1181
- const l = e[s];
1182
- if ((r = (o = this.options.extensions) == null ? void 0 : o.renderers) != null && r[l.type]) {
1183
- const a = l, c = this.options.extensions.renderers[a.type].call({ parser: this }, a);
1184
- if (c !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(a.type)) {
1185
- n += c || "";
1186
- continue;
1187
- }
1188
- }
1189
- const u = l;
1190
- switch (u.type) {
1191
- case "space": {
1192
- n += this.renderer.space(u);
1193
- continue;
1194
- }
1195
- case "hr": {
1196
- n += this.renderer.hr(u);
1197
- continue;
1198
- }
1199
- case "heading": {
1200
- n += this.renderer.heading(u);
1201
- continue;
1202
- }
1203
- case "code": {
1204
- n += this.renderer.code(u);
1205
- continue;
1206
- }
1207
- case "table": {
1208
- n += this.renderer.table(u);
1209
- continue;
1210
- }
1211
- case "blockquote": {
1212
- n += this.renderer.blockquote(u);
1213
- continue;
1214
- }
1215
- case "list": {
1216
- n += this.renderer.list(u);
1217
- continue;
1218
- }
1219
- case "html": {
1220
- n += this.renderer.html(u);
1221
- continue;
1222
- }
1223
- case "paragraph": {
1224
- n += this.renderer.paragraph(u);
1225
- continue;
1226
- }
1227
- case "text": {
1228
- let a = u, c = this.renderer.text(a);
1229
- for (; s + 1 < e.length && e[s + 1].type === "text"; )
1230
- a = e[++s], c += `
1231
- ` + this.renderer.text(a);
1232
- t ? n += this.renderer.paragraph({
1233
- type: "paragraph",
1234
- raw: c,
1235
- text: c,
1236
- tokens: [{ type: "text", raw: c, text: c, escaped: !0 }]
1237
- }) : n += c;
1238
- continue;
1239
- }
1240
- default: {
1241
- const a = 'Token with "' + u.type + '" type was not found.';
1242
- if (this.options.silent)
1243
- return console.error(a), "";
1244
- throw new Error(a);
1245
- }
1246
- }
1247
- }
1248
- return n;
1249
- }
1250
- /**
1251
- * Parse Inline Tokens
1252
- */
1253
- parseInline(e, t = this.renderer) {
1254
- var o, r;
1255
- let n = "";
1256
- for (let s = 0; s < e.length; s++) {
1257
- const l = e[s];
1258
- if ((r = (o = this.options.extensions) == null ? void 0 : o.renderers) != null && r[l.type]) {
1259
- const a = this.options.extensions.renderers[l.type].call({ parser: this }, l);
1260
- if (a !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(l.type)) {
1261
- n += a || "";
1262
- continue;
1263
- }
1264
- }
1265
- const u = l;
1266
- switch (u.type) {
1267
- case "escape": {
1268
- n += t.text(u);
1269
- break;
1270
- }
1271
- case "html": {
1272
- n += t.html(u);
1273
- break;
1274
- }
1275
- case "link": {
1276
- n += t.link(u);
1277
- break;
1278
- }
1279
- case "image": {
1280
- n += t.image(u);
1281
- break;
1282
- }
1283
- case "strong": {
1284
- n += t.strong(u);
1285
- break;
1286
- }
1287
- case "em": {
1288
- n += t.em(u);
1289
- break;
1290
- }
1291
- case "codespan": {
1292
- n += t.codespan(u);
1293
- break;
1294
- }
1295
- case "br": {
1296
- n += t.br(u);
1297
- break;
1298
- }
1299
- case "del": {
1300
- n += t.del(u);
1301
- break;
1302
- }
1303
- case "text": {
1304
- n += t.text(u);
1305
- break;
1306
- }
1307
- default: {
1308
- const a = 'Token with "' + u.type + '" type was not found.';
1309
- if (this.options.silent)
1310
- return console.error(a), "";
1311
- throw new Error(a);
1312
- }
1313
- }
1314
- }
1315
- return n;
1316
- }
1317
- }
1318
- class Se {
1319
- constructor(e) {
1320
- y(this, "options");
1321
- y(this, "block");
1322
- this.options = e || re;
1323
- }
1324
- /**
1325
- * Process markdown before marked
1326
- */
1327
- preprocess(e) {
1328
- return e;
1329
- }
1330
- /**
1331
- * Process HTML after marked is finished
1332
- */
1333
- postprocess(e) {
1334
- return e;
1335
- }
1336
- /**
1337
- * Process all tokens before walk tokens
1338
- */
1339
- processAllTokens(e) {
1340
- return e;
1341
- }
1342
- /**
1343
- * Provide function to tokenize markdown
1344
- */
1345
- provideLexer() {
1346
- return this.block ? W.lex : W.lexInline;
1347
- }
1348
- /**
1349
- * Provide function to parse tokens
1350
- */
1351
- provideParser() {
1352
- return this.block ? j.parse : j.parseInline;
1353
- }
1354
- }
1355
- y(Se, "passThroughHooks", /* @__PURE__ */ new Set([
1356
- "preprocess",
1357
- "postprocess",
1358
- "processAllTokens"
1359
- ]));
1360
- class Wi {
1361
- constructor(...e) {
1362
- y(this, "defaults", gt());
1363
- y(this, "options", this.setOptions);
1364
- y(this, "parse", this.parseMarkdown(!0));
1365
- y(this, "parseInline", this.parseMarkdown(!1));
1366
- y(this, "Parser", j);
1367
- y(this, "Renderer", He);
1368
- y(this, "TextRenderer", _t);
1369
- y(this, "Lexer", W);
1370
- y(this, "Tokenizer", Fe);
1371
- y(this, "Hooks", Se);
1372
- this.use(...e);
1373
- }
1374
- /**
1375
- * Run callback for every token
1376
- */
1377
- walkTokens(e, t) {
1378
- var o, r;
1379
- let n = [];
1380
- for (const s of e)
1381
- switch (n = n.concat(t.call(this, s)), s.type) {
1382
- case "table": {
1383
- const l = s;
1384
- for (const u of l.header)
1385
- n = n.concat(this.walkTokens(u.tokens, t));
1386
- for (const u of l.rows)
1387
- for (const a of u)
1388
- n = n.concat(this.walkTokens(a.tokens, t));
1389
- break;
1390
- }
1391
- case "list": {
1392
- const l = s;
1393
- n = n.concat(this.walkTokens(l.items, t));
1394
- break;
1395
- }
1396
- default: {
1397
- const l = s;
1398
- (r = (o = this.defaults.extensions) == null ? void 0 : o.childTokens) != null && r[l.type] ? this.defaults.extensions.childTokens[l.type].forEach((u) => {
1399
- const a = l[u].flat(1 / 0);
1400
- n = n.concat(this.walkTokens(a, t));
1401
- }) : l.tokens && (n = n.concat(this.walkTokens(l.tokens, t)));
1402
- }
1403
- }
1404
- return n;
1405
- }
1406
- use(...e) {
1407
- const t = this.defaults.extensions || { renderers: {}, childTokens: {} };
1408
- return e.forEach((n) => {
1409
- const o = { ...n };
1410
- if (o.async = this.defaults.async || o.async || !1, n.extensions && (n.extensions.forEach((r) => {
1411
- if (!r.name)
1412
- throw new Error("extension name required");
1413
- if ("renderer" in r) {
1414
- const s = t.renderers[r.name];
1415
- s ? t.renderers[r.name] = function(...l) {
1416
- let u = r.renderer.apply(this, l);
1417
- return u === !1 && (u = s.apply(this, l)), u;
1418
- } : t.renderers[r.name] = r.renderer;
1419
- }
1420
- if ("tokenizer" in r) {
1421
- if (!r.level || r.level !== "block" && r.level !== "inline")
1422
- throw new Error("extension level must be 'block' or 'inline'");
1423
- const s = t[r.level];
1424
- s ? s.unshift(r.tokenizer) : t[r.level] = [r.tokenizer], r.start && (r.level === "block" ? t.startBlock ? t.startBlock.push(r.start) : t.startBlock = [r.start] : r.level === "inline" && (t.startInline ? t.startInline.push(r.start) : t.startInline = [r.start]));
1425
- }
1426
- "childTokens" in r && r.childTokens && (t.childTokens[r.name] = r.childTokens);
1427
- }), o.extensions = t), n.renderer) {
1428
- const r = this.defaults.renderer || new He(this.defaults);
1429
- for (const s in n.renderer) {
1430
- if (!(s in r))
1431
- throw new Error(`renderer '${s}' does not exist`);
1432
- if (["options", "parser"].includes(s))
1433
- continue;
1434
- const l = s, u = n.renderer[l], a = r[l];
1435
- r[l] = (...c) => {
1436
- let k = u.apply(r, c);
1437
- return k === !1 && (k = a.apply(r, c)), k || "";
1438
- };
1439
- }
1440
- o.renderer = r;
1441
- }
1442
- if (n.tokenizer) {
1443
- const r = this.defaults.tokenizer || new Fe(this.defaults);
1444
- for (const s in n.tokenizer) {
1445
- if (!(s in r))
1446
- throw new Error(`tokenizer '${s}' does not exist`);
1447
- if (["options", "rules", "lexer"].includes(s))
1448
- continue;
1449
- const l = s, u = n.tokenizer[l], a = r[l];
1450
- r[l] = (...c) => {
1451
- let k = u.apply(r, c);
1452
- return k === !1 && (k = a.apply(r, c)), k;
1453
- };
1454
- }
1455
- o.tokenizer = r;
1456
- }
1457
- if (n.hooks) {
1458
- const r = this.defaults.hooks || new Se();
1459
- for (const s in n.hooks) {
1460
- if (!(s in r))
1461
- throw new Error(`hook '${s}' does not exist`);
1462
- if (["options", "block"].includes(s))
1463
- continue;
1464
- const l = s, u = n.hooks[l], a = r[l];
1465
- Se.passThroughHooks.has(s) ? r[l] = (c) => {
1466
- if (this.defaults.async)
1467
- return Promise.resolve(u.call(r, c)).then((m) => a.call(r, m));
1468
- const k = u.call(r, c);
1469
- return a.call(r, k);
1470
- } : r[l] = (...c) => {
1471
- let k = u.apply(r, c);
1472
- return k === !1 && (k = a.apply(r, c)), k;
1473
- };
1474
- }
1475
- o.hooks = r;
1476
- }
1477
- if (n.walkTokens) {
1478
- const r = this.defaults.walkTokens, s = n.walkTokens;
1479
- o.walkTokens = function(l) {
1480
- let u = [];
1481
- return u.push(s.call(this, l)), r && (u = u.concat(r.call(this, l))), u;
1482
- };
1483
- }
1484
- this.defaults = { ...this.defaults, ...o };
1485
- }), this;
1486
- }
1487
- setOptions(e) {
1488
- return this.defaults = { ...this.defaults, ...e }, this;
1489
- }
1490
- lexer(e, t) {
1491
- return W.lex(e, t ?? this.defaults);
1492
- }
1493
- parser(e, t) {
1494
- return j.parse(e, t ?? this.defaults);
1495
- }
1496
- parseMarkdown(e) {
1497
- return (n, o) => {
1498
- const r = { ...o }, s = { ...this.defaults, ...r }, l = this.onError(!!s.silent, !!s.async);
1499
- if (this.defaults.async === !0 && r.async === !1)
1500
- return l(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."));
1501
- if (typeof n > "u" || n === null)
1502
- return l(new Error("marked(): input parameter is undefined or null"));
1503
- if (typeof n != "string")
1504
- return l(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
1505
- s.hooks && (s.hooks.options = s, s.hooks.block = e);
1506
- const u = s.hooks ? s.hooks.provideLexer() : e ? W.lex : W.lexInline, a = s.hooks ? s.hooks.provideParser() : e ? j.parse : j.parseInline;
1507
- if (s.async)
1508
- return Promise.resolve(s.hooks ? s.hooks.preprocess(n) : n).then((c) => u(c, s)).then((c) => s.hooks ? s.hooks.processAllTokens(c) : c).then((c) => s.walkTokens ? Promise.all(this.walkTokens(c, s.walkTokens)).then(() => c) : c).then((c) => a(c, s)).then((c) => s.hooks ? s.hooks.postprocess(c) : c).catch(l);
1509
- try {
1510
- s.hooks && (n = s.hooks.preprocess(n));
1511
- let c = u(n, s);
1512
- s.hooks && (c = s.hooks.processAllTokens(c)), s.walkTokens && this.walkTokens(c, s.walkTokens);
1513
- let k = a(c, s);
1514
- return s.hooks && (k = s.hooks.postprocess(k)), k;
1515
- } catch (c) {
1516
- return l(c);
1517
- }
1518
- };
1519
- }
1520
- onError(e, t) {
1521
- return (n) => {
1522
- if (n.message += `
1523
- Please report this to https://github.com/markedjs/marked.`, e) {
1524
- const o = "<p>An error occurred:</p><pre>" + X(n.message + "", !0) + "</pre>";
1525
- return t ? Promise.resolve(o) : o;
1526
- }
1527
- if (t)
1528
- return Promise.reject(n);
1529
- throw n;
1530
- };
1531
- }
1532
- }
1533
- const ie = new Wi();
1534
- function S(h, e) {
1535
- return ie.parse(h, e);
1536
- }
1537
- S.options = S.setOptions = function(h) {
1538
- return ie.setOptions(h), S.defaults = ie.defaults, fn(S.defaults), S;
1539
- };
1540
- S.getDefaults = gt;
1541
- S.defaults = re;
1542
- S.use = function(...h) {
1543
- return ie.use(...h), S.defaults = ie.defaults, fn(S.defaults), S;
1544
- };
1545
- S.walkTokens = function(h, e) {
1546
- return ie.walkTokens(h, e);
1547
- };
1548
- S.parseInline = ie.parseInline;
1549
- S.Parser = j;
1550
- S.parser = j.parse;
1551
- S.Renderer = He;
1552
- S.TextRenderer = _t;
1553
- S.Lexer = W;
1554
- S.lexer = W.lex;
1555
- S.Tokenizer = Fe;
1556
- S.Hooks = Se;
1557
- S.parse = S;
1558
- S.options;
1559
- S.setOptions;
1560
- S.use;
1561
- S.walkTokens;
1562
- S.parseInline;
1563
- j.parse;
1564
- W.lex;
1565
- var Qi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
1566
- function ji(h) {
1567
- return h && h.__esModule && Object.prototype.hasOwnProperty.call(h, "default") ? h.default : h;
1568
- }
1569
- /*! @license DOMPurify 3.2.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.5/LICENSE */
1570
- var pt, un;
1571
- function pn() {
1572
- if (un) return pt;
1573
- un = 1;
1574
- const {
1575
- entries: h,
1576
- setPrototypeOf: e,
1577
- isFrozen: t,
1578
- getPrototypeOf: n,
1579
- getOwnPropertyDescriptor: o
1580
- } = Object;
1581
- let {
1582
- freeze: r,
1583
- seal: s,
1584
- create: l
1585
- } = Object, {
1586
- apply: u,
1587
- construct: a
1588
- } = typeof Reflect < "u" && Reflect;
1589
- r || (r = function(g) {
1590
- return g;
1591
- }), s || (s = function(g) {
1592
- return g;
1593
- }), u || (u = function(g, _, w) {
1594
- return g.apply(_, w);
1595
- }), a || (a = function(g, _) {
1596
- return new g(..._);
1597
- });
1598
- const c = I(Array.prototype.forEach), k = I(Array.prototype.lastIndexOf), m = I(Array.prototype.pop), b = I(Array.prototype.push), L = I(Array.prototype.splice), A = I(String.prototype.toLowerCase), z = I(String.prototype.toString), he = I(String.prototype.match), Q = I(String.prototype.replace), Re = I(String.prototype.indexOf), Le = I(String.prototype.trim), G = I(Object.prototype.hasOwnProperty), N = I(RegExp.prototype.test), V = En(TypeError);
1599
- function I(T) {
1600
- return function(g) {
1601
- g instanceof RegExp && (g.lastIndex = 0);
1602
- for (var _ = arguments.length, w = new Array(_ > 1 ? _ - 1 : 0), v = 1; v < _; v++)
1603
- w[v - 1] = arguments[v];
1604
- return u(T, g, w);
1605
- };
1606
- }
1607
- function En(T) {
1608
- return function() {
1609
- for (var g = arguments.length, _ = new Array(g), w = 0; w < g; w++)
1610
- _[w] = arguments[w];
1611
- return a(T, _);
1612
- };
1613
- }
1614
- function x(T, g) {
1615
- let _ = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : A;
1616
- e && e(T, null);
1617
- let w = g.length;
1618
- for (; w--; ) {
1619
- let v = g[w];
1620
- if (typeof v == "string") {
1621
- const K = _(v);
1622
- K !== v && (t(g) || (g[w] = K), v = K);
1623
- }
1624
- T[v] = !0;
1625
- }
1626
- return T;
1627
- }
1628
- function Sn(T) {
1629
- for (let g = 0; g < T.length; g++)
1630
- G(T, g) || (T[g] = null);
1631
- return T;
1632
- }
1633
- function te(T) {
1634
- const g = l(null);
1635
- for (const [_, w] of h(T))
1636
- G(T, _) && (Array.isArray(w) ? g[_] = Sn(w) : w && typeof w == "object" && w.constructor === Object ? g[_] = te(w) : g[_] = w);
1637
- return g;
1638
- }
1639
- function fe(T, g) {
1640
- for (; T !== null; ) {
1641
- const w = o(T, g);
1642
- if (w) {
1643
- if (w.get)
1644
- return I(w.get);
1645
- if (typeof w.value == "function")
1646
- return I(w.value);
1647
- }
1648
- T = n(T);
1649
- }
1650
- function _() {
1651
- return null;
1652
- }
1653
- return _;
1654
- }
1655
- const At = r(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), We = r(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), je = r(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), yn = r(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), Ze = r(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), Rn = r(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Et = r(["#text"]), St = r(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), Ye = r(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), yt = r(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), Ie = r(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), Ln = s(/\{\{[\w\W]*|[\w\W]*\}\}/gm), In = s(/<%[\w\W]*|[\w\W]*%>/gm), Cn = s(/\$\{[\w\W]*/gm), On = s(/^data-[\-\w.\u00B7-\uFFFF]+$/), Dn = s(/^aria-[\-\w]+$/), Rt = s(
1656
- /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
1657
- // eslint-disable-line no-useless-escape
1658
- ), Nn = s(/^(?:\w+script|data):/i), Pn = s(
1659
- /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
1660
- // eslint-disable-line no-control-regex
1661
- ), Lt = s(/^html$/i), Mn = s(/^[a-z][.\w]*(-[.\w]+)+$/i);
1662
- var It = /* @__PURE__ */ Object.freeze({
1663
- __proto__: null,
1664
- ARIA_ATTR: Dn,
1665
- ATTR_WHITESPACE: Pn,
1666
- CUSTOM_ELEMENT: Mn,
1667
- DATA_ATTR: On,
1668
- DOCTYPE_NAME: Lt,
1669
- ERB_EXPR: In,
1670
- IS_ALLOWED_URI: Rt,
1671
- IS_SCRIPT_OR_DATA: Nn,
1672
- MUSTACHE_EXPR: Ln,
1673
- TMPLIT_EXPR: Cn
1674
- });
1675
- const ge = {
1676
- element: 1,
1677
- text: 3,
1678
- // Deprecated
1679
- progressingInstruction: 7,
1680
- comment: 8,
1681
- document: 9
1682
- }, zn = function() {
1683
- return typeof window > "u" ? null : window;
1684
- }, vn = function(g, _) {
1685
- if (typeof g != "object" || typeof g.createPolicy != "function")
1686
- return null;
1687
- let w = null;
1688
- const v = "data-tt-policy-suffix";
1689
- _ && _.hasAttribute(v) && (w = _.getAttribute(v));
1690
- const K = "dompurify" + (w ? "#" + w : "");
1691
- try {
1692
- return g.createPolicy(K, {
1693
- createHTML(se) {
1694
- return se;
1695
- },
1696
- createScriptURL(se) {
1697
- return se;
1698
- }
1699
- });
1700
- } catch {
1701
- return console.warn("TrustedTypes policy " + K + " could not be created."), null;
1702
- }
1703
- }, Ct = function() {
1704
- return {
1705
- afterSanitizeAttributes: [],
1706
- afterSanitizeElements: [],
1707
- afterSanitizeShadowDOM: [],
1708
- beforeSanitizeAttributes: [],
1709
- beforeSanitizeElements: [],
1710
- beforeSanitizeShadowDOM: [],
1711
- uponSanitizeAttribute: [],
1712
- uponSanitizeElement: [],
1713
- uponSanitizeShadowNode: []
1714
- };
1715
- };
1716
- function Ot() {
1717
- let T = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : zn();
1718
- const g = (d) => Ot(d);
1719
- if (g.version = "3.2.5", g.removed = [], !T || !T.document || T.document.nodeType !== ge.document || !T.Element)
1720
- return g.isSupported = !1, g;
1721
- let {
1722
- document: _
1723
- } = T;
1724
- const w = _, v = w.currentScript, {
1725
- DocumentFragment: K,
1726
- HTMLTemplateElement: se,
1727
- Node: Xe,
1728
- Element: Dt,
1729
- NodeFilter: de,
1730
- NamedNodeMap: Un = T.NamedNodeMap || T.MozNamedAttrMap,
1731
- HTMLFormElement: Bn,
1732
- DOMParser: Fn,
1733
- trustedTypes: Ce
1734
- } = T, me = Dt.prototype, Hn = fe(me, "cloneNode"), Gn = fe(me, "remove"), qn = fe(me, "nextSibling"), Wn = fe(me, "childNodes"), Oe = fe(me, "parentNode");
1735
- if (typeof se == "function") {
1736
- const d = _.createElement("template");
1737
- d.content && d.content.ownerDocument && (_ = d.content.ownerDocument);
1738
- }
1739
- let U, ke = "";
1740
- const {
1741
- implementation: Qe,
1742
- createNodeIterator: jn,
1743
- createDocumentFragment: Zn,
1744
- getElementsByTagName: Yn
1745
- } = _, {
1746
- importNode: Xn
1747
- } = w;
1748
- let B = Ct();
1749
- g.isSupported = typeof h == "function" && typeof Oe == "function" && Qe && Qe.createHTMLDocument !== void 0;
1750
- const {
1751
- MUSTACHE_EXPR: Ve,
1752
- ERB_EXPR: Ke,
1753
- TMPLIT_EXPR: Je,
1754
- DATA_ATTR: Qn,
1755
- ARIA_ATTR: Vn,
1756
- IS_SCRIPT_OR_DATA: Kn,
1757
- ATTR_WHITESPACE: Nt,
1758
- CUSTOM_ELEMENT: Jn
1759
- } = It;
1760
- let {
1761
- IS_ALLOWED_URI: Pt
1762
- } = It, O = null;
1763
- const Mt = x({}, [...At, ...We, ...je, ...Ze, ...Et]);
1764
- let P = null;
1765
- const zt = x({}, [...St, ...Ye, ...yt, ...Ie]);
1766
- let C = Object.seal(l(null, {
1767
- tagNameCheck: {
1768
- writable: !0,
1769
- configurable: !1,
1770
- enumerable: !0,
1771
- value: null
1772
- },
1773
- attributeNameCheck: {
1774
- writable: !0,
1775
- configurable: !1,
1776
- enumerable: !0,
1777
- value: null
1778
- },
1779
- allowCustomizedBuiltInElements: {
1780
- writable: !0,
1781
- configurable: !1,
1782
- enumerable: !0,
1783
- value: !1
1784
- }
1785
- })), be = null, et = null, vt = !0, tt = !0, $t = !1, Ut = !0, oe = !1, nt = !0, ne = !1, it = !1, rt = !1, le = !1, De = !1, Ne = !1, Bt = !0, Ft = !1;
1786
- const ei = "user-content-";
1787
- let st = !0, xe = !1, ae = {}, ce = null;
1788
- const Ht = x({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
1789
- let Gt = null;
1790
- const qt = x({}, ["audio", "video", "img", "source", "image", "track"]);
1791
- let ot = null;
1792
- const Wt = x({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), Pe = "http://www.w3.org/1998/Math/MathML", Me = "http://www.w3.org/2000/svg", J = "http://www.w3.org/1999/xhtml";
1793
- let ue = J, lt = !1, at = null;
1794
- const ti = x({}, [Pe, Me, J], z);
1795
- let ze = x({}, ["mi", "mo", "mn", "ms", "mtext"]), ve = x({}, ["annotation-xml"]);
1796
- const ni = x({}, ["title", "style", "font", "a", "script"]);
1797
- let Te = null;
1798
- const ii = ["application/xhtml+xml", "text/html"], ri = "text/html";
1799
- let D = null, pe = null;
1800
- const si = _.createElement("form"), jt = function(i) {
1801
- return i instanceof RegExp || i instanceof Function;
1802
- }, ct = function() {
1803
- let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1804
- if (!(pe && pe === i)) {
1805
- if ((!i || typeof i != "object") && (i = {}), i = te(i), Te = // eslint-disable-next-line unicorn/prefer-includes
1806
- ii.indexOf(i.PARSER_MEDIA_TYPE) === -1 ? ri : i.PARSER_MEDIA_TYPE, D = Te === "application/xhtml+xml" ? z : A, O = G(i, "ALLOWED_TAGS") ? x({}, i.ALLOWED_TAGS, D) : Mt, P = G(i, "ALLOWED_ATTR") ? x({}, i.ALLOWED_ATTR, D) : zt, at = G(i, "ALLOWED_NAMESPACES") ? x({}, i.ALLOWED_NAMESPACES, z) : ti, ot = G(i, "ADD_URI_SAFE_ATTR") ? x(te(Wt), i.ADD_URI_SAFE_ATTR, D) : Wt, Gt = G(i, "ADD_DATA_URI_TAGS") ? x(te(qt), i.ADD_DATA_URI_TAGS, D) : qt, ce = G(i, "FORBID_CONTENTS") ? x({}, i.FORBID_CONTENTS, D) : Ht, be = G(i, "FORBID_TAGS") ? x({}, i.FORBID_TAGS, D) : {}, et = G(i, "FORBID_ATTR") ? x({}, i.FORBID_ATTR, D) : {}, ae = G(i, "USE_PROFILES") ? i.USE_PROFILES : !1, vt = i.ALLOW_ARIA_ATTR !== !1, tt = i.ALLOW_DATA_ATTR !== !1, $t = i.ALLOW_UNKNOWN_PROTOCOLS || !1, Ut = i.ALLOW_SELF_CLOSE_IN_ATTR !== !1, oe = i.SAFE_FOR_TEMPLATES || !1, nt = i.SAFE_FOR_XML !== !1, ne = i.WHOLE_DOCUMENT || !1, le = i.RETURN_DOM || !1, De = i.RETURN_DOM_FRAGMENT || !1, Ne = i.RETURN_TRUSTED_TYPE || !1, rt = i.FORCE_BODY || !1, Bt = i.SANITIZE_DOM !== !1, Ft = i.SANITIZE_NAMED_PROPS || !1, st = i.KEEP_CONTENT !== !1, xe = i.IN_PLACE || !1, Pt = i.ALLOWED_URI_REGEXP || Rt, ue = i.NAMESPACE || J, ze = i.MATHML_TEXT_INTEGRATION_POINTS || ze, ve = i.HTML_INTEGRATION_POINTS || ve, C = i.CUSTOM_ELEMENT_HANDLING || {}, i.CUSTOM_ELEMENT_HANDLING && jt(i.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (C.tagNameCheck = i.CUSTOM_ELEMENT_HANDLING.tagNameCheck), i.CUSTOM_ELEMENT_HANDLING && jt(i.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (C.attributeNameCheck = i.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), i.CUSTOM_ELEMENT_HANDLING && typeof i.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (C.allowCustomizedBuiltInElements = i.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), oe && (tt = !1), De && (le = !0), ae && (O = x({}, Et), P = [], ae.html === !0 && (x(O, At), x(P, St)), ae.svg === !0 && (x(O, We), x(P, Ye), x(P, Ie)), ae.svgFilters === !0 && (x(O, je), x(P, Ye), x(P, Ie)), ae.mathMl === !0 && (x(O, Ze), x(P, yt), x(P, Ie))), i.ADD_TAGS && (O === Mt && (O = te(O)), x(O, i.ADD_TAGS, D)), i.ADD_ATTR && (P === zt && (P = te(P)), x(P, i.ADD_ATTR, D)), i.ADD_URI_SAFE_ATTR && x(ot, i.ADD_URI_SAFE_ATTR, D), i.FORBID_CONTENTS && (ce === Ht && (ce = te(ce)), x(ce, i.FORBID_CONTENTS, D)), st && (O["#text"] = !0), ne && x(O, ["html", "head", "body"]), O.table && (x(O, ["tbody"]), delete be.tbody), i.TRUSTED_TYPES_POLICY) {
1807
- if (typeof i.TRUSTED_TYPES_POLICY.createHTML != "function")
1808
- throw V('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
1809
- if (typeof i.TRUSTED_TYPES_POLICY.createScriptURL != "function")
1810
- throw V('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
1811
- U = i.TRUSTED_TYPES_POLICY, ke = U.createHTML("");
1812
- } else
1813
- U === void 0 && (U = vn(Ce, v)), U !== null && typeof ke == "string" && (ke = U.createHTML(""));
1814
- r && r(i), pe = i;
1815
- }
1816
- }, Zt = x({}, [...We, ...je, ...yn]), Yt = x({}, [...Ze, ...Rn]), oi = function(i) {
1817
- let p = Oe(i);
1818
- (!p || !p.tagName) && (p = {
1819
- namespaceURI: ue,
1820
- tagName: "template"
1821
- });
1822
- const f = A(i.tagName), R = A(p.tagName);
1823
- return at[i.namespaceURI] ? i.namespaceURI === Me ? p.namespaceURI === J ? f === "svg" : p.namespaceURI === Pe ? f === "svg" && (R === "annotation-xml" || ze[R]) : !!Zt[f] : i.namespaceURI === Pe ? p.namespaceURI === J ? f === "math" : p.namespaceURI === Me ? f === "math" && ve[R] : !!Yt[f] : i.namespaceURI === J ? p.namespaceURI === Me && !ve[R] || p.namespaceURI === Pe && !ze[R] ? !1 : !Yt[f] && (ni[f] || !Zt[f]) : !!(Te === "application/xhtml+xml" && at[i.namespaceURI]) : !1;
1824
- }, Z = function(i) {
1825
- b(g.removed, {
1826
- element: i
1827
- });
1828
- try {
1829
- Oe(i).removeChild(i);
1830
- } catch {
1831
- Gn(i);
1832
- }
1833
- }, $e = function(i, p) {
1834
- try {
1835
- b(g.removed, {
1836
- attribute: p.getAttributeNode(i),
1837
- from: p
1838
- });
1839
- } catch {
1840
- b(g.removed, {
1841
- attribute: null,
1842
- from: p
1843
- });
1844
- }
1845
- if (p.removeAttribute(i), i === "is")
1846
- if (le || De)
1847
- try {
1848
- Z(p);
1849
- } catch {
1850
- }
1851
- else
1852
- try {
1853
- p.setAttribute(i, "");
1854
- } catch {
1855
- }
1856
- }, Xt = function(i) {
1857
- let p = null, f = null;
1858
- if (rt)
1859
- i = "<remove></remove>" + i;
1860
- else {
1861
- const M = he(i, /^[\r\n\t ]+/);
1862
- f = M && M[0];
1863
- }
1864
- Te === "application/xhtml+xml" && ue === J && (i = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + i + "</body></html>");
1865
- const R = U ? U.createHTML(i) : i;
1866
- if (ue === J)
1867
- try {
1868
- p = new Fn().parseFromString(R, Te);
1869
- } catch {
1870
- }
1871
- if (!p || !p.documentElement) {
1872
- p = Qe.createDocument(ue, "template", null);
1873
- try {
1874
- p.documentElement.innerHTML = lt ? ke : R;
1875
- } catch {
1876
- }
1877
- }
1878
- const $ = p.body || p.documentElement;
1879
- return i && f && $.insertBefore(_.createTextNode(f), $.childNodes[0] || null), ue === J ? Yn.call(p, ne ? "html" : "body")[0] : ne ? p.documentElement : $;
1880
- }, Qt = function(i) {
1881
- return jn.call(
1882
- i.ownerDocument || i,
1883
- i,
1884
- // eslint-disable-next-line no-bitwise
1885
- de.SHOW_ELEMENT | de.SHOW_COMMENT | de.SHOW_TEXT | de.SHOW_PROCESSING_INSTRUCTION | de.SHOW_CDATA_SECTION,
1886
- null
1887
- );
1888
- }, ut = function(i) {
1889
- return i instanceof Bn && (typeof i.nodeName != "string" || typeof i.textContent != "string" || typeof i.removeChild != "function" || !(i.attributes instanceof Un) || typeof i.removeAttribute != "function" || typeof i.setAttribute != "function" || typeof i.namespaceURI != "string" || typeof i.insertBefore != "function" || typeof i.hasChildNodes != "function");
1890
- }, Vt = function(i) {
1891
- return typeof Xe == "function" && i instanceof Xe;
1892
- };
1893
- function ee(d, i, p) {
1894
- c(d, (f) => {
1895
- f.call(g, i, p, pe);
1896
- });
1897
- }
1898
- const Kt = function(i) {
1899
- let p = null;
1900
- if (ee(B.beforeSanitizeElements, i, null), ut(i))
1901
- return Z(i), !0;
1902
- const f = D(i.nodeName);
1903
- if (ee(B.uponSanitizeElement, i, {
1904
- tagName: f,
1905
- allowedTags: O
1906
- }), i.hasChildNodes() && !Vt(i.firstElementChild) && N(/<[/\w!]/g, i.innerHTML) && N(/<[/\w!]/g, i.textContent) || i.nodeType === ge.progressingInstruction || nt && i.nodeType === ge.comment && N(/<[/\w]/g, i.data))
1907
- return Z(i), !0;
1908
- if (!O[f] || be[f]) {
1909
- if (!be[f] && en(f) && (C.tagNameCheck instanceof RegExp && N(C.tagNameCheck, f) || C.tagNameCheck instanceof Function && C.tagNameCheck(f)))
1910
- return !1;
1911
- if (st && !ce[f]) {
1912
- const R = Oe(i) || i.parentNode, $ = Wn(i) || i.childNodes;
1913
- if ($ && R) {
1914
- const M = $.length;
1915
- for (let q = M - 1; q >= 0; --q) {
1916
- const Y = Hn($[q], !0);
1917
- Y.__removalCount = (i.__removalCount || 0) + 1, R.insertBefore(Y, qn(i));
1918
- }
1919
- }
1920
- }
1921
- return Z(i), !0;
1922
- }
1923
- return i instanceof Dt && !oi(i) || (f === "noscript" || f === "noembed" || f === "noframes") && N(/<\/no(script|embed|frames)/i, i.innerHTML) ? (Z(i), !0) : (oe && i.nodeType === ge.text && (p = i.textContent, c([Ve, Ke, Je], (R) => {
1924
- p = Q(p, R, " ");
1925
- }), i.textContent !== p && (b(g.removed, {
1926
- element: i.cloneNode()
1927
- }), i.textContent = p)), ee(B.afterSanitizeElements, i, null), !1);
1928
- }, Jt = function(i, p, f) {
1929
- if (Bt && (p === "id" || p === "name") && (f in _ || f in si))
1930
- return !1;
1931
- if (!(tt && !et[p] && N(Qn, p))) {
1932
- if (!(vt && N(Vn, p))) {
1933
- if (!P[p] || et[p]) {
1934
- if (
1935
- // First condition does a very basic check if a) it's basically a valid custom element tagname AND
1936
- // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1937
- // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
1938
- !(en(i) && (C.tagNameCheck instanceof RegExp && N(C.tagNameCheck, i) || C.tagNameCheck instanceof Function && C.tagNameCheck(i)) && (C.attributeNameCheck instanceof RegExp && N(C.attributeNameCheck, p) || C.attributeNameCheck instanceof Function && C.attributeNameCheck(p)) || // Alternative, second condition checks if it's an `is`-attribute, AND
1939
- // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1940
- p === "is" && C.allowCustomizedBuiltInElements && (C.tagNameCheck instanceof RegExp && N(C.tagNameCheck, f) || C.tagNameCheck instanceof Function && C.tagNameCheck(f)))
1941
- ) return !1;
1942
- } else if (!ot[p]) {
1943
- if (!N(Pt, Q(f, Nt, ""))) {
1944
- if (!((p === "src" || p === "xlink:href" || p === "href") && i !== "script" && Re(f, "data:") === 0 && Gt[i])) {
1945
- if (!($t && !N(Kn, Q(f, Nt, "")))) {
1946
- if (f)
1947
- return !1;
1948
- }
1949
- }
1950
- }
1951
- }
1952
- }
1953
- }
1954
- return !0;
1955
- }, en = function(i) {
1956
- return i !== "annotation-xml" && he(i, Jn);
1957
- }, tn = function(i) {
1958
- ee(B.beforeSanitizeAttributes, i, null);
1959
- const {
1960
- attributes: p
1961
- } = i;
1962
- if (!p || ut(i))
1963
- return;
1964
- const f = {
1965
- attrName: "",
1966
- attrValue: "",
1967
- keepAttr: !0,
1968
- allowedAttributes: P,
1969
- forceKeepAttr: void 0
1970
- };
1971
- let R = p.length;
1972
- for (; R--; ) {
1973
- const $ = p[R], {
1974
- name: M,
1975
- namespaceURI: q,
1976
- value: Y
1977
- } = $, we = D(M);
1978
- let F = M === "value" ? Y : Le(Y);
1979
- if (f.attrName = we, f.attrValue = F, f.keepAttr = !0, f.forceKeepAttr = void 0, ee(B.uponSanitizeAttribute, i, f), F = f.attrValue, Ft && (we === "id" || we === "name") && ($e(M, i), F = ei + F), nt && N(/((--!?|])>)|<\/(style|title)/i, F)) {
1980
- $e(M, i);
1981
- continue;
1982
- }
1983
- if (f.forceKeepAttr || ($e(M, i), !f.keepAttr))
1984
- continue;
1985
- if (!Ut && N(/\/>/i, F)) {
1986
- $e(M, i);
1987
- continue;
1988
- }
1989
- oe && c([Ve, Ke, Je], (rn) => {
1990
- F = Q(F, rn, " ");
1991
- });
1992
- const nn = D(i.nodeName);
1993
- if (Jt(nn, we, F)) {
1994
- if (U && typeof Ce == "object" && typeof Ce.getAttributeType == "function" && !q)
1995
- switch (Ce.getAttributeType(nn, we)) {
1996
- case "TrustedHTML": {
1997
- F = U.createHTML(F);
1998
- break;
1999
- }
2000
- case "TrustedScriptURL": {
2001
- F = U.createScriptURL(F);
2002
- break;
2003
- }
2004
- }
2005
- try {
2006
- q ? i.setAttributeNS(q, M, F) : i.setAttribute(M, F), ut(i) ? Z(i) : m(g.removed);
2007
- } catch {
2008
- }
2009
- }
2010
- }
2011
- ee(B.afterSanitizeAttributes, i, null);
2012
- }, li = function d(i) {
2013
- let p = null;
2014
- const f = Qt(i);
2015
- for (ee(B.beforeSanitizeShadowDOM, i, null); p = f.nextNode(); )
2016
- ee(B.uponSanitizeShadowNode, p, null), Kt(p), tn(p), p.content instanceof K && d(p.content);
2017
- ee(B.afterSanitizeShadowDOM, i, null);
2018
- };
2019
- return g.sanitize = function(d) {
2020
- let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, p = null, f = null, R = null, $ = null;
2021
- if (lt = !d, lt && (d = "<!-->"), typeof d != "string" && !Vt(d))
2022
- if (typeof d.toString == "function") {
2023
- if (d = d.toString(), typeof d != "string")
2024
- throw V("dirty is not a string, aborting");
2025
- } else
2026
- throw V("toString is not a function");
2027
- if (!g.isSupported)
2028
- return d;
2029
- if (it || ct(i), g.removed = [], typeof d == "string" && (xe = !1), xe) {
2030
- if (d.nodeName) {
2031
- const Y = D(d.nodeName);
2032
- if (!O[Y] || be[Y])
2033
- throw V("root node is forbidden and cannot be sanitized in-place");
2034
- }
2035
- } else if (d instanceof Xe)
2036
- p = Xt("<!---->"), f = p.ownerDocument.importNode(d, !0), f.nodeType === ge.element && f.nodeName === "BODY" || f.nodeName === "HTML" ? p = f : p.appendChild(f);
2037
- else {
2038
- if (!le && !oe && !ne && // eslint-disable-next-line unicorn/prefer-includes
2039
- d.indexOf("<") === -1)
2040
- return U && Ne ? U.createHTML(d) : d;
2041
- if (p = Xt(d), !p)
2042
- return le ? null : Ne ? ke : "";
2043
- }
2044
- p && rt && Z(p.firstChild);
2045
- const M = Qt(xe ? d : p);
2046
- for (; R = M.nextNode(); )
2047
- Kt(R), tn(R), R.content instanceof K && li(R.content);
2048
- if (xe)
2049
- return d;
2050
- if (le) {
2051
- if (De)
2052
- for ($ = Zn.call(p.ownerDocument); p.firstChild; )
2053
- $.appendChild(p.firstChild);
2054
- else
2055
- $ = p;
2056
- return (P.shadowroot || P.shadowrootmode) && ($ = Xn.call(w, $, !0)), $;
2057
- }
2058
- let q = ne ? p.outerHTML : p.innerHTML;
2059
- return ne && O["!doctype"] && p.ownerDocument && p.ownerDocument.doctype && p.ownerDocument.doctype.name && N(Lt, p.ownerDocument.doctype.name) && (q = "<!DOCTYPE " + p.ownerDocument.doctype.name + `>
2060
- ` + q), oe && c([Ve, Ke, Je], (Y) => {
2061
- q = Q(q, Y, " ");
2062
- }), U && Ne ? U.createHTML(q) : q;
2063
- }, g.setConfig = function() {
2064
- let d = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2065
- ct(d), it = !0;
2066
- }, g.clearConfig = function() {
2067
- pe = null, it = !1;
2068
- }, g.isValidAttribute = function(d, i, p) {
2069
- pe || ct({});
2070
- const f = D(d), R = D(i);
2071
- return Jt(f, R, p);
2072
- }, g.addHook = function(d, i) {
2073
- typeof i == "function" && b(B[d], i);
2074
- }, g.removeHook = function(d, i) {
2075
- if (i !== void 0) {
2076
- const p = k(B[d], i);
2077
- return p === -1 ? void 0 : L(B[d], p, 1)[0];
2078
- }
2079
- return m(B[d]);
2080
- }, g.removeHooks = function(d) {
2081
- B[d] = [];
2082
- }, g.removeAllHooks = function() {
2083
- B = Ct();
2084
- }, g;
2085
- }
2086
- var $n = Ot();
2087
- return pt = $n, pt;
2088
- }
2089
- var ht, hn;
2090
- function Zi() {
2091
- return hn || (hn = 1, ht = window.DOMPurify || (window.DOMPurify = pn().default || pn())), ht;
2092
- }
2093
- var Yi = Zi();
2094
- const Vi = /* @__PURE__ */ ji(Yi);
2095
- export {
2096
- Vi as D,
2097
- Qi as c,
2098
- S as m
2099
- };