@oat-sa/tao-core-ui 1.60.2 → 1.62.0

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 (783) hide show
  1. package/LICENSE +339 -339
  2. package/README.md +23 -18
  3. package/dist/actionbar.js +393 -410
  4. package/dist/adder.js +143 -156
  5. package/dist/animable/absorbable/absorbable.js +208 -211
  6. package/dist/animable/absorbable/css/absorb.css +7 -8
  7. package/dist/animable/absorbable/css/absorb.css.map +1 -1
  8. package/dist/animable/pulsable/css/pulse.css +7 -7
  9. package/dist/animable/pulsable/css/pulse.css.map +1 -1
  10. package/dist/animable/pulsable/pulsable.js +174 -174
  11. package/dist/areaBroker.js +59 -72
  12. package/dist/autocomplete/css/autocomplete.css +7 -8
  13. package/dist/autocomplete/css/autocomplete.css.map +1 -1
  14. package/dist/autocomplete.js +494 -604
  15. package/dist/autoscroll.js +23 -25
  16. package/dist/badge/badge.js +201 -199
  17. package/dist/badge/css/badge.css +7 -8
  18. package/dist/badge/css/badge.css.map +1 -1
  19. package/dist/breadcrumbs/css/breadcrumbs.css +7 -7
  20. package/dist/breadcrumbs/css/breadcrumbs.css.map +1 -1
  21. package/dist/breadcrumbs.js +286 -285
  22. package/dist/btngrouper.js +83 -95
  23. package/dist/bulkActionPopup/css/bulkActionPopup.css +7 -7
  24. package/dist/bulkActionPopup/css/bulkActionPopup.css.map +1 -1
  25. package/dist/bulkActionPopup.js +503 -503
  26. package/dist/button.js +300 -293
  27. package/dist/calculator/css/calculator.css +10 -10
  28. package/dist/calculator/css/calculator.css.map +1 -1
  29. package/dist/calculator.js +59 -72
  30. package/dist/cascadingComboBox.js +257 -256
  31. package/dist/ckeditor/ckConfigurator.js +130 -154
  32. package/dist/ckeditor/dtdHandler.js +305 -345
  33. package/dist/class/css/selector.css +7 -7
  34. package/dist/class/css/selector.css.map +1 -1
  35. package/dist/class/selector.js +437 -470
  36. package/dist/component/alignable.js +97 -121
  37. package/dist/component/containable.js +53 -58
  38. package/dist/component/css/components.css +7 -7
  39. package/dist/component/css/components.css.map +1 -1
  40. package/dist/component/css/windowComponent.css +7 -7
  41. package/dist/component/css/windowComponent.css.map +1 -1
  42. package/dist/component/draggable.js +34 -36
  43. package/dist/component/placeable.js +84 -102
  44. package/dist/component/resizable.js +79 -89
  45. package/dist/component/stackable.js +21 -27
  46. package/dist/component/windowed.js +284 -297
  47. package/dist/component.js +439 -467
  48. package/dist/container.js +79 -98
  49. package/dist/contextualPopup/css/contextualPopup.css +7 -7
  50. package/dist/contextualPopup/css/contextualPopup.css.map +1 -1
  51. package/dist/contextualPopup.js +417 -436
  52. package/dist/dashboard/css/dashboard.css +7 -7
  53. package/dist/dashboard/css/dashboard.css.map +1 -1
  54. package/dist/dashboard.js +302 -305
  55. package/dist/datalist/css/datalist.css +7 -7
  56. package/dist/datalist/css/datalist.css.map +1 -1
  57. package/dist/datalist.js +783 -791
  58. package/dist/datatable/css/datatable.css +11 -7
  59. package/dist/datatable/css/datatable.css.map +1 -1
  60. package/dist/datatable/filterStrategy/filterStrategy.js +28 -30
  61. package/dist/datatable/filterStrategy/multiple.js +26 -45
  62. package/dist/datatable/filterStrategy/single.js +28 -40
  63. package/dist/datatable.js +1591 -1616
  64. package/dist/dateRange/css/dateRange.css +7 -7
  65. package/dist/dateRange/css/dateRange.css.map +1 -1
  66. package/dist/dateRange/dateRange.js +398 -412
  67. package/dist/datetime/css/picker.css +7 -7
  68. package/dist/datetime/css/picker.css.map +1 -1
  69. package/dist/datetime/picker.js +670 -703
  70. package/dist/deleter.js +383 -398
  71. package/dist/destination/css/selector.css +7 -7
  72. package/dist/destination/css/selector.css.map +1 -1
  73. package/dist/destination/selector.js +295 -293
  74. package/dist/dialog/alert.js +30 -32
  75. package/dist/dialog/confirm.js +29 -32
  76. package/dist/dialog/confirmDelete.js +223 -221
  77. package/dist/dialog.js +651 -695
  78. package/dist/disabler.js +108 -119
  79. package/dist/documentViewer/css/documentViewer.css +7 -7
  80. package/dist/documentViewer/css/documentViewer.css.map +1 -1
  81. package/dist/documentViewer/providers/pdfViewer/fallback/viewer.js +172 -169
  82. package/dist/documentViewer/providers/pdfViewer/pdfjs/areaBroker.js +32 -29
  83. package/dist/documentViewer/providers/pdfViewer/pdfjs/findBar.js +523 -564
  84. package/dist/documentViewer/providers/pdfViewer/pdfjs/pageView.js +376 -393
  85. package/dist/documentViewer/providers/pdfViewer/pdfjs/pagesManager.js +53 -68
  86. package/dist/documentViewer/providers/pdfViewer/pdfjs/searchEngine.js +517 -567
  87. package/dist/documentViewer/providers/pdfViewer/pdfjs/textManager.js +73 -96
  88. package/dist/documentViewer/providers/pdfViewer/pdfjs/viewer.js +381 -392
  89. package/dist/documentViewer/providers/pdfViewer/pdfjs/wrapper.js +125 -152
  90. package/dist/documentViewer/providers/pdfViewer.js +189 -191
  91. package/dist/documentViewer/viewerFactory.js +76 -81
  92. package/dist/documentViewer.js +303 -311
  93. package/dist/dropdown/css/dropdown.css +7 -7
  94. package/dist/dropdown/css/dropdown.css.map +1 -1
  95. package/dist/dropdown.js +392 -412
  96. package/dist/durationer.js +77 -85
  97. package/dist/dynamicComponent/css/dynamicComponent.css +7 -7
  98. package/dist/dynamicComponent/css/dynamicComponent.css.map +1 -1
  99. package/dist/dynamicComponent.js +595 -630
  100. package/dist/feedback.js +365 -375
  101. package/dist/figure/FigureStateActive.js +246 -296
  102. package/dist/filesender.js +44 -54
  103. package/dist/filter.js +244 -240
  104. package/dist/form/css/dropdownForm.css +7 -7
  105. package/dist/form/css/dropdownForm.css.map +1 -1
  106. package/dist/form/css/form.css +7 -7
  107. package/dist/form/css/form.css.map +1 -1
  108. package/dist/form/dropdownForm.js +357 -362
  109. package/dist/form/form.js +703 -984
  110. package/dist/form/simpleForm.js +74 -77
  111. package/dist/form/validator/css/validator.css +7 -7
  112. package/dist/form/validator/css/validator.css.map +1 -1
  113. package/dist/form/validator/renderer.js +235 -241
  114. package/dist/form/validator/validator.js +181 -267
  115. package/dist/form/widget/css/widget.css +7 -7
  116. package/dist/form/widget/css/widget.css.map +1 -1
  117. package/dist/form/widget/definitions.js +27 -28
  118. package/dist/form/widget/loader.js +16 -16
  119. package/dist/form/widget/providers/checkBox.js +257 -264
  120. package/dist/form/widget/providers/comboBox.js +194 -193
  121. package/dist/form/widget/providers/default.js +44 -50
  122. package/dist/form/widget/providers/hidden.js +179 -176
  123. package/dist/form/widget/providers/hiddenBox.js +262 -272
  124. package/dist/form/widget/providers/radioBox.js +222 -223
  125. package/dist/form/widget/providers/textArea.js +197 -193
  126. package/dist/form/widget/providers/textBox.js +36 -37
  127. package/dist/form/widget/widget.js +480 -508
  128. package/dist/form.js +12 -17
  129. package/dist/formValidator/formValidator.js +74 -91
  130. package/dist/formValidator/highlighters/highlighter.js +43 -51
  131. package/dist/formValidator/highlighters/message.js +31 -32
  132. package/dist/formValidator/highlighters/tooltip.js +33 -35
  133. package/dist/generis/form/css/form.css +7 -7
  134. package/dist/generis/form/css/form.css.map +1 -1
  135. package/dist/generis/form/form.js +323 -331
  136. package/dist/generis/validator/css/validator.css +7 -7
  137. package/dist/generis/validator/css/validator.css.map +1 -1
  138. package/dist/generis/validator/validator.js +215 -216
  139. package/dist/generis/widget/checkBox/checkBox.js +227 -225
  140. package/dist/generis/widget/comboBox/comboBox.js +189 -183
  141. package/dist/generis/widget/css/widget.css +7 -7
  142. package/dist/generis/widget/css/widget.css.map +1 -1
  143. package/dist/generis/widget/hiddenBox/hiddenBox.js +231 -232
  144. package/dist/generis/widget/loader.js +21 -23
  145. package/dist/generis/widget/textBox/textBox.js +178 -172
  146. package/dist/generis/widget/widget.js +255 -266
  147. package/dist/groupedComboBox.js +231 -226
  148. package/dist/groupvalidator.js +30 -34
  149. package/dist/hider.js +43 -50
  150. package/dist/highlighter.js +946 -1057
  151. package/dist/image/ImgStateActive/extractLabel.js +20 -21
  152. package/dist/image/ImgStateActive/helper.js +21 -25
  153. package/dist/image/ImgStateActive/initHelper.js +133 -162
  154. package/dist/image/ImgStateActive/initMediaEditor.js +72 -92
  155. package/dist/image/ImgStateActive/mediaSizer.js +48 -58
  156. package/dist/image/ImgStateActive.js +185 -215
  157. package/dist/incrementer.js +91 -110
  158. package/dist/inplacer.js +108 -132
  159. package/dist/interactUtils.js +56 -67
  160. package/dist/itemButtonList/css/item-button-list.css +23 -24
  161. package/dist/itemButtonList/css/item-button-list.css.map +1 -1
  162. package/dist/itemButtonList.js +444 -469
  163. package/dist/keyNavigation/navigableDomElement.js +124 -158
  164. package/dist/keyNavigation/navigator.js +235 -312
  165. package/dist/listbox/css/listbox.css +7 -7
  166. package/dist/listbox/css/listbox.css.map +1 -1
  167. package/dist/listbox.js +463 -476
  168. package/dist/liststyler.js +75 -76
  169. package/dist/loadingButton/css/button.css +7 -7
  170. package/dist/loadingButton/css/button.css.map +1 -1
  171. package/dist/loadingButton/loadingButton.js +219 -218
  172. package/dist/lock.js +484 -509
  173. package/dist/login/login.js +471 -486
  174. package/dist/maths/calculator/basicCalculator.js +247 -242
  175. package/dist/maths/calculator/calculatorComponent.js +34 -36
  176. package/dist/maths/calculator/core/areaBroker.js +30 -28
  177. package/dist/maths/calculator/core/board.js +805 -872
  178. package/dist/maths/calculator/core/expression.js +500 -518
  179. package/dist/maths/calculator/core/labels.js +240 -235
  180. package/dist/maths/calculator/core/plugin.js +20 -20
  181. package/dist/maths/calculator/core/terms.js +27 -27
  182. package/dist/maths/calculator/core/tokenizer.js +119 -132
  183. package/dist/maths/calculator/core/tokens.js +157 -168
  184. package/dist/maths/calculator/css/calculator.css +7 -7
  185. package/dist/maths/calculator/css/calculator.css.map +1 -1
  186. package/dist/maths/calculator/defaultCalculator.js +24 -27
  187. package/dist/maths/calculator/plugins/core/degrad.js +22 -30
  188. package/dist/maths/calculator/plugins/core/history.js +55 -67
  189. package/dist/maths/calculator/plugins/core/remind.js +22 -25
  190. package/dist/maths/calculator/plugins/core/stepNavigation.js +33 -49
  191. package/dist/maths/calculator/plugins/keyboard/templateKeyboard/templateKeyboard.js +255 -258
  192. package/dist/maths/calculator/plugins/modifiers/pow10.js +47 -52
  193. package/dist/maths/calculator/plugins/modifiers/sign.js +103 -130
  194. package/dist/maths/calculator/plugins/screen/simpleScreen/simpleScreen.js +288 -293
  195. package/dist/maths/calculator/pluginsLoader.js +22 -22
  196. package/dist/maths/calculator/scientificCalculator.js +339 -334
  197. package/dist/mediaEditor/mediaEditorComponent.js +244 -249
  198. package/dist/mediaEditor/plugins/mediaAlignment/helper.js +28 -33
  199. package/dist/mediaEditor/plugins/mediaAlignment/mediaAlignmentComponent.js +228 -236
  200. package/dist/mediaEditor/plugins/mediaAlignment/style.css +7 -7
  201. package/dist/mediaEditor/plugins/mediaDimension/helper.js +81 -106
  202. package/dist/mediaEditor/plugins/mediaDimension/mediaDimensionComponent.js +597 -635
  203. package/dist/mediaEditor/plugins/mediaDimension/style.css +141 -141
  204. package/dist/mediaplayer/css/player.css +7 -7
  205. package/dist/mediaplayer/css/player.css.map +1 -1
  206. package/dist/mediaplayer/players/html5.js +646 -706
  207. package/dist/mediaplayer/players/youtube.js +393 -438
  208. package/dist/mediaplayer/players.js +19 -19
  209. package/dist/mediaplayer/support.js +66 -79
  210. package/dist/mediaplayer/utils/reminder.js +117 -128
  211. package/dist/mediaplayer/utils/timeObserver.js +106 -109
  212. package/dist/mediaplayer/youtubeManager.js +142 -170
  213. package/dist/mediaplayer.js +1484 -1774
  214. package/dist/mediasizer.js +633 -676
  215. package/dist/modal.js +137 -153
  216. package/dist/movableComponent.js +37 -37
  217. package/dist/pageSizeSelector.js +231 -224
  218. package/dist/pageStatus.js +43 -46
  219. package/dist/pagination/css/pagination.css +7 -7
  220. package/dist/pagination/css/pagination.css.map +1 -1
  221. package/dist/pagination/paginationStrategy.js +24 -25
  222. package/dist/pagination/providers/pages.js +281 -291
  223. package/dist/pagination/providers/simple.js +202 -196
  224. package/dist/pagination.js +49 -72
  225. package/dist/previewer.js +113 -138
  226. package/dist/progressbar.js +70 -80
  227. package/dist/propertySelector/css/propertySelector.css +74 -0
  228. package/dist/propertySelector/css/propertySelector.css.map +1 -0
  229. package/dist/propertySelector/propertySelector.js +489 -0
  230. package/dist/report.js +356 -359
  231. package/dist/resource/css/selector.css +7 -7
  232. package/dist/resource/css/selector.css.map +1 -1
  233. package/dist/resource/filters.js +275 -289
  234. package/dist/resource/list.js +1589 -1371
  235. package/dist/resource/selectable.js +101 -136
  236. package/dist/resource/selector.js +855 -914
  237. package/dist/resource/tree.js +1796 -1612
  238. package/dist/resourcemgr/css/resourcemgr.css +7 -7
  239. package/dist/resourcemgr/css/resourcemgr.css.map +1 -1
  240. package/dist/resourcemgr/fileBrowser.js +540 -587
  241. package/dist/resourcemgr/filePreview.js +16 -25
  242. package/dist/resourcemgr/fileSelector.js +520 -547
  243. package/dist/resourcemgr/util/updatePermissions.js +10 -18
  244. package/dist/resourcemgr.js +325 -332
  245. package/dist/scroller.js +29 -33
  246. package/dist/searchModal/advancedSearch.js +949 -833
  247. package/dist/searchModal/css/advancedSearch.css +7 -14
  248. package/dist/searchModal/css/advancedSearch.css.map +1 -1
  249. package/dist/searchModal/css/searchModal.css +28 -8
  250. package/dist/searchModal/css/searchModal.css.map +1 -1
  251. package/dist/searchModal.js +616 -335
  252. package/dist/selecter.js +21 -28
  253. package/dist/stacker.js +52 -60
  254. package/dist/switch/css/switch.css +7 -7
  255. package/dist/switch/css/switch.css.map +1 -1
  256. package/dist/switch/switch.js +305 -311
  257. package/dist/tableModel.js +39 -49
  258. package/dist/tabs/css/tabs.css +12 -12
  259. package/dist/tabs/css/tabs.css.map +1 -1
  260. package/dist/tabs.js +588 -639
  261. package/dist/taskQueue/css/taskQueue.css +7 -7
  262. package/dist/taskQueue/css/taskQueue.css.map +1 -1
  263. package/dist/taskQueue/status.js +317 -322
  264. package/dist/taskQueue/table.js +383 -394
  265. package/dist/taskQueue/taskQueue.js +19 -19
  266. package/dist/taskQueue/taskQueueModel.js +459 -538
  267. package/dist/taskQueue.js +49 -67
  268. package/dist/taskQueueButton/css/taskable.css +7 -7
  269. package/dist/taskQueueButton/css/taskable.css.map +1 -1
  270. package/dist/taskQueueButton/css/treeButton.css +7 -7
  271. package/dist/taskQueueButton/css/treeButton.css.map +1 -1
  272. package/dist/taskQueueButton/standardButton.js +45 -43
  273. package/dist/taskQueueButton/taskable.js +267 -272
  274. package/dist/taskQueueButton/treeButton.js +200 -198
  275. package/dist/themeLoader.js +109 -129
  276. package/dist/themes.js +86 -100
  277. package/dist/toggler.js +76 -88
  278. package/dist/tooltip.js +296 -311
  279. package/dist/tooltipster.js +17 -17
  280. package/dist/transformer.js +140 -169
  281. package/dist/tristateCheckboxGroup/css/tristateCheckboxGroup.css +7 -7
  282. package/dist/tristateCheckboxGroup/css/tristateCheckboxGroup.css.map +1 -1
  283. package/dist/tristateCheckboxGroup.js +319 -325
  284. package/dist/uploader.js +691 -724
  285. package/dist/validator/Report.js +1 -2
  286. package/dist/validator/Validator.js +6 -25
  287. package/dist/validator/validators.js +66 -80
  288. package/dist/validator.js +218 -254
  289. package/dist/waitForMedia.js +45 -51
  290. package/dist/waitingDialog/css/waitingDialog.css +7 -7
  291. package/dist/waitingDialog/css/waitingDialog.css.map +1 -1
  292. package/dist/waitingDialog/waitingDialog.js +59 -77
  293. package/package.json +109 -107
  294. package/scss/basic.scss +16 -16
  295. package/scss/ckeditor/skins/tao/scss/inc/_ck-icons.scss +59 -59
  296. package/scss/ckeditor/skins/tao/scss/inc/_tao.scss +59 -59
  297. package/scss/font/tao/tao.svg +234 -234
  298. package/scss/inc/_base.scss +495 -495
  299. package/scss/inc/_bootstrap.scss +6 -6
  300. package/scss/inc/_buttons.scss +114 -114
  301. package/scss/inc/_colors.scss +93 -88
  302. package/scss/inc/_feedback.scss +150 -150
  303. package/scss/inc/_flex-grid.scss +15 -15
  304. package/scss/inc/_fonts.scss +4 -4
  305. package/scss/inc/_forms.scss +832 -832
  306. package/scss/inc/_functions.scss +283 -283
  307. package/scss/inc/_jquery.nouislider.scss +254 -254
  308. package/scss/inc/_normalize.scss +528 -528
  309. package/scss/inc/_report.scss +67 -67
  310. package/scss/inc/_secondary-properties.scss +89 -89
  311. package/scss/inc/_select2.scss +634 -634
  312. package/scss/inc/_toolbars.scss +155 -155
  313. package/scss/inc/_tooltip.scss +312 -312
  314. package/scss/inc/_variables.scss +21 -21
  315. package/scss/inc/base/_highlight.scss +5 -5
  316. package/scss/inc/base/_list-style.scss +58 -58
  317. package/scss/inc/base/_svg.scss +3 -3
  318. package/scss/inc/base/_table.scss +62 -62
  319. package/scss/inc/fonts/_source-sans-pro.scss +29 -29
  320. package/scss/inc/fonts/_tao-icon-classes.scss +226 -226
  321. package/scss/inc/fonts/_tao-icon-def.scss +12 -12
  322. package/scss/inc/fonts/_tao-icon-vars.scss +240 -240
  323. package/src/actionbar/tpl/main.tpl +8 -8
  324. package/src/actionbar.js +251 -251
  325. package/src/adder.js +250 -250
  326. package/src/animable/absorbable/absorbable.js +134 -134
  327. package/src/animable/absorbable/css/absorb.css +7 -8
  328. package/src/animable/absorbable/css/absorb.css.map +1 -1
  329. package/src/animable/absorbable/scss/absorb.scss +37 -37
  330. package/src/animable/pulsable/css/pulse.css +7 -7
  331. package/src/animable/pulsable/css/pulse.css.map +1 -1
  332. package/src/animable/pulsable/pulsable.js +90 -90
  333. package/src/animable/pulsable/scss/pulse.scss +22 -22
  334. package/src/areaBroker.js +160 -160
  335. package/src/autocomplete/css/autocomplete.css +7 -8
  336. package/src/autocomplete/css/autocomplete.css.map +1 -1
  337. package/src/autocomplete/scss/autocomplete.scss +37 -37
  338. package/src/autocomplete.js +1029 -1029
  339. package/src/autoscroll.js +57 -57
  340. package/src/badge/badge.js +119 -119
  341. package/src/badge/css/badge.css +7 -8
  342. package/src/badge/css/badge.css.map +1 -1
  343. package/src/badge/scss/badge.scss +92 -92
  344. package/src/badge/tpl/badge.tpl +4 -4
  345. package/src/breadcrumbs/css/breadcrumbs.css +7 -7
  346. package/src/breadcrumbs/css/breadcrumbs.css.map +1 -1
  347. package/src/breadcrumbs/scss/breadcrumbs.scss +52 -52
  348. package/src/breadcrumbs/tpl/breadcrumbs.tpl +20 -20
  349. package/src/breadcrumbs.js +99 -99
  350. package/src/btngrouper.js +213 -213
  351. package/src/bulkActionPopup/css/bulkActionPopup.css +7 -7
  352. package/src/bulkActionPopup/css/bulkActionPopup.css.map +1 -1
  353. package/src/bulkActionPopup/scss/bulkActionPopup.scss +63 -63
  354. package/src/bulkActionPopup/tpl/layout.tpl +76 -76
  355. package/src/bulkActionPopup/tpl/select.tpl +8 -8
  356. package/src/bulkActionPopup.js +274 -274
  357. package/src/button/tpl/button.tpl +4 -4
  358. package/src/button.js +135 -135
  359. package/src/calculator/css/calculator.css +10 -10
  360. package/src/calculator/css/calculator.css.map +1 -1
  361. package/src/calculator/scss/calculator.scss +139 -139
  362. package/src/calculator.js +188 -188
  363. package/src/cascadingComboBox.js +126 -126
  364. package/src/ckeditor/ckConfigurator.js +736 -736
  365. package/src/ckeditor/dtdHandler.js +1030 -1030
  366. package/src/class/css/selector.css +7 -7
  367. package/src/class/css/selector.css.map +1 -1
  368. package/src/class/scss/selector.scss +101 -101
  369. package/src/class/selector.js +329 -329
  370. package/src/class/tpl/listItem.tpl +9 -9
  371. package/src/class/tpl/selector.tpl +10 -10
  372. package/src/component/alignable.js +274 -274
  373. package/src/component/containable.js +122 -122
  374. package/src/component/css/components.css +7 -7
  375. package/src/component/css/components.css.map +1 -1
  376. package/src/component/css/windowComponent.css +7 -7
  377. package/src/component/css/windowComponent.css.map +1 -1
  378. package/src/component/draggable.js +104 -104
  379. package/src/component/placeable.js +233 -233
  380. package/src/component/resizable.js +195 -195
  381. package/src/component/scss/components.scss +507 -507
  382. package/src/component/scss/windowComponent.scss +62 -62
  383. package/src/component/stackable.js +67 -67
  384. package/src/component/tpl/window.tpl +7 -7
  385. package/src/component/windowed.js +206 -206
  386. package/src/component.js +401 -401
  387. package/src/container.js +200 -200
  388. package/src/contextualPopup/css/contextualPopup.css +7 -7
  389. package/src/contextualPopup/css/contextualPopup.css.map +1 -1
  390. package/src/contextualPopup/scss/contextualPopup.scss +78 -78
  391. package/src/contextualPopup/tpl/popup.tpl +10 -10
  392. package/src/contextualPopup.js +297 -297
  393. package/src/css/basic.css +103 -106
  394. package/src/css/basic.css.map +1 -1
  395. package/src/dashboard/css/dashboard.css +7 -7
  396. package/src/dashboard/css/dashboard.css.map +1 -1
  397. package/src/dashboard/scss/dashboard.scss +93 -93
  398. package/src/dashboard/tpl/dashboard.tpl +16 -16
  399. package/src/dashboard/tpl/dashboardMetricsList.tpl +15 -15
  400. package/src/dashboard.js +184 -184
  401. package/src/datalist/css/datalist.css +7 -7
  402. package/src/datalist/css/datalist.css.map +1 -1
  403. package/src/datalist/scss/datalist.scss +116 -116
  404. package/src/datalist/tpl/list.tpl +24 -24
  405. package/src/datalist/tpl/main.tpl +44 -44
  406. package/src/datalist.js +500 -500
  407. package/src/datatable/css/datatable.css +11 -7
  408. package/src/datatable/css/datatable.css.map +1 -1
  409. package/src/datatable/filterStrategy/filterStrategy.js +70 -70
  410. package/src/datatable/filterStrategy/multiple.js +126 -126
  411. package/src/datatable/filterStrategy/single.js +108 -108
  412. package/src/datatable/scss/datatable.scss +149 -146
  413. package/src/datatable/tpl/button.tpl +6 -6
  414. package/src/datatable/tpl/layout.tpl +158 -158
  415. package/src/datatable.js +1056 -1056
  416. package/src/dateRange/css/dateRange.css +7 -7
  417. package/src/dateRange/css/dateRange.css.map +1 -1
  418. package/src/dateRange/dateRange.js +341 -341
  419. package/src/dateRange/scss/dateRange.scss +7 -7
  420. package/src/dateRange/tpl/select.tpl +18 -18
  421. package/src/datetime/css/picker.css +7 -7
  422. package/src/datetime/css/picker.css.map +1 -1
  423. package/src/datetime/picker.js +576 -576
  424. package/src/datetime/scss/picker.scss +192 -192
  425. package/src/datetime/tpl/picker.tpl +18 -18
  426. package/src/deleter/undo.tpl +6 -6
  427. package/src/deleter.js +296 -296
  428. package/src/destination/css/selector.css +7 -7
  429. package/src/destination/css/selector.css.map +1 -1
  430. package/src/destination/scss/selector.scss +36 -36
  431. package/src/destination/selector.js +195 -195
  432. package/src/destination/tpl/selector.tpl +13 -13
  433. package/src/dialog/alert.js +70 -70
  434. package/src/dialog/confirm.js +85 -85
  435. package/src/dialog/confirmDelete.js +95 -95
  436. package/src/dialog/tpl/body.tpl +24 -24
  437. package/src/dialog/tpl/buttons.tpl +6 -6
  438. package/src/dialog/tpl/checkbox.tpl +5 -5
  439. package/src/dialog.js +517 -517
  440. package/src/disabler.js +230 -230
  441. package/src/documentViewer/css/documentViewer.css +7 -7
  442. package/src/documentViewer/css/documentViewer.css.map +1 -1
  443. package/src/documentViewer/providers/pdfViewer/fallback/viewer.js +69 -69
  444. package/src/documentViewer/providers/pdfViewer/pdfjs/areaBroker.js +41 -41
  445. package/src/documentViewer/providers/pdfViewer/pdfjs/findBar.js +475 -475
  446. package/src/documentViewer/providers/pdfViewer/pdfjs/findBar.tpl +20 -20
  447. package/src/documentViewer/providers/pdfViewer/pdfjs/match.tpl +1 -1
  448. package/src/documentViewer/providers/pdfViewer/pdfjs/page.tpl +4 -4
  449. package/src/documentViewer/providers/pdfViewer/pdfjs/pageView.js +318 -318
  450. package/src/documentViewer/providers/pdfViewer/pdfjs/pagesManager.js +167 -167
  451. package/src/documentViewer/providers/pdfViewer/pdfjs/searchEngine.js +451 -451
  452. package/src/documentViewer/providers/pdfViewer/pdfjs/textManager.js +252 -252
  453. package/src/documentViewer/providers/pdfViewer/pdfjs/viewer.js +299 -299
  454. package/src/documentViewer/providers/pdfViewer/pdfjs/viewer.tpl +16 -16
  455. package/src/documentViewer/providers/pdfViewer/pdfjs/wrapper.js +351 -351
  456. package/src/documentViewer/providers/pdfViewer.js +93 -93
  457. package/src/documentViewer/scss/documentViewer.scss +184 -184
  458. package/src/documentViewer/viewerFactory.js +191 -191
  459. package/src/documentViewer.js +238 -238
  460. package/src/dropdown/css/dropdown.css +7 -7
  461. package/src/dropdown/css/dropdown.css.map +1 -1
  462. package/src/dropdown/scss/dropdown.scss +99 -99
  463. package/src/dropdown/tpl/dropdown.tpl +8 -8
  464. package/src/dropdown/tpl/list-item.tpl +4 -4
  465. package/src/dropdown.js +255 -255
  466. package/src/durationer.js +222 -222
  467. package/src/dynamicComponent/css/dynamicComponent.css +7 -7
  468. package/src/dynamicComponent/css/dynamicComponent.css.map +1 -1
  469. package/src/dynamicComponent/scss/dynamicComponent.scss +98 -98
  470. package/src/dynamicComponent/tpl/layout.tpl +17 -17
  471. package/src/dynamicComponent.js +554 -554
  472. package/src/feedback/feedback.tpl +7 -7
  473. package/src/feedback.js +295 -295
  474. package/src/figure/FigureStateActive.js +174 -174
  475. package/src/filesender.js +114 -114
  476. package/src/filter/template.tpl +5 -5
  477. package/src/filter.js +135 -135
  478. package/src/form/css/dropdownForm.css +7 -7
  479. package/src/form/css/dropdownForm.css.map +1 -1
  480. package/src/form/css/form.css +7 -7
  481. package/src/form/css/form.css.map +1 -1
  482. package/src/form/dropdownForm.js +281 -281
  483. package/src/form/form.js +688 -688
  484. package/src/form/scss/dropdownForm.scss +60 -60
  485. package/src/form/scss/form.scss +25 -25
  486. package/src/form/simpleForm.js +125 -125
  487. package/src/form/tpl/dropdownForm.tpl +4 -4
  488. package/src/form/tpl/form.tpl +7 -7
  489. package/src/form/validator/css/validator.css +7 -7
  490. package/src/form/validator/css/validator.css.map +1 -1
  491. package/src/form/validator/renderer.js +118 -118
  492. package/src/form/validator/scss/validator.scss +14 -14
  493. package/src/form/validator/tpl/message.tpl +1 -1
  494. package/src/form/validator/tpl/validator.tpl +1 -1
  495. package/src/form/validator/validator.js +220 -220
  496. package/src/form/widget/css/widget.css +7 -7
  497. package/src/form/widget/css/widget.css.map +1 -1
  498. package/src/form/widget/definitions.js +51 -51
  499. package/src/form/widget/loader.js +40 -40
  500. package/src/form/widget/providers/checkBox.js +138 -138
  501. package/src/form/widget/providers/comboBox.js +63 -63
  502. package/src/form/widget/providers/default.js +90 -90
  503. package/src/form/widget/providers/hidden.js +62 -62
  504. package/src/form/widget/providers/hiddenBox.js +152 -152
  505. package/src/form/widget/providers/radioBox.js +99 -99
  506. package/src/form/widget/providers/textArea.js +52 -52
  507. package/src/form/widget/providers/textBox.js +48 -48
  508. package/src/form/widget/scss/widget.scss +55 -55
  509. package/src/form/widget/tpl/checkBox.tpl +25 -25
  510. package/src/form/widget/tpl/comboBox.tpl +13 -13
  511. package/src/form/widget/tpl/hidden.tpl +1 -1
  512. package/src/form/widget/tpl/hiddenBox.tpl +17 -17
  513. package/src/form/widget/tpl/label.tpl +6 -6
  514. package/src/form/widget/tpl/radioBox.tpl +25 -25
  515. package/src/form/widget/tpl/textArea.tpl +8 -8
  516. package/src/form/widget/tpl/widget.tpl +8 -8
  517. package/src/form/widget/widget.js +372 -372
  518. package/src/form.js +53 -53
  519. package/src/formValidator/formValidator.js +253 -253
  520. package/src/formValidator/highlighters/highlighter.js +102 -102
  521. package/src/formValidator/highlighters/message.js +70 -70
  522. package/src/formValidator/highlighters/tooltip.js +78 -78
  523. package/src/generis/form/css/form.css +7 -7
  524. package/src/generis/form/css/form.css.map +1 -1
  525. package/src/generis/form/form.js +239 -239
  526. package/src/generis/form/readme.md +70 -70
  527. package/src/generis/form/scss/form.scss +23 -23
  528. package/src/generis/form/tpl/form.tpl +16 -16
  529. package/src/generis/validator/css/validator.css +7 -7
  530. package/src/generis/validator/css/validator.css.map +1 -1
  531. package/src/generis/validator/readme.md +46 -46
  532. package/src/generis/validator/scss/validator.scss +13 -13
  533. package/src/generis/validator/validator.js +128 -128
  534. package/src/generis/widget/checkBox/checkBox.js +112 -112
  535. package/src/generis/widget/checkBox/checkBox.tpl +18 -18
  536. package/src/generis/widget/comboBox/comboBox.js +67 -67
  537. package/src/generis/widget/comboBox/comboBox.tpl +12 -12
  538. package/src/generis/widget/css/widget.css +7 -7
  539. package/src/generis/widget/css/widget.css.map +1 -1
  540. package/src/generis/widget/hiddenBox/hiddenBox.js +132 -132
  541. package/src/generis/widget/hiddenBox/hiddenBox.tpl +16 -16
  542. package/src/generis/widget/loader.js +49 -49
  543. package/src/generis/widget/readme.md +59 -59
  544. package/src/generis/widget/scss/widget.scss +61 -61
  545. package/src/generis/widget/textBox/textBox.js +65 -65
  546. package/src/generis/widget/textBox/textBox.tpl +7 -7
  547. package/src/generis/widget/widget.js +164 -164
  548. package/src/generis/widget/widget.tpl +5 -5
  549. package/src/groupedComboBox.js +99 -99
  550. package/src/groupvalidator.js +84 -84
  551. package/src/hider.js +88 -88
  552. package/src/highlighter.js +1166 -1166
  553. package/src/image/ImgStateActive/extractLabel.js +29 -29
  554. package/src/image/ImgStateActive/helper.js +36 -36
  555. package/src/image/ImgStateActive/initHelper.js +137 -137
  556. package/src/image/ImgStateActive/initMediaEditor.js +92 -92
  557. package/src/image/ImgStateActive/mediaSizer.js +63 -63
  558. package/src/image/ImgStateActive.js +115 -115
  559. package/src/incrementer.js +319 -319
  560. package/src/inplacer.js +316 -316
  561. package/src/interactUtils.js +140 -140
  562. package/src/itemButtonList/css/item-button-list.css +23 -24
  563. package/src/itemButtonList/css/item-button-list.css.map +1 -1
  564. package/src/itemButtonList/scss/item-button-list.scss +236 -236
  565. package/src/itemButtonList/tpl/itemButtonList.tpl +21 -21
  566. package/src/itemButtonList.js +274 -274
  567. package/src/keyNavigation/navigableDomElement.js +282 -282
  568. package/src/keyNavigation/navigator.js +543 -543
  569. package/src/listbox/css/listbox.css +7 -7
  570. package/src/listbox/css/listbox.css.map +1 -1
  571. package/src/listbox/scss/listbox.scss +116 -116
  572. package/src/listbox/tpl/list.tpl +14 -14
  573. package/src/listbox/tpl/main.tpl +9 -9
  574. package/src/listbox.js +251 -251
  575. package/src/liststyler.js +155 -155
  576. package/src/loadingButton/css/button.css +7 -7
  577. package/src/loadingButton/css/button.css.map +1 -1
  578. package/src/loadingButton/loadingButton.js +110 -110
  579. package/src/loadingButton/scss/button.scss +41 -41
  580. package/src/loadingButton/tpl/button.tpl +5 -5
  581. package/src/lock/lock.tpl +16 -16
  582. package/src/lock.js +395 -395
  583. package/src/login/login.js +322 -322
  584. package/src/login/tpl/login.tpl +29 -29
  585. package/src/login/tpl/passwordReveal.tpl +7 -7
  586. package/src/maths/calculator/basicCalculator.js +55 -55
  587. package/src/maths/calculator/calculatorComponent.js +128 -128
  588. package/src/maths/calculator/core/areaBroker.js +38 -38
  589. package/src/maths/calculator/core/board.js +841 -841
  590. package/src/maths/calculator/core/expression.js +430 -430
  591. package/src/maths/calculator/core/labels.js +116 -116
  592. package/src/maths/calculator/core/plugin.js +40 -40
  593. package/src/maths/calculator/core/terms.js +459 -459
  594. package/src/maths/calculator/core/tokenizer.js +245 -245
  595. package/src/maths/calculator/core/tokens.js +178 -178
  596. package/src/maths/calculator/core/tpl/board.tpl +4 -4
  597. package/src/maths/calculator/css/calculator.css +7 -7
  598. package/src/maths/calculator/css/calculator.css.map +1 -1
  599. package/src/maths/calculator/defaultCalculator.js +66 -66
  600. package/src/maths/calculator/plugins/core/degrad.js +90 -90
  601. package/src/maths/calculator/plugins/core/history.js +166 -166
  602. package/src/maths/calculator/plugins/core/remind.js +96 -96
  603. package/src/maths/calculator/plugins/core/stepNavigation.js +175 -175
  604. package/src/maths/calculator/plugins/keyboard/templateKeyboard/defaultTemplate.tpl +36 -36
  605. package/src/maths/calculator/plugins/keyboard/templateKeyboard/templateKeyboard.js +91 -91
  606. package/src/maths/calculator/plugins/modifiers/pow10.js +143 -143
  607. package/src/maths/calculator/plugins/modifiers/sign.js +339 -339
  608. package/src/maths/calculator/plugins/screen/simpleScreen/defaultTemplate.tpl +3 -3
  609. package/src/maths/calculator/plugins/screen/simpleScreen/history.tpl +3 -3
  610. package/src/maths/calculator/plugins/screen/simpleScreen/simpleScreen.js +191 -191
  611. package/src/maths/calculator/pluginsLoader.js +46 -46
  612. package/src/maths/calculator/scientificCalculator.js +74 -74
  613. package/src/maths/calculator/scss/calculator.scss +396 -396
  614. package/src/maths/calculator/tpl/basicKeyboard.tpl +37 -37
  615. package/src/maths/calculator/tpl/basicScreen.tpl +2 -2
  616. package/src/maths/calculator/tpl/scientificKeyboard.tpl +61 -61
  617. package/src/maths/calculator/tpl/scientificScreen.tpl +3 -3
  618. package/src/mediaEditor/mediaEditorComponent.js +141 -141
  619. package/src/mediaEditor/plugins/mediaAlignment/helper.js +62 -62
  620. package/src/mediaEditor/plugins/mediaAlignment/mediaAlignmentComponent.js +99 -99
  621. package/src/mediaEditor/plugins/mediaAlignment/style.css +7 -7
  622. package/src/mediaEditor/plugins/mediaAlignment/tpl/mediaAlignment.tpl +25 -25
  623. package/src/mediaEditor/plugins/mediaDimension/helper.js +189 -189
  624. package/src/mediaEditor/plugins/mediaDimension/mediaDimensionComponent.js +561 -561
  625. package/src/mediaEditor/plugins/mediaDimension/style.css +141 -141
  626. package/src/mediaEditor/plugins/mediaDimension/tpl/mediaDimension.tpl +55 -55
  627. package/src/mediaEditor/tpl/editor.tpl +4 -4
  628. package/src/mediaplayer/css/player.css +7 -7
  629. package/src/mediaplayer/css/player.css.map +1 -1
  630. package/src/mediaplayer/players/html5.js +564 -564
  631. package/src/mediaplayer/players/youtube.js +323 -323
  632. package/src/mediaplayer/players.js +29 -29
  633. package/src/mediaplayer/readme.md +305 -305
  634. package/src/mediaplayer/scss/player.scss +569 -569
  635. package/src/mediaplayer/support.js +126 -126
  636. package/src/mediaplayer/tpl/audio.tpl +6 -6
  637. package/src/mediaplayer/tpl/player.tpl +37 -37
  638. package/src/mediaplayer/tpl/source.tpl +1 -1
  639. package/src/mediaplayer/tpl/video.tpl +6 -6
  640. package/src/mediaplayer/tpl/youtube.tpl +1 -1
  641. package/src/mediaplayer/utils/reminder.js +184 -184
  642. package/src/mediaplayer/utils/timeObserver.js +143 -143
  643. package/src/mediaplayer/youtubeManager.js +161 -161
  644. package/src/mediaplayer.js +1606 -1606
  645. package/src/mediasizer/mediasizer.tpl +55 -55
  646. package/src/mediasizer.js +635 -635
  647. package/src/modal.js +365 -365
  648. package/src/movableComponent.js +78 -78
  649. package/src/pageSizeSelector/tpl/pageSizeSelector.tpl +9 -9
  650. package/src/pageSizeSelector.js +107 -107
  651. package/src/pageStatus.js +147 -147
  652. package/src/pagination/css/pagination.css +7 -7
  653. package/src/pagination/css/pagination.css.map +1 -1
  654. package/src/pagination/paginationStrategy.js +53 -53
  655. package/src/pagination/providers/pages.js +161 -161
  656. package/src/pagination/providers/simple.js +74 -74
  657. package/src/pagination/providers/tpl/pages/page.tpl +1 -1
  658. package/src/pagination/providers/tpl/pages.tpl +8 -8
  659. package/src/pagination/providers/tpl/simple.tpl +7 -7
  660. package/src/pagination/scss/pagination.scss +111 -111
  661. package/src/pagination.js +237 -237
  662. package/src/previewer.js +300 -300
  663. package/src/progressbar.js +165 -165
  664. package/src/propertySelector/css/propertySelector.css +74 -0
  665. package/src/propertySelector/css/propertySelector.css.map +1 -0
  666. package/src/propertySelector/propertySelector.js +286 -0
  667. package/src/propertySelector/scss/propertySelector.scss +66 -0
  668. package/src/propertySelector/tpl/highlighted-text.tpl +1 -0
  669. package/src/propertySelector/tpl/property-description.tpl +13 -0
  670. package/src/propertySelector/tpl/property-selector.tpl +7 -0
  671. package/src/report/feedback.tpl +11 -11
  672. package/src/report/layout.tpl +10 -10
  673. package/src/report.js +184 -184
  674. package/src/resource/css/selector.css +7 -7
  675. package/src/resource/css/selector.css.map +1 -1
  676. package/src/resource/filters.js +208 -208
  677. package/src/resource/list.js +200 -200
  678. package/src/resource/scss/_filters.scss +26 -26
  679. package/src/resource/scss/_resource-list.scss +107 -107
  680. package/src/resource/scss/_resource-tree.scss +205 -205
  681. package/src/resource/scss/selector.scss +187 -187
  682. package/src/resource/selectable.js +322 -322
  683. package/src/resource/selector.js +871 -871
  684. package/src/resource/tpl/filters.tpl +2 -2
  685. package/src/resource/tpl/list.tpl +7 -7
  686. package/src/resource/tpl/listNode.tpl +4 -4
  687. package/src/resource/tpl/selector.tpl +46 -46
  688. package/src/resource/tpl/tree.tpl +4 -4
  689. package/src/resource/tpl/treeNode.tpl +30 -30
  690. package/src/resource/tree.js +400 -400
  691. package/src/resourcemgr/css/resourcemgr.css +7 -7
  692. package/src/resourcemgr/css/resourcemgr.css.map +1 -1
  693. package/src/resourcemgr/fileBrowser.js +381 -381
  694. package/src/resourcemgr/filePreview.js +73 -73
  695. package/src/resourcemgr/fileSelector.js +348 -348
  696. package/src/resourcemgr/scss/resourcemgr.scss +254 -254
  697. package/src/resourcemgr/tpl/fileSelect.tpl +39 -39
  698. package/src/resourcemgr/tpl/folder.tpl +11 -11
  699. package/src/resourcemgr/tpl/layout.tpl +84 -84
  700. package/src/resourcemgr/tpl/rootFolder.tpl +13 -13
  701. package/src/resourcemgr/util/updatePermissions.js +53 -53
  702. package/src/resourcemgr.js +216 -216
  703. package/src/scroller.js +94 -94
  704. package/src/scss/basic.scss +16 -16
  705. package/src/searchModal/advancedSearch.js +638 -601
  706. package/src/searchModal/css/advancedSearch.css +7 -14
  707. package/src/searchModal/css/advancedSearch.css.map +1 -1
  708. package/src/searchModal/css/searchModal.css +28 -8
  709. package/src/searchModal/css/searchModal.css.map +1 -1
  710. package/src/searchModal/scss/advancedSearch.scss +171 -177
  711. package/src/searchModal/scss/searchModal.scss +393 -375
  712. package/src/searchModal/tpl/advanced-search.tpl +9 -9
  713. package/src/searchModal/tpl/criteria-alias.tpl +1 -0
  714. package/src/searchModal/tpl/criteria-class-label.tpl +1 -0
  715. package/src/searchModal/tpl/criteria-label.tpl +1 -0
  716. package/src/searchModal/tpl/highlighted-text.tpl +1 -0
  717. package/src/searchModal/tpl/info-message.tpl +3 -3
  718. package/src/searchModal/tpl/invalid-criteria-warning.tpl +10 -10
  719. package/src/searchModal/tpl/layout.tpl +27 -25
  720. package/src/searchModal/tpl/list-checkbox-criterion.tpl +17 -12
  721. package/src/searchModal/tpl/list-select-criterion.tpl +12 -6
  722. package/src/searchModal/tpl/property-select-button.tpl +1 -0
  723. package/src/searchModal/tpl/results-container.tpl +1 -0
  724. package/src/searchModal/tpl/text-criterion.tpl +11 -6
  725. package/src/searchModal.js +761 -496
  726. package/src/selecter.js +43 -43
  727. package/src/stacker.js +133 -133
  728. package/src/switch/css/switch.css +7 -7
  729. package/src/switch/css/switch.css.map +1 -1
  730. package/src/switch/scss/switch.scss +83 -83
  731. package/src/switch/switch.js +195 -195
  732. package/src/switch/tpl/switch.tpl +7 -7
  733. package/src/tableModel.js +112 -112
  734. package/src/tabs/css/tabs.css +12 -12
  735. package/src/tabs/css/tabs.css.map +1 -1
  736. package/src/tabs/scss/tabs.scss +50 -50
  737. package/src/tabs/tpl/panel.tpl +3 -3
  738. package/src/tabs/tpl/tabs.tpl +10 -10
  739. package/src/tabs.js +528 -528
  740. package/src/taskQueue/css/taskQueue.css +7 -7
  741. package/src/taskQueue/css/taskQueue.css.map +1 -1
  742. package/src/taskQueue/scss/taskQueue.scss +47 -47
  743. package/src/taskQueue/status.js +228 -228
  744. package/src/taskQueue/table.js +350 -350
  745. package/src/taskQueue/taskQueue.js +33 -33
  746. package/src/taskQueue/taskQueueModel.js +548 -548
  747. package/src/taskQueue/tpl/statusMessage.tpl +7 -7
  748. package/src/taskQueue.js +218 -218
  749. package/src/taskQueueButton/css/taskable.css +7 -7
  750. package/src/taskQueueButton/css/taskable.css.map +1 -1
  751. package/src/taskQueueButton/css/treeButton.css +7 -7
  752. package/src/taskQueueButton/css/treeButton.css.map +1 -1
  753. package/src/taskQueueButton/scss/taskable.scss +4 -4
  754. package/src/taskQueueButton/scss/treeButton.scss +34 -34
  755. package/src/taskQueueButton/standardButton.js +108 -108
  756. package/src/taskQueueButton/taskable.js +202 -202
  757. package/src/taskQueueButton/tpl/report.tpl +5 -5
  758. package/src/taskQueueButton/tpl/treeButton.tpl +6 -6
  759. package/src/taskQueueButton/treeButton.js +109 -109
  760. package/src/themeLoader.js +252 -252
  761. package/src/themes.js +162 -162
  762. package/src/toggler.js +200 -200
  763. package/src/tooltip/default.tpl +3 -3
  764. package/src/tooltip.js +160 -160
  765. package/src/tooltipster.js +25 -25
  766. package/src/transformer.js +327 -327
  767. package/src/tristateCheckboxGroup/css/tristateCheckboxGroup.css +7 -7
  768. package/src/tristateCheckboxGroup/css/tristateCheckboxGroup.css.map +1 -1
  769. package/src/tristateCheckboxGroup/scss/tristateCheckboxGroup.scss +15 -15
  770. package/src/tristateCheckboxGroup/tpl/li.tpl +6 -6
  771. package/src/tristateCheckboxGroup.js +207 -207
  772. package/src/uploader/fileEntry.tpl +6 -6
  773. package/src/uploader/uploader.tpl +32 -32
  774. package/src/uploader.js +594 -594
  775. package/src/validator/Report.js +10 -10
  776. package/src/validator/Validator.js +108 -108
  777. package/src/validator/validators.js +220 -220
  778. package/src/validator.js +264 -264
  779. package/src/waitForMedia.js +82 -82
  780. package/src/waitingDialog/css/waitingDialog.css +7 -7
  781. package/src/waitingDialog/css/waitingDialog.css.map +1 -1
  782. package/src/waitingDialog/scss/waitingDialog.scss +34 -34
  783. package/src/waitingDialog/waitingDialog.js +240 -240
