@baloise/ds-core 20.0.0-next.4 → 20.0.0-next.6

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 (988) hide show
  1. package/LICENSE +9 -0
  2. package/components/all.d.ts +56 -0
  3. package/components/all.js +84 -0
  4. package/components/ds-accordion.js +1 -1
  5. package/components/ds-alert-container.js +1 -1
  6. package/components/ds-app.js +1 -1
  7. package/components/ds-badge.js +1 -1
  8. package/components/ds-button-group.js +1 -1
  9. package/components/ds-button.js +1 -1
  10. package/components/ds-card-actions.js +1 -1
  11. package/components/ds-card-content.js +1 -1
  12. package/components/ds-card-header.js +1 -1
  13. package/components/ds-card-subtitle.js +1 -1
  14. package/components/ds-card-title.js +1 -1
  15. package/components/ds-card.js +1 -1
  16. package/components/ds-carousel-item.d.ts +11 -0
  17. package/components/ds-carousel-item.js +4 -0
  18. package/components/ds-carousel.d.ts +11 -0
  19. package/components/ds-carousel.js +4 -0
  20. package/components/ds-checkbox-group.js +1 -1
  21. package/components/ds-checkbox.js +1 -1
  22. package/components/ds-close.js +1 -1
  23. package/components/ds-content.js +1 -1
  24. package/components/ds-data-item.d.ts +11 -0
  25. package/components/ds-data-item.js +4 -0
  26. package/components/ds-data-label.d.ts +11 -0
  27. package/components/ds-data-label.js +4 -0
  28. package/components/ds-data-value.d.ts +11 -0
  29. package/components/ds-data-value.js +4 -0
  30. package/components/ds-data.d.ts +11 -0
  31. package/components/ds-data.js +4 -0
  32. package/components/ds-date.d.ts +11 -0
  33. package/components/ds-date.js +4 -0
  34. package/components/ds-divider.js +1 -1
  35. package/components/ds-drawer.d.ts +11 -0
  36. package/components/ds-drawer.js +4 -0
  37. package/components/ds-file-upload.d.ts +11 -0
  38. package/components/ds-file-upload.js +4 -0
  39. package/components/ds-footer.d.ts +11 -0
  40. package/components/ds-footer.js +4 -0
  41. package/components/ds-heading.js +1 -1
  42. package/components/ds-hint-text.d.ts +11 -0
  43. package/components/ds-hint-text.js +4 -0
  44. package/components/ds-hint-title.d.ts +11 -0
  45. package/components/ds-hint-title.js +4 -0
  46. package/components/ds-hint.d.ts +11 -0
  47. package/components/ds-hint.js +4 -0
  48. package/components/ds-icon.js +1 -1
  49. package/components/ds-input.js +1 -1
  50. package/components/ds-item.js +1 -1
  51. package/components/ds-label.js +1 -1
  52. package/components/ds-list.js +1 -1
  53. package/components/ds-logo.js +1 -1
  54. package/components/ds-modal-body.d.ts +11 -0
  55. package/components/ds-modal-body.js +4 -0
  56. package/components/ds-modal-header.d.ts +11 -0
  57. package/components/ds-modal-header.js +4 -0
  58. package/components/ds-modal.d.ts +11 -0
  59. package/components/ds-modal.js +4 -0
  60. package/components/ds-navbar.d.ts +11 -0
  61. package/components/ds-navbar.js +4 -0
  62. package/components/ds-notification.js +1 -1
  63. package/components/ds-number-input.js +1 -1
  64. package/components/ds-pagination.js +1 -1
  65. package/components/ds-popup.d.ts +11 -0
  66. package/components/ds-popup.js +4 -0
  67. package/components/ds-progress-bar.js +1 -1
  68. package/components/ds-radio-group.js +1 -1
  69. package/components/ds-radio.js +1 -1
  70. package/components/ds-segment-item.js +1 -1
  71. package/components/ds-segment.js +1 -1
  72. package/components/ds-select-optgroup.d.ts +11 -0
  73. package/components/ds-select-optgroup.js +4 -0
  74. package/components/ds-select-option.d.ts +11 -0
  75. package/components/ds-select-option.js +4 -0
  76. package/components/ds-select.d.ts +11 -0
  77. package/components/ds-select.js +4 -0
  78. package/components/ds-shape.js +1 -1
  79. package/components/ds-snackbar.js +1 -1
  80. package/components/ds-spinner.js +1 -1
  81. package/components/ds-stack.js +1 -1
  82. package/components/ds-step-panel.d.ts +11 -0
  83. package/components/ds-step-panel.js +4 -0
  84. package/components/ds-step.d.ts +11 -0
  85. package/components/ds-step.js +4 -0
  86. package/components/ds-steps.d.ts +11 -0
  87. package/components/ds-steps.js +4 -0
  88. package/components/ds-tab-panel.d.ts +11 -0
  89. package/components/ds-tab-panel.js +4 -0
  90. package/components/ds-tab.d.ts +11 -0
  91. package/components/ds-tab.js +4 -0
  92. package/components/ds-tabs.d.ts +11 -0
  93. package/components/ds-tabs.js +4 -0
  94. package/components/ds-tag-group.js +1 -1
  95. package/components/ds-tag.js +1 -1
  96. package/components/ds-text.js +1 -1
  97. package/components/ds-textarea.js +1 -1
  98. package/components/ds-toast.js +1 -1
  99. package/components/ds-toggle.js +1 -1
  100. package/components/ds-tooltip.d.ts +11 -0
  101. package/components/ds-tooltip.js +4 -0
  102. package/components/index.js +1 -1
  103. package/components/p-3Mi9vpmB.js +4 -0
  104. package/components/p-B-en4B17.js +4 -0
  105. package/components/p-B1gnrQ9b.js +4 -0
  106. package/components/p-BU0dY8pq.js +4 -0
  107. package/components/p-BfXZJ1Fe.js +4 -0
  108. package/components/p-BgzU1loG.js +4 -0
  109. package/components/p-BhbWmCTu.js +4 -0
  110. package/components/p-BqY0KzJC.js +4 -0
  111. package/components/p-BrIcCcce.js +4 -0
  112. package/components/p-BrJFPhMA.js +4 -0
  113. package/components/p-Btdh3fq7.js +4 -0
  114. package/components/{p-Urcs7-vS.js → p-BwfAXfmz.js} +1 -1
  115. package/components/p-ByX1_7SF.js +4 -0
  116. package/components/p-C1jqbZdf.js +4 -0
  117. package/{dist/design-system/p-15bc012833.entry.js → components/p-CA7G72wZ.js} +1 -1
  118. package/components/p-CQHwI4iD.js +4 -0
  119. package/components/p-CYWn3X22.js +4 -0
  120. package/components/p-CjIxf5zy.js +4 -0
  121. package/components/p-Ctnm_MBD.js +4 -0
  122. package/components/p-CvaNxQtw.js +4 -0
  123. package/components/p-D9ILiUgm.js +4 -0
  124. package/components/{p-BATOumsf.js → p-D9YYP2SG.js} +1 -1
  125. package/components/p-DAYd9ty0.js +4 -0
  126. package/components/p-DIK6Zkg6.js +4 -0
  127. package/{dist/design-system/p-BkESlUMc.js → components/p-DQBzmbR6.js} +1 -1
  128. package/components/{p-z1jJgtep.js → p-DU7t9H9h.js} +1 -1
  129. package/components/p-DYTOWDAA.js +4 -0
  130. package/components/p-DYlqkAWn.js +4 -0
  131. package/components/p-DbM7ALm9.js +14 -0
  132. package/{dist/design-system/p-D2tr7015.js → components/p-DbY6Pfeh.js} +1 -1
  133. package/components/{p-DZqqelPH.js → p-DcSNuA8W.js} +1 -1
  134. package/components/p-DenZRIeA.js +4 -0
  135. package/components/p-DokkRjWC.js +4 -0
  136. package/{dist/design-system/p-BwrOVItb.js → components/p-Dr4MUfss.js} +1 -1
  137. package/components/p-DsvYY32v.js +4 -0
  138. package/components/p-Du7QOHtz.js +5 -0
  139. package/components/{p-E8U6M5ii.js → p-FBQaJyH0.js} +1 -1
  140. package/components/{p-Dr4dquer.js → p-J0mxIuTt.js} +1 -1
  141. package/{dist/design-system/p-DJxr2Dcd.js → components/p-UCeQ1JCs.js} +1 -1
  142. package/components/p-Uy_dVz21.js +4 -0
  143. package/components/p-WO0X5Vmy.js +4 -0
  144. package/components/p-bGV2P6rT.js +4 -0
  145. package/components/{p-Bt20CEww.js → p-n3_2KEz0.js} +1 -1
  146. package/dist/cjs/array-CioNm_V1.js +1985 -0
  147. package/dist/cjs/{breakpoints.decorator-qaoHOU6Q.js → breakpoints.decorator-C-Qm21UK.js} +1 -1
  148. package/dist/cjs/{breakpoints.subject-DhAN_ZAn.js → breakpoints.subject-XNcGwhzh.js} +3 -3
  149. package/dist/cjs/{button.interfaces-BueDWsuH.js → button.interfaces-CqlUGR-N.js} +1 -1
  150. package/dist/cjs/carousel.interfaces-BFQpUNrw.js +12 -0
  151. package/dist/cjs/{config.decorator-Qmrq4ZYj.js → config.decorator-ThGLtT-3.js} +1 -1
  152. package/dist/cjs/{config.utils-Cv4cx_Xa.js → config.utils-MhZvq4Qm.js} +1 -1
  153. package/dist/cjs/create-validator-decorator-BIgFqrMJ.js +212 -0
  154. package/dist/cjs/design-system.cjs.js +3 -3
  155. package/dist/cjs/{device-CptgCtVc.js → device-BnjBOLnP.js} +1 -1
  156. package/dist/cjs/ds-accordion.cjs.entry.js +30 -34
  157. package/dist/cjs/ds-alert-container.cjs.entry.js +12 -15
  158. package/dist/cjs/ds-app.cjs.entry.js +16 -6
  159. package/dist/cjs/ds-badge.cjs.entry.js +32 -25
  160. package/dist/cjs/ds-button-group.cjs.entry.js +14 -17
  161. package/dist/cjs/ds-button_2.cjs.entry.js +58 -73
  162. package/dist/cjs/ds-card-actions.cjs.entry.js +6 -8
  163. package/dist/cjs/ds-card-content.cjs.entry.js +2 -2
  164. package/dist/cjs/ds-card-header.cjs.entry.js +8 -5
  165. package/dist/cjs/ds-card-subtitle.cjs.entry.js +13 -13
  166. package/dist/cjs/ds-card-title.cjs.entry.js +11 -7
  167. package/dist/cjs/ds-card.cjs.entry.js +30 -42
  168. package/dist/cjs/ds-carousel-item.cjs.entry.js +128 -0
  169. package/dist/cjs/ds-carousel.cjs.entry.js +473 -0
  170. package/dist/cjs/ds-checkbox-group.cjs.entry.js +41 -2012
  171. package/dist/cjs/ds-checkbox.cjs.entry.js +23 -19
  172. package/dist/cjs/ds-content_2.cjs.entry.js +330 -0
  173. package/dist/cjs/ds-data-item.cjs.entry.js +146 -0
  174. package/dist/cjs/ds-data-label.cjs.entry.js +41 -0
  175. package/dist/cjs/ds-data-value.cjs.entry.js +31 -0
  176. package/dist/cjs/ds-data.cjs.entry.js +43 -0
  177. package/dist/cjs/ds-date.cjs.entry.js +5334 -0
  178. package/dist/cjs/{ds-logo.cjs.entry.js → ds-divider_2.cjs.entry.js} +130 -25
  179. package/dist/cjs/ds-drawer_2.cjs.entry.js +602 -0
  180. package/dist/cjs/ds-file-upload.cjs.entry.js +515 -0
  181. package/dist/cjs/ds-footer.cjs.entry.js +159 -0
  182. package/dist/cjs/ds-heading.cjs.entry.js +21 -19
  183. package/dist/cjs/ds-hint-text.cjs.entry.js +28 -0
  184. package/dist/cjs/ds-hint-title.cjs.entry.js +31 -0
  185. package/dist/cjs/ds-hint.cjs.entry.js +243 -0
  186. package/dist/cjs/ds-icon_2.cjs.entry.js +78 -70
  187. package/dist/cjs/ds-input.cjs.entry.js +45 -43
  188. package/dist/cjs/ds-item.cjs.entry.js +29 -34
  189. package/dist/cjs/ds-label.cjs.entry.js +22 -30
  190. package/dist/cjs/ds-list.cjs.entry.js +6 -12
  191. package/dist/cjs/ds-modal-body.cjs.entry.js +34 -0
  192. package/dist/cjs/ds-modal-header.cjs.entry.js +31 -0
  193. package/dist/cjs/ds-modal.cjs.entry.js +201 -0
  194. package/dist/cjs/ds-navbar.cjs.entry.js +359 -0
  195. package/dist/cjs/ds-notification.cjs.entry.js +19 -27
  196. package/dist/cjs/ds-number-input.cjs.entry.js +128 -45
  197. package/dist/cjs/ds-pagination.cjs.entry.js +41 -37
  198. package/dist/cjs/ds-progress-bar.cjs.entry.js +25 -29
  199. package/dist/cjs/ds-radio-group.cjs.entry.js +30 -29
  200. package/dist/cjs/ds-radio.cjs.entry.js +26 -33
  201. package/dist/cjs/ds-segment-item.cjs.entry.js +9 -9
  202. package/dist/cjs/ds-segment.cjs.entry.js +29 -117
  203. package/dist/cjs/ds-select-optgroup.cjs.entry.js +49 -0
  204. package/dist/cjs/ds-select-option.cjs.entry.js +57 -0
  205. package/dist/cjs/ds-select.cjs.entry.js +2772 -0
  206. package/dist/cjs/ds-shape.cjs.entry.js +10 -16
  207. package/dist/cjs/ds-snackbar.cjs.entry.js +40 -57
  208. package/dist/cjs/ds-step-panel.cjs.entry.js +55 -0
  209. package/dist/cjs/ds-step.cjs.entry.js +170 -0
  210. package/dist/cjs/ds-steps.cjs.entry.js +227 -0
  211. package/dist/cjs/ds-tab-panel.cjs.entry.js +55 -0
  212. package/dist/cjs/ds-tab.cjs.entry.js +120 -0
  213. package/dist/cjs/ds-tabs.cjs.entry.js +364 -0
  214. package/dist/cjs/ds-tag-group.cjs.entry.js +3 -3
  215. package/dist/cjs/ds-tag.cjs.entry.js +19 -26
  216. package/dist/cjs/ds-text.cjs.entry.js +28 -32
  217. package/dist/cjs/ds-textarea.cjs.entry.js +32 -31
  218. package/dist/cjs/ds-toast.cjs.entry.js +40 -54
  219. package/dist/cjs/ds-toggle.cjs.entry.js +22 -21
  220. package/dist/cjs/ds-tooltip.cjs.entry.js +182 -0
  221. package/dist/cjs/{field.util-RjuvTLNZ.js → field.util-L-DkeMVk.js} +1 -1
  222. package/dist/cjs/floating-ui.dom-Cu3dZdFD.js +1628 -0
  223. package/dist/cjs/focus-D3VVgpM7.js +1958 -0
  224. package/dist/cjs/footer.i18n-CpGxizgm.js +162 -0
  225. package/dist/cjs/{form-control-Bno2tBGf.js → form-control-CtMcJUuC.js} +2 -2
  226. package/dist/cjs/has-value-DK0oRqXI.js +12 -0
  227. package/dist/cjs/{index-CdD-TT_n.js → index-sC3JnTlJ.js} +497 -175
  228. package/dist/cjs/index.cjs.js +26 -8283
  229. package/dist/cjs/keyboard-C7y0jXYb.js +23 -0
  230. package/dist/cjs/{listener-DgVWqfa1.js → listener-BwB_xent.js} +1 -1
  231. package/dist/cjs/loader.cjs.js +2 -2
  232. package/dist/cjs/luxon-q23LOWrr.js +8137 -0
  233. package/dist/cjs/one-of-BZGRIMtQ.js +30 -0
  234. package/dist/cjs/popup.interfaces-B-mwd9rh.js +23 -0
  235. package/dist/cjs/required-COz3Unzu.js +38 -0
  236. package/dist/cjs/resize.decorator-DWM_fQgv.js +98 -0
  237. package/dist/cjs/scroll-CUuEh4xd.js +89 -0
  238. package/dist/cjs/svg-D9RbiR8R.js +2443 -0
  239. package/dist/cjs/{tslib.es6-BTi-SLnA.js → tslib.es6-CxyosZMg.js} +1 -1
  240. package/dist/cjs/type-hmc4CJcO.js +33 -0
  241. package/dist/collection/collection-manifest.json +30 -2
  242. package/dist/collection/components/accordion/accordion.host.css +1 -1
  243. package/dist/collection/components/accordion/accordion.js +22 -29
  244. package/dist/collection/components/alert/alert-container.js +8 -14
  245. package/dist/collection/components/alert/alert.controller.js +1 -1
  246. package/dist/collection/components/alert/snackbar/snackbar.js +30 -53
  247. package/dist/collection/components/alert/toast/toast.js +32 -53
  248. package/dist/collection/components/app/app.js +11 -3
  249. package/dist/collection/components/badge/badge.interfaces.js +1 -1
  250. package/dist/collection/components/badge/badge.js +28 -25
  251. package/dist/collection/components/button/button-group/button-group.js +8 -14
  252. package/dist/collection/components/button/button.host.css +1 -1
  253. package/dist/collection/components/button/button.interfaces.js +1 -1
  254. package/dist/collection/components/button/button.js +44 -54
  255. package/dist/collection/components/card/card-actions/card-actions.js +3 -6
  256. package/dist/collection/components/card/card-header/card-header.js +4 -3
  257. package/dist/collection/components/card/card-subtitle/card-subtitle.js +8 -11
  258. package/dist/collection/components/card/card-title/card-title.js +6 -5
  259. package/dist/collection/components/card/card.host.css +1 -1
  260. package/dist/collection/components/card/card.js +25 -38
  261. package/dist/collection/components/carousel/carousel/carousel.host.css +1 -0
  262. package/dist/collection/components/carousel/carousel/carousel.i18n.js +65 -0
  263. package/dist/collection/components/carousel/carousel/carousel.js +631 -0
  264. package/dist/collection/components/carousel/carousel-item/carousel-item.host.css +1 -0
  265. package/dist/collection/components/carousel/carousel-item/carousel-item.js +313 -0
  266. package/dist/collection/components/carousel/carousel.interfaces.js +6 -0
  267. package/dist/collection/components/carousel/test/carousel.a11y.play.js +34 -0
  268. package/dist/collection/components/carousel/test/carousel.component.play.js +57 -0
  269. package/dist/collection/components/carousel/test/carousel.visual.play.js +24 -0
  270. package/dist/collection/components/checkbox/checkbox-group/checkbox-group.host.css +1 -1
  271. package/dist/collection/components/checkbox/checkbox-group/checkbox-group.js +25 -26
  272. package/dist/collection/components/checkbox/checkbox.js +18 -18
  273. package/dist/collection/components/close/close.js +10 -21
  274. package/dist/collection/components/content/content.js +38 -52
  275. package/dist/collection/components/data/data-item.host.css +1 -0
  276. package/dist/collection/components/data/data-item.i18n.js +35 -0
  277. package/dist/collection/components/data/data-item.js +244 -0
  278. package/dist/collection/components/data/data-label.host.css +1 -0
  279. package/dist/collection/components/data/data-label.js +72 -0
  280. package/dist/collection/components/data/data-value.host.css +1 -0
  281. package/dist/collection/components/data/data-value.js +38 -0
  282. package/dist/collection/components/data/data.host.css +1 -0
  283. package/dist/collection/components/data/data.js +75 -0
  284. package/dist/collection/components/data/test/data.a11y.play.js +31 -0
  285. package/dist/collection/components/data/test/data.component.play.js +104 -0
  286. package/dist/collection/components/data/test/data.visual.play.js +25 -0
  287. package/dist/collection/components/date/date.host.css +1 -0
  288. package/dist/collection/components/date/date.i18n.js +105 -0
  289. package/dist/collection/components/date/date.interfaces.js +4 -0
  290. package/dist/collection/components/date/date.js +1241 -0
  291. package/dist/collection/components/date/date.mask.js +189 -0
  292. package/dist/collection/components/date/date.picker.js +536 -0
  293. package/dist/collection/components/date/test/date.a11y.play.js +27 -0
  294. package/dist/collection/components/date/test/date.component.play.js +69 -0
  295. package/dist/collection/components/date/test/date.visual.play.js +43 -0
  296. package/dist/collection/components/divider/divider.host.css +1 -1
  297. package/dist/collection/components/divider/divider.js +11 -24
  298. package/dist/collection/components/drawer/drawer.host.css +1 -0
  299. package/dist/collection/{utils/property-checkers/constants.js → components/drawer/drawer.interfaces.js} +1 -1
  300. package/dist/collection/components/drawer/drawer.js +492 -0
  301. package/dist/collection/components/drawer/test/drawer.a11y.play.js +39 -0
  302. package/dist/collection/components/drawer/test/drawer.component.play.js +131 -0
  303. package/dist/collection/components/drawer/test/drawer.visual.play.js +31 -0
  304. package/dist/collection/components/file-upload/file-upload.host.css +1 -0
  305. package/dist/collection/components/file-upload/file-upload.i18n.js +55 -0
  306. package/dist/collection/components/file-upload/file-upload.interfaces.js +10 -0
  307. package/dist/collection/components/file-upload/file-upload.js +1030 -0
  308. package/dist/collection/components/file-upload/test/file-upload.a11y.play.js +52 -0
  309. package/dist/collection/components/file-upload/test/file-upload.component.play.js +124 -0
  310. package/dist/collection/components/file-upload/test/file-upload.visual.play.js +18 -0
  311. package/dist/collection/components/file-upload/utils/file-list.util.js +13 -0
  312. package/dist/collection/components/file-upload/utils/file-size.util.js +10 -0
  313. package/dist/collection/components/file-upload/utils/file-validation.util.js +48 -0
  314. package/dist/collection/components/footer/footer.host.css +1 -0
  315. package/dist/collection/components/footer/footer.i18n.js +155 -0
  316. package/dist/collection/components/footer/footer.interfaces.js +4 -0
  317. package/dist/collection/components/footer/footer.js +350 -0
  318. package/dist/collection/components/footer/test/footer.a11y.play.js +17 -0
  319. package/dist/collection/components/footer/test/footer.component.play.js +74 -0
  320. package/dist/collection/components/footer/test/footer.visual.play.js +16 -0
  321. package/dist/collection/components/form/test/form.visual.play.js +13 -1
  322. package/dist/collection/components/heading/heading.js +16 -17
  323. package/dist/collection/components/hint/hint-text/hint-text.js +28 -0
  324. package/dist/collection/components/hint/hint-title/hint-title.js +31 -0
  325. package/dist/collection/components/hint/hint.host.css +1 -0
  326. package/dist/collection/components/hint/hint.i18n.js +35 -0
  327. package/dist/collection/components/hint/hint.interfaces.js +1 -0
  328. package/dist/collection/components/hint/hint.js +410 -0
  329. package/dist/collection/components/hint/test/hint.a11y.play.js +41 -0
  330. package/dist/collection/components/hint/test/hint.component.play.js +110 -0
  331. package/dist/collection/components/hint/test/hint.visual.play.js +39 -0
  332. package/dist/collection/components/icon/icon.host.css +1 -1
  333. package/dist/collection/components/icon/icon.interfaces.js +1 -0
  334. package/dist/collection/components/icon/icon.js +73 -42
  335. package/dist/collection/components/icon/test/icon.component.play.js +23 -1
  336. package/dist/collection/components/input/clear-button.i18n.js +35 -0
  337. package/dist/collection/components/input/clear-button.util.js +11 -0
  338. package/dist/collection/components/input/input.host.css +1 -1
  339. package/dist/collection/components/input/input.js +36 -37
  340. package/dist/collection/components/input/test/input.component.play.js +1 -1
  341. package/dist/collection/components/input/trigger-button.i18n.js +45 -0
  342. package/dist/collection/components/label/label.js +16 -28
  343. package/dist/collection/components/list/item/item.host.css +1 -1
  344. package/dist/collection/components/list/item/item.interfaces.js +1 -1
  345. package/dist/collection/components/list/item/item.js +27 -34
  346. package/dist/collection/components/list/list.js +3 -10
  347. package/dist/collection/components/list/test/list.visual.play.js +30 -0
  348. package/dist/collection/components/logo/logo.js +11 -18
  349. package/dist/collection/components/modal/modal-body/modal-body.host.css +1 -0
  350. package/dist/collection/components/modal/modal-body/modal-body.js +41 -0
  351. package/dist/collection/components/modal/modal-header/modal-header.js +32 -0
  352. package/dist/collection/components/modal/modal.controller.js +31 -0
  353. package/dist/collection/components/modal/modal.host.css +1 -0
  354. package/dist/collection/components/modal/modal.interfaces.js +1 -0
  355. package/dist/collection/components/modal/modal.js +461 -0
  356. package/dist/collection/components/modal/test/modal.a11y.play.js +59 -0
  357. package/dist/collection/components/modal/test/modal.component.play.js +196 -0
  358. package/dist/collection/components/modal/test/modal.visual.play.js +36 -0
  359. package/dist/collection/components/navbar/navbar.host.css +1 -0
  360. package/dist/collection/components/navbar/navbar.i18n.js +65 -0
  361. package/dist/collection/components/navbar/navbar.interfaces.js +6 -0
  362. package/dist/collection/components/navbar/navbar.js +544 -0
  363. package/dist/collection/components/navbar/test/navbar.a11y.play.js +26 -0
  364. package/dist/collection/components/navbar/test/navbar.component.play.js +76 -0
  365. package/dist/collection/components/navbar/test/navbar.visual.play.js +14 -0
  366. package/dist/collection/components/notification/notification.js +14 -26
  367. package/dist/collection/components/number-input/number-input.host.css +1 -1
  368. package/dist/collection/components/number-input/number-input.js +23 -24
  369. package/dist/collection/components/pagination/pagination.host.css +1 -1
  370. package/dist/collection/components/pagination/pagination.js +29 -28
  371. package/dist/collection/components/popup/popup.host.css +1 -0
  372. package/dist/collection/components/popup/popup.interfaces.js +18 -0
  373. package/dist/collection/components/popup/popup.js +869 -0
  374. package/dist/collection/components/popup/test/popup.a11y.play.js +50 -0
  375. package/dist/collection/components/popup/test/popup.component.play.js +168 -0
  376. package/dist/collection/components/popup/test/popup.visual.play.js +33 -0
  377. package/dist/collection/components/progress-bar/progress-bar.host.css +1 -1
  378. package/dist/collection/components/progress-bar/progress-bar.js +13 -20
  379. package/dist/collection/components/radio/radio-group/radio-group.host.css +1 -1
  380. package/dist/collection/components/radio/radio-group/radio-group.js +22 -23
  381. package/dist/collection/components/radio/radio.js +19 -20
  382. package/dist/collection/components/segment/segment/segment.host.css +1 -1
  383. package/dist/collection/components/segment/segment/segment.js +19 -20
  384. package/dist/collection/components/segment/segment-item.js +6 -7
  385. package/dist/collection/components/select/select-optgroup.host.css +1 -0
  386. package/dist/collection/components/select/select-optgroup.js +82 -0
  387. package/dist/collection/components/select/select-option.host.css +1 -0
  388. package/dist/collection/components/select/select-option.js +112 -0
  389. package/dist/collection/components/select/select.host.css +1 -0
  390. package/dist/collection/components/select/select.i18n.js +45 -0
  391. package/dist/collection/components/select/select.interfaces.js +4 -0
  392. package/dist/collection/components/select/select.js +1024 -0
  393. package/dist/collection/components/select/select.picker.js +276 -0
  394. package/dist/collection/components/select/test/select.a11y.play.js +81 -0
  395. package/dist/collection/components/select/test/select.component.play.js +184 -0
  396. package/dist/collection/components/select/test/select.visual.play.js +70 -0
  397. package/dist/collection/components/shape/shape.js +7 -14
  398. package/dist/collection/components/spinner/spinner.js +18 -26
  399. package/dist/collection/components/stack/stack.host.css +1 -1
  400. package/dist/collection/components/stack/stack.js +41 -153
  401. package/dist/collection/components/steps/step/step.host.css +1 -0
  402. package/dist/collection/components/steps/step/step.js +431 -0
  403. package/dist/collection/components/steps/step-panel/step-panel.host.css +1 -0
  404. package/dist/collection/components/steps/step-panel/step-panel.js +104 -0
  405. package/dist/collection/components/steps/steps/steps.host.css +1 -0
  406. package/dist/collection/components/steps/steps/steps.js +356 -0
  407. package/dist/collection/components/steps/steps.interfaces.js +4 -0
  408. package/dist/collection/components/steps/test/steps.a11y.play.js +73 -0
  409. package/dist/collection/components/steps/test/steps.component.play.js +182 -0
  410. package/dist/collection/components/steps/test/steps.visual.play.js +18 -0
  411. package/dist/collection/components/tabs/tab/tab.host.css +1 -0
  412. package/dist/collection/components/tabs/tab/tab.js +278 -0
  413. package/dist/collection/components/tabs/tab-panel/tab-panel.host.css +1 -0
  414. package/dist/collection/components/tabs/tab-panel/tab-panel.js +104 -0
  415. package/dist/collection/components/tabs/tabs/tabs.host.css +1 -0
  416. package/dist/collection/components/tabs/tabs/tabs.i18n.js +45 -0
  417. package/dist/collection/components/tabs/tabs/tabs.js +552 -0
  418. package/dist/collection/components/tabs/tabs.interfaces.js +12 -0
  419. package/dist/collection/components/tabs/test/tabs.a11y.play.js +60 -0
  420. package/dist/collection/components/tabs/test/tabs.component.play.js +129 -0
  421. package/dist/collection/components/tabs/test/tabs.visual.play.js +31 -0
  422. package/dist/collection/components/tag/tag-group/tag-group.js +1 -1
  423. package/dist/collection/components/tag/tag.js +15 -26
  424. package/dist/collection/components/text/text.js +23 -30
  425. package/dist/collection/components/textarea/textarea.host.css +1 -1
  426. package/dist/collection/components/textarea/textarea.js +24 -25
  427. package/dist/collection/components/time-input/test/time-input.visual.play.js +18 -0
  428. package/dist/collection/components/toggle/toggle.js +19 -20
  429. package/dist/collection/components/tooltip/test/tooltip.a11y.play.js +32 -0
  430. package/dist/collection/components/tooltip/test/tooltip.component.play.js +51 -0
  431. package/dist/collection/components/tooltip/test/tooltip.visual.play.js +16 -0
  432. package/dist/collection/components/tooltip/tooltip.host.css +1 -0
  433. package/dist/collection/components/tooltip/tooltip.interfaces.js +4 -0
  434. package/dist/collection/components/tooltip/tooltip.js +407 -0
  435. package/dist/collection/foundation/colors.visual.play.js +18 -0
  436. package/dist/collection/global/config/config.const.js +11 -0
  437. package/dist/collection/global/config/config.default.js +92 -42
  438. package/dist/collection/global/config/config.js +1 -1
  439. package/dist/collection/global/config/config.meta.js +27 -0
  440. package/dist/collection/global/config/index.js +1 -0
  441. package/dist/collection/global/config/initialize.js +2 -1
  442. package/dist/collection/global/constants/tags.constant.js +29 -1
  443. package/dist/collection/global/constants/version.constant.js +1 -1
  444. package/dist/collection/global/index.js +0 -1
  445. package/dist/collection/global/initialize.js +2 -0
  446. package/dist/collection/index.js +5 -20
  447. package/dist/collection/utils/attributes.js +0 -15
  448. package/dist/collection/utils/focus.js +72 -0
  449. package/dist/collection/utils/form-control.js +1 -1
  450. package/dist/collection/utils/has-value.js +7 -0
  451. package/dist/collection/utils/helpers.js +14 -74
  452. package/dist/collection/utils/index.js +7 -5
  453. package/dist/collection/utils/{property-checkers/is-value-empty.js → is-value-empty.js} +1 -1
  454. package/dist/collection/utils/number.js +6 -25
  455. package/dist/collection/utils/property-decorators/array-of.js +25 -0
  456. package/dist/collection/utils/property-decorators/bound.js +79 -0
  457. package/dist/collection/utils/property-decorators/create-validator-decorator.js +212 -0
  458. package/dist/collection/utils/property-decorators/date.js +24 -0
  459. package/dist/collection/utils/property-decorators/index.js +12 -0
  460. package/dist/collection/utils/property-decorators/iso-date.js +24 -0
  461. package/dist/collection/utils/property-decorators/one-of.js +25 -0
  462. package/dist/collection/utils/property-decorators/pattern.js +25 -0
  463. package/dist/collection/utils/property-decorators/required.js +44 -0
  464. package/dist/collection/utils/property-decorators/type.js +28 -0
  465. package/dist/collection/utils/property-decorators/url.js +32 -0
  466. package/dist/collection/utils/property-types.js +1 -0
  467. package/dist/collection/utils/svg.js +19 -0
  468. package/dist/design-system/design-system.esm.js +1 -1
  469. package/dist/design-system/index.esm.js +1 -1
  470. package/dist/design-system/p-01430d5c28.entry.js +4 -0
  471. package/dist/design-system/p-014d464627.entry.js +4 -0
  472. package/dist/design-system/p-0663d7c0f1.entry.js +4 -0
  473. package/dist/design-system/p-0bd2ce2da3.entry.js +4 -0
  474. package/dist/design-system/p-0ff0be5b83.entry.js +4 -0
  475. package/dist/design-system/p-10c136d00d.entry.js +4 -0
  476. package/dist/design-system/p-11f34d0c7d.entry.js +4 -0
  477. package/dist/design-system/p-13d1ce3158.entry.js +4 -0
  478. package/dist/design-system/p-163d606781.entry.js +4 -0
  479. package/dist/design-system/p-1VXOIrN2.js +4 -0
  480. package/dist/design-system/p-202ecb8f01.entry.js +4 -0
  481. package/dist/design-system/p-27d181c5ac.entry.js +4 -0
  482. package/dist/design-system/p-2a35e0b9b0.entry.js +4 -0
  483. package/dist/design-system/p-2f51e1d39b.entry.js +4 -0
  484. package/dist/design-system/p-3134821ac6.entry.js +4 -0
  485. package/dist/design-system/p-3292ae6a05.entry.js +4 -0
  486. package/dist/design-system/p-372bf379f9.entry.js +4 -0
  487. package/dist/design-system/p-3895178b39.entry.js +4 -0
  488. package/dist/design-system/p-3c6b7a2967.entry.js +4 -0
  489. package/dist/design-system/p-3ef4bd1c59.entry.js +4 -0
  490. package/dist/design-system/p-493b18cc46.entry.js +4 -0
  491. package/dist/design-system/p-4a99464dae.entry.js +4 -0
  492. package/dist/design-system/p-4e6638d14e.entry.js +4 -0
  493. package/dist/design-system/p-53dda5d400.entry.js +4 -0
  494. package/dist/design-system/p-5d17209d91.entry.js +4 -0
  495. package/dist/design-system/p-5e51fa8df4.entry.js +4 -0
  496. package/dist/design-system/p-60d29d8b8e.entry.js +4 -0
  497. package/dist/design-system/p-62cb503015.entry.js +4 -0
  498. package/dist/design-system/p-650289138a.entry.js +4 -0
  499. package/dist/design-system/p-65c221261c.entry.js +4 -0
  500. package/dist/design-system/p-68c9f4f630.entry.js +4 -0
  501. package/dist/design-system/p-68ebed7eee.entry.js +4 -0
  502. package/dist/design-system/p-6b6531379b.entry.js +4 -0
  503. package/dist/design-system/p-6d168ba9ad.entry.js +4 -0
  504. package/dist/design-system/p-6ef31a3c07.entry.js +4 -0
  505. package/dist/design-system/p-774b89ed0b.entry.js +4 -0
  506. package/dist/design-system/p-787bd92bcc.entry.js +4 -0
  507. package/{components/p-E1SnOz0L.js → dist/design-system/p-78NZc8PM.js} +1 -1
  508. package/dist/design-system/p-7c353652a9.entry.js +4 -0
  509. package/dist/design-system/p-7c8bf0f33e.entry.js +4 -0
  510. package/dist/design-system/p-7e702193fc.entry.js +4 -0
  511. package/dist/design-system/p-8353961d39.entry.js +4 -0
  512. package/dist/design-system/{p-1d312498a6.entry.js → p-8406f6faf1.entry.js} +1 -1
  513. package/dist/design-system/p-9f2dd0b55b.entry.js +4 -0
  514. package/dist/design-system/p-B-en4B17.js +4 -0
  515. package/dist/design-system/p-B1e0kNRJ.js +14 -0
  516. package/dist/design-system/p-B8KVoKrH.js +5 -0
  517. package/dist/design-system/p-BAY6Z8bT.js +4 -0
  518. package/dist/design-system/p-BLGVE-7Z.js +4 -0
  519. package/dist/design-system/{p-C7EnKCpl.js → p-BMM6Nxeh.js} +1 -1
  520. package/{components/p-Diz11uvt.js → dist/design-system/p-BPGfTrrM.js} +1 -1
  521. package/dist/design-system/p-BhdSNuGP.js +4 -0
  522. package/dist/design-system/p-BkTv_bQR.js +4 -0
  523. package/dist/design-system/p-BqY0KzJC.js +4 -0
  524. package/dist/design-system/p-BrJFPhMA.js +4 -0
  525. package/dist/design-system/p-BvEM6oCl.js +4 -0
  526. package/dist/design-system/p-C1jqbZdf.js +4 -0
  527. package/dist/design-system/p-C6MVahkC.js +5 -0
  528. package/dist/design-system/{p-DCf2fJmI.js → p-C7i6xLTJ.js} +1 -1
  529. package/dist/design-system/p-CvTcEsXg.js +4 -0
  530. package/dist/design-system/p-CwCAiaMq.js +4 -0
  531. package/{components/p-5Sp1eJOt.js → dist/design-system/p-DTxLRTYr.js} +1 -1
  532. package/dist/design-system/{p-Dnjznncd.js → p-DgVaaZT_.js} +1 -1
  533. package/dist/design-system/{p-CAcwu8uP.js → p-Dm2lqE3-.js} +1 -1
  534. package/dist/design-system/p-HwbqEzpk.js +4 -0
  535. package/dist/design-system/p-LCY5n5tq.js +4 -0
  536. package/dist/design-system/p-Uy_dVz21.js +4 -0
  537. package/dist/design-system/p-a465c1acce.entry.js +4 -0
  538. package/dist/design-system/p-a62b7985a0.entry.js +4 -0
  539. package/dist/design-system/p-a8de98dd7b.entry.js +4 -0
  540. package/dist/design-system/p-ad2b17b0a0.entry.js +4 -0
  541. package/dist/design-system/p-afd8bbe699.entry.js +4 -0
  542. package/dist/design-system/{p-7e6ed497e7.entry.js → p-b68bc14064.entry.js} +1 -1
  543. package/dist/design-system/p-b955a93959.entry.js +4 -0
  544. package/dist/design-system/p-c37f266740.entry.js +4 -0
  545. package/dist/design-system/p-caad93b943.entry.js +4 -0
  546. package/dist/design-system/p-cca79bfeb1.entry.js +4 -0
  547. package/dist/design-system/p-d5f8d8f5e1.entry.js +4 -0
  548. package/dist/design-system/p-dcb749efc7.entry.js +4 -0
  549. package/dist/design-system/p-dd38f8f206.entry.js +4 -0
  550. package/dist/design-system/p-ddf2a7dfee.entry.js +4 -0
  551. package/dist/design-system/p-df5899b930.entry.js +4 -0
  552. package/dist/design-system/p-e7472337ed.entry.js +4 -0
  553. package/dist/design-system/p-e85c92ca1a.entry.js +4 -0
  554. package/dist/design-system/p-f0119fe693.entry.js +4 -0
  555. package/dist/design-system/p-f4958b9e97.entry.js +4 -0
  556. package/dist/design-system/p-f62643c33d.entry.js +4 -0
  557. package/dist/design-system/p-fa9568abce.entry.js +4 -0
  558. package/dist/design-system/p-fcd98f22b7.entry.js +4 -0
  559. package/dist/design-system/p-feeef4a8cb.entry.js +4 -0
  560. package/dist/design-system/{p-BLPSziW-.js → p-hLAmwHiq.js} +1 -1
  561. package/dist/design-system/p-ij4OEkzJ.js +4 -0
  562. package/dist/design-system/p-tl_BegdE.js +4 -0
  563. package/dist/esm/array-dJH4dfMr.js +1983 -0
  564. package/dist/esm/{breakpoints.decorator-L2xeP46f.js → breakpoints.decorator-DZ0xN4Np.js} +1 -1
  565. package/dist/esm/{breakpoints.subject-BhbzG-rl.js → breakpoints.subject-BNnXcKMw.js} +3 -3
  566. package/dist/esm/{button.interfaces-BkESlUMc.js → button.interfaces-BPGfTrrM.js} +1 -1
  567. package/dist/esm/carousel.interfaces-B-en4B17.js +8 -0
  568. package/dist/esm/{config.decorator-BQNIja4k.js → config.decorator-ZQ0_Zx5y.js} +1 -1
  569. package/dist/esm/{config.utils-COlKFRlV.js → config.utils-D9o7rffC.js} +1 -1
  570. package/dist/esm/create-validator-decorator-DovxquEu.js +208 -0
  571. package/dist/esm/design-system.js +4 -4
  572. package/dist/esm/{device-Dhwt3m7W.js → device-CRuIJzXR.js} +1 -1
  573. package/dist/esm/ds-accordion.entry.js +30 -34
  574. package/dist/esm/ds-alert-container.entry.js +12 -15
  575. package/dist/esm/ds-app.entry.js +16 -6
  576. package/dist/esm/ds-badge.entry.js +32 -25
  577. package/dist/esm/ds-button-group.entry.js +14 -17
  578. package/dist/esm/ds-button_2.entry.js +58 -73
  579. package/dist/esm/ds-card-actions.entry.js +6 -8
  580. package/dist/esm/ds-card-content.entry.js +2 -2
  581. package/dist/esm/ds-card-header.entry.js +8 -5
  582. package/dist/esm/ds-card-subtitle.entry.js +13 -13
  583. package/dist/esm/ds-card-title.entry.js +11 -7
  584. package/dist/esm/ds-card.entry.js +30 -42
  585. package/dist/esm/ds-carousel-item.entry.js +126 -0
  586. package/dist/esm/ds-carousel.entry.js +471 -0
  587. package/dist/esm/ds-checkbox-group.entry.js +40 -2011
  588. package/dist/esm/ds-checkbox.entry.js +23 -19
  589. package/dist/esm/ds-content_2.entry.js +327 -0
  590. package/dist/esm/ds-data-item.entry.js +144 -0
  591. package/dist/esm/ds-data-label.entry.js +39 -0
  592. package/dist/esm/ds-data-value.entry.js +29 -0
  593. package/dist/esm/ds-data.entry.js +41 -0
  594. package/dist/esm/ds-date.entry.js +5332 -0
  595. package/dist/esm/{ds-logo.entry.js → ds-divider_2.entry.js} +130 -26
  596. package/dist/esm/ds-drawer_2.entry.js +599 -0
  597. package/dist/esm/ds-file-upload.entry.js +513 -0
  598. package/dist/esm/ds-footer.entry.js +157 -0
  599. package/dist/esm/ds-heading.entry.js +21 -19
  600. package/dist/esm/ds-hint-text.entry.js +26 -0
  601. package/dist/esm/ds-hint-title.entry.js +29 -0
  602. package/dist/esm/ds-hint.entry.js +241 -0
  603. package/dist/esm/ds-icon_2.entry.js +78 -70
  604. package/dist/esm/ds-input.entry.js +46 -44
  605. package/dist/esm/ds-item.entry.js +29 -34
  606. package/dist/esm/ds-label.entry.js +22 -30
  607. package/dist/esm/ds-list.entry.js +6 -12
  608. package/dist/esm/ds-modal-body.entry.js +32 -0
  609. package/dist/esm/ds-modal-header.entry.js +29 -0
  610. package/dist/esm/ds-modal.entry.js +199 -0
  611. package/dist/esm/ds-navbar.entry.js +357 -0
  612. package/dist/esm/ds-notification.entry.js +19 -27
  613. package/dist/esm/ds-number-input.entry.js +129 -46
  614. package/dist/esm/ds-pagination.entry.js +41 -37
  615. package/dist/esm/ds-progress-bar.entry.js +25 -29
  616. package/dist/esm/ds-radio-group.entry.js +31 -30
  617. package/dist/esm/ds-radio.entry.js +25 -32
  618. package/dist/esm/ds-segment-item.entry.js +9 -9
  619. package/dist/esm/ds-segment.entry.js +28 -116
  620. package/dist/esm/ds-select-optgroup.entry.js +47 -0
  621. package/dist/esm/ds-select-option.entry.js +55 -0
  622. package/dist/esm/ds-select.entry.js +2770 -0
  623. package/dist/esm/ds-shape.entry.js +10 -16
  624. package/dist/esm/ds-snackbar.entry.js +40 -57
  625. package/dist/esm/ds-step-panel.entry.js +53 -0
  626. package/dist/esm/ds-step.entry.js +168 -0
  627. package/dist/esm/ds-steps.entry.js +225 -0
  628. package/dist/esm/ds-tab-panel.entry.js +53 -0
  629. package/dist/esm/ds-tab.entry.js +118 -0
  630. package/dist/esm/ds-tabs.entry.js +362 -0
  631. package/dist/esm/ds-tag-group.entry.js +3 -3
  632. package/dist/esm/ds-tag.entry.js +19 -26
  633. package/dist/esm/ds-text.entry.js +28 -32
  634. package/dist/esm/ds-textarea.entry.js +33 -32
  635. package/dist/esm/ds-toast.entry.js +40 -54
  636. package/dist/esm/ds-toggle.entry.js +22 -21
  637. package/dist/esm/ds-tooltip.entry.js +180 -0
  638. package/dist/esm/{field.util-BXxRO7CD.js → field.util-BjZzAi09.js} +1 -1
  639. package/dist/esm/floating-ui.dom-BqY0KzJC.js +1621 -0
  640. package/dist/esm/focus-ZxHImoOj.js +1956 -0
  641. package/dist/esm/footer.i18n-BrJFPhMA.js +159 -0
  642. package/dist/esm/{form-control-D2O-sb65.js → form-control-DvJo0GKN.js} +2 -2
  643. package/dist/esm/has-value-DU9L2JaI.js +10 -0
  644. package/dist/esm/{index-CuwLeg-T.js → index-C6MVahkC.js} +496 -175
  645. package/dist/esm/index.js +13 -8273
  646. package/dist/esm/{input.interfaces-C7EnKCpl.js → input.interfaces-BMM6Nxeh.js} +1 -1
  647. package/dist/esm/keyboard-Uy_dVz21.js +20 -0
  648. package/dist/esm/{listener-C_kjUVTE.js → listener-DHP2OPMZ.js} +1 -1
  649. package/dist/esm/loader.js +3 -3
  650. package/dist/esm/luxon-C1jqbZdf.js +8133 -0
  651. package/dist/esm/one-of-CKPv0Nqm.js +28 -0
  652. package/dist/esm/popup.interfaces-BAY6Z8bT.js +20 -0
  653. package/dist/esm/required-Dqsbx5fH.js +36 -0
  654. package/dist/esm/resize.decorator-B8h8D676.js +96 -0
  655. package/dist/esm/scroll-CsH7NHo5.js +87 -0
  656. package/dist/esm/svg-B8KVoKrH.js +2440 -0
  657. package/dist/esm/{tslib.es6-tdchDLyb.js → tslib.es6-C9GKXw-5.js} +1 -1
  658. package/dist/esm/type-DzkhLOG_.js +31 -0
  659. package/dist/types/components/accordion/accordion.d.ts +0 -5
  660. package/dist/types/components/alert/alert-container.d.ts +0 -5
  661. package/dist/types/components/alert/snackbar/snackbar.d.ts +0 -5
  662. package/dist/types/components/alert/toast/toast.d.ts +0 -5
  663. package/dist/types/components/badge/badge.d.ts +1 -3
  664. package/dist/types/components/badge/badge.interfaces.d.ts +1 -1
  665. package/dist/types/components/button/button-group/button-group.d.ts +0 -5
  666. package/dist/types/components/button/button.d.ts +1 -3
  667. package/dist/types/components/button/button.interfaces.d.ts +1 -1
  668. package/dist/types/components/card/card-actions/card-actions.d.ts +0 -1
  669. package/dist/types/components/card/card-subtitle/card-subtitle.d.ts +0 -1
  670. package/dist/types/components/card/card.d.ts +1 -3
  671. package/dist/types/components/carousel/carousel/carousel.d.ts +114 -0
  672. package/dist/types/components/carousel/carousel/carousel.i18n.d.ts +9 -0
  673. package/dist/types/components/carousel/carousel-item/carousel-item.d.ts +70 -0
  674. package/dist/types/components/carousel/carousel.interfaces.d.ts +14 -0
  675. package/dist/types/components/carousel/test/carousel.a11y.play.d.ts +1 -0
  676. package/dist/types/components/carousel/test/carousel.component.play.d.ts +1 -0
  677. package/dist/types/components/carousel/test/carousel.visual.play.d.ts +1 -0
  678. package/dist/types/components/close/close.d.ts +1 -3
  679. package/dist/types/components/content/content.d.ts +2 -5
  680. package/dist/types/components/data/data-item.d.ts +43 -0
  681. package/dist/types/components/data/data-item.i18n.d.ts +6 -0
  682. package/dist/types/components/data/data-item.interfaces.d.ts +4 -0
  683. package/dist/types/components/data/data-label.d.ts +19 -0
  684. package/dist/types/components/data/data-label.interfaces.d.ts +3 -0
  685. package/dist/types/components/data/data-value.d.ts +15 -0
  686. package/dist/types/components/data/data-value.interfaces.d.ts +5 -0
  687. package/dist/types/components/data/data.d.ts +19 -0
  688. package/dist/types/components/data/data.interfaces.d.ts +4 -0
  689. package/dist/types/components/data/test/data.a11y.play.d.ts +1 -0
  690. package/dist/types/components/data/test/data.component.play.d.ts +1 -0
  691. package/dist/types/components/data/test/data.visual.play.d.ts +1 -0
  692. package/dist/types/components/date/date.d.ts +214 -0
  693. package/dist/types/components/date/date.i18n.d.ts +13 -0
  694. package/dist/types/components/date/date.interfaces.d.ts +18 -0
  695. package/dist/types/components/date/date.mask.d.ts +29 -0
  696. package/dist/types/components/date/date.picker.d.ts +67 -0
  697. package/dist/types/components/date/test/date.a11y.play.d.ts +1 -0
  698. package/dist/types/components/date/test/date.component.play.d.ts +1 -0
  699. package/dist/types/components/date/test/date.visual.play.d.ts +1 -0
  700. package/dist/types/components/divider/divider.d.ts +1 -3
  701. package/dist/types/components/drawer/drawer.d.ts +102 -0
  702. package/dist/types/components/drawer/drawer.interfaces.d.ts +8 -0
  703. package/dist/types/components/drawer/test/drawer.a11y.play.d.ts +1 -0
  704. package/dist/types/components/drawer/test/drawer.component.play.d.ts +1 -0
  705. package/dist/types/components/drawer/test/drawer.visual.play.d.ts +1 -0
  706. package/dist/types/components/file-upload/file-upload.d.ts +192 -0
  707. package/dist/types/components/file-upload/file-upload.i18n.d.ts +8 -0
  708. package/dist/types/components/file-upload/file-upload.interfaces.d.ts +24 -0
  709. package/dist/types/components/file-upload/test/file-upload.a11y.play.d.ts +1 -0
  710. package/dist/types/components/file-upload/test/file-upload.component.play.d.ts +1 -0
  711. package/dist/types/components/file-upload/test/file-upload.visual.play.d.ts +1 -0
  712. package/dist/types/components/file-upload/utils/file-list.util.d.ts +2 -0
  713. package/dist/types/components/file-upload/utils/file-size.util.d.ts +1 -0
  714. package/dist/types/components/file-upload/utils/file-validation.util.d.ts +13 -0
  715. package/dist/types/components/footer/footer.d.ts +68 -0
  716. package/dist/types/components/footer/footer.i18n.d.ts +7 -0
  717. package/dist/types/components/footer/footer.interfaces.d.ts +19 -0
  718. package/dist/types/components/footer/test/footer.a11y.play.d.ts +1 -0
  719. package/dist/types/components/footer/test/footer.component.play.d.ts +1 -0
  720. package/dist/types/components/footer/test/footer.visual.play.d.ts +1 -0
  721. package/dist/types/components/hint/hint-text/hint-text.d.ts +15 -0
  722. package/dist/types/components/hint/hint-title/hint-title.d.ts +16 -0
  723. package/dist/types/components/hint/hint.d.ts +87 -0
  724. package/dist/types/components/hint/hint.i18n.d.ts +6 -0
  725. package/dist/types/components/hint/hint.interfaces.d.ts +4 -0
  726. package/dist/types/components/hint/test/hint.a11y.play.d.ts +1 -0
  727. package/dist/types/components/hint/test/hint.component.play.d.ts +1 -0
  728. package/dist/types/components/hint/test/hint.visual.play.d.ts +1 -0
  729. package/dist/types/components/icon/icon.d.ts +7 -3
  730. package/dist/types/components/icon/icon.interfaces.d.ts +1 -1
  731. package/dist/types/components/input/clear-button.i18n.d.ts +6 -0
  732. package/dist/types/components/input/clear-button.util.d.ts +10 -0
  733. package/dist/types/components/input/trigger-button.i18n.d.ts +7 -0
  734. package/dist/types/components/label/label.d.ts +3 -5
  735. package/dist/types/components/list/item/item.d.ts +0 -5
  736. package/dist/types/components/list/item/item.interfaces.d.ts +1 -1
  737. package/dist/types/components/list/list.d.ts +0 -5
  738. package/dist/types/components/list/test/list.visual.play.d.ts +1 -0
  739. package/dist/types/components/logo/logo.d.ts +1 -2
  740. package/dist/types/components/modal/modal-body/modal-body.d.ts +15 -0
  741. package/dist/types/components/modal/modal-header/modal-header.d.ts +17 -0
  742. package/dist/types/components/modal/modal.controller.d.ts +3 -0
  743. package/dist/types/components/modal/modal.d.ts +97 -0
  744. package/dist/types/components/modal/modal.interfaces.d.ts +15 -0
  745. package/dist/types/components/modal/test/modal.a11y.play.d.ts +1 -0
  746. package/dist/types/components/modal/test/modal.component.play.d.ts +1 -0
  747. package/dist/types/components/modal/test/modal.visual.play.d.ts +1 -0
  748. package/dist/types/components/navbar/navbar.d.ts +128 -0
  749. package/dist/types/components/navbar/navbar.i18n.d.ts +9 -0
  750. package/dist/types/components/navbar/navbar.interfaces.d.ts +10 -0
  751. package/dist/types/components/navbar/test/navbar.a11y.play.d.ts +1 -0
  752. package/dist/types/components/navbar/test/navbar.component.play.d.ts +1 -0
  753. package/dist/types/components/navbar/test/navbar.visual.play.d.ts +1 -0
  754. package/dist/types/components/notification/notification.d.ts +1 -3
  755. package/dist/types/components/pagination/pagination.d.ts +0 -5
  756. package/dist/types/components/popup/popup.d.ts +152 -0
  757. package/dist/types/components/popup/popup.interfaces.d.ts +14 -0
  758. package/dist/types/components/popup/test/popup.a11y.play.d.ts +1 -0
  759. package/dist/types/components/popup/test/popup.component.play.d.ts +1 -0
  760. package/dist/types/components/popup/test/popup.visual.play.d.ts +1 -0
  761. package/dist/types/components/progress-bar/progress-bar.d.ts +0 -5
  762. package/dist/types/components/select/select-optgroup.d.ts +28 -0
  763. package/dist/types/components/select/select-option.d.ts +34 -0
  764. package/dist/types/components/select/select.d.ts +193 -0
  765. package/dist/types/components/select/select.i18n.d.ts +7 -0
  766. package/dist/types/components/select/select.interfaces.d.ts +16 -0
  767. package/dist/types/components/select/select.picker.d.ts +57 -0
  768. package/dist/types/components/select/test/select.a11y.play.d.ts +1 -0
  769. package/dist/types/components/select/test/select.component.play.d.ts +1 -0
  770. package/dist/types/components/select/test/select.visual.play.d.ts +1 -0
  771. package/dist/types/components/shape/shape.d.ts +2 -7
  772. package/dist/types/components/spinner/spinner.d.ts +0 -2
  773. package/dist/types/components/stack/stack.d.ts +7 -19
  774. package/dist/types/components/steps/step/step.d.ts +89 -0
  775. package/dist/types/components/steps/step-panel/step-panel.d.ts +34 -0
  776. package/dist/types/components/steps/steps/steps.d.ts +77 -0
  777. package/dist/types/components/steps/steps.interfaces.d.ts +10 -0
  778. package/dist/types/components/steps/test/steps.a11y.play.d.ts +1 -0
  779. package/dist/types/components/steps/test/steps.component.play.d.ts +1 -0
  780. package/dist/types/components/steps/test/steps.visual.play.d.ts +1 -0
  781. package/dist/types/components/tabs/tab/tab.d.ts +67 -0
  782. package/dist/types/components/tabs/tab-panel/tab-panel.d.ts +34 -0
  783. package/dist/types/components/tabs/tabs/tabs.d.ts +97 -0
  784. package/dist/types/components/tabs/tabs/tabs.i18n.d.ts +7 -0
  785. package/dist/types/components/tabs/tabs.interfaces.d.ts +12 -0
  786. package/dist/types/components/tabs/test/tabs.a11y.play.d.ts +1 -0
  787. package/dist/types/components/tabs/test/tabs.component.play.d.ts +1 -0
  788. package/dist/types/components/tabs/test/tabs.visual.play.d.ts +1 -0
  789. package/dist/types/components/tag/tag.d.ts +1 -3
  790. package/dist/types/components/text/text.d.ts +2 -7
  791. package/dist/types/components/time-input/test/time-input.visual.play.d.ts +1 -0
  792. package/dist/types/components/tooltip/test/tooltip.a11y.play.d.ts +1 -0
  793. package/dist/types/components/tooltip/test/tooltip.component.play.d.ts +1 -0
  794. package/dist/types/components/tooltip/test/tooltip.visual.play.d.ts +1 -0
  795. package/dist/types/components/tooltip/tooltip.d.ts +85 -0
  796. package/dist/types/components/tooltip/tooltip.interfaces.d.ts +10 -0
  797. package/dist/types/components.d.ts +4913 -1926
  798. package/dist/types/foundation/colors.visual.play.d.ts +1 -0
  799. package/dist/types/global/config/config.const.d.ts +3 -0
  800. package/dist/types/global/config/config.default.d.ts +0 -40
  801. package/dist/types/global/config/config.meta.d.ts +2 -0
  802. package/dist/types/global/config/config.types.d.ts +27 -0
  803. package/dist/types/global/config/index.d.ts +1 -0
  804. package/dist/types/global/index.d.ts +0 -1
  805. package/dist/types/home/runner/work/design-system/design-system/packages/core/.stencil/packages/playwright/src/lib/components/carousel.po.d.ts +12 -0
  806. package/dist/types/home/runner/work/design-system/design-system/packages/core/.stencil/packages/playwright/src/lib/components/data-item.po.d.ts +16 -0
  807. package/dist/types/home/runner/work/design-system/design-system/packages/core/.stencil/packages/playwright/src/lib/components/data.po.d.ts +12 -0
  808. package/dist/types/home/runner/work/design-system/design-system/packages/core/.stencil/packages/playwright/src/lib/components/date.po.d.ts +15 -0
  809. package/dist/types/home/runner/work/design-system/design-system/packages/core/.stencil/packages/playwright/src/lib/components/drawer.po.d.ts +11 -0
  810. package/dist/types/home/runner/work/design-system/design-system/packages/core/.stencil/packages/playwright/src/lib/components/file-upload.po.d.ts +16 -0
  811. package/dist/types/home/runner/work/design-system/design-system/packages/core/.stencil/packages/playwright/src/lib/components/footer.po.d.ts +16 -0
  812. package/dist/types/home/runner/work/design-system/design-system/packages/core/.stencil/packages/playwright/src/lib/components/hint.po.d.ts +10 -0
  813. package/dist/types/home/runner/work/design-system/design-system/packages/core/.stencil/packages/playwright/src/lib/components/index.d.ts +15 -0
  814. package/dist/types/home/runner/work/design-system/design-system/packages/core/.stencil/packages/playwright/src/lib/components/modal.po.d.ts +15 -0
  815. package/dist/types/home/runner/work/design-system/design-system/packages/core/.stencil/packages/playwright/src/lib/components/navbar.po.d.ts +13 -0
  816. package/dist/types/home/runner/work/design-system/design-system/packages/core/.stencil/packages/playwright/src/lib/components/popup.po.d.ts +11 -0
  817. package/dist/types/home/runner/work/design-system/design-system/packages/core/.stencil/packages/playwright/src/lib/components/select.po.d.ts +24 -0
  818. package/dist/types/home/runner/work/design-system/design-system/packages/core/.stencil/packages/playwright/src/lib/components/steps.po.d.ts +13 -0
  819. package/dist/types/home/runner/work/design-system/design-system/packages/core/.stencil/packages/playwright/src/lib/components/tabs.po.d.ts +13 -0
  820. package/dist/types/home/runner/work/design-system/design-system/packages/core/.stencil/packages/playwright/src/lib/components/tooltip.po.d.ts +6 -0
  821. package/dist/types/home/runner/work/design-system/design-system/packages/core/.stencil/packages/playwright/src/lib/page/utils/goto.d.ts +1 -1
  822. package/dist/types/index.d.ts +4 -1
  823. package/dist/types/stencil-public-runtime.d.ts +1 -0
  824. package/dist/types/utils/attributes.d.ts +0 -8
  825. package/dist/types/utils/focus.d.ts +18 -0
  826. package/dist/types/utils/form-control.d.ts +2 -2
  827. package/dist/types/utils/has-value.d.ts +1 -0
  828. package/dist/types/utils/index.d.ts +7 -5
  829. package/dist/types/utils/number.d.ts +0 -3
  830. package/dist/types/utils/property-decorators/array-of.d.ts +9 -0
  831. package/dist/types/utils/property-decorators/bound.d.ts +36 -0
  832. package/dist/types/utils/property-decorators/create-validator-decorator.d.ts +48 -0
  833. package/dist/types/utils/property-decorators/date.d.ts +6 -0
  834. package/dist/types/utils/property-decorators/index.d.ts +9 -0
  835. package/dist/types/utils/property-decorators/iso-date.d.ts +6 -0
  836. package/dist/types/utils/property-decorators/one-of.d.ts +8 -0
  837. package/dist/types/utils/property-decorators/pattern.d.ts +8 -0
  838. package/dist/types/utils/property-decorators/required.d.ts +17 -0
  839. package/dist/types/utils/property-decorators/type.d.ts +9 -0
  840. package/dist/types/utils/property-decorators/url.d.ts +6 -0
  841. package/dist/types/utils/svg.d.ts +2 -0
  842. package/docs/cem.json +17659 -0
  843. package/docs/components.json +38767 -17409
  844. package/docs/html.html-data.json +1529 -147
  845. package/docs/tags.json +29 -1
  846. package/package.json +45 -38
  847. package/sbom.cdx.json +54391 -0
  848. package/README.md +0 -33
  849. package/components/p-82RSSk25.js +0 -4
  850. package/components/p-BEngECpF.js +0 -4
  851. package/components/p-BMBthpLd.js +0 -4
  852. package/components/p-BNY3JzuV.js +0 -4
  853. package/components/p-BOTkpyFe.js +0 -5
  854. package/components/p-BOgMmRCt.js +0 -4
  855. package/components/p-CDYlUuhB.js +0 -4
  856. package/components/p-Cb75Rr6o.js +0 -4
  857. package/components/p-CojUmpFm.js +0 -4
  858. package/components/p-DHeVI6dR.js +0 -4
  859. package/components/p-DTPbL3uY.js +0 -4
  860. package/components/p-DnnGnukM.js +0 -4
  861. package/components/p-DtuTnY5l.js +0 -4
  862. package/components/p-JZ1uDtZv.js +0 -4
  863. package/components/p-cSbDziZm.js +0 -4
  864. package/components/p-gA-94RPS.js +0 -4
  865. package/components/p-xDEngwqW.js +0 -4
  866. package/dist/cjs/contact-SPfz2A_q.js +0 -1647
  867. package/dist/cjs/ds-content.cjs.entry.js +0 -154
  868. package/dist/cjs/ds-divider.cjs.entry.js +0 -131
  869. package/dist/cjs/ds-stack.cjs.entry.js +0 -224
  870. package/dist/cjs/isEmpty-BmKp4bH4.js +0 -99
  871. package/dist/cjs/stack.interfaces-6vlKvBmb.js +0 -68
  872. package/dist/cjs/svg-D7Mwbcvp.js +0 -1482
  873. package/dist/cjs/validate.decorator-C9-9HA0Y.js +0 -115
  874. package/dist/collection/global/constants/icons.constant.js +0 -42
  875. package/dist/collection/utils/element-states/element-states.decorator.js +0 -23
  876. package/dist/collection/utils/element-states/element-states.listener.js +0 -55
  877. package/dist/collection/utils/element-states/element-states.subject.js +0 -24
  878. package/dist/collection/utils/element-states/index.js +0 -5
  879. package/dist/collection/utils/keyboard/index.js +0 -6
  880. package/dist/collection/utils/keyboard/keyboard.decorator.js +0 -23
  881. package/dist/collection/utils/keyboard/keyboard.listener.js +0 -34
  882. package/dist/collection/utils/keyboard/keyboard.subject.js +0 -24
  883. package/dist/collection/utils/property-checkers/check-array-of.js +0 -13
  884. package/dist/collection/utils/property-checkers/check-date.js +0 -18
  885. package/dist/collection/utils/property-checkers/check-iso-date.js +0 -14
  886. package/dist/collection/utils/property-checkers/check-one-of.js +0 -13
  887. package/dist/collection/utils/property-checkers/check-pattern.js +0 -13
  888. package/dist/collection/utils/property-checkers/check-type.js +0 -20
  889. package/dist/collection/utils/property-checkers/check-url.js +0 -20
  890. package/dist/collection/utils/property-checkers/empty-or.js +0 -15
  891. package/dist/collection/utils/property-checkers/index.js +0 -57
  892. package/dist/collection/utils/property-checkers/required-and.js +0 -20
  893. package/dist/collection/utils/swipe/index.js +0 -6
  894. package/dist/collection/utils/swipe/swipe.decorator.js +0 -23
  895. package/dist/collection/utils/swipe/swipe.listener.js +0 -33
  896. package/dist/collection/utils/swipe/swipe.subject.js +0 -28
  897. package/dist/collection/utils/validate.decorator.js +0 -203
  898. package/dist/design-system/p-03bbcdf9de.entry.js +0 -4
  899. package/dist/design-system/p-1154323457.entry.js +0 -4
  900. package/dist/design-system/p-1f0601a4f4.entry.js +0 -4
  901. package/dist/design-system/p-21b080a49a.entry.js +0 -4
  902. package/dist/design-system/p-27c34c4e5f.entry.js +0 -4
  903. package/dist/design-system/p-2b91de302f.entry.js +0 -4
  904. package/dist/design-system/p-31c1235ac5.entry.js +0 -4
  905. package/dist/design-system/p-3259acaa64.entry.js +0 -4
  906. package/dist/design-system/p-339d85cca0.entry.js +0 -4
  907. package/dist/design-system/p-35e63b52e7.entry.js +0 -4
  908. package/dist/design-system/p-363f3a7ab4.entry.js +0 -4
  909. package/dist/design-system/p-3d901720f7.entry.js +0 -4
  910. package/dist/design-system/p-40ba8b9812.entry.js +0 -4
  911. package/dist/design-system/p-432430e14f.entry.js +0 -4
  912. package/dist/design-system/p-487807f228.entry.js +0 -4
  913. package/dist/design-system/p-4a049d1b7f.entry.js +0 -4
  914. package/dist/design-system/p-4f4cce8ce4.entry.js +0 -4
  915. package/dist/design-system/p-5a901a9b8e.entry.js +0 -4
  916. package/dist/design-system/p-5d3330bf93.entry.js +0 -4
  917. package/dist/design-system/p-640223834c.entry.js +0 -4
  918. package/dist/design-system/p-6b9aab417f.entry.js +0 -4
  919. package/dist/design-system/p-799705af3a.entry.js +0 -4
  920. package/dist/design-system/p-82RSSk25.js +0 -4
  921. package/dist/design-system/p-8e0872fef0.entry.js +0 -4
  922. package/dist/design-system/p-9617d56181.entry.js +0 -4
  923. package/dist/design-system/p-BaIoYrFa.js +0 -5
  924. package/dist/design-system/p-Cb75Rr6o.js +0 -4
  925. package/dist/design-system/p-CqZ6YSy9.js +0 -4
  926. package/dist/design-system/p-CqzM3doy.js +0 -4
  927. package/dist/design-system/p-CuwLeg-T.js +0 -5
  928. package/dist/design-system/p-DTPbL3uY.js +0 -4
  929. package/dist/design-system/p-aff68865ee.entry.js +0 -4
  930. package/dist/design-system/p-b3c6327744.entry.js +0 -4
  931. package/dist/design-system/p-be9023a38b.entry.js +0 -4
  932. package/dist/design-system/p-c031d1dce5.entry.js +0 -4
  933. package/dist/design-system/p-c3ae96e220.entry.js +0 -4
  934. package/dist/design-system/p-d430812a57.entry.js +0 -4
  935. package/dist/design-system/p-de1354f022.entry.js +0 -4
  936. package/dist/design-system/p-e3d0c82e2a.entry.js +0 -4
  937. package/dist/design-system/p-ea1a5e1f75.entry.js +0 -4
  938. package/dist/design-system/p-ea7169501c.entry.js +0 -4
  939. package/dist/design-system/p-eab397e041.entry.js +0 -4
  940. package/dist/design-system/p-ecba4deb9a.entry.js +0 -4
  941. package/dist/design-system/p-fe0dbd4b03.entry.js +0 -4
  942. package/dist/design-system/p-ng5ZzTOj.js +0 -4
  943. package/dist/esm/contact-Cb75Rr6o.js +0 -1636
  944. package/dist/esm/ds-content.entry.js +0 -152
  945. package/dist/esm/ds-divider.entry.js +0 -129
  946. package/dist/esm/ds-stack.entry.js +0 -222
  947. package/dist/esm/isEmpty-DmZYZqE9.js +0 -97
  948. package/dist/esm/stack.interfaces-ng5ZzTOj.js +0 -62
  949. package/dist/esm/svg-BaIoYrFa.js +0 -1480
  950. package/dist/esm/validate.decorator-82RSSk25.js +0 -110
  951. package/dist/types/global/constants/icons.constant.d.ts +0 -38
  952. package/dist/types/utils/element-states/element-states.decorator.d.ts +0 -3
  953. package/dist/types/utils/element-states/element-states.interfaces.d.ts +0 -10
  954. package/dist/types/utils/element-states/element-states.listener.d.ts +0 -15
  955. package/dist/types/utils/element-states/element-states.subject.d.ts +0 -8
  956. package/dist/types/utils/element-states/index.d.ts +0 -2
  957. package/dist/types/utils/keyboard/index.d.ts +0 -3
  958. package/dist/types/utils/keyboard/keyboard.decorator.d.ts +0 -3
  959. package/dist/types/utils/keyboard/keyboard.interfaces.d.ts +0 -8
  960. package/dist/types/utils/keyboard/keyboard.listener.d.ts +0 -9
  961. package/dist/types/utils/keyboard/keyboard.subject.d.ts +0 -8
  962. package/dist/types/utils/property-checkers/check-array-of.d.ts +0 -2
  963. package/dist/types/utils/property-checkers/check-date.d.ts +0 -1
  964. package/dist/types/utils/property-checkers/check-iso-date.d.ts +0 -1
  965. package/dist/types/utils/property-checkers/check-one-of.d.ts +0 -1
  966. package/dist/types/utils/property-checkers/check-pattern.d.ts +0 -1
  967. package/dist/types/utils/property-checkers/check-type.d.ts +0 -2
  968. package/dist/types/utils/property-checkers/check-url.d.ts +0 -1
  969. package/dist/types/utils/property-checkers/constants.d.ts +0 -1
  970. package/dist/types/utils/property-checkers/empty-or.d.ts +0 -1
  971. package/dist/types/utils/property-checkers/index.d.ts +0 -19
  972. package/dist/types/utils/property-checkers/required-and.d.ts +0 -1
  973. package/dist/types/utils/swipe/index.d.ts +0 -3
  974. package/dist/types/utils/swipe/swipe.decorator.d.ts +0 -5
  975. package/dist/types/utils/swipe/swipe.interfaces.d.ts +0 -10
  976. package/dist/types/utils/swipe/swipe.listener.d.ts +0 -10
  977. package/dist/types/utils/swipe/swipe.subject.d.ts +0 -11
  978. package/dist/types/utils/validate.decorator.d.ts +0 -114
  979. /package/dist/collection/{utils/element-states/element-states.interfaces.js → components/data/data-item.interfaces.js} +0 -0
  980. /package/dist/collection/{utils/keyboard/keyboard.interfaces.js → components/data/data-label.interfaces.js} +0 -0
  981. /package/dist/collection/{utils/property-checkers/property-types.js → components/data/data-value.interfaces.js} +0 -0
  982. /package/dist/collection/{utils/swipe/swipe.interfaces.js → components/data/data.interfaces.js} +0 -0
  983. /package/dist/collection/utils/{property-checkers/is-iso-date.js → is-iso-date.js} +0 -0
  984. /package/dist/collection/utils/{keyboard/keyboard.helpers.js → keyboard.js} +0 -0
  985. /package/dist/types/utils/{property-checkers/is-iso-date.d.ts → is-iso-date.d.ts} +0 -0
  986. /package/dist/types/utils/{property-checkers/is-value-empty.d.ts → is-value-empty.d.ts} +0 -0
  987. /package/dist/types/utils/{keyboard/keyboard.helpers.d.ts → keyboard.d.ts} +0 -0
  988. /package/dist/types/utils/{property-checkers/property-types.d.ts → property-types.d.ts} +0 -0
