@heartlandone/vega 2.102.0 → 2.103.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (387) hide show
  1. package/dist/cjs/{app-globals-49c2a999.js → app-globals-85986306.js} +10 -10
  2. package/dist/cjs/{code-block-06e6591f.js → code-block-72de6c4d.js} +80 -1
  3. package/dist/cjs/{component-value-history-controller-slimmer.abstract-f29908f8.js → component-value-history-controller-slimmer.abstract-23d2b3d8.js} +3 -3
  4. package/dist/cjs/{content-state-8c862e5e.js → content-state-ff40bdc6.js} +38 -5
  5. package/dist/cjs/{date-required-rule-b672c432.js → date-required-rule-608e704b.js} +1 -1
  6. package/dist/cjs/{design-token-351ffd2c.js → design-token-a101a8d0.js} +3 -3
  7. package/dist/cjs/{element-appender-slimmer-f932b166.js → element-appender-slimmer-b93cc564.js} +2 -2
  8. package/dist/cjs/{form-field-controller-slimmer-5adb86ae.js → form-field-controller-slimmer-124d54ea.js} +1 -1
  9. package/dist/cjs/{image-annotation-action-25907d6b.js → image-annotation-action-1ee41bc7.js} +2 -2
  10. package/dist/cjs/{image-extension-1cf84f27.js → image-extension-6a92c524.js} +247 -5
  11. package/dist/cjs/index.cjs.js +17 -17
  12. package/dist/cjs/{inject-keyboard-manager-84d33920.js → inject-keyboard-manager-32d7dd0e.js} +1 -1
  13. package/dist/cjs/{internal-calendar-period-factory-3c5236be.js → internal-calendar-period-factory-c3198ea7.js} +1 -1
  14. package/dist/cjs/{internal-translation-controller-eae8a8de.js → internal-translation-controller-0d67ca4d.js} +1 -0
  15. package/dist/cjs/{keyboard-manager-baa83a61.js → keyboard-manager-332eec89.js} +1 -1
  16. package/dist/cjs/{keyboard-manager-slimmer-d1974b28.js → keyboard-manager-slimmer-a2872981.js} +1 -1
  17. package/dist/cjs/{link-extension-2a6133b7.js → link-extension-1b4ed437.js} +3 -3
  18. package/dist/cjs/loader.cjs.js +12 -12
  19. package/dist/cjs/{month-view-generator-a6827548.js → month-view-generator-b6a2b8be.js} +1 -1
  20. package/dist/cjs/{public-rules-7f26e0ae.js → public-rules-2066613c.js} +7 -7
  21. package/dist/cjs/{range-518b95a2.js → range-712fe703.js} +1 -1
  22. package/dist/cjs/{responsive-format-facade-95c54444.js → responsive-format-facade-44d33457.js} +1 -1
  23. package/dist/cjs/{rich-text-editor-required-rule-5d0c76ec.js → rich-text-editor-required-rule-1aa75d22.js} +1 -1
  24. package/dist/cjs/{split-cell-operation-28f6f8d9.js → split-cell-operation-afc82323.js} +3 -3
  25. package/dist/cjs/{state-border-formatter-6c284859.js → state-border-formatter-49984fd6.js} +1 -1
  26. package/dist/cjs/{string-format-strategy.abstract-f15b6196.js → string-format-strategy.abstract-bd563c01.js} +1 -1
  27. package/dist/cjs/{string-input-formatter-slimmer-5a3f1b55.js → string-input-formatter-slimmer-4faebac9.js} +1 -1
  28. package/dist/cjs/{string-mask-strategy-af6f3ba0.js → string-mask-strategy-624c4398.js} +2 -2
  29. package/dist/cjs/{style-formatter-324211fd.js → style-formatter-151d89a3.js} +2 -2
  30. package/dist/cjs/{time-required-rule-9e714442.js → time-required-rule-8cd8f9b9.js} +1 -1
  31. package/dist/cjs/{token-extension-86723cad.js → token-extension-72d0cb08.js} +1011 -767
  32. package/dist/cjs/{translation-slimmer-0227ee24.js → translation-slimmer-1771d01f.js} +1 -1
  33. package/dist/cjs/{type-guard-29e01bd4.js → type-guard-cce6fe1f.js} +1 -1
  34. package/dist/cjs/{valid-credit-card-number-rule-4ec364af.js → valid-credit-card-number-rule-b13c2fc4.js} +1 -1
  35. package/dist/cjs/vega-accordion.cjs.entry.js +6 -6
  36. package/dist/cjs/vega-app-header-button.cjs.entry.js +5 -5
  37. package/dist/cjs/vega-box.cjs.entry.js +6 -6
  38. package/dist/cjs/vega-button-circle.cjs.entry.js +5 -5
  39. package/dist/cjs/vega-button.cjs.entry.js +3 -3
  40. package/dist/cjs/vega-calendar_5.cjs.entry.js +7 -7
  41. package/dist/cjs/vega-card.cjs.entry.js +5 -5
  42. package/dist/cjs/vega-carousel.cjs.entry.js +3 -3
  43. package/dist/cjs/vega-checkbox_2.cjs.entry.js +2 -2
  44. package/dist/cjs/vega-chip.cjs.entry.js +5 -5
  45. package/dist/cjs/vega-code-block.cjs.entry.js +8 -8
  46. package/dist/cjs/vega-color-picker.cjs.entry.js +2 -2
  47. package/dist/cjs/vega-color-swatch-picker.cjs.entry.js +3 -3
  48. package/dist/cjs/vega-color-swatch.cjs.entry.js +2 -2
  49. package/dist/cjs/vega-combo-box.cjs.entry.js +8 -8
  50. package/dist/cjs/vega-date-picker_2.cjs.entry.js +13 -13
  51. package/dist/cjs/vega-dialog_2.cjs.entry.js +3 -3
  52. package/dist/cjs/vega-divider.cjs.entry.js +5 -5
  53. package/dist/cjs/vega-dropdown_5.cjs.entry.js +7 -7
  54. package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
  55. package/dist/cjs/vega-field-label.cjs.entry.js +2 -2
  56. package/dist/cjs/vega-file-uploader.cjs.entry.js +3 -3
  57. package/dist/cjs/vega-flag-icon.cjs.entry.js +5 -5
  58. package/dist/cjs/vega-flex.cjs.entry.js +6 -6
  59. package/dist/cjs/vega-font.cjs.entry.js +5 -5
  60. package/dist/cjs/vega-form.cjs.entry.js +2 -2
  61. package/dist/cjs/vega-grid.cjs.entry.js +5 -5
  62. package/dist/cjs/vega-icon.cjs.entry.js +5 -5
  63. package/dist/cjs/vega-image-uploader.cjs.entry.js +5 -5
  64. package/dist/cjs/vega-input-credit-card.cjs.entry.js +6 -6
  65. package/dist/cjs/vega-input-numeric.cjs.entry.js +12 -14
  66. package/dist/cjs/vega-input-passcode.cjs.entry.js +5 -5
  67. package/dist/cjs/vega-input-phone-number.cjs.entry.js +4 -4
  68. package/dist/cjs/vega-input-range.cjs.entry.js +3 -3
  69. package/dist/cjs/vega-input-select.cjs.entry.js +5 -5
  70. package/dist/cjs/vega-input.cjs.entry.js +31 -27
  71. package/dist/cjs/vega-left-nav_5.cjs.entry.js +7 -7
  72. package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +3 -3
  73. package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +2 -2
  74. package/dist/cjs/vega-pagination.cjs.entry.js +4 -4
  75. package/dist/cjs/vega-popover_2.cjs.entry.js +8 -8
  76. package/dist/cjs/vega-progress-tracker_2.cjs.entry.js +3 -3
  77. package/dist/cjs/vega-radio_2.cjs.entry.js +5 -5
  78. package/dist/cjs/vega-rich-text-bookmark-editor.cjs.entry.js +2 -2
  79. package/dist/cjs/vega-rich-text-content.cjs.entry.js +6 -6
  80. package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +474 -207
  81. package/dist/cjs/vega-rich-text-find-replace-panel.cjs.entry.js +1 -1
  82. package/dist/cjs/vega-rich-text-special-characters-panel.cjs.entry.js +5 -5
  83. package/dist/cjs/vega-rich-text-table-properties_3.cjs.entry.js +8 -8
  84. package/dist/cjs/vega-selection-chip_2.cjs.entry.js +4 -4
  85. package/dist/cjs/vega-selection-tile_2.cjs.entry.js +2 -2
  86. package/dist/cjs/vega-sidenav_3.cjs.entry.js +3 -3
  87. package/dist/cjs/vega-signature-capture.cjs.entry.js +7 -7
  88. package/dist/cjs/vega-stepper.cjs.entry.js +2 -2
  89. package/dist/cjs/vega-tab-group_2.cjs.entry.js +6 -6
  90. package/dist/cjs/vega-table_11.cjs.entry.js +4 -4
  91. package/dist/cjs/vega-textarea.cjs.entry.js +2 -2
  92. package/dist/cjs/vega-time-picker_2.cjs.entry.js +9 -9
  93. package/dist/cjs/vega-toggle-switch.cjs.entry.js +2 -2
  94. package/dist/cjs/vega-tooltip_2.cjs.entry.js +6 -6
  95. package/dist/cjs/vega.cjs.js +12 -12
  96. package/dist/collection/components/vega-input/slimmers/controllers/vega-input-state-controller.js +0 -14
  97. package/dist/collection/components/vega-input/slimmers/renderers/vega-input-input-container-renderer.js +11 -2
  98. package/dist/collection/components/vega-input/slimmers/renderers/vega-input-input-renderer.js +11 -1
  99. package/dist/collection/components/vega-input/vega-input.js +52 -8
  100. package/dist/collection/components/vega-input-numeric/slimmers/renderers/vega-input-numeric-renderer.js +7 -1
  101. package/dist/collection/components/vega-input-numeric/vega-input-numeric.js +0 -8
  102. package/dist/collection/components/vega-rich-text-editor/constants/constant.js +4 -0
  103. package/dist/collection/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/sequential-composition-strategy.js +31 -0
  104. package/dist/collection/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.js +1 -0
  105. package/dist/collection/components/vega-rich-text-editor/dto/actions/sequential-composition-action.js +14 -0
  106. package/dist/collection/components/vega-rich-text-editor/dto/content-state.js +4 -1
  107. package/dist/collection/components/vega-rich-text-editor/dto/flush-changes-payload.js +1 -0
  108. package/dist/collection/components/vega-rich-text-editor/dto/nodes/image-node.js +3 -2
  109. package/dist/collection/components/vega-rich-text-editor/extensions/functions/dto/function-block.js +30 -0
  110. package/dist/collection/components/vega-rich-text-editor/extensions/functions/element-to-dto-strategies/div-to-function-block-strategy.js +1 -0
  111. package/dist/collection/components/vega-rich-text-editor/extensions/paste/controllers/chooser-positioner.js +107 -0
  112. package/dist/collection/components/vega-rich-text-editor/extensions/paste/controllers/paste-chooser-controller.js +91 -0
  113. package/dist/collection/components/vega-rich-text-editor/extensions/paste/controllers/paste-event-interceptor.js +47 -0
  114. package/dist/collection/components/vega-rich-text-editor/extensions/paste/controllers/selection-snapshot-service.js +54 -0
  115. package/dist/collection/components/vega-rich-text-editor/extensions/paste/parse-local-images-helper/image-extractor.js +17 -0
  116. package/dist/collection/components/vega-rich-text-editor/extensions/paste/paste-chooser-ui.js +3 -1
  117. package/dist/collection/components/vega-rich-text-editor/extensions/paste/paste-extension.js +41 -354
  118. package/dist/collection/components/vega-rich-text-editor/extensions/paste/pipeline/data-transfer-builder.js +36 -0
  119. package/dist/collection/components/vega-rich-text-editor/extensions/paste/pipeline/paste-dispatcher.js +23 -0
  120. package/dist/collection/components/vega-rich-text-editor/extensions/paste/pipeline/paste-processing-pipeline.js +30 -0
  121. package/dist/collection/components/vega-rich-text-editor/extensions/paste/strategies/paste-processing-strategy.abstract.js +34 -0
  122. package/dist/collection/components/vega-rich-text-editor/extensions/paste/strategies/paste-strategy-selector.js +19 -0
  123. package/dist/collection/components/vega-rich-text-editor/extensions/paste/strategies/plain-paste-strategy.js +74 -0
  124. package/dist/collection/components/vega-rich-text-editor/extensions/paste/type.js +1 -0
  125. package/dist/collection/components/vega-rich-text-editor/helpers/utils.js +67 -0
  126. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/abstract-delete-content-handler.js +67 -11
  127. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/backward-delete-content-handler.js +4 -17
  128. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/base-handler.js +34 -1
  129. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/forward-delete-content-handler.js +13 -32
  130. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-line-break-handler.js +60 -25
  131. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paragraph-handler.js +55 -19
  132. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.js +165 -59
  133. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-text-handler.js +55 -21
  134. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.js +2 -16
  135. package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/value-controller.js +11 -1
  136. package/dist/collection/components/vega-rich-text-editor/utils/html-to-plain-text-utils.js +240 -0
  137. package/dist/collection/helpers/translation/locales/en.js +1 -0
  138. package/dist/esm/{app-globals-da5c83c2.js → app-globals-8cdfc5c9.js} +10 -10
  139. package/dist/esm/{code-block-d8f83d85.js → code-block-9360c331.js} +74 -2
  140. package/dist/esm/{component-value-history-controller-slimmer.abstract-642e7147.js → component-value-history-controller-slimmer.abstract-9ea58806.js} +3 -3
  141. package/dist/esm/{content-state-486eae1d.js → content-state-67a12e74.js} +38 -5
  142. package/dist/esm/{date-required-rule-08695d25.js → date-required-rule-66b5bf02.js} +1 -1
  143. package/dist/esm/{design-token-df3331d9.js → design-token-acd1efeb.js} +3 -3
  144. package/dist/esm/{element-appender-slimmer-f02a227f.js → element-appender-slimmer-7e5bc1e9.js} +2 -2
  145. package/dist/esm/{form-field-controller-slimmer-a7c0a0f8.js → form-field-controller-slimmer-d653c494.js} +1 -1
  146. package/dist/esm/{image-annotation-action-df744ba5.js → image-annotation-action-9525be48.js} +2 -2
  147. package/dist/esm/{image-extension-20b39140.js → image-extension-aea75132.js} +246 -6
  148. package/dist/esm/index.js +17 -17
  149. package/dist/esm/{inject-keyboard-manager-399ed867.js → inject-keyboard-manager-f6522d2f.js} +1 -1
  150. package/dist/esm/{internal-calendar-period-factory-7b866c3b.js → internal-calendar-period-factory-261df2f2.js} +1 -1
  151. package/dist/esm/{internal-translation-controller-4a7ee4d5.js → internal-translation-controller-3637e47e.js} +1 -0
  152. package/dist/esm/{keyboard-manager-f5d13a34.js → keyboard-manager-53e8d8d0.js} +1 -1
  153. package/dist/esm/{keyboard-manager-slimmer-f40dcb54.js → keyboard-manager-slimmer-b3de042d.js} +1 -1
  154. package/dist/esm/{link-extension-3f93d70d.js → link-extension-57ba9520.js} +3 -3
  155. package/dist/esm/loader.js +12 -12
  156. package/dist/esm/{month-view-generator-0c665987.js → month-view-generator-15215a09.js} +1 -1
  157. package/dist/esm/{public-rules-470a1dac.js → public-rules-c77a1550.js} +7 -7
  158. package/dist/esm/{range-8e89fb54.js → range-3c74e1c8.js} +1 -1
  159. package/dist/esm/{responsive-format-facade-55131a33.js → responsive-format-facade-1b325d06.js} +1 -1
  160. package/dist/esm/{rich-text-editor-required-rule-06caf383.js → rich-text-editor-required-rule-cfd32ba2.js} +1 -1
  161. package/dist/esm/{split-cell-operation-e158366a.js → split-cell-operation-85a036f9.js} +3 -3
  162. package/dist/esm/{state-border-formatter-2b73fa08.js → state-border-formatter-ce3495b0.js} +1 -1
  163. package/dist/esm/{string-format-strategy.abstract-8c7937e3.js → string-format-strategy.abstract-8ce04558.js} +1 -1
  164. package/dist/esm/{string-input-formatter-slimmer-681c6b71.js → string-input-formatter-slimmer-0d60ba7d.js} +1 -1
  165. package/dist/esm/{string-mask-strategy-b8cceee6.js → string-mask-strategy-cabc1d50.js} +2 -2
  166. package/dist/esm/{style-formatter-fcd70869.js → style-formatter-00fe4f1c.js} +2 -2
  167. package/dist/esm/{time-required-rule-ce50859b.js → time-required-rule-57ceeae9.js} +1 -1
  168. package/dist/esm/{token-extension-2401e753.js → token-extension-645a9520.js} +1011 -767
  169. package/dist/esm/{translation-slimmer-b3f3cf65.js → translation-slimmer-b69057eb.js} +1 -1
  170. package/dist/esm/{type-guard-08c82e08.js → type-guard-204094c6.js} +1 -1
  171. package/dist/esm/{valid-credit-card-number-rule-66bad519.js → valid-credit-card-number-rule-0874e19f.js} +1 -1
  172. package/dist/esm/vega-accordion.entry.js +6 -6
  173. package/dist/esm/vega-app-header-button.entry.js +5 -5
  174. package/dist/esm/vega-box.entry.js +6 -6
  175. package/dist/esm/vega-button-circle.entry.js +5 -5
  176. package/dist/esm/vega-button.entry.js +3 -3
  177. package/dist/esm/vega-calendar_5.entry.js +7 -7
  178. package/dist/esm/vega-card.entry.js +5 -5
  179. package/dist/esm/vega-carousel.entry.js +3 -3
  180. package/dist/esm/vega-checkbox_2.entry.js +2 -2
  181. package/dist/esm/vega-chip.entry.js +5 -5
  182. package/dist/esm/vega-code-block.entry.js +8 -8
  183. package/dist/esm/vega-color-picker.entry.js +2 -2
  184. package/dist/esm/vega-color-swatch-picker.entry.js +3 -3
  185. package/dist/esm/vega-color-swatch.entry.js +2 -2
  186. package/dist/esm/vega-combo-box.entry.js +8 -8
  187. package/dist/esm/vega-date-picker_2.entry.js +13 -13
  188. package/dist/esm/vega-dialog_2.entry.js +3 -3
  189. package/dist/esm/vega-divider.entry.js +5 -5
  190. package/dist/esm/vega-dropdown_5.entry.js +7 -7
  191. package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
  192. package/dist/esm/vega-field-label.entry.js +2 -2
  193. package/dist/esm/vega-file-uploader.entry.js +3 -3
  194. package/dist/esm/vega-flag-icon.entry.js +5 -5
  195. package/dist/esm/vega-flex.entry.js +6 -6
  196. package/dist/esm/vega-font.entry.js +5 -5
  197. package/dist/esm/vega-form.entry.js +2 -2
  198. package/dist/esm/vega-grid.entry.js +5 -5
  199. package/dist/esm/vega-icon.entry.js +5 -5
  200. package/dist/esm/vega-image-uploader.entry.js +5 -5
  201. package/dist/esm/vega-input-credit-card.entry.js +6 -6
  202. package/dist/esm/vega-input-numeric.entry.js +12 -14
  203. package/dist/esm/vega-input-passcode.entry.js +5 -5
  204. package/dist/esm/vega-input-phone-number.entry.js +4 -4
  205. package/dist/esm/vega-input-range.entry.js +3 -3
  206. package/dist/esm/vega-input-select.entry.js +5 -5
  207. package/dist/esm/vega-input.entry.js +31 -27
  208. package/dist/esm/vega-left-nav_5.entry.js +7 -7
  209. package/dist/esm/vega-loader-wrapper_2.entry.js +3 -3
  210. package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +2 -2
  211. package/dist/esm/vega-pagination.entry.js +4 -4
  212. package/dist/esm/vega-popover_2.entry.js +8 -8
  213. package/dist/esm/vega-progress-tracker_2.entry.js +3 -3
  214. package/dist/esm/vega-radio_2.entry.js +5 -5
  215. package/dist/esm/vega-rich-text-bookmark-editor.entry.js +2 -2
  216. package/dist/esm/vega-rich-text-content.entry.js +6 -6
  217. package/dist/esm/vega-rich-text-editor_4.entry.js +474 -207
  218. package/dist/esm/vega-rich-text-find-replace-panel.entry.js +1 -1
  219. package/dist/esm/vega-rich-text-special-characters-panel.entry.js +5 -5
  220. package/dist/esm/vega-rich-text-table-properties_3.entry.js +8 -8
  221. package/dist/esm/vega-selection-chip_2.entry.js +4 -4
  222. package/dist/esm/vega-selection-tile_2.entry.js +2 -2
  223. package/dist/esm/vega-sidenav_3.entry.js +3 -3
  224. package/dist/esm/vega-signature-capture.entry.js +7 -7
  225. package/dist/esm/vega-stepper.entry.js +2 -2
  226. package/dist/esm/vega-tab-group_2.entry.js +6 -6
  227. package/dist/esm/vega-table_11.entry.js +4 -4
  228. package/dist/esm/vega-textarea.entry.js +2 -2
  229. package/dist/esm/vega-time-picker_2.entry.js +9 -9
  230. package/dist/esm/vega-toggle-switch.entry.js +2 -2
  231. package/dist/esm/vega-tooltip_2.entry.js +6 -6
  232. package/dist/esm/vega.js +12 -12
  233. package/dist/sri/vega-sri-manifest.json +321 -321
  234. package/dist/types/components/vega-input/slimmers/controllers/vega-input-state-controller.d.ts +0 -2
  235. package/dist/types/components/vega-input/slimmers/renderers/vega-input-input-container-renderer.d.ts +4 -0
  236. package/dist/types/components/vega-input/slimmers/renderers/vega-input-input-renderer.d.ts +2 -0
  237. package/dist/types/components/vega-input/vega-input.d.ts +15 -3
  238. package/dist/types/components/vega-input-numeric/slimmers/renderers/vega-input-numeric-renderer.d.ts +2 -0
  239. package/dist/types/components/vega-input-numeric/vega-input-numeric.d.ts +0 -2
  240. package/dist/types/components/vega-rich-text-editor/constants/constant.d.ts +4 -0
  241. package/dist/types/components/vega-rich-text-editor/dto/action-handle-strategies/modify-content-strategies/sequential-composition-strategy.d.ts +14 -0
  242. package/dist/types/components/vega-rich-text-editor/dto/actions/modify-content-action.abstract.d.ts +4 -1
  243. package/dist/types/components/vega-rich-text-editor/dto/actions/sequential-composition-action.d.ts +30 -0
  244. package/dist/types/components/vega-rich-text-editor/dto/flush-changes-payload.d.ts +16 -0
  245. package/dist/types/components/vega-rich-text-editor/extensions/functions/dto/function-block.d.ts +7 -0
  246. package/dist/types/components/vega-rich-text-editor/extensions/paste/controllers/chooser-positioner.d.ts +33 -0
  247. package/dist/types/components/vega-rich-text-editor/extensions/paste/controllers/paste-chooser-controller.d.ts +43 -0
  248. package/dist/types/components/vega-rich-text-editor/extensions/paste/controllers/paste-event-interceptor.d.ts +22 -0
  249. package/dist/types/components/vega-rich-text-editor/extensions/paste/controllers/selection-snapshot-service.d.ts +29 -0
  250. package/dist/types/components/vega-rich-text-editor/extensions/paste/parse-local-images-helper/image-extractor.d.ts +13 -0
  251. package/dist/types/components/vega-rich-text-editor/extensions/paste/parse-local-images-helper/paste-image-parser.d.ts +1 -1
  252. package/dist/types/components/vega-rich-text-editor/extensions/paste/parse-local-images-helper/pending-image-registry.d.ts +1 -1
  253. package/dist/types/components/vega-rich-text-editor/extensions/paste/paste-chooser-ui.d.ts +1 -0
  254. package/dist/types/components/vega-rich-text-editor/extensions/paste/paste-extension.d.ts +28 -93
  255. package/dist/types/components/vega-rich-text-editor/extensions/paste/pipeline/data-transfer-builder.d.ts +10 -0
  256. package/dist/types/components/vega-rich-text-editor/extensions/paste/pipeline/paste-dispatcher.d.ts +8 -0
  257. package/dist/types/components/vega-rich-text-editor/extensions/paste/pipeline/paste-processing-pipeline.d.ts +18 -0
  258. package/dist/types/components/vega-rich-text-editor/extensions/paste/strategies/paste-processing-strategy.abstract.d.ts +28 -6
  259. package/dist/types/components/vega-rich-text-editor/extensions/paste/strategies/paste-strategy-selector.d.ts +13 -0
  260. package/dist/types/components/vega-rich-text-editor/extensions/paste/strategies/plain-paste-strategy.d.ts +29 -0
  261. package/dist/types/components/vega-rich-text-editor/extensions/paste/type.d.ts +35 -0
  262. package/dist/types/components/vega-rich-text-editor/helpers/utils.d.ts +47 -0
  263. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/abstract-delete-content-handler.d.ts +17 -6
  264. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/backward-delete-content-handler.d.ts +5 -1
  265. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/base-handler.d.ts +30 -1
  266. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/forward-delete-content-handler.d.ts +5 -1
  267. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-line-break-handler.d.ts +21 -4
  268. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paragraph-handler.d.ts +12 -4
  269. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.d.ts +38 -5
  270. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-text-handler.d.ts +7 -2
  271. package/dist/types/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.d.ts +2 -0
  272. package/dist/types/components/vega-rich-text-editor/utils/html-to-plain-text-utils.d.ts +31 -0
  273. package/dist/types/components.d.ts +24 -0
  274. package/dist/types/helpers/translation/interface.d.ts +1 -0
  275. package/dist/types/types/public-api.d.ts +2 -1
  276. package/dist/vega/index.esm.js +1 -1
  277. package/dist/vega/{p-8a4cc7c2.entry.js → p-0169f71c.entry.js} +1 -1
  278. package/dist/vega/p-018bb83b.entry.js +1 -0
  279. package/dist/vega/{p-25e51acb.js → p-08bf08d2.js} +1 -1
  280. package/dist/vega/{p-85a940c0.entry.js → p-0b33753f.entry.js} +1 -1
  281. package/dist/vega/{p-a5fa260b.js → p-1537b1e4.js} +1 -1
  282. package/dist/vega/{p-7dfb1481.entry.js → p-17f6dc94.entry.js} +1 -1
  283. package/dist/vega/{p-dd673eb4.entry.js → p-1a4d1991.entry.js} +1 -1
  284. package/dist/vega/{p-557b64bd.js → p-1b2e5898.js} +1 -1
  285. package/dist/vega/{p-2256eb09.entry.js → p-1f1f93bf.entry.js} +1 -1
  286. package/dist/vega/{p-d86e0b01.js → p-1fb953f8.js} +1 -1
  287. package/dist/vega/{p-03efc67a.entry.js → p-2171b571.entry.js} +1 -1
  288. package/dist/vega/p-255fe20b.js +1 -0
  289. package/dist/vega/{p-cf5c5515.js → p-261cf764.js} +1 -1
  290. package/dist/vega/{p-f0b49ae4.entry.js → p-27e77ea1.entry.js} +1 -1
  291. package/dist/vega/{p-109f0e33.entry.js → p-28acbe42.entry.js} +1 -1
  292. package/dist/vega/{p-27c9c2a5.entry.js → p-2acc600a.entry.js} +1 -1
  293. package/dist/vega/p-2fc2299f.js +1 -0
  294. package/dist/vega/{p-b48caf90.entry.js → p-2ff659a1.entry.js} +1 -1
  295. package/dist/vega/{p-527c3211.entry.js → p-322da1eb.entry.js} +1 -1
  296. package/dist/vega/{p-dffe47db.js → p-3283fa2f.js} +1 -1
  297. package/dist/vega/p-3567dc55.entry.js +1 -0
  298. package/dist/vega/{p-c6419eb3.entry.js → p-36b795c6.entry.js} +1 -1
  299. package/dist/vega/p-37714a3a.js +1 -0
  300. package/dist/vega/{p-d7e59f31.js → p-3b4e2ba0.js} +1 -1
  301. package/dist/vega/{p-3d060d2f.entry.js → p-3b911043.entry.js} +1 -1
  302. package/dist/vega/{p-5c6d36ef.entry.js → p-3e270b65.entry.js} +1 -1
  303. package/dist/vega/{p-b68f55e2.js → p-4043508a.js} +1 -1
  304. package/dist/vega/p-4151d4a8.js +1 -0
  305. package/dist/vega/{p-c6b6987e.js → p-45af801f.js} +1 -1
  306. package/dist/vega/p-48c2150b.entry.js +1 -0
  307. package/dist/vega/p-4b253f74.entry.js +1 -0
  308. package/dist/vega/{p-75c7f8ea.entry.js → p-4cdc064d.entry.js} +1 -1
  309. package/dist/vega/{p-1d8a8507.entry.js → p-4e4b50f3.entry.js} +1 -1
  310. package/dist/vega/{p-d8fa2f19.entry.js → p-564110ba.entry.js} +1 -1
  311. package/dist/vega/p-5f377954.js +1 -1
  312. package/dist/vega/{p-bec31ffc.entry.js → p-608d3559.entry.js} +1 -1
  313. package/dist/vega/{p-3ce7521e.entry.js → p-64eb05d3.entry.js} +1 -1
  314. package/dist/vega/{p-2f5c4b61.entry.js → p-66bf209b.entry.js} +1 -1
  315. package/dist/vega/{p-83f5ef3a.entry.js → p-69eadbd8.entry.js} +1 -1
  316. package/dist/vega/{p-c66c6fd2.entry.js → p-6c4edee8.entry.js} +1 -1
  317. package/dist/vega/p-6e16bb3a.js +1 -0
  318. package/dist/vega/{p-7d748545.entry.js → p-76f4fdba.entry.js} +1 -1
  319. package/dist/vega/{p-4c6989ae.entry.js → p-7874055b.entry.js} +1 -1
  320. package/dist/vega/{p-ca60a74b.entry.js → p-7d3d24f6.entry.js} +1 -1
  321. package/dist/vega/{p-3bfb53e3.js → p-7f9ad7bc.js} +1 -1
  322. package/dist/vega/{p-18ddc6a4.entry.js → p-8193f4ef.entry.js} +1 -1
  323. package/dist/vega/{p-816064f2.entry.js → p-8197d172.entry.js} +1 -1
  324. package/dist/vega/{p-634b138c.entry.js → p-8ac0b1b2.entry.js} +1 -1
  325. package/dist/vega/{p-553510d8.entry.js → p-8c61db9d.entry.js} +1 -1
  326. package/dist/vega/{p-061a76c3.entry.js → p-8de29082.entry.js} +1 -1
  327. package/dist/vega/{p-325b804d.entry.js → p-8e59606f.entry.js} +1 -1
  328. package/dist/vega/p-8ea41806.js +1 -0
  329. package/dist/vega/{p-ff9090af.entry.js → p-9153c2f5.entry.js} +1 -1
  330. package/dist/vega/{p-a0c87e88.entry.js → p-92411f56.entry.js} +1 -1
  331. package/dist/vega/{p-049e64b1.entry.js → p-94d65dcf.entry.js} +1 -1
  332. package/dist/vega/{p-a261a675.entry.js → p-9a96fb05.entry.js} +1 -1
  333. package/dist/vega/{p-7044bb48.js → p-9fcfd738.js} +1 -1
  334. package/dist/vega/{p-b1e1c7d0.js → p-a2c7a3bc.js} +1 -1
  335. package/dist/vega/p-a2dcde12.js +1 -0
  336. package/dist/vega/{p-be0eb72f.js → p-a60d75d9.js} +1 -1
  337. package/dist/vega/{p-5a347a15.js → p-a9fc4043.js} +1 -1
  338. package/dist/vega/{p-efef0dfe.entry.js → p-abe5f7f0.entry.js} +1 -1
  339. package/dist/vega/{p-197388a5.entry.js → p-ac98c189.entry.js} +1 -1
  340. package/dist/vega/{p-dd273d89.entry.js → p-ade903b3.entry.js} +1 -1
  341. package/dist/vega/{p-c0eb8c58.js → p-affb40e8.js} +1 -1
  342. package/dist/vega/{p-277aab9b.js → p-b3a1cd22.js} +1 -1
  343. package/dist/vega/p-b63a90b3.entry.js +1 -0
  344. package/dist/vega/{p-f9f96030.entry.js → p-ba050d63.entry.js} +1 -1
  345. package/dist/vega/{p-bf0b46c1.js → p-ba67eb96.js} +1 -1
  346. package/dist/vega/{p-f0c6e9c5.entry.js → p-c08ac33f.entry.js} +1 -1
  347. package/dist/vega/{p-46be74fc.entry.js → p-c7ec97d1.entry.js} +1 -1
  348. package/dist/vega/{p-effbfc50.entry.js → p-ca1fe571.entry.js} +1 -1
  349. package/dist/vega/{p-408c3ad4.entry.js → p-cc9fc36a.entry.js} +1 -1
  350. package/dist/vega/{p-741e064e.entry.js → p-d044d54f.entry.js} +1 -1
  351. package/dist/vega/{p-0e0e66c9.entry.js → p-d3a9355c.entry.js} +1 -1
  352. package/dist/vega/p-d5a75228.js +1 -0
  353. package/dist/vega/{p-76135e80.entry.js → p-dc83fa6b.entry.js} +1 -1
  354. package/dist/vega/{p-92efdbf0.entry.js → p-dcfce26e.entry.js} +1 -1
  355. package/dist/vega/p-df9585f6.js +3 -0
  356. package/dist/vega/{p-f5f26b44.entry.js → p-e2c8a470.entry.js} +1 -1
  357. package/dist/vega/{p-23781e76.js → p-e33a954f.js} +1 -1
  358. package/dist/vega/{p-e577dda8.entry.js → p-e5fc6583.entry.js} +1 -1
  359. package/dist/vega/p-e668cf11.js +1 -0
  360. package/dist/vega/{p-0338f621.entry.js → p-e6b0a292.entry.js} +1 -1
  361. package/dist/vega/{p-381d8781.js → p-e84c2589.js} +1 -1
  362. package/dist/vega/{p-1b97e751.entry.js → p-eb945d34.entry.js} +1 -1
  363. package/dist/vega/{p-d8a0e3e0.entry.js → p-ebe1dd2b.entry.js} +1 -1
  364. package/dist/vega/{p-6beaf1c8.entry.js → p-f818bb20.entry.js} +1 -1
  365. package/dist/vega/p-f981cf2c.js +1 -0
  366. package/dist/vega/p-f9d09b0c.js +1 -0
  367. package/dist/vega/{p-4d20a56f.js → p-fdbdf12f.js} +1 -1
  368. package/dist/vega/{p-48100d38.entry.js → p-fee080b9.entry.js} +1 -1
  369. package/dist/vega/vega.esm.js +1 -1
  370. package/package.json +1 -1
  371. package/dist/vega/p-040bd9ca.js +0 -1
  372. package/dist/vega/p-087240db.js +0 -1
  373. package/dist/vega/p-15052b2e.entry.js +0 -1
  374. package/dist/vega/p-28c16885.js +0 -1
  375. package/dist/vega/p-30cc31dd.entry.js +0 -1
  376. package/dist/vega/p-3ec4d710.js +0 -1
  377. package/dist/vega/p-43ea1e86.js +0 -1
  378. package/dist/vega/p-7228088b.entry.js +0 -1
  379. package/dist/vega/p-7f711049.js +0 -1
  380. package/dist/vega/p-7fd15dd1.js +0 -1
  381. package/dist/vega/p-85695819.js +0 -1
  382. package/dist/vega/p-8e1f30ec.entry.js +0 -1
  383. package/dist/vega/p-9680dfe6.js +0 -1
  384. package/dist/vega/p-ae12cc3f.js +0 -3
  385. package/dist/vega/p-c0823f32.js +0 -1
  386. package/dist/vega/p-c5af2ecc.entry.js +0 -1
  387. package/dist/vega/p-fa43272c.js +0 -1