@@ -1,1609 +1,1827 @@
1
1
  define(['jquery', 'lodash', 'ui/component', 'ui/resource/selectable', 'ui/hider', 'handlebars', 'i18n', 'lib/dompurify/purify'], function ($$1, _, component, selectable, hider, Handlebars, __, DOMPurify) { 'use strict';
2
2
 
3
- $$1 = $$1 && Object.prototype.hasOwnProperty.call($$1, 'default') ? $$1['default'] : $$1;
4
- _ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _;
5
- component = component && Object.prototype.hasOwnProperty.call(component, 'default') ? component['default'] : component;
6
- selectable = selectable && Object.prototype.hasOwnProperty.call(selectable, 'default') ? selectable['default'] : selectable;
7
- hider = hider && Object.prototype.hasOwnProperty.call(hider, 'default') ? hider['default'] : hider;
8
- Handlebars = Handlebars && Object.prototype.hasOwnProperty.call(Handlebars, 'default') ? Handlebars['default'] : Handlebars;
9
- __ = __ && Object.prototype.hasOwnProperty.call(__, 'default') ? __['default'] : __;
10
- DOMPurify = DOMPurify && Object.prototype.hasOwnProperty.call(DOMPurify, 'default') ? DOMPurify['default'] : DOMPurify;
11
-
12
- function _typeof(obj) {
13
- "@babel/helpers - typeof";
14
-
15
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
16
- return typeof obj;
17
- } : function (obj) {
18
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
19
- }, _typeof(obj);
20
- }
21
-
22
- function Helpers0 (hb) {
23
- //register a i18n helper
24
- hb.registerHelper('__', function (key) {
25
- return __(key);
26
- });
27
- /**
28
- * Register dompurify helper
29
- *
30
- * https://github.com/cure53/DOMPurify
31
- * with config SAFE_FOR_TEMPLATES: true
32
- * to make output safe for template systems
33
- */
3
+ $$1 = $$1 && Object.prototype.hasOwnProperty.call($$1, 'default') ? $$1['default'] : $$1;
4
+ _ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _;
5
+ component = component && Object.prototype.hasOwnProperty.call(component, 'default') ? component['default'] : component;
6
+ selectable = selectable && Object.prototype.hasOwnProperty.call(selectable, 'default') ? selectable['default'] : selectable;
7
+ hider = hider && Object.prototype.hasOwnProperty.call(hider, 'default') ? hider['default'] : hider;
8
+ Handlebars = Handlebars && Object.prototype.hasOwnProperty.call(Handlebars, 'default') ? Handlebars['default'] : Handlebars;
9
+ __ = __ && Object.prototype.hasOwnProperty.call(__, 'default') ? __['default'] : __;
10
+ DOMPurify = DOMPurify && Object.prototype.hasOwnProperty.call(DOMPurify, 'default') ? DOMPurify['default'] : DOMPurify;
34
11
 
35
- hb.registerHelper('dompurify', function (context) {
36
- return DOMPurify.sanitize(context);
37
- });
38
- /**
39
- * Register join helper
40
- *
41
- * Example :
42
- * var values = {a:v1, b:v2, c:v3};
43
- * Using {{{join attributes '=' ' ' '"'}}} will return : a="v1" b="v2" c="v3"
44
- * Using {{{join values null ' or ' '*'}}} will return : *v1* or *v2* or *v3*
12
+ /**
13
+ * This program is free software; you can redistribute it and/or
14
+ * modify it under the terms of the GNU General Public License
15
+ * as published by the Free Software Foundation; under version 2
16
+ * of the License (non-upgradable).
17
+ *
18
+ * This program is distributed in the hope that it will be useful,
19
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ * GNU General Public License for more details.
22
+ *
23
+ * You should have received a copy of the GNU General Public License
24
+ * along with this program; if not, write to the Free Software
25
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26
+ *
27
+ * Copyright (c) 2013-2019 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT);
28
+ *
29
+ *
45
30
  */
31
+ function Helpers0 (hb) {
32
+ //register a i18n helper
33
+ hb.registerHelper('__', function (key) {
34
+ return __(key);
35
+ });
46
36
 
47
- hb.registerHelper('join', function (arr, keyValueGlue, fragmentGlue, wrapper) {
48
- var fragments = [];
49
- keyValueGlue = typeof keyValueGlue === 'string' ? keyValueGlue : undefined;
50
- fragmentGlue = typeof fragmentGlue === 'string' ? fragmentGlue : ' ';
51
- wrapper = typeof wrapper === 'string' ? wrapper : '"';
52
-
53
- _.forIn(arr, function (value, key) {
54
- var fragment = '';
37
+ /**
38
+ * Register dompurify helper
39
+ *
40
+ * https://github.com/cure53/DOMPurify
41
+ * with config SAFE_FOR_TEMPLATES: true
42
+ * to make output safe for template systems
43
+ */
44
+ hb.registerHelper('dompurify', function (context) {
45
+ return DOMPurify.sanitize(context);
46
+ });
55
47
 
56
- if (value !== null || value !== undefined) {
57
- if (typeof value === 'boolean') {
58
- value = value ? 'true' : 'false';
59
- } else if (_typeof(value) === 'object') {
60
- value = _.values(value).join(' ');
48
+ /**
49
+ * Register join helper
50
+ *
51
+ * Example :
52
+ * var values = {a:v1, b:v2, c:v3};
53
+ * Using {{{join attributes '=' ' ' '"'}}} will return : a="v1" b="v2" c="v3"
54
+ * Using {{{join values null ' or ' '*'}}} will return : *v1* or *v2* or *v3*
55
+ */
56
+ hb.registerHelper('join', function (arr, keyValueGlue, fragmentGlue, wrapper) {
57
+ var fragments = [];
58
+ keyValueGlue = typeof keyValueGlue === 'string' ? keyValueGlue : undefined;
59
+ fragmentGlue = typeof fragmentGlue === 'string' ? fragmentGlue : ' ';
60
+ wrapper = typeof wrapper === 'string' ? wrapper : '"';
61
+ _.forIn(arr, function (value, key) {
62
+ var fragment = '';
63
+ if (value !== null || value !== undefined) {
64
+ if (typeof value === 'boolean') {
65
+ value = value ? 'true' : 'false';
66
+ } else if (typeof value === 'object') {
67
+ value = _.values(value).join(' ');
68
+ }
69
+ } else {
70
+ value = '';
71
+ }
72
+ if (keyValueGlue !== undefined) {
73
+ fragment += key + keyValueGlue;
61
74
  }
75
+ fragment += wrapper + value + wrapper;
76
+ fragments.push(fragment);
77
+ });
78
+ return fragments.join(fragmentGlue);
79
+ });
80
+
81
+ //register a classic "for loop" helper
82
+ //it also adds a local variable "i" as the index in each iteration loop
83
+ hb.registerHelper('for', function (startIndex, stopIndex, increment, options) {
84
+ var ret = '';
85
+ startIndex = parseInt(startIndex);
86
+ stopIndex = parseInt(stopIndex);
87
+ increment = parseInt(increment);
88
+ for (var i = startIndex; i < stopIndex; i += increment) {
89
+ ret += options.fn(_.extend({}, this, {
90
+ i: i
91
+ }));
92
+ }
93
+ return ret;
94
+ });
95
+ hb.registerHelper('equal', function (var1, var2, options) {
96
+ if (var1 == var2) {
97
+ return options.fn(this);
62
98
  } else {
63
- value = '';
99
+ return options.inverse(this);
64
100
  }
101
+ });
65
102
 
66
- if (keyValueGlue !== undefined) {
67
- fragment += key + keyValueGlue;
68
- }
103
+ // register a "get property" helper
104
+ // it gets the named property from the provided context
105
+ hb.registerHelper('property', function (name, context) {
106
+ return context[name] || '';
107
+ });
69
108
 
70
- fragment += wrapper + value + wrapper;
71
- fragments.push(fragment);
109
+ // register an 'includes' helper
110
+ // it checks if value is in array
111
+ hb.registerHelper('includes', function (haystack, needle, options) {
112
+ if (_.contains(haystack, needle)) {
113
+ return options.fn(this);
114
+ }
72
115
  });
116
+ }
73
117
 
74
- return fragments.join(fragmentGlue);
75
- }); //register a classic "for loop" helper
76
- //it also adds a local variable "i" as the index in each iteration loop
118
+ if (!Helpers0.__initialized) {
119
+ Helpers0(Handlebars);
120
+ Helpers0.__initialized = true;
121
+ }
122
+ var Template = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
123
+ this.compilerInfo = [4,'>= 1.0.0'];
124
+ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
125
+ var buffer = "", stack1, helper, options, self=this, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
126
+
127
+ function program1(depth0,data) {
128
+
129
+
130
+ return "multiple";
131
+ }
77
132
 
78
- hb.registerHelper('for', function (startIndex, stopIndex, increment, options) {
79
- var ret = '';
80
- startIndex = parseInt(startIndex);
81
- stopIndex = parseInt(stopIndex);
82
- increment = parseInt(increment);
133
+ buffer += "<div class=\"resource-list ";
134
+ stack1 = helpers['if'].call(depth0, (depth0 && depth0.multiple), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
135
+ if(stack1 || stack1 === 0) { buffer += stack1; }
136
+ buffer += "\">\n <ul></ul>\n <div class=\"more hidden\">\n <a href=\"#\" class=\"btn-info small\"><span class=\"icon-download\"></span> "
137
+ + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Load more", options) : helperMissing.call(depth0, "__", "Load more", options)))
138
+ + "</a>\n </div>\n</div>\n\n";
139
+ return buffer;
140
+ });
141
+ function listTpl(data, options, asString) {
142
+ var html = Template(data, options);
143
+ return (asString || true) ? html : $(html);
144
+ }
83
145
 
84
- for (var i = startIndex; i < stopIndex; i += increment) {
85
- ret += options.fn(_.extend({}, this, {
86
- i: i
87
- }));
146
+ if (!Helpers0.__initialized) {
147
+ Helpers0(Handlebars);
148
+ Helpers0.__initialized = true;
149
+ }
150
+ var Template$1 = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
151
+ this.compilerInfo = [4,'>= 1.0.0'];
152
+ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
153
+ var buffer = "", stack1, helper, functionType="function", escapeExpression=this.escapeExpression, self=this;
154
+
155
+ function program1(depth0,data) {
156
+
157
+
158
+ return "class=\"selected\"";
88
159
  }
89
160
 
90
- return ret;
91
- });
92
- hb.registerHelper('equal', function (var1, var2, options) {
93
- if (var1 == var2) {
94
- return options.fn(this);
95
- } else {
96
- return options.inverse(this);
161
+ function program3(depth0,data) {
162
+
163
+ var buffer = "", stack1, helper;
164
+ buffer += "data-access=\"";
165
+ if (helper = helpers.accessMode) { stack1 = helper.call(depth0, {hash:{},data:data}); }
166
+ else { helper = (depth0 && depth0.accessMode); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
167
+ buffer += escapeExpression(stack1)
168
+ + "\"";
169
+ return buffer;
97
170
  }
98
- }); // register a "get property" helper
99
- // it gets the named property from the provided context
100
171
 
101
- hb.registerHelper('property', function (name, context) {
102
- return context[name] || '';
103
- }); // register an 'includes' helper
104
- // it checks if value is in array
172
+ buffer += "<li data-uri=\"";
173
+ if (helper = helpers.uri) { stack1 = helper.call(depth0, {hash:{},data:data}); }
174
+ else { helper = (depth0 && depth0.uri); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
175
+ buffer += escapeExpression(stack1)
176
+ + "\" ";
177
+ stack1 = helpers['if'].call(depth0, (depth0 && depth0.selected), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
178
+ if(stack1 || stack1 === 0) { buffer += stack1; }
179
+ buffer += " class=\"";
180
+ if (helper = helpers.state) { stack1 = helper.call(depth0, {hash:{},data:data}); }
181
+ else { helper = (depth0 && depth0.state); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
182
+ buffer += escapeExpression(stack1)
183
+ + "\" ";
184
+ stack1 = helpers['if'].call(depth0, (depth0 && depth0.accessMode), {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data});
185
+ if(stack1 || stack1 === 0) { buffer += stack1; }
186
+ buffer += ">\n <a href=\"#\" title=\"";
187
+ if (helper = helpers.label) { stack1 = helper.call(depth0, {hash:{},data:data}); }
188
+ else { helper = (depth0 && depth0.label); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
189
+ if(stack1 || stack1 === 0) { buffer += stack1; }
190
+ buffer += "\"><span class=\"icon-";
191
+ if (helper = helpers.icon) { stack1 = helper.call(depth0, {hash:{},data:data}); }
192
+ else { helper = (depth0 && depth0.icon); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
193
+ buffer += escapeExpression(stack1)
194
+ + "\"></span>";
195
+ if (helper = helpers.label) { stack1 = helper.call(depth0, {hash:{},data:data}); }
196
+ else { helper = (depth0 && depth0.label); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
197
+ if(stack1 || stack1 === 0) { buffer += stack1; }
198
+ buffer += "</a>\n</li>\n\n";
199
+ return buffer;
200
+ });
201
+ function listNodeTpl(data, options, asString) {
202
+ var html = Template$1(data, options);
203
+ return (asString || true) ? html : $(html);
204
+ }
205
+
206
+ /*! @license DOMPurify 2.4.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.0/LICENSE */
105
207
 
106
- hb.registerHelper('includes', function (haystack, needle, options) {
107
- if (_.contains(haystack, needle)) {
108
- return options.fn(this);
208
+ function _typeof(obj) {
209
+ "@babel/helpers - typeof";
210
+
211
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
212
+ return typeof obj;
213
+ } : function (obj) {
214
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
215
+ }, _typeof(obj);
216
+ }
217
+ function _setPrototypeOf(o, p) {
218
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
219
+ o.__proto__ = p;
220
+ return o;
221
+ };
222
+ return _setPrototypeOf(o, p);
223
+ }
224
+ function _isNativeReflectConstruct() {
225
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
226
+ if (Reflect.construct.sham) return false;
227
+ if (typeof Proxy === "function") return true;
228
+ try {
229
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
230
+ return true;
231
+ } catch (e) {
232
+ return false;
109
233
  }
110
- });
111
- }
112
-
113
- if (!Helpers0.__initialized) {
114
- Helpers0(Handlebars);
115
- Helpers0.__initialized = true;
116
- }
117
- var Template = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
118
- this.compilerInfo = [4,'>= 1.0.0'];
119
- helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
120
- var buffer = "", stack1, helper, options, self=this, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
121
-
122
- function program1(depth0,data) {
123
-
124
-
125
- return "multiple";
126
234
  }
127
-
128
- buffer += "<div class=\"resource-list ";
129
- stack1 = helpers['if'].call(depth0, (depth0 && depth0.multiple), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
130
- if(stack1 || stack1 === 0) { buffer += stack1; }
131
- buffer += "\">\r\n <ul></ul>\r\n <div class=\"more hidden\">\r\n <a href=\"#\" class=\"btn-info small\"><span class=\"icon-download\"></span> "
132
- + escapeExpression((helper = helpers.__ || (depth0 && depth0.__),options={hash:{},data:data},helper ? helper.call(depth0, "Load more", options) : helperMissing.call(depth0, "__", "Load more", options)))
133
- + "</a>\r\n </div>\r\n</div>\r\n\r\n";
134
- return buffer;
135
- });
136
- function listTpl(data, options, asString) {
137
- var html = Template(data, options);
138
- return (asString || true) ? html : $(html);
139
- }
140
-
141
- if (!Helpers0.__initialized) {
142
- Helpers0(Handlebars);
143
- Helpers0.__initialized = true;
144
- }
145
- var Template$1 = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
146
- this.compilerInfo = [4,'>= 1.0.0'];
147
- helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
148
- var buffer = "", stack1, helper, functionType="function", escapeExpression=this.escapeExpression, self=this;
149
-
150
- function program1(depth0,data) {
151
-
152
-
153
- return "class=\"selected\"";
235
+ function _construct(Parent, args, Class) {
236
+ if (_isNativeReflectConstruct()) {
237
+ _construct = Reflect.construct;
238
+ } else {
239
+ _construct = function _construct(Parent, args, Class) {
240
+ var a = [null];
241
+ a.push.apply(a, args);
242
+ var Constructor = Function.bind.apply(Parent, a);
243
+ var instance = new Constructor();
244
+ if (Class) _setPrototypeOf(instance, Class.prototype);
245
+ return instance;
246
+ };
247
+ }
248
+ return _construct.apply(null, arguments);
154
249
  }
155
-
156
- function program3(depth0,data) {
157
-
158
- var buffer = "", stack1, helper;
159
- buffer += "data-access=\"";
160
- if (helper = helpers.accessMode) { stack1 = helper.call(depth0, {hash:{},data:data}); }
161
- else { helper = (depth0 && depth0.accessMode); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
162
- buffer += escapeExpression(stack1)
163
- + "\"";
164
- return buffer;
250
+ function _toConsumableArray(arr) {
251
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
165
252
  }
166
-
167
- buffer += "<li data-uri=\"";
168
- if (helper = helpers.uri) { stack1 = helper.call(depth0, {hash:{},data:data}); }
169
- else { helper = (depth0 && depth0.uri); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
170
- buffer += escapeExpression(stack1)
171
- + "\" ";
172
- stack1 = helpers['if'].call(depth0, (depth0 && depth0.selected), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
173
- if(stack1 || stack1 === 0) { buffer += stack1; }
174
- buffer += " class=\"";
175
- if (helper = helpers.state) { stack1 = helper.call(depth0, {hash:{},data:data}); }
176
- else { helper = (depth0 && depth0.state); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
177
- buffer += escapeExpression(stack1)
178
- + "\" ";
179
- stack1 = helpers['if'].call(depth0, (depth0 && depth0.accessMode), {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data});
180
- if(stack1 || stack1 === 0) { buffer += stack1; }
181
- buffer += ">\r\n <a href=\"#\" title=\"";
182
- if (helper = helpers.label) { stack1 = helper.call(depth0, {hash:{},data:data}); }
183
- else { helper = (depth0 && depth0.label); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
184
- if(stack1 || stack1 === 0) { buffer += stack1; }
185
- buffer += "\"><span class=\"icon-";
186
- if (helper = helpers.icon) { stack1 = helper.call(depth0, {hash:{},data:data}); }
187
- else { helper = (depth0 && depth0.icon); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
188
- buffer += escapeExpression(stack1)
189
- + "\"></span>";
190
- if (helper = helpers.label) { stack1 = helper.call(depth0, {hash:{},data:data}); }
191
- else { helper = (depth0 && depth0.label); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
192
- if(stack1 || stack1 === 0) { buffer += stack1; }
193
- buffer += "</a>\r\n</li>\r\n\r\n";
194
- return buffer;
195
- });
196
- function listNodeTpl(data, options, asString) {
197
- var html = Template$1(data, options);
198
- return (asString || true) ? html : $(html);
199
- }
200
-
201
- var freeze$1 = Object.freeze || function (x) {
202
- return x;
203
- };
204
-
205
- var html = freeze$1(['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', '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', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']); // SVG
206
-
207
- var svg = freeze$1(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'audio', 'canvas', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'video', 'view', 'vkern']);
208
- var svgFilters = freeze$1(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);
209
- var mathMl = freeze$1(['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']);
210
- var text = freeze$1(['#text']);
211
-
212
- var freeze$2 = Object.freeze || function (x) {
213
- return x;
214
- };
215
-
216
- var html$1 = freeze$2(['accept', 'action', 'align', 'alt', 'autocomplete', 'background', 'bgcolor', 'border', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'coords', 'crossorigin', 'datetime', 'default', 'dir', 'disabled', 'download', 'enctype', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'integrity', 'ismap', 'label', 'lang', 'list', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'multiple', 'name', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns']);
217
- var svg$1 = freeze$2(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'tabindex', 'targetx', 'targety', 'transform', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
218
- var mathMl$1 = freeze$2(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
219
- var xml = freeze$2(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
220
- var hasOwnProperty = Object.hasOwnProperty;
221
- var setPrototypeOf = Object.setPrototypeOf;
222
-
223
- var _ref$1 = typeof Reflect !== 'undefined' && Reflect;
224
-
225
- var apply$1 = _ref$1.apply;
226
-
227
- if (!apply$1) {
228
- apply$1 = function apply(fun, thisValue, args) {
229
- return fun.apply(thisValue, args);
230
- };
231
- }
232
- /* Add properties to a lookup table */
233
-
234
-
235
- function addToSet(set, array) {
236
- if (setPrototypeOf) {
237
- // Make 'in' and truthy checks like Boolean(set.constructor)
238
- // independent of any properties defined on Object.prototype.
239
- // Prevent prototype setters from intercepting set as a this value.
240
- setPrototypeOf(set, null);
253
+ function _arrayWithoutHoles(arr) {
254
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
241
255
  }
242
-
243
- var l = array.length;
244
-
245
- while (l--) {
246
- var element = array[l];
247
-
248
- if (typeof element === 'string') {
249
- var lcElement = element.toLowerCase();
250
-
251
- if (lcElement !== element) {
252
- // Config presets (e.g. tags.js, attrs.js) are immutable.
253
- if (!Object.isFrozen(array)) {
254
- array[l] = lcElement;
256
+ function _iterableToArray(iter) {
257
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
258
+ }
259
+ function _unsupportedIterableToArray(o, minLen) {
260
+ if (!o) return;
261
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
262
+ var n = Object.prototype.toString.call(o).slice(8, -1);
263
+ if (n === "Object" && o.constructor) n = o.constructor.name;
264
+ if (n === "Map" || n === "Set") return Array.from(o);
265
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
266
+ }
267
+ function _arrayLikeToArray(arr, len) {
268
+ if (len == null || len > arr.length) len = arr.length;
269
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
270
+ return arr2;
271
+ }
272
+ function _nonIterableSpread() {
273
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
274
+ }
275
+ var hasOwnProperty = Object.hasOwnProperty,
276
+ setPrototypeOf = Object.setPrototypeOf,
277
+ isFrozen = Object.isFrozen,
278
+ getPrototypeOf = Object.getPrototypeOf,
279
+ getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
280
+ var freeze = Object.freeze,
281
+ seal = Object.seal,
282
+ create = Object.create; // eslint-disable-line import/no-mutable-exports
283
+
284
+ var _ref = typeof Reflect !== 'undefined' && Reflect,
285
+ apply = _ref.apply,
286
+ construct = _ref.construct;
287
+ if (!apply) {
288
+ apply = function apply(fun, thisValue, args) {
289
+ return fun.apply(thisValue, args);
290
+ };
291
+ }
292
+ if (!freeze) {
293
+ freeze = function freeze(x) {
294
+ return x;
295
+ };
296
+ }
297
+ if (!seal) {
298
+ seal = function seal(x) {
299
+ return x;
300
+ };
301
+ }
302
+ if (!construct) {
303
+ construct = function construct(Func, args) {
304
+ return _construct(Func, _toConsumableArray(args));
305
+ };
306
+ }
307
+ var arrayForEach = unapply(Array.prototype.forEach);
308
+ var arrayPop = unapply(Array.prototype.pop);
309
+ var arrayPush = unapply(Array.prototype.push);
310
+ var stringToLowerCase = unapply(String.prototype.toLowerCase);
311
+ var stringMatch = unapply(String.prototype.match);
312
+ var stringReplace = unapply(String.prototype.replace);
313
+ var stringIndexOf = unapply(String.prototype.indexOf);
314
+ var stringTrim = unapply(String.prototype.trim);
315
+ var regExpTest = unapply(RegExp.prototype.test);
316
+ var typeErrorCreate = unconstruct(TypeError);
317
+ function unapply(func) {
318
+ return function (thisArg) {
319
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
320
+ args[_key - 1] = arguments[_key];
321
+ }
322
+ return apply(func, thisArg, args);
323
+ };
324
+ }
325
+ function unconstruct(func) {
326
+ return function () {
327
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
328
+ args[_key2] = arguments[_key2];
329
+ }
330
+ return construct(func, args);
331
+ };
332
+ }
333
+ /* Add properties to a lookup table */
334
+
335
+ function addToSet(set, array, transformCaseFunc) {
336
+ transformCaseFunc = transformCaseFunc ? transformCaseFunc : stringToLowerCase;
337
+ if (setPrototypeOf) {
338
+ // Make 'in' and truthy checks like Boolean(set.constructor)
339
+ // independent of any properties defined on Object.prototype.
340
+ // Prevent prototype setters from intercepting set as a this value.
341
+ setPrototypeOf(set, null);
342
+ }
343
+ var l = array.length;
344
+ while (l--) {
345
+ var element = array[l];
346
+ if (typeof element === 'string') {
347
+ var lcElement = transformCaseFunc(element);
348
+ if (lcElement !== element) {
349
+ // Config presets (e.g. tags.js, attrs.js) are immutable.
350
+ if (!isFrozen(array)) {
351
+ array[l] = lcElement;
352
+ }
353
+ element = lcElement;
255
354
  }
256
-
257
- element = lcElement;
258
355
  }
356
+ set[element] = true;
259
357
  }
260
-
261
- set[element] = true;
358
+ return set;
262
359
  }
263
-
264
- return set;
265
- }
266
- /* Shallow clone an object */
267
-
268
-
269
- function clone(object) {
270
- var newObject = {};
271
- var property = void 0;
272
-
273
- for (property in object) {
274
- if (apply$1(hasOwnProperty, object, [property])) {
275
- newObject[property] = object[property];
360
+ /* Shallow clone an object */
361
+
362
+ function clone(object) {
363
+ var newObject = create(null);
364
+ var property;
365
+ for (property in object) {
366
+ if (apply(hasOwnProperty, object, [property])) {
367
+ newObject[property] = object[property];
368
+ }
276
369
  }
370
+ return newObject;
277
371
  }
278
-
279
- return newObject;
280
- }
281
-
282
- var seal = Object.seal || function (x) {
283
- return x;
284
- };
285
-
286
- var MUSTACHE_EXPR = seal(/\{\{[\s\S]*|[\s\S]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
287
-
288
- var ERB_EXPR = seal(/<%[\s\S]*|[\s\S]*%>/gm);
289
- var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape
290
-
291
- var ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
292
-
293
- var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
294
- );
295
- var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
296
- var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g // eslint-disable-line no-control-regex
297
- );
298
-
299
- var _typeof$1 = typeof Symbol === "function" && _typeof(Symbol.iterator) === "symbol" ? function (obj) {
300
- return _typeof(obj);
301
- } : function (obj) {
302
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof(obj);
303
- };
304
-
305
- function _toConsumableArray(arr) {
306
- if (Array.isArray(arr)) {
307
- for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {
308
- arr2[i] = arr[i];
372
+ /* IE10 doesn't support __lookupGetter__ so lets'
373
+ * simulate it. It also automatically checks
374
+ * if the prop is function or getter and behaves
375
+ * accordingly. */
376
+
377
+ function lookupGetter(object, prop) {
378
+ while (object !== null) {
379
+ var desc = getOwnPropertyDescriptor(object, prop);
380
+ if (desc) {
381
+ if (desc.get) {
382
+ return unapply(desc.get);
383
+ }
384
+ if (typeof desc.value === 'function') {
385
+ return unapply(desc.value);
386
+ }
387
+ }
388
+ object = getPrototypeOf(object);
309
389
  }
310
-
311
- return arr2;
312
- } else {
313
- return Array.from(arr);
390
+ function fallbackValue(element) {
391
+ console.warn('fallback value for', element);
392
+ return null;
393
+ }
394
+ return fallbackValue;
314
395
  }
315
- }
396
+ var html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']); // SVG
316
397
 
317
- var _ref = typeof Reflect !== 'undefined' && Reflect;
398
+ var svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
399
+ var svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']); // List of SVG elements that are disallowed by default.
400
+ // We still need to know them so that we can do namespace
401
+ // checks properly in case one wants to add them to
402
+ // allow-list.
318
403
 
319
- var apply = _ref.apply;
320
- var arraySlice = Array.prototype.slice;
321
- var freeze = Object.freeze;
404
+ var svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'fedropshadow', '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']);
405
+ var 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']); // Similarly to SVG, we want to know all MathML elements,
406
+ // even those that we disallow by default.
322
407
 
323
- var getGlobal = function getGlobal() {
324
- return typeof window === 'undefined' ? null : window;
325
- };
408
+ var mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
409
+ var text = freeze(['#text']);
410
+ var html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']);
411
+ var svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
412
+ var mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
413
+ var xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
414
+ var MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
326
415
 
327
- if (!apply) {
328
- apply = function apply(fun, thisValue, args) {
329
- return fun.apply(thisValue, args);
330
- };
331
- }
332
- /**
333
- * Creates a no-op policy for internal use only.
334
- * Don't export this function outside this module!
335
- * @param {?TrustedTypePolicyFactory} trustedTypes The policy factory.
336
- * @param {Document} document The document object (to determine policy name suffix)
337
- * @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types
338
- * are not supported).
339
- */
340
-
341
-
342
- var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, document) {
343
- if ((typeof trustedTypes === 'undefined' ? 'undefined' : _typeof$1(trustedTypes)) !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
344
- return null;
345
- } // Allow the callers to control the unique policy name
346
- // by adding a data-tt-policy-suffix to the script element with the DOMPurify.
347
- // Policy creation with duplicate names throws in Trusted Types.
348
-
349
-
350
- var suffix = null;
351
- var ATTR_NAME = 'data-tt-policy-suffix';
352
-
353
- if (document.currentScript && document.currentScript.hasAttribute(ATTR_NAME)) {
354
- suffix = document.currentScript.getAttribute(ATTR_NAME);
355
- }
416
+ var ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
417
+ var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape
356
418
 
357
- var policyName = 'dompurify' + (suffix ? '#' + suffix : '');
419
+ var ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
358
420
 
359
- try {
360
- return trustedTypes.createPolicy(policyName, {
361
- createHTML: function createHTML(html$$1) {
362
- return html$$1;
363
- }
364
- });
365
- } catch (error) {
366
- // Policy creation failed (most likely another DOMPurify script has
367
- // already run). Skip creating the policy, as this will only cause errors
368
- // if TT are enforced.
369
- console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
370
- return null;
371
- }
372
- };
421
+ var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
422
+ );
373
423
 
374
- function createDOMPurify() {
375
- var window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
424
+ var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
425
+ var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
426
+ );
376
427
 
377
- var DOMPurify = function DOMPurify(root) {
378
- return createDOMPurify(root);
428
+ var DOCTYPE_NAME = seal(/^html$/i);
429
+ var getGlobal = function getGlobal() {
430
+ return typeof window === 'undefined' ? null : window;
379
431
  };
380
432
  /**
381
- * Version label, exposed for easier checks
382
- * if DOMPurify is up to date or not
383
- */
384
-
385
-
386
- DOMPurify.version = '1.0.11';
387
- /**
388
- * Array of elements that DOMPurify removed during sanitation.
389
- * Empty if nothing was removed.
433
+ * Creates a no-op policy for internal use only.
434
+ * Don't export this function outside this module!
435
+ * @param {?TrustedTypePolicyFactory} trustedTypes The policy factory.
436
+ * @param {Document} document The document object (to determine policy name suffix)
437
+ * @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types
438
+ * are not supported).
390
439
  */
391
440
 
392
- DOMPurify.removed = [];
441
+ var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, document) {
442
+ if (_typeof(trustedTypes) !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
443
+ return null;
444
+ } // Allow the callers to control the unique policy name
445
+ // by adding a data-tt-policy-suffix to the script element with the DOMPurify.
446
+ // Policy creation with duplicate names throws in Trusted Types.
447
+
448
+ var suffix = null;
449
+ var ATTR_NAME = 'data-tt-policy-suffix';
450
+ if (document.currentScript && document.currentScript.hasAttribute(ATTR_NAME)) {
451
+ suffix = document.currentScript.getAttribute(ATTR_NAME);
452
+ }
453
+ var policyName = 'dompurify' + (suffix ? '#' + suffix : '');
454
+ try {
455
+ return trustedTypes.createPolicy(policyName, {
456
+ createHTML: function createHTML(html) {
457
+ return html;
458
+ },
459
+ createScriptURL: function createScriptURL(scriptUrl) {
460
+ return scriptUrl;
461
+ }
462
+ });
463
+ } catch (_) {
464
+ // Policy creation failed (most likely another DOMPurify script has
465
+ // already run). Skip creating the policy, as this will only cause errors
466
+ // if TT are enforced.
467
+ console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
468
+ return null;
469
+ }
470
+ };
471
+ function createDOMPurify() {
472
+ var window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
473
+ var DOMPurify = function DOMPurify(root) {
474
+ return createDOMPurify(root);
475
+ };
476
+ /**
477
+ * Version label, exposed for easier checks
478
+ * if DOMPurify is up to date or not
479
+ */
393
480
 
394
- if (!window || !window.document || window.document.nodeType !== 9) {
395
- // Not running in a browser, provide a factory function
396
- // so that you can pass your own Window
397
- DOMPurify.isSupported = false;
398
- return DOMPurify;
399
- }
481
+ DOMPurify.version = '2.4.0';
482
+ /**
483
+ * Array of elements that DOMPurify removed during sanitation.
484
+ * Empty if nothing was removed.
485
+ */
400
486
 
401
- var originalDocument = window.document;
402
- var useDOMParser = false;
403
- var removeTitle = false;
404
- var document = window.document;
405
- var DocumentFragment = window.DocumentFragment,
487
+ DOMPurify.removed = [];
488
+ if (!window || !window.document || window.document.nodeType !== 9) {
489
+ // Not running in a browser, provide a factory function
490
+ // so that you can pass your own Window
491
+ DOMPurify.isSupported = false;
492
+ return DOMPurify;
493
+ }
494
+ var originalDocument = window.document;
495
+ var document = window.document;
496
+ var DocumentFragment = window.DocumentFragment,
406
497
  HTMLTemplateElement = window.HTMLTemplateElement,
407
498
  Node = window.Node,
499
+ Element = window.Element,
408
500
  NodeFilter = window.NodeFilter,
409
501
  _window$NamedNodeMap = window.NamedNodeMap,
410
- NamedNodeMap = _window$NamedNodeMap === undefined ? window.NamedNodeMap || window.MozNamedAttrMap : _window$NamedNodeMap,
411
- Text = window.Text,
412
- Comment = window.Comment,
502
+ NamedNodeMap = _window$NamedNodeMap === void 0 ? window.NamedNodeMap || window.MozNamedAttrMap : _window$NamedNodeMap,
503
+ HTMLFormElement = window.HTMLFormElement,
413
504
  DOMParser = window.DOMParser,
414
- TrustedTypes = window.TrustedTypes; // As per issue #47, the web-components registry is inherited by a
415
- // new document created via createHTMLDocument. As per the spec
416
- // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
417
- // a new empty registry is used when creating a template contents owner
418
- // document, so we use that as our parent document to ensure nothing
419
- // is inherited.
420
-
421
- if (typeof HTMLTemplateElement === 'function') {
422
- var template = document.createElement('template');
423
-
424
- if (template.content && template.content.ownerDocument) {
425
- document = template.content.ownerDocument;
505
+ trustedTypes = window.trustedTypes;
506
+ var ElementPrototype = Element.prototype;
507
+ var cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
508
+ var getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
509
+ var getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
510
+ var getParentNode = lookupGetter(ElementPrototype, 'parentNode'); // As per issue #47, the web-components registry is inherited by a
511
+ // new document created via createHTMLDocument. As per the spec
512
+ // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
513
+ // a new empty registry is used when creating a template contents owner
514
+ // document, so we use that as our parent document to ensure nothing
515
+ // is inherited.
516
+
517
+ if (typeof HTMLTemplateElement === 'function') {
518
+ var template = document.createElement('template');
519
+ if (template.content && template.content.ownerDocument) {
520
+ document = template.content.ownerDocument;
521
+ }
426
522
  }
427
- }
428
-
429
- var trustedTypesPolicy = _createTrustedTypesPolicy(TrustedTypes, originalDocument);
430
-
431
- var emptyHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML('') : '';
432
- var _document = document,
523
+ var trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, originalDocument);
524
+ var emptyHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML('') : '';
525
+ var _document = document,
433
526
  implementation = _document.implementation,
434
527
  createNodeIterator = _document.createNodeIterator,
435
- getElementsByTagName = _document.getElementsByTagName,
436
- createDocumentFragment = _document.createDocumentFragment;
437
- var importNode = originalDocument.importNode;
438
- var hooks = {};
439
- /**
440
- * Expose whether this browser supports running the full DOMPurify.
441
- */
442
-
443
- DOMPurify.isSupported = implementation && typeof implementation.createHTMLDocument !== 'undefined' && document.documentMode !== 9;
444
- var MUSTACHE_EXPR$$1 = MUSTACHE_EXPR,
445
- ERB_EXPR$$1 = ERB_EXPR,
446
- DATA_ATTR$$1 = DATA_ATTR,
447
- ARIA_ATTR$$1 = ARIA_ATTR,
448
- IS_SCRIPT_OR_DATA$$1 = IS_SCRIPT_OR_DATA,
449
- ATTR_WHITESPACE$$1 = ATTR_WHITESPACE;
450
- var IS_ALLOWED_URI$$1 = IS_ALLOWED_URI;
451
- /**
452
- * We consider the elements and attributes below to be safe. Ideally
453
- * don't add any new ones but feel free to remove unwanted ones.
454
- */
455
-
456
- /* allowed element names */
528
+ createDocumentFragment = _document.createDocumentFragment,
529
+ getElementsByTagName = _document.getElementsByTagName;
530
+ var importNode = originalDocument.importNode;
531
+ var documentMode = {};
532
+ try {
533
+ documentMode = clone(document).documentMode ? document.documentMode : {};
534
+ } catch (_) {}
535
+ var hooks = {};
536
+ /**
537
+ * Expose whether this browser supports running the full DOMPurify.
538
+ */
457
539
 
458
- var ALLOWED_TAGS = null;
459
- var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(html), _toConsumableArray(svg), _toConsumableArray(svgFilters), _toConsumableArray(mathMl), _toConsumableArray(text)));
460
- /* Allowed attribute names */
540
+ DOMPurify.isSupported = typeof getParentNode === 'function' && implementation && typeof implementation.createHTMLDocument !== 'undefined' && documentMode !== 9;
541
+ var MUSTACHE_EXPR$1 = MUSTACHE_EXPR,
542
+ ERB_EXPR$1 = ERB_EXPR,
543
+ DATA_ATTR$1 = DATA_ATTR,
544
+ ARIA_ATTR$1 = ARIA_ATTR,
545
+ IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA,
546
+ ATTR_WHITESPACE$1 = ATTR_WHITESPACE;
547
+ var IS_ALLOWED_URI$1 = IS_ALLOWED_URI;
548
+ /**
549
+ * We consider the elements and attributes below to be safe. Ideally
550
+ * don't add any new ones but feel free to remove unwanted ones.
551
+ */
461
552
 
462
- var ALLOWED_ATTR = null;
463
- var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray(html$1), _toConsumableArray(svg$1), _toConsumableArray(mathMl$1), _toConsumableArray(xml)));
464
- /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
553
+ /* allowed element names */
465
554
 
466
- var FORBID_TAGS = null;
467
- /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
555
+ var ALLOWED_TAGS = null;
556
+ var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(html$1), _toConsumableArray(svg$1), _toConsumableArray(svgFilters), _toConsumableArray(mathMl$1), _toConsumableArray(text)));
557
+ /* Allowed attribute names */
468
558
 
469
- var FORBID_ATTR = null;
470
- /* Decide if ARIA attributes are okay */
559
+ var ALLOWED_ATTR = null;
560
+ var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray(html), _toConsumableArray(svg), _toConsumableArray(mathMl), _toConsumableArray(xml)));
561
+ /*
562
+ * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.
563
+ * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
564
+ * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
565
+ * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
566
+ */
471
567
 
472
- var ALLOW_ARIA_ATTR = true;
473
- /* Decide if custom data attributes are okay */
568
+ var CUSTOM_ELEMENT_HANDLING = Object.seal(Object.create(null, {
569
+ tagNameCheck: {
570
+ writable: true,
571
+ configurable: false,
572
+ enumerable: true,
573
+ value: null
574
+ },
575
+ attributeNameCheck: {
576
+ writable: true,
577
+ configurable: false,
578
+ enumerable: true,
579
+ value: null
580
+ },
581
+ allowCustomizedBuiltInElements: {
582
+ writable: true,
583
+ configurable: false,
584
+ enumerable: true,
585
+ value: false
586
+ }
587
+ }));
588
+ /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
474
589
 
475
- var ALLOW_DATA_ATTR = true;
476
- /* Decide if unknown protocols are okay */
590
+ var FORBID_TAGS = null;
591
+ /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
477
592
 
478
- var ALLOW_UNKNOWN_PROTOCOLS = false;
479
- /* Output should be safe for jQuery's $() factory? */
593
+ var FORBID_ATTR = null;
594
+ /* Decide if ARIA attributes are okay */
480
595
 
481
- var SAFE_FOR_JQUERY = false;
482
- /* Output should be safe for common template engines.
483
- * This means, DOMPurify removes data attributes, mustaches and ERB
484
- */
596
+ var ALLOW_ARIA_ATTR = true;
597
+ /* Decide if custom data attributes are okay */
485
598
 
486
- var SAFE_FOR_TEMPLATES = false;
487
- /* Decide if document with <html>... should be returned */
599
+ var ALLOW_DATA_ATTR = true;
600
+ /* Decide if unknown protocols are okay */
488
601
 
489
- var WHOLE_DOCUMENT = false;
490
- /* Track whether config is already set on this instance of DOMPurify. */
602
+ var ALLOW_UNKNOWN_PROTOCOLS = false;
603
+ /* Output should be safe for common template engines.
604
+ * This means, DOMPurify removes data attributes, mustaches and ERB
605
+ */
491
606
 
492
- var SET_CONFIG = false;
493
- /* Decide if all elements (e.g. style, script) must be children of
494
- * document.body. By default, browsers might move them to document.head */
607
+ var SAFE_FOR_TEMPLATES = false;
608
+ /* Decide if document with <html>... should be returned */
495
609
 
496
- var FORCE_BODY = false;
497
- /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
498
- * string (or a TrustedHTML object if Trusted Types are supported).
499
- * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
500
- */
610
+ var WHOLE_DOCUMENT = false;
611
+ /* Track whether config is already set on this instance of DOMPurify. */
501
612
 
502
- var RETURN_DOM = false;
503
- /* Decide if a DOM `DocumentFragment` should be returned, instead of a html
504
- * string (or a TrustedHTML object if Trusted Types are supported) */
613
+ var SET_CONFIG = false;
614
+ /* Decide if all elements (e.g. style, script) must be children of
615
+ * document.body. By default, browsers might move them to document.head */
505
616
 
506
- var RETURN_DOM_FRAGMENT = false;
507
- /* If `RETURN_DOM` or `RETURN_DOM_FRAGMENT` is enabled, decide if the returned DOM
508
- * `Node` is imported into the current `Document`. If this flag is not enabled the
509
- * `Node` will belong (its ownerDocument) to a fresh `HTMLDocument`, created by
510
- * DOMPurify. */
617
+ var FORCE_BODY = false;
618
+ /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
619
+ * string (or a TrustedHTML object if Trusted Types are supported).
620
+ * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
621
+ */
511
622
 
512
- var RETURN_DOM_IMPORT = false;
513
- /* Output should be free from DOM clobbering attacks? */
623
+ var 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) */
514
626
 
515
- var SANITIZE_DOM = true;
516
- /* Keep element content when removing element? */
627
+ var RETURN_DOM_FRAGMENT = false;
628
+ /* Try to return a Trusted Type object instead of a string, return a string in
629
+ * case Trusted Types are not supported */
517
630
 
518
- var KEEP_CONTENT = true;
519
- /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
520
- * of importing it into a new Document and returning a sanitized copy */
631
+ var RETURN_TRUSTED_TYPE = false;
632
+ /* Output should be free from DOM clobbering attacks?
633
+ * This sanitizes markups named with colliding, clobberable built-in DOM APIs.
634
+ */
521
635
 
522
- var IN_PLACE = false;
523
- /* Allow usage of profiles like html, svg and mathMl */
636
+ var SANITIZE_DOM = true;
637
+ /* Achieve full DOM Clobbering protection by isolating the namespace of named
638
+ * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.
639
+ *
640
+ * HTML/DOM spec rules that enable DOM Clobbering:
641
+ * - Named Access on Window (§7.3.3)
642
+ * - DOM Tree Accessors (§3.1.5)
643
+ * - Form Element Parent-Child Relations (§4.10.3)
644
+ * - Iframe srcdoc / Nested WindowProxies (§4.8.5)
645
+ * - HTMLCollection (§4.2.10.2)
646
+ *
647
+ * Namespace isolation is implemented by prefixing `id` and `name` attributes
648
+ * with a constant string, i.e., `user-content-`
649
+ */
524
650
 
525
- var USE_PROFILES = {};
526
- /* Tags to ignore content of when KEEP_CONTENT is true */
651
+ var SANITIZE_NAMED_PROPS = false;
652
+ var SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
653
+ /* Keep element content when removing element? */
527
654
 
528
- var FORBID_CONTENTS = addToSet({}, ['audio', 'head', 'math', 'script', 'style', 'template', 'svg', 'video']);
529
- /* Tags that are safe for data: URIs */
655
+ var KEEP_CONTENT = true;
656
+ /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
657
+ * of importing it into a new Document and returning a sanitized copy */
530
658
 
531
- var DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image']);
532
- /* Attributes safe for values like "javascript:" */
659
+ var IN_PLACE = false;
660
+ /* Allow usage of profiles like html, svg and mathMl */
533
661
 
534
- var URI_SAFE_ATTRIBUTES = null;
535
- var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'summary', 'title', 'value', 'style', 'xmlns']);
536
- /* Keep a reference to config to pass to hooks */
662
+ var USE_PROFILES = {};
663
+ /* Tags to ignore content of when KEEP_CONTENT is true */
537
664
 
538
- var CONFIG = null;
539
- /* Ideally, do not touch anything below this line */
665
+ var FORBID_CONTENTS = null;
666
+ var DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);
667
+ /* Tags that are safe for data: URIs */
540
668
 
541
- /* ______________________________________________ */
669
+ var DATA_URI_TAGS = null;
670
+ var DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
671
+ /* Attributes safe for values like "javascript:" */
542
672
 
543
- var formElement = document.createElement('form');
544
- /**
545
- * _parseConfig
546
- *
547
- * @param {Object} cfg optional config literal
548
- */
549
- // eslint-disable-next-line complexity
673
+ var URI_SAFE_ATTRIBUTES = null;
674
+ var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
675
+ var MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
676
+ var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
677
+ var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
678
+ /* Document namespace */
550
679
 
551
- var _parseConfig = function _parseConfig(cfg) {
552
- if (CONFIG && CONFIG === cfg) {
553
- return;
554
- }
555
- /* Shield configuration object from tampering */
680
+ var NAMESPACE = HTML_NAMESPACE;
681
+ var IS_EMPTY_INPUT = false;
682
+ /* Parsing of strict XHTML documents */
556
683
 
684
+ var PARSER_MEDIA_TYPE;
685
+ var SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
686
+ var DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
687
+ var transformCaseFunc;
688
+ /* Keep a reference to config to pass to hooks */
557
689
 
558
- if (!cfg || (typeof cfg === 'undefined' ? 'undefined' : _typeof$1(cfg)) !== 'object') {
559
- cfg = {};
560
- }
561
- /* Set configuration parameters */
690
+ var CONFIG = null;
691
+ /* Ideally, do not touch anything below this line */
562
692
 
693
+ /* ______________________________________________ */
563
694
 
564
- ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS) : DEFAULT_ALLOWED_TAGS;
565
- ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR) : DEFAULT_ALLOWED_ATTR;
566
- URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet({}, cfg.ADD_URI_SAFE_ATTR) : DEFAULT_URI_SAFE_ATTRIBUTES;
567
- FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS) : {};
568
- FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR) : {};
569
- USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;
570
- ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
695
+ var formElement = document.createElement('form');
696
+ var isRegexOrFunction = function isRegexOrFunction(testValue) {
697
+ return testValue instanceof RegExp || testValue instanceof Function;
698
+ };
699
+ /**
700
+ * _parseConfig
701
+ *
702
+ * @param {Object} cfg optional config literal
703
+ */
704
+ // eslint-disable-next-line complexity
571
705
 
572
- ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
706
+ var _parseConfig = function _parseConfig(cfg) {
707
+ if (CONFIG && CONFIG === cfg) {
708
+ return;
709
+ }
710
+ /* Shield configuration object from tampering */
573
711
 
574
- ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
712
+ if (!cfg || _typeof(cfg) !== 'object') {
713
+ cfg = {};
714
+ }
715
+ /* Shield configuration object from prototype pollution */
575
716
 
576
- SAFE_FOR_JQUERY = cfg.SAFE_FOR_JQUERY || false; // Default false
717
+ cfg = clone(cfg);
718
+ PARSER_MEDIA_TYPE =
719
+ // eslint-disable-next-line unicorn/prefer-includes
720
+ SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
577
721
 
578
- SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
722
+ transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? function (x) {
723
+ return x;
724
+ } : stringToLowerCase;
725
+ /* Set configuration parameters */
579
726
 
580
- WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
727
+ ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
728
+ ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
729
+ URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES),
730
+ // eslint-disable-line indent
731
+ cfg.ADD_URI_SAFE_ATTR,
732
+ // eslint-disable-line indent
733
+ transformCaseFunc // eslint-disable-line indent
734
+ ) // eslint-disable-line indent
735
+ : DEFAULT_URI_SAFE_ATTRIBUTES;
736
+ DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS),
737
+ // eslint-disable-line indent
738
+ cfg.ADD_DATA_URI_TAGS,
739
+ // eslint-disable-line indent
740
+ transformCaseFunc // eslint-disable-line indent
741
+ ) // eslint-disable-line indent
742
+ : DEFAULT_DATA_URI_TAGS;
743
+ FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
744
+ FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
745
+ FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
746
+ USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;
747
+ ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
581
748
 
582
- RETURN_DOM = cfg.RETURN_DOM || false; // Default false
749
+ ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
583
750
 
584
- RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
751
+ ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
585
752
 
586
- RETURN_DOM_IMPORT = cfg.RETURN_DOM_IMPORT || false; // Default false
753
+ SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
587
754
 
588
- FORCE_BODY = cfg.FORCE_BODY || false; // Default false
755
+ WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
589
756
 
590
- SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
757
+ RETURN_DOM = cfg.RETURN_DOM || false; // Default false
591
758
 
592
- KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
759
+ RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
593
760
 
594
- IN_PLACE = cfg.IN_PLACE || false; // Default false
761
+ RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false
595
762
 
596
- IS_ALLOWED_URI$$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$$1;
763
+ FORCE_BODY = cfg.FORCE_BODY || false; // Default false
597
764
 
598
- if (SAFE_FOR_TEMPLATES) {
599
- ALLOW_DATA_ATTR = false;
600
- }
765
+ SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
601
766
 
602
- if (RETURN_DOM_FRAGMENT) {
603
- RETURN_DOM = true;
604
- }
605
- /* Parse profile info */
767
+ SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false
606
768
 
769
+ KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
607
770
 
608
- if (USE_PROFILES) {
609
- ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(text)));
610
- ALLOWED_ATTR = [];
771
+ IN_PLACE = cfg.IN_PLACE || false; // Default false
611
772
 
612
- if (USE_PROFILES.html === true) {
613
- addToSet(ALLOWED_TAGS, html);
614
- addToSet(ALLOWED_ATTR, html$1);
773
+ IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$1;
774
+ NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
775
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
776
+ CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
615
777
  }
616
-
617
- if (USE_PROFILES.svg === true) {
618
- addToSet(ALLOWED_TAGS, svg);
619
- addToSet(ALLOWED_ATTR, svg$1);
620
- addToSet(ALLOWED_ATTR, xml);
778
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
779
+ CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
621
780
  }
622
-
623
- if (USE_PROFILES.svgFilters === true) {
624
- addToSet(ALLOWED_TAGS, svgFilters);
625
- addToSet(ALLOWED_ATTR, svg$1);
626
- addToSet(ALLOWED_ATTR, xml);
781
+ if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {
782
+ CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
783
+ }
784
+ if (SAFE_FOR_TEMPLATES) {
785
+ ALLOW_DATA_ATTR = false;
786
+ }
787
+ if (RETURN_DOM_FRAGMENT) {
788
+ RETURN_DOM = true;
789
+ }
790
+ /* Parse profile info */
791
+
792
+ if (USE_PROFILES) {
793
+ ALLOWED_TAGS = addToSet({}, _toConsumableArray(text));
794
+ ALLOWED_ATTR = [];
795
+ if (USE_PROFILES.html === true) {
796
+ addToSet(ALLOWED_TAGS, html$1);
797
+ addToSet(ALLOWED_ATTR, html);
798
+ }
799
+ if (USE_PROFILES.svg === true) {
800
+ addToSet(ALLOWED_TAGS, svg$1);
801
+ addToSet(ALLOWED_ATTR, svg);
802
+ addToSet(ALLOWED_ATTR, xml);
803
+ }
804
+ if (USE_PROFILES.svgFilters === true) {
805
+ addToSet(ALLOWED_TAGS, svgFilters);
806
+ addToSet(ALLOWED_ATTR, svg);
807
+ addToSet(ALLOWED_ATTR, xml);
808
+ }
809
+ if (USE_PROFILES.mathMl === true) {
810
+ addToSet(ALLOWED_TAGS, mathMl$1);
811
+ addToSet(ALLOWED_ATTR, mathMl);
812
+ addToSet(ALLOWED_ATTR, xml);
813
+ }
627
814
  }
815
+ /* Merge configuration parameters */
628
816
 
629
- if (USE_PROFILES.mathMl === true) {
630
- addToSet(ALLOWED_TAGS, mathMl);
631
- addToSet(ALLOWED_ATTR, mathMl$1);
632
- addToSet(ALLOWED_ATTR, xml);
817
+ if (cfg.ADD_TAGS) {
818
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
819
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
820
+ }
821
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
633
822
  }
634
- }
635
- /* Merge configuration parameters */
823
+ if (cfg.ADD_ATTR) {
824
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
825
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
826
+ }
827
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
828
+ }
829
+ if (cfg.ADD_URI_SAFE_ATTR) {
830
+ addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
831
+ }
832
+ if (cfg.FORBID_CONTENTS) {
833
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
834
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
835
+ }
836
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
837
+ }
838
+ /* Add #text in case KEEP_CONTENT is set to true */
636
839
 
840
+ if (KEEP_CONTENT) {
841
+ ALLOWED_TAGS['#text'] = true;
842
+ }
843
+ /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
637
844
 
638
- if (cfg.ADD_TAGS) {
639
- if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
640
- ALLOWED_TAGS = clone(ALLOWED_TAGS);
845
+ if (WHOLE_DOCUMENT) {
846
+ addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
641
847
  }
848
+ /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
642
849
 
643
- addToSet(ALLOWED_TAGS, cfg.ADD_TAGS);
644
- }
850
+ if (ALLOWED_TAGS.table) {
851
+ addToSet(ALLOWED_TAGS, ['tbody']);
852
+ delete FORBID_TAGS.tbody;
853
+ } // Prevent further manipulation of configuration.
854
+ // Not available in IE8, Safari 5, etc.
645
855
 
646
- if (cfg.ADD_ATTR) {
647
- if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
648
- ALLOWED_ATTR = clone(ALLOWED_ATTR);
856
+ if (freeze) {
857
+ freeze(cfg);
649
858
  }
859
+ CONFIG = cfg;
860
+ };
861
+ var MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
862
+ var HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']); // Certain elements are allowed in both SVG and HTML
863
+ // namespace. We need to specify them explicitly
864
+ // so that they don't get erroneously deleted from
865
+ // HTML namespace.
866
+
867
+ var COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
868
+ /* Keep track of all possible SVG and MathML tags
869
+ * so that we can perform the namespace checks
870
+ * correctly. */
871
+
872
+ var ALL_SVG_TAGS = addToSet({}, svg$1);
873
+ addToSet(ALL_SVG_TAGS, svgFilters);
874
+ addToSet(ALL_SVG_TAGS, svgDisallowed);
875
+ var ALL_MATHML_TAGS = addToSet({}, mathMl$1);
876
+ addToSet(ALL_MATHML_TAGS, mathMlDisallowed);
877
+ /**
878
+ *
879
+ *
880
+ * @param {Element} element a DOM element whose namespace is being checked
881
+ * @returns {boolean} Return false if the element has a
882
+ * namespace that a spec-compliant parser would never
883
+ * return. Return true otherwise.
884
+ */
650
885
 
651
- addToSet(ALLOWED_ATTR, cfg.ADD_ATTR);
652
- }
653
-
654
- if (cfg.ADD_URI_SAFE_ATTR) {
655
- addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR);
656
- }
657
- /* Add #text in case KEEP_CONTENT is set to true */
886
+ var _checkValidNamespace = function _checkValidNamespace(element) {
887
+ var parent = getParentNode(element); // In JSDOM, if we're inside shadow DOM, then parentNode
888
+ // can be null. We just simulate parent in this case.
658
889
 
890
+ if (!parent || !parent.tagName) {
891
+ parent = {
892
+ namespaceURI: HTML_NAMESPACE,
893
+ tagName: 'template'
894
+ };
895
+ }
896
+ var tagName = stringToLowerCase(element.tagName);
897
+ var parentTagName = stringToLowerCase(parent.tagName);
898
+ if (element.namespaceURI === SVG_NAMESPACE) {
899
+ // The only way to switch from HTML namespace to SVG
900
+ // is via <svg>. If it happens via any other tag, then
901
+ // it should be killed.
902
+ if (parent.namespaceURI === HTML_NAMESPACE) {
903
+ return tagName === 'svg';
904
+ } // The only way to switch from MathML to SVG is via
905
+ // svg if parent is either <annotation-xml> or MathML
906
+ // text integration points.
907
+
908
+ if (parent.namespaceURI === MATHML_NAMESPACE) {
909
+ return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
910
+ } // We only allow elements that are defined in SVG
911
+ // spec. All others are disallowed in SVG namespace.
912
+
913
+ return Boolean(ALL_SVG_TAGS[tagName]);
914
+ }
915
+ if (element.namespaceURI === MATHML_NAMESPACE) {
916
+ // The only way to switch from HTML namespace to MathML
917
+ // is via <math>. If it happens via any other tag, then
918
+ // it should be killed.
919
+ if (parent.namespaceURI === HTML_NAMESPACE) {
920
+ return tagName === 'math';
921
+ } // The only way to switch from SVG to MathML is via
922
+ // <math> and HTML integration points
923
+
924
+ if (parent.namespaceURI === SVG_NAMESPACE) {
925
+ return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
926
+ } // We only allow elements that are defined in MathML
927
+ // spec. All others are disallowed in MathML namespace.
928
+
929
+ return Boolean(ALL_MATHML_TAGS[tagName]);
930
+ }
931
+ if (element.namespaceURI === HTML_NAMESPACE) {
932
+ // The only way to switch from SVG to HTML is via
933
+ // HTML integration points, and from MathML to HTML
934
+ // is via MathML text integration points
935
+ if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
936
+ return false;
937
+ }
938
+ if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
939
+ return false;
940
+ } // We disallow tags that are specific for MathML
941
+ // or SVG and should never appear in HTML namespace
659
942
 
660
- if (KEEP_CONTENT) {
661
- ALLOWED_TAGS['#text'] = true;
662
- }
663
- /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
943
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
944
+ } // The code should never reach this place (this means
945
+ // that the element somehow got namespace that is not
946
+ // HTML, SVG or MathML). Return false just in case.
664
947
 
948
+ return false;
949
+ };
950
+ /**
951
+ * _forceRemove
952
+ *
953
+ * @param {Node} node a DOM node
954
+ */
665
955
 
666
- if (WHOLE_DOCUMENT) {
667
- addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
668
- }
669
- /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286 */
956
+ var _forceRemove = function _forceRemove(node) {
957
+ arrayPush(DOMPurify.removed, {
958
+ element: node
959
+ });
960
+ try {
961
+ // eslint-disable-next-line unicorn/prefer-dom-node-remove
962
+ node.parentNode.removeChild(node);
963
+ } catch (_) {
964
+ try {
965
+ node.outerHTML = emptyHTML;
966
+ } catch (_) {
967
+ node.remove();
968
+ }
969
+ }
970
+ };
971
+ /**
972
+ * _removeAttribute
973
+ *
974
+ * @param {String} name an Attribute name
975
+ * @param {Node} node a DOM node
976
+ */
670
977
 
978
+ var _removeAttribute = function _removeAttribute(name, node) {
979
+ try {
980
+ arrayPush(DOMPurify.removed, {
981
+ attribute: node.getAttributeNode(name),
982
+ from: node
983
+ });
984
+ } catch (_) {
985
+ arrayPush(DOMPurify.removed, {
986
+ attribute: null,
987
+ from: node
988
+ });
989
+ }
990
+ node.removeAttribute(name); // We void attribute values for unremovable "is"" attributes
671
991
 
672
- if (ALLOWED_TAGS.table) {
673
- addToSet(ALLOWED_TAGS, ['tbody']);
674
- } // Prevent further manipulation of configuration.
675
- // Not available in IE8, Safari 5, etc.
992
+ if (name === 'is' && !ALLOWED_ATTR[name]) {
993
+ if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
994
+ try {
995
+ _forceRemove(node);
996
+ } catch (_) {}
997
+ } else {
998
+ try {
999
+ node.setAttribute(name, '');
1000
+ } catch (_) {}
1001
+ }
1002
+ }
1003
+ };
1004
+ /**
1005
+ * _initDocument
1006
+ *
1007
+ * @param {String} dirty a string of dirty markup
1008
+ * @return {Document} a DOM, filled with the dirty markup
1009
+ */
676
1010
 
1011
+ var _initDocument = function _initDocument(dirty) {
1012
+ /* Create a HTML document */
1013
+ var doc;
1014
+ var leadingWhitespace;
1015
+ if (FORCE_BODY) {
1016
+ dirty = '<remove></remove>' + dirty;
1017
+ } else {
1018
+ /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
1019
+ var matches = stringMatch(dirty, /^[\r\n\t ]+/);
1020
+ leadingWhitespace = matches && matches[0];
1021
+ }
1022
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml') {
1023
+ // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
1024
+ dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
1025
+ }
1026
+ var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
1027
+ /*
1028
+ * Use the DOMParser API by default, fallback later if needs be
1029
+ * DOMParser not work for svg when has multiple root element.
1030
+ */
677
1031
 
678
- if (freeze) {
679
- freeze(cfg);
680
- }
1032
+ if (NAMESPACE === HTML_NAMESPACE) {
1033
+ try {
1034
+ doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
1035
+ } catch (_) {}
1036
+ }
1037
+ /* Use createHTMLDocument in case DOMParser is not available */
681
1038
 
682
- CONFIG = cfg;
683
- };
684
- /**
685
- * _forceRemove
686
- *
687
- * @param {Node} node a DOM node
688
- */
1039
+ if (!doc || !doc.documentElement) {
1040
+ doc = implementation.createDocument(NAMESPACE, 'template', null);
1041
+ try {
1042
+ doc.documentElement.innerHTML = IS_EMPTY_INPUT ? '' : dirtyPayload;
1043
+ } catch (_) {// Syntax error if dirtyPayload is invalid xml
1044
+ }
1045
+ }
1046
+ var body = doc.body || doc.documentElement;
1047
+ if (dirty && leadingWhitespace) {
1048
+ body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
1049
+ }
1050
+ /* Work on whole document or just its body */
689
1051
 
1052
+ if (NAMESPACE === HTML_NAMESPACE) {
1053
+ return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
1054
+ }
1055
+ return WHOLE_DOCUMENT ? doc.documentElement : body;
1056
+ };
1057
+ /**
1058
+ * _createIterator
1059
+ *
1060
+ * @param {Document} root document/fragment to create iterator for
1061
+ * @return {Iterator} iterator instance
1062
+ */
690
1063
 