@@ -0,0 +1,2443 @@
1
+ /*!
2
+ * (C) Helvetia Design System https://design.baloise.dev/ - Apache License 2.0
3
+ */
4
+ 'use strict';
5
+
6
+ /*! @license DOMPurify 3.4.12 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.12/LICENSE */
7
+
8
+ function _arrayLikeToArray(r, a) {
9
+ (null == a || a > r.length) && (a = r.length);
10
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
11
+ return n;
12
+ }
13
+ function _arrayWithHoles(r) {
14
+ if (Array.isArray(r)) return r;
15
+ }
16
+ function _iterableToArrayLimit(r, l) {
17
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
18
+ if (null != t) {
19
+ var e,
20
+ n,
21
+ i,
22
+ u,
23
+ a = [],
24
+ f = true,
25
+ o = false;
26
+ try {
27
+ if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = true);
28
+ } catch (r) {
29
+ o = true, n = r;
30
+ } finally {
31
+ try {
32
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
33
+ } finally {
34
+ if (o) throw n;
35
+ }
36
+ }
37
+ return a;
38
+ }
39
+ }
40
+ function _nonIterableRest() {
41
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
42
+ }
43
+ function _slicedToArray(r, e) {
44
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
45
+ }
46
+ function _unsupportedIterableToArray(r, a) {
47
+ if (r) {
48
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
49
+ var t = {}.toString.call(r).slice(8, -1);
50
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
51
+ }
52
+ }
53
+
54
+ const entries = Object.entries,
55
+ setPrototypeOf = Object.setPrototypeOf,
56
+ isFrozen = Object.isFrozen,
57
+ getPrototypeOf = Object.getPrototypeOf,
58
+ getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
59
+ let freeze = Object.freeze,
60
+ seal = Object.seal,
61
+ create = Object.create; // eslint-disable-line import/no-mutable-exports
62
+ let _ref = typeof Reflect !== 'undefined' && Reflect,
63
+ apply = _ref.apply,
64
+ construct = _ref.construct;
65
+ if (!freeze) {
66
+ freeze = function freeze(x) {
67
+ return x;
68
+ };
69
+ }
70
+ if (!seal) {
71
+ seal = function seal(x) {
72
+ return x;
73
+ };
74
+ }
75
+ if (!apply) {
76
+ apply = function apply(func, thisArg) {
77
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
78
+ args[_key - 2] = arguments[_key];
79
+ }
80
+ return func.apply(thisArg, args);
81
+ };
82
+ }
83
+ if (!construct) {
84
+ construct = function construct(Func) {
85
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
86
+ args[_key2 - 1] = arguments[_key2];
87
+ }
88
+ return new Func(...args);
89
+ };
90
+ }
91
+ const arrayForEach = unapply(Array.prototype.forEach);
92
+ const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
93
+ const arrayPop = unapply(Array.prototype.pop);
94
+ const arrayPush = unapply(Array.prototype.push);
95
+ const arraySplice = unapply(Array.prototype.splice);
96
+ const arrayIsArray = Array.isArray;
97
+ const stringToLowerCase = unapply(String.prototype.toLowerCase);
98
+ const stringToString = unapply(String.prototype.toString);
99
+ const stringMatch = unapply(String.prototype.match);
100
+ const stringReplace = unapply(String.prototype.replace);
101
+ const stringIndexOf = unapply(String.prototype.indexOf);
102
+ const stringTrim = unapply(String.prototype.trim);
103
+ const numberToString = unapply(Number.prototype.toString);
104
+ const booleanToString = unapply(Boolean.prototype.toString);
105
+ const bigintToString = typeof BigInt === 'undefined' ? null : unapply(BigInt.prototype.toString);
106
+ const symbolToString = typeof Symbol === 'undefined' ? null : unapply(Symbol.prototype.toString);
107
+ const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
108
+ const objectToString = unapply(Object.prototype.toString);
109
+ const regExpTest = unapply(RegExp.prototype.test);
110
+ const typeErrorCreate = unconstruct(TypeError);
111
+ /**
112
+ * Creates a new function that calls the given function with a specified thisArg and arguments.
113
+ *
114
+ * @param func - The function to be wrapped and called.
115
+ * @returns A new function that calls the given function with a specified thisArg and arguments.
116
+ */
117
+ function unapply(func) {
118
+ return function (thisArg) {
119
+ if (thisArg instanceof RegExp) {
120
+ thisArg.lastIndex = 0;
121
+ }
122
+ for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
123
+ args[_key3 - 1] = arguments[_key3];
124
+ }
125
+ return apply(func, thisArg, args);
126
+ };
127
+ }
128
+ /**
129
+ * Creates a new function that constructs an instance of the given constructor function with the provided arguments.
130
+ *
131
+ * @param func - The constructor function to be wrapped and called.
132
+ * @returns A new function that constructs an instance of the given constructor function with the provided arguments.
133
+ */
134
+ function unconstruct(Func) {
135
+ return function () {
136
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
137
+ args[_key4] = arguments[_key4];
138
+ }
139
+ return construct(Func, args);
140
+ };
141
+ }
142
+ /**
143
+ * Add properties to a lookup table
144
+ *
145
+ * @param set - The set to which elements will be added.
146
+ * @param array - The array containing elements to be added to the set.
147
+ * @param transformCaseFunc - An optional function to transform the case of each element before adding to the set.
148
+ * @returns The modified set with added elements.
149
+ */
150
+ function addToSet(set, array) {
151
+ let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase;
152
+ if (setPrototypeOf) {
153
+ // Make 'in' and truthy checks like Boolean(set.constructor)
154
+ // independent of any properties defined on Object.prototype.
155
+ // Prevent prototype setters from intercepting set as a this value.
156
+ setPrototypeOf(set, null);
157
+ }
158
+ if (!arrayIsArray(array)) {
159
+ return set;
160
+ }
161
+ let l = array.length;
162
+ while (l--) {
163
+ let element = array[l];
164
+ if (typeof element === 'string') {
165
+ const lcElement = transformCaseFunc(element);
166
+ if (lcElement !== element) {
167
+ // Config presets (e.g. tags.js, attrs.js) are immutable.
168
+ if (!isFrozen(array)) {
169
+ array[l] = lcElement;
170
+ }
171
+ element = lcElement;
172
+ }
173
+ }
174
+ set[element] = true;
175
+ }
176
+ return set;
177
+ }
178
+ /**
179
+ * Clean up an array to harden against CSPP
180
+ *
181
+ * @param array - The array to be cleaned.
182
+ * @returns The cleaned version of the array
183
+ */
184
+ function cleanArray(array) {
185
+ for (let index = 0; index < array.length; index++) {
186
+ const isPropertyExist = objectHasOwnProperty(array, index);
187
+ if (!isPropertyExist) {
188
+ array[index] = null;
189
+ }
190
+ }
191
+ return array;
192
+ }
193
+ /**
194
+ * Shallow clone an object
195
+ *
196
+ * @param object - The object to be cloned.
197
+ * @returns A new object that copies the original.
198
+ */
199
+ function clone(object) {
200
+ const newObject = create(null);
201
+ for (const _ref2 of entries(object)) {
202
+ var _ref3 = _slicedToArray(_ref2, 2);
203
+ const property = _ref3[0];
204
+ const value = _ref3[1];
205
+ const isPropertyExist = objectHasOwnProperty(object, property);
206
+ if (isPropertyExist) {
207
+ if (arrayIsArray(value)) {
208
+ newObject[property] = cleanArray(value);
209
+ } else if (value && typeof value === 'object' && value.constructor === Object) {
210
+ newObject[property] = clone(value);
211
+ } else {
212
+ newObject[property] = value;
213
+ }
214
+ }
215
+ }
216
+ return newObject;
217
+ }
218
+ /**
219
+ * Convert non-node values into strings without depending on direct property access.
220
+ *
221
+ * @param value - The value to stringify.
222
+ * @returns A string representation of the provided value.
223
+ */
224
+ function stringifyValue(value) {
225
+ switch (typeof value) {
226
+ case 'string':
227
+ {
228
+ return value;
229
+ }
230
+ case 'number':
231
+ {
232
+ return numberToString(value);
233
+ }
234
+ case 'boolean':
235
+ {
236
+ return booleanToString(value);
237
+ }
238
+ case 'bigint':
239
+ {
240
+ return bigintToString ? bigintToString(value) : '0';
241
+ }
242
+ case 'symbol':
243
+ {
244
+ return symbolToString ? symbolToString(value) : 'Symbol()';
245
+ }
246
+ case 'undefined':
247
+ {
248
+ return objectToString(value);
249
+ }
250
+ case 'function':
251
+ case 'object':
252
+ {
253
+ if (value === null) {
254
+ return objectToString(value);
255
+ }
256
+ const valueAsRecord = value;
257
+ const valueToString = lookupGetter(valueAsRecord, 'toString');
258
+ if (typeof valueToString === 'function') {
259
+ const stringified = valueToString(valueAsRecord);
260
+ return typeof stringified === 'string' ? stringified : objectToString(stringified);
261
+ }
262
+ return objectToString(value);
263
+ }
264
+ default:
265
+ {
266
+ return objectToString(value);
267
+ }
268
+ }
269
+ }
270
+ /**
271
+ * This method automatically checks if the prop is function or getter and behaves accordingly.
272
+ *
273
+ * @param object - The object to look up the getter function in its prototype chain.
274
+ * @param prop - The property name for which to find the getter function.
275
+ * @returns The getter function found in the prototype chain or a fallback function.
276
+ */
277
+ function lookupGetter(object, prop) {
278
+ while (object !== null) {
279
+ const desc = getOwnPropertyDescriptor(object, prop);
280
+ if (desc) {
281
+ if (desc.get) {
282
+ return unapply(desc.get);
283
+ }
284
+ if (typeof desc.value === 'function') {
285
+ return unapply(desc.value);
286
+ }
287
+ }
288
+ object = getPrototypeOf(object);
289
+ }
290
+ function fallbackValue() {
291
+ return null;
292
+ }
293
+ return fallbackValue;
294
+ }
295
+ function isRegex(value) {
296
+ try {
297
+ regExpTest(value, '');
298
+ return true;
299
+ } catch (_unused) {
300
+ return false;
301
+ }
302
+ }
303
+
304
+ 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', 'search', 'section', 'select', 'shadow', 'slot', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
305
+ const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'enterkeyhint', 'exportparts', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'inputmode', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'part', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
306
+ 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']);
307
+ // List of SVG elements that are disallowed by default.
308
+ // We still need to know them so that we can do namespace
309
+ // checks properly in case one wants to add them to
310
+ // allow-list.
311
+ 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']);
312
+ 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']);
313
+ // Similarly to SVG, we want to know all MathML elements,
314
+ // even those that we disallow by default.
315
+ const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
316
+ const text = freeze(['#text']);
317
+
318
+ const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'command', 'commandfor', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'exportparts', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inert', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'part', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'slot', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns']);
319
+ 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', 'dominant-baseline', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'mask-type', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-orientation', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
320
+ const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnalign', 'columnlines', 'columnspacing', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lquote', 'lspace', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
321
+ const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
322
+
323
+ const MUSTACHE_EXPR = seal(/{{[\w\W]*|^[\w\W]*}}/g);
324
+ const ERB_EXPR = seal(/<%[\w\W]*|^[\w\W]*%>/g);
325
+ const TMPLIT_EXPR = seal(/\${[\w\W]*/g);
326
+ const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/); // eslint-disable-line no-useless-escape
327
+ const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
328
+ 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
329
+ );
330
+ const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
331
+ const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
332
+ );
333
+ const DOCTYPE_NAME = seal(/^html$/i);
334
+ const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
335
+ // Markup-significant character probes used by _sanitizeElements.
336
+ // Shared module-level instances are safe despite the sticky /g flags:
337
+ // unapply() resets lastIndex for RegExp receivers before every call.
338
+ const ELEMENT_MARKUP_PROBE = seal(/<[/\w!]/g);
339
+ const COMMENT_MARKUP_PROBE = seal(/<[/\w]/g);
340
+ const FALLBACK_TAG_CLOSE = seal(/<\/no(script|embed|frames)/i);
341
+ const SELF_CLOSING_TAG = seal(/\/>/i);
342
+
343
+ // https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
344
+ const NODE_TYPE = {
345
+ element: 1,
346
+ text: 3,
347
+ // Deprecated
348
+ processingInstruction: 7,
349
+ comment: 8,
350
+ document: 9,
351
+ documentFragment: 11};
352
+ const getGlobal = function getGlobal() {
353
+ return typeof window === 'undefined' ? null : window;
354
+ };
355
+ /**
356
+ * Creates a no-op policy for internal use only.
357
+ * Don't export this function outside this module!
358
+ * @param trustedTypes The policy factory.
359
+ * @param purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
360
+ * @return The policy created (or null, if Trusted Types
361
+ * are not supported or creating the policy failed).
362
+ */
363
+ const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
364
+ if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
365
+ return null;
366
+ }
367
+ // Allow the callers to control the unique policy name
368
+ // by adding a data-tt-policy-suffix to the script element with the DOMPurify.
369
+ // Policy creation with duplicate names throws in Trusted Types.
370
+ let suffix = null;
371
+ const ATTR_NAME = 'data-tt-policy-suffix';
372
+ if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
373
+ suffix = purifyHostElement.getAttribute(ATTR_NAME);
374
+ }
375
+ const policyName = 'dompurify' + (suffix ? '#' + suffix : '');
376
+ try {
377
+ return trustedTypes.createPolicy(policyName, {
378
+ createHTML(html) {
379
+ return html;
380
+ },
381
+ createScriptURL(scriptUrl) {
382
+ return scriptUrl;
383
+ }
384
+ });
385
+ } catch (_) {
386
+ // Policy creation failed (most likely another DOMPurify script has
387
+ // already run). Skip creating the policy, as this will only cause errors
388
+ // if TT are enforced.
389
+ console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
390
+ return null;
391
+ }
392
+ };
393
+ const _createHooksMap = function _createHooksMap() {
394
+ return {
395
+ afterSanitizeAttributes: [],
396
+ afterSanitizeElements: [],
397
+ afterSanitizeShadowDOM: [],
398
+ beforeSanitizeAttributes: [],
399
+ beforeSanitizeElements: [],
400
+ beforeSanitizeShadowDOM: [],
401
+ uponSanitizeAttribute: [],
402
+ uponSanitizeElement: [],
403
+ uponSanitizeShadowNode: []
404
+ };
405
+ };
406
+ /**
407
+ * Resolve a set-valued configuration option: a fresh set built from
408
+ * cfg[key] when it is an own array property (seeded with a clone of
409
+ * options.base when given, case-normalized via options.transform),
410
+ * the fallback set otherwise.
411
+ *
412
+ * @param cfg the cloned, prototype-free configuration object
413
+ * @param key the configuration property to read
414
+ * @param fallback the set to use when the option is absent or not an array
415
+ * @param options transform and optional base set to merge into
416
+ * @returns the resolved set
417
+ */
418
+ const _resolveSetOption = function _resolveSetOption(cfg, key, fallback, options) {
419
+ return objectHasOwnProperty(cfg, key) && arrayIsArray(cfg[key]) ? addToSet(options.base ? clone(options.base) : {}, cfg[key], options.transform) : fallback;
420
+ };
421
+ function createDOMPurify() {
422
+ let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
423
+ const DOMPurify = root => createDOMPurify(root);
424
+ DOMPurify.version = '3.4.12';
425
+ DOMPurify.removed = [];
426
+ if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
427
+ // Not running in a browser, provide a factory function
428
+ // so that you can pass your own Window
429
+ DOMPurify.isSupported = false;
430
+ return DOMPurify;
431
+ }
432
+ let document = window.document;
433
+ const originalDocument = document;
434
+ const currentScript = originalDocument.currentScript;
435
+ const HTMLTemplateElement = window.HTMLTemplateElement,
436
+ Node = window.Node,
437
+ Element = window.Element,
438
+ NodeFilter = window.NodeFilter;
439
+ const DOMParser = window.DOMParser,
440
+ trustedTypes = window.trustedTypes;
441
+ const ElementPrototype = Element.prototype;
442
+ const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
443
+ const remove = lookupGetter(ElementPrototype, 'remove');
444
+ const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
445
+ const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
446
+ const getParentNode = lookupGetter(ElementPrototype, 'parentNode');
447
+ const getShadowRoot = lookupGetter(ElementPrototype, 'shadowRoot');
448
+ const getAttributes = lookupGetter(ElementPrototype, 'attributes');
449
+ const getNodeType = Node && Node.prototype ? lookupGetter(Node.prototype, 'nodeType') : null;
450
+ const getNodeName = Node && Node.prototype ? lookupGetter(Node.prototype, 'nodeName') : null;
451
+ // As per issue #47, the web-components registry is inherited by a
452
+ // new document created via createHTMLDocument. As per the spec
453
+ // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
454
+ // a new empty registry is used when creating a template contents owner
455
+ // document, so we use that as our parent document to ensure nothing
456
+ // is inherited.
457
+ if (typeof HTMLTemplateElement === 'function') {
458
+ const template = document.createElement('template');
459
+ if (template.content && template.content.ownerDocument) {
460
+ document = template.content.ownerDocument;
461
+ }
462
+ }
463
+ let trustedTypesPolicy;
464
+ let emptyHTML = '';
465
+ // The instance's own internal Trusted Types policy. Unlike a caller-supplied
466
+ // `TRUSTED_TYPES_POLICY`, this is created at most once — Trusted Types throws
467
+ // on duplicate policy names — and is the only policy allowed to persist
468
+ // across configurations and survive `clearConfig()`.
469
+ let defaultTrustedTypesPolicy;
470
+ let defaultTrustedTypesPolicyResolved = false;
471
+ // Tracks whether we are already inside a call to the configured Trusted Types
472
+ // policy (`createHTML` or `createScriptURL`). If a supplied policy callback
473
+ // itself calls `DOMPurify.sanitize` (the cause of #1422), `sanitize` would
474
+ // re-enter the policy and recurse until the stack overflows. We detect that
475
+ // re-entry and throw a clear, actionable error instead. The guard is shared
476
+ // across both callbacks, because either one re-entering `sanitize` triggers
477
+ // the same unbounded recursion.
478
+ let IN_TRUSTED_TYPES_POLICY = 0;
479
+ const _assertNotInTrustedTypesPolicy = function _assertNotInTrustedTypesPolicy() {
480
+ if (IN_TRUSTED_TYPES_POLICY > 0) {
481
+ throw typeErrorCreate('A configured TRUSTED_TYPES_POLICY callback (createHTML or ' + 'createScriptURL) must not call DOMPurify.sanitize, as that causes ' + 'infinite recursion. Do not pass a policy whose callbacks wrap ' + 'DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted ' + 'Types" section of the README.');
482
+ }
483
+ };
484
+ const _createTrustedHTML = function _createTrustedHTML(html) {
485
+ _assertNotInTrustedTypesPolicy();
486
+ IN_TRUSTED_TYPES_POLICY++;
487
+ try {
488
+ return trustedTypesPolicy.createHTML(html);
489
+ } finally {
490
+ IN_TRUSTED_TYPES_POLICY--;
491
+ }
492
+ };
493
+ const _createTrustedScriptURL = function _createTrustedScriptURL(scriptUrl) {
494
+ _assertNotInTrustedTypesPolicy();
495
+ IN_TRUSTED_TYPES_POLICY++;
496
+ try {
497
+ return trustedTypesPolicy.createScriptURL(scriptUrl);
498
+ } finally {
499
+ IN_TRUSTED_TYPES_POLICY--;
500
+ }
501
+ };
502
+ // Lazily resolve (and cache) the instance's internal default policy.
503
+ // Resolution is attempted at most once: a successful `createPolicy` cannot be
504
+ // repeated (Trusted Types throws on duplicate names), and a failed or
505
+ // unsupported attempt must not be retried on every parse.
506
+ const _getDefaultTrustedTypesPolicy = function _getDefaultTrustedTypesPolicy() {
507
+ if (!defaultTrustedTypesPolicyResolved) {
508
+ defaultTrustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
509
+ defaultTrustedTypesPolicyResolved = true;
510
+ }
511
+ return defaultTrustedTypesPolicy;
512
+ };
513
+ const _document = document,
514
+ implementation = _document.implementation,
515
+ createNodeIterator = _document.createNodeIterator,
516
+ createDocumentFragment = _document.createDocumentFragment,
517
+ getElementsByTagName = _document.getElementsByTagName;
518
+ const importNode = originalDocument.importNode;
519
+ let hooks = _createHooksMap();
520
+ /**
521
+ * Expose whether this browser supports running the full DOMPurify.
522
+ */
523
+ DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;
524
+ const MUSTACHE_EXPR$1 = MUSTACHE_EXPR,
525
+ ERB_EXPR$1 = ERB_EXPR,
526
+ TMPLIT_EXPR$1 = TMPLIT_EXPR,
527
+ DATA_ATTR$1 = DATA_ATTR,
528
+ ARIA_ATTR$1 = ARIA_ATTR,
529
+ IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA,
530
+ ATTR_WHITESPACE$1 = ATTR_WHITESPACE,
531
+ CUSTOM_ELEMENT$1 = CUSTOM_ELEMENT;
532
+ let IS_ALLOWED_URI$1 = IS_ALLOWED_URI;
533
+ /**
534
+ * We consider the elements and attributes below to be safe. Ideally
535
+ * don't add any new ones but feel free to remove unwanted ones.
536
+ */
537
+ /* allowed element names */
538
+ let ALLOWED_TAGS = null;
539
+ const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
540
+ /* Allowed attribute names */
541
+ let ALLOWED_ATTR = null;
542
+ const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
543
+ /*
544
+ * Configure how DOMPurify should handle custom elements and their attributes as well as customized built-in elements.
545
+ * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
546
+ * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
547
+ * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
548
+ */
549
+ let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
550
+ tagNameCheck: {
551
+ writable: true,
552
+ configurable: false,
553
+ enumerable: true,
554
+ value: null
555
+ },
556
+ attributeNameCheck: {
557
+ writable: true,
558
+ configurable: false,
559
+ enumerable: true,
560
+ value: null
561
+ },
562
+ allowCustomizedBuiltInElements: {
563
+ writable: true,
564
+ configurable: false,
565
+ enumerable: true,
566
+ value: false
567
+ }
568
+ }));
569
+ /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
570
+ let FORBID_TAGS = null;
571
+ /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
572
+ let FORBID_ATTR = null;
573
+ /* Config object to store ADD_TAGS/ADD_ATTR functions (when used as functions) */
574
+ const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
575
+ tagCheck: {
576
+ writable: true,
577
+ configurable: false,
578
+ enumerable: true,
579
+ value: null
580
+ },
581
+ attributeCheck: {
582
+ writable: true,
583
+ configurable: false,
584
+ enumerable: true,
585
+ value: null
586
+ }
587
+ }));
588
+ /* Decide if ARIA attributes are okay */
589
+ let ALLOW_ARIA_ATTR = true;
590
+ /* Decide if custom data attributes are okay */
591
+ let ALLOW_DATA_ATTR = true;
592
+ /* Decide if unknown protocols are okay */
593
+ let ALLOW_UNKNOWN_PROTOCOLS = false;
594
+ /* Decide if self-closing tags in attributes are allowed.
595
+ * Usually removed due to a mXSS issue in jQuery 3.0 */
596
+ let ALLOW_SELF_CLOSE_IN_ATTR = true;
597
+ /* Output should be safe for common template engines.
598
+ * This means, DOMPurify removes data attributes, mustaches and ERB
599
+ */
600
+ let SAFE_FOR_TEMPLATES = false;
601
+ /* Output should be safe even for XML used within HTML and alike.
602
+ * This means, DOMPurify removes comments when containing risky content.
603
+ */
604
+ let SAFE_FOR_XML = true;
605
+ /* Decide if document with <html>... should be returned */
606
+ let WHOLE_DOCUMENT = false;
607
+ /* Track whether config is already set on this instance of DOMPurify. */
608
+ let SET_CONFIG = false;
609
+ /* Pristine allowlist bindings captured at setConfig() time. On the
610
+ * persistent-config path sanitize() restores the sets from these before
611
+ * the per-walk hook clone-guard, so a hook's in-call widening cannot
612
+ * carry across calls. Null until setConfig() is called; reset by
613
+ * clearConfig(). */
614
+ let SET_CONFIG_ALLOWED_TAGS = null;
615
+ let SET_CONFIG_ALLOWED_ATTR = null;
616
+ /* Decide if all elements (e.g. style, script) must be children of
617
+ * document.body. By default, browsers might move them to document.head */
618
+ let FORCE_BODY = false;
619
+ /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
620
+ * string (or a TrustedHTML object if Trusted Types are supported).
621
+ * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
622
+ */
623
+ let RETURN_DOM = false;
624
+ /* Decide if a DOM `DocumentFragment` should be returned, instead of a html
625
+ * string (or a TrustedHTML object if Trusted Types are supported) */
626
+ let RETURN_DOM_FRAGMENT = false;
627
+ /* Try to return a Trusted Type object instead of a string, return a string in
628
+ * case Trusted Types are not supported */
629
+ let RETURN_TRUSTED_TYPE = false;
630
+ /* Output should be free from DOM clobbering attacks?
631
+ * This sanitizes markups named with colliding, clobberable built-in DOM APIs.
632
+ */
633
+ let SANITIZE_DOM = true;
634
+ /* Achieve full DOM Clobbering protection by isolating the namespace of named
635
+ * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.
636
+ *
637
+ * HTML/DOM spec rules that enable DOM Clobbering:
638
+ * - Named Access on Window (§7.3.3)
639
+ * - DOM Tree Accessors (§3.1.5)
640
+ * - Form Element Parent-Child Relations (§4.10.3)
641
+ * - Iframe srcdoc / Nested WindowProxies (§4.8.5)
642
+ * - HTMLCollection (§4.2.10.2)
643
+ *
644
+ * Namespace isolation is implemented by prefixing `id` and `name` attributes
645
+ * with a constant string, i.e., `user-content-`
646
+ */
647
+ let SANITIZE_NAMED_PROPS = false;
648
+ const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
649
+ /* Keep element content when removing element? */
650
+ let KEEP_CONTENT = true;
651
+ /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
652
+ * of importing it into a new Document and returning a sanitized copy */
653
+ let IN_PLACE = false;
654
+ /* Allow usage of profiles like html, svg and mathMl */
655
+ let USE_PROFILES = {};
656
+ /* Tags to ignore content of when KEEP_CONTENT is true */
657
+ let FORBID_CONTENTS = null;
658
+ const DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script',
659
+ // <selectedcontent> mirrors the selected <option>'s subtree, cloned by
660
+ // the UA (customizable <select>) — including any on* handlers — and the
661
+ // engine re-mirrors synchronously whenever a removal changes which
662
+ // option/selectedcontent is current, even inside DOMPurify's inert
663
+ // DOMParser document. Hoisting its children on removal re-inserts a fresh
664
+ // mirror target ahead of the walk, which the engine refills, looping
665
+ // forever (DoS) and amplifying output. Dropping its content on removal
666
+ // (rather than hoisting) breaks that cascade; the content is a duplicate
667
+ // of the option, which is sanitized on its own. See campaign-3 F1/F6.
668
+ 'selectedcontent', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);
669
+ /* Tags that are safe for data: URIs */
670
+ let DATA_URI_TAGS = null;
671
+ const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
672
+ /* Attributes safe for values like "javascript:" */
673
+ let URI_SAFE_ATTRIBUTES = null;
674
+ const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
675
+ const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
676
+ const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
677
+ const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
678
+ /* Document namespace */
679
+ let NAMESPACE = HTML_NAMESPACE;
680
+ let IS_EMPTY_INPUT = false;
681
+ /* Allowed XHTML+XML namespaces */
682
+ let ALLOWED_NAMESPACES = null;
683
+ const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
684
+ const DEFAULT_MATHML_TEXT_INTEGRATION_POINTS = freeze(['mi', 'mo', 'mn', 'ms', 'mtext']);
685
+ let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS);
686
+ const DEFAULT_HTML_INTEGRATION_POINTS = freeze(['annotation-xml']);
687
+ let HTML_INTEGRATION_POINTS = addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS);
688
+ // Certain elements are allowed in both SVG and HTML
689
+ // namespace. We need to specify them explicitly
690
+ // so that they don't get erroneously deleted from
691
+ // HTML namespace.
692
+ const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
693
+ /* Parsing of strict XHTML documents */
694
+ let PARSER_MEDIA_TYPE = null;
695
+ const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
696
+ const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
697
+ let transformCaseFunc = null;
698
+ /* Keep a reference to config to pass to hooks */
699
+ let CONFIG = null;
700
+ /* Ideally, do not touch anything below this line */
701
+ /* ______________________________________________ */
702
+ const formElement = document.createElement('form');
703
+ const isRegexOrFunction = function isRegexOrFunction(testValue) {
704
+ return testValue instanceof RegExp || testValue instanceof Function;
705
+ };
706
+ /**
707
+ * _parseConfig
708
+ *
709
+ * @param cfg optional config literal
710
+ */
711
+ // eslint-disable-next-line complexity
712
+ const _parseConfig = function _parseConfig() {
713
+ let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
714
+ if (CONFIG && CONFIG === cfg) {
715
+ return;
716
+ }
717
+ /* Shield configuration object from tampering */
718
+ if (!cfg || typeof cfg !== 'object') {
719
+ cfg = {};
720
+ }
721
+ /* Shield configuration object from prototype pollution */
722
+ cfg = clone(cfg);
723
+ PARSER_MEDIA_TYPE =
724
+ // eslint-disable-next-line unicorn/prefer-includes
725
+ SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
726
+ // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
727
+ transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
728
+ /* Set configuration parameters */
729
+ ALLOWED_TAGS = _resolveSetOption(cfg, 'ALLOWED_TAGS', DEFAULT_ALLOWED_TAGS, {
730
+ transform: transformCaseFunc
731
+ });
732
+ ALLOWED_ATTR = _resolveSetOption(cfg, 'ALLOWED_ATTR', DEFAULT_ALLOWED_ATTR, {
733
+ transform: transformCaseFunc
734
+ });
735
+ ALLOWED_NAMESPACES = _resolveSetOption(cfg, 'ALLOWED_NAMESPACES', DEFAULT_ALLOWED_NAMESPACES, {
736
+ transform: stringToString
737
+ });
738
+ URI_SAFE_ATTRIBUTES = _resolveSetOption(cfg, 'ADD_URI_SAFE_ATTR', DEFAULT_URI_SAFE_ATTRIBUTES, {
739
+ transform: transformCaseFunc,
740
+ base: DEFAULT_URI_SAFE_ATTRIBUTES
741
+ });
742
+ DATA_URI_TAGS = _resolveSetOption(cfg, 'ADD_DATA_URI_TAGS', DEFAULT_DATA_URI_TAGS, {
743
+ transform: transformCaseFunc,
744
+ base: DEFAULT_DATA_URI_TAGS
745
+ });
746
+ FORBID_CONTENTS = _resolveSetOption(cfg, 'FORBID_CONTENTS', DEFAULT_FORBID_CONTENTS, {
747
+ transform: transformCaseFunc
748
+ });
749
+ FORBID_TAGS = _resolveSetOption(cfg, 'FORBID_TAGS', clone({}), {
750
+ transform: transformCaseFunc
751
+ });
752
+ FORBID_ATTR = _resolveSetOption(cfg, 'FORBID_ATTR', clone({}), {
753
+ transform: transformCaseFunc
754
+ });
755
+ USE_PROFILES = objectHasOwnProperty(cfg, 'USE_PROFILES') ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === 'object' ? clone(cfg.USE_PROFILES) : cfg.USE_PROFILES : false;
756
+ ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
757
+ ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
758
+ ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
759
+ ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true
760
+ SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
761
+ SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false; // Default true
762
+ WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
763
+ RETURN_DOM = cfg.RETURN_DOM || false; // Default false
764
+ RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
765
+ RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false
766
+ FORCE_BODY = cfg.FORCE_BODY || false; // Default false
767
+ SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
768
+ SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false
769
+ KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
770
+ IN_PLACE = cfg.IN_PLACE || false; // Default false
771
+ IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI; // Default regexp
772
+ NAMESPACE = typeof cfg.NAMESPACE === 'string' ? cfg.NAMESPACE : HTML_NAMESPACE; // Default HTML namespace
773
+ MATHML_TEXT_INTEGRATION_POINTS = objectHasOwnProperty(cfg, 'MATHML_TEXT_INTEGRATION_POINTS') && cfg.MATHML_TEXT_INTEGRATION_POINTS && typeof cfg.MATHML_TEXT_INTEGRATION_POINTS === 'object' ? clone(cfg.MATHML_TEXT_INTEGRATION_POINTS) : addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS); // Default built-in map
774
+ HTML_INTEGRATION_POINTS = objectHasOwnProperty(cfg, 'HTML_INTEGRATION_POINTS') && cfg.HTML_INTEGRATION_POINTS && typeof cfg.HTML_INTEGRATION_POINTS === 'object' ? clone(cfg.HTML_INTEGRATION_POINTS) : addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS); // Default built-in map
775
+ const customElementHandling = objectHasOwnProperty(cfg, 'CUSTOM_ELEMENT_HANDLING') && cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING === 'object' ? clone(cfg.CUSTOM_ELEMENT_HANDLING) : create(null);
776
+ CUSTOM_ELEMENT_HANDLING = create(null);
777
+ if (objectHasOwnProperty(customElementHandling, 'tagNameCheck') && isRegexOrFunction(customElementHandling.tagNameCheck)) {
778
+ CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck; // Default undefined
779
+ }
780
+ if (objectHasOwnProperty(customElementHandling, 'attributeNameCheck') && isRegexOrFunction(customElementHandling.attributeNameCheck)) {
781
+ CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck; // Default undefined
782
+ }
783
+ if (objectHasOwnProperty(customElementHandling, 'allowCustomizedBuiltInElements') && typeof customElementHandling.allowCustomizedBuiltInElements === 'boolean') {
784
+ CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements; // Default undefined
785
+ }
786
+ seal(CUSTOM_ELEMENT_HANDLING);
787
+ if (SAFE_FOR_TEMPLATES) {
788
+ ALLOW_DATA_ATTR = false;
789
+ }
790
+ if (RETURN_DOM_FRAGMENT) {
791
+ RETURN_DOM = true;
792
+ }
793
+ /* Parse profile info */
794
+ if (USE_PROFILES) {
795
+ ALLOWED_TAGS = addToSet({}, text);
796
+ ALLOWED_ATTR = create(null);
797
+ if (USE_PROFILES.html === true) {
798
+ addToSet(ALLOWED_TAGS, html$1);
799
+ addToSet(ALLOWED_ATTR, html);
800
+ }
801
+ if (USE_PROFILES.svg === true) {
802
+ addToSet(ALLOWED_TAGS, svg$1);
803
+ addToSet(ALLOWED_ATTR, svg);
804
+ addToSet(ALLOWED_ATTR, xml);
805
+ }
806
+ if (USE_PROFILES.svgFilters === true) {
807
+ addToSet(ALLOWED_TAGS, svgFilters);
808
+ addToSet(ALLOWED_ATTR, svg);
809
+ addToSet(ALLOWED_ATTR, xml);
810
+ }
811
+ if (USE_PROFILES.mathMl === true) {
812
+ addToSet(ALLOWED_TAGS, mathMl$1);
813
+ addToSet(ALLOWED_ATTR, mathMl);
814
+ addToSet(ALLOWED_ATTR, xml);
815
+ }
816
+ }
817
+ /* Always reset function-based ADD_TAGS / ADD_ATTR checks to prevent
818
+ * leaking across calls when switching from function to array config */
819
+ EXTRA_ELEMENT_HANDLING.tagCheck = null;
820
+ EXTRA_ELEMENT_HANDLING.attributeCheck = null;
821
+ /* Merge configuration parameters */
822
+ if (objectHasOwnProperty(cfg, 'ADD_TAGS')) {
823
+ if (typeof cfg.ADD_TAGS === 'function') {
824
+ EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
825
+ } else if (arrayIsArray(cfg.ADD_TAGS)) {
826
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
827
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
828
+ }
829
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
830
+ }
831
+ }
832
+ if (objectHasOwnProperty(cfg, 'ADD_ATTR')) {
833
+ if (typeof cfg.ADD_ATTR === 'function') {
834
+ EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
835
+ } else if (arrayIsArray(cfg.ADD_ATTR)) {
836
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
837
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
838
+ }
839
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
840
+ }
841
+ }
842
+ if (objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') && arrayIsArray(cfg.ADD_URI_SAFE_ATTR)) {
843
+ addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
844
+ }
845
+ if (objectHasOwnProperty(cfg, 'FORBID_CONTENTS') && arrayIsArray(cfg.FORBID_CONTENTS)) {
846
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
847
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
848
+ }
849
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
850
+ }
851
+ if (objectHasOwnProperty(cfg, 'ADD_FORBID_CONTENTS') && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) {
852
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
853
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
854
+ }
855
+ addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
856
+ }
857
+ /* Add #text in case KEEP_CONTENT is set to true */
858
+ if (KEEP_CONTENT) {
859
+ ALLOWED_TAGS['#text'] = true;
860
+ }
861
+ /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
862
+ if (WHOLE_DOCUMENT) {
863
+ addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
864
+ }
865
+ /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
866
+ if (ALLOWED_TAGS.table) {
867
+ addToSet(ALLOWED_TAGS, ['tbody']);
868
+ delete FORBID_TAGS.tbody;
869
+ }
870
+ // Re-derive the active Trusted Types policy from this configuration on
871
+ // every parse. The active policy must never be sticky closure state that
872
+ // outlives the config that set it: a caller-supplied policy left in place
873
+ // after `clearConfig()` — or after a later call that supplied none, or
874
+ // `TRUSTED_TYPES_POLICY: null` — could sign a subsequent "default"
875
+ // `RETURN_TRUSTED_TYPE` result with a foreign, possibly unsafe policy.
876
+ // See GHSA-vxr8-fq34-vvx9.
877
+ if (cfg.TRUSTED_TYPES_POLICY) {
878
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {
879
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
880
+ }
881
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {
882
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
883
+ }
884
+ // A caller-supplied policy applies to this configuration only.
885
+ const previousTrustedTypesPolicy = trustedTypesPolicy;
886
+ trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
887
+ // Sign local variables required by `sanitize`. If the supplied policy's
888
+ // `createHTML` is circular (i.e. it calls `DOMPurify.sanitize`), this
889
+ // throws via the re-entrancy guard. Restore the previous policy first so
890
+ // the instance is not left in a poisoned state. See #1422.
891
+ try {
892
+ emptyHTML = _createTrustedHTML('');
893
+ } catch (error) {
894
+ trustedTypesPolicy = previousTrustedTypesPolicy;
895
+ throw error;
896
+ }
897
+ } else if (cfg.TRUSTED_TYPES_POLICY === null) {
898
+ // Explicit opt-out for this call: perform no Trusted Types signing and
899
+ // create nothing (so a strict `trusted-types` CSP that disallows a
900
+ // `dompurify` policy can still call `sanitize` from inside its own
901
+ // policy — see #1422). Resetting to `undefined` rather than a sticky
902
+ // `null` also drops any previously retained caller policy, so it cannot
903
+ // resurface on a later call, while still allowing the next config-less
904
+ // call to restore the internal default policy. See GHSA-vxr8-fq34-vvx9.
905
+ trustedTypesPolicy = undefined;
906
+ emptyHTML = '';
907
+ } else {
908
+ // No policy supplied: keep the currently active policy if one is set — a
909
+ // previously supplied policy is intentionally sticky across config-less
910
+ // calls — otherwise fall back to the instance's own internal policy,
911
+ // created at most once. (A policy supplied for a *single* call still
912
+ // lingers by design; what must not linger is a policy whose configuration
913
+ // has been torn down via `clearConfig()`, which restores the default.)
914
+ if (trustedTypesPolicy === undefined) {
915
+ trustedTypesPolicy = _getDefaultTrustedTypesPolicy();
916
+ }
917
+ // Sign internal variables only when a policy is active. A falsy policy
918
+ // (Trusted Types unsupported, creation failed, or an explicit opt-out)
919
+ // leaves `emptyHTML` as a plain string, so we never call `.createHTML` on
920
+ // a non-policy and throw. See #1422.
921
+ if (trustedTypesPolicy && typeof emptyHTML === 'string') {
922
+ emptyHTML = _createTrustedHTML('');
923
+ }
924
+ }
925
+ // Prevent further manipulation of configuration.
926
+ // Not available in IE8, Safari 5, etc.
927
+ if (freeze) {
928
+ freeze(cfg);
929
+ }
930
+ CONFIG = cfg;
931
+ };
932
+ /* Keep track of all possible SVG and MathML tags
933
+ * so that we can perform the namespace checks
934
+ * correctly. */
935
+ const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
936
+ const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
937
+ /**
938
+ * Namespace rules for an element in the SVG namespace.
939
+ *
940
+ * @param tagName the element's lowercase tag name
941
+ * @param parent the (possibly simulated) parent node
942
+ * @param parentTagName the parent's lowercase tag name
943
+ * @returns true if a spec-compliant parser could produce this element
944
+ */
945
+ const _checkSvgNamespace = function _checkSvgNamespace(tagName, parent, parentTagName) {
946
+ // The only way to switch from HTML namespace to SVG
947
+ // is via <svg>. If it happens via any other tag, then
948
+ // it should be killed.
949
+ if (parent.namespaceURI === HTML_NAMESPACE) {
950
+ return tagName === 'svg';
951
+ }
952
+ // The only way to switch from MathML to SVG is via <svg>
953
+ // if the parent is either <annotation-xml> or a MathML
954
+ // text integration point.
955
+ if (parent.namespaceURI === MATHML_NAMESPACE) {
956
+ return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
957
+ }
958
+ // We only allow elements that are defined in SVG
959
+ // spec. All others are disallowed in SVG namespace.
960
+ return Boolean(ALL_SVG_TAGS[tagName]);
961
+ };
962
+ /**
963
+ * Namespace rules for an element in the MathML namespace.
964
+ *
965
+ * @param tagName the element's lowercase tag name
966
+ * @param parent the (possibly simulated) parent node
967
+ * @param parentTagName the parent's lowercase tag name
968
+ * @returns true if a spec-compliant parser could produce this element
969
+ */
970
+ const _checkMathMlNamespace = function _checkMathMlNamespace(tagName, parent, parentTagName) {
971
+ // The only way to switch from HTML namespace to MathML
972
+ // is via <math>. If it happens via any other tag, then
973
+ // it should be killed.
974
+ if (parent.namespaceURI === HTML_NAMESPACE) {
975
+ return tagName === 'math';
976
+ }
977
+ // The only way to switch from SVG to MathML is via
978
+ // <math> and HTML integration points
979
+ if (parent.namespaceURI === SVG_NAMESPACE) {
980
+ return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
981
+ }
982
+ // We only allow elements that are defined in MathML
983
+ // spec. All others are disallowed in MathML namespace.
984
+ return Boolean(ALL_MATHML_TAGS[tagName]);
985
+ };
986
+ /**
987
+ * Namespace rules for an element in the HTML namespace.
988
+ *
989
+ * @param tagName the element's lowercase tag name
990
+ * @param parent the (possibly simulated) parent node
991
+ * @param parentTagName the parent's lowercase tag name
992
+ * @returns true if a spec-compliant parser could produce this element
993
+ */
994
+ const _checkHtmlNamespace = function _checkHtmlNamespace(tagName, parent, parentTagName) {
995
+ // The only way to switch from SVG to HTML is via
996
+ // HTML integration points, and from MathML to HTML
997
+ // is via MathML text integration points
998
+ if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
999
+ return false;
1000
+ }
1001
+ if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
1002
+ return false;
1003
+ }
1004
+ // We disallow tags that are specific for MathML
1005
+ // or SVG and should never appear in HTML namespace
1006
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
1007
+ };
1008
+ /**
1009
+ * @param element a DOM element whose namespace is being checked
1010
+ * @returns Return false if the element has a
1011
+ * namespace that a spec-compliant parser would never
1012
+ * return. Return true otherwise.
1013
+ */
1014
+ const _checkValidNamespace = function _checkValidNamespace(element) {
1015
+ let parent = getParentNode(element);
1016
+ // In JSDOM, if we're inside shadow DOM, then parentNode
1017
+ // can be null. We just simulate parent in this case.
1018
+ if (!parent || !parent.tagName) {
1019
+ parent = {
1020
+ namespaceURI: NAMESPACE,
1021
+ tagName: 'template'
1022
+ };
1023
+ }
1024
+ const tagName = stringToLowerCase(element.tagName);
1025
+ const parentTagName = stringToLowerCase(parent.tagName);
1026
+ if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
1027
+ return false;
1028
+ }
1029
+ if (element.namespaceURI === SVG_NAMESPACE) {
1030
+ return _checkSvgNamespace(tagName, parent, parentTagName);
1031
+ }
1032
+ if (element.namespaceURI === MATHML_NAMESPACE) {
1033
+ return _checkMathMlNamespace(tagName, parent, parentTagName);
1034
+ }
1035
+ if (element.namespaceURI === HTML_NAMESPACE) {
1036
+ return _checkHtmlNamespace(tagName, parent, parentTagName);
1037
+ }
1038
+ // For XHTML and XML documents that support custom namespaces
1039
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {
1040
+ return true;
1041
+ }
1042
+ // The code should never reach this place (this means
1043
+ // that the element somehow got namespace that is not
1044
+ // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).
1045
+ // Return false just in case.
1046
+ return false;
1047
+ };
1048
+ /**
1049
+ * _forceRemove
1050
+ *
1051
+ * @param node a DOM node
1052
+ */
1053
+ const _forceRemove = function _forceRemove(node) {
1054
+ arrayPush(DOMPurify.removed, {
1055
+ element: node
1056
+ });
1057
+ try {
1058
+ // eslint-disable-next-line unicorn/prefer-dom-node-remove
1059
+ getParentNode(node).removeChild(node);
1060
+ } catch (_) {
1061
+ /* The normal detach failed — this is reached for a parentless node
1062
+ (getParentNode() is null, so .removeChild throws). Element.prototype
1063
+ .remove() is itself a spec no-op on a parentless node, so a recorded
1064
+ "removal" would otherwise hand the caller back an intact,
1065
+ payload-bearing node (e.g. a detached IN_PLACE root the mXSS canary or
1066
+ the style-with-element-child rule decided to kill). Fail closed by
1067
+ throwing — exactly as a clobbered root does at the IN_PLACE entry —
1068
+ rather than trying to "neutralize" the node via its own methods.
1069
+ Neutralizing would mean calling getAttributeNames()/removeAttribute()
1070
+ on the node, both of which a <form> root can clobber via a named child
1071
+ (and _isClobbered does not even probe getAttributeNames), so the
1072
+ neutralize step could itself be silently defeated, leaving the payload
1073
+ intact. A throw touches only the cached, clobber-safe remove() and
1074
+ getParentNode(). Generalizes GHSA-r47g-fvhr-h676 (clobbered-form root)
1075
+ to every root-kill reason. REPORT-3.
1076
+ This lives inside the catch, so it never fires for a normally-removed
1077
+ in-tree node: those have a parent, removeChild() succeeds, and the
1078
+ catch is not entered. Only a kept (parentless) root reaches here. */
1079
+ remove(node);
1080
+ if (!getParentNode(node)) {
1081
+ throw typeErrorCreate('a node selected for removal could not be detached from its tree ' + 'and cannot be safely returned; refusing to sanitize in place');
1082
+ }
1083
+ }
1084
+ };
1085
+ /**
1086
+ * _neutralizeRoot
1087
+ *
1088
+ * Fail-closed teardown of an in-place root after the sanitize walk aborts
1089
+ * (campaign-3 F2). An internal throw mid-walk — e.g. a page-registered
1090
+ * custom element's reaction detaches a node so `_forceRemove`'s deliberate
1091
+ * parentless guard throws, or any other re-entrant engine mutation — would
1092
+ * otherwise leave the caller's *live* tree half-sanitized, with everything
1093
+ * after the abort point still carrying its handlers. There is no safe way
1094
+ * to resume the walk (the tree mutated under us), so we strip the root bare:
1095
+ * remove every child and every attribute, then let the caller's catch see
1096
+ * the original error. Clobber-safe (cached `remove`/`childNodes`/`attributes`
1097
+ * getters; the root was already clobber-pre-flighted at the IN_PLACE entry).
1098
+ *
1099
+ * @param root the in-place root to empty
1100
+ */
1101
+ const _neutralizeRoot = function _neutralizeRoot(root) {
1102
+ /* Strip every disallowed attribute (on* handlers included) off the whole
1103
+ subtree BEFORE detaching anything. Detaching first would hand back
1104
+ handler-bearing originals (e.g. an already-loading `<img onerror>`)
1105
+ whose queued resource event still fires in page scope after we throw.
1106
+ Clobber-safe reads; a doomed clobbered node's own attributes are
1107
+ irrelevant while its non-clobbered descendants are reached and scrubbed. */
1108
+ _neutralizeSubtree(root);
1109
+ const childNodes = getChildNodes(root);
1110
+ if (childNodes) {
1111
+ const snapshot = [];
1112
+ arrayForEach(childNodes, child => {
1113
+ arrayPush(snapshot, child);
1114
+ });
1115
+ arrayForEach(snapshot, child => {
1116
+ try {
1117
+ remove(child);
1118
+ } catch (_) {
1119
+ /* Best-effort teardown; a still-attached child is handled below */
1120
+ }
1121
+ });
1122
+ }
1123
+ const attributes = getAttributes(root);
1124
+ if (attributes) {
1125
+ for (let i = attributes.length - 1; i >= 0; --i) {
1126
+ const attribute = attributes[i];
1127
+ const name = attribute && attribute.name;
1128
+ if (typeof name === 'string') {
1129
+ try {
1130
+ root.removeAttribute(name);
1131
+ } catch (_) {
1132
+ /* Clobbered removeAttribute — ignore (fail-closed best effort) */
1133
+ }
1134
+ }
1135
+ }
1136
+ }
1137
+ };
1138
+ /**
1139
+ * _removeAttribute
1140
+ *
1141
+ * @param name an Attribute name
1142
+ * @param element a DOM node
1143
+ */
1144
+ const _removeAttribute = function _removeAttribute(name, element) {
1145
+ try {
1146
+ arrayPush(DOMPurify.removed, {
1147
+ attribute: element.getAttributeNode(name),
1148
+ from: element
1149
+ });
1150
+ } catch (_) {
1151
+ arrayPush(DOMPurify.removed, {
1152
+ attribute: null,
1153
+ from: element
1154
+ });
1155
+ }
1156
+ element.removeAttribute(name);
1157
+ // We void attribute values for unremovable "is" attributes
1158
+ if (name === 'is') {
1159
+ if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
1160
+ try {
1161
+ _forceRemove(element);
1162
+ } catch (_) {}
1163
+ } else {
1164
+ try {
1165
+ element.setAttribute(name, '');
1166
+ } catch (_) {}
1167
+ }
1168
+ }
1169
+ };
1170
+ /**
1171
+ * _stripDisallowedAttributes
1172
+ *
1173
+ * Removes every attribute the active configuration does not allow from a
1174
+ * single element, using the same allowlist as the main attribute pass (so
1175
+ * `on*` handlers go, but no `/^on/` blocklist is introduced). Used only to
1176
+ * neutralise nodes that are being discarded from an in-place tree.
1177
+ *
1178
+ * @param element the element to strip
1179
+ */
1180
+ const _stripDisallowedAttributes = function _stripDisallowedAttributes(element) {
1181
+ const attributes = getAttributes(element);
1182
+ if (!attributes) {
1183
+ return;
1184
+ }
1185
+ for (let i = attributes.length - 1; i >= 0; --i) {
1186
+ const attribute = attributes[i];
1187
+ const name = attribute && attribute.name;
1188
+ if (typeof name !== 'string' || ALLOWED_ATTR[transformCaseFunc(name)]) {
1189
+ continue;
1190
+ }
1191
+ try {
1192
+ element.removeAttribute(name);
1193
+ } catch (_) {
1194
+ /* Clobbered removeAttribute on a doomed node — ignore */
1195
+ }
1196
+ }
1197
+ };
1198
+ /**
1199
+ * _neutralizeSubtree
1200
+ *
1201
+ * Completes the audit-5 F1 fix across every removal path. The KEEP_CONTENT
1202
+ * move-hoist neutralises only disallowed-tag removals; clobber, mXSS-canary,
1203
+ * namespace, comment, processing-instruction and KEEP_CONTENT:false removals
1204
+ * all drop their subtree wholesale via `_forceRemove`. On the IN_PLACE path
1205
+ * those dropped nodes are detached from the caller's LIVE tree but a
1206
+ * handler-bearing original among them (an `<img onerror>`/`<video>` that was
1207
+ * loading) keeps its queued resource event, which fires in page scope after
1208
+ * sanitize returns. This walks a removed subtree and strips every attribute
1209
+ * the active configuration does not allow — so `on*` handlers are cancelled
1210
+ * through the SAME allowlist that governs kept nodes, not a separate `/^on/`
1211
+ * blocklist. Run synchronously before sanitize returns, i.e. before any
1212
+ * queued event can fire. Hook-free by design: these nodes leave the output,
1213
+ * so firing attribute hooks for them would be surprising. Clobber-safe reads;
1214
+ * a doomed clobbered node may shadow `removeAttribute` (its own attributes are
1215
+ * irrelevant — it is discarded — while its non-clobbered descendants, e.g.
1216
+ * the `<img>`, are reached and scrubbed).
1217
+ *
1218
+ * @param root the root of a removed subtree to neutralise
1219
+ */
1220
+ const _neutralizeSubtree = function _neutralizeSubtree(root) {
1221
+ const stack = [root];
1222
+ while (stack.length > 0) {
1223
+ const node = stack.pop();
1224
+ const nodeType = getNodeType ? getNodeType(node) : node.nodeType;
1225
+ if (nodeType === NODE_TYPE.element) {
1226
+ _stripDisallowedAttributes(node);
1227
+ }
1228
+ const childNodes = getChildNodes(node);
1229
+ if (childNodes) {
1230
+ for (let i = childNodes.length - 1; i >= 0; --i) {
1231
+ stack.push(childNodes[i]);
1232
+ }
1233
+ }
1234
+ }
1235
+ };
1236
+ /**
1237
+ * _neutralizePatchLinkage
1238
+ *
1239
+ * IN_PLACE entry pre-pass (declarative-partial-updates / streaming
1240
+ * hardening, https://github.com/WICG/declarative-partial-updates).
1241
+ *
1242
+ * The main walk strips patch linkage (`for`/`patchsrc`) and removes range
1243
+ * markers (PIs / markup comments) node-by-node, in document order, AS it
1244
+ * reaches each node. On a live in-place root that leaves a window: from the
1245
+ * moment the root is connected until the walk arrives at a given node, that
1246
+ * node's linkage is live. A patch applied on connection/stream can fire as
1247
+ * a microtask during the walk and inject or teleport an unsanitized DOM
1248
+ * range into a region the iterator has already passed and will not revisit,
1249
+ * so the post-return "tree is sanitized" contract is violated. Sweep the
1250
+ * whole tree once up front and sever every linkage before the walk begins,
1251
+ * closing that window.
1252
+ *
1253
+ * This CANNOT undo a patch that already fired before sanitize ran — that is
1254
+ * the irreducible "do not IN_PLACE a live-connected attacker tree" caveat —
1255
+ * but it closes everything from sanitize-start onward. Gated on SAFE_FOR_XML
1256
+ * to group with the rest of the declarative-partial-updates handling and
1257
+ * stay overridable, consistent with the codebase.
1258
+ *
1259
+ * Clobber-safe traversal (cached childNodes getter); per-node try/catch so a
1260
+ * clobbered root cannot defeat the sweep of its non-clobbered descendants.
1261
+ *
1262
+ * NOTE (pending real-Chrome confirmation, see test/declarative-patch-probe
1263
+ * .html Q1): this mirrors the existing policy of keeping `for` on
1264
+ * <label>/<output>. If the shipping feature can drive a patch through a
1265
+ * surviving `for`-on-label/output + `id` pair, this pre-pass and the
1266
+ * attribute check at _isBasicCustomElement's caller must additionally drop
1267
+ * that pair on the IN_PLACE path. Left as-is until the taxonomy is verified.
1268
+ *
1269
+ * @param root the in-place root to sweep
1270
+ */
1271
+ const _neutralizePatchLinkage = function _neutralizePatchLinkage(root) {
1272
+ if (!SAFE_FOR_XML) {
1273
+ return;
1274
+ }
1275
+ const stack = [root];
1276
+ while (stack.length > 0) {
1277
+ const node = stack.pop();
1278
+ const nodeType = getNodeType ? getNodeType(node) : node.nodeType;
1279
+ /* Remove range markers (the target side of a patch linkage): every
1280
+ processing instruction, and any markup-bearing comment. */
1281
+ if (nodeType === NODE_TYPE.processingInstruction || nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, node.data)) {
1282
+ try {
1283
+ remove(node);
1284
+ } catch (_) {
1285
+ /* Best-effort */
1286
+ }
1287
+ continue;
1288
+ }
1289
+ /* Strip patch-source attributes (the source side) off elements. */
1290
+ if (nodeType === NODE_TYPE.element) {
1291
+ const element = node;
1292
+ const lcTag = transformCaseFunc(getNodeName ? getNodeName(node) : node.nodeName);
1293
+ try {
1294
+ if (element.hasAttribute && element.hasAttribute('patchsrc')) {
1295
+ element.removeAttribute('patchsrc');
1296
+ }
1297
+ if (element.hasAttribute && element.hasAttribute('for') && lcTag !== 'label' && lcTag !== 'output') {
1298
+ element.removeAttribute('for');
1299
+ }
1300
+ } catch (_) {
1301
+ /* Clobbered removeAttribute/hasAttribute on a doomed node — ignore */
1302
+ }
1303
+ }
1304
+ const childNodes = getChildNodes(node);
1305
+ if (childNodes) {
1306
+ for (let i = childNodes.length - 1; i >= 0; --i) {
1307
+ stack.push(childNodes[i]);
1308
+ }
1309
+ }
1310
+ }
1311
+ };
1312
+ /**
1313
+ * _initDocument
1314
+ *
1315
+ * @param dirty - a string of dirty markup
1316
+ * @return a DOM, filled with the dirty markup
1317
+ */
1318
+ const _initDocument = function _initDocument(dirty) {
1319
+ /* Create a HTML document */
1320
+ let doc = null;
1321
+ let leadingWhitespace = null;
1322
+ if (FORCE_BODY) {
1323
+ dirty = '<remove></remove>' + dirty;
1324
+ } else {
1325
+ /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
1326
+ const matches = stringMatch(dirty, /^[\r\n\t ]+/);
1327
+ leadingWhitespace = matches && matches[0];
1328
+ }
1329
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {
1330
+ // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
1331
+ dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
1332
+ }
1333
+ const dirtyPayload = trustedTypesPolicy ? _createTrustedHTML(dirty) : dirty;
1334
+ /*
1335
+ * Use the DOMParser API by default, fallback later if needs be
1336
+ * DOMParser not work for svg when has multiple root element.
1337
+ */
1338
+ if (NAMESPACE === HTML_NAMESPACE) {
1339
+ try {
1340
+ doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
1341
+ } catch (_) {}
1342
+ }
1343
+ /* Use createHTMLDocument in case DOMParser is not available */
1344
+ if (!doc || !doc.documentElement) {
1345
+ doc = implementation.createDocument(NAMESPACE, 'template', null);
1346
+ try {
1347
+ doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
1348
+ } catch (_) {
1349
+ // Syntax error if dirtyPayload is invalid xml
1350
+ }
1351
+ }
1352
+ const body = doc.body || doc.documentElement;
1353
+ if (dirty && leadingWhitespace) {
1354
+ body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
1355
+ }
1356
+ /* Work on whole document or just its body */
1357
+ if (NAMESPACE === HTML_NAMESPACE) {
1358
+ return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
1359
+ }
1360
+ return WHOLE_DOCUMENT ? doc.documentElement : body;
1361
+ };
1362
+ /**
1363
+ * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
1364
+ *
1365
+ * @param root The root element or node to start traversing on.
1366
+ * @return The created NodeIterator
1367
+ */
1368
+ const _createNodeIterator = function _createNodeIterator(root) {
1369
+ return createNodeIterator.call(root.ownerDocument || root, root,
1370
+ // eslint-disable-next-line no-bitwise
1371
+ NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);
1372
+ };
1373
+ /**
1374
+ * Replace template expression syntax (mustache, ERB, template
1375
+ * literal) with a space; shared by all SAFE_FOR_TEMPLATES scrub
1376
+ * sites. Order matters: mustache, then ERB, then template literal.
1377
+ *
1378
+ * @param value the string to scrub
1379
+ * @returns the scrubbed string
1380
+ */
1381
+ const _stripTemplateExpressions = function _stripTemplateExpressions(value) {
1382
+ value = stringReplace(value, MUSTACHE_EXPR$1, ' ');
1383
+ value = stringReplace(value, ERB_EXPR$1, ' ');
1384
+ value = stringReplace(value, TMPLIT_EXPR$1, ' ');
1385
+ return value;
1386
+ };
1387
+ /**
1388
+ * Strip template-engine expressions ({{...}}, ${...}, <%...%>) from the
1389
+ * character data of an element subtree. Used as the final safety net for
1390
+ * SAFE_FOR_TEMPLATES on every DOM-returning code path so that expressions
1391
+ * which only form after text-node normalization (e.g. fragments split across
1392
+ * stripped elements) cannot survive into a template-evaluating framework.
1393
+ *
1394
+ * Walks text/comment/CDATA/processing-instruction nodes and mutates `.data`
1395
+ * in place rather than round-tripping through innerHTML. This preserves
1396
+ * descendant node references (important for IN_PLACE callers), avoids a
1397
+ * serialize/reparse cycle, and reads literal character data — which means
1398
+ * `<%...%>` in text content matches the ERB regex against its real bytes
1399
+ * instead of the HTML-entity-escaped form innerHTML would produce.
1400
+ *
1401
+ * Attribute values are not visited here; SAFE_FOR_TEMPLATES handling for
1402
+ * attributes is performed during the per-node `_sanitizeAttributes` pass.
1403
+ *
1404
+ * @param node The root element whose character data should be scrubbed.
1405
+ */
1406
+ const _scrubTemplateExpressions2 = function _scrubTemplateExpressions(node) {
1407
+ var _node$querySelectorAl;
1408
+ node.normalize();
1409
+ const walker = createNodeIterator.call(node.ownerDocument || node, node,
1410
+ // eslint-disable-next-line no-bitwise
1411
+ NodeFilter.SHOW_TEXT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_CDATA_SECTION | NodeFilter.SHOW_PROCESSING_INSTRUCTION, null);
1412
+ let currentNode = walker.nextNode();
1413
+ while (currentNode) {
1414
+ currentNode.data = _stripTemplateExpressions(currentNode.data);
1415
+ currentNode = walker.nextNode();
1416
+ }
1417
+ // NodeIterator does not descend into <template>.content per the DOM spec,
1418
+ // so we must explicitly recurse into each template's content fragment,
1419
+ // mirroring the approach used by _sanitizeShadowDOM.
1420
+ const templates = (_node$querySelectorAl = node.querySelectorAll) === null || _node$querySelectorAl === void 0 ? void 0 : _node$querySelectorAl.call(node, 'template');
1421
+ if (templates) {
1422
+ arrayForEach(templates, tmpl => {
1423
+ if (_isDocumentFragment(tmpl.content)) {
1424
+ _scrubTemplateExpressions2(tmpl.content);
1425
+ }
1426
+ });
1427
+ }
1428
+ };
1429
+ /**
1430
+ * _isClobbered
1431
+ *
1432
+ * Detect DOM-clobbering on HTMLFormElement nodes. Form is the only HTML
1433
+ * interface with [LegacyOverrideBuiltIns]; a descendant element with a
1434
+ * `name` attribute matching a prototype property shadows that property
1435
+ * on direct reads. We use this check at the IN_PLACE entry-point and
1436
+ * during attribute sanitization to refuse clobbered forms.
1437
+ *
1438
+ * @param element element to check for clobbering attacks
1439
+ * @return true if clobbered, false if safe
1440
+ */
1441
+ const _isClobbered = function _isClobbered(element) {
1442
+ // Realm-independent tag-name probe. If we can't determine the tag
1443
+ // name at all, we can't reason about clobbering — return false
1444
+ // (the caller's other defences still apply).
1445
+ const realTagName = getNodeName ? getNodeName(element) : null;
1446
+ if (typeof realTagName !== 'string') {
1447
+ return false;
1448
+ }
1449
+ if (transformCaseFunc(realTagName) !== 'form') {
1450
+ return false;
1451
+ }
1452
+ return typeof element.nodeName !== 'string' || typeof element.textContent !== 'string' || typeof element.removeChild !== 'function' ||
1453
+ // Realm-safe NamedNodeMap detection: equality against the cached
1454
+ // prototype getter. Clobbered .attributes (e.g. <input name="attributes">)
1455
+ // makes the direct read diverge from the cached read; a clean form
1456
+ // (same-realm OR foreign-realm) has both reads pointing at the same
1457
+ // canonical NamedNodeMap.
1458
+ element.attributes !== getAttributes(element) || typeof element.removeAttribute !== 'function' || typeof element.setAttribute !== 'function' || typeof element.namespaceURI !== 'string' || typeof element.insertBefore !== 'function' || typeof element.hasChildNodes !== 'function' ||
1459
+ // NodeType clobbering probe. Cached Node.prototype.nodeType getter
1460
+ // returns the integer 1 for any Element regardless of realm; direct
1461
+ // read on a clobbered form (e.g. <input name="nodeType">) returns
1462
+ // the named child element. Cheap addition — nodeType is read from
1463
+ // an internal slot, no serialization cost — and removes a residual
1464
+ // clobbering surface used by several mXSS / PI / comment branches
1465
+ // in _sanitizeElements that compare currentNode.nodeType directly.
1466
+ element.nodeType !== getNodeType(element) ||
1467
+ // HTMLFormElement has [LegacyOverrideBuiltIns]: a descendant named
1468
+ // "childNodes" shadows the prototype getter. Direct reads of
1469
+ // form.childNodes from a clobbered form return the named child
1470
+ // instead of the real NodeList, so any walk that reads it directly
1471
+ // skips the form's real children. Compare the direct read to the
1472
+ // cached Node.prototype getter — when the form's named-property
1473
+ // getter intercepts the read, the two values differ and we flag
1474
+ // the form. This catches every clobbering child type (input,
1475
+ // select, etc.) regardless of whether the named child happens to
1476
+ // carry a numeric .length, which a typeof-based probe would miss
1477
+ // (e.g. HTMLSelectElement.length is a defined unsigned-long).
1478
+ element.childNodes !== getChildNodes(element);
1479
+ };
1480
+ /**
1481
+ * Checks whether the given value is a DocumentFragment from any realm.
1482
+ *
1483
+ * The realm-independent replacement reads `nodeType` through the cached
1484
+ * Node.prototype getter and compares to the DOCUMENT_FRAGMENT_NODE
1485
+ * constant (11). nodeType is a numeric value resolved from the node's
1486
+ * internal slot, identical across realms for the same kind of node.
1487
+ *
1488
+ * @param value object to check
1489
+ * @return true if value is a DocumentFragment-shaped node from any realm
1490
+ */
1491
+ const _isDocumentFragment = function _isDocumentFragment(value) {
1492
+ if (!getNodeType || typeof value !== 'object' || value === null) {
1493
+ return false;
1494
+ }
1495
+ try {
1496
+ return getNodeType(value) === NODE_TYPE.documentFragment;
1497
+ } catch (_) {
1498
+ return false;
1499
+ }
1500
+ };
1501
+ /**
1502
+ * Checks whether the given object is a DOM node, including nodes that
1503
+ * originate from a different window/realm (e.g. an iframe's
1504
+ * contentDocument). The previous `value instanceof Node` check was
1505
+ * realm-bound: nodes from a different window failed it, causing
1506
+ * sanitize() to silently stringify them and reset IN_PLACE to false,
1507
+ * returning the original node unsanitized. See GHSA-4w3q-35jp-p934.
1508
+ *
1509
+ * @param value object to check whether it's a DOM node
1510
+ * @return true if value is a DOM node from any realm
1511
+ */
1512
+ const _isNode = function _isNode(value) {
1513
+ if (!getNodeType || typeof value !== 'object' || value === null) {
1514
+ return false;
1515
+ }
1516
+ try {
1517
+ return typeof getNodeType(value) === 'number';
1518
+ } catch (_) {
1519
+ return false;
1520
+ }
1521
+ };
1522
+ function _executeHooks(hooks, currentNode, data) {
1523
+ if (hooks.length === 0) {
1524
+ return;
1525
+ }
1526
+ arrayForEach(hooks, hook => {
1527
+ hook.call(DOMPurify, currentNode, data, CONFIG);
1528
+ });
1529
+ }
1530
+ /**
1531
+ * Structural-threat checks that condemn a node regardless of the
1532
+ * allowlists: mXSS via namespace confusion, risky CSS construction,
1533
+ * processing instructions, markup-bearing comments. Pure predicate;
1534
+ * the caller removes. Check order is load-bearing.
1535
+ *
1536
+ * @param currentNode the node to inspect
1537
+ * @param tagName the node's transformCaseFunc'd tag name
1538
+ * @return true if the node must be removed
1539
+ */
1540
+ const _isUnsafeNode = function _isUnsafeNode(currentNode, tagName) {
1541
+ /* Detect mXSS attempts abusing namespace confusion */
1542
+ if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.textContent) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.innerHTML)) {
1543
+ return true;
1544
+ }
1545
+ /* Remove risky CSS construction leading to mXSS */
1546
+ if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === 'style' && _isNode(currentNode.firstElementChild)) {
1547
+ return true;
1548
+ }
1549
+ /* Remove any occurrence of processing instructions */
1550
+ if (currentNode.nodeType === NODE_TYPE.processingInstruction) {
1551
+ return true;
1552
+ }
1553
+ /* Remove any kind of possibly harmful comments */
1554
+ if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, currentNode.data)) {
1555
+ return true;
1556
+ }
1557
+ return false;
1558
+ };
1559
+ /**
1560
+ * Handle a node whose tag is forbidden or not allowlisted: keep
1561
+ * allowed custom elements (false return exits _sanitizeElements
1562
+ * early - the namespace and fallback-tag removal checks are
1563
+ * intentionally skipped for kept custom elements), else hoist
1564
+ * content per KEEP_CONTENT and remove.
1565
+ *
1566
+ * A kept custom element is the ONLY case in which this function
1567
+ * returns false, so the caller uses that return value to run the
1568
+ * afterSanitizeElements hook on the kept element and keep the
1569
+ * element-hook lifecycle consistent with normal allowlisted
1570
+ * elements (GHSA-c2j3-45gr-mqc4).
1571
+ *
1572
+ * @param currentNode the disallowed node
1573
+ * @param tagName the node's transformCaseFunc'd tag name
1574
+ * @return true if the node was removed, false if kept
1575
+ */
1576
+ const _sanitizeDisallowedNode = function _sanitizeDisallowedNode(currentNode, tagName) {
1577
+ /* Check if we have a custom element to handle */
1578
+ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
1579
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
1580
+ return false;
1581
+ }
1582
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
1583
+ return false;
1584
+ }
1585
+ }
1586
+ /* Keep content except for bad-listed elements.
1587
+ Use the cached prototype getters exclusively — the previous code
1588
+ had `|| currentNode.parentNode` / `|| currentNode.childNodes`
1589
+ fallbacks, but the cached getters always return the canonical
1590
+ value (or null for a real parent-less node), so the fallback
1591
+ path was dead in safe cases and a clobbering surface in unsafe
1592
+ ones. Falsy cached results stay falsy; the `if (childNodes &&
1593
+ parentNode)` check already gates correctly. */
1594
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
1595
+ const parentNode = getParentNode(currentNode);
1596
+ const childNodes = getChildNodes(currentNode);
1597
+ if (childNodes && parentNode) {
1598
+ const childCount = childNodes.length;
1599
+ /* In-place: hoist the *original* children so the iterator visits
1600
+ and sanitises them through the same allowlist pass as every other
1601
+ node. The caller built the tree in the live document, so the
1602
+ originals carry already-queued resource events (`<img onerror>`,
1603
+ `<video>`/`<audio>` error, lazy/`onload`, …); cloning would leave
1604
+ those originals detached but still armed, firing in page scope
1605
+ while the returned tree looked clean. Moving is safe in-place: the
1606
+ root is pre-validated as an allowed tag and so is never the node
1607
+ being removed, which keeps `parentNode` inside the iterator root
1608
+ and the relocated child inside the serialised tree.
1609
+ Otherwise (string / DOM-copy paths): clone. The iterator is rooted
1610
+ at — and the result serialised from — `body`, so a restrictive
1611
+ ALLOWED_TAGS that removes `body` itself must leave its content in
1612
+ place, which only cloning does; and those paths parse into an
1613
+ inert document, so their discarded originals never had a queued
1614
+ event to neutralise.
1615
+ `childNodes` is live; a tail-to-head walk keeps `childNodes[i]`
1616
+ valid whether we move (drops the trailing entry) or clone (leaves
1617
+ the list intact). */
1618
+ for (let i = childCount - 1; i >= 0; --i) {
1619
+ const hoisted = IN_PLACE ? childNodes[i] : cloneNode(childNodes[i], true);
1620
+ parentNode.insertBefore(hoisted, getNextSibling(currentNode));
1621
+ }
1622
+ }
1623
+ }
1624
+ _forceRemove(currentNode);
1625
+ return true;
1626
+ };
1627
+ /**
1628
+ * _sanitizeElements
1629
+ *
1630
+ * @protect nodeName
1631
+ * @protect textContent
1632
+ * @protect removeChild
1633
+ * @param currentNode to check for permission to exist
1634
+ * @return true if node was killed, false if left alive
1635
+ */
1636
+ // eslint-disable-next-line complexity
1637
+ const _sanitizeElements = function _sanitizeElements(currentNode, root) {
1638
+ /* Execute a hook if present */
1639
+ _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
1640
+ /* A hook may have detached the node — treat it as removed (see the
1641
+ detached-node comment after the uponSanitizeElement hook below). */
1642
+ if (currentNode !== root && getParentNode(currentNode) === null) {
1643
+ return true;
1644
+ }
1645
+ /* Check if element is clobbered or can clobber */
1646
+ if (_isClobbered(currentNode)) {
1647
+ _forceRemove(currentNode);
1648
+ return true;
1649
+ }
1650
+ /* Now let's check the element's type and name */
1651
+ const tagName = transformCaseFunc(getNodeName ? getNodeName(currentNode) : currentNode.nodeName);
1652
+ /* Execute a hook if present */
1653
+ _executeHooks(hooks.uponSanitizeElement, currentNode, {
1654
+ tagName,
1655
+ allowedTags: ALLOWED_TAGS
1656
+ });
1657
+ /* A hook may have detached the node from the tree — a long-standing
1658
+ user pattern (issue #469; draw.io-style foreignObject filtering).
1659
+ Per the cached, unclobberable parentNode getter the node is
1660
+ genuinely out of the tree, so it can reach neither the serialized
1661
+ output nor an IN_PLACE live tree; treat it as removed and stop
1662
+ processing it. Without this guard, the unsafe-node / namespace
1663
+ checks below would call _forceRemove on a parentless node and hit
1664
+ the REPORT-3 fail-closed throw — which exists for nodes DOMPurify
1665
+ wants gone but *cannot* detach (clobbered / parentless roots), the
1666
+ opposite of a node that is already safely gone. The walk root is
1667
+ exempt: a detached IN_PLACE root is legitimate input and must still
1668
+ be fully sanitized, and a kill-decision on it must keep hitting the
1669
+ REPORT-3 throw. Nodes detached by hooks are the hook's
1670
+ responsibility: they are not recorded in DOMPurify.removed and are
1671
+ not neutralized by the post-walk IN_PLACE pass. */
1672
+ if (currentNode !== root && getParentNode(currentNode) === null) {
1673
+ return true;
1674
+ }
1675
+ /* Remove mXSS vectors, processing instructions and risky comments */
1676
+ if (_isUnsafeNode(currentNode, tagName)) {
1677
+ _forceRemove(currentNode);
1678
+ return true;
1679
+ }
1680
+ /* Remove element if anything forbids its presence */
1681
+ if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
1682
+ const removed = _sanitizeDisallowedNode(currentNode, tagName);
1683
+ /* A false return means the node is a custom element kept via
1684
+ CUSTOM_ELEMENT_HANDLING - the only keep path through
1685
+ _sanitizeDisallowedNode. Run afterSanitizeElements on it so the
1686
+ element-hook lifecycle matches normal allowlisted elements: a
1687
+ security policy applied in this hook (e.g. stripping an attribute
1688
+ from every surviving element) must not silently skip kept custom
1689
+ elements (GHSA-c2j3-45gr-mqc4). This mirrors the normal-element
1690
+ tail below - the hook runs, then the walker's subsequent
1691
+ _sanitizeAttributes pass sanitizes the element's attributes. The
1692
+ deliberately skipped namespace and fallback-tag removal checks stay
1693
+ skipped; they are removal decisions, not the hook contract. */
1694
+ if (removed === false) {
1695
+ _executeHooks(hooks.afterSanitizeElements, currentNode, null);
1696
+ }
1697
+ return removed;
1698
+ }
1699
+ /* Check whether element has a valid namespace.
1700
+ Realm-safe check (GHSA-hpcv-96wg-7vj8): use the cached Node.prototype
1701
+ nodeType getter rather than `instanceof Element`, which is realm-
1702
+ bound and short-circuits to false for any node minted in a different
1703
+ realm — letting a foreign-realm element with a forbidden namespace
1704
+ slip past the namespace check entirely. */
1705
+ const nt = getNodeType ? getNodeType(currentNode) : currentNode.nodeType;
1706
+ if (nt === NODE_TYPE.element && !_checkValidNamespace(currentNode)) {
1707
+ _forceRemove(currentNode);
1708
+ return true;
1709
+ }
1710
+ /* Make sure that older browsers don't get fallback-tag mXSS */
1711
+ if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(FALLBACK_TAG_CLOSE, currentNode.innerHTML)) {
1712
+ _forceRemove(currentNode);
1713
+ return true;
1714
+ }
1715
+ /* Sanitize element content to be template-safe */
1716
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
1717
+ /* Get the element's text content */
1718
+ const content = _stripTemplateExpressions(currentNode.textContent);
1719
+ if (currentNode.textContent !== content) {
1720
+ arrayPush(DOMPurify.removed, {
1721
+ element: currentNode.cloneNode()
1722
+ });
1723
+ currentNode.textContent = content;
1724
+ }
1725
+ }
1726
+ /* Execute a hook if present */
1727
+ _executeHooks(hooks.afterSanitizeElements, currentNode, null);
1728
+ return false;
1729
+ };
1730
+ /**
1731
+ * _isValidAttribute
1732
+ *
1733
+ * @param lcTag Lowercase tag name of containing element.
1734
+ * @param lcName Lowercase attribute name.
1735
+ * @param value Attribute value.
1736
+ * @return Returns true if `value` is valid, otherwise false.
1737
+ */
1738
+ // eslint-disable-next-line complexity
1739
+ const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
1740
+ /* FORBID_ATTR must always win, even if ADD_ATTR predicate would allow it */
1741
+ if (FORBID_ATTR[lcName]) {
1742
+ return false;
1743
+ }
1744
+ /* Reject declarative-partial-updates patch-linkage attributes
1745
+ (https://github.com/WICG/declarative-partial-updates).
1746
+ Empirical note (Chrome 150, verified — see
1747
+ test/declarative-patch-probe-v3.html): expansion is NOT applied after
1748
+ sanitization. For the string path it fires during sanitize()'s own
1749
+ parse, so the walk sees and sanitizes the fully materialized expanded
1750
+ tree — teleports into MathML/SVG integration points included; a
1751
+ weaponized `<template for>`->`<img onerror>` comes back with the handler
1752
+ stripped. For the IN_PLACE path it fires on connection, before the walk.
1753
+ Either way DOMPurify is NOT blind to the patch.
1754
+ This removal is therefore defense-in-depth rather than the sole barrier:
1755
+ it prevents live linkage from surviving into the OUTPUT and re-expanding
1756
+ in the caller's context, and keeps behaviour deterministic if a future
1757
+ engine defers expansion. `for` is legitimate only on <label>/<output>;
1758
+ anywhere else (notably <template for>) it links the element to a patch
1759
+ target and teleports or removes an arbitrary DOM range by id/marker name.
1760
+ `patchsrc` fetches remote markup and is treated as a script-loading
1761
+ mechanism (CSP). Gated on SAFE_FOR_XML so the removal groups with the
1762
+ other structural-threat checks and stays overridable, consistent with
1763
+ the rest of the codebase. PI range markers are already removed by
1764
+ _isUnsafeNode. */
1765
+ if (SAFE_FOR_XML && lcName === 'patchsrc') {
1766
+ return false;
1767
+ }
1768
+ if (SAFE_FOR_XML && lcName === 'for' && lcTag !== 'label' && lcTag !== 'output') {
1769
+ return false;
1770
+ }
1771
+ /* Make sure attribute cannot clobber */
1772
+ if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
1773
+ return false;
1774
+ }
1775
+ const nameIsPermitted = ALLOWED_ATTR[lcName] || EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag);
1776
+ /* Allow valid data-* attributes: At least one character after "-"
1777
+ (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
1778
+ XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
1779
+ We don't need to check the value; it's always URI safe. */
1780
+ if (ALLOW_DATA_ATTR && regExpTest(DATA_ATTR$1, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName)) ; else if (!nameIsPermitted) {
1781
+ if (
1782
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
1783
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1784
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
1785
+ _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, lcTag)) ||
1786
+ // Alternative, second condition checks if it's an `is`-attribute, AND
1787
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1788
+ 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 {
1789
+ return false;
1790
+ }
1791
+ /* Check value is safe. First, is attr inert? If so, is safe */
1792
+ } else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, ''))) ; 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$1, stringReplace(value, ATTR_WHITESPACE$1, ''))) ; else if (value) {
1793
+ return false;
1794
+ } else ;
1795
+ return true;
1796
+ };
1797
+ /* Names the HTML spec reserves from valid-custom-element-name; these must
1798
+ * never be treated as basic custom elements even when a permissive
1799
+ * CUSTOM_ELEMENT_HANDLING.tagNameCheck is configured. */
1800
+ const RESERVED_CUSTOM_ELEMENT_NAMES = addToSet({}, ['annotation-xml', 'color-profile', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'missing-glyph']);
1801
+ /**
1802
+ * _isBasicCustomElement
1803
+ * checks if at least one dash is included in tagName, and it's not the first char
1804
+ * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
1805
+ *
1806
+ * @param tagName name of the tag of the node to sanitize
1807
+ * @returns Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
1808
+ */
1809
+ const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
1810
+ return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT$1, tagName);
1811
+ };
1812
+ /**
1813
+ * Wrap an attribute value in the matching Trusted Types object when
1814
+ * the active policy requires it. Namespaced attributes pass through
1815
+ * unchanged (no TT support yet, see
1816
+ * https://bugs.chromium.org/p/chromium/issues/detail?id=1305293).
1817
+ *
1818
+ * @param lcTag lowercase tag name of the containing element
1819
+ * @param lcName lowercase attribute name
1820
+ * @param namespaceURI the attribute's namespace, if any
1821
+ * @param value the attribute value to wrap
1822
+ * @return the value, wrapped when Trusted Types demand it
1823
+ */
1824
+ const _applyTrustedTypesToAttribute = function _applyTrustedTypesToAttribute(lcTag, lcName, namespaceURI, value) {
1825
+ if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function' && !namespaceURI) {
1826
+ switch (trustedTypes.getAttributeType(lcTag, lcName)) {
1827
+ case 'TrustedHTML':
1828
+ {
1829
+ return _createTrustedHTML(value);
1830
+ }
1831
+ case 'TrustedScriptURL':
1832
+ {
1833
+ return _createTrustedScriptURL(value);
1834
+ }
1835
+ }
1836
+ }
1837
+ return value;
1838
+ };
1839
+ /**
1840
+ * Write a modified attribute value back onto the element. On
1841
+ * success, re-probe for clobbering introduced by the new value and
1842
+ * remove the element when found; otherwise pop the removal entry
1843
+ * recorded by the earlier _removeAttribute (long-standing pairing
1844
+ * with the SANITIZE_NAMED_PROPS path - do not "fix" casually). On
1845
+ * failure, remove the attribute instead.
1846
+ *
1847
+ * @param currentNode the element carrying the attribute
1848
+ * @param name the attribute name as present on the element
1849
+ * @param namespaceURI the attribute's namespace, if any
1850
+ * @param value the new attribute value
1851
+ */
1852
+ const _setAttributeValue = function _setAttributeValue(currentNode, name, namespaceURI, value) {
1853
+ try {
1854
+ if (namespaceURI) {
1855
+ currentNode.setAttributeNS(namespaceURI, name, value);
1856
+ } else {
1857
+ /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
1858
+ currentNode.setAttribute(name, value);
1859
+ }
1860
+ if (_isClobbered(currentNode)) {
1861
+ _forceRemove(currentNode);
1862
+ } else {
1863
+ arrayPop(DOMPurify.removed);
1864
+ }
1865
+ } catch (_) {
1866
+ _removeAttribute(name, currentNode);
1867
+ }
1868
+ };
1869
+ /**
1870
+ * _sanitizeAttributes
1871
+ *
1872
+ * @protect attributes
1873
+ * @protect nodeName
1874
+ * @protect removeAttribute
1875
+ * @protect setAttribute
1876
+ *
1877
+ * @param currentNode to sanitize
1878
+ */
1879
+ const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
1880
+ /* Execute a hook if present */
1881
+ _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
1882
+ const attributes = currentNode.attributes;
1883
+ /* Check if we have attributes; if not we might have a text node */
1884
+ if (!attributes || _isClobbered(currentNode)) {
1885
+ return;
1886
+ }
1887
+ const hookEvent = {
1888
+ attrName: '',
1889
+ attrValue: '',
1890
+ keepAttr: true,
1891
+ allowedAttributes: ALLOWED_ATTR,
1892
+ forceKeepAttr: undefined
1893
+ };
1894
+ let l = attributes.length;
1895
+ const lcTag = transformCaseFunc(currentNode.nodeName);
1896
+ /* Go backwards over all attributes; safely remove bad ones */
1897
+ while (l--) {
1898
+ const attr = attributes[l];
1899
+ const name = attr.name,
1900
+ namespaceURI = attr.namespaceURI,
1901
+ attrValue = attr.value;
1902
+ const lcName = transformCaseFunc(name);
1903
+ const initValue = attrValue;
1904
+ let value = name === 'value' ? initValue : stringTrim(initValue);
1905
+ /* Execute a hook if present */
1906
+ hookEvent.attrName = lcName;
1907
+ hookEvent.attrValue = value;
1908
+ hookEvent.keepAttr = true;
1909
+ hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
1910
+ _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
1911
+ value = hookEvent.attrValue;
1912
+ /* Full DOM Clobbering protection via namespace isolation,
1913
+ * Prefix id and name attributes with `user-content-`
1914
+ */
1915
+ if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name') && stringIndexOf(value, SANITIZE_NAMED_PROPS_PREFIX) !== 0) {
1916
+ // Remove the attribute with this value
1917
+ _removeAttribute(name, currentNode);
1918
+ // Prefix the value and later re-create the attribute with the sanitized value
1919
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
1920
+ }
1921
+ // Else: already prefixed, leave the attribute alone — the prefix is
1922
+ // itself the clobbering protection, and re-applying it is incorrect.
1923
+ /* Work around a security issue with comments inside attributes */
1924
+ if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) {
1925
+ _removeAttribute(name, currentNode);
1926
+ continue;
1927
+ }
1928
+ /* Make sure we cannot easily use animated hrefs, even if animations are allowed */
1929
+ if (lcName === 'attributename' && stringMatch(value, 'href')) {
1930
+ _removeAttribute(name, currentNode);
1931
+ continue;
1932
+ }
1933
+ /* Did the hooks force-keep the attribute? */
1934
+ if (hookEvent.forceKeepAttr) {
1935
+ continue;
1936
+ }
1937
+ /* Did the hooks approve of the attribute? */
1938
+ if (!hookEvent.keepAttr) {
1939
+ _removeAttribute(name, currentNode);
1940
+ continue;
1941
+ }
1942
+ /* Work around a security issue in jQuery 3.0 */
1943
+ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(SELF_CLOSING_TAG, value)) {
1944
+ _removeAttribute(name, currentNode);
1945
+ continue;
1946
+ }
1947
+ /* Sanitize attribute content to be template-safe */
1948
+ if (SAFE_FOR_TEMPLATES) {
1949
+ value = _stripTemplateExpressions(value);
1950
+ }
1951
+ /* Is `value` valid for this attribute? */
1952
+ if (!_isValidAttribute(lcTag, lcName, value)) {
1953
+ _removeAttribute(name, currentNode);
1954
+ continue;
1955
+ }
1956
+ /* Handle attributes that require Trusted Types */
1957
+ value = _applyTrustedTypesToAttribute(lcTag, lcName, namespaceURI, value);
1958
+ /* Handle invalid data-* attribute set by try-catching it */
1959
+ if (value !== initValue) {
1960
+ _setAttributeValue(currentNode, name, namespaceURI, value);
1961
+ }
1962
+ }
1963
+ /* Execute a hook if present */
1964
+ _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
1965
+ };
1966
+ /**
1967
+ * _sanitizeShadowDOM
1968
+ *
1969
+ * @param fragment to iterate over recursively
1970
+ */
1971
+ const _sanitizeShadowDOM2 = function _sanitizeShadowDOM(fragment) {
1972
+ let shadowNode = null;
1973
+ const shadowIterator = _createNodeIterator(fragment);
1974
+ /* Execute a hook if present */
1975
+ _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
1976
+ while (shadowNode = shadowIterator.nextNode()) {
1977
+ /* Execute a hook if present */
1978
+ _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
1979
+ /* Sanitize tags and elements */
1980
+ _sanitizeElements(shadowNode, fragment);
1981
+ /* Check attributes next */
1982
+ _sanitizeAttributes(shadowNode);
1983
+ /* Deep shadow DOM detected.
1984
+ Realm-safe check (GHSA-hpcv-96wg-7vj8): use nodeType against the
1985
+ DOCUMENT_FRAGMENT_NODE constant rather than instanceof, so we
1986
+ recurse into <template>.content from foreign realms too. */
1987
+ if (_isDocumentFragment(shadowNode.content)) {
1988
+ _sanitizeShadowDOM2(shadowNode.content);
1989
+ }
1990
+ /* An element iterated here may itself host an attached
1991
+ shadow root. The default NodeIterator does not enter shadow
1992
+ trees, so a shadow root nested inside template.content was
1993
+ previously reached by no walk at all (the pre-pass at
1994
+ _sanitizeAttachedShadowRoots descends via childNodes, which
1995
+ doesn't enter template.content; the template-content recursion
1996
+ above iterates the content but never inspected shadowRoot).
1997
+ Walk it explicitly. The nodeType guard avoids reading
1998
+ shadowRoot off text / comment / CDATA / PI nodes that the
1999
+ iterator also surfaces. */
2000
+ const shadowNodeType = getNodeType ? getNodeType(shadowNode) : shadowNode.nodeType;
2001
+ if (shadowNodeType === NODE_TYPE.element) {
2002
+ const innerSr = getShadowRoot(shadowNode);
2003
+ if (_isDocumentFragment(innerSr)) {
2004
+ _sanitizeAttachedShadowRoots(innerSr);
2005
+ _sanitizeShadowDOM2(innerSr);
2006
+ }
2007
+ }
2008
+ }
2009
+ /* Execute a hook if present */
2010
+ _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
2011
+ };
2012
+ /**
2013
+ * _sanitizeAttachedShadowRoots
2014
+ *
2015
+ * Walks `root` and feeds every attached shadow root we encounter into
2016
+ * the existing _sanitizeShadowDOM pipeline. The default node iterator
2017
+ * does not descend into shadow trees, so nodes inside an attached
2018
+ * shadow root would otherwise be skipped entirely.
2019
+ *
2020
+ * Two real input paths put attached shadow roots in front of us:
2021
+ * 1. IN_PLACE on a DOM node that already has shadow roots attached.
2022
+ * 2. DOM-node input where importNode(dirty, true) deep-clones the
2023
+ * shadow root because it was created with `clonable: true`.
2024
+ *
2025
+ * This pass runs once, up front, so the main iteration loop (and the
2026
+ * existing _sanitizeShadowDOM template-content recursion) stay
2027
+ * untouched — string-input paths are not affected.
2028
+ *
2029
+ * @param root the subtree root to walk for attached shadow roots
2030
+ */
2031
+ const _sanitizeAttachedShadowRoots = function _sanitizeAttachedShadowRoots(root) {
2032
+ /* Iterative (explicit stack) rather than per-child recursion. DOM APIs
2033
+ impose no depth cap, so an attacker-shaped tree (JSON/CRDT/editor data
2034
+ built straight into the DOM — the IN_PLACE surface) deeper than the JS
2035
+ call-stack budget would otherwise overflow native recursion here and
2036
+ throw at the IN_PLACE entry pre-pass, before a single node is
2037
+ sanitized, leaving the caller's live tree untouched (fail-open). See
2038
+ campaign-3 F4. A heap stack keeps depth off the call stack.
2039
+ Each work item is either a node to descend into, or a deferred
2040
+ `_sanitizeShadowDOM` for an already-walked shadow root. The deferred
2041
+ form preserves the original post-order discipline: a shadow root's
2042
+ nested shadow roots are discovered before the outer shadow is
2043
+ sanitized (which may remove hosts). Pushes are in reverse of the
2044
+ desired processing order (LIFO): template content, then children, then
2045
+ the shadow-sanitize, then the shadow walk — so the order matches the
2046
+ previous recursion exactly. */
2047
+ const stack = [{
2048
+ node: root,
2049
+ shadow: null
2050
+ }];
2051
+ while (stack.length > 0) {
2052
+ const item = stack.pop();
2053
+ /* Deferred shadow-DOM sanitisation: runs after its subtree was walked. */
2054
+ if (item.shadow) {
2055
+ _sanitizeShadowDOM2(item.shadow);
2056
+ continue;
2057
+ }
2058
+ const node = item.node;
2059
+ const nodeType = getNodeType ? getNodeType(node) : node.nodeType;
2060
+ const isElement = nodeType === NODE_TYPE.element;
2061
+ /* (pushed last → processed first) Children, snapshotted in reverse so
2062
+ the first child is processed first. Snapshotting matters because a
2063
+ hook may detach siblings mid-walk. */
2064
+ const childNodes = getChildNodes(node);
2065
+ if (childNodes) {
2066
+ for (let i = childNodes.length - 1; i >= 0; --i) {
2067
+ stack.push({
2068
+ node: childNodes[i],
2069
+ shadow: null
2070
+ });
2071
+ }
2072
+ }
2073
+ /* (pushed before children → processed after them, matching the old
2074
+ "template content last" order) When the node is a <template>,
2075
+ descend into its content. */
2076
+ if (isElement) {
2077
+ const rootName = getNodeName ? getNodeName(node) : null;
2078
+ if (typeof rootName === 'string' && transformCaseFunc(rootName) === 'template') {
2079
+ const content = node.content;
2080
+ if (_isDocumentFragment(content)) {
2081
+ stack.push({
2082
+ node: content,
2083
+ shadow: null
2084
+ });
2085
+ }
2086
+ }
2087
+ }
2088
+ /* Shadow root (processed first): walk its subtree, then sanitise it.
2089
+ Realm-safe check (GHSA-hpcv-96wg-7vj8): nodeType-based detection
2090
+ rather than `instanceof DocumentFragment`, which is realm-bound and
2091
+ silently skipped foreign-realm shadow roots (e.g.
2092
+ iframe.contentDocument attachShadow). */
2093
+ if (isElement) {
2094
+ const sr = getShadowRoot(node);
2095
+ if (_isDocumentFragment(sr)) {
2096
+ /* Push the deferred sanitise first so it pops after the shadow
2097
+ walk we push next, i.e. nested shadow roots are discovered
2098
+ before this one is sanitised. */
2099
+ stack.push({
2100
+ node: null,
2101
+ shadow: sr
2102
+ }, {
2103
+ node: sr,
2104
+ shadow: null
2105
+ });
2106
+ }
2107
+ }
2108
+ }
2109
+ };
2110
+ // eslint-disable-next-line complexity
2111
+ DOMPurify.sanitize = function (dirty) {
2112
+ let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2113
+ let body = null;
2114
+ let importedNode = null;
2115
+ let currentNode = null;
2116
+ let returnNode = null;
2117
+ /* Make sure we have a string to sanitize.
2118
+ DO NOT return early, as this will return the wrong type if
2119
+ the user has requested a DOM object rather than a string */
2120
+ IS_EMPTY_INPUT = !dirty;
2121
+ if (IS_EMPTY_INPUT) {
2122
+ dirty = '<!-->';
2123
+ }
2124
+ /* Stringify, in case dirty is an object */
2125
+ if (typeof dirty !== 'string' && !_isNode(dirty)) {
2126
+ dirty = stringifyValue(dirty);
2127
+ if (typeof dirty !== 'string') {
2128
+ throw typeErrorCreate('dirty is not a string, aborting');
2129
+ }
2130
+ }
2131
+ /* Return dirty HTML if DOMPurify cannot run */
2132
+ if (!DOMPurify.isSupported) {
2133
+ return dirty;
2134
+ }
2135
+ /* Assign config vars */
2136
+ if (SET_CONFIG) {
2137
+ /* Persistent setConfig() path: _parseConfig is skipped, so the sets are
2138
+ * not re-derived per call. Restore them from the pristine bindings
2139
+ * captured at setConfig() time so a previous call's hook clone (mutated
2140
+ * below) does not carry over. */
2141
+ ALLOWED_TAGS = SET_CONFIG_ALLOWED_TAGS;
2142
+ ALLOWED_ATTR = SET_CONFIG_ALLOWED_ATTR;
2143
+ } else {
2144
+ _parseConfig(cfg);
2145
+ }
2146
+ /* Clone the hook-mutable allowlists before the walk whenever an
2147
+ * uponSanitize* hook is registered. The hook event exposes ALLOWED_TAGS
2148
+ * and ALLOWED_ATTR by reference (as allowedTags / allowedAttributes), so
2149
+ * a hook that widens them would otherwise mutate the shared set
2150
+ * permanently: across later calls and across every element. Cloning per
2151
+ * walk keeps documented in-call widening working while scoping it to the
2152
+ * call. A single guard for both config paths - the per-call path rebinds
2153
+ * the sets in _parseConfig each call, the persistent path restores them
2154
+ * from the captured bindings just above - so the two cannot diverge. */
2155
+ if (hooks.uponSanitizeElement.length > 0 || hooks.uponSanitizeAttribute.length > 0) {
2156
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
2157
+ }
2158
+ if (hooks.uponSanitizeAttribute.length > 0) {
2159
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
2160
+ }
2161
+ /* Clean up removed elements */
2162
+ DOMPurify.removed = [];
2163
+ /* Resolve IN_PLACE for this call without mutating persistent config.
2164
+ Writing the IN_PLACE closure variable here leaks under setConfig(),
2165
+ where _parseConfig is skipped on later calls: a single string call would
2166
+ disable in-place mode for every subsequent node call, returning a
2167
+ sanitized copy while leaving the caller's node — which in-place callers
2168
+ keep using and whose return value they ignore — unsanitized. REPORT-2. */
2169
+ const inPlace = IN_PLACE && typeof dirty !== 'string' && _isNode(dirty);
2170
+ if (inPlace) {
2171
+ /* Declarative-partial-updates / streaming pre-pass: sever every patch
2172
+ linkage across the live tree BEFORE the walk, so no patch can fire
2173
+ mid-walk and inject into an already-processed region. Runs first, so
2174
+ it also covers the forbidden/clobbered roots that throw below. */
2175
+ _neutralizePatchLinkage(dirty);
2176
+ /* Do some early pre-sanitization to avoid unsafe root nodes.
2177
+ Read nodeName through the cached prototype getter — a clobbering
2178
+ child named "nodeName" on the form root would otherwise shadow
2179
+ the property and let this check skip the root-allowlist
2180
+ validation entirely. */
2181
+ const nn = getNodeName ? getNodeName(dirty) : dirty.nodeName;
2182
+ if (typeof nn === 'string') {
2183
+ const tagName = transformCaseFunc(nn);
2184
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
2185
+ /* Fail closed on a live root: neutralize handlers/children before
2186
+ throwing, exactly as the mid-walk abort path does. */
2187
+ _neutralizeRoot(dirty);
2188
+ throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
2189
+ }
2190
+ }
2191
+ /* Pre-flight the root through _isClobbered. The iterator-driven
2192
+ removal path can not detach a parent-less root: _forceRemove
2193
+ falls through to Element.prototype.remove(), which per spec
2194
+ is a no-op on a node with no parent. A clobbered root would
2195
+ then survive the main loop with its attributes uninspected,
2196
+ because _sanitizeAttributes early-returns on _isClobbered. The
2197
+ result would be an attacker-controlled form, complete with any
2198
+ event-handler attributes the caller passed in, handed back to
2199
+ the application unsanitized. Refuse to sanitize such a root
2200
+ the same way we refuse a forbidden tag. GHSA-r47g-fvhr-h676. */
2201
+ if (_isClobbered(dirty)) {
2202
+ /* Fail closed on a live clobbered root before throwing.
2203
+ _neutralizeRoot's reads are clobber-safe (cached getters); the
2204
+ form's non-clobbered descendants, e.g. an armed <img>, are scrubbed. */
2205
+ _neutralizeRoot(dirty);
2206
+ throw typeErrorCreate('root node is clobbered and cannot be sanitized in-place');
2207
+ }
2208
+ /* Sanitize attached shadow roots before the main iterator runs.
2209
+ The iterator does not descend into shadow trees. Same fail-closed
2210
+ barrier as the main walk (campaign-3 F2): a custom-element reaction
2211
+ inside a shadow root could abort this pre-pass before the walk runs,
2212
+ which would otherwise leave the entire live tree unsanitized. */
2213
+ try {
2214
+ _sanitizeAttachedShadowRoots(dirty);
2215
+ } catch (error) {
2216
+ _neutralizeRoot(dirty);
2217
+ throw error;
2218
+ }
2219
+ } else if (_isNode(dirty)) {
2220
+ /* If dirty is a DOM element, append to an empty document to avoid
2221
+ elements being stripped by the parser */
2222
+ body = _initDocument('<!---->');
2223
+ importedNode = body.ownerDocument.importNode(dirty, true);
2224
+ if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === 'BODY') {
2225
+ /* Node is already a body, use as is */
2226
+ body = importedNode;
2227
+ } else if (importedNode.nodeName === 'HTML') {
2228
+ body = importedNode;
2229
+ } else {
2230
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
2231
+ body.appendChild(importedNode);
2232
+ }
2233
+ /* Clonable shadow roots are deep-cloned by importNode(); sanitize
2234
+ them before the main iterator runs, since the iterator does not
2235
+ descend into shadow trees. The walk routes every read through a
2236
+ cached prototype getter so clobbering descendants on a form root
2237
+ cannot hide a shadow host from this pass. */
2238
+ _sanitizeAttachedShadowRoots(importedNode);
2239
+ } else {
2240
+ /* Exit directly if we have nothing to do */
2241
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT &&
2242
+ // eslint-disable-next-line unicorn/prefer-includes
2243
+ dirty.indexOf('<') === -1) {
2244
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(dirty) : dirty;
2245
+ }
2246
+ /* Initialize the document to work on */
2247
+ body = _initDocument(dirty);
2248
+ /* Check we have a DOM node from the data */
2249
+ if (!body) {
2250
+ return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';
2251
+ }
2252
+ }
2253
+ /* Remove first element node (ours) if FORCE_BODY is set */
2254
+ if (body && FORCE_BODY) {
2255
+ _forceRemove(body.firstChild);
2256
+ }
2257
+ /* Get node iterator */
2258
+ const walkRoot = inPlace ? dirty : body;
2259
+ const nodeIterator = _createNodeIterator(walkRoot);
2260
+ /* Now start iterating over the created document.
2261
+ The walk runs inside an exception barrier (campaign-3 F2): a re-entrant
2262
+ engine/custom-element mutation can detach a node mid-walk so
2263
+ `_forceRemove`'s parentless guard throws, aborting the loop. Without the
2264
+ barrier the caller's in-place tree would be left half-sanitized with the
2265
+ unvisited tail still armed. On any throw we fail closed — strip the
2266
+ in-place root bare — then rethrow so the existing throw contract is
2267
+ preserved. (String/DOM-copy paths never return the partial body, so the
2268
+ propagating throw is already fail-closed there.) */
2269
+ try {
2270
+ while (currentNode = nodeIterator.nextNode()) {
2271
+ /* Sanitize tags and elements */
2272
+ _sanitizeElements(currentNode, walkRoot);
2273
+ /* Check attributes next */
2274
+ _sanitizeAttributes(currentNode);
2275
+ /* Shadow DOM detected, sanitize it.
2276
+ Realm-safe check (GHSA-hpcv-96wg-7vj8): nodeType-based detection
2277
+ instead of instanceof, so foreign-realm <template>.content is
2278
+ walked correctly. */
2279
+ if (_isDocumentFragment(currentNode.content)) {
2280
+ _sanitizeShadowDOM2(currentNode.content);
2281
+ }
2282
+ }
2283
+ } catch (error) {
2284
+ if (inPlace) {
2285
+ _neutralizeRoot(dirty);
2286
+ /* Nodes _forceRemove'd earlier in the aborted walk are already
2287
+ detached from the root, so _neutralizeRoot's subtree pass does not
2288
+ reach them. Defuse them too, mirroring the success-path loop below. */
2289
+ arrayForEach(DOMPurify.removed, entry => {
2290
+ if (entry.element) {
2291
+ _neutralizeSubtree(entry.element);
2292
+ }
2293
+ });
2294
+ }
2295
+ throw error;
2296
+ }
2297
+ /* If we sanitized `dirty` in-place, return it. */
2298
+ if (inPlace) {
2299
+ /* Fail-closed completion of the audit-5 F1 fix: every node removed from
2300
+ the caller's live tree is detached but may still hold a queued
2301
+ resource-event handler that fires in page scope after we return. The
2302
+ move-hoist covers only disallowed-tag KEEP_CONTENT removals; strip the
2303
+ non-allow-listed attributes off every other removed subtree (clobber,
2304
+ mXSS, namespace, comments, KEEP_CONTENT:false, …) so those handlers are
2305
+ cancelled before any event can fire. Runs synchronously, pre-return. */
2306
+ arrayForEach(DOMPurify.removed, entry => {
2307
+ if (entry.element) {
2308
+ _neutralizeSubtree(entry.element);
2309
+ }
2310
+ });
2311
+ if (SAFE_FOR_TEMPLATES) {
2312
+ _scrubTemplateExpressions2(dirty);
2313
+ }
2314
+ return dirty;
2315
+ }
2316
+ /* Return sanitized string or DOM */
2317
+ if (RETURN_DOM) {
2318
+ if (SAFE_FOR_TEMPLATES) {
2319
+ _scrubTemplateExpressions2(body);
2320
+ }
2321
+ if (RETURN_DOM_FRAGMENT) {
2322
+ returnNode = createDocumentFragment.call(body.ownerDocument);
2323
+ while (body.firstChild) {
2324
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
2325
+ returnNode.appendChild(body.firstChild);
2326
+ }
2327
+ } else {
2328
+ returnNode = body;
2329
+ }
2330
+ if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
2331
+ /*
2332
+ AdoptNode() is not used because internal state is not reset
2333
+ (e.g. the past names map of a HTMLFormElement), this is safe
2334
+ in theory but we would rather not risk another attack vector.
2335
+ The state that is cloned by importNode() is explicitly defined
2336
+ by the specs.
2337
+ */
2338
+ returnNode = importNode.call(originalDocument, returnNode, true);
2339
+ }
2340
+ return returnNode;
2341
+ }
2342
+ let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
2343
+ /* Serialize doctype if allowed */
2344
+ if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
2345
+ serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML;
2346
+ }
2347
+ /* Sanitize final string template-safe */
2348
+ if (SAFE_FOR_TEMPLATES) {
2349
+ serializedHTML = _stripTemplateExpressions(serializedHTML);
2350
+ }
2351
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(serializedHTML) : serializedHTML;
2352
+ };
2353
+ DOMPurify.setConfig = function () {
2354
+ let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2355
+ _parseConfig(cfg);
2356
+ SET_CONFIG = true;
2357
+ SET_CONFIG_ALLOWED_TAGS = ALLOWED_TAGS;
2358
+ SET_CONFIG_ALLOWED_ATTR = ALLOWED_ATTR;
2359
+ };
2360
+ DOMPurify.clearConfig = function () {
2361
+ CONFIG = null;
2362
+ SET_CONFIG = false;
2363
+ SET_CONFIG_ALLOWED_TAGS = null;
2364
+ SET_CONFIG_ALLOWED_ATTR = null;
2365
+ // Drop any caller-supplied Trusted Types policy so it cannot poison later
2366
+ // `RETURN_TRUSTED_TYPE` output. The internal default policy (cached, and
2367
+ // never recreated — Trusted Types throws on duplicate names) is restored by
2368
+ // the next `_parseConfig`. See GHSA-vxr8-fq34-vvx9.
2369
+ trustedTypesPolicy = defaultTrustedTypesPolicy;
2370
+ emptyHTML = '';
2371
+ };
2372
+ DOMPurify.isValidAttribute = function (tag, attr, value) {
2373
+ /* Initialize shared config vars if necessary. */
2374
+ if (!CONFIG) {
2375
+ _parseConfig({});
2376
+ }
2377
+ const lcTag = transformCaseFunc(tag);
2378
+ const lcName = transformCaseFunc(attr);
2379
+ return _isValidAttribute(lcTag, lcName, value);
2380
+ };
2381
+ DOMPurify.addHook = function (entryPoint, hookFunction) {
2382
+ if (typeof hookFunction !== 'function') {
2383
+ return;
2384
+ }
2385
+ /* Reject unknown entry points. Without this, a non-hook key (e.g.
2386
+ * '__proto__') indexes off the prototype chain rather than a real
2387
+ * hook array, and arrayPush then writes to Object.prototype. Guard
2388
+ * with an own-property check against the known hook names. */
2389
+ if (!objectHasOwnProperty(hooks, entryPoint)) {
2390
+ return;
2391
+ }
2392
+ arrayPush(hooks[entryPoint], hookFunction);
2393
+ };
2394
+ DOMPurify.removeHook = function (entryPoint, hookFunction) {
2395
+ if (!objectHasOwnProperty(hooks, entryPoint)) {
2396
+ return undefined;
2397
+ }
2398
+ if (hookFunction !== undefined) {
2399
+ const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
2400
+ return index === -1 ? undefined : arraySplice(hooks[entryPoint], index, 1)[0];
2401
+ }
2402
+ return arrayPop(hooks[entryPoint]);
2403
+ };
2404
+ DOMPurify.removeHooks = function (entryPoint) {
2405
+ if (!objectHasOwnProperty(hooks, entryPoint)) {
2406
+ return;
2407
+ }
2408
+ hooks[entryPoint] = [];
2409
+ };
2410
+ DOMPurify.removeAllHooks = function () {
2411
+ hooks = _createHooksMap();
2412
+ };
2413
+ return DOMPurify;
2414
+ }
2415
+ var purify = createDOMPurify();
2416
+
2417
+ const sanitizeSvg = (svg) => {
2418
+ return purify.sanitize(svg, {
2419
+ USE_PROFILES: { svg: true },
2420
+ FORBID_ATTR: ['height', 'width'],
2421
+ });
2422
+ };
2423
+ const svgCache = new Map();
2424
+ const fetchSvg = (url) => {
2425
+ if (!svgCache.has(url)) {
2426
+ svgCache.set(url, fetch(url)
2427
+ .then(r => {
2428
+ if (!r.ok)
2429
+ throw new Error(`ds-icon: failed to fetch SVG "${url}" (${r.status})`);
2430
+ return r.text();
2431
+ })
2432
+ .then(text => sanitizeSvg(text))
2433
+ .catch(err => {
2434
+ console.error(err);
2435
+ svgCache.delete(url);
2436
+ return '';
2437
+ }));
2438
+ }
2439
+ return svgCache.get(url);
2440
+ };
2441
+
2442
+ exports.fetchSvg = fetchSvg;
2443
+ exports.sanitizeSvg = sanitizeSvg;