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