691
- var _forceRemove = function _forceRemove(node) {
692
- DOMPurify.removed.push({
693
- element: node
694
- });
1064
+ var _createIterator = function _createIterator(root) {
1065
+ return createNodeIterator.call(root.ownerDocument || root, root,
1066
+ // eslint-disable-next-line no-bitwise
1067
+ NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null, false);
1068
+ };
1069
+ /**
1070
+ * _isClobbered
1071
+ *
1072
+ * @param {Node} elm element to check for clobbering attacks
1073
+ * @return {Boolean} true if clobbered, false if safe
1074
+ */
695
1075
 
696
- try {
697
- node.parentNode.removeChild(node);
698
- } catch (error) {
699
- node.outerHTML = emptyHTML;
700
- }
701
- };
702
- /**
703
- * _removeAttribute
704
- *
705
- * @param {String} name an Attribute name
706
- * @param {Node} node a DOM node
707
- */
1076
+ var _isClobbered = function _isClobbered(elm) {
1077
+ return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function');
1078
+ };
1079
+ /**
1080
+ * _isNode
1081
+ *
1082
+ * @param {Node} obj object to check whether it's a DOM node
1083
+ * @return {Boolean} true is object is a DOM node
1084
+ */
708
1085
 
1086
+ var _isNode = function _isNode(object) {
1087
+ return _typeof(Node) === 'object' ? object instanceof Node : object && _typeof(object) === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string';
1088
+ };
1089
+ /**
1090
+ * _executeHook
1091
+ * Execute user configurable hooks
1092
+ *
1093
+ * @param {String} entryPoint Name of the hook's entry point
1094
+ * @param {Node} currentNode node to work on with the hook
1095
+ * @param {Object} data additional hook parameters
1096
+ */
709
1097
 
