@clevertask/scribe 0.1.4 → 0.1.5

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 (85) hide show
  1. package/README.md +3 -0
  2. package/dist/BarMenu-V1uRL3bt.js +272 -0
  3. package/dist/assets/index.css +1 -1
  4. package/dist/components/Menu/BarMenu.d.ts.map +1 -1
  5. package/dist/components/Menu/BarMenu.js +2 -10
  6. package/dist/components/Menu/BubbleMenu.d.ts.map +1 -1
  7. package/dist/components/Menu/BubbleMenu.js +165 -1023
  8. package/dist/components/Menu/LinkBubbleMenu.d.ts +8 -0
  9. package/dist/components/Menu/LinkBubbleMenu.d.ts.map +1 -0
  10. package/dist/components/Menu/LinkBubbleMenu.js +78 -0
  11. package/dist/components/Menu/LinkEditor.d.ts +14 -0
  12. package/dist/components/Menu/LinkEditor.d.ts.map +1 -0
  13. package/dist/components/Menu/LinkEditor.js +140 -0
  14. package/dist/components/Menu/Mobile/ListOptionBar.d.ts.map +1 -1
  15. package/dist/components/Menu/Mobile/ListOptionBar.js +38 -44
  16. package/dist/components/Menu/linkBubbleMenuPlugin.d.ts +5 -0
  17. package/dist/components/Menu/linkBubbleMenuPlugin.d.ts.map +1 -0
  18. package/dist/components/Menu/linkBubbleMenuPlugin.js +7 -0
  19. package/dist/components/Menu/linkUrl.d.ts +2 -0
  20. package/dist/components/Menu/linkUrl.d.ts.map +1 -0
  21. package/dist/components/Menu/linkUrl.js +21 -0
  22. package/dist/components/Scribe/extension/emoji/EmojiList.js +58 -45
  23. package/dist/components/Scribe/extension/emoji/suggest.d.ts +2 -2
  24. package/dist/components/Scribe/extension/emoji/suggest.d.ts.map +1 -1
  25. package/dist/components/Scribe/extension/emoji/suggest.js +39 -43
  26. package/dist/components/Scribe/extension/extension-link.d.ts.map +1 -1
  27. package/dist/components/Scribe/extension/extension-link.js +2 -4
  28. package/dist/components/Scribe/extension/extension-markdown-paste.d.ts.map +1 -1
  29. package/dist/components/Scribe/extension/extension-markdown-paste.js +50 -45
  30. package/dist/components/Scribe/extension/extension-selectedText.d.ts.map +1 -1
  31. package/dist/components/Scribe/extension/extension-selectedText.js +10 -12
  32. package/dist/components/Scribe/extension/getPopupMountTarget.d.ts.map +1 -1
  33. package/dist/components/Scribe/extension/getPopupMountTarget.js +12 -15
  34. package/dist/components/Scribe/extension/index.d.ts +4 -4
  35. package/dist/components/Scribe/extension/index.d.ts.map +1 -1
  36. package/dist/components/Scribe/extension/index.js +2 -39521
  37. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +3369 -3731
  38. package/dist/components/Scribe/extension/slashCommand/index.js +2 -6
  39. package/dist/components/Scribe/extension/slashCommand/items.d.ts.map +1 -1
  40. package/dist/components/Scribe/extension/slashCommand/items.js +177 -176
  41. package/dist/components/Scribe/extension/slashCommand/renderItems.d.ts.map +1 -1
  42. package/dist/components/Scribe/extension/slashCommand/renderItems.js +35 -41
  43. package/dist/components/Scribe/extension/tableOfContents.js +153 -180
  44. package/dist/components/Scribe/index.d.ts.map +1 -1
  45. package/dist/components/Scribe/index.js +113 -153
  46. package/dist/dist-BQjH-i-q.js +7016 -0
  47. package/dist/dist-CnXCIcnl.js +3506 -0
  48. package/dist/dist-RuuEA1GJ.js +686 -0
  49. package/dist/extension-CZOsheCI.js +56236 -0
  50. package/dist/extension-link-DZID_SYl.js +908 -0
  51. package/dist/floating-ui.dom-rih69525.js +928 -0
  52. package/dist/html-to-markdown-CrNOkSye.js +497 -0
  53. package/dist/icons/ToolbarIcons.d.ts.map +1 -1
  54. package/dist/icons/ToolbarIcons.js +76 -135
  55. package/dist/main.css +10 -0
  56. package/dist/main.js +7 -15
  57. package/dist/markdown-to-html-DEczPfuq.js +1458 -0
  58. package/dist/menus-CzX7kyXn.js +633 -0
  59. package/dist/purify.es-DF9CW1cl.js +767 -0
  60. package/dist/rolldown-runtime-B8UxIWdF.js +7 -0
  61. package/dist/slashCommand-B7CRIaKG.js +429 -0
  62. package/dist/tables-CjOC70rm.js +1345 -0
  63. package/dist/tippy.esm-D9LL2xiE.js +1713 -0
  64. package/dist/utils/convert-legacy-math-delimiters.d.ts.map +1 -1
  65. package/dist/utils/convert-legacy-math-delimiters.js +7 -13
  66. package/dist/utils/create-scribe-editor.js +2 -31
  67. package/dist/utils/html-to-markdown.d.ts.map +1 -1
  68. package/dist/utils/html-to-markdown.js +2 -600
  69. package/dist/utils/index.js +24 -12
  70. package/dist/utils/is-in-viewport.d.ts.map +1 -1
  71. package/dist/utils/is-in-viewport.js +6 -6
  72. package/dist/utils/markdown-to-html.d.ts.map +1 -1
  73. package/dist/utils/markdown-to-html.js +2 -5
  74. package/dist/vite-env.d.js +0 -1
  75. package/package.json +36 -34
  76. package/dist/BarMenu-BNk2I0zi.js +0 -327
  77. package/dist/extension-link-P1rro4zO.js +0 -1059
  78. package/dist/floating-ui.dom-ZRy7FSVk.js +0 -1246
  79. package/dist/index-BMISMQrG.js +0 -855
  80. package/dist/index-ByyiiYsp.js +0 -1410
  81. package/dist/index-CnKS-BY2.js +0 -13834
  82. package/dist/index-CnQHDObA.js +0 -539
  83. package/dist/markdown-to-html-Bw9L43K6.js +0 -1135
  84. package/dist/purify.es-DC1iJOxX.js +0 -864
  85. package/dist/tippy.esm-DLHdsnfG.js +0 -1711
