@clevertask/scribe 0.0.0 → 0.0.2

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.
@@ -1,524 +0,0 @@
1
- /*! @license DOMPurify 3.2.2 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.2/LICENSE */
2
- const {
3
- entries: dt,
4
- setPrototypeOf: at,
5
- isFrozen: Wt,
6
- getPrototypeOf: Bt,
7
- getOwnPropertyDescriptor: Yt
8
- } = Object;
9
- let {
10
- freeze: A,
11
- seal: y,
12
- create: Tt
13
- } = Object, {
14
- apply: Me,
15
- construct: Ce
16
- } = typeof Reflect < "u" && Reflect;
17
- A || (A = function(o) {
18
- return o;
19
- });
20
- y || (y = function(o) {
21
- return o;
22
- });
23
- Me || (Me = function(o, l, s) {
24
- return o.apply(l, s);
25
- });
26
- Ce || (Ce = function(o, l) {
27
- return new o(...l);
28
- });
29
- const se = O(Array.prototype.forEach), rt = O(Array.prototype.pop), V = O(Array.prototype.push), ce = O(String.prototype.toLowerCase), Le = O(String.prototype.toString), st = O(String.prototype.match), $ = O(String.prototype.replace), Xt = O(String.prototype.indexOf), jt = O(String.prototype.trim), L = O(Object.prototype.hasOwnProperty), h = O(RegExp.prototype.test), q = Vt(TypeError);
30
- function O(r) {
31
- return function(o) {
32
- for (var l = arguments.length, s = new Array(l > 1 ? l - 1 : 0), T = 1; T < l; T++)
33
- s[T - 1] = arguments[T];
34
- return Me(r, o, s);
35
- };
36
- }
37
- function Vt(r) {
38
- return function() {
39
- for (var o = arguments.length, l = new Array(o), s = 0; s < o; s++)
40
- l[s] = arguments[s];
41
- return Ce(r, l);
42
- };
43
- }
44
- function a(r, o) {
45
- let l = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ce;
46
- at && at(r, null);
47
- let s = o.length;
48
- for (; s--; ) {
49
- let T = o[s];
50
- if (typeof T == "string") {
51
- const b = l(T);
52
- b !== T && (Wt(o) || (o[s] = b), T = b);
53
- }
54
- r[T] = !0;
55
- }
56
- return r;
57
- }
58
- function $t(r) {
59
- for (let o = 0; o < r.length; o++)
60
- L(r, o) || (r[o] = null);
61
- return r;
62
- }
63
- function w(r) {
64
- const o = Tt(null);
65
- for (const [l, s] of dt(r))
66
- L(r, l) && (Array.isArray(s) ? o[l] = $t(s) : s && typeof s == "object" && s.constructor === Object ? o[l] = w(s) : o[l] = s);
67
- return o;
68
- }
69
- function K(r, o) {
70
- for (; r !== null; ) {
71
- const s = Yt(r, o);
72
- if (s) {
73
- if (s.get)
74
- return O(s.get);
75
- if (typeof s.value == "function")
76
- return O(s.value);
77
- }
78
- r = Bt(r);
79
- }
80
- function l() {
81
- return null;
82
- }
83
- return l;
84
- }
85
- const lt = A(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), Ne = A(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), De = A(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), qt = A(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), be = A(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), Kt = A(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), ct = A(["#text"]), ft = A(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), Ie = A(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), ut = A(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), le = A(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), Zt = y(/\{\{[\w\W]*|[\w\W]*\}\}/gm), Jt = y(/<%[\w\W]*|[\w\W]*%>/gm), Qt = y(/\${[\w\W]*}/gm), en = y(/^data-[\-\w.\u00B7-\uFFFF]/), tn = y(/^aria-[\-\w]+$/), _t = y(
86
- /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
87
- // eslint-disable-line no-useless-escape
88
- ), nn = y(/^(?:\w+script|data):/i), on = y(
89
- /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
90
- // eslint-disable-line no-control-regex
91
- ), Et = y(/^html$/i), an = y(/^[a-z][.\w]*(-[.\w]+)+$/i);
92
- var mt = /* @__PURE__ */ Object.freeze({
93
- __proto__: null,
94
- ARIA_ATTR: tn,
95
- ATTR_WHITESPACE: on,
96
- CUSTOM_ELEMENT: an,
97
- DATA_ATTR: en,
98
- DOCTYPE_NAME: Et,
99
- ERB_EXPR: Jt,
100
- IS_ALLOWED_URI: _t,
101
- IS_SCRIPT_OR_DATA: nn,
102
- MUSTACHE_EXPR: Zt,
103
- TMPLIT_EXPR: Qt
104
- });
105
- const Z = {
106
- element: 1,
107
- attribute: 2,
108
- text: 3,
109
- cdataSection: 4,
110
- entityReference: 5,
111
- // Deprecated
112
- entityNode: 6,
113
- // Deprecated
114
- progressingInstruction: 7,
115
- comment: 8,
116
- document: 9,
117
- documentType: 10,
118
- documentFragment: 11,
119
- notation: 12
120
- // Deprecated
121
- }, rn = function() {
122
- return typeof window > "u" ? null : window;
123
- }, sn = function(o, l) {
124
- if (typeof o != "object" || typeof o.createPolicy != "function")
125
- return null;
126
- let s = null;
127
- const T = "data-tt-policy-suffix";
128
- l && l.hasAttribute(T) && (s = l.getAttribute(T));
129
- const b = "dompurify" + (s ? "#" + s : "");
130
- try {
131
- return o.createPolicy(b, {
132
- createHTML(P) {
133
- return P;
134
- },
135
- createScriptURL(P) {
136
- return P;
137
- }
138
- });
139
- } catch {
140
- return console.warn("TrustedTypes policy " + b + " could not be created."), null;
141
- }
142
- }, pt = function() {
143
- return {
144
- afterSanitizeAttributes: [],
145
- afterSanitizeElements: [],
146
- afterSanitizeShadowDOM: [],
147
- beforeSanitizeAttributes: [],
148
- beforeSanitizeElements: [],
149
- beforeSanitizeShadowDOM: [],
150
- uponSanitizeAttribute: [],
151
- uponSanitizeElement: [],
152
- uponSanitizeShadowNode: []
153
- };
154
- };
155
- function gt() {
156
- let r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : rn();
157
- const o = (i) => gt(i);
158
- if (o.version = "3.2.2", o.removed = [], !r || !r.document || r.document.nodeType !== Z.document)
159
- return o.isSupported = !1, o;
160
- let {
161
- document: l
162
- } = r;
163
- const s = l, T = s.currentScript, {
164
- DocumentFragment: b,
165
- HTMLTemplateElement: P,
166
- Node: fe,
167
- Element: we,
168
- NodeFilter: z,
169
- NamedNodeMap: ht = r.NamedNodeMap || r.MozNamedAttrMap,
170
- HTMLFormElement: At,
171
- DOMParser: St,
172
- trustedTypes: J
173
- } = r, G = we.prototype, Rt = K(G, "cloneNode"), Ot = K(G, "remove"), yt = K(G, "nextSibling"), Lt = K(G, "childNodes"), Q = K(G, "parentNode");
174
- if (typeof P == "function") {
175
- const i = l.createElement("template");
176
- i.content && i.content.ownerDocument && (l = i.content.ownerDocument);
177
- }
178
- let E, W = "";
179
- const {
180
- implementation: ue,
181
- createNodeIterator: Nt,
182
- createDocumentFragment: Dt,
183
- getElementsByTagName: bt
184
- } = l, {
185
- importNode: It
186
- } = s;
187
- let R = pt();
188
- o.isSupported = typeof dt == "function" && typeof Q == "function" && ue && ue.createHTMLDocument !== void 0;
189
- const {
190
- MUSTACHE_EXPR: me,
191
- ERB_EXPR: pe,
192
- TMPLIT_EXPR: de,
193
- DATA_ATTR: Mt,
194
- ARIA_ATTR: Ct,
195
- IS_SCRIPT_OR_DATA: wt,
196
- ATTR_WHITESPACE: Pe,
197
- CUSTOM_ELEMENT: Pt
198
- } = mt;
199
- let {
200
- IS_ALLOWED_URI: xe
201
- } = mt, u = null;
202
- const ve = a({}, [...lt, ...Ne, ...De, ...be, ...ct]);
203
- let p = null;
204
- const ke = a({}, [...ft, ...Ie, ...ut, ...le]);
205
- let f = Object.seal(Tt(null, {
206
- tagNameCheck: {
207
- writable: !0,
208
- configurable: !1,
209
- enumerable: !0,
210
- value: null
211
- },
212
- attributeNameCheck: {
213
- writable: !0,
214
- configurable: !1,
215
- enumerable: !0,
216
- value: null
217
- },
218
- allowCustomizedBuiltInElements: {
219
- writable: !0,
220
- configurable: !1,
221
- enumerable: !0,
222
- value: !1
223
- }
224
- })), B = null, Te = null, Ue = !0, _e = !0, Fe = !1, He = !0, x = !1, Ee = !0, C = !1, ge = !1, he = !1, v = !1, ee = !1, te = !1, ze = !0, Ge = !1;
225
- const xt = "user-content-";
226
- let Ae = !0, Y = !1, k = {}, U = null;
227
- const We = a({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
228
- let Be = null;
229
- const Ye = a({}, ["audio", "video", "img", "source", "image", "track"]);
230
- let Se = null;
231
- const Xe = a({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), ne = "http://www.w3.org/1998/Math/MathML", oe = "http://www.w3.org/2000/svg", I = "http://www.w3.org/1999/xhtml";
232
- let F = I, Re = !1, Oe = null;
233
- const vt = a({}, [ne, oe, I], Le);
234
- let ie = a({}, ["mi", "mo", "mn", "ms", "mtext"]), ae = a({}, ["annotation-xml"]);
235
- const kt = a({}, ["title", "style", "font", "a", "script"]);
236
- let X = null;
237
- const Ut = ["application/xhtml+xml", "text/html"], Ft = "text/html";
238
- let m = null, H = null;
239
- const Ht = l.createElement("form"), je = function(e) {
240
- return e instanceof RegExp || e instanceof Function;
241
- }, ye = function() {
242
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
243
- if (!(H && H === e)) {
244
- if ((!e || typeof e != "object") && (e = {}), e = w(e), X = // eslint-disable-next-line unicorn/prefer-includes
245
- Ut.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? Ft : e.PARSER_MEDIA_TYPE, m = X === "application/xhtml+xml" ? Le : ce, u = L(e, "ALLOWED_TAGS") ? a({}, e.ALLOWED_TAGS, m) : ve, p = L(e, "ALLOWED_ATTR") ? a({}, e.ALLOWED_ATTR, m) : ke, Oe = L(e, "ALLOWED_NAMESPACES") ? a({}, e.ALLOWED_NAMESPACES, Le) : vt, Se = L(e, "ADD_URI_SAFE_ATTR") ? a(w(Xe), e.ADD_URI_SAFE_ATTR, m) : Xe, Be = L(e, "ADD_DATA_URI_TAGS") ? a(w(Ye), e.ADD_DATA_URI_TAGS, m) : Ye, U = L(e, "FORBID_CONTENTS") ? a({}, e.FORBID_CONTENTS, m) : We, B = L(e, "FORBID_TAGS") ? a({}, e.FORBID_TAGS, m) : {}, Te = L(e, "FORBID_ATTR") ? a({}, e.FORBID_ATTR, m) : {}, k = L(e, "USE_PROFILES") ? e.USE_PROFILES : !1, Ue = e.ALLOW_ARIA_ATTR !== !1, _e = e.ALLOW_DATA_ATTR !== !1, Fe = e.ALLOW_UNKNOWN_PROTOCOLS || !1, He = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, x = e.SAFE_FOR_TEMPLATES || !1, Ee = e.SAFE_FOR_XML !== !1, C = e.WHOLE_DOCUMENT || !1, v = e.RETURN_DOM || !1, ee = e.RETURN_DOM_FRAGMENT || !1, te = e.RETURN_TRUSTED_TYPE || !1, he = e.FORCE_BODY || !1, ze = e.SANITIZE_DOM !== !1, Ge = e.SANITIZE_NAMED_PROPS || !1, Ae = e.KEEP_CONTENT !== !1, Y = e.IN_PLACE || !1, xe = e.ALLOWED_URI_REGEXP || _t, F = e.NAMESPACE || I, ie = e.MATHML_TEXT_INTEGRATION_POINTS || ie, ae = e.HTML_INTEGRATION_POINTS || ae, f = e.CUSTOM_ELEMENT_HANDLING || {}, e.CUSTOM_ELEMENT_HANDLING && je(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (f.tagNameCheck = e.CUSTOM_ELEMENT_HANDLING.tagNameCheck), e.CUSTOM_ELEMENT_HANDLING && je(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (f.attributeNameCheck = e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (f.allowCustomizedBuiltInElements = e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), x && (_e = !1), ee && (v = !0), k && (u = a({}, ct), p = [], k.html === !0 && (a(u, lt), a(p, ft)), k.svg === !0 && (a(u, Ne), a(p, Ie), a(p, le)), k.svgFilters === !0 && (a(u, De), a(p, Ie), a(p, le)), k.mathMl === !0 && (a(u, be), a(p, ut), a(p, le))), e.ADD_TAGS && (u === ve && (u = w(u)), a(u, e.ADD_TAGS, m)), e.ADD_ATTR && (p === ke && (p = w(p)), a(p, e.ADD_ATTR, m)), e.ADD_URI_SAFE_ATTR && a(Se, e.ADD_URI_SAFE_ATTR, m), e.FORBID_CONTENTS && (U === We && (U = w(U)), a(U, e.FORBID_CONTENTS, m)), Ae && (u["#text"] = !0), C && a(u, ["html", "head", "body"]), u.table && (a(u, ["tbody"]), delete B.tbody), e.TRUSTED_TYPES_POLICY) {
246
- if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function")
247
- throw q('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
248
- if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function")
249
- throw q('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
250
- E = e.TRUSTED_TYPES_POLICY, W = E.createHTML("");
251
- } else
252
- E === void 0 && (E = sn(J, T)), E !== null && typeof W == "string" && (W = E.createHTML(""));
253
- A && A(e), H = e;
254
- }
255
- }, Ve = a({}, [...Ne, ...De, ...qt]), $e = a({}, [...be, ...Kt]), zt = function(e) {
256
- let t = Q(e);
257
- (!t || !t.tagName) && (t = {
258
- namespaceURI: F,
259
- tagName: "template"
260
- });
261
- const n = ce(e.tagName), c = ce(t.tagName);
262
- return Oe[e.namespaceURI] ? e.namespaceURI === oe ? t.namespaceURI === I ? n === "svg" : t.namespaceURI === ne ? n === "svg" && (c === "annotation-xml" || ie[c]) : !!Ve[n] : e.namespaceURI === ne ? t.namespaceURI === I ? n === "math" : t.namespaceURI === oe ? n === "math" && ae[c] : !!$e[n] : e.namespaceURI === I ? t.namespaceURI === oe && !ae[c] || t.namespaceURI === ne && !ie[c] ? !1 : !$e[n] && (kt[n] || !Ve[n]) : !!(X === "application/xhtml+xml" && Oe[e.namespaceURI]) : !1;
263
- }, N = function(e) {
264
- V(o.removed, {
265
- element: e
266
- });
267
- try {
268
- Q(e).removeChild(e);
269
- } catch {
270
- Ot(e);
271
- }
272
- }, re = function(e, t) {
273
- try {
274
- V(o.removed, {
275
- attribute: t.getAttributeNode(e),
276
- from: t
277
- });
278
- } catch {
279
- V(o.removed, {
280
- attribute: null,
281
- from: t
282
- });
283
- }
284
- if (t.removeAttribute(e), e === "is")
285
- if (v || ee)
286
- try {
287
- N(t);
288
- } catch {
289
- }
290
- else
291
- try {
292
- t.setAttribute(e, "");
293
- } catch {
294
- }
295
- }, qe = function(e) {
296
- let t = null, n = null;
297
- if (he)
298
- e = "<remove></remove>" + e;
299
- else {
300
- const d = st(e, /^[\r\n\t ]+/);
301
- n = d && d[0];
302
- }
303
- X === "application/xhtml+xml" && F === I && (e = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + e + "</body></html>");
304
- const c = E ? E.createHTML(e) : e;
305
- if (F === I)
306
- try {
307
- t = new St().parseFromString(c, X);
308
- } catch {
309
- }
310
- if (!t || !t.documentElement) {
311
- t = ue.createDocument(F, "template", null);
312
- try {
313
- t.documentElement.innerHTML = Re ? W : c;
314
- } catch {
315
- }
316
- }
317
- const _ = t.body || t.documentElement;
318
- return e && n && _.insertBefore(l.createTextNode(n), _.childNodes[0] || null), F === I ? bt.call(t, C ? "html" : "body")[0] : C ? t.documentElement : _;
319
- }, Ke = function(e) {
320
- return Nt.call(
321
- e.ownerDocument || e,
322
- e,
323
- // eslint-disable-next-line no-bitwise
324
- z.SHOW_ELEMENT | z.SHOW_COMMENT | z.SHOW_TEXT | z.SHOW_PROCESSING_INSTRUCTION | z.SHOW_CDATA_SECTION,
325
- null
326
- );
327
- }, Ze = function(e) {
328
- return e instanceof At && (typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || !(e.attributes instanceof ht) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function");
329
- }, Je = function(e) {
330
- return typeof fe == "function" && e instanceof fe;
331
- };
332
- function M(i, e, t) {
333
- se(i, (n) => {
334
- n.call(o, e, t, H);
335
- });
336
- }
337
- const Qe = function(e) {
338
- let t = null;
339
- if (M(R.beforeSanitizeElements, e, null), Ze(e))
340
- return N(e), !0;
341
- const n = m(e.nodeName);
342
- if (M(R.uponSanitizeElement, e, {
343
- tagName: n,
344
- allowedTags: u
345
- }), e.hasChildNodes() && !Je(e.firstElementChild) && h(/<[/\w]/g, e.innerHTML) && h(/<[/\w]/g, e.textContent) || e.nodeType === Z.progressingInstruction || Ee && e.nodeType === Z.comment && h(/<[/\w]/g, e.data))
346
- return N(e), !0;
347
- if (!u[n] || B[n]) {
348
- if (!B[n] && tt(n) && (f.tagNameCheck instanceof RegExp && h(f.tagNameCheck, n) || f.tagNameCheck instanceof Function && f.tagNameCheck(n)))
349
- return !1;
350
- if (Ae && !U[n]) {
351
- const c = Q(e) || e.parentNode, _ = Lt(e) || e.childNodes;
352
- if (_ && c) {
353
- const d = _.length;
354
- for (let S = d - 1; S >= 0; --S) {
355
- const D = Rt(_[S], !0);
356
- D.__removalCount = (e.__removalCount || 0) + 1, c.insertBefore(D, yt(e));
357
- }
358
- }
359
- }
360
- return N(e), !0;
361
- }
362
- return e instanceof we && !zt(e) || (n === "noscript" || n === "noembed" || n === "noframes") && h(/<\/no(script|embed|frames)/i, e.innerHTML) ? (N(e), !0) : (x && e.nodeType === Z.text && (t = e.textContent, se([me, pe, de], (c) => {
363
- t = $(t, c, " ");
364
- }), e.textContent !== t && (V(o.removed, {
365
- element: e.cloneNode()
366
- }), e.textContent = t)), M(R.afterSanitizeElements, e, null), !1);
367
- }, et = function(e, t, n) {
368
- if (ze && (t === "id" || t === "name") && (n in l || n in Ht))
369
- return !1;
370
- if (!(_e && !Te[t] && h(Mt, t))) {
371
- if (!(Ue && h(Ct, t))) {
372
- if (!p[t] || Te[t]) {
373
- if (
374
- // First condition does a very basic check if a) it's basically a valid custom element tagname AND
375
- // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
376
- // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
377
- !(tt(e) && (f.tagNameCheck instanceof RegExp && h(f.tagNameCheck, e) || f.tagNameCheck instanceof Function && f.tagNameCheck(e)) && (f.attributeNameCheck instanceof RegExp && h(f.attributeNameCheck, t) || f.attributeNameCheck instanceof Function && f.attributeNameCheck(t)) || // Alternative, second condition checks if it's an `is`-attribute, AND
378
- // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
379
- t === "is" && f.allowCustomizedBuiltInElements && (f.tagNameCheck instanceof RegExp && h(f.tagNameCheck, n) || f.tagNameCheck instanceof Function && f.tagNameCheck(n)))
380
- ) return !1;
381
- } else if (!Se[t]) {
382
- if (!h(xe, $(n, Pe, ""))) {
383
- if (!((t === "src" || t === "xlink:href" || t === "href") && e !== "script" && Xt(n, "data:") === 0 && Be[e])) {
384
- if (!(Fe && !h(wt, $(n, Pe, "")))) {
385
- if (n)
386
- return !1;
387
- }
388
- }
389
- }
390
- }
391
- }
392
- }
393
- return !0;
394
- }, tt = function(e) {
395
- return e !== "annotation-xml" && st(e, Pt);
396
- }, nt = function(e) {
397
- M(R.beforeSanitizeAttributes, e, null);
398
- const {
399
- attributes: t
400
- } = e;
401
- if (!t)
402
- return;
403
- const n = {
404
- attrName: "",
405
- attrValue: "",
406
- keepAttr: !0,
407
- allowedAttributes: p,
408
- forceKeepAttr: void 0
409
- };
410
- let c = t.length;
411
- for (; c--; ) {
412
- const _ = t[c], {
413
- name: d,
414
- namespaceURI: S,
415
- value: D
416
- } = _, j = m(d);
417
- let g = d === "value" ? D : jt(D);
418
- if (n.attrName = j, n.attrValue = g, n.keepAttr = !0, n.forceKeepAttr = void 0, M(R.uponSanitizeAttribute, e, n), g = n.attrValue, Ge && (j === "id" || j === "name") && (re(d, e), g = xt + g), Ee && h(/((--!?|])>)|<\/(style|title)/i, g)) {
419
- re(d, e);
420
- continue;
421
- }
422
- if (n.forceKeepAttr || (re(d, e), !n.keepAttr))
423
- continue;
424
- if (!He && h(/\/>/i, g)) {
425
- re(d, e);
426
- continue;
427
- }
428
- x && se([me, pe, de], (it) => {
429
- g = $(g, it, " ");
430
- });
431
- const ot = m(e.nodeName);
432
- if (et(ot, j, g)) {
433
- if (E && typeof J == "object" && typeof J.getAttributeType == "function" && !S)
434
- switch (J.getAttributeType(ot, j)) {
435
- case "TrustedHTML": {
436
- g = E.createHTML(g);
437
- break;
438
- }
439
- case "TrustedScriptURL": {
440
- g = E.createScriptURL(g);
441
- break;
442
- }
443
- }
444
- try {
445
- S ? e.setAttributeNS(S, d, g) : e.setAttribute(d, g), Ze(e) ? N(e) : rt(o.removed);
446
- } catch {
447
- }
448
- }
449
- }
450
- M(R.afterSanitizeAttributes, e, null);
451
- }, Gt = function i(e) {
452
- let t = null;
453
- const n = Ke(e);
454
- for (M(R.beforeSanitizeShadowDOM, e, null); t = n.nextNode(); )
455
- M(R.uponSanitizeShadowNode, t, null), !Qe(t) && (t.content instanceof b && i(t.content), nt(t));
456
- M(R.afterSanitizeShadowDOM, e, null);
457
- };
458
- return o.sanitize = function(i) {
459
- let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, t = null, n = null, c = null, _ = null;
460
- if (Re = !i, Re && (i = "<!-->"), typeof i != "string" && !Je(i))
461
- if (typeof i.toString == "function") {
462
- if (i = i.toString(), typeof i != "string")
463
- throw q("dirty is not a string, aborting");
464
- } else
465
- throw q("toString is not a function");
466
- if (!o.isSupported)
467
- return i;
468
- if (ge || ye(e), o.removed = [], typeof i == "string" && (Y = !1), Y) {
469
- if (i.nodeName) {
470
- const D = m(i.nodeName);
471
- if (!u[D] || B[D])
472
- throw q("root node is forbidden and cannot be sanitized in-place");
473
- }
474
- } else if (i instanceof fe)
475
- t = qe("<!---->"), n = t.ownerDocument.importNode(i, !0), n.nodeType === Z.element && n.nodeName === "BODY" || n.nodeName === "HTML" ? t = n : t.appendChild(n);
476
- else {
477
- if (!v && !x && !C && // eslint-disable-next-line unicorn/prefer-includes
478
- i.indexOf("<") === -1)
479
- return E && te ? E.createHTML(i) : i;
480
- if (t = qe(i), !t)
481
- return v ? null : te ? W : "";
482
- }
483
- t && he && N(t.firstChild);
484
- const d = Ke(Y ? i : t);
485
- for (; c = d.nextNode(); )
486
- Qe(c) || (c.content instanceof b && Gt(c.content), nt(c));
487
- if (Y)
488
- return i;
489
- if (v) {
490
- if (ee)
491
- for (_ = Dt.call(t.ownerDocument); t.firstChild; )
492
- _.appendChild(t.firstChild);
493
- else
494
- _ = t;
495
- return (p.shadowroot || p.shadowrootmode) && (_ = It.call(s, _, !0)), _;
496
- }
497
- let S = C ? t.outerHTML : t.innerHTML;
498
- return C && u["!doctype"] && t.ownerDocument && t.ownerDocument.doctype && t.ownerDocument.doctype.name && h(Et, t.ownerDocument.doctype.name) && (S = "<!DOCTYPE " + t.ownerDocument.doctype.name + `>
499
- ` + S), x && se([me, pe, de], (D) => {
500
- S = $(S, D, " ");
501
- }), E && te ? E.createHTML(S) : S;
502
- }, o.setConfig = function() {
503
- let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
504
- ye(i), ge = !0;
505
- }, o.clearConfig = function() {
506
- H = null, ge = !1;
507
- }, o.isValidAttribute = function(i, e, t) {
508
- H || ye({});
509
- const n = m(i), c = m(e);
510
- return et(n, c, t);
511
- }, o.addHook = function(i, e) {
512
- typeof e == "function" && V(R[i], e);
513
- }, o.removeHook = function(i) {
514
- return rt(R[i]);
515
- }, o.removeHooks = function(i) {
516
- R[i] = [];
517
- }, o.removeAllHooks = function() {
518
- R = pt();
519
- }, o;
520
- }
521
- var ln = gt();
522
- export {
523
- ln as p
524
- };