@clevertask/scribe 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/{BarMenu-DaKIz3zZ.js → BarMenu-BNk2I0zi.js} +1 -1
  2. package/dist/assets/index.css +1 -1
  3. package/dist/components/Menu/BarMenu.js +2 -2
  4. package/dist/components/Menu/BubbleMenu.js +378 -1445
  5. package/dist/components/Menu/Mobile/ListOptionBar.d.ts +1 -1
  6. package/dist/components/Menu/Mobile/ListOptionBar.d.ts.map +1 -1
  7. package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
  8. package/dist/components/Scribe/extension/emoji/suggest.js +1 -1
  9. package/dist/components/Scribe/extension/extension-link.js +1 -1
  10. package/dist/components/Scribe/extension/extension-markdown-paste.js +2 -2
  11. package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
  12. package/dist/components/Scribe/extension/index.js +5735 -3383
  13. package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
  14. package/dist/components/Scribe/extension/slashCommand/renderItems.js +1 -1
  15. package/dist/components/Scribe/extension/tableOfContents.js +1 -1
  16. package/dist/components/Scribe/index.js +5 -5
  17. package/dist/{extension-link-Ch_T7WWG.js → extension-link-P1rro4zO.js} +247 -218
  18. package/dist/floating-ui.dom-ZRy7FSVk.js +1246 -0
  19. package/dist/{index-DxF-1P4n.js → index-BMISMQrG.js} +168 -147
  20. package/dist/{index-CqzMmrnw.js → index-ByyiiYsp.js} +1 -1
  21. package/dist/{index-BiBV5TQx.js → index-CnKS-BY2.js} +2644 -2323
  22. package/dist/index-CnQHDObA.js +539 -0
  23. package/dist/main.js +1 -1
  24. package/dist/{markdown-to-html-pL7ckd-m.js → markdown-to-html-Bw9L43K6.js} +1 -1
  25. package/dist/purify.es-DC1iJOxX.js +864 -0
  26. package/dist/utils/create-scribe-editor.js +3 -3
  27. package/dist/utils/html-to-markdown.js +1 -1
  28. package/dist/utils/index.js +1 -1
  29. package/dist/utils/markdown-to-html.js +2 -2
  30. package/package.json +31 -31
  31. package/dist/index-V-gN11Y9.js +0 -249
  32. package/dist/purify.es-exIQuqhb.js +0 -595
