@3t-transform/threeteeui 0.1.36 → 0.1.41

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 (125) hide show
  1. package/dist/cjs/domsanitiser.options-277161b9.js +1667 -0
  2. package/dist/cjs/{index-457ca775.js → index-76f14107.js} +2 -88
  3. package/dist/cjs/loader.cjs.js +2 -3
  4. package/dist/cjs/tttx-button.cjs.entry.js +25 -25
  5. package/dist/cjs/tttx-filter.cjs.entry.js +159 -159
  6. package/dist/cjs/tttx-form.cjs.entry.js +457 -373
  7. package/dist/cjs/tttx-icon.cjs.entry.js +11 -11
  8. package/dist/cjs/tttx-keyvalue-block.cjs.entry.js +59 -59
  9. package/dist/cjs/tttx-list.cjs.entry.js +32 -1694
  10. package/dist/cjs/tttx-loading-spinner.cjs.entry.js +16 -16
  11. package/dist/cjs/tttx-sorter.cjs.entry.js +102 -102
  12. package/dist/cjs/tttx-standalone-input.cjs.entry.js +79 -79
  13. package/dist/cjs/tttx-toolbar.cjs.entry.js +10 -10
  14. package/dist/cjs/tttx.cjs.js +2 -6
  15. package/dist/collection/collection-manifest.json +2 -2
  16. package/dist/collection/components/atoms/tttx-button/tttx-button.css +4 -4
  17. package/dist/collection/components/atoms/tttx-button/tttx-button.js +110 -110
  18. package/dist/collection/components/atoms/tttx-button/tttx-button.stories.js +14 -14
  19. package/dist/collection/components/atoms/tttx-icon/tttx-icon.js +62 -62
  20. package/dist/collection/components/atoms/tttx-icon/tttx-icon.stories.js +22 -22
  21. package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.js +109 -109
  22. package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.js +38 -38
  23. package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.js +67 -67
  24. package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.js +17 -17
  25. package/dist/collection/components/molecules/tttx-filter/tttx-filter.js +334 -334
  26. package/dist/collection/components/molecules/tttx-filter/tttx-filter.stories.js +62 -62
  27. package/dist/collection/components/molecules/tttx-form/lib/setErrorState.js +37 -37
  28. package/dist/collection/components/molecules/tttx-form/lib/validityCheck.js +61 -58
  29. package/dist/collection/components/molecules/tttx-form/tttx-form.css +98 -2
  30. package/dist/collection/components/molecules/tttx-form/tttx-form.js +477 -393
  31. package/dist/collection/components/molecules/tttx-form/tttx-form.stories.js +274 -218
  32. package/dist/collection/components/molecules/tttx-list/tttx-list.js +105 -105
  33. package/dist/collection/components/molecules/tttx-list/tttx-list.stories.js +43 -43
  34. package/dist/collection/components/molecules/tttx-sorter/tttx-sorter.js +224 -224
  35. package/dist/collection/components/molecules/tttx-sorter/tttx-sorter.stories.js +42 -42
  36. package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.js +759 -759
  37. package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.js +172 -172
  38. package/dist/collection/components/molecules/tttx-toolbar/tttx-toolbar.js +44 -44
  39. package/dist/collection/components/molecules/tttx-toolbar/tttx-toolbar.stories.js +14 -14
  40. package/dist/collection/components/palette.stories.js +7 -7
  41. package/dist/collection/docs/gettingstarted-developer.stories.js +5 -5
  42. package/dist/collection/icons.js +2838 -2838
  43. package/dist/collection/index.js +1 -1
  44. package/dist/collection/shared/domsanitiser.options.js +14 -14
  45. package/dist/components/domsanitiser.options.js +1664 -0
  46. package/dist/components/index.d.ts +0 -9
  47. package/dist/components/index.js +1 -1
  48. package/dist/components/tttx-button.js +49 -49
  49. package/dist/components/tttx-filter.js +191 -191
  50. package/dist/components/tttx-form.js +475 -391
  51. package/dist/components/tttx-icon2.js +28 -28
  52. package/dist/components/tttx-keyvalue-block.js +76 -76
  53. package/dist/components/tttx-list.js +54 -1716
  54. package/dist/components/tttx-loading-spinner.js +33 -33
  55. package/dist/components/tttx-sorter.js +130 -130
  56. package/dist/components/tttx-standalone-input.js +130 -130
  57. package/dist/components/tttx-toolbar.js +26 -26
  58. package/dist/esm/domsanitiser.options-cc420431.js +1664 -0
  59. package/dist/esm/{index-d784fb3e.js → index-9cde46a5.js} +3 -88
  60. package/dist/esm/loader.js +2 -3
  61. package/dist/esm/polyfills/core-js.js +0 -0
  62. package/dist/esm/polyfills/css-shim.js +1 -1
  63. package/dist/esm/polyfills/dom.js +0 -0
  64. package/dist/esm/polyfills/es5-html-element.js +0 -0
  65. package/dist/esm/polyfills/index.js +0 -0
  66. package/dist/esm/polyfills/system.js +0 -0
  67. package/dist/esm/tttx-button.entry.js +25 -25
  68. package/dist/esm/tttx-filter.entry.js +159 -159
  69. package/dist/esm/tttx-form.entry.js +457 -373
  70. package/dist/esm/tttx-icon.entry.js +11 -11
  71. package/dist/esm/tttx-keyvalue-block.entry.js +59 -59
  72. package/dist/esm/tttx-list.entry.js +32 -1694
  73. package/dist/esm/tttx-loading-spinner.entry.js +16 -16
  74. package/dist/esm/tttx-sorter.entry.js +102 -102
  75. package/dist/esm/tttx-standalone-input.entry.js +79 -79
  76. package/dist/esm/tttx-toolbar.entry.js +10 -10
  77. package/dist/esm/tttx.js +2 -3
  78. package/dist/tttx/{p-400868f1.entry.js → p-3b1be372.entry.js} +1 -1
  79. package/dist/tttx/{p-563605b2.entry.js → p-561224f5.entry.js} +1 -1
  80. package/dist/tttx/{p-b720c4ad.entry.js → p-9f1e9cc1.entry.js} +1 -1
  81. package/dist/tttx/{p-798a098a.entry.js → p-aef96333.entry.js} +1 -1
  82. package/dist/tttx/p-b4290a5b.js +3 -0
  83. package/dist/tttx/p-bd1edaed.entry.js +1 -0
  84. package/dist/tttx/p-d0ff9ad0.entry.js +1 -0
  85. package/dist/tttx/{p-cac26a1b.entry.js → p-d2f1aa8e.entry.js} +1 -1
  86. package/dist/tttx/p-db059a69.js +2 -0
  87. package/dist/tttx/p-dc2a37b0.entry.js +1 -0
  88. package/dist/tttx/{p-ab6ce9f6.entry.js → p-e53c7f9d.entry.js} +1 -1
  89. package/dist/tttx/{p-92cade7f.entry.js → p-f885f17a.entry.js} +1 -1
  90. package/dist/tttx/tttx.esm.js +1 -1
  91. package/dist/types/components/atoms/tttx-button/tttx-button.d.ts +10 -10
  92. package/dist/types/components/atoms/tttx-button/tttx-button.stories.d.ts +10 -10
  93. package/dist/types/components/atoms/tttx-icon/tttx-icon.d.ts +5 -5
  94. package/dist/types/components/atoms/tttx-icon/tttx-icon.stories.d.ts +20 -20
  95. package/dist/types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.d.ts +7 -7
  96. package/dist/types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.d.ts +9 -9
  97. package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.d.ts +6 -6
  98. package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.d.ts +17 -17
  99. package/dist/types/components/molecules/tttx-filter/tttx-filter.d.ts +39 -39
  100. package/dist/types/components/molecules/tttx-filter/tttx-filter.stories.d.ts +68 -68
  101. package/dist/types/components/molecules/tttx-form/lib/setErrorState.d.ts +13 -13
  102. package/dist/types/components/molecules/tttx-form/lib/validityCheck.d.ts +17 -17
  103. package/dist/types/components/molecules/tttx-form/tttx-form.d.ts +133 -111
  104. package/dist/types/components/molecules/tttx-form/tttx-form.stories.d.ts +278 -13
  105. package/dist/types/components/molecules/tttx-list/tttx-list.d.ts +11 -11
  106. package/dist/types/components/molecules/tttx-list/tttx-list.stories.d.ts +14 -14
  107. package/dist/types/components/molecules/tttx-sorter/tttx-sorter.d.ts +19 -19
  108. package/dist/types/components/molecules/tttx-sorter/tttx-sorter.stories.d.ts +30 -30
  109. package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.d.ts +69 -69
  110. package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.d.ts +143 -143
  111. package/dist/types/components/molecules/tttx-toolbar/tttx-toolbar.d.ts +4 -4
  112. package/dist/types/components/molecules/tttx-toolbar/tttx-toolbar.stories.d.ts +13 -13
  113. package/dist/types/components/palette.stories.d.ts +6 -6
  114. package/dist/types/components.d.ts +1 -1
  115. package/dist/types/docs/gettingstarted-developer.stories.d.ts +5 -5
  116. package/dist/types/icons.d.ts +2 -2
  117. package/dist/types/index.d.ts +1 -1
  118. package/dist/types/shared/domsanitiser.options.d.ts +10 -10
  119. package/dist/types/stencil-public-runtime.d.ts +3 -59
  120. package/loader/index.d.ts +0 -9
  121. package/package.json +1 -1
  122. package/dist/tttx/p-0ebffdfc.js +0 -2
  123. package/dist/tttx/p-72e7f7dd.entry.js +0 -3
  124. package/dist/tttx/p-c4162029.entry.js +0 -1
  125. package/dist/tttx/p-eb126fd0.entry.js +0 -1
