@fses/workbench-app 0.2.0 → 0.2.2

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 (803) hide show
  1. package/WORKBENCH-CLOSURE.json +80 -0
  2. package/dist/Workspace-fYH2XNdb.js +22699 -0
  3. package/dist/fses-workbench-app.js +2 -2
  4. package/dist/{index-DbH6tMQy.js → index-CbIJlts1.js} +8 -8
  5. package/dist/internal/personal-workbench/components/workbench/WorkbenchStudio.vue.d.ts +2 -2
  6. package/dist/internal/personal-workbench/lib/deepAgentApi.d.ts +41 -2
  7. package/dist/internal/personal-workbench/lib/deepAgentQueueState.d.ts +111 -0
  8. package/dist/internal/personal-workbench/lib/vueRuntimeAdapters.d.ts +72 -0
  9. package/dist/internal/personal-workbench/lib/workbenchSocketClient.d.ts +1 -1
  10. package/dist/internal/personal-workbench/lib/workbenchStorage.d.ts +2 -0
  11. package/dist/runtime/index.js +1 -1
  12. package/dist/style.css +1 -1
  13. package/dist/{useWorkbenchRuntime-XpOzwm56.js → useWorkbenchRuntime-Ch8lqkjO.js} +6707 -6315
  14. package/node_modules/@byteluck/agentic-protocol/LICENSE +9 -0
  15. package/node_modules/@byteluck/agentic-protocol/README.md +74 -0
  16. package/node_modules/@byteluck/agentic-protocol/dist/index.d.ts +1623 -0
  17. package/node_modules/@byteluck/agentic-protocol/dist/index.mjs +3380 -0
  18. package/node_modules/@byteluck/agentic-protocol/package.json +37 -0
  19. package/node_modules/@byteluck/workbench-skill-contracts/LICENSE +9 -0
  20. package/node_modules/@byteluck/workbench-skill-contracts/dist/index.d.ts +234 -0
  21. package/node_modules/@byteluck/workbench-skill-contracts/dist/index.mjs +394 -0
  22. package/node_modules/@byteluck/workbench-skill-contracts/package.json +37 -0
  23. package/node_modules/@fses/ai-chat/LICENSE +9 -0
  24. package/node_modules/@fses/ai-chat/README.md +320 -0
  25. package/node_modules/@fses/ai-chat/dist/chart-card/data.d.ts +12 -0
  26. package/node_modules/@fses/ai-chat/dist/chart-card/from-markdown.d.ts +11 -0
  27. package/node_modules/@fses/ai-chat/dist/chart-card/from-tool.d.ts +8 -0
  28. package/node_modules/@fses/ai-chat/dist/chart-card/options.d.ts +4 -0
  29. package/node_modules/@fses/ai-chat/dist/chart-card/trace.d.ts +19 -0
  30. package/node_modules/@fses/ai-chat/dist/chart-card/types.d.ts +133 -0
  31. package/node_modules/@fses/ai-chat/dist/components/CardRecommendationDeferredDraft.vue.d.ts +13 -0
  32. package/node_modules/@fses/ai-chat/dist/components/CardRecommendationDraft.vue.d.ts +18 -0
  33. package/node_modules/@fses/ai-chat/dist/components/ChartCardRenderer.vue.d.ts +11 -0
  34. package/node_modules/@fses/ai-chat/dist/components/ChatMessageItem.vue.d.ts +76 -0
  35. package/node_modules/@fses/ai-chat/dist/components/ChatMessageList.vue.d.ts +79 -0
  36. package/node_modules/@fses/ai-chat/dist/components/ChatSender.vue.d.ts +98 -0
  37. package/node_modules/@fses/ai-chat/dist/components/CollapsedToolActivity.vue.d.ts +9 -0
  38. package/node_modules/@fses/ai-chat/dist/components/ContextUsageRing.vue.d.ts +12 -0
  39. package/node_modules/@fses/ai-chat/dist/components/EChartsView.vue.d.ts +6 -0
  40. package/node_modules/@fses/ai-chat/dist/components/FsesAiChat.vue.d.ts +306 -0
  41. package/node_modules/@fses/ai-chat/dist/components/PlanDraftCard.vue.d.ts +19 -0
  42. package/node_modules/@fses/ai-chat/dist/components/ShellExecPanel.vue.d.ts +6 -0
  43. package/node_modules/@fses/ai-chat/dist/components/TaskTodoPlanBar.vue.d.ts +6 -0
  44. package/node_modules/@fses/ai-chat/dist/components/ThinkingShimmer.vue.d.ts +6 -0
  45. package/node_modules/@fses/ai-chat/dist/composables/context-usage.d.ts +11 -0
  46. package/node_modules/@fses/ai-chat/dist/composables/types.d.ts +465 -0
  47. package/node_modules/@fses/ai-chat/dist/composables/useChat.d.ts +2 -0
  48. package/node_modules/@fses/ai-chat/dist/composables/useSystemEChartsIcon.d.ts +11 -0
  49. package/node_modules/@fses/ai-chat/dist/fses-ai-chat.js +11408 -0
  50. package/node_modules/@fses/ai-chat/dist/fses-ai-chat.umd.cjs +25 -0
  51. package/node_modules/@fses/ai-chat/dist/index.d.ts +17 -0
  52. package/node_modules/@fses/ai-chat/dist/plugin.d.ts +8 -0
  53. package/node_modules/@fses/ai-chat/dist/style.css +1 -0
  54. package/node_modules/@fses/ai-chat/dist/utils/assistant-markdown.d.ts +11 -0
  55. package/node_modules/@fses/ai-chat/dist/utils/attachment-upload.d.ts +22 -0
  56. package/node_modules/@fses/ai-chat/dist/utils/card-recommendation-config-summary.d.ts +86 -0
  57. package/node_modules/@fses/ai-chat/dist/utils/card-recommendation-field-label.d.ts +24 -0
  58. package/node_modules/@fses/ai-chat/dist/utils/card-recommendation-source.d.ts +18 -0
  59. package/node_modules/@fses/ai-chat/dist/utils/card-recommendation-title-source.d.ts +12 -0
  60. package/node_modules/@fses/ai-chat/dist/utils/chart-card-visibility.d.ts +24 -0
  61. package/node_modules/@fses/ai-chat/dist/utils/derived-process-labels.d.ts +13 -0
  62. package/node_modules/@fses/ai-chat/dist/utils/echarts-recommendation-icon.d.ts +36 -0
  63. package/node_modules/@fses/ai-chat/dist/utils/group-messages.d.ts +30 -0
  64. package/node_modules/@fses/ai-chat/dist/utils/status-activity.d.ts +48 -0
  65. package/node_modules/@fses/ai-chat/dist/utils/system-echarts-template-icons.generated.d.ts +305 -0
  66. package/node_modules/@fses/ai-chat/dist/utils/system-echarts-template.d.ts +20 -0
  67. package/node_modules/@fses/ai-chat/dist/utils/task-todo-plan.d.ts +40 -0
  68. package/node_modules/@fses/ai-chat/dist/utils/workbench-echarts-theme.d.ts +35 -0
  69. package/node_modules/@fses/ai-chat/package.json +81 -0
  70. package/node_modules/@fses/workbench-card/LICENSE +9 -0
  71. package/node_modules/@fses/workbench-card/README.md +81 -0
  72. package/node_modules/@fses/workbench-card/dist/chart/index.d.ts +8 -0
  73. package/node_modules/@fses/workbench-card/dist/fses-workbench-card-echarts-protocol.js +2230 -0
  74. package/node_modules/@fses/workbench-card/dist/fses-workbench-card-renderers.js +33742 -0
  75. package/node_modules/@fses/workbench-card/dist/fses-workbench-card.js +21238 -0
  76. package/node_modules/@fses/workbench-card/dist/fses-workbench-card.umd.cjs +1 -0
  77. package/node_modules/@fses/workbench-card/dist/index.d.ts +11 -0
  78. package/node_modules/@fses/workbench-card/dist/registry/cardRegistry.d.ts +50 -0
  79. package/node_modules/@fses/workbench-card/dist/registry/compositeCardPatterns.d.ts +39 -0
  80. package/node_modules/@fses/workbench-card/dist/registry/echartsTemplateCategories.d.ts +20 -0
  81. package/node_modules/@fses/workbench-card/dist/registry/echartsTemplateRegistry.d.ts +1158 -0
  82. package/node_modules/@fses/workbench-card/dist/registry/echartsTemplateRegistry.generated.d.ts +1141 -0
  83. package/node_modules/@fses/workbench-card/dist/registry/echartsTemplateTypes.d.ts +76 -0
  84. package/node_modules/@fses/workbench-card/dist/registry/index.d.ts +10 -0
  85. package/node_modules/@fses/workbench-card/dist/renderers/WorkbenchBlockRenderer.vue.d.ts +55 -0
  86. package/node_modules/@fses/workbench-card/dist/renderers/chart/ChartRegistry.vue.d.ts +22 -0
  87. package/node_modules/@fses/workbench-card/dist/renderers/chart/EChartsProtocolRenderer.vue.d.ts +34 -0
  88. package/node_modules/@fses/workbench-card/dist/renderers/chart/chartRendererRegistry.d.ts +219 -0
  89. package/node_modules/@fses/workbench-card/dist/renderers/chart/chartResponsiveLayout.d.ts +47 -0
  90. package/node_modules/@fses/workbench-card/dist/renderers/chart/dynamicEchartOption.d.ts +30 -0
  91. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/adapter.d.ts +73 -0
  92. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/composite.converter.d.ts +11 -0
  93. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/configOnly.converter.d.ts +11 -0
  94. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/geo.converter.d.ts +10 -0
  95. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/graphic.converter.d.ts +10 -0
  96. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/layout.converter.d.ts +11 -0
  97. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/network.converter.d.ts +10 -0
  98. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/scene3D.converter.d.ts +11 -0
  99. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/series.converter.d.ts +10 -0
  100. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/table.converter.d.ts +10 -0
  101. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/timeline.converter.d.ts +11 -0
  102. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/transition.converter.d.ts +11 -0
  103. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/tree.converter.d.ts +10 -0
  104. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/converters/tuple.converter.d.ts +10 -0
  105. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/index.d.ts +9 -0
  106. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/merger.d.ts +16 -0
  107. package/node_modules/@fses/workbench-card/dist/renderers/chart/echarts-protocol/types.d.ts +447 -0
  108. package/node_modules/@fses/workbench-card/dist/renderers/chart/echartsRuntimeInteractions.d.ts +30 -0
  109. package/node_modules/@fses/workbench-card/dist/renderers/chart/echartsTitle.d.ts +13 -0
  110. package/node_modules/@fses/workbench-card/dist/renderers/chart/echartsTooltipPortal.d.ts +12 -0
  111. package/node_modules/@fses/workbench-card/dist/renderers/chart/types.d.ts +47 -0
  112. package/node_modules/@fses/workbench-card/dist/renderers/chart/useEchart.d.ts +29 -0
  113. package/node_modules/@fses/workbench-card/dist/renderers/chart/workbenchChartTheme.d.ts +36 -0
  114. package/node_modules/@fses/workbench-card/dist/renderers/custom-canvas/canvasLayoutBindings.d.ts +86 -0
  115. package/node_modules/@fses/workbench-card/dist/renderers/hostBridge.d.ts +61 -0
  116. package/node_modules/@fses/workbench-card/dist/renderers/index.d.ts +17 -0
  117. package/node_modules/@fses/workbench-card/dist/renderers/native/nativeBindings.d.ts +145 -0
  118. package/node_modules/@fses/workbench-card/dist/renderers/nested/nestedBlockBindings.d.ts +107 -0
  119. package/node_modules/@fses/workbench-card/dist/renderers/quickLinkDisplay.d.ts +24 -0
  120. package/node_modules/@fses/workbench-card/dist/renderers/reference-composite/referenceCompositeBindings.d.ts +171 -0
  121. package/node_modules/@fses/workbench-card/dist/renderers/reference-composite/referenceRiskAndStrategyBindings.d.ts +91 -0
  122. package/node_modules/@fses/workbench-card/dist/renderers/resizableTable.d.ts +51 -0
  123. package/node_modules/@fses/workbench-card/dist/renderers/style.css +1 -0
  124. package/node_modules/@fses/workbench-card/dist/renderers/tableDisplay.d.ts +25 -0
  125. package/node_modules/@fses/workbench-card/dist/renderers/useWorkbenchBlockRendererBindings.d.ts +580 -0
  126. package/node_modules/@fses/workbench-card/dist/shell/workbenchVisualShell.d.ts +48 -0
  127. package/node_modules/@fses/workbench-card/dist/style.css +1 -0
  128. package/node_modules/@fses/workbench-card/dist/types/block.d.ts +2011 -0
  129. package/node_modules/@fses/workbench-card/dist/types/canvas.d.ts +25 -0
  130. package/node_modules/@fses/workbench-card/dist/types/echartsProtocol.d.ts +445 -0
  131. package/node_modules/@fses/workbench-card/dist/types/index.d.ts +10 -0
  132. package/node_modules/@fses/workbench-card/dist/types/registry.d.ts +7 -0
  133. package/node_modules/@fses/workbench-card/dist/types/runtime.d.ts +34 -0
  134. package/node_modules/@fses/workbench-card/package.json +83 -0
  135. package/node_modules/@fses/workbench-card/src/chart/index.ts +8 -0
  136. package/node_modules/@fses/workbench-card/src/index.ts +13 -0
  137. package/node_modules/@fses/workbench-card/src/registry/cardRegistry.ts +476 -0
  138. package/node_modules/@fses/workbench-card/src/registry/compositeCardPatterns.ts +206 -0
  139. package/node_modules/@fses/workbench-card/src/registry/echartsTemplateCategories.ts +74 -0
  140. package/node_modules/@fses/workbench-card/src/registry/echartsTemplateRegistry.generated.js +19950 -0
  141. package/node_modules/@fses/workbench-card/src/registry/echartsTemplateRegistry.generated.ts +19951 -0
  142. package/node_modules/@fses/workbench-card/src/registry/echartsTemplateRegistry.ts +32 -0
  143. package/node_modules/@fses/workbench-card/src/registry/echartsTemplateTypes.ts +83 -0
  144. package/node_modules/@fses/workbench-card/src/registry/index.ts +10 -0
  145. package/node_modules/@fses/workbench-card/src/renderers/WorkbenchBlockRenderer.vue +2728 -0
  146. package/node_modules/@fses/workbench-card/src/renderers/chart/ChartRegistry.vue +221 -0
  147. package/node_modules/@fses/workbench-card/src/renderers/chart/EChartsProtocolRenderer.vue +304 -0
  148. package/node_modules/@fses/workbench-card/src/renderers/chart/chartRendererRegistry.ts +311 -0
  149. package/node_modules/@fses/workbench-card/src/renderers/chart/chartResponsiveLayout.ts +172 -0
  150. package/node_modules/@fses/workbench-card/src/renderers/chart/dynamicEchartOption.ts +127 -0
  151. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/adapter.ts +1349 -0
  152. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/composite.converter.ts +71 -0
  153. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/configOnly.converter.ts +45 -0
  154. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/geo.converter.ts +97 -0
  155. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/graphic.converter.ts +59 -0
  156. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/layout.converter.ts +53 -0
  157. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/network.converter.ts +82 -0
  158. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/scene3D.converter.ts +73 -0
  159. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/series.converter.ts +795 -0
  160. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/table.converter.ts +195 -0
  161. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/timeline.converter.ts +62 -0
  162. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/transition.converter.ts +58 -0
  163. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/tree.converter.ts +75 -0
  164. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/converters/tuple.converter.ts +112 -0
  165. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/index.ts +10 -0
  166. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/merger.ts +109 -0
  167. package/node_modules/@fses/workbench-card/src/renderers/chart/echarts-protocol/types.ts +515 -0
  168. package/node_modules/@fses/workbench-card/src/renderers/chart/echartsRuntimeInteractions.ts +450 -0
  169. package/node_modules/@fses/workbench-card/src/renderers/chart/echartsTitle.ts +94 -0
  170. package/node_modules/@fses/workbench-card/src/renderers/chart/echartsTooltipPortal.ts +140 -0
  171. package/node_modules/@fses/workbench-card/src/renderers/chart/types.ts +53 -0
  172. package/node_modules/@fses/workbench-card/src/renderers/chart/useEchart.ts +1820 -0
  173. package/node_modules/@fses/workbench-card/src/renderers/chart/workbenchChartTheme.ts +240 -0
  174. package/node_modules/@fses/workbench-card/src/renderers/custom-canvas/canvasLayoutBindings.ts +660 -0
  175. package/node_modules/@fses/workbench-card/src/renderers/hostBridge.ts +74 -0
  176. package/node_modules/@fses/workbench-card/src/renderers/index.ts +25 -0
  177. package/node_modules/@fses/workbench-card/src/renderers/native/nativeBindings.ts +1096 -0
  178. package/node_modules/@fses/workbench-card/src/renderers/nested/nestedBlockBindings.ts +1349 -0
  179. package/node_modules/@fses/workbench-card/src/renderers/quickLinkDisplay.ts +53 -0
  180. package/node_modules/@fses/workbench-card/src/renderers/reference-composite/referenceCompositeBindings.ts +3209 -0
  181. package/node_modules/@fses/workbench-card/src/renderers/reference-composite/referenceRiskAndStrategyBindings.ts +1004 -0
  182. package/node_modules/@fses/workbench-card/src/renderers/resizableTable.ts +136 -0
  183. package/node_modules/@fses/workbench-card/src/renderers/tableDisplay.ts +140 -0
  184. package/node_modules/@fses/workbench-card/src/renderers/useWorkbenchBlockRendererBindings.ts +3192 -0
  185. package/node_modules/@fses/workbench-card/src/shell/workbenchVisualShell.ts +228 -0
  186. package/node_modules/@fses/workbench-card/src/styles/workbench-card.css +343 -0
  187. package/node_modules/@fses/workbench-card/src/types/block.ts +2496 -0
  188. package/node_modules/@fses/workbench-card/src/types/canvas.ts +30 -0
  189. package/node_modules/@fses/workbench-card/src/types/echartsProtocol.ts +513 -0
  190. package/node_modules/@fses/workbench-card/src/types/index.ts +10 -0
  191. package/node_modules/@fses/workbench-card/src/types/registry.ts +17 -0
  192. package/node_modules/@fses/workbench-card/src/types/runtime.ts +31 -0
  193. package/node_modules/dompurify/LICENSE +568 -0
  194. package/node_modules/dompurify/README.md +523 -0
  195. package/node_modules/dompurify/dist/purify.cjs.d.ts +451 -0
  196. package/node_modules/dompurify/dist/purify.cjs.js +1472 -0
  197. package/node_modules/dompurify/dist/purify.cjs.js.map +1 -0
  198. package/node_modules/dompurify/dist/purify.es.d.mts +448 -0
  199. package/node_modules/dompurify/dist/purify.es.mjs +1470 -0
  200. package/node_modules/dompurify/dist/purify.es.mjs.map +1 -0
  201. package/node_modules/dompurify/dist/purify.js +1478 -0
  202. package/node_modules/dompurify/dist/purify.js.map +1 -0
  203. package/node_modules/dompurify/dist/purify.min.js +3 -0
  204. package/node_modules/dompurify/dist/purify.min.js.map +1 -0
  205. package/node_modules/dompurify/package.json +168 -0
  206. package/node_modules/zod/LICENSE +21 -0
  207. package/node_modules/zod/README.md +208 -0
  208. package/node_modules/zod/index.cjs +33 -0
  209. package/node_modules/zod/index.d.cts +4 -0
  210. package/node_modules/zod/index.d.ts +4 -0
  211. package/node_modules/zod/index.js +4 -0
  212. package/node_modules/zod/package.json +118 -0
  213. package/node_modules/zod/src/index.ts +4 -0
  214. package/node_modules/zod/src/v3/ZodError.ts +330 -0
  215. package/node_modules/zod/src/v3/benchmarks/datetime.ts +58 -0
  216. package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
  217. package/node_modules/zod/src/v3/benchmarks/index.ts +59 -0
  218. package/node_modules/zod/src/v3/benchmarks/ipv4.ts +57 -0
  219. package/node_modules/zod/src/v3/benchmarks/object.ts +69 -0
  220. package/node_modules/zod/src/v3/benchmarks/primitives.ts +162 -0
  221. package/node_modules/zod/src/v3/benchmarks/realworld.ts +63 -0
  222. package/node_modules/zod/src/v3/benchmarks/string.ts +55 -0
  223. package/node_modules/zod/src/v3/benchmarks/union.ts +80 -0
  224. package/node_modules/zod/src/v3/errors.ts +13 -0
  225. package/node_modules/zod/src/v3/external.ts +6 -0
  226. package/node_modules/zod/src/v3/helpers/enumUtil.ts +17 -0
  227. package/node_modules/zod/src/v3/helpers/errorUtil.ts +8 -0
  228. package/node_modules/zod/src/v3/helpers/parseUtil.ts +176 -0
  229. package/node_modules/zod/src/v3/helpers/partialUtil.ts +34 -0
  230. package/node_modules/zod/src/v3/helpers/typeAliases.ts +2 -0
  231. package/node_modules/zod/src/v3/helpers/util.ts +224 -0
  232. package/node_modules/zod/src/v3/index.ts +4 -0
  233. package/node_modules/zod/src/v3/locales/en.ts +124 -0
  234. package/node_modules/zod/src/v3/standard-schema.ts +113 -0
  235. package/node_modules/zod/src/v3/tests/Mocker.ts +54 -0
  236. package/node_modules/zod/src/v3/tests/all-errors.test.ts +157 -0
  237. package/node_modules/zod/src/v3/tests/anyunknown.test.ts +28 -0
  238. package/node_modules/zod/src/v3/tests/array.test.ts +71 -0
  239. package/node_modules/zod/src/v3/tests/async-parsing.test.ts +388 -0
  240. package/node_modules/zod/src/v3/tests/async-refinements.test.ts +46 -0
  241. package/node_modules/zod/src/v3/tests/base.test.ts +29 -0
  242. package/node_modules/zod/src/v3/tests/bigint.test.ts +55 -0
  243. package/node_modules/zod/src/v3/tests/branded.test.ts +53 -0
  244. package/node_modules/zod/src/v3/tests/catch.test.ts +220 -0
  245. package/node_modules/zod/src/v3/tests/coerce.test.ts +133 -0
  246. package/node_modules/zod/src/v3/tests/complex.test.ts +56 -0
  247. package/node_modules/zod/src/v3/tests/custom.test.ts +31 -0
  248. package/node_modules/zod/src/v3/tests/date.test.ts +32 -0
  249. package/node_modules/zod/src/v3/tests/deepmasking.test.ts +186 -0
  250. package/node_modules/zod/src/v3/tests/default.test.ts +112 -0
  251. package/node_modules/zod/src/v3/tests/description.test.ts +33 -0
  252. package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +315 -0
  253. package/node_modules/zod/src/v3/tests/enum.test.ts +80 -0
  254. package/node_modules/zod/src/v3/tests/error.test.ts +551 -0
  255. package/node_modules/zod/src/v3/tests/firstparty.test.ts +87 -0
  256. package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +21 -0
  257. package/node_modules/zod/src/v3/tests/function.test.ts +257 -0
  258. package/node_modules/zod/src/v3/tests/generics.test.ts +48 -0
  259. package/node_modules/zod/src/v3/tests/instanceof.test.ts +37 -0
  260. package/node_modules/zod/src/v3/tests/intersection.test.ts +110 -0
  261. package/node_modules/zod/src/v3/tests/language-server.source.ts +76 -0
  262. package/node_modules/zod/src/v3/tests/language-server.test.ts +207 -0
  263. package/node_modules/zod/src/v3/tests/literal.test.ts +36 -0
  264. package/node_modules/zod/src/v3/tests/map.test.ts +110 -0
  265. package/node_modules/zod/src/v3/tests/masking.test.ts +4 -0
  266. package/node_modules/zod/src/v3/tests/mocker.test.ts +19 -0
  267. package/node_modules/zod/src/v3/tests/nan.test.ts +21 -0
  268. package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +87 -0
  269. package/node_modules/zod/src/v3/tests/nullable.test.ts +42 -0
  270. package/node_modules/zod/src/v3/tests/number.test.ts +176 -0
  271. package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +29 -0
  272. package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +29 -0
  273. package/node_modules/zod/src/v3/tests/object.test.ts +434 -0
  274. package/node_modules/zod/src/v3/tests/optional.test.ts +42 -0
  275. package/node_modules/zod/src/v3/tests/parseUtil.test.ts +23 -0
  276. package/node_modules/zod/src/v3/tests/parser.test.ts +41 -0
  277. package/node_modules/zod/src/v3/tests/partials.test.ts +243 -0
  278. package/node_modules/zod/src/v3/tests/pickomit.test.ts +111 -0
  279. package/node_modules/zod/src/v3/tests/pipeline.test.ts +29 -0
  280. package/node_modules/zod/src/v3/tests/preprocess.test.ts +186 -0
  281. package/node_modules/zod/src/v3/tests/primitive.test.ts +440 -0
  282. package/node_modules/zod/src/v3/tests/promise.test.ts +90 -0
  283. package/node_modules/zod/src/v3/tests/readonly.test.ts +194 -0
  284. package/node_modules/zod/src/v3/tests/record.test.ts +171 -0
  285. package/node_modules/zod/src/v3/tests/recursive.test.ts +197 -0
  286. package/node_modules/zod/src/v3/tests/refine.test.ts +313 -0
  287. package/node_modules/zod/src/v3/tests/safeparse.test.ts +27 -0
  288. package/node_modules/zod/src/v3/tests/set.test.ts +142 -0
  289. package/node_modules/zod/src/v3/tests/standard-schema.test.ts +83 -0
  290. package/node_modules/zod/src/v3/tests/string.test.ts +916 -0
  291. package/node_modules/zod/src/v3/tests/transformer.test.ts +233 -0
  292. package/node_modules/zod/src/v3/tests/tuple.test.ts +90 -0
  293. package/node_modules/zod/src/v3/tests/unions.test.ts +57 -0
  294. package/node_modules/zod/src/v3/tests/validations.test.ts +133 -0
  295. package/node_modules/zod/src/v3/tests/void.test.ts +15 -0
  296. package/node_modules/zod/src/v3/types.ts +5136 -0
  297. package/node_modules/zod/src/v4/classic/checks.ts +30 -0
  298. package/node_modules/zod/src/v4/classic/coerce.ts +27 -0
  299. package/node_modules/zod/src/v4/classic/compat.ts +66 -0
  300. package/node_modules/zod/src/v4/classic/errors.ts +75 -0
  301. package/node_modules/zod/src/v4/classic/external.ts +50 -0
  302. package/node_modules/zod/src/v4/classic/index.ts +5 -0
  303. package/node_modules/zod/src/v4/classic/iso.ts +90 -0
  304. package/node_modules/zod/src/v4/classic/parse.ts +33 -0
  305. package/node_modules/zod/src/v4/classic/schemas.ts +2054 -0
  306. package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +26 -0
  307. package/node_modules/zod/src/v4/classic/tests/array.test.ts +264 -0
  308. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +210 -0
  309. package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +381 -0
  310. package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +68 -0
  311. package/node_modules/zod/src/v4/classic/tests/base.test.ts +7 -0
  312. package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +54 -0
  313. package/node_modules/zod/src/v4/classic/tests/brand.test.ts +63 -0
  314. package/node_modules/zod/src/v4/classic/tests/catch.test.ts +252 -0
  315. package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +20 -0
  316. package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +160 -0
  317. package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +352 -0
  318. package/node_modules/zod/src/v4/classic/tests/custom.test.ts +40 -0
  319. package/node_modules/zod/src/v4/classic/tests/date.test.ts +31 -0
  320. package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +296 -0
  321. package/node_modules/zod/src/v4/classic/tests/default.test.ts +313 -0
  322. package/node_modules/zod/src/v4/classic/tests/description.test.ts +32 -0
  323. package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +619 -0
  324. package/node_modules/zod/src/v4/classic/tests/enum.test.ts +285 -0
  325. package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +527 -0
  326. package/node_modules/zod/src/v4/classic/tests/error.test.ts +711 -0
  327. package/node_modules/zod/src/v4/classic/tests/file.test.ts +91 -0
  328. package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +175 -0
  329. package/node_modules/zod/src/v4/classic/tests/function.test.ts +268 -0
  330. package/node_modules/zod/src/v4/classic/tests/generics.test.ts +72 -0
  331. package/node_modules/zod/src/v4/classic/tests/index.test.ts +829 -0
  332. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +34 -0
  333. package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +171 -0
  334. package/node_modules/zod/src/v4/classic/tests/json.test.ts +108 -0
  335. package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +227 -0
  336. package/node_modules/zod/src/v4/classic/tests/literal.test.ts +92 -0
  337. package/node_modules/zod/src/v4/classic/tests/map.test.ts +196 -0
  338. package/node_modules/zod/src/v4/classic/tests/nan.test.ts +21 -0
  339. package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +168 -0
  340. package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +86 -0
  341. package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +22 -0
  342. package/node_modules/zod/src/v4/classic/tests/number.test.ts +247 -0
  343. package/node_modules/zod/src/v4/classic/tests/object.test.ts +563 -0
  344. package/node_modules/zod/src/v4/classic/tests/optional.test.ts +123 -0
  345. package/node_modules/zod/src/v4/classic/tests/partial.test.ts +147 -0
  346. package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +127 -0
  347. package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +81 -0
  348. package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +37 -0
  349. package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +298 -0
  350. package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +175 -0
  351. package/node_modules/zod/src/v4/classic/tests/promise.test.ts +81 -0
  352. package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +23 -0
  353. package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +252 -0
  354. package/node_modules/zod/src/v4/classic/tests/record.test.ts +342 -0
  355. package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +356 -0
  356. package/node_modules/zod/src/v4/classic/tests/refine.test.ts +532 -0
  357. package/node_modules/zod/src/v4/classic/tests/registries.test.ts +204 -0
  358. package/node_modules/zod/src/v4/classic/tests/set.test.ts +179 -0
  359. package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +57 -0
  360. package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +109 -0
  361. package/node_modules/zod/src/v4/classic/tests/string.test.ts +881 -0
  362. package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +66 -0
  363. package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +758 -0
  364. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +2314 -0
  365. package/node_modules/zod/src/v4/classic/tests/transform.test.ts +250 -0
  366. package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +163 -0
  367. package/node_modules/zod/src/v4/classic/tests/union.test.ts +94 -0
  368. package/node_modules/zod/src/v4/classic/tests/validations.test.ts +283 -0
  369. package/node_modules/zod/src/v4/classic/tests/void.test.ts +12 -0
  370. package/node_modules/zod/src/v4/core/api.ts +1594 -0
  371. package/node_modules/zod/src/v4/core/checks.ts +1283 -0
  372. package/node_modules/zod/src/v4/core/config.ts +15 -0
  373. package/node_modules/zod/src/v4/core/core.ts +134 -0
  374. package/node_modules/zod/src/v4/core/doc.ts +44 -0
  375. package/node_modules/zod/src/v4/core/errors.ts +424 -0
  376. package/node_modules/zod/src/v4/core/function.ts +176 -0
  377. package/node_modules/zod/src/v4/core/index.ts +15 -0
  378. package/node_modules/zod/src/v4/core/json-schema.ts +143 -0
  379. package/node_modules/zod/src/v4/core/parse.ts +94 -0
  380. package/node_modules/zod/src/v4/core/regexes.ts +135 -0
  381. package/node_modules/zod/src/v4/core/registries.ts +96 -0
  382. package/node_modules/zod/src/v4/core/schemas.ts +3842 -0
  383. package/node_modules/zod/src/v4/core/standard-schema.ts +64 -0
  384. package/node_modules/zod/src/v4/core/tests/index.test.ts +46 -0
  385. package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +124 -0
  386. package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +22 -0
  387. package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
  388. package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
  389. package/node_modules/zod/src/v4/core/to-json-schema.ts +977 -0
  390. package/node_modules/zod/src/v4/core/util.ts +775 -0
  391. package/node_modules/zod/src/v4/core/versions.ts +5 -0
  392. package/node_modules/zod/src/v4/core/zsf.ts +323 -0
  393. package/node_modules/zod/src/v4/index.ts +4 -0
  394. package/node_modules/zod/src/v4/locales/ar.ts +125 -0
  395. package/node_modules/zod/src/v4/locales/az.ts +121 -0
  396. package/node_modules/zod/src/v4/locales/be.ts +184 -0
  397. package/node_modules/zod/src/v4/locales/ca.ts +127 -0
  398. package/node_modules/zod/src/v4/locales/cs.ts +142 -0
  399. package/node_modules/zod/src/v4/locales/de.ts +124 -0
  400. package/node_modules/zod/src/v4/locales/en.ts +127 -0
  401. package/node_modules/zod/src/v4/locales/eo.ts +125 -0
  402. package/node_modules/zod/src/v4/locales/es.ts +125 -0
  403. package/node_modules/zod/src/v4/locales/fa.ts +134 -0
  404. package/node_modules/zod/src/v4/locales/fi.ts +131 -0
  405. package/node_modules/zod/src/v4/locales/fr-CA.ts +126 -0
  406. package/node_modules/zod/src/v4/locales/fr.ts +124 -0
  407. package/node_modules/zod/src/v4/locales/he.ts +125 -0
  408. package/node_modules/zod/src/v4/locales/hu.ts +126 -0
  409. package/node_modules/zod/src/v4/locales/id.ts +125 -0
  410. package/node_modules/zod/src/v4/locales/index.ts +39 -0
  411. package/node_modules/zod/src/v4/locales/it.ts +125 -0
  412. package/node_modules/zod/src/v4/locales/ja.ts +122 -0
  413. package/node_modules/zod/src/v4/locales/kh.ts +126 -0
  414. package/node_modules/zod/src/v4/locales/ko.ts +131 -0
  415. package/node_modules/zod/src/v4/locales/mk.ts +127 -0
  416. package/node_modules/zod/src/v4/locales/ms.ts +124 -0
  417. package/node_modules/zod/src/v4/locales/nl.ts +126 -0
  418. package/node_modules/zod/src/v4/locales/no.ts +124 -0
  419. package/node_modules/zod/src/v4/locales/ota.ts +125 -0
  420. package/node_modules/zod/src/v4/locales/pl.ts +126 -0
  421. package/node_modules/zod/src/v4/locales/ps.ts +133 -0
  422. package/node_modules/zod/src/v4/locales/pt.ts +123 -0
  423. package/node_modules/zod/src/v4/locales/ru.ts +184 -0
  424. package/node_modules/zod/src/v4/locales/sl.ts +126 -0
  425. package/node_modules/zod/src/v4/locales/sv.ts +127 -0
  426. package/node_modules/zod/src/v4/locales/ta.ts +125 -0
  427. package/node_modules/zod/src/v4/locales/th.ts +126 -0
  428. package/node_modules/zod/src/v4/locales/tr.ts +121 -0
  429. package/node_modules/zod/src/v4/locales/ua.ts +126 -0
  430. package/node_modules/zod/src/v4/locales/ur.ts +126 -0
  431. package/node_modules/zod/src/v4/locales/vi.ts +125 -0
  432. package/node_modules/zod/src/v4/locales/zh-CN.ts +123 -0
  433. package/node_modules/zod/src/v4/locales/zh-TW.ts +125 -0
  434. package/node_modules/zod/src/v4/mini/checks.ts +32 -0
  435. package/node_modules/zod/src/v4/mini/coerce.ts +22 -0
  436. package/node_modules/zod/src/v4/mini/external.ts +40 -0
  437. package/node_modules/zod/src/v4/mini/index.ts +3 -0
  438. package/node_modules/zod/src/v4/mini/iso.ts +62 -0
  439. package/node_modules/zod/src/v4/mini/parse.ts +1 -0
  440. package/node_modules/zod/src/v4/mini/schemas.ts +1579 -0
  441. package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +129 -0
  442. package/node_modules/zod/src/v4/mini/tests/brand.test.ts +51 -0
  443. package/node_modules/zod/src/v4/mini/tests/checks.test.ts +144 -0
  444. package/node_modules/zod/src/v4/mini/tests/computed.test.ts +36 -0
  445. package/node_modules/zod/src/v4/mini/tests/error.test.ts +22 -0
  446. package/node_modules/zod/src/v4/mini/tests/functions.test.ts +43 -0
  447. package/node_modules/zod/src/v4/mini/tests/index.test.ts +871 -0
  448. package/node_modules/zod/src/v4/mini/tests/number.test.ts +95 -0
  449. package/node_modules/zod/src/v4/mini/tests/object.test.ts +185 -0
  450. package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
  451. package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +275 -0
  452. package/node_modules/zod/src/v4/mini/tests/string.test.ts +299 -0
  453. package/node_modules/zod/src/v4-mini/index.ts +1 -0
  454. package/node_modules/zod/v3/ZodError.cjs +138 -0
  455. package/node_modules/zod/v3/ZodError.d.cts +164 -0
  456. package/node_modules/zod/v3/ZodError.d.ts +164 -0
  457. package/node_modules/zod/v3/ZodError.js +133 -0
  458. package/node_modules/zod/v3/errors.cjs +17 -0
  459. package/node_modules/zod/v3/errors.d.cts +5 -0
  460. package/node_modules/zod/v3/errors.d.ts +5 -0
  461. package/node_modules/zod/v3/errors.js +9 -0
  462. package/node_modules/zod/v3/external.cjs +22 -0
  463. package/node_modules/zod/v3/external.d.cts +6 -0
  464. package/node_modules/zod/v3/external.d.ts +6 -0
  465. package/node_modules/zod/v3/external.js +6 -0
  466. package/node_modules/zod/v3/helpers/enumUtil.cjs +2 -0
  467. package/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
  468. package/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
  469. package/node_modules/zod/v3/helpers/enumUtil.js +1 -0
  470. package/node_modules/zod/v3/helpers/errorUtil.cjs +9 -0
  471. package/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
  472. package/node_modules/zod/v3/helpers/errorUtil.d.ts +9 -0
  473. package/node_modules/zod/v3/helpers/errorUtil.js +6 -0
  474. package/node_modules/zod/v3/helpers/parseUtil.cjs +124 -0
  475. package/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
  476. package/node_modules/zod/v3/helpers/parseUtil.d.ts +78 -0
  477. package/node_modules/zod/v3/helpers/parseUtil.js +109 -0
  478. package/node_modules/zod/v3/helpers/partialUtil.cjs +2 -0
  479. package/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
  480. package/node_modules/zod/v3/helpers/partialUtil.d.ts +8 -0
  481. package/node_modules/zod/v3/helpers/partialUtil.js +1 -0
  482. package/node_modules/zod/v3/helpers/typeAliases.cjs +2 -0
  483. package/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
  484. package/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
  485. package/node_modules/zod/v3/helpers/typeAliases.js +1 -0
  486. package/node_modules/zod/v3/helpers/util.cjs +137 -0
  487. package/node_modules/zod/v3/helpers/util.d.cts +85 -0
  488. package/node_modules/zod/v3/helpers/util.d.ts +85 -0
  489. package/node_modules/zod/v3/helpers/util.js +133 -0
  490. package/node_modules/zod/v3/index.cjs +33 -0
  491. package/node_modules/zod/v3/index.d.cts +4 -0
  492. package/node_modules/zod/v3/index.d.ts +4 -0
  493. package/node_modules/zod/v3/index.js +4 -0
  494. package/node_modules/zod/v3/locales/en.cjs +111 -0
  495. package/node_modules/zod/v3/locales/en.d.cts +3 -0
  496. package/node_modules/zod/v3/locales/en.d.ts +3 -0
  497. package/node_modules/zod/v3/locales/en.js +109 -0
  498. package/node_modules/zod/v3/standard-schema.cjs +2 -0
  499. package/node_modules/zod/v3/standard-schema.d.cts +102 -0
  500. package/node_modules/zod/v3/standard-schema.d.ts +102 -0
  501. package/node_modules/zod/v3/standard-schema.js +1 -0
  502. package/node_modules/zod/v3/types.cjs +3775 -0
  503. package/node_modules/zod/v3/types.d.cts +1031 -0
  504. package/node_modules/zod/v3/types.d.ts +1031 -0
  505. package/node_modules/zod/v3/types.js +3693 -0
  506. package/node_modules/zod/v4/classic/checks.cjs +32 -0
  507. package/node_modules/zod/v4/classic/checks.d.cts +1 -0
  508. package/node_modules/zod/v4/classic/checks.d.ts +1 -0
  509. package/node_modules/zod/v4/classic/checks.js +1 -0
  510. package/node_modules/zod/v4/classic/coerce.cjs +47 -0
  511. package/node_modules/zod/v4/classic/coerce.d.cts +17 -0
  512. package/node_modules/zod/v4/classic/coerce.d.ts +17 -0
  513. package/node_modules/zod/v4/classic/coerce.js +17 -0
  514. package/node_modules/zod/v4/classic/compat.cjs +57 -0
  515. package/node_modules/zod/v4/classic/compat.d.cts +46 -0
  516. package/node_modules/zod/v4/classic/compat.d.ts +46 -0
  517. package/node_modules/zod/v4/classic/compat.js +27 -0
  518. package/node_modules/zod/v4/classic/errors.cjs +67 -0
  519. package/node_modules/zod/v4/classic/errors.d.cts +30 -0
  520. package/node_modules/zod/v4/classic/errors.d.ts +30 -0
  521. package/node_modules/zod/v4/classic/errors.js +41 -0
  522. package/node_modules/zod/v4/classic/external.cjs +70 -0
  523. package/node_modules/zod/v4/classic/external.d.cts +13 -0
  524. package/node_modules/zod/v4/classic/external.d.ts +13 -0
  525. package/node_modules/zod/v4/classic/external.js +18 -0
  526. package/node_modules/zod/v4/classic/index.cjs +33 -0
  527. package/node_modules/zod/v4/classic/index.d.cts +4 -0
  528. package/node_modules/zod/v4/classic/index.d.ts +4 -0
  529. package/node_modules/zod/v4/classic/index.js +4 -0
  530. package/node_modules/zod/v4/classic/iso.cjs +60 -0
  531. package/node_modules/zod/v4/classic/iso.d.cts +22 -0
  532. package/node_modules/zod/v4/classic/iso.d.ts +22 -0
  533. package/node_modules/zod/v4/classic/iso.js +30 -0
  534. package/node_modules/zod/v4/classic/parse.cjs +32 -0
  535. package/node_modules/zod/v4/classic/parse.d.cts +23 -0
  536. package/node_modules/zod/v4/classic/parse.d.ts +23 -0
  537. package/node_modules/zod/v4/classic/parse.js +6 -0
  538. package/node_modules/zod/v4/classic/schemas.cjs +1109 -0
  539. package/node_modules/zod/v4/classic/schemas.d.cts +630 -0
  540. package/node_modules/zod/v4/classic/schemas.d.ts +630 -0
  541. package/node_modules/zod/v4/classic/schemas.js +1006 -0
  542. package/node_modules/zod/v4/core/api.cjs +1039 -0
  543. package/node_modules/zod/v4/core/api.d.cts +284 -0
  544. package/node_modules/zod/v4/core/api.d.ts +284 -0
  545. package/node_modules/zod/v4/core/api.js +906 -0
  546. package/node_modules/zod/v4/core/checks.cjs +591 -0
  547. package/node_modules/zod/v4/core/checks.d.cts +278 -0
  548. package/node_modules/zod/v4/core/checks.d.ts +278 -0
  549. package/node_modules/zod/v4/core/checks.js +565 -0
  550. package/node_modules/zod/v4/core/core.cjs +67 -0
  551. package/node_modules/zod/v4/core/core.d.cts +49 -0
  552. package/node_modules/zod/v4/core/core.d.ts +49 -0
  553. package/node_modules/zod/v4/core/core.js +61 -0
  554. package/node_modules/zod/v4/core/doc.cjs +39 -0
  555. package/node_modules/zod/v4/core/doc.d.cts +14 -0
  556. package/node_modules/zod/v4/core/doc.d.ts +14 -0
  557. package/node_modules/zod/v4/core/doc.js +35 -0
  558. package/node_modules/zod/v4/core/errors.cjs +226 -0
  559. package/node_modules/zod/v4/core/errors.d.cts +208 -0
  560. package/node_modules/zod/v4/core/errors.d.ts +208 -0
  561. package/node_modules/zod/v4/core/errors.js +195 -0
  562. package/node_modules/zod/v4/core/function.cjs +102 -0
  563. package/node_modules/zod/v4/core/function.d.cts +52 -0
  564. package/node_modules/zod/v4/core/function.d.ts +52 -0
  565. package/node_modules/zod/v4/core/function.js +75 -0
  566. package/node_modules/zod/v4/core/index.cjs +44 -0
  567. package/node_modules/zod/v4/core/index.d.cts +15 -0
  568. package/node_modules/zod/v4/core/index.d.ts +15 -0
  569. package/node_modules/zod/v4/core/index.js +15 -0
  570. package/node_modules/zod/v4/core/json-schema.cjs +2 -0
  571. package/node_modules/zod/v4/core/json-schema.d.cts +87 -0
  572. package/node_modules/zod/v4/core/json-schema.d.ts +87 -0
  573. package/node_modules/zod/v4/core/json-schema.js +1 -0
  574. package/node_modules/zod/v4/core/parse.cjs +87 -0
  575. package/node_modules/zod/v4/core/parse.d.cts +25 -0
  576. package/node_modules/zod/v4/core/parse.d.ts +25 -0
  577. package/node_modules/zod/v4/core/parse.js +57 -0
  578. package/node_modules/zod/v4/core/regexes.cjs +103 -0
  579. package/node_modules/zod/v4/core/regexes.d.cts +62 -0
  580. package/node_modules/zod/v4/core/regexes.d.ts +62 -0
  581. package/node_modules/zod/v4/core/regexes.js +95 -0
  582. package/node_modules/zod/v4/core/registries.cjs +56 -0
  583. package/node_modules/zod/v4/core/registries.d.cts +35 -0
  584. package/node_modules/zod/v4/core/registries.d.ts +35 -0
  585. package/node_modules/zod/v4/core/registries.js +51 -0
  586. package/node_modules/zod/v4/core/schemas.cjs +1748 -0
  587. package/node_modules/zod/v4/core/schemas.d.cts +1041 -0
  588. package/node_modules/zod/v4/core/schemas.d.ts +1041 -0
  589. package/node_modules/zod/v4/core/schemas.js +1717 -0
  590. package/node_modules/zod/v4/core/standard-schema.cjs +2 -0
  591. package/node_modules/zod/v4/core/standard-schema.d.cts +55 -0
  592. package/node_modules/zod/v4/core/standard-schema.d.ts +55 -0
  593. package/node_modules/zod/v4/core/standard-schema.js +1 -0
  594. package/node_modules/zod/v4/core/to-json-schema.cjs +854 -0
  595. package/node_modules/zod/v4/core/to-json-schema.d.cts +88 -0
  596. package/node_modules/zod/v4/core/to-json-schema.d.ts +88 -0
  597. package/node_modules/zod/v4/core/to-json-schema.js +849 -0
  598. package/node_modules/zod/v4/core/util.cjs +539 -0
  599. package/node_modules/zod/v4/core/util.d.cts +183 -0
  600. package/node_modules/zod/v4/core/util.d.ts +183 -0
  601. package/node_modules/zod/v4/core/util.js +493 -0
  602. package/node_modules/zod/v4/core/versions.cjs +8 -0
  603. package/node_modules/zod/v4/core/versions.d.cts +5 -0
  604. package/node_modules/zod/v4/core/versions.d.ts +5 -0
  605. package/node_modules/zod/v4/core/versions.js +5 -0
  606. package/node_modules/zod/v4/index.cjs +22 -0
  607. package/node_modules/zod/v4/index.d.cts +3 -0
  608. package/node_modules/zod/v4/index.d.ts +3 -0
  609. package/node_modules/zod/v4/index.js +3 -0
  610. package/node_modules/zod/v4/locales/ar.cjs +142 -0
  611. package/node_modules/zod/v4/locales/ar.d.cts +4 -0
  612. package/node_modules/zod/v4/locales/ar.d.ts +4 -0
  613. package/node_modules/zod/v4/locales/ar.js +116 -0
  614. package/node_modules/zod/v4/locales/az.cjs +141 -0
  615. package/node_modules/zod/v4/locales/az.d.cts +4 -0
  616. package/node_modules/zod/v4/locales/az.d.ts +4 -0
  617. package/node_modules/zod/v4/locales/az.js +115 -0
  618. package/node_modules/zod/v4/locales/be.cjs +190 -0
  619. package/node_modules/zod/v4/locales/be.d.cts +4 -0
  620. package/node_modules/zod/v4/locales/be.d.ts +4 -0
  621. package/node_modules/zod/v4/locales/be.js +164 -0
  622. package/node_modules/zod/v4/locales/ca.cjs +144 -0
  623. package/node_modules/zod/v4/locales/ca.d.cts +4 -0
  624. package/node_modules/zod/v4/locales/ca.d.ts +4 -0
  625. package/node_modules/zod/v4/locales/ca.js +118 -0
  626. package/node_modules/zod/v4/locales/cs.cjs +161 -0
  627. package/node_modules/zod/v4/locales/cs.d.cts +4 -0
  628. package/node_modules/zod/v4/locales/cs.d.ts +4 -0
  629. package/node_modules/zod/v4/locales/cs.js +135 -0
  630. package/node_modules/zod/v4/locales/de.cjs +142 -0
  631. package/node_modules/zod/v4/locales/de.d.cts +4 -0
  632. package/node_modules/zod/v4/locales/de.d.ts +4 -0
  633. package/node_modules/zod/v4/locales/de.js +116 -0
  634. package/node_modules/zod/v4/locales/en.cjs +145 -0
  635. package/node_modules/zod/v4/locales/en.d.cts +5 -0
  636. package/node_modules/zod/v4/locales/en.d.ts +5 -0
  637. package/node_modules/zod/v4/locales/en.js +117 -0
  638. package/node_modules/zod/v4/locales/eo.cjs +144 -0
  639. package/node_modules/zod/v4/locales/eo.d.cts +5 -0
  640. package/node_modules/zod/v4/locales/eo.d.ts +5 -0
  641. package/node_modules/zod/v4/locales/eo.js +116 -0
  642. package/node_modules/zod/v4/locales/es.cjs +143 -0
  643. package/node_modules/zod/v4/locales/es.d.cts +4 -0
  644. package/node_modules/zod/v4/locales/es.d.ts +4 -0
  645. package/node_modules/zod/v4/locales/es.js +117 -0
  646. package/node_modules/zod/v4/locales/fa.cjs +148 -0
  647. package/node_modules/zod/v4/locales/fa.d.cts +4 -0
  648. package/node_modules/zod/v4/locales/fa.d.ts +4 -0
  649. package/node_modules/zod/v4/locales/fa.js +122 -0
  650. package/node_modules/zod/v4/locales/fi.cjs +148 -0
  651. package/node_modules/zod/v4/locales/fi.d.cts +4 -0
  652. package/node_modules/zod/v4/locales/fi.d.ts +4 -0
  653. package/node_modules/zod/v4/locales/fi.js +122 -0
  654. package/node_modules/zod/v4/locales/fr-CA.cjs +143 -0
  655. package/node_modules/zod/v4/locales/fr-CA.d.cts +4 -0
  656. package/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
  657. package/node_modules/zod/v4/locales/fr-CA.js +117 -0
  658. package/node_modules/zod/v4/locales/fr.cjs +142 -0
  659. package/node_modules/zod/v4/locales/fr.d.cts +4 -0
  660. package/node_modules/zod/v4/locales/fr.d.ts +4 -0
  661. package/node_modules/zod/v4/locales/fr.js +116 -0
  662. package/node_modules/zod/v4/locales/he.cjs +143 -0
  663. package/node_modules/zod/v4/locales/he.d.cts +4 -0
  664. package/node_modules/zod/v4/locales/he.d.ts +4 -0
  665. package/node_modules/zod/v4/locales/he.js +117 -0
  666. package/node_modules/zod/v4/locales/hu.cjs +143 -0
  667. package/node_modules/zod/v4/locales/hu.d.cts +4 -0
  668. package/node_modules/zod/v4/locales/hu.d.ts +4 -0
  669. package/node_modules/zod/v4/locales/hu.js +117 -0
  670. package/node_modules/zod/v4/locales/id.cjs +142 -0
  671. package/node_modules/zod/v4/locales/id.d.cts +4 -0
  672. package/node_modules/zod/v4/locales/id.d.ts +4 -0
  673. package/node_modules/zod/v4/locales/id.js +116 -0
  674. package/node_modules/zod/v4/locales/index.cjs +84 -0
  675. package/node_modules/zod/v4/locales/index.d.cts +39 -0
  676. package/node_modules/zod/v4/locales/index.d.ts +39 -0
  677. package/node_modules/zod/v4/locales/index.js +39 -0
  678. package/node_modules/zod/v4/locales/it.cjs +143 -0
  679. package/node_modules/zod/v4/locales/it.d.cts +4 -0
  680. package/node_modules/zod/v4/locales/it.d.ts +4 -0
  681. package/node_modules/zod/v4/locales/it.js +117 -0
  682. package/node_modules/zod/v4/locales/ja.cjs +141 -0
  683. package/node_modules/zod/v4/locales/ja.d.cts +4 -0
  684. package/node_modules/zod/v4/locales/ja.d.ts +4 -0
  685. package/node_modules/zod/v4/locales/ja.js +115 -0
  686. package/node_modules/zod/v4/locales/kh.cjs +143 -0
  687. package/node_modules/zod/v4/locales/kh.d.cts +4 -0
  688. package/node_modules/zod/v4/locales/kh.d.ts +4 -0
  689. package/node_modules/zod/v4/locales/kh.js +117 -0
  690. package/node_modules/zod/v4/locales/ko.cjs +147 -0
  691. package/node_modules/zod/v4/locales/ko.d.cts +4 -0
  692. package/node_modules/zod/v4/locales/ko.d.ts +4 -0
  693. package/node_modules/zod/v4/locales/ko.js +121 -0
  694. package/node_modules/zod/v4/locales/mk.cjs +144 -0
  695. package/node_modules/zod/v4/locales/mk.d.cts +4 -0
  696. package/node_modules/zod/v4/locales/mk.d.ts +4 -0
  697. package/node_modules/zod/v4/locales/mk.js +118 -0
  698. package/node_modules/zod/v4/locales/ms.cjs +142 -0
  699. package/node_modules/zod/v4/locales/ms.d.cts +4 -0
  700. package/node_modules/zod/v4/locales/ms.d.ts +4 -0
  701. package/node_modules/zod/v4/locales/ms.js +116 -0
  702. package/node_modules/zod/v4/locales/nl.cjs +143 -0
  703. package/node_modules/zod/v4/locales/nl.d.cts +4 -0
  704. package/node_modules/zod/v4/locales/nl.d.ts +4 -0
  705. package/node_modules/zod/v4/locales/nl.js +117 -0
  706. package/node_modules/zod/v4/locales/no.cjs +142 -0
  707. package/node_modules/zod/v4/locales/no.d.cts +4 -0
  708. package/node_modules/zod/v4/locales/no.d.ts +4 -0
  709. package/node_modules/zod/v4/locales/no.js +116 -0
  710. package/node_modules/zod/v4/locales/ota.cjs +143 -0
  711. package/node_modules/zod/v4/locales/ota.d.cts +4 -0
  712. package/node_modules/zod/v4/locales/ota.d.ts +4 -0
  713. package/node_modules/zod/v4/locales/ota.js +117 -0
  714. package/node_modules/zod/v4/locales/pl.cjs +143 -0
  715. package/node_modules/zod/v4/locales/pl.d.cts +4 -0
  716. package/node_modules/zod/v4/locales/pl.d.ts +4 -0
  717. package/node_modules/zod/v4/locales/pl.js +117 -0
  718. package/node_modules/zod/v4/locales/ps.cjs +148 -0
  719. package/node_modules/zod/v4/locales/ps.d.cts +4 -0
  720. package/node_modules/zod/v4/locales/ps.d.ts +4 -0
  721. package/node_modules/zod/v4/locales/ps.js +122 -0
  722. package/node_modules/zod/v4/locales/pt.cjs +142 -0
  723. package/node_modules/zod/v4/locales/pt.d.cts +4 -0
  724. package/node_modules/zod/v4/locales/pt.d.ts +4 -0
  725. package/node_modules/zod/v4/locales/pt.js +116 -0
  726. package/node_modules/zod/v4/locales/ru.cjs +190 -0
  727. package/node_modules/zod/v4/locales/ru.d.cts +4 -0
  728. package/node_modules/zod/v4/locales/ru.d.ts +4 -0
  729. package/node_modules/zod/v4/locales/ru.js +164 -0
  730. package/node_modules/zod/v4/locales/sl.cjs +143 -0
  731. package/node_modules/zod/v4/locales/sl.d.cts +4 -0
  732. package/node_modules/zod/v4/locales/sl.d.ts +4 -0
  733. package/node_modules/zod/v4/locales/sl.js +117 -0
  734. package/node_modules/zod/v4/locales/sv.cjs +144 -0
  735. package/node_modules/zod/v4/locales/sv.d.cts +4 -0
  736. package/node_modules/zod/v4/locales/sv.d.ts +4 -0
  737. package/node_modules/zod/v4/locales/sv.js +118 -0
  738. package/node_modules/zod/v4/locales/ta.cjs +143 -0
  739. package/node_modules/zod/v4/locales/ta.d.cts +4 -0
  740. package/node_modules/zod/v4/locales/ta.d.ts +4 -0
  741. package/node_modules/zod/v4/locales/ta.js +117 -0
  742. package/node_modules/zod/v4/locales/th.cjs +143 -0
  743. package/node_modules/zod/v4/locales/th.d.cts +4 -0
  744. package/node_modules/zod/v4/locales/th.d.ts +4 -0
  745. package/node_modules/zod/v4/locales/th.js +117 -0
  746. package/node_modules/zod/v4/locales/tr.cjs +143 -0
  747. package/node_modules/zod/v4/locales/tr.d.cts +5 -0
  748. package/node_modules/zod/v4/locales/tr.d.ts +5 -0
  749. package/node_modules/zod/v4/locales/tr.js +115 -0
  750. package/node_modules/zod/v4/locales/ua.cjs +143 -0
  751. package/node_modules/zod/v4/locales/ua.d.cts +4 -0
  752. package/node_modules/zod/v4/locales/ua.d.ts +4 -0
  753. package/node_modules/zod/v4/locales/ua.js +117 -0
  754. package/node_modules/zod/v4/locales/ur.cjs +143 -0
  755. package/node_modules/zod/v4/locales/ur.d.cts +4 -0
  756. package/node_modules/zod/v4/locales/ur.d.ts +4 -0
  757. package/node_modules/zod/v4/locales/ur.js +117 -0
  758. package/node_modules/zod/v4/locales/vi.cjs +142 -0
  759. package/node_modules/zod/v4/locales/vi.d.cts +4 -0
  760. package/node_modules/zod/v4/locales/vi.d.ts +4 -0
  761. package/node_modules/zod/v4/locales/vi.js +116 -0
  762. package/node_modules/zod/v4/locales/zh-CN.cjs +142 -0
  763. package/node_modules/zod/v4/locales/zh-CN.d.cts +4 -0
  764. package/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
  765. package/node_modules/zod/v4/locales/zh-CN.js +116 -0
  766. package/node_modules/zod/v4/locales/zh-TW.cjs +143 -0
  767. package/node_modules/zod/v4/locales/zh-TW.d.cts +4 -0
  768. package/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
  769. package/node_modules/zod/v4/locales/zh-TW.js +117 -0
  770. package/node_modules/zod/v4/mini/checks.cjs +34 -0
  771. package/node_modules/zod/v4/mini/checks.d.cts +1 -0
  772. package/node_modules/zod/v4/mini/checks.d.ts +1 -0
  773. package/node_modules/zod/v4/mini/checks.js +1 -0
  774. package/node_modules/zod/v4/mini/coerce.cjs +47 -0
  775. package/node_modules/zod/v4/mini/coerce.d.cts +7 -0
  776. package/node_modules/zod/v4/mini/coerce.d.ts +7 -0
  777. package/node_modules/zod/v4/mini/coerce.js +17 -0
  778. package/node_modules/zod/v4/mini/external.cjs +62 -0
  779. package/node_modules/zod/v4/mini/external.d.cts +11 -0
  780. package/node_modules/zod/v4/mini/external.d.ts +11 -0
  781. package/node_modules/zod/v4/mini/external.js +13 -0
  782. package/node_modules/zod/v4/mini/index.cjs +32 -0
  783. package/node_modules/zod/v4/mini/index.d.cts +3 -0
  784. package/node_modules/zod/v4/mini/index.d.ts +3 -0
  785. package/node_modules/zod/v4/mini/index.js +3 -0
  786. package/node_modules/zod/v4/mini/iso.cjs +60 -0
  787. package/node_modules/zod/v4/mini/iso.d.cts +22 -0
  788. package/node_modules/zod/v4/mini/iso.d.ts +22 -0
  789. package/node_modules/zod/v4/mini/iso.js +30 -0
  790. package/node_modules/zod/v4/mini/parse.cjs +8 -0
  791. package/node_modules/zod/v4/mini/parse.d.cts +1 -0
  792. package/node_modules/zod/v4/mini/parse.d.ts +1 -0
  793. package/node_modules/zod/v4/mini/parse.js +1 -0
  794. package/node_modules/zod/v4/mini/schemas.cjs +839 -0
  795. package/node_modules/zod/v4/mini/schemas.d.cts +356 -0
  796. package/node_modules/zod/v4/mini/schemas.d.ts +356 -0
  797. package/node_modules/zod/v4/mini/schemas.js +732 -0
  798. package/node_modules/zod/v4-mini/index.cjs +17 -0
  799. package/node_modules/zod/v4-mini/index.d.cts +1 -0
  800. package/node_modules/zod/v4-mini/index.d.ts +1 -0
  801. package/node_modules/zod/v4-mini/index.js +1 -0
  802. package/package.json +99 -104
  803. package/dist/Workspace-DMye5DU8.js +0 -43113
