@clevertask/scribe 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-BJWkU9cc.js +2106 -0
- package/dist/clsx-OuTLNxxd.js +16 -0
- package/dist/components/Menu/BarMenu.js +119 -4
- package/dist/components/Menu/BubbleMenu.js +1 -1
- package/dist/components/Scribe/extension/emoji/EmojiList.d.ts +1 -0
- package/dist/components/Scribe/extension/emoji/EmojiList.js +35 -0
- package/dist/components/Scribe/extension/emoji/suggest.d.ts +16 -0
- package/dist/components/Scribe/extension/emoji/suggest.js +40 -0
- package/dist/components/Scribe/extension/extension-link.js +208 -200
- package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
- package/dist/components/Scribe/extension/index.js +30 -24
- package/dist/components/Scribe/extension/math-extension.js +1 -1
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +7 -5
- package/dist/components/Scribe/extension/slashCommand/index.js +4 -153
- package/dist/components/Scribe/extension/slashCommand/renderItems.d.ts +1 -1
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +14 -14
- package/dist/components/Scribe/index.js +18 -17
- package/dist/index-BqFHWqw6.js +156 -0
- package/dist/{index-C3_lI_rP.js → index-C_aWB8qt.js} +449 -427
- package/dist/index-CasgquAq.js +39381 -0
- package/dist/{index-Gm-3o3nq.js → index-DeZ8laak.js} +1124 -1083
- package/dist/main.css +60 -2
- package/dist/{turndown.browser.es-BSoGafvq.js → turndown.browser.es-C1wFFc_i.js} +342 -334
- package/dist/utils/create-scribe-editor.js +2 -2
- package/dist/utils/html-to-markdown.js +1 -1
- package/dist/utils/markdown-to-html.js +1 -1
- package/package.json +33 -31
- package/dist/BarMenu-SiPgB2ow.js +0 -134
- package/dist/browser-DEobZXxB.js +0 -2099
- package/dist/index-NRgJVTH-.js +0 -7576
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
/*! @license DOMPurify 3.2.
|
|
1
|
+
/*! @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 */
|
|
2
2
|
const {
|
|
3
|
-
entries:
|
|
4
|
-
setPrototypeOf:
|
|
5
|
-
isFrozen:
|
|
6
|
-
getPrototypeOf:
|
|
7
|
-
getOwnPropertyDescriptor:
|
|
3
|
+
entries: Dt,
|
|
4
|
+
setPrototypeOf: Et,
|
|
5
|
+
isFrozen: cn,
|
|
6
|
+
getPrototypeOf: fn,
|
|
7
|
+
getOwnPropertyDescriptor: un
|
|
8
8
|
} = Object;
|
|
9
9
|
let {
|
|
10
10
|
freeze: v,
|
|
11
11
|
seal: C,
|
|
12
|
-
create:
|
|
12
|
+
create: Ct
|
|
13
13
|
} = Object, {
|
|
14
|
-
apply:
|
|
15
|
-
construct:
|
|
14
|
+
apply: Be,
|
|
15
|
+
construct: ze
|
|
16
16
|
} = typeof Reflect < "u" && Reflect;
|
|
17
17
|
v || (v = function(t) {
|
|
18
18
|
return t;
|
|
@@ -20,99 +20,99 @@ v || (v = function(t) {
|
|
|
20
20
|
C || (C = function(t) {
|
|
21
21
|
return t;
|
|
22
22
|
});
|
|
23
|
-
|
|
23
|
+
Be || (Be = function(t, r, i) {
|
|
24
24
|
return t.apply(r, i);
|
|
25
25
|
});
|
|
26
|
-
|
|
26
|
+
ze || (ze = function(t, r) {
|
|
27
27
|
return new t(...r);
|
|
28
28
|
});
|
|
29
|
-
const
|
|
29
|
+
const me = b(Array.prototype.forEach), mn = b(Array.prototype.lastIndexOf), At = b(Array.prototype.pop), Q = b(Array.prototype.push), pn = b(Array.prototype.splice), de = b(String.prototype.toLowerCase), Me = b(String.prototype.toString), _t = b(String.prototype.match), J = b(String.prototype.replace), dn = b(String.prototype.indexOf), hn = b(String.prototype.trim), I = b(Object.prototype.hasOwnProperty), O = b(RegExp.prototype.test), ee = gn(TypeError);
|
|
30
30
|
function b(e) {
|
|
31
31
|
return function(t) {
|
|
32
32
|
t instanceof RegExp && (t.lastIndex = 0);
|
|
33
33
|
for (var r = arguments.length, i = new Array(r > 1 ? r - 1 : 0), s = 1; s < r; s++)
|
|
34
34
|
i[s - 1] = arguments[s];
|
|
35
|
-
return
|
|
35
|
+
return Be(e, t, i);
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function gn(e) {
|
|
39
39
|
return function() {
|
|
40
40
|
for (var t = arguments.length, r = new Array(t), i = 0; i < t; i++)
|
|
41
41
|
r[i] = arguments[i];
|
|
42
|
-
return
|
|
42
|
+
return ze(e, r);
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
45
|
function f(e, t) {
|
|
46
|
-
let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] :
|
|
47
|
-
|
|
46
|
+
let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : de;
|
|
47
|
+
Et && Et(e, null);
|
|
48
48
|
let i = t.length;
|
|
49
49
|
for (; i--; ) {
|
|
50
50
|
let s = t[i];
|
|
51
51
|
if (typeof s == "string") {
|
|
52
52
|
const c = r(s);
|
|
53
|
-
c !== s && (
|
|
53
|
+
c !== s && (cn(t) || (t[i] = c), s = c);
|
|
54
54
|
}
|
|
55
55
|
e[s] = !0;
|
|
56
56
|
}
|
|
57
57
|
return e;
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function Tn(e) {
|
|
60
60
|
for (let t = 0; t < e.length; t++)
|
|
61
61
|
I(e, t) || (e[t] = null);
|
|
62
62
|
return e;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
const t =
|
|
66
|
-
for (const [r, i] of
|
|
67
|
-
I(e, r) && (Array.isArray(i) ? t[r] =
|
|
64
|
+
function P(e) {
|
|
65
|
+
const t = Ct(null);
|
|
66
|
+
for (const [r, i] of Dt(e))
|
|
67
|
+
I(e, r) && (Array.isArray(i) ? t[r] = Tn(i) : i && typeof i == "object" && i.constructor === Object ? t[r] = P(i) : t[r] = i);
|
|
68
68
|
return t;
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function te(e, t) {
|
|
71
71
|
for (; e !== null; ) {
|
|
72
|
-
const i =
|
|
72
|
+
const i = un(e, t);
|
|
73
73
|
if (i) {
|
|
74
74
|
if (i.get)
|
|
75
75
|
return b(i.get);
|
|
76
76
|
if (typeof i.value == "function")
|
|
77
77
|
return b(i.value);
|
|
78
78
|
}
|
|
79
|
-
e =
|
|
79
|
+
e = fn(e);
|
|
80
80
|
}
|
|
81
81
|
function r() {
|
|
82
82
|
return null;
|
|
83
83
|
}
|
|
84
84
|
return r;
|
|
85
85
|
}
|
|
86
|
-
const
|
|
87
|
-
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
86
|
+
const St = v(["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 = v(["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"]), ke = v(["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"]), En = v(["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"]), xe = v(["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"]), An = v(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Rt = v(["#text"]), yt = v(["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"]), Pe = v(["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"]), Nt = v(["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"]), pe = v(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), _n = C(/\{\{[\w\W]*|[\w\W]*\}\}/gm), Sn = C(/<%[\w\W]*|[\w\W]*%>/gm), Rn = C(/\$\{[\w\W]*/gm), yn = C(/^data-[\-\w.\u00B7-\uFFFF]+$/), Nn = C(/^aria-[\-\w]+$/), It = C(
|
|
87
|
+
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
88
88
|
// eslint-disable-line no-useless-escape
|
|
89
|
-
),
|
|
89
|
+
), On = C(/^(?:\w+script|data):/i), vn = C(
|
|
90
90
|
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
91
91
|
// eslint-disable-line no-control-regex
|
|
92
|
-
),
|
|
93
|
-
var
|
|
92
|
+
), Mt = C(/^html$/i), bn = C(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
93
|
+
var Ot = /* @__PURE__ */ Object.freeze({
|
|
94
94
|
__proto__: null,
|
|
95
|
-
ARIA_ATTR:
|
|
96
|
-
ATTR_WHITESPACE:
|
|
97
|
-
CUSTOM_ELEMENT:
|
|
98
|
-
DATA_ATTR:
|
|
99
|
-
DOCTYPE_NAME:
|
|
100
|
-
ERB_EXPR:
|
|
101
|
-
IS_ALLOWED_URI:
|
|
102
|
-
IS_SCRIPT_OR_DATA:
|
|
103
|
-
MUSTACHE_EXPR:
|
|
104
|
-
TMPLIT_EXPR:
|
|
95
|
+
ARIA_ATTR: Nn,
|
|
96
|
+
ATTR_WHITESPACE: vn,
|
|
97
|
+
CUSTOM_ELEMENT: bn,
|
|
98
|
+
DATA_ATTR: yn,
|
|
99
|
+
DOCTYPE_NAME: Mt,
|
|
100
|
+
ERB_EXPR: Sn,
|
|
101
|
+
IS_ALLOWED_URI: It,
|
|
102
|
+
IS_SCRIPT_OR_DATA: On,
|
|
103
|
+
MUSTACHE_EXPR: _n,
|
|
104
|
+
TMPLIT_EXPR: Rn
|
|
105
105
|
});
|
|
106
|
-
const
|
|
106
|
+
const ne = {
|
|
107
107
|
element: 1,
|
|
108
108
|
text: 3,
|
|
109
109
|
// Deprecated
|
|
110
110
|
progressingInstruction: 7,
|
|
111
111
|
comment: 8,
|
|
112
112
|
document: 9
|
|
113
|
-
},
|
|
113
|
+
}, Ln = function() {
|
|
114
114
|
return typeof window > "u" ? null : window;
|
|
115
|
-
},
|
|
115
|
+
}, Dn = function(t, r) {
|
|
116
116
|
if (typeof t != "object" || typeof t.createPolicy != "function")
|
|
117
117
|
return null;
|
|
118
118
|
let i = null;
|
|
@@ -131,7 +131,7 @@ const te = {
|
|
|
131
131
|
} catch {
|
|
132
132
|
return console.warn("TrustedTypes policy " + c + " could not be created."), null;
|
|
133
133
|
}
|
|
134
|
-
},
|
|
134
|
+
}, vt = function() {
|
|
135
135
|
return {
|
|
136
136
|
afterSanitizeAttributes: [],
|
|
137
137
|
afterSanitizeElements: [],
|
|
@@ -144,10 +144,10 @@ const te = {
|
|
|
144
144
|
uponSanitizeShadowNode: []
|
|
145
145
|
};
|
|
146
146
|
};
|
|
147
|
-
function
|
|
148
|
-
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] :
|
|
149
|
-
const t = (l) =>
|
|
150
|
-
if (t.version = "3.2.
|
|
147
|
+
function wt() {
|
|
148
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Ln();
|
|
149
|
+
const t = (l) => wt(l);
|
|
150
|
+
if (t.version = "3.2.6", t.removed = [], !e || !e.document || e.document.nodeType !== ne.document || !e.Element)
|
|
151
151
|
return t.isSupported = !1, t;
|
|
152
152
|
let {
|
|
153
153
|
document: r
|
|
@@ -157,44 +157,44 @@ function Mt() {
|
|
|
157
157
|
HTMLTemplateElement: p,
|
|
158
158
|
Node: L,
|
|
159
159
|
Element: m,
|
|
160
|
-
NodeFilter:
|
|
160
|
+
NodeFilter: R,
|
|
161
161
|
NamedNodeMap: F = e.NamedNodeMap || e.MozNamedAttrMap,
|
|
162
|
-
HTMLFormElement:
|
|
163
|
-
DOMParser:
|
|
164
|
-
trustedTypes:
|
|
165
|
-
} = e,
|
|
162
|
+
HTMLFormElement: ge,
|
|
163
|
+
DOMParser: zt,
|
|
164
|
+
trustedTypes: re
|
|
165
|
+
} = e, V = m.prototype, Wt = te(V, "cloneNode"), Gt = te(V, "remove"), Yt = te(V, "nextSibling"), $t = te(V, "childNodes"), ie = te(V, "parentNode");
|
|
166
166
|
if (typeof p == "function") {
|
|
167
167
|
const l = r.createElement("template");
|
|
168
168
|
l.content && l.content.ownerDocument && (r = l.content.ownerDocument);
|
|
169
169
|
}
|
|
170
|
-
let
|
|
170
|
+
let y, X = "";
|
|
171
171
|
const {
|
|
172
|
-
implementation:
|
|
173
|
-
createNodeIterator:
|
|
174
|
-
createDocumentFragment:
|
|
175
|
-
getElementsByTagName:
|
|
172
|
+
implementation: Te,
|
|
173
|
+
createNodeIterator: Vt,
|
|
174
|
+
createDocumentFragment: Xt,
|
|
175
|
+
getElementsByTagName: jt
|
|
176
176
|
} = r, {
|
|
177
|
-
importNode:
|
|
177
|
+
importNode: Kt
|
|
178
178
|
} = i;
|
|
179
|
-
let
|
|
180
|
-
t.isSupported = typeof
|
|
179
|
+
let N = vt();
|
|
180
|
+
t.isSupported = typeof Dt == "function" && typeof ie == "function" && Te && Te.createHTMLDocument !== void 0;
|
|
181
181
|
const {
|
|
182
|
-
MUSTACHE_EXPR:
|
|
183
|
-
ERB_EXPR:
|
|
184
|
-
TMPLIT_EXPR:
|
|
185
|
-
DATA_ATTR:
|
|
186
|
-
ARIA_ATTR:
|
|
187
|
-
IS_SCRIPT_OR_DATA:
|
|
188
|
-
ATTR_WHITESPACE:
|
|
189
|
-
CUSTOM_ELEMENT:
|
|
190
|
-
} =
|
|
182
|
+
MUSTACHE_EXPR: Ee,
|
|
183
|
+
ERB_EXPR: Ae,
|
|
184
|
+
TMPLIT_EXPR: _e,
|
|
185
|
+
DATA_ATTR: qt,
|
|
186
|
+
ARIA_ATTR: Zt,
|
|
187
|
+
IS_SCRIPT_OR_DATA: Qt,
|
|
188
|
+
ATTR_WHITESPACE: Xe,
|
|
189
|
+
CUSTOM_ELEMENT: Jt
|
|
190
|
+
} = Ot;
|
|
191
191
|
let {
|
|
192
|
-
IS_ALLOWED_URI:
|
|
193
|
-
} =
|
|
194
|
-
const
|
|
195
|
-
let
|
|
196
|
-
const
|
|
197
|
-
let d = Object.seal(
|
|
192
|
+
IS_ALLOWED_URI: je
|
|
193
|
+
} = Ot, g = null;
|
|
194
|
+
const Ke = f({}, [...St, ...we, ...ke, ...xe, ...Rt]);
|
|
195
|
+
let E = null;
|
|
196
|
+
const qe = f({}, [...yt, ...Pe, ...Nt, ...pe]);
|
|
197
|
+
let d = Object.seal(Ct(null, {
|
|
198
198
|
tagNameCheck: {
|
|
199
199
|
writable: !0,
|
|
200
200
|
configurable: !1,
|
|
@@ -213,68 +213,68 @@ function Mt() {
|
|
|
213
213
|
enumerable: !0,
|
|
214
214
|
value: !1
|
|
215
215
|
}
|
|
216
|
-
})),
|
|
217
|
-
const
|
|
218
|
-
let Oe = !0,
|
|
219
|
-
const
|
|
220
|
-
let
|
|
221
|
-
const
|
|
216
|
+
})), j = null, Se = null, Ze = !0, Re = !0, Qe = !1, Je = !0, H = !1, ae = !0, U = !1, ye = !1, Ne = !1, B = !1, oe = !1, le = !1, et = !0, tt = !1;
|
|
217
|
+
const en = "user-content-";
|
|
218
|
+
let Oe = !0, K = !1, z = {}, W = null;
|
|
219
|
+
const nt = f({}, ["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"]);
|
|
220
|
+
let rt = null;
|
|
221
|
+
const it = f({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
222
222
|
let ve = null;
|
|
223
|
-
const
|
|
224
|
-
let G =
|
|
225
|
-
const
|
|
226
|
-
let
|
|
227
|
-
const
|
|
228
|
-
let
|
|
229
|
-
const
|
|
230
|
-
let
|
|
231
|
-
const
|
|
223
|
+
const at = f({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), se = "http://www.w3.org/1998/Math/MathML", ce = "http://www.w3.org/2000/svg", w = "http://www.w3.org/1999/xhtml";
|
|
224
|
+
let G = w, be = !1, Le = null;
|
|
225
|
+
const tn = f({}, [se, ce, w], Me);
|
|
226
|
+
let fe = f({}, ["mi", "mo", "mn", "ms", "mtext"]), ue = f({}, ["annotation-xml"]);
|
|
227
|
+
const nn = f({}, ["title", "style", "font", "a", "script"]);
|
|
228
|
+
let q = null;
|
|
229
|
+
const rn = ["application/xhtml+xml", "text/html"], an = "text/html";
|
|
230
|
+
let T = null, Y = null;
|
|
231
|
+
const on = r.createElement("form"), ot = function(n) {
|
|
232
232
|
return n instanceof RegExp || n instanceof Function;
|
|
233
233
|
}, De = function() {
|
|
234
234
|
let n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
235
235
|
if (!(Y && Y === n)) {
|
|
236
|
-
if ((!n || typeof n != "object") && (n = {}), n =
|
|
237
|
-
|
|
236
|
+
if ((!n || typeof n != "object") && (n = {}), n = P(n), q = // eslint-disable-next-line unicorn/prefer-includes
|
|
237
|
+
rn.indexOf(n.PARSER_MEDIA_TYPE) === -1 ? an : n.PARSER_MEDIA_TYPE, T = q === "application/xhtml+xml" ? Me : de, g = I(n, "ALLOWED_TAGS") ? f({}, n.ALLOWED_TAGS, T) : Ke, E = I(n, "ALLOWED_ATTR") ? f({}, n.ALLOWED_ATTR, T) : qe, Le = I(n, "ALLOWED_NAMESPACES") ? f({}, n.ALLOWED_NAMESPACES, Me) : tn, ve = I(n, "ADD_URI_SAFE_ATTR") ? f(P(at), n.ADD_URI_SAFE_ATTR, T) : at, rt = I(n, "ADD_DATA_URI_TAGS") ? f(P(it), n.ADD_DATA_URI_TAGS, T) : it, W = I(n, "FORBID_CONTENTS") ? f({}, n.FORBID_CONTENTS, T) : nt, j = I(n, "FORBID_TAGS") ? f({}, n.FORBID_TAGS, T) : P({}), Se = I(n, "FORBID_ATTR") ? f({}, n.FORBID_ATTR, T) : P({}), z = I(n, "USE_PROFILES") ? n.USE_PROFILES : !1, Ze = n.ALLOW_ARIA_ATTR !== !1, Re = n.ALLOW_DATA_ATTR !== !1, Qe = n.ALLOW_UNKNOWN_PROTOCOLS || !1, Je = n.ALLOW_SELF_CLOSE_IN_ATTR !== !1, H = n.SAFE_FOR_TEMPLATES || !1, ae = n.SAFE_FOR_XML !== !1, U = n.WHOLE_DOCUMENT || !1, B = n.RETURN_DOM || !1, oe = n.RETURN_DOM_FRAGMENT || !1, le = n.RETURN_TRUSTED_TYPE || !1, Ne = n.FORCE_BODY || !1, et = n.SANITIZE_DOM !== !1, tt = n.SANITIZE_NAMED_PROPS || !1, Oe = n.KEEP_CONTENT !== !1, K = n.IN_PLACE || !1, je = n.ALLOWED_URI_REGEXP || It, G = n.NAMESPACE || w, fe = n.MATHML_TEXT_INTEGRATION_POINTS || fe, ue = n.HTML_INTEGRATION_POINTS || ue, d = n.CUSTOM_ELEMENT_HANDLING || {}, n.CUSTOM_ELEMENT_HANDLING && ot(n.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (d.tagNameCheck = n.CUSTOM_ELEMENT_HANDLING.tagNameCheck), n.CUSTOM_ELEMENT_HANDLING && ot(n.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (d.attributeNameCheck = n.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), n.CUSTOM_ELEMENT_HANDLING && typeof n.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (d.allowCustomizedBuiltInElements = n.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), H && (Re = !1), oe && (B = !0), z && (g = f({}, Rt), E = [], z.html === !0 && (f(g, St), f(E, yt)), z.svg === !0 && (f(g, we), f(E, Pe), f(E, pe)), z.svgFilters === !0 && (f(g, ke), f(E, Pe), f(E, pe)), z.mathMl === !0 && (f(g, xe), f(E, Nt), f(E, pe))), n.ADD_TAGS && (g === Ke && (g = P(g)), f(g, n.ADD_TAGS, T)), n.ADD_ATTR && (E === qe && (E = P(E)), f(E, n.ADD_ATTR, T)), n.ADD_URI_SAFE_ATTR && f(ve, n.ADD_URI_SAFE_ATTR, T), n.FORBID_CONTENTS && (W === nt && (W = P(W)), f(W, n.FORBID_CONTENTS, T)), Oe && (g["#text"] = !0), U && f(g, ["html", "head", "body"]), g.table && (f(g, ["tbody"]), delete j.tbody), n.TRUSTED_TYPES_POLICY) {
|
|
238
238
|
if (typeof n.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
239
|
-
throw
|
|
239
|
+
throw ee('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
240
240
|
if (typeof n.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
241
|
-
throw
|
|
242
|
-
|
|
241
|
+
throw ee('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
242
|
+
y = n.TRUSTED_TYPES_POLICY, X = y.createHTML("");
|
|
243
243
|
} else
|
|
244
|
-
|
|
244
|
+
y === void 0 && (y = Dn(re, s)), y !== null && typeof X == "string" && (X = y.createHTML(""));
|
|
245
245
|
v && v(n), Y = n;
|
|
246
246
|
}
|
|
247
|
-
},
|
|
248
|
-
let a =
|
|
247
|
+
}, lt = f({}, [...we, ...ke, ...En]), st = f({}, [...xe, ...An]), ln = function(n) {
|
|
248
|
+
let a = ie(n);
|
|
249
249
|
(!a || !a.tagName) && (a = {
|
|
250
250
|
namespaceURI: G,
|
|
251
251
|
tagName: "template"
|
|
252
252
|
});
|
|
253
|
-
const o =
|
|
254
|
-
return Le[n.namespaceURI] ? n.namespaceURI ===
|
|
253
|
+
const o = de(n.tagName), u = de(a.tagName);
|
|
254
|
+
return Le[n.namespaceURI] ? n.namespaceURI === ce ? a.namespaceURI === w ? o === "svg" : a.namespaceURI === se ? o === "svg" && (u === "annotation-xml" || fe[u]) : !!lt[o] : n.namespaceURI === se ? a.namespaceURI === w ? o === "math" : a.namespaceURI === ce ? o === "math" && ue[u] : !!st[o] : n.namespaceURI === w ? a.namespaceURI === ce && !ue[u] || a.namespaceURI === se && !fe[u] ? !1 : !st[o] && (nn[o] || !lt[o]) : !!(q === "application/xhtml+xml" && Le[n.namespaceURI]) : !1;
|
|
255
255
|
}, M = function(n) {
|
|
256
|
-
|
|
256
|
+
Q(t.removed, {
|
|
257
257
|
element: n
|
|
258
258
|
});
|
|
259
259
|
try {
|
|
260
|
-
|
|
260
|
+
ie(n).removeChild(n);
|
|
261
261
|
} catch {
|
|
262
|
-
|
|
262
|
+
Gt(n);
|
|
263
263
|
}
|
|
264
|
-
},
|
|
264
|
+
}, $ = function(n, a) {
|
|
265
265
|
try {
|
|
266
|
-
|
|
266
|
+
Q(t.removed, {
|
|
267
267
|
attribute: a.getAttributeNode(n),
|
|
268
268
|
from: a
|
|
269
269
|
});
|
|
270
270
|
} catch {
|
|
271
|
-
|
|
271
|
+
Q(t.removed, {
|
|
272
272
|
attribute: null,
|
|
273
273
|
from: a
|
|
274
274
|
});
|
|
275
275
|
}
|
|
276
276
|
if (a.removeAttribute(n), n === "is")
|
|
277
|
-
if (B ||
|
|
277
|
+
if (B || oe)
|
|
278
278
|
try {
|
|
279
279
|
M(a);
|
|
280
280
|
} catch {
|
|
@@ -284,96 +284,96 @@ function Mt() {
|
|
|
284
284
|
a.setAttribute(n, "");
|
|
285
285
|
} catch {
|
|
286
286
|
}
|
|
287
|
-
},
|
|
287
|
+
}, ct = function(n) {
|
|
288
288
|
let a = null, o = null;
|
|
289
289
|
if (Ne)
|
|
290
290
|
n = "<remove></remove>" + n;
|
|
291
291
|
else {
|
|
292
|
-
const
|
|
293
|
-
o =
|
|
292
|
+
const h = _t(n, /^[\r\n\t ]+/);
|
|
293
|
+
o = h && h[0];
|
|
294
294
|
}
|
|
295
|
-
|
|
296
|
-
const u =
|
|
297
|
-
if (G ===
|
|
295
|
+
q === "application/xhtml+xml" && G === w && (n = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + n + "</body></html>");
|
|
296
|
+
const u = y ? y.createHTML(n) : n;
|
|
297
|
+
if (G === w)
|
|
298
298
|
try {
|
|
299
|
-
a = new
|
|
299
|
+
a = new zt().parseFromString(u, q);
|
|
300
300
|
} catch {
|
|
301
301
|
}
|
|
302
302
|
if (!a || !a.documentElement) {
|
|
303
|
-
a =
|
|
303
|
+
a = Te.createDocument(G, "template", null);
|
|
304
304
|
try {
|
|
305
|
-
a.documentElement.innerHTML = be ?
|
|
305
|
+
a.documentElement.innerHTML = be ? X : u;
|
|
306
306
|
} catch {
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
309
|
const A = a.body || a.documentElement;
|
|
310
|
-
return n && o && A.insertBefore(r.createTextNode(o), A.childNodes[0] || null), G ===
|
|
311
|
-
},
|
|
312
|
-
return
|
|
310
|
+
return n && o && A.insertBefore(r.createTextNode(o), A.childNodes[0] || null), G === w ? jt.call(a, U ? "html" : "body")[0] : U ? a.documentElement : A;
|
|
311
|
+
}, ft = function(n) {
|
|
312
|
+
return Vt.call(
|
|
313
313
|
n.ownerDocument || n,
|
|
314
314
|
n,
|
|
315
315
|
// eslint-disable-next-line no-bitwise
|
|
316
|
-
|
|
316
|
+
R.SHOW_ELEMENT | R.SHOW_COMMENT | R.SHOW_TEXT | R.SHOW_PROCESSING_INSTRUCTION | R.SHOW_CDATA_SECTION,
|
|
317
317
|
null
|
|
318
318
|
);
|
|
319
319
|
}, Ce = function(n) {
|
|
320
|
-
return n instanceof
|
|
321
|
-
},
|
|
320
|
+
return n instanceof ge && (typeof n.nodeName != "string" || typeof n.textContent != "string" || typeof n.removeChild != "function" || !(n.attributes instanceof F) || typeof n.removeAttribute != "function" || typeof n.setAttribute != "function" || typeof n.namespaceURI != "string" || typeof n.insertBefore != "function" || typeof n.hasChildNodes != "function");
|
|
321
|
+
}, ut = function(n) {
|
|
322
322
|
return typeof L == "function" && n instanceof L;
|
|
323
323
|
};
|
|
324
|
-
function
|
|
325
|
-
|
|
324
|
+
function k(l, n, a) {
|
|
325
|
+
me(l, (o) => {
|
|
326
326
|
o.call(t, n, a, Y);
|
|
327
327
|
});
|
|
328
328
|
}
|
|
329
|
-
const
|
|
329
|
+
const mt = function(n) {
|
|
330
330
|
let a = null;
|
|
331
|
-
if (
|
|
331
|
+
if (k(N.beforeSanitizeElements, n, null), Ce(n))
|
|
332
332
|
return M(n), !0;
|
|
333
|
-
const o =
|
|
334
|
-
if (
|
|
333
|
+
const o = T(n.nodeName);
|
|
334
|
+
if (k(N.uponSanitizeElement, n, {
|
|
335
335
|
tagName: o,
|
|
336
|
-
allowedTags:
|
|
337
|
-
}), n.hasChildNodes() && !
|
|
336
|
+
allowedTags: g
|
|
337
|
+
}), ae && n.hasChildNodes() && !ut(n.firstElementChild) && O(/<[/\w!]/g, n.innerHTML) && O(/<[/\w!]/g, n.textContent) || n.nodeType === ne.progressingInstruction || ae && n.nodeType === ne.comment && O(/<[/\w]/g, n.data))
|
|
338
338
|
return M(n), !0;
|
|
339
|
-
if (!
|
|
340
|
-
if (!
|
|
339
|
+
if (!g[o] || j[o]) {
|
|
340
|
+
if (!j[o] && dt(o) && (d.tagNameCheck instanceof RegExp && O(d.tagNameCheck, o) || d.tagNameCheck instanceof Function && d.tagNameCheck(o)))
|
|
341
341
|
return !1;
|
|
342
342
|
if (Oe && !W[o]) {
|
|
343
|
-
const u =
|
|
343
|
+
const u = ie(n) || n.parentNode, A = $t(n) || n.childNodes;
|
|
344
344
|
if (A && u) {
|
|
345
|
-
const
|
|
346
|
-
for (let D =
|
|
347
|
-
const
|
|
348
|
-
|
|
345
|
+
const h = A.length;
|
|
346
|
+
for (let D = h - 1; D >= 0; --D) {
|
|
347
|
+
const x = Wt(A[D], !0);
|
|
348
|
+
x.__removalCount = (n.__removalCount || 0) + 1, u.insertBefore(x, Yt(n));
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
352
|
return M(n), !0;
|
|
353
353
|
}
|
|
354
|
-
return n instanceof m && !
|
|
355
|
-
a =
|
|
356
|
-
}), n.textContent !== a && (
|
|
354
|
+
return n instanceof m && !ln(n) || (o === "noscript" || o === "noembed" || o === "noframes") && O(/<\/no(script|embed|frames)/i, n.innerHTML) ? (M(n), !0) : (H && n.nodeType === ne.text && (a = n.textContent, me([Ee, Ae, _e], (u) => {
|
|
355
|
+
a = J(a, u, " ");
|
|
356
|
+
}), n.textContent !== a && (Q(t.removed, {
|
|
357
357
|
element: n.cloneNode()
|
|
358
|
-
}), n.textContent = a)),
|
|
359
|
-
},
|
|
360
|
-
if (
|
|
358
|
+
}), n.textContent = a)), k(N.afterSanitizeElements, n, null), !1);
|
|
359
|
+
}, pt = function(n, a, o) {
|
|
360
|
+
if (et && (a === "id" || a === "name") && (o in r || o in on))
|
|
361
361
|
return !1;
|
|
362
|
-
if (!(
|
|
363
|
-
if (!(
|
|
364
|
-
if (!
|
|
362
|
+
if (!(Re && !Se[a] && O(qt, a))) {
|
|
363
|
+
if (!(Ze && O(Zt, a))) {
|
|
364
|
+
if (!E[a] || Se[a]) {
|
|
365
365
|
if (
|
|
366
366
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
367
367
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
368
368
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
369
|
-
!(
|
|
369
|
+
!(dt(n) && (d.tagNameCheck instanceof RegExp && O(d.tagNameCheck, n) || d.tagNameCheck instanceof Function && d.tagNameCheck(n)) && (d.attributeNameCheck instanceof RegExp && O(d.attributeNameCheck, a) || d.attributeNameCheck instanceof Function && d.attributeNameCheck(a)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
370
370
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
371
371
|
a === "is" && d.allowCustomizedBuiltInElements && (d.tagNameCheck instanceof RegExp && O(d.tagNameCheck, o) || d.tagNameCheck instanceof Function && d.tagNameCheck(o)))
|
|
372
372
|
) return !1;
|
|
373
373
|
} else if (!ve[a]) {
|
|
374
|
-
if (!O(
|
|
375
|
-
if (!((a === "src" || a === "xlink:href" || a === "href") && n !== "script" &&
|
|
376
|
-
if (!(
|
|
374
|
+
if (!O(je, J(o, Xe, ""))) {
|
|
375
|
+
if (!((a === "src" || a === "xlink:href" || a === "href") && n !== "script" && dn(o, "data:") === 0 && rt[n])) {
|
|
376
|
+
if (!(Qe && !O(Qt, J(o, Xe, "")))) {
|
|
377
377
|
if (o)
|
|
378
378
|
return !1;
|
|
379
379
|
}
|
|
@@ -383,10 +383,10 @@ function Mt() {
|
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
385
|
return !0;
|
|
386
|
-
}, pt = function(n) {
|
|
387
|
-
return n !== "annotation-xml" && At(n, Qt);
|
|
388
386
|
}, dt = function(n) {
|
|
389
|
-
|
|
387
|
+
return n !== "annotation-xml" && _t(n, Jt);
|
|
388
|
+
}, ht = function(n) {
|
|
389
|
+
k(N.beforeSanitizeAttributes, n, null);
|
|
390
390
|
const {
|
|
391
391
|
attributes: a
|
|
392
392
|
} = n;
|
|
@@ -396,101 +396,109 @@ function Mt() {
|
|
|
396
396
|
attrName: "",
|
|
397
397
|
attrValue: "",
|
|
398
398
|
keepAttr: !0,
|
|
399
|
-
allowedAttributes:
|
|
399
|
+
allowedAttributes: E,
|
|
400
400
|
forceKeepAttr: void 0
|
|
401
401
|
};
|
|
402
402
|
let u = a.length;
|
|
403
403
|
for (; u--; ) {
|
|
404
404
|
const A = a[u], {
|
|
405
|
-
name:
|
|
405
|
+
name: h,
|
|
406
406
|
namespaceURI: D,
|
|
407
|
-
value:
|
|
408
|
-
} = A,
|
|
409
|
-
let
|
|
410
|
-
if (o.attrName =
|
|
411
|
-
|
|
407
|
+
value: x
|
|
408
|
+
} = A, Z = T(h), Ie = x;
|
|
409
|
+
let _ = h === "value" ? Ie : hn(Ie);
|
|
410
|
+
if (o.attrName = Z, o.attrValue = _, o.keepAttr = !0, o.forceKeepAttr = void 0, k(N.uponSanitizeAttribute, n, o), _ = o.attrValue, tt && (Z === "id" || Z === "name") && ($(h, n), _ = en + _), ae && O(/((--!?|])>)|<\/(style|title)/i, _)) {
|
|
411
|
+
$(h, n);
|
|
412
412
|
continue;
|
|
413
413
|
}
|
|
414
|
-
if (o.forceKeepAttr
|
|
414
|
+
if (o.forceKeepAttr)
|
|
415
|
+
continue;
|
|
416
|
+
if (!o.keepAttr) {
|
|
417
|
+
$(h, n);
|
|
415
418
|
continue;
|
|
416
|
-
|
|
417
|
-
|
|
419
|
+
}
|
|
420
|
+
if (!Je && O(/\/>/i, _)) {
|
|
421
|
+
$(h, n);
|
|
418
422
|
continue;
|
|
419
423
|
}
|
|
420
|
-
H &&
|
|
421
|
-
|
|
424
|
+
H && me([Ee, Ae, _e], (Tt) => {
|
|
425
|
+
_ = J(_, Tt, " ");
|
|
422
426
|
});
|
|
423
|
-
const
|
|
424
|
-
if (
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
427
|
+
const gt = T(n.nodeName);
|
|
428
|
+
if (!pt(gt, Z, _)) {
|
|
429
|
+
$(h, n);
|
|
430
|
+
continue;
|
|
431
|
+
}
|
|
432
|
+
if (y && typeof re == "object" && typeof re.getAttributeType == "function" && !D)
|
|
433
|
+
switch (re.getAttributeType(gt, Z)) {
|
|
434
|
+
case "TrustedHTML": {
|
|
435
|
+
_ = y.createHTML(_);
|
|
436
|
+
break;
|
|
437
|
+
}
|
|
438
|
+
case "TrustedScriptURL": {
|
|
439
|
+
_ = y.createScriptURL(_);
|
|
440
|
+
break;
|
|
435
441
|
}
|
|
442
|
+
}
|
|
443
|
+
if (_ !== Ie)
|
|
436
444
|
try {
|
|
437
|
-
D ? n.setAttributeNS(D,
|
|
445
|
+
D ? n.setAttributeNS(D, h, _) : n.setAttribute(h, _), Ce(n) ? M(n) : At(t.removed);
|
|
438
446
|
} catch {
|
|
447
|
+
$(h, n);
|
|
439
448
|
}
|
|
440
|
-
}
|
|
441
449
|
}
|
|
442
|
-
|
|
443
|
-
},
|
|
450
|
+
k(N.afterSanitizeAttributes, n, null);
|
|
451
|
+
}, sn = function l(n) {
|
|
444
452
|
let a = null;
|
|
445
|
-
const o =
|
|
446
|
-
for (
|
|
447
|
-
|
|
448
|
-
|
|
453
|
+
const o = ft(n);
|
|
454
|
+
for (k(N.beforeSanitizeShadowDOM, n, null); a = o.nextNode(); )
|
|
455
|
+
k(N.uponSanitizeShadowNode, a, null), mt(a), ht(a), a.content instanceof c && l(a.content);
|
|
456
|
+
k(N.afterSanitizeShadowDOM, n, null);
|
|
449
457
|
};
|
|
450
458
|
return t.sanitize = function(l) {
|
|
451
459
|
let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, a = null, o = null, u = null, A = null;
|
|
452
|
-
if (be = !l, be && (l = "<!-->"), typeof l != "string" && !
|
|
460
|
+
if (be = !l, be && (l = "<!-->"), typeof l != "string" && !ut(l))
|
|
453
461
|
if (typeof l.toString == "function") {
|
|
454
462
|
if (l = l.toString(), typeof l != "string")
|
|
455
|
-
throw
|
|
463
|
+
throw ee("dirty is not a string, aborting");
|
|
456
464
|
} else
|
|
457
|
-
throw
|
|
465
|
+
throw ee("toString is not a function");
|
|
458
466
|
if (!t.isSupported)
|
|
459
467
|
return l;
|
|
460
|
-
if (ye || De(n), t.removed = [], typeof l == "string" && (
|
|
468
|
+
if (ye || De(n), t.removed = [], typeof l == "string" && (K = !1), K) {
|
|
461
469
|
if (l.nodeName) {
|
|
462
|
-
const
|
|
463
|
-
if (!
|
|
464
|
-
throw
|
|
470
|
+
const x = T(l.nodeName);
|
|
471
|
+
if (!g[x] || j[x])
|
|
472
|
+
throw ee("root node is forbidden and cannot be sanitized in-place");
|
|
465
473
|
}
|
|
466
474
|
} else if (l instanceof L)
|
|
467
|
-
a =
|
|
475
|
+
a = ct("<!---->"), o = a.ownerDocument.importNode(l, !0), o.nodeType === ne.element && o.nodeName === "BODY" || o.nodeName === "HTML" ? a = o : a.appendChild(o);
|
|
468
476
|
else {
|
|
469
|
-
if (!B && !H && !
|
|
477
|
+
if (!B && !H && !U && // eslint-disable-next-line unicorn/prefer-includes
|
|
470
478
|
l.indexOf("<") === -1)
|
|
471
|
-
return
|
|
472
|
-
if (a =
|
|
473
|
-
return B ? null :
|
|
479
|
+
return y && le ? y.createHTML(l) : l;
|
|
480
|
+
if (a = ct(l), !a)
|
|
481
|
+
return B ? null : le ? X : "";
|
|
474
482
|
}
|
|
475
483
|
a && Ne && M(a.firstChild);
|
|
476
|
-
const
|
|
477
|
-
for (; u =
|
|
478
|
-
|
|
479
|
-
if (
|
|
484
|
+
const h = ft(K ? l : a);
|
|
485
|
+
for (; u = h.nextNode(); )
|
|
486
|
+
mt(u), ht(u), u.content instanceof c && sn(u.content);
|
|
487
|
+
if (K)
|
|
480
488
|
return l;
|
|
481
489
|
if (B) {
|
|
482
|
-
if (
|
|
483
|
-
for (A =
|
|
490
|
+
if (oe)
|
|
491
|
+
for (A = Xt.call(a.ownerDocument); a.firstChild; )
|
|
484
492
|
A.appendChild(a.firstChild);
|
|
485
493
|
else
|
|
486
494
|
A = a;
|
|
487
|
-
return (
|
|
495
|
+
return (E.shadowroot || E.shadowrootmode) && (A = Kt.call(i, A, !0)), A;
|
|
488
496
|
}
|
|
489
|
-
let D =
|
|
490
|
-
return
|
|
491
|
-
` + D), H &&
|
|
492
|
-
D =
|
|
493
|
-
}),
|
|
497
|
+
let D = U ? a.outerHTML : a.innerHTML;
|
|
498
|
+
return U && g["!doctype"] && a.ownerDocument && a.ownerDocument.doctype && a.ownerDocument.doctype.name && O(Mt, a.ownerDocument.doctype.name) && (D = "<!DOCTYPE " + a.ownerDocument.doctype.name + `>
|
|
499
|
+
` + D), H && me([Ee, Ae, _e], (x) => {
|
|
500
|
+
D = J(D, x, " ");
|
|
501
|
+
}), y && le ? y.createHTML(D) : D;
|
|
494
502
|
}, t.setConfig = function() {
|
|
495
503
|
let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
496
504
|
De(l), ye = !0;
|
|
@@ -498,24 +506,24 @@ function Mt() {
|
|
|
498
506
|
Y = null, ye = !1;
|
|
499
507
|
}, t.isValidAttribute = function(l, n, a) {
|
|
500
508
|
Y || De({});
|
|
501
|
-
const o =
|
|
502
|
-
return
|
|
509
|
+
const o = T(l), u = T(n);
|
|
510
|
+
return pt(o, u, a);
|
|
503
511
|
}, t.addHook = function(l, n) {
|
|
504
|
-
typeof n == "function" &&
|
|
512
|
+
typeof n == "function" && Q(N[l], n);
|
|
505
513
|
}, t.removeHook = function(l, n) {
|
|
506
514
|
if (n !== void 0) {
|
|
507
|
-
const a =
|
|
508
|
-
return a === -1 ? void 0 :
|
|
515
|
+
const a = mn(N[l], n);
|
|
516
|
+
return a === -1 ? void 0 : pn(N[l], a, 1)[0];
|
|
509
517
|
}
|
|
510
|
-
return
|
|
518
|
+
return At(N[l]);
|
|
511
519
|
}, t.removeHooks = function(l) {
|
|
512
|
-
|
|
520
|
+
N[l] = [];
|
|
513
521
|
}, t.removeAllHooks = function() {
|
|
514
|
-
|
|
522
|
+
N = vt();
|
|
515
523
|
}, t;
|
|
516
524
|
}
|
|
517
|
-
var
|
|
518
|
-
function
|
|
525
|
+
var tr = wt();
|
|
526
|
+
function Cn(e) {
|
|
519
527
|
for (var t = 1; t < arguments.length; t++) {
|
|
520
528
|
var r = arguments[t];
|
|
521
529
|
for (var i in r)
|
|
@@ -523,18 +531,18 @@ function Dn(e) {
|
|
|
523
531
|
}
|
|
524
532
|
return e;
|
|
525
533
|
}
|
|
526
|
-
function
|
|
534
|
+
function We(e, t) {
|
|
527
535
|
return Array(t + 1).join(e);
|
|
528
536
|
}
|
|
529
|
-
function
|
|
537
|
+
function In(e) {
|
|
530
538
|
return e.replace(/^\n*/, "");
|
|
531
539
|
}
|
|
532
|
-
function
|
|
540
|
+
function Mn(e) {
|
|
533
541
|
for (var t = e.length; t > 0 && e[t - 1] === `
|
|
534
542
|
`; ) t--;
|
|
535
543
|
return e.substring(0, t);
|
|
536
544
|
}
|
|
537
|
-
var
|
|
545
|
+
var wn = [
|
|
538
546
|
"ADDRESS",
|
|
539
547
|
"ARTICLE",
|
|
540
548
|
"ASIDE",
|
|
@@ -585,10 +593,10 @@ var Mn = [
|
|
|
585
593
|
"TR",
|
|
586
594
|
"UL"
|
|
587
595
|
];
|
|
588
|
-
function
|
|
589
|
-
return
|
|
596
|
+
function Ye(e) {
|
|
597
|
+
return $e(e, wn);
|
|
590
598
|
}
|
|
591
|
-
var
|
|
599
|
+
var kt = [
|
|
592
600
|
"AREA",
|
|
593
601
|
"BASE",
|
|
594
602
|
"BR",
|
|
@@ -606,13 +614,13 @@ var wt = [
|
|
|
606
614
|
"TRACK",
|
|
607
615
|
"WBR"
|
|
608
616
|
];
|
|
609
|
-
function
|
|
610
|
-
return
|
|
617
|
+
function xt(e) {
|
|
618
|
+
return $e(e, kt);
|
|
611
619
|
}
|
|
612
|
-
function
|
|
613
|
-
return
|
|
620
|
+
function kn(e) {
|
|
621
|
+
return Ut(e, kt);
|
|
614
622
|
}
|
|
615
|
-
var
|
|
623
|
+
var Pt = [
|
|
616
624
|
"A",
|
|
617
625
|
"TABLE",
|
|
618
626
|
"THEAD",
|
|
@@ -625,22 +633,22 @@ var xt = [
|
|
|
625
633
|
"AUDIO",
|
|
626
634
|
"VIDEO"
|
|
627
635
|
];
|
|
628
|
-
function kn(e) {
|
|
629
|
-
return Ye(e, xt);
|
|
630
|
-
}
|
|
631
636
|
function xn(e) {
|
|
632
|
-
return
|
|
637
|
+
return $e(e, Pt);
|
|
638
|
+
}
|
|
639
|
+
function Pn(e) {
|
|
640
|
+
return Ut(e, Pt);
|
|
633
641
|
}
|
|
634
|
-
function
|
|
642
|
+
function $e(e, t) {
|
|
635
643
|
return t.indexOf(e.nodeName) >= 0;
|
|
636
644
|
}
|
|
637
|
-
function
|
|
645
|
+
function Ut(e, t) {
|
|
638
646
|
return e.getElementsByTagName && t.some(function(r) {
|
|
639
647
|
return e.getElementsByTagName(r).length;
|
|
640
648
|
});
|
|
641
649
|
}
|
|
642
|
-
var
|
|
643
|
-
|
|
650
|
+
var S = {};
|
|
651
|
+
S.paragraph = {
|
|
644
652
|
filter: "p",
|
|
645
653
|
replacement: function(e) {
|
|
646
654
|
return `
|
|
@@ -650,19 +658,19 @@ _.paragraph = {
|
|
|
650
658
|
`;
|
|
651
659
|
}
|
|
652
660
|
};
|
|
653
|
-
|
|
661
|
+
S.lineBreak = {
|
|
654
662
|
filter: "br",
|
|
655
663
|
replacement: function(e, t, r) {
|
|
656
664
|
return r.br + `
|
|
657
665
|
`;
|
|
658
666
|
}
|
|
659
667
|
};
|
|
660
|
-
|
|
668
|
+
S.heading = {
|
|
661
669
|
filter: ["h1", "h2", "h3", "h4", "h5", "h6"],
|
|
662
670
|
replacement: function(e, t, r) {
|
|
663
671
|
var i = Number(t.nodeName.charAt(1));
|
|
664
672
|
if (r.headingStyle === "setext" && i < 3) {
|
|
665
|
-
var s =
|
|
673
|
+
var s = We(i === 1 ? "=" : "-", e.length);
|
|
666
674
|
return `
|
|
667
675
|
|
|
668
676
|
` + e + `
|
|
@@ -672,12 +680,12 @@ _.heading = {
|
|
|
672
680
|
} else
|
|
673
681
|
return `
|
|
674
682
|
|
|
675
|
-
` +
|
|
683
|
+
` + We("#", i) + " " + e + `
|
|
676
684
|
|
|
677
685
|
`;
|
|
678
686
|
}
|
|
679
687
|
};
|
|
680
|
-
|
|
688
|
+
S.blockquote = {
|
|
681
689
|
filter: "blockquote",
|
|
682
690
|
replacement: function(e) {
|
|
683
691
|
return e = e.replace(/^\n+|\n+$/g, ""), e = e.replace(/^/gm, "> "), `
|
|
@@ -687,7 +695,7 @@ _.blockquote = {
|
|
|
687
695
|
`;
|
|
688
696
|
}
|
|
689
697
|
};
|
|
690
|
-
|
|
698
|
+
S.list = {
|
|
691
699
|
filter: ["ul", "ol"],
|
|
692
700
|
replacement: function(e, t) {
|
|
693
701
|
var r = t.parentNode;
|
|
@@ -699,7 +707,7 @@ _.list = {
|
|
|
699
707
|
`;
|
|
700
708
|
}
|
|
701
709
|
};
|
|
702
|
-
|
|
710
|
+
S.listItem = {
|
|
703
711
|
filter: "li",
|
|
704
712
|
replacement: function(e, t, r) {
|
|
705
713
|
e = e.replace(/^\n+/, "").replace(/\n+$/, `
|
|
@@ -714,7 +722,7 @@ _.listItem = {
|
|
|
714
722
|
` : "");
|
|
715
723
|
}
|
|
716
724
|
};
|
|
717
|
-
|
|
725
|
+
S.indentedCodeBlock = {
|
|
718
726
|
filter: function(e, t) {
|
|
719
727
|
return t.codeBlockStyle === "indented" && e.nodeName === "PRE" && e.firstChild && e.firstChild.nodeName === "CODE";
|
|
720
728
|
},
|
|
@@ -727,14 +735,14 @@ _.indentedCodeBlock = {
|
|
|
727
735
|
`;
|
|
728
736
|
}
|
|
729
737
|
};
|
|
730
|
-
|
|
738
|
+
S.fencedCodeBlock = {
|
|
731
739
|
filter: function(e, t) {
|
|
732
740
|
return t.codeBlockStyle === "fenced" && e.nodeName === "PRE" && e.firstChild && e.firstChild.nodeName === "CODE";
|
|
733
741
|
},
|
|
734
742
|
replacement: function(e, t, r) {
|
|
735
|
-
for (var i = t.firstChild.getAttribute("class") || "", s = (i.match(/language-(\S+)/) || [null, ""])[1], c = t.firstChild.textContent, p = r.fence.charAt(0), L = 3, m = new RegExp("^" + p + "{3,}", "gm"),
|
|
736
|
-
|
|
737
|
-
var F =
|
|
743
|
+
for (var i = t.firstChild.getAttribute("class") || "", s = (i.match(/language-(\S+)/) || [null, ""])[1], c = t.firstChild.textContent, p = r.fence.charAt(0), L = 3, m = new RegExp("^" + p + "{3,}", "gm"), R; R = m.exec(c); )
|
|
744
|
+
R[0].length >= L && (L = R[0].length + 1);
|
|
745
|
+
var F = We(p, L);
|
|
738
746
|
return `
|
|
739
747
|
|
|
740
748
|
` + F + s + `
|
|
@@ -744,7 +752,7 @@ _.fencedCodeBlock = {
|
|
|
744
752
|
`;
|
|
745
753
|
}
|
|
746
754
|
};
|
|
747
|
-
|
|
755
|
+
S.horizontalRule = {
|
|
748
756
|
filter: "hr",
|
|
749
757
|
replacement: function(e, t, r) {
|
|
750
758
|
return `
|
|
@@ -754,23 +762,23 @@ _.horizontalRule = {
|
|
|
754
762
|
`;
|
|
755
763
|
}
|
|
756
764
|
};
|
|
757
|
-
|
|
765
|
+
S.inlineLink = {
|
|
758
766
|
filter: function(e, t) {
|
|
759
767
|
return t.linkStyle === "inlined" && e.nodeName === "A" && e.getAttribute("href");
|
|
760
768
|
},
|
|
761
769
|
replacement: function(e, t) {
|
|
762
770
|
var r = t.getAttribute("href");
|
|
763
771
|
r && (r = r.replace(/([()])/g, "\\$1"));
|
|
764
|
-
var i =
|
|
772
|
+
var i = he(t.getAttribute("title"));
|
|
765
773
|
return i && (i = ' "' + i.replace(/"/g, '\\"') + '"'), "[" + e + "](" + r + i + ")";
|
|
766
774
|
}
|
|
767
775
|
};
|
|
768
|
-
|
|
776
|
+
S.referenceLink = {
|
|
769
777
|
filter: function(e, t) {
|
|
770
778
|
return t.linkStyle === "referenced" && e.nodeName === "A" && e.getAttribute("href");
|
|
771
779
|
},
|
|
772
780
|
replacement: function(e, t, r) {
|
|
773
|
-
var i = t.getAttribute("href"), s =
|
|
781
|
+
var i = t.getAttribute("href"), s = he(t.getAttribute("title"));
|
|
774
782
|
s && (s = ' "' + s + '"');
|
|
775
783
|
var c, p;
|
|
776
784
|
switch (r.linkReferenceStyle) {
|
|
@@ -797,19 +805,19 @@ _.referenceLink = {
|
|
|
797
805
|
`, this.references = []), t;
|
|
798
806
|
}
|
|
799
807
|
};
|
|
800
|
-
|
|
808
|
+
S.emphasis = {
|
|
801
809
|
filter: ["em", "i"],
|
|
802
810
|
replacement: function(e, t, r) {
|
|
803
811
|
return e.trim() ? r.emDelimiter + e + r.emDelimiter : "";
|
|
804
812
|
}
|
|
805
813
|
};
|
|
806
|
-
|
|
814
|
+
S.strong = {
|
|
807
815
|
filter: ["strong", "b"],
|
|
808
816
|
replacement: function(e, t, r) {
|
|
809
817
|
return e.trim() ? r.strongDelimiter + e + r.strongDelimiter : "";
|
|
810
818
|
}
|
|
811
819
|
};
|
|
812
|
-
|
|
820
|
+
S.code = {
|
|
813
821
|
filter: function(e) {
|
|
814
822
|
var t = e.previousSibling || e.nextSibling, r = e.parentNode.nodeName === "PRE" && !t;
|
|
815
823
|
return e.nodeName === "CODE" && !r;
|
|
@@ -821,18 +829,18 @@ _.code = {
|
|
|
821
829
|
return r + t + e + t + r;
|
|
822
830
|
}
|
|
823
831
|
};
|
|
824
|
-
|
|
832
|
+
S.image = {
|
|
825
833
|
filter: "img",
|
|
826
834
|
replacement: function(e, t) {
|
|
827
|
-
var r =
|
|
835
|
+
var r = he(t.getAttribute("alt")), i = t.getAttribute("src") || "", s = he(t.getAttribute("title")), c = s ? ' "' + s + '"' : "";
|
|
828
836
|
return i ? "" : "";
|
|
829
837
|
}
|
|
830
838
|
};
|
|
831
|
-
function
|
|
839
|
+
function he(e) {
|
|
832
840
|
return e ? e.replace(/(\n+\s*)+/g, `
|
|
833
841
|
`) : "";
|
|
834
842
|
}
|
|
835
|
-
function
|
|
843
|
+
function Ft(e) {
|
|
836
844
|
this.options = e, this._keep = [], this._remove = [], this.blankRule = {
|
|
837
845
|
replacement: e.blankReplacement
|
|
838
846
|
}, this.keepReplacement = e.keepReplacement, this.defaultRule = {
|
|
@@ -840,7 +848,7 @@ function Ut(e) {
|
|
|
840
848
|
}, this.array = [];
|
|
841
849
|
for (var t in e.rules) this.array.push(e.rules[t]);
|
|
842
850
|
}
|
|
843
|
-
|
|
851
|
+
Ft.prototype = {
|
|
844
852
|
add: function(e, t) {
|
|
845
853
|
this.array.unshift(t);
|
|
846
854
|
},
|
|
@@ -861,19 +869,19 @@ Ut.prototype = {
|
|
|
861
869
|
forNode: function(e) {
|
|
862
870
|
if (e.isBlank) return this.blankRule;
|
|
863
871
|
var t;
|
|
864
|
-
return (t =
|
|
872
|
+
return (t = Ue(this.array, e, this.options)) || (t = Ue(this._keep, e, this.options)) || (t = Ue(this._remove, e, this.options)) ? t : this.defaultRule;
|
|
865
873
|
},
|
|
866
874
|
forEach: function(e) {
|
|
867
875
|
for (var t = 0; t < this.array.length; t++) e(this.array[t], t);
|
|
868
876
|
}
|
|
869
877
|
};
|
|
870
|
-
function
|
|
878
|
+
function Ue(e, t, r) {
|
|
871
879
|
for (var i = 0; i < e.length; i++) {
|
|
872
880
|
var s = e[i];
|
|
873
|
-
if (
|
|
881
|
+
if (Un(s, t, r)) return s;
|
|
874
882
|
}
|
|
875
883
|
}
|
|
876
|
-
function
|
|
884
|
+
function Un(e, t, r) {
|
|
877
885
|
var i = e.filter;
|
|
878
886
|
if (typeof i == "string") {
|
|
879
887
|
if (i === t.nodeName.toLowerCase()) return !0;
|
|
@@ -884,51 +892,51 @@ function Pn(e, t, r) {
|
|
|
884
892
|
} else
|
|
885
893
|
throw new TypeError("`filter` needs to be a string, array, or function");
|
|
886
894
|
}
|
|
887
|
-
function
|
|
888
|
-
var t = e.element, r = e.isBlock, i = e.isVoid, s = e.isPre || function(
|
|
889
|
-
return
|
|
895
|
+
function Fn(e) {
|
|
896
|
+
var t = e.element, r = e.isBlock, i = e.isVoid, s = e.isPre || function(ge) {
|
|
897
|
+
return ge.nodeName === "PRE";
|
|
890
898
|
};
|
|
891
899
|
if (!(!t.firstChild || s(t))) {
|
|
892
|
-
for (var c = null, p = !1, L = null, m =
|
|
900
|
+
for (var c = null, p = !1, L = null, m = bt(L, t, s); m !== t; ) {
|
|
893
901
|
if (m.nodeType === 3 || m.nodeType === 4) {
|
|
894
|
-
var
|
|
895
|
-
if ((!c || / $/.test(c.data)) && !p &&
|
|
896
|
-
m =
|
|
902
|
+
var R = m.data.replace(/[ \r\n\t]+/g, " ");
|
|
903
|
+
if ((!c || / $/.test(c.data)) && !p && R[0] === " " && (R = R.substr(1)), !R) {
|
|
904
|
+
m = Fe(m);
|
|
897
905
|
continue;
|
|
898
906
|
}
|
|
899
|
-
m.data =
|
|
907
|
+
m.data = R, c = m;
|
|
900
908
|
} else if (m.nodeType === 1)
|
|
901
909
|
r(m) || m.nodeName === "BR" ? (c && (c.data = c.data.replace(/ $/, "")), c = null, p = !1) : i(m) || s(m) ? (c = null, p = !0) : c && (p = !1);
|
|
902
910
|
else {
|
|
903
|
-
m =
|
|
911
|
+
m = Fe(m);
|
|
904
912
|
continue;
|
|
905
913
|
}
|
|
906
|
-
var F =
|
|
914
|
+
var F = bt(L, m, s);
|
|
907
915
|
L = m, m = F;
|
|
908
916
|
}
|
|
909
|
-
c && (c.data = c.data.replace(/ $/, ""), c.data ||
|
|
917
|
+
c && (c.data = c.data.replace(/ $/, ""), c.data || Fe(c));
|
|
910
918
|
}
|
|
911
919
|
}
|
|
912
|
-
function
|
|
920
|
+
function Fe(e) {
|
|
913
921
|
var t = e.nextSibling || e.parentNode;
|
|
914
922
|
return e.parentNode.removeChild(e), t;
|
|
915
923
|
}
|
|
916
|
-
function
|
|
924
|
+
function bt(e, t, r) {
|
|
917
925
|
return e && e.parentNode === t || r(t) ? t.nextSibling || t.parentNode : t.firstChild || t.nextSibling || t.parentNode;
|
|
918
926
|
}
|
|
919
|
-
var
|
|
920
|
-
function
|
|
921
|
-
var e =
|
|
927
|
+
var Ve = typeof window < "u" ? window : {};
|
|
928
|
+
function Hn() {
|
|
929
|
+
var e = Ve.DOMParser, t = !1;
|
|
922
930
|
try {
|
|
923
931
|
new e().parseFromString("", "text/html") && (t = !0);
|
|
924
932
|
} catch {
|
|
925
933
|
}
|
|
926
934
|
return t;
|
|
927
935
|
}
|
|
928
|
-
function
|
|
936
|
+
function Bn() {
|
|
929
937
|
var e = function() {
|
|
930
938
|
};
|
|
931
|
-
return
|
|
939
|
+
return zn() ? e.prototype.parseFromString = function(t) {
|
|
932
940
|
var r = new window.ActiveXObject("htmlfile");
|
|
933
941
|
return r.designMode = "on", r.open(), r.write(t), r.close(), r;
|
|
934
942
|
} : e.prototype.parseFromString = function(t) {
|
|
@@ -936,20 +944,20 @@ function Hn() {
|
|
|
936
944
|
return r.open(), r.write(t), r.close(), r;
|
|
937
945
|
}, e;
|
|
938
946
|
}
|
|
939
|
-
function
|
|
947
|
+
function zn() {
|
|
940
948
|
var e = !1;
|
|
941
949
|
try {
|
|
942
950
|
document.implementation.createHTMLDocument("").open();
|
|
943
951
|
} catch {
|
|
944
|
-
|
|
952
|
+
Ve.ActiveXObject && (e = !0);
|
|
945
953
|
}
|
|
946
954
|
return e;
|
|
947
955
|
}
|
|
948
|
-
var
|
|
949
|
-
function
|
|
956
|
+
var Wn = Hn() ? Ve.DOMParser : Bn();
|
|
957
|
+
function Gn(e, t) {
|
|
950
958
|
var r;
|
|
951
959
|
if (typeof e == "string") {
|
|
952
|
-
var i =
|
|
960
|
+
var i = Yn().parseFromString(
|
|
953
961
|
// DOM parsers arrange elements in the <head> and <body>.
|
|
954
962
|
// Wrapping in a custom element ensures elements are reliably arranged in
|
|
955
963
|
// a single element.
|
|
@@ -959,33 +967,33 @@ function Wn(e, t) {
|
|
|
959
967
|
r = i.getElementById("turndown-root");
|
|
960
968
|
} else
|
|
961
969
|
r = e.cloneNode(!0);
|
|
962
|
-
return
|
|
970
|
+
return Fn({
|
|
963
971
|
element: r,
|
|
964
|
-
isBlock:
|
|
965
|
-
isVoid:
|
|
966
|
-
isPre: t.preformattedCode ?
|
|
972
|
+
isBlock: Ye,
|
|
973
|
+
isVoid: xt,
|
|
974
|
+
isPre: t.preformattedCode ? $n : null
|
|
967
975
|
}), r;
|
|
968
976
|
}
|
|
969
|
-
var
|
|
970
|
-
function
|
|
971
|
-
return
|
|
977
|
+
var He;
|
|
978
|
+
function Yn() {
|
|
979
|
+
return He = He || new Wn(), He;
|
|
972
980
|
}
|
|
973
|
-
function
|
|
981
|
+
function $n(e) {
|
|
974
982
|
return e.nodeName === "PRE" || e.nodeName === "CODE";
|
|
975
983
|
}
|
|
976
|
-
function
|
|
977
|
-
return e.isBlock =
|
|
984
|
+
function Vn(e, t) {
|
|
985
|
+
return e.isBlock = Ye(e), e.isCode = e.nodeName === "CODE" || e.parentNode.isCode, e.isBlank = Xn(e), e.flankingWhitespace = jn(e, t), e;
|
|
978
986
|
}
|
|
979
|
-
function
|
|
980
|
-
return !
|
|
987
|
+
function Xn(e) {
|
|
988
|
+
return !xt(e) && !xn(e) && /^\s*$/i.test(e.textContent) && !kn(e) && !Pn(e);
|
|
981
989
|
}
|
|
982
|
-
function
|
|
990
|
+
function jn(e, t) {
|
|
983
991
|
if (e.isBlock || t.preformattedCode && e.isCode)
|
|
984
992
|
return { leading: "", trailing: "" };
|
|
985
|
-
var r =
|
|
986
|
-
return r.leadingAscii &&
|
|
993
|
+
var r = Kn(e.textContent);
|
|
994
|
+
return r.leadingAscii && Lt("left", e, t) && (r.leading = r.leadingNonAscii), r.trailingAscii && Lt("right", e, t) && (r.trailing = r.trailingNonAscii), { leading: r.leading, trailing: r.trailing };
|
|
987
995
|
}
|
|
988
|
-
function
|
|
996
|
+
function Kn(e) {
|
|
989
997
|
var t = e.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);
|
|
990
998
|
return {
|
|
991
999
|
leading: t[1],
|
|
@@ -998,11 +1006,11 @@ function jn(e) {
|
|
|
998
1006
|
trailingAscii: t[6]
|
|
999
1007
|
};
|
|
1000
1008
|
}
|
|
1001
|
-
function
|
|
1009
|
+
function Lt(e, t, r) {
|
|
1002
1010
|
var i, s, c;
|
|
1003
|
-
return e === "left" ? (i = t.previousSibling, s = / $/) : (i = t.nextSibling, s = /^ /), i && (i.nodeType === 3 ? c = s.test(i.nodeValue) : r.preformattedCode && i.nodeName === "CODE" ? c = !1 : i.nodeType === 1 && !
|
|
1011
|
+
return e === "left" ? (i = t.previousSibling, s = / $/) : (i = t.nextSibling, s = /^ /), i && (i.nodeType === 3 ? c = s.test(i.nodeValue) : r.preformattedCode && i.nodeName === "CODE" ? c = !1 : i.nodeType === 1 && !Ye(i) && (c = s.test(i.textContent))), c;
|
|
1004
1012
|
}
|
|
1005
|
-
var
|
|
1013
|
+
var qn = Array.prototype.reduce, Zn = [
|
|
1006
1014
|
[/\\/g, "\\\\"],
|
|
1007
1015
|
[/\*/g, "\\*"],
|
|
1008
1016
|
[/^-/g, "\\-"],
|
|
@@ -1017,10 +1025,10 @@ var Kn = Array.prototype.reduce, qn = [
|
|
|
1017
1025
|
[/_/g, "\\_"],
|
|
1018
1026
|
[/^(\d+)\. /g, "$1\\. "]
|
|
1019
1027
|
];
|
|
1020
|
-
function
|
|
1021
|
-
if (!(this instanceof
|
|
1028
|
+
function Ge(e) {
|
|
1029
|
+
if (!(this instanceof Ge)) return new Ge(e);
|
|
1022
1030
|
var t = {
|
|
1023
|
-
rules:
|
|
1031
|
+
rules: S,
|
|
1024
1032
|
headingStyle: "setext",
|
|
1025
1033
|
hr: "* * *",
|
|
1026
1034
|
bulletListMarker: "*",
|
|
@@ -1052,9 +1060,9 @@ function We(e) {
|
|
|
1052
1060
|
` : r;
|
|
1053
1061
|
}
|
|
1054
1062
|
};
|
|
1055
|
-
this.options =
|
|
1063
|
+
this.options = Cn({}, t, e), this.rules = new Ft(this.options);
|
|
1056
1064
|
}
|
|
1057
|
-
|
|
1065
|
+
Ge.prototype = {
|
|
1058
1066
|
/**
|
|
1059
1067
|
* The entry point for converting a string or DOM node to Markdown
|
|
1060
1068
|
* @public
|
|
@@ -1063,13 +1071,13 @@ We.prototype = {
|
|
|
1063
1071
|
* @type String
|
|
1064
1072
|
*/
|
|
1065
1073
|
turndown: function(e) {
|
|
1066
|
-
if (!
|
|
1074
|
+
if (!er(e))
|
|
1067
1075
|
throw new TypeError(
|
|
1068
1076
|
e + " is not a string, or an element/document/fragment node."
|
|
1069
1077
|
);
|
|
1070
1078
|
if (e === "") return "";
|
|
1071
|
-
var t =
|
|
1072
|
-
return
|
|
1079
|
+
var t = Ht.call(this, new Gn(e, this.options));
|
|
1080
|
+
return Qn.call(this, t);
|
|
1073
1081
|
},
|
|
1074
1082
|
/**
|
|
1075
1083
|
* Add one or more plugins
|
|
@@ -1126,39 +1134,39 @@ We.prototype = {
|
|
|
1126
1134
|
* @type String
|
|
1127
1135
|
*/
|
|
1128
1136
|
escape: function(e) {
|
|
1129
|
-
return
|
|
1137
|
+
return Zn.reduce(function(t, r) {
|
|
1130
1138
|
return t.replace(r[0], r[1]);
|
|
1131
1139
|
}, e);
|
|
1132
1140
|
}
|
|
1133
1141
|
};
|
|
1134
|
-
function
|
|
1142
|
+
function Ht(e) {
|
|
1135
1143
|
var t = this;
|
|
1136
|
-
return
|
|
1137
|
-
i = new
|
|
1144
|
+
return qn.call(e.childNodes, function(r, i) {
|
|
1145
|
+
i = new Vn(i, t.options);
|
|
1138
1146
|
var s = "";
|
|
1139
|
-
return i.nodeType === 3 ? s = i.isCode ? i.nodeValue : t.escape(i.nodeValue) : i.nodeType === 1 && (s =
|
|
1147
|
+
return i.nodeType === 3 ? s = i.isCode ? i.nodeValue : t.escape(i.nodeValue) : i.nodeType === 1 && (s = Jn.call(t, i)), Bt(r, s);
|
|
1140
1148
|
}, "");
|
|
1141
1149
|
}
|
|
1142
|
-
function
|
|
1150
|
+
function Qn(e) {
|
|
1143
1151
|
var t = this;
|
|
1144
1152
|
return this.rules.forEach(function(r) {
|
|
1145
|
-
typeof r.append == "function" && (e =
|
|
1153
|
+
typeof r.append == "function" && (e = Bt(e, r.append(t.options)));
|
|
1146
1154
|
}), e.replace(/^[\t\r\n]+/, "").replace(/[\t\r\n\s]+$/, "");
|
|
1147
1155
|
}
|
|
1148
|
-
function
|
|
1149
|
-
var t = this.rules.forNode(e), r =
|
|
1156
|
+
function Jn(e) {
|
|
1157
|
+
var t = this.rules.forNode(e), r = Ht.call(this, e), i = e.flankingWhitespace;
|
|
1150
1158
|
return (i.leading || i.trailing) && (r = r.trim()), i.leading + t.replacement(r, e, this.options) + i.trailing;
|
|
1151
1159
|
}
|
|
1152
|
-
function
|
|
1153
|
-
var r =
|
|
1160
|
+
function Bt(e, t) {
|
|
1161
|
+
var r = Mn(e), i = In(t), s = Math.max(e.length - r.length, t.length - i.length), c = `
|
|
1154
1162
|
|
|
1155
1163
|
`.substring(0, s);
|
|
1156
1164
|
return r + c + i;
|
|
1157
1165
|
}
|
|
1158
|
-
function
|
|
1166
|
+
function er(e) {
|
|
1159
1167
|
return e != null && (typeof e == "string" || e.nodeType && (e.nodeType === 1 || e.nodeType === 9 || e.nodeType === 11));
|
|
1160
1168
|
}
|
|
1161
1169
|
export {
|
|
1162
|
-
|
|
1163
|
-
|
|
1170
|
+
Ge as T,
|
|
1171
|
+
tr as p
|
|
1164
1172
|
};
|