710
- var _removeAttribute = function _removeAttribute(name, node) {
711
- try {
712
- DOMPurify.removed.push({
713
- attribute: node.getAttributeNode(name),
714
- from: node
715
- });
716
- } catch (error) {
717
- DOMPurify.removed.push({
718
- attribute: null,
719
- from: node
1098
+ var _executeHook = function _executeHook(entryPoint, currentNode, data) {
1099
+ if (!hooks[entryPoint]) {
1100
+ return;
1101
+ }
1102
+ arrayForEach(hooks[entryPoint], function (hook) {
1103
+ hook.call(DOMPurify, currentNode, data, CONFIG);
720
1104
  });
721
- }
722
-
723
- node.removeAttribute(name);
724
- };
725
- /**
726
- * _initDocument
727
- *
728
- * @param {String} dirty a string of dirty markup
729
- * @return {Document} a DOM, filled with the dirty markup
730
- */
731
-
1105
+ };
1106
+ /**
1107
+ * _sanitizeElements
1108
+ *
1109
+ * @protect nodeName
1110
+ * @protect textContent
1111
+ * @protect removeChild
1112
+ *
1113
+ * @param {Node} currentNode to check for permission to exist
1114
+ * @return {Boolean} true if node was killed, false if left alive
1115
+ */
732
1116
 
733
- var _initDocument = function _initDocument(dirty) {
734
- /* Create a HTML document */
735
- var doc = void 0;
736
- var leadingWhitespace = void 0;
1117
+ var _sanitizeElements = function _sanitizeElements(currentNode) {
1118
+ var content;
1119
+ /* Execute a hook if present */
737
1120
 
738
- if (FORCE_BODY) {
739
- dirty = '<remove></remove>' + dirty;
740
- } else {
741
- /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
742
- var matches = dirty.match(/^[\s]+/);
743
- leadingWhitespace = matches && matches[0];
1121
+ _executeHook('beforeSanitizeElements', currentNode, null);
1122
+ /* Check if element is clobbered or can clobber */
744
1123
 
745
- if (leadingWhitespace) {
746
- dirty = dirty.slice(leadingWhitespace.length);
1124
+ if (_isClobbered(currentNode)) {
1125
+ _forceRemove(currentNode);
1126
+ return true;
747
1127
  }
748
- }
749
- /* Use DOMParser to workaround Firefox bug (see comment below) */
1128
+ /* Check if tagname contains Unicode */
750
1129
 
1130
+ if (regExpTest(/[\u0080-\uFFFF]/, currentNode.nodeName)) {
1131
+ _forceRemove(currentNode);
1132
+ return true;
1133
+ }
1134
+ /* Now let's check the element's type and name */
751
1135
 
752
- if (useDOMParser) {
753
- try {
754
- doc = new DOMParser().parseFromString(dirty, 'text/html');
755
- } catch (error) {}
756
- }
757
- /* Remove title to fix a mXSS bug in older MS Edge */
1136
+ var tagName = transformCaseFunc(currentNode.nodeName);
1137
+ /* Execute a hook if present */
758
1138
 
1139
+ _executeHook('uponSanitizeElement', currentNode, {
1140
+ tagName: tagName,
1141
+ allowedTags: ALLOWED_TAGS
1142
+ });
1143
+ /* Detect mXSS attempts abusing namespace confusion */
759
1144
 
760
- if (removeTitle) {
761
- addToSet(FORBID_TAGS, ['title']);
762
- }
763
- /* Otherwise use createHTMLDocument, because DOMParser is unsafe in
764
- Safari (see comment below) */
1145
+ if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
1146
+ _forceRemove(currentNode);
1147
+ return true;
1148
+ }
1149
+ /* Mitigate a problem with templates inside select */
765
1150
 
1151
+ if (tagName === 'select' && regExpTest(/<template/i, currentNode.innerHTML)) {
1152
+ _forceRemove(currentNode);
1153
+ return true;
1154
+ }
1155
+ /* Remove element if anything forbids its presence */
766
1156
 
767
- if (!doc || !doc.documentElement) {
768
- doc = implementation.createHTMLDocument('');
769
- var _doc = doc,
770
- body = _doc.body;
771
- body.parentNode.removeChild(body.parentNode.firstElementChild);
772
- body.outerHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
773
- }
1157
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
1158
+ /* Check if we have a custom element to handle */
1159
+ if (!FORBID_TAGS[tagName] && _basicCustomElementTest(tagName)) {
1160
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
1161
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) return false;
1162
+ }
1163
+ /* Keep content except for bad-listed elements */
1164
+
1165
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
1166
+ var parentNode = getParentNode(currentNode) || currentNode.parentNode;
1167
+ var childNodes = getChildNodes(currentNode) || currentNode.childNodes;
1168
+ if (childNodes && parentNode) {
1169
+ var childCount = childNodes.length;
1170
+ for (var i = childCount - 1; i >= 0; --i) {
1171
+ parentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode));
1172
+ }
1173
+ }
1174
+ }
1175
+ _forceRemove(currentNode);
1176
+ return true;
1177
+ }
1178
+ /* Check whether element has a valid namespace */
774
1179
 
