@3t-transform/threeteeui 0.1.6 → 0.1.7

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