bkui-vue 2.0.2-beta.5 → 2.0.2-beta.51

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 (303) hide show
  1. package/License.txt +1 -2
  2. package/dist/cli.css +1 -0
  3. package/dist/index.cjs.js +133 -132
  4. package/dist/index.esm.js +16844 -14959
  5. package/dist/index.umd.js +133 -132
  6. package/dist/locale/en.esm.js.map +1 -1
  7. package/dist/locale/en.umd.js.map +1 -1
  8. package/dist/locale/ja-jp.esm.js +2 -0
  9. package/dist/locale/ja-jp.esm.js.map +1 -0
  10. package/dist/locale/ja-jp.umd.js +2 -0
  11. package/dist/locale/ja-jp.umd.js.map +1 -0
  12. package/dist/locale/zh-cn.esm.js.map +1 -1
  13. package/dist/locale/zh-cn.umd.js.map +1 -1
  14. package/dist/style.variable.css +1 -1
  15. package/lib/affix/affix.variable.css +1 -0
  16. package/lib/affix/index.js +2 -2
  17. package/lib/alert/alert.variable.css +1 -0
  18. package/lib/alert/index.js +2 -2
  19. package/lib/animate-number/index.js +2 -2
  20. package/lib/backtop/backtop.variable.css +1 -0
  21. package/lib/backtop/index.js +2 -2
  22. package/lib/badge/badge.variable.css +1 -0
  23. package/lib/badge/index.js +2 -2
  24. package/lib/breadcrumb/breadcrumb.variable.css +1 -0
  25. package/lib/breadcrumb/index.js +3 -3
  26. package/lib/button/button.d.ts +1 -1
  27. package/lib/button/button.variable.css +1 -0
  28. package/lib/button/index.js +3 -3
  29. package/lib/card/card.variable.css +1 -0
  30. package/lib/card/index.js +2 -2
  31. package/lib/cascader/cascader.css +26 -24
  32. package/lib/cascader/cascader.d.ts +12 -0
  33. package/lib/cascader/cascader.less +78 -76
  34. package/lib/cascader/cascader.variable.css +27 -24
  35. package/lib/cascader/index.d.ts +26 -0
  36. package/lib/cascader/index.js +120 -70
  37. package/lib/checkbox/checkbox.variable.css +1 -0
  38. package/lib/checkbox/index.js +5 -5
  39. package/lib/code-diff/code-diff.variable.css +1 -0
  40. package/lib/code-diff/index.js +2 -2
  41. package/lib/collapse/collapse.variable.css +1 -0
  42. package/lib/collapse/index.js +3 -3
  43. package/lib/collapse-transition/collapse-transition.variable.css +1 -0
  44. package/lib/collapse-transition/index.js +2 -2
  45. package/lib/color-picker/color-picker.variable.css +1 -0
  46. package/lib/color-picker/index.js +33 -29
  47. package/lib/components.d.ts +1 -2
  48. package/lib/components.js +2 -3
  49. package/lib/config-provider/config-provider.variable.css +1 -0
  50. package/lib/config-provider/index.d.ts +1 -1
  51. package/lib/config-provider/index.js +6 -6
  52. package/lib/container/container.variable.css +1 -0
  53. package/lib/container/index.js +5 -5
  54. package/lib/date-picker/date-picker.variable.css +1 -0
  55. package/lib/date-picker/index.js +74 -79
  56. package/lib/date-picker/panel/time.d.ts +1 -1
  57. package/lib/date-picker/utils.d.ts +5 -17
  58. package/lib/dialog/dialog.css +20 -1
  59. package/lib/dialog/dialog.variable.css +21 -1
  60. package/lib/dialog/index.js +13 -36
  61. package/lib/directives/index.js +22 -18
  62. package/lib/dist.index.js +1 -1
  63. package/lib/divider/divider.variable.css +1 -0
  64. package/lib/divider/index.js +3 -3
  65. package/lib/dropdown/dropdown.d.ts +1 -0
  66. package/lib/dropdown/dropdown.variable.css +1 -0
  67. package/lib/dropdown/index.d.ts +3 -0
  68. package/lib/dropdown/index.js +15 -10
  69. package/lib/exception/exception.variable.css +1 -0
  70. package/lib/exception/index.js +2 -2
  71. package/lib/fixed-navbar/fixed-navbar.variable.css +1 -0
  72. package/lib/fixed-navbar/index.js +2 -2
  73. package/lib/form/form-item.d.ts +19 -0
  74. package/lib/form/form.css +16 -4
  75. package/lib/form/form.less +24 -6
  76. package/lib/form/form.variable.css +17 -4
  77. package/lib/form/index.d.ts +13 -0
  78. package/lib/form/index.js +44 -36
  79. package/lib/hooks.js +1 -1
  80. package/lib/icon/angle-double-down-line.js +1 -1
  81. package/lib/icon/angle-double-left-line.js +1 -1
  82. package/lib/icon/angle-double-left.js +1 -1
  83. package/lib/icon/angle-double-right-line.js +1 -1
  84. package/lib/icon/angle-double-right.js +1 -1
  85. package/lib/icon/angle-double-up-line.js +1 -1
  86. package/lib/icon/angle-down-fill.js +1 -1
  87. package/lib/icon/angle-down-line.js +1 -1
  88. package/lib/icon/angle-down.js +1 -1
  89. package/lib/icon/angle-left.js +1 -1
  90. package/lib/icon/angle-right.js +1 -1
  91. package/lib/icon/angle-up-fill.js +1 -1
  92. package/lib/icon/angle-up.js +1 -1
  93. package/lib/icon/archive-fill.js +1 -1
  94. package/lib/icon/arrows-left.js +1 -1
  95. package/lib/icon/arrows-right.js +1 -1
  96. package/lib/icon/assistant.js +1 -1
  97. package/lib/icon/audio-fill.js +1 -1
  98. package/lib/icon/bk.js +1 -1
  99. package/lib/icon/circle.js +1 -1
  100. package/lib/icon/close-line.js +1 -1
  101. package/lib/icon/close.js +1 -1
  102. package/lib/icon/code.js +1 -1
  103. package/lib/icon/cog-shape.js +1 -1
  104. package/lib/icon/collapse-left.js +1 -1
  105. package/lib/icon/copy-shape.js +1 -1
  106. package/lib/icon/copy.js +1 -1
  107. package/lib/icon/data-shape.js +1 -1
  108. package/lib/icon/del.js +1 -1
  109. package/lib/icon/doc-fill.js +1 -1
  110. package/lib/icon/done.js +1 -1
  111. package/lib/icon/down-shape.js +1 -1
  112. package/lib/icon/down-small.js +1 -1
  113. package/lib/icon/edit-line.js +1 -1
  114. package/lib/icon/ellipsis.js +1 -1
  115. package/lib/icon/enlarge-line.js +1 -1
  116. package/lib/icon/error.js +1 -1
  117. package/lib/icon/excel-fill.js +1 -1
  118. package/lib/icon/exclamation-circle-shape.js +1 -1
  119. package/lib/icon/eye.js +1 -1
  120. package/lib/icon/filliscreen-line.js +1 -1
  121. package/lib/icon/fix-line.js +1 -1
  122. package/lib/icon/fix-shape.js +1 -1
  123. package/lib/icon/folder-open.js +1 -1
  124. package/lib/icon/folder-shape-open.js +1 -1
  125. package/lib/icon/folder-shape.js +1 -1
  126. package/lib/icon/folder.js +1 -1
  127. package/lib/icon/funnel.js +1 -1
  128. package/lib/icon/grag-fill.js +1 -1
  129. package/lib/icon/help-document-fill.js +1 -1
  130. package/lib/icon/help-fill.js +1 -1
  131. package/lib/icon/help.js +1 -1
  132. package/lib/icon/image-fill.js +1 -1
  133. package/lib/icon/img-error.js +1 -1
  134. package/lib/icon/img-placehoulder.js +1 -1
  135. package/lib/icon/index.js +1 -1
  136. package/lib/icon/info-line.js +1 -1
  137. package/lib/icon/info.js +1 -1
  138. package/lib/icon/left-shape.js +1 -1
  139. package/lib/icon/left-turn-line.js +1 -1
  140. package/lib/icon/loading.js +1 -1
  141. package/lib/icon/narrow-line.js +1 -1
  142. package/lib/icon/original.js +1 -1
  143. package/lib/icon/pdf-fill.js +1 -1
  144. package/lib/icon/play-shape.js +1 -1
  145. package/lib/icon/plus.js +1 -1
  146. package/lib/icon/ppt-fill.js +1 -1
  147. package/lib/icon/qq.js +1 -1
  148. package/lib/icon/right-shape.js +1 -1
  149. package/lib/icon/right-turn-line.js +1 -1
  150. package/lib/icon/search.js +1 -1
  151. package/lib/icon/share.js +1 -1
  152. package/lib/icon/spinner.js +1 -1
  153. package/lib/icon/success.js +1 -1
  154. package/lib/icon/switcher-loading.js +1 -1
  155. package/lib/icon/text-all.js +1 -1
  156. package/lib/icon/text-file.js +1 -1
  157. package/lib/icon/text-fill.js +1 -1
  158. package/lib/icon/transfer.js +1 -1
  159. package/lib/icon/tree-application-shape.js +1 -1
  160. package/lib/icon/unfull-screen.js +1 -1
  161. package/lib/icon/unvisible.js +1 -1
  162. package/lib/icon/up-shape.js +1 -1
  163. package/lib/icon/upload.js +1 -1
  164. package/lib/icon/video-fill.js +1 -1
  165. package/lib/icon/warn.js +1 -1
  166. package/lib/icon/weixin-pro.js +1 -1
  167. package/lib/icon/weixin.js +1 -1
  168. package/lib/image/image-viewer.variable.css +1 -0
  169. package/lib/image/image.variable.css +1 -0
  170. package/lib/image/index.js +15 -18
  171. package/lib/index.d.ts +0 -1
  172. package/lib/index.js +1 -2
  173. package/lib/info-box/index.js +22 -7
  174. package/lib/info-box/info-box.css +20 -1
  175. package/lib/info-box/info-box.d.ts +1 -0
  176. package/lib/info-box/info-box.less +28 -2
  177. package/lib/info-box/info-box.variable.css +22 -2
  178. package/lib/input/index.d.ts +39 -20
  179. package/lib/input/index.js +33 -30
  180. package/lib/input/input.d.ts +30 -16
  181. package/lib/input/input.variable.css +1 -0
  182. package/lib/link/index.js +2 -2
  183. package/lib/link/link.variable.css +1 -0
  184. package/lib/loading/index.js +3 -3
  185. package/lib/loading/loading.variable.css +1 -0
  186. package/lib/locale/index.d.ts +1 -0
  187. package/lib/locale/index.js +172 -4
  188. package/lib/locale/lang/ja-jp.d.ts +3 -0
  189. package/lib/menu/index.js +12 -9
  190. package/lib/menu/menu.variable.css +1 -0
  191. package/lib/menu/submenu.variable.css +1 -0
  192. package/lib/message/index.js +4 -4
  193. package/lib/message/message.variable.css +1 -0
  194. package/lib/modal/index.js +7 -6
  195. package/lib/modal/modal.css +20 -1
  196. package/lib/modal/modal.variable.css +21 -1
  197. package/lib/navigation/index.js +3 -3
  198. package/lib/navigation/navigation.variable.css +1 -0
  199. package/lib/notify/index.js +3 -3
  200. package/lib/notify/notify.variable.css +1 -0
  201. package/lib/overflow-title/index.js +3 -3
  202. package/lib/pagination/index.js +6 -6
  203. package/lib/pagination/pagination.variable.css +1 -0
  204. package/lib/pop-confirm/index.d.ts +584 -0
  205. package/lib/pop-confirm/index.js +10 -6
  206. package/lib/pop-confirm/pop-confirm.d.ts +292 -0
  207. package/lib/pop-confirm/pop-confirm.variable.css +1 -0
  208. package/lib/pop-confirm/props.d.ts +146 -0
  209. package/lib/popover/index.js +24 -27
  210. package/lib/popover/popover.variable.css +1 -0
  211. package/lib/popover2/index.js +2 -2
  212. package/lib/preset.js +1 -1
  213. package/lib/process/index.js +2 -2
  214. package/lib/process/process.d.ts +1 -1
  215. package/lib/process/process.variable.css +1 -0
  216. package/lib/progress/index.js +4 -4
  217. package/lib/progress/progress.variable.css +1 -0
  218. package/lib/radio/index.js +5 -5
  219. package/lib/radio/radio.variable.css +1 -0
  220. package/lib/rate/index.js +3 -3
  221. package/lib/rate/rate.variable.css +1 -0
  222. package/lib/resize-layout/index.js +2 -2
  223. package/lib/resize-layout/resize-layout.variable.css +1 -0
  224. package/lib/scrollbar/css/scrollbar.variable.css +1 -0
  225. package/lib/scrollbar/index.js +6 -6
  226. package/lib/search-select/index.d.ts +21 -3
  227. package/lib/search-select/index.js +73 -41
  228. package/lib/search-select/input.d.ts +3 -0
  229. package/lib/search-select/search-select.d.ts +7 -1
  230. package/lib/search-select/search-select.variable.css +1 -0
  231. package/lib/search-select/selected.d.ts +6 -0
  232. package/lib/select/index.d.ts +22 -3
  233. package/lib/select/index.js +39 -39
  234. package/lib/select/select.d.ts +11 -1
  235. package/lib/select/select.variable.css +1 -0
  236. package/lib/shared/index.d.ts +1 -1
  237. package/lib/shared/index.js +10 -10
  238. package/lib/shared/z-index-manager.d.ts +1 -1
  239. package/lib/sideslider/index.js +5 -3
  240. package/lib/sideslider/sideslider.variable.css +1 -0
  241. package/lib/slider/index.d.ts +1 -1
  242. package/lib/slider/index.js +5 -4
  243. package/lib/slider/slider-button.d.ts +1 -1
  244. package/lib/slider/slider.d.ts +1 -1
  245. package/lib/slider/slider.variable.css +1 -0
  246. package/lib/steps/index.js +2 -2
  247. package/lib/steps/steps.d.ts +1 -1
  248. package/lib/steps/steps.variable.css +1 -0
  249. package/lib/styles/mixins/animate.variable.css +1 -0
  250. package/lib/styles/mixins/popper.variable.css +1 -0
  251. package/lib/styles/mixins/scroll.variable.css +1 -0
  252. package/lib/styles/reset.variable.css +1 -0
  253. package/lib/styles/themes/themes.less +3 -0
  254. package/lib/swiper/index.js +2 -2
  255. package/lib/swiper/swiper.variable.css +1 -0
  256. package/lib/switcher/index.js +2 -2
  257. package/lib/switcher/switcher.variable.css +1 -0
  258. package/lib/tab/index.d.ts +12 -0
  259. package/lib/tab/index.js +26 -23
  260. package/lib/tab/props.d.ts +3 -0
  261. package/lib/tab/tab.d.ts +6 -0
  262. package/lib/tab/tab.variable.css +1 -0
  263. package/lib/table/index.js +39 -47
  264. package/lib/table/plugins/head-filter.variable.css +1 -0
  265. package/lib/table/plugins/head-sort.variable.css +1 -0
  266. package/lib/table/plugins/settings.variable.css +1 -0
  267. package/lib/table/table.variable.css +1 -0
  268. package/lib/table-column/index.js +1 -1
  269. package/lib/tag/index.js +2 -2
  270. package/lib/tag/tag.variable.css +1 -0
  271. package/lib/tag-input/index.d.ts +3 -0
  272. package/lib/tag-input/index.js +1398 -38
  273. package/lib/tag-input/tag-input.d.ts +1 -0
  274. package/lib/tag-input/tag-input.variable.css +1 -0
  275. package/lib/time-picker/index.js +1 -1
  276. package/lib/time-picker/time-picker.variable.css +1 -0
  277. package/lib/timeline/index.js +1353 -4
  278. package/lib/timeline/timeline.d.ts +1 -1
  279. package/lib/timeline/timeline.variable.css +1 -0
  280. package/lib/transfer/index.d.ts +1 -1
  281. package/lib/transfer/index.js +4 -4
  282. package/lib/transfer/transfer.d.ts +1 -1
  283. package/lib/transfer/transfer.variable.css +1 -0
  284. package/lib/tree/constant.d.ts +2 -0
  285. package/lib/tree/index.d.ts +48 -0
  286. package/lib/tree/index.js +221 -71
  287. package/lib/tree/props.d.ts +20 -0
  288. package/lib/tree/tree.css +46 -0
  289. package/lib/tree/tree.d.ts +22 -0
  290. package/lib/tree/tree.less +57 -2
  291. package/lib/tree/tree.variable.css +47 -0
  292. package/lib/tree/use-node-action.d.ts +2 -2
  293. package/lib/upload/index.js +8 -8
  294. package/lib/upload/upload.variable.css +1 -0
  295. package/lib/virtual-render/index.js +7 -7
  296. package/lib/virtual-render/virtual-render.variable.css +1 -0
  297. package/lib/volar.components.d.ts +1 -1
  298. package/package.json +13 -2
  299. package/dist/style.css +0 -1
  300. package/lib/plugin-popover/index.d.ts +0 -27
  301. package/lib/plugin-popover/index.js +0 -65
  302. package/lib/plugins/index.d.ts +0 -1
  303. package/lib/plugins/index.js +0 -64