775
- if (leadingWhitespace) {
776
- doc.body.insertBefore(document.createTextNode(leadingWhitespace), doc.body.childNodes[0] || null);
777
- }
778
- /* Work on whole document or just its body */
779
-
780
-
781
- return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
782
- }; // Firefox uses a different parser for innerHTML rather than
783
- // DOMParser (see https://bugzilla.mozilla.org/show_bug.cgi?id=1205631)
784
- // which means that you *must* use DOMParser, otherwise the output may
785
- // not be safe if used in a document.write context later.
786
- //
787
- // So we feature detect the Firefox bug and use the DOMParser if necessary.
788
- //
789
- // MS Edge, in older versions, is affected by an mXSS behavior. The second
790
- // check tests for the behavior and fixes it if necessary.
791
-
792
-
793
- if (DOMPurify.isSupported) {
794
- (function () {
795
- try {
796
- var doc = _initDocument('<svg><p><style><img src="</style><img src=x onerror=1//">');
797
-
798
- if (doc.querySelector('svg img')) {
799
- useDOMParser = true;
800
- }
801
- } catch (error) {}
802
- })();
803
-
804
- (function () {
805
- try {
806
- var doc = _initDocument('<x/><title>&lt;/title&gt;&lt;img&gt;');
807
-
808
- if (doc.querySelector('title').innerHTML.match(/<\/title/)) {
809
- removeTitle = true;
1180
+ if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
1181
+ _forceRemove(currentNode);
1182
+ return true;
1183
+ }
1184
+ if ((tagName === 'noscript' || tagName === 'noembed') && regExpTest(/<\/no(script|embed)/i, currentNode.innerHTML)) {
1185
+ _forceRemove(currentNode);
1186
+ return true;
1187
+ }
1188
+ /* Sanitize element content to be template-safe */
1189
+
1190
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
1191
+ /* Get the element's text content */
1192
+ content = currentNode.textContent;
1193
+ content = stringReplace(content, MUSTACHE_EXPR$1, ' ');
1194
+ content = stringReplace(content, ERB_EXPR$1, ' ');
1195
+ if (currentNode.textContent !== content) {
1196
+ arrayPush(DOMPurify.removed, {
1197
+ element: currentNode.cloneNode()
1198
+ });
1199
+ currentNode.textContent = content;
810
1200
  }
811
- } catch (error) {}
812
- })();
813
- }
814
- /**
815
- * _createIterator
816
- *
817
- * @param {Document} root document/fragment to create iterator for
818
- * @return {Iterator} iterator instance
819
- */
820
-
821
-
822
- var _createIterator = function _createIterator(root) {
823
- return createNodeIterator.call(root.ownerDocument || root, root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, function () {
824
- return NodeFilter.FILTER_ACCEPT;
825
- }, false);
826
- };
827
- /**
828
- * _isClobbered
829
- *
830
- * @param {Node} elm element to check for clobbering attacks
831
- * @return {Boolean} true if clobbered, false if safe
832
- */
833
-
1201
+ }
1202
+ /* Execute a hook if present */
834
1203
 