@@ -0,0 +1,1470 @@
1
+ /*! @license DOMPurify 3.4.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.1/LICENSE */
2
+
3
+ const {
4
+ entries,
5
+ setPrototypeOf,
6
+ isFrozen,
7
+ getPrototypeOf,
8
+ getOwnPropertyDescriptor
9
+ } = Object;
10
+ let {
11
+ freeze,
12
+ seal,
13
+ create
14
+ } = Object; // eslint-disable-line import/no-mutable-exports
15
+ let {
16
+ apply,
17
+ construct
18
+ } = typeof Reflect !== 'undefined' && Reflect;
19
+ if (!freeze) {
20
+ freeze = function freeze(x) {
21
+ return x;
22
+ };
23
+ }
24
+ if (!seal) {
25
+ seal = function seal(x) {
26
+ return x;
27
+ };
28
+ }
29
+ if (!apply) {
30
+ apply = function apply(func, thisArg) {
31
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
32
+ args[_key - 2] = arguments[_key];
33
+ }
34
+ return func.apply(thisArg, args);
35
+ };
36
+ }
37
+ if (!construct) {
38
+ construct = function construct(Func) {
39
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
40
+ args[_key2 - 1] = arguments[_key2];
41
+ }
42
+ return new Func(...args);
43
+ };
44
+ }
45
+ const arrayForEach = unapply(Array.prototype.forEach);
46
+ const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
47
+ const arrayPop = unapply(Array.prototype.pop);
48
+ const arrayPush = unapply(Array.prototype.push);
49
+ const arraySplice = unapply(Array.prototype.splice);
50
+ const arrayIsArray = Array.isArray;
51
+ const stringToLowerCase = unapply(String.prototype.toLowerCase);
52
+ const stringToString = unapply(String.prototype.toString);
53
+ const stringMatch = unapply(String.prototype.match);
54
+ const stringReplace = unapply(String.prototype.replace);
55
+ const stringIndexOf = unapply(String.prototype.indexOf);
56
+ const stringTrim = unapply(String.prototype.trim);
57
+ const numberToString = unapply(Number.prototype.toString);
58
+ const booleanToString = unapply(Boolean.prototype.toString);
59
+ const bigintToString = typeof BigInt === 'undefined' ? null : unapply(BigInt.prototype.toString);
60
+ const symbolToString = typeof Symbol === 'undefined' ? null : unapply(Symbol.prototype.toString);
61
+ const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
62
+ const objectToString = unapply(Object.prototype.toString);
63
+ const regExpTest = unapply(RegExp.prototype.test);
64
+ const typeErrorCreate = unconstruct(TypeError);
65
+ /**
66
+ * Creates a new function that calls the given function with a specified thisArg and arguments.
67
+ *
68
+ * @param func - The function to be wrapped and called.
69
+ * @returns A new function that calls the given function with a specified thisArg and arguments.
70
+ */
71
+ function unapply(func) {
72
+ return function (thisArg) {
73
+ if (thisArg instanceof RegExp) {
74
+ thisArg.lastIndex = 0;
75
+ }
76
+ for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
77
+ args[_key3 - 1] = arguments[_key3];
78
+ }
79
+ return apply(func, thisArg, args);
80
+ };
81
+ }
82
+ /**
83
+ * Creates a new function that constructs an instance of the given constructor function with the provided arguments.
84
+ *
85
+ * @param func - The constructor function to be wrapped and called.
86
+ * @returns A new function that constructs an instance of the given constructor function with the provided arguments.
87
+ */
88
+ function unconstruct(Func) {
89
+ return function () {
90
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
91
+ args[_key4] = arguments[_key4];
92
+ }
93
+ return construct(Func, args);
94
+ };
95
+ }
96
+ /**
97
+ * Add properties to a lookup table
98
+ *
99
+ * @param set - The set to which elements will be added.
100
+ * @param array - The array containing elements to be added to the set.
101
+ * @param transformCaseFunc - An optional function to transform the case of each element before adding to the set.
102
+ * @returns The modified set with added elements.
103
+ */
104
+ function addToSet(set, array) {
105
+ let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase;
106
+ if (setPrototypeOf) {
107
+ // Make 'in' and truthy checks like Boolean(set.constructor)
108
+ // independent of any properties defined on Object.prototype.
109
+ // Prevent prototype setters from intercepting set as a this value.
110
+ setPrototypeOf(set, null);
111
+ }
112
+ if (!arrayIsArray(array)) {
113
+ return set;
114
+ }
115
+ let l = array.length;
116
+ while (l--) {
117
+ let element = array[l];
118
+ if (typeof element === 'string') {
119
+ const lcElement = transformCaseFunc(element);
120
+ if (lcElement !== element) {
121
+ // Config presets (e.g. tags.js, attrs.js) are immutable.
122
+ if (!isFrozen(array)) {
123
+ array[l] = lcElement;
124
+ }
125
+ element = lcElement;
126
+ }
127
+ }
128
+ set[element] = true;
129
+ }
130
+ return set;
131
+ }
132
+ /**
133
+ * Clean up an array to harden against CSPP
134
+ *
135
+ * @param array - The array to be cleaned.
136
+ * @returns The cleaned version of the array
137
+ */
138
+ function cleanArray(array) {
139
+ for (let index = 0; index < array.length; index++) {
140
+ const isPropertyExist = objectHasOwnProperty(array, index);
141
+ if (!isPropertyExist) {
142
+ array[index] = null;
143
+ }
144
+ }
145
+ return array;
146
+ }
147
+ /**
148
+ * Shallow clone an object
149
+ *
150
+ * @param object - The object to be cloned.
151
+ * @returns A new object that copies the original.
152
+ */
153
+ function clone(object) {
154
+ const newObject = create(null);
155
+ for (const [property, value] of entries(object)) {
156
+ const isPropertyExist = objectHasOwnProperty(object, property);
157
+ if (isPropertyExist) {
158
+ if (arrayIsArray(value)) {
159
+ newObject[property] = cleanArray(value);
160
+ } else if (value && typeof value === 'object' && value.constructor === Object) {
161
+ newObject[property] = clone(value);
162
+ } else {
163
+ newObject[property] = value;
164
+ }
165
+ }
166
+ }
167
+ return newObject;
168
+ }
169
+ /**
170
+ * Convert non-node values into strings without depending on direct property access.
171
+ *
172
+ * @param value - The value to stringify.
173
+ * @returns A string representation of the provided value.
174
+ */
175
+ function stringifyValue(value) {
176
+ switch (typeof value) {
177
+ case 'string':
178
+ {
179
+ return value;
180
+ }
181
+ case 'number':
182
+ {
183
+ return numberToString(value);
184
+ }
185
+ case 'boolean':
186
+ {
187
+ return booleanToString(value);
188
+ }
189
+ case 'bigint':
190
+ {
191
+ return bigintToString ? bigintToString(value) : '0';
192
+ }
193
+ case 'symbol':
194
+ {
195
+ return symbolToString ? symbolToString(value) : 'Symbol()';
196
+ }
197
+ case 'undefined':
198
+ {
199
+ return objectToString(value);
200
+ }
201
+ case 'function':
202
+ case 'object':
203
+ {
204
+ if (value === null) {
205
+ return objectToString(value);
206
+ }
207
+ const valueAsRecord = value;
208
+ const valueToString = lookupGetter(valueAsRecord, 'toString');
209
+ if (typeof valueToString === 'function') {
210
+ const stringified = valueToString(valueAsRecord);
211
+ return typeof stringified === 'string' ? stringified : objectToString(stringified);
212
+ }
213
+ return objectToString(value);
214
+ }
215
+ default:
216
+ {
217
+ return objectToString(value);
218
+ }
219
+ }
220
+ }
221
+ /**
222
+ * This method automatically checks if the prop is function or getter and behaves accordingly.
223
+ *
224
+ * @param object - The object to look up the getter function in its prototype chain.
225
+ * @param prop - The property name for which to find the getter function.
226
+ * @returns The getter function found in the prototype chain or a fallback function.
227
+ */
228
+ function lookupGetter(object, prop) {
229
+ while (object !== null) {
230
+ const desc = getOwnPropertyDescriptor(object, prop);
231
+ if (desc) {
232
+ if (desc.get) {
233
+ return unapply(desc.get);
234
+ }
235
+ if (typeof desc.value === 'function') {
236
+ return unapply(desc.value);
237
+ }
238
+ }
239
+ object = getPrototypeOf(object);
240
+ }
241
+ function fallbackValue() {
242
+ return null;
243
+ }
244
+ return fallbackValue;
245
+ }
246
+ function isRegex(value) {
247
+ try {
248
+ regExpTest(value, '');
249
+ return true;
250
+ } catch (_unused) {
251
+ return false;
252
+ }
253
+ }
254
+
255
+ const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'search', 'section', 'select', 'shadow', 'slot', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
256
+ const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'enterkeyhint', 'exportparts', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'inputmode', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'part', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
257
+ const svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);
258
+ // List of SVG elements that are disallowed by default.
259
+ // We still need to know them so that we can do namespace
260
+ // checks properly in case one wants to add them to
261
+ // allow-list.
262
+ const svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);
263
+ const mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover', 'mprescripts']);
264
+ // Similarly to SVG, we want to know all MathML elements,
265
+ // even those that we disallow by default.
266
+ const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
267
+ const text = freeze(['#text']);
268
+
269
+ const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'exportparts', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inert', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'part', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'slot', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns']);
270
+ const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'mask-type', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-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']);
271
+ const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnalign', 'columnlines', 'columnspacing', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lquote', 'lspace', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
272
+ const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
273
+
274
+ // eslint-disable-next-line unicorn/better-regex
275
+ const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
276
+ const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
277
+ const TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm); // eslint-disable-line unicorn/better-regex
278
+ const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/); // eslint-disable-line no-useless-escape
279
+ const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
280
+ const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
281
+ );
282
+ const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
283
+ const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
284
+ );
285
+ const DOCTYPE_NAME = seal(/^html$/i);
286
+ const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
287
+
288
+ var EXPRESSIONS = /*#__PURE__*/Object.freeze({
289
+ __proto__: null,
290
+ ARIA_ATTR: ARIA_ATTR,
291
+ ATTR_WHITESPACE: ATTR_WHITESPACE,
292
+ CUSTOM_ELEMENT: CUSTOM_ELEMENT,
293
+ DATA_ATTR: DATA_ATTR,
294
+ DOCTYPE_NAME: DOCTYPE_NAME,
295
+ ERB_EXPR: ERB_EXPR,
296
+ IS_ALLOWED_URI: IS_ALLOWED_URI,
297
+ IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,
298
+ MUSTACHE_EXPR: MUSTACHE_EXPR,
299
+ TMPLIT_EXPR: TMPLIT_EXPR
300
+ });
301
+
302
+ /* eslint-disable @typescript-eslint/indent */
303
+ // https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
304
+ const NODE_TYPE = {
305
+ element: 1,
306
+ text: 3,
307
+ // Deprecated
308
+ progressingInstruction: 7,
309
+ comment: 8,
310
+ document: 9};
311
+ const getGlobal = function getGlobal() {
312
+ return typeof window === 'undefined' ? null : window;
313
+ };
314
+ /**
315
+ * Creates a no-op policy for internal use only.
316
+ * Don't export this function outside this module!
317
+ * @param trustedTypes The policy factory.
318
+ * @param purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
319
+ * @return The policy created (or null, if Trusted Types
320
+ * are not supported or creating the policy failed).
321
+ */
322
+ const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
323
+ if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
324
+ return null;
325
+ }
326
+ // Allow the callers to control the unique policy name
327
+ // by adding a data-tt-policy-suffix to the script element with the DOMPurify.
328
+ // Policy creation with duplicate names throws in Trusted Types.
329
+ let suffix = null;
330
+ const ATTR_NAME = 'data-tt-policy-suffix';
331
+ if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
332
+ suffix = purifyHostElement.getAttribute(ATTR_NAME);
333
+ }
334
+ const policyName = 'dompurify' + (suffix ? '#' + suffix : '');
335
+ try {
336
+ return trustedTypes.createPolicy(policyName, {
337
+ createHTML(html) {
338
+ return html;
339
+ },
340
+ createScriptURL(scriptUrl) {
341
+ return scriptUrl;
342
+ }
343
+ });
344
+ } catch (_) {
345
+ // Policy creation failed (most likely another DOMPurify script has
346
+ // already run). Skip creating the policy, as this will only cause errors
347
+ // if TT are enforced.
348
+ console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
349
+ return null;
350
+ }
351
+ };
352
+ const _createHooksMap = function _createHooksMap() {
353
+ return {
354
+ afterSanitizeAttributes: [],
355
+ afterSanitizeElements: [],
356
+ afterSanitizeShadowDOM: [],
357
+ beforeSanitizeAttributes: [],
358
+ beforeSanitizeElements: [],
359
+ beforeSanitizeShadowDOM: [],
360
+ uponSanitizeAttribute: [],
361
+ uponSanitizeElement: [],
362
+ uponSanitizeShadowNode: []
363
+ };
364
+ };
365
+ function createDOMPurify() {
366
+ let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
367
+ const DOMPurify = root => createDOMPurify(root);
368
+ DOMPurify.version = '3.4.1';
369
+ DOMPurify.removed = [];
370
+ if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
371
+ // Not running in a browser, provide a factory function
372
+ // so that you can pass your own Window
373
+ DOMPurify.isSupported = false;
374
+ return DOMPurify;
375
+ }
376
+ let {
377
+ document
378
+ } = window;
379
+ const originalDocument = document;
380
+ const currentScript = originalDocument.currentScript;
381
+ const {
382
+ DocumentFragment,
383
+ HTMLTemplateElement,
384
+ Node,
385
+ Element,
386
+ NodeFilter,
387
+ NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,
388
+ HTMLFormElement,
389
+ DOMParser,
390
+ trustedTypes
391
+ } = window;
392
+ const ElementPrototype = Element.prototype;
393
+ const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
394
+ const remove = lookupGetter(ElementPrototype, 'remove');
395
+ const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
396
+ const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
397
+ const getParentNode = lookupGetter(ElementPrototype, 'parentNode');
398
+ // As per issue #47, the web-components registry is inherited by a
399
+ // new document created via createHTMLDocument. As per the spec
400
+ // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
401
+ // a new empty registry is used when creating a template contents owner
402
+ // document, so we use that as our parent document to ensure nothing
403
+ // is inherited.
404
+ if (typeof HTMLTemplateElement === 'function') {
405
+ const template = document.createElement('template');
406
+ if (template.content && template.content.ownerDocument) {
407
+ document = template.content.ownerDocument;
408
+ }
409
+ }
410
+ let trustedTypesPolicy;
411
+ let emptyHTML = '';
412
+ const {
413
+ implementation,
414
+ createNodeIterator,
415
+ createDocumentFragment,
416
+ getElementsByTagName
417
+ } = document;
418
+ const {
419
+ importNode
420
+ } = originalDocument;
421
+ let hooks = _createHooksMap();
422
+ /**
423
+ * Expose whether this browser supports running the full DOMPurify.
424
+ */
425
+ DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;
426
+ const {
427
+ MUSTACHE_EXPR,
428
+ ERB_EXPR,
429
+ TMPLIT_EXPR,
430
+ DATA_ATTR,
431
+ ARIA_ATTR,
432
+ IS_SCRIPT_OR_DATA,
433
+ ATTR_WHITESPACE,
434
+ CUSTOM_ELEMENT
435
+ } = EXPRESSIONS;
436
+ let {
437
+ IS_ALLOWED_URI: IS_ALLOWED_URI$1
438
+ } = EXPRESSIONS;
439
+ /**
440
+ * We consider the elements and attributes below to be safe. Ideally
441
+ * don't add any new ones but feel free to remove unwanted ones.
442
+ */
443
+ /* allowed element names */
444
+ let ALLOWED_TAGS = null;
445
+ const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
446
+ /* Allowed attribute names */
447
+ let ALLOWED_ATTR = null;
448
+ const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
449
+ /*
450
+ * Configure how DOMPurify should handle custom elements and their attributes as well as customized built-in elements.
451
+ * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
452
+ * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
453
+ * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
454
+ */
455
+ let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
456
+ tagNameCheck: {
457
+ writable: true,
458
+ configurable: false,
459
+ enumerable: true,
460
+ value: null
461
+ },
462
+ attributeNameCheck: {
463
+ writable: true,
464
+ configurable: false,
465
+ enumerable: true,
466
+ value: null
467
+ },
468
+ allowCustomizedBuiltInElements: {
469
+ writable: true,
470
+ configurable: false,
471
+ enumerable: true,
472
+ value: false
473
+ }
474
+ }));
475
+ /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
476
+ let FORBID_TAGS = null;
477
+ /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
478
+ let FORBID_ATTR = null;
479
+ /* Config object to store ADD_TAGS/ADD_ATTR functions (when used as functions) */
480
+ const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
481
+ tagCheck: {
482
+ writable: true,
483
+ configurable: false,
484
+ enumerable: true,
485
+ value: null
486
+ },
487
+ attributeCheck: {
488
+ writable: true,
489
+ configurable: false,
490
+ enumerable: true,
491
+ value: null
492
+ }
493
+ }));
494
+ /* Decide if ARIA attributes are okay */
495
+ let ALLOW_ARIA_ATTR = true;
496
+ /* Decide if custom data attributes are okay */
497
+ let ALLOW_DATA_ATTR = true;
498
+ /* Decide if unknown protocols are okay */
499
+ let ALLOW_UNKNOWN_PROTOCOLS = false;
500
+ /* Decide if self-closing tags in attributes are allowed.
501
+ * Usually removed due to a mXSS issue in jQuery 3.0 */
502
+ let ALLOW_SELF_CLOSE_IN_ATTR = true;
503
+ /* Output should be safe for common template engines.
504
+ * This means, DOMPurify removes data attributes, mustaches and ERB
505
+ */
506
+ let SAFE_FOR_TEMPLATES = false;
507
+ /* Output should be safe even for XML used within HTML and alike.
508
+ * This means, DOMPurify removes comments when containing risky content.
509
+ */
510
+ let SAFE_FOR_XML = true;
511
+ /* Decide if document with <html>... should be returned */
512
+ let WHOLE_DOCUMENT = false;
513
+ /* Track whether config is already set on this instance of DOMPurify. */
514
+ let SET_CONFIG = false;
515
+ /* Decide if all elements (e.g. style, script) must be children of
516
+ * document.body. By default, browsers might move them to document.head */
517
+ let FORCE_BODY = false;
518
+ /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
519
+ * string (or a TrustedHTML object if Trusted Types are supported).
520
+ * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
521
+ */
522
+ let RETURN_DOM = false;
523
+ /* Decide if a DOM `DocumentFragment` should be returned, instead of a html
524
+ * string (or a TrustedHTML object if Trusted Types are supported) */
525
+ let RETURN_DOM_FRAGMENT = false;
526
+ /* Try to return a Trusted Type object instead of a string, return a string in
527
+ * case Trusted Types are not supported */
528
+ let RETURN_TRUSTED_TYPE = false;
529
+ /* Output should be free from DOM clobbering attacks?
530
+ * This sanitizes markups named with colliding, clobberable built-in DOM APIs.
531
+ */
532
+ let SANITIZE_DOM = true;
533
+ /* Achieve full DOM Clobbering protection by isolating the namespace of named
534
+ * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.
535
+ *
536
+ * HTML/DOM spec rules that enable DOM Clobbering:
537
+ * - Named Access on Window (§7.3.3)
538
+ * - DOM Tree Accessors (§3.1.5)
539
+ * - Form Element Parent-Child Relations (§4.10.3)
540
+ * - Iframe srcdoc / Nested WindowProxies (§4.8.5)
541
+ * - HTMLCollection (§4.2.10.2)
542
+ *
543
+ * Namespace isolation is implemented by prefixing `id` and `name` attributes
544
+ * with a constant string, i.e., `user-content-`
545
+ */
546
+ let SANITIZE_NAMED_PROPS = false;
547
+ const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
548
+ /* Keep element content when removing element? */
549
+ let KEEP_CONTENT = true;
550
+ /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
551
+ * of importing it into a new Document and returning a sanitized copy */
552
+ let IN_PLACE = false;
553
+ /* Allow usage of profiles like html, svg and mathMl */
554
+ let USE_PROFILES = {};
555
+ /* Tags to ignore content of when KEEP_CONTENT is true */
556
+ let FORBID_CONTENTS = null;
557
+ const DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);
558
+ /* Tags that are safe for data: URIs */
559
+ let DATA_URI_TAGS = null;
560
+ const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
561
+ /* Attributes safe for values like "javascript:" */
562
+ let URI_SAFE_ATTRIBUTES = null;
563
+ const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
564
+ const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
565
+ const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
566
+ const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
567
+ /* Document namespace */
568
+ let NAMESPACE = HTML_NAMESPACE;
569
+ let IS_EMPTY_INPUT = false;
570
+ /* Allowed XHTML+XML namespaces */
571
+ let ALLOWED_NAMESPACES = null;
572
+ const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
573
+ let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
574
+ let HTML_INTEGRATION_POINTS = addToSet({}, ['annotation-xml']);
575
+ // Certain elements are allowed in both SVG and HTML
576
+ // namespace. We need to specify them explicitly
577
+ // so that they don't get erroneously deleted from
578
+ // HTML namespace.
579
+ const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
580
+ /* Parsing of strict XHTML documents */
581
+ let PARSER_MEDIA_TYPE = null;
582
+ const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
583
+ const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
584
+ let transformCaseFunc = null;
585
+ /* Keep a reference to config to pass to hooks */
586
+ let CONFIG = null;
587
+ /* Ideally, do not touch anything below this line */
588
+ /* ______________________________________________ */
589
+ const formElement = document.createElement('form');
590
+ const isRegexOrFunction = function isRegexOrFunction(testValue) {
591
+ return testValue instanceof RegExp || testValue instanceof Function;
592
+ };
593
+ /**
594
+ * _parseConfig
595
+ *
596
+ * @param cfg optional config literal
597
+ */
598
+ // eslint-disable-next-line complexity
599
+ const _parseConfig = function _parseConfig() {
600
+ let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
601
+ if (CONFIG && CONFIG === cfg) {
602
+ return;
603
+ }
604
+ /* Shield configuration object from tampering */
605
+ if (!cfg || typeof cfg !== 'object') {
606
+ cfg = {};
607
+ }
608
+ /* Shield configuration object from prototype pollution */
609
+ cfg = clone(cfg);
610
+ PARSER_MEDIA_TYPE =
611
+ // eslint-disable-next-line unicorn/prefer-includes
612
+ SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
613
+ // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
614
+ transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
615
+ /* Set configuration parameters */
616
+ ALLOWED_TAGS = objectHasOwnProperty(cfg, 'ALLOWED_TAGS') && arrayIsArray(cfg.ALLOWED_TAGS) ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
617
+ ALLOWED_ATTR = objectHasOwnProperty(cfg, 'ALLOWED_ATTR') && arrayIsArray(cfg.ALLOWED_ATTR) ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
618
+ ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, 'ALLOWED_NAMESPACES') && arrayIsArray(cfg.ALLOWED_NAMESPACES) ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
619
+ URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') && arrayIsArray(cfg.ADD_URI_SAFE_ATTR) ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
620
+ DATA_URI_TAGS = objectHasOwnProperty(cfg, 'ADD_DATA_URI_TAGS') && arrayIsArray(cfg.ADD_DATA_URI_TAGS) ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
621
+ FORBID_CONTENTS = objectHasOwnProperty(cfg, 'FORBID_CONTENTS') && arrayIsArray(cfg.FORBID_CONTENTS) ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
622
+ FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') && arrayIsArray(cfg.FORBID_TAGS) ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone({});
623
+ FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') && arrayIsArray(cfg.FORBID_ATTR) ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone({});
624
+ USE_PROFILES = objectHasOwnProperty(cfg, 'USE_PROFILES') ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === 'object' ? clone(cfg.USE_PROFILES) : cfg.USE_PROFILES : false;
625
+ ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
626
+ ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
627
+ ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
628
+ ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true
629
+ SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
630
+ SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false; // Default true
631
+ WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
632
+ RETURN_DOM = cfg.RETURN_DOM || false; // Default false
633
+ RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
634
+ RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false
635
+ FORCE_BODY = cfg.FORCE_BODY || false; // Default false
636
+ SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
637
+ SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false
638
+ KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
639
+ IN_PLACE = cfg.IN_PLACE || false; // Default false
640
+ IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI; // Default regexp
641
+ NAMESPACE = typeof cfg.NAMESPACE === 'string' ? cfg.NAMESPACE : HTML_NAMESPACE; // Default HTML namespace
642
+ MATHML_TEXT_INTEGRATION_POINTS = objectHasOwnProperty(cfg, 'MATHML_TEXT_INTEGRATION_POINTS') && cfg.MATHML_TEXT_INTEGRATION_POINTS && typeof cfg.MATHML_TEXT_INTEGRATION_POINTS === 'object' ? clone(cfg.MATHML_TEXT_INTEGRATION_POINTS) : addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']); // Default built-in map
643
+ HTML_INTEGRATION_POINTS = objectHasOwnProperty(cfg, 'HTML_INTEGRATION_POINTS') && cfg.HTML_INTEGRATION_POINTS && typeof cfg.HTML_INTEGRATION_POINTS === 'object' ? clone(cfg.HTML_INTEGRATION_POINTS) : addToSet({}, ['annotation-xml']); // Default built-in map
644
+ const customElementHandling = objectHasOwnProperty(cfg, 'CUSTOM_ELEMENT_HANDLING') && cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING === 'object' ? clone(cfg.CUSTOM_ELEMENT_HANDLING) : create(null);
645
+ CUSTOM_ELEMENT_HANDLING = create(null);
646
+ if (objectHasOwnProperty(customElementHandling, 'tagNameCheck') && isRegexOrFunction(customElementHandling.tagNameCheck)) {
647
+ CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck; // Default undefined
648
+ }
649
+ if (objectHasOwnProperty(customElementHandling, 'attributeNameCheck') && isRegexOrFunction(customElementHandling.attributeNameCheck)) {
650
+ CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck; // Default undefined
651
+ }
652
+ if (objectHasOwnProperty(customElementHandling, 'allowCustomizedBuiltInElements') && typeof customElementHandling.allowCustomizedBuiltInElements === 'boolean') {
653
+ CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements; // Default undefined
654
+ }
655
+ if (SAFE_FOR_TEMPLATES) {
656
+ ALLOW_DATA_ATTR = false;
657
+ }
658
+ if (RETURN_DOM_FRAGMENT) {
659
+ RETURN_DOM = true;
660
+ }
661
+ /* Parse profile info */
662
+ if (USE_PROFILES) {
663
+ ALLOWED_TAGS = addToSet({}, text);
664
+ ALLOWED_ATTR = create(null);
665
+ if (USE_PROFILES.html === true) {
666
+ addToSet(ALLOWED_TAGS, html$1);
667
+ addToSet(ALLOWED_ATTR, html);
668
+ }
669
+ if (USE_PROFILES.svg === true) {
670
+ addToSet(ALLOWED_TAGS, svg$1);
671
+ addToSet(ALLOWED_ATTR, svg);
672
+ addToSet(ALLOWED_ATTR, xml);
673
+ }
674
+ if (USE_PROFILES.svgFilters === true) {
675
+ addToSet(ALLOWED_TAGS, svgFilters);
676
+ addToSet(ALLOWED_ATTR, svg);
677
+ addToSet(ALLOWED_ATTR, xml);
678
+ }
679
+ if (USE_PROFILES.mathMl === true) {
680
+ addToSet(ALLOWED_TAGS, mathMl$1);
681
+ addToSet(ALLOWED_ATTR, mathMl);
682
+ addToSet(ALLOWED_ATTR, xml);
683
+ }
684
+ }
685
+ /* Always reset function-based ADD_TAGS / ADD_ATTR checks to prevent
686
+ * leaking across calls when switching from function to array config */
687
+ EXTRA_ELEMENT_HANDLING.tagCheck = null;
688
+ EXTRA_ELEMENT_HANDLING.attributeCheck = null;
689
+ /* Merge configuration parameters */
690
+ if (objectHasOwnProperty(cfg, 'ADD_TAGS')) {
691
+ if (typeof cfg.ADD_TAGS === 'function') {
692
+ EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
693
+ } else if (arrayIsArray(cfg.ADD_TAGS)) {
694
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
695
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
696
+ }
697
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
698
+ }
699
+ }
700
+ if (objectHasOwnProperty(cfg, 'ADD_ATTR')) {
701
+ if (typeof cfg.ADD_ATTR === 'function') {
702
+ EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
703
+ } else if (arrayIsArray(cfg.ADD_ATTR)) {
704
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
705
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
706
+ }
707
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
708
+ }
709
+ }
710
+ if (objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') && arrayIsArray(cfg.ADD_URI_SAFE_ATTR)) {
711
+ addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
712
+ }
713
+ if (objectHasOwnProperty(cfg, 'FORBID_CONTENTS') && arrayIsArray(cfg.FORBID_CONTENTS)) {
714
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
715
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
716
+ }
717
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
718
+ }
719
+ if (objectHasOwnProperty(cfg, 'ADD_FORBID_CONTENTS') && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) {
720
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
721
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
722
+ }
723
+ addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
724
+ }
725
+ /* Add #text in case KEEP_CONTENT is set to true */
726
+ if (KEEP_CONTENT) {
727
+ ALLOWED_TAGS['#text'] = true;
728
+ }
729
+ /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
730
+ if (WHOLE_DOCUMENT) {
731
+ addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
732
+ }
733
+ /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
734
+ if (ALLOWED_TAGS.table) {
735
+ addToSet(ALLOWED_TAGS, ['tbody']);
736
+ delete FORBID_TAGS.tbody;
737
+ }
738
+ if (cfg.TRUSTED_TYPES_POLICY) {
739
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {
740
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
741
+ }
742
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {
743
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
744
+ }
745
+ // Overwrite existing TrustedTypes policy.
746
+ trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
747
+ // Sign local variables required by `sanitize`.
748
+ emptyHTML = trustedTypesPolicy.createHTML('');
749
+ } else {
750
+ // Uninitialized policy, attempt to initialize the internal dompurify policy.
751
+ if (trustedTypesPolicy === undefined) {
752
+ trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
753
+ }
754
+ // If creating the internal policy succeeded sign internal variables.
755
+ if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {
756
+ emptyHTML = trustedTypesPolicy.createHTML('');
757
+ }
758
+ }
759
+ // Prevent further manipulation of configuration.
760
+ // Not available in IE8, Safari 5, etc.
761
+ if (freeze) {
762
+ freeze(cfg);
763
+ }
764
+ CONFIG = cfg;
765
+ };
766
+ /* Keep track of all possible SVG and MathML tags
767
+ * so that we can perform the namespace checks
768
+ * correctly. */
769
+ const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
770
+ const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
771
+ /**
772
+ * @param element a DOM element whose namespace is being checked
773
+ * @returns Return false if the element has a
774
+ * namespace that a spec-compliant parser would never
775
+ * return. Return true otherwise.
776
+ */
777
+ const _checkValidNamespace = function _checkValidNamespace(element) {
778
+ let parent = getParentNode(element);
779
+ // In JSDOM, if we're inside shadow DOM, then parentNode
780
+ // can be null. We just simulate parent in this case.
781
+ if (!parent || !parent.tagName) {
782
+ parent = {
783
+ namespaceURI: NAMESPACE,
784
+ tagName: 'template'
785
+ };
786
+ }
787
+ const tagName = stringToLowerCase(element.tagName);
788
+ const parentTagName = stringToLowerCase(parent.tagName);
789
+ if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
790
+ return false;
791
+ }
792
+ if (element.namespaceURI === SVG_NAMESPACE) {
793
+ // The only way to switch from HTML namespace to SVG
794
+ // is via <svg>. If it happens via any other tag, then
795
+ // it should be killed.
796
+ if (parent.namespaceURI === HTML_NAMESPACE) {
797
+ return tagName === 'svg';
798
+ }
799
+ // The only way to switch from MathML to SVG is via`
800
+ // svg if parent is either <annotation-xml> or MathML
801
+ // text integration points.
802
+ if (parent.namespaceURI === MATHML_NAMESPACE) {
803
+ return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
804
+ }
805
+ // We only allow elements that are defined in SVG
806
+ // spec. All others are disallowed in SVG namespace.
807
+ return Boolean(ALL_SVG_TAGS[tagName]);
808
+ }
809
+ if (element.namespaceURI === MATHML_NAMESPACE) {
810
+ // The only way to switch from HTML namespace to MathML
811
+ // is via <math>. If it happens via any other tag, then
812
+ // it should be killed.
813
+ if (parent.namespaceURI === HTML_NAMESPACE) {
814
+ return tagName === 'math';
815
+ }
816
+ // The only way to switch from SVG to MathML is via
817
+ // <math> and HTML integration points
818
+ if (parent.namespaceURI === SVG_NAMESPACE) {
819
+ return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
820
+ }
821
+ // We only allow elements that are defined in MathML
822
+ // spec. All others are disallowed in MathML namespace.
823
+ return Boolean(ALL_MATHML_TAGS[tagName]);
824
+ }
825
+ if (element.namespaceURI === HTML_NAMESPACE) {
826
+ // The only way to switch from SVG to HTML is via
827
+ // HTML integration points, and from MathML to HTML
828
+ // is via MathML text integration points
829
+ if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
830
+ return false;
831
+ }
832
+ if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
833
+ return false;
834
+ }
835
+ // We disallow tags that are specific for MathML
836
+ // or SVG and should never appear in HTML namespace
837
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
838
+ }
839
+ // For XHTML and XML documents that support custom namespaces
840
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {
841
+ return true;
842
+ }
843
+ // The code should never reach this place (this means
844
+ // that the element somehow got namespace that is not
845
+ // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).
846
+ // Return false just in case.
847
+ return false;
848
+ };
849
+ /**
850
+ * _forceRemove
851
+ *
852
+ * @param node a DOM node
853
+ */
854
+ const _forceRemove = function _forceRemove(node) {
855
+ arrayPush(DOMPurify.removed, {
856
+ element: node
857
+ });
858
+ try {
859
+ // eslint-disable-next-line unicorn/prefer-dom-node-remove
860
+ getParentNode(node).removeChild(node);
861
+ } catch (_) {
862
+ remove(node);
863
+ }
864
+ };
865
+ /**
866
+ * _removeAttribute
867
+ *
868
+ * @param name an Attribute name
869
+ * @param element a DOM node
870
+ */
871
+ const _removeAttribute = function _removeAttribute(name, element) {
872
+ try {
873
+ arrayPush(DOMPurify.removed, {
874
+ attribute: element.getAttributeNode(name),
875
+ from: element
876
+ });
877
+ } catch (_) {
878
+ arrayPush(DOMPurify.removed, {
879
+ attribute: null,
880
+ from: element
881
+ });
882
+ }
883
+ element.removeAttribute(name);
884
+ // We void attribute values for unremovable "is" attributes
885
+ if (name === 'is') {
886
+ if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
887
+ try {
888
+ _forceRemove(element);
889
+ } catch (_) {}
890
+ } else {
891
+ try {
892
+ element.setAttribute(name, '');
893
+ } catch (_) {}
894
+ }
895
+ }
896
+ };
897
+ /**
898
+ * _initDocument
899
+ *
900
+ * @param dirty - a string of dirty markup
901
+ * @return a DOM, filled with the dirty markup
902
+ */
903
+ const _initDocument = function _initDocument(dirty) {
904
+ /* Create a HTML document */
905
+ let doc = null;
906
+ let leadingWhitespace = null;
907
+ if (FORCE_BODY) {
908
+ dirty = '<remove></remove>' + dirty;
909
+ } else {
910
+ /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
911
+ const matches = stringMatch(dirty, /^[\r\n\t ]+/);
912
+ leadingWhitespace = matches && matches[0];
913
+ }
914
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {
915
+ // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
916
+ dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
917
+ }
918
+ const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
919
+ /*
920
+ * Use the DOMParser API by default, fallback later if needs be
921
+ * DOMParser not work for svg when has multiple root element.
922
+ */
923
+ if (NAMESPACE === HTML_NAMESPACE) {
924
+ try {
925
+ doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
926
+ } catch (_) {}
927
+ }
928
+ /* Use createHTMLDocument in case DOMParser is not available */
929
+ if (!doc || !doc.documentElement) {
930
+ doc = implementation.createDocument(NAMESPACE, 'template', null);
931
+ try {
932
+ doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
933
+ } catch (_) {
934
+ // Syntax error if dirtyPayload is invalid xml
935
+ }
936
+ }
937
+ const body = doc.body || doc.documentElement;
938
+ if (dirty && leadingWhitespace) {
939
+ body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
940
+ }
941
+ /* Work on whole document or just its body */
942
+ if (NAMESPACE === HTML_NAMESPACE) {
943
+ return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
944
+ }
945
+ return WHOLE_DOCUMENT ? doc.documentElement : body;
946
+ };
947
+ /**
948
+ * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
949
+ *
950
+ * @param root The root element or node to start traversing on.
951
+ * @return The created NodeIterator
952
+ */
953
+ const _createNodeIterator = function _createNodeIterator(root) {
954
+ return createNodeIterator.call(root.ownerDocument || root, root,
955
+ // eslint-disable-next-line no-bitwise
956
+ NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);
957
+ };
958
+ /**
959
+ * _isClobbered
960
+ *
961
+ * @param element element to check for clobbering attacks
962
+ * @return true if clobbered, false if safe
963
+ */
964
+ const _isClobbered = function _isClobbered(element) {
965
+ return element instanceof HTMLFormElement && (typeof element.nodeName !== 'string' || typeof element.textContent !== 'string' || typeof element.removeChild !== 'function' || !(element.attributes instanceof NamedNodeMap) || typeof element.removeAttribute !== 'function' || typeof element.setAttribute !== 'function' || typeof element.namespaceURI !== 'string' || typeof element.insertBefore !== 'function' || typeof element.hasChildNodes !== 'function');
966
+ };
967
+ /**
968
+ * Checks whether the given object is a DOM node.
969
+ *
970
+ * @param value object to check whether it's a DOM node
971
+ * @return true is object is a DOM node
972
+ */
973
+ const _isNode = function _isNode(value) {
974
+ return typeof Node === 'function' && value instanceof Node;
975
+ };
976
+ function _executeHooks(hooks, currentNode, data) {
977
+ arrayForEach(hooks, hook => {
978
+ hook.call(DOMPurify, currentNode, data, CONFIG);
979
+ });
980
+ }
981
+ /**
982
+ * _sanitizeElements
983
+ *
984
+ * @protect nodeName
985
+ * @protect textContent
986
+ * @protect removeChild
987
+ * @param currentNode to check for permission to exist
988
+ * @return true if node was killed, false if left alive
989
+ */
990
+ const _sanitizeElements = function _sanitizeElements(currentNode) {
991
+ let content = null;
992
+ /* Execute a hook if present */
993
+ _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
994
+ /* Check if element is clobbered or can clobber */
995
+ if (_isClobbered(currentNode)) {
996
+ _forceRemove(currentNode);
997
+ return true;
998
+ }
999
+ /* Now let's check the element's type and name */
1000
+ const tagName = transformCaseFunc(currentNode.nodeName);
1001
+ /* Execute a hook if present */
1002
+ _executeHooks(hooks.uponSanitizeElement, currentNode, {
1003
+ tagName,
1004
+ allowedTags: ALLOWED_TAGS
1005
+ });
1006
+ /* Detect mXSS attempts abusing namespace confusion */
1007
+ if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
1008
+ _forceRemove(currentNode);
1009
+ return true;
1010
+ }
1011
+ /* Remove risky CSS construction leading to mXSS */
1012
+ if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === 'style' && _isNode(currentNode.firstElementChild)) {
1013
+ _forceRemove(currentNode);
1014
+ return true;
1015
+ }
1016
+ /* Remove any occurrence of processing instructions */
1017
+ if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
1018
+ _forceRemove(currentNode);
1019
+ return true;
1020
+ }
1021
+ /* Remove any kind of possibly harmful comments */
1022
+ if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
1023
+ _forceRemove(currentNode);
1024
+ return true;
1025
+ }
1026
+ /* Remove element if anything forbids its presence */
1027
+ if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
1028
+ /* Check if we have a custom element to handle */
1029
+ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
1030
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
1031
+ return false;
1032
+ }
1033
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
1034
+ return false;
1035
+ }
1036
+ }
1037
+ /* Keep content except for bad-listed elements */
1038
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
1039
+ const parentNode = getParentNode(currentNode) || currentNode.parentNode;
1040
+ const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
1041
+ if (childNodes && parentNode) {
1042
+ const childCount = childNodes.length;
1043
+ for (let i = childCount - 1; i >= 0; --i) {
1044
+ const childClone = cloneNode(childNodes[i], true);
1045
+ parentNode.insertBefore(childClone, getNextSibling(currentNode));
1046
+ }
1047
+ }
1048
+ }
1049
+ _forceRemove(currentNode);
1050
+ return true;
1051
+ }
1052
+ /* Check whether element has a valid namespace */
1053
+ if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
1054
+ _forceRemove(currentNode);
1055
+ return true;
1056
+ }
1057
+ /* Make sure that older browsers don't get fallback-tag mXSS */
1058
+ if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
1059
+ _forceRemove(currentNode);
1060
+ return true;
1061
+ }
1062
+ /* Sanitize element content to be template-safe */
1063
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
1064
+ /* Get the element's text content */
1065
+ content = currentNode.textContent;
1066
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
1067
+ content = stringReplace(content, expr, ' ');
1068
+ });
1069
+ if (currentNode.textContent !== content) {
1070
+ arrayPush(DOMPurify.removed, {
1071
+ element: currentNode.cloneNode()
1072
+ });
1073
+ currentNode.textContent = content;
1074
+ }
1075
+ }
1076
+ /* Execute a hook if present */
1077
+ _executeHooks(hooks.afterSanitizeElements, currentNode, null);
1078
+ return false;
1079
+ };
1080
+ /**
1081
+ * _isValidAttribute
1082
+ *
1083
+ * @param lcTag Lowercase tag name of containing element.
1084
+ * @param lcName Lowercase attribute name.
1085
+ * @param value Attribute value.
1086
+ * @return Returns true if `value` is valid, otherwise false.
1087
+ */
1088
+ // eslint-disable-next-line complexity
1089
+ const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
1090
+ /* FORBID_ATTR must always win, even if ADD_ATTR predicate would allow it */
1091
+ if (FORBID_ATTR[lcName]) {
1092
+ return false;
1093
+ }
1094
+ /* Make sure attribute cannot clobber */
1095
+ if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
1096
+ return false;
1097
+ }
1098
+ /* Allow valid data-* attributes: At least one character after "-"
1099
+ (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
1100
+ XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
1101
+ We don't need to check the value; it's always URI safe. */
1102
+ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
1103
+ if (
1104
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
1105
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1106
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
1107
+ _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName, lcTag)) ||
1108
+ // Alternative, second condition checks if it's an `is`-attribute, AND
1109
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1110
+ 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 {
1111
+ return false;
1112
+ }
1113
+ /* Check value is safe. First, is attr inert? If so, is safe */
1114
+ } else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if (value) {
1115
+ return false;
1116
+ } else ;
1117
+ return true;
1118
+ };
1119
+ /* Names the HTML spec reserves from valid-custom-element-name; these must
1120
+ * never be treated as basic custom elements even when a permissive
1121
+ * CUSTOM_ELEMENT_HANDLING.tagNameCheck is configured. */
1122
+ const RESERVED_CUSTOM_ELEMENT_NAMES = addToSet({}, ['annotation-xml', 'color-profile', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'missing-glyph']);
1123
+ /**
1124
+ * _isBasicCustomElement
1125
+ * checks if at least one dash is included in tagName, and it's not the first char
1126
+ * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
1127
+ *
1128
+ * @param tagName name of the tag of the node to sanitize
1129
+ * @returns Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
1130
+ */
1131
+ const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
1132
+ return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT, tagName);
1133
+ };
1134
+ /**
1135
+ * _sanitizeAttributes
1136
+ *
1137
+ * @protect attributes
1138
+ * @protect nodeName
1139
+ * @protect removeAttribute
1140
+ * @protect setAttribute
1141
+ *
1142
+ * @param currentNode to sanitize
1143
+ */
1144
+ const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
1145
+ /* Execute a hook if present */
1146
+ _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
1147
+ const {
1148
+ attributes
1149
+ } = currentNode;
1150
+ /* Check if we have attributes; if not we might have a text node */
1151
+ if (!attributes || _isClobbered(currentNode)) {
1152
+ return;
1153
+ }
1154
+ const hookEvent = {
1155
+ attrName: '',
1156
+ attrValue: '',
1157
+ keepAttr: true,
1158
+ allowedAttributes: ALLOWED_ATTR,
1159
+ forceKeepAttr: undefined
1160
+ };
1161
+ let l = attributes.length;
1162
+ /* Go backwards over all attributes; safely remove bad ones */
1163
+ while (l--) {
1164
+ const attr = attributes[l];
1165
+ const {
1166
+ name,
1167
+ namespaceURI,
1168
+ value: attrValue
1169
+ } = attr;
1170
+ const lcName = transformCaseFunc(name);
1171
+ const initValue = attrValue;
1172
+ let value = name === 'value' ? initValue : stringTrim(initValue);
1173
+ /* Execute a hook if present */
1174
+ hookEvent.attrName = lcName;
1175
+ hookEvent.attrValue = value;
1176
+ hookEvent.keepAttr = true;
1177
+ hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
1178
+ _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
1179
+ value = hookEvent.attrValue;
1180
+ /* Full DOM Clobbering protection via namespace isolation,
1181
+ * Prefix id and name attributes with `user-content-`
1182
+ */
1183
+ if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name') && stringIndexOf(value, SANITIZE_NAMED_PROPS_PREFIX) !== 0) {
1184
+ // Remove the attribute with this value
1185
+ _removeAttribute(name, currentNode);
1186
+ // Prefix the value and later re-create the attribute with the sanitized value
1187
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
1188
+ }
1189
+ // Else: already prefixed, leave the attribute alone — the prefix is
1190
+ // itself the clobbering protection, and re-applying it is incorrect.
1191
+ /* Work around a security issue with comments inside attributes */
1192
+ if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) {
1193
+ _removeAttribute(name, currentNode);
1194
+ continue;
1195
+ }
1196
+ /* Make sure we cannot easily use animated hrefs, even if animations are allowed */
1197
+ if (lcName === 'attributename' && stringMatch(value, 'href')) {
1198
+ _removeAttribute(name, currentNode);
1199
+ continue;
1200
+ }
1201
+ /* Did the hooks approve of the attribute? */
1202
+ if (hookEvent.forceKeepAttr) {
1203
+ continue;
1204
+ }
1205
+ /* Did the hooks approve of the attribute? */
1206
+ if (!hookEvent.keepAttr) {
1207
+ _removeAttribute(name, currentNode);
1208
+ continue;
1209
+ }
1210
+ /* Work around a security issue in jQuery 3.0 */
1211
+ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
1212
+ _removeAttribute(name, currentNode);
1213
+ continue;
1214
+ }
1215
+ /* Sanitize attribute content to be template-safe */
1216
+ if (SAFE_FOR_TEMPLATES) {
1217
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
1218
+ value = stringReplace(value, expr, ' ');
1219
+ });
1220
+ }
1221
+ /* Is `value` valid for this attribute? */
1222
+ const lcTag = transformCaseFunc(currentNode.nodeName);
1223
+ if (!_isValidAttribute(lcTag, lcName, value)) {
1224
+ _removeAttribute(name, currentNode);
1225
+ continue;
1226
+ }
1227
+ /* Handle attributes that require Trusted Types */
1228
+ if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {
1229
+ if (namespaceURI) ; else {
1230
+ switch (trustedTypes.getAttributeType(lcTag, lcName)) {
1231
+ case 'TrustedHTML':
1232
+ {
1233
+ value = trustedTypesPolicy.createHTML(value);
1234
+ break;
1235
+ }
1236
+ case 'TrustedScriptURL':
1237
+ {
1238
+ value = trustedTypesPolicy.createScriptURL(value);
1239
+ break;
1240
+ }
1241
+ }
1242
+ }
1243
+ }
1244
+ /* Handle invalid data-* attribute set by try-catching it */
1245
+ if (value !== initValue) {
1246
+ try {
1247
+ if (namespaceURI) {
1248
+ currentNode.setAttributeNS(namespaceURI, name, value);
1249
+ } else {
1250
+ /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
1251
+ currentNode.setAttribute(name, value);
1252
+ }
1253
+ if (_isClobbered(currentNode)) {
1254
+ _forceRemove(currentNode);
1255
+ } else {
1256
+ arrayPop(DOMPurify.removed);
1257
+ }
1258
+ } catch (_) {
1259
+ _removeAttribute(name, currentNode);
1260
+ }
1261
+ }
1262
+ }
1263
+ /* Execute a hook if present */
1264
+ _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
1265
+ };
1266
+ /**
1267
+ * _sanitizeShadowDOM
1268
+ *
1269
+ * @param fragment to iterate over recursively
1270
+ */
1271
+ const _sanitizeShadowDOM2 = function _sanitizeShadowDOM(fragment) {
1272
+ let shadowNode = null;
1273
+ const shadowIterator = _createNodeIterator(fragment);
1274
+ /* Execute a hook if present */
1275
+ _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
1276
+ while (shadowNode = shadowIterator.nextNode()) {
1277
+ /* Execute a hook if present */
1278
+ _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
1279
+ /* Sanitize tags and elements */
1280
+ _sanitizeElements(shadowNode);
1281
+ /* Check attributes next */
1282
+ _sanitizeAttributes(shadowNode);
1283
+ /* Deep shadow DOM detected */
1284
+ if (shadowNode.content instanceof DocumentFragment) {
1285
+ _sanitizeShadowDOM2(shadowNode.content);
1286
+ }
1287
+ }
1288
+ /* Execute a hook if present */
1289
+ _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
1290
+ };
1291
+ // eslint-disable-next-line complexity
1292
+ DOMPurify.sanitize = function (dirty) {
1293
+ let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1294
+ let body = null;
1295
+ let importedNode = null;
1296
+ let currentNode = null;
1297
+ let returnNode = null;
1298
+ /* Make sure we have a string to sanitize.
1299
+ DO NOT return early, as this will return the wrong type if
1300
+ the user has requested a DOM object rather than a string */
1301
+ IS_EMPTY_INPUT = !dirty;
1302
+ if (IS_EMPTY_INPUT) {
1303
+ dirty = '<!-->';
1304
+ }
1305
+ /* Stringify, in case dirty is an object */
1306
+ if (typeof dirty !== 'string' && !_isNode(dirty)) {
1307
+ dirty = stringifyValue(dirty);
1308
+ if (typeof dirty !== 'string') {
1309
+ throw typeErrorCreate('dirty is not a string, aborting');
1310
+ }
1311
+ }
1312
+ /* Return dirty HTML if DOMPurify cannot run */
1313
+ if (!DOMPurify.isSupported) {
1314
+ return dirty;
1315
+ }
1316
+ /* Assign config vars */
1317
+ if (!SET_CONFIG) {
1318
+ _parseConfig(cfg);
1319
+ }
1320
+ /* Clean up removed elements */
1321
+ DOMPurify.removed = [];
1322
+ /* Check if dirty is correctly typed for IN_PLACE */
1323
+ if (typeof dirty === 'string') {
1324
+ IN_PLACE = false;
1325
+ }
1326
+ if (IN_PLACE) {
1327
+ /* Do some early pre-sanitization to avoid unsafe root nodes */
1328
+ const nn = dirty.nodeName;
1329
+ if (typeof nn === 'string') {
1330
+ const tagName = transformCaseFunc(nn);
1331
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
1332
+ throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
1333
+ }
1334
+ }
1335
+ } else if (dirty instanceof Node) {
1336
+ /* If dirty is a DOM element, append to an empty document to avoid
1337
+ elements being stripped by the parser */
1338
+ body = _initDocument('<!---->');
1339
+ importedNode = body.ownerDocument.importNode(dirty, true);
1340
+ if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === 'BODY') {
1341
+ /* Node is already a body, use as is */
1342
+ body = importedNode;
1343
+ } else if (importedNode.nodeName === 'HTML') {
1344
+ body = importedNode;
1345
+ } else {
1346
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
1347
+ body.appendChild(importedNode);
1348
+ }
1349
+ } else {
1350
+ /* Exit directly if we have nothing to do */
1351
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT &&
1352
+ // eslint-disable-next-line unicorn/prefer-includes
1353
+ dirty.indexOf('<') === -1) {
1354
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
1355
+ }
1356
+ /* Initialize the document to work on */
1357
+ body = _initDocument(dirty);
1358
+ /* Check we have a DOM node from the data */
1359
+ if (!body) {
1360
+ return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';
1361
+ }
1362
+ }
1363
+ /* Remove first element node (ours) if FORCE_BODY is set */
1364
+ if (body && FORCE_BODY) {
1365
+ _forceRemove(body.firstChild);
1366
+ }
1367
+ /* Get node iterator */
1368
+ const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
1369
+ /* Now start iterating over the created document */
1370
+ while (currentNode = nodeIterator.nextNode()) {
1371
+ /* Sanitize tags and elements */
1372
+ _sanitizeElements(currentNode);
1373
+ /* Check attributes next */
1374
+ _sanitizeAttributes(currentNode);
1375
+ /* Shadow DOM detected, sanitize it */
1376
+ if (currentNode.content instanceof DocumentFragment) {
1377
+ _sanitizeShadowDOM2(currentNode.content);
1378
+ }
1379
+ }
1380
+ /* If we sanitized `dirty` in-place, return it. */
1381
+ if (IN_PLACE) {
1382
+ return dirty;
1383
+ }
1384
+ /* Return sanitized string or DOM */
1385
+ if (RETURN_DOM) {
1386
+ if (SAFE_FOR_TEMPLATES) {
1387
+ body.normalize();
1388
+ let html = body.innerHTML;
1389
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
1390
+ html = stringReplace(html, expr, ' ');
1391
+ });
1392
+ body.innerHTML = html;
1393
+ }
1394
+ if (RETURN_DOM_FRAGMENT) {
1395
+ returnNode = createDocumentFragment.call(body.ownerDocument);
1396
+ while (body.firstChild) {
1397
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
1398
+ returnNode.appendChild(body.firstChild);
1399
+ }
1400
+ } else {
1401
+ returnNode = body;
1402
+ }
1403
+ if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
1404
+ /*
1405
+ AdoptNode() is not used because internal state is not reset
1406
+ (e.g. the past names map of a HTMLFormElement), this is safe
1407
+ in theory but we would rather not risk another attack vector.
1408
+ The state that is cloned by importNode() is explicitly defined
1409
+ by the specs.
1410
+ */
1411
+ returnNode = importNode.call(originalDocument, returnNode, true);
1412
+ }
1413
+ return returnNode;
1414
+ }
1415
+ let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
1416
+ /* Serialize doctype if allowed */
1417
+ if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
1418
+ serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML;
1419
+ }
1420
+ /* Sanitize final string template-safe */
1421
+ if (SAFE_FOR_TEMPLATES) {
1422
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
1423
+ serializedHTML = stringReplace(serializedHTML, expr, ' ');
1424
+ });
1425
+ }
1426
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
1427
+ };
1428
+ DOMPurify.setConfig = function () {
1429
+ let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1430
+ _parseConfig(cfg);
1431
+ SET_CONFIG = true;
1432
+ };
1433
+ DOMPurify.clearConfig = function () {
1434
+ CONFIG = null;
1435
+ SET_CONFIG = false;
1436
+ };
1437
+ DOMPurify.isValidAttribute = function (tag, attr, value) {
1438
+ /* Initialize shared config vars if necessary. */
1439
+ if (!CONFIG) {
1440
+ _parseConfig({});
1441
+ }
1442
+ const lcTag = transformCaseFunc(tag);
1443
+ const lcName = transformCaseFunc(attr);
1444
+ return _isValidAttribute(lcTag, lcName, value);
1445
+ };
1446
+ DOMPurify.addHook = function (entryPoint, hookFunction) {
1447
+ if (typeof hookFunction !== 'function') {
1448
+ return;
1449
+ }
1450
+ arrayPush(hooks[entryPoint], hookFunction);
1451
+ };
1452
+ DOMPurify.removeHook = function (entryPoint, hookFunction) {
1453
+ if (hookFunction !== undefined) {
1454
+ const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
1455
+ return index === -1 ? undefined : arraySplice(hooks[entryPoint], index, 1)[0];
1456
+ }
1457
+ return arrayPop(hooks[entryPoint]);
1458
+ };
1459
+ DOMPurify.removeHooks = function (entryPoint) {
1460
+ hooks[entryPoint] = [];
1461
+ };
1462
+ DOMPurify.removeAllHooks = function () {
1463
+ hooks = _createHooksMap();
1464
+ };
1465
+ return DOMPurify;
1466
+ }
1467
+ var purify = createDOMPurify();
1468
+
1469
+ export { purify as default };
1470
+ //# sourceMappingURL=purify.es.mjs.map