@@ -0,0 +1,1667 @@
1
+ 'use strict';
2
+
3
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4
+
5
+ function createCommonjsModule(fn, basedir, module) {
6
+ return module = {
7
+ path: basedir,
8
+ exports: {},
9
+ require: function (path, base) {
10
+ return commonjsRequire();
11
+ }
12
+ }, fn(module, module.exports), module.exports;
13
+ }
14
+
15
+ function commonjsRequire () {
16
+ throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
17
+ }
18
+
19
+ var purify = createCommonjsModule(function (module, exports) {
20
+ /*! @license DOMPurify 3.0.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.3/LICENSE */
21
+
22
+ (function (global, factory) {
23
+ module.exports = factory() ;
24
+ })(commonjsGlobal, (function () {
25
+ const {
26
+ entries,
27
+ setPrototypeOf,
28
+ isFrozen,
29
+ getPrototypeOf,
30
+ getOwnPropertyDescriptor
31
+ } = Object;
32
+ let {
33
+ freeze,
34
+ seal,
35
+ create
36
+ } = Object; // eslint-disable-line import/no-mutable-exports
37
+
38
+ let {
39
+ apply,
40
+ construct
41
+ } = typeof Reflect !== 'undefined' && Reflect;
42
+
43
+ if (!apply) {
44
+ apply = function apply(fun, thisValue, args) {
45
+ return fun.apply(thisValue, args);
46
+ };
47
+ }
48
+
49
+ if (!freeze) {
50
+ freeze = function freeze(x) {
51
+ return x;
52
+ };
53
+ }
54
+
55
+ if (!seal) {
56
+ seal = function seal(x) {
57
+ return x;
58
+ };
59
+ }
60
+
61
+ if (!construct) {
62
+ construct = function construct(Func, args) {
63
+ return new Func(...args);
64
+ };
65
+ }
66
+
67
+ const arrayForEach = unapply(Array.prototype.forEach);
68
+ const arrayPop = unapply(Array.prototype.pop);
69
+ const arrayPush = unapply(Array.prototype.push);
70
+ const stringToLowerCase = unapply(String.prototype.toLowerCase);
71
+ const stringToString = unapply(String.prototype.toString);
72
+ const stringMatch = unapply(String.prototype.match);
73
+ const stringReplace = unapply(String.prototype.replace);
74
+ const stringIndexOf = unapply(String.prototype.indexOf);
75
+ const stringTrim = unapply(String.prototype.trim);
76
+ const regExpTest = unapply(RegExp.prototype.test);
77
+ const typeErrorCreate = unconstruct(TypeError);
78
+ function unapply(func) {
79
+ return function (thisArg) {
80
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
81
+ args[_key - 1] = arguments[_key];
82
+ }
83
+
84
+ return apply(func, thisArg, args);
85
+ };
86
+ }
87
+ function unconstruct(func) {
88
+ return function () {
89
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
90
+ args[_key2] = arguments[_key2];
91
+ }
92
+
93
+ return construct(func, args);
94
+ };
95
+ }
96
+ /* Add properties to a lookup table */
97
+
98
+ function addToSet(set, array, transformCaseFunc) {
99
+ var _transformCaseFunc;
100
+
101
+ transformCaseFunc = (_transformCaseFunc = transformCaseFunc) !== null && _transformCaseFunc !== void 0 ? _transformCaseFunc : stringToLowerCase;
102
+
103
+ if (setPrototypeOf) {
104
+ // Make 'in' and truthy checks like Boolean(set.constructor)
105
+ // independent of any properties defined on Object.prototype.
106
+ // Prevent prototype setters from intercepting set as a this value.
107
+ setPrototypeOf(set, null);
108
+ }
109
+
110
+ let l = array.length;
111
+
112
+ while (l--) {
113
+ let element = array[l];
114
+
115
+ if (typeof element === 'string') {
116
+ const lcElement = transformCaseFunc(element);
117
+
118
+ if (lcElement !== element) {
119
+ // Config presets (e.g. tags.js, attrs.js) are immutable.
120
+ if (!isFrozen(array)) {
121
+ array[l] = lcElement;
122
+ }
123
+
124
+ element = lcElement;
125
+ }
126
+ }
127
+
128
+ set[element] = true;
129
+ }
130
+
131
+ return set;
132
+ }
133
+ /* Shallow clone an object */
134
+
135
+ function clone(object) {
136
+ const newObject = create(null);
137
+
138
+ for (const [property, value] of entries(object)) {
139
+ newObject[property] = value;
140
+ }
141
+
142
+ return newObject;
143
+ }
144
+ /* This method automatically checks if the prop is function
145
+ * or getter and behaves accordingly. */
146
+
147
+ function lookupGetter(object, prop) {
148
+ while (object !== null) {
149
+ const desc = getOwnPropertyDescriptor(object, prop);
150
+
151
+ if (desc) {
152
+ if (desc.get) {
153
+ return unapply(desc.get);
154
+ }
155
+
156
+ if (typeof desc.value === 'function') {
157
+ return unapply(desc.value);
158
+ }
159
+ }
160
+
161
+ object = getPrototypeOf(object);
162
+ }
163
+
164
+ function fallbackValue(element) {
165
+ console.warn('fallback value for', element);
166
+ return null;
167
+ }
168
+
169
+ return fallbackValue;
170
+ }
171
+
172
+ const html$1 = freeze(['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']); // SVG
173
+
174
+ const svg$1 = freeze(['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']);
175
+ const svgFilters = freeze(['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']); // List of SVG elements that are disallowed by default.
176
+ // We still need to know them so that we can do namespace
177
+ // checks properly in case one wants to add them to
178
+ // allow-list.
179
+
180
+ const svgDisallowed = freeze(['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']);
181
+ const mathMl$1 = freeze(['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']); // Similarly to SVG, we want to know all MathML elements,
182
+ // even those that we disallow by default.
183
+
184
+ const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
185
+ const text = freeze(['#text']);
186
+
187
+ const html = freeze(['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', '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', 'xmlns', 'slot']);
188
+ const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', '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', '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', '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', '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', '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']);
189
+ const mathMl = freeze(['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']);
190
+ const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
191
+
192
+ const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
193
+
194
+ const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
195
+ const TMPLIT_EXPR = seal(/\${[\w\W]*}/gm);
196
+ const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape
197
+
198
+ const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
199
+
200
+ const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
201
+ );
202
+ const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
203
+ const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
204
+ );
205
+ const DOCTYPE_NAME = seal(/^html$/i);
206
+
207
+ var EXPRESSIONS = /*#__PURE__*/Object.freeze({
208
+ __proto__: null,
209
+ MUSTACHE_EXPR: MUSTACHE_EXPR,
210
+ ERB_EXPR: ERB_EXPR,
211
+ TMPLIT_EXPR: TMPLIT_EXPR,
212
+ DATA_ATTR: DATA_ATTR,
213
+ ARIA_ATTR: ARIA_ATTR,
214
+ IS_ALLOWED_URI: IS_ALLOWED_URI,
215
+ IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,
216
+ ATTR_WHITESPACE: ATTR_WHITESPACE,
217
+ DOCTYPE_NAME: DOCTYPE_NAME
218
+ });
219
+
220
+ const getGlobal = () => typeof window === 'undefined' ? null : window;
221
+ /**
222
+ * Creates a no-op policy for internal use only.
223
+ * Don't export this function outside this module!
224
+ * @param {?TrustedTypePolicyFactory} trustedTypes The policy factory.
225
+ * @param {HTMLScriptElement} purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
226
+ * @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types
227
+ * are not supported or creating the policy failed).
228
+ */
229
+
230
+
231
+ const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
232
+ if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
233
+ return null;
234
+ } // Allow the callers to control the unique policy name
235
+ // by adding a data-tt-policy-suffix to the script element with the DOMPurify.
236
+ // Policy creation with duplicate names throws in Trusted Types.
237
+
238
+
239
+ let suffix = null;
240
+ const ATTR_NAME = 'data-tt-policy-suffix';
241
+
242
+ if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
243
+ suffix = purifyHostElement.getAttribute(ATTR_NAME);
244
+ }
245
+
246
+ const policyName = 'dompurify' + (suffix ? '#' + suffix : '');
247
+
248
+ try {
249
+ return trustedTypes.createPolicy(policyName, {
250
+ createHTML(html) {
251
+ return html;
252
+ },
253
+
254
+ createScriptURL(scriptUrl) {
255
+ return scriptUrl;
256
+ }
257
+
258
+ });
259
+ } catch (_) {
260
+ // Policy creation failed (most likely another DOMPurify script has
261
+ // already run). Skip creating the policy, as this will only cause errors
262
+ // if TT are enforced.
263
+ console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
264
+ return null;
265
+ }
266
+ };
267
+
268
+ function createDOMPurify() {
269
+ let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
270
+
271
+ const DOMPurify = root => createDOMPurify(root);
272
+ /**
273
+ * Version label, exposed for easier checks
274
+ * if DOMPurify is up to date or not
275
+ */
276
+
277
+
278
+ DOMPurify.version = '3.0.3';
279
+ /**
280
+ * Array of elements that DOMPurify removed during sanitation.
281
+ * Empty if nothing was removed.
282
+ */
283
+
284
+ DOMPurify.removed = [];
285
+
286
+ if (!window || !window.document || window.document.nodeType !== 9) {
287
+ // Not running in a browser, provide a factory function
288
+ // so that you can pass your own Window
289
+ DOMPurify.isSupported = false;
290
+ return DOMPurify;
291
+ }
292
+
293
+ const originalDocument = window.document;
294
+ const currentScript = originalDocument.currentScript;
295
+ let {
296
+ document
297
+ } = window;
298
+ const {
299
+ DocumentFragment,
300
+ HTMLTemplateElement,
301
+ Node,
302
+ Element,
303
+ NodeFilter,
304
+ NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,
305
+ HTMLFormElement,
306
+ DOMParser,
307
+ trustedTypes
308
+ } = window;
309
+ const ElementPrototype = Element.prototype;
310
+ const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
311
+ const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
312
+ const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
313
+ const getParentNode = lookupGetter(ElementPrototype, 'parentNode'); // As per issue #47, the web-components registry is inherited by a
314
+ // new document created via createHTMLDocument. As per the spec
315
+ // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
316
+ // a new empty registry is used when creating a template contents owner
317
+ // document, so we use that as our parent document to ensure nothing
318
+ // is inherited.
319
+
320
+ if (typeof HTMLTemplateElement === 'function') {
321
+ const template = document.createElement('template');
322
+
323
+ if (template.content && template.content.ownerDocument) {
324
+ document = template.content.ownerDocument;
325
+ }
326
+ }
327
+
328
+ let trustedTypesPolicy;
329
+ let emptyHTML = '';
330
+ const {
331
+ implementation,
332
+ createNodeIterator,
333
+ createDocumentFragment,
334
+ getElementsByTagName
335
+ } = document;
336
+ const {
337
+ importNode
338
+ } = originalDocument;
339
+ let hooks = {};
340
+ /**
341
+ * Expose whether this browser supports running the full DOMPurify.
342
+ */
343
+
344
+ DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;
345
+ const {
346
+ MUSTACHE_EXPR,
347
+ ERB_EXPR,
348
+ TMPLIT_EXPR,
349
+ DATA_ATTR,
350
+ ARIA_ATTR,
351
+ IS_SCRIPT_OR_DATA,
352
+ ATTR_WHITESPACE
353
+ } = EXPRESSIONS;
354
+ let {
355
+ IS_ALLOWED_URI: IS_ALLOWED_URI$1
356
+ } = EXPRESSIONS;
357
+ /**
358
+ * We consider the elements and attributes below to be safe. Ideally
359
+ * don't add any new ones but feel free to remove unwanted ones.
360
+ */
361
+
362
+ /* allowed element names */
363
+
364
+ let ALLOWED_TAGS = null;
365
+ const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
366
+ /* Allowed attribute names */
367
+
368
+ let ALLOWED_ATTR = null;
369
+ const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
370
+ /*
371
+ * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.
372
+ * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
373
+ * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
374
+ * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
375
+ */
376
+
377
+ let CUSTOM_ELEMENT_HANDLING = Object.seal(Object.create(null, {
378
+ tagNameCheck: {
379
+ writable: true,
380
+ configurable: false,
381
+ enumerable: true,
382
+ value: null
383
+ },
384
+ attributeNameCheck: {
385
+ writable: true,
386
+ configurable: false,
387
+ enumerable: true,
388
+ value: null
389
+ },
390
+ allowCustomizedBuiltInElements: {
391
+ writable: true,
392
+ configurable: false,
393
+ enumerable: true,
394
+ value: false
395
+ }
396
+ }));
397
+ /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
398
+
399
+ let FORBID_TAGS = null;
400
+ /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
401
+
402
+ let FORBID_ATTR = null;
403
+ /* Decide if ARIA attributes are okay */
404
+
405
+ let ALLOW_ARIA_ATTR = true;
406
+ /* Decide if custom data attributes are okay */
407
+
408
+ let ALLOW_DATA_ATTR = true;
409
+ /* Decide if unknown protocols are okay */
410
+
411
+ let ALLOW_UNKNOWN_PROTOCOLS = false;
412
+ /* Decide if self-closing tags in attributes are allowed.
413
+ * Usually removed due to a mXSS issue in jQuery 3.0 */
414
+
415
+ let ALLOW_SELF_CLOSE_IN_ATTR = true;
416
+ /* Output should be safe for common template engines.
417
+ * This means, DOMPurify removes data attributes, mustaches and ERB
418
+ */
419
+
420
+ let SAFE_FOR_TEMPLATES = false;
421
+ /* Decide if document with <html>... should be returned */
422
+
423
+ let WHOLE_DOCUMENT = false;
424
+ /* Track whether config is already set on this instance of DOMPurify. */
425
+
426
+ let SET_CONFIG = false;
427
+ /* Decide if all elements (e.g. style, script) must be children of
428
+ * document.body. By default, browsers might move them to document.head */
429
+
430
+ let FORCE_BODY = false;
431
+ /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
432
+ * string (or a TrustedHTML object if Trusted Types are supported).
433
+ * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
434
+ */
435
+
436
+ let RETURN_DOM = false;
437
+ /* Decide if a DOM `DocumentFragment` should be returned, instead of a html
438
+ * string (or a TrustedHTML object if Trusted Types are supported) */
439
+
440
+ let RETURN_DOM_FRAGMENT = false;
441
+ /* Try to return a Trusted Type object instead of a string, return a string in
442
+ * case Trusted Types are not supported */
443
+
444
+ let RETURN_TRUSTED_TYPE = false;
445
+ /* Output should be free from DOM clobbering attacks?
446
+ * This sanitizes markups named with colliding, clobberable built-in DOM APIs.
447
+ */
448
+
449
+ let SANITIZE_DOM = true;
450
+ /* Achieve full DOM Clobbering protection by isolating the namespace of named
451
+ * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.
452
+ *
453
+ * HTML/DOM spec rules that enable DOM Clobbering:
454
+ * - Named Access on Window (§7.3.3)
455
+ * - DOM Tree Accessors (§3.1.5)
456
+ * - Form Element Parent-Child Relations (§4.10.3)
457
+ * - Iframe srcdoc / Nested WindowProxies (§4.8.5)
458
+ * - HTMLCollection (§4.2.10.2)
459
+ *
460
+ * Namespace isolation is implemented by prefixing `id` and `name` attributes
461
+ * with a constant string, i.e., `user-content-`
462
+ */
463
+
464
+ let SANITIZE_NAMED_PROPS = false;
465
+ const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
466
+ /* Keep element content when removing element? */
467
+
468
+ let KEEP_CONTENT = true;
469
+ /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
470
+ * of importing it into a new Document and returning a sanitized copy */
471
+
472
+ let IN_PLACE = false;
473
+ /* Allow usage of profiles like html, svg and mathMl */
474
+
475
+ let USE_PROFILES = {};
476
+ /* Tags to ignore content of when KEEP_CONTENT is true */
477
+
478
+ let FORBID_CONTENTS = null;
479
+ const DEFAULT_FORBID_CONTENTS = addToSet({}, ['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']);
480
+ /* Tags that are safe for data: URIs */
481
+
482
+ let DATA_URI_TAGS = null;
483
+ const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
484
+ /* Attributes safe for values like "javascript:" */
485
+
486
+ let URI_SAFE_ATTRIBUTES = null;
487
+ const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
488
+ const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
489
+ const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
490
+ const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
491
+ /* Document namespace */
492
+
493
+ let NAMESPACE = HTML_NAMESPACE;
494
+ let IS_EMPTY_INPUT = false;
495
+ /* Allowed XHTML+XML namespaces */
496
+
497
+ let ALLOWED_NAMESPACES = null;
498
+ const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
499
+ /* Parsing of strict XHTML documents */
500
+
501
+ let PARSER_MEDIA_TYPE;
502
+ const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
503
+ const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
504
+ let transformCaseFunc;
505
+ /* Keep a reference to config to pass to hooks */
506
+
507
+ let CONFIG = null;
508
+ /* Ideally, do not touch anything below this line */
509
+
510
+ /* ______________________________________________ */
511
+
512
+ const formElement = document.createElement('form');
513
+
514
+ const isRegexOrFunction = function isRegexOrFunction(testValue) {
515
+ return testValue instanceof RegExp || testValue instanceof Function;
516
+ };
517
+ /**
518
+ * _parseConfig
519
+ *
520
+ * @param {Object} cfg optional config literal
521
+ */
522
+ // eslint-disable-next-line complexity
523
+
524
+
525
+ const _parseConfig = function _parseConfig(cfg) {
526
+ if (CONFIG && CONFIG === cfg) {
527
+ return;
528
+ }
529
+ /* Shield configuration object from tampering */
530
+
531
+
532
+ if (!cfg || typeof cfg !== 'object') {
533
+ cfg = {};
534
+ }
535
+ /* Shield configuration object from prototype pollution */
536
+
537
+
538
+ cfg = clone(cfg);
539
+ PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
540
+ SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
541
+
542
+ transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
543
+ /* Set configuration parameters */
544
+
545
+ ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
546
+ ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
547
+ ALLOWED_NAMESPACES = 'ALLOWED_NAMESPACES' in cfg ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
548
+ URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), // eslint-disable-line indent
549
+ cfg.ADD_URI_SAFE_ATTR, // eslint-disable-line indent
550
+ transformCaseFunc // eslint-disable-line indent
551
+ ) // eslint-disable-line indent
552
+ : DEFAULT_URI_SAFE_ATTRIBUTES;
553
+ DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), // eslint-disable-line indent
554
+ cfg.ADD_DATA_URI_TAGS, // eslint-disable-line indent
555
+ transformCaseFunc // eslint-disable-line indent
556
+ ) // eslint-disable-line indent
557
+ : DEFAULT_DATA_URI_TAGS;
558
+ FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
559
+ FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
560
+ FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
561
+ USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;
562
+ ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
563
+
564
+ ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
565
+
566
+ ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
567
+
568
+ ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true
569
+
570
+ SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
571
+
572
+ WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
573
+
574
+ RETURN_DOM = cfg.RETURN_DOM || false; // Default false
575
+
576
+ RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
577
+
578
+ RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false
579
+
580
+ FORCE_BODY = cfg.FORCE_BODY || false; // Default false
581
+
582
+ SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
583
+
584
+ SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false
585
+
586
+ KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
587
+
588
+ IN_PLACE = cfg.IN_PLACE || false; // Default false
589
+
590
+ IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
591
+ NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
592
+ CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
593
+
594
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
595
+ CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
596
+ }
597
+
598
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
599
+ CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
600
+ }
601
+
602
+ if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {
603
+ CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
604
+ }
605
+
606
+ if (SAFE_FOR_TEMPLATES) {
607
+ ALLOW_DATA_ATTR = false;
608
+ }
609
+
610
+ if (RETURN_DOM_FRAGMENT) {
611
+ RETURN_DOM = true;
612
+ }
613
+ /* Parse profile info */
614
+
615
+
616
+ if (USE_PROFILES) {
617
+ ALLOWED_TAGS = addToSet({}, [...text]);
618
+ ALLOWED_ATTR = [];
619
+
620
+ if (USE_PROFILES.html === true) {
621
+ addToSet(ALLOWED_TAGS, html$1);
622
+ addToSet(ALLOWED_ATTR, html);
623
+ }
624
+
625
+ if (USE_PROFILES.svg === true) {
626
+ addToSet(ALLOWED_TAGS, svg$1);
627
+ addToSet(ALLOWED_ATTR, svg);
628
+ addToSet(ALLOWED_ATTR, xml);
629
+ }
630
+
631
+ if (USE_PROFILES.svgFilters === true) {
632
+ addToSet(ALLOWED_TAGS, svgFilters);
633
+ addToSet(ALLOWED_ATTR, svg);
634
+ addToSet(ALLOWED_ATTR, xml);
635
+ }
636
+
637
+ if (USE_PROFILES.mathMl === true) {
638
+ addToSet(ALLOWED_TAGS, mathMl$1);
639
+ addToSet(ALLOWED_ATTR, mathMl);
640
+ addToSet(ALLOWED_ATTR, xml);
641
+ }
642
+ }
643
+ /* Merge configuration parameters */
644
+
645
+
646
+ if (cfg.ADD_TAGS) {
647
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
648
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
649
+ }
650
+
651
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
652
+ }
653
+
654
+ if (cfg.ADD_ATTR) {
655
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
656
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
657
+ }
658
+
659
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
660
+ }
661
+
662
+ if (cfg.ADD_URI_SAFE_ATTR) {
663
+ addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
664
+ }
665
+
666
+ if (cfg.FORBID_CONTENTS) {
667
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
668
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
669
+ }
670
+
671
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
672
+ }
673
+ /* Add #text in case KEEP_CONTENT is set to true */
674
+
675
+
676
+ if (KEEP_CONTENT) {
677
+ ALLOWED_TAGS['#text'] = true;
678
+ }
679
+ /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
680
+
681
+
682
+ if (WHOLE_DOCUMENT) {
683
+ addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
684
+ }
685
+ /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
686
+
687
+
688
+ if (ALLOWED_TAGS.table) {
689
+ addToSet(ALLOWED_TAGS, ['tbody']);
690
+ delete FORBID_TAGS.tbody;
691
+ }
692
+
693
+ if (cfg.TRUSTED_TYPES_POLICY) {
694
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {
695
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
696
+ }
697
+
698
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {
699
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
700
+ } // Overwrite existing TrustedTypes policy.
701
+
702
+
703
+ trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY; // Sign local variables required by `sanitize`.
704
+
705
+ emptyHTML = trustedTypesPolicy.createHTML('');
706
+ } else {
707
+ // Uninitialized policy, attempt to initialize the internal dompurify policy.
708
+ if (trustedTypesPolicy === undefined) {
709
+ trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
710
+ } // If creating the internal policy succeeded sign internal variables.
711
+
712
+
713
+ if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {
714
+ emptyHTML = trustedTypesPolicy.createHTML('');
715
+ }
716
+ } // Prevent further manipulation of configuration.
717
+ // Not available in IE8, Safari 5, etc.
718
+
719
+
720
+ if (freeze) {
721
+ freeze(cfg);
722
+ }
723
+
724
+ CONFIG = cfg;
725
+ };
726
+
727
+ const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
728
+ const HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']); // Certain elements are allowed in both SVG and HTML
729
+ // namespace. We need to specify them explicitly
730
+ // so that they don't get erroneously deleted from
731
+ // HTML namespace.
732
+
733
+ const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
734
+ /* Keep track of all possible SVG and MathML tags
735
+ * so that we can perform the namespace checks
736
+ * correctly. */
737
+
738
+ const ALL_SVG_TAGS = addToSet({}, svg$1);
739
+ addToSet(ALL_SVG_TAGS, svgFilters);
740
+ addToSet(ALL_SVG_TAGS, svgDisallowed);
741
+ const ALL_MATHML_TAGS = addToSet({}, mathMl$1);
742
+ addToSet(ALL_MATHML_TAGS, mathMlDisallowed);
743
+ /**
744
+ *
745
+ *
746
+ * @param {Element} element a DOM element whose namespace is being checked
747
+ * @returns {boolean} Return false if the element has a
748
+ * namespace that a spec-compliant parser would never
749
+ * return. Return true otherwise.
750
+ */
751
+
752
+ const _checkValidNamespace = function _checkValidNamespace(element) {
753
+ let parent = getParentNode(element); // In JSDOM, if we're inside shadow DOM, then parentNode
754
+ // can be null. We just simulate parent in this case.
755
+
756
+ if (!parent || !parent.tagName) {
757
+ parent = {
758
+ namespaceURI: NAMESPACE,
759
+ tagName: 'template'
760
+ };
761
+ }
762
+
763
+ const tagName = stringToLowerCase(element.tagName);
764
+ const parentTagName = stringToLowerCase(parent.tagName);
765
+
766
+ if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
767
+ return false;
768
+ }
769
+
770
+ if (element.namespaceURI === SVG_NAMESPACE) {
771
+ // The only way to switch from HTML namespace to SVG
772
+ // is via <svg>. If it happens via any other tag, then
773
+ // it should be killed.
774
+ if (parent.namespaceURI === HTML_NAMESPACE) {
775
+ return tagName === 'svg';
776
+ } // The only way to switch from MathML to SVG is via`
777
+ // svg if parent is either <annotation-xml> or MathML
778
+ // text integration points.
779
+
780
+
781
+ if (parent.namespaceURI === MATHML_NAMESPACE) {
782
+ return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
783
+ } // We only allow elements that are defined in SVG
784
+ // spec. All others are disallowed in SVG namespace.
785
+
786
+
787
+ return Boolean(ALL_SVG_TAGS[tagName]);
788
+ }
789
+
790
+ if (element.namespaceURI === MATHML_NAMESPACE) {
791
+ // The only way to switch from HTML namespace to MathML
792
+ // is via <math>. If it happens via any other tag, then
793
+ // it should be killed.
794
+ if (parent.namespaceURI === HTML_NAMESPACE) {
795
+ return tagName === 'math';
796
+ } // The only way to switch from SVG to MathML is via
797
+ // <math> and HTML integration points
798
+
799
+
800
+ if (parent.namespaceURI === SVG_NAMESPACE) {
801
+ return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
802
+ } // We only allow elements that are defined in MathML
803
+ // spec. All others are disallowed in MathML namespace.
804
+
805
+
806
+ return Boolean(ALL_MATHML_TAGS[tagName]);
807
+ }
808
+
809
+ if (element.namespaceURI === HTML_NAMESPACE) {
810
+ // The only way to switch from SVG to HTML is via
811
+ // HTML integration points, and from MathML to HTML
812
+ // is via MathML text integration points
813
+ if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
814
+ return false;
815
+ }
816
+
817
+ if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
818
+ return false;
819
+ } // We disallow tags that are specific for MathML
820
+ // or SVG and should never appear in HTML namespace
821
+
822
+
823
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
824
+ } // For XHTML and XML documents that support custom namespaces
825
+
826
+
827
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {
828
+ return true;
829
+ } // The code should never reach this place (this means
830
+ // that the element somehow got namespace that is not
831
+ // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).
832
+ // Return false just in case.
833
+
834
+
835
+ return false;
836
+ };
837
+ /**
838
+ * _forceRemove
839
+ *
840
+ * @param {Node} node a DOM node
841
+ */
842
+
843
+
844
+ const _forceRemove = function _forceRemove(node) {
845
+ arrayPush(DOMPurify.removed, {
846
+ element: node
847
+ });
848
+
849
+ try {
850
+ // eslint-disable-next-line unicorn/prefer-dom-node-remove
851
+ node.parentNode.removeChild(node);
852
+ } catch (_) {
853
+ node.remove();
854
+ }
855
+ };
856
+ /**
857
+ * _removeAttribute
858
+ *
859
+ * @param {String} name an Attribute name
860
+ * @param {Node} node a DOM node
861
+ */
862
+
863
+
864
+ const _removeAttribute = function _removeAttribute(name, node) {
865
+ try {
866
+ arrayPush(DOMPurify.removed, {
867
+ attribute: node.getAttributeNode(name),
868
+ from: node
869
+ });
870
+ } catch (_) {
871
+ arrayPush(DOMPurify.removed, {
872
+ attribute: null,
873
+ from: node
874
+ });
875
+ }
876
+
877
+ node.removeAttribute(name); // We void attribute values for unremovable "is"" attributes
878
+
879
+ if (name === 'is' && !ALLOWED_ATTR[name]) {
880
+ if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
881
+ try {
882
+ _forceRemove(node);
883
+ } catch (_) {}
884
+ } else {
885
+ try {
886
+ node.setAttribute(name, '');
887
+ } catch (_) {}
888
+ }
889
+ }
890
+ };
891
+ /**
892
+ * _initDocument
893
+ *
894
+ * @param {String} dirty a string of dirty markup
895
+ * @return {Document} a DOM, filled with the dirty markup
896
+ */
897
+
898
+
899
+ const _initDocument = function _initDocument(dirty) {
900
+ /* Create a HTML document */
901
+ let doc;
902
+ let leadingWhitespace;
903
+
904
+ if (FORCE_BODY) {
905
+ dirty = '<remove></remove>' + dirty;
906
+ } else {
907
+ /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
908
+ const matches = stringMatch(dirty, /^[\r\n\t ]+/);
909
+ leadingWhitespace = matches && matches[0];
910
+ }
911
+
912
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {
913
+ // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
914
+ dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
915
+ }
916
+
917
+ const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
918
+ /*
919
+ * Use the DOMParser API by default, fallback later if needs be
920
+ * DOMParser not work for svg when has multiple root element.
921
+ */
922
+
923
+ if (NAMESPACE === HTML_NAMESPACE) {
924
+ try {
925
+ doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
926
+ } catch (_) {}
927
+ }
928
+ /* Use createHTMLDocument in case DOMParser is not available */
929
+
930
+
931
+ if (!doc || !doc.documentElement) {
932
+ doc = implementation.createDocument(NAMESPACE, 'template', null);
933
+
934
+ try {
935
+ doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
936
+ } catch (_) {// Syntax error if dirtyPayload is invalid xml
937
+ }
938
+ }
939
+
940
+ const body = doc.body || doc.documentElement;
941
+
942
+ if (dirty && leadingWhitespace) {
943
+ body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
944
+ }
945
+ /* Work on whole document or just its body */
946
+
947
+
948
+ if (NAMESPACE === HTML_NAMESPACE) {
949
+ return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
950
+ }
951
+
952
+ return WHOLE_DOCUMENT ? doc.documentElement : body;
953
+ };
954
+ /**
955
+ * _createIterator
956
+ *
957
+ * @param {Document} root document/fragment to create iterator for
958
+ * @return {Iterator} iterator instance
959
+ */
960
+
961
+
962
+ const _createIterator = function _createIterator(root) {
963
+ return createNodeIterator.call(root.ownerDocument || root, root, // eslint-disable-next-line no-bitwise
964
+ NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null, false);
965
+ };
966
+ /**
967
+ * _isClobbered
968
+ *
969
+ * @param {Node} elm element to check for clobbering attacks
970
+ * @return {Boolean} true if clobbered, false if safe
971
+ */
972
+
973
+
974
+ const _isClobbered = function _isClobbered(elm) {
975
+ return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function' || typeof elm.hasChildNodes !== 'function');
976
+ };
977
+ /**
978
+ * _isNode
979
+ *
980
+ * @param {Node} obj object to check whether it's a DOM node
981
+ * @return {Boolean} true is object is a DOM node
982
+ */
983
+
984
+
985
+ const _isNode = function _isNode(object) {
986
+ return typeof Node === 'object' ? object instanceof Node : object && typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string';
987
+ };
988
+ /**
989
+ * _executeHook
990
+ * Execute user configurable hooks
991
+ *
992
+ * @param {String} entryPoint Name of the hook's entry point
993
+ * @param {Node} currentNode node to work on with the hook
994
+ * @param {Object} data additional hook parameters
995
+ */
996
+
997
+
998
+ const _executeHook = function _executeHook(entryPoint, currentNode, data) {
999
+ if (!hooks[entryPoint]) {
1000
+ return;
1001
+ }
1002
+
1003
+ arrayForEach(hooks[entryPoint], hook => {
1004
+ hook.call(DOMPurify, currentNode, data, CONFIG);
1005
+ });
1006
+ };
1007
+ /**
1008
+ * _sanitizeElements
1009
+ *
1010
+ * @protect nodeName
1011
+ * @protect textContent
1012
+ * @protect removeChild
1013
+ *
1014
+ * @param {Node} currentNode to check for permission to exist
1015
+ * @return {Boolean} true if node was killed, false if left alive
1016
+ */
1017
+
1018
+
1019
+ const _sanitizeElements = function _sanitizeElements(currentNode) {
1020
+ let content;
1021
+ /* Execute a hook if present */
1022
+
1023
+ _executeHook('beforeSanitizeElements', currentNode, null);
1024
+ /* Check if element is clobbered or can clobber */
1025
+
1026
+
1027
+ if (_isClobbered(currentNode)) {
1028
+ _forceRemove(currentNode);
1029
+
1030
+ return true;
1031
+ }
1032
+ /* Now let's check the element's type and name */
1033
+
1034
+
1035
+ const tagName = transformCaseFunc(currentNode.nodeName);
1036
+ /* Execute a hook if present */
1037
+
1038
+ _executeHook('uponSanitizeElement', currentNode, {
1039
+ tagName,
1040
+ allowedTags: ALLOWED_TAGS
1041
+ });
1042
+ /* Detect mXSS attempts abusing namespace confusion */
1043
+
1044
+
1045
+ if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
1046
+ _forceRemove(currentNode);
1047
+
1048
+ return true;
1049
+ }
1050
+ /* Remove element if anything forbids its presence */
1051
+
1052
+
1053
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
1054
+ /* Check if we have a custom element to handle */
1055
+ if (!FORBID_TAGS[tagName] && _basicCustomElementTest(tagName)) {
1056
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
1057
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) return false;
1058
+ }
1059
+ /* Keep content except for bad-listed elements */
1060
+
1061
+
1062
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
1063
+ const parentNode = getParentNode(currentNode) || currentNode.parentNode;
1064
+ const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
1065
+
1066
+ if (childNodes && parentNode) {
1067
+ const childCount = childNodes.length;
1068
+
1069
+ for (let i = childCount - 1; i >= 0; --i) {
1070
+ parentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode));
1071
+ }
1072
+ }
1073
+ }
1074
+
1075
+ _forceRemove(currentNode);
1076
+
1077
+ return true;
1078
+ }
1079
+ /* Check whether element has a valid namespace */
1080
+
1081
+
1082
+ if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
1083
+ _forceRemove(currentNode);
1084
+
1085
+ return true;
1086
+ }
1087
+ /* Make sure that older browsers don't get noscript mXSS */
1088
+
1089
+
1090
+ if ((tagName === 'noscript' || tagName === 'noembed') && regExpTest(/<\/no(script|embed)/i, currentNode.innerHTML)) {
1091
+ _forceRemove(currentNode);
1092
+
1093
+ return true;
1094
+ }
1095
+ /* Sanitize element content to be template-safe */
1096
+
1097
+
1098
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
1099
+ /* Get the element's text content */
1100
+ content = currentNode.textContent;
1101
+ content = stringReplace(content, MUSTACHE_EXPR, ' ');
1102
+ content = stringReplace(content, ERB_EXPR, ' ');
1103
+ content = stringReplace(content, TMPLIT_EXPR, ' ');
1104
+
1105
+ if (currentNode.textContent !== content) {
1106
+ arrayPush(DOMPurify.removed, {
1107
+ element: currentNode.cloneNode()
1108
+ });
1109
+ currentNode.textContent = content;
1110
+ }
1111
+ }
1112
+ /* Execute a hook if present */
1113
+
1114
+
1115
+ _executeHook('afterSanitizeElements', currentNode, null);
1116
+
1117
+ return false;
1118
+ };
1119
+ /**
1120
+ * _isValidAttribute
1121
+ *
1122
+ * @param {string} lcTag Lowercase tag name of containing element.
1123
+ * @param {string} lcName Lowercase attribute name.
1124
+ * @param {string} value Attribute value.
1125
+ * @return {Boolean} Returns true if `value` is valid, otherwise false.
1126
+ */
1127
+ // eslint-disable-next-line complexity
1128
+
1129
+
1130
+ const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
1131
+ /* Make sure attribute cannot clobber */
1132
+ if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
1133
+ return false;
1134
+ }
1135
+ /* Allow valid data-* attributes: At least one character after "-"
1136
+ (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
1137
+ XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
1138
+ We don't need to check the value; it's always URI safe. */
1139
+
1140
+
1141
+ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
1142
+ if ( // First condition does a very basic check if a) it's basically a valid custom element tagname AND
1143
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1144
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
1145
+ _basicCustomElementTest(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) || // Alternative, second condition checks if it's an `is`-attribute, AND
1146
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1147
+ lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ; else {
1148
+ return false;
1149
+ }
1150
+ /* Check value is safe. First, is attr inert? If so, is safe */
1151
+
1152
+ } else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if (value) {
1153
+ return false;
1154
+ } else ;
1155
+
1156
+ return true;
1157
+ };
1158
+ /**
1159
+ * _basicCustomElementCheck
1160
+ * checks if at least one dash is included in tagName, and it's not the first char
1161
+ * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
1162
+ * @param {string} tagName name of the tag of the node to sanitize
1163
+ */
1164
+
1165
+
1166
+ const _basicCustomElementTest = function _basicCustomElementTest(tagName) {
1167
+ return tagName.indexOf('-') > 0;
1168
+ };
1169
+ /**
1170
+ * _sanitizeAttributes
1171
+ *
1172
+ * @protect attributes
1173
+ * @protect nodeName
1174
+ * @protect removeAttribute
1175
+ * @protect setAttribute
1176
+ *
1177
+ * @param {Node} currentNode to sanitize
1178
+ */
1179
+
1180
+
1181
+ const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
1182
+ let attr;
1183
+ let value;
1184
+ let lcName;
1185
+ let l;
1186
+ /* Execute a hook if present */
1187
+
1188
+ _executeHook('beforeSanitizeAttributes', currentNode, null);
1189
+
1190
+ const {
1191
+ attributes
1192
+ } = currentNode;
1193
+ /* Check if we have attributes; if not we might have a text node */
1194
+
1195
+ if (!attributes) {
1196
+ return;
1197
+ }
1198
+
1199
+ const hookEvent = {
1200
+ attrName: '',
1201
+ attrValue: '',
1202
+ keepAttr: true,
1203
+ allowedAttributes: ALLOWED_ATTR
1204
+ };
1205
+ l = attributes.length;
1206
+ /* Go backwards over all attributes; safely remove bad ones */
1207
+
1208
+ while (l--) {
1209
+ attr = attributes[l];
1210
+ const {
1211
+ name,
1212
+ namespaceURI
1213
+ } = attr;
1214
+ value = name === 'value' ? attr.value : stringTrim(attr.value);
1215
+ lcName = transformCaseFunc(name);
1216
+ /* Execute a hook if present */
1217
+
1218
+ hookEvent.attrName = lcName;
1219
+ hookEvent.attrValue = value;
1220
+ hookEvent.keepAttr = true;
1221
+ hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
1222
+
1223
+ _executeHook('uponSanitizeAttribute', currentNode, hookEvent);
1224
+
1225
+ value = hookEvent.attrValue;
1226
+ /* Did the hooks approve of the attribute? */
1227
+
1228
+ if (hookEvent.forceKeepAttr) {
1229
+ continue;
1230
+ }
1231
+ /* Remove attribute */
1232
+
1233
+
1234
+ _removeAttribute(name, currentNode);
1235
+ /* Did the hooks approve of the attribute? */
1236
+
1237
+
1238
+ if (!hookEvent.keepAttr) {
1239
+ continue;
1240
+ }
1241
+ /* Work around a security issue in jQuery 3.0 */
1242
+
1243
+
1244
+ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
1245
+ _removeAttribute(name, currentNode);
1246
+
1247
+ continue;
1248
+ }
1249
+ /* Sanitize attribute content to be template-safe */
1250
+
1251
+
1252
+ if (SAFE_FOR_TEMPLATES) {
1253
+ value = stringReplace(value, MUSTACHE_EXPR, ' ');
1254
+ value = stringReplace(value, ERB_EXPR, ' ');
1255
+ value = stringReplace(value, TMPLIT_EXPR, ' ');
1256
+ }
1257
+ /* Is `value` valid for this attribute? */
1258
+
1259
+
1260
+ const lcTag = transformCaseFunc(currentNode.nodeName);
1261
+
1262
+ if (!_isValidAttribute(lcTag, lcName, value)) {
1263
+ continue;
1264
+ }
1265
+ /* Full DOM Clobbering protection via namespace isolation,
1266
+ * Prefix id and name attributes with `user-content-`
1267
+ */
1268
+
1269
+
1270
+ if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {
1271
+ // Remove the attribute with this value
1272
+ _removeAttribute(name, currentNode); // Prefix the value and later re-create the attribute with the sanitized value
1273
+
1274
+
1275
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
1276
+ }
1277
+ /* Handle attributes that require Trusted Types */
1278
+
1279
+
1280
+ if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {
1281
+ if (namespaceURI) ; else {
1282
+ switch (trustedTypes.getAttributeType(lcTag, lcName)) {
1283
+ case 'TrustedHTML':
1284
+ {
1285
+ value = trustedTypesPolicy.createHTML(value);
1286
+ break;
1287
+ }
1288
+
1289
+ case 'TrustedScriptURL':
1290
+ {
1291
+ value = trustedTypesPolicy.createScriptURL(value);
1292
+ break;
1293
+ }
1294
+ }
1295
+ }
1296
+ }
1297
+ /* Handle invalid data-* attribute set by try-catching it */
1298
+
1299
+
1300
+ try {
1301
+ if (namespaceURI) {
1302
+ currentNode.setAttributeNS(namespaceURI, name, value);
1303
+ } else {
1304
+ /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
1305
+ currentNode.setAttribute(name, value);
1306
+ }
1307
+
1308
+ arrayPop(DOMPurify.removed);
1309
+ } catch (_) {}
1310
+ }
1311
+ /* Execute a hook if present */
1312
+
1313
+
1314
+ _executeHook('afterSanitizeAttributes', currentNode, null);
1315
+ };
1316
+ /**
1317
+ * _sanitizeShadowDOM
1318
+ *
1319
+ * @param {DocumentFragment} fragment to iterate over recursively
1320
+ */
1321
+
1322
+
1323
+ const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
1324
+ let shadowNode;
1325
+
1326
+ const shadowIterator = _createIterator(fragment);
1327
+ /* Execute a hook if present */
1328
+
1329
+
1330
+ _executeHook('beforeSanitizeShadowDOM', fragment, null);
1331
+
1332
+ while (shadowNode = shadowIterator.nextNode()) {
1333
+ /* Execute a hook if present */
1334
+ _executeHook('uponSanitizeShadowNode', shadowNode, null);
1335
+ /* Sanitize tags and elements */
1336
+
1337
+
1338
+ if (_sanitizeElements(shadowNode)) {
1339
+ continue;
1340
+ }
1341
+ /* Deep shadow DOM detected */
1342
+
1343
+
1344
+ if (shadowNode.content instanceof DocumentFragment) {
1345
+ _sanitizeShadowDOM(shadowNode.content);
1346
+ }
1347
+ /* Check attributes, sanitize if necessary */
1348
+
1349
+
1350
+ _sanitizeAttributes(shadowNode);
1351
+ }
1352
+ /* Execute a hook if present */
1353
+
1354
+
1355
+ _executeHook('afterSanitizeShadowDOM', fragment, null);
1356
+ };
1357
+ /**
1358
+ * Sanitize
1359
+ * Public method providing core sanitation functionality
1360
+ *
1361
+ * @param {String|Node} dirty string or DOM node
1362
+ * @param {Object} configuration object
1363
+ */
1364
+ // eslint-disable-next-line complexity
1365
+
1366
+
1367
+ DOMPurify.sanitize = function (dirty) {
1368
+ let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1369
+ let body;
1370
+ let importedNode;
1371
+ let currentNode;
1372
+ let returnNode;
1373
+ /* Make sure we have a string to sanitize.
1374
+ DO NOT return early, as this will return the wrong type if
1375
+ the user has requested a DOM object rather than a string */
1376
+
1377
+ IS_EMPTY_INPUT = !dirty;
1378
+
1379
+ if (IS_EMPTY_INPUT) {
1380
+ dirty = '<!-->';
1381
+ }
1382
+ /* Stringify, in case dirty is an object */
1383
+
1384
+
1385
+ if (typeof dirty !== 'string' && !_isNode(dirty)) {
1386
+ if (typeof dirty.toString === 'function') {
1387
+ dirty = dirty.toString();
1388
+
1389
+ if (typeof dirty !== 'string') {
1390
+ throw typeErrorCreate('dirty is not a string, aborting');
1391
+ }
1392
+ } else {
1393
+ throw typeErrorCreate('toString is not a function');
1394
+ }
1395
+ }
1396
+ /* Return dirty HTML if DOMPurify cannot run */
1397
+
1398
+
1399
+ if (!DOMPurify.isSupported) {
1400
+ return dirty;
1401
+ }
1402
+ /* Assign config vars */
1403
+
1404
+
1405
+ if (!SET_CONFIG) {
1406
+ _parseConfig(cfg);
1407
+ }
1408
+ /* Clean up removed elements */
1409
+
1410
+
1411
+ DOMPurify.removed = [];
1412
+ /* Check if dirty is correctly typed for IN_PLACE */
1413
+
1414
+ if (typeof dirty === 'string') {
1415
+ IN_PLACE = false;
1416
+ }
1417
+
1418
+ if (IN_PLACE) {
1419
+ /* Do some early pre-sanitization to avoid unsafe root nodes */
1420
+ if (dirty.nodeName) {
1421
+ const tagName = transformCaseFunc(dirty.nodeName);
1422
+
1423
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
1424
+ throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
1425
+ }
1426
+ }
1427
+ } else if (dirty instanceof Node) {
1428
+ /* If dirty is a DOM element, append to an empty document to avoid
1429
+ elements being stripped by the parser */
1430
+ body = _initDocument('<!---->');
1431
+ importedNode = body.ownerDocument.importNode(dirty, true);
1432
+
1433
+ if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {
1434
+ /* Node is already a body, use as is */
1435
+ body = importedNode;
1436
+ } else if (importedNode.nodeName === 'HTML') {
1437
+ body = importedNode;
1438
+ } else {
1439
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
1440
+ body.appendChild(importedNode);
1441
+ }
1442
+ } else {
1443
+ /* Exit directly if we have nothing to do */
1444
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
1445
+ dirty.indexOf('<') === -1) {
1446
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
1447
+ }
1448
+ /* Initialize the document to work on */
1449
+
1450
+
1451
+ body = _initDocument(dirty);
1452
+ /* Check we have a DOM node from the data */
1453
+
1454
+ if (!body) {
1455
+ return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';
1456
+ }
1457
+ }
1458
+ /* Remove first element node (ours) if FORCE_BODY is set */
1459
+
1460
+
1461
+ if (body && FORCE_BODY) {
1462
+ _forceRemove(body.firstChild);
1463
+ }
1464
+ /* Get node iterator */
1465
+
1466
+
1467
+ const nodeIterator = _createIterator(IN_PLACE ? dirty : body);
1468
+ /* Now start iterating over the created document */
1469
+
1470
+
1471
+ while (currentNode = nodeIterator.nextNode()) {
1472
+ /* Sanitize tags and elements */
1473
+ if (_sanitizeElements(currentNode)) {
1474
+ continue;
1475
+ }
1476
+ /* Shadow DOM detected, sanitize it */
1477
+
1478
+
1479
+ if (currentNode.content instanceof DocumentFragment) {
1480
+ _sanitizeShadowDOM(currentNode.content);
1481
+ }
1482
+ /* Check attributes, sanitize if necessary */
1483
+
1484
+
1485
+ _sanitizeAttributes(currentNode);
1486
+ }
1487
+ /* If we sanitized `dirty` in-place, return it. */
1488
+
1489
+
1490
+ if (IN_PLACE) {
1491
+ return dirty;
1492
+ }
1493
+ /* Return sanitized string or DOM */
1494
+
1495
+
1496
+ if (RETURN_DOM) {
1497
+ if (RETURN_DOM_FRAGMENT) {
1498
+ returnNode = createDocumentFragment.call(body.ownerDocument);
1499
+
1500
+ while (body.firstChild) {
1501
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
1502
+ returnNode.appendChild(body.firstChild);
1503
+ }
1504
+ } else {
1505
+ returnNode = body;
1506
+ }
1507
+
1508
+ if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmod) {
1509
+ /*
1510
+ AdoptNode() is not used because internal state is not reset
1511
+ (e.g. the past names map of a HTMLFormElement), this is safe
1512
+ in theory but we would rather not risk another attack vector.
1513
+ The state that is cloned by importNode() is explicitly defined
1514
+ by the specs.
1515
+ */
1516
+ returnNode = importNode.call(originalDocument, returnNode, true);
1517
+ }
1518
+
1519
+ return returnNode;
1520
+ }
1521
+
1522
+ let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
1523
+ /* Serialize doctype if allowed */
1524
+
1525
+ if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
1526
+ serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML;
1527
+ }
1528
+ /* Sanitize final string template-safe */
1529
+
1530
+
1531
+ if (SAFE_FOR_TEMPLATES) {
1532
+ serializedHTML = stringReplace(serializedHTML, MUSTACHE_EXPR, ' ');
1533
+ serializedHTML = stringReplace(serializedHTML, ERB_EXPR, ' ');
1534
+ serializedHTML = stringReplace(serializedHTML, TMPLIT_EXPR, ' ');
1535
+ }
1536
+
1537
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
1538
+ };
1539
+ /**
1540
+ * Public method to set the configuration once
1541
+ * setConfig
1542
+ *
1543
+ * @param {Object} cfg configuration object
1544
+ */
1545
+
1546
+
1547
+ DOMPurify.setConfig = function (cfg) {
1548
+ _parseConfig(cfg);
1549
+
1550
+ SET_CONFIG = true;
1551
+ };
1552
+ /**
1553
+ * Public method to remove the configuration
1554
+ * clearConfig
1555
+ *
1556
+ */
1557
+
1558
+
1559
+ DOMPurify.clearConfig = function () {
1560
+ CONFIG = null;
1561
+ SET_CONFIG = false;
1562
+ };
1563
+ /**
1564
+ * Public method to check if an attribute value is valid.
1565
+ * Uses last set config, if any. Otherwise, uses config defaults.
1566
+ * isValidAttribute
1567
+ *
1568
+ * @param {string} tag Tag name of containing element.
1569
+ * @param {string} attr Attribute name.
1570
+ * @param {string} value Attribute value.
1571
+ * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.
1572
+ */
1573
+
1574
+
1575
+ DOMPurify.isValidAttribute = function (tag, attr, value) {
1576
+ /* Initialize shared config vars if necessary. */
1577
+ if (!CONFIG) {
1578
+ _parseConfig({});
1579
+ }
1580
+
1581
+ const lcTag = transformCaseFunc(tag);
1582
+ const lcName = transformCaseFunc(attr);
1583
+ return _isValidAttribute(lcTag, lcName, value);
1584
+ };
1585
+ /**
1586
+ * AddHook
1587
+ * Public method to add DOMPurify hooks
1588
+ *
1589
+ * @param {String} entryPoint entry point for the hook to add
1590
+ * @param {Function} hookFunction function to execute
1591
+ */
1592
+
1593
+
1594
+ DOMPurify.addHook = function (entryPoint, hookFunction) {
1595
+ if (typeof hookFunction !== 'function') {
1596
+ return;
1597
+ }
1598
+
1599
+ hooks[entryPoint] = hooks[entryPoint] || [];
1600
+ arrayPush(hooks[entryPoint], hookFunction);
1601
+ };
1602
+ /**
1603
+ * RemoveHook
1604
+ * Public method to remove a DOMPurify hook at a given entryPoint
1605
+ * (pops it from the stack of hooks if more are present)
1606
+ *
1607
+ * @param {String} entryPoint entry point for the hook to remove
1608
+ * @return {Function} removed(popped) hook
1609
+ */
1610
+
1611
+
1612
+ DOMPurify.removeHook = function (entryPoint) {
1613
+ if (hooks[entryPoint]) {
1614
+ return arrayPop(hooks[entryPoint]);
1615
+ }
1616
+ };
1617
+ /**
1618
+ * RemoveHooks
1619
+ * Public method to remove all DOMPurify hooks at a given entryPoint
1620
+ *
1621
+ * @param {String} entryPoint entry point for the hooks to remove
1622
+ */
1623
+
1624
+
1625
+ DOMPurify.removeHooks = function (entryPoint) {
1626
+ if (hooks[entryPoint]) {
1627
+ hooks[entryPoint] = [];
1628
+ }
1629
+ };
1630
+ /**
1631
+ * RemoveAllHooks
1632
+ * Public method to remove all DOMPurify hooks
1633
+ *
1634
+ */
1635
+
1636
+
1637
+ DOMPurify.removeAllHooks = function () {
1638
+ hooks = {};
1639
+ };
1640
+
1641
+ return DOMPurify;
1642
+ }
1643
+
1644
+ var purify = createDOMPurify();
1645
+
1646
+ return purify;
1647
+
1648
+ }));
1649
+ //# sourceMappingURL=purify.js.map
1650
+ });
1651
+
1652
+ function tagRegXp(tagName) {
1653
+ return RegExp(/^tttx-/).exec(tagName);
1654
+ }
1655
+ function attributeNameCheck() {
1656
+ return true;
1657
+ }
1658
+ const domSanitiserOptions = {
1659
+ CUSTOM_ELEMENT_HANDLING: {
1660
+ tagNameCheck: tagRegXp,
1661
+ attributeNameCheck: attributeNameCheck,
1662
+ allowCustomizedBuiltInElements: false, // customized built-ins are not allowed
1663
+ }
1664
+ };
1665
+
1666
+ exports.domSanitiserOptions = domSanitiserOptions;
1667
+ exports.purify = purify;