@@ -1,864 +0,0 @@
1
- function Pe(o, i) {
2
- (i == null || i > o.length) && (i = o.length);
3
- for (var s = 0, c = Array(i); s < i; s++) c[s] = o[s];
4
- return c;
5
- }
6
- function Dn(o) {
7
- if (Array.isArray(o)) return o;
8
- }
9
- function Ln(o, i) {
10
- var s = o == null ? null : typeof Symbol < "u" && o[Symbol.iterator] || o["@@iterator"];
11
- if (s != null) {
12
- var c, f, m, R, ct = [], M = !0, ut = !1;
13
- try {
14
- if (m = (s = s.call(o)).next, i !== 0) for (; !(M = (c = m.call(s)).done) && (ct.push(c.value), ct.length !== i); M = !0) ;
15
- } catch (Lt) {
16
- ut = !0, f = Lt;
17
- } finally {
18
- try {
19
- if (!M && s.return != null && (R = s.return(), Object(R) !== R)) return;
20
- } finally {
21
- if (ut) throw f;
22
- }
23
- }
24
- return ct;
25
- }
26
- }
27
- function wn() {
28
- throw new TypeError(`Invalid attempt to destructure non-iterable instance.
29
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
30
- }
31
- function Cn(o, i) {
32
- return Dn(o) || Ln(o, i) || Mn(o, i) || wn();
33
- }
34
- function Mn(o, i) {
35
- if (o) {
36
- if (typeof o == "string") return Pe(o, i);
37
- var s = {}.toString.call(o).slice(8, -1);
38
- return s === "Object" && o.constructor && (s = o.constructor.name), s === "Map" || s === "Set" ? Array.from(o) : s === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s) ? Pe(o, i) : void 0;
39
- }
40
- }
41
- const Ve = Object.entries, xe = Object.setPrototypeOf, Pn = Object.isFrozen, xn = Object.getPrototypeOf, kn = Object.getOwnPropertyDescriptor;
42
- let b = Object.freeze, O = Object.seal, lt = Object.create, qe = typeof Reflect < "u" && Reflect, ne = qe.apply, oe = qe.construct;
43
- b || (b = function(i) {
44
- return i;
45
- });
46
- O || (O = function(i) {
47
- return i;
48
- });
49
- ne || (ne = function(i, s) {
50
- for (var c = arguments.length, f = new Array(c > 2 ? c - 2 : 0), m = 2; m < c; m++)
51
- f[m - 2] = arguments[m];
52
- return i.apply(s, f);
53
- });
54
- oe || (oe = function(i) {
55
- for (var s = arguments.length, c = new Array(s > 1 ? s - 1 : 0), f = 1; f < s; f++)
56
- c[f - 1] = arguments[f];
57
- return new i(...c);
58
- });
59
- const at = A(Array.prototype.forEach), vn = A(Array.prototype.lastIndexOf), ke = A(Array.prototype.pop), st = A(Array.prototype.push), Un = A(Array.prototype.splice), $ = Array.isArray, _t = A(String.prototype.toLowerCase), Zt = A(String.prototype.toString), ve = A(String.prototype.match), Tt = A(String.prototype.replace), Ue = A(String.prototype.indexOf), Fn = A(String.prototype.trim), zn = A(Number.prototype.toString), Hn = A(Boolean.prototype.toString), Fe = typeof BigInt > "u" ? null : A(BigInt.prototype.toString), ze = typeof Symbol > "u" ? null : A(Symbol.prototype.toString), S = A(Object.prototype.hasOwnProperty), ht = A(Object.prototype.toString), y = A(RegExp.prototype.test), J = Gn(TypeError);
60
- function A(o) {
61
- return function(i) {
62
- i instanceof RegExp && (i.lastIndex = 0);
63
- for (var s = arguments.length, c = new Array(s > 1 ? s - 1 : 0), f = 1; f < s; f++)
64
- c[f - 1] = arguments[f];
65
- return ne(o, i, c);
66
- };
67
- }
68
- function Gn(o) {
69
- return function() {
70
- for (var i = arguments.length, s = new Array(i), c = 0; c < i; c++)
71
- s[c] = arguments[c];
72
- return oe(o, s);
73
- };
74
- }
75
- function p(o, i) {
76
- let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : _t;
77
- if (xe && xe(o, null), !$(i))
78
- return o;
79
- let c = i.length;
80
- for (; c--; ) {
81
- let f = i[c];
82
- if (typeof f == "string") {
83
- const m = s(f);
84
- m !== f && (Pn(i) || (i[c] = m), f = m);
85
- }
86
- o[f] = !0;
87
- }
88
- return o;
89
- }
90
- function Bn(o) {
91
- for (let i = 0; i < o.length; i++)
92
- S(o, i) || (o[i] = null);
93
- return o;
94
- }
95
- function L(o) {
96
- const i = lt(null);
97
- for (const c of Ve(o)) {
98
- var s = Cn(c, 2);
99
- const f = s[0], m = s[1];
100
- S(o, f) && ($(m) ? i[f] = Bn(m) : m && typeof m == "object" && m.constructor === Object ? i[f] = L(m) : i[f] = m);
101
- }
102
- return i;
103
- }
104
- function Wn(o) {
105
- switch (typeof o) {
106
- case "string":
107
- return o;
108
- case "number":
109
- return zn(o);
110
- case "boolean":
111
- return Hn(o);
112
- case "bigint":
113
- return Fe ? Fe(o) : "0";
114
- case "symbol":
115
- return ze ? ze(o) : "Symbol()";
116
- case "undefined":
117
- return ht(o);
118
- case "function":
119
- case "object": {
120
- if (o === null)
121
- return ht(o);
122
- const i = o, s = H(i, "toString");
123
- if (typeof s == "function") {
124
- const c = s(i);
125
- return typeof c == "string" ? c : ht(c);
126
- }
127
- return ht(o);
128
- }
129
- default:
130
- return ht(o);
131
- }
132
- }
133
- function H(o, i) {
134
- for (; o !== null; ) {
135
- const c = kn(o, i);
136
- if (c) {
137
- if (c.get)
138
- return A(c.get);
139
- if (typeof c.value == "function")
140
- return A(c.value);
141
- }
142
- o = xn(o);
143
- }
144
- function s() {
145
- return null;
146
- }
147
- return s;
148
- }
149
- function Yn(o) {
150
- try {
151
- return y(o, ""), !0;
152
- } catch {
153
- return !1;
154
- }
155
- }
156
- const He = b(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "search", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), Jt = b(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), Qt = b(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), jn = b(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), te = b(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), $n = b(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Ge = b(["#text"]), Be = b(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "command", "commandfor", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns"]), ee = b(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dominant-baseline", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "mask-type", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-orientation", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "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"]), We = b(["accent", "accentunder", "align", "bevelled", "close", "columnalign", "columnlines", "columnspacing", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lquote", "lspace", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), Dt = b(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), Xn = O(/{{[\w\W]*|^[\w\W]*}}/g), Vn = O(/<%[\w\W]*|^[\w\W]*%>/g), qn = O(/\${[\w\W]*/g), Kn = O(/^data-[\-\w.\u00B7-\uFFFF]+$/), Zn = O(/^aria-[\-\w]+$/), Ye = O(
157
- /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
158
- // eslint-disable-line no-useless-escape
159
- ), Jn = O(/^(?:\w+script|data):/i), Qn = O(
160
- /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
161
- // eslint-disable-line no-control-regex
162
- ), to = O(/^html$/i), eo = O(/^[a-z][.\w]*(-[.\w]+)+$/i), je = O(/<[/\w!]/g), $e = O(/<[/\w]/g), no = O(/<\/no(script|embed|frames)/i), oo = O(/\/>/i), P = {
163
- element: 1,
164
- attribute: 2,
165
- text: 3,
166
- cdataSection: 4,
167
- entityReference: 5,
168
- // Deprecated
169
- entityNode: 6,
170
- // Deprecated
171
- processingInstruction: 7,
172
- comment: 8,
173
- document: 9,
174
- documentType: 10,
175
- documentFragment: 11,
176
- notation: 12
177
- // Deprecated
178
- }, ro = function() {
179
- return typeof window > "u" ? null : window;
180
- }, io = function(i, s) {
181
- if (typeof i != "object" || typeof i.createPolicy != "function")
182
- return null;
183
- let c = null;
184
- const f = "data-tt-policy-suffix";
185
- s && s.hasAttribute(f) && (c = s.getAttribute(f));
186
- const m = "dompurify" + (c ? "#" + c : "");
187
- try {
188
- return i.createPolicy(m, {
189
- createHTML(R) {
190
- return R;
191
- },
192
- createScriptURL(R) {
193
- return R;
194
- }
195
- });
196
- } catch {
197
- return console.warn("TrustedTypes policy " + m + " could not be created."), null;
198
- }
199
- }, Xe = function() {
200
- return {
201
- afterSanitizeAttributes: [],
202
- afterSanitizeElements: [],
203
- afterSanitizeShadowDOM: [],
204
- beforeSanitizeAttributes: [],
205
- beforeSanitizeElements: [],
206
- beforeSanitizeShadowDOM: [],
207
- uponSanitizeAttribute: [],
208
- uponSanitizeElement: [],
209
- uponSanitizeShadowNode: []
210
- };
211
- }, j = function(i, s, c, f) {
212
- return S(i, s) && $(i[s]) ? p(f.base ? L(f.base) : {}, i[s], f.transform) : c;
213
- };
214
- function Ke() {
215
- let o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ro();
216
- const i = (r) => Ke(r);
217
- if (i.version = "3.4.12", i.removed = [], !o || !o.document || o.document.nodeType !== P.document || !o.Element)
218
- return i.isSupported = !1, i;
219
- let s = o.document;
220
- const c = s, f = c.currentScript;
221
- o.DocumentFragment;
222
- const m = o.HTMLTemplateElement, R = o.Node, ct = o.Element, M = o.NodeFilter, ut = o.NamedNodeMap;
223
- ut === void 0 && (o.NamedNodeMap || o.MozNamedAttrMap), o.HTMLFormElement;
224
- const Lt = o.DOMParser, gt = o.trustedTypes, X = ct.prototype, Ze = H(X, "cloneNode"), wt = H(X, "remove"), Je = H(X, "nextSibling"), Q = H(X, "childNodes"), V = H(X, "parentNode"), re = H(X, "shadowRoot"), Ct = H(X, "attributes"), I = R && R.prototype ? H(R.prototype, "nodeType") : null, v = R && R.prototype ? H(R.prototype, "nodeName") : null;
225
- if (typeof m == "function") {
226
- const r = s.createElement("template");
227
- r.content && r.content.ownerDocument && (s = r.content.ownerDocument);
228
- }
229
- let w, q = "", Mt, ie = !1, ft = 0;
230
- const ae = function() {
231
- if (ft > 0)
232
- throw J('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.');
233
- }, tt = function(t) {
234
- ae(), ft++;
235
- try {
236
- return w.createHTML(t);
237
- } finally {
238
- ft--;
239
- }
240
- }, Qe = function(t) {
241
- ae(), ft++;
242
- try {
243
- return w.createScriptURL(t);
244
- } finally {
245
- ft--;
246
- }
247
- }, tn = function() {
248
- return ie || (Mt = io(gt, f), ie = !0), Mt;
249
- }, Et = s, Pt = Et.implementation, se = Et.createNodeIterator, en = Et.createDocumentFragment, nn = Et.getElementsByTagName, on = c.importNode;
250
- let T = Xe();
251
- i.isSupported = typeof Ve == "function" && typeof V == "function" && Pt && Pt.createHTMLDocument !== void 0;
252
- const rn = Xn, an = Vn, sn = qn, ln = Kn, cn = Zn, un = Jn, le = Qn, fn = eo;
253
- let ce = Ye, h = null;
254
- const ue = p({}, [...He, ...Jt, ...Qt, ...te, ...Ge]);
255
- let _ = null;
256
- const fe = p({}, [...Be, ...ee, ...We, ...Dt]);
257
- let g = Object.seal(lt(null, {
258
- tagNameCheck: {
259
- writable: !0,
260
- configurable: !1,
261
- enumerable: !0,
262
- value: null
263
- },
264
- attributeNameCheck: {
265
- writable: !0,
266
- configurable: !1,
267
- enumerable: !0,
268
- value: null
269
- },
270
- allowCustomizedBuiltInElements: {
271
- writable: !0,
272
- configurable: !1,
273
- enumerable: !0,
274
- value: !1
275
- }
276
- })), pt = null, pe = null;
277
- const G = Object.seal(lt(null, {
278
- tagCheck: {
279
- writable: !0,
280
- configurable: !1,
281
- enumerable: !0,
282
- value: null
283
- },
284
- attributeCheck: {
285
- writable: !0,
286
- configurable: !1,
287
- enumerable: !0,
288
- value: null
289
- }
290
- }));
291
- let me = !0, xt = !0, de = !1, Te = !0, B = !1, W = !0, K = !1, kt = !1, vt = null, Ut = null, Ft = !1, et = !1, At = !1, yt = !1, he = !0, _e = !1;
292
- const ge = "user-content-";
293
- let zt = !0, Ht = !1, nt = {}, U = null;
294
- const Gt = p({}, [
295
- "annotation-xml",
296
- "audio",
297
- "colgroup",
298
- "desc",
299
- "foreignobject",
300
- "head",
301
- "iframe",
302
- "math",
303
- "mi",
304
- "mn",
305
- "mo",
306
- "ms",
307
- "mtext",
308
- "noembed",
309
- "noframes",
310
- "noscript",
311
- "plaintext",
312
- "script",
313
- // <selectedcontent> mirrors the selected <option>'s subtree, cloned by
314
- // the UA (customizable <select>) — including any on* handlers — and the
315
- // engine re-mirrors synchronously whenever a removal changes which
316
- // option/selectedcontent is current, even inside DOMPurify's inert
317
- // DOMParser document. Hoisting its children on removal re-inserts a fresh
318
- // mirror target ahead of the walk, which the engine refills, looping
319
- // forever (DoS) and amplifying output. Dropping its content on removal
320
- // (rather than hoisting) breaks that cascade; the content is a duplicate
321
- // of the option, which is sanitized on its own. See campaign-3 F1/F6.
322
- "selectedcontent",
323
- "style",
324
- "svg",
325
- "template",
326
- "thead",
327
- "title",
328
- "video",
329
- "xmp"
330
- ]);
331
- let Ee = null;
332
- const Ae = p({}, ["audio", "video", "img", "source", "image", "track"]);
333
- let Bt = null;
334
- const ye = p({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), St = "http://www.w3.org/1998/Math/MathML", bt = "http://www.w3.org/2000/svg", F = "http://www.w3.org/1999/xhtml";
335
- let ot = F, Wt = !1, Yt = null;
336
- const pn = p({}, [St, bt, F], Zt), Se = b(["mi", "mo", "mn", "ms", "mtext"]);
337
- let jt = p({}, Se);
338
- const be = b(["annotation-xml"]);
339
- let $t = p({}, be);
340
- const mn = p({}, ["title", "style", "font", "a", "script"]);
341
- let mt = null;
342
- const dn = ["application/xhtml+xml", "text/html"], Tn = "text/html";
343
- let d = null, rt = null;
344
- const hn = s.createElement("form"), Oe = function(t) {
345
- return t instanceof RegExp || t instanceof Function;
346
- }, Xt = function() {
347
- let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
348
- if (rt && rt === t)
349
- return;
350
- (!t || typeof t != "object") && (t = {}), t = L(t), mt = // eslint-disable-next-line unicorn/prefer-includes
351
- dn.indexOf(t.PARSER_MEDIA_TYPE) === -1 ? Tn : t.PARSER_MEDIA_TYPE, d = mt === "application/xhtml+xml" ? Zt : _t, h = j(t, "ALLOWED_TAGS", ue, {
352
- transform: d
353
- }), _ = j(t, "ALLOWED_ATTR", fe, {
354
- transform: d
355
- }), Yt = j(t, "ALLOWED_NAMESPACES", pn, {
356
- transform: Zt
357
- }), Bt = j(t, "ADD_URI_SAFE_ATTR", ye, {
358
- transform: d,
359
- base: ye
360
- }), Ee = j(t, "ADD_DATA_URI_TAGS", Ae, {
361
- transform: d,
362
- base: Ae
363
- }), U = j(t, "FORBID_CONTENTS", Gt, {
364
- transform: d
365
- }), pt = j(t, "FORBID_TAGS", L({}), {
366
- transform: d
367
- }), pe = j(t, "FORBID_ATTR", L({}), {
368
- transform: d
369
- }), nt = S(t, "USE_PROFILES") ? t.USE_PROFILES && typeof t.USE_PROFILES == "object" ? L(t.USE_PROFILES) : t.USE_PROFILES : !1, me = t.ALLOW_ARIA_ATTR !== !1, xt = t.ALLOW_DATA_ATTR !== !1, de = t.ALLOW_UNKNOWN_PROTOCOLS || !1, Te = t.ALLOW_SELF_CLOSE_IN_ATTR !== !1, B = t.SAFE_FOR_TEMPLATES || !1, W = t.SAFE_FOR_XML !== !1, K = t.WHOLE_DOCUMENT || !1, et = t.RETURN_DOM || !1, At = t.RETURN_DOM_FRAGMENT || !1, yt = t.RETURN_TRUSTED_TYPE || !1, Ft = t.FORCE_BODY || !1, he = t.SANITIZE_DOM !== !1, _e = t.SANITIZE_NAMED_PROPS || !1, zt = t.KEEP_CONTENT !== !1, Ht = t.IN_PLACE || !1, ce = Yn(t.ALLOWED_URI_REGEXP) ? t.ALLOWED_URI_REGEXP : Ye, ot = typeof t.NAMESPACE == "string" ? t.NAMESPACE : F, jt = S(t, "MATHML_TEXT_INTEGRATION_POINTS") && t.MATHML_TEXT_INTEGRATION_POINTS && typeof t.MATHML_TEXT_INTEGRATION_POINTS == "object" ? L(t.MATHML_TEXT_INTEGRATION_POINTS) : p({}, Se), $t = S(t, "HTML_INTEGRATION_POINTS") && t.HTML_INTEGRATION_POINTS && typeof t.HTML_INTEGRATION_POINTS == "object" ? L(t.HTML_INTEGRATION_POINTS) : p({}, be);
370
- const e = S(t, "CUSTOM_ELEMENT_HANDLING") && t.CUSTOM_ELEMENT_HANDLING && typeof t.CUSTOM_ELEMENT_HANDLING == "object" ? L(t.CUSTOM_ELEMENT_HANDLING) : lt(null);
371
- if (g = lt(null), S(e, "tagNameCheck") && Oe(e.tagNameCheck) && (g.tagNameCheck = e.tagNameCheck), S(e, "attributeNameCheck") && Oe(e.attributeNameCheck) && (g.attributeNameCheck = e.attributeNameCheck), S(e, "allowCustomizedBuiltInElements") && typeof e.allowCustomizedBuiltInElements == "boolean" && (g.allowCustomizedBuiltInElements = e.allowCustomizedBuiltInElements), O(g), B && (xt = !1), At && (et = !0), nt && (h = p({}, Ge), _ = lt(null), nt.html === !0 && (p(h, He), p(_, Be)), nt.svg === !0 && (p(h, Jt), p(_, ee), p(_, Dt)), nt.svgFilters === !0 && (p(h, Qt), p(_, ee), p(_, Dt)), nt.mathMl === !0 && (p(h, te), p(_, We), p(_, Dt))), G.tagCheck = null, G.attributeCheck = null, S(t, "ADD_TAGS") && (typeof t.ADD_TAGS == "function" ? G.tagCheck = t.ADD_TAGS : $(t.ADD_TAGS) && (h === ue && (h = L(h)), p(h, t.ADD_TAGS, d))), S(t, "ADD_ATTR") && (typeof t.ADD_ATTR == "function" ? G.attributeCheck = t.ADD_ATTR : $(t.ADD_ATTR) && (_ === fe && (_ = L(_)), p(_, t.ADD_ATTR, d))), S(t, "ADD_URI_SAFE_ATTR") && $(t.ADD_URI_SAFE_ATTR) && p(Bt, t.ADD_URI_SAFE_ATTR, d), S(t, "FORBID_CONTENTS") && $(t.FORBID_CONTENTS) && (U === Gt && (U = L(U)), p(U, t.FORBID_CONTENTS, d)), S(t, "ADD_FORBID_CONTENTS") && $(t.ADD_FORBID_CONTENTS) && (U === Gt && (U = L(U)), p(U, t.ADD_FORBID_CONTENTS, d)), zt && (h["#text"] = !0), K && p(h, ["html", "head", "body"]), h.table && (p(h, ["tbody"]), delete pt.tbody), t.TRUSTED_TYPES_POLICY) {
372
- if (typeof t.TRUSTED_TYPES_POLICY.createHTML != "function")
373
- throw J('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
374
- if (typeof t.TRUSTED_TYPES_POLICY.createScriptURL != "function")
375
- throw J('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
376
- const n = w;
377
- w = t.TRUSTED_TYPES_POLICY;
378
- try {
379
- q = tt("");
380
- } catch (a) {
381
- throw w = n, a;
382
- }
383
- } else t.TRUSTED_TYPES_POLICY === null ? (w = void 0, q = "") : (w === void 0 && (w = tn()), w && typeof q == "string" && (q = tt("")));
384
- b && b(t), rt = t;
385
- }, Re = p({}, [...Jt, ...Qt, ...jn]), Ne = p({}, [...te, ...$n]), _n = function(t, e, n) {
386
- return e.namespaceURI === F ? t === "svg" : e.namespaceURI === St ? t === "svg" && (n === "annotation-xml" || jt[n]) : !!Re[t];
387
- }, gn = function(t, e, n) {
388
- return e.namespaceURI === F ? t === "math" : e.namespaceURI === bt ? t === "math" && $t[n] : !!Ne[t];
389
- }, En = function(t, e, n) {
390
- return e.namespaceURI === bt && !$t[n] || e.namespaceURI === St && !jt[n] ? !1 : !Ne[t] && (mn[t] || !Re[t]);
391
- }, An = function(t) {
392
- let e = V(t);
393
- (!e || !e.tagName) && (e = {
394
- namespaceURI: ot,
395
- tagName: "template"
396
- });
397
- const n = _t(t.tagName), a = _t(e.tagName);
398
- return Yt[t.namespaceURI] ? t.namespaceURI === bt ? _n(n, e, a) : t.namespaceURI === St ? gn(n, e, a) : t.namespaceURI === F ? En(n, e, a) : !!(mt === "application/xhtml+xml" && Yt[t.namespaceURI]) : !1;
399
- }, Y = function(t) {
400
- st(i.removed, {
401
- element: t
402
- });
403
- try {
404
- V(t).removeChild(t);
405
- } catch {
406
- if (wt(t), !V(t))
407
- throw J("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
408
- }
409
- }, Ot = function(t) {
410
- Vt(t);
411
- const e = Q(t);
412
- if (e) {
413
- const a = [];
414
- at(e, (l) => {
415
- st(a, l);
416
- }), at(a, (l) => {
417
- try {
418
- wt(l);
419
- } catch {
420
- }
421
- });
422
- }
423
- const n = Ct(t);
424
- if (n)
425
- for (let a = n.length - 1; a >= 0; --a) {
426
- const l = n[a], u = l && l.name;
427
- if (typeof u == "string")
428
- try {
429
- t.removeAttribute(u);
430
- } catch {
431
- }
432
- }
433
- }, Z = function(t, e) {
434
- try {
435
- st(i.removed, {
436
- attribute: e.getAttributeNode(t),
437
- from: e
438
- });
439
- } catch {
440
- st(i.removed, {
441
- attribute: null,
442
- from: e
443
- });
444
- }
445
- if (e.removeAttribute(t), t === "is")
446
- if (et || At)
447
- try {
448
- Y(e);
449
- } catch {
450
- }
451
- else
452
- try {
453
- e.setAttribute(t, "");
454
- } catch {
455
- }
456
- }, yn = function(t) {
457
- const e = Ct(t);
458
- if (e)
459
- for (let n = e.length - 1; n >= 0; --n) {
460
- const a = e[n], l = a && a.name;
461
- if (!(typeof l != "string" || _[d(l)]))
462
- try {
463
- t.removeAttribute(l);
464
- } catch {
465
- }
466
- }
467
- }, Vt = function(t) {
468
- const e = [t];
469
- for (; e.length > 0; ) {
470
- const n = e.pop();
471
- (I ? I(n) : n.nodeType) === P.element && yn(n);
472
- const l = Q(n);
473
- if (l)
474
- for (let u = l.length - 1; u >= 0; --u)
475
- e.push(l[u]);
476
- }
477
- }, Sn = function(t) {
478
- if (!W)
479
- return;
480
- const e = [t];
481
- for (; e.length > 0; ) {
482
- const n = e.pop(), a = I ? I(n) : n.nodeType;
483
- if (a === P.processingInstruction || a === P.comment && y($e, n.data)) {
484
- try {
485
- wt(n);
486
- } catch {
487
- }
488
- continue;
489
- }
490
- if (a === P.element) {
491
- const u = n, E = d(v ? v(n) : n.nodeName);
492
- try {
493
- u.hasAttribute && u.hasAttribute("patchsrc") && u.removeAttribute("patchsrc"), u.hasAttribute && u.hasAttribute("for") && E !== "label" && E !== "output" && u.removeAttribute("for");
494
- } catch {
495
- }
496
- }
497
- const l = Q(n);
498
- if (l)
499
- for (let u = l.length - 1; u >= 0; --u)
500
- e.push(l[u]);
501
- }
502
- }, Ie = function(t) {
503
- let e = null, n = null;
504
- if (Ft)
505
- t = "<remove></remove>" + t;
506
- else {
507
- const u = ve(t, /^[\r\n\t ]+/);
508
- n = u && u[0];
509
- }
510
- mt === "application/xhtml+xml" && ot === F && (t = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + t + "</body></html>");
511
- const a = w ? tt(t) : t;
512
- if (ot === F)
513
- try {
514
- e = new Lt().parseFromString(a, mt);
515
- } catch {
516
- }
517
- if (!e || !e.documentElement) {
518
- e = Pt.createDocument(ot, "template", null);
519
- try {
520
- e.documentElement.innerHTML = Wt ? q : a;
521
- } catch {
522
- }
523
- }
524
- const l = e.body || e.documentElement;
525
- return t && n && l.insertBefore(s.createTextNode(n), l.childNodes[0] || null), ot === F ? nn.call(e, K ? "html" : "body")[0] : K ? e.documentElement : l;
526
- }, De = function(t) {
527
- return se.call(
528
- t.ownerDocument || t,
529
- t,
530
- // eslint-disable-next-line no-bitwise
531
- M.SHOW_ELEMENT | M.SHOW_COMMENT | M.SHOW_TEXT | M.SHOW_PROCESSING_INSTRUCTION | M.SHOW_CDATA_SECTION,
532
- null
533
- );
534
- }, Rt = function(t) {
535
- return t = Tt(t, rn, " "), t = Tt(t, an, " "), t = Tt(t, sn, " "), t;
536
- }, qt = function(t) {
537
- var e;
538
- t.normalize();
539
- const n = se.call(
540
- t.ownerDocument || t,
541
- t,
542
- // eslint-disable-next-line no-bitwise
543
- M.SHOW_TEXT | M.SHOW_COMMENT | M.SHOW_CDATA_SECTION | M.SHOW_PROCESSING_INSTRUCTION,
544
- null
545
- );
546
- let a = n.nextNode();
547
- for (; a; )
548
- a.data = Rt(a.data), a = n.nextNode();
549
- const l = (e = t.querySelectorAll) === null || e === void 0 ? void 0 : e.call(t, "template");
550
- l && at(l, (u) => {
551
- it(u.content) && qt(u.content);
552
- });
553
- }, Nt = function(t) {
554
- const e = v ? v(t) : null;
555
- return typeof e != "string" || d(e) !== "form" ? !1 : typeof t.nodeName != "string" || typeof t.textContent != "string" || typeof t.removeChild != "function" || // Realm-safe NamedNodeMap detection: equality against the cached
556
- // prototype getter. Clobbered .attributes (e.g. <input name="attributes">)
557
- // makes the direct read diverge from the cached read; a clean form
558
- // (same-realm OR foreign-realm) has both reads pointing at the same
559
- // canonical NamedNodeMap.
560
- t.attributes !== Ct(t) || typeof t.removeAttribute != "function" || typeof t.setAttribute != "function" || typeof t.namespaceURI != "string" || typeof t.insertBefore != "function" || typeof t.hasChildNodes != "function" || // NodeType clobbering probe. Cached Node.prototype.nodeType getter
561
- // returns the integer 1 for any Element regardless of realm; direct
562
- // read on a clobbered form (e.g. <input name="nodeType">) returns
563
- // the named child element. Cheap addition — nodeType is read from
564
- // an internal slot, no serialization cost — and removes a residual
565
- // clobbering surface used by several mXSS / PI / comment branches
566
- // in _sanitizeElements that compare currentNode.nodeType directly.
567
- t.nodeType !== I(t) || // HTMLFormElement has [LegacyOverrideBuiltIns]: a descendant named
568
- // "childNodes" shadows the prototype getter. Direct reads of
569
- // form.childNodes from a clobbered form return the named child
570
- // instead of the real NodeList, so any walk that reads it directly
571
- // skips the form's real children. Compare the direct read to the
572
- // cached Node.prototype getter — when the form's named-property
573
- // getter intercepts the read, the two values differ and we flag
574
- // the form. This catches every clobbering child type (input,
575
- // select, etc.) regardless of whether the named child happens to
576
- // carry a numeric .length, which a typeof-based probe would miss
577
- // (e.g. HTMLSelectElement.length is a defined unsigned-long).
578
- t.childNodes !== Q(t);
579
- }, it = function(t) {
580
- if (!I || typeof t != "object" || t === null)
581
- return !1;
582
- try {
583
- return I(t) === P.documentFragment;
584
- } catch {
585
- return !1;
586
- }
587
- }, dt = function(t) {
588
- if (!I || typeof t != "object" || t === null)
589
- return !1;
590
- try {
591
- return typeof I(t) == "number";
592
- } catch {
593
- return !1;
594
- }
595
- };
596
- function z(r, t, e) {
597
- r.length !== 0 && at(r, (n) => {
598
- n.call(i, t, e, rt);
599
- });
600
- }
601
- const bn = function(t, e) {
602
- return !!(W && t.hasChildNodes() && !dt(t.firstElementChild) && y(je, t.textContent) && y(je, t.innerHTML) || W && t.namespaceURI === F && e === "style" && dt(t.firstElementChild) || t.nodeType === P.processingInstruction || W && t.nodeType === P.comment && y($e, t.data));
603
- }, On = function(t, e) {
604
- if (!pt[e] && Ce(e) && (g.tagNameCheck instanceof RegExp && y(g.tagNameCheck, e) || g.tagNameCheck instanceof Function && g.tagNameCheck(e)))
605
- return !1;
606
- if (zt && !U[e]) {
607
- const n = V(t), a = Q(t);
608
- if (a && n) {
609
- const l = a.length;
610
- for (let u = l - 1; u >= 0; --u) {
611
- const E = Ht ? a[u] : Ze(a[u], !0);
612
- n.insertBefore(E, Je(t));
613
- }
614
- }
615
- }
616
- return Y(t), !0;
617
- }, Le = function(t, e) {
618
- if (z(T.beforeSanitizeElements, t, null), t !== e && V(t) === null)
619
- return !0;
620
- if (Nt(t))
621
- return Y(t), !0;
622
- const n = d(v ? v(t) : t.nodeName);
623
- if (z(T.uponSanitizeElement, t, {
624
- tagName: n,
625
- allowedTags: h
626
- }), t !== e && V(t) === null)
627
- return !0;
628
- if (bn(t, n))
629
- return Y(t), !0;
630
- if (pt[n] || !(G.tagCheck instanceof Function && G.tagCheck(n)) && !h[n]) {
631
- const l = On(t, n);
632
- return l === !1 && z(T.afterSanitizeElements, t, null), l;
633
- }
634
- if ((I ? I(t) : t.nodeType) === P.element && !An(t) || (n === "noscript" || n === "noembed" || n === "noframes") && y(no, t.innerHTML))
635
- return Y(t), !0;
636
- if (B && t.nodeType === P.text) {
637
- const l = Rt(t.textContent);
638
- t.textContent !== l && (st(i.removed, {
639
- element: t.cloneNode()
640
- }), t.textContent = l);
641
- }
642
- return z(T.afterSanitizeElements, t, null), !1;
643
- }, we = function(t, e, n) {
644
- if (pe[e] || W && e === "patchsrc" || W && e === "for" && t !== "label" && t !== "output" || he && (e === "id" || e === "name") && (n in s || n in hn))
645
- return !1;
646
- const a = _[e] || G.attributeCheck instanceof Function && G.attributeCheck(e, t);
647
- if (!(xt && y(ln, e))) {
648
- if (!(me && y(cn, e))) {
649
- if (a) {
650
- if (!Bt[e]) {
651
- if (!y(ce, Tt(n, le, ""))) {
652
- if (!((e === "src" || e === "xlink:href" || e === "href") && t !== "script" && Ue(n, "data:") === 0 && Ee[t])) {
653
- if (!(de && !y(un, Tt(n, le, "")))) {
654
- if (n)
655
- return !1;
656
- }
657
- }
658
- }
659
- }
660
- } else if (
661
- // First condition does a very basic check if a) it's basically a valid custom element tagname AND
662
- // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
663
- // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
664
- !(Ce(t) && (g.tagNameCheck instanceof RegExp && y(g.tagNameCheck, t) || g.tagNameCheck instanceof Function && g.tagNameCheck(t)) && (g.attributeNameCheck instanceof RegExp && y(g.attributeNameCheck, e) || g.attributeNameCheck instanceof Function && g.attributeNameCheck(e, t)) || // Alternative, second condition checks if it's an `is`-attribute, AND
665
- // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
666
- e === "is" && g.allowCustomizedBuiltInElements && (g.tagNameCheck instanceof RegExp && y(g.tagNameCheck, n) || g.tagNameCheck instanceof Function && g.tagNameCheck(n)))
667
- ) return !1;
668
- }
669
- }
670
- return !0;
671
- }, Rn = p({}, ["annotation-xml", "color-profile", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "missing-glyph"]), Ce = function(t) {
672
- return !Rn[_t(t)] && y(fn, t);
673
- }, Nn = function(t, e, n, a) {
674
- if (w && typeof gt == "object" && typeof gt.getAttributeType == "function" && !n)
675
- switch (gt.getAttributeType(t, e)) {
676
- case "TrustedHTML":
677
- return tt(a);
678
- case "TrustedScriptURL":
679
- return Qe(a);
680
- }
681
- return a;
682
- }, In = function(t, e, n, a) {
683
- try {
684
- n ? t.setAttributeNS(n, e, a) : t.setAttribute(e, a), Nt(t) ? Y(t) : ke(i.removed);
685
- } catch {
686
- Z(e, t);
687
- }
688
- }, Me = function(t) {
689
- z(T.beforeSanitizeAttributes, t, null);
690
- const e = t.attributes;
691
- if (!e || Nt(t))
692
- return;
693
- const n = {
694
- attrName: "",
695
- attrValue: "",
696
- keepAttr: !0,
697
- allowedAttributes: _,
698
- forceKeepAttr: void 0
699
- };
700
- let a = e.length;
701
- const l = d(t.nodeName);
702
- for (; a--; ) {
703
- const u = e[a], E = u.name, N = u.namespaceURI, x = u.value, C = d(E), k = x;
704
- let D = E === "value" ? k : Fn(k);
705
- if (n.attrName = C, n.attrValue = D, n.keepAttr = !0, n.forceKeepAttr = void 0, z(T.uponSanitizeAttribute, t, n), D = n.attrValue, _e && (C === "id" || C === "name") && Ue(D, ge) !== 0 && (Z(E, t), D = ge + D), W && y(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, D)) {
706
- Z(E, t);
707
- continue;
708
- }
709
- if (C === "attributename" && ve(D, "href")) {
710
- Z(E, t);
711
- continue;
712
- }
713
- if (!n.forceKeepAttr) {
714
- if (!n.keepAttr) {
715
- Z(E, t);
716
- continue;
717
- }
718
- if (!Te && y(oo, D)) {
719
- Z(E, t);
720
- continue;
721
- }
722
- if (B && (D = Rt(D)), !we(l, C, D)) {
723
- Z(E, t);
724
- continue;
725
- }
726
- D = Nn(l, C, N, D), D !== k && In(t, E, N, D);
727
- }
728
- }
729
- z(T.afterSanitizeAttributes, t, null);
730
- }, It = function(t) {
731
- let e = null;
732
- const n = De(t);
733
- for (z(T.beforeSanitizeShadowDOM, t, null); e = n.nextNode(); )
734
- if (z(T.uponSanitizeShadowNode, e, null), Le(e, t), Me(e), it(e.content) && It(e.content), (I ? I(e) : e.nodeType) === P.element) {
735
- const l = re(e);
736
- it(l) && (Kt(l), It(l));
737
- }
738
- z(T.afterSanitizeShadowDOM, t, null);
739
- }, Kt = function(t) {
740
- const e = [{
741
- node: t,
742
- shadow: null
743
- }];
744
- for (; e.length > 0; ) {
745
- const n = e.pop();
746
- if (n.shadow) {
747
- It(n.shadow);
748
- continue;
749
- }
750
- const a = n.node, u = (I ? I(a) : a.nodeType) === P.element, E = Q(a);
751
- if (E)
752
- for (let N = E.length - 1; N >= 0; --N)
753
- e.push({
754
- node: E[N],
755
- shadow: null
756
- });
757
- if (u) {
758
- const N = v ? v(a) : null;
759
- if (typeof N == "string" && d(N) === "template") {
760
- const x = a.content;
761
- it(x) && e.push({
762
- node: x,
763
- shadow: null
764
- });
765
- }
766
- }
767
- if (u) {
768
- const N = re(a);
769
- it(N) && e.push({
770
- node: null,
771
- shadow: N
772
- }, {
773
- node: N,
774
- shadow: null
775
- });
776
- }
777
- }
778
- };
779
- return i.sanitize = function(r) {
780
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, e = null, n = null, a = null, l = null;
781
- if (Wt = !r, Wt && (r = "<!-->"), typeof r != "string" && !dt(r) && (r = Wn(r), typeof r != "string"))
782
- throw J("dirty is not a string, aborting");
783
- if (!i.isSupported)
784
- return r;
785
- kt ? (h = vt, _ = Ut) : Xt(t), (T.uponSanitizeElement.length > 0 || T.uponSanitizeAttribute.length > 0) && (h = L(h)), T.uponSanitizeAttribute.length > 0 && (_ = L(_)), i.removed = [];
786
- const u = Ht && typeof r != "string" && dt(r);
787
- if (u) {
788
- Sn(r);
789
- const C = v ? v(r) : r.nodeName;
790
- if (typeof C == "string") {
791
- const k = d(C);
792
- if (!h[k] || pt[k])
793
- throw Ot(r), J("root node is forbidden and cannot be sanitized in-place");
794
- }
795
- if (Nt(r))
796
- throw Ot(r), J("root node is clobbered and cannot be sanitized in-place");
797
- try {
798
- Kt(r);
799
- } catch (k) {
800
- throw Ot(r), k;
801
- }
802
- } else if (dt(r))
803
- e = Ie("<!---->"), n = e.ownerDocument.importNode(r, !0), n.nodeType === P.element && n.nodeName === "BODY" || n.nodeName === "HTML" ? e = n : e.appendChild(n), Kt(n);
804
- else {
805
- if (!et && !B && !K && // eslint-disable-next-line unicorn/prefer-includes
806
- r.indexOf("<") === -1)
807
- return w && yt ? tt(r) : r;
808
- if (e = Ie(r), !e)
809
- return et ? null : yt ? q : "";
810
- }
811
- e && Ft && Y(e.firstChild);
812
- const E = u ? r : e, N = De(E);
813
- try {
814
- for (; a = N.nextNode(); )
815
- Le(a, E), Me(a), it(a.content) && It(a.content);
816
- } catch (C) {
817
- throw u && (Ot(r), at(i.removed, (k) => {
818
- k.element && Vt(k.element);
819
- })), C;
820
- }
821
- if (u)
822
- return at(i.removed, (C) => {
823
- C.element && Vt(C.element);
824
- }), B && qt(r), r;
825
- if (et) {
826
- if (B && qt(e), At)
827
- for (l = en.call(e.ownerDocument); e.firstChild; )
828
- l.appendChild(e.firstChild);
829
- else
830
- l = e;
831
- return (_.shadowroot || _.shadowrootmode) && (l = on.call(c, l, !0)), l;
832
- }
833
- let x = K ? e.outerHTML : e.innerHTML;
834
- return K && h["!doctype"] && e.ownerDocument && e.ownerDocument.doctype && e.ownerDocument.doctype.name && y(to, e.ownerDocument.doctype.name) && (x = "<!DOCTYPE " + e.ownerDocument.doctype.name + `>
835
- ` + x), B && (x = Rt(x)), w && yt ? tt(x) : x;
836
- }, i.setConfig = function() {
837
- let r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
838
- Xt(r), kt = !0, vt = h, Ut = _;
839
- }, i.clearConfig = function() {
840
- rt = null, kt = !1, vt = null, Ut = null, w = Mt, q = "";
841
- }, i.isValidAttribute = function(r, t, e) {
842
- rt || Xt({});
843
- const n = d(r), a = d(t);
844
- return we(n, a, e);
845
- }, i.addHook = function(r, t) {
846
- typeof t == "function" && S(T, r) && st(T[r], t);
847
- }, i.removeHook = function(r, t) {
848
- if (S(T, r)) {
849
- if (t !== void 0) {
850
- const e = vn(T[r], t);
851
- return e === -1 ? void 0 : Un(T[r], e, 1)[0];
852
- }
853
- return ke(T[r]);
854
- }
855
- }, i.removeHooks = function(r) {
856
- S(T, r) && (T[r] = []);
857
- }, i.removeAllHooks = function() {
858
- T = Xe();
859
- }, i;
860
- }
861
- var ao = Ke();
862
- export {
863
- ao as p
864
- };