@squeed/flow-sdk 2.0.22 → 2.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +117 -0
- package/dist/{contentPreviewDocument-B0nOMpw0.js → _virtual_content-preview-runtime-Deui59HN.cjs} +3 -961
- package/dist/_virtual_content-preview-runtime-Deui59HN.cjs.map +1 -0
- package/dist/{contentPreviewDocument-B_Jous_v.cjs → _virtual_content-preview-runtime-X_KtOyFO.js} +6 -11
- package/dist/_virtual_content-preview-runtime-X_KtOyFO.js.map +1 -0
- package/dist/contentPreviewDocument-BsKd0dD4.cjs +10 -0
- package/dist/{contentPreviewDocument-B_Jous_v.cjs.map → contentPreviewDocument-BsKd0dD4.cjs.map} +1 -1
- package/dist/contentPreviewDocument-C2D0H-Lr.js +962 -0
- package/dist/{contentPreviewDocument-B0nOMpw0.js.map → contentPreviewDocument-C2D0H-Lr.js.map} +1 -1
- package/dist/index.cjs +12 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +144 -7
- package/dist/index.d.ts +144 -7
- package/dist/index.js +11813 -10024
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,962 @@
|
|
|
1
|
+
/*! @license DOMPurify 3.4.15 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.15/LICENSE */
|
|
2
|
+
function je(o, r) {
|
|
3
|
+
(r == null || r > o.length) && (r = o.length);
|
|
4
|
+
for (var s = 0, c = Array(r); s < r; s++) c[s] = o[s];
|
|
5
|
+
return c;
|
|
6
|
+
}
|
|
7
|
+
function Hn(o) {
|
|
8
|
+
if (Array.isArray(o)) return o;
|
|
9
|
+
}
|
|
10
|
+
function Gn(o, r) {
|
|
11
|
+
var s = o == null ? null : typeof Symbol < "u" && o[Symbol.iterator] || o["@@iterator"];
|
|
12
|
+
if (s != null) {
|
|
13
|
+
var c, f, d, E, x = [], R = !0, F = !1;
|
|
14
|
+
try {
|
|
15
|
+
if (d = (s = s.call(o)).next, r !== 0) for (; !(R = (c = d.call(s)).done) && (x.push(c.value), x.length !== r); R = !0) ;
|
|
16
|
+
} catch (z) {
|
|
17
|
+
F = !0, f = z;
|
|
18
|
+
} finally {
|
|
19
|
+
try {
|
|
20
|
+
if (!R && s.return != null && (E = s.return(), Object(E) !== E)) return;
|
|
21
|
+
} finally {
|
|
22
|
+
if (F) throw f;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return x;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function Wn() {
|
|
29
|
+
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
30
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
31
|
+
}
|
|
32
|
+
function Bn(o, r) {
|
|
33
|
+
return Hn(o) || Gn(o, r) || jn(o, r) || Wn();
|
|
34
|
+
}
|
|
35
|
+
function jn(o, r) {
|
|
36
|
+
if (o) {
|
|
37
|
+
if (typeof o == "string") return je(o, r);
|
|
38
|
+
var s = {}.toString.call(o).slice(8, -1);
|
|
39
|
+
return s === "Object" && o.constructor && (s = o.constructor.name), s === "Map" || s === "Set" ? Array.from(o) : s === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s) ? je(o, r) : void 0;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const an = Object.entries, Ye = Object.setPrototypeOf, Yn = Object.isFrozen, $n = Object.getPrototypeOf, Xn = Object.getOwnPropertyDescriptor;
|
|
43
|
+
let b = Object.freeze, S = Object.seal, ct = Object.create, sn = typeof Reflect < "u" && Reflect, se = sn.apply, le = sn.construct;
|
|
44
|
+
b || (b = function(r) {
|
|
45
|
+
return r;
|
|
46
|
+
});
|
|
47
|
+
S || (S = function(r) {
|
|
48
|
+
return r;
|
|
49
|
+
});
|
|
50
|
+
se || (se = function(r, s) {
|
|
51
|
+
for (var c = arguments.length, f = new Array(c > 2 ? c - 2 : 0), d = 2; d < c; d++)
|
|
52
|
+
f[d - 2] = arguments[d];
|
|
53
|
+
return r.apply(s, f);
|
|
54
|
+
});
|
|
55
|
+
le || (le = function(r) {
|
|
56
|
+
for (var s = arguments.length, c = new Array(s > 1 ? s - 1 : 0), f = 1; f < s; f++)
|
|
57
|
+
c[f - 1] = arguments[f];
|
|
58
|
+
return new r(...c);
|
|
59
|
+
});
|
|
60
|
+
const J = y(Array.prototype.forEach), Vn = y(Array.prototype.lastIndexOf), $e = y(Array.prototype.pop), Tt = y(Array.prototype.push), qn = y(Array.prototype.splice), ut = Array.isArray, Et = y(String.prototype.toLowerCase), ee = y(String.prototype.toString), Xe = y(String.prototype.match), _t = y(String.prototype.replace), Ve = y(String.prototype.indexOf), Kn = y(String.prototype.trim), Zn = y(Number.prototype.toString), Jn = y(Boolean.prototype.toString), qe = typeof BigInt > "u" ? null : y(BigInt.prototype.toString), Ke = typeof Symbol > "u" ? null : y(Symbol.prototype.toString), N = y(Object.prototype.hasOwnProperty), gt = y(Object.prototype.toString), O = y(RegExp.prototype.test), Z = Qn(TypeError);
|
|
61
|
+
function y(o) {
|
|
62
|
+
return function(r) {
|
|
63
|
+
r instanceof RegExp && (r.lastIndex = 0);
|
|
64
|
+
for (var s = arguments.length, c = new Array(s > 1 ? s - 1 : 0), f = 1; f < s; f++)
|
|
65
|
+
c[f - 1] = arguments[f];
|
|
66
|
+
return se(o, r, c);
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function Qn(o) {
|
|
70
|
+
return function() {
|
|
71
|
+
for (var r = arguments.length, s = new Array(r), c = 0; c < r; c++)
|
|
72
|
+
s[c] = arguments[c];
|
|
73
|
+
return le(o, s);
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function p(o, r) {
|
|
77
|
+
let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Et;
|
|
78
|
+
if (Ye && Ye(o, null), !ut(r))
|
|
79
|
+
return o;
|
|
80
|
+
let c = r.length;
|
|
81
|
+
for (; c--; ) {
|
|
82
|
+
let f = r[c];
|
|
83
|
+
if (typeof f == "string") {
|
|
84
|
+
const d = s(f);
|
|
85
|
+
d !== f && (Yn(r) || (r[c] = d), f = d);
|
|
86
|
+
}
|
|
87
|
+
o[f] = !0;
|
|
88
|
+
}
|
|
89
|
+
return o;
|
|
90
|
+
}
|
|
91
|
+
function to(o) {
|
|
92
|
+
for (let r = 0; r < o.length; r++)
|
|
93
|
+
N(o, r) || (o[r] = null);
|
|
94
|
+
return o;
|
|
95
|
+
}
|
|
96
|
+
function C(o) {
|
|
97
|
+
const r = ct(null);
|
|
98
|
+
for (const c of an(o)) {
|
|
99
|
+
var s = Bn(c, 2);
|
|
100
|
+
const f = s[0], d = s[1];
|
|
101
|
+
N(o, f) && (ut(d) ? r[f] = to(d) : d && typeof d == "object" && d.constructor === Object ? r[f] = C(d) : r[f] = d);
|
|
102
|
+
}
|
|
103
|
+
return r;
|
|
104
|
+
}
|
|
105
|
+
function eo(o) {
|
|
106
|
+
switch (typeof o) {
|
|
107
|
+
case "string":
|
|
108
|
+
return o;
|
|
109
|
+
case "number":
|
|
110
|
+
return Zn(o);
|
|
111
|
+
case "boolean":
|
|
112
|
+
return Jn(o);
|
|
113
|
+
case "bigint":
|
|
114
|
+
return qe ? qe(o) : "0";
|
|
115
|
+
case "symbol":
|
|
116
|
+
return Ke ? Ke(o) : "Symbol()";
|
|
117
|
+
case "undefined":
|
|
118
|
+
return gt(o);
|
|
119
|
+
case "function":
|
|
120
|
+
case "object": {
|
|
121
|
+
if (o === null)
|
|
122
|
+
return gt(o);
|
|
123
|
+
const r = o, s = P(r, "toString");
|
|
124
|
+
if (typeof s == "function") {
|
|
125
|
+
const c = s(r);
|
|
126
|
+
return typeof c == "string" ? c : gt(c);
|
|
127
|
+
}
|
|
128
|
+
return gt(o);
|
|
129
|
+
}
|
|
130
|
+
default:
|
|
131
|
+
return gt(o);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function P(o, r) {
|
|
135
|
+
for (; o !== null; ) {
|
|
136
|
+
const c = Xn(o, r);
|
|
137
|
+
if (c) {
|
|
138
|
+
if (c.get)
|
|
139
|
+
return y(c.get);
|
|
140
|
+
if (typeof c.value == "function")
|
|
141
|
+
return y(c.value);
|
|
142
|
+
}
|
|
143
|
+
o = $n(o);
|
|
144
|
+
}
|
|
145
|
+
function s() {
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
return s;
|
|
149
|
+
}
|
|
150
|
+
function no(o) {
|
|
151
|
+
try {
|
|
152
|
+
return O(o, ""), !0;
|
|
153
|
+
} catch {
|
|
154
|
+
return !1;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
const Ze = b(["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", "search", "section", "select", "shadow", "slot", "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"]), ne = b(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), oe = b(["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"]), oo = b(["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"]), re = b(["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"]), ro = b(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Je = b(["#text"]), Qe = b(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "command", "commandfor", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "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", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns"]), ie = b(["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", "dominant-baseline", "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", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "pointer-events", "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-orientation", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "vector-effect", "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"]), tn = b(["accent", "accentunder", "align", "bevelled", "close", "columnalign", "columnlines", "columnspacing", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lquote", "lspace", "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"]), Pt = b(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), io = S(/{{[\w\W]*|^[\w\W]*}}/g), ao = S(/<%[\w\W]*|^[\w\W]*%>/g), so = S(/\${[\w\W]*/g), lo = S(/^data-[\-\w.\u00B7-\uFFFF]+$/), co = S(/^aria-[\-\w]+$/), en = S(
|
|
158
|
+
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
159
|
+
// eslint-disable-line no-useless-escape
|
|
160
|
+
), uo = S(/^(?:\w+script|data):/i), fo = S(
|
|
161
|
+
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
162
|
+
// eslint-disable-line no-control-regex
|
|
163
|
+
), po = S(/^html$/i), mo = S(/^[a-z][.\w]*(-[.\w]+)+$/i), nn = S(/<[/\w!]/g), on = S(/<[/\w]/g), ho = S(/<\/no(script|embed|frames)/i), To = S(/\/>/i), M = {
|
|
164
|
+
element: 1,
|
|
165
|
+
attribute: 2,
|
|
166
|
+
text: 3,
|
|
167
|
+
cdataSection: 4,
|
|
168
|
+
entityReference: 5,
|
|
169
|
+
// Deprecated
|
|
170
|
+
entityNode: 6,
|
|
171
|
+
// Deprecated
|
|
172
|
+
processingInstruction: 7,
|
|
173
|
+
comment: 8,
|
|
174
|
+
document: 9,
|
|
175
|
+
documentType: 10,
|
|
176
|
+
documentFragment: 11,
|
|
177
|
+
notation: 12
|
|
178
|
+
// Deprecated
|
|
179
|
+
}, ln = ["style", "script", "xmp", "iframe", "noembed", "noframes", "plaintext", "noscript"], _o = b(p({}, ln)), go = (function() {
|
|
180
|
+
const o = {};
|
|
181
|
+
return J(ln, (r) => {
|
|
182
|
+
o[r] = S(new RegExp("</" + r + "(?=[\\t\\n\\f\\r />])", "i"));
|
|
183
|
+
}), b(o);
|
|
184
|
+
})(), Eo = function() {
|
|
185
|
+
return typeof window > "u" ? null : window;
|
|
186
|
+
}, Ao = function(r, s) {
|
|
187
|
+
if (typeof r != "object" || typeof r.createPolicy != "function")
|
|
188
|
+
return null;
|
|
189
|
+
let c = null;
|
|
190
|
+
const f = "data-tt-policy-suffix";
|
|
191
|
+
s && s.hasAttribute(f) && (c = s.getAttribute(f));
|
|
192
|
+
const d = "dompurify" + (c ? "#" + c : "");
|
|
193
|
+
try {
|
|
194
|
+
return r.createPolicy(d, {
|
|
195
|
+
createHTML(E) {
|
|
196
|
+
return E;
|
|
197
|
+
},
|
|
198
|
+
createScriptURL(E) {
|
|
199
|
+
return E;
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
} catch {
|
|
203
|
+
return console.warn("TrustedTypes policy " + d + " could not be created."), null;
|
|
204
|
+
}
|
|
205
|
+
}, rn = function() {
|
|
206
|
+
return {
|
|
207
|
+
afterSanitizeAttributes: [],
|
|
208
|
+
afterSanitizeElements: [],
|
|
209
|
+
afterSanitizeShadowDOM: [],
|
|
210
|
+
beforeSanitizeAttributes: [],
|
|
211
|
+
beforeSanitizeElements: [],
|
|
212
|
+
beforeSanitizeShadowDOM: [],
|
|
213
|
+
uponSanitizeAttribute: [],
|
|
214
|
+
uponSanitizeElement: [],
|
|
215
|
+
uponSanitizeShadowNode: []
|
|
216
|
+
};
|
|
217
|
+
}, Y = function(r, s, c, f) {
|
|
218
|
+
return N(r, s) && ut(r[s]) ? p(f.base ? C(f.base) : {}, r[s], f.transform) : c;
|
|
219
|
+
}, ae = function(r, s, c) {
|
|
220
|
+
const f = N(r, s) ? r[s] : void 0;
|
|
221
|
+
return f && typeof f == "object" ? C(f) : c();
|
|
222
|
+
};
|
|
223
|
+
function cn() {
|
|
224
|
+
let o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Eo();
|
|
225
|
+
const r = (i) => cn(i);
|
|
226
|
+
if (r.version = "3.4.15", r.removed = [], !o || !o.document || o.document.nodeType !== M.document || !o.Element)
|
|
227
|
+
return r.isSupported = !1, r;
|
|
228
|
+
let s = o.document;
|
|
229
|
+
const c = s, f = c.currentScript;
|
|
230
|
+
o.DocumentFragment;
|
|
231
|
+
const d = o.HTMLTemplateElement, E = o.Node, x = o.Element, R = o.NodeFilter, F = o.NamedNodeMap;
|
|
232
|
+
F === void 0 && (o.NamedNodeMap || o.MozNamedAttrMap), o.HTMLFormElement;
|
|
233
|
+
const z = o.DOMParser, H = o.trustedTypes, G = x.prototype, un = P(G, "cloneNode"), vt = P(G, "remove"), ce = P(G, "removeAttributeNode"), fn = P(G, "nextSibling"), Q = P(G, "childNodes"), tt = P(G, "parentNode"), ue = P(G, "shadowRoot"), kt = P(G, "attributes"), $ = E && E.prototype ? P(E.prototype, "nodeType") : null, et = E && E.prototype ? P(E.prototype, "nodeName") : null, At = E && E.prototype ? P(E.prototype, "ownerDocument") : null, ft = function(t) {
|
|
234
|
+
return $ ? $(t) : t.nodeType;
|
|
235
|
+
}, Ut = function(t) {
|
|
236
|
+
return et ? et(t) : t.nodeName;
|
|
237
|
+
};
|
|
238
|
+
if (typeof d == "function") {
|
|
239
|
+
const i = s.createElement("template");
|
|
240
|
+
i.content && i.content.ownerDocument && (s = i.content.ownerDocument);
|
|
241
|
+
}
|
|
242
|
+
let D, X = "", Ft, fe = !1, pt = 0;
|
|
243
|
+
const pe = function() {
|
|
244
|
+
if (pt > 0)
|
|
245
|
+
throw Z('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.');
|
|
246
|
+
}, nt = function(t) {
|
|
247
|
+
pe(), pt++;
|
|
248
|
+
try {
|
|
249
|
+
return D.createHTML(t);
|
|
250
|
+
} finally {
|
|
251
|
+
pt--;
|
|
252
|
+
}
|
|
253
|
+
}, pn = function(t) {
|
|
254
|
+
pe(), pt++;
|
|
255
|
+
try {
|
|
256
|
+
return D.createScriptURL(t);
|
|
257
|
+
} finally {
|
|
258
|
+
pt--;
|
|
259
|
+
}
|
|
260
|
+
}, mn = function() {
|
|
261
|
+
return fe || (Ft = Ao(H, f), fe = !0), Ft;
|
|
262
|
+
}, yt = s, zt = yt.implementation, me = yt.createNodeIterator, dn = yt.createDocumentFragment, hn = yt.getElementsByTagName, Tn = c.importNode;
|
|
263
|
+
let h = rn();
|
|
264
|
+
r.isSupported = typeof an == "function" && typeof tt == "function" && zt && zt.createHTMLDocument !== void 0;
|
|
265
|
+
const _n = io, gn = ao, En = so, An = lo, yn = co, bn = uo, de = fo, Sn = mo;
|
|
266
|
+
let he = en, T = null;
|
|
267
|
+
const Ht = p({}, [...Ze, ...ne, ...oe, ...re, ...Je]);
|
|
268
|
+
let _ = null;
|
|
269
|
+
const Gt = p({}, [...Qe, ...ie, ...tn, ...Pt]);
|
|
270
|
+
let v = Object.seal(ct(null, {
|
|
271
|
+
tagNameCheck: {
|
|
272
|
+
writable: !0,
|
|
273
|
+
configurable: !1,
|
|
274
|
+
enumerable: !0,
|
|
275
|
+
value: null
|
|
276
|
+
},
|
|
277
|
+
attributeNameCheck: {
|
|
278
|
+
writable: !0,
|
|
279
|
+
configurable: !1,
|
|
280
|
+
enumerable: !0,
|
|
281
|
+
value: null
|
|
282
|
+
},
|
|
283
|
+
allowCustomizedBuiltInElements: {
|
|
284
|
+
writable: !0,
|
|
285
|
+
configurable: !1,
|
|
286
|
+
enumerable: !0,
|
|
287
|
+
value: !1
|
|
288
|
+
}
|
|
289
|
+
})), mt = null, Te = null;
|
|
290
|
+
const W = Object.seal(ct(null, {
|
|
291
|
+
tagCheck: {
|
|
292
|
+
writable: !0,
|
|
293
|
+
configurable: !1,
|
|
294
|
+
enumerable: !0,
|
|
295
|
+
value: null
|
|
296
|
+
},
|
|
297
|
+
attributeCheck: {
|
|
298
|
+
writable: !0,
|
|
299
|
+
configurable: !1,
|
|
300
|
+
enumerable: !0,
|
|
301
|
+
value: null
|
|
302
|
+
}
|
|
303
|
+
}));
|
|
304
|
+
let _e = !0, Wt = !0, ge = !1, Ee = !0, B = !1, V = !0, q = !1, Bt = !1, bt = null, St = null, jt = !1, ot = !1, Ot = !1, Rt = !1, Ae = !0, ye = !1;
|
|
305
|
+
const be = "user-content-";
|
|
306
|
+
let Yt = !0, $t = !1, rt = {}, it = null;
|
|
307
|
+
const Se = p({}, [
|
|
308
|
+
"annotation-xml",
|
|
309
|
+
"audio",
|
|
310
|
+
"colgroup",
|
|
311
|
+
"desc",
|
|
312
|
+
"foreignobject",
|
|
313
|
+
"head",
|
|
314
|
+
"iframe",
|
|
315
|
+
"math",
|
|
316
|
+
"mi",
|
|
317
|
+
"mn",
|
|
318
|
+
"mo",
|
|
319
|
+
"ms",
|
|
320
|
+
"mtext",
|
|
321
|
+
"noembed",
|
|
322
|
+
"noframes",
|
|
323
|
+
"noscript",
|
|
324
|
+
"plaintext",
|
|
325
|
+
"script",
|
|
326
|
+
// <selectedcontent> mirrors the selected <option>'s subtree, cloned by
|
|
327
|
+
// the UA (customizable <select>) — including any on* handlers — and the
|
|
328
|
+
// engine re-mirrors synchronously whenever a removal changes which
|
|
329
|
+
// option/selectedcontent is current, even inside DOMPurify's inert
|
|
330
|
+
// DOMParser document. Hoisting its children on removal re-inserts a fresh
|
|
331
|
+
// mirror target ahead of the walk, which the engine refills, looping
|
|
332
|
+
// forever (DoS) and amplifying output. Dropping its content on removal
|
|
333
|
+
// (rather than hoisting) breaks that cascade; the content is a duplicate
|
|
334
|
+
// of the option, which is sanitized on its own. See campaign-3 F1/F6.
|
|
335
|
+
"selectedcontent",
|
|
336
|
+
"style",
|
|
337
|
+
"svg",
|
|
338
|
+
"template",
|
|
339
|
+
"thead",
|
|
340
|
+
"title",
|
|
341
|
+
"video",
|
|
342
|
+
"xmp"
|
|
343
|
+
]);
|
|
344
|
+
let Oe = null;
|
|
345
|
+
const Re = p({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
346
|
+
let we = null;
|
|
347
|
+
const De = p({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), wt = "http://www.w3.org/1998/Math/MathML", Dt = "http://www.w3.org/2000/svg", k = "http://www.w3.org/1999/xhtml";
|
|
348
|
+
let at = k, Xt = !1, Vt = null;
|
|
349
|
+
const On = p({}, [wt, Dt, k], ee), Le = b(["mi", "mo", "mn", "ms", "mtext"]);
|
|
350
|
+
let qt = p({}, Le);
|
|
351
|
+
const Ie = b(["annotation-xml"]);
|
|
352
|
+
let Kt = p({}, Ie);
|
|
353
|
+
const Rn = p({}, ["title", "style", "font", "a", "script"]);
|
|
354
|
+
let dt = null;
|
|
355
|
+
const wn = ["application/xhtml+xml", "text/html"], Dn = "text/html";
|
|
356
|
+
let A = null, st = null;
|
|
357
|
+
const Ln = s.createElement("form"), Ne = function(t) {
|
|
358
|
+
return t instanceof RegExp || t instanceof Function;
|
|
359
|
+
}, Zt = function() {
|
|
360
|
+
let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
361
|
+
if (st && st === t)
|
|
362
|
+
return;
|
|
363
|
+
(!t || typeof t != "object") && (t = {}), t = C(t), dt = // eslint-disable-next-line unicorn/prefer-includes
|
|
364
|
+
wn.indexOf(t.PARSER_MEDIA_TYPE) === -1 ? Dn : t.PARSER_MEDIA_TYPE, A = dt === "application/xhtml+xml" ? ee : Et, T = Y(t, "ALLOWED_TAGS", Ht, {
|
|
365
|
+
transform: A
|
|
366
|
+
}), _ = Y(t, "ALLOWED_ATTR", Gt, {
|
|
367
|
+
transform: A
|
|
368
|
+
}), Vt = Y(t, "ALLOWED_NAMESPACES", On, {
|
|
369
|
+
transform: ee
|
|
370
|
+
}), we = Y(t, "ADD_URI_SAFE_ATTR", De, {
|
|
371
|
+
transform: A,
|
|
372
|
+
base: De
|
|
373
|
+
}), Oe = Y(t, "ADD_DATA_URI_TAGS", Re, {
|
|
374
|
+
transform: A,
|
|
375
|
+
base: Re
|
|
376
|
+
}), it = Y(t, "FORBID_CONTENTS", Se, {
|
|
377
|
+
transform: A
|
|
378
|
+
}), mt = Y(t, "FORBID_TAGS", C({}), {
|
|
379
|
+
transform: A
|
|
380
|
+
}), Te = Y(t, "FORBID_ATTR", C({}), {
|
|
381
|
+
transform: A
|
|
382
|
+
}), rt = N(t, "USE_PROFILES") ? t.USE_PROFILES && typeof t.USE_PROFILES == "object" ? C(t.USE_PROFILES) : t.USE_PROFILES : !1, _e = t.ALLOW_ARIA_ATTR !== !1, Wt = t.ALLOW_DATA_ATTR !== !1, ge = t.ALLOW_UNKNOWN_PROTOCOLS || !1, Ee = t.ALLOW_SELF_CLOSE_IN_ATTR !== !1, B = t.SAFE_FOR_TEMPLATES || !1, V = t.SAFE_FOR_XML !== !1, q = t.WHOLE_DOCUMENT || !1, ot = t.RETURN_DOM || !1, Ot = t.RETURN_DOM_FRAGMENT || !1, Rt = t.RETURN_TRUSTED_TYPE || !1, jt = t.FORCE_BODY || !1, Ae = t.SANITIZE_DOM !== !1, ye = t.SANITIZE_NAMED_PROPS || !1, Yt = t.KEEP_CONTENT !== !1, $t = t.IN_PLACE || !1, he = no(t.ALLOWED_URI_REGEXP) ? t.ALLOWED_URI_REGEXP : en, at = typeof t.NAMESPACE == "string" ? t.NAMESPACE : k, qt = ae(
|
|
383
|
+
t,
|
|
384
|
+
"MATHML_TEXT_INTEGRATION_POINTS",
|
|
385
|
+
() => p({}, Le)
|
|
386
|
+
// Default built-in map
|
|
387
|
+
), Kt = ae(
|
|
388
|
+
t,
|
|
389
|
+
"HTML_INTEGRATION_POINTS",
|
|
390
|
+
() => p({}, Ie)
|
|
391
|
+
// Default built-in map
|
|
392
|
+
);
|
|
393
|
+
const e = ae(t, "CUSTOM_ELEMENT_HANDLING", () => ct(null));
|
|
394
|
+
if (v = ct(null), N(e, "tagNameCheck") && Ne(e.tagNameCheck) && (v.tagNameCheck = e.tagNameCheck), N(e, "attributeNameCheck") && Ne(e.attributeNameCheck) && (v.attributeNameCheck = e.attributeNameCheck), N(e, "allowCustomizedBuiltInElements") && typeof e.allowCustomizedBuiltInElements == "boolean" && (v.allowCustomizedBuiltInElements = e.allowCustomizedBuiltInElements), S(v), B && (Wt = !1), Ot && (ot = !0), rt && (T = p({}, Je), _ = ct(null), rt.html === !0 && (p(T, Ze), p(_, Qe)), rt.svg === !0 && (p(T, ne), p(_, ie), p(_, Pt)), rt.svgFilters === !0 && (p(T, oe), p(_, ie), p(_, Pt)), rt.mathMl === !0 && (p(T, re), p(_, tn), p(_, Pt))), W.tagCheck = null, W.attributeCheck = null, N(t, "ADD_TAGS") && (typeof t.ADD_TAGS == "function" ? W.tagCheck = t.ADD_TAGS : ut(t.ADD_TAGS) && (T === Ht && (T = C(T)), p(T, t.ADD_TAGS, A))), N(t, "ADD_ATTR") && (typeof t.ADD_ATTR == "function" ? W.attributeCheck = t.ADD_ATTR : ut(t.ADD_ATTR) && (_ === Gt && (_ = C(_)), p(_, t.ADD_ATTR, A))), N(t, "ADD_FORBID_CONTENTS") && ut(t.ADD_FORBID_CONTENTS) && (it === Se && (it = C(it)), p(it, t.ADD_FORBID_CONTENTS, A)), Yt && (T["#text"] = !0), q && p(T, ["html", "head", "body"]), T.table && (p(T, ["tbody"]), delete mt.tbody), t.TRUSTED_TYPES_POLICY) {
|
|
395
|
+
if (typeof t.TRUSTED_TYPES_POLICY.createHTML != "function")
|
|
396
|
+
throw Z('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
397
|
+
if (typeof t.TRUSTED_TYPES_POLICY.createScriptURL != "function")
|
|
398
|
+
throw Z('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
399
|
+
const n = D;
|
|
400
|
+
D = t.TRUSTED_TYPES_POLICY;
|
|
401
|
+
try {
|
|
402
|
+
X = nt("");
|
|
403
|
+
} catch (a) {
|
|
404
|
+
throw D = n, a;
|
|
405
|
+
}
|
|
406
|
+
} else t.TRUSTED_TYPES_POLICY === null ? (D = void 0, X = "") : (D === void 0 && (D = mn()), D && typeof X == "string" && (X = nt("")));
|
|
407
|
+
b && b(t), st = t;
|
|
408
|
+
}, Me = p({}, [...ne, ...oe, ...oo]), Ce = p({}, [...re, ...ro]), In = function(t, e, n) {
|
|
409
|
+
return e.namespaceURI === k ? t === "svg" : e.namespaceURI === wt ? t === "svg" && (n === "annotation-xml" || qt[n]) : !!Me[t];
|
|
410
|
+
}, Nn = function(t, e, n) {
|
|
411
|
+
return e.namespaceURI === k ? t === "math" : e.namespaceURI === Dt ? t === "math" && Kt[n] : !!Ce[t];
|
|
412
|
+
}, Mn = function(t, e, n) {
|
|
413
|
+
return e.namespaceURI === Dt && !Kt[n] || e.namespaceURI === wt && !qt[n] ? !1 : !Ce[t] && (Rn[t] || !Me[t]);
|
|
414
|
+
}, Cn = function(t) {
|
|
415
|
+
let e = tt(t);
|
|
416
|
+
(!e || !e.tagName) && (e = {
|
|
417
|
+
namespaceURI: at,
|
|
418
|
+
tagName: "template"
|
|
419
|
+
});
|
|
420
|
+
const n = Et(t.tagName), a = Et(e.tagName);
|
|
421
|
+
return Vt[t.namespaceURI] ? t.namespaceURI === Dt ? In(n, e, a) : t.namespaceURI === wt ? Nn(n, e, a) : t.namespaceURI === k ? Mn(n, e, a) : !!(dt === "application/xhtml+xml" && Vt[t.namespaceURI]) : !1;
|
|
422
|
+
}, j = function(t) {
|
|
423
|
+
Tt(r.removed, {
|
|
424
|
+
element: t
|
|
425
|
+
});
|
|
426
|
+
try {
|
|
427
|
+
tt(t).removeChild(t);
|
|
428
|
+
} catch {
|
|
429
|
+
if (vt(t), !tt(t))
|
|
430
|
+
throw Z("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
|
|
431
|
+
}
|
|
432
|
+
}, xe = function(t, e, n) {
|
|
433
|
+
try {
|
|
434
|
+
ce(t, e);
|
|
435
|
+
} catch {
|
|
436
|
+
try {
|
|
437
|
+
t.removeAttribute(n);
|
|
438
|
+
} catch {
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}, Lt = function(t) {
|
|
442
|
+
It(t);
|
|
443
|
+
const e = Q(t);
|
|
444
|
+
if (e) {
|
|
445
|
+
const a = [];
|
|
446
|
+
J(e, (l) => {
|
|
447
|
+
Tt(a, l);
|
|
448
|
+
}), J(a, (l) => {
|
|
449
|
+
try {
|
|
450
|
+
vt(l);
|
|
451
|
+
} catch {
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
const n = kt(t);
|
|
456
|
+
if (n)
|
|
457
|
+
for (let a = n.length - 1; a >= 0; --a) {
|
|
458
|
+
const l = n[a], u = l && l.name;
|
|
459
|
+
typeof u == "string" && xe(t, l, u);
|
|
460
|
+
}
|
|
461
|
+
}, K = function(t, e, n) {
|
|
462
|
+
if (!n)
|
|
463
|
+
try {
|
|
464
|
+
n = e.getAttributeNode(t);
|
|
465
|
+
} catch {
|
|
466
|
+
n = null;
|
|
467
|
+
}
|
|
468
|
+
Tt(r.removed, {
|
|
469
|
+
attribute: n || null,
|
|
470
|
+
from: e
|
|
471
|
+
});
|
|
472
|
+
try {
|
|
473
|
+
n ? ce(e, n) : e.removeAttribute(t);
|
|
474
|
+
} catch {
|
|
475
|
+
try {
|
|
476
|
+
e.removeAttribute(t);
|
|
477
|
+
} catch {
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
if (t === "is")
|
|
481
|
+
if (ot || Ot)
|
|
482
|
+
try {
|
|
483
|
+
j(e);
|
|
484
|
+
} catch {
|
|
485
|
+
}
|
|
486
|
+
else
|
|
487
|
+
try {
|
|
488
|
+
e.setAttribute(t, "");
|
|
489
|
+
} catch {
|
|
490
|
+
}
|
|
491
|
+
}, xn = function(t) {
|
|
492
|
+
const e = kt(t);
|
|
493
|
+
if (e)
|
|
494
|
+
for (let n = e.length - 1; n >= 0; --n) {
|
|
495
|
+
const a = e[n], l = a && a.name;
|
|
496
|
+
typeof l != "string" || _[A(l)] || xe(t, a, l);
|
|
497
|
+
}
|
|
498
|
+
}, It = function(t) {
|
|
499
|
+
const e = [t];
|
|
500
|
+
for (; e.length > 0; ) {
|
|
501
|
+
const n = e.pop();
|
|
502
|
+
ft(n) === M.element && xn(n);
|
|
503
|
+
const l = Q(n);
|
|
504
|
+
if (l)
|
|
505
|
+
for (let u = l.length - 1; u >= 0; --u)
|
|
506
|
+
e.push(l[u]);
|
|
507
|
+
}
|
|
508
|
+
}, Pe = function(t, e) {
|
|
509
|
+
return V ? t === "patchsrc" ? !0 : t === "for" && e !== "label" && e !== "output" : !1;
|
|
510
|
+
}, Pn = function(t) {
|
|
511
|
+
if (!V)
|
|
512
|
+
return;
|
|
513
|
+
const e = [t];
|
|
514
|
+
for (; e.length > 0; ) {
|
|
515
|
+
const n = e.pop(), a = ft(n);
|
|
516
|
+
if (a === M.processingInstruction || a === M.comment && O(on, n.data)) {
|
|
517
|
+
try {
|
|
518
|
+
vt(n);
|
|
519
|
+
} catch {
|
|
520
|
+
}
|
|
521
|
+
continue;
|
|
522
|
+
}
|
|
523
|
+
if (a === M.element) {
|
|
524
|
+
const u = n, m = A(Ut(n));
|
|
525
|
+
try {
|
|
526
|
+
u.hasAttribute && u.hasAttribute("patchsrc") && u.removeAttribute("patchsrc"), u.hasAttribute && u.hasAttribute("for") && Pe("for", m) && u.removeAttribute("for");
|
|
527
|
+
} catch {
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
const l = Q(n);
|
|
531
|
+
if (l)
|
|
532
|
+
for (let u = l.length - 1; u >= 0; --u)
|
|
533
|
+
e.push(l[u]);
|
|
534
|
+
}
|
|
535
|
+
}, ve = function(t) {
|
|
536
|
+
let e = null, n = null;
|
|
537
|
+
if (jt)
|
|
538
|
+
t = "<remove></remove>" + t;
|
|
539
|
+
else {
|
|
540
|
+
const u = Xe(t, /^[\r\n\t ]+/);
|
|
541
|
+
n = u && u[0];
|
|
542
|
+
}
|
|
543
|
+
dt === "application/xhtml+xml" && at === k && (t = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + t + "</body></html>");
|
|
544
|
+
const a = D ? nt(t) : t;
|
|
545
|
+
if (at === k)
|
|
546
|
+
try {
|
|
547
|
+
e = new z().parseFromString(a, dt);
|
|
548
|
+
} catch {
|
|
549
|
+
}
|
|
550
|
+
if (!e || !e.documentElement) {
|
|
551
|
+
e = zt.createDocument(at, "template", null);
|
|
552
|
+
try {
|
|
553
|
+
e.documentElement.innerHTML = Xt ? X : a;
|
|
554
|
+
} catch {
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
const l = e.body || e.documentElement;
|
|
558
|
+
return t && n && l.insertBefore(s.createTextNode(n), l.childNodes[0] || null), at === k ? hn.call(e, q ? "html" : "body")[0] : q ? e.documentElement : l;
|
|
559
|
+
}, ke = function(t) {
|
|
560
|
+
const e = At ? At(t) : t.ownerDocument;
|
|
561
|
+
return me.call(
|
|
562
|
+
e || t,
|
|
563
|
+
t,
|
|
564
|
+
// eslint-disable-next-line no-bitwise
|
|
565
|
+
R.SHOW_ELEMENT | R.SHOW_COMMENT | R.SHOW_TEXT | R.SHOW_PROCESSING_INSTRUCTION | R.SHOW_CDATA_SECTION,
|
|
566
|
+
null
|
|
567
|
+
);
|
|
568
|
+
}, Nt = function(t) {
|
|
569
|
+
return t = _t(t, _n, " "), t = _t(t, gn, " "), t = _t(t, En, " "), t;
|
|
570
|
+
}, Jt = function(t) {
|
|
571
|
+
var e;
|
|
572
|
+
t.normalize();
|
|
573
|
+
const n = At ? At(t) : t.ownerDocument, a = me.call(
|
|
574
|
+
n || t,
|
|
575
|
+
t,
|
|
576
|
+
// eslint-disable-next-line no-bitwise
|
|
577
|
+
R.SHOW_TEXT | R.SHOW_COMMENT | R.SHOW_CDATA_SECTION | R.SHOW_PROCESSING_INSTRUCTION,
|
|
578
|
+
null
|
|
579
|
+
);
|
|
580
|
+
let l = a.nextNode();
|
|
581
|
+
for (; l; )
|
|
582
|
+
l.data = Nt(l.data), l = a.nextNode();
|
|
583
|
+
const u = (e = t.querySelectorAll) === null || e === void 0 ? void 0 : e.call(t, "template");
|
|
584
|
+
u && J(u, (m) => {
|
|
585
|
+
lt(m.content) && Jt(m.content);
|
|
586
|
+
});
|
|
587
|
+
}, Mt = function(t) {
|
|
588
|
+
const e = et ? et(t) : null;
|
|
589
|
+
return typeof e != "string" || A(e) !== "form" ? !1 : typeof t.nodeName != "string" || typeof t.textContent != "string" || typeof t.removeChild != "function" || // Realm-safe NamedNodeMap detection: equality against the cached
|
|
590
|
+
// prototype getter. Clobbered .attributes (e.g. <input name="attributes">)
|
|
591
|
+
// makes the direct read diverge from the cached read; a clean form
|
|
592
|
+
// (same-realm OR foreign-realm) has both reads pointing at the same
|
|
593
|
+
// canonical NamedNodeMap.
|
|
594
|
+
t.attributes !== kt(t) || typeof t.removeAttribute != "function" || // A form descendant named "removeAttributeNode" or "getAttributeNode"
|
|
595
|
+
// shadows these Attr-node methods via [LegacyOverrideBuiltIns].
|
|
596
|
+
// _removeAttribute() / _stripAttributeNode() reach for
|
|
597
|
+
// element.removeAttributeNode(attr) first; when it is shadowed the call
|
|
598
|
+
// throws and the name-based fallback element.removeAttribute(name)
|
|
599
|
+
// ASCII-lowercases its lookup key in an HTML document, silently missing
|
|
600
|
+
// a case-preserved event-handler attribute (e.g. an ONANIMATIONSTART
|
|
601
|
+
// that reached the sanitizer through an XML/XHTML parse). Flag the form
|
|
602
|
+
// so it is removed wholesale, exactly as for the other shadowed methods.
|
|
603
|
+
typeof t.removeAttributeNode != "function" || typeof t.getAttributeNode != "function" || typeof t.setAttribute != "function" || typeof t.namespaceURI != "string" || typeof t.insertBefore != "function" || typeof t.hasChildNodes != "function" || // NodeType clobbering probe. Cached Node.prototype.nodeType getter
|
|
604
|
+
// returns the integer 1 for any Element regardless of realm; direct
|
|
605
|
+
// read on a clobbered form (e.g. <input name="nodeType">) returns
|
|
606
|
+
// the named child element. Cheap addition — nodeType is read from
|
|
607
|
+
// an internal slot, no serialization cost — and removes a residual
|
|
608
|
+
// clobbering surface used by several mXSS / PI / comment branches
|
|
609
|
+
// in _sanitizeElements that compare currentNode.nodeType directly.
|
|
610
|
+
t.nodeType !== $(t) || // HTMLFormElement has [LegacyOverrideBuiltIns]: a descendant named
|
|
611
|
+
// "childNodes" shadows the prototype getter. Direct reads of
|
|
612
|
+
// form.childNodes from a clobbered form return the named child
|
|
613
|
+
// instead of the real NodeList, so any walk that reads it directly
|
|
614
|
+
// skips the form's real children. Compare the direct read to the
|
|
615
|
+
// cached Node.prototype getter — when the form's named-property
|
|
616
|
+
// getter intercepts the read, the two values differ and we flag
|
|
617
|
+
// the form. This catches every clobbering child type (input,
|
|
618
|
+
// select, etc.) regardless of whether the named child happens to
|
|
619
|
+
// carry a numeric .length, which a typeof-based probe would miss
|
|
620
|
+
// (e.g. HTMLSelectElement.length is a defined unsigned-long).
|
|
621
|
+
t.childNodes !== Q(t);
|
|
622
|
+
}, lt = function(t) {
|
|
623
|
+
if (!$ || typeof t != "object" || t === null)
|
|
624
|
+
return !1;
|
|
625
|
+
try {
|
|
626
|
+
return $(t) === M.documentFragment;
|
|
627
|
+
} catch {
|
|
628
|
+
return !1;
|
|
629
|
+
}
|
|
630
|
+
}, ht = function(t) {
|
|
631
|
+
if (!$ || typeof t != "object" || t === null)
|
|
632
|
+
return !1;
|
|
633
|
+
try {
|
|
634
|
+
return typeof $(t) == "number";
|
|
635
|
+
} catch {
|
|
636
|
+
return !1;
|
|
637
|
+
}
|
|
638
|
+
};
|
|
639
|
+
function U(i, t, e) {
|
|
640
|
+
i.length !== 0 && J(i, (n) => {
|
|
641
|
+
n.call(r, t, e, st);
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
const vn = function(t, e) {
|
|
645
|
+
return !!(V && t.hasChildNodes() && !ht(t.firstElementChild) && O(nn, t.textContent) && O(nn, t.innerHTML) || V && t.namespaceURI === k && _o[e] && (ht(t.firstElementChild) || typeof t.textContent == "string" && O(go[e], t.textContent)) || t.nodeType === M.processingInstruction || V && t.nodeType === M.comment && O(on, t.data));
|
|
646
|
+
}, Ct = function(t, e) {
|
|
647
|
+
if (t instanceof RegExp)
|
|
648
|
+
return O(t, e);
|
|
649
|
+
if (t instanceof Function) {
|
|
650
|
+
for (var n = arguments.length, a = new Array(n > 2 ? n - 2 : 0), l = 2; l < n; l++)
|
|
651
|
+
a[l - 2] = arguments[l];
|
|
652
|
+
return !!t(e, ...a);
|
|
653
|
+
}
|
|
654
|
+
return !1;
|
|
655
|
+
}, kn = function(t, e, n) {
|
|
656
|
+
if (!mt[e] && Ge(e) && Ct(v.tagNameCheck, e))
|
|
657
|
+
return !1;
|
|
658
|
+
if (Yt && !it[e]) {
|
|
659
|
+
const a = tt(t), l = Q(t);
|
|
660
|
+
if (l && a) {
|
|
661
|
+
const u = l.length;
|
|
662
|
+
for (let m = u - 1; m >= 0; --m) {
|
|
663
|
+
const g = t === n ? un(l[m], !0) : l[m];
|
|
664
|
+
a.insertBefore(g, fn(t));
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
return j(t), !0;
|
|
669
|
+
}, Ue = function(t, e, n, a) {
|
|
670
|
+
return t.length === 0 ? e : e === n || e === a ? C(e) : e;
|
|
671
|
+
}, Fe = function(t, e) {
|
|
672
|
+
return t === e || tt(t) !== null ? !1 : ($t && It(t), !0);
|
|
673
|
+
}, ze = function(t, e) {
|
|
674
|
+
if (U(h.beforeSanitizeElements, t, null), Fe(t, e))
|
|
675
|
+
return !0;
|
|
676
|
+
if (Mt(t))
|
|
677
|
+
return j(t), !0;
|
|
678
|
+
const n = A(Ut(t));
|
|
679
|
+
if (T = Ue(h.uponSanitizeElement, T, Ht, bt), U(h.uponSanitizeElement, t, {
|
|
680
|
+
tagName: n,
|
|
681
|
+
allowedTags: T
|
|
682
|
+
}), Fe(t, e))
|
|
683
|
+
return !0;
|
|
684
|
+
if (vn(t, n))
|
|
685
|
+
return j(t), !0;
|
|
686
|
+
if (mt[n] || !(W.tagCheck instanceof Function && W.tagCheck(n)) && !T[n]) {
|
|
687
|
+
const l = kn(t, n, e);
|
|
688
|
+
return l === !1 && U(h.afterSanitizeElements, t, null), l;
|
|
689
|
+
}
|
|
690
|
+
if (ft(t) === M.element && !Cn(t) || (n === "noscript" || n === "noembed" || n === "noframes") && O(ho, t.innerHTML))
|
|
691
|
+
return j(t), !0;
|
|
692
|
+
if (B && t.nodeType === M.text) {
|
|
693
|
+
const l = Nt(t.textContent);
|
|
694
|
+
t.textContent !== l && (Tt(r.removed, {
|
|
695
|
+
element: t.cloneNode()
|
|
696
|
+
}), t.textContent = l);
|
|
697
|
+
}
|
|
698
|
+
return U(h.afterSanitizeElements, t, null), !1;
|
|
699
|
+
}, He = function(t, e, n) {
|
|
700
|
+
if (Te[e] || Pe(e, t) || Ae && (e === "id" || e === "name") && (n in s || n in Ln))
|
|
701
|
+
return !1;
|
|
702
|
+
const a = _[e] || W.attributeCheck instanceof Function && W.attributeCheck(e, t);
|
|
703
|
+
return Wt && O(An, e) || _e && O(yn, e) ? !0 : a ? we[e] || O(he, _t(n, de, "")) || (e === "src" || e === "xlink:href" || e === "href") && t !== "script" && Ve(n, "data:") === 0 && Oe[t] || ge && !O(bn, _t(n, de, "")) ? !0 : !n : (
|
|
704
|
+
// Condition a) covers a basically valid custom element tag name whose
|
|
705
|
+
// tag passes the configured tagNameCheck and whose attribute name
|
|
706
|
+
// passes the configured attributeNameCheck ...
|
|
707
|
+
Ge(t) && Ct(v.tagNameCheck, t) && Ct(v.attributeNameCheck, e, t) || // Condition b) covers an `is` attribute whose value passes the
|
|
708
|
+
// configured tagNameCheck while customized built-in elements are
|
|
709
|
+
// allowed.
|
|
710
|
+
e === "is" && v.allowCustomizedBuiltInElements && Ct(v.tagNameCheck, n)
|
|
711
|
+
);
|
|
712
|
+
}, Un = p({}, ["annotation-xml", "color-profile", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "missing-glyph"]), Ge = function(t) {
|
|
713
|
+
return !Un[Et(t)] && O(Sn, t);
|
|
714
|
+
}, Fn = function(t, e, n, a) {
|
|
715
|
+
if (D && typeof H == "object" && typeof H.getAttributeType == "function" && !n)
|
|
716
|
+
switch (H.getAttributeType(t, e)) {
|
|
717
|
+
case "TrustedHTML":
|
|
718
|
+
return nt(a);
|
|
719
|
+
case "TrustedScriptURL":
|
|
720
|
+
return pn(a);
|
|
721
|
+
}
|
|
722
|
+
return a;
|
|
723
|
+
}, zn = function(t, e, n, a) {
|
|
724
|
+
try {
|
|
725
|
+
return n ? t.setAttributeNS(n, e, a) : t.setAttribute(e, a), Mt(t) ? (j(t), !1) : !0;
|
|
726
|
+
} catch {
|
|
727
|
+
return K(e, t), !1;
|
|
728
|
+
}
|
|
729
|
+
}, We = function(t) {
|
|
730
|
+
U(h.beforeSanitizeAttributes, t, null);
|
|
731
|
+
const e = t.attributes;
|
|
732
|
+
if (!e || Mt(t))
|
|
733
|
+
return;
|
|
734
|
+
_ = Ue(h.uponSanitizeAttribute, _, Gt, St);
|
|
735
|
+
const n = {
|
|
736
|
+
attrName: "",
|
|
737
|
+
attrValue: "",
|
|
738
|
+
keepAttr: !0,
|
|
739
|
+
allowedAttributes: _,
|
|
740
|
+
forceKeepAttr: void 0
|
|
741
|
+
};
|
|
742
|
+
let a = e.length;
|
|
743
|
+
const l = A(t.nodeName);
|
|
744
|
+
for (; a--; ) {
|
|
745
|
+
const u = e[a], m = u.name, g = u.namespaceURI, L = u.value, I = A(m), te = L;
|
|
746
|
+
let w = m === "value" ? te : Kn(te), Be = !1;
|
|
747
|
+
if (n.attrName = I, n.attrValue = w, n.keepAttr = !0, n.forceKeepAttr = void 0, U(h.uponSanitizeAttribute, t, n), w = n.attrValue, ye && (I === "id" || I === "name") && Ve(w, be) !== 0 && (K(m, t, u), w = be + w, Be = !0), V && O(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, w)) {
|
|
748
|
+
K(m, t, u);
|
|
749
|
+
continue;
|
|
750
|
+
}
|
|
751
|
+
if (I === "attributename" && Xe(w, "href")) {
|
|
752
|
+
K(m, t, u);
|
|
753
|
+
continue;
|
|
754
|
+
}
|
|
755
|
+
if (!n.forceKeepAttr) {
|
|
756
|
+
if (!n.keepAttr) {
|
|
757
|
+
K(m, t, u);
|
|
758
|
+
continue;
|
|
759
|
+
}
|
|
760
|
+
if (!Ee && O(To, w)) {
|
|
761
|
+
K(m, t, u);
|
|
762
|
+
continue;
|
|
763
|
+
}
|
|
764
|
+
if (B && (w = Nt(w)), !He(l, I, w)) {
|
|
765
|
+
K(m, t, u);
|
|
766
|
+
continue;
|
|
767
|
+
}
|
|
768
|
+
w = Fn(l, I, g, w), w !== te && zn(t, m, g, w) && Be && $e(r.removed);
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
U(h.afterSanitizeAttributes, t, null);
|
|
772
|
+
}, xt = function(t) {
|
|
773
|
+
let e = null;
|
|
774
|
+
const n = ke(t);
|
|
775
|
+
for (U(h.beforeSanitizeShadowDOM, t, null); e = n.nextNode(); )
|
|
776
|
+
if (U(h.uponSanitizeShadowNode, e, null), ze(e, t), We(e), lt(e.content) && xt(e.content), ft(e) === M.element) {
|
|
777
|
+
const a = ue(e);
|
|
778
|
+
lt(a) && (Qt(a), xt(a));
|
|
779
|
+
}
|
|
780
|
+
U(h.afterSanitizeShadowDOM, t, null);
|
|
781
|
+
}, Qt = function(t) {
|
|
782
|
+
const e = [{
|
|
783
|
+
node: t,
|
|
784
|
+
shadow: null
|
|
785
|
+
}];
|
|
786
|
+
for (; e.length > 0; ) {
|
|
787
|
+
const n = e.pop();
|
|
788
|
+
if (n.shadow) {
|
|
789
|
+
xt(n.shadow);
|
|
790
|
+
continue;
|
|
791
|
+
}
|
|
792
|
+
const a = n.node, u = ft(a) === M.element, m = Q(a);
|
|
793
|
+
if (m)
|
|
794
|
+
for (let g = m.length - 1; g >= 0; --g)
|
|
795
|
+
e.push({
|
|
796
|
+
node: m[g],
|
|
797
|
+
shadow: null
|
|
798
|
+
});
|
|
799
|
+
if (u) {
|
|
800
|
+
const g = et ? et(a) : null;
|
|
801
|
+
if (typeof g == "string" && A(g) === "template") {
|
|
802
|
+
const L = a.content;
|
|
803
|
+
lt(L) && e.push({
|
|
804
|
+
node: L,
|
|
805
|
+
shadow: null
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
if (u) {
|
|
810
|
+
const g = ue(a);
|
|
811
|
+
lt(g) && e.push({
|
|
812
|
+
node: null,
|
|
813
|
+
shadow: g
|
|
814
|
+
}, {
|
|
815
|
+
node: g,
|
|
816
|
+
shadow: null
|
|
817
|
+
});
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
};
|
|
821
|
+
return r.sanitize = function(i) {
|
|
822
|
+
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, e = null, n = null, a = null, l = null;
|
|
823
|
+
if (Xt = !i, Xt && (i = "<!-->"), typeof i != "string" && !ht(i) && (i = eo(i), typeof i != "string"))
|
|
824
|
+
throw Z("dirty is not a string, aborting");
|
|
825
|
+
if (!r.isSupported)
|
|
826
|
+
return i;
|
|
827
|
+
Bt ? (T = bt, _ = St) : Zt(t), (h.uponSanitizeElement.length > 0 || h.uponSanitizeAttribute.length > 0) && (T = C(T)), h.uponSanitizeAttribute.length > 0 && (_ = C(_)), r.removed = [];
|
|
828
|
+
const u = $t && typeof i != "string" && ht(i);
|
|
829
|
+
if (u) {
|
|
830
|
+
Pn(i);
|
|
831
|
+
const L = Ut(i);
|
|
832
|
+
if (typeof L == "string") {
|
|
833
|
+
const I = A(L);
|
|
834
|
+
if (!T[I] || mt[I])
|
|
835
|
+
throw Lt(i), Z("root node is forbidden and cannot be sanitized in-place");
|
|
836
|
+
}
|
|
837
|
+
if (Mt(i))
|
|
838
|
+
throw Lt(i), Z("root node is clobbered and cannot be sanitized in-place");
|
|
839
|
+
try {
|
|
840
|
+
Qt(i);
|
|
841
|
+
} catch (I) {
|
|
842
|
+
throw Lt(i), I;
|
|
843
|
+
}
|
|
844
|
+
} else if (ht(i))
|
|
845
|
+
e = ve("<!---->"), n = e.ownerDocument.importNode(i, !0), n.nodeType === M.element && n.nodeName === "BODY" || n.nodeName === "HTML" ? e = n : e.appendChild(n), Qt(e);
|
|
846
|
+
else {
|
|
847
|
+
if (!ot && !B && !q && // eslint-disable-next-line unicorn/prefer-includes
|
|
848
|
+
i.indexOf("<") === -1)
|
|
849
|
+
return D && Rt ? nt(i) : i;
|
|
850
|
+
if (e = ve(i), !e)
|
|
851
|
+
return ot ? null : Rt ? X : "";
|
|
852
|
+
}
|
|
853
|
+
e && jt && j(e.firstChild);
|
|
854
|
+
const m = u ? i : e;
|
|
855
|
+
try {
|
|
856
|
+
const L = ke(m);
|
|
857
|
+
for (; a = L.nextNode(); )
|
|
858
|
+
ze(a, m), We(a), lt(a.content) && xt(a.content);
|
|
859
|
+
} catch (L) {
|
|
860
|
+
throw u && (Lt(i), J(r.removed, (I) => {
|
|
861
|
+
I.element && It(I.element);
|
|
862
|
+
})), L;
|
|
863
|
+
}
|
|
864
|
+
if (u)
|
|
865
|
+
return J(r.removed, (L) => {
|
|
866
|
+
L.element && It(L.element);
|
|
867
|
+
}), B && Jt(i), i;
|
|
868
|
+
if (ot) {
|
|
869
|
+
if (B && Jt(e), Ot)
|
|
870
|
+
for (l = dn.call(e.ownerDocument); e.firstChild; )
|
|
871
|
+
l.appendChild(e.firstChild);
|
|
872
|
+
else
|
|
873
|
+
l = e;
|
|
874
|
+
return (_.shadowroot || _.shadowrootmode) && (l = Tn.call(c, l, !0)), l;
|
|
875
|
+
}
|
|
876
|
+
let g = q ? e.outerHTML : e.innerHTML;
|
|
877
|
+
return q && T["!doctype"] && e.ownerDocument && e.ownerDocument.doctype && e.ownerDocument.doctype.name && O(po, e.ownerDocument.doctype.name) && (g = "<!DOCTYPE " + e.ownerDocument.doctype.name + `>
|
|
878
|
+
` + g), B && (g = Nt(g)), D && Rt ? nt(g) : g;
|
|
879
|
+
}, r.setConfig = function() {
|
|
880
|
+
let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
881
|
+
Zt(i), Bt = !0, bt = T, St = _;
|
|
882
|
+
}, r.clearConfig = function() {
|
|
883
|
+
st = null, Bt = !1, bt = null, St = null, D = Ft, X = "";
|
|
884
|
+
}, r.isValidAttribute = function(i, t, e) {
|
|
885
|
+
st || Zt({});
|
|
886
|
+
const n = A(i), a = A(t);
|
|
887
|
+
return He(n, a, e);
|
|
888
|
+
}, r.addHook = function(i, t) {
|
|
889
|
+
typeof t == "function" && N(h, i) && Tt(h[i], t);
|
|
890
|
+
}, r.removeHook = function(i, t) {
|
|
891
|
+
if (N(h, i)) {
|
|
892
|
+
if (t !== void 0) {
|
|
893
|
+
const e = Vn(h[i], t);
|
|
894
|
+
return e === -1 ? void 0 : qn(h[i], e, 1)[0];
|
|
895
|
+
}
|
|
896
|
+
return $e(h[i]);
|
|
897
|
+
}
|
|
898
|
+
}, r.removeHooks = function(i) {
|
|
899
|
+
N(h, i) && (h[i] = []);
|
|
900
|
+
}, r.removeAllHooks = function() {
|
|
901
|
+
h = rn();
|
|
902
|
+
}, r;
|
|
903
|
+
}
|
|
904
|
+
var yo = cn();
|
|
905
|
+
async function So(o, r, s = !1) {
|
|
906
|
+
var E;
|
|
907
|
+
if (o.length > 1e5)
|
|
908
|
+
throw new Error("Preview source exceeds 100,000 characters.");
|
|
909
|
+
const c = crypto.randomUUID();
|
|
910
|
+
let f;
|
|
911
|
+
if (r === "html")
|
|
912
|
+
f = yo.sanitize(o, {
|
|
913
|
+
WHOLE_DOCUMENT: !0,
|
|
914
|
+
ADD_TAGS: ["style"],
|
|
915
|
+
FORBID_TAGS: [
|
|
916
|
+
"script",
|
|
917
|
+
"meta",
|
|
918
|
+
"base",
|
|
919
|
+
"link",
|
|
920
|
+
"iframe",
|
|
921
|
+
"object",
|
|
922
|
+
"embed",
|
|
923
|
+
"form"
|
|
924
|
+
],
|
|
925
|
+
FORBID_ATTR: ["href", "action", "formaction", "srcset"]
|
|
926
|
+
});
|
|
927
|
+
else {
|
|
928
|
+
const [x, { default: R }] = await Promise.all([
|
|
929
|
+
import("typescript"),
|
|
930
|
+
import("./_virtual_content-preview-runtime-X_KtOyFO.js")
|
|
931
|
+
]), F = x.transpileModule(o, {
|
|
932
|
+
fileName: "preview.tsx",
|
|
933
|
+
reportDiagnostics: !0,
|
|
934
|
+
compilerOptions: {
|
|
935
|
+
jsx: x.JsxEmit.React,
|
|
936
|
+
module: x.ModuleKind.CommonJS,
|
|
937
|
+
target: x.ScriptTarget.ES2020,
|
|
938
|
+
esModuleInterop: !0
|
|
939
|
+
}
|
|
940
|
+
}), z = (E = F.diagnostics) == null ? void 0 : E.filter(
|
|
941
|
+
(H) => H.category === x.DiagnosticCategory.Error
|
|
942
|
+
);
|
|
943
|
+
if (z != null && z.length)
|
|
944
|
+
throw new Error(
|
|
945
|
+
z.map(
|
|
946
|
+
(H) => x.flattenDiagnosticMessageText(H.messageText, `
|
|
947
|
+
`)
|
|
948
|
+
).join(`
|
|
949
|
+
`)
|
|
950
|
+
);
|
|
951
|
+
f = `<div id="preview"></div><script type="application/json" id="source">${JSON.stringify(F.outputText).replace(/</g, "\\u003c")}<\/script><script nonce="${c}">${R.replace(/<\/script/gi, "<\\/script")}<\/script>`;
|
|
952
|
+
}
|
|
953
|
+
return s && (f += `<script nonce="${c}">document.addEventListener('dblclick', function(event) {
|
|
954
|
+
if (event.defaultPrevented || !(event.target instanceof Element) || event.target.closest('button, a, input, textarea, select, video, audio, [contenteditable], [role="button"], [role="textbox"]')) return;
|
|
955
|
+
event.preventDefault();
|
|
956
|
+
parent.postMessage({type: 'squeed:content-edit'}, '*');
|
|
957
|
+
});<\/script>`), `<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="${`default-src 'none'; script-src ${r === "jsx" ? `'nonce-${c}' 'unsafe-eval'` : s ? `'nonce-${c}'` : "'none'"}; style-src 'unsafe-inline'; img-src data: blob:; media-src https: data: blob:; connect-src 'none'; base-uri 'none'; form-action 'none'; frame-src 'none';`}"><meta name="referrer" content="no-referrer"><style>html{color-scheme:light}body{margin:0;padding:0;font:16px/1.5 sans-serif;color:#18181b;background:white;overflow-wrap:anywhere}*{box-sizing:border-box}img{max-width:100%}pre{white-space:pre-wrap}</style></head><body>${f}</body></html>`;
|
|
958
|
+
}
|
|
959
|
+
export {
|
|
960
|
+
So as contentPreviewDocument
|
|
961
|
+
};
|
|
962
|
+
//# sourceMappingURL=contentPreviewDocument-C2D0H-Lr.js.map
|