@@ -54,6 +54,1354 @@ const external_vue_namespaceObject = external_vue_x({ ["createVNode"]: () => __W
54
54
  var config_provider_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
55
55
  var config_provider_y = x => () => x
56
56
  const config_provider_namespaceObject = config_provider_x({ ["usePrefix"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_config_provider_fe8577a3__.usePrefix });
57
+ ;// CONCATENATED MODULE: ../../node_modules/dompurify/dist/purify.es.mjs
58
+ /*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */
59
+
60
+ const {
61
+ entries,
62
+ setPrototypeOf,
63
+ isFrozen,
64
+ getPrototypeOf,
65
+ getOwnPropertyDescriptor
66
+ } = Object;
67
+ let {
68
+ freeze,
69
+ seal,
70
+ create
71
+ } = Object; // eslint-disable-line import/no-mutable-exports
72
+ let {
73
+ apply,
74
+ construct
75
+ } = typeof Reflect !== 'undefined' && Reflect;
76
+ if (!freeze) {
77
+ freeze = function freeze(x) {
78
+ return x;
79
+ };
80
+ }
81
+ if (!seal) {
82
+ seal = function seal(x) {
83
+ return x;
84
+ };
85
+ }
86
+ if (!apply) {
87
+ apply = function apply(fun, thisValue, args) {
88
+ return fun.apply(thisValue, args);
89
+ };
90
+ }
91
+ if (!construct) {
92
+ construct = function construct(Func, args) {
93
+ return new Func(...args);
94
+ };
95
+ }
96
+ const arrayForEach = unapply(Array.prototype.forEach);
97
+ const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
98
+ const arrayPop = unapply(Array.prototype.pop);
99
+ const arrayPush = unapply(Array.prototype.push);
100
+ const arraySplice = unapply(Array.prototype.splice);
101
+ const stringToLowerCase = unapply(String.prototype.toLowerCase);
102
+ const stringToString = unapply(String.prototype.toString);
103
+ const stringMatch = unapply(String.prototype.match);
104
+ const stringReplace = unapply(String.prototype.replace);
105
+ const stringIndexOf = unapply(String.prototype.indexOf);
106
+ const stringTrim = unapply(String.prototype.trim);
107
+ const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
108
+ const regExpTest = unapply(RegExp.prototype.test);
109
+ const typeErrorCreate = unconstruct(TypeError);
110
+ /**
111
+ * Creates a new function that calls the given function with a specified thisArg and arguments.
112
+ *
113
+ * @param func - The function to be wrapped and called.
114
+ * @returns A new function that calls the given function with a specified thisArg and arguments.
115
+ */
116
+ function unapply(func) {
117
+ return function (thisArg) {
118
+ if (thisArg instanceof RegExp) {
119
+ thisArg.lastIndex = 0;
120
+ }
121
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
122
+ args[_key - 1] = arguments[_key];
123
+ }
124
+ return apply(func, thisArg, args);
125
+ };
126
+ }
127
+ /**
128
+ * Creates a new function that constructs an instance of the given constructor function with the provided arguments.
129
+ *
130
+ * @param func - The constructor function to be wrapped and called.
131
+ * @returns A new function that constructs an instance of the given constructor function with the provided arguments.
132
+ */
133
+ function unconstruct(func) {
134
+ return function () {
135
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
136
+ args[_key2] = arguments[_key2];
137
+ }
138
+ return construct(func, args);
139
+ };
140
+ }
141
+ /**
142
+ * Add properties to a lookup table
143
+ *
144
+ * @param set - The set to which elements will be added.
145
+ * @param array - The array containing elements to be added to the set.
146
+ * @param transformCaseFunc - An optional function to transform the case of each element before adding to the set.
147
+ * @returns The modified set with added elements.
148
+ */
149
+ function addToSet(set, array) {
150
+ let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase;
151
+ if (setPrototypeOf) {
152
+ // Make 'in' and truthy checks like Boolean(set.constructor)
153
+ // independent of any properties defined on Object.prototype.
154
+ // Prevent prototype setters from intercepting set as a this value.
155
+ setPrototypeOf(set, null);
156
+ }
157
+ let l = array.length;
158
+ while (l--) {
159
+ let element = array[l];
160
+ if (typeof element === 'string') {
161
+ const lcElement = transformCaseFunc(element);
162
+ if (lcElement !== element) {
163
+ // Config presets (e.g. tags.js, attrs.js) are immutable.
164
+ if (!isFrozen(array)) {
165
+ array[l] = lcElement;
166
+ }
167
+ element = lcElement;
168
+ }
169
+ }
170
+ set[element] = true;
171
+ }
172
+ return set;
173
+ }
174
+ /**
175
+ * Clean up an array to harden against CSPP
176
+ *
177
+ * @param array - The array to be cleaned.
178
+ * @returns The cleaned version of the array
179
+ */
180
+ function cleanArray(array) {
181
+ for (let index = 0; index < array.length; index++) {
182
+ const isPropertyExist = objectHasOwnProperty(array, index);
183
+ if (!isPropertyExist) {
184
+ array[index] = null;
185
+ }
186
+ }
187
+ return array;
188
+ }
189
+ /**
190
+ * Shallow clone an object
191
+ *
192
+ * @param object - The object to be cloned.
193
+ * @returns A new object that copies the original.
194
+ */
195
+ function clone(object) {
196
+ const newObject = create(null);
197
+ for (const [property, value] of entries(object)) {
198
+ const isPropertyExist = objectHasOwnProperty(object, property);
199
+ if (isPropertyExist) {
200
+ if (Array.isArray(value)) {
201
+ newObject[property] = cleanArray(value);
202
+ } else if (value && typeof value === 'object' && value.constructor === Object) {
203
+ newObject[property] = clone(value);
204
+ } else {
205
+ newObject[property] = value;
206
+ }
207
+ }
208
+ }
209
+ return newObject;
210
+ }
211
+ /**
212
+ * This method automatically checks if the prop is function or getter and behaves accordingly.
213
+ *
214
+ * @param object - The object to look up the getter function in its prototype chain.
215
+ * @param prop - The property name for which to find the getter function.
216
+ * @returns The getter function found in the prototype chain or a fallback function.
217
+ */
218
+ function lookupGetter(object, prop) {
219
+ while (object !== null) {
220
+ const desc = getOwnPropertyDescriptor(object, prop);
221
+ if (desc) {
222
+ if (desc.get) {
223
+ return unapply(desc.get);
224
+ }
225
+ if (typeof desc.value === 'function') {
226
+ return unapply(desc.value);
227
+ }
228
+ }
229
+ object = getPrototypeOf(object);
230
+ }
231
+ function fallbackValue() {
232
+ return null;
233
+ }
234
+ return fallbackValue;
235
+ }
236
+
237
+ 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']);
238
+ 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']);
239
+ 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']);
240
+ // List of SVG elements that are disallowed by default.
241
+ // We still need to know them so that we can do namespace
242
+ // checks properly in case one wants to add them to
243
+ // allow-list.
244
+ 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']);
245
+ 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']);
246
+ // Similarly to SVG, we want to know all MathML elements,
247
+ // even those that we disallow by default.
248
+ const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
249
+ const purify_es_text = freeze(['#text']);
250
+
251
+ 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', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']);
252
+ const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
253
+ 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']);
254
+ const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
255
+
256
+ // eslint-disable-next-line unicorn/better-regex
257
+ const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
258
+ const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
259
+ const TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm); // eslint-disable-line unicorn/better-regex
260
+ const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/); // eslint-disable-line no-useless-escape
261
+ const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
262
+ const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
263
+ );
264
+ const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
265
+ const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
266
+ );
267
+ const DOCTYPE_NAME = seal(/^html$/i);
268
+ const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
269
+
270
+ var EXPRESSIONS = /*#__PURE__*/Object.freeze({
271
+ __proto__: null,
272
+ ARIA_ATTR: ARIA_ATTR,
273
+ ATTR_WHITESPACE: ATTR_WHITESPACE,
274
+ CUSTOM_ELEMENT: CUSTOM_ELEMENT,
275
+ DATA_ATTR: DATA_ATTR,
276
+ DOCTYPE_NAME: DOCTYPE_NAME,
277
+ ERB_EXPR: ERB_EXPR,
278
+ IS_ALLOWED_URI: IS_ALLOWED_URI,
279
+ IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,
280
+ MUSTACHE_EXPR: MUSTACHE_EXPR,
281
+ TMPLIT_EXPR: TMPLIT_EXPR
282
+ });
283
+
284
+ /* eslint-disable @typescript-eslint/indent */
285
+ // https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
286
+ const NODE_TYPE = {
287
+ element: 1,
288
+ attribute: 2,
289
+ text: 3,
290
+ cdataSection: 4,
291
+ entityReference: 5,
292
+ // Deprecated
293
+ entityNode: 6,
294
+ // Deprecated
295
+ progressingInstruction: 7,
296
+ comment: 8,
297
+ document: 9,
298
+ documentType: 10,
299
+ documentFragment: 11,
300
+ notation: 12 // Deprecated
301
+ };
302
+ const getGlobal = function getGlobal() {
303
+ return typeof window === 'undefined' ? null : window;
304
+ };
305
+ /**
306
+ * Creates a no-op policy for internal use only.
307
+ * Don't export this function outside this module!
308
+ * @param trustedTypes The policy factory.
309
+ * @param purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
310
+ * @return The policy created (or null, if Trusted Types
311
+ * are not supported or creating the policy failed).
312
+ */
313
+ const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
314
+ if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
315
+ return null;
316
+ }
317
+ // Allow the callers to control the unique policy name
318
+ // by adding a data-tt-policy-suffix to the script element with the DOMPurify.
319
+ // Policy creation with duplicate names throws in Trusted Types.
320
+ let suffix = null;
321
+ const ATTR_NAME = 'data-tt-policy-suffix';
322
+ if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
323
+ suffix = purifyHostElement.getAttribute(ATTR_NAME);
324
+ }
325
+ const policyName = 'dompurify' + (suffix ? '#' + suffix : '');
326
+ try {
327
+ return trustedTypes.createPolicy(policyName, {
328
+ createHTML(html) {
329
+ return html;
330
+ },
331
+ createScriptURL(scriptUrl) {
332
+ return scriptUrl;
333
+ }
334
+ });
335
+ } catch (_) {
336
+ // Policy creation failed (most likely another DOMPurify script has
337
+ // already run). Skip creating the policy, as this will only cause errors
338
+ // if TT are enforced.
339
+ console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
340
+ return null;
341
+ }
342
+ };
343
+ const _createHooksMap = function _createHooksMap() {
344
+ return {
345
+ afterSanitizeAttributes: [],
346
+ afterSanitizeElements: [],
347
+ afterSanitizeShadowDOM: [],
348
+ beforeSanitizeAttributes: [],
349
+ beforeSanitizeElements: [],
350
+ beforeSanitizeShadowDOM: [],
351
+ uponSanitizeAttribute: [],
352
+ uponSanitizeElement: [],
353
+ uponSanitizeShadowNode: []
354
+ };
355
+ };
356
+ function createDOMPurify() {
357
+ let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
358
+ const DOMPurify = root => createDOMPurify(root);
359
+ DOMPurify.version = '3.2.6';
360
+ DOMPurify.removed = [];
361
+ if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
362
+ // Not running in a browser, provide a factory function
363
+ // so that you can pass your own Window
364
+ DOMPurify.isSupported = false;
365
+ return DOMPurify;
366
+ }
367
+ let {
368
+ document
369
+ } = window;
370
+ const originalDocument = document;
371
+ const currentScript = originalDocument.currentScript;
372
+ const {
373
+ DocumentFragment,
374
+ HTMLTemplateElement,
375
+ Node,
376
+ Element,
377
+ NodeFilter,
378
+ NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,
379
+ HTMLFormElement,
380
+ DOMParser,
381
+ trustedTypes
382
+ } = window;
383
+ const ElementPrototype = Element.prototype;
384
+ const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
385
+ const remove = lookupGetter(ElementPrototype, 'remove');
386
+ const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
387
+ const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
388
+ const getParentNode = lookupGetter(ElementPrototype, 'parentNode');
389
+ // As per issue #47, the web-components registry is inherited by a
390
+ // new document created via createHTMLDocument. As per the spec
391
+ // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
392
+ // a new empty registry is used when creating a template contents owner
393
+ // document, so we use that as our parent document to ensure nothing
394
+ // is inherited.
395
+ if (typeof HTMLTemplateElement === 'function') {
396
+ const template = document.createElement('template');
397
+ if (template.content && template.content.ownerDocument) {
398
+ document = template.content.ownerDocument;
399
+ }
400
+ }
401
+ let trustedTypesPolicy;
402
+ let emptyHTML = '';
403
+ const {
404
+ implementation,
405
+ createNodeIterator,
406
+ createDocumentFragment,
407
+ getElementsByTagName
408
+ } = document;
409
+ const {
410
+ importNode
411
+ } = originalDocument;
412
+ let hooks = _createHooksMap();
413
+ /**
414
+ * Expose whether this browser supports running the full DOMPurify.
415
+ */
416
+ DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;
417
+ const {
418
+ MUSTACHE_EXPR,
419
+ ERB_EXPR,
420
+ TMPLIT_EXPR,
421
+ DATA_ATTR,
422
+ ARIA_ATTR,
423
+ IS_SCRIPT_OR_DATA,
424
+ ATTR_WHITESPACE,
425
+ CUSTOM_ELEMENT
426
+ } = EXPRESSIONS;
427
+ let {
428
+ IS_ALLOWED_URI: IS_ALLOWED_URI$1
429
+ } = EXPRESSIONS;
430
+ /**
431
+ * We consider the elements and attributes below to be safe. Ideally
432
+ * don't add any new ones but feel free to remove unwanted ones.
433
+ */
434
+ /* allowed element names */
435
+ let ALLOWED_TAGS = null;
436
+ const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...purify_es_text]);
437
+ /* Allowed attribute names */
438
+ let ALLOWED_ATTR = null;
439
+ const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
440
+ /*
441
+ * Configure how DOMPurify should handle custom elements and their attributes as well as customized built-in elements.
442
+ * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
443
+ * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
444
+ * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
445
+ */
446
+ let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
447
+ tagNameCheck: {
448
+ writable: true,
449
+ configurable: false,
450
+ enumerable: true,
451
+ value: null
452
+ },
453
+ attributeNameCheck: {
454
+ writable: true,
455
+ configurable: false,
456
+ enumerable: true,
457
+ value: null
458
+ },
459
+ allowCustomizedBuiltInElements: {
460
+ writable: true,
461
+ configurable: false,
462
+ enumerable: true,
463
+ value: false
464
+ }
465
+ }));
466
+ /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
467
+ let FORBID_TAGS = null;
468
+ /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
469
+ let FORBID_ATTR = null;
470
+ /* Decide if ARIA attributes are okay */
471
+ let ALLOW_ARIA_ATTR = true;
472
+ /* Decide if custom data attributes are okay */
473
+ let ALLOW_DATA_ATTR = true;
474
+ /* Decide if unknown protocols are okay */
475
+ let ALLOW_UNKNOWN_PROTOCOLS = false;
476
+ /* Decide if self-closing tags in attributes are allowed.
477
+ * Usually removed due to a mXSS issue in jQuery 3.0 */
478
+ let ALLOW_SELF_CLOSE_IN_ATTR = true;
479
+ /* Output should be safe for common template engines.
480
+ * This means, DOMPurify removes data attributes, mustaches and ERB
481
+ */
482
+ let SAFE_FOR_TEMPLATES = false;
483
+ /* Output should be safe even for XML used within HTML and alike.
484
+ * This means, DOMPurify removes comments when containing risky content.
485
+ */
486
+ let SAFE_FOR_XML = true;
487
+ /* Decide if document with <html>... should be returned */
488
+ let WHOLE_DOCUMENT = false;
489
+ /* Track whether config is already set on this instance of DOMPurify. */
490
+ let SET_CONFIG = false;
491
+ /* Decide if all elements (e.g. style, script) must be children of
492
+ * document.body. By default, browsers might move them to document.head */
493
+ let FORCE_BODY = false;
494
+ /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
495
+ * string (or a TrustedHTML object if Trusted Types are supported).
496
+ * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
497
+ */
498
+ let RETURN_DOM = false;
499
+ /* Decide if a DOM `DocumentFragment` should be returned, instead of a html
500
+ * string (or a TrustedHTML object if Trusted Types are supported) */
501
+ let RETURN_DOM_FRAGMENT = false;
502
+ /* Try to return a Trusted Type object instead of a string, return a string in
503
+ * case Trusted Types are not supported */
504
+ let RETURN_TRUSTED_TYPE = false;
505
+ /* Output should be free from DOM clobbering attacks?
506
+ * This sanitizes markups named with colliding, clobberable built-in DOM APIs.
507
+ */
508
+ let SANITIZE_DOM = true;
509
+ /* Achieve full DOM Clobbering protection by isolating the namespace of named
510
+ * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.
511
+ *
512
+ * HTML/DOM spec rules that enable DOM Clobbering:
513
+ * - Named Access on Window (§7.3.3)
514
+ * - DOM Tree Accessors (§3.1.5)
515
+ * - Form Element Parent-Child Relations (§4.10.3)
516
+ * - Iframe srcdoc / Nested WindowProxies (§4.8.5)
517
+ * - HTMLCollection (§4.2.10.2)
518
+ *
519
+ * Namespace isolation is implemented by prefixing `id` and `name` attributes
520
+ * with a constant string, i.e., `user-content-`
521
+ */
522
+ let SANITIZE_NAMED_PROPS = false;
523
+ const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
524
+ /* Keep element content when removing element? */
525
+ let KEEP_CONTENT = true;
526
+ /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
527
+ * of importing it into a new Document and returning a sanitized copy */
528
+ let IN_PLACE = false;
529
+ /* Allow usage of profiles like html, svg and mathMl */
530
+ let USE_PROFILES = {};
531
+ /* Tags to ignore content of when KEEP_CONTENT is true */
532
+ let FORBID_CONTENTS = null;
533
+ 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']);
534
+ /* Tags that are safe for data: URIs */
535
+ let DATA_URI_TAGS = null;
536
+ const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
537
+ /* Attributes safe for values like "javascript:" */
538
+ let URI_SAFE_ATTRIBUTES = null;
539
+ const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
540
+ const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
541
+ const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
542
+ const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
543
+ /* Document namespace */
544
+ let NAMESPACE = HTML_NAMESPACE;
545
+ let IS_EMPTY_INPUT = false;
546
+ /* Allowed XHTML+XML namespaces */
547
+ let ALLOWED_NAMESPACES = null;
548
+ const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
549
+ let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
550
+ let HTML_INTEGRATION_POINTS = addToSet({}, ['annotation-xml']);
551
+ // Certain elements are allowed in both SVG and HTML
552
+ // namespace. We need to specify them explicitly
553
+ // so that they don't get erroneously deleted from
554
+ // HTML namespace.
555
+ const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
556
+ /* Parsing of strict XHTML documents */
557
+ let PARSER_MEDIA_TYPE = null;
558
+ const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
559
+ const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
560
+ let transformCaseFunc = null;
561
+ /* Keep a reference to config to pass to hooks */
562
+ let CONFIG = null;
563
+ /* Ideally, do not touch anything below this line */
564
+ /* ______________________________________________ */
565
+ const formElement = document.createElement('form');
566
+ const isRegexOrFunction = function isRegexOrFunction(testValue) {
567
+ return testValue instanceof RegExp || testValue instanceof Function;
568
+ };
569
+ /**
570
+ * _parseConfig
571
+ *
572
+ * @param cfg optional config literal
573
+ */
574
+ // eslint-disable-next-line complexity
575
+ const _parseConfig = function _parseConfig() {
576
+ let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
577
+ if (CONFIG && CONFIG === cfg) {
578
+ return;
579
+ }
580
+ /* Shield configuration object from tampering */
581
+ if (!cfg || typeof cfg !== 'object') {
582
+ cfg = {};
583
+ }
584
+ /* Shield configuration object from prototype pollution */
585
+ cfg = clone(cfg);
586
+ PARSER_MEDIA_TYPE =
587
+ // eslint-disable-next-line unicorn/prefer-includes
588
+ SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
589
+ // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
590
+ transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
591
+ /* Set configuration parameters */
592
+ ALLOWED_TAGS = objectHasOwnProperty(cfg, 'ALLOWED_TAGS') ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
593
+ ALLOWED_ATTR = objectHasOwnProperty(cfg, 'ALLOWED_ATTR') ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
594
+ ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, 'ALLOWED_NAMESPACES') ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
595
+ URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
596
+ DATA_URI_TAGS = objectHasOwnProperty(cfg, 'ADD_DATA_URI_TAGS') ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
597
+ FORBID_CONTENTS = objectHasOwnProperty(cfg, 'FORBID_CONTENTS') ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
598
+ FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone({});
599
+ FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone({});
600
+ USE_PROFILES = objectHasOwnProperty(cfg, 'USE_PROFILES') ? cfg.USE_PROFILES : false;
601
+ ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
602
+ ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
603
+ ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
604
+ ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true
605
+ SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
606
+ SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false; // Default true
607
+ WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
608
+ RETURN_DOM = cfg.RETURN_DOM || false; // Default false
609
+ RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
610
+ RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false
611
+ FORCE_BODY = cfg.FORCE_BODY || false; // Default false
612
+ SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
613
+ SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false
614
+ KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
615
+ IN_PLACE = cfg.IN_PLACE || false; // Default false
616
+ IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
617
+ NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
618
+ MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS || MATHML_TEXT_INTEGRATION_POINTS;
619
+ HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS || HTML_INTEGRATION_POINTS;
620
+ CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
621
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
622
+ CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
623
+ }
624
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
625
+ CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
626
+ }
627
+ if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {
628
+ CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
629
+ }
630
+ if (SAFE_FOR_TEMPLATES) {
631
+ ALLOW_DATA_ATTR = false;
632
+ }
633
+ if (RETURN_DOM_FRAGMENT) {
634
+ RETURN_DOM = true;
635
+ }
636
+ /* Parse profile info */
637
+ if (USE_PROFILES) {
638
+ ALLOWED_TAGS = addToSet({}, purify_es_text);
639
+ ALLOWED_ATTR = [];
640
+ if (USE_PROFILES.html === true) {
641
+ addToSet(ALLOWED_TAGS, html$1);
642
+ addToSet(ALLOWED_ATTR, html);
643
+ }
644
+ if (USE_PROFILES.svg === true) {
645
+ addToSet(ALLOWED_TAGS, svg$1);
646
+ addToSet(ALLOWED_ATTR, svg);
647
+ addToSet(ALLOWED_ATTR, xml);
648
+ }
649
+ if (USE_PROFILES.svgFilters === true) {
650
+ addToSet(ALLOWED_TAGS, svgFilters);
651
+ addToSet(ALLOWED_ATTR, svg);
652
+ addToSet(ALLOWED_ATTR, xml);
653
+ }
654
+ if (USE_PROFILES.mathMl === true) {
655
+ addToSet(ALLOWED_TAGS, mathMl$1);
656
+ addToSet(ALLOWED_ATTR, mathMl);
657
+ addToSet(ALLOWED_ATTR, xml);
658
+ }
659
+ }
660
+ /* Merge configuration parameters */
661
+ if (cfg.ADD_TAGS) {
662
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
663
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
664
+ }
665
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
666
+ }
667
+ if (cfg.ADD_ATTR) {
668
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
669
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
670
+ }
671
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
672
+ }
673
+ if (cfg.ADD_URI_SAFE_ATTR) {
674
+ addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
675
+ }
676
+ if (cfg.FORBID_CONTENTS) {
677
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
678
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
679
+ }
680
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
681
+ }
682
+ /* Add #text in case KEEP_CONTENT is set to true */
683
+ if (KEEP_CONTENT) {
684
+ ALLOWED_TAGS['#text'] = true;
685
+ }
686
+ /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
687
+ if (WHOLE_DOCUMENT) {
688
+ addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
689
+ }
690
+ /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
691
+ if (ALLOWED_TAGS.table) {
692
+ addToSet(ALLOWED_TAGS, ['tbody']);
693
+ delete FORBID_TAGS.tbody;
694
+ }
695
+ if (cfg.TRUSTED_TYPES_POLICY) {
696
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {
697
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
698
+ }
699
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {
700
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
701
+ }
702
+ // Overwrite existing TrustedTypes policy.
703
+ trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
704
+ // Sign local variables required by `sanitize`.
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
+ }
711
+ // If creating the internal policy succeeded sign internal variables.
712
+ if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {
713
+ emptyHTML = trustedTypesPolicy.createHTML('');
714
+ }
715
+ }
716
+ // Prevent further manipulation of configuration.
717
+ // Not available in IE8, Safari 5, etc.
718
+ if (freeze) {
719
+ freeze(cfg);
720
+ }
721
+ CONFIG = cfg;
722
+ };
723
+ /* Keep track of all possible SVG and MathML tags
724
+ * so that we can perform the namespace checks
725
+ * correctly. */
726
+ const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
727
+ const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
728
+ /**
729
+ * @param element a DOM element whose namespace is being checked
730
+ * @returns Return false if the element has a
731
+ * namespace that a spec-compliant parser would never
732
+ * return. Return true otherwise.
733
+ */
734
+ const _checkValidNamespace = function _checkValidNamespace(element) {
735
+ let parent = getParentNode(element);
736
+ // In JSDOM, if we're inside shadow DOM, then parentNode
737
+ // can be null. We just simulate parent in this case.
738
+ if (!parent || !parent.tagName) {
739
+ parent = {
740
+ namespaceURI: NAMESPACE,
741
+ tagName: 'template'
742
+ };
743
+ }
744
+ const tagName = stringToLowerCase(element.tagName);
745
+ const parentTagName = stringToLowerCase(parent.tagName);
746
+ if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
747
+ return false;
748
+ }
749
+ if (element.namespaceURI === SVG_NAMESPACE) {
750
+ // The only way to switch from HTML namespace to SVG
751
+ // is via <svg>. If it happens via any other tag, then
752
+ // it should be killed.
753
+ if (parent.namespaceURI === HTML_NAMESPACE) {
754
+ return tagName === 'svg';
755
+ }
756
+ // The only way to switch from MathML to SVG is via`
757
+ // svg if parent is either <annotation-xml> or MathML
758
+ // text integration points.
759
+ if (parent.namespaceURI === MATHML_NAMESPACE) {
760
+ return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
761
+ }
762
+ // We only allow elements that are defined in SVG
763
+ // spec. All others are disallowed in SVG namespace.
764
+ return Boolean(ALL_SVG_TAGS[tagName]);
765
+ }
766
+ if (element.namespaceURI === MATHML_NAMESPACE) {
767
+ // The only way to switch from HTML namespace to MathML
768
+ // is via <math>. If it happens via any other tag, then
769
+ // it should be killed.
770
+ if (parent.namespaceURI === HTML_NAMESPACE) {
771
+ return tagName === 'math';
772
+ }
773
+ // The only way to switch from SVG to MathML is via
774
+ // <math> and HTML integration points
775
+ if (parent.namespaceURI === SVG_NAMESPACE) {
776
+ return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
777
+ }
778
+ // We only allow elements that are defined in MathML
779
+ // spec. All others are disallowed in MathML namespace.
780
+ return Boolean(ALL_MATHML_TAGS[tagName]);
781
+ }
782
+ if (element.namespaceURI === HTML_NAMESPACE) {
783
+ // The only way to switch from SVG to HTML is via
784
+ // HTML integration points, and from MathML to HTML
785
+ // is via MathML text integration points
786
+ if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
787
+ return false;
788
+ }
789
+ if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
790
+ return false;
791
+ }
792
+ // We disallow tags that are specific for MathML
793
+ // or SVG and should never appear in HTML namespace
794
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
795
+ }
796
+ // For XHTML and XML documents that support custom namespaces
797
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {
798
+ return true;
799
+ }
800
+ // The code should never reach this place (this means
801
+ // that the element somehow got namespace that is not
802
+ // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).
803
+ // Return false just in case.
804
+ return false;
805
+ };
806
+ /**
807
+ * _forceRemove
808
+ *
809
+ * @param node a DOM node
810
+ */
811
+ const _forceRemove = function _forceRemove(node) {
812
+ arrayPush(DOMPurify.removed, {
813
+ element: node
814
+ });
815
+ try {
816
+ // eslint-disable-next-line unicorn/prefer-dom-node-remove
817
+ getParentNode(node).removeChild(node);
818
+ } catch (_) {
819
+ remove(node);
820
+ }
821
+ };
822
+ /**
823
+ * _removeAttribute
824
+ *
825
+ * @param name an Attribute name
826
+ * @param element a DOM node
827
+ */
828
+ const _removeAttribute = function _removeAttribute(name, element) {
829
+ try {
830
+ arrayPush(DOMPurify.removed, {
831
+ attribute: element.getAttributeNode(name),
832
+ from: element
833
+ });
834
+ } catch (_) {
835
+ arrayPush(DOMPurify.removed, {
836
+ attribute: null,
837
+ from: element
838
+ });
839
+ }
840
+ element.removeAttribute(name);
841
+ // We void attribute values for unremovable "is" attributes
842
+ if (name === 'is') {
843
+ if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
844
+ try {
845
+ _forceRemove(element);
846
+ } catch (_) {}
847
+ } else {
848
+ try {
849
+ element.setAttribute(name, '');
850
+ } catch (_) {}
851
+ }
852
+ }
853
+ };
854
+ /**
855
+ * _initDocument
856
+ *
857
+ * @param dirty - a string of dirty markup
858
+ * @return a DOM, filled with the dirty markup
859
+ */
860
+ const _initDocument = function _initDocument(dirty) {
861
+ /* Create a HTML document */
862
+ let doc = null;
863
+ let leadingWhitespace = null;
864
+ if (FORCE_BODY) {
865
+ dirty = '<remove></remove>' + dirty;
866
+ } else {
867
+ /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
868
+ const matches = stringMatch(dirty, /^[\r\n\t ]+/);
869
+ leadingWhitespace = matches && matches[0];
870
+ }
871
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {
872
+ // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
873
+ dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
874
+ }
875
+ const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
876
+ /*
877
+ * Use the DOMParser API by default, fallback later if needs be
878
+ * DOMParser not work for svg when has multiple root element.
879
+ */
880
+ if (NAMESPACE === HTML_NAMESPACE) {
881
+ try {
882
+ doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
883
+ } catch (_) {}
884
+ }
885
+ /* Use createHTMLDocument in case DOMParser is not available */
886
+ if (!doc || !doc.documentElement) {
887
+ doc = implementation.createDocument(NAMESPACE, 'template', null);
888
+ try {
889
+ doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
890
+ } catch (_) {
891
+ // Syntax error if dirtyPayload is invalid xml
892
+ }
893
+ }
894
+ const body = doc.body || doc.documentElement;
895
+ if (dirty && leadingWhitespace) {
896
+ body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
897
+ }
898
+ /* Work on whole document or just its body */
899
+ if (NAMESPACE === HTML_NAMESPACE) {
900
+ return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
901
+ }
902
+ return WHOLE_DOCUMENT ? doc.documentElement : body;
903
+ };
904
+ /**
905
+ * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
906
+ *
907
+ * @param root The root element or node to start traversing on.
908
+ * @return The created NodeIterator
909
+ */
910
+ const _createNodeIterator = function _createNodeIterator(root) {
911
+ return createNodeIterator.call(root.ownerDocument || root, root,
912
+ // eslint-disable-next-line no-bitwise
913
+ NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);
914
+ };
915
+ /**
916
+ * _isClobbered
917
+ *
918
+ * @param element element to check for clobbering attacks
919
+ * @return true if clobbered, false if safe
920
+ */
921
+ const _isClobbered = function _isClobbered(element) {
922
+ return element instanceof HTMLFormElement && (typeof element.nodeName !== 'string' || typeof element.textContent !== 'string' || typeof element.removeChild !== 'function' || !(element.attributes instanceof NamedNodeMap) || typeof element.removeAttribute !== 'function' || typeof element.setAttribute !== 'function' || typeof element.namespaceURI !== 'string' || typeof element.insertBefore !== 'function' || typeof element.hasChildNodes !== 'function');
923
+ };
924
+ /**
925
+ * Checks whether the given object is a DOM node.
926
+ *
927
+ * @param value object to check whether it's a DOM node
928
+ * @return true is object is a DOM node
929
+ */
930
+ const _isNode = function _isNode(value) {
931
+ return typeof Node === 'function' && value instanceof Node;
932
+ };
933
+ function _executeHooks(hooks, currentNode, data) {
934
+ arrayForEach(hooks, hook => {
935
+ hook.call(DOMPurify, currentNode, data, CONFIG);
936
+ });
937
+ }
938
+ /**
939
+ * _sanitizeElements
940
+ *
941
+ * @protect nodeName
942
+ * @protect textContent
943
+ * @protect removeChild
944
+ * @param currentNode to check for permission to exist
945
+ * @return true if node was killed, false if left alive
946
+ */
947
+ const _sanitizeElements = function _sanitizeElements(currentNode) {
948
+ let content = null;
949
+ /* Execute a hook if present */
950
+ _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
951
+ /* Check if element is clobbered or can clobber */
952
+ if (_isClobbered(currentNode)) {
953
+ _forceRemove(currentNode);
954
+ return true;
955
+ }
956
+ /* Now let's check the element's type and name */
957
+ const tagName = transformCaseFunc(currentNode.nodeName);
958
+ /* Execute a hook if present */
959
+ _executeHooks(hooks.uponSanitizeElement, currentNode, {
960
+ tagName,
961
+ allowedTags: ALLOWED_TAGS
962
+ });
963
+ /* Detect mXSS attempts abusing namespace confusion */
964
+ if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
965
+ _forceRemove(currentNode);
966
+ return true;
967
+ }
968
+ /* Remove any occurrence of processing instructions */
969
+ if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
970
+ _forceRemove(currentNode);
971
+ return true;
972
+ }
973
+ /* Remove any kind of possibly harmful comments */
974
+ if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
975
+ _forceRemove(currentNode);
976
+ return true;
977
+ }
978
+ /* Remove element if anything forbids its presence */
979
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
980
+ /* Check if we have a custom element to handle */
981
+ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
982
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
983
+ return false;
984
+ }
985
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
986
+ return false;
987
+ }
988
+ }
989
+ /* Keep content except for bad-listed elements */
990
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
991
+ const parentNode = getParentNode(currentNode) || currentNode.parentNode;
992
+ const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
993
+ if (childNodes && parentNode) {
994
+ const childCount = childNodes.length;
995
+ for (let i = childCount - 1; i >= 0; --i) {
996
+ const childClone = cloneNode(childNodes[i], true);
997
+ childClone.__removalCount = (currentNode.__removalCount || 0) + 1;
998
+ parentNode.insertBefore(childClone, getNextSibling(currentNode));
999
+ }
1000
+ }
1001
+ }
1002
+ _forceRemove(currentNode);
1003
+ return true;
1004
+ }
1005
+ /* Check whether element has a valid namespace */
1006
+ if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
1007
+ _forceRemove(currentNode);
1008
+ return true;
1009
+ }
1010
+ /* Make sure that older browsers don't get fallback-tag mXSS */
1011
+ if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
1012
+ _forceRemove(currentNode);
1013
+ return true;
1014
+ }
1015
+ /* Sanitize element content to be template-safe */
1016
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
1017
+ /* Get the element's text content */
1018
+ content = currentNode.textContent;
1019
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
1020
+ content = stringReplace(content, expr, ' ');
1021
+ });
1022
+ if (currentNode.textContent !== content) {
1023
+ arrayPush(DOMPurify.removed, {
1024
+ element: currentNode.cloneNode()
1025
+ });
1026
+ currentNode.textContent = content;
1027
+ }
1028
+ }
1029
+ /* Execute a hook if present */
1030
+ _executeHooks(hooks.afterSanitizeElements, currentNode, null);
1031
+ return false;
1032
+ };
1033
+ /**
1034
+ * _isValidAttribute
1035
+ *
1036
+ * @param lcTag Lowercase tag name of containing element.
1037
+ * @param lcName Lowercase attribute name.
1038
+ * @param value Attribute value.
1039
+ * @return Returns true if `value` is valid, otherwise false.
1040
+ */
1041
+ // eslint-disable-next-line complexity
1042
+ const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
1043
+ /* Make sure attribute cannot clobber */
1044
+ if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
1045
+ return false;
1046
+ }
1047
+ /* Allow valid data-* attributes: At least one character after "-"
1048
+ (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
1049
+ XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
1050
+ We don't need to check the value; it's always URI safe. */
1051
+ 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]) {
1052
+ if (
1053
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
1054
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1055
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
1056
+ _isBasicCustomElement(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)) ||
1057
+ // Alternative, second condition checks if it's an `is`-attribute, AND
1058
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1059
+ 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 {
1060
+ return false;
1061
+ }
1062
+ /* Check value is safe. First, is attr inert? If so, is safe */
1063
+ } 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) {
1064
+ return false;
1065
+ } else ;
1066
+ return true;
1067
+ };
1068
+ /**
1069
+ * _isBasicCustomElement
1070
+ * checks if at least one dash is included in tagName, and it's not the first char
1071
+ * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
1072
+ *
1073
+ * @param tagName name of the tag of the node to sanitize
1074
+ * @returns Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
1075
+ */
1076
+ const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
1077
+ return tagName !== 'annotation-xml' && stringMatch(tagName, CUSTOM_ELEMENT);
1078
+ };
1079
+ /**
1080
+ * _sanitizeAttributes
1081
+ *
1082
+ * @protect attributes
1083
+ * @protect nodeName
1084
+ * @protect removeAttribute
1085
+ * @protect setAttribute
1086
+ *
1087
+ * @param currentNode to sanitize
1088
+ */
1089
+ const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
1090
+ /* Execute a hook if present */
1091
+ _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
1092
+ const {
1093
+ attributes
1094
+ } = currentNode;
1095
+ /* Check if we have attributes; if not we might have a text node */
1096
+ if (!attributes || _isClobbered(currentNode)) {
1097
+ return;
1098
+ }
1099
+ const hookEvent = {
1100
+ attrName: '',
1101
+ attrValue: '',
1102
+ keepAttr: true,
1103
+ allowedAttributes: ALLOWED_ATTR,
1104
+ forceKeepAttr: undefined
1105
+ };
1106
+ let l = attributes.length;
1107
+ /* Go backwards over all attributes; safely remove bad ones */
1108
+ while (l--) {
1109
+ const attr = attributes[l];
1110
+ const {
1111
+ name,
1112
+ namespaceURI,
1113
+ value: attrValue
1114
+ } = attr;
1115
+ const lcName = transformCaseFunc(name);
1116
+ const initValue = attrValue;
1117
+ let value = name === 'value' ? initValue : stringTrim(initValue);
1118
+ /* Execute a hook if present */
1119
+ hookEvent.attrName = lcName;
1120
+ hookEvent.attrValue = value;
1121
+ hookEvent.keepAttr = true;
1122
+ hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
1123
+ _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
1124
+ value = hookEvent.attrValue;
1125
+ /* Full DOM Clobbering protection via namespace isolation,
1126
+ * Prefix id and name attributes with `user-content-`
1127
+ */
1128
+ if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {
1129
+ // Remove the attribute with this value
1130
+ _removeAttribute(name, currentNode);
1131
+ // Prefix the value and later re-create the attribute with the sanitized value
1132
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
1133
+ }
1134
+ /* Work around a security issue with comments inside attributes */
1135
+ if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
1136
+ _removeAttribute(name, currentNode);
1137
+ continue;
1138
+ }
1139
+ /* Did the hooks approve of the attribute? */
1140
+ if (hookEvent.forceKeepAttr) {
1141
+ continue;
1142
+ }
1143
+ /* Did the hooks approve of the attribute? */
1144
+ if (!hookEvent.keepAttr) {
1145
+ _removeAttribute(name, currentNode);
1146
+ continue;
1147
+ }
1148
+ /* Work around a security issue in jQuery 3.0 */
1149
+ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
1150
+ _removeAttribute(name, currentNode);
1151
+ continue;
1152
+ }
1153
+ /* Sanitize attribute content to be template-safe */
1154
+ if (SAFE_FOR_TEMPLATES) {
1155
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
1156
+ value = stringReplace(value, expr, ' ');
1157
+ });
1158
+ }
1159
+ /* Is `value` valid for this attribute? */
1160
+ const lcTag = transformCaseFunc(currentNode.nodeName);
1161
+ if (!_isValidAttribute(lcTag, lcName, value)) {
1162
+ _removeAttribute(name, currentNode);
1163
+ continue;
1164
+ }
1165
+ /* Handle attributes that require Trusted Types */
1166
+ if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {
1167
+ if (namespaceURI) ; else {
1168
+ switch (trustedTypes.getAttributeType(lcTag, lcName)) {
1169
+ case 'TrustedHTML':
1170
+ {
1171
+ value = trustedTypesPolicy.createHTML(value);
1172
+ break;
1173
+ }
1174
+ case 'TrustedScriptURL':
1175
+ {
1176
+ value = trustedTypesPolicy.createScriptURL(value);
1177
+ break;
1178
+ }
1179
+ }
1180
+ }
1181
+ }
1182
+ /* Handle invalid data-* attribute set by try-catching it */
1183
+ if (value !== initValue) {
1184
+ try {
1185
+ if (namespaceURI) {
1186
+ currentNode.setAttributeNS(namespaceURI, name, value);
1187
+ } else {
1188
+ /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
1189
+ currentNode.setAttribute(name, value);
1190
+ }
1191
+ if (_isClobbered(currentNode)) {
1192
+ _forceRemove(currentNode);
1193
+ } else {
1194
+ arrayPop(DOMPurify.removed);
1195
+ }
1196
+ } catch (_) {
1197
+ _removeAttribute(name, currentNode);
1198
+ }
1199
+ }
1200
+ }
1201
+ /* Execute a hook if present */
1202
+ _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
1203
+ };
1204
+ /**
1205
+ * _sanitizeShadowDOM
1206
+ *
1207
+ * @param fragment to iterate over recursively
1208
+ */
1209
+ const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
1210
+ let shadowNode = null;
1211
+ const shadowIterator = _createNodeIterator(fragment);
1212
+ /* Execute a hook if present */
1213
+ _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
1214
+ while (shadowNode = shadowIterator.nextNode()) {
1215
+ /* Execute a hook if present */
1216
+ _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
1217
+ /* Sanitize tags and elements */
1218
+ _sanitizeElements(shadowNode);
1219
+ /* Check attributes next */
1220
+ _sanitizeAttributes(shadowNode);
1221
+ /* Deep shadow DOM detected */
1222
+ if (shadowNode.content instanceof DocumentFragment) {
1223
+ _sanitizeShadowDOM(shadowNode.content);
1224
+ }
1225
+ }
1226
+ /* Execute a hook if present */
1227
+ _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
1228
+ };
1229
+ // eslint-disable-next-line complexity
1230
+ DOMPurify.sanitize = function (dirty) {
1231
+ let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1232
+ let body = null;
1233
+ let importedNode = null;
1234
+ let currentNode = null;
1235
+ let returnNode = null;
1236
+ /* Make sure we have a string to sanitize.
1237
+ DO NOT return early, as this will return the wrong type if
1238
+ the user has requested a DOM object rather than a string */
1239
+ IS_EMPTY_INPUT = !dirty;
1240
+ if (IS_EMPTY_INPUT) {
1241
+ dirty = '<!-->';
1242
+ }
1243
+ /* Stringify, in case dirty is an object */
1244
+ if (typeof dirty !== 'string' && !_isNode(dirty)) {
1245
+ if (typeof dirty.toString === 'function') {
1246
+ dirty = dirty.toString();
1247
+ if (typeof dirty !== 'string') {
1248
+ throw typeErrorCreate('dirty is not a string, aborting');
1249
+ }
1250
+ } else {
1251
+ throw typeErrorCreate('toString is not a function');
1252
+ }
1253
+ }
1254
+ /* Return dirty HTML if DOMPurify cannot run */
1255
+ if (!DOMPurify.isSupported) {
1256
+ return dirty;
1257
+ }
1258
+ /* Assign config vars */
1259
+ if (!SET_CONFIG) {
1260
+ _parseConfig(cfg);
1261
+ }
1262
+ /* Clean up removed elements */
1263
+ DOMPurify.removed = [];
1264
+ /* Check if dirty is correctly typed for IN_PLACE */
1265
+ if (typeof dirty === 'string') {
1266
+ IN_PLACE = false;
1267
+ }
1268
+ if (IN_PLACE) {
1269
+ /* Do some early pre-sanitization to avoid unsafe root nodes */
1270
+ if (dirty.nodeName) {
1271
+ const tagName = transformCaseFunc(dirty.nodeName);
1272
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
1273
+ throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
1274
+ }
1275
+ }
1276
+ } else if (dirty instanceof Node) {
1277
+ /* If dirty is a DOM element, append to an empty document to avoid
1278
+ elements being stripped by the parser */
1279
+ body = _initDocument('<!---->');
1280
+ importedNode = body.ownerDocument.importNode(dirty, true);
1281
+ if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === 'BODY') {
1282
+ /* Node is already a body, use as is */
1283
+ body = importedNode;
1284
+ } else if (importedNode.nodeName === 'HTML') {
1285
+ body = importedNode;
1286
+ } else {
1287
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
1288
+ body.appendChild(importedNode);
1289
+ }
1290
+ } else {
1291
+ /* Exit directly if we have nothing to do */
1292
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT &&
1293
+ // eslint-disable-next-line unicorn/prefer-includes
1294
+ dirty.indexOf('<') === -1) {
1295
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
1296
+ }
1297
+ /* Initialize the document to work on */
1298
+ body = _initDocument(dirty);
1299
+ /* Check we have a DOM node from the data */
1300
+ if (!body) {
1301
+ return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';
1302
+ }
1303
+ }
1304
+ /* Remove first element node (ours) if FORCE_BODY is set */
1305
+ if (body && FORCE_BODY) {
1306
+ _forceRemove(body.firstChild);
1307
+ }
1308
+ /* Get node iterator */
1309
+ const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
1310
+ /* Now start iterating over the created document */
1311
+ while (currentNode = nodeIterator.nextNode()) {
1312
+ /* Sanitize tags and elements */
1313
+ _sanitizeElements(currentNode);
1314
+ /* Check attributes next */
1315
+ _sanitizeAttributes(currentNode);
1316
+ /* Shadow DOM detected, sanitize it */
1317
+ if (currentNode.content instanceof DocumentFragment) {
1318
+ _sanitizeShadowDOM(currentNode.content);
1319
+ }
1320
+ }
1321
+ /* If we sanitized `dirty` in-place, return it. */
1322
+ if (IN_PLACE) {
1323
+ return dirty;
1324
+ }
1325
+ /* Return sanitized string or DOM */
1326
+ if (RETURN_DOM) {
1327
+ if (RETURN_DOM_FRAGMENT) {
1328
+ returnNode = createDocumentFragment.call(body.ownerDocument);
1329
+ while (body.firstChild) {
1330
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
1331
+ returnNode.appendChild(body.firstChild);
1332
+ }
1333
+ } else {
1334
+ returnNode = body;
1335
+ }
1336
+ if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
1337
+ /*
1338
+ AdoptNode() is not used because internal state is not reset
1339
+ (e.g. the past names map of a HTMLFormElement), this is safe
1340
+ in theory but we would rather not risk another attack vector.
1341
+ The state that is cloned by importNode() is explicitly defined
1342
+ by the specs.
1343
+ */
1344
+ returnNode = importNode.call(originalDocument, returnNode, true);
1345
+ }
1346
+ return returnNode;
1347
+ }
1348
+ let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
1349
+ /* Serialize doctype if allowed */
1350
+ if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
1351
+ serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML;
1352
+ }
1353
+ /* Sanitize final string template-safe */
1354
+ if (SAFE_FOR_TEMPLATES) {
1355
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
1356
+ serializedHTML = stringReplace(serializedHTML, expr, ' ');
1357
+ });
1358
+ }
1359
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
1360
+ };
1361
+ DOMPurify.setConfig = function () {
1362
+ let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1363
+ _parseConfig(cfg);
1364
+ SET_CONFIG = true;
1365
+ };
1366
+ DOMPurify.clearConfig = function () {
1367
+ CONFIG = null;
1368
+ SET_CONFIG = false;
1369
+ };
1370
+ DOMPurify.isValidAttribute = function (tag, attr, value) {
1371
+ /* Initialize shared config vars if necessary. */
1372
+ if (!CONFIG) {
1373
+ _parseConfig({});
1374
+ }
1375
+ const lcTag = transformCaseFunc(tag);
1376
+ const lcName = transformCaseFunc(attr);
1377
+ return _isValidAttribute(lcTag, lcName, value);
1378
+ };
1379
+ DOMPurify.addHook = function (entryPoint, hookFunction) {
1380
+ if (typeof hookFunction !== 'function') {
1381
+ return;
1382
+ }
1383
+ arrayPush(hooks[entryPoint], hookFunction);
1384
+ };
1385
+ DOMPurify.removeHook = function (entryPoint, hookFunction) {
1386
+ if (hookFunction !== undefined) {
1387
+ const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
1388
+ return index === -1 ? undefined : arraySplice(hooks[entryPoint], index, 1)[0];
1389
+ }
1390
+ return arrayPop(hooks[entryPoint]);
1391
+ };
1392
+ DOMPurify.removeHooks = function (entryPoint) {
1393
+ hooks[entryPoint] = [];
1394
+ };
1395
+ DOMPurify.removeAllHooks = function () {
1396
+ hooks = _createHooksMap();
1397
+ };
1398
+ return DOMPurify;
1399
+ }
1400
+ var purify = createDOMPurify();
1401
+
1402
+
1403
+ //# sourceMappingURL=purify.es.mjs.map
1404
+
57
1405
  ;// CONCATENATED MODULE: ../../packages/timeline/src/timeline.tsx