835
- var _isClobbered = function _isClobbered(elm) {
836
- if (elm instanceof Text || elm instanceof Comment) {
1204
+ _executeHook('afterSanitizeElements', currentNode, null);
837
1205
  return false;
838
- }
839
-
840
- if (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function') {
841
- return true;
842
- }
843
-
844
- return false;
845
- };
846
- /**
847
- * _isNode
848
- *
849
- * @param {Node} obj object to check whether it's a DOM node
850
- * @return {Boolean} true is object is a DOM node
851
- */
852
-
853
-
854
- var _isNode = function _isNode(obj) {
855
- return (typeof Node === 'undefined' ? 'undefined' : _typeof$1(Node)) === 'object' ? obj instanceof Node : obj && (typeof obj === 'undefined' ? 'undefined' : _typeof$1(obj)) === 'object' && typeof obj.nodeType === 'number' && typeof obj.nodeName === 'string';
856
- };
857
- /**
858
- * _executeHook
859
- * Execute user configurable hooks
860
- *
861
- * @param {String} entryPoint Name of the hook's entry point
862
- * @param {Node} currentNode node to work on with the hook
863
- * @param {Object} data additional hook parameters
864
- */
865
-
866
-
867
- var _executeHook = function _executeHook(entryPoint, currentNode, data) {
868
- if (!hooks[entryPoint]) {
869
- return;
870
- }
871
-
872
- hooks[entryPoint].forEach(function (hook) {
873
- hook.call(DOMPurify, currentNode, data, CONFIG);
874
- });
875
- };
876
- /**
877
- * _sanitizeElements
878
- *
879
- * @protect nodeName
880
- * @protect textContent
881
- * @protect removeChild
882
- *
883
- * @param {Node} currentNode to check for permission to exist
884
- * @return {Boolean} true if node was killed, false if left alive
885
- */
886
- // eslint-disable-next-line complexity
887
-
888
-
889
- var _sanitizeElements = function _sanitizeElements(currentNode) {
890
- var content = void 0;
891
- /* Execute a hook if present */
892
-
893
- _executeHook('beforeSanitizeElements', currentNode, null);
894
- /* Check if element is clobbered or can clobber */
895
-
896
-
897
- if (_isClobbered(currentNode)) {
898
- _forceRemove(currentNode);
899
-
900
- return true;
901
- }
902
- /* Now let's check the element's type and name */
903
-
904
-
905
- var tagName = currentNode.nodeName.toLowerCase();
906
- /* Execute a hook if present */
907
-
908
- _executeHook('uponSanitizeElement', currentNode, {
909
- tagName: tagName,
910
- allowedTags: ALLOWED_TAGS
911
- });
912
- /* Remove element if anything forbids its presence */
913
-
1206
+ };
1207
+ /**
1208
+ * _isValidAttribute
1209
+ *
1210
+ * @param {string} lcTag Lowercase tag name of containing element.
1211
+ * @param {string} lcName Lowercase attribute name.
1212
+ * @param {string} value Attribute value.
1213
+ * @return {Boolean} Returns true if `value` is valid, otherwise false.
1214
+ */
1215
+ // eslint-disable-next-line complexity
914
1216
 
915
- if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
916
- /* Keep content except for black-listed elements */
917
- if (KEEP_CONTENT && !FORBID_CONTENTS[tagName] && typeof currentNode.insertAdjacentHTML === 'function') {
918
- try {
919
- var htmlToInsert = currentNode.innerHTML;
920
- currentNode.insertAdjacentHTML('AfterEnd', trustedTypesPolicy ? trustedTypesPolicy.createHTML(htmlToInsert) : htmlToInsert);
921
- } catch (error) {}
1217
+ var _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
1218
+ /* Make sure attribute cannot clobber */
1219
+ if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
1220
+ return false;
1221
+ }
1222
+ /* Allow valid data-* attributes: At least one character after "-"
1223
+ (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
1224
+ XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
1225
+ We don't need to check the value; it's always URI safe. */
1226
+
1227
+ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR$1, lcName)) ;else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName)) ;else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
1228
+ if (
1229
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
1230
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1231
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
1232
+ _basicCustomElementTest(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) ||
1233
+ // Alternative, second condition checks if it's an `is`-attribute, AND
1234
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1235
+ 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 {
1236
+ return false;
1237
+ }
1238
+ /* Check value is safe. First, is attr inert? If so, is safe */
1239
+ } 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) ;else {
1240
+ return false;
922
1241
  }
923
-
924
- _forceRemove(currentNode);
925
-
926
- return true;
927
- }
928
- /* Remove in case a noscript/noembed XSS is suspected */
929
-
930
-
931
- if (tagName === 'noscript' && currentNode.innerHTML.match(/<\/noscript/i)) {
932
- _forceRemove(currentNode);
933
-
934
- return true;
935
- }
936
-
937
- if (tagName === 'noembed' && currentNode.innerHTML.match(/<\/noembed/i)) {
938
- _forceRemove(currentNode);
939
-
940
1242
  return true;
941
- }
942
- /* Convert markup to cover jQuery behavior */
943
-
944
-
945
- if (SAFE_FOR_JQUERY && !currentNode.firstElementChild && (!currentNode.content || !currentNode.content.firstElementChild) && /</g.test(currentNode.textContent)) {
946
- DOMPurify.removed.push({
947
- element: currentNode.cloneNode()
948
- });
1243
+ };
1244
+ /**
1245
+ * _basicCustomElementCheck
1246
+ * checks if at least one dash is included in tagName, and it's not the first char
1247
+ * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
1248
+ * @param {string} tagName name of the tag of the node to sanitize
1249
+ */
949
1250
 