@@ -1,595 +0,0 @@
1
- const {
2
- entries: yt,
3
- setPrototypeOf: mt,
4
- isFrozen: Kt,
5
- getPrototypeOf: Zt,
6
- getOwnPropertyDescriptor: Jt
7
- } = Object;
8
- let {
9
- freeze: y,
10
- seal: N,
11
- create: X
12
- } = Object, {
13
- apply: Fe,
14
- construct: He
15
- } = typeof Reflect < "u" && Reflect;
16
- y || (y = function(n) {
17
- return n;
18
- });
19
- N || (N = function(n) {
20
- return n;
21
- });
22
- Fe || (Fe = function(n, l) {
23
- for (var a = arguments.length, c = new Array(a > 2 ? a - 2 : 0), b = 2; b < a; b++)
24
- c[b - 2] = arguments[b];
25
- return n.apply(l, c);
26
- });
27
- He || (He = function(n) {
28
- for (var l = arguments.length, a = new Array(l > 1 ? l - 1 : 0), c = 1; c < l; c++)
29
- a[c - 1] = arguments[c];
30
- return new n(...a);
31
- });
32
- const ee = T(Array.prototype.forEach), Qt = T(Array.prototype.lastIndexOf), pt = T(Array.prototype.pop), te = T(Array.prototype.push), en = T(Array.prototype.splice), O = Array.isArray, ie = T(String.prototype.toLowerCase), Pe = T(String.prototype.toString), Tt = T(String.prototype.match), Y = T(String.prototype.replace), dt = T(String.prototype.indexOf), tn = T(String.prototype.trim), nn = T(Number.prototype.toString), on = T(Boolean.prototype.toString), _t = typeof BigInt > "u" ? null : T(BigInt.prototype.toString), Et = typeof Symbol > "u" ? null : T(Symbol.prototype.toString), u = T(Object.prototype.hasOwnProperty), ne = T(Object.prototype.toString), g = T(RegExp.prototype.test), de = rn(TypeError);
33
- function T(i) {
34
- return function(n) {
35
- n instanceof RegExp && (n.lastIndex = 0);
36
- for (var l = arguments.length, a = new Array(l > 1 ? l - 1 : 0), c = 1; c < l; c++)
37
- a[c - 1] = arguments[c];
38
- return Fe(i, n, a);
39
- };
40
- }
41
- function rn(i) {
42
- return function() {
43
- for (var n = arguments.length, l = new Array(n), a = 0; a < n; a++)
44
- l[a] = arguments[a];
45
- return He(i, l);
46
- };
47
- }
48
- function s(i, n) {
49
- let l = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ie;
50
- if (mt && mt(i, null), !O(n))
51
- return i;
52
- let a = n.length;
53
- for (; a--; ) {
54
- let c = n[a];
55
- if (typeof c == "string") {
56
- const b = l(c);
57
- b !== c && (Kt(n) || (n[a] = b), c = b);
58
- }
59
- i[c] = !0;
60
- }
61
- return i;
62
- }
63
- function an(i) {
64
- for (let n = 0; n < i.length; n++)
65
- u(i, n) || (i[n] = null);
66
- return i;
67
- }
68
- function I(i) {
69
- const n = X(null);
70
- for (const [l, a] of yt(i))
71
- u(i, l) && (O(a) ? n[l] = an(a) : a && typeof a == "object" && a.constructor === Object ? n[l] = I(a) : n[l] = a);
72
- return n;
73
- }
74
- function sn(i) {
75
- switch (typeof i) {
76
- case "string":
77
- return i;
78
- case "number":
79
- return nn(i);
80
- case "boolean":
81
- return on(i);
82
- case "bigint":
83
- return _t ? _t(i) : "0";
84
- case "symbol":
85
- return Et ? Et(i) : "Symbol()";
86
- case "undefined":
87
- return ne(i);
88
- case "function":
89
- case "object": {
90
- if (i === null)
91
- return ne(i);
92
- const n = i, l = j(n, "toString");
93
- if (typeof l == "function") {
94
- const a = l(n);
95
- return typeof a == "string" ? a : ne(a);
96
- }
97
- return ne(i);
98
- }
99
- default:
100
- return ne(i);
101
- }
102
- }
103
- function j(i, n) {
104
- for (; i !== null; ) {
105
- const a = Jt(i, n);
106
- if (a) {
107
- if (a.get)
108
- return T(a.get);
109
- if (typeof a.value == "function")
110
- return T(a.value);
111
- }
112
- i = Zt(i);
113
- }
114
- function l() {
115
- return null;
116
- }
117
- return l;
118
- }
119
- function ln(i) {
120
- try {
121
- return g(i, ""), !0;
122
- } catch {
123
- return !1;
124
- }
125
- }
126
- const At = y(["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"]), xe = y(["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 = y(["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"]), cn = y(["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"]), Ue = y(["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"]), fn = y(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), gt = y(["#text"]), ht = y(["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", "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"]), ve = y(["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"]), St = y(["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"]), _e = y(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), un = N(/\{\{[\w\W]*|[\w\W]*\}\}/gm), mn = N(/<%[\w\W]*|[\w\W]*%>/gm), pn = N(/\$\{[\w\W]*/gm), Tn = N(/^data-[\-\w.\u00B7-\uFFFF]+$/), dn = N(/^aria-[\-\w]+$/), bt = N(
127
- /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
128
- // eslint-disable-line no-useless-escape
129
- ), _n = N(/^(?:\w+script|data):/i), En = N(
130
- /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
131
- // eslint-disable-line no-control-regex
132
- ), Dt = N(/^html$/i), An = N(/^[a-z][.\w]*(-[.\w]+)+$/i);
133
- var Rt = /* @__PURE__ */ Object.freeze({
134
- __proto__: null,
135
- ARIA_ATTR: dn,
136
- ATTR_WHITESPACE: En,
137
- CUSTOM_ELEMENT: An,
138
- DATA_ATTR: Tn,
139
- DOCTYPE_NAME: Dt,
140
- ERB_EXPR: mn,
141
- IS_ALLOWED_URI: bt,
142
- IS_SCRIPT_OR_DATA: _n,
143
- MUSTACHE_EXPR: un,
144
- TMPLIT_EXPR: pn
145
- });
146
- const oe = {
147
- element: 1,
148
- text: 3,
149
- // Deprecated
150
- progressingInstruction: 7,
151
- comment: 8,
152
- document: 9
153
- }, gn = function() {
154
- return typeof window > "u" ? null : window;
155
- }, hn = function(n, l) {
156
- if (typeof n != "object" || typeof n.createPolicy != "function")
157
- return null;
158
- let a = null;
159
- const c = "data-tt-policy-suffix";
160
- l && l.hasAttribute(c) && (a = l.getAttribute(c));
161
- const b = "dompurify" + (a ? "#" + a : "");
162
- try {
163
- return n.createPolicy(b, {
164
- createHTML(H) {
165
- return H;
166
- },
167
- createScriptURL(H) {
168
- return H;
169
- }
170
- });
171
- } catch {
172
- return console.warn("TrustedTypes policy " + b + " could not be created."), null;
173
- }
174
- }, Ot = function() {
175
- return {
176
- afterSanitizeAttributes: [],
177
- afterSanitizeElements: [],
178
- afterSanitizeShadowDOM: [],
179
- beforeSanitizeAttributes: [],
180
- beforeSanitizeElements: [],
181
- beforeSanitizeShadowDOM: [],
182
- uponSanitizeAttribute: [],
183
- uponSanitizeElement: [],
184
- uponSanitizeShadowNode: []
185
- };
186
- };
187
- function It() {
188
- let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : gn();
189
- const n = (r) => It(r);
190
- if (n.version = "3.4.1", n.removed = [], !i || !i.document || i.document.nodeType !== oe.document || !i.Element)
191
- return n.isSupported = !1, n;
192
- let {
193
- document: l
194
- } = i;
195
- const a = l, c = a.currentScript, {
196
- DocumentFragment: b,
197
- HTMLTemplateElement: H,
198
- Node: Ee,
199
- Element: ze,
200
- NodeFilter: V,
201
- NamedNodeMap: Lt = i.NamedNodeMap || i.MozNamedAttrMap,
202
- HTMLFormElement: Nt,
203
- DOMParser: Ct,
204
- trustedTypes: re
205
- } = i, $ = ze.prototype, Mt = j($, "cloneNode"), wt = j($, "remove"), Pt = j($, "nextSibling"), xt = j($, "childNodes"), ae = j($, "parentNode");
206
- if (typeof H == "function") {
207
- const r = l.createElement("template");
208
- r.content && r.content.ownerDocument && (l = r.content.ownerDocument);
209
- }
210
- let S, q = "";
211
- const {
212
- implementation: Ae,
213
- createNodeIterator: kt,
214
- createDocumentFragment: Ut,
215
- getElementsByTagName: vt
216
- } = l, {
217
- importNode: Ft
218
- } = a;
219
- let R = Ot();
220
- n.isSupported = typeof yt == "function" && typeof ae == "function" && Ae && Ae.createHTMLDocument !== void 0;
221
- const {
222
- MUSTACHE_EXPR: se,
223
- ERB_EXPR: le,
224
- TMPLIT_EXPR: ce,
225
- DATA_ATTR: Ht,
226
- ARIA_ATTR: zt,
227
- IS_SCRIPT_OR_DATA: Gt,
228
- ATTR_WHITESPACE: Ge,
229
- CUSTOM_ELEMENT: Bt
230
- } = Rt;
231
- let {
232
- IS_ALLOWED_URI: Be
233
- } = Rt, _ = null;
234
- const We = s({}, [...At, ...xe, ...ke, ...Ue, ...gt]);
235
- let A = null;
236
- const Ye = s({}, [...ht, ...ve, ...St, ..._e]);
237
- let m = Object.seal(X(null, {
238
- tagNameCheck: {
239
- writable: !0,
240
- configurable: !1,
241
- enumerable: !0,
242
- value: null
243
- },
244
- attributeNameCheck: {
245
- writable: !0,
246
- configurable: !1,
247
- enumerable: !0,
248
- value: null
249
- },
250
- allowCustomizedBuiltInElements: {
251
- writable: !0,
252
- configurable: !1,
253
- enumerable: !0,
254
- value: !1
255
- }
256
- })), K = null, fe = null;
257
- const k = Object.seal(X(null, {
258
- tagCheck: {
259
- writable: !0,
260
- configurable: !1,
261
- enumerable: !0,
262
- value: null
263
- },
264
- attributeCheck: {
265
- writable: !0,
266
- configurable: !1,
267
- enumerable: !0,
268
- value: null
269
- }
270
- }));
271
- let Xe = !0, ge = !0, je = !1, Ve = !0, U = !1, Z = !0, v = !1, he = !1, Se = !1, z = !1, ue = !1, me = !1, $e = !0, qe = !1;
272
- const Ke = "user-content-";
273
- let Re = !0, J = !1, G = {}, w = null;
274
- const Oe = s({}, ["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"]);
275
- let Ze = null;
276
- const Je = s({}, ["audio", "video", "img", "source", "image", "track"]);
277
- let ye = null;
278
- const Qe = s({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), pe = "http://www.w3.org/1998/Math/MathML", Te = "http://www.w3.org/2000/svg", P = "http://www.w3.org/1999/xhtml";
279
- let B = P, be = !1, De = null;
280
- const Wt = s({}, [pe, Te, P], Pe);
281
- let Ie = s({}, ["mi", "mo", "mn", "ms", "mtext"]), Le = s({}, ["annotation-xml"]);
282
- const Yt = s({}, ["title", "style", "font", "a", "script"]);
283
- let Q = null;
284
- const Xt = ["application/xhtml+xml", "text/html"], jt = "text/html";
285
- let d = null, W = null;
286
- const Vt = l.createElement("form"), et = function(e) {
287
- return e instanceof RegExp || e instanceof Function;
288
- }, Ne = function() {
289
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
290
- if (W && W === e)
291
- return;
292
- (!e || typeof e != "object") && (e = {}), e = I(e), Q = // eslint-disable-next-line unicorn/prefer-includes
293
- Xt.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? jt : e.PARSER_MEDIA_TYPE, d = Q === "application/xhtml+xml" ? Pe : ie, _ = u(e, "ALLOWED_TAGS") && O(e.ALLOWED_TAGS) ? s({}, e.ALLOWED_TAGS, d) : We, A = u(e, "ALLOWED_ATTR") && O(e.ALLOWED_ATTR) ? s({}, e.ALLOWED_ATTR, d) : Ye, De = u(e, "ALLOWED_NAMESPACES") && O(e.ALLOWED_NAMESPACES) ? s({}, e.ALLOWED_NAMESPACES, Pe) : Wt, ye = u(e, "ADD_URI_SAFE_ATTR") && O(e.ADD_URI_SAFE_ATTR) ? s(I(Qe), e.ADD_URI_SAFE_ATTR, d) : Qe, Ze = u(e, "ADD_DATA_URI_TAGS") && O(e.ADD_DATA_URI_TAGS) ? s(I(Je), e.ADD_DATA_URI_TAGS, d) : Je, w = u(e, "FORBID_CONTENTS") && O(e.FORBID_CONTENTS) ? s({}, e.FORBID_CONTENTS, d) : Oe, K = u(e, "FORBID_TAGS") && O(e.FORBID_TAGS) ? s({}, e.FORBID_TAGS, d) : I({}), fe = u(e, "FORBID_ATTR") && O(e.FORBID_ATTR) ? s({}, e.FORBID_ATTR, d) : I({}), G = u(e, "USE_PROFILES") ? e.USE_PROFILES && typeof e.USE_PROFILES == "object" ? I(e.USE_PROFILES) : e.USE_PROFILES : !1, Xe = e.ALLOW_ARIA_ATTR !== !1, ge = e.ALLOW_DATA_ATTR !== !1, je = e.ALLOW_UNKNOWN_PROTOCOLS || !1, Ve = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, U = e.SAFE_FOR_TEMPLATES || !1, Z = e.SAFE_FOR_XML !== !1, v = e.WHOLE_DOCUMENT || !1, z = e.RETURN_DOM || !1, ue = e.RETURN_DOM_FRAGMENT || !1, me = e.RETURN_TRUSTED_TYPE || !1, Se = e.FORCE_BODY || !1, $e = e.SANITIZE_DOM !== !1, qe = e.SANITIZE_NAMED_PROPS || !1, Re = e.KEEP_CONTENT !== !1, J = e.IN_PLACE || !1, Be = ln(e.ALLOWED_URI_REGEXP) ? e.ALLOWED_URI_REGEXP : bt, B = typeof e.NAMESPACE == "string" ? e.NAMESPACE : P, Ie = u(e, "MATHML_TEXT_INTEGRATION_POINTS") && e.MATHML_TEXT_INTEGRATION_POINTS && typeof e.MATHML_TEXT_INTEGRATION_POINTS == "object" ? I(e.MATHML_TEXT_INTEGRATION_POINTS) : s({}, ["mi", "mo", "mn", "ms", "mtext"]), Le = u(e, "HTML_INTEGRATION_POINTS") && e.HTML_INTEGRATION_POINTS && typeof e.HTML_INTEGRATION_POINTS == "object" ? I(e.HTML_INTEGRATION_POINTS) : s({}, ["annotation-xml"]);
294
- const t = u(e, "CUSTOM_ELEMENT_HANDLING") && e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING == "object" ? I(e.CUSTOM_ELEMENT_HANDLING) : X(null);
295
- if (m = X(null), u(t, "tagNameCheck") && et(t.tagNameCheck) && (m.tagNameCheck = t.tagNameCheck), u(t, "attributeNameCheck") && et(t.attributeNameCheck) && (m.attributeNameCheck = t.attributeNameCheck), u(t, "allowCustomizedBuiltInElements") && typeof t.allowCustomizedBuiltInElements == "boolean" && (m.allowCustomizedBuiltInElements = t.allowCustomizedBuiltInElements), U && (ge = !1), ue && (z = !0), G && (_ = s({}, gt), A = X(null), G.html === !0 && (s(_, At), s(A, ht)), G.svg === !0 && (s(_, xe), s(A, ve), s(A, _e)), G.svgFilters === !0 && (s(_, ke), s(A, ve), s(A, _e)), G.mathMl === !0 && (s(_, Ue), s(A, St), s(A, _e))), k.tagCheck = null, k.attributeCheck = null, u(e, "ADD_TAGS") && (typeof e.ADD_TAGS == "function" ? k.tagCheck = e.ADD_TAGS : O(e.ADD_TAGS) && (_ === We && (_ = I(_)), s(_, e.ADD_TAGS, d))), u(e, "ADD_ATTR") && (typeof e.ADD_ATTR == "function" ? k.attributeCheck = e.ADD_ATTR : O(e.ADD_ATTR) && (A === Ye && (A = I(A)), s(A, e.ADD_ATTR, d))), u(e, "ADD_URI_SAFE_ATTR") && O(e.ADD_URI_SAFE_ATTR) && s(ye, e.ADD_URI_SAFE_ATTR, d), u(e, "FORBID_CONTENTS") && O(e.FORBID_CONTENTS) && (w === Oe && (w = I(w)), s(w, e.FORBID_CONTENTS, d)), u(e, "ADD_FORBID_CONTENTS") && O(e.ADD_FORBID_CONTENTS) && (w === Oe && (w = I(w)), s(w, e.ADD_FORBID_CONTENTS, d)), Re && (_["#text"] = !0), v && s(_, ["html", "head", "body"]), _.table && (s(_, ["tbody"]), delete K.tbody), e.TRUSTED_TYPES_POLICY) {
296
- if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function")
297
- throw de('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
298
- if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function")
299
- throw de('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
300
- S = e.TRUSTED_TYPES_POLICY, q = S.createHTML("");
301
- } else
302
- S === void 0 && (S = hn(re, c)), S !== null && typeof q == "string" && (q = S.createHTML(""));
303
- y && y(e), W = e;
304
- }, tt = s({}, [...xe, ...ke, ...cn]), nt = s({}, [...Ue, ...fn]), $t = function(e) {
305
- let t = ae(e);
306
- (!t || !t.tagName) && (t = {
307
- namespaceURI: B,
308
- tagName: "template"
309
- });
310
- const o = ie(e.tagName), f = ie(t.tagName);
311
- return De[e.namespaceURI] ? e.namespaceURI === Te ? t.namespaceURI === P ? o === "svg" : t.namespaceURI === pe ? o === "svg" && (f === "annotation-xml" || Ie[f]) : !!tt[o] : e.namespaceURI === pe ? t.namespaceURI === P ? o === "math" : t.namespaceURI === Te ? o === "math" && Le[f] : !!nt[o] : e.namespaceURI === P ? t.namespaceURI === Te && !Le[f] || t.namespaceURI === pe && !Ie[f] ? !1 : !nt[o] && (Yt[o] || !tt[o]) : !!(Q === "application/xhtml+xml" && De[e.namespaceURI]) : !1;
312
- }, C = function(e) {
313
- te(n.removed, {
314
- element: e
315
- });
316
- try {
317
- ae(e).removeChild(e);
318
- } catch {
319
- wt(e);
320
- }
321
- }, F = function(e, t) {
322
- try {
323
- te(n.removed, {
324
- attribute: t.getAttributeNode(e),
325
- from: t
326
- });
327
- } catch {
328
- te(n.removed, {
329
- attribute: null,
330
- from: t
331
- });
332
- }
333
- if (t.removeAttribute(e), e === "is")
334
- if (z || ue)
335
- try {
336
- C(t);
337
- } catch {
338
- }
339
- else
340
- try {
341
- t.setAttribute(e, "");
342
- } catch {
343
- }
344
- }, ot = function(e) {
345
- let t = null, o = null;
346
- if (Se)
347
- e = "<remove></remove>" + e;
348
- else {
349
- const p = Tt(e, /^[\r\n\t ]+/);
350
- o = p && p[0];
351
- }
352
- Q === "application/xhtml+xml" && B === P && (e = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + e + "</body></html>");
353
- const f = S ? S.createHTML(e) : e;
354
- if (B === P)
355
- try {
356
- t = new Ct().parseFromString(f, Q);
357
- } catch {
358
- }
359
- if (!t || !t.documentElement) {
360
- t = Ae.createDocument(B, "template", null);
361
- try {
362
- t.documentElement.innerHTML = be ? q : f;
363
- } catch {
364
- }
365
- }
366
- const h = t.body || t.documentElement;
367
- return e && o && h.insertBefore(l.createTextNode(o), h.childNodes[0] || null), B === P ? vt.call(t, v ? "html" : "body")[0] : v ? t.documentElement : h;
368
- }, it = function(e) {
369
- return kt.call(
370
- e.ownerDocument || e,
371
- e,
372
- // eslint-disable-next-line no-bitwise
373
- V.SHOW_ELEMENT | V.SHOW_COMMENT | V.SHOW_TEXT | V.SHOW_PROCESSING_INSTRUCTION | V.SHOW_CDATA_SECTION,
374
- null
375
- );
376
- }, Ce = function(e) {
377
- return e instanceof Nt && (typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || !(e.attributes instanceof Lt) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function");
378
- }, Me = function(e) {
379
- return typeof Ee == "function" && e instanceof Ee;
380
- };
381
- function x(r, e, t) {
382
- ee(r, (o) => {
383
- o.call(n, e, t, W);
384
- });
385
- }
386
- const rt = function(e) {
387
- let t = null;
388
- if (x(R.beforeSanitizeElements, e, null), Ce(e))
389
- return C(e), !0;
390
- const o = d(e.nodeName);
391
- if (x(R.uponSanitizeElement, e, {
392
- tagName: o,
393
- allowedTags: _
394
- }), Z && e.hasChildNodes() && !Me(e.firstElementChild) && g(/<[/\w!]/g, e.innerHTML) && g(/<[/\w!]/g, e.textContent) || Z && e.namespaceURI === P && o === "style" && Me(e.firstElementChild) || e.nodeType === oe.progressingInstruction || Z && e.nodeType === oe.comment && g(/<[/\w]/g, e.data))
395
- return C(e), !0;
396
- if (K[o] || !(k.tagCheck instanceof Function && k.tagCheck(o)) && !_[o]) {
397
- if (!K[o] && st(o) && (m.tagNameCheck instanceof RegExp && g(m.tagNameCheck, o) || m.tagNameCheck instanceof Function && m.tagNameCheck(o)))
398
- return !1;
399
- if (Re && !w[o]) {
400
- const f = ae(e) || e.parentNode, h = xt(e) || e.childNodes;
401
- if (h && f) {
402
- const p = h.length;
403
- for (let D = p - 1; D >= 0; --D) {
404
- const L = Mt(h[D], !0);
405
- f.insertBefore(L, Pt(e));
406
- }
407
- }
408
- }
409
- return C(e), !0;
410
- }
411
- return e instanceof ze && !$t(e) || (o === "noscript" || o === "noembed" || o === "noframes") && g(/<\/no(script|embed|frames)/i, e.innerHTML) ? (C(e), !0) : (U && e.nodeType === oe.text && (t = e.textContent, ee([se, le, ce], (f) => {
412
- t = Y(t, f, " ");
413
- }), e.textContent !== t && (te(n.removed, {
414
- element: e.cloneNode()
415
- }), e.textContent = t)), x(R.afterSanitizeElements, e, null), !1);
416
- }, at = function(e, t, o) {
417
- if (fe[t] || $e && (t === "id" || t === "name") && (o in l || o in Vt))
418
- return !1;
419
- if (!(ge && !fe[t] && g(Ht, t))) {
420
- if (!(Xe && g(zt, t))) {
421
- if (!(k.attributeCheck instanceof Function && k.attributeCheck(t, e))) {
422
- if (!A[t] || fe[t]) {
423
- if (
424
- // First condition does a very basic check if a) it's basically a valid custom element tagname AND
425
- // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
426
- // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
427
- !(st(e) && (m.tagNameCheck instanceof RegExp && g(m.tagNameCheck, e) || m.tagNameCheck instanceof Function && m.tagNameCheck(e)) && (m.attributeNameCheck instanceof RegExp && g(m.attributeNameCheck, t) || m.attributeNameCheck instanceof Function && m.attributeNameCheck(t, e)) || // Alternative, second condition checks if it's an `is`-attribute, AND
428
- // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
429
- t === "is" && m.allowCustomizedBuiltInElements && (m.tagNameCheck instanceof RegExp && g(m.tagNameCheck, o) || m.tagNameCheck instanceof Function && m.tagNameCheck(o)))
430
- ) return !1;
431
- } else if (!ye[t]) {
432
- if (!g(Be, Y(o, Ge, ""))) {
433
- if (!((t === "src" || t === "xlink:href" || t === "href") && e !== "script" && dt(o, "data:") === 0 && Ze[e])) {
434
- if (!(je && !g(Gt, Y(o, Ge, "")))) {
435
- if (o)
436
- return !1;
437
- }
438
- }
439
- }
440
- }
441
- }
442
- }
443
- }
444
- return !0;
445
- }, qt = s({}, ["annotation-xml", "color-profile", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "missing-glyph"]), st = function(e) {
446
- return !qt[ie(e)] && g(Bt, e);
447
- }, lt = function(e) {
448
- x(R.beforeSanitizeAttributes, e, null);
449
- const {
450
- attributes: t
451
- } = e;
452
- if (!t || Ce(e))
453
- return;
454
- const o = {
455
- attrName: "",
456
- attrValue: "",
457
- keepAttr: !0,
458
- allowedAttributes: A,
459
- forceKeepAttr: void 0
460
- };
461
- let f = t.length;
462
- for (; f--; ) {
463
- const h = t[f], {
464
- name: p,
465
- namespaceURI: D,
466
- value: L
467
- } = h, M = d(p), we = L;
468
- let E = p === "value" ? we : tn(we);
469
- if (o.attrName = M, o.attrValue = E, o.keepAttr = !0, o.forceKeepAttr = void 0, x(R.uponSanitizeAttribute, e, o), E = o.attrValue, qe && (M === "id" || M === "name") && dt(E, Ke) !== 0 && (F(p, e), E = Ke + E), Z && g(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, E)) {
470
- F(p, e);
471
- continue;
472
- }
473
- if (M === "attributename" && Tt(E, "href")) {
474
- F(p, e);
475
- continue;
476
- }
477
- if (o.forceKeepAttr)
478
- continue;
479
- if (!o.keepAttr) {
480
- F(p, e);
481
- continue;
482
- }
483
- if (!Ve && g(/\/>/i, E)) {
484
- F(p, e);
485
- continue;
486
- }
487
- U && ee([se, le, ce], (ut) => {
488
- E = Y(E, ut, " ");
489
- });
490
- const ft = d(e.nodeName);
491
- if (!at(ft, M, E)) {
492
- F(p, e);
493
- continue;
494
- }
495
- if (S && typeof re == "object" && typeof re.getAttributeType == "function" && !D)
496
- switch (re.getAttributeType(ft, M)) {
497
- case "TrustedHTML": {
498
- E = S.createHTML(E);
499
- break;
500
- }
501
- case "TrustedScriptURL": {
502
- E = S.createScriptURL(E);
503
- break;
504
- }
505
- }
506
- if (E !== we)
507
- try {
508
- D ? e.setAttributeNS(D, p, E) : e.setAttribute(p, E), Ce(e) ? C(e) : pt(n.removed);
509
- } catch {
510
- F(p, e);
511
- }
512
- }
513
- x(R.afterSanitizeAttributes, e, null);
514
- }, ct = function(e) {
515
- let t = null;
516
- const o = it(e);
517
- for (x(R.beforeSanitizeShadowDOM, e, null); t = o.nextNode(); )
518
- x(R.uponSanitizeShadowNode, t, null), rt(t), lt(t), t.content instanceof b && ct(t.content);
519
- x(R.afterSanitizeShadowDOM, e, null);
520
- };
521
- return n.sanitize = function(r) {
522
- let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, t = null, o = null, f = null, h = null;
523
- if (be = !r, be && (r = "<!-->"), typeof r != "string" && !Me(r) && (r = sn(r), typeof r != "string"))
524
- throw de("dirty is not a string, aborting");
525
- if (!n.isSupported)
526
- return r;
527
- if (he || Ne(e), n.removed = [], typeof r == "string" && (J = !1), J) {
528
- const L = r.nodeName;
529
- if (typeof L == "string") {
530
- const M = d(L);
531
- if (!_[M] || K[M])
532
- throw de("root node is forbidden and cannot be sanitized in-place");
533
- }
534
- } else if (r instanceof Ee)
535
- t = ot("<!---->"), o = t.ownerDocument.importNode(r, !0), o.nodeType === oe.element && o.nodeName === "BODY" || o.nodeName === "HTML" ? t = o : t.appendChild(o);
536
- else {
537
- if (!z && !U && !v && // eslint-disable-next-line unicorn/prefer-includes
538
- r.indexOf("<") === -1)
539
- return S && me ? S.createHTML(r) : r;
540
- if (t = ot(r), !t)
541
- return z ? null : me ? q : "";
542
- }
543
- t && Se && C(t.firstChild);
544
- const p = it(J ? r : t);
545
- for (; f = p.nextNode(); )
546
- rt(f), lt(f), f.content instanceof b && ct(f.content);
547
- if (J)
548
- return r;
549
- if (z) {
550
- if (U) {
551
- t.normalize();
552
- let L = t.innerHTML;
553
- ee([se, le, ce], (M) => {
554
- L = Y(L, M, " ");
555
- }), t.innerHTML = L;
556
- }
557
- if (ue)
558
- for (h = Ut.call(t.ownerDocument); t.firstChild; )
559
- h.appendChild(t.firstChild);
560
- else
561
- h = t;
562
- return (A.shadowroot || A.shadowrootmode) && (h = Ft.call(a, h, !0)), h;
563
- }
564
- let D = v ? t.outerHTML : t.innerHTML;
565
- return v && _["!doctype"] && t.ownerDocument && t.ownerDocument.doctype && t.ownerDocument.doctype.name && g(Dt, t.ownerDocument.doctype.name) && (D = "<!DOCTYPE " + t.ownerDocument.doctype.name + `>
566
- ` + D), U && ee([se, le, ce], (L) => {
567
- D = Y(D, L, " ");
568
- }), S && me ? S.createHTML(D) : D;
569
- }, n.setConfig = function() {
570
- let r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
571
- Ne(r), he = !0;
572
- }, n.clearConfig = function() {
573
- W = null, he = !1;
574
- }, n.isValidAttribute = function(r, e, t) {
575
- W || Ne({});
576
- const o = d(r), f = d(e);
577
- return at(o, f, t);
578
- }, n.addHook = function(r, e) {
579
- typeof e == "function" && te(R[r], e);
580
- }, n.removeHook = function(r, e) {
581
- if (e !== void 0) {
582
- const t = Qt(R[r], e);
583
- return t === -1 ? void 0 : en(R[r], t, 1)[0];
584
- }
585
- return pt(R[r]);
586
- }, n.removeHooks = function(r) {
587
- R[r] = [];
588
- }, n.removeAllHooks = function() {
589
- R = Ot();
590
- }, n;
591
- }
592
- var Sn = It();
593
- export {
594
- Sn as p
595
- };