@clevertask/scribe 0.0.2 → 0.0.4
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/dist/{SlashCommandList-D_Ndw6pj.js → SlashCommandList-DLPd43Tg.js} +538 -538
- package/dist/assets/index.css +1 -0
- package/dist/{browser-D3_ToIiA.js → browser-Ce149ePN.js} +497 -508
- package/dist/components/Menu/BubbleMenu.js +1 -1
- package/dist/components/Scribe/extension/extension-link.js +482 -432
- 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 +2706 -568
- package/dist/components/Scribe/extension/math-extension.d.ts +2 -0
- package/dist/components/Scribe/extension/math-extension.js +11768 -0
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +3 -3
- package/dist/components/Scribe/extension/slashCommand/index.js +76 -75
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +2 -2
- package/dist/components/Scribe/index.d.ts +4 -3
- package/dist/components/Scribe/index.js +67 -66
- package/dist/{index-Cu10LNOZ.js → index-Bl1eZGET.js} +520 -516
- package/dist/{index-CzwFCNeI.js → index-pCZujIH1.js} +2074 -1965
- package/dist/main.css +10 -1
- package/dist/{turndown.browser.es-CeowJDZ0.js → turndown.browser.es-BSoGafvq.js} +249 -253
- package/dist/utils/html-to-markdown.js +1 -1
- package/dist/utils/markdown-to-html.js +1 -1
- package/package.json +43 -38
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
function
|
|
1
|
+
var ai = Object.defineProperty;
|
|
2
|
+
var ci = (h, e, t) => e in h ? ai(h, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[e] = t;
|
|
3
|
+
var y = (h, e, t) => ci(h, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
var Qi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
5
|
+
function ui(h) {
|
|
6
6
|
return h && h.__esModule && Object.prototype.hasOwnProperty.call(h, "default") ? h.default : h;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function gt() {
|
|
9
9
|
return {
|
|
10
10
|
async: !1,
|
|
11
11
|
breaks: !1,
|
|
@@ -19,23 +19,23 @@ function ht() {
|
|
|
19
19
|
walkTokens: null
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
let
|
|
23
|
-
function
|
|
24
|
-
|
|
22
|
+
let re = gt();
|
|
23
|
+
function fn(h) {
|
|
24
|
+
re = h;
|
|
25
25
|
}
|
|
26
26
|
const Ee = { exec: () => null };
|
|
27
|
-
function
|
|
27
|
+
function E(h, e = "") {
|
|
28
28
|
let t = typeof h == "string" ? h : h.source;
|
|
29
29
|
const n = {
|
|
30
30
|
replace: (o, r) => {
|
|
31
31
|
let s = typeof r == "string" ? r : r.source;
|
|
32
|
-
return s = s.replace(
|
|
32
|
+
return s = s.replace(H.caret, "$1"), t = t.replace(o, s), n;
|
|
33
33
|
},
|
|
34
34
|
getRegex: () => new RegExp(t, e)
|
|
35
35
|
};
|
|
36
36
|
return n;
|
|
37
37
|
}
|
|
38
|
-
const
|
|
38
|
+
const H = {
|
|
39
39
|
codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
|
|
40
40
|
outputLinkReplace: /\\([\[\]])/g,
|
|
41
41
|
indentCodeCompensation: /^(\s+)(?:```)/,
|
|
@@ -92,110 +92,112 @@ const F = {
|
|
|
92
92
|
fencesBeginRegex: (h) => new RegExp(`^ {0,${Math.min(3, h - 1)}}(?:\`\`\`|~~~)`),
|
|
93
93
|
headingBeginRegex: (h) => new RegExp(`^ {0,${Math.min(3, h - 1)}}#`),
|
|
94
94
|
htmlBeginRegex: (h) => new RegExp(`^ {0,${Math.min(3, h - 1)}}<(?:[a-z].*>|!--)`, "i")
|
|
95
|
-
},
|
|
96
|
-
blockquote:
|
|
97
|
-
code:
|
|
98
|
-
def:
|
|
99
|
-
fences:
|
|
100
|
-
heading:
|
|
101
|
-
hr:
|
|
102
|
-
html:
|
|
103
|
-
lheading:
|
|
104
|
-
list:
|
|
105
|
-
newline:
|
|
106
|
-
paragraph:
|
|
95
|
+
}, pi = /^(?:[ \t]*(?:\n|$))+/, hi = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, fi = /^ {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+|$)/, gi = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, dt = /(?:[*+-]|\d{1,9}[.)])/, gn = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, dn = E(gn).replace(/bull/g, dt).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), di = E(gn).replace(/bull/g, dt).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), mt = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, mi = /^[^\n]+/, kt = /(?!\s*\])(?:\\.|[^\[\]\\])+/, ki = E(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", kt).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), bi = E(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, dt).getRegex(), Ge = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", bt = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, xi = E("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", bt).replace("tag", Ge).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), mn = E(mt).replace("hr", ye).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Ge).getRegex(), Ti = E(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", mn).getRegex(), xt = {
|
|
96
|
+
blockquote: Ti,
|
|
97
|
+
code: hi,
|
|
98
|
+
def: ki,
|
|
99
|
+
fences: fi,
|
|
100
|
+
heading: gi,
|
|
101
|
+
hr: ye,
|
|
102
|
+
html: xi,
|
|
103
|
+
lheading: dn,
|
|
104
|
+
list: bi,
|
|
105
|
+
newline: pi,
|
|
106
|
+
paragraph: mn,
|
|
107
107
|
table: Ee,
|
|
108
|
-
text:
|
|
109
|
-
},
|
|
110
|
-
...
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
},
|
|
114
|
-
|
|
115
|
-
|
|
108
|
+
text: mi
|
|
109
|
+
}, sn = E("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", ye).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Ge).getRegex(), wi = {
|
|
110
|
+
...xt,
|
|
111
|
+
lheading: di,
|
|
112
|
+
table: sn,
|
|
113
|
+
paragraph: E(mt).replace("hr", ye).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", sn).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Ge).getRegex()
|
|
114
|
+
}, _i = {
|
|
115
|
+
...xt,
|
|
116
|
+
html: E(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", bt).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
|
|
116
117
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
117
118
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
118
119
|
fences: Ee,
|
|
119
120
|
// fences not supported
|
|
120
121
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
121
|
-
paragraph:
|
|
122
|
-
]`).replace("lheading",
|
|
123
|
-
},
|
|
122
|
+
paragraph: E(mt).replace("hr", ye).replace("heading", ` *#{1,6} *[^
|
|
123
|
+
]`).replace("lheading", dn).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
124
|
+
}, Ai = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ei = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, kn = /^( {2,}|\\)\n(?!\s*$)/, Si = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, qe = /[\p{P}\p{S}]/u, Tt = /[\s\p{P}\p{S}]/u, bn = /[^\s\p{P}\p{S}]/u, yi = E(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, Tt).getRegex(), xn = /(?!~)[\p{P}\p{S}]/u, Ri = /(?!~)[\s\p{P}\p{S}]/u, Li = /(?:[^\s\p{P}\p{S}]|~)/u, Ii = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g, Tn = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, Ci = E(Tn, "u").replace(/punct/g, qe).getRegex(), Oi = E(Tn, "u").replace(/punct/g, xn).getRegex(), wn = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Di = E(wn, "gu").replace(/notPunctSpace/g, bn).replace(/punctSpace/g, Tt).replace(/punct/g, qe).getRegex(), Ni = E(wn, "gu").replace(/notPunctSpace/g, Li).replace(/punctSpace/g, Ri).replace(/punct/g, xn).getRegex(), Pi = E("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, bn).replace(/punctSpace/g, Tt).replace(/punct/g, qe).getRegex(), Mi = E(/\\(punct)/, "gu").replace(/punct/g, qe).getRegex(), zi = E(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), vi = E(bt).replace("(?:-->|$)", "-->").getRegex(), $i = E("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", vi).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Be = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, Ui = E(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", Be).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), _n = E(/^!?\[(label)\]\[(ref)\]/).replace("label", Be).replace("ref", kt).getRegex(), An = E(/^!?\[(ref)\](?:\[\])?/).replace("ref", kt).getRegex(), Bi = E("reflink|nolink(?!\\()", "g").replace("reflink", _n).replace("nolink", An).getRegex(), wt = {
|
|
124
125
|
_backpedal: Ee,
|
|
125
126
|
// only used for GFM url
|
|
126
|
-
anyPunctuation:
|
|
127
|
-
autolink:
|
|
128
|
-
blockSkip:
|
|
129
|
-
br:
|
|
130
|
-
code:
|
|
127
|
+
anyPunctuation: Mi,
|
|
128
|
+
autolink: zi,
|
|
129
|
+
blockSkip: Ii,
|
|
130
|
+
br: kn,
|
|
131
|
+
code: Ei,
|
|
131
132
|
del: Ee,
|
|
132
|
-
emStrongLDelim:
|
|
133
|
-
emStrongRDelimAst:
|
|
134
|
-
emStrongRDelimUnd:
|
|
135
|
-
escape:
|
|
136
|
-
link:
|
|
137
|
-
nolink:
|
|
138
|
-
punctuation:
|
|
139
|
-
reflink:
|
|
140
|
-
reflinkSearch:
|
|
141
|
-
tag:
|
|
142
|
-
text:
|
|
133
|
+
emStrongLDelim: Ci,
|
|
134
|
+
emStrongRDelimAst: Di,
|
|
135
|
+
emStrongRDelimUnd: Pi,
|
|
136
|
+
escape: Ai,
|
|
137
|
+
link: Ui,
|
|
138
|
+
nolink: An,
|
|
139
|
+
punctuation: yi,
|
|
140
|
+
reflink: _n,
|
|
141
|
+
reflinkSearch: Bi,
|
|
142
|
+
tag: $i,
|
|
143
|
+
text: Si,
|
|
143
144
|
url: Ee
|
|
144
|
-
},
|
|
145
|
-
...
|
|
146
|
-
link:
|
|
147
|
-
reflink:
|
|
148
|
-
},
|
|
149
|
-
...
|
|
150
|
-
|
|
151
|
-
|
|
145
|
+
}, Fi = {
|
|
146
|
+
...wt,
|
|
147
|
+
link: E(/^!?\[(label)\]\((.*?)\)/).replace("label", Be).getRegex(),
|
|
148
|
+
reflink: E(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Be).getRegex()
|
|
149
|
+
}, ft = {
|
|
150
|
+
...wt,
|
|
151
|
+
emStrongRDelimAst: Ni,
|
|
152
|
+
emStrongLDelim: Oi,
|
|
153
|
+
url: E(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
152
154
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
153
155
|
del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
|
|
154
156
|
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
|
155
|
-
},
|
|
156
|
-
...
|
|
157
|
-
br:
|
|
158
|
-
text:
|
|
159
|
-
},
|
|
160
|
-
normal:
|
|
161
|
-
gfm:
|
|
162
|
-
pedantic:
|
|
157
|
+
}, Hi = {
|
|
158
|
+
...ft,
|
|
159
|
+
br: E(kn).replace("{2,}", "*").getRegex(),
|
|
160
|
+
text: E(ft.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
161
|
+
}, Ue = {
|
|
162
|
+
normal: xt,
|
|
163
|
+
gfm: wi,
|
|
164
|
+
pedantic: _i
|
|
163
165
|
}, _e = {
|
|
164
|
-
normal:
|
|
165
|
-
gfm:
|
|
166
|
-
breaks:
|
|
167
|
-
pedantic:
|
|
168
|
-
},
|
|
166
|
+
normal: wt,
|
|
167
|
+
gfm: ft,
|
|
168
|
+
breaks: Hi,
|
|
169
|
+
pedantic: Fi
|
|
170
|
+
}, Gi = {
|
|
169
171
|
"&": "&",
|
|
170
172
|
"<": "<",
|
|
171
173
|
">": ">",
|
|
172
174
|
'"': """,
|
|
173
175
|
"'": "'"
|
|
174
|
-
},
|
|
176
|
+
}, on = (h) => Gi[h];
|
|
175
177
|
function X(h, e) {
|
|
176
178
|
if (e) {
|
|
177
|
-
if (
|
|
178
|
-
return h.replace(
|
|
179
|
-
} else if (
|
|
180
|
-
return h.replace(
|
|
179
|
+
if (H.escapeTest.test(h))
|
|
180
|
+
return h.replace(H.escapeReplace, on);
|
|
181
|
+
} else if (H.escapeTestNoEncode.test(h))
|
|
182
|
+
return h.replace(H.escapeReplaceNoEncode, on);
|
|
181
183
|
return h;
|
|
182
184
|
}
|
|
183
|
-
function
|
|
185
|
+
function ln(h) {
|
|
184
186
|
try {
|
|
185
|
-
h = encodeURI(h).replace(
|
|
187
|
+
h = encodeURI(h).replace(H.percentDecode, "%");
|
|
186
188
|
} catch {
|
|
187
189
|
return null;
|
|
188
190
|
}
|
|
189
191
|
return h;
|
|
190
192
|
}
|
|
191
|
-
function
|
|
193
|
+
function an(h, e) {
|
|
192
194
|
var r;
|
|
193
|
-
const t = h.replace(
|
|
195
|
+
const t = h.replace(H.findPipe, (s, l, u) => {
|
|
194
196
|
let a = !1, c = l;
|
|
195
197
|
for (; --c >= 0 && u[c] === "\\"; )
|
|
196
198
|
a = !a;
|
|
197
199
|
return a ? "|" : " |";
|
|
198
|
-
}), n = t.split(
|
|
200
|
+
}), n = t.split(H.splitPipe);
|
|
199
201
|
let o = 0;
|
|
200
202
|
if (n[0].trim() || n.shift(), n.length > 0 && !((r = n.at(-1)) != null && r.trim()) && n.pop(), e)
|
|
201
203
|
if (n.length > e)
|
|
@@ -204,7 +206,7 @@ function on(h, e) {
|
|
|
204
206
|
for (; n.length < e; )
|
|
205
207
|
n.push("");
|
|
206
208
|
for (; o < n.length; o++)
|
|
207
|
-
n[o] = n[o].trim().replace(
|
|
209
|
+
n[o] = n[o].trim().replace(H.slashPipe, "|");
|
|
208
210
|
return n;
|
|
209
211
|
}
|
|
210
212
|
function Ae(h, e, t) {
|
|
@@ -212,18 +214,11 @@ function Ae(h, e, t) {
|
|
|
212
214
|
if (n === 0)
|
|
213
215
|
return "";
|
|
214
216
|
let o = 0;
|
|
215
|
-
for (; o < n; )
|
|
216
|
-
|
|
217
|
-
if (r === e && !t)
|
|
218
|
-
o++;
|
|
219
|
-
else if (r !== e && t)
|
|
220
|
-
o++;
|
|
221
|
-
else
|
|
222
|
-
break;
|
|
223
|
-
}
|
|
217
|
+
for (; o < n && h.charAt(n - o - 1) === e; )
|
|
218
|
+
o++;
|
|
224
219
|
return h.slice(0, n - o);
|
|
225
220
|
}
|
|
226
|
-
function
|
|
221
|
+
function qi(h, e) {
|
|
227
222
|
if (h.indexOf(e[1]) === -1)
|
|
228
223
|
return -1;
|
|
229
224
|
let t = 0;
|
|
@@ -234,31 +229,22 @@ function Ni(h, e) {
|
|
|
234
229
|
t++;
|
|
235
230
|
else if (h[n] === e[1] && (t--, t < 0))
|
|
236
231
|
return n;
|
|
237
|
-
return -1;
|
|
232
|
+
return t > 0 ? -2 : -1;
|
|
238
233
|
}
|
|
239
|
-
function
|
|
234
|
+
function cn(h, e, t, n, o) {
|
|
240
235
|
const r = e.href, s = e.title || null, l = h[1].replace(o.other.outputLinkReplace, "$1");
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
type: "link",
|
|
245
|
-
raw: t,
|
|
246
|
-
href: r,
|
|
247
|
-
title: s,
|
|
248
|
-
text: l,
|
|
249
|
-
tokens: n.inlineTokens(l)
|
|
250
|
-
};
|
|
251
|
-
return n.state.inLink = !1, u;
|
|
252
|
-
}
|
|
253
|
-
return {
|
|
254
|
-
type: "image",
|
|
236
|
+
n.state.inLink = !0;
|
|
237
|
+
const u = {
|
|
238
|
+
type: h[0].charAt(0) === "!" ? "image" : "link",
|
|
255
239
|
raw: t,
|
|
256
240
|
href: r,
|
|
257
241
|
title: s,
|
|
258
|
-
text: l
|
|
242
|
+
text: l,
|
|
243
|
+
tokens: n.inlineTokens(l)
|
|
259
244
|
};
|
|
245
|
+
return n.state.inLink = !1, u;
|
|
260
246
|
}
|
|
261
|
-
function
|
|
247
|
+
function Wi(h, e, t) {
|
|
262
248
|
const n = h.match(t.other.indentCodeCompensation);
|
|
263
249
|
if (n === null)
|
|
264
250
|
return e;
|
|
@@ -273,14 +259,14 @@ function Mi(h, e, t) {
|
|
|
273
259
|
}).join(`
|
|
274
260
|
`);
|
|
275
261
|
}
|
|
276
|
-
class
|
|
262
|
+
class Fe {
|
|
277
263
|
// set by the lexer
|
|
278
264
|
constructor(e) {
|
|
279
|
-
|
|
280
|
-
|
|
265
|
+
y(this, "options");
|
|
266
|
+
y(this, "rules");
|
|
281
267
|
// set by the lexer
|
|
282
|
-
|
|
283
|
-
this.options = e ||
|
|
268
|
+
y(this, "lexer");
|
|
269
|
+
this.options = e || re;
|
|
284
270
|
}
|
|
285
271
|
space(e) {
|
|
286
272
|
const t = this.rules.block.newline.exec(e);
|
|
@@ -306,7 +292,7 @@ class Be {
|
|
|
306
292
|
fences(e) {
|
|
307
293
|
const t = this.rules.block.fences.exec(e);
|
|
308
294
|
if (t) {
|
|
309
|
-
const n = t[0], o =
|
|
295
|
+
const n = t[0], o = Wi(n, t[3] || "", this.rules);
|
|
310
296
|
return {
|
|
311
297
|
type: "code",
|
|
312
298
|
raw: n,
|
|
@@ -369,20 +355,20 @@ ${k}` : k;
|
|
|
369
355
|
const m = this.lexer.state.top;
|
|
370
356
|
if (this.lexer.state.top = !0, this.lexer.blockTokens(k, s, !0), this.lexer.state.top = m, n.length === 0)
|
|
371
357
|
break;
|
|
372
|
-
const
|
|
373
|
-
if ((
|
|
358
|
+
const b = s.at(-1);
|
|
359
|
+
if ((b == null ? void 0 : b.type) === "code")
|
|
374
360
|
break;
|
|
375
|
-
if ((
|
|
376
|
-
const
|
|
361
|
+
if ((b == null ? void 0 : b.type) === "blockquote") {
|
|
362
|
+
const L = b, A = L.raw + `
|
|
377
363
|
` + n.join(`
|
|
378
|
-
`),
|
|
379
|
-
s[s.length - 1] =
|
|
364
|
+
`), z = this.blockquote(A);
|
|
365
|
+
s[s.length - 1] = z, o = o.substring(0, o.length - L.raw.length) + z.raw, r = r.substring(0, r.length - L.text.length) + z.text;
|
|
380
366
|
break;
|
|
381
|
-
} else if ((
|
|
382
|
-
const
|
|
367
|
+
} else if ((b == null ? void 0 : b.type) === "list") {
|
|
368
|
+
const L = b, A = L.raw + `
|
|
383
369
|
` + n.join(`
|
|
384
|
-
`),
|
|
385
|
-
s[s.length - 1] =
|
|
370
|
+
`), z = this.list(A);
|
|
371
|
+
s[s.length - 1] = z, o = o.substring(0, o.length - b.raw.length) + z.raw, r = r.substring(0, r.length - L.raw.length) + z.raw, n = A.substring(s.at(-1).raw.length).split(`
|
|
386
372
|
`);
|
|
387
373
|
continue;
|
|
388
374
|
}
|
|
@@ -416,44 +402,48 @@ ${k}` : k;
|
|
|
416
402
|
break;
|
|
417
403
|
c = t[0], e = e.substring(c.length);
|
|
418
404
|
let m = t[2].split(`
|
|
419
|
-
`, 1)[0].replace(this.rules.other.listReplaceTabs, (
|
|
420
|
-
`, 1)[0],
|
|
421
|
-
if (this.options.pedantic ? (A = 2, k = m.trimStart()) :
|
|
422
|
-
`, e = e.substring(
|
|
423
|
-
const
|
|
405
|
+
`, 1)[0].replace(this.rules.other.listReplaceTabs, (Q) => " ".repeat(3 * Q.length)), b = e.split(`
|
|
406
|
+
`, 1)[0], L = !m.trim(), A = 0;
|
|
407
|
+
if (this.options.pedantic ? (A = 2, k = m.trimStart()) : L ? A = t[1].length + 1 : (A = t[2].search(this.rules.other.nonSpaceChar), A = A > 4 ? 1 : A, k = m.slice(A), A += t[1].length), L && this.rules.other.blankLine.test(b) && (c += b + `
|
|
408
|
+
`, e = e.substring(b.length + 1), a = !0), !a) {
|
|
409
|
+
const Q = this.rules.other.nextBulletRegex(A), Re = this.rules.other.hrRegex(A), Le = this.rules.other.fencesBeginRegex(A), G = this.rules.other.headingBeginRegex(A), N = this.rules.other.htmlBeginRegex(A);
|
|
424
410
|
for (; e; ) {
|
|
425
|
-
const
|
|
411
|
+
const V = e.split(`
|
|
426
412
|
`, 1)[0];
|
|
427
|
-
let
|
|
428
|
-
if (
|
|
413
|
+
let I;
|
|
414
|
+
if (b = V, this.options.pedantic ? (b = b.replace(this.rules.other.listReplaceNesting, " "), I = b) : I = b.replace(this.rules.other.tabCharGlobal, " "), Le.test(b) || G.test(b) || N.test(b) || Q.test(b) || Re.test(b))
|
|
429
415
|
break;
|
|
430
|
-
if (
|
|
416
|
+
if (I.search(this.rules.other.nonSpaceChar) >= A || !b.trim())
|
|
431
417
|
k += `
|
|
432
|
-
` +
|
|
418
|
+
` + I.slice(A);
|
|
433
419
|
else {
|
|
434
|
-
if (
|
|
420
|
+
if (L || m.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || Le.test(m) || G.test(m) || Re.test(m))
|
|
435
421
|
break;
|
|
436
422
|
k += `
|
|
437
|
-
` +
|
|
423
|
+
` + b;
|
|
438
424
|
}
|
|
439
|
-
!
|
|
440
|
-
`, e = e.substring(
|
|
425
|
+
!L && !b.trim() && (L = !0), c += V + `
|
|
426
|
+
`, e = e.substring(V.length + 1), m = I.slice(A);
|
|
441
427
|
}
|
|
442
428
|
}
|
|
443
429
|
r.loose || (l ? r.loose = !0 : this.rules.other.doubleBlankLine.test(c) && (l = !0));
|
|
444
|
-
let
|
|
445
|
-
this.options.gfm && (
|
|
430
|
+
let z = null, he;
|
|
431
|
+
this.options.gfm && (z = this.rules.other.listIsTask.exec(k), z && (he = z[0] !== "[ ] ", k = k.replace(this.rules.other.listReplaceTask, ""))), r.items.push({
|
|
446
432
|
type: "list_item",
|
|
447
433
|
raw: c,
|
|
448
|
-
task: !!
|
|
449
|
-
checked:
|
|
434
|
+
task: !!z,
|
|
435
|
+
checked: he,
|
|
450
436
|
loose: !1,
|
|
451
437
|
text: k,
|
|
452
438
|
tokens: []
|
|
453
439
|
}), r.raw += c;
|
|
454
440
|
}
|
|
455
441
|
const u = r.items.at(-1);
|
|
456
|
-
|
|
442
|
+
if (u)
|
|
443
|
+
u.raw = u.raw.trimEnd(), u.text = u.text.trimEnd();
|
|
444
|
+
else
|
|
445
|
+
return;
|
|
446
|
+
r.raw = r.raw.trimEnd();
|
|
457
447
|
for (let a = 0; a < r.items.length; a++)
|
|
458
448
|
if (this.lexer.state.top = !1, r.items[a].tokens = this.lexer.blockTokens(r.items[a].text, []), !r.loose) {
|
|
459
449
|
const c = r.items[a].tokens.filter((m) => m.type === "space"), k = c.length > 0 && c.some((m) => this.rules.other.anyLine.test(m.raw));
|
|
@@ -494,7 +484,7 @@ ${k}` : k;
|
|
|
494
484
|
const t = this.rules.block.table.exec(e);
|
|
495
485
|
if (!t || !this.rules.other.tableDelimiter.test(t[2]))
|
|
496
486
|
return;
|
|
497
|
-
const n =
|
|
487
|
+
const n = an(t[1]), o = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = (l = t[3]) != null && l.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
498
488
|
`) : [], s = {
|
|
499
489
|
type: "table",
|
|
500
490
|
raw: t[0],
|
|
@@ -513,7 +503,7 @@ ${k}` : k;
|
|
|
513
503
|
align: s.align[u]
|
|
514
504
|
});
|
|
515
505
|
for (const u of r)
|
|
516
|
-
s.rows.push(
|
|
506
|
+
s.rows.push(an(u, s.header.length).map((a, c) => ({
|
|
517
507
|
text: a,
|
|
518
508
|
tokens: this.lexer.inline(a),
|
|
519
509
|
header: !1,
|
|
@@ -588,7 +578,9 @@ ${k}` : k;
|
|
|
588
578
|
if ((n.length - s.length) % 2 === 0)
|
|
589
579
|
return;
|
|
590
580
|
} else {
|
|
591
|
-
const s =
|
|
581
|
+
const s = qi(t[2], "()");
|
|
582
|
+
if (s === -2)
|
|
583
|
+
return;
|
|
592
584
|
if (s > -1) {
|
|
593
585
|
const u = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + s;
|
|
594
586
|
t[2] = t[2].substring(0, s), t[0] = t[0].substring(0, u).trim(), t[3] = "";
|
|
@@ -600,7 +592,7 @@ ${k}` : k;
|
|
|
600
592
|
s && (o = s[1], r = s[3]);
|
|
601
593
|
} else
|
|
602
594
|
r = t[3] ? t[3].slice(1, -1) : "";
|
|
603
|
-
return o = o.trim(), this.rules.other.startAngleBracket.test(o) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? o = o.slice(1) : o = o.slice(1, -1)),
|
|
595
|
+
return o = o.trim(), this.rules.other.startAngleBracket.test(o) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? o = o.slice(1) : o = o.slice(1, -1)), cn(t, {
|
|
604
596
|
href: o && o.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
605
597
|
title: r && r.replace(this.rules.inline.anyPunctuation, "$1")
|
|
606
598
|
}, t[0], this.lexer, this.rules);
|
|
@@ -618,7 +610,7 @@ ${k}` : k;
|
|
|
618
610
|
text: s
|
|
619
611
|
};
|
|
620
612
|
}
|
|
621
|
-
return
|
|
613
|
+
return cn(n, r, n[0], this.lexer, this.rules);
|
|
622
614
|
}
|
|
623
615
|
}
|
|
624
616
|
emStrong(e, t, n = "") {
|
|
@@ -642,22 +634,22 @@ ${k}` : k;
|
|
|
642
634
|
if (a -= u, a > 0)
|
|
643
635
|
continue;
|
|
644
636
|
u = Math.min(u, u + a + c);
|
|
645
|
-
const m = [...o[0]][0].length,
|
|
637
|
+
const m = [...o[0]][0].length, b = e.slice(0, s + o.index + m + u);
|
|
646
638
|
if (Math.min(s, u) % 2) {
|
|
647
|
-
const A =
|
|
639
|
+
const A = b.slice(1, -1);
|
|
648
640
|
return {
|
|
649
641
|
type: "em",
|
|
650
|
-
raw:
|
|
642
|
+
raw: b,
|
|
651
643
|
text: A,
|
|
652
644
|
tokens: this.lexer.inlineTokens(A)
|
|
653
645
|
};
|
|
654
646
|
}
|
|
655
|
-
const
|
|
647
|
+
const L = b.slice(2, -2);
|
|
656
648
|
return {
|
|
657
649
|
type: "strong",
|
|
658
|
-
raw:
|
|
659
|
-
text:
|
|
660
|
-
tokens: this.lexer.inlineTokens(
|
|
650
|
+
raw: b,
|
|
651
|
+
text: L,
|
|
652
|
+
tokens: this.lexer.inlineTokens(L)
|
|
661
653
|
};
|
|
662
654
|
}
|
|
663
655
|
}
|
|
@@ -753,31 +745,31 @@ ${k}` : k;
|
|
|
753
745
|
}
|
|
754
746
|
}
|
|
755
747
|
}
|
|
756
|
-
class
|
|
748
|
+
class W {
|
|
757
749
|
constructor(e) {
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e ||
|
|
750
|
+
y(this, "tokens");
|
|
751
|
+
y(this, "options");
|
|
752
|
+
y(this, "state");
|
|
753
|
+
y(this, "tokenizer");
|
|
754
|
+
y(this, "inlineQueue");
|
|
755
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || re, this.options.tokenizer = this.options.tokenizer || new Fe(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
764
756
|
inLink: !1,
|
|
765
757
|
inRawBlock: !1,
|
|
766
758
|
top: !0
|
|
767
759
|
};
|
|
768
760
|
const t = {
|
|
769
|
-
other:
|
|
770
|
-
block:
|
|
761
|
+
other: H,
|
|
762
|
+
block: Ue.normal,
|
|
771
763
|
inline: _e.normal
|
|
772
764
|
};
|
|
773
|
-
this.options.pedantic ? (t.block =
|
|
765
|
+
this.options.pedantic ? (t.block = Ue.pedantic, t.inline = _e.pedantic) : this.options.gfm && (t.block = Ue.gfm, this.options.breaks ? t.inline = _e.breaks : t.inline = _e.gfm), this.tokenizer.rules = t;
|
|
774
766
|
}
|
|
775
767
|
/**
|
|
776
768
|
* Expose Rules
|
|
777
769
|
*/
|
|
778
770
|
static get rules() {
|
|
779
771
|
return {
|
|
780
|
-
block:
|
|
772
|
+
block: Ue,
|
|
781
773
|
inline: _e
|
|
782
774
|
};
|
|
783
775
|
}
|
|
@@ -785,19 +777,19 @@ class q {
|
|
|
785
777
|
* Static Lex Method
|
|
786
778
|
*/
|
|
787
779
|
static lex(e, t) {
|
|
788
|
-
return new
|
|
780
|
+
return new W(t).lex(e);
|
|
789
781
|
}
|
|
790
782
|
/**
|
|
791
783
|
* Static Lex Inline Method
|
|
792
784
|
*/
|
|
793
785
|
static lexInline(e, t) {
|
|
794
|
-
return new
|
|
786
|
+
return new W(t).inlineTokens(e);
|
|
795
787
|
}
|
|
796
788
|
/**
|
|
797
789
|
* Preprocessing
|
|
798
790
|
*/
|
|
799
791
|
lex(e) {
|
|
800
|
-
e = e.replace(
|
|
792
|
+
e = e.replace(H.carriageReturn, `
|
|
801
793
|
`), this.blockTokens(e, this.tokens);
|
|
802
794
|
for (let t = 0; t < this.inlineQueue.length; t++) {
|
|
803
795
|
const n = this.inlineQueue[t];
|
|
@@ -807,7 +799,7 @@ class q {
|
|
|
807
799
|
}
|
|
808
800
|
blockTokens(e, t = [], n = !1) {
|
|
809
801
|
var o, r, s;
|
|
810
|
-
for (this.options.pedantic && (e = e.replace(
|
|
802
|
+
for (this.options.pedantic && (e = e.replace(H.tabCharGlobal, " ").replace(H.spaceLine, "")); e; ) {
|
|
811
803
|
let l;
|
|
812
804
|
if ((r = (o = this.options.extensions) == null ? void 0 : o.block) != null && r.some((a) => (l = a.call({ lexer: this }, e, t)) ? (e = e.substring(l.raw.length), t.push(l), !0) : !1))
|
|
813
805
|
continue;
|
|
@@ -919,10 +911,10 @@ class q {
|
|
|
919
911
|
for (; (o = this.tokenizer.rules.inline.reflinkSearch.exec(n)) != null; )
|
|
920
912
|
c.includes(o[0].slice(o[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, o.index) + "[" + "a".repeat(o[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
921
913
|
}
|
|
922
|
-
for (; (o = this.tokenizer.rules.inline.blockSkip.exec(n)) != null; )
|
|
923
|
-
n = n.slice(0, o.index) + "[" + "a".repeat(o[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
924
914
|
for (; (o = this.tokenizer.rules.inline.anyPunctuation.exec(n)) != null; )
|
|
925
915
|
n = n.slice(0, o.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
916
|
+
for (; (o = this.tokenizer.rules.inline.blockSkip.exec(n)) != null; )
|
|
917
|
+
n = n.slice(0, o.index) + "[" + "a".repeat(o[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
926
918
|
let r = !1, s = "";
|
|
927
919
|
for (; e; ) {
|
|
928
920
|
r || (s = ""), r = !1;
|
|
@@ -974,10 +966,10 @@ class q {
|
|
|
974
966
|
let k = e;
|
|
975
967
|
if ((a = this.options.extensions) != null && a.startInline) {
|
|
976
968
|
let m = 1 / 0;
|
|
977
|
-
const
|
|
978
|
-
let
|
|
969
|
+
const b = e.slice(1);
|
|
970
|
+
let L;
|
|
979
971
|
this.options.extensions.startInline.forEach((A) => {
|
|
980
|
-
|
|
972
|
+
L = A.call({ lexer: this }, b), typeof L == "number" && L >= 0 && (m = Math.min(m, L));
|
|
981
973
|
}), m < 1 / 0 && m >= 0 && (k = e.substring(0, m + 1));
|
|
982
974
|
}
|
|
983
975
|
if (c = this.tokenizer.inlineText(k)) {
|
|
@@ -998,19 +990,19 @@ class q {
|
|
|
998
990
|
return t;
|
|
999
991
|
}
|
|
1000
992
|
}
|
|
1001
|
-
class
|
|
993
|
+
class He {
|
|
1002
994
|
// set by the parser
|
|
1003
995
|
constructor(e) {
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
this.options = e ||
|
|
996
|
+
y(this, "options");
|
|
997
|
+
y(this, "parser");
|
|
998
|
+
this.options = e || re;
|
|
1007
999
|
}
|
|
1008
1000
|
space(e) {
|
|
1009
1001
|
return "";
|
|
1010
1002
|
}
|
|
1011
1003
|
code({ text: e, lang: t, escaped: n }) {
|
|
1012
1004
|
var s;
|
|
1013
|
-
const o = (s = (t || "").match(
|
|
1005
|
+
const o = (s = (t || "").match(H.notSpaceStart)) == null ? void 0 : s[0], r = e.replace(H.endingNewline, "") + `
|
|
1014
1006
|
`;
|
|
1015
1007
|
return o ? '<pre><code class="language-' + X(o) + '">' + (n ? r : X(r, !0)) + `</code></pre>
|
|
1016
1008
|
` : "<pre><code>" + (n ? r : X(r, !0)) + `</code></pre>
|
|
@@ -1114,26 +1106,27 @@ ${e}</tr>
|
|
|
1114
1106
|
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
1115
1107
|
}
|
|
1116
1108
|
link({ href: e, title: t, tokens: n }) {
|
|
1117
|
-
const o = this.parser.parseInline(n), r =
|
|
1109
|
+
const o = this.parser.parseInline(n), r = ln(e);
|
|
1118
1110
|
if (r === null)
|
|
1119
1111
|
return o;
|
|
1120
1112
|
e = r;
|
|
1121
1113
|
let s = '<a href="' + e + '"';
|
|
1122
1114
|
return t && (s += ' title="' + X(t) + '"'), s += ">" + o + "</a>", s;
|
|
1123
1115
|
}
|
|
1124
|
-
image({ href: e, title: t, text: n }) {
|
|
1125
|
-
|
|
1126
|
-
|
|
1116
|
+
image({ href: e, title: t, text: n, tokens: o }) {
|
|
1117
|
+
o && (n = this.parser.parseInline(o, this.parser.textRenderer));
|
|
1118
|
+
const r = ln(e);
|
|
1119
|
+
if (r === null)
|
|
1127
1120
|
return X(n);
|
|
1128
|
-
e =
|
|
1129
|
-
let
|
|
1130
|
-
return t && (
|
|
1121
|
+
e = r;
|
|
1122
|
+
let s = `<img src="${e}" alt="${n}"`;
|
|
1123
|
+
return t && (s += ` title="${X(t)}"`), s += ">", s;
|
|
1131
1124
|
}
|
|
1132
1125
|
text(e) {
|
|
1133
1126
|
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : X(e.text);
|
|
1134
1127
|
}
|
|
1135
1128
|
}
|
|
1136
|
-
class
|
|
1129
|
+
class _t {
|
|
1137
1130
|
// no need for block level renderers
|
|
1138
1131
|
strong({ text: e }) {
|
|
1139
1132
|
return e;
|
|
@@ -1165,10 +1158,10 @@ class xt {
|
|
|
1165
1158
|
}
|
|
1166
1159
|
class j {
|
|
1167
1160
|
constructor(e) {
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
this.options = e ||
|
|
1161
|
+
y(this, "options");
|
|
1162
|
+
y(this, "renderer");
|
|
1163
|
+
y(this, "textRenderer");
|
|
1164
|
+
this.options = e || re, this.options.renderer = this.options.renderer || new He(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new _t();
|
|
1172
1165
|
}
|
|
1173
1166
|
/**
|
|
1174
1167
|
* Static Parse Method
|
|
@@ -1326,11 +1319,11 @@ class j {
|
|
|
1326
1319
|
return n;
|
|
1327
1320
|
}
|
|
1328
1321
|
}
|
|
1329
|
-
class
|
|
1322
|
+
class Se {
|
|
1330
1323
|
constructor(e) {
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
this.options = e ||
|
|
1324
|
+
y(this, "options");
|
|
1325
|
+
y(this, "block");
|
|
1326
|
+
this.options = e || re;
|
|
1334
1327
|
}
|
|
1335
1328
|
/**
|
|
1336
1329
|
* Process markdown before marked
|
|
@@ -1354,7 +1347,7 @@ class ye {
|
|
|
1354
1347
|
* Provide function to tokenize markdown
|
|
1355
1348
|
*/
|
|
1356
1349
|
provideLexer() {
|
|
1357
|
-
return this.block ?
|
|
1350
|
+
return this.block ? W.lex : W.lexInline;
|
|
1358
1351
|
}
|
|
1359
1352
|
/**
|
|
1360
1353
|
* Provide function to parse tokens
|
|
@@ -1363,23 +1356,23 @@ class ye {
|
|
|
1363
1356
|
return this.block ? j.parse : j.parseInline;
|
|
1364
1357
|
}
|
|
1365
1358
|
}
|
|
1366
|
-
|
|
1359
|
+
y(Se, "passThroughHooks", /* @__PURE__ */ new Set([
|
|
1367
1360
|
"preprocess",
|
|
1368
1361
|
"postprocess",
|
|
1369
1362
|
"processAllTokens"
|
|
1370
1363
|
]));
|
|
1371
|
-
class
|
|
1364
|
+
class ji {
|
|
1372
1365
|
constructor(...e) {
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1366
|
+
y(this, "defaults", gt());
|
|
1367
|
+
y(this, "options", this.setOptions);
|
|
1368
|
+
y(this, "parse", this.parseMarkdown(!0));
|
|
1369
|
+
y(this, "parseInline", this.parseMarkdown(!1));
|
|
1370
|
+
y(this, "Parser", j);
|
|
1371
|
+
y(this, "Renderer", He);
|
|
1372
|
+
y(this, "TextRenderer", _t);
|
|
1373
|
+
y(this, "Lexer", W);
|
|
1374
|
+
y(this, "Tokenizer", Fe);
|
|
1375
|
+
y(this, "Hooks", Se);
|
|
1383
1376
|
this.use(...e);
|
|
1384
1377
|
}
|
|
1385
1378
|
/**
|
|
@@ -1436,7 +1429,7 @@ class Pi {
|
|
|
1436
1429
|
}
|
|
1437
1430
|
"childTokens" in r && r.childTokens && (t.childTokens[r.name] = r.childTokens);
|
|
1438
1431
|
}), o.extensions = t), n.renderer) {
|
|
1439
|
-
const r = this.defaults.renderer || new
|
|
1432
|
+
const r = this.defaults.renderer || new He(this.defaults);
|
|
1440
1433
|
for (const s in n.renderer) {
|
|
1441
1434
|
if (!(s in r))
|
|
1442
1435
|
throw new Error(`renderer '${s}' does not exist`);
|
|
@@ -1451,7 +1444,7 @@ class Pi {
|
|
|
1451
1444
|
o.renderer = r;
|
|
1452
1445
|
}
|
|
1453
1446
|
if (n.tokenizer) {
|
|
1454
|
-
const r = this.defaults.tokenizer || new
|
|
1447
|
+
const r = this.defaults.tokenizer || new Fe(this.defaults);
|
|
1455
1448
|
for (const s in n.tokenizer) {
|
|
1456
1449
|
if (!(s in r))
|
|
1457
1450
|
throw new Error(`tokenizer '${s}' does not exist`);
|
|
@@ -1466,14 +1459,14 @@ class Pi {
|
|
|
1466
1459
|
o.tokenizer = r;
|
|
1467
1460
|
}
|
|
1468
1461
|
if (n.hooks) {
|
|
1469
|
-
const r = this.defaults.hooks || new
|
|
1462
|
+
const r = this.defaults.hooks || new Se();
|
|
1470
1463
|
for (const s in n.hooks) {
|
|
1471
1464
|
if (!(s in r))
|
|
1472
1465
|
throw new Error(`hook '${s}' does not exist`);
|
|
1473
1466
|
if (["options", "block"].includes(s))
|
|
1474
1467
|
continue;
|
|
1475
1468
|
const l = s, u = n.hooks[l], a = r[l];
|
|
1476
|
-
|
|
1469
|
+
Se.passThroughHooks.has(s) ? r[l] = (c) => {
|
|
1477
1470
|
if (this.defaults.async)
|
|
1478
1471
|
return Promise.resolve(u.call(r, c)).then((m) => a.call(r, m));
|
|
1479
1472
|
const k = u.call(r, c);
|
|
@@ -1499,7 +1492,7 @@ class Pi {
|
|
|
1499
1492
|
return this.defaults = { ...this.defaults, ...e }, this;
|
|
1500
1493
|
}
|
|
1501
1494
|
lexer(e, t) {
|
|
1502
|
-
return
|
|
1495
|
+
return W.lex(e, t ?? this.defaults);
|
|
1503
1496
|
}
|
|
1504
1497
|
parser(e, t) {
|
|
1505
1498
|
return j.parse(e, t ?? this.defaults);
|
|
@@ -1514,7 +1507,7 @@ class Pi {
|
|
|
1514
1507
|
if (typeof n != "string")
|
|
1515
1508
|
return l(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
|
|
1516
1509
|
s.hooks && (s.hooks.options = s, s.hooks.block = e);
|
|
1517
|
-
const u = s.hooks ? s.hooks.provideLexer() : e ?
|
|
1510
|
+
const u = s.hooks ? s.hooks.provideLexer() : e ? W.lex : W.lexInline, a = s.hooks ? s.hooks.provideParser() : e ? j.parse : j.parseInline;
|
|
1518
1511
|
if (s.async)
|
|
1519
1512
|
return Promise.resolve(s.hooks ? s.hooks.preprocess(n) : n).then((c) => u(c, s)).then((c) => s.hooks ? s.hooks.processAllTokens(c) : c).then((c) => s.walkTokens ? Promise.all(this.walkTokens(c, s.walkTokens)).then(() => c) : c).then((c) => a(c, s)).then((c) => s.hooks ? s.hooks.postprocess(c) : c).catch(l);
|
|
1520
1513
|
try {
|
|
@@ -1541,43 +1534,43 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
1541
1534
|
};
|
|
1542
1535
|
}
|
|
1543
1536
|
}
|
|
1544
|
-
const
|
|
1545
|
-
function
|
|
1546
|
-
return
|
|
1537
|
+
const ie = new ji();
|
|
1538
|
+
function S(h, e) {
|
|
1539
|
+
return ie.parse(h, e);
|
|
1547
1540
|
}
|
|
1548
|
-
|
|
1549
|
-
return
|
|
1541
|
+
S.options = S.setOptions = function(h) {
|
|
1542
|
+
return ie.setOptions(h), S.defaults = ie.defaults, fn(S.defaults), S;
|
|
1550
1543
|
};
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
return
|
|
1544
|
+
S.getDefaults = gt;
|
|
1545
|
+
S.defaults = re;
|
|
1546
|
+
S.use = function(...h) {
|
|
1547
|
+
return ie.use(...h), S.defaults = ie.defaults, fn(S.defaults), S;
|
|
1555
1548
|
};
|
|
1556
|
-
|
|
1557
|
-
return
|
|
1549
|
+
S.walkTokens = function(h, e) {
|
|
1550
|
+
return ie.walkTokens(h, e);
|
|
1558
1551
|
};
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1552
|
+
S.parseInline = ie.parseInline;
|
|
1553
|
+
S.Parser = j;
|
|
1554
|
+
S.parser = j.parse;
|
|
1555
|
+
S.Renderer = He;
|
|
1556
|
+
S.TextRenderer = _t;
|
|
1557
|
+
S.Lexer = W;
|
|
1558
|
+
S.lexer = W.lex;
|
|
1559
|
+
S.Tokenizer = Fe;
|
|
1560
|
+
S.Hooks = Se;
|
|
1561
|
+
S.parse = S;
|
|
1562
|
+
S.options;
|
|
1563
|
+
S.setOptions;
|
|
1564
|
+
S.use;
|
|
1565
|
+
S.walkTokens;
|
|
1566
|
+
S.parseInline;
|
|
1574
1567
|
j.parse;
|
|
1575
|
-
|
|
1576
|
-
/*! @license DOMPurify 3.2.
|
|
1577
|
-
var
|
|
1578
|
-
function
|
|
1579
|
-
if (
|
|
1580
|
-
|
|
1568
|
+
W.lex;
|
|
1569
|
+
/*! @license DOMPurify 3.2.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.5/LICENSE */
|
|
1570
|
+
var pt, un;
|
|
1571
|
+
function pn() {
|
|
1572
|
+
if (un) return pt;
|
|
1573
|
+
un = 1;
|
|
1581
1574
|
const {
|
|
1582
1575
|
entries: h,
|
|
1583
1576
|
setPrototypeOf: e,
|
|
@@ -1602,44 +1595,45 @@ function cn() {
|
|
|
1602
1595
|
}), a || (a = function(g, _) {
|
|
1603
1596
|
return new g(..._);
|
|
1604
1597
|
});
|
|
1605
|
-
const c =
|
|
1606
|
-
function
|
|
1598
|
+
const c = I(Array.prototype.forEach), k = I(Array.prototype.lastIndexOf), m = I(Array.prototype.pop), b = I(Array.prototype.push), L = I(Array.prototype.splice), A = I(String.prototype.toLowerCase), z = I(String.prototype.toString), he = I(String.prototype.match), Q = I(String.prototype.replace), Re = I(String.prototype.indexOf), Le = I(String.prototype.trim), G = I(Object.prototype.hasOwnProperty), N = I(RegExp.prototype.test), V = En(TypeError);
|
|
1599
|
+
function I(T) {
|
|
1607
1600
|
return function(g) {
|
|
1608
|
-
|
|
1609
|
-
|
|
1601
|
+
g instanceof RegExp && (g.lastIndex = 0);
|
|
1602
|
+
for (var _ = arguments.length, w = new Array(_ > 1 ? _ - 1 : 0), v = 1; v < _; v++)
|
|
1603
|
+
w[v - 1] = arguments[v];
|
|
1610
1604
|
return u(T, g, w);
|
|
1611
1605
|
};
|
|
1612
1606
|
}
|
|
1613
|
-
function
|
|
1607
|
+
function En(T) {
|
|
1614
1608
|
return function() {
|
|
1615
1609
|
for (var g = arguments.length, _ = new Array(g), w = 0; w < g; w++)
|
|
1616
1610
|
_[w] = arguments[w];
|
|
1617
1611
|
return a(T, _);
|
|
1618
1612
|
};
|
|
1619
1613
|
}
|
|
1620
|
-
function
|
|
1621
|
-
let _ = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] :
|
|
1614
|
+
function x(T, g) {
|
|
1615
|
+
let _ = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : A;
|
|
1622
1616
|
e && e(T, null);
|
|
1623
1617
|
let w = g.length;
|
|
1624
1618
|
for (; w--; ) {
|
|
1625
|
-
let
|
|
1626
|
-
if (typeof
|
|
1627
|
-
const
|
|
1628
|
-
|
|
1619
|
+
let v = g[w];
|
|
1620
|
+
if (typeof v == "string") {
|
|
1621
|
+
const K = _(v);
|
|
1622
|
+
K !== v && (t(g) || (g[w] = K), v = K);
|
|
1629
1623
|
}
|
|
1630
|
-
T[
|
|
1624
|
+
T[v] = !0;
|
|
1631
1625
|
}
|
|
1632
1626
|
return T;
|
|
1633
1627
|
}
|
|
1634
|
-
function
|
|
1628
|
+
function Sn(T) {
|
|
1635
1629
|
for (let g = 0; g < T.length; g++)
|
|
1636
|
-
|
|
1630
|
+
G(T, g) || (T[g] = null);
|
|
1637
1631
|
return T;
|
|
1638
1632
|
}
|
|
1639
|
-
function
|
|
1633
|
+
function te(T) {
|
|
1640
1634
|
const g = l(null);
|
|
1641
1635
|
for (const [_, w] of h(T))
|
|
1642
|
-
|
|
1636
|
+
G(T, _) && (Array.isArray(w) ? g[_] = Sn(w) : w && typeof w == "object" && w.constructor === Object ? g[_] = te(w) : g[_] = w);
|
|
1643
1637
|
return g;
|
|
1644
1638
|
}
|
|
1645
1639
|
function fe(T, g) {
|
|
@@ -1647,9 +1641,9 @@ function cn() {
|
|
|
1647
1641
|
const w = o(T, g);
|
|
1648
1642
|
if (w) {
|
|
1649
1643
|
if (w.get)
|
|
1650
|
-
return
|
|
1644
|
+
return I(w.get);
|
|
1651
1645
|
if (typeof w.value == "function")
|
|
1652
|
-
return
|
|
1646
|
+
return I(w.value);
|
|
1653
1647
|
}
|
|
1654
1648
|
T = n(T);
|
|
1655
1649
|
}
|
|
@@ -1658,64 +1652,55 @@ function cn() {
|
|
|
1658
1652
|
}
|
|
1659
1653
|
return _;
|
|
1660
1654
|
}
|
|
1661
|
-
const
|
|
1655
|
+
const At = r(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), We = r(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), je = r(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), yn = r(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), Ze = r(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), Rn = r(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Et = r(["#text"]), St = r(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), Ye = r(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), yt = r(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), Ie = r(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), Ln = s(/\{\{[\w\W]*|[\w\W]*\}\}/gm), In = s(/<%[\w\W]*|[\w\W]*%>/gm), Cn = s(/\$\{[\w\W]*/gm), On = s(/^data-[\-\w.\u00B7-\uFFFF]+$/), Dn = s(/^aria-[\-\w]+$/), Rt = s(
|
|
1662
1656
|
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
1663
1657
|
// eslint-disable-line no-useless-escape
|
|
1664
|
-
),
|
|
1658
|
+
), Nn = s(/^(?:\w+script|data):/i), Pn = s(
|
|
1665
1659
|
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
1666
1660
|
// eslint-disable-line no-control-regex
|
|
1667
|
-
),
|
|
1668
|
-
var
|
|
1661
|
+
), Lt = s(/^html$/i), Mn = s(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
1662
|
+
var It = /* @__PURE__ */ Object.freeze({
|
|
1669
1663
|
__proto__: null,
|
|
1670
|
-
ARIA_ATTR:
|
|
1671
|
-
ATTR_WHITESPACE:
|
|
1672
|
-
CUSTOM_ELEMENT:
|
|
1673
|
-
DATA_ATTR:
|
|
1674
|
-
DOCTYPE_NAME:
|
|
1675
|
-
ERB_EXPR:
|
|
1676
|
-
IS_ALLOWED_URI:
|
|
1677
|
-
IS_SCRIPT_OR_DATA:
|
|
1678
|
-
MUSTACHE_EXPR:
|
|
1679
|
-
TMPLIT_EXPR:
|
|
1664
|
+
ARIA_ATTR: Dn,
|
|
1665
|
+
ATTR_WHITESPACE: Pn,
|
|
1666
|
+
CUSTOM_ELEMENT: Mn,
|
|
1667
|
+
DATA_ATTR: On,
|
|
1668
|
+
DOCTYPE_NAME: Lt,
|
|
1669
|
+
ERB_EXPR: In,
|
|
1670
|
+
IS_ALLOWED_URI: Rt,
|
|
1671
|
+
IS_SCRIPT_OR_DATA: Nn,
|
|
1672
|
+
MUSTACHE_EXPR: Ln,
|
|
1673
|
+
TMPLIT_EXPR: Cn
|
|
1680
1674
|
});
|
|
1681
1675
|
const ge = {
|
|
1682
1676
|
element: 1,
|
|
1683
|
-
attribute: 2,
|
|
1684
1677
|
text: 3,
|
|
1685
|
-
cdataSection: 4,
|
|
1686
|
-
entityReference: 5,
|
|
1687
|
-
// Deprecated
|
|
1688
|
-
entityNode: 6,
|
|
1689
1678
|
// Deprecated
|
|
1690
1679
|
progressingInstruction: 7,
|
|
1691
1680
|
comment: 8,
|
|
1692
|
-
document: 9
|
|
1693
|
-
|
|
1694
|
-
documentFragment: 11,
|
|
1695
|
-
notation: 12
|
|
1696
|
-
// Deprecated
|
|
1697
|
-
}, On = function() {
|
|
1681
|
+
document: 9
|
|
1682
|
+
}, zn = function() {
|
|
1698
1683
|
return typeof window > "u" ? null : window;
|
|
1699
|
-
},
|
|
1684
|
+
}, vn = function(g, _) {
|
|
1700
1685
|
if (typeof g != "object" || typeof g.createPolicy != "function")
|
|
1701
1686
|
return null;
|
|
1702
1687
|
let w = null;
|
|
1703
|
-
const
|
|
1704
|
-
_ && _.hasAttribute(
|
|
1705
|
-
const
|
|
1688
|
+
const v = "data-tt-policy-suffix";
|
|
1689
|
+
_ && _.hasAttribute(v) && (w = _.getAttribute(v));
|
|
1690
|
+
const K = "dompurify" + (w ? "#" + w : "");
|
|
1706
1691
|
try {
|
|
1707
|
-
return g.createPolicy(
|
|
1708
|
-
createHTML(
|
|
1709
|
-
return
|
|
1692
|
+
return g.createPolicy(K, {
|
|
1693
|
+
createHTML(se) {
|
|
1694
|
+
return se;
|
|
1710
1695
|
},
|
|
1711
|
-
createScriptURL(
|
|
1712
|
-
return
|
|
1696
|
+
createScriptURL(se) {
|
|
1697
|
+
return se;
|
|
1713
1698
|
}
|
|
1714
1699
|
});
|
|
1715
1700
|
} catch {
|
|
1716
|
-
return console.warn("TrustedTypes policy " +
|
|
1701
|
+
return console.warn("TrustedTypes policy " + K + " could not be created."), null;
|
|
1717
1702
|
}
|
|
1718
|
-
},
|
|
1703
|
+
}, Ct = function() {
|
|
1719
1704
|
return {
|
|
1720
1705
|
afterSanitizeAttributes: [],
|
|
1721
1706
|
afterSanitizeElements: [],
|
|
@@ -1728,57 +1713,57 @@ function cn() {
|
|
|
1728
1713
|
uponSanitizeShadowNode: []
|
|
1729
1714
|
};
|
|
1730
1715
|
};
|
|
1731
|
-
function
|
|
1732
|
-
let T = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] :
|
|
1733
|
-
const g = (d) =>
|
|
1734
|
-
if (g.version = "3.2.
|
|
1716
|
+
function Ot() {
|
|
1717
|
+
let T = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : zn();
|
|
1718
|
+
const g = (d) => Ot(d);
|
|
1719
|
+
if (g.version = "3.2.5", g.removed = [], !T || !T.document || T.document.nodeType !== ge.document || !T.Element)
|
|
1735
1720
|
return g.isSupported = !1, g;
|
|
1736
1721
|
let {
|
|
1737
1722
|
document: _
|
|
1738
1723
|
} = T;
|
|
1739
|
-
const w = _,
|
|
1740
|
-
DocumentFragment:
|
|
1741
|
-
HTMLTemplateElement:
|
|
1742
|
-
Node:
|
|
1743
|
-
Element:
|
|
1724
|
+
const w = _, v = w.currentScript, {
|
|
1725
|
+
DocumentFragment: K,
|
|
1726
|
+
HTMLTemplateElement: se,
|
|
1727
|
+
Node: Xe,
|
|
1728
|
+
Element: Dt,
|
|
1744
1729
|
NodeFilter: de,
|
|
1745
|
-
NamedNodeMap:
|
|
1746
|
-
HTMLFormElement:
|
|
1747
|
-
DOMParser:
|
|
1748
|
-
trustedTypes:
|
|
1749
|
-
} = T, me =
|
|
1750
|
-
if (typeof
|
|
1730
|
+
NamedNodeMap: Un = T.NamedNodeMap || T.MozNamedAttrMap,
|
|
1731
|
+
HTMLFormElement: Bn,
|
|
1732
|
+
DOMParser: Fn,
|
|
1733
|
+
trustedTypes: Ce
|
|
1734
|
+
} = T, me = Dt.prototype, Hn = fe(me, "cloneNode"), Gn = fe(me, "remove"), qn = fe(me, "nextSibling"), Wn = fe(me, "childNodes"), Oe = fe(me, "parentNode");
|
|
1735
|
+
if (typeof se == "function") {
|
|
1751
1736
|
const d = _.createElement("template");
|
|
1752
1737
|
d.content && d.content.ownerDocument && (_ = d.content.ownerDocument);
|
|
1753
1738
|
}
|
|
1754
1739
|
let U, ke = "";
|
|
1755
1740
|
const {
|
|
1756
|
-
implementation:
|
|
1757
|
-
createNodeIterator:
|
|
1758
|
-
createDocumentFragment:
|
|
1759
|
-
getElementsByTagName:
|
|
1741
|
+
implementation: Qe,
|
|
1742
|
+
createNodeIterator: jn,
|
|
1743
|
+
createDocumentFragment: Zn,
|
|
1744
|
+
getElementsByTagName: Yn
|
|
1760
1745
|
} = _, {
|
|
1761
|
-
importNode:
|
|
1746
|
+
importNode: Xn
|
|
1762
1747
|
} = w;
|
|
1763
|
-
let
|
|
1764
|
-
g.isSupported = typeof h == "function" && typeof
|
|
1748
|
+
let B = Ct();
|
|
1749
|
+
g.isSupported = typeof h == "function" && typeof Oe == "function" && Qe && Qe.createHTMLDocument !== void 0;
|
|
1765
1750
|
const {
|
|
1766
|
-
MUSTACHE_EXPR:
|
|
1767
|
-
ERB_EXPR:
|
|
1768
|
-
TMPLIT_EXPR:
|
|
1769
|
-
DATA_ATTR:
|
|
1770
|
-
ARIA_ATTR:
|
|
1771
|
-
IS_SCRIPT_OR_DATA:
|
|
1772
|
-
ATTR_WHITESPACE:
|
|
1773
|
-
CUSTOM_ELEMENT:
|
|
1774
|
-
} =
|
|
1751
|
+
MUSTACHE_EXPR: Ve,
|
|
1752
|
+
ERB_EXPR: Ke,
|
|
1753
|
+
TMPLIT_EXPR: Je,
|
|
1754
|
+
DATA_ATTR: Qn,
|
|
1755
|
+
ARIA_ATTR: Vn,
|
|
1756
|
+
IS_SCRIPT_OR_DATA: Kn,
|
|
1757
|
+
ATTR_WHITESPACE: Nt,
|
|
1758
|
+
CUSTOM_ELEMENT: Jn
|
|
1759
|
+
} = It;
|
|
1775
1760
|
let {
|
|
1776
|
-
IS_ALLOWED_URI:
|
|
1777
|
-
} =
|
|
1778
|
-
const
|
|
1779
|
-
let
|
|
1780
|
-
const
|
|
1781
|
-
let
|
|
1761
|
+
IS_ALLOWED_URI: Pt
|
|
1762
|
+
} = It, O = null;
|
|
1763
|
+
const Mt = x({}, [...At, ...We, ...je, ...Ze, ...Et]);
|
|
1764
|
+
let P = null;
|
|
1765
|
+
const zt = x({}, [...St, ...Ye, ...yt, ...Ie]);
|
|
1766
|
+
let C = Object.seal(l(null, {
|
|
1782
1767
|
tagNameCheck: {
|
|
1783
1768
|
writable: !0,
|
|
1784
1769
|
configurable: !1,
|
|
@@ -1797,68 +1782,68 @@ function cn() {
|
|
|
1797
1782
|
enumerable: !0,
|
|
1798
1783
|
value: !1
|
|
1799
1784
|
}
|
|
1800
|
-
})), be = null,
|
|
1801
|
-
const
|
|
1802
|
-
let
|
|
1803
|
-
const
|
|
1804
|
-
let
|
|
1805
|
-
const
|
|
1806
|
-
let
|
|
1807
|
-
const
|
|
1808
|
-
let
|
|
1809
|
-
const
|
|
1810
|
-
let
|
|
1811
|
-
const
|
|
1785
|
+
})), be = null, et = null, vt = !0, tt = !0, $t = !1, Ut = !0, oe = !1, nt = !0, ne = !1, it = !1, rt = !1, le = !1, De = !1, Ne = !1, Bt = !0, Ft = !1;
|
|
1786
|
+
const ei = "user-content-";
|
|
1787
|
+
let st = !0, xe = !1, ae = {}, ce = null;
|
|
1788
|
+
const Ht = x({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
|
|
1789
|
+
let Gt = null;
|
|
1790
|
+
const qt = x({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
1791
|
+
let ot = null;
|
|
1792
|
+
const Wt = x({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), Pe = "http://www.w3.org/1998/Math/MathML", Me = "http://www.w3.org/2000/svg", J = "http://www.w3.org/1999/xhtml";
|
|
1793
|
+
let ue = J, lt = !1, at = null;
|
|
1794
|
+
const ti = x({}, [Pe, Me, J], z);
|
|
1795
|
+
let ze = x({}, ["mi", "mo", "mn", "ms", "mtext"]), ve = x({}, ["annotation-xml"]);
|
|
1796
|
+
const ni = x({}, ["title", "style", "font", "a", "script"]);
|
|
1812
1797
|
let Te = null;
|
|
1813
|
-
const
|
|
1814
|
-
let
|
|
1815
|
-
const
|
|
1798
|
+
const ii = ["application/xhtml+xml", "text/html"], ri = "text/html";
|
|
1799
|
+
let D = null, pe = null;
|
|
1800
|
+
const si = _.createElement("form"), jt = function(i) {
|
|
1816
1801
|
return i instanceof RegExp || i instanceof Function;
|
|
1817
|
-
},
|
|
1802
|
+
}, ct = function() {
|
|
1818
1803
|
let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1819
|
-
if (!(
|
|
1820
|
-
if ((!i || typeof i != "object") && (i = {}), i =
|
|
1821
|
-
|
|
1804
|
+
if (!(pe && pe === i)) {
|
|
1805
|
+
if ((!i || typeof i != "object") && (i = {}), i = te(i), Te = // eslint-disable-next-line unicorn/prefer-includes
|
|
1806
|
+
ii.indexOf(i.PARSER_MEDIA_TYPE) === -1 ? ri : i.PARSER_MEDIA_TYPE, D = Te === "application/xhtml+xml" ? z : A, O = G(i, "ALLOWED_TAGS") ? x({}, i.ALLOWED_TAGS, D) : Mt, P = G(i, "ALLOWED_ATTR") ? x({}, i.ALLOWED_ATTR, D) : zt, at = G(i, "ALLOWED_NAMESPACES") ? x({}, i.ALLOWED_NAMESPACES, z) : ti, ot = G(i, "ADD_URI_SAFE_ATTR") ? x(te(Wt), i.ADD_URI_SAFE_ATTR, D) : Wt, Gt = G(i, "ADD_DATA_URI_TAGS") ? x(te(qt), i.ADD_DATA_URI_TAGS, D) : qt, ce = G(i, "FORBID_CONTENTS") ? x({}, i.FORBID_CONTENTS, D) : Ht, be = G(i, "FORBID_TAGS") ? x({}, i.FORBID_TAGS, D) : {}, et = G(i, "FORBID_ATTR") ? x({}, i.FORBID_ATTR, D) : {}, ae = G(i, "USE_PROFILES") ? i.USE_PROFILES : !1, vt = i.ALLOW_ARIA_ATTR !== !1, tt = i.ALLOW_DATA_ATTR !== !1, $t = i.ALLOW_UNKNOWN_PROTOCOLS || !1, Ut = i.ALLOW_SELF_CLOSE_IN_ATTR !== !1, oe = i.SAFE_FOR_TEMPLATES || !1, nt = i.SAFE_FOR_XML !== !1, ne = i.WHOLE_DOCUMENT || !1, le = i.RETURN_DOM || !1, De = i.RETURN_DOM_FRAGMENT || !1, Ne = i.RETURN_TRUSTED_TYPE || !1, rt = i.FORCE_BODY || !1, Bt = i.SANITIZE_DOM !== !1, Ft = i.SANITIZE_NAMED_PROPS || !1, st = i.KEEP_CONTENT !== !1, xe = i.IN_PLACE || !1, Pt = i.ALLOWED_URI_REGEXP || Rt, ue = i.NAMESPACE || J, ze = i.MATHML_TEXT_INTEGRATION_POINTS || ze, ve = i.HTML_INTEGRATION_POINTS || ve, C = i.CUSTOM_ELEMENT_HANDLING || {}, i.CUSTOM_ELEMENT_HANDLING && jt(i.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (C.tagNameCheck = i.CUSTOM_ELEMENT_HANDLING.tagNameCheck), i.CUSTOM_ELEMENT_HANDLING && jt(i.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (C.attributeNameCheck = i.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), i.CUSTOM_ELEMENT_HANDLING && typeof i.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (C.allowCustomizedBuiltInElements = i.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), oe && (tt = !1), De && (le = !0), ae && (O = x({}, Et), P = [], ae.html === !0 && (x(O, At), x(P, St)), ae.svg === !0 && (x(O, We), x(P, Ye), x(P, Ie)), ae.svgFilters === !0 && (x(O, je), x(P, Ye), x(P, Ie)), ae.mathMl === !0 && (x(O, Ze), x(P, yt), x(P, Ie))), i.ADD_TAGS && (O === Mt && (O = te(O)), x(O, i.ADD_TAGS, D)), i.ADD_ATTR && (P === zt && (P = te(P)), x(P, i.ADD_ATTR, D)), i.ADD_URI_SAFE_ATTR && x(ot, i.ADD_URI_SAFE_ATTR, D), i.FORBID_CONTENTS && (ce === Ht && (ce = te(ce)), x(ce, i.FORBID_CONTENTS, D)), st && (O["#text"] = !0), ne && x(O, ["html", "head", "body"]), O.table && (x(O, ["tbody"]), delete be.tbody), i.TRUSTED_TYPES_POLICY) {
|
|
1822
1807
|
if (typeof i.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
1823
|
-
throw
|
|
1808
|
+
throw V('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
1824
1809
|
if (typeof i.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
1825
|
-
throw
|
|
1810
|
+
throw V('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
1826
1811
|
U = i.TRUSTED_TYPES_POLICY, ke = U.createHTML("");
|
|
1827
1812
|
} else
|
|
1828
|
-
U === void 0 && (U =
|
|
1829
|
-
r && r(i),
|
|
1813
|
+
U === void 0 && (U = vn(Ce, v)), U !== null && typeof ke == "string" && (ke = U.createHTML(""));
|
|
1814
|
+
r && r(i), pe = i;
|
|
1830
1815
|
}
|
|
1831
|
-
},
|
|
1832
|
-
let p =
|
|
1816
|
+
}, Zt = x({}, [...We, ...je, ...yn]), Yt = x({}, [...Ze, ...Rn]), oi = function(i) {
|
|
1817
|
+
let p = Oe(i);
|
|
1833
1818
|
(!p || !p.tagName) && (p = {
|
|
1834
|
-
namespaceURI:
|
|
1819
|
+
namespaceURI: ue,
|
|
1835
1820
|
tagName: "template"
|
|
1836
1821
|
});
|
|
1837
|
-
const f =
|
|
1838
|
-
return
|
|
1822
|
+
const f = A(i.tagName), R = A(p.tagName);
|
|
1823
|
+
return at[i.namespaceURI] ? i.namespaceURI === Me ? p.namespaceURI === J ? f === "svg" : p.namespaceURI === Pe ? f === "svg" && (R === "annotation-xml" || ze[R]) : !!Zt[f] : i.namespaceURI === Pe ? p.namespaceURI === J ? f === "math" : p.namespaceURI === Me ? f === "math" && ve[R] : !!Yt[f] : i.namespaceURI === J ? p.namespaceURI === Me && !ve[R] || p.namespaceURI === Pe && !ze[R] ? !1 : !Yt[f] && (ni[f] || !Zt[f]) : !!(Te === "application/xhtml+xml" && at[i.namespaceURI]) : !1;
|
|
1839
1824
|
}, Z = function(i) {
|
|
1840
|
-
|
|
1825
|
+
b(g.removed, {
|
|
1841
1826
|
element: i
|
|
1842
1827
|
});
|
|
1843
1828
|
try {
|
|
1844
|
-
|
|
1829
|
+
Oe(i).removeChild(i);
|
|
1845
1830
|
} catch {
|
|
1846
|
-
|
|
1831
|
+
Gn(i);
|
|
1847
1832
|
}
|
|
1848
|
-
},
|
|
1833
|
+
}, $e = function(i, p) {
|
|
1849
1834
|
try {
|
|
1850
|
-
|
|
1835
|
+
b(g.removed, {
|
|
1851
1836
|
attribute: p.getAttributeNode(i),
|
|
1852
1837
|
from: p
|
|
1853
1838
|
});
|
|
1854
1839
|
} catch {
|
|
1855
|
-
|
|
1840
|
+
b(g.removed, {
|
|
1856
1841
|
attribute: null,
|
|
1857
1842
|
from: p
|
|
1858
1843
|
});
|
|
1859
1844
|
}
|
|
1860
1845
|
if (p.removeAttribute(i), i === "is")
|
|
1861
|
-
if (
|
|
1846
|
+
if (le || De)
|
|
1862
1847
|
try {
|
|
1863
1848
|
Z(p);
|
|
1864
1849
|
} catch {
|
|
@@ -1868,96 +1853,96 @@ function cn() {
|
|
|
1868
1853
|
p.setAttribute(i, "");
|
|
1869
1854
|
} catch {
|
|
1870
1855
|
}
|
|
1871
|
-
},
|
|
1856
|
+
}, Xt = function(i) {
|
|
1872
1857
|
let p = null, f = null;
|
|
1873
|
-
if (
|
|
1858
|
+
if (rt)
|
|
1874
1859
|
i = "<remove></remove>" + i;
|
|
1875
1860
|
else {
|
|
1876
|
-
const
|
|
1877
|
-
f =
|
|
1861
|
+
const M = he(i, /^[\r\n\t ]+/);
|
|
1862
|
+
f = M && M[0];
|
|
1878
1863
|
}
|
|
1879
|
-
Te === "application/xhtml+xml" &&
|
|
1880
|
-
const
|
|
1881
|
-
if (
|
|
1864
|
+
Te === "application/xhtml+xml" && ue === J && (i = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + i + "</body></html>");
|
|
1865
|
+
const R = U ? U.createHTML(i) : i;
|
|
1866
|
+
if (ue === J)
|
|
1882
1867
|
try {
|
|
1883
|
-
p = new
|
|
1868
|
+
p = new Fn().parseFromString(R, Te);
|
|
1884
1869
|
} catch {
|
|
1885
1870
|
}
|
|
1886
1871
|
if (!p || !p.documentElement) {
|
|
1887
|
-
p =
|
|
1872
|
+
p = Qe.createDocument(ue, "template", null);
|
|
1888
1873
|
try {
|
|
1889
|
-
p.documentElement.innerHTML =
|
|
1874
|
+
p.documentElement.innerHTML = lt ? ke : R;
|
|
1890
1875
|
} catch {
|
|
1891
1876
|
}
|
|
1892
1877
|
}
|
|
1893
|
-
const
|
|
1894
|
-
return i && f &&
|
|
1895
|
-
},
|
|
1896
|
-
return
|
|
1878
|
+
const $ = p.body || p.documentElement;
|
|
1879
|
+
return i && f && $.insertBefore(_.createTextNode(f), $.childNodes[0] || null), ue === J ? Yn.call(p, ne ? "html" : "body")[0] : ne ? p.documentElement : $;
|
|
1880
|
+
}, Qt = function(i) {
|
|
1881
|
+
return jn.call(
|
|
1897
1882
|
i.ownerDocument || i,
|
|
1898
1883
|
i,
|
|
1899
1884
|
// eslint-disable-next-line no-bitwise
|
|
1900
1885
|
de.SHOW_ELEMENT | de.SHOW_COMMENT | de.SHOW_TEXT | de.SHOW_PROCESSING_INSTRUCTION | de.SHOW_CDATA_SECTION,
|
|
1901
1886
|
null
|
|
1902
1887
|
);
|
|
1903
|
-
},
|
|
1904
|
-
return i instanceof
|
|
1905
|
-
},
|
|
1906
|
-
return typeof
|
|
1888
|
+
}, ut = function(i) {
|
|
1889
|
+
return i instanceof Bn && (typeof i.nodeName != "string" || typeof i.textContent != "string" || typeof i.removeChild != "function" || !(i.attributes instanceof Un) || typeof i.removeAttribute != "function" || typeof i.setAttribute != "function" || typeof i.namespaceURI != "string" || typeof i.insertBefore != "function" || typeof i.hasChildNodes != "function");
|
|
1890
|
+
}, Vt = function(i) {
|
|
1891
|
+
return typeof Xe == "function" && i instanceof Xe;
|
|
1907
1892
|
};
|
|
1908
|
-
function
|
|
1893
|
+
function ee(d, i, p) {
|
|
1909
1894
|
c(d, (f) => {
|
|
1910
|
-
f.call(g, i, p,
|
|
1895
|
+
f.call(g, i, p, pe);
|
|
1911
1896
|
});
|
|
1912
1897
|
}
|
|
1913
|
-
const
|
|
1898
|
+
const Kt = function(i) {
|
|
1914
1899
|
let p = null;
|
|
1915
|
-
if (
|
|
1900
|
+
if (ee(B.beforeSanitizeElements, i, null), ut(i))
|
|
1916
1901
|
return Z(i), !0;
|
|
1917
|
-
const f =
|
|
1918
|
-
if (
|
|
1902
|
+
const f = D(i.nodeName);
|
|
1903
|
+
if (ee(B.uponSanitizeElement, i, {
|
|
1919
1904
|
tagName: f,
|
|
1920
|
-
allowedTags:
|
|
1921
|
-
}), i.hasChildNodes() && !
|
|
1905
|
+
allowedTags: O
|
|
1906
|
+
}), i.hasChildNodes() && !Vt(i.firstElementChild) && N(/<[/\w!]/g, i.innerHTML) && N(/<[/\w!]/g, i.textContent) || i.nodeType === ge.progressingInstruction || nt && i.nodeType === ge.comment && N(/<[/\w]/g, i.data))
|
|
1922
1907
|
return Z(i), !0;
|
|
1923
|
-
if (!
|
|
1924
|
-
if (!be[f] &&
|
|
1908
|
+
if (!O[f] || be[f]) {
|
|
1909
|
+
if (!be[f] && en(f) && (C.tagNameCheck instanceof RegExp && N(C.tagNameCheck, f) || C.tagNameCheck instanceof Function && C.tagNameCheck(f)))
|
|
1925
1910
|
return !1;
|
|
1926
|
-
if (
|
|
1927
|
-
const
|
|
1928
|
-
if (
|
|
1929
|
-
const
|
|
1930
|
-
for (let
|
|
1931
|
-
const Y =
|
|
1932
|
-
Y.__removalCount = (i.__removalCount || 0) + 1,
|
|
1911
|
+
if (st && !ce[f]) {
|
|
1912
|
+
const R = Oe(i) || i.parentNode, $ = Wn(i) || i.childNodes;
|
|
1913
|
+
if ($ && R) {
|
|
1914
|
+
const M = $.length;
|
|
1915
|
+
for (let q = M - 1; q >= 0; --q) {
|
|
1916
|
+
const Y = Hn($[q], !0);
|
|
1917
|
+
Y.__removalCount = (i.__removalCount || 0) + 1, R.insertBefore(Y, qn(i));
|
|
1933
1918
|
}
|
|
1934
1919
|
}
|
|
1935
1920
|
}
|
|
1936
1921
|
return Z(i), !0;
|
|
1937
1922
|
}
|
|
1938
|
-
return i instanceof
|
|
1939
|
-
p =
|
|
1940
|
-
}), i.textContent !== p && (
|
|
1923
|
+
return i instanceof Dt && !oi(i) || (f === "noscript" || f === "noembed" || f === "noframes") && N(/<\/no(script|embed|frames)/i, i.innerHTML) ? (Z(i), !0) : (oe && i.nodeType === ge.text && (p = i.textContent, c([Ve, Ke, Je], (R) => {
|
|
1924
|
+
p = Q(p, R, " ");
|
|
1925
|
+
}), i.textContent !== p && (b(g.removed, {
|
|
1941
1926
|
element: i.cloneNode()
|
|
1942
|
-
}), i.textContent = p)),
|
|
1943
|
-
},
|
|
1944
|
-
if (
|
|
1927
|
+
}), i.textContent = p)), ee(B.afterSanitizeElements, i, null), !1);
|
|
1928
|
+
}, Jt = function(i, p, f) {
|
|
1929
|
+
if (Bt && (p === "id" || p === "name") && (f in _ || f in si))
|
|
1945
1930
|
return !1;
|
|
1946
|
-
if (!(
|
|
1947
|
-
if (!(
|
|
1948
|
-
if (!
|
|
1931
|
+
if (!(tt && !et[p] && N(Qn, p))) {
|
|
1932
|
+
if (!(vt && N(Vn, p))) {
|
|
1933
|
+
if (!P[p] || et[p]) {
|
|
1949
1934
|
if (
|
|
1950
1935
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
1951
1936
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
1952
1937
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
1953
|
-
!(
|
|
1938
|
+
!(en(i) && (C.tagNameCheck instanceof RegExp && N(C.tagNameCheck, i) || C.tagNameCheck instanceof Function && C.tagNameCheck(i)) && (C.attributeNameCheck instanceof RegExp && N(C.attributeNameCheck, p) || C.attributeNameCheck instanceof Function && C.attributeNameCheck(p)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
1954
1939
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
1955
|
-
p === "is" &&
|
|
1940
|
+
p === "is" && C.allowCustomizedBuiltInElements && (C.tagNameCheck instanceof RegExp && N(C.tagNameCheck, f) || C.tagNameCheck instanceof Function && C.tagNameCheck(f)))
|
|
1956
1941
|
) return !1;
|
|
1957
|
-
} else if (!
|
|
1958
|
-
if (!
|
|
1959
|
-
if (!((p === "src" || p === "xlink:href" || p === "href") && i !== "script" && Re(f, "data:") === 0 &&
|
|
1960
|
-
if (!(
|
|
1942
|
+
} else if (!ot[p]) {
|
|
1943
|
+
if (!N(Pt, Q(f, Nt, ""))) {
|
|
1944
|
+
if (!((p === "src" || p === "xlink:href" || p === "href") && i !== "script" && Re(f, "data:") === 0 && Gt[i])) {
|
|
1945
|
+
if (!($t && !N(Kn, Q(f, Nt, "")))) {
|
|
1961
1946
|
if (f)
|
|
1962
1947
|
return !1;
|
|
1963
1948
|
}
|
|
@@ -1967,144 +1952,148 @@ function cn() {
|
|
|
1967
1952
|
}
|
|
1968
1953
|
}
|
|
1969
1954
|
return !0;
|
|
1970
|
-
},
|
|
1971
|
-
return i !== "annotation-xml" &&
|
|
1972
|
-
},
|
|
1973
|
-
|
|
1955
|
+
}, en = function(i) {
|
|
1956
|
+
return i !== "annotation-xml" && he(i, Jn);
|
|
1957
|
+
}, tn = function(i) {
|
|
1958
|
+
ee(B.beforeSanitizeAttributes, i, null);
|
|
1974
1959
|
const {
|
|
1975
1960
|
attributes: p
|
|
1976
1961
|
} = i;
|
|
1977
|
-
if (!p)
|
|
1962
|
+
if (!p || ut(i))
|
|
1978
1963
|
return;
|
|
1979
1964
|
const f = {
|
|
1980
1965
|
attrName: "",
|
|
1981
1966
|
attrValue: "",
|
|
1982
1967
|
keepAttr: !0,
|
|
1983
|
-
allowedAttributes:
|
|
1968
|
+
allowedAttributes: P,
|
|
1984
1969
|
forceKeepAttr: void 0
|
|
1985
1970
|
};
|
|
1986
|
-
let
|
|
1987
|
-
for (;
|
|
1988
|
-
const
|
|
1989
|
-
name:
|
|
1990
|
-
namespaceURI:
|
|
1971
|
+
let R = p.length;
|
|
1972
|
+
for (; R--; ) {
|
|
1973
|
+
const $ = p[R], {
|
|
1974
|
+
name: M,
|
|
1975
|
+
namespaceURI: q,
|
|
1991
1976
|
value: Y
|
|
1992
|
-
} =
|
|
1993
|
-
let
|
|
1994
|
-
if (f.attrName = we, f.attrValue =
|
|
1995
|
-
|
|
1977
|
+
} = $, we = D(M);
|
|
1978
|
+
let F = M === "value" ? Y : Le(Y);
|
|
1979
|
+
if (f.attrName = we, f.attrValue = F, f.keepAttr = !0, f.forceKeepAttr = void 0, ee(B.uponSanitizeAttribute, i, f), F = f.attrValue, Ft && (we === "id" || we === "name") && ($e(M, i), F = ei + F), nt && N(/((--!?|])>)|<\/(style|title)/i, F)) {
|
|
1980
|
+
$e(M, i);
|
|
1996
1981
|
continue;
|
|
1997
1982
|
}
|
|
1998
|
-
if (f.forceKeepAttr || (
|
|
1983
|
+
if (f.forceKeepAttr || ($e(M, i), !f.keepAttr))
|
|
1999
1984
|
continue;
|
|
2000
|
-
if (!
|
|
2001
|
-
|
|
1985
|
+
if (!Ut && N(/\/>/i, F)) {
|
|
1986
|
+
$e(M, i);
|
|
2002
1987
|
continue;
|
|
2003
1988
|
}
|
|
2004
|
-
|
|
2005
|
-
|
|
1989
|
+
oe && c([Ve, Ke, Je], (rn) => {
|
|
1990
|
+
F = Q(F, rn, " ");
|
|
2006
1991
|
});
|
|
2007
|
-
const
|
|
2008
|
-
if (
|
|
2009
|
-
if (U && typeof
|
|
2010
|
-
switch (
|
|
1992
|
+
const nn = D(i.nodeName);
|
|
1993
|
+
if (Jt(nn, we, F)) {
|
|
1994
|
+
if (U && typeof Ce == "object" && typeof Ce.getAttributeType == "function" && !q)
|
|
1995
|
+
switch (Ce.getAttributeType(nn, we)) {
|
|
2011
1996
|
case "TrustedHTML": {
|
|
2012
|
-
|
|
1997
|
+
F = U.createHTML(F);
|
|
2013
1998
|
break;
|
|
2014
1999
|
}
|
|
2015
2000
|
case "TrustedScriptURL": {
|
|
2016
|
-
|
|
2001
|
+
F = U.createScriptURL(F);
|
|
2017
2002
|
break;
|
|
2018
2003
|
}
|
|
2019
2004
|
}
|
|
2020
2005
|
try {
|
|
2021
|
-
|
|
2006
|
+
q ? i.setAttributeNS(q, M, F) : i.setAttribute(M, F), ut(i) ? Z(i) : m(g.removed);
|
|
2022
2007
|
} catch {
|
|
2023
2008
|
}
|
|
2024
2009
|
}
|
|
2025
2010
|
}
|
|
2026
|
-
|
|
2027
|
-
},
|
|
2011
|
+
ee(B.afterSanitizeAttributes, i, null);
|
|
2012
|
+
}, li = function d(i) {
|
|
2028
2013
|
let p = null;
|
|
2029
|
-
const f =
|
|
2030
|
-
for (
|
|
2031
|
-
|
|
2032
|
-
|
|
2014
|
+
const f = Qt(i);
|
|
2015
|
+
for (ee(B.beforeSanitizeShadowDOM, i, null); p = f.nextNode(); )
|
|
2016
|
+
ee(B.uponSanitizeShadowNode, p, null), Kt(p), tn(p), p.content instanceof K && d(p.content);
|
|
2017
|
+
ee(B.afterSanitizeShadowDOM, i, null);
|
|
2033
2018
|
};
|
|
2034
2019
|
return g.sanitize = function(d) {
|
|
2035
|
-
let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, p = null, f = null,
|
|
2036
|
-
if (
|
|
2020
|
+
let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, p = null, f = null, R = null, $ = null;
|
|
2021
|
+
if (lt = !d, lt && (d = "<!-->"), typeof d != "string" && !Vt(d))
|
|
2037
2022
|
if (typeof d.toString == "function") {
|
|
2038
2023
|
if (d = d.toString(), typeof d != "string")
|
|
2039
|
-
throw
|
|
2024
|
+
throw V("dirty is not a string, aborting");
|
|
2040
2025
|
} else
|
|
2041
|
-
throw
|
|
2026
|
+
throw V("toString is not a function");
|
|
2042
2027
|
if (!g.isSupported)
|
|
2043
2028
|
return d;
|
|
2044
|
-
if (
|
|
2029
|
+
if (it || ct(i), g.removed = [], typeof d == "string" && (xe = !1), xe) {
|
|
2045
2030
|
if (d.nodeName) {
|
|
2046
|
-
const Y =
|
|
2047
|
-
if (!
|
|
2048
|
-
throw
|
|
2031
|
+
const Y = D(d.nodeName);
|
|
2032
|
+
if (!O[Y] || be[Y])
|
|
2033
|
+
throw V("root node is forbidden and cannot be sanitized in-place");
|
|
2049
2034
|
}
|
|
2050
|
-
} else if (d instanceof
|
|
2051
|
-
p =
|
|
2035
|
+
} else if (d instanceof Xe)
|
|
2036
|
+
p = Xt("<!---->"), f = p.ownerDocument.importNode(d, !0), f.nodeType === ge.element && f.nodeName === "BODY" || f.nodeName === "HTML" ? p = f : p.appendChild(f);
|
|
2052
2037
|
else {
|
|
2053
|
-
if (!
|
|
2038
|
+
if (!le && !oe && !ne && // eslint-disable-next-line unicorn/prefer-includes
|
|
2054
2039
|
d.indexOf("<") === -1)
|
|
2055
|
-
return U &&
|
|
2056
|
-
if (p =
|
|
2057
|
-
return
|
|
2040
|
+
return U && Ne ? U.createHTML(d) : d;
|
|
2041
|
+
if (p = Xt(d), !p)
|
|
2042
|
+
return le ? null : Ne ? ke : "";
|
|
2058
2043
|
}
|
|
2059
|
-
p &&
|
|
2060
|
-
const
|
|
2061
|
-
for (;
|
|
2062
|
-
|
|
2044
|
+
p && rt && Z(p.firstChild);
|
|
2045
|
+
const M = Qt(xe ? d : p);
|
|
2046
|
+
for (; R = M.nextNode(); )
|
|
2047
|
+
Kt(R), tn(R), R.content instanceof K && li(R.content);
|
|
2063
2048
|
if (xe)
|
|
2064
2049
|
return d;
|
|
2065
|
-
if (
|
|
2066
|
-
if (
|
|
2067
|
-
for (
|
|
2068
|
-
|
|
2050
|
+
if (le) {
|
|
2051
|
+
if (De)
|
|
2052
|
+
for ($ = Zn.call(p.ownerDocument); p.firstChild; )
|
|
2053
|
+
$.appendChild(p.firstChild);
|
|
2069
2054
|
else
|
|
2070
|
-
|
|
2071
|
-
return (
|
|
2055
|
+
$ = p;
|
|
2056
|
+
return (P.shadowroot || P.shadowrootmode) && ($ = Xn.call(w, $, !0)), $;
|
|
2072
2057
|
}
|
|
2073
|
-
let
|
|
2074
|
-
return
|
|
2075
|
-
` +
|
|
2076
|
-
|
|
2077
|
-
}), U &&
|
|
2058
|
+
let q = ne ? p.outerHTML : p.innerHTML;
|
|
2059
|
+
return ne && O["!doctype"] && p.ownerDocument && p.ownerDocument.doctype && p.ownerDocument.doctype.name && N(Lt, p.ownerDocument.doctype.name) && (q = "<!DOCTYPE " + p.ownerDocument.doctype.name + `>
|
|
2060
|
+
` + q), oe && c([Ve, Ke, Je], (Y) => {
|
|
2061
|
+
q = Q(q, Y, " ");
|
|
2062
|
+
}), U && Ne ? U.createHTML(q) : q;
|
|
2078
2063
|
}, g.setConfig = function() {
|
|
2079
2064
|
let d = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2080
|
-
|
|
2065
|
+
ct(d), it = !0;
|
|
2081
2066
|
}, g.clearConfig = function() {
|
|
2082
|
-
|
|
2067
|
+
pe = null, it = !1;
|
|
2083
2068
|
}, g.isValidAttribute = function(d, i, p) {
|
|
2084
|
-
|
|
2085
|
-
const f =
|
|
2086
|
-
return
|
|
2069
|
+
pe || ct({});
|
|
2070
|
+
const f = D(d), R = D(i);
|
|
2071
|
+
return Jt(f, R, p);
|
|
2087
2072
|
}, g.addHook = function(d, i) {
|
|
2088
|
-
typeof i == "function" &&
|
|
2089
|
-
}, g.removeHook = function(d) {
|
|
2090
|
-
|
|
2073
|
+
typeof i == "function" && b(B[d], i);
|
|
2074
|
+
}, g.removeHook = function(d, i) {
|
|
2075
|
+
if (i !== void 0) {
|
|
2076
|
+
const p = k(B[d], i);
|
|
2077
|
+
return p === -1 ? void 0 : L(B[d], p, 1)[0];
|
|
2078
|
+
}
|
|
2079
|
+
return m(B[d]);
|
|
2091
2080
|
}, g.removeHooks = function(d) {
|
|
2092
|
-
|
|
2081
|
+
B[d] = [];
|
|
2093
2082
|
}, g.removeAllHooks = function() {
|
|
2094
|
-
|
|
2083
|
+
B = Ct();
|
|
2095
2084
|
}, g;
|
|
2096
2085
|
}
|
|
2097
|
-
var
|
|
2098
|
-
return
|
|
2086
|
+
var $n = Ot();
|
|
2087
|
+
return pt = $n, pt;
|
|
2099
2088
|
}
|
|
2100
|
-
var
|
|
2101
|
-
function
|
|
2102
|
-
return
|
|
2089
|
+
var ht, hn;
|
|
2090
|
+
function Zi() {
|
|
2091
|
+
return hn || (hn = 1, ht = window.DOMPurify || (window.DOMPurify = pn().default || pn())), ht;
|
|
2103
2092
|
}
|
|
2104
|
-
var
|
|
2105
|
-
const
|
|
2093
|
+
var Yi = Zi();
|
|
2094
|
+
const Vi = /* @__PURE__ */ ui(Yi);
|
|
2106
2095
|
export {
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2096
|
+
Vi as D,
|
|
2097
|
+
Qi as c,
|
|
2098
|
+
S as m
|
|
2110
2099
|
};
|