950
- if (currentNode.innerHTML) {
951
- currentNode.innerHTML = currentNode.innerHTML.replace(/</g, '&lt;');
952
- } else {
953
- currentNode.innerHTML = currentNode.textContent.replace(/</g, '&lt;');
954
- }
955
- }
956
- /* Sanitize element content to be template-safe */
1251
+ var _basicCustomElementTest = function _basicCustomElementTest(tagName) {
1252
+ return tagName.indexOf('-') > 0;
1253
+ };
1254
+ /**
1255
+ * _sanitizeAttributes
1256
+ *
1257
+ * @protect attributes
1258
+ * @protect nodeName
1259
+ * @protect removeAttribute
1260
+ * @protect setAttribute
1261
+ *
1262
+ * @param {Node} currentNode to sanitize
1263
+ */
957
1264
 
1265
+ var _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
1266
+ var attr;
1267
+ var value;
1268
+ var lcName;
1269
+ var l;
1270
+ /* Execute a hook if present */
958
1271
 
959
- if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
960
- /* Get the element's text content */
961
- content = currentNode.textContent;
962
- content = content.replace(MUSTACHE_EXPR$$1, ' ');
963
- content = content.replace(ERB_EXPR$$1, ' ');
1272
+ _executeHook('beforeSanitizeAttributes', currentNode, null);
1273
+ var attributes = currentNode.attributes;
1274
+ /* Check if we have attributes; if not we might have a text node */
964
1275
 
965
- if (currentNode.textContent !== content) {
966
- DOMPurify.removed.push({
967
- element: currentNode.cloneNode()
968
- });
969
- currentNode.textContent = content;
1276
+ if (!attributes) {
1277
+ return;
970
1278
  }
971
- }
972
- /* Execute a hook if present */
973
-
974
-
975
- _executeHook('afterSanitizeElements', currentNode, null);
1279
+ var hookEvent = {
1280
+ attrName: '',
1281
+ attrValue: '',
1282
+ keepAttr: true,
1283
+ allowedAttributes: ALLOWED_ATTR
1284
+ };
1285
+ l = attributes.length;
1286
+ /* Go backwards over all attributes; safely remove bad ones */
1287
+
1288
+ while (l--) {
1289
+ attr = attributes[l];
1290
+ var _attr = attr,
1291
+ name = _attr.name,
1292
+ namespaceURI = _attr.namespaceURI;
1293
+ value = name === 'value' ? attr.value : stringTrim(attr.value);
1294
+ lcName = transformCaseFunc(name);
1295
+ /* Execute a hook if present */
976
1296
 
977
- return false;
978
- };
979
- /**
980
- * _isValidAttribute
981
- *
982
- * @param {string} lcTag Lowercase tag name of containing element.
983
- * @param {string} lcName Lowercase attribute name.
984
- * @param {string} value Attribute value.
985
- * @return {Boolean} Returns true if `value` is valid, otherwise false.
986
- */
987
- // eslint-disable-next-line complexity
1297
+ hookEvent.attrName = lcName;
1298
+ hookEvent.attrValue = value;
1299
+ hookEvent.keepAttr = true;
1300
+ hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
988
1301
 
1302
+ _executeHook('uponSanitizeAttribute', currentNode, hookEvent);
1303
+ value = hookEvent.attrValue;
1304
+ /* Did the hooks approve of the attribute? */
989
1305
 
990
- var _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
991
- /* Make sure attribute cannot clobber */
992
- if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
993
- return false;
994
- }
995
- /* Allow valid data-* attributes: At least one character after "-"
996
- (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
997
- XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
998
- We don't need to check the value; it's always URI safe. */
1306
+ if (hookEvent.forceKeepAttr) {
1307
+ continue;
1308
+ }
1309
+ /* Remove attribute */
999
1310
 
1311
+ _removeAttribute(name, currentNode);
1312
+ /* Did the hooks approve of the attribute? */
1000
1313
 