@@ -1 +0,0 @@
1
- import{C as t}from"./p-2d0d575f.js";import{d as e}from"./p-36a57431.js";import{e as n,f as s}from"./p-53e3f259.js";import{d as r,c as i}from"./p-02841589.js";import{L as o}from"./p-6e1ab235.js";import{i as c}from"./p-4d20a56f.js";import{T as a}from"./p-b438e68b.js";import{D as l}from"./p-5c285374.js";import{g as u}from"./p-8b5d3a52.js";import{V as h}from"./p-d1f47512.js";import{c as d}from"./p-a841cf13.js";import{f}from"./p-aa135628.js";var p,g;!function(t){t.SELECTION_RANGE="SELECTION_RANGE",t.CLEAR_FORMATTING="CLEAR_FORMATTING",t.LINK_GROUP="LINK_GROUP"}(p||(p={}));class w{get isFormattingOnly(){return!1}}!function(t){t.ALIGNMENT="ALIGNMENT",t.TEXT_STYLE="TEXT_STYLE",t.INDENT="INDENT",t.LIST="LIST",t.INTERNAL_WRAPPER="INTERNAL_WRAPPER"}(g||(g={}));class m extends w{}const A=new class{constructor(){this.domToEntity=new WeakMap,this.entityToDOM=new WeakMap,this.contentEntityToRootDom=new Map,this.rootDomToContentEntity=new WeakMap}register(t,e){this.isVegaRTEContent(e)?this.registerRootDomAndContentEntity(t,e):(this.domToEntity.set(t,e),this.entityToDOM.set(e,t))}getEntityByDOM(t){return this.domToEntity.get(t)}getDOMByEntity(t){return this.isVegaRTEContent(t)?this.contentEntityToRootDom.get(t):this.entityToDOM.get(t)}removeDirtyDomRef(t){this.domToEntity.delete(t)}registerRootDomAndContentEntity(t,e){const n=this.rootDomToContentEntity.get(t);n&&n!==e&&this.contentEntityToRootDom.delete(n),this.rootDomToContentEntity.set(t,e),this.contentEntityToRootDom.set(e,t)}isVegaRTEContent(t){return t&&"VegaRTEContent"===t.typeName}};var x,S,y,O;!function(t){t.DELETE_CHILDREN="DELETE_CHILDREN",t.DELETE_NEST_LIST="DELETE_NEST_LIST",t.UPDATE_TEXT="UPDATE_TEXT",t.REPLACE_SELECTED_TEXT="REPLACE_SELECTED_TEXT",t.APPEND_CHILDREN="APPEND_CHILDREN",t.INSERT_CHILDREN_AFTER="INSERT_CHILDREN_AFTER",t.INSERT_CHILDREN_BEFORE="INSERT_CHILDREN_BEFORE",t.SPLIT_BLOCK_WITH_NODE="SPLIT_BLOCK_WITH_NODE",t.REPLACE_CHILD_NODES="REPLACE_CHILD_NODES",t.REPLACE_NEST_LIST="REPLACE_NEST_LIST",t.MERGE_TWO_BLOCKS_NODES="MERGE_TWO_BLOCKS_NODES",t.INSERT_NEW_PARAGRAPH="INSERT_NEW_PARAGRAPH",t.LINE_BREAK_SINGLE_BLOCK="LINE_BREAK_SINGLE_BLOCK",t.LINE_BREAK_MULTIPLE_BLOCKS="LINE_BREAK_MULTIPLE_BLOCKS",t.TRANSFORM_LIST_BLOCK="TRANSFORM_LIST_BLOCK",t.TRANSFORM_PARAGRAPH_BLOCK="TRANSFORM_PARAGRAPH_BLOCK",t.NEST_LIST_ITEMS="NEST_LIST_ITEMS",t.UNNEST_LIST_ITEMS="UNNEST_LIST_ITEMS",t.DELETE_BLOCK_CONTENT="DELETE_BLOCK_CONTENT",t.INSERT_IMAGE_TO_BLOCK="INSERT_IMAGE_TO_BLOCK",t.UPDATE_IMAGE_NODE_URL="UPDATE_IMAGE_NODE_URL",t.TRANSFORM_TO_CODE_BLOCK="TRANSFORM_TO_CODE_BLOCK",t.UPDATE_CODE_BLOCK="UPDATE_CODE_BLOCK",t.SWITCH_OUT_FROM_CODE_BLOCK="SWITCH_OUT_FROM_CODE_BLOCK",t.DELETE_CODE_BLOCK="DELETE_CODE_BLOCK",t.UNLINK_LINK_GROUP="UNLINK_LINK_GROUP",t.LINK_GROUP_NODE_SPLIT="LINK_GROUP_NODE_SPLIT",t.DELETE_LINK_GROUP="DELETE_LINK_GROUP",t.UPDATE_CURSOR_POSITION="UPDATE_CURSOR_POSITION",t.INSERT_TEXT_TO_DECORATOR_NODE="INSERT_TEXT_TO_DECORATOR_NODE",t.INSERT_NODE_TO_NEAREST_ROOT="INSERT_NODE_TO_NEAREST_ROOT",t.PASTE_CONTENT="PASTE_CONTENT",t.DELETE_SELECTED_CONTENT="DELETE_SELECTED_CONTENT"}(x||(x={}));class T{constructor(){this.isFlushable=!1}}function E(t){const e={},n=t.getAttribute("style");if(!n)return e;const s=function(t){const e=[];let n="",s=0;for(let r=0;r<t.length;r++){const i=t[r];"("===i?(s++,n+=i):")"===i?(s--,n+=i):";"===i&&0===s?(e.push(n),n=""):n+=i}return n&&e.push(n),e}(n);for(const t of s){const n=t.trim(),s=n.indexOf(":"),i=n.substring(0,s).trim(),o=n.substring(s+1).trim();e[r(i)]=o}return e}function v(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function N(t){return v(t).replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function b(t){return t.replace(/&(?!(?:[a-zA-Z][a-zA-Z0-9]+|#[0-9]+|#x[a-fA-F0-9]+);)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}class C{constructor(){this.classNameToBeAdded=""}filterAnnotations(t){const e=t.customStyle;return e?(this.extractAndDeleteMatchedStyles(e),0===Object.keys(e).length&&delete t.customStyle,t):t}filterAndDeleteStyles(t,e,n){const s=new Set(e);return this.extractAndDeleteMatchedStyles(t)&&this.classNameToBeAdded&&s.add(this.classNameToBeAdded),{styles:t,classNames:Array.from(s)}}refillStyles(t){this.classNameToBeAdded&&t.classList.remove(this.classNameToBeAdded);const e=E(t),n=Object.assign(Object.assign({},this.stylesToBeFiltered),e),s=Object.entries(Object.assign({},n)).map((([t,e])=>`${i(t)}: ${e};`)).join("");t.setAttribute("style",s)}canFilter(t){return!1}canRefill(t,e){return!1}toCssText(){return""}get alwaysFilter(){return!1}extractAndDeleteMatchedStyles(t){let e=!1;const n=this.stylesToBeFiltered;if(t&&n){const s=Object.keys(n);for(const r of s)t[r]===n[r]&&(delete t[r],e=!0)}return e}buildCssTextForStyles(t,e){return`${`.${C.RTE_CONTENT_CONTAINER_CLASS_NAME}`+(e?` .${e}`:` ${t}`)} { ${Object.entries(this.stylesToBeFiltered).map((([t,e])=>`${i(t)}: ${e};`)).join(" ")} }`}convertStylesMapToCssText(t){return Object.entries(t||this.stylesToBeFiltered).map((([t,e])=>`${i(t)}: ${e};`)).join(" ")}isBlockOrNodeStylesMatchFilterStyles(t,e){const n=t.getStyles({standalone:!0});return this.isMatchFilterStyles(n,e)}isMatchFilterStyles(t,e){return(e&&e.length>0?e:Object.keys(this.stylesToBeFiltered)).every((e=>t[e]===this.stylesToBeFiltered[e]))}}C.RTE_CONTENT_CONTAINER_CLASS_NAME="vega-rte-content",function(t){t.BOLD="BOLD",t.ITALIC="ITALIC",t.UNDERLINE="UNDERLINE",t.STRIKETHROUGH="STRIKETHROUGH",t.SELECTION_RANGE="SELECTION_RANGE",t.IMAGE="IMAGE",t.CODE="CODE",t.TEXT_COLOR="TEXT_COLOR",t.LINK="LINK",t.INLINE_HTML="INLINE_HTML",t.PLAIN_TEXT="PLAIN_TEXT"}(S||(S={}));class L extends w{}class k{static isTextBlock(t){return t===this.RTE_TEXT_BLOCK_CLASS_NAME}static isCodeBlock(t){return"RTECodeBlock"===t}static isListBlock(t){return"RTEListBlock"===t}static isListItemBlock(t){return"RTEListItemBlock"===t}static isTextNode(t){return t===this.RTE_TEXT_NODE_CLASS_NAME}static isLinkNode(t){return this.isTextNode(t.typeName)&&!!t.getAnnotationByType(S.LINK)}static isCodeNode(t){if(this.isTextNode(t.typeName)){const e=t.getAnnotationByType(S.CODE);return!!e&&e.code}return!1}static isImageNode(t){return"RTEImageNode"===t.typeName}static isCodeBlockNode(t){return"RTECodeBlockNode"===t.typeName}}k.RTE_TEXT_NODE_CLASS_NAME="RTETextNode",k.RTE_TEXT_BLOCK_CLASS_NAME="RTETextBlock";class R extends C{constructor(){super(...arguments),this.stylesToBeFiltered=j.getDefaultStyles(),this.elementTagName="a"}filterAnnotations(t){const e=t.link;return(null==e?void 0:e.customStyle)?(this.extractAndDeleteMatchedStyles(e.customStyle),0===Object.keys(e.customStyle).length&&delete e.customStyle,t):t}canFilter(t){return k.isLinkNode(t)}canRefill(t,e){return"RTETextNode"===t&&e.matches(this.elementTagName)}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}filterLinkGroupInlineStyles(t){const e=t.style,n=t.class?t.class.split(" "):[],s=this.filterAndDeleteStyles(e,n);return s.styles&&Object.keys(s.styles).length>0&&(t.style=s.styles),s.classNames&&s.classNames.length>0&&(t.class=s.classNames.join(" ")),t.style&&0===Object.keys(t.style).length&&delete t.style,t}}class j extends w{constructor(t){super(),this.type=p.LINK_GROUP,this.linkGroups=new Map,this.linkGroups=new Map([[t,[]]])}static getDefaultStyles(){return{color:"rgba(var(--v-text-link, 19, 98, 226, 1))"}}clone(){const t=new j("");return this.linkGroups.forEach(((e,n)=>{t.linkGroups.set(n,e.map((t=>t.clone(t.parent))))})),t}toString(t,e){let n=this.toJsx(t,e);return(null==e?void 0:e.filterInlineStyles)&&(n=j.linkGroupFilterStylesStrategy.filterLinkGroupInlineStyles(n)),Object.entries(n).map((([t,e])=>{const n="string"==typeof e?e:this.formatStyleToString(e);return`${i(t)}="${n}"`})).join(" ")}toJsx(t,e){const n=this.getStyle(t,e),s=this.getClass(t,e),r=this.getAttribute(t);return s.length>0&&(r.class=s.join(" ")),n&&Object.keys(n).length>0&&(r.style=n),r}getClass(t,e){const n=[];return t.link.customClass&&n.push(...t.link.customClass),!(null==e?void 0:e.standalone)&&t.useInternalStyle&&n.push("v-rte--link"),n}getStyle(t,e){const n={};return t.link.customStyle&&Object.assign(n,t.link.customStyle),(null==e?void 0:e.standalone)&&t.useInternalStyle&&Object.assign(n,j.getDefaultStyles()),n}getAttribute(t){const{href:e,customAttribute:n={}}=t.link,s=t.useInternalStyle,r=(null==e?void 0:e.startsWith("#"))?"_self":n.target||(s?"_blank":"");return Object.assign(Object.assign(Object.assign({},n),e||s?{href:e}:{}),r?{target:r}:{})}formatStyleToString(t){return Object.entries(t).map((([t,e])=>`${i(t)}: ${e};`)).join(" ")}}j.linkGroupFilterStylesStrategy=new R;class _ extends m{constructor(t){super(),this.type=g.ALIGNMENT,this.textAlign=t}static from(t){return[g.ALIGNMENT,new _(t)]}static getDefaultStyles(t){switch(t){case"right":case"center":case"justify":return{textAlign:t};case"left":default:return{textAlign:"left"}}}toJSON(){return{textAlign:this.textAlign}}renderClass(t){if(null==t?void 0:t.standalone)return null;switch(this.textAlign){case"right":case"center":case"justify":return`v-rte--horizontal-alignment-${this.textAlign}`;case"left":default:return"v-rte--horizontal-alignment-left"}}clone(){return new _(this.textAlign)}renderStyle(t){return(null==t?void 0:t.standalone)?_.getDefaultStyles(this.textAlign):null}}class $ extends m{constructor(t){super(),this.type=g.INDENT,this.indent=Math.max(0,t)}static from(t){return[g.INDENT,new $(t)]}toJSON(){return this.indent>0?{indent:this.indent}:null}clone(){return new $(this.indent)}renderClass(){return null}renderStyle(){return this.indent>0?{marginLeft:16*this.indent+"px"}:null}}class I{static register(t,e,n){this.registry.has(e)||this.registry.set(e,new Map),this.registry.get(e).has(t)||this.registry.get(e).set(t,new Set),this.registry.get(e).get(t).add(n)}static unregister(t,e,n){const s=this.registry.get(e);if(s){const e=s.get(t);e&&e.delete(n)}}static get(t,e){const n=t instanceof T?t.type:t.typeName,s=this.registry.get(e.typeName);if(s){const r=s.get(n);if(r&&r.size>0)return Array.from(r).find((n=>n.canIntercept(t,e)))}}}I.registry=new Map;class B{static register(t,e,n){this.registry.has(e)||this.registry.set(e,new Map),this.registry.get(e).set(t,n)}static unregister(t,e){const n=this.registry.get(e);n&&n.delete(t)}static get(t,e){const n=this.registry.get(e);if(n)return n.get(t)}static executeTheStrategy(t,e){const n=I.get(t,e),s=()=>{const n=t instanceof T?t.type:t.typeName,s=B.get(n,e.typeName);if(s)return t.executedFlag=!0,s.execute(t,e);o.warn(`Type ${n} action handle strategy is not registered in class ${e.typeName}`)};return n?n.intercept(s,t,e):s()}static canHandle(t,e){return!!B.get(t,e.typeName)}}B.registry=new Map,function(t){t.CUSTOM_ATTRIBUTE="CUSTOM_ATTRIBUTE",t.CUSTOM_CLASS="CUSTOM_CLASS",t.CUSTOM_STYLE="CUSTOM_STYLE"}(y||(y={}));class D extends w{}class M extends D{constructor(t){super(),this.type=y.CUSTOM_ATTRIBUTE,this.BOOLEAN_ATTRS=new Set(["controls","disabled","checked","readonly","multiple","required","autoplay","muted"]),this.customAttribute=t}static from(t){return[y.CUSTOM_ATTRIBUTE,new M(t)]}toJSON(){return{customAttribute:this.customAttribute}}clone(){return new M(this.customAttribute)}toString(t=[]){const e=t.map((t=>t.split("=")[0]));return Object.keys(this.customAttribute).map((t=>e.includes(t)?null:`${t}="${this.customAttribute[t]}"`)).filter(c)}render(t={}){var e;const n=Object.assign({},this.customAttribute);return null===(e=t.filterAttributes)||void 0===e||e.forEach((t=>delete n[t])),Object.keys(n).forEach((t=>{this.BOOLEAN_ATTRS.has(t)&&""===n[t]&&(n[t]="true")})),n}}class F extends D{constructor(t){super(),this.type=y.CUSTOM_CLASS,this.customClass=t}static from(t){return[y.CUSTOM_CLASS,new F(t)]}toJSON(){return{customClass:this.customClass}}clone(){return new F(this.customClass)}toString(){return`class="${this.customClass.join(" ")}"`}renderClass(){return this.customClass}}class P extends D{constructor(t){super(),this.type=y.CUSTOM_STYLE,this.customStyle=t}static from(t){return[y.CUSTOM_STYLE,new P(t)]}toJSON(){return{customStyle:this.customStyle}}clone(){return new P(this.customStyle)}renderStyle(){return this.customStyle}removeStyles(t){const e=Object.assign({},this.customStyle);return t.forEach((t=>delete e[t])),e}toString(){return`style="${b(Object.entries(this.customStyle).map((([t,e])=>`${t}: ${e};`)).join(" "))}"`}}class H extends m{constructor(t){super(),this.type=g.INTERNAL_WRAPPER,this.internalWrapper=t}static from(t){return[g.INTERNAL_WRAPPER,new H(t)]}clone(){return new H(this.internalWrapper)}renderClass(){}renderStyle(){}toJSON(){return this.internalWrapper?{internalWrapper:this.internalWrapper}:void 0}}class J{constructor(t){this.dtoName=t instanceof z?"block":"node",this.annotationMap=t.annotationMap}toCssText(t={standalone:!1},e,n){return n=n||this.toJSON(t,e),Object.entries(Object.assign({},n)).map((([t,e])=>`${i(t)}: ${e};`)).join("")}toJSON(t={standalone:!1},e){const n=Array.from(this.annotationMap.values()).filter((t=>this.filterAnnotation(t)||t instanceof P)).map((e=>e.renderStyle(t))).filter(c);return e&&e.length>0?this.mergeAnnotationStyles(n,e):n.reduce(((t,e)=>Object.assign(Object.assign({},t),e)),{})}filterAnnotation(t){return"block"===this.dtoName?t instanceof m:t instanceof L}mergeAnnotationStyles(t,e){const n={};for(const s of t)for(const t in s){const r=s[t],i=n[t];n[t]="string"==typeof i&&"string"==typeof r&&e.includes(t)?Array.from(new Set(`${i} ${r}`.split(/\s+/).filter(Boolean))).join(" "):r}return n}}class K{static register(t,e){var n;const s=null!==(n=this.registry.get(t))&&void 0!==n?n:new Set;s.add(e),this.registry.set(t,s)}static getStrategies(t){var e;return Array.from(null!==(e=this.registry.get(t))&&void 0!==e?e:[])}static executeTheStrategyFilterAction(t,e,n){return this.getStrategies(t.typeName).filter((e=>e.canFilter(t))).reduce(((e,n)=>n.filterAndDeleteStyles(e.styles,e.classNames,t)),{styles:e,classNames:n})}static executeTheStrategyRefillAction(t,e){this.getStrategies(t).filter((n=>n.canRefill(t,e))).forEach((t=>{t.refillStyles(e)}))}static generateAllStylesContent(t=!1){const e=[];return t&&(e.push("/* Font-face imports begin */\n"),e.push(Object.keys(a).map((t=>`@import url('${a[t].url}');\n`)).join(" ")),e.push("/* Font-face imports end */\n")),this.registry.forEach((t=>{t.forEach((t=>{const n=t.toCssText();n&&!e.includes(n)&&e.push(n)}))})),e.join(" ")}}K.registry=new Map,function(t){t.TEXT="TEXT",t.IMAGE="IMAGE",t.CODE_BLOCK_NODE="CODE_BLOCK_NODE"}(O||(O={}));class U extends l{constructor(t,e){super(),this.annotationMap=new Map,this.id=t,e&&(this.annotationMap=e)}static from(t,e,n){throw new Error(`[Vega] ${this.typeName}.from(${JSON.stringify(t)}, ${e}, ${n}) is not implemented. Please implement this method in the subclass.`)}static createAnnotationEntity(t,e){switch(t){case"customAttribute":return M.from(e);case"customClass":return F.from(e);case"customStyle":return P.from(e)}}getAnnotationByType(t){return this.annotationMap.get(t)}deleteAnnotationByType(t){this.annotationMap.delete(t),this.flushChange()}apply(t){return this.doApply(t),t.isFlushable&&this.flushChange(),this}getStyles(t={standalone:!1}){return new J(this).toJSON(t,["textDecoration"])}getClasses(t={standalone:!1}){return Array.from(this.annotationMap.values()).filter((t=>t instanceof L||t instanceof F)).map((e=>e.renderClass(t))).filter(c).reduce(((t,e)=>[t,e].join(" ").trim()),"")}getCustomAttributesAnnotation(){return this.annotationMap.get(y.CUSTOM_ATTRIBUTE)}isTextNode(){return!1}getPlainText(){return""}getElementRef(){return A.getDOMByEntity(this)}generateAttributeString(t,...e){var n;const s=new J(this),r=s.toJSON({standalone:!0},["textDecoration"]),i=this.annotationMap.get(y.CUSTOM_CLASS);let o=r,a=null==i?void 0:i.renderClass();if(t&&t.filterInlineStyles){const t=K.executeTheStrategyFilterAction(this,r,a);o=t.styles,a=t.classNames}const l=[...(null===(n=this.getCustomAttributesAnnotation())||void 0===n?void 0:n.toString(e))||[],a&&a.length>0?`class="${a.join(" ")}"`:null,o&&Object.keys(o).length>0?`style="${b(s.toCssText({standalone:!0},void 0,o))}"`:null,...e].filter(c);return l.length?` ${l.join(" ")}`:""}doApply(t){t instanceof T?this.doModifyActionApply(t):this.doAnnotationActionApply(t)}flushChange(){const s=A.getDOMByEntity(this);if(s){const r=e.getSubjectFromParentNodeByEventId(s,n);r&&t.notify(r,{})}}cloneAnnotations(){return new Map(Array.from(this.annotationMap.entries()).map((([t,e])=>[t,e.clone()])))}doAnnotationActionApply(t){}doModifyActionApply(t){}}U.typeName="RTENode";const G=new class{constructor(){this.RTE_BLOCK_DTO_CLASS_MAP=new Map,this.RTE_NODE_DTO_CLASS_MAP=new Map}registerRTEDTOClass(t,e){if(e.prototype instanceof z)this.RTE_BLOCK_DTO_CLASS_MAP.set(t,e);else{if(!(e.prototype instanceof U))throw new Error(`Invalid RTE DTO class type: ${t}`);this.RTE_NODE_DTO_CLASS_MAP.set(t,e)}}getRTEBlockClass(t){return this.RTE_BLOCK_DTO_CLASS_MAP.get(t)}getRTENodeClass(t){return this.RTE_NODE_DTO_CLASS_MAP.get(t)}};class z extends l{constructor(t){super(),this.annotationMap=new Map,this.id=t}static from(t,e){throw new Error(`[Vega] ${this.typeName}.from(${JSON.stringify(t)}, ${e}) is not implemented. Please implement this method in the subclass.`)}static generateBlockChildren(t,e,n){return t.map((t=>{const s=G.getRTEBlockClass(t.type);if(s){const r=s.from(t,e);return r.parent=n,r}})).filter(c)}static createAnnotationEntity(t,e){switch(t){case"textAlign":return _.from(e);case"indent":return $.from(e);case"customAttribute":return M.from(e);case"customClass":return F.from(e);case"customStyle":return P.from(e);case"internalWrapper":return H.from(e)}}static convertAnnotationsToMap(t,e){Object.entries(e).forEach((([e,n])=>{const s=this.createAnnotationEntity(e,n);c(s)&&t.set(...s)}))}shouldRenderAsInternalWrapper(){const t=this.getAnnotationByType(g.INTERNAL_WRAPPER);return!!t&&t.internalWrapper&&0===Array.from(this.annotationMap.values()).filter((t=>!(t instanceof j||t instanceof H))).length}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof m||t instanceof D)).reduce(((t,e)=>Object.assign(Object.assign({},t),e.toJSON())),{});return Object.assign({id:this.id},Object.keys(t).length>0?{annotations:t}:{})}getAnnotationByType(t){return this.annotationMap.get(t)}apply(s){if(this.doApply(s),s.isFlushable){const s=A.getDOMByEntity(this);if(s){const r=e.getSubjectFromParentNodeByEventId(s,n);r&&t.notify(r,{})}}}allowsCaretDescend(){return!0}getFirstNode(){if(!this.children||!this.children[0])return null;const t=this.children[0];return t instanceof z?t.getFirstNode():t}getPlainText(){var t;return(null!==(t=this.children)&&void 0!==t?t:[]).map((t=>t.getPlainText())).join("")}isListItemBlock(){return"list-item"===this.type}getStyles(t={standalone:!1}){const e=new J(this).toJSON(t);return Object.assign(Object.assign({},e),this.shouldRenderAsInternalWrapper()?{display:"contents"}:{})}getClasses(t={standalone:!1}){return Array.from(this.annotationMap.values()).filter((t=>t instanceof m||t instanceof F)).map((e=>e.renderClass(t))).filter(c).reduce(((t,e)=>[t,e].join(" ").trim()),"")}getCustomAttributesAnnotation(){return this.annotationMap.get(y.CUSTOM_ATTRIBUTE)}generateAttributeString(t,...e){var n;const s=new J(this),r=s.toJSON({standalone:!0}),i=this.annotationMap.get(y.CUSTOM_CLASS);let o=r,a=null==i?void 0:i.renderClass();if(t&&t.filterInlineStyles){const t=K.executeTheStrategyFilterAction(this,r,a);o=t.styles,a=t.classNames}const l=[...(null===(n=this.getCustomAttributesAnnotation())||void 0===n?void 0:n.toString(e))||[],a&&a.length>0?`class="${a.join(" ")}"`:null,o&&Object.keys(o).length>0?`style="${b(s.toCssText({standalone:!0},void 0,o))}"`:null,...e].filter(c);return l.length?` ${l.join(" ")}`:""}doApply(t){t instanceof T?B.executeTheStrategy(t,this):this.applyAnnotationAction(t)}applyAnnotationAction(t){const e=t.toAnnotation();if(e instanceof j||this.annotationMap.set(e.type,e),"function"==typeof this.doAnnotationActionApply)this.doAnnotationActionApply(t);else{const e=B.get(t.typeName,this.typeName);e&&e.execute(t,this)}}cloneAnnotations(){return new Map(Array.from(this.annotationMap.entries()).map((([t,e])=>[t,e.clone()])))}}z.typeName="RTEBlock";class W extends T{constructor(t){super(),this.type=x.APPEND_CHILDREN,this.entityToBeAppended=t}}const V="500",X={fontFamily:"Inter",fontSize:"16px",lineHeight:"22px",minHeight:"22px",fontWeight:"500"},q=Object.assign(Object.assign({},X),{marginTop:"0px",marginBottom:"0px"}),Y={paragraph:q,title:Object.assign(Object.assign({},X),{fontSize:"36px",lineHeight:"40px",minHeight:"40px"}),subtitle:Object.assign(Object.assign({},X),{fontSize:"28px",lineHeight:"32px",minHeight:"32px"}),"heading-1":Object.assign(Object.assign({},q),{fontSize:"22px",lineHeight:"24px",minHeight:"24px"}),"heading-2":Object.assign(Object.assign({},q),{fontSize:"20px",lineHeight:"24px",minHeight:"24px"}),"heading-3":Object.assign(Object.assign({},q),{fontSize:"18px"}),"heading-4":Object.assign({},q),"heading-5":Object.assign(Object.assign({},q),{fontSize:"14px"}),"heading-6":Object.assign(Object.assign({},q),{fontSize:"12px"})};class Z extends m{constructor(t){super(),this.type=g.TEXT_STYLE,this.textStyle=t}static from(t){return[g.TEXT_STYLE,new Z(t)]}static getDefaultStyles(t){return t?Y[t]:null}toJSON(){return{textStyle:this.textStyle}}clone(){return new Z(this.textStyle)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.textStyle?`v-rte--text-style-${this.textStyle}`:null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.textStyle?Z.getDefaultStyles(this.textStyle):null}}class Q extends l{}Q.typeName="AnnotationAction";class tt extends Q{constructor(t,e){super(),this.isFlushable=!0,this.textStyle=t,this.bold=e}toAnnotation(){return new Z(this.textStyle)}}tt.typeName="TextStyleAnnotationAction";class et extends L{constructor(t,e=!0){super(),this.type=S.LINK,this.link=t,this.useInternalStyle=e}static from(t,e=!0){return[S.LINK,new et(t,e)]}toJSON(){return{link:this.link}}clone(){return new et(this.link,this.useInternalStyle)}toEqual(t){return this.link.groupKey===t.link.groupKey}renderClass(){return null}renderStyle(){return null}}class nt extends Q{constructor(){super(...arguments),this.doSplit=!0}}nt.typeName="TextSplittableAction";class st extends nt{constructor({link:t,newText:e,needMergeNode:n,doSplit:s,type:r}){super(),this.isFlushable=!0,this.link=t,this.needMergeNode=n,this.newText=e,this.type=r,c(s)&&(this.doSplit=s)}toAnnotation(){return new et(this.link)}}st.typeName="LinkAnnotationAction";class rt extends Q{constructor(t,e,n){super(),this.isFlushable=!1,this.groupKey=t,this.nodes=e,this.type=n}toAnnotation(){return new j(this.groupKey)}}rt.typeName="LinkGroupAnnotationAction";const it="700",ot="bold",ct="italic",at="underline",lt="line-through";class ut extends L{constructor(t){super(),this.type=S.BOLD,this.bold=t}static from(t){return[S.BOLD,new ut(t)]}get isFormattingOnly(){return!0}toJSON(){return{bold:this.bold}}clone(){return new ut(this.bold)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.bold?"v-rte--bold":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.bold?{fontWeight:"700"}:null}}class ht extends nt{constructor(t){super(),this.isFlushable=!0,this.bold=t}toAnnotation(){return new ut(this.bold)}}ht.typeName="BoldAnnotationAction";class dt extends Q{constructor(t){super(),this.isFlushable=!0,this.annotationType=t}toAnnotation(){}}dt.typeName="DeleteNodeAnnotationAction";class ft{execute(t,e){return o.log(`Executing action ${t instanceof T?t.type:t.typeName} on ${e.typeName} ${e.id}`),this.handleAction(t,e)}updateCustomStyleAnnotation(t,e){const n=t.annotationMap.get(y.CUSTOM_STYLE);n&&this.isCustomStyle(n,e)&&t.annotationMap.set(n.type,new P(n.removeStyles(e)))}createNewParagraph(t){const e=G.getRTEBlockClass("paragraph");if(e)return e.from({id:u(),type:"paragraph",nodes:[{id:u(),type:"text",text:t}]})}getRootContent(t){const e=t.parent;if(e)return"VegaRTEContent"===e.typeName?e:this.getRootContent(e)}isCaretPositionAtBlockStart(t,e,n){return e===t.children[0]&&0===n}isCaretPositionAtBlockEnd(t,e,n){return e.isContentEditable()?this.isCaretPositionAtTextBlockEnd(t,e,n):this.isCaretPositionAtDecoratorBlockEnd(t,e,n)}getDOMByEntity(t){return A.getDOMByEntity(t)}isCaretPositionAtTextBlockEnd(t,e,n){const s=t.children[t.children.length-1];return e===s&&(e.isEmpty()||n===s.text.length)}isCaretPositionAtDecoratorBlockEnd(t,e,n){return e===t.children[t.children.length-1]&&0!==n}isCustomStyle(t,e){return e.some((e=>Object.keys(t.customStyle).includes(e)))}}class pt extends ft{handleAction(t,e){"list-item"!==e.type&&(e.type=t.textStyle),e.children.forEach(t.bold?t=>{const e=new ht(!0);e.doSplit=!1,t.apply(e)}:t=>{t.apply(new dt(S.BOLD))}),this.updateCustomStyleAnnotation(e,["fontFamily","lineHeight","fontWeight","fontSize"])}}class gt extends T{constructor(t,...e){super(),this.type=x.INSERT_CHILDREN_AFTER,this.referChildren=t,this.childrenToBeInserted=e}}class wt extends T{constructor(t){super(),this.type=x.REPLACE_CHILD_NODES,this.newChildNodes=t}}class mt extends ft{handleAction(t,e){t.newBlock=this.splitTextNodeBlock(t.splitPointNode,t.startOffsetOfNode,e)}splitTextNodeBlock(t,e,n){if(t){const s=t.text.slice(0,e),r=t.text.slice(e),i=n.children.indexOf(t);if(i>-1){const o=n.children.slice(0,i),c=n.children.slice(i+1);t.isContentEditable()?(s&&o.push(t.cloneWithText(s)),r&&c.unshift(t.cloneWithText(r))):e>0?o.push(t):c.unshift(t),n.apply(new wt(o));const a=n.cloneWithNodes(c);return n.parent.apply(new gt(n,a)),a}}}}class At extends ft{handleAction(t,e){e.children=[],e.apply(new W(t.newChildNodes))}}class xt extends T{constructor(t){super(),this.type=x.DELETE_CHILDREN,this.entityToBeRemoved=t}}class St extends w{constructor(t){super(),this.type=p.SELECTION_RANGE,this.range=t}get isFormattingOnly(){return!0}clone(){return new St(this.range)}}class yt extends L{constructor(t){super(),this.type=S.STRIKETHROUGH,this.strikethrough=t}static from(t){return[S.STRIKETHROUGH,new yt(t)]}get isFormattingOnly(){return!0}toJSON(){return{strikethrough:this.strikethrough}}clone(){return new yt(this.strikethrough)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.strikethrough?"v-rte--strikethrough":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.strikethrough?{textDecoration:"line-through"}:null}}class Ot extends L{constructor(t){super(),this.type=S.UNDERLINE,this.underline=t}static from(t){return[S.UNDERLINE,new Ot(t)]}get isFormattingOnly(){return!0}toJSON(){return{underline:this.underline}}clone(){return new Ot(this.underline)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.underline?"v-rte--underline":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.underline?{textDecoration:"underline"}:null}}class Tt extends L{constructor(t){super(),this.type=S.ITALIC,this.italic=t}static from(t){return[S.ITALIC,new Tt(t)]}get isFormattingOnly(){return!0}toJSON(){return{italic:this.italic}}clone(){return new Tt(this.italic)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.italic?"v-rte--italic":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.italic?{fontStyle:"italic"}:null}}class Et extends L{constructor(t,e=!0){super(),this.type=S.CODE,this.code=t,this.useInternalStyle=e}static from(t,e){return[S.CODE,new Et(t,e)]}static getDefaultStyles(){return{fontFamily:"Roboto Mono",whiteSpace:"pre-wrap"}}get isFormattingOnly(){return!0}toJSON(){return{code:this.code}}clone(){return new Et(this.code,this.useInternalStyle)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.code&&this.useInternalStyle?"v-rte--code":null}renderStyle(t){return(null==t?void 0:t.standalone)&&this.code&&this.useInternalStyle?Et.getDefaultStyles():null}}const vt={key:"black",light:"#111128",dark:"#E3E3E8"},Nt=[vt,{key:"gray",light:"#5E5E6D",dark:"#B9B9C1"},{key:"green",light:"#01801F",dark:"#59D977"},{key:"red",light:"#BD2947",dark:"#FFB2B5"},{key:"purple",light:"#563D82",dark:"#BEB2FF"},{key:"teal",light:"#17758F",dark:"#4CD8FF"}],bt="​";var Ct;!function(t){t.Default="default",t.Composition="composition"}(Ct||(Ct={}));const Lt="__updateSource",kt=[{key:"title"},{key:"subtitle"},{key:"heading-1"},{key:"heading-2"},{key:"heading-3"},{key:"paragraph"}],Rt=[["textStyles"],["bold","italic","underline","strikethrough","code"],["textColor"],["horizontalAlignment","bulletsNumbers"],["moreIndent","lessIndent"],["link"],["image"],["clearStyle"]],jt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),_t=22,$t="url",It="email",Bt=["url","email"],Dt="data-vega-rte-block-boundary",Mt="application/x-vega-rte-paste-mode",Ft="word",Pt="rte-word-count";class Ht extends L{constructor(t){super(),this.type=S.TEXT_COLOR,this.textColor=this.formatTextColor(t)}static from(t){return[S.TEXT_COLOR,new Ht(t)]}get isFormattingOnly(){return!0}toJSON(){return{textColor:this.textColor.key}}clone(){return new Ht(this.textColor.key)}renderClass(){return null}renderStyle(){return{color:h.isDarkMode()?this.textColor.dark:this.textColor.light}}formatTextColor(t){return Nt.find((e=>e.key===t))||Nt[0]}}class Jt extends Q{constructor(){super(),this.isFlushable=!1}toAnnotation(){return null}}Jt.typeName="SyncUpSelectionAction";class Kt extends T{constructor(t){super(),this.type=x.LINK_GROUP_NODE_SPLIT,this.splittedTextNodes=t}}class Ut extends ft{constructor(){super(...arguments),this.applyTargetNode=null}handleAction(t,e){const n=e.getAnnotationByType(p.SELECTION_RANGE);if(this.setApplyTargetNode(null),t instanceof nt&&t.doSplit&&n){const{startContainer:t,endContainer:s,startOffset:r,endOffset:i}=n.range,o=t===s&&r===i;e.parent.children=e.parent.children.flatMap((t=>{if(t.id===e.id){if(o)return this.insertNewNode(r,e);if(this.shouldSplitSelection(n.range)&&e.isContentEditable()){const s=this.splitTextNode(n.range,e);return t.annotationMap.has("LINK")&&t.apply(new Kt(s)),s}return this.setApplyTargetNode(e),e}return t}))}return this.applyTargetNode}insertNewNode(t,e){const n=e.cloneWithText("");this.setApplyTargetNode(n);const s=e.parent.children.findIndex((t=>t===e));return 0===t||!e.isContentEditable()&&t===s?[n,e]:t===e.text.length||!e.isContentEditable()&&t===s+1?[e,n]:[e.cloneWithText(e.text.substring(0,t)),n,e.cloneWithText(e.text.substring(t))]}shouldSplitSelection(t){const{startContainer:e,endContainer:n,startOffset:s,endOffset:r}=t;return e!==n||s>0||r<(n.textContent?n.textContent.length:0)}splitTextNode(t,e){const{startContainer:n,endContainer:s,startOffset:r}=t,i=n.parentElement,o=s.parentElement,c=(t,n,s)=>{const r=t.substring(0,n),i=t.substring(n,s),o=t.substring(s);return[e.cloneWithText(r),e.cloneWithText(i),e.cloneWithText(o)]},a=i&&A.getEntityByDOM(i),l=o&&A.getEntityByDOM(o);if(a&&a.id===e.id){const i=n===s?t.endOffset:e.text.length,[o,a,l]=c(e.text,r,i);return this.setApplyTargetNode(a),[o,a,l].filter((t=>!!t.text))}if(l&&l.id===e.id){const[n,s,r]=c(e.text,0,t.endOffset);return this.setApplyTargetNode(s),[n,s,r].filter((t=>!!t.text))}return this.setApplyTargetNode(e),e}setApplyTargetNode(t){this.applyTargetNode=t}}class Gt extends w{constructor(){super(...arguments),this.type=p.CLEAR_FORMATTING,this.items=[S.BOLD,S.ITALIC,S.UNDERLINE,S.STRIKETHROUGH,S.TEXT_COLOR,S.CODE,y.CUSTOM_STYLE]}}class zt extends nt{constructor(){super(...arguments),this.isFlushable=!0}toAnnotation(){return new Gt}}zt.typeName="ClearFormattingAnnotationAction";class Wt extends nt{constructor(t){super(),this.isFlushable=!0,this.code=t}toAnnotation(){return new Et(this.code)}}Wt.typeName="CodeAnnotationAction";class Vt extends nt{constructor(t){super(),this.isFlushable=!0,this.italic=t}toAnnotation(){return new Tt(this.italic)}}Vt.typeName="ItalicAnnotationAction";class Xt extends nt{constructor(t){super(),this.isFlushable=!0,this.strikethrough=t}toAnnotation(){return new yt(this.strikethrough)}}Xt.typeName="StrikethroughAnnotationAction";class qt extends nt{constructor(t){super(),this.isFlushable=!0,this.underline=t}toAnnotation(){return new Ot(this.underline)}}qt.typeName="UnderlineAnnotationAction";class Yt extends ft{handleAction(t,e){const n=t.toAnnotation();if(t instanceof dt)e.annotationMap.delete(t.annotationType);else{if(!(n instanceof Gt))return n instanceof L||n instanceof St?(t instanceof st&&(c(t.newText)&&(e.text=t.newText),e.parent.apply(new rt(t.link.groupKey,[e],t.type))),t instanceof Wt&&this.handleAction(new zt,e),t instanceof ht&&this.updateCustomStyleAnnotation(e,["fontWeight"]),t instanceof Vt&&this.updateCustomStyleAnnotation(e,["fontStyle"]),(t instanceof qt||t instanceof Xt)&&this.updateCustomStyleAnnotation(e,["textDecoration"]),void e.annotationMap.set(n.type,n)):void 0;n.items.forEach((t=>{e.deleteAnnotationByType(t)}))}}}class Zt extends T{constructor(){super(...arguments),this.type=x.DELETE_LINK_GROUP}}class Qt extends ft{handleAction(t,e){e.text=t.newTextContent,!e.text&&e.annotationMap.has("LINK")&&e.apply(new Zt)}}class te extends T{constructor(t){super(),this.type=x.UPDATE_TEXT,this.newTextContent="",this.newTextContent=t}}class ee extends ft{handleAction(t,e){this.replaceSelectedText(t.textToBeInsert,t.currentRange,e)}replaceSelectedText(t,e,n){if(e&&e.startContainer&&e.endContainer){const{startContainer:s,endContainer:r,startOffset:i,endOffset:o}=e;let c=n.text;if(s===r&&i===o&&t)c=n.text.slice(0,i)+t+n.text.slice(i);else{const e=s.parentElement,a=r.parentElement,l=e&&A.getEntityByDOM(e),u=a&&A.getEntityByDOM(a);let h=0,d=n.text.length;l&&l===n?(h=i,d=s===r?o:d):u&&u===n&&(d=o),c=n.text.slice(0,h)+t+n.text.slice(d)}n.apply(new te(c))}}}class ne extends w{constructor(t){super(),this.type=S.INLINE_HTML,this.htmlTag=t}static from(t){const{htmlTag:e,child:n,customStyle:s,customClass:r,customAttribute:i}=t,o=new ne(e);return o.groupId=t.groupId,o.child=n?ne.from(n)[1]:void 0,o.customAttribute=i?M.from(i)[1]:void 0,o.customClass=r?F.from(r)[1]:void 0,o.customStyle=s?P.from(s)[1]:void 0,[S.INLINE_HTML,o]}clone(){var t,e,n,s;const r=new ne(this.htmlTag);return r.groupId=this.groupId,r.child=null===(t=this.child)||void 0===t?void 0:t.clone(),r.customAttribute=null===(e=this.customAttribute)||void 0===e?void 0:e.clone(),r.customClass=null===(n=this.customClass)||void 0===n?void 0:n.clone(),r.customStyle=null===(s=this.customStyle)||void 0===s?void 0:s.clone(),r}renderProps(){var t,e,n;return Object.assign(Object.assign({},null===(t=this.customAttribute)||void 0===t?void 0:t.render()),{style:null===(e=this.customStyle)||void 0===e?void 0:e.renderStyle(),class:null===(n=this.customClass)||void 0===n?void 0:n.renderClass().join(" ")})}toJSON(){var t,e,n,s;return{inlineHtml:d({htmlTag:this.htmlTag,groupId:this.groupId,child:null===(t=this.child)||void 0===t?void 0:t.toJSON().inlineHtml,customAttribute:null===(e=this.customAttribute)||void 0===e?void 0:e.toJSON().customAttribute,customClass:null===(n=this.customClass)||void 0===n?void 0:n.toJSON().customClass,customStyle:null===(s=this.customStyle)||void 0===s?void 0:s.toJSON().customStyle})}}}class se extends ft{handleAction(t,e){const n=e.parent.getAnnotationByType(p.LINK_GROUP);if(n){const s=e.annotationMap.get("LINK").link.groupKey,r=n.linkGroups.get(s);if(r){const i=r.indexOf(e);-1!==i&&(r.splice(i,1,...Array.isArray(t.splittedTextNodes)?t.splittedTextNodes:[t.splittedTextNodes]),n.linkGroups.set(s,r))}}}}class re extends ft{handleAction(t,e){const n=e.parent.getAnnotationByType(p.LINK_GROUP);if(n){const t=e.annotationMap.get(S.LINK).link.groupKey,s=n.linkGroups.get(t);if(s){const r=s.indexOf(e);-1!==r&&s.splice(r,1),0===s.length&&n.linkGroups.delete(t),0===n.linkGroups.size&&e.parent.annotationMap.delete(p.LINK_GROUP)}}e.annotationMap.delete(S.LINK)}}class ie extends L{constructor(t){super(),this.type=S.PLAIN_TEXT,this.plainText=!0,this.plainText=t}static from(t){return[S.PLAIN_TEXT,new ie(t)]}get isFormattingOnly(){return!0}clone(){return new ie(this.plainText)}renderClass(){}renderStyle(){}toJSON(){return this.plainText?{plainText:this.plainText}:void 0}}class oe extends nt{constructor(t){super(),this.isFlushable=!0,this.textColor=t}toAnnotation(){return new Ht(this.textColor)}}oe.typeName="TextColorAnnotationAction";class ce extends U{constructor(t,e,n,s){super(t,s),this.type=O.TEXT,this.parent=n,this.text=e,this.registerModifyStrategy()}static supportsHtmlTag(t){return["span","code"].includes(t)}static from(t,e,n={autoMatchFormat:!0}){const s=new ce(t.id,t.text,e),{annotations:r}=t;return r&&(s.annotationMap=this.generateTextAnnotationMap(r,n,e,s)),s}static generateTextAnnotationMap(t,e,n,s){return new Map(Object.keys(t).map((r=>("link"===r&&t.link&&n&&s&&n.apply(new rt(t.link.groupKey,[s],"link")),this.createAnnotationEntity(r,t[r],e)))).filter(c))}static createAnnotationEntity(t,e,n){const s=!(!n||!n.autoMatchFormat);switch(t){case"bold":return ut.from(e);case"italic":return Tt.from(e);case"underline":return Ot.from(e);case"strikethrough":return yt.from(e);case"code":return Et.from(e,s);case"textColor":return Ht.from(e);case"link":return et.from(e,s);case"inlineHtml":return ne.from(e);case"plainText":return ie.from(e)}return U.createAnnotationEntity(t,e)}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof L||t instanceof D||t instanceof ne)).reduce(((t,e)=>Object.assign(Object.assign({},t),e.toJSON())),{});return Object.assign(Object.assign({id:this.id},Object.keys(t).length>0?{annotations:t}:{}),{type:"text",text:this.text})}toHtml(t){const e=this.getAnnotationByType(S.INLINE_HTML);return e?this.renderWithWrapperStr(e,t):this.renderTextStr(t)}cloneWithText(t){return new ce(u(),t,this.parent,super.cloneAnnotations())}clone(t){return new ce(this.id,this.text,t,super.cloneAnnotations())}isEmpty(){return!(this.getAnnotationByType(S.INLINE_HTML)||this.text&&"​"!==this.text&&"\n"!==this.text)}isTextNode(){return!0}getRangeEndOffset(){return!this.isContentEditable()&&this.parent?this.parent.children.indexOf(this)+1:"\n"===this.text?0:this.text.length}getRangeContainer(){const t=this.getElementRef();if(t)return this.isContentEditable()?t.firstChild:t.parentElement}isContentEditable(){return!0}getPlainText(){return this.text}getInlineHtmlTagAtDepth(t){const e=this.getInlineHtmlAnnotationAtDepth(t);return e?jt.has(e.htmlTag)?null:{htmlTag:e.htmlTag,attrStr:this.annotationAttrStr(e),groupId:e.groupId,annotation:e}:null}renderHtmlFromDepth(t,e){if(0===t)return this.toHtml(e);const n=this.getInlineHtmlAnnotationAtDepth(t);return n?this.renderWithWrapperStr(n,e):this.renderTextStr(e)}getInlineHtmlAnnotationAtDepth(t){let e=this.getAnnotationByType(S.INLINE_HTML);for(let n=0;n<t&&e;n++)e=e.child;return e}registerModifyStrategy(){const t=this.typeName;ce.registerActionStrategyStatus[t]||(this.isContentEditable()&&(B.register(x.UPDATE_TEXT,t,new Qt),B.register(x.REPLACE_SELECTED_TEXT,t,new ee),B.register(x.LINK_GROUP_NODE_SPLIT,t,new se),B.register(st.typeName,t,new Yt)),B.register(nt.typeName,t,new Ut),B.register(x.DELETE_LINK_GROUP,t,new re),B.register(ht.typeName,t,new Yt),B.register(zt.typeName,t,new Yt),B.register(Vt.typeName,t,new Yt),B.register(qt.typeName,t,new Yt),B.register(oe.typeName,t,new Yt),B.register(Xt.typeName,t,new Yt),B.register(Wt.typeName,t,new Yt),B.register(Q.typeName,t,new Yt),ce.registerActionStrategyStatus[t]=!0)}doAnnotationActionApply(t){const e=this.getAnnotationByType(p.SELECTION_RANGE);if(t instanceof nt&&t.doSplit&&e){const e=B.get(nt.typeName,this.typeName);if(e){const n=e.execute(t,this);n&&this.applyActionToNode(n,t)}}else this.applyActionToNode(this,t);"function"==typeof this.parent.mergeNodes&&this.parent.mergeNodes(t)}doModifyActionApply(t){B.executeTheStrategy(t,this)}applyActionToNode(t,e){const n=e.toAnnotation();if(e instanceof Jt)return void this.syncUpSelectedNodes(t);n instanceof St||this.syncUpSelectedNodes(t);const s=B.get(e.typeName,t.typeName);if(s)return void s.execute(e,t);const r=B.get(Q.typeName,ce.typeName);r&&r.execute(e,t)}syncUpSelectedNodes(n){const r=this.getElementRef();if(r){const i=e.getSubjectFromParentNodeByEventId(r,s);i&&t.notify(i,{node:n})}}renderWithWrapperStr(t,e){const{htmlTag:n,child:s}=t,r=this.annotationAttrStr(t);return s?`<${n}${r}>${this.renderWithWrapperStr(s,e)}</${n}>`:jt.has(n)?`<${n}${r}>`:this.text?`<${n}${r}>${this.renderTextStr(e)}</${n}>`:`<${n}${r}></${n}>`}annotationAttrStr(t){const{customAttribute:e,customClass:n,customStyle:s}=t,r=[...(null==e?void 0:e.toString())||[],null==n?void 0:n.toString(),null==s?void 0:s.toString()].filter(c);return r.length>0?` ${r.join(" ")}`:""}renderTextStr(t){var e;const n=(null===(e=this.getAnnotationByType(S.CODE))||void 0===e?void 0:e.code)?"code":"span",s=super.generateAttributeString(t);return"\n"===this.text?"<br>":this.shouldSkipEmptyFormattingMarker()?"":this.shouldRenderAsPlainText()?this.text:`<${n}${s}>${"code"===n?N(this.text):this.text}</${n}>`}shouldSkipEmptyFormattingMarker(){return""===this.text&&this.annotationMap.size>0&&Array.from(this.annotationMap.values()).every((t=>t.isFormattingOnly))}shouldRenderAsPlainText(){const t=super.getAnnotationByType(S.PLAIN_TEXT);return!!t&&t.plainText&&0===Array.from(this.annotationMap.values()).filter((t=>t instanceof L&&!(t instanceof et)&&!(t instanceof ie)||t instanceof D)).length}}ce.registerActionStrategyStatus={},ce.htmlTag="span",ce.typeName="RTETextNode";class ae extends ft{handleAction(t,e){const n=t.blockNeedToBeMerged;if(e.type===n.type||"image"!==e.type&&"image"!==n.type){let t=n.children;"image"!==n.type&&(t=n.children.filter((t=>t.text))),e.apply(new W(t)),"image"!==e.type&&this.transferLinkGroups(t,e),n.parent.apply(new xt(n))}}transferLinkGroups(t,e){t.forEach((t=>{if(!(t instanceof ce))return;const n=t.getAnnotationByType(S.LINK);n&&e.apply(new rt(n.link.groupKey,[t],"link"))}))}}class le extends ft{handleAction(t,e){t.lineBreakNode=this.lineBreakSingleBlock(t.startContainerNode,t.startOffset,e)}lineBreakSingleBlock(t,e,n){if(t){const s=new ce(u(),"\n",n),r=t.text.slice(0,e),i=t.text.slice(e),o=n.children.indexOf(t);if(o>-1){const c=n.children.slice(0,o),a=n.children.slice(o+1);t.isContentEditable()?(r&&c.push(t.cloneWithText(r)),i&&a.unshift(t.cloneWithText(i))):e>0?c.push(t):a.unshift(t),this.mergeLineBreakNodes(c,s,a,n)}return s}}mergeLineBreakNodes(t,e,n,s){if(0===n.length||n[0]&&""===n[0].text){const e=t[t.length-1];n.push(new ce(u(),"\n",s,e&&new Map(e.annotationMap)))}s.apply(new wt([...t,e,...n]))}}class ue extends ft{handleAction(t,e){t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks,e)}lineBreakMultipleBlocks(t,e){const n=e.children,s=new ce(u(),"\n",e),r=this.concatBlocksNodes(t.slice(1));return this.mergeLineBreakNodes(n,s,r,e),s}concatBlocksNodes(t){const e=[];return t.map((t=>{"image"!==t.type&&(e.push(...t.children),t.parent.apply(new xt(t)))})),e}mergeLineBreakNodes(t,e,n,s){(0===n.length||n[0]&&""===n[0].text)&&n.push(new ce(u(),"\n",s,t[t.length-1]&&t[t.length-1].annotationMap)),s.apply(new wt([...t,e,...n]))}}class he extends T{constructor(t,...e){super(),this.type=x.INSERT_CHILDREN_BEFORE,this.referChildren=t,this.childrenToBeInserted=e}}class de extends T{constructor(t,e){super(),this.type=x.SPLIT_BLOCK_WITH_NODE,this.splitPointNode=t,this.startOffsetOfNode=e}}function fe(t,e){const n=new Set(t.filter((t=>"RTEListItemBlock"===t.typeName)));return t.filter((t=>{if("RTEListItemBlock"!==t.typeName)return!0;let s=t.parent;for(;s.parent&&"RTEListItemBlock"===s.parent.typeName;){const r=s.parent;if(n.has(r))return t.parent.type=e,!1;s=r.parent}return!0}))}class pe extends Q{constructor(t){super(),this.isFlushable=!0,this.textAlign=t}toAnnotation(){return new _(this.textAlign)}}pe.typeName="HorizontalAlignmentAnnotationAction";class ge extends ft{handleAction(t,e){this.updateCustomStyleAnnotation(e,["textAlign"])}}class we extends Q{constructor(t){super(),this.isFlushable=!0,this.indent=t}toAnnotation(){return new $(this.indent)}}we.typeName="IndentAnnotationAction";class me extends z{constructor(t,e,n){super(t),this.children=[],this.type=e;const{autoMatchFormat:s}=n||{autoMatchFormat:!0};s&&(this.annotationMap=me.isAcceptableTextStyle(e)?new Map([Z.from(e)]):new Map([Z.from("paragraph")]))}static from(t,e={autoMatchFormat:!0}){var n,s;const r=new me(t.id,t.type,e),i=e.autoMatchFormat?Object.assign(Object.assign({},t.annotations),{textStyle:null!==(s=null===(n=t.annotations)||void 0===n?void 0:n.textStyle)&&void 0!==s?s:r.type}):t.annotations;return r.children=me.convertNodes(t.nodes,r,e),i&&super.convertAnnotationsToMap(r.annotationMap,i),r}static convertNodes(t,e,n){return t.map((t=>{const s=G.getRTENodeClass(t.type);if(s)return s.from(t,e,n)})).filter(c)}static createAnnotationEntity(t,e){return"textStyle"===t?Z.from(e):super.createAnnotationEntity(t,e)}static isAcceptableTextStyle(t){return["title","subtitle","paragraph","heading-1","heading-2","heading-3","heading-4","heading-5","heading-6"].includes(t)}mergeNodes(t){this.children=this.children.reduce(((e,n)=>{const s=e.at(-1);if(t instanceof st&&t.needMergeNode){const t=null==s?void 0:s.getAnnotationByType(S.LINK),r=n.getAnnotationByType(S.LINK);if(t&&r&&t.toEqual(r))return e}return[...e,n]}),[])}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:this.type,nodes:this.children.map((t=>t.toJSON()))})}toHtml(t){const e=this.getBlockTag(),n=super.generateAttributeString(t),s=this.getChildrenHtml(t);return super.shouldRenderAsInternalWrapper()?s:[`<${e}${n}>`,s,`</${e}>`].join("")}cloneWithNodes(t){const e=new me(u(),this.type);return e.annotationMap=super.cloneAnnotations(),e.apply(new W(t)),e}clone(t){const e=new me(this.id,this.type);return e.children=this.children.map((t=>t.clone(e))),e.annotationMap=super.cloneAnnotations(),e.parent=t,e}isNotEmpty(){return this.children.length>0&&this.children.some((t=>!t.isEmpty()))}getLastNode(){return this.children[this.children.length-1]}getBlockTag(){switch(this.type){case"title":case"subtitle":return"div";case"heading-1":return"h1";case"heading-2":return"h2";case"heading-3":return"h3";case"heading-4":return"h4";case"heading-5":return"h5";case"heading-6":return"h6";case"paragraph":default:return"p"}}getChildrenHtml(t){if(!this.isNotEmpty())return"<br>";const e=this.getAnnotationByType(p.LINK_GROUP);let n=this.renderGroupedNodesAtDepth(this.children,0,t);return e&&this.children.length>0&&(n=this.generateLinkHtml(e,n,t)),n}doAnnotationActionApply(t){const e=B.get(t.typeName,me.typeName);e&&e.execute(t,this)}renderGroupedNodesAtDepth(t,e,n){var s;let r="",i=0;for(;i<t.length;){const o=t[i].getInlineHtmlTagAtDepth(e);if(!(null==o?void 0:o.groupId)){r+=t[i].renderHtmlFromDepth(e,n),i++;continue}let c=i+1;for(;c<t.length&&(null===(s=t[c].getInlineHtmlTagAtDepth(e))||void 0===s?void 0:s.groupId)===o.groupId;)c++;if(c===i+1)r+=t[i].renderHtmlFromDepth(e,n);else{const s=this.renderGroupedNodesAtDepth(t.slice(i,c),e+1,n);r+=`<${o.htmlTag}${o.attrStr}>${s}</${o.htmlTag}>`}i=c}return r}generateLinkHtml(t,e,n){e="";let s=[];for(let r=0;r<this.children.length;r++){const i=this.children[r].getAnnotationByType(S.LINK),o=this.children[r+1]?this.children[r+1].getAnnotationByType(S.LINK):null;if(i){if(s.push(this.children[r]),!o||i.link.groupKey!==o.link.groupKey){const r=t.toString(i,{standalone:!0,filterInlineStyles:null==n?void 0:n.filterInlineStyles});e+=[`<a${r?` ${r}`:""}>`,this.renderGroupedNodesAtDepth(s,0,n),"</a>"].join(""),s=[]}}else e+=this.children[r].toHtml(n)}return e}}me.typeName="RTETextBlock",B.register(tt.typeName,me.typeName,new pt),B.register(pe.typeName,me.typeName,new ge),B.register(we.typeName,me.typeName,new class extends ft{handleAction(t,e){this.updateCustomStyleAnnotation(e,["marginLeft"])}}),B.register(rt.typeName,me.typeName,new class extends ft{handleAction(t,e){let n=e.getAnnotationByType(p.LINK_GROUP);if("update_link"===t.type){if(n){const e=n.linkGroups.get(t.groupKey);e&&n.linkGroups.set(t.groupKey,[e[0]])}}else{if(n){const e=n.linkGroups.get(t.groupKey)||[];n.linkGroups.set(t.groupKey,[...e,...t.nodes])}else n=t.toAnnotation(),n.linkGroups.set(t.groupKey,[...t.nodes]);e.annotationMap.set(p.LINK_GROUP,n)}}}),B.register(x.UNLINK_LINK_GROUP,me.typeName,new class extends ft{handleAction(t,e){const n=e.getAnnotationByType(p.LINK_GROUP);n&&(n.linkGroups.size>1?n.linkGroups.delete(t.groupKey):e.annotationMap.delete(p.LINK_GROUP))}}),B.register(x.SPLIT_BLOCK_WITH_NODE,me.typeName,new mt),B.register(x.REPLACE_CHILD_NODES,me.typeName,new At),B.register(x.MERGE_TWO_BLOCKS_NODES,me.typeName,new ae),B.register(x.LINE_BREAK_SINGLE_BLOCK,me.typeName,new le),B.register(x.LINE_BREAK_MULTIPLE_BLOCKS,me.typeName,new ue),B.register(x.INSERT_IMAGE_TO_BLOCK,me.typeName,new class extends ft{handleAction(t,e){const n=t.splitPointNode,s=t.startOffsetOfNode,r=t.imageBlockToBeInserted;if(this.isCaretPositionAtBlockEnd(e,n,s))e.parent.apply(new gt(e,r));else if(this.isCaretPositionAtBlockStart(e,n,s))e.parent.apply(new he(e,r));else{const t=new de(n,s);e.apply(t),e.parent.apply(new gt(e,r))}}}),B.register(x.TRANSFORM_LIST_BLOCK,me.typeName,new class extends ft{handleAction(t,e){const n=this.getRootContent(e);if(!n)return;const s=e.parent,r=n.createList(t.listType),i=fe(t.selectedBlocks,t.listType),o=i.map((t=>n.toListItem(t)));r.apply(new W(o)),s.apply(new gt(t.selectedBlocks[0],r)),i.forEach((t=>{t.parent.apply(new xt(t))}))}});class Ae extends ft{copyListAnnotations(t,e){t.annotationMap.forEach(((t,n)=>{e.annotationMap.set(n,t.clone())}))}haveSameListAnnotations(t,e){var n,s;const r=Array.from(t.annotationMap.keys()).sort(),i=Array.from(e.annotationMap.keys()).sort();return JSON.stringify(r)===JSON.stringify(i)&&JSON.stringify(this.normalizeAnnotationValue(null!==(n=t.toJSON().annotations)&&void 0!==n?n:{}))===JSON.stringify(this.normalizeAnnotationValue(null!==(s=e.toJSON().annotations)&&void 0!==s?s:{}))}normalizeAnnotationValue(t){if(Array.isArray(t))return t.map((t=>this.normalizeAnnotationValue(t)));if(t&&"object"==typeof t){const e=t;return Object.keys(e).sort().reduce(((t,n)=>(t[n]=this.normalizeAnnotationValue(e[n]),t)),{})}return t}}class xe extends me{constructor(t,e,n){super(t,"list-item",n),this.nestList=[],this.nestList=e}static from(t,e={autoMatchFormat:!0}){const n=new xe(t.id,void 0,e);n.children=xe.convertNodes(t.nodes,n,e),t.children&&(n.nestList=t.children.map((t=>{const s=Ne.from(t,e);return s.parent=n,s})));const{annotations:s}=t;return s&&Object.entries(s).forEach((([t,e])=>{const s=this.createAnnotationEntity(t,e);c(s)&&n.annotationMap.set(...s)})),n}toJSON(){var t;return Object.assign(Object.assign({},super.toJSON()),{type:"list-item",children:null===(t=this.nestList)||void 0===t?void 0:t.map((t=>t.toJSON()))})}toHtml(t){var e;const n=super.generateAttributeString(t),s=(null===(e=this.nestList)||void 0===e?void 0:e.length)?this.nestList.map((e=>e.toHtml(t))).join(""):"";return[`<li${n}>`,this.getChildrenHtml(t),s,"</li>"].join("")}cloneWithNodes(t){const e=new xe(u());return e.children=[],e.apply(new W(t)),e}getLastNode(){return this.nestList&&this.nestList.length>0?this.nestList[this.nestList.length-1].getLastNode():super.getLastNode()}getPlainText(){var t;const e=(null!==(t=this.nestList)&&void 0!==t?t:[]).map((t=>t.getPlainText())).join("");return super.getPlainText()+e}createNewListItem(){return new xe(u())}clone(t){var e;const n=new xe(this.id);return n.children=this.children.map((t=>t.clone(n))),n.annotationMap=super.cloneAnnotations(),n.nestList=null===(e=this.nestList)||void 0===e?void 0:e.map((t=>t.clone(n))),n.parent=t,n}}xe.typeName="RTEListItemBlock",B.register(tt.typeName,xe.typeName,new pt),B.register(pe.typeName,xe.typeName,new ge),B.register(x.LINE_BREAK_SINGLE_BLOCK,xe.typeName,new le),B.register(x.LINE_BREAK_MULTIPLE_BLOCKS,xe.typeName,new ue),B.register(x.DELETE_NEST_LIST,xe.typeName,new class extends ft{handleAction(t,e){e.nestList&&(e.nestList=e.nestList.length>1?e.nestList.filter((e=>e!==t.nestListBlockToBeRemoved)):void 0)}}),B.register(x.SPLIT_BLOCK_WITH_NODE,xe.typeName,new mt),B.register(x.REPLACE_CHILD_NODES,xe.typeName,new At),B.register(x.REPLACE_NEST_LIST,xe.typeName,new class extends Ae{handleAction(t,e){const n=this.mergeAdjacentSameType(t.newList);n.forEach((t=>{t.parent=e})),e.nestList=n}mergeAdjacentSameType(t){if(t.length<=1)return t;const e=[t[0]];for(let n=1;n<t.length;n++){const s=e[e.length-1],r=t[n];s.type===r.type&&this.haveSameListAnnotations(s,r)?(r.children.forEach((t=>{t.parent=s})),s.children=s.children.concat(r.children)):e.push(r)}return e}}),B.register(x.MERGE_TWO_BLOCKS_NODES,xe.typeName,new ae),B.register(x.INSERT_IMAGE_TO_BLOCK,xe.typeName,new class extends ft{handleAction(t,e){e.parent.apply(t)}});class Se extends T{constructor(t){super(),this.type=x.REPLACE_NEST_LIST,this.newList=t}}class ye extends T{constructor(t){super(),this.type=x.TRANSFORM_PARAGRAPH_BLOCK,this.isFlushable=!0,this.selectedBlocks=t}}class Oe extends z{constructor(t,e){super(t),this.type="html-block",this.children=[],this.htmlTag=e}static from(t,e){const n=new Oe(t.id,t.htmlTag),{annotations:s}=t;return s&&super.convertAnnotationsToMap(n.annotationMap,s),n.children=this.generateBlockChildren(t.children,e,n),n}clone(t){const e=new Oe(this.id,this.htmlTag);return e.children=this.children.map((t=>t.clone(e))),e.annotationMap=super.cloneAnnotations(),e.parent=t,e}getLastNode(){return this.children[this.children.length-1].getLastNode()}isNotEmpty(){return!0}toHtml(t){const e=this.htmlTag,n=super.generateAttributeString(t);return jt.has(this.htmlTag)?`<${e}${n}>`:[`<${e}${n}>`,this.children.map((e=>e.toHtml(t))).join(""),`</${e}>`].join("")}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{id:this.id,type:this.type,htmlTag:this.htmlTag,children:this.children.map((t=>t.toJSON()))})}}Oe.typeName="RTEHtmlBlock";class Te extends ft{getOrderedContiguousItems(t,e){const n=[...e].sort(((e,n)=>t.children.indexOf(e)-t.children.indexOf(n))),s=t.children.indexOf(n[0]);return s<0?[]:t.children.slice(s,s+n.length).every(((t,e)=>t===n[e]))?n:[]}}class Ee extends T{constructor(t){super(),this.type=x.DELETE_NEST_LIST,this.nestListBlockToBeRemoved=t}}class ve extends m{constructor(){super(...arguments),this.type=g.LIST}static getDefaultStyles(){return{paddingLeft:"8px",marginLeft:"16px"}}static getDefaultMarkerStyles(){return{fontSize:"16px"}}renderStyle(t){return(null==t?void 0:t.standalone)?ve.getDefaultStyles():null}renderClass(t){return(null==t?void 0:t.standalone)?null:"v-rte--list"}clone(){return new ve}toJSON(){}}class Ne extends z{constructor(t,e,n){super(t),this.type="bullet-list",this.children=[],this.type=e;const{autoMatchFormat:s}=n||{autoMatchFormat:!0};s&&this.annotationMap.set(g.LIST,new ve)}static from(t,e={autoMatchFormat:!0}){const n=new Ne(t.id,t.type,e),{annotations:s}=t;return s&&Object.entries(s).forEach((([t,e])=>{const s=this.createAnnotationEntity(t,e);c(s)&&n.annotationMap.set(...s)})),n.children=t.blocks.map((t=>{const s=xe.from(t,e);return s.parent=n,s})),n}static createAnnotationEntity(t,e){switch(t){case"customAttribute":return M.from(e);case"customClass":return F.from(e);case"customStyle":return P.from(e)}}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{id:this.id,type:this.type,blocks:this.children.map((t=>t.toJSON()))})}toHtml(t){const e=this.getBlockTag();return[`<${e}${super.generateAttributeString(t)}>`,this.children.map((e=>e.toHtml(t))).join(""),`</${e}>`].join("")}isNotEmpty(){return this.children.length>0}getLastNode(){return this.children[this.children.length-1].getLastNode()}clone(t){const e=new Ne(this.id,this.type);return e.children=this.children.map((t=>t.clone(e))),e.annotationMap=super.cloneAnnotations(),e.parent=t,e}getBlockTag(){return"number-list"===this.type?"ol":"ul"}}Ne.typeName="RTEListBlock",B.register(x.TRANSFORM_LIST_BLOCK,Ne.typeName,new class extends Ae{handleAction(t,e){var n;const s=t.selectedBlocks,r=s.every((t=>t.parent===e)),i=this.getRootContent(e);if(!i)return;if(e.parent instanceof xe){if(r){const r=this.createListFromSource(i,e,t.listType);r.apply(new W(e.children));const o=e.parent,c=(null!==(n=o.nestList)&&void 0!==n?n:[]).map((t=>t===e?r:t));o.apply(new Se(c)),s.forEach((t=>t.children.map((t=>t.apply(new Jt)))))}else this.handleCrossListTransform(t,e);return}if(!r&&s.every((t=>t instanceof xe))){const e=new Set(s.map((t=>t.parent))),n=new Set;e.forEach((e=>{e.type!==t.listType&&this.convertListTypeInPlace(e,t.listType)}));const r=new Set;return s.forEach((t=>{const e=t.parent;e.parent instanceof xe||(n.add(e),r.add(e.parent))})),r.forEach((t=>{for(let e=0;e<t.children.length-1;){const s=t.children[e],r=t.children[e+1];s instanceof Ne&&r instanceof Ne&&s.type===r.type&&this.haveSameListAnnotations(s,r)&&n.has(s)&&n.has(r)?(s.apply(new W([...r.children])),t.apply(new xt(r)),n.delete(r)):e++}})),void s.forEach((t=>t.children.map((t=>t.apply(new Jt)))))}const o=this.createListFromSource(i,e,t.listType),c=e.parent;if(r)o.apply(new W(e.children)),c.apply(new gt(e,o)),c.apply(new xt(e)),s.forEach((t=>t.children.map((t=>t.apply(new Jt)))));else{const n=fe(t.selectedBlocks,t.listType),s=n.map((t=>i.toListItem(t)));o.apply(new W(s)),c.apply(new gt(e,o)),n.forEach((t=>{t.parent.apply(new xt(t))})),0===e.children.length&&c.apply(new xt(e))}}convertListTypeInPlace(t,e){var n;const s=this.getRootContent(t);if(!s)return;const r=t.parent,i=this.createListFromSource(s,t,e);if(i.apply(new W([...t.children])),r instanceof xe){const e=(null!==(n=r.nestList)&&void 0!==n?n:[]).map((e=>e===t?i:e));r.apply(new Se(e))}else r.apply(new gt(t,i)),r.apply(new xt(t))}handleCrossListTransform(t,e){if(!(e.parent instanceof xe))return;const n=this.getRootContent(e);if(!n)return;const s=e.parent,r=s.nestList,i=new Set(t.selectedBlocks.filter((t=>t instanceof xe)).map((t=>t.parent)).filter((t=>r.includes(t))));if(!i.size)return;const o=r.map((e=>{if(!i.has(e))return e;const s=this.createListFromSource(n,e,t.listType);return s.apply(new W(e.children)),s}));s.apply(new Se(o)),t.selectedBlocks.forEach((t=>t.children.map((t=>t.apply(new Jt)))))}createListFromSource(t,e,n){const s=t.createList(n);return this.copyListAnnotations(e,s),s}}),B.register(x.TRANSFORM_PARAGRAPH_BLOCK,Ne.typeName,new class extends Ae{handleAction(t,e){const n=this.getSelectedSegments(t.selectedBlocks);0!==n.length&&this.hasConsistentTargetAndRoot(n,e)&&(this.syncSelection(n),[...n].reverse().forEach((t=>this.transformSegment(t))))}hasConsistentTargetAndRoot(t,e){if(t[0][0].parent!==e)return!1;const n=this.getRootContent(e);return Boolean(n&&t.every((t=>t.every((t=>this.getRootContent(t)===n)))))}syncSelection(t){t.forEach((t=>{t.forEach((t=>{t.children.forEach((t=>t.apply(new Jt)))}))}))}transformSegment(t){const e=t[0].parent,n=new ye(t);e.parent instanceof xe?this.handleNestedListCase(n,e):this.handleRootListCase(n,e)}handleRootListCase(t,e){const n=this.getRootContent(e);let s=!1,r=!1;const i=t.selectedBlocks,o=[];if(i.forEach((t=>{var n;t===e.children[0]&&(s=!0),t===e.children[e.children.length-1]&&(r=!0),o.push(this.toParagraph(t));for(const e of null!==(n=t.nestList)&&void 0!==n?n:[])this.appendListBlock(o,e)})),s)e.parent.apply(new he(e,...o));else if(r)e.parent.apply(new gt(e,...o));else{const t=e.children.indexOf(i[0]),s=e.children.indexOf(i[i.length-1]),r=this.createListFromSource(n,e);r.apply(new W(e.children.slice(0,t)));const c=this.createListFromSource(n,e);c.apply(new W(e.children.slice(s+1)));const a=o[o.length-1];a instanceof Ne&&c.children.length>0&&a.type===c.type&&this.haveSameListAnnotations(a,c)?(a.apply(new W(c.children)),e.parent.apply(new he(e,r,...o))):e.parent.apply(new he(e,r,...o,c)),e.parent.apply(new xt(e))}if(i.map((t=>{t.nestList=[],e.apply(new xt(t))})),0===e.children.length)e.parent.apply(new xt(e));else if(s){const t=o[o.length-1];t instanceof Ne&&t.type===e.type&&this.haveSameListAnnotations(t,e)&&(t.apply(new W([...e.children])),e.parent.apply(new xt(e)))}}handleNestedListCase(t,e){const n=t.selectedBlocks,s=this.getRootContent(e),r=e.children.indexOf(n[0]),i=[];n.forEach((t=>{var e;i.push(this.toParagraph(t));for(const n of null!==(e=t.nestList)&&void 0!==e?e:[])this.appendListBlock(i,n)}));const o=e.children.indexOf(n[n.length-1]),c=e.children.slice(o+1),a=[];let l=e;for(;l.parent instanceof xe;){const t=l.parent,e=t.parent,n=e.children.indexOf(t),s=t.nestList,r=s.indexOf(l),i=s.slice(r+1);a.push({list:e,ancestorIndex:n,trailingNestLists:i}),l=e}const u=l,h=u.parent,d=[];c.length>0&&d.push({items:c,sourceList:e});for(const t of a){for(const e of t.trailingNestLists)e.children.length>0&&d.push({items:[...e.children],sourceList:e});const e=t.list.children.slice(t.ancestorIndex+1);e.length>0&&d.push({items:e,sourceList:t.list})}const f=[];for(const t of d){const e=f[f.length-1];e&&e.sourceList.type===t.sourceList.type&&this.haveSameListAnnotations(e.sourceList,t.sourceList)?e.items.push(...t.items):f.push({items:[...t.items],sourceList:t.sourceList})}f.map((t=>{const e=this.createListFromSource(s,t.sourceList);return e.apply(new W(t.items)),e})).forEach((t=>this.appendListBlock(i,t))),e.children=e.children.slice(0,r);const p=e.parent,g=p.nestList,w=g.indexOf(e);let m=g.slice(0,w+1);0===e.children.length&&(m=m.filter((t=>t!==e))),p.apply(new Se(m));for(const t of a)if(t.list.children=t.list.children.slice(0,t.ancestorIndex+1),t.trailingNestLists.length>0){const e=t.list.children[t.ancestorIndex],n=e.nestList,s=n.indexOf(t.trailingNestLists[0]);if(s>=0){const t=n.slice(0,s);e.apply(new Se(t))}}h.apply(new gt(u,...i))}getSelectedSegments(t){const e=Array.from(new Set(t.filter((t=>t instanceof xe)))).map((t=>({item:t,path:this.getStructuralPath(t)}))).filter((t=>null!==t.path)).sort(((t,e)=>this.compareStructuralPaths(t.path,e.path))).map((t=>t.item)),n=[];for(const t of e){const e=n[n.length-1],s=null==e?void 0:e[e.length-1];(null==s?void 0:s.parent)===t.parent&&t.parent.children.indexOf(t)-t.parent.children.indexOf(s)==1?e.push(t):n.push([t])}return n}getStructuralPath(t){var e;const n=[],s=new Set;let r=t,i=t.parent;for(;!s.has(i);){s.add(i);const t=i.children.indexOf(r);if(t<0)return null;if(n.unshift(t),"VegaRTEContent"===i.parent.typeName||"RTEHtmlBlock"===i.parent.typeName){const t=this.getContainerPath(i);return t?[...t,...n]:null}if(!(i.parent instanceof xe))return null;const o=i.parent,c=(null!==(e=o.nestList)&&void 0!==e?e:[]).indexOf(i);if(c<0)return null;n.unshift(c),r=o,i=o.parent}return null}getContainerPath(t){const e=[],n=new Set;let s=t,r=t.parent;for(;r instanceof Oe;){if(n.has(r))return null;n.add(r);const t=r.children.indexOf(s);if(t<0)return null;e.unshift(t),s=r,r=r.parent}const i=r.children.indexOf(s);return i<0?null:(e.unshift(i),e)}compareStructuralPaths(t,e){const n=Math.min(t.length,e.length);for(let s=0;s<n;s++)if(t[s]!==e[s])return t[s]-e[s];return t.length-e.length}appendListBlock(t,e){const n=t[t.length-1];n instanceof Ne&&n.type===e.type&&this.haveSameListAnnotations(n,e)?n.apply(new W([...e.children])):t.push(e)}createListFromSource(t,e){const n=t.createList(e.type);return this.copyListAnnotations(e,n),n}toParagraph(t){const e=new me(u(),"paragraph");return e.apply(new W(t.children)),e.annotationMap=t.annotationMap,e}}),B.register(x.INSERT_IMAGE_TO_BLOCK,Ne.typeName,new class extends ft{handleAction(t,e){e.parent.apply("list-item"!==e.parent.type?new gt(e,t.imageBlockToBeInserted):t)}}),B.register(x.NEST_LIST_ITEMS,Ne.typeName,new class extends Te{handleAction(t,e){var n,s;const r=this.getOrderedContiguousItems(e,t.selectedBlocks);if(!r.length)return;const i=e.children.indexOf(r[0]);if(i<=0)return;const o=e.children[i-1],c=new Set(r);let a=null===(n=o.nestList)||void 0===n?void 0:n[o.nestList.length-1];a||(a=new Ne(u(),e.type),o.apply(new Se([...null!==(s=o.nestList)&&void 0!==s?s:[],a]))),e.children=e.children.filter((t=>!c.has(t))),a.children=a.children.concat(r),r.forEach((t=>{var e;t.parent=a,(null===(e=t.nestList)||void 0===e?void 0:e.length)&&this.unifyDescendantNestLists(t,t.nestList[0].type),t.children.forEach((t=>t.apply(new Jt)))}))}unifyDescendantNestLists(t,e){var n;if(!(null===(n=t.nestList)||void 0===n?void 0:n.length))return;let s=!1;for(const n of t.nestList){n.type!==e&&(n.type=e,s=!0);for(const t of n.children)this.unifyDescendantNestLists(t,e)}s&&t.apply(new Se([...t.nestList]))}}),B.register(x.UNNEST_LIST_ITEMS,Ne.typeName,new class extends Te{handleAction(t,e){var n;const s=this.getOrderedContiguousItems(e,t.selectedBlocks),r=e.parent;if(!(s.length&&r instanceof xe))return;const i=e.children.indexOf(s[0]),o=e.children.indexOf(s[s.length-1]);if(i<0||o<i)return;const c=r,a=c.parent,l=a.children.indexOf(c);if(l<0)return;const h=e.children.slice(o+1),d=new Set(s);if(e.children=e.children.filter((t=>!d.has(t))),a.children=[...a.children.slice(0,l+1),...s,...a.children.slice(l+1)],s.forEach((t=>{t.parent=a,t.children.forEach((t=>t.apply(new Jt)))})),h.length>0){const t=new Set(h);e.children=e.children.filter((e=>!t.has(e)));const r=s[s.length-1];let i=null===(n=r.nestList)||void 0===n?void 0:n[r.nestList.length-1];if(i&&i.type!==e.type&&(i=null),!i){i=new Ne(u(),e.type);const t=Array.isArray(r.nestList)?r.nestList:[];r.apply(new Se([...t,i]))}i.children=i.children.concat(h),h.forEach((t=>{t.parent=i}))}const f=this.collectTrailingNestLists(c,e);if(f.length>0){const t=s[s.length-1],e=Array.isArray(t.nestList)?t.nestList:[];t.apply(new Se([...e,...f]))}0===e.children.length&&c.apply(new Ee(e))}collectTrailingNestLists(t,e){var n;const s=null!==(n=t.nestList)&&void 0!==n?n:[],r=s.indexOf(e);if(r<0||r>=s.length-1)return[];const i=s.slice(r+1);return t.apply(new Se(s.slice(0,r+1))),i}});class be extends ft{getPreviousNode(t){var e;const n=t.parent,s=n.children.indexOf(t);if(s>0)return n.children[s-1];if(n.parent){if(n.isListItemBlock()&&0===n.parent.children.indexOf(n)&&n.parent.parent instanceof xe){const t=n.parent.parent;if(0!==(null!==(e=t.nestList)&&void 0!==e?e:[]).indexOf(n.parent)){const t=this.getPreviousBlock(n);return t?this.getBlockLastNode(t):null}const s=t.children;return s.length>0?s[s.length-1]:null}const t=this.getPreviousBlock(n);if(t)return this.getBlockLastNode(t)}}getNextNode(t){const e=t.parent,n=e.children.indexOf(t);if(e.children[n+1])return e.children[n+1];if(e.parent){const t=this.getNextBlock(e);if(t)return this.getBlockFirstNode(t)}}isContentFirstNode(t){const e=t.parent,n=e.children.indexOf(t),s=e.parent;if(e.isListItemBlock()){const t=s.parent;return 0===n&&Array.isArray(s.children)&&s.children[0]===e&&"list-item"!==t.type&&Array.isArray(t.children)&&t.children[0]===s}return 0===n&&Array.isArray(s.children)&&s.children[0]===e}getPreviousBlock(t){var e;if(t.parent instanceof xe){const n=null!==(e=t.parent.nestList)&&void 0!==e?e:[],s=n.indexOf(t);if(s>0)return n[s-1];if(0===s)return t.parent}if(t&&t.parent&&t.parent.children){const e=t.parent.children.indexOf(t);if(e>0)return t.parent.children[e-1];if(this.isRTEBlock(t.parent)&&0===e)return this.getPreviousBlock(t.parent)}}getBlockLastNode(t){return t.getLastNode()}getBlockFirstNode(t){if("number-list"===t.type||"bullet-list"===t.type){if(t.children)return this.getBlockFirstNode(t.children[0])}else if(t.children)return t.children[0]}getNextBlock(t){if(t&&t.parent&&t.parent.children){const e=t.parent.children.indexOf(t);if(t.parent.children[e+1])return t.parent.children[e+1];if("list-item"===t.type&&t.parent.children.length===e+1)return this.getNextBlock(t.parent)}}isRTEBlock(t){return t&&"VegaRTEContent"!==t.typeName}}class Ce extends T{constructor(t,e){super(),this.isFlushable=!0,this.type=x.UPDATE_CODE_BLOCK,this.content=t,this.language=e}}class Le extends Q{constructor(t){super(),this.isFlushable=!1,this.range=t}toAnnotation(){return new St(this.range)}}Le.typeName="SelectionChangeAction";class ke extends U{constructor(){super(...arguments),this.type="decorator-node",this.isSelected=!1}static isDecoratorNodeContainerElement(t){return t&&t.classList.contains(ke.DECORATOR_CONTAINER_CLASS)}static getDecoratorNodeElement(t){return t.querySelector(`.${ke.DECORATOR_NODE_CLASS}`)}getRangeEndOffset(){return 1}getRangeContainer(){const t=this.getElementRef();if(t)return f(t,`.${ke.DECORATOR_CONTAINER_CLASS}`)}isContentEditable(){return!1}}ke.typeName="RTEDecoratorNode",ke.DECORATOR_CONTAINER_CLASS="v-internal-decorator-container",ke.DECORATOR_NODE_CLASS="v-internal-decorator-node";class Re extends C{constructor(){super(...arguments),this.stylesToBeFiltered=Re.STYLES,this.elementTagName="pre code"}canFilter(t){return k.isCodeBlockNode(t)}canRefill(t,e){return!1}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}}Re.STYLES={boxSizing:"border-box",color:"rgba(var(--v-text-primary, 32, 54, 69, 1))",textAlign:"left",fontFamily:"'Roboto Mono'",fontWeight:"400",lineHeight:"22px",fontSize:"16px",whiteSpace:"pre-wrap",minHeight:"22px",tabSize:"2px"};class je extends ke{constructor(t,e,n,s){super(t),this.type=O.CODE_BLOCK_NODE,this.text="",this.annotationMap=new Map,this.text=e,this.parent=s,this.language=n,this.annotationMap.set(y.CUSTOM_STYLE,new P(Re.STYLES))}toJSON(){return{id:this.id,type:"text",text:this.text,language:this.language}}getPlainText(){return this.text}toHtml(t){return`<code${this.generateAttributeString(t)}>${v(this.text)}</code>`}clone(t){return new je(this.id,this.text,this.language,t)}doAnnotationActionApply(t){B.executeTheStrategy(t,this)}doModifyActionApply(t){B.executeTheStrategy(t,this)}}je.typeName="RTECodeBlockNode",B.register(x.UPDATE_CODE_BLOCK,je.typeName,new class extends ft{handleAction(t,e){const{content:n,language:s}=t;e.language=s,e.text=n}}),B.register(Le.typeName,je.typeName,new class extends ft{handleAction(t,e){e.annotationMap.set(p.SELECTION_RANGE,t.toAnnotation())}});var _e;!function(t){t.CSS="css",t.HTML="html",t.JavaScript="js",t.JSX="jsx",t["Plain Text"]="plainText",t.TypeScript="ts",t.TSX="tsx"}(_e||(_e={}));class $e extends ft{handleAction(t,e){e.children=e.children.filter((e=>e!==t.entityToBeRemoved)),0===e.children.length&&"parent"in e&&e.parent&&(e.isListItemBlock()&&e.nestList&&e.nestList.length||e.parent.apply(new xt(e)))}}class Ie extends C{constructor(){super(...arguments),this.stylesToBeFiltered=Ie.STYLES,this.elementTagName="pre"}canFilter(t){return k.isCodeBlock(t.typeName)}canRefill(t,e){return!1}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}}Ie.STYLES={backgroundColor:"rgba(var(--v-bg-secondary, 245, 247, 247, 1))",padding:"12px"};class Be extends z{constructor(t,e,n){super(t),this.type="code-block",this.annotationMap=new Map([P.from(Ie.STYLES)]),this.children=[new je(`${t}-1`,e,n,this)]}static from(t){return new Be(t.id,t.content,t.language)}toJSON(){const{language:t,text:e}=this.children[0];return{id:this.id,type:"code-block",content:e,language:t}}toHtml(t){const{language:e=_e["Plain Text"]}=this.children[0];return`<pre data-language="${e}"${super.generateAttributeString(t)}>${this.children.map((e=>e.toHtml(t)))}</pre>`}clone(t){const e=Be.from(this.toJSON());return e.parent=t,e}apply(s){if(s instanceof T&&B.executeTheStrategy(s,this),s.isFlushable){const s=A.getDOMByEntity(this);if(s){const r=e.getSubjectFromParentNodeByEventId(s,n);r&&t.notify(r,{})}}}isNotEmpty(){return!!this.children.length}getLastNode(){return this.children[0]}isSelected(){return this.children[0].annotationMap.has(p.SELECTION_RANGE)}}Be.typeName="RTECodeBlock",B.register(x.DELETE_CODE_BLOCK,Be.typeName,new class extends be{handleAction(t,e){const n=e.children[0],s=e.parent;if(s){let t=this.getPreviousNode(n),r=this.getRTENodeEndOffset(t);t||(t=this.getNextNode(n),r=0),s.apply(new xt(e));const i=t?A.getDOMByEntity(t):null;if(0===s.children.length){const n=me.from({id:u(),type:"paragraph",nodes:[{id:u(),type:"text",text:""}]});e.parent.apply(new W([n])),t=n.children[0],r=0}this.notifyUpdateSelection(t,i,r,e)}}notifyUpdateSelection(n,r,i,o){const c=A.getDOMByEntity(o);if(c){const o=e.getSubjectFromParentNodeByEventId(c,s);o&&t.notify(o,{node:n,updateDirectly:!!r,offset:i})}}getRTENodeEndOffset(t){return t?t.getRangeEndOffset():0}}),B.register(x.DELETE_CHILDREN,Be.typeName,new $e),B.register(x.SWITCH_OUT_FROM_CODE_BLOCK,Be.typeName,new class extends ft{handleAction(n,r){const{content:i,language:o}=n,c=i.split("\n"),a=new Ce(c.slice(0,c.length-2).join("\n"),o);a.isFlushable=!1,r.children[0].apply(a);const l=me.from({id:u(),type:"paragraph",nodes:[{id:u(),text:"",type:"text"}]});r.parent.apply(new gt(r,l));const h=A.getDOMByEntity(r);if(h){const n=e.getSubjectFromParentNodeByEventId(h,s);n&&t.notify(n,{node:l.children[0]})}}}),B.register(x.INSERT_IMAGE_TO_BLOCK,Be.typeName,new class extends ft{handleAction(t,e){e.parent.apply(new gt(e,t.imageBlockToBeInserted))}}),Be.CODE_BLOCK_PLACEHOLDER_CLASS_NAME="code-block-placeholder-element";export{ct as $,B as A,m as B,y as C,D,wt as E,ae as F,At as G,jt as H,gt as I,pe as J,ge as K,be as L,T as M,S as N,$e as O,Ee as P,Se as Q,ce as R,de as S,Ne as T,te as U,Rt as V,ot as W,it as X,E as Y,Nt as Z,vt as _,z as a,lt as a0,at as a1,Z as a2,Oe as a3,k as a4,ve as a5,_ as a6,Et as a7,V as a8,R as a9,Ct as aA,N as aB,Ft as aC,Lt as aD,It as aE,$t as aF,Bt as aG,Ie as aa,Re as ab,Jt as ac,b as ad,ht as ae,dt as af,I as ag,_e as ah,F as ai,kt as aj,bt as ak,st as al,Ce as am,Le as an,oe as ao,_t as ap,Vt as aq,qt as ar,tt as as,ut as at,g as au,zt as av,Wt as aw,Xt as ax,we as ay,ye as az,me as b,Dt as c,J as d,ft as e,W as f,U as g,he as h,p as i,x as j,Q as k,xt as l,M as m,G as n,C as o,ke as p,Be as q,xe as r,A as s,je as t,P as u,K as v,Mt as w,Pt as x,L as y,O as z}
@@ -1,3 +0,0 @@
1
- import{e as t,q as e,h as n,l as s,s as r,y as i,N as o,p as a,z as l,D as c,A as h,k as u,j as d,E as w,I as p,f,M as m,b as g,R as T,S as x,a as b,F as O,G as y,J as E,K as k,L as A,U as v,O as C,P as B,r as H,Q as j,T as N,W as I,X as S,Y as R,Z as L,_ as D,$,a0 as M,a1 as P,v as F,a2 as z,a3 as U,c as V,o as W,a4 as G,a5 as J,a6 as K,a7 as Y,a8 as _,n as X,a9 as Q,aa as Z,t as q,ab as tt,ac as et}from"./p-9680dfe6.js";import{g as nt}from"./p-8b5d3a52.js";import{i as st}from"./p-4d20a56f.js";import{C as rt}from"./p-2d0d575f.js";import{d as it}from"./p-36a57431.js";import{c as ot,d as at,e as lt}from"./p-53e3f259.js";import{r as ct,i as ht}from"./p-aa135628.js";import{c as ut}from"./p-a841cf13.js";import{L as dt}from"./p-6e1ab235.js";import{D as wt}from"./p-5c285374.js";class pt{}class ft{constructor(t,e){this.childrenOutput=[],this.currentStrategy=t,this.currentElements=e}setChildrenOutput(t){this.childrenOutput=t}toDto(t={autoMatchFormat:!0,skipCustomAnnotations:!0}){const e=this.currentStrategy.handle(this.currentElements,t);return this.childrenOutput.length>0&&e&&this.currentStrategy.appendChildBlocks(e,this.childrenOutput.map((e=>e.toDto(t))).filter(st)),e}}const mt=new class{constructor(){this.elementToBlockStrategies=[],this.elementToNodeStrategies=[]}registerElementToBlockStrategy(t){this.hasDuplicateStrategy(t,this.elementToBlockStrategies)||this.elementToBlockStrategies.unshift(t)}registerElementToNodeStrategy(t){this.hasDuplicateStrategy(t,this.elementToNodeStrategies)||this.elementToNodeStrategies.unshift(t)}getElementToBlockStrategies(){return this.elementToBlockStrategies}getElementToNodeStrategies(){return this.elementToNodeStrategies}hasDuplicateStrategy(t,e){return e.includes(t)}},gt=new class{process(t,e={autoMatchFormat:!0,skipCustomAnnotations:!0}){const n=this.getElementToBlockStrategies(),s=[];for(let r=0;r<t.length;r++){if(this.isInvalidElement(t[r],e))continue;let i=0;for(const o of n)if(i=o.canHandle(t,r,e),i>0){const n=t.slice(r,r+i),a=new ft(o,n);1===i&&o.shouldProceedToElementChildren()&&a.setChildrenOutput(this.process(Array.from(n[0].childNodes),e)),s.push(a),r+=i-1;break}if(0===i&&r<t.length){const n=Array.from(t[r].childNodes),i=this.process(Array.from(n),e);i.length>0&&s.push(...i)}}return s}isInvalidElement(t,e){return t.nodeType===Node.COMMENT_NODE||!1!==e.autoMatchFormat&&["META","STYLE"].includes(t.nodeName)}getElementToBlockStrategies(){return mt.getElementToBlockStrategies()}};class Tt extends t{handleAction(t,e){const n=t.entityToBeAppended;e.children&&(n.forEach((t=>{t.parent=e})),e.children=e.children.concat(n))}}class xt extends t{handleAction(t,e){this.replaceElementWithElements(e,t.referChildren,[...t.childrenToBeInserted,t.referChildren])}replaceElementWithElements(t,e,n){t.children&&(n.forEach((e=>{e.parent=t})),t.children=t.children.flatMap((t=>t===e?n:t)))}}class bt extends xt{handleAction(t,e){this.replaceElementWithElements(e,t.referChildren,[t.referChildren,...t.childrenToBeInserted])}}class Ot extends i{constructor(t,e){super(),this.type=o.IMAGE,this.size=t,this.alt=e}static from(t,e){return[o.IMAGE,new Ot(t,e)]}static getDefaultStyles(){return{verticalAlign:"bottom"}}toJSON(){return st(this.alt)?{size:this.size,alt:this.alt}:{size:this.size}}clone(){return new Ot(this.size,this.alt)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.size?`v-rte--image-size-${this.size}`:null}renderStyle(t){if(!(null==t?void 0:t.standalone))return null;const e=Ot.getDefaultStyles();switch(this.size){case"sm":return Object.assign(Object.assign({},e),{width:"25%"});case"md":return Object.assign(Object.assign({},e),{width:"50%"});case"lg":return Object.assign(Object.assign({},e),{width:"100%"})}}}Ot.BASE_STYLES={verticalAlign:"bottom"};class yt extends a{constructor(t,e,n,s){super(t,s),this.type=l.IMAGE,this.url=e,this.parent=n}static from(t,e,n={autoMatchFormat:!0}){const s=new yt(t.id,t.url,e),r=!!n.autoMatchFormat,i=Object.assign({},t.annotations),{size:o}=i,a=function(t,e){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(n[s[r]]=t[s[r]])}return n}(i,["size"]),l=Object.assign(Object.assign({},a),{size:null!=o?o:r?"md":void 0});return s.annotationMap=new Map(Object.keys(l).map((t=>"size"===t||"alt"===t?Ot.from(l.size,l.alt):this.createAnnotationEntity(t,l[t]))).filter(st)),s}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof Ot||t instanceof c)).reduce(((t,e)=>Object.assign(Object.assign({},t),e.toJSON())),{});return""==t.alt&&delete t.alt,Object.assign(Object.assign({id:this.id},Object.keys(t).length>0?{annotations:t}:{}),{type:"image",url:this.url})}clone(t){return new yt(this.id,this.url,t,super.cloneAnnotations())}toHtml(t){const e=this.getAnnotationByType(o.IMAGE);return`<img${super.generateAttributeString(t,...[e&&e.alt?`alt="${e.alt}"`:null,`src="${this.url}"`,e&&e.size?`data-size="${e.size}"`:null].filter(st))}>`}doAnnotationActionApply(t){const e=h.get(u.typeName,yt.typeName);e&&e.execute(t,this)}doModifyActionApply(t){h.executeTheStrategy(t,this)}}yt.typeName="RTEImageNode",h.register(d.UPDATE_IMAGE_NODE_URL,yt.typeName,new class extends t{handleAction(t,e){e.url=t.url}}),h.register(u.typeName,yt.typeName,new class extends t{handleAction(t,e){const n=t.toAnnotation();e.annotationMap.set(n.type,n)}});class Et extends m{constructor(t,e){super(),this.type=d.INSERT_NEW_PARAGRAPH,this.startContainerNode=t,this.startOffset=e}}class kt extends b{constructor(t){super(t),this.type="image",this.children=[]}static from(t,e={autoMatchFormat:!0}){const n=new kt(t.id),{annotations:s}=t;return n.children=t.nodes.map((t=>yt.from(t,n,e))),s&&super.convertAnnotationsToMap(n.annotationMap,s),n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:"image",nodes:this.children.map((t=>t.toJSON()))})}toHtml(t){const e=super.generateAttributeString(t),n=this.children.map((e=>e.toHtml(t))).join("");return super.shouldRenderAsInternalWrapper()?n:[`<div${e}>`,n,"</div>"].join("")}isNotEmpty(){return this.children.length>0&&this.children.some((t=>t.url.length>0))}getLastNode(){return this.children[this.children.length-1]}createNewImageBlock(){return new kt(nt())}clone(t){const e=new kt(this.id);return e.children=this.children.map((t=>t.clone(e))),e.annotationMap=super.cloneAnnotations(),e.parent=t,e}}kt.typeName="RTEImageBlock",h.register(d.MERGE_TWO_BLOCKS_NODES,kt.typeName,new O),h.register(d.REPLACE_CHILD_NODES,kt.typeName,new y),h.register(d.SPLIT_BLOCK_WITH_NODE,kt.typeName,new class extends t{handleAction(t,e){t.newBlock=this.splitImageNodes(t.splitPointNode,t.startOffsetOfNode,e)}splitImageNodes(t,e,n){const s=n.children.indexOf(t);if(s>-1){const t=n.children.slice(0,s+e),r=n.children.slice(s+e);n.apply(new w(t));const i=this.cloneWithNodes(r,n);return n.parent.apply(new p(n,i)),i}}cloneWithNodes(t,e){const n=e.createNewImageBlock();return n.children=[],n.apply(new f(t)),n}}),h.register(d.LINE_BREAK_SINGLE_BLOCK,kt.typeName,new class extends t{handleAction(t,e){const n=new Et(t.startContainerNode,t.startOffset);e.apply(n);const s=n.newBlock;s&&(t.lineBreakNode=s.children[0])}}),h.register(d.LINE_BREAK_MULTIPLE_BLOCKS,kt.typeName,new class extends t{handleAction(t,e){t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks,e)}lineBreakMultipleBlocks(t,e){const n=g.from({id:nt(),type:"paragraph",nodes:[{id:nt(),type:"text",text:"\n"}]});e.parent.apply(new p(e,n));const s=this.concatBlocksNodes(t.slice(1));return(0===s.length||s[0]&&""===s[0].text)&&s.push(new T(nt(),"\n",n)),n.apply(new f(s)),n.children[0]}concatBlocksNodes(t){const e=[];return t.map((t=>{"image"!==t.type&&(e.push(...t.children),t.parent.apply(new s(t)))})),e}}),h.register(d.INSERT_IMAGE_TO_BLOCK,kt.typeName,new class extends t{handleAction(t,e){const s=t.splitPointNode,r=t.startOffsetOfNode,i=t.imageBlockToBeInserted;e.children.length<1?e.apply(new f(i.children)):this.isCaretPositionAtBlockEnd(e,s,r)?e.parent.apply(new p(e,i)):this.isCaretPositionAtBlockStart(e,s,r)?e.parent.apply(new n(e,i)):(e.apply(new x(s,r)),e.parent.apply(new p(e,i)))}}),h.register(E.typeName,kt.typeName,new k);class At extends m{constructor(t){super(),this.type=d.MERGE_TWO_BLOCKS_NODES,this.blockNeedToBeMerged=t}}class vt extends A{handleAction(t,e){const{startContainerNode:n}=t;n.isContentEditable()?n.isTextNode()&&this.deleteTextNodeContent(t,e):this.deleteDecoratorNodeContent(t,e);const r=e.parent;r&&e.isListItemBlock()&&0===r.children.length&&r.parent.apply(new s(r))}deleteTextNodeContent(t,e){const n=t.startContainerNode,r=t.startOffset;if(0!==r&&!n.isEmpty()){const i=n.text.slice(0,r-1)+n.text.slice(r);if(n.apply(new v(i)),i)return void(t.previousNode=n);{const r=e.children.indexOf(n),i=e.children[r+1],o=this.getPreviousNode(n);return o&&o.parent===e&&"\n"===o.text||1===e.children.length?void(t.previousNode=n):(e.apply(new s(n)),void(i&&(null==o?void 0:o.parent)!==e?t.nextNode=i:t.previousNode=o))}}{let r=this.getPreviousNode(n),i=null;const o=n.isEmpty();if(e.children.length&&r&&r.parent!==e)o&&e.apply(new s(n)),e.type===r.parent.type&&r.parent.apply(new At(e));else if(this.isContentFirstNode(n)&&o&&(i=this.getNextNode(n)),o&&e.apply(new s(n)),r&&r.isTextNode()&&(r.isEmpty()||!r.isContentEditable()&&r.parent===e)){const t=r;r=this.getPreviousNode(r),t.parent.apply(new s(t)),r||o||(i=n)}0===e.children.length&&e.parent.apply(new s(e)),r?t.previousNode=r:i&&(t.nextNode=i)}}deleteDecoratorNodeContent(t,e){const n=t.startContainerNode,r=t.startOffset;let i=this.getPreviousNode(n),o=null;if(0!==r){const t=e;this.isContentFirstNode(n)&&(o=this.getNextNode(n)),1===t.children.length?t.parent.apply(new s(t)):t.apply(new s(n))}else{const r=i;r&&!r.isContentEditable()&&r.parent===e?(i=this.getPreviousNode(r),r.parent.apply(new s(r)),i||(t.nextNode=n)):i&&i.parent!==e&&e.type===i.parent.type&&i.parent.apply(new At(e))}i?t.previousNode=i:o&&(t.nextNode=o)}}class Ct extends t{handleAction(t,e){const{startContainerNode:n}=t;t.newBlock=this.breakSingleBlock(n,t.startOffset,e)}breakSingleBlock(t,e,s){const r=this.getNewParagraph(t);if(r){if(this.isCaretPositionAtBlockEnd(s,t,e))s.parent.apply(new p(s,r));else{if(!this.isCaretPositionAtBlockStart(s,t,e)){const n=new x(t,e);return s.apply(n),n.newBlock}s.parent.apply(new n(s,r))}return r}}getNewParagraph(t){const e=this.createNewParagraph("");if(e){let n=e.children[0];return t.isTextNode()&&t.isContentEditable()&&(e.children=[],n=t.cloneWithText(""),n.annotationMap.delete(o.LINK),e.apply(new f([n]))),e}}}class Bt extends m{constructor(t,e,n=!1){super(),this.isFlushable=!0,this.type=d.UPDATE_CURSOR_POSITION,this.immediatelyRun=!1,this.nextFocusNode=t,this.offset=e,this.immediatelyRun=n,this.immediatelyRun&&(this.isFlushable=!1)}}class Ht extends t{handleAction(t,e){const{rteRange:r,nodeToBeInserted:i}=t,{startNode:o,startOffset:a}=r;if(o){const t=e;if(o.isContentEditable()&&o.isTextNode())if("\n"!==o.text&&o.text&&0!==a){const e=o.text.substring(0,a),r=o.text.substring(a),l=o.cloneWithText(e),c=o.cloneWithText(r),h=[l,i];r&&h.push(c),t.apply(new n(o,...h)),t.apply(new s(o))}else t.apply(new n(o,i));else t.apply(0!==a?new p(o,i):new n(o,i));this.updateCursorPosition(i)}}updateCursorPosition(t){const e=this.getRootContent(t.parent);e&&e.apply(new Bt(t))}}class jt extends t{handleAction(t,e){const{text:s,offset:r,decoratorNode:i}=t,o=this.createNewParagraph(s);if(o){const t=o.children[0];e.apply(0!==r?new p(i,t):new n(i,t)),this.setTheCursorPosition(t)}}setTheCursorPosition(t){const e=this.getRootContent(t.parent);e&&e.apply(new Bt(t))}}class Nt extends t{handleAction(t,e){t.newBlock=this.breakSingleListItemBlock(t.startContainerNode,t.startOffset,e)}breakSingleListItemBlock(t,e,s){const r=s.createNewListItem(),i=this.copyInlineStyleToNewNode(t);if(r.apply(new f([i])),this.isCaretPositionAtBlockEnd(s,t,e))return this.breakListItemAtEnd(r,s);if(!this.isCaretPositionAtBlockStart(s,t,e)){const n=new x(t,e);return s.apply(n),n.newBlock}return s.parent.apply(new n(s,r)),r}breakListItemAtEnd(t,e){const n=e.parent.children[e.parent.children.length-1],r=1===e.children.length&&e.children[0].isEmpty();if(e===n&&r){const n=e.parent.parent;if("list-item"!==n.type){const r=g.from({id:nt(),type:"paragraph",nodes:[]});return r.apply(new f(t.children)),n.apply(new p(e.parent,r)),e.parent.apply(new s(e)),r}n.parent.apply(new p(n,t)),e.parent.apply(new s(e))}else e.parent.apply(new p(e,t));return t}copyInlineStyleToNewNode(t){const e=t.cloneWithText("");return e.annotationMap.delete(o.LINK),e}}class It extends C{handleAction(t,e){var n,r;const i=t.entityToBeRemoved instanceof H?t.entityToBeRemoved:null,o=i?e.children.indexOf(i):-1;(null===(n=null==i?void 0:i.nestList)||void 0===n?void 0:n.length)&&o>=0&&this.promoteNestListsToUpperLevel(i,e,o),super.handleAction(t,e);const a=e.parent;if(0===e.children.length&&a)if("list-item"===a.type){const t=a;(null===(r=t.nestList)||void 0===r?void 0:r.includes(e))&&t.apply(new B(e))}else a.apply(new s(e))}promoteNestListsToUpperLevel(t,e,s){var r,i;const o=[...null!==(r=t.nestList)&&void 0!==r?r:[]];let a=s+1;const l=[];o.forEach((t=>{if(t.type===e.type){const n=[...t.children];n.length>0&&(n.forEach((t=>{t.parent=e})),e.children.splice(a,0,...n),a+=n.length)}else l.push(t)}));const c=e.parent;if(l.length>0&&c instanceof H){const t=[...null!==(i=c.nestList)&&void 0!==i?i:[]],n=t.indexOf(e);n>=0?t.splice(0===s?n:n+1,0,...l):t.push(...l),c.apply(new j(t))}else l.length>0&&c.apply(0===s?new n(e,...l):new p(e,...l));t.apply(new j([]))}}class St extends t{handleAction(t,e){if(e.parent){const{blocksToBeInserted:s,startNode:r,startOffset:i}=t;let o=e;const a=s[0],l=1===s.length&&r instanceof T&&!["RTEListBlock","RTEHtmlBlock"].includes(a.typeName)&&a.children.length>0&&a.children.every((t=>{var e,n;return!0===(null===(n=(e=t).isTextNode)||void 0===n?void 0:n.call(e))}));if(r===e.children[0]&&0===i)e.parent.apply(new n(e,...s));else{if(l)return void this.inlineMergeSingleBlock(t,e);{const n=new x(r,i);e.apply(n),e.parent.apply(new p(e,...s)),o=s[s.length-1],t.futureFocusAtEnd=!0}}t.futureFocusBlock=o}}inlineMergeSingleBlock(t,e){const{blocksToBeInserted:n,startNode:s,startOffset:r}=t,i=n[0],o=i.children,a=s,l=e.children.indexOf(a);if(-1===l){const o=new x(s,r);return e.apply(o),e.parent.apply(new p(e,...n)),t.futureFocusBlock=i,void(t.futureFocusAtEnd=!0)}const c=a.text.slice(0,r),h=a.text.slice(r),u=e.children.slice(0,l),d=e.children.slice(l+1);c&&u.push(a.cloneWithText(c)),h&&d.unshift(a.cloneWithText(h)),e.apply(new w([...u,...o,...d]));const f=o[o.length-1];t.futureFocusBlock=e,t.futureFocusNode=f,f.isTextNode()&&(t.futureFocusNodeOffset=f.text.length)}}const Rt=new class{registerBlockBasicStrategies(t){h.register(d.DELETE_CHILDREN,t,t===N.typeName?new It:new C),h.register(d.APPEND_CHILDREN,t,new Tt),h.register(d.INSERT_CHILDREN_BEFORE,t,new xt),h.register(d.INSERT_CHILDREN_AFTER,t,new bt),h.register(d.DELETE_BLOCK_CONTENT,t,new vt),h.register(d.INSERT_NEW_PARAGRAPH,t,t===H.typeName?new Nt:new Ct),h.register(d.INSERT_TEXT_TO_DECORATOR_NODE,t,new jt),h.register(d.INSERT_NODE_TO_NEAREST_ROOT,t,new Ht),h.register(d.PASTE_CONTENT,t,new St)}};class Lt{}class Dt extends Lt{canHandle(t){return"RTETextNode"===t.typeName}handle(t,e={}){return this.isBold(t)||e.bold?{bold:!0}:{}}isBold(t){return"STRONG"===t.nodeName||"B"===t.nodeName||t.style.fontWeight===I||t.style.fontWeight===S||t.classList.contains("v-rte--bold")}}class $t extends Lt{canHandle(t,e){return!e.skipCustomAnnotations&&!!t}handle(t){const e=this.getAttributes(t);return Object.keys(e).length>0?{customAttribute:e}:{}}getAttributes(t){return t.getAttributeNames().filter((t=>"style"!==t&&"class"!==t&&this.isValidAttr(t))).reduce(((e,n)=>(e[n]=t.getAttribute(n),e)),{})}isValidAttr(t){return/^[a-zA-Z_][\w-]*$/.test(t)}}class Mt extends Lt{canHandle(t,e){return!e.skipCustomAnnotations&&!!t}handle(t){const e=this.getCustomClass(t);return e.length>0?{customClass:e}:{}}getCustomClass(t){return t.classList.toString().split(" ").filter((t=>!t.includes("v-rte")&&""!==t))}}class Pt extends Lt{canHandle(t,e){return!e.skipCustomAnnotations&&!!t}handle(t){const e=R(t);return Object.keys(e).length>0?{customStyle:e}:{}}}class Ft extends Lt{canHandle(t){return["RTETextBlock","RTEListItemBlock","RTEListBlock"].includes(t.typeName)}handle(t){const e=this.getIndent(t);return e?{indent:e}:{}}getIndent(t){const e=t.style;let n;if(e.marginLeft)n=e.marginLeft;else{if(!e.margin)return null;{const t=e.margin.split(" ");switch(t.length){case 4:n=t[3];break;case 2:case 3:n=t[1];break;default:n=t[0]}}}const s=Number(n.replace("px",""));return s&&s>=0?Math.floor(s/16):null}}class zt extends Lt{canHandle(t){return["RTETextBlock","RTEListItemBlock","RTEListBlock"].includes(t.typeName)}handle(t){const e=this.getTextAlign(t);return e?{textAlign:e}:{}}getTextAlign(t){const e=t.classList;if(e.contains("v-rte--horizontal-alignment-left"))return"left";if(e.contains("v-rte--horizontal-alignment-center"))return"center";if(e.contains("v-rte--horizontal-alignment-right"))return"right";if(e.contains("v-rte--horizontal-alignment-justify"))return"justify";switch(t.style.textAlign){case"center":return"center";case"right":return"right";case"justify":return"justify";case"left":return"left";default:return null}}}class Ut extends Lt{canHandle(t){return"RTETextNode"===t.typeName}handle(t,e={}){return this.isCode(t)||e.code?{code:!0}:{}}isCode(t){return t.classList.contains("v-rte--code")||"CODE"===t.nodeName||"PRE"===t.nodeName||"monospace"===t.style.fontFamily||"Roboto Mono"===t.style.fontFamily.replace(/["']/g,"")}}class Vt extends Lt{canHandle(t){return"RTETextNode"===t.typeName}handle(t,e={}){const n=this.getColor(t)||e.textColor;return n?{textColor:n}:{}}getColor(t){var e;const n=null===(e=ct(t.style.color))||void 0===e?void 0:e.toUpperCase();if(n){const t=L.filter((t=>t.key!==D.key)).find((t=>t.light===n||t.dark===n));return t?t.key:null}for(const e of L)if(t.style.color.includes(e.key))return e.key;return null}}class Wt extends Lt{canHandle(t){return"RTETextNode"===t.typeName}handle(t,e={}){return this.isItalic(t)||e.italic?{italic:!0}:{}}isItalic(t){return"I"===t.nodeName||t.style.fontStyle===$||"EM"===t.nodeName||t.classList.contains("v-rte--italic")}}class Gt extends Lt{canHandle(t,e){return!!e.autoMatchFormat&&"RTETextBlock"===t.typeName}handle(t){const e=this.getTextStyle(t);return e?{textStyle:e}:{}}getTextStyle(t){const e=this.getElementTypeByDataType(t);if(e)return e;const n=this.getElementTypeByClassName(t);if(n)return n;const s=this.getElementTypeByNodeName(t);if(s)return s;return this.getElementTypeByFontSize(t)||null}getElementTypeByDataType(t){return t.nodeType!==Node.TEXT_NODE&&t.hasAttribute("data-type")?t.getAttribute("data-type"):null}getElementTypeByFontSize(t){var e;switch(null===(e=t.style)||void 0===e?void 0:e.fontSize){case"36px":return"title";case"28px":return"subtitle";case"22px":return"heading-1";case"20px":return"heading-2";case"18px":return"heading-3";default:return null}}getElementTypeByNodeName(t){switch(t.nodeName){case"P":return"paragraph";case"H1":return"heading-1";case"H2":return"heading-2";case"H3":return"heading-3";case"H4":return"heading-4";case"H5":return"heading-5";case"H6":return"heading-6";default:return null}}getElementTypeByClassName(t){if(t.className){const e=/\bv-rte-(?:-text-style-)?(title|subtitle|heading-1|heading-2|heading-3|heading-4|heading-5|heading-6|paragraph)\b/.exec(t.className);if(e)return e[1]}return null}}class Jt{static isTitleOrSubtitle(t){if("DIV"===t.nodeName){const e=Jt.textStyleHandler.getTextStyle(t);return"title"===e||"subtitle"===e}return!1}static isLinkElement(t){return"A"===t.nodeName}}Jt.textStyleHandler=new Gt;class Kt extends Lt{constructor(){super(...arguments),this.handlers=[new $t,new Mt,new Pt]}canHandle(t){return"RTETextNode"===t.typeName}handle(t,e={}){return e.link?{link:e.link}:Jt.isLinkElement(t)?{link:this.generateLinkAnnotations(t)}:{}}generateLinkAnnotations(t){const e={href:t.getAttribute("href")||"",groupKey:nt()};return this.handlers.forEach((n=>{Object.assign(e,n.handle(t))})),e}}class Yt extends Lt{canHandle(t){return"RTETextNode"===t.typeName}handle(t,e={}){return this.isStrikethrough(t)||e.strikethrough?{strikethrough:!0}:{}}isStrikethrough(t){return t.style.textDecoration.includes(M)||"S"===t.nodeName||"DEL"===t.nodeName||t.classList.contains("v-rte--strikethrough")}}class _t extends Lt{canHandle(t){return"RTETextNode"===t.typeName}handle(t,e={}){return this.isUnderline(t)||e.underline?{underline:!0}:{}}isUnderline(t){return t.style.textDecoration.includes(P)||"U"===t.nodeName||"INS"===t.nodeName||t.classList.contains("v-rte--underline")}}class Xt extends Lt{canHandle(t){return"RTEImageNode"===t.typeName}handle(t){const e=this.getImageSize(t);return e?{size:e}:{}}getImageSize(t){return t.getAttribute("data-size")?t.getAttribute("data-size"):null}}class Qt extends Lt{canHandle(t){return"RTEImageNode"===t.typeName}handle(t){return t.hasAttribute("alt")?{alt:t.getAttribute("alt")}:{}}}const Zt=new Set(["P","H1","H2","H3","H4","H5","H6","LI"]),qt=new Set(["P","H1","H2","H3","H4","H5","H6","LI","UL","OL","IMG","CODE"]),te=new Set(["BR","VEGA-RICH-TEXT-LINK-EDITOR","CODE","A"]),ee=new Set(["TABLE","THEAD","TBODY","TFOOT","TR","DL"]),ne=new Set(["ABBR","B","BDI","BDO","CITE","DEL","DFN","EM","I","INS","KBD","MARK","METER","OUTPUT","PROGRESS","Q","S","SAMP","SMALL","SPAN","STRONG","SUB","SUP","TIME","U","VAR"]);function se(t){return Zt.has(t.parentElement.nodeName)}class re extends Lt{constructor(){super(...arguments),this.customAttributeHandler=new $t,this.customStyleAnnotationHandler=new Pt,this.customClassAnnotationHandler=new Mt}canHandle(t,e){return"RTETextNode"===t.typeName&&!1===e.autoMatchFormat}handle(t,e){if(qt.has(t.nodeName)&&!te.has(t.nodeName))return{};const n=this.generateInlineHtmlAnnotation(t,Object.assign({},e));return n?{inlineHtml:n}:{}}generateInlineHtmlAnnotation(t,e){let{inlineHtml:n}=e;const s=Array.from(t.childNodes).some((t=>t.nodeType===Node.ELEMENT_NODE));if(!T.supportsHtmlTag(t.nodeName.toLowerCase())||s){const e=Object.assign(Object.assign({htmlTag:t.nodeName.toLowerCase()},s?{groupId:nt()}:{}),{customAttribute:this.customAttributeHandler.handle(t).customAttribute,customStyle:this.customStyleAnnotationHandler.handle(t).customStyle,customClass:this.customClassAnnotationHandler.handle(t).customClass});n=n?this.appendToInlineHtmlChain(n,e,t.parentNode):e}return n?Object.assign({},n):null}appendToInlineHtmlChain(t,e,n){return t.child&&n&&t.child.htmlTag===n.nodeName.toLowerCase()?Object.assign(Object.assign({},t),{child:this.appendToInlineHtmlChain(t.child,e,n)}):Object.assign(Object.assign({},t),{child:e})}}const ie=new class{constructor(){this.handlers=[new zt,new Ft,new Dt,new Wt,new _t,new Yt,new Vt,new Kt,new Ut,new Xt,new Qt,new $t,new Mt,new Pt,new Gt,new re]}registerHandler(t){this.handlers.unshift(t)}generate(t,e,n={autoMatchFormat:!0}){n&&n.filterInlineStyles&&F.executeTheStrategyRefillAction(t.typeName,e);const s=Jt.isLinkElement(e)&&"RTETextNode"===t.typeName,r=this.handlers.filter((t=>!(!n.autoMatchFormat&&s)||t instanceof Kt)).filter((r=>e.nodeType!==Node.TEXT_NODE&&r.canHandle(t,{skipCustomAnnotations:n.skipCustomAnnotations||s,autoMatchFormat:n.autoMatchFormat}))).reduce(((t,s)=>{const r=s.handle(e,n.parentAnnotations);return Object.assign(Object.assign({},t),r)}),{});this.removeTextStyleDefaultsFromCustomStyle(r);const i=F.getStrategies(t.typeName);for(const t of i)(n.autoMatchFormat||t.alwaysFilter)&&t.filterAnnotations(r);return r}removeTextStyleDefaultsFromCustomStyle(t){const e="textStyle"in t?t.textStyle:void 0,n=t.customStyle;if(!e||!n)return t;const s=z.getDefaultStyles(e);if(!s)return t;for(const t of Object.keys(s))n[t]===s[t]&&delete n[t];return 0===Object.keys(n).length&&delete t.customStyle,t}};class oe extends pt{constructor(){super(...arguments),this.annotationHandler=new Gt}generateChildNodes(t,e,n){const s=[],r=!(!n||!1!==n.autoMatchFormat),i=Object.assign({},e);return t.forEach((t=>{const o=mt.getElementToNodeStrategies().find((e=>e.canHandle([t],0,n)>0));let a=null;if(o&&(a=o.handle([t],n,i)),a)s.push(a);else if(ht(t)&&t.childNodes.length>0){const o=ie.generate(T,t,Object.assign({parentAnnotations:r?{inlineHtml:i.inlineHtml,link:i.link,code:i.code}:e},n));s.push(...this.generateChildNodes(Array.from(t.childNodes),o,n))}})),s}matchTextBlockType(t){var e;return null!==(e=this.annotationHandler.handle(t).textStyle)&&void 0!==e?e:"paragraph"}}class ae extends oe{canHandle(t,e,n){const s=t[e];return s.nodeType===Node.TEXT_NODE||this.isInlineTagWithoutBlockChildren(s,n)||qt.has(s.nodeName)&&!this.shouldFallBackToHtmlBlock(s)||n.autoMatchFormat||!this.isCustomHtmlContainer(s)||Jt.isTitleOrSubtitle(s)?0:1}handle(t,e){return U.from(this.generateHtmlBlock(t[0],e),e)}appendChildBlocks(t,e){t.children=e.map((e=>(e.parent=t,e)))}shouldProceedToElementChildren(){return!0}isInlineTagWithoutBlockChildren(t,e){if(te.has(t.nodeName)&&0===t.childNodes.length)return!0;if(se(t))return!(0===t.childNodes.length&&""===t.textContent&&!te.has(t.nodeName)&&!ne.has(t.nodeName));const n=Array.from(t.childNodes);return!(n.some((t=>t.nodeType===Node.ELEMENT_NODE))||!n.some((t=>t.nodeType===Node.TEXT_NODE)))&&(!1!==e.autoMatchFormat||!ee.has(t.parentElement.nodeName)&&(ne.has(t.nodeName)||te.has(t.nodeName)))}shouldFallBackToHtmlBlock(t){const e=Array.from(t.childNodes);if(0===e.length)return!1;const n=t.parentElement.nodeName;return"UL"!==n&&"OL"!==n&&e.every((t=>t.nodeType===Node.ELEMENT_NODE&&""===t.textContent&&!te.has(t.nodeName)&&!ne.has(t.nodeName)))}isCustomHtmlContainer(t){return"DIV"!==t.nodeName||t.childNodes.length>0&&"IMG"!==t.childNodes[0].nodeName}generateHtmlBlock(t,e){return{id:nt(),type:"html-block",htmlTag:t.nodeName.toLowerCase(),annotations:ie.generate(U,t,e),children:[]}}}class le extends oe{canHandle(t,e){return"PRE"!==t[e].tagName&&"CODE"!==t[e].tagName||!t[e].hasAttribute("data-language")?0:1}handle(t){const n=t[0];if(n){const t=n.textContent,s=n.dataset.language;return e.from({id:nt(),type:"code-block",content:t,language:s})}}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}class ce extends oe{createRTEImageBlock(t,e){const n=!(e&&e.autoMatchFormat||!t.parentNode||"DIV"===t.parentNode.nodeName);return kt.from({id:nt(),type:"image",nodes:[{id:nt(),type:"image",url:t.src,annotations:ie.generate(yt,t,e)}],annotations:Object.assign(Object.assign({},ie.generate(kt,t.parentElement,e)),{internalWrapper:n})},e)}}class he extends pt{shouldProceedToElementChildren(){return!1}appendChildBlocks(){}generateTextNode(t,e){return{id:nt(),type:"text",text:t,annotations:e}}}class ue extends W{constructor(){super(...arguments),this.stylesToBeFiltered={}}get alwaysFilter(){return!0}filterAnnotations(t){const{textAlign:e,customStyle:n}=t;return e&&n?(this.stylesToBeFiltered=K.getDefaultStyles(e),super.filterAnnotations(t)):t}}class de extends W{constructor(){super(...arguments),this.stylesToBeFiltered=z.getDefaultStyles("paragraph"),this.type="paragraph",this.elementTagName="p"}filterAnnotations(t){return t}canFilter(t){return G.isTextBlock(t.typeName)&&t.type===this.type}canRefill(t,e){const n=this.classNameToBeAdded?`.${this.classNameToBeAdded}`:this.elementTagName;return G.isTextBlock(t)&&e.matches(n)}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}}class we extends de{constructor(t){super(),this.type="heading-1",this.elementTagName="h1",this.type=`heading-${t}`,this.elementTagName=`h${t}`,this.stylesToBeFiltered=z.getDefaultStyles(this.type)}}class pe extends de{constructor(t){super(),this.type="title",this.elementTagName="div",this.classNameToBeAdded="v-rte-title",this.type=t,this.classNameToBeAdded=`v-rte-${t}`,this.stylesToBeFiltered=z.getDefaultStyles(this.type)}}class fe extends W{constructor(){super(...arguments),this.stylesToBeFiltered=fe.BOLD_STYLES,this.elementTagName="span",this.parentBlockTypes=["heading-1","heading-2","heading-3","heading-4","heading-5","heading-6","title"],this.parentElementSelectors=["h1","h2","h3","h4","h5","h6",".v-rte-title"],this.toBeCheckedSelector=this.parentElementSelectors.join(",")}filterAnnotations(t){return t}filterAndDeleteStyles(t,e,n){var s;const r=super.filterAndDeleteStyles(t,e);return this.isExplicitlyNonBold(n)&&void 0===(null===(s=r.styles)||void 0===s?void 0:s.fontWeight)&&(r.styles=Object.assign(Object.assign({},r.styles),{fontWeight:fe.NON_BOLD_FONT_WEIGHT})),r}canFilter(t){return G.isTextNode(t.typeName)&&this.parentBlockIsHeadingOrTitle(t)}canRefill(t,e){return G.isTextNode(t)&&"SPAN"===e.nodeName&&this.isHeadingOrTitleChild(e)}toCssText(){return`${this.parentElementSelectors.map((t=>`.${fe.RTE_CONTENT_CONTAINER_CLASS_NAME} ${t}`)).join(",")} { ${this.convertStylesMapToCssText()} }`}isExplicitlyNonBold(t){var e;const n=null===(e=t)||void 0===e?void 0:e.getAnnotationByType(o.BOLD);return!1===(null==n?void 0:n.bold)}parentBlockIsHeadingOrTitle(t){const e=t.parent;return!!e&&this.parentBlockTypes.includes(e.type)}isHeadingOrTitleChild(t){let e=t.parentElement;for(;e;){if(e.matches(this.toBeCheckedSelector))return!0;if(fe.NON_HEADING_TITLE_ELEMENT_TAGS.includes(e.tagName))return!1;e=e.parentElement}return!1}}fe.BOLD_STYLES={fontWeight:"700"},fe.NON_BOLD_FONT_WEIGHT=_,fe.NON_HEADING_TITLE_ELEMENT_TAGS=["TD","TH","TR","TABLE","THEAD","TBODY","DIV","BODY"];class me extends we{constructor(t){super(t),this.classNameToBeAdded=`v-rte-h${t}`,this.elementTagName="li"}canFilter(t){return G.isListItemBlock(t.typeName)&&this.isBlockOrNodeStylesMatchFilterStyles(t,["fontSize","lineHeight"])}canRefill(t,e){return G.isListItemBlock(t)&&e.matches(this.elementTagName)&&e.classList.contains(this.classNameToBeAdded)}}class ge extends pe{constructor(t){super(t),this.classNameToBeAdded=`v-rte-${t}`,this.elementTagName="li"}canFilter(t){return G.isListItemBlock(t.typeName)&&this.isBlockOrNodeStylesMatchFilterStyles(t,["fontSize","lineHeight"])}canRefill(t,e){return G.isListItemBlock(t)&&e.matches(this.elementTagName)&&e.classList.contains(this.classNameToBeAdded)}}X.registerRTEDTOClass("paragraph",g),X.registerRTEDTOClass("title",g),X.registerRTEDTOClass("subtitle",g),X.registerRTEDTOClass("heading-1",g),X.registerRTEDTOClass("heading-2",g),X.registerRTEDTOClass("heading-3",g),X.registerRTEDTOClass("heading-4",g),X.registerRTEDTOClass("heading-5",g),X.registerRTEDTOClass("heading-6",g),X.registerRTEDTOClass("heading-6",g),X.registerRTEDTOClass("list-item",H),X.registerRTEDTOClass("bullet-list",N),X.registerRTEDTOClass("number-list",N),X.registerRTEDTOClass("image",kt),X.registerRTEDTOClass("code-block",e),X.registerRTEDTOClass("html-block",U),X.registerRTEDTOClass("text",T),X.registerRTEDTOClass("image",yt),Rt.registerBlockBasicStrategies(g.typeName),Rt.registerBlockBasicStrategies(N.typeName),Rt.registerBlockBasicStrategies(H.typeName),Rt.registerBlockBasicStrategies(kt.typeName),Rt.registerBlockBasicStrategies(U.typeName),mt.registerElementToBlockStrategy(new class extends oe{canHandle(t,e,n){let s=0;for(let r=e;r<t.length&&this.isInlineCandidate(t[r],n);r++)s++;return s}handle(t,e){const n=t[0].parentElement,s=e&&e.autoMatchFormat,r=this.generateChildNodes(t,s?ie.generate(T,n,Object.assign(Object.assign({},e),{skipCustomAnnotations:!0})):{},e),i=s?super.matchTextBlockType(n):this.matchTextBlockTypeByTagName(n),o=!s&&!i;return g.from(Object.assign({id:nt(),type:i||"paragraph",nodes:r},o?{annotations:{internalWrapper:o}}:{annotations:ie.generate(g,n,e)}),e)}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}matchTextBlockTypeByTagName(t){switch(t.nodeName){case"P":return"paragraph";default:return null}}isInlineCandidate(t,e){return t.nodeType===Node.TEXT_NODE||!this.isBlockBoundaryElement(t,e)&&(!!te.has(t.nodeName)||!this.isDedicatedBlockTag(t.nodeName)&&(!(!1!==e.autoMatchFormat||!se(t))||this.isInlineLeafOrWrapper(t)))}isBlockBoundaryElement(t,e){var n;return!!t.hasAttribute(V)||!!(null===(n=e.blockBoundaryRegistry)||void 0===n?void 0:n.isBoundary(t))}isDedicatedBlockTag(t){return qt.has(t)&&!te.has(t)}isInlineLeafOrWrapper(t){return 0===t.childNodes.length?ne.has(t.nodeName):this.isTextOnlyElement(t)?ne.has(t.nodeName)||te.has(t.nodeName):this.hasOnlyInlineDescendants(t)}isTextOnlyElement(t){const e=Array.from(t.childNodes);return!e.some((t=>t.nodeType===Node.ELEMENT_NODE))&&e.some((t=>t.nodeType===Node.TEXT_NODE))}hasOnlyInlineDescendants(t){for(let e=0;e<t.children.length;e++){const n=t.children[e];if(this.isDedicatedBlockTag(n.nodeName))return!1;if(!n.hasChildNodes())return!1;if(!this.hasOnlyInlineDescendants(n))return!1}return!0}}),mt.registerElementToBlockStrategy(new class extends ce{canHandle(t,e){const n=t[e];return n.nodeType===Node.ELEMENT_NODE&&""===n.textContent&&n.querySelector("img")?1:0}handle(t,e){const n=t[0].querySelector("img");return this.createRTEImageBlock(n,e)}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}),mt.registerElementToBlockStrategy(new class extends ce{canHandle(t,e){return"VEGA-RICH-TEXT-IMAGE-EDITOR"===t[e].tagName?1:0}handle(t,e){const n=t[0],s=n.querySelector("img");if(st(s))return kt.from({id:nt(),type:"image",nodes:[{id:nt(),type:"image",url:s.src,annotations:ie.generate(yt,n,e)}],annotations:ie.generate(kt,n.parentElement,e)},e)}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}),mt.registerElementToBlockStrategy(new class extends ce{canHandle(t,e){return"IMG"===t[e].tagName?1:0}handle(t,e){return this.createRTEImageBlock(t[0],e)}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}),mt.registerElementToBlockStrategy(new class extends oe{canHandle(t,e){return["heading-1","heading-2","heading-3","heading-4","heading-5","heading-6","title","subtitle"].includes(super.matchTextBlockType(t[e]))?1:0}handle(t,e){const n=this.generateChildNodes(Array.from(t[0].childNodes),{},e);return 0===n.length?null:g.from({id:nt(),type:super.matchTextBlockType(t[0]),nodes:n,annotations:ie.generate(g,t[0],e)},e)}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}),mt.registerElementToBlockStrategy(new class extends oe{canHandle(t,e){if(!["UL","OL"].includes(t[e].parentElement.nodeName)&&t.some((t=>"LI"===t.nodeName))){let n=0;for(let s=e;s<t.length&&"LI"===t[s].nodeName;s++)n++;return n}return"LI"===t[e].tagName?1:0}handle(t,e){const n=t[0];return["UL","OL"].includes(n.parentElement.nodeName)?H.from(this.generateListItemBlockDTO(n,e),e):this.generateWithListBlock(t,e)}appendChildBlocks(t,e){t.nestList=e.filter((t=>["bullet-list","number-list"].includes(t.type))),t.nestList.forEach((e=>e.parent=t))}shouldProceedToElementChildren(){return!0}generateWithListBlock(t,e){return N.from({id:nt(),type:"bullet-list",blocks:t.map((t=>this.generateListItemBlockDTO(t,e)))},e)}generateListItemBlockDTO(t,e){return{id:nt(),type:"list-item",annotations:ie.generate(H,t,e),nodes:this.generateChildNodes(Array.from(t.childNodes.length?t.childNodes:[t]).filter((t=>!["UL","OL"].includes(t.nodeName))),ie.generate(T,t,Object.assign(Object.assign({},e),{skipCustomAnnotations:!0})),e)}}}),mt.registerElementToBlockStrategy(new class extends oe{canHandle(t,e){const n=t[e],s=n.parentElement,r="LI"!==n.nodeName,i=n.nodeType===Node.TEXT_NODE&&""===n.textContent.trim(),o=st(s)&&["UL","OL"].includes(s.nodeName);return r&&!i&&o?1:0}handle(t,e){const n=this.generateChildNodes(t,{},e);return H.from({id:nt(),type:"list-item",nodes:n,annotations:{}},e)}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}}),mt.registerElementToBlockStrategy(new class extends oe{canHandle(t,e){return"OL"===t[e].tagName?1:0}handle(t,e){return 0===t[0].childNodes.length?null:N.from({id:nt(),type:"number-list",blocks:[],annotations:ie.generate(N,t[0],e)},e)}appendChildBlocks(t,e){t.children=e.filter((t=>t instanceof H)),e.forEach((e=>e.parent=t))}shouldProceedToElementChildren(){return!0}}),mt.registerElementToBlockStrategy(new class extends oe{canHandle(t,e){return"UL"===t[e].tagName?1:0}handle(t,e){return 0===t[0].childNodes.length?null:N.from({id:nt(),type:"bullet-list",blocks:[],annotations:ie.generate(N,t[0],e)},e)}appendChildBlocks(t,e){t.children=e.filter((t=>t instanceof H)),e.forEach((e=>e.parent=t))}shouldProceedToElementChildren(){return!0}}),mt.registerElementToBlockStrategy(new ae),
2
- //!important: Code block strategies must be registered after HtmlBlockStrategy because registerElementToBlockStrategy uses unshift, giving later registrations higher priority.
3
- mt.registerElementToBlockStrategy(new le),mt.registerElementToBlockStrategy(new class extends le{canHandle(t,e){return"VEGA-CODE-BLOCK"===t[e].tagName&&0==!!t[e].querySelector("vega-code-block")||this.isCodeBlockContainer(t[e])?1:0}handle(t){const e=this.isCodeBlockContainer(t[0])?t[0].querySelector("vega-code-block"):t[0],n=e.querySelector("code");if(n)return super.handle([n]);if(e.hasAttribute("data-content")){const t=document.createElement("code");return t.textContent=e.dataset.content,t.dataset.language=e.dataset.language,super.handle([t])}}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}isCodeBlockContainer(t){return"PRE"===t.tagName&&t.classList.contains("code-block-container")&&1===t.querySelectorAll("vega-code-block").length}}),mt.registerElementToNodeStrategy(new class extends he{canHandle(t,e){const n=t[e];return!ht(n)||"BR"!==n.nodeName&&0!==n.childNodes.length?0:1}handle(t,e,n){const s=!(!e||!1!==e.autoMatchFormat),r=Object.assign({},n),i=t[0],o=ie.generate(T,i,Object.assign({parentAnnotations:s?{inlineHtml:r.inlineHtml,link:r.link,code:r.code}:n},e));if("BR"===i.nodeName){const{inlineHtml:t}=o,e=function(t,e){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(n[s[r]]=t[s[r]])}return n}(o,["inlineHtml"]);return this.generateTextNode("\n",t&&"br"===t.htmlTag?e:o)}if(0===i.childNodes.length){const t=s?ut(Object.assign(Object.assign({},T.supportsHtmlTag(i.nodeName.toLowerCase())?o:{}),{inlineHtml:o.inlineHtml})):o;return Object.assign({},this.generateTextNode("",t))}}}),mt.registerElementToNodeStrategy(new class extends he{canHandle(t,e){return t[e].nodeType===Node.TEXT_NODE?1:0}handle(t,e,n){const s=Object.assign({},n),r=!(!e||!1!==e.autoMatchFormat),i=t[0],o=i.parentNode.nodeName.toLowerCase(),a=r&&!T.supportsHtmlTag(o),l=this.generateTextNode(String(i.textContent),r?ut(Object.assign(Object.assign({},"span"===o?s:{link:s.link,code:"code"===o?s.code:void 0}),{inlineHtml:s.inlineHtml,plainText:a||void 0})):s);return Object.assign({},l)}}),F.register(g.typeName,new ue),F.register(N.typeName,new ue),F.register(H.typeName,new ue),F.register(T.typeName,new class extends W{constructor(){super(...arguments),this.stylesToBeFiltered={}}get alwaysFilter(){return!0}filterAnnotations(t){const e=t,n=e.customStyle;if(!n)return t;e.bold&&n.fontWeight===S&&delete n.fontWeight,e.italic&&n.fontStyle===$&&delete n.fontStyle;const s=this.normalizeTextDecoration(n.textDecoration);return s&&this.shouldRemoveTextDecoration(s,e)&&delete n.textDecoration,0===Object.keys(n).length&&delete e.customStyle,t}normalizeTextDecoration(t){if(!t)return;const e=t.trim().toLowerCase().split(/\s+/);return e.some((t=>t!==P&&t!==M))?void 0:Array.from(new Set(e)).sort().join(" ")}shouldRemoveTextDecoration(t,e){const n=[];return e.underline&&n.push(P),e.strikethrough&&n.push(M),0!==n.length&&t===n.sort().join(" ")}}),F.register(g.typeName,new de),F.register(g.typeName,new we(1)),F.register(g.typeName,new we(2)),F.register(g.typeName,new we(3)),F.register(g.typeName,new we(4)),F.register(g.typeName,new we(5)),F.register(g.typeName,new we(6)),F.register(g.typeName,new pe("title")),F.register(g.typeName,new pe("subtitle")),F.register(T.typeName,new fe),F.register(T.typeName,new class extends W{constructor(){super(...arguments),this.stylesToBeFiltered=Y.getDefaultStyles(),this.elementTagName="code"}filterAnnotations(t){const{code:e,customStyle:n}=t;return e&&n?super.filterAnnotations(t):t}canFilter(t){return G.isCodeNode(t)}canRefill(t,e){return G.isTextNode(t)&&e.matches(this.elementTagName)}toCssText(){return`.${W.RTE_CONTENT_CONTAINER_CLASS_NAME} ${this.elementTagName} { ${this.convertStylesMapToCssText(Object.assign(Object.assign({},this.stylesToBeFiltered),{fontWeight:"500"}))} }`}}),F.register(T.typeName,new Q),F.register(yt.typeName,new class extends W{constructor(){super(...arguments),this.stylesToBeFiltered=Ot.getDefaultStyles(),this.elementTagName="img"}get alwaysFilter(){return!0}canFilter(t){return G.isImageNode(t)}canRefill(t,e){return e.tagName.toLowerCase()===this.elementTagName}toCssText(){return this.buildCssTextForStyles(this.elementTagName,this.classNameToBeAdded)}}),F.register(e.typeName,new Z),F.register(q.typeName,new tt),F.register(N.typeName,new class extends W{constructor(){super(...arguments),this.stylesToBeFiltered=J.getDefaultStyles(),this.elementTagName="ol,ul"}canFilter(t){return G.isListBlock(t.typeName)}canRefill(t,e){return G.isListBlock(t)&&e.matches(this.elementTagName)}toCssText(){const t=W.RTE_CONTENT_CONTAINER_CLASS_NAME,e=this.elementTagName.split(",").map((t=>t.trim())),n=e.map((e=>`.${t} ${e}`)).join(", "),s=e.map((e=>`.${t} ${e} > li::marker`)).join(", "),r=this.convertStylesMapToCssText(J.getDefaultMarkerStyles());return`${n} { ${this.convertStylesMapToCssText(this.stylesToBeFiltered)} } ${s} { ${r} }`}}),F.register(H.typeName,new class extends W{constructor(){super(...arguments),this.stylesToBeFiltered=z.getDefaultStyles("paragraph"),this.elementTagName="li",this.headingOrTitleClassNamePattern=/^v-rte-(h[1-6]|title|subtitle)$/}canFilter(t){const e=!t.getStyles().fontSize||this.isBlockOrNodeStylesMatchFilterStyles(t,["fontSize","lineHeight"]);return G.isListItemBlock(t.typeName)&&e}canRefill(t,e){return G.isListItemBlock(t)&&e.matches(this.elementTagName)&&this.isElementNotHeadingOrTitle(e)}toCssText(){return this.buildCssTextForStyles(this.elementTagName)}isElementNotHeadingOrTitle(t){return!t.className.split(" ").some((t=>this.headingOrTitleClassNamePattern.test(t.trim())))}}),F.register(H.typeName,new me(1)),F.register(H.typeName,new me(2)),F.register(H.typeName,new me(3)),F.register(H.typeName,new me(4)),F.register(H.typeName,new me(5)),F.register(H.typeName,new me(6)),F.register(H.typeName,new ge("title")),F.register(H.typeName,new ge("subtitle"));class Te{static preserve(t){const e=t.replace(/\s+style=/g," data-style=");return new xe(e)}}class xe{constructor(t){this.processedHtml=t}getProcessedHtml(){return this.processedHtml}restore(t){this.walkNodes(t)}walkNodes(t){t.forEach((t=>{if(ht(t)){const e=t.getAttribute("data-style");e&&(t.style.cssText=e,t.removeAttribute("data-style")),t.children.length>0&&this.walkNodes(Array.from(t.children))}}))}}class be{process(t){return t.replace(/(<[^>]+>)(\s+)(<[^>]+>)/g,((t,e,n,s)=>{const r=this.extractOpeningTagName(e),i=this.extractClosingTagName(s);return r&&i&&r===i?`${e}${n}${s}`:`${e}${s}`}))}extractOpeningTagName(t){const e=t.match(/<(\w[\w-]*)/);return e?e[1]:null}extractClosingTagName(t){const e=t.match(/<\/(\w[\w-]*)/);return e?e[1]:null}}class Oe{process(t){return t.replace(/(>)[\n\t]+(?=.)/g,"$1")}}class ye{process(t){return t.replace(/(.?)[\n\t]+(?=<)/g,"$1")}}class Ee{constructor(){this.processors=[new be,new Oe,new ye]}clean(t){if(!t||0===t.trim().length)return t;let e,n=t;do{e=n;for(const t of this.processors)n=t.process(n)}while(n!==e);return n}}const ke="COMMIT_VALUE";class Ae extends m{constructor(t,e,n){super(),this.candidate=t,this.previous=e,this.host=n,this.isFlushable=!1,this.type="COMMIT_VALUE"}}class ve extends wt{constructor(t){super(),t.forEach((t=>{t.parent=this})),this.children=t}static fromJSON(t,e={autoMatchFormat:!0}){const n=t.map((t=>{const n=X.getRTEBlockClass(t.type);if(n)return n.from(t,e);throw new Error(`[Vega] Unknown block type: ${t.type}`)}));return new ve(n)}static createEmptyContent(t={autoMatchFormat:!0}){return ve.fromJSON([{id:nt(),type:"paragraph",annotations:{internalWrapper:!t.autoMatchFormat},nodes:[{id:nt(),annotations:{plainText:!t.autoMatchFormat},type:"text",text:""}]}],t)}static fromHtml(t,e={autoMatchFormat:!0,skipCustomAnnotations:!1}){const n=(new Ee).clean(t),s=Te.preserve(n),r=s.getProcessedHtml(),i=(new DOMParser).parseFromString(r,"text/html").body,o=Array.from(i.childNodes);s.restore(o);const a=gt.process(o,e).filter(st).map((t=>t.toDto(e))).filter(st);return new ve(a)}static generateContentStyles(t){return F.generateAllStylesContent(null==t?void 0:t.enableFontImports)}clone(t=!1){return new ve(t?this.children.map((t=>t.clone(this))):[...this.children])}toJSON(){return this.children.map((t=>t.toJSON()))}toHtml(t){return t&&(st(t.autoMatchFormat)||st(t.skipCustomAnnotations))&&dt.warn("The 'options' parameter's properties 'autoMatchFormat' and 'skipCustomAnnotations' in toHtml method are deprecated and will be removed in the future."),this.isEmpty()?"":this.children.map((e=>e.toHtml({filterInlineStyles:null==t?void 0:t.filterInlineStyles}))).join("")}isEmpty(){return 0===this.children.length||1===this.children.length&&!this.children[0].isNotEmpty()}apply(t){if(h.executeTheStrategy(t,this),t.executedFlag&&t.isFlushable){const t=r.getDOMByEntity(this);t&&rt.notify(it.getSubject(t,lt),{})}}getLastNode(){return 0===this.children.length?null:this.children[this.children.length-1].getLastNode()}getPlainText(){return this.children.map((t=>t.getPlainText())).join("")}toListItem(t){var e;t.children.map((t=>t.apply(new et)));const n=new H(nt());return n.apply(new f(t.children)),n.annotationMap=t.annotationMap,t instanceof H&&(null===(e=t.nestList)||void 0===e?void 0:e.length)&&(n.apply(new j([...t.nestList])),t.apply(new j([]))),n}createList(t){return new N(nt(),t)}findNodeById(t){return this.findNodeInBlocksById(t,this.children)}findNodeInBlocksById(t,e){for(const n of e){if("children"in n)for(const e of n.children)if(e.id===t)return e;if(n instanceof H&&n.nestList)for(const e of n.nestList){const n=this.findNodeInBlocksById(t,e.children);if(n)return n}if(n instanceof N&&n.children){const e=this.findNodeInBlocksById(t,n.children);if(e)return e}}return null}}ve.typeName="VegaRTEContent",h.register(d.DELETE_CHILDREN,ve.typeName,new C),h.register(d.APPEND_CHILDREN,ve.typeName,new Tt),h.register(d.INSERT_CHILDREN_BEFORE,ve.typeName,new xt),h.register(d.INSERT_CHILDREN_AFTER,ve.typeName,new bt),h.register(d.TRANSFORM_TO_CODE_BLOCK,ve.typeName,new class extends t{handleAction(t,s){const r=t.selectedBlocks,i=new e(nt(),this.getCodeContent(r),"plainText");s.apply(new n(r[0],i)),t.newCodeBlock=i,this.removeSelectBlocks(r,s)}getCodeContent(t){return t.filter((t=>"image"!==t.type&&"list-item"!==t.type)).map((t=>t.children.map((t=>t.text)).join(""))).join("\n")}removeSelectBlocks(t,e){for(let n=0;n<t.length;n++)e.apply(new s(t[n]))}}),h.register(d.UPDATE_CURSOR_POSITION,ve.typeName,new class extends t{handleAction(t,e){const{offset:n,nextFocusNode:s,immediatelyRun:i}=t,o=r.getDOMByEntity(e);o&&rt.notify(it.getSubject(o,ot),{node:s,offset:n,updateDirectly:i})}}),h.register(d.DELETE_SELECTED_CONTENT,ve.typeName,new class extends t{handleAction(t){const{host:e,mergeFlag:n}=t;rt.notify(it.getSubject(e,at),{host:e,detail:n})}}),h.register("COMMIT_VALUE",ve.typeName,new class extends t{handleAction(t){return t.candidate}});export{Lt as A,oe as B,ke as C,pt as E,ae as H,Et as I,At as M,St as P,kt as R,Te as S,Bt as U,ve as V,xt as a,yt as b,Rt as c,mt as d,Ot as e,Ae as f,gt as g,ie as h}
@@ -1 +0,0 @@
1
- import{R as t,ad as e,ae as o,af as r,N as s,U as n,l as i,e as a,M as l,j as d,s as h,A as c,b as u,r as p}from"./p-9680dfe6.js";import{e as v,a as m,b as k}from"./p-d7e59f31.js";import{g as f}from"./p-8b5d3a52.js";import{E as b,U as w}from"./p-ae12cc3f.js";import{D as g}from"./p-36a57431.js";import{d as x,b as y,c as A}from"./p-a83cef5a.js";import{V as B}from"./p-c0eb8c58.js";import{c as D}from"./p-8387896e.js";import{d as E}from"./p-1bc5b3bc.js";import{t as R}from"./p-b75ee3ba.js";import{V as O}from"./p-44245a36.js";import{i as N}from"./p-4d20a56f.js";import{v as j}from"./p-4866e390.js";class K{constructor(){this.dropdownEl=null,this.itemsContainerEl=null,this.buttonEl=null}isHidden(t){return t.sourceEditMode}getExtensionContext(t){return v.getExtensionContext(t)}renderDropdown(t,e,o,r){return t("vega-dropdown",Object.assign({trigger:"click",searchable:!1,maxWidth:"200",itemDisplayRule:"ellipsis",isScreenPosition:!0,role:"presentation",ref:t=>{this.dropdownEl=t,g.addUniqueObserverToNode(t,x,(t=>{this.handleDropdownClick(t.detail,e)}))}},o),r)}renderDropdownListTemplate(t,e,o){return t("div",{slot:"items",onMouseDown:this.preventDefault,onKeyDown:t=>this.handleItemsKeyDown(t),ref:t=>{this.itemsContainerEl=t},class:"rte-dropdown-list"},[t("style",{nonce:j.nonce},".rte-dropdown-list vega-dropdown-group vega-dropdown-group { padding-left: 4px }"),...e.map((e=>"children"in e?this.renderDropdownGroup(t,e,o):this.renderDropdownItem(t,e,o)))])}renderDropdownItem(t,e,o){return t("vega-dropdown-item",{key:e.key,itemKey:e.key,label:o.translation.t(e.label),prefixIcon:e.icon})}renderDropdownGroup(t,e,o){return t("vega-dropdown-group",{key:e.key,label:o.translation.t(e.label),divide:!1},e.children.map((e=>"children"in e?this.renderDropdownGroup(t,e,o):this.renderDropdownItem(t,e,o))))}renderButton(t,e,o){const{icon:r,label:s,showArrowIcon:n,tooltip:i,ariaLabel:a}=o,l=this.isDisabled(e),d=t("vega-rich-text-editor-toolbar-button",{disabled:l,icon:r,"data-aria-label":null!=a?a:s,hidden:this.isHidden(e),selected:this.isSelected(e),ref:t=>{this.buttonEl=t,g.addUniqueObserverToNode(t,y,(()=>this.handleButtonClick(e)))},onMouseDown:this.preventDefault,onKeyDown:t=>this.handleButtonKeyDown(t)},[this.renderButtonLabel(t,e,s),n?t("vega-icon",{size:"size-8",color:l?"text-disabled":"text-secondary",style:{marginLeft:"8px"},"aria-hidden":"true",icon:O.getIconKey("chevron-down")}):null].filter(N));return(null==i?void 0:i.text)?t("vega-tooltip",{text:e.translation.t(i.text),placement:["bottom","top"]},[d]):d}renderButtonLabel(t,e,o){return o?t("vega-font",{variant:"font-field-label-sm",color:this.isDisabled(e)?"text-disabled":"text-primary","aria-hidden":"true"},e.translation.t(o)):null}isDisabled(t){return t.host.disabled}isSelected(t){return!1}preventDefault(t){t.preventDefault()}focusToolbarButton(){var t,e,o,r;const s=null!==(o=null===(e=null===(t=this.buttonEl)||void 0===t?void 0:t.shadowRoot)||void 0===e?void 0:e.querySelector("button"))&&void 0!==o?o:null;null===(r=null!=s?s:this.buttonEl)||void 0===r||r.focus()}getListItemByKey(t,e){for(const o of t)if("children"in o){const t=this.getListItemByKey(o.children,e);if(t)return t}else if(o.key===e)return o;return null}handleButtonKeyDown(t){this.dropdownEl&&("Enter"===t.code||"Space"===t.code?(t.preventDefault(),t.stopPropagation(),this.dropdownEl.dispatchEvent(new MouseEvent("click",{bubbles:!0}))):"ArrowDown"!==t.code&&"ArrowUp"!==t.code||(t.preventDefault(),t.stopPropagation(),this.dropdownEl.show().then((()=>{this.focusDropdownItem("ArrowDown"===t.code?"first":"last")}))))}handleItemsKeyDown(t){var e,o;if("Escape"===t.code)return t.preventDefault(),t.stopPropagation(),this.dropdownEl&&this.dropdownEl.hide(),void this.focusToolbarButton();if("ArrowDown"!==t.code&&"ArrowUp"!==t.code)return;t.preventDefault(),t.stopPropagation();const r=this.getDropdownItems();if(0===r.length)return;const s=r.findIndex((t=>{var e,o;return(null===(e=t.shadowRoot)||void 0===e?void 0:e.querySelector("li"))===(null===(o=t.shadowRoot)||void 0===o?void 0:o.activeElement)})),n="ArrowDown"===t.code?1:-1,i=-1===s?"ArrowDown"===t.code?0:r.length-1:s+n;for(let t=0;t<r.length;t++){const s=(i+t*n+r.length)%r.length;if(!r[s].disabled)return void(null===(o=null===(e=r[s].shadowRoot)||void 0===e?void 0:e.querySelector("li"))||void 0===o||o.focus())}}focusDropdownItem(t){var e,o;const r=this.getDropdownItems(),s="first"===t?r:[...r].reverse();for(const t of s)if(!t.disabled)return void(null===(o=null===(e=t.shadowRoot)||void 0===e?void 0:e.querySelector("li"))||void 0===o||o.focus())}getDropdownItems(){return this.itemsContainerEl?Array.from(this.itemsContainerEl.querySelectorAll("vega-dropdown-item")):[]}}class S{}class _ extends t{constructor(t,e,o,r){super(t,"",o,r),this.dtoName=_.dtoName,this.type="bookmark",this.name=e}static from(t,e){const o=new _(t.id,t.name,e);return t.annotations&&(o.annotationMap=this.generateTextAnnotationMap(t.annotations)),o}toJSON(){const t=super.toJSON().annotations;return Object.assign(Object.assign({id:this.id},t?{annotations:t}:{}),{type:this.type,text:"",name:this.name})}isContentEditable(){return!1}clone(t){return new _(this.id,this.name,t,super.cloneAnnotations())}isEmpty(){return!1}toHtml(){return`<a id="${e(this.name)}"></a>`}doAnnotationActionApply(t){t instanceof o||t instanceof r&&t.annotationType===s.BOLD||super.doAnnotationActionApply(t)}}_.typeName="RTEBookmarkNode",_.dtoName="RTEBookmarkNode";class C extends S{canIntercept(e,o){const{startContainerNode:r,startOffset:s}=e;if(!(r instanceof t))return!1;const n=o.children.indexOf(r);return r.parent===o&&n>0&&o.children[n-1]instanceof _&&(0===s||1===r.text.length&&s===r.text.length)}intercept(t,e,o){const r=e.startContainerNode;if(1===r.text.length&&1===e.startOffset)return r.apply(new n("")),void(e.previousNode=r);const s=o.children.indexOf(r);o.apply(new i(o.children[s-1])),e.nextNode=r}}class I extends a{handleAction(t,e){e.name=t.name}}class M extends l{constructor(t,e){super(),this.type=d.INSERT_NODE_TO_NEAREST_ROOT,this.rteRange=t,this.nodeToBeInserted=e}}class T extends a{handleAction(t,e){const{rteRange:o,name:r}=t;if(o&&o.startNode){const s=new _(f(),r,e);e.apply(new M(o,s)),t.actionHandleResult=!0}}}class H extends l{constructor(t,e){super(),this.type="INSERT_BOOKMARK_NODE",this.rteRange=null,this.actionHandleResult=!1,this.rteRange=t,this.name=e}}class L extends l{constructor(t){super(),this.type="UPDATE_BOOKMARK_NAME",this.name=t}}const P="M0 48V487.7C0 501.1 10.9 512 24.3 512c5 0 9.9-1.5 14-4.4L192 400 345.7 507.6c4.1 2.9 9 4.4 14 4.4c13.4 0 24.3-10.9 24.3-24.3V48c0-26.5-21.5-48-48-48H48C21.5 0 0 21.5 0 48z",U={icon:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="${P}"/></svg>`};function V(t){const e=[],o=new Set;return function t(r){if(!r||"object"!=typeof r||o.has(r))return;if(o.add(r),r instanceof _)return void e.push(r);const{children:s,nestList:n}=r;Array.isArray(s)&&s.forEach(t),Array.isArray(n)&&n.forEach(t)}(t),e}function $(t){return V(t).map((t=>t.name))}class z extends m{constructor(){super(...arguments),this.rangeHighlightHandlers=new WeakMap,this.openPopoverNode=null,this.handleBalloonShow=t=>{const e=this.getBookmarkAnchor(t);e&&(this.openPopoverNode=this.getBookmarkNodeByAnchor(e),e.classList.add(z.SELECTED_CLASS))},this.handleBalloonHide=t=>{const e=this.getBookmarkAnchor(t);e&&(this.getBookmarkNodeByAnchor(e)===this.openPopoverNode&&(this.openPopoverNode=null),e.classList.remove(z.SELECTED_CLASS))}}doRender(t,e,o){return o&&!1!==o.editable?this.renderEditableBookmark(t,e,o):this.renderReadonlyBookmark(t,e)}injectRTEScopeStyles(){return["a.rte-bookmark{display: inline-block; vertical-align: middle; line-height: 0; cursor: pointer; padding: 0; margin: 0; border-radius: 2px}","a.rte-bookmark.rte-bookmark-readonly{cursor: default}","a.rte-bookmark > vega-rich-text-bookmark-editor{position: absolute; width: 0; height: 0}","a.rte-bookmark .rte-bookmark__icon{display: inline-block; position: relative; top: -0.125em; vertical-align: middle; line-height: 0; height: 1em; width: 1em}","a.rte-bookmark svg{display: block; height: 100%; width: 100%}",`a.rte-bookmark.${z.SELECTED_CLASS}{color: rgba(var(--v-bg-action, 19,98,226,1))}`].join("\n")}teardownRangeHighlight(t){var e,o;const r=null!==(e=this.rangeHighlightHandlers.get(t))&&void 0!==e?e:null;r&&(null===(o=R())||void 0===o||o.removeEventListener("selectionchange",r),this.rangeHighlightHandlers.delete(t))}renderReadonlyBookmark(t,e){return t("a",{key:e.id,id:e.name,class:"rte-bookmark rte-bookmark-readonly",title:e.name},[this.renderIcon(t)])}renderEditableBookmark(t,e,o){const r=this.useRef(e);let s=null,n=null;return this.ensureRangeHighlight(o.host),t("a",{key:e.id,id:e.name,class:"rte-bookmark",contenteditable:"false",role:"button",tabIndex:0,"aria-label":`${B.t("Bookmark")}: ${e.name}`,title:e.name,onKeyDown:D(),onMouseDown:t=>t.preventDefault(),onClick:()=>{n&&(n.reservedNames=this.getReservedNames(e,o)),this.placeCaretAfterBookmark(e,o)},ref:t=>{t?(s=t,r(t)):null==n||n.hide()}},[this.renderIcon(t),t("vega-rich-text-bookmark-editor",{mode:"preview",name:e.name,ref:t=>{t&&(n=t,s&&t.target!==s&&(t.target=s),this.bindSelectedStateToBalloon(t),g.addUniqueObserverToNode(t,A,(t=>{this.handleChange(t,e,o)})))}})])}renderIcon(t){return t("span",{class:"rte-bookmark__icon"},[t("svg",{viewBox:"0 0 384 512","aria-hidden":"true",focusable:"false"},[t("path",{fill:"currentColor",d:P})])])}placeCaretAfterBookmark(t,e){var o;null===(o=e.host)||void 0===o||o.value.apply(new w(t,t.getRangeEndOffset(),!0))}bindSelectedStateToBalloon(t){t.removeEventListener("vegaPopoverShow",this.handleBalloonShow),t.removeEventListener("vegaPopoverHide",this.handleBalloonHide),t.addEventListener("vegaPopoverShow",this.handleBalloonShow),t.addEventListener("vegaPopoverHide",this.handleBalloonHide)}ensureRangeHighlight(t){const e=R();if(!t||!e||this.rangeHighlightHandlers.has(t))return;const o=E((()=>this.syncRangeHighlight(t)),30,this);this.rangeHighlightHandlers.set(t,o),e.addEventListener("selectionchange",o)}syncRangeHighlight(t){var e;const o=null===(e=this.getExtensionContext(t))||void 0===e?void 0:e.getSelection(),r=o&&o.rangeCount>0?o.getRangeAt(0):null;V(t.value).forEach((t=>{const e=h.getDOMByEntity(t);if(e){const o=!!r&&!r.collapsed&&r.intersectsNode(e);e.classList.toggle(z.SELECTED_CLASS,o||t===this.openPopoverNode)}}))}getBookmarkAnchor(t){var e;return null===(e=t.currentTarget)||void 0===e?void 0:e.closest("a.rte-bookmark")}getBookmarkNodeByAnchor(t){const e=h.getEntityByDOM(t);return e instanceof _?e:null}getReservedNames(t,e){var o;return V(null===(o=e.host)||void 0===o?void 0:o.value).filter((e=>e!==t)).map((t=>t.name))}handleChange(t,e,o){var r;const s=o.host;if(s)return"save"===t.detail.action?(e.apply(new L(t.detail.name)),void(null===(r=this.getExtensionContext(s))||void 0===r||r.flushValue(s.value))):void this.removeBookmark(e,s)}removeBookmark(t,e){var o,r,s,n;const a=null!==(r=null===(o=t.parent)||void 0===o?void 0:o.children)&&void 0!==r?r:[],l=a.indexOf(t),d=l>=0?a[l+1]:null,h=l>0?a[l-1]:null;null===(s=t.parent)||void 0===s||s.apply(new i(t)),null===(n=this.getExtensionContext(e))||void 0===n||n.flushValue(e.value),d?e.value.apply(new w(d,0,!0)):h&&e.value.apply(new w(h,h.getRangeEndOffset(),!0))}}z.typeName="RTEBookmarkNodeRenderer",z.SELECTED_CLASS="rte-bookmark-selected";class W extends K{constructor(){super(...arguments),this.editorRef=null,this.buttonWrapperRef=null,this.pendingRange=null}render(t,e){return t("vega-rich-text-bookmark-editor",{mode:"insert",name:"",ref:t=>{t&&(this.editorRef=t,this.syncPopoverTarget(),g.addUniqueObserverToNode(t,A,(t=>{this.handleEditorChange(t,e)})))}},[t("div",{ref:t=>{t&&(this.buttonWrapperRef=t,this.syncPopoverTarget())}},[this.renderButton(t,e,{icon:"rte-bookmark",tooltip:{text:B.t("Bookmark")}})])])}isDisabled(t){let e=super.isDisabled(t);const o=this.getExtensionContext(t.host);if(o){const{getSelectedNodes:t}=o,[r]=t();r&&(e||(e=!c.canHandle("INSERT_BOOKMARK_NODE",r.parent)))}return e}handleButtonClick(t){this.pendingRange=t.rteRange.clone(),this.editorRef&&(this.editorRef.reservedNames=$(t.host.value),this.editorRef.show())}handleDropdownClick(){}syncPopoverTarget(){this.editorRef&&this.buttonWrapperRef&&this.editorRef.target!==this.buttonWrapperRef&&(this.editorRef.target=this.buttonWrapperRef)}handleEditorChange(t,e){if("save"!==t.detail.action)return;const o=this.pendingRange,r=null==o?void 0:o.startNode;if(!(null==r?void 0:r.parent))return;const s=new H(o,t.detail.name);if(r.parent.apply(s),s.actionHandleResult){const t=this.getExtensionContext(e.host);null==t||t.flushValue(t.host.value)}this.pendingRange=null}}O.register({"rte-bookmark":U});const G=new class extends b{canHandle(t,e){return this.isBookmarkAnchor(t[e])?1:0}handle(t){const e=this.resolveBookmarkName(t[0]);return e?{id:f(),type:"bookmark",text:"",name:e}:null}appendChildBlocks(){}shouldProceedToElementChildren(){return!1}isBookmarkAnchor(t){return!!t&&"A"===t.nodeName&&!t.hasAttribute("href")&&this.isEmptyAnchor(t)&&!!this.resolveBookmarkName(t)}resolveBookmarkName(t){return(t.getAttribute("id")||t.getAttribute("name")||"").trim()}isEmptyAnchor(t){return 0===(t.textContent||"").trim().length&&0===t.children.length}};class J extends k{constructor(){super(),this.bookmarkRenderer=new z,this.registerNode("bookmark",_),this.registerRenderer("bookmark",this.bookmarkRenderer),this.registerElementToNodeDTOClassStrategy(G)}prepareBeforeLoad(t){this.registerToolbarButtonRenderer(J.TOOLBAR_BUTTON_KEY,new W,t)}destroyExtension(){var t;const e=null===(t=this.extensionContext)||void 0===t?void 0:t.host;e&&this.bookmarkRenderer.teardownRangeHighlight(e)}}(()=>{const t=new T;k.registerActionHandleStrategy(u.typeName,"INSERT_BOOKMARK_NODE",t),k.registerActionHandleStrategy(p.typeName,"INSERT_BOOKMARK_NODE",t),k.registerActionHandleStrategy(_.typeName,"UPDATE_BOOKMARK_NAME",new I);const e=new C;k.registerActionHandlerInterceptor(u.typeName,d.DELETE_BLOCK_CONTENT,e),k.registerActionHandlerInterceptor(p.typeName,d.DELETE_BLOCK_CONTENT,e)})(),J.TOOLBAR_BUTTON_KEY="bookmark";class q extends l{constructor(t,e){super(),this.type=d.REPLACE_SELECTED_TEXT,this.textToBeInsert="",this.textToBeInsert=t,this.currentRange=e}}class F extends k{constructor(t={}){super(),this.config=t}prepareBeforeLoad(t){F.configStore.set(t,this.config)}destroyExtension(){var t;(null===(t=this.extensionContext)||void 0===t?void 0:t.host)&&F.configStore.delete(this.extensionContext.host)}}F.configStore=F.createStateStore();export{S as A,M as I,q as R,J as V,F as a,K as b,U as c,$ as d}