@heartlandone/vega 2.68.1 → 2.69.1

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 (282) hide show
  1. package/dist/cjs/{app-globals-f7106a22.js → app-globals-837be7a6.js} +7 -7
  2. package/dist/cjs/{code-block-39074880.js → code-block-bb4cbafa.js} +1 -1
  3. package/dist/cjs/{component-global-style-slimmer-d5216fa7.js → component-global-style-slimmer-adfa2e59.js} +1 -1
  4. package/dist/cjs/{component-value-history-controller-slimmer.abstract-ddedf543.js → component-value-history-controller-slimmer.abstract-cf7b4bda.js} +2 -2
  5. package/dist/cjs/{dark-mode-style-controller-27809ff8.js → dark-mode-style-controller-c21172aa.js} +1 -1
  6. package/dist/cjs/{design-token-e14a4e66.js → design-token-00fe8d2f.js} +1 -1
  7. package/dist/cjs/{dto-renderer-manager-b7969d6c.js → dto-renderer-manager-c917dade.js} +1 -1
  8. package/dist/cjs/{element-appender-slimmer-7ee27ab3.js → element-appender-slimmer-f8e89f37.js} +2 -2
  9. package/dist/cjs/{form-field-controller-slimmer-2a091912.js → form-field-controller-slimmer-f865d397.js} +1 -1
  10. package/dist/cjs/{function-extension-f0e845f2.js → function-extension-28a4d781.js} +15 -10
  11. package/dist/cjs/{image-annotation-action-7f0626c8.js → image-annotation-action-8843adbf.js} +3 -3
  12. package/dist/cjs/index.cjs.js +11 -11
  13. package/dist/cjs/{language-extension-d0103d1a.js → language-extension-99c6fb40.js} +2 -2
  14. package/dist/cjs/loader.cjs.js +9 -9
  15. package/dist/cjs/{public-rules-8b67eaba.js → public-rules-759c745b.js} +5 -5
  16. package/dist/cjs/{range-002671b6.js → range-0b597850.js} +1 -1
  17. package/dist/cjs/{responsive-format-facade-347db035.js → responsive-format-facade-1d9c13a9.js} +5 -5
  18. package/dist/cjs/{rich-text-editor-required-rule-5392bd8a.js → rich-text-editor-required-rule-92d0640e.js} +1 -1
  19. package/dist/cjs/{style-formatter-0a09f0dd.js → style-formatter-1daa8371.js} +1 -1
  20. package/dist/cjs/{translation-f5adcb9f.js → translation-5f9f9c0c.js} +2 -0
  21. package/dist/cjs/{translation-slimmer-4b6239d1.js → translation-slimmer-f0ebe710.js} +1 -1
  22. package/dist/cjs/vega-accordion.cjs.entry.js +8 -8
  23. package/dist/cjs/vega-app-footer.cjs.entry.js +2 -2
  24. package/dist/cjs/vega-app-header-button.cjs.entry.js +8 -8
  25. package/dist/cjs/vega-box.cjs.entry.js +9 -9
  26. package/dist/cjs/vega-brand-logo.cjs.entry.js +2 -2
  27. package/dist/cjs/vega-breadcrumb.cjs.entry.js +2 -2
  28. package/dist/cjs/vega-button-circle.cjs.entry.js +8 -8
  29. package/dist/cjs/vega-button.cjs.entry.js +8 -8
  30. package/dist/cjs/vega-calendar_4.cjs.entry.js +3 -3
  31. package/dist/cjs/vega-card.cjs.entry.js +8 -8
  32. package/dist/cjs/vega-carousel.cjs.entry.js +7 -7
  33. package/dist/cjs/vega-checkbox_2.cjs.entry.js +2 -2
  34. package/dist/cjs/vega-chip.cjs.entry.js +8 -8
  35. package/dist/cjs/vega-code-block.cjs.entry.js +8 -8
  36. package/dist/cjs/vega-color-picker.cjs.entry.js +2 -2
  37. package/dist/cjs/vega-combo-box.cjs.entry.js +2 -2
  38. package/dist/cjs/vega-date-picker_2.cjs.entry.js +10 -10
  39. package/dist/cjs/vega-dialog_2.cjs.entry.js +9 -9
  40. package/dist/cjs/vega-divider.cjs.entry.js +8 -8
  41. package/dist/cjs/vega-dropdown_5.cjs.entry.js +20 -11
  42. package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
  43. package/dist/cjs/vega-file-uploader.cjs.entry.js +3 -3
  44. package/dist/cjs/vega-flag-icon.cjs.entry.js +8 -8
  45. package/dist/cjs/vega-flex.cjs.entry.js +9 -9
  46. package/dist/cjs/vega-font.cjs.entry.js +8 -8
  47. package/dist/cjs/vega-form.cjs.entry.js +2 -2
  48. package/dist/cjs/vega-grid.cjs.entry.js +8 -8
  49. package/dist/cjs/vega-icon.cjs.entry.js +8 -8
  50. package/dist/cjs/vega-image-uploader.cjs.entry.js +9 -9
  51. package/dist/cjs/vega-input-credit-card.cjs.entry.js +2 -2
  52. package/dist/cjs/vega-input-numeric.cjs.entry.js +2 -2
  53. package/dist/cjs/vega-input-passcode.cjs.entry.js +2 -2
  54. package/dist/cjs/vega-input-phone-number.cjs.entry.js +7 -7
  55. package/dist/cjs/vega-input-range.cjs.entry.js +3 -3
  56. package/dist/cjs/vega-input-select.cjs.entry.js +143 -17
  57. package/dist/cjs/vega-input.cjs.entry.js +89 -29
  58. package/dist/cjs/vega-left-nav_5.cjs.entry.js +9 -9
  59. package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +7 -7
  60. package/dist/cjs/{vega-nonce-manager-f927497f.js → vega-nonce-manager-df69d3ed.js} +2 -2
  61. package/dist/cjs/vega-pagination-page-size-selector-mobile.cjs.entry.js +2 -2
  62. package/dist/cjs/vega-pagination.cjs.entry.js +8 -8
  63. package/dist/cjs/vega-popover_2.cjs.entry.js +9 -9
  64. package/dist/cjs/vega-radio_2.cjs.entry.js +2 -2
  65. package/dist/cjs/vega-rich-text-content.cjs.entry.js +5 -5
  66. package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +11 -11
  67. package/dist/cjs/vega-selection-chip_2.cjs.entry.js +8 -8
  68. package/dist/cjs/vega-selection-tile_2.cjs.entry.js +2 -2
  69. package/dist/cjs/vega-sidenav_3.cjs.entry.js +7 -7
  70. package/dist/cjs/vega-signature-capture.cjs.entry.js +12 -10
  71. package/dist/cjs/vega-stepper.cjs.entry.js +2 -2
  72. package/dist/cjs/vega-tab-group_2.cjs.entry.js +1 -1
  73. package/dist/cjs/vega-table_11.cjs.entry.js +8 -8
  74. package/dist/cjs/vega-textarea.cjs.entry.js +3 -3
  75. package/dist/cjs/vega-time-picker_2.cjs.entry.js +10 -10
  76. package/dist/cjs/vega-toggle-switch.cjs.entry.js +2 -2
  77. package/dist/cjs/vega-tooltip_2.cjs.entry.js +8 -8
  78. package/dist/cjs/vega.cjs.js +9 -9
  79. package/dist/collection/components/vega-button/vega-button.css +20 -12
  80. package/dist/collection/components/vega-dropdown/slimmers/controllers/vega-dropdown-selected-controller.js +4 -1
  81. package/dist/collection/components/vega-dropdown/vega-dropdown.js +27 -0
  82. package/dist/collection/components/vega-input/slimmers/renderers/vega-input-password-eye-renderer.js +41 -0
  83. package/dist/collection/components/vega-input/vega-input.css +13 -0
  84. package/dist/collection/components/vega-input/vega-input.js +21 -3
  85. package/dist/collection/components/vega-input-select/slimmers/controllers/vega-input-select-source-controller.js +4 -0
  86. package/dist/collection/components/vega-input-select/slimmers/controllers/vega-input-select-value-controller.js +18 -4
  87. package/dist/collection/components/vega-input-select/slimmers/renderers/vega-input-select-dropdown-renderer.js +17 -3
  88. package/dist/collection/components/vega-input-select/vega-input-select.js +14 -1
  89. package/dist/collection/components/vega-rich-text-editor/extensions/base-extension-renderer.js +3 -1
  90. package/dist/collection/components/vega-rich-text-editor/extensions/functions/renderers/function-toolbar-button-renderer.js +9 -6
  91. package/dist/collection/components/vega-signature-capture/slimmers/written-mode/controllers/written-mode-svg-controller.js +1 -0
  92. package/dist/collection/components/vega-signature-capture/slimmers/written-mode/renderers/written-mode-renderer.js +1 -0
  93. package/dist/collection/components/vega-tab-group/vega-tab-group.js +2 -2
  94. package/dist/collection/components/vega-textarea/vega-textarea.js +2 -2
  95. package/dist/collection/global/icons/eye-slash.js +3 -0
  96. package/dist/collection/global/icons/eye.js +3 -0
  97. package/dist/collection/helpers/csp/test/vega-nonce-manager.test.js +11 -0
  98. package/dist/collection/helpers/csp/vega-nonce-manager.js +2 -2
  99. package/dist/collection/helpers/translation/locales/en.js +2 -0
  100. package/dist/collection/helpers/translation/tests/internal-translation-controller.test.js +2 -0
  101. package/dist/collection/helpers/validator/rules/input-select-value-in-source-rule.js +85 -0
  102. package/dist/collection/helpers/validator/test/rules/input-select-value-in-source-rule.test.js +99 -0
  103. package/dist/esm/{app-globals-2f689986.js → app-globals-fd4b7d97.js} +7 -7
  104. package/dist/esm/{code-block-e8839202.js → code-block-ecb4491b.js} +1 -1
  105. package/dist/esm/{component-global-style-slimmer-5d437fdf.js → component-global-style-slimmer-08046b38.js} +1 -1
  106. package/dist/esm/{component-value-history-controller-slimmer.abstract-c6f94113.js → component-value-history-controller-slimmer.abstract-5d618b88.js} +2 -2
  107. package/dist/esm/{dark-mode-style-controller-b7e85b6a.js → dark-mode-style-controller-de88a117.js} +1 -1
  108. package/dist/esm/{design-token-e9e6b011.js → design-token-2d77e8f5.js} +1 -1
  109. package/dist/esm/{dto-renderer-manager-7abc53bf.js → dto-renderer-manager-d862ae78.js} +1 -1
  110. package/dist/esm/{element-appender-slimmer-8dbc8387.js → element-appender-slimmer-6791c332.js} +2 -2
  111. package/dist/esm/{form-field-controller-slimmer-b23d9ff3.js → form-field-controller-slimmer-bf071b75.js} +1 -1
  112. package/dist/esm/{function-extension-eb1d062f.js → function-extension-8d39db56.js} +15 -10
  113. package/dist/esm/{image-annotation-action-7957653a.js → image-annotation-action-d0af138c.js} +3 -3
  114. package/dist/esm/index.js +11 -11
  115. package/dist/esm/{language-extension-3331131f.js → language-extension-8f51f5ff.js} +2 -2
  116. package/dist/esm/loader.js +9 -9
  117. package/dist/esm/{public-rules-e613dead.js → public-rules-d10e76f4.js} +5 -5
  118. package/dist/esm/{range-adf206fd.js → range-f7b9e2fb.js} +1 -1
  119. package/dist/esm/{responsive-format-facade-b0712993.js → responsive-format-facade-267935ae.js} +5 -5
  120. package/dist/esm/{rich-text-editor-required-rule-43857573.js → rich-text-editor-required-rule-774b822b.js} +1 -1
  121. package/dist/esm/{style-formatter-a20a1ef4.js → style-formatter-3f88c491.js} +1 -1
  122. package/dist/esm/{translation-f10b1e19.js → translation-96e5debd.js} +2 -0
  123. package/dist/esm/{translation-slimmer-984c9ce6.js → translation-slimmer-c936cb1b.js} +1 -1
  124. package/dist/esm/vega-accordion.entry.js +8 -8
  125. package/dist/esm/vega-app-footer.entry.js +2 -2
  126. package/dist/esm/vega-app-header-button.entry.js +8 -8
  127. package/dist/esm/vega-box.entry.js +9 -9
  128. package/dist/esm/vega-brand-logo.entry.js +2 -2
  129. package/dist/esm/vega-breadcrumb.entry.js +2 -2
  130. package/dist/esm/vega-button-circle.entry.js +8 -8
  131. package/dist/esm/vega-button.entry.js +8 -8
  132. package/dist/esm/vega-calendar_4.entry.js +3 -3
  133. package/dist/esm/vega-card.entry.js +8 -8
  134. package/dist/esm/vega-carousel.entry.js +7 -7
  135. package/dist/esm/vega-checkbox_2.entry.js +2 -2
  136. package/dist/esm/vega-chip.entry.js +8 -8
  137. package/dist/esm/vega-code-block.entry.js +8 -8
  138. package/dist/esm/vega-color-picker.entry.js +2 -2
  139. package/dist/esm/vega-combo-box.entry.js +2 -2
  140. package/dist/esm/vega-date-picker_2.entry.js +10 -10
  141. package/dist/esm/vega-dialog_2.entry.js +9 -9
  142. package/dist/esm/vega-divider.entry.js +8 -8
  143. package/dist/esm/vega-dropdown_5.entry.js +20 -11
  144. package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
  145. package/dist/esm/vega-file-uploader.entry.js +3 -3
  146. package/dist/esm/vega-flag-icon.entry.js +8 -8
  147. package/dist/esm/vega-flex.entry.js +9 -9
  148. package/dist/esm/vega-font.entry.js +8 -8
  149. package/dist/esm/vega-form.entry.js +2 -2
  150. package/dist/esm/vega-grid.entry.js +8 -8
  151. package/dist/esm/vega-icon.entry.js +8 -8
  152. package/dist/esm/vega-image-uploader.entry.js +9 -9
  153. package/dist/esm/vega-input-credit-card.entry.js +2 -2
  154. package/dist/esm/vega-input-numeric.entry.js +2 -2
  155. package/dist/esm/vega-input-passcode.entry.js +2 -2
  156. package/dist/esm/vega-input-phone-number.entry.js +7 -7
  157. package/dist/esm/vega-input-range.entry.js +3 -3
  158. package/dist/esm/vega-input-select.entry.js +143 -17
  159. package/dist/esm/vega-input.entry.js +90 -30
  160. package/dist/esm/vega-left-nav_5.entry.js +9 -9
  161. package/dist/esm/vega-loader-wrapper_2.entry.js +7 -7
  162. package/dist/esm/{vega-nonce-manager-87615d3c.js → vega-nonce-manager-497e5eb5.js} +2 -2
  163. package/dist/esm/vega-pagination-page-size-selector-mobile.entry.js +2 -2
  164. package/dist/esm/vega-pagination.entry.js +8 -8
  165. package/dist/esm/vega-popover_2.entry.js +9 -9
  166. package/dist/esm/vega-radio_2.entry.js +2 -2
  167. package/dist/esm/vega-rich-text-content.entry.js +5 -5
  168. package/dist/esm/vega-rich-text-editor_4.entry.js +11 -11
  169. package/dist/esm/vega-selection-chip_2.entry.js +8 -8
  170. package/dist/esm/vega-selection-tile_2.entry.js +2 -2
  171. package/dist/esm/vega-sidenav_3.entry.js +7 -7
  172. package/dist/esm/vega-signature-capture.entry.js +12 -10
  173. package/dist/esm/vega-stepper.entry.js +2 -2
  174. package/dist/esm/vega-tab-group_2.entry.js +1 -1
  175. package/dist/esm/vega-table_11.entry.js +8 -8
  176. package/dist/esm/vega-textarea.entry.js +3 -3
  177. package/dist/esm/vega-time-picker_2.entry.js +10 -10
  178. package/dist/esm/vega-toggle-switch.entry.js +2 -2
  179. package/dist/esm/vega-tooltip_2.entry.js +8 -8
  180. package/dist/esm/vega.js +9 -9
  181. package/dist/sri/vega-sri-manifest.json +258 -258
  182. package/dist/types/components/vega-dropdown/slimmers/controllers/vega-dropdown-selected-controller.d.ts +1 -0
  183. package/dist/types/components/vega-dropdown/vega-dropdown.d.ts +6 -0
  184. package/dist/types/components/vega-input/slimmers/renderers/vega-input-password-eye-renderer.d.ts +9 -0
  185. package/dist/types/components/vega-input/vega-input.d.ts +4 -0
  186. package/dist/types/components/vega-input-select/slimmers/controllers/vega-input-select-source-controller.d.ts +1 -0
  187. package/dist/types/components/vega-input-select/slimmers/controllers/vega-input-select-value-controller.d.ts +1 -0
  188. package/dist/types/components/vega-input-select/slimmers/renderers/vega-input-select-dropdown-renderer.d.ts +1 -0
  189. package/dist/types/components/vega-input-select/types.d.ts +1 -0
  190. package/dist/types/components/vega-input-select/vega-input-select.d.ts +1 -0
  191. package/dist/types/components/vega-tab-group/vega-tab-group.d.ts +1 -1
  192. package/dist/types/components/vega-textarea/vega-textarea.d.ts +1 -1
  193. package/dist/types/components.d.ts +14 -4
  194. package/dist/types/global/icons/eye-slash.d.ts +3 -0
  195. package/dist/types/global/icons/eye.d.ts +3 -0
  196. package/dist/types/helpers/translation/interface.d.ts +2 -0
  197. package/dist/types/helpers/validator/rules/input-select-value-in-source-rule.d.ts +60 -0
  198. package/dist/types/helpers/validator/test/rules/input-select-value-in-source-rule.test.d.ts +1 -0
  199. package/dist/vega/index.esm.js +1 -1
  200. package/dist/vega/{p-8506e8c3.js → p-0cdb38d3.js} +1 -1
  201. package/dist/vega/{p-22fe8c61.entry.js → p-0e5297b9.entry.js} +1 -1
  202. package/dist/vega/{p-c54148fb.entry.js → p-0feceaac.entry.js} +1 -1
  203. package/dist/vega/{p-7747c163.js → p-1372b984.js} +1 -1
  204. package/dist/vega/{p-00376f71.entry.js → p-1739a877.entry.js} +1 -1
  205. package/dist/vega/{p-1dd7f8b2.entry.js → p-1a59703b.entry.js} +1 -1
  206. package/dist/vega/{p-85407fb9.js → p-1bb0c934.js} +1 -1
  207. package/dist/vega/{p-7dde3be9.entry.js → p-1e92737c.entry.js} +1 -1
  208. package/dist/vega/{p-9fb6fbcc.js → p-1f26de89.js} +1 -1
  209. package/dist/vega/{p-76b1dae4.entry.js → p-235bf01b.entry.js} +1 -1
  210. package/dist/vega/{p-99bf5993.entry.js → p-257ff60b.entry.js} +1 -1
  211. package/dist/vega/{p-3ad87199.entry.js → p-25a3fad7.entry.js} +1 -1
  212. package/dist/vega/{p-a6fb5a40.entry.js → p-2622f0a8.entry.js} +1 -1
  213. package/dist/vega/{p-24419ebe.entry.js → p-26c4f07c.entry.js} +1 -1
  214. package/dist/vega/{p-e0979451.entry.js → p-2e6ce1e9.entry.js} +1 -1
  215. package/dist/vega/{p-de8c5fae.entry.js → p-2ec7e020.entry.js} +1 -1
  216. package/dist/vega/{p-0849f85e.js → p-2f09c6aa.js} +1 -1
  217. package/dist/vega/p-330c224f.entry.js +1 -0
  218. package/dist/vega/{p-369810ae.js → p-33f3f306.js} +1 -1
  219. package/dist/vega/{p-2f04d2ac.js → p-35252108.js} +1 -1
  220. package/dist/vega/p-35cd469a.entry.js +1 -0
  221. package/dist/vega/p-366825fa.entry.js +1 -0
  222. package/dist/vega/{p-83a50ac2.entry.js → p-37020002.entry.js} +1 -1
  223. package/dist/vega/{p-69d27eaf.entry.js → p-379f1b40.entry.js} +1 -1
  224. package/dist/vega/{p-2478f65e.js → p-38cb2b40.js} +1 -1
  225. package/dist/vega/{p-19256107.entry.js → p-3c865f86.entry.js} +1 -1
  226. package/dist/vega/{p-56636a58.entry.js → p-3e040167.entry.js} +1 -1
  227. package/dist/vega/{p-54ae02db.js → p-4866e390.js} +1 -1
  228. package/dist/vega/{p-79e6e12c.js → p-4a467973.js} +1 -1
  229. package/dist/vega/{p-d4893487.js → p-4e13a26f.js} +1 -1
  230. package/dist/vega/{p-238afe1b.entry.js → p-52efaadb.entry.js} +1 -1
  231. package/dist/vega/{p-b78670c9.entry.js → p-54e56f0d.entry.js} +1 -1
  232. package/dist/vega/{p-48bc03fa.entry.js → p-58769a72.entry.js} +1 -1
  233. package/dist/vega/{p-de02f404.entry.js → p-5972c101.entry.js} +1 -1
  234. package/dist/vega/{p-16d68187.js → p-5d827fe5.js} +1 -1
  235. package/dist/vega/p-5e708ad5.entry.js +1 -0
  236. package/dist/vega/p-5f377954.js +1 -1
  237. package/dist/vega/{p-6609d87e.entry.js → p-652626b6.entry.js} +1 -1
  238. package/dist/vega/{p-0a55f984.entry.js → p-65a9af84.entry.js} +1 -1
  239. package/dist/vega/{p-f3399ef1.entry.js → p-67eb405d.entry.js} +1 -1
  240. package/dist/vega/{p-a2506cb5.entry.js → p-69aec6af.entry.js} +1 -1
  241. package/dist/vega/{p-b5060e84.entry.js → p-71ddccf2.entry.js} +1 -1
  242. package/dist/vega/{p-d5ff8b7f.js → p-75f981ce.js} +1 -1
  243. package/dist/vega/{p-2c945862.entry.js → p-785d9ac3.entry.js} +1 -1
  244. package/dist/vega/{p-c26332ae.entry.js → p-796d840c.entry.js} +1 -1
  245. package/dist/vega/{p-8dba59a6.entry.js → p-7a590741.entry.js} +1 -1
  246. package/dist/vega/{p-ad5393f0.entry.js → p-7b42da4f.entry.js} +1 -1
  247. package/dist/vega/{p-5a555092.entry.js → p-8ac2f43f.entry.js} +1 -1
  248. package/dist/vega/{p-1dcb1fcd.entry.js → p-8c6b6ad7.entry.js} +1 -1
  249. package/dist/vega/{p-d3905af1.entry.js → p-8ff96b8c.entry.js} +2 -2
  250. package/dist/vega/{p-56f77466.entry.js → p-91d71ae9.entry.js} +1 -1
  251. package/dist/vega/{p-94e167b8.entry.js → p-9794fd88.entry.js} +1 -1
  252. package/dist/vega/{p-1922303e.entry.js → p-9e59345f.entry.js} +1 -1
  253. package/dist/vega/{p-6ce1e9d4.entry.js → p-9fd503e9.entry.js} +1 -1
  254. package/dist/vega/{p-626246b4.entry.js → p-a630ce73.entry.js} +1 -1
  255. package/dist/vega/{p-787caad3.entry.js → p-b27fcac4.entry.js} +1 -1
  256. package/dist/vega/{p-a211ae63.js → p-b5ba0c11.js} +1 -1
  257. package/dist/vega/{p-018d70a5.js → p-b8b9ed2c.js} +1 -1
  258. package/dist/vega/{p-bb37a401.js → p-b9798158.js} +1 -1
  259. package/dist/vega/{p-2e32fbe6.entry.js → p-bcc396c2.entry.js} +1 -1
  260. package/dist/vega/{p-b8558278.entry.js → p-bfb86c3e.entry.js} +1 -1
  261. package/dist/vega/p-c224b44c.js +1 -0
  262. package/dist/vega/{p-54ddd06f.entry.js → p-c2f21426.entry.js} +1 -1
  263. package/dist/vega/{p-117be41b.js → p-c616c592.js} +1 -1
  264. package/dist/vega/p-c6ae78f2.entry.js +1 -0
  265. package/dist/vega/{p-f0fb3fdd.entry.js → p-cbabb07a.entry.js} +1 -1
  266. package/dist/vega/{p-bd0e55a2.entry.js → p-dde03224.entry.js} +1 -1
  267. package/dist/vega/{p-719354e7.entry.js → p-ea04a387.entry.js} +1 -1
  268. package/dist/vega/{p-d67200e8.entry.js → p-ea96635b.entry.js} +1 -1
  269. package/dist/vega/{p-4c192985.js → p-ef9cbad1.js} +1 -1
  270. package/dist/vega/{p-30a8d9d6.entry.js → p-f21b893b.entry.js} +1 -1
  271. package/dist/vega/p-f69f84a7.js +1 -0
  272. package/dist/vega/{p-3b800f1b.entry.js → p-fb320b50.entry.js} +1 -1
  273. package/dist/vega/{p-82ef2de0.entry.js → p-ff470366.entry.js} +1 -1
  274. package/dist/vega/vega.esm.js +1 -1
  275. package/package.json +2 -1
  276. package/dist/vega/p-113d305b.entry.js +0 -1
  277. package/dist/vega/p-16358fec.entry.js +0 -1
  278. package/dist/vega/p-240d9d35.entry.js +0 -1
  279. package/dist/vega/p-39482a1a.js +0 -1
  280. package/dist/vega/p-437f865f.js +0 -1
  281. package/dist/vega/p-705dad87.entry.js +0 -1
  282. package/dist/vega/p-bb0f2b5f.entry.js +0 -1
@@ -9,6 +9,7 @@ export declare class VegaDropdownSelectedController extends VegaSlimmer {
9
9
  selectType: VegaDropdown['selectType'];
10
10
  source: VegaDropdown['source'];
11
11
  selectedSourceKey: VegaDropdown['selectedSourceKey'];
12
+ preserveValueIfNotInSource: VegaDropdown['preserveValueIfNotInSource'];
12
13
  vegaDropdownClick: VegaDropdown['vegaDropdownClick'];
13
14
  appenderController: VegaDropdown['appenderController'];
14
15
  childrenController: VegaDropdown['childrenController'];
@@ -283,6 +283,12 @@ export declare class VegaDropdown {
283
283
  * @vegaVersion 2.54.0
284
284
  */
285
285
  virtualizationThreshold: number;
286
+ /**
287
+ * Controls whether the value of selectedSourceKey is preserved when it does not exist in the source.
288
+ *
289
+ * @vegaVersion 2.69.0
290
+ */
291
+ preserveValueIfNotInSource: boolean;
286
292
  /**
287
293
  * An event emitter notifying that a dropdown item has been clicked.
288
294
  *
@@ -0,0 +1,9 @@
1
+ import { VegaSlimmer } from '../../../../vega-slimmer/vega-slimmer-core';
2
+ import { VegaInput } from '../../vega-input';
3
+ export declare class VegaInputPasswordEyeRenderer extends VegaSlimmer {
4
+ protected host: VegaInput['host'];
5
+ protected isPasswordDisplay: VegaInput['isPasswordDisplay'];
6
+ protected type: VegaInput['type'];
7
+ render(): HTMLElement;
8
+ private addEyeIconObserver;
9
+ }
@@ -13,6 +13,7 @@ import { VegaInputCompactWidthController } from './slimmers/controllers/vega-inp
13
13
  import { PageResizeObserverSlimmer } from '../../helpers/slimmers/page-resize-observer-slimmer';
14
14
  import { VegaInputStateController } from './slimmers/controllers/vega-input-state-controller';
15
15
  import { Nullable } from '../../types/general';
16
+ import { VegaInputPasswordEyeRenderer } from './slimmers/renderers/vega-input-password-eye-renderer';
16
17
  /**
17
18
  * @vegaVersion 1.0.5
18
19
  */
@@ -31,6 +32,7 @@ export declare class VegaInput {
31
32
  protected labelButtonClickEventEmitter: EventEmitSlimmerBase;
32
33
  protected pasteEventEmitter: EventEmitSlimmerBase;
33
34
  protected vegaComponentUsageRuntimeMetricsSlimmer: VegaComponentUsageRuntimeMetricsSlimmer<HTMLVegaInputElement>;
35
+ protected readonly passwordEyeRenderer: VegaInputPasswordEyeRenderer;
34
36
  private inputRef;
35
37
  private inputContainerRef;
36
38
  host: HTMLVegaInputElement;
@@ -38,6 +40,7 @@ export declare class VegaInput {
38
40
  suffixText: string;
39
41
  watchSuffixText(): void;
40
42
  isCompactInputWidth: boolean;
43
+ isPasswordDisplay: boolean;
41
44
  /**
42
45
  * Specifies the label or title for the input field.
43
46
  *
@@ -336,6 +339,7 @@ export declare class VegaInput {
336
339
  private focusInput;
337
340
  private setInputRef;
338
341
  private containerDom;
342
+ private getInputType;
339
343
  private groupDom;
340
344
  private renderLabelDom;
341
345
  private renderClearIcon;
@@ -6,6 +6,7 @@ import { Nullable } from '../../../../types/general';
6
6
  * a dropdown input component in TypeScript.
7
7
  */
8
8
  export declare class VegaInputSelectSourceController extends VegaSlimmer {
9
+ private host;
9
10
  private source;
10
11
  /**
11
12
  * convert the dropdown source when the component watchSource call
@@ -7,6 +7,7 @@ export declare class VegaInputSelectValueController extends VegaSlimmer {
7
7
  private changeEventEmitter;
8
8
  private host;
9
9
  private sourceController;
10
+ private vegaDropdownProps;
10
11
  /**
11
12
  * handle the value change when the component watchValue call
12
13
  *
@@ -19,6 +19,7 @@ export declare class VegaInputSelectDropdownRenderer extends VegaSlimmer {
19
19
  private sourceController;
20
20
  private translationSlimmer;
21
21
  private disabled;
22
+ watchVegaDropdownProps(): void;
22
23
  show(): Promise<void>;
23
24
  hide(): Promise<void>;
24
25
  getDropdownRef(): HTMLVegaDropdownElement;
@@ -20,6 +20,7 @@ export type VegaDropdownPropsForSelect = Partial<
20
20
  | 'isScreenPosition'
21
21
  | 'itemDisplayRule'
22
22
  | 'resettable'
23
+ | 'preserveValueIfNotInSource'
23
24
  >
24
25
  >;
25
26
 
@@ -170,6 +170,7 @@ export declare class VegaInputSelect {
170
170
  * @vegaVersion 1.3.0
171
171
  */
172
172
  vegaDropdownProps: VegaDropdownPropsForSelect;
173
+ watchVegaDropdownProps(): void;
173
174
  /**
174
175
  * Defines the size of the input select field.
175
176
  *
@@ -119,7 +119,7 @@ export declare class VegaTabGroup {
119
119
  /**
120
120
  * Specifies the overflow navigation for many tab items within the tab group.
121
121
  *
122
- * @vegaVersion __VERSION__
122
+ * @vegaVersion 2.49.0
123
123
  */
124
124
  overflow: TabGroupOverflowType;
125
125
  /**
@@ -60,7 +60,7 @@ export declare class VegaTextarea {
60
60
  * It provides essential information and functionality
61
61
  * related to the suffix button's role and behavior.
62
62
  *
63
- * @vegaVersion __VERSION__
63
+ * @vegaVersion 2.68.0
64
64
  */
65
65
  labelSuffixButtonConfig: Nullable<LabelSuffixButtonConfig>;
66
66
  /**
@@ -1409,6 +1409,11 @@ export namespace Components {
1409
1409
  * @vegaVersion 1.47.0
1410
1410
  */
1411
1411
  "prefixIconSlot": boolean;
1412
+ /**
1413
+ * Controls whether the value of selectedSourceKey is preserved when it does not exist in the source.
1414
+ * @vegaVersion 2.69.0
1415
+ */
1416
+ "preserveValueIfNotInSource": boolean;
1412
1417
  /**
1413
1418
  * Specifies whether the selected option in the dropdown can be cleared. It allows users to reset the selectedSourceKey when a selection has already been made.
1414
1419
  * @vegaVersion 2.46.0
@@ -3746,7 +3751,7 @@ export namespace Components {
3746
3751
  "gap": SpacingTokenType;
3747
3752
  /**
3748
3753
  * Specifies the overflow navigation for many tab items within the tab group.
3749
- * @vegaVersion __VERSION__
3754
+ * @vegaVersion 2.49.0
3750
3755
  */
3751
3756
  "overflow": TabGroupOverflowType;
3752
3757
  /**
@@ -4145,7 +4150,7 @@ export namespace Components {
4145
4150
  "label": string;
4146
4151
  /**
4147
4152
  * Specifies the properties for the suffix button associated with the input. It provides essential information and functionality related to the suffix button's role and behavior.
4148
- * @vegaVersion __VERSION__
4153
+ * @vegaVersion 2.68.0
4149
4154
  */
4150
4155
  "labelSuffixButtonConfig": Nullable<LabelSuffixButtonConfig>;
4151
4156
  /**
@@ -7124,6 +7129,11 @@ declare namespace LocalJSX {
7124
7129
  * @vegaVersion 1.47.0
7125
7130
  */
7126
7131
  "prefixIconSlot"?: boolean;
7132
+ /**
7133
+ * Controls whether the value of selectedSourceKey is preserved when it does not exist in the source.
7134
+ * @vegaVersion 2.69.0
7135
+ */
7136
+ "preserveValueIfNotInSource"?: boolean;
7127
7137
  /**
7128
7138
  * Specifies whether the selected option in the dropdown can be cleared. It allows users to reset the selectedSourceKey when a selection has already been made.
7129
7139
  * @vegaVersion 2.46.0
@@ -10001,7 +10011,7 @@ declare namespace LocalJSX {
10001
10011
  "onVegaClick"?: (event: VegaTabGroupCustomEvent<string>) => void;
10002
10012
  /**
10003
10013
  * Specifies the overflow navigation for many tab items within the tab group.
10004
- * @vegaVersion __VERSION__
10014
+ * @vegaVersion 2.49.0
10005
10015
  */
10006
10016
  "overflow"?: TabGroupOverflowType;
10007
10017
  /**
@@ -10400,7 +10410,7 @@ declare namespace LocalJSX {
10400
10410
  "label"?: string;
10401
10411
  /**
10402
10412
  * Specifies the properties for the suffix button associated with the input. It provides essential information and functionality related to the suffix button's role and behavior.
10403
- * @vegaVersion __VERSION__
10413
+ * @vegaVersion 2.68.0
10404
10414
  */
10405
10415
  "labelSuffixButtonConfig"?: Nullable<LabelSuffixButtonConfig>;
10406
10416
  /**
@@ -0,0 +1,3 @@
1
+ import { IconPayload } from '../../helpers/icon/interface';
2
+ declare const _default: IconPayload;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { IconPayload } from '../../helpers/icon/interface';
2
+ declare const _default: IconPayload;
3
+ export default _default;
@@ -39,6 +39,8 @@ export type StaticTranslationKey =
39
39
  | 'The end time should be later than start time'
40
40
  | 'Phone number is not valid'
41
41
  | 'Phone number is valid but it belongs to country {0}, not country {1}'
42
+ | 'The value does not exist in the source'
43
+ | 'There are values that do not exist in the source'
42
44
  // Component internal text
43
45
  // Common start
44
46
  | 'January'
@@ -0,0 +1,60 @@
1
+ import { FormFieldStatusMeta } from './form-field-validation-rule';
2
+ import { EvaluateResultTranslation } from './validation-rule';
3
+ import { InternalFormFieldValidationRule } from './internal-form-field-validation-rule.abstract';
4
+ import { SelectSourceItem, SelectType, SelectValueType } from '../../../components/vega-input-select/types';
5
+ /**
6
+ * A rule that checks if the value exists in the source or not
7
+ *
8
+ * @augments {InternalFormFieldValidationRule<SelectValueType<SelectType>>}
9
+ */
10
+ export declare class InputSelectValueInSourceRule extends InternalFormFieldValidationRule<SelectValueType<SelectType>> {
11
+ private readonly inputSelectSourceGetter;
12
+ /**
13
+ * It creates a new instance of the class with the given config.
14
+ *
15
+ * @param {() => SelectSourceItem[]} inputSelectSourceGetter - The input select source getter function
16
+ */
17
+ constructor(inputSelectSourceGetter: () => SelectSourceItem[]);
18
+ /**
19
+ * If the input is accepted and the status is not disabled and visible, then return true
20
+ *
21
+ * @param {unknown} input - The input to be evaluated.
22
+ * @param {FormFieldStatusMeta} [status] - FormFieldStatusMeta
23
+ * @returns {boolean} A boolean value.
24
+ */
25
+ canEvaluate(input: unknown, status?: FormFieldStatusMeta): boolean;
26
+ /**
27
+ * check if the value exists in the source
28
+ *
29
+ * @param {SelectValueType<SelectType>} input - The input to be evaluated.
30
+ * @returns {EvaluateResultTranslation} - The result of the evaluation.
31
+ */
32
+ evaluate(input: SelectValueType<SelectType>): EvaluateResultTranslation;
33
+ /**
34
+ * If the field is not disabled, visible, and has been touched or modified, then show the error
35
+ *
36
+ * @param {FormFieldStatusMeta} status - FormFieldStatusMeta
37
+ * @returns {boolean} A boolean value.
38
+ */
39
+ shouldShowError(status: FormFieldStatusMeta): boolean;
40
+ /**
41
+ * It returns true if the input is a string or an array of two strings, and each string is a valid string
42
+ *
43
+ * @param {unknown} input - The input value to be validated.
44
+ * @returns {boolean} A boolean value.
45
+ */
46
+ private isAcceptedInputType;
47
+ /**
48
+ * Generate an invalid result
49
+ *
50
+ * @param {string} message Error message
51
+ * @returns {EvaluateResultTranslation} invalid validation result
52
+ */
53
+ private invalidResult;
54
+ /**
55
+ * Generate a valid result
56
+ *
57
+ * @returns {EvaluateResultTranslation} invalid validation result
58
+ */
59
+ private validResult;
60
+ }
@@ -1 +1 @@
1
- export{g as getCurrentBreakpoint}from"./p-7d9cd9c8.js";export{L as LogUtility,s as setVegaLogLevel}from"./p-6e1ab235.js";export{d as formatAndValidBackgroundColor,e as formatAndValidBorderColor,g as formatAndValidBorderRadius,c as formatAndValidBreakpointSize,a as formatAndValidGap,h as formatAndValidPadding,f as formatAndValidResponsiveToken,b as formatAndValidShadow,i as formatAndValidTextColor}from"./p-7747c163.js";export{c as camelToDashCase}from"./p-02841589.js";export{d as BackgroundColorMap,a as BackgroundColors,e as BorderColorMap,b as BorderColors,B as BorderRadius,C as Colors,F as FillBackgroundColors,g as ShadowMap,f as Shadows,h as Spacing,S as StrokeBackgroundColors,c as TextColorMap,T as TextColors}from"./p-b1faebe0.js";export{B as Breakpoints}from"./p-ed45b3b6.js";export{I as Icons,g as getIconFromToken}from"./p-16493e5b.js";export{b as Typography,a as TypographyKeys,T as TypographyUrls}from"./p-d884c644.js";export{e as BoxDisplay,B as BreakpointKeys,C as CssStates,F as FlexDirections}from"./p-74168615.js";export{F as FrameworkEnum,v as VegaEnvManager}from"./p-5f377954.js";export{A as ActionHandlerInterceptor,I as InsertNodeToNearestRootAction,l as RTETokenNode,m as RTETokenNodeRenderer,R as RTETokenToolbarButtonRenderer,c as VegaDialog,d as VegaEventManager,V as VegaLoader,a as VegaNotify,j as VegaRTEExtension,k as VegaRTEExtensionRenderer,h as VegaRTEFunctionExtension,g as VegaRTETokenExtension,i as VegaRTEToolbarButtonRenderer,f as VegaSkeletonLoader,b as VegaThemeManager,e as VegaZIndexManager}from"./p-018d70a5.js";export{F as FeatureFlag}from"./p-e77a83e4.js";export{B as VegaJQueryDelegatedEventStrategy}from"./p-bccee21e.js";export{V as VegaIconManager}from"./p-8c9ea6f4.js";export{V as ValidCreditCardNumberRule}from"./p-9ce249a9.js";export{w as waitForVega}from"./p-8350506e.js";export{a as VegaTranslation,s as VegaTranslationResourceEN}from"./p-39482a1a.js";export{B as BlockToRTEBlockStrategyAbstract,b as ElementToDTOStrategy,I as InsertNewParagraphAction,d as RTEImageBlock,f as RTEImageNode,e as RTEListBlock,c as RTEListItemBlock,U as UpdateCursorPositionAction,V as VegaRTEContent,h as htmlElementToAnnotationGenerator}from"./p-d4893487.js";export{s as setVegaNonce}from"./p-54ae02db.js";export{d as ActionHandleStrategy,h as AppendChildrenAction,Q as CodeLanguage,w as CustomAttributeAnnotation,v as CustomClassAnnotation,C as CustomStyleAnnotation,I as InsertChildrenAfterAction,j as InsertChildrenBeforeAction,M as ModifyContentAction,c as ModifyContentActionType,g as RTEAnnotationStyle,f as RTEBlock,z as RTEDecoratorNode,i as RTENode,e as RTETextBlock,b as RTETextNode,r as RemoveChildrenAction,V as VegaRTEPresetToolbarItems}from"./p-8506e8c3.js";export{R as RTELanguageToolbarButtonRenderer,V as VegaRTELanguageExtension}from"./p-0849f85e.js";export{R as RTERange}from"./p-bb37a401.js";export{G as GridColumns,a as GridRows}from"./p-85407fb9.js";export{C as CheckBoxRequiredRule}from"./p-590fd123.js";export{D as DateRequiredRule}from"./p-8fae8f9e.js";export{I as InputPhoneNumberRequiredRule}from"./p-07c2725a.js";export{I as InputRangeRequiredRule}from"./p-f396c69a.js";export{R as RequiredFieldRule}from"./p-280cbcdb.js";export{R as RichTextEditorRequiredRule}from"./p-79e6e12c.js";export{T as TimeRangeRequiredRule,a as TimeRequiredRule}from"./p-924b4e24.js";export{T as ToggleSwitchRequiredRule}from"./p-7c0b4c36.js";export{F as FileUploaderRequiredRule}from"./p-0bb860cc.js";import"./p-b75ee3ba.js";import"./p-824a06ba.js";import"./p-a4670e23.js";import"./p-6a334573.js";import"./p-d9671d27.js";import"./p-4c192985.js";import"./p-a528714c.js";import"./p-2d0d575f.js";import"./p-331a62d5.js";import"./p-112455b1.js";import"./p-262ec334.js";import"./p-a7b5f497.js";import"./p-447c7590.js";import"./p-db8cdba6.js";import"./p-abd7aeaa.js";import"./p-5d676a94.js";import"./p-308aa2e3.js";import"./p-bf19682d.js";import"./p-0c667d6a.js";import"./p-d27ae9ff.js";import"./p-08835909.js";const o=["ring-input-focus","dark-ring-input-focus","ring-input-danger-focus","dark-ring-input-danger-focus","ring-action-focus","dark-ring-action-focus","ring-action-danger-focus","dark-ring-action-danger-focus"];export{o as Rings}
1
+ export{g as getCurrentBreakpoint}from"./p-7d9cd9c8.js";export{L as LogUtility,s as setVegaLogLevel}from"./p-6e1ab235.js";export{d as formatAndValidBackgroundColor,e as formatAndValidBorderColor,g as formatAndValidBorderRadius,c as formatAndValidBreakpointSize,a as formatAndValidGap,h as formatAndValidPadding,f as formatAndValidResponsiveToken,b as formatAndValidShadow,i as formatAndValidTextColor}from"./p-1372b984.js";export{c as camelToDashCase}from"./p-02841589.js";export{d as BackgroundColorMap,a as BackgroundColors,e as BorderColorMap,b as BorderColors,B as BorderRadius,C as Colors,F as FillBackgroundColors,g as ShadowMap,f as Shadows,h as Spacing,S as StrokeBackgroundColors,c as TextColorMap,T as TextColors}from"./p-b1faebe0.js";export{B as Breakpoints}from"./p-ed45b3b6.js";export{I as Icons,g as getIconFromToken}from"./p-16493e5b.js";export{b as Typography,a as TypographyKeys,T as TypographyUrls}from"./p-d884c644.js";export{e as BoxDisplay,B as BreakpointKeys,C as CssStates,F as FlexDirections}from"./p-74168615.js";export{F as FrameworkEnum,v as VegaEnvManager}from"./p-5f377954.js";export{A as ActionHandlerInterceptor,I as InsertNodeToNearestRootAction,l as RTETokenNode,m as RTETokenNodeRenderer,R as RTETokenToolbarButtonRenderer,c as VegaDialog,d as VegaEventManager,V as VegaLoader,a as VegaNotify,j as VegaRTEExtension,k as VegaRTEExtensionRenderer,h as VegaRTEFunctionExtension,g as VegaRTETokenExtension,i as VegaRTEToolbarButtonRenderer,f as VegaSkeletonLoader,b as VegaThemeManager,e as VegaZIndexManager}from"./p-b8b9ed2c.js";export{F as FeatureFlag}from"./p-e77a83e4.js";export{B as VegaJQueryDelegatedEventStrategy}from"./p-bccee21e.js";export{V as VegaIconManager}from"./p-8c9ea6f4.js";export{V as ValidCreditCardNumberRule}from"./p-9ce249a9.js";export{w as waitForVega}from"./p-8350506e.js";export{a as VegaTranslation,s as VegaTranslationResourceEN}from"./p-f69f84a7.js";export{B as BlockToRTEBlockStrategyAbstract,b as ElementToDTOStrategy,I as InsertNewParagraphAction,d as RTEImageBlock,f as RTEImageNode,e as RTEListBlock,c as RTEListItemBlock,U as UpdateCursorPositionAction,V as VegaRTEContent,h as htmlElementToAnnotationGenerator}from"./p-4e13a26f.js";export{s as setVegaNonce}from"./p-4866e390.js";export{d as ActionHandleStrategy,h as AppendChildrenAction,Q as CodeLanguage,w as CustomAttributeAnnotation,v as CustomClassAnnotation,C as CustomStyleAnnotation,I as InsertChildrenAfterAction,j as InsertChildrenBeforeAction,M as ModifyContentAction,c as ModifyContentActionType,g as RTEAnnotationStyle,f as RTEBlock,z as RTEDecoratorNode,i as RTENode,e as RTETextBlock,b as RTETextNode,r as RemoveChildrenAction,V as VegaRTEPresetToolbarItems}from"./p-0cdb38d3.js";export{R as RTELanguageToolbarButtonRenderer,V as VegaRTELanguageExtension}from"./p-2f09c6aa.js";export{R as RTERange}from"./p-b9798158.js";export{G as GridColumns,a as GridRows}from"./p-1bb0c934.js";export{C as CheckBoxRequiredRule}from"./p-590fd123.js";export{D as DateRequiredRule}from"./p-8fae8f9e.js";export{I as InputPhoneNumberRequiredRule}from"./p-07c2725a.js";export{I as InputRangeRequiredRule}from"./p-f396c69a.js";export{R as RequiredFieldRule}from"./p-280cbcdb.js";export{R as RichTextEditorRequiredRule}from"./p-4a467973.js";export{T as TimeRangeRequiredRule,a as TimeRequiredRule}from"./p-924b4e24.js";export{T as ToggleSwitchRequiredRule}from"./p-7c0b4c36.js";export{F as FileUploaderRequiredRule}from"./p-0bb860cc.js";import"./p-b75ee3ba.js";import"./p-824a06ba.js";import"./p-a4670e23.js";import"./p-6a334573.js";import"./p-d9671d27.js";import"./p-ef9cbad1.js";import"./p-a528714c.js";import"./p-2d0d575f.js";import"./p-331a62d5.js";import"./p-112455b1.js";import"./p-262ec334.js";import"./p-a7b5f497.js";import"./p-447c7590.js";import"./p-db8cdba6.js";import"./p-abd7aeaa.js";import"./p-5d676a94.js";import"./p-308aa2e3.js";import"./p-bf19682d.js";import"./p-0c667d6a.js";import"./p-d27ae9ff.js";import"./p-08835909.js";const o=["ring-input-focus","dark-ring-input-focus","ring-input-danger-focus","dark-ring-input-danger-focus","ring-action-focus","dark-ring-action-focus","ring-action-danger-focus","dark-ring-action-danger-focus"];export{o as Rings}
@@ -1 +1 @@
1
- import{C as t}from"./p-2d0d575f.js";import{d as e}from"./p-447c7590.js";import{b as n,c as s}from"./p-308aa2e3.js";import{c as r}from"./p-02841589.js";import{L as i}from"./p-6e1ab235.js";import{i as o}from"./p-b1faebe0.js";import{g as c}from"./p-a4670e23.js";import{V as a}from"./p-4c192985.js";import{c as l}from"./p-bf19682d.js";import{f as h}from"./p-d9671d27.js";var u,d;!function(t){t.SELECTION_RANGE="SELECTION_RANGE",t.CLEAR_FORMATTING="CLEAR_FORMATTING",t.LINK_GROUP="LINK_GROUP"}(u||(u={}));class p{}!function(t){t.ALIGNMENT="ALIGNMENT",t.TEXT_STYLE="TEXT_STYLE",t.INDENT="INDENT",t.LIST="LIST",t.INTERNAL_WRAPPER="INTERNAL_WRAPPER"}(d||(d={}));class f extends p{}const T=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.constructor.name}};var E,x,g,w;!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.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"}(E||(E={}));class m{constructor(){this.isFlushable=!1}}class A extends p{constructor(t){super(),this.type=u.LINK_GROUP,this.linkGroups=new Map,this.linkGroups=new Map([[t,[]]])}clone(){const t=new A("");return this.linkGroups.forEach(((e,n)=>{t.linkGroups.set(n,e.map((t=>t.clone(t.parent))))})),t}toString(t,e){const n=this.toJsx(t,e);return Object.entries(n).map((([t,e])=>{const n="string"==typeof e?e:this.formatStyleToString(e);return`${r(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&&(n.color="rgba(var(--v-text-link, 19, 98, 226, 1))"),n}getAttribute(t){const{href:e,customAttribute:n={}}=t.link,s=t.useInternalStyle,r=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])=>`${r(t)}: ${e};`)).join(" ")}}class N extends f{constructor(t){super(),this.type=d.ALIGNMENT,this.textAlign=t}static from(t){return[d.ALIGNMENT,new N(t)]}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 N(this.textAlign)}renderStyle(t){if(!(null==t?void 0:t.standalone))return null;switch(this.textAlign){case"right":case"center":case"justify":return{textAlign:this.textAlign};case"left":default:return{textAlign:"left"}}}}class y extends f{constructor(t){super(),this.type=d.INDENT,this.indent=Math.max(0,t)}static from(t){return[d.INDENT,new y(t)]}toJSON(){return this.indent>0?{indent:this.indent}:null}clone(){return new y(this.indent)}renderClass(){return null}renderStyle(){return this.indent>0?{marginLeft:16*this.indent+"px"}:null}}class R{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 m?t.type:t.constructor.name,s=this.registry.get(e.constructor.name);if(s){const r=s.get(n);if(r&&r.size>0)return Array.from(r).find((n=>n.canIntercept(t,e)))}}}R.registry=new Map;class O{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=R.get(t,e),s=()=>{const n=t instanceof m?t.type:t.constructor.name,s=O.get(n,e.constructor.name);if(s)return t.executedFlag=!0,s.execute(t,e);i.warn(`Type ${n} action handle strategy is not registered in class ${e.constructor.name}`)};return n?n.intercept(s,t,e):s()}static canHandle(t,e){return!!O.get(t,e.constructor.name)}}O.registry=new Map,function(t){t.CUSTOM_ATTRIBUTE="CUSTOM_ATTRIBUTE",t.CUSTOM_CLASS="CUSTOM_CLASS",t.CUSTOM_STYLE="CUSTOM_STYLE"}(x||(x={}));class S extends p{}class C extends S{constructor(t){super(),this.type=x.CUSTOM_ATTRIBUTE,this.BOOLEAN_ATTRS=new Set(["controls","disabled","checked","readonly","multiple","required","autoplay","muted"]),this.customAttribute=t}static from(t){return[x.CUSTOM_ATTRIBUTE,new C(t)]}toJSON(){return{customAttribute:this.customAttribute}}clone(){return new C(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(o)}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 k extends S{constructor(t){super(),this.type=x.CUSTOM_CLASS,this.customClass=t}static from(t){return[x.CUSTOM_CLASS,new k(t)]}toJSON(){return{customClass:this.customClass}}clone(){return new k(this.customClass)}toString(){return`class="${this.customClass.join(" ")}"`}renderClass(){return this.customClass}}class B extends S{constructor(t){super(),this.type=x.CUSTOM_STYLE,this.customStyle=t}static from(t){return[x.CUSTOM_STYLE,new B(t)]}toJSON(){return{customStyle:this.customStyle}}clone(){return new B(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="${Object.entries(this.customStyle).map((([t,e])=>`${t}: ${e};`)).join(" ")}"`}}class v extends f{constructor(t){super(),this.type=d.INTERNAL_WRAPPER,this.internalWrapper=t}static from(t){return[d.INTERNAL_WRAPPER,new v(t)]}clone(){return new v(this.internalWrapper)}renderClass(){}renderStyle(){}toJSON(){return this.internalWrapper?{internalWrapper:this.internalWrapper}:void 0}}!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"}(g||(g={}));class b extends p{}class _{constructor(t){this.dtoType=t instanceof RTEBlock?"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])=>`${r(t)}: ${e};`)).join("")}toJSON(t={standalone:!1},e){const n=Array.from(this.annotationMap.values()).filter((t=>this.filterAnnotation(t)||t instanceof B)).map((e=>e.renderStyle(t))).filter(o);return e&&e.length>0?this.mergeAnnotationStyles(n,e):n.reduce(((t,e)=>Object.assign(Object.assign({},t),e)),{})}filterAnnotation(t){return"block"===this.dtoType?t instanceof f:t instanceof b}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}}!function(t){t.TEXT="TEXT",t.IMAGE="IMAGE",t.CODE_BLOCK_NODE="CODE_BLOCK_NODE"}(w||(w={}));class RTENode{constructor(t,e){this.annotationMap=new Map,this.id=t,e&&(this.annotationMap=e)}static from(t,e,n){throw new Error(`[Vega] ${this.constructor.name}.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 C.from(e);case"customClass":return k.from(e);case"customStyle":return B.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 _(this).toJSON(t,["textDecoration"])}getClasses(t={standalone:!1}){return Array.from(this.annotationMap.values()).filter((t=>t instanceof b||t instanceof k)).map((e=>e.renderClass(t))).filter(o).reduce(((t,e)=>[t,e].join(" ").trim()),"")}getCustomAttributesAnnotation(){return this.annotationMap.get(x.CUSTOM_ATTRIBUTE)}isTextNode(){return!1}getElementRef(){return T.getDOMByEntity(this)}generateAttributeString(...t){var e;const n=new _(this).toCssText({standalone:!0},["textDecoration"]),s=this.annotationMap.get(x.CUSTOM_CLASS),r=[...(null===(e=this.getCustomAttributesAnnotation())||void 0===e?void 0:e.toString(t))||[],null==s?void 0:s.toString(),n?`style="${n}"`:null,...t].filter(o);return r.length?` ${r.join(" ")}`:""}doApply(t){t instanceof m?this.doModifyActionApply(t):this.doAnnotationActionApply(t)}flushChange(){const s=T.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){}}const L=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 RTEBlock)this.RTE_BLOCK_DTO_CLASS_MAP.set(t,e);else{if(!(e.prototype instanceof RTENode))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 RTEBlock{constructor(t){this.annotationMap=new Map,this.id=t}static from(t,e){throw new Error(`[Vega] ${this.constructor.name}.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=L.getRTEBlockClass(t.type);if(s){const r=s.from(t,e);return r.parent=n,r}})).filter(o)}static createAnnotationEntity(t,e){switch(t){case"textAlign":return N.from(e);case"indent":return y.from(e);case"customAttribute":return C.from(e);case"customClass":return k.from(e);case"customStyle":return B.from(e);case"internalWrapper":return v.from(e)}}static convertAnnotationsToMap(t,e){Object.entries(e).forEach((([e,n])=>{const s=this.createAnnotationEntity(e,n);o(s)&&t.set(...s)}))}shouldRenderAsInternalWrapper(){const t=this.getAnnotationByType(d.INTERNAL_WRAPPER);return!!t&&t.internalWrapper&&0===Array.from(this.annotationMap.values()).filter((t=>!(t instanceof A||t instanceof v))).length}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof f||t instanceof S)).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=T.getDOMByEntity(this);if(s){const r=e.getSubjectFromParentNodeByEventId(s,n);r&&t.notify(r,{})}}}isListItemBlock(){return"list-item"===this.type}getStyles(t={standalone:!1}){const e=new _(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 f||t instanceof k)).map((e=>e.renderClass(t))).filter(o).reduce(((t,e)=>[t,e].join(" ").trim()),"")}getCustomAttributesAnnotation(){return this.annotationMap.get(x.CUSTOM_ATTRIBUTE)}generateAttributeString(...t){var e;const n=new _(this).toCssText({standalone:!0}),s=this.annotationMap.get(x.CUSTOM_CLASS),r=[...(null===(e=this.getCustomAttributesAnnotation())||void 0===e?void 0:e.toString(t))||[],null==s?void 0:s.toString(),n?`style="${n}"`:null,...t].filter(o);return r.length?` ${r.join(" ")}`:""}doApply(t){t instanceof m?O.executeTheStrategy(t,this):this.applyAnnotationAction(t)}applyAnnotationAction(t){const e=t.toAnnotation();e instanceof A||this.annotationMap.set(e.type,e),"function"==typeof this.doAnnotationActionApply&&this.doAnnotationActionApply(t)}cloneAnnotations(){return new Map(Array.from(this.annotationMap.entries()).map((([t,e])=>[t,e.clone()])))}}class I{}class D extends I{constructor(){super(...arguments),this.doSplit=!0}}class $ extends p{constructor(t){super(),this.type=u.SELECTION_RANGE,this.range=t}clone(){return new $(this.range)}}class M extends b{constructor(t){super(),this.type=g.STRIKETHROUGH,this.strikethrough=t}static from(t){return[g.STRIKETHROUGH,new M(t)]}toJSON(){return{strikethrough:this.strikethrough}}clone(){return new M(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 j extends b{constructor(t){super(),this.type=g.UNDERLINE,this.underline=t}static from(t){return[g.UNDERLINE,new j(t)]}toJSON(){return{underline:this.underline}}clone(){return new j(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 P extends b{constructor(t){super(),this.type=g.ITALIC,this.italic=t}static from(t){return[g.ITALIC,new P(t)]}toJSON(){return{italic:this.italic}}clone(){return new P(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 F extends b{constructor(t){super(),this.type=g.BOLD,this.bold=t}static from(t){return[g.BOLD,new F(t)]}toJSON(){return{bold:this.bold}}clone(){return new F(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 H extends b{constructor(t,e=!0){super(),this.type=g.CODE,this.code=t,this.useInternalStyle=e}static from(t,e){return[g.CODE,new H(t,e)]}toJSON(){return{code:this.code}}clone(){return new H(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?{fontFamily:"Roboto Mono",whiteSpace:"pre-wrap"}:null}}const W={key:"black",light:"#111128",dark:"#E3E3E8"},J=[W,{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"}],K="​",U=[["textStyles"],["bold","italic","underline","strikethrough","code"],["textColor"],["horizontalAlignment","bulletsNumbers"],["moreIndent","lessIndent"],["link"],["image"],["clearStyle"]];class G extends b{constructor(t){super(),this.type=g.TEXT_COLOR,this.textColor=this.formatTextColor(t)}static from(t){return[g.TEXT_COLOR,new G(t)]}toJSON(){return{textColor:this.textColor.key}}clone(){return new G(this.textColor.key)}renderClass(){return null}renderStyle(){return{color:a.isDarkMode()?this.textColor.dark:this.textColor.light}}formatTextColor(t){return J.find((e=>e.key===t))||J[0]}}class z extends b{constructor(t,e=!0){super(),this.type=g.LINK,this.link=t,this.useInternalStyle=e}static from(t,e=!0){return[g.LINK,new z(t,e)]}toJSON(){return{link:this.link}}clone(){return new z(this.link,this.useInternalStyle)}toEqual(t){return this.link.groupKey===t.link.groupKey}renderClass(){return null}renderStyle(){return null}}class V extends I{constructor(t,e,n){super(),this.isFlushable=!1,this.groupKey=t,this.nodes=e,this.type=n}toAnnotation(){return new A(this.groupKey)}}class X extends I{constructor(){super(),this.isFlushable=!1}toAnnotation(){return null}}class q{execute(t,e){return i.log(`Executing action ${t.constructor.name} on ${e.constructor.name} ${e.id}`),this.handleAction(t,e)}updateCustomStyleAnnotation(t,e){const n=t.annotationMap.get(x.CUSTOM_STYLE);n&&this.isCustomStyle(n,e)&&t.annotationMap.set(n.type,new B(n.removeStyles(e)))}createNewParagraph(t){const e=L.getRTEBlockClass("paragraph");if(e)return e.from({id:c(),type:"paragraph",nodes:[{id:c(),type:"text",text:t}]})}getRootContent(t){const e=t.parent;if(e)return"VegaRTEContent"===e.constructor.name?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)}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 Y extends m{constructor(t){super(),this.type=E.LINK_GROUP_NODE_SPLIT,this.splittedTextNodes=t}}class Q extends q{constructor(){super(...arguments),this.applyTargetNode=null}handleAction(t,e){const n=e.getAnnotationByType(u.SELECTION_RANGE);if(this.setApplyTargetNode(null),t instanceof D&&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 Y(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&&T.getEntityByDOM(i),l=o&&T.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 Z extends D{constructor(t){super(),this.isFlushable=!0,this.bold=t}toAnnotation(){return new F(this.bold)}}class tt extends p{constructor(){super(...arguments),this.type=u.CLEAR_FORMATTING,this.items=[g.BOLD,g.ITALIC,g.UNDERLINE,g.STRIKETHROUGH,g.TEXT_COLOR,g.CODE,x.CUSTOM_STYLE]}}class et extends D{constructor(){super(...arguments),this.isFlushable=!0}toAnnotation(){return new tt}}class nt extends D{constructor(t){super(),this.isFlushable=!0,this.code=t}toAnnotation(){return new H(this.code)}}class st extends I{constructor(t){super(),this.isFlushable=!0,this.annotationType=t}toAnnotation(){}}class rt extends D{constructor(t){super(),this.isFlushable=!0,this.italic=t}toAnnotation(){return new P(this.italic)}}class it extends D{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,o(s)&&(this.doSplit=s)}toAnnotation(){return new z(this.link)}}class ot extends D{constructor(t){super(),this.isFlushable=!0,this.strikethrough=t}toAnnotation(){return new M(this.strikethrough)}}class ct extends D{constructor(t){super(),this.isFlushable=!0,this.underline=t}toAnnotation(){return new j(this.underline)}}class at extends q{handleAction(t,e){const n=t.toAnnotation();if(t instanceof st)e.annotationMap.delete(t.annotationType);else{if(!(n instanceof tt))return n instanceof b||n instanceof $?(t instanceof it&&(o(t.newText)&&(e.text=t.newText),e.parent.apply(new V(t.link.groupKey,[e],t.type))),t instanceof nt&&this.handleAction(new et,e),t instanceof Z&&this.updateCustomStyleAnnotation(e,["fontWeight"]),t instanceof rt&&this.updateCustomStyleAnnotation(e,["fontStyle"]),(t instanceof ct||t instanceof ot)&&this.updateCustomStyleAnnotation(e,["textDecoration"]),void e.annotationMap.set(n.type,n)):void 0;n.items.forEach((t=>{e.deleteAnnotationByType(t)}))}}}class lt extends m{constructor(){super(...arguments),this.type=E.DELETE_LINK_GROUP}}class ht extends q{handleAction(t,e){e.text=t.newTextContent,!e.text&&e.annotationMap.has("LINK")&&e.apply(new lt)}}class ut extends m{constructor(t){super(),this.type=E.UPDATE_TEXT,this.newTextContent="",this.newTextContent=t}}class dt extends q{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&&T.getEntityByDOM(e),h=a&&T.getEntityByDOM(a);let u=0,d=n.text.length;l&&l===n?(u=i,d=s===r?o:d):h&&h===n&&(d=o),c=n.text.slice(0,u)+t+n.text.slice(d)}n.apply(new ut(c))}}}class pt extends p{constructor(t){super(),this.type=g.INLINE_HTML,this.htmlTag=t}static from(t){const{htmlTag:e,child:n,customStyle:s,customClass:r,customAttribute:i}=t,o=new pt(e);return o.child=n?pt.from(n)[1]:void 0,o.customAttribute=i?C.from(i)[1]:void 0,o.customClass=r?k.from(r)[1]:void 0,o.customStyle=s?B.from(s)[1]:void 0,[g.INLINE_HTML,o]}clone(){var t,e,n,s;const r=new pt(this.htmlTag);return 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}toJSON(){var t,e,n,s;return{inlineHtml:l({htmlTag:this.htmlTag,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 ft extends q{handleAction(t,e){const n=e.parent.getAnnotationByType(u.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 Tt extends q{handleAction(t,e){const n=e.parent.getAnnotationByType(u.LINK_GROUP);if(n){const t=e.annotationMap.get(g.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(u.LINK_GROUP)}}e.annotationMap.delete(g.LINK)}}class Et extends b{constructor(t){super(),this.type=g.PLAIN_TEXT,this.plainText=!0,this.plainText=t}static from(t){return[g.PLAIN_TEXT,new Et(t)]}clone(){return new Et(this.plainText)}renderClass(){}renderStyle(){}toJSON(){return{plainText:this.plainText}}}class xt extends D{constructor(t){super(),this.isFlushable=!0,this.textColor=t}toAnnotation(){return new G(this.textColor)}}class RTETextNode extends RTENode{constructor(t,e,n,s){super(t,s),this.type=w.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 RTETextNode(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 V(t.link.groupKey,[s],"link")),this.createAnnotationEntity(r,t[r],e)))).filter(o))}static createAnnotationEntity(t,e,n){const s=!(!n||!n.autoMatchFormat);switch(t){case"bold":return F.from(e);case"italic":return P.from(e);case"underline":return j.from(e);case"strikethrough":return M.from(e);case"code":return H.from(e,s);case"textColor":return G.from(e);case"link":return z.from(e,s);case"inlineHtml":return pt.from(e);case"plainText":return Et.from(e)}return RTENode.createAnnotationEntity(t,e)}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof b||t instanceof S||t instanceof pt)).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(){const t=this.getAnnotationByType(g.INLINE_HTML);return t?this.renderWithWrapperStr(t):this.renderTextStr()}cloneWithText(t){return new RTETextNode(c(),t,this.parent,super.cloneAnnotations())}clone(t){return new RTETextNode(this.id,this.text,t,super.cloneAnnotations())}isEmpty(){return!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}registerModifyStrategy(){const t=this.constructor.name;RTETextNode.registerActionStrategyStatus[t]||(this.isContentEditable()&&(O.register(E.UPDATE_TEXT,t,new ht),O.register(E.REPLACE_SELECTED_TEXT,t,new dt),O.register(E.LINK_GROUP_NODE_SPLIT,t,new ft),O.register(it.name,t,new at)),O.register(D.name,t,new Q),O.register(E.DELETE_LINK_GROUP,t,new Tt),O.register(Z.name,t,new at),O.register(et.name,t,new at),O.register(rt.name,t,new at),O.register(ct.name,t,new at),O.register(xt.name,t,new at),O.register(ot.name,t,new at),O.register(nt.name,t,new at),O.register(I.name,t,new at),RTETextNode.registerActionStrategyStatus[t]=!0)}doAnnotationActionApply(t){const e=this.getAnnotationByType(u.SELECTION_RANGE);if(t instanceof D&&t.doSplit&&e){const e=O.get(D.name,this.constructor.name);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){O.executeTheStrategy(t,this)}applyActionToNode(t,e){const n=e.toAnnotation();if(e instanceof X)return void this.syncUpSelectedNodes(t);n instanceof $||this.syncUpSelectedNodes(t);const s=O.get(e.constructor.name,t.constructor.name);if(s)return void s.execute(e,t);const r=O.get(I.name,RTETextNode.name);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){const{htmlTag:e,customAttribute:n,customClass:s,customStyle:r,child:i}=t,c=[...(null==n?void 0:n.toString())||[],null==s?void 0:s.toString(),null==r?void 0:r.toString()].filter(o),a=c.length>0?` ${c.join(" ")}`:"";return i?`<${e}${a}>${this.renderWithWrapperStr(i)}</${e}>`:`<${e}${a}>${this.renderTextStr()}</${e}>`}renderTextStr(){var t;const e=(null===(t=this.getAnnotationByType(g.CODE))||void 0===t?void 0:t.code)?"code":"span",n=super.generateAttributeString();return"\n"===this.text?"<br>":this.shouldRenderAsPlainText()?this.text:`<${e}${n}>${this.text}</${e}>`}shouldRenderAsPlainText(){const t=super.getAnnotationByType(g.PLAIN_TEXT);return!!t&&t.plainText&&0===Array.from(this.annotationMap.values()).filter((t=>t instanceof b&&!(t instanceof z)&&!(t instanceof Et)||t instanceof S)).length}}RTETextNode.registerActionStrategyStatus={},RTETextNode.htmlTag="span";class gt extends m{constructor(t){super(),this.type=E.APPEND_CHILDREN,this.entityToBeAppended=t}}class wt extends f{constructor(t){super(),this.type=d.TEXT_STYLE,this.textStyle=t}static from(t){return[d.TEXT_STYLE,new wt(t)]}toJSON(){return{textStyle:this.textStyle}}clone(){return new wt(this.textStyle)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.textStyle?`v-rte--text-style-${this.textStyle}`:null}renderStyle(t){if(!(null==t?void 0:t.standalone))return null;const e={fontFamily:"Inter",fontSize:"16px",lineHeight:"22px",fontWeight:"500",marginTop:"0px",marginBottom:"0px"};switch(this.textStyle){case"paragraph":return e;case"title":return{fontFamily:"Inter",fontSize:"36px",lineHeight:"40px",fontWeight:"500"};case"subtitle":return{fontFamily:"Inter",fontSize:"28px",lineHeight:"32px",fontWeight:"500"};case"heading-1":return{fontFamily:"Inter",fontSize:"22px",lineHeight:"24px",fontWeight:"500",marginTop:"0px",marginBottom:"0px"};case"heading-2":return{fontFamily:"Inter",fontSize:"20px",lineHeight:"24px",fontWeight:"500",marginTop:"0px",marginBottom:"0px"};case"heading-3":return{fontFamily:"Inter",fontSize:"18px",lineHeight:"22px",fontWeight:"500",marginTop:"0px",marginBottom:"0px"};case"heading-4":return{fontFamily:"Inter",fontSize:"16px",lineHeight:"22px",fontWeight:"500",marginTop:"0px",marginBottom:"0px"};case"heading-5":return{fontFamily:"Inter",fontSize:"14px",lineHeight:"22px",fontWeight:"500",marginTop:"0px",marginBottom:"0px"};case"heading-6":return{fontFamily:"Inter",fontSize:"12px",lineHeight:"22px",fontWeight:"500",marginTop:"0px",marginBottom:"0px"}}}}class mt extends I{constructor(t,e){super(),this.isFlushable=!0,this.textStyle=t,this.bold=e}toAnnotation(){return new wt(this.textStyle)}}class At extends q{handleAction(t,e){"list-item"!==e.type&&(e.type=t.textStyle),e.children.forEach(t.bold?t=>{const e=new Z(!0);e.doSplit=!1,t.apply(e)}:t=>{t.apply(new st(g.BOLD))}),this.updateCustomStyleAnnotation(e,["fontFamily","lineHeight","fontWeight","fontSize"])}}class Nt extends m{constructor(t,...e){super(),this.type=E.INSERT_CHILDREN_AFTER,this.referChildren=t,this.childrenToBeInserted=e}}class yt extends m{constructor(t){super(),this.type=E.REPLACE_CHILD_NODES,this.newChildNodes=t}}class Rt extends q{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 e=n.children.slice(0,i),o=n.children.slice(i+1);s&&e.push(t.cloneWithText(s)),r&&o.unshift(t.cloneWithText(r)),n.apply(new yt(e));const c=n.cloneWithNodes(o);return n.parent.apply(new Nt(n,c)),c}}}}class Ot extends q{handleAction(t,e){e.children=[],e.apply(new gt(t.newChildNodes))}}class St extends m{constructor(t){super(),this.type=E.DELETE_CHILDREN,this.entityToBeRemoved=t}}class Ct extends q{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 gt(t)),n.parent.apply(new St(n))}}}class kt extends q{handleAction(t,e){t.lineBreakNode=this.lineBreakSingleBlock(t.startContainerNode,t.startOffset,e)}lineBreakSingleBlock(t,e,n){if(t){const s=new RTETextNode(c(),"\n",n),r=t.text.slice(0,e),i=t.text.slice(e),o=n.children.indexOf(t);if(o>-1){const e=n.children.slice(0,o),c=n.children.slice(o+1);r&&e.push(t.cloneWithText(r)),i&&c.unshift(t.cloneWithText(i)),this.mergeLineBreakNodes(e,s,c,n)}return s}}mergeLineBreakNodes(t,e,n,s){(0===n.length||n[0]&&""===n[0].text)&&n.push(new RTETextNode(c(),"\n",s,t[t.length-1]&&t[t.length-1].annotationMap)),s.apply(new yt([...t,e,...n]))}}class Bt extends q{handleAction(t,e){t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks,e)}lineBreakMultipleBlocks(t,e){const n=e.children,s=new RTETextNode(c(),"\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 St(t)))})),e}mergeLineBreakNodes(t,e,n,s){(0===n.length||n[0]&&""===n[0].text)&&n.push(new RTETextNode(c(),"\n",s,t[t.length-1]&&t[t.length-1].annotationMap)),s.apply(new yt([...t,e,...n]))}}class vt extends m{constructor(t,...e){super(),this.type=E.INSERT_CHILDREN_BEFORE,this.referChildren=t,this.childrenToBeInserted=e}}class bt extends m{constructor(t,e){super(),this.type=E.SPLIT_BLOCK_WITH_NODE,this.splitPointNode=t,this.startOffsetOfNode=e}}class _t extends I{constructor(t){super(),this.isFlushable=!0,this.textAlign=t}toAnnotation(){return new N(this.textAlign)}}class Lt extends q{handleAction(t,e){this.updateCustomStyleAnnotation(e,["textAlign"])}}class It extends I{constructor(t){super(),this.isFlushable=!0,this.indent=t}toAnnotation(){return new y(this.indent)}}class RTETextBlock extends RTEBlock{constructor(t,e,n){super(t),this.children=[],this.type=e;const{autoMatchFormat:s}=n||{autoMatchFormat:!0};s&&(this.annotationMap=RTETextBlock.isAcceptableTextStyle(e)?new Map([wt.from(e)]):new Map([wt.from("paragraph")]))}static from(t,e={autoMatchFormat:!0}){var n,s;const r=new RTETextBlock(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=t.nodes.map((t=>{const n=L.getRTENodeClass(t.type);if(n)return n.from(t,r,e)})).filter(o),i&&super.convertAnnotationsToMap(r.annotationMap,i),r}static createAnnotationEntity(t,e){return"textStyle"===t?wt.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 it&&t.needMergeNode){const t=null==s?void 0:s.getAnnotationByType(g.LINK),r=n.getAnnotationByType(g.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(){const t=this.getBlockTag(),e=super.generateAttributeString(),n=this.getChildrenHtml();return super.shouldRenderAsInternalWrapper()?n:[`<${t}${e}>`,n,`</${t}>`].join("")}cloneWithNodes(t){const e=new RTETextBlock(c(),this.type);return e.annotationMap=super.cloneAnnotations(),e.apply(new gt(t)),e}clone(t){const e=new RTETextBlock(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(){const t=this.getAnnotationByType(u.LINK_GROUP);let e=this.children.map((t=>t.toHtml())).join("");return t&&this.children.length>0&&(e=this.generateLinkHtml(t,e)),e}doAnnotationActionApply(t){const e=O.get(t.constructor.name,RTETextBlock.name);e&&e.execute(t,this)}generateLinkHtml(t,e){e="";let n=[];for(let s=0;s<this.children.length;s++){const r=this.children[s].getAnnotationByType(g.LINK),i=this.children[s+1]?this.children[s+1].getAnnotationByType(g.LINK):null;if(r){if(n.push(this.children[s]),!i||r.link.groupKey!==i.link.groupKey){const s=t.toString(r,{standalone:!0});e+=[`<a${s?` ${s}`:""}>`,n.map((t=>t.toHtml())).join(""),"</a>"].join(""),n=[]}}else e+=this.children[s].toHtml()}return e}}O.register(mt.name,RTETextBlock.name,new At),O.register(_t.name,RTETextBlock.name,new Lt),O.register(It.name,RTETextBlock.name,new class extends q{handleAction(t,e){this.updateCustomStyleAnnotation(e,["marginLeft"])}}),O.register(V.name,RTETextBlock.name,new class extends q{handleAction(t,e){let n=e.getAnnotationByType(u.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(u.LINK_GROUP,n)}}}),O.register(E.UNLINK_LINK_GROUP,RTETextBlock.name,new class extends q{handleAction(t,e){const n=e.getAnnotationByType(u.LINK_GROUP);n&&(n.linkGroups.size>1?n.linkGroups.delete(t.groupKey):e.annotationMap.delete(u.LINK_GROUP))}}),O.register(E.SPLIT_BLOCK_WITH_NODE,RTETextBlock.name,new Rt),O.register(E.REPLACE_CHILD_NODES,RTETextBlock.name,new Ot),O.register(E.MERGE_TWO_BLOCKS_NODES,RTETextBlock.name,new Ct),O.register(E.LINE_BREAK_SINGLE_BLOCK,RTETextBlock.name,new kt),O.register(E.LINE_BREAK_MULTIPLE_BLOCKS,RTETextBlock.name,new Bt),O.register(E.INSERT_IMAGE_TO_BLOCK,RTETextBlock.name,new class extends q{handleAction(t,e){const n=t.splitPointNode,s=t.startOffsetOfNode,r=t.imageBlockToBeInserted;if(this.isCaretPositionAtBlockEnd(e,n,s))e.parent.apply(new Nt(e,r));else if(this.isCaretPositionAtBlockStart(e,n,s))e.parent.apply(new vt(e,r));else{const t=new bt(n,s);e.apply(t),e.parent.apply(new Nt(e,r))}}}),O.register(E.TRANSFORM_LIST_BLOCK,RTETextBlock.name,new class extends q{handleAction(t,e){const n=e.parent,s=n.createList(t.listType),r=t.selectedBlocks,i=r.map((t=>n.toListItem(t)));s.apply(new gt(i)),n.apply(new Nt(t.selectedBlocks[0],s)),r.forEach((t=>{t.parent.apply(new St(t))}))}});class Dt extends q{getPreviousNode(t){const e=t.parent,n=e.children.indexOf(t);if(n>0)return e.children[n-1];if(e.parent){const t=this.getPreviousBlock(e);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){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.constructor.name}}class $t extends m{constructor(t,e){super(),this.isFlushable=!0,this.type=E.UPDATE_CODE_BLOCK,this.content=t,this.language=e}}class Mt extends I{constructor(t){super(),this.isFlushable=!1,this.range=t}toAnnotation(){return new $(this.range)}}class RTEDecoratorNode extends RTENode{constructor(){super(...arguments),this.type="decorator-node",this.isSelected=!1}static isDecoratorNodeContainerElement(t){return t&&t.classList.contains(RTEDecoratorNode.DECORATOR_CONTAINER_CLASS)}static getDecoratorNodeElement(t){return t.querySelector(`.${RTEDecoratorNode.DECORATOR_NODE_CLASS}`)}getRangeEndOffset(){return 1}getRangeContainer(){const t=this.getElementRef();if(t)return h(t,`.${RTEDecoratorNode.DECORATOR_CONTAINER_CLASS}`)}isContentEditable(){return!1}}RTEDecoratorNode.DECORATOR_CONTAINER_CLASS="v-internal-decorator-container",RTEDecoratorNode.DECORATOR_NODE_CLASS="v-internal-decorator-node";class RTECodeBlockNode extends RTEDecoratorNode{constructor(t,e,n,s){super(t),this.type=w.CODE_BLOCK_NODE,this.text="",this.annotationMap=new Map,this.text=e,this.parent=s,this.language=n}toJSON(){return{id:this.id,type:"text",text:this.text,language:this.language}}toHtml(){return`<code style='box-sizing: border-box;color: rgba(var(--v-text-primary, 32, 54, 69, 1));text-align: left;font-family: "Roboto Mono";font-weight: 400;line-height: 22px;font-size: 16px;white-space: pre-wrap;min-height: 22px;tab-size: 2px;'>${this.text}</code>`}clone(t){return new RTECodeBlockNode(this.id,this.text,this.language,t)}doAnnotationActionApply(t){O.executeTheStrategy(t,this)}doModifyActionApply(t){O.executeTheStrategy(t,this)}}O.register(E.UPDATE_CODE_BLOCK,RTECodeBlockNode.name,new class extends q{handleAction(t,e){const{content:n,language:s}=t;e.language=s,e.text=n}}),O.register(Mt.name,RTECodeBlockNode.name,new class extends q{handleAction(t,e){e.annotationMap.set(u.SELECTION_RANGE,t.toAnnotation())}});var jt;!function(t){t.CSS="css",t.HTML="html",t.JavaScript="js",t.JSX="jsx",t["Plain Text"]="plainText",t.TypeScript="ts",t.TSX="tsx"}(jt||(jt={}));class Pt extends q{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 St(e)))}}class RTECodeBlock extends RTEBlock{constructor(t,e,n){super(t),this.type="code-block",this.children=[new RTECodeBlockNode(`${t}-1`,e,n,this)]}static from(t){return new RTECodeBlock(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(){const{language:t=jt["Plain Text"]}=this.children[0];return`<pre data-language="${t}" style="background-color: rgba(var(--v-bg-secondary, 245, 247, 247, 1)); padding: 12px">${this.children.map((t=>t.toHtml()))}</pre>`}clone(t){const e=RTECodeBlock.from(this.toJSON());return e.parent=t,e}apply(s){if(s instanceof m&&O.executeTheStrategy(s,this),s.isFlushable){const s=T.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(u.SELECTION_RANGE)}}O.register(E.DELETE_CODE_BLOCK,RTECodeBlock.name,new class extends Dt{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 St(e));const i=t?T.getDOMByEntity(t):null;if(0===s.children.length){const n=RTETextBlock.from({id:c(),type:"paragraph",nodes:[{id:c(),type:"text",text:""}]});e.parent.apply(new gt([n])),t=n.children[0],r=0}this.notifyUpdateSelection(t,i,r,e)}}notifyUpdateSelection(n,r,i,o){const c=T.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}}),O.register(E.DELETE_CHILDREN,RTECodeBlock.name,new Pt),O.register(E.SWITCH_OUT_FROM_CODE_BLOCK,RTECodeBlock.name,new class extends q{handleAction(n,r){const{content:i,language:o}=n,a=i.split("\n"),l=new $t(a.slice(0,a.length-2).join("\n"),o);l.isFlushable=!1,r.children[0].apply(l);const h=RTETextBlock.from({id:c(),type:"paragraph",nodes:[{id:c(),text:"",type:"text"}]});r.parent.apply(new Nt(r,h));const u=T.getDOMByEntity(r);if(u){const n=e.getSubjectFromParentNodeByEventId(u,s);n&&t.notify(n,{node:h.children[0]})}}}),O.register(E.INSERT_IMAGE_TO_BLOCK,RTECodeBlock.name,new class extends q{handleAction(t,e){e.parent.apply(new Nt(e,t.imageBlockToBeInserted))}}),RTECodeBlock.CODE_BLOCK_PLACEHOLDER_CLASS_NAME="code-block-placeholder-element";export{xt as $,O as A,At as B,B as C,w as D,S as E,I as F,yt as G,_t as H,Nt as I,bt as J,Dt as K,Pt as L,m as M,b as N,J as O,W as P,jt as Q,L as R,X as S,mt as T,ut as U,U as V,it as W,x as X,$t as Y,K as Z,Mt as _,R as a,RTECodeBlockNode as a0,Z as a1,rt as a2,ct as a3,wt as a4,F as a5,et as a6,nt as a7,ot as a8,It as a9,RTETextNode as b,E as c,q as d,RTETextBlock as e,RTEBlock as f,_ as g,gt as h,RTENode as i,vt as j,u as k,Lt as l,kt as m,Bt as n,Rt as o,Ot as p,Ct as q,St as r,T as s,f as t,d as u,k as v,C as w,RTECodeBlock as x,g as y,RTEDecoratorNode as z}
1
+ import{C as t}from"./p-2d0d575f.js";import{d as e}from"./p-447c7590.js";import{b as n,c as s}from"./p-308aa2e3.js";import{c as r}from"./p-02841589.js";import{L as i}from"./p-6e1ab235.js";import{i as o}from"./p-b1faebe0.js";import{g as c}from"./p-a4670e23.js";import{V as a}from"./p-ef9cbad1.js";import{c as l}from"./p-bf19682d.js";import{f as h}from"./p-d9671d27.js";var u,d;!function(t){t.SELECTION_RANGE="SELECTION_RANGE",t.CLEAR_FORMATTING="CLEAR_FORMATTING",t.LINK_GROUP="LINK_GROUP"}(u||(u={}));class p{}!function(t){t.ALIGNMENT="ALIGNMENT",t.TEXT_STYLE="TEXT_STYLE",t.INDENT="INDENT",t.LIST="LIST",t.INTERNAL_WRAPPER="INTERNAL_WRAPPER"}(d||(d={}));class f extends p{}const T=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.constructor.name}};var E,x,g,w;!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.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"}(E||(E={}));class m{constructor(){this.isFlushable=!1}}class A extends p{constructor(t){super(),this.type=u.LINK_GROUP,this.linkGroups=new Map,this.linkGroups=new Map([[t,[]]])}clone(){const t=new A("");return this.linkGroups.forEach(((e,n)=>{t.linkGroups.set(n,e.map((t=>t.clone(t.parent))))})),t}toString(t,e){const n=this.toJsx(t,e);return Object.entries(n).map((([t,e])=>{const n="string"==typeof e?e:this.formatStyleToString(e);return`${r(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&&(n.color="rgba(var(--v-text-link, 19, 98, 226, 1))"),n}getAttribute(t){const{href:e,customAttribute:n={}}=t.link,s=t.useInternalStyle,r=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])=>`${r(t)}: ${e};`)).join(" ")}}class N extends f{constructor(t){super(),this.type=d.ALIGNMENT,this.textAlign=t}static from(t){return[d.ALIGNMENT,new N(t)]}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 N(this.textAlign)}renderStyle(t){if(!(null==t?void 0:t.standalone))return null;switch(this.textAlign){case"right":case"center":case"justify":return{textAlign:this.textAlign};case"left":default:return{textAlign:"left"}}}}class y extends f{constructor(t){super(),this.type=d.INDENT,this.indent=Math.max(0,t)}static from(t){return[d.INDENT,new y(t)]}toJSON(){return this.indent>0?{indent:this.indent}:null}clone(){return new y(this.indent)}renderClass(){return null}renderStyle(){return this.indent>0?{marginLeft:16*this.indent+"px"}:null}}class R{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 m?t.type:t.constructor.name,s=this.registry.get(e.constructor.name);if(s){const r=s.get(n);if(r&&r.size>0)return Array.from(r).find((n=>n.canIntercept(t,e)))}}}R.registry=new Map;class O{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=R.get(t,e),s=()=>{const n=t instanceof m?t.type:t.constructor.name,s=O.get(n,e.constructor.name);if(s)return t.executedFlag=!0,s.execute(t,e);i.warn(`Type ${n} action handle strategy is not registered in class ${e.constructor.name}`)};return n?n.intercept(s,t,e):s()}static canHandle(t,e){return!!O.get(t,e.constructor.name)}}O.registry=new Map,function(t){t.CUSTOM_ATTRIBUTE="CUSTOM_ATTRIBUTE",t.CUSTOM_CLASS="CUSTOM_CLASS",t.CUSTOM_STYLE="CUSTOM_STYLE"}(x||(x={}));class S extends p{}class C extends S{constructor(t){super(),this.type=x.CUSTOM_ATTRIBUTE,this.BOOLEAN_ATTRS=new Set(["controls","disabled","checked","readonly","multiple","required","autoplay","muted"]),this.customAttribute=t}static from(t){return[x.CUSTOM_ATTRIBUTE,new C(t)]}toJSON(){return{customAttribute:this.customAttribute}}clone(){return new C(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(o)}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 k extends S{constructor(t){super(),this.type=x.CUSTOM_CLASS,this.customClass=t}static from(t){return[x.CUSTOM_CLASS,new k(t)]}toJSON(){return{customClass:this.customClass}}clone(){return new k(this.customClass)}toString(){return`class="${this.customClass.join(" ")}"`}renderClass(){return this.customClass}}class B extends S{constructor(t){super(),this.type=x.CUSTOM_STYLE,this.customStyle=t}static from(t){return[x.CUSTOM_STYLE,new B(t)]}toJSON(){return{customStyle:this.customStyle}}clone(){return new B(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="${Object.entries(this.customStyle).map((([t,e])=>`${t}: ${e};`)).join(" ")}"`}}class v extends f{constructor(t){super(),this.type=d.INTERNAL_WRAPPER,this.internalWrapper=t}static from(t){return[d.INTERNAL_WRAPPER,new v(t)]}clone(){return new v(this.internalWrapper)}renderClass(){}renderStyle(){}toJSON(){return this.internalWrapper?{internalWrapper:this.internalWrapper}:void 0}}!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"}(g||(g={}));class b extends p{}class _{constructor(t){this.dtoType=t instanceof RTEBlock?"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])=>`${r(t)}: ${e};`)).join("")}toJSON(t={standalone:!1},e){const n=Array.from(this.annotationMap.values()).filter((t=>this.filterAnnotation(t)||t instanceof B)).map((e=>e.renderStyle(t))).filter(o);return e&&e.length>0?this.mergeAnnotationStyles(n,e):n.reduce(((t,e)=>Object.assign(Object.assign({},t),e)),{})}filterAnnotation(t){return"block"===this.dtoType?t instanceof f:t instanceof b}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}}!function(t){t.TEXT="TEXT",t.IMAGE="IMAGE",t.CODE_BLOCK_NODE="CODE_BLOCK_NODE"}(w||(w={}));class RTENode{constructor(t,e){this.annotationMap=new Map,this.id=t,e&&(this.annotationMap=e)}static from(t,e,n){throw new Error(`[Vega] ${this.constructor.name}.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 C.from(e);case"customClass":return k.from(e);case"customStyle":return B.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 _(this).toJSON(t,["textDecoration"])}getClasses(t={standalone:!1}){return Array.from(this.annotationMap.values()).filter((t=>t instanceof b||t instanceof k)).map((e=>e.renderClass(t))).filter(o).reduce(((t,e)=>[t,e].join(" ").trim()),"")}getCustomAttributesAnnotation(){return this.annotationMap.get(x.CUSTOM_ATTRIBUTE)}isTextNode(){return!1}getElementRef(){return T.getDOMByEntity(this)}generateAttributeString(...t){var e;const n=new _(this).toCssText({standalone:!0},["textDecoration"]),s=this.annotationMap.get(x.CUSTOM_CLASS),r=[...(null===(e=this.getCustomAttributesAnnotation())||void 0===e?void 0:e.toString(t))||[],null==s?void 0:s.toString(),n?`style="${n}"`:null,...t].filter(o);return r.length?` ${r.join(" ")}`:""}doApply(t){t instanceof m?this.doModifyActionApply(t):this.doAnnotationActionApply(t)}flushChange(){const s=T.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){}}const L=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 RTEBlock)this.RTE_BLOCK_DTO_CLASS_MAP.set(t,e);else{if(!(e.prototype instanceof RTENode))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 RTEBlock{constructor(t){this.annotationMap=new Map,this.id=t}static from(t,e){throw new Error(`[Vega] ${this.constructor.name}.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=L.getRTEBlockClass(t.type);if(s){const r=s.from(t,e);return r.parent=n,r}})).filter(o)}static createAnnotationEntity(t,e){switch(t){case"textAlign":return N.from(e);case"indent":return y.from(e);case"customAttribute":return C.from(e);case"customClass":return k.from(e);case"customStyle":return B.from(e);case"internalWrapper":return v.from(e)}}static convertAnnotationsToMap(t,e){Object.entries(e).forEach((([e,n])=>{const s=this.createAnnotationEntity(e,n);o(s)&&t.set(...s)}))}shouldRenderAsInternalWrapper(){const t=this.getAnnotationByType(d.INTERNAL_WRAPPER);return!!t&&t.internalWrapper&&0===Array.from(this.annotationMap.values()).filter((t=>!(t instanceof A||t instanceof v))).length}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof f||t instanceof S)).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=T.getDOMByEntity(this);if(s){const r=e.getSubjectFromParentNodeByEventId(s,n);r&&t.notify(r,{})}}}isListItemBlock(){return"list-item"===this.type}getStyles(t={standalone:!1}){const e=new _(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 f||t instanceof k)).map((e=>e.renderClass(t))).filter(o).reduce(((t,e)=>[t,e].join(" ").trim()),"")}getCustomAttributesAnnotation(){return this.annotationMap.get(x.CUSTOM_ATTRIBUTE)}generateAttributeString(...t){var e;const n=new _(this).toCssText({standalone:!0}),s=this.annotationMap.get(x.CUSTOM_CLASS),r=[...(null===(e=this.getCustomAttributesAnnotation())||void 0===e?void 0:e.toString(t))||[],null==s?void 0:s.toString(),n?`style="${n}"`:null,...t].filter(o);return r.length?` ${r.join(" ")}`:""}doApply(t){t instanceof m?O.executeTheStrategy(t,this):this.applyAnnotationAction(t)}applyAnnotationAction(t){const e=t.toAnnotation();e instanceof A||this.annotationMap.set(e.type,e),"function"==typeof this.doAnnotationActionApply&&this.doAnnotationActionApply(t)}cloneAnnotations(){return new Map(Array.from(this.annotationMap.entries()).map((([t,e])=>[t,e.clone()])))}}class I{}class D extends I{constructor(){super(...arguments),this.doSplit=!0}}class $ extends p{constructor(t){super(),this.type=u.SELECTION_RANGE,this.range=t}clone(){return new $(this.range)}}class M extends b{constructor(t){super(),this.type=g.STRIKETHROUGH,this.strikethrough=t}static from(t){return[g.STRIKETHROUGH,new M(t)]}toJSON(){return{strikethrough:this.strikethrough}}clone(){return new M(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 j extends b{constructor(t){super(),this.type=g.UNDERLINE,this.underline=t}static from(t){return[g.UNDERLINE,new j(t)]}toJSON(){return{underline:this.underline}}clone(){return new j(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 P extends b{constructor(t){super(),this.type=g.ITALIC,this.italic=t}static from(t){return[g.ITALIC,new P(t)]}toJSON(){return{italic:this.italic}}clone(){return new P(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 F extends b{constructor(t){super(),this.type=g.BOLD,this.bold=t}static from(t){return[g.BOLD,new F(t)]}toJSON(){return{bold:this.bold}}clone(){return new F(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 H extends b{constructor(t,e=!0){super(),this.type=g.CODE,this.code=t,this.useInternalStyle=e}static from(t,e){return[g.CODE,new H(t,e)]}toJSON(){return{code:this.code}}clone(){return new H(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?{fontFamily:"Roboto Mono",whiteSpace:"pre-wrap"}:null}}const W={key:"black",light:"#111128",dark:"#E3E3E8"},J=[W,{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"}],K="​",U=[["textStyles"],["bold","italic","underline","strikethrough","code"],["textColor"],["horizontalAlignment","bulletsNumbers"],["moreIndent","lessIndent"],["link"],["image"],["clearStyle"]];class G extends b{constructor(t){super(),this.type=g.TEXT_COLOR,this.textColor=this.formatTextColor(t)}static from(t){return[g.TEXT_COLOR,new G(t)]}toJSON(){return{textColor:this.textColor.key}}clone(){return new G(this.textColor.key)}renderClass(){return null}renderStyle(){return{color:a.isDarkMode()?this.textColor.dark:this.textColor.light}}formatTextColor(t){return J.find((e=>e.key===t))||J[0]}}class z extends b{constructor(t,e=!0){super(),this.type=g.LINK,this.link=t,this.useInternalStyle=e}static from(t,e=!0){return[g.LINK,new z(t,e)]}toJSON(){return{link:this.link}}clone(){return new z(this.link,this.useInternalStyle)}toEqual(t){return this.link.groupKey===t.link.groupKey}renderClass(){return null}renderStyle(){return null}}class V extends I{constructor(t,e,n){super(),this.isFlushable=!1,this.groupKey=t,this.nodes=e,this.type=n}toAnnotation(){return new A(this.groupKey)}}class X extends I{constructor(){super(),this.isFlushable=!1}toAnnotation(){return null}}class q{execute(t,e){return i.log(`Executing action ${t.constructor.name} on ${e.constructor.name} ${e.id}`),this.handleAction(t,e)}updateCustomStyleAnnotation(t,e){const n=t.annotationMap.get(x.CUSTOM_STYLE);n&&this.isCustomStyle(n,e)&&t.annotationMap.set(n.type,new B(n.removeStyles(e)))}createNewParagraph(t){const e=L.getRTEBlockClass("paragraph");if(e)return e.from({id:c(),type:"paragraph",nodes:[{id:c(),type:"text",text:t}]})}getRootContent(t){const e=t.parent;if(e)return"VegaRTEContent"===e.constructor.name?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)}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 Y extends m{constructor(t){super(),this.type=E.LINK_GROUP_NODE_SPLIT,this.splittedTextNodes=t}}class Q extends q{constructor(){super(...arguments),this.applyTargetNode=null}handleAction(t,e){const n=e.getAnnotationByType(u.SELECTION_RANGE);if(this.setApplyTargetNode(null),t instanceof D&&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 Y(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&&T.getEntityByDOM(i),l=o&&T.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 Z extends D{constructor(t){super(),this.isFlushable=!0,this.bold=t}toAnnotation(){return new F(this.bold)}}class tt extends p{constructor(){super(...arguments),this.type=u.CLEAR_FORMATTING,this.items=[g.BOLD,g.ITALIC,g.UNDERLINE,g.STRIKETHROUGH,g.TEXT_COLOR,g.CODE,x.CUSTOM_STYLE]}}class et extends D{constructor(){super(...arguments),this.isFlushable=!0}toAnnotation(){return new tt}}class nt extends D{constructor(t){super(),this.isFlushable=!0,this.code=t}toAnnotation(){return new H(this.code)}}class st extends I{constructor(t){super(),this.isFlushable=!0,this.annotationType=t}toAnnotation(){}}class rt extends D{constructor(t){super(),this.isFlushable=!0,this.italic=t}toAnnotation(){return new P(this.italic)}}class it extends D{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,o(s)&&(this.doSplit=s)}toAnnotation(){return new z(this.link)}}class ot extends D{constructor(t){super(),this.isFlushable=!0,this.strikethrough=t}toAnnotation(){return new M(this.strikethrough)}}class ct extends D{constructor(t){super(),this.isFlushable=!0,this.underline=t}toAnnotation(){return new j(this.underline)}}class at extends q{handleAction(t,e){const n=t.toAnnotation();if(t instanceof st)e.annotationMap.delete(t.annotationType);else{if(!(n instanceof tt))return n instanceof b||n instanceof $?(t instanceof it&&(o(t.newText)&&(e.text=t.newText),e.parent.apply(new V(t.link.groupKey,[e],t.type))),t instanceof nt&&this.handleAction(new et,e),t instanceof Z&&this.updateCustomStyleAnnotation(e,["fontWeight"]),t instanceof rt&&this.updateCustomStyleAnnotation(e,["fontStyle"]),(t instanceof ct||t instanceof ot)&&this.updateCustomStyleAnnotation(e,["textDecoration"]),void e.annotationMap.set(n.type,n)):void 0;n.items.forEach((t=>{e.deleteAnnotationByType(t)}))}}}class lt extends m{constructor(){super(...arguments),this.type=E.DELETE_LINK_GROUP}}class ht extends q{handleAction(t,e){e.text=t.newTextContent,!e.text&&e.annotationMap.has("LINK")&&e.apply(new lt)}}class ut extends m{constructor(t){super(),this.type=E.UPDATE_TEXT,this.newTextContent="",this.newTextContent=t}}class dt extends q{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&&T.getEntityByDOM(e),h=a&&T.getEntityByDOM(a);let u=0,d=n.text.length;l&&l===n?(u=i,d=s===r?o:d):h&&h===n&&(d=o),c=n.text.slice(0,u)+t+n.text.slice(d)}n.apply(new ut(c))}}}class pt extends p{constructor(t){super(),this.type=g.INLINE_HTML,this.htmlTag=t}static from(t){const{htmlTag:e,child:n,customStyle:s,customClass:r,customAttribute:i}=t,o=new pt(e);return o.child=n?pt.from(n)[1]:void 0,o.customAttribute=i?C.from(i)[1]:void 0,o.customClass=r?k.from(r)[1]:void 0,o.customStyle=s?B.from(s)[1]:void 0,[g.INLINE_HTML,o]}clone(){var t,e,n,s;const r=new pt(this.htmlTag);return 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}toJSON(){var t,e,n,s;return{inlineHtml:l({htmlTag:this.htmlTag,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 ft extends q{handleAction(t,e){const n=e.parent.getAnnotationByType(u.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 Tt extends q{handleAction(t,e){const n=e.parent.getAnnotationByType(u.LINK_GROUP);if(n){const t=e.annotationMap.get(g.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(u.LINK_GROUP)}}e.annotationMap.delete(g.LINK)}}class Et extends b{constructor(t){super(),this.type=g.PLAIN_TEXT,this.plainText=!0,this.plainText=t}static from(t){return[g.PLAIN_TEXT,new Et(t)]}clone(){return new Et(this.plainText)}renderClass(){}renderStyle(){}toJSON(){return{plainText:this.plainText}}}class xt extends D{constructor(t){super(),this.isFlushable=!0,this.textColor=t}toAnnotation(){return new G(this.textColor)}}class RTETextNode extends RTENode{constructor(t,e,n,s){super(t,s),this.type=w.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 RTETextNode(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 V(t.link.groupKey,[s],"link")),this.createAnnotationEntity(r,t[r],e)))).filter(o))}static createAnnotationEntity(t,e,n){const s=!(!n||!n.autoMatchFormat);switch(t){case"bold":return F.from(e);case"italic":return P.from(e);case"underline":return j.from(e);case"strikethrough":return M.from(e);case"code":return H.from(e,s);case"textColor":return G.from(e);case"link":return z.from(e,s);case"inlineHtml":return pt.from(e);case"plainText":return Et.from(e)}return RTENode.createAnnotationEntity(t,e)}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof b||t instanceof S||t instanceof pt)).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(){const t=this.getAnnotationByType(g.INLINE_HTML);return t?this.renderWithWrapperStr(t):this.renderTextStr()}cloneWithText(t){return new RTETextNode(c(),t,this.parent,super.cloneAnnotations())}clone(t){return new RTETextNode(this.id,this.text,t,super.cloneAnnotations())}isEmpty(){return!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}registerModifyStrategy(){const t=this.constructor.name;RTETextNode.registerActionStrategyStatus[t]||(this.isContentEditable()&&(O.register(E.UPDATE_TEXT,t,new ht),O.register(E.REPLACE_SELECTED_TEXT,t,new dt),O.register(E.LINK_GROUP_NODE_SPLIT,t,new ft),O.register(it.name,t,new at)),O.register(D.name,t,new Q),O.register(E.DELETE_LINK_GROUP,t,new Tt),O.register(Z.name,t,new at),O.register(et.name,t,new at),O.register(rt.name,t,new at),O.register(ct.name,t,new at),O.register(xt.name,t,new at),O.register(ot.name,t,new at),O.register(nt.name,t,new at),O.register(I.name,t,new at),RTETextNode.registerActionStrategyStatus[t]=!0)}doAnnotationActionApply(t){const e=this.getAnnotationByType(u.SELECTION_RANGE);if(t instanceof D&&t.doSplit&&e){const e=O.get(D.name,this.constructor.name);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){O.executeTheStrategy(t,this)}applyActionToNode(t,e){const n=e.toAnnotation();if(e instanceof X)return void this.syncUpSelectedNodes(t);n instanceof $||this.syncUpSelectedNodes(t);const s=O.get(e.constructor.name,t.constructor.name);if(s)return void s.execute(e,t);const r=O.get(I.name,RTETextNode.name);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){const{htmlTag:e,customAttribute:n,customClass:s,customStyle:r,child:i}=t,c=[...(null==n?void 0:n.toString())||[],null==s?void 0:s.toString(),null==r?void 0:r.toString()].filter(o),a=c.length>0?` ${c.join(" ")}`:"";return i?`<${e}${a}>${this.renderWithWrapperStr(i)}</${e}>`:`<${e}${a}>${this.renderTextStr()}</${e}>`}renderTextStr(){var t;const e=(null===(t=this.getAnnotationByType(g.CODE))||void 0===t?void 0:t.code)?"code":"span",n=super.generateAttributeString();return"\n"===this.text?"<br>":this.shouldRenderAsPlainText()?this.text:`<${e}${n}>${this.text}</${e}>`}shouldRenderAsPlainText(){const t=super.getAnnotationByType(g.PLAIN_TEXT);return!!t&&t.plainText&&0===Array.from(this.annotationMap.values()).filter((t=>t instanceof b&&!(t instanceof z)&&!(t instanceof Et)||t instanceof S)).length}}RTETextNode.registerActionStrategyStatus={},RTETextNode.htmlTag="span";class gt extends m{constructor(t){super(),this.type=E.APPEND_CHILDREN,this.entityToBeAppended=t}}class wt extends f{constructor(t){super(),this.type=d.TEXT_STYLE,this.textStyle=t}static from(t){return[d.TEXT_STYLE,new wt(t)]}toJSON(){return{textStyle:this.textStyle}}clone(){return new wt(this.textStyle)}renderClass(t){return(null==t?void 0:t.standalone)?null:this.textStyle?`v-rte--text-style-${this.textStyle}`:null}renderStyle(t){if(!(null==t?void 0:t.standalone))return null;const e={fontFamily:"Inter",fontSize:"16px",lineHeight:"22px",fontWeight:"500",marginTop:"0px",marginBottom:"0px"};switch(this.textStyle){case"paragraph":return e;case"title":return{fontFamily:"Inter",fontSize:"36px",lineHeight:"40px",fontWeight:"500"};case"subtitle":return{fontFamily:"Inter",fontSize:"28px",lineHeight:"32px",fontWeight:"500"};case"heading-1":return{fontFamily:"Inter",fontSize:"22px",lineHeight:"24px",fontWeight:"500",marginTop:"0px",marginBottom:"0px"};case"heading-2":return{fontFamily:"Inter",fontSize:"20px",lineHeight:"24px",fontWeight:"500",marginTop:"0px",marginBottom:"0px"};case"heading-3":return{fontFamily:"Inter",fontSize:"18px",lineHeight:"22px",fontWeight:"500",marginTop:"0px",marginBottom:"0px"};case"heading-4":return{fontFamily:"Inter",fontSize:"16px",lineHeight:"22px",fontWeight:"500",marginTop:"0px",marginBottom:"0px"};case"heading-5":return{fontFamily:"Inter",fontSize:"14px",lineHeight:"22px",fontWeight:"500",marginTop:"0px",marginBottom:"0px"};case"heading-6":return{fontFamily:"Inter",fontSize:"12px",lineHeight:"22px",fontWeight:"500",marginTop:"0px",marginBottom:"0px"}}}}class mt extends I{constructor(t,e){super(),this.isFlushable=!0,this.textStyle=t,this.bold=e}toAnnotation(){return new wt(this.textStyle)}}class At extends q{handleAction(t,e){"list-item"!==e.type&&(e.type=t.textStyle),e.children.forEach(t.bold?t=>{const e=new Z(!0);e.doSplit=!1,t.apply(e)}:t=>{t.apply(new st(g.BOLD))}),this.updateCustomStyleAnnotation(e,["fontFamily","lineHeight","fontWeight","fontSize"])}}class Nt extends m{constructor(t,...e){super(),this.type=E.INSERT_CHILDREN_AFTER,this.referChildren=t,this.childrenToBeInserted=e}}class yt extends m{constructor(t){super(),this.type=E.REPLACE_CHILD_NODES,this.newChildNodes=t}}class Rt extends q{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 e=n.children.slice(0,i),o=n.children.slice(i+1);s&&e.push(t.cloneWithText(s)),r&&o.unshift(t.cloneWithText(r)),n.apply(new yt(e));const c=n.cloneWithNodes(o);return n.parent.apply(new Nt(n,c)),c}}}}class Ot extends q{handleAction(t,e){e.children=[],e.apply(new gt(t.newChildNodes))}}class St extends m{constructor(t){super(),this.type=E.DELETE_CHILDREN,this.entityToBeRemoved=t}}class Ct extends q{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 gt(t)),n.parent.apply(new St(n))}}}class kt extends q{handleAction(t,e){t.lineBreakNode=this.lineBreakSingleBlock(t.startContainerNode,t.startOffset,e)}lineBreakSingleBlock(t,e,n){if(t){const s=new RTETextNode(c(),"\n",n),r=t.text.slice(0,e),i=t.text.slice(e),o=n.children.indexOf(t);if(o>-1){const e=n.children.slice(0,o),c=n.children.slice(o+1);r&&e.push(t.cloneWithText(r)),i&&c.unshift(t.cloneWithText(i)),this.mergeLineBreakNodes(e,s,c,n)}return s}}mergeLineBreakNodes(t,e,n,s){(0===n.length||n[0]&&""===n[0].text)&&n.push(new RTETextNode(c(),"\n",s,t[t.length-1]&&t[t.length-1].annotationMap)),s.apply(new yt([...t,e,...n]))}}class Bt extends q{handleAction(t,e){t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks,e)}lineBreakMultipleBlocks(t,e){const n=e.children,s=new RTETextNode(c(),"\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 St(t)))})),e}mergeLineBreakNodes(t,e,n,s){(0===n.length||n[0]&&""===n[0].text)&&n.push(new RTETextNode(c(),"\n",s,t[t.length-1]&&t[t.length-1].annotationMap)),s.apply(new yt([...t,e,...n]))}}class vt extends m{constructor(t,...e){super(),this.type=E.INSERT_CHILDREN_BEFORE,this.referChildren=t,this.childrenToBeInserted=e}}class bt extends m{constructor(t,e){super(),this.type=E.SPLIT_BLOCK_WITH_NODE,this.splitPointNode=t,this.startOffsetOfNode=e}}class _t extends I{constructor(t){super(),this.isFlushable=!0,this.textAlign=t}toAnnotation(){return new N(this.textAlign)}}class Lt extends q{handleAction(t,e){this.updateCustomStyleAnnotation(e,["textAlign"])}}class It extends I{constructor(t){super(),this.isFlushable=!0,this.indent=t}toAnnotation(){return new y(this.indent)}}class RTETextBlock extends RTEBlock{constructor(t,e,n){super(t),this.children=[],this.type=e;const{autoMatchFormat:s}=n||{autoMatchFormat:!0};s&&(this.annotationMap=RTETextBlock.isAcceptableTextStyle(e)?new Map([wt.from(e)]):new Map([wt.from("paragraph")]))}static from(t,e={autoMatchFormat:!0}){var n,s;const r=new RTETextBlock(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=t.nodes.map((t=>{const n=L.getRTENodeClass(t.type);if(n)return n.from(t,r,e)})).filter(o),i&&super.convertAnnotationsToMap(r.annotationMap,i),r}static createAnnotationEntity(t,e){return"textStyle"===t?wt.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 it&&t.needMergeNode){const t=null==s?void 0:s.getAnnotationByType(g.LINK),r=n.getAnnotationByType(g.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(){const t=this.getBlockTag(),e=super.generateAttributeString(),n=this.getChildrenHtml();return super.shouldRenderAsInternalWrapper()?n:[`<${t}${e}>`,n,`</${t}>`].join("")}cloneWithNodes(t){const e=new RTETextBlock(c(),this.type);return e.annotationMap=super.cloneAnnotations(),e.apply(new gt(t)),e}clone(t){const e=new RTETextBlock(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(){const t=this.getAnnotationByType(u.LINK_GROUP);let e=this.children.map((t=>t.toHtml())).join("");return t&&this.children.length>0&&(e=this.generateLinkHtml(t,e)),e}doAnnotationActionApply(t){const e=O.get(t.constructor.name,RTETextBlock.name);e&&e.execute(t,this)}generateLinkHtml(t,e){e="";let n=[];for(let s=0;s<this.children.length;s++){const r=this.children[s].getAnnotationByType(g.LINK),i=this.children[s+1]?this.children[s+1].getAnnotationByType(g.LINK):null;if(r){if(n.push(this.children[s]),!i||r.link.groupKey!==i.link.groupKey){const s=t.toString(r,{standalone:!0});e+=[`<a${s?` ${s}`:""}>`,n.map((t=>t.toHtml())).join(""),"</a>"].join(""),n=[]}}else e+=this.children[s].toHtml()}return e}}O.register(mt.name,RTETextBlock.name,new At),O.register(_t.name,RTETextBlock.name,new Lt),O.register(It.name,RTETextBlock.name,new class extends q{handleAction(t,e){this.updateCustomStyleAnnotation(e,["marginLeft"])}}),O.register(V.name,RTETextBlock.name,new class extends q{handleAction(t,e){let n=e.getAnnotationByType(u.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(u.LINK_GROUP,n)}}}),O.register(E.UNLINK_LINK_GROUP,RTETextBlock.name,new class extends q{handleAction(t,e){const n=e.getAnnotationByType(u.LINK_GROUP);n&&(n.linkGroups.size>1?n.linkGroups.delete(t.groupKey):e.annotationMap.delete(u.LINK_GROUP))}}),O.register(E.SPLIT_BLOCK_WITH_NODE,RTETextBlock.name,new Rt),O.register(E.REPLACE_CHILD_NODES,RTETextBlock.name,new Ot),O.register(E.MERGE_TWO_BLOCKS_NODES,RTETextBlock.name,new Ct),O.register(E.LINE_BREAK_SINGLE_BLOCK,RTETextBlock.name,new kt),O.register(E.LINE_BREAK_MULTIPLE_BLOCKS,RTETextBlock.name,new Bt),O.register(E.INSERT_IMAGE_TO_BLOCK,RTETextBlock.name,new class extends q{handleAction(t,e){const n=t.splitPointNode,s=t.startOffsetOfNode,r=t.imageBlockToBeInserted;if(this.isCaretPositionAtBlockEnd(e,n,s))e.parent.apply(new Nt(e,r));else if(this.isCaretPositionAtBlockStart(e,n,s))e.parent.apply(new vt(e,r));else{const t=new bt(n,s);e.apply(t),e.parent.apply(new Nt(e,r))}}}),O.register(E.TRANSFORM_LIST_BLOCK,RTETextBlock.name,new class extends q{handleAction(t,e){const n=e.parent,s=n.createList(t.listType),r=t.selectedBlocks,i=r.map((t=>n.toListItem(t)));s.apply(new gt(i)),n.apply(new Nt(t.selectedBlocks[0],s)),r.forEach((t=>{t.parent.apply(new St(t))}))}});class Dt extends q{getPreviousNode(t){const e=t.parent,n=e.children.indexOf(t);if(n>0)return e.children[n-1];if(e.parent){const t=this.getPreviousBlock(e);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){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.constructor.name}}class $t extends m{constructor(t,e){super(),this.isFlushable=!0,this.type=E.UPDATE_CODE_BLOCK,this.content=t,this.language=e}}class Mt extends I{constructor(t){super(),this.isFlushable=!1,this.range=t}toAnnotation(){return new $(this.range)}}class RTEDecoratorNode extends RTENode{constructor(){super(...arguments),this.type="decorator-node",this.isSelected=!1}static isDecoratorNodeContainerElement(t){return t&&t.classList.contains(RTEDecoratorNode.DECORATOR_CONTAINER_CLASS)}static getDecoratorNodeElement(t){return t.querySelector(`.${RTEDecoratorNode.DECORATOR_NODE_CLASS}`)}getRangeEndOffset(){return 1}getRangeContainer(){const t=this.getElementRef();if(t)return h(t,`.${RTEDecoratorNode.DECORATOR_CONTAINER_CLASS}`)}isContentEditable(){return!1}}RTEDecoratorNode.DECORATOR_CONTAINER_CLASS="v-internal-decorator-container",RTEDecoratorNode.DECORATOR_NODE_CLASS="v-internal-decorator-node";class RTECodeBlockNode extends RTEDecoratorNode{constructor(t,e,n,s){super(t),this.type=w.CODE_BLOCK_NODE,this.text="",this.annotationMap=new Map,this.text=e,this.parent=s,this.language=n}toJSON(){return{id:this.id,type:"text",text:this.text,language:this.language}}toHtml(){return`<code style='box-sizing: border-box;color: rgba(var(--v-text-primary, 32, 54, 69, 1));text-align: left;font-family: "Roboto Mono";font-weight: 400;line-height: 22px;font-size: 16px;white-space: pre-wrap;min-height: 22px;tab-size: 2px;'>${this.text}</code>`}clone(t){return new RTECodeBlockNode(this.id,this.text,this.language,t)}doAnnotationActionApply(t){O.executeTheStrategy(t,this)}doModifyActionApply(t){O.executeTheStrategy(t,this)}}O.register(E.UPDATE_CODE_BLOCK,RTECodeBlockNode.name,new class extends q{handleAction(t,e){const{content:n,language:s}=t;e.language=s,e.text=n}}),O.register(Mt.name,RTECodeBlockNode.name,new class extends q{handleAction(t,e){e.annotationMap.set(u.SELECTION_RANGE,t.toAnnotation())}});var jt;!function(t){t.CSS="css",t.HTML="html",t.JavaScript="js",t.JSX="jsx",t["Plain Text"]="plainText",t.TypeScript="ts",t.TSX="tsx"}(jt||(jt={}));class Pt extends q{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 St(e)))}}class RTECodeBlock extends RTEBlock{constructor(t,e,n){super(t),this.type="code-block",this.children=[new RTECodeBlockNode(`${t}-1`,e,n,this)]}static from(t){return new RTECodeBlock(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(){const{language:t=jt["Plain Text"]}=this.children[0];return`<pre data-language="${t}" style="background-color: rgba(var(--v-bg-secondary, 245, 247, 247, 1)); padding: 12px">${this.children.map((t=>t.toHtml()))}</pre>`}clone(t){const e=RTECodeBlock.from(this.toJSON());return e.parent=t,e}apply(s){if(s instanceof m&&O.executeTheStrategy(s,this),s.isFlushable){const s=T.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(u.SELECTION_RANGE)}}O.register(E.DELETE_CODE_BLOCK,RTECodeBlock.name,new class extends Dt{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 St(e));const i=t?T.getDOMByEntity(t):null;if(0===s.children.length){const n=RTETextBlock.from({id:c(),type:"paragraph",nodes:[{id:c(),type:"text",text:""}]});e.parent.apply(new gt([n])),t=n.children[0],r=0}this.notifyUpdateSelection(t,i,r,e)}}notifyUpdateSelection(n,r,i,o){const c=T.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}}),O.register(E.DELETE_CHILDREN,RTECodeBlock.name,new Pt),O.register(E.SWITCH_OUT_FROM_CODE_BLOCK,RTECodeBlock.name,new class extends q{handleAction(n,r){const{content:i,language:o}=n,a=i.split("\n"),l=new $t(a.slice(0,a.length-2).join("\n"),o);l.isFlushable=!1,r.children[0].apply(l);const h=RTETextBlock.from({id:c(),type:"paragraph",nodes:[{id:c(),text:"",type:"text"}]});r.parent.apply(new Nt(r,h));const u=T.getDOMByEntity(r);if(u){const n=e.getSubjectFromParentNodeByEventId(u,s);n&&t.notify(n,{node:h.children[0]})}}}),O.register(E.INSERT_IMAGE_TO_BLOCK,RTECodeBlock.name,new class extends q{handleAction(t,e){e.parent.apply(new Nt(e,t.imageBlockToBeInserted))}}),RTECodeBlock.CODE_BLOCK_PLACEHOLDER_CLASS_NAME="code-block-placeholder-element";export{xt as $,O as A,At as B,B as C,w as D,S as E,I as F,yt as G,_t as H,Nt as I,bt as J,Dt as K,Pt as L,m as M,b as N,J as O,W as P,jt as Q,L as R,X as S,mt as T,ut as U,U as V,it as W,x as X,$t as Y,K as Z,Mt as _,R as a,RTECodeBlockNode as a0,Z as a1,rt as a2,ct as a3,wt as a4,F as a5,et as a6,nt as a7,ot as a8,It as a9,RTETextNode as b,E as c,q as d,RTETextBlock as e,RTEBlock as f,_ as g,gt as h,RTENode as i,vt as j,u as k,Lt as l,kt as m,Bt as n,Rt as o,Ot as p,Ct as q,St as r,T as s,f as t,d as u,k as v,C as w,RTECodeBlock as x,g as y,RTEDecoratorNode as z}