1001
- if (ALLOW_DATA_ATTR && DATA_ATTR$$1.test(lcName)) ; else if (ALLOW_ARIA_ATTR && ARIA_ATTR$$1.test(lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
1002
- return false;
1003
- /* Check value is safe. First, is attr inert? If so, is safe */
1004
- } else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (IS_ALLOWED_URI$$1.test(value.replace(ATTR_WHITESPACE$$1, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href') && lcTag !== 'script' && value.indexOf('data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !IS_SCRIPT_OR_DATA$$1.test(value.replace(ATTR_WHITESPACE$$1, ''))) ; else if (!value) ; else {
1005
- return false;
1006
- }
1314
+ if (!hookEvent.keepAttr) {
1315
+ continue;
1316
+ }
1317
+ /* Work around a security issue in jQuery 3.0 */
1007
1318
 
1008
- return true;
1009
- };
1010
- /**
1011
- * _sanitizeAttributes
1012
- *
1013
- * @protect attributes
1014
- * @protect nodeName
1015
- * @protect removeAttribute
1016
- * @protect setAttribute
1017
- *
1018
- * @param {Node} currentNode to sanitize
1019
- */
1319
+ if (regExpTest(/\/>/i, value)) {
1320
+ _removeAttribute(name, currentNode);
1321
+ continue;
1322
+ }
1323
+ /* Sanitize attribute content to be template-safe */
1020
1324
 
1325
+ if (SAFE_FOR_TEMPLATES) {
1326
+ value = stringReplace(value, MUSTACHE_EXPR$1, ' ');
1327
+ value = stringReplace(value, ERB_EXPR$1, ' ');
1328
+ }
1329
+ /* Is `value` valid for this attribute? */
1021
1330
 
1022
- var _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
1023
- var attr = void 0;
1024
- var value = void 0;
1025
- var lcName = void 0;
1026
- var idAttr = void 0;
1027
- var l = void 0;
1028
- /* Execute a hook if present */
1331
+ var lcTag = transformCaseFunc(currentNode.nodeName);
1332
+ if (!_isValidAttribute(lcTag, lcName, value)) {
1333
+ continue;
1334
+ }
1335
+ /* Full DOM Clobbering protection via namespace isolation,
1336
+ * Prefix id and name attributes with `user-content-`
1337
+ */
1029
1338
 
1030
- _executeHook('beforeSanitizeAttributes', currentNode, null);
1339
+ if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {
1340
+ // Remove the attribute with this value
1341
+ _removeAttribute(name, currentNode); // Prefix the value and later re-create the attribute with the sanitized value
1031
1342
 
1032
- var attributes = currentNode.attributes;
1033
- /* Check if we have attributes; if not we might have a text node */
1343
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
1344
+ }
1345
+ /* Handle attributes that require Trusted Types */
1346
+
1347
+ if (trustedTypesPolicy && _typeof(trustedTypes) === 'object' && typeof trustedTypes.getAttributeType === 'function') {
1348
+ if (namespaceURI) ;else {
1349
+ switch (trustedTypes.getAttributeType(lcTag, lcName)) {
1350
+ case 'TrustedHTML':
1351
+ value = trustedTypesPolicy.createHTML(value);
1352
+ break;
1353
+ case 'TrustedScriptURL':
1354
+ value = trustedTypesPolicy.createScriptURL(value);
1355
+ break;
1356
+ }
1357
+ }
1358
+ }
1359
+ /* Handle invalid data-* attribute set by try-catching it */
1034
1360
 
1035
- if (!attributes) {
1036
- return;
1037
- }
1361
+ try {
1362
+ if (namespaceURI) {
1363
+ currentNode.setAttributeNS(namespaceURI, name, value);
1364
+ } else {
1365
+ /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
1366
+ currentNode.setAttribute(name, value);
1367
+ }
1368
+ arrayPop(DOMPurify.removed);
1369
+ } catch (_) {}
1370
+ }
1371
+ /* Execute a hook if present */
1038
1372
 
1039
- var hookEvent = {
1040
- attrName: '',
1041
- attrValue: '',
1042
- keepAttr: true,
1043
- allowedAttributes: ALLOWED_ATTR
1373
+ _executeHook('afterSanitizeAttributes', currentNode, null);
1044
1374
  };
1045
- l = attributes.length;
1046
- /* Go backwards over all attributes; safely remove bad ones */
1375
+ /**
1376
+ * _sanitizeShadowDOM
1377
+ *
1378
+ * @param {DocumentFragment} fragment to iterate over recursively
1379
+ */
1047
1380
 
1048
- while (l--) {
1049
- attr = attributes[l];
1050
- var _attr = attr,
1051
- name = _attr.name,
1052
- namespaceURI = _attr.namespaceURI;
1053
- value = attr.value.trim();
1054
- lcName = name.toLowerCase();
1381
+ var _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
1382
+ var shadowNode;
1383
+ var shadowIterator = _createIterator(fragment);
1055
1384
  /* Execute a hook if present */
1056
1385
 
1057
- hookEvent.attrName = lcName;
1058
- hookEvent.attrValue = value;
1059
- hookEvent.keepAttr = true;
1060
-
1061
- _executeHook('uponSanitizeAttribute', currentNode, hookEvent);
1062
-
1063
- value = hookEvent.attrValue;
1064
- /* Remove attribute */
1065
- // Safari (iOS + Mac), last tested v8.0.5, crashes if you try to
1066
- // remove a "name" attribute from an <img> tag that has an "id"
1067
- // attribute at the time.
1386
+ _executeHook('beforeSanitizeShadowDOM', fragment, null);
1387
+ while (shadowNode = shadowIterator.nextNode()) {
1388
+ /* Execute a hook if present */
1389
+ _executeHook('uponSanitizeShadowNode', shadowNode, null);
1390
+ /* Sanitize tags and elements */
1068
1391
 
1069
- if (lcName === 'name' && currentNode.nodeName === 'IMG' && attributes.id) {
1070
- idAttr = attributes.id;
1071
- attributes = apply(arraySlice, attributes, []);
1072
-
1073
- _removeAttribute('id', currentNode);
1074
-
1075
- _removeAttribute(name, currentNode);
1076
-
1077
- if (attributes.indexOf(idAttr) > l) {
1078
- currentNode.setAttribute('id', idAttr.value);
1392
+ if (_sanitizeElements(shadowNode)) {
1393
+ continue;
1079
1394
  }
1080
- } else if ( // This works around a bug in Safari, where input[type=file]
1081
- // cannot be dynamically set after type has been removed
1082
- currentNode.nodeName === 'INPUT' && lcName === 'type' && value === 'file' && hookEvent.keepAttr && (ALLOWED_ATTR[lcName] || !FORBID_ATTR[lcName])) {
1083
- continue;
1084
- } else {
1085
- // This avoids a crash in Safari v9.0 with double-ids.
1086
- // The trick is to first set the id to be empty and then to
1087
- // remove the attribute
1088
- if (name === 'id') {
1089
- currentNode.setAttribute(name, '');
1395
+ /* Deep shadow DOM detected */
1396
+
1397
+ if (shadowNode.content instanceof DocumentFragment) {
1398
+ _sanitizeShadowDOM(shadowNode.content);
1090
1399
  }
1400
+ /* Check attributes, sanitize if necessary */
1091
1401
 
1092
- _removeAttribute(name, currentNode);
1402
+ _sanitizeAttributes(shadowNode);
1093
1403
  }
1094
- /* Did the hooks approve of the attribute? */
1095
-
1404
+ /* Execute a hook if present */
1096
1405
 
1097
- if (!hookEvent.keepAttr) {
1098
- continue;
1406
+ _executeHook('afterSanitizeShadowDOM', fragment, null);
1407
+ };
1408
+ /**
1409
+ * Sanitize
1410
+ * Public method providing core sanitation functionality
1411
+ *
1412
+ * @param {String|Node} dirty string or DOM node
1413
+ * @param {Object} configuration object
1414
+ */
1415
+ // eslint-disable-next-line complexity
1416
+
1417
+ DOMPurify.sanitize = function (dirty) {
1418
+ var cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1419
+ var body;
1420
+ var importedNode;
1421
+ var currentNode;
1422
+ var oldNode;
1423
+ var returnNode;
1424
+ /* Make sure we have a string to sanitize.
1425
+ DO NOT return early, as this will return the wrong type if
1426
+ the user has requested a DOM object rather than a string */
1427
+
1428
+ IS_EMPTY_INPUT = !dirty;
1429
+ if (IS_EMPTY_INPUT) {
1430
+ dirty = '<!-->';
1099
1431
  }
1100
- /* Sanitize attribute content to be template-safe */
1101
-
1432
+ /* Stringify, in case dirty is an object */
1102
1433
 
1103
- if (SAFE_FOR_TEMPLATES) {
1104
- value = value.replace(MUSTACHE_EXPR$$1, ' ');
1105
- value = value.replace(ERB_EXPR$$1, ' ');
1434
+ if (typeof dirty !== 'string' && !_isNode(dirty)) {
1435
+ // eslint-disable-next-line no-negated-condition
1436
+ if (typeof dirty.toString !== 'function') {
1437
+ throw typeErrorCreate('toString is not a function');
1438
+ } else {
1439
+ dirty = dirty.toString();
1440
+ if (typeof dirty !== 'string') {
1441
+ throw typeErrorCreate('dirty is not a string, aborting');
1442
+ }
1443
+ }
1106
1444
  }
1107
- /* Is `value` valid for this attribute? */
1108
-
1109
-
1110
- var lcTag = currentNode.nodeName.toLowerCase();
1445
+ /* Check we can run. Otherwise fall back or ignore */
1446
+
1447
+ if (!DOMPurify.isSupported) {
1448
+ if (_typeof(window.toStaticHTML) === 'object' || typeof window.toStaticHTML === 'function') {
1449
+ if (typeof dirty === 'string') {
1450
+ return window.toStaticHTML(dirty);
1451
+ }
1452
+ if (_isNode(dirty)) {
1453
+ return window.toStaticHTML(dirty.outerHTML);
1454
+ }
1455
+ }
1456
+ return dirty;
1457
+ }
1458
+ /* Assign config vars */
1111
1459
 
1112
- if (!_isValidAttribute(lcTag, lcName, value)) {
1113
- continue;
1460
+ if (!SET_CONFIG) {
1461
+ _parseConfig(cfg);
1114
1462
  }
1115
- /* Handle invalid data-* attribute set by try-catching it */
1463
+ /* Clean up removed elements */
1116
1464
 
1465
+ DOMPurify.removed = [];
1466
+ /* Check if dirty is correctly typed for IN_PLACE */
1117
1467
 
1118
- try {
1119
- if (namespaceURI) {
1120
- currentNode.setAttributeNS(namespaceURI, name, value);
1468
+ if (typeof dirty === 'string') {
1469
+ IN_PLACE = false;
1470
+ }
1471
+ if (IN_PLACE) {
1472
+ /* Do some early pre-sanitization to avoid unsafe root nodes */
1473
+ if (dirty.nodeName) {
1474
+ var tagName = transformCaseFunc(dirty.nodeName);
1475
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
1476
+ throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
1477
+ }
1478
+ }
1479
+ } else if (dirty instanceof Node) {
1480
+ /* If dirty is a DOM element, append to an empty document to avoid
1481
+ elements being stripped by the parser */
1482
+ body = _initDocument('<!---->');
1483
+ importedNode = body.ownerDocument.importNode(dirty, true);
1484
+ if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {
1485
+ /* Node is already a body, use as is */
1486
+ body = importedNode;
1487
+ } else if (importedNode.nodeName === 'HTML') {
1488
+ body = importedNode;
1121
1489
  } else {
1122
- /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
1123
- currentNode.setAttribute(name, value);
1490
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
1491
+ body.appendChild(importedNode);
1124
1492
  }
1493
+ } else {
1494
+ /* Exit directly if we have nothing to do */
1495
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT &&
1496
+ // eslint-disable-next-line unicorn/prefer-includes
1497
+ dirty.indexOf('<') === -1) {
1498
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
1499
+ }
1500
+ /* Initialize the document to work on */
1125
1501
 
1126
- DOMPurify.removed.pop();
1127
- } catch (error) {}
1128
- }
1129
- /* Execute a hook if present */
1130
-
1131
-
1132
- _executeHook('afterSanitizeAttributes', currentNode, null);
1133
- };
1134
- /**
1135
- * _sanitizeShadowDOM
1136
- *
1137
- * @param {DocumentFragment} fragment to iterate over recursively
1138
- */
1139
-
1140
-
1141
- var _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
1142
- var shadowNode = void 0;
1143
-
1144
- var shadowIterator = _createIterator(fragment);
1145
- /* Execute a hook if present */
1146
-
1147
-
1148
- _executeHook('beforeSanitizeShadowDOM', fragment, null);
1149
-
1150
- while (shadowNode = shadowIterator.nextNode()) {
1151
- /* Execute a hook if present */
1152
- _executeHook('uponSanitizeShadowNode', shadowNode, null);
1153
- /* Sanitize tags and elements */
1154
-
1502
+ body = _initDocument(dirty);
1503
+ /* Check we have a DOM node from the data */
1155
1504
 
1156
- if (_sanitizeElements(shadowNode)) {
1157
- continue;
1505
+ if (!body) {
1506
+ return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';
1507
+ }
1158
1508
  }
1159
- /* Deep shadow DOM detected */
1509
+ /* Remove first element node (ours) if FORCE_BODY is set */
1160
1510
 
1161
-
1162
- if (shadowNode.content instanceof DocumentFragment) {
1163
- _sanitizeShadowDOM(shadowNode.content);
1511
+ if (body && FORCE_BODY) {
1512
+ _forceRemove(body.firstChild);
1164
1513
  }
1165
- /* Check attributes, sanitize if necessary */
1166
-
1167
-
1168
- _sanitizeAttributes(shadowNode);
1169
- }
1170
- /* Execute a hook if present */
1171
-
1172
-
1173
- _executeHook('afterSanitizeShadowDOM', fragment, null);
1174
- };
1175
- /**
1176
- * Sanitize
1177
- * Public method providing core sanitation functionality
1178
- *
1179
- * @param {String|Node} dirty string or DOM node
1180
- * @param {Object} configuration object
1181
- */
1182
- // eslint-disable-next-line complexity
1514
+ /* Get node iterator */
1183
1515
 
1516
+ var nodeIterator = _createIterator(IN_PLACE ? dirty : body);
1517
+ /* Now start iterating over the created document */
1184
1518
 
1185
- DOMPurify.sanitize = function (dirty, cfg) {
1186
- var body = void 0;
1187
- var importedNode = void 0;
1188
- var currentNode = void 0;
1189
- var oldNode = void 0;
1190
- var returnNode = void 0;
1191
- /* Make sure we have a string to sanitize.
1192
- DO NOT return early, as this will return the wrong type if
1193
- the user has requested a DOM object rather than a string */
1194
-
1195
- if (!dirty) {
1196
- dirty = '<!-->';
1197
- }
1198
- /* Stringify, in case dirty is an object */
1199
-
1200
-
1201
- if (typeof dirty !== 'string' && !_isNode(dirty)) {
1202
- // eslint-disable-next-line no-negated-condition
1203
- if (typeof dirty.toString !== 'function') {
1204
- throw new TypeError('toString is not a function');
1205
- } else {
1206
- dirty = dirty.toString();
1207
-
1208
- if (typeof dirty !== 'string') {
1209
- throw new TypeError('dirty is not a string, aborting');
1519
+ while (currentNode = nodeIterator.nextNode()) {
1520
+ /* Fix IE's strange behavior with manipulated textNodes #89 */
1521
+ if (currentNode.nodeType === 3 && currentNode === oldNode) {
1522
+ continue;
1210
1523
  }
1211
- }
1212
- }
1213
- /* Check we can run. Otherwise fall back or ignore */
1524
+ /* Sanitize tags and elements */
1214
1525
 
1215
-
1216
- if (!DOMPurify.isSupported) {
1217
- if (_typeof$1(window.toStaticHTML) === 'object' || typeof window.toStaticHTML === 'function') {
1218
- if (typeof dirty === 'string') {
1219
- return window.toStaticHTML(dirty);
1526
+ if (_sanitizeElements(currentNode)) {
1527
+ continue;
1220
1528
  }
1529
+ /* Shadow DOM detected, sanitize it */
1221
1530
 
1222
- if (_isNode(dirty)) {
1223
- return window.toStaticHTML(dirty.outerHTML);
1531
+ if (currentNode.content instanceof DocumentFragment) {
1532
+ _sanitizeShadowDOM(currentNode.content);
1224
1533
  }
1225
- }
1534
+ /* Check attributes, sanitize if necessary */
1226
1535
 
1227
- return dirty;
1228
- }
1229
- /* Assign config vars */
1230
-
1231
-
1232
- if (!SET_CONFIG) {
1233
- _parseConfig(cfg);
1234
- }
1235
- /* Clean up removed elements */
1236
-
1237
-
1238
- DOMPurify.removed = [];
1239
-
1240
- if (IN_PLACE) ; else if (dirty instanceof Node) {
1241
- /* If dirty is a DOM element, append to an empty document to avoid
1242
- elements being stripped by the parser */
1243
- body = _initDocument('<!-->');
1244
- importedNode = body.ownerDocument.importNode(dirty, true);
1245
-
1246
- if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {
1247
- /* Node is already a body, use as is */
1248
- body = importedNode;
1249
- } else if (importedNode.nodeName === 'HTML') {
1250
- body = importedNode;
1251
- } else {
1252
- // eslint-disable-next-line unicorn/prefer-node-append
1253
- body.appendChild(importedNode);
1536
+ _sanitizeAttributes(currentNode);
1537
+ oldNode = currentNode;
1254
1538
  }
1255
- } else {
1256
- /* Exit directly if we have nothing to do */
1257
- if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && dirty.indexOf('<') === -1) {
1258
- return trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
1259
- }
1260
- /* Initialize the document to work on */
1261
-
1539
+ oldNode = null;
1540
+ /* If we sanitized `dirty` in-place, return it. */
1262
1541
 
1263
- body = _initDocument(dirty);
1264
- /* Check we have a DOM node from the data */
1265
-
1266
- if (!body) {
1267
- return RETURN_DOM ? null : emptyHTML;
1542
+ if (IN_PLACE) {
1543
+ return dirty;
1268
1544
  }
1269
- }
1270
- /* Remove first element node (ours) if FORCE_BODY is set */
1271
-
1272
-
1273
- if (body && FORCE_BODY) {
1274
- _forceRemove(body.firstChild);
1275
- }
1276
- /* Get node iterator */
1277
-
1278
-
1279
- var nodeIterator = _createIterator(IN_PLACE ? dirty : body);
1280
- /* Now start iterating over the created document */
1281
-
1282
-
1283
- while (currentNode = nodeIterator.nextNode()) {
1284
- /* Fix IE's strange behavior with manipulated textNodes #89 */
1285
- if (currentNode.nodeType === 3 && currentNode === oldNode) {
1286
- continue;
1545
+ /* Return sanitized string or DOM */
1546
+
1547
+ if (RETURN_DOM) {
1548
+ if (RETURN_DOM_FRAGMENT) {
1549
+ returnNode = createDocumentFragment.call(body.ownerDocument);
1550
+ while (body.firstChild) {
1551
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
1552
+ returnNode.appendChild(body.firstChild);
1553
+ }
1554
+ } else {
1555
+ returnNode = body;
1556
+ }
1557
+ if (ALLOWED_ATTR.shadowroot) {
1558
+ /*
1559
+ AdoptNode() is not used because internal state is not reset
1560
+ (e.g. the past names map of a HTMLFormElement), this is safe
1561
+ in theory but we would rather not risk another attack vector.
1562
+ The state that is cloned by importNode() is explicitly defined
1563
+ by the specs.
1564
+ */
1565
+ returnNode = importNode.call(originalDocument, returnNode, true);
1566
+ }
1567
+ return returnNode;
1287
1568
  }
1288
- /* Sanitize tags and elements */
1569
+ var serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
1570
+ /* Serialize doctype if allowed */
1289
1571
 
1290
-
1291
- if (_sanitizeElements(currentNode)) {
1292
- continue;
1572
+ if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
1573
+ serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML;
1293
1574
  }
1294
- /* Shadow DOM detected, sanitize it */
1295
-
1575
+ /* Sanitize final string template-safe */
1296
1576
 
1297
- if (currentNode.content instanceof DocumentFragment) {
1298
- _sanitizeShadowDOM(currentNode.content);
1577
+ if (SAFE_FOR_TEMPLATES) {
1578
+ serializedHTML = stringReplace(serializedHTML, MUSTACHE_EXPR$1, ' ');
1579
+ serializedHTML = stringReplace(serializedHTML, ERB_EXPR$1, ' ');
1299
1580
  }
1300
- /* Check attributes, sanitize if necessary */
1301
-
1302
-
1303
- _sanitizeAttributes(currentNode);
1304
-
1305
- oldNode = currentNode;
1306
- }
1307
-
1308
- oldNode = null;
1309
- /* If we sanitized `dirty` in-place, return it. */
1310
-
1311
- if (IN_PLACE) {
1312
- return dirty;
1313
- }
1314
- /* Return sanitized string or DOM */
1581
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
1582
+ };
1583
+ /**
1584
+ * Public method to set the configuration once
1585
+ * setConfig
1586
+ *
1587
+ * @param {Object} cfg configuration object
1588
+ */
1315
1589
 
1590
+ DOMPurify.setConfig = function (cfg) {
1591
+ _parseConfig(cfg);
1592
+ SET_CONFIG = true;
1593
+ };
1594
+ /**
1595
+ * Public method to remove the configuration
1596
+ * clearConfig
1597
+ *
1598
+ */
1316
1599
 
1317
- if (RETURN_DOM) {
1318
- if (RETURN_DOM_FRAGMENT) {
1319
- returnNode = createDocumentFragment.call(body.ownerDocument);
1600
+ DOMPurify.clearConfig = function () {
1601
+ CONFIG = null;
1602
+ SET_CONFIG = false;
1603
+ };
1604
+ /**
1605
+ * Public method to check if an attribute value is valid.
1606
+ * Uses last set config, if any. Otherwise, uses config defaults.
1607
+ * isValidAttribute
1608
+ *
1609
+ * @param {string} tag Tag name of containing element.
1610
+ * @param {string} attr Attribute name.
1611
+ * @param {string} value Attribute value.
1612
+ * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.
1613
+ */
1320
1614
 
1321
- while (body.firstChild) {
1322
- // eslint-disable-next-line unicorn/prefer-node-append
1323
- returnNode.appendChild(body.firstChild);
1324
- }
1325
- } else {
1326
- returnNode = body;
1615
+ DOMPurify.isValidAttribute = function (tag, attr, value) {
1616
+ /* Initialize shared config vars if necessary. */
1617
+ if (!CONFIG) {
1618
+ _parseConfig({});
1327
1619
  }
1620
+ var lcTag = transformCaseFunc(tag);
1621
+ var lcName = transformCaseFunc(attr);
1622
+ return _isValidAttribute(lcTag, lcName, value);
1623
+ };
1624
+ /**
1625
+ * AddHook
1626
+ * Public method to add DOMPurify hooks
1627
+ *
1628
+ * @param {String} entryPoint entry point for the hook to add
1629
+ * @param {Function} hookFunction function to execute
1630
+ */
1328
1631
 
1329
- if (RETURN_DOM_IMPORT) {
1330
- /* AdoptNode() is not used because internal state is not reset
1331
- (e.g. the past names map of a HTMLFormElement), this is safe
1332
- in theory but we would rather not risk another attack vector.
1333
- The state that is cloned by importNode() is explicitly defined
1334
- by the specs. */
1335
- returnNode = importNode.call(originalDocument, returnNode, true);
1632
+ DOMPurify.addHook = function (entryPoint, hookFunction) {
1633
+ if (typeof hookFunction !== 'function') {
1634
+ return;
1336
1635
  }
1636
+ hooks[entryPoint] = hooks[entryPoint] || [];
1637
+ arrayPush(hooks[entryPoint], hookFunction);
1638
+ };
1639
+ /**
1640
+ * RemoveHook
1641
+ * Public method to remove a DOMPurify hook at a given entryPoint
1642
+ * (pops it from the stack of hooks if more are present)
1643
+ *
1644
+ * @param {String} entryPoint entry point for the hook to remove
1645
+ * @return {Function} removed(popped) hook
1646
+ */
1337
1647
 
1338
- return returnNode;
1339
- }
1340
-
1341
- var serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
1342
- /* Sanitize final string template-safe */
1343
-
1344
- if (SAFE_FOR_TEMPLATES) {
1345
- serializedHTML = serializedHTML.replace(MUSTACHE_EXPR$$1, ' ');
1346
- serializedHTML = serializedHTML.replace(ERB_EXPR$$1, ' ');
1347
- }
1348
-
1349
- return trustedTypesPolicy ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
1350
- };
1351
- /**
1352
- * Public method to set the configuration once
1353
- * setConfig
1354
- *
1355
- * @param {Object} cfg configuration object
1356
- */
1357
-
1358
-
1359
- DOMPurify.setConfig = function (cfg) {
1360
- _parseConfig(cfg);
1648
+ DOMPurify.removeHook = function (entryPoint) {
1649
+ if (hooks[entryPoint]) {
1650
+ return arrayPop(hooks[entryPoint]);
1651
+ }
1652
+ };
1653
+ /**
1654
+ * RemoveHooks
1655
+ * Public method to remove all DOMPurify hooks at a given entryPoint
1656
+ *
1657
+ * @param {String} entryPoint entry point for the hooks to remove
1658
+ */
1361
1659
 
1362
- SET_CONFIG = true;
1363
- };
1364
- /**
1365
- * Public method to remove the configuration
1366
- * clearConfig
1367
- *
1368
- */
1660
+ DOMPurify.removeHooks = function (entryPoint) {
1661
+ if (hooks[entryPoint]) {
1662
+ hooks[entryPoint] = [];
1663
+ }
1664
+ };
1665
+ /**
1666
+ * RemoveAllHooks
1667
+ * Public method to remove all DOMPurify hooks
1668
+ *
1669
+ */
1369
1670
 
1671
+ DOMPurify.removeAllHooks = function () {
1672
+ hooks = {};
1673
+ };
1674
+ return DOMPurify;
1675
+ }
1676
+ var purify = createDOMPurify();
1370
1677
 
1371
- DOMPurify.clearConfig = function () {
1372
- CONFIG = null;
1373
- SET_CONFIG = false;
1374
- };
1375
1678
  /**
1376
- * Public method to check if an attribute value is valid.
1377
- * Uses last set config, if any. Otherwise, uses config defaults.
1378
- * isValidAttribute
1679
+ * This program is free software; you can redistribute it and/or
1680
+ * modify it under the terms of the GNU General Public License
1681
+ * as published by the Free Software Foundation; under version 2
1682
+ * of the License (non-upgradable).
1379
1683
  *
1380
- * @param {string} tag Tag name of containing element.
1381
- * @param {string} attr Attribute name.
1382
- * @param {string} value Attribute value.
1383
- * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.
1384
- */
1385
-
1386
-
1387
- DOMPurify.isValidAttribute = function (tag, attr, value) {
1388
- /* Initialize shared config vars if necessary. */
1389
- if (!CONFIG) {
1390
- _parseConfig({});
1391
- }
1392
-
1393
- var lcTag = tag.toLowerCase();
1394
- var lcName = attr.toLowerCase();
1395
- return _isValidAttribute(lcTag, lcName, value);
1396
- };
1397
- /**
1398
- * AddHook
1399
- * Public method to add DOMPurify hooks
1684
+ * This program is distributed in the hope that it will be useful,
1685
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1686
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1687
+ * GNU General Public License for more details.
1400
1688
  *
1401
- * @param {String} entryPoint entry point for the hook to add
1402
- * @param {Function} hookFunction function to execute
1403
- */
1404
-
1405
-
1406
- DOMPurify.addHook = function (entryPoint, hookFunction) {
1407
- if (typeof hookFunction !== 'function') {
1408
- return;
1409
- }
1410
-
1411
- hooks[entryPoint] = hooks[entryPoint] || [];
1412
- hooks[entryPoint].push(hookFunction);
1413
- };
1414
- /**
1415
- * RemoveHook
1416
- * Public method to remove a DOMPurify hook at a given entryPoint
1417
- * (pops it from the stack of hooks if more are present)
1689
+ * You should have received a copy of the GNU General Public License
1690
+ * along with this program; if not, write to the Free Software
1691
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1418
1692
  *
1419
- * @param {String} entryPoint entry point for the hook to remove
1693
+ * Copyright (c) 2017-2019 (original work) Open Assessment Technologies SA ;
1420
1694
  */
1421
-
1422
-
1423
- DOMPurify.removeHook = function (entryPoint) {
1424
- if (hooks[entryPoint]) {
1425
- hooks[entryPoint].pop();
1426
- }
1695
+ var defaultConfig = {
1696
+ multiple: true
1427
1697
  };
1428
- /**
1429
- * RemoveHooks
1430
- * Public method to remove all DOMPurify hooks at a given entryPoint
1431
- *
1432
- * @param {String} entryPoint entry point for the hooks to remove
1433
- */
1434
-
1435
1698
 
1436
- DOMPurify.removeHooks = function (entryPoint) {
1437
- if (hooks[entryPoint]) {
1438
- hooks[entryPoint] = [];
1439
- }
1440
- };
1441
1699
  /**
1442
- * RemoveAllHooks
1443
- * Public method to remove all DOMPurify hooks
1700
+ * Builds the resource list component
1444
1701
  *
1702
+ * @param {jQueryElement} $container - where to append the component
1703
+ * @param {Object} config - the component config
1704
+ * @param {String} config.classUri - the root Class URI
1705
+ * @param {Object[]} [config.nodes] - the nodes to preload
1706
+ * @param {String} [config.icon] - the icon class to show close to the resources
1707
+ * @param {Boolean} [config.multiple = true] - multiple vs unique selection
1708
+ * @returns {resourceList} the component
1445
1709
  */
1710
+ function resourceListFactory($container, config) {
1711
+ var $list;
1712
+ var $loadMore;
1446
1713
 
1447
-
1448
- DOMPurify.removeAllHooks = function () {
1449
- hooks = {};
1450
- };
1451
-
1452
- return DOMPurify;
1453
- }
1454
-
1455
- var purify = createDOMPurify();
1456
-
1457
- /**
1458
- * This program is free software; you can redistribute it and/or
1459
- * modify it under the terms of the GNU General Public License
1460
- * as published by the Free Software Foundation; under version 2
1461
- * of the License (non-upgradable).
1462
- *
1463
- * This program is distributed in the hope that it will be useful,
1464
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1465
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1466
- * GNU General Public License for more details.
1467
- *
1468
- * You should have received a copy of the GNU General Public License
1469
- * along with this program; if not, write to the Free Software
1470
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1471
- *
1472
- * Copyright (c) 2017-2019 (original work) Open Assessment Technologies SA ;
1473
- */
1474
- var defaultConfig = {
1475
- multiple: true
1476
- };
1477
- /**
1478
- * Builds the resource list component
1479
- *
1480
- * @param {jQueryElement} $container - where to append the component
1481
- * @param {Object} config - the component config
1482
- * @param {String} config.classUri - the root Class URI
1483
- * @param {Object[]} [config.nodes] - the nodes to preload
1484
- * @param {String} [config.icon] - the icon class to show close to the resources
1485
- * @param {Boolean} [config.multiple = true] - multiple vs unique selection
1486
- * @returns {resourceList} the component
1487
- */
1488
-
1489
- function resourceListFactory($container, config) {
1490
- var $list;
1491
- var $loadMore;
1492
- /**
1493
- * A selectable component
1494
- * @typedef {ui/component} resourceList
1495
- */
1496
-
1497
- var resourceList = selectable(component({
1498
- /**
1499
- * Ask for a query (forward the event)
1500
- * @param {Object} [params] - the query parameters
1501
- * @param {String} [params.classUri] - the class URI
1502
- * @param {Number} [params.offset = 0] - for paging
1503
- * @param {Number} [params.limit] - for paging
1504
- * @returns {resourceList} chains
1505
- * @fires resourceList#query
1714
+ /**
1715
+ * A selectable component
1716
+ * @typedef {ui/component} resourceList
1506
1717
  */
1507
- query: function query(params) {
1508
- if (!this.is('loading')) {
1509
- /**
1510
- * Formulate the query
1511
- * @event resourceList#query
1512
- * @param {Object} params
1513
- */
1514
- this.trigger('query', _.defaults(params || {}, {
1515
- classUri: this.classUri
1516
- }));
1718
+ var resourceList = selectable(component({
1719
+ /**
1720
+ * Ask for a query (forward the event)
1721
+ * @param {Object} [params] - the query parameters
1722
+ * @param {String} [params.classUri] - the class URI
1723
+ * @param {Number} [params.offset = 0] - for paging
1724
+ * @param {Number} [params.limit] - for paging
1725
+ * @returns {resourceList} chains
1726
+ * @fires resourceList#query
1727
+ */
1728
+ query: function query(params) {
1729
+ if (!this.is('loading')) {
1730
+ /**
1731
+ * Formulate the query
1732
+ * @event resourceList#query
1733
+ * @param {Object} params
1734
+ */
1735
+ this.trigger('query', _.defaults(params || {}, {
1736
+ classUri: this.classUri
1737
+ }));
1738
+ }
1739
+ },
1740
+ /**
1741
+ * Update the component with the given nodes
1742
+ * @param resources
1743
+ * @returns {resourceList} chains
1744
+ * @fires resourceList#update
1745
+ */
1746
+ update: function update(resources) {
1747
+ var self = this;
1748
+ if (this.is('rendered')) {
1749
+ $list.html(_.reduce(resources.nodes, function (acc, node) {
1750
+ node.icon = self.config.icon;
1751
+ node.label = purify.sanitize(node.label);
1752
+ acc += listNodeTpl(node);
1753
+ return acc;
1754
+ }, ''));
1755
+ _.forEach(resources.nodes, function (node) {
1756
+ self.addNode(node.uri, node);
1757
+ });
1758
+ if (resources.total > _.size(self.getNodes())) {
1759
+ hider.show($loadMore);
1760
+ } else {
1761
+ hider.hide($loadMore);
1762
+ }
1763
+
1764
+ /**
1765
+ * The list has been updated
1766
+ * @event resourceList#update
1767
+ */
1768
+ this.trigger('update');
1769
+ }
1517
1770
  }
1518
- },
1519
-
1520
- /**
1521
- * Update the component with the given nodes
1522
- * @param resources
1523
- * @returns {resourceList} chains
1524
- * @fires resourceList#update
1525
- */
1526
- update: function update(resources) {
1771
+ }, defaultConfig));
1772
+ resourceList.setTemplate(listTpl).on('init', function () {
1773
+ this.classUri = this.config.classUri;
1774
+ this.setState('multiple', !!this.config.multiple);
1775
+ this.render($container);
1776
+ }).on('render', function () {
1527
1777
  var self = this;
1528
-
1529
- if (this.is('rendered')) {
1530
- $list.html(_.reduce(resources.nodes, function (acc, node) {
1531
- node.icon = self.config.icon;
1532
- node.label = purify.sanitize(node.label);
1533
- acc += listNodeTpl(node);
1534
- return acc;
1535
- }, ''));
1536
-
1537
- _.forEach(resources.nodes, function (node) {
1538
- self.addNode(node.uri, node);
1539
- });
1540
-
1541
- if (resources.total > _.size(self.getNodes())) {
1542
- hider.show($loadMore);
1778
+ var $component = this.getElement();
1779
+ $list = $component.children('ul');
1780
+ $loadMore = $$1('.more', $component);
1781
+
1782
+ //selection
1783
+ $component.on('click', 'li', function (e) {
1784
+ var $instance = $$1(e.currentTarget);
1785
+ e.preventDefault();
1786
+ e.stopPropagation();
1787
+ if ($instance.hasClass('selected')) {
1788
+ self.unselect($instance.data('uri'));
1543
1789
  } else {
1544
- hider.hide($loadMore);
1790
+ self.select($instance.data('uri'), !self.is('multiple'));
1545
1791
  }
1546
- /**
1547
- * The list has been updated
1548
- * @event resourceList#update
1549
- */
1792
+ });
1550
1793
 
1794
+ //load next page
1795
+ $loadMore.on('click', function (e) {
1796
+ e.preventDefault();
1797
+ self.query({
1798
+ offset: _.size(self.getNodes())
1799
+ });
1800
+ });
1551
1801
 
1552
- this.trigger('update');
1553
- }
1554
- }
1555
- }, defaultConfig));
1556
- resourceList.setTemplate(listTpl).on('init', function () {
1557
- this.classUri = this.config.classUri;
1558
- this.setState('multiple', !!this.config.multiple);
1559
- this.render($container);
1560
- }).on('render', function () {
1561
- var self = this;
1562
- var $component = this.getElement();
1563
- $list = $component.children('ul');
1564
- $loadMore = $$1('.more', $component); //selection
1565
-
1566
- $component.on('click', 'li', function (e) {
1567
- var $instance = $$1(e.currentTarget);
1568
- e.preventDefault();
1569
- e.stopPropagation();
1570
-
1571
- if ($instance.hasClass('selected')) {
1572
- self.unselect($instance.data('uri'));
1802
+ //initial data loading
1803
+ if (this.config.nodes) {
1804
+ this.update(this.config.nodes);
1573
1805
  } else {
1574
- self.select($instance.data('uri'), !self.is('multiple'));
1806
+ this.query();
1575
1807
  }
1576
- }); //load next page
1577
-
1578
- $loadMore.on('click', function (e) {
1579
- e.preventDefault();
1580
- self.query({
1581
- offset: _.size(self.getNodes())
1582
- });
1583
- }); //initial data loading
1584
-
1585
- if (this.config.nodes) {
1586
- this.update(this.config.nodes);
1587
- } else {
1588
- this.query();
1589
- }
1590
- }).on('query', function () {
1591
- this.setState('loading', true);
1592
- }).on('update', function () {
1593
- this.setState('loading', false);
1594
- }).on('remove', function (uri) {
1595
- if (this.is('rendered')) {
1596
- $$1('[data-uri="' + uri + '"]', this.getElement()).remove();
1597
- }
1598
- }); //always defer the initialization to let consumers listen for init and render events.
1599
-
1600
- _.defer(function () {
1601
- resourceList.init(config);
1602
- });
1808
+ }).on('query', function () {
1809
+ this.setState('loading', true);
1810
+ }).on('update', function () {
1811
+ this.setState('loading', false);
1812
+ }).on('remove', function (uri) {
1813
+ if (this.is('rendered')) {
1814
+ $$1('[data-uri="' + uri + '"]', this.getElement()).remove();
1815
+ }
1816
+ });
1603
1817
 
1604
- return resourceList;
1605
- }
1818
+ //always defer the initialization to let consumers listen for init and render events.
1819
+ _.defer(function () {
1820
+ resourceList.init(config);
1821
+ });
1822
+ return resourceList;
1823
+ }
1606
1824
 
1607
- return resourceListFactory;
1825
+ return resourceListFactory;
1608
1826
 
1609
1827
  });