@ranty/ranty-sdk 4.0.0-beta.12 → 4.0.0-beta.14

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.
@@ -0,0 +1,839 @@
1
+ /*! @license DOMPurify 3.4.11 | (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.11/LICENSE */
2
+ function Mt(n, o) {
3
+ (o == null || o > n.length) && (o = n.length);
4
+ for (var s = 0, l = Array(o); s < o; s++)
5
+ l[s] = n[s];
6
+ return l;
7
+ }
8
+ function Nn(n) {
9
+ if (Array.isArray(n))
10
+ return n;
11
+ }
12
+ function In(n, o) {
13
+ var s = n == null ? null : typeof Symbol != "undefined" && n[Symbol.iterator] || n["@@iterator"];
14
+ if (s != null) {
15
+ var l, u, m, N, re = [], w = !0, ie = !1;
16
+ try {
17
+ if (m = (s = s.call(n)).next, o !== 0)
18
+ for (; !(w = (l = m.call(s)).done) && (re.push(l.value), re.length !== o); w = !0)
19
+ ;
20
+ } catch (Ie) {
21
+ ie = !0, u = Ie;
22
+ } finally {
23
+ try {
24
+ if (!w && s.return != null && (N = s.return(), Object(N) !== N))
25
+ return;
26
+ } finally {
27
+ if (ie)
28
+ throw u;
29
+ }
30
+ }
31
+ return re;
32
+ }
33
+ }
34
+ function Dn() {
35
+ throw new TypeError(`Invalid attempt to destructure non-iterable instance.
36
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
37
+ }
38
+ function Ln(n, o) {
39
+ return Nn(n) || In(n, o) || wn(n, o) || Dn();
40
+ }
41
+ function wn(n, o) {
42
+ if (n) {
43
+ if (typeof n == "string")
44
+ return Mt(n, o);
45
+ var s = {}.toString.call(n).slice(8, -1);
46
+ return s === "Object" && n.constructor && (s = n.constructor.name), s === "Map" || s === "Set" ? Array.from(n) : s === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s) ? Mt(n, o) : void 0;
47
+ }
48
+ }
49
+ const $t = Object.entries, Pt = Object.setPrototypeOf, Cn = Object.isFrozen, Mn = Object.getPrototypeOf, Pn = Object.getOwnPropertyDescriptor;
50
+ let O = Object.freeze, R = Object.seal, oe = Object.create, Xt = typeof Reflect != "undefined" && Reflect, Qe = Xt.apply, et = Xt.construct;
51
+ O || (O = function(o) {
52
+ return o;
53
+ });
54
+ R || (R = function(o) {
55
+ return o;
56
+ });
57
+ Qe || (Qe = function(o, s) {
58
+ for (var l = arguments.length, u = new Array(l > 2 ? l - 2 : 0), m = 2; m < l; m++)
59
+ u[m - 2] = arguments[m];
60
+ return o.apply(s, u);
61
+ });
62
+ et || (et = function(o) {
63
+ for (var s = arguments.length, l = new Array(s > 1 ? s - 1 : 0), u = 1; u < s; u++)
64
+ l[u - 1] = arguments[u];
65
+ return new o(...l);
66
+ });
67
+ const me = A(Array.prototype.forEach), xn = A(Array.prototype.lastIndexOf), xt = A(Array.prototype.pop), ne = A(Array.prototype.push), kn = A(Array.prototype.splice), Y = Array.isArray, _e = A(String.prototype.toLowerCase), Ve = A(String.prototype.toString), kt = A(String.prototype.match), de = A(String.prototype.replace), vt = A(String.prototype.indexOf), vn = A(String.prototype.trim), Un = A(Number.prototype.toString), Fn = A(Boolean.prototype.toString), Ut = typeof BigInt == "undefined" ? null : A(BigInt.prototype.toString), Ft = typeof Symbol == "undefined" ? null : A(Symbol.prototype.toString), S = A(Object.prototype.hasOwnProperty), Te = A(Object.prototype.toString), b = A(RegExp.prototype.test), q = zn(TypeError);
68
+ function A(n) {
69
+ return function(o) {
70
+ o instanceof RegExp && (o.lastIndex = 0);
71
+ for (var s = arguments.length, l = new Array(s > 1 ? s - 1 : 0), u = 1; u < s; u++)
72
+ l[u - 1] = arguments[u];
73
+ return Qe(n, o, l);
74
+ };
75
+ }
76
+ function zn(n) {
77
+ return function() {
78
+ for (var o = arguments.length, s = new Array(o), l = 0; l < o; l++)
79
+ s[l] = arguments[l];
80
+ return et(n, s);
81
+ };
82
+ }
83
+ function f(n, o) {
84
+ let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : _e;
85
+ if (Pt && Pt(n, null), !Y(o))
86
+ return n;
87
+ let l = o.length;
88
+ for (; l--; ) {
89
+ let u = o[l];
90
+ if (typeof u == "string") {
91
+ const m = s(u);
92
+ m !== u && (Cn(o) || (o[l] = m), u = m);
93
+ }
94
+ n[u] = !0;
95
+ }
96
+ return n;
97
+ }
98
+ function Hn(n) {
99
+ for (let o = 0; o < n.length; o++)
100
+ S(n, o) || (n[o] = null);
101
+ return n;
102
+ }
103
+ function D(n) {
104
+ const o = oe(null);
105
+ for (const l of $t(n)) {
106
+ var s = Ln(l, 2);
107
+ const u = s[0], m = s[1];
108
+ S(n, u) && (Y(m) ? o[u] = Hn(m) : m && typeof m == "object" && m.constructor === Object ? o[u] = D(m) : o[u] = m);
109
+ }
110
+ return o;
111
+ }
112
+ function Gn(n) {
113
+ switch (typeof n) {
114
+ case "string":
115
+ return n;
116
+ case "number":
117
+ return Un(n);
118
+ case "boolean":
119
+ return Fn(n);
120
+ case "bigint":
121
+ return Ut ? Ut(n) : "0";
122
+ case "symbol":
123
+ return Ft ? Ft(n) : "Symbol()";
124
+ case "undefined":
125
+ return Te(n);
126
+ case "function":
127
+ case "object": {
128
+ if (n === null)
129
+ return Te(n);
130
+ const o = n, s = U(o, "toString");
131
+ if (typeof s == "function") {
132
+ const l = s(o);
133
+ return typeof l == "string" ? l : Te(l);
134
+ }
135
+ return Te(n);
136
+ }
137
+ default:
138
+ return Te(n);
139
+ }
140
+ }
141
+ function U(n, o) {
142
+ for (; n !== null; ) {
143
+ const l = Pn(n, o);
144
+ if (l) {
145
+ if (l.get)
146
+ return A(l.get);
147
+ if (typeof l.value == "function")
148
+ return A(l.value);
149
+ }
150
+ n = Mn(n);
151
+ }
152
+ function s() {
153
+ return null;
154
+ }
155
+ return s;
156
+ }
157
+ function Bn(n) {
158
+ try {
159
+ return b(n, ""), !0;
160
+ } catch (o) {
161
+ return !1;
162
+ }
163
+ }
164
+ const zt = O(["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"]), qe = O(["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"]), Ke = O(["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"]), Wn = O(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), Ze = O(["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"]), Yn = O(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Ht = O(["#text"]), Gt = O(["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"]), Je = O(["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", "mask-type", "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"]), Bt = O(["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"]), Ne = O(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), jn = R(/{{[\w\W]*|^[\w\W]*}}/g), $n = R(/<%[\w\W]*|^[\w\W]*%>/g), Xn = R(/\${[\w\W]*/g), Vn = R(/^data-[\-\w.\u00B7-\uFFFF]+$/), qn = R(/^aria-[\-\w]+$/), Wt = R(
165
+ /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
166
+ // eslint-disable-line no-useless-escape
167
+ ), Kn = R(/^(?:\w+script|data):/i), Zn = R(
168
+ /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
169
+ // eslint-disable-line no-control-regex
170
+ ), Jn = R(/^html$/i), Qn = R(/^[a-z][.\w]*(-[.\w]+)+$/i), Yt = R(/<[/\w!]/g), eo = R(/<[/\w]/g), to = R(/<\/no(script|embed|frames)/i), no = R(/\/>/i), v = {
171
+ element: 1,
172
+ attribute: 2,
173
+ text: 3,
174
+ cdataSection: 4,
175
+ entityReference: 5,
176
+ // Deprecated
177
+ entityNode: 6,
178
+ // Deprecated
179
+ processingInstruction: 7,
180
+ comment: 8,
181
+ document: 9,
182
+ documentType: 10,
183
+ documentFragment: 11,
184
+ notation: 12
185
+ // Deprecated
186
+ }, oo = function() {
187
+ return typeof window == "undefined" ? null : window;
188
+ }, ro = function(o, s) {
189
+ if (typeof o != "object" || typeof o.createPolicy != "function")
190
+ return null;
191
+ let l = null;
192
+ const u = "data-tt-policy-suffix";
193
+ s && s.hasAttribute(u) && (l = s.getAttribute(u));
194
+ const m = "dompurify" + (l ? "#" + l : "");
195
+ try {
196
+ return o.createPolicy(m, {
197
+ createHTML(N) {
198
+ return N;
199
+ },
200
+ createScriptURL(N) {
201
+ return N;
202
+ }
203
+ });
204
+ } catch (N) {
205
+ return console.warn("TrustedTypes policy " + m + " could not be created."), null;
206
+ }
207
+ }, jt = function() {
208
+ return {
209
+ afterSanitizeAttributes: [],
210
+ afterSanitizeElements: [],
211
+ afterSanitizeShadowDOM: [],
212
+ beforeSanitizeAttributes: [],
213
+ beforeSanitizeElements: [],
214
+ beforeSanitizeShadowDOM: [],
215
+ uponSanitizeAttribute: [],
216
+ uponSanitizeElement: [],
217
+ uponSanitizeShadowNode: []
218
+ };
219
+ }, W = function(o, s, l, u) {
220
+ return S(o, s) && Y(o[s]) ? f(u.base ? D(u.base) : {}, o[s], u.transform) : l;
221
+ };
222
+ function Vt() {
223
+ let n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : oo();
224
+ const o = (i) => Vt(i);
225
+ if (o.version = "3.4.11", o.removed = [], !n || !n.document || n.document.nodeType !== v.document || !n.Element)
226
+ return o.isSupported = !1, o;
227
+ let s = n.document;
228
+ const l = s, u = l.currentScript;
229
+ n.DocumentFragment;
230
+ const m = n.HTMLTemplateElement, N = n.Node, re = n.Element, w = n.NodeFilter, ie = n.NamedNodeMap;
231
+ ie === void 0 && (n.NamedNodeMap || n.MozNamedAttrMap), n.HTMLFormElement;
232
+ const Ie = n.DOMParser, he = n.trustedTypes, j = re.prototype, qt = U(j, "cloneNode"), tt = U(j, "remove"), Kt = U(j, "nextSibling"), ae = U(j, "childNodes"), se = U(j, "parentNode"), nt = U(j, "shadowRoot"), De = U(j, "attributes"), C = N && N.prototype ? U(N.prototype, "nodeType") : null, z = N && N.prototype ? U(N.prototype, "nodeName") : null;
233
+ if (typeof m == "function") {
234
+ const i = s.createElement("template");
235
+ i.content && i.content.ownerDocument && (s = i.content.ownerDocument);
236
+ }
237
+ let L, $ = "", Le, ot = !1, le = 0;
238
+ const rt = function() {
239
+ if (le > 0)
240
+ throw q('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.');
241
+ }, K = function(e) {
242
+ rt(), le++;
243
+ try {
244
+ return L.createHTML(e);
245
+ } finally {
246
+ le--;
247
+ }
248
+ }, Zt = function(e) {
249
+ rt(), le++;
250
+ try {
251
+ return L.createScriptURL(e);
252
+ } finally {
253
+ le--;
254
+ }
255
+ }, Jt = function() {
256
+ return ot || (Le = ro(he, u), ot = !0), Le;
257
+ }, ge = s, we = ge.implementation, it = ge.createNodeIterator, Qt = ge.createDocumentFragment, en = ge.getElementsByTagName, tn = l.importNode;
258
+ let g = jt();
259
+ o.isSupported = typeof $t == "function" && typeof se == "function" && we && we.createHTMLDocument !== void 0;
260
+ const nn = jn, on = $n, rn = Xn, an = Vn, sn = qn, ln = Kn, at = Zn, cn = Qn;
261
+ let st = Wt, d = null;
262
+ const lt = f({}, [...zt, ...qe, ...Ke, ...Ze, ...Ht]);
263
+ let T = null;
264
+ const ct = f({}, [...Gt, ...Je, ...Bt, ...Ne]);
265
+ let _ = Object.seal(oe(null, {
266
+ tagNameCheck: {
267
+ writable: !0,
268
+ configurable: !1,
269
+ enumerable: !0,
270
+ value: null
271
+ },
272
+ attributeNameCheck: {
273
+ writable: !0,
274
+ configurable: !1,
275
+ enumerable: !0,
276
+ value: null
277
+ },
278
+ allowCustomizedBuiltInElements: {
279
+ writable: !0,
280
+ configurable: !1,
281
+ enumerable: !0,
282
+ value: !1
283
+ }
284
+ })), ce = null, ut = null;
285
+ const H = Object.seal(oe(null, {
286
+ tagCheck: {
287
+ writable: !0,
288
+ configurable: !1,
289
+ enumerable: !0,
290
+ value: null
291
+ },
292
+ attributeCheck: {
293
+ writable: !0,
294
+ configurable: !1,
295
+ enumerable: !0,
296
+ value: null
297
+ }
298
+ }));
299
+ let ft = !0, Ce = !0, pt = !1, mt = !0, G = !1, ue = !0, X = !1, Me = !1, Pe = null, xe = null, ke = !1, Z = !1, Ee = !1, Ae = !1, dt = !0, Tt = !1;
300
+ const _t = "user-content-";
301
+ let ve = !0, Ue = !1, J = {}, x = null;
302
+ const Fe = f({}, [
303
+ "annotation-xml",
304
+ "audio",
305
+ "colgroup",
306
+ "desc",
307
+ "foreignobject",
308
+ "head",
309
+ "iframe",
310
+ "math",
311
+ "mi",
312
+ "mn",
313
+ "mo",
314
+ "ms",
315
+ "mtext",
316
+ "noembed",
317
+ "noframes",
318
+ "noscript",
319
+ "plaintext",
320
+ "script",
321
+ // <selectedcontent> mirrors the selected <option>'s subtree, cloned by
322
+ // the UA (customizable <select>) — including any on* handlers — and the
323
+ // engine re-mirrors synchronously whenever a removal changes which
324
+ // option/selectedcontent is current, even inside DOMPurify's inert
325
+ // DOMParser document. Hoisting its children on removal re-inserts a fresh
326
+ // mirror target ahead of the walk, which the engine refills, looping
327
+ // forever (DoS) and amplifying output. Dropping its content on removal
328
+ // (rather than hoisting) breaks that cascade; the content is a duplicate
329
+ // of the option, which is sanitized on its own. See campaign-3 F1/F6.
330
+ "selectedcontent",
331
+ "style",
332
+ "svg",
333
+ "template",
334
+ "thead",
335
+ "title",
336
+ "video",
337
+ "xmp"
338
+ ]);
339
+ let ht = null;
340
+ const gt = f({}, ["audio", "video", "img", "source", "image", "track"]);
341
+ let ze = null;
342
+ const Et = f({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), ye = "http://www.w3.org/1998/Math/MathML", Se = "http://www.w3.org/2000/svg", k = "http://www.w3.org/1999/xhtml";
343
+ let Q = k, He = !1, Ge = null;
344
+ const un = f({}, [ye, Se, k], Ve), At = O(["mi", "mo", "mn", "ms", "mtext"]);
345
+ let Be = f({}, At);
346
+ const yt = O(["annotation-xml"]);
347
+ let We = f({}, yt);
348
+ const fn = f({}, ["title", "style", "font", "a", "script"]);
349
+ let fe = null;
350
+ const pn = ["application/xhtml+xml", "text/html"], mn = "text/html";
351
+ let h = null, ee = null;
352
+ const dn = s.createElement("form"), St = function(e) {
353
+ return e instanceof RegExp || e instanceof Function;
354
+ }, Ye = function() {
355
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
356
+ if (ee && ee === e)
357
+ return;
358
+ (!e || typeof e != "object") && (e = {}), e = D(e), fe = // eslint-disable-next-line unicorn/prefer-includes
359
+ pn.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? mn : e.PARSER_MEDIA_TYPE, h = fe === "application/xhtml+xml" ? Ve : _e, d = W(e, "ALLOWED_TAGS", lt, {
360
+ transform: h
361
+ }), T = W(e, "ALLOWED_ATTR", ct, {
362
+ transform: h
363
+ }), Ge = W(e, "ALLOWED_NAMESPACES", un, {
364
+ transform: Ve
365
+ }), ze = W(e, "ADD_URI_SAFE_ATTR", Et, {
366
+ transform: h,
367
+ base: Et
368
+ }), ht = W(e, "ADD_DATA_URI_TAGS", gt, {
369
+ transform: h,
370
+ base: gt
371
+ }), x = W(e, "FORBID_CONTENTS", Fe, {
372
+ transform: h
373
+ }), ce = W(e, "FORBID_TAGS", D({}), {
374
+ transform: h
375
+ }), ut = W(e, "FORBID_ATTR", D({}), {
376
+ transform: h
377
+ }), J = S(e, "USE_PROFILES") ? e.USE_PROFILES && typeof e.USE_PROFILES == "object" ? D(e.USE_PROFILES) : e.USE_PROFILES : !1, ft = e.ALLOW_ARIA_ATTR !== !1, Ce = e.ALLOW_DATA_ATTR !== !1, pt = e.ALLOW_UNKNOWN_PROTOCOLS || !1, mt = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, G = e.SAFE_FOR_TEMPLATES || !1, ue = e.SAFE_FOR_XML !== !1, X = e.WHOLE_DOCUMENT || !1, Z = e.RETURN_DOM || !1, Ee = e.RETURN_DOM_FRAGMENT || !1, Ae = e.RETURN_TRUSTED_TYPE || !1, ke = e.FORCE_BODY || !1, dt = e.SANITIZE_DOM !== !1, Tt = e.SANITIZE_NAMED_PROPS || !1, ve = e.KEEP_CONTENT !== !1, Ue = e.IN_PLACE || !1, st = Bn(e.ALLOWED_URI_REGEXP) ? e.ALLOWED_URI_REGEXP : Wt, Q = typeof e.NAMESPACE == "string" ? e.NAMESPACE : k, Be = S(e, "MATHML_TEXT_INTEGRATION_POINTS") && e.MATHML_TEXT_INTEGRATION_POINTS && typeof e.MATHML_TEXT_INTEGRATION_POINTS == "object" ? D(e.MATHML_TEXT_INTEGRATION_POINTS) : f({}, At), We = S(e, "HTML_INTEGRATION_POINTS") && e.HTML_INTEGRATION_POINTS && typeof e.HTML_INTEGRATION_POINTS == "object" ? D(e.HTML_INTEGRATION_POINTS) : f({}, yt);
378
+ const t = S(e, "CUSTOM_ELEMENT_HANDLING") && e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING == "object" ? D(e.CUSTOM_ELEMENT_HANDLING) : oe(null);
379
+ if (_ = oe(null), S(t, "tagNameCheck") && St(t.tagNameCheck) && (_.tagNameCheck = t.tagNameCheck), S(t, "attributeNameCheck") && St(t.attributeNameCheck) && (_.attributeNameCheck = t.attributeNameCheck), S(t, "allowCustomizedBuiltInElements") && typeof t.allowCustomizedBuiltInElements == "boolean" && (_.allowCustomizedBuiltInElements = t.allowCustomizedBuiltInElements), R(_), G && (Ce = !1), Ee && (Z = !0), J && (d = f({}, Ht), T = oe(null), J.html === !0 && (f(d, zt), f(T, Gt)), J.svg === !0 && (f(d, qe), f(T, Je), f(T, Ne)), J.svgFilters === !0 && (f(d, Ke), f(T, Je), f(T, Ne)), J.mathMl === !0 && (f(d, Ze), f(T, Bt), f(T, Ne))), H.tagCheck = null, H.attributeCheck = null, S(e, "ADD_TAGS") && (typeof e.ADD_TAGS == "function" ? H.tagCheck = e.ADD_TAGS : Y(e.ADD_TAGS) && (d === lt && (d = D(d)), f(d, e.ADD_TAGS, h))), S(e, "ADD_ATTR") && (typeof e.ADD_ATTR == "function" ? H.attributeCheck = e.ADD_ATTR : Y(e.ADD_ATTR) && (T === ct && (T = D(T)), f(T, e.ADD_ATTR, h))), S(e, "ADD_URI_SAFE_ATTR") && Y(e.ADD_URI_SAFE_ATTR) && f(ze, e.ADD_URI_SAFE_ATTR, h), S(e, "FORBID_CONTENTS") && Y(e.FORBID_CONTENTS) && (x === Fe && (x = D(x)), f(x, e.FORBID_CONTENTS, h)), S(e, "ADD_FORBID_CONTENTS") && Y(e.ADD_FORBID_CONTENTS) && (x === Fe && (x = D(x)), f(x, e.ADD_FORBID_CONTENTS, h)), ve && (d["#text"] = !0), X && f(d, ["html", "head", "body"]), d.table && (f(d, ["tbody"]), delete ce.tbody), e.TRUSTED_TYPES_POLICY) {
380
+ if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function")
381
+ throw q('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
382
+ if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function")
383
+ throw q('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
384
+ const r = L;
385
+ L = e.TRUSTED_TYPES_POLICY;
386
+ try {
387
+ $ = K("");
388
+ } catch (a) {
389
+ throw L = r, a;
390
+ }
391
+ } else
392
+ e.TRUSTED_TYPES_POLICY === null ? (L = void 0, $ = "") : (L === void 0 && (L = Jt()), L && typeof $ == "string" && ($ = K("")));
393
+ O && O(e), ee = e;
394
+ }, bt = f({}, [...qe, ...Ke, ...Wn]), Ot = f({}, [...Ze, ...Yn]), Tn = function(e, t, r) {
395
+ return t.namespaceURI === k ? e === "svg" : t.namespaceURI === ye ? e === "svg" && (r === "annotation-xml" || Be[r]) : !!bt[e];
396
+ }, _n = function(e, t, r) {
397
+ return t.namespaceURI === k ? e === "math" : t.namespaceURI === Se ? e === "math" && We[r] : !!Ot[e];
398
+ }, hn = function(e, t, r) {
399
+ return t.namespaceURI === Se && !We[r] || t.namespaceURI === ye && !Be[r] ? !1 : !Ot[e] && (fn[e] || !bt[e]);
400
+ }, gn = function(e) {
401
+ let t = se(e);
402
+ (!t || !t.tagName) && (t = {
403
+ namespaceURI: Q,
404
+ tagName: "template"
405
+ });
406
+ const r = _e(e.tagName), a = _e(t.tagName);
407
+ return Ge[e.namespaceURI] ? e.namespaceURI === Se ? Tn(r, t, a) : e.namespaceURI === ye ? _n(r, t, a) : e.namespaceURI === k ? hn(r, t, a) : !!(fe === "application/xhtml+xml" && Ge[e.namespaceURI]) : !1;
408
+ }, B = function(e) {
409
+ ne(o.removed, {
410
+ element: e
411
+ });
412
+ try {
413
+ se(e).removeChild(e);
414
+ } catch (t) {
415
+ if (tt(e), !se(e))
416
+ throw q("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
417
+ }
418
+ }, Rt = function(e) {
419
+ const t = ae(e);
420
+ if (t) {
421
+ const a = [];
422
+ me(t, (c) => {
423
+ ne(a, c);
424
+ }), me(a, (c) => {
425
+ try {
426
+ tt(c);
427
+ } catch (p) {
428
+ }
429
+ });
430
+ }
431
+ const r = De(e);
432
+ if (r)
433
+ for (let a = r.length - 1; a >= 0; --a) {
434
+ const c = r[a], p = c && c.name;
435
+ if (typeof p == "string")
436
+ try {
437
+ e.removeAttribute(p);
438
+ } catch (y) {
439
+ }
440
+ }
441
+ }, V = function(e, t) {
442
+ try {
443
+ ne(o.removed, {
444
+ attribute: t.getAttributeNode(e),
445
+ from: t
446
+ });
447
+ } catch (r) {
448
+ ne(o.removed, {
449
+ attribute: null,
450
+ from: t
451
+ });
452
+ }
453
+ if (t.removeAttribute(e), e === "is")
454
+ if (Z || Ee)
455
+ try {
456
+ B(t);
457
+ } catch (r) {
458
+ }
459
+ else
460
+ try {
461
+ t.setAttribute(e, "");
462
+ } catch (r) {
463
+ }
464
+ }, En = function(e) {
465
+ const t = De(e);
466
+ if (t)
467
+ for (let r = t.length - 1; r >= 0; --r) {
468
+ const a = t[r], c = a && a.name;
469
+ if (!(typeof c != "string" || T[h(c)]))
470
+ try {
471
+ e.removeAttribute(c);
472
+ } catch (p) {
473
+ }
474
+ }
475
+ }, An = function(e) {
476
+ const t = [e];
477
+ for (; t.length > 0; ) {
478
+ const r = t.pop();
479
+ (C ? C(r) : r.nodeType) === v.element && En(r);
480
+ const c = ae(r);
481
+ if (c)
482
+ for (let p = c.length - 1; p >= 0; --p)
483
+ t.push(c[p]);
484
+ }
485
+ }, Nt = function(e) {
486
+ let t = null, r = null;
487
+ if (ke)
488
+ e = "<remove></remove>" + e;
489
+ else {
490
+ const p = kt(e, /^[\r\n\t ]+/);
491
+ r = p && p[0];
492
+ }
493
+ fe === "application/xhtml+xml" && Q === k && (e = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + e + "</body></html>");
494
+ const a = L ? K(e) : e;
495
+ if (Q === k)
496
+ try {
497
+ t = new Ie().parseFromString(a, fe);
498
+ } catch (p) {
499
+ }
500
+ if (!t || !t.documentElement) {
501
+ t = we.createDocument(Q, "template", null);
502
+ try {
503
+ t.documentElement.innerHTML = He ? $ : a;
504
+ } catch (p) {
505
+ }
506
+ }
507
+ const c = t.body || t.documentElement;
508
+ return e && r && c.insertBefore(s.createTextNode(r), c.childNodes[0] || null), Q === k ? en.call(t, X ? "html" : "body")[0] : X ? t.documentElement : c;
509
+ }, It = function(e) {
510
+ return it.call(
511
+ e.ownerDocument || e,
512
+ e,
513
+ // eslint-disable-next-line no-bitwise
514
+ w.SHOW_ELEMENT | w.SHOW_COMMENT | w.SHOW_TEXT | w.SHOW_PROCESSING_INSTRUCTION | w.SHOW_CDATA_SECTION,
515
+ null
516
+ );
517
+ }, be = function(e) {
518
+ return e = de(e, nn, " "), e = de(e, on, " "), e = de(e, rn, " "), e;
519
+ }, je = function(e) {
520
+ var t;
521
+ e.normalize();
522
+ const r = it.call(
523
+ e.ownerDocument || e,
524
+ e,
525
+ // eslint-disable-next-line no-bitwise
526
+ w.SHOW_TEXT | w.SHOW_COMMENT | w.SHOW_CDATA_SECTION | w.SHOW_PROCESSING_INSTRUCTION,
527
+ null
528
+ );
529
+ let a = r.nextNode();
530
+ for (; a; )
531
+ a.data = be(a.data), a = r.nextNode();
532
+ const c = (t = e.querySelectorAll) === null || t === void 0 ? void 0 : t.call(e, "template");
533
+ c && me(c, (p) => {
534
+ te(p.content) && je(p.content);
535
+ });
536
+ }, Oe = function(e) {
537
+ const t = z ? z(e) : null;
538
+ return typeof t != "string" || h(t) !== "form" ? !1 : typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || // Realm-safe NamedNodeMap detection: equality against the cached
539
+ // prototype getter. Clobbered .attributes (e.g. <input name="attributes">)
540
+ // makes the direct read diverge from the cached read; a clean form
541
+ // (same-realm OR foreign-realm) has both reads pointing at the same
542
+ // canonical NamedNodeMap.
543
+ e.attributes !== De(e) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function" || // NodeType clobbering probe. Cached Node.prototype.nodeType getter
544
+ // returns the integer 1 for any Element regardless of realm; direct
545
+ // read on a clobbered form (e.g. <input name="nodeType">) returns
546
+ // the named child element. Cheap addition — nodeType is read from
547
+ // an internal slot, no serialization cost — and removes a residual
548
+ // clobbering surface used by several mXSS / PI / comment branches
549
+ // in _sanitizeElements that compare currentNode.nodeType directly.
550
+ e.nodeType !== C(e) || // HTMLFormElement has [LegacyOverrideBuiltIns]: a descendant named
551
+ // "childNodes" shadows the prototype getter. Direct reads of
552
+ // form.childNodes from a clobbered form return the named child
553
+ // instead of the real NodeList, so any walk that reads it directly
554
+ // skips the form's real children. Compare the direct read to the
555
+ // cached Node.prototype getter — when the form's named-property
556
+ // getter intercepts the read, the two values differ and we flag
557
+ // the form. This catches every clobbering child type (input,
558
+ // select, etc.) regardless of whether the named child happens to
559
+ // carry a numeric .length, which a typeof-based probe would miss
560
+ // (e.g. HTMLSelectElement.length is a defined unsigned-long).
561
+ e.childNodes !== ae(e);
562
+ }, te = function(e) {
563
+ if (!C || typeof e != "object" || e === null)
564
+ return !1;
565
+ try {
566
+ return C(e) === v.documentFragment;
567
+ } catch (t) {
568
+ return !1;
569
+ }
570
+ }, pe = function(e) {
571
+ if (!C || typeof e != "object" || e === null)
572
+ return !1;
573
+ try {
574
+ return typeof C(e) == "number";
575
+ } catch (t) {
576
+ return !1;
577
+ }
578
+ };
579
+ function F(i, e, t) {
580
+ i.length !== 0 && me(i, (r) => {
581
+ r.call(o, e, t, ee);
582
+ });
583
+ }
584
+ const yn = function(e, t) {
585
+ return !!(ue && e.hasChildNodes() && !pe(e.firstElementChild) && b(Yt, e.textContent) && b(Yt, e.innerHTML) || ue && e.namespaceURI === k && t === "style" && pe(e.firstElementChild) || e.nodeType === v.processingInstruction || ue && e.nodeType === v.comment && b(eo, e.data));
586
+ }, Sn = function(e, t) {
587
+ if (!ce[t] && wt(t) && (_.tagNameCheck instanceof RegExp && b(_.tagNameCheck, t) || _.tagNameCheck instanceof Function && _.tagNameCheck(t)))
588
+ return !1;
589
+ if (ve && !x[t]) {
590
+ const r = se(e), a = ae(e);
591
+ if (a && r) {
592
+ const c = a.length;
593
+ for (let p = c - 1; p >= 0; --p) {
594
+ const y = Ue ? a[p] : qt(a[p], !0);
595
+ r.insertBefore(y, Kt(e));
596
+ }
597
+ }
598
+ }
599
+ return B(e), !0;
600
+ }, Dt = function(e) {
601
+ if (F(g.beforeSanitizeElements, e, null), Oe(e))
602
+ return B(e), !0;
603
+ const t = h(z ? z(e) : e.nodeName);
604
+ if (F(g.uponSanitizeElement, e, {
605
+ tagName: t,
606
+ allowedTags: d
607
+ }), yn(e, t))
608
+ return B(e), !0;
609
+ if (ce[t] || !(H.tagCheck instanceof Function && H.tagCheck(t)) && !d[t])
610
+ return Sn(e, t);
611
+ if ((C ? C(e) : e.nodeType) === v.element && !gn(e) || (t === "noscript" || t === "noembed" || t === "noframes") && b(to, e.innerHTML))
612
+ return B(e), !0;
613
+ if (G && e.nodeType === v.text) {
614
+ const a = be(e.textContent);
615
+ e.textContent !== a && (ne(o.removed, {
616
+ element: e.cloneNode()
617
+ }), e.textContent = a);
618
+ }
619
+ return F(g.afterSanitizeElements, e, null), !1;
620
+ }, Lt = function(e, t, r) {
621
+ if (ut[t] || dt && (t === "id" || t === "name") && (r in s || r in dn))
622
+ return !1;
623
+ const a = T[t] || H.attributeCheck instanceof Function && H.attributeCheck(t, e);
624
+ if (!(Ce && b(an, t))) {
625
+ if (!(ft && b(sn, t))) {
626
+ if (a) {
627
+ if (!ze[t]) {
628
+ if (!b(st, de(r, at, ""))) {
629
+ if (!((t === "src" || t === "xlink:href" || t === "href") && e !== "script" && vt(r, "data:") === 0 && ht[e])) {
630
+ if (!(pt && !b(ln, de(r, at, "")))) {
631
+ if (r)
632
+ return !1;
633
+ }
634
+ }
635
+ }
636
+ }
637
+ } else if (
638
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
639
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
640
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
641
+ !(wt(e) && (_.tagNameCheck instanceof RegExp && b(_.tagNameCheck, e) || _.tagNameCheck instanceof Function && _.tagNameCheck(e)) && (_.attributeNameCheck instanceof RegExp && b(_.attributeNameCheck, t) || _.attributeNameCheck instanceof Function && _.attributeNameCheck(t, e)) || // Alternative, second condition checks if it's an `is`-attribute, AND
642
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
643
+ t === "is" && _.allowCustomizedBuiltInElements && (_.tagNameCheck instanceof RegExp && b(_.tagNameCheck, r) || _.tagNameCheck instanceof Function && _.tagNameCheck(r)))
644
+ )
645
+ return !1;
646
+ }
647
+ }
648
+ return !0;
649
+ }, bn = f({}, ["annotation-xml", "color-profile", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "missing-glyph"]), wt = function(e) {
650
+ return !bn[_e(e)] && b(cn, e);
651
+ }, On = function(e, t, r, a) {
652
+ if (L && typeof he == "object" && typeof he.getAttributeType == "function" && !r)
653
+ switch (he.getAttributeType(e, t)) {
654
+ case "TrustedHTML":
655
+ return K(a);
656
+ case "TrustedScriptURL":
657
+ return Zt(a);
658
+ }
659
+ return a;
660
+ }, Rn = function(e, t, r, a) {
661
+ try {
662
+ r ? e.setAttributeNS(r, t, a) : e.setAttribute(t, a), Oe(e) ? B(e) : xt(o.removed);
663
+ } catch (c) {
664
+ V(t, e);
665
+ }
666
+ }, Ct = function(e) {
667
+ F(g.beforeSanitizeAttributes, e, null);
668
+ const t = e.attributes;
669
+ if (!t || Oe(e))
670
+ return;
671
+ const r = {
672
+ attrName: "",
673
+ attrValue: "",
674
+ keepAttr: !0,
675
+ allowedAttributes: T,
676
+ forceKeepAttr: void 0
677
+ };
678
+ let a = t.length;
679
+ const c = h(e.nodeName);
680
+ for (; a--; ) {
681
+ const p = t[a], y = p.name, E = p.namespaceURI, M = p.value, P = h(y), Xe = M;
682
+ let I = y === "value" ? Xe : vn(Xe);
683
+ if (r.attrName = P, r.attrValue = I, r.keepAttr = !0, r.forceKeepAttr = void 0, F(g.uponSanitizeAttribute, e, r), I = r.attrValue, Tt && (P === "id" || P === "name") && vt(I, _t) !== 0 && (V(y, e), I = _t + I), ue && b(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, I)) {
684
+ V(y, e);
685
+ continue;
686
+ }
687
+ if (P === "attributename" && kt(I, "href")) {
688
+ V(y, e);
689
+ continue;
690
+ }
691
+ if (!r.forceKeepAttr) {
692
+ if (!r.keepAttr) {
693
+ V(y, e);
694
+ continue;
695
+ }
696
+ if (!mt && b(no, I)) {
697
+ V(y, e);
698
+ continue;
699
+ }
700
+ if (G && (I = be(I)), !Lt(c, P, I)) {
701
+ V(y, e);
702
+ continue;
703
+ }
704
+ I = On(c, P, E, I), I !== Xe && Rn(e, y, E, I);
705
+ }
706
+ }
707
+ F(g.afterSanitizeAttributes, e, null);
708
+ }, Re = function(e) {
709
+ let t = null;
710
+ const r = It(e);
711
+ for (F(g.beforeSanitizeShadowDOM, e, null); t = r.nextNode(); )
712
+ if (F(g.uponSanitizeShadowNode, t, null), Dt(t), Ct(t), te(t.content) && Re(t.content), (C ? C(t) : t.nodeType) === v.element) {
713
+ const c = nt(t);
714
+ te(c) && ($e(c), Re(c));
715
+ }
716
+ F(g.afterSanitizeShadowDOM, e, null);
717
+ }, $e = function(e) {
718
+ const t = [{
719
+ node: e,
720
+ shadow: null
721
+ }];
722
+ for (; t.length > 0; ) {
723
+ const r = t.pop();
724
+ if (r.shadow) {
725
+ Re(r.shadow);
726
+ continue;
727
+ }
728
+ const a = r.node, p = (C ? C(a) : a.nodeType) === v.element, y = ae(a);
729
+ if (y)
730
+ for (let E = y.length - 1; E >= 0; --E)
731
+ t.push({
732
+ node: y[E],
733
+ shadow: null
734
+ });
735
+ if (p) {
736
+ const E = z ? z(a) : null;
737
+ if (typeof E == "string" && h(E) === "template") {
738
+ const M = a.content;
739
+ te(M) && t.push({
740
+ node: M,
741
+ shadow: null
742
+ });
743
+ }
744
+ }
745
+ if (p) {
746
+ const E = nt(a);
747
+ te(E) && t.push({
748
+ node: null,
749
+ shadow: E
750
+ }, {
751
+ node: E,
752
+ shadow: null
753
+ });
754
+ }
755
+ }
756
+ };
757
+ return o.sanitize = function(i) {
758
+ let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, t = null, r = null, a = null, c = null;
759
+ if (He = !i, He && (i = "<!-->"), typeof i != "string" && !pe(i) && (i = Gn(i), typeof i != "string"))
760
+ throw q("dirty is not a string, aborting");
761
+ if (!o.isSupported)
762
+ return i;
763
+ Me ? (d = Pe, T = xe) : Ye(e), (g.uponSanitizeElement.length > 0 || g.uponSanitizeAttribute.length > 0) && (d = D(d)), g.uponSanitizeAttribute.length > 0 && (T = D(T)), o.removed = [];
764
+ const p = Ue && typeof i != "string" && pe(i);
765
+ if (p) {
766
+ const M = z ? z(i) : i.nodeName;
767
+ if (typeof M == "string") {
768
+ const P = h(M);
769
+ if (!d[P] || ce[P])
770
+ throw q("root node is forbidden and cannot be sanitized in-place");
771
+ }
772
+ if (Oe(i))
773
+ throw q("root node is clobbered and cannot be sanitized in-place");
774
+ try {
775
+ $e(i);
776
+ } catch (P) {
777
+ throw Rt(i), P;
778
+ }
779
+ } else if (pe(i))
780
+ t = Nt("<!---->"), r = t.ownerDocument.importNode(i, !0), r.nodeType === v.element && r.nodeName === "BODY" || r.nodeName === "HTML" ? t = r : t.appendChild(r), $e(r);
781
+ else {
782
+ if (!Z && !G && !X && // eslint-disable-next-line unicorn/prefer-includes
783
+ i.indexOf("<") === -1)
784
+ return L && Ae ? K(i) : i;
785
+ if (t = Nt(i), !t)
786
+ return Z ? null : Ae ? $ : "";
787
+ }
788
+ t && ke && B(t.firstChild);
789
+ const y = It(p ? i : t);
790
+ try {
791
+ for (; a = y.nextNode(); )
792
+ Dt(a), Ct(a), te(a.content) && Re(a.content);
793
+ } catch (M) {
794
+ throw p && Rt(i), M;
795
+ }
796
+ if (p)
797
+ return me(o.removed, (M) => {
798
+ M.element && An(M.element);
799
+ }), G && je(i), i;
800
+ if (Z) {
801
+ if (G && je(t), Ee)
802
+ for (c = Qt.call(t.ownerDocument); t.firstChild; )
803
+ c.appendChild(t.firstChild);
804
+ else
805
+ c = t;
806
+ return (T.shadowroot || T.shadowrootmode) && (c = tn.call(l, c, !0)), c;
807
+ }
808
+ let E = X ? t.outerHTML : t.innerHTML;
809
+ return X && d["!doctype"] && t.ownerDocument && t.ownerDocument.doctype && t.ownerDocument.doctype.name && b(Jn, t.ownerDocument.doctype.name) && (E = "<!DOCTYPE " + t.ownerDocument.doctype.name + `>
810
+ ` + E), G && (E = be(E)), L && Ae ? K(E) : E;
811
+ }, o.setConfig = function() {
812
+ let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
813
+ Ye(i), Me = !0, Pe = d, xe = T;
814
+ }, o.clearConfig = function() {
815
+ ee = null, Me = !1, Pe = null, xe = null, L = Le, $ = "";
816
+ }, o.isValidAttribute = function(i, e, t) {
817
+ ee || Ye({});
818
+ const r = h(i), a = h(e);
819
+ return Lt(r, a, t);
820
+ }, o.addHook = function(i, e) {
821
+ typeof e == "function" && S(g, i) && ne(g[i], e);
822
+ }, o.removeHook = function(i, e) {
823
+ if (S(g, i)) {
824
+ if (e !== void 0) {
825
+ const t = xn(g[i], e);
826
+ return t === -1 ? void 0 : kn(g[i], t, 1)[0];
827
+ }
828
+ return xt(g[i]);
829
+ }
830
+ }, o.removeHooks = function(i) {
831
+ S(g, i) && (g[i] = []);
832
+ }, o.removeAllHooks = function() {
833
+ g = jt();
834
+ }, o;
835
+ }
836
+ var io = Vt();
837
+ export {
838
+ io as default
839
+ };