58
1406
 
59
1407
 
@@ -61,7 +1409,7 @@ const config_provider_namespaceObject = config_provider_x({ ["usePrefix"]: () =>
61
1409
  * Tencent is pleased to support the open source community by making
62
1410
  * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
63
1411
  *
64
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
1412
+ * Copyright (C) 2025 Tencent. All rights reserved.
65
1413
  *
66
1414
  * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
67
1415
  *
@@ -85,6 +1433,7 @@ const config_provider_namespaceObject = config_provider_x({ ["usePrefix"]: () =>
85
1433
 
86
1434
 
87
1435
 
1436
+
88
1437
  var timelineProps = {
89
1438
  list: shared_namespaceObject.PropTypes.arrayOf(shared_namespaceObject.PropTypes.shape({
90
1439
  tag: shared_namespaceObject.PropTypes.string,
@@ -168,7 +1517,7 @@ var timelineProps = {
168
1517
  }
169
1518
  return (0,external_vue_namespaceObject.createVNode)("div", {
170
1519
  "class": "".concat(_this.resolveClassName('timeline-content')),
171
- "innerHTML": item.content
1520
+ "innerHTML": typeof item.content === 'string' ? purify.sanitize(item.content) : item.content
172
1521
  }, null);
173
1522
  };
174
1523
  return (0,external_vue_namespaceObject.createVNode)("ul", {
@@ -192,7 +1541,7 @@ var timelineProps = {
192
1541
  return _this.handleTitleSelect(item);
193
1542
  }
194
1543
  }, [item.nodeType === 'vnode' ? item.tag : (0,external_vue_namespaceObject.createVNode)("span", {
195
- "innerHTML": item.tag
1544
+ "innerHTML": purify.sanitize(item.tag || '')
196
1545
  }, null)]), renderContent(item)])]);
197
1546
  })]);
198
1547
  }
@@ -202,7 +1551,7 @@ var timelineProps = {
202
1551
  * Tencent is pleased to support the open source community by making
203
1552
  * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
204
1553
  *
205
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
1554
+ * Copyright (C) 2025 Tencent. All rights reserved.
206
1555
  *
207
1556
  * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